@globalpayments/vega 2.39.0 → 2.40.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.
- package/dist/cjs/{app-globals-dd3e7925.js → app-globals-cdd0972c.js} +12 -1
- package/dist/cjs/check-box-required-rule-1ee54b9a.js +70 -0
- package/dist/cjs/date-required-rule-4e1f84fd.js +92 -0
- package/dist/cjs/{element-appender-slimmer-c6e0f4ca.js → element-appender-slimmer-4f0dc8c6.js} +9 -5
- package/dist/cjs/file-uploader-required-rule-313ec9e3.js +21 -0
- package/dist/cjs/{form-field-controller-slimmer-48c0ad0b.js → form-field-controller-slimmer-d92e8212.js} +28 -1
- package/dist/cjs/index.cjs.js +22 -1
- package/dist/cjs/input-phone-number-required-rule-2668fdf1.js +65 -0
- package/dist/cjs/input-range-required-rule-5b9c2a95.js +63 -0
- package/dist/cjs/internal-form-field-validation-rule.abstract-07cdff46.js +15 -0
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/{min-number-rule-115c5a3b.js → min-number-rule-5bcccc8f.js} +7 -4
- package/dist/cjs/{min-string-length-rule-75f24a48.js → min-string-length-rule-af215976.js} +8 -4
- package/dist/cjs/public-rules-90b972e5.js +42 -0
- package/dist/cjs/{required-field-rule-7f9945fa.js → required-field-rule-d73c1d8c.js} +6 -3
- package/dist/cjs/rich-text-editor-required-rule-cacc5fe0.js +64 -0
- package/dist/cjs/time-required-rule-ccf178e7.js +141 -0
- package/dist/cjs/toggle-switch-required-rule-88a51b36.js +66 -0
- package/dist/cjs/{valid-credit-card-number-rule-4a9ae5d9.js → valid-credit-card-number-rule-4a1b00b8.js} +3 -2
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +11 -79
- package/dist/cjs/vega-color-picker.cjs.entry.js +3 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +3 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +8 -90
- package/dist/cjs/vega-dialog_2.cjs.entry.js +29 -1
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +1 -1
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +5 -19
- package/dist/cjs/vega-form.cjs.entry.js +2 -1
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +4 -3
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +7 -63
- package/dist/cjs/vega-input-range.cjs.entry.js +6 -61
- package/dist/cjs/vega-input-select.cjs.entry.js +3 -2
- package/dist/cjs/vega-input.cjs.entry.js +7 -6
- package/dist/cjs/vega-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-radio_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +4 -60
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +3 -2
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -2
- package/dist/cjs/vega-stepper.cjs.entry.js +3 -2
- package/dist/cjs/vega-textarea.cjs.entry.js +4 -3
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +11 -140
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +4 -63
- package/dist/cjs/vega-tooltip_2.cjs.entry.js +53 -12
- package/dist/cjs/vega.cjs.js +3 -2
- package/dist/collection/components/vega-checkbox/vega-checkbox.css +82 -33
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +8 -13
- package/dist/collection/components/vega-file-uploader/vega-file-uploader.js +2 -2
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.js +9 -0
- package/dist/collection/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.js +16 -0
- package/dist/collection/components/vega-modal/vega-modal.js +6 -0
- package/dist/collection/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.js +45 -11
- package/dist/collection/components/vega-tooltip/vega-tooltip.js +12 -0
- package/dist/collection/global/scripts/before-vega-load.js +11 -0
- package/dist/collection/helpers/slimmers/element-appender-slimmer.js +8 -5
- package/dist/collection/helpers/slimmers/test/element-appender-slimmer.test.js +2 -0
- package/dist/collection/helpers/ui/element-appender.js +1 -0
- package/dist/collection/helpers/ui/test/element-appender.test.js +1 -0
- package/dist/collection/helpers/validator/form-field-controller.js +28 -1
- package/dist/collection/helpers/validator/public-rules.js +10 -0
- package/dist/collection/helpers/validator/rules/check-box-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/date-range-rule.js +2 -1
- package/dist/collection/helpers/validator/rules/date-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/email-field-rule.js +3 -2
- package/dist/collection/helpers/validator/rules/{object-array-required-rule.js → file-uploader-required-rule.js} +1 -1
- package/dist/collection/helpers/validator/rules/input-phone-number-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/input-range-min-and-max-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/input-range-required-rule.js +5 -4
- package/dist/collection/helpers/validator/rules/internal-form-field-validation-rule.abstract.js +11 -0
- package/dist/collection/helpers/validator/rules/max-number-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/max-string-length-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/min-and-max-date-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/min-number-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/min-string-length-rule.js +4 -2
- package/dist/collection/helpers/validator/rules/required-field-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/rich-text-editor-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/time-range-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/time-range-rule.js +3 -1
- package/dist/collection/helpers/validator/rules/time-required-rule.js +5 -3
- package/dist/collection/helpers/validator/rules/toggle-switch-required-rule.js +4 -3
- package/dist/collection/helpers/validator/rules/valid-credit-card-number-rule.js +3 -2
- package/dist/collection/helpers/validator/rules/valid-phone-number-rule.js +4 -2
- package/dist/collection/helpers/validator/test/rules/file-uploader-required-rule.test.js +7 -0
- package/dist/collection/helpers/validator/test/rules/public-rules.test.js +80 -0
- package/dist/collection/index.js +1 -0
- package/dist/esm/{app-globals-c954167a.js → app-globals-88fa3549.js} +12 -1
- package/dist/esm/check-box-required-rule-cb0aa339.js +68 -0
- package/dist/esm/{date-732bc749.js → date-c55b97f0.js} +1 -1
- package/dist/esm/date-required-rule-8944f3bf.js +90 -0
- package/dist/esm/{element-appender-slimmer-f5e703f3.js → element-appender-slimmer-d9155ee0.js} +9 -5
- package/dist/esm/file-uploader-required-rule-ad886d01.js +19 -0
- package/dist/esm/{form-field-controller-slimmer-7a9f2b2e.js → form-field-controller-slimmer-bb64dec7.js} +28 -1
- package/dist/esm/index.js +12 -1
- package/dist/esm/input-phone-number-required-rule-be6a5572.js +63 -0
- package/dist/esm/input-range-required-rule-3ad74776.js +61 -0
- package/dist/esm/internal-form-field-validation-rule.abstract-f5b6bdbf.js +13 -0
- package/dist/esm/loader.js +3 -2
- package/dist/esm/{min-number-rule-31d48b22.js → min-number-rule-a6082418.js} +7 -4
- package/dist/esm/{min-string-length-rule-c6a69eeb.js → min-string-length-rule-c31c89f4.js} +8 -4
- package/dist/esm/public-rules-413f6a17.js +27 -0
- package/dist/esm/{required-field-rule-368b31fa.js → required-field-rule-ab4bdc47.js} +6 -3
- package/dist/esm/rich-text-editor-required-rule-75cc2db0.js +62 -0
- package/dist/esm/time-required-rule-a01163b5.js +138 -0
- package/dist/esm/toggle-switch-required-rule-b3cf4302.js +64 -0
- package/dist/esm/{valid-credit-card-number-rule-2aef3ad5.js → valid-credit-card-number-rule-cc497bec.js} +3 -2
- package/dist/esm/vega-calendar_3.entry.js +1 -1
- package/dist/esm/vega-checkbox_2.entry.js +11 -79
- package/dist/esm/vega-color-picker.entry.js +3 -2
- package/dist/esm/vega-combo-box.entry.js +3 -2
- package/dist/esm/vega-date-picker_2.entry.js +8 -90
- package/dist/esm/vega-dialog_2.entry.js +29 -1
- package/dist/esm/vega-dropdown_5.entry.js +1 -1
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +5 -19
- package/dist/esm/vega-form.entry.js +2 -1
- package/dist/esm/vega-image-uploader.entry.js +3 -2
- package/dist/esm/vega-input-credit-card.entry.js +4 -3
- package/dist/esm/vega-input-numeric.entry.js +3 -2
- package/dist/esm/vega-input-phone-number.entry.js +6 -62
- package/dist/esm/vega-input-range.entry.js +5 -60
- package/dist/esm/vega-input-select.entry.js +3 -2
- package/dist/esm/vega-input.entry.js +7 -6
- package/dist/esm/vega-popover_2.entry.js +1 -1
- package/dist/esm/vega-radio_2.entry.js +3 -2
- package/dist/esm/vega-rich-text-editor_4.entry.js +3 -59
- package/dist/esm/vega-selection-chip_2.entry.js +3 -2
- package/dist/esm/vega-selection-tile_2.entry.js +3 -2
- package/dist/esm/vega-signature-capture.entry.js +3 -2
- package/dist/esm/vega-stepper.entry.js +3 -2
- package/dist/esm/vega-textarea.entry.js +4 -3
- package/dist/esm/vega-time-picker_2.entry.js +7 -136
- package/dist/esm/vega-toggle-switch.entry.js +3 -62
- package/dist/esm/vega-tooltip_2.entry.js +53 -12
- package/dist/esm/vega.js +3 -2
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-layout-controller.d.ts +4 -0
- package/dist/types/components/vega-modal/slimmers/controllers/vega-modal-scroll-controller.d.ts +5 -0
- package/dist/types/components/vega-modal/vega-modal.d.ts +1 -0
- package/dist/types/components/vega-tooltip/slimmers/controllers/vega-tooltip-element-appender-controller.d.ts +18 -0
- package/dist/types/components/vega-tooltip/vega-tooltip.d.ts +4 -0
- package/dist/types/helpers/slimmers/element-appender-slimmer.d.ts +1 -0
- package/dist/types/helpers/slimmers/form-field-controller-slimmer.d.ts +2 -1
- package/dist/types/helpers/validator/form-field-controller.d.ts +10 -0
- package/dist/types/helpers/validator/public-rules.d.ts +10 -0
- package/dist/types/helpers/validator/rules/check-box-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/date-range-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/date-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/email-field-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/{object-array-required-rule.d.ts → file-uploader-required-rule.d.ts} +1 -1
- package/dist/types/helpers/validator/rules/input-phone-number-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/input-range-min-and-max-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/input-range-required-rule.d.ts +8 -7
- package/dist/types/helpers/validator/rules/internal-form-field-validation-rule.abstract.d.ts +19 -0
- package/dist/types/helpers/validator/rules/max-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/max-string-length-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/min-and-max-date-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/min-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/min-string-length-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/required-field-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/rich-text-editor-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/time-range-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/time-range-rule.d.ts +3 -2
- package/dist/types/helpers/validator/rules/time-required-rule.d.ts +7 -6
- package/dist/types/helpers/validator/rules/toggle-switch-required-rule.d.ts +5 -4
- package/dist/types/helpers/validator/rules/valid-credit-card-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/rules/valid-phone-number-rule.d.ts +4 -3
- package/dist/types/helpers/validator/test/rules/public-rules.test.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/public-api.d.ts +1 -1
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/p-04c72f30.entry.js +1 -0
- package/dist/vega/p-07c2725a.js +1 -0
- package/dist/vega/{p-b5990090.js → p-08835909.js} +1 -1
- package/dist/vega/p-0b6d4561.entry.js +1 -0
- package/dist/vega/p-0bb860cc.js +1 -0
- package/dist/vega/p-113cd659.entry.js +1 -0
- package/dist/vega/{p-64e49394.entry.js → p-154d262e.entry.js} +1 -1
- package/dist/vega/p-17598aac.entry.js +1 -0
- package/dist/vega/p-23130825.entry.js +1 -0
- package/dist/vega/p-280cbcdb.js +1 -0
- package/dist/vega/{p-4b19706c.entry.js → p-3299c30b.entry.js} +1 -1
- package/dist/vega/p-3fd9d39f.entry.js +1 -0
- package/dist/vega/p-42a949f5.entry.js +1 -0
- package/dist/vega/p-4bd1b877.entry.js +1 -0
- package/dist/vega/p-590fd123.js +1 -0
- package/dist/vega/{p-d2e6090a.js → p-5a7eabcc.js} +1 -1
- package/dist/vega/p-5e56f3bd.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/p-612c9374.entry.js +1 -0
- package/dist/vega/{p-9ee23f34.entry.js → p-6585bddc.entry.js} +2 -2
- package/dist/vega/p-6603081a.entry.js +1 -0
- package/dist/vega/p-6f90d444.js +1 -0
- package/dist/vega/p-7303fff2.entry.js +1 -0
- package/dist/vega/p-7b648a05.entry.js +1 -0
- package/dist/vega/p-7c0b4c36.js +1 -0
- package/dist/vega/p-81b21503.entry.js +1 -0
- package/dist/vega/p-8fae8f9e.js +1 -0
- package/dist/vega/p-924b4e24.js +1 -0
- package/dist/vega/{p-ea78ddfa.entry.js → p-94459733.entry.js} +1 -1
- package/dist/vega/p-a05ca459.entry.js +1 -0
- package/dist/vega/p-a3e80fb2.entry.js +1 -0
- package/dist/vega/p-a7a46358.entry.js +1 -0
- package/dist/vega/p-abd7aeaa.js +1 -0
- package/dist/vega/p-b24da503.entry.js +1 -0
- package/dist/vega/p-b44f3309.js +1 -0
- package/dist/vega/p-b9051ad2.js +1 -0
- package/dist/vega/{p-4ab0d645.js → p-c253d09c.js} +1 -1
- package/dist/vega/p-c56acdd5.entry.js +1 -0
- package/dist/vega/p-cdbbdcc2.js +1 -0
- package/dist/vega/p-d1a06058.entry.js +1 -0
- package/dist/vega/p-d51b04ce.entry.js +1 -0
- package/dist/vega/p-e0446879.js +1 -0
- package/dist/vega/p-e08b6542.entry.js +1 -0
- package/dist/vega/p-f396c69a.js +1 -0
- package/dist/vega/p-fda6c178.entry.js +1 -0
- package/dist/vega/p-ffac4b8c.entry.js +1 -0
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/collection/helpers/validator/test/rules/object-array-required-rule.test.js +0 -7
- package/dist/vega/p-0b697841.entry.js +0 -1
- package/dist/vega/p-257b1bc2.entry.js +0 -1
- package/dist/vega/p-3152031c.js +0 -1
- package/dist/vega/p-3c85a11b.entry.js +0 -1
- package/dist/vega/p-49bf2b3a.js +0 -1
- package/dist/vega/p-4a8db510.entry.js +0 -1
- package/dist/vega/p-4e436842.entry.js +0 -1
- package/dist/vega/p-59834ea4.entry.js +0 -1
- package/dist/vega/p-59cfed37.entry.js +0 -1
- package/dist/vega/p-60e1ebe1.entry.js +0 -1
- package/dist/vega/p-629bd266.entry.js +0 -1
- package/dist/vega/p-64e0c944.entry.js +0 -1
- package/dist/vega/p-66b9e86d.entry.js +0 -1
- package/dist/vega/p-74958b1a.js +0 -1
- package/dist/vega/p-74ff73d6.entry.js +0 -1
- package/dist/vega/p-8120e7a1.entry.js +0 -1
- package/dist/vega/p-894c067a.entry.js +0 -1
- package/dist/vega/p-989b36a2.entry.js +0 -1
- package/dist/vega/p-a8a809e1.entry.js +0 -1
- package/dist/vega/p-b6bffdf3.entry.js +0 -1
- package/dist/vega/p-bf6d3c00.entry.js +0 -1
- package/dist/vega/p-c00fde35.entry.js +0 -1
- package/dist/vega/p-c2e96537.entry.js +0 -1
- package/dist/vega/p-ce94a9c5.entry.js +0 -1
- package/dist/vega/p-d03945cb.entry.js +0 -1
- package/dist/vega/p-f41102cd.js +0 -1
- package/dist/vega/p-f5b0ce61.js +0 -1
- package/dist/vega/p-fc49a98e.entry.js +0 -1
- /package/dist/types/helpers/validator/test/rules/{object-array-required-rule.test.d.ts → file-uploader-required-rule.test.d.ts} +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { i as isDateStr } from './date-c55b97f0.js';
|
|
2
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A rule that checks if date is empty or not
|
|
6
|
+
*
|
|
7
|
+
* @augments {InternalFormFieldValidationRule<string | string[]>}
|
|
8
|
+
*/
|
|
9
|
+
class DateRequiredRule extends InternalFormFieldValidationRule {
|
|
10
|
+
/**
|
|
11
|
+
* It creates a new instance of the class with the given config.
|
|
12
|
+
*
|
|
13
|
+
* @param {{ mode: 'single' | 'range' }} config - config including the mode for date value
|
|
14
|
+
* @param {'single' | 'range'} config.mode - The mode for date value
|
|
15
|
+
*/
|
|
16
|
+
constructor(config) {
|
|
17
|
+
super();
|
|
18
|
+
this.config = config;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* If the input is not valid for the current mode, throw an error.
|
|
22
|
+
* Otherwise, return an object with a boolean indicating whether the input is valid and a message to display to the user
|
|
23
|
+
*
|
|
24
|
+
* @param {string | string[]} input - The value of the input field.
|
|
25
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
26
|
+
*/
|
|
27
|
+
evaluate(input) {
|
|
28
|
+
if (!this.isAcceptedInputType(input)) {
|
|
29
|
+
throw new Error(`Invalid date value ${input} for mode ${this.config.mode}`);
|
|
30
|
+
}
|
|
31
|
+
let isValid;
|
|
32
|
+
switch (this.config.mode) {
|
|
33
|
+
case 'single':
|
|
34
|
+
isValid = isDateStr(input);
|
|
35
|
+
break;
|
|
36
|
+
case 'range':
|
|
37
|
+
isValid = Array.isArray(input) && input.length === 2 && input.every(isDateStr);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
isValid,
|
|
42
|
+
message: isValid ? '' : 'This field is required',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
47
|
+
*
|
|
48
|
+
* @param {unknown} input - The input to be evaluated.
|
|
49
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
50
|
+
* @returns {boolean} A boolean value.
|
|
51
|
+
*/
|
|
52
|
+
canEvaluate(input, status) {
|
|
53
|
+
return status
|
|
54
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
55
|
+
: this.isAcceptedInputType(input);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
59
|
+
*
|
|
60
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
61
|
+
* @returns {boolean} A boolean value.
|
|
62
|
+
*/
|
|
63
|
+
shouldShowError(status) {
|
|
64
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* If the input is undefined or null, return true. Otherwise, if the mode is 'single', return true if
|
|
68
|
+
* the input is a string. Otherwise, if the mode is 'range', return true if the input is an array. Otherwise, return false.
|
|
69
|
+
*
|
|
70
|
+
* @param {unknown} input - The input value that the user has entered.
|
|
71
|
+
* @returns {boolean} A boolean value.
|
|
72
|
+
*/
|
|
73
|
+
isAcceptedInputType(input) {
|
|
74
|
+
if (input === undefined || input === null)
|
|
75
|
+
return true;
|
|
76
|
+
if (!this.config.mode) {
|
|
77
|
+
throw new Error(`Unexpected type of mode: ${this.config.mode}`);
|
|
78
|
+
}
|
|
79
|
+
switch (this.config.mode) {
|
|
80
|
+
case 'single':
|
|
81
|
+
return typeof input === 'string';
|
|
82
|
+
case 'range':
|
|
83
|
+
return Array.isArray(input);
|
|
84
|
+
default:
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { DateRequiredRule as D };
|
package/dist/esm/{element-appender-slimmer-f5e703f3.js → element-appender-slimmer-d9155ee0.js}
RENAMED
|
@@ -953,6 +953,7 @@ class ElementAppender {
|
|
|
953
953
|
if (!this.showConfig)
|
|
954
954
|
return;
|
|
955
955
|
this.removeVisibleAppendElement(this.showConfig.appendableElement);
|
|
956
|
+
this.resetContainerPosition();
|
|
956
957
|
InternalVegaZIndexManager.removeZIndex(this.showConfig.appendableElement, 'base');
|
|
957
958
|
this.showConfig.appendableElement.remove();
|
|
958
959
|
this.disconnectResizeObserver();
|
|
@@ -1243,10 +1244,7 @@ class ElementAppenderSlimmer extends VegaSlimmer {
|
|
|
1243
1244
|
}
|
|
1244
1245
|
disconnectedCallback() {
|
|
1245
1246
|
this.unRegisterElementAppenderListener();
|
|
1246
|
-
|
|
1247
|
-
this.elementAppender.destroy();
|
|
1248
|
-
this.elementAppender = null;
|
|
1249
|
-
}
|
|
1247
|
+
this.destroyElementAppender();
|
|
1250
1248
|
}
|
|
1251
1249
|
componentDidLoad() {
|
|
1252
1250
|
this.initElementAppender();
|
|
@@ -1263,13 +1261,19 @@ class ElementAppenderSlimmer extends VegaSlimmer {
|
|
|
1263
1261
|
this[this.isDropdownShowName] = false;
|
|
1264
1262
|
}
|
|
1265
1263
|
destroy() {
|
|
1266
|
-
this.
|
|
1264
|
+
this.destroyElementAppender();
|
|
1267
1265
|
this[this.isDropdownShowName] = false;
|
|
1268
1266
|
}
|
|
1269
1267
|
updateShowConfigFactory(showConfigFactory) {
|
|
1270
1268
|
this.showConfigFactory = showConfigFactory;
|
|
1271
1269
|
this.initElementAppender();
|
|
1272
1270
|
}
|
|
1271
|
+
destroyElementAppender() {
|
|
1272
|
+
if (this.elementAppender) {
|
|
1273
|
+
this.elementAppender.destroy();
|
|
1274
|
+
this.elementAppender = null;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1273
1277
|
initElementAppender() {
|
|
1274
1278
|
this.setShowConfig();
|
|
1275
1279
|
this.setElementAppender();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A rule that checks the value is empty or not which value type is object array
|
|
5
|
+
*/
|
|
6
|
+
class FileUploaderRequiredRule extends RequiredFieldRule {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
/**
|
|
10
|
+
* re-define the object array check item type method
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown} item the array item
|
|
13
|
+
* @returns {boolean} true or false
|
|
14
|
+
*/
|
|
15
|
+
this.checkArrayItemType = (item) => !!(item && typeof item === 'object');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { FileUploaderRequiredRule as F };
|
|
@@ -10,6 +10,7 @@ import { d as domNodeSubjectFactory } from './dom-node-subject-factory-97deb349.
|
|
|
10
10
|
import { c as VegaInternalFieldErrorStateChange, d as VegaInternalValid } from './vega-internal-event-id-f269c42f.js';
|
|
11
11
|
import { V as VegaInternalTranslation } from './translation-c08f2274.js';
|
|
12
12
|
import { P as PageResizeObserverSlimmer } from './page-resize-observer-slimmer-beb7b0bd.js';
|
|
13
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
13
14
|
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-857c65fa.js';
|
|
14
15
|
import { M as MutationObserverSlimmer } from './mutation-observer-slimmer-6cef9549.js';
|
|
15
16
|
import { A as AttributeOldValueMutationFilter } from './mutation-observer-filters-1035b064.js';
|
|
@@ -534,7 +535,11 @@ class FormFieldController {
|
|
|
534
535
|
* @returns {FormFieldValidationRule<number | string | boolean>[]} An array of FormFieldValidationRule<T>
|
|
535
536
|
*/
|
|
536
537
|
getRules() {
|
|
537
|
-
|
|
538
|
+
const additionalRules = [...this.additionalRules];
|
|
539
|
+
const overriddenDefaultRules = this.defaultRules.map((rule) => {
|
|
540
|
+
return this.overrideDefaultRuleByAdditionalRule(rule, additionalRules);
|
|
541
|
+
});
|
|
542
|
+
return [...overriddenDefaultRules, ...additionalRules];
|
|
538
543
|
}
|
|
539
544
|
/**
|
|
540
545
|
* Set the default rules for the form field.
|
|
@@ -822,6 +827,28 @@ class FormFieldController {
|
|
|
822
827
|
return isEnterKey;
|
|
823
828
|
}
|
|
824
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* It overrides the default rule by checking if the additional rules contain a custom rule that overrides.
|
|
832
|
+
* If it does, it returns that additional rule, and the rule will be removed from the additional rules array.
|
|
833
|
+
* otherwise, it returns the default rule.
|
|
834
|
+
*
|
|
835
|
+
* @param {InternalFormFieldValidationRule} defaultRule - The rule to be overridden.
|
|
836
|
+
* @param {FormFieldValidationRule[]} additionalRules - The additional rules to be applied.
|
|
837
|
+
* @returns {FormFieldValidationRule} The overridden rule.
|
|
838
|
+
*/
|
|
839
|
+
overrideDefaultRuleByAdditionalRule(defaultRule, additionalRules) {
|
|
840
|
+
if (defaultRule && additionalRules) {
|
|
841
|
+
const customRuleIndex = additionalRules.findIndex((customRule) => {
|
|
842
|
+
return (customRule instanceof InternalFormFieldValidationRule &&
|
|
843
|
+
customRule instanceof defaultRule.constructor &&
|
|
844
|
+
customRule.overrideDefault);
|
|
845
|
+
});
|
|
846
|
+
if (customRuleIndex > -1) {
|
|
847
|
+
return additionalRules.splice(customRuleIndex, 1)[0];
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return defaultRule;
|
|
851
|
+
}
|
|
825
852
|
}
|
|
826
853
|
__decorate$3([
|
|
827
854
|
InjectVegaSlimmer()
|
package/dist/esm/index.js
CHANGED
|
@@ -14,10 +14,19 @@ export { M as ModifyContentAction, e as RTEBlock, b as RTEImageBlock, f as RTEIm
|
|
|
14
14
|
export { V as VegaDialog } from './vega-dialog-controller-34eb8967.js';
|
|
15
15
|
export { B as VegaJQueryDelegatedEventStrategy } from './internal-vega-event-manager-0a01ba12.js';
|
|
16
16
|
export { V as VegaIconManager } from './icon-manager-b889176b.js';
|
|
17
|
-
export { V as ValidCreditCardNumberRule } from './valid-credit-card-number-rule-
|
|
17
|
+
export { V as ValidCreditCardNumberRule } from './valid-credit-card-number-rule-cc497bec.js';
|
|
18
18
|
export { w as waitForVega } from './index-d172bafa.js';
|
|
19
19
|
export { a as VegaTranslation, s as VegaTranslationResourceEN } from './translation-c08f2274.js';
|
|
20
20
|
export { G as GridColumns, a as GridRows } from './responsive-format-facade-661193d7.js';
|
|
21
|
+
export { C as CheckBoxRequiredRule } from './check-box-required-rule-cb0aa339.js';
|
|
22
|
+
export { D as DateRequiredRule } from './date-required-rule-8944f3bf.js';
|
|
23
|
+
export { I as InputPhoneNumberRequiredRule } from './input-phone-number-required-rule-be6a5572.js';
|
|
24
|
+
export { I as InputRangeRequiredRule } from './input-range-required-rule-3ad74776.js';
|
|
25
|
+
export { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
26
|
+
export { R as RichTextEditorRequiredRule } from './rich-text-editor-required-rule-75cc2db0.js';
|
|
27
|
+
export { T as TimeRangeRequiredRule, a as TimeRequiredRule } from './time-required-rule-a01163b5.js';
|
|
28
|
+
export { T as ToggleSwitchRequiredRule } from './toggle-switch-required-rule-b3cf4302.js';
|
|
29
|
+
export { F as FileUploaderRequiredRule } from './file-uploader-required-rule-ad886d01.js';
|
|
21
30
|
import './state-background-color-formatter-121ae7d3.js';
|
|
22
31
|
import './regex-dfe11abf.js';
|
|
23
32
|
import './create-public-api-runtime-metrics-slimmer-9ab05523.js';
|
|
@@ -33,7 +42,9 @@ import './dom-node-subject-factory-97deb349.js';
|
|
|
33
42
|
import './vega-internal-event-id-f269c42f.js';
|
|
34
43
|
import './static-subject-title-8268945e.js';
|
|
35
44
|
import './observer-3959f9dd.js';
|
|
45
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
36
46
|
import './pixel-f32c07ce.js';
|
|
47
|
+
import './date-c55b97f0.js';
|
|
37
48
|
|
|
38
49
|
/* This file is generated by vega-design 2.0.77 */
|
|
39
50
|
/* eslint-disable */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A rule that checks if input phone number is empty or not
|
|
5
|
+
*
|
|
6
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
7
|
+
*/
|
|
8
|
+
class InputPhoneNumberRequiredRule extends InternalFormFieldValidationRule {
|
|
9
|
+
constructor(phoneNumberValueGetter) {
|
|
10
|
+
super();
|
|
11
|
+
this.phoneNumberValueGetter = phoneNumberValueGetter;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* It checks if the input is a valid value.
|
|
15
|
+
*
|
|
16
|
+
* @param {unknown} input - The value of the input field.
|
|
17
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
18
|
+
*/
|
|
19
|
+
evaluate(input) {
|
|
20
|
+
if (!this.isAcceptedInputType(input)) {
|
|
21
|
+
throw new Error(`Invalid value ${input} for input phone number`);
|
|
22
|
+
}
|
|
23
|
+
const isValid = this.phoneNumberValueGetter() !== '';
|
|
24
|
+
return {
|
|
25
|
+
isValid,
|
|
26
|
+
message: isValid ? '' : 'This field is required',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
31
|
+
*
|
|
32
|
+
* @param {unknown} input - The input to be evaluated.
|
|
33
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
34
|
+
* @returns {boolean} A boolean value.
|
|
35
|
+
*/
|
|
36
|
+
canEvaluate(input, status) {
|
|
37
|
+
return status
|
|
38
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
39
|
+
: this.isAcceptedInputType(input);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
43
|
+
*
|
|
44
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
45
|
+
* @returns {boolean} A boolean value.
|
|
46
|
+
*/
|
|
47
|
+
shouldShowError(status) {
|
|
48
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a string.
|
|
52
|
+
*
|
|
53
|
+
* @param {unknown} input - The input value to be validated.
|
|
54
|
+
* @returns {boolean}A boolean.
|
|
55
|
+
*/
|
|
56
|
+
isAcceptedInputType(input) {
|
|
57
|
+
if (input === undefined || input === null)
|
|
58
|
+
return true;
|
|
59
|
+
return typeof input === 'string';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { InputPhoneNumberRequiredRule as I };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A rule that checks if the input range is empty or not
|
|
5
|
+
*
|
|
6
|
+
* @augments {InternalFormFieldValidationRule<string[]>}
|
|
7
|
+
*/
|
|
8
|
+
class InputRangeRequiredRule extends InternalFormFieldValidationRule {
|
|
9
|
+
/**
|
|
10
|
+
* It checks if the input is a valid value.
|
|
11
|
+
*
|
|
12
|
+
* @param {string[]} input - The value of the input field.
|
|
13
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
14
|
+
*/
|
|
15
|
+
evaluate(input) {
|
|
16
|
+
if (!this.isAcceptedInputType(input)) {
|
|
17
|
+
throw new Error(`Invalid value ${input} for input range`);
|
|
18
|
+
}
|
|
19
|
+
const isValid = Array.isArray(input) &&
|
|
20
|
+
input.length === 2 &&
|
|
21
|
+
input.every((item) => !!item || item == '0');
|
|
22
|
+
return {
|
|
23
|
+
isValid,
|
|
24
|
+
message: isValid ? '' : 'This field is required',
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
29
|
+
*
|
|
30
|
+
* @param {unknown} input - The input to be evaluated.
|
|
31
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
32
|
+
* @returns {boolean} A boolean value.
|
|
33
|
+
*/
|
|
34
|
+
canEvaluate(input, status) {
|
|
35
|
+
return status
|
|
36
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
37
|
+
: this.isAcceptedInputType(input);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
41
|
+
*
|
|
42
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
43
|
+
* @returns {boolean} A boolean value.
|
|
44
|
+
*/
|
|
45
|
+
shouldShowError(status) {
|
|
46
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a string.
|
|
50
|
+
*
|
|
51
|
+
* @param {unknown} input - The input value to be validated.
|
|
52
|
+
* @returns {boolean}A boolean.
|
|
53
|
+
*/
|
|
54
|
+
isAcceptedInputType(input) {
|
|
55
|
+
if (input === undefined || input === null)
|
|
56
|
+
return true;
|
|
57
|
+
return Array.isArray(input);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { InputRangeRequiredRule as I };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract class for internal form field validation rules
|
|
3
|
+
*/
|
|
4
|
+
class InternalFormFieldValidationRule {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Whether to override the default validation rule.
|
|
8
|
+
*/
|
|
9
|
+
this.overrideDefault = false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { InternalFormFieldValidationRule as I };
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as promiseResolve, b as bootstrapLazy } from './index-187f71d1.js';
|
|
2
|
-
import { g as globalScripts } from './app-globals-
|
|
2
|
+
import { g as globalScripts } from './app-globals-88fa3549.js';
|
|
3
3
|
import './feature-flag-controller-4b3fe6f8.js';
|
|
4
4
|
import './global-slimmer-registry-17c4efd4.js';
|
|
5
5
|
import './index-44c794b4.js';
|
|
@@ -29,7 +29,8 @@ import './vega-env-manager-8f8dc473.js';
|
|
|
29
29
|
import './icon-manager-b889176b.js';
|
|
30
30
|
import './index-d172bafa.js';
|
|
31
31
|
import './translation-c08f2274.js';
|
|
32
|
-
import './valid-credit-card-number-rule-
|
|
32
|
+
import './valid-credit-card-number-rule-cc497bec.js';
|
|
33
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
33
34
|
|
|
34
35
|
/*
|
|
35
36
|
Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { c as convertToNumber } from './number-4398f2e1.js';
|
|
2
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A rule that checks if the input is less than or equal to a maximum value
|
|
5
6
|
*
|
|
6
|
-
* @
|
|
7
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
7
8
|
* @property {{ maxValue: number }} config config including the maxValue limit for validation
|
|
8
9
|
*/
|
|
9
|
-
class MaxNumberRule {
|
|
10
|
+
class MaxNumberRule extends InternalFormFieldValidationRule {
|
|
10
11
|
/**
|
|
11
12
|
* It creates a new instance of the class with the given config.
|
|
12
13
|
*
|
|
@@ -14,6 +15,7 @@ class MaxNumberRule {
|
|
|
14
15
|
* @param {number} config.maxValue number of the maxValue
|
|
15
16
|
*/
|
|
16
17
|
constructor(config) {
|
|
18
|
+
super();
|
|
17
19
|
this.config = config;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
@@ -71,10 +73,10 @@ class MaxNumberRule {
|
|
|
71
73
|
/**
|
|
72
74
|
* A rule that checks if the input is larger than or equal to a minimum value
|
|
73
75
|
*
|
|
74
|
-
* @
|
|
76
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
75
77
|
* @property {{ minValue: number }} config config including the minValue limit for validation
|
|
76
78
|
*/
|
|
77
|
-
class MinNumberRule {
|
|
79
|
+
class MinNumberRule extends InternalFormFieldValidationRule {
|
|
78
80
|
/**
|
|
79
81
|
* It creates a new instance of the class with the given config.
|
|
80
82
|
*
|
|
@@ -82,6 +84,7 @@ class MinNumberRule {
|
|
|
82
84
|
* @param {number} config.minValue number of the minValue
|
|
83
85
|
*/
|
|
84
86
|
constructor(config) {
|
|
87
|
+
super();
|
|
85
88
|
this.config = config;
|
|
86
89
|
}
|
|
87
90
|
/**
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A rule that checks if the length of input is less than or equal to a maximum value
|
|
3
5
|
*
|
|
4
|
-
* @
|
|
6
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
5
7
|
* @property {{ maxStrLength: number }} config config including the maxStrLength limit for validation
|
|
6
8
|
*/
|
|
7
|
-
class MaxStringLengthRule {
|
|
9
|
+
class MaxStringLengthRule extends InternalFormFieldValidationRule {
|
|
8
10
|
/**
|
|
9
11
|
* It creates a new instance of the class with the given config.
|
|
10
12
|
*
|
|
@@ -12,6 +14,7 @@ class MaxStringLengthRule {
|
|
|
12
14
|
* @param {number} config.maxStrLength number of the maxStrLength
|
|
13
15
|
*/
|
|
14
16
|
constructor(config) {
|
|
17
|
+
super();
|
|
15
18
|
this.config = config;
|
|
16
19
|
}
|
|
17
20
|
/**
|
|
@@ -69,10 +72,10 @@ class MaxStringLengthRule {
|
|
|
69
72
|
/**
|
|
70
73
|
* A rule that checks if the length of input is more than or equal to a minimum value
|
|
71
74
|
*
|
|
72
|
-
* @
|
|
75
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
73
76
|
* @property {{ minStrLength: number }} config config including the minStrLength limit for validation
|
|
74
77
|
*/
|
|
75
|
-
class MinStringLengthRule {
|
|
78
|
+
class MinStringLengthRule extends InternalFormFieldValidationRule {
|
|
76
79
|
/**
|
|
77
80
|
* It creates a new instance of the class with the given config.
|
|
78
81
|
*
|
|
@@ -80,6 +83,7 @@ class MinStringLengthRule {
|
|
|
80
83
|
* @param {number} config.minStrLength number of the minStrLength
|
|
81
84
|
*/
|
|
82
85
|
constructor(config) {
|
|
86
|
+
super();
|
|
83
87
|
this.config = config;
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { C as CheckBoxRequiredRule } from './check-box-required-rule-cb0aa339.js';
|
|
2
|
+
export { D as DateRequiredRule } from './date-required-rule-8944f3bf.js';
|
|
3
|
+
export { I as InputPhoneNumberRequiredRule } from './input-phone-number-required-rule-be6a5572.js';
|
|
4
|
+
export { I as InputRangeRequiredRule } from './input-range-required-rule-3ad74776.js';
|
|
5
|
+
export { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
6
|
+
export { R as RichTextEditorRequiredRule } from './rich-text-editor-required-rule-75cc2db0.js';
|
|
7
|
+
export { T as TimeRangeRequiredRule, a as TimeRequiredRule } from './time-required-rule-a01163b5.js';
|
|
8
|
+
export { T as ToggleSwitchRequiredRule } from './toggle-switch-required-rule-b3cf4302.js';
|
|
9
|
+
export { F as FileUploaderRequiredRule } from './file-uploader-required-rule-ad886d01.js';
|
|
10
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
11
|
+
import './date-c55b97f0.js';
|
|
12
|
+
import './global-slimmer-registry-17c4efd4.js';
|
|
13
|
+
import './content-state-2edba4ec.js';
|
|
14
|
+
import './change-manager-6a7eb88c.js';
|
|
15
|
+
import './dom-node-subject-factory-97deb349.js';
|
|
16
|
+
import './ui-62e4be97.js';
|
|
17
|
+
import './vega-internal-event-id-f269c42f.js';
|
|
18
|
+
import './type-guard-158f6d7a.js';
|
|
19
|
+
import './breakpoints-d9faf11c.js';
|
|
20
|
+
import './ui-8424715a.js';
|
|
21
|
+
import './regex-dfe11abf.js';
|
|
22
|
+
import './typography-396de03f.js';
|
|
23
|
+
import './create-public-api-runtime-metrics-slimmer-9ab05523.js';
|
|
24
|
+
import './dynamic-slimmer-90b8af32.js';
|
|
25
|
+
import './_commonjsHelpers-9943807e.js';
|
|
26
|
+
import './static-subject-title-8268945e.js';
|
|
27
|
+
import './observer-3959f9dd.js';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A rule that checks if a string is empty or not
|
|
3
5
|
*
|
|
4
|
-
* @
|
|
6
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
5
7
|
*/
|
|
6
|
-
class RequiredFieldRule {
|
|
8
|
+
class RequiredFieldRule extends InternalFormFieldValidationRule {
|
|
7
9
|
constructor() {
|
|
10
|
+
super(...arguments);
|
|
8
11
|
/**
|
|
9
12
|
* A function that checks if the item is a string, number, or boolean.
|
|
10
13
|
*
|
|
@@ -17,7 +20,7 @@ class RequiredFieldRule {
|
|
|
17
20
|
* 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
|
|
18
21
|
*
|
|
19
22
|
* @param {FormFieldValueType | Array<FormFieldValueType>} input - The input to be evaluated.
|
|
20
|
-
* @returns {
|
|
23
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
21
24
|
*/
|
|
22
25
|
evaluate(input) {
|
|
23
26
|
if (!this.isAcceptedInputType(input)) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { a as VegaRTEContent } from './content-state-2edba4ec.js';
|
|
2
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A rule that checks if the input range is empty or not
|
|
6
|
+
*
|
|
7
|
+
* @augments {InternalFormFieldValidationRule<string[]>}
|
|
8
|
+
*/
|
|
9
|
+
class RichTextEditorRequiredRule extends InternalFormFieldValidationRule {
|
|
10
|
+
/**
|
|
11
|
+
* It checks if the input is a valid value.
|
|
12
|
+
*
|
|
13
|
+
* @param {string[]} input - The value of the input field.
|
|
14
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
15
|
+
*/
|
|
16
|
+
evaluate(input) {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
if (!this.isAcceptedInputType(input)) {
|
|
19
|
+
throw new Error(`Invalid value ${input} for rich text editor`);
|
|
20
|
+
}
|
|
21
|
+
const isValid = ((_a = input === null || input === void 0 ? void 0 : input.blocks) === null || _a === void 0 ? void 0 : _a.length) > 1 || // isValid: true when the length is greater than 1 to keep the same behavior as vega-textarea
|
|
22
|
+
(((_b = input === null || input === void 0 ? void 0 : input.blocks) === null || _b === void 0 ? void 0 : _b.length) === 1 && input.blocks.some((block) => block.isNotEmpty()));
|
|
23
|
+
return {
|
|
24
|
+
isValid,
|
|
25
|
+
message: isValid ? '' : 'This field is required',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
30
|
+
*
|
|
31
|
+
* @param {unknown} input - The input to be evaluated.
|
|
32
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
33
|
+
* @returns {boolean} A boolean value.
|
|
34
|
+
*/
|
|
35
|
+
canEvaluate(input, status) {
|
|
36
|
+
return status
|
|
37
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
38
|
+
: this.isAcceptedInputType(input);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
42
|
+
*
|
|
43
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
44
|
+
* @returns {boolean} A boolean value.
|
|
45
|
+
*/
|
|
46
|
+
shouldShowError(status) {
|
|
47
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a VegaRTEContent.
|
|
51
|
+
*
|
|
52
|
+
* @param {unknown} input - The input value to be validated.
|
|
53
|
+
* @returns {boolean} A boolean.
|
|
54
|
+
*/
|
|
55
|
+
isAcceptedInputType(input) {
|
|
56
|
+
if (input === undefined || input === null)
|
|
57
|
+
return true;
|
|
58
|
+
return input instanceof VegaRTEContent;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { RichTextEditorRequiredRule as R };
|