@globalpayments/vega 2.37.1 → 2.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/cjs/{app-globals-e10d1859.js → app-globals-7087f121.js} +1 -1
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/{string-input-formatter-slimmer-072b75a0.js → string-input-formatter-slimmer-f45931fd.js} +111 -32
  5. package/dist/cjs/vega-date-picker_2.cjs.entry.js +2 -2
  6. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  7. package/dist/cjs/vega-input.cjs.entry.js +6 -4
  8. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +54 -1
  9. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +1 -1
  10. package/dist/cjs/{vega-skeleton-loader-controller-ef43cfc1.js → vega-skeleton-loader-controller-00dbdf29.js} +11 -3
  11. package/dist/cjs/vega.cjs.js +2 -2
  12. package/dist/collection/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.js +49 -0
  13. package/dist/collection/components/vega-loader-wrapper/vega-loader-wrapper.js +5 -0
  14. package/dist/collection/helpers/formatter/string-formatter/custom-formatter-strategy.js +3 -1
  15. package/dist/collection/helpers/formatter/string-formatter/number-mask-strategy.js +3 -1
  16. package/dist/collection/helpers/formatter/string-formatter/string-format-strategy.abstract.js +52 -0
  17. package/dist/collection/helpers/formatter/string-formatter/string-mask-strategy.js +6 -7
  18. package/dist/collection/helpers/formatter/string-formatter/thousand-comma-strategy.js +2 -1
  19. package/dist/collection/helpers/formatter/test/string-formatter/custom-formatter-strategy.test.js +2 -1
  20. package/dist/collection/helpers/formatter/test/string-formatter/number-mask-strategy.test.js +9 -0
  21. package/dist/collection/helpers/formatter/test/string-formatter/string-mask-strategy.test.js +62 -4
  22. package/dist/collection/helpers/loading-indicator/tests/vega-loader-controller.test.js +29 -2
  23. package/dist/collection/helpers/loading-indicator/vega-loader-controller.js +11 -3
  24. package/dist/collection/helpers/slimmers/string-input-formatter-slimmer.js +53 -25
  25. package/dist/collection/helpers/slimmers/test/string-input-formatter-slimmer.test.js +2 -1
  26. package/dist/esm/{app-globals-c1f2bea9.js → app-globals-4cca4a96.js} +1 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/loader.js +2 -2
  29. package/dist/esm/{string-input-formatter-slimmer-930f1125.js → string-input-formatter-slimmer-d4132497.js} +111 -33
  30. package/dist/esm/vega-date-picker_2.entry.js +2 -2
  31. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  32. package/dist/esm/vega-input.entry.js +6 -4
  33. package/dist/esm/vega-loader-wrapper_2.entry.js +55 -2
  34. package/dist/esm/vega-rich-text-editor_4.entry.js +1 -1
  35. package/dist/esm/{vega-skeleton-loader-controller-0044d77f.js → vega-skeleton-loader-controller-5aea7aeb.js} +11 -3
  36. package/dist/esm/vega.js +2 -2
  37. package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-format-controller.d.ts +1 -1
  38. package/dist/types/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.d.ts +1 -1
  39. package/dist/types/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.d.ts +21 -0
  40. package/dist/types/components/vega-loader-wrapper/vega-loader-wrapper.d.ts +2 -0
  41. package/dist/types/helpers/formatter/string-formatter/custom-formatter-strategy.d.ts +3 -3
  42. package/dist/types/helpers/formatter/string-formatter/number-mask-strategy.d.ts +2 -2
  43. package/dist/types/helpers/formatter/string-formatter/string-format-strategy.abstract.d.ts +48 -0
  44. package/dist/types/helpers/formatter/string-formatter/string-mask-strategy.d.ts +6 -10
  45. package/dist/types/helpers/formatter/string-formatter/thousand-comma-strategy.d.ts +2 -2
  46. package/dist/types/helpers/loading-indicator/vega-loader-controller.d.ts +1 -0
  47. package/dist/types/helpers/slimmers/string-input-formatter-slimmer.d.ts +20 -4
  48. package/dist/vega/index.esm.js +1 -1
  49. package/dist/vega/{p-6100e1aa.js → p-1d93b3a9.js} +1 -1
  50. package/dist/vega/p-20326c64.js +1 -0
  51. package/dist/vega/p-5f377954.js +1 -1
  52. package/dist/vega/p-76a8ccbb.js +1 -0
  53. package/dist/vega/{p-da66dad5.entry.js → p-9728d571.entry.js} +1 -1
  54. package/dist/vega/{p-9eb90ee8.entry.js → p-a2a34239.entry.js} +1 -1
  55. package/dist/vega/p-e4ce559d.entry.js +1 -0
  56. package/dist/vega/p-ecaf4cfa.entry.js +1 -0
  57. package/dist/vega/vega.esm.js +1 -1
  58. package/package.json +1 -1
  59. package/dist/types/helpers/formatter/string-formatter/string-format-strategy.d.ts +0 -12
  60. package/dist/vega/p-4c18ff36.js +0 -1
  61. package/dist/vega/p-84a7c18a.entry.js +0 -1
  62. package/dist/vega/p-a98475a2.entry.js +0 -1
  63. package/dist/vega/p-b2d47bdd.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const featureFlagController = require('./feature-flag-controller-7b22e598.js');
4
- const vegaSkeletonLoaderController = require('./vega-skeleton-loader-controller-ef43cfc1.js');
4
+ const vegaSkeletonLoaderController = require('./vega-skeleton-loader-controller-00dbdf29.js');
5
5
  const nodeAnnotation_abstract = require('./node-annotation.abstract-4f6df9cf.js');
6
6
  const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
7
7
  const vegaDialogController = require('./vega-dialog-controller-fe610705.js');
@@ -12,7 +12,7 @@ const icons = require('./icons-dbc3eb9c.js');
12
12
  const typography = require('./typography-4560e7f1.js');
13
13
  const ui = require('./ui-32e69595.js');
14
14
  const vegaEnvManager = require('./vega-env-manager-23b8b23c.js');
15
- const vegaSkeletonLoaderController = require('./vega-skeleton-loader-controller-ef43cfc1.js');
15
+ const vegaSkeletonLoaderController = require('./vega-skeleton-loader-controller-00dbdf29.js');
16
16
  const featureFlagController = require('./feature-flag-controller-7b22e598.js');
17
17
  const nodeAnnotation_abstract = require('./node-annotation.abstract-4f6df9cf.js');
18
18
  const vegaDialogController = require('./vega-dialog-controller-fe610705.js');
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-09acd3c9.js');
6
- const appGlobals = require('./app-globals-e10d1859.js');
6
+ const appGlobals = require('./app-globals-7087f121.js');
7
7
  require('./feature-flag-controller-7b22e598.js');
8
8
  require('./global-slimmer-registry-b3bce7e0.js');
9
9
  require('./index-8b247c17.js');
10
10
  require('./_commonjsHelpers-537d719a.js');
11
- require('./vega-skeleton-loader-controller-ef43cfc1.js');
11
+ require('./vega-skeleton-loader-controller-00dbdf29.js');
12
12
  require('./create-public-api-runtime-metrics-slimmer-54c3f73b.js');
13
13
  require('./dynamic-slimmer-f31fdfd7.js');
14
14
  require('./ui-5fd9b267.js');
@@ -7,18 +7,71 @@ const domNodeSubjectFactory = require('./dom-node-subject-factory-ce1777a9.js');
7
7
  const vegaInternalEventId = require('./vega-internal-event-id-bda63e14.js');
8
8
  const index = require('./index-0546e2ea.js');
9
9
 
10
+ /**
11
+ * String format strategy abstract class
12
+ */
13
+ class StringFormatStrategy {
14
+ /**
15
+ * Check if the {@link format} should be applied
16
+ *
17
+ * @param {FormatTrigger} triggeredBy - The trigger of the format
18
+ * @param {FormatTarget} target - The target of the format
19
+ * @param {InputStatus} inputStatus - The status of the input
20
+ * @returns {boolean} - Whether the format should be applied
21
+ */
22
+ canFormat(triggeredBy, target, inputStatus) {
23
+ if (triggeredBy === 'init') {
24
+ if (target === 'component' && typeGuard.isNonNullable(inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
25
+ return false;
26
+ }
27
+ if (this.shouldTriggerAtInit()) {
28
+ return true;
29
+ }
30
+ }
31
+ if (triggeredBy === 'input' && target === 'native-input') {
32
+ return true;
33
+ }
34
+ if (triggeredBy === 'blur' && (inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
35
+ if (target === 'component' && this.shouldOverrideComponentValueAfterBlur()) {
36
+ return true;
37
+ }
38
+ if (target === 'native-input') {
39
+ return true;
40
+ }
41
+ }
42
+ return false;
43
+ }
44
+ /**
45
+ * Determines whether a component value should be overridden based on the mask configuration.
46
+ *
47
+ * @returns {boolean} - Whether the component value should be overridden.
48
+ */
49
+ shouldOverrideComponentValueAfterBlur() {
50
+ return false;
51
+ }
52
+ /**
53
+ * Determines whether the format should be triggered at init.
54
+ *
55
+ * @returns {boolean} - Whether the format should be triggered at init.
56
+ */
57
+ shouldTriggerAtInit() {
58
+ return false; // TODO: trigger at init feature is not implemented to all strategies. To keep the same behavior as before so set false here as default.
59
+ }
60
+ }
61
+
10
62
  /**
11
63
  * A class for formatting string with the given mask format
12
64
  *
13
65
  * @augments StringFormatStrategy
14
66
  */
15
- class StringMaskStrategy {
67
+ class StringMaskStrategy extends StringFormatStrategy {
16
68
  /**
17
69
  * It creates a new instance of the Mask class.
18
70
  *
19
71
  * @param {MaskConfig} maskConfig - MaskConfig
20
72
  */
21
73
  constructor(maskConfig) {
74
+ super();
22
75
  /**
23
76
  * The insert mode means adding some special character in the input string, will replace part of input string if insertMode set to false.
24
77
  *
@@ -37,13 +90,10 @@ class StringMaskStrategy {
37
90
  this.insertMode = maskConfig.insertMode === false ? false : true;
38
91
  }
39
92
  /**
40
- * Given a string, it replaces the mask with the matched input slot value
41
- *
42
- * @param {string} input - The input string that needs to be formatted.
43
- * @param {number} caretPosition - The current position of caret
44
- * @returns {string} The formatted string.
93
+ * @inheritDoc
45
94
  */
46
- format(input, caretPosition) {
95
+ format(input, inputStatus) {
96
+ const caretPosition = inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.caretPosition;
47
97
  if (input.length > this.getLengthLimit() && typeGuard.isNonNullable(caretPosition)) {
48
98
  const rawValueArr = [...input];
49
99
  const exceededLength = input.length - this.getLengthLimit();
@@ -193,7 +243,7 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
193
243
  }
194
244
  };
195
245
  /**
196
- * A function update the value of the input element by inputFormatStrategy output.
246
+ * A function updates the value of the input element by inputFormatStrategy output.
197
247
  *
198
248
  * @param {InputEvent} e - blur event
199
249
  */
@@ -201,17 +251,11 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
201
251
  if (this.blurFormatStrategy) {
202
252
  const target = e.target;
203
253
  const rawValue = target.value;
204
- const maskedValue = this.blurFormatStrategy.format(rawValue);
205
- this.updateInputValue(rawValue, maskedValue);
206
- if (this.host &&
207
- this.blurFormatStrategy.shouldOverrideComponentValueAfterBlur &&
208
- this.blurFormatStrategy.shouldOverrideComponentValueAfterBlur()) {
209
- this.host['value'] = maskedValue;
210
- }
254
+ this.formatValue(rawValue, 'blur');
211
255
  }
212
256
  };
213
257
  /**
214
- * A function update the value of the input element by inputFormatStrategy output.
258
+ * A function updates the value of the input element by inputFormatStrategy output.
215
259
  *
216
260
  * @param {InputEvent} e - input event
217
261
  */
@@ -220,11 +264,9 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
220
264
  const rawValue = target.value;
221
265
  const caretPosition = target.selectionStart; // selectionStart is nullable, link https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-selectionstart
222
266
  if (this.inputFormatStrategy) {
223
- const maskedValue = this.inputFormatStrategy.format(rawValue.replace(/\s/g, ''),
224
- // Paste input is difference with type input, it can set much characters at one time,
225
- // so we should make caretPosition as undefined to format all value.
226
- e.inputType === 'insertFromPaste' ? null : caretPosition);
227
- this.updateInputValue(rawValue, maskedValue);
267
+ this.formatValue(rawValue.replace(/\s/g, ''), 'input', {
268
+ caretPosition: e.inputType === 'insertFromPaste' ? undefined : caretPosition,
269
+ });
228
270
  this.updateInputCaretPosition(rawValue, caretPosition);
229
271
  }
230
272
  };
@@ -286,22 +328,13 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
286
328
  */
287
329
  formatValueAfterSetup() {
288
330
  void index.waitForComponentDidRender(this.host).then(() => {
289
- var _a, _b, _c, _d;
290
- const rawValue = this.inputElement.value;
291
- if ((_b = (_a = this.inputFormatStrategy) === null || _a === void 0 ? void 0 : _a.shouldTriggerAtInit) === null || _b === void 0 ? void 0 : _b.call(_a)) {
292
- this.host['value'] = this.inputFormatStrategy.format(rawValue);
293
- }
294
- if (((_d = (_c = this.blurFormatStrategy) === null || _c === void 0 ? void 0 : _c.shouldTriggerAtInit) === null || _d === void 0 ? void 0 : _d.call(_c)) && !this.isOnFocus()) {
295
- const maskedValue = this.blurFormatStrategy.format(rawValue);
296
- this.updateInputValue(rawValue, maskedValue);
297
- }
331
+ this.formatValue(this.inputElement.value, 'init');
298
332
  });
299
333
  }
300
334
  /*
301
335
  * The below method is e2e-test covered in
302
336
  * @see{module:vega-input-credit-card-dynamic-mask-e2e}
303
337
  */
304
- /* istanbul ignore next */
305
338
  /**
306
339
  * The function `isOnFocus` checks if the input element is currently focused.
307
340
  *
@@ -319,7 +352,7 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
319
352
  * @param {string} rawValue - the original value
320
353
  * @param {string} maskedValue - masked value
321
354
  */
322
- updateInputValue(rawValue, maskedValue) {
355
+ updateNativeInputValue(rawValue, maskedValue) {
323
356
  // link: https://stackoverflow.com/questions/52003841/why-doesnt-event-target-value-include-and-e-for-number-inputs
324
357
  // If the input value is '123.', '123' will be got from `target.value` when the input element type is number
325
358
  // '123.' will be formatted to '123', then `this.inputElement.value = 123`, '.' will never be filled in
@@ -327,6 +360,17 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
327
360
  this.inputElement.value = maskedValue;
328
361
  }
329
362
  }
363
+ /**
364
+ * Update the host value
365
+ *
366
+ * @param {string} rawValue - the original value
367
+ * @param {string} maskedValue - the masked value
368
+ */
369
+ updateComponentValue(rawValue, maskedValue) {
370
+ if (maskedValue !== rawValue) {
371
+ this.host['value'] = maskedValue;
372
+ }
373
+ }
330
374
  /**
331
375
  * Updated the input caret position after the mask format
332
376
  *
@@ -340,6 +384,40 @@ class StringInputFormatterSlimmer extends globalSlimmerRegistry.VegaSlimmer {
340
384
  this.inputElement.setSelectionRange(newCaretPosition, newCaretPosition);
341
385
  }
342
386
  }
387
+ /**
388
+ * Format the value based on the input and blur format strategies.
389
+ *
390
+ * @param {string} rawValue - The original input value
391
+ * @param {FormatTrigger} triggeredBy - The trigger of the format
392
+ * @param {{ caretPosition?: number }} options - The options for the format
393
+ * @param {number} options.caretPosition - The current input caret position
394
+ */
395
+ formatValue(rawValue, triggeredBy, options) {
396
+ const isBlurred = !this.isOnFocus();
397
+ const caretPosition = options === null || options === void 0 ? void 0 : options.caretPosition;
398
+ if (this.inputFormatStrategy) {
399
+ if (this.inputFormatStrategy.canFormat(triggeredBy, 'component')) {
400
+ const formattedComponentValue = this.inputFormatStrategy.format(rawValue);
401
+ this.updateComponentValue(rawValue, formattedComponentValue);
402
+ }
403
+ if (this.inputFormatStrategy.canFormat(triggeredBy, 'native-input')) {
404
+ const formattedNativeInputValue = this.inputFormatStrategy.format(rawValue, {
405
+ caretPosition: caretPosition,
406
+ });
407
+ this.updateNativeInputValue(rawValue, formattedNativeInputValue);
408
+ }
409
+ }
410
+ if (this.blurFormatStrategy && isBlurred) {
411
+ if (this.blurFormatStrategy.canFormat(triggeredBy, 'component', { isBlurred })) {
412
+ const formattedComponentValue = this.blurFormatStrategy.format(rawValue);
413
+ this.updateComponentValue(rawValue, formattedComponentValue);
414
+ }
415
+ if (this.blurFormatStrategy.canFormat(triggeredBy, 'native-input', { isBlurred })) {
416
+ const formattedNativeInputValue = this.blurFormatStrategy.format(rawValue);
417
+ this.updateNativeInputValue(rawValue, formattedNativeInputValue);
418
+ }
419
+ }
420
+ }
343
421
  }
344
422
  __decorate([
345
423
  globalSlimmerRegistry.MapToComponentField()
@@ -348,5 +426,6 @@ __decorate([
348
426
  globalSlimmerRegistry.MapToComponentMethod('componentDidRender')
349
427
  ], StringInputFormatterSlimmer.prototype, "componentDidRender", null);
350
428
 
429
+ exports.StringFormatStrategy = StringFormatStrategy;
351
430
  exports.StringInputFormatterSlimmer = StringInputFormatterSlimmer;
352
431
  exports.StringMaskStrategy = StringMaskStrategy;
@@ -18,10 +18,10 @@ const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
18
18
  const internalVegaZIndexManager = require('./internal-vega-z-index-manager-f03ddb37.js');
19
19
  const staticSubjectTitle = require('./static-subject-title-c589a1bd.js');
20
20
  const changeManager = require('./change-manager-a297e4d2.js');
21
- const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-072b75a0.js');
21
+ const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-f45931fd.js');
22
22
  const elementAppenderSlimmer = require('./element-appender-slimmer-c6e0f4ca.js');
23
23
  require('./vega-env-manager-23b8b23c.js');
24
- require('./vega-skeleton-loader-controller-ef43cfc1.js');
24
+ require('./vega-skeleton-loader-controller-00dbdf29.js');
25
25
  const featureFlagController = require('./feature-flag-controller-7b22e598.js');
26
26
  require('./node-annotation.abstract-4f6df9cf.js');
27
27
  require('./vega-dialog-controller-fe610705.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.37.1` will be replaced to a version string when running publish script.
14
+ // The `2.38.0` 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.37.1';
16
+ this.vegaVersion = '2.38.0';
17
17
  this.framework = exports.FrameworkEnum.VanillaJs;
18
18
  }
19
19
  /**
@@ -17,7 +17,7 @@ const eventEmitSlimmer = require('./event-emit-slimmer-208a19e4.js');
17
17
  const domNodeSubjectFactory = require('./dom-node-subject-factory-ce1777a9.js');
18
18
  const staticSubjectTitle = require('./static-subject-title-c589a1bd.js');
19
19
  const changeManager = require('./change-manager-a297e4d2.js');
20
- const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-072b75a0.js');
20
+ const stringInputFormatterSlimmer = require('./string-input-formatter-slimmer-f45931fd.js');
21
21
  const typeGuard = require('./type-guard-4ba85fdc.js');
22
22
  const domNodeSubjectObserverFactory = require('./dom-node-subject-observer-factory-80b3ac6c.js');
23
23
  const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-bb1eaebe.js');
@@ -188,7 +188,7 @@ __decorate$4([
188
188
  *
189
189
  * @augments StringFormatStrategy
190
190
  */
191
- class ThousandCommaStrategy {
191
+ class ThousandCommaStrategy extends stringInputFormatterSlimmer.StringFormatStrategy {
192
192
  /**
193
193
  * If the input is a number, format it as a string
194
194
  *
@@ -224,13 +224,14 @@ class ThousandCommaStrategy {
224
224
  /**
225
225
  * A class for formatting number with the given mask format
226
226
  */
227
- class NumberMaskStrategy {
227
+ class NumberMaskStrategy extends stringInputFormatterSlimmer.StringFormatStrategy {
228
228
  /**
229
229
  * It creates a new instance of the Mask class.
230
230
  *
231
231
  * @param {NumberMaskConfig} maskConfig - MaskConfig
232
232
  */
233
233
  constructor(maskConfig) {
234
+ super();
234
235
  this.maskConfig = { allowNegative: true };
235
236
  /**
236
237
  * if allow negative, will skip '-', e.g. when input '-' -> '-1.2'
@@ -333,7 +334,7 @@ class NumberMaskStrategy {
333
334
  /**
334
335
  * Used to format a string using a custom formatter.
335
336
  */
336
- class CustomFormatterStrategy {
337
+ class CustomFormatterStrategy extends stringInputFormatterSlimmer.StringFormatStrategy {
337
338
  /**
338
339
  * The constructor function takes a CustomStringFormatter parameter and assigns it to the formatter
339
340
  * property of the class.
@@ -345,6 +346,7 @@ class CustomFormatterStrategy {
345
346
  * @param {boolean} resetCaretPosition - The caret position should update to the last or keep the current position after format
346
347
  */
347
348
  constructor(formatter, resetCaretPosition = false) {
349
+ super();
348
350
  this.resetCaretPositionFlag = false;
349
351
  this.formatter = formatter;
350
352
  this.resetCaretPositionFlag = resetCaretPosition;
@@ -5,19 +5,68 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-09acd3c9.js');
6
6
  const globalSlimmerRegistry = require('./global-slimmer-registry-b3bce7e0.js');
7
7
  const componentUsageRuntimeMetrics = require('./component-usage-runtime-metrics-dcb32c24.js');
8
+ const internalVegaZIndexManager = require('./internal-vega-z-index-manager-f03ddb37.js');
8
9
  const component = require('./component-73a88c4e.js');
9
10
  const ui = require('./ui-5fd9b267.js');
10
11
  const responsiveFormatFacade = require('./responsive-format-facade-a1983026.js');
11
12
  const breakpoints = require('./breakpoints-17d6c4c7.js');
12
13
  const pageResizeObserverSlimmer = require('./page-resize-observer-slimmer-bb1eaebe.js');
14
+ require('./number-4816603d.js');
13
15
  require('./type-guard-4ba85fdc.js');
14
16
  require('./breakpoints-ebde4837.js');
15
17
  require('./ui-32e69595.js');
16
18
  require('./regex-c1f70fd4.js');
17
19
  require('./typography-4560e7f1.js');
18
- require('./number-4816603d.js');
19
20
  require('./pixel-98f2a10c.js');
20
21
 
22
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
23
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
24
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
25
+ 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;
26
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
27
+ };
28
+ /** The ManageVegaLoaderWrapperZIndex class manages z-index of the vega-loader-wrapper. */
29
+ class ManageVegaLoaderWrapperZIndexController extends globalSlimmerRegistry.VegaSlimmer {
30
+ /**
31
+ * When vega loader wrapper is connected
32
+ */
33
+ connectedCallback() {
34
+ this.setIndex();
35
+ }
36
+ /**
37
+ * When vega loader wrapper is disconnected
38
+ */
39
+ disconnectedCallback() {
40
+ this.removeIndex();
41
+ }
42
+ /**
43
+ * Sets the z-index level for the vega-loader-wrapper based on the target container.
44
+ */
45
+ setIndex() {
46
+ const containerElement = document.querySelector(this.host.dataset.container);
47
+ if (containerElement) {
48
+ if (containerElement.tagName === 'BODY') {
49
+ internalVegaZIndexManager.InternalVegaZIndexManager.setZIndex(this.host, 'base');
50
+ }
51
+ }
52
+ }
53
+ /**
54
+ * Removes the z-index of the vega-loader-wrapper by resetting it.
55
+ */
56
+ removeIndex() {
57
+ internalVegaZIndexManager.InternalVegaZIndexManager.removeZIndex(this.host, 'base');
58
+ }
59
+ }
60
+ __decorate$2([
61
+ globalSlimmerRegistry.MapToComponentField()
62
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "host", void 0);
63
+ __decorate$2([
64
+ globalSlimmerRegistry.MapToComponentMethod('connectedCallback')
65
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "connectedCallback", null);
66
+ __decorate$2([
67
+ globalSlimmerRegistry.MapToComponentMethod('disconnectedCallback')
68
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "disconnectedCallback", null);
69
+
21
70
  const vegaLoaderWrapperCss = ":host{display:block;display:inline-flex;align-items:center;justify-content:center;top:0px;right:0px;bottom:0px;left:0px;background-color:rgba(var(--v-bg-backdrop-loading, 255, 255, 255, 0.5))}:host(.absolute-wrapper){position:absolute}:host(.fixed-wrapper){width:100%;height:100%;position:fixed}";
22
71
 
23
72
  var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
@@ -34,6 +83,7 @@ const VegaLoaderWrapper = class {
34
83
  constructor(hostRef) {
35
84
  index.registerInstance(this, hostRef);
36
85
  this.globalSlimmers = {};
86
+ this.manageVegaLoaderWrapperZIndexController = new ManageVegaLoaderWrapperZIndexController();
37
87
  this.vegaComponentUsageRuntimeMetricsSlimmer = new componentUsageRuntimeMetrics.VegaComponentUsageRuntimeMetricsSlimmer();
38
88
  }
39
89
  render() {
@@ -44,6 +94,9 @@ const VegaLoaderWrapper = class {
44
94
  __decorate$1([
45
95
  componentUsageRuntimeMetrics.InjectVegaGlobalSlimmer()
46
96
  ], VegaLoaderWrapper.prototype, "globalSlimmers", void 0);
97
+ __decorate$1([
98
+ globalSlimmerRegistry.InjectVegaSlimmer()
99
+ ], VegaLoaderWrapper.prototype, "manageVegaLoaderWrapperZIndexController", void 0);
47
100
  __decorate$1([
48
101
  globalSlimmerRegistry.InjectVegaSlimmer()
49
102
  ], VegaLoaderWrapper.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
@@ -26,7 +26,7 @@ const observer = require('./observer-f49483e8.js');
26
26
  const ui = require('./ui-5fd9b267.js');
27
27
  const staticSubjectTitle = require('./static-subject-title-c589a1bd.js');
28
28
  require('./vega-env-manager-23b8b23c.js');
29
- require('./vega-skeleton-loader-controller-ef43cfc1.js');
29
+ require('./vega-skeleton-loader-controller-00dbdf29.js');
30
30
  require('./feature-flag-controller-7b22e598.js');
31
31
  require('./vega-dialog-controller-fe610705.js');
32
32
  require('./icon-manager-edc2400b.js');
@@ -72,8 +72,13 @@ class VegaLoaderController {
72
72
  * @vegaVersion 1.16.0
73
73
  */
74
74
  load(options = {}) {
75
- const containerSelector = options.containerSelector || 'body';
76
- const containerElement = document.querySelector(containerSelector);
75
+ let containerSelector = options.containerSelector || 'body';
76
+ let containerElement = document.querySelector(containerSelector);
77
+ if (containerElement &&
78
+ VegaLoaderController.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY.includes(containerElement.tagName)) {
79
+ containerSelector = 'body';
80
+ containerElement = document.querySelector('body');
81
+ }
77
82
  if (!containerElement) {
78
83
  globalSlimmerRegistry.LogUtility.error('Container is not found by selector: ', containerSelector);
79
84
  return null;
@@ -95,7 +100,9 @@ class VegaLoaderController {
95
100
  if (loader.dataset.container) {
96
101
  const container = document.querySelector(loader.dataset.container);
97
102
  if (container) {
98
- container.style.position = container.dataset['vegaLoaderOriginPosition'] || 'static';
103
+ if (container.dataset['vegaLoaderOriginPosition']) {
104
+ container.style.position = container.dataset['vegaLoaderOriginPosition'];
105
+ }
99
106
  }
100
107
  }
101
108
  loader.remove();
@@ -165,6 +172,7 @@ class VegaLoaderController {
165
172
  }
166
173
  }
167
174
  }
175
+ VegaLoaderController.SPECIAL_ELEMENT_TO_WRAP_FULL_BODY = ['VEGA-MODAL'];
168
176
  __decorate$4([
169
177
  createPublicApiRuntimeMetricsSlimmer.InjectVegaTelemetrySlimmer()
170
178
  ], VegaLoaderController.prototype, "vegaPublicAPIRuntimeMetricsSlimmer", void 0);
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const index = require('./index-09acd3c9.js');
4
- const appGlobals = require('./app-globals-e10d1859.js');
4
+ const appGlobals = require('./app-globals-7087f121.js');
5
5
  require('./feature-flag-controller-7b22e598.js');
6
6
  require('./global-slimmer-registry-b3bce7e0.js');
7
7
  require('./index-8b247c17.js');
8
8
  require('./_commonjsHelpers-537d719a.js');
9
- require('./vega-skeleton-loader-controller-ef43cfc1.js');
9
+ require('./vega-skeleton-loader-controller-00dbdf29.js');
10
10
  require('./create-public-api-runtime-metrics-slimmer-54c3f73b.js');
11
11
  require('./dynamic-slimmer-f31fdfd7.js');
12
12
  require('./ui-5fd9b267.js');
@@ -0,0 +1,49 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import internalVegaZIndexManager from '../../../../helpers/zindex/internal-vega-z-index-manager';
8
+ import { MapToComponentField, MapToComponentMethod, VegaSlimmer } from 'vega-slimmer/core';
9
+ /** The ManageVegaLoaderWrapperZIndex class manages z-index of the vega-loader-wrapper. */
10
+ export class ManageVegaLoaderWrapperZIndexController extends VegaSlimmer {
11
+ /**
12
+ * When vega loader wrapper is connected
13
+ */
14
+ connectedCallback() {
15
+ this.setIndex();
16
+ }
17
+ /**
18
+ * When vega loader wrapper is disconnected
19
+ */
20
+ disconnectedCallback() {
21
+ this.removeIndex();
22
+ }
23
+ /**
24
+ * Sets the z-index level for the vega-loader-wrapper based on the target container.
25
+ */
26
+ setIndex() {
27
+ const containerElement = document.querySelector(this.host.dataset.container);
28
+ if (containerElement) {
29
+ if (containerElement.tagName === 'BODY') {
30
+ internalVegaZIndexManager.setZIndex(this.host, 'base');
31
+ }
32
+ }
33
+ }
34
+ /**
35
+ * Removes the z-index of the vega-loader-wrapper by resetting it.
36
+ */
37
+ removeIndex() {
38
+ internalVegaZIndexManager.removeZIndex(this.host, 'base');
39
+ }
40
+ }
41
+ __decorate([
42
+ MapToComponentField()
43
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "host", void 0);
44
+ __decorate([
45
+ MapToComponentMethod('connectedCallback')
46
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "connectedCallback", null);
47
+ __decorate([
48
+ MapToComponentMethod('disconnectedCallback')
49
+ ], ManageVegaLoaderWrapperZIndexController.prototype, "disconnectedCallback", null);
@@ -7,12 +7,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { Component, Host, h, Element } from '@stencil/core';
8
8
  import { InjectVegaGlobalSlimmer, InjectVegaSlimmer } from 'vega-slimmer/core';
9
9
  import { VegaComponentUsageRuntimeMetricsSlimmer } from '../../helpers/slimmers/component-usage-runtime-metrics';
10
+ import { ManageVegaLoaderWrapperZIndexController } from './slimmers/controllers/manage-vega-loader-wrapper-z-index-controller';
10
11
  /**
11
12
  * @vegaVersion 2.0.0
12
13
  */
13
14
  export class VegaLoaderWrapper {
14
15
  constructor() {
15
16
  this.globalSlimmers = {};
17
+ this.manageVegaLoaderWrapperZIndexController = new ManageVegaLoaderWrapperZIndexController();
16
18
  this.vegaComponentUsageRuntimeMetricsSlimmer = new VegaComponentUsageRuntimeMetricsSlimmer();
17
19
  }
18
20
  render() {
@@ -32,6 +34,9 @@ export class VegaLoaderWrapper {
32
34
  __decorate([
33
35
  InjectVegaGlobalSlimmer()
34
36
  ], VegaLoaderWrapper.prototype, "globalSlimmers", void 0);
37
+ __decorate([
38
+ InjectVegaSlimmer()
39
+ ], VegaLoaderWrapper.prototype, "manageVegaLoaderWrapperZIndexController", void 0);
35
40
  __decorate([
36
41
  InjectVegaSlimmer()
37
42
  ], VegaLoaderWrapper.prototype, "vegaComponentUsageRuntimeMetricsSlimmer", void 0);
@@ -1,8 +1,9 @@
1
+ import { StringFormatStrategy } from './string-format-strategy.abstract';
1
2
  import { isNonNullable } from '../../../types/type-guard';
2
3
  /**
3
4
  * Used to format a string using a custom formatter.
4
5
  */
5
- export class CustomFormatterStrategy {
6
+ export class CustomFormatterStrategy extends StringFormatStrategy {
6
7
  /**
7
8
  * The constructor function takes a CustomStringFormatter parameter and assigns it to the formatter
8
9
  * property of the class.
@@ -14,6 +15,7 @@ export class CustomFormatterStrategy {
14
15
  * @param {boolean} resetCaretPosition - The caret position should update to the last or keep the current position after format
15
16
  */
16
17
  constructor(formatter, resetCaretPosition = false) {
18
+ super();
17
19
  this.resetCaretPositionFlag = false;
18
20
  this.formatter = formatter;
19
21
  this.resetCaretPositionFlag = resetCaretPosition;
@@ -1,14 +1,16 @@
1
1
  import { isNonNullable } from '../../../types/type-guard';
2
+ import { StringFormatStrategy } from './string-format-strategy.abstract';
2
3
  /**
3
4
  * A class for formatting number with the given mask format
4
5
  */
5
- export class NumberMaskStrategy {
6
+ export class NumberMaskStrategy extends StringFormatStrategy {
6
7
  /**
7
8
  * It creates a new instance of the Mask class.
8
9
  *
9
10
  * @param {NumberMaskConfig} maskConfig - MaskConfig
10
11
  */
11
12
  constructor(maskConfig) {
13
+ super();
12
14
  this.maskConfig = { allowNegative: true };
13
15
  /**
14
16
  * if allow negative, will skip '-', e.g. when input '-' -> '-1.2'
@@ -0,0 +1,52 @@
1
+ import { isNonNullable } from '../../../types/type-guard';
2
+ /**
3
+ * String format strategy abstract class
4
+ */
5
+ export class StringFormatStrategy {
6
+ /**
7
+ * Check if the {@link format} should be applied
8
+ *
9
+ * @param {FormatTrigger} triggeredBy - The trigger of the format
10
+ * @param {FormatTarget} target - The target of the format
11
+ * @param {InputStatus} inputStatus - The status of the input
12
+ * @returns {boolean} - Whether the format should be applied
13
+ */
14
+ canFormat(triggeredBy, target, inputStatus) {
15
+ if (triggeredBy === 'init') {
16
+ if (target === 'component' && isNonNullable(inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
17
+ return false;
18
+ }
19
+ if (this.shouldTriggerAtInit()) {
20
+ return true;
21
+ }
22
+ }
23
+ if (triggeredBy === 'input' && target === 'native-input') {
24
+ return true;
25
+ }
26
+ if (triggeredBy === 'blur' && (inputStatus === null || inputStatus === void 0 ? void 0 : inputStatus.isBlurred)) {
27
+ if (target === 'component' && this.shouldOverrideComponentValueAfterBlur()) {
28
+ return true;
29
+ }
30
+ if (target === 'native-input') {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+ /**
37
+ * Determines whether a component value should be overridden based on the mask configuration.
38
+ *
39
+ * @returns {boolean} - Whether the component value should be overridden.
40
+ */
41
+ shouldOverrideComponentValueAfterBlur() {
42
+ return false;
43
+ }
44
+ /**
45
+ * Determines whether the format should be triggered at init.
46
+ *
47
+ * @returns {boolean} - Whether the format should be triggered at init.
48
+ */
49
+ shouldTriggerAtInit() {
50
+ return false; // TODO: trigger at init feature is not implemented to all strategies. To keep the same behavior as before so set false here as default.
51
+ }
52
+ }