@globalbrain/sefirot 3.40.1 → 3.41.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/README.md +8 -2
- package/lib/components/STableCellDay.vue +1 -1
- package/lib/components/STableCellNumber.vue +1 -1
- package/lib/components/STableCellPill.vue +1 -1
- package/lib/components/STableCellPills.vue +8 -4
- package/lib/composables/Error.ts +4 -4
- package/lib/composables/Table.ts +1 -1
- package/lib/composables/Url.ts +5 -1
- package/lib/validation/rules/index.ts +2 -0
- package/lib/validation/rules/requiredHms.ts +1 -2
- package/lib/validation/rules/requiredHmsIf.ts +16 -0
- package/lib/validation/rules/requiredYmd.ts +1 -2
- package/lib/validation/rules/requiredYmdIf.ts +16 -0
- package/lib/validation/validators/index.ts +2 -0
- package/lib/validation/validators/requiredHmsIf.ts +19 -0
- package/lib/validation/validators/requiredYmdIf.ts +19 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -27,10 +27,16 @@ Sefirot follows the official [Vue Style Guide](https://v3.vuejs.org/style-guide/
|
|
|
27
27
|
### Development
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
$ pnpm run
|
|
30
|
+
$ pnpm run story
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Serve
|
|
33
|
+
Serve Histoire at http://localhost:4010.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
$ pnpm run docs
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Serve documentation website at http://localhost:4011.
|
|
34
40
|
|
|
35
41
|
```bash
|
|
36
42
|
$ pnpm run lint
|
|
@@ -4,12 +4,16 @@ import { type TableCellPillItem } from '../composables/Table'
|
|
|
4
4
|
import STableCellPill from './STableCellPill.vue'
|
|
5
5
|
|
|
6
6
|
const props = defineProps<{
|
|
7
|
-
value
|
|
8
|
-
record
|
|
9
|
-
pills(value:
|
|
7
|
+
value?: any
|
|
8
|
+
record?: any
|
|
9
|
+
pills: TableCellPillItem[] | ((value: any, record: any) => TableCellPillItem[])
|
|
10
10
|
}>()
|
|
11
11
|
|
|
12
|
-
const items = computed(() =>
|
|
12
|
+
const items = computed(() => {
|
|
13
|
+
return Array.isArray(props.pills)
|
|
14
|
+
? props.pills
|
|
15
|
+
: props.pills(props.value, props.record)
|
|
16
|
+
})
|
|
13
17
|
</script>
|
|
14
18
|
|
|
15
19
|
<template>
|
package/lib/composables/Error.ts
CHANGED
|
@@ -173,11 +173,11 @@ export function useErrorHandler({
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
return function errorHandler(
|
|
176
|
-
|
|
176
|
+
e: any,
|
|
177
177
|
instance: ComponentPublicInstance | null = null,
|
|
178
178
|
info: string = ''
|
|
179
179
|
) {
|
|
180
|
-
error.set(
|
|
180
|
+
error.set(e)
|
|
181
181
|
|
|
182
182
|
if (enabled) {
|
|
183
183
|
pauseTracking()
|
|
@@ -187,7 +187,7 @@ export function useErrorHandler({
|
|
|
187
187
|
userValue = null
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
if (![403, 404].includes(
|
|
190
|
+
if (![403, 404].includes(e?.cause?.statusCode)) {
|
|
191
191
|
const $ = instance && instance.$
|
|
192
192
|
const metadata = $ && {
|
|
193
193
|
componentName: formatComponentName($),
|
|
@@ -200,7 +200,7 @@ export function useErrorHandler({
|
|
|
200
200
|
Sentry.withScope((scope) => {
|
|
201
201
|
scope.setUser(userValue)
|
|
202
202
|
scope.setContext('vue', metadata)
|
|
203
|
-
Sentry.captureException(
|
|
203
|
+
Sentry.captureException(e)
|
|
204
204
|
})
|
|
205
205
|
})
|
|
206
206
|
}
|
package/lib/composables/Table.ts
CHANGED
|
@@ -140,7 +140,7 @@ export type TableCellPillColor = ColorModes
|
|
|
140
140
|
|
|
141
141
|
export interface TableCellPills<V = any, R = any> extends TableCellBase {
|
|
142
142
|
type: 'pills'
|
|
143
|
-
pills(value: V, record: R)
|
|
143
|
+
pills: TableCellPillItem[] | ((value: V, record: R) => TableCellPillItem[])
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export interface TableCellPillItem {
|
package/lib/composables/Url.ts
CHANGED
|
@@ -131,7 +131,11 @@ function deepAssign(target: Record<string, any>, source: Record<string, any>) {
|
|
|
131
131
|
const value = source[key]
|
|
132
132
|
|
|
133
133
|
if (Array.isArray(value)) {
|
|
134
|
-
|
|
134
|
+
if (Array.isArray(target[key])) {
|
|
135
|
+
target[key].splice(0, target[key].length, ...value)
|
|
136
|
+
} else {
|
|
137
|
+
target[key] = value
|
|
138
|
+
}
|
|
135
139
|
} else if (value && typeof value === 'object') {
|
|
136
140
|
target[key] = deepAssign(target[key] || {}, value)
|
|
137
141
|
} else {
|
|
@@ -16,8 +16,10 @@ export { negativeInteger } from './negativeInteger'
|
|
|
16
16
|
export { positiveInteger } from './positiveInteger'
|
|
17
17
|
export { required } from './required'
|
|
18
18
|
export { requiredHms } from './requiredHms'
|
|
19
|
+
export { requiredHmsIf } from './requiredHmsIf'
|
|
19
20
|
export { requiredIf } from './requiredIf'
|
|
20
21
|
export { requiredYmd } from './requiredYmd'
|
|
22
|
+
export { requiredYmdIf } from './requiredYmdIf'
|
|
21
23
|
export { rule } from './rule'
|
|
22
24
|
export { slackChannelName } from './slackChannelName'
|
|
23
25
|
export { url } from './url'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { type HmsType } from '../../support/Day'
|
|
1
2
|
import { createRule } from '../Rule'
|
|
2
3
|
import { requiredHms as baseRequiredHms } from '../validators/requiredHms'
|
|
3
4
|
|
|
4
|
-
type HmsType = 'h' | 'm' | 's'
|
|
5
|
-
|
|
6
5
|
export const message = {
|
|
7
6
|
en: 'The field is required.',
|
|
8
7
|
ja: 'この項目は必須です。'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type HmsType } from '../../support/Day'
|
|
2
|
+
import { createRule } from '../Rule'
|
|
3
|
+
import { type RequiredIfCondition, requiredHmsIf as baseRequiredHmsIf } from '../validators'
|
|
4
|
+
|
|
5
|
+
export const message = {
|
|
6
|
+
en: 'The field is required.',
|
|
7
|
+
ja: 'この項目は必須です。'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function requiredHmsIf(condition: RequiredIfCondition, required?: HmsType[], msg?: string) {
|
|
11
|
+
return createRule({
|
|
12
|
+
async: true,
|
|
13
|
+
message: ({ lang }) => msg ?? message[lang],
|
|
14
|
+
validation: (value) => baseRequiredHmsIf(value, condition, required)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { type YmdType } from '../../support/Day'
|
|
1
2
|
import { createRule } from '../Rule'
|
|
2
3
|
import { requiredYmd as baseRequiredYmd } from '../validators/requiredYmd'
|
|
3
4
|
|
|
4
|
-
type YmdType = 'y' | 'm' | 'd'
|
|
5
|
-
|
|
6
5
|
export const message = {
|
|
7
6
|
en: 'The field is required.',
|
|
8
7
|
ja: 'この項目は必須です。'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type YmdType } from '../../support/Day'
|
|
2
|
+
import { createRule } from '../Rule'
|
|
3
|
+
import { type RequiredIfCondition, requiredYmdIf as baseRequiredYmdIf } from '../validators'
|
|
4
|
+
|
|
5
|
+
export const message = {
|
|
6
|
+
en: 'The field is required.',
|
|
7
|
+
ja: 'この項目は必須です。'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function requiredYmdIf(condition: RequiredIfCondition, required?: YmdType[], msg?: string) {
|
|
11
|
+
return createRule({
|
|
12
|
+
async: true,
|
|
13
|
+
message: ({ lang }) => msg ?? message[lang],
|
|
14
|
+
validation: (value) => baseRequiredYmdIf(value, condition, required)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -15,8 +15,10 @@ export * from './negativeInteger'
|
|
|
15
15
|
export * from './positiveInteger'
|
|
16
16
|
export * from './required'
|
|
17
17
|
export * from './requiredHms'
|
|
18
|
+
export * from './requiredHmsIf'
|
|
18
19
|
export * from './requiredIf'
|
|
19
20
|
export * from './requiredYmd'
|
|
21
|
+
export * from './requiredYmdIf'
|
|
20
22
|
export * from './slackChannelName'
|
|
21
23
|
export * from './url'
|
|
22
24
|
export * from './ymd'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HmsType } from '../../support/Day'
|
|
2
|
+
import { requiredHms } from './requiredHms'
|
|
3
|
+
import { type RequiredIfCondition } from './requiredIf'
|
|
4
|
+
|
|
5
|
+
export async function requiredHmsIf(value: unknown, condition: RequiredIfCondition, required: HmsType[] = ['h', 'm', 's']): Promise<boolean> {
|
|
6
|
+
if (typeof condition === 'boolean' && condition) {
|
|
7
|
+
return requiredHms(value, required)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof condition === 'string' && condition) {
|
|
11
|
+
return requiredHms(value, required)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (typeof condition === 'function' && (await condition())) {
|
|
15
|
+
return requiredHms(value, required)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type YmdType } from '../../support/Day'
|
|
2
|
+
import { type RequiredIfCondition } from './requiredIf'
|
|
3
|
+
import { requiredYmd } from './requiredYmd'
|
|
4
|
+
|
|
5
|
+
export async function requiredYmdIf(value: unknown, condition: RequiredIfCondition, required: YmdType[] = ['y', 'm', 'd']): Promise<boolean> {
|
|
6
|
+
if (typeof condition === 'boolean' && condition) {
|
|
7
|
+
return requiredYmd(value, required)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof condition === 'string' && condition) {
|
|
11
|
+
return requiredYmd(value, required)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (typeof condition === 'function' && (await condition())) {
|
|
15
|
+
return requiredYmd(value, required)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return true
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.41.0",
|
|
4
4
|
"packageManager": "pnpm@8.15.5",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
@@ -22,12 +22,13 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"docs": "pnpm docs:dev",
|
|
25
|
-
"docs:dev": "vitepress dev docs --port
|
|
25
|
+
"docs:dev": "vitepress dev docs --port 4011",
|
|
26
26
|
"docs:build": "vitepress build docs",
|
|
27
|
-
"docs:preview": "vitepress serve docs --port
|
|
28
|
-
"story": "
|
|
27
|
+
"docs:preview": "vitepress serve docs --port 4011",
|
|
28
|
+
"story": "pnpm story:dev",
|
|
29
|
+
"story:dev": "histoire dev --port 4010",
|
|
29
30
|
"story:build": "histoire build",
|
|
30
|
-
"story:preview": "histoire preview --port
|
|
31
|
+
"story:preview": "histoire preview --port 4010",
|
|
31
32
|
"type": "vue-tsc --noEmit",
|
|
32
33
|
"lint": "eslint --fix .",
|
|
33
34
|
"lint:fail": "eslint .",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"@globalbrain/eslint-config": "^1.6.0",
|
|
78
|
-
"@histoire/plugin-vue": "
|
|
79
|
+
"@histoire/plugin-vue": "0.16.5",
|
|
79
80
|
"@iconify-icons/ph": "^1.2.5",
|
|
80
81
|
"@iconify-icons/ri": "^1.2.10",
|
|
81
82
|
"@iconify/vue": "^4.1.1",
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
"eslint": "^8.57.0",
|
|
96
97
|
"fuse.js": "^7.0.0",
|
|
97
98
|
"happy-dom": "^14.3.9",
|
|
98
|
-
"histoire": "
|
|
99
|
+
"histoire": "0.16.5",
|
|
99
100
|
"lodash-es": "^4.17.21",
|
|
100
101
|
"markdown-it": "^14.1.0",
|
|
101
102
|
"normalize.css": "^8.0.1",
|