@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* eslint no-underscore-dangle: [ "warn", { "allow": [ "_nonReactiveStaticFields__YDF"] } ] --
|
|
2
|
+
* According Vue guidelines, the private properties should be underscored. */
|
|
3
|
+
|
|
4
|
+
import { type ArbitraryObject } from "@yamato-daiwa/es-extensions";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
type Constructor = {
|
|
8
|
+
prototype: Prototype;
|
|
9
|
+
_nonReactiveStaticFields__YDF?: Array<string>;
|
|
10
|
+
[newProperties: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Prototype = {
|
|
14
|
+
created?: () => unknown;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const AccessibleFromTemplateAsNonReactive: PropertyDecorator = (target: object, propertyKey: string | symbol): void => {
|
|
19
|
+
|
|
20
|
+
if (typeof target !== "function") {
|
|
21
|
+
throw new Error("@exposeForTemplateAsNonReactive can only be applied to static fields.");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if (typeof propertyKey === "symbol") {
|
|
26
|
+
throw new Error("@exposeForTemplateAsNonReactive does not support symbol-type properties.");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- ※
|
|
31
|
+
* Although the `target` is a function, no need to call in here. Cast it to еру indexable type for accessing to static
|
|
32
|
+
* properties. */
|
|
33
|
+
const constructor: Constructor = target as unknown as Constructor;
|
|
34
|
+
|
|
35
|
+
let hasCreatedLifecycleHookBeenPatched: boolean;
|
|
36
|
+
|
|
37
|
+
if (Array.isArray(constructor._nonReactiveStaticFields__YDF)) {
|
|
38
|
+
hasCreatedLifecycleHookBeenPatched = true;
|
|
39
|
+
constructor._nonReactiveStaticFields__YDF.push(propertyKey);
|
|
40
|
+
} else {
|
|
41
|
+
constructor._nonReactiveStaticFields__YDF = [ propertyKey ];
|
|
42
|
+
hasCreatedLifecycleHookBeenPatched = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!hasCreatedLifecycleHookBeenPatched) {
|
|
46
|
+
|
|
47
|
+
const prototype: Prototype = constructor.prototype;
|
|
48
|
+
const originalCreatedMethod: (() => unknown) | undefined = prototype.created;
|
|
49
|
+
|
|
50
|
+
prototype.created = function patchCheatedHook(): void {
|
|
51
|
+
|
|
52
|
+
originalCreatedMethod?.call(this);
|
|
53
|
+
|
|
54
|
+
for (const key of constructor._nonReactiveStaticFields__YDF ?? []) {
|
|
55
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
|
|
56
|
+
* It is possible to assign the new properties to prototype. */
|
|
57
|
+
(this as ArbitraryObject)[key] = constructor[key];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
export default AccessibleFromTemplateAsNonReactive;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createDecorator } from "vue-facing-decorator";
|
|
2
|
+
import type { ComponentOptions } from "vue";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function NonReactiveVueData(
|
|
6
|
+
value: unknown
|
|
7
|
+
): (_arguments: unknown, decoratorContext: string | DecoratorContext) => void {
|
|
8
|
+
return createDecorator(
|
|
9
|
+
(componentOptions: ComponentOptions, key: string): void => {
|
|
10
|
+
|
|
11
|
+
/* eslint-disable-next-line @typescript-eslint/unbound-method --
|
|
12
|
+
* The binding of the correct context will be executed inside the `patchCheatedHook` function. */
|
|
13
|
+
const originalCreatedHook: (() => unknown) | undefined = componentOptions.created;
|
|
14
|
+
|
|
15
|
+
componentOptions.created = function patchCheatedHook(): void {
|
|
16
|
+
|
|
17
|
+
originalCreatedHook?.call(this);
|
|
18
|
+
|
|
19
|
+
this[key] = value;
|
|
20
|
+
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
},
|
|
24
|
+
{ preserve: true }
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -5,11 +5,10 @@ import ForbiddenNullValueOfOptionalVuePropertyError from
|
|
|
5
5
|
"../_Errors/ForbiddenNullValueOfOptionalVueProperty/ForbiddenNullValueOfOptionalVuePropertyError";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const preventNullForOptionalVueProperty: (_arguments: unknown, decoratorContext: string | DecoratorContext) => void =
|
|
9
9
|
createDecorator(
|
|
10
10
|
(componentOptions: ComponentOptions, key: string): void => {
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
/* eslint-disable no-underscore-dangle -- [ CONVENTION ]
|
|
14
13
|
* Vue uses the `_` prefix to define its own private properties. */
|
|
15
14
|
if (isUndefined(componentOptions._nonNullOptionalProperties__YDF)) {
|
|
@@ -43,7 +42,7 @@ function patchLifecycleHook(
|
|
|
43
42
|
|
|
44
43
|
for (const nonNullOptionalProperty of nonNullOptionalProperties) {
|
|
45
44
|
if (this[nonNullOptionalProperty] === null) {
|
|
46
|
-
Logger.
|
|
45
|
+
Logger.throwErrorWithFormattedMessage({
|
|
47
46
|
errorInstance: new ForbiddenNullValueOfOptionalVuePropertyError({
|
|
48
47
|
targetComponentName: componentOptions.name,
|
|
49
48
|
targetPropertyName: nonNullOptionalProperty
|
|
@@ -62,4 +61,4 @@ function patchLifecycleHook(
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
|
|
65
|
-
export default
|
|
64
|
+
export default preventNullForOptionalVueProperty;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import invalidVuePropertyErrorLocalization__english from "./InvalidVuePropertyErrorLocalization.english";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class InvalidVuePropertyError extends Error {
|
|
5
|
+
|
|
6
|
+
public static readonly NAME: string = "InvalidVuePropertyError";
|
|
7
|
+
|
|
8
|
+
public static localization: InvalidVuePropertyError.Localization = invalidVuePropertyErrorLocalization__english;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
public constructor(compoundParameter: InvalidVuePropertyError.ConstructorParameter) {
|
|
12
|
+
|
|
13
|
+
super();
|
|
14
|
+
|
|
15
|
+
this.name = InvalidVuePropertyError.NAME;
|
|
16
|
+
this.message = InvalidVuePropertyError.localization.generateDescription(compoundParameter);
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
namespace InvalidVuePropertyError {
|
|
24
|
+
|
|
25
|
+
export type ConstructorParameter = Localization.DescriptionTemplateVariables;
|
|
26
|
+
|
|
27
|
+
export type Localization = Readonly<{
|
|
28
|
+
defaultTitle: string;
|
|
29
|
+
generateDescription: (templateVariables: Localization.DescriptionTemplateVariables) => string;
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export namespace Localization {
|
|
33
|
+
export type DescriptionTemplateVariables = Readonly<{
|
|
34
|
+
componentName: string;
|
|
35
|
+
propertyName: string;
|
|
36
|
+
messageSpecificPart: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export default InvalidVuePropertyError;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type InvalidVuePropertyError from "./InvalidVuePropertyError";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const invalidVuePropertyErrorLocalization__english: InvalidVuePropertyError.Localization = {
|
|
5
|
+
defaultTitle: "Invalid Vue Property",
|
|
6
|
+
generateDescription: (
|
|
7
|
+
{
|
|
8
|
+
propertyName,
|
|
9
|
+
componentName,
|
|
10
|
+
messageSpecificPart
|
|
11
|
+
}: InvalidVuePropertyError.Localization.DescriptionTemplateVariables
|
|
12
|
+
): string => `Invalid Vue property "${ propertyName }"of "${ componentName }" Vue component.\n${ messageSpecificPart }`
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default invalidVuePropertyErrorLocalization__english;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isBoolean } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function BooleanVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
componentName,
|
|
8
|
+
propertyName,
|
|
9
|
+
isPropertyRequired
|
|
10
|
+
}: Readonly<{
|
|
11
|
+
componentName: string;
|
|
12
|
+
propertyName: string;
|
|
13
|
+
isPropertyRequired: boolean;
|
|
14
|
+
}>
|
|
15
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
16
|
+
return VuePropertyValidator.create({
|
|
17
|
+
checker: isBoolean,
|
|
18
|
+
messageSpecificPart:
|
|
19
|
+
isPropertyRequired ?
|
|
20
|
+
"Must be the boolean." :
|
|
21
|
+
"Must be either boolean or undefined (explicit or omitted).",
|
|
22
|
+
propertyName,
|
|
23
|
+
componentName
|
|
24
|
+
});
|
|
25
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/DecorativeModifiersVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function DecorativeModifiersVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
DecorativeModifiers,
|
|
8
|
+
CSS_NAMESPACE: componentName
|
|
9
|
+
}: Readonly<{
|
|
10
|
+
DecorativeModifiers: Readonly<{ [key: string]: string; }>;
|
|
11
|
+
CSS_NAMESPACE: string;
|
|
12
|
+
}>
|
|
13
|
+
): (targetVueProperty: unknown) => boolean {
|
|
14
|
+
return VuePropertyValidator.create({
|
|
15
|
+
checker: (rawValue: unknown): boolean => Array.isArray(rawValue) && rawValue.every(
|
|
16
|
+
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, DecorativeModifiers)
|
|
17
|
+
),
|
|
18
|
+
messageSpecificPart: `Each array element must the member of \`${ componentName }.DecorativeModifiers\` enumeration.`,
|
|
19
|
+
propertyName: "decorativeModifiers",
|
|
20
|
+
componentName
|
|
21
|
+
});
|
|
22
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/DecorativeVariationVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function DecorativeVariationVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
DecorativeVariations,
|
|
8
|
+
CSS_NAMESPACE: componentName
|
|
9
|
+
}: Readonly<{
|
|
10
|
+
DecorativeVariations: Readonly<{ [key: string]: string; }>;
|
|
11
|
+
CSS_NAMESPACE: string;
|
|
12
|
+
}>
|
|
13
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
14
|
+
return VuePropertyValidator.create({
|
|
15
|
+
checker: (rawValue: Exclude<unknown, undefined>): boolean =>
|
|
16
|
+
isString(rawValue) && isElementOfEnumeration(rawValue, DecorativeVariations),
|
|
17
|
+
messageSpecificPart:
|
|
18
|
+
`Must be the string herewith one among values of \`${ componentName }.DecorativeVariations\` associative array ` +
|
|
19
|
+
`including the ones defined via \`${ componentName }.defineDecorativeVariations()\`.`,
|
|
20
|
+
propertyName: "decorativeVariation",
|
|
21
|
+
componentName
|
|
22
|
+
});
|
|
23
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/ElementOfEnumerationVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function ElementOfEnumerationVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
componentName,
|
|
8
|
+
propertyName,
|
|
9
|
+
enumeration,
|
|
10
|
+
isPropertyRequired,
|
|
11
|
+
enumerationFullyQualifiedName
|
|
12
|
+
}: Readonly<{
|
|
13
|
+
componentName: string;
|
|
14
|
+
propertyName: string;
|
|
15
|
+
isPropertyRequired: boolean;
|
|
16
|
+
enumeration: Readonly<{ [key: string]: string | number; }>;
|
|
17
|
+
enumerationFullyQualifiedName: string;
|
|
18
|
+
}>
|
|
19
|
+
): (targetVueProperty: unknown) => boolean {
|
|
20
|
+
return VuePropertyValidator.create({
|
|
21
|
+
checker: (rawValue: unknown): boolean => isString(rawValue) && isElementOfEnumeration(rawValue, enumeration),
|
|
22
|
+
messageSpecificPart:
|
|
23
|
+
isPropertyRequired ?
|
|
24
|
+
`Must the an element of "${ enumerationFullyQualifiedName }" enumeration.` :
|
|
25
|
+
`Must be either element of "${ enumerationFullyQualifiedName }" enumeration of undefined (explicit or omitted).`,
|
|
26
|
+
propertyName,
|
|
27
|
+
componentName
|
|
28
|
+
});
|
|
29
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/GeometricModifiersVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function GeometricModifiersVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
GeometricModifiers,
|
|
8
|
+
CSS_NAMESPACE: componentName
|
|
9
|
+
}: Readonly<{
|
|
10
|
+
GeometricModifiers: Readonly<{ [key: string]: string; }>;
|
|
11
|
+
CSS_NAMESPACE: string;
|
|
12
|
+
}>
|
|
13
|
+
): (targetVueProperty: unknown) => boolean {
|
|
14
|
+
return VuePropertyValidator.create({
|
|
15
|
+
checker: (rawValue: unknown): boolean => Array.isArray(rawValue) && rawValue.every(
|
|
16
|
+
(element: unknown): boolean => isString(element) && isElementOfEnumeration(element, GeometricModifiers)
|
|
17
|
+
),
|
|
18
|
+
messageSpecificPart: `Each array element must the member of \`${ componentName }.GeometricModifiers\` enumeration.`,
|
|
19
|
+
propertyName: "geometricModifiers",
|
|
20
|
+
componentName
|
|
21
|
+
});
|
|
22
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/GeometricVariationVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function GeometricVariationVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
GeometricVariations,
|
|
8
|
+
CSS_NAMESPACE: componentName
|
|
9
|
+
}: Readonly<{
|
|
10
|
+
GeometricVariations: Readonly<{ [key: string]: string; }>;
|
|
11
|
+
CSS_NAMESPACE: string;
|
|
12
|
+
}>
|
|
13
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
14
|
+
return VuePropertyValidator.create({
|
|
15
|
+
checker: (rawValue: Exclude<unknown, undefined>): boolean =>
|
|
16
|
+
isString(rawValue) && isElementOfEnumeration(rawValue, GeometricVariations),
|
|
17
|
+
messageSpecificPart:
|
|
18
|
+
`Must be the string herewith one among values of \`${ componentName }.GeometricVariations\` associative array ` +
|
|
19
|
+
` including the ones defined via \`${ componentName }.defineGeometricVariations()\`.`,
|
|
20
|
+
propertyName: "geometricVariation",
|
|
21
|
+
componentName
|
|
22
|
+
});
|
|
23
|
+
}
|
package/Source/GUI_Components/_VuePropertiesValidators/NaturalNumberOrZeroVuePropertyValidator.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isNaturalNumberOrZero } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function NaturalNumberOrZeroVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
componentName,
|
|
8
|
+
propertyName,
|
|
9
|
+
isPropertyRequired
|
|
10
|
+
}: Readonly<{
|
|
11
|
+
componentName: string;
|
|
12
|
+
propertyName: string;
|
|
13
|
+
isPropertyRequired: boolean;
|
|
14
|
+
}>
|
|
15
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
16
|
+
return VuePropertyValidator.create({
|
|
17
|
+
checker: isNaturalNumberOrZero,
|
|
18
|
+
messageSpecificPart:
|
|
19
|
+
isPropertyRequired ?
|
|
20
|
+
"Must be the 0 or natural number." :
|
|
21
|
+
"Must be 0, natural number or undefined (explicit or omitted).",
|
|
22
|
+
propertyName,
|
|
23
|
+
componentName
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isNonEmptyString } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function NonEmptyStringVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
componentName,
|
|
8
|
+
propertyName,
|
|
9
|
+
isPropertyRequired
|
|
10
|
+
}: Readonly<{
|
|
11
|
+
componentName: string;
|
|
12
|
+
propertyName: string;
|
|
13
|
+
isPropertyRequired: boolean;
|
|
14
|
+
}>
|
|
15
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
16
|
+
return VuePropertyValidator.create({
|
|
17
|
+
checker: isNonEmptyString,
|
|
18
|
+
messageSpecificPart:
|
|
19
|
+
isPropertyRequired ?
|
|
20
|
+
"Must be the non-empty string." :
|
|
21
|
+
"Must be either non-empty string or undefined (explicit or omitted).",
|
|
22
|
+
propertyName,
|
|
23
|
+
componentName
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import VuePropertyValidator from "./VuePropertyValidator";
|
|
2
|
+
import { isString, isElementOfEnumeration } from "@yamato-daiwa/es-extensions";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default function ThemeVuePropertyValidator(
|
|
6
|
+
{
|
|
7
|
+
Themes,
|
|
8
|
+
CSS_NAMESPACE: componentName
|
|
9
|
+
}: Readonly<{
|
|
10
|
+
Themes: Readonly<{ [key: string]: string; }>;
|
|
11
|
+
CSS_NAMESPACE: string;
|
|
12
|
+
}>
|
|
13
|
+
): (targetVueProperty: Exclude<unknown, undefined>) => boolean {
|
|
14
|
+
return VuePropertyValidator.create({
|
|
15
|
+
checker: (rawValue: Exclude<unknown, undefined>): boolean =>
|
|
16
|
+
isString(rawValue) && isElementOfEnumeration(rawValue, Themes),
|
|
17
|
+
messageSpecificPart:
|
|
18
|
+
`Must be the string herewith one among values of \`${ componentName }.Themes\` associative array including ` +
|
|
19
|
+
`the ones defined via \`${ componentName }.defineThemes()\`.`,
|
|
20
|
+
propertyName: "theme",
|
|
21
|
+
componentName
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Logger } from "@yamato-daiwa/es-extensions";
|
|
2
|
+
import InvalidVuePropertyError from "../_Errors/InvalidVueProperty/InvalidVuePropertyError";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
type VuePropertyValidator = (value: Exclude<unknown, undefined>) => boolean;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
namespace VuePropertyValidator {
|
|
9
|
+
|
|
10
|
+
export function create(
|
|
11
|
+
{
|
|
12
|
+
checker,
|
|
13
|
+
componentName,
|
|
14
|
+
propertyName,
|
|
15
|
+
messageSpecificPart
|
|
16
|
+
}: Readonly<{
|
|
17
|
+
checker: (targetVueProperty: Exclude<unknown, undefined>) => boolean;
|
|
18
|
+
componentName: string;
|
|
19
|
+
propertyName: string;
|
|
20
|
+
messageSpecificPart: string;
|
|
21
|
+
}>
|
|
22
|
+
): VuePropertyValidator {
|
|
23
|
+
return (targetVueProperty: Exclude<unknown, undefined>): boolean => {
|
|
24
|
+
|
|
25
|
+
if (!checker(targetVueProperty)) {
|
|
26
|
+
|
|
27
|
+
Logger.logError({
|
|
28
|
+
errorType: InvalidVuePropertyError.NAME,
|
|
29
|
+
title: InvalidVuePropertyError.localization.defaultTitle,
|
|
30
|
+
description: InvalidVuePropertyError.localization.generateDescription({
|
|
31
|
+
componentName,
|
|
32
|
+
propertyName,
|
|
33
|
+
messageSpecificPart
|
|
34
|
+
}),
|
|
35
|
+
occurrenceLocation: "VuePropertyValidator"
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export default VuePropertyValidator;
|
package/Source/index.ts
CHANGED
|
@@ -2,27 +2,43 @@ export { default as YDF_ComponentsCoordinator } from "./GUI_Components/YDF_Compo
|
|
|
2
2
|
|
|
3
3
|
/* ━━━ Officially Realized ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
4
4
|
/* ━━━ GUI Components ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
5
|
+
/* ╍╍╍ Admonition Block ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ */
|
|
6
|
+
export { default as AdmonitionBlockLogic } from "./GUI_Components/AdmonitionBlock/AdmonitionBlockLogic.vue";
|
|
5
7
|
export { default as AdmonitionBlock } from "./GUI_Components/AdmonitionBlock/AdmonitionBlock.vue";
|
|
6
8
|
|
|
9
|
+
// ━━━ TODO ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
7
10
|
export { default as Badge } from "./GUI_Components/Badge/Badge.vue";
|
|
8
11
|
export { default as BadgeLoadingPlaceholder } from "./GUI_Components/Badge/LoadingPlaceholder/Badge-LoadingPlaceholder.vue";
|
|
9
12
|
|
|
10
|
-
/*
|
|
11
|
-
|
|
13
|
+
/* ┅┅┅ Controls ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ */
|
|
14
|
+
export { default as ValidatableControlShell } from
|
|
15
|
+
"./GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue";
|
|
16
|
+
|
|
17
|
+
/* ╍╍╍ Buttons ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ */
|
|
12
18
|
export { default as Button } from "./GUI_Components/Controls/Buttons/Plain/Button.vue";
|
|
13
19
|
export { default as ButtonLoadingPlaceholder } from
|
|
14
20
|
"./GUI_Components/Controls/Buttons/Plain/LoadingPlaceholder/Button-LoadingPlaceholder.vue";
|
|
15
21
|
|
|
22
|
+
export { default as HamburgerMenuButton } from "./GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton.vue";
|
|
23
|
+
export { default as HamburgerMenuButtonLogic } from
|
|
24
|
+
"./GUI_Components/Controls/Buttons/HamburgerMenu/HamburgerMenuButton-ForInheritance.vue";
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
/* ┄┄┄ Validatable Control Shell ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ */
|
|
19
|
-
export { default as ValidatableControlShell } from
|
|
20
|
-
"./GUI_Components/Controls/ValidatableControlShell/ValidatableControlShell.vue";
|
|
26
|
+
export { default as ClosingButton } from "./GUI_Components/Controls/Buttons/Closing/ClosingButton.vue";
|
|
21
27
|
|
|
22
|
-
/*
|
|
28
|
+
/* ╍╍╍ Validatables ╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ */
|
|
29
|
+
export { default as InputtableControl } from "./GUI_Components/Controls/Validatables/InputtableControl.vue";
|
|
30
|
+
export { default as ValidatableControl } from "./GUI_Components/Controls/Validatables/ValidatableControl";
|
|
31
|
+
export { default as ValidatableControlsGroup } from "./GUI_Components/Controls/Validatables/ValidatableControlsGroup";
|
|
32
|
+
|
|
33
|
+
export { default as TextBox } from "./GUI_Components/Controls/Validatables/TextBox/TextBox.vue";
|
|
23
34
|
|
|
24
|
-
export { default as OverflowSafeSingleLineLabel } from "./GUI_Components/OverflowSafeSingleLineLabel.vue";
|
|
25
35
|
|
|
36
|
+
/* ━━━ Alpha / Beta ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
37
|
+
export { default as AccessibleFromTemplateAsNonReactive } from "./GUI_Components/_Decorators/AccessibleFromTemplateAsNonReactive";
|
|
38
|
+
export { default as NonReactiveVueData } from "./GUI_Components/_Decorators/NonReactiveVueData";
|
|
39
|
+
export { default as preventNullForOptionalVueProperty } from "./GUI_Components/_Decorators/preventNullForOptionalVueProperty";
|
|
40
|
+
|
|
41
|
+
export { default as OverflowSafeSingleLineLabel } from "./GUI_Components/OverflowSafeSingleLineLabel.vue";
|
|
26
42
|
export { default as ThemesShowcase } from "./GUI_Components/ThemesShowcase.vue";
|
|
27
43
|
|
|
28
44
|
/* ━━━ Icons ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
extends ../../../node_modules/@yamato-daiwa/frontend/PagesTemplates/RegularWebPageTemplate.pug
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
block append Metadata
|
|
5
|
+
|
|
6
|
+
-
|
|
7
|
+
|
|
8
|
+
RegularWebPageTemplate__YDF.configure({
|
|
9
|
+
metadata: {
|
|
10
|
+
title: "Decorators Workbench"
|
|
11
|
+
},
|
|
12
|
+
scriptsURIs: {
|
|
13
|
+
atEndOfBody: [ "@Workbenches/Decorators/Decorators.workbench" ]
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
block append PageContent
|
|
19
|
+
|
|
20
|
+
#APPLICATION
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
|
|
3
|
+
button(
|
|
4
|
+
type="button"
|
|
5
|
+
@click="updateFields"
|
|
6
|
+
) Change
|
|
7
|
+
|
|
8
|
+
span {{ reactiveFiled }}
|
|
9
|
+
span {{ nonReactiveFiled }}
|
|
10
|
+
|
|
11
|
+
span {{ staticField1 }}
|
|
12
|
+
span {{ staticField2 }}
|
|
13
|
+
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
|
|
19
|
+
/* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
20
|
+
import {
|
|
21
|
+
Component as VueComponentOptions,
|
|
22
|
+
Vue as VueComponent,
|
|
23
|
+
toNative as transformToOptionAPI_Component
|
|
24
|
+
} from "vue-facing-decorator";
|
|
25
|
+
|
|
26
|
+
/* ─── Utils ────────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
27
|
+
import {
|
|
28
|
+
AccessibleFromTemplateAsNonReactive,
|
|
29
|
+
NonReactiveVueData
|
|
30
|
+
} from "../../../Source";
|
|
31
|
+
|
|
32
|
+
@VueComponentOptions({ name: "DecoratorsWorkbench" })
|
|
33
|
+
class DecoratorsWorkbench extends VueComponent {
|
|
34
|
+
|
|
35
|
+
protected reactiveFiled = "ALPHA";
|
|
36
|
+
|
|
37
|
+
@NonReactiveVueData("ALPHA")
|
|
38
|
+
protected nonReactiveFiled!: string;
|
|
39
|
+
|
|
40
|
+
@AccessibleFromTemplateAsNonReactive
|
|
41
|
+
protected static staticField1: string = "STATIC_FIELD_1";
|
|
42
|
+
|
|
43
|
+
@AccessibleFromTemplateAsNonReactive
|
|
44
|
+
protected static staticField2: string = "STATIC_FIELD_2";
|
|
45
|
+
|
|
46
|
+
protected updateFields(): void {
|
|
47
|
+
this.reactiveFiled = "BRAVO";
|
|
48
|
+
this.nonReactiveFiled = "CHARLIE";
|
|
49
|
+
DecoratorsWorkbench.staticField1 = "UPDATED_STATIC_FIELD_1";
|
|
50
|
+
DecoratorsWorkbench.staticField2 = "UPDATED_STATIC_FIELD_2";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default transformToOptionAPI_Component(DecoratorsWorkbench);
|
|
56
|
+
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<style lang="stylus">
|
|
61
|
+
|
|
62
|
+
@require "../../../node_modules/@yamato-daiwa/frontend/Functionality.styl"
|
|
63
|
+
@require "../../../node_modules/@yamato-daiwa/frontend/GUI_Components.styl"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
CrossBrowserStylesReset()
|
|
67
|
+
InitialGlobalCSS_Rules()
|
|
68
|
+
|
|
69
|
+
</style>
|
package/Workbenches/Source/GUI_Components/AdmonitionBlock/AdmonitionBlockComponentTestSite.vue
CHANGED
|
@@ -9,15 +9,22 @@
|
|
|
9
9
|
import { AdmonitionBlock } from "../../../../Source";
|
|
10
10
|
|
|
11
11
|
/* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
Component as VueComponentOptions,
|
|
14
|
+
Vue as VueComponent,
|
|
15
|
+
toNative as transformToOptionAPI_Component
|
|
16
|
+
} from "vue-facing-decorator";
|
|
13
17
|
|
|
14
18
|
|
|
15
19
|
@VueComponentOptions({
|
|
20
|
+
name: "AdmonitionBlockComponentTestSite",
|
|
16
21
|
components: {
|
|
17
22
|
AdmonitionBlock
|
|
18
23
|
}
|
|
19
24
|
})
|
|
20
|
-
|
|
25
|
+
class AdmonitionBlockComponentTestSite extends VueComponent {}
|
|
26
|
+
|
|
27
|
+
export default transformToOptionAPI_Component(AdmonitionBlockComponentTestSite);
|
|
21
28
|
|
|
22
29
|
</script>
|
|
23
30
|
|