jsl-ui 9.28.2 → 9.28.4
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/lib/components/IntervalComponent.js +32 -35
- package/lib/components/auto-suggest/AutoSuggestComponent.js +19 -21
- package/lib/components/button/ButtonComponent.js +13 -30
- package/lib/components/checkbox/CheckBoxComponent.js +22 -39
- package/lib/components/date/DateComponent.js +29 -46
- package/lib/components/date-range/DateRangeComponent.js +48 -63
- package/lib/components/date-time/DateTimeComponent.js +17 -31
- package/lib/components/dialog/DialogComponent.js +75 -134
- package/lib/components/drop-down/DropDownComponent.js +23 -37
- package/lib/components/expander/ExpanderComponent.js +20 -23
- package/lib/components/form-field/FormComponent.js +9 -12
- package/lib/components/form-field/FormFieldComponent.js +28 -30
- package/lib/components/grid/GridComponent.js +46 -52
- package/lib/components/input/InputComponent.js +26 -47
- package/lib/components/loading/LoadingComponent.js +7 -9
- package/lib/components/navigation/NavigationComponent.js +20 -43
- package/lib/components/notification/Notification.js +18 -22
- package/lib/components/number/NumberComponent.js +28 -46
- package/lib/components/overlay/OverlayComponent.js +45 -60
- package/lib/components/progress/ProgressComponent.js +15 -17
- package/lib/components/ribbon-menu/RibbonMenuComponent.js +9 -20
- package/lib/components/select/SelectComponent.js +105 -122
- package/lib/components/select/SelectDDAreaComponent.js +108 -122
- package/lib/components/slider/nouislider.js +1 -1
- package/lib/components/stack-panel/SplitterComponent.js +27 -29
- package/lib/components/stack-panel/StackPanelComponent.js +17 -31
- package/lib/components/tabs/TabsComponent.js +53 -66
- package/lib/components/time/TimeComponent.js +32 -43
- package/lib/components/tree-view/TreeViewComponent.js +13 -16
- package/lib/components/virtual-render/VirtualRenderComponent.js +30 -44
- package/lib/core/culture.js +2 -2
- package/lib/core/date.js +68 -72
- package/lib/core/helper.js +30 -34
- package/lib/core/jq.js +54 -63
- package/lib/core/lang.js +24 -28
- package/lib/core/numeric.js +35 -39
- package/lib/grid/filterDialogs/dateRangeFilter.js +98 -148
- package/lib/grid/filterDialogs/excelFilter.js +205 -271
- package/lib/grid/plugins/ext.overlay.js +9 -9
- package/lib/grid/plugins/slick.cellrangedecorator.js +2 -2
- package/lib/grid/plugins/slick.cellrangeselector.js +1 -1
- package/lib/grid/plugins/slick.cellselectionmodel.js +8 -8
- package/lib/grid/plugins/slick.headerbuttons.js +1 -1
- package/lib/grid/plugins/slick.headermenu.js +1 -1
- package/lib/grid/plugins/slick.rowmovemanager.js +2 -2
- package/lib/grid/plugins/slick.rowselectionmodel.js +1 -1
- package/lib/grid/slick.core.js +1 -1
- package/lib/grid/slick.creator.js +144 -144
- package/lib/grid/slick.dataview.js +127 -138
- package/lib/grid/slick.editors.core.js +1 -1
- package/lib/grid/slick.editors.date.js +2 -2
- package/lib/grid/slick.editors.lookup.js +36 -37
- package/lib/grid/slick.editors.nav.js +1 -1
- package/lib/grid/slick.formatters.js +26 -26
- package/lib/grid/slick.grid.js +163 -166
- package/lib/grid/slick.groupitemmetadataprovider.js +4 -4
- package/lib/grid/slick.tree.js +91 -103
- package/lib/index.js.map +1 -1
- package/lib/interaction/eventhandler.js +20 -23
- package/lib/interaction/moveable.js +76 -90
- package/lib/interaction/resizable.js +58 -72
- package/lib/ui/auto.suggest.js +13 -28
- package/lib/ui/date.picker/lib/fns.js +1 -5
- package/lib/ui/dialog.js +28 -43
- package/lib/ui/drop.down.js +4 -4
- package/lib/ui/number.input.js +8 -19
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jQueryReplacement } from "../core/jq";
|
|
2
2
|
import { Slick } from "./slick.core";
|
|
3
|
-
|
|
3
|
+
let $ = jQueryReplacement;
|
|
4
4
|
$.deepExtend(Slick, {
|
|
5
5
|
Data: {
|
|
6
6
|
GroupItemMetadataProvider: GroupItemMetadataProvider
|
|
@@ -43,7 +43,7 @@ export function GroupItemMetadataProvider(options) {
|
|
|
43
43
|
if (!options.enableExpandCollapse) {
|
|
44
44
|
return item.title;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
let indentation = item.level * 15 + "px";
|
|
47
47
|
return (options.checkboxSelect ? '<span class="' + options.checkboxSelectCssClass +
|
|
48
48
|
' ' + (item.selectChecked ? 'checked' : 'unchecked') + '"></span>' : '') +
|
|
49
49
|
"<span class='" + options.toggleCssClass + " " +
|
|
@@ -55,12 +55,12 @@ export function GroupItemMetadataProvider(options) {
|
|
|
55
55
|
"</span>";
|
|
56
56
|
}
|
|
57
57
|
function defaultTotalsCellFormatter(row, cell, value, columnDef, item, grid) {
|
|
58
|
-
|
|
58
|
+
let formatter_res;
|
|
59
59
|
if (columnDef.groupTotalsFormatter) {
|
|
60
60
|
formatter_res = columnDef.groupTotalsFormatter(item, columnDef, grid) || "";
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
|
|
63
|
+
let res = (item.avg && item.avg[columnDef.field])
|
|
64
64
|
|| (item.sum && item.sum[columnDef.field])
|
|
65
65
|
|| (item.max && item.max[columnDef.field])
|
|
66
66
|
|| (item.min && item.min[columnDef.field]);
|
package/lib/grid/slick.tree.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import "./slick.tree.css";
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
export let IndentFormatter = function (row, cell, value, columnDef, dataContext, grid) {
|
|
3
|
+
let result = "";
|
|
4
|
+
const hierachy = grid._hierachy;
|
|
16
5
|
if (hierachy != null) {
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
const options = hierachy.getOptions();
|
|
7
|
+
const level = hierachy.getLevel(dataContext);
|
|
19
8
|
if (level > 0) {
|
|
20
9
|
result += "<span class='jsl-indent' style='min-width:" + (level * hierachy.getOptions().indentInRem) + "rem;'></span>";
|
|
21
10
|
}
|
|
22
11
|
if (options.enableCollapsing) {
|
|
23
|
-
|
|
12
|
+
const hasChildren = hierachy.hasChildren(dataContext);
|
|
24
13
|
if (hasChildren) {
|
|
25
14
|
if (dataContext[options.collapsedStateField]) {
|
|
26
15
|
result += "<span class='jsl-toggle'>" + options.expandIconHTML + "</span>";
|
|
@@ -39,83 +28,85 @@ export var IndentFormatter = function (row, cell, value, columnDef, dataContext,
|
|
|
39
28
|
}
|
|
40
29
|
return result;
|
|
41
30
|
};
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
export class GridTree {
|
|
32
|
+
constructor(grid, o) {
|
|
44
33
|
this.grid = grid;
|
|
45
|
-
this.options =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
34
|
+
this.options = {
|
|
35
|
+
...{
|
|
36
|
+
enableCollapsing: true,
|
|
37
|
+
indentInRem: 1,
|
|
38
|
+
hiddenStateField: "_hidden_by_h",
|
|
39
|
+
collapsedStateField: "_callapsed",
|
|
40
|
+
expandIconHTML: "▶", // "˃",
|
|
41
|
+
collapseIconHTML: "▼" // "˅"
|
|
42
|
+
}, ...o
|
|
43
|
+
};
|
|
53
44
|
this.primaryKey = this.grid.getOptions().primaryKey;
|
|
54
45
|
grid._hierachy = this;
|
|
55
46
|
grid.refresh();
|
|
56
47
|
this.initEvents();
|
|
57
48
|
}
|
|
58
|
-
|
|
49
|
+
getOptions() {
|
|
59
50
|
return this.options;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
}
|
|
52
|
+
getLevel(item) {
|
|
53
|
+
let level = 0;
|
|
54
|
+
let parent = this.getParent(item);
|
|
64
55
|
while (parent != null) {
|
|
65
56
|
parent = this.getParent(parent);
|
|
66
57
|
level++;
|
|
67
58
|
}
|
|
68
59
|
return level;
|
|
69
|
-
}
|
|
70
|
-
|
|
60
|
+
}
|
|
61
|
+
getParent(item) {
|
|
71
62
|
return this.grid.dataView.getItemById(item[this.options.parentColumn]);
|
|
72
|
-
}
|
|
73
|
-
|
|
63
|
+
}
|
|
64
|
+
hasChildren(item) {
|
|
74
65
|
return this.rowHasChildren(this.grid.dataView.getIdxByItem(item));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
for (
|
|
81
|
-
|
|
66
|
+
}
|
|
67
|
+
getDirectChildren(item) {
|
|
68
|
+
const id = item[this.primaryKey];
|
|
69
|
+
const result = [];
|
|
70
|
+
const data = this.grid.getData();
|
|
71
|
+
for (let i = 0; i < data.length; i++) {
|
|
72
|
+
const pid = data[i][this.options.parentColumn];
|
|
82
73
|
if (pid === id) {
|
|
83
74
|
result.push(data[i]);
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
return result;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for (
|
|
78
|
+
}
|
|
79
|
+
getAllChildren(item) {
|
|
80
|
+
const parentid = item[this.primaryKey];
|
|
81
|
+
const result = [];
|
|
82
|
+
const data = this.grid.getData();
|
|
83
|
+
for (let i = 0; i < data.length; i++) {
|
|
93
84
|
if (data[i][this.options.parentColumn] === parentid) {
|
|
94
85
|
result.push(data[i]);
|
|
95
|
-
result.push
|
|
86
|
+
result.push(...this.getAllChildren(data[i]));
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
89
|
return result;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
90
|
+
}
|
|
91
|
+
rowHasChildren(row) {
|
|
92
|
+
const data = this.grid.getData();
|
|
102
93
|
if (data.length > row + 1) {
|
|
103
94
|
return data[row + 1][this.options.parentColumn] === data[row][this.primaryKey];
|
|
104
95
|
}
|
|
105
96
|
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
97
|
+
}
|
|
98
|
+
toggleExpand(item) {
|
|
108
99
|
if (item[this.options.collapsedStateField]) {
|
|
109
100
|
this.expand(item);
|
|
110
101
|
}
|
|
111
102
|
else {
|
|
112
103
|
this.collapse(item);
|
|
113
104
|
}
|
|
114
|
-
}
|
|
115
|
-
|
|
105
|
+
}
|
|
106
|
+
expand(item) {
|
|
116
107
|
item[this.options.collapsedStateField] = false;
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
const data = this.grid.getData();
|
|
109
|
+
let i = this.grid.dataView.getIdxByItem(item);
|
|
119
110
|
while (i < data.length) {
|
|
120
111
|
data[i][this.options.hiddenStateField] = false;
|
|
121
112
|
if (this.rowHasChildren(i)) {
|
|
@@ -127,22 +118,22 @@ var GridTree = /** @class */ (function () {
|
|
|
127
118
|
i++;
|
|
128
119
|
}
|
|
129
120
|
this.grid.refreshData();
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
}
|
|
122
|
+
indent(rows) {
|
|
123
|
+
const realRows = this.filterChildren(rows);
|
|
124
|
+
const data = this.grid.getData();
|
|
134
125
|
//get indexes of rows
|
|
135
|
-
|
|
136
|
-
for (
|
|
126
|
+
const indexes = [];
|
|
127
|
+
for (let i = 0; i < realRows.length; i++) {
|
|
137
128
|
indexes.push(this.grid.dataView.getIdxByItem(realRows[i]));
|
|
138
129
|
}
|
|
139
130
|
//sort indexes
|
|
140
|
-
indexes.sort(
|
|
131
|
+
indexes.sort((a, b) => a > b ? 1 : (a < b ? -1 : 0));
|
|
141
132
|
//change parents to indent rows
|
|
142
|
-
for (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
for (
|
|
133
|
+
for (let i = 0; i < indexes.length; i++) {
|
|
134
|
+
const rowIdx = indexes[i];
|
|
135
|
+
const parentID = data[rowIdx][this.options.parentColumn];
|
|
136
|
+
for (let tmp = rowIdx - 1; tmp >= 0; tmp--) {
|
|
146
137
|
if (data[tmp][this.options.parentColumn] === parentID) {
|
|
147
138
|
data[rowIdx][this.options.parentColumn] = data[tmp][this.primaryKey];
|
|
148
139
|
break;
|
|
@@ -150,18 +141,18 @@ var GridTree = /** @class */ (function () {
|
|
|
150
141
|
}
|
|
151
142
|
}
|
|
152
143
|
this.grid.refreshData();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
for (
|
|
158
|
-
|
|
159
|
-
|
|
144
|
+
}
|
|
145
|
+
outdent(rows) {
|
|
146
|
+
const rows2 = this.filterChildren(rows);
|
|
147
|
+
const data = this.grid.getData();
|
|
148
|
+
for (let i = 0; i < rows2.length; i++) {
|
|
149
|
+
const row = rows2[i];
|
|
150
|
+
const oldparent = row[this.options.parentColumn];
|
|
160
151
|
if (oldparent) {
|
|
161
|
-
|
|
152
|
+
const newparent = data[this.grid.dataView.getIdxById(oldparent)][this.options.parentColumn];
|
|
162
153
|
row[this.options.parentColumn] = newparent;
|
|
163
154
|
//make all subsequent items with same ParentID have current row as new parentid
|
|
164
|
-
|
|
155
|
+
let idx = this.grid.dataView.getIdxById(row[this.primaryKey]);
|
|
165
156
|
while (++idx < data.length) {
|
|
166
157
|
if (data[idx][this.options.parentColumn] === oldparent) {
|
|
167
158
|
data[idx][this.options.parentColumn] = row[this.primaryKey];
|
|
@@ -171,50 +162,47 @@ var GridTree = /** @class */ (function () {
|
|
|
171
162
|
}
|
|
172
163
|
}
|
|
173
164
|
this.grid.refreshData();
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
for (
|
|
165
|
+
}
|
|
166
|
+
filterChildren(rows) {
|
|
167
|
+
const result = [];
|
|
168
|
+
const dict = {};
|
|
169
|
+
for (let i = 0; i < rows.length; i++) {
|
|
179
170
|
dict[rows[i][this.primaryKey]] = true;
|
|
180
171
|
}
|
|
181
|
-
for (
|
|
182
|
-
|
|
183
|
-
|
|
172
|
+
for (let i = 0; i < rows.length; i++) {
|
|
173
|
+
const row = rows[i];
|
|
174
|
+
const parentid = row[this.options.parentColumn];
|
|
184
175
|
if (!parentid || !dict[parentid]) {
|
|
185
176
|
result.push(row);
|
|
186
177
|
}
|
|
187
178
|
}
|
|
188
179
|
return result;
|
|
189
|
-
}
|
|
190
|
-
|
|
180
|
+
}
|
|
181
|
+
collapse(item) {
|
|
191
182
|
item[this.options.collapsedStateField] = true;
|
|
192
|
-
|
|
193
|
-
for (
|
|
183
|
+
const children = this.getAllChildren(item);
|
|
184
|
+
for (let i = 0; i < children.length; i++) {
|
|
194
185
|
children[i][this.options.hiddenStateField] = true;
|
|
195
186
|
}
|
|
196
187
|
this.grid.refreshData();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
var _this = this;
|
|
188
|
+
}
|
|
189
|
+
initEvents() {
|
|
200
190
|
// collapse / expand click events
|
|
201
191
|
if (this.options.enableCollapsing) {
|
|
202
|
-
this.grid.onClick.subscribe(
|
|
192
|
+
this.grid.onClick.subscribe((e, args) => {
|
|
203
193
|
if (e.target.classList.contains("jsl-toggle")) {
|
|
204
194
|
e.stopImmediatePropagation();
|
|
205
|
-
|
|
195
|
+
this.toggleExpand(this.grid.dataView.getItem(args.row));
|
|
206
196
|
}
|
|
207
197
|
});
|
|
208
198
|
}
|
|
209
199
|
// filters
|
|
210
|
-
|
|
200
|
+
const hiddenFilter = {
|
|
211
201
|
field: this.options.hiddenStateField,
|
|
212
|
-
match:
|
|
213
|
-
return !itm[
|
|
202
|
+
match: (itm, field) => {
|
|
203
|
+
return !itm[this.options.hiddenStateField];
|
|
214
204
|
}
|
|
215
205
|
};
|
|
216
206
|
this.grid.addFilter(hiddenFilter);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
}());
|
|
220
|
-
export { GridTree };
|
|
207
|
+
}
|
|
208
|
+
}
|