@globalbrain/sefirot 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/SButton.vue +0 -1
- package/lib/components/SButtonGroup.vue +17 -17
- package/lib/components/SDropdownSectionFilter.vue +5 -5
- package/lib/components/SIcon.vue +2 -2
- package/lib/components/SInputBase.vue +4 -5
- package/lib/components/SInputCheckbox.vue +23 -23
- package/lib/components/SInputCheckboxes.vue +23 -23
- package/lib/components/SInputDate.vue +55 -132
- package/lib/components/SInputDropdown.vue +16 -5
- package/lib/components/SInputDropdownItem.vue +3 -0
- package/lib/components/SInputDropdownItemAvatar.vue +8 -3
- package/lib/components/SInputDropdownItemText.vue +9 -4
- package/lib/components/SInputFile.vue +1 -1
- package/lib/components/SInputNumber.vue +51 -50
- package/lib/components/SInputSelect.vue +48 -48
- package/lib/components/SInputSwitch.vue +68 -142
- package/lib/components/SInputSwitches.vue +51 -58
- package/lib/components/SInputText.vue +13 -2
- package/lib/components/SInputTextarea.vue +24 -24
- package/lib/components/SInputYMD.vue +1 -1
- package/lib/components/SLink.vue +14 -14
- package/lib/components/SMarkdown.vue +3 -3
- package/lib/components/SMount.vue +1 -1
- package/lib/components/SSheetFooterAction.vue +1 -1
- package/lib/components/SSpinner.vue +28 -12
- package/lib/components/SStep.vue +15 -15
- package/lib/components/SSteps.vue +16 -16
- package/lib/components/STable.vue +2 -2
- package/lib/components/STableCellAvatar.vue +1 -1
- package/lib/components/STableCellAvatars.vue +1 -1
- package/lib/components/STableCellDay.vue +1 -1
- package/lib/components/STableCellPill.vue +3 -2
- package/lib/components/STableColumn.vue +4 -4
- package/lib/components/STooltip.vue +17 -17
- package/lib/composables/Form.ts +7 -5
- package/lib/composables/Grid.ts +3 -3
- package/lib/composables/Markdown.ts +2 -2
- package/lib/composables/Tooltip.ts +2 -1
- package/lib/composables/Validation.ts +2 -2
- package/lib/support/Day.ts +1 -1
- package/lib/validation/rules/email.ts +1 -1
- package/lib/validation/rules/hms.ts +1 -1
- package/lib/validation/rules/maxLength.ts +1 -1
- package/lib/validation/rules/maxValue.ts +1 -1
- package/lib/validation/rules/minLength.ts +1 -1
- package/lib/validation/rules/minValue.ts +1 -1
- package/lib/validation/rules/required.ts +1 -1
- package/lib/validation/rules/requiredHms.ts +1 -1
- package/lib/validation/rules/requiredIf.ts +1 -1
- package/lib/validation/rules/requiredYmd.ts +1 -1
- package/lib/validation/rules/url.ts +1 -1
- package/lib/validation/rules/ymd.ts +1 -1
- package/lib/validation/validators/requiredYmd.ts +1 -1
- package/package.json +12 -15
|
@@ -1,56 +1,35 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<SInputText
|
|
3
|
-
class="SInputNumber"
|
|
4
|
-
:name="name"
|
|
5
|
-
:size="size"
|
|
6
|
-
type="number"
|
|
7
|
-
:label="label"
|
|
8
|
-
:note="note"
|
|
9
|
-
:help="help"
|
|
10
|
-
:align="align"
|
|
11
|
-
:placeholder="placeholder"
|
|
12
|
-
:disabled="disabled"
|
|
13
|
-
:error-message="errorMessage"
|
|
14
|
-
:display-value="displayValue"
|
|
15
|
-
:model-value="String(modelValue)"
|
|
16
|
-
:validation="validation"
|
|
17
|
-
@update:model-value="emitUpdate"
|
|
18
|
-
>
|
|
19
|
-
<template #before-help>
|
|
20
|
-
<p v-if="helpFormat" class="help-text">
|
|
21
|
-
{{ valueWithSeparator }}
|
|
22
|
-
</p>
|
|
23
|
-
</template>
|
|
24
|
-
</SInputText>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
1
|
<script setup lang="ts">
|
|
28
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
29
3
|
import { Validatable } from '../composables/Validation'
|
|
30
4
|
import { isNullish } from '../support/Utils'
|
|
31
|
-
import SInputText
|
|
5
|
+
import SInputText from './SInputText.vue'
|
|
32
6
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
7
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
8
|
+
export type Align = 'left' | 'center' | 'right'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
size?: Size
|
|
12
|
+
name?: string
|
|
13
|
+
label?: string
|
|
14
|
+
note?: string
|
|
15
|
+
help?: string
|
|
16
|
+
placeholder?: string
|
|
17
|
+
align?: Align
|
|
18
|
+
separator?: boolean
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
modelValue: number | null
|
|
21
|
+
displayValue?: string | null
|
|
22
|
+
hideError?: boolean
|
|
23
|
+
validation?: Validatable
|
|
24
|
+
}>()
|
|
48
25
|
|
|
49
|
-
const emit = defineEmits
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
(e: 'update:modelValue', value: number | null): void
|
|
28
|
+
}>()
|
|
50
29
|
|
|
51
30
|
const valueWithSeparator = computed(() => {
|
|
52
31
|
if (isNullish(props.modelValue)) {
|
|
53
|
-
return
|
|
32
|
+
return null
|
|
54
33
|
}
|
|
55
34
|
|
|
56
35
|
return props.modelValue >= 100000000000000000000
|
|
@@ -59,14 +38,36 @@ const valueWithSeparator = computed(() => {
|
|
|
59
38
|
})
|
|
60
39
|
|
|
61
40
|
const displayValue = computed(() => {
|
|
62
|
-
if (!props.
|
|
63
|
-
return
|
|
41
|
+
if (!isNullish(props.displayValue)) {
|
|
42
|
+
return props.displayValue
|
|
64
43
|
}
|
|
65
44
|
|
|
66
|
-
return valueWithSeparator.value
|
|
45
|
+
return !props.separator || valueWithSeparator.value === null
|
|
46
|
+
? null
|
|
47
|
+
: valueWithSeparator.value
|
|
67
48
|
})
|
|
68
49
|
|
|
69
|
-
function emitUpdate(value: string | null)
|
|
70
|
-
emit('update:modelValue', value ? Number(value)
|
|
50
|
+
function emitUpdate(value: string | null) {
|
|
51
|
+
emit('update:modelValue', isNullish(value) ? null : Number(value))
|
|
71
52
|
}
|
|
72
53
|
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<SInputText
|
|
57
|
+
class="SInputNumber"
|
|
58
|
+
:name="name"
|
|
59
|
+
:size="size"
|
|
60
|
+
type="number"
|
|
61
|
+
:label="label"
|
|
62
|
+
:note="note"
|
|
63
|
+
:help="help"
|
|
64
|
+
:align="align"
|
|
65
|
+
:placeholder="placeholder"
|
|
66
|
+
:disabled="disabled"
|
|
67
|
+
:hide-error="hideError"
|
|
68
|
+
:display-value="displayValue"
|
|
69
|
+
:model-value="String(modelValue)"
|
|
70
|
+
:validation="validation"
|
|
71
|
+
@update:model-value="emitUpdate"
|
|
72
|
+
/>
|
|
73
|
+
</template>
|
|
@@ -1,54 +1,7 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<SInputBase
|
|
3
|
-
class="SInputSelect"
|
|
4
|
-
:class="classes"
|
|
5
|
-
:label="label"
|
|
6
|
-
:note="note"
|
|
7
|
-
:help="help"
|
|
8
|
-
:error-message="errorMessage ?? true"
|
|
9
|
-
:validation="validation"
|
|
10
|
-
>
|
|
11
|
-
<div class="box" :class="{ focus: isFocused }">
|
|
12
|
-
<select
|
|
13
|
-
class="select"
|
|
14
|
-
:class="{ 'is-not-selected': isNotSelected }"
|
|
15
|
-
:disabled="disabled"
|
|
16
|
-
@focus="focus"
|
|
17
|
-
@blur="blur"
|
|
18
|
-
@change="emitChange"
|
|
19
|
-
>
|
|
20
|
-
<option
|
|
21
|
-
v-if="placeholder || nullable"
|
|
22
|
-
:value="JSON.stringify({ value: null })"
|
|
23
|
-
:selected="isNotSelected"
|
|
24
|
-
:disabled="!nullable"
|
|
25
|
-
>
|
|
26
|
-
{{ placeholder || 'Please select' }}
|
|
27
|
-
</option>
|
|
28
|
-
|
|
29
|
-
<option
|
|
30
|
-
v-for="(option, index) in options"
|
|
31
|
-
:key="index"
|
|
32
|
-
:style="{ display: option.disabled ? 'none' : undefined }"
|
|
33
|
-
:value="JSON.stringify(option)"
|
|
34
|
-
:selected="isSelectedOption(option)"
|
|
35
|
-
>
|
|
36
|
-
{{ option.label }}
|
|
37
|
-
</option>
|
|
38
|
-
</select>
|
|
39
|
-
|
|
40
|
-
<div class="icon" role="button">
|
|
41
|
-
<SIcon :icon="IconCaretUp" class="icon-svg up" />
|
|
42
|
-
<SIcon :icon="IconCaretDown" class="icon-svg down" />
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</SInputBase>
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
1
|
<script setup lang="ts">
|
|
49
2
|
import IconCaretDown from '@iconify-icons/ph/caret-down'
|
|
50
3
|
import IconCaretUp from '@iconify-icons/ph/caret-up'
|
|
51
|
-
import { PropType,
|
|
4
|
+
import { PropType, computed, ref } from 'vue'
|
|
52
5
|
import { Validatable } from '../composables/Validation'
|
|
53
6
|
import SIcon from './SIcon.vue'
|
|
54
7
|
import SInputBase from './SInputBase.vue'
|
|
@@ -109,6 +62,53 @@ function emitChange(e: any): void {
|
|
|
109
62
|
}
|
|
110
63
|
</script>
|
|
111
64
|
|
|
65
|
+
<template>
|
|
66
|
+
<SInputBase
|
|
67
|
+
class="SInputSelect"
|
|
68
|
+
:class="classes"
|
|
69
|
+
:label="label"
|
|
70
|
+
:note="note"
|
|
71
|
+
:help="help"
|
|
72
|
+
:error-message="errorMessage ?? true"
|
|
73
|
+
:validation="validation"
|
|
74
|
+
>
|
|
75
|
+
<div class="box" :class="{ focus: isFocused }">
|
|
76
|
+
<select
|
|
77
|
+
class="select"
|
|
78
|
+
:class="{ 'is-not-selected': isNotSelected }"
|
|
79
|
+
:disabled="disabled"
|
|
80
|
+
@focus="focus"
|
|
81
|
+
@blur="blur"
|
|
82
|
+
@change="emitChange"
|
|
83
|
+
>
|
|
84
|
+
<Option
|
|
85
|
+
v-if="placeholder || nullable"
|
|
86
|
+
:value="JSON.stringify({ value: null })"
|
|
87
|
+
:selected="isNotSelected"
|
|
88
|
+
:disabled="!nullable"
|
|
89
|
+
>
|
|
90
|
+
{{ placeholder || 'Please select' }}
|
|
91
|
+
</Option>
|
|
92
|
+
|
|
93
|
+
<Option
|
|
94
|
+
v-for="(option, index) in options"
|
|
95
|
+
:key="index"
|
|
96
|
+
:style="{ display: option.disabled ? 'none' : undefined }"
|
|
97
|
+
:value="JSON.stringify(option)"
|
|
98
|
+
:selected="isSelectedOption(option)"
|
|
99
|
+
>
|
|
100
|
+
{{ option.label }}
|
|
101
|
+
</Option>
|
|
102
|
+
</select>
|
|
103
|
+
|
|
104
|
+
<div class="icon" role="button">
|
|
105
|
+
<SIcon :icon="IconCaretUp" class="icon-svg up" />
|
|
106
|
+
<SIcon :icon="IconCaretDown" class="icon-svg down" />
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</SInputBase>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
112
|
<style scoped lang="postcss">
|
|
113
113
|
.SInputSelect.mini {
|
|
114
114
|
.box {
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { Validatable } from '../composables/Validation'
|
|
4
|
+
import SInputBase from './SInputBase.vue'
|
|
5
|
+
|
|
6
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
size?: Size
|
|
10
|
+
name?: string
|
|
11
|
+
label?: string
|
|
12
|
+
note?: string
|
|
13
|
+
text?: string
|
|
14
|
+
help?: string
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
modelValue: boolean
|
|
17
|
+
hideError?: boolean
|
|
18
|
+
validation?: Validatable
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
const emit = defineEmits<{
|
|
22
|
+
(e: 'update:modelValue', value: boolean): void
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
const classes = computed(() => [
|
|
26
|
+
[props.size ?? 'small'],
|
|
27
|
+
{ disabled: props.disabled }
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
function emitChange(): void {
|
|
31
|
+
!props.disabled && emit('update:modelValue', !props.modelValue)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
1
35
|
<template>
|
|
2
36
|
<SInputBase
|
|
3
37
|
class="SInputSwitch"
|
|
@@ -6,188 +40,80 @@
|
|
|
6
40
|
:label="label"
|
|
7
41
|
:note="note"
|
|
8
42
|
:help="help"
|
|
43
|
+
:hide-error="hideError"
|
|
9
44
|
>
|
|
10
|
-
<div class="
|
|
11
|
-
<div class="
|
|
12
|
-
<p v-if="text" class="
|
|
45
|
+
<div class="container">
|
|
46
|
+
<div class="input" :class="{ on: modelValue }" role="button" @click="emitChange">
|
|
47
|
+
<p v-if="text" class="text">{{ text }}</p>
|
|
13
48
|
|
|
14
|
-
<div class="
|
|
15
|
-
<div class="
|
|
49
|
+
<div class="box">
|
|
50
|
+
<div class="check" />
|
|
16
51
|
</div>
|
|
17
|
-
|
|
18
|
-
<p v-if="textAfter" class="SInputSwitch-text after" :class="[textMode]">{{ textAfter }}</p>
|
|
19
52
|
</div>
|
|
20
53
|
</div>
|
|
21
54
|
</SInputBase>
|
|
22
55
|
</template>
|
|
23
56
|
|
|
24
|
-
<script setup lang="ts">
|
|
25
|
-
import { computed, PropType } from 'vue'
|
|
26
|
-
import SInputBase from './SInputBase.vue'
|
|
27
|
-
|
|
28
|
-
type Size = 'mini' | 'small'
|
|
29
|
-
type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
30
|
-
type TextMode = 'neutral' | 'mute' | 'info' | 'success' | 'warning' | 'danger'
|
|
31
|
-
|
|
32
|
-
const props = defineProps({
|
|
33
|
-
size: { type: String as PropType<Size>, default: 'small' },
|
|
34
|
-
mode: { type: String as PropType<Mode>, default: 'neutral' },
|
|
35
|
-
name: { type: String, default: null },
|
|
36
|
-
label: { type: String, default: null },
|
|
37
|
-
note: { type: String, default: null },
|
|
38
|
-
text: { type: String, default: null },
|
|
39
|
-
textAfter: { type: String, default: null },
|
|
40
|
-
textMode: { type: String as PropType<TextMode>, default: 'neutral' },
|
|
41
|
-
disabled: { type: Boolean, default: false },
|
|
42
|
-
help: { type: String, default: null },
|
|
43
|
-
modelValue: { type: Boolean, required: true }
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const emit = defineEmits(['update:modelValue'])
|
|
47
|
-
|
|
48
|
-
const classes = computed(() => ({
|
|
49
|
-
mini: props.size === 'mini',
|
|
50
|
-
small: props.size === 'small',
|
|
51
|
-
neutral: props.mode === 'neutral',
|
|
52
|
-
info: props.mode === 'info',
|
|
53
|
-
success: props.mode === 'success',
|
|
54
|
-
warning: props.mode === 'warning',
|
|
55
|
-
danger: props.mode === 'danger',
|
|
56
|
-
disabled: props.disabled
|
|
57
|
-
}))
|
|
58
|
-
|
|
59
|
-
function emitChange(): void {
|
|
60
|
-
!props.disabled && emit('update:modelValue', !props.modelValue)
|
|
61
|
-
}
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
57
|
<style lang="postcss" scoped>
|
|
65
|
-
.
|
|
66
|
-
.SInputSwitch-box {
|
|
67
|
-
margin: 1px 0 0;
|
|
68
|
-
border-radius: 9px;
|
|
69
|
-
width: 36px;
|
|
70
|
-
height: 18px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.SInputSwitch-check {
|
|
74
|
-
top: 2px;
|
|
75
|
-
left: 2px;
|
|
76
|
-
width: 12px;
|
|
77
|
-
height: 12px;
|
|
78
|
-
transition: background-color .25s, transform .25s;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.SInputSwitch.small {
|
|
83
|
-
.SInputSwitch-box {
|
|
84
|
-
margin: -1px 0 -1px;
|
|
85
|
-
border-radius: 11px;
|
|
86
|
-
width: 40px;
|
|
87
|
-
height: 22px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.SInputSwitch-check {
|
|
91
|
-
top: 2px;
|
|
92
|
-
left: 2px;
|
|
93
|
-
width: 16px;
|
|
94
|
-
height: 16px;
|
|
95
|
-
transition: background-color .25s, transform .25s;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.SInputSwitch.neutral .SInputSwitch-input.on .SInputSwitch-box {
|
|
100
|
-
border-color: var(--c-black);
|
|
101
|
-
background-color: var(--c-black);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.SInputSwitch.info .SInputSwitch-input.on .SInputSwitch-box {
|
|
105
|
-
border-color: var(--c-info);
|
|
106
|
-
background-color: var(--c-info);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.SInputSwitch.success .SInputSwitch-input.on .SInputSwitch-box {
|
|
110
|
-
border-color: var(--c-success);
|
|
111
|
-
background-color: var(--c-success);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.SInputSwitch.warning .SInputSwitch-input.on .SInputSwitch-box {
|
|
115
|
-
border-color: var(--c-warning);
|
|
116
|
-
background-color: var(--c-warning);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.SInputSwitch.danger .SInputSwitch-input.on .SInputSwitch-box {
|
|
120
|
-
border-color: var(--c-danger);
|
|
121
|
-
background-color: var(--c-danger);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.SInputSwitch.disabled .SInputSwitch-input {
|
|
125
|
-
.SInputSwitch-box {
|
|
126
|
-
cursor: not-allowed;
|
|
127
|
-
opacity: .6;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
&:hover .SInputSwitch-box { border-color: var(--c-gray); }
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.SInputSwitch.disabled .SInputSwitch-input.on {
|
|
134
|
-
&:hover .SInputSwitch-box { border-color: transparent; }
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.SInputSwitch-container {
|
|
58
|
+
.container {
|
|
138
59
|
display: flex;
|
|
139
60
|
}
|
|
140
61
|
|
|
141
|
-
.
|
|
62
|
+
.input {
|
|
142
63
|
position: relative;
|
|
143
64
|
display: flex;
|
|
144
65
|
justify-content: space-between;
|
|
66
|
+
align-items: center;
|
|
145
67
|
width: 100%;
|
|
68
|
+
height: 32px;
|
|
146
69
|
|
|
147
70
|
&:hover {
|
|
148
|
-
.
|
|
149
|
-
.SInputSwitch-check { background-color: var(--c-black); }
|
|
71
|
+
.box { border-color: var(--c-info); }
|
|
150
72
|
}
|
|
151
73
|
}
|
|
152
74
|
|
|
153
|
-
.
|
|
75
|
+
.input.on .box {
|
|
76
|
+
border-color: var(--c-info-lighter);
|
|
77
|
+
background-color: var(--c-info);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.input.on .check {
|
|
154
81
|
background-color: var(--c-white);
|
|
155
82
|
transform: translateX(18px);
|
|
156
83
|
}
|
|
157
84
|
|
|
158
|
-
.
|
|
85
|
+
.text {
|
|
159
86
|
flex-grow: 1;
|
|
160
87
|
margin: 0;
|
|
161
88
|
padding-right: 16px;
|
|
162
89
|
line-height: 20px;
|
|
163
90
|
font-size: 14px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.SInputSwitch-text.mute {
|
|
167
|
-
color: var(--c-text-light-2);
|
|
168
91
|
font-weight: 500;
|
|
169
92
|
}
|
|
170
93
|
|
|
171
|
-
.
|
|
172
|
-
.SInputSwitch-text.success { color: var(--c-success); }
|
|
173
|
-
.SInputSwitch-text.warning { color: var(--c-warning); }
|
|
174
|
-
.SInputSwitch-text.danger { color: var(--c-danger); }
|
|
175
|
-
.SInputSwitch-text.after {
|
|
176
|
-
padding-left: 12px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.SInputSwitch-box {
|
|
94
|
+
.box {
|
|
180
95
|
position: relative;
|
|
181
96
|
flex-shrink: 0;
|
|
182
|
-
border: 1px solid var(--c-
|
|
183
|
-
|
|
184
|
-
|
|
97
|
+
border: 1px solid var(--c-divider);
|
|
98
|
+
border-radius: 11px;
|
|
99
|
+
width: 40px;
|
|
100
|
+
height: 22px;
|
|
101
|
+
background-color: var(--c-bg-elv-down);
|
|
102
|
+
transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
|
|
185
103
|
}
|
|
186
104
|
|
|
187
|
-
.
|
|
105
|
+
.check {
|
|
188
106
|
position: absolute;
|
|
189
107
|
border-radius: 50%;
|
|
190
108
|
background-color: var(--c-black);
|
|
109
|
+
top: 2px;
|
|
110
|
+
left: 2px;
|
|
111
|
+
width: 16px;
|
|
112
|
+
height: 16px;
|
|
191
113
|
transition: background-color .25s, transform .25s;
|
|
114
|
+
|
|
115
|
+
.dark & {
|
|
116
|
+
background-color: var(--c-white);
|
|
117
|
+
}
|
|
192
118
|
}
|
|
193
119
|
</style>
|
|
@@ -1,88 +1,81 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<SInputBase
|
|
3
|
-
class="SInputSwitches"
|
|
4
|
-
:class="classes"
|
|
5
|
-
:name="name"
|
|
6
|
-
:label="label"
|
|
7
|
-
:note="note"
|
|
8
|
-
:help="help"
|
|
9
|
-
>
|
|
10
|
-
<div class="SInputSwitches-container">
|
|
11
|
-
<div class="SInputSwitches-row">
|
|
12
|
-
<div v-for="option in options" :key="option.value" class="SInputSwitches-col">
|
|
13
|
-
<SInputSwitch
|
|
14
|
-
:size="size"
|
|
15
|
-
:mode="mode"
|
|
16
|
-
:text="option.label"
|
|
17
|
-
:model-value="isChecked(option.value)"
|
|
18
|
-
@update:model-value="handleChange(option.value)"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</SInputBase>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
1
|
<script setup lang="ts">
|
|
27
|
-
import { computed
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { Validatable } from '../composables/Validation'
|
|
28
4
|
import SInputBase from './SInputBase.vue'
|
|
29
5
|
import SInputSwitch from './SInputSwitch.vue'
|
|
30
6
|
|
|
31
|
-
type Size = 'mini' | 'small'
|
|
32
|
-
type Mode = 'neutral' | 'info' | 'success' | 'warning' | 'danger'
|
|
7
|
+
export type Size = 'mini' | 'small' | 'medium'
|
|
33
8
|
|
|
34
|
-
|
|
35
|
-
interface Option {
|
|
9
|
+
export interface Option {
|
|
36
10
|
label: string
|
|
37
|
-
value:
|
|
11
|
+
value: string | number | boolean
|
|
38
12
|
}
|
|
39
13
|
|
|
40
|
-
const props = defineProps
|
|
41
|
-
size
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
modelValue:
|
|
49
|
-
|
|
14
|
+
const props = defineProps<{
|
|
15
|
+
size?: Size
|
|
16
|
+
name?: string
|
|
17
|
+
label?: string
|
|
18
|
+
note?: string
|
|
19
|
+
help?: string
|
|
20
|
+
options: Option[]
|
|
21
|
+
disabled?: boolean
|
|
22
|
+
modelValue: (string | number | boolean)[]
|
|
23
|
+
hideError?: boolean
|
|
24
|
+
validation?: Validatable
|
|
25
|
+
}>()
|
|
50
26
|
|
|
51
|
-
const emit = defineEmits
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
(e: 'update:modelValue', value: (string | number | boolean)[]): void
|
|
29
|
+
}>()
|
|
52
30
|
|
|
53
31
|
const classes = computed(() => [
|
|
54
|
-
props.size
|
|
55
|
-
props.mode
|
|
32
|
+
props.size ?? 'small'
|
|
56
33
|
])
|
|
57
34
|
|
|
58
|
-
function isChecked(value:
|
|
35
|
+
function isChecked(value: string | number | boolean): boolean {
|
|
59
36
|
return props.modelValue.includes(value)
|
|
60
37
|
}
|
|
61
38
|
|
|
62
|
-
function handleChange(value:
|
|
39
|
+
function handleChange(value: string | number | boolean): void {
|
|
63
40
|
const difference = props.modelValue
|
|
64
41
|
.filter(v => v !== value)
|
|
65
42
|
.concat(props.modelValue.includes(value) ? [] : [value])
|
|
43
|
+
|
|
66
44
|
emit('update:modelValue', difference)
|
|
67
45
|
}
|
|
68
46
|
</script>
|
|
69
47
|
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
48
|
+
<template>
|
|
49
|
+
<SInputBase
|
|
50
|
+
class="SInputSwitches"
|
|
51
|
+
:class="classes"
|
|
52
|
+
:name="name"
|
|
53
|
+
:label="label"
|
|
54
|
+
:note="note"
|
|
55
|
+
:help="help"
|
|
56
|
+
:hide-error="hideError"
|
|
57
|
+
>
|
|
58
|
+
<div class="container">
|
|
59
|
+
<div class="row">
|
|
60
|
+
<div v-for="(option, index) in options" :key="index" class="col">
|
|
61
|
+
<SInputSwitch
|
|
62
|
+
:size="size"
|
|
63
|
+
:text="option.label"
|
|
64
|
+
:model-value="isChecked(option.value)"
|
|
65
|
+
@update:model-value="handleChange(option.value)"
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</SInputBase>
|
|
71
|
+
</template>
|
|
80
72
|
|
|
81
|
-
|
|
73
|
+
<style lang="postcss" scoped>
|
|
74
|
+
.container {
|
|
82
75
|
display: flex;
|
|
83
76
|
}
|
|
84
77
|
|
|
85
|
-
.
|
|
78
|
+
.row {
|
|
86
79
|
width: 100%;
|
|
87
80
|
}
|
|
88
81
|
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
import { Validatable } from '../composables/Validation'
|
|
4
4
|
import SIcon from './SIcon.vue'
|
|
5
5
|
import SInputBase from './SInputBase.vue'
|
|
@@ -141,6 +141,10 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
|
|
|
141
141
|
font-size: 14px;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
.display {
|
|
145
|
+
top: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
144
148
|
.icon {
|
|
145
149
|
width: 22px;
|
|
146
150
|
height: 30px;
|
|
@@ -172,6 +176,10 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
|
|
|
172
176
|
font-size: 16px;
|
|
173
177
|
}
|
|
174
178
|
|
|
179
|
+
.display {
|
|
180
|
+
top: 2px;
|
|
181
|
+
}
|
|
182
|
+
|
|
175
183
|
.icon {
|
|
176
184
|
width: 26px;
|
|
177
185
|
height: 38px;
|
|
@@ -203,6 +211,10 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
|
|
|
203
211
|
font-size: 16px;
|
|
204
212
|
}
|
|
205
213
|
|
|
214
|
+
.display {
|
|
215
|
+
top: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
206
218
|
.icon {
|
|
207
219
|
width: 28px;
|
|
208
220
|
height: 46px;
|
|
@@ -288,7 +300,6 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
|
|
|
288
300
|
|
|
289
301
|
.display {
|
|
290
302
|
position: absolute;
|
|
291
|
-
top: 0;
|
|
292
303
|
left: 0;
|
|
293
304
|
width: 100%;
|
|
294
305
|
}
|