@sme.up/ketchup 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{f-button-5b69d882.js → f-button-94cb5f35.js} +2 -2
- package/dist/cjs/{f-cell-3a740c48.js → f-cell-76830a0d.js} +12 -14
- package/dist/cjs/{f-checkbox-57443ca3.js → f-checkbox-cd977193.js} +1 -1
- package/dist/cjs/{f-chip-02e83f82.js → f-chip-68d45fd3.js} +3 -3
- package/dist/cjs/{f-image-2a61ece2.js → f-image-0e71df7e.js} +2 -2
- package/dist/cjs/{f-paginator-utils-09126bdd.js → f-paginator-utils-46689c0a.js} +80 -403
- package/dist/cjs/{f-text-field-9ee20a67.js → f-text-field-b4229cef.js} +11 -3
- package/dist/cjs/{index-06b131ea.js → index-31125378.js} +9 -4
- package/dist/cjs/ketchup.cjs.js +3 -3
- package/dist/cjs/kup-accordion.cjs.entry.js +5 -6
- package/dist/cjs/kup-autocomplete_25.cjs.entry.js +116 -111
- package/dist/cjs/kup-box.cjs.entry.js +15 -17
- package/dist/cjs/kup-calendar.cjs.entry.js +9 -11
- package/dist/cjs/kup-cell.cjs.entry.js +9 -11
- package/dist/cjs/kup-dash-list.cjs.entry.js +5 -7
- package/dist/cjs/kup-dash_2.cjs.entry.js +4 -5
- package/dist/cjs/kup-dashboard.cjs.entry.js +76 -17
- package/dist/cjs/kup-drawer.cjs.entry.js +4 -5
- package/dist/cjs/kup-echart.cjs.entry.js +17 -19
- package/dist/cjs/kup-family-tree.cjs.entry.js +140 -64
- package/dist/cjs/kup-form.cjs.entry.js +10 -12
- package/dist/cjs/kup-iframe.cjs.entry.js +4 -5
- package/dist/cjs/kup-image-list.cjs.entry.js +10 -12
- package/dist/cjs/kup-lazy.cjs.entry.js +4 -5
- package/dist/cjs/kup-magic-box.cjs.entry.js +5 -6
- package/dist/cjs/{kup-manager-02acbb37.js → kup-manager-7c514a30.js} +1400 -369
- package/dist/cjs/kup-nav-bar.cjs.entry.js +4 -5
- package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
- package/dist/cjs/kup-photo-frame.cjs.entry.js +4 -5
- 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 +6 -7
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/assets/dashboard.js +48 -0
- package/dist/collection/assets/family-tree.js +236 -19
- package/dist/collection/assets/index.js +4 -0
- package/dist/collection/assets/kupinteract.js +68 -0
- package/dist/collection/collection-manifest.json +5 -5
- package/dist/collection/components/kup-dashboard/kup-dashboard.css +7 -0
- package/dist/collection/components/kup-dashboard/kup-dashboard.js +67 -7
- package/dist/collection/components/kup-data-table/kup-data-table-helper.js +42 -30
- package/dist/collection/components/kup-echart/kup-echart.js +9 -9
- package/dist/collection/components/kup-family-tree/kup-family-tree-declarations.js +3 -1
- package/dist/collection/components/kup-family-tree/kup-family-tree.css +79 -9
- package/dist/collection/components/kup-family-tree/kup-family-tree.js +253 -65
- package/dist/collection/components/kup-text-field/kup-text-field-declarations.js +1 -0
- package/dist/collection/components/kup-text-field/kup-text-field.js +27 -0
- package/dist/collection/f-components/f-text-field/f-text-field.js +9 -1
- package/dist/collection/managers/kup-data/kup-data-cell-helper.js +48 -15
- package/dist/collection/managers/kup-data/kup-data.js +5 -5
- package/dist/collection/managers/kup-interact/kup-interact.js +3 -5
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.js +2 -0
- package/dist/collection/managers/kup-scroll-on-hover/kup-scroll-on-hover.js +131 -45
- package/dist/collection/utils/filters/filters-rows.js +4 -23
- package/dist/collection/utils/filters/filters-tree-items.js +2 -1
- package/dist/esm/{f-button-fd44ef70.js → f-button-cd948e50.js} +2 -2
- package/dist/esm/{f-cell-7b159a22.js → f-cell-474dd282.js} +6 -8
- package/dist/esm/{f-checkbox-c51c4a75.js → f-checkbox-e06cf07b.js} +1 -1
- package/dist/esm/{f-chip-c2e4c522.js → f-chip-d6f2eb94.js} +3 -3
- package/dist/esm/{f-image-2ab4b9aa.js → f-image-914a03ef.js} +2 -2
- package/dist/esm/{f-paginator-utils-ef537d82.js → f-paginator-utils-a4a52732.js} +44 -366
- package/dist/esm/{f-text-field-41c575eb.js → f-text-field-76341fe3.js} +11 -3
- package/dist/esm/{index-ad6ab214.js → index-e41330a5.js} +9 -4
- package/dist/esm/ketchup.js +3 -3
- package/dist/esm/kup-accordion.entry.js +3 -4
- package/dist/esm/kup-autocomplete_25.entry.js +17 -12
- package/dist/esm/kup-box.entry.js +9 -11
- package/dist/esm/kup-calendar.entry.js +5 -7
- package/dist/esm/kup-cell.entry.js +7 -9
- package/dist/esm/kup-dash-list.entry.js +2 -4
- package/dist/esm/kup-dash_2.entry.js +2 -3
- package/dist/esm/kup-dashboard.entry.js +74 -15
- package/dist/esm/kup-drawer.entry.js +2 -3
- package/dist/esm/kup-echart.entry.js +11 -13
- package/dist/esm/kup-family-tree.entry.js +138 -62
- package/dist/esm/kup-form.entry.js +7 -9
- package/dist/esm/kup-iframe.entry.js +2 -3
- package/dist/esm/kup-image-list.entry.js +8 -10
- package/dist/esm/kup-lazy.entry.js +2 -3
- package/dist/esm/kup-magic-box.entry.js +3 -4
- package/dist/esm/{kup-manager-22a475e6.js → kup-manager-86f440c7.js} +1379 -370
- package/dist/esm/kup-nav-bar.entry.js +2 -3
- package/dist/esm/kup-numeric-picker.entry.js +3 -3
- package/dist/esm/kup-photo-frame.entry.js +2 -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 +4 -5
- package/dist/esm/loader.js +3 -3
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/p-00e1133d.entry.js +9 -0
- package/dist/ketchup/p-066f344a.entry.js +1 -0
- package/dist/ketchup/p-0c6e0647.entry.js +1 -0
- package/dist/ketchup/p-151f7c17.entry.js +27 -0
- package/dist/ketchup/p-1e9c03b0.entry.js +1 -0
- package/dist/ketchup/{p-fc2b1229.js → p-21ea11cb.js} +3 -3
- package/dist/ketchup/{p-1959f835.entry.js → p-2f4e6c50.entry.js} +1 -1
- package/dist/ketchup/p-3586f59c.js +1 -0
- package/dist/ketchup/p-359fd90d.entry.js +1 -0
- package/dist/ketchup/{p-38d7584e.js → p-389fd0bf.js} +1 -1
- package/dist/ketchup/{p-cd5cfa7c.js → p-5552f156.js} +1 -1
- package/dist/ketchup/{p-264b1b19.entry.js → p-77aff9c1.entry.js} +1 -1
- package/dist/ketchup/{p-e9366aaf.entry.js → p-7cfdf53c.entry.js} +4 -4
- package/dist/ketchup/p-853a5178.entry.js +1 -0
- package/dist/ketchup/{p-edae3076.js → p-8673bd4e.js} +1 -1
- package/dist/ketchup/p-8b55b786.entry.js +1 -0
- package/dist/ketchup/p-95f5834b.entry.js +1 -0
- package/dist/ketchup/p-a2c595c4.js +1 -0
- package/dist/ketchup/p-ae91f27e.entry.js +1 -0
- package/dist/ketchup/{p-928c5c36.js → p-af664379.js} +1 -1
- package/dist/ketchup/p-b0b3989b.js +2 -0
- package/dist/ketchup/p-b3b65a61.entry.js +1 -0
- package/dist/ketchup/p-bc306a53.entry.js +1 -0
- package/dist/ketchup/{p-42080355.entry.js → p-c3783b77.entry.js} +1 -1
- package/dist/ketchup/{p-dc62a30f.js → p-cd4fc3fb.js} +1 -1
- package/dist/ketchup/p-cee76b14.entry.js +1 -0
- package/dist/ketchup/p-cfaea29b.entry.js +1 -0
- package/dist/ketchup/p-d2f51e7b.entry.js +1 -0
- package/dist/ketchup/p-df8e6a4d.entry.js +1 -0
- package/dist/ketchup/p-e60a1170.entry.js +1 -0
- package/dist/ketchup/p-e9a1ba04.entry.js +1 -0
- package/dist/types/components/kup-dashboard/kup-dashboard.d.ts +6 -1
- package/dist/types/components/kup-family-tree/kup-family-tree-declarations.d.ts +7 -3
- package/dist/types/components/kup-family-tree/kup-family-tree.d.ts +26 -5
- package/dist/types/components/kup-text-field/kup-text-field-declarations.d.ts +1 -0
- package/dist/types/components/kup-text-field/kup-text-field.d.ts +5 -0
- package/dist/types/components.d.ts +49 -7
- package/dist/types/f-components/f-text-field/f-text-field-declarations.d.ts +1 -0
- package/dist/types/managers/kup-data/kup-data-cell-helper.d.ts +13 -6
- package/dist/types/managers/kup-data/kup-data.d.ts +2 -1
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover-declarations.d.ts +9 -1
- package/dist/types/managers/kup-scroll-on-hover/kup-scroll-on-hover.d.ts +7 -5
- package/dist/types/utils/filters/filters-rows.d.ts +0 -2
- package/package.json +2 -2
- package/dist/cjs/cell-utils-fe64a28c.js +0 -168
- package/dist/cjs/utils-4b208b48.js +0 -447
- package/dist/esm/cell-utils-cb5d4149.js +0 -160
- package/dist/esm/utils-2c1f4122.js +0 -428
- package/dist/ketchup/p-06c6cc68.js +0 -1
- package/dist/ketchup/p-0dacd4bc.entry.js +0 -1
- package/dist/ketchup/p-1c44dc62.entry.js +0 -1
- package/dist/ketchup/p-4bc9f98b.entry.js +0 -1
- package/dist/ketchup/p-578583db.entry.js +0 -1
- package/dist/ketchup/p-5866d507.entry.js +0 -1
- package/dist/ketchup/p-61059e9d.entry.js +0 -9
- package/dist/ketchup/p-664be494.entry.js +0 -1
- package/dist/ketchup/p-67cd575d.entry.js +0 -1
- package/dist/ketchup/p-682a367a.js +0 -1
- package/dist/ketchup/p-6ccf7eb2.entry.js +0 -1
- package/dist/ketchup/p-7230ab97.entry.js +0 -1
- package/dist/ketchup/p-752b4cef.entry.js +0 -1
- package/dist/ketchup/p-7de3e7ac.entry.js +0 -1
- package/dist/ketchup/p-9b36497d.entry.js +0 -1
- package/dist/ketchup/p-b982d137.entry.js +0 -1
- package/dist/ketchup/p-c0219e5e.js +0 -1
- package/dist/ketchup/p-c55fd0a7.entry.js +0 -1
- package/dist/ketchup/p-d154b3a0.entry.js +0 -1
- package/dist/ketchup/p-d2affb6f.entry.js +0 -27
- package/dist/ketchup/p-d3b542b3.js +0 -2
- package/dist/ketchup/p-d6c12c6c.js +0 -1
- package/dist/ketchup/p-da0eab60.entry.js +0 -1
|
@@ -1,330 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const kupManager = require('./kup-manager-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const index = require('./index-06b131ea.js');
|
|
7
|
-
const fButton = require('./f-button-5b69d882.js');
|
|
3
|
+
const kupManager = require('./kup-manager-7c514a30.js');
|
|
4
|
+
const index = require('./index-31125378.js');
|
|
5
|
+
const fButton = require('./f-button-94cb5f35.js');
|
|
8
6
|
const fButtonDeclarations = require('./f-button-declarations-b611587f.js');
|
|
9
7
|
|
|
10
|
-
/**
|
|
11
|
-
* Interface for ranged filters.
|
|
12
|
-
*/
|
|
13
|
-
exports.FilterInterval = void 0;
|
|
14
|
-
(function (FilterInterval) {
|
|
15
|
-
FilterInterval[FilterInterval["FROM"] = 0] = "FROM";
|
|
16
|
-
FilterInterval[FilterInterval["TO"] = 1] = "TO";
|
|
17
|
-
})(exports.FilterInterval || (exports.FilterInterval = {}));
|
|
18
|
-
/**
|
|
19
|
-
* This regular expressions returns a match like this one:
|
|
20
|
-
* if the string does not match is null, otherwise the indexes are equal to the object below:
|
|
21
|
-
*
|
|
22
|
-
* @property {string} 0 - The entire match of the regexp; is equal to the cellValue.
|
|
23
|
-
* @property {string} 1 - Either !' or ' it's the start of the regexp.
|
|
24
|
-
* @property {string} 2 - Either % or null: means the string must start with the given string.
|
|
25
|
-
* @property {string} 3 - Either "" or a string with a length.
|
|
26
|
-
* @property {string} 4 - Either % or null: means the string must finish with the given string.
|
|
27
|
-
* @property {string} 5 - Always equal to ': it's the end of the filter.
|
|
28
|
-
*/
|
|
29
|
-
const FILTER_ANALIZER = /^('|!')(%){0,1}(.*?)(%){0,1}(')$/;
|
|
30
|
-
exports.KupGlobalFilterMode = void 0;
|
|
31
|
-
(function (KupGlobalFilterMode) {
|
|
32
|
-
KupGlobalFilterMode["SIMPLE"] = "simple";
|
|
33
|
-
KupGlobalFilterMode["HIGHLIGHT"] = "highlight";
|
|
34
|
-
})(exports.KupGlobalFilterMode || (exports.KupGlobalFilterMode = {}));
|
|
35
|
-
|
|
36
|
-
const dom$3 = document.documentElement;
|
|
37
|
-
/**
|
|
38
|
-
* Filtering algorithms.
|
|
39
|
-
* @module Filters
|
|
40
|
-
* @todo Should contain EVERY filtering method in common between filtering types (i.e.: global filters and column menu filters).
|
|
41
|
-
*/
|
|
42
|
-
class Filters {
|
|
43
|
-
/**
|
|
44
|
-
* Function used to check whether the component is a KupTree or KupDataTable.
|
|
45
|
-
* @param {KupDataTable | KupTree} comp - Component using the column menu.
|
|
46
|
-
* @returns {comp is KupTree} Returns true when the component is KupTree.
|
|
47
|
-
*/
|
|
48
|
-
static isTree(comp) {
|
|
49
|
-
return comp.rootElement.tagName === kupManager.KupTagNames.TREE;
|
|
50
|
-
}
|
|
51
|
-
isObjFiltrableByInterval(obj) {
|
|
52
|
-
if (dom$3.ketchup.objects.isDate(obj)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
if (dom$3.ketchup.objects.isTime(obj)) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
if (dom$3.ketchup.objects.isTimestamp(obj)) {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
if (dom$3.ketchup.objects.isNumber(obj)) {
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
normalizeValue(value, smeupObj) {
|
|
67
|
-
let newValue = value != null ? value.trim() : value;
|
|
68
|
-
if (newValue == null || newValue == '' || smeupObj == null) {
|
|
69
|
-
return newValue;
|
|
70
|
-
}
|
|
71
|
-
if (dom$3.ketchup.objects.isDate(smeupObj)) {
|
|
72
|
-
if (dom$3.ketchup.dates.isValid(value, kupManager.KupDatesFormats.ISO_DATE)) {
|
|
73
|
-
return newValue;
|
|
74
|
-
}
|
|
75
|
-
if (dom$3.ketchup.dates.isValid(value)) {
|
|
76
|
-
return dom$3.ketchup.dates.format(dom$3.ketchup.dates.normalize(value, kupManager.KupDatesNormalize.DATE), kupManager.KupDatesFormats.ISO_DATE);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else if (dom$3.ketchup.objects.isTime(smeupObj)) {
|
|
80
|
-
let manageSeconds = dom$3.ketchup.objects.isTimeWithSeconds(smeupObj);
|
|
81
|
-
if (dom$3.ketchup.dates.isValid(value, manageSeconds
|
|
82
|
-
? kupManager.KupDatesFormats.ISO_TIME
|
|
83
|
-
: kupManager.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS)) {
|
|
84
|
-
return newValue;
|
|
85
|
-
}
|
|
86
|
-
if (utils.isValidFormattedStringTime(value, manageSeconds)) {
|
|
87
|
-
return utils.formattedStringToCustomUnformattedStringTime(value, manageSeconds
|
|
88
|
-
? kupManager.KupDatesFormats.ISO_TIME
|
|
89
|
-
: kupManager.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS, manageSeconds);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else if (dom$3.ketchup.objects.isTimestamp(smeupObj)) {
|
|
93
|
-
if (dom$3.ketchup.dates.isValid(value, kupManager.KupDatesFormats.ISO_DATE_TIME)) {
|
|
94
|
-
return newValue;
|
|
95
|
-
}
|
|
96
|
-
if (utils.isValidFormattedStringTime(value, true)) {
|
|
97
|
-
return utils.formattedStringToDefaultUnformattedStringTimestamp(value);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (dom$3.ketchup.objects.isNumber(smeupObj)) {
|
|
101
|
-
if (utils.isValidFormattedStringNumber(value, smeupObj ? smeupObj.p : '')) {
|
|
102
|
-
return utils.formattedStringToUnformattedStringNumber(value, smeupObj ? smeupObj.p : '');
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return newValue;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Given a filter value, check if is a negative filter
|
|
109
|
-
* @param filterValue the filter value to use for check
|
|
110
|
-
*/
|
|
111
|
-
filterIsNegative(filterValue) {
|
|
112
|
-
const analyzedFilter = filterValue.match(FILTER_ANALIZER);
|
|
113
|
-
const filterIsNegative = analyzedFilter
|
|
114
|
-
? analyzedFilter[1].indexOf('!') >= 0
|
|
115
|
-
: false;
|
|
116
|
-
return filterIsNegative;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Given a value and a filter value, returns if that value matches the filter.
|
|
120
|
-
*
|
|
121
|
-
* Web filters can also be expressions: by putting strings between single quotes (') it's possible to activate filter expressions.
|
|
122
|
-
* Valid syntax:
|
|
123
|
-
* 'filter' = search for exact phrase;
|
|
124
|
-
* '' = match when value is empty;
|
|
125
|
-
* 'filter%' = match when a string starts with "filter";
|
|
126
|
-
* '%filter' = match when a string ends with "filter";
|
|
127
|
-
* '%filter%' = match when a string contains "filter".
|
|
128
|
-
*
|
|
129
|
-
* It is also possible to negate the expression by prepending "!" in front of the expression.
|
|
130
|
-
* For example: !'' = value in the cell must not be empty.
|
|
131
|
-
*
|
|
132
|
-
* With no expression set, the filter is by default set to '%filter%'.
|
|
133
|
-
*
|
|
134
|
-
* @param value - The current value to check.
|
|
135
|
-
* @param filterValue - The value of the current filter.
|
|
136
|
-
* @returns false if value or filterValue are empty;
|
|
137
|
-
true if value contains filterValue;
|
|
138
|
-
true if value matches special filter created on filterValue;
|
|
139
|
-
false otherwise.
|
|
140
|
-
*/
|
|
141
|
-
isFilterCompliantForValue(value, filterValue) {
|
|
142
|
-
if (value == null) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
if (filterValue == null) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
const _filterIsNegative = this.filterIsNegative(filterValue);
|
|
149
|
-
// checks if the value of the filter is contained inside value of the object
|
|
150
|
-
// Or is if the filter is a special filter to be matched.
|
|
151
|
-
if (value.toLowerCase().includes(filterValue.toLowerCase()) ||
|
|
152
|
-
this.matchSpecialFilter(value.toLowerCase(), filterValue.toLowerCase().match(FILTER_ANALIZER), true)) {
|
|
153
|
-
// the element matches the field filter
|
|
154
|
-
if (_filterIsNegative) {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
if (_filterIsNegative) {
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Given a value and a filter value, returns if that value matches the filter.
|
|
166
|
-
*
|
|
167
|
-
* Web filters can also be expressions: by putting strings between single quotes (') it's possible to activate filter expressions.
|
|
168
|
-
* Valid syntax:
|
|
169
|
-
* 'filter' = search for exact phrase;
|
|
170
|
-
* '' = match when value is empty;
|
|
171
|
-
* 'filter%' = match when a string starts with "filter";
|
|
172
|
-
* '%filter' = match when a string ends with "filter";
|
|
173
|
-
* '%filter%' = match when a string contains "filter".
|
|
174
|
-
*
|
|
175
|
-
* It is also possible to negate the expression by prepending "!" in front of the expression.
|
|
176
|
-
* For example: !'' = value in the cell must not be empty.
|
|
177
|
-
*
|
|
178
|
-
* With no expression set, the filter is by default set to '%filter%'.
|
|
179
|
-
*
|
|
180
|
-
* @param value - The current value to check.
|
|
181
|
-
* @param parsedFilter - The value of the current filter.
|
|
182
|
-
* @param ignoreNegativeFlag = false - When set to true, the matcher will ignore the (!) operator; useful for global filter.
|
|
183
|
-
* @returns True if the filter is empty and the value of the cell is empty, false otherwise.
|
|
184
|
-
*/
|
|
185
|
-
matchSpecialFilter(value, parsedFilter, ignoreNegativeFlag = false) {
|
|
186
|
-
if (parsedFilter != null) {
|
|
187
|
-
// endsWith and startWith are not supported by IE 11
|
|
188
|
-
// Check here https://www.w3schools.com/jsref/jsref_endswith.asp
|
|
189
|
-
const toRet = (parsedFilter[3] === '' && !value.trim()) ||
|
|
190
|
-
(!parsedFilter[2] &&
|
|
191
|
-
parsedFilter[4] &&
|
|
192
|
-
value.startsWith(parsedFilter[3])) ||
|
|
193
|
-
(parsedFilter[2] &&
|
|
194
|
-
!parsedFilter[4] &&
|
|
195
|
-
value.endsWith(parsedFilter[3])) ||
|
|
196
|
-
(!parsedFilter[2] &&
|
|
197
|
-
!parsedFilter[4] &&
|
|
198
|
-
value === parsedFilter[3]) ||
|
|
199
|
-
(parsedFilter[2] &&
|
|
200
|
-
parsedFilter[4] &&
|
|
201
|
-
value.indexOf(parsedFilter[3]) >= 0);
|
|
202
|
-
return !ignoreNegativeFlag
|
|
203
|
-
? parsedFilter[1].indexOf('!') < 0
|
|
204
|
-
? toRet
|
|
205
|
-
: !toRet
|
|
206
|
-
: toRet;
|
|
207
|
-
}
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
isFilterCompliantForSimpleValue(valueToCheck, obj, filterValue, interval) {
|
|
211
|
-
if (valueToCheck == null) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
filterValue = this.normalizeValue(filterValue, obj);
|
|
215
|
-
let value = valueToCheck;
|
|
216
|
-
let from = '';
|
|
217
|
-
let to = '';
|
|
218
|
-
if (interval != null) {
|
|
219
|
-
from = interval[exports.FilterInterval.FROM];
|
|
220
|
-
to = interval[exports.FilterInterval.TO];
|
|
221
|
-
}
|
|
222
|
-
let checkByRegularExpression = true;
|
|
223
|
-
if (dom$3.ketchup.objects.isNumber(obj)) {
|
|
224
|
-
value = utils.unformattedStringNumberToNumber(value, obj ? obj.p : '');
|
|
225
|
-
let valueNumber = utils.stringToNumber(value);
|
|
226
|
-
if (from != '') {
|
|
227
|
-
if (utils.isNumber(from)) {
|
|
228
|
-
checkByRegularExpression = false;
|
|
229
|
-
let fromNumber = utils.stringToNumber(from);
|
|
230
|
-
if (valueNumber < fromNumber) {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
filterValue = from;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
if (to != '') {
|
|
239
|
-
if (utils.isNumber(to)) {
|
|
240
|
-
checkByRegularExpression = false;
|
|
241
|
-
let toNumber = utils.stringToNumber(to);
|
|
242
|
-
if (valueNumber > toNumber) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
filterValue = to;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (dom$3.ketchup.objects.isDate(obj) ||
|
|
252
|
-
dom$3.ketchup.objects.isTime(obj) ||
|
|
253
|
-
dom$3.ketchup.objects.isTimestamp(obj)) {
|
|
254
|
-
let valueDate = null;
|
|
255
|
-
let defaultFormat = kupManager.KupDatesFormats.ISO_DATE;
|
|
256
|
-
if (dom$3.ketchup.objects.isDate(obj)) {
|
|
257
|
-
defaultFormat = kupManager.KupDatesFormats.ISO_DATE;
|
|
258
|
-
}
|
|
259
|
-
else if (dom$3.ketchup.objects.isTime(obj)) {
|
|
260
|
-
defaultFormat = dom$3.ketchup.objects.isTimeWithSeconds(obj)
|
|
261
|
-
? kupManager.KupDatesFormats.ISO_TIME
|
|
262
|
-
: kupManager.KupDatesFormats.ISO_TIME_WITHOUT_SECONDS;
|
|
263
|
-
}
|
|
264
|
-
else if (dom$3.ketchup.objects.isTimestamp(obj)) {
|
|
265
|
-
defaultFormat = kupManager.KupDatesFormats.ISO_DATE_TIME;
|
|
266
|
-
}
|
|
267
|
-
if (dom$3.ketchup.dates.isValid(value, defaultFormat, true)) {
|
|
268
|
-
valueDate = dom$3.ketchup.dates.toDate(value, defaultFormat);
|
|
269
|
-
}
|
|
270
|
-
if (from != '') {
|
|
271
|
-
if (valueDate != null &&
|
|
272
|
-
dom$3.ketchup.dates.isValid(from, defaultFormat, true)) {
|
|
273
|
-
checkByRegularExpression = false;
|
|
274
|
-
let fromDate = dom$3.ketchup.dates.toDate(from, defaultFormat);
|
|
275
|
-
if (valueDate < fromDate) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
else {
|
|
280
|
-
filterValue = from;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (to != '') {
|
|
284
|
-
if (valueDate != null &&
|
|
285
|
-
dom$3.ketchup.dates.isValid(to, defaultFormat, true)) {
|
|
286
|
-
checkByRegularExpression = false;
|
|
287
|
-
let toDate = dom$3.ketchup.dates.toDate(to, defaultFormat);
|
|
288
|
-
if (valueDate > toDate) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
filterValue = to;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
if (!dom$3.ketchup.dates.isValid(filterValue, defaultFormat) &&
|
|
297
|
-
!dom$3.ketchup.dates.isValid(filterValue)) {
|
|
298
|
-
value = dom$3.ketchup.dates.format(value);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (checkByRegularExpression) {
|
|
302
|
-
return this.isFilterCompliantForValue(value, filterValue);
|
|
303
|
-
}
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
static valuesArrayContainsValue(values, value) {
|
|
307
|
-
return Filters.indexOfValueInValuesArray(values, value) >= 0;
|
|
308
|
-
}
|
|
309
|
-
static indexOfValueInValuesArray(values, value) {
|
|
310
|
-
if (values == null || values.length < 1) {
|
|
311
|
-
return -1;
|
|
312
|
-
}
|
|
313
|
-
for (let i = 0; i < values.length; i++) {
|
|
314
|
-
if (values[i].value == value) {
|
|
315
|
-
return i;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return -1;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
8
|
/**
|
|
323
9
|
* Filtering algorithms related to column menus.
|
|
324
10
|
* @module FiltersColumnMenu
|
|
325
11
|
* @todo Should contain EVERY column-specific filtering method.
|
|
326
12
|
*/
|
|
327
|
-
class FiltersColumnMenu extends Filters {
|
|
13
|
+
class FiltersColumnMenu extends kupManager.Filters {
|
|
328
14
|
/**
|
|
329
15
|
* Gets the value of the filter prop.
|
|
330
16
|
* @param {GenericFilter} filters - Filters of the component.
|
|
@@ -436,11 +122,11 @@ class FiltersColumnMenu extends Filters {
|
|
|
436
122
|
if (!this.isColumnFiltrableByInterval(column)) {
|
|
437
123
|
return false;
|
|
438
124
|
}
|
|
439
|
-
let intervalFrom = this._getIntervalTextFieldFilterValue(filters, column.name,
|
|
125
|
+
let intervalFrom = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp);
|
|
440
126
|
if (intervalFrom != null && intervalFrom.trim() != '') {
|
|
441
127
|
return true;
|
|
442
128
|
}
|
|
443
|
-
let intervalTo = this._getIntervalTextFieldFilterValue(filters, column.name,
|
|
129
|
+
let intervalTo = this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp);
|
|
444
130
|
if (intervalTo != null && intervalTo.trim() != '') {
|
|
445
131
|
return true;
|
|
446
132
|
}
|
|
@@ -474,7 +160,7 @@ class FiltersColumnMenu extends Filters {
|
|
|
474
160
|
filter.checkBoxes = [];
|
|
475
161
|
}
|
|
476
162
|
else {
|
|
477
|
-
if (!Filters.valuesArrayContainsValue(filter.checkBoxes, newFilterItem.value)) {
|
|
163
|
+
if (!kupManager.Filters.valuesArrayContainsValue(filter.checkBoxes, newFilterItem.value)) {
|
|
478
164
|
filter.checkBoxes[filter.checkBoxes.length] = newFilterItem;
|
|
479
165
|
}
|
|
480
166
|
}
|
|
@@ -496,7 +182,7 @@ class FiltersColumnMenu extends Filters {
|
|
|
496
182
|
if (filter.checkBoxes == null) {
|
|
497
183
|
filter.checkBoxes = [];
|
|
498
184
|
}
|
|
499
|
-
let index = Filters.indexOfValueInValuesArray(filter.checkBoxes, remFilter);
|
|
185
|
+
let index = kupManager.Filters.indexOfValueInValuesArray(filter.checkBoxes, remFilter);
|
|
500
186
|
if (index >= 0) {
|
|
501
187
|
let chs = [];
|
|
502
188
|
for (let i = 0; i < filter.checkBoxes.length; i++) {
|
|
@@ -521,8 +207,8 @@ class FiltersColumnMenu extends Filters {
|
|
|
521
207
|
return ['', ''];
|
|
522
208
|
}
|
|
523
209
|
let values = [
|
|
524
|
-
this._getIntervalTextFieldFilterValue(filters, column.name,
|
|
525
|
-
this._getIntervalTextFieldFilterValue(filters, column.name,
|
|
210
|
+
this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.FROM, tmp),
|
|
211
|
+
this._getIntervalTextFieldFilterValue(filters, column.name, kupManager.FilterInterval.TO, tmp),
|
|
526
212
|
];
|
|
527
213
|
return values;
|
|
528
214
|
}
|
|
@@ -613,43 +299,43 @@ class FiltersColumnMenu extends Filters {
|
|
|
613
299
|
}
|
|
614
300
|
saveTextualFilters(filters = {}, column) {
|
|
615
301
|
this._setTextFieldFilterValue(filters, column, this.getTextFilterValueTmp(filters, column), false);
|
|
616
|
-
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column,
|
|
617
|
-
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column,
|
|
302
|
+
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, false);
|
|
303
|
+
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValueTmp(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, false);
|
|
618
304
|
}
|
|
619
305
|
resetTextualFilters(filters = {}, column) {
|
|
620
306
|
this._setTextFieldFilterValue(filters, column, this.getTextFilterValue(filters, column), true);
|
|
621
|
-
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column,
|
|
622
|
-
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column,
|
|
307
|
+
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.FROM), kupManager.FilterInterval.FROM, true);
|
|
308
|
+
this._setIntervalTextFieldFilterValue(filters, column, this.getIntervalTextFieldFilterValue(filters, column, kupManager.FilterInterval.TO), kupManager.FilterInterval.TO, true);
|
|
623
309
|
}
|
|
624
310
|
getFilterValueForTooltip(filters = {}, column) {
|
|
625
311
|
let txtFilter = this.getTextFilterValue(filters, column.name);
|
|
626
312
|
let interval = this.getIntervalTextFieldFilterValues(filters, column);
|
|
627
313
|
let chkFilters = this.getCheckBoxFilterValues(filters, column.name);
|
|
628
314
|
let separator = '';
|
|
629
|
-
let txtFiterRis =
|
|
315
|
+
let txtFiterRis = kupManager.getValueForDisplay(txtFilter, column.obj, column.decimals);
|
|
630
316
|
if (txtFilter != '') {
|
|
631
317
|
separator = ' AND ';
|
|
632
318
|
}
|
|
633
|
-
if (interval[
|
|
319
|
+
if (interval[kupManager.FilterInterval.FROM] != '') {
|
|
634
320
|
txtFiterRis +=
|
|
635
321
|
separator +
|
|
636
322
|
'(>= ' +
|
|
637
|
-
|
|
323
|
+
kupManager.getValueForDisplay(interval[kupManager.FilterInterval.FROM], column.obj, column.decimals) +
|
|
638
324
|
')';
|
|
639
325
|
separator = ' AND ';
|
|
640
326
|
}
|
|
641
|
-
if (interval[
|
|
327
|
+
if (interval[kupManager.FilterInterval.TO] != '') {
|
|
642
328
|
txtFiterRis +=
|
|
643
329
|
separator +
|
|
644
330
|
'(<= ' +
|
|
645
|
-
|
|
331
|
+
kupManager.getValueForDisplay(interval[kupManager.FilterInterval.TO], column.obj, column.decimals) +
|
|
646
332
|
')';
|
|
647
333
|
separator = ' AND ';
|
|
648
334
|
}
|
|
649
335
|
separator = '';
|
|
650
336
|
let ris = '';
|
|
651
337
|
chkFilters.forEach((f) => {
|
|
652
|
-
ris += separator +
|
|
338
|
+
ris += separator + kupManager.getValueForDisplay2(f, column);
|
|
653
339
|
separator = ' OR ';
|
|
654
340
|
});
|
|
655
341
|
if (ris != '') {
|
|
@@ -727,12 +413,13 @@ const dom$2 = document.documentElement;
|
|
|
727
413
|
const kupObjects = dom$2.ketchup
|
|
728
414
|
? dom$2.ketchup.objects
|
|
729
415
|
: new kupManager.KupObjects();
|
|
416
|
+
const kupData = dom$2.ketchup ? dom$2.ketchup.data : new kupManager.KupData();
|
|
730
417
|
/**
|
|
731
418
|
* Filtering algorithms related to data-table rows.
|
|
732
419
|
* @module FiltersRows
|
|
733
420
|
* @todo Should contain EVERY row-specific filtering method.
|
|
734
421
|
*/
|
|
735
|
-
class FiltersRows extends Filters {
|
|
422
|
+
class FiltersRows extends kupManager.Filters {
|
|
736
423
|
isFilterCompliantForCell(cellValue, filterValue, interval) {
|
|
737
424
|
if (!cellValue) {
|
|
738
425
|
return false;
|
|
@@ -768,7 +455,7 @@ class FiltersRows extends Filters {
|
|
|
768
455
|
continue;
|
|
769
456
|
}
|
|
770
457
|
retValue = this.isFilterCompliantForValue(cell.value, globalFilter);
|
|
771
|
-
let displayedValue =
|
|
458
|
+
let displayedValue = kupManager.getCellValueForDisplay(columns[i], cell);
|
|
772
459
|
if (displayedValue != cell.value) {
|
|
773
460
|
retValue =
|
|
774
461
|
retValue ||
|
|
@@ -802,7 +489,7 @@ class FiltersRows extends Filters {
|
|
|
802
489
|
return false;
|
|
803
490
|
}
|
|
804
491
|
let filterValue = columnFilters.getTextFilterValue(filters, key);
|
|
805
|
-
let interval = columnFilters.getIntervalTextFieldFilterValues(filters,
|
|
492
|
+
let interval = columnFilters.getIntervalTextFieldFilterValues(filters, kupManager.getColumnByName(columns, key));
|
|
806
493
|
const _filterIsNegative = this.filterIsNegative(filterValue);
|
|
807
494
|
let b1 = this.isFilterCompliantForCell(cell, filterValue, interval);
|
|
808
495
|
let b2 = _filterIsNegative;
|
|
@@ -874,7 +561,7 @@ class FiltersRows extends Filters {
|
|
|
874
561
|
};
|
|
875
562
|
}
|
|
876
563
|
else {
|
|
877
|
-
col =
|
|
564
|
+
col = kupManager.getColumnByName(columns, key);
|
|
878
565
|
}
|
|
879
566
|
if (columnFilters.hasFiltersForColumn(filters, col)) {
|
|
880
567
|
return true;
|
|
@@ -925,12 +612,12 @@ class FiltersRows extends Filters {
|
|
|
925
612
|
column.valuesForFilter.length > 0) {
|
|
926
613
|
column.valuesForFilter.forEach((element) => {
|
|
927
614
|
let v = element;
|
|
928
|
-
if (Filters.valuesArrayContainsValue(checkboxes, v) ||
|
|
615
|
+
if (kupManager.Filters.valuesArrayContainsValue(checkboxes, v) ||
|
|
929
616
|
value == '' ||
|
|
930
617
|
columnFilters.isFilterCompliantForSimpleValue(v, column.obj, value, interval)) {
|
|
931
618
|
values.push({
|
|
932
619
|
value: v,
|
|
933
|
-
displayedValue:
|
|
620
|
+
displayedValue: kupManager.getValueForDisplay(v, column.obj, column.decimals),
|
|
934
621
|
});
|
|
935
622
|
}
|
|
936
623
|
});
|
|
@@ -950,27 +637,7 @@ class FiltersRows extends Filters {
|
|
|
950
637
|
for (let i = 0; i < checkboxes.length; i++) {
|
|
951
638
|
values.push(checkboxes[i]);
|
|
952
639
|
}
|
|
953
|
-
|
|
954
|
-
values.sort((n1, n2) => {
|
|
955
|
-
return cellUtils.compareValues(null, cellUtils.getValueForDisplay2(n1, column), null, cellUtils.getValueForDisplay2(n2, column), kupManager.SortMode.A);
|
|
956
|
-
});
|
|
957
|
-
return values;
|
|
958
|
-
}
|
|
959
|
-
extractColumnValues(rows, column, values) {
|
|
960
|
-
/** il valore delle righe attualmente filtrate, formattato */
|
|
961
|
-
rows.forEach((row) => this.addColumnValueFromRow(values, column, row.cells[column.name]));
|
|
962
|
-
return values;
|
|
963
|
-
}
|
|
964
|
-
addColumnValueFromRow(values, column, cell) {
|
|
965
|
-
if (cell) {
|
|
966
|
-
let item = {
|
|
967
|
-
value: cell.value,
|
|
968
|
-
displayedValue: cellUtils.getCellValueForDisplay(column, cell),
|
|
969
|
-
};
|
|
970
|
-
if (!Filters.valuesArrayContainsValue(values, cell.value)) {
|
|
971
|
-
values.push(item);
|
|
972
|
-
}
|
|
973
|
-
}
|
|
640
|
+
return kupData.cell.getValue({ rows: tmpRows }, column, true);
|
|
974
641
|
}
|
|
975
642
|
}
|
|
976
643
|
|
|
@@ -1033,7 +700,7 @@ function sortGroupRows(rows = [], sort = []) {
|
|
|
1033
700
|
obj: r2.group.obj,
|
|
1034
701
|
value: r2.group.id,
|
|
1035
702
|
};
|
|
1036
|
-
return
|
|
703
|
+
return kupManager.compareCell(cell1, cell2, sortObject.sortMode);
|
|
1037
704
|
});
|
|
1038
705
|
// sorting children
|
|
1039
706
|
rows.forEach((row) => {
|
|
@@ -1064,7 +731,7 @@ function compareRows(r1, r2, sortObj) {
|
|
|
1064
731
|
if (!cell2) {
|
|
1065
732
|
return -1;
|
|
1066
733
|
}
|
|
1067
|
-
return
|
|
734
|
+
return kupManager.compareCell(cell1, cell2, sortObj.sortMode);
|
|
1068
735
|
}
|
|
1069
736
|
//-------- FILTER FUNCTIONS --------
|
|
1070
737
|
/**
|
|
@@ -1117,8 +784,8 @@ function groupRows(columns = [], rows = [], groups = [], totals = {}) {
|
|
|
1117
784
|
// getting row value
|
|
1118
785
|
const cell = row.cells[columnName];
|
|
1119
786
|
if (cell) {
|
|
1120
|
-
const column =
|
|
1121
|
-
const cellValueForDisplay =
|
|
787
|
+
const column = kupManager.getColumnByName(columns, columnName);
|
|
788
|
+
const cellValueForDisplay = kupManager.getCellValueForDisplay(column, cell);
|
|
1122
789
|
const cellValue = cell.value;
|
|
1123
790
|
let groupRow = null;
|
|
1124
791
|
// check in already in groupedRow
|
|
@@ -1152,8 +819,8 @@ function groupRows(columns = [], rows = [], groups = [], totals = {}) {
|
|
|
1152
819
|
// getting cell value
|
|
1153
820
|
const tempCell = row.cells[group.column];
|
|
1154
821
|
if (tempCell) {
|
|
1155
|
-
const column =
|
|
1156
|
-
const tempCellValueForDisplay =
|
|
822
|
+
const column = kupManager.getColumnByName(columns, group.column);
|
|
823
|
+
const tempCellValueForDisplay = kupManager.getCellValueForDisplay(column, tempCell);
|
|
1157
824
|
const tempCellValue = tempCell.value;
|
|
1158
825
|
// check if group already exists
|
|
1159
826
|
let tempGroupingRow = null;
|
|
@@ -1224,7 +891,7 @@ function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
|
|
|
1224
891
|
case kupManager.TotalMode.DISTINCT:
|
|
1225
892
|
let cellValue;
|
|
1226
893
|
if (_isNumber) {
|
|
1227
|
-
cellValue = dom$1.ketchup.math.numberify(
|
|
894
|
+
cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1228
895
|
}
|
|
1229
896
|
else {
|
|
1230
897
|
cellValue = cell.value;
|
|
@@ -1276,7 +943,7 @@ function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
|
|
|
1276
943
|
case kupManager.TotalMode.SUM:
|
|
1277
944
|
case kupManager.TotalMode.AVERAGE:
|
|
1278
945
|
if (_isNumber) {
|
|
1279
|
-
const cellValue = dom$1.ketchup.math.numberify(
|
|
946
|
+
const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1280
947
|
groupRow.group.totals[key] =
|
|
1281
948
|
cellValue + currentTotalValue;
|
|
1282
949
|
// updating parents
|
|
@@ -1293,7 +960,7 @@ function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
|
|
|
1293
960
|
case kupManager.TotalMode.MIN:
|
|
1294
961
|
if (_isNumber) {
|
|
1295
962
|
const currentTotalValue = groupRow.group.totals[key];
|
|
1296
|
-
const cellValue = dom$1.ketchup.math.numberify(
|
|
963
|
+
const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1297
964
|
if (currentTotalValue) {
|
|
1298
965
|
groupRow.group.totals[key] = Math.min(currentTotalValue, cellValue);
|
|
1299
966
|
}
|
|
@@ -1356,7 +1023,7 @@ function updateGroupTotal(groupRow, totals, addedRow, distinctObj) {
|
|
|
1356
1023
|
case kupManager.TotalMode.MAX:
|
|
1357
1024
|
if (_isNumber) {
|
|
1358
1025
|
const currentTotalValue = groupRow.group.totals[key];
|
|
1359
|
-
const cellValue = dom$1.ketchup.math.numberify(
|
|
1026
|
+
const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1360
1027
|
if (currentTotalValue) {
|
|
1361
1028
|
groupRow.group.totals[key] = Math.max(currentTotalValue, cellValue);
|
|
1362
1029
|
}
|
|
@@ -1539,8 +1206,9 @@ function calcTotals(rows = [], totals = {}) {
|
|
|
1539
1206
|
}
|
|
1540
1207
|
const keys = Object.keys(totals);
|
|
1541
1208
|
const footerRow = {};
|
|
1209
|
+
const dateColumns = new Array();
|
|
1542
1210
|
// if there are only COUNT, no need to loop on rows
|
|
1543
|
-
let onlyCount = keys.length === 0
|
|
1211
|
+
let onlyCount = keys.length === 0 ||
|
|
1544
1212
|
keys.every((key) => totals[key] === kupManager.TotalMode.COUNT);
|
|
1545
1213
|
if (onlyCount) {
|
|
1546
1214
|
keys.forEach((columnName) => (footerRow[columnName] = rows.length));
|
|
@@ -1556,7 +1224,7 @@ function calcTotals(rows = [], totals = {}) {
|
|
|
1556
1224
|
if (totals[key] === kupManager.TotalMode.DISTINCT) {
|
|
1557
1225
|
let cellValue;
|
|
1558
1226
|
if (dom$1.ketchup.objects.isNumber(cell.obj)) {
|
|
1559
|
-
cellValue = dom$1.ketchup.math.numberify(
|
|
1227
|
+
cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1560
1228
|
}
|
|
1561
1229
|
else {
|
|
1562
1230
|
cellValue = cell.value;
|
|
@@ -1573,7 +1241,7 @@ function calcTotals(rows = [], totals = {}) {
|
|
|
1573
1241
|
}
|
|
1574
1242
|
}
|
|
1575
1243
|
else if (dom$1.ketchup.objects.isNumber(cell.obj)) {
|
|
1576
|
-
const cellValue = dom$1.ketchup.math.numberify(
|
|
1244
|
+
const cellValue = dom$1.ketchup.math.numberify(kupManager.stringToNumber(cell.value));
|
|
1577
1245
|
let currentFooterValue = footerRow[key];
|
|
1578
1246
|
switch (true) {
|
|
1579
1247
|
// TODO DRY the MIN and MAX functions
|
|
@@ -1603,35 +1271,40 @@ function calcTotals(rows = [], totals = {}) {
|
|
|
1603
1271
|
// TODO DRY the MIN and MAX functions
|
|
1604
1272
|
}
|
|
1605
1273
|
else if (dom$1.ketchup.objects.isDate(cell.obj)) {
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1274
|
+
if (dateColumns.indexOf(key) == -1) {
|
|
1275
|
+
dateColumns.push(key);
|
|
1276
|
+
}
|
|
1277
|
+
const momentValue = dom$1.ketchup.dates.toDayjs(cell.value);
|
|
1609
1278
|
if (dom$1.ketchup.dates.isValid(momentValue)) {
|
|
1610
1279
|
const cellValue = dom$1.ketchup.dates.toDate(momentValue);
|
|
1611
|
-
const currentFooterValue = footerRow[key]
|
|
1280
|
+
const currentFooterValue = footerRow[key]
|
|
1281
|
+
? dom$1.ketchup.dates.toDate(dom$1.ketchup.dates.toDayjs(footerRow[key]))
|
|
1282
|
+
: null;
|
|
1612
1283
|
switch (true) {
|
|
1613
1284
|
case totals[key] === kupManager.TotalMode.MIN:
|
|
1614
1285
|
if (currentFooterValue) {
|
|
1615
1286
|
let moments = [];
|
|
1616
1287
|
moments.push(cellValue);
|
|
1617
|
-
moments.push(
|
|
1288
|
+
moments.push(currentFooterValue);
|
|
1618
1289
|
footerRow[key] =
|
|
1619
|
-
dom$1.ketchup.dates.format(dom$1.ketchup.dates.min(moments));
|
|
1290
|
+
dom$1.ketchup.dates.format(dom$1.ketchup.dates.min(moments), kupManager.KupDatesFormats.ISO_DATE);
|
|
1620
1291
|
}
|
|
1621
1292
|
else {
|
|
1622
|
-
footerRow[key] =
|
|
1293
|
+
footerRow[key] =
|
|
1294
|
+
dom$1.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
|
|
1623
1295
|
}
|
|
1624
1296
|
break;
|
|
1625
1297
|
case totals[key] === kupManager.TotalMode.MAX:
|
|
1626
1298
|
if (currentFooterValue) {
|
|
1627
1299
|
let moments = [];
|
|
1628
1300
|
moments.push(cellValue);
|
|
1629
|
-
moments.push(
|
|
1301
|
+
moments.push(currentFooterValue);
|
|
1630
1302
|
footerRow[key] =
|
|
1631
|
-
dom$1.ketchup.dates.format(dom$1.ketchup.dates.max(moments));
|
|
1303
|
+
dom$1.ketchup.dates.format(dom$1.ketchup.dates.max(moments), kupManager.KupDatesFormats.ISO_DATE);
|
|
1632
1304
|
}
|
|
1633
1305
|
else {
|
|
1634
|
-
footerRow[key] =
|
|
1306
|
+
footerRow[key] =
|
|
1307
|
+
dom$1.ketchup.dates.format(cellValue, kupManager.KupDatesFormats.ISO_DATE);
|
|
1635
1308
|
}
|
|
1636
1309
|
break;
|
|
1637
1310
|
}
|
|
@@ -1646,23 +1319,28 @@ function calcTotals(rows = [], totals = {}) {
|
|
|
1646
1319
|
}
|
|
1647
1320
|
});
|
|
1648
1321
|
});
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1322
|
+
}
|
|
1323
|
+
// fixing MATH, AVERAGE and COUNT
|
|
1324
|
+
for (let key of keys) {
|
|
1325
|
+
switch (true) {
|
|
1326
|
+
case totals[key] === kupManager.TotalMode.AVERAGE:
|
|
1327
|
+
const sum = footerRow[key];
|
|
1328
|
+
if (sum && rows.length > 0) {
|
|
1329
|
+
footerRow[key] = sum / rows.length;
|
|
1330
|
+
}
|
|
1331
|
+
break;
|
|
1332
|
+
case totals[key] === kupManager.TotalMode.COUNT:
|
|
1333
|
+
footerRow[key] = rows.length;
|
|
1334
|
+
break;
|
|
1335
|
+
case totals[key].indexOf(kupManager.TotalMode.MATH) == 0:
|
|
1336
|
+
footerRow[key] = dom$1.ketchup.math.formulas.custom(totals[key].substring(kupManager.TotalMode.MATH.length), footerRow);
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1339
|
+
if (footerRow[key]) {
|
|
1340
|
+
if (dateColumns.indexOf(key) != -1) {
|
|
1341
|
+
footerRow[key] = dom$1.ketchup.dates.format(footerRow[key]);
|
|
1664
1342
|
}
|
|
1665
|
-
if (footerRow[key]) {
|
|
1343
|
+
else if (kupManager.isNumber(footerRow[key])) {
|
|
1666
1344
|
footerRow[key] = +footerRow[key].toFixed(2);
|
|
1667
1345
|
}
|
|
1668
1346
|
}
|
|
@@ -1856,7 +1534,7 @@ function isPrevPageDisabled(props) {
|
|
|
1856
1534
|
}
|
|
1857
1535
|
|
|
1858
1536
|
function pageChange(pageNumber, max, perPage) {
|
|
1859
|
-
if (
|
|
1537
|
+
if (kupManager.isNumber(pageNumber)) {
|
|
1860
1538
|
const numberOfPages = Math.ceil(max / perPage);
|
|
1861
1539
|
let tmpNewPage = pageNumber;
|
|
1862
1540
|
if (tmpNewPage > numberOfPages) {
|
|
@@ -1870,7 +1548,7 @@ function pageChange(pageNumber, max, perPage) {
|
|
|
1870
1548
|
return null;
|
|
1871
1549
|
}
|
|
1872
1550
|
function rowsPerPageChange(rowsNumber, max) {
|
|
1873
|
-
if (
|
|
1551
|
+
if (kupManager.isNumber(rowsNumber)) {
|
|
1874
1552
|
let tmpRowsPerPage = rowsNumber;
|
|
1875
1553
|
if (tmpRowsPerPage > max) {
|
|
1876
1554
|
tmpRowsPerPage = max;
|
|
@@ -1884,7 +1562,6 @@ function rowsPerPageChange(rowsNumber, max) {
|
|
|
1884
1562
|
}
|
|
1885
1563
|
|
|
1886
1564
|
exports.FPaginator = FPaginator;
|
|
1887
|
-
exports.Filters = Filters;
|
|
1888
1565
|
exports.FiltersColumnMenu = FiltersColumnMenu;
|
|
1889
1566
|
exports.FiltersRows = FiltersRows;
|
|
1890
1567
|
exports.calcTotals = calcTotals;
|