@globalbrain/sefirot 3.40.2 → 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/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
|
|
@@ -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",
|