dattatable 2.9.44 → 2.9.46
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/accordion.js +4 -11
- package/build/dashboard/index.d.ts +14 -0
- package/build/dashboard/index.js +57 -4
- package/build/dashboard/tiles.d.ts +30 -0
- package/build/dashboard/tiles.js +167 -0
- package/build/lib.d.ts +1 -0
- package/dist/dattatable.js +13 -2
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/navigation.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 +8 -4
- 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 +4 -4
- package/docs/classes/List.html +4 -4
- 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 +13 -0
- 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/index.html +1 -1
- package/docs/interfaces/IAccordion.html +2 -2
- package/docs/interfaces/IAccordionProps.html +2 -2
- package/docs/interfaces/IAuditLogItem.html +3 -3
- 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/IDashboardProps.html +3 -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/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/IItemFormTab.html +2 -2
- package/docs/interfaces/IItemFormTabInfo.html +2 -2
- package/docs/interfaces/IItemFormViewProps.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/IShowDialogProps.html +2 -2
- package/docs/interfaces/ITiles.html +3 -0
- package/docs/interfaces/ITilesProps.html +9 -0
- package/docs/modules.html +4 -1
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
|
@@ -33,19 +33,10 @@ var Accordion = /** @class */ (function () {
|
|
|
33
33
|
var items = this._props.el.querySelectorAll(".accordion-item");
|
|
34
34
|
for (var i = 0; i < items.length; i++) {
|
|
35
35
|
var elItem = items[i];
|
|
36
|
+
// Clear the item
|
|
37
|
+
this.clearItem(elItem);
|
|
36
38
|
// Show the item
|
|
37
39
|
elItem.classList.remove("d-none");
|
|
38
|
-
// Remove the first/last item classes
|
|
39
|
-
elItem.classList.remove("first-item");
|
|
40
|
-
elItem.classList.remove("last-item");
|
|
41
|
-
// See if a class name exists
|
|
42
|
-
if (className) {
|
|
43
|
-
// See if this item doesn't matches
|
|
44
|
-
if (!elItem.classList.contains(className)) {
|
|
45
|
-
// Hide the item
|
|
46
|
-
elItem.classList.add("d-none");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
40
|
}
|
|
50
41
|
// Render the items
|
|
51
42
|
this.renderItems();
|
|
@@ -141,6 +132,8 @@ var Accordion = /** @class */ (function () {
|
|
|
141
132
|
var elItem = elItems[i];
|
|
142
133
|
// Ensure the item exists
|
|
143
134
|
if (elItem) {
|
|
135
|
+
// Clear the item
|
|
136
|
+
this.clearItem(elItem);
|
|
144
137
|
// Show the item
|
|
145
138
|
elItem.classList.remove("d-none");
|
|
146
139
|
// See if this is the first item
|
|
@@ -8,6 +8,7 @@ export * from "./footer";
|
|
|
8
8
|
export * from "./header";
|
|
9
9
|
export * from "./navigation";
|
|
10
10
|
export * from "./table";
|
|
11
|
+
export * from "./tiles";
|
|
11
12
|
export interface IDashboardProps {
|
|
12
13
|
accordion?: {
|
|
13
14
|
bodyField?: string;
|
|
@@ -70,6 +71,15 @@ export interface IDashboardProps {
|
|
|
70
71
|
onRendered?: (el?: HTMLElement, dt?: any) => void;
|
|
71
72
|
rows?: any[];
|
|
72
73
|
};
|
|
74
|
+
tiles?: {
|
|
75
|
+
bodyField?: string;
|
|
76
|
+
filterField?: string;
|
|
77
|
+
items: any[];
|
|
78
|
+
onCardRender?: (el?: HTMLElement, item?: any) => void;
|
|
79
|
+
paginationLimit?: number;
|
|
80
|
+
subTitleField?: string;
|
|
81
|
+
titleField?: string;
|
|
82
|
+
};
|
|
73
83
|
onRendered?: (el?: HTMLElement) => void;
|
|
74
84
|
useModal?: boolean;
|
|
75
85
|
}
|
|
@@ -82,7 +92,9 @@ export declare class Dashboard {
|
|
|
82
92
|
private _filters;
|
|
83
93
|
private _navigation;
|
|
84
94
|
private _props;
|
|
95
|
+
private _tiles;
|
|
85
96
|
private IsAccordion;
|
|
97
|
+
private IsTiles;
|
|
86
98
|
constructor(props: IDashboardProps);
|
|
87
99
|
private applyFilters;
|
|
88
100
|
private render;
|
|
@@ -100,6 +112,8 @@ export declare class Dashboard {
|
|
|
100
112
|
filterAccordion(value?: string): void;
|
|
101
113
|
filterAccordionMulti(value?: string[]): void;
|
|
102
114
|
filterMulti(idx: number, values?: string[]): void;
|
|
115
|
+
filterTiles(value?: string): void;
|
|
116
|
+
filterTilesMulti(value?: string[]): void;
|
|
103
117
|
getFilter(key: string): Components.ICheckboxGroup;
|
|
104
118
|
getSearchValue(): string;
|
|
105
119
|
hideFilter(): void;
|
package/build/dashboard/index.js
CHANGED
|
@@ -34,6 +34,7 @@ var footer_1 = require("./footer");
|
|
|
34
34
|
var header_1 = require("./header");
|
|
35
35
|
var navigation_1 = require("./navigation");
|
|
36
36
|
var table_1 = require("./table");
|
|
37
|
+
var tiles_1 = require("./tiles");
|
|
37
38
|
// Export the components
|
|
38
39
|
__exportStar(require("./accordion"), exports);
|
|
39
40
|
__exportStar(require("./filter"), exports);
|
|
@@ -41,6 +42,7 @@ __exportStar(require("./footer"), exports);
|
|
|
41
42
|
__exportStar(require("./header"), exports);
|
|
42
43
|
__exportStar(require("./navigation"), exports);
|
|
43
44
|
__exportStar(require("./table"), exports);
|
|
45
|
+
__exportStar(require("./tiles"), exports);
|
|
44
46
|
/**
|
|
45
47
|
* Dashboard
|
|
46
48
|
*/
|
|
@@ -53,6 +55,7 @@ var Dashboard = /** @class */ (function () {
|
|
|
53
55
|
this._filters = null;
|
|
54
56
|
this._navigation = null;
|
|
55
57
|
this._props = null;
|
|
58
|
+
this._tiles = null;
|
|
56
59
|
// Set the properties
|
|
57
60
|
this._props = props;
|
|
58
61
|
// Set the flag
|
|
@@ -67,7 +70,10 @@ var Dashboard = /** @class */ (function () {
|
|
|
67
70
|
props.onRendered ? props.onRendered(_this._props.el) : null;
|
|
68
71
|
}, 10);
|
|
69
72
|
}
|
|
73
|
+
// Determines if we are rendering an accordion
|
|
70
74
|
Dashboard.prototype.IsAccordion = function () { return this._props.accordion ? true : false; };
|
|
75
|
+
// Determines if we are rendering tiles
|
|
76
|
+
Dashboard.prototype.IsTiles = function () { return this._props.tiles ? true : false; };
|
|
71
77
|
// Applies the default active filters
|
|
72
78
|
Dashboard.prototype.applyFilters = function () {
|
|
73
79
|
var _a;
|
|
@@ -105,14 +111,16 @@ var Dashboard = /** @class */ (function () {
|
|
|
105
111
|
filters: this._props.filters ? this._props.filters.items : [],
|
|
106
112
|
onClear: this._props.filters ? this._props.filters.onClear : null,
|
|
107
113
|
onRendered: this._props.filters ? this._props.filters.onRendered : null,
|
|
108
|
-
onFilter:
|
|
114
|
+
onFilter: this.IsAccordion ? function (value) {
|
|
109
115
|
_this._accordion.filter(value);
|
|
110
|
-
}
|
|
116
|
+
} : (this.IsTiles ? function (value) {
|
|
117
|
+
_this._tiles.filter(value);
|
|
118
|
+
} : null)
|
|
111
119
|
});
|
|
112
120
|
// Render the template
|
|
113
121
|
var elTemplate = document.createElement("div");
|
|
114
122
|
elTemplate.classList.add("dashboard");
|
|
115
|
-
elTemplate.innerHTML = "\n <div class=\"row\">\n <div id=\"navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"header\" class=\"col mx-75\"></div>\n </div>\n <div class=\"row\">\n <div id=\"sub-navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"".concat(this.IsAccordion ? "accordion" : "datatable", "\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"footer\" class=\"col\"></div>\n </div>").trim();
|
|
123
|
+
elTemplate.innerHTML = "\n <div class=\"row\">\n <div id=\"navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"header\" class=\"col mx-75\"></div>\n </div>\n <div class=\"row\">\n <div id=\"sub-navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"".concat(this.IsAccordion ? "accordion" : (this.IsTiles ? "tiles" : "datatable"), "\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"footer\" class=\"col\"></div>\n </div>").trim();
|
|
116
124
|
this._props.el.appendChild(elTemplate);
|
|
117
125
|
// Set/Default the visibility flags
|
|
118
126
|
var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;
|
|
@@ -149,6 +157,11 @@ var Dashboard = /** @class */ (function () {
|
|
|
149
157
|
// Search the accordion
|
|
150
158
|
_this._accordion.search(value);
|
|
151
159
|
}
|
|
160
|
+
// Else, see if we are rendering tiles
|
|
161
|
+
else if (_this.IsTiles) {
|
|
162
|
+
// Search the tiles
|
|
163
|
+
_this._tiles.search(value);
|
|
164
|
+
}
|
|
152
165
|
else {
|
|
153
166
|
// Search the data table
|
|
154
167
|
_this._dt.search(value);
|
|
@@ -225,6 +238,11 @@ var Dashboard = /** @class */ (function () {
|
|
|
225
238
|
// Search the accordion
|
|
226
239
|
_this._accordion.search(value);
|
|
227
240
|
}
|
|
241
|
+
// Else, see if we are rendering tiles
|
|
242
|
+
else if (_this.IsTiles) {
|
|
243
|
+
// Search the tiles
|
|
244
|
+
_this._tiles.search(value);
|
|
245
|
+
}
|
|
228
246
|
else {
|
|
229
247
|
// Search the data table
|
|
230
248
|
_this._dt.search(value);
|
|
@@ -241,6 +259,11 @@ var Dashboard = /** @class */ (function () {
|
|
|
241
259
|
// Render the accordion
|
|
242
260
|
this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector("#accordion") }, this._props.accordion));
|
|
243
261
|
}
|
|
262
|
+
// Else, see if we are rendering tiles
|
|
263
|
+
else if (this.IsTiles) {
|
|
264
|
+
// Render the tiles
|
|
265
|
+
this._tiles = new tiles_1.Tiles(__assign({ el: this._props.el.querySelector("#tiles") }, this._props.tiles));
|
|
266
|
+
}
|
|
244
267
|
else {
|
|
245
268
|
// Render the data table
|
|
246
269
|
this._dt = new table_1.DataTable({
|
|
@@ -301,7 +324,11 @@ var Dashboard = /** @class */ (function () {
|
|
|
301
324
|
// Filter the accordion
|
|
302
325
|
this._accordion.filter(value);
|
|
303
326
|
}
|
|
304
|
-
// Else,
|
|
327
|
+
// Else, see if we are rendering tiles
|
|
328
|
+
else if (this.IsTiles) {
|
|
329
|
+
// Search the tiles
|
|
330
|
+
this._tiles.search(value);
|
|
331
|
+
}
|
|
305
332
|
else {
|
|
306
333
|
// If no value is specified, then we don't want to filter by exact value
|
|
307
334
|
exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);
|
|
@@ -330,11 +357,32 @@ var Dashboard = /** @class */ (function () {
|
|
|
330
357
|
// Filter the accordion
|
|
331
358
|
//this._accordion.filterMulti(value);
|
|
332
359
|
}
|
|
360
|
+
// Else, see if we have tiles
|
|
361
|
+
else if (this.IsTiles) {
|
|
362
|
+
// Filter the tiles
|
|
363
|
+
//this._tiles.filterMulti(value);
|
|
364
|
+
}
|
|
333
365
|
else {
|
|
334
366
|
// Filter the table
|
|
335
367
|
this._dt.filterMulti(idx, values);
|
|
336
368
|
}
|
|
337
369
|
};
|
|
370
|
+
// Filter the tiles
|
|
371
|
+
Dashboard.prototype.filterTiles = function (value) {
|
|
372
|
+
// See if we have tiles
|
|
373
|
+
if (this.IsTiles) {
|
|
374
|
+
// Filter the tiles
|
|
375
|
+
this._tiles.filter(value);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
// Filter the tiles
|
|
379
|
+
Dashboard.prototype.filterTilesMulti = function (value) {
|
|
380
|
+
// See if we have tiles
|
|
381
|
+
if (this.IsTiles) {
|
|
382
|
+
// Filter the tiles
|
|
383
|
+
//this._tiles.filterMulti(value);
|
|
384
|
+
}
|
|
385
|
+
};
|
|
338
386
|
// Returns a filter checkbox group by its key
|
|
339
387
|
Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };
|
|
340
388
|
// Returns the current search value
|
|
@@ -359,6 +407,11 @@ var Dashboard = /** @class */ (function () {
|
|
|
359
407
|
// Search the accordion
|
|
360
408
|
this._accordion.search(value);
|
|
361
409
|
}
|
|
410
|
+
// Else, see if we have tiles
|
|
411
|
+
else if (this.IsTiles) {
|
|
412
|
+
// Search the tiles
|
|
413
|
+
this._tiles.search(value);
|
|
414
|
+
}
|
|
362
415
|
else {
|
|
363
416
|
// Search the table
|
|
364
417
|
this._dt.search(value);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ITiles {
|
|
2
|
+
filter?: (string: any) => void;
|
|
3
|
+
search?: (value: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface ITilesProps {
|
|
6
|
+
bodyField?: string;
|
|
7
|
+
el: HTMLElement;
|
|
8
|
+
filterField?: string;
|
|
9
|
+
items: any[];
|
|
10
|
+
onCardRender?: (el?: HTMLElement, item?: any) => void;
|
|
11
|
+
paginationLimit?: number;
|
|
12
|
+
subTitleField?: string;
|
|
13
|
+
titleField?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Tiles
|
|
17
|
+
*/
|
|
18
|
+
export declare class Tiles implements ITiles {
|
|
19
|
+
private _tiles;
|
|
20
|
+
private _activeFilterClass;
|
|
21
|
+
private _activeSearchFilter;
|
|
22
|
+
private _pagination;
|
|
23
|
+
private _props;
|
|
24
|
+
constructor(props: ITilesProps);
|
|
25
|
+
filter(value: string): void;
|
|
26
|
+
private render;
|
|
27
|
+
private renderTiles;
|
|
28
|
+
private updateTiles;
|
|
29
|
+
search(value: string): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tiles = void 0;
|
|
4
|
+
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
|
+
/**
|
|
6
|
+
* Tiles
|
|
7
|
+
*/
|
|
8
|
+
var Tiles = /** @class */ (function () {
|
|
9
|
+
// Constructor
|
|
10
|
+
function Tiles(props) {
|
|
11
|
+
this._tiles = null;
|
|
12
|
+
this._activeFilterClass = null;
|
|
13
|
+
this._activeSearchFilter = null;
|
|
14
|
+
this._pagination = null;
|
|
15
|
+
// Save the properties
|
|
16
|
+
this._props = props;
|
|
17
|
+
// Render the tile
|
|
18
|
+
this.render();
|
|
19
|
+
}
|
|
20
|
+
// Filters the tile
|
|
21
|
+
Tiles.prototype.filter = function (value) {
|
|
22
|
+
var className = value ? value.toLowerCase().replace(/ /g, "-") : null;
|
|
23
|
+
this._activeFilterClass = className;
|
|
24
|
+
// Parse all tile items
|
|
25
|
+
var items = this._props.el.querySelectorAll(".card");
|
|
26
|
+
for (var i = 0; i < items.length; i++) {
|
|
27
|
+
var elItem = items[i];
|
|
28
|
+
// Show the item
|
|
29
|
+
elItem.classList.remove("d-none");
|
|
30
|
+
}
|
|
31
|
+
// Update the tiles
|
|
32
|
+
this.updateTiles();
|
|
33
|
+
};
|
|
34
|
+
// Renders the dashboard
|
|
35
|
+
Tiles.prototype.render = function () {
|
|
36
|
+
// Render the tile
|
|
37
|
+
this.renderTiles();
|
|
38
|
+
// Update the tiles
|
|
39
|
+
this.updateTiles();
|
|
40
|
+
};
|
|
41
|
+
// Renders the tiles
|
|
42
|
+
Tiles.prototype.renderTiles = function () {
|
|
43
|
+
// Parse the items
|
|
44
|
+
var cards = [];
|
|
45
|
+
for (var i = 0; i < this._props.items.length; i++) {
|
|
46
|
+
var item = this._props.items[i];
|
|
47
|
+
var itemClassNames = [];
|
|
48
|
+
// Get the filters
|
|
49
|
+
var filters = item[this._props.filterField] || [];
|
|
50
|
+
filters = filters["results"] || filters;
|
|
51
|
+
// See if the filter field is specified
|
|
52
|
+
if (this._props.filterField) {
|
|
53
|
+
// Parse the selected filters
|
|
54
|
+
for (var j = 0; j < filters.length; j++) {
|
|
55
|
+
var filter = filters[j].toLowerCase().replace(/ /g, '-');
|
|
56
|
+
// Add the filter as a class name
|
|
57
|
+
if (filter) {
|
|
58
|
+
itemClassNames.push(filter);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Add an tile
|
|
63
|
+
cards.push({
|
|
64
|
+
className: itemClassNames.join(" "),
|
|
65
|
+
body: [{
|
|
66
|
+
content: (this._props.bodyField ? item[this._props.bodyField || "Description"] : null) || "",
|
|
67
|
+
data: filters,
|
|
68
|
+
subTitle: item[this._props.subTitleField] || "",
|
|
69
|
+
title: item[this._props.titleField || "Title"] || "",
|
|
70
|
+
onRender: this._props.onCardRender
|
|
71
|
+
}]
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
// Render the tiles
|
|
75
|
+
this._tiles = gd_sprest_bs_1.Components.CardGroup({
|
|
76
|
+
el: this._props.el,
|
|
77
|
+
cards: cards
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
// Updates the visibility of the tiles
|
|
81
|
+
Tiles.prototype.updateTiles = function () {
|
|
82
|
+
var paginationLimit = this._props.paginationLimit || 10;
|
|
83
|
+
// Get the pagination element
|
|
84
|
+
var elPagination = this._props.el.querySelector(".tiles-pagination");
|
|
85
|
+
if (elPagination) {
|
|
86
|
+
// Clear the element
|
|
87
|
+
while (elPagination.firstChild) {
|
|
88
|
+
elPagination.removeChild(elPagination.firstChild);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Create the element
|
|
93
|
+
elPagination = document.createElement("div");
|
|
94
|
+
elPagination.classList.add("tiles-pagination");
|
|
95
|
+
this._props.el.appendChild(elPagination);
|
|
96
|
+
}
|
|
97
|
+
// Get the elements as an array
|
|
98
|
+
var elItems = Array.from(this._tiles.el.querySelectorAll(this._activeFilterClass ? "." + this._activeFilterClass : ".card"));
|
|
99
|
+
// See if a search value exists
|
|
100
|
+
if (this._activeSearchFilter) {
|
|
101
|
+
// Parse the items
|
|
102
|
+
for (var i = elItems.length - 1; i >= 0; i--) {
|
|
103
|
+
var elItem = elItems[i];
|
|
104
|
+
// See if the item doesn't contains the search value
|
|
105
|
+
if (elItem.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0) {
|
|
106
|
+
// Hide the item
|
|
107
|
+
elItem.classList.add("d-none");
|
|
108
|
+
// Exclude the item from the array
|
|
109
|
+
elItems.splice(i, 1);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Parse the active items to show
|
|
114
|
+
for (var i = 0; i < paginationLimit; i++) {
|
|
115
|
+
var elItem = elItems[i];
|
|
116
|
+
// Ensure the item exists
|
|
117
|
+
if (elItem) {
|
|
118
|
+
// Show the item
|
|
119
|
+
elItem.classList.remove("d-none");
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// Set the class for the last item
|
|
123
|
+
if (elItems[i - 1]) {
|
|
124
|
+
elItems[i - 1].classList.add("last-item");
|
|
125
|
+
}
|
|
126
|
+
// Break from the loop
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Parse the active items to hide
|
|
131
|
+
for (var i = paginationLimit; i < elItems.length; i++) {
|
|
132
|
+
var elItem = elItems[i];
|
|
133
|
+
// Hide the item
|
|
134
|
+
elItem.classList.add("d-none");
|
|
135
|
+
}
|
|
136
|
+
// Render the pagination
|
|
137
|
+
this._pagination = gd_sprest_bs_1.Components.Pagination({
|
|
138
|
+
el: elPagination,
|
|
139
|
+
className: "d-flex justify-content-end pt-2",
|
|
140
|
+
numberOfPages: Math.ceil(elItems.length / paginationLimit),
|
|
141
|
+
onClick: function (pageNumber) {
|
|
142
|
+
// Parse the items
|
|
143
|
+
for (var i = 0; i < elItems.length; i++) {
|
|
144
|
+
var elItem = elItems[i];
|
|
145
|
+
// Hide the item
|
|
146
|
+
elItem.classList.add("d-none");
|
|
147
|
+
}
|
|
148
|
+
// Parse the items to show
|
|
149
|
+
var startIdx = (pageNumber - 1) * paginationLimit;
|
|
150
|
+
for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {
|
|
151
|
+
var elItem = elItems[i];
|
|
152
|
+
// Show the item
|
|
153
|
+
elItem.classList.remove("d-none");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
// Searches the tile
|
|
159
|
+
Tiles.prototype.search = function (value) {
|
|
160
|
+
// Set the search value
|
|
161
|
+
this._activeSearchFilter = (value || "").toLowerCase();
|
|
162
|
+
// Update the tiles
|
|
163
|
+
this.updateTiles();
|
|
164
|
+
};
|
|
165
|
+
return Tiles;
|
|
166
|
+
}());
|
|
167
|
+
exports.Tiles = Tiles;
|
package/build/lib.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const DattaTable: {
|
|
|
12
12
|
Header: typeof Dashboard.Header;
|
|
13
13
|
Navigation: typeof Dashboard.Navigation;
|
|
14
14
|
DataTable: typeof Dashboard.DataTable;
|
|
15
|
+
Tiles: typeof Dashboard.Tiles;
|
|
15
16
|
AuditLog: typeof AuditLog.AuditLog;
|
|
16
17
|
CanvasForm: typeof Common.CanvasForm;
|
|
17
18
|
Comments: typeof Common.Comments;
|
package/dist/dattatable.js
CHANGED
|
@@ -170,7 +170,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
170
170
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
171
171
|
|
|
172
172
|
"use strict";
|
|
173
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Accordion = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.98/node_modules/gd-sprest-bs/build/index.js\");\r\n/**\r\n * Accordion\r\n */\r\nvar Accordion = /** @class */ (function () {\r\n // Constructor\r\n function Accordion(props) {\r\n this._accordion = null;\r\n this._activeFilterClass = null;\r\n this._activeSearchFilter = null;\r\n this._pagination = null;\r\n // Save the properties\r\n this._props = props;\r\n // Render the accordion\r\n this.render();\r\n }\r\n // Clears an item\r\n Accordion.prototype.clearItem = function (elItem) {\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n // Remove the first/last item classes\r\n elItem.classList.remove(\"first-item\");\r\n elItem.classList.remove(\"last-item\");\r\n };\r\n // Filters the accordion\r\n Accordion.prototype.filter = function (value) {\r\n var className = value ? value.toLowerCase().replace(/ /g, \"-\") : null;\r\n this._activeFilterClass = className;\r\n // Parse all accordion items\r\n var items = this._props.el.querySelectorAll(\".accordion-item\");\r\n for (var i = 0; i < items.length; i++) {\r\n var elItem = items[i];\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n // Remove the first/last item classes\r\n elItem.classList.remove(\"first-item\");\r\n elItem.classList.remove(\"last-item\");\r\n // See if a class name exists\r\n if (className) {\r\n // See if this item doesn't matches\r\n if (!elItem.classList.contains(className)) {\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n }\r\n }\r\n }\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Renders the dashboard\r\n Accordion.prototype.render = function () {\r\n // Render the accordion\r\n this.renderAccordion();\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Renders the accordion\r\n Accordion.prototype.renderAccordion = function () {\r\n // Parse the items\r\n var accordionItems = [];\r\n for (var i = 0; i < this._props.items.length; i++) {\r\n var item = this._props.items[i];\r\n var itemClassNames = [];\r\n // See if the filter field is specified\r\n if (this._props.filterField) {\r\n // Parse the selected filters\r\n var filters = item[this._props.filterField] || [];\r\n filters = filters[\"results\"] || filters;\r\n for (var j = 0; j < filters.length; j++) {\r\n var filter = filters[j].toLowerCase().replace(/ /g, '-');\r\n // Add the filter as a class name\r\n if (filter) {\r\n itemClassNames.push(filter);\r\n }\r\n }\r\n }\r\n // Add an accordion item\r\n accordionItems.push({\r\n className: itemClassNames.join(\" \"),\r\n content: (this._props.bodyField ? item[this._props.bodyField || \"Description\"] : null) || \"\",\r\n header: item[this._props.titleField || \"Title\"] || \"\",\r\n onClick: this._props.onItemClick,\r\n onRender: this._props.onItemRender,\r\n showFl: i == 0,\r\n });\r\n }\r\n // Render the accordion\r\n this._accordion = gd_sprest_bs_1.Components.Accordion({\r\n el: this._props.el,\r\n id: \"accordion-list\",\r\n items: accordionItems\r\n });\r\n };\r\n // Renders the items\r\n Accordion.prototype.renderItems = function () {\r\n var _this = this;\r\n var paginationLimit = this._props.paginationLimit || 10;\r\n // Get the pagination element\r\n var elPagination = this._props.el.querySelector(\".accordion-pagination\");\r\n if (elPagination) {\r\n // Clear the element\r\n while (elPagination.firstChild) {\r\n elPagination.removeChild(elPagination.firstChild);\r\n }\r\n }\r\n else {\r\n // Create the element\r\n elPagination = document.createElement(\"div\");\r\n elPagination.classList.add(\"accordion-pagination\");\r\n this._props.el.appendChild(elPagination);\r\n }\r\n // Get the elements as an array\r\n var elItems = Array.from(this._accordion.el.querySelectorAll(this._activeFilterClass ? \".\" + this._activeFilterClass : \".accordion-item\"));\r\n // See if a search value exists\r\n if (this._activeSearchFilter) {\r\n // Parse the items\r\n for (var i = elItems.length - 1; i >= 0; i--) {\r\n var elItem = elItems[i];\r\n var elContent = elItem.querySelector(\".accordion-body\");\r\n // See if this item is expanded\r\n if (elItem.querySelector(\".accordion-collapse.show\")) {\r\n // Collapse the item\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0 &&\r\n elContent.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0) {\r\n // Clear the item\r\n this.clearItem(elItem);\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n }\r\n }\r\n }\r\n // Parse the active items to show\r\n for (var i = 0; i < paginationLimit; i++) {\r\n var elItem = elItems[i];\r\n // Ensure the item exists\r\n if (elItem) {\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n // See if this is the first item\r\n if (i == 0) {\r\n elItem.classList.add(\"first-item\");\r\n }\r\n }\r\n else {\r\n // Set the class for the last item\r\n if (elItems[i - 1]) {\r\n elItems[i - 1].classList.add(\"last-item\");\r\n }\r\n // Break from the loop\r\n break;\r\n }\r\n }\r\n // Parse the active items to hide\r\n for (var i = paginationLimit; i < elItems.length; i++) {\r\n // Clear the item\r\n this.clearItem(elItems[i]);\r\n }\r\n // Ensure items exist\r\n if (elItems.length > 0) {\r\n // Ensure the first item is expanded\r\n if (elItems[0].querySelector(\".accordion-collapse.show\") == null) {\r\n // Hide the button\r\n var btn = elItems[0].querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // Set the first item class\r\n elItems[0].classList.add(\"first-item\");\r\n // Set the last item class\r\n var lastIdx = paginationLimit - 1;\r\n elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add(\"last-item\");\r\n }\r\n // Render the pagination\r\n this._pagination = gd_sprest_bs_1.Components.Pagination({\r\n el: elPagination,\r\n className: \"d-flex justify-content-end pt-2\",\r\n numberOfPages: Math.ceil(elItems.length / paginationLimit),\r\n onClick: function (pageNumber) {\r\n // Parse the items\r\n for (var i = 0; i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // See if this item is expanded\r\n if (elItem.querySelector(\".accordion-collapse.show\")) {\r\n // Hide the button\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // Clear the item\r\n _this.clearItem(elItem);\r\n }\r\n // Parse the items to show\r\n var startIdx = (pageNumber - 1) * paginationLimit;\r\n for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n // See if this is the first item\r\n if (i == startIdx) {\r\n // Set the first item class\r\n elItem.classList.add(\"first-item\");\r\n // Expand the item\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n }\r\n // Set the last item class\r\n var lastIdx = startIdx + paginationLimit - 1;\r\n elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add(\"last-item\");\r\n }\r\n });\r\n };\r\n // Searches the accordion\r\n Accordion.prototype.search = function (value) {\r\n // Set the search value\r\n this._activeSearchFilter = (value || \"\").toLowerCase();\r\n // Render the items\r\n this.renderItems();\r\n };\r\n return Accordion;\r\n}());\r\nexports.Accordion = Accordion;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/accordion.js?");
|
|
173
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Accordion = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.98/node_modules/gd-sprest-bs/build/index.js\");\r\n/**\r\n * Accordion\r\n */\r\nvar Accordion = /** @class */ (function () {\r\n // Constructor\r\n function Accordion(props) {\r\n this._accordion = null;\r\n this._activeFilterClass = null;\r\n this._activeSearchFilter = null;\r\n this._pagination = null;\r\n // Save the properties\r\n this._props = props;\r\n // Render the accordion\r\n this.render();\r\n }\r\n // Clears an item\r\n Accordion.prototype.clearItem = function (elItem) {\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n // Remove the first/last item classes\r\n elItem.classList.remove(\"first-item\");\r\n elItem.classList.remove(\"last-item\");\r\n };\r\n // Filters the accordion\r\n Accordion.prototype.filter = function (value) {\r\n var className = value ? value.toLowerCase().replace(/ /g, \"-\") : null;\r\n this._activeFilterClass = className;\r\n // Parse all accordion items\r\n var items = this._props.el.querySelectorAll(\".accordion-item\");\r\n for (var i = 0; i < items.length; i++) {\r\n var elItem = items[i];\r\n // Clear the item\r\n this.clearItem(elItem);\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n }\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Renders the dashboard\r\n Accordion.prototype.render = function () {\r\n // Render the accordion\r\n this.renderAccordion();\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Renders the accordion\r\n Accordion.prototype.renderAccordion = function () {\r\n // Parse the items\r\n var accordionItems = [];\r\n for (var i = 0; i < this._props.items.length; i++) {\r\n var item = this._props.items[i];\r\n var itemClassNames = [];\r\n // See if the filter field is specified\r\n if (this._props.filterField) {\r\n // Parse the selected filters\r\n var filters = item[this._props.filterField] || [];\r\n filters = filters[\"results\"] || filters;\r\n for (var j = 0; j < filters.length; j++) {\r\n var filter = filters[j].toLowerCase().replace(/ /g, '-');\r\n // Add the filter as a class name\r\n if (filter) {\r\n itemClassNames.push(filter);\r\n }\r\n }\r\n }\r\n // Add an accordion item\r\n accordionItems.push({\r\n className: itemClassNames.join(\" \"),\r\n content: (this._props.bodyField ? item[this._props.bodyField || \"Description\"] : null) || \"\",\r\n header: item[this._props.titleField || \"Title\"] || \"\",\r\n onClick: this._props.onItemClick,\r\n onRender: this._props.onItemRender,\r\n showFl: i == 0,\r\n });\r\n }\r\n // Render the accordion\r\n this._accordion = gd_sprest_bs_1.Components.Accordion({\r\n el: this._props.el,\r\n id: \"accordion-list\",\r\n items: accordionItems\r\n });\r\n };\r\n // Renders the items\r\n Accordion.prototype.renderItems = function () {\r\n var _this = this;\r\n var paginationLimit = this._props.paginationLimit || 10;\r\n // Get the pagination element\r\n var elPagination = this._props.el.querySelector(\".accordion-pagination\");\r\n if (elPagination) {\r\n // Clear the element\r\n while (elPagination.firstChild) {\r\n elPagination.removeChild(elPagination.firstChild);\r\n }\r\n }\r\n else {\r\n // Create the element\r\n elPagination = document.createElement(\"div\");\r\n elPagination.classList.add(\"accordion-pagination\");\r\n this._props.el.appendChild(elPagination);\r\n }\r\n // Get the elements as an array\r\n var elItems = Array.from(this._accordion.el.querySelectorAll(this._activeFilterClass ? \".\" + this._activeFilterClass : \".accordion-item\"));\r\n // See if a search value exists\r\n if (this._activeSearchFilter) {\r\n // Parse the items\r\n for (var i = elItems.length - 1; i >= 0; i--) {\r\n var elItem = elItems[i];\r\n var elContent = elItem.querySelector(\".accordion-body\");\r\n // See if this item is expanded\r\n if (elItem.querySelector(\".accordion-collapse.show\")) {\r\n // Collapse the item\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0 &&\r\n elContent.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0) {\r\n // Clear the item\r\n this.clearItem(elItem);\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n }\r\n }\r\n }\r\n // Parse the active items to show\r\n for (var i = 0; i < paginationLimit; i++) {\r\n var elItem = elItems[i];\r\n // Ensure the item exists\r\n if (elItem) {\r\n // Clear the item\r\n this.clearItem(elItem);\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n // See if this is the first item\r\n if (i == 0) {\r\n elItem.classList.add(\"first-item\");\r\n }\r\n }\r\n else {\r\n // Set the class for the last item\r\n if (elItems[i - 1]) {\r\n elItems[i - 1].classList.add(\"last-item\");\r\n }\r\n // Break from the loop\r\n break;\r\n }\r\n }\r\n // Parse the active items to hide\r\n for (var i = paginationLimit; i < elItems.length; i++) {\r\n // Clear the item\r\n this.clearItem(elItems[i]);\r\n }\r\n // Ensure items exist\r\n if (elItems.length > 0) {\r\n // Ensure the first item is expanded\r\n if (elItems[0].querySelector(\".accordion-collapse.show\") == null) {\r\n // Hide the button\r\n var btn = elItems[0].querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // Set the first item class\r\n elItems[0].classList.add(\"first-item\");\r\n // Set the last item class\r\n var lastIdx = paginationLimit - 1;\r\n elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add(\"last-item\");\r\n }\r\n // Render the pagination\r\n this._pagination = gd_sprest_bs_1.Components.Pagination({\r\n el: elPagination,\r\n className: \"d-flex justify-content-end pt-2\",\r\n numberOfPages: Math.ceil(elItems.length / paginationLimit),\r\n onClick: function (pageNumber) {\r\n // Parse the items\r\n for (var i = 0; i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // See if this item is expanded\r\n if (elItem.querySelector(\".accordion-collapse.show\")) {\r\n // Hide the button\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n // Clear the item\r\n _this.clearItem(elItem);\r\n }\r\n // Parse the items to show\r\n var startIdx = (pageNumber - 1) * paginationLimit;\r\n for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n // See if this is the first item\r\n if (i == startIdx) {\r\n // Set the first item class\r\n elItem.classList.add(\"first-item\");\r\n // Expand the item\r\n var btn = elItem.querySelector(\".accordion-button\");\r\n btn === null || btn === void 0 ? void 0 : btn.click();\r\n }\r\n }\r\n // Set the last item class\r\n var lastIdx = startIdx + paginationLimit - 1;\r\n elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add(\"last-item\");\r\n }\r\n });\r\n };\r\n // Searches the accordion\r\n Accordion.prototype.search = function (value) {\r\n // Set the search value\r\n this._activeSearchFilter = (value || \"\").toLowerCase();\r\n // Render the items\r\n this.renderItems();\r\n };\r\n return Accordion;\r\n}());\r\nexports.Accordion = Accordion;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/accordion.js?");
|
|
174
174
|
|
|
175
175
|
/***/ }),
|
|
176
176
|
|
|
@@ -214,7 +214,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
214
214
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
215
215
|
|
|
216
216
|
"use strict";
|
|
217
|
-
eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Dashboard = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.98/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\nvar accordion_1 = __webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\");\r\nvar filter_1 = __webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\");\r\nvar footer_1 = __webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\");\r\nvar header_1 = __webpack_require__(/*! ./header */ \"./build/dashboard/header.js\");\r\nvar navigation_1 = __webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\");\r\nvar table_1 = __webpack_require__(/*! ./table */ \"./build/dashboard/table.js\");\r\n// Export the components\r\n__exportStar(__webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./header */ \"./build/dashboard/header.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./table */ \"./build/dashboard/table.js\"), exports);\r\n/**\r\n * Dashboard\r\n */\r\nvar Dashboard = /** @class */ (function () {\r\n // Constructor\r\n function Dashboard(props) {\r\n var _this = this;\r\n this._accordion = null;\r\n this._dt = null;\r\n this._filters = null;\r\n this._navigation = null;\r\n this._props = null;\r\n // Set the properties\r\n this._props = props;\r\n // Set the flag\r\n typeof (props.useModal) === \"boolean\" ? common_1.ItemForm.UseModal = props.useModal : null;\r\n // Render the dashboard\r\n this.render();\r\n // Let the object get instaniated before calling the event\r\n setTimeout(function () {\r\n // Apply the filters\r\n _this.applyFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(_this._props.el) : null;\r\n }, 10);\r\n }\r\n Dashboard.prototype.IsAccordion = function () { return this._props.accordion ? true : false; };\r\n // Applies the default active filters\r\n Dashboard.prototype.applyFilters = function () {\r\n var _a;\r\n // See if filters exist\r\n if ((_a = this._props.filters) === null || _a === void 0 ? void 0 : _a.items) {\r\n // Parse the filters\r\n for (var i = 0; i < this._props.filters.items.length; i++) {\r\n var applyFilter = false;\r\n var filter = this._props.filters.items[i];\r\n var value = filter.multi ? [] : \"\";\r\n // Parse the items\r\n for (var j = 0; j < (filter === null || filter === void 0 ? void 0 : filter.items.length); j++) {\r\n var item = filter.items[j];\r\n // See if this one is active\r\n if (item.isSelected) {\r\n // Set the flag\r\n applyFilter = true;\r\n // Set the value\r\n filter.multi ? value.push(item.label) : value = item.label;\r\n }\r\n }\r\n // See if we are applying the filter\r\n if (applyFilter) {\r\n // Apply the filter\r\n filter.onFilter(value);\r\n }\r\n }\r\n }\r\n };\r\n // Renders the component\r\n Dashboard.prototype.render = function () {\r\n var _this = this;\r\n // Create the filters\r\n this._filters = new filter_1.FilterSlideout({\r\n filters: this._props.filters ? this._props.filters.items : [],\r\n onClear: this._props.filters ? this._props.filters.onClear : null,\r\n onRendered: this._props.filters ? this._props.filters.onRendered : null,\r\n onFilter: !this.IsAccordion ? null : function (value) {\r\n _this._accordion.filter(value);\r\n }\r\n });\r\n // Render the template\r\n var elTemplate = document.createElement(\"div\");\r\n elTemplate.classList.add(\"dashboard\");\r\n elTemplate.innerHTML = \"\\n <div class=\\\"row\\\">\\n <div id=\\\"navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"header\\\" class=\\\"col mx-75\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"sub-navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"\".concat(this.IsAccordion ? \"accordion\" : \"datatable\", \"\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"footer\\\" class=\\\"col\\\"></div>\\n </div>\").trim();\r\n this._props.el.appendChild(elTemplate);\r\n // Set/Default the visibility flags\r\n var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;\r\n var navIsVisible = this._props.hideNavigation ? false : true;\r\n var subNavIsVisible = (this._props.hideSubNavigation == null || this._props.hideSubNavigation == true) && this._props.subNavigation == null ? false : true;\r\n // See if we are hiding the navigation\r\n if (!navIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_1 = this._props.navigation || {};\r\n this._navigation = new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#navigation\"),\r\n hideFilter: navProps_1.showFilter != null ? !navProps_1.showFilter : false,\r\n hideSearch: navProps_1.showSearch != null ? !navProps_1.showSearch : false,\r\n items: navProps_1.items,\r\n itemsEnd: navProps_1.itemsEnd,\r\n title: navProps_1.title,\r\n onFilterRendered: navProps_1.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"bg-sharepoint rounded\" + (headerIsVisible || subNavIsVisible ? \"-top\" : \"\"));\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Dark;\r\n // Call the rendering event if it exists\r\n navProps_1.onRendering ? navProps_1.onRendering(props) : null;\r\n },\r\n onRendered: navProps_1.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onSearchRendered: navProps_1.onSearchRendered,\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n // Call the event\r\n navProps_1.onShowFilter ? navProps_1.onShowFilter() : null;\r\n },\r\n searchPlaceholder: navProps_1.searchPlaceholder\r\n });\r\n }\r\n // See if we are hiding the header\r\n if (!headerIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#header\").classList.add(\"d-none\");\r\n }\r\n else {\r\n var elHeader = this._props.el.querySelector(\"#header\");\r\n // Render the header\r\n var header = this._props.header || {};\r\n new header_1.Header({\r\n el: elHeader,\r\n onRendering: this._props.header ? this._props.header.onRendering : null,\r\n onRendered: this._props.header ? this._props.header.onRendered : null,\r\n title: header.title\r\n });\r\n // See if the sub-nav is not visible\r\n if (!navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded\");\r\n }\r\n else if (navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-bottom\");\r\n }\r\n else if (!navIsVisible && subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-top\");\r\n }\r\n }\r\n // See if we are hiding the sub-navigation\r\n if (!subNavIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#sub-navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_2 = this._props.subNavigation || {};\r\n new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#sub-navigation\"),\r\n hideFilter: navProps_2.showFilter != null ? !navProps_2.showFilter : true,\r\n hideSearch: navProps_2.showSearch != null ? !navProps_2.showSearch : true,\r\n items: navProps_2.items,\r\n itemsEnd: navProps_2.itemsEnd,\r\n title: navProps_2.title,\r\n onFilterRendered: navProps_2.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"rounded\" + (!headerIsVisible && !navIsVisible ? \"\" : \"-bottom\"));\r\n props.className = \"sub-nav \" + props.className;\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Light;\r\n // Call the rendering event if it exists\r\n navProps_2.onRendering ? navProps_2.onRendering(props) : null;\r\n },\r\n onRendered: navProps_2.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n },\r\n });\r\n }\r\n // See if we are rendering an accordion\r\n if (this.IsAccordion) {\r\n // Render the accordion\r\n this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector(\"#accordion\") }, this._props.accordion));\r\n }\r\n else {\r\n // Render the data table\r\n this._dt = new table_1.DataTable({\r\n columns: this._props.table ? this._props.table.columns : null,\r\n dtProps: this._props.table ? this._props.table.dtProps : null,\r\n el: this._props.el.querySelector(\"#datatable\"),\r\n onRendered: this._props.table ? this._props.table.onRendered : null,\r\n rows: this._props.table ? this._props.table.rows : null\r\n });\r\n }\r\n // See if we are hiding the footer\r\n if (this._props.hideFooter) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#footer\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the footer\r\n var footer = this._props.footer || {};\r\n new footer_1.Footer({\r\n el: this._props.el.querySelector(\"#footer\"),\r\n items: footer.items,\r\n itemsEnd: footer.itemsEnd,\r\n onRendering: footer.onRendering,\r\n onRendered: footer.onRendered\r\n });\r\n }\r\n };\r\n Object.defineProperty(Dashboard.prototype, \"Datatable\", {\r\n /**\r\n * Component References\r\n */\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Filters\", {\r\n get: function () { return this._filters; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Navigation\", {\r\n get: function () { return this._navigation; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Public Interface\r\n */\r\n // Clears the filters\r\n Dashboard.prototype.clearFilter = function () {\r\n // Clear the filters\r\n this._filters.clear();\r\n };\r\n // Filter the table\r\n Dashboard.prototype.filter = function (idx, value, exactMatchFl) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n // Else, filter the table\r\n else {\r\n // If no value is specified, then we don't want to filter by exact value\r\n exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordion = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordionMulti = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n //this._accordion.filter(value);\r\n }\r\n };\r\n // Filter the table by multiple values\r\n Dashboard.prototype.filterMulti = function (idx, values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n //this._accordion.filterMulti(value);\r\n }\r\n else {\r\n // Filter the table\r\n this._dt.filterMulti(idx, values);\r\n }\r\n };\r\n // Returns a filter checkbox group by its key\r\n Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };\r\n // Returns the current search value\r\n Dashboard.prototype.getSearchValue = function () { return this._navigation ? this._navigation.getSearchValue() : \"\"; };\r\n // Hides the filter\r\n Dashboard.prototype.hideFilter = function () { this._filters.hide(); };\r\n // Refresh the table\r\n Dashboard.prototype.refresh = function (rows) {\r\n // Refresh the table\r\n this._dt.refresh(rows);\r\n // See if a search value exists\r\n var searchValue = this._navigation ? this._navigation.getSearchValue() : \"\";\r\n if (searchValue) {\r\n // Apply the search value\r\n this.search(searchValue);\r\n }\r\n };\r\n // Search the table\r\n Dashboard.prototype.search = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Search the accordion\r\n this._accordion.search(value);\r\n }\r\n else {\r\n // Search the table\r\n this._dt.search(value);\r\n }\r\n };\r\n // Sets a filter checkbox group value\r\n Dashboard.prototype.setFilterValue = function (key, value) { return this._filters.setFilterValue(key, value); };\r\n // Shows the filter\r\n Dashboard.prototype.showFilter = function () { this._filters.show(); };\r\n return Dashboard;\r\n}());\r\nexports.Dashboard = Dashboard;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/index.js?");
|
|
217
|
+
eval("\r\nvar __assign = (this && this.__assign) || function () {\r\n __assign = Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}));\r\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\r\n};\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Dashboard = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.98/node_modules/gd-sprest-bs/build/index.js\");\r\nvar common_1 = __webpack_require__(/*! ../common */ \"./build/common/index.js\");\r\nvar accordion_1 = __webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\");\r\nvar filter_1 = __webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\");\r\nvar footer_1 = __webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\");\r\nvar header_1 = __webpack_require__(/*! ./header */ \"./build/dashboard/header.js\");\r\nvar navigation_1 = __webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\");\r\nvar table_1 = __webpack_require__(/*! ./table */ \"./build/dashboard/table.js\");\r\nvar tiles_1 = __webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\");\r\n// Export the components\r\n__exportStar(__webpack_require__(/*! ./accordion */ \"./build/dashboard/accordion.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./filter */ \"./build/dashboard/filter.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./footer */ \"./build/dashboard/footer.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./header */ \"./build/dashboard/header.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./navigation */ \"./build/dashboard/navigation.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./table */ \"./build/dashboard/table.js\"), exports);\r\n__exportStar(__webpack_require__(/*! ./tiles */ \"./build/dashboard/tiles.js\"), exports);\r\n/**\r\n * Dashboard\r\n */\r\nvar Dashboard = /** @class */ (function () {\r\n // Constructor\r\n function Dashboard(props) {\r\n var _this = this;\r\n this._accordion = null;\r\n this._dt = null;\r\n this._filters = null;\r\n this._navigation = null;\r\n this._props = null;\r\n this._tiles = null;\r\n // Set the properties\r\n this._props = props;\r\n // Set the flag\r\n typeof (props.useModal) === \"boolean\" ? common_1.ItemForm.UseModal = props.useModal : null;\r\n // Render the dashboard\r\n this.render();\r\n // Let the object get instaniated before calling the event\r\n setTimeout(function () {\r\n // Apply the filters\r\n _this.applyFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(_this._props.el) : null;\r\n }, 10);\r\n }\r\n // Determines if we are rendering an accordion\r\n Dashboard.prototype.IsAccordion = function () { return this._props.accordion ? true : false; };\r\n // Determines if we are rendering tiles\r\n Dashboard.prototype.IsTiles = function () { return this._props.tiles ? true : false; };\r\n // Applies the default active filters\r\n Dashboard.prototype.applyFilters = function () {\r\n var _a;\r\n // See if filters exist\r\n if ((_a = this._props.filters) === null || _a === void 0 ? void 0 : _a.items) {\r\n // Parse the filters\r\n for (var i = 0; i < this._props.filters.items.length; i++) {\r\n var applyFilter = false;\r\n var filter = this._props.filters.items[i];\r\n var value = filter.multi ? [] : \"\";\r\n // Parse the items\r\n for (var j = 0; j < (filter === null || filter === void 0 ? void 0 : filter.items.length); j++) {\r\n var item = filter.items[j];\r\n // See if this one is active\r\n if (item.isSelected) {\r\n // Set the flag\r\n applyFilter = true;\r\n // Set the value\r\n filter.multi ? value.push(item.label) : value = item.label;\r\n }\r\n }\r\n // See if we are applying the filter\r\n if (applyFilter) {\r\n // Apply the filter\r\n filter.onFilter(value);\r\n }\r\n }\r\n }\r\n };\r\n // Renders the component\r\n Dashboard.prototype.render = function () {\r\n var _this = this;\r\n // Create the filters\r\n this._filters = new filter_1.FilterSlideout({\r\n filters: this._props.filters ? this._props.filters.items : [],\r\n onClear: this._props.filters ? this._props.filters.onClear : null,\r\n onRendered: this._props.filters ? this._props.filters.onRendered : null,\r\n onFilter: this.IsAccordion ? function (value) {\r\n _this._accordion.filter(value);\r\n } : (this.IsTiles ? function (value) {\r\n _this._tiles.filter(value);\r\n } : null)\r\n });\r\n // Render the template\r\n var elTemplate = document.createElement(\"div\");\r\n elTemplate.classList.add(\"dashboard\");\r\n elTemplate.innerHTML = \"\\n <div class=\\\"row\\\">\\n <div id=\\\"navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"header\\\" class=\\\"col mx-75\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"sub-navigation\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"\".concat(this.IsAccordion ? \"accordion\" : (this.IsTiles ? \"tiles\" : \"datatable\"), \"\\\" class=\\\"col\\\"></div>\\n </div>\\n <div class=\\\"row\\\">\\n <div id=\\\"footer\\\" class=\\\"col\\\"></div>\\n </div>\").trim();\r\n this._props.el.appendChild(elTemplate);\r\n // Set/Default the visibility flags\r\n var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;\r\n var navIsVisible = this._props.hideNavigation ? false : true;\r\n var subNavIsVisible = (this._props.hideSubNavigation == null || this._props.hideSubNavigation == true) && this._props.subNavigation == null ? false : true;\r\n // See if we are hiding the navigation\r\n if (!navIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_1 = this._props.navigation || {};\r\n this._navigation = new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#navigation\"),\r\n hideFilter: navProps_1.showFilter != null ? !navProps_1.showFilter : false,\r\n hideSearch: navProps_1.showSearch != null ? !navProps_1.showSearch : false,\r\n items: navProps_1.items,\r\n itemsEnd: navProps_1.itemsEnd,\r\n title: navProps_1.title,\r\n onFilterRendered: navProps_1.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"bg-sharepoint rounded\" + (headerIsVisible || subNavIsVisible ? \"-top\" : \"\"));\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Dark;\r\n // Call the rendering event if it exists\r\n navProps_1.onRendering ? navProps_1.onRendering(props) : null;\r\n },\r\n onRendered: navProps_1.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onSearchRendered: navProps_1.onSearchRendered,\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n // Call the event\r\n navProps_1.onShowFilter ? navProps_1.onShowFilter() : null;\r\n },\r\n searchPlaceholder: navProps_1.searchPlaceholder\r\n });\r\n }\r\n // See if we are hiding the header\r\n if (!headerIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#header\").classList.add(\"d-none\");\r\n }\r\n else {\r\n var elHeader = this._props.el.querySelector(\"#header\");\r\n // Render the header\r\n var header = this._props.header || {};\r\n new header_1.Header({\r\n el: elHeader,\r\n onRendering: this._props.header ? this._props.header.onRendering : null,\r\n onRendered: this._props.header ? this._props.header.onRendered : null,\r\n title: header.title\r\n });\r\n // See if the sub-nav is not visible\r\n if (!navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded\");\r\n }\r\n else if (navIsVisible && !subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-bottom\");\r\n }\r\n else if (!navIsVisible && subNavIsVisible) {\r\n // Set the class name\r\n elHeader.classList.add(\"rounded-top\");\r\n }\r\n }\r\n // See if we are hiding the sub-navigation\r\n if (!subNavIsVisible) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#sub-navigation\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the navigation\r\n var navProps_2 = this._props.subNavigation || {};\r\n new navigation_1.Navigation({\r\n el: this._props.el.querySelector(\"#sub-navigation\"),\r\n hideFilter: navProps_2.showFilter != null ? !navProps_2.showFilter : true,\r\n hideSearch: navProps_2.showSearch != null ? !navProps_2.showSearch : true,\r\n items: navProps_2.items,\r\n itemsEnd: navProps_2.itemsEnd,\r\n title: navProps_2.title,\r\n onFilterRendered: navProps_2.onFilterRendered,\r\n onRendering: function (props) {\r\n // Set the default classname\r\n props.className = props.className || (\"rounded\" + (!headerIsVisible && !navIsVisible ? \"\" : \"-bottom\"));\r\n props.className = \"sub-nav \" + props.className;\r\n // Set the default type\r\n props.type = typeof (props.type) === \"number\" ? props.type : gd_sprest_bs_1.Components.NavbarTypes.Light;\r\n // Call the rendering event if it exists\r\n navProps_2.onRendering ? navProps_2.onRendering(props) : null;\r\n },\r\n onRendered: navProps_2.onRendered,\r\n onSearch: function (value) {\r\n // See if we are rendering an accordion\r\n if (_this.IsAccordion) {\r\n // Search the accordion\r\n _this._accordion.search(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (_this.IsTiles) {\r\n // Search the tiles\r\n _this._tiles.search(value);\r\n }\r\n else {\r\n // Search the data table\r\n _this._dt.search(value);\r\n }\r\n },\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n },\r\n });\r\n }\r\n // See if we are rendering an accordion\r\n if (this.IsAccordion) {\r\n // Render the accordion\r\n this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector(\"#accordion\") }, this._props.accordion));\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Render the tiles\r\n this._tiles = new tiles_1.Tiles(__assign({ el: this._props.el.querySelector(\"#tiles\") }, this._props.tiles));\r\n }\r\n else {\r\n // Render the data table\r\n this._dt = new table_1.DataTable({\r\n columns: this._props.table ? this._props.table.columns : null,\r\n dtProps: this._props.table ? this._props.table.dtProps : null,\r\n el: this._props.el.querySelector(\"#datatable\"),\r\n onRendered: this._props.table ? this._props.table.onRendered : null,\r\n rows: this._props.table ? this._props.table.rows : null\r\n });\r\n }\r\n // See if we are hiding the footer\r\n if (this._props.hideFooter) {\r\n // Hide the element\r\n this._props.el.querySelector(\"#footer\").classList.add(\"d-none\");\r\n }\r\n else {\r\n // Render the footer\r\n var footer = this._props.footer || {};\r\n new footer_1.Footer({\r\n el: this._props.el.querySelector(\"#footer\"),\r\n items: footer.items,\r\n itemsEnd: footer.itemsEnd,\r\n onRendering: footer.onRendering,\r\n onRendered: footer.onRendered\r\n });\r\n }\r\n };\r\n Object.defineProperty(Dashboard.prototype, \"Datatable\", {\r\n /**\r\n * Component References\r\n */\r\n get: function () { return this._dt; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Filters\", {\r\n get: function () { return this._filters; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"Navigation\", {\r\n get: function () { return this._navigation; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n /**\r\n * Public Interface\r\n */\r\n // Clears the filters\r\n Dashboard.prototype.clearFilter = function () {\r\n // Clear the filters\r\n this._filters.clear();\r\n };\r\n // Filter the table\r\n Dashboard.prototype.filter = function (idx, value, exactMatchFl) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n // Else, see if we are rendering tiles\r\n else if (this.IsTiles) {\r\n // Search the tiles\r\n this._tiles.search(value);\r\n }\r\n else {\r\n // If no value is specified, then we don't want to filter by exact value\r\n exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordion = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(value);\r\n }\r\n };\r\n // Filter the accordion\r\n Dashboard.prototype.filterAccordionMulti = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n //this._accordion.filter(value);\r\n }\r\n };\r\n // Filter the table by multiple values\r\n Dashboard.prototype.filterMulti = function (idx, values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n //this._accordion.filterMulti(value);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Filter the tiles\r\n //this._tiles.filterMulti(value);\r\n }\r\n else {\r\n // Filter the table\r\n this._dt.filterMulti(idx, values);\r\n }\r\n };\r\n // Filter the tiles\r\n Dashboard.prototype.filterTiles = function (value) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(value);\r\n }\r\n };\r\n // Filter the tiles\r\n Dashboard.prototype.filterTilesMulti = function (value) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n //this._tiles.filterMulti(value);\r\n }\r\n };\r\n // Returns a filter checkbox group by its key\r\n Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };\r\n // Returns the current search value\r\n Dashboard.prototype.getSearchValue = function () { return this._navigation ? this._navigation.getSearchValue() : \"\"; };\r\n // Hides the filter\r\n Dashboard.prototype.hideFilter = function () { this._filters.hide(); };\r\n // Refresh the table\r\n Dashboard.prototype.refresh = function (rows) {\r\n // Refresh the table\r\n this._dt.refresh(rows);\r\n // See if a search value exists\r\n var searchValue = this._navigation ? this._navigation.getSearchValue() : \"\";\r\n if (searchValue) {\r\n // Apply the search value\r\n this.search(searchValue);\r\n }\r\n };\r\n // Search the table\r\n Dashboard.prototype.search = function (value) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Search the accordion\r\n this._accordion.search(value);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Search the tiles\r\n this._tiles.search(value);\r\n }\r\n else {\r\n // Search the table\r\n this._dt.search(value);\r\n }\r\n };\r\n // Sets a filter checkbox group value\r\n Dashboard.prototype.setFilterValue = function (key, value) { return this._filters.setFilterValue(key, value); };\r\n // Shows the filter\r\n Dashboard.prototype.showFilter = function () { this._filters.show(); };\r\n return Dashboard;\r\n}());\r\nexports.Dashboard = Dashboard;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/index.js?");
|
|
218
218
|
|
|
219
219
|
/***/ }),
|
|
220
220
|
|
|
@@ -240,6 +240,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
240
240
|
|
|
241
241
|
/***/ }),
|
|
242
242
|
|
|
243
|
+
/***/ "./build/dashboard/tiles.js":
|
|
244
|
+
/*!**********************************!*\
|
|
245
|
+
!*** ./build/dashboard/tiles.js ***!
|
|
246
|
+
\**********************************/
|
|
247
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
248
|
+
|
|
249
|
+
"use strict";
|
|
250
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.Tiles = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.10.98/node_modules/gd-sprest-bs/build/index.js\");\r\n/**\r\n * Tiles\r\n */\r\nvar Tiles = /** @class */ (function () {\r\n // Constructor\r\n function Tiles(props) {\r\n this._tiles = null;\r\n this._activeFilterClass = null;\r\n this._activeSearchFilter = null;\r\n this._pagination = null;\r\n // Save the properties\r\n this._props = props;\r\n // Render the tile\r\n this.render();\r\n }\r\n // Filters the tile\r\n Tiles.prototype.filter = function (value) {\r\n var className = value ? value.toLowerCase().replace(/ /g, \"-\") : null;\r\n this._activeFilterClass = className;\r\n // Parse all tile items\r\n var items = this._props.el.querySelectorAll(\".card\");\r\n for (var i = 0; i < items.length; i++) {\r\n var elItem = items[i];\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n }\r\n // Update the tiles\r\n this.updateTiles();\r\n };\r\n // Renders the dashboard\r\n Tiles.prototype.render = function () {\r\n // Render the tile\r\n this.renderTiles();\r\n // Update the tiles\r\n this.updateTiles();\r\n };\r\n // Renders the tiles\r\n Tiles.prototype.renderTiles = function () {\r\n // Parse the items\r\n var cards = [];\r\n for (var i = 0; i < this._props.items.length; i++) {\r\n var item = this._props.items[i];\r\n var itemClassNames = [];\r\n // Get the filters\r\n var filters = item[this._props.filterField] || [];\r\n filters = filters[\"results\"] || filters;\r\n // See if the filter field is specified\r\n if (this._props.filterField) {\r\n // Parse the selected filters\r\n for (var j = 0; j < filters.length; j++) {\r\n var filter = filters[j].toLowerCase().replace(/ /g, '-');\r\n // Add the filter as a class name\r\n if (filter) {\r\n itemClassNames.push(filter);\r\n }\r\n }\r\n }\r\n // Add an tile\r\n cards.push({\r\n className: itemClassNames.join(\" \"),\r\n body: [{\r\n content: (this._props.bodyField ? item[this._props.bodyField || \"Description\"] : null) || \"\",\r\n data: filters,\r\n subTitle: item[this._props.subTitleField] || \"\",\r\n title: item[this._props.titleField || \"Title\"] || \"\",\r\n onRender: this._props.onCardRender\r\n }]\r\n });\r\n }\r\n // Render the tiles\r\n this._tiles = gd_sprest_bs_1.Components.CardGroup({\r\n el: this._props.el,\r\n cards: cards\r\n });\r\n };\r\n // Updates the visibility of the tiles\r\n Tiles.prototype.updateTiles = function () {\r\n var paginationLimit = this._props.paginationLimit || 10;\r\n // Get the pagination element\r\n var elPagination = this._props.el.querySelector(\".tiles-pagination\");\r\n if (elPagination) {\r\n // Clear the element\r\n while (elPagination.firstChild) {\r\n elPagination.removeChild(elPagination.firstChild);\r\n }\r\n }\r\n else {\r\n // Create the element\r\n elPagination = document.createElement(\"div\");\r\n elPagination.classList.add(\"tiles-pagination\");\r\n this._props.el.appendChild(elPagination);\r\n }\r\n // Get the elements as an array\r\n var elItems = Array.from(this._tiles.el.querySelectorAll(this._activeFilterClass ? \".\" + this._activeFilterClass : \".card\"));\r\n // See if a search value exists\r\n if (this._activeSearchFilter) {\r\n // Parse the items\r\n for (var i = elItems.length - 1; i >= 0; i--) {\r\n var elItem = elItems[i];\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0) {\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n }\r\n }\r\n }\r\n // Parse the active items to show\r\n for (var i = 0; i < paginationLimit; i++) {\r\n var elItem = elItems[i];\r\n // Ensure the item exists\r\n if (elItem) {\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n }\r\n else {\r\n // Set the class for the last item\r\n if (elItems[i - 1]) {\r\n elItems[i - 1].classList.add(\"last-item\");\r\n }\r\n // Break from the loop\r\n break;\r\n }\r\n }\r\n // Parse the active items to hide\r\n for (var i = paginationLimit; i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n }\r\n // Render the pagination\r\n this._pagination = gd_sprest_bs_1.Components.Pagination({\r\n el: elPagination,\r\n className: \"d-flex justify-content-end pt-2\",\r\n numberOfPages: Math.ceil(elItems.length / paginationLimit),\r\n onClick: function (pageNumber) {\r\n // Parse the items\r\n for (var i = 0; i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // Hide the item\r\n elItem.classList.add(\"d-none\");\r\n }\r\n // Parse the items to show\r\n var startIdx = (pageNumber - 1) * paginationLimit;\r\n for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {\r\n var elItem = elItems[i];\r\n // Show the item\r\n elItem.classList.remove(\"d-none\");\r\n }\r\n }\r\n });\r\n };\r\n // Searches the tile\r\n Tiles.prototype.search = function (value) {\r\n // Set the search value\r\n this._activeSearchFilter = (value || \"\").toLowerCase();\r\n // Update the tiles\r\n this.updateTiles();\r\n };\r\n return Tiles;\r\n}());\r\nexports.Tiles = Tiles;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/tiles.js?");
|
|
251
|
+
|
|
252
|
+
/***/ }),
|
|
253
|
+
|
|
243
254
|
/***/ "./build/index.js":
|
|
244
255
|
/*!************************!*\
|
|
245
256
|
!*** ./build/index.js ***!
|