@heartlandone/vega 1.6.0 → 1.8.0

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.
Files changed (143) hide show
  1. package/dist/cjs/{app-globals-82228833.js → app-globals-55277f95.js} +1 -1
  2. package/dist/cjs/{array-414f6d01.js → array-a4f013ec.js} +15 -0
  3. package/dist/cjs/{featureFlagController-d092ffce.js → featureFlagController-8cb35fec.js} +10 -5
  4. package/dist/cjs/formFieldController-2882fd1f.js +468 -0
  5. package/dist/cjs/index.cjs.js +1 -1
  6. package/dist/cjs/loader.cjs.js +3 -3
  7. package/dist/cjs/{subject-fdccaa01.js → subject-b9a0f7c6.js} +32 -0
  8. package/dist/{esm/inputValidator-27713cd2.js → cjs/validatorFacade-01c6f6e5.js} +148 -68
  9. package/dist/cjs/vega-accordion.cjs.entry.js +2 -3
  10. package/dist/cjs/vega-button_22.cjs.entry.js +363 -116
  11. package/dist/cjs/vega-checkbox-group.cjs.entry.js +51 -39
  12. package/dist/cjs/vega-form.cjs.entry.js +69 -40
  13. package/dist/cjs/vega-radio-group.cjs.entry.js +48 -26
  14. package/dist/cjs/vega-radio.cjs.entry.js +9 -8
  15. package/dist/cjs/vega-stepper.cjs.entry.js +26 -20
  16. package/dist/cjs/vega.cjs.js +3 -3
  17. package/dist/collection/components/vega-checkbox/vega-checkbox-group.js +65 -50
  18. package/dist/collection/components/vega-date-picker/vega-date-picker.js +74 -30
  19. package/dist/collection/components/vega-form/vega-form.js +72 -45
  20. package/dist/collection/components/vega-input/vega-input.js +50 -27
  21. package/dist/collection/components/vega-input-select/vega-input-select.js +50 -25
  22. package/dist/collection/components/vega-progress-tracker/vega-progress-tracker.js +3 -3
  23. package/dist/collection/components/vega-radio/vega-radio-group.js +74 -27
  24. package/dist/collection/components/vega-radio/vega-radio.js +14 -12
  25. package/dist/collection/components/vega-stepper/vega-stepper.js +57 -28
  26. package/dist/collection/components/vega-table/vega-table.js +28 -3
  27. package/dist/collection/constants/test/picture.js +9 -0
  28. package/dist/collection/helpers/feature-control/featureFlagsMap.js +10 -5
  29. package/dist/collection/helpers/observer/subject.js +1 -0
  30. package/dist/collection/helpers/ui/elementAppender.js +6 -5
  31. package/dist/collection/helpers/validator/formFieldController.js +385 -0
  32. package/dist/collection/helpers/validator/inputValidator.js +8 -7
  33. package/dist/collection/helpers/validator/rules/dateRangeRule.js +26 -5
  34. package/dist/collection/helpers/validator/rules/dateRequiredRule.js +27 -5
  35. package/dist/collection/helpers/validator/rules/emailFieldRule.js +27 -7
  36. package/dist/collection/helpers/validator/rules/maxNumberRule.js +27 -6
  37. package/dist/collection/helpers/validator/rules/maxStringLengthRule.js +27 -6
  38. package/dist/collection/helpers/validator/rules/minAndMaxDateRule.js +27 -6
  39. package/dist/collection/helpers/validator/rules/minNumberRule.js +27 -6
  40. package/dist/collection/helpers/validator/rules/minStringLengthRule.js +26 -5
  41. package/dist/collection/helpers/validator/rules/requiredFieldRule.js +25 -4
  42. package/dist/collection/helpers/validator/test/rules/dateRangeRule.test.js +33 -0
  43. package/dist/collection/helpers/validator/test/rules/dateRequiredRule.test.js +33 -0
  44. package/dist/collection/helpers/validator/test/rules/emailFieldRule.test.js +34 -0
  45. package/dist/collection/helpers/validator/test/rules/maxNumberRule.test.js +34 -0
  46. package/dist/collection/helpers/validator/test/rules/maxStringLengthRule.test.js +34 -0
  47. package/dist/collection/helpers/validator/test/rules/minAndMaxDateRule.test.js +36 -0
  48. package/dist/collection/helpers/validator/test/rules/minNumberRule.test.js +34 -0
  49. package/dist/collection/helpers/validator/test/rules/minStringLengthRule.test.js +34 -0
  50. package/dist/collection/helpers/validator/test/rules/requiredFieldRule.test.js +34 -0
  51. package/dist/collection/helpers/validator/test/validator/formFieldController.test.js +50 -0
  52. package/dist/collection/helpers/validator/validatorFacade.js +135 -0
  53. package/dist/collection/utils/array.js +14 -0
  54. package/dist/collection/utils/test/array.test.js +15 -1
  55. package/dist/collection/utils/testUtils.js +35 -1
  56. package/dist/esm/{app-globals-e9d163d5.js → app-globals-8eba7d36.js} +1 -1
  57. package/dist/esm/{array-fb0b8d24.js → array-68c5fe34.js} +15 -1
  58. package/dist/esm/{featureFlagController-8dd5f329.js → featureFlagController-255beaed.js} +10 -5
  59. package/dist/esm/formFieldController-b76c1ff2.js +465 -0
  60. package/dist/esm/index.js +1 -1
  61. package/dist/esm/loader.js +3 -3
  62. package/dist/esm/{subject-ade7d101.js → subject-86545d82.js} +31 -1
  63. package/dist/{cjs/inputValidator-4485dcb4.js → esm/validatorFacade-b579d4b7.js} +144 -69
  64. package/dist/esm/vega-accordion.entry.js +1 -2
  65. package/dist/esm/vega-button_22.entry.js +358 -111
  66. package/dist/esm/vega-checkbox-group.entry.js +50 -38
  67. package/dist/esm/vega-form.entry.js +69 -40
  68. package/dist/esm/vega-radio-group.entry.js +47 -25
  69. package/dist/esm/vega-radio.entry.js +9 -8
  70. package/dist/esm/vega-stepper.entry.js +26 -20
  71. package/dist/esm/vega.js +3 -3
  72. package/dist/types/components/vega-checkbox/vega-checkbox-group.d.ts +13 -9
  73. package/dist/types/components/vega-date-picker/vega-date-picker.d.ts +18 -4
  74. package/dist/types/components/vega-form/vega-form.d.ts +5 -2
  75. package/dist/types/components/vega-input/vega-input.d.ts +12 -5
  76. package/dist/types/components/vega-input-select/vega-input-select.d.ts +16 -5
  77. package/dist/types/components/vega-progress-tracker/vega-progress-tracker.d.ts +1 -1
  78. package/dist/types/components/vega-radio/vega-radio-group.d.ts +16 -7
  79. package/dist/types/components/vega-radio/vega-radio.d.ts +2 -2
  80. package/dist/types/components/vega-stepper/vega-stepper.d.ts +13 -5
  81. package/dist/types/components/vega-table/vega-table.d.ts +3 -0
  82. package/dist/types/components.d.ts +65 -23
  83. package/dist/types/constants/test/picture.d.ts +3 -0
  84. package/dist/types/helpers/feature-control/featureFlag.d.ts +2 -1
  85. package/dist/types/helpers/observer/subject.d.ts +2 -1
  86. package/dist/types/helpers/ui/elementAppender.d.ts +4 -4
  87. package/dist/types/helpers/validator/formFieldController.d.ts +218 -0
  88. package/dist/types/helpers/validator/formValidator.d.ts +8 -0
  89. package/dist/types/helpers/validator/inputValidator.d.ts +13 -12
  90. package/dist/types/helpers/validator/rules/dateRangeRule.d.ts +20 -5
  91. package/dist/types/helpers/validator/rules/dateRequiredRule.d.ts +22 -6
  92. package/dist/types/helpers/validator/rules/emailFieldRule.d.ts +22 -7
  93. package/dist/types/helpers/validator/rules/formFieldValidationRule.d.ts +22 -0
  94. package/dist/types/helpers/validator/rules/maxNumberRule.d.ts +22 -7
  95. package/dist/types/helpers/validator/rules/maxStringLengthRule.d.ts +22 -7
  96. package/dist/types/helpers/validator/rules/minAndMaxDateRule.d.ts +20 -5
  97. package/dist/types/helpers/validator/rules/minNumberRule.d.ts +22 -7
  98. package/dist/types/helpers/validator/rules/minStringLengthRule.d.ts +21 -6
  99. package/dist/types/helpers/validator/rules/requiredFieldRule.d.ts +20 -5
  100. package/dist/types/helpers/validator/test/validator/formFieldController.test.d.ts +1 -0
  101. package/dist/types/helpers/validator/validator.d.ts +3 -3
  102. package/dist/types/helpers/validator/validatorFacade.d.ts +72 -0
  103. package/dist/types/utils/array.d.ts +8 -0
  104. package/dist/types/utils/testUtils.d.ts +11 -3
  105. package/dist/vega/index.esm.js +1 -1
  106. package/dist/vega/p-0124aea1.js +1 -0
  107. package/dist/vega/p-11abc13b.entry.js +1 -0
  108. package/dist/vega/p-1c936310.js +1 -0
  109. package/dist/vega/p-2c4b2cee.js +1 -0
  110. package/dist/vega/p-61922e02.entry.js +13 -0
  111. package/dist/vega/p-6813838d.js +1 -0
  112. package/dist/vega/p-89f00634.js +1 -0
  113. package/dist/vega/p-a5a7b29e.entry.js +1 -0
  114. package/dist/vega/p-aec29962.entry.js +1 -0
  115. package/dist/vega/p-b5a4ee96.js +1 -0
  116. package/dist/vega/p-bd47cc3c.entry.js +1 -0
  117. package/dist/vega/p-ecb50707.entry.js +1 -0
  118. package/dist/vega/p-f27a18dc.entry.js +1 -0
  119. package/dist/vega/vega.css +1 -1
  120. package/dist/vega/vega.esm.js +1 -1
  121. package/package.json +1 -1
  122. package/readme.md +21 -0
  123. package/style/vega.css +1 -1
  124. package/style/vega_min.css +1 -1
  125. package/dist/cjs/observer-126f19d0.js +0 -32
  126. package/dist/collection/helpers/validator/rules/customFieldRule.js +0 -42
  127. package/dist/collection/helpers/validator/test/rules/customFieldRule.test.js +0 -48
  128. package/dist/esm/observer-8ff2bb65.js +0 -30
  129. package/dist/types/helpers/validator/rules/customFieldRule.d.ts +0 -35
  130. package/dist/types/helpers/validator/test/rules/customFieldRule.test.d.ts +0 -1
  131. package/dist/vega/p-03db1ce3.entry.js +0 -1
  132. package/dist/vega/p-08b6766a.js +0 -1
  133. package/dist/vega/p-35cb6bef.entry.js +0 -1
  134. package/dist/vega/p-59a2385e.entry.js +0 -1
  135. package/dist/vega/p-5c85d021.entry.js +0 -1
  136. package/dist/vega/p-6715aa3b.js +0 -1
  137. package/dist/vega/p-699caab3.js +0 -1
  138. package/dist/vega/p-8e09cf4d.entry.js +0 -1
  139. package/dist/vega/p-975a51b7.js +0 -1
  140. package/dist/vega/p-b242c3b3.entry.js +0 -1
  141. package/dist/vega/p-bba1c460.js +0 -1
  142. package/dist/vega/p-d46bceb1.js +0 -1
  143. package/dist/vega/p-ec5c01b5.entry.js +0 -13
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const featureFlagController = require('./featureFlagController-d092ffce.js');
3
+ const featureFlagController = require('./featureFlagController-8cb35fec.js');
4
4
 
5
5
  /**
6
6
  * Default export function that will be used by stencil global script,
@@ -39,7 +39,22 @@ const isArrayEqual = (first, second) => {
39
39
  const isObjectArrayLike = (obj) => {
40
40
  return Object.keys(obj).every((key) => !isNaN(number.convertToNumber(key)));
41
41
  };
42
+ /**
43
+ * It takes an array and an item, and returns a new array with the item removed at the first occurrence.
44
+ *
45
+ * @param {T[]} arr - T[] - The array to remove the item from
46
+ * @param {T} item - The item to be deleted from the array.
47
+ * @returns {T[]} A function that takes two arguments, arr and item, and returns an array.
48
+ */
49
+ const deleteItemFromArray = (arr, item) => {
50
+ const index = arr.indexOf(item);
51
+ if (index > -1) {
52
+ arr.splice(index, 1);
53
+ }
54
+ return arr;
55
+ };
42
56
 
57
+ exports.deleteItemFromArray = deleteItemFromArray;
43
58
  exports.flattenChildren = flattenChildren;
44
59
  exports.isArrayEqual = isArrayEqual;
45
60
  exports.isObjectArrayLike = isObjectArrayLike;
@@ -14,16 +14,21 @@ const FeatureFlagsMap = {
14
14
  createdTimestamp: 1660800418146,
15
15
  createdAtVersion: '1.3.0',
16
16
  },
17
- 'VEGA_DATE_PICKER.ADD_DATEPICKER_TO_ELEMENT_APPENDER': {
18
- description: `Feature flag to enable add the date picker to element appender`,
19
- createdTimestamp: 1662508203840,
20
- createdAtVersion: '1.4.0',
21
- },
22
17
  'VEGA_CHECK_GROUP.VALUE_PROPERTY_TYPE_CHANGE_ARRAY': {
23
18
  description: 'Feature flag to enable the change value property to array for the checkbox group component.',
24
19
  createdTimestamp: 1661243219291,
25
20
  createdAtVersion: '1.3.0',
26
21
  },
22
+ 'VEGA_FORM.FORM_FIELD_CONTROLLER_VALIDATION': {
23
+ description: `Feature flag to enable the new form validation process for the form component.`,
24
+ createdTimestamp: 1660617211562,
25
+ createdAtVersion: '1.6.0',
26
+ },
27
+ 'VEGA_DATE_PICKER.ADD_DATEPICKER_TO_ELEMENT_APPENDER': {
28
+ description: `Feature flag to enable add the date picker to element appender`,
29
+ createdTimestamp: 1662508203840,
30
+ createdAtVersion: '1.4.0',
31
+ },
27
32
  };
28
33
  const FeatureFlagsMap$1 = Object.freeze(FeatureFlagsMap);
29
34
 
@@ -0,0 +1,468 @@
1
+ 'use strict';
2
+
3
+ const subject = require('./subject-b9a0f7c6.js');
4
+ const ui = require('./ui-1393500e.js');
5
+
6
+ /**
7
+ * A rule that checks if a string is empty or not
8
+ *
9
+ * @implements {FormFieldValidationRule<string>}
10
+ */
11
+ class RequiredFieldRule {
12
+ constructor() {
13
+ /**
14
+ * A function that checks if the item is a string, number, or boolean.
15
+ *
16
+ * @param {unknown} item - The item to be checked.
17
+ * @returns {boolean} The return value is a boolean that indicates whether the item is string, number or boolean.
18
+ */
19
+ this.checkArrayItemType = (item) => typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean';
20
+ }
21
+ /**
22
+ * If the input is a number or a boolean, return true. If the input is a string, return true if the string is not empty
23
+ *
24
+ * @param {Primitive | Array<Primitive>} input - The input to be evaluated.
25
+ * @returns {EvaluateResult} An object with two properties: isValid and message.
26
+ */
27
+ evaluate(input) {
28
+ if (!this.isAcceptedInputType(input)) {
29
+ throw new Error(`Unexpected type of input: ${typeof input}: ${input}`);
30
+ }
31
+ else if (typeof input === 'number' || typeof input === 'boolean') {
32
+ return {
33
+ isValid: true,
34
+ message: '',
35
+ };
36
+ }
37
+ else if (typeof input === 'string' || Array.isArray(input)) {
38
+ return {
39
+ isValid: input.length > 0,
40
+ message: input.length <= 0 ? 'This field is required' : '',
41
+ };
42
+ }
43
+ else if (input === null) {
44
+ return {
45
+ isValid: false,
46
+ message: 'This field is required',
47
+ };
48
+ }
49
+ }
50
+ /**
51
+ * If the input is accepted and the status is not disabled and visible, then return true
52
+ *
53
+ * @param {unknown} input - The input to be evaluated.
54
+ * @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
55
+ * @returns {boolean} The return value is a boolean that indicates whether the input can be evaluated.
56
+ */
57
+ canEvaluate(input, status) {
58
+ return status
59
+ ? this.isAcceptedInputType(input) && !status.disabled && status.visible
60
+ : this.isAcceptedInputType(input);
61
+ }
62
+ /**
63
+ * If the field is not disabled, visible, and has been touched or modified, then show the error
64
+ *
65
+ * @param {FormFieldStatusMeta} status - FormFieldStatusMeta
66
+ * @returns {boolean} A boolean value.
67
+ */
68
+ shouldShowError(status) {
69
+ return !status.disabled && status.visible && (status.touched || status.modified);
70
+ }
71
+ /**
72
+ * If the input is a string, number, boolean, or null, return true, otherwise return false.
73
+ *
74
+ * @param {unknown} input - The input value to be validated.
75
+ * @returns {boolean} a boolean value.
76
+ */
77
+ isAcceptedInputType(input) {
78
+ return (typeof input === 'string' ||
79
+ typeof input === 'number' ||
80
+ typeof input === 'boolean' ||
81
+ (Array.isArray(input) && input.every(this.checkArrayItemType)) ||
82
+ input === null);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * The FormFieldController class is a class that validates the value of an input elements
88
+ *
89
+ * @implements {Validator<number | string | boolean | null>}
90
+ * @property {FormFieldValidationRule<number | string | boolean>[] = []} defaultRules default rules used for validation
91
+ * @property {FormFieldValidationRule<number | string | boolean>[]} additionalRules additional rules used for validation
92
+ * @property {InputValidatorListener[]} listeners listeners monitoring on the validation result
93
+ * @property {string} inputContainerSelector container that holds the input value
94
+ * @property {unknown & { value?: number | string | boolean }} hostElement host element used to get the value for validation if input element is not present
95
+ * @property {boolean} isTouched true if an element is touched
96
+ * @property {boolean} isModified true if an element is modified
97
+ * @property {boolean} isVisible true if an element is visible
98
+ * @property {string} touchableArea define the area which listen to the blur event
99
+ * @property {MutationObserver} disabledAttrObserver reference to the MutationObserver
100
+ * @property {ResizeObserver} visibilityObserver reference to the ResizeObserver
101
+ * @property {Observer<boolean>} formResetTriggeredObserver reference to formResetTriggeredObserver
102
+ */
103
+ class FormFieldController {
104
+ /**
105
+ * This function is called when the component is created, and it sets up the observers that will be used to detect changes to the component's state.
106
+ * The first thing the constructor does is set the defaultRules, hostElement, inputContainerSelector, touchableArea, isTouched, isModified, and isDisabled properties
107
+ *
108
+ * @param {FormFieldValidationRule<number | string | boolean>[]} defaultRules - FormFieldValidationRule<T>[]
109
+ * @param {FormFieldElement<number | string | boolean>} hostElement - The form field element that this validation manager is attached to.
110
+ * @param {string} [inputContainer=.vega-input-container] - The selector for the element that contains the input element.
111
+ * @param {string} [touchableArea=input] - This is the element that will be used to determine if the user has touched the field.
112
+ */
113
+ constructor(defaultRules, hostElement, inputContainer = '.vega-input-container', touchableArea = 'input') {
114
+ var _a, _b;
115
+ this.defaultRules = [];
116
+ this.additionalRules = [];
117
+ this.listeners = [];
118
+ this.inputContainerSelector = '';
119
+ this.isTouched = false;
120
+ this.isModified = false;
121
+ this.isVisible = false;
122
+ this.defaultRules = defaultRules;
123
+ this.hostElement = hostElement;
124
+ this.inputContainerSelector = inputContainer;
125
+ this.touchableArea = touchableArea;
126
+ this.initDisabledAttrObserver();
127
+ this.initResizeObserver();
128
+ this.initFormResetObserver();
129
+ (_b = (_a = this.hostElement).componentOnReady) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => {
130
+ this.didRender();
131
+ });
132
+ }
133
+ /**
134
+ * Get the default value of the form field
135
+ *
136
+ * @param {HTMLElement} element Form field element
137
+ * @returns { '' | 0 | ['', ''] } The default value
138
+ */
139
+ static getFormFieldDefaultValue(element) {
140
+ const tagName = element.tagName;
141
+ if (tagName === 'VEGA-INPUT-SELECT' ||
142
+ tagName === 'VEGA-CHECKBOX-GROUP' ||
143
+ tagName === 'VEGA-RADIO-GROUP')
144
+ return '';
145
+ if (tagName === 'VEGA-INPUT') {
146
+ return element.dataset['isVegaStepper'] ? 0 : '';
147
+ }
148
+ if (tagName === 'VEGA-DATE-PICKER') {
149
+ if (element['mode'] === 'range') {
150
+ return ['', ''];
151
+ }
152
+ else {
153
+ return '';
154
+ }
155
+ }
156
+ if (tagName === 'VEGA-STEPPER') {
157
+ return 0;
158
+ }
159
+ }
160
+ /**
161
+ * It validates the input against the rules and returns a boolean indicating whether the input is valid or not
162
+ *
163
+ * @param {boolean} showError whether the validation result should be reflected in UI
164
+ * @returns {boolean} A boolean value.
165
+ */
166
+ validate(showError) {
167
+ return this.valid([], showError);
168
+ }
169
+ /**
170
+ * This function adds a listener to the listeners array.
171
+ *
172
+ * @param {InputValidatorListener} listener - The listener to add.
173
+ */
174
+ addListener(listener) {
175
+ this.listeners.push(listener);
176
+ }
177
+ /**
178
+ * It returns an array of all the validation rules for the field
179
+ *
180
+ * @returns {FormFieldValidationRule<number | string | boolean>[]} An array of FormFieldValidationRule<T>
181
+ */
182
+ getRules() {
183
+ return [...this.defaultRules, ...this.additionalRules];
184
+ }
185
+ /**
186
+ * Set the default rules for the form field.
187
+ *
188
+ * @param {FormFieldValidationRule<number | string | boolean>[]} rules - FormFieldValidationRule<T>[]
189
+ */
190
+ setDefaultRules(rules) {
191
+ this.defaultRules = rules;
192
+ }
193
+ /**
194
+ * This function sets the additional rules for the form field
195
+ *
196
+ * @param {FormFieldValidationRule<number | string | boolean>[]} rules - The rules that are required for the field to be valid.
197
+ */
198
+ setAdditionalRules(rules) {
199
+ this.additionalRules = rules;
200
+ }
201
+ /**
202
+ * Return true if any of the rules are an instance of the RequiredFieldRule class.
203
+ *
204
+ * @returns {boolean} A boolean value.
205
+ */
206
+ hasRequiredRule() {
207
+ return this.getRules().some((rule) => rule instanceof RequiredFieldRule);
208
+ }
209
+ /**
210
+ * The destroy function unregister the form reset observer
211
+ */
212
+ destroy() {
213
+ this.unregisterFormResetObserver();
214
+ }
215
+ /**
216
+ * valid function to validate the rules
217
+ */
218
+ valid(triggerStatus, showError = 'rule') {
219
+ const input = this.hostElement.value;
220
+ const firstInvalidResult = this.getFirstInvalidRuleResult(input, triggerStatus);
221
+ let isValid = true;
222
+ if (firstInvalidResult) {
223
+ if (showError === 'rule') {
224
+ firstInvalidResult.shouldShowError
225
+ ? this.applyInputInvalidUI(firstInvalidResult.message)
226
+ : this.resetInputInvalidUI();
227
+ }
228
+ else {
229
+ showError ? this.applyInputInvalidUI(firstInvalidResult.message) : this.resetInputInvalidUI();
230
+ }
231
+ isValid = false;
232
+ }
233
+ else {
234
+ this.resetInputInvalidUI();
235
+ }
236
+ this.invokeListeners(isValid);
237
+ return isValid;
238
+ }
239
+ /**
240
+ * It returns the first invalid rule result, or null if all rules are valid
241
+ *
242
+ * @param {number | string | boolean | string[] | null} input - The current value of the field
243
+ * @param {(keyof FormFieldStatusMeta)[]} statusChanged - (keyof FormFieldStatusMeta)[]
244
+ * @returns {ValidationResult | null} The first invalid rule result.
245
+ */
246
+ getFirstInvalidRuleResult(input, statusChanged) {
247
+ const status = this.getStatus();
248
+ for (const rule of this.getRules().filter((rule) => rule.canEvaluate(input, status, statusChanged))) {
249
+ const evaluateResult = rule.evaluate(input);
250
+ const shouldShowError = rule.shouldShowError
251
+ ? rule.shouldShowError(status, statusChanged)
252
+ : this.defaultShouldShowError(status);
253
+ const validationResult = Object.assign(Object.assign({}, evaluateResult), { shouldShowError });
254
+ if (!evaluateResult.isValid) {
255
+ return validationResult;
256
+ }
257
+ }
258
+ return null;
259
+ }
260
+ /**
261
+ * It takes an error message and displays it in the error container
262
+ *
263
+ * @param {string} errorMessage - The error message to display.
264
+ */
265
+ applyInputInvalidUI(errorMessage) {
266
+ if (errorMessage) {
267
+ const inputContainer = this.getInputElementContainer();
268
+ const errorContainer = this.getErrorContainer();
269
+ errorContainer.innerHTML = errorMessage;
270
+ errorContainer.classList.remove('vega-hidden');
271
+ inputContainer.classList.add('error');
272
+ }
273
+ }
274
+ /**
275
+ * Reset the input element's invalid UI
276
+ */
277
+ resetInputInvalidUI() {
278
+ const inputContainer = this.getInputElementContainer();
279
+ const errorContainer = this.getErrorContainer();
280
+ errorContainer.classList.add('vega-hidden');
281
+ inputContainer.classList.remove('error');
282
+ }
283
+ /**
284
+ * Get the input element container
285
+ *
286
+ * @returns {HTMLElement} The input element container.
287
+ */
288
+ getInputElementContainer() {
289
+ const inputContainer = this.hostElement.querySelector(this.inputContainerSelector);
290
+ if (!inputContainer) {
291
+ throw new Error(`Can't not find inputContainer with selector ${this.inputContainerSelector}`);
292
+ }
293
+ return inputContainer;
294
+ }
295
+ /**
296
+ * Get the error container, if it doesn't exist, create it
297
+ *
298
+ * @returns {HTMLElement} The error container.
299
+ */
300
+ getErrorContainer() {
301
+ var _a;
302
+ const inputContainer = this.getInputElementContainer();
303
+ let siblingContainer = inputContainer.nextSibling;
304
+ if (!siblingContainer || !((_a = siblingContainer.classList) === null || _a === void 0 ? void 0 : _a.contains('vega-error'))) {
305
+ siblingContainer = document.createElement('label');
306
+ siblingContainer.classList.add('vega-error');
307
+ inputContainer.after(siblingContainer);
308
+ }
309
+ return siblingContainer;
310
+ }
311
+ /**
312
+ * Invoke all listeners with the given isValid value
313
+ *
314
+ * @param {boolean} isValid - boolean
315
+ */
316
+ invokeListeners(isValid) {
317
+ this.listeners.forEach((listener) => listener.callback(isValid));
318
+ }
319
+ /**
320
+ * It returns an object with the current status of the form field
321
+ *
322
+ * @returns {FormFieldStatusMeta} The status of the form field.
323
+ */
324
+ getStatus() {
325
+ return {
326
+ touched: this.isTouched,
327
+ modified: this.isModified,
328
+ disabled: this.hostElement['disabled'],
329
+ visible: this.isVisible,
330
+ };
331
+ }
332
+ /**
333
+ * It updates the `isTouched` property and if auto validation is enabled, it validates the input
334
+ *
335
+ * @param {boolean} touched - boolean - whether the input is touched or not
336
+ */
337
+ updateIsTouched(touched) {
338
+ const prevIsTouched = this.isTouched;
339
+ this.isTouched = touched;
340
+ if (this.isAutoValidationEnabled()) {
341
+ this.valid(prevIsTouched === touched ? [] : ['touched']);
342
+ }
343
+ }
344
+ /**
345
+ * "If the value of the `isModified` property has changed, then update the `isModified` property and if auto-validation is enabled, then validate the control."
346
+ *
347
+ * @param {boolean} modified - boolean - whether the value has been modified or not
348
+ */
349
+ updateIsModified(modified) {
350
+ const prevIsModified = this.isModified;
351
+ this.isModified = modified;
352
+ if (this.isAutoValidationEnabled()) {
353
+ this.valid(prevIsModified === modified ? [] : ['modified']);
354
+ }
355
+ }
356
+ /**
357
+ * It creates a new MutationObserver that watches for changes to the disabled attribute of the host
358
+ * element, and when it detects a change, it validates the host element's value
359
+ */
360
+ initDisabledAttrObserver() {
361
+ this.disabledAttrObserver = new MutationObserver(() => {
362
+ if (this.isAutoValidationEnabled()) {
363
+ this.valid(['disabled']);
364
+ }
365
+ });
366
+ this.disabledAttrObserver.observe(this.hostElement, {
367
+ attributes: true,
368
+ attributeFilter: ['disabled'],
369
+ });
370
+ }
371
+ /**
372
+ * It creates an observer that will watch the host element and set the isVisible property to true if
373
+ * the element is visible.
374
+ */
375
+ initResizeObserver() {
376
+ this.resizeObserver = new ResizeObserver((entries) => {
377
+ const prevVisible = this.isVisible;
378
+ const currentVisible = entries[0].contentRect.height > 0;
379
+ this.isVisible = currentVisible;
380
+ if (this.isAutoValidationEnabled() && ui.findParent(this.hostElement, 'vega-form')) {
381
+ prevVisible !== currentVisible && this.valid(['visible']);
382
+ }
383
+ });
384
+ this.resizeObserver.observe(this.hostElement);
385
+ }
386
+ /**
387
+ * If the input form is a child of the current form, then the current form can accept the input form's reset operation
388
+ *
389
+ * @param {ResetOperationPayload} input - VegaForm - The form that is being reset.
390
+ * @returns {boolean} A boolean value.
391
+ */
392
+ canAcceptFormResetOperation(input) {
393
+ return ui.findParent(this.hostElement, 'vega-form') === input.host;
394
+ }
395
+ /**
396
+ * Unregister the form reset observer.
397
+ */
398
+ unregisterFormResetObserver() {
399
+ subject.ChangeManager.unregister(subject.FORM_RESET_OPERATION_TRIGGERED, this.formResetTriggeredObserver);
400
+ }
401
+ /**
402
+ * It adds a blur event listener to all elements that match the selector in the touchableArea property
403
+ */
404
+ setupTouchedListener() {
405
+ this.hostElement.querySelectorAll(this.touchableArea).forEach((item) => item.addEventListener('blur', () => {
406
+ this.updateIsTouched(true);
407
+ }));
408
+ }
409
+ /**
410
+ * It adds an event listener to the host element that listens for a custom event called `vegaChange`.
411
+ * When that event is fired, the `updateIsModified` function is called with the argument `true`
412
+ */
413
+ setupModifiedListener() {
414
+ this.hostElement.addEventListener('vegaChange', () => {
415
+ this.updateIsModified(true);
416
+ });
417
+ }
418
+ /**
419
+ * It resets the form field's status and then validates the form field with the current value
420
+ */
421
+ reset(payload) {
422
+ const fieldName = this.hostElement.dataset['vegaForm'];
423
+ const defaultValue = payload.defaultValueMap[fieldName] === undefined || payload.defaultValueMap[fieldName] === null
424
+ ? FormFieldController.getFormFieldDefaultValue(this.hostElement)
425
+ : payload.defaultValueMap[fieldName];
426
+ this.hostElement.value = defaultValue;
427
+ this.isTouched = false;
428
+ this.isModified = false;
429
+ this.resetInputInvalidUI();
430
+ }
431
+ /**
432
+ * This function is called after the component has been rendered. It re-attaches the invalid UI to
433
+ * the input element, and sets up the listeners for the `touched` and `modified` events
434
+ */
435
+ didRender() {
436
+ this.setupTouchedListener();
437
+ this.setupModifiedListener();
438
+ }
439
+ /**
440
+ * This function registers an observer with the ChangeManager that will be notified when a form
441
+ * reset operation is triggered
442
+ */
443
+ initFormResetObserver() {
444
+ this.formResetTriggeredObserver = new subject.Observer(this.canAcceptFormResetOperation.bind(this), this.reset.bind(this));
445
+ subject.ChangeManager.register(subject.FORM_RESET_OPERATION_TRIGGERED, this.formResetTriggeredObserver);
446
+ }
447
+ /**
448
+ * "If the host element's autoValidation property is not false, then return true."
449
+ * The host element is the element that the directive is attached to. In this case, the host element is the input element
450
+ *
451
+ * @returns {boolean} A boolean value.
452
+ */
453
+ isAutoValidationEnabled() {
454
+ return this.hostElement.autoValidation !== false;
455
+ }
456
+ /**
457
+ * If the field is not disabled, visible, and the field is touched or modified, then return true
458
+ *
459
+ * @param {FormFieldStatusMeta} status - FormFieldStatusMeta - The status of the field.
460
+ * @returns {boolean} A function that takes in 3 parameters and returns a boolean.
461
+ */
462
+ defaultShouldShowError(status) {
463
+ return !status.disabled && status.visible && (status.touched || status.modified);
464
+ }
465
+ }
466
+
467
+ exports.FormFieldController = FormFieldController;
468
+ exports.RequiredFieldRule = RequiredFieldRule;
@@ -7,7 +7,7 @@ const log = require('./log-7b0974fb.js');
7
7
  const typeGuard = require('./typeGuard-7a5746f7.js');
8
8
  const icons = require('./icons-5a6aca4a.js');
9
9
  const ui = require('./ui-2ae913d5.js');
10
- const featureFlagController = require('./featureFlagController-d092ffce.js');
10
+ const featureFlagController = require('./featureFlagController-8cb35fec.js');
11
11
  require('./number-2eb7b8f3.js');
12
12
 
13
13
  /* This file is generated by vega-design 2.0.64 */
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-c12bc235.js');
6
- const appGlobals = require('./app-globals-82228833.js');
7
- require('./featureFlagController-d092ffce.js');
6
+ const appGlobals = require('./app-globals-55277f95.js');
7
+ require('./featureFlagController-8cb35fec.js');
8
8
 
9
9
  /*
10
10
  Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
@@ -17,7 +17,7 @@ const defineCustomElements = (win, options) => {
17
17
  if (typeof window === 'undefined') return Promise.resolve();
18
18
  return patchEsm().then(() => {
19
19
  appGlobals.globalScripts();
20
- return index.bootstrapLazy([["vega-button_22.cjs",[[0,"vega-tab-group",{"selectedTabDataTarget":[1,"selected-tab-data-target"],"gap":[1],"showCloseButton":[4,"show-close-button"],"tabItems":[16],"positionRelativeTo":[1,"position-relative-to"],"tabPages":[32],"tabWidthArray":[32],"currentPageIndex":[32]},[[0,"vegaPageUpdate","onCarouselPageUpdate"]]],[4,"vega-table",{"columns":[16],"dataSource":[16],"rowSelection":[1040],"rowExpandable":[4,"row-expandable"],"rowClickable":[4,"row-clickable"],"rowDivider":[4,"row-divider"],"columnDivider":[4,"column-divider"],"striped":[4],"density":[1],"paddingX":[16],"showHeader":[4,"show-header"],"pagination":[16],"selectedRowKeySet":[32],"expandedRowKeySet":[32],"currentBreakpoint":[32],"sortersMap":[32],"currentData":[32],"currentClickedRowIndex":[32],"currentPage":[32],"openExpandRow":[64],"closeExpandRow":[64],"closeAllExpandRow":[64],"toggleExpandRow":[64],"clearSelection":[64],"getSelection":[64],"setSelection":[64]}],[0,"vega-date-picker",{"mode":[1],"value":[1537],"label":[1],"required":[4],"isValid":[1540,"is-valid"],"autoValidation":[516,"auto-validation"],"format":[1],"size":[1],"formValidation":[2,"form-validation"],"validationRules":[16],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"placeholder":[1],"clearButton":[4,"clear-button"],"readOnly":[4,"read-only"],"allowRepick":[4,"allow-repick"],"dropdownConfig":[16],"disabled":[4],"valid":[64],"doClose":[64],"doOpen":[64]}],[0,"vega-input-select",{"label":[1],"required":[1028],"source":[1040],"value":[1537],"isValid":[1540,"is-valid"],"autoValidation":[4,"auto-validation"],"formValidation":[2,"form-validation"],"validationRules":[16],"prefixIcon":[1,"prefix-icon"],"disabled":[4],"placeholder":[1],"hint":[1],"vegaDropdownProps":[16],"isDropdownShow":[32],"showError":[32],"doClose":[64],"doOpen":[64],"doChange":[64],"valid":[64]}],[0,"vega-progress-tracker",{"direction":[1],"steps":[16],"completedStepArray":[16],"canClickStep":[4,"can-click-step"],"current":[32],"nextStep":[64],"prevStep":[64],"setCurrent":[64],"getCurrent":[64]},[[0,"vegaPageUpdate","onVegaPageUpdateHandler"]]],[4,"vega-sidenav",{"source":[16],"footnote":[1],"headerConfig":[16],"openByDefault":[1,"open-by-default"],"openState":[32],"toggle":[64]},[[0,"vegaClick","onVegaClickHandler"],[10,"click","collapseSidenavByBackDropClick"]]],[0,"vega-button",{"size":[1],"variant":[1],"icon":[1],"iconAlign":[1,"icon-align"],"label":[1025],"disabled":[4],"danger":[4],"block":[4]}],[4,"vega-footer",{"tosUrl":[1,"tos-url"],"privacyUrl":[1,"privacy-url"]}],[4,"vega-modal",{"backdrop":[1],"size":[8],"open":[1028],"animation":[4],"modalTitle":[1,"modal-title"],"backdropColor":[1,"backdrop-color"],"isVerticallyCenter":[4,"is-vertically-center"],"showCloseButton":[4,"show-close-button"],"padding":[1],"contentMaxHeight":[2,"content-max-height"],"modal":[64]},[[10,"click","listenDataTarget"],[0,"click","listenDataDismiss"]]],[0,"vega-pagination",{"current":[1538],"total":[2],"pageSize":[2,"page-size"]}],[0,"vega-button-link",{"link":[1],"size":[1],"icon":[513],"iconType":[1,"icon-type"],"iconAlign":[1,"icon-align"],"label":[1025],"disabled":[4],"danger":[4],"eventful":[4]}],[4,"vega-checkbox",{"value":[1],"name":[1],"checked":[1028],"disabled":[4],"size":[1]}],[4,"vega-sidenav-group",{"icon":[1],"label":[1]}],[4,"vega-sidenav-link",{"icon":[1],"selected":[1540],"url":[1],"showSideBarOnClickLink":[4,"show-side-bar-on-click-link"]}],[4,"vega-dropdown",{"size":[8],"trigger":[1],"translocation":[16],"source":[1040],"positionRelativeTo":[1,"position-relative-to"],"selectType":[1,"select-type"],"selectedSourceKey":[1025,"selected-source-key"],"maxHeight":[2,"max-height"],"searchable":[4],"matchTargetWidth":[4,"match-target-width"],"matchContainerHeight":[4,"match-container-height"],"caseSensitive":[4,"case-sensitive"],"searchString":[32],"show":[64],"hide":[64]},[[1,"mouseenter","onMouseEnter"],[0,"click","onClick"],[9,"mousedown","onMouseDown"]]],[4,"vega-carousel",{"perPage":[8,"per-page"],"showSlider":[4,"show-slider"],"spacing":[1],"page":[32],"totalPages":[32],"nextPage":[64],"prevPage":[64],"goToPage":[64]}],[4,"vega-grid",{"column":[2],"row":[2],"gap":[1]}],[0,"vega-input",{"inputId":[513,"id"],"label":[1],"value":[1537],"type":[1],"autocomplete":[1],"prefixIcon":[1,"prefix-icon"],"email":[4],"required":[1028],"min":[2],"max":[2],"minLength":[2,"min-length"],"maxLength":[2,"max-length"],"showClearIcon":[4,"show-clear-icon"],"isValid":[1540,"is-valid"],"autoValidation":[516,"auto-validation"],"formValidation":[2,"form-validation"],"validationRules":[16],"size":[1],"placeholder":[1],"disabled":[4],"hint":[1],"maskConfig":[16],"valid":[64]},[[0,"input","handleValueInput"]]],[0,"vega-button-circle",{"size":[1],"variant":[1],"icon":[513],"label":[1],"disabled":[4],"danger":[4]}],[4,"vega-tooltip",{"size":[8],"trigger":[1],"content":[1],"placement":[1],"positionRelativeTo":[1,"position-relative-to"]},[[0,"click","onClick"],[1,"mouseenter","onMouseEnter"],[1,"mouseleave","onMouseLeave"],[8,"keyup","onKeyDown"],[9,"mousedown","onMouseDown"]]],[0,"vega-flex",{"gap":[1],"margin":[1],"breakpoint":[1],"direction":[1],"alignItem":[1,"align-item"],"justifyContent":[1,"justify-content"]}],[0,"vega-icon",{"icon":[513],"size":[1]}]]],["vega-accordion.cjs",[[4,"vega-accordion",{"drawsBackground":[4,"draws-background"],"prefixIcon":[1,"prefix-icon"],"accordionTitle":[1,"accordion-title"],"expandIconAlign":[1,"expand-icon-align"],"expand":[1028],"showExpandIcon":[4,"show-expand-icon"],"groupId":[1,"group-id"]}]]],["vega-stepper.cjs",[[0,"vega-stepper",{"stepperId":[513,"id"],"max":[2],"min":[2],"value":[1538],"label":[1],"disabled":[4],"required":[4],"isValid":[1028,"is-valid"],"formValidation":[2,"form-validation"],"valid":[64]},[[0,"vegaChange","handleValueChange"],[0,"vegaValidate","handleVegaInputValidate"]]]]],["vega-item-toggle.cjs",[[0,"vega-item-toggle",{"itemToggleStatusMap":[16],"isToggled":[1028,"is-toggled"],"isError":[4,"is-error"],"toggleStatus":[32]}]]],["vega-option.cjs",[[4,"vega-option",{"label":[1],"subLabel":[1,"sub-label"],"icon":[1]},[[2,"vegaFocus","handleFocus"],[2,"vegaBlur","handleBlur"],[3,"mousedown","handleMousedown"],[3,"mouseup","handleMouseup"],[3,"mouseout","handleMouseout"],[2,"click","handleClick"]]]]],["vega-checkbox-group.cjs",[[4,"vega-checkbox-group",{"label":[1],"value":[1025],"name":[1],"vegaFlexProp":[16],"disabled":[4],"required":[4],"hint":[1],"formValidation":[2,"form-validation"],"isValid":[1540,"is-valid"],"valid":[64]},[[0,"vegaChange","changeValue"]]]]],["vega-header.cjs",[[4,"vega-header",{"menuShown":[32]}]]],["vega-radio-group.cjs",[[4,"vega-radio-group",{"label":[1],"value":[1025],"name":[1],"vegaFlexProp":[16],"required":[4],"hint":[1],"formValidation":[2,"form-validation"],"isValid":[1540,"is-valid"],"valid":[64]},[[0,"vegaChange","changeValue"]]]]],["vega-toggle-switch.cjs",[[0,"vega-toggle-switch",{"checked":[1540],"size":[1],"label":[1],"disabled":[4]}]]],["vega-app-footer.cjs",[[0,"vega-app-footer",{"tosUrl":[1,"tos-url"],"privacyUrl":[1,"privacy-url"],"showDisclaimer":[4,"show-disclaimer"]}]]],["vega-badge.cjs",[[0,"vega-badge",{"bgColor":[1,"bg-color"],"textColor":[1,"text-color"],"text":[1],"size":[1]}]]],["vega-form.cjs",[[1,"vega-form",{"isValid":[1028,"is-valid"],"isTouched":[1028,"is-touched"],"valid":[64],"getValue":[64],"setValue":[64],"reset":[64]},[[0,"vegaValidate","updateInternalValidStatus"],[0,"vegaChange","updateInternalTouchedStatus"]]]]],["vega-radio.cjs",[[4,"vega-radio",{"value":[1025],"name":[1],"checked":[4],"disabled":[4]}]]],["vega-card.cjs",[[4,"vega-card",{"padding":[1],"margin":[1],"shadow":[1],"backgroundColor":[1,"background-color"]}]]]], options);
20
+ return index.bootstrapLazy([["vega-button_22.cjs",[[0,"vega-tab-group",{"selectedTabDataTarget":[1,"selected-tab-data-target"],"gap":[1],"showCloseButton":[4,"show-close-button"],"tabItems":[16],"positionRelativeTo":[1,"position-relative-to"],"tabPages":[32],"tabWidthArray":[32],"currentPageIndex":[32]},[[0,"vegaPageUpdate","onCarouselPageUpdate"]]],[4,"vega-table",{"columns":[16],"dataSource":[16],"rowSelection":[1040],"rowExpandable":[4,"row-expandable"],"rowClickable":[4,"row-clickable"],"rowDivider":[4,"row-divider"],"columnDivider":[4,"column-divider"],"striped":[4],"density":[1],"paddingX":[16],"showHeader":[4,"show-header"],"pagination":[16],"emptyDescription":[1,"empty-description"],"selectedRowKeySet":[32],"expandedRowKeySet":[32],"currentBreakpoint":[32],"sortersMap":[32],"currentData":[32],"currentClickedRowIndex":[32],"currentPage":[32],"openExpandRow":[64],"closeExpandRow":[64],"closeAllExpandRow":[64],"toggleExpandRow":[64],"clearSelection":[64],"getSelection":[64],"setSelection":[64]}],[0,"vega-date-picker",{"mode":[1],"value":[1537],"label":[1],"required":[4],"isValid":[1540,"is-valid"],"autoValidation":[516,"auto-validation"],"format":[1],"size":[1],"formValidation":[2,"form-validation"],"validationRules":[16],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"placeholder":[1],"clearButton":[4,"clear-button"],"readOnly":[4,"read-only"],"allowRepick":[4,"allow-repick"],"dropdownConfig":[16],"disabled":[516],"valid":[64],"doClose":[64],"doOpen":[64]}],[0,"vega-input-select",{"label":[1],"required":[1028],"source":[1040],"value":[1537],"isValid":[1540,"is-valid"],"autoValidation":[4,"auto-validation"],"formValidation":[2,"form-validation"],"validationRules":[16],"prefixIcon":[1,"prefix-icon"],"disabled":[516],"placeholder":[1],"hint":[1],"vegaDropdownProps":[16],"isDropdownShow":[32],"doClose":[64],"doOpen":[64],"doChange":[64],"valid":[64]}],[0,"vega-progress-tracker",{"direction":[1],"steps":[16],"completedStepArray":[16],"canClickStep":[4,"can-click-step"],"current":[32],"nextStep":[64],"prevStep":[64],"setCurrent":[64],"getCurrent":[64]},[[0,"vegaPageUpdate","onVegaPageUpdateHandler"]]],[4,"vega-sidenav",{"source":[16],"footnote":[1],"headerConfig":[16],"openByDefault":[1,"open-by-default"],"openState":[32],"toggle":[64]},[[0,"vegaClick","onVegaClickHandler"],[10,"click","collapseSidenavByBackDropClick"]]],[0,"vega-button",{"size":[1],"variant":[1],"icon":[1],"iconAlign":[1,"icon-align"],"label":[1025],"disabled":[4],"danger":[4],"block":[4]}],[4,"vega-footer",{"tosUrl":[1,"tos-url"],"privacyUrl":[1,"privacy-url"]}],[4,"vega-modal",{"backdrop":[1],"size":[8],"open":[1028],"animation":[4],"modalTitle":[1,"modal-title"],"backdropColor":[1,"backdrop-color"],"isVerticallyCenter":[4,"is-vertically-center"],"showCloseButton":[4,"show-close-button"],"padding":[1],"contentMaxHeight":[2,"content-max-height"],"modal":[64]},[[10,"click","listenDataTarget"],[0,"click","listenDataDismiss"]]],[0,"vega-pagination",{"current":[1538],"total":[2],"pageSize":[2,"page-size"]}],[0,"vega-button-link",{"link":[1],"size":[1],"icon":[513],"iconType":[1,"icon-type"],"iconAlign":[1,"icon-align"],"label":[1025],"disabled":[4],"danger":[4],"eventful":[4]}],[4,"vega-checkbox",{"value":[1],"name":[1],"checked":[1028],"disabled":[4],"size":[1]}],[4,"vega-sidenav-group",{"icon":[1],"label":[1]}],[4,"vega-sidenav-link",{"icon":[1],"selected":[1540],"url":[1],"showSideBarOnClickLink":[4,"show-side-bar-on-click-link"]}],[4,"vega-dropdown",{"size":[8],"trigger":[1],"translocation":[16],"source":[1040],"positionRelativeTo":[1,"position-relative-to"],"selectType":[1,"select-type"],"selectedSourceKey":[1025,"selected-source-key"],"maxHeight":[2,"max-height"],"searchable":[4],"matchTargetWidth":[4,"match-target-width"],"matchContainerHeight":[4,"match-container-height"],"caseSensitive":[4,"case-sensitive"],"searchString":[32],"show":[64],"hide":[64]},[[1,"mouseenter","onMouseEnter"],[0,"click","onClick"],[9,"mousedown","onMouseDown"]]],[4,"vega-carousel",{"perPage":[8,"per-page"],"showSlider":[4,"show-slider"],"spacing":[1],"page":[32],"totalPages":[32],"nextPage":[64],"prevPage":[64],"goToPage":[64]}],[4,"vega-grid",{"column":[2],"row":[2],"gap":[1]}],[0,"vega-input",{"inputId":[513,"id"],"label":[1],"value":[1537],"type":[1],"autocomplete":[1],"prefixIcon":[1,"prefix-icon"],"email":[4],"required":[1028],"min":[2],"max":[2],"minLength":[2,"min-length"],"maxLength":[2,"max-length"],"showClearIcon":[4,"show-clear-icon"],"isValid":[1540,"is-valid"],"autoValidation":[516,"auto-validation"],"formValidation":[2,"form-validation"],"validationRules":[16],"size":[1],"placeholder":[1],"disabled":[516],"hint":[1],"maskConfig":[16],"valid":[64]},[[0,"input","handleValueInput"]]],[0,"vega-button-circle",{"size":[1],"variant":[1],"icon":[513],"label":[1],"disabled":[4],"danger":[4]}],[4,"vega-tooltip",{"size":[8],"trigger":[1],"content":[1],"placement":[1],"positionRelativeTo":[1,"position-relative-to"]},[[0,"click","onClick"],[1,"mouseenter","onMouseEnter"],[1,"mouseleave","onMouseLeave"],[8,"keyup","onKeyDown"],[9,"mousedown","onMouseDown"]]],[0,"vega-flex",{"gap":[1],"margin":[1],"breakpoint":[1],"direction":[1],"alignItem":[1,"align-item"],"justifyContent":[1,"justify-content"]}],[0,"vega-icon",{"icon":[513],"size":[1]}]]],["vega-accordion.cjs",[[4,"vega-accordion",{"drawsBackground":[4,"draws-background"],"prefixIcon":[1,"prefix-icon"],"accordionTitle":[1,"accordion-title"],"expandIconAlign":[1,"expand-icon-align"],"expand":[1028],"showExpandIcon":[4,"show-expand-icon"],"groupId":[1,"group-id"]}]]],["vega-stepper.cjs",[[0,"vega-stepper",{"stepperId":[513,"id"],"max":[2],"min":[2],"value":[1538],"label":[1],"inputEditable":[4,"input-editable"],"disabled":[516],"required":[4],"isValid":[1028,"is-valid"],"formValidation":[2,"form-validation"],"valid":[64]},[[0,"vegaChange","handleValueChange"],[0,"vegaValidate","handleVegaInputValidate"]]]]],["vega-item-toggle.cjs",[[0,"vega-item-toggle",{"itemToggleStatusMap":[16],"isToggled":[1028,"is-toggled"],"isError":[4,"is-error"],"toggleStatus":[32]}]]],["vega-option.cjs",[[4,"vega-option",{"label":[1],"subLabel":[1,"sub-label"],"icon":[1]},[[2,"vegaFocus","handleFocus"],[2,"vegaBlur","handleBlur"],[3,"mousedown","handleMousedown"],[3,"mouseup","handleMouseup"],[3,"mouseout","handleMouseout"],[2,"click","handleClick"]]]]],["vega-checkbox-group.cjs",[[4,"vega-checkbox-group",{"label":[1],"value":[16],"name":[1],"vegaFlexProp":[16],"disabled":[516],"required":[4],"hint":[1],"formValidation":[2,"form-validation"],"isValid":[1028,"is-valid"],"valid":[64]},[[0,"vegaChange","changeValue"]]]]],["vega-header.cjs",[[4,"vega-header",{"menuShown":[32]}]]],["vega-radio-group.cjs",[[4,"vega-radio-group",{"label":[1],"value":[1025],"name":[1],"vegaFlexProp":[16],"required":[4],"hint":[1],"formValidation":[2,"form-validation"],"isValid":[1028,"is-valid"],"disabled":[4],"valid":[64]},[[0,"vegaChange","changeValue"]]]]],["vega-toggle-switch.cjs",[[0,"vega-toggle-switch",{"checked":[1540],"size":[1],"label":[1],"disabled":[4]}]]],["vega-app-footer.cjs",[[0,"vega-app-footer",{"tosUrl":[1,"tos-url"],"privacyUrl":[1,"privacy-url"],"showDisclaimer":[4,"show-disclaimer"]}]]],["vega-badge.cjs",[[0,"vega-badge",{"bgColor":[1,"bg-color"],"textColor":[1,"text-color"],"text":[1],"size":[1]}]]],["vega-form.cjs",[[1,"vega-form",{"isValid":[1028,"is-valid"],"isTouched":[1028,"is-touched"],"valid":[64],"getValue":[64],"setValue":[64],"reset":[64]},[[0,"vegaValidate","updateInternalValidStatus"],[0,"vegaChange","updateInternalTouchedStatus"]]]]],["vega-radio.cjs",[[4,"vega-radio",{"value":[1],"name":[1],"checked":[4],"disabled":[4]}]]],["vega-card.cjs",[[4,"vega-card",{"padding":[1],"margin":[1],"shadow":[1],"backgroundColor":[1,"background-color"]}]]]], options);
21
21
  });
22
22
  };
23
23
 
@@ -67,6 +67,35 @@ class ChangeManager {
67
67
  }
68
68
  const ChangeManager$1 = new ChangeManager();
69
69
 
70
+ /**
71
+ * An Observer is a class that has a listener method that accepts a value of type T
72
+ * and calls the listener method with a value of type T
73
+ */
74
+ class Observer {
75
+ /**
76
+ * It accepts a function that accepts a value and returns a boolean, and a function that accepts a value of the type that
77
+ * the first function accepts
78
+ *
79
+ * @typedef T generic type parameter
80
+ * @param {(input: unknown) => input is T} accept - A function that indicate if the input is acceptable by the observer
81
+ * @param {(input: T) => void} listener - A function handle the input for the observer if the input is accepted
82
+ */
83
+ constructor(accept, listener) {
84
+ this.accept = accept;
85
+ this.listener = listener;
86
+ }
87
+ /**
88
+ * If the input is of the type that this handler is interested in, then call the listener function
89
+ *
90
+ * @param {unknown} input - unknown
91
+ */
92
+ notify(input) {
93
+ if (this.accept(input)) {
94
+ this.listener(input);
95
+ }
96
+ }
97
+ }
98
+
70
99
  /**
71
100
  * A subject class is used for register by observer
72
101
  */
@@ -91,8 +120,11 @@ class Subject {
91
120
  const SIDENAV_LINK_SELECTED_TOPIC = new Subject('SIDENAV_LINK_SELECTED_TOPIC');
92
121
  const ACCORDION_EXPAND_TOPIC = new Subject('ACCORDION_EXPAND_TOPIC');
93
122
  const FORM_CONTROLLED_FIELD_DISABLED_STATUS_CHANGE = new Subject('FORM_CONTROLLED_FIELD_DISABLED_STATUS_CHANGE');
123
+ const FORM_RESET_OPERATION_TRIGGERED = new Subject('FORM_RESET_OPERATION_TRIGGERED');
94
124
 
95
125
  exports.ACCORDION_EXPAND_TOPIC = ACCORDION_EXPAND_TOPIC;
96
126
  exports.ChangeManager = ChangeManager$1;
97
127
  exports.FORM_CONTROLLED_FIELD_DISABLED_STATUS_CHANGE = FORM_CONTROLLED_FIELD_DISABLED_STATUS_CHANGE;
128
+ exports.FORM_RESET_OPERATION_TRIGGERED = FORM_RESET_OPERATION_TRIGGERED;
129
+ exports.Observer = Observer;
98
130
  exports.SIDENAV_LINK_SELECTED_TOPIC = SIDENAV_LINK_SELECTED_TOPIC;