@globalbrain/sefirot 2.2.1 → 2.3.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/SButton.vue +0 -1
- package/lib/components/SButtonGroup.vue +17 -17
- package/lib/components/SDropdownSectionFilter.vue +5 -5
- package/lib/components/SIcon.vue +2 -2
- package/lib/components/SInputBase.vue +4 -5
- package/lib/components/SInputCheckbox.vue +23 -23
- package/lib/components/SInputCheckboxes.vue +23 -23
- package/lib/components/SInputDate.vue +55 -132
- package/lib/components/SInputDropdown.vue +3 -3
- package/lib/components/SInputFile.vue +1 -1
- package/lib/components/SInputSelect.vue +48 -48
- package/lib/components/SInputSwitch.vue +68 -142
- package/lib/components/SInputSwitches.vue +51 -58
- package/lib/components/SInputText.vue +1 -1
- package/lib/components/SInputTextarea.vue +24 -24
- package/lib/components/SLink.vue +14 -14
- package/lib/components/SMarkdown.vue +3 -3
- package/lib/components/SMount.vue +1 -1
- package/lib/components/SSheetFooterAction.vue +1 -1
- package/lib/components/SSpinner.vue +28 -12
- package/lib/components/SStep.vue +15 -15
- package/lib/components/SSteps.vue +16 -16
- package/lib/components/STable.vue +2 -2
- package/lib/components/STableCellAvatar.vue +1 -1
- package/lib/components/STableCellAvatars.vue +1 -1
- package/lib/components/STableCellDay.vue +1 -1
- package/lib/components/STableColumn.vue +4 -4
- package/lib/components/STooltip.vue +17 -17
- package/lib/composables/Form.ts +7 -5
- package/lib/composables/Grid.ts +3 -3
- package/lib/composables/Markdown.ts +2 -2
- package/lib/composables/Tooltip.ts +2 -1
- package/lib/composables/Validation.ts +2 -2
- package/lib/support/Day.ts +1 -1
- package/lib/validation/rules/email.ts +1 -1
- package/lib/validation/rules/hms.ts +1 -1
- package/lib/validation/rules/maxLength.ts +1 -1
- package/lib/validation/rules/maxValue.ts +1 -1
- package/lib/validation/rules/minLength.ts +1 -1
- package/lib/validation/rules/minValue.ts +1 -1
- package/lib/validation/rules/required.ts +1 -1
- package/lib/validation/rules/requiredHms.ts +1 -1
- package/lib/validation/rules/requiredIf.ts +1 -1
- package/lib/validation/rules/requiredYmd.ts +1 -1
- package/lib/validation/rules/url.ts +1 -1
- package/lib/validation/rules/ymd.ts +1 -1
- package/lib/validation/validators/requiredYmd.ts +1 -1
- package/package.json +12 -15
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="SSteps">
|
|
3
|
-
<SStep
|
|
4
|
-
v-for="(step, index) in steps"
|
|
5
|
-
:key="index"
|
|
6
|
-
class="item"
|
|
7
|
-
:style="{ width }"
|
|
8
|
-
:bar-left="getBarLeftMode(index)"
|
|
9
|
-
:bar-right="getBarRightMode(index)"
|
|
10
|
-
v-bind="step"
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
1
|
<script setup lang="ts">
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
2
|
+
import { PropType, computed } from 'vue'
|
|
3
|
+
import { BarMode, Step } from '../composables/Step'
|
|
18
4
|
import SStep from './SStep.vue'
|
|
19
5
|
|
|
20
6
|
const props = defineProps({
|
|
@@ -52,6 +38,20 @@ function isActive(step: Step): boolean {
|
|
|
52
38
|
}
|
|
53
39
|
</script>
|
|
54
40
|
|
|
41
|
+
<template>
|
|
42
|
+
<div class="SSteps">
|
|
43
|
+
<SStep
|
|
44
|
+
v-for="(step, index) in steps"
|
|
45
|
+
:key="index"
|
|
46
|
+
class="item"
|
|
47
|
+
:style="{ width }"
|
|
48
|
+
:bar-left="getBarLeftMode(index)"
|
|
49
|
+
:bar-right="getBarRightMode(index)"
|
|
50
|
+
v-bind="step"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
55
|
<style lang="postcss" scoped>
|
|
56
56
|
.SSteps {
|
|
57
57
|
display: flex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { reactive, ref,
|
|
2
|
+
import { computed, reactive, ref, toRefs, watch } from 'vue'
|
|
3
3
|
import { Table } from '../composables/Table'
|
|
4
4
|
import SSpinner from './SSpinner.vue'
|
|
5
5
|
import STableCell from './STableCell.vue'
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
loading,
|
|
25
25
|
onPrev,
|
|
26
26
|
onNext,
|
|
27
|
-
onReset
|
|
27
|
+
onReset
|
|
28
28
|
} = toRefs(props.options)
|
|
29
29
|
|
|
30
30
|
const head = ref<HTMLElement | null>(null)
|
|
@@ -17,7 +17,7 @@ const _name = computed(() => props.name?.(props.value, props.record))
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<template>
|
|
20
|
-
<div class="STableCellAvatar" :class="[{ link}, color]">
|
|
20
|
+
<div class="STableCellAvatar" :class="[{ link }, color]">
|
|
21
21
|
<SLink class="container" :href="link?.(value, record)">
|
|
22
22
|
<div v-if="_image" class="avatar">
|
|
23
23
|
<SAvatar size="mini" :avatar="_image" :name="_name" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import IconDotsThree from '@iconify-icons/ph/dots-three'
|
|
3
|
-
import {
|
|
3
|
+
import { computed, nextTick, ref, unref, watch } from 'vue'
|
|
4
4
|
import { DropdownSection } from '../composables/Dropdown'
|
|
5
5
|
import { useFlyout } from '../composables/Flyout'
|
|
6
6
|
import { isArray } from '../support/Utils'
|
|
@@ -93,11 +93,11 @@ async function adjustDialogPosition() {
|
|
|
93
93
|
const position = (window.innerWidth - rect.right) > dialogWidth ? 'right' : 'left'
|
|
94
94
|
|
|
95
95
|
top.value = `${rect.top + rect.height - 8}px`
|
|
96
|
-
left.value
|
|
97
|
-
Math.max(
|
|
96
|
+
left.value
|
|
97
|
+
= `${Math.max(
|
|
98
98
|
16,
|
|
99
99
|
position === 'right' ? rect.left - 4 : rect.right - dialogWidth - 4
|
|
100
|
-
)
|
|
100
|
+
)}px`
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
function startDialogPositionListener() {
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { PropType, computed, ref } from 'vue'
|
|
3
|
+
import { Position, useTooltip } from '../composables/Tooltip'
|
|
4
|
+
import SMarkdown from './SMarkdown.vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
tag: { type: String, default: 'span' },
|
|
8
|
+
text: { type: String, default: null },
|
|
9
|
+
position: { type: String as PropType<Position>, default: 'top' }
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const tip = ref<HTMLElement | null>(null)
|
|
13
|
+
const content = ref<HTMLElement | null>(null)
|
|
14
|
+
const classes = computed(() => [props.position])
|
|
15
|
+
const { on, show, hide } = useTooltip(content, tip, props.position)
|
|
16
|
+
</script>
|
|
17
|
+
|
|
1
18
|
<template>
|
|
2
19
|
<component :is="tag" class="STooltip" @mouseenter="show" @mouseleave="hide">
|
|
3
20
|
<template v-if="text">
|
|
@@ -20,23 +37,6 @@
|
|
|
20
37
|
</component>
|
|
21
38
|
</template>
|
|
22
39
|
|
|
23
|
-
<script setup lang="ts">
|
|
24
|
-
import { computed, PropType, ref } from 'vue'
|
|
25
|
-
import { Position, useTooltip } from '../composables/Tooltip'
|
|
26
|
-
import SMarkdown from './SMarkdown.vue'
|
|
27
|
-
|
|
28
|
-
const props = defineProps({
|
|
29
|
-
tag: { type: String, default: 'span' },
|
|
30
|
-
text: { type: String, default: null },
|
|
31
|
-
position: { type: String as PropType<Position>, default: 'top' }
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const tip = ref<HTMLElement | null>(null)
|
|
35
|
-
const content = ref<HTMLElement | null>(null)
|
|
36
|
-
const classes = computed(() => [props.position])
|
|
37
|
-
const { on, show, hide } = useTooltip(content, tip, props.position)
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
40
|
<style lang="postcss" scoped>
|
|
41
41
|
.STooltip {
|
|
42
42
|
position: relative;
|
package/lib/composables/Form.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cloneDeep from 'lodash-es/cloneDeep'
|
|
2
|
-
import { Ref, reactive } from 'vue'
|
|
2
|
+
import { Ref, computed, reactive } from 'vue'
|
|
3
3
|
import { useSnackbars } from '../stores/Snackbars'
|
|
4
4
|
import { Validation, useValidation } from './Validation'
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ export interface Form<T extends Record<string, any>> {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface UseFormOptions<T extends Record<string, any>> {
|
|
16
|
-
data: T
|
|
16
|
+
data: T
|
|
17
17
|
rules?: Record<string, any> | ((state: T) => Record<string, any>)
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -26,9 +26,11 @@ export function useForm<
|
|
|
26
26
|
|
|
27
27
|
const data = reactive(options.data)
|
|
28
28
|
|
|
29
|
-
const rules =
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const rules = computed(() => {
|
|
30
|
+
return options.rules
|
|
31
|
+
? typeof options.rules === 'function' ? options.rules(data) : options.rules
|
|
32
|
+
: {}
|
|
33
|
+
})
|
|
32
34
|
|
|
33
35
|
const validation = useValidation(data, rules)
|
|
34
36
|
|
package/lib/composables/Grid.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ref,
|
|
1
|
+
import { Ref, onMounted, onUnmounted, ref, watchEffect } from 'vue'
|
|
2
2
|
|
|
3
3
|
export interface Grid {
|
|
4
4
|
container: Ref<HTMLElement | null>
|
|
@@ -69,7 +69,7 @@ export function useGrid(options: UseGridOptions): Grid {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
function toClassSelector(name: string) {
|
|
72
|
-
return name.startsWith('.') ? name :
|
|
72
|
+
return name.startsWith('.') ? name : `.${name}`
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function toClassName(name: string) {
|
|
@@ -84,7 +84,7 @@ function createSpacers(size: number, tag: string, classes: string, type: 'fill'
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (type === 'fill') {
|
|
87
|
-
const spacer = createSpacer(tag, classes, { gridColumn: `span ${size}`})
|
|
87
|
+
const spacer = createSpacer(tag, classes, { gridColumn: `span ${size}` })
|
|
88
88
|
|
|
89
89
|
fragment.appendChild(spacer)
|
|
90
90
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MarkdownIt from 'markdown-it'
|
|
2
|
-
import {
|
|
2
|
+
import { Ref, onUnmounted } from 'vue'
|
|
3
3
|
import { useRouter } from 'vue-router'
|
|
4
|
-
import { isCallbackUrl, isExternalUrl,
|
|
4
|
+
import { LinkAttrs, isCallbackUrl, isExternalUrl, linkPlugin } from './markdown/LinkPlugin'
|
|
5
5
|
|
|
6
6
|
export type UseMarkdown = (source: string, inline: boolean) => string
|
|
7
7
|
|
package/lib/support/Day.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { helpers } from '@vuelidate/validators'
|
|
2
|
-
import { hms as baseHms
|
|
2
|
+
import { Hms, HmsType, hms as baseHms } from '../validators/hms'
|
|
3
3
|
|
|
4
4
|
export function hms(required?: HmsType[], msg?: string) {
|
|
5
5
|
return helpers.withMessage(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { helpers } from '@vuelidate/validators'
|
|
2
|
-
import { requiredHms as baseRequiredHms
|
|
2
|
+
import { Hms, HmsType, requiredHms as baseRequiredHms } from '../validators/requiredHms'
|
|
3
3
|
|
|
4
4
|
export function requiredHms(required?: HmsType[], msg?: string) {
|
|
5
5
|
return helpers.withMessage(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { helpers } from '@vuelidate/validators'
|
|
2
|
-
import { requiredYmd as baseRequiredYmd
|
|
2
|
+
import { Ymd, YmdType, requiredYmd as baseRequiredYmd } from '../validators/requiredYmd'
|
|
3
3
|
|
|
4
4
|
export function requiredYmd(required?: YmdType[], msg?: string) {
|
|
5
5
|
return helpers.withMessage(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { helpers } from '@vuelidate/validators'
|
|
2
|
-
import { ymd as baseYmd
|
|
2
|
+
import { Ymd, YmdType, ymd as baseYmd } from '../validators/ymd'
|
|
3
3
|
|
|
4
4
|
export function ymd(required?: YmdType[], msg?: string) {
|
|
5
5
|
return helpers.withMessage(
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Vue Components for Global Brain Design System.",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
],
|
|
5
|
+
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
6
|
+
"license": "MIT",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "git@github.com:globalbrain/sefirot.git"
|
|
11
10
|
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/globalbrain/sefirot/issues"
|
|
13
|
+
},
|
|
12
14
|
"keywords": [
|
|
13
15
|
"sefirot",
|
|
14
16
|
"vue",
|
|
15
17
|
"vue component"
|
|
16
18
|
],
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"url": "https://github.com/globalbrain/sefirot/issues"
|
|
21
|
-
},
|
|
19
|
+
"files": [
|
|
20
|
+
"lib"
|
|
21
|
+
],
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@iconify-icons/ph": "^1.2.2",
|
|
24
24
|
"@iconify/vue": "^4.0.0",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"vue-router": "^4.1.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@globalbrain/eslint-config": "^0.1.0",
|
|
46
47
|
"@histoire/plugin-vue": "^0.10.7",
|
|
47
48
|
"@iconify-icons/ph": "^1.2.2",
|
|
48
49
|
"@iconify/vue": "^4.0.0",
|
|
@@ -50,8 +51,6 @@
|
|
|
50
51
|
"@types/lodash-es": "^4.17.6",
|
|
51
52
|
"@types/markdown-it": "^12.2.3",
|
|
52
53
|
"@types/node": "^18.8.0",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
|
54
|
-
"@typescript-eslint/parser": "^5.38.0",
|
|
55
54
|
"@vitejs/plugin-vue": "^3.1.2",
|
|
56
55
|
"@vitest/coverage-c8": "^0.23.4",
|
|
57
56
|
"@vue/test-utils": "^2.1.0",
|
|
@@ -64,8 +63,6 @@
|
|
|
64
63
|
"dayjs": "^1.11.5",
|
|
65
64
|
"enquirer": "^2.3.6",
|
|
66
65
|
"eslint": "^8.23.1",
|
|
67
|
-
"eslint-plugin-import": "^2.26.0",
|
|
68
|
-
"eslint-plugin-vue": "^9.5.1",
|
|
69
66
|
"execa": "^5.1.1",
|
|
70
67
|
"fuse.js": "^6.6.2",
|
|
71
68
|
"happy-dom": "^6.0.4",
|
|
@@ -94,8 +91,8 @@
|
|
|
94
91
|
"story:build": "histoire build",
|
|
95
92
|
"story:preview": "histoire preview --port 3000",
|
|
96
93
|
"type": "vue-tsc --noEmit",
|
|
97
|
-
"lint": "eslint --
|
|
98
|
-
"lint:fail": "eslint
|
|
94
|
+
"lint": "eslint --fix .",
|
|
95
|
+
"lint:fail": "eslint .",
|
|
99
96
|
"vitest": "vitest",
|
|
100
97
|
"coverage": "vitest run --coverage",
|
|
101
98
|
"test": "pnpm run type && pnpm run lint && pnpm run coverage",
|