@sme.up/ketchup 8.0.1 → 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.
- package/dist/cjs/{f-button-c0ede055.js → f-button-9524bbf7.js} +1 -1
- package/dist/cjs/{f-cell-1c17dbac.js → f-cell-bcb75ade.js} +10 -8
- package/dist/cjs/{f-chip-bace36bb.js → f-chip-2249b386.js} +2 -2
- package/dist/cjs/{f-image-22174590.js → f-image-47d74999.js} +1 -1
- package/dist/cjs/{f-paginator-utils-e21e1f06.js → f-paginator-utils-b0a9ae5f.js} +63 -62
- package/dist/cjs/{f-text-field-503f2bb0.js → f-text-field-579c0fc0.js} +1 -1
- package/dist/cjs/kup-accordion.cjs.entry.js +2 -2
- package/dist/cjs/kup-autocomplete_27.cjs.entry.js +32 -87
- package/dist/cjs/kup-box.cjs.entry.js +7 -7
- package/dist/cjs/kup-calendar.cjs.entry.js +4 -4
- package/dist/cjs/kup-cell.cjs.entry.js +5 -5
- package/dist/cjs/kup-dash-list.cjs.entry.js +1 -1
- package/dist/cjs/kup-dash_2.cjs.entry.js +1 -1
- package/dist/cjs/kup-dashboard.cjs.entry.js +4 -4
- package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
- package/dist/cjs/kup-echart.cjs.entry.js +1 -1
- package/dist/cjs/kup-family-tree.cjs.entry.js +3 -3
- package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
- package/dist/cjs/kup-image-list.cjs.entry.js +6 -6
- package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
- package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
- package/dist/cjs/{kup-manager-b994cf71.js → kup-manager-85b2a756.js} +679 -531
- package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
- package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
- package/dist/cjs/kup-planner.cjs.entry.js +2 -2
- package/dist/cjs/kup-probe.cjs.entry.js +1 -1
- package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
- package/dist/cjs/kup-snackbar.cjs.entry.js +3 -3
- package/dist/collection/assets/data-table.js +0 -44
- package/dist/collection/components/kup-card/built-in/kup-card-calendar.js +5 -61
- package/dist/collection/components/kup-card/built-in/kup-card-clock.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +7 -8
- package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table.js +5 -4
- package/dist/collection/components/kup-gauge/kup-gauge.js +4 -4
- package/dist/collection/components/kup-text-field/kup-text-field.js +4 -5
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +7 -7
- package/dist/collection/components/kup-tree/kup-tree.js +2 -2
- package/dist/collection/f-components/f-cell/f-cell.js +6 -5
- package/dist/collection/f-components/f-paginator/f-paginator-utils.js +3 -3
- package/dist/collection/managers/kup-data/kup-data.js +3 -1
- package/dist/collection/managers/kup-dates/kup-dates-declarations.js +21 -10
- package/dist/collection/managers/kup-dates/kup-dates.js +312 -1
- package/dist/collection/managers/kup-math/kup-math.js +180 -9
- package/dist/collection/utils/cell-utils.js +5 -6
- package/dist/collection/utils/filters/filters.js +11 -13
- package/dist/collection/utils/utils.js +18 -435
- package/dist/components/kup-autocomplete2.js +915 -810
- package/dist/components/kup-box2.js +1 -1
- package/dist/components/kup-calendar.js +1 -1
- package/dist/components/kup-cell.js +1 -1
- package/dist/components/kup-dashboard.js +1 -1
- package/dist/components/kup-echart2.js +1 -1
- package/dist/components/kup-family-tree.js +1 -1
- package/dist/components/kup-grid2.js +1 -1
- package/dist/components/kup-iframe.js +1 -1
- package/dist/components/kup-image-list.js +1 -1
- package/dist/components/kup-magic-box.js +1 -1
- package/dist/components/kup-numeric-picker.js +1 -1
- package/dist/components/kup-planner.js +1 -1
- package/dist/esm/{f-button-c377973d.js → f-button-024f0cfe.js} +1 -1
- package/dist/esm/{f-cell-e5a98bc8.js → f-cell-90240a8c.js} +10 -8
- package/dist/esm/{f-chip-c8a18c48.js → f-chip-2238ad43.js} +2 -2
- package/dist/esm/{f-image-5cbdf39d.js → f-image-f2e9bf79.js} +1 -1
- package/dist/esm/{f-paginator-utils-a1dab059.js → f-paginator-utils-8cb3c023.js} +63 -62
- package/dist/esm/{f-text-field-dafb7c8b.js → f-text-field-d231982c.js} +1 -1
- package/dist/esm/kup-accordion.entry.js +2 -2
- package/dist/esm/kup-autocomplete_27.entry.js +26 -81
- package/dist/esm/kup-box.entry.js +7 -7
- package/dist/esm/kup-calendar.entry.js +4 -4
- package/dist/esm/kup-cell.entry.js +5 -5
- package/dist/esm/kup-dash-list.entry.js +1 -1
- package/dist/esm/kup-dash_2.entry.js +1 -1
- package/dist/esm/kup-dashboard.entry.js +4 -4
- package/dist/esm/kup-drawer.entry.js +1 -1
- package/dist/esm/kup-echart.entry.js +1 -1
- package/dist/esm/kup-family-tree.entry.js +3 -3
- package/dist/esm/kup-iframe.entry.js +1 -1
- package/dist/esm/kup-image-list.entry.js +6 -6
- package/dist/esm/kup-lazy.entry.js +1 -1
- package/dist/esm/kup-magic-box.entry.js +2 -2
- package/dist/esm/{kup-manager-3594cde8.js → kup-manager-d1da769e.js} +679 -522
- package/dist/esm/kup-nav-bar.entry.js +1 -1
- package/dist/esm/kup-numeric-picker.entry.js +2 -2
- package/dist/esm/kup-photo-frame.entry.js +1 -1
- package/dist/esm/kup-planner.entry.js +2 -2
- package/dist/esm/kup-probe.entry.js +1 -1
- package/dist/esm/kup-qlik.entry.js +1 -1
- package/dist/esm/kup-snackbar.entry.js +3 -3
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-31abf4b6.entry.js → p-063d4c27.entry.js} +1 -1
- package/dist/ketchup/{p-9fc6a9a8.entry.js → p-0bcda0e2.entry.js} +1 -1
- package/dist/ketchup/{p-473d2bea.entry.js → p-0d7d59c7.entry.js} +1 -1
- package/dist/ketchup/{p-b718af72.entry.js → p-163b18b9.entry.js} +1 -1
- package/dist/ketchup/{p-37ada0f0.entry.js → p-1ad628fb.entry.js} +1 -1
- package/dist/ketchup/{p-5205286a.entry.js → p-33aff1ca.entry.js} +1 -1
- package/dist/ketchup/p-3432ebaf.entry.js +9 -0
- package/dist/ketchup/{p-80815edf.entry.js → p-35b29b22.entry.js} +1 -1
- package/dist/ketchup/{p-acaa171f.js → p-36dac88e.js} +3 -3
- package/dist/ketchup/{p-22e72f06.entry.js → p-37067ee6.entry.js} +1 -1
- package/dist/ketchup/p-39a55c47.js +1 -0
- package/dist/ketchup/{p-8b248655.js → p-3cf64473.js} +1 -1
- package/dist/ketchup/p-410c102a.js +1 -0
- package/dist/ketchup/{p-d76be079.entry.js → p-43b67de4.entry.js} +1 -1
- package/dist/ketchup/{p-ef0b4f19.entry.js → p-489d55ff.entry.js} +1 -1
- package/dist/ketchup/{p-2d32e3cd.js → p-5f3680f2.js} +1 -1
- package/dist/ketchup/{p-cf322853.entry.js → p-651d89c8.entry.js} +1 -1
- package/dist/ketchup/{p-4c56e199.entry.js → p-73c8d651.entry.js} +1 -1
- package/dist/ketchup/{p-d1164680.entry.js → p-83435e6c.entry.js} +1 -1
- package/dist/ketchup/{p-7f4f5f0f.entry.js → p-89743989.entry.js} +1 -1
- package/dist/ketchup/{p-6762d447.js → p-8b46e7ce.js} +1 -1
- package/dist/ketchup/p-a84f1d24.entry.js +1 -0
- package/dist/ketchup/{p-ed7e118e.entry.js → p-b2fd2dbf.entry.js} +1 -1
- package/dist/ketchup/{p-ce5b6ce7.entry.js → p-c42b80c1.entry.js} +1 -1
- package/dist/ketchup/p-d1b050d0.entry.js +27 -0
- package/dist/ketchup/{p-d4eb9a76.entry.js → p-d6ea709e.entry.js} +1 -1
- package/dist/ketchup/{p-7be5ef32.entry.js → p-e1f1e661.entry.js} +1 -1
- package/dist/ketchup/p-eda7f130.js +1 -0
- package/dist/ketchup/{p-afff7a6e.entry.js → p-f876125d.entry.js} +1 -1
- package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
- package/dist/types/managers/kup-dates/kup-dates-declarations.d.ts +19 -9
- package/dist/types/managers/kup-dates/kup-dates.d.ts +94 -1
- package/dist/types/managers/kup-math/kup-math.d.ts +68 -7
- package/dist/types/utils/utils.d.ts +13 -102
- package/package.json +1 -1
- package/dist/ketchup/p-017418e7.entry.js +0 -27
- package/dist/ketchup/p-38f16697.entry.js +0 -9
- package/dist/ketchup/p-4638fbff.js +0 -1
- package/dist/ketchup/p-61319cfa.js +0 -1
- package/dist/ketchup/p-6c726886.entry.js +0 -1
- package/dist/ketchup/p-bf4a881b.js +0 -1
|
@@ -346,7 +346,7 @@ var __classPrivateFieldGet$3 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
346
346
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
347
347
|
};
|
|
348
348
|
var _KupDebug_debugWidget;
|
|
349
|
-
const dom$
|
|
349
|
+
const dom$h = document.documentElement;
|
|
350
350
|
/**
|
|
351
351
|
* Debugging suite, used to log messages and statuses from the Ketchup components.
|
|
352
352
|
* @module KupDebug
|
|
@@ -393,32 +393,32 @@ class KupDebug {
|
|
|
393
393
|
*/
|
|
394
394
|
showWidget() {
|
|
395
395
|
const debugWidget = document.createElement('kup-card');
|
|
396
|
-
const languages = dom$
|
|
396
|
+
const languages = dom$h.ketchup.language.getLanguages();
|
|
397
397
|
const languagesListData = [];
|
|
398
398
|
for (let index = 0; index < languages.length; index++) {
|
|
399
399
|
languagesListData.push({
|
|
400
400
|
id: languages[index],
|
|
401
|
-
selected: languages[index] === dom$
|
|
401
|
+
selected: languages[index] === dom$h.ketchup.language.name
|
|
402
402
|
? true
|
|
403
403
|
: false,
|
|
404
404
|
value: languages[index],
|
|
405
405
|
});
|
|
406
406
|
}
|
|
407
|
-
const themes = dom$
|
|
407
|
+
const themes = dom$h.ketchup.theme.getThemes();
|
|
408
408
|
const themesListData = [];
|
|
409
409
|
for (let index = 0; index < themes.length; index++) {
|
|
410
410
|
themesListData.push({
|
|
411
411
|
id: themes[index],
|
|
412
|
-
selected: themes[index] === dom$
|
|
412
|
+
selected: themes[index] === dom$h.ketchup.theme.name ? true : false,
|
|
413
413
|
value: themes[index],
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
const locales = dom$
|
|
416
|
+
const locales = dom$h.ketchup.dates.getLocales();
|
|
417
417
|
const localesListData = [];
|
|
418
418
|
for (let index = 0; index < locales.length; index++) {
|
|
419
419
|
localesListData.push({
|
|
420
420
|
id: locales[index],
|
|
421
|
-
selected: locales[index] === dom$
|
|
421
|
+
selected: locales[index] === dom$h.ketchup.dates.locale ? true : false,
|
|
422
422
|
value: locales[index],
|
|
423
423
|
});
|
|
424
424
|
}
|
|
@@ -428,13 +428,13 @@ class KupDebug {
|
|
|
428
428
|
icon: 'power_settings_new',
|
|
429
429
|
id: 'kup-debug-off',
|
|
430
430
|
customStyle: ':host {--kup-font-size: 0.875em; border-left: 1px solid var(--kup-border-color); border-right: 1px solid var(--kup-border-color);}',
|
|
431
|
-
title: dom$
|
|
431
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.OFF),
|
|
432
432
|
},
|
|
433
433
|
{
|
|
434
434
|
customStyle: ':host {--kup-font-size: 0.875em;}',
|
|
435
435
|
icon: 'print',
|
|
436
436
|
id: 'kup-debug-print',
|
|
437
|
-
title: dom$
|
|
437
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.PRINT),
|
|
438
438
|
},
|
|
439
439
|
{
|
|
440
440
|
checked: this.autoPrint,
|
|
@@ -442,20 +442,20 @@ class KupDebug {
|
|
|
442
442
|
icon: 'speaker_notes',
|
|
443
443
|
iconOff: 'speaker_notes_off',
|
|
444
444
|
id: 'kup-debug-autoprint',
|
|
445
|
-
title: dom$
|
|
445
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.AUTOPRINT),
|
|
446
446
|
toggable: true,
|
|
447
447
|
},
|
|
448
448
|
{
|
|
449
449
|
customStyle: ':host {--kup-font-size: 0.875em;}',
|
|
450
450
|
icon: 'broom',
|
|
451
451
|
id: 'kup-debug-clear',
|
|
452
|
-
title: dom$
|
|
452
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.CLEAR),
|
|
453
453
|
},
|
|
454
454
|
{
|
|
455
455
|
customStyle: ':host {--kup-font-size: 0.875em;}',
|
|
456
456
|
icon: 'delete',
|
|
457
457
|
id: 'kup-debug-delete',
|
|
458
|
-
title: dom$
|
|
458
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.DUMP),
|
|
459
459
|
},
|
|
460
460
|
{
|
|
461
461
|
className: 'kup-full-height',
|
|
@@ -464,22 +464,22 @@ class KupDebug {
|
|
|
464
464
|
id: 'kup-debug-dl-props',
|
|
465
465
|
label: 'Props',
|
|
466
466
|
styling: 'flat',
|
|
467
|
-
title: dom$
|
|
467
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.DL_PROPS),
|
|
468
468
|
},
|
|
469
469
|
{
|
|
470
470
|
className: 'kup-full-height',
|
|
471
471
|
customStyle: ':host {border-right: 1px solid var(--kup-border-color);}',
|
|
472
472
|
icon: 'download',
|
|
473
473
|
id: 'kup-debug-dl-all',
|
|
474
|
-
label: dom$
|
|
474
|
+
label: dom$h.ketchup.language.translate(KupLanguageDebug.DL_ALL),
|
|
475
475
|
styling: 'flat',
|
|
476
|
-
title: dom$
|
|
476
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.DL_ALL),
|
|
477
477
|
},
|
|
478
478
|
{
|
|
479
479
|
customStyle: ':host {--kup-font-size: 0.875em;}',
|
|
480
480
|
icon: 'auto-fix',
|
|
481
481
|
id: 'kup-debug-magic-box',
|
|
482
|
-
title: dom$
|
|
482
|
+
title: dom$h.ketchup.language.translate(KupLanguageDebug.MAGIC_BOX),
|
|
483
483
|
},
|
|
484
484
|
],
|
|
485
485
|
combobox: [
|
|
@@ -494,11 +494,11 @@ class KupDebug {
|
|
|
494
494
|
className: 'kup-full-height',
|
|
495
495
|
emitSubmitEventOnEnter: false,
|
|
496
496
|
inputType: 'text',
|
|
497
|
-
label: dom$
|
|
497
|
+
label: dom$h.ketchup.language.translate(KupLanguageDebug.THEME_CHANGER),
|
|
498
498
|
},
|
|
499
499
|
},
|
|
500
500
|
id: 'kup-debug-theme-changer',
|
|
501
|
-
initialValue: dom$
|
|
501
|
+
initialValue: dom$h.ketchup.theme.name,
|
|
502
502
|
isSelect: true,
|
|
503
503
|
},
|
|
504
504
|
{
|
|
@@ -512,11 +512,11 @@ class KupDebug {
|
|
|
512
512
|
className: 'kup-full-height',
|
|
513
513
|
emitSubmitEventOnEnter: false,
|
|
514
514
|
inputType: 'text',
|
|
515
|
-
label: dom$
|
|
515
|
+
label: dom$h.ketchup.language.translate(KupLanguageDebug.LANGUAGE_CHANGER),
|
|
516
516
|
},
|
|
517
517
|
},
|
|
518
518
|
id: 'kup-debug-language-changer',
|
|
519
|
-
initialValue: dom$
|
|
519
|
+
initialValue: dom$h.ketchup.language.name,
|
|
520
520
|
isSelect: true,
|
|
521
521
|
},
|
|
522
522
|
{
|
|
@@ -530,11 +530,11 @@ class KupDebug {
|
|
|
530
530
|
className: 'kup-full-height',
|
|
531
531
|
emitSubmitEventOnEnter: false,
|
|
532
532
|
inputType: 'text',
|
|
533
|
-
label: dom$
|
|
533
|
+
label: dom$h.ketchup.language.translate(KupLanguageDebug.LOCALE_CHANGER),
|
|
534
534
|
},
|
|
535
535
|
},
|
|
536
536
|
id: 'kup-debug-locale-changer',
|
|
537
|
-
initialValue: dom$
|
|
537
|
+
initialValue: dom$h.ketchup.dates.locale,
|
|
538
538
|
isSelect: true,
|
|
539
539
|
},
|
|
540
540
|
],
|
|
@@ -542,7 +542,7 @@ class KupDebug {
|
|
|
542
542
|
{
|
|
543
543
|
className: 'kup-full-height',
|
|
544
544
|
id: 'kup-debug-log-limit',
|
|
545
|
-
label: dom$
|
|
545
|
+
label: dom$h.ketchup.language.translate(KupLanguageDebug.LOG_LIMIT),
|
|
546
546
|
initialValue: this.logLimit,
|
|
547
547
|
emitSubmitEventOnEnter: false,
|
|
548
548
|
inputType: 'number',
|
|
@@ -593,7 +593,7 @@ class KupDebug {
|
|
|
593
593
|
kupDebug.dump();
|
|
594
594
|
break;
|
|
595
595
|
case 'kup-debug-magic-box':
|
|
596
|
-
dom$
|
|
596
|
+
dom$h.ketchup.toggleMagicBox();
|
|
597
597
|
break;
|
|
598
598
|
case 'kup-debug-off':
|
|
599
599
|
kupDebug.toggle();
|
|
@@ -608,14 +608,14 @@ class KupDebug {
|
|
|
608
608
|
case 'kup-combobox-itemclick':
|
|
609
609
|
switch (compID) {
|
|
610
610
|
case 'kup-debug-language-changer':
|
|
611
|
-
dom$
|
|
611
|
+
dom$h.ketchup.language.set(compEvent.detail.value);
|
|
612
612
|
break;
|
|
613
613
|
case 'kup-debug-locale-changer':
|
|
614
|
-
dom$
|
|
615
|
-
dom$
|
|
614
|
+
dom$h.ketchup.dates.setLocale(compEvent.detail.value);
|
|
615
|
+
dom$h.ketchup.math.setLocale(compEvent.detail.value);
|
|
616
616
|
break;
|
|
617
617
|
case 'kup-debug-theme-changer':
|
|
618
|
-
dom$
|
|
618
|
+
dom$h.ketchup.theme.set(compEvent.detail.value);
|
|
619
619
|
break;
|
|
620
620
|
}
|
|
621
621
|
case 'kup-textfield-input':
|
|
@@ -677,7 +677,7 @@ class KupDebug {
|
|
|
677
677
|
// If the log is tied to a KupComponent, on click its props will be downloaded.
|
|
678
678
|
// Also, a different style will be applied to distinguish it between the others.
|
|
679
679
|
if (typeof this.logs[index].element == 'object') {
|
|
680
|
-
slot.title = dom$
|
|
680
|
+
slot.title = dom$h.ketchup.language.translate(KupLanguageDebug.DL_PROPS_COMP);
|
|
681
681
|
slot.style.fontWeight = 'bold';
|
|
682
682
|
slot.style.cursor = 'pointer';
|
|
683
683
|
slot.onclick = () => {
|
|
@@ -735,7 +735,7 @@ class KupDebug {
|
|
|
735
735
|
printLog[type] = [];
|
|
736
736
|
}
|
|
737
737
|
printLog[type].push({
|
|
738
|
-
date: dom$
|
|
738
|
+
date: dom$h.ketchup.dates.format(this.logs[index].date, 'LLL:ms'),
|
|
739
739
|
element: isComponent
|
|
740
740
|
? this.logs[index].element
|
|
741
741
|
: this.logs[index].id,
|
|
@@ -915,7 +915,7 @@ class KupDebug {
|
|
|
915
915
|
message: message,
|
|
916
916
|
};
|
|
917
917
|
if (this.logs.length > this.logLimit) {
|
|
918
|
-
console.warn(dom$
|
|
918
|
+
console.warn(dom$h.ketchup.dates.format(date, 'LLL:ms') +
|
|
919
919
|
' kup-debug => ' +
|
|
920
920
|
'Too many logs (> ' +
|
|
921
921
|
this.logLimit +
|
|
@@ -931,14 +931,14 @@ class KupDebug {
|
|
|
931
931
|
}
|
|
932
932
|
switch (category) {
|
|
933
933
|
case exports.KupDebugCategory.ERROR:
|
|
934
|
-
console.error(dom$
|
|
934
|
+
console.error(dom$h.ketchup.dates.format(date, 'LLL:ms') + id + message, obj);
|
|
935
935
|
window.dispatchEvent(new CustomEvent('kup-debug-error', {
|
|
936
936
|
bubbles: true,
|
|
937
937
|
detail: { comp, date, message },
|
|
938
938
|
}));
|
|
939
939
|
break;
|
|
940
940
|
case exports.KupDebugCategory.WARNING:
|
|
941
|
-
console.warn(dom$
|
|
941
|
+
console.warn(dom$h.ketchup.dates.format(date, 'LLL:ms') + id + message, obj);
|
|
942
942
|
break;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
@@ -1025,7 +1025,7 @@ exports.KupDynamicPositionPlacement = void 0;
|
|
|
1025
1025
|
KupDynamicPositionPlacement["TOP_RIGHT"] = "tr";
|
|
1026
1026
|
})(exports.KupDynamicPositionPlacement || (exports.KupDynamicPositionPlacement = {}));
|
|
1027
1027
|
|
|
1028
|
-
const dom$
|
|
1028
|
+
const dom$g = document.documentElement;
|
|
1029
1029
|
/**
|
|
1030
1030
|
* This class is used to dynamically reposition HTML elements.
|
|
1031
1031
|
* @module KupDynamicPosition
|
|
@@ -1093,7 +1093,7 @@ class KupDynamicPosition {
|
|
|
1093
1093
|
const target = mutations[0].target;
|
|
1094
1094
|
if (target.classList.contains(kupDynamicPositionActiveClass)) {
|
|
1095
1095
|
requestAnimationFrame(function () {
|
|
1096
|
-
dom$
|
|
1096
|
+
dom$g.ketchup.dynamicPosition.run(el);
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
});
|
|
@@ -1150,7 +1150,7 @@ class KupDynamicPosition {
|
|
|
1150
1150
|
*/
|
|
1151
1151
|
run(el) {
|
|
1152
1152
|
if (!el.isConnected) {
|
|
1153
|
-
dom$
|
|
1153
|
+
dom$g.ketchup.dynamicPosition.managedElements.delete(el);
|
|
1154
1154
|
cancelAnimationFrame(el.kupDynamicPosition.rAF);
|
|
1155
1155
|
return;
|
|
1156
1156
|
}
|
|
@@ -1258,7 +1258,7 @@ class KupDynamicPosition {
|
|
|
1258
1258
|
// Recursive
|
|
1259
1259
|
if (!el.kupDynamicPosition.detach) {
|
|
1260
1260
|
el.kupDynamicPosition.rAF = requestAnimationFrame(function () {
|
|
1261
|
-
dom$
|
|
1261
|
+
dom$g.ketchup.dynamicPosition.run(el);
|
|
1262
1262
|
});
|
|
1263
1263
|
}
|
|
1264
1264
|
else {
|
|
@@ -1346,7 +1346,7 @@ exports.KupDropEventTypes = void 0;
|
|
|
1346
1346
|
KupDropEventTypes["MAGICBOX"] = "text/kup-magic-box-drag";
|
|
1347
1347
|
})(exports.KupDropEventTypes || (exports.KupDropEventTypes = {}));
|
|
1348
1348
|
|
|
1349
|
-
const dom$
|
|
1349
|
+
const dom$f = document.documentElement;
|
|
1350
1350
|
/**
|
|
1351
1351
|
* This class handles elements as dialogs, making them resizable and movable.
|
|
1352
1352
|
* @module KupInteract
|
|
@@ -1460,7 +1460,7 @@ class KupInteract {
|
|
|
1460
1460
|
ghostImage.style.transition = 'none';
|
|
1461
1461
|
ghostImage.style.zIndex =
|
|
1462
1462
|
'calc(var(--kup-navbar-zindex) + 1)';
|
|
1463
|
-
dom$
|
|
1463
|
+
dom$f.ketchup.interact.container.appendChild(ghostImage);
|
|
1464
1464
|
draggable.kupDragDrop.ghostImage = ghostImage;
|
|
1465
1465
|
break;
|
|
1466
1466
|
case exports.KupDragEffect.CLONE:
|
|
@@ -1621,7 +1621,7 @@ class KupInteract {
|
|
|
1621
1621
|
x += e.deltaRect.left;
|
|
1622
1622
|
y += e.deltaRect.top;
|
|
1623
1623
|
el.style.transform = 'translate(' + x + 'px,' + y + 'px)';
|
|
1624
|
-
if (dom$
|
|
1624
|
+
if (dom$f.ketchup.interact.isInViewport(el, oldTransform, e.delta)) {
|
|
1625
1625
|
el.setAttribute('data-x', x.toString());
|
|
1626
1626
|
el.setAttribute('data-y', y.toString());
|
|
1627
1627
|
}
|
|
@@ -1673,7 +1673,7 @@ class KupInteract {
|
|
|
1673
1673
|
const callbacks = {
|
|
1674
1674
|
start(e) {
|
|
1675
1675
|
const el = e.currentTarget;
|
|
1676
|
-
el.style.zIndex = (dom$
|
|
1676
|
+
el.style.zIndex = (dom$f.ketchup.interact.zIndex++).toString();
|
|
1677
1677
|
},
|
|
1678
1678
|
};
|
|
1679
1679
|
this.draggable(el, {
|
|
@@ -1682,7 +1682,7 @@ class KupInteract {
|
|
|
1682
1682
|
interact.modifiers.restrictRect({
|
|
1683
1683
|
restriction: restrictContainer
|
|
1684
1684
|
? restrictContainer
|
|
1685
|
-
: dom$
|
|
1685
|
+
: dom$f.ketchup.interact.restrictContainer,
|
|
1686
1686
|
endOnly: true,
|
|
1687
1687
|
}),
|
|
1688
1688
|
],
|
|
@@ -2634,7 +2634,7 @@ const languages = {
|
|
|
2634
2634
|
spanish: spanish
|
|
2635
2635
|
};
|
|
2636
2636
|
|
|
2637
|
-
const dom$
|
|
2637
|
+
const dom$e = document.documentElement;
|
|
2638
2638
|
/**
|
|
2639
2639
|
* Handles the translation to different languages.
|
|
2640
2640
|
* @module KupLanguage
|
|
@@ -2688,7 +2688,7 @@ class KupLanguage {
|
|
|
2688
2688
|
return invalidKey(key);
|
|
2689
2689
|
}
|
|
2690
2690
|
function invalidKey(key) {
|
|
2691
|
-
dom$
|
|
2691
|
+
dom$e.ketchup.debug.logMessage('kup-language', 'Invalid translation for key (' + key + ')!', exports.KupDebugCategory.WARNING);
|
|
2692
2692
|
return key;
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
@@ -2701,7 +2701,7 @@ class KupLanguage {
|
|
|
2701
2701
|
language = language.toLowerCase();
|
|
2702
2702
|
}
|
|
2703
2703
|
else {
|
|
2704
|
-
dom$
|
|
2704
|
+
dom$e.ketchup.debug.logMessage('kup-language', "Couldn't set language, invalid string received (" +
|
|
2705
2705
|
language +
|
|
2706
2706
|
')!', exports.KupDebugCategory.WARNING);
|
|
2707
2707
|
return;
|
|
@@ -2711,12 +2711,12 @@ class KupLanguage {
|
|
|
2711
2711
|
const dVariant = decodedLanguage.variant;
|
|
2712
2712
|
if (this.list[dLanguage]) {
|
|
2713
2713
|
if (dVariant && !this.list[dLanguage].variants[dVariant]) {
|
|
2714
|
-
dom$
|
|
2714
|
+
dom$e.ketchup.debug.logMessage('kup-language', 'Variant not found (' + dVariant + ')!', exports.KupDebugCategory.WARNING);
|
|
2715
2715
|
return;
|
|
2716
2716
|
}
|
|
2717
2717
|
}
|
|
2718
2718
|
else {
|
|
2719
|
-
dom$
|
|
2719
|
+
dom$e.ketchup.debug.logMessage('kup-language', 'Language not found (' + dLanguage + ')!', exports.KupDebugCategory.WARNING);
|
|
2720
2720
|
return;
|
|
2721
2721
|
}
|
|
2722
2722
|
this.name = language;
|
|
@@ -2803,7 +2803,7 @@ const obj = {
|
|
|
2803
2803
|
types: types
|
|
2804
2804
|
};
|
|
2805
2805
|
|
|
2806
|
-
const dom$
|
|
2806
|
+
const dom$d = document.documentElement;
|
|
2807
2807
|
/**
|
|
2808
2808
|
* Handles objects definition and validation.
|
|
2809
2809
|
* @module KupObjects
|
|
@@ -3138,9 +3138,9 @@ class KupObjects {
|
|
|
3138
3138
|
*/
|
|
3139
3139
|
parseDate(obj) {
|
|
3140
3140
|
if (obj.t === 'D8' && obj.p === '*DMYY') {
|
|
3141
|
-
return dom$
|
|
3141
|
+
return dom$d.ketchup.dates.toDayjs(obj.k, 'DDMMYYYY');
|
|
3142
3142
|
}
|
|
3143
|
-
return dom$
|
|
3143
|
+
return dom$d.ketchup.dates.toDayjs(obj.k);
|
|
3144
3144
|
}
|
|
3145
3145
|
/**
|
|
3146
3146
|
* Check whether two JS objects are deeply equal. When the arguments aren't objects, they are tested directly for equity.
|
|
@@ -3213,7 +3213,7 @@ var __classPrivateFieldGet$2 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
3213
3213
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3214
3214
|
};
|
|
3215
3215
|
var _KupScrollOnHover_instances, _KupScrollOnHover_arrowsContainer, _KupScrollOnHover_leftArrows, _KupScrollOnHover_rightArrows, _KupScrollOnHover_scrollEvent, _KupScrollOnHover_mousemoveEvent, _KupScrollOnHover_mouseleaveEvent, _KupScrollOnHover_rAF, _KupScrollOnHover_timeout, _KupScrollOnHover_initArrows;
|
|
3216
|
-
const dom$
|
|
3216
|
+
const dom$c = document.documentElement;
|
|
3217
3217
|
/**
|
|
3218
3218
|
* Lets the user scroll an element's overflow by hovering with the mouse on its left/right edge.
|
|
3219
3219
|
* @module KupScrollOnHover
|
|
@@ -3342,7 +3342,7 @@ class KupScrollOnHover {
|
|
|
3342
3342
|
__classPrivateFieldSet$2(this, _KupScrollOnHover_timeout, setTimeout(() => {
|
|
3343
3343
|
el.scrollOnHover.active = true;
|
|
3344
3344
|
__classPrivateFieldSet$2(this, _KupScrollOnHover_rAF, requestAnimationFrame(function () {
|
|
3345
|
-
dom$
|
|
3345
|
+
dom$c.ketchup.scrollOnHover.run(el, maxScrollLeft, percRight, percLeft, direction);
|
|
3346
3346
|
}), "f");
|
|
3347
3347
|
}, this.delay), "f");
|
|
3348
3348
|
}
|
|
@@ -3364,7 +3364,7 @@ class KupScrollOnHover {
|
|
|
3364
3364
|
__classPrivateFieldSet$2(this, _KupScrollOnHover_timeout, setTimeout(() => {
|
|
3365
3365
|
el.scrollOnHover.active = true;
|
|
3366
3366
|
__classPrivateFieldSet$2(this, _KupScrollOnHover_rAF, requestAnimationFrame(function () {
|
|
3367
|
-
dom$
|
|
3367
|
+
dom$c.ketchup.scrollOnHover.run(el, maxScrollTop, percBottom, percTop, direction);
|
|
3368
3368
|
}), "f");
|
|
3369
3369
|
}, this.delay), "f");
|
|
3370
3370
|
}
|
|
@@ -3495,7 +3495,7 @@ class KupScrollOnHover {
|
|
|
3495
3495
|
arrow[i].classList.add('kup-animated');
|
|
3496
3496
|
}
|
|
3497
3497
|
__classPrivateFieldSet$2(this, _KupScrollOnHover_rAF, requestAnimationFrame(function () {
|
|
3498
|
-
dom$
|
|
3498
|
+
dom$c.ketchup.scrollOnHover.run(el, maxScrollLeft, percForward, percBack, direction);
|
|
3499
3499
|
}), "f");
|
|
3500
3500
|
}
|
|
3501
3501
|
/**
|
|
@@ -4733,7 +4733,7 @@ exports.KupThemeIconValues = void 0;
|
|
|
4733
4733
|
KupThemeIconValues["SEARCH"] = "--kup-search-icon";
|
|
4734
4734
|
})(exports.KupThemeIconValues || (exports.KupThemeIconValues = {}));
|
|
4735
4735
|
|
|
4736
|
-
const dom$
|
|
4736
|
+
const dom$b = document.documentElement;
|
|
4737
4737
|
/**
|
|
4738
4738
|
* Theme manager, handles everything about theming, customStyles and color utilities.
|
|
4739
4739
|
* @module KupTheme
|
|
@@ -4747,7 +4747,7 @@ class KupTheme {
|
|
|
4747
4747
|
this.list = list ? list : themes;
|
|
4748
4748
|
this.managedComponents = new Set();
|
|
4749
4749
|
this.name = name ? name : 'ketchup';
|
|
4750
|
-
this.styleTag = dom$
|
|
4750
|
+
this.styleTag = dom$b
|
|
4751
4751
|
.querySelector('head')
|
|
4752
4752
|
.appendChild(document.createElement('style'));
|
|
4753
4753
|
}
|
|
@@ -4834,9 +4834,9 @@ class KupTheme {
|
|
|
4834
4834
|
if (list) {
|
|
4835
4835
|
this.list = list;
|
|
4836
4836
|
}
|
|
4837
|
-
dom$
|
|
4837
|
+
dom$b.ketchup.debug.logMessage('theme manager', 'Setting theme to: ' + this.name + '.');
|
|
4838
4838
|
if (!this.list[this.name]) {
|
|
4839
|
-
dom$
|
|
4839
|
+
dom$b.ketchup.debug.logMessage('theme manager', 'Invalid theme name, falling back to default ("ketchup").');
|
|
4840
4840
|
this.name = 'ketchup';
|
|
4841
4841
|
}
|
|
4842
4842
|
this.cssVars = {};
|
|
@@ -4879,11 +4879,11 @@ class KupTheme {
|
|
|
4879
4879
|
this.icons() +
|
|
4880
4880
|
'}';
|
|
4881
4881
|
this.customStyle();
|
|
4882
|
-
dom$
|
|
4882
|
+
dom$b.ketchup.debug.logMessage('kup-theme', 'Theme ' + dom$b.getAttribute('kup-theme') + ' refreshed.');
|
|
4883
4883
|
document.dispatchEvent(new CustomEvent('kup-theme-refresh'));
|
|
4884
4884
|
}
|
|
4885
4885
|
catch (error) {
|
|
4886
|
-
dom$
|
|
4886
|
+
dom$b.ketchup.debug.logMessage('kup-theme', 'Theme not refreshed.', exports.KupDebugCategory.WARNING);
|
|
4887
4887
|
}
|
|
4888
4888
|
}
|
|
4889
4889
|
/**
|
|
@@ -5002,7 +5002,7 @@ class KupTheme {
|
|
|
5002
5002
|
this.set(themes[index]);
|
|
5003
5003
|
}
|
|
5004
5004
|
else {
|
|
5005
|
-
dom$
|
|
5005
|
+
dom$b.ketchup.debug.logMessage('kup-theme', "Couldn't set a random theme: no themes available!", exports.KupDebugCategory.WARNING);
|
|
5006
5006
|
}
|
|
5007
5007
|
}
|
|
5008
5008
|
/**
|
|
@@ -5014,7 +5014,7 @@ class KupTheme {
|
|
|
5014
5014
|
//Testing whether the color is transparent, if it is a fall back value will be returned matching the background-color
|
|
5015
5015
|
if (color === 'transparent') {
|
|
5016
5016
|
color = this.cssVars['--kup-background-color'];
|
|
5017
|
-
dom$
|
|
5017
|
+
dom$b.ketchup.debug.logMessage('theme manager', 'Received TRANSPARENT color, converted to ' +
|
|
5018
5018
|
color +
|
|
5019
5019
|
' (theme background).');
|
|
5020
5020
|
}
|
|
@@ -5032,7 +5032,7 @@ class KupTheme {
|
|
|
5032
5032
|
const oldColor = color;
|
|
5033
5033
|
color = this.codeToHex(color);
|
|
5034
5034
|
isHex = color.substring(0, 1) === '#' ? true : false;
|
|
5035
|
-
dom$
|
|
5035
|
+
dom$b.ketchup.debug.logMessage('theme manager', 'Received CODE NAME color ' +
|
|
5036
5036
|
oldColor +
|
|
5037
5037
|
', converted to ' +
|
|
5038
5038
|
color +
|
|
@@ -5086,14 +5086,14 @@ class KupTheme {
|
|
|
5086
5086
|
else {
|
|
5087
5087
|
hexColor = this.rgbToHex(rgbColorObj.r, rgbColorObj.g, rgbColorObj.b);
|
|
5088
5088
|
}
|
|
5089
|
-
dom$
|
|
5089
|
+
dom$b.ketchup.debug.logMessage('theme-manager', 'Received HEX color ' +
|
|
5090
5090
|
oldColor +
|
|
5091
5091
|
', converted to ' +
|
|
5092
5092
|
color +
|
|
5093
5093
|
'.');
|
|
5094
5094
|
}
|
|
5095
5095
|
catch (error) {
|
|
5096
|
-
dom$
|
|
5096
|
+
dom$b.ketchup.debug.logMessage('theme-manager', 'Invalid color: ' + color + '.');
|
|
5097
5097
|
}
|
|
5098
5098
|
}
|
|
5099
5099
|
let rgbValues = null;
|
|
@@ -5103,14 +5103,14 @@ class KupTheme {
|
|
|
5103
5103
|
rgbColor = color;
|
|
5104
5104
|
}
|
|
5105
5105
|
catch (error) {
|
|
5106
|
-
dom$
|
|
5106
|
+
dom$b.ketchup.debug.logMessage('theme-manager', 'Color not converted to rgb values: ' + color + '.');
|
|
5107
5107
|
}
|
|
5108
5108
|
if (!hexColor) {
|
|
5109
5109
|
try {
|
|
5110
5110
|
hexColor = this.rgbToHex(parseInt(values[1]), parseInt(values[2]), parseInt(values[3]));
|
|
5111
5111
|
}
|
|
5112
5112
|
catch (error) {
|
|
5113
|
-
dom$
|
|
5113
|
+
dom$b.ketchup.debug.logMessage('theme-manager', 'Color not converted to hex value: ' + color + '.');
|
|
5114
5114
|
}
|
|
5115
5115
|
}
|
|
5116
5116
|
if (!hslColor || !hslValues) {
|
|
@@ -5123,7 +5123,7 @@ class KupTheme {
|
|
|
5123
5123
|
hslColor = 'hsl(' + hsl.h + ',' + hsl.s + '%,' + hsl.l + '%)';
|
|
5124
5124
|
}
|
|
5125
5125
|
catch (error) {
|
|
5126
|
-
dom$
|
|
5126
|
+
dom$b.ketchup.debug.logMessage('theme-manager', 'Color not converted to hex value: ' + color + '.');
|
|
5127
5127
|
}
|
|
5128
5128
|
}
|
|
5129
5129
|
return {
|
|
@@ -5428,7 +5428,7 @@ class KupTheme {
|
|
|
5428
5428
|
return colorCodes[color.toLowerCase()];
|
|
5429
5429
|
}
|
|
5430
5430
|
else {
|
|
5431
|
-
dom$
|
|
5431
|
+
dom$b.ketchup.debug.logMessage('theme manager', 'Could not decode color ' + color + '!');
|
|
5432
5432
|
return color;
|
|
5433
5433
|
}
|
|
5434
5434
|
}
|
|
@@ -5456,7 +5456,7 @@ var __classPrivateFieldGet$1 = (undefined && undefined.__classPrivateFieldGet) |
|
|
|
5456
5456
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5457
5457
|
};
|
|
5458
5458
|
var _KupToolbar_keyEvent;
|
|
5459
|
-
const dom$
|
|
5459
|
+
const dom$a = document.documentElement;
|
|
5460
5460
|
/**
|
|
5461
5461
|
* Handles component's toolbar.
|
|
5462
5462
|
* @module KupToolbar
|
|
@@ -5474,7 +5474,7 @@ class KupToolbar {
|
|
|
5474
5474
|
KupToolbarModifierKeys.CTRL,
|
|
5475
5475
|
];
|
|
5476
5476
|
__classPrivateFieldSet$1(this, _KupToolbar_keyEvent, function (e) {
|
|
5477
|
-
const toolbar = dom$
|
|
5477
|
+
const toolbar = dom$a.ketchup.toolbar;
|
|
5478
5478
|
if (toolbar.managedElements) {
|
|
5479
5479
|
for (let index = 0; index < toolbar.modifiers.length; index++) {
|
|
5480
5480
|
if (toolbar.modifiers[index] ===
|
|
@@ -5981,16 +5981,6 @@ exports.KupDatesNormalize = void 0;
|
|
|
5981
5981
|
KupDatesNormalize["TIME"] = "time";
|
|
5982
5982
|
KupDatesNormalize["TIMESTAMP"] = "timestamp";
|
|
5983
5983
|
})(exports.KupDatesNormalize || (exports.KupDatesNormalize = {}));
|
|
5984
|
-
/**
|
|
5985
|
-
* Common use formats
|
|
5986
|
-
*/
|
|
5987
|
-
exports.KupDatesFormats = void 0;
|
|
5988
|
-
(function (KupDatesFormats) {
|
|
5989
|
-
KupDatesFormats["ISO_DATE"] = "YYYY-MM-DD";
|
|
5990
|
-
KupDatesFormats["ISO_DATE_TIME"] = "YYYY-MM-DD HH:mm:ss";
|
|
5991
|
-
KupDatesFormats["ISO_TIME"] = "HH:mm:ss";
|
|
5992
|
-
KupDatesFormats["ISO_TIME_WITHOUT_SECONDS"] = "HH:mm";
|
|
5993
|
-
})(exports.KupDatesFormats || (exports.KupDatesFormats = {}));
|
|
5994
5984
|
/**
|
|
5995
5985
|
* Supported locales.
|
|
5996
5986
|
*/
|
|
@@ -6003,423 +5993,28 @@ exports.KupDatesLocales = void 0;
|
|
|
6003
5993
|
KupDatesLocales["POLISH"] = "pl";
|
|
6004
5994
|
KupDatesLocales["RUSSIAN"] = "ru";
|
|
6005
5995
|
KupDatesLocales["SPANISH"] = "es";
|
|
6006
|
-
})(exports.KupDatesLocales || (exports.KupDatesLocales = {}));
|
|
6007
|
-
|
|
6008
|
-
const dom$a = document.documentElement;
|
|
6009
|
-
exports.DateTimeFormatOptionsMonth = void 0;
|
|
6010
|
-
(function (DateTimeFormatOptionsMonth) {
|
|
6011
|
-
DateTimeFormatOptionsMonth["NUMERIC"] = "numeric";
|
|
6012
|
-
DateTimeFormatOptionsMonth["DIGIT2"] = "2-digit";
|
|
6013
|
-
DateTimeFormatOptionsMonth["LONG"] = "long";
|
|
6014
|
-
DateTimeFormatOptionsMonth["SHORT"] = "short";
|
|
6015
|
-
DateTimeFormatOptionsMonth["NARROW"] = "narrow";
|
|
6016
|
-
})(exports.DateTimeFormatOptionsMonth || (exports.DateTimeFormatOptionsMonth = {}));
|
|
6017
|
-
function identify(array) {
|
|
6018
|
-
if (array) {
|
|
6019
|
-
for (let i = 0; i < array.length; i++) {
|
|
6020
|
-
array[i].id = i.toString();
|
|
6021
|
-
}
|
|
6022
|
-
}
|
|
6023
|
-
}
|
|
6024
|
-
function getCurrentTimeFormatFromBrowserLocale(manageSeconds) {
|
|
6025
|
-
const options = {
|
|
6026
|
-
hour: '2-digit',
|
|
6027
|
-
minute: '2-digit',
|
|
6028
|
-
hour12: false,
|
|
6029
|
-
};
|
|
6030
|
-
if (manageSeconds == true) {
|
|
6031
|
-
options.second = '2-digit';
|
|
6032
|
-
}
|
|
6033
|
-
const formatObj = new Intl.DateTimeFormat(dom$a.ketchup.dates.getLocale() + '-u-hc-h23', options).formatToParts(new Date());
|
|
6034
|
-
let timeFormat = formatObj
|
|
6035
|
-
.map((obj) => {
|
|
6036
|
-
switch (obj.type) {
|
|
6037
|
-
case 'hour':
|
|
6038
|
-
return 'HH';
|
|
6039
|
-
case 'minute':
|
|
6040
|
-
return 'mm';
|
|
6041
|
-
case 'second':
|
|
6042
|
-
return 'ss';
|
|
6043
|
-
default:
|
|
6044
|
-
return obj.value;
|
|
6045
|
-
}
|
|
6046
|
-
})
|
|
6047
|
-
.join('');
|
|
6048
|
-
return timeFormat;
|
|
6049
|
-
}
|
|
6050
|
-
/**
|
|
6051
|
-
* @param value number as string, formatted by actual browser locale
|
|
6052
|
-
* @param type - type of number for calculate suffix
|
|
6053
|
-
* @returns true if number string in input is a valid number
|
|
6054
|
-
*/
|
|
6055
|
-
function isValidFormattedStringNumber(value, type) {
|
|
6056
|
-
if (value == null || value.trim() == '') {
|
|
6057
|
-
return false;
|
|
6058
|
-
}
|
|
6059
|
-
let tmpStr = formattedStringToUnformattedStringNumber(value, type);
|
|
6060
|
-
if (isNumber(tmpStr)) {
|
|
6061
|
-
return true;
|
|
6062
|
-
}
|
|
6063
|
-
return false;
|
|
6064
|
-
}
|
|
6065
|
-
function isNumber(value) {
|
|
6066
|
-
//return typeof value === 'number';
|
|
6067
|
-
return !isNaN(value);
|
|
6068
|
-
}
|
|
6069
|
-
/**
|
|
6070
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
6071
|
-
* @returns number
|
|
6072
|
-
**/
|
|
6073
|
-
function stringToNumber(input) {
|
|
6074
|
-
if (!input || input == null || input.trim() == '') {
|
|
6075
|
-
input = '0';
|
|
6076
|
-
}
|
|
6077
|
-
return dom$a.ketchup.math.numberify(input);
|
|
6078
|
-
}
|
|
6079
|
-
/**
|
|
6080
|
-
* @param input number
|
|
6081
|
-
* @param decimals number of significant decimal digits for output
|
|
6082
|
-
* @returns number as string, formatted by actual browser locale
|
|
6083
|
-
**/
|
|
6084
|
-
function numberToString(input, decimals) {
|
|
6085
|
-
if (input == null) {
|
|
6086
|
-
return '';
|
|
6087
|
-
}
|
|
6088
|
-
return _numberToString(input, decimals, dom$a.ketchup.dates.getLocale(), true);
|
|
6089
|
-
}
|
|
6090
|
-
/**
|
|
6091
|
-
* @param type - type of number for calculate suffix
|
|
6092
|
-
* @returns suffix for number, by type
|
|
6093
|
-
**/
|
|
6094
|
-
function getNumericValueSuffixByType(type) {
|
|
6095
|
-
type = type.toUpperCase();
|
|
6096
|
-
let nstr = '';
|
|
6097
|
-
if (type == 'P') {
|
|
6098
|
-
nstr = ' %';
|
|
6099
|
-
}
|
|
6100
|
-
else if (type == 'VE') {
|
|
6101
|
-
nstr = ' €';
|
|
6102
|
-
}
|
|
6103
|
-
else if (type == 'VL') {
|
|
6104
|
-
nstr = ' £';
|
|
6105
|
-
}
|
|
6106
|
-
else if (type == 'VV') {
|
|
6107
|
-
nstr = ' $';
|
|
6108
|
-
}
|
|
6109
|
-
return nstr;
|
|
6110
|
-
}
|
|
6111
|
-
/**
|
|
6112
|
-
* @param input number
|
|
6113
|
-
* @param decimals number of significant decimal digits for output
|
|
6114
|
-
* @param type - type of number for calculate suffix
|
|
6115
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
6116
|
-
**/
|
|
6117
|
-
function numberToFormattedStringNumber(input, decimals, type) {
|
|
6118
|
-
if (input == null || isNaN(input)) {
|
|
6119
|
-
return '';
|
|
6120
|
-
}
|
|
6121
|
-
let nstr = numberToString(input, decimals);
|
|
6122
|
-
nstr = nstr + getNumericValueSuffixByType(type);
|
|
6123
|
-
return nstr;
|
|
6124
|
-
}
|
|
6125
|
-
/**
|
|
6126
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
6127
|
-
* @param decimals number of significant decimal digits for output
|
|
6128
|
-
* @param type - type of number for calculate suffix
|
|
6129
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
6130
|
-
**/
|
|
6131
|
-
function unformattedStringToFormattedStringNumber(input, decimals, type) {
|
|
6132
|
-
return numberToFormattedStringNumber(stringToNumber(input), decimals, type);
|
|
6133
|
-
}
|
|
6134
|
-
/**
|
|
6135
|
-
* @param input number as string, formatted by actual browser locale
|
|
6136
|
-
* @param type - type of number for calculate suffix
|
|
6137
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
6138
|
-
**/
|
|
6139
|
-
function formattedStringToUnformattedStringNumber(input, type) {
|
|
6140
|
-
return numberStringToNumberString(input, type, dom$a.ketchup.math.decimalSeparator());
|
|
6141
|
-
}
|
|
6142
|
-
/**
|
|
6143
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers), with group separator
|
|
6144
|
-
* @param type - type of number for calculate suffix
|
|
6145
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
6146
|
-
**/
|
|
6147
|
-
function unformattedStringNumberToNumber(input, type) {
|
|
6148
|
-
return numberStringToNumberString(input, type, '.');
|
|
6149
|
-
}
|
|
6150
|
-
function numberStringToNumberString(input, type, decFmt) {
|
|
6151
|
-
if (input == null || input.trim() == '') {
|
|
6152
|
-
return '';
|
|
6153
|
-
}
|
|
6154
|
-
let originalInputValue = input;
|
|
6155
|
-
let suffix = getNumericValueSuffixByType(type);
|
|
6156
|
-
if (suffix != '') {
|
|
6157
|
-
input = input.replace(suffix, '');
|
|
6158
|
-
}
|
|
6159
|
-
let regExpr = null;
|
|
6160
|
-
if (decFmt == '.') {
|
|
6161
|
-
regExpr = /,/g;
|
|
6162
|
-
}
|
|
6163
|
-
else {
|
|
6164
|
-
regExpr = /\./g;
|
|
6165
|
-
}
|
|
6166
|
-
input = input.replace(regExpr, '');
|
|
6167
|
-
if (decFmt != '.') {
|
|
6168
|
-
input = input.replace(/,/g, '.');
|
|
6169
|
-
}
|
|
6170
|
-
if (dom$a.ketchup.math.numberify(input) == null ||
|
|
6171
|
-
isNaN(dom$a.ketchup.math.numberify(input))) {
|
|
6172
|
-
return originalInputValue;
|
|
6173
|
-
}
|
|
6174
|
-
let unf = stringToNumber(input);
|
|
6175
|
-
return _numberToString(unf, -1, 'en-US', false);
|
|
6176
|
-
}
|
|
6177
|
-
function countDecimals(value) {
|
|
6178
|
-
if (Math.floor(value) === value)
|
|
6179
|
-
return 0;
|
|
6180
|
-
let stringValue = value.toString().split('.')[1];
|
|
6181
|
-
if (stringValue) {
|
|
6182
|
-
return stringValue.length ? stringValue.length : 0;
|
|
6183
|
-
}
|
|
6184
|
-
else {
|
|
6185
|
-
return 0;
|
|
6186
|
-
}
|
|
6187
|
-
}
|
|
6188
|
-
function _numberToString(input, decimals, locale, useGrouping) {
|
|
6189
|
-
if (input == null) {
|
|
6190
|
-
input = 0;
|
|
6191
|
-
}
|
|
6192
|
-
if (decimals == null || decimals == -1) {
|
|
6193
|
-
decimals = countDecimals(input);
|
|
6194
|
-
}
|
|
6195
|
-
let n = Number(input);
|
|
6196
|
-
let f = decimals > -1
|
|
6197
|
-
? {
|
|
6198
|
-
minimumFractionDigits: decimals,
|
|
6199
|
-
maximumFractionDigits: decimals,
|
|
6200
|
-
useGrouping: useGrouping,
|
|
6201
|
-
}
|
|
6202
|
-
: { useGrouping: useGrouping };
|
|
6203
|
-
return n.toLocaleString(locale, f);
|
|
6204
|
-
}
|
|
6205
|
-
/**
|
|
6206
|
-
* @param time time as Date object
|
|
6207
|
-
* @param manageSeconds flag to set seconds managing
|
|
6208
|
-
* @return time as string, formatted
|
|
6209
|
-
**/
|
|
6210
|
-
function formatTime(time, manageSeconds) {
|
|
6211
|
-
const options = {
|
|
6212
|
-
hour: '2-digit',
|
|
6213
|
-
minute: '2-digit',
|
|
6214
|
-
hour12: false,
|
|
6215
|
-
};
|
|
6216
|
-
if (manageSeconds == true) {
|
|
6217
|
-
options.second = '2-digit';
|
|
6218
|
-
}
|
|
6219
|
-
return time.toLocaleTimeString(dom$a.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
6220
|
-
}
|
|
5996
|
+
})(exports.KupDatesLocales || (exports.KupDatesLocales = {}));
|
|
6221
5997
|
/**
|
|
6222
|
-
*
|
|
6223
|
-
* @returns true if time string in input is a valid time
|
|
5998
|
+
* Format Months
|
|
6224
5999
|
*/
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
function formattedStringToDefaultUnformattedStringTimestamp(value) {
|
|
6234
|
-
return formattedStringToCustomUnformattedStringTime(value, exports.KupDatesFormats.ISO_DATE_TIME, true);
|
|
6235
|
-
}
|
|
6236
|
-
/**
|
|
6237
|
-
* @param value time as string, formatted by actual browser locale
|
|
6238
|
-
* @param outputFormat time format to return
|
|
6239
|
-
* @param manageSeconds flag to set seconds managing
|
|
6240
|
-
* @returns time as string, formatted
|
|
6241
|
-
**/
|
|
6242
|
-
function formattedStringToCustomUnformattedStringTime(value, outputFormat, manageSeconds) {
|
|
6243
|
-
let inputFormat = getCurrentTimeFormatFromBrowserLocale(manageSeconds);
|
|
6244
|
-
if (dom$a.ketchup.dates.isValid(value, inputFormat)) {
|
|
6245
|
-
return dom$a.ketchup.dates.format(dom$a.ketchup.dates.normalize(value, exports.KupDatesNormalize.TIME), outputFormat);
|
|
6246
|
-
}
|
|
6247
|
-
else {
|
|
6248
|
-
return '';
|
|
6249
|
-
}
|
|
6250
|
-
}
|
|
6251
|
-
/**
|
|
6252
|
-
* @param value time as string, formatted ISO
|
|
6253
|
-
* @param manageSeconds flag to set seconds managing
|
|
6254
|
-
* @param valueTimeFormat time format (default ISO)
|
|
6255
|
-
* @param customedFormat time format from smeupObject
|
|
6256
|
-
* @returns time as string, formatted by actual browser locale
|
|
6257
|
-
**/
|
|
6258
|
-
function unformattedStringToFormattedStringTime(value, manageSeconds, customedFormat) {
|
|
6259
|
-
const options = {
|
|
6260
|
-
hour: '2-digit',
|
|
6261
|
-
minute: '2-digit',
|
|
6262
|
-
hour12: false,
|
|
6263
|
-
};
|
|
6264
|
-
if (manageSeconds == true) {
|
|
6265
|
-
options.second = '2-digit';
|
|
6266
|
-
}
|
|
6267
|
-
let date = dom$a.ketchup.dates.toDate(dom$a.ketchup.dates.normalize(value, exports.KupDatesNormalize.TIME));
|
|
6268
|
-
return formatByCustomedOutputTimeFormat(value, date, options, customedFormat);
|
|
6269
|
-
}
|
|
6270
|
-
function formatByCustomedOutputTimeFormat(valueStr, date, options, customedFormat) {
|
|
6271
|
-
if (customedFormat == null) {
|
|
6272
|
-
return date.toLocaleTimeString(dom$a.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
6273
|
-
}
|
|
6274
|
-
switch (customedFormat) {
|
|
6275
|
-
case 'I13': {
|
|
6276
|
-
//hh:mm
|
|
6277
|
-
break;
|
|
6278
|
-
}
|
|
6279
|
-
case 'I12': {
|
|
6280
|
-
//hh:mm:ss
|
|
6281
|
-
break;
|
|
6282
|
-
}
|
|
6283
|
-
case 'I11': {
|
|
6284
|
-
//???
|
|
6285
|
-
//hh:dddd
|
|
6286
|
-
//return moment(date).format('HH:DDDD');
|
|
6287
|
-
return valueStr;
|
|
6288
|
-
}
|
|
6289
|
-
case 'I14': {
|
|
6290
|
-
//???
|
|
6291
|
-
//sssss
|
|
6292
|
-
//return moment(date).format('SSSSS');
|
|
6293
|
-
return valueStr;
|
|
6294
|
-
}
|
|
6295
|
-
case 'I1H': {
|
|
6296
|
-
//???
|
|
6297
|
-
//Ora,Cen/Min HH,xx
|
|
6298
|
-
return valueStr;
|
|
6299
|
-
}
|
|
6300
|
-
case 'I1M': {
|
|
6301
|
-
//???
|
|
6302
|
-
//Min,Cen/Sec MMMM,xx
|
|
6303
|
-
return valueStr;
|
|
6304
|
-
}
|
|
6305
|
-
case 'I21': {
|
|
6306
|
-
//???
|
|
6307
|
-
//Giorni,(4 decim)
|
|
6308
|
-
return valueStr;
|
|
6309
|
-
}
|
|
6310
|
-
case 'I22': {
|
|
6311
|
-
//???
|
|
6312
|
-
//Ore,(4 decim)
|
|
6313
|
-
return valueStr;
|
|
6314
|
-
}
|
|
6315
|
-
case 'I23': {
|
|
6316
|
-
//???
|
|
6317
|
-
//Minuti,(4 decim)
|
|
6318
|
-
return valueStr;
|
|
6319
|
-
}
|
|
6320
|
-
case 'I24': {
|
|
6321
|
-
//???
|
|
6322
|
-
//Secondi
|
|
6323
|
-
return valueStr;
|
|
6324
|
-
}
|
|
6325
|
-
case 'I2H': {
|
|
6326
|
-
//???
|
|
6327
|
-
//Ora,Cen/Min HHHH,xx
|
|
6328
|
-
return valueStr;
|
|
6329
|
-
}
|
|
6330
|
-
case 'I2D': {
|
|
6331
|
-
//???
|
|
6332
|
-
//Ore Minuti Secondi HHMMS
|
|
6333
|
-
return valueStr;
|
|
6334
|
-
}
|
|
6335
|
-
case 'I2M': {
|
|
6336
|
-
//???
|
|
6337
|
-
//Min,Cen/Sec MMMM,xx
|
|
6338
|
-
return valueStr;
|
|
6339
|
-
}
|
|
6340
|
-
}
|
|
6341
|
-
return date.toLocaleTimeString(dom$a.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
6342
|
-
}
|
|
6000
|
+
exports.KupDateTimeFormatOptionsMonth = void 0;
|
|
6001
|
+
(function (KupDateTimeFormatOptionsMonth) {
|
|
6002
|
+
KupDateTimeFormatOptionsMonth["NUMERIC"] = "numeric";
|
|
6003
|
+
KupDateTimeFormatOptionsMonth["DIGIT2"] = "2-digit";
|
|
6004
|
+
KupDateTimeFormatOptionsMonth["LONG"] = "long";
|
|
6005
|
+
KupDateTimeFormatOptionsMonth["SHORT"] = "short";
|
|
6006
|
+
KupDateTimeFormatOptionsMonth["NARROW"] = "narrow";
|
|
6007
|
+
})(exports.KupDateTimeFormatOptionsMonth || (exports.KupDateTimeFormatOptionsMonth = {}));
|
|
6343
6008
|
/**
|
|
6344
|
-
*
|
|
6345
|
-
* @param valueDateFormat date/time format (default ISO)
|
|
6346
|
-
* @returns date/time as string, formatted by actual browser locale
|
|
6347
|
-
**/
|
|
6348
|
-
function unformattedStringToFormattedStringTimestamp(value) {
|
|
6349
|
-
const options = {
|
|
6350
|
-
day: '2-digit',
|
|
6351
|
-
month: '2-digit',
|
|
6352
|
-
year: 'numeric',
|
|
6353
|
-
hour: '2-digit',
|
|
6354
|
-
minute: '2-digit',
|
|
6355
|
-
second: '2-digit',
|
|
6356
|
-
hour12: false,
|
|
6357
|
-
};
|
|
6358
|
-
let date = dom$a.ketchup.dates.toDate(dom$a.ketchup.dates.normalize(value, exports.KupDatesNormalize.TIMESTAMP));
|
|
6359
|
-
return date.toLocaleString(dom$a.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
6360
|
-
}
|
|
6361
|
-
function getMonthAsStringByLocale(month, format) {
|
|
6362
|
-
if (month == null) {
|
|
6363
|
-
return '';
|
|
6364
|
-
}
|
|
6365
|
-
const dateTmp = new Date();
|
|
6366
|
-
dateTmp.setDate(1);
|
|
6367
|
-
dateTmp.setMonth(month - 1);
|
|
6368
|
-
const options = {
|
|
6369
|
-
month: format,
|
|
6370
|
-
};
|
|
6371
|
-
const dateTimeFormat = new Intl.DateTimeFormat(dom$a.ketchup.dates.getLocale(), options);
|
|
6372
|
-
return dateTimeFormat.format(dateTmp);
|
|
6373
|
-
}
|
|
6374
|
-
function getMonthsAsStringByLocale(format) {
|
|
6375
|
-
if (format == null || format.trim() == '') {
|
|
6376
|
-
format = exports.DateTimeFormatOptionsMonth.LONG;
|
|
6377
|
-
}
|
|
6378
|
-
var months = [];
|
|
6379
|
-
for (var i = 0; i < 12; i++) {
|
|
6380
|
-
months[i] = getMonthAsStringByLocale(i + 1, format);
|
|
6381
|
-
}
|
|
6382
|
-
return months;
|
|
6383
|
-
}
|
|
6384
|
-
/**
|
|
6385
|
-
* Used to retrieve component's props values.
|
|
6386
|
-
* @param {any} comp - Component calling this function.
|
|
6387
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
6388
|
-
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
6389
|
-
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
6390
|
-
*/
|
|
6391
|
-
function getProps(comp, list, descriptions) {
|
|
6392
|
-
let props = {};
|
|
6393
|
-
if (descriptions) {
|
|
6394
|
-
props = list;
|
|
6395
|
-
}
|
|
6396
|
-
else {
|
|
6397
|
-
for (const key in list) {
|
|
6398
|
-
if (Object.prototype.hasOwnProperty.call(list, key)) {
|
|
6399
|
-
props[key] = comp[key];
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
}
|
|
6403
|
-
return props;
|
|
6404
|
-
}
|
|
6405
|
-
/**
|
|
6406
|
-
* Sets the props to the component.
|
|
6407
|
-
* @param {any} comp - Component calling this function.
|
|
6408
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
6409
|
-
* @param {GenericObject} props - Prop to be set.
|
|
6009
|
+
* Common use formats
|
|
6410
6010
|
*/
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
// Otherwise, it will be set on its HTML element (i.e.: "id", "style", ecc.)
|
|
6419
|
-
comp.rootElement[key] = props[key];
|
|
6420
|
-
}
|
|
6421
|
-
}
|
|
6422
|
-
}
|
|
6011
|
+
exports.KupDatesFormats = void 0;
|
|
6012
|
+
(function (KupDatesFormats) {
|
|
6013
|
+
KupDatesFormats["ISO_DATE"] = "YYYY-MM-DD";
|
|
6014
|
+
KupDatesFormats["ISO_DATE_TIME"] = "YYYY-MM-DD HH:mm:ss";
|
|
6015
|
+
KupDatesFormats["ISO_TIME"] = "HH:mm:ss";
|
|
6016
|
+
KupDatesFormats["ISO_TIME_WITHOUT_SECONDS"] = "HH:mm";
|
|
6017
|
+
})(exports.KupDatesFormats || (exports.KupDatesFormats = {}));
|
|
6423
6018
|
|
|
6424
6019
|
const dom$9 = document.documentElement;
|
|
6425
6020
|
// -------------
|
|
@@ -6464,17 +6059,17 @@ function getValueForDisplay(value, obj, decimals) {
|
|
|
6464
6059
|
return value;
|
|
6465
6060
|
}
|
|
6466
6061
|
if (dom$9.ketchup.objects.isNumber(obj)) {
|
|
6467
|
-
return
|
|
6062
|
+
return dom$9.ketchup.math.numberStringToFormattedString(value, decimals ? decimals : -1, obj ? obj.p : '');
|
|
6468
6063
|
}
|
|
6469
6064
|
if (dom$9.ketchup.objects.isDate(obj) &&
|
|
6470
6065
|
dom$9.ketchup.dates.isValid(value, exports.KupDatesFormats.ISO_DATE)) {
|
|
6471
6066
|
return dom$9.ketchup.dates.format(value);
|
|
6472
6067
|
}
|
|
6473
6068
|
if (dom$9.ketchup.objects.isTime(obj)) {
|
|
6474
|
-
return
|
|
6069
|
+
return dom$9.ketchup.dates.timeStringToFormattedString(value, dom$9.ketchup.objects.isTimeWithSeconds(obj), obj.t + obj.p);
|
|
6475
6070
|
}
|
|
6476
6071
|
if (dom$9.ketchup.objects.isTimestamp(obj)) {
|
|
6477
|
-
return
|
|
6072
|
+
return dom$9.ketchup.dates.timestampStringToFormattedString(value);
|
|
6478
6073
|
}
|
|
6479
6074
|
return value;
|
|
6480
6075
|
}
|
|
@@ -6519,8 +6114,8 @@ function compareValues(obj1, value1, obj2, value2, sortMode) {
|
|
|
6519
6114
|
let v1 = s1;
|
|
6520
6115
|
let v2 = s2;
|
|
6521
6116
|
if (dom$9.ketchup.objects.isNumber(obj1)) {
|
|
6522
|
-
v1 =
|
|
6523
|
-
v2 =
|
|
6117
|
+
v1 = dom$9.ketchup.math.numberifySafe(s1);
|
|
6118
|
+
v2 = dom$9.ketchup.math.numberifySafe(s2);
|
|
6524
6119
|
}
|
|
6525
6120
|
else if (dom$9.ketchup.objects.isDate(obj1)) {
|
|
6526
6121
|
v1 = dom$9.ketchup.dates.toDate(dom$9.ketchup.dates.format(s1, exports.KupDatesFormats.ISO_DATE));
|
|
@@ -6653,8 +6248,8 @@ class Filters {
|
|
|
6653
6248
|
: exports.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS)) {
|
|
6654
6249
|
return newValue;
|
|
6655
6250
|
}
|
|
6656
|
-
if (isValidFormattedStringTime(value, manageSeconds)) {
|
|
6657
|
-
return
|
|
6251
|
+
if (dom$8.ketchup.dates.isValidFormattedStringTime(value, manageSeconds)) {
|
|
6252
|
+
return dom$8.ketchup.dates.formattedStringToCustomDateTime(value, manageSeconds
|
|
6658
6253
|
? exports.KupDatesFormats.ISO_TIME
|
|
6659
6254
|
: exports.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS, manageSeconds);
|
|
6660
6255
|
}
|
|
@@ -6663,13 +6258,13 @@ class Filters {
|
|
|
6663
6258
|
if (dom$8.ketchup.dates.isValid(value, exports.KupDatesFormats.ISO_DATE_TIME)) {
|
|
6664
6259
|
return newValue;
|
|
6665
6260
|
}
|
|
6666
|
-
if (isValidFormattedStringTime(value, true)) {
|
|
6667
|
-
return
|
|
6261
|
+
if (dom$8.ketchup.dates.isValidFormattedStringTime(value, true)) {
|
|
6262
|
+
return dom$8.ketchup.dates.formattedStringToTimestampString(value);
|
|
6668
6263
|
}
|
|
6669
6264
|
}
|
|
6670
6265
|
else if (dom$8.ketchup.objects.isNumber(smeupObj)) {
|
|
6671
|
-
if (
|
|
6672
|
-
return
|
|
6266
|
+
if (dom$8.ketchup.math.isStringNumber(value, smeupObj ? smeupObj.p : '')) {
|
|
6267
|
+
return dom$8.ketchup.math.formattedStringToNumberString(value, smeupObj ? smeupObj.p : '');
|
|
6673
6268
|
}
|
|
6674
6269
|
}
|
|
6675
6270
|
return newValue;
|
|
@@ -6791,12 +6386,11 @@ class Filters {
|
|
|
6791
6386
|
}
|
|
6792
6387
|
let checkByRegularExpression = true;
|
|
6793
6388
|
if (dom$8.ketchup.objects.isNumber(obj)) {
|
|
6794
|
-
|
|
6795
|
-
let valueNumber = stringToNumber(value);
|
|
6389
|
+
let valueNumber = dom$8.ketchup.math.numberifySafe(value, obj ? obj.p : '');
|
|
6796
6390
|
if (from != '') {
|
|
6797
|
-
if (isNumber(from)) {
|
|
6391
|
+
if (dom$8.ketchup.math.isNumber(from)) {
|
|
6798
6392
|
checkByRegularExpression = false;
|
|
6799
|
-
let fromNumber =
|
|
6393
|
+
let fromNumber = dom$8.ketchup.math.numberifySafe(from);
|
|
6800
6394
|
if (valueNumber < fromNumber) {
|
|
6801
6395
|
return false;
|
|
6802
6396
|
}
|
|
@@ -6806,9 +6400,9 @@ class Filters {
|
|
|
6806
6400
|
}
|
|
6807
6401
|
}
|
|
6808
6402
|
if (to != '') {
|
|
6809
|
-
if (isNumber(to)) {
|
|
6403
|
+
if (dom$8.ketchup.math.isNumber(to)) {
|
|
6810
6404
|
checkByRegularExpression = false;
|
|
6811
|
-
let toNumber =
|
|
6405
|
+
let toNumber = dom$8.ketchup.math.numberifySafe(to);
|
|
6812
6406
|
if (valueNumber > toNumber) {
|
|
6813
6407
|
return false;
|
|
6814
6408
|
}
|
|
@@ -7833,9 +7427,11 @@ class KupData {
|
|
|
7833
7427
|
}
|
|
7834
7428
|
else {
|
|
7835
7429
|
n = dom$4.ketchup.math.numberify(cell.value);
|
|
7430
|
+
const nMax = dom$4.ketchup.math.numberify(max);
|
|
7431
|
+
const nMin = dom$4.ketchup.math.numberify(min);
|
|
7836
7432
|
if (n === max ||
|
|
7837
7433
|
n === min ||
|
|
7838
|
-
(n <
|
|
7434
|
+
(n < nMax && n > nMin)) {
|
|
7839
7435
|
result.cells.push(cell);
|
|
7840
7436
|
result.rows.push(row);
|
|
7841
7437
|
}
|
|
@@ -8225,6 +7821,59 @@ class KupDates {
|
|
|
8225
7821
|
.filter((value) => typeof value === 'string');
|
|
8226
7822
|
return items;
|
|
8227
7823
|
}
|
|
7824
|
+
/**
|
|
7825
|
+
* Gets date format by browser locale
|
|
7826
|
+
* @returns {string} date format pattern, by browser locale
|
|
7827
|
+
*/
|
|
7828
|
+
getDateFormat() {
|
|
7829
|
+
const formatObj = new Intl.DateTimeFormat(this.getLocale()).formatToParts(new Date());
|
|
7830
|
+
let dateFormat = formatObj
|
|
7831
|
+
.map((obj) => {
|
|
7832
|
+
switch (obj.type) {
|
|
7833
|
+
case 'day':
|
|
7834
|
+
return 'DD';
|
|
7835
|
+
case 'month':
|
|
7836
|
+
return 'MM';
|
|
7837
|
+
case 'year':
|
|
7838
|
+
return 'YYYY';
|
|
7839
|
+
default:
|
|
7840
|
+
return obj.value;
|
|
7841
|
+
}
|
|
7842
|
+
})
|
|
7843
|
+
.join('');
|
|
7844
|
+
return dateFormat;
|
|
7845
|
+
}
|
|
7846
|
+
/**
|
|
7847
|
+
* Gets time format by browser locale
|
|
7848
|
+
* @param {boolean} manageSeconds flag to set seconds managing
|
|
7849
|
+
* @returns {string} time format pattern, by browser locale
|
|
7850
|
+
*/
|
|
7851
|
+
getTimeFormat(manageSeconds) {
|
|
7852
|
+
const options = {
|
|
7853
|
+
hour: '2-digit',
|
|
7854
|
+
minute: '2-digit',
|
|
7855
|
+
hour12: false,
|
|
7856
|
+
};
|
|
7857
|
+
if (manageSeconds == true) {
|
|
7858
|
+
options.second = '2-digit';
|
|
7859
|
+
}
|
|
7860
|
+
const formatObj = new Intl.DateTimeFormat(this.getLocale() + '-u-hc-h23', options).formatToParts(new Date());
|
|
7861
|
+
let timeFormat = formatObj
|
|
7862
|
+
.map((obj) => {
|
|
7863
|
+
switch (obj.type) {
|
|
7864
|
+
case 'hour':
|
|
7865
|
+
return 'HH';
|
|
7866
|
+
case 'minute':
|
|
7867
|
+
return 'mm';
|
|
7868
|
+
case 'second':
|
|
7869
|
+
return 'ss';
|
|
7870
|
+
default:
|
|
7871
|
+
return obj.value;
|
|
7872
|
+
}
|
|
7873
|
+
})
|
|
7874
|
+
.join('');
|
|
7875
|
+
return timeFormat;
|
|
7876
|
+
}
|
|
8228
7877
|
/**
|
|
8229
7878
|
* Formats the given date.
|
|
8230
7879
|
* @param {dayjs.ConfigType} input - Date to be formatted.
|
|
@@ -8237,6 +7886,23 @@ class KupDates {
|
|
|
8237
7886
|
}
|
|
8238
7887
|
return dayjs_min(input).format(format);
|
|
8239
7888
|
}
|
|
7889
|
+
/**
|
|
7890
|
+
* Gets the time formatted
|
|
7891
|
+
* @param {Date} time time as Date object
|
|
7892
|
+
* @param {boolean} manageSeconds flag to set seconds managing
|
|
7893
|
+
* @return {string} time as string, formatted
|
|
7894
|
+
**/
|
|
7895
|
+
formatTime(time, manageSeconds) {
|
|
7896
|
+
const options = {
|
|
7897
|
+
hour: '2-digit',
|
|
7898
|
+
minute: '2-digit',
|
|
7899
|
+
hour12: false,
|
|
7900
|
+
};
|
|
7901
|
+
if (manageSeconds == true) {
|
|
7902
|
+
options.second = '2-digit';
|
|
7903
|
+
}
|
|
7904
|
+
return time.toLocaleTimeString(this.getLocale() + '-u-hc-h23', options);
|
|
7905
|
+
}
|
|
8240
7906
|
/**
|
|
8241
7907
|
* Validates the given date.
|
|
8242
7908
|
* @param {dayjs.ConfigType} date - Date to be validated.
|
|
@@ -8252,6 +7918,16 @@ class KupDates {
|
|
|
8252
7918
|
return dayjs_min(date, undefined, strict).isValid();
|
|
8253
7919
|
}
|
|
8254
7920
|
}
|
|
7921
|
+
/**
|
|
7922
|
+
* Validates the given date as string.
|
|
7923
|
+
* @param {string} value time string, formatted by actual browser locale
|
|
7924
|
+
* @param {boolean} manageSeconds if manage seconds
|
|
7925
|
+
* @returns {boolean} true if time string in input is a valid time
|
|
7926
|
+
*/
|
|
7927
|
+
isValidFormattedStringTime(value, manageSeconds) {
|
|
7928
|
+
let format = this.getTimeFormat(manageSeconds);
|
|
7929
|
+
return this.isValid(value, format, true);
|
|
7930
|
+
}
|
|
8255
7931
|
/**
|
|
8256
7932
|
* Converts the input in a Date object.
|
|
8257
7933
|
* @param {dayjs.ConfigType} input - Input date.
|
|
@@ -8460,6 +8136,237 @@ class KupDates {
|
|
|
8460
8136
|
subtract(input, value, unit) {
|
|
8461
8137
|
return dayjs_min(input).subtract(value, unit);
|
|
8462
8138
|
}
|
|
8139
|
+
/**
|
|
8140
|
+
* Gets the month formatted
|
|
8141
|
+
* @param {number} month month id
|
|
8142
|
+
* @param {KupDateTimeFormatOptionsMonth} format format
|
|
8143
|
+
* @returns {string} the month formatted, by browser locale
|
|
8144
|
+
*/
|
|
8145
|
+
getMonthAsString(month, format) {
|
|
8146
|
+
if (month == null) {
|
|
8147
|
+
return '';
|
|
8148
|
+
}
|
|
8149
|
+
const dateTmp = new Date();
|
|
8150
|
+
dateTmp.setDate(1);
|
|
8151
|
+
dateTmp.setMonth(month - 1);
|
|
8152
|
+
const options = {
|
|
8153
|
+
month: format,
|
|
8154
|
+
};
|
|
8155
|
+
const dateTimeFormat = new Intl.DateTimeFormat(this.getLocale(), options);
|
|
8156
|
+
return dateTimeFormat.format(dateTmp);
|
|
8157
|
+
}
|
|
8158
|
+
/**
|
|
8159
|
+
* Gets the year months formatted
|
|
8160
|
+
* @param {KupDateTimeFormatOptionsMonth} format format
|
|
8161
|
+
* @returns {string[]} the months formatted, by browser locale
|
|
8162
|
+
*/
|
|
8163
|
+
getMonthsAsString(format) {
|
|
8164
|
+
if (format == null || format.trim() == '') {
|
|
8165
|
+
format = exports.KupDateTimeFormatOptionsMonth.LONG;
|
|
8166
|
+
}
|
|
8167
|
+
var months = [];
|
|
8168
|
+
for (var i = 0; i < 12; i++) {
|
|
8169
|
+
months[i] = this.getMonthAsString(i + 1, format);
|
|
8170
|
+
}
|
|
8171
|
+
return months;
|
|
8172
|
+
}
|
|
8173
|
+
/**
|
|
8174
|
+
* Gets the day formatted
|
|
8175
|
+
* @param {Date} date date
|
|
8176
|
+
* @returns {string} the day formatted, by browser locale
|
|
8177
|
+
*/
|
|
8178
|
+
getDayAsString(date) {
|
|
8179
|
+
if (date == null) {
|
|
8180
|
+
return '';
|
|
8181
|
+
}
|
|
8182
|
+
const options = {
|
|
8183
|
+
weekday: 'narrow',
|
|
8184
|
+
/** weekday: 'narrow' 'short' 'long' */
|
|
8185
|
+
};
|
|
8186
|
+
const dateTimeFormat = new Intl.DateTimeFormat(this.getLocale(), options);
|
|
8187
|
+
return dateTimeFormat.format(date);
|
|
8188
|
+
}
|
|
8189
|
+
/**
|
|
8190
|
+
* First day of current week
|
|
8191
|
+
* @param {number} firstDayIndex first day of week index
|
|
8192
|
+
* @returns {Date} the first day of current week
|
|
8193
|
+
*/
|
|
8194
|
+
firstDayThisWeek(firstDayIndex) {
|
|
8195
|
+
var d = new Date();
|
|
8196
|
+
const day = d.getDay();
|
|
8197
|
+
// dayIndex0
|
|
8198
|
+
d.setDate(d.getDate() - day);
|
|
8199
|
+
// dayIndexX
|
|
8200
|
+
d.setDate(d.getDate() + firstDayIndex);
|
|
8201
|
+
return d;
|
|
8202
|
+
}
|
|
8203
|
+
/**
|
|
8204
|
+
* Dates of current week
|
|
8205
|
+
* @param {number} firstDayIndex first day of week index
|
|
8206
|
+
* @returns { startDate: Date; endDate: Date } the dates of current week
|
|
8207
|
+
*/
|
|
8208
|
+
thisWeek(firstDayIndex) {
|
|
8209
|
+
const firstDay = this.firstDayThisWeek(firstDayIndex);
|
|
8210
|
+
return {
|
|
8211
|
+
startDate: firstDay,
|
|
8212
|
+
endDate: offsetDate(firstDay, 6),
|
|
8213
|
+
};
|
|
8214
|
+
function offsetDate(base, count) {
|
|
8215
|
+
const date = new Date(base);
|
|
8216
|
+
date.setDate(base.getDate() + count);
|
|
8217
|
+
return date;
|
|
8218
|
+
}
|
|
8219
|
+
}
|
|
8220
|
+
/**
|
|
8221
|
+
* Gets the days of current week as string
|
|
8222
|
+
* @param {number} firstDayIndex first day of week index
|
|
8223
|
+
* @returns {string[]} the days of current week as string
|
|
8224
|
+
*/
|
|
8225
|
+
getDaysOfWeekAsString(firstDayIndex) {
|
|
8226
|
+
var thisWeekDays = this.thisWeek(firstDayIndex);
|
|
8227
|
+
var monday = thisWeekDays.startDate;
|
|
8228
|
+
var days = [];
|
|
8229
|
+
for (var i = 0; i < 7; i++) {
|
|
8230
|
+
var date = new Date(monday.toISOString());
|
|
8231
|
+
date.setDate(date.getDate() + i);
|
|
8232
|
+
days[i] = this.getDayAsString(date);
|
|
8233
|
+
}
|
|
8234
|
+
return days;
|
|
8235
|
+
}
|
|
8236
|
+
/**
|
|
8237
|
+
* Gets the timestamp formatted
|
|
8238
|
+
* @param {string} value date/time as string, formatted ISO
|
|
8239
|
+
* @returns {string} date/time as string, formatted by actual browser locale
|
|
8240
|
+
**/
|
|
8241
|
+
timestampStringToFormattedString(value) {
|
|
8242
|
+
const options = {
|
|
8243
|
+
day: '2-digit',
|
|
8244
|
+
month: '2-digit',
|
|
8245
|
+
year: 'numeric',
|
|
8246
|
+
hour: '2-digit',
|
|
8247
|
+
minute: '2-digit',
|
|
8248
|
+
second: '2-digit',
|
|
8249
|
+
hour12: false,
|
|
8250
|
+
};
|
|
8251
|
+
let date = this.toDate(this.normalize(value, exports.KupDatesNormalize.TIMESTAMP));
|
|
8252
|
+
return date.toLocaleString(this.getLocale() + '-u-hc-h23', options);
|
|
8253
|
+
}
|
|
8254
|
+
/**
|
|
8255
|
+
* Gets ISO date/time from formatted string, as string
|
|
8256
|
+
* @param {string} value date/time as string, formatted by actual browser locale
|
|
8257
|
+
* @returns {string} date/time as string, formatted ISO
|
|
8258
|
+
**/
|
|
8259
|
+
formattedStringToTimestampString(value) {
|
|
8260
|
+
return this.formattedStringToCustomDateTime(value, exports.KupDatesFormats.ISO_DATE_TIME, true);
|
|
8261
|
+
}
|
|
8262
|
+
/**
|
|
8263
|
+
* Gets formatted dateTime as customed ISO (see KupDatesFormats)
|
|
8264
|
+
* @param {string} value time as string, formatted by actual browser locale
|
|
8265
|
+
* @param {string} outputFormat time format to return (see KupDatesFormats)
|
|
8266
|
+
* @param {boolean} manageSeconds flag to set seconds managing
|
|
8267
|
+
* @returns {string} time as string, formatted
|
|
8268
|
+
**/
|
|
8269
|
+
formattedStringToCustomDateTime(value, outputFormat, manageSeconds) {
|
|
8270
|
+
let inputFormat = this.getTimeFormat(manageSeconds);
|
|
8271
|
+
if (this.isValid(value, inputFormat)) {
|
|
8272
|
+
return this.format(this.normalize(value, exports.KupDatesNormalize.TIME), outputFormat);
|
|
8273
|
+
}
|
|
8274
|
+
else {
|
|
8275
|
+
return '';
|
|
8276
|
+
}
|
|
8277
|
+
}
|
|
8278
|
+
/**
|
|
8279
|
+
* Gets the time formatted
|
|
8280
|
+
* @param {string} value time as string, formatted ISO
|
|
8281
|
+
* @param {boolean} manageSeconds flag to set seconds managing
|
|
8282
|
+
* @param {string} customedFormat time format from smeupObject
|
|
8283
|
+
* @returns {string} time as string, formatted by actual browser locale
|
|
8284
|
+
**/
|
|
8285
|
+
timeStringToFormattedString(value, manageSeconds, customedFormat) {
|
|
8286
|
+
const options = {
|
|
8287
|
+
hour: '2-digit',
|
|
8288
|
+
minute: '2-digit',
|
|
8289
|
+
hour12: false,
|
|
8290
|
+
};
|
|
8291
|
+
if (manageSeconds == true) {
|
|
8292
|
+
options.second = '2-digit';
|
|
8293
|
+
}
|
|
8294
|
+
let date = this.toDate(this.normalize(value, exports.KupDatesNormalize.TIME));
|
|
8295
|
+
return formatByCustomedOutputTimeFormat(value, date, options, customedFormat, this);
|
|
8296
|
+
function formatByCustomedOutputTimeFormat(valueStr, date, options, customedFormat, kupDates) {
|
|
8297
|
+
if (customedFormat == null) {
|
|
8298
|
+
return date.toLocaleTimeString(kupDates.getLocale() + '-u-hc-h23', options);
|
|
8299
|
+
}
|
|
8300
|
+
switch (customedFormat) {
|
|
8301
|
+
case 'I13': {
|
|
8302
|
+
//hh:mm
|
|
8303
|
+
break;
|
|
8304
|
+
}
|
|
8305
|
+
case 'I12': {
|
|
8306
|
+
//hh:mm:ss
|
|
8307
|
+
break;
|
|
8308
|
+
}
|
|
8309
|
+
case 'I11': {
|
|
8310
|
+
//???
|
|
8311
|
+
//hh:dddd
|
|
8312
|
+
//return moment(date).format('HH:DDDD');
|
|
8313
|
+
return valueStr;
|
|
8314
|
+
}
|
|
8315
|
+
case 'I14': {
|
|
8316
|
+
//???
|
|
8317
|
+
//sssss
|
|
8318
|
+
//return moment(date).format('SSSSS');
|
|
8319
|
+
return valueStr;
|
|
8320
|
+
}
|
|
8321
|
+
case 'I1H': {
|
|
8322
|
+
//???
|
|
8323
|
+
//Ora,Cen/Min HH,xx
|
|
8324
|
+
return valueStr;
|
|
8325
|
+
}
|
|
8326
|
+
case 'I1M': {
|
|
8327
|
+
//???
|
|
8328
|
+
//Min,Cen/Sec MMMM,xx
|
|
8329
|
+
return valueStr;
|
|
8330
|
+
}
|
|
8331
|
+
case 'I21': {
|
|
8332
|
+
//???
|
|
8333
|
+
//Giorni,(4 decim)
|
|
8334
|
+
return valueStr;
|
|
8335
|
+
}
|
|
8336
|
+
case 'I22': {
|
|
8337
|
+
//???
|
|
8338
|
+
//Ore,(4 decim)
|
|
8339
|
+
return valueStr;
|
|
8340
|
+
}
|
|
8341
|
+
case 'I23': {
|
|
8342
|
+
//???
|
|
8343
|
+
//Minuti,(4 decim)
|
|
8344
|
+
return valueStr;
|
|
8345
|
+
}
|
|
8346
|
+
case 'I24': {
|
|
8347
|
+
//???
|
|
8348
|
+
//Secondi
|
|
8349
|
+
return valueStr;
|
|
8350
|
+
}
|
|
8351
|
+
case 'I2H': {
|
|
8352
|
+
//???
|
|
8353
|
+
//Ora,Cen/Min HHHH,xx
|
|
8354
|
+
return valueStr;
|
|
8355
|
+
}
|
|
8356
|
+
case 'I2D': {
|
|
8357
|
+
//???
|
|
8358
|
+
//Ore Minuti Secondi HHMMS
|
|
8359
|
+
return valueStr;
|
|
8360
|
+
}
|
|
8361
|
+
case 'I2M': {
|
|
8362
|
+
//???
|
|
8363
|
+
//Min,Cen/Sec MMMM,xx
|
|
8364
|
+
return valueStr;
|
|
8365
|
+
}
|
|
8366
|
+
}
|
|
8367
|
+
return date.toLocaleTimeString(kupDates.getLocale() + '-u-hc-h23', options);
|
|
8368
|
+
}
|
|
8369
|
+
}
|
|
8463
8370
|
/**
|
|
8464
8371
|
* Registers a KupComponent in KupDates, in order to be properly handled whenever the locale changes.
|
|
8465
8372
|
* @param {any} component - The Ketchup component to be registered.
|
|
@@ -9824,6 +9731,86 @@ function normalDistributionFormula(average, variance, x) {
|
|
|
9824
9731
|
Math.exp(-Math.pow(x - average, 2) / (2 * variance)));
|
|
9825
9732
|
}
|
|
9826
9733
|
|
|
9734
|
+
function identify(array) {
|
|
9735
|
+
if (array) {
|
|
9736
|
+
for (let i = 0; i < array.length; i++) {
|
|
9737
|
+
array[i].id = i.toString();
|
|
9738
|
+
}
|
|
9739
|
+
}
|
|
9740
|
+
}
|
|
9741
|
+
/**
|
|
9742
|
+
* Fills a string with another string, eventually before
|
|
9743
|
+
* @param {string} stringIn initial string
|
|
9744
|
+
* @param {string} stringForFill string used for fill
|
|
9745
|
+
* @param {number} finalLen final string length
|
|
9746
|
+
* @param {boolean} addBefore flag for fill on left
|
|
9747
|
+
* @returns the input string filled with stringForFill
|
|
9748
|
+
*/
|
|
9749
|
+
function fillString(stringIn, stringForFill, finalLen, addBefore) {
|
|
9750
|
+
let initSize = stringIn.length;
|
|
9751
|
+
let stringOut = '';
|
|
9752
|
+
for (let i = initSize; i < finalLen; i += stringForFill.length) {
|
|
9753
|
+
stringOut += stringForFill;
|
|
9754
|
+
}
|
|
9755
|
+
if (addBefore) {
|
|
9756
|
+
return stringOut + stringIn;
|
|
9757
|
+
}
|
|
9758
|
+
else {
|
|
9759
|
+
return stringIn + stringOut;
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
/**
|
|
9763
|
+
* Used to retrieve component's props values.
|
|
9764
|
+
* @param {any} comp - Component calling this function.
|
|
9765
|
+
* @param {GenericObject} list - Prop list, specific for each component.
|
|
9766
|
+
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
9767
|
+
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
9768
|
+
*/
|
|
9769
|
+
function getProps(comp, list, descriptions) {
|
|
9770
|
+
let props = {};
|
|
9771
|
+
if (descriptions) {
|
|
9772
|
+
props = list;
|
|
9773
|
+
}
|
|
9774
|
+
else {
|
|
9775
|
+
for (const key in list) {
|
|
9776
|
+
if (Object.prototype.hasOwnProperty.call(list, key)) {
|
|
9777
|
+
props[key] = comp[key];
|
|
9778
|
+
}
|
|
9779
|
+
}
|
|
9780
|
+
}
|
|
9781
|
+
return props;
|
|
9782
|
+
}
|
|
9783
|
+
/**
|
|
9784
|
+
* Sets the props to the component.
|
|
9785
|
+
* @param {any} comp - Component calling this function.
|
|
9786
|
+
* @param {GenericObject} list - Prop list, specific for each component.
|
|
9787
|
+
* @param {GenericObject} props - Prop to be set.
|
|
9788
|
+
*/
|
|
9789
|
+
function setProps(comp, list, props) {
|
|
9790
|
+
for (const key in props) {
|
|
9791
|
+
// If key is a custom prop it will be set on the component (i.e.: "data", "customStyle", ecc.)
|
|
9792
|
+
if (list[key]) {
|
|
9793
|
+
comp[key] = props[key];
|
|
9794
|
+
}
|
|
9795
|
+
else {
|
|
9796
|
+
// Otherwise, it will be set on its HTML element (i.e.: "id", "style", ecc.)
|
|
9797
|
+
comp.rootElement[key] = props[key];
|
|
9798
|
+
}
|
|
9799
|
+
}
|
|
9800
|
+
}
|
|
9801
|
+
/**
|
|
9802
|
+
* Creates a regular expression object, from a string un-escaped
|
|
9803
|
+
* @param s string to use for create regular expression (not escaped)
|
|
9804
|
+
* @param flags flags used for the regular expression
|
|
9805
|
+
* @returns the regular expression object
|
|
9806
|
+
*/
|
|
9807
|
+
function getRegExpFromString(s, flags) {
|
|
9808
|
+
return new RegExp(escapeRegExp(s), flags);
|
|
9809
|
+
}
|
|
9810
|
+
function escapeRegExp(s) {
|
|
9811
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
9812
|
+
}
|
|
9813
|
+
|
|
9827
9814
|
const dom$2 = document.documentElement;
|
|
9828
9815
|
/**
|
|
9829
9816
|
* Handles mathematical operations and number formatting/conversion.
|
|
@@ -9847,7 +9834,7 @@ class KupMath {
|
|
|
9847
9834
|
const maximumFractionDigits = 14;
|
|
9848
9835
|
if (value == null || value == '')
|
|
9849
9836
|
return value;
|
|
9850
|
-
return Number(value).toLocaleString(
|
|
9837
|
+
return Number(value).toLocaleString(this.locale, {
|
|
9851
9838
|
maximumFractionDigits: maximumFractionDigits,
|
|
9852
9839
|
});
|
|
9853
9840
|
},
|
|
@@ -9936,14 +9923,15 @@ class KupMath {
|
|
|
9936
9923
|
return this.numeral(n).format(format);
|
|
9937
9924
|
}
|
|
9938
9925
|
/**
|
|
9939
|
-
*
|
|
9926
|
+
* Create the pattern string for format a number
|
|
9940
9927
|
* @param {boolean} thousandPoint - show thousandPoint
|
|
9941
9928
|
* @param {number} decimals - number of decimals
|
|
9929
|
+
* @returns {string} - formatter pattern
|
|
9942
9930
|
*/
|
|
9943
9931
|
createFormatPattern(thousandPoint, decimals) {
|
|
9944
9932
|
var format = '0';
|
|
9945
9933
|
if (thousandPoint) {
|
|
9946
|
-
format += ',
|
|
9934
|
+
format += ',0';
|
|
9947
9935
|
}
|
|
9948
9936
|
if (decimals && decimals > 0) {
|
|
9949
9937
|
format += '.';
|
|
@@ -9955,7 +9943,7 @@ class KupMath {
|
|
|
9955
9943
|
}
|
|
9956
9944
|
/**
|
|
9957
9945
|
* Returns the decimal separator of current browser
|
|
9958
|
-
* @returns current decimal separator, by locale
|
|
9946
|
+
* @returns {string} current decimal separator, by locale
|
|
9959
9947
|
*/
|
|
9960
9948
|
decimalSeparator() {
|
|
9961
9949
|
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
@@ -9965,7 +9953,7 @@ class KupMath {
|
|
|
9965
9953
|
}
|
|
9966
9954
|
/**
|
|
9967
9955
|
* Returns the group separator of current browser
|
|
9968
|
-
* @returns current group separator, by locale
|
|
9956
|
+
* @returns {string} current group separator, by locale
|
|
9969
9957
|
*/
|
|
9970
9958
|
groupSeparator() {
|
|
9971
9959
|
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
@@ -9975,11 +9963,12 @@ class KupMath {
|
|
|
9975
9963
|
}
|
|
9976
9964
|
/**
|
|
9977
9965
|
* Checks if an input string matches options, for desired formatted decimal number (integer digits, decimal digits)
|
|
9978
|
-
* @param value the input value to check
|
|
9979
|
-
* @param options options for customize the check
|
|
9980
|
-
* @returns an object from applying the regular expression for check
|
|
9966
|
+
* @param {string} value the input value to check
|
|
9967
|
+
* @param {NumericFieldFormatOptions} options options for customize the check
|
|
9968
|
+
* @returns {RegExpMatchArray} an object from applying the regular expression for check
|
|
9981
9969
|
*/
|
|
9982
9970
|
matchNumericValueWithOptions(value, options) {
|
|
9971
|
+
value = value.replace(getRegExpFromString(this.groupSeparator(), 'g'), '');
|
|
9983
9972
|
// see https://github.com/24eme/jquery-input-number-format.git
|
|
9984
9973
|
let found = undefined;
|
|
9985
9974
|
let integerPartSuffix = '+';
|
|
@@ -10020,9 +10009,22 @@ class KupMath {
|
|
|
10020
10009
|
* Returns a number from a non-specified input type between string, number, or String.
|
|
10021
10010
|
* @param {string | String | number} input - Input value to numberify.
|
|
10022
10011
|
* @param {boolean} inputIsLocalized - Numberifies assuming the input string is in the current KupMath locale's format.
|
|
10012
|
+
* @param {string} type - type of number for calculate suffix
|
|
10023
10013
|
* @returns {number} Resulting number or NaN (when not a number).
|
|
10024
10014
|
*/
|
|
10025
|
-
numberify(input, inputIsLocalized) {
|
|
10015
|
+
numberify(input, inputIsLocalized, type) {
|
|
10016
|
+
if (typeof input != 'number') {
|
|
10017
|
+
if (type) {
|
|
10018
|
+
let suffix = this.getNumericValueSuffix(type);
|
|
10019
|
+
if (suffix != '') {
|
|
10020
|
+
input = input.replace(getRegExpFromString(suffix, 'g'), '');
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
10023
|
+
const groupSeparator = inputIsLocalized
|
|
10024
|
+
? this.groupSeparator()
|
|
10025
|
+
: ',';
|
|
10026
|
+
input = input.replace(getRegExpFromString(groupSeparator, 'g'), '');
|
|
10027
|
+
}
|
|
10026
10028
|
let n = NaN;
|
|
10027
10029
|
if (inputIsLocalized) {
|
|
10028
10030
|
n = this.numeral(input).value();
|
|
@@ -10038,6 +10040,161 @@ class KupMath {
|
|
|
10038
10040
|
}
|
|
10039
10041
|
return n;
|
|
10040
10042
|
}
|
|
10043
|
+
/**
|
|
10044
|
+
* Returns a number from a non-specified input type between string, number, or String.
|
|
10045
|
+
* If value in is null, undefined or blank, returns 0
|
|
10046
|
+
* @param {string} input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
10047
|
+
* @param {boolean} inputIsLocalized - Numberifies assuming the input string is in the current KupMath locale's format.
|
|
10048
|
+
* @param {string} type - type of number for calculate suffix
|
|
10049
|
+
* @returns {number} Resulting number
|
|
10050
|
+
**/
|
|
10051
|
+
numberifySafe(input, inputIsLocalized, type) {
|
|
10052
|
+
if (!input || input == null || input.trim() == '') {
|
|
10053
|
+
input = '0';
|
|
10054
|
+
}
|
|
10055
|
+
return this.numberify(input, inputIsLocalized, type);
|
|
10056
|
+
}
|
|
10057
|
+
/**
|
|
10058
|
+
* Checks if input is a valid number
|
|
10059
|
+
* @param {any} value input value to check
|
|
10060
|
+
* @returns {boolean} if input value is valid number
|
|
10061
|
+
*/
|
|
10062
|
+
isNumber(value) {
|
|
10063
|
+
//return typeof value === 'number';
|
|
10064
|
+
return !isNaN(value);
|
|
10065
|
+
}
|
|
10066
|
+
/**
|
|
10067
|
+
* Checks if string in input is a valid formatted number
|
|
10068
|
+
* @param {string} value number as string, formatted by actual browser locale
|
|
10069
|
+
* @param {string} type - type of number for calculate suffix
|
|
10070
|
+
* @returns {boolean} true if number string in input is a valid number
|
|
10071
|
+
*/
|
|
10072
|
+
isStringNumber(value, type) {
|
|
10073
|
+
if (value == null || value.trim() == '') {
|
|
10074
|
+
return false;
|
|
10075
|
+
}
|
|
10076
|
+
let tmpStr = this.formattedStringToNumberString(value, type);
|
|
10077
|
+
if (this.isNumber(tmpStr)) {
|
|
10078
|
+
return true;
|
|
10079
|
+
}
|
|
10080
|
+
return false;
|
|
10081
|
+
}
|
|
10082
|
+
/**
|
|
10083
|
+
* Gets number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
10084
|
+
* @param {string} input number as string, formatted by actual browser locale (maybe)
|
|
10085
|
+
* @param {string} type - type of number for calculate suffix
|
|
10086
|
+
* @param {string} decSeparator - decimal serparator of input string
|
|
10087
|
+
* @returns {string} number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
10088
|
+
**/
|
|
10089
|
+
formattedStringToNumberString(input, type, decSeparator) {
|
|
10090
|
+
return numberStringToNumberString(input, type, decSeparator !== null && decSeparator !== void 0 ? decSeparator : this.decimalSeparator(), this);
|
|
10091
|
+
function numberStringToNumberString(input, type, decFmt, kupMath) {
|
|
10092
|
+
if (!input || input == null || input.trim() == '') {
|
|
10093
|
+
return '';
|
|
10094
|
+
}
|
|
10095
|
+
let unf = kupMath.numberifySafe(input, decFmt != '.', type);
|
|
10096
|
+
if (unf == null || isNaN(unf)) {
|
|
10097
|
+
return input;
|
|
10098
|
+
}
|
|
10099
|
+
return numberToString(unf, -1, 'en-US', kupMath);
|
|
10100
|
+
}
|
|
10101
|
+
function numberToString(input, decimals, locale, kupMath) {
|
|
10102
|
+
if (input == null) {
|
|
10103
|
+
input = 0;
|
|
10104
|
+
}
|
|
10105
|
+
if (decimals == null || decimals == -1) {
|
|
10106
|
+
decimals = kupMath.countDecimals(input);
|
|
10107
|
+
}
|
|
10108
|
+
let n = Number(input);
|
|
10109
|
+
let f = decimals > -1
|
|
10110
|
+
? {
|
|
10111
|
+
minimumFractionDigits: decimals,
|
|
10112
|
+
maximumFractionDigits: decimals,
|
|
10113
|
+
useGrouping: false,
|
|
10114
|
+
}
|
|
10115
|
+
: { useGrouping: false };
|
|
10116
|
+
return n.toLocaleString(locale, f);
|
|
10117
|
+
}
|
|
10118
|
+
}
|
|
10119
|
+
/**
|
|
10120
|
+
* Gets the number of decimals for current number
|
|
10121
|
+
* @param {number} value numer input
|
|
10122
|
+
* @returns {number} the number of decimals
|
|
10123
|
+
*/
|
|
10124
|
+
countDecimals(value) {
|
|
10125
|
+
var _a;
|
|
10126
|
+
if (Math.floor(value) === value)
|
|
10127
|
+
return 0;
|
|
10128
|
+
let stringValue = value.toString().split('.')[1];
|
|
10129
|
+
if (stringValue) {
|
|
10130
|
+
return (_a = stringValue.length) !== null && _a !== void 0 ? _a : 0;
|
|
10131
|
+
}
|
|
10132
|
+
else {
|
|
10133
|
+
return 0;
|
|
10134
|
+
}
|
|
10135
|
+
}
|
|
10136
|
+
/**
|
|
10137
|
+
* Gets the suffix for number, by type
|
|
10138
|
+
* @param {string} type - type of number for calculate suffix
|
|
10139
|
+
* @returns {string} suffix for number, by type
|
|
10140
|
+
**/
|
|
10141
|
+
getNumericValueSuffix(type) {
|
|
10142
|
+
type = type.toUpperCase();
|
|
10143
|
+
let nstr = '';
|
|
10144
|
+
if (type == 'P') {
|
|
10145
|
+
nstr = ' %';
|
|
10146
|
+
}
|
|
10147
|
+
else if (type == 'VE') {
|
|
10148
|
+
nstr = ' €';
|
|
10149
|
+
}
|
|
10150
|
+
else if (type == 'VL') {
|
|
10151
|
+
nstr = ' £';
|
|
10152
|
+
}
|
|
10153
|
+
else if (type == 'VV') {
|
|
10154
|
+
nstr = ' $';
|
|
10155
|
+
}
|
|
10156
|
+
return nstr;
|
|
10157
|
+
}
|
|
10158
|
+
/**
|
|
10159
|
+
* Gets the number as string, formatted by actual browser locale, with suffix by type
|
|
10160
|
+
* @param {number} input number
|
|
10161
|
+
* @param {number} decimals number of significant decimal digits for output
|
|
10162
|
+
* @param {string} type - type of number for calculate suffix
|
|
10163
|
+
* @returns {string} number as string, formatted by actual browser locale, with suffix by type
|
|
10164
|
+
**/
|
|
10165
|
+
numberToFormattedString(input, decimals, type) {
|
|
10166
|
+
if (input == null || isNaN(input)) {
|
|
10167
|
+
return '';
|
|
10168
|
+
}
|
|
10169
|
+
if (decimals == null || decimals == -1) {
|
|
10170
|
+
decimals = this.countDecimals(input);
|
|
10171
|
+
}
|
|
10172
|
+
let nstr = this.format(input, this.createFormatPattern(true, decimals));
|
|
10173
|
+
nstr = nstr + this.getNumericValueSuffix(type);
|
|
10174
|
+
return nstr;
|
|
10175
|
+
}
|
|
10176
|
+
/**
|
|
10177
|
+
* Gets the number as string, formatted by actual browser locale, with suffix by type
|
|
10178
|
+
* @param {string} input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
10179
|
+
* @param {number} decimals number of significant decimal digits for output
|
|
10180
|
+
* @param {string} type - type of number for calculate suffix
|
|
10181
|
+
* @param {string} decSeparator decimal separator for outpu string
|
|
10182
|
+
* @returns {string} number as string, formatted by actual browser locale (or using decimal separator param), with suffix by type
|
|
10183
|
+
**/
|
|
10184
|
+
numberStringToFormattedString(input, decimals, type, decSeparator) {
|
|
10185
|
+
let value = this.numberToFormattedString(this.numberifySafe(input), decimals, type);
|
|
10186
|
+
if (!decSeparator) {
|
|
10187
|
+
return value;
|
|
10188
|
+
}
|
|
10189
|
+
const browserDecSeparator = this.decimalSeparator();
|
|
10190
|
+
if (browserDecSeparator == decSeparator) {
|
|
10191
|
+
return value;
|
|
10192
|
+
}
|
|
10193
|
+
const browserGroupSeparator = this.groupSeparator();
|
|
10194
|
+
value = value.replace(getRegExpFromString(browserGroupSeparator, 'g'), '');
|
|
10195
|
+
value = value.replace(getRegExpFromString(browserDecSeparator, 'g'), decSeparator);
|
|
10196
|
+
return value;
|
|
10197
|
+
}
|
|
10041
10198
|
/**
|
|
10042
10199
|
* Registers a KupComponent in KupMath, in order to be properly handled whenever the locale changes.
|
|
10043
10200
|
* @param {any} component - The Ketchup component to be registered.
|
|
@@ -18406,22 +18563,17 @@ exports.compareCell = compareCell;
|
|
|
18406
18563
|
exports.createCommonjsModule = createCommonjsModule;
|
|
18407
18564
|
exports.editableTypes = editableTypes;
|
|
18408
18565
|
exports.fieldColumn = fieldColumn;
|
|
18409
|
-
exports.
|
|
18566
|
+
exports.fillString = fillString;
|
|
18410
18567
|
exports.formatToNumber = formatToNumber;
|
|
18411
|
-
exports.formattedStringToCustomUnformattedStringTime = formattedStringToCustomUnformattedStringTime;
|
|
18412
|
-
exports.formattedStringToUnformattedStringNumber = formattedStringToUnformattedStringNumber;
|
|
18413
18568
|
exports.fullWidthFieldsComps = fullWidthFieldsComps;
|
|
18414
18569
|
exports.getCellValueForDisplay = getCellValueForDisplay;
|
|
18415
18570
|
exports.getColumnByName = getColumnByName;
|
|
18416
18571
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
18417
|
-
exports.getMonthsAsStringByLocale = getMonthsAsStringByLocale;
|
|
18418
18572
|
exports.getProps = getProps;
|
|
18419
18573
|
exports.getValueForDisplay = getValueForDisplay;
|
|
18420
18574
|
exports.getValueForDisplay2 = getValueForDisplay2;
|
|
18421
18575
|
exports.iconColumn = iconColumn;
|
|
18422
18576
|
exports.identify = identify;
|
|
18423
|
-
exports.isNumber = isNumber;
|
|
18424
|
-
exports.isValidFormattedStringTime = isValidFormattedStringTime;
|
|
18425
18577
|
exports.keyColumn = keyColumn;
|
|
18426
18578
|
exports.kupDragActiveAttr = kupDragActiveAttr;
|
|
18427
18579
|
exports.kupDraggableCellAttr = kupDraggableCellAttr;
|
|
@@ -18431,8 +18583,4 @@ exports.kupDropEvent = kupDropEvent;
|
|
|
18431
18583
|
exports.kupDynamicPositionAttribute = kupDynamicPositionAttribute;
|
|
18432
18584
|
exports.kupManagerInstance = kupManagerInstance;
|
|
18433
18585
|
exports.kupTypes = kupTypes;
|
|
18434
|
-
exports.numberToFormattedStringNumber = numberToFormattedStringNumber;
|
|
18435
18586
|
exports.setProps = setProps;
|
|
18436
|
-
exports.stringToNumber = stringToNumber;
|
|
18437
|
-
exports.unformattedStringToFormattedStringNumber = unformattedStringToFormattedStringNumber;
|
|
18438
|
-
exports.unformattedStringToFormattedStringTime = unformattedStringToFormattedStringTime;
|