@sme.up/ketchup 8.0.0 → 8.0.2

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 (170) hide show
  1. package/dist/cjs/{f-button-49b2c37c.js → f-button-9524bbf7.js} +2 -2
  2. package/dist/cjs/{f-cell-9a6bc55c.js → f-cell-bcb75ade.js} +22 -13
  3. package/dist/cjs/{f-checkbox-593f72c3.js → f-checkbox-1148e791.js} +1 -1
  4. package/dist/cjs/{f-chip-dee84122.js → f-chip-2249b386.js} +3 -3
  5. package/dist/cjs/{f-image-27f965ff.js → f-image-47d74999.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-4a30189d.js → f-paginator-utils-b0a9ae5f.js} +64 -63
  7. package/dist/cjs/{f-text-field-04a663b4.js → f-text-field-579c0fc0.js} +83 -9
  8. package/dist/cjs/{index-74433248.js → index-1f177abc.js} +0 -3
  9. package/dist/cjs/ketchup.cjs.js +2 -2
  10. package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
  11. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +798 -815
  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 +7 -7
  15. package/dist/cjs/kup-dash-list.cjs.entry.js +3 -4
  16. package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +6 -6
  18. package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
  19. package/dist/cjs/kup-echart.cjs.entry.js +2 -2
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
  21. package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
  22. package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
  23. package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
  24. package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
  25. package/dist/cjs/{kup-manager-2ff5d258.js → kup-manager-85b2a756.js} +758 -538
  26. package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
  27. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +2 -2
  29. package/dist/cjs/kup-planner.cjs.entry.js +3 -3
  30. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  31. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +12 -4
  33. package/dist/cjs/loader.cjs.js +2 -2
  34. package/dist/collection/components/kup-card/built-in/kup-card-calendar.js +5 -61
  35. package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
  36. package/dist/collection/components/kup-dash-list/kup-dash-list.js +1 -3
  37. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +7 -8
  38. package/dist/collection/components/kup-data-table/kup-data-table.js +5 -4
  39. package/dist/collection/components/kup-gauge/kup-gauge.js +4 -4
  40. package/dist/collection/components/kup-snackbar/kup-snackbar.js +27 -0
  41. package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +3 -0
  42. package/dist/collection/components/kup-text-field/kup-text-field.js +107 -9
  43. package/dist/collection/components/kup-time-picker/kup-time-picker.js +7 -7
  44. package/dist/collection/components/kup-tree/kup-tree.js +2 -2
  45. package/dist/collection/f-components/f-cell/f-cell.js +16 -8
  46. package/dist/collection/f-components/f-paginator/f-paginator-utils.js +3 -3
  47. package/dist/collection/f-components/f-text-field/f-text-field.js +80 -6
  48. package/dist/collection/managers/kup-data/kup-data.js +3 -1
  49. package/dist/collection/managers/kup-dates/kup-dates-declarations.js +21 -10
  50. package/dist/collection/managers/kup-dates/kup-dates.js +312 -1
  51. package/dist/collection/managers/kup-math/kup-math.js +258 -6
  52. package/dist/collection/utils/cell-utils.js +5 -6
  53. package/dist/collection/utils/filters/filters.js +11 -13
  54. package/dist/collection/utils/utils.js +18 -444
  55. package/dist/components/kup-autocomplete2.js +1301 -1002
  56. package/dist/components/kup-box2.js +1 -1
  57. package/dist/components/kup-calendar.js +1 -1
  58. package/dist/components/kup-cell.js +1 -1
  59. package/dist/components/kup-dash-list.js +2 -3
  60. package/dist/components/kup-dashboard.js +1 -1
  61. package/dist/components/kup-data-table.js +1 -1
  62. package/dist/components/kup-date-picker.js +1 -1
  63. package/dist/components/kup-dialog.js +1 -1
  64. package/dist/components/kup-dropdown-button.js +1 -1
  65. package/dist/components/kup-echart2.js +1 -1
  66. package/dist/components/kup-family-tree.js +1 -1
  67. package/dist/components/kup-form.js +1 -1
  68. package/dist/components/kup-gauge.js +1 -1
  69. package/dist/components/kup-grid2.js +1 -1
  70. package/dist/components/kup-iframe.js +1 -1
  71. package/dist/components/kup-image-list.js +1 -1
  72. package/dist/components/kup-image.js +1 -1
  73. package/dist/components/kup-list.js +1 -1
  74. package/dist/components/kup-magic-box.js +1 -1
  75. package/dist/components/kup-numeric-picker.js +1 -1
  76. package/dist/components/kup-planner.js +1 -1
  77. package/dist/components/kup-progress-bar.js +1 -1
  78. package/dist/components/kup-radio.js +1 -1
  79. package/dist/components/kup-rating.js +1 -1
  80. package/dist/components/kup-snackbar.js +8 -0
  81. package/dist/components/kup-spinner.js +1 -1
  82. package/dist/components/kup-switch.js +1 -1
  83. package/dist/components/kup-tab-bar.js +1 -1
  84. package/dist/components/kup-text-field.js +1 -1
  85. package/dist/components/kup-time-picker.js +1 -1
  86. package/dist/components/kup-tree.js +1 -1
  87. package/dist/esm/{f-button-744cf1f6.js → f-button-024f0cfe.js} +2 -2
  88. package/dist/esm/{f-cell-b319c869.js → f-cell-90240a8c.js} +22 -13
  89. package/dist/esm/{f-checkbox-ec85b437.js → f-checkbox-9b3f5f5b.js} +1 -1
  90. package/dist/esm/{f-chip-7e3e4180.js → f-chip-2238ad43.js} +3 -3
  91. package/dist/esm/{f-image-098c26ce.js → f-image-f2e9bf79.js} +2 -2
  92. package/dist/esm/{f-paginator-utils-674cb2ae.js → f-paginator-utils-8cb3c023.js} +64 -63
  93. package/dist/esm/{f-text-field-c38ef113.js → f-text-field-d231982c.js} +83 -9
  94. package/dist/esm/{index-b326ffc9.js → index-8bd38435.js} +1 -3
  95. package/dist/esm/ketchup.js +3 -3
  96. package/dist/esm/kup-accordion.entry.js +3 -3
  97. package/dist/esm/kup-autocomplete_27.entry.js +792 -809
  98. package/dist/esm/kup-box.entry.js +10 -10
  99. package/dist/esm/kup-calendar.entry.js +5 -5
  100. package/dist/esm/kup-cell.entry.js +7 -7
  101. package/dist/esm/kup-dash-list.entry.js +3 -4
  102. package/dist/esm/kup-dash_2.entry.js +2 -2
  103. package/dist/esm/kup-dashboard.entry.js +6 -6
  104. package/dist/esm/kup-drawer.entry.js +2 -2
  105. package/dist/esm/kup-echart.entry.js +2 -2
  106. package/dist/esm/kup-family-tree.entry.js +4 -4
  107. package/dist/esm/kup-iframe.entry.js +2 -2
  108. package/dist/esm/kup-image-list.entry.js +8 -8
  109. package/dist/esm/kup-lazy.entry.js +2 -2
  110. package/dist/esm/kup-magic-box.entry.js +3 -3
  111. package/dist/esm/{kup-manager-b41eb2a8.js → kup-manager-d1da769e.js} +758 -529
  112. package/dist/esm/kup-nav-bar.entry.js +2 -2
  113. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  114. package/dist/esm/kup-photo-frame.entry.js +2 -2
  115. package/dist/esm/kup-planner.entry.js +3 -3
  116. package/dist/esm/kup-probe.entry.js +2 -2
  117. package/dist/esm/kup-qlik.entry.js +2 -2
  118. package/dist/esm/kup-snackbar.entry.js +12 -4
  119. package/dist/esm/loader.js +3 -3
  120. package/dist/ketchup/ketchup.esm.js +1 -1
  121. package/dist/ketchup/{p-5ce2b4fc.entry.js → p-063d4c27.entry.js} +1 -1
  122. package/dist/ketchup/{p-4325d965.entry.js → p-0bcda0e2.entry.js} +1 -1
  123. package/dist/ketchup/{p-af82131e.entry.js → p-0d7d59c7.entry.js} +1 -1
  124. package/dist/ketchup/{p-bd42562d.entry.js → p-163b18b9.entry.js} +1 -1
  125. package/dist/ketchup/{p-b244f5ca.entry.js → p-1ad628fb.entry.js} +1 -1
  126. package/dist/ketchup/{p-a9b7533b.entry.js → p-33aff1ca.entry.js} +1 -1
  127. package/dist/ketchup/p-3432ebaf.entry.js +9 -0
  128. package/dist/ketchup/{p-b032f47d.entry.js → p-35b29b22.entry.js} +1 -1
  129. package/dist/ketchup/{p-940a5feb.js → p-36dac88e.js} +3 -3
  130. package/dist/ketchup/{p-395e1960.entry.js → p-37067ee6.entry.js} +1 -1
  131. package/dist/ketchup/p-39a55c47.js +1 -0
  132. package/dist/ketchup/p-3cf64473.js +1 -0
  133. package/dist/ketchup/{p-5d398e42.js → p-410c102a.js} +1 -1
  134. package/dist/ketchup/p-43b67de4.entry.js +1 -0
  135. package/dist/ketchup/{p-a7e19620.entry.js → p-489d55ff.entry.js} +1 -1
  136. package/dist/ketchup/{p-77e3d537.js → p-5f3680f2.js} +1 -1
  137. package/dist/ketchup/p-651d89c8.entry.js +1 -0
  138. package/dist/ketchup/{p-da891093.entry.js → p-73c8d651.entry.js} +1 -1
  139. package/dist/ketchup/{p-bb17c1ba.entry.js → p-83435e6c.entry.js} +1 -1
  140. package/dist/ketchup/{p-3b41aca7.entry.js → p-89743989.entry.js} +1 -1
  141. package/dist/ketchup/{p-ef614656.js → p-8b46e7ce.js} +1 -1
  142. package/dist/ketchup/{p-d4ece435.js → p-9dcfbb1e.js} +2 -2
  143. package/dist/ketchup/{p-c26975bf.js → p-9f9b6656.js} +1 -1
  144. package/dist/ketchup/{p-c968e93d.entry.js → p-a84f1d24.entry.js} +1 -1
  145. package/dist/ketchup/{p-e02b5141.entry.js → p-b2fd2dbf.entry.js} +1 -1
  146. package/dist/ketchup/{p-d739710a.entry.js → p-c42b80c1.entry.js} +1 -1
  147. package/dist/ketchup/p-d1b050d0.entry.js +27 -0
  148. package/dist/ketchup/p-d6ea709e.entry.js +1 -0
  149. package/dist/ketchup/{p-0b91f5f8.entry.js → p-e1f1e661.entry.js} +1 -1
  150. package/dist/ketchup/p-eda7f130.js +1 -0
  151. package/dist/ketchup/{p-4ae2ca6f.entry.js → p-f876125d.entry.js} +1 -1
  152. package/dist/types/components/kup-snackbar/kup-snackbar.d.ts +5 -0
  153. package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +3 -0
  154. package/dist/types/components/kup-text-field/kup-text-field.d.ts +20 -2
  155. package/dist/types/components.d.ts +34 -0
  156. package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +3 -0
  157. package/dist/types/managers/kup-dates/kup-dates-declarations.d.ts +19 -9
  158. package/dist/types/managers/kup-dates/kup-dates.d.ts +94 -1
  159. package/dist/types/managers/kup-math/kup-math-declarations.d.ts +6 -0
  160. package/dist/types/managers/kup-math/kup-math.d.ts +88 -3
  161. package/dist/types/utils/utils.d.ts +13 -103
  162. package/package.json +1 -1
  163. package/dist/ketchup/p-0b0b61cb.entry.js +0 -1
  164. package/dist/ketchup/p-3efe7f43.entry.js +0 -27
  165. package/dist/ketchup/p-9700eb32.js +0 -1
  166. package/dist/ketchup/p-a877a87b.entry.js +0 -9
  167. package/dist/ketchup/p-c8b7790a.entry.js +0 -1
  168. package/dist/ketchup/p-d98fdb9b.js +0 -1
  169. package/dist/ketchup/p-df316daf.entry.js +0 -1
  170. package/dist/ketchup/p-e714f4dc.js +0 -1
@@ -1,3 +1,11 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f)
3
+ throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
5
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
+ };
8
+ var _KupTextField_instances, _KupTextField_getValueForOutput, _KupTextField_setValueFromEventTaget;
1
9
  import { forceUpdate, h, Host, } from '@stencil/core';
2
10
  import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
3
11
  import { FTextField } from '../../f-components/f-text-field/f-text-field';
@@ -8,16 +16,19 @@ import { getProps, setProps } from '../../utils/utils';
8
16
  import { componentWrapperId } from '../../variables/GenericVariables';
9
17
  export class KupTextField {
10
18
  constructor() {
19
+ _KupTextField_instances.add(this);
11
20
  /**
12
21
  * Instance of the KupManager class.
13
22
  */
14
23
  this.kupManager = kupManagerInstance();
15
24
  this.value = '';
25
+ this.allowNegative = false;
16
26
  this.customStyle = '';
17
27
  this.decimals = null;
18
28
  this.disabled = false;
19
29
  this.emitSubmitEventOnEnter = true;
20
30
  this.fullWidth = false;
31
+ this.group = false;
21
32
  this.helper = null;
22
33
  this.helperEnabled = true;
23
34
  this.helperWhenFocused = false;
@@ -25,6 +36,7 @@ export class KupTextField {
25
36
  this.initialValue = '';
26
37
  this.inputMode = null;
27
38
  this.inputType = 'text';
39
+ this.integers = null;
28
40
  this.isClearable = false;
29
41
  this.label = null;
30
42
  this.leadingLabel = false;
@@ -41,35 +53,36 @@ export class KupTextField {
41
53
  }
42
54
  onKupBlur(event) {
43
55
  const { target } = event;
56
+ __classPrivateFieldGet(this, _KupTextField_instances, "m", _KupTextField_setValueFromEventTaget).call(this, target);
44
57
  this.kupBlur.emit({
45
58
  comp: this,
46
59
  id: this.rootElement.id,
47
- value: target.value,
60
+ value: this.value,
48
61
  });
49
62
  }
50
63
  onKupChange(event) {
51
64
  const { target } = event;
52
- this.value = target.value;
65
+ __classPrivateFieldGet(this, _KupTextField_instances, "m", _KupTextField_setValueFromEventTaget).call(this, target);
53
66
  this.kupChange.emit({
54
67
  comp: this,
55
68
  id: this.rootElement.id,
56
- value: target.value,
69
+ value: this.value,
57
70
  });
58
71
  }
59
72
  onKupClick(event) {
60
73
  const { target } = event;
74
+ __classPrivateFieldGet(this, _KupTextField_instances, "m", _KupTextField_setValueFromEventTaget).call(this, target);
61
75
  this.kupClick.emit({
62
76
  comp: this,
63
77
  id: this.rootElement.id,
64
- value: target.value,
78
+ value: this.value,
65
79
  });
66
80
  }
67
- onKupFocus(event) {
68
- const { target } = event;
81
+ onKupFocus(_event) {
69
82
  this.kupFocus.emit({
70
83
  comp: this,
71
84
  id: this.rootElement.id,
72
- value: target.value,
85
+ value: this.value,
73
86
  });
74
87
  }
75
88
  onKupInput(event) {
@@ -97,12 +110,14 @@ export class KupTextField {
97
110
  });
98
111
  }
99
112
  onKeyDown(event) {
113
+ const { target } = event;
100
114
  if (event.key === 'Enter') {
101
115
  if (this.emitSubmitEventOnEnter == true) {
116
+ __classPrivateFieldGet(this, _KupTextField_instances, "m", _KupTextField_setValueFromEventTaget).call(this, target);
102
117
  this.kupTextFieldSubmit.emit({
103
118
  comp: this,
104
119
  id: this.rootElement.id,
105
- value: this.inputEl.value,
120
+ value: this.value,
106
121
  });
107
122
  }
108
123
  }
@@ -122,6 +137,9 @@ export class KupTextField {
122
137
  * Returns the component's internal value.
123
138
  */
124
139
  async getValue() {
140
+ if (this.inputType == 'number') {
141
+ return this.kupManager.math.formattedStringToNumberString(this.value, '');
142
+ }
125
143
  return this.value;
126
144
  }
127
145
  /**
@@ -149,7 +167,7 @@ export class KupTextField {
149
167
  async setValue(value) {
150
168
  this.value = value;
151
169
  try {
152
- this.inputEl.value = value;
170
+ this.inputEl.value = __classPrivateFieldGet(this, _KupTextField_instances, "m", _KupTextField_getValueForOutput).call(this);
153
171
  }
154
172
  catch (error) {
155
173
  this.kupManager.debug.logMessage(this, "Couldn't set value on input element: '" + value + "'", KupDebugCategory.WARNING);
@@ -185,6 +203,7 @@ export class KupTextField {
185
203
  }
186
204
  render() {
187
205
  const props = {
206
+ allowNegative: this.allowNegative,
188
207
  danger: this.rootElement.classList.contains('kup-danger')
189
208
  ? true
190
209
  : false,
@@ -194,6 +213,7 @@ export class KupTextField {
194
213
  ? true
195
214
  : false,
196
215
  fullWidth: this.fullWidth,
216
+ group: this.group,
197
217
  helper: this.helper,
198
218
  helperEnabled: this.helperEnabled,
199
219
  helperWhenFocused: this.helperWhenFocused,
@@ -203,6 +223,7 @@ export class KupTextField {
203
223
  : false,
204
224
  inputMode: this.inputMode,
205
225
  inputType: this.inputType,
226
+ integers: this.integers,
206
227
  isClearable: this.isClearable,
207
228
  label: this.label,
208
229
  leadingLabel: this.leadingLabel,
@@ -257,6 +278,27 @@ export class KupTextField {
257
278
  }
258
279
  static get properties() {
259
280
  return {
281
+ "allowNegative": {
282
+ "type": "boolean",
283
+ "mutable": false,
284
+ "complexType": {
285
+ "original": "boolean",
286
+ "resolved": "boolean",
287
+ "references": {}
288
+ },
289
+ "required": false,
290
+ "optional": false,
291
+ "docs": {
292
+ "tags": [{
293
+ "name": "default",
294
+ "text": "null"
295
+ }],
296
+ "text": "When true, could be input negative numbers (should be used when inputType is number)."
297
+ },
298
+ "attribute": "allow-negative",
299
+ "reflect": false,
300
+ "defaultValue": "false"
301
+ },
260
302
  "customStyle": {
261
303
  "type": "string",
262
304
  "mutable": false,
@@ -365,6 +407,27 @@ export class KupTextField {
365
407
  "reflect": true,
366
408
  "defaultValue": "false"
367
409
  },
410
+ "group": {
411
+ "type": "boolean",
412
+ "mutable": false,
413
+ "complexType": {
414
+ "original": "boolean",
415
+ "resolved": "boolean",
416
+ "references": {}
417
+ },
418
+ "required": false,
419
+ "optional": false,
420
+ "docs": {
421
+ "tags": [{
422
+ "name": "default",
423
+ "text": "null"
424
+ }],
425
+ "text": "When true, the number will be formatted with group separator (should be used when inputType is number)."
426
+ },
427
+ "attribute": "group",
428
+ "reflect": false,
429
+ "defaultValue": "false"
430
+ },
368
431
  "helper": {
369
432
  "type": "string",
370
433
  "mutable": false,
@@ -512,6 +575,27 @@ export class KupTextField {
512
575
  "reflect": false,
513
576
  "defaultValue": "'text'"
514
577
  },
578
+ "integers": {
579
+ "type": "number",
580
+ "mutable": false,
581
+ "complexType": {
582
+ "original": "number",
583
+ "resolved": "number",
584
+ "references": {}
585
+ },
586
+ "required": false,
587
+ "optional": false,
588
+ "docs": {
589
+ "tags": [{
590
+ "name": "default",
591
+ "text": "null"
592
+ }],
593
+ "text": "Number of integers (should be used when inputType is number)."
594
+ },
595
+ "attribute": "integers",
596
+ "reflect": false,
597
+ "defaultValue": "null"
598
+ },
515
599
  "isClearable": {
516
600
  "type": "boolean",
517
601
  "mutable": false,
@@ -1089,3 +1173,17 @@ export class KupTextField {
1089
1173
  }
1090
1174
  static get elementRef() { return "rootElement"; }
1091
1175
  }
1176
+ _KupTextField_instances = new WeakSet(), _KupTextField_getValueForOutput = function _KupTextField_getValueForOutput() {
1177
+ if (this.value == null || this.value.trim() == '') {
1178
+ return '';
1179
+ }
1180
+ let v1 = this.kupManager.math.numberStringToFormattedString(this.value, this.decimals, '');
1181
+ return v1;
1182
+ }, _KupTextField_setValueFromEventTaget = function _KupTextField_setValueFromEventTaget(target) {
1183
+ if (this.inputType == 'number') {
1184
+ this.value = this.kupManager.math.formattedStringToNumberString(target.value, '');
1185
+ }
1186
+ else {
1187
+ this.value = target.value;
1188
+ }
1189
+ };
@@ -1,14 +1,14 @@
1
1
  import { forceUpdate, h, Host, } from '@stencil/core';
2
2
  import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
3
- import { isValidFormattedStringTime, formattedStringToCustomUnformattedStringTime, unformattedStringToFormattedStringTime, formatTime, getProps, setProps, } from '../../utils/utils';
3
+ import { getProps, setProps } from '../../utils/utils';
4
4
  import { KupTimePickerProps, } from './kup-time-picker-declarations';
5
5
  import { KupDebugCategory } from '../../managers/kup-debug/kup-debug-declarations';
6
6
  import { componentWrapperId } from '../../variables/GenericVariables';
7
- import { KupDatesFormats } from '../../managers/kup-dates/kup-dates-declarations';
8
7
  import { FTextField } from '../../f-components/f-text-field/f-text-field';
9
8
  import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
10
9
  import { KupCardFamily, } from '../kup-card/kup-card-declarations';
11
10
  import { KupDynamicPositionPlacement } from '../../managers/kup-dynamic-position/kup-dynamic-position-declarations';
11
+ import { KupDatesFormats } from '../../managers/kup-dates/kup-dates-declarations';
12
12
  export class KupTimePicker {
13
13
  constructor() {
14
14
  /*-------------------------------------------------*/
@@ -193,13 +193,13 @@ export class KupTimePicker {
193
193
  /* P r i v a t e M e t h o d s */
194
194
  /*-------------------------------------------------*/
195
195
  getFormattedValue(value) {
196
- return formattedStringToCustomUnformattedStringTime(value, this.manageSeconds
196
+ return this.kupManager.dates.formattedStringToCustomDateTime(value, this.manageSeconds
197
197
  ? KupDatesFormats.ISO_TIME
198
198
  : KupDatesFormats.ISO_TIME_WITHOUT_SECONDS, this.manageSeconds);
199
199
  }
200
200
  refreshPickerValue(eventDetailValue, eventToRaise) {
201
201
  let newValue = null;
202
- if (isValidFormattedStringTime(eventDetailValue, this.manageSeconds)) {
202
+ if (this.kupManager.dates.isValidFormattedStringTime(eventDetailValue, this.manageSeconds)) {
203
203
  this.value = eventDetailValue;
204
204
  newValue = this.value;
205
205
  }
@@ -349,8 +349,8 @@ export class KupTimePicker {
349
349
  date.getMinutes() == selectedTime.getMinutes()) {
350
350
  selected = true;
351
351
  }
352
- const value = formatTime(date, this.manageSeconds);
353
- const id = formattedStringToCustomUnformattedStringTime(value, this.manageSeconds
352
+ const value = this.kupManager.dates.formatTime(date, this.manageSeconds);
353
+ const id = this.kupManager.dates.formattedStringToCustomDateTime(value, this.manageSeconds
354
354
  ? KupDatesFormats.ISO_TIME
355
355
  : KupDatesFormats.ISO_TIME_WITHOUT_SECONDS, this.manageSeconds);
356
356
  let item = {
@@ -367,7 +367,7 @@ export class KupTimePicker {
367
367
  if (this.value == null || this.value.trim() == '') {
368
368
  return '';
369
369
  }
370
- let v1 = unformattedStringToFormattedStringTime(this.value, this.manageSeconds);
370
+ let v1 = this.kupManager.dates.timeStringToFormattedString(this.value, this.manageSeconds);
371
371
  return v1;
372
372
  }
373
373
  /*-------------------------------------------------*/
@@ -14,7 +14,7 @@ import { kupManagerInstance, } from '../../managers/kup-manager/kup-manager';
14
14
  import { calcTotals, normalizeRows, } from '../kup-data-table/kup-data-table-helper';
15
15
  import { KupTreeState } from './kup-tree-state';
16
16
  import { getColumnByName } from '../../utils/cell-utils';
17
- import { getProps, numberToFormattedStringNumber, setProps, } from '../../utils/utils';
17
+ import { getProps, setProps } from '../../utils/utils';
18
18
  import { KupColumnMenu } from '../../utils/kup-column-menu/kup-column-menu';
19
19
  import { FiltersColumnMenu } from '../../utils/filters/filters-column-menu';
20
20
  import { KupGlobalFilterMode, } from '../../utils/filters/filters-declarations';
@@ -1142,7 +1142,7 @@ export class KupTree {
1142
1142
  value = this.footer[column.name];
1143
1143
  }
1144
1144
  else {
1145
- value = numberToFormattedStringNumber(this.footer[column.name], column.decimals, column.obj ? column.obj.p : '');
1145
+ value = __classPrivateFieldGet(this, _KupTree_kupManager, "f").math.numberToFormattedString(this.footer[column.name], column.decimals, column.obj ? column.obj.p : '');
1146
1146
  }
1147
1147
  return (h("td", { "data-column": column.name }, totalMenu, h("span", { class: "totals-value", title: translation[menuLabel] }, value)));
1148
1148
  });
@@ -4,7 +4,6 @@ import { h } from '@stencil/core';
4
4
  import { getCellValueForDisplay } from '../../utils/cell-utils';
5
5
  import { FCheckbox } from '../f-checkbox/f-checkbox';
6
6
  import { FTextField } from '../f-text-field/f-text-field';
7
- import { stringToNumber } from '../../utils/utils';
8
7
  import { FImage } from '../f-image/f-image';
9
8
  import { FChip } from '../f-chip/f-chip';
10
9
  import { KupThemeColorValues } from '../../managers/kup-theme/kup-theme-declarations';
@@ -232,7 +231,9 @@ function setEditableCell(cellType, classObj, cell, column, props) {
232
231
  case FCellTypes.LINK:
233
232
  case FCellTypes.STRING:
234
233
  return (h(FTextField, Object.assign({ inputType: cellType === FCellTypes.NUMBER ? 'number' : null, fullWidth: isFullWidth(props) ? true : false }, cell.data, { icon: cell.icon ? cell.icon : column.icon ? column.icon : null, value: cellType === FCellTypes.NUMBER
235
- ? stringToNumber(cell.value).toString()
234
+ ? dom.ketchup.math
235
+ .numberifySafe(cell.value)
236
+ .toString()
236
237
  : cell.value, onChange: (e) => cellEvent(e, props, cellType, FCellEvents.UPDATE), onInput: (e) => cellEvent(e, props, cellType, FCellEvents.INPUT), onIconClick: (e) => cellEvent(e, props, cellType, FCellEvents.ICON_CLICK) })));
237
238
  }
238
239
  }
@@ -270,7 +271,7 @@ function setCell(cellType, subcomponentProps, content, classObj, cell, column, p
270
271
  return (h("a", { href: content, target: "_blank" }, cell.value));
271
272
  case FCellTypes.NUMBER:
272
273
  if (content && content != '') {
273
- const cellValueNumber = stringToNumber(cell.value);
274
+ const cellValueNumber = dom.ketchup.math.numberifySafe(cell.value);
274
275
  const cellValue = getCellValueForDisplay(column, cell);
275
276
  if (cellValueNumber < 0) {
276
277
  classObj[FCellClasses.TEXT_DANGER] = true;
@@ -329,7 +330,7 @@ function setKupCell(cellType, classObj, subcomponentProps, cell, row, column, pr
329
330
  case FCellTypes.COLOR_PICKER:
330
331
  return (h("kup-color-picker", Object.assign({ key: column.name + props.row.id }, subcomponentProps, { class: isFullWidth(props) ? 'kup-full-width' : '', disabled: true })));
331
332
  case FCellTypes.GAUGE:
332
- return (h("kup-gauge", Object.assign({ key: column.name + props.row.id, value: stringToNumber(cell.value), "width-component": "280px" }, subcomponentProps)));
333
+ return (h("kup-gauge", Object.assign({ key: column.name + props.row.id, value: dom.ketchup.math.numberifySafe(cell.value), "width-component": "280px" }, subcomponentProps)));
333
334
  case FCellTypes.KNOB:
334
335
  case FCellTypes.PROGRESS_BAR:
335
336
  return (h("kup-progress-bar", Object.assign({ key: column.name + props.row.id }, subcomponentProps)));
@@ -348,10 +349,7 @@ function cellEvent(e, props, cellType, cellEventName) {
348
349
  const column = props.column;
349
350
  const comp = props.component;
350
351
  const row = props.row;
351
- const isInputEvent = !!(e.target.tagName === 'INPUT');
352
- let value = isInputEvent
353
- ? e.target.value
354
- : e.detail.value;
352
+ let value = getValueFromEventTaget(e, cellType);
355
353
  if (cellEventName === FCellEvents.UPDATE) {
356
354
  switch (cellType) {
357
355
  case FCellTypes.AUTOCOMPLETE:
@@ -411,6 +409,16 @@ function cellEvent(e, props, cellType, cellEventName) {
411
409
  }
412
410
  }
413
411
  }
412
+ function getValueFromEventTaget(e, cellType) {
413
+ const isInputEvent = !!(e.target.tagName === 'INPUT');
414
+ let value = isInputEvent
415
+ ? e.target.value
416
+ : e.detail.value;
417
+ if (cellType === FCellTypes.NUMBER && isInputEvent) {
418
+ value = dom.ketchup.math.formattedStringToNumberString(value, '');
419
+ }
420
+ return value;
421
+ }
414
422
  function isAutoCentered(props) {
415
423
  var _a;
416
424
  return autoCenterComps.includes((_a = props.component) === null || _a === void 0 ? void 0 : _a.rootElement.tagName);
@@ -1,6 +1,6 @@
1
- import { isNumber } from '../../utils/utils';
1
+ const dom = document.documentElement;
2
2
  export function pageChange(pageNumber, max, perPage) {
3
- if (isNumber(pageNumber)) {
3
+ if (dom.ketchup.math.isNumber(pageNumber)) {
4
4
  const numberOfPages = Math.ceil(max / perPage);
5
5
  let tmpNewPage = pageNumber;
6
6
  if (tmpNewPage > numberOfPages) {
@@ -14,7 +14,7 @@ export function pageChange(pageNumber, max, perPage) {
14
14
  return null;
15
15
  }
16
16
  export function rowsPerPageChange(rowsNumber, max) {
17
- if (isNumber(rowsNumber)) {
17
+ if (dom.ketchup.math.isNumber(rowsNumber)) {
18
18
  let tmpRowsPerPage = rowsNumber;
19
19
  if (tmpRowsPerPage > max) {
20
20
  tmpRowsPerPage = max;
@@ -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
+ };
@@ -219,9 +219,11 @@ export class KupData {
219
219
  }
220
220
  else {
221
221
  n = dom.ketchup.math.numberify(cell.value);
222
+ const nMax = dom.ketchup.math.numberify(max);
223
+ const nMin = dom.ketchup.math.numberify(min);
222
224
  if (n === max ||
223
225
  n === min ||
224
- (n < max && n > min)) {
226
+ (n < nMax && n > nMin)) {
225
227
  result.cells.push(cell);
226
228
  result.rows.push(row);
227
229
  }
@@ -7,16 +7,6 @@ export var KupDatesNormalize;
7
7
  KupDatesNormalize["TIME"] = "time";
8
8
  KupDatesNormalize["TIMESTAMP"] = "timestamp";
9
9
  })(KupDatesNormalize || (KupDatesNormalize = {}));
10
- /**
11
- * Common use formats
12
- */
13
- export var KupDatesFormats;
14
- (function (KupDatesFormats) {
15
- KupDatesFormats["ISO_DATE"] = "YYYY-MM-DD";
16
- KupDatesFormats["ISO_DATE_TIME"] = "YYYY-MM-DD HH:mm:ss";
17
- KupDatesFormats["ISO_TIME"] = "HH:mm:ss";
18
- KupDatesFormats["ISO_TIME_WITHOUT_SECONDS"] = "HH:mm";
19
- })(KupDatesFormats || (KupDatesFormats = {}));
20
10
  /**
21
11
  * Supported locales.
22
12
  */
@@ -30,3 +20,24 @@ export var KupDatesLocales;
30
20
  KupDatesLocales["RUSSIAN"] = "ru";
31
21
  KupDatesLocales["SPANISH"] = "es";
32
22
  })(KupDatesLocales || (KupDatesLocales = {}));
23
+ /**
24
+ * Format Months
25
+ */
26
+ export var KupDateTimeFormatOptionsMonth;
27
+ (function (KupDateTimeFormatOptionsMonth) {
28
+ KupDateTimeFormatOptionsMonth["NUMERIC"] = "numeric";
29
+ KupDateTimeFormatOptionsMonth["DIGIT2"] = "2-digit";
30
+ KupDateTimeFormatOptionsMonth["LONG"] = "long";
31
+ KupDateTimeFormatOptionsMonth["SHORT"] = "short";
32
+ KupDateTimeFormatOptionsMonth["NARROW"] = "narrow";
33
+ })(KupDateTimeFormatOptionsMonth || (KupDateTimeFormatOptionsMonth = {}));
34
+ /**
35
+ * Common use formats
36
+ */
37
+ export var KupDatesFormats;
38
+ (function (KupDatesFormats) {
39
+ KupDatesFormats["ISO_DATE"] = "YYYY-MM-DD";
40
+ KupDatesFormats["ISO_DATE_TIME"] = "YYYY-MM-DD HH:mm:ss";
41
+ KupDatesFormats["ISO_TIME"] = "HH:mm:ss";
42
+ KupDatesFormats["ISO_TIME_WITHOUT_SECONDS"] = "HH:mm";
43
+ })(KupDatesFormats || (KupDatesFormats = {}));