@globalbrain/sefirot 2.26.0 → 2.28.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/SInputDate.vue +49 -19
- package/lib/components/STable.vue +14 -1
- package/lib/components/STableCell.vue +5 -1
- package/lib/components/STableCellDay.vue +4 -0
- package/lib/components/STableCellText.vue +4 -0
- package/lib/composables/Table.ts +6 -0
- package/lib/styles/variables.css +2 -0
- package/package.json +2 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { IconifyIcon } from '@iconify/vue/dist/offline'
|
|
3
3
|
import { DatePicker } from 'v-calendar'
|
|
4
|
-
import type { DefineComponent } from 'vue'
|
|
5
4
|
import { computed } from 'vue'
|
|
6
5
|
import type { Validatable } from '../composables/Validation'
|
|
7
|
-
import type
|
|
8
|
-
import { day } from '../support/Day'
|
|
6
|
+
import { type Day, day } from '../support/Day'
|
|
9
7
|
import SInputBase from './SInputBase.vue'
|
|
10
8
|
|
|
9
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
11
10
|
export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
12
11
|
|
|
13
12
|
const props = defineProps<{
|
|
13
|
+
size?: Size
|
|
14
14
|
name?: string
|
|
15
15
|
label?: string
|
|
16
16
|
info?: string
|
|
17
17
|
note?: string
|
|
18
18
|
help?: string
|
|
19
|
-
checkIcon?: IconifyIcon
|
|
19
|
+
checkIcon?: IconifyIcon
|
|
20
20
|
checkText?: string
|
|
21
21
|
checkColor?: Color
|
|
22
22
|
block?: boolean
|
|
@@ -26,9 +26,13 @@ const props = defineProps<{
|
|
|
26
26
|
}>()
|
|
27
27
|
|
|
28
28
|
const emit = defineEmits<{
|
|
29
|
-
(e: 'update:
|
|
29
|
+
(e: 'update:model-value', value: Day | null): void
|
|
30
30
|
}>()
|
|
31
31
|
|
|
32
|
+
const classes = computed(() => [
|
|
33
|
+
props.size ?? 'small'
|
|
34
|
+
])
|
|
35
|
+
|
|
32
36
|
const value = computed(() => {
|
|
33
37
|
return props.modelValue
|
|
34
38
|
? props.modelValue.format('YYYY-MM-DD')
|
|
@@ -36,7 +40,7 @@ const value = computed(() => {
|
|
|
36
40
|
})
|
|
37
41
|
|
|
38
42
|
function emitInput(date?: string) {
|
|
39
|
-
emit('update:
|
|
43
|
+
emit('update:model-value', date ? day(date) : null)
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
function emitBlur() {
|
|
@@ -48,7 +52,8 @@ function emitBlur() {
|
|
|
48
52
|
|
|
49
53
|
<template>
|
|
50
54
|
<SInputBase
|
|
51
|
-
class="SInputDate
|
|
55
|
+
class="SInputDate"
|
|
56
|
+
:class="classes"
|
|
52
57
|
:name="name"
|
|
53
58
|
:label="label"
|
|
54
59
|
:note="note"
|
|
@@ -89,33 +94,58 @@ function emitBlur() {
|
|
|
89
94
|
</template>
|
|
90
95
|
|
|
91
96
|
<style lang="postcss" scoped>
|
|
97
|
+
.SInputDate.mini {
|
|
98
|
+
.input {
|
|
99
|
+
padding: 3px 8px;
|
|
100
|
+
max-width: 120px;
|
|
101
|
+
height: 32px;
|
|
102
|
+
line-height: 24px;
|
|
103
|
+
font-size: var(--input-font-size, var(--input-mini-font-size));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.SInputDate.small {
|
|
108
|
+
.input {
|
|
109
|
+
padding: 5px 12px;
|
|
110
|
+
max-width: 128px;
|
|
111
|
+
height: 40px;
|
|
112
|
+
line-height: 24px;
|
|
113
|
+
font-size: var(--input-font-size, var(--input-small-font-size));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.SInputDate.medium {
|
|
118
|
+
.input {
|
|
119
|
+
padding: 11px 12px;
|
|
120
|
+
max-width: 160px;
|
|
121
|
+
height: 48px;
|
|
122
|
+
line-height: 24px;
|
|
123
|
+
font-size: var(--input-font-size, var(--input-medium-font-size));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
92
127
|
.SInputDate.has-error {
|
|
93
128
|
.input {
|
|
94
|
-
border-color: var(--
|
|
129
|
+
border-color: var(--input-error-border-color);
|
|
95
130
|
|
|
96
131
|
&:focus {
|
|
97
|
-
border-color: var(--
|
|
132
|
+
border-color: var(--input-error-border-color);
|
|
98
133
|
}
|
|
99
134
|
}
|
|
100
135
|
}
|
|
101
136
|
|
|
102
137
|
.input {
|
|
103
138
|
display: block;
|
|
104
|
-
border: 1px solid var(--
|
|
139
|
+
border: 1px solid var(--input-border-color);
|
|
105
140
|
border-radius: 6px;
|
|
106
|
-
padding: 5px 12px;
|
|
107
141
|
width: 100%;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
line-height: 24px;
|
|
112
|
-
font-size: 16px;
|
|
113
|
-
background-color: var(--c-bg);
|
|
142
|
+
font-family: var(--font-family-number);
|
|
143
|
+
font-weight: 400;
|
|
144
|
+
background-color: var(--input-bg-color);
|
|
114
145
|
transition: border-color 0.25s, background-color 0.25s;
|
|
115
146
|
|
|
116
147
|
&::placeholder {
|
|
117
|
-
|
|
118
|
-
color: var(--c-text-3);
|
|
148
|
+
color: var(--input-placeholder-color);
|
|
119
149
|
}
|
|
120
150
|
|
|
121
151
|
&.block {
|
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
records,
|
|
19
19
|
header,
|
|
20
20
|
footer,
|
|
21
|
+
summary,
|
|
21
22
|
total,
|
|
22
23
|
page,
|
|
23
24
|
perPage,
|
|
@@ -71,6 +72,12 @@ const classes = computed(() => ({
|
|
|
71
72
|
'borderless': borderless?.value
|
|
72
73
|
}))
|
|
73
74
|
|
|
75
|
+
const recordsWithSummary = computed(() => {
|
|
76
|
+
return (records?.value && summary?.value)
|
|
77
|
+
? [...records?.value, summary?.value]
|
|
78
|
+
: records?.value ?? []
|
|
79
|
+
})
|
|
80
|
+
|
|
74
81
|
watch(() => records?.value, () => {
|
|
75
82
|
headLock = true
|
|
76
83
|
bodyLock = true
|
|
@@ -160,7 +167,12 @@ function updateColWidth(key: string, value: string) {
|
|
|
160
167
|
@scroll="syncBodyScroll"
|
|
161
168
|
>
|
|
162
169
|
<div class="block">
|
|
163
|
-
<div
|
|
170
|
+
<div
|
|
171
|
+
v-for="(record, rIndex) in recordsWithSummary"
|
|
172
|
+
:key="rIndex"
|
|
173
|
+
class="row"
|
|
174
|
+
:class="rIndex === records?.length && 'summary'"
|
|
175
|
+
>
|
|
164
176
|
<STableItem
|
|
165
177
|
v-for="key in orders"
|
|
166
178
|
:key="key"
|
|
@@ -170,6 +182,7 @@ function updateColWidth(key: string, value: string) {
|
|
|
170
182
|
>
|
|
171
183
|
<STableCell
|
|
172
184
|
:name="key"
|
|
185
|
+
:class="rIndex === records?.length && 'summary'"
|
|
173
186
|
:class-name="columns[key].className"
|
|
174
187
|
:cell="columns[key].cell"
|
|
175
188
|
:value="record[key]"
|
|
@@ -95,7 +95,11 @@ const computedCell = computed<TableCell | undefined>(() =>
|
|
|
95
95
|
overflow: hidden;
|
|
96
96
|
|
|
97
97
|
.row:hover & {
|
|
98
|
-
background-color: var(--c-bg-elv);
|
|
98
|
+
background-color: var(--c-bg-elv-1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.summary & {
|
|
102
|
+
background-color: var(--c-bg-elv-2);
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
.STableItem:first-child & {
|
|
@@ -42,5 +42,9 @@ const _value = computed(() => {
|
|
|
42
42
|
.STableCellDay.neutral & { color: var(--c-text-1); }
|
|
43
43
|
.STableCellDay.soft & { color: var(--c-text-2); }
|
|
44
44
|
.STableCellDay.mute & { color: var(--c-text-3); }
|
|
45
|
+
|
|
46
|
+
.STableCell.summary & {
|
|
47
|
+
font-weight: var(--table-cell-summary-font-weight);
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
</style>
|
|
@@ -110,6 +110,10 @@ const _iconColor = computed(() => {
|
|
|
110
110
|
.STableCellText.link:hover &.warning { color: var(--c-warning-darker); }
|
|
111
111
|
.STableCellText.link &.danger { color: var(--c-danger); }
|
|
112
112
|
.STableCellText.link:hover &.danger { color: var(--c-danger-dark); }
|
|
113
|
+
|
|
114
|
+
.STableCell.summary & {
|
|
115
|
+
font-weight: var(--table-cell-summary-font-weight);
|
|
116
|
+
}
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
.icon {
|
package/lib/composables/Table.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface Table<
|
|
|
13
13
|
records?: R[] | null
|
|
14
14
|
header?: boolean
|
|
15
15
|
footer?: boolean
|
|
16
|
+
summary?: TableSummary<R> | null
|
|
16
17
|
total?: number | null
|
|
17
18
|
page?: number | null
|
|
18
19
|
perPage?: number | null
|
|
@@ -138,12 +139,17 @@ export interface TableCellComponent extends TableCellBase {
|
|
|
138
139
|
props?: Record<string, any>
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
export type TableSummary<T> = {
|
|
143
|
+
[P in keyof T]?: T[P] | null | undefined
|
|
144
|
+
}
|
|
145
|
+
|
|
141
146
|
export interface UseTableOptions<O extends string, R extends Record<string, any>> {
|
|
142
147
|
orders: MaybeRef<O[]>
|
|
143
148
|
columns: MaybeRef<TableColumns<O, R>>
|
|
144
149
|
records?: MaybeRef<R[] | null | undefined>
|
|
145
150
|
header?: MaybeRef<boolean | undefined>
|
|
146
151
|
footer?: MaybeRef<boolean | undefined>
|
|
152
|
+
summary?: MaybeRef<TableSummary<R> | null | undefined>
|
|
147
153
|
total?: MaybeRef<number | null | undefined>
|
|
148
154
|
page?: MaybeRef<number | null | undefined>
|
|
149
155
|
perPage?: MaybeRef<number | null | undefined>
|
package/lib/styles/variables.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"packageManager": "pnpm@7.26.2",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"execa": "^5.1.1",
|
|
69
69
|
"fuse.js": "^6.6.2",
|
|
70
70
|
"histoire": "^0.15.8",
|
|
71
|
+
"jsdom": "^21.1.1",
|
|
71
72
|
"lodash-es": "^4.17.21",
|
|
72
73
|
"markdown-it": "^13.0.1",
|
|
73
74
|
"normalize.css": "^8.0.1",
|