dattatable 2.11.97 → 2.11.99
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/build/dashboard/index.d.ts +1 -2
- package/build/dashboard/index.js +5 -21
- package/build/dashboard/tiles.d.ts +14 -16
- package/build/dashboard/tiles.js +155 -166
- package/build/styles.js +1 -1
- package/dist/dattatable.js +3 -3
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Accordion.html +2 -2
- package/docs/classes/AuditLog.html +2 -2
- package/docs/classes/CanvasForm.html +2 -2
- package/docs/classes/Comments.html +2 -2
- package/docs/classes/Dashboard.html +4 -5
- package/docs/classes/DataTable.html +3 -3
- package/docs/classes/Documents.html +6 -6
- package/docs/classes/FilterSlideout.html +2 -2
- package/docs/classes/Footer.html +2 -2
- package/docs/classes/Header.html +2 -2
- package/docs/classes/InstallationRequired.html +2 -2
- package/docs/classes/ItemForm.html +5 -5
- package/docs/classes/List.html +4 -4
- package/docs/classes/ListConfig.html +2 -2
- package/docs/classes/ListSecurity.html +2 -2
- package/docs/classes/LoadingDialog.html +2 -2
- package/docs/classes/Modal.html +2 -2
- package/docs/classes/Navigation.html +3 -3
- package/docs/classes/Tiles.html +7 -9
- package/docs/classes/Timeout.html +2 -2
- package/docs/enums/ActionButtonTypes.html +2 -2
- package/docs/functions/formatBytes.html +1 -1
- package/docs/functions/formatDateValue.html +1 -1
- package/docs/functions/formatTimeValue.html +1 -1
- package/docs/functions/getContextInfo.html +1 -1
- package/docs/functions/getFileExt.html +1 -1
- package/docs/functions/waitForTheme.html +1 -1
- package/docs/interfaces/IAccordion.html +2 -2
- package/docs/interfaces/IAccordionProps.html +2 -2
- package/docs/interfaces/IAuditLogItem.html +2 -2
- package/docs/interfaces/IAuditLogItemCreation.html +2 -2
- package/docs/interfaces/IAuditLogProps.html +2 -2
- package/docs/interfaces/IAuditLogViewProps.html +2 -2
- package/docs/interfaces/ICommentsItem.html +2 -2
- package/docs/interfaces/ICreateLookupData.html +2 -2
- package/docs/interfaces/IDashboardProps.html +2 -2
- package/docs/interfaces/IDataTable.html +2 -2
- package/docs/interfaces/IDataTableProps.html +2 -2
- package/docs/interfaces/IDocumentsProps.html +2 -2
- package/docs/interfaces/IFilterItem.html +2 -2
- package/docs/interfaces/IFilterProps.html +2 -2
- package/docs/interfaces/IFooterProps.html +2 -2
- package/docs/interfaces/IGenerateLookupDataProps.html +2 -2
- package/docs/interfaces/IHeaderProps.html +2 -2
- package/docs/interfaces/IInstallProps.html +2 -2
- package/docs/interfaces/IItemFormCreateProps.html +2 -2
- package/docs/interfaces/IItemFormEditProps.html +2 -2
- package/docs/interfaces/IItemFormSaveProps.html +2 -2
- package/docs/interfaces/IItemFormTab.html +2 -2
- package/docs/interfaces/IItemFormTabInfo.html +2 -2
- package/docs/interfaces/IItemFormViewProps.html +2 -2
- package/docs/interfaces/IListConfig.html +2 -2
- package/docs/interfaces/IListConfigProps.html +2 -2
- package/docs/interfaces/IListProps.html +2 -2
- package/docs/interfaces/IListSecurity.html +2 -2
- package/docs/interfaces/IListSecurityItem.html +2 -2
- package/docs/interfaces/ILookupData.html +2 -2
- package/docs/interfaces/IShowDialogProps.html +2 -2
- package/docs/interfaces/ITiles.html +5 -2
- package/docs/interfaces/ITilesProps.html +3 -7
- package/docs/interfaces/IValidateLookupsProps.html +2 -2
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
|
@@ -96,7 +96,7 @@ export interface IDashboardProps {
|
|
|
96
96
|
classNameCard?: string;
|
|
97
97
|
classNameFooter?: string;
|
|
98
98
|
classNameHeader?: string;
|
|
99
|
-
colSize?: number
|
|
99
|
+
colSize?: number;
|
|
100
100
|
filterFields?: string[];
|
|
101
101
|
items: any[];
|
|
102
102
|
onBodyRendered?: (el?: HTMLElement, item?: any) => void;
|
|
@@ -152,7 +152,6 @@ export declare class Dashboard {
|
|
|
152
152
|
filter(idx: number, value?: string, exactMatchFl?: boolean): void;
|
|
153
153
|
filterAccordion(values?: string | string[], useAndOperator?: boolean): void;
|
|
154
154
|
filterMulti(idx: number, values?: string[], exactMatchFl?: boolean): void;
|
|
155
|
-
filterTiles(values?: string | string[], useAndOperator?: boolean): void;
|
|
156
155
|
getFilter(key: string): Components.ICheckboxGroup;
|
|
157
156
|
getSearchValue(): string;
|
|
158
157
|
hideFilter(): void;
|
package/build/dashboard/index.js
CHANGED
|
@@ -118,17 +118,10 @@ var Dashboard = /** @class */ (function () {
|
|
|
118
118
|
onClear: this._props.filters ? this._props.filters.onClear : null,
|
|
119
119
|
onRendered: this._props.filters ? this._props.filters.onRendered : null,
|
|
120
120
|
onShowFilter: this._props.filters ? this._props.filters.onShowFilter : null,
|
|
121
|
-
onFilter: this.IsAccordion
|
|
121
|
+
onFilter: this.IsAccordion ? function (value, item) {
|
|
122
122
|
var values = typeof (value) === "string" ? [value] : value;
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
// Filter the accordion
|
|
126
|
-
_this._accordion.filter(values);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
// Filter the tiles
|
|
130
|
-
_this._tiles.filter(values);
|
|
131
|
-
}
|
|
123
|
+
// Filter the accordion
|
|
124
|
+
_this._accordion.filter(values);
|
|
132
125
|
} : null
|
|
133
126
|
});
|
|
134
127
|
// Render the template
|
|
@@ -341,7 +334,7 @@ var Dashboard = /** @class */ (function () {
|
|
|
341
334
|
// Else, see if we are rendering tiles
|
|
342
335
|
else if (this.IsTiles) {
|
|
343
336
|
// Filter the tiles
|
|
344
|
-
this._tiles.filter(value);
|
|
337
|
+
exactMatchFl && value ? this._tiles.filterExact(idx, value) : this._tiles.filter(idx, value);
|
|
345
338
|
}
|
|
346
339
|
else {
|
|
347
340
|
// If no value is specified, then we don't want to filter by exact value
|
|
@@ -367,22 +360,13 @@ var Dashboard = /** @class */ (function () {
|
|
|
367
360
|
// Else, see if we have tiles
|
|
368
361
|
else if (this.IsTiles) {
|
|
369
362
|
// Filter the tiles
|
|
370
|
-
this._tiles.
|
|
363
|
+
exactMatchFl && values.length > 0 ? this._tiles.filterMultiExact(idx + 1, values) : this._tiles.filterMulti(idx + 1, values);
|
|
371
364
|
}
|
|
372
365
|
else {
|
|
373
366
|
// Filter the table
|
|
374
367
|
exactMatchFl && values.length > 0 ? this._dt.filterMultiExact(idx, values) : this._dt.filterMulti(idx, values);
|
|
375
368
|
}
|
|
376
369
|
};
|
|
377
|
-
// Filter the tiles
|
|
378
|
-
Dashboard.prototype.filterTiles = function (values, useAndOperator) {
|
|
379
|
-
if (useAndOperator === void 0) { useAndOperator = false; }
|
|
380
|
-
// See if we have tiles
|
|
381
|
-
if (this.IsTiles) {
|
|
382
|
-
// Filter the tiles
|
|
383
|
-
this._tiles.filter(typeof (values) === "string" ? [values] : values, useAndOperator);
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
370
|
// Returns a filter checkbox group by its key
|
|
387
371
|
Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };
|
|
388
372
|
// Returns the current search value
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Components } from "gd-sprest-bs";
|
|
2
|
+
import "datatables.net-bs5";
|
|
2
3
|
export interface ITiles {
|
|
3
|
-
filter
|
|
4
|
+
filter: (idx: number, value?: string) => void;
|
|
5
|
+
filterExact: (idx: number, value?: string) => void;
|
|
6
|
+
filterMulti: (idx: number, values?: string[]) => void;
|
|
7
|
+
filterMultiExact: (idx: number, values?: string[]) => void;
|
|
4
8
|
refresh?: (items: any[]) => void;
|
|
5
9
|
search?: (value: string) => void;
|
|
6
10
|
}
|
|
@@ -12,7 +16,7 @@ export interface ITilesProps {
|
|
|
12
16
|
classNameCard?: string;
|
|
13
17
|
classNameFooter?: string;
|
|
14
18
|
classNameHeader?: string;
|
|
15
|
-
colSize?: number
|
|
19
|
+
colSize?: number;
|
|
16
20
|
el: HTMLElement;
|
|
17
21
|
filterFields?: string[];
|
|
18
22
|
items: any[];
|
|
@@ -21,18 +25,14 @@ export interface ITilesProps {
|
|
|
21
25
|
onCardRendered?: (el?: HTMLElement, item?: any) => void;
|
|
22
26
|
onCardRendering?: (cardProps?: Components.ICardProps, item?: any) => void;
|
|
23
27
|
onClick?: (el?: HTMLElement, item?: Components.ICardBody) => void;
|
|
24
|
-
onColumnRendered?: (el?: HTMLElement, item?: any) => void;
|
|
25
28
|
onFooterRendered?: (el?: HTMLElement, item?: any) => void;
|
|
26
29
|
onHeaderRendered?: (el?: HTMLElement, item?: any) => void;
|
|
27
|
-
|
|
28
|
-
onPaginationRendered?: (el?: HTMLElement) => void;
|
|
30
|
+
onRendering?: (dtProps: any) => any;
|
|
29
31
|
onRendered?: (el?: HTMLElement) => void;
|
|
30
32
|
onSubTitleRendered?: (el?: HTMLElement, item?: any) => void;
|
|
31
33
|
onTitleRendered?: (el?: HTMLElement, item?: any) => void;
|
|
32
|
-
paginationLimit?: number;
|
|
33
34
|
showFooter?: boolean;
|
|
34
35
|
showHeader?: boolean;
|
|
35
|
-
showPagination?: boolean;
|
|
36
36
|
subTitleFields?: string[];
|
|
37
37
|
subTitleTemplate?: string;
|
|
38
38
|
titleFields?: string[];
|
|
@@ -42,18 +42,16 @@ export interface ITilesProps {
|
|
|
42
42
|
* Tiles
|
|
43
43
|
*/
|
|
44
44
|
export declare class Tiles implements ITiles {
|
|
45
|
-
private
|
|
46
|
-
private _activeFilterValue;
|
|
47
|
-
private _activeSearchValue;
|
|
48
|
-
private _pagination;
|
|
45
|
+
private _datatable;
|
|
49
46
|
private _props;
|
|
50
|
-
private _useAndOperator;
|
|
51
47
|
constructor(props: ITilesProps);
|
|
52
|
-
filter(
|
|
48
|
+
filter(idx: number, value?: string): void;
|
|
49
|
+
filterExact(idx: number, value?: string): void;
|
|
50
|
+
filterMulti(idx: number, values?: string[]): void;
|
|
51
|
+
filterMultiExact(idx: number, values?: string[]): void;
|
|
53
52
|
private generateCard;
|
|
53
|
+
private getDefaultProperties;
|
|
54
54
|
refresh(items?: any[]): void;
|
|
55
55
|
private render;
|
|
56
|
-
|
|
57
|
-
private updateTiles;
|
|
58
|
-
search(value: string): void;
|
|
56
|
+
search(value?: string): void;
|
|
59
57
|
}
|
package/build/dashboard/tiles.js
CHANGED
|
@@ -1,41 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Tiles = void 0;
|
|
4
|
+
var dtnet = require("datatables.net-dt");
|
|
4
5
|
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
6
|
+
// DataTables.net
|
|
7
|
+
require("datatables.net-bs5");
|
|
5
8
|
/**
|
|
6
9
|
* Tiles
|
|
7
10
|
*/
|
|
8
11
|
var Tiles = /** @class */ (function () {
|
|
9
12
|
// Constructor
|
|
10
13
|
function Tiles(props) {
|
|
11
|
-
|
|
12
|
-
this._tiles = null;
|
|
13
|
-
this._activeFilterValue = null;
|
|
14
|
-
this._activeSearchValue = null;
|
|
15
|
-
this._pagination = null;
|
|
16
|
-
this._useAndOperator = false;
|
|
14
|
+
this._datatable = null;
|
|
17
15
|
// Save the properties
|
|
18
16
|
this._props = props;
|
|
19
17
|
// Render the tile
|
|
20
18
|
this.render(this._props.items);
|
|
21
|
-
// Call the rendered event in a separate thread to ensure the dashboard object is created
|
|
22
|
-
setTimeout(function () {
|
|
23
|
-
_this._props.onRendered ? _this._props.onRendered(_this._props.el) : null;
|
|
24
|
-
}, 50);
|
|
25
19
|
}
|
|
26
|
-
// Filters the
|
|
27
|
-
Tiles.prototype.filter = function (
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
// Filters the status
|
|
21
|
+
Tiles.prototype.filter = function (idx, value) {
|
|
22
|
+
if (value === void 0) { value = ""; }
|
|
23
|
+
// Set the filter
|
|
24
|
+
this._datatable.column(idx).search(value.replace(/[-[/\]{}()*+?.,\\^$#\s]/g, '\\$&'), true, false).draw();
|
|
25
|
+
};
|
|
26
|
+
// Filters the status
|
|
27
|
+
Tiles.prototype.filterExact = function (idx, value) {
|
|
28
|
+
if (value === void 0) { value = ""; }
|
|
29
|
+
// Set the filter
|
|
30
|
+
this._datatable.column(idx).search("^" + value.replace(/[-[/\]{}()*+?.,\\^$#\s]/g, '\\$&') + "$", true, false).draw();
|
|
31
|
+
};
|
|
32
|
+
// Filters multiple values against the status
|
|
33
|
+
Tiles.prototype.filterMulti = function (idx, values) {
|
|
34
|
+
if (values === void 0) { values = []; }
|
|
35
|
+
// Parse the values
|
|
36
|
+
for (var i = 0; i < values.length; i++) {
|
|
37
|
+
// Update the value
|
|
38
|
+
values[i] = values[i].replace(/\|/g, '\\$&');
|
|
39
|
+
}
|
|
40
|
+
// Filter the values
|
|
41
|
+
this.filter(idx, values.join('|'));
|
|
42
|
+
};
|
|
43
|
+
// Filters multiple values against the status
|
|
44
|
+
Tiles.prototype.filterMultiExact = function (idx, values) {
|
|
45
|
+
if (values === void 0) { values = []; }
|
|
46
|
+
// Parse the values
|
|
47
|
+
for (var i = 0; i < values.length; i++) {
|
|
48
|
+
// Update the value
|
|
49
|
+
values[i] = values[i].replace(/\|/g, '\\$&');
|
|
36
50
|
}
|
|
37
|
-
//
|
|
38
|
-
this.
|
|
51
|
+
// Filter the values
|
|
52
|
+
this._datatable.column(idx).search("^(" + values.join('|') + ")$", true, false).draw();
|
|
39
53
|
};
|
|
40
54
|
// Generate the card properties
|
|
41
55
|
Tiles.prototype.generateCard = function (item) {
|
|
@@ -173,9 +187,105 @@ var Tiles = /** @class */ (function () {
|
|
|
173
187
|
// Return the card properties
|
|
174
188
|
return cardProps;
|
|
175
189
|
};
|
|
190
|
+
// Returns the default properties for the datatable
|
|
191
|
+
Tiles.prototype.getDefaultProperties = function (items) {
|
|
192
|
+
var _this = this;
|
|
193
|
+
// Get the column size
|
|
194
|
+
var colSize = this._props.colSize > 0 ? this._props.colSize : 4;
|
|
195
|
+
if (colSize > 4) {
|
|
196
|
+
colSize = 4;
|
|
197
|
+
}
|
|
198
|
+
// Determine the paging based on the column size
|
|
199
|
+
var lengthMenu = [];
|
|
200
|
+
switch (colSize) {
|
|
201
|
+
case 1:
|
|
202
|
+
lengthMenu = [4, 8, 16, 32];
|
|
203
|
+
break;
|
|
204
|
+
case 2:
|
|
205
|
+
lengthMenu = [8, 16, 32, 64];
|
|
206
|
+
break;
|
|
207
|
+
case 3:
|
|
208
|
+
lengthMenu = [12, 24, 48, 96];
|
|
209
|
+
break;
|
|
210
|
+
case 4:
|
|
211
|
+
lengthMenu = [16, 32, 64, 128];
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
// Set the columns
|
|
215
|
+
var columns = [{
|
|
216
|
+
data: null,
|
|
217
|
+
render: function (data, type, row) {
|
|
218
|
+
var cardProps = _this.generateCard(data);
|
|
219
|
+
// Return the card element
|
|
220
|
+
return gd_sprest_bs_1.Components.Card(cardProps).el;
|
|
221
|
+
}
|
|
222
|
+
}];
|
|
223
|
+
// Parse the filter columns
|
|
224
|
+
var filterFields = this._props.filterFields || [];
|
|
225
|
+
for (var i = 0; i < filterFields.length; i++) {
|
|
226
|
+
// Append the hidden column
|
|
227
|
+
columns.push({
|
|
228
|
+
data: filterFields[i],
|
|
229
|
+
visible: false
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
// Return the default properties
|
|
233
|
+
return {
|
|
234
|
+
columns: columns,
|
|
235
|
+
data: items,
|
|
236
|
+
lengthMenu: lengthMenu,
|
|
237
|
+
pageLength: lengthMenu[0],
|
|
238
|
+
language: {
|
|
239
|
+
lengthMenu: "_MENU_",
|
|
240
|
+
paginate: {
|
|
241
|
+
first: "First",
|
|
242
|
+
last: "Last",
|
|
243
|
+
next: "Next",
|
|
244
|
+
previous: "Previous"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
layout: {
|
|
248
|
+
top: null,
|
|
249
|
+
topStart: null,
|
|
250
|
+
topEnd: null,
|
|
251
|
+
bottom: "info",
|
|
252
|
+
bottomStart: "pageLength",
|
|
253
|
+
bottomEnd: {
|
|
254
|
+
paging: {
|
|
255
|
+
type: "full_numbers"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
createdRow: function (row, data, rowIdx) {
|
|
260
|
+
// Append the class
|
|
261
|
+
row.classList.add("col");
|
|
262
|
+
switch (colSize) {
|
|
263
|
+
case 1:
|
|
264
|
+
row.classList.add("col-12");
|
|
265
|
+
break;
|
|
266
|
+
case 2:
|
|
267
|
+
row.classList.add("col-6");
|
|
268
|
+
break;
|
|
269
|
+
case 3:
|
|
270
|
+
row.classList.add("col-4");
|
|
271
|
+
break;
|
|
272
|
+
case 4:
|
|
273
|
+
row.classList.add("col-3");
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
};
|
|
176
279
|
// Method to reload the data
|
|
177
280
|
Tiles.prototype.refresh = function (items) {
|
|
178
281
|
if (items === void 0) { items = []; }
|
|
282
|
+
// See if the datatable exists
|
|
283
|
+
if (this._datatable != null) {
|
|
284
|
+
// Clear the datatable
|
|
285
|
+
this._datatable.clear();
|
|
286
|
+
this._datatable.destroy();
|
|
287
|
+
this._datatable = null;
|
|
288
|
+
}
|
|
179
289
|
// Clear the datatable element
|
|
180
290
|
while (this._props.el.firstChild) {
|
|
181
291
|
this._props.el.removeChild(this._props.el.firstChild);
|
|
@@ -185,154 +295,33 @@ var Tiles = /** @class */ (function () {
|
|
|
185
295
|
};
|
|
186
296
|
// Renders the dashboard
|
|
187
297
|
Tiles.prototype.render = function (items) {
|
|
188
|
-
// Render the tile
|
|
189
|
-
this.renderTiles(items);
|
|
190
|
-
// Update the tiles
|
|
191
|
-
this.updateTiles();
|
|
192
|
-
};
|
|
193
|
-
// Renders the tiles
|
|
194
|
-
Tiles.prototype.renderTiles = function (items) {
|
|
195
|
-
// Parse the items
|
|
196
|
-
var cards = [];
|
|
197
|
-
for (var i = 0; i < items.length; i++) {
|
|
198
|
-
var item = items[i];
|
|
199
|
-
// Add an tile
|
|
200
|
-
cards.push(this.generateCard(item));
|
|
201
|
-
}
|
|
202
|
-
// Render the tiles
|
|
203
|
-
this._tiles = gd_sprest_bs_1.Components.CardGroup({
|
|
204
|
-
el: this._props.el,
|
|
205
|
-
cards: cards,
|
|
206
|
-
className: this._props.className,
|
|
207
|
-
colSize: this._props.colSize || 4,
|
|
208
|
-
onColRender: this._props.onColumnRendered
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
// Updates the visibility of the tiles
|
|
212
|
-
Tiles.prototype.updateTiles = function () {
|
|
213
298
|
var _this = this;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
//
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (this._activeFilterValue) {
|
|
235
|
-
var filterValues = (typeof (elItem.dataset.filter) != "undefined" ? elItem.dataset.filter : "").split('|');
|
|
236
|
-
// Parse the active filters
|
|
237
|
-
var activeFilters = this._activeFilterValue.split('|');
|
|
238
|
-
var showItem = false;
|
|
239
|
-
for (var j = 0; j < activeFilters.length; j++) {
|
|
240
|
-
// See if the item contains the filter value
|
|
241
|
-
if (filterValues.indexOf(activeFilters[j]) >= 0) {
|
|
242
|
-
// Set the flag
|
|
243
|
-
showItem = true;
|
|
244
|
-
// Break from the loop if we aren't using the and operator
|
|
245
|
-
if (!this._useAndOperator) {
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
// Else, see if we are using the and operator
|
|
250
|
-
else if (this._useAndOperator) {
|
|
251
|
-
// Set the flag and break from the loop
|
|
252
|
-
showItem = false;
|
|
253
|
-
break;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
// See if we are hiding the item
|
|
257
|
-
if (!showItem) {
|
|
258
|
-
// Hide the item
|
|
259
|
-
elItem.parentElement.classList.add("d-none");
|
|
260
|
-
// Exclude the item from the array
|
|
261
|
-
elItems.splice(i, 1);
|
|
262
|
-
// Continue the loop
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
// See if a search value exists
|
|
267
|
-
if (this._activeSearchValue) {
|
|
268
|
-
// See if the item doesn't contains the search value
|
|
269
|
-
if (elItem.innerText.toLowerCase().indexOf(this._activeSearchValue.toLowerCase()) < 0) {
|
|
270
|
-
// Hide the item
|
|
271
|
-
elItem.parentElement.classList.add("d-none");
|
|
272
|
-
// Exclude the item from the array
|
|
273
|
-
elItems.splice(i, 1);
|
|
274
|
-
// Continue the loop
|
|
275
|
-
continue;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
// Set the pagination limit
|
|
280
|
-
var showPagination = typeof (this._props.showPagination) === "boolean" ? this._props.showPagination : true;
|
|
281
|
-
var paginationLimit = showPagination ? this._props.paginationLimit || 10 : elItems.length;
|
|
282
|
-
// Parse the active items to show
|
|
283
|
-
for (var i = 0; i < paginationLimit; i++) {
|
|
284
|
-
var elItem = elItems[i];
|
|
285
|
-
// Ensure the item exists
|
|
286
|
-
if (elItem) {
|
|
287
|
-
// Show the item
|
|
288
|
-
elItem.parentElement.classList.remove("d-none");
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
// Break from the loop
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// Ensure we are showing the pagination
|
|
296
|
-
if (showPagination) {
|
|
297
|
-
// Parse the active items to hide
|
|
298
|
-
for (var i = paginationLimit; i < elItems.length; i++) {
|
|
299
|
-
var elItem = elItems[i];
|
|
300
|
-
// Hide the item
|
|
301
|
-
elItem.parentElement.classList.add("d-none");
|
|
302
|
-
}
|
|
303
|
-
// Render the pagination
|
|
304
|
-
this._pagination = gd_sprest_bs_1.Components.Pagination({
|
|
305
|
-
el: elPagination,
|
|
306
|
-
className: "d-flex justify-content-end pt-2",
|
|
307
|
-
numberOfPages: Math.ceil(elItems.length / paginationLimit),
|
|
308
|
-
onClick: function (pageNumber) {
|
|
309
|
-
// Parse the items
|
|
310
|
-
for (var i = 0; i < elItems.length; i++) {
|
|
311
|
-
var elItem = elItems[i];
|
|
312
|
-
// Hide the item
|
|
313
|
-
elItem.parentElement.classList.add("d-none");
|
|
314
|
-
}
|
|
315
|
-
// Parse the items to show
|
|
316
|
-
var startIdx = (pageNumber - 1) * paginationLimit;
|
|
317
|
-
for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {
|
|
318
|
-
var elItem = elItems[i];
|
|
319
|
-
// Show the item
|
|
320
|
-
elItem.parentElement.classList.remove("d-none");
|
|
321
|
-
}
|
|
322
|
-
// Call the event
|
|
323
|
-
_this._props.onPaginationClick ? _this._props.onPaginationClick(pageNumber) : null;
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
// Call the event
|
|
327
|
-
this._props.onPaginationRendered ? this._props.onPaginationRendered(elPagination) : null;
|
|
328
|
-
}
|
|
299
|
+
var _a;
|
|
300
|
+
// Create the datatable element
|
|
301
|
+
var el = document.createElement("div");
|
|
302
|
+
el.classList.add("bs");
|
|
303
|
+
(_a = this._props) === null || _a === void 0 ? void 0 : _a.el.appendChild(el);
|
|
304
|
+
// Set the table element
|
|
305
|
+
var elTable = document.createElement("table");
|
|
306
|
+
elTable.innerHTML = "<thead><th></th></thead><tbody class=\"row\"></tbody>";
|
|
307
|
+
el.appendChild(elTable);
|
|
308
|
+
// Get the default properties
|
|
309
|
+
var dtProps = this.getDefaultProperties(items);
|
|
310
|
+
// Call the rendering event
|
|
311
|
+
dtProps = this._props.onRendering ? this._props.onRendering(dtProps) : dtProps;
|
|
312
|
+
// Render the table
|
|
313
|
+
var dtLib = dtnet["DataTable"] || dtnet;
|
|
314
|
+
this._datatable = new dtLib(elTable, dtProps);
|
|
315
|
+
// Call the rendered event in a separate thread to ensure the dashboard object is created
|
|
316
|
+
setTimeout(function () {
|
|
317
|
+
_this._props.onRendered ? _this._props.onRendered(_this._props.el) : null;
|
|
318
|
+
}, 50);
|
|
329
319
|
};
|
|
330
320
|
// Searches the tile
|
|
331
321
|
Tiles.prototype.search = function (value) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
this.updateTiles();
|
|
322
|
+
if (value === void 0) { value = ""; }
|
|
323
|
+
// Search the table
|
|
324
|
+
this._datatable.search(value).draw();
|
|
336
325
|
};
|
|
337
326
|
return Tiles;
|
|
338
327
|
}());
|