dattatable 2.9.42 → 2.9.44
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 +31 -0
- package/build/dashboard/accordion.js +227 -0
- package/build/dashboard/filter.d.ts +2 -0
- package/build/dashboard/filter.js +3 -0
- package/build/dashboard/index.d.ts +14 -0
- package/build/dashboard/index.js +97 -21
- package/build/lib.d.ts +1 -0
- package/dist/dattatable.js +13 -2
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Accordion.html +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 +10 -6
- package/docs/classes/DataTable.html +3 -3
- package/docs/classes/Documents.html +6 -6
- package/docs/classes/FilterSlideout.html +3 -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/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 +3 -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
|
@@ -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;
|
|
@@ -14,6 +14,7 @@ export interface IFilterItem {
|
|
|
14
14
|
export interface IFilterProps {
|
|
15
15
|
filters: IFilterItem[];
|
|
16
16
|
onClear?: () => void;
|
|
17
|
+
onFilter?: (value: string | string[]) => void;
|
|
17
18
|
onRendered?: (el: HTMLElement) => void;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -25,6 +26,7 @@ export declare class FilterSlideout {
|
|
|
25
26
|
private _filters;
|
|
26
27
|
private _items;
|
|
27
28
|
private _onClear;
|
|
29
|
+
private _onFilter;
|
|
28
30
|
constructor(props: IFilterProps);
|
|
29
31
|
private generateFilters;
|
|
30
32
|
private generateItem;
|
|
@@ -16,6 +16,7 @@ var FilterSlideout = /** @class */ (function () {
|
|
|
16
16
|
// Save the properties
|
|
17
17
|
this._filters = props.filters || [];
|
|
18
18
|
this._onClear = props.onClear;
|
|
19
|
+
this._onFilter = props.onFilter;
|
|
19
20
|
// Initialize the variables
|
|
20
21
|
this._cbs = [];
|
|
21
22
|
this._items = [];
|
|
@@ -93,11 +94,13 @@ var FilterSlideout = /** @class */ (function () {
|
|
|
93
94
|
}
|
|
94
95
|
// Execute the event
|
|
95
96
|
filter.onFilter ? filter.onFilter(values) : null;
|
|
97
|
+
_this._onFilter ? _this._onFilter(values) : null;
|
|
96
98
|
}
|
|
97
99
|
else {
|
|
98
100
|
var item_1 = value;
|
|
99
101
|
// Execute the event
|
|
100
102
|
filter.onFilter ? filter.onFilter(item_1 ? item_1.label : "") : null;
|
|
103
|
+
_this._onFilter ? _this._onFilter(item_1 ? item_1.label : "") : null;
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}));
|
|
@@ -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;
|
|
@@ -85,6 +97,8 @@ export declare class Dashboard {
|
|
|
85
97
|
*/
|
|
86
98
|
clearFilter(): void;
|
|
87
99
|
filter(idx: number, value?: string, exactMatchFl?: boolean): void;
|
|
100
|
+
filterAccordion(value?: string): void;
|
|
101
|
+
filterAccordionMulti(value?: string[]): void;
|
|
88
102
|
filterMulti(idx: number, values?: string[]): void;
|
|
89
103
|
getFilter(key: string): Components.ICheckboxGroup;
|
|
90
104
|
getSearchValue(): string;
|
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;
|
|
@@ -89,12 +104,15 @@ var Dashboard = /** @class */ (function () {
|
|
|
89
104
|
this._filters = new filter_1.FilterSlideout({
|
|
90
105
|
filters: this._props.filters ? this._props.filters.items : [],
|
|
91
106
|
onClear: this._props.filters ? this._props.filters.onClear : null,
|
|
92
|
-
onRendered: this._props.filters ? this._props.filters.onRendered : null
|
|
107
|
+
onRendered: this._props.filters ? this._props.filters.onRendered : null,
|
|
108
|
+
onFilter: !this.IsAccordion ? null : function (value) {
|
|
109
|
+
_this._accordion.filter(value);
|
|
110
|
+
}
|
|
93
111
|
});
|
|
94
112
|
// Render the template
|
|
95
113
|
var elTemplate = document.createElement("div");
|
|
96
114
|
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();
|
|
115
|
+
elTemplate.innerHTML = "\n <div class=\"row\">\n <div id=\"navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"header\" class=\"col mx-75\"></div>\n </div>\n <div class=\"row\">\n <div id=\"sub-navigation\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"".concat(this.IsAccordion ? "accordion" : "datatable", "\" class=\"col\"></div>\n </div>\n <div class=\"row\">\n <div id=\"footer\" class=\"col\"></div>\n </div>").trim();
|
|
98
116
|
this._props.el.appendChild(elTemplate);
|
|
99
117
|
// Set/Default the visibility flags
|
|
100
118
|
var headerIsVisible = (this._props.hideHeader == null || this._props.hideHeader == true) && this._props.header == null ? false : true;
|
|
@@ -126,8 +144,15 @@ var Dashboard = /** @class */ (function () {
|
|
|
126
144
|
},
|
|
127
145
|
onRendered: navProps_1.onRendered,
|
|
128
146
|
onSearch: function (value) {
|
|
129
|
-
//
|
|
130
|
-
_this.
|
|
147
|
+
// See if we are rendering an accordion
|
|
148
|
+
if (_this.IsAccordion) {
|
|
149
|
+
// Search the accordion
|
|
150
|
+
_this._accordion.search(value);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// Search the data table
|
|
154
|
+
_this._dt.search(value);
|
|
155
|
+
}
|
|
131
156
|
},
|
|
132
157
|
onSearchRendered: navProps_1.onSearchRendered,
|
|
133
158
|
onShowFilter: function () {
|
|
@@ -195,8 +220,15 @@ var Dashboard = /** @class */ (function () {
|
|
|
195
220
|
},
|
|
196
221
|
onRendered: navProps_2.onRendered,
|
|
197
222
|
onSearch: function (value) {
|
|
198
|
-
//
|
|
199
|
-
_this.
|
|
223
|
+
// See if we are rendering an accordion
|
|
224
|
+
if (_this.IsAccordion) {
|
|
225
|
+
// Search the accordion
|
|
226
|
+
_this._accordion.search(value);
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
// Search the data table
|
|
230
|
+
_this._dt.search(value);
|
|
231
|
+
}
|
|
200
232
|
},
|
|
201
233
|
onShowFilter: function () {
|
|
202
234
|
// Show the filter
|
|
@@ -204,14 +236,21 @@ var Dashboard = /** @class */ (function () {
|
|
|
204
236
|
},
|
|
205
237
|
});
|
|
206
238
|
}
|
|
207
|
-
//
|
|
208
|
-
this.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
239
|
+
// See if we are rendering an accordion
|
|
240
|
+
if (this.IsAccordion) {
|
|
241
|
+
// Render the accordion
|
|
242
|
+
this._accordion = new accordion_1.Accordion(__assign({ el: this._props.el.querySelector("#accordion") }, this._props.accordion));
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
// Render the data table
|
|
246
|
+
this._dt = new table_1.DataTable({
|
|
247
|
+
columns: this._props.table ? this._props.table.columns : null,
|
|
248
|
+
dtProps: this._props.table ? this._props.table.dtProps : null,
|
|
249
|
+
el: this._props.el.querySelector("#datatable"),
|
|
250
|
+
onRendered: this._props.table ? this._props.table.onRendered : null,
|
|
251
|
+
rows: this._props.table ? this._props.table.rows : null
|
|
252
|
+
});
|
|
253
|
+
}
|
|
215
254
|
// See if we are hiding the footer
|
|
216
255
|
if (this._props.hideFooter) {
|
|
217
256
|
// Hide the element
|
|
@@ -257,14 +296,44 @@ var Dashboard = /** @class */ (function () {
|
|
|
257
296
|
};
|
|
258
297
|
// Filter the table
|
|
259
298
|
Dashboard.prototype.filter = function (idx, value, exactMatchFl) {
|
|
260
|
-
//
|
|
261
|
-
|
|
262
|
-
|
|
299
|
+
// See if we have an accordion
|
|
300
|
+
if (this.IsAccordion) {
|
|
301
|
+
// Filter the accordion
|
|
302
|
+
this._accordion.filter(value);
|
|
303
|
+
}
|
|
304
|
+
// Else, filter the table
|
|
305
|
+
else {
|
|
306
|
+
// If no value is specified, then we don't want to filter by exact value
|
|
307
|
+
exactMatchFl && value ? this._dt.filterExact(idx, value) : this._dt.filter(idx, value);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
// Filter the accordion
|
|
311
|
+
Dashboard.prototype.filterAccordion = function (value) {
|
|
312
|
+
// See if we have an accordion
|
|
313
|
+
if (this.IsAccordion) {
|
|
314
|
+
// Filter the accordion
|
|
315
|
+
this._accordion.filter(value);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
// Filter the accordion
|
|
319
|
+
Dashboard.prototype.filterAccordionMulti = function (value) {
|
|
320
|
+
// See if we have an accordion
|
|
321
|
+
if (this.IsAccordion) {
|
|
322
|
+
// Filter the accordion
|
|
323
|
+
//this._accordion.filter(value);
|
|
324
|
+
}
|
|
263
325
|
};
|
|
264
326
|
// Filter the table by multiple values
|
|
265
327
|
Dashboard.prototype.filterMulti = function (idx, values) {
|
|
266
|
-
//
|
|
267
|
-
this.
|
|
328
|
+
// See if we have an accordion
|
|
329
|
+
if (this.IsAccordion) {
|
|
330
|
+
// Filter the accordion
|
|
331
|
+
//this._accordion.filterMulti(value);
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
// Filter the table
|
|
335
|
+
this._dt.filterMulti(idx, values);
|
|
336
|
+
}
|
|
268
337
|
};
|
|
269
338
|
// Returns a filter checkbox group by its key
|
|
270
339
|
Dashboard.prototype.getFilter = function (key) { return this._filters.getFilter(key); };
|
|
@@ -285,8 +354,15 @@ var Dashboard = /** @class */ (function () {
|
|
|
285
354
|
};
|
|
286
355
|
// Search the table
|
|
287
356
|
Dashboard.prototype.search = function (value) {
|
|
288
|
-
//
|
|
289
|
-
this.
|
|
357
|
+
// See if we have an accordion
|
|
358
|
+
if (this.IsAccordion) {
|
|
359
|
+
// Search the accordion
|
|
360
|
+
this._accordion.search(value);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// Search the table
|
|
364
|
+
this._dt.search(value);
|
|
365
|
+
}
|
|
290
366
|
};
|
|
291
367
|
// Sets a filter checkbox group value
|
|
292
368
|
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;
|