@globalbrain/sefirot 3.32.0 → 3.33.1
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.
- package/lib/components/SInputRadio.vue +2 -2
- package/lib/components/STable.vue +31 -22
- package/lib/styles/base.css +11 -0
- package/package.json +16 -16
|
@@ -17,7 +17,7 @@ const props = defineProps<{
|
|
|
17
17
|
checkIcon?: IconifyIcon | DefineComponent
|
|
18
18
|
checkText?: string
|
|
19
19
|
checkColor?: Color
|
|
20
|
-
text
|
|
20
|
+
text?: string
|
|
21
21
|
disabled?: boolean
|
|
22
22
|
modelValue: boolean
|
|
23
23
|
validation?: Validatable
|
|
@@ -68,7 +68,7 @@ function onClick() {
|
|
|
68
68
|
<div class="check" />
|
|
69
69
|
</div>
|
|
70
70
|
|
|
71
|
-
<p class="text">{{ text }}</p>
|
|
71
|
+
<p class="text" v-if="text">{{ text }}</p>
|
|
72
72
|
</div>
|
|
73
73
|
</div>
|
|
74
74
|
<template v-if="$slots.info" #info><slot name="info" /></template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
1
|
+
<script setup lang="ts" generic="S extends any[] | any | undefined = undefined">
|
|
2
2
|
import { useVirtualizer } from '@tanstack/vue-virtual'
|
|
3
3
|
import { useResizeObserver } from '@vueuse/core'
|
|
4
4
|
import xor from 'lodash-es/xor'
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { type Table } from '../composables/Table'
|
|
16
16
|
import { getTextWidth } from '../support/Text'
|
|
17
17
|
import SInputCheckbox from './SInputCheckbox.vue'
|
|
18
|
+
import SInputRadio from './SInputRadio.vue'
|
|
18
19
|
import SSpinner from './SSpinner.vue'
|
|
19
20
|
import STableCell from './STableCell.vue'
|
|
20
21
|
import STableColumn from './STableColumn.vue'
|
|
@@ -24,11 +25,11 @@ import STableItem from './STableItem.vue'
|
|
|
24
25
|
|
|
25
26
|
const props = defineProps<{
|
|
26
27
|
options: Table
|
|
27
|
-
selected?:
|
|
28
|
+
selected?: S
|
|
28
29
|
}>()
|
|
29
30
|
|
|
30
31
|
const emit = defineEmits<{
|
|
31
|
-
(e: 'update:selected', value:
|
|
32
|
+
(e: 'update:selected', value: S): void
|
|
32
33
|
}>()
|
|
33
34
|
|
|
34
35
|
const head = shallowRef<HTMLElement | null>(null)
|
|
@@ -41,7 +42,7 @@ const ordersToShow = computed(() => {
|
|
|
41
42
|
const show = unref(props.options.columns)[key]?.show
|
|
42
43
|
return toValue(show) !== false
|
|
43
44
|
})
|
|
44
|
-
if (
|
|
45
|
+
if (props.selected === undefined) {
|
|
45
46
|
return orders
|
|
46
47
|
}
|
|
47
48
|
return ['__select', ...orders]
|
|
@@ -126,7 +127,7 @@ const recordsWithSummary = computed(() => {
|
|
|
126
127
|
})
|
|
127
128
|
|
|
128
129
|
const indexes = computed(() => {
|
|
129
|
-
if (
|
|
130
|
+
if (props.selected === undefined) {
|
|
130
131
|
return []
|
|
131
132
|
}
|
|
132
133
|
const records = unref(props.options.records) ?? []
|
|
@@ -139,9 +140,6 @@ const selectedIndexes = reactive(new Set())
|
|
|
139
140
|
|
|
140
141
|
const control = computed({
|
|
141
142
|
get() {
|
|
142
|
-
if (!props.selected) {
|
|
143
|
-
return false
|
|
144
|
-
}
|
|
145
143
|
const selected = indexes.value.filter((index) => {
|
|
146
144
|
return selectedIndexes.has(index)
|
|
147
145
|
})
|
|
@@ -165,12 +163,11 @@ const control = computed({
|
|
|
165
163
|
})
|
|
166
164
|
|
|
167
165
|
watch(indexes, (newValue, oldValue) => {
|
|
168
|
-
if (
|
|
169
|
-
|
|
166
|
+
if (Array.isArray(props.selected)) {
|
|
167
|
+
xor(newValue, oldValue).forEach((index) => {
|
|
168
|
+
selectedIndexes.delete(index)
|
|
169
|
+
})
|
|
170
170
|
}
|
|
171
|
-
xor(newValue, oldValue).forEach((index) => {
|
|
172
|
-
selectedIndexes.delete(index)
|
|
173
|
-
})
|
|
174
171
|
})
|
|
175
172
|
|
|
176
173
|
const virtualizerOptions = computed(() => ({
|
|
@@ -343,8 +340,12 @@ function getCell(key: string, index: number) {
|
|
|
343
340
|
return (isSummary(index) && col?.summaryCell) ? col?.summaryCell : col?.cell
|
|
344
341
|
}
|
|
345
342
|
|
|
346
|
-
function updateSelected(selected:
|
|
347
|
-
if (
|
|
343
|
+
function updateSelected(selected: any) {
|
|
344
|
+
if (Array.isArray(props.selected)) {
|
|
345
|
+
if (xor(selected, props.selected ?? []).length) {
|
|
346
|
+
emit('update:selected', selected)
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
348
349
|
emit('update:selected', selected)
|
|
349
350
|
}
|
|
350
351
|
}
|
|
@@ -361,7 +362,7 @@ function updateSelected(selected: unknown[]) {
|
|
|
361
362
|
:actions="unref(options.actions)"
|
|
362
363
|
:borderless="unref(options.borderless)"
|
|
363
364
|
:on-reset="options.onReset"
|
|
364
|
-
:selected="selected"
|
|
365
|
+
:selected="Array.isArray(selected) ? selected : undefined"
|
|
365
366
|
/>
|
|
366
367
|
|
|
367
368
|
<div class="table" role="grid">
|
|
@@ -389,7 +390,7 @@ function updateSelected(selected: unknown[]) {
|
|
|
389
390
|
@resize="(value) => updateColWidth(key, value, true)"
|
|
390
391
|
>
|
|
391
392
|
<SInputCheckbox
|
|
392
|
-
v-if="key === '__select' && unref(options.records)?.length"
|
|
393
|
+
v-if="Array.isArray(selected) && key === '__select' && unref(options.records)?.length"
|
|
393
394
|
v-model="control"
|
|
394
395
|
/>
|
|
395
396
|
</STableColumn>
|
|
@@ -444,11 +445,18 @@ function updateSelected(selected: unknown[]) {
|
|
|
444
445
|
:record="recordsWithSummary[index]"
|
|
445
446
|
:records="unref(options.records)!"
|
|
446
447
|
>
|
|
447
|
-
<
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
448
|
+
<template v-if="key === '__select' && !isSummary(index)">
|
|
449
|
+
<SInputCheckbox
|
|
450
|
+
v-if="Array.isArray(selected)"
|
|
451
|
+
:model-value="selectedIndexes.has(indexes[index])"
|
|
452
|
+
@update:model-value="c => selectedIndexes[c ? 'add' : 'delete'](indexes[index])"
|
|
453
|
+
/>
|
|
454
|
+
<SInputRadio
|
|
455
|
+
v-else
|
|
456
|
+
:model-value="selected === indexes[index]"
|
|
457
|
+
@update:model-value="c => updateSelected(c ? indexes[index] : null)"
|
|
458
|
+
/>
|
|
459
|
+
</template>
|
|
452
460
|
</STableCell>
|
|
453
461
|
</STableItem>
|
|
454
462
|
</div>
|
|
@@ -598,6 +606,7 @@ function updateSelected(selected: unknown[]) {
|
|
|
598
606
|
align-items: center;
|
|
599
607
|
padding: 0 16px;
|
|
600
608
|
min-height: 40px;
|
|
609
|
+
user-select: none;
|
|
601
610
|
}
|
|
602
611
|
|
|
603
612
|
:deep(.container) {
|
package/lib/styles/base.css
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"packageManager": "pnpm@8.15.
|
|
3
|
+
"version": "3.33.1",
|
|
4
|
+
"packageManager": "pnpm@8.15.4",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/markdown-it": "^13.0.7",
|
|
47
47
|
"@vuelidate/core": "^2.0.3",
|
|
48
48
|
"@vuelidate/validators": "^2.0.4",
|
|
49
|
-
"@vueuse/core": "^10.
|
|
49
|
+
"@vueuse/core": "^10.8.0",
|
|
50
50
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
51
51
|
"fuse.js": "^7.0.0",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"postcss": "^8.4.35",
|
|
57
57
|
"postcss-nested": "^6.0.1",
|
|
58
58
|
"v-calendar": "^3.1.2",
|
|
59
|
-
"vue": "^3.4.
|
|
60
|
-
"vue-router": "^4.
|
|
59
|
+
"vue": "^3.4.20",
|
|
60
|
+
"vue-router": "^4.3.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@tanstack/vue-virtual": "3.0.0-beta.62",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@globalbrain/eslint-config": "^1.5.2",
|
|
75
|
-
"@histoire/plugin-vue": "0.
|
|
75
|
+
"@histoire/plugin-vue": "^0.16.5",
|
|
76
76
|
"@iconify-icons/ph": "^1.2.5",
|
|
77
77
|
"@iconify-icons/ri": "^1.2.10",
|
|
78
78
|
"@iconify/vue": "^4.1.1",
|
|
@@ -80,18 +80,18 @@
|
|
|
80
80
|
"@types/body-scroll-lock": "^3.1.2",
|
|
81
81
|
"@types/lodash-es": "^4.17.12",
|
|
82
82
|
"@types/markdown-it": "^13.0.7",
|
|
83
|
-
"@types/node": "^20.11.
|
|
83
|
+
"@types/node": "^20.11.20",
|
|
84
84
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
85
|
-
"@vitest/coverage-v8": "^1.3.
|
|
85
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
86
86
|
"@vue/test-utils": "^2.4.4",
|
|
87
87
|
"@vuelidate/core": "^2.0.3",
|
|
88
88
|
"@vuelidate/validators": "^2.0.4",
|
|
89
|
-
"@vueuse/core": "^10.
|
|
89
|
+
"@vueuse/core": "^10.8.0",
|
|
90
90
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
91
|
-
"eslint": "^8.
|
|
91
|
+
"eslint": "^8.57.0",
|
|
92
92
|
"fuse.js": "^7.0.0",
|
|
93
|
-
"happy-dom": "^13.
|
|
94
|
-
"histoire": "0.
|
|
93
|
+
"happy-dom": "^13.6.0",
|
|
94
|
+
"histoire": "^0.16.5",
|
|
95
95
|
"lodash-es": "^4.17.21",
|
|
96
96
|
"markdown-it": "^14.0.0",
|
|
97
97
|
"normalize.css": "^8.0.1",
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"release-it": "^17.1.1",
|
|
103
103
|
"typescript": "~5.3.3",
|
|
104
104
|
"v-calendar": "^3.1.2",
|
|
105
|
-
"vite": "^5.1.
|
|
105
|
+
"vite": "^5.1.4",
|
|
106
106
|
"vitepress": "1.0.0-rc.44",
|
|
107
|
-
"vitest": "^1.3.
|
|
108
|
-
"vue": "^3.4.
|
|
109
|
-
"vue-router": "^4.
|
|
107
|
+
"vitest": "^1.3.1",
|
|
108
|
+
"vue": "^3.4.20",
|
|
109
|
+
"vue-router": "^4.3.0",
|
|
110
110
|
"vue-tsc": "^1.8.27"
|
|
111
111
|
}
|
|
112
112
|
}
|