@globalbrain/sefirot 3.15.0 → 3.17.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/SActionList.vue +1 -0
- package/lib/components/SActionListItem.vue +12 -3
- package/lib/components/SActionMenu.vue +84 -0
- package/lib/components/SButton.vue +41 -28
- package/lib/components/SCard.vue +2 -2
- package/lib/components/SCardBlock.vue +32 -6
- package/lib/components/SControl.vue +50 -0
- package/lib/components/SControlActionMenu.vue +43 -0
- package/lib/components/SControlButton.vue +45 -0
- package/lib/components/SControlCenter.vue +24 -0
- package/lib/components/SControlInputSearch.vue +68 -0
- package/lib/components/SControlLeft.vue +24 -0
- package/lib/components/SControlPagination.vue +26 -0
- package/lib/components/SControlRight.vue +24 -0
- package/lib/components/SControlText.vue +12 -0
- package/lib/components/SDropdown.vue +1 -1
- package/lib/components/SDropdownSection.vue +7 -1
- package/lib/components/SDropdownSectionDateRange.vue +126 -0
- package/lib/components/SDropdownSectionDateRangeDateFromTo.vue +88 -0
- package/lib/components/SDropdownSectionDateRangeYear.vue +73 -0
- package/lib/components/SDropdownSectionDateRangeYearHalf.vue +94 -0
- package/lib/components/SDropdownSectionDateRangeYearQuarter.vue +96 -0
- package/lib/components/SDropdownSectionMenu.vue +5 -34
- package/lib/components/SInputText.vue +9 -7
- package/lib/components/SPagination.vue +132 -0
- package/lib/components/STable.vue +6 -2
- package/lib/components/STableColumn.vue +1 -1
- package/lib/components/SW.vue +1 -1
- package/lib/composables/Card.ts +15 -3
- package/lib/composables/Control.ts +43 -0
- package/lib/composables/Dropdown.ts +47 -9
- package/lib/composables/Table.ts +11 -9
- package/lib/composables/V.ts +5 -5
- package/lib/mixins/Control.ts +33 -0
- package/lib/styles/utilities.css +113 -3
- package/lib/support/DateRange.ts +227 -0
- package/package.json +11 -11
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { type Day, day } from './Day'
|
|
2
|
+
|
|
3
|
+
export type DateRangePreset =
|
|
4
|
+
| DateFromTo
|
|
5
|
+
| Year
|
|
6
|
+
| YearHalf
|
|
7
|
+
| YearQuarter
|
|
8
|
+
|
|
9
|
+
export type DateRangePresetType =
|
|
10
|
+
| 'date-from-to'
|
|
11
|
+
| 'year'
|
|
12
|
+
| 'year-half'
|
|
13
|
+
| 'year-quarter'
|
|
14
|
+
|
|
15
|
+
export type DateRangePresetDict = {
|
|
16
|
+
'date-from-to': typeof DateFromTo
|
|
17
|
+
'year': typeof Year
|
|
18
|
+
'year-half': typeof YearHalf
|
|
19
|
+
'year-quarter': typeof YearQuarter
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class DateRange {
|
|
23
|
+
preset: DateRangePreset
|
|
24
|
+
|
|
25
|
+
presetDict: DateRangePresetDict = {
|
|
26
|
+
'date-from-to': DateFromTo,
|
|
27
|
+
'year': Year,
|
|
28
|
+
'year-half': YearHalf,
|
|
29
|
+
'year-quarter': YearQuarter
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
this.preset = new DateFromTo()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setPreset(preset: DateRangePreset | DateRangePresetType): this {
|
|
37
|
+
preset = typeof preset === 'string' ? new this.presetDict[preset]() : preset
|
|
38
|
+
|
|
39
|
+
this.preset = preset
|
|
40
|
+
|
|
41
|
+
return this
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getFrom(): Day | null {
|
|
45
|
+
return this.preset.getFrom()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getTo(): Day | null {
|
|
49
|
+
return this.preset.getTo()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getLabeltext(): string {
|
|
53
|
+
return this.preset.getLabeltext()
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export abstract class DateRangePresetBase {
|
|
58
|
+
abstract getFrom(): Day | null
|
|
59
|
+
abstract getTo(): Day | null
|
|
60
|
+
abstract getLabeltext(): string
|
|
61
|
+
|
|
62
|
+
protected getYear(year: number | null): Day | null {
|
|
63
|
+
if (!year) {
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const d = day().year(year)
|
|
68
|
+
|
|
69
|
+
return d.isValid() ? d : null
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export class DateFromTo extends DateRangePresetBase {
|
|
74
|
+
type = 'date-from-to' as const
|
|
75
|
+
from: Day | null
|
|
76
|
+
to: Day | null
|
|
77
|
+
|
|
78
|
+
constructor() {
|
|
79
|
+
super()
|
|
80
|
+
this.from = day().subtract(30, 'days')
|
|
81
|
+
this.to = day()
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getFrom(): Day | null {
|
|
85
|
+
return this.from
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getTo(): Day | null {
|
|
89
|
+
return this.to
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getLabeltext(): string {
|
|
93
|
+
const f = this.getFrom()?.format('YYYY-MM-DD')
|
|
94
|
+
const t = this.getTo()?.format('YYYY-MM-DD')
|
|
95
|
+
|
|
96
|
+
return (f && t) ? `${f} – ${t}` : 'Error'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setFrom(from: Day | null): this {
|
|
100
|
+
this.from = from
|
|
101
|
+
return this
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setTo(to: Day | null): this {
|
|
105
|
+
this.to = to
|
|
106
|
+
return this
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export class Year extends DateRangePresetBase {
|
|
111
|
+
type = 'year' as const
|
|
112
|
+
year: number | null = null
|
|
113
|
+
|
|
114
|
+
constructor() {
|
|
115
|
+
super()
|
|
116
|
+
this.year = day().year()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getFrom(): Day | null {
|
|
120
|
+
return this.getYear(this.year)?.startOf('year') ?? null
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
getTo(): Day | null {
|
|
124
|
+
return this.getYear(this.year)?.endOf('year') ?? null
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
getLabeltext(): string {
|
|
128
|
+
return this.getYear(this.year)?.format('YYYY') ?? 'Error'
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
setYear(year: number | null): this {
|
|
132
|
+
this.year = year
|
|
133
|
+
return this
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export class YearHalf extends DateRangePresetBase {
|
|
138
|
+
type = 'year-half' as const
|
|
139
|
+
year: number | null
|
|
140
|
+
half: 1 | 2
|
|
141
|
+
|
|
142
|
+
protected monthDict: Record<number, number> = {
|
|
143
|
+
1: 0,
|
|
144
|
+
2: 6
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
constructor() {
|
|
148
|
+
super()
|
|
149
|
+
this.year = day().year()
|
|
150
|
+
this.half = 1
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
getFrom(): Day | null {
|
|
154
|
+
return this.getYear(this.year)
|
|
155
|
+
?.month(this.monthDict[this.half])
|
|
156
|
+
.startOf('month') ?? null
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
getTo(): Day | null {
|
|
160
|
+
return this.getYear(this.year)
|
|
161
|
+
?.month(this.monthDict[this.half] + 5)
|
|
162
|
+
.endOf('month') ?? null
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
getLabeltext(): string {
|
|
166
|
+
const y = this.getYear(this.year)?.format('YYYY')
|
|
167
|
+
|
|
168
|
+
return y ? `${y}H${this.half}` : 'Error'
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setYear(year: number | null): this {
|
|
172
|
+
this.year = year
|
|
173
|
+
return this
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setHalf(half: 1 | 2): this {
|
|
177
|
+
this.half = half
|
|
178
|
+
return this
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export class YearQuarter extends DateRangePresetBase {
|
|
183
|
+
type = 'year-quarter' as const
|
|
184
|
+
year: number | null
|
|
185
|
+
quarter: 1 | 2 | 3 | 4
|
|
186
|
+
|
|
187
|
+
protected monthDict: Record<number, number> = {
|
|
188
|
+
1: 0,
|
|
189
|
+
2: 3,
|
|
190
|
+
3: 6,
|
|
191
|
+
4: 9
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
constructor() {
|
|
195
|
+
super()
|
|
196
|
+
this.year = day().year()
|
|
197
|
+
this.quarter = 1
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
getFrom(): Day | null {
|
|
201
|
+
return this.getYear(this.year)
|
|
202
|
+
?.month(this.monthDict[this.quarter])
|
|
203
|
+
.startOf('month') ?? null
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
getTo(): Day | null {
|
|
207
|
+
return this.getYear(this.year)
|
|
208
|
+
?.month(this.monthDict[this.quarter] + 2)
|
|
209
|
+
.endOf('month') ?? null
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
getLabeltext(): string {
|
|
213
|
+
const y = this.getYear(this.year)?.format('YYYY')
|
|
214
|
+
|
|
215
|
+
return y ? `${y}Q${this.quarter}` : 'Error'
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
setYear(year: number | null): this {
|
|
219
|
+
this.year = year
|
|
220
|
+
return this
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
setQuarter(quarter: 1 | 2 | 3 | 4): this {
|
|
224
|
+
this.quarter = quarter
|
|
225
|
+
return this
|
|
226
|
+
}
|
|
227
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"packageManager": "pnpm@8.12.1",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"postcss": "^8.4.32",
|
|
57
57
|
"postcss-nested": "^6.0.1",
|
|
58
58
|
"v-calendar": "^3.1.2",
|
|
59
|
-
"vue": "^3.3.
|
|
59
|
+
"vue": "^3.3.13",
|
|
60
60
|
"vue-router": "^4.2.5"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
@@ -79,16 +79,16 @@
|
|
|
79
79
|
"@types/file-saver": "^2.0.7",
|
|
80
80
|
"@types/lodash-es": "^4.17.12",
|
|
81
81
|
"@types/markdown-it": "^13.0.7",
|
|
82
|
-
"@types/node": "^20.10.
|
|
83
|
-
"@types/qs": "^6.9.
|
|
82
|
+
"@types/node": "^20.10.5",
|
|
83
|
+
"@types/qs": "^6.9.11",
|
|
84
84
|
"@vitejs/plugin-vue": "^4.5.2",
|
|
85
|
-
"@vitest/coverage-v8": "^1.0
|
|
85
|
+
"@vitest/coverage-v8": "^1.1.0",
|
|
86
86
|
"@vue/test-utils": "^2.4.3",
|
|
87
87
|
"@vuelidate/core": "^2.0.3",
|
|
88
88
|
"@vuelidate/validators": "^2.0.4",
|
|
89
89
|
"@vueuse/core": "^10.7.0",
|
|
90
90
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
91
|
-
"eslint": "^8.
|
|
91
|
+
"eslint": "^8.56.0",
|
|
92
92
|
"fuse.js": "^7.0.0",
|
|
93
93
|
"happy-dom": "^12.10.3",
|
|
94
94
|
"histoire": "^0.17.6",
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
"release-it": "^17.0.1",
|
|
103
103
|
"typescript": "~5.3.3",
|
|
104
104
|
"v-calendar": "^3.1.2",
|
|
105
|
-
"vite": "^5.0.
|
|
106
|
-
"vitepress": "1.0.0-rc.
|
|
107
|
-
"vitest": "^1.0
|
|
108
|
-
"vue": "^3.3.
|
|
105
|
+
"vite": "^5.0.10",
|
|
106
|
+
"vitepress": "1.0.0-rc.32",
|
|
107
|
+
"vitest": "^1.1.0",
|
|
108
|
+
"vue": "^3.3.13",
|
|
109
109
|
"vue-router": "^4.2.5",
|
|
110
|
-
"vue-tsc": "^1.8.
|
|
110
|
+
"vue-tsc": "^1.8.26"
|
|
111
111
|
}
|
|
112
112
|
}
|