Remove double checks
This commit is contained in:
parent
5444655237
commit
9ac462c390
|
@ -28,8 +28,7 @@
|
||||||
showAvatars={false}
|
showAvatars={false}
|
||||||
on:updatedatasource={handleGridViewUpdate}
|
on:updatedatasource={handleGridViewUpdate}
|
||||||
isCloud={$admin.cloud}
|
isCloud={$admin.cloud}
|
||||||
showReadonlyColumnsOptions
|
allowViewReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
|
||||||
canSetReadonlyColumns={$licensing.isViewReadonlyColumnsEnabled}
|
|
||||||
>
|
>
|
||||||
<svelte:fragment slot="filter">
|
<svelte:fragment slot="filter">
|
||||||
<GridFilterButton />
|
<GridFilterButton />
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
import { getColumnIcon } from "../lib/utils"
|
import { getColumnIcon } from "../lib/utils"
|
||||||
import ToggleActionButtonGroup from "./ToggleActionButtonGroup.svelte"
|
import ToggleActionButtonGroup from "./ToggleActionButtonGroup.svelte"
|
||||||
|
|
||||||
export let showReadonlyColumnsOptions = false
|
export let allowViewReadonlyColumns = false
|
||||||
export let canSetReadonlyColumns = false
|
|
||||||
|
|
||||||
const { columns, datasource, stickyColumn, dispatch } = getContext("grid")
|
const { columns, datasource, stickyColumn, dispatch } = getContext("grid")
|
||||||
|
|
||||||
|
@ -43,10 +42,10 @@
|
||||||
$: READONLY_OPTION = {
|
$: READONLY_OPTION = {
|
||||||
icon: "Visibility",
|
icon: "Visibility",
|
||||||
value: PERMISSION_OPTIONS.READONLY,
|
value: PERMISSION_OPTIONS.READONLY,
|
||||||
tooltip: canSetReadonlyColumns
|
tooltip: allowViewReadonlyColumns
|
||||||
? "Read only"
|
? "Read only"
|
||||||
: "Read only (premium feature)",
|
: "Read only (premium feature)",
|
||||||
disabled: !canSetReadonlyColumns,
|
disabled: !allowViewReadonlyColumns,
|
||||||
}
|
}
|
||||||
const HIDDEN_OPTION = {
|
const HIDDEN_OPTION = {
|
||||||
icon: "VisibilityOff",
|
icon: "VisibilityOff",
|
||||||
|
@ -54,9 +53,10 @@
|
||||||
tooltip: "Hidden",
|
tooltip: "Hidden",
|
||||||
}
|
}
|
||||||
|
|
||||||
$: options = showReadonlyColumnsOptions
|
$: options =
|
||||||
? [EDIT_OPTION, READONLY_OPTION, HIDDEN_OPTION]
|
$datasource.type === "viewV2"
|
||||||
: [EDIT_OPTION, HIDDEN_OPTION]
|
? [EDIT_OPTION, READONLY_OPTION, HIDDEN_OPTION]
|
||||||
|
: [EDIT_OPTION, HIDDEN_OPTION]
|
||||||
|
|
||||||
function columnToPermissionOptions(column) {
|
function columnToPermissionOptions(column) {
|
||||||
if (!column.visible) {
|
if (!column.visible) {
|
||||||
|
|
|
@ -57,8 +57,7 @@
|
||||||
export let buttons = null
|
export let buttons = null
|
||||||
export let darkMode
|
export let darkMode
|
||||||
export let isCloud = null
|
export let isCloud = null
|
||||||
export let showReadonlyColumnsOptions = false
|
export let allowViewReadonlyColumns = false
|
||||||
export let canSetReadonlyColumns = false
|
|
||||||
|
|
||||||
// Unique identifier for DOM nodes inside this instance
|
// Unique identifier for DOM nodes inside this instance
|
||||||
const gridID = `grid-${Math.random().toString().slice(2)}`
|
const gridID = `grid-${Math.random().toString().slice(2)}`
|
||||||
|
@ -155,10 +154,7 @@
|
||||||
<div class="controls-left">
|
<div class="controls-left">
|
||||||
<slot name="filter" />
|
<slot name="filter" />
|
||||||
<SortButton />
|
<SortButton />
|
||||||
<ColumnsSettingButton
|
<ColumnsSettingButton {allowViewReadonlyColumns} />
|
||||||
{showReadonlyColumnsOptions}
|
|
||||||
{canSetReadonlyColumns}
|
|
||||||
/>
|
|
||||||
<SizeButton />
|
<SizeButton />
|
||||||
<slot name="controls" />
|
<slot name="controls" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue