@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.

Files changed (60) hide show
  1. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +5 -1
  3. package/README.md +5 -0
  4. package/Source/Functions/getElementByVueReference.ts +105 -8
  5. package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue +67 -0
  6. package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue.d.ts +48 -0
  7. package/Source/GUI_Components/AdmonitionBlock/{AdmonitionBlock.vue.ts → AdmonitionBlockLogic.vue.ts} +83 -59
  8. package/Source/GUI_Components/Badge/Badge.vue.ts +98 -63
  9. package/Source/GUI_Components/Badge/LoadingPlaceholder/Badge-LoadingPlaceholder.vue.ts +51 -32
  10. package/Source/GUI_Components/Controls/Buttons/Closing/ClosingButton.vue.pug +1 -0
  11. package/Source/GUI_Components/Controls/Buttons/Closing/ClosingButton.vue.ts +224 -0
  12. package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton-ForInheritance.vue.ts +253 -0
  13. package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue +24 -0
  14. package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue.d.ts +45 -0
  15. package/Source/GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue.pug +0 -0
  16. package/Source/GUI_Components/Controls/Buttons/Plain/Button.vue.ts +217 -105
  17. package/Source/GUI_Components/Controls/Buttons/Plain/LoadingPlaceholder/Button-LoadingPlaceholder.vue.ts +38 -30
  18. package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.pug +33 -20
  19. package/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue.ts +303 -121
  20. package/Source/GUI_Components/Controls/Validatables/InputtableControl.vue.ts +233 -0
  21. package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.pug +38 -0
  22. package/Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue.ts +538 -96
  23. package/Source/GUI_Components/Controls/Validatables/ValidatableControl.ts +63 -54
  24. package/Source/GUI_Components/Controls/Validatables/ValidatableControlsGroup.ts +176 -0
  25. package/Source/GUI_Components/OverflowSafeSingleLineLabel.vue +9 -2
  26. package/Source/GUI_Components/ThemesShowcase.vue +10 -5
  27. package/Source/GUI_Components/YDF_ComponentsCoordinator.ts +164 -5
  28. package/Source/GUI_Components/_Decorators/AccessibleFromTemplateAsNonReactive.ts +67 -0
  29. package/Source/GUI_Components/_Decorators/NonReactiveVueData.ts +26 -0
  30. package/Source/GUI_Components/_Decorators/{OptionalButNotNullableVueProperty.ts → preventNullForOptionalVueProperty.ts} +3 -4
  31. package/Source/GUI_Components/_Errors/InvalidVueProperty/InvalidVuePropertyError.ts +43 -0
  32. package/Source/GUI_Components/_Errors/InvalidVueProperty/InvalidVuePropertyErrorLocalization.english.ts +16 -0
  33. package/Source/GUI_Components/_VuePropertiesValidators/BooleanVuePropertyValidator.ts +25 -0
  34. package/Source/GUI_Components/_VuePropertiesValidators/DecorativeModifiersVuePropertyValidator.ts +22 -0
  35. package/Source/GUI_Components/_VuePropertiesValidators/DecorativeVariationVuePropertyValidator.ts +23 -0
  36. package/Source/GUI_Components/_VuePropertiesValidators/ElementOfEnumerationVuePropertyValidator.ts +29 -0
  37. package/Source/GUI_Components/_VuePropertiesValidators/GeometricModifiersVuePropertyValidator.ts +22 -0
  38. package/Source/GUI_Components/_VuePropertiesValidators/GeometricVariationVuePropertyValidator.ts +23 -0
  39. package/Source/GUI_Components/_VuePropertiesValidators/NaturalNumberOrZeroVuePropertyValidator.ts +25 -0
  40. package/Source/GUI_Components/_VuePropertiesValidators/NonEmptyStringVuePropertyValidator.ts +25 -0
  41. package/Source/GUI_Components/_VuePropertiesValidators/ThemeVuePropertyValidator.ts +23 -0
  42. package/Source/GUI_Components/_VuePropertiesValidators/VuePropertyValidator.ts +51 -0
  43. package/Source/index.ts +24 -8
  44. package/Workbenches/Source/Decorators/Decorators.workbench.pug +20 -0
  45. package/Workbenches/Source/Decorators/Decorators.workbench.ts +5 -0
  46. package/Workbenches/Source/Decorators/DecoratorsWorkbench.vue +69 -0
  47. package/Workbenches/Source/GUI_Components/AdmonitionBlock/AdmonitionBlockComponentTestSite.vue +9 -2
  48. package/Workbenches/Source/GUI_Components/Badge/BadgeBlockComponentTestSite.vue +9 -2
  49. package/Workbenches/Source/GUI_Components/Controls/Buttons/Plain/ButtonComponentTestSite.vue +19 -8
  50. package/Workbenches/Source/GUI_Components/Controls/Validatable/TextBox/TextBoxWorkbench.vue +45 -2
  51. package/Workbenches/Source/GUI_Components/Controls/ValidatableControlShell/ValidatableControlShellTestSite.vue +9 -2
  52. package/Workbenches/Source/GUI_Components/OverflowSafeSingleLineLabel/OverflowSafeSingleLineLabelComponentTestSite.vue +9 -2
  53. package/Workbenches/Source/Workbenches.pug +6 -0
  54. package/eslint.config.js +15 -0
  55. package/package.json +40 -48
  56. package/tsconfig.json +0 -3
  57. package/yda.config.yaml +1 -1
  58. package/Source/GUI_Components/AdmonitionBlock/AdmonitionBlock.vue.pug +0 -43
  59. package/Source/GUI_Components/Controls/Validatables/InputtableControl.ts +0 -134
  60. 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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.HTML_Types)
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({ validator: (value: unknown): boolean => isNonEmptyString(value) || isNumber(value) })
67
- protected readonly label?: string | number | null;
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({ validator: isNonEmptyString })
70
- protected readonly accessibilityGuidance?: string | null;
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({ validator: (value: unknown): boolean => isNonEmptyString(value) || isArbitraryObject(value) })
75
- protected readonly route?: VueRouterRawLocation | null;
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({ validator: isNonEmptyString })
78
- protected readonly externalURI?: string | null;
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({ type: Boolean, default: false })
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({ type: Boolean, default: false })
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({ type: Boolean, default: false })
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({ type: Boolean, default: false })
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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.Themes)
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({ type: Boolean, default: Button.areThemesCSS_ClassesCommon })
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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.GeometricVariations)
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
- type: Array,
139
- default: (): ReadonlyArray<string> => [],
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
- protected readonly geometricModifiers!: ReadonlyArray<Button.GeometricModifiers>;
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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.DecorativeVariations)
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
- type: Array,
170
- default: (): ReadonlyArray<string> => [],
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
- public created(): void {
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
- ...(this.isAnchorTheTagNameOfRootElement || this.isRouterLinkTheRootElement) && this.disabled ?
267
- [ `${ Button.CSS_NAMESPACE }__DisabledState` ] : [],
268
-
269
- ...YDF_ComponentsCoordinator.addThemeCSS_ClassToArrayIfMust({
270
- themeValue: this.theme,
271
- allThemes: Button.Themes,
272
- areThemesCSS_ClassesCommon: this.areThemesCSS_ClassesCommon,
273
- CSS_Namespace: Button.CSS_NAMESPACE
274
- }),
275
-
276
- ...YDF_ComponentsCoordinator.addGeometricVariationCSS_ClassToArrayIfMust({
277
- geometricVariation: this.geometricVariation,
278
- allGeometricVariations: Button.GeometricVariations,
279
- CSS_Namespace: Button.CSS_NAMESPACE
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
- ...YDF_ComponentsCoordinator.addDecorativeVariationCSS_ClassToArrayIfMust({
286
- decorativeVariation: this.decorativeVariation,
287
- allDecorativeVariations: Button.DecorativeVariations,
288
- CSS_Namespace: Button.CSS_NAMESPACE
289
- }),
384
+ /* ━━━ Properties Validation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
385
+ protected validateProperties(): void {
290
386
 
291
- ...YDF_ComponentsCoordinator.
292
- generateDemandedDecorativeModifiersCSS_Classes(Button.CSS_NAMESPACE, this.decorativeModifiers)
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 enum GeometricModifiers {
323
- pillShape = "PILL_SHAPE",
324
- squareShape = "SQUARE_SHAPE",
325
- squareShapeUnlessOverflowed = "SQUARE_SHAPE_UNLESS_OVERFLOWED",
326
- singleLine = "SINGLE_LINE",
327
- noLeftBorderAndRoundings = "NO_LEFT_BORDER_AND_ROUNDINGS",
328
- noRightBorderAndRoundings = "NO_RIGHT_BORDER_AND_ROUNDINGS",
329
- noTopBorderAndRoundings = "NO_TOP_BORDER_AND_ROUNDINGS",
330
- noBottomBorderAndRoundings = "NO_BOTTOM_BORDER_AND_ROUNDINGS",
331
- noRoundings = "NO_ROUNDINGS",
332
- horizontallyShrinkable = "HORIZONTALLY_SHRINKABLE"
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 enum DecorativeModifiers {
344
- bordersDisguising = "BORDERS_DISGUISING",
345
- noBackground = "NO_BACKGROUND",
346
- noBackgroundInDefaultState = "NO_BACKGROUND_IN_DEFAULT_STATE"
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--YDF-LoadingPlaceholder",
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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.Themes)
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: (rawValue: string): boolean => isElementOfEnumeration(rawValue, Button.GeometricVariations)
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<string> => [],
44
- validator: (rawValue: ReadonlyArray<unknown>): boolean =>
45
- rawValue.every(
46
- (element: unknown): boolean => isString(element) && isElementOfEnumeration(element, Button.GeometricModifiers)
47
- )
60
+ default: (): ReadonlyArray<Button.GeometricModifiers> => [],
61
+ validator: GeometricModifiersVuePropertyValidator({
62
+ GeometricModifiers: Button.GeometricModifiers,
63
+ CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
64
+ })
48
65
  })
49
- protected readonly geometricModifiers!: ReadonlyArray<Button.GeometricModifiers>;
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
- ...YDF_ComponentsCoordinator.addThemeCSS_ClassToArrayIfMust({
56
- themeValue: this.theme,
57
- allThemes: Button.Themes,
58
- areThemesCSS_ClassesCommon: this.areThemesCSS_ClassesCommon,
59
- CSS_Namespace: Button.CSS_NAMESPACE
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
  }
@@ -12,40 +12,53 @@
12
12
  :id="labelElementHTML_ID"
13
13
  ) {{ label }}
14
14
 
15
- span.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__RequiredInput(
15
+ Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Required(
16
16
  v-if="mustDisplayRequiredInputBadge"
17
- ) {{ localization.requirementBadges.required }}
17
+ :valueLabel="localization.requirementBadges.required"
18
+ :theme="badgeTheme"
19
+ :geometricVariation="badgeGeometricVariation"
20
+ :geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
21
+ :decorativeVariation="requiredInputBadgeDecorativeVariation"
22
+ )
18
23
 
19
- span.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__OptionalInput(
24
+ Badge.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Optional(
20
25
  v-else-if="mustDisplayOptionalInputBadge"
21
- ) {{ localization.requirementBadges.optional }}
26
+ :valueLabel="localization.requirementBadges.optional"
27
+ :theme="badgeTheme"
28
+ :geometricVariation="badgeGeometricVariation"
29
+ :geometricModifiers="[ Badge.GeometricModifiers.pillShape ]"
30
+ :decorativeVariation="optionalInputBadgeDecorativeVariation"
31
+ )
22
32
 
23
- span.ValidatableControlShell--YDF-Badge.ValidatableControlShell--YDF-Badge__Invisible(
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="guidance"
30
- v-html="guidance"
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
- ): slot
51
+ )
52
+ slot
37
53
 
38
54
 
39
- //-
40
- VerticallySlidingAlwaysMountedContainer.ValidatableControlShell--YDF-ValidationErrorsMessagesList(
41
- v-model="isDisplaying"
42
- expanded="invalidInputHighlightingIfAnyValidationErrorsMessages && validationErrorsMessagesCopyForAnimating.length > 0"
43
- HTML_Tag="ul"
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
- li.ValidatableControlShell--YDF-ValidationErrorMessage(
49
- v-for="validationErrorMessage of validationErrorsMessagesCopyForAnimating"
50
- key="`VALIDATION_ERROR_MESSAGE-${ validationErrorMessage }`"
51
- ) {{ validationErrorMessage }}
61
+ li.ValidatableControlShell--YDF-ValidationErrorsMessagesList-Item(
62
+ v-for="validationErrorMessage of validationErrorsMessagesCopyForAnimating"
63
+ :key="validationErrorMessage"
64
+ ) {{ validationErrorMessage }}