@globalbrain/sefirot 4.56.0 → 4.58.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/blocks/lens/components/LensFormFilterCondition.vue +2 -1
- package/lib/blocks/lens/components/LensFormFilterGroup.vue +1 -1
- package/lib/blocks/lens/components/{LensAvatarInput.vue → LensInputAvatar.vue} +5 -3
- package/lib/blocks/lens/components/LensInputDropdown.vue +102 -0
- package/lib/blocks/lens/components/LensSheetAvatarField.vue +2 -2
- package/lib/blocks/lens/components/LensTableEditableCell.vue +5 -4
- package/lib/blocks/lens/fields/AvatarField.ts +2 -2
- package/lib/blocks/lens/fields/Field.ts +10 -6
- package/lib/blocks/lens/filter-inputs/SelectFilterInput.ts +2 -1
- package/lib/components/SButton.vue +2 -10
- package/lib/components/SControlInputSearch.vue +6 -3
- package/lib/components/SDescPill.vue +3 -2
- package/lib/components/SDescState.vue +3 -2
- package/lib/components/SInputAddon.vue +4 -2
- package/lib/components/SInputAsyncDropdown.vue +761 -0
- package/lib/components/SInputBase.vue +1 -3
- package/lib/components/SInputCheckbox.vue +10 -18
- package/lib/components/SInputCheckboxes.vue +16 -33
- package/lib/components/SInputDate.vue +10 -20
- package/lib/components/SInputDropdown.vue +22 -43
- package/lib/components/SInputDropdownItem.vue +10 -27
- package/lib/components/SInputFile.vue +10 -18
- package/lib/components/SInputFileUpload.vue +12 -34
- package/lib/components/SInputFileUploadItem.vue +7 -21
- package/lib/components/SInputHMS.vue +6 -7
- package/lib/components/SInputImage.vue +11 -16
- package/lib/components/SInputNumber.vue +1 -3
- package/lib/components/SInputRadio.vue +9 -19
- package/lib/components/SInputRadios.vue +18 -40
- package/lib/components/SInputSegments.vue +15 -26
- package/lib/components/SInputSegmentsOption.vue +7 -7
- package/lib/components/SInputSelect.vue +14 -19
- package/lib/components/SInputSwitch.vue +10 -19
- package/lib/components/SInputSwitches.vue +16 -30
- package/lib/components/SInputText.vue +1 -4
- package/lib/components/SInputTextarea.vue +0 -2
- package/lib/components/SInputYMD.vue +6 -7
- package/lib/components/SPagination.vue +1 -1
- package/lib/components/SPill.vue +2 -2
- package/lib/components/SState.vue +2 -2
- package/lib/components/STableCellPill.vue +3 -2
- package/lib/components/STableCellState.vue +3 -2
- package/lib/composables/Table.ts +8 -15
- package/lib/support/Color.ts +4 -0
- package/lib/support/InputBase.ts +5 -0
- package/lib/support/InputDropdown.ts +15 -0
- package/lib/support/InputFileUpload.ts +22 -0
- package/lib/support/InputOption.ts +8 -0
- package/lib/support/InputText.ts +6 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import IconQuestion from '~icons/ph/question'
|
|
3
3
|
import { type Component, computed, unref, useSlots } from 'vue'
|
|
4
4
|
import { type Validatable } from '../composables/Validation'
|
|
5
|
+
import { type Color, type Size } from '../support/InputBase'
|
|
5
6
|
import STooltip from './STooltip.vue'
|
|
6
7
|
|
|
7
8
|
export interface Props {
|
|
@@ -20,9 +21,6 @@ export interface Props {
|
|
|
20
21
|
hideWarning?: boolean
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
export type Size = 'sm' | 'md' | 'mini' | 'small' | 'medium'
|
|
24
|
-
export type Color = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
25
|
-
|
|
26
24
|
const props = defineProps<Props>()
|
|
27
25
|
|
|
28
26
|
const slots = useSlots()
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import IconCheck from '~icons/ph/check-bold'
|
|
3
3
|
import IconMinus from '~icons/ph/minus-bold'
|
|
4
|
-
import {
|
|
5
|
-
import { type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type { Color, Size }
|
|
9
|
-
|
|
10
|
-
const props = withDefaults(defineProps<{
|
|
11
|
-
size?: Size
|
|
12
|
-
label?: string
|
|
13
|
-
info?: string
|
|
14
|
-
note?: string
|
|
15
|
-
help?: string
|
|
16
|
-
checkIcon?: Component
|
|
17
|
-
checkText?: string
|
|
18
|
-
checkColor?: Color
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
6
|
+
|
|
7
|
+
export interface Props extends BaseProps {
|
|
19
8
|
text?: string
|
|
20
9
|
disabled?: boolean
|
|
21
10
|
value?: boolean | 'indeterminate'
|
|
22
11
|
modelValue?: boolean | 'indeterminate'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
26
15
|
value: undefined,
|
|
27
16
|
modelValue: undefined
|
|
28
17
|
})
|
|
@@ -62,6 +51,7 @@ function onClick() {
|
|
|
62
51
|
class="SInputCheckbox"
|
|
63
52
|
:class="classes"
|
|
64
53
|
:size
|
|
54
|
+
:name
|
|
65
55
|
:label
|
|
66
56
|
:note
|
|
67
57
|
:info
|
|
@@ -70,7 +60,9 @@ function onClick() {
|
|
|
70
60
|
:check-text
|
|
71
61
|
:check-color
|
|
72
62
|
:validation
|
|
63
|
+
:warning
|
|
73
64
|
:hide-error
|
|
65
|
+
:hide-warning
|
|
74
66
|
>
|
|
75
67
|
<div class="container">
|
|
76
68
|
<div
|
|
@@ -1,43 +1,24 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import SInputBase, { type
|
|
1
|
+
<script setup lang="ts" generic="T = any">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { type Option } from '../support/InputOption'
|
|
4
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
5
5
|
import SInputCheckbox from './SInputCheckbox.vue'
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export interface Option {
|
|
12
|
-
label: string
|
|
13
|
-
value: Value
|
|
7
|
+
export interface Props<T = any> extends BaseProps {
|
|
8
|
+
options: Option<T>[]
|
|
9
|
+
nullable?: boolean
|
|
14
10
|
disabled?: boolean
|
|
11
|
+
value?: T[]
|
|
12
|
+
modelValue?: T[]
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
const props = withDefaults(defineProps<{
|
|
18
|
-
size?: Size
|
|
19
|
-
name?: string
|
|
20
|
-
label?: string
|
|
21
|
-
info?: string
|
|
22
|
-
note?: string
|
|
23
|
-
help?: string
|
|
24
|
-
checkIcon?: Component
|
|
25
|
-
checkText?: string
|
|
26
|
-
checkColor?: Color
|
|
27
|
-
options: Option[]
|
|
28
|
-
nullable?: boolean
|
|
29
|
-
disabled?: boolean
|
|
30
|
-
value?: Value[]
|
|
31
|
-
modelValue?: Value[]
|
|
32
|
-
validation?: Validatable
|
|
33
|
-
hideError?: boolean
|
|
34
|
-
}>(), {
|
|
15
|
+
const props = withDefaults(defineProps<Props<T>>(), {
|
|
35
16
|
nullable: true
|
|
36
17
|
})
|
|
37
18
|
|
|
38
19
|
const emit = defineEmits<{
|
|
39
|
-
'update:model-value': [value:
|
|
40
|
-
'change': [value:
|
|
20
|
+
'update:model-value': [value: T[]]
|
|
21
|
+
'change': [value: T[]]
|
|
41
22
|
}>()
|
|
42
23
|
|
|
43
24
|
const _value = computed(() => {
|
|
@@ -48,11 +29,11 @@ const _value = computed(() => {
|
|
|
48
29
|
: []
|
|
49
30
|
})
|
|
50
31
|
|
|
51
|
-
function isChecked(value:
|
|
32
|
+
function isChecked(value: T): boolean {
|
|
52
33
|
return _value.value.includes(value)
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
function onChange(value:
|
|
36
|
+
function onChange(value: T): void {
|
|
56
37
|
const distinct = _value.value
|
|
57
38
|
.filter((v) => v !== value)
|
|
58
39
|
.concat(_value.value.includes(value) ? [] : [value])
|
|
@@ -80,7 +61,9 @@ function onChange(value: Value): void {
|
|
|
80
61
|
:check-text
|
|
81
62
|
:check-color
|
|
82
63
|
:validation
|
|
64
|
+
:warning
|
|
83
65
|
:hide-error
|
|
66
|
+
:hide-warning
|
|
84
67
|
>
|
|
85
68
|
<div class="container">
|
|
86
69
|
<div class="row">
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { DatePicker } from 'v-calendar'
|
|
3
|
-
import {
|
|
4
|
-
import { type Validatable } from '../composables/Validation'
|
|
3
|
+
import { computed } from 'vue'
|
|
5
4
|
import { type Day, day } from '../support/Day'
|
|
6
|
-
import SInputBase, { type
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
const props = defineProps<{
|
|
11
|
-
size?: Size
|
|
12
|
-
name?: string
|
|
13
|
-
label?: string
|
|
14
|
-
info?: string
|
|
15
|
-
note?: string
|
|
16
|
-
help?: string
|
|
17
|
-
checkIcon?: Component
|
|
18
|
-
checkText?: string
|
|
19
|
-
checkColor?: Color
|
|
5
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
6
|
+
|
|
7
|
+
export interface Props extends BaseProps {
|
|
20
8
|
block?: boolean
|
|
21
9
|
disabled?: boolean
|
|
22
10
|
tabindex?: -1 | 0 | number
|
|
23
11
|
modelValue: Day | null
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = defineProps<Props>()
|
|
27
15
|
|
|
28
16
|
const emit = defineEmits<{
|
|
29
17
|
'update:model-value': [value: Day | null]
|
|
@@ -61,8 +49,10 @@ function onBlur() {
|
|
|
61
49
|
:check-icon
|
|
62
50
|
:check-text
|
|
63
51
|
:check-color
|
|
64
|
-
:hide-error
|
|
65
52
|
:validation
|
|
53
|
+
:warning
|
|
54
|
+
:hide-error
|
|
55
|
+
:hide-warning
|
|
66
56
|
>
|
|
67
57
|
<div class="container">
|
|
68
58
|
<DatePicker
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
1
|
+
<script setup lang="ts" generic="T = any">
|
|
2
2
|
import IconCaretDown from '~icons/ph/caret-down'
|
|
3
3
|
import IconCaretUp from '~icons/ph/caret-up'
|
|
4
4
|
import xor from 'lodash-es/xor'
|
|
@@ -6,14 +6,14 @@ import { computed, ref } from 'vue'
|
|
|
6
6
|
import { type DropdownSectionFilter, useManualDropdownPosition } from '../composables/Dropdown'
|
|
7
7
|
import { useFlyout } from '../composables/Flyout'
|
|
8
8
|
import { useTrans } from '../composables/Lang'
|
|
9
|
+
import { type Option } from '../support/InputDropdown'
|
|
9
10
|
import SDropdown from './SDropdown.vue'
|
|
10
11
|
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
11
12
|
import SInputDropdownItem from './SInputDropdownItem.vue'
|
|
12
13
|
|
|
13
|
-
export
|
|
14
|
-
export interface Props extends BaseProps {
|
|
14
|
+
export interface Props<T = any> extends BaseProps {
|
|
15
15
|
placeholder?: string
|
|
16
|
-
options: Option[]
|
|
16
|
+
options: Option<T>[]
|
|
17
17
|
position?: 'top' | 'bottom'
|
|
18
18
|
noSearch?: boolean
|
|
19
19
|
nullable?: boolean
|
|
@@ -21,32 +21,12 @@ export interface Props extends BaseProps {
|
|
|
21
21
|
disabled?: boolean
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
export type ArrayValue = any[]
|
|
26
|
-
export type OptionValue = any
|
|
24
|
+
const props = defineProps<Props<T>>()
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value: OptionValue
|
|
33
|
-
disabled?: boolean
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface OptionText extends OptionBase {
|
|
37
|
-
type?: 'text'
|
|
38
|
-
label: string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface OptionAvatar extends OptionBase {
|
|
42
|
-
type: 'avatar'
|
|
43
|
-
label: string
|
|
44
|
-
image?: string | null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const props = defineProps<Props>()
|
|
48
|
-
|
|
49
|
-
const model = defineModel<PrimitiveValue | ArrayValue>({ required: true })
|
|
26
|
+
// Single- vs multi-select is inferred from the bound model at runtime: an array
|
|
27
|
+
// model selects multiple values, anything else a single value (or `null`) — so no
|
|
28
|
+
// `multiple` prop is needed (unlike SInputAsyncDropdown).
|
|
29
|
+
const model = defineModel<T | T[] | null>({ required: true })
|
|
50
30
|
|
|
51
31
|
const { t } = useTrans({
|
|
52
32
|
en: {
|
|
@@ -78,14 +58,12 @@ const dropdownOptions = computed<DropdownSectionFilter[]>(() => [{
|
|
|
78
58
|
onClick: onSelect
|
|
79
59
|
}])
|
|
80
60
|
|
|
81
|
-
const selected = computed(() => {
|
|
61
|
+
const selected = computed<Option<T> | Option<T>[] | null>(() => {
|
|
82
62
|
if (Array.isArray(model.value)) {
|
|
83
|
-
return props.options.filter((o) => (model.value as
|
|
63
|
+
return props.options.filter((o) => (model.value as T[]).includes(o.value))
|
|
84
64
|
}
|
|
85
65
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return item ?? null
|
|
66
|
+
return props.options.find((o) => o.value === model.value) ?? null
|
|
89
67
|
})
|
|
90
68
|
|
|
91
69
|
const hasSelected = computed(() => {
|
|
@@ -94,7 +72,7 @@ const hasSelected = computed(() => {
|
|
|
94
72
|
|
|
95
73
|
const removable = computed(() => {
|
|
96
74
|
if (Array.isArray(model.value)) {
|
|
97
|
-
return props.nullable || (selected.value as Option[]).length > 1
|
|
75
|
+
return !!props.nullable || (selected.value as Option<T>[]).length > 1
|
|
98
76
|
}
|
|
99
77
|
|
|
100
78
|
return !!props.nullable
|
|
@@ -107,20 +85,18 @@ async function onOpen() {
|
|
|
107
85
|
}
|
|
108
86
|
}
|
|
109
87
|
|
|
110
|
-
function onSelect(value:
|
|
88
|
+
function onSelect(value: T) {
|
|
111
89
|
props.validation?.$touch()
|
|
112
90
|
|
|
113
91
|
if (Array.isArray(model.value)) {
|
|
114
|
-
const toggled = xor(model.value, [value])
|
|
92
|
+
const toggled = xor(model.value as T[], [value])
|
|
115
93
|
if (toggled.length !== 0 || props.nullable) {
|
|
116
94
|
model.value = toggled
|
|
117
95
|
}
|
|
118
|
-
} else {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
model.value = null
|
|
123
|
-
}
|
|
96
|
+
} else if (value !== model.value) {
|
|
97
|
+
model.value = value
|
|
98
|
+
} else if (props.nullable) {
|
|
99
|
+
model.value = null
|
|
124
100
|
}
|
|
125
101
|
|
|
126
102
|
props.closeOnClick && close()
|
|
@@ -132,6 +108,7 @@ function onSelect(value: OptionValue) {
|
|
|
132
108
|
class="SInputDropdown"
|
|
133
109
|
:class="classes"
|
|
134
110
|
:size
|
|
111
|
+
:name
|
|
135
112
|
:label
|
|
136
113
|
:note
|
|
137
114
|
:info
|
|
@@ -140,7 +117,9 @@ function onSelect(value: OptionValue) {
|
|
|
140
117
|
:check-text
|
|
141
118
|
:check-color
|
|
142
119
|
:validation
|
|
120
|
+
:warning
|
|
143
121
|
:hide-error
|
|
122
|
+
:hide-warning
|
|
144
123
|
>
|
|
145
124
|
<div ref="container" class="container">
|
|
146
125
|
<div
|
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import IconX from '~icons/ph/x'
|
|
3
|
+
import { type Size } from '../support/InputBase'
|
|
4
|
+
import { type Option } from '../support/InputDropdown'
|
|
3
5
|
import SAvatar from './SAvatar.vue'
|
|
4
|
-
import { type Size } from './SInputBase.vue'
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export type Item = ItemText | ItemAvatar
|
|
9
|
-
|
|
10
|
-
export interface ItemBase {
|
|
11
|
-
type?: 'text' | 'avatar'
|
|
12
|
-
value: any
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ItemText extends ItemBase {
|
|
16
|
-
type?: 'text'
|
|
17
|
-
label: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ItemAvatar extends ItemBase {
|
|
21
|
-
type: 'avatar'
|
|
22
|
-
label: string
|
|
23
|
-
image?: string | null
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const props = defineProps<{
|
|
27
|
-
item: Item | Item[]
|
|
7
|
+
export interface Props {
|
|
8
|
+
item: Option | Option[]
|
|
28
9
|
size: Size
|
|
29
10
|
removable: boolean
|
|
30
11
|
disabled: boolean
|
|
31
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = defineProps<Props>()
|
|
32
15
|
|
|
33
16
|
const emit = defineEmits<{
|
|
34
17
|
remove: [value: any]
|
|
@@ -47,7 +30,7 @@ function emitRemove(value: any) {
|
|
|
47
30
|
<template v-for="(el, i) in item" :key="i">
|
|
48
31
|
<div v-if="el.type === undefined || el.type === 'text'" class="many-text">
|
|
49
32
|
<div class="many-text-value">{{ el.label }}</div>
|
|
50
|
-
<button v-if="removable" class="many-text-close" @click.stop="emitRemove(el.value)">
|
|
33
|
+
<button v-if="removable" type="button" class="many-text-close" @click.stop="emitRemove(el.value)">
|
|
51
34
|
<IconX class="many-text-close-icon" />
|
|
52
35
|
</button>
|
|
53
36
|
</div>
|
|
@@ -56,7 +39,7 @@ function emitRemove(value: any) {
|
|
|
56
39
|
<div class="many-avatar-image"><SAvatar size="fill" :avatar="el.image" /></div>
|
|
57
40
|
<div class="many-avatar-name">{{ el.label }}</div>
|
|
58
41
|
</div>
|
|
59
|
-
<button v-if="removable" class="many-avatar-close" @click.stop="emitRemove(el.value)">
|
|
42
|
+
<button v-if="removable" type="button" class="many-avatar-close" @click.stop="emitRemove(el.value)">
|
|
60
43
|
<IconX class="many-avatar-close-icon" />
|
|
61
44
|
</button>
|
|
62
45
|
</div>
|
|
@@ -70,7 +53,7 @@ function emitRemove(value: any) {
|
|
|
70
53
|
<div class="one-avatar-image"><SAvatar size="fill" :avatar="item.image" /></div>
|
|
71
54
|
<div class="one-avatar-name">{{ item.label }}</div>
|
|
72
55
|
</div>
|
|
73
|
-
<button v-if="removable" class="one-close" @click.stop="emitRemove(item.value)">
|
|
56
|
+
<button v-if="removable" type="button" class="one-close" @click.stop="emitRemove(item.value)">
|
|
74
57
|
<IconX class="one-close-icon" />
|
|
75
58
|
</button>
|
|
76
59
|
</div>
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type { Color, Size }
|
|
7
|
-
|
|
8
|
-
const props = defineProps<{
|
|
9
|
-
size?: Size
|
|
10
|
-
label?: string
|
|
11
|
-
info?: string
|
|
12
|
-
note?: string
|
|
13
|
-
help?: string
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
4
|
+
|
|
5
|
+
export interface Props extends BaseProps {
|
|
14
6
|
text?: string
|
|
15
7
|
placeholder?: string
|
|
16
8
|
accept?: string
|
|
17
9
|
multiple?: boolean
|
|
18
10
|
tabindex?: -1 | 0 | number
|
|
19
|
-
checkIcon?: Component
|
|
20
|
-
checkText?: string
|
|
21
|
-
checkColor?: Color
|
|
22
11
|
value?: File | File[] | null
|
|
23
12
|
modelValue?: File | File[] | null
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = defineProps<Props>()
|
|
27
16
|
|
|
28
17
|
const emit = defineEmits<{
|
|
29
18
|
'update:model-value': [file: File | File[] | null]
|
|
@@ -69,6 +58,7 @@ function onChange(e: Event) {
|
|
|
69
58
|
class="SInputFile"
|
|
70
59
|
:class="classes"
|
|
71
60
|
:size
|
|
61
|
+
:name
|
|
72
62
|
:label
|
|
73
63
|
:note
|
|
74
64
|
:info
|
|
@@ -77,7 +67,9 @@ function onChange(e: Event) {
|
|
|
77
67
|
:check-text
|
|
78
68
|
:check-color
|
|
79
69
|
:validation
|
|
70
|
+
:warning
|
|
80
71
|
:hide-error
|
|
72
|
+
:hide-warning
|
|
81
73
|
>
|
|
82
74
|
<input
|
|
83
75
|
ref="input"
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends ModelType = 'file'">
|
|
2
2
|
import { type ValidationRuleWithParams } from '@vuelidate/core'
|
|
3
3
|
import { useDropZone } from '@vueuse/core'
|
|
4
|
-
import {
|
|
4
|
+
import { computed, ref } from 'vue'
|
|
5
5
|
import { useTrans } from '../composables/Lang'
|
|
6
|
-
import { type Validatable } from '../composables/Validation'
|
|
7
6
|
import { formatSize } from '../support/File'
|
|
8
|
-
import
|
|
7
|
+
import { type FileObject } from '../support/InputFileUpload'
|
|
8
|
+
import SButton from './SButton.vue'
|
|
9
9
|
import SCard from './SCard.vue'
|
|
10
10
|
import SCardBlock from './SCardBlock.vue'
|
|
11
|
-
import { type
|
|
12
|
-
import SInputBase, { type Color } from './SInputBase.vue'
|
|
11
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
13
12
|
import SInputFileUploadItem from './SInputFileUploadItem.vue'
|
|
14
13
|
import STrans from './STrans.vue'
|
|
15
14
|
|
|
16
15
|
export type Size = 'mini' | 'small' | 'medium'
|
|
17
|
-
export type { Color }
|
|
18
16
|
|
|
19
17
|
export type ModelType = 'file' | 'object'
|
|
20
18
|
|
|
@@ -26,44 +24,20 @@ export type ModelType = 'file' | 'object'
|
|
|
26
24
|
*/
|
|
27
25
|
export type ModelValue<T extends ModelType> = T extends 'file' ? File | string : FileObject
|
|
28
26
|
|
|
29
|
-
export interface
|
|
30
|
-
file: File
|
|
31
|
-
indicatorState?: IndicatorState | null
|
|
32
|
-
canRemove?: boolean
|
|
33
|
-
action?: Action
|
|
34
|
-
errorMessage?: string | null
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface Action {
|
|
38
|
-
mode?: ButtonMode
|
|
39
|
-
icon?: Component
|
|
40
|
-
leadIcon?: Component
|
|
41
|
-
trailIcon?: Component
|
|
42
|
-
label?: string
|
|
43
|
-
onClick(): void
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const props = withDefaults(defineProps<{
|
|
27
|
+
export interface Props<T extends ModelType = 'file'> extends BaseProps {
|
|
47
28
|
size?: Size
|
|
48
|
-
label?: string
|
|
49
|
-
info?: string
|
|
50
|
-
note?: string
|
|
51
|
-
help?: string
|
|
52
29
|
text?: string
|
|
53
30
|
placeholder?: string
|
|
54
31
|
emptyText?: string
|
|
55
32
|
accept?: string
|
|
56
|
-
checkIcon?: Component
|
|
57
|
-
checkText?: string
|
|
58
|
-
checkColor?: Color
|
|
59
33
|
droppable?: boolean
|
|
60
34
|
value?: ModelValue<T>[]
|
|
61
35
|
modelType?: T
|
|
62
36
|
modelValue?: ModelValue<T>[]
|
|
63
37
|
rules?: Record<string, ValidationRuleWithParams>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(defineProps<Props<T>>(), {
|
|
67
41
|
modelType: 'file' as any // `ModelType` doesn't work so stubbing it.
|
|
68
42
|
})
|
|
69
43
|
|
|
@@ -171,6 +145,8 @@ function toFileObjects(files: File[]) {
|
|
|
171
145
|
<SInputBase
|
|
172
146
|
class="SInputFileUpload"
|
|
173
147
|
:class="classes"
|
|
148
|
+
:size
|
|
149
|
+
:name
|
|
174
150
|
:label
|
|
175
151
|
:note
|
|
176
152
|
:info
|
|
@@ -179,7 +155,9 @@ function toFileObjects(files: File[]) {
|
|
|
179
155
|
:check-text
|
|
180
156
|
:check-color
|
|
181
157
|
:validation
|
|
158
|
+
:warning
|
|
182
159
|
:hide-error
|
|
160
|
+
:hide-warning
|
|
183
161
|
>
|
|
184
162
|
<template #default="{ hasError }">
|
|
185
163
|
<input
|
|
@@ -2,34 +2,20 @@
|
|
|
2
2
|
import IconFileText from '~icons/ph/file-text'
|
|
3
3
|
import IconTrash from '~icons/ph/trash'
|
|
4
4
|
import { type ValidationRuleWithParams } from '@vuelidate/core'
|
|
5
|
-
import {
|
|
5
|
+
import { computed, watch } from 'vue'
|
|
6
6
|
import { useValidation } from '../composables/Validation'
|
|
7
7
|
import { formatSize } from '../support/File'
|
|
8
|
-
import
|
|
8
|
+
import { type Action, type FileObject } from '../support/InputFileUpload'
|
|
9
|
+
import SButton from './SButton.vue'
|
|
9
10
|
import SCardBlock from './SCardBlock.vue'
|
|
10
11
|
import SIndicator, { type State as IndicatorState } from './SIndicator.vue'
|
|
11
12
|
|
|
12
|
-
export interface
|
|
13
|
-
file: File
|
|
14
|
-
indicatorState?: IndicatorState | null
|
|
15
|
-
canRemove?: boolean
|
|
16
|
-
action?: Action | null
|
|
17
|
-
errorMessage?: string | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface Action {
|
|
21
|
-
mode?: ButtonMode
|
|
22
|
-
icon?: Component
|
|
23
|
-
leadIcon?: Component
|
|
24
|
-
trailIcon?: Component
|
|
25
|
-
label?: string
|
|
26
|
-
onClick(): void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const props = defineProps<{
|
|
13
|
+
export interface Props {
|
|
30
14
|
file: File | FileObject | string
|
|
31
15
|
rules?: Record<string, ValidationRuleWithParams>
|
|
32
|
-
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const props = defineProps<Props>()
|
|
33
19
|
|
|
34
20
|
defineEmits<{
|
|
35
21
|
remove: []
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
+
import { type Hms } from '../support/Day'
|
|
3
4
|
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
4
5
|
|
|
5
|
-
export type { Color, Size } from './SInputBase.vue'
|
|
6
6
|
export interface Props extends BaseProps {
|
|
7
7
|
placeholder?: Placeholder
|
|
8
8
|
noHour?: boolean
|
|
@@ -13,11 +13,7 @@ export interface Props extends BaseProps {
|
|
|
13
13
|
modelValue?: Value
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
hour: string | null
|
|
18
|
-
minute: string | null
|
|
19
|
-
second: string | null
|
|
20
|
-
}
|
|
16
|
+
export type Value = Hms
|
|
21
17
|
|
|
22
18
|
export interface Placeholder {
|
|
23
19
|
hour?: string
|
|
@@ -136,6 +132,7 @@ function createRequiredTouched(): boolean[] {
|
|
|
136
132
|
class="SInputHMS"
|
|
137
133
|
:class="[size ?? 'small', { disabled }]"
|
|
138
134
|
:size
|
|
135
|
+
:name
|
|
139
136
|
:label
|
|
140
137
|
:note
|
|
141
138
|
:info
|
|
@@ -143,8 +140,10 @@ function createRequiredTouched(): boolean[] {
|
|
|
143
140
|
:check-icon
|
|
144
141
|
:check-text
|
|
145
142
|
:check-color
|
|
146
|
-
:hide-error
|
|
147
143
|
:validation
|
|
144
|
+
:warning
|
|
145
|
+
:hide-error
|
|
146
|
+
:hide-warning
|
|
148
147
|
>
|
|
149
148
|
<div class="container" :class="{ focus: isFocused }">
|
|
150
149
|
<input
|