dattatable 2.9.41 → 2.9.43
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/common/listSecurity.d.ts +1 -1
- package/build/dashboard/accordion.d.ts +31 -0
- package/build/dashboard/accordion.js +227 -0
- package/build/dashboard/index.d.ts +12 -0
- package/build/dashboard/index.js +59 -16
- package/build/lib.d.ts +1 -0
- package/dist/dattatable.js +12 -1
- 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 +14 -0
- 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 -6
- 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 +3 -3
- package/docs/classes/LoadingDialog.html +2 -2
- package/docs/classes/Modal.html +2 -2
- package/docs/classes/Navigation.html +3 -3
- 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 +3 -0
- package/docs/interfaces/IAccordionProps.html +9 -0
- 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/modules.html +6 -3
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ export declare class ListSecurity {
|
|
|
39
39
|
private removeUser;
|
|
40
40
|
constructor(props: IListSecurity);
|
|
41
41
|
addToGroup(userId: number, groupName: string): PromiseLike<void>;
|
|
42
|
-
|
|
42
|
+
checkUserPermissions(): PromiseLike<boolean>;
|
|
43
43
|
private configureList;
|
|
44
44
|
private configureLists;
|
|
45
45
|
private createGroups;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface IAccordion {
|
|
2
|
+
filter?: (string: any) => void;
|
|
3
|
+
search?: (value: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface IAccordionProps {
|
|
6
|
+
bodyField?: string;
|
|
7
|
+
el: HTMLElement;
|
|
8
|
+
filterField?: string;
|
|
9
|
+
items: any[];
|
|
10
|
+
onItemClick?: (el?: HTMLElement, item?: any) => void;
|
|
11
|
+
onItemRender?: (el?: HTMLElement, item?: any) => void;
|
|
12
|
+
paginationLimit?: number;
|
|
13
|
+
titleField?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Accordion
|
|
17
|
+
*/
|
|
18
|
+
export declare class Accordion implements IAccordion {
|
|
19
|
+
private _accordion;
|
|
20
|
+
private _activeFilterClass;
|
|
21
|
+
private _activeSearchFilter;
|
|
22
|
+
private _pagination;
|
|
23
|
+
private _props;
|
|
24
|
+
constructor(props: IAccordionProps);
|
|
25
|
+
private clearItem;
|
|
26
|
+
filter(value: string): void;
|
|
27
|
+
private render;
|
|
28
|
+
private renderAccordion;
|
|
29
|
+
private renderItems;
|
|
30
|
+
search(value: string): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Accordion = void 0;
|
|
4
|
+
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
|
+
/**
|
|
6
|
+
* Accordion
|
|
7
|
+
*/
|
|
8
|
+
var Accordion = /** @class */ (function () {
|
|
9
|
+
// Constructor
|
|
10
|
+
function Accordion(props) {
|
|
11
|
+
this._accordion = null;
|
|
12
|
+
this._activeFilterClass = null;
|
|
13
|
+
this._activeSearchFilter = null;
|
|
14
|
+
this._pagination = null;
|
|
15
|
+
// Save the properties
|
|
16
|
+
this._props = props;
|
|
17
|
+
// Render the accordion
|
|
18
|
+
this.render();
|
|
19
|
+
}
|
|
20
|
+
// Clears an item
|
|
21
|
+
Accordion.prototype.clearItem = function (elItem) {
|
|
22
|
+
// Hide the item
|
|
23
|
+
elItem.classList.add("d-none");
|
|
24
|
+
// Remove the first/last item classes
|
|
25
|
+
elItem.classList.remove("first-item");
|
|
26
|
+
elItem.classList.remove("last-item");
|
|
27
|
+
};
|
|
28
|
+
// Filters the accordion
|
|
29
|
+
Accordion.prototype.filter = function (value) {
|
|
30
|
+
var className = value ? value.toLowerCase().replace(/ /g, "-") : null;
|
|
31
|
+
this._activeFilterClass = className;
|
|
32
|
+
// Parse all accordion items
|
|
33
|
+
var items = this._props.el.querySelectorAll(".accordion-item");
|
|
34
|
+
for (var i = 0; i < items.length; i++) {
|
|
35
|
+
var elItem = items[i];
|
|
36
|
+
// Show the item
|
|
37
|
+
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
|
+
}
|
|
50
|
+
// Render the items
|
|
51
|
+
this.renderItems();
|
|
52
|
+
};
|
|
53
|
+
// Renders the dashboard
|
|
54
|
+
Accordion.prototype.render = function () {
|
|
55
|
+
// Render the accordion
|
|
56
|
+
this.renderAccordion();
|
|
57
|
+
// Render the items
|
|
58
|
+
this.renderItems();
|
|
59
|
+
};
|
|
60
|
+
// Renders the accordion
|
|
61
|
+
Accordion.prototype.renderAccordion = function () {
|
|
62
|
+
// Parse the items
|
|
63
|
+
var accordionItems = [];
|
|
64
|
+
for (var i = 0; i < this._props.items.length; i++) {
|
|
65
|
+
var item = this._props.items[i];
|
|
66
|
+
var itemClassNames = [];
|
|
67
|
+
// See if the filter field is specified
|
|
68
|
+
if (this._props.filterField) {
|
|
69
|
+
// Parse the selected filters
|
|
70
|
+
var filters = item[this._props.filterField] || [];
|
|
71
|
+
filters = filters["results"] || filters;
|
|
72
|
+
for (var j = 0; j < filters.length; j++) {
|
|
73
|
+
var filter = filters[j].toLowerCase().replace(/ /g, '-');
|
|
74
|
+
// Add the filter as a class name
|
|
75
|
+
if (filter) {
|
|
76
|
+
itemClassNames.push(filter);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Add an accordion item
|
|
81
|
+
accordionItems.push({
|
|
82
|
+
className: itemClassNames.join(" "),
|
|
83
|
+
content: (this._props.bodyField ? item[this._props.bodyField || "Description"] : null) || "",
|
|
84
|
+
header: item[this._props.titleField || "Title"] || "",
|
|
85
|
+
onClick: this._props.onItemClick,
|
|
86
|
+
onRender: this._props.onItemRender,
|
|
87
|
+
showFl: i == 0,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Render the accordion
|
|
91
|
+
this._accordion = gd_sprest_bs_1.Components.Accordion({
|
|
92
|
+
el: this._props.el,
|
|
93
|
+
id: "accordion-list",
|
|
94
|
+
items: accordionItems
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
// Renders the items
|
|
98
|
+
Accordion.prototype.renderItems = function () {
|
|
99
|
+
var _this = this;
|
|
100
|
+
var paginationLimit = this._props.paginationLimit || 10;
|
|
101
|
+
// Get the pagination element
|
|
102
|
+
var elPagination = this._props.el.querySelector(".accordion-pagination");
|
|
103
|
+
if (elPagination) {
|
|
104
|
+
// Clear the element
|
|
105
|
+
while (elPagination.firstChild) {
|
|
106
|
+
elPagination.removeChild(elPagination.firstChild);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
// Create the element
|
|
111
|
+
elPagination = document.createElement("div");
|
|
112
|
+
elPagination.classList.add("accordion-pagination");
|
|
113
|
+
this._props.el.appendChild(elPagination);
|
|
114
|
+
}
|
|
115
|
+
// Get the elements as an array
|
|
116
|
+
var elItems = Array.from(this._accordion.el.querySelectorAll(this._activeFilterClass ? "." + this._activeFilterClass : ".accordion-item"));
|
|
117
|
+
// See if a search value exists
|
|
118
|
+
if (this._activeSearchFilter) {
|
|
119
|
+
// Parse the items
|
|
120
|
+
for (var i = elItems.length - 1; i >= 0; i--) {
|
|
121
|
+
var elItem = elItems[i];
|
|
122
|
+
var elContent = elItem.querySelector(".accordion-body");
|
|
123
|
+
// See if this item is expanded
|
|
124
|
+
if (elItem.querySelector(".accordion-collapse.show")) {
|
|
125
|
+
// Collapse the item
|
|
126
|
+
var btn = elItem.querySelector(".accordion-button");
|
|
127
|
+
btn === null || btn === void 0 ? void 0 : btn.click();
|
|
128
|
+
}
|
|
129
|
+
// See if the item doesn't contains the search value
|
|
130
|
+
if (elItem.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0 &&
|
|
131
|
+
elContent.innerText.toLowerCase().indexOf(this._activeSearchFilter) < 0) {
|
|
132
|
+
// Clear the item
|
|
133
|
+
this.clearItem(elItem);
|
|
134
|
+
// Exclude the item from the array
|
|
135
|
+
elItems.splice(i, 1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Parse the active items to show
|
|
140
|
+
for (var i = 0; i < paginationLimit; i++) {
|
|
141
|
+
var elItem = elItems[i];
|
|
142
|
+
// Ensure the item exists
|
|
143
|
+
if (elItem) {
|
|
144
|
+
// Show the item
|
|
145
|
+
elItem.classList.remove("d-none");
|
|
146
|
+
// See if this is the first item
|
|
147
|
+
if (i == 0) {
|
|
148
|
+
elItem.classList.add("first-item");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
// Set the class for the last item
|
|
153
|
+
if (elItems[i - 1]) {
|
|
154
|
+
elItems[i - 1].classList.add("last-item");
|
|
155
|
+
}
|
|
156
|
+
// Break from the loop
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Parse the active items to hide
|
|
161
|
+
for (var i = paginationLimit; i < elItems.length; i++) {
|
|
162
|
+
// Clear the item
|
|
163
|
+
this.clearItem(elItems[i]);
|
|
164
|
+
}
|
|
165
|
+
// Ensure items exist
|
|
166
|
+
if (elItems.length > 0) {
|
|
167
|
+
// Ensure the first item is expanded
|
|
168
|
+
if (elItems[0].querySelector(".accordion-collapse.show") == null) {
|
|
169
|
+
// Hide the button
|
|
170
|
+
var btn = elItems[0].querySelector(".accordion-button");
|
|
171
|
+
btn === null || btn === void 0 ? void 0 : btn.click();
|
|
172
|
+
}
|
|
173
|
+
// Set the first item class
|
|
174
|
+
elItems[0].classList.add("first-item");
|
|
175
|
+
// Set the last item class
|
|
176
|
+
var lastIdx = paginationLimit - 1;
|
|
177
|
+
elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add("last-item");
|
|
178
|
+
}
|
|
179
|
+
// Render the pagination
|
|
180
|
+
this._pagination = gd_sprest_bs_1.Components.Pagination({
|
|
181
|
+
el: elPagination,
|
|
182
|
+
className: "d-flex justify-content-end pt-2",
|
|
183
|
+
numberOfPages: Math.ceil(elItems.length / paginationLimit),
|
|
184
|
+
onClick: function (pageNumber) {
|
|
185
|
+
// Parse the items
|
|
186
|
+
for (var i = 0; i < elItems.length; i++) {
|
|
187
|
+
var elItem = elItems[i];
|
|
188
|
+
// See if this item is expanded
|
|
189
|
+
if (elItem.querySelector(".accordion-collapse.show")) {
|
|
190
|
+
// Hide the button
|
|
191
|
+
var btn = elItem.querySelector(".accordion-button");
|
|
192
|
+
btn === null || btn === void 0 ? void 0 : btn.click();
|
|
193
|
+
}
|
|
194
|
+
// Clear the item
|
|
195
|
+
_this.clearItem(elItem);
|
|
196
|
+
}
|
|
197
|
+
// Parse the items to show
|
|
198
|
+
var startIdx = (pageNumber - 1) * paginationLimit;
|
|
199
|
+
for (var i = startIdx; i < startIdx + paginationLimit && i < elItems.length; i++) {
|
|
200
|
+
var elItem = elItems[i];
|
|
201
|
+
// Show the item
|
|
202
|
+
elItem.classList.remove("d-none");
|
|
203
|
+
// See if this is the first item
|
|
204
|
+
if (i == startIdx) {
|
|
205
|
+
// Set the first item class
|
|
206
|
+
elItem.classList.add("first-item");
|
|
207
|
+
// Expand the item
|
|
208
|
+
var btn = elItem.querySelector(".accordion-button");
|
|
209
|
+
btn === null || btn === void 0 ? void 0 : btn.click();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Set the last item class
|
|
213
|
+
var lastIdx = startIdx + paginationLimit - 1;
|
|
214
|
+
elItems[lastIdx < elItems.length ? lastIdx : elItems.length - 1].classList.add("last-item");
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
// Searches the accordion
|
|
219
|
+
Accordion.prototype.search = function (value) {
|
|
220
|
+
// Set the search value
|
|
221
|
+
this._activeSearchFilter = (value || "").toLowerCase();
|
|
222
|
+
// Render the items
|
|
223
|
+
this.renderItems();
|
|
224
|
+
};
|
|
225
|
+
return Accordion;
|
|
226
|
+
}());
|
|
227
|
+
exports.Accordion = Accordion;
|
|
@@ -2,12 +2,22 @@ import { Components } from "gd-sprest-bs";
|
|
|
2
2
|
import { FilterSlideout, IFilterItem } from "./filter";
|
|
3
3
|
import { Navigation } from "./navigation";
|
|
4
4
|
import { IDataTable } from "./table";
|
|
5
|
+
export * from "./accordion";
|
|
5
6
|
export * from "./filter";
|
|
6
7
|
export * from "./footer";
|
|
7
8
|
export * from "./header";
|
|
8
9
|
export * from "./navigation";
|
|
9
10
|
export * from "./table";
|
|
10
11
|
export interface IDashboardProps {
|
|
12
|
+
accordion?: {
|
|
13
|
+
bodyField?: string;
|
|
14
|
+
filterField?: string;
|
|
15
|
+
items: any[];
|
|
16
|
+
onItemClick?: (el?: HTMLElement, item?: any) => void;
|
|
17
|
+
onItemRender?: (el?: HTMLElement, item?: any) => void;
|
|
18
|
+
paginationLimit?: number;
|
|
19
|
+
titleField?: string;
|
|
20
|
+
};
|
|
11
21
|
el: HTMLElement;
|
|
12
22
|
footer?: {
|
|
13
23
|
items?: Components.INavbarItem[];
|
|
@@ -67,10 +77,12 @@ export interface IDashboardProps {
|
|
|
67
77
|
* Dashboard
|
|
68
78
|
*/
|
|
69
79
|
export declare class Dashboard {
|
|
80
|
+
private _accordion;
|
|
70
81
|
private _dt;
|
|
71
82
|
private _filters;
|
|
72
83
|
private _navigation;
|
|
73
84
|
private _props;
|
|
85
|
+
private IsAccordion;
|
|
74
86
|
constructor(props: IDashboardProps);
|
|
75
87
|
private applyFilters;
|
|
76
88
|
private render;
|
package/build/dashboard/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -17,12 +28,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
28
|
exports.Dashboard = void 0;
|
|
18
29
|
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
19
30
|
var common_1 = require("../common");
|
|
31
|
+
var accordion_1 = require("./accordion");
|
|
20
32
|
var filter_1 = require("./filter");
|
|
21
33
|
var footer_1 = require("./footer");
|
|
22
34
|
var header_1 = require("./header");
|
|
23
35
|
var navigation_1 = require("./navigation");
|
|
24
36
|
var table_1 = require("./table");
|
|
25
37
|
// Export the components
|
|
38
|
+
__exportStar(require("./accordion"), exports);
|
|
26
39
|
__exportStar(require("./filter"), exports);
|
|
27
40
|
__exportStar(require("./footer"), exports);
|
|
28
41
|
__exportStar(require("./header"), exports);
|
|
@@ -35,6 +48,7 @@ var Dashboard = /** @class */ (function () {
|
|
|
35
48
|
// Constructor
|
|
36
49
|
function Dashboard(props) {
|
|
37
50
|
var _this = this;
|
|
51
|
+
this._accordion = null;
|
|
38
52
|
this._dt = null;
|
|
39
53
|
this._filters = null;
|
|
40
54
|
this._navigation = null;
|
|
@@ -53,6 +67,7 @@ var Dashboard = /** @class */ (function () {
|
|
|
53
67
|
props.onRendered ? props.onRendered(_this._props.el) : null;
|
|
54
68
|
}, 10);
|
|
55
69
|
}
|
|
70
|
+
Dashboard.prototype.IsAccordion = function () { return this._props.accordion ? true : false; };
|
|
56
71
|
// Applies the default active filters
|
|
57
72
|
Dashboard.prototype.applyFilters = function () {
|
|
58
73
|
var _a;
|
|
@@ -94,7 +109,7 @@ var Dashboard = /** @class */ (function () {
|
|
|
94
109
|
// Render the template
|
|
95
110
|
var elTemplate = document.createElement("div");
|
|
96
111
|
elTemplate.classList.add("dashboard");
|
|
97
|
-
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=\"datatable\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"footer\" class=\"col\"></div>\n </div>".trim();
|
|
112
|
+
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();
|
|
98
113
|
this._props.el.appendChild(elTemplate);
|
|
99
114
|
// Set/Default the visibility flags
|
|
100
115
|
var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;
|
|
@@ -204,14 +219,21 @@ var Dashboard = /** @class */ (function () {
|
|
|
204
219
|
},
|
|
205
220
|
});
|
|
206
221
|
}
|
|
207
|
-
//
|
|
208
|
-
this.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
222
|
+
// See if we are rendering an accordion
|
|
223
|
+
if (this.IsAccordion) {
|
|
224
|
+
// Render the accordion
|
|
225
|
+
this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el }, this._props.accordion));
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
// Render the data table
|
|
229
|
+
this._dt = new table_1.DataTable({
|
|
230
|
+
columns: this._props.table ? this._props.table.columns : null,
|
|
231
|
+
dtProps: this._props.table ? this._props.table.dtProps : null,
|
|
232
|
+
el: this._props.el.querySelector("#datatable"),
|
|
233
|
+
onRendered: this._props.table ? this._props.table.onRendered : null,
|
|
234
|
+
rows: this._props.table ? this._props.table.rows : null
|
|
235
|
+
});
|
|
236
|
+
}
|
|
215
237
|
// See if we are hiding the footer
|
|
216
238
|
if (this._props.hideFooter) {
|
|
217
239
|
// Hide the element
|
|
@@ -257,14 +279,28 @@ var Dashboard = /** @class */ (function () {
|
|
|
257
279
|
};
|
|
258
280
|
// Filter the table
|
|
259
281
|
Dashboard.prototype.filter = function (idx, value, exactMatchFl) {
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
|
|
282
|
+
// See if we have an accordion
|
|
283
|
+
if (this.IsAccordion) {
|
|
284
|
+
// Filter the accordion
|
|
285
|
+
this._accordion.filter(value);
|
|
286
|
+
}
|
|
287
|
+
// Else, filter the table
|
|
288
|
+
else {
|
|
289
|
+
// If no value is specified, then we don't want to filter by exact value
|
|
290
|
+
exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);
|
|
291
|
+
}
|
|
263
292
|
};
|
|
264
293
|
// Filter the table by multiple values
|
|
265
294
|
Dashboard.prototype.filterMulti = function (idx, values) {
|
|
266
|
-
//
|
|
267
|
-
this.
|
|
295
|
+
// See if we have an accordion
|
|
296
|
+
if (this.IsAccordion) {
|
|
297
|
+
// Filter the accordion
|
|
298
|
+
//this._accordion.filterMulti(value);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
// Filter the table
|
|
302
|
+
this._dt.filterMulti(idx, values);
|
|
303
|
+
}
|
|
268
304
|
};
|
|
269
305
|
// Returns a filter checkbox group by its key
|
|
270
306
|
Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };
|
|
@@ -285,8 +321,15 @@ var Dashboard = /** @class */ (function () {
|
|
|
285
321
|
};
|
|
286
322
|
// Search the table
|
|
287
323
|
Dashboard.prototype.search = function (value) {
|
|
288
|
-
//
|
|
289
|
-
this.
|
|
324
|
+
// See if we have an accordion
|
|
325
|
+
if (this.IsAccordion) {
|
|
326
|
+
// Search the accordion
|
|
327
|
+
this._accordion.search(value);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
// Search the table
|
|
331
|
+
this._dt.search(value);
|
|
332
|
+
}
|
|
290
333
|
};
|
|
291
334
|
// Sets a filter checkbox group value
|
|
292
335
|
Dashboard.prototype.setFilterValue = function (key, value) { return this._filters.setFilterValue(key, value); };
|
package/build/lib.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import * as AuditLog from "./auditLog";
|
|
|
6
6
|
import * as Dashboard from "./dashboard";
|
|
7
7
|
export declare const DattaTable: {
|
|
8
8
|
Dashboard: typeof Dashboard.Dashboard;
|
|
9
|
+
Accordion: typeof Dashboard.Accordion;
|
|
9
10
|
FilterSlideout: typeof Dashboard.FilterSlideout;
|
|
10
11
|
Footer: typeof Dashboard.Footer;
|
|
11
12
|
Header: typeof Dashboard.Header;
|
package/dist/dattatable.js
CHANGED
|
@@ -163,6 +163,17 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
163
163
|
|
|
164
164
|
/***/ }),
|
|
165
165
|
|
|
166
|
+
/***/ "./build/dashboard/accordion.js":
|
|
167
|
+
/*!**************************************!*\
|
|
168
|
+
!*** ./build/dashboard/accordion.js ***!
|
|
169
|
+
\**************************************/
|
|
170
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
171
|
+
|
|
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?");
|
|
174
|
+
|
|
175
|
+
/***/ }),
|
|
176
|
+
|
|
166
177
|
/***/ "./build/dashboard/filter.js":
|
|
167
178
|
/*!***********************************!*\
|
|
168
179
|
!*** ./build/dashboard/filter.js ***!
|
|
@@ -203,7 +214,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
203
214
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
204
215
|
|
|
205
216
|
"use strict";
|
|
206
|
-
eval("\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 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__(/*! ./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._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 // 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 });\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=\\\"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 // Search the data table\r\n _this._dt.search(value);\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 // Search the data table\r\n _this._dt.search(value);\r\n },\r\n onShowFilter: function () {\r\n // Show the filter\r\n _this._filters.show();\r\n },\r\n });\r\n }\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 // 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 // Filter the table\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 // Filter the table by multiple values\r\n Dashboard.prototype.filterMulti = function (idx, values) {\r\n // Filter the table\r\n this._dt.filterMulti(idx, values);\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 // Search the table\r\n this._dt.search(value);\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\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 });\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 // Search the data table\r\n _this._dt.search(value);\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 // Search the data table\r\n _this._dt.search(value);\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 }, 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 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?");
|
|
207
218
|
|
|
208
219
|
/***/ }),
|
|
209
220
|
|