@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.
Files changed (106) hide show
  1. package/config/nuxt.d.ts +4 -0
  2. package/config/nuxt.js +31 -0
  3. package/config/vite.d.ts +8 -0
  4. package/config/vite.js +69 -0
  5. package/lib/components/SActionList.vue +0 -1
  6. package/lib/components/SActionListItem.vue +3 -11
  7. package/lib/components/SAlert.vue +8 -13
  8. package/lib/components/SButton.vue +9 -10
  9. package/lib/components/SCardBlock.vue +0 -6
  10. package/lib/components/SControlActionBarClose.vue +1 -1
  11. package/lib/components/SControlActionBarCollapse.vue +2 -2
  12. package/lib/components/SControlInputSearch.vue +2 -2
  13. package/lib/components/SDescAvatar.vue +1 -2
  14. package/lib/components/SDescFile.vue +4 -6
  15. package/lib/components/SDescPill.vue +1 -2
  16. package/lib/components/SDescText.vue +1 -1
  17. package/lib/components/SDropdownSectionDateRange.vue +2 -2
  18. package/lib/components/SDropdownSectionDateRangeDateFromTo.vue +2 -2
  19. package/lib/components/SDropdownSectionDateRangeYear.vue +2 -2
  20. package/lib/components/SDropdownSectionDateRangeYearHalf.vue +2 -2
  21. package/lib/components/SDropdownSectionDateRangeYearQuarter.vue +2 -2
  22. package/lib/components/SDropdownSectionFilter.vue +4 -6
  23. package/lib/components/SIndicator.vue +10 -16
  24. package/lib/components/SInputAddon.vue +6 -8
  25. package/lib/components/SInputBase.vue +6 -8
  26. package/lib/components/SInputCheckbox.vue +7 -11
  27. package/lib/components/SInputCheckboxes.vue +3 -4
  28. package/lib/components/SInputDate.vue +3 -4
  29. package/lib/components/SInputDropdown.vue +10 -13
  30. package/lib/components/SInputDropdownItemAvatar.vue +2 -3
  31. package/lib/components/SInputDropdownItemText.vue +2 -3
  32. package/lib/components/SInputFile.vue +3 -4
  33. package/lib/components/SInputHMS.vue +4 -5
  34. package/lib/components/SInputImage.vue +5 -7
  35. package/lib/components/SInputNumber.vue +10 -11
  36. package/lib/components/SInputRadio.vue +3 -4
  37. package/lib/components/SInputRadios.vue +3 -4
  38. package/lib/components/SInputSegments.vue +3 -4
  39. package/lib/components/SInputSelect.vue +7 -9
  40. package/lib/components/SInputSwitch.vue +3 -4
  41. package/lib/components/SInputSwitches.vue +3 -4
  42. package/lib/components/SInputText.vue +7 -9
  43. package/lib/components/SInputTextarea.vue +3 -4
  44. package/lib/components/SInputYMD.vue +4 -5
  45. package/lib/components/SLink.vue +1 -1
  46. package/lib/components/SLocalNavMenu.vue +3 -4
  47. package/lib/components/SLoginPage.vue +3 -3
  48. package/lib/components/SLoginPagePasswordDialog.vue +4 -4
  49. package/lib/components/SPagination.vue +2 -2
  50. package/lib/components/SPill.vue +1 -5
  51. package/lib/components/SSnackbar.vue +2 -3
  52. package/lib/components/SStep.vue +4 -5
  53. package/lib/components/STable.vue +1 -2
  54. package/lib/components/STableCell.vue +5 -13
  55. package/lib/components/STableCellAvatar.vue +10 -27
  56. package/lib/components/STableCellAvatars.vue +6 -19
  57. package/lib/components/STableCellDay.vue +4 -11
  58. package/lib/components/STableCellNumber.vue +8 -9
  59. package/lib/components/STableCellPill.vue +5 -33
  60. package/lib/components/STableCellPills.vue +4 -14
  61. package/lib/components/STableCellState.vue +3 -3
  62. package/lib/components/STableCellText.vue +22 -50
  63. package/lib/components/STableColumn.vue +4 -6
  64. package/lib/components/STableFooter.vue +4 -5
  65. package/lib/components/STableHeader.vue +2 -19
  66. package/lib/components/STableHeaderMenu.vue +1 -2
  67. package/lib/components/STableHeaderMenuItem.vue +2 -3
  68. package/lib/components/STableItem.vue +1 -1
  69. package/lib/composables/Data.ts +8 -102
  70. package/lib/composables/Error.ts +3 -3
  71. package/lib/composables/Table.ts +17 -22
  72. package/lib/composables/Utils.ts +2 -2
  73. package/lib/composables/Validation.ts +76 -14
  74. package/lib/http/Http.ts +27 -10
  75. package/lib/mixins/Card.ts +0 -27
  76. package/lib/mixins/Fundamental.ts +0 -3
  77. package/lib/support/Day.ts +5 -5
  78. package/lib/support/Utils.ts +35 -14
  79. package/lib/validation/validators/maxLength.ts +2 -2
  80. package/lib/validation/validators/maxValue.ts +2 -2
  81. package/lib/validation/validators/minLength.ts +2 -2
  82. package/lib/validation/validators/minValue.ts +2 -2
  83. package/lib/validation/validators/required.ts +4 -4
  84. package/package.json +40 -40
  85. package/lib/components/SCardFooter.vue +0 -22
  86. package/lib/components/SCardFooterAction.vue +0 -31
  87. package/lib/components/SCardFooterActions.vue +0 -18
  88. package/lib/components/SCardHeader.vue +0 -15
  89. package/lib/components/SCardHeaderAction.vue +0 -28
  90. package/lib/components/SCardHeaderActionClose.vue +0 -27
  91. package/lib/components/SCardHeaderActionCollapse.vue +0 -47
  92. package/lib/components/SCardHeaderActions.vue +0 -13
  93. package/lib/components/SCardHeaderTitle.vue +0 -29
  94. package/lib/components/SIcon.vue +0 -13
  95. package/lib/components/SSheet.vue +0 -87
  96. package/lib/components/SSheetFooter.vue +0 -16
  97. package/lib/components/SSheetFooterAction.vue +0 -34
  98. package/lib/components/SSheetFooterActions.vue +0 -14
  99. package/lib/components/SSheetForm.vue +0 -15
  100. package/lib/components/SSheetMedium.vue +0 -72
  101. package/lib/components/SSheetTitle.vue +0 -13
  102. package/lib/components/STableHeaderActions.vue +0 -20
  103. package/lib/composables/D.ts +0 -21
  104. package/lib/composables/Form.ts +0 -109
  105. package/lib/composables/V.ts +0 -97
  106. package/lib/mixins/Sheet.ts +0 -30
@@ -1,9 +1,8 @@
1
1
  <script setup lang="ts">
2
- import IconCaretDown from '@iconify-icons/ph/caret-down-bold'
3
2
  import { type DropdownSection } from '../composables/Dropdown'
4
3
  import { useFlyout } from '../composables/Flyout'
5
4
  import SDropdown from './SDropdown.vue'
6
- import SIcon from './SIcon.vue'
5
+ import IconCaretDown from '~icons/ph/caret-down-bold'
7
6
 
8
7
  defineProps<{
9
8
  label: string
@@ -19,7 +18,7 @@ const { container, isOpen, toggle } = useFlyout()
19
18
  <button class="button" :class="[state]" @click="toggle">
20
19
  <span class="label">{{ label }}</span>
21
20
  <span v-if="state !== 'indicate'" class="caret">
22
- <SIcon class="caret-svg" :icon="IconCaretDown" />
21
+ <IconCaretDown class="caret-svg" />
23
22
  </span>
24
23
  <span v-else class="indicator">
25
24
  <span class="indicator-dot" />
@@ -11,7 +11,7 @@ const classes = computed(() => [
11
11
  'STableItem',
12
12
  props.className,
13
13
  `col-${props.name}`,
14
- { adjusted: props.width },
14
+ { adjusted: !!props.width },
15
15
  { auto: props.width === 'auto' }
16
16
  ])
17
17
  </script>
@@ -1,115 +1,21 @@
1
- /**
2
- * @deprecated Use `composables/D` module instead.
3
- */
1
+ import { type Ref, ref } from 'vue'
4
2
 
5
- import { watchOnce } from '@vueuse/core'
6
- import cloneDeep from 'lodash-es/cloneDeep'
7
- import { type WatchSource, reactive } from 'vue'
8
- import { isNullish, isObject } from '../support/Utils'
9
-
10
- export interface Data<T extends Record<string, any>> {
11
- state: T
3
+ export interface D<T extends Record<string, any>> {
4
+ data: Ref<T>
12
5
  init(): void
13
6
  }
14
7
 
15
- export type DataWithDef = Record<string, any>
16
-
17
- export interface Def<T = any> {
18
- __isDef: true
19
- value: any
20
- source: WatchSource<T>
21
- cb: (value: Exclude<T, undefined>) => void
22
- }
23
-
24
- export type UseDataInput<
25
- T extends Record<string, any>
26
- > = T | ((utils: UseDataInputUtils) => DataWithDef)
27
-
28
- export interface UseDataInputUtils {
29
- def<T>(
30
- value: any,
31
- source: WatchSource<T>,
32
- cb: (value: Exclude<T, null | undefined>) => void
33
- ): Def<T>
34
- }
35
-
36
- export function useData<T extends Record<string, any>>(
37
- data: UseDataInput<T>
38
- ): Data<T> {
39
- const { state, defs } = createState(data)
40
-
41
- const initialState = cloneDeep(state)
42
- const reactiveState = reactive(state)
8
+ export function useData<T extends Record<string, any>>(data: T): D<T> {
9
+ const initialData = JSON.stringify(data)
43
10
 
44
- handleDefs(defs, reactiveState)
11
+ const refData = ref(data) as Ref<T>
45
12
 
46
13
  function init(): void {
47
- Object.assign(reactiveState, initialState)
14
+ refData.value = JSON.parse(initialData) as T
48
15
  }
49
16
 
50
17
  return {
51
- state: reactiveState as T,
18
+ data: refData,
52
19
  init
53
20
  }
54
21
  }
55
-
56
- function createState<T extends Record<string, any>>(
57
- data: UseDataInput<T>
58
- ): { state: T; defs: [string, Def][] } {
59
- if (typeof data !== 'function') {
60
- return { state: data, defs: [] }
61
- }
62
-
63
- const dataWithDef = data({ def })
64
-
65
- const state = {} as T
66
- const defs = [] as [string, Def][]
67
-
68
- for (const key in dataWithDef) {
69
- const maybeDef = dataWithDef[key]
70
-
71
- if (!isDef(maybeDef)) {
72
- (state as any)[key] = maybeDef
73
- continue
74
- }
75
-
76
- (state as any)[key] = maybeDef.value
77
-
78
- defs.push([key, maybeDef])
79
- }
80
-
81
- return {
82
- state,
83
- defs
84
- }
85
- }
86
-
87
- function handleDefs<T extends Record<string, any>>(
88
- defs: [string, Def][],
89
- state: T
90
- ): void {
91
- defs.forEach(([key, def]) => {
92
- watchOnce(def.source, (value: any) => {
93
- if (!isNullish(value)) {
94
- (state as any)[key] = def.cb(value)
95
- }
96
- })
97
- })
98
- }
99
-
100
- function def<T>(
101
- value: any,
102
- source: WatchSource<T>,
103
- cb: (value: Exclude<T, null | undefined>) => void
104
- ): Def {
105
- return {
106
- __isDef: true,
107
- value,
108
- source,
109
- cb
110
- }
111
- }
112
-
113
- function isDef(value: any): boolean {
114
- return isObject(value) ? !!value.__isDef : false
115
- }
@@ -29,7 +29,7 @@ import {
29
29
  toValue
30
30
  } from 'vue'
31
31
  import { useError } from '../stores/Error'
32
- import { isFunction } from '../support/Utils'
32
+ import { isError } from '../support/Utils'
33
33
 
34
34
  export interface User {
35
35
  id?: string | number
@@ -47,7 +47,7 @@ function classify(str: string): string {
47
47
  }
48
48
 
49
49
  function getComponentName(Component: ConcreteComponent): string | undefined {
50
- return isFunction(Component)
50
+ return typeof Component === 'function'
51
51
  ? Component.displayName || Component.name
52
52
  : Component.name || Component.__name
53
53
  }
@@ -232,7 +232,7 @@ function getErrorMessage(error: unknown | undefined) {
232
232
  return error
233
233
  }
234
234
 
235
- if (error instanceof Error) {
235
+ if (isError(error)) {
236
236
  return error.message
237
237
  }
238
238
 
@@ -18,11 +18,6 @@ export interface Table<
18
18
  rowSize?: MaybeRef<number | undefined>
19
19
  borderless?: MaybeRef<boolean>
20
20
  disableSelection?: (record: R) => boolean
21
-
22
- /**
23
- * @deprecated Use `<SControl>` to add equivalent features.
24
- */
25
- actions?: MaybeRef<TableHeaderAction[]>
26
21
  menu?: MaybeRef<TableMenu[] | TableMenu[][]>
27
22
  header?: MaybeRef<boolean | undefined>
28
23
  footer?: MaybeRef<boolean | undefined>
@@ -61,11 +56,11 @@ export type TableCell<V = any, R = any> =
61
56
  | TableCellText<V, R>
62
57
  | TableCellNumber<V, R>
63
58
  | TableCellDay
64
- | TableCellPill<V, R>
65
- | TableCellPills<V, R>
59
+ | TableCellPill
60
+ | TableCellPills
66
61
  | TableCellState
67
62
  | TableCellAvatar<V, R>
68
- | TableCellAvatars<V, R>
63
+ | TableCellAvatars
69
64
  | TableCellCustom
70
65
  | TableCellEmpty
71
66
  | TableCellComponent
@@ -102,10 +97,10 @@ export interface TableCellText<V = any, R = any> extends TableCellBase {
102
97
  type: 'text'
103
98
  align?: 'left' | 'center' | 'right'
104
99
  icon?: any
105
- value?: string | null | ((value: V, record: R) => string | null)
106
- link?: string | null | ((value: V, record: R) => string)
107
- color?: TableCellValueColor | ((value: V, record: R) => TableCellValueColor)
108
- iconColor?: TableCellValueColor | ((value: V, record: R) => TableCellValueColor)
100
+ value?: string | null
101
+ link?: string | null
102
+ color?: TableCellValueColor
103
+ iconColor?: TableCellValueColor
109
104
  onClick?(value: V, record: R): void
110
105
  }
111
106
 
@@ -131,17 +126,17 @@ export interface TableCellDay extends TableCellBase {
131
126
  color?: 'neutral' | 'soft' | 'mute'
132
127
  }
133
128
 
134
- export interface TableCellPill<V = any, R = any> extends TableCellBase {
129
+ export interface TableCellPill extends TableCellBase {
135
130
  type: 'pill'
136
- value?: string | ((value: V, record: R) => string)
137
- color?: TableCellPillColor | ((value: V, record: R) => TableCellPillColor)
131
+ value?: string
132
+ color?: TableCellPillColor
138
133
  }
139
134
 
140
135
  export type TableCellPillColor = ColorModes
141
136
 
142
- export interface TableCellPills<V = any, R = any> extends TableCellBase {
137
+ export interface TableCellPills extends TableCellBase {
143
138
  type: 'pills'
144
- pills: TableCellPillItem[] | ((value: V, record: R) => TableCellPillItem[])
139
+ pills: TableCellPillItem[]
145
140
  }
146
141
 
147
142
  export interface TableCellPillItem {
@@ -151,16 +146,16 @@ export interface TableCellPillItem {
151
146
 
152
147
  export interface TableCellAvatar<V = any, R = any> extends TableCellBase {
153
148
  type: 'avatar'
154
- image?: string | null | ((value: V, record: R) => string | null | undefined)
155
- name?: string | null | ((value: V, record: R) => string | null | undefined)
156
- link?: string | null | ((value: V, record: R) => string | null | undefined)
149
+ image?: string | null
150
+ name?: string | null
151
+ link?: string | null
157
152
  color?: 'neutral' | 'soft' | 'mute'
158
153
  onClick?(value: V, record: R): void
159
154
  }
160
155
 
161
- export interface TableCellAvatars<V = any, R = any> extends TableCellBase {
156
+ export interface TableCellAvatars extends TableCellBase {
162
157
  type: 'avatars'
163
- avatars: TableCellAvatarsOption[] | ((value: V, record: R) => TableCellAvatarsOption[])
158
+ avatars: TableCellAvatarsOption[]
164
159
  color?: 'neutral' | 'soft' | 'mute'
165
160
  avatarCount?: number
166
161
  nameCount?: number
@@ -1,5 +1,5 @@
1
1
  import { type ComputedRef, type MaybeRefOrGetter, computed, getCurrentInstance, onMounted, toValue, useSlots } from 'vue'
2
- import { isArray, isString } from '../support/Utils'
2
+ import { isString } from '../support/Utils'
3
3
 
4
4
  export type WhenCondition<T> = MaybeRefOrGetter<T>
5
5
 
@@ -42,7 +42,7 @@ export function useHasSlotContent(name = 'default'): ComputedRef<boolean> {
42
42
 
43
43
  return computed(() => {
44
44
  return !!slots[name]?.().some((s) => {
45
- return isArray(s.children) ? true : !!(s.children as string).trim()
45
+ return Array.isArray(s.children) ? true : !!(s.children as string).trim()
46
46
  })
47
47
  })
48
48
  }
@@ -1,16 +1,23 @@
1
- /**
2
- * @deprecated Use `composables/V` module instead.
3
- */
4
-
5
1
  import {
6
- type GlobalConfig,
7
2
  type Validation,
8
3
  type ValidationArgs,
4
+ type GlobalConfig as VuelidateConfig,
9
5
  useVuelidate
10
6
  } from '@vuelidate/core'
11
- import { type Ref, type ToRefs } from 'vue'
7
+ import { type MaybeRefOrGetter, type Ref, computed, toValue } from 'vue'
8
+ import { type Snackbar, useSnackbars } from '../stores/Snackbars'
9
+ import { useTrans } from './Lang'
12
10
 
13
- export type { Validation, ValidationArgs, GlobalConfig }
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
+ }
14
21
 
15
22
  export interface Validatable {
16
23
  readonly $dirty: boolean
@@ -23,13 +30,68 @@ export interface ValidatableError {
23
30
  readonly $message: string | Ref<string>
24
31
  }
25
32
 
33
+ export interface VNotification {
34
+ notify(message?: Snackbar): void
35
+ }
36
+
26
37
  export function useValidation<
27
- T extends { [key in keyof R]: any },
28
- R extends ValidationArgs = ValidationArgs
38
+ Data extends { [key in keyof Rules]: any },
39
+ Rules extends ValidationArgs = ValidationArgs
29
40
  >(
30
- state: T | Ref<T> | ToRefs<T>,
31
- rules: Ref<R> | R,
32
- config?: GlobalConfig
33
- ): Ref<Validation<R, T>> {
34
- return useVuelidate(rules, state, config)
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
+ }
35
97
  }
package/lib/http/Http.ts CHANGED
@@ -1,9 +1,16 @@
1
1
  import { parse as parseContentDisposition } from '@tinyhttp/content-disposition'
2
2
  import { parse as parseCookie } from '@tinyhttp/cookie'
3
3
  import FileSaver from 'file-saver'
4
- import { type FetchOptions, type FetchRequest, type FetchResponse, ofetch } from 'ofetch'
4
+ import {
5
+ FetchError,
6
+ type FetchOptions,
7
+ type FetchRequest,
8
+ type FetchResponse,
9
+ ofetch
10
+ } from 'ofetch'
5
11
  import { stringify } from 'qs'
6
12
  import { type Lang } from '../composables/Lang'
13
+ import { isBlob, isError, isFormData, isRequest, isResponse, isString } from '../support/Utils'
7
14
 
8
15
  export interface HttpClient {
9
16
  <T = any>(request: FetchRequest, options?: Omit<FetchOptions, 'method'>): Promise<T>
@@ -106,11 +113,11 @@ export class Http {
106
113
  }
107
114
 
108
115
  async post<T = any>(url: string, body?: any, options?: FetchOptions): Promise<T> {
109
- if (body && !(body instanceof FormData)) {
116
+ if (body && !isFormData(body)) {
110
117
  let hasFile = false
111
118
 
112
119
  const payload = JSON.stringify(body, (_, value) => {
113
- if (value instanceof Blob) {
120
+ if (isBlob(value)) {
114
121
  hasFile = true
115
122
  return undefined
116
123
  }
@@ -177,15 +184,11 @@ export class Http {
177
184
  return
178
185
  }
179
186
 
180
- if (
181
- typeof obj[property] === 'object'
182
- && !(obj[property] instanceof Blob)
183
- && obj[property] !== null
184
- ) {
187
+ if (typeof obj[property] === 'object' && !isBlob(obj[property]) && obj[property] !== null) {
185
188
  this.objectToFormData(obj[property], fd, property, onlyFiles)
186
189
  } else {
187
190
  const value = obj[property] === null ? '' : obj[property]
188
- if (onlyFiles && !(value instanceof Blob)) {
191
+ if (onlyFiles && !isBlob(value)) {
189
192
  return
190
193
  }
191
194
  fd.append(formKey, value)
@@ -196,4 +199,18 @@ export class Http {
196
199
  }
197
200
  }
198
201
 
199
- export type { FetchOptions }
202
+ export function isFetchError(e: unknown): e is FetchError {
203
+ return (
204
+ e instanceof FetchError
205
+ || (isError(e)
206
+ && (isString((e as FetchError).request) || isRequest((e as FetchError).request))
207
+ && ((e as FetchError).response === undefined || isResponse((e as FetchError).response))
208
+ && e.message.startsWith(
209
+ `[${((e as FetchError).request as Request | undefined)?.method || (e as FetchError).options?.method || 'GET'}] ${
210
+ JSON.stringify(((e as FetchError).request as Request | undefined)?.url || String((e as FetchError).request) || '/')
211
+ }: `
212
+ ))
213
+ )
214
+ }
215
+
216
+ export { FetchError, type FetchOptions, type FetchRequest, type FetchResponse } from 'ofetch'
@@ -1,42 +1,15 @@
1
1
  import { type App } from 'vue'
2
2
  import SCard from '../components/SCard.vue'
3
3
  import SCardBlock from '../components/SCardBlock.vue'
4
- import SCardFooter from '../components/SCardFooter.vue'
5
- import SCardFooterAction from '../components/SCardFooterAction.vue'
6
- import SCardFooterActions from '../components/SCardFooterActions.vue'
7
- import SCardHeader from '../components/SCardHeader.vue'
8
- import SCardHeaderAction from '../components/SCardHeaderAction.vue'
9
- import SCardHeaderActionClose from '../components/SCardHeaderActionClose.vue'
10
- import SCardHeaderActionCollapse from '../components/SCardHeaderActionCollapse.vue'
11
- import SCardHeaderActions from '../components/SCardHeaderActions.vue'
12
- import SCardHeaderTitle from '../components/SCardHeaderTitle.vue'
13
4
 
14
5
  export function mixin(app: App): void {
15
6
  app.component('SCard', SCard)
16
7
  app.component('SCardBlock', SCardBlock)
17
- app.component('SCardFooter', SCardFooter)
18
- app.component('SCardFooterAction', SCardFooterAction)
19
- app.component('SCardFooterActions', SCardFooterActions)
20
- app.component('SCardHeader', SCardHeader)
21
- app.component('SCardHeaderAction', SCardHeaderAction)
22
- app.component('SCardHeaderActionClose', SCardHeaderActionClose)
23
- app.component('SCardHeaderActionCollapse', SCardHeaderActionCollapse)
24
- app.component('SCardHeaderActions', SCardHeaderActions)
25
- app.component('SCardHeaderTitle', SCardHeaderTitle)
26
8
  }
27
9
 
28
10
  declare module 'vue' {
29
11
  export interface GlobalComponents {
30
12
  SCard: typeof SCard
31
13
  SCardBlock: typeof SCardBlock
32
- SCardFooter: typeof SCardFooter
33
- SCardFooterAction: typeof SCardFooterAction
34
- SCardFooterActions: typeof SCardFooterActions
35
- SCardHeader: typeof SCardHeader
36
- SCardHeaderAction: typeof SCardHeaderAction
37
- SCardHeaderActionClose: typeof SCardHeaderActionClose
38
- SCardHeaderActionCollapse: typeof SCardHeaderActionCollapse
39
- SCardHeaderActions: typeof SCardHeaderActions
40
- SCardHeaderTitle: typeof SCardHeaderTitle
41
14
  }
42
15
  }
@@ -1,7 +1,6 @@
1
1
  import { type App } from 'vue'
2
2
  import SContent from '../components/SContent.vue'
3
3
  import SDivider from '../components/SDivider.vue'
4
- import SIcon from '../components/SIcon.vue'
5
4
  import SLink from '../components/SLink.vue'
6
5
  import SModal from '../components/SModal.vue'
7
6
  import STrans from '../components/STrans.vue'
@@ -22,7 +21,6 @@ export function mixin(app: App): void {
22
21
 
23
22
  app.component('SContent', SContent)
24
23
  app.component('SDivider', SDivider)
25
- app.component('SIcon', SIcon)
26
24
  app.component('SLink', SLink)
27
25
  app.component('SModal', SModal)
28
26
  app.component('STrans', STrans)
@@ -32,7 +30,6 @@ declare module 'vue' {
32
30
  export interface GlobalComponents {
33
31
  SContent: typeof SContent
34
32
  SDivider: typeof SDivider
35
- SIcon: typeof SIcon
36
33
  SLink: typeof SLink
37
34
  SModal: typeof SModal
38
35
  STrans: typeof STrans
@@ -2,7 +2,7 @@ import dayjs, { type ConfigType, type Dayjs } from 'dayjs'
2
2
  import PluginRelativeTime from 'dayjs/plugin/relativeTime'
3
3
  import PluginTimezone from 'dayjs/plugin/timezone'
4
4
  import PluginUtc from 'dayjs/plugin/utc'
5
- import { isNullish, isNumber, isObject, isString } from './Utils'
5
+ import { isNumber, isObject, isString } from './Utils'
6
6
 
7
7
  dayjs.extend(PluginUtc)
8
8
  dayjs.extend(PluginTimezone)
@@ -67,7 +67,7 @@ export function createYmd(
67
67
  month: number | null = null,
68
68
  date: number | null = null
69
69
  ): Ymd {
70
- if (isNumber(yearOrDay) || isNullish(yearOrDay)) {
70
+ if (isNumber(yearOrDay) || yearOrDay == null) {
71
71
  return {
72
72
  year: yearOrDay,
73
73
  month,
@@ -92,7 +92,7 @@ export function createHms(
92
92
  minute: string | null = null,
93
93
  second: string | null = null
94
94
  ): Hms {
95
- if (isString(hourOrDay) || isNullish(hourOrDay)) {
95
+ if (isString(hourOrDay) || hourOrDay == null) {
96
96
  return {
97
97
  hour: hourOrDay,
98
98
  minute,
@@ -108,7 +108,7 @@ export function createHms(
108
108
  }
109
109
 
110
110
  export function isYmd(value: unknown, required: YmdType[] = ['y', 'm', 'd']): value is Ymd {
111
- if (isNullish(value) || !isObject(value)) {
111
+ if (value == null || !isObject(value)) {
112
112
  return false
113
113
  }
114
114
 
@@ -121,7 +121,7 @@ export function isYmd(value: unknown, required: YmdType[] = ['y', 'm', 'd']): va
121
121
  }
122
122
 
123
123
  export function isHms(value: unknown, required: HmsType[] = ['h', 'm', 's']): value is Hms {
124
- if (isNullish(value) || !isObject(value)) {
124
+ if (value == null || !isObject(value)) {
125
125
  return false
126
126
  }
127
127
 
@@ -1,28 +1,49 @@
1
- export function isNullish(value: unknown): value is undefined | null {
2
- return value == null
1
+ // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
2
+ // @ts-ignore internal
3
+ import baseGetTag from 'lodash-es/_baseGetTag'
4
+
5
+ import _isDate from 'lodash-es/isDate'
6
+ import _isError from 'lodash-es/isError'
7
+ import _isNumber from 'lodash-es/isNumber'
8
+ import _isPlainObject from 'lodash-es/isPlainObject'
9
+ import _isString from 'lodash-es/isString'
10
+
11
+ export function isBlob(value: unknown): value is Blob {
12
+ return value instanceof Blob || baseGetTag(value) === '[object Blob]'
3
13
  }
4
14
 
5
- export function isString(value: unknown): value is string {
6
- return typeof value === 'string'
15
+ export function isDate(value: unknown): value is Date {
16
+ return _isDate(value)
17
+ }
18
+
19
+ export function isError(value: unknown): value is Error {
20
+ return _isError(value)
21
+ }
22
+
23
+ export function isFile(value: unknown): value is File {
24
+ return value instanceof File || baseGetTag(value) === '[object File]'
25
+ }
26
+
27
+ export function isFormData(value: unknown): value is FormData {
28
+ return value instanceof FormData || baseGetTag(value) === '[object FormData]'
7
29
  }
8
30
 
9
31
  export function isNumber(value: unknown): value is number {
10
- return typeof value === 'number'
32
+ return _isNumber(value)
11
33
  }
12
34
 
13
- export function isArray(value: unknown): value is unknown[] {
14
- return Array.isArray(value)
35
+ export function isObject(value: unknown): value is Record<string, unknown> {
36
+ return _isPlainObject(value)
15
37
  }
16
38
 
17
- export function isObject(value: unknown): value is Record<string, any> {
18
- return typeof value === 'object' && value !== null && !isArray(value)
39
+ export function isRequest(value: unknown): value is Request {
40
+ return value instanceof Request || baseGetTag(value) === '[object Request]'
19
41
  }
20
42
 
21
- export function isFile(value: unknown): value is File {
22
- return value instanceof File
43
+ export function isResponse(value: unknown): value is Response {
44
+ return value instanceof Response || baseGetTag(value) === '[object Response]'
23
45
  }
24
46
 
25
- // eslint-disable-next-line @typescript-eslint/ban-types
26
- export function isFunction(value: unknown): value is Function {
27
- return typeof value === 'function'
47
+ export function isString(value: unknown): value is string {
48
+ return _isString(value)
28
49
  }
@@ -1,7 +1,7 @@
1
- import { isArray, isString } from '../../support/Utils'
1
+ import { isString } from '../../support/Utils'
2
2
 
3
3
  export function maxLength(value: unknown, length: number): boolean {
4
- if (!(isString(value) || isArray(value))) {
4
+ if (!(isString(value) || Array.isArray(value))) {
5
5
  return false
6
6
  }
7
7
 
@@ -1,7 +1,7 @@
1
- import { isNumber, isString } from '../../support/Utils'
1
+ import { isDate, isNumber, isString } from '../../support/Utils'
2
2
 
3
3
  export function maxValue(value: unknown, max: number) {
4
- if (isNumber(value) || isString(value) || value instanceof Date) {
4
+ if (isNumber(value) || isString(value) || isDate(value)) {
5
5
  return +value <= max
6
6
  }
7
7
 
@@ -1,7 +1,7 @@
1
- import { isArray, isString } from '../../support/Utils'
1
+ import { isString } from '../../support/Utils'
2
2
 
3
3
  export function minLength(value: unknown, length: number): boolean {
4
- if (!(isString(value) || isArray(value))) {
4
+ if (!(isString(value) || Array.isArray(value))) {
5
5
  return false
6
6
  }
7
7