dattatable 2.10.0 → 2.10.1
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.d.ts +2 -0
- package/build/dashboard/accordion.js +16 -6
- package/build/dashboard/index.js +14 -2
- package/build/dashboard/tiles.d.ts +3 -1
- package/build/dashboard/tiles.js +21 -11
- 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 +3 -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 -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 +3 -2
- 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 +3 -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/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/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 -2
- package/docs/interfaces/ITilesProps.html +2 -2
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Components } from "gd-sprest-bs";
|
|
2
2
|
export interface IAccordion {
|
|
3
3
|
filter?: (value: string | string[], item?: Components.ICheckboxGroupItem) => void;
|
|
4
|
+
refresh?: (items: any[]) => void;
|
|
4
5
|
search?: (value: string) => void;
|
|
5
6
|
}
|
|
6
7
|
export interface IAccordionProps {
|
|
@@ -32,6 +33,7 @@ export declare class Accordion implements IAccordion {
|
|
|
32
33
|
private clearItem;
|
|
33
34
|
filter(values?: string[]): void;
|
|
34
35
|
private generateItem;
|
|
36
|
+
refresh(items?: any[]): void;
|
|
35
37
|
private render;
|
|
36
38
|
private renderAccordion;
|
|
37
39
|
private renderItems;
|
|
@@ -15,7 +15,7 @@ var Accordion = /** @class */ (function () {
|
|
|
15
15
|
// Save the properties
|
|
16
16
|
this._props = props;
|
|
17
17
|
// Render the accordion
|
|
18
|
-
this.
|
|
18
|
+
this.refresh(this._props.items);
|
|
19
19
|
}
|
|
20
20
|
// Clears an item
|
|
21
21
|
Accordion.prototype.clearItem = function (elItem) {
|
|
@@ -111,20 +111,30 @@ var Accordion = /** @class */ (function () {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
|
+
// Method to reload the data
|
|
115
|
+
Accordion.prototype.refresh = function (items) {
|
|
116
|
+
if (items === void 0) { items = []; }
|
|
117
|
+
// Clear the datatable element
|
|
118
|
+
while (this._props.el.firstChild) {
|
|
119
|
+
this._props.el.removeChild(this._props.el.firstChild);
|
|
120
|
+
}
|
|
121
|
+
// Render the accordion
|
|
122
|
+
this.render(items);
|
|
123
|
+
};
|
|
114
124
|
// Renders the dashboard
|
|
115
|
-
Accordion.prototype.render = function () {
|
|
125
|
+
Accordion.prototype.render = function (items) {
|
|
116
126
|
// Render the accordion
|
|
117
|
-
this.renderAccordion();
|
|
127
|
+
this.renderAccordion(items);
|
|
118
128
|
// Render the items
|
|
119
129
|
this.renderItems();
|
|
120
130
|
};
|
|
121
131
|
// Renders the accordion
|
|
122
|
-
Accordion.prototype.renderAccordion = function () {
|
|
132
|
+
Accordion.prototype.renderAccordion = function (items) {
|
|
123
133
|
// Parse the items
|
|
124
134
|
var accordionItems = [];
|
|
125
|
-
for (var i = 0; i <
|
|
135
|
+
for (var i = 0; i < items.length; i++) {
|
|
126
136
|
// Add an accordion item
|
|
127
|
-
accordionItems.push(this.generateItem(
|
|
137
|
+
accordionItems.push(this.generateItem(items[i]));
|
|
128
138
|
}
|
|
129
139
|
// Render the accordion
|
|
130
140
|
this._accordion = gd_sprest_bs_1.Components.Accordion({
|
package/build/dashboard/index.js
CHANGED
|
@@ -384,8 +384,20 @@ var Dashboard = /** @class */ (function () {
|
|
|
384
384
|
Dashboard.prototype.hideFilter = function () { this._filters.hide(); };
|
|
385
385
|
// Refresh the table
|
|
386
386
|
Dashboard.prototype.refresh = function (rows) {
|
|
387
|
-
//
|
|
388
|
-
this.
|
|
387
|
+
// See if we have an accordion
|
|
388
|
+
if (this.IsAccordion) {
|
|
389
|
+
// Refresh the table
|
|
390
|
+
this._accordion.refresh(rows);
|
|
391
|
+
}
|
|
392
|
+
// Else, see if we have tiles
|
|
393
|
+
else if (this.IsTiles) {
|
|
394
|
+
// Refresh the table
|
|
395
|
+
this._tiles.refresh(rows);
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
// Refresh the table
|
|
399
|
+
this._dt.refresh(rows);
|
|
400
|
+
}
|
|
389
401
|
// See if a search value exists
|
|
390
402
|
var searchValue = this._navigation ? this._navigation.getSearchValue() : "";
|
|
391
403
|
if (searchValue) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Components } from "gd-sprest-bs";
|
|
2
2
|
export interface ITiles {
|
|
3
3
|
filter?: (value: string | string[], item?: Components.ICheckboxGroupItem) => void;
|
|
4
|
+
refresh?: (items: any[]) => void;
|
|
4
5
|
search?: (value: string) => void;
|
|
5
6
|
}
|
|
6
7
|
export interface ITilesProps {
|
|
@@ -39,8 +40,9 @@ export declare class Tiles implements ITiles {
|
|
|
39
40
|
private _props;
|
|
40
41
|
constructor(props: ITilesProps);
|
|
41
42
|
filter(values?: string[]): void;
|
|
42
|
-
private render;
|
|
43
43
|
private generateCard;
|
|
44
|
+
refresh(items?: any[]): void;
|
|
45
|
+
private render;
|
|
44
46
|
private renderTiles;
|
|
45
47
|
private updateTiles;
|
|
46
48
|
search(value: string): void;
|
package/build/dashboard/tiles.js
CHANGED
|
@@ -15,7 +15,7 @@ var Tiles = /** @class */ (function () {
|
|
|
15
15
|
// Save the properties
|
|
16
16
|
this._props = props;
|
|
17
17
|
// Render the tile
|
|
18
|
-
this.render();
|
|
18
|
+
this.render(this._props.items);
|
|
19
19
|
}
|
|
20
20
|
// Filters the tile
|
|
21
21
|
Tiles.prototype.filter = function (values) {
|
|
@@ -30,13 +30,6 @@ var Tiles = /** @class */ (function () {
|
|
|
30
30
|
// Update the tiles
|
|
31
31
|
this.updateTiles();
|
|
32
32
|
};
|
|
33
|
-
// Renders the dashboard
|
|
34
|
-
Tiles.prototype.render = function () {
|
|
35
|
-
// Render the tile
|
|
36
|
-
this.renderTiles();
|
|
37
|
-
// Update the tiles
|
|
38
|
-
this.updateTiles();
|
|
39
|
-
};
|
|
40
33
|
// Generate the card properties
|
|
41
34
|
Tiles.prototype.generateCard = function (item) {
|
|
42
35
|
var _this = this;
|
|
@@ -158,12 +151,29 @@ var Tiles = /** @class */ (function () {
|
|
|
158
151
|
// Return the card properties
|
|
159
152
|
return cardProps;
|
|
160
153
|
};
|
|
154
|
+
// Method to reload the data
|
|
155
|
+
Tiles.prototype.refresh = function (items) {
|
|
156
|
+
if (items === void 0) { items = []; }
|
|
157
|
+
// Clear the datatable element
|
|
158
|
+
while (this._props.el.firstChild) {
|
|
159
|
+
this._props.el.removeChild(this._props.el.firstChild);
|
|
160
|
+
}
|
|
161
|
+
// Render the accordion
|
|
162
|
+
this.render(items);
|
|
163
|
+
};
|
|
164
|
+
// Renders the dashboard
|
|
165
|
+
Tiles.prototype.render = function (items) {
|
|
166
|
+
// Render the tile
|
|
167
|
+
this.renderTiles(items);
|
|
168
|
+
// Update the tiles
|
|
169
|
+
this.updateTiles();
|
|
170
|
+
};
|
|
161
171
|
// Renders the tiles
|
|
162
|
-
Tiles.prototype.renderTiles = function () {
|
|
172
|
+
Tiles.prototype.renderTiles = function (items) {
|
|
163
173
|
// Parse the items
|
|
164
174
|
var cards = [];
|
|
165
|
-
for (var i = 0; i <
|
|
166
|
-
var item =
|
|
175
|
+
for (var i = 0; i < items.length; i++) {
|
|
176
|
+
var item = items[i];
|
|
167
177
|
// Add an tile
|
|
168
178
|
cards.push(this.generateCard(item));
|
|
169
179
|
}
|
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.11.52/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._activeFilterValue = null;\r\n this._activeSearchValue = 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 (values) {\r\n if (values === void 0) { values = []; }\r\n this._activeFilterValue = values.join('|');\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 }\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Generates the accordion item\r\n Accordion.prototype.generateItem = function (item) {\r\n var _this = this;\r\n var filterValues = [];\r\n // See if the filter field is specified\r\n if (this._props.filterFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.filterFields.length; i++) {\r\n var filterField = this._props.filterFields[i];\r\n // Get the filter values\r\n var filters = item[filterField] || [];\r\n filters = filters[\"results\"] || [filters];\r\n // Append the values\r\n filterValues = filterValues.concat(filters);\r\n }\r\n }\r\n // See if the body fields exist\r\n var bodyContent = this._props.bodyTemplate || \"\";\r\n if (this._props.bodyFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.bodyFields.length; i++) {\r\n var field = this._props.bodyFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.bodyTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n bodyContent = bodyContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n bodyContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var titleContent = this._props.titleTemplate || \"\";\r\n if (this._props.titleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.titleFields.length; i++) {\r\n var field = this._props.titleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.titleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n titleContent = titleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n titleContent += value;\r\n }\r\n }\r\n }\r\n // Return the item\r\n return {\r\n content: bodyContent,\r\n header: titleContent,\r\n onClick: this._props.onItemClick,\r\n onRenderBody: this._props.onItemBodyRender,\r\n onRenderHeader: this._props.onItemHeaderRender,\r\n onRender: function (el, item) {\r\n // See if filters exist\r\n if (filterValues && filterValues.length > 0) {\r\n // Set the data filter value\r\n el.setAttribute(\"data-filter\", filterValues.join('|'));\r\n }\r\n // Call the event\r\n _this._props.onItemRender ? _this._props.onItemRender(el, item) : null;\r\n }\r\n };\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 // Add an accordion item\r\n accordionItems.push(this.generateItem(this._props.items[i]));\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(\".accordion-item\"));\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 there is an active filter\r\n if (this._activeFilterValue) {\r\n var filterValues = (elItem.dataset.filter || \"\").split('|');\r\n // Parse the active filters\r\n var activeFilters = this._activeFilterValue.split('|');\r\n var showItem = false;\r\n for (var j = 0; j < activeFilters.length; j++) {\r\n // See if the item contains the filter value\r\n if (filterValues.indexOf(activeFilters[j]) >= 0) {\r\n // Set the flag and break from the loop\r\n showItem = true;\r\n break;\r\n }\r\n }\r\n // See if we are hiding the item\r\n if (!showItem) {\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 // Continue the loop\r\n continue;\r\n }\r\n }\r\n // See if a search value exists\r\n if (this._activeSearchValue) {\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchValue) < 0 &&\r\n elContent.innerText.toLowerCase().indexOf(this._activeSearchValue) < 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 // Continue the loop\r\n continue;\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 // See if we are showing pagination\r\n var showPagination = typeof (this._props.showPagination) === \"boolean\" ? this._props.showPagination : true;\r\n if (showPagination) {\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 // Call the event\r\n this._props.onPaginationRender ? this._props.onPaginationRender(elPagination) : null;\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._activeSearchValue = (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.11.52/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._activeFilterValue = null;\r\n this._activeSearchValue = null;\r\n this._pagination = null;\r\n // Save the properties\r\n this._props = props;\r\n // Render the accordion\r\n this.refresh(this._props.items);\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 (values) {\r\n if (values === void 0) { values = []; }\r\n this._activeFilterValue = values.join('|');\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 }\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Generates the accordion item\r\n Accordion.prototype.generateItem = function (item) {\r\n var _this = this;\r\n var filterValues = [];\r\n // See if the filter field is specified\r\n if (this._props.filterFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.filterFields.length; i++) {\r\n var filterField = this._props.filterFields[i];\r\n // Get the filter values\r\n var filters = item[filterField] || [];\r\n filters = filters[\"results\"] || [filters];\r\n // Append the values\r\n filterValues = filterValues.concat(filters);\r\n }\r\n }\r\n // See if the body fields exist\r\n var bodyContent = this._props.bodyTemplate || \"\";\r\n if (this._props.bodyFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.bodyFields.length; i++) {\r\n var field = this._props.bodyFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.bodyTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n bodyContent = bodyContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n bodyContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var titleContent = this._props.titleTemplate || \"\";\r\n if (this._props.titleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.titleFields.length; i++) {\r\n var field = this._props.titleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.titleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n titleContent = titleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n titleContent += value;\r\n }\r\n }\r\n }\r\n // Return the item\r\n return {\r\n content: bodyContent,\r\n header: titleContent,\r\n onClick: this._props.onItemClick,\r\n onRenderBody: this._props.onItemBodyRender,\r\n onRenderHeader: this._props.onItemHeaderRender,\r\n onRender: function (el, item) {\r\n // See if filters exist\r\n if (filterValues && filterValues.length > 0) {\r\n // Set the data filter value\r\n el.setAttribute(\"data-filter\", filterValues.join('|'));\r\n }\r\n // Call the event\r\n _this._props.onItemRender ? _this._props.onItemRender(el, item) : null;\r\n }\r\n };\r\n };\r\n // Method to reload the data\r\n Accordion.prototype.refresh = function (items) {\r\n if (items === void 0) { items = []; }\r\n // Clear the datatable element\r\n while (this._props.el.firstChild) {\r\n this._props.el.removeChild(this._props.el.firstChild);\r\n }\r\n // Render the accordion\r\n this.render(items);\r\n };\r\n // Renders the dashboard\r\n Accordion.prototype.render = function (items) {\r\n // Render the accordion\r\n this.renderAccordion(items);\r\n // Render the items\r\n this.renderItems();\r\n };\r\n // Renders the accordion\r\n Accordion.prototype.renderAccordion = function (items) {\r\n // Parse the items\r\n var accordionItems = [];\r\n for (var i = 0; i < items.length; i++) {\r\n // Add an accordion item\r\n accordionItems.push(this.generateItem(items[i]));\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(\".accordion-item\"));\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 there is an active filter\r\n if (this._activeFilterValue) {\r\n var filterValues = (elItem.dataset.filter || \"\").split('|');\r\n // Parse the active filters\r\n var activeFilters = this._activeFilterValue.split('|');\r\n var showItem = false;\r\n for (var j = 0; j < activeFilters.length; j++) {\r\n // See if the item contains the filter value\r\n if (filterValues.indexOf(activeFilters[j]) >= 0) {\r\n // Set the flag and break from the loop\r\n showItem = true;\r\n break;\r\n }\r\n }\r\n // See if we are hiding the item\r\n if (!showItem) {\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 // Continue the loop\r\n continue;\r\n }\r\n }\r\n // See if a search value exists\r\n if (this._activeSearchValue) {\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchValue) < 0 &&\r\n elContent.innerText.toLowerCase().indexOf(this._activeSearchValue) < 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 // Continue the loop\r\n continue;\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 // See if we are showing pagination\r\n var showPagination = typeof (this._props.showPagination) === \"boolean\" ? this._props.showPagination : true;\r\n if (showPagination) {\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 // Call the event\r\n this._props.onPaginationRender ? this._props.onPaginationRender(elPagination) : null;\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._activeSearchValue = (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.11.52/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 Object.defineProperty(Dashboard.prototype, \"IsAccordion\", {\r\n // Determines if we are rendering an accordion\r\n get: function () { return this._props.accordion ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"IsTiles\", {\r\n // Determines if we are rendering tiles\r\n get: function () { return this._props.tiles ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\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 || this.IsTiles ? function (value, item) {\r\n var values = typeof (value) === \"string\" ? [value] : value;\r\n // See if this is an accordion\r\n if (_this.IsAccordion) {\r\n // Filter the accordion\r\n _this._accordion.filter(values, item);\r\n }\r\n else {\r\n // Filter the tiles\r\n _this._tiles.filter(values, item);\r\n }\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 = typeof (this._props.hideHeader) === \"boolean\" ? !this._props.hideHeader : (this._props.header == null ? false : true);\r\n var navIsVisible = typeof (this._props.hideNavigation) === \"boolean\" ? !this._props.hideNavigation : true;\r\n var subNavIsVisible = typeof (this._props.hideSubNavigation) === \"boolean\" ? !this._props.hideSubNavigation : (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(__assign({ el: this._props.el.querySelector(\"#datatable\") }, this._props.table));\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 // Filter the tiles\r\n this._tiles.filter(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 (values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(typeof (values) === \"string\" ? [values] : values);\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.filter(values);\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.filter(values);\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 (values) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(typeof (values) === \"string\" ? [values] : 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, 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?");
|
|
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.11.52/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 Object.defineProperty(Dashboard.prototype, \"IsAccordion\", {\r\n // Determines if we are rendering an accordion\r\n get: function () { return this._props.accordion ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\r\n Object.defineProperty(Dashboard.prototype, \"IsTiles\", {\r\n // Determines if we are rendering tiles\r\n get: function () { return this._props.tiles ? true : false; },\r\n enumerable: false,\r\n configurable: true\r\n });\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 || this.IsTiles ? function (value, item) {\r\n var values = typeof (value) === \"string\" ? [value] : value;\r\n // See if this is an accordion\r\n if (_this.IsAccordion) {\r\n // Filter the accordion\r\n _this._accordion.filter(values, item);\r\n }\r\n else {\r\n // Filter the tiles\r\n _this._tiles.filter(values, item);\r\n }\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 = typeof (this._props.hideHeader) === \"boolean\" ? !this._props.hideHeader : (this._props.header == null ? false : true);\r\n var navIsVisible = typeof (this._props.hideNavigation) === \"boolean\" ? !this._props.hideNavigation : true;\r\n var subNavIsVisible = typeof (this._props.hideSubNavigation) === \"boolean\" ? !this._props.hideSubNavigation : (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(__assign({ el: this._props.el.querySelector(\"#datatable\") }, this._props.table));\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 // Filter the tiles\r\n this._tiles.filter(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 (values) {\r\n // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Filter the accordion\r\n this._accordion.filter(typeof (values) === \"string\" ? [values] : values);\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.filter(values);\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.filter(values);\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 (values) {\r\n // See if we have tiles\r\n if (this.IsTiles) {\r\n // Filter the tiles\r\n this._tiles.filter(typeof (values) === \"string\" ? [values] : 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 // See if we have an accordion\r\n if (this.IsAccordion) {\r\n // Refresh the table\r\n this._accordion.refresh(rows);\r\n }\r\n // Else, see if we have tiles\r\n else if (this.IsTiles) {\r\n // Refresh the table\r\n this._tiles.refresh(rows);\r\n }\r\n else {\r\n // Refresh the table\r\n this._dt.refresh(rows);\r\n }\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
|
|
|
@@ -247,7 +247,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
247
247
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
248
248
|
|
|
249
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.11.52/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._activeFilterValue = null;\r\n this._activeSearchValue = 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 (values) {\r\n if (values === void 0) { values = []; }\r\n this._activeFilterValue = values.join('|');\r\n // Parse all tile\r\n var tiles = this._props.el.querySelectorAll(\".card\");\r\n for (var i = 0; i < tiles.length; i++) {\r\n // Hide the tile\r\n tiles[i].parentElement.classList.add(\"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 // Generate the card properties\r\n Tiles.prototype.generateCard = function (item) {\r\n var _this = this;\r\n var filterValues = [];\r\n // See if the filter field is specified\r\n if (this._props.filterFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.filterFields.length; i++) {\r\n var filterField = this._props.filterFields[i];\r\n // Get the filter values\r\n var filters = item[filterField] || [];\r\n filters = filters[\"results\"] || [filters];\r\n // Append the values\r\n filterValues = filterValues.concat(filters);\r\n }\r\n }\r\n // See if the body fields exist\r\n var bodyContent = this._props.bodyTemplate || \"\";\r\n if (this._props.bodyFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.bodyFields.length; i++) {\r\n var field = this._props.bodyFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.bodyTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n bodyContent = bodyContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n bodyContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var subTitleContent = this._props.subTitleTemplate || \"\";\r\n if (this._props.subTitleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.subTitleFields.length; i++) {\r\n var field = this._props.subTitleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.subTitleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n subTitleContent = subTitleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n subTitleContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var titleContent = this._props.titleTemplate || \"\";\r\n if (this._props.titleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.titleFields.length; i++) {\r\n var field = this._props.titleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.titleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n titleContent = titleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n titleContent += value;\r\n }\r\n }\r\n }\r\n // Set the card props\r\n var cardProps = {\r\n onRender: function (el, card) {\r\n // See if filters exist\r\n if (filterValues && filterValues.length > 0) {\r\n // Set the data filter value\r\n el.setAttribute(\"data-filter\", filterValues.join('|'));\r\n }\r\n // Call the event\r\n _this._props.onCardRendered ? _this._props.onCardRendered(el, card) : null;\r\n },\r\n body: [{\r\n content: bodyContent,\r\n data: item,\r\n subTitle: subTitleContent,\r\n title: titleContent,\r\n onRender: function (el, card) {\r\n var item = card.data;\r\n // Call the events\r\n _this._props.onTitleRendered ? _this._props.onTitleRendered(el.querySelector(\".card-title\"), item) : null;\r\n _this._props.onSubTitleRendered ? _this._props.onSubTitleRendered(el.querySelector(\".card-subtitle\"), item) : null;\r\n _this._props.onBodyRendered ? _this._props.onBodyRendered(el, item) : null;\r\n }\r\n }]\r\n };\r\n // See if we are showing the header\r\n var showHeader = typeof (this._props.showHeader) === \"boolean\" ? this._props.showHeader : true;\r\n if (showHeader) {\r\n cardProps.header = {\r\n onRender: function (el) {\r\n _this._props.onHeaderRendered ? _this._props.onHeaderRendered(el, item) : null;\r\n }\r\n };\r\n }\r\n // See if we are showing the footer\r\n var showFooter = typeof (this._props.showFooter) === \"boolean\" ? this._props.showFooter : true;\r\n if (showFooter) {\r\n cardProps.footer = {\r\n onRender: function (el) {\r\n _this._props.onFooterRendered ? _this._props.onFooterRendered(el, item) : null;\r\n }\r\n };\r\n }\r\n // Call the event\r\n this._props.onCardRendering ? this._props.onCardRendering(cardProps) : null;\r\n // Return the card properties\r\n return cardProps;\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 // Add an tile\r\n cards.push(this.generateCard(item));\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 colSize: this._props.colSize || 4,\r\n onColRender: this._props.onColumnRendered\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(\".card\"));\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 a filter value exists\r\n if (this._activeFilterValue) {\r\n var filterValues = (elItem.dataset.filter || \"\").split('|');\r\n // Parse the active filters\r\n var activeFilters = this._activeFilterValue.split('|');\r\n var showItem = false;\r\n for (var j = 0; j < activeFilters.length; j++) {\r\n // See if the item contains the filter value\r\n if (filterValues.indexOf(activeFilters[j]) >= 0) {\r\n // Set the flag and break from the loop\r\n showItem = true;\r\n break;\r\n }\r\n }\r\n // See if we are hiding the item\r\n if (!showItem) {\r\n // Hide the item\r\n elItem.parentElement.classList.add(\"d-none\");\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n // Continue the loop\r\n continue;\r\n }\r\n }\r\n // See if a search value exists\r\n if (this._activeSearchValue) {\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchValue.toLowerCase()) < 0) {\r\n // Hide the item\r\n elItem.parentElement.classList.add(\"d-none\");\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n // Continue the loop\r\n continue;\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.parentElement.classList.remove(\"d-none\");\r\n }\r\n else {\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.parentElement.classList.add(\"d-none\");\r\n }\r\n // See if we are showing pagination\r\n var showPagination = typeof (this._props.showPagination) === \"boolean\" ? this._props.showPagination : true;\r\n if (showPagination) {\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.parentElement.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.parentElement.classList.remove(\"d-none\");\r\n }\r\n }\r\n });\r\n // Call the event\r\n this._props.onPaginationRendered ? this._props.onPaginationRendered(elPagination) : null;\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._activeSearchValue = value || \"\";\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?");
|
|
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.11.52/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._activeFilterValue = null;\r\n this._activeSearchValue = 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(this._props.items);\r\n }\r\n // Filters the tile\r\n Tiles.prototype.filter = function (values) {\r\n if (values === void 0) { values = []; }\r\n this._activeFilterValue = values.join('|');\r\n // Parse all tile\r\n var tiles = this._props.el.querySelectorAll(\".card\");\r\n for (var i = 0; i < tiles.length; i++) {\r\n // Hide the tile\r\n tiles[i].parentElement.classList.add(\"d-none\");\r\n }\r\n // Update the tiles\r\n this.updateTiles();\r\n };\r\n // Generate the card properties\r\n Tiles.prototype.generateCard = function (item) {\r\n var _this = this;\r\n var filterValues = [];\r\n // See if the filter field is specified\r\n if (this._props.filterFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.filterFields.length; i++) {\r\n var filterField = this._props.filterFields[i];\r\n // Get the filter values\r\n var filters = item[filterField] || [];\r\n filters = filters[\"results\"] || [filters];\r\n // Append the values\r\n filterValues = filterValues.concat(filters);\r\n }\r\n }\r\n // See if the body fields exist\r\n var bodyContent = this._props.bodyTemplate || \"\";\r\n if (this._props.bodyFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.bodyFields.length; i++) {\r\n var field = this._props.bodyFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.bodyTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n bodyContent = bodyContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n bodyContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var subTitleContent = this._props.subTitleTemplate || \"\";\r\n if (this._props.subTitleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.subTitleFields.length; i++) {\r\n var field = this._props.subTitleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.subTitleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n subTitleContent = subTitleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n subTitleContent += value;\r\n }\r\n }\r\n }\r\n // See if the sub-title fields exist\r\n var titleContent = this._props.titleTemplate || \"\";\r\n if (this._props.titleFields) {\r\n // Parse the fields\r\n for (var i = 0; i < this._props.titleFields.length; i++) {\r\n var field = this._props.titleFields[i];\r\n var value = item[field] || \"\";\r\n // See if there is a template\r\n if (this._props.titleTemplate) {\r\n // Replace the values\r\n var pattern = new RegExp(\"({\" + field + \"})\", \"g\");\r\n titleContent = titleContent.replace(pattern, value);\r\n }\r\n else {\r\n // Append the value\r\n titleContent += value;\r\n }\r\n }\r\n }\r\n // Set the card props\r\n var cardProps = {\r\n onRender: function (el, card) {\r\n // See if filters exist\r\n if (filterValues && filterValues.length > 0) {\r\n // Set the data filter value\r\n el.setAttribute(\"data-filter\", filterValues.join('|'));\r\n }\r\n // Call the event\r\n _this._props.onCardRendered ? _this._props.onCardRendered(el, card) : null;\r\n },\r\n body: [{\r\n content: bodyContent,\r\n data: item,\r\n subTitle: subTitleContent,\r\n title: titleContent,\r\n onRender: function (el, card) {\r\n var item = card.data;\r\n // Call the events\r\n _this._props.onTitleRendered ? _this._props.onTitleRendered(el.querySelector(\".card-title\"), item) : null;\r\n _this._props.onSubTitleRendered ? _this._props.onSubTitleRendered(el.querySelector(\".card-subtitle\"), item) : null;\r\n _this._props.onBodyRendered ? _this._props.onBodyRendered(el, item) : null;\r\n }\r\n }]\r\n };\r\n // See if we are showing the header\r\n var showHeader = typeof (this._props.showHeader) === \"boolean\" ? this._props.showHeader : true;\r\n if (showHeader) {\r\n cardProps.header = {\r\n onRender: function (el) {\r\n _this._props.onHeaderRendered ? _this._props.onHeaderRendered(el, item) : null;\r\n }\r\n };\r\n }\r\n // See if we are showing the footer\r\n var showFooter = typeof (this._props.showFooter) === \"boolean\" ? this._props.showFooter : true;\r\n if (showFooter) {\r\n cardProps.footer = {\r\n onRender: function (el) {\r\n _this._props.onFooterRendered ? _this._props.onFooterRendered(el, item) : null;\r\n }\r\n };\r\n }\r\n // Call the event\r\n this._props.onCardRendering ? this._props.onCardRendering(cardProps) : null;\r\n // Return the card properties\r\n return cardProps;\r\n };\r\n // Method to reload the data\r\n Tiles.prototype.refresh = function (items) {\r\n if (items === void 0) { items = []; }\r\n // Clear the datatable element\r\n while (this._props.el.firstChild) {\r\n this._props.el.removeChild(this._props.el.firstChild);\r\n }\r\n // Render the accordion\r\n this.render(items);\r\n };\r\n // Renders the dashboard\r\n Tiles.prototype.render = function (items) {\r\n // Render the tile\r\n this.renderTiles(items);\r\n // Update the tiles\r\n this.updateTiles();\r\n };\r\n // Renders the tiles\r\n Tiles.prototype.renderTiles = function (items) {\r\n // Parse the items\r\n var cards = [];\r\n for (var i = 0; i < items.length; i++) {\r\n var item = items[i];\r\n // Add an tile\r\n cards.push(this.generateCard(item));\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 colSize: this._props.colSize || 4,\r\n onColRender: this._props.onColumnRendered\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(\".card\"));\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 a filter value exists\r\n if (this._activeFilterValue) {\r\n var filterValues = (elItem.dataset.filter || \"\").split('|');\r\n // Parse the active filters\r\n var activeFilters = this._activeFilterValue.split('|');\r\n var showItem = false;\r\n for (var j = 0; j < activeFilters.length; j++) {\r\n // See if the item contains the filter value\r\n if (filterValues.indexOf(activeFilters[j]) >= 0) {\r\n // Set the flag and break from the loop\r\n showItem = true;\r\n break;\r\n }\r\n }\r\n // See if we are hiding the item\r\n if (!showItem) {\r\n // Hide the item\r\n elItem.parentElement.classList.add(\"d-none\");\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n // Continue the loop\r\n continue;\r\n }\r\n }\r\n // See if a search value exists\r\n if (this._activeSearchValue) {\r\n // See if the item doesn't contains the search value\r\n if (elItem.innerText.toLowerCase().indexOf(this._activeSearchValue.toLowerCase()) < 0) {\r\n // Hide the item\r\n elItem.parentElement.classList.add(\"d-none\");\r\n // Exclude the item from the array\r\n elItems.splice(i, 1);\r\n // Continue the loop\r\n continue;\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.parentElement.classList.remove(\"d-none\");\r\n }\r\n else {\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.parentElement.classList.add(\"d-none\");\r\n }\r\n // See if we are showing pagination\r\n var showPagination = typeof (this._props.showPagination) === \"boolean\" ? this._props.showPagination : true;\r\n if (showPagination) {\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.parentElement.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.parentElement.classList.remove(\"d-none\");\r\n }\r\n }\r\n });\r\n // Call the event\r\n this._props.onPaginationRendered ? this._props.onPaginationRendered(elPagination) : null;\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._activeSearchValue = value || \"\";\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
251
|
|
|
252
252
|
/***/ }),
|
|
253
253
|
|