@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
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
2
|
import componentVueTemplate from "./Button.vue.pug";
|
|
3
3
|
|
|
4
|
+
/* ─── Validations ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
5
|
+
import VuePropertyValidator from "../../../_VuePropertiesValidators/VuePropertyValidator";
|
|
6
|
+
import BooleanVuePropertyValidator from "../../../_VuePropertiesValidators/BooleanVuePropertyValidator";
|
|
7
|
+
import ElementOfEnumerationVuePropertyValidator from "../../../_VuePropertiesValidators/ElementOfEnumerationVuePropertyValidator";
|
|
8
|
+
import NonEmptyStringVuePropertyValidator from "../../../_VuePropertiesValidators/NonEmptyStringVuePropertyValidator";
|
|
9
|
+
import ThemeVuePropertyValidator from "../../../_VuePropertiesValidators/ThemeVuePropertyValidator";
|
|
10
|
+
import GeometricVariationVuePropertyValidator from "../../../_VuePropertiesValidators/GeometricVariationVuePropertyValidator";
|
|
11
|
+
import GeometricModifiersVuePropertyValidator from "../../../_VuePropertiesValidators/GeometricModifiersVuePropertyValidator";
|
|
12
|
+
import DecorativeVariationVuePropertyValidator from "../../../_VuePropertiesValidators/DecorativeVariationVuePropertyValidator";
|
|
13
|
+
import DecorativeModifiersVuePropertyValidator from "../../../_VuePropertiesValidators/DecorativeModifiersVuePropertyValidator";
|
|
14
|
+
import InvalidVuePropertiesCombinationError from
|
|
15
|
+
"../../../_Errors/InvalidVuePropertiesCombination/InvalidVuePropertiesCombinationError";
|
|
16
|
+
import preventNullForOptionalVueProperty from "../../../_Decorators/preventNullForOptionalVueProperty";
|
|
17
|
+
|
|
4
18
|
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
5
19
|
import {
|
|
6
20
|
ComponentBase as VueComponentConfiguration,
|
|
@@ -11,16 +25,12 @@ import type { RouteLocationRaw as VueRouterRawLocation } from "vue-router";
|
|
|
11
25
|
|
|
12
26
|
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
13
27
|
import YDF_ComponentsCoordinator from "../../../YDF_ComponentsCoordinator";
|
|
14
|
-
import InvalidVuePropertiesCombinationError from
|
|
15
|
-
"../../../_Errors/InvalidVuePropertiesCombination/InvalidVuePropertiesCombinationError";
|
|
16
28
|
import {
|
|
17
29
|
Logger,
|
|
18
30
|
isNumber,
|
|
19
|
-
isString,
|
|
20
31
|
isNonEmptyString,
|
|
21
32
|
isEitherUndefinedOrNull,
|
|
22
33
|
isNeitherUndefinedNorNull,
|
|
23
|
-
isElementOfEnumeration,
|
|
24
34
|
isArbitraryObject,
|
|
25
35
|
emptyStringToNull,
|
|
26
36
|
type ElementOfPseudoEnumeration
|
|
@@ -55,40 +65,127 @@ class Button extends VueComponent {
|
|
|
55
65
|
|
|
56
66
|
/* ━━━ Common Properties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
57
67
|
@VueProperty({
|
|
58
|
-
type: String,
|
|
59
68
|
default: Button.HTML_Types.regular,
|
|
60
|
-
validator
|
|
69
|
+
get validator(): VuePropertyValidator {
|
|
70
|
+
return ElementOfEnumerationVuePropertyValidator({
|
|
71
|
+
enumerationFullyQualifiedName: "Button.HTML_Types",
|
|
72
|
+
enumeration: Button.HTML_Types,
|
|
73
|
+
propertyName: "HTML_Type",
|
|
74
|
+
componentName: Button.CSS_NAMESPACE,
|
|
75
|
+
isPropertyRequired: this.required === true
|
|
76
|
+
});
|
|
77
|
+
}
|
|
61
78
|
})
|
|
79
|
+
@preventNullForOptionalVueProperty
|
|
62
80
|
protected readonly HTML_Type!: ElementOfPseudoEnumeration<Button.HTML_Types>;
|
|
63
81
|
|
|
64
82
|
|
|
65
83
|
/* ─── Textings ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
66
|
-
@VueProperty({
|
|
67
|
-
|
|
84
|
+
@VueProperty({
|
|
85
|
+
required: false,
|
|
86
|
+
validator: VuePropertyValidator.create({
|
|
87
|
+
checker: (rawValue: unknown): boolean =>
|
|
88
|
+
isNonEmptyString(rawValue) || isNumber(rawValue, { mustConsiderNaN_AsNumber: true }),
|
|
89
|
+
messageSpecificPart: "If specified, must be either non-empty string or number.",
|
|
90
|
+
propertyName: "label",
|
|
91
|
+
componentName: Button.CSS_NAMESPACE
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
@preventNullForOptionalVueProperty
|
|
95
|
+
protected readonly label?: string | number;
|
|
68
96
|
|
|
69
|
-
@VueProperty({
|
|
70
|
-
|
|
97
|
+
@VueProperty({
|
|
98
|
+
required: false,
|
|
99
|
+
get validator(): VuePropertyValidator {
|
|
100
|
+
return NonEmptyStringVuePropertyValidator({
|
|
101
|
+
isPropertyRequired: this.required === true,
|
|
102
|
+
propertyName: "accessibilityGuidance",
|
|
103
|
+
componentName: Button.CSS_NAMESPACE
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
@preventNullForOptionalVueProperty
|
|
108
|
+
protected readonly accessibilityGuidance?: string;
|
|
71
109
|
|
|
72
110
|
|
|
73
111
|
/* ─── Links ────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
74
|
-
@VueProperty({
|
|
75
|
-
|
|
112
|
+
@VueProperty({
|
|
113
|
+
required: false,
|
|
114
|
+
validator: VuePropertyValidator.create({
|
|
115
|
+
checker: (rawValue: unknown): boolean => isNonEmptyString(rawValue) || isArbitraryObject(rawValue),
|
|
116
|
+
messageSpecificPart: "If specified, must be either non-empty string or an object.",
|
|
117
|
+
propertyName: "route",
|
|
118
|
+
componentName: Button.CSS_NAMESPACE
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
@preventNullForOptionalVueProperty
|
|
122
|
+
protected readonly route?: VueRouterRawLocation;
|
|
76
123
|
|
|
77
|
-
@VueProperty({
|
|
78
|
-
|
|
124
|
+
@VueProperty({
|
|
125
|
+
required: false,
|
|
126
|
+
get validator(): VuePropertyValidator {
|
|
127
|
+
return NonEmptyStringVuePropertyValidator({
|
|
128
|
+
propertyName: "externalURI",
|
|
129
|
+
isPropertyRequired: this.required === true,
|
|
130
|
+
componentName: Button.CSS_NAMESPACE
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
@preventNullForOptionalVueProperty
|
|
135
|
+
protected readonly externalURI?: string;
|
|
79
136
|
|
|
80
|
-
@VueProperty({
|
|
137
|
+
@VueProperty({
|
|
138
|
+
default: false,
|
|
139
|
+
get validator(): VuePropertyValidator {
|
|
140
|
+
return BooleanVuePropertyValidator({
|
|
141
|
+
propertyName: "mustOpenLinkInNewTab",
|
|
142
|
+
componentName: Button.CSS_NAMESPACE,
|
|
143
|
+
isPropertyRequired: this.required === true
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
@preventNullForOptionalVueProperty
|
|
81
148
|
protected readonly mustOpenLinkInNewTab!: boolean;
|
|
82
149
|
|
|
83
|
-
@VueProperty({
|
|
150
|
+
@VueProperty({
|
|
151
|
+
default: false,
|
|
152
|
+
get validator(): VuePropertyValidator {
|
|
153
|
+
return BooleanVuePropertyValidator({
|
|
154
|
+
propertyName: "mustRequestNotFollowLinkForCrawlingToSearchEngine",
|
|
155
|
+
componentName: Button.CSS_NAMESPACE,
|
|
156
|
+
isPropertyRequired: this.required === true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
@preventNullForOptionalVueProperty
|
|
84
161
|
protected readonly mustRequestNotFollowLinkForCrawlingToSearchEngine!: boolean;
|
|
85
162
|
|
|
86
163
|
|
|
87
164
|
/* ─── Status ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
88
|
-
@VueProperty({
|
|
165
|
+
@VueProperty({
|
|
166
|
+
default: false,
|
|
167
|
+
get validator(): VuePropertyValidator {
|
|
168
|
+
return BooleanVuePropertyValidator({
|
|
169
|
+
propertyName: "disabled",
|
|
170
|
+
componentName: Button.CSS_NAMESPACE,
|
|
171
|
+
isPropertyRequired: this.required === true
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
@preventNullForOptionalVueProperty
|
|
89
176
|
protected readonly disabled!: boolean;
|
|
90
177
|
|
|
91
|
-
@VueProperty({
|
|
178
|
+
@VueProperty({
|
|
179
|
+
default: false,
|
|
180
|
+
get validator(): VuePropertyValidator {
|
|
181
|
+
return BooleanVuePropertyValidator({
|
|
182
|
+
propertyName: "toggled",
|
|
183
|
+
componentName: Button.CSS_NAMESPACE,
|
|
184
|
+
isPropertyRequired: this.required === true
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
@preventNullForOptionalVueProperty
|
|
92
189
|
protected readonly toggled!: boolean;
|
|
93
190
|
|
|
94
191
|
|
|
@@ -96,10 +193,10 @@ class Button extends VueComponent {
|
|
|
96
193
|
public static readonly Themes: Button.Themes = { regular: "REGULAR" };
|
|
97
194
|
|
|
98
195
|
@VueProperty({
|
|
99
|
-
type: String,
|
|
100
196
|
default: Button.Themes.regular,
|
|
101
|
-
validator: (
|
|
197
|
+
validator: ThemeVuePropertyValidator(Button)
|
|
102
198
|
})
|
|
199
|
+
@preventNullForOptionalVueProperty
|
|
103
200
|
protected readonly theme!: string;
|
|
104
201
|
|
|
105
202
|
public static defineThemes(themesNames: ReadonlyArray<string>): typeof Button {
|
|
@@ -112,7 +209,17 @@ class Button extends VueComponent {
|
|
|
112
209
|
Button.areThemesCSS_ClassesCommon = true;
|
|
113
210
|
}
|
|
114
211
|
|
|
115
|
-
@VueProperty({
|
|
212
|
+
@VueProperty({
|
|
213
|
+
default: Button.areThemesCSS_ClassesCommon,
|
|
214
|
+
get validator(): VuePropertyValidator {
|
|
215
|
+
return BooleanVuePropertyValidator({
|
|
216
|
+
propertyName: "areThemesCSS_ClassesCommon",
|
|
217
|
+
componentName: Button.CSS_NAMESPACE,
|
|
218
|
+
isPropertyRequired: this.required === true
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
@preventNullForOptionalVueProperty
|
|
116
223
|
private readonly areThemesCSS_ClassesCommon!: boolean;
|
|
117
224
|
|
|
118
225
|
|
|
@@ -124,25 +231,35 @@ class Button extends VueComponent {
|
|
|
124
231
|
};
|
|
125
232
|
|
|
126
233
|
@VueProperty({
|
|
127
|
-
type: String,
|
|
128
234
|
default: Button.GeometricVariations.regular,
|
|
129
|
-
validator: (
|
|
235
|
+
validator: GeometricVariationVuePropertyValidator(Button)
|
|
130
236
|
})
|
|
237
|
+
@preventNullForOptionalVueProperty
|
|
131
238
|
protected readonly geometricVariation!: string;
|
|
132
239
|
|
|
133
240
|
public static defineGeometricVariations(geometricVariationsNames: ReadonlyArray<string>): typeof Button {
|
|
134
241
|
return YDF_ComponentsCoordinator.defineGeometricVariations(geometricVariationsNames, Button);
|
|
135
242
|
}
|
|
136
243
|
|
|
244
|
+
public static readonly GeometricModifiers: Button.GeometricModifiers = {
|
|
245
|
+
pillShape: "PILL_SHAPE",
|
|
246
|
+
squareShape: "SQUARE_SHAPE",
|
|
247
|
+
squareShapeUnlessOverflowed: "SQUARE_SHAPE_UNLESS_OVERFLOWED",
|
|
248
|
+
singleLine: "SINGLE_LINE",
|
|
249
|
+
noLeftBorderAndRoundings: "NO_LEFT_BORDER_AND_ROUNDINGS",
|
|
250
|
+
noRightBorderAndRoundings: "NO_RIGHT_BORDER_AND_ROUNDINGS",
|
|
251
|
+
noTopBorderAndRoundings: "NO_TOP_BORDER_AND_ROUNDINGS",
|
|
252
|
+
noBottomBorderAndRoundings: "NO_BOTTOM_BORDER_AND_ROUNDINGS",
|
|
253
|
+
noRoundings: "NO_ROUNDINGS",
|
|
254
|
+
horizontallyShrinkable: "HORIZONTALLY_SHRINKABLE"
|
|
255
|
+
};
|
|
256
|
+
|
|
137
257
|
@VueProperty({
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
validator: (rawValue: ReadonlyArray<unknown>): boolean =>
|
|
141
|
-
rawValue.every(
|
|
142
|
-
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, Button.GeometricModifiers)
|
|
143
|
-
)
|
|
258
|
+
default: (): ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>> => [],
|
|
259
|
+
validator: GeometricModifiersVuePropertyValidator(Button)
|
|
144
260
|
})
|
|
145
|
-
|
|
261
|
+
@preventNullForOptionalVueProperty
|
|
262
|
+
protected readonly geometricModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>>;
|
|
146
263
|
|
|
147
264
|
|
|
148
265
|
/* ─── Decoration ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -154,53 +271,37 @@ class Button extends VueComponent {
|
|
|
154
271
|
};
|
|
155
272
|
|
|
156
273
|
@VueProperty({
|
|
157
|
-
type: String,
|
|
158
274
|
default: Button.DecorativeVariations.regular,
|
|
159
|
-
validator: (
|
|
275
|
+
validator: DecorativeVariationVuePropertyValidator(Button)
|
|
160
276
|
})
|
|
277
|
+
@preventNullForOptionalVueProperty
|
|
161
278
|
protected readonly decorativeVariation!: string;
|
|
162
279
|
|
|
163
280
|
public static defineDecorativeVariations(decorativeVariationsNames: ReadonlyArray<string>): typeof Button {
|
|
164
281
|
return YDF_ComponentsCoordinator.defineDecorativeVariations(decorativeVariationsNames, Button);
|
|
165
282
|
}
|
|
166
283
|
|
|
284
|
+
public static readonly DecorativeModifiers: Button.DecorativeModifiers = {
|
|
285
|
+
bordersDisguising: "BORDERS_DISGUISING",
|
|
286
|
+
noBackground: "NO_BACKGROUND",
|
|
287
|
+
noBackgroundInDefaultState: "NO_BACKGROUND_IN_DEFAULT_STATE"
|
|
288
|
+
};
|
|
167
289
|
|
|
168
290
|
@VueProperty({
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
validator: (rawValue: ReadonlyArray<unknown>): boolean =>
|
|
172
|
-
rawValue.every(
|
|
173
|
-
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, Button.DecorativeModifiers)
|
|
174
|
-
)
|
|
291
|
+
default: (): ReadonlyArray<ElementOfPseudoEnumeration<Button.DecorativeModifiers>> => [],
|
|
292
|
+
validator: DecorativeModifiersVuePropertyValidator(Button)
|
|
175
293
|
})
|
|
176
|
-
protected readonly decorativeModifiers!: ReadonlyArray<Button.DecorativeModifiers
|
|
294
|
+
protected readonly decorativeModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.DecorativeModifiers>>;
|
|
177
295
|
|
|
178
296
|
|
|
179
297
|
/* ━━━ Lifecycle Hooks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
(!isNonEmptyString(this.label) && isNumber(this.label)) &&
|
|
184
|
-
(
|
|
185
|
-
this.HTML_Type === Button.HTML_Types.inputButton ||
|
|
186
|
-
this.HTML_Type === Button.HTML_Types.inputSubmit ||
|
|
187
|
-
this.HTML_Type === Button.HTML_Types.inputReset
|
|
188
|
-
)
|
|
189
|
-
) {
|
|
190
|
-
Logger.throwErrorAndLog({
|
|
191
|
-
errorInstance: new InvalidVuePropertiesCombinationError({
|
|
192
|
-
vueComponentName: Button.name,
|
|
193
|
-
messageSpecificPart:
|
|
194
|
-
"When button has HTML type \"inputButton\", \"inputSubmit\" or \"inputReset\", the \"label\" property " +
|
|
195
|
-
"must be specified with non-empty string of number."
|
|
196
|
-
}),
|
|
197
|
-
title: InvalidVuePropertiesCombinationError.localization.defaultTitle,
|
|
198
|
-
occurrenceLocation: `${ Button.name }.created()`
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
298
|
+
protected created(): void {
|
|
202
299
|
this.initializeNonReactiveClassFields();
|
|
300
|
+
this.validateProperties();
|
|
301
|
+
}
|
|
203
302
|
|
|
303
|
+
protected beforeUpdate(): void {
|
|
304
|
+
this.validateProperties();
|
|
204
305
|
}
|
|
205
306
|
|
|
206
307
|
|
|
@@ -261,37 +362,48 @@ class Button extends VueComponent {
|
|
|
261
362
|
|
|
262
363
|
/* ━━━ CSS Classes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
263
364
|
protected get rootElementModifierCSS_Classes(): ReadonlyArray<string> {
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
365
|
+
return YDF_ComponentsCoordinator.generateRootElementModifierCSS_Classes({
|
|
366
|
+
CSS_Namespace: Button.CSS_NAMESPACE,
|
|
367
|
+
activeTheme: this.theme,
|
|
368
|
+
allThemes: Button.Themes,
|
|
369
|
+
areThemesCSS_ClassesCommon: this.areThemesCSS_ClassesCommon,
|
|
370
|
+
activeGeometricVariation: this.geometricVariation,
|
|
371
|
+
allGeometricVariations: Button.GeometricVariations,
|
|
372
|
+
activeGeometricModifiers: this.geometricModifiers,
|
|
373
|
+
activeDecorativeVariation: this.decorativeVariation,
|
|
374
|
+
allDecorativeVariations: Button.DecorativeVariations,
|
|
375
|
+
activeDecorativeModifiers: this.decorativeModifiers,
|
|
376
|
+
other: [
|
|
377
|
+
...(this.isAnchorTheTagNameOfRootElement || this.isRouterLinkTheRootElement) && this.disabled ?
|
|
378
|
+
[ `${ Button.CSS_NAMESPACE }__DisabledState` ] : []
|
|
379
|
+
]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
281
382
|
|
|
282
|
-
...YDF_ComponentsCoordinator.
|
|
283
|
-
generateDemandedGeometricModifiersCSS_Classes(Button.CSS_NAMESPACE, this.geometricModifiers),
|
|
284
383
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
allDecorativeVariations: Button.DecorativeVariations,
|
|
288
|
-
CSS_Namespace: Button.CSS_NAMESPACE
|
|
289
|
-
}),
|
|
384
|
+
/* ━━━ Properties Validation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
385
|
+
protected validateProperties(): void {
|
|
290
386
|
|
|
291
|
-
|
|
292
|
-
|
|
387
|
+
if (
|
|
388
|
+
(!isNonEmptyString(this.label) && isNumber(this.label, { mustConsiderNaN_AsNumber: true })) &&
|
|
389
|
+
(
|
|
390
|
+
this.HTML_Type === Button.HTML_Types.inputButton ||
|
|
391
|
+
this.HTML_Type === Button.HTML_Types.inputSubmit ||
|
|
392
|
+
this.HTML_Type === Button.HTML_Types.inputReset
|
|
393
|
+
)
|
|
394
|
+
) {
|
|
395
|
+
Logger.throwErrorWithFormattedMessage({
|
|
396
|
+
errorInstance: new InvalidVuePropertiesCombinationError({
|
|
397
|
+
vueComponentName: Button.CSS_NAMESPACE,
|
|
398
|
+
messageSpecificPart:
|
|
399
|
+
"When button has HTML type \"inputButton\", \"inputSubmit\" or \"inputReset\", the \"label\" property " +
|
|
400
|
+
"must be specified with non-empty string of number."
|
|
401
|
+
}),
|
|
402
|
+
title: InvalidVuePropertiesCombinationError.localization.defaultTitle,
|
|
403
|
+
occurrenceLocation: `${ Button.CSS_NAMESPACE }.created/beforeUpdate()`
|
|
404
|
+
});
|
|
405
|
+
}
|
|
293
406
|
|
|
294
|
-
];
|
|
295
407
|
}
|
|
296
408
|
|
|
297
409
|
}
|
|
@@ -319,18 +431,18 @@ namespace Button {
|
|
|
319
431
|
[variationName: string]: string;
|
|
320
432
|
};
|
|
321
433
|
|
|
322
|
-
export
|
|
323
|
-
pillShape
|
|
324
|
-
squareShape
|
|
325
|
-
squareShapeUnlessOverflowed
|
|
326
|
-
singleLine
|
|
327
|
-
noLeftBorderAndRoundings
|
|
328
|
-
noRightBorderAndRoundings
|
|
329
|
-
noTopBorderAndRoundings
|
|
330
|
-
noBottomBorderAndRoundings
|
|
331
|
-
noRoundings
|
|
332
|
-
horizontallyShrinkable
|
|
333
|
-
}
|
|
434
|
+
export type GeometricModifiers = Readonly<{
|
|
435
|
+
pillShape: "PILL_SHAPE";
|
|
436
|
+
squareShape: "SQUARE_SHAPE";
|
|
437
|
+
squareShapeUnlessOverflowed: "SQUARE_SHAPE_UNLESS_OVERFLOWED";
|
|
438
|
+
singleLine: "SINGLE_LINE";
|
|
439
|
+
noLeftBorderAndRoundings: "NO_LEFT_BORDER_AND_ROUNDINGS";
|
|
440
|
+
noRightBorderAndRoundings: "NO_RIGHT_BORDER_AND_ROUNDINGS";
|
|
441
|
+
noTopBorderAndRoundings: "NO_TOP_BORDER_AND_ROUNDINGS";
|
|
442
|
+
noBottomBorderAndRoundings: "NO_BOTTOM_BORDER_AND_ROUNDINGS";
|
|
443
|
+
noRoundings: "NO_ROUNDINGS";
|
|
444
|
+
horizontallyShrinkable: "HORIZONTALLY_SHRINKABLE";
|
|
445
|
+
}>;
|
|
334
446
|
|
|
335
447
|
export type DecorativeVariations = {
|
|
336
448
|
readonly regular: "REGULAR";
|
|
@@ -340,11 +452,11 @@ namespace Button {
|
|
|
340
452
|
[variationName: string]: string;
|
|
341
453
|
};
|
|
342
454
|
|
|
343
|
-
export
|
|
344
|
-
bordersDisguising
|
|
345
|
-
noBackground
|
|
346
|
-
noBackgroundInDefaultState
|
|
347
|
-
}
|
|
455
|
+
export type DecorativeModifiers = Readonly<{
|
|
456
|
+
bordersDisguising: "BORDERS_DISGUISING";
|
|
457
|
+
noBackground: "NO_BACKGROUND";
|
|
458
|
+
noBackgroundInDefaultState: "NO_BACKGROUND_IN_DEFAULT_STATE";
|
|
459
|
+
}>;
|
|
348
460
|
|
|
349
461
|
}
|
|
350
462
|
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
|
-
import Button from "../Button.vue";
|
|
3
2
|
import componentVueTemplate from "./Button-LoadingPlaceholder.vue.pug";
|
|
4
3
|
|
|
4
|
+
/* ─── GUI Components ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
5
|
+
import Button from "../Button.vue";
|
|
6
|
+
|
|
7
|
+
/* ─── Validations ─────────────────────────────────────────────────────────────────────────────────────── */
|
|
8
|
+
import ThemeVuePropertyValidator from "../../../../_VuePropertiesValidators/ThemeVuePropertyValidator";
|
|
9
|
+
import GeometricVariationVuePropertyValidator from "../../../../_VuePropertiesValidators/GeometricVariationVuePropertyValidator";
|
|
10
|
+
import GeometricModifiersVuePropertyValidator from "../../../../_VuePropertiesValidators/GeometricModifiersVuePropertyValidator";
|
|
11
|
+
import preventNullForOptionalVueProperty from "../../../../_Decorators/preventNullForOptionalVueProperty";
|
|
12
|
+
|
|
5
13
|
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
6
14
|
import {
|
|
7
15
|
ComponentBase as VueComponentConfiguration,
|
|
@@ -10,12 +18,12 @@ import {
|
|
|
10
18
|
} from "vue-facing-decorator";
|
|
11
19
|
|
|
12
20
|
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
13
|
-
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
14
21
|
import YDF_ComponentsCoordinator from "../../../../YDF_ComponentsCoordinator";
|
|
22
|
+
import type { ElementOfPseudoEnumeration } from "@yamato-daiwa/es-extensions";
|
|
15
23
|
|
|
16
24
|
|
|
17
25
|
@VueComponentConfiguration({
|
|
18
|
-
name: "Button--
|
|
26
|
+
name: "Button--YDF__LoadingPlaceholder",
|
|
19
27
|
template: componentVueTemplate
|
|
20
28
|
})
|
|
21
29
|
export default class ButtonLoadingPlaceholder extends VueComponent {
|
|
@@ -23,52 +31,52 @@ export default class ButtonLoadingPlaceholder extends VueComponent {
|
|
|
23
31
|
@VueProperty({
|
|
24
32
|
type: String,
|
|
25
33
|
default: Button.Themes.regular,
|
|
26
|
-
validator: (
|
|
34
|
+
validator: ThemeVuePropertyValidator({
|
|
35
|
+
Themes: Button.Themes,
|
|
36
|
+
CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
|
|
37
|
+
})
|
|
27
38
|
})
|
|
39
|
+
@preventNullForOptionalVueProperty
|
|
28
40
|
protected readonly theme!: string;
|
|
29
41
|
|
|
30
42
|
@VueProperty({ type: Boolean, default: Button.areThemesCSS_ClassesCommon })
|
|
43
|
+
@preventNullForOptionalVueProperty
|
|
31
44
|
protected readonly areThemesCSS_ClassesCommon!: boolean;
|
|
32
45
|
|
|
33
46
|
|
|
34
47
|
@VueProperty({
|
|
35
48
|
type: String,
|
|
36
49
|
default: Button.GeometricVariations.regular,
|
|
37
|
-
validator: (
|
|
50
|
+
validator: GeometricVariationVuePropertyValidator({
|
|
51
|
+
GeometricVariations: Button.GeometricVariations,
|
|
52
|
+
CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
|
|
53
|
+
})
|
|
38
54
|
})
|
|
55
|
+
@preventNullForOptionalVueProperty
|
|
39
56
|
protected readonly geometricVariation!: string;
|
|
40
57
|
|
|
41
58
|
@VueProperty({
|
|
42
59
|
type: Array,
|
|
43
|
-
default: (): ReadonlyArray<
|
|
44
|
-
validator: (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
60
|
+
default: (): ReadonlyArray<Button.GeometricModifiers> => [],
|
|
61
|
+
validator: GeometricModifiersVuePropertyValidator({
|
|
62
|
+
GeometricModifiers: Button.GeometricModifiers,
|
|
63
|
+
CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
|
|
64
|
+
})
|
|
48
65
|
})
|
|
49
|
-
|
|
66
|
+
@preventNullForOptionalVueProperty
|
|
67
|
+
protected readonly geometricModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>>;
|
|
50
68
|
|
|
51
69
|
|
|
52
70
|
protected get rootElementModifierCSS_Classes(): ReadonlyArray<string> {
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...YDF_ComponentsCoordinator.addGeometricVariationCSS_ClassToArrayIfMust({
|
|
63
|
-
geometricVariation: this.geometricVariation,
|
|
64
|
-
allGeometricVariations: Button.GeometricVariations,
|
|
65
|
-
CSS_Namespace: Button.CSS_NAMESPACE
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
...YDF_ComponentsCoordinator.
|
|
69
|
-
generateDemandedGeometricModifiersCSS_Classes(Button.CSS_NAMESPACE, this.geometricModifiers)
|
|
70
|
-
|
|
71
|
-
];
|
|
71
|
+
return YDF_ComponentsCoordinator.generateRootElementModifierCSS_Classes({
|
|
72
|
+
CSS_Namespace: Button.CSS_NAMESPACE,
|
|
73
|
+
activeTheme: this.theme,
|
|
74
|
+
allThemes: Button.Themes,
|
|
75
|
+
areThemesCSS_ClassesCommon: this.areThemesCSS_ClassesCommon,
|
|
76
|
+
activeGeometricVariation: this.geometricVariation,
|
|
77
|
+
allGeometricVariations: Button.GeometricVariations,
|
|
78
|
+
activeGeometricModifiers: this.geometricModifiers
|
|
79
|
+
});
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
}
|
package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.pug
CHANGED
|
@@ -12,40 +12,53 @@
|
|
|
12
12
|
:id="labelElementHTML_ID"
|
|
13
13
|
) {{ label }}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Required(
|
|
16
16
|
v-if="mustDisplayRequiredInputBadge"
|
|
17
|
-
|
|
17
|
+
:valueLabel="localization.requirementBadges.required"
|
|
18
|
+
:theme="badgeTheme"
|
|
19
|
+
:geometricVariation="badgeGeometricVariation"
|
|
20
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
21
|
+
:decorativeVariation="requiredInputBadgeDecorativeVariation"
|
|
22
|
+
)
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Optional(
|
|
20
25
|
v-else-if="mustDisplayOptionalInputBadge"
|
|
21
|
-
|
|
26
|
+
:valueLabel="localization.requirementBadges.optional"
|
|
27
|
+
:theme="badgeTheme"
|
|
28
|
+
:geometricVariation="badgeGeometricVariation"
|
|
29
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
30
|
+
:decorativeVariation="optionalInputBadgeDecorativeVariation"
|
|
31
|
+
)
|
|
22
32
|
|
|
23
|
-
|
|
33
|
+
Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Invisible(
|
|
24
34
|
v-else-if="mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge"
|
|
35
|
+
:valueLabel="localization.requirementBadges.optional"
|
|
36
|
+
:theme="badgeTheme"
|
|
37
|
+
:geometricVariation="badgeGeometricVariation"
|
|
38
|
+
:geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
|
|
39
|
+
:decorativeVariation="optionalInputBadgeDecorativeVariation"
|
|
25
40
|
)
|
|
26
41
|
|
|
27
42
|
|
|
28
43
|
p.ValidatableControlShell--YDF-Guidance(
|
|
29
|
-
v-if="
|
|
30
|
-
v-html="
|
|
44
|
+
v-if="formattedGuidance"
|
|
45
|
+
v-html="formattedGuidance"
|
|
31
46
|
)
|
|
32
47
|
|
|
33
48
|
|
|
34
49
|
.ValidatableControlShell--YDF-MainSlotCustomizableWrapper(
|
|
35
50
|
:class="mainSlotWrapperAdditionalCSS_Classes"
|
|
36
|
-
)
|
|
51
|
+
)
|
|
52
|
+
slot
|
|
37
53
|
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
mustAnimateHeightWhenContentsAreChanged="true"
|
|
45
|
-
animationDuration__seconds="VALIDATION_ERRORS_MESSAGES_ANIMATION_DURATION__SECONDS"
|
|
46
|
-
)
|
|
55
|
+
VerticallySlidingAlwaysMountedContainer.ValidatableControlShell--YDF-ValidationErrorsMessagesList(
|
|
56
|
+
:modelValue="invalidInputHighlightingIfAnyValidationErrorsMessages && validationErrorsMessages.length > 0"
|
|
57
|
+
tag="ul"
|
|
58
|
+
:duration="errorsListExpandingAnimationDuration__milliseconds"
|
|
59
|
+
)
|
|
47
60
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
li.ValidatableControlShell--YDF-ValidationErrorsMessagesList-Item(
|
|
62
|
+
v-for="validationErrorMessage of validationErrorsMessagesCopyForAnimating"
|
|
63
|
+
:key="validationErrorMessage"
|
|
64
|
+
) {{ validationErrorMessage }}
|