@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
@@ -9,15 +9,22 @@
9
9
  import { Badge } from "../../../../Source";
10
10
 
11
11
  /* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
12
- import { Component as VueComponentOptions, Vue as VueComponent } from "vue-facing-decorator";
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: "BadgeComponentTestSite",
16
21
  components: {
17
22
  Badge
18
23
  }
19
24
  })
20
- export default class BadgeComponentTestSite extends VueComponent {}
25
+ class BadgeComponentTestSite extends VueComponent {}
26
+
27
+ export default transformToOptionAPI_Component(BadgeComponentTestSite);
21
28
 
22
29
  </script>
23
30
 
@@ -1,10 +1,10 @@
1
1
  <template lang="pug">
2
2
 
3
- Button(
4
- label="Test"
5
- :disabled="false"
6
- @click="onButtonClicked"
7
- )
3
+ Button(
4
+ label="Test"
5
+ :disabled="false"
6
+ @click="onButtonClicked"
7
+ )
8
8
 
9
9
  </template>
10
10
 
@@ -15,22 +15,33 @@ Button(
15
15
  import { Button } from "../../../../../../Source";
16
16
 
17
17
  /* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
18
- import { Component as VueComponentOptions, Vue as VueComponent } from "vue-facing-decorator";
18
+ import {
19
+ Component as VueComponentOptions,
20
+ Vue as VueComponent,
21
+ toNative as transformToOptionAPI_Component
22
+ } from "vue-facing-decorator";
23
+ import { Logger } from "@yamato-daiwa/es-extensions";
19
24
 
20
25
 
21
26
  @VueComponentOptions({
27
+ name: "ButtonComponentTestSite",
22
28
  components: {
23
29
  Button
24
30
  }
25
31
  })
26
- export default class ButtonComponentTestSite extends VueComponent {
32
+ class ButtonComponentTestSite extends VueComponent {
27
33
 
28
34
  protected onButtonClicked(): void {
29
- console.log("ok!");
35
+ Logger.logSuccess({
36
+ title: "Clicked",
37
+ description: "Button has been clicked"
38
+ });
30
39
  }
31
40
 
32
41
  }
33
42
 
43
+ export default transformToOptionAPI_Component(ButtonComponentTestSite);
44
+
34
45
  </script>
35
46
 
36
47
 
@@ -3,6 +3,12 @@
3
3
  TextBox(
4
4
  label="Sample"
5
5
  guidance="Please input something"
6
+ inputOrTextareaElementHTML_ID="BLA"
7
+ v-model="textBoxPayload"
8
+ :validityHighlightingActivationMode="TextBox.ValidityHighlightingActivationModes.onFocusOut"
9
+ :mustDisplayAppropriateBadgeIfInputIsRequired="true"
10
+ :required="textBoxPayload.validation.isInputRequired()"
11
+ :ref="TEXT_BOX_VUE_REFERENCE_ID"
6
12
  )
7
13
 
8
14
  </template>
@@ -11,18 +17,54 @@
11
17
  <script lang="ts">
12
18
 
13
19
  /* ─── GUI Components ───────────────────────────────────────────────────────────────────────────────────────────── */
20
+ /* eslint-disable-next-line max-classes-per-file -- Allow additional class for for inputted data validation. */
14
21
  import TextBox from "../../../../../../Source/GUI_Components/Controls/Validatables/TextBox/TextBox.vue";
15
22
 
16
23
  /* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
17
- import { Component as VueComponentOptions, Vue as VueComponent } from "vue-facing-decorator";
24
+ import {
25
+ Component as VueComponentOptions,
26
+ Vue as VueComponent,
27
+ toNative as transformToOptionAPI_Component
28
+ } from "vue-facing-decorator";
29
+ import { ValidatableControl, NonReactiveVueData, AccessibleFromTemplateAsNonReactive } from "../../../../../../Source";
30
+ import { InputtedValueValidation, MinimalCharactersCountInputtedValueValidationRule } from "@yamato-daiwa/frontend";
31
+ import { isEmptyString } from "@yamato-daiwa/es-extensions";
18
32
 
19
33
 
20
34
  @VueComponentOptions({
35
+ name: "TextBoxWorkbench",
21
36
  components: {
22
37
  TextBox
23
38
  }
24
39
  })
25
- export default class TextBoxWorkbench extends VueComponent {}
40
+ class TextBoxWorkbench extends VueComponent {
41
+
42
+ @NonReactiveVueData("TEXT_BOX")
43
+ protected readonly TEXT_BOX_VUE_REFERENCE_ID!: string;
44
+
45
+ @AccessibleFromTemplateAsNonReactive
46
+ protected static readonly TextBox: typeof TextBox = TextBox;
47
+
48
+ protected textBoxPayload: ValidatableControl.Payload<string, string, InputtedValueValidation> =
49
+ ValidatableControl.Payload.createInitialInstance({
50
+ initialValue: "",
51
+ validation: new class extends InputtedValueValidation {
52
+ public constructor() {
53
+ super({
54
+ omittedValueChecker: isEmptyString,
55
+ isInputRequired: true,
56
+ staticRules: [
57
+ new MinimalCharactersCountInputtedValueValidationRule({ minimalCharactersCount: 3 })
58
+ ]
59
+ });
60
+ }
61
+ }(),
62
+ vueReferenceID: this.TEXT_BOX_VUE_REFERENCE_ID
63
+ });
64
+
65
+ }
66
+
67
+ export default transformToOptionAPI_Component(TextBoxWorkbench);
26
68
 
27
69
  </script>
28
70
 
@@ -39,5 +81,6 @@
39
81
 
40
82
  generateValidatableControlShellYDF_GUI_ComponentStyles()
41
83
  generateTextBoxYDF_GUI_ComponentStyles()
84
+ generateBadgeYDF_GUI_ComponentStyles()
42
85
 
43
86
  </style>
@@ -12,15 +12,22 @@
12
12
  import { ValidatableControlShell } from "../../../../../Source";
13
13
 
14
14
  /* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
15
- import { Component as VueComponentOptions, Vue as VueComponent } from "vue-facing-decorator";
15
+ import {
16
+ Component as VueComponentOptions,
17
+ Vue as VueComponent,
18
+ toNative as transformToOptionAPI_Component
19
+ } from "vue-facing-decorator";
16
20
 
17
21
 
18
22
  @VueComponentOptions({
23
+ name: "ValidatableControlShellTestSite",
19
24
  components: {
20
25
  ValidatableControlShell
21
26
  }
22
27
  })
23
- export default class ValidatableControlShellTestSite extends VueComponent {}
28
+ class ValidatableControlShellTestSite extends VueComponent {}
29
+
30
+ export default transformToOptionAPI_Component(ValidatableControlShellTestSite);
24
31
 
25
32
  </script>
26
33
 
@@ -22,15 +22,22 @@
22
22
  import { OverflowSafeSingleLineLabel } from "../../../../Source";
23
23
 
24
24
  /* ─── Framework ────────────────────────────────────────────────────────────────────────────────────────────────── */
25
- import { Component as VueComponentOptions, Vue as VueComponent } from "vue-facing-decorator";
25
+ import {
26
+ Component as VueComponentOptions,
27
+ Vue as VueComponent,
28
+ toNative as transformToOptionAPI_Component
29
+ } from "vue-facing-decorator";
26
30
 
27
31
 
28
32
  @VueComponentOptions({
33
+ name: "OverflowSafeSingleLineLabelComponentTestSite",
29
34
  components: {
30
35
  OverflowSafeSingleLineLabel
31
36
  }
32
37
  })
33
- export default class OverflowSafeSingleLineLabelComponentTestSite extends VueComponent {}
38
+ class OverflowSafeSingleLineLabelComponentTestSite extends VueComponent {}
39
+
40
+ export default transformToOptionAPI_Component(OverflowSafeSingleLineLabelComponentTestSite);
34
41
 
35
42
  </script>
36
43
 
@@ -15,6 +15,12 @@ block append Metadata
15
15
 
16
16
  tableOfContents: [
17
17
 
18
+ {
19
+ title: "Decorators",
20
+ URI: "@Workbenches/Decorators/Decorators.workbench",
21
+ progressStatus: StaticPreviewAnywherePage__YDF.PageDevelopmentProgressStatuses.implementationInProgress
22
+ },
23
+
18
24
  {
19
25
 
20
26
  heading: "GUI Components",
package/eslint.config.js CHANGED
@@ -23,6 +23,21 @@ module.exports = [
23
23
  /* The import from the Pug must not be counted as element */
24
24
  "vue/valid-template-root": "off"
25
25
 
26
+ }
27
+ },
28
+
29
+ {
30
+ files: [
31
+ "Source/GUI_Components/_VuePropertiesValidators/VuePropertyValidator.ts",
32
+ "Source/GUI_Components/Controls/Validatables/ValidatableControl.ts"
33
+ ],
34
+ rules: {
35
+
36
+ /* The merging of type/interface and namespace is completely valid TypeScript,
37
+ * but @typescript-eslint community does not wish to support it.
38
+ * https://github.com/eslint/eslint/issues/15504 */
39
+ "@typescript-eslint/no-redeclare": "off"
40
+
26
41
  }
27
42
  }
28
43
 
package/package.json CHANGED
@@ -1,50 +1,42 @@
1
1
  {
2
- "name": "@yamato-daiwa/frontend-vue",
3
- "version": "0.2.0",
4
- "description": "The adaptation of \"@yamato-daiwa/frontend\" package for Vue framework and also some additional functionality.",
5
- "keywords": [
6
- "frontend",
7
- "vue"
8
- ],
9
- "author": {
10
- "name": "Yamato Daiwa Co., Ltd.",
11
- "email": "frontend-es-info@yamato-daiwa.com"
12
- },
13
- "license": "MIT",
14
- "homepage": "https://frontend.yamato-daiwa.com/",
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/TokugawaTakeshi/yamato_daiwa-frontend.git"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/TokugawaTakeshi/yamato_daiwa-frontend/issues",
21
- "email": "frontend-es-info@yamato-daiwa.com"
22
- },
23
- "module": "./Distributable/index.js",
24
- "types": "./Distributable/index.d.ts",
25
- "peerDependencies": {
26
- "@yamato-daiwa/frontend": "2.0.0-beta.10",
27
- "vue": "~3.5.0",
28
- "vue-router": "~4.5.0"
29
- },
30
- "dependencies": {
31
- "@yamato-daiwa/es-extensions": "1.7.2",
32
- "vue-facing-decorator": "3.0.4",
33
- "vue3-slide-up-down": "2.1.0"
34
- },
35
- "devDependencies": {
36
- "@yamato-daiwa/automation": "0.7.0-alpha.4",
37
- "@yamato-daiwa/frontend": "2.0.0-beta.10",
38
- "@yamato-daiwa/style_guides": "0.6.9",
39
- "rimraf": "6.0.1",
40
- "typescript": "5.8.3",
41
- "vue": "3.5.14",
42
- "vue-router": "4.5.1"
43
- },
44
- "scripts": {
45
- "Rebuild Distributable": "yda build --selectiveExecution Distributable --mode PRODUCTION & npm run \"Generate TypeScript Types\"",
46
- "Generate TypeScript Types": "tsc --project tsconfig.declarations.json --declaration --emitDeclarationOnly --outDir Distributable",
47
- "Start Workbenches": "rimraf Workbenches/Output && yda build --selectiveExecution Workbenches --mode LOCAL_DEVELOPMENT",
48
- "Lint": "eslint ."
49
- }
2
+ "name": "@yamato-daiwa/frontend-vue",
3
+ "version": "0.3.0-alpha.1",
4
+ "description": "The adaptation of \"@yamato-daiwa/frontend\" package for Vue framework and also some additional functionality.",
5
+ "keywords": [
6
+ "frontend",
7
+ "vue"
8
+ ],
9
+ "author": {
10
+ "name": "Yamato Daiwa Co., Ltd.",
11
+ "email": "frontend-es-info@yamato-daiwa.com"
12
+ },
13
+ "license": "MIT",
14
+ "homepage": "https://frontend.yamato-daiwa.com/",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/TokugawaTakeshi/yamato_daiwa-frontend.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/TokugawaTakeshi/yamato_daiwa-frontend/issues",
21
+ "email": "frontend-es-info@yamato-daiwa.com"
22
+ },
23
+ "module": "./Distributable/index.js",
24
+ "types": "./Distributable/index.d.ts",
25
+ "peerDependencies": {
26
+ "@yamato-daiwa/frontend": ">=2.0.0-beta.10",
27
+ "vue": "~3.5.0",
28
+ "vue-facing-decorator": "~3.0.0",
29
+ "vue-router": "~4.6.0"
30
+ },
31
+ "dependencies": {
32
+ "@yamato-daiwa/es-extensions": "1.8.4",
33
+ "@yamato-daiwa/es-extensions-browserjs": "1.8.4",
34
+ "vue3-slide-up-down": "2.1.0"
35
+ },
36
+ "scripts": {
37
+ "Rebuild Distributable": "yda build --selectiveExecution Distributable --mode PRODUCTION & npm run \"Generate TypeScript Types\"",
38
+ "Generate TypeScript Types": "tsc --project tsconfig.declarations.json --declaration --emitDeclarationOnly --outDir Distributable",
39
+ "Start Workbenches": "rimraf Workbenches/Output && yda build --selectiveExecution Workbenches --mode LOCAL_DEVELOPMENT",
40
+ "Lint": "eslint ."
41
+ }
50
42
  }
package/tsconfig.json CHANGED
@@ -12,9 +12,6 @@
12
12
  "experimentalDecorators": true,
13
13
  "allowJs": true, /* Actual for Vue3; */
14
14
  "skipLibCheck": true,
15
-
16
- "baseUrl": "./",
17
- "declaration": true
18
15
  },
19
16
  "include": [
20
17
  "Project.d.ts",
package/yda.config.yaml CHANGED
@@ -75,7 +75,7 @@ $projectBuilding:
75
75
  $distributing:
76
76
  $exposingOfExportsFromEntryPoints:
77
77
  $mustExpose: true
78
- $externalizingDependencies: [ @yamato-daiwa/frontend, vue, vue-router ]
78
+ $externalizingDependencies: [ @yamato-daiwa/frontend, vue, vue-facing-decorator, vue-router ]
79
79
  $typeScriptTypesDeclarations:
80
80
  $mustGenerate: true
81
81
 
@@ -1,43 +0,0 @@
1
- VerticallySlidingAlwaysMountedContainer.AdmonitionBlock--YDF(
2
- v-model="isDisplaying"
3
- role="alert"
4
- :class="rootElementModifierCSS_Classes"
5
- )
6
-
7
- slot(
8
- v-if="$slots.CustomSVG_Icon"
9
- name="CustomSVG_Icon"
10
- )
11
-
12
- component.AdmonitionBlock--YDF-SVG_Icon(
13
- v-else-if="hasDefaultSVG_Icon"
14
- :is="defaultSVG_IconComponentName"
15
- )
16
-
17
- .AdmonitionBlock--YDF-Title(
18
- v-if="title"
19
- id=TITLE_HTML_ID
20
- ) {{ title }}
21
-
22
- .AdmonitionBlock--YDF-MainContent(
23
- :aria-labelledby="title ? TITLE_HTML_ID : null"
24
- )
25
-
26
- slot
27
-
28
- template(
29
- v-if="$slots.ActionBarContent"
30
- )
31
-
32
- .AdmonitionBlock--YDF-ActionBar
33
-
34
- slot(
35
- name="ActionBarContent"
36
- )
37
-
38
- button.AdmonitionBlock--YDF-DismissingButton(
39
- v-if="dismissible"
40
- type="button"
41
- :aria-label="localization.dismissingButton.accessibilityGuidance"
42
- @click="onClickDismissingButton"
43
- ): MultiplicationSignIcon__Boxed__Filled.AdmonitionBlock--YDF-DismissingButton-Icon
@@ -1,134 +0,0 @@
1
- /* ─── Framework ──────────────────────────────────────────────────────────────────────────────────────────────────── */
2
- import {
3
- ComponentBase as VueComponentConfiguration,
4
- Vue as VueComponent,
5
- Prop as VueProperty
6
- } from "vue-facing-decorator";
7
-
8
- /* ─── Utils ──────────────────────────────────────────────────────────────────────────────────────────────────────── */
9
- import {
10
- Logger,
11
- isNonEmptyString,
12
- isEitherUndefinedOrNull
13
- } from "@yamato-daiwa/es-extensions";
14
- import InvalidVuePropertiesCombinationError from
15
- "../../_Errors/InvalidVuePropertiesCombination/InvalidVuePropertiesCombinationError";
16
- import OptionalButNotNullableVueProperty from "../../_Decorators/OptionalButNotNullableVueProperty";
17
- import validateVuePropertyAndLogIfInvalid from "../../_Utils/validateVuePropertyAndLogIfInvalid";
18
-
19
-
20
- @VueComponentConfiguration({})
21
- export default class InputtableControl extends VueComponent {
22
-
23
- /* ━━━ Component Common Properties ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
24
- /* ─── Textings ─────────────────────────────────────────────────────────────────────────────────────────────────── */
25
- @VueProperty({
26
- validator: validateVuePropertyAndLogIfInvalid({
27
- checker: isNonEmptyString,
28
- message: "If string specified it must be non-empty"
29
- })
30
- })
31
- @OptionalButNotNullableVueProperty
32
- protected readonly label?: string;
33
-
34
- @VueProperty({
35
- validator: validateVuePropertyAndLogIfInvalid({
36
- checker: isNonEmptyString,
37
- message: "If string specified it must be non-empty"
38
- })
39
- })
40
- @OptionalButNotNullableVueProperty
41
- protected readonly accessibilityGuidance?: string;
42
-
43
- @VueProperty({
44
- validator: validateVuePropertyAndLogIfInvalid({
45
- checker: isNonEmptyString,
46
- message: "If string specified it must be non-empty"
47
- })
48
- })
49
- @OptionalButNotNullableVueProperty
50
- protected readonly externalLabelHTML_ID?: string;
51
-
52
- @VueProperty({
53
- validator: validateVuePropertyAndLogIfInvalid({
54
- checker: isNonEmptyString,
55
- message: "If string specified it must be non-empty"
56
- })
57
- })
58
- @OptionalButNotNullableVueProperty
59
- protected readonly guidance?: string;
60
-
61
-
62
- /* ─── Requirement ──────────────────────────────────────────────────────────────────────────────────────────────── */
63
- @VueProperty({ type: Boolean, default: false })
64
- @OptionalButNotNullableVueProperty
65
- protected readonly required!: boolean;
66
-
67
- @VueProperty({ type: Boolean, default: false })
68
- @OptionalButNotNullableVueProperty
69
- protected readonly mustDisplayAppropriateBadgeIfInputIsRequired!: boolean;
70
-
71
- @VueProperty({ type: Boolean, default: false })
72
- @OptionalButNotNullableVueProperty
73
- protected readonly mustDisplayAppropriateBadgeIfInputIsOptional!: boolean;
74
-
75
- @VueProperty({ type: Boolean, default: false })
76
- @OptionalButNotNullableVueProperty
77
- protected readonly mustAddInvisibleBadgeForHeightEqualizingWhenNoBadge!: boolean;
78
-
79
-
80
- /* ─── State Limitations ─────────────────────────────────────────────────────────────────────────────────────────── */
81
- @VueProperty({ type: Boolean, default: false })
82
- @OptionalButNotNullableVueProperty
83
- protected readonly disabled!: boolean;
84
-
85
- @VueProperty({ type: Boolean, default: false })
86
- @OptionalButNotNullableVueProperty
87
- protected readonly readonly!: boolean;
88
- // ━━━ TODO ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
89
- /* === State ====================================================================================================== */
90
- protected invalidInputHighlightingIfAnyValidationErrorsMessages: boolean = false;
91
- protected validInputHighlightingIfAnyErrorsMessages: boolean = false;
92
-
93
-
94
- /* === Methods ==================================================================================================== */
95
- public highlightInvalidInput(): this {
96
- this.invalidInputHighlightingIfAnyValidationErrorsMessages = true;
97
- return this;
98
- }
99
-
100
- public getRootElement(): Element {
101
- return this.$el;
102
- }
103
-
104
- public resetStateToInitial(): void {
105
- Object.assign(this.$data, this.$options.data?.({}));
106
- }
107
-
108
-
109
- /* === Livecycle hooks ========================================================================================== */
110
- public beforeCreate(): void {
111
-
112
- const inheritedComponentNameForLogging: string = this.$options.name ?? "(Unnamed component)";
113
-
114
- if (
115
- isEitherUndefinedOrNull(this.label) &&
116
- isEitherUndefinedOrNull(this.accessibilityGuidance) &&
117
- isEitherUndefinedOrNull(this.externalLabelHTML_ID)
118
- ) {
119
- Logger.logError({
120
- errorType: InvalidVuePropertiesCombinationError.NAME,
121
- title: InvalidVuePropertiesCombinationError.localization.defaultTitle,
122
- description: InvalidVuePropertiesCombinationError.localization.generateMessage({
123
- vueComponentName: inheritedComponentNameForLogging,
124
- messageSpecificPart: "From the accessibility requirements, one of next properties must be specified:\n" +
125
- "● label\n● accessibilityGuidance\n● externalLabelHTML_ID"
126
-
127
- }),
128
- occurrenceLocation: `${ inheritedComponentNameForLogging }.beforeCreate()`
129
- });
130
- }
131
-
132
- }
133
-
134
- }
@@ -1,34 +0,0 @@
1
- import { Logger } from "@yamato-daiwa/es-extensions";
2
-
3
-
4
- export default function validateVuePropertyAndLogIfInvalid<PreCheckedValueType>(
5
- {
6
- checker,
7
- message
8
- }: Readonly<{
9
- checker: (targetVueProperty: PreCheckedValueType) => boolean;
10
- message: string;
11
- }>
12
- ): (targetVueProperty: PreCheckedValueType) => boolean {
13
-
14
- return (targetVueProperty: PreCheckedValueType): boolean => {
15
-
16
- if (!checker(targetVueProperty)) {
17
-
18
- Logger.logError({
19
- errorType: "VuePropertyCustomValidationFailedError",
20
- title: "Vue Property Custom Validation Failed",
21
- description: message,
22
- occurrenceLocation: "validateVuePropertyAndLogIfInvalid(compoundParameter)"
23
- });
24
-
25
- return false;
26
-
27
- }
28
-
29
-
30
- return true;
31
-
32
- };
33
-
34
- }