@globalbrain/sefirot 3.50.0 → 4.0.0-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/config/nuxt.d.ts +4 -0
- package/config/nuxt.js +31 -0
- package/config/vite.d.ts +8 -0
- package/config/vite.js +69 -0
- package/lib/components/SActionList.vue +0 -1
- package/lib/components/SActionListItem.vue +3 -11
- package/lib/components/SAlert.vue +8 -13
- package/lib/components/SButton.vue +9 -10
- package/lib/components/SCardBlock.vue +0 -6
- package/lib/components/SControlActionBarClose.vue +1 -1
- package/lib/components/SControlActionBarCollapse.vue +2 -2
- package/lib/components/SControlInputSearch.vue +2 -2
- package/lib/components/SDescAvatar.vue +1 -2
- package/lib/components/SDescFile.vue +4 -6
- package/lib/components/SDescPill.vue +1 -2
- package/lib/components/SDescText.vue +1 -1
- package/lib/components/SDropdownSectionDateRange.vue +2 -2
- package/lib/components/SDropdownSectionDateRangeDateFromTo.vue +2 -2
- package/lib/components/SDropdownSectionDateRangeYear.vue +2 -2
- package/lib/components/SDropdownSectionDateRangeYearHalf.vue +2 -2
- package/lib/components/SDropdownSectionDateRangeYearQuarter.vue +2 -2
- package/lib/components/SDropdownSectionFilter.vue +4 -6
- package/lib/components/SIndicator.vue +10 -16
- package/lib/components/SInputAddon.vue +6 -8
- package/lib/components/SInputBase.vue +6 -8
- package/lib/components/SInputCheckbox.vue +7 -11
- package/lib/components/SInputCheckboxes.vue +3 -4
- package/lib/components/SInputDate.vue +3 -4
- package/lib/components/SInputDropdown.vue +10 -13
- package/lib/components/SInputDropdownItemAvatar.vue +2 -3
- package/lib/components/SInputDropdownItemText.vue +2 -3
- package/lib/components/SInputFile.vue +3 -4
- package/lib/components/SInputHMS.vue +4 -5
- package/lib/components/SInputImage.vue +5 -7
- package/lib/components/SInputNumber.vue +10 -11
- package/lib/components/SInputRadio.vue +3 -4
- package/lib/components/SInputRadios.vue +3 -4
- package/lib/components/SInputSegments.vue +3 -4
- package/lib/components/SInputSelect.vue +7 -9
- package/lib/components/SInputSwitch.vue +3 -4
- package/lib/components/SInputSwitches.vue +3 -4
- package/lib/components/SInputText.vue +7 -9
- package/lib/components/SInputTextarea.vue +3 -4
- package/lib/components/SInputYMD.vue +4 -5
- package/lib/components/SLink.vue +1 -1
- package/lib/components/SLocalNavMenu.vue +3 -4
- package/lib/components/SLoginPage.vue +3 -3
- package/lib/components/SLoginPagePasswordDialog.vue +4 -4
- package/lib/components/SPagination.vue +2 -2
- package/lib/components/SPill.vue +1 -5
- package/lib/components/SSnackbar.vue +2 -3
- package/lib/components/SStep.vue +4 -5
- package/lib/components/STable.vue +1 -2
- package/lib/components/STableCell.vue +5 -13
- package/lib/components/STableCellAvatar.vue +10 -27
- package/lib/components/STableCellAvatars.vue +6 -19
- package/lib/components/STableCellDay.vue +4 -11
- package/lib/components/STableCellNumber.vue +8 -9
- package/lib/components/STableCellPill.vue +5 -33
- package/lib/components/STableCellPills.vue +4 -14
- package/lib/components/STableCellState.vue +3 -3
- package/lib/components/STableCellText.vue +22 -50
- package/lib/components/STableColumn.vue +4 -6
- package/lib/components/STableFooter.vue +4 -5
- package/lib/components/STableHeader.vue +2 -19
- package/lib/components/STableHeaderMenu.vue +1 -2
- package/lib/components/STableHeaderMenuItem.vue +2 -3
- package/lib/components/STableItem.vue +1 -1
- package/lib/composables/Data.ts +8 -102
- package/lib/composables/Error.ts +3 -3
- package/lib/composables/Table.ts +17 -22
- package/lib/composables/Utils.ts +2 -2
- package/lib/composables/Validation.ts +76 -14
- package/lib/http/Http.ts +27 -10
- package/lib/mixins/Card.ts +0 -27
- package/lib/mixins/Fundamental.ts +0 -3
- package/lib/support/Day.ts +5 -5
- package/lib/support/Utils.ts +35 -14
- package/lib/validation/validators/maxLength.ts +2 -2
- package/lib/validation/validators/maxValue.ts +2 -2
- package/lib/validation/validators/minLength.ts +2 -2
- package/lib/validation/validators/minValue.ts +2 -2
- package/lib/validation/validators/required.ts +4 -4
- package/package.json +40 -40
- package/lib/components/SCardFooter.vue +0 -22
- package/lib/components/SCardFooterAction.vue +0 -31
- package/lib/components/SCardFooterActions.vue +0 -18
- package/lib/components/SCardHeader.vue +0 -15
- package/lib/components/SCardHeaderAction.vue +0 -28
- package/lib/components/SCardHeaderActionClose.vue +0 -27
- package/lib/components/SCardHeaderActionCollapse.vue +0 -47
- package/lib/components/SCardHeaderActions.vue +0 -13
- package/lib/components/SCardHeaderTitle.vue +0 -29
- package/lib/components/SIcon.vue +0 -13
- package/lib/components/SSheet.vue +0 -87
- package/lib/components/SSheetFooter.vue +0 -16
- package/lib/components/SSheetFooterAction.vue +0 -34
- package/lib/components/SSheetFooterActions.vue +0 -14
- package/lib/components/SSheetForm.vue +0 -15
- package/lib/components/SSheetMedium.vue +0 -72
- package/lib/components/SSheetTitle.vue +0 -13
- package/lib/components/STableHeaderActions.vue +0 -20
- package/lib/composables/D.ts +0 -21
- package/lib/composables/Form.ts +0 -109
- package/lib/composables/V.ts +0 -97
- package/lib/mixins/Sheet.ts +0 -30
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { type TableHeaderAction } from '../composables/Table'
|
|
3
|
-
import STableHeaderActionItem from './STableHeaderActionItem.vue'
|
|
4
|
-
|
|
5
|
-
defineProps<{ actions: TableHeaderAction[] }>()
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<div class="STableHeaderActions">
|
|
10
|
-
<STableHeaderActionItem v-for="action in actions" :key="action.label" v-bind="action" />
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<style scoped lang="postcss">
|
|
15
|
-
.STableHeaderActions {
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-grow: 1;
|
|
18
|
-
gap: 8px;
|
|
19
|
-
}
|
|
20
|
-
</style>
|
package/lib/composables/D.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type Ref, ref } from 'vue'
|
|
2
|
-
|
|
3
|
-
export interface D<T extends Record<string, any>> {
|
|
4
|
-
data: Ref<T>
|
|
5
|
-
init(): void
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function useD<T extends Record<string, any>>(data: T): D<T> {
|
|
9
|
-
const initialData = JSON.stringify(data)
|
|
10
|
-
|
|
11
|
-
const refData = ref(data) as Ref<T>
|
|
12
|
-
|
|
13
|
-
function init(): void {
|
|
14
|
-
refData.value = JSON.parse(initialData) as T
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
data: refData,
|
|
19
|
-
init
|
|
20
|
-
}
|
|
21
|
-
}
|
package/lib/composables/Form.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Use `composables/D` and `composables/V` modules instead.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { type Ref, computed, reactive, toRefs } from 'vue'
|
|
6
|
-
import { type Snackbar, useSnackbars } from '../stores/Snackbars'
|
|
7
|
-
import { type UseDataInput, useData } from './Data'
|
|
8
|
-
import { type Validation, useValidation } from './Validation'
|
|
9
|
-
|
|
10
|
-
export interface Form<T extends Record<string, any>> {
|
|
11
|
-
data: T
|
|
12
|
-
validation: Ref<Validation<any, T>>
|
|
13
|
-
init(): void
|
|
14
|
-
reset(): void
|
|
15
|
-
validate(): Promise<boolean>
|
|
16
|
-
validateAndNotify(message?: Snackbar): Promise<boolean>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type ComputedData<T extends Record<string, () => any>> = {
|
|
20
|
-
[K in keyof T]: ReturnType<T[K]>
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type AllData<
|
|
24
|
-
D extends Record<string, any>,
|
|
25
|
-
C extends Record<string, () => any>
|
|
26
|
-
> = D & ComputedData<C>
|
|
27
|
-
|
|
28
|
-
export interface UseFormOptions<
|
|
29
|
-
D extends Record<string, any>,
|
|
30
|
-
C extends Record<string, () => any>
|
|
31
|
-
> {
|
|
32
|
-
data: UseDataInput<D>
|
|
33
|
-
computed?: (data: D) => C
|
|
34
|
-
rules?: Record<string, any> | ((data: AllData<D, C>) => Record<string, any>)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function useForm<
|
|
38
|
-
D extends Record<string, any> = Record<string, any>,
|
|
39
|
-
C extends Record<string, () => any> = Record<string, () => any>
|
|
40
|
-
>(options: UseFormOptions<D, C>): Form<AllData<D, C>> {
|
|
41
|
-
const snackbars = useSnackbars()
|
|
42
|
-
|
|
43
|
-
const data = useData(options.data)
|
|
44
|
-
const dataStateRef = toRefs(data.state)
|
|
45
|
-
|
|
46
|
-
const computedData = options.computed
|
|
47
|
-
? createComputedData(options.computed(data.state))
|
|
48
|
-
: {}
|
|
49
|
-
|
|
50
|
-
const allData = reactive({
|
|
51
|
-
...dataStateRef,
|
|
52
|
-
...computedData
|
|
53
|
-
}) as AllData<D, C>
|
|
54
|
-
|
|
55
|
-
const rules = computed(() => {
|
|
56
|
-
return options.rules
|
|
57
|
-
? typeof options.rules === 'function' ? options.rules(allData) : options.rules
|
|
58
|
-
: {}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
const validation = useValidation(allData, rules)
|
|
62
|
-
|
|
63
|
-
function init(): void {
|
|
64
|
-
data.init()
|
|
65
|
-
reset()
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function reset(): void {
|
|
69
|
-
validation.value.$reset()
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function validate(): Promise<boolean> {
|
|
73
|
-
return validation.value.$validate()
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async function validateAndNotify(message?: Snackbar): Promise<boolean> {
|
|
77
|
-
const valid = await validate()
|
|
78
|
-
|
|
79
|
-
if (!valid) {
|
|
80
|
-
snackbars.push(message ?? {
|
|
81
|
-
mode: 'danger',
|
|
82
|
-
text: 'Form contains errors. Please correct them and try again.'
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return valid
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
data: allData,
|
|
91
|
-
init,
|
|
92
|
-
reset,
|
|
93
|
-
validation,
|
|
94
|
-
validate,
|
|
95
|
-
validateAndNotify
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function createComputedData<
|
|
100
|
-
C extends Record<string, () => any>
|
|
101
|
-
>(input: C): ComputedData<C> {
|
|
102
|
-
const computedData = {} as any
|
|
103
|
-
|
|
104
|
-
for (const [key, fn] of Object.entries(input)) {
|
|
105
|
-
computedData[key] = computed(() => fn())
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return computedData
|
|
109
|
-
}
|
package/lib/composables/V.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Validation,
|
|
3
|
-
type ValidationArgs,
|
|
4
|
-
type GlobalConfig as VuelidateConfig,
|
|
5
|
-
useVuelidate
|
|
6
|
-
} from '@vuelidate/core'
|
|
7
|
-
import { type MaybeRefOrGetter, type Ref, computed, toValue } from 'vue'
|
|
8
|
-
import { type Snackbar, useSnackbars } from '../stores/Snackbars'
|
|
9
|
-
import { useTrans } from './Lang'
|
|
10
|
-
|
|
11
|
-
export interface V<
|
|
12
|
-
Data extends { [key in keyof Rules]: any },
|
|
13
|
-
Rules extends ValidationArgs = ValidationArgs
|
|
14
|
-
> {
|
|
15
|
-
validation: Ref<Validation<Rules, Data>>
|
|
16
|
-
validate(): Promise<boolean>
|
|
17
|
-
validateAndNotify(message?: Snackbar): Promise<boolean>
|
|
18
|
-
notify(message?: Snackbar): void
|
|
19
|
-
reset(): void
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface Validatable {
|
|
23
|
-
readonly $dirty: boolean
|
|
24
|
-
readonly $invalid: boolean
|
|
25
|
-
readonly $errors: ValidatableError[]
|
|
26
|
-
readonly $touch: () => void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ValidatableError {
|
|
30
|
-
readonly $message: string | Ref<string>
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface VNotification {
|
|
34
|
-
notify(message?: Snackbar): void
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function useV<
|
|
38
|
-
Data extends { [key in keyof Rules]: any },
|
|
39
|
-
Rules extends ValidationArgs = ValidationArgs
|
|
40
|
-
>(
|
|
41
|
-
data?: MaybeRefOrGetter<Data>,
|
|
42
|
-
rules?: MaybeRefOrGetter<Rules>,
|
|
43
|
-
config?: VuelidateConfig
|
|
44
|
-
): V<Data, Rules> {
|
|
45
|
-
const { notify } = useVNotification()
|
|
46
|
-
|
|
47
|
-
const d = computed(() => toValue(data) ?? {})
|
|
48
|
-
const r = computed(() => toValue(rules) ?? {})
|
|
49
|
-
|
|
50
|
-
const validation = useVuelidate(r, d, config) as any
|
|
51
|
-
|
|
52
|
-
function reset(): void {
|
|
53
|
-
validation.value.$reset()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function validate(): Promise<boolean> {
|
|
57
|
-
return validation.value.$validate()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function validateAndNotify(message?: Snackbar): Promise<boolean> {
|
|
61
|
-
const valid = await validate()
|
|
62
|
-
|
|
63
|
-
if (!valid) {
|
|
64
|
-
notify(message)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return valid
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
validation,
|
|
72
|
-
validate,
|
|
73
|
-
validateAndNotify,
|
|
74
|
-
notify,
|
|
75
|
-
reset
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function useVNotification(): VNotification {
|
|
80
|
-
const { t } = useTrans({
|
|
81
|
-
en: { notify: 'Form contains errors. Please correct them and try again.' },
|
|
82
|
-
ja: { notify: 'フォームにエラーがあります。内容を確認し、再度お試しください。' }
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
const snackbars = useSnackbars()
|
|
86
|
-
|
|
87
|
-
function notify(message?: Snackbar): void {
|
|
88
|
-
snackbars.push(message ?? {
|
|
89
|
-
mode: 'danger',
|
|
90
|
-
text: t.notify
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return {
|
|
95
|
-
notify
|
|
96
|
-
}
|
|
97
|
-
}
|
package/lib/mixins/Sheet.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type App } from 'vue'
|
|
2
|
-
import SSheet from '../components/SSheet.vue'
|
|
3
|
-
import SSheetFooter from '../components/SSheetFooter.vue'
|
|
4
|
-
import SSheetFooterAction from '../components/SSheetFooterAction.vue'
|
|
5
|
-
import SSheetFooterActions from '../components/SSheetFooterActions.vue'
|
|
6
|
-
import SSheetForm from '../components/SSheetForm.vue'
|
|
7
|
-
import SSheetMedium from '../components/SSheetMedium.vue'
|
|
8
|
-
import SSheetTitle from '../components/SSheetTitle.vue'
|
|
9
|
-
|
|
10
|
-
export function mixin(app: App): void {
|
|
11
|
-
app.component('SSheet', SSheet)
|
|
12
|
-
app.component('SSheetFooter', SSheetFooter)
|
|
13
|
-
app.component('SSheetFooterAction', SSheetFooterAction)
|
|
14
|
-
app.component('SSheetFooterActions', SSheetFooterActions)
|
|
15
|
-
app.component('SSheetForm', SSheetForm)
|
|
16
|
-
app.component('SSheetMedium', SSheetMedium)
|
|
17
|
-
app.component('SSheetTitle', SSheetTitle)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
declare module 'vue' {
|
|
21
|
-
export interface GlobalComponents {
|
|
22
|
-
SSheet: typeof SSheet
|
|
23
|
-
SSheetFooter: typeof SSheetFooter
|
|
24
|
-
SSheetFooterAction: typeof SSheetFooterAction
|
|
25
|
-
SSheetFooterActions: typeof SSheetFooterActions
|
|
26
|
-
SSheetForm: typeof SSheetForm
|
|
27
|
-
SSheetMedium: typeof SSheetMedium
|
|
28
|
-
SSheetTitle: typeof SSheetTitle
|
|
29
|
-
}
|
|
30
|
-
}
|