dattatable 2.9.94 → 2.9.97
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/filter.js +1 -1
- package/build/dashboard/index.d.ts +1 -0
- package/build/dashboard/tiles.d.ts +1 -0
- package/build/dashboard/tiles.js +2 -1
- package/dist/dattatable.js +2 -2
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Accordion.html +2 -2
- package/docs/classes/AuditLog.html +2 -2
- package/docs/classes/CanvasForm.html +2 -2
- package/docs/classes/Comments.html +2 -2
- package/docs/classes/Dashboard.html +4 -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 +2 -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 +2 -2
- package/docs/interfaces/IAccordionProps.html +2 -2
- package/docs/interfaces/IAuditLogItem.html +2 -2
- package/docs/interfaces/IAuditLogItemCreation.html +2 -2
- package/docs/interfaces/IAuditLogProps.html +2 -2
- package/docs/interfaces/IAuditLogViewProps.html +2 -2
- package/docs/interfaces/ICommentsItem.html +2 -2
- package/docs/interfaces/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 +2 -2
- package/docs/interfaces/ITilesProps.html +3 -2
- package/docs/variables/DattaTable.html +1 -1
- package/docs/variables/ListSecurityDefaultGroups.html +1 -1
- package/package.json +1 -1
|
@@ -75,7 +75,7 @@ var FilterSlideout = /** @class */ (function () {
|
|
|
75
75
|
// Create the item
|
|
76
76
|
var item = {
|
|
77
77
|
header: filter.header,
|
|
78
|
-
|
|
78
|
+
onRenderBody: function (el) {
|
|
79
79
|
// Render the checkbox group
|
|
80
80
|
_this._cbs.push(gd_sprest_bs_1.Components.CheckboxGroup({
|
|
81
81
|
el: el,
|
|
@@ -86,6 +86,7 @@ export interface IDashboardProps {
|
|
|
86
86
|
onBodyRendered?: (el?: HTMLElement, item?: any) => void;
|
|
87
87
|
onCardRendered?: (el?: HTMLElement, item?: any) => void;
|
|
88
88
|
onCardRendering?: (item?: Components.ICardProps) => void;
|
|
89
|
+
onColumnRendered?: (el?: HTMLElement, item?: any) => void;
|
|
89
90
|
onFooterRendered?: (el?: HTMLElement, item?: any) => void;
|
|
90
91
|
onHeaderRendered?: (el?: HTMLElement, item?: any) => void;
|
|
91
92
|
onPaginationRendered?: (el?: HTMLElement) => void;
|
|
@@ -13,6 +13,7 @@ export interface ITilesProps {
|
|
|
13
13
|
onBodyRendered?: (el?: HTMLElement, item?: any) => void;
|
|
14
14
|
onCardRendered?: (el?: HTMLElement, item?: any) => void;
|
|
15
15
|
onCardRendering?: (item?: Components.ICardProps) => void;
|
|
16
|
+
onColumnRendered?: (el?: HTMLElement, item?: any) => void;
|
|
16
17
|
onFooterRendered?: (el?: HTMLElement, item?: any) => void;
|
|
17
18
|
onHeaderRendered?: (el?: HTMLElement, item?: any) => void;
|
|
18
19
|
onPaginationRendered?: (el?: HTMLElement) => void;
|
package/build/dashboard/tiles.js
CHANGED
|
@@ -171,7 +171,8 @@ var Tiles = /** @class */ (function () {
|
|
|
171
171
|
this._tiles = gd_sprest_bs_1.Components.CardGroup({
|
|
172
172
|
el: this._props.el,
|
|
173
173
|
cards: cards,
|
|
174
|
-
colSize: this._props.colSize
|
|
174
|
+
colSize: this._props.colSize || 4,
|
|
175
|
+
onColRender: this._props.onColumnRendered
|
|
175
176
|
});
|
|
176
177
|
};
|
|
177
178
|
// Updates the visibility of the tiles
|
package/dist/dattatable.js
CHANGED
|
@@ -181,7 +181,7 @@ eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\n
|
|
|
181
181
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
182
182
|
|
|
183
183
|
"use strict";
|
|
184
|
-
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FilterSlideout = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.51/node_modules/gd-sprest-bs/build/index.js\");\r\nvar filter_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/filter */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.51/node_modules/gd-sprest-bs/build/icons/svgs/filter.js\");\r\nvar canvas_1 = __webpack_require__(/*! ../common/canvas */ \"./build/common/canvas.js\");\r\n/**\r\n * Filter Slideout\r\n */\r\nvar FilterSlideout = /** @class */ (function () {\r\n function FilterSlideout(props) {\r\n this._cbs = null;\r\n this._el = null;\r\n this._filters = null;\r\n this._items = null;\r\n // Save the properties\r\n this._filters = props.filters || [];\r\n this._onClear = props.onClear;\r\n this._onFilter = props.onFilter;\r\n // Initialize the variables\r\n this._cbs = [];\r\n this._items = [];\r\n // Generate the items\r\n this.generateFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(this._el) : null;\r\n }\r\n // Generates the filters\r\n FilterSlideout.prototype.generateFilters = function () {\r\n var _this = this;\r\n // Create the filters element\r\n this._el = document.createElement(\"div\");\r\n // Parse the filters\r\n for (var i = 0; i < this._filters.length; i++) {\r\n var fltr = this._filters[i];\r\n // Add the filter\r\n this._items.push(this.generateItem(fltr));\r\n }\r\n // Default the first filter to be displayed\r\n this._items.length > 0 ? this._items[0].showFl = true : null;\r\n // Render an accordion\r\n gd_sprest_bs_1.Components.Accordion({\r\n el: this._el,\r\n items: this._items\r\n });\r\n // Render a clear button\r\n gd_sprest_bs_1.Components.Tooltip({\r\n el: this._el,\r\n content: \"Reset Filters\",\r\n placement: gd_sprest_bs_1.Components.TooltipPlacements.Left,\r\n btnProps: {\r\n className: \"float-end mt-3 p-1 pe-2\",\r\n iconClassName: \"me-1\",\r\n iconType: filter_1.filter,\r\n iconSize: 24,\r\n isSmall: true,\r\n text: \"Reset\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,\r\n onClick: function () {\r\n // Clear the filters\r\n _this.clear();\r\n }\r\n }\r\n });\r\n // Add the dark class if theme is inverted\r\n if (gd_sprest_bs_1.ThemeManager.IsInverted) {\r\n this._el.querySelectorAll(\"div.form-check.form-switch input[type=checkbox].form-check-input\").forEach(function (el) {\r\n el.classList.add(\"dark\");\r\n });\r\n }\r\n };\r\n // Generates the navigation dropdown items\r\n FilterSlideout.prototype.generateItem = function (filter) {\r\n var _this = this;\r\n // Create the item\r\n var item = {\r\n header: filter.header,\r\n
|
|
184
|
+
eval("\r\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\r\nexports.FilterSlideout = void 0;\r\nvar gd_sprest_bs_1 = __webpack_require__(/*! gd-sprest-bs */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.51/node_modules/gd-sprest-bs/build/index.js\");\r\nvar filter_1 = __webpack_require__(/*! gd-sprest-bs/build/icons/svgs/filter */ \"./node_modules/.pnpm/gd-sprest-bs@10.11.51/node_modules/gd-sprest-bs/build/icons/svgs/filter.js\");\r\nvar canvas_1 = __webpack_require__(/*! ../common/canvas */ \"./build/common/canvas.js\");\r\n/**\r\n * Filter Slideout\r\n */\r\nvar FilterSlideout = /** @class */ (function () {\r\n function FilterSlideout(props) {\r\n this._cbs = null;\r\n this._el = null;\r\n this._filters = null;\r\n this._items = null;\r\n // Save the properties\r\n this._filters = props.filters || [];\r\n this._onClear = props.onClear;\r\n this._onFilter = props.onFilter;\r\n // Initialize the variables\r\n this._cbs = [];\r\n this._items = [];\r\n // Generate the items\r\n this.generateFilters();\r\n // Call the render event\r\n props.onRendered ? props.onRendered(this._el) : null;\r\n }\r\n // Generates the filters\r\n FilterSlideout.prototype.generateFilters = function () {\r\n var _this = this;\r\n // Create the filters element\r\n this._el = document.createElement(\"div\");\r\n // Parse the filters\r\n for (var i = 0; i < this._filters.length; i++) {\r\n var fltr = this._filters[i];\r\n // Add the filter\r\n this._items.push(this.generateItem(fltr));\r\n }\r\n // Default the first filter to be displayed\r\n this._items.length > 0 ? this._items[0].showFl = true : null;\r\n // Render an accordion\r\n gd_sprest_bs_1.Components.Accordion({\r\n el: this._el,\r\n items: this._items\r\n });\r\n // Render a clear button\r\n gd_sprest_bs_1.Components.Tooltip({\r\n el: this._el,\r\n content: \"Reset Filters\",\r\n placement: gd_sprest_bs_1.Components.TooltipPlacements.Left,\r\n btnProps: {\r\n className: \"float-end mt-3 p-1 pe-2\",\r\n iconClassName: \"me-1\",\r\n iconType: filter_1.filter,\r\n iconSize: 24,\r\n isSmall: true,\r\n text: \"Reset\",\r\n type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,\r\n onClick: function () {\r\n // Clear the filters\r\n _this.clear();\r\n }\r\n }\r\n });\r\n // Add the dark class if theme is inverted\r\n if (gd_sprest_bs_1.ThemeManager.IsInverted) {\r\n this._el.querySelectorAll(\"div.form-check.form-switch input[type=checkbox].form-check-input\").forEach(function (el) {\r\n el.classList.add(\"dark\");\r\n });\r\n }\r\n };\r\n // Generates the navigation dropdown items\r\n FilterSlideout.prototype.generateItem = function (filter) {\r\n var _this = this;\r\n // Create the item\r\n var item = {\r\n header: filter.header,\r\n onRenderBody: function (el) {\r\n // Render the checkbox group\r\n _this._cbs.push(gd_sprest_bs_1.Components.CheckboxGroup({\r\n el: el,\r\n items: filter.items,\r\n multi: filter.multi,\r\n type: gd_sprest_bs_1.Components.CheckboxGroupTypes.Switch,\r\n onChange: function (selectedCheckboxes) {\r\n // See if this is a single item\r\n if (filter.multi) {\r\n var values = [];\r\n // Parse the items\r\n var items = (selectedCheckboxes || []);\r\n for (var i = 0; i < items.length; i++) {\r\n // Append the value\r\n values.push(items[i].label);\r\n }\r\n // Execute the events\r\n values = filter.onSetFilterValue ? filter.onSetFilterValue(values, selectedCheckboxes) : values;\r\n filter.onFilter ? filter.onFilter(values, item) : null;\r\n _this._onFilter ? _this._onFilter(values, item) : null;\r\n }\r\n else {\r\n var item_1 = selectedCheckboxes;\r\n var filterValue = item_1 ? item_1.label : \"\";\r\n // Execute the events\r\n filterValue = filter.onSetFilterValue ? filter.onSetFilterValue(filterValue, selectedCheckboxes) : filterValue;\r\n filter.onFilter ? filter.onFilter(filterValue, item_1) : null;\r\n _this._onFilter ? _this._onFilter(filterValue, item_1) : null;\r\n }\r\n }\r\n }));\r\n }\r\n };\r\n // Return the item\r\n return item;\r\n };\r\n // Clears the filters\r\n FilterSlideout.prototype.clear = function () {\r\n // Parse the filters\r\n for (var i = 0; i < this._cbs.length; i++) {\r\n // Clear the filter\r\n this._cbs[i].setValue(\"\");\r\n }\r\n // Execute the event\r\n this._onClear ? this._onClear() : null;\r\n };\r\n // Gets a checkbox group by its name\r\n FilterSlideout.prototype.getFilter = function (key) {\r\n // Parse the items\r\n for (var i = 0; i < this._items.length; i++) {\r\n var item = this._items[i];\r\n // See if this is the target\r\n if (item.header == key) {\r\n // Return the checkbox\r\n return this._cbs[i];\r\n }\r\n }\r\n // Not found\r\n return null;\r\n };\r\n // Sets a checkbox group filter\r\n FilterSlideout.prototype.setFilterValue = function (key, value) {\r\n // Get the filter\r\n var filter = this.getFilter(key);\r\n if (filter) {\r\n // Set the value\r\n filter.setValue(value);\r\n }\r\n };\r\n // Hides the filter\r\n FilterSlideout.prototype.hide = function () { canvas_1.CanvasForm.hide(); };\r\n // Shows the filters\r\n FilterSlideout.prototype.show = function () {\r\n // Set the header and body\r\n canvas_1.CanvasForm.setHeader('<h5 class=\"m-0\">Filters</h5>');\r\n canvas_1.CanvasForm.setBody(this._el || \"<p>Loading the Filters...</p>\");\r\n // Show the filters\r\n canvas_1.CanvasForm.show();\r\n };\r\n return FilterSlideout;\r\n}());\r\nexports.FilterSlideout = FilterSlideout;\r\n\n\n//# sourceURL=webpack://dattatable/./build/dashboard/filter.js?");
|
|
185
185
|
|
|
186
186
|
/***/ }),
|
|
187
187
|
|
|
@@ -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.51/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\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.51/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?");
|
|
251
251
|
|
|
252
252
|
/***/ }),
|
|
253
253
|
|