@yamato-daiwa/frontend-vue 0.1.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 +0 -1
- package/README.md +13 -2
- 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} +88 -64
- package/Source/GUI_Components/Badge/Badge.vue.ts +103 -68
- package/Source/GUI_Components/Badge/LoadingPlaceholder/Badge-LoadingPlaceholder.vue.ts +52 -33
- 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.pug +5 -7
- package/Source/GUI_Components/Controls/Buttons/Plain/Button.vue.ts +257 -116
- package/Source/GUI_Components/Controls/Buttons/Plain/LoadingPlaceholder/Button-LoadingPlaceholder.vue.pug +1 -1
- package/Source/GUI_Components/Controls/Buttons/Plain/LoadingPlaceholder/Button-LoadingPlaceholder.vue.ts +42 -33
- package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.pug +64 -0
- package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.ts +478 -0
- package/Source/GUI_Components/Controls/Validatables/InputtableControl.vue.ts +233 -0
- package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.pug +67 -0
- package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.ts +702 -0
- package/Source/GUI_Components/Controls/{ValidatableControl.ts → Validatables/ValidatableControl.ts} +64 -55
- 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 +317 -0
- package/Source/GUI_Components/_Decorators/AccessibleFromTemplateAsNonReactive.ts +67 -0
- package/Source/GUI_Components/_Decorators/NonReactiveVueData.ts +26 -0
- package/Source/GUI_Components/_Decorators/preventNullForOptionalVueProperty.ts +64 -0
- package/Source/GUI_Components/_Errors/ForbiddenNullValueOfOptionalVueProperty/ForbiddenNullValueOfOptionalVuePropertyError.ts +47 -0
- package/Source/GUI_Components/_Errors/ForbiddenNullValueOfOptionalVueProperty/ForbiddenNullValueOfOptionalVuePropertyErrorLocalization.english.ts +24 -0
- 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 +28 -5
- 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 +24 -2
- package/Workbenches/Source/GUI_Components/Badge/BadgeBlockComponentTestSite.vue +24 -2
- package/Workbenches/Source/GUI_Components/Controls/Buttons/Plain/Button.workbench.pug +20 -0
- package/Workbenches/Source/GUI_Components/Controls/Buttons/Plain/Button.workbench.ts +5 -0
- package/Workbenches/Source/GUI_Components/Controls/Buttons/Plain/ButtonComponentTestSite.vue +60 -0
- package/Workbenches/Source/GUI_Components/Controls/Validatable/TextBox/TextBox.workbench.pug +20 -0
- package/Workbenches/Source/GUI_Components/Controls/Validatable/TextBox/TextBox.workbench.ts +5 -0
- package/Workbenches/Source/GUI_Components/Controls/Validatable/TextBox/TextBoxWorkbench.vue +86 -0
- package/Workbenches/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.workbench.pug +20 -0
- package/Workbenches/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.workbench.ts +5 -0
- package/Workbenches/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShellTestSite.vue +68 -0
- package/Workbenches/Source/GUI_Components/OverflowSafeSingleLineLabel/OverflowSafeSingleLineLabelComponentTestSite.vue +9 -2
- package/Workbenches/Source/Workbenches.pug +62 -0
- package/eslint.config.js +15 -0
- package/package.json +40 -48
- package/tsconfig.json +0 -3
- package/yda.config.yaml +65 -65
- package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue.pug +0 -43
- package/Source/GUI_Components/ComponentsAuxiliaries.ts +0 -124
- package/Source/GUI_Components/Controls/InputtableControl.ts +0 -97
package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.pug
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.ValidatableControlShell--YDF(
|
|
2
|
+
:class="rootElementModifierCSS_Classes"
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
.ValidatableControlShell--YDF-Header(
|
|
6
|
+
v-if="mustDisplayHeader"
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
label.ValidatableControlShell--YDF-Label(
|
|
10
|
+
v-if="label"
|
|
11
|
+
:for="coreElementHTML_ID"
|
|
12
|
+
:id="labelElementHTML_ID"
|
|
13
|
+
) {{ label }}
|
|
14
|
+
|
|
15
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Required(
|
|
16
|
+
v-if="mustDisplayRequiredInputBadge"
|
|
17
|
+
:valueLabel="localization.requirementBadges.required"
|
|
18
|
+
:theme="badgeTheme"
|
|
19
|
+
:geometricVariation="badgeGeometricVariation"
|
|
20
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
21
|
+
:decorativeVariation="requiredInputBadgeDecorativeVariation"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Optional(
|
|
25
|
+
v-else-if="mustDisplayOptionalInputBadge"
|
|
26
|
+
:valueLabel="localization.requirementBadges.optional"
|
|
27
|
+
:theme="badgeTheme"
|
|
28
|
+
:geometricVariation="badgeGeometricVariation"
|
|
29
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
30
|
+
:decorativeVariation="optionalInputBadgeDecorativeVariation"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Invisible(
|
|
34
|
+
v-else-if="mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge"
|
|
35
|
+
:valueLabel="localization.requirementBadges.optional"
|
|
36
|
+
:theme="badgeTheme"
|
|
37
|
+
:geometricVariation="badgeGeometricVariation"
|
|
38
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
39
|
+
:decorativeVariation="optionalInputBadgeDecorativeVariation"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
p.ValidatableControlShell--YDF-Guidance(
|
|
44
|
+
v-if="formattedGuidance"
|
|
45
|
+
v-html="formattedGuidance"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
.ValidatableControlShell--YDF-MainSlotCustomizableWrapper(
|
|
50
|
+
:class="mainSlotWrapperAdditionalCSS_Classes"
|
|
51
|
+
)
|
|
52
|
+
slot
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
VerticallySlidingAlwaysMountedContainer.ValidatableControlShell--YDF-ValidationErrorsMessagesList(
|
|
56
|
+
:modelValue="invalidInputHighlightingIfAnyValidationErrorsMessages && validationErrorsMessages.length > 0"
|
|
57
|
+
tag="ul"
|
|
58
|
+
:duration="errorsListExpandingAnimationDuration__milliseconds"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
li.ValidatableControlShell--YDF-ValidationErrorsMessagesList-Item(
|
|
62
|
+
v-for="validationErrorMessage of validationErrorsMessagesCopyForAnimating"
|
|
63
|
+
:key="validationErrorMessage"
|
|
64
|
+
) {{ validationErrorMessage }}
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
|
+
import componentVueTemplate from "./ValidatableControlShell.vue.pug";
|
|
3
|
+
import {
|
|
4
|
+
type ValidatableControlShellLocalization,
|
|
5
|
+
validatableControlShellYDF_ComponentLocalization__english,
|
|
6
|
+
replaceMarkdownBold,
|
|
7
|
+
replaceMarkdownLink
|
|
8
|
+
} from "@yamato-daiwa/frontend";
|
|
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
|
+
|
|
23
|
+
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
24
|
+
import {
|
|
25
|
+
ComponentBase as VueComponentConfiguration,
|
|
26
|
+
Vue as VueComponent,
|
|
27
|
+
Prop as VueProperty,
|
|
28
|
+
Watch as onVueComponentFieldUpdated
|
|
29
|
+
} from "vue-facing-decorator";
|
|
30
|
+
|
|
31
|
+
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
32
|
+
import YDF_ComponentsCoordinator from "../../YDF_ComponentsCoordinator";
|
|
33
|
+
import AccessibleFromTemplateAsNonReactive from "../../_Decorators/AccessibleFromTemplateAsNonReactive";
|
|
34
|
+
import {
|
|
35
|
+
secondsToMilliseconds,
|
|
36
|
+
isArrayOfCertainTypeElements,
|
|
37
|
+
isNonEmptyString,
|
|
38
|
+
isNotUndefined
|
|
39
|
+
} from "@yamato-daiwa/es-extensions";
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@VueComponentConfiguration({
|
|
43
|
+
name: ValidatableControlShell.CSS_NAMESPACE,
|
|
44
|
+
template: componentVueTemplate,
|
|
45
|
+
components: {
|
|
46
|
+
Badge,
|
|
47
|
+
VerticallySlidingAlwaysMountedContainer
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
class ValidatableControlShell extends VueComponent {
|
|
51
|
+
|
|
52
|
+
public static CSS_NAMESPACE: string = "ValidatableControlShell--YDF";
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
/* ━━━ Component Common Properties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
56
|
+
/* ─── Textings ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
57
|
+
@VueProperty({
|
|
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
|
+
}
|
|
66
|
+
})
|
|
67
|
+
@preventNullForOptionalVueProperty
|
|
68
|
+
protected readonly label?: string;
|
|
69
|
+
|
|
70
|
+
@VueProperty({
|
|
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
|
+
}
|
|
79
|
+
})
|
|
80
|
+
@preventNullForOptionalVueProperty
|
|
81
|
+
protected readonly guidance?: string;
|
|
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
|
+
|
|
104
|
+
|
|
105
|
+
/* ─── Inputting Requirement ────────────────────────────────────────────────────────────────────────────────────── */
|
|
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
|
|
117
|
+
protected readonly required!: boolean;
|
|
118
|
+
|
|
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
|
|
130
|
+
protected readonly mustDisplayAppropriateBadgeIfInputIsRequired!: boolean;
|
|
131
|
+
|
|
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
|
|
143
|
+
protected readonly mustDisplayAppropriateBadgeIfInputIsOptional!: boolean;
|
|
144
|
+
|
|
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
|
|
156
|
+
protected readonly mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge!: boolean;
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
/* ─── Displaying of Validation Messages ────────────────────────────────────────────────────────────────────────── */
|
|
160
|
+
@VueProperty({
|
|
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
|
+
}
|
|
169
|
+
})
|
|
170
|
+
@preventNullForOptionalVueProperty
|
|
171
|
+
protected readonly invalidInputHighlightingIfAnyValidationErrorsMessages!: boolean;
|
|
172
|
+
|
|
173
|
+
@VueProperty({
|
|
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
|
+
}
|
|
182
|
+
})
|
|
183
|
+
@preventNullForOptionalVueProperty
|
|
184
|
+
protected readonly validValueHighlightingIfNoValidationErrorsMessages!: boolean;
|
|
185
|
+
|
|
186
|
+
|
|
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;
|
|
200
|
+
|
|
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;
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
/* ─── CSS Classes ──────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
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
|
|
226
|
+
protected readonly mainSlotWrapperAdditionalCSS_Classes!: ReadonlyArray<string>;
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
/* ━━━ Validation Errors Messages ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
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
|
|
240
|
+
protected readonly validationErrorsMessages!: ReadonlyArray<string>;
|
|
241
|
+
|
|
242
|
+
/* [ Theory ]
|
|
243
|
+
* Even if `validationErrorsMessages` has become to empty array, the validation errors messages are still
|
|
244
|
+
* required to animate the collapsing. */
|
|
245
|
+
protected validationErrorsMessagesCopyForAnimating: ReadonlyArray<string> = [ ...this.validationErrorsMessages ];
|
|
246
|
+
|
|
247
|
+
protected static readonly ERRORS_LIST_EXPANDING_ANIMATION_DURATION_PER_ONE_ERROR_MESSAGE__SECONDS: number = 0.2;
|
|
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")
|
|
257
|
+
@onVueComponentFieldUpdated("validationErrorsMessages")
|
|
258
|
+
protected onValidationErrorsMessagesUpdated(): void {
|
|
259
|
+
|
|
260
|
+
if (this.validationErrorsMessages.length > 0) {
|
|
261
|
+
this.validationErrorsMessagesCopyForAnimating = [ ...this.validationErrorsMessages ];
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
setTimeout(
|
|
267
|
+
(): void => {
|
|
268
|
+
this.validationErrorsMessagesCopyForAnimating = [];
|
|
269
|
+
},
|
|
270
|
+
this.errorsListExpandingAnimationDuration__milliseconds
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
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
|
+
|
|
293
|
+
/* ━━━ Theming ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
294
|
+
public static readonly Themes: ValidatableControlShell.Themes = { regular: "REGULAR" };
|
|
295
|
+
|
|
296
|
+
public static readonly selfAndChildrenComponentsThemesCorrespondence:
|
|
297
|
+
{ badge: { [ownThemeValue: string]: string; }; } =
|
|
298
|
+
{ badge: { [ValidatableControlShell.Themes.regular]: Badge.Themes.regular } };
|
|
299
|
+
|
|
300
|
+
@VueProperty({
|
|
301
|
+
default: ValidatableControlShell.Themes.regular,
|
|
302
|
+
validator: ThemeVuePropertyValidator(ValidatableControlShell)
|
|
303
|
+
})
|
|
304
|
+
@preventNullForOptionalVueProperty
|
|
305
|
+
protected readonly theme!: string;
|
|
306
|
+
|
|
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
|
+
);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
public static areThemesCSS_ClassesCommon: boolean = YDF_ComponentsCoordinator.areThemesCSS_ClassesCommon;
|
|
322
|
+
|
|
323
|
+
public static considerThemesAsCommon(): void {
|
|
324
|
+
ValidatableControlShell.areThemesCSS_ClassesCommon = true;
|
|
325
|
+
}
|
|
326
|
+
|
|
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;
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
/* ─── Geometry ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
342
|
+
public static readonly GeometricVariations: ValidatableControlShell.GeometricVariations = {
|
|
343
|
+
regular: "REGULAR",
|
|
344
|
+
small: "SMALL"
|
|
345
|
+
};
|
|
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
|
+
|
|
363
|
+
@VueProperty({
|
|
364
|
+
default: ValidatableControlShell.GeometricVariations.regular,
|
|
365
|
+
validator: GeometricVariationVuePropertyValidator(ValidatableControlShell)
|
|
366
|
+
})
|
|
367
|
+
@preventNullForOptionalVueProperty
|
|
368
|
+
protected readonly geometricVariation!: string;
|
|
369
|
+
|
|
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
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
/* ─── Decoration ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
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
|
+
};
|
|
401
|
+
|
|
402
|
+
@VueProperty({
|
|
403
|
+
default: ValidatableControlShell.GeometricVariations.regular,
|
|
404
|
+
validator: DecorativeVariationVuePropertyValidator(ValidatableControlShell)
|
|
405
|
+
})
|
|
406
|
+
protected readonly decorativeVariation!: string;
|
|
407
|
+
|
|
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
|
+
);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
/* ━━━ CSS Classes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
433
|
+
protected get rootElementModifierCSS_Classes(): ReadonlyArray<string> {
|
|
434
|
+
return YDF_ComponentsCoordinator.generateRootElementModifierCSS_Classes({
|
|
435
|
+
CSS_Namespace: ValidatableControlShell.CSS_NAMESPACE,
|
|
436
|
+
activeTheme: this.theme,
|
|
437
|
+
allThemes: ValidatableControlShell.Themes,
|
|
438
|
+
areThemesCSS_ClassesCommon: this.areThemesCSS_ClassesCommon,
|
|
439
|
+
activeGeometricVariation: this.geometricVariation,
|
|
440
|
+
allGeometricVariations: ValidatableControlShell.GeometricVariations,
|
|
441
|
+
activeDecorativeVariation: this.decorativeVariation,
|
|
442
|
+
allDecorativeVariations: ValidatableControlShell.DecorativeVariations
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
/* ━━━ Non-reactive Fields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
448
|
+
@AccessibleFromTemplateAsNonReactive
|
|
449
|
+
protected static readonly Badge: typeof Badge = Badge;
|
|
450
|
+
|
|
451
|
+
@AccessibleFromTemplateAsNonReactive
|
|
452
|
+
public static localization: ValidatableControlShellLocalization = validatableControlShellYDF_ComponentLocalization__english;
|
|
453
|
+
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
namespace ValidatableControlShell {
|
|
458
|
+
|
|
459
|
+
export type Themes = {
|
|
460
|
+
readonly regular: "REGULAR";
|
|
461
|
+
[themeName: string]: string;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
export type GeometricVariations = {
|
|
465
|
+
readonly regular: "REGULAR";
|
|
466
|
+
readonly small: "SMALL";
|
|
467
|
+
[geometricVariationName: string]: string;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export type DecorativeVariations = {
|
|
471
|
+
readonly regular: "REGULAR";
|
|
472
|
+
[decorativeVariationName: string]: string;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
export default ValidatableControlShell;
|