@heartlandone/vega 2.57.0 → 2.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/card-config-2ee5505e.js +65 -0
- package/dist/cjs/{string-input-formatter-slimmer-92ab034f.js → string-input-formatter-slimmer-dc1747ad.js} +20 -1
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +20 -116
- package/dist/cjs/vega-input.cjs.entry.js +194 -2
- package/dist/collection/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.js +25 -2
- package/dist/collection/components/vega-input/vega-input.js +1 -1
- package/dist/collection/components/vega-input-credit-card/vega-input-credit-card.js +13 -52
- package/dist/collection/components/vega-table/vega-table-head-cell/vega-table-head-cell.js +1 -1
- package/dist/collection/components/vega-table/vega-table.js +1 -1
- package/dist/collection/constants/card-config.js +4 -4
- package/dist/collection/helpers/formatter/string-formatter/credit-card-blur-mask-strategy.js +74 -0
- package/dist/collection/helpers/formatter/string-formatter/credit-card-input-mask-strategy.js +34 -0
- package/dist/collection/helpers/formatter/string-formatter/credit-card-mask-strategy.abstract.js +63 -0
- package/dist/collection/helpers/formatter/string-formatter/string-format-strategy.abstract.js +4 -1
- package/dist/collection/helpers/formatter/string-formatter/string-mask-strategy.js +8 -0
- package/dist/collection/helpers/slimmers/string-input-formatter-slimmer.js +8 -0
- package/dist/esm/{app-globals-366415b3.js → app-globals-ee6a1250.js} +3 -3
- package/dist/esm/card-config-d2ad484e.js +63 -0
- package/dist/esm/{code-block-73869a3c.js → code-block-7bd4cb87.js} +1 -1
- package/dist/esm/{component-value-history-controller-slimmer.abstract-dfe89c93.js → component-value-history-controller-slimmer.abstract-41c58caf.js} +2 -2
- package/dist/esm/{content-state-953906e8.js → content-state-a43e703e.js} +1 -1
- package/dist/esm/{design-token-28a0a2e6.js → design-token-23522f5c.js} +1 -1
- package/dist/esm/{element-appender-slimmer-7b9f4a8e.js → element-appender-slimmer-042df95a.js} +2 -2
- package/dist/esm/{form-field-controller-slimmer-707a6da2.js → form-field-controller-slimmer-f0982f11.js} +2 -2
- package/dist/esm/{image-annotation-action-5bfda07c.js → image-annotation-action-1e88f5a0.js} +1 -1
- package/dist/esm/{index-3e551cbe.js → index-fb3b74bd.js} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{public-rules-c5d2c1e1.js → public-rules-287d4d77.js} +4 -4
- package/dist/esm/{responsive-format-facade-60731164.js → responsive-format-facade-d2632288.js} +1 -1
- package/dist/esm/{rich-text-editor-required-rule-4429066e.js → rich-text-editor-required-rule-69d5f035.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-6ab5cad6.js → string-input-formatter-slimmer-09478e0d.js} +23 -4
- package/dist/esm/{style-formatter-57fc600a.js → style-formatter-f7951677.js} +1 -1
- package/dist/esm/{sub-state-notify-slimmer-1c4d1e78.js → sub-state-notify-slimmer-0a6c3cbb.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-1e9af9ec.js → sub-state-observer-slimmer-53eec5fb.js} +1 -1
- package/dist/esm/vega-accordion.entry.js +5 -5
- package/dist/esm/vega-app-header-button.entry.js +5 -5
- package/dist/esm/vega-box.entry.js +6 -6
- package/dist/esm/vega-button-circle.entry.js +5 -5
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button.entry.js +4 -4
- package/dist/esm/vega-calendar_3.entry.js +3 -3
- package/dist/esm/vega-card.entry.js +5 -5
- package/dist/esm/vega-carousel.entry.js +4 -4
- package/dist/esm/vega-checkbox_2.entry.js +3 -3
- package/dist/esm/vega-chip.entry.js +5 -5
- package/dist/esm/vega-code-block.entry.js +3 -3
- package/dist/esm/vega-color-picker.entry.js +3 -3
- package/dist/esm/vega-combo-box.entry.js +3 -3
- package/dist/esm/vega-date-picker_2.entry.js +9 -9
- package/dist/esm/vega-dialog_2.entry.js +5 -5
- package/dist/esm/vega-divider.entry.js +5 -5
- package/dist/esm/vega-dropdown_5.entry.js +7 -7
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +3 -3
- package/dist/esm/vega-flag-icon.entry.js +5 -5
- package/dist/esm/vega-flex.entry.js +6 -6
- package/dist/esm/vega-font.entry.js +5 -5
- package/dist/esm/vega-form.entry.js +4 -4
- package/dist/esm/vega-grid.entry.js +5 -5
- package/dist/esm/vega-icon.entry.js +5 -5
- package/dist/esm/vega-image-uploader.entry.js +6 -6
- package/dist/esm/vega-input-credit-card.entry.js +21 -117
- package/dist/esm/vega-input-numeric.entry.js +4 -4
- package/dist/esm/vega-input-phone-number.entry.js +5 -5
- package/dist/esm/vega-input-range.entry.js +3 -3
- package/dist/esm/vega-input-select.entry.js +6 -6
- package/dist/esm/vega-input.entry.js +198 -6
- package/dist/esm/{vega-internal-event-id-f0ea2bab.js → vega-internal-event-id-4072659b.js} +1 -1
- package/dist/esm/vega-left-nav_5.entry.js +7 -7
- package/dist/esm/vega-loader-wrapper_2.entry.js +4 -4
- package/dist/esm/vega-pagination-page-selector-mobile.entry.js +1 -1
- package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +1 -1
- package/dist/esm/vega-pagination.entry.js +4 -4
- package/dist/esm/vega-popover_2.entry.js +5 -5
- package/dist/esm/vega-radio_2.entry.js +3 -3
- package/dist/esm/vega-rich-text-content.entry.js +6 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +10 -10
- package/dist/esm/vega-selection-chip_2.entry.js +7 -7
- package/dist/esm/vega-selection-tile_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +6 -6
- package/dist/esm/vega-signature-capture.entry.js +7 -7
- package/dist/esm/vega-stepper.entry.js +3 -3
- package/dist/esm/vega-table_8.entry.js +6 -6
- package/dist/esm/vega-textarea.entry.js +3 -3
- package/dist/esm/vega-time-picker_2.entry.js +7 -7
- package/dist/esm/vega-toggle-switch.entry.js +3 -3
- package/dist/esm/vega-tooltip_2.entry.js +5 -5
- package/dist/esm/vega.js +5 -5
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.d.ts +7 -0
- package/dist/types/components/vega-input/types.d.ts +10 -1
- package/dist/types/components/vega-input-credit-card/vega-input-credit-card.d.ts +1 -13
- package/dist/types/components/vega-table/interface.d.ts +18 -11
- package/dist/types/components/vega-table/vega-table-head-cell/vega-table-head-cell.d.ts +1 -1
- package/dist/types/components/vega-table/vega-table.d.ts +1 -1
- package/dist/types/components.d.ts +4 -4
- package/dist/types/helpers/formatter/string-formatter/credit-card-blur-mask-strategy.d.ts +28 -0
- package/dist/types/helpers/formatter/string-formatter/credit-card-input-mask-strategy.d.ts +21 -0
- package/dist/types/helpers/formatter/string-formatter/credit-card-mask-strategy.abstract.d.ts +36 -0
- package/dist/types/helpers/formatter/string-formatter/string-format-strategy.abstract.d.ts +1 -1
- package/dist/types/helpers/formatter/string-formatter/string-mask-strategy.d.ts +9 -3
- package/dist/types/helpers/slimmers/string-input-formatter-slimmer.d.ts +4 -0
- package/dist/types/types/public-api.d.ts +1 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-f8e0e4f0.entry.js → p-080db42b.entry.js} +1 -1
- package/dist/vega/{p-6acf0a51.entry.js → p-083af15f.entry.js} +1 -1
- package/dist/vega/{p-75ff12da.entry.js → p-091ab617.entry.js} +1 -1
- package/dist/vega/{p-47e89c0e.entry.js → p-0b5330e1.entry.js} +1 -1
- package/dist/vega/{p-f4a7acff.entry.js → p-1a4f77de.entry.js} +1 -1
- package/dist/vega/{p-21a7530c.entry.js → p-1a6dacc7.entry.js} +1 -1
- package/dist/vega/{p-2ebef70f.entry.js → p-1db2ba98.entry.js} +1 -1
- package/dist/vega/{p-e277ea73.entry.js → p-1f9a735a.entry.js} +1 -1
- package/dist/vega/{p-44880bdf.entry.js → p-24042f0c.entry.js} +1 -1
- package/dist/vega/{p-0496f1cb.entry.js → p-27ec0c07.entry.js} +1 -1
- package/dist/vega/{p-27dca371.entry.js → p-317920e6.entry.js} +1 -1
- package/dist/vega/{p-a2ef3429.entry.js → p-376b3ec7.entry.js} +1 -1
- package/dist/vega/{p-dc16e6ba.entry.js → p-394594e9.entry.js} +1 -1
- package/dist/vega/{p-07927476.entry.js → p-39906ad2.entry.js} +1 -1
- package/dist/vega/{p-8fb5bcb0.entry.js → p-42ec43ef.entry.js} +1 -1
- package/dist/vega/{p-6e1b5949.js → p-43263510.js} +1 -1
- package/dist/vega/{p-29f4cbed.entry.js → p-435451be.entry.js} +1 -1
- package/dist/vega/{p-9481c073.entry.js → p-45eb1e01.entry.js} +1 -1
- package/dist/vega/p-472108bd.entry.js +1 -0
- package/dist/vega/{p-6131f229.entry.js → p-48ae6f02.entry.js} +1 -1
- package/dist/vega/{p-1c4d05de.entry.js → p-48b24fd3.entry.js} +1 -1
- package/dist/vega/{p-fb8c99c5.js → p-4a237308.js} +1 -1
- package/dist/vega/{p-5dec9bd9.entry.js → p-4ab67150.entry.js} +1 -1
- package/dist/vega/{p-d82ceacf.entry.js → p-4c4ac1a5.entry.js} +1 -1
- package/dist/vega/p-4fb159d5.js +1 -0
- package/dist/vega/p-5bd3487e.js +1 -0
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-39049341.entry.js → p-5fe47fe8.entry.js} +1 -1
- package/dist/vega/{p-d5ab867e.entry.js → p-61ea2d75.entry.js} +1 -1
- package/dist/vega/{p-e32efc2e.entry.js → p-63adca7b.entry.js} +1 -1
- package/dist/vega/{p-7c0004dc.entry.js → p-699032fc.entry.js} +1 -1
- package/dist/vega/{p-0b77c6c9.entry.js → p-710da484.entry.js} +1 -1
- package/dist/vega/{p-007bf7df.js → p-71c65f7e.js} +1 -1
- package/dist/vega/{p-a92a8172.entry.js → p-81279fea.entry.js} +1 -1
- package/dist/vega/{p-ecd032fc.js → p-8782abeb.js} +1 -1
- package/dist/vega/p-88e08a33.js +1 -0
- package/dist/vega/{p-4f5eb8d5.js → p-8c4f893b.js} +1 -1
- package/dist/vega/{p-2873b600.entry.js → p-8f8de5ab.entry.js} +1 -1
- package/dist/vega/p-92355996.entry.js +1 -0
- package/dist/vega/{p-ce14af16.js → p-9a956a00.js} +1 -1
- package/dist/vega/{p-fcb04960.js → p-9afdcf65.js} +1 -1
- package/dist/vega/p-9b08ed46.entry.js +1 -0
- package/dist/vega/{p-0604563a.entry.js → p-9ca7467d.entry.js} +1 -1
- package/dist/vega/{p-b44ebc84.entry.js → p-9ce0bd82.entry.js} +1 -1
- package/dist/vega/{p-f8f8e7d2.entry.js → p-a04491cc.entry.js} +1 -1
- package/dist/vega/{p-99c4559e.entry.js → p-a1056063.entry.js} +1 -1
- package/dist/vega/{p-b449fe9a.entry.js → p-a4a0fcfd.entry.js} +1 -1
- package/dist/vega/{p-f79c82c7.entry.js → p-a7042a5a.entry.js} +1 -1
- package/dist/vega/p-acf7667e.entry.js +1 -0
- package/dist/vega/{p-8ba8a7cc.entry.js → p-b21b128c.entry.js} +1 -1
- package/dist/vega/{p-766ed063.entry.js → p-b75a8edb.entry.js} +1 -1
- package/dist/vega/{p-1e3f4007.entry.js → p-c21295cf.entry.js} +1 -1
- package/dist/vega/{p-5130bb06.entry.js → p-c69a6547.entry.js} +1 -1
- package/dist/vega/{p-79c2282c.entry.js → p-c9740710.entry.js} +1 -1
- package/dist/vega/{p-f4546425.entry.js → p-ce5a3589.entry.js} +1 -1
- package/dist/vega/{p-cd3d468c.js → p-d1355307.js} +1 -1
- package/dist/vega/{p-8246f8ae.js → p-d7e0c57a.js} +1 -1
- package/dist/vega/p-e1ed78db.js +1 -0
- package/dist/vega/{p-34643550.entry.js → p-ef84dc90.entry.js} +1 -1
- package/dist/vega/{p-2458ad97.js → p-f229d6d1.js} +1 -1
- package/dist/vega/{p-fd2f699b.js → p-f25570f5.js} +1 -1
- package/dist/vega/{p-888dc143.entry.js → p-f27fcc7c.entry.js} +1 -1
- package/dist/vega/{p-e28fcf04.entry.js → p-f3ab00ad.entry.js} +1 -1
- package/dist/vega/{p-f3f7d059.entry.js → p-f543e911.entry.js} +1 -1
- package/dist/vega/{p-65d8c2bc.js → p-f5ac60f5.js} +1 -1
- package/dist/vega/{p-bdaf1143.entry.js → p-f7b5833d.entry.js} +1 -1
- package/dist/vega/p-fc02a67a.js +1 -0
- package/dist/vega/{p-a33c6652.entry.js → p-fcb5b40f.entry.js} +1 -1
- package/dist/vega/{p-aed3320d.js → p-fda6f8bc.js} +1 -1
- package/dist/vega/{p-e5196440.entry.js → p-fe1512f9.entry.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/vega/p-3a7e897b.entry.js +0 -1
- package/dist/vega/p-51297b96.js +0 -1
- package/dist/vega/p-51a4dc20.entry.js +0 -1
- package/dist/vega/p-53e9595f.js +0 -1
- package/dist/vega/p-6ec338b0.entry.js +0 -1
- package/dist/vega/p-76818196.entry.js +0 -1
- package/dist/vega/p-79a0a06c.js +0 -1
- package/dist/vega/p-b8d7d4a9.js +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const featureFlagController = require('./feature-flag-controller-ce2162c8.js');
|
|
4
|
+
const regex = require('./regex-c1f70fd4.js');
|
|
5
|
+
|
|
6
|
+
const CARDS_INFO = [
|
|
7
|
+
{
|
|
8
|
+
type: 'visa',
|
|
9
|
+
iconName: 'visa',
|
|
10
|
+
pattern: regex.VisaRegex,
|
|
11
|
+
maskConfig: {
|
|
12
|
+
type: 'credit-card',
|
|
13
|
+
options: {
|
|
14
|
+
mask: '9999 9999 9999 9999 999',
|
|
15
|
+
slot: '9',
|
|
16
|
+
accept: /\d/,
|
|
17
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
type: 'mastercard',
|
|
23
|
+
iconName: 'mastercard',
|
|
24
|
+
pattern: regex.MasterCardRegex,
|
|
25
|
+
maskConfig: {
|
|
26
|
+
type: 'credit-card',
|
|
27
|
+
options: {
|
|
28
|
+
mask: '9999 9999 9999 9999',
|
|
29
|
+
slot: '9',
|
|
30
|
+
accept: /\d/,
|
|
31
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'amex',
|
|
37
|
+
iconName: 'amex',
|
|
38
|
+
pattern: regex.AmexRegex,
|
|
39
|
+
maskConfig: {
|
|
40
|
+
type: 'credit-card',
|
|
41
|
+
options: {
|
|
42
|
+
mask: '9999 999999 99999',
|
|
43
|
+
slot: '9',
|
|
44
|
+
accept: /\d/,
|
|
45
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
type: 'discover',
|
|
51
|
+
iconName: 'discover',
|
|
52
|
+
pattern: regex.DiscoverRegex,
|
|
53
|
+
maskConfig: {
|
|
54
|
+
type: 'credit-card',
|
|
55
|
+
options: {
|
|
56
|
+
mask: '9999 9999 9999 9999',
|
|
57
|
+
slot: '9',
|
|
58
|
+
accept: /\d/,
|
|
59
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
exports.CARDS_INFO = CARDS_INFO;
|
|
@@ -20,7 +20,7 @@ class StringFormatStrategy {
|
|
|
20
20
|
* @returns {boolean} - Whether the format should be applied
|
|
21
21
|
*/
|
|
22
22
|
canFormat(triggeredBy, target, inputStatus) {
|
|
23
|
-
if (triggeredBy === 'init') {
|
|
23
|
+
if (triggeredBy === 'init' || triggeredBy === 'change') {
|
|
24
24
|
if (target === 'component' && typeGuard.isNonNullable(inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
|
|
25
25
|
return false;
|
|
26
26
|
}
|
|
@@ -31,6 +31,9 @@ class StringFormatStrategy {
|
|
|
31
31
|
if (triggeredBy === 'input' && target === 'native-input') {
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
34
|
+
if (triggeredBy === 'change' && (target === 'component' || target === 'native-input')) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
34
37
|
if (triggeredBy === 'blur' && (inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
|
|
35
38
|
if (target === 'component' && this.shouldOverrideComponentValueAfterBlur()) {
|
|
36
39
|
return true;
|
|
@@ -89,6 +92,14 @@ class StringMaskStrategy extends StringFormatStrategy {
|
|
|
89
92
|
this.acceptRegex = new RegExp(maskConfig.accept, 'g');
|
|
90
93
|
this.insertMode = maskConfig.insertMode === false ? false : true;
|
|
91
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Set the mask config
|
|
97
|
+
*
|
|
98
|
+
* @param {MaskConfig} maskConfig - MaskConfig
|
|
99
|
+
*/
|
|
100
|
+
setMaskConfig(maskConfig) {
|
|
101
|
+
this.maskConfig = maskConfig;
|
|
102
|
+
}
|
|
92
103
|
/**
|
|
93
104
|
* @inheritDoc
|
|
94
105
|
*/
|
|
@@ -326,6 +337,14 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
|
|
|
326
337
|
}
|
|
327
338
|
}
|
|
328
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Format string and update input field
|
|
342
|
+
*/
|
|
343
|
+
formatValueAfterValueChange() {
|
|
344
|
+
void index.waitForComponentDidRender(this.host).then(() => {
|
|
345
|
+
this.formatValue(this.inputElement.value, 'change');
|
|
346
|
+
});
|
|
347
|
+
}
|
|
329
348
|
/**
|
|
330
349
|
* Format the value by input strategy and blur strategy when formatter config change.
|
|
331
350
|
*/
|
|
@@ -20,7 +20,7 @@ const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
|
|
|
20
20
|
const vegaSkeletonLoaderController = require('./vega-skeleton-loader-controller-d534f5a1.js');
|
|
21
21
|
const staticSubjectTitle = require('./static-subject-title-7e7d791a.js');
|
|
22
22
|
const changeManager = require('./change-manager-a297e4d2.js');
|
|
23
|
-
const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-
|
|
23
|
+
const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-dc1747ad.js');
|
|
24
24
|
const elementAppenderSlimmer = require('./element-appender-slimmer-7f98d16b.js');
|
|
25
25
|
require('./vega-env-manager-23b8b23c.js');
|
|
26
26
|
const featureFlagController = require('./feature-flag-controller-ce2162c8.js');
|
|
@@ -11,9 +11,9 @@ exports.FrameworkEnum = void 0;
|
|
|
11
11
|
/** The VegaEnvManager class manages vega environment parameters. */
|
|
12
12
|
class VegaEnvManager {
|
|
13
13
|
constructor() {
|
|
14
|
-
// The `2.57.
|
|
14
|
+
// The `2.57.1` will be replaced to a version string when running publish script.
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
16
|
-
this.vegaVersion = '2.57.
|
|
16
|
+
this.vegaVersion = '2.57.1';
|
|
17
17
|
this.framework = exports.FrameworkEnum.VanillaJs;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7700600c.js');
|
|
6
|
-
const
|
|
7
|
-
const regex = require('./regex-c1f70fd4.js');
|
|
6
|
+
const cardConfig = require('./card-config-2ee5505e.js');
|
|
8
7
|
const requiredFieldRule = require('./required-field-rule-d73c1d8c.js');
|
|
9
8
|
const validCreditCardNumberRule = require('./valid-credit-card-number-rule-4a1b00b8.js');
|
|
10
9
|
const component = require('./component-1e352960.js');
|
|
@@ -18,9 +17,8 @@ const childNodesEventPreventSlimmer = require('./child-nodes-event-prevent-slimm
|
|
|
18
17
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-5aa4cc83.js');
|
|
19
18
|
const domNodeSubjectFactory = require('./dom-node-subject-factory-769dd00f.js');
|
|
20
19
|
const internalIconManager = require('./internal-icon-manager-f8677abb.js');
|
|
21
|
-
const
|
|
22
|
-
require('./
|
|
23
|
-
require('./_commonjsHelpers-537d719a.js');
|
|
20
|
+
const featureFlagController = require('./feature-flag-controller-ce2162c8.js');
|
|
21
|
+
require('./regex-c1f70fd4.js');
|
|
24
22
|
require('./internal-form-field-validation-rule.abstract-07cdff46.js');
|
|
25
23
|
require('./number-4816603d.js');
|
|
26
24
|
require('./string-21427167.js');
|
|
@@ -28,6 +26,7 @@ require('./observer-f49483e8.js');
|
|
|
28
26
|
require('./ui-6c069604.js');
|
|
29
27
|
require('./create-public-api-runtime-metrics-slimmer-e2e274e1.js');
|
|
30
28
|
require('./dynamic-slimmer-f31fdfd7.js');
|
|
29
|
+
require('./vega-internal-event-id-bda08efa.js');
|
|
31
30
|
require('./translation-de7e351e.js');
|
|
32
31
|
require('./page-resize-observer-slimmer-11937d6f.js');
|
|
33
32
|
require('./ui-32e69595.js');
|
|
@@ -40,65 +39,8 @@ require('./sub-state-observer-slimmer-93d0a609.js');
|
|
|
40
39
|
require('./internal-vega-event-manager-e98944ac.js');
|
|
41
40
|
require('./vega-env-manager-23b8b23c.js');
|
|
42
41
|
require('./icon-manager-9072356d.js');
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
type: 'visa',
|
|
47
|
-
iconName: 'visa',
|
|
48
|
-
pattern: regex.VisaRegex,
|
|
49
|
-
maskConfig: {
|
|
50
|
-
type: 'custom',
|
|
51
|
-
options: {
|
|
52
|
-
mask: '9999 9999 9999 9999 999',
|
|
53
|
-
slot: '9',
|
|
54
|
-
accept: /\d/,
|
|
55
|
-
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: 'mastercard',
|
|
61
|
-
iconName: 'mastercard',
|
|
62
|
-
pattern: regex.MasterCardRegex,
|
|
63
|
-
maskConfig: {
|
|
64
|
-
type: 'custom',
|
|
65
|
-
options: {
|
|
66
|
-
mask: '9999 9999 9999 9999',
|
|
67
|
-
slot: '9',
|
|
68
|
-
accept: /\d/,
|
|
69
|
-
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: 'amex',
|
|
75
|
-
iconName: 'amex',
|
|
76
|
-
pattern: regex.AmexRegex,
|
|
77
|
-
maskConfig: {
|
|
78
|
-
type: 'custom',
|
|
79
|
-
options: {
|
|
80
|
-
mask: '9999 999999 99999',
|
|
81
|
-
slot: '9',
|
|
82
|
-
accept: /\d/,
|
|
83
|
-
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: 'discover',
|
|
89
|
-
iconName: 'discover',
|
|
90
|
-
pattern: regex.DiscoverRegex,
|
|
91
|
-
maskConfig: {
|
|
92
|
-
type: 'custom',
|
|
93
|
-
options: {
|
|
94
|
-
mask: '9999 9999 9999 9999',
|
|
95
|
-
slot: '9',
|
|
96
|
-
accept: /\d/,
|
|
97
|
-
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
];
|
|
42
|
+
require('./index-4d7bce1a.js');
|
|
43
|
+
require('./_commonjsHelpers-537d719a.js');
|
|
102
44
|
|
|
103
45
|
const Icons = {
|
|
104
46
|
'visa': {
|
|
@@ -194,17 +136,6 @@ const VegaInputCreditCard = class {
|
|
|
194
136
|
this.focusEventEmitter = eventEmitSlimmer.createEventEmitSlimmer(VegaInputCreditCard, domNodeSubjectFactory.VegaFocus);
|
|
195
137
|
this.inputCreditCardEventPrevent = new childNodesEventPreventSlimmer.ChildNodesEventPreventSlimmer([domNodeSubjectFactory.VegaChange, domNodeSubjectFactory.VegaFocus, domNodeSubjectFactory.VegaBlur], () => this.host, true);
|
|
196
138
|
this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer(VegaInputCreditCardRuntimeMetricsPayloadDefinition);
|
|
197
|
-
this.maskConfig = {
|
|
198
|
-
type: 'custom',
|
|
199
|
-
options: {
|
|
200
|
-
mask: '',
|
|
201
|
-
slot: '9',
|
|
202
|
-
accept: /[\d\s]/,
|
|
203
|
-
insertMode: false,
|
|
204
|
-
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
205
|
-
},
|
|
206
|
-
trigger: 'blur',
|
|
207
|
-
};
|
|
208
139
|
/**
|
|
209
140
|
* Specifies whether a card number must be entered for
|
|
210
141
|
* this component to pass form validation.
|
|
@@ -292,7 +223,7 @@ const VegaInputCreditCard = class {
|
|
|
292
223
|
this.renderInputContainer = () => {
|
|
293
224
|
var _a;
|
|
294
225
|
const iconName = ((_a = this.getCreditCardType(this.value)) === null || _a === void 0 ? void 0 : _a.iconName) || 'regular-credit-card';
|
|
295
|
-
return (index.h("vega-input", { label: this.label, type: "number", prefixIcon: internalIconManager.VegaInternalIconManager.getIconKey(iconName), maskConfig: this.getMaskConfig(
|
|
226
|
+
return (index.h("vega-input", { label: this.label, type: "number", prefixIcon: internalIconManager.VegaInternalIconManager.getIconKey(iconName), maskConfig: this.getMaskConfig(), placeholder: this.placeholder, disabled: this.disabled, size: this.size, value: this.value, hint: this.hint, required: this.required, showClearIcon: false, ref: (ref) => {
|
|
296
227
|
this.inputRef = ref;
|
|
297
228
|
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, domNodeSubjectFactory.VegaChange, (input) => {
|
|
298
229
|
this.handleVegaChange(input);
|
|
@@ -303,10 +234,6 @@ const VegaInputCreditCard = class {
|
|
|
303
234
|
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, domNodeSubjectFactory.VegaFocus, () => {
|
|
304
235
|
this.handleVegaFocus();
|
|
305
236
|
});
|
|
306
|
-
domNodeSubjectObserverFactory.DomNodeSubjectObserverFactory.addUniqueObserverToNode(ref, vegaInternalEventId.VegaInternalPasteEvent, (event) => {
|
|
307
|
-
const pastedValue = event.clipboardData.getData('text');
|
|
308
|
-
this.inputRef.maskConfig = this.getMaskConfig(pastedValue); // The mask should be updated before the value changed.
|
|
309
|
-
});
|
|
310
237
|
} }));
|
|
311
238
|
};
|
|
312
239
|
this.handleVegaChange = (e) => {
|
|
@@ -347,43 +274,20 @@ const VegaInputCreditCard = class {
|
|
|
347
274
|
return component.sanitizeVegaComponent(index.h(index.Host, null, this.renderInputContainer()), this.host);
|
|
348
275
|
}
|
|
349
276
|
getCreditCardType(value) {
|
|
350
|
-
return CARDS_INFO.filter((card) => card.pattern.test(value))[0];
|
|
351
|
-
}
|
|
352
|
-
getMaskConfig(value) {
|
|
353
|
-
const maskConfig = [];
|
|
354
|
-
const creditCardType = this.getCreditCardType(value);
|
|
355
|
-
if (creditCardType) {
|
|
356
|
-
maskConfig.push(creditCardType.maskConfig);
|
|
357
|
-
if (this.hideCardNumberOnBlur && value.trim().includes(' ')) {
|
|
358
|
-
this.maskConfig.options.mask = this.generateDynamicMask();
|
|
359
|
-
maskConfig.push(this.maskConfig);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
return maskConfig;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* The below method is e2e-test covered in
|
|
366
|
-
* @see{module:vega-input-credit-card-dynamic-mask-e2e}
|
|
367
|
-
*/
|
|
368
|
-
/* istanbul ignore next */
|
|
369
|
-
/** Transform the input card number with dynamic card number mask, for example: '4111 2222 3333 44' will be transformed to 'XXXX XXXX XXXX 99' */
|
|
370
|
-
generateDynamicMask() {
|
|
371
|
-
const cardNumberSplit = this.value.trim().split(' ');
|
|
372
|
-
const cardNumberMask = this.maskCardNumber(cardNumberSplit).join(' ');
|
|
373
|
-
return cardNumberMask;
|
|
277
|
+
return cardConfig.CARDS_INFO.filter((card) => card.pattern.test(value))[0];
|
|
374
278
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
279
|
+
getMaskConfig() {
|
|
280
|
+
return [
|
|
281
|
+
{
|
|
282
|
+
type: 'credit-card',
|
|
283
|
+
trigger: 'input',
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
type: 'credit-card',
|
|
287
|
+
trigger: 'blur',
|
|
288
|
+
hideCardNumberOnBlur: this.hideCardNumberOnBlur,
|
|
289
|
+
},
|
|
290
|
+
];
|
|
387
291
|
}
|
|
388
292
|
get host() { return index.getElement(this); }
|
|
389
293
|
static get watchers() { return {
|
|
@@ -18,8 +18,10 @@ const eventEmitSlimmer = require('./event-emit-slimmer-6154c759.js');
|
|
|
18
18
|
const domNodeSubjectFactory = require('./dom-node-subject-factory-769dd00f.js');
|
|
19
19
|
const staticSubjectTitle = require('./static-subject-title-7e7d791a.js');
|
|
20
20
|
const changeManager = require('./change-manager-a297e4d2.js');
|
|
21
|
-
const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-
|
|
21
|
+
const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-dc1747ad.js');
|
|
22
22
|
const typeGuard = require('./type-guard-aa8fdeaf.js');
|
|
23
|
+
const featureFlagController = require('./feature-flag-controller-ce2162c8.js');
|
|
24
|
+
const cardConfig = require('./card-config-2ee5505e.js');
|
|
23
25
|
const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-5aa4cc83.js');
|
|
24
26
|
const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-11937d6f.js');
|
|
25
27
|
const subStateObserverSlimmer = require('./sub-state-observer-slimmer-93d0a609.js');
|
|
@@ -43,6 +45,8 @@ require('./breakpoints-ebde4837.js');
|
|
|
43
45
|
require('./ui-32e69595.js');
|
|
44
46
|
require('./regex-c1f70fd4.js');
|
|
45
47
|
require('./typography-4560e7f1.js');
|
|
48
|
+
require('./index-4d7bce1a.js');
|
|
49
|
+
require('./_commonjsHelpers-537d719a.js');
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* This email regex from https://stackoverflow.com/a/201378
|
|
@@ -465,6 +469,173 @@ class NumberThousandCommaStrategy extends NumberMaskStrategy {
|
|
|
465
469
|
}
|
|
466
470
|
}
|
|
467
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Credit card mask strategy abstract class
|
|
474
|
+
*/
|
|
475
|
+
class CreditCardMaskStrategy extends stringInputFormatterSlimmer.StringMaskStrategy {
|
|
476
|
+
/* istanbul ignore next */
|
|
477
|
+
/**
|
|
478
|
+
* Get the position of caret
|
|
479
|
+
*
|
|
480
|
+
* @param {string} input - The input string
|
|
481
|
+
* @param {number} caretPosition - The current position of caret
|
|
482
|
+
* @returns {Nullable<number>} The new position of caret
|
|
483
|
+
*/
|
|
484
|
+
calculateCaretPosition(input, caretPosition) {
|
|
485
|
+
if (!typeGuard.isNonNullable(caretPosition))
|
|
486
|
+
return null;
|
|
487
|
+
const maskConfigType = this.getCreditCardMaskConfig(input);
|
|
488
|
+
if (maskConfigType) {
|
|
489
|
+
if (input.length > this.getLengthLimit()) {
|
|
490
|
+
const exceededLength = input.length - this.getLengthLimit();
|
|
491
|
+
return caretPosition - exceededLength;
|
|
492
|
+
}
|
|
493
|
+
const startValue = input.substring(0, caretPosition);
|
|
494
|
+
const maskedStartValue = this.format(startValue);
|
|
495
|
+
return caretPosition + (maskedStartValue.length - startValue.length);
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
return caretPosition;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
/* istanbul ignore next */
|
|
502
|
+
/**
|
|
503
|
+
* @inheritDoc
|
|
504
|
+
*/
|
|
505
|
+
format(input, inputStatus) {
|
|
506
|
+
const maskConfigType = this.getCreditCardMaskConfig(input);
|
|
507
|
+
if (maskConfigType) {
|
|
508
|
+
this.setMaskConfig(maskConfigType.options);
|
|
509
|
+
const caretPosition = inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.caretPosition;
|
|
510
|
+
if (input.length > this.getLengthLimit() && typeGuard.isNonNullable(caretPosition)) {
|
|
511
|
+
const rawValueArr = [...input];
|
|
512
|
+
const exceededLength = input.length - this.getLengthLimit();
|
|
513
|
+
rawValueArr.splice(caretPosition - exceededLength, exceededLength);
|
|
514
|
+
return rawValueArr.join('');
|
|
515
|
+
}
|
|
516
|
+
return this.replaceMaskWithMatchedInputSlots(input, this.getMatchedInputSlotValue(input));
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
return input;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* get credit card type
|
|
524
|
+
*
|
|
525
|
+
* @param {string} value - card number string
|
|
526
|
+
* @returns {CardConfigType} - card type config
|
|
527
|
+
*/
|
|
528
|
+
getCreditCardType(value) {
|
|
529
|
+
return cardConfig.CARDS_INFO.filter((card) => card.pattern.test(value))[0];
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* A class for formatting string with the given mask format
|
|
535
|
+
*
|
|
536
|
+
* @augments StringFormatStrategy
|
|
537
|
+
*/
|
|
538
|
+
class CreditCardInputMaskStrategy extends CreditCardMaskStrategy {
|
|
539
|
+
/**
|
|
540
|
+
* It creates a new instance of the Mask class.
|
|
541
|
+
*/
|
|
542
|
+
constructor() {
|
|
543
|
+
super({
|
|
544
|
+
mask: '',
|
|
545
|
+
slot: '9',
|
|
546
|
+
accept: /\d/,
|
|
547
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* get credit card mask config
|
|
552
|
+
*
|
|
553
|
+
* @param {string} value - card number string
|
|
554
|
+
* @returns {Nullable<MaskConfigType>} - mask config type
|
|
555
|
+
*/
|
|
556
|
+
getCreditCardMaskConfig(value) {
|
|
557
|
+
let maskConfig;
|
|
558
|
+
const creditCardType = this.getCreditCardType(value);
|
|
559
|
+
if (creditCardType) {
|
|
560
|
+
maskConfig = creditCardType.maskConfig;
|
|
561
|
+
}
|
|
562
|
+
return maskConfig;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* A class for formatting string with the given mask format
|
|
568
|
+
*
|
|
569
|
+
* @augments StringFormatStrategy
|
|
570
|
+
*/
|
|
571
|
+
class CreditCardBlurMaskStrategy extends CreditCardMaskStrategy {
|
|
572
|
+
/**
|
|
573
|
+
* It creates a new instance of the Mask class.
|
|
574
|
+
*
|
|
575
|
+
* @param {boolean} hideCardNumberOnBlur - boolean
|
|
576
|
+
*/
|
|
577
|
+
constructor(hideCardNumberOnBlur) {
|
|
578
|
+
super({
|
|
579
|
+
mask: '',
|
|
580
|
+
slot: '9',
|
|
581
|
+
accept: /[\d\s]/,
|
|
582
|
+
insertMode: false,
|
|
583
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
584
|
+
});
|
|
585
|
+
this.hideCardNumberOnBlur = hideCardNumberOnBlur;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @inheritDoc
|
|
589
|
+
*/
|
|
590
|
+
getCreditCardMaskConfig(value) {
|
|
591
|
+
let maskConfig;
|
|
592
|
+
const creditCardType = this.getCreditCardType(value);
|
|
593
|
+
if (creditCardType) {
|
|
594
|
+
if (this.hideCardNumberOnBlur && value.trim().includes(' ')) {
|
|
595
|
+
maskConfig = this.generateDynamicMask(value);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return maskConfig;
|
|
599
|
+
}
|
|
600
|
+
/*
|
|
601
|
+
* The below method is e2e-test covered in
|
|
602
|
+
*
|
|
603
|
+
* @see{module:vega-input-credit-card-dynamic-mask-e2e}
|
|
604
|
+
*/
|
|
605
|
+
/* istanbul ignore next */
|
|
606
|
+
/**
|
|
607
|
+
* Transform the input card number with dynamic card number mask, for example: '4111 2222 3333 44' will be transformed to 'XXXX XXXX XXXX 99'
|
|
608
|
+
*
|
|
609
|
+
* @param {string} value - card number string
|
|
610
|
+
* @returns {MaskConfigType} - mask config type
|
|
611
|
+
*/
|
|
612
|
+
generateDynamicMask(value) {
|
|
613
|
+
const maskConfig = {
|
|
614
|
+
type: 'credit-card',
|
|
615
|
+
options: {
|
|
616
|
+
mask: '',
|
|
617
|
+
slot: '9',
|
|
618
|
+
accept: /[\d\s]/,
|
|
619
|
+
insertMode: false,
|
|
620
|
+
triggerAtInit: featureFlagController.FeatureFlag.isEnabled('VEGA_INPUT_CREDIT_CARD.ENABLE_HIDE_NUMBER_MASK_ON_FIRST_LOAD'),
|
|
621
|
+
},
|
|
622
|
+
trigger: 'blur',
|
|
623
|
+
};
|
|
624
|
+
const cardNumberSplit = value.trim().split(' ');
|
|
625
|
+
const cardNumberMask =
|
|
626
|
+
// Map through the array and replace each character with 'X' or '9' depending on the index
|
|
627
|
+
cardNumberSplit
|
|
628
|
+
.map((element, index) => {
|
|
629
|
+
// Replace each character in the string with 'X' except the last element, which uses '9'
|
|
630
|
+
const replacementChar = index === cardNumberSplit.length - 1 ? '9' : 'X';
|
|
631
|
+
return replacementChar.repeat(element.length);
|
|
632
|
+
})
|
|
633
|
+
.join(' ');
|
|
634
|
+
maskConfig.options.mask = cardNumberMask;
|
|
635
|
+
return maskConfig;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
468
639
|
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
469
640
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
470
641
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -500,6 +671,17 @@ class VegaInputMaskConfigController extends stringInputFormatterSlimmer.StringIn
|
|
|
500
671
|
return this.generateMaskStrategy('blur');
|
|
501
672
|
};
|
|
502
673
|
}
|
|
674
|
+
/**
|
|
675
|
+
* Detect value change and initialize mask formatting
|
|
676
|
+
*
|
|
677
|
+
* @param {string} newValue The new value
|
|
678
|
+
* @param {string} oldValue The new value
|
|
679
|
+
*/
|
|
680
|
+
watchValue(newValue, oldValue) {
|
|
681
|
+
if (newValue !== oldValue) {
|
|
682
|
+
this.formatValueAfterValueChange();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
503
685
|
/**
|
|
504
686
|
* The function `setupStringFormatter` sets up a string formatter for an input element based on provided mask configurations.
|
|
505
687
|
*
|
|
@@ -555,6 +737,12 @@ class VegaInputMaskConfigController extends stringInputFormatterSlimmer.StringIn
|
|
|
555
737
|
case 'number':
|
|
556
738
|
stringFormatStrategy = this.getNumberTypeMaskStrategy(maskConfig.options);
|
|
557
739
|
break;
|
|
740
|
+
case 'credit-card':
|
|
741
|
+
stringFormatStrategy =
|
|
742
|
+
maskTrigger === 'input'
|
|
743
|
+
? new CreditCardInputMaskStrategy()
|
|
744
|
+
: new CreditCardBlurMaskStrategy(maskConfig.hideCardNumberOnBlur);
|
|
745
|
+
break;
|
|
558
746
|
case 'custom':
|
|
559
747
|
stringFormatStrategy = new stringInputFormatterSlimmer.StringMaskStrategy(maskConfig.options);
|
|
560
748
|
break;
|
|
@@ -589,7 +777,8 @@ class VegaInputMaskConfigController extends stringInputFormatterSlimmer.StringIn
|
|
|
589
777
|
* 'custom' and a trigger of 'blur'.
|
|
590
778
|
*/
|
|
591
779
|
isBlurModeMaskConfig(maskConfig) {
|
|
592
|
-
return maskConfig.type === 'custom'
|
|
780
|
+
return ((maskConfig.type === 'custom' || maskConfig.type === 'credit-card') &&
|
|
781
|
+
maskConfig.trigger === 'blur');
|
|
593
782
|
}
|
|
594
783
|
}
|
|
595
784
|
__decorate$3([
|
|
@@ -601,6 +790,9 @@ __decorate$3([
|
|
|
601
790
|
__decorate$3([
|
|
602
791
|
globalSlimmerRegistry.MapToComponentField()
|
|
603
792
|
], VegaInputMaskConfigController.prototype, "type", void 0);
|
|
793
|
+
__decorate$3([
|
|
794
|
+
globalSlimmerRegistry.MapToComponentMethod('watchValue')
|
|
795
|
+
], VegaInputMaskConfigController.prototype, "watchValue", null);
|
|
604
796
|
|
|
605
797
|
const VegaInputRuntimeMetricsPayloadDefinition = [
|
|
606
798
|
{
|
|
@@ -4,13 +4,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { MapToComponentField } from 'vega-slimmer/core';
|
|
7
|
+
import { MapToComponentField, MapToComponentMethod } from 'vega-slimmer/core';
|
|
8
8
|
import { StringMaskStrategy, } from '../../../../helpers/formatter/string-formatter/string-mask-strategy';
|
|
9
9
|
import { ThousandCommaStrategy } from '../../../../helpers/formatter/string-formatter/thousand-comma-strategy';
|
|
10
10
|
import { NumberMaskStrategy, } from '../../../../helpers/formatter/string-formatter/number-mask-strategy';
|
|
11
11
|
import { StringInputFormatterSlimmer } from '../../../../helpers/slimmers/string-input-formatter-slimmer';
|
|
12
12
|
import { CustomFormatterStrategy } from '../../../../helpers/formatter/string-formatter/custom-formatter-strategy';
|
|
13
13
|
import { NumberThousandCommaStrategy } from '../../../../helpers/formatter/string-formatter/number-thousand-comma-strategy';
|
|
14
|
+
import { CreditCardInputMaskStrategy } from '../../../../helpers/formatter/string-formatter/credit-card-input-mask-strategy';
|
|
15
|
+
import { CreditCardBlurMaskStrategy } from '../../../../helpers/formatter/string-formatter/credit-card-blur-mask-strategy';
|
|
14
16
|
/** The `VegaInputMaskConfigController` class in TypeScript manages input mask configuration and string formatting for an input element within a component's shadow root. */
|
|
15
17
|
export class VegaInputMaskConfigController extends StringInputFormatterSlimmer {
|
|
16
18
|
constructor() {
|
|
@@ -40,6 +42,17 @@ export class VegaInputMaskConfigController extends StringInputFormatterSlimmer {
|
|
|
40
42
|
return this.generateMaskStrategy('blur');
|
|
41
43
|
};
|
|
42
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Detect value change and initialize mask formatting
|
|
47
|
+
*
|
|
48
|
+
* @param {string} newValue The new value
|
|
49
|
+
* @param {string} oldValue The new value
|
|
50
|
+
*/
|
|
51
|
+
watchValue(newValue, oldValue) {
|
|
52
|
+
if (newValue !== oldValue) {
|
|
53
|
+
this.formatValueAfterValueChange();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
43
56
|
/**
|
|
44
57
|
* The function `setupStringFormatter` sets up a string formatter for an input element based on provided mask configurations.
|
|
45
58
|
*
|
|
@@ -95,6 +108,12 @@ export class VegaInputMaskConfigController extends StringInputFormatterSlimmer {
|
|
|
95
108
|
case 'number':
|
|
96
109
|
stringFormatStrategy = this.getNumberTypeMaskStrategy(maskConfig.options);
|
|
97
110
|
break;
|
|
111
|
+
case 'credit-card':
|
|
112
|
+
stringFormatStrategy =
|
|
113
|
+
maskTrigger === 'input'
|
|
114
|
+
? new CreditCardInputMaskStrategy()
|
|
115
|
+
: new CreditCardBlurMaskStrategy(maskConfig.hideCardNumberOnBlur);
|
|
116
|
+
break;
|
|
98
117
|
case 'custom':
|
|
99
118
|
stringFormatStrategy = new StringMaskStrategy(maskConfig.options);
|
|
100
119
|
break;
|
|
@@ -129,7 +148,8 @@ export class VegaInputMaskConfigController extends StringInputFormatterSlimmer {
|
|
|
129
148
|
* 'custom' and a trigger of 'blur'.
|
|
130
149
|
*/
|
|
131
150
|
isBlurModeMaskConfig(maskConfig) {
|
|
132
|
-
return maskConfig.type === 'custom'
|
|
151
|
+
return ((maskConfig.type === 'custom' || maskConfig.type === 'credit-card') &&
|
|
152
|
+
maskConfig.trigger === 'blur');
|
|
133
153
|
}
|
|
134
154
|
}
|
|
135
155
|
__decorate([
|
|
@@ -141,3 +161,6 @@ __decorate([
|
|
|
141
161
|
__decorate([
|
|
142
162
|
MapToComponentField()
|
|
143
163
|
], VegaInputMaskConfigController.prototype, "type", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
MapToComponentMethod('watchValue')
|
|
166
|
+
], VegaInputMaskConfigController.prototype, "watchValue", null);
|
|
@@ -924,7 +924,7 @@ export class VegaInput {
|
|
|
924
924
|
"mutable": false,
|
|
925
925
|
"complexType": {
|
|
926
926
|
"original": "MaskConfigType | MaskConfigType[]",
|
|
927
|
-
"resolved": "MaskConfigType[] | ({ type: \"number\" | \"phone\" | \"zipcode\" | \"taxId\" | \"custom\" | \"thousand-comma\" | \"custom-formatter\"; options?: MaskConfig | NumberMaskConfig; trigger?: \"blur\" | \"input\"; formatter?: (value: string) => string; resetCaretPosition?: boolean; })",
|
|
927
|
+
"resolved": "MaskConfigType[] | ({ type: \"number\" | \"phone\" | \"zipcode\" | \"taxId\" | \"custom\" | \"thousand-comma\" | \"custom-formatter\" | \"credit-card\"; options?: MaskConfig | NumberMaskConfig; trigger?: \"blur\" | \"input\"; formatter?: (value: string) => string; resetCaretPosition?: boolean; hideCardNumberOnBlur?: boolean; })",
|
|
928
928
|
"references": {
|
|
929
929
|
"MaskConfigType": {
|
|
930
930
|
"location": "import",
|