@globalbrain/sefirot 0.72.0 → 2.0.0-draft.1
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/CHANGELOG.md +2 -820
- package/README.md +1 -1
- package/lib/assets/styles/bootstrap.css +1 -2
- package/lib/assets/styles/variables.css +14 -47
- package/lib/components/SAvatar.vue +9 -18
- package/lib/components/SButton.vue +35 -48
- package/lib/components/SDialog.vue +16 -34
- package/lib/components/SDropdown.vue +36 -55
- package/lib/components/SDropdownItem.vue +27 -39
- package/lib/components/SDropdownItemText.vue +4 -9
- package/lib/components/SDropdownItemUser.vue +4 -12
- package/lib/components/SInputBase.vue +33 -45
- package/lib/components/SInputCheckbox.vue +17 -37
- package/lib/components/SInputDropdown.vue +109 -171
- package/lib/components/SInputDropdownItem.vue +26 -32
- package/lib/components/SInputDropdownItemText.vue +6 -11
- package/lib/components/SInputDropdownItemTextTag.vue +10 -17
- package/lib/components/SInputDropdownItemUser.vue +5 -13
- package/lib/components/SInputDropdownItemUserTag.vue +9 -16
- package/lib/components/SInputFile.vue +38 -53
- package/lib/components/SInputHMS.vue +91 -114
- package/lib/components/SInputNumber.vue +27 -106
- package/lib/components/SInputRadio.vue +21 -34
- package/lib/components/SInputRadios.vue +36 -46
- package/lib/components/SInputText.vue +59 -633
- package/lib/components/SInputTextarea.vue +54 -113
- package/lib/components/SInputYMD.vue +94 -105
- package/lib/components/SLink.vue +16 -52
- package/lib/components/SModal.vue +53 -90
- package/lib/components/SPortalModals.vue +37 -53
- package/lib/components/SPortalSnackbars.vue +9 -24
- package/lib/components/SSheet.vue +10 -23
- package/lib/components/SSheetFooter.vue +0 -2
- package/lib/components/SSheetFooterAction.vue +9 -14
- package/lib/components/SSheetFooterActions.vue +1 -3
- package/lib/components/SSheetHeader.vue +9 -24
- package/lib/components/SSheetHeaderTitle.vue +0 -2
- package/lib/components/SSheetMedium.vue +12 -14
- package/lib/components/SSnackbar.vue +18 -28
- package/lib/composables/Dialog.ts +9 -17
- package/lib/composables/Dropdown.ts +1 -1
- package/lib/composables/{Menu.ts → Flyout.ts} +11 -4
- package/lib/composables/Form.ts +42 -44
- package/lib/composables/Modal.ts +9 -9
- package/lib/composables/Snackbar.ts +18 -0
- package/lib/composables/Validation.ts +28 -0
- package/lib/mixins/Sheet.ts +3 -3
- package/lib/store/Sefirot.ts +8 -13
- package/lib/store/dialog/index.ts +20 -10
- package/lib/store/modal/index.ts +11 -13
- package/lib/store/snackbars/index.ts +3 -4
- package/lib/support/{Util.ts → Utils.ts} +0 -2
- package/lib/types/Utils.ts +0 -7
- package/lib/types/vue-shims.d.ts +7 -0
- package/lib/validation/rules/checked.ts +6 -10
- package/lib/validation/rules/fileExtension.ts +9 -9
- package/lib/validation/rules/hms.ts +9 -9
- package/lib/validation/rules/index.ts +10 -74
- package/lib/validation/rules/maxLength.ts +10 -9
- package/lib/validation/rules/minLength.ts +12 -0
- package/lib/validation/rules/required.ts +2 -10
- package/lib/validation/rules/requiredHms.ts +11 -0
- package/lib/validation/rules/requiredIf.ts +3 -11
- package/lib/validation/rules/requiredYmd.ts +11 -0
- package/lib/validation/rules/ymd.ts +11 -0
- package/lib/validation/validators/checked.ts +1 -1
- package/lib/validation/validators/fileExtension.ts +1 -1
- package/lib/validation/validators/hms.ts +5 -5
- package/lib/validation/validators/requiredHms.ts +17 -0
- package/lib/validation/validators/requiredYmd.ts +7 -0
- package/lib/validation/validators/ymd.ts +41 -0
- package/package.json +45 -50
- package/lib/components/SAction.vue +0 -37
- package/lib/components/SActionAvatar.vue +0 -25
- package/lib/components/SActionButton.vue +0 -40
- package/lib/components/SActionPill.vue +0 -35
- package/lib/components/SActionSwitch.vue +0 -37
- package/lib/components/SAlert.vue +0 -145
- package/lib/components/SButtonGroup.vue +0 -160
- package/lib/components/SCard.vue +0 -111
- package/lib/components/SCardFooter.vue +0 -74
- package/lib/components/SCardHeader.vue +0 -213
- package/lib/components/SGrid.vue +0 -237
- package/lib/components/SGridActionLink.vue +0 -53
- package/lib/components/SGridActionMulti.vue +0 -139
- package/lib/components/SGridActionSingle.vue +0 -64
- package/lib/components/SHeader.vue +0 -180
- package/lib/components/SInputCheckboxes.vue +0 -87
- package/lib/components/SInputDate.vue +0 -192
- package/lib/components/SInputDay.vue +0 -87
- package/lib/components/SInputMonth.vue +0 -86
- package/lib/components/SInputSelect.vue +0 -298
- package/lib/components/SInputSwitch.vue +0 -212
- package/lib/components/SInputSwitches.vue +0 -108
- package/lib/components/SInputTime.vue +0 -255
- package/lib/components/SInputYear.vue +0 -60
- package/lib/components/SMarkdown.vue +0 -56
- package/lib/components/SPlaceholderBlank.vue +0 -113
- package/lib/components/SPlaceholderImage.vue +0 -83
- package/lib/components/SPortalScreens.vue +0 -62
- package/lib/components/SProgressBar.vue +0 -89
- package/lib/components/SResponsive.vue +0 -46
- package/lib/components/SScreen.vue +0 -81
- package/lib/components/SStep.vue +0 -107
- package/lib/components/SSteps.vue +0 -75
- package/lib/components/STag.vue +0 -67
- package/lib/components/STooltip.vue +0 -134
- package/lib/components/SWindow.vue +0 -158
- package/lib/components/icons/SIconCopy.vue +0 -6
- package/lib/composables/Action.ts +0 -141
- package/lib/composables/Alert.ts +0 -50
- package/lib/composables/Card.ts +0 -46
- package/lib/composables/FormValidation.ts +0 -150
- package/lib/composables/Header.ts +0 -72
- package/lib/composables/InputDropdown.ts +0 -6
- package/lib/composables/Markdown.ts +0 -138
- package/lib/composables/Router.ts +0 -20
- package/lib/composables/Step.ts +0 -7
- package/lib/composables/Store.ts +0 -9
- package/lib/composables/Tag.ts +0 -32
- package/lib/composables/Tooltip.ts +0 -91
- package/lib/composables/Utils.ts +0 -115
- package/lib/composables/markdown/LinkPlugin.ts +0 -45
- package/lib/compositions/useForm.ts +0 -17
- package/lib/compositions/useResizeObserver.ts +0 -25
- package/lib/compositions/useTime.ts +0 -26
- package/lib/store/alert/index.ts +0 -32
- package/lib/store/screen/index.ts +0 -46
- package/lib/types/v-calendar.d.ts +0 -5
- package/lib/validation/Validation.ts +0 -151
- package/lib/validation/rules/day.ts +0 -11
- package/lib/validation/rules/email.ts +0 -11
- package/lib/validation/rules/every.ts +0 -38
- package/lib/validation/rules/include.ts +0 -11
- package/lib/validation/rules/includeSome.ts +0 -11
- package/lib/validation/rules/integer.ts +0 -11
- package/lib/validation/rules/maxValue.ts +0 -11
- package/lib/validation/rules/minValue.ts +0 -11
- package/lib/validation/rules/month.ts +0 -11
- package/lib/validation/rules/not.ts +0 -10
- package/lib/validation/rules/regex.ts +0 -11
- package/lib/validation/rules/requiredHMS.ts +0 -11
- package/lib/validation/rules/requiredMonthDate.ts +0 -11
- package/lib/validation/rules/requiredYearMonth.ts +0 -11
- package/lib/validation/rules/requiredYearMonthDate.ts +0 -11
- package/lib/validation/rules/rule.ts +0 -5
- package/lib/validation/rules/sameAs.ts +0 -11
- package/lib/validation/rules/url.ts +0 -11
- package/lib/validation/rules/validateIf.ts +0 -27
- package/lib/validation/rules/year.ts +0 -11
- package/lib/validation/rules/yearMonth.ts +0 -11
- package/lib/validation/rules/yearMonthDate.ts +0 -11
- package/lib/validation/validators/day.ts +0 -29
- package/lib/validation/validators/email.ts +0 -5
- package/lib/validation/validators/include.ts +0 -5
- package/lib/validation/validators/includeSome.ts +0 -5
- package/lib/validation/validators/index.ts +0 -51
- package/lib/validation/validators/integer.ts +0 -6
- package/lib/validation/validators/maxLength.ts +0 -3
- package/lib/validation/validators/maxValue.ts +0 -3
- package/lib/validation/validators/minValue.ts +0 -3
- package/lib/validation/validators/month.ts +0 -3
- package/lib/validation/validators/monthDate.ts +0 -20
- package/lib/validation/validators/regex.ts +0 -3
- package/lib/validation/validators/required.ts +0 -27
- package/lib/validation/validators/requiredHMS.ts +0 -17
- package/lib/validation/validators/requiredMonthDate.ts +0 -8
- package/lib/validation/validators/requiredYearMonth.ts +0 -8
- package/lib/validation/validators/requiredYearMonthDate.ts +0 -9
- package/lib/validation/validators/sameAs.ts +0 -5
- package/lib/validation/validators/url.ts +0 -5
- package/lib/validation/validators/year.ts +0 -3
- package/lib/validation/validators/yearMonth.ts +0 -20
- package/lib/validation/validators/yearMonthDate.ts +0 -21
|
@@ -2,85 +2,62 @@
|
|
|
2
2
|
<SInputBase
|
|
3
3
|
class="SInputTextarea"
|
|
4
4
|
:class="classes"
|
|
5
|
-
:name="name"
|
|
6
5
|
:label="label"
|
|
7
6
|
:note="note"
|
|
8
7
|
:help="help"
|
|
8
|
+
:error-message="errorMessage"
|
|
9
9
|
:validation="validation"
|
|
10
10
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@blur="emitBlur"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
11
|
+
<textarea
|
|
12
|
+
class="input"
|
|
13
|
+
:placeholder="placeholder"
|
|
14
|
+
:rows="rows"
|
|
15
|
+
:disabled="disabled"
|
|
16
|
+
:value="modelValue ?? undefined"
|
|
17
|
+
@input="emitInput"
|
|
18
|
+
@blur="emitBlur"
|
|
19
|
+
/>
|
|
23
20
|
</SInputBase>
|
|
24
21
|
</template>
|
|
25
22
|
|
|
26
|
-
<script lang="ts">
|
|
27
|
-
import { PropType,
|
|
28
|
-
import {
|
|
29
|
-
import { Validation } from '../validation/Validation'
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { PropType, computed } from 'vue'
|
|
25
|
+
import { Validatable } from '../composables/Validation'
|
|
30
26
|
import SInputBase from './SInputBase.vue'
|
|
31
27
|
|
|
32
28
|
type Size = 'mini' | 'small' | 'medium'
|
|
33
|
-
type Mode = 'filled' | 'outlined' | 'clear'
|
|
34
|
-
|
|
35
|
-
export default defineComponent({
|
|
36
|
-
components: {
|
|
37
|
-
SInputBase
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
props: {
|
|
41
|
-
size: { type: String as PropType<Size>, default: 'medium' },
|
|
42
|
-
mode: { type: String as PropType<Mode>, default: 'filled' },
|
|
43
|
-
name: { type: String, default: null },
|
|
44
|
-
label: { type: String, default: null },
|
|
45
|
-
note: { type: String, default: null },
|
|
46
|
-
help: { type: String, default: null },
|
|
47
|
-
placeholder: { type: String, default: null },
|
|
48
|
-
disabled: { type: Boolean, default: false },
|
|
49
|
-
rows: { type: Number, default: 3 },
|
|
50
|
-
value: { type: [String, Number], default: null },
|
|
51
|
-
validation: { type: Object as PropType<Validation>, default: null }
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
setup(props, { emit }) {
|
|
55
|
-
const classes = computed(() => [
|
|
56
|
-
props.size,
|
|
57
|
-
props.mode,
|
|
58
|
-
{
|
|
59
|
-
disabled: props.disabled
|
|
60
|
-
}
|
|
61
|
-
])
|
|
62
|
-
|
|
63
|
-
function emitInput(e: SyntheticInputEvent): void {
|
|
64
|
-
emit('input', e.target.value)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function emitBlur(e: SyntheticInputEvent): void {
|
|
68
|
-
props.validation && props.validation.$touch()
|
|
69
|
-
emit('blur', e.target.value)
|
|
70
|
-
}
|
|
71
29
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
size: { type: String as PropType<Size>, default: 'small' },
|
|
32
|
+
label: { type: String, default: null },
|
|
33
|
+
note: { type: String, default: null },
|
|
34
|
+
help: { type: String, default: null },
|
|
35
|
+
placeholder: { type: String, default: null },
|
|
36
|
+
disabled: { type: Boolean, default: false },
|
|
37
|
+
rows: { type: Number, default: 3 },
|
|
38
|
+
errorMessage: { type: Boolean, default: true },
|
|
39
|
+
modelValue: { type: String as PropType<string | null>, default: null },
|
|
40
|
+
validation: { type: Object as PropType<Validatable>, default: null }
|
|
78
41
|
})
|
|
42
|
+
|
|
43
|
+
const emit = defineEmits(['update:modelValue'])
|
|
44
|
+
|
|
45
|
+
const classes = computed(() => [
|
|
46
|
+
props.size,
|
|
47
|
+
{ disabled: props.disabled }
|
|
48
|
+
])
|
|
49
|
+
|
|
50
|
+
function emitInput(e: Event): void {
|
|
51
|
+
emit('update:modelValue', (e.target as HTMLInputElement).value)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function emitBlur(e: FocusEvent): void {
|
|
55
|
+
props.validation?.$touch()
|
|
56
|
+
emit('update:modelValue', (e.target as HTMLInputElement).value)
|
|
57
|
+
}
|
|
79
58
|
</script>
|
|
80
59
|
|
|
81
60
|
<style lang="postcss" scoped>
|
|
82
|
-
@import "@/assets/styles/variables";
|
|
83
|
-
|
|
84
61
|
.SInputTextarea.mini {
|
|
85
62
|
.input {
|
|
86
63
|
padding: 6px 12px;
|
|
@@ -111,58 +88,11 @@ export default defineComponent({
|
|
|
111
88
|
}
|
|
112
89
|
}
|
|
113
90
|
|
|
114
|
-
.SInputTextarea.filled {
|
|
115
|
-
.input {
|
|
116
|
-
background-color: var(--input-filled-bg);
|
|
117
|
-
|
|
118
|
-
&:focus {
|
|
119
|
-
border-color: var(--input-focus-border);
|
|
120
|
-
background-color: var(--input-focus-bg);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
&.disabled .input {
|
|
125
|
-
background-color: var(--input-filled-bg-disabled);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.SInputTextarea.outlined {
|
|
130
|
-
.input {
|
|
131
|
-
border-color: var(--input-outlined-border);
|
|
132
|
-
background-color: transparent;
|
|
133
|
-
|
|
134
|
-
&:hover {
|
|
135
|
-
border-color: var(--input-focus-border);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&:focus {
|
|
139
|
-
border-color: var(--input-focus-border);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
&.disabled .input:hover {
|
|
144
|
-
border-color: var(--input-outlined-border);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
&.disabled .input {
|
|
148
|
-
background-color: var(--input-outlined-bg-disabled);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.SInputTextarea.clear {
|
|
153
|
-
.input {
|
|
154
|
-
padding: 0;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
&.disabled .input {
|
|
158
|
-
background-color: var(--input-clear-bg-disabled);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
91
|
.SInputTextarea.disabled {
|
|
92
|
+
.input,
|
|
163
93
|
.input:hover {
|
|
94
|
+
background-color: var(--input-disabled-bg);
|
|
164
95
|
cursor: not-allowed;
|
|
165
|
-
border-color: transparent;
|
|
166
96
|
}
|
|
167
97
|
}
|
|
168
98
|
|
|
@@ -180,14 +110,25 @@ export default defineComponent({
|
|
|
180
110
|
.input {
|
|
181
111
|
display: block;
|
|
182
112
|
flex-grow: 1;
|
|
183
|
-
border: 1px solid
|
|
113
|
+
border: 1px solid var(--input-border);
|
|
184
114
|
border-radius: 4px;
|
|
185
115
|
width: 100%;
|
|
186
116
|
font-weight: 400;
|
|
117
|
+
background-color: transparent;
|
|
187
118
|
transition: border-color .25s, background-color .25s;
|
|
188
119
|
|
|
189
120
|
&::placeholder {
|
|
121
|
+
font-weight: 500;
|
|
190
122
|
color: var(--input-placeholder);
|
|
191
123
|
}
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
border-color: var(--input-hover-border);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:focus {
|
|
130
|
+
border-color: var(--input-focus-border);
|
|
131
|
+
background-color: transparent;
|
|
132
|
+
}
|
|
192
133
|
}
|
|
193
134
|
</style>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<SInputBase
|
|
3
3
|
class="SInputYMD"
|
|
4
|
-
:class="[size,
|
|
5
|
-
:name="name"
|
|
4
|
+
:class="[size, { disabled }]"
|
|
6
5
|
:label="label"
|
|
7
6
|
:note="note"
|
|
8
7
|
:help="help"
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
v-if="year"
|
|
15
14
|
class="input year"
|
|
16
15
|
type="number"
|
|
17
|
-
:value="
|
|
16
|
+
:value="modelValue?.year"
|
|
18
17
|
placeholder="YYYY"
|
|
19
18
|
:disabled="disabled"
|
|
20
19
|
@blur="updateYear"
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
v-if="month"
|
|
28
27
|
class="input month"
|
|
29
28
|
type="number"
|
|
30
|
-
:value="
|
|
29
|
+
:value="modelValue?.month"
|
|
31
30
|
placeholder="M"
|
|
32
31
|
:disabled="disabled"
|
|
33
32
|
@blur="updateMonth"
|
|
@@ -40,143 +39,120 @@
|
|
|
40
39
|
v-if="date"
|
|
41
40
|
class="input date"
|
|
42
41
|
type="number"
|
|
43
|
-
:value="
|
|
42
|
+
:value="modelValue?.date"
|
|
44
43
|
placeholder="D"
|
|
45
44
|
:disabled="disabled"
|
|
46
45
|
@blur="updateDate"
|
|
47
46
|
>
|
|
48
47
|
</div>
|
|
49
|
-
|
|
50
|
-
<template #before-help>
|
|
51
|
-
<slot name="before-help" />
|
|
52
|
-
</template>
|
|
53
48
|
</SInputBase>
|
|
54
49
|
</template>
|
|
55
50
|
|
|
56
|
-
<script lang="ts">
|
|
57
|
-
import { PropType
|
|
58
|
-
import {
|
|
59
|
-
import { Validation } from '../validation/Validation'
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import { PropType } from 'vue'
|
|
53
|
+
import { Validatable } from '../composables/Validation'
|
|
60
54
|
import SInputBase from './SInputBase.vue'
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
export type Mode = 'outlined'
|
|
56
|
+
type Size = 'mini' | 'small' | 'medium'
|
|
64
57
|
|
|
65
|
-
|
|
58
|
+
interface Value {
|
|
66
59
|
year?: number
|
|
67
60
|
month?: number
|
|
68
61
|
date?: number
|
|
69
62
|
}
|
|
70
63
|
|
|
71
|
-
|
|
64
|
+
type ValueType = 'year' | 'month' | 'date'
|
|
72
65
|
|
|
73
|
-
|
|
66
|
+
interface Fields {
|
|
74
67
|
year?: boolean
|
|
75
68
|
month?: boolean
|
|
76
69
|
date?: boolean
|
|
77
70
|
}
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
year: { type: Boolean, default: true },
|
|
93
|
-
month: { type: Boolean, default: true },
|
|
94
|
-
date: { type: Boolean, default: true },
|
|
95
|
-
disabled: { type: Boolean, default: false },
|
|
96
|
-
errorMessage: { type: Boolean, default: true },
|
|
97
|
-
value: { type: Object as PropType<Value>, default: null },
|
|
98
|
-
validation: { type: Object as PropType<Validation>, default: null }
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
setup(props, { emit }) {
|
|
102
|
-
const touched = {
|
|
103
|
-
year: false,
|
|
104
|
-
month: false,
|
|
105
|
-
date: false
|
|
106
|
-
}
|
|
72
|
+
const props = defineProps({
|
|
73
|
+
size: { type: String as PropType<Size>, default: 'small' },
|
|
74
|
+
label: { type: String, default: null },
|
|
75
|
+
note: { type: String, default: null },
|
|
76
|
+
help: { type: String, default: null },
|
|
77
|
+
year: { type: Boolean, default: true },
|
|
78
|
+
month: { type: Boolean, default: true },
|
|
79
|
+
date: { type: Boolean, default: true },
|
|
80
|
+
disabled: { type: Boolean, default: false },
|
|
81
|
+
errorMessage: { type: Boolean, default: true },
|
|
82
|
+
modelValue: { type: Object as PropType<Value>, default: null },
|
|
83
|
+
validation: { type: Object as PropType<Validatable>, default: null }
|
|
84
|
+
})
|
|
107
85
|
|
|
108
|
-
|
|
109
|
-
const value = Number(e.target.value)
|
|
110
|
-
update('year', value === 0 ? undefined : value)
|
|
111
|
-
}
|
|
86
|
+
const emit = defineEmits(['update:modelValue'])
|
|
112
87
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
88
|
+
const touched = {
|
|
89
|
+
year: false,
|
|
90
|
+
month: false,
|
|
91
|
+
date: false
|
|
92
|
+
}
|
|
117
93
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
function updateYear(e: FocusEvent): void {
|
|
95
|
+
const value = Number((e.target as HTMLInputElement).value)
|
|
96
|
+
update('year', value === 0 ? undefined : value)
|
|
97
|
+
}
|
|
122
98
|
|
|
123
|
-
|
|
124
|
-
|
|
99
|
+
function updateMonth(e: FocusEvent): void {
|
|
100
|
+
const value = Number((e.target as HTMLInputElement).value)
|
|
101
|
+
update('month', value === 0 ? undefined : value)
|
|
102
|
+
}
|
|
125
103
|
|
|
126
|
-
|
|
104
|
+
function updateDate(e: FocusEvent): void {
|
|
105
|
+
const value = Number((e.target as HTMLInputElement).value)
|
|
106
|
+
update('date', value === 0 ? undefined : value)
|
|
107
|
+
}
|
|
127
108
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
: emit('input', data)
|
|
109
|
+
function update(type: ValueType, value?: number): void {
|
|
110
|
+
const data = { ...props.modelValue } as Value
|
|
131
111
|
|
|
132
|
-
|
|
133
|
-
}
|
|
112
|
+
setValue(data, type, value)
|
|
134
113
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
return
|
|
139
|
-
}
|
|
114
|
+
data.year === undefined && data.month === undefined && data.date === undefined
|
|
115
|
+
? emit('update:modelValue', null)
|
|
116
|
+
: emit('update:modelValue', data)
|
|
140
117
|
|
|
141
|
-
|
|
142
|
-
|
|
118
|
+
emitTouch(type)
|
|
119
|
+
}
|
|
143
120
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
121
|
+
function setValue(data: Value, type: ValueType, value?: number): void {
|
|
122
|
+
if (value === undefined) {
|
|
123
|
+
delete data[type]
|
|
124
|
+
return
|
|
125
|
+
}
|
|
148
126
|
|
|
149
|
-
|
|
127
|
+
data[type] = value
|
|
128
|
+
}
|
|
150
129
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
130
|
+
function emitTouch(type: ValueType): void {
|
|
131
|
+
if (!props.validation || props.validation.$dirty) {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
155
134
|
|
|
156
|
-
|
|
157
|
-
const requiredTouched = [] as boolean[]
|
|
135
|
+
touched[type] = true
|
|
158
136
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
137
|
+
if (createRequiredTouched().every(v => v)) {
|
|
138
|
+
props.validation.$touch()
|
|
139
|
+
}
|
|
140
|
+
}
|
|
164
141
|
|
|
165
|
-
|
|
166
|
-
|
|
142
|
+
function createRequiredTouched(): boolean[] {
|
|
143
|
+
const requiredTouched = [] as boolean[]
|
|
167
144
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
updateDate
|
|
145
|
+
for (const key in touched) {
|
|
146
|
+
if ((props as any)[key]) {
|
|
147
|
+
requiredTouched.push((touched as any)[key])
|
|
172
148
|
}
|
|
173
149
|
}
|
|
174
|
-
|
|
150
|
+
|
|
151
|
+
return requiredTouched
|
|
152
|
+
}
|
|
175
153
|
</script>
|
|
176
154
|
|
|
177
155
|
<style lang="postcss" scoped>
|
|
178
|
-
@import "@/assets/styles/variables";
|
|
179
|
-
|
|
180
156
|
.SInputYMD.mini {
|
|
181
157
|
.container {
|
|
182
158
|
padding: 0 4px;
|
|
@@ -211,8 +187,8 @@ export default defineComponent({
|
|
|
211
187
|
}
|
|
212
188
|
|
|
213
189
|
.input.year { width: 56px; }
|
|
214
|
-
.input.month { width:
|
|
215
|
-
.input.date { width:
|
|
190
|
+
.input.month { width: 40px; }
|
|
191
|
+
.input.date { width: 40px; }
|
|
216
192
|
|
|
217
193
|
.separator {
|
|
218
194
|
padding: 7px 0;
|
|
@@ -233,8 +209,8 @@ export default defineComponent({
|
|
|
233
209
|
}
|
|
234
210
|
|
|
235
211
|
.input.year { width: 56px; }
|
|
236
|
-
.input.month { width:
|
|
237
|
-
.input.date { width:
|
|
212
|
+
.input.month { width: 40px; }
|
|
213
|
+
.input.date { width: 40px; }
|
|
238
214
|
|
|
239
215
|
.separator {
|
|
240
216
|
padding: 11px 0;
|
|
@@ -263,8 +239,14 @@ export default defineComponent({
|
|
|
263
239
|
}
|
|
264
240
|
|
|
265
241
|
.SInputYMD.disabled {
|
|
266
|
-
.container
|
|
267
|
-
.input
|
|
242
|
+
.container,
|
|
243
|
+
.input {
|
|
244
|
+
cursor: not-allowed;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.container {
|
|
248
|
+
background-color: var(--input-disabled-bg);
|
|
249
|
+
}
|
|
268
250
|
}
|
|
269
251
|
|
|
270
252
|
.SInputYMD.has-error {
|
|
@@ -274,7 +256,14 @@ export default defineComponent({
|
|
|
274
256
|
}
|
|
275
257
|
|
|
276
258
|
.container {
|
|
277
|
-
display: flex;
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
border: 1px solid var(--input-border);
|
|
261
|
+
border-radius: 4px;
|
|
262
|
+
transition: border-color .25s;
|
|
263
|
+
|
|
264
|
+
&:hover {
|
|
265
|
+
border-color: var(--input-focus-border);
|
|
266
|
+
}
|
|
278
267
|
}
|
|
279
268
|
|
|
280
269
|
.input {
|
package/lib/components/SLink.vue
CHANGED
|
@@ -8,65 +8,29 @@
|
|
|
8
8
|
:target="target"
|
|
9
9
|
:rel="rel"
|
|
10
10
|
>
|
|
11
|
-
<slot
|
|
11
|
+
<slot />
|
|
12
12
|
</component>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<script lang="ts">
|
|
16
|
-
import {
|
|
17
|
-
import SIconExternalLink from './icons/SIconExternalLink.vue'
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { computed } from 'vue'
|
|
18
17
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
components: {
|
|
23
|
-
SIconExternalLink
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
props: {
|
|
27
|
-
href: { type: String, default: null },
|
|
28
|
-
icon: { type: Boolean, default: false }
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
setup(props) {
|
|
32
|
-
const isExternal = computed(() => OUTBOUND_REGEX.test(props.href))
|
|
33
|
-
|
|
34
|
-
const component = computed(() => {
|
|
35
|
-
if (!props.href) {
|
|
36
|
-
return 'span'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return isExternal.value ? 'a' : 'nuxt-link'
|
|
40
|
-
})
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
href: { type: String, default: null }
|
|
20
|
+
})
|
|
41
21
|
|
|
42
|
-
|
|
43
|
-
const rel = computed(() => isExternal.value ? 'noopener noreferrer' : null)
|
|
22
|
+
const OUTBOUND_REGEX = /^[a-z]+:/i
|
|
44
23
|
|
|
45
|
-
|
|
24
|
+
const isExternal = computed(() => OUTBOUND_REGEX.test(props.href))
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rel,
|
|
51
|
-
showExternal
|
|
52
|
-
}
|
|
26
|
+
const component = computed(() => {
|
|
27
|
+
if (!props.href) {
|
|
28
|
+
return 'span'
|
|
53
29
|
}
|
|
54
|
-
})
|
|
55
|
-
</script>
|
|
56
30
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.SLink {
|
|
61
|
-
display: inline-flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
}
|
|
31
|
+
return isExternal.value ? 'a' : 'router-link'
|
|
32
|
+
})
|
|
64
33
|
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
width: 1em;
|
|
69
|
-
height: 1em;
|
|
70
|
-
fill: currentColor;
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
34
|
+
const target = computed(() => isExternal.value ? '_blank' : null)
|
|
35
|
+
const rel = computed(() => isExternal.value ? 'noopener noreferrer' : null)
|
|
36
|
+
</script>
|