@sme.up/ketchup 4.3.0-SNAPSHOT → 5.1.0-SNAPSHOT
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/README.md +107 -3
- package/dist/cjs/{cell-utils-dc0884a3.js → cell-utils-9b1d6563.js} +4 -4
- package/dist/cjs/{component-8fbc31a2.js → component-d1496215.js} +203 -174
- package/dist/cjs/{f-button-2ba74fb5.js → f-button-02a7cde4.js} +2 -2
- package/dist/cjs/{f-cell-fe60a08d.js → f-cell-4d1450a8.js} +38 -28
- package/dist/cjs/f-chip-a50b9f00.js +130 -0
- package/dist/cjs/{f-image-d3bd4e08.js → f-image-db55ac49.js} +3 -3
- package/dist/cjs/{index-0416afab.js → index-ab119fad.js} +23 -0
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +7 -7
- package/dist/cjs/{kup-autocomplete_28.cjs.entry.js → kup-autocomplete_27.cjs.entry.js} +4636 -4073
- package/dist/cjs/kup-calendar.cjs.entry.js +626 -359
- package/dist/cjs/kup-cell.cjs.entry.js +15 -13
- package/dist/cjs/kup-dash-list.cjs.entry.js +4 -4
- package/dist/cjs/kup-dash_2.cjs.entry.js +8 -7
- package/dist/cjs/kup-drawer.cjs.entry.js +3 -3
- package/dist/cjs/kup-echart.cjs.entry.js +93039 -0
- package/dist/cjs/kup-field.cjs.entry.js +2 -2
- package/dist/cjs/kup-iframe.cjs.entry.js +3 -3
- package/dist/cjs/kup-lazy.cjs.entry.js +22 -5
- package/dist/cjs/kup-magic-box.cjs.entry.js +95 -42
- package/dist/cjs/{kup-manager-1a2688ca.js → kup-manager-5877b2ee.js} +3392 -753
- package/dist/cjs/kup-nav-bar.cjs.entry.js +3 -3
- package/dist/cjs/kup-probe.cjs.entry.js +2 -2
- package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
- package/dist/cjs/kup-snackbar.cjs.entry.js +5 -5
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{tslib.es6-4360c099.js → tslib.es6-0ee02c67.js} +13 -0
- package/dist/cjs/utils-1b5c8c70.js +482 -0
- package/dist/collection/assets/calendar.js +46 -1
- package/dist/collection/assets/card.js +15 -15
- package/dist/collection/assets/data-table.js +18 -6
- package/dist/collection/assets/index.js +8 -0
- package/dist/collection/assets/kupdata.js +937 -0
- package/dist/collection/collection-manifest.json +4 -4
- package/dist/collection/components/kup-accordion/kup-accordion.css +0 -1
- package/dist/collection/components/kup-accordion/kup-accordion.js +2 -2
- package/dist/collection/components/kup-autocomplete/kup-autocomplete-declarations.js +2 -0
- package/dist/collection/components/kup-autocomplete/kup-autocomplete.js +148 -52
- package/dist/collection/components/kup-badge/kup-badge.js +2 -2
- package/dist/collection/components/kup-box/kup-box.js +31 -17
- package/dist/collection/components/kup-button/kup-button.js +2 -2
- package/dist/collection/components/kup-button-list/kup-button-list.js +26 -8
- package/dist/collection/components/kup-calendar/kup-calendar-declarations.js +14 -8
- package/dist/collection/components/kup-calendar/kup-calendar.css +2 -2
- package/dist/collection/components/kup-calendar/kup-calendar.js +185 -315
- package/dist/collection/components/kup-card/built-in/kup-card-built-in.js +38 -0
- package/dist/collection/components/kup-card/{builtin → built-in}/kup-card-calendar.js +1 -1
- package/dist/collection/components/kup-card/{builtin → built-in}/kup-card-clock.js +32 -32
- package/dist/collection/components/kup-card/built-in/kup-card-column-drop-menu.js +167 -0
- package/dist/collection/components/kup-card/collapsible/kup-card-collapsible.js +1 -1
- package/dist/collection/components/kup-card/dialog/kup-card-dialog.js +2 -2
- package/dist/collection/components/kup-card/free/kup-card-free.js +11 -2
- package/dist/collection/components/kup-card/kup-card-declarations.js +14 -14
- package/dist/collection/components/kup-card/kup-card-helper.js +3 -3
- package/dist/collection/components/kup-card/kup-card.css +423 -137
- package/dist/collection/components/kup-card/kup-card.js +62 -11
- package/dist/collection/components/kup-card/scalable/kup-card-scalable.js +1 -1
- package/dist/collection/components/kup-card/standard/kup-card-standard.js +18 -5
- package/dist/collection/components/kup-cell/kup-cell.js +15 -13
- package/dist/collection/components/kup-chart/kup-chart-builder.js +3 -4
- package/dist/collection/components/kup-chart/kup-chart.js +7 -7
- package/dist/collection/components/kup-checkbox/kup-checkbox.js +1 -1
- package/dist/collection/components/kup-chip/kup-chip.css +1 -0
- package/dist/collection/components/kup-chip/kup-chip.js +51 -92
- package/dist/collection/components/kup-color-picker/kup-color-picker.css +1 -265
- package/dist/collection/components/kup-color-picker/kup-color-picker.js +93 -48
- package/dist/collection/components/kup-combobox/kup-combobox.js +148 -115
- package/dist/collection/components/kup-dash/kup-dash.js +1 -1
- package/dist/collection/components/kup-dash-list/kup-dash-list.js +5 -5
- package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +3 -1
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +28 -56
- package/dist/collection/components/kup-data-table/kup-data-table.css +4 -0
- package/dist/collection/components/kup-data-table/kup-data-table.js +345 -158
- package/dist/collection/components/kup-date-picker/kup-date-picker.js +8 -5
- package/dist/collection/components/kup-drawer/kup-drawer.js +1 -1
- package/dist/collection/components/kup-dropdown-button/kup-dropdown-button.js +2 -2
- package/dist/collection/components/kup-echart/assets/maps/africa.json +6116 -0
- package/dist/collection/components/kup-echart/assets/maps/america.json +5416 -0
- package/dist/collection/components/kup-echart/assets/maps/asia.json +6053 -0
- package/dist/collection/components/kup-echart/assets/maps/europe.json +5051 -0
- package/dist/collection/components/kup-echart/assets/maps/italy.json +3562 -0
- package/dist/collection/components/kup-echart/assets/maps/oceania.json +1069 -0
- package/dist/collection/components/kup-echart/assets/maps/world.json +23685 -0
- package/dist/collection/components/kup-echart/kup-echart-declarations.js +45 -0
- package/dist/collection/components/kup-echart/kup-echart.css +13 -0
- package/dist/collection/components/kup-echart/kup-echart.js +1165 -0
- package/dist/collection/components/kup-field/kup-field.js +2 -2
- package/dist/collection/components/kup-gauge/kup-gauge.js +3 -3
- package/dist/collection/components/kup-grid/kup-grid.css +2 -2
- package/dist/collection/components/kup-grid/kup-grid.js +6 -5
- package/dist/collection/components/kup-iframe/kup-iframe.js +2 -2
- package/dist/collection/components/kup-image/assets/svg/science.svg +1 -0
- package/dist/collection/components/kup-image/kup-image.js +3 -3
- package/dist/collection/components/kup-lazy/kup-lazy.css +21 -11
- package/dist/collection/components/kup-lazy/kup-lazy.js +62 -3
- package/dist/collection/components/kup-list/kup-list-helper.js +7 -1
- package/dist/collection/components/kup-list/kup-list.css +3 -0
- package/dist/collection/components/kup-list/kup-list.js +219 -288
- package/dist/collection/components/kup-magic-box/kup-magic-box-declarations.js +11 -7
- package/dist/collection/components/kup-magic-box/kup-magic-box.js +90 -41
- package/dist/collection/components/kup-nav-bar/kup-nav-bar.js +1 -1
- package/dist/collection/components/kup-probe/kup-probe.js +1 -1
- package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +1 -1
- package/dist/collection/components/kup-qlik/kup-qlik.js +1 -1
- package/dist/collection/components/kup-radio/kup-radio.js +1 -1
- package/dist/collection/components/kup-rating/kup-rating.js +1 -1
- package/dist/collection/components/kup-snackbar/kup-snackbar.js +1 -1
- package/dist/collection/components/kup-spinner/kup-spinner.js +1 -1
- package/dist/collection/components/kup-state/mock-store.js +1 -1
- package/dist/collection/components/kup-switch/kup-switch.js +1 -1
- package/dist/collection/components/kup-tab-bar/kup-tab-bar.js +3 -3
- package/dist/collection/components/kup-text-field/kup-text-field.css +2 -0
- package/dist/collection/components/kup-text-field/kup-text-field.js +2 -2
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +8 -5
- package/dist/collection/components/kup-tooltip/kup-tooltip.js +3 -3
- package/dist/collection/components/kup-tree/kup-tree-declarations.js +0 -5
- package/dist/collection/components/kup-tree/kup-tree-faker.js +2 -3
- package/dist/collection/components/kup-tree/kup-tree.css +2 -0
- package/dist/collection/components/kup-tree/kup-tree.js +145 -70
- package/dist/collection/f-components/f-cell/f-cell-declarations.js +3 -1
- package/dist/collection/f-components/f-cell/f-cell.js +29 -19
- package/dist/collection/f-components/f-chip/f-chip.js +76 -87
- package/dist/collection/f-components/f-image/f-image.js +2 -2
- package/dist/collection/f-components/f-paginator/f-paginator-declarations.js +5 -0
- package/dist/collection/f-components/f-paginator/f-paginator-utils.js +28 -0
- package/dist/collection/f-components/f-paginator/f-paginator.js +91 -0
- package/dist/collection/f-components/f-text-field/f-text-field.js +4 -4
- package/dist/collection/managers/kup-data/kup-data-cell-helper.js +52 -0
- package/dist/collection/managers/kup-data/kup-data-column-helper.js +272 -0
- package/dist/collection/managers/kup-data/kup-data-declarations.js +9 -0
- package/dist/collection/managers/kup-data/kup-data-node-helper.js +72 -0
- package/dist/collection/managers/kup-data/kup-data-row-helper.js +28 -0
- package/dist/collection/managers/kup-data/kup-data.js +382 -0
- package/dist/collection/{utils → managers}/kup-dates/kup-dates-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-dates/kup-dates.js +53 -19
- package/dist/collection/{utils → managers}/kup-debug/kup-debug-browser-utils.js +1 -1
- package/dist/collection/{utils → managers}/kup-debug/kup-debug-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-debug/kup-debug.js +79 -124
- package/dist/collection/{utils → managers}/kup-dynamic-position/kup-dynamic-position-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-dynamic-position/kup-dynamic-position.js +10 -1
- package/dist/collection/{utils → managers}/kup-interact/kup-interact-declarations.js +1 -0
- package/dist/collection/{utils → managers}/kup-interact/kup-interact.js +22 -13
- package/dist/collection/{utils → managers}/kup-language/kup-language-declarations.js +10 -0
- package/dist/collection/{utils → managers}/kup-language/kup-language.js +5 -5
- package/dist/collection/{utils → managers}/kup-manager/kup-manager-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-manager/kup-manager.js +45 -4
- package/dist/collection/managers/kup-math/kup-math-declarations.js +13 -0
- package/dist/collection/managers/kup-math/kup-math-helper.js +39 -0
- package/dist/collection/managers/kup-math/kup-math.js +151 -0
- package/dist/collection/{utils → managers}/kup-objects/kup-objects-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-objects/kup-objects.js +15 -0
- package/dist/collection/{utils → managers}/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-scroll-on-hover/kup-scroll-on-hover.js +0 -0
- package/dist/collection/{utils → managers}/kup-search/kup-search-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-search/kup-search.js +0 -0
- package/dist/collection/{utils → managers}/kup-theme/kup-theme-declarations.js +99 -0
- package/dist/collection/{utils → managers}/kup-theme/kup-theme.js +117 -68
- package/dist/collection/{utils → managers}/kup-toolbar/kup-toolbar-declarations.js +0 -0
- package/dist/collection/{utils → managers}/kup-toolbar/kup-toolbar.js +0 -0
- package/dist/collection/types/GenericTypes.js +48 -1
- package/dist/collection/utils/cell-utils.js +3 -4
- package/dist/collection/utils/filters/filters-column-menu.js +7 -7
- package/dist/collection/utils/filters/filters-rows.js +2 -2
- package/dist/collection/utils/filters/filters-tree-items.js +12 -12
- package/dist/collection/utils/filters/filters.js +3 -2
- package/dist/collection/utils/kup-column-menu/kup-column-menu-declarations.js +1 -0
- package/dist/collection/utils/kup-column-menu/kup-column-menu.js +100 -68
- package/dist/collection/utils/utils.js +4 -4
- package/dist/esm/{cell-utils-8f512ea9.js → cell-utils-571978d6.js} +4 -4
- package/dist/esm/{component-d2803feb.js → component-c4eb6153.js} +204 -170
- package/dist/esm/{f-button-30dbcaa9.js → f-button-b3011cc2.js} +2 -2
- package/dist/esm/{f-cell-95c186c6.js → f-cell-b88b2731.js} +38 -28
- package/dist/esm/f-chip-a52489ec.js +128 -0
- package/dist/esm/{f-image-3bc8b24f.js → f-image-5e5ed7e2.js} +3 -3
- package/dist/esm/{index-e0e67c23.js → index-78f3699d.js} +23 -0
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +7 -7
- package/dist/esm/{kup-autocomplete_28.entry.js → kup-autocomplete_27.entry.js} +4420 -3856
- package/dist/esm/kup-calendar.entry.js +626 -359
- package/dist/esm/kup-cell.entry.js +15 -13
- package/dist/esm/kup-dash-list.entry.js +4 -4
- package/dist/esm/kup-dash_2.entry.js +8 -7
- package/dist/esm/kup-drawer.entry.js +3 -3
- package/dist/esm/kup-echart.entry.js +93035 -0
- package/dist/esm/kup-field.entry.js +2 -2
- package/dist/esm/kup-iframe.entry.js +3 -3
- package/dist/esm/kup-lazy.entry.js +22 -5
- package/dist/esm/kup-magic-box.entry.js +95 -42
- package/dist/esm/{kup-manager-7fc234da.js → kup-manager-1f76a3ef.js} +3388 -753
- package/dist/esm/kup-nav-bar.entry.js +3 -3
- package/dist/esm/kup-probe.entry.js +2 -2
- package/dist/esm/kup-qlik.entry.js +2 -2
- package/dist/esm/kup-snackbar.entry.js +5 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{tslib.es6-e6137777.js → tslib.es6-8f2d44b6.js} +13 -1
- package/dist/esm/utils-93ae800f.js +461 -0
- package/dist/ketchup/assets/maps/africa.json +6116 -0
- package/dist/ketchup/assets/maps/america.json +5416 -0
- package/dist/ketchup/assets/maps/asia.json +6053 -0
- package/dist/ketchup/assets/maps/europe.json +5051 -0
- package/dist/ketchup/assets/maps/italy.json +3562 -0
- package/dist/ketchup/assets/maps/oceania.json +1069 -0
- package/dist/ketchup/assets/maps/world.json +23685 -0
- package/dist/ketchup/assets/svg/science.svg +1 -0
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-a878016f.entry.js → p-088a886c.entry.js} +1 -1
- package/dist/ketchup/p-135cabdc.entry.js +1 -0
- package/dist/ketchup/{p-1c6178e4.entry.js → p-1c1e830f.entry.js} +1 -1
- package/dist/ketchup/{p-62816d0b.entry.js → p-29208220.entry.js} +1 -1
- package/dist/ketchup/{p-ca0ca27f.entry.js → p-2b9f2019.entry.js} +1 -1
- package/dist/ketchup/p-52d0582a.js +1 -0
- package/dist/ketchup/p-554bd5f0.entry.js +39 -0
- package/dist/ketchup/{p-de83f2f6.js → p-5f52e313.js} +1 -1
- package/dist/ketchup/{p-ccda584a.entry.js → p-65449480.entry.js} +1 -1
- package/dist/ketchup/p-79cf3874.entry.js +1 -0
- package/dist/ketchup/p-7a85cda4.js +1 -0
- package/dist/ketchup/p-84cce555.entry.js +27 -0
- package/dist/ketchup/p-8c44c3b9.js +135 -0
- package/dist/ketchup/{p-65adc15b.entry.js → p-9d49cdb2.entry.js} +1 -1
- package/dist/ketchup/{p-5a4a5fdc.js → p-a0b1d769.js} +1 -1
- package/dist/ketchup/{p-dbb6998b.entry.js → p-a2b6672e.entry.js} +1 -1
- package/dist/ketchup/{p-a378ba56.entry.js → p-a4be630b.entry.js} +1 -1
- package/dist/ketchup/p-c072b270.js +1 -0
- package/dist/ketchup/{p-1baf1205.entry.js → p-c648972c.entry.js} +1 -1
- package/dist/ketchup/{p-af4a6191.entry.js → p-d67d39c0.entry.js} +1 -1
- package/dist/ketchup/p-d6e2f2b0.entry.js +1 -0
- package/dist/ketchup/{p-44375e49.js → p-da387e0e.js} +1 -1
- package/dist/ketchup/p-e5c9ec9e.js +1 -0
- package/dist/ketchup/{p-cb5f4994.js → p-ed0b8666.js} +0 -0
- package/dist/ketchup/p-ef539eda.js +9 -0
- package/dist/ketchup/p-f316234c.entry.js +143 -0
- package/dist/types/components/kup-accordion/kup-accordion-declarations.d.ts +2 -2
- package/dist/types/components/kup-autocomplete/kup-autocomplete-declarations.d.ts +6 -0
- package/dist/types/components/kup-autocomplete/kup-autocomplete.d.ts +29 -22
- package/dist/types/components/kup-box/kup-box-declarations.d.ts +7 -11
- package/dist/types/components/kup-box/kup-box.d.ts +4 -4
- package/dist/types/components/kup-button-list/kup-button-list-declarations.d.ts +6 -1
- package/dist/types/components/kup-button-list/kup-button-list.d.ts +4 -3
- package/dist/types/components/kup-calendar/kup-calendar-declarations.d.ts +28 -10
- package/dist/types/components/kup-calendar/kup-calendar.d.ts +19 -47
- package/dist/types/components/kup-card/built-in/kup-card-built-in.d.ts +27 -0
- package/dist/types/components/kup-card/{builtin → built-in}/kup-card-calendar.d.ts +0 -0
- package/dist/types/components/kup-card/{builtin → built-in}/kup-card-clock.d.ts +0 -0
- package/dist/types/components/kup-card/built-in/kup-card-column-drop-menu.d.ts +3 -0
- package/dist/types/components/kup-card/free/kup-card-free.d.ts +7 -1
- package/dist/types/components/kup-card/kup-card-declarations.d.ts +46 -21
- package/dist/types/components/kup-card/kup-card.d.ts +9 -2
- package/dist/types/components/kup-cell/kup-cell.d.ts +3 -3
- package/dist/types/components/kup-chart/kup-chart-builder.d.ts +5 -5
- package/dist/types/components/kup-chart/kup-chart-declarations.d.ts +3 -3
- package/dist/types/components/kup-chart/kup-chart.d.ts +2 -2
- package/dist/types/components/kup-chip/kup-chip-declarations.d.ts +6 -3
- package/dist/types/components/kup-chip/kup-chip.d.ts +9 -13
- package/dist/types/components/kup-color-picker/kup-color-picker.d.ts +7 -3
- package/dist/types/components/kup-combobox/kup-combobox-declarations.d.ts +4 -0
- package/dist/types/components/kup-combobox/kup-combobox.d.ts +11 -33
- package/dist/types/components/kup-dash-list/kup-dash-list.d.ts +2 -2
- package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +45 -104
- package/dist/types/components/kup-data-table/kup-data-table-helper.d.ts +8 -11
- package/dist/types/components/kup-data-table/kup-data-table.d.ts +49 -27
- package/dist/types/components/kup-echart/kup-echart-declarations.d.ts +55 -0
- package/dist/types/components/kup-echart/kup-echart.d.ts +100 -0
- package/dist/types/components/kup-lazy/kup-lazy.d.ts +13 -1
- package/dist/types/components/kup-list/kup-list-declarations.d.ts +2 -1
- package/dist/types/components/kup-list/kup-list.d.ts +4 -35
- package/dist/types/components/kup-magic-box/kup-magic-box-declarations.d.ts +6 -10
- package/dist/types/components/kup-magic-box/kup-magic-box.d.ts +7 -11
- package/dist/types/components/kup-tooltip/kup-tooltip-declarations.d.ts +11 -13
- package/dist/types/components/kup-tree/kup-tree-declarations.d.ts +14 -35
- package/dist/types/components/kup-tree/kup-tree-faker.d.ts +10 -10
- package/dist/types/components/kup-tree/kup-tree.d.ts +45 -35
- package/dist/types/components.d.ts +305 -186
- package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +11 -10
- package/dist/types/f-components/f-chip/f-chip-declarations.d.ts +7 -22
- package/dist/types/f-components/f-paginator/f-paginator-declarations.d.ts +22 -0
- package/dist/types/f-components/f-paginator/f-paginator-utils.d.ts +2 -0
- package/dist/types/f-components/f-paginator/f-paginator.d.ts +3 -0
- package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +24 -0
- package/dist/types/managers/kup-data/kup-data-column-helper.d.ts +31 -0
- package/dist/types/managers/kup-data/kup-data-declarations.d.ts +160 -0
- package/dist/types/managers/kup-data/kup-data-node-helper.d.ts +23 -0
- package/dist/types/managers/kup-data/kup-data-row-helper.d.ts +14 -0
- package/dist/types/managers/kup-data/kup-data.d.ts +77 -0
- package/dist/types/{utils → managers}/kup-dates/kup-dates-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-dates/kup-dates.d.ts +24 -2
- package/dist/types/{utils → managers}/kup-debug/kup-debug-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-debug/kup-debug.d.ts +6 -13
- package/dist/types/{utils → managers}/kup-dynamic-position/kup-dynamic-position-declarations.d.ts +1 -0
- package/dist/types/{utils → managers}/kup-dynamic-position/kup-dynamic-position.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-interact/kup-interact-declarations.d.ts +9 -8
- package/dist/types/{utils → managers}/kup-interact/kup-interact.d.ts +7 -6
- package/dist/types/{utils → managers}/kup-language/kup-language-declarations.d.ts +11 -1
- package/dist/types/{utils → managers}/kup-language/kup-language.d.ts +3 -3
- package/dist/types/{utils → managers}/kup-manager/kup-manager-declarations.d.ts +21 -2
- package/dist/types/{utils → managers}/kup-manager/kup-manager.d.ts +4 -0
- package/dist/types/managers/kup-math/kup-math-declarations.d.ts +21 -0
- package/dist/types/managers/kup-math/kup-math-helper.d.ts +17 -0
- package/dist/types/managers/kup-math/kup-math.d.ts +60 -0
- package/dist/types/{utils → managers}/kup-objects/kup-objects-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-objects/kup-objects.d.ts +6 -0
- package/dist/types/{utils → managers}/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-search/kup-search-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-search/kup-search.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-theme/kup-theme-declarations.d.ts +37 -1
- package/dist/types/{utils → managers}/kup-theme/kup-theme.d.ts +19 -19
- package/dist/types/{utils → managers}/kup-toolbar/kup-toolbar-declarations.d.ts +0 -0
- package/dist/types/{utils → managers}/kup-toolbar/kup-toolbar.d.ts +0 -0
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/types/GenericTypes.d.ts +53 -6
- package/dist/types/utils/cell-utils.d.ts +7 -6
- package/dist/types/utils/filters/filters-column-menu.d.ts +16 -16
- package/dist/types/utils/filters/filters-rows.d.ts +10 -10
- package/dist/types/utils/filters/filters-tree-items.d.ts +7 -7
- package/dist/types/utils/helpers.d.ts +2 -2
- package/dist/types/utils/kup-column-menu/kup-column-menu-declarations.d.ts +1 -0
- package/dist/types/utils/kup-column-menu/kup-column-menu.d.ts +27 -33
- package/dist/types/utils/utils.d.ts +4 -2
- package/package.json +31 -26
- package/dist/cjs/f-chip-90d95d22.js +0 -141
- package/dist/cjs/utils-0cc466b9.js +0 -1492
- package/dist/collection/components/kup-card/builtin/kup-card-builtin.js +0 -20
- package/dist/collection/components/kup-paginator/kup-paginator-declarations.js +0 -5
- package/dist/collection/components/kup-paginator/kup-paginator.css +0 -46
- package/dist/collection/components/kup-paginator/kup-paginator.js +0 -408
- package/dist/esm/f-chip-c0e9c0ff.js +0 -139
- package/dist/esm/utils-6c73709d.js +0 -1470
- package/dist/ketchup/p-15321eae.js +0 -1
- package/dist/ketchup/p-5a5f2a53.js +0 -1
- package/dist/ketchup/p-61faaa38.js +0 -8
- package/dist/ketchup/p-7e23ea7c.entry.js +0 -1
- package/dist/ketchup/p-9d02a676.js +0 -134
- package/dist/ketchup/p-a96e6e32.entry.js +0 -1
- package/dist/ketchup/p-ad32821e.entry.js +0 -1
- package/dist/ketchup/p-c18c7bb0.entry.js +0 -27
- package/dist/ketchup/p-d4aa4922.js +0 -1
- package/dist/ketchup/p-ec3a3db9.js +0 -1
- package/dist/ketchup/p-ecccb3a4.entry.js +0 -45
- package/dist/types/components/kup-card/builtin/kup-card-builtin.d.ts +0 -14
- package/dist/types/components/kup-paginator/kup-paginator-declarations.d.ts +0 -11
- package/dist/types/components/kup-paginator/kup-paginator.d.ts +0 -48
|
@@ -1,1492 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const kupManager = require('./kup-manager-1a2688ca.js');
|
|
4
|
-
|
|
5
|
-
var numeral = kupManager.createCommonjsModule(function (module) {
|
|
6
|
-
/*! @preserve
|
|
7
|
-
* numeral.js
|
|
8
|
-
* version : 2.0.6
|
|
9
|
-
* author : Adam Draper
|
|
10
|
-
* license : MIT
|
|
11
|
-
* http://adamwdraper.github.com/Numeral-js/
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
(function (global, factory) {
|
|
15
|
-
if (module.exports) {
|
|
16
|
-
module.exports = factory();
|
|
17
|
-
} else {
|
|
18
|
-
global.numeral = factory();
|
|
19
|
-
}
|
|
20
|
-
}(kupManager.commonjsGlobal, function () {
|
|
21
|
-
/************************************
|
|
22
|
-
Variables
|
|
23
|
-
************************************/
|
|
24
|
-
|
|
25
|
-
var numeral,
|
|
26
|
-
_,
|
|
27
|
-
VERSION = '2.0.6',
|
|
28
|
-
formats = {},
|
|
29
|
-
locales = {},
|
|
30
|
-
defaults = {
|
|
31
|
-
currentLocale: 'en',
|
|
32
|
-
zeroFormat: null,
|
|
33
|
-
nullFormat: null,
|
|
34
|
-
defaultFormat: '0,0',
|
|
35
|
-
scalePercentBy100: true
|
|
36
|
-
},
|
|
37
|
-
options = {
|
|
38
|
-
currentLocale: defaults.currentLocale,
|
|
39
|
-
zeroFormat: defaults.zeroFormat,
|
|
40
|
-
nullFormat: defaults.nullFormat,
|
|
41
|
-
defaultFormat: defaults.defaultFormat,
|
|
42
|
-
scalePercentBy100: defaults.scalePercentBy100
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/************************************
|
|
47
|
-
Constructors
|
|
48
|
-
************************************/
|
|
49
|
-
|
|
50
|
-
// Numeral prototype object
|
|
51
|
-
function Numeral(input, number) {
|
|
52
|
-
this._input = input;
|
|
53
|
-
|
|
54
|
-
this._value = number;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
numeral = function(input) {
|
|
58
|
-
var value,
|
|
59
|
-
kind,
|
|
60
|
-
unformatFunction,
|
|
61
|
-
regexp;
|
|
62
|
-
|
|
63
|
-
if (numeral.isNumeral(input)) {
|
|
64
|
-
value = input.value();
|
|
65
|
-
} else if (input === 0 || typeof input === 'undefined') {
|
|
66
|
-
value = 0;
|
|
67
|
-
} else if (input === null || _.isNaN(input)) {
|
|
68
|
-
value = null;
|
|
69
|
-
} else if (typeof input === 'string') {
|
|
70
|
-
if (options.zeroFormat && input === options.zeroFormat) {
|
|
71
|
-
value = 0;
|
|
72
|
-
} else if (options.nullFormat && input === options.nullFormat || !input.replace(/[^0-9]+/g, '').length) {
|
|
73
|
-
value = null;
|
|
74
|
-
} else {
|
|
75
|
-
for (kind in formats) {
|
|
76
|
-
regexp = typeof formats[kind].regexps.unformat === 'function' ? formats[kind].regexps.unformat() : formats[kind].regexps.unformat;
|
|
77
|
-
|
|
78
|
-
if (regexp && input.match(regexp)) {
|
|
79
|
-
unformatFunction = formats[kind].unformat;
|
|
80
|
-
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
unformatFunction = unformatFunction || numeral._.stringToNumber;
|
|
86
|
-
|
|
87
|
-
value = unformatFunction(input);
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
value = Number(input)|| null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return new Numeral(input, value);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// version number
|
|
97
|
-
numeral.version = VERSION;
|
|
98
|
-
|
|
99
|
-
// compare numeral object
|
|
100
|
-
numeral.isNumeral = function(obj) {
|
|
101
|
-
return obj instanceof Numeral;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// helper functions
|
|
105
|
-
numeral._ = _ = {
|
|
106
|
-
// formats numbers separators, decimals places, signs, abbreviations
|
|
107
|
-
numberToFormat: function(value, format, roundingFunction) {
|
|
108
|
-
var locale = locales[numeral.options.currentLocale],
|
|
109
|
-
negP = false,
|
|
110
|
-
optDec = false,
|
|
111
|
-
leadingCount = 0,
|
|
112
|
-
abbr = '',
|
|
113
|
-
trillion = 1000000000000,
|
|
114
|
-
billion = 1000000000,
|
|
115
|
-
million = 1000000,
|
|
116
|
-
thousand = 1000,
|
|
117
|
-
decimal = '',
|
|
118
|
-
neg = false,
|
|
119
|
-
abbrForce, // force abbreviation
|
|
120
|
-
abs,
|
|
121
|
-
int,
|
|
122
|
-
precision,
|
|
123
|
-
signed,
|
|
124
|
-
thousands,
|
|
125
|
-
output;
|
|
126
|
-
|
|
127
|
-
// make sure we never format a null value
|
|
128
|
-
value = value || 0;
|
|
129
|
-
|
|
130
|
-
abs = Math.abs(value);
|
|
131
|
-
|
|
132
|
-
// see if we should use parentheses for negative number or if we should prefix with a sign
|
|
133
|
-
// if both are present we default to parentheses
|
|
134
|
-
if (numeral._.includes(format, '(')) {
|
|
135
|
-
negP = true;
|
|
136
|
-
format = format.replace(/[\(|\)]/g, '');
|
|
137
|
-
} else if (numeral._.includes(format, '+') || numeral._.includes(format, '-')) {
|
|
138
|
-
signed = numeral._.includes(format, '+') ? format.indexOf('+') : value < 0 ? format.indexOf('-') : -1;
|
|
139
|
-
format = format.replace(/[\+|\-]/g, '');
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// see if abbreviation is wanted
|
|
143
|
-
if (numeral._.includes(format, 'a')) {
|
|
144
|
-
abbrForce = format.match(/a(k|m|b|t)?/);
|
|
145
|
-
|
|
146
|
-
abbrForce = abbrForce ? abbrForce[1] : false;
|
|
147
|
-
|
|
148
|
-
// check for space before abbreviation
|
|
149
|
-
if (numeral._.includes(format, ' a')) {
|
|
150
|
-
abbr = ' ';
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
format = format.replace(new RegExp(abbr + 'a[kmbt]?'), '');
|
|
154
|
-
|
|
155
|
-
if (abs >= trillion && !abbrForce || abbrForce === 't') {
|
|
156
|
-
// trillion
|
|
157
|
-
abbr += locale.abbreviations.trillion;
|
|
158
|
-
value = value / trillion;
|
|
159
|
-
} else if (abs < trillion && abs >= billion && !abbrForce || abbrForce === 'b') {
|
|
160
|
-
// billion
|
|
161
|
-
abbr += locale.abbreviations.billion;
|
|
162
|
-
value = value / billion;
|
|
163
|
-
} else if (abs < billion && abs >= million && !abbrForce || abbrForce === 'm') {
|
|
164
|
-
// million
|
|
165
|
-
abbr += locale.abbreviations.million;
|
|
166
|
-
value = value / million;
|
|
167
|
-
} else if (abs < million && abs >= thousand && !abbrForce || abbrForce === 'k') {
|
|
168
|
-
// thousand
|
|
169
|
-
abbr += locale.abbreviations.thousand;
|
|
170
|
-
value = value / thousand;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// check for optional decimals
|
|
175
|
-
if (numeral._.includes(format, '[.]')) {
|
|
176
|
-
optDec = true;
|
|
177
|
-
format = format.replace('[.]', '.');
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// break number and format
|
|
181
|
-
int = value.toString().split('.')[0];
|
|
182
|
-
precision = format.split('.')[1];
|
|
183
|
-
thousands = format.indexOf(',');
|
|
184
|
-
leadingCount = (format.split('.')[0].split(',')[0].match(/0/g) || []).length;
|
|
185
|
-
|
|
186
|
-
if (precision) {
|
|
187
|
-
if (numeral._.includes(precision, '[')) {
|
|
188
|
-
precision = precision.replace(']', '');
|
|
189
|
-
precision = precision.split('[');
|
|
190
|
-
decimal = numeral._.toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);
|
|
191
|
-
} else {
|
|
192
|
-
decimal = numeral._.toFixed(value, precision.length, roundingFunction);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
int = decimal.split('.')[0];
|
|
196
|
-
|
|
197
|
-
if (numeral._.includes(decimal, '.')) {
|
|
198
|
-
decimal = locale.delimiters.decimal + decimal.split('.')[1];
|
|
199
|
-
} else {
|
|
200
|
-
decimal = '';
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (optDec && Number(decimal.slice(1)) === 0) {
|
|
204
|
-
decimal = '';
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
int = numeral._.toFixed(value, 0, roundingFunction);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// check abbreviation again after rounding
|
|
211
|
-
if (abbr && !abbrForce && Number(int) >= 1000 && abbr !== locale.abbreviations.trillion) {
|
|
212
|
-
int = String(Number(int) / 1000);
|
|
213
|
-
|
|
214
|
-
switch (abbr) {
|
|
215
|
-
case locale.abbreviations.thousand:
|
|
216
|
-
abbr = locale.abbreviations.million;
|
|
217
|
-
break;
|
|
218
|
-
case locale.abbreviations.million:
|
|
219
|
-
abbr = locale.abbreviations.billion;
|
|
220
|
-
break;
|
|
221
|
-
case locale.abbreviations.billion:
|
|
222
|
-
abbr = locale.abbreviations.trillion;
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// format number
|
|
229
|
-
if (numeral._.includes(int, '-')) {
|
|
230
|
-
int = int.slice(1);
|
|
231
|
-
neg = true;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (int.length < leadingCount) {
|
|
235
|
-
for (var i = leadingCount - int.length; i > 0; i--) {
|
|
236
|
-
int = '0' + int;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (thousands > -1) {
|
|
241
|
-
int = int.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1' + locale.delimiters.thousands);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (format.indexOf('.') === 0) {
|
|
245
|
-
int = '';
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
output = int + decimal + (abbr ? abbr : '');
|
|
249
|
-
|
|
250
|
-
if (negP) {
|
|
251
|
-
output = (negP && neg ? '(' : '') + output + (negP && neg ? ')' : '');
|
|
252
|
-
} else {
|
|
253
|
-
if (signed >= 0) {
|
|
254
|
-
output = signed === 0 ? (neg ? '-' : '+') + output : output + (neg ? '-' : '+');
|
|
255
|
-
} else if (neg) {
|
|
256
|
-
output = '-' + output;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return output;
|
|
261
|
-
},
|
|
262
|
-
// unformats numbers separators, decimals places, signs, abbreviations
|
|
263
|
-
stringToNumber: function(string) {
|
|
264
|
-
var locale = locales[options.currentLocale],
|
|
265
|
-
stringOriginal = string,
|
|
266
|
-
abbreviations = {
|
|
267
|
-
thousand: 3,
|
|
268
|
-
million: 6,
|
|
269
|
-
billion: 9,
|
|
270
|
-
trillion: 12
|
|
271
|
-
},
|
|
272
|
-
abbreviation,
|
|
273
|
-
value,
|
|
274
|
-
regexp;
|
|
275
|
-
|
|
276
|
-
if (options.zeroFormat && string === options.zeroFormat) {
|
|
277
|
-
value = 0;
|
|
278
|
-
} else if (options.nullFormat && string === options.nullFormat || !string.replace(/[^0-9]+/g, '').length) {
|
|
279
|
-
value = null;
|
|
280
|
-
} else {
|
|
281
|
-
value = 1;
|
|
282
|
-
|
|
283
|
-
if (locale.delimiters.decimal !== '.') {
|
|
284
|
-
string = string.replace(/\./g, '').replace(locale.delimiters.decimal, '.');
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
for (abbreviation in abbreviations) {
|
|
288
|
-
regexp = new RegExp('[^a-zA-Z]' + locale.abbreviations[abbreviation] + '(?:\\)|(\\' + locale.currency.symbol + ')?(?:\\))?)?$');
|
|
289
|
-
|
|
290
|
-
if (stringOriginal.match(regexp)) {
|
|
291
|
-
value *= Math.pow(10, abbreviations[abbreviation]);
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// check for negative number
|
|
297
|
-
value *= (string.split('-').length + Math.min(string.split('(').length - 1, string.split(')').length - 1)) % 2 ? 1 : -1;
|
|
298
|
-
|
|
299
|
-
// remove non numbers
|
|
300
|
-
string = string.replace(/[^0-9\.]+/g, '');
|
|
301
|
-
|
|
302
|
-
value *= Number(string);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return value;
|
|
306
|
-
},
|
|
307
|
-
isNaN: function(value) {
|
|
308
|
-
return typeof value === 'number' && isNaN(value);
|
|
309
|
-
},
|
|
310
|
-
includes: function(string, search) {
|
|
311
|
-
return string.indexOf(search) !== -1;
|
|
312
|
-
},
|
|
313
|
-
insert: function(string, subString, start) {
|
|
314
|
-
return string.slice(0, start) + subString + string.slice(start);
|
|
315
|
-
},
|
|
316
|
-
reduce: function(array, callback /*, initialValue*/) {
|
|
317
|
-
if (this === null) {
|
|
318
|
-
throw new TypeError('Array.prototype.reduce called on null or undefined');
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (typeof callback !== 'function') {
|
|
322
|
-
throw new TypeError(callback + ' is not a function');
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
var t = Object(array),
|
|
326
|
-
len = t.length >>> 0,
|
|
327
|
-
k = 0,
|
|
328
|
-
value;
|
|
329
|
-
|
|
330
|
-
if (arguments.length === 3) {
|
|
331
|
-
value = arguments[2];
|
|
332
|
-
} else {
|
|
333
|
-
while (k < len && !(k in t)) {
|
|
334
|
-
k++;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (k >= len) {
|
|
338
|
-
throw new TypeError('Reduce of empty array with no initial value');
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
value = t[k++];
|
|
342
|
-
}
|
|
343
|
-
for (; k < len; k++) {
|
|
344
|
-
if (k in t) {
|
|
345
|
-
value = callback(value, t[k], k, t);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return value;
|
|
349
|
-
},
|
|
350
|
-
/**
|
|
351
|
-
* Computes the multiplier necessary to make x >= 1,
|
|
352
|
-
* effectively eliminating miscalculations caused by
|
|
353
|
-
* finite precision.
|
|
354
|
-
*/
|
|
355
|
-
multiplier: function (x) {
|
|
356
|
-
var parts = x.toString().split('.');
|
|
357
|
-
|
|
358
|
-
return parts.length < 2 ? 1 : Math.pow(10, parts[1].length);
|
|
359
|
-
},
|
|
360
|
-
/**
|
|
361
|
-
* Given a variable number of arguments, returns the maximum
|
|
362
|
-
* multiplier that must be used to normalize an operation involving
|
|
363
|
-
* all of them.
|
|
364
|
-
*/
|
|
365
|
-
correctionFactor: function () {
|
|
366
|
-
var args = Array.prototype.slice.call(arguments);
|
|
367
|
-
|
|
368
|
-
return args.reduce(function(accum, next) {
|
|
369
|
-
var mn = _.multiplier(next);
|
|
370
|
-
return accum > mn ? accum : mn;
|
|
371
|
-
}, 1);
|
|
372
|
-
},
|
|
373
|
-
/**
|
|
374
|
-
* Implementation of toFixed() that treats floats more like decimals
|
|
375
|
-
*
|
|
376
|
-
* Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present
|
|
377
|
-
* problems for accounting- and finance-related software.
|
|
378
|
-
*/
|
|
379
|
-
toFixed: function(value, maxDecimals, roundingFunction, optionals) {
|
|
380
|
-
var splitValue = value.toString().split('.'),
|
|
381
|
-
minDecimals = maxDecimals - (optionals || 0),
|
|
382
|
-
boundedPrecision,
|
|
383
|
-
optionalsRegExp,
|
|
384
|
-
power,
|
|
385
|
-
output;
|
|
386
|
-
|
|
387
|
-
// Use the smallest precision value possible to avoid errors from floating point representation
|
|
388
|
-
if (splitValue.length === 2) {
|
|
389
|
-
boundedPrecision = Math.min(Math.max(splitValue[1].length, minDecimals), maxDecimals);
|
|
390
|
-
} else {
|
|
391
|
-
boundedPrecision = minDecimals;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
power = Math.pow(10, boundedPrecision);
|
|
395
|
-
|
|
396
|
-
// Multiply up by precision, round accurately, then divide and use native toFixed():
|
|
397
|
-
output = (roundingFunction(value + 'e+' + boundedPrecision) / power).toFixed(boundedPrecision);
|
|
398
|
-
|
|
399
|
-
if (optionals > maxDecimals - boundedPrecision) {
|
|
400
|
-
optionalsRegExp = new RegExp('\\.?0{1,' + (optionals - (maxDecimals - boundedPrecision)) + '}$');
|
|
401
|
-
output = output.replace(optionalsRegExp, '');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
return output;
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
// avaliable options
|
|
409
|
-
numeral.options = options;
|
|
410
|
-
|
|
411
|
-
// avaliable formats
|
|
412
|
-
numeral.formats = formats;
|
|
413
|
-
|
|
414
|
-
// avaliable formats
|
|
415
|
-
numeral.locales = locales;
|
|
416
|
-
|
|
417
|
-
// This function sets the current locale. If
|
|
418
|
-
// no arguments are passed in, it will simply return the current global
|
|
419
|
-
// locale key.
|
|
420
|
-
numeral.locale = function(key) {
|
|
421
|
-
if (key) {
|
|
422
|
-
options.currentLocale = key.toLowerCase();
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
return options.currentLocale;
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// This function provides access to the loaded locale data. If
|
|
429
|
-
// no arguments are passed in, it will simply return the current
|
|
430
|
-
// global locale object.
|
|
431
|
-
numeral.localeData = function(key) {
|
|
432
|
-
if (!key) {
|
|
433
|
-
return locales[options.currentLocale];
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
key = key.toLowerCase();
|
|
437
|
-
|
|
438
|
-
if (!locales[key]) {
|
|
439
|
-
throw new Error('Unknown locale : ' + key);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return locales[key];
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
numeral.reset = function() {
|
|
446
|
-
for (var property in defaults) {
|
|
447
|
-
options[property] = defaults[property];
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
numeral.zeroFormat = function(format) {
|
|
452
|
-
options.zeroFormat = typeof(format) === 'string' ? format : null;
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
numeral.nullFormat = function (format) {
|
|
456
|
-
options.nullFormat = typeof(format) === 'string' ? format : null;
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
numeral.defaultFormat = function(format) {
|
|
460
|
-
options.defaultFormat = typeof(format) === 'string' ? format : '0.0';
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
numeral.register = function(type, name, format) {
|
|
464
|
-
name = name.toLowerCase();
|
|
465
|
-
|
|
466
|
-
if (this[type + 's'][name]) {
|
|
467
|
-
throw new TypeError(name + ' ' + type + ' already registered.');
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
this[type + 's'][name] = format;
|
|
471
|
-
|
|
472
|
-
return format;
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
numeral.validate = function(val, culture) {
|
|
477
|
-
var _decimalSep,
|
|
478
|
-
_thousandSep,
|
|
479
|
-
_currSymbol,
|
|
480
|
-
_valArray,
|
|
481
|
-
_abbrObj,
|
|
482
|
-
_thousandRegEx,
|
|
483
|
-
localeData,
|
|
484
|
-
temp;
|
|
485
|
-
|
|
486
|
-
//coerce val to string
|
|
487
|
-
if (typeof val !== 'string') {
|
|
488
|
-
val += '';
|
|
489
|
-
|
|
490
|
-
if (console.warn) {
|
|
491
|
-
console.warn('Numeral.js: Value is not string. It has been co-erced to: ', val);
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
//trim whitespaces from either sides
|
|
496
|
-
val = val.trim();
|
|
497
|
-
|
|
498
|
-
//if val is just digits return true
|
|
499
|
-
if (!!val.match(/^\d+$/)) {
|
|
500
|
-
return true;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
//if val is empty return false
|
|
504
|
-
if (val === '') {
|
|
505
|
-
return false;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
//get the decimal and thousands separator from numeral.localeData
|
|
509
|
-
try {
|
|
510
|
-
//check if the culture is understood by numeral. if not, default it to current locale
|
|
511
|
-
localeData = numeral.localeData(culture);
|
|
512
|
-
} catch (e) {
|
|
513
|
-
localeData = numeral.localeData(numeral.locale());
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
//setup the delimiters and currency symbol based on culture/locale
|
|
517
|
-
_currSymbol = localeData.currency.symbol;
|
|
518
|
-
_abbrObj = localeData.abbreviations;
|
|
519
|
-
_decimalSep = localeData.delimiters.decimal;
|
|
520
|
-
if (localeData.delimiters.thousands === '.') {
|
|
521
|
-
_thousandSep = '\\.';
|
|
522
|
-
} else {
|
|
523
|
-
_thousandSep = localeData.delimiters.thousands;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// validating currency symbol
|
|
527
|
-
temp = val.match(/^[^\d]+/);
|
|
528
|
-
if (temp !== null) {
|
|
529
|
-
val = val.substr(1);
|
|
530
|
-
if (temp[0] !== _currSymbol) {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
//validating abbreviation symbol
|
|
536
|
-
temp = val.match(/[^\d]+$/);
|
|
537
|
-
if (temp !== null) {
|
|
538
|
-
val = val.slice(0, -1);
|
|
539
|
-
if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million && temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {
|
|
540
|
-
return false;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
_thousandRegEx = new RegExp(_thousandSep + '{2}');
|
|
545
|
-
|
|
546
|
-
if (!val.match(/[^\d.,]/g)) {
|
|
547
|
-
_valArray = val.split(_decimalSep);
|
|
548
|
-
if (_valArray.length > 2) {
|
|
549
|
-
return false;
|
|
550
|
-
} else {
|
|
551
|
-
if (_valArray.length < 2) {
|
|
552
|
-
return ( !! _valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx));
|
|
553
|
-
} else {
|
|
554
|
-
if (_valArray[0].length === 1) {
|
|
555
|
-
return ( !! _valArray[0].match(/^\d+$/) && !_valArray[0].match(_thousandRegEx) && !! _valArray[1].match(/^\d+$/));
|
|
556
|
-
} else {
|
|
557
|
-
return ( !! _valArray[0].match(/^\d+.*\d$/) && !_valArray[0].match(_thousandRegEx) && !! _valArray[1].match(/^\d+$/));
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
return false;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
/************************************
|
|
568
|
-
Numeral Prototype
|
|
569
|
-
************************************/
|
|
570
|
-
|
|
571
|
-
numeral.fn = Numeral.prototype = {
|
|
572
|
-
clone: function() {
|
|
573
|
-
return numeral(this);
|
|
574
|
-
},
|
|
575
|
-
format: function(inputString, roundingFunction) {
|
|
576
|
-
var value = this._value,
|
|
577
|
-
format = inputString || options.defaultFormat,
|
|
578
|
-
kind,
|
|
579
|
-
output,
|
|
580
|
-
formatFunction;
|
|
581
|
-
|
|
582
|
-
// make sure we have a roundingFunction
|
|
583
|
-
roundingFunction = roundingFunction || Math.round;
|
|
584
|
-
|
|
585
|
-
// format based on value
|
|
586
|
-
if (value === 0 && options.zeroFormat !== null) {
|
|
587
|
-
output = options.zeroFormat;
|
|
588
|
-
} else if (value === null && options.nullFormat !== null) {
|
|
589
|
-
output = options.nullFormat;
|
|
590
|
-
} else {
|
|
591
|
-
for (kind in formats) {
|
|
592
|
-
if (format.match(formats[kind].regexps.format)) {
|
|
593
|
-
formatFunction = formats[kind].format;
|
|
594
|
-
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
formatFunction = formatFunction || numeral._.numberToFormat;
|
|
600
|
-
|
|
601
|
-
output = formatFunction(value, format, roundingFunction);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
return output;
|
|
605
|
-
},
|
|
606
|
-
value: function() {
|
|
607
|
-
return this._value;
|
|
608
|
-
},
|
|
609
|
-
input: function() {
|
|
610
|
-
return this._input;
|
|
611
|
-
},
|
|
612
|
-
set: function(value) {
|
|
613
|
-
this._value = Number(value);
|
|
614
|
-
|
|
615
|
-
return this;
|
|
616
|
-
},
|
|
617
|
-
add: function(value) {
|
|
618
|
-
var corrFactor = _.correctionFactor.call(null, this._value, value);
|
|
619
|
-
|
|
620
|
-
function cback(accum, curr, currI, O) {
|
|
621
|
-
return accum + Math.round(corrFactor * curr);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
this._value = _.reduce([this._value, value], cback, 0) / corrFactor;
|
|
625
|
-
|
|
626
|
-
return this;
|
|
627
|
-
},
|
|
628
|
-
subtract: function(value) {
|
|
629
|
-
var corrFactor = _.correctionFactor.call(null, this._value, value);
|
|
630
|
-
|
|
631
|
-
function cback(accum, curr, currI, O) {
|
|
632
|
-
return accum - Math.round(corrFactor * curr);
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
this._value = _.reduce([value], cback, Math.round(this._value * corrFactor)) / corrFactor;
|
|
636
|
-
|
|
637
|
-
return this;
|
|
638
|
-
},
|
|
639
|
-
multiply: function(value) {
|
|
640
|
-
function cback(accum, curr, currI, O) {
|
|
641
|
-
var corrFactor = _.correctionFactor(accum, curr);
|
|
642
|
-
return Math.round(accum * corrFactor) * Math.round(curr * corrFactor) / Math.round(corrFactor * corrFactor);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
this._value = _.reduce([this._value, value], cback, 1);
|
|
646
|
-
|
|
647
|
-
return this;
|
|
648
|
-
},
|
|
649
|
-
divide: function(value) {
|
|
650
|
-
function cback(accum, curr, currI, O) {
|
|
651
|
-
var corrFactor = _.correctionFactor(accum, curr);
|
|
652
|
-
return Math.round(accum * corrFactor) / Math.round(curr * corrFactor);
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
this._value = _.reduce([this._value, value], cback);
|
|
656
|
-
|
|
657
|
-
return this;
|
|
658
|
-
},
|
|
659
|
-
difference: function(value) {
|
|
660
|
-
return Math.abs(numeral(this._value).subtract(value).value());
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
|
|
664
|
-
/************************************
|
|
665
|
-
Default Locale && Format
|
|
666
|
-
************************************/
|
|
667
|
-
|
|
668
|
-
numeral.register('locale', 'en', {
|
|
669
|
-
delimiters: {
|
|
670
|
-
thousands: ',',
|
|
671
|
-
decimal: '.'
|
|
672
|
-
},
|
|
673
|
-
abbreviations: {
|
|
674
|
-
thousand: 'k',
|
|
675
|
-
million: 'm',
|
|
676
|
-
billion: 'b',
|
|
677
|
-
trillion: 't'
|
|
678
|
-
},
|
|
679
|
-
ordinal: function(number) {
|
|
680
|
-
var b = number % 10;
|
|
681
|
-
return (~~(number % 100 / 10) === 1) ? 'th' :
|
|
682
|
-
(b === 1) ? 'st' :
|
|
683
|
-
(b === 2) ? 'nd' :
|
|
684
|
-
(b === 3) ? 'rd' : 'th';
|
|
685
|
-
},
|
|
686
|
-
currency: {
|
|
687
|
-
symbol: '$'
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
(function() {
|
|
694
|
-
numeral.register('format', 'bps', {
|
|
695
|
-
regexps: {
|
|
696
|
-
format: /(BPS)/,
|
|
697
|
-
unformat: /(BPS)/
|
|
698
|
-
},
|
|
699
|
-
format: function(value, format, roundingFunction) {
|
|
700
|
-
var space = numeral._.includes(format, ' BPS') ? ' ' : '',
|
|
701
|
-
output;
|
|
702
|
-
|
|
703
|
-
value = value * 10000;
|
|
704
|
-
|
|
705
|
-
// check for space before BPS
|
|
706
|
-
format = format.replace(/\s?BPS/, '');
|
|
707
|
-
|
|
708
|
-
output = numeral._.numberToFormat(value, format, roundingFunction);
|
|
709
|
-
|
|
710
|
-
if (numeral._.includes(output, ')')) {
|
|
711
|
-
output = output.split('');
|
|
712
|
-
|
|
713
|
-
output.splice(-1, 0, space + 'BPS');
|
|
714
|
-
|
|
715
|
-
output = output.join('');
|
|
716
|
-
} else {
|
|
717
|
-
output = output + space + 'BPS';
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
return output;
|
|
721
|
-
},
|
|
722
|
-
unformat: function(string) {
|
|
723
|
-
return +(numeral._.stringToNumber(string) * 0.0001).toFixed(15);
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
})();
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
(function() {
|
|
730
|
-
var decimal = {
|
|
731
|
-
base: 1000,
|
|
732
|
-
suffixes: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
733
|
-
},
|
|
734
|
-
binary = {
|
|
735
|
-
base: 1024,
|
|
736
|
-
suffixes: ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
var allSuffixes = decimal.suffixes.concat(binary.suffixes.filter(function (item) {
|
|
740
|
-
return decimal.suffixes.indexOf(item) < 0;
|
|
741
|
-
}));
|
|
742
|
-
var unformatRegex = allSuffixes.join('|');
|
|
743
|
-
// Allow support for BPS (http://www.investopedia.com/terms/b/basispoint.asp)
|
|
744
|
-
unformatRegex = '(' + unformatRegex.replace('B', 'B(?!PS)') + ')';
|
|
745
|
-
|
|
746
|
-
numeral.register('format', 'bytes', {
|
|
747
|
-
regexps: {
|
|
748
|
-
format: /([0\s]i?b)/,
|
|
749
|
-
unformat: new RegExp(unformatRegex)
|
|
750
|
-
},
|
|
751
|
-
format: function(value, format, roundingFunction) {
|
|
752
|
-
var output,
|
|
753
|
-
bytes = numeral._.includes(format, 'ib') ? binary : decimal,
|
|
754
|
-
suffix = numeral._.includes(format, ' b') || numeral._.includes(format, ' ib') ? ' ' : '',
|
|
755
|
-
power,
|
|
756
|
-
min,
|
|
757
|
-
max;
|
|
758
|
-
|
|
759
|
-
// check for space before
|
|
760
|
-
format = format.replace(/\s?i?b/, '');
|
|
761
|
-
|
|
762
|
-
for (power = 0; power <= bytes.suffixes.length; power++) {
|
|
763
|
-
min = Math.pow(bytes.base, power);
|
|
764
|
-
max = Math.pow(bytes.base, power + 1);
|
|
765
|
-
|
|
766
|
-
if (value === null || value === 0 || value >= min && value < max) {
|
|
767
|
-
suffix += bytes.suffixes[power];
|
|
768
|
-
|
|
769
|
-
if (min > 0) {
|
|
770
|
-
value = value / min;
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
break;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
output = numeral._.numberToFormat(value, format, roundingFunction);
|
|
778
|
-
|
|
779
|
-
return output + suffix;
|
|
780
|
-
},
|
|
781
|
-
unformat: function(string) {
|
|
782
|
-
var value = numeral._.stringToNumber(string),
|
|
783
|
-
power,
|
|
784
|
-
bytesMultiplier;
|
|
785
|
-
|
|
786
|
-
if (value) {
|
|
787
|
-
for (power = decimal.suffixes.length - 1; power >= 0; power--) {
|
|
788
|
-
if (numeral._.includes(string, decimal.suffixes[power])) {
|
|
789
|
-
bytesMultiplier = Math.pow(decimal.base, power);
|
|
790
|
-
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (numeral._.includes(string, binary.suffixes[power])) {
|
|
795
|
-
bytesMultiplier = Math.pow(binary.base, power);
|
|
796
|
-
|
|
797
|
-
break;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
value *= (bytesMultiplier || 1);
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
return value;
|
|
805
|
-
}
|
|
806
|
-
});
|
|
807
|
-
})();
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
(function() {
|
|
811
|
-
numeral.register('format', 'currency', {
|
|
812
|
-
regexps: {
|
|
813
|
-
format: /(\$)/
|
|
814
|
-
},
|
|
815
|
-
format: function(value, format, roundingFunction) {
|
|
816
|
-
var locale = numeral.locales[numeral.options.currentLocale],
|
|
817
|
-
symbols = {
|
|
818
|
-
before: format.match(/^([\+|\-|\(|\s|\$]*)/)[0],
|
|
819
|
-
after: format.match(/([\+|\-|\)|\s|\$]*)$/)[0]
|
|
820
|
-
},
|
|
821
|
-
output,
|
|
822
|
-
symbol,
|
|
823
|
-
i;
|
|
824
|
-
|
|
825
|
-
// strip format of spaces and $
|
|
826
|
-
format = format.replace(/\s?\$\s?/, '');
|
|
827
|
-
|
|
828
|
-
// format the number
|
|
829
|
-
output = numeral._.numberToFormat(value, format, roundingFunction);
|
|
830
|
-
|
|
831
|
-
// update the before and after based on value
|
|
832
|
-
if (value >= 0) {
|
|
833
|
-
symbols.before = symbols.before.replace(/[\-\(]/, '');
|
|
834
|
-
symbols.after = symbols.after.replace(/[\-\)]/, '');
|
|
835
|
-
} else if (value < 0 && (!numeral._.includes(symbols.before, '-') && !numeral._.includes(symbols.before, '('))) {
|
|
836
|
-
symbols.before = '-' + symbols.before;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
// loop through each before symbol
|
|
840
|
-
for (i = 0; i < symbols.before.length; i++) {
|
|
841
|
-
symbol = symbols.before[i];
|
|
842
|
-
|
|
843
|
-
switch (symbol) {
|
|
844
|
-
case '$':
|
|
845
|
-
output = numeral._.insert(output, locale.currency.symbol, i);
|
|
846
|
-
break;
|
|
847
|
-
case ' ':
|
|
848
|
-
output = numeral._.insert(output, ' ', i + locale.currency.symbol.length - 1);
|
|
849
|
-
break;
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
// loop through each after symbol
|
|
854
|
-
for (i = symbols.after.length - 1; i >= 0; i--) {
|
|
855
|
-
symbol = symbols.after[i];
|
|
856
|
-
|
|
857
|
-
switch (symbol) {
|
|
858
|
-
case '$':
|
|
859
|
-
output = i === symbols.after.length - 1 ? output + locale.currency.symbol : numeral._.insert(output, locale.currency.symbol, -(symbols.after.length - (1 + i)));
|
|
860
|
-
break;
|
|
861
|
-
case ' ':
|
|
862
|
-
output = i === symbols.after.length - 1 ? output + ' ' : numeral._.insert(output, ' ', -(symbols.after.length - (1 + i) + locale.currency.symbol.length - 1));
|
|
863
|
-
break;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
return output;
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
})();
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
(function() {
|
|
875
|
-
numeral.register('format', 'exponential', {
|
|
876
|
-
regexps: {
|
|
877
|
-
format: /(e\+|e-)/,
|
|
878
|
-
unformat: /(e\+|e-)/
|
|
879
|
-
},
|
|
880
|
-
format: function(value, format, roundingFunction) {
|
|
881
|
-
var output,
|
|
882
|
-
exponential = typeof value === 'number' && !numeral._.isNaN(value) ? value.toExponential() : '0e+0',
|
|
883
|
-
parts = exponential.split('e');
|
|
884
|
-
|
|
885
|
-
format = format.replace(/e[\+|\-]{1}0/, '');
|
|
886
|
-
|
|
887
|
-
output = numeral._.numberToFormat(Number(parts[0]), format, roundingFunction);
|
|
888
|
-
|
|
889
|
-
return output + 'e' + parts[1];
|
|
890
|
-
},
|
|
891
|
-
unformat: function(string) {
|
|
892
|
-
var parts = numeral._.includes(string, 'e+') ? string.split('e+') : string.split('e-'),
|
|
893
|
-
value = Number(parts[0]),
|
|
894
|
-
power = Number(parts[1]);
|
|
895
|
-
|
|
896
|
-
power = numeral._.includes(string, 'e-') ? power *= -1 : power;
|
|
897
|
-
|
|
898
|
-
function cback(accum, curr, currI, O) {
|
|
899
|
-
var corrFactor = numeral._.correctionFactor(accum, curr),
|
|
900
|
-
num = (accum * corrFactor) * (curr * corrFactor) / (corrFactor * corrFactor);
|
|
901
|
-
return num;
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
return numeral._.reduce([value, Math.pow(10, power)], cback, 1);
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
})();
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
(function() {
|
|
911
|
-
numeral.register('format', 'ordinal', {
|
|
912
|
-
regexps: {
|
|
913
|
-
format: /(o)/
|
|
914
|
-
},
|
|
915
|
-
format: function(value, format, roundingFunction) {
|
|
916
|
-
var locale = numeral.locales[numeral.options.currentLocale],
|
|
917
|
-
output,
|
|
918
|
-
ordinal = numeral._.includes(format, ' o') ? ' ' : '';
|
|
919
|
-
|
|
920
|
-
// check for space before
|
|
921
|
-
format = format.replace(/\s?o/, '');
|
|
922
|
-
|
|
923
|
-
ordinal += locale.ordinal(value);
|
|
924
|
-
|
|
925
|
-
output = numeral._.numberToFormat(value, format, roundingFunction);
|
|
926
|
-
|
|
927
|
-
return output + ordinal;
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
})();
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
(function() {
|
|
934
|
-
numeral.register('format', 'percentage', {
|
|
935
|
-
regexps: {
|
|
936
|
-
format: /(%)/,
|
|
937
|
-
unformat: /(%)/
|
|
938
|
-
},
|
|
939
|
-
format: function(value, format, roundingFunction) {
|
|
940
|
-
var space = numeral._.includes(format, ' %') ? ' ' : '',
|
|
941
|
-
output;
|
|
942
|
-
|
|
943
|
-
if (numeral.options.scalePercentBy100) {
|
|
944
|
-
value = value * 100;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
// check for space before %
|
|
948
|
-
format = format.replace(/\s?\%/, '');
|
|
949
|
-
|
|
950
|
-
output = numeral._.numberToFormat(value, format, roundingFunction);
|
|
951
|
-
|
|
952
|
-
if (numeral._.includes(output, ')')) {
|
|
953
|
-
output = output.split('');
|
|
954
|
-
|
|
955
|
-
output.splice(-1, 0, space + '%');
|
|
956
|
-
|
|
957
|
-
output = output.join('');
|
|
958
|
-
} else {
|
|
959
|
-
output = output + space + '%';
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
return output;
|
|
963
|
-
},
|
|
964
|
-
unformat: function(string) {
|
|
965
|
-
var number = numeral._.stringToNumber(string);
|
|
966
|
-
if (numeral.options.scalePercentBy100) {
|
|
967
|
-
return number * 0.01;
|
|
968
|
-
}
|
|
969
|
-
return number;
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
})();
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
(function() {
|
|
976
|
-
numeral.register('format', 'time', {
|
|
977
|
-
regexps: {
|
|
978
|
-
format: /(:)/,
|
|
979
|
-
unformat: /(:)/
|
|
980
|
-
},
|
|
981
|
-
format: function(value, format, roundingFunction) {
|
|
982
|
-
var hours = Math.floor(value / 60 / 60),
|
|
983
|
-
minutes = Math.floor((value - (hours * 60 * 60)) / 60),
|
|
984
|
-
seconds = Math.round(value - (hours * 60 * 60) - (minutes * 60));
|
|
985
|
-
|
|
986
|
-
return hours + ':' + (minutes < 10 ? '0' + minutes : minutes) + ':' + (seconds < 10 ? '0' + seconds : seconds);
|
|
987
|
-
},
|
|
988
|
-
unformat: function(string) {
|
|
989
|
-
var timeArray = string.split(':'),
|
|
990
|
-
seconds = 0;
|
|
991
|
-
|
|
992
|
-
// turn hours and minutes into seconds and add them all up
|
|
993
|
-
if (timeArray.length === 3) {
|
|
994
|
-
// hours
|
|
995
|
-
seconds = seconds + (Number(timeArray[0]) * 60 * 60);
|
|
996
|
-
// minutes
|
|
997
|
-
seconds = seconds + (Number(timeArray[1]) * 60);
|
|
998
|
-
// seconds
|
|
999
|
-
seconds = seconds + Number(timeArray[2]);
|
|
1000
|
-
} else if (timeArray.length === 2) {
|
|
1001
|
-
// minutes
|
|
1002
|
-
seconds = seconds + (Number(timeArray[0]) * 60);
|
|
1003
|
-
// seconds
|
|
1004
|
-
seconds = seconds + Number(timeArray[1]);
|
|
1005
|
-
}
|
|
1006
|
-
return Number(seconds);
|
|
1007
|
-
}
|
|
1008
|
-
});
|
|
1009
|
-
})();
|
|
1010
|
-
|
|
1011
|
-
return numeral;
|
|
1012
|
-
}));
|
|
1013
|
-
});
|
|
1014
|
-
|
|
1015
|
-
const dom = document.documentElement;
|
|
1016
|
-
exports.DateTimeFormatOptionsMonth = void 0;
|
|
1017
|
-
(function (DateTimeFormatOptionsMonth) {
|
|
1018
|
-
DateTimeFormatOptionsMonth["NUMERIC"] = "numeric";
|
|
1019
|
-
DateTimeFormatOptionsMonth["DIGIT2"] = "2-digit";
|
|
1020
|
-
DateTimeFormatOptionsMonth["LONG"] = "long";
|
|
1021
|
-
DateTimeFormatOptionsMonth["SHORT"] = "short";
|
|
1022
|
-
DateTimeFormatOptionsMonth["NARROW"] = "narrow";
|
|
1023
|
-
})(exports.DateTimeFormatOptionsMonth || (exports.DateTimeFormatOptionsMonth = {}));
|
|
1024
|
-
function identify(array) {
|
|
1025
|
-
if (array) {
|
|
1026
|
-
for (let i = 0; i < array.length; i++) {
|
|
1027
|
-
array[i].id = i.toString();
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
function getSeparator(locale, separatorType) {
|
|
1032
|
-
const numberWithGroupAndDecimalSeparator = 1000.1;
|
|
1033
|
-
return Intl.NumberFormat(locale)
|
|
1034
|
-
.formatToParts(numberWithGroupAndDecimalSeparator)
|
|
1035
|
-
.find((part) => part.type === separatorType).value;
|
|
1036
|
-
}
|
|
1037
|
-
function getCurrentTimeFormatFromBrowserLocale(manageSeconds) {
|
|
1038
|
-
const options = {
|
|
1039
|
-
hour: '2-digit',
|
|
1040
|
-
minute: '2-digit',
|
|
1041
|
-
hour12: false,
|
|
1042
|
-
};
|
|
1043
|
-
if (manageSeconds == true) {
|
|
1044
|
-
options.second = '2-digit';
|
|
1045
|
-
}
|
|
1046
|
-
const formatObj = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale() + '-u-hc-h23', options).formatToParts(new Date());
|
|
1047
|
-
let timeFormat = formatObj
|
|
1048
|
-
.map((obj) => {
|
|
1049
|
-
switch (obj.type) {
|
|
1050
|
-
case 'hour':
|
|
1051
|
-
return 'HH';
|
|
1052
|
-
case 'minute':
|
|
1053
|
-
return 'mm';
|
|
1054
|
-
case 'second':
|
|
1055
|
-
return 'ss';
|
|
1056
|
-
default:
|
|
1057
|
-
return obj.value;
|
|
1058
|
-
}
|
|
1059
|
-
})
|
|
1060
|
-
.join('');
|
|
1061
|
-
return timeFormat;
|
|
1062
|
-
}
|
|
1063
|
-
/**
|
|
1064
|
-
* Check if an object is undefined, null or empty
|
|
1065
|
-
* @param obj the object to check
|
|
1066
|
-
* @returns true or false
|
|
1067
|
-
*/
|
|
1068
|
-
function isEmpty(obj) {
|
|
1069
|
-
return (!obj ||
|
|
1070
|
-
obj === null ||
|
|
1071
|
-
(Object.keys(obj).length === 0 && obj.constructor === Object));
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* @param value number as string, formatted by actual browser locale
|
|
1075
|
-
* @param type - type of number for calculate suffix
|
|
1076
|
-
* @returns true if number string in input is a valid number
|
|
1077
|
-
*/
|
|
1078
|
-
function isValidFormattedStringNumber(value, type) {
|
|
1079
|
-
if (value == null || value.trim() == '') {
|
|
1080
|
-
return false;
|
|
1081
|
-
}
|
|
1082
|
-
let tmpStr = formattedStringToUnformattedStringNumber(value, type);
|
|
1083
|
-
if (isNumber(tmpStr)) {
|
|
1084
|
-
return true;
|
|
1085
|
-
}
|
|
1086
|
-
return false;
|
|
1087
|
-
}
|
|
1088
|
-
function isNumber(value) {
|
|
1089
|
-
//return typeof value === 'number';
|
|
1090
|
-
return !isNaN(value);
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
1094
|
-
* @returns number
|
|
1095
|
-
**/
|
|
1096
|
-
function stringToNumber(input) {
|
|
1097
|
-
if (!input || input == null || input.trim() == '') {
|
|
1098
|
-
input = '0';
|
|
1099
|
-
}
|
|
1100
|
-
return numeral(input).value();
|
|
1101
|
-
}
|
|
1102
|
-
/**
|
|
1103
|
-
* @param input number
|
|
1104
|
-
* @param decimals number of significant decimal digits for output
|
|
1105
|
-
* @returns number as string, formatted by actual browser locale
|
|
1106
|
-
**/
|
|
1107
|
-
function numberToString(input, decimals) {
|
|
1108
|
-
if (input == null) {
|
|
1109
|
-
return '';
|
|
1110
|
-
}
|
|
1111
|
-
return _numberToString(input, decimals, dom.ketchup.dates.getLocale(), true);
|
|
1112
|
-
}
|
|
1113
|
-
/**
|
|
1114
|
-
* @param type - type of number for calculate suffix
|
|
1115
|
-
* @returns suffix for number, by type
|
|
1116
|
-
**/
|
|
1117
|
-
function getNumericValueSuffixByType(type) {
|
|
1118
|
-
type = type.toUpperCase();
|
|
1119
|
-
let nstr = '';
|
|
1120
|
-
if (type == 'P') {
|
|
1121
|
-
nstr = ' %';
|
|
1122
|
-
}
|
|
1123
|
-
else if (type == 'VE') {
|
|
1124
|
-
nstr = ' €';
|
|
1125
|
-
}
|
|
1126
|
-
else if (type == 'VL') {
|
|
1127
|
-
nstr = ' £';
|
|
1128
|
-
}
|
|
1129
|
-
else if (type == 'VV') {
|
|
1130
|
-
nstr = ' $';
|
|
1131
|
-
}
|
|
1132
|
-
return nstr;
|
|
1133
|
-
}
|
|
1134
|
-
/**
|
|
1135
|
-
* @param input number
|
|
1136
|
-
* @param decimals number of significant decimal digits for output
|
|
1137
|
-
* @param type - type of number for calculate suffix
|
|
1138
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
1139
|
-
**/
|
|
1140
|
-
function numberToFormattedStringNumber(input, decimals, type) {
|
|
1141
|
-
if (input == null || isNaN(input)) {
|
|
1142
|
-
return '';
|
|
1143
|
-
}
|
|
1144
|
-
let nstr = numberToString(input, decimals);
|
|
1145
|
-
nstr = nstr + getNumericValueSuffixByType(type);
|
|
1146
|
-
return nstr;
|
|
1147
|
-
}
|
|
1148
|
-
/**
|
|
1149
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers)
|
|
1150
|
-
* @param decimals number of significant decimal digits for output
|
|
1151
|
-
* @param type - type of number for calculate suffix
|
|
1152
|
-
* @returns number as string, formatted by actual browser locale, with suffix by type
|
|
1153
|
-
**/
|
|
1154
|
-
function unformattedStringToFormattedStringNumber(input, decimals, type) {
|
|
1155
|
-
return numberToFormattedStringNumber(stringToNumber(input), decimals, type);
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* @param input number as string, formatted by actual browser locale
|
|
1159
|
-
* @param type - type of number for calculate suffix
|
|
1160
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
1161
|
-
**/
|
|
1162
|
-
function formattedStringToUnformattedStringNumber(input, type) {
|
|
1163
|
-
return numberStringToNumberString(input, type, getDecimalSeparator(dom.ketchup.dates.getLocale()));
|
|
1164
|
-
}
|
|
1165
|
-
/**
|
|
1166
|
-
* @param input number as string, formatted by locale US, decimal separator . (like java decimal numbers), with group separator
|
|
1167
|
-
* @param type - type of number for calculate suffix
|
|
1168
|
-
* @returns number as string, formatted by locale US, decimal separator . (like java decimal numbers), without group separator
|
|
1169
|
-
**/
|
|
1170
|
-
function unformattedStringNumberToNumber(input, type) {
|
|
1171
|
-
return numberStringToNumberString(input, type, '.');
|
|
1172
|
-
}
|
|
1173
|
-
function numberStringToNumberString(input, type, decFmt) {
|
|
1174
|
-
if (input == null || input.trim() == '') {
|
|
1175
|
-
return '';
|
|
1176
|
-
}
|
|
1177
|
-
let originalInputValue = input;
|
|
1178
|
-
let suffix = getNumericValueSuffixByType(type);
|
|
1179
|
-
if (suffix != '') {
|
|
1180
|
-
input = input.replace(suffix, '');
|
|
1181
|
-
}
|
|
1182
|
-
let regExpr = null;
|
|
1183
|
-
if (decFmt == '.') {
|
|
1184
|
-
regExpr = /,/g;
|
|
1185
|
-
}
|
|
1186
|
-
else {
|
|
1187
|
-
regExpr = /\./g;
|
|
1188
|
-
}
|
|
1189
|
-
input = input.replace(regExpr, '');
|
|
1190
|
-
if (decFmt != '.') {
|
|
1191
|
-
input = input.replace(/,/g, '.');
|
|
1192
|
-
}
|
|
1193
|
-
if (numeral(input).value() == null || isNaN(numeral(input).value())) {
|
|
1194
|
-
return originalInputValue;
|
|
1195
|
-
}
|
|
1196
|
-
let unf = stringToNumber(input);
|
|
1197
|
-
return _numberToString(unf, -1, 'en-US', false);
|
|
1198
|
-
}
|
|
1199
|
-
function getDecimalSeparator(locale) {
|
|
1200
|
-
return getSeparator(locale, 'decimal');
|
|
1201
|
-
}
|
|
1202
|
-
function countDecimals(value) {
|
|
1203
|
-
if (Math.floor(value) === value)
|
|
1204
|
-
return 0;
|
|
1205
|
-
let stringValue = value.toString().split('.')[1];
|
|
1206
|
-
if (stringValue) {
|
|
1207
|
-
return stringValue.length ? stringValue.length : 0;
|
|
1208
|
-
}
|
|
1209
|
-
else {
|
|
1210
|
-
return 0;
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
function _numberToString(input, decimals, locale, useGrouping) {
|
|
1214
|
-
if (input == null) {
|
|
1215
|
-
input = 0;
|
|
1216
|
-
}
|
|
1217
|
-
if (decimals == null || decimals == -1) {
|
|
1218
|
-
decimals = countDecimals(input);
|
|
1219
|
-
}
|
|
1220
|
-
let n = Number(input);
|
|
1221
|
-
let f = decimals > -1
|
|
1222
|
-
? {
|
|
1223
|
-
minimumFractionDigits: decimals,
|
|
1224
|
-
maximumFractionDigits: decimals,
|
|
1225
|
-
useGrouping: useGrouping,
|
|
1226
|
-
}
|
|
1227
|
-
: { useGrouping: useGrouping };
|
|
1228
|
-
return n.toLocaleString(locale, f);
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
1231
|
-
* @param time time as Date object
|
|
1232
|
-
* @param manageSeconds flag to set seconds managing
|
|
1233
|
-
* @return time as string, formatted
|
|
1234
|
-
**/
|
|
1235
|
-
function formatTime(time, manageSeconds) {
|
|
1236
|
-
const options = {
|
|
1237
|
-
hour: '2-digit',
|
|
1238
|
-
minute: '2-digit',
|
|
1239
|
-
hour12: false,
|
|
1240
|
-
};
|
|
1241
|
-
if (manageSeconds == true) {
|
|
1242
|
-
options.second = '2-digit';
|
|
1243
|
-
}
|
|
1244
|
-
return time.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* @param value time string, formatted by actual browser locale
|
|
1248
|
-
* @returns true if time string in input is a valid time
|
|
1249
|
-
*/
|
|
1250
|
-
function isValidFormattedStringTime(value, manageSeconds) {
|
|
1251
|
-
let format = getCurrentTimeFormatFromBrowserLocale(manageSeconds);
|
|
1252
|
-
return dom.ketchup.dates.isValid(value, format, true);
|
|
1253
|
-
}
|
|
1254
|
-
/**
|
|
1255
|
-
* @param value date/time as string, formatted by actual browser locale
|
|
1256
|
-
* @returns date/time as string, formatted ISO
|
|
1257
|
-
**/
|
|
1258
|
-
function formattedStringToDefaultUnformattedStringTimestamp(value) {
|
|
1259
|
-
return formattedStringToCustomUnformattedStringTime(value, kupManager.KupDatesFormats.ISO_DATE_TIME, true);
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* @param value time as string, formatted by actual browser locale
|
|
1263
|
-
* @param outputFormat time format to return
|
|
1264
|
-
* @param manageSeconds flag to set seconds managing
|
|
1265
|
-
* @returns time as string, formatted
|
|
1266
|
-
**/
|
|
1267
|
-
function formattedStringToCustomUnformattedStringTime(value, outputFormat, manageSeconds) {
|
|
1268
|
-
let inputFormat = getCurrentTimeFormatFromBrowserLocale(manageSeconds);
|
|
1269
|
-
if (dom.ketchup.dates.isValid(value, inputFormat)) {
|
|
1270
|
-
return dom.ketchup.dates.format(dom.ketchup.dates.normalize(value, kupManager.KupDatesNormalize.TIME), outputFormat);
|
|
1271
|
-
}
|
|
1272
|
-
else {
|
|
1273
|
-
return '';
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
/**
|
|
1277
|
-
* @param value time as string, formatted ISO
|
|
1278
|
-
* @param manageSeconds flag to set seconds managing
|
|
1279
|
-
* @param valueTimeFormat time format (default ISO)
|
|
1280
|
-
* @param customedFormat time format from smeupObject
|
|
1281
|
-
* @returns time as string, formatted by actual browser locale
|
|
1282
|
-
**/
|
|
1283
|
-
function unformattedStringToFormattedStringTime(value, manageSeconds, customedFormat) {
|
|
1284
|
-
const options = {
|
|
1285
|
-
hour: '2-digit',
|
|
1286
|
-
minute: '2-digit',
|
|
1287
|
-
hour12: false,
|
|
1288
|
-
};
|
|
1289
|
-
if (manageSeconds == true) {
|
|
1290
|
-
options.second = '2-digit';
|
|
1291
|
-
}
|
|
1292
|
-
let date = dom.ketchup.dates.toDate(dom.ketchup.dates.normalize(value, kupManager.KupDatesNormalize.TIME));
|
|
1293
|
-
return formatByCustomedOutputTimeFormat(value, date, options, customedFormat);
|
|
1294
|
-
}
|
|
1295
|
-
function formatByCustomedOutputTimeFormat(valueStr, date, options, customedFormat) {
|
|
1296
|
-
if (customedFormat == null) {
|
|
1297
|
-
return date.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
1298
|
-
}
|
|
1299
|
-
switch (customedFormat) {
|
|
1300
|
-
case 'I13': {
|
|
1301
|
-
//hh:mm
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
case 'I12': {
|
|
1305
|
-
//hh:mm:ss
|
|
1306
|
-
break;
|
|
1307
|
-
}
|
|
1308
|
-
case 'I11': {
|
|
1309
|
-
//???
|
|
1310
|
-
//hh:dddd
|
|
1311
|
-
//return moment(date).format('HH:DDDD');
|
|
1312
|
-
return valueStr;
|
|
1313
|
-
}
|
|
1314
|
-
case 'I14': {
|
|
1315
|
-
//???
|
|
1316
|
-
//sssss
|
|
1317
|
-
//return moment(date).format('SSSSS');
|
|
1318
|
-
return valueStr;
|
|
1319
|
-
}
|
|
1320
|
-
case 'I1H': {
|
|
1321
|
-
//???
|
|
1322
|
-
//Ora,Cen/Min HH,xx
|
|
1323
|
-
return valueStr;
|
|
1324
|
-
}
|
|
1325
|
-
case 'I1M': {
|
|
1326
|
-
//???
|
|
1327
|
-
//Min,Cen/Sec MMMM,xx
|
|
1328
|
-
return valueStr;
|
|
1329
|
-
}
|
|
1330
|
-
case 'I21': {
|
|
1331
|
-
//???
|
|
1332
|
-
//Giorni,(4 decim)
|
|
1333
|
-
return valueStr;
|
|
1334
|
-
}
|
|
1335
|
-
case 'I22': {
|
|
1336
|
-
//???
|
|
1337
|
-
//Ore,(4 decim)
|
|
1338
|
-
return valueStr;
|
|
1339
|
-
}
|
|
1340
|
-
case 'I23': {
|
|
1341
|
-
//???
|
|
1342
|
-
//Minuti,(4 decim)
|
|
1343
|
-
return valueStr;
|
|
1344
|
-
}
|
|
1345
|
-
case 'I24': {
|
|
1346
|
-
//???
|
|
1347
|
-
//Secondi
|
|
1348
|
-
return valueStr;
|
|
1349
|
-
}
|
|
1350
|
-
case 'I2H': {
|
|
1351
|
-
//???
|
|
1352
|
-
//Ora,Cen/Min HHHH,xx
|
|
1353
|
-
return valueStr;
|
|
1354
|
-
}
|
|
1355
|
-
case 'I2D': {
|
|
1356
|
-
//???
|
|
1357
|
-
//Ore Minuti Secondi HHMMS
|
|
1358
|
-
return valueStr;
|
|
1359
|
-
}
|
|
1360
|
-
case 'I2M': {
|
|
1361
|
-
//???
|
|
1362
|
-
//Min,Cen/Sec MMMM,xx
|
|
1363
|
-
return valueStr;
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
return date.toLocaleTimeString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
1367
|
-
}
|
|
1368
|
-
/**
|
|
1369
|
-
* @param value date/time as string, formatted ISO
|
|
1370
|
-
* @param valueDateFormat date/time format (default ISO)
|
|
1371
|
-
* @returns date/time as string, formatted by actual browser locale
|
|
1372
|
-
**/
|
|
1373
|
-
function unformattedStringToFormattedStringTimestamp(value) {
|
|
1374
|
-
const options = {
|
|
1375
|
-
day: '2-digit',
|
|
1376
|
-
month: '2-digit',
|
|
1377
|
-
year: 'numeric',
|
|
1378
|
-
hour: '2-digit',
|
|
1379
|
-
minute: '2-digit',
|
|
1380
|
-
second: '2-digit',
|
|
1381
|
-
hour12: false,
|
|
1382
|
-
};
|
|
1383
|
-
let date = dom.ketchup.dates.toDate(dom.ketchup.dates.normalize(value, kupManager.KupDatesNormalize.TIMESTAMP));
|
|
1384
|
-
return date.toLocaleString(dom.ketchup.dates.getLocale() + '-u-hc-h23', options);
|
|
1385
|
-
}
|
|
1386
|
-
function getMonthAsStringByLocale(month, format) {
|
|
1387
|
-
if (month == null) {
|
|
1388
|
-
return '';
|
|
1389
|
-
}
|
|
1390
|
-
const dateTmp = new Date();
|
|
1391
|
-
dateTmp.setDate(1);
|
|
1392
|
-
dateTmp.setMonth(month - 1);
|
|
1393
|
-
const options = {
|
|
1394
|
-
month: format,
|
|
1395
|
-
};
|
|
1396
|
-
const dateTimeFormat = new Intl.DateTimeFormat(dom.ketchup.dates.getLocale(), options);
|
|
1397
|
-
return dateTimeFormat.format(dateTmp);
|
|
1398
|
-
}
|
|
1399
|
-
function getMonthsAsStringByLocale(format) {
|
|
1400
|
-
if (format == null || format.trim() == '') {
|
|
1401
|
-
format = exports.DateTimeFormatOptionsMonth.LONG;
|
|
1402
|
-
}
|
|
1403
|
-
var months = [];
|
|
1404
|
-
for (var i = 0; i < 12; i++) {
|
|
1405
|
-
months[i] = getMonthAsStringByLocale(i + 1, format);
|
|
1406
|
-
}
|
|
1407
|
-
return months;
|
|
1408
|
-
}
|
|
1409
|
-
function deepEqual(object1, object2) {
|
|
1410
|
-
if (!(isObject(object1) && isObject(object2))) {
|
|
1411
|
-
return object1 === object2;
|
|
1412
|
-
}
|
|
1413
|
-
const keys1 = Object.keys(object1);
|
|
1414
|
-
const keys2 = Object.keys(object2);
|
|
1415
|
-
if (keys1.length !== keys2.length) {
|
|
1416
|
-
return false;
|
|
1417
|
-
}
|
|
1418
|
-
for (const key of keys1) {
|
|
1419
|
-
const val1 = object1[key];
|
|
1420
|
-
const val2 = object2[key];
|
|
1421
|
-
const areObjects = isObject(val1) && isObject(val2);
|
|
1422
|
-
if ((areObjects && !deepEqual(val1, val2)) ||
|
|
1423
|
-
(!areObjects && val1 !== val2)) {
|
|
1424
|
-
return false;
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
return true;
|
|
1428
|
-
}
|
|
1429
|
-
function isObject(object) {
|
|
1430
|
-
return object != null && typeof object === 'object';
|
|
1431
|
-
}
|
|
1432
|
-
/**
|
|
1433
|
-
* Used to retrieve component's props values.
|
|
1434
|
-
* @param {any} comp - Component calling this function.
|
|
1435
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
1436
|
-
* @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
|
|
1437
|
-
* @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
|
|
1438
|
-
*/
|
|
1439
|
-
function getProps(comp, list, descriptions) {
|
|
1440
|
-
let props = {};
|
|
1441
|
-
if (descriptions) {
|
|
1442
|
-
props = list;
|
|
1443
|
-
}
|
|
1444
|
-
else {
|
|
1445
|
-
for (const key in list) {
|
|
1446
|
-
if (Object.prototype.hasOwnProperty.call(list, key)) {
|
|
1447
|
-
props[key] = comp[key];
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
return props;
|
|
1452
|
-
}
|
|
1453
|
-
/**
|
|
1454
|
-
* Sets the props to the component.
|
|
1455
|
-
* @param {any} comp - Component calling this function.
|
|
1456
|
-
* @param {GenericObject} list - Prop list, specific for each component.
|
|
1457
|
-
* @param {GenericObject} props - Prop to be set.
|
|
1458
|
-
*/
|
|
1459
|
-
function setProps(comp, list, props) {
|
|
1460
|
-
for (const key in props) {
|
|
1461
|
-
// If key is a custom prop it will be set on the component (i.e.: "data", "customStyle", ecc.)
|
|
1462
|
-
if (list[key]) {
|
|
1463
|
-
comp[key] = props[key];
|
|
1464
|
-
}
|
|
1465
|
-
else {
|
|
1466
|
-
// Otherwise, it will be set on its HTML element (i.e.: "id", "style", ecc.)
|
|
1467
|
-
comp.rootElement[key] = props[key];
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
exports.deepEqual = deepEqual;
|
|
1473
|
-
exports.formatTime = formatTime;
|
|
1474
|
-
exports.formattedStringToCustomUnformattedStringTime = formattedStringToCustomUnformattedStringTime;
|
|
1475
|
-
exports.formattedStringToDefaultUnformattedStringTimestamp = formattedStringToDefaultUnformattedStringTimestamp;
|
|
1476
|
-
exports.formattedStringToUnformattedStringNumber = formattedStringToUnformattedStringNumber;
|
|
1477
|
-
exports.getDecimalSeparator = getDecimalSeparator;
|
|
1478
|
-
exports.getMonthsAsStringByLocale = getMonthsAsStringByLocale;
|
|
1479
|
-
exports.getProps = getProps;
|
|
1480
|
-
exports.identify = identify;
|
|
1481
|
-
exports.isEmpty = isEmpty;
|
|
1482
|
-
exports.isNumber = isNumber;
|
|
1483
|
-
exports.isValidFormattedStringNumber = isValidFormattedStringNumber;
|
|
1484
|
-
exports.isValidFormattedStringTime = isValidFormattedStringTime;
|
|
1485
|
-
exports.numberToFormattedStringNumber = numberToFormattedStringNumber;
|
|
1486
|
-
exports.numeral = numeral;
|
|
1487
|
-
exports.setProps = setProps;
|
|
1488
|
-
exports.stringToNumber = stringToNumber;
|
|
1489
|
-
exports.unformattedStringNumberToNumber = unformattedStringNumberToNumber;
|
|
1490
|
-
exports.unformattedStringToFormattedStringNumber = unformattedStringToFormattedStringNumber;
|
|
1491
|
-
exports.unformattedStringToFormattedStringTime = unformattedStringToFormattedStringTime;
|
|
1492
|
-
exports.unformattedStringToFormattedStringTimestamp = unformattedStringToFormattedStringTimestamp;
|