@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,138 @@
|
|
|
1
|
+
import { a as isTimeStr } 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 time is empty or not
|
|
6
|
+
*
|
|
7
|
+
* @augments {InternalFormFieldValidationRule<string[]>}
|
|
8
|
+
*/
|
|
9
|
+
class TimeRangeRequiredRule extends InternalFormFieldValidationRule {
|
|
10
|
+
/**
|
|
11
|
+
* It creates a new instance of the class with the given config.
|
|
12
|
+
*
|
|
13
|
+
* @param {{ timeFormat: TimeFormat }} config - config including the timeFormat for time value
|
|
14
|
+
* @param {TimeFormat} config.timeFormat - The timeFormat for time value
|
|
15
|
+
*/
|
|
16
|
+
constructor(config) {
|
|
17
|
+
super();
|
|
18
|
+
this.config = config;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* It checks if the input is a valid time string.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} input - The value of the input field.
|
|
24
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
25
|
+
*/
|
|
26
|
+
evaluate(input) {
|
|
27
|
+
if (!this.isAcceptedInputType(input)) {
|
|
28
|
+
throw new Error(`Invalid time value ${input} for range mode`);
|
|
29
|
+
}
|
|
30
|
+
const isValid = Array.isArray(input) &&
|
|
31
|
+
input.length === 2 &&
|
|
32
|
+
input.every((item) => isTimeStr(item, this.config.timeFormat));
|
|
33
|
+
return {
|
|
34
|
+
isValid,
|
|
35
|
+
message: isValid ? '' : 'This field is required',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
40
|
+
*
|
|
41
|
+
* @param {unknown} input - The input to be evaluated.
|
|
42
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
43
|
+
* @returns {boolean} A boolean value.
|
|
44
|
+
*/
|
|
45
|
+
canEvaluate(input, status) {
|
|
46
|
+
return status
|
|
47
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
48
|
+
: this.isAcceptedInputType(input);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
52
|
+
*
|
|
53
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
54
|
+
* @returns {boolean} A boolean value.
|
|
55
|
+
*/
|
|
56
|
+
shouldShowError(status) {
|
|
57
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a string.
|
|
61
|
+
*
|
|
62
|
+
* @param {unknown} input - The input value to be validated.
|
|
63
|
+
* @returns {boolean}A boolean.
|
|
64
|
+
*/
|
|
65
|
+
isAcceptedInputType(input) {
|
|
66
|
+
if (input === undefined || input === null)
|
|
67
|
+
return true;
|
|
68
|
+
return Array.isArray(input);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A rule that checks if time is empty or not
|
|
74
|
+
*
|
|
75
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
76
|
+
*/
|
|
77
|
+
class TimeRequiredRule extends InternalFormFieldValidationRule {
|
|
78
|
+
/**
|
|
79
|
+
* It creates a new instance of the class with the given config.
|
|
80
|
+
*
|
|
81
|
+
* @param {{ timeFormat: TimeFormat }} config - config including the timeFormat for time value
|
|
82
|
+
* @param {TimeFormat} config.timeFormat - The timeFormat for time value
|
|
83
|
+
*/
|
|
84
|
+
constructor(config) {
|
|
85
|
+
super();
|
|
86
|
+
this.config = config;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* It checks if the input is a valid time string.
|
|
90
|
+
*
|
|
91
|
+
* @param {string} input - The value of the input field.
|
|
92
|
+
* @returns {EvaluateResult} An object with two properties: isValid and message.
|
|
93
|
+
*/
|
|
94
|
+
evaluate(input) {
|
|
95
|
+
if (!this.isAcceptedInputType(input)) {
|
|
96
|
+
throw new Error(`Invalid time value ${input}`);
|
|
97
|
+
}
|
|
98
|
+
const isValid = isTimeStr(input, this.config.timeFormat);
|
|
99
|
+
return {
|
|
100
|
+
isValid,
|
|
101
|
+
message: isValid ? '' : 'This field is required',
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
106
|
+
*
|
|
107
|
+
* @param {unknown} input - The input to be evaluated.
|
|
108
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
109
|
+
* @returns {boolean} A boolean value.
|
|
110
|
+
*/
|
|
111
|
+
canEvaluate(input, status) {
|
|
112
|
+
return status
|
|
113
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
114
|
+
: this.isAcceptedInputType(input);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
118
|
+
*
|
|
119
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
120
|
+
* @returns {boolean} A boolean value.
|
|
121
|
+
*/
|
|
122
|
+
shouldShowError(status) {
|
|
123
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a string.
|
|
127
|
+
*
|
|
128
|
+
* @param {unknown} input - The input value to be validated.
|
|
129
|
+
* @returns {boolean}A boolean.
|
|
130
|
+
*/
|
|
131
|
+
isAcceptedInputType(input) {
|
|
132
|
+
if (input === undefined || input === null)
|
|
133
|
+
return true;
|
|
134
|
+
return typeof input === 'string';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { TimeRangeRequiredRule as T, TimeRequiredRule as a };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A rule that checks if the toggle switch is required to switch on
|
|
5
|
+
*
|
|
6
|
+
* @augments {InternalFormFieldValidationRule<boolean>}
|
|
7
|
+
*/
|
|
8
|
+
class ToggleSwitchRequiredRule extends InternalFormFieldValidationRule {
|
|
9
|
+
/**
|
|
10
|
+
* If the input is a boolean, return a boolean. If the
|
|
11
|
+
* input is anything else, return false
|
|
12
|
+
*
|
|
13
|
+
* @param {unknown} input - The input to be evaluated.
|
|
14
|
+
* @returns {EvaluateResult} - An object with two properties: isValid and message.
|
|
15
|
+
*/
|
|
16
|
+
evaluate(input) {
|
|
17
|
+
if (typeof input === 'boolean') {
|
|
18
|
+
return {
|
|
19
|
+
isValid: input,
|
|
20
|
+
message: input ? '' : 'This field is required',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return {
|
|
25
|
+
isValid: false,
|
|
26
|
+
message: 'This field is required',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* If the input is accepted and the status is not disabled and visible, then return true
|
|
32
|
+
*
|
|
33
|
+
* @param {unknown} input - The input to be evaluated.
|
|
34
|
+
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
35
|
+
* @returns {boolean} The return value is a boolean that indicates whether the input can be evaluated.
|
|
36
|
+
*/
|
|
37
|
+
canEvaluate(input, status) {
|
|
38
|
+
return status
|
|
39
|
+
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
40
|
+
: this.isAcceptedInputType(input);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
44
|
+
*
|
|
45
|
+
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
46
|
+
* @returns {boolean} A boolean value.
|
|
47
|
+
*/
|
|
48
|
+
shouldShowError(status) {
|
|
49
|
+
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* If the input is undefined or null, return true, otherwise return true if the input is a boolean.
|
|
53
|
+
*
|
|
54
|
+
* @param {unknown} input - The input value to be validated.
|
|
55
|
+
* @returns {boolean} A boolean.
|
|
56
|
+
*/
|
|
57
|
+
isAcceptedInputType(input) {
|
|
58
|
+
if (input === undefined || input === null)
|
|
59
|
+
return true;
|
|
60
|
+
return typeof input === 'boolean';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { ToggleSwitchRequiredRule as T };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { V as VisaRegex, M as MasterCardRegex, A as AmexRegex, D as DiscoverRegex } from './regex-dfe11abf.js';
|
|
2
2
|
import { m as mapStringToNumberArray, a as mapParityDigits, s as sum } from './number-4398f2e1.js';
|
|
3
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* A rule that checks if it's a valid credit card number
|
|
6
7
|
*
|
|
7
|
-
* @
|
|
8
|
+
* @augments {InternalFormFieldValidationRule<string>}
|
|
8
9
|
*/
|
|
9
|
-
class ValidCreditCardNumberRule {
|
|
10
|
+
class ValidCreditCardNumberRule extends InternalFormFieldValidationRule {
|
|
10
11
|
/**
|
|
11
12
|
* It takes a string, maps it to an array of numbers, reverses the array, checks the length of the
|
|
12
13
|
* array, maps the even digits to a new array, sums the new array, and returns true if the sum is
|
|
@@ -5,7 +5,7 @@ import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlim
|
|
|
5
5
|
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-857c65fa.js';
|
|
6
6
|
import { a as VegaClick, f as VegaChange, b as VegaDropdownClick, d as domNodeSubjectFactory, g as VegaEventClick, h as VegaDateDblClick, i as VegaMoreActionClick } from './dom-node-subject-factory-97deb349.js';
|
|
7
7
|
import { V as VegaInternalIconManager } from './internal-icon-manager-900a5bb4.js';
|
|
8
|
-
import { p as pad } from './date-
|
|
8
|
+
import { p as pad } from './date-c55b97f0.js';
|
|
9
9
|
import { c as createEventEmitSlimmer } from './event-emit-slimmer-36cf4e39.js';
|
|
10
10
|
import { C as ChildNodesEventPreventSlimmer } from './child-nodes-event-prevent-slimmer-3220fa5b.js';
|
|
11
11
|
import { n as VegaInternalCalendarMonthEventsChange } from './vega-internal-event-id-f269c42f.js';
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-187f71d1.js';
|
|
2
2
|
import { c as createEnterKeyHandlerToTriggerClick } from './accessibility-e5fd0fab.js';
|
|
3
3
|
import { s as sanitizeVegaComponent } from './component-cae24190.js';
|
|
4
|
+
import { C as CheckBoxRequiredRule } from './check-box-required-rule-cb0aa339.js';
|
|
4
5
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
5
6
|
import { C as CHECKBOX_VALUE_CHANGE, b as FORM_ELEMENT_VALUE_CHANGE, h as CHECKBOX_GROUP_DISABLED_CHANGE } from './static-subject-title-8268945e.js';
|
|
6
7
|
import { O as Observer } from './observer-3959f9dd.js';
|
|
7
|
-
import { f as findParent } from './ui-62e4be97.js';
|
|
8
|
+
import { f as findParent, a as arrayToClassString } from './ui-62e4be97.js';
|
|
8
9
|
import { c as MapToComponentField, M as MapToComponentMethod, V as VegaSlimmer, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
9
10
|
import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlimmer } from './component-usage-runtime-metrics-385c7124.js';
|
|
10
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-
|
|
11
|
+
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-bb64dec7.js';
|
|
11
12
|
import { c as createEventEmitSlimmer } from './event-emit-slimmer-36cf4e39.js';
|
|
12
13
|
import { d as domNodeSubjectFactory, f as VegaChange } from './dom-node-subject-factory-97deb349.js';
|
|
13
14
|
import { c as VegaInternalFieldErrorStateChange } from './vega-internal-event-id-f269c42f.js';
|
|
14
15
|
import { C as ChildNodesEventPreventSlimmer } from './child-nodes-event-prevent-slimmer-3220fa5b.js';
|
|
15
|
-
import { R as RequiredFieldRule } from './required-field-rule-
|
|
16
|
+
import { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
16
17
|
import { C as ComponentLoadRequired } from './component-load-required-ce710ef5.js';
|
|
17
18
|
import { C as ChildNodesNotifyObserverSlimmer } from './child-nodes-notify-observer-slimmer-36024b11.js';
|
|
19
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
18
20
|
import './string-be824360.js';
|
|
19
21
|
import './create-public-api-runtime-metrics-slimmer-9ab05523.js';
|
|
20
22
|
import './dynamic-slimmer-90b8af32.js';
|
|
@@ -34,71 +36,6 @@ import './feature-flag-controller-4b3fe6f8.js';
|
|
|
34
36
|
import './index-44c794b4.js';
|
|
35
37
|
import './_commonjsHelpers-9943807e.js';
|
|
36
38
|
|
|
37
|
-
/**
|
|
38
|
-
* A rule that checks if a string is empty or not
|
|
39
|
-
*
|
|
40
|
-
* @implements {FormFieldValidationRule<string>}
|
|
41
|
-
*/
|
|
42
|
-
class CheckBoxRequiredRule {
|
|
43
|
-
/**
|
|
44
|
-
* If the input is a boolean, return a boolean. If the input is a string, return a boolean. If the
|
|
45
|
-
* input is anything else, return false
|
|
46
|
-
*
|
|
47
|
-
* @param {string | boolean} input - The input to be evaluated.
|
|
48
|
-
* @returns {EvaluateResultTranslation} - An object with two properties: isValid and message.
|
|
49
|
-
*/
|
|
50
|
-
evaluate(input) {
|
|
51
|
-
if (typeof input === 'boolean') {
|
|
52
|
-
return {
|
|
53
|
-
isValid: input,
|
|
54
|
-
message: input ? '' : 'This field is required',
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
else if (typeof input === 'string') {
|
|
58
|
-
return {
|
|
59
|
-
isValid: input !== '',
|
|
60
|
-
message: input !== '' ? '' : 'This field is required',
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
return {
|
|
65
|
-
isValid: false,
|
|
66
|
-
message: 'This field is required',
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* If the input is accepted and the status is not disabled and visible, then return true
|
|
72
|
-
*
|
|
73
|
-
* @param {unknown} input - The input to be evaluated.
|
|
74
|
-
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
75
|
-
* @returns {boolean} The return value is a boolean that indicates whether the input can be evaluated.
|
|
76
|
-
*/
|
|
77
|
-
canEvaluate(input, status) {
|
|
78
|
-
return status
|
|
79
|
-
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
80
|
-
: this.isAcceptedInputType(input);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
84
|
-
*
|
|
85
|
-
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
86
|
-
* @returns {boolean} A boolean value.
|
|
87
|
-
*/
|
|
88
|
-
shouldShowError(status) {
|
|
89
|
-
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* If the input is a string, number, boolean, or null, return true, otherwise return false.
|
|
93
|
-
*
|
|
94
|
-
* @param {unknown} input - The input value to be validated.
|
|
95
|
-
* @returns {boolean} a boolean value.
|
|
96
|
-
*/
|
|
97
|
-
isAcceptedInputType(input) {
|
|
98
|
-
return typeof input === 'string' || typeof input === 'boolean' || input === null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
39
|
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
103
40
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
104
41
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -153,7 +90,7 @@ __decorate$2([
|
|
|
153
90
|
MapToComponentMethod('disconnectedCallback')
|
|
154
91
|
], VegaCheckboxShowErrorController.prototype, "disconnectedCallback", null);
|
|
155
92
|
|
|
156
|
-
const vegaCheckboxCss = ":host{display:inline-block;vertical-align:middle}.vega-checkbox-container{position:relative;display:flex;-webkit-tap-highlight-color:transparent}.vega-checkbox-container>input[type=checkbox]{position:absolute;left:0px;top:0px;opacity:0;width:24px;height:24px;padding:0px;margin:0px}.vega-checkbox-container>.vega-checkbox-icon{display:inline-block;box-sizing:border-box;width:24px;height:24px;border-style:solid;border-width:2px;border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1));position:relative;left:0px;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:4px;min-width:24px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}.vega-checkbox-container>.vega-checkbox-icon
|
|
93
|
+
const vegaCheckboxCss = ":host{display:inline-block;vertical-align:middle}.vega-checkbox-container{position:relative;display:flex;-webkit-tap-highlight-color:transparent}.vega-checkbox-container>input[type=checkbox]{position:absolute;left:0px;top:0px;opacity:0;width:24px;height:24px;padding:0px;margin:0px}.vega-checkbox-container>.vega-checkbox-icon{display:inline-block;box-sizing:border-box;width:24px;height:24px;border-style:solid;border-width:2px;border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1));position:relative;left:0px;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:4px;min-width:24px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}.vega-checkbox-container>.vega-checkbox-icon:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-action, 19, 98, 226, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon:hover{background-color:rgba(var(--v-bg-action-hover, 4, 112, 236, 1))}.vega-checkbox-container>input[type=checkbox]:focus-visible+.vega-checkbox-icon{box-shadow:0 0 0 4px rgba(var(--v-ring-input-focus, 19, 98, 226, 0.25));border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:none}.vega-checkbox-container>.vega-checkbox-icon:active{border-width:1px;border-style:solid;border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon:active{background-color:rgba(var(--v-bg-action-active, 29, 65, 195, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon{display:inline-flex;align-items:center;justify-content:center}:host(.disabled) .vega-checkbox-container{cursor:not-allowed}:host(:not(.disabled)) .vega-checkbox-container{cursor:pointer}.vega-checkbox-container .vega-require{color:rgba(var(--v-text-error, 189, 41, 71, 1));margin-left:4px;vertical-align:middle}.vega-checkbox-container.error>.vega-checkbox-icon{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon{background-color:rgba(var(--v-bg-danger, 189, 41, 71, 1))}.vega-checkbox-container.error>.vega-checkbox-icon:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon:hover{background-color:rgba(var(--v-bg-danger-hover, 233, 71, 104, 1))}.vega-checkbox-container.error>input[type=checkbox]:focus-visible+.vega-checkbox-icon{box-shadow:0 0 0 4px rgba(var(--v-ring-input-danger-focus, 230, 50, 87, 0.25));border:1px solid rgba(var(--v-border-input-field-danger-focus, 233, 71, 104, 1));outline:none}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon:active{background-color:rgba(var(--v-bg-danger-active, 230, 50, 87, 1))}.vega-checkbox-container.error>.vega-checkbox-icon:active{border-width:1px;border-style:solid;border-color:rgba(var(--v-border-color-danger-active, 189, 41, 71, 1))}:host(.disabled) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.checked.disabled) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-disabled, 176, 180, 181, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.checked.disabled) .vega-checkbox-container>.vega-checkbox-icon>vega-icon{color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}.vega-checkbox-container>.vega-checkbox-label-container{display:inline-block;margin-left:12px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}:host(.disabled) .vega-checkbox-container>.vega-checkbox-label-container{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.vega-error{display:block;margin-top:12px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-checkbox-label-container.vega-hidden{display:none}.vega-hidden{display:none}.size-default input[type=checkbox]{width:24px;height:24px}.size-default .vega-checkbox-icon{width:24px;height:24px;min-width:24px;border-radius:4px}.size-default .vega-checkbox-label-container{margin-left:12px;font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}@media screen and (min-width: 768px) and (max-width: 1023px){.size-default .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.size-default .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.size-default .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}.size-small input[type=checkbox]{width:16px;height:16px}.size-small .vega-checkbox-icon{width:16px;height:16px;min-width:16px;border-radius:2px}.size-small .vega-checkbox-label-container{margin-left:8px;font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.size-small .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.size-small .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.size-small .vega-checkbox-label-container{font-family:\"Inter\", sans-serif;font-size:14px;font-weight:400;line-height:18px}}";
|
|
157
94
|
|
|
158
95
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
159
96
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -307,16 +244,11 @@ const VegaCheckbox = class {
|
|
|
307
244
|
'vega-flex-shrink-0 v-min-w-min': this.host.parentElement.nodeName == 'VEGA-CHECKBOX-GROUP',
|
|
308
245
|
'checked': this.checked,
|
|
309
246
|
'disabled': this.isDisabled(),
|
|
310
|
-
} }, h("label", { class:
|
|
311
|
-
'vega-checkbox-container'
|
|
312
|
-
'error'
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
'vega-checkbox-small': this.size === 'small',
|
|
316
|
-
}, onClick: this.onSelectedIconClick, tabIndex: -1 }, this.renderIconDom()), h("div", { class: {
|
|
317
|
-
'vega-checkbox-label-container': true,
|
|
318
|
-
'vega-checkbox-label-small': this.size === 'small',
|
|
319
|
-
}, ref: (el) => (this.labelElement = el) }, this.renderLabelDom(), this.renderRequireDom()))), this.host);
|
|
247
|
+
} }, h("label", { class: arrayToClassString([
|
|
248
|
+
'vega-checkbox-container',
|
|
249
|
+
this.showError && 'error',
|
|
250
|
+
this.size && `size-${this.size}`,
|
|
251
|
+
]), ref: (e) => (this.inputContainerRef = e) }, h("input", { ref: (e) => (this.inputRef = e), type: "checkbox", checked: this.checked, value: this.identifier, onChange: this.onCheckBoxChange, "aria-label": this.identifier || 'No label defined', disabled: this.isDisabled(), role: 'button', tabIndex: 0, onKeyDown: createEnterKeyHandlerToTriggerClick() }), h("span", { class: "vega-checkbox-icon", onClick: this.onSelectedIconClick, tabIndex: -1 }, this.renderIconDom()), h("div", { class: "vega-checkbox-label-container", ref: (el) => (this.labelElement = el) }, this.renderLabelDom(), this.renderRequireDom()))), this.host);
|
|
320
252
|
}
|
|
321
253
|
renderIconDom() {
|
|
322
254
|
return this.checked ? (h("vega-icon", { icon: "checkmark", size: this.size === 'small' ? 'size-12' : 'size-16' })) : null;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-187f71d1.js';
|
|
2
|
-
import { R as RequiredFieldRule } from './required-field-rule-
|
|
2
|
+
import { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
3
3
|
import { c as createEnterKeyHandlerToTriggerClick } from './accessibility-e5fd0fab.js';
|
|
4
4
|
import { s as sanitizeVegaComponent } from './component-cae24190.js';
|
|
5
5
|
import { a as arrayToClassString, h as hexToRGB, b as getHexFromShorthand } from './ui-62e4be97.js';
|
|
6
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-
|
|
6
|
+
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-bb64dec7.js';
|
|
7
7
|
import { I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
8
8
|
import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlimmer } from './component-usage-runtime-metrics-385c7124.js';
|
|
9
9
|
import { b as FORM_ELEMENT_VALUE_CHANGE } from './static-subject-title-8268945e.js';
|
|
10
10
|
import { c as createEventEmitSlimmer } from './event-emit-slimmer-36cf4e39.js';
|
|
11
11
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
12
12
|
import { f as VegaChange } from './dom-node-subject-factory-97deb349.js';
|
|
13
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
13
14
|
import './string-be824360.js';
|
|
14
15
|
import './observer-3959f9dd.js';
|
|
15
16
|
import './create-public-api-runtime-metrics-slimmer-9ab05523.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { h, F as Fragment, H as Host, r as registerInstance, c as createEvent, g as getElement } from './index-187f71d1.js';
|
|
2
|
-
import { R as RequiredFieldRule } from './required-field-rule-
|
|
2
|
+
import { R as RequiredFieldRule } from './required-field-rule-ab4bdc47.js';
|
|
3
3
|
import { g as getActiveElement, s as sanitizeVegaComponent } from './component-cae24190.js';
|
|
4
4
|
import { N as isArrayOfType, O as isDropdownSourceItemType } from './type-guard-158f6d7a.js';
|
|
5
5
|
import { c as MapToComponentField, M as MapToComponentMethod, V as VegaSlimmer, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
6
6
|
import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlimmer } from './component-usage-runtime-metrics-385c7124.js';
|
|
7
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-
|
|
7
|
+
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-bb64dec7.js';
|
|
8
8
|
import { C as ChildNodesEventPreventSlimmer } from './child-nodes-event-prevent-slimmer-3220fa5b.js';
|
|
9
9
|
import { c as createEventEmitSlimmer } from './event-emit-slimmer-36cf4e39.js';
|
|
10
10
|
import { k as VegaCreate, n as VegaDropdownHide, b as VegaDropdownClick, c as VegaClose, f as VegaChange, l as VegaSearch } from './dom-node-subject-factory-97deb349.js';
|
|
@@ -17,6 +17,7 @@ import { K as KeyboardManagerSlimmer } from './keyboard-manager-slimmer-f80d6835
|
|
|
17
17
|
import { f as findParent } from './ui-62e4be97.js';
|
|
18
18
|
import { M as MutationObserverSlimmer } from './mutation-observer-slimmer-6cef9549.js';
|
|
19
19
|
import { T as TagNameMutationFilter } from './mutation-observer-filters-1035b064.js';
|
|
20
|
+
import './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
20
21
|
import './breakpoints-d9faf11c.js';
|
|
21
22
|
import './ui-8424715a.js';
|
|
22
23
|
import './regex-dfe11abf.js';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { h, H as Host, F as Fragment, r as registerInstance, c as createEvent, g as getElement } from './index-187f71d1.js';
|
|
2
2
|
import { s as sanitizeVegaComponent } from './component-cae24190.js';
|
|
3
|
-
import {
|
|
3
|
+
import { D as DateRequiredRule } from './date-required-rule-8944f3bf.js';
|
|
4
|
+
import { c as compareIsSameOrBefore, i as isDateStr, b as compareIsBefore, d as compareIsAfter } from './date-c55b97f0.js';
|
|
5
|
+
import { I as InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract-f5b6bdbf.js';
|
|
4
6
|
import { c as MapToComponentField, V as VegaSlimmer, M as MapToComponentMethod, L as LogUtility, I as InjectVegaSlimmer } from './global-slimmer-registry-17c4efd4.js';
|
|
5
7
|
import { V as VegaComponentUsageRuntimeMetricsSlimmer, I as InjectVegaGlobalSlimmer } from './component-usage-runtime-metrics-385c7124.js';
|
|
6
|
-
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-
|
|
8
|
+
import { F as FormFieldControllerSlimmer } from './form-field-controller-slimmer-bb64dec7.js';
|
|
7
9
|
import { a as arrayToClassString, g as getDeviceType, D as DeviceType } from './ui-62e4be97.js';
|
|
8
10
|
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-857c65fa.js';
|
|
9
11
|
import { a as VegaClick, b as VegaDropdownClick, d as domNodeSubjectFactory, f as VegaChange } from './dom-node-subject-factory-97deb349.js';
|
|
@@ -15,7 +17,7 @@ import { I as InternalVegaZIndexManager } from './internal-vega-z-index-manager-
|
|
|
15
17
|
import { b as FORM_ELEMENT_VALUE_CHANGE } from './static-subject-title-8268945e.js';
|
|
16
18
|
import { C as ChangeManager } from './change-manager-6a7eb88c.js';
|
|
17
19
|
import { a as StringInputFormatterSlimmer, b as StringMaskStrategy } from './string-input-formatter-slimmer-418b54f0.js';
|
|
18
|
-
import { E as ElementAppenderSlimmer } from './element-appender-slimmer-
|
|
20
|
+
import { E as ElementAppenderSlimmer } from './element-appender-slimmer-d9155ee0.js';
|
|
19
21
|
import './vega-env-manager-8f8dc473.js';
|
|
20
22
|
import './vega-skeleton-loader-controller-5aea7aeb.js';
|
|
21
23
|
import { F as FeatureFlag } from './feature-flag-controller-4b3fe6f8.js';
|
|
@@ -51,95 +53,10 @@ import './internal-vega-event-manager-0a01ba12.js';
|
|
|
51
53
|
import './index-44c794b4.js';
|
|
52
54
|
import './keyboard-manager-4c898a0d.js';
|
|
53
55
|
|
|
54
|
-
/**
|
|
55
|
-
* A rule that checks if date is empty or not
|
|
56
|
-
*
|
|
57
|
-
* @implements {FormFieldValidationRule<string | string[]>}
|
|
58
|
-
*/
|
|
59
|
-
class DateRequiredRule {
|
|
60
|
-
/**
|
|
61
|
-
* It creates a new instance of the class with the given config.
|
|
62
|
-
*
|
|
63
|
-
* @param {{ mode: 'single' | 'range' }} config - config including the mode for date value
|
|
64
|
-
* @param {'single' | 'range'} config.mode - The mode for date value
|
|
65
|
-
*/
|
|
66
|
-
constructor(config) {
|
|
67
|
-
this.config = config;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* If the input is not valid for the current mode, throw an error.
|
|
71
|
-
* Otherwise, return an object with a boolean indicating whether the input is valid and a message to display to the user
|
|
72
|
-
*
|
|
73
|
-
* @param {string | string[]} input - The value of the input field.
|
|
74
|
-
* @returns {EvaluateResultTranslation} An object with two properties: isValid and message.
|
|
75
|
-
*/
|
|
76
|
-
evaluate(input) {
|
|
77
|
-
if (!this.isAcceptedInputType(input)) {
|
|
78
|
-
throw new Error(`Invalid date value ${input} for mode ${this.config.mode}`);
|
|
79
|
-
}
|
|
80
|
-
let isValid;
|
|
81
|
-
switch (this.config.mode) {
|
|
82
|
-
case 'single':
|
|
83
|
-
isValid = isDateStr(input);
|
|
84
|
-
break;
|
|
85
|
-
case 'range':
|
|
86
|
-
isValid = Array.isArray(input) && input.length === 2 && input.every(isDateStr);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
isValid,
|
|
91
|
-
message: isValid ? '' : 'This field is required',
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* If the input is accepted and the status is not disabled and visible, then return true
|
|
96
|
-
*
|
|
97
|
-
* @param {unknown} input - The input to be evaluated.
|
|
98
|
-
* @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
|
|
99
|
-
* @returns {boolean} A boolean value.
|
|
100
|
-
*/
|
|
101
|
-
canEvaluate(input, status) {
|
|
102
|
-
return status
|
|
103
|
-
? this.isAcceptedInputType(input) && !status.disabled && status.visible
|
|
104
|
-
: this.isAcceptedInputType(input);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* If the field is not disabled, visible, and has been touched or modified, then show the error
|
|
108
|
-
*
|
|
109
|
-
* @param {FormFieldStatusMeta} status - FormFieldStatusMeta
|
|
110
|
-
* @returns {boolean} A boolean value.
|
|
111
|
-
*/
|
|
112
|
-
shouldShowError(status) {
|
|
113
|
-
return !status.disabled && status.visible && (status.touched || status.modified);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* If the input is undefined or null, return true. Otherwise, if the mode is 'single', return true if
|
|
117
|
-
* the input is a string. Otherwise, if the mode is 'range', return true if the input is an array. Otherwise, return false.
|
|
118
|
-
*
|
|
119
|
-
* @param {unknown} input - The input value that the user has entered.
|
|
120
|
-
* @returns {boolean} A boolean value.
|
|
121
|
-
*/
|
|
122
|
-
isAcceptedInputType(input) {
|
|
123
|
-
if (input === undefined || input === null)
|
|
124
|
-
return true;
|
|
125
|
-
if (!this.config.mode) {
|
|
126
|
-
throw new Error(`Unexpected type of mode: ${this.config.mode}`);
|
|
127
|
-
}
|
|
128
|
-
switch (this.config.mode) {
|
|
129
|
-
case 'single':
|
|
130
|
-
return typeof input === 'string';
|
|
131
|
-
case 'range':
|
|
132
|
-
return Array.isArray(input);
|
|
133
|
-
default:
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
56
|
/**
|
|
140
57
|
* A rule that checks if start date is before than end date
|
|
141
58
|
*/
|
|
142
|
-
class DateRangeRule {
|
|
59
|
+
class DateRangeRule extends InternalFormFieldValidationRule {
|
|
143
60
|
/**
|
|
144
61
|
* If the input is accepted and the status is not disabled and visible, then return true
|
|
145
62
|
*
|
|
@@ -193,7 +110,7 @@ class DateRangeRule {
|
|
|
193
110
|
/**
|
|
194
111
|
* A rule that checks if date is in minDate and maxDate range
|
|
195
112
|
*/
|
|
196
|
-
class MinAndMaxDateRule {
|
|
113
|
+
class MinAndMaxDateRule extends InternalFormFieldValidationRule {
|
|
197
114
|
/**
|
|
198
115
|
* It creates a new instance of the class with the given config.
|
|
199
116
|
*
|
|
@@ -202,6 +119,7 @@ class MinAndMaxDateRule {
|
|
|
202
119
|
* @param {string} config.maxDate - The maxDate
|
|
203
120
|
*/
|
|
204
121
|
constructor(config) {
|
|
122
|
+
super();
|
|
205
123
|
/**
|
|
206
124
|
* Evaluate if single date is within the min and max date range
|
|
207
125
|
*
|
|
@@ -366,6 +366,12 @@ class VegaModalLayoutController extends VegaSlimmer {
|
|
|
366
366
|
watchSize() {
|
|
367
367
|
this.setModalWidth('update');
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* Listen watchContentMaxHeight method to be called
|
|
371
|
+
*/
|
|
372
|
+
watchContentMaxHeight() {
|
|
373
|
+
this.setContentMaxHeight();
|
|
374
|
+
}
|
|
369
375
|
/*
|
|
370
376
|
* The below method is e2e-test covered in
|
|
371
377
|
* @see{module:vega-modal-default-e2e}
|
|
@@ -452,6 +458,9 @@ __decorate$7([
|
|
|
452
458
|
__decorate$7([
|
|
453
459
|
MapToComponentMethod('watchSize')
|
|
454
460
|
], VegaModalLayoutController.prototype, "watchSize", null);
|
|
461
|
+
__decorate$7([
|
|
462
|
+
MapToComponentMethod('watchContentMaxHeight')
|
|
463
|
+
], VegaModalLayoutController.prototype, "watchContentMaxHeight", null);
|
|
455
464
|
|
|
456
465
|
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
457
466
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -521,6 +530,10 @@ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators,
|
|
|
521
530
|
* Modal scroll controller
|
|
522
531
|
*/
|
|
523
532
|
class VegaModalScrollController extends VegaSlimmer {
|
|
533
|
+
constructor() {
|
|
534
|
+
super(...arguments);
|
|
535
|
+
this.scrollEventListenerAdded = false;
|
|
536
|
+
}
|
|
524
537
|
/**
|
|
525
538
|
* Component lifecycle - [connectedCallback]
|
|
526
539
|
*/
|
|
@@ -529,6 +542,14 @@ class VegaModalScrollController extends VegaSlimmer {
|
|
|
529
542
|
this.listenContentScroll();
|
|
530
543
|
}
|
|
531
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* Listen watchContentMaxHeight method to be called
|
|
547
|
+
*/
|
|
548
|
+
watchContentMaxHeight() {
|
|
549
|
+
if (!this.scrollEventListenerAdded && this.isContentScrollable()) {
|
|
550
|
+
this.listenContentScroll();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
532
553
|
/**
|
|
533
554
|
* Is modal content scrollable.
|
|
534
555
|
*
|
|
@@ -557,6 +578,7 @@ class VegaModalScrollController extends VegaSlimmer {
|
|
|
557
578
|
}
|
|
558
579
|
this.notifyContentScrolling();
|
|
559
580
|
});
|
|
581
|
+
this.scrollEventListenerAdded = true;
|
|
560
582
|
}
|
|
561
583
|
/*
|
|
562
584
|
* The below method is e2e-test covered in
|
|
@@ -584,6 +606,9 @@ __decorate$5([
|
|
|
584
606
|
__decorate$5([
|
|
585
607
|
MapToComponentMethod('componentDidLoad')
|
|
586
608
|
], VegaModalScrollController.prototype, "componentDidLoad", null);
|
|
609
|
+
__decorate$5([
|
|
610
|
+
MapToComponentMethod('watchContentMaxHeight')
|
|
611
|
+
], VegaModalScrollController.prototype, "watchContentMaxHeight", null);
|
|
587
612
|
|
|
588
613
|
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
589
614
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1062,6 +1087,8 @@ const VegaModal = class {
|
|
|
1062
1087
|
}
|
|
1063
1088
|
watchOpen() {
|
|
1064
1089
|
}
|
|
1090
|
+
watchContentMaxHeight() {
|
|
1091
|
+
}
|
|
1065
1092
|
disconnectedCallback() {
|
|
1066
1093
|
this.open = false;
|
|
1067
1094
|
}
|
|
@@ -1107,7 +1134,8 @@ const VegaModal = class {
|
|
|
1107
1134
|
get host() { return getElement(this); }
|
|
1108
1135
|
static get watchers() { return {
|
|
1109
1136
|
"size": ["watchSize"],
|
|
1110
|
-
"open": ["watchOpen"]
|
|
1137
|
+
"open": ["watchOpen"],
|
|
1138
|
+
"contentMaxHeight": ["watchContentMaxHeight"]
|
|
1111
1139
|
}; }
|
|
1112
1140
|
};
|
|
1113
1141
|
__decorate([
|
|
@@ -9,7 +9,7 @@ import { c as createEnterKeyHandlerToTriggerClick } from './accessibility-e5fd0f
|
|
|
9
9
|
import { D as DomNodeSubjectObserverFactory } from './dom-node-subject-observer-factory-857c65fa.js';
|
|
10
10
|
import { f as VegaChange, d as domNodeSubjectFactory, m as VegaDropdownShow, n as VegaDropdownHide, b as VegaDropdownClick, k as VegaCreate, o as VegaDropdownSearch, p as VegaSearchTrigger, a as VegaClick } from './dom-node-subject-factory-97deb349.js';
|
|
11
11
|
import { K as KeyboardManagerSlimmer } from './keyboard-manager-slimmer-f80d6835.js';
|
|
12
|
-
import { E as ElementAppenderSlimmer } from './element-appender-slimmer-
|
|
12
|
+
import { E as ElementAppenderSlimmer } from './element-appender-slimmer-d9155ee0.js';
|
|
13
13
|
import { r as remoteInvocationRegistry } from './remote-invocation-registry-1682b34e.js';
|
|
14
14
|
import { k as VegaInternalDropdownUpdateTarget, e as VegaInternalDropdownTemplateItemsChange, j as VegaDropdownSearchInternalOverridden, i as VegaDropdownRenderItemInternalOverridden, f as VegaInternalVirtualScrollToBottom } from './vega-internal-event-id-f269c42f.js';
|
|
15
15
|
import { i as isArrayEqual } from './array-b668466e.js';
|