@yamato-daiwa/frontend-vue 0.2.0 → 0.3.0-alpha.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.
Potentially problematic release.
This version of @yamato-daiwa/frontend-vue might be problematic. Click here for more details.
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +5 -1
- package/README.md +5 -0
- package/Source/Functions/getElementByVueReference.ts +105 -8
- package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue +67 -0
- package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue.d.ts +48 -0
- package/Source/GUI_Components/AdmonitionBlock/{AdmonitionBlock.vue.ts → AdmonitionBlockLogic.vue.ts} +83 -59
- package/Source/GUI_Components/Badge/Badge.vue.ts +98 -63
- package/Source/GUI_Components/Badge/LoadingPlaceholder/Badge-LoadingPlaceholder.vue.ts +51 -32
- package/Source/GUI_Components/Controls/Buttons/Closing/ClosingButton.vue.pug +1 -0
- package/Source/GUI_Components/Controls/Buttons/Closing/ClosingButton.vue.ts +224 -0
- package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton-ForInheritance.vue.ts +253 -0
- package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue +24 -0
- package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue.d.ts +45 -0
- package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue.pug +0 -0
- package/Source/GUI_Components/Controls/Buttons/Plain/Button.vue.ts +217 -105
- package/Source/GUI_Components/Controls/Buttons/Plain/LoadingPlaceholder/Button-LoadingPlaceholder.vue.ts +38 -30
- package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.pug +33 -20
- package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.ts +303 -121
- package/Source/GUI_Components/Controls/Validatables/InputtableControl.vue.ts +233 -0
- package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.pug +38 -0
- package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.ts +538 -96
- package/Source/GUI_Components/Controls/Validatables/ValidatableControl.ts +63 -54
- package/Source/GUI_Components/Controls/Validatables/ValidatableControlsGroup.ts +176 -0
- package/Source/GUI_Components/OverflowSafeSingleLineLabel.vue +9 -2
- package/Source/GUI_Components/ThemesShowcase.vue +10 -5
- package/Source/GUI_Components/YDF_ComponentsCoordinator.ts +164 -5
- package/Source/GUI_Components/_Decorators/AccessibleFromTemplateAsNonReactive.ts +67 -0
- package/Source/GUI_Components/_Decorators/NonReactiveVueData.ts +26 -0
- package/Source/GUI_Components/_Decorators/{OptionalButNotNullableVueProperty.ts → preventNullForOptionalVueProperty.ts} +3 -4
- package/Source/GUI_Components/_Errors/InvalidVueProperty/InvalidVuePropertyError.ts +43 -0
- package/Source/GUI_Components/_Errors/InvalidVueProperty/InvalidVuePropertyErrorLocalization.english.ts +16 -0
- package/Source/GUI_Components/_VuePropertiesValidators/BooleanVuePropertyValidator.ts +25 -0
- package/Source/GUI_Components/_VuePropertiesValidators/DecorativeModifiersVuePropertyValidator.ts +22 -0
- package/Source/GUI_Components/_VuePropertiesValidators/DecorativeVariationVuePropertyValidator.ts +23 -0
- package/Source/GUI_Components/_VuePropertiesValidators/ElementOfEnumerationVuePropertyValidator.ts +29 -0
- package/Source/GUI_Components/_VuePropertiesValidators/GeometricModifiersVuePropertyValidator.ts +22 -0
- package/Source/GUI_Components/_VuePropertiesValidators/GeometricVariationVuePropertyValidator.ts +23 -0
- package/Source/GUI_Components/_VuePropertiesValidators/NaturalNumberOrZeroVuePropertyValidator.ts +25 -0
- package/Source/GUI_Components/_VuePropertiesValidators/NonEmptyStringVuePropertyValidator.ts +25 -0
- package/Source/GUI_Components/_VuePropertiesValidators/ThemeVuePropertyValidator.ts +23 -0
- package/Source/GUI_Components/_VuePropertiesValidators/VuePropertyValidator.ts +51 -0
- package/Source/index.ts +24 -8
- package/Workbenches/Source/Decorators/Decorators.workbench.pug +20 -0
- package/Workbenches/Source/Decorators/Decorators.workbench.ts +5 -0
- package/Workbenches/Source/Decorators/DecoratorsWorkbench.vue +69 -0
- package/Workbenches/Source/GUI_Components/AdmonitionBlock/AdmonitionBlockComponentTestSite.vue +9 -2
- package/Workbenches/Source/GUI_Components/Badge/BadgeBlockComponentTestSite.vue +9 -2
- package/Workbenches/Source/GUI_Components/Controls/Buttons/Plain/ButtonComponentTestSite.vue +19 -8
- package/Workbenches/Source/GUI_Components/Controls/Validatable/TextBox/TextBoxWorkbench.vue +45 -2
- package/Workbenches/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShellTestSite.vue +9 -2
- package/Workbenches/Source/GUI_Components/OverflowSafeSingleLineLabel/OverflowSafeSingleLineLabelComponentTestSite.vue +9 -2
- package/Workbenches/Source/Workbenches.pug +6 -0
- package/eslint.config.js +15 -0
- package/package.json +40 -48
- package/tsconfig.json +0 -3
- package/yda.config.yaml +1 -1
- package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue.pug +0 -43
- package/Source/GUI_Components/Controls/Validatables/InputtableControl.ts +0 -134
- package/Source/GUI_Components/_Utils/validateVuePropertyAndLogIfInvalid.ts +0 -34
package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import { Vue3SlideUpDown as VerticallySlidingAlwaysMountedContainer } from "vue3-slide-up-down";
|
|
2
|
-
|
|
3
1
|
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
4
2
|
import componentVueTemplate from "./ValidatableControlShell.vue.pug";
|
|
5
3
|
import {
|
|
6
4
|
type ValidatableControlShellLocalization,
|
|
7
|
-
validatableControlShellYDF_ComponentLocalization__english
|
|
5
|
+
validatableControlShellYDF_ComponentLocalization__english,
|
|
6
|
+
replaceMarkdownBold,
|
|
7
|
+
replaceMarkdownLink
|
|
8
8
|
} from "@yamato-daiwa/frontend";
|
|
9
9
|
|
|
10
|
+
/* ─── Related GUI Components ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
11
|
+
import Badge from "../../Badge/Badge.vue";
|
|
12
|
+
import { Vue3SlideUpDown as VerticallySlidingAlwaysMountedContainer } from "vue3-slide-up-down";
|
|
13
|
+
|
|
14
|
+
/* ─── Validations ────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
15
|
+
import VuePropertyValidator from "../../_VuePropertiesValidators/VuePropertyValidator";
|
|
16
|
+
import preventNullForOptionalVueProperty from "../../_Decorators/preventNullForOptionalVueProperty";
|
|
17
|
+
import NonEmptyStringVuePropertyValidator from "../../_VuePropertiesValidators/NonEmptyStringVuePropertyValidator";
|
|
18
|
+
import BooleanVuePropertyValidator from "../../_VuePropertiesValidators/BooleanVuePropertyValidator";
|
|
19
|
+
import ThemeVuePropertyValidator from "../../_VuePropertiesValidators/ThemeVuePropertyValidator";
|
|
20
|
+
import GeometricVariationVuePropertyValidator from "../../_VuePropertiesValidators/GeometricVariationVuePropertyValidator";
|
|
21
|
+
import DecorativeVariationVuePropertyValidator from "../../_VuePropertiesValidators/DecorativeVariationVuePropertyValidator";
|
|
22
|
+
|
|
10
23
|
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
11
24
|
import {
|
|
12
25
|
ComponentBase as VueComponentConfiguration,
|
|
@@ -17,13 +30,12 @@ import {
|
|
|
17
30
|
|
|
18
31
|
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
19
32
|
import YDF_ComponentsCoordinator from "../../YDF_ComponentsCoordinator";
|
|
20
|
-
import
|
|
21
|
-
import validateVuePropertyAndLogIfInvalid from "../../_Utils/validateVuePropertyAndLogIfInvalid";
|
|
33
|
+
import AccessibleFromTemplateAsNonReactive from "../../_Decorators/AccessibleFromTemplateAsNonReactive";
|
|
22
34
|
import {
|
|
23
|
-
isNonEmptyString,
|
|
24
|
-
isElementOfEnumeration,
|
|
25
35
|
secondsToMilliseconds,
|
|
26
|
-
|
|
36
|
+
isArrayOfCertainTypeElements,
|
|
37
|
+
isNonEmptyString,
|
|
38
|
+
isNotUndefined
|
|
27
39
|
} from "@yamato-daiwa/es-extensions";
|
|
28
40
|
|
|
29
41
|
|
|
@@ -31,6 +43,7 @@ import {
|
|
|
31
43
|
name: ValidatableControlShell.CSS_NAMESPACE,
|
|
32
44
|
template: componentVueTemplate,
|
|
33
45
|
components: {
|
|
46
|
+
Badge,
|
|
34
47
|
VerticallySlidingAlwaysMountedContainer
|
|
35
48
|
}
|
|
36
49
|
})
|
|
@@ -42,95 +55,210 @@ class ValidatableControlShell extends VueComponent {
|
|
|
42
55
|
/* ━━━ Component Common Properties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
43
56
|
/* ─── Textings ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
44
57
|
@VueProperty({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
required: false,
|
|
59
|
+
get validator(): VuePropertyValidator {
|
|
60
|
+
return NonEmptyStringVuePropertyValidator({
|
|
61
|
+
propertyName: "label",
|
|
62
|
+
isPropertyRequired: this.required === true,
|
|
63
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
64
|
+
});
|
|
65
|
+
}
|
|
49
66
|
})
|
|
50
|
-
@
|
|
67
|
+
@preventNullForOptionalVueProperty
|
|
51
68
|
protected readonly label?: string;
|
|
52
69
|
|
|
53
70
|
@VueProperty({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
required: false,
|
|
72
|
+
get validator(): VuePropertyValidator {
|
|
73
|
+
return NonEmptyStringVuePropertyValidator({
|
|
74
|
+
propertyName: "guidance",
|
|
75
|
+
isPropertyRequired: this.required === true,
|
|
76
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
77
|
+
});
|
|
78
|
+
}
|
|
58
79
|
})
|
|
59
|
-
@
|
|
80
|
+
@preventNullForOptionalVueProperty
|
|
60
81
|
protected readonly guidance?: string;
|
|
61
82
|
|
|
83
|
+
protected get formattedGuidance(): string | null {
|
|
84
|
+
return isNotUndefined(this.guidance) ?
|
|
85
|
+
replaceMarkdownLink(
|
|
86
|
+
replaceMarkdownBold(
|
|
87
|
+
this.guidance,
|
|
88
|
+
(boldedContent: string): string =>
|
|
89
|
+
`<span class="ValidatableControlShell--YDF-Guidance-AccentedFragment">${ boldedContent }</span>`
|
|
90
|
+
),
|
|
91
|
+
({ URI, anchorText }: Readonly<{ URI: string; anchorText: string; }>): string =>
|
|
92
|
+
"<a " +
|
|
93
|
+
"class=\"Link--YDF ValidatableControlShell--YDF-Guidance-Link\" " +
|
|
94
|
+
`href="${ URI }" ` +
|
|
95
|
+
"target=\"_blank\" " +
|
|
96
|
+
"rel=\"noopener noreferrer nofollow\"" +
|
|
97
|
+
">" +
|
|
98
|
+
anchorText +
|
|
99
|
+
"</a>"
|
|
100
|
+
) :
|
|
101
|
+
null;
|
|
102
|
+
}
|
|
103
|
+
|
|
62
104
|
|
|
63
105
|
/* ─── Inputting Requirement ────────────────────────────────────────────────────────────────────────────────────── */
|
|
64
|
-
@VueProperty({
|
|
65
|
-
|
|
106
|
+
@VueProperty({
|
|
107
|
+
default: false,
|
|
108
|
+
get validator(): VuePropertyValidator {
|
|
109
|
+
return BooleanVuePropertyValidator({
|
|
110
|
+
propertyName: "required",
|
|
111
|
+
isPropertyRequired: this.required === true,
|
|
112
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
@preventNullForOptionalVueProperty
|
|
66
117
|
protected readonly required!: boolean;
|
|
67
118
|
|
|
68
|
-
@VueProperty({
|
|
69
|
-
|
|
119
|
+
@VueProperty({
|
|
120
|
+
default: false,
|
|
121
|
+
get validator(): VuePropertyValidator {
|
|
122
|
+
return BooleanVuePropertyValidator({
|
|
123
|
+
propertyName: "mustDisplayAppropriateBadgeIfInputIsRequired",
|
|
124
|
+
isPropertyRequired: this.required === true,
|
|
125
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
@preventNullForOptionalVueProperty
|
|
70
130
|
protected readonly mustDisplayAppropriateBadgeIfInputIsRequired!: boolean;
|
|
71
131
|
|
|
72
|
-
@VueProperty({
|
|
73
|
-
|
|
132
|
+
@VueProperty({
|
|
133
|
+
default: false,
|
|
134
|
+
get validator(): VuePropertyValidator {
|
|
135
|
+
return BooleanVuePropertyValidator({
|
|
136
|
+
propertyName: "mustDisplayAppropriateBadgeIfInputIsOptional",
|
|
137
|
+
isPropertyRequired: this.required === true,
|
|
138
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
@preventNullForOptionalVueProperty
|
|
74
143
|
protected readonly mustDisplayAppropriateBadgeIfInputIsOptional!: boolean;
|
|
75
144
|
|
|
76
|
-
@VueProperty({
|
|
77
|
-
|
|
145
|
+
@VueProperty({
|
|
146
|
+
default: false,
|
|
147
|
+
get validator(): VuePropertyValidator {
|
|
148
|
+
return BooleanVuePropertyValidator({
|
|
149
|
+
propertyName: "mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge",
|
|
150
|
+
isPropertyRequired: this.required === true,
|
|
151
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
@preventNullForOptionalVueProperty
|
|
78
156
|
protected readonly mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge!: boolean;
|
|
79
157
|
|
|
80
|
-
|
|
158
|
+
|
|
159
|
+
/* ─── Displaying of Validation Messages ────────────────────────────────────────────────────────────────────────── */
|
|
81
160
|
@VueProperty({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
161
|
+
default: false,
|
|
162
|
+
get validator(): VuePropertyValidator {
|
|
163
|
+
return BooleanVuePropertyValidator({
|
|
164
|
+
propertyName: "invalidInputHighlightingIfAnyValidationErrorsMessages",
|
|
165
|
+
isPropertyRequired: this.required === true,
|
|
166
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
167
|
+
});
|
|
168
|
+
}
|
|
86
169
|
})
|
|
87
|
-
@
|
|
88
|
-
protected readonly
|
|
170
|
+
@preventNullForOptionalVueProperty
|
|
171
|
+
protected readonly invalidInputHighlightingIfAnyValidationErrorsMessages!: boolean;
|
|
89
172
|
|
|
90
173
|
@VueProperty({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
174
|
+
default: false,
|
|
175
|
+
get validator(): VuePropertyValidator {
|
|
176
|
+
return BooleanVuePropertyValidator({
|
|
177
|
+
propertyName: "validValueHighlightingIfNoValidationErrorsMessages",
|
|
178
|
+
isPropertyRequired: this.required === true,
|
|
179
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
180
|
+
});
|
|
181
|
+
}
|
|
95
182
|
})
|
|
96
|
-
@
|
|
97
|
-
protected readonly
|
|
183
|
+
@preventNullForOptionalVueProperty
|
|
184
|
+
protected readonly validValueHighlightingIfNoValidationErrorsMessages!: boolean;
|
|
98
185
|
|
|
99
186
|
|
|
100
|
-
/* ───
|
|
101
|
-
@VueProperty({
|
|
102
|
-
|
|
103
|
-
|
|
187
|
+
/* ─── HTML IDs ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
188
|
+
@VueProperty({
|
|
189
|
+
required: false,
|
|
190
|
+
get validator(): VuePropertyValidator {
|
|
191
|
+
return NonEmptyStringVuePropertyValidator({
|
|
192
|
+
propertyName: "coreElementHTML_ID",
|
|
193
|
+
isPropertyRequired: this.required === true,
|
|
194
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
@preventNullForOptionalVueProperty
|
|
199
|
+
protected readonly coreElementHTML_ID?: string;
|
|
104
200
|
|
|
105
|
-
@VueProperty({
|
|
106
|
-
|
|
107
|
-
|
|
201
|
+
@VueProperty({
|
|
202
|
+
required: false,
|
|
203
|
+
get validator(): VuePropertyValidator {
|
|
204
|
+
return NonEmptyStringVuePropertyValidator({
|
|
205
|
+
propertyName: "labelElementHTML_ID",
|
|
206
|
+
isPropertyRequired: this.required === true,
|
|
207
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
@preventNullForOptionalVueProperty
|
|
212
|
+
protected readonly labelElementHTML_ID?: string;
|
|
108
213
|
|
|
109
214
|
|
|
110
215
|
/* ─── CSS Classes ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
111
|
-
@VueProperty({
|
|
112
|
-
|
|
216
|
+
@VueProperty({
|
|
217
|
+
default: (): ReadonlyArray<string> => [],
|
|
218
|
+
validator: VuePropertyValidator.create({
|
|
219
|
+
checker: (rawValue: unknown): boolean => isArrayOfCertainTypeElements(rawValue, isNonEmptyString),
|
|
220
|
+
messageSpecificPart: "If specified, must be an array of non-empty strings.",
|
|
221
|
+
propertyName: "mainSlotWrapperAdditionalCSS_Classes",
|
|
222
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
223
|
+
})
|
|
224
|
+
})
|
|
225
|
+
@preventNullForOptionalVueProperty
|
|
113
226
|
protected readonly mainSlotWrapperAdditionalCSS_Classes!: ReadonlyArray<string>;
|
|
114
227
|
|
|
115
228
|
|
|
116
229
|
/* ━━━ Validation Errors Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
117
|
-
@VueProperty({
|
|
118
|
-
|
|
230
|
+
@VueProperty({
|
|
231
|
+
default: (): ReadonlyArray<string> => [],
|
|
232
|
+
validator: VuePropertyValidator.create({
|
|
233
|
+
checker: (rawValue: unknown): boolean => isArrayOfCertainTypeElements(rawValue, isNonEmptyString),
|
|
234
|
+
messageSpecificPart: "If specified, must be an array of non-empty strings.",
|
|
235
|
+
propertyName: "validationErrorsMessages",
|
|
236
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
@preventNullForOptionalVueProperty
|
|
119
240
|
protected readonly validationErrorsMessages!: ReadonlyArray<string>;
|
|
120
241
|
|
|
121
242
|
/* [ Theory ]
|
|
122
243
|
* Even if `validationErrorsMessages` has become to empty array, the validation errors messages are still
|
|
123
|
-
*
|
|
244
|
+
* required to animate the collapsing. */
|
|
124
245
|
protected validationErrorsMessagesCopyForAnimating: ReadonlyArray<string> = [ ...this.validationErrorsMessages ];
|
|
125
246
|
|
|
126
247
|
protected static readonly ERRORS_LIST_EXPANDING_ANIMATION_DURATION_PER_ONE_ERROR_MESSAGE__SECONDS: number = 0.2;
|
|
127
|
-
protected static readonly ERRORS_LIST_COLLAPSING_ANIMATION_DURATION__SECONDS: number = 0.2;
|
|
128
248
|
|
|
249
|
+
protected get errorsListExpandingAnimationDuration__milliseconds(): number {
|
|
250
|
+
return secondsToMilliseconds(
|
|
251
|
+
ValidatableControlShell.ERRORS_LIST_EXPANDING_ANIMATION_DURATION_PER_ONE_ERROR_MESSAGE__SECONDS *
|
|
252
|
+
this.validationErrorsMessagesCopyForAnimating.length
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@onVueComponentFieldUpdated("invalidInputHighlightingIfAnyValidationErrorsMessages")
|
|
129
257
|
@onVueComponentFieldUpdated("validationErrorsMessages")
|
|
130
|
-
protected onValidationErrorsMessagesUpdated(
|
|
258
|
+
protected onValidationErrorsMessagesUpdated(): void {
|
|
131
259
|
|
|
132
|
-
if (
|
|
133
|
-
this.validationErrorsMessagesCopyForAnimating = [ ...
|
|
260
|
+
if (this.validationErrorsMessages.length > 0) {
|
|
261
|
+
this.validationErrorsMessagesCopyForAnimating = [ ...this.validationErrorsMessages ];
|
|
134
262
|
return;
|
|
135
263
|
}
|
|
136
264
|
|
|
@@ -139,30 +267,55 @@ class ValidatableControlShell extends VueComponent {
|
|
|
139
267
|
(): void => {
|
|
140
268
|
this.validationErrorsMessagesCopyForAnimating = [];
|
|
141
269
|
},
|
|
142
|
-
|
|
270
|
+
this.errorsListExpandingAnimationDuration__milliseconds
|
|
143
271
|
);
|
|
144
272
|
|
|
145
273
|
}
|
|
146
274
|
|
|
147
275
|
|
|
276
|
+
/* ━━━ Conditional Rendering ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
277
|
+
protected get mustDisplayRequiredInputBadge(): boolean {
|
|
278
|
+
return this.required && this.mustDisplayAppropriateBadgeIfInputIsRequired;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
protected get mustDisplayOptionalInputBadge(): boolean {
|
|
282
|
+
return !this.required && this.mustDisplayAppropriateBadgeIfInputIsOptional;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
protected get mustDisplayHeader(): boolean {
|
|
286
|
+
return isNotUndefined(this.label) ||
|
|
287
|
+
this.mustDisplayRequiredInputBadge ||
|
|
288
|
+
this.mustDisplayOptionalInputBadge ||
|
|
289
|
+
this.mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
|
|
148
293
|
/* ━━━ Theming ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
149
294
|
public static readonly Themes: ValidatableControlShell.Themes = { regular: "REGULAR" };
|
|
150
295
|
|
|
296
|
+
public static readonly selfAndChildrenComponentsThemesCorrespondence:
|
|
297
|
+
{ badge: { [ownThemeValue: string]: string; }; } =
|
|
298
|
+
{ badge: { [ValidatableControlShell.Themes.regular]: Badge.Themes.regular } };
|
|
299
|
+
|
|
151
300
|
@VueProperty({
|
|
152
|
-
type: String,
|
|
153
301
|
default: ValidatableControlShell.Themes.regular,
|
|
154
|
-
validator:
|
|
155
|
-
checker: (rawValue: string): boolean => isElementOfEnumeration(rawValue, ValidatableControlShell.Themes),
|
|
156
|
-
message:
|
|
157
|
-
"Must be the one among values of `ValidatableControlShell.Themes` associative array including the ones " +
|
|
158
|
-
"defined via `ValidatableControlShell.defineThemes()`."
|
|
159
|
-
})
|
|
302
|
+
validator: ThemeVuePropertyValidator(ValidatableControlShell)
|
|
160
303
|
})
|
|
161
|
-
@
|
|
304
|
+
@preventNullForOptionalVueProperty
|
|
162
305
|
protected readonly theme!: string;
|
|
163
306
|
|
|
164
|
-
|
|
165
|
-
return
|
|
307
|
+
protected get badgeTheme(): string {
|
|
308
|
+
return ValidatableControlShell.selfAndChildrenComponentsThemesCorrespondence.badge[this.theme];
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
public static defineThemes(
|
|
312
|
+
ownAndChildrenThemesCorrespondenceDefinition: Readonly<{
|
|
313
|
+
[ownThemeKey: string]: Readonly<{ badge: string; }>;
|
|
314
|
+
}>
|
|
315
|
+
): typeof ValidatableControlShell {
|
|
316
|
+
return YDF_ComponentsCoordinator.defineThemesAndSetCorrespondenceWithOnesOfChildrenComponents(
|
|
317
|
+
ownAndChildrenThemesCorrespondenceDefinition, ValidatableControlShell
|
|
318
|
+
);
|
|
166
319
|
}
|
|
167
320
|
|
|
168
321
|
public static areThemesCSS_ClassesCommon: boolean = YDF_ComponentsCoordinator.areThemesCSS_ClassesCommon;
|
|
@@ -171,9 +324,18 @@ class ValidatableControlShell extends VueComponent {
|
|
|
171
324
|
ValidatableControlShell.areThemesCSS_ClassesCommon = true;
|
|
172
325
|
}
|
|
173
326
|
|
|
174
|
-
@VueProperty({
|
|
175
|
-
|
|
176
|
-
|
|
327
|
+
@VueProperty({
|
|
328
|
+
default: ValidatableControlShell.areThemesCSS_ClassesCommon,
|
|
329
|
+
get validator(): VuePropertyValidator {
|
|
330
|
+
return BooleanVuePropertyValidator({
|
|
331
|
+
propertyName: "areThemesCSS_ClassesCommon",
|
|
332
|
+
componentName: ValidatableControlShell.CSS_NAMESPACE,
|
|
333
|
+
isPropertyRequired: this.required === true
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
})
|
|
337
|
+
@preventNullForOptionalVueProperty
|
|
338
|
+
protected readonly areThemesCSS_ClassesCommon!: boolean;
|
|
177
339
|
|
|
178
340
|
|
|
179
341
|
/* ─── Geometry ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -182,43 +344,88 @@ class ValidatableControlShell extends VueComponent {
|
|
|
182
344
|
small: "SMALL"
|
|
183
345
|
};
|
|
184
346
|
|
|
347
|
+
public static readonly selfAndChildrenComponentsGeometricVariationsCorrespondence:
|
|
348
|
+
{ badge: { [ownGeometricVariationValue: string]: string; }; } =
|
|
349
|
+
{
|
|
350
|
+
badge: {
|
|
351
|
+
|
|
352
|
+
[ValidatableControlShell.GeometricVariations.regular]: Badge.GeometricVariations.regular,
|
|
353
|
+
|
|
354
|
+
/* [ Approach ]
|
|
355
|
+
* `Badge__YDF.GeometricVariations.regular` is NOT a mistake because `Badge__YDF.GeometricVariations.small`
|
|
356
|
+
* is too small, while the actual size can be flexibly adjusted by relative CSS units.
|
|
357
|
+
* */
|
|
358
|
+
[ValidatableControlShell.GeometricVariations.small]: Badge.GeometricVariations.regular
|
|
359
|
+
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
185
363
|
@VueProperty({
|
|
186
|
-
type: String,
|
|
187
364
|
default: ValidatableControlShell.GeometricVariations.regular,
|
|
188
|
-
validator:
|
|
189
|
-
checker: (rawValue: string): boolean => isElementOfEnumeration(rawValue, ValidatableControlShell.GeometricVariations),
|
|
190
|
-
message:
|
|
191
|
-
"Must be the one among values of `ValidatableControlShell.GeometricVariations` associative array including the ones " +
|
|
192
|
-
"defined via `ValidatableControlShell.defineGeometricVariations()`."
|
|
193
|
-
})
|
|
365
|
+
validator: GeometricVariationVuePropertyValidator(ValidatableControlShell)
|
|
194
366
|
})
|
|
195
|
-
@
|
|
367
|
+
@preventNullForOptionalVueProperty
|
|
196
368
|
protected readonly geometricVariation!: string;
|
|
197
369
|
|
|
198
|
-
|
|
199
|
-
return
|
|
370
|
+
protected get badgeGeometricVariation(): string {
|
|
371
|
+
return ValidatableControlShell.selfAndChildrenComponentsGeometricVariationsCorrespondence.badge[this.geometricVariation];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
public static defineGeometricVariations(
|
|
375
|
+
ownAndChildrenGeometricVariationsAndCorrespondenceDefinition: Readonly<{
|
|
376
|
+
[ownGeometricVariationKey: string]: Readonly<{ badge: string; }>;
|
|
377
|
+
}>
|
|
378
|
+
): typeof ValidatableControlShell {
|
|
379
|
+
return YDF_ComponentsCoordinator.defineGeometricVariationsAndSetCorrespondenceWithOnesOfChildrenComponents(
|
|
380
|
+
ownAndChildrenGeometricVariationsAndCorrespondenceDefinition, ValidatableControlShell
|
|
381
|
+
);
|
|
200
382
|
}
|
|
201
383
|
|
|
202
384
|
|
|
203
385
|
/* ─── Decoration ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
204
|
-
public static readonly DecorativeVariations: ValidatableControlShell.DecorativeVariations = {
|
|
205
|
-
|
|
206
|
-
|
|
386
|
+
public static readonly DecorativeVariations: ValidatableControlShell.DecorativeVariations = { regular: "REGULAR" };
|
|
387
|
+
|
|
388
|
+
public static readonly selfAndChildrenComponentsDecorativeVariationsCorrespondence:
|
|
389
|
+
{
|
|
390
|
+
requiredInputBadge: { [ownDecorativeVariationValue: string]: string; };
|
|
391
|
+
optionalInputBadge: { [ownDecorativeVariationValue: string]: string; };
|
|
392
|
+
} =
|
|
393
|
+
{
|
|
394
|
+
requiredInputBadge: {
|
|
395
|
+
[ValidatableControlShell.DecorativeVariations.regular]: Badge.DecorativeVariations.veryCatchyBright
|
|
396
|
+
},
|
|
397
|
+
optionalInputBadge: {
|
|
398
|
+
[ValidatableControlShell.DecorativeVariations.regular]: Badge.DecorativeVariations.modestlyCalmingBright
|
|
399
|
+
}
|
|
400
|
+
};
|
|
207
401
|
|
|
208
402
|
@VueProperty({
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
validator: validateVuePropertyAndLogIfInvalid({
|
|
212
|
-
checker: (rawValue: string): boolean => isElementOfEnumeration(rawValue, ValidatableControlShell.DecorativeVariations),
|
|
213
|
-
message:
|
|
214
|
-
"Must be the one among values of `ValidatableControlShell.DecorativeVariations` associative array including the ones " +
|
|
215
|
-
"defined via `ValidatableControlShell.defineDecorativeVariations()`."
|
|
216
|
-
})
|
|
403
|
+
default: ValidatableControlShell.GeometricVariations.regular,
|
|
404
|
+
validator: DecorativeVariationVuePropertyValidator(ValidatableControlShell)
|
|
217
405
|
})
|
|
218
406
|
protected readonly decorativeVariation!: string;
|
|
219
407
|
|
|
220
|
-
|
|
221
|
-
return
|
|
408
|
+
protected get requiredInputBadgeDecorativeVariation(): string {
|
|
409
|
+
return ValidatableControlShell.selfAndChildrenComponentsDecorativeVariationsCorrespondence.
|
|
410
|
+
requiredInputBadge[this.decorativeVariation];
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
protected get optionalInputBadgeDecorativeVariation(): string {
|
|
414
|
+
return ValidatableControlShell.selfAndChildrenComponentsDecorativeVariationsCorrespondence.
|
|
415
|
+
optionalInputBadge[this.decorativeVariation];
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
public static defineDecorativeVariations(
|
|
419
|
+
ownAndChildrenDecorativeVariationsAndCorrespondenceDefinition: Readonly<{
|
|
420
|
+
[ownDecorativeVariationKey: string]: Readonly<{
|
|
421
|
+
requiredInputBadge: string;
|
|
422
|
+
optionalInputBadge: string;
|
|
423
|
+
}>;
|
|
424
|
+
}>
|
|
425
|
+
): typeof ValidatableControlShell {
|
|
426
|
+
return YDF_ComponentsCoordinator.defineDecorativeVariationsAndSetCorrespondenceWithOnesOfChildrenComponents(
|
|
427
|
+
ownAndChildrenDecorativeVariationsAndCorrespondenceDefinition, ValidatableControlShell
|
|
428
|
+
);
|
|
222
429
|
}
|
|
223
430
|
|
|
224
431
|
|
|
@@ -237,37 +444,12 @@ class ValidatableControlShell extends VueComponent {
|
|
|
237
444
|
}
|
|
238
445
|
|
|
239
446
|
|
|
240
|
-
// ━━━ TODO ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
241
|
-
/* ━━━ Conditional Rendering ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
242
|
-
private get mustDisplayRequiredInputBadge(): boolean {
|
|
243
|
-
return this.required && this.mustDisplayAppropriateBadgeIfInputIsRequired;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
private get mustDisplayOptionalInputBadge(): boolean {
|
|
247
|
-
return this.required && this.mustDisplayAppropriateBadgeIfInputIsOptional;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
protected get mustDisplayHeader(): boolean {
|
|
251
|
-
return isNeitherUndefinedNorNull(this.label) ||
|
|
252
|
-
this.mustDisplayRequiredInputBadge ||
|
|
253
|
-
this.mustDisplayOptionalInputBadge ||
|
|
254
|
-
this.mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
/* ━━━ Lifecycle Hooks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
259
|
-
public created(): void {
|
|
260
|
-
this.initializeNonReactiveClassFields();
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
447
|
/* ━━━ Non-reactive Fields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
265
|
-
|
|
266
|
-
protected
|
|
448
|
+
@AccessibleFromTemplateAsNonReactive
|
|
449
|
+
protected static readonly Badge: typeof Badge = Badge;
|
|
267
450
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
451
|
+
@AccessibleFromTemplateAsNonReactive
|
|
452
|
+
public static localization: ValidatableControlShellLocalization = validatableControlShellYDF_ComponentLocalization__english;
|
|
271
453
|
|
|
272
454
|
}
|
|
273
455
|
|