@sme.up/ketchup 7.5.0-SNAPSHOT → 8.0.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.
Files changed (166) hide show
  1. package/dist/cjs/{component-72a5b626.js → component-85c2bd4d.js} +1 -1
  2. package/dist/cjs/{f-button-a508a0a1.js → f-button-c0ede055.js} +1 -1
  3. package/dist/cjs/{f-cell-52d724f5.js → f-cell-1c17dbac.js} +15 -8
  4. package/dist/cjs/{f-chip-cbb70aed.js → f-chip-bace36bb.js} +2 -2
  5. package/dist/cjs/{f-image-510563ed.js → f-image-22174590.js} +1 -1
  6. package/dist/cjs/{f-paginator-utils-ff531caa.js → f-paginator-utils-e21e1f06.js} +2 -2
  7. package/dist/cjs/{f-text-field-d17e5aa0.js → f-text-field-503f2bb0.js} +82 -8
  8. package/dist/cjs/{f-text-field-mdc-85997738.js → f-text-field-mdc-0e22f3e3.js} +2 -2
  9. package/dist/cjs/ketchup.cjs.js +1 -1
  10. package/dist/cjs/kup-accordion.cjs.entry.js +4 -4
  11. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +851 -824
  12. package/dist/cjs/kup-box.cjs.entry.js +10 -10
  13. package/dist/cjs/kup-calendar.cjs.entry.js +5 -5
  14. package/dist/cjs/kup-cell.cjs.entry.js +5 -5
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +2 -3
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +1 -1
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +7 -7
  18. package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
  19. package/dist/cjs/kup-echart.cjs.entry.js +25 -8
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +7 -18
  21. package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
  22. package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
  23. package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
  24. package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
  25. package/dist/cjs/{kup-manager-9e1680dd.js → kup-manager-b994cf71.js} +164 -16
  26. package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
  27. package/dist/cjs/kup-numeric-picker.cjs.entry.js +5 -5
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
  29. package/dist/cjs/kup-planner.cjs.entry.js +1041 -192
  30. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  31. package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +12 -4
  33. package/dist/cjs/loader.cjs.js +1 -1
  34. package/dist/cjs/{tslib.es6-0ee02c67.js → tslib.es6-386654de.js} +9 -5
  35. package/dist/collection/assets/data-table.js +44 -0
  36. package/dist/collection/components/kup-chip/kup-chip.js +4 -3
  37. package/dist/collection/components/kup-dash-list/kup-dash-list.js +1 -3
  38. package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
  39. package/dist/collection/components/kup-data-table/kup-data-table.js +5 -16
  40. package/dist/collection/components/kup-echart/kup-echart-declarations.js +2 -0
  41. package/dist/collection/components/kup-echart/kup-echart.js +23 -8
  42. package/dist/collection/components/kup-family-tree/kup-family-tree.js +4 -15
  43. package/dist/collection/components/kup-planner/kup-planner-declarations.js +1 -0
  44. package/dist/collection/components/kup-planner/kup-planner.css +1 -3
  45. package/dist/collection/components/kup-planner/kup-planner.js +302 -72
  46. package/dist/collection/components/kup-snackbar/kup-snackbar.css +4 -3
  47. package/dist/collection/components/kup-snackbar/kup-snackbar.js +27 -0
  48. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  49. package/dist/collection/components/kup-text-field/kup-text-field.js +109 -10
  50. package/dist/collection/components/kup-tree/kup-tree.js +66 -67
  51. package/dist/collection/f-components/f-cell/f-cell.js +12 -5
  52. package/dist/collection/f-components/f-text-field/f-text-field.js +80 -6
  53. package/dist/collection/managers/kup-manager/kup-manager.js +18 -0
  54. package/dist/collection/managers/kup-math/kup-math.js +85 -4
  55. package/dist/collection/utils/utils.js +1 -10
  56. package/dist/components/kup-autocomplete2.js +648 -386
  57. package/dist/components/kup-dash-list.js +2 -3
  58. package/dist/components/kup-dashboard.js +1 -1
  59. package/dist/components/kup-data-table.js +1 -1
  60. package/dist/components/kup-date-picker.js +1 -1
  61. package/dist/components/kup-dialog.js +1 -1
  62. package/dist/components/kup-dropdown-button.js +1 -1
  63. package/dist/components/kup-echart2.js +25 -8
  64. package/dist/components/kup-family-tree.js +5 -16
  65. package/dist/components/kup-form.js +1 -1
  66. package/dist/components/kup-gauge.js +1 -1
  67. package/dist/components/kup-image-list.js +1 -1
  68. package/dist/components/kup-image.js +1 -1
  69. package/dist/components/kup-list.js +1 -1
  70. package/dist/components/kup-magic-box.js +1 -1
  71. package/dist/components/kup-numeric-picker.js +1 -1
  72. package/dist/components/kup-planner.js +1041 -189
  73. package/dist/components/kup-snackbar.js +9 -1
  74. package/dist/esm/{component-b1bedf1d.js → component-120651a0.js} +1 -1
  75. package/dist/esm/{f-button-b7f77b26.js → f-button-c377973d.js} +1 -1
  76. package/dist/esm/{f-cell-dc3beffe.js → f-cell-e5a98bc8.js} +15 -8
  77. package/dist/esm/{f-chip-0a678211.js → f-chip-c8a18c48.js} +2 -2
  78. package/dist/esm/{f-image-f84dbd7c.js → f-image-5cbdf39d.js} +1 -1
  79. package/dist/esm/{f-paginator-utils-52902bd6.js → f-paginator-utils-a1dab059.js} +2 -2
  80. package/dist/esm/{f-text-field-7dd143be.js → f-text-field-dafb7c8b.js} +82 -8
  81. package/dist/esm/{f-text-field-mdc-d42d3f9e.js → f-text-field-mdc-cee583ea.js} +2 -2
  82. package/dist/esm/ketchup.js +1 -1
  83. package/dist/esm/kup-accordion.entry.js +4 -4
  84. package/dist/esm/kup-autocomplete_27.entry.js +851 -824
  85. package/dist/esm/kup-box.entry.js +10 -10
  86. package/dist/esm/kup-calendar.entry.js +5 -5
  87. package/dist/esm/kup-cell.entry.js +5 -5
  88. package/dist/esm/kup-dash-list.entry.js +2 -3
  89. package/dist/esm/kup-dash_2.entry.js +1 -1
  90. package/dist/esm/kup-dashboard.entry.js +7 -7
  91. package/dist/esm/kup-drawer.entry.js +1 -1
  92. package/dist/esm/kup-echart.entry.js +25 -8
  93. package/dist/esm/kup-family-tree.entry.js +7 -18
  94. package/dist/esm/kup-iframe.entry.js +1 -1
  95. package/dist/esm/kup-image-list.entry.js +8 -8
  96. package/dist/esm/kup-lazy.entry.js +1 -1
  97. package/dist/esm/kup-magic-box.entry.js +2 -2
  98. package/dist/esm/{kup-manager-a5ab58a0.js → kup-manager-3594cde8.js} +163 -16
  99. package/dist/esm/kup-nav-bar.entry.js +1 -1
  100. package/dist/esm/kup-numeric-picker.entry.js +5 -5
  101. package/dist/esm/kup-photo-frame.entry.js +1 -1
  102. package/dist/esm/kup-planner.entry.js +1042 -193
  103. package/dist/esm/kup-probe.entry.js +1 -1
  104. package/dist/esm/kup-qlik.entry.js +1 -1
  105. package/dist/esm/kup-snackbar.entry.js +12 -4
  106. package/dist/esm/loader.js +1 -1
  107. package/dist/esm/{tslib.es6-3eea2234.js → tslib.es6-8c2af864.js} +9 -5
  108. package/dist/ketchup/ketchup.esm.js +1 -1
  109. package/dist/ketchup/{p-98ff4101.entry.js → p-017418e7.entry.js} +1 -1
  110. package/dist/ketchup/{p-81605f08.js → p-10d84b1b.js} +1 -1
  111. package/dist/ketchup/{p-871cfe60.entry.js → p-22e72f06.entry.js} +1 -1
  112. package/dist/ketchup/{p-a203f78b.js → p-27a56c87.js} +1 -1
  113. package/dist/ketchup/{p-7065b172.js → p-2d32e3cd.js} +1 -1
  114. package/dist/ketchup/{p-a122b8d3.entry.js → p-31abf4b6.entry.js} +1 -1
  115. package/dist/ketchup/{p-beb0907a.entry.js → p-37ada0f0.entry.js} +1 -1
  116. package/dist/ketchup/p-38f16697.entry.js +9 -0
  117. package/dist/ketchup/{p-69f3b9da.js → p-4638fbff.js} +1 -1
  118. package/dist/ketchup/{p-00fc0f80.entry.js → p-473d2bea.entry.js} +1 -1
  119. package/dist/ketchup/{p-166257d0.entry.js → p-4c56e199.entry.js} +1 -1
  120. package/dist/ketchup/p-5205286a.entry.js +25 -0
  121. package/dist/ketchup/p-61319cfa.js +1 -0
  122. package/dist/ketchup/{p-de34eb56.js → p-6762d447.js} +1 -1
  123. package/dist/ketchup/{p-7040cab7.entry.js → p-6c726886.entry.js} +1 -1
  124. package/dist/ketchup/p-7be5ef32.entry.js +1 -0
  125. package/dist/ketchup/{p-e92d1972.entry.js → p-7f4f5f0f.entry.js} +1 -1
  126. package/dist/ketchup/p-7f59211b.js +1 -0
  127. package/dist/ketchup/{p-78d1fc60.entry.js → p-80815edf.entry.js} +1 -1
  128. package/dist/ketchup/p-8b248655.js +1 -0
  129. package/dist/ketchup/{p-a32cc181.entry.js → p-9fc6a9a8.entry.js} +1 -1
  130. package/dist/ketchup/{p-4fd6c34c.js → p-acaa171f.js} +3 -3
  131. package/dist/ketchup/{p-6022c951.entry.js → p-afff7a6e.entry.js} +1 -1
  132. package/dist/ketchup/{p-d315f7fa.entry.js → p-b718af72.entry.js} +1 -1
  133. package/dist/ketchup/p-bf4a881b.js +1 -0
  134. package/dist/ketchup/{p-c797ab39.entry.js → p-ce5b6ce7.entry.js} +1 -1
  135. package/dist/ketchup/p-cf322853.entry.js +1 -0
  136. package/dist/ketchup/{p-d2670436.entry.js → p-d1164680.entry.js} +1 -1
  137. package/dist/ketchup/{p-efb80719.entry.js → p-d4eb9a76.entry.js} +1 -1
  138. package/dist/ketchup/p-d76be079.entry.js +1 -0
  139. package/dist/ketchup/{p-d711e9ae.entry.js → p-ed7e118e.entry.js} +1 -1
  140. package/dist/ketchup/{p-f158836b.entry.js → p-ef0b4f19.entry.js} +2 -2
  141. package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
  142. package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +2 -0
  143. package/dist/types/components/kup-planner/kup-planner-declarations.d.ts +15 -2
  144. package/dist/types/components/kup-planner/kup-planner.d.ts +36 -11
  145. package/dist/types/components/kup-snackbar/kup-snackbar.d.ts +5 -0
  146. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  147. package/dist/types/components/kup-text-field/kup-text-field.d.ts +20 -2
  148. package/dist/types/components/kup-tree/kup-tree.d.ts +1 -5
  149. package/dist/types/components.d.ts +72 -4
  150. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +3 -0
  151. package/dist/types/managers/kup-language/kup-language-declarations.d.ts +1 -1
  152. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +1 -0
  153. package/dist/types/managers/kup-manager/kup-manager.d.ts +7 -0
  154. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +6 -0
  155. package/dist/types/managers/kup-math/kup-math.d.ts +26 -2
  156. package/dist/types/utils/utils.d.ts +0 -1
  157. package/package.json +6 -18
  158. package/dist/ketchup/p-28efed63.js +0 -1
  159. package/dist/ketchup/p-3ae1409f.entry.js +0 -1
  160. package/dist/ketchup/p-71cb80ac.entry.js +0 -9
  161. package/dist/ketchup/p-79b0730b.js +0 -15
  162. package/dist/ketchup/p-8d0e6825.entry.js +0 -1
  163. package/dist/ketchup/p-9ae47a0d.entry.js +0 -1
  164. package/dist/ketchup/p-c5c6a2fb.js +0 -1
  165. package/dist/ketchup/p-d1e3573f.js +0 -1
  166. package/dist/ketchup/p-f69a6d89.entry.js +0 -10
@@ -1,5 +1,6 @@
1
1
  import { getAssetPath, h } from '@stencil/core';
2
2
  import { KupThemeIconValues } from '../../managers/kup-theme/kup-theme-declarations';
3
+ const dom = document.documentElement;
3
4
  /*-------------------------------------------------*/
4
5
  /* C o m p o n e n t */
5
6
  /*-------------------------------------------------*/
@@ -14,6 +15,7 @@ export const FTextField = (props, children) => {
14
15
  /* M e t h o d s */
15
16
  /*-------------------------------------------------*/
16
17
  function setContent(props) {
18
+ var _a, _b;
17
19
  const isOutlined = props.textArea || props.outlined;
18
20
  let labelEl;
19
21
  let iconEl;
@@ -47,17 +49,79 @@ function setContent(props) {
47
49
  'mdc-text-field--with-leading-icon': props.icon && !props.trailingIcon,
48
50
  'mdc-text-field--with-trailing-icon': props.icon && props.trailingIcon,
49
51
  };
50
- return (h("div", { class: classObj }, props.textArea && props.maxLength ? (h("div", { class: "mdc-text-field-character-counter" }, "'0 / ' + ", props.maxLength)) : undefined, !props.trailingIcon ? iconEl : undefined, props.textArea ? (h("span", { class: "mdc-text-field__resizer" }, h("textarea", { class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown }))) : (h("input", { inputmode: props.inputMode ? props.inputMode : undefined, type: props.inputType ? props.inputType : 'text', step: props.step, min: props.min, max: props.max, name: props.name, class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, placeholder: props.fullWidth && !props.outlined
52
+ let value = props.value;
53
+ let inputType = (_a = props.inputType) !== null && _a !== void 0 ? _a : 'text';
54
+ let persManageForNumberFormat = false;
55
+ if (props.inputType === 'number' && props.decimals && props.decimals > 0) {
56
+ inputType = 'text';
57
+ persManageForNumberFormat = true;
58
+ }
59
+ if (props.inputType === 'number') {
60
+ const options = {
61
+ allowNegative: (_b = props.allowNegative) !== null && _b !== void 0 ? _b : true,
62
+ decimal: props.decimals,
63
+ group: props.group,
64
+ integer: props.integers,
65
+ };
66
+ value = formatValue(value, options, false);
67
+ }
68
+ return (h("div", { class: classObj }, props.textArea && props.maxLength ? (h("div", { class: "mdc-text-field-character-counter" }, "'0 / ' + ", props.maxLength)) : undefined, !props.trailingIcon ? iconEl : undefined, props.textArea ? (h("span", { class: "mdc-text-field__resizer" }, h("textarea", { class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, maxlength: props.maxLength, value: value, onBlur: props.onBlur, onClick: props.onClick, onChange: props.onChange, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown }))) : (h("input", { inputmode: props.inputMode ? props.inputMode : undefined, type: inputType, step: props.step, min: props.min, max: props.max, name: props.name, class: "mdc-text-field__input", disabled: props.disabled, readOnly: props.readOnly, placeholder: props.fullWidth && !props.outlined
51
69
  ? props.label
52
- : undefined, maxlength: props.maxLength, value: props.value, onBlur: props.onBlur, onChange: (e) => {
53
- if (props.decimals !== null &&
54
- props.inputType === 'number') {
55
- e.target.value = parseFloat(e.target.value).toFixed(props.decimals);
70
+ : undefined, maxlength: props.maxLength, value: value, onBlur: (e) => {
71
+ var _a;
72
+ if (persManageForNumberFormat) {
73
+ const options = {
74
+ allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
75
+ decimal: props.decimals,
76
+ group: props.group,
77
+ integer: props.integers,
78
+ };
79
+ e.target.value = formatValue(e.target.value, options, true);
80
+ }
81
+ if (props.onBlur) {
82
+ props.onBlur(e);
83
+ }
84
+ }, onChange: (e) => {
85
+ var _a;
86
+ if (persManageForNumberFormat) {
87
+ const options = {
88
+ allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
89
+ decimal: props.decimals,
90
+ group: props.group,
91
+ integer: props.integers,
92
+ };
93
+ e.target.value = formatValue(e.target.value, options, true);
56
94
  }
57
95
  if (props.onChange) {
58
96
  props.onChange(e);
59
97
  }
60
- }, onClick: props.onClick, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown })), props.isClearable ? (h("span", { class: `mdc-text-field__icon kup-icon ${KupThemeIconValues.CLEAR.replace('--', '')}`, onClick: props.onClearIconClick })) : undefined, props.trailingIcon ? iconEl : undefined, !props.fullWidth && !isOutlined ? labelEl : undefined, isOutlined ? (h("div", { class: "mdc-notched-outline" }, h("div", { class: "mdc-notched-outline__leading" }), h("div", { class: "mdc-notched-outline__notch" }, labelEl), h("div", { class: "mdc-notched-outline__trailing" }))) : (h("span", { class: "mdc-line-ripple" }))));
98
+ }, onClick: props.onClick, onFocus: props.onFocus, onInput: props.onInput, onKeyDown: props.onKeyDown, onKeyPress: (e) => {
99
+ var _a;
100
+ if (!persManageForNumberFormat) {
101
+ return;
102
+ }
103
+ if (e.ctrlKey) {
104
+ return;
105
+ }
106
+ if (e.key.length > 1) {
107
+ return;
108
+ }
109
+ const options = {
110
+ allowNegative: (_a = props.allowNegative) !== null && _a !== void 0 ? _a : true,
111
+ decimal: props.decimals,
112
+ group: props.group,
113
+ integer: props.integers,
114
+ };
115
+ let component = e.target;
116
+ let value = component.value;
117
+ let beginVal = value.substring(0, component.selectionStart);
118
+ let endVal = value.substring(component.selectionEnd, component.selectionEnd + value.length - 1);
119
+ let val = beginVal + e.key + endVal;
120
+ if (!dom.ketchup.math.matchNumericValueWithOptions(val, options)) {
121
+ e.preventDefault();
122
+ return;
123
+ }
124
+ } })), props.isClearable ? (h("span", { class: `mdc-text-field__icon kup-icon ${KupThemeIconValues.CLEAR.replace('--', '')}`, onClick: props.onClearIconClick })) : undefined, props.trailingIcon ? iconEl : undefined, !props.fullWidth && !isOutlined ? labelEl : undefined, isOutlined ? (h("div", { class: "mdc-notched-outline" }, h("div", { class: "mdc-notched-outline__leading" }), h("div", { class: "mdc-notched-outline__notch" }, labelEl), h("div", { class: "mdc-notched-outline__trailing" }))) : (h("span", { class: "mdc-line-ripple" }))));
61
125
  }
62
126
  function setHelper(props) {
63
127
  if (props.helperEnabled !== false) {
@@ -75,3 +139,13 @@ function setHelper(props) {
75
139
  }
76
140
  }
77
141
  }
142
+ const formatValue = function (value, options, inputIsLocalized) {
143
+ let formatedValue = value;
144
+ if (!formatedValue) {
145
+ return formatedValue;
146
+ }
147
+ if (formatedValue == '-') {
148
+ return '';
149
+ }
150
+ return dom.ketchup.math.format(formatedValue, dom.ketchup.math.createFormatPattern(options.group, options.decimal), inputIsLocalized);
151
+ };
@@ -233,6 +233,24 @@ export class KupManager {
233
233
  this.utilities.clickCallbacks.add(cb);
234
234
  }
235
235
  }
236
+ /**
237
+ * Retrives event path from event.target
238
+ * @param currentEl event.target
239
+ * @param rootElement rootElement of component
240
+ * @returns
241
+ */
242
+ getEventPath(currentEl, rootElement) {
243
+ const path = [];
244
+ while (currentEl &&
245
+ currentEl !== rootElement &&
246
+ currentEl !== document.body) {
247
+ path.push(currentEl);
248
+ currentEl = currentEl.parentNode
249
+ ? currentEl.parentNode
250
+ : currentEl.host;
251
+ }
252
+ return path;
253
+ }
236
254
  /**
237
255
  * Rasterizes an HTMLElement, transforming into a canvas.
238
256
  * @param {HTMLElement} el - Element to rasterize.
@@ -102,10 +102,11 @@ export class KupMath {
102
102
  * Formats the input number with the specified format of the currently set locale.
103
103
  * @param {string | String | number} input - Input number which will be automatically "numberified".
104
104
  * @param {string} format - Desired format. Defaults to '0,0.00' (i.e.: 2,000,000.51).
105
+ * @param {boolean} inputIsLocalized Numberifies assuming the input string is in the current KupMath locale's format.
105
106
  * @returns {string} Formatted number.
106
107
  */
107
- format(input, format) {
108
- const n = this.numberify(input);
108
+ format(input, format, inputIsLocalized) {
109
+ const n = this.numberify(input, inputIsLocalized);
109
110
  if (!format) {
110
111
  const positiveN = Math.abs(n);
111
112
  const decimals = positiveN - Math.floor(positiveN);
@@ -116,8 +117,88 @@ export class KupMath {
116
117
  format = '0,0';
117
118
  }
118
119
  }
119
- const formatted = this.numeral(n).format(format);
120
- return formatted;
120
+ return this.numeral(n).format(format);
121
+ }
122
+ /**
123
+ * Created the string for format a number
124
+ * @param {boolean} thousandPoint - show thousandPoint
125
+ * @param {number} decimals - number of decimals
126
+ */
127
+ createFormatPattern(thousandPoint, decimals) {
128
+ var format = '0';
129
+ if (thousandPoint) {
130
+ format += ',000';
131
+ }
132
+ if (decimals && decimals > 0) {
133
+ format += '.';
134
+ for (let i = 0; i < decimals; i++) {
135
+ format += '0';
136
+ }
137
+ }
138
+ return format;
139
+ }
140
+ /**
141
+ * Returns the decimal separator of current browser
142
+ * @returns current decimal separator, by locale
143
+ */
144
+ decimalSeparator() {
145
+ const numberWithGroupAndDecimalSeparator = 1000.1;
146
+ return Intl.NumberFormat(this.locale)
147
+ .formatToParts(numberWithGroupAndDecimalSeparator)
148
+ .find((part) => part.type === 'decimal').value;
149
+ }
150
+ /**
151
+ * Returns the group separator of current browser
152
+ * @returns current group separator, by locale
153
+ */
154
+ groupSeparator() {
155
+ const numberWithGroupAndDecimalSeparator = 1000.1;
156
+ return Intl.NumberFormat(this.locale)
157
+ .formatToParts(numberWithGroupAndDecimalSeparator)
158
+ .find((part) => part.type === 'group').value;
159
+ }
160
+ /**
161
+ * Checks if an input string matches options, for desired formatted decimal number (integer digits, decimal digits)
162
+ * @param value the input value to check
163
+ * @param options options for customize the check
164
+ * @returns an object from applying the regular expression for check
165
+ */
166
+ matchNumericValueWithOptions(value, options) {
167
+ // see https://github.com/24eme/jquery-input-number-format.git
168
+ let found = undefined;
169
+ let integerPartSuffix = '+';
170
+ if (options.integer && options.integer > 0) {
171
+ integerPartSuffix = '{0,' + options.integer + '}';
172
+ }
173
+ let regexp = '^[0-9]' + integerPartSuffix;
174
+ if (options.allowNegative) {
175
+ regexp = '^-{0,1}[0-9]' + integerPartSuffix;
176
+ }
177
+ if (options.decimal && options.decimal > 0) {
178
+ regexp +=
179
+ '([' +
180
+ this.decimalSeparator() +
181
+ '][0-9]{0,' +
182
+ options.decimal +
183
+ '})?';
184
+ let regexpObj = new RegExp(regexp + '$');
185
+ found = value.match(regexpObj);
186
+ if (!found) {
187
+ regexp =
188
+ '^[' +
189
+ this.decimalSeparator() +
190
+ '][0-9]{0,' +
191
+ options.decimal +
192
+ '}';
193
+ regexpObj = new RegExp(regexp + '$');
194
+ found = value.match(regexpObj);
195
+ }
196
+ }
197
+ else {
198
+ let regexpObj = new RegExp(regexp + '$');
199
+ found = value.match(regexpObj);
200
+ }
201
+ return found;
121
202
  }
122
203
  /**
123
204
  * Returns a number from a non-specified input type between string, number, or String.
@@ -15,12 +15,6 @@ export function identify(array) {
15
15
  }
16
16
  }
17
17
  }
18
- function getSeparator(locale, separatorType) {
19
- const numberWithGroupAndDecimalSeparator = 1000.1;
20
- return Intl.NumberFormat(locale)
21
- .formatToParts(numberWithGroupAndDecimalSeparator)
22
- .find((part) => part.type === separatorType).value;
23
- }
24
18
  export function getCurrentDateFormatFromBrowserLocale() {
25
19
  const formatObj = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale()).formatToParts(new Date());
26
20
  let dateFormat = formatObj
@@ -155,7 +149,7 @@ export function unformattedStringToFormattedStringNumber(input, decimals, type)
155
149
  * @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
156
150
  **/
157
151
  export function formattedStringToUnformattedStringNumber(input, type) {
158
- return numberStringToNumberString(input, type, getDecimalSeparator(dom.ketchup.dates.getLocale()));
152
+ return numberStringToNumberString(input, type, dom.ketchup.math.decimalSeparator());
159
153
  }
160
154
  /**
161
155
  * @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers), with group separator
@@ -192,9 +186,6 @@ function numberStringToNumberString(input, type, decFmt) {
192
186
  let unf = stringToNumber(input);
193
187
  return _numberToString(unf, -1, 'en-US', false);
194
188
  }
195
- export function getDecimalSeparator(locale) {
196
- return getSeparator(locale, 'decimal');
197
- }
198
189
  function countDecimals(value) {
199
190
  if (Math.floor(value) === value)
200
191
  return 0;