@globalbrain/sefirot 2.37.0 → 2.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.
- package/lib/components/SDropdownSectionMenu.vue +11 -2
- package/lib/components/STable.vue +14 -6
- package/lib/components/STableCellNumber.vue +1 -1
- package/lib/components/STableCellText.vue +8 -2
- package/lib/composables/Dropdown.ts +1 -0
- package/lib/composables/Table.ts +2 -1
- package/package.json +2 -2
|
@@ -9,7 +9,11 @@ defineProps<{
|
|
|
9
9
|
<template>
|
|
10
10
|
<ul class="SDropdownSectionMenu">
|
|
11
11
|
<li v-for="option in options" :key="option.label" class="item">
|
|
12
|
-
<button
|
|
12
|
+
<button
|
|
13
|
+
class="button"
|
|
14
|
+
@click="option.onClick"
|
|
15
|
+
:disabled="option.disabled"
|
|
16
|
+
>
|
|
13
17
|
{{ option.label }}
|
|
14
18
|
</button>
|
|
15
19
|
</li>
|
|
@@ -33,8 +37,13 @@ defineProps<{
|
|
|
33
37
|
font-weight: 400;
|
|
34
38
|
transition: color 0.25s, background-color 0.25s;
|
|
35
39
|
|
|
36
|
-
&:hover {
|
|
40
|
+
&:hover:not(:disabled) {
|
|
37
41
|
background-color: var(--c-mute);
|
|
38
42
|
}
|
|
43
|
+
|
|
44
|
+
&:disabled {
|
|
45
|
+
color: var(--c-text-3);
|
|
46
|
+
cursor: not-allowed;
|
|
47
|
+
}
|
|
39
48
|
}
|
|
40
49
|
</style>
|
|
@@ -27,6 +27,14 @@ const body = shallowRef<HTMLElement | null>(null)
|
|
|
27
27
|
const block = shallowRef<HTMLElement | null>(null)
|
|
28
28
|
const row = shallowRef<HTMLElement | null>(null)
|
|
29
29
|
|
|
30
|
+
const ordersToShow = computed(() => {
|
|
31
|
+
return unref(props.options.orders).filter((key) => {
|
|
32
|
+
return unref(props.options.columns)[key]?.show !== false
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
watch(() => ordersToShow.value, handleResize)
|
|
37
|
+
|
|
30
38
|
const colToGrowAdjusted = ref(false)
|
|
31
39
|
|
|
32
40
|
const colToGrow = computed(() => {
|
|
@@ -34,13 +42,13 @@ const colToGrow = computed(() => {
|
|
|
34
42
|
return -1
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
return
|
|
45
|
+
return ordersToShow.value.findIndex((key) => {
|
|
38
46
|
return unref(props.options.columns)[key]?.grow
|
|
39
47
|
}) ?? -1
|
|
40
48
|
})
|
|
41
49
|
|
|
42
50
|
const nameOfColToGrow = computed(() => {
|
|
43
|
-
return
|
|
51
|
+
return ordersToShow.value[colToGrow.value]
|
|
44
52
|
})
|
|
45
53
|
|
|
46
54
|
const cellOfColToGrow = computed(() => {
|
|
@@ -130,7 +138,7 @@ useResizeObserver(block, ([entry]) => {
|
|
|
130
138
|
const resizeObserver = useResizeObserver(head, handleResize)
|
|
131
139
|
|
|
132
140
|
function stopObserving() {
|
|
133
|
-
const orders =
|
|
141
|
+
const orders = ordersToShow.value
|
|
134
142
|
colWidths[orders[orders.length - 1]] = 'auto'
|
|
135
143
|
resizeObserver.stop()
|
|
136
144
|
}
|
|
@@ -236,7 +244,7 @@ function getCell(key: string, index: number) {
|
|
|
236
244
|
<div class="block" ref="block">
|
|
237
245
|
<div class="row" ref="row">
|
|
238
246
|
<STableItem
|
|
239
|
-
v-for="key in
|
|
247
|
+
v-for="key in ordersToShow"
|
|
240
248
|
:key="key"
|
|
241
249
|
:name="key"
|
|
242
250
|
:class-name="unref(options.columns)[key].className"
|
|
@@ -281,7 +289,7 @@ function getCell(key: string, index: number) {
|
|
|
281
289
|
>
|
|
282
290
|
<div class="row" :class="isSummaryOrLastClass(rIndex)">
|
|
283
291
|
<STableItem
|
|
284
|
-
v-for="key in
|
|
292
|
+
v-for="key in ordersToShow"
|
|
285
293
|
:key="key"
|
|
286
294
|
:name="key"
|
|
287
295
|
:class-name="unref(options.columns)[key].className"
|
|
@@ -313,7 +321,7 @@ function getCell(key: string, index: number) {
|
|
|
313
321
|
>
|
|
314
322
|
<div class="row" :class="isSummaryOrLastClass(rIndex)">
|
|
315
323
|
<STableItem
|
|
316
|
-
v-for="key in
|
|
324
|
+
v-for="key in ordersToShow"
|
|
317
325
|
:key="key"
|
|
318
326
|
:name="key"
|
|
319
327
|
:class-name="unref(options.columns)[key].className"
|
|
@@ -20,7 +20,7 @@ const props = defineProps<{
|
|
|
20
20
|
getter?: string | null | ((value: any, record: any) => string | null)
|
|
21
21
|
color?: Color | ((value: any, record: any) => Color)
|
|
22
22
|
iconColor?: Color | ((value: any, record: any) => Color)
|
|
23
|
-
link
|
|
23
|
+
link?: string | null | ((value: any, record: any) => string)
|
|
24
24
|
onClick?(value: any, record: any): void
|
|
25
25
|
}>()
|
|
26
26
|
|
|
@@ -34,6 +34,12 @@ const _value = computed(() => {
|
|
|
34
34
|
: props.getter
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
const _link = computed(() => {
|
|
38
|
+
return typeof props.link === 'function'
|
|
39
|
+
? props.link(props.value, props.record)
|
|
40
|
+
: props.link
|
|
41
|
+
})
|
|
42
|
+
|
|
37
43
|
const _color = computed(() => {
|
|
38
44
|
return typeof props.color === 'function'
|
|
39
45
|
? props.color(props.value, props.record)
|
|
@@ -52,7 +58,7 @@ const _iconColor = computed(() => {
|
|
|
52
58
|
<SLink
|
|
53
59
|
v-if="_value"
|
|
54
60
|
class="container"
|
|
55
|
-
:href="
|
|
61
|
+
:href="_link"
|
|
56
62
|
:role="onClick ? 'button' : null"
|
|
57
63
|
@click="() => onClick?.(value, record)"
|
|
58
64
|
>
|
package/lib/composables/Table.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface TableColumn<V, R, SV, SR> {
|
|
|
43
43
|
resizable?: boolean
|
|
44
44
|
cell?: TableCell | TableColumnCellFn<V, R>
|
|
45
45
|
summaryCell?: TableCell | TableColumnCellFn<SV, SR>
|
|
46
|
+
show?: boolean
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export type TableColumnCellFn<V, R> = (value: V, record: R) => TableCell
|
|
@@ -80,7 +81,7 @@ export interface TableCellText extends TableCellBase {
|
|
|
80
81
|
align?: 'left' | 'center' | 'right'
|
|
81
82
|
icon?: any
|
|
82
83
|
value?: string | null | ((value: any, record: any) => string | null)
|
|
83
|
-
link
|
|
84
|
+
link?: string | null | ((value: any, record: any) => string)
|
|
84
85
|
color?: TableCellValueColor | ((value: any, record: any) => TableCellValueColor)
|
|
85
86
|
iconColor?: TableCellValueColor | ((value: any, record: any) => TableCellValueColor)
|
|
86
87
|
onClick?(value: any, record: any): void
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"packageManager": "pnpm@8.
|
|
3
|
+
"version": "2.38.0",
|
|
4
|
+
"packageManager": "pnpm@8.6.2",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
7
7
|
"license": "MIT",
|