@globalbrain/sefirot 3.37.0 → 3.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -163,7 +163,11 @@ function onClick() {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
.SInputCheckbox.disabled {
|
|
166
|
-
.
|
|
166
|
+
.input {
|
|
167
|
+
cursor: not-allowed;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.input .box {
|
|
167
171
|
border-color: var(--input-disabled-border-color);
|
|
168
172
|
background-color: var(--input-disabled-bg-color);
|
|
169
173
|
|
|
@@ -171,6 +175,13 @@ function onClick() {
|
|
|
171
175
|
&:focus:not(:focus-visible) { border-color: var(--input-disabled-border-color); }
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
.input {
|
|
178
|
+
.input.on .box {
|
|
179
|
+
border-color: var(--c-border-info-1);
|
|
180
|
+
background-color: var(--c-blue-8);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.check-icon {
|
|
184
|
+
color: var(--c-white-a3);
|
|
185
|
+
}
|
|
175
186
|
}
|
|
176
187
|
</style>
|
|
@@ -141,7 +141,11 @@ function onClick() {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
.SInputRadio.disabled {
|
|
144
|
-
.
|
|
144
|
+
.input {
|
|
145
|
+
cursor: not-allowed;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.input .box {
|
|
145
149
|
border-color: var(--input-disabled-border-color);
|
|
146
150
|
background-color: var(--input-disabled-bg-color);
|
|
147
151
|
|
|
@@ -149,6 +153,12 @@ function onClick() {
|
|
|
149
153
|
&:focus:not(:focus-visible) { border-color: var(--input-disabled-border-color); }
|
|
150
154
|
}
|
|
151
155
|
|
|
152
|
-
.input {
|
|
156
|
+
.input.on .box {
|
|
157
|
+
border-color: var(--c-border-info-1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.check {
|
|
161
|
+
background-color: var(--c-blue-9);
|
|
162
|
+
}
|
|
153
163
|
}
|
|
154
164
|
</style>
|
|
@@ -136,19 +136,17 @@ const indexes = computed(() => {
|
|
|
136
136
|
return records.map((record, i) => indexField ? record[indexField] : i)
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
const selectedIndexes = reactive(new Set())
|
|
139
|
+
const selectedIndexes = reactive(new Set(Array.isArray(props.selected) ? props.selected : []))
|
|
140
140
|
|
|
141
141
|
const control = computed({
|
|
142
142
|
get() {
|
|
143
|
-
|
|
144
|
-
return
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
if (Array.isArray(props.selected)) {
|
|
144
|
+
return props.selected.length === indexes.value.length
|
|
145
|
+
? true
|
|
146
|
+
: props.selected.length ? 'indeterminate' : false
|
|
147
|
+
}
|
|
148
148
|
|
|
149
|
-
return
|
|
150
|
-
? true
|
|
151
|
-
: selected.length ? 'indeterminate' : false
|
|
149
|
+
return 'indeterminate' // doesn't matter
|
|
152
150
|
},
|
|
153
151
|
|
|
154
152
|
set(newValue) {
|
|
@@ -170,6 +168,12 @@ watch(indexes, (newValue, oldValue) => {
|
|
|
170
168
|
}
|
|
171
169
|
})
|
|
172
170
|
|
|
171
|
+
watch(selectedIndexes, (newValue) => {
|
|
172
|
+
if (Array.isArray(props.selected)) {
|
|
173
|
+
updateSelected(Array.from(newValue))
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
|
|
173
177
|
const virtualizerOptions = computed(() => ({
|
|
174
178
|
count: recordsWithSummary.value.length,
|
|
175
179
|
getScrollElement: () => body.value,
|
|
@@ -390,7 +394,12 @@ function updateSelected(selected: any) {
|
|
|
390
394
|
@resize="(value) => updateColWidth(key, value, true)"
|
|
391
395
|
>
|
|
392
396
|
<SInputCheckbox
|
|
393
|
-
v-if="
|
|
397
|
+
v-if="
|
|
398
|
+
Array.isArray(selected)
|
|
399
|
+
&& key === '__select'
|
|
400
|
+
&& unref(options.records)?.length
|
|
401
|
+
&& options.disableSelection == null
|
|
402
|
+
"
|
|
394
403
|
v-model="control"
|
|
395
404
|
/>
|
|
396
405
|
</STableColumn>
|
|
@@ -450,11 +459,13 @@ function updateSelected(selected: any) {
|
|
|
450
459
|
v-if="Array.isArray(selected)"
|
|
451
460
|
:model-value="selectedIndexes.has(indexes[index])"
|
|
452
461
|
@update:model-value="c => selectedIndexes[c ? 'add' : 'delete'](indexes[index])"
|
|
462
|
+
:disabled="options.disableSelection?.(recordsWithSummary[index]) === true"
|
|
453
463
|
/>
|
|
454
464
|
<SInputRadio
|
|
455
465
|
v-else
|
|
456
466
|
:model-value="selected === indexes[index]"
|
|
457
467
|
@update:model-value="c => updateSelected(c ? indexes[index] : null)"
|
|
468
|
+
:disabled="options.disableSelection?.(recordsWithSummary[index]) === true"
|
|
458
469
|
/>
|
|
459
470
|
</template>
|
|
460
471
|
</STableCell>
|
|
@@ -131,6 +131,10 @@ const computedCell = computed<TableCell | undefined>(() =>
|
|
|
131
131
|
transition: background-color 0.1s;
|
|
132
132
|
overflow: hidden;
|
|
133
133
|
|
|
134
|
+
:where(.row:has(.input.on)) & {
|
|
135
|
+
background-color: var(--c-bg-elv-4);
|
|
136
|
+
}
|
|
137
|
+
|
|
134
138
|
.row:hover & {
|
|
135
139
|
background-color: var(--c-bg-elv-4);
|
|
136
140
|
}
|
package/lib/composables/Table.ts
CHANGED
|
@@ -16,10 +16,11 @@ export interface Table<
|
|
|
16
16
|
loading?: MaybeRef<boolean | undefined>
|
|
17
17
|
rowSize?: MaybeRef<number | undefined>
|
|
18
18
|
borderless?: MaybeRef<boolean>
|
|
19
|
+
disableSelection?: (record: R) => boolean
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @deprecated Use `<SControl>` to add equivalent features.
|
|
22
|
-
|
|
23
|
+
*/
|
|
23
24
|
actions?: MaybeRef<TableHeaderAction[]>
|
|
24
25
|
menu?: MaybeRef<TableMenu[] | TableMenu[][]>
|
|
25
26
|
header?: MaybeRef<boolean | undefined>
|