@globalbrain/sefirot 4.57.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/{SInputSelectSearch.vue → SInputAsyncDropdown.vue} +91 -83
- 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 +7 -24
- 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
- package/lib/blocks/lens/components/LensInputSelect.vue +0 -92
|
@@ -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]
|
|
@@ -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
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import IconImage from '~icons/ph/image-bold'
|
|
3
|
-
import {
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
4
|
import { useImageSrcFromFile } from '../composables/Image'
|
|
5
|
-
import { type Validatable } from '../composables/Validation'
|
|
6
5
|
import SButton from './SButton.vue'
|
|
7
|
-
import SInputBase, { type
|
|
6
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
8
7
|
|
|
9
8
|
export type Size = 'mini' | 'small' | 'medium'
|
|
10
|
-
export type { Color }
|
|
11
9
|
export type ImageType = 'rectangle' | 'circle'
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
export interface Props extends BaseProps {
|
|
14
12
|
size?: Size
|
|
15
|
-
label?: string
|
|
16
|
-
info?: string
|
|
17
|
-
note?: string
|
|
18
|
-
help?: string
|
|
19
|
-
checkIcon?: Component
|
|
20
|
-
checkText?: string
|
|
21
|
-
checkColor?: Color
|
|
22
13
|
imageType?: ImageType
|
|
23
14
|
imageWidth?: string
|
|
24
15
|
imageAspectRatio?: string
|
|
@@ -29,9 +20,9 @@ const props = withDefaults(defineProps<{
|
|
|
29
20
|
disabled?: boolean
|
|
30
21
|
value?: File | string | null
|
|
31
22
|
modelValue?: File | string | null
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
35
26
|
size: 'small',
|
|
36
27
|
imageType: 'rectangle',
|
|
37
28
|
imageWidth: '96px',
|
|
@@ -91,14 +82,18 @@ function onFileDelete() {
|
|
|
91
82
|
<SInputBase
|
|
92
83
|
class="SInputImage"
|
|
93
84
|
:class="[size]"
|
|
85
|
+
:size
|
|
86
|
+
:name
|
|
94
87
|
:label
|
|
95
88
|
:note
|
|
96
89
|
:info
|
|
97
90
|
:check-icon
|
|
98
91
|
:check-text
|
|
99
92
|
:check-color
|
|
100
|
-
:hide-error
|
|
101
93
|
:validation
|
|
94
|
+
:warning
|
|
95
|
+
:hide-error
|
|
96
|
+
:hide-warning
|
|
102
97
|
>
|
|
103
98
|
<template #default>
|
|
104
99
|
<input
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { type Component, computed } from 'vue'
|
|
3
|
+
import { type Align, type TextColor } from '../support/InputText'
|
|
3
4
|
import { type Props as BaseProps } from './SInputBase.vue'
|
|
4
5
|
import SInputText from './SInputText.vue'
|
|
5
6
|
|
|
@@ -17,9 +18,6 @@ export interface Props extends BaseProps {
|
|
|
17
18
|
displayValue?: string | null
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
export type Align = 'left' | 'center' | 'right'
|
|
21
|
-
export type TextColor = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
22
|
-
|
|
23
21
|
const props = defineProps<Props>()
|
|
24
22
|
|
|
25
23
|
const emit = defineEmits<{
|
|
@@ -1,26 +1,14 @@
|
|
|
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
|
-
name?: string
|
|
11
|
-
label?: string
|
|
12
|
-
info?: string
|
|
13
|
-
note?: string
|
|
14
|
-
help?: string
|
|
15
|
-
checkIcon?: Component
|
|
16
|
-
checkText?: string
|
|
17
|
-
checkColor?: Color
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
4
|
+
|
|
5
|
+
export interface Props extends BaseProps {
|
|
18
6
|
text?: string
|
|
19
7
|
disabled?: boolean
|
|
20
8
|
modelValue: boolean
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const props = defineProps<Props>()
|
|
24
12
|
|
|
25
13
|
const emit = defineEmits<{
|
|
26
14
|
'update:model-value': [value: boolean]
|
|
@@ -54,7 +42,9 @@ function onClick() {
|
|
|
54
42
|
:check-text
|
|
55
43
|
:check-color
|
|
56
44
|
:validation
|
|
45
|
+
:warning
|
|
57
46
|
:hide-error
|
|
47
|
+
:hide-warning
|
|
58
48
|
>
|
|
59
49
|
<div class="container">
|
|
60
50
|
<div
|
|
@@ -1,51 +1,27 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ValueType extends string | number | boolean = string | number | boolean,
|
|
6
|
-
Nullable extends boolean = false
|
|
7
|
-
"
|
|
8
|
-
>
|
|
9
|
-
import { type Component, computed } from 'vue'
|
|
10
|
-
import { type Validatable } from '../composables/Validation'
|
|
11
|
-
import SInputBase, { type Color, type Size } from './SInputBase.vue'
|
|
1
|
+
<script setup lang="ts" generic="T extends string | number | boolean = string | number | boolean, Nullable extends boolean = false">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { type Option } from '../support/InputOption'
|
|
4
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
12
5
|
import SInputRadio from './SInputRadio.vue'
|
|
13
6
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
label: string
|
|
18
|
-
value: ValueType
|
|
7
|
+
export interface Props<T extends string | number | boolean = string | number | boolean, Nullable extends boolean = false> extends BaseProps {
|
|
8
|
+
options: Option<T>[]
|
|
9
|
+
nullable?: boolean & Nullable
|
|
19
10
|
disabled?: boolean
|
|
11
|
+
value?: T | null
|
|
12
|
+
modelValue?: T | null
|
|
20
13
|
}
|
|
21
14
|
|
|
22
15
|
type NullValue = Nullable extends true ? null : never
|
|
23
16
|
|
|
24
|
-
const props = withDefaults(defineProps<{
|
|
25
|
-
size?: Size
|
|
26
|
-
name?: string
|
|
27
|
-
label?: string
|
|
28
|
-
info?: string
|
|
29
|
-
note?: string
|
|
30
|
-
help?: string
|
|
31
|
-
checkIcon?: Component
|
|
32
|
-
checkText?: string
|
|
33
|
-
checkColor?: Color
|
|
34
|
-
options: Option<ValueType>[]
|
|
35
|
-
nullable?: Nullable
|
|
36
|
-
disabled?: boolean
|
|
37
|
-
value?: ValueType | null
|
|
38
|
-
modelValue?: ValueType | null
|
|
39
|
-
validation?: Validatable
|
|
40
|
-
hideError?: boolean
|
|
41
|
-
}>(), {
|
|
17
|
+
const props = withDefaults(defineProps<Props<T, Nullable>>(), {
|
|
42
18
|
value: undefined,
|
|
43
19
|
modelValue: undefined
|
|
44
20
|
})
|
|
45
21
|
|
|
46
22
|
const emit = defineEmits<{
|
|
47
|
-
'update:model-value': [value:
|
|
48
|
-
'change': [value:
|
|
23
|
+
'update:model-value': [value: T | NullValue]
|
|
24
|
+
'change': [value: T | NullValue]
|
|
49
25
|
}>()
|
|
50
26
|
|
|
51
27
|
const _value = computed(() => {
|
|
@@ -56,11 +32,11 @@ const _value = computed(() => {
|
|
|
56
32
|
: null
|
|
57
33
|
})
|
|
58
34
|
|
|
59
|
-
function isChecked(value:
|
|
35
|
+
function isChecked(value: T) {
|
|
60
36
|
return value === _value.value
|
|
61
37
|
}
|
|
62
38
|
|
|
63
|
-
function onUpdate(value:
|
|
39
|
+
function onUpdate(value: T) {
|
|
64
40
|
if (value !== _value.value) {
|
|
65
41
|
emit('update:model-value', value)
|
|
66
42
|
return
|
|
@@ -71,7 +47,7 @@ function onUpdate(value: ValueType) {
|
|
|
71
47
|
}
|
|
72
48
|
}
|
|
73
49
|
|
|
74
|
-
function onChange(value:
|
|
50
|
+
function onChange(value: T) {
|
|
75
51
|
if (value !== _value.value) {
|
|
76
52
|
emit('change', value)
|
|
77
53
|
return
|
|
@@ -96,8 +72,10 @@ function onChange(value: ValueType) {
|
|
|
96
72
|
:check-icon
|
|
97
73
|
:check-text
|
|
98
74
|
:check-color
|
|
99
|
-
:hide-error
|
|
100
75
|
:validation
|
|
76
|
+
:warning
|
|
77
|
+
:hide-error
|
|
78
|
+
:hide-warning
|
|
101
79
|
>
|
|
102
80
|
<div class="container">
|
|
103
81
|
<div class="row">
|
|
@@ -1,36 +1,23 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends string | number | boolean">
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
label: string
|
|
11
|
-
value: T
|
|
12
|
-
mode?: Mode
|
|
13
|
-
disabled?: boolean
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { type ColorMode } from '../support/Color'
|
|
4
|
+
import { type Option as BaseOption } from '../support/InputOption'
|
|
5
|
+
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
6
|
+
import SInputSegmentsOption from './SInputSegmentsOption.vue'
|
|
7
|
+
|
|
8
|
+
export interface Option<T extends string | number | boolean> extends BaseOption<T> {
|
|
9
|
+
mode?: ColorMode
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
size?: Size
|
|
18
|
-
name?: string
|
|
19
|
-
label?: string
|
|
20
|
-
info?: string
|
|
21
|
-
note?: string
|
|
22
|
-
help?: string
|
|
23
|
-
checkIcon?: Component
|
|
24
|
-
checkText?: string
|
|
25
|
-
checkColor?: Color
|
|
12
|
+
export interface Props<T extends string | number | boolean> extends BaseProps {
|
|
26
13
|
options: Option<T>[]
|
|
27
14
|
block?: boolean
|
|
28
15
|
disabled?: boolean
|
|
29
16
|
value?: T
|
|
30
17
|
modelValue?: T
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const props = defineProps<Props<T>>()
|
|
34
21
|
|
|
35
22
|
const emit = defineEmits<{
|
|
36
23
|
'update:model-value': [value: T]
|
|
@@ -66,8 +53,10 @@ function onSelect(value: T) {
|
|
|
66
53
|
:check-icon
|
|
67
54
|
:check-text
|
|
68
55
|
:check-color
|
|
69
|
-
:hide-error
|
|
70
56
|
:validation
|
|
57
|
+
:warning
|
|
58
|
+
:hide-error
|
|
59
|
+
:hide-warning
|
|
71
60
|
>
|
|
72
61
|
<div class="box">
|
|
73
62
|
<SInputSegmentsOption
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { type
|
|
2
|
+
import { type ColorMode } from '../support/Color'
|
|
3
|
+
import { type Size } from '../support/InputBase'
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
export type Mode = 'default' | 'mute' | 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
5
|
+
export interface Props {
|
|
8
6
|
size: Size
|
|
9
7
|
label: string
|
|
10
|
-
mode:
|
|
8
|
+
mode: ColorMode
|
|
11
9
|
active: boolean
|
|
12
10
|
disabled: boolean
|
|
13
|
-
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const props = defineProps<Props>()
|
|
14
14
|
|
|
15
15
|
const emit = defineEmits<{
|
|
16
16
|
click: []
|
|
@@ -1,36 +1,28 @@
|
|
|
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 { computed, ref } from 'vue'
|
|
5
|
+
import { type Option } from '../support/InputOption'
|
|
5
6
|
import SInputBase, { type Props as BaseProps } from './SInputBase.vue'
|
|
6
7
|
|
|
7
|
-
export
|
|
8
|
-
export interface Props extends BaseProps {
|
|
8
|
+
export interface Props<T = any> extends BaseProps {
|
|
9
9
|
placeholder?: string
|
|
10
|
-
options: Option[]
|
|
10
|
+
options: Option<T>[]
|
|
11
11
|
nullable?: boolean
|
|
12
12
|
disabled?: boolean
|
|
13
13
|
tabindex?: -1 | 0 | number
|
|
14
|
-
value?:
|
|
15
|
-
modelValue?:
|
|
14
|
+
value?: T | null
|
|
15
|
+
modelValue?: T | null
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export interface Option {
|
|
21
|
-
label: string
|
|
22
|
-
value: any
|
|
23
|
-
disabled?: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
const props = withDefaults(defineProps<Props<T>>(), {
|
|
27
19
|
value: undefined,
|
|
28
20
|
modelValue: undefined
|
|
29
21
|
})
|
|
30
22
|
|
|
31
23
|
const emit = defineEmits<{
|
|
32
|
-
'update:model-value': [value:
|
|
33
|
-
'change': [value:
|
|
24
|
+
'update:model-value': [value: T | null]
|
|
25
|
+
'change': [value: T | null]
|
|
34
26
|
}>()
|
|
35
27
|
|
|
36
28
|
const _value = computed(() => {
|
|
@@ -52,7 +44,7 @@ const isNotSelected = computed(() => {
|
|
|
52
44
|
return _value.value == null || _value.value === ''
|
|
53
45
|
})
|
|
54
46
|
|
|
55
|
-
function isSelectedOption(option: Option): boolean {
|
|
47
|
+
function isSelectedOption(option: Option<T>): boolean {
|
|
56
48
|
return option.value === _value.value
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -74,6 +66,7 @@ function emitChange(e: any): void {
|
|
|
74
66
|
class="SInputSelect"
|
|
75
67
|
:class="classes"
|
|
76
68
|
:size
|
|
69
|
+
:name
|
|
77
70
|
:label
|
|
78
71
|
:note
|
|
79
72
|
:info
|
|
@@ -81,8 +74,10 @@ function emitChange(e: any): void {
|
|
|
81
74
|
:check-icon
|
|
82
75
|
:check-text
|
|
83
76
|
:check-color
|
|
84
|
-
:hide-error
|
|
85
77
|
:validation
|
|
78
|
+
:warning
|
|
79
|
+
:hide-error
|
|
80
|
+
:hide-warning
|
|
86
81
|
>
|
|
87
82
|
<div class="box" :class="{ focus: isFocused }">
|
|
88
83
|
<select
|