@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
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
|
-
import
|
|
2
|
+
import componentVueTemplate from "./Button.vue.pug";
|
|
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";
|
|
3
17
|
|
|
4
18
|
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
5
19
|
import {
|
|
@@ -7,31 +21,29 @@ import {
|
|
|
7
21
|
Vue as VueComponent,
|
|
8
22
|
Prop as VueProperty
|
|
9
23
|
} from "vue-facing-decorator";
|
|
10
|
-
|
|
11
24
|
import type { RouteLocationRaw as VueRouterRawLocation } from "vue-router";
|
|
12
25
|
|
|
13
26
|
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
14
|
-
import
|
|
15
|
-
import InvalidVuePropertiesCombinationError from
|
|
16
|
-
"../../../_Errors/InvalidVuePropertiesCombination/InvalidVuePropertiesCombinationError";
|
|
27
|
+
import YDF_ComponentsCoordinator from "../../../YDF_ComponentsCoordinator";
|
|
17
28
|
import {
|
|
18
29
|
Logger,
|
|
19
30
|
isNumber,
|
|
20
|
-
isString,
|
|
21
31
|
isNonEmptyString,
|
|
22
32
|
isEitherUndefinedOrNull,
|
|
23
33
|
isNeitherUndefinedNorNull,
|
|
24
|
-
|
|
34
|
+
isArbitraryObject,
|
|
35
|
+
emptyStringToNull,
|
|
36
|
+
type ElementOfPseudoEnumeration
|
|
25
37
|
} from "@yamato-daiwa/es-extensions";
|
|
26
|
-
import type { ElementOfPseudoEnumeration } from "@yamato-daiwa/es-extensions";
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
@VueComponentConfiguration({
|
|
30
41
|
name: Button.CSS_NAMESPACE,
|
|
31
|
-
template:
|
|
42
|
+
template: componentVueTemplate
|
|
32
43
|
})
|
|
33
44
|
class Button extends VueComponent {
|
|
34
45
|
|
|
46
|
+
/* ━━━ Static Fields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
35
47
|
public static CSS_NAMESPACE: string = "Button--YDF";
|
|
36
48
|
|
|
37
49
|
public static HTML_Types: Button.HTML_Types = {
|
|
@@ -42,34 +54,138 @@ class Button extends VueComponent {
|
|
|
42
54
|
inputReset: "INPUT_RESET"
|
|
43
55
|
};
|
|
44
56
|
|
|
57
|
+
|
|
58
|
+
/* ━━━ Non-reactive Instance Fields ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
45
59
|
protected IS_NUXT!: boolean;
|
|
46
60
|
|
|
61
|
+
private initializeNonReactiveClassFields(): void {
|
|
62
|
+
this.IS_NUXT = "$nuxt" in window;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/* ━━━ Common Properties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
47
67
|
@VueProperty({
|
|
48
|
-
type: String,
|
|
49
68
|
default: Button.HTML_Types.regular,
|
|
50
|
-
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
|
+
}
|
|
51
78
|
})
|
|
79
|
+
@preventNullForOptionalVueProperty
|
|
52
80
|
protected readonly HTML_Type!: ElementOfPseudoEnumeration<Button.HTML_Types>;
|
|
53
81
|
|
|
54
|
-
@VueProperty({ type: String })
|
|
55
|
-
protected readonly label?: string | number | null;
|
|
56
82
|
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
/* ─── Textings ─────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
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;
|
|
59
96
|
|
|
60
|
-
@VueProperty({
|
|
61
|
-
|
|
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;
|
|
62
109
|
|
|
63
|
-
@VueProperty({ type: String })
|
|
64
|
-
protected readonly externalURI?: string | null;
|
|
65
110
|
|
|
66
|
-
|
|
67
|
-
|
|
111
|
+
/* ─── Links ────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
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;
|
|
68
123
|
|
|
69
|
-
@VueProperty({
|
|
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;
|
|
136
|
+
|
|
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
|
|
148
|
+
protected readonly mustOpenLinkInNewTab!: boolean;
|
|
149
|
+
|
|
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
|
|
161
|
+
protected readonly mustRequestNotFollowLinkForCrawlingToSearchEngine!: boolean;
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
/* ─── Status ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
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
|
|
70
176
|
protected readonly disabled!: boolean;
|
|
71
177
|
|
|
72
|
-
@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
|
|
73
189
|
protected readonly toggled!: boolean;
|
|
74
190
|
|
|
75
191
|
|
|
@@ -77,24 +193,33 @@ class Button extends VueComponent {
|
|
|
77
193
|
public static readonly Themes: Button.Themes = { regular: "REGULAR" };
|
|
78
194
|
|
|
79
195
|
@VueProperty({
|
|
80
|
-
type: String,
|
|
81
196
|
default: Button.Themes.regular,
|
|
82
|
-
validator: (
|
|
197
|
+
validator: ThemeVuePropertyValidator(Button)
|
|
83
198
|
})
|
|
199
|
+
@preventNullForOptionalVueProperty
|
|
84
200
|
protected readonly theme!: string;
|
|
85
201
|
|
|
86
202
|
public static defineThemes(themesNames: ReadonlyArray<string>): typeof Button {
|
|
87
|
-
return
|
|
203
|
+
return YDF_ComponentsCoordinator.defineThemes(themesNames, Button);
|
|
88
204
|
}
|
|
89
205
|
|
|
90
|
-
public static areThemesCSS_ClassesCommon: boolean =
|
|
206
|
+
public static areThemesCSS_ClassesCommon: boolean = YDF_ComponentsCoordinator.areThemesCSS_ClassesCommon;
|
|
91
207
|
|
|
92
|
-
public static considerThemesAsCommon():
|
|
208
|
+
public static considerThemesAsCommon(): void {
|
|
93
209
|
Button.areThemesCSS_ClassesCommon = true;
|
|
94
|
-
return Button;
|
|
95
210
|
}
|
|
96
211
|
|
|
97
|
-
@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
|
|
98
223
|
private readonly areThemesCSS_ClassesCommon!: boolean;
|
|
99
224
|
|
|
100
225
|
|
|
@@ -106,82 +231,77 @@ class Button extends VueComponent {
|
|
|
106
231
|
};
|
|
107
232
|
|
|
108
233
|
@VueProperty({
|
|
109
|
-
type: String,
|
|
110
234
|
default: Button.GeometricVariations.regular,
|
|
111
|
-
validator: (
|
|
235
|
+
validator: GeometricVariationVuePropertyValidator(Button)
|
|
112
236
|
})
|
|
237
|
+
@preventNullForOptionalVueProperty
|
|
113
238
|
protected readonly geometricVariation!: string;
|
|
114
239
|
|
|
115
240
|
public static defineGeometricVariations(geometricVariationsNames: ReadonlyArray<string>): typeof Button {
|
|
116
|
-
return
|
|
241
|
+
return YDF_ComponentsCoordinator.defineGeometricVariations(geometricVariationsNames, Button);
|
|
117
242
|
}
|
|
118
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
|
+
|
|
119
257
|
@VueProperty({
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
validator: (rawValue: ReadonlyArray<unknown>): boolean =>
|
|
123
|
-
rawValue.every(
|
|
124
|
-
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, Button.GeometricModifiers)
|
|
125
|
-
)
|
|
258
|
+
default: (): ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>> => [],
|
|
259
|
+
validator: GeometricModifiersVuePropertyValidator(Button)
|
|
126
260
|
})
|
|
127
|
-
|
|
261
|
+
@preventNullForOptionalVueProperty
|
|
262
|
+
protected readonly geometricModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>>;
|
|
128
263
|
|
|
129
264
|
|
|
130
265
|
/* ─── Decoration ───────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
131
266
|
public static readonly DecorativeVariations: Button.DecorativeVariations = {
|
|
132
267
|
regular: "REGULAR",
|
|
133
268
|
accented: "ACCENTED",
|
|
269
|
+
danger: "DANGER",
|
|
134
270
|
linkLike: "LINK_LIKE"
|
|
135
271
|
};
|
|
136
272
|
|
|
137
273
|
@VueProperty({
|
|
138
|
-
type: String,
|
|
139
274
|
default: Button.DecorativeVariations.regular,
|
|
140
|
-
validator: (
|
|
275
|
+
validator: DecorativeVariationVuePropertyValidator(Button)
|
|
141
276
|
})
|
|
277
|
+
@preventNullForOptionalVueProperty
|
|
142
278
|
protected readonly decorativeVariation!: string;
|
|
143
279
|
|
|
144
280
|
public static defineDecorativeVariations(decorativeVariationsNames: ReadonlyArray<string>): typeof Button {
|
|
145
|
-
return
|
|
281
|
+
return YDF_ComponentsCoordinator.defineDecorativeVariations(decorativeVariationsNames, Button);
|
|
146
282
|
}
|
|
147
283
|
|
|
284
|
+
public static readonly DecorativeModifiers: Button.DecorativeModifiers = {
|
|
285
|
+
bordersDisguising: "BORDERS_DISGUISING",
|
|
286
|
+
noBackground: "NO_BACKGROUND",
|
|
287
|
+
noBackgroundInDefaultState: "NO_BACKGROUND_IN_DEFAULT_STATE"
|
|
288
|
+
};
|
|
148
289
|
|
|
149
290
|
@VueProperty({
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
validator: (rawValue: ReadonlyArray<unknown>): boolean =>
|
|
153
|
-
rawValue.every(
|
|
154
|
-
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, Button.DecorativeModifiers)
|
|
155
|
-
)
|
|
291
|
+
default: (): ReadonlyArray<ElementOfPseudoEnumeration<Button.DecorativeModifiers>> => [],
|
|
292
|
+
validator: DecorativeModifiersVuePropertyValidator(Button)
|
|
156
293
|
})
|
|
157
|
-
protected readonly decorativeModifiers!: ReadonlyArray<Button.DecorativeModifiers
|
|
294
|
+
protected readonly decorativeModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.DecorativeModifiers>>;
|
|
158
295
|
|
|
159
296
|
|
|
160
297
|
/* ━━━ Lifecycle Hooks ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (
|
|
164
|
-
(!isNonEmptyString(this.label) && isNumber(this.label)) &&
|
|
165
|
-
(
|
|
166
|
-
this.HTML_Type === Button.HTML_Types.inputButton ||
|
|
167
|
-
this.HTML_Type === Button.HTML_Types.inputSubmit ||
|
|
168
|
-
this.HTML_Type === Button.HTML_Types.inputReset
|
|
169
|
-
)
|
|
170
|
-
) {
|
|
171
|
-
Logger.throwErrorAndLog({
|
|
172
|
-
errorInstance: new InvalidVuePropertiesCombinationError({
|
|
173
|
-
vueComponentName: Button.name,
|
|
174
|
-
messageSpecificPart:
|
|
175
|
-
"When button has HTML type \"inputButton\", \"inputSubmit\" or \"inputReset\", the \"label\" property " +
|
|
176
|
-
"must be specified with non-empty string of number."
|
|
177
|
-
}),
|
|
178
|
-
title: InvalidVuePropertiesCombinationError.localization.defaultTitle,
|
|
179
|
-
occurrenceLocation: `${ Button.name }.created()`
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
|
|
298
|
+
protected created(): void {
|
|
183
299
|
this.initializeNonReactiveClassFields();
|
|
300
|
+
this.validateProperties();
|
|
301
|
+
}
|
|
184
302
|
|
|
303
|
+
protected beforeUpdate(): void {
|
|
304
|
+
this.validateProperties();
|
|
185
305
|
}
|
|
186
306
|
|
|
187
307
|
|
|
@@ -230,45 +350,60 @@ class Button extends VueComponent {
|
|
|
230
350
|
|
|
231
351
|
}
|
|
232
352
|
|
|
353
|
+
protected get relAttributeValueOfAnchorElement(): string | null {
|
|
354
|
+
return emptyStringToNull(
|
|
355
|
+
[
|
|
356
|
+
...this.mustOpenLinkInNewTab ? [ "noopener", "noreferrer" ] : [],
|
|
357
|
+
...this.mustRequestNotFollowLinkForCrawlingToSearchEngine ? [ "nofollow" ] : []
|
|
358
|
+
].join(" ")
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
233
362
|
|
|
234
363
|
/* ━━━ CSS Classes ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
235
364
|
protected get rootElementModifierCSS_Classes(): ReadonlyArray<string> {
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
...ComponentsAuxiliaries.
|
|
255
|
-
generateDemandedGeometricModifiersCSS_Classes(Button.CSS_NAMESPACE, this.geometricModifiers),
|
|
256
|
-
|
|
257
|
-
...ComponentsAuxiliaries.addDecorativeVariationCSS_ClassToArrayIfMust({
|
|
258
|
-
decorativeVariation: this.decorativeVariation,
|
|
259
|
-
allDecorativeVariations: Button.DecorativeVariations,
|
|
260
|
-
CSS_Namespace: Button.CSS_NAMESPACE
|
|
261
|
-
}),
|
|
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
|
+
}
|
|
262
382
|
|
|
263
|
-
...ComponentsAuxiliaries.
|
|
264
|
-
generateDemandedDecorativeModifiersCSS_Classes(Button.CSS_NAMESPACE, this.decorativeModifiers)
|
|
265
383
|
|
|
266
|
-
|
|
267
|
-
|
|
384
|
+
/* ━━━ Properties Validation ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
385
|
+
protected validateProperties(): void {
|
|
268
386
|
|
|
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
|
+
}
|
|
269
406
|
|
|
270
|
-
private initializeNonReactiveClassFields(): void {
|
|
271
|
-
this.IS_NUXT = "$nuxt" in window;
|
|
272
407
|
}
|
|
273
408
|
|
|
274
409
|
}
|
|
@@ -296,26 +431,32 @@ namespace Button {
|
|
|
296
431
|
[variationName: string]: string;
|
|
297
432
|
};
|
|
298
433
|
|
|
299
|
-
export
|
|
300
|
-
pillShape
|
|
301
|
-
squareShape
|
|
302
|
-
squareShapeUnlessOverflowed
|
|
303
|
-
singleLine
|
|
304
|
-
noLeftBorderAndRoundings
|
|
305
|
-
noRightBorderAndRoundings
|
|
306
|
-
|
|
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
|
+
}>;
|
|
307
446
|
|
|
308
447
|
export type DecorativeVariations = {
|
|
309
448
|
readonly regular: "REGULAR";
|
|
310
449
|
readonly accented: "ACCENTED";
|
|
450
|
+
readonly danger: "DANGER";
|
|
311
451
|
readonly linkLike: "LINK_LIKE";
|
|
312
452
|
[variationName: string]: string;
|
|
313
453
|
};
|
|
314
454
|
|
|
315
|
-
export
|
|
316
|
-
bordersDisguising
|
|
317
|
-
noBackground
|
|
318
|
-
|
|
455
|
+
export type DecorativeModifiers = Readonly<{
|
|
456
|
+
bordersDisguising: "BORDERS_DISGUISING";
|
|
457
|
+
noBackground: "NO_BACKGROUND";
|
|
458
|
+
noBackgroundInDefaultState: "NO_BACKGROUND_IN_DEFAULT_STATE";
|
|
459
|
+
}>;
|
|
319
460
|
|
|
320
461
|
}
|
|
321
462
|
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* ─── Assets ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
|
+
import componentVueTemplate from "./Button-LoadingPlaceholder.vue.pug";
|
|
3
|
+
|
|
4
|
+
/* ─── GUI Components ─────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
2
5
|
import Button from "../Button.vue";
|
|
3
|
-
|
|
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";
|
|
4
12
|
|
|
5
13
|
/* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
6
14
|
import {
|
|
@@ -10,64 +18,65 @@ import {
|
|
|
10
18
|
} from "vue-facing-decorator";
|
|
11
19
|
|
|
12
20
|
/* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
13
|
-
import
|
|
14
|
-
import
|
|
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--
|
|
19
|
-
template:
|
|
26
|
+
name: "Button--YDF__LoadingPlaceholder",
|
|
27
|
+
template: componentVueTemplate
|
|
20
28
|
})
|
|
21
29
|
export default class ButtonLoadingPlaceholder extends VueComponent {
|
|
22
30
|
|
|
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
|
|
|
46
|
+
|
|
33
47
|
@VueProperty({
|
|
34
48
|
type: String,
|
|
35
49
|
default: Button.GeometricVariations.regular,
|
|
36
|
-
validator: (
|
|
50
|
+
validator: GeometricVariationVuePropertyValidator({
|
|
51
|
+
GeometricVariations: Button.GeometricVariations,
|
|
52
|
+
CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
|
|
53
|
+
})
|
|
37
54
|
})
|
|
38
|
-
|
|
55
|
+
@preventNullForOptionalVueProperty
|
|
56
|
+
protected readonly geometricVariation!: string;
|
|
39
57
|
|
|
40
58
|
@VueProperty({
|
|
41
59
|
type: Array,
|
|
42
|
-
default: (): ReadonlyArray<
|
|
43
|
-
validator: (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
default: (): ReadonlyArray<Button.GeometricModifiers> => [],
|
|
61
|
+
validator: GeometricModifiersVuePropertyValidator({
|
|
62
|
+
GeometricModifiers: Button.GeometricModifiers,
|
|
63
|
+
CSS_NAMESPACE: "Button--YDF__LoadingPlaceholder"
|
|
64
|
+
})
|
|
47
65
|
})
|
|
48
|
-
|
|
66
|
+
@preventNullForOptionalVueProperty
|
|
67
|
+
protected readonly geometricModifiers!: ReadonlyArray<ElementOfPseudoEnumeration<Button.GeometricModifiers>>;
|
|
49
68
|
|
|
50
69
|
|
|
51
70
|
protected get rootElementModifierCSS_Classes(): ReadonlyArray<string> {
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
...ComponentsAuxiliaries.addGeometricVariationCSS_ClassToArrayIfMust({
|
|
62
|
-
geometricVariation: this.geometry,
|
|
63
|
-
allGeometricVariations: Button.GeometricVariations,
|
|
64
|
-
CSS_Namespace: Button.CSS_NAMESPACE
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
...ComponentsAuxiliaries.
|
|
68
|
-
generateDemandedGeometricModifiersCSS_Classes(Button.CSS_NAMESPACE, this.geometricModifiers)
|
|
69
|
-
|
|
70
|
-
];
|
|
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
|
+
});
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
}
|