@sd-angular/core 1.0.43 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/scss/core/toastr.scss +1 -0
- package/bundles/sd-angular-core-autocomplete.umd.js +2 -0
- package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
- package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js +380 -293
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.js +15 -6
- package/bundles/sd-angular-core-notify.umd.js.map +1 -1
- package/bundles/sd-angular-core-notify.umd.min.js +2 -2
- package/bundles/sd-angular-core-notify.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-popover.umd.js +704 -0
- package/bundles/sd-angular-core-popover.umd.js.map +1 -0
- package/bundles/sd-angular-core-popover.umd.min.js +16 -0
- package/bundles/sd-angular-core-popover.umd.min.js.map +1 -0
- package/bundles/sd-angular-core.umd.js +12 -4
- package/bundles/sd-angular-core.umd.js.map +1 -1
- package/bundles/sd-angular-core.umd.min.js +1 -1
- package/bundles/sd-angular-core.umd.min.js.map +1 -1
- package/esm2015/autocomplete/src/lib/autocomplete.component.js +3 -1
- package/esm2015/grid-material/sd-angular-core-grid-material.js +5 -5
- package/esm2015/grid-material/src/lib/components/desktop-cell-children-view/desktop-cell-children-view.component.js +2 -2
- package/esm2015/grid-material/src/lib/grid-material.component.js +21 -22
- package/esm2015/grid-material/src/lib/grid-material.module.js +2 -1
- package/esm2015/grid-material/src/lib/models/grid-column.model.js +1 -1
- package/esm2015/grid-material/src/lib/models/grid.model.js +1 -1
- package/esm2015/grid-material/src/lib/pipes/cell-view.pipe.js +8 -9
- package/esm2015/grid-material/src/lib/pipes/column-badge.pipe.js +1 -1
- package/esm2015/grid-material/src/lib/pipes/column-values.pipe.js +34 -12
- package/esm2015/grid-material/src/lib/services/grid.service.js +2 -2
- package/esm2015/notify/src/lib/notify.service.js +18 -9
- package/esm2015/popover/index.js +2 -0
- package/esm2015/popover/sd-angular-core-popover.js +5 -0
- package/esm2015/popover/src/lib/directives/popover-trigger.directive.js +218 -0
- package/esm2015/popover/src/lib/popover/popover.component.js +122 -0
- package/esm2015/popover/src/lib/popover.model.js +2 -0
- package/esm2015/popover/src/lib/popover.module.js +24 -0
- package/esm2015/popover/src/public-api.js +7 -0
- package/esm2015/public-api.js +2 -1
- package/fesm2015/sd-angular-core-autocomplete.js +2 -0
- package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +154 -132
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-notify.js +17 -8
- package/fesm2015/sd-angular-core-notify.js.map +1 -1
- package/fesm2015/sd-angular-core-popover.js +369 -0
- package/fesm2015/sd-angular-core-popover.js.map +1 -0
- package/fesm2015/sd-angular-core.js +1 -0
- package/fesm2015/sd-angular-core.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.d.ts +4 -4
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/grid-material.component.d.ts +4 -3
- package/grid-material/src/lib/models/grid-column.model.d.ts +2 -2
- package/grid-material/src/lib/pipes/cell-view.pipe.d.ts +3 -3
- package/grid-material/src/lib/pipes/column-values.pipe.d.ts +2 -4
- package/package.json +1 -1
- package/popover/index.d.ts +1 -0
- package/popover/package.json +12 -0
- package/popover/sd-angular-core-popover.d.ts +4 -0
- package/popover/sd-angular-core-popover.metadata.json +1 -0
- package/popover/src/lib/directives/popover-trigger.directive.d.ts +25 -0
- package/popover/src/lib/popover/popover.component.d.ts +34 -0
- package/popover/src/lib/popover.model.d.ts +1 -0
- package/popover/src/lib/popover.module.d.ts +2 -0
- package/popover/src/public-api.d.ts +3 -0
- package/public-api.d.ts +1 -0
- package/{sd-angular-core-1.0.43.tgz → sd-angular-core-1.0.46.tgz} +0 -0
- package/sd-angular-core.metadata.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sd-angular/core/common'), require('@angular/core'), require('@angular/material/paginator'), require('@angular/material/sort'), require('@angular/animations'), require('uuid'), require('rxjs'), require('@sd-angular/core/notify'), require('@angular/cdk/drag-drop'), require('rxjs/operators'), require('object-hash'), require('@sd-angular/core/setting'), require('ngx-device-detector'), require('@sd-angular/core/loading'), require('@sd-angular/core/translate'), require('@sd-angular/core/export'), require('@angular/forms'), require('@sd-angular/core/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@sd-angular/core/grid-material', ['exports', '@sd-angular/core/common', '@angular/core', '@angular/material/paginator', '@angular/material/sort', '@angular/animations', 'uuid', 'rxjs', '@sd-angular/core/notify', '@angular/cdk/drag-drop', 'rxjs/operators', 'object-hash', '@sd-angular/core/setting', 'ngx-device-detector', '@sd-angular/core/loading', '@sd-angular/core/translate', '@sd-angular/core/export', '@angular/forms', '@sd-angular/core/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core['grid-material'] = {}), global['sd-angular'].core.common, global.ng.core, global.ng.material.paginator, global.ng.material.sort, global.ng.animations, global.uuid, global.rxjs, global['sd-angular'].core.notify, global.ng.cdk.dragDrop, global.rxjs.operators, global['object-hash'], global['sd-angular'].core.setting, global['ngx-device-detector'], global['sd-angular'].core.loading, global['sd-angular'].core.translate, global['sd-angular'].core.export, global.ng.forms, global['sd-angular'].core
|
|
5
|
-
}(this, (function (exports, common$1, core, paginator, sort, animations, uuid, rxjs, notify, dragDrop, operators, hash, setting, ngxDeviceDetector, loading, translate, _export, forms,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sd-angular/core/common'), require('@angular/core'), require('@angular/material/paginator'), require('@angular/material/sort'), require('@angular/animations'), require('uuid'), require('rxjs'), require('@sd-angular/core/notify'), require('@angular/cdk/drag-drop'), require('rxjs/operators'), require('object-hash'), require('@sd-angular/core/setting'), require('ngx-device-detector'), require('@sd-angular/core/loading'), require('@sd-angular/core/translate'), require('@sd-angular/core/export'), require('@angular/forms'), require('@sd-angular/core/quick-action'), require('@angular/common'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/table'), require('@angular/material/progress-spinner'), require('@angular/cdk/table'), require('@angular/cdk/scrolling'), require('@angular/material/menu'), require('@angular/material/slider'), require('@angular/material/button'), require('@sd-angular/core/utility'), require('@sd-angular/core/service'), require('@angular/material/tooltip'), require('@angular/material/chips'), require('@angular/material/radio'), require('@angular/material/slide-toggle'), require('@sd-angular/core/form'), require('@angular/material/checkbox'), require('@angular/material/list'), require('@angular/material/divider'), require('@sd-angular/core/side-drawer')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sd-angular/core/grid-material', ['exports', '@sd-angular/core/common', '@angular/core', '@angular/material/paginator', '@angular/material/sort', '@angular/animations', 'uuid', 'rxjs', '@sd-angular/core/notify', '@angular/cdk/drag-drop', 'rxjs/operators', 'object-hash', '@sd-angular/core/setting', 'ngx-device-detector', '@sd-angular/core/loading', '@sd-angular/core/translate', '@sd-angular/core/export', '@angular/forms', '@sd-angular/core/quick-action', '@angular/common', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@angular/material/table', '@angular/material/progress-spinner', '@angular/cdk/table', '@angular/cdk/scrolling', '@angular/material/menu', '@angular/material/slider', '@angular/material/button', '@sd-angular/core/utility', '@sd-angular/core/service', '@angular/material/tooltip', '@angular/material/chips', '@angular/material/radio', '@angular/material/slide-toggle', '@sd-angular/core/form', '@angular/material/checkbox', '@angular/material/list', '@angular/material/divider', '@sd-angular/core/side-drawer'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['sd-angular'] = global['sd-angular'] || {}, global['sd-angular'].core = global['sd-angular'].core || {}, global['sd-angular'].core['grid-material'] = {}), global['sd-angular'].core.common, global.ng.core, global.ng.material.paginator, global.ng.material.sort, global.ng.animations, global.uuid, global.rxjs, global['sd-angular'].core.notify, global.ng.cdk.dragDrop, global.rxjs.operators, global['object-hash'], global['sd-angular'].core.setting, global['ngx-device-detector'], global['sd-angular'].core.loading, global['sd-angular'].core.translate, global['sd-angular'].core.export, global.ng.forms, global['sd-angular'].core['quick-action'], global.ng.common, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global.ng.material.table, global.ng.material.progressSpinner, global.ng.cdk.table, global.ng.cdk.scrolling, global.ng.material.menu, global.ng.material.slider, global.ng.material.button, global['sd-angular'].core.utility, global['sd-angular'].core.service, global.ng.material.tooltip, global.ng.material.chips, global.ng.material.radio, global.ng.material.slideToggle, global['sd-angular'].core.form, global.ng.material.checkbox, global.ng.material.list, global.ng.material.divider, global['sd-angular'].core['side-drawer']));
|
|
5
|
+
}(this, (function (exports, common$1, core, paginator, sort, animations, uuid, rxjs, notify, dragDrop, operators, hash, setting, ngxDeviceDetector, loading, translate, _export, forms, quickAction, common, formField, icon, input, table, progressSpinner, table$1, scrolling, menu, slider, button, utility, service, tooltip, chips, radio, slideToggle, form, checkbox, list, divider, sideDrawer) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
|
|
31
31
|
var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
|
|
32
|
+
var hash__namespace = /*#__PURE__*/_interopNamespace(hash);
|
|
32
33
|
|
|
33
34
|
var SdMaterialCellDefDirective = /** @class */ (function () {
|
|
34
35
|
function SdMaterialCellDefDirective(templateRef) {
|
|
@@ -1647,74 +1648,58 @@
|
|
|
1647
1648
|
{ type: undefined, decorators: [{ type: core.Inject, args: [GRID_MATERIAL_CONFIG,] }, { type: core.Optional }] }
|
|
1648
1649
|
]; };
|
|
1649
1650
|
|
|
1650
|
-
var
|
|
1651
|
-
var
|
|
1652
|
-
function
|
|
1651
|
+
var _cache$1;
|
|
1652
|
+
var SdColumnValuesPipe = /** @class */ (function () {
|
|
1653
|
+
function SdColumnValuesPipe() {
|
|
1653
1654
|
var _this = this;
|
|
1654
|
-
this.utilityService = utilityService;
|
|
1655
|
-
_prefix$1.set(this, 'a1e67660-8aa2-4c11-b02d-71a32188719f');
|
|
1656
1655
|
_cache$1.set(this, {});
|
|
1657
|
-
this.
|
|
1658
|
-
var _a, _b, _c, _d,
|
|
1659
|
-
return __generator(this, function (
|
|
1660
|
-
switch (
|
|
1656
|
+
this.transform = function (value, column) { return __awaiter(_this, void 0, void 0, function () {
|
|
1657
|
+
var _a, _b, _c, _d, _e, _f, items, valueField, displayField, key, values;
|
|
1658
|
+
return __generator(this, function (_g) {
|
|
1659
|
+
switch (_g.label) {
|
|
1661
1660
|
case 0:
|
|
1662
1661
|
if (column.type !== 'values' || !((_a = column.option) === null || _a === void 0 ? void 0 : _a.items) || !((_b = column.option) === null || _b === void 0 ? void 0 : _b.valueField) || !((_c = column.option) === null || _c === void 0 ? void 0 : _c.displayField)) {
|
|
1663
|
-
return [2 /*return*/,
|
|
1664
|
-
values: [],
|
|
1665
|
-
obj: {}
|
|
1666
|
-
}];
|
|
1662
|
+
return [2 /*return*/, value];
|
|
1667
1663
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
if (!!__classPrivateFieldGet(this, _cache$1)[hashKey]) return [3 /*break*/, 4];
|
|
1674
|
-
items = [];
|
|
1675
|
-
if (!(typeof ((_d = column.option) === null || _d === void 0 ? void 0 : _d.items) === 'function')) return [3 /*break*/, 2];
|
|
1676
|
-
return [4 /*yield*/, column.option.items()];
|
|
1664
|
+
_f = column.option, items = _f.items, valueField = _f.valueField, displayField = _f.displayField;
|
|
1665
|
+
if (!(typeof (items) === 'function')) return [3 /*break*/, 3];
|
|
1666
|
+
key = hash__namespace(Object.assign(Object.assign({}, column), { value: value }));
|
|
1667
|
+
if (!!__classPrivateFieldGet(this, _cache$1)[key]) return [3 /*break*/, 2];
|
|
1668
|
+
return [4 /*yield*/, items(value, true)];
|
|
1677
1669
|
case 1:
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
_e.label = 3;
|
|
1683
|
-
case 3:
|
|
1684
|
-
__classPrivateFieldGet(this, _cache$1)[hashKey] = {
|
|
1685
|
-
values: items,
|
|
1686
|
-
obj: this.utilityService.arrayToObject(items, column.option.valueField)
|
|
1670
|
+
values = _g.sent();
|
|
1671
|
+
__classPrivateFieldGet(this, _cache$1)[key] = {
|
|
1672
|
+
items: values,
|
|
1673
|
+
obj: Array.toObject(values, valueField)
|
|
1687
1674
|
};
|
|
1688
|
-
|
|
1689
|
-
case
|
|
1675
|
+
_g.label = 2;
|
|
1676
|
+
case 2: return [3 /*break*/, 4];
|
|
1677
|
+
case 3:
|
|
1678
|
+
key = hash__namespace(Object.assign({}, column));
|
|
1679
|
+
if (!__classPrivateFieldGet(this, _cache$1)[key]) {
|
|
1680
|
+
__classPrivateFieldGet(this, _cache$1)[key] = {
|
|
1681
|
+
items: items || [],
|
|
1682
|
+
obj: Array.toObject(items, valueField)
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
_g.label = 4;
|
|
1686
|
+
case 4: return [2 /*return*/, (_e = (_d = __classPrivateFieldGet(this, _cache$1)[key].obj[valueField]) === null || _d === void 0 ? void 0 : _d[displayField]) !== null && _e !== void 0 ? _e : value];
|
|
1690
1687
|
}
|
|
1691
1688
|
});
|
|
1692
1689
|
}); };
|
|
1693
|
-
this.getValues = function (column, key) {
|
|
1694
|
-
var hashKey = hash__default['default']({
|
|
1695
|
-
prefix: __classPrivateFieldGet(_this, _prefix$1),
|
|
1696
|
-
field: column.field,
|
|
1697
|
-
key: key,
|
|
1698
|
-
});
|
|
1699
|
-
return __classPrivateFieldGet(_this, _cache$1)[hashKey] || {
|
|
1700
|
-
values: [],
|
|
1701
|
-
obj: {}
|
|
1702
|
-
};
|
|
1703
|
-
};
|
|
1704
1690
|
}
|
|
1705
|
-
return
|
|
1691
|
+
return SdColumnValuesPipe;
|
|
1706
1692
|
}());
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
{ type: core.
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
]; };
|
|
1693
|
+
_cache$1 = new WeakMap();
|
|
1694
|
+
SdColumnValuesPipe.decorators = [
|
|
1695
|
+
{ type: core.Pipe, args: [{
|
|
1696
|
+
name: 'columnValues'
|
|
1697
|
+
},] }
|
|
1698
|
+
];
|
|
1714
1699
|
|
|
1715
1700
|
var _paginator, _sort, _subscription$1, _optionChanges, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _updateSelectedItems;
|
|
1716
1701
|
var SdGridMaterial = /** @class */ (function () {
|
|
1717
|
-
function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, translateService,
|
|
1702
|
+
function SdGridMaterial(ref, configuration, gridConfigurationService, exportService, notifyService, translateService, columnValuesPipe) {
|
|
1718
1703
|
var _this = this;
|
|
1719
1704
|
this.ref = ref;
|
|
1720
1705
|
this.configuration = configuration;
|
|
@@ -1722,7 +1707,7 @@
|
|
|
1722
1707
|
this.exportService = exportService;
|
|
1723
1708
|
this.notifyService = notifyService;
|
|
1724
1709
|
this.translateService = translateService;
|
|
1725
|
-
this.
|
|
1710
|
+
this.columnValuesPipe = columnValuesPipe;
|
|
1726
1711
|
this.key = uuid.v4();
|
|
1727
1712
|
this.localItems = [];
|
|
1728
1713
|
this.items = [];
|
|
@@ -1753,11 +1738,11 @@
|
|
|
1753
1738
|
this.isSelectAll = false;
|
|
1754
1739
|
this.exportTitle = 'Export';
|
|
1755
1740
|
_initCellDef.set(this, function () {
|
|
1756
|
-
var e_1,
|
|
1741
|
+
var e_1, _v;
|
|
1757
1742
|
_this.cellDef = {};
|
|
1758
1743
|
try {
|
|
1759
|
-
for (var
|
|
1760
|
-
var cellDef =
|
|
1744
|
+
for (var _w = __values(_this.sdCellDefs), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1745
|
+
var cellDef = _x.value;
|
|
1761
1746
|
if (cellDef.sdMaterialCellDef) {
|
|
1762
1747
|
_this.cellDef[cellDef.sdMaterialCellDef] = cellDef;
|
|
1763
1748
|
}
|
|
@@ -1766,35 +1751,35 @@
|
|
|
1766
1751
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1767
1752
|
finally {
|
|
1768
1753
|
try {
|
|
1769
|
-
if (
|
|
1754
|
+
if (_x && !_x.done && (_v = _w.return)) _v.call(_w);
|
|
1770
1755
|
}
|
|
1771
1756
|
finally { if (e_1) throw e_1.error; }
|
|
1772
1757
|
}
|
|
1773
1758
|
});
|
|
1774
1759
|
_initFilterDef.set(this, function () {
|
|
1775
|
-
var e_2,
|
|
1760
|
+
var e_2, _v;
|
|
1776
1761
|
_this.filterDefs = [];
|
|
1777
1762
|
try {
|
|
1778
|
-
for (var
|
|
1779
|
-
var filterDef =
|
|
1763
|
+
for (var _w = __values(_this.sdFilterDefs), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1764
|
+
var filterDef = _x.value;
|
|
1780
1765
|
_this.filterDefs.push(filterDef);
|
|
1781
1766
|
}
|
|
1782
1767
|
}
|
|
1783
1768
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1784
1769
|
finally {
|
|
1785
1770
|
try {
|
|
1786
|
-
if (
|
|
1771
|
+
if (_x && !_x.done && (_v = _w.return)) _v.call(_w);
|
|
1787
1772
|
}
|
|
1788
1773
|
finally { if (e_2) throw e_2.error; }
|
|
1789
1774
|
}
|
|
1790
1775
|
});
|
|
1791
1776
|
_initFooterDef.set(this, function () {
|
|
1792
|
-
var e_3,
|
|
1777
|
+
var e_3, _v;
|
|
1793
1778
|
_this.footerDef = {};
|
|
1794
1779
|
_this.hasFooter = false;
|
|
1795
1780
|
try {
|
|
1796
|
-
for (var
|
|
1797
|
-
var footerDef =
|
|
1781
|
+
for (var _w = __values(_this.sdFooterDefs), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1782
|
+
var footerDef = _x.value;
|
|
1798
1783
|
if (footerDef.sdMaterialFooterDef) {
|
|
1799
1784
|
_this.hasFooter = true;
|
|
1800
1785
|
_this.footerDef[footerDef.sdMaterialFooterDef] = footerDef;
|
|
@@ -1804,7 +1789,7 @@
|
|
|
1804
1789
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1805
1790
|
finally {
|
|
1806
1791
|
try {
|
|
1807
|
-
if (
|
|
1792
|
+
if (_x && !_x.done && (_v = _w.return)) _v.call(_w);
|
|
1808
1793
|
}
|
|
1809
1794
|
finally { if (e_3) throw e_3.error; }
|
|
1810
1795
|
}
|
|
@@ -1836,7 +1821,7 @@
|
|
|
1836
1821
|
var columns = _this.gridOption.columns;
|
|
1837
1822
|
var rawColumnFilter = filterInfo.rawColumnFilter, orderBy = filterInfo.orderBy, orderDirection = filterInfo.orderDirection, pageSize = filterInfo.pageSize, pageNumber = filterInfo.pageNumber;
|
|
1838
1823
|
var items = localItems.filter(function (item) {
|
|
1839
|
-
var e_4,
|
|
1824
|
+
var e_4, _v;
|
|
1840
1825
|
var _a, _b, _c, _d;
|
|
1841
1826
|
try {
|
|
1842
1827
|
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
@@ -1910,7 +1895,7 @@
|
|
|
1910
1895
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1911
1896
|
finally {
|
|
1912
1897
|
try {
|
|
1913
|
-
if (columns_1_1 && !columns_1_1.done && (
|
|
1898
|
+
if (columns_1_1 && !columns_1_1.done && (_v = columns_1.return)) _v.call(columns_1);
|
|
1914
1899
|
}
|
|
1915
1900
|
finally { if (e_4) throw e_4.error; }
|
|
1916
1901
|
}
|
|
@@ -1968,37 +1953,37 @@
|
|
|
1968
1953
|
_load$1.set(this, function (filterReq, force) {
|
|
1969
1954
|
if (force === void 0) { force = true; }
|
|
1970
1955
|
return __awaiter(_this, void 0, void 0, function () {
|
|
1971
|
-
var result, results,
|
|
1972
|
-
return __generator(this, function (
|
|
1973
|
-
switch (
|
|
1956
|
+
var result, results, _v, error_1;
|
|
1957
|
+
return __generator(this, function (_w) {
|
|
1958
|
+
switch (_w.label) {
|
|
1974
1959
|
case 0:
|
|
1975
1960
|
this.isLoading = true;
|
|
1976
|
-
|
|
1961
|
+
_w.label = 1;
|
|
1977
1962
|
case 1:
|
|
1978
|
-
|
|
1963
|
+
_w.trys.push([1, 8, 9, 10]);
|
|
1979
1964
|
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 3];
|
|
1980
1965
|
result = this.gridOption.items(filterReq);
|
|
1981
1966
|
if (rxjs.isObservable(result)) {
|
|
1982
1967
|
result = result.toPromise();
|
|
1983
1968
|
}
|
|
1984
1969
|
return [4 /*yield*/, result];
|
|
1985
|
-
case 2: return [2 /*return*/,
|
|
1970
|
+
case 2: return [2 /*return*/, _w.sent()];
|
|
1986
1971
|
case 3:
|
|
1987
1972
|
if (!force) return [3 /*break*/, 6];
|
|
1988
1973
|
results = this.gridOption.items();
|
|
1989
1974
|
if (!(results instanceof Promise)) return [3 /*break*/, 5];
|
|
1990
|
-
|
|
1975
|
+
_v = this;
|
|
1991
1976
|
return [4 /*yield*/, results];
|
|
1992
1977
|
case 4:
|
|
1993
|
-
|
|
1978
|
+
_v.localItems = _w.sent();
|
|
1994
1979
|
return [3 /*break*/, 6];
|
|
1995
1980
|
case 5:
|
|
1996
1981
|
this.localItems = results;
|
|
1997
|
-
|
|
1982
|
+
_w.label = 6;
|
|
1998
1983
|
case 6: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, this.localItems, filterReq)];
|
|
1999
1984
|
case 7: return [3 /*break*/, 10];
|
|
2000
1985
|
case 8:
|
|
2001
|
-
error_1 =
|
|
1986
|
+
error_1 = _w.sent();
|
|
2002
1987
|
this.notifyService.handle.error(error_1);
|
|
2003
1988
|
return [3 /*break*/, 10];
|
|
2004
1989
|
case 9:
|
|
@@ -2012,8 +1997,8 @@
|
|
|
2012
1997
|
});
|
|
2013
1998
|
_render.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2014
1999
|
var _a, _b, _c;
|
|
2015
|
-
return __generator(this, function (
|
|
2016
|
-
switch (
|
|
2000
|
+
return __generator(this, function (_v) {
|
|
2001
|
+
switch (_v.label) {
|
|
2017
2002
|
case 0:
|
|
2018
2003
|
this.items = (args === null || args === void 0 ? void 0 : args.items) || [];
|
|
2019
2004
|
this.total = (args === null || args === void 0 ? void 0 : args.total) || 0;
|
|
@@ -2023,7 +2008,7 @@
|
|
|
2023
2008
|
});
|
|
2024
2009
|
return [4 /*yield*/, ((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.reload) === null || _b === void 0 ? void 0 : _b.onReload) === null || _c === void 0 ? void 0 : _c.call(_b, this.items))];
|
|
2025
2010
|
case 1:
|
|
2026
|
-
|
|
2011
|
+
_v.sent();
|
|
2027
2012
|
this.isSelectAll = this.items.every(function (e) { return e.isSelected; });
|
|
2028
2013
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2029
2014
|
return [2 /*return*/];
|
|
@@ -2034,11 +2019,11 @@
|
|
|
2034
2019
|
if (force === void 0) { force = true; }
|
|
2035
2020
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2036
2021
|
var data;
|
|
2037
|
-
return __generator(this, function (
|
|
2038
|
-
switch (
|
|
2022
|
+
return __generator(this, function (_v) {
|
|
2023
|
+
switch (_v.label) {
|
|
2039
2024
|
case 0: return [4 /*yield*/, __classPrivateFieldGet(this, _load$1).call(this, __classPrivateFieldGet(this, _getFilter).call(this), force)];
|
|
2040
2025
|
case 1:
|
|
2041
|
-
data =
|
|
2026
|
+
data = _v.sent();
|
|
2042
2027
|
__classPrivateFieldGet(this, _render).call(this, data);
|
|
2043
2028
|
return [2 /*return*/];
|
|
2044
2029
|
}
|
|
@@ -2050,8 +2035,8 @@
|
|
|
2050
2035
|
if (pageSize === void 0) { pageSize = 10000; }
|
|
2051
2036
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2052
2037
|
var _d, _e, result, filterInfo, result, exportedItems, results;
|
|
2053
|
-
return __generator(this, function (
|
|
2054
|
-
switch (
|
|
2038
|
+
return __generator(this, function (_v) {
|
|
2039
|
+
switch (_v.label) {
|
|
2055
2040
|
case 0:
|
|
2056
2041
|
if (!((_d = this.gridOption.export) === null || _d === void 0 ? void 0 : _d.items)) return [3 /*break*/, 2];
|
|
2057
2042
|
result = (_e = this.gridOption.export) === null || _e === void 0 ? void 0 : _e.items(__classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize));
|
|
@@ -2065,7 +2050,7 @@
|
|
|
2065
2050
|
result = result.toPromise();
|
|
2066
2051
|
}
|
|
2067
2052
|
return [4 /*yield*/, result];
|
|
2068
|
-
case 1: return [2 /*return*/,
|
|
2053
|
+
case 1: return [2 /*return*/, _v.sent()];
|
|
2069
2054
|
case 2:
|
|
2070
2055
|
filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
2071
2056
|
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 4];
|
|
@@ -2074,7 +2059,7 @@
|
|
|
2074
2059
|
result = result.toPromise();
|
|
2075
2060
|
}
|
|
2076
2061
|
return [4 /*yield*/, result];
|
|
2077
|
-
case 3: return [2 /*return*/,
|
|
2062
|
+
case 3: return [2 /*return*/, _v.sent()];
|
|
2078
2063
|
case 4:
|
|
2079
2064
|
exportedItems = [];
|
|
2080
2065
|
if (!(typeof (this.gridOption.items) === 'function')) return [3 /*break*/, 8];
|
|
@@ -2082,15 +2067,15 @@
|
|
|
2082
2067
|
if (!(results instanceof Promise)) return [3 /*break*/, 6];
|
|
2083
2068
|
return [4 /*yield*/, results];
|
|
2084
2069
|
case 5:
|
|
2085
|
-
exportedItems =
|
|
2070
|
+
exportedItems = _v.sent();
|
|
2086
2071
|
return [3 /*break*/, 7];
|
|
2087
2072
|
case 6:
|
|
2088
2073
|
exportedItems = results;
|
|
2089
|
-
|
|
2074
|
+
_v.label = 7;
|
|
2090
2075
|
case 7: return [3 /*break*/, 9];
|
|
2091
2076
|
case 8:
|
|
2092
2077
|
exportedItems = this.gridOption.items;
|
|
2093
|
-
|
|
2078
|
+
_v.label = 9;
|
|
2094
2079
|
case 9: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, exportedItems, filterInfo)];
|
|
2095
2080
|
}
|
|
2096
2081
|
});
|
|
@@ -2130,13 +2115,13 @@
|
|
|
2130
2115
|
return ((_b = (_a = _this.gridOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || [];
|
|
2131
2116
|
});
|
|
2132
2117
|
_onExport.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2133
|
-
var _f, _g, _h, _j, _k, _l, _m, _o, _p, file, columns_2, isCSV, pageSize, total, pageNumber, exportItems, items, _loop_1, this_1, sheets,
|
|
2134
|
-
var e_5,
|
|
2118
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, file, columns_2, isCSV, pageSize, total, pageNumber, exportItems, items, _loop_1, this_1, sheets, _v, _w, sheet, _x, _y, _z, e_5_1;
|
|
2119
|
+
var e_5, _0;
|
|
2135
2120
|
var _this = this;
|
|
2136
|
-
return __generator(this, function (
|
|
2137
|
-
switch (
|
|
2121
|
+
return __generator(this, function (_1) {
|
|
2122
|
+
switch (_1.label) {
|
|
2138
2123
|
case 0:
|
|
2139
|
-
|
|
2124
|
+
_1.trys.push([0, , 18, 19]);
|
|
2140
2125
|
file = args.file, columns_2 = args.columns, isCSV = args.isCSV;
|
|
2141
2126
|
pageSize = ((_g = (_f = this.gridOption) === null || _f === void 0 ? void 0 : _f.export) === null || _g === void 0 ? void 0 : _g.maxItemsPerRequest) || 1000;
|
|
2142
2127
|
total = this.total;
|
|
@@ -2145,13 +2130,13 @@
|
|
|
2145
2130
|
this.isExporting = true;
|
|
2146
2131
|
items = [];
|
|
2147
2132
|
_loop_1 = function () {
|
|
2148
|
-
var res, results, totalPage, percent, allColumns, allExportedColumns, _loop_2, exportItems_1, exportItems_1_1, item;
|
|
2149
|
-
var e_6,
|
|
2150
|
-
return __generator(this, function (
|
|
2151
|
-
switch (
|
|
2133
|
+
var res, results, totalPage, percent, allColumns, allExportedColumns, _loop_2, exportItems_1, exportItems_1_1, item, e_6_1;
|
|
2134
|
+
var e_6, _v;
|
|
2135
|
+
return __generator(this, function (_w) {
|
|
2136
|
+
switch (_w.label) {
|
|
2152
2137
|
case 0: return [4 /*yield*/, __classPrivateFieldGet(this_1, _exportedItems).call(this_1, pageNumber, pageSize)];
|
|
2153
2138
|
case 1:
|
|
2154
|
-
res =
|
|
2139
|
+
res = _w.sent();
|
|
2155
2140
|
if ('items' in res) {
|
|
2156
2141
|
exportItems = res.items;
|
|
2157
2142
|
total = res.total;
|
|
@@ -2165,11 +2150,11 @@
|
|
|
2165
2150
|
if (!(results instanceof Promise)) return [3 /*break*/, 3];
|
|
2166
2151
|
return [4 /*yield*/, results];
|
|
2167
2152
|
case 2:
|
|
2168
|
-
exportItems =
|
|
2153
|
+
exportItems = _w.sent();
|
|
2169
2154
|
return [3 /*break*/, 4];
|
|
2170
2155
|
case 3:
|
|
2171
2156
|
exportItems = results;
|
|
2172
|
-
|
|
2157
|
+
_w.label = 4;
|
|
2173
2158
|
case 4:
|
|
2174
2159
|
totalPage = total / pageSize;
|
|
2175
2160
|
percent = Math.round(pageNumber * 100.0 / totalPage);
|
|
@@ -2177,103 +2162,159 @@
|
|
|
2177
2162
|
allColumns = __classPrivateFieldGet(this_1, _allColumns).call(this_1);
|
|
2178
2163
|
allExportedColumns = __classPrivateFieldGet(this_1, _allExportedColumns).call(this_1);
|
|
2179
2164
|
_loop_2 = function (item) {
|
|
2180
|
-
var obj
|
|
2181
|
-
var
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2165
|
+
var obj, handle, columns_3, columns_3_1, exportColumn, e_7_1;
|
|
2166
|
+
var e_7, _v;
|
|
2167
|
+
return __generator(this, function (_w) {
|
|
2168
|
+
switch (_w.label) {
|
|
2169
|
+
case 0:
|
|
2170
|
+
obj = {};
|
|
2171
|
+
handle = function (exportColumn) { return __awaiter(_this, void 0, void 0, function () {
|
|
2172
|
+
var _q, _r, column, exportedColumn, date, date, date, _v, _w;
|
|
2173
|
+
return __generator(this, function (_x) {
|
|
2174
|
+
switch (_x.label) {
|
|
2175
|
+
case 0:
|
|
2176
|
+
obj[exportColumn.field] = item[exportColumn.field];
|
|
2177
|
+
column = allColumns.find(function (e) { return e.field === exportColumn.field; });
|
|
2178
|
+
exportedColumn = allExportedColumns.find(function (e) { return e.field === exportColumn.field; });
|
|
2179
|
+
if (exportedColumn === null || exportedColumn === void 0 ? void 0 : exportedColumn.transform) {
|
|
2180
|
+
obj[exportedColumn.field] = exportedColumn.transform(item[exportedColumn.field], item);
|
|
2181
|
+
return [2 /*return*/];
|
|
2182
|
+
}
|
|
2183
|
+
if (!column) {
|
|
2184
|
+
return [2 /*return*/];
|
|
2185
|
+
}
|
|
2186
|
+
if (column.type === 'children' || column.type === 'children-col') {
|
|
2187
|
+
column === null || column === void 0 ? void 0 : column.children.forEach(function (childColumn) { return handle(childColumn); });
|
|
2188
|
+
return [2 /*return*/];
|
|
2189
|
+
}
|
|
2190
|
+
if (!columns_2.some(function (e) { return e.field === column.field; })) {
|
|
2191
|
+
return [2 /*return*/];
|
|
2192
|
+
}
|
|
2193
|
+
if (!column.transform) return [3 /*break*/, 1];
|
|
2194
|
+
obj[column.field] = column.transform(item[column.field], item);
|
|
2195
|
+
return [3 /*break*/, 10];
|
|
2196
|
+
case 1:
|
|
2197
|
+
if (!(item[column.field] === undefined || item[column.field] === null || item[column.field] === '')) return [3 /*break*/, 2];
|
|
2198
|
+
obj[column.field] = '';
|
|
2199
|
+
return [3 /*break*/, 10];
|
|
2200
|
+
case 2:
|
|
2201
|
+
if (!(column.type === 'string' || column.type === 'number')) return [3 /*break*/, 3];
|
|
2202
|
+
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
2203
|
+
obj[column.field] = item[column.field];
|
|
2204
|
+
return [3 /*break*/, 10];
|
|
2205
|
+
case 3:
|
|
2206
|
+
if (!(column.type === 'bool')) return [3 /*break*/, 4];
|
|
2207
|
+
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
2208
|
+
if (item[column.field]) {
|
|
2209
|
+
obj[column.field] = ((_q = column.option) === null || _q === void 0 ? void 0 : _q.displayOnTrue) || 'True';
|
|
2210
|
+
}
|
|
2211
|
+
else {
|
|
2212
|
+
obj[column.field] = ((_r = column.option) === null || _r === void 0 ? void 0 : _r.displayOnFalse) || 'False';
|
|
2213
|
+
}
|
|
2214
|
+
return [3 /*break*/, 10];
|
|
2215
|
+
case 4:
|
|
2216
|
+
if (!(column.type === 'date')) return [3 /*break*/, 5];
|
|
2217
|
+
date = new Date(item[column.field]);
|
|
2218
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
2219
|
+
return [3 /*break*/, 10];
|
|
2220
|
+
case 5:
|
|
2221
|
+
if (!(column.type === 'datetime')) return [3 /*break*/, 6];
|
|
2222
|
+
date = new Date(item[column.field]);
|
|
2223
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm:ss');
|
|
2224
|
+
return [3 /*break*/, 10];
|
|
2225
|
+
case 6:
|
|
2226
|
+
if (!(column.type === 'time')) return [3 /*break*/, 7];
|
|
2227
|
+
date = new Date(item[column.field]);
|
|
2228
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm:ss');
|
|
2229
|
+
return [3 /*break*/, 10];
|
|
2230
|
+
case 7:
|
|
2231
|
+
if (!(column.type === 'values')) return [3 /*break*/, 9];
|
|
2232
|
+
// Nếu là values thì lấy giá trị của value được chọn
|
|
2233
|
+
_v = obj;
|
|
2234
|
+
_w = column.field;
|
|
2235
|
+
return [4 /*yield*/, this.columnValuesPipe.transform(item[column.field], column)];
|
|
2236
|
+
case 8:
|
|
2237
|
+
// Nếu là values thì lấy giá trị của value được chọn
|
|
2238
|
+
_v[_w] = _x.sent();
|
|
2239
|
+
return [3 /*break*/, 10];
|
|
2240
|
+
case 9:
|
|
2241
|
+
obj[column.field] = item[column.field];
|
|
2242
|
+
_x.label = 10;
|
|
2243
|
+
case 10: return [2 /*return*/];
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
}); };
|
|
2247
|
+
_w.label = 1;
|
|
2248
|
+
case 1:
|
|
2249
|
+
_w.trys.push([1, 6, 7, 8]);
|
|
2250
|
+
columns_3 = (e_7 = void 0, __values(columns_2)), columns_3_1 = columns_3.next();
|
|
2251
|
+
_w.label = 2;
|
|
2252
|
+
case 2:
|
|
2253
|
+
if (!!columns_3_1.done) return [3 /*break*/, 5];
|
|
2254
|
+
exportColumn = columns_3_1.value;
|
|
2255
|
+
return [4 /*yield*/, handle(exportColumn)];
|
|
2256
|
+
case 3:
|
|
2257
|
+
_w.sent();
|
|
2258
|
+
_w.label = 4;
|
|
2259
|
+
case 4:
|
|
2260
|
+
columns_3_1 = columns_3.next();
|
|
2261
|
+
return [3 /*break*/, 2];
|
|
2262
|
+
case 5: return [3 /*break*/, 8];
|
|
2263
|
+
case 6:
|
|
2264
|
+
e_7_1 = _w.sent();
|
|
2265
|
+
e_7 = { error: e_7_1 };
|
|
2266
|
+
return [3 /*break*/, 8];
|
|
2267
|
+
case 7:
|
|
2268
|
+
try {
|
|
2269
|
+
if (columns_3_1 && !columns_3_1.done && (_v = columns_3.return)) _v.call(columns_3);
|
|
2270
|
+
}
|
|
2271
|
+
finally { if (e_7) throw e_7.error; }
|
|
2272
|
+
return [7 /*endfinally*/];
|
|
2273
|
+
case 8:
|
|
2274
|
+
items.push(obj);
|
|
2275
|
+
return [2 /*return*/];
|
|
2209
2276
|
}
|
|
2210
|
-
|
|
2211
|
-
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
2212
|
-
if (item[column.field]) {
|
|
2213
|
-
obj[column.field] = ((_a = column.option) === null || _a === void 0 ? void 0 : _a.displayOnTrue) || 'True';
|
|
2214
|
-
}
|
|
2215
|
-
else {
|
|
2216
|
-
obj[column.field] = ((_b = column.option) === null || _b === void 0 ? void 0 : _b.displayOnFalse) || 'False';
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
else if (column.type === 'date') {
|
|
2220
|
-
// Nếu là date thì convert theo đúng format
|
|
2221
|
-
var date = new Date(item[column.field]);
|
|
2222
|
-
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
2223
|
-
}
|
|
2224
|
-
else if (column.type === 'datetime') {
|
|
2225
|
-
// Nếu là datetime thì convert theo đúng format
|
|
2226
|
-
var date = new Date(item[column.field]);
|
|
2227
|
-
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm:ss');
|
|
2228
|
-
}
|
|
2229
|
-
else if (column.type === 'time') {
|
|
2230
|
-
// Nếu là time thì convert theo đúng format
|
|
2231
|
-
var date = new Date(item[column.field]);
|
|
2232
|
-
obj[column.field] = Date.toFormat(date, 'HH:mm:ss');
|
|
2233
|
-
}
|
|
2234
|
-
else if (column.type === 'values') {
|
|
2235
|
-
// Nếu là values thì lấy giá trị của value được chọn
|
|
2236
|
-
var data = _this.gridService.getValues(column, _this.key);
|
|
2237
|
-
if (data.obj[column.option.displayField] !== null && data.obj[column.option.displayField] !== undefined) {
|
|
2238
|
-
obj[column.field] = data.obj[column.option.displayField];
|
|
2239
|
-
}
|
|
2240
|
-
else {
|
|
2241
|
-
obj[column.field] = item[column.field];
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
else {
|
|
2245
|
-
obj[column.field] = item[column.field];
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
// this.gridOption.columns.forEach(handle);
|
|
2249
|
-
columns_2.forEach(handle);
|
|
2250
|
-
items.push(obj);
|
|
2277
|
+
});
|
|
2251
2278
|
};
|
|
2279
|
+
_w.label = 5;
|
|
2280
|
+
case 5:
|
|
2281
|
+
_w.trys.push([5, 10, 11, 12]);
|
|
2282
|
+
exportItems_1 = (e_6 = void 0, __values(exportItems)), exportItems_1_1 = exportItems_1.next();
|
|
2283
|
+
_w.label = 6;
|
|
2284
|
+
case 6:
|
|
2285
|
+
if (!!exportItems_1_1.done) return [3 /*break*/, 9];
|
|
2286
|
+
item = exportItems_1_1.value;
|
|
2287
|
+
return [5 /*yield**/, _loop_2(item)];
|
|
2288
|
+
case 7:
|
|
2289
|
+
_w.sent();
|
|
2290
|
+
_w.label = 8;
|
|
2291
|
+
case 8:
|
|
2292
|
+
exportItems_1_1 = exportItems_1.next();
|
|
2293
|
+
return [3 /*break*/, 6];
|
|
2294
|
+
case 9: return [3 /*break*/, 12];
|
|
2295
|
+
case 10:
|
|
2296
|
+
e_6_1 = _w.sent();
|
|
2297
|
+
e_6 = { error: e_6_1 };
|
|
2298
|
+
return [3 /*break*/, 12];
|
|
2299
|
+
case 11:
|
|
2252
2300
|
try {
|
|
2253
|
-
|
|
2254
|
-
item = exportItems_1_1.value;
|
|
2255
|
-
_loop_2(item);
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2259
|
-
finally {
|
|
2260
|
-
try {
|
|
2261
|
-
if (exportItems_1_1 && !exportItems_1_1.done && (_t = exportItems_1.return)) _t.call(exportItems_1);
|
|
2262
|
-
}
|
|
2263
|
-
finally { if (e_6) throw e_6.error; }
|
|
2301
|
+
if (exportItems_1_1 && !exportItems_1_1.done && (_v = exportItems_1.return)) _v.call(exportItems_1);
|
|
2264
2302
|
}
|
|
2303
|
+
finally { if (e_6) throw e_6.error; }
|
|
2304
|
+
return [7 /*endfinally*/];
|
|
2305
|
+
case 12:
|
|
2265
2306
|
pageNumber++;
|
|
2266
2307
|
return [2 /*return*/];
|
|
2267
2308
|
}
|
|
2268
2309
|
});
|
|
2269
2310
|
};
|
|
2270
2311
|
this_1 = this;
|
|
2271
|
-
|
|
2312
|
+
_1.label = 1;
|
|
2272
2313
|
case 1:
|
|
2273
2314
|
if (!(pageNumber * pageSize < total)) return [3 /*break*/, 3];
|
|
2274
2315
|
return [5 /*yield**/, _loop_1()];
|
|
2275
2316
|
case 2:
|
|
2276
|
-
|
|
2317
|
+
_1.sent();
|
|
2277
2318
|
return [3 /*break*/, 1];
|
|
2278
2319
|
case 3:
|
|
2279
2320
|
if (!!(file === null || file === void 0 ? void 0 : file.filePath)) return [3 /*break*/, 16];
|
|
@@ -2284,19 +2325,19 @@
|
|
|
2284
2325
|
fileName: (_k = (_j = this.gridOption) === null || _j === void 0 ? void 0 : _j.export) === null || _k === void 0 ? void 0 : _k.fileName
|
|
2285
2326
|
})];
|
|
2286
2327
|
case 4:
|
|
2287
|
-
|
|
2328
|
+
_1.sent();
|
|
2288
2329
|
return [2 /*return*/];
|
|
2289
2330
|
case 5:
|
|
2290
2331
|
sheets = [];
|
|
2291
2332
|
if (!Array.isArray((_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.sheets)) return [3 /*break*/, 14];
|
|
2292
|
-
|
|
2333
|
+
_1.label = 6;
|
|
2293
2334
|
case 6:
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2335
|
+
_1.trys.push([6, 12, 13, 14]);
|
|
2336
|
+
_v = __values(this.gridOption.export.sheets), _w = _v.next();
|
|
2337
|
+
_1.label = 7;
|
|
2297
2338
|
case 7:
|
|
2298
|
-
if (!!
|
|
2299
|
-
sheet =
|
|
2339
|
+
if (!!_w.done) return [3 /*break*/, 11];
|
|
2340
|
+
sheet = _w.value;
|
|
2300
2341
|
if (!(sheet.name && sheet.items && sheet.fields)) return [3 /*break*/, 10];
|
|
2301
2342
|
if (!Array.isArray(sheet.items)) return [3 /*break*/, 8];
|
|
2302
2343
|
sheets.push({
|
|
@@ -2306,27 +2347,27 @@
|
|
|
2306
2347
|
});
|
|
2307
2348
|
return [3 /*break*/, 10];
|
|
2308
2349
|
case 8:
|
|
2309
|
-
|
|
2310
|
-
|
|
2350
|
+
_y = (_x = sheets).push;
|
|
2351
|
+
_z = {
|
|
2311
2352
|
name: sheet.name
|
|
2312
2353
|
};
|
|
2313
2354
|
return [4 /*yield*/, sheet.items()];
|
|
2314
2355
|
case 9:
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2356
|
+
_y.apply(_x, [(_z.items = _1.sent(),
|
|
2357
|
+
_z.fields = sheet.fields,
|
|
2358
|
+
_z)]);
|
|
2359
|
+
_1.label = 10;
|
|
2319
2360
|
case 10:
|
|
2320
|
-
|
|
2361
|
+
_w = _v.next();
|
|
2321
2362
|
return [3 /*break*/, 7];
|
|
2322
2363
|
case 11: return [3 /*break*/, 14];
|
|
2323
2364
|
case 12:
|
|
2324
|
-
e_5_1 =
|
|
2365
|
+
e_5_1 = _1.sent();
|
|
2325
2366
|
e_5 = { error: e_5_1 };
|
|
2326
2367
|
return [3 /*break*/, 14];
|
|
2327
2368
|
case 13:
|
|
2328
2369
|
try {
|
|
2329
|
-
if (
|
|
2370
|
+
if (_w && !_w.done && (_0 = _v.return)) _0.call(_v);
|
|
2330
2371
|
}
|
|
2331
2372
|
finally { if (e_5) throw e_5.error; }
|
|
2332
2373
|
return [7 /*endfinally*/];
|
|
@@ -2337,7 +2378,7 @@
|
|
|
2337
2378
|
sheets: sheets
|
|
2338
2379
|
})];
|
|
2339
2380
|
case 15:
|
|
2340
|
-
|
|
2381
|
+
_1.sent();
|
|
2341
2382
|
return [2 /*return*/];
|
|
2342
2383
|
case 16: return [4 /*yield*/, this.exportService.exportByTemplate({
|
|
2343
2384
|
filePath: file.filePath,
|
|
@@ -2346,7 +2387,7 @@
|
|
|
2346
2387
|
items: items
|
|
2347
2388
|
})];
|
|
2348
2389
|
case 17:
|
|
2349
|
-
|
|
2390
|
+
_1.sent();
|
|
2350
2391
|
return [3 /*break*/, 19];
|
|
2351
2392
|
case 18:
|
|
2352
2393
|
this.isExporting = false;
|
|
@@ -2360,7 +2401,7 @@
|
|
|
2360
2401
|
this.onExport = function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2361
2402
|
var translate;
|
|
2362
2403
|
var _this = this;
|
|
2363
|
-
return __generator(this, function (
|
|
2404
|
+
return __generator(this, function (_v) {
|
|
2364
2405
|
translate = this.translateService.translate;
|
|
2365
2406
|
if (!args.isCSV && this.gridOption.export.max && this.total > this.gridOption.export.max) {
|
|
2366
2407
|
this.notifyService.confirm(translate("Total rows reach limit, do you want to export CSV")).then(function () {
|
|
@@ -2378,8 +2419,8 @@
|
|
|
2378
2419
|
_this.reload(false);
|
|
2379
2420
|
};
|
|
2380
2421
|
this.onExpand = function (rowData) { return __awaiter(_this, void 0, void 0, function () {
|
|
2381
|
-
var
|
|
2382
|
-
return __generator(this, function (
|
|
2422
|
+
var _s, _t, _u, data;
|
|
2423
|
+
return __generator(this, function (_v) {
|
|
2383
2424
|
if (rowData.isExpanding) {
|
|
2384
2425
|
return [2 /*return*/];
|
|
2385
2426
|
}
|
|
@@ -2387,8 +2428,8 @@
|
|
|
2387
2428
|
rowData.isExpanded = false;
|
|
2388
2429
|
return [2 /*return*/];
|
|
2389
2430
|
}
|
|
2390
|
-
data = (
|
|
2391
|
-
if (!((
|
|
2431
|
+
data = (_t = (_s = this.gridOption) === null || _s === void 0 ? void 0 : _s.subInformation) === null || _t === void 0 ? void 0 : _t.onExpand(rowData);
|
|
2432
|
+
if (!((_u = this.gridOption.subInformation) === null || _u === void 0 ? void 0 : _u.multiple)) {
|
|
2392
2433
|
this.items.forEach(function (item) { return item.isExpanding = item.isExpanded = false; });
|
|
2393
2434
|
}
|
|
2394
2435
|
if (data instanceof Promise) {
|
|
@@ -2450,7 +2491,7 @@
|
|
|
2450
2491
|
};
|
|
2451
2492
|
this.onCreate = function () {
|
|
2452
2493
|
var _a, _b;
|
|
2453
|
-
var
|
|
2494
|
+
var _v = _this.gridOption, type = _v.type, editor = _v.editor, columns = _v.columns;
|
|
2454
2495
|
if (!(editor === null || editor === void 0 ? void 0 : editor.addable)) {
|
|
2455
2496
|
return;
|
|
2456
2497
|
}
|
|
@@ -2506,23 +2547,23 @@
|
|
|
2506
2547
|
};
|
|
2507
2548
|
this.onSave = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
2508
2549
|
var editor, result, message, result, err_1;
|
|
2509
|
-
return __generator(this, function (
|
|
2510
|
-
switch (
|
|
2550
|
+
return __generator(this, function (_v) {
|
|
2551
|
+
switch (_v.label) {
|
|
2511
2552
|
case 0:
|
|
2512
2553
|
if (item.editorHandlerRow.saving) {
|
|
2513
2554
|
return [2 /*return*/];
|
|
2514
2555
|
}
|
|
2515
2556
|
editor = this.gridOption.editor;
|
|
2516
|
-
|
|
2557
|
+
_v.label = 1;
|
|
2517
2558
|
case 1:
|
|
2518
|
-
|
|
2559
|
+
_v.trys.push([1, 7, 8, 9]);
|
|
2519
2560
|
item.editorHandlerRow.saving = true;
|
|
2520
2561
|
if (!editor.validate) return [3 /*break*/, 4];
|
|
2521
2562
|
result = editor.validate(item, this.items.indexOf(item));
|
|
2522
2563
|
if (!(result instanceof Promise)) return [3 /*break*/, 3];
|
|
2523
2564
|
return [4 /*yield*/, result];
|
|
2524
2565
|
case 2:
|
|
2525
|
-
message =
|
|
2566
|
+
message = _v.sent();
|
|
2526
2567
|
if (message) {
|
|
2527
2568
|
throw message;
|
|
2528
2569
|
}
|
|
@@ -2531,15 +2572,15 @@
|
|
|
2531
2572
|
if (result) {
|
|
2532
2573
|
throw result;
|
|
2533
2574
|
}
|
|
2534
|
-
|
|
2575
|
+
_v.label = 4;
|
|
2535
2576
|
case 4:
|
|
2536
2577
|
if (!editor.onSave) return [3 /*break*/, 6];
|
|
2537
2578
|
result = editor.onSave(item);
|
|
2538
2579
|
if (!(result instanceof Promise)) return [3 /*break*/, 6];
|
|
2539
2580
|
return [4 /*yield*/, result];
|
|
2540
2581
|
case 5:
|
|
2541
|
-
|
|
2542
|
-
|
|
2582
|
+
_v.sent();
|
|
2583
|
+
_v.label = 6;
|
|
2543
2584
|
case 6:
|
|
2544
2585
|
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
2545
2586
|
if (this.gridOption.type === 'local') {
|
|
@@ -2550,7 +2591,7 @@
|
|
|
2550
2591
|
item.editorStatus = undefined;
|
|
2551
2592
|
return [3 /*break*/, 9];
|
|
2552
2593
|
case 7:
|
|
2553
|
-
err_1 =
|
|
2594
|
+
err_1 = _v.sent();
|
|
2554
2595
|
this.notifyService.notify.warning(err_1);
|
|
2555
2596
|
return [3 /*break*/, 9];
|
|
2556
2597
|
case 8:
|
|
@@ -2742,13 +2783,20 @@
|
|
|
2742
2783
|
enumerable: false,
|
|
2743
2784
|
configurable: true
|
|
2744
2785
|
});
|
|
2786
|
+
Object.defineProperty(SdGridMaterial.prototype, "isEditing", {
|
|
2787
|
+
get: function () {
|
|
2788
|
+
return this.items.some(function (e) { return e.editorStatus !== undefined; });
|
|
2789
|
+
},
|
|
2790
|
+
enumerable: false,
|
|
2791
|
+
configurable: true
|
|
2792
|
+
});
|
|
2745
2793
|
return SdGridMaterial;
|
|
2746
2794
|
}());
|
|
2747
2795
|
_paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _optionChanges = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = new WeakMap(), _filterLocal = new WeakMap(), _getFilter = new WeakMap(), _load$1 = new WeakMap(), _render = new WeakMap(), _exportedItems = new WeakMap(), _allColumns = new WeakMap(), _allExportedColumns = new WeakMap(), _onExport = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
2748
2796
|
SdGridMaterial.decorators = [
|
|
2749
2797
|
{ type: core.Component, args: [{
|
|
2750
2798
|
selector: 'sd-grid-material',
|
|
2751
|
-
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"items\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <div *ngIf=\"sdSubInformation?.templateRef\" [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding\" mat-icon-button aria-label=\"Expand & Collapse\"\r\n (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\" [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\"></tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault(true)\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n</ng-container>\r\n<sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\" (clear)=\"onClearSelection()\">\r\n</sd-grid-quick-action>",
|
|
2799
|
+
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"items\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <div *ngIf=\"sdSubInformation?.templateRef\" [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding\" mat-icon-button aria-label=\"Expand & Collapse\"\r\n (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\"></tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [class.text-right]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right'\" [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault(true)\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n</ng-container>\r\n<sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\" (clear)=\"onClearSelection()\">\r\n</sd-grid-quick-action>",
|
|
2752
2800
|
animations: [
|
|
2753
2801
|
animations.trigger('detailExpand', [
|
|
2754
2802
|
animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
@@ -2766,7 +2814,7 @@
|
|
|
2766
2814
|
{ type: _export.SdExportService },
|
|
2767
2815
|
{ type: notify.SdNotifyService },
|
|
2768
2816
|
{ type: translate.SdTranslateService },
|
|
2769
|
-
{ type:
|
|
2817
|
+
{ type: SdColumnValuesPipe }
|
|
2770
2818
|
]; };
|
|
2771
2819
|
SdGridMaterial.propDecorators = {
|
|
2772
2820
|
quickAction: [{ type: core.ViewChild, args: [quickAction.SdQuickAction,] }],
|
|
@@ -2974,33 +3022,6 @@
|
|
|
2974
3022
|
},] }
|
|
2975
3023
|
];
|
|
2976
3024
|
|
|
2977
|
-
var SdColumnValuesPipe = /** @class */ (function () {
|
|
2978
|
-
function SdColumnValuesPipe(gridService) {
|
|
2979
|
-
var _this = this;
|
|
2980
|
-
this.gridService = gridService;
|
|
2981
|
-
this.transform = function (value, column, key) { return __awaiter(_this, void 0, void 0, function () {
|
|
2982
|
-
var _a, data;
|
|
2983
|
-
return __generator(this, function (_b) {
|
|
2984
|
-
switch (_b.label) {
|
|
2985
|
-
case 0: return [4 /*yield*/, this.gridService.loadValues(column, key)];
|
|
2986
|
-
case 1:
|
|
2987
|
-
data = _b.sent();
|
|
2988
|
-
return [2 /*return*/, (_a = data.obj[value]) !== null && _a !== void 0 ? _a : value];
|
|
2989
|
-
}
|
|
2990
|
-
});
|
|
2991
|
-
}); };
|
|
2992
|
-
}
|
|
2993
|
-
return SdColumnValuesPipe;
|
|
2994
|
-
}());
|
|
2995
|
-
SdColumnValuesPipe.decorators = [
|
|
2996
|
-
{ type: core.Pipe, args: [{
|
|
2997
|
-
name: 'columnValues'
|
|
2998
|
-
},] }
|
|
2999
|
-
];
|
|
3000
|
-
SdColumnValuesPipe.ctorParameters = function () { return [
|
|
3001
|
-
{ type: SdGridService }
|
|
3002
|
-
]; };
|
|
3003
|
-
|
|
3004
3025
|
var SdColumnHtmlTemplatePipe = /** @class */ (function () {
|
|
3005
3026
|
function SdColumnHtmlTemplatePipe(deviceService) {
|
|
3006
3027
|
this.isMobileOrTablet = false;
|
|
@@ -3045,6 +3066,71 @@
|
|
|
3045
3066
|
gridOption: [{ type: core.Input }]
|
|
3046
3067
|
};
|
|
3047
3068
|
|
|
3069
|
+
var _prefix$1, _cache$2;
|
|
3070
|
+
var SdGridService = /** @class */ (function () {
|
|
3071
|
+
function SdGridService(utilityService) {
|
|
3072
|
+
var _this = this;
|
|
3073
|
+
this.utilityService = utilityService;
|
|
3074
|
+
_prefix$1.set(this, 'a1e67660-8aa2-4c11-b02d-71a32188719f');
|
|
3075
|
+
_cache$2.set(this, {});
|
|
3076
|
+
this.loadValues = function (column, key) { return __awaiter(_this, void 0, void 0, function () {
|
|
3077
|
+
var _a, _b, _c, _d, hashKey, items;
|
|
3078
|
+
return __generator(this, function (_e) {
|
|
3079
|
+
switch (_e.label) {
|
|
3080
|
+
case 0:
|
|
3081
|
+
if (column.type !== 'values' || !((_a = column.option) === null || _a === void 0 ? void 0 : _a.items) || !((_b = column.option) === null || _b === void 0 ? void 0 : _b.valueField) || !((_c = column.option) === null || _c === void 0 ? void 0 : _c.displayField)) {
|
|
3082
|
+
return [2 /*return*/, {
|
|
3083
|
+
values: [],
|
|
3084
|
+
obj: {}
|
|
3085
|
+
}];
|
|
3086
|
+
}
|
|
3087
|
+
hashKey = hash__default['default']({
|
|
3088
|
+
prefix: __classPrivateFieldGet(this, _prefix$1),
|
|
3089
|
+
field: column.field,
|
|
3090
|
+
key: key,
|
|
3091
|
+
});
|
|
3092
|
+
if (!!__classPrivateFieldGet(this, _cache$2)[hashKey]) return [3 /*break*/, 4];
|
|
3093
|
+
items = [];
|
|
3094
|
+
if (!(typeof ((_d = column.option) === null || _d === void 0 ? void 0 : _d.items) === 'function')) return [3 /*break*/, 2];
|
|
3095
|
+
return [4 /*yield*/, column.option.items()];
|
|
3096
|
+
case 1:
|
|
3097
|
+
items = _e.sent();
|
|
3098
|
+
return [3 /*break*/, 3];
|
|
3099
|
+
case 2:
|
|
3100
|
+
items = column.option.items;
|
|
3101
|
+
_e.label = 3;
|
|
3102
|
+
case 3:
|
|
3103
|
+
__classPrivateFieldGet(this, _cache$2)[hashKey] = {
|
|
3104
|
+
values: items,
|
|
3105
|
+
obj: Array.toObject(items, column.option.valueField)
|
|
3106
|
+
};
|
|
3107
|
+
_e.label = 4;
|
|
3108
|
+
case 4: return [2 /*return*/, __classPrivateFieldGet(this, _cache$2)[hashKey]];
|
|
3109
|
+
}
|
|
3110
|
+
});
|
|
3111
|
+
}); };
|
|
3112
|
+
this.getValues = function (column, key) {
|
|
3113
|
+
var hashKey = hash__default['default']({
|
|
3114
|
+
prefix: __classPrivateFieldGet(_this, _prefix$1),
|
|
3115
|
+
field: column.field,
|
|
3116
|
+
key: key,
|
|
3117
|
+
});
|
|
3118
|
+
return __classPrivateFieldGet(_this, _cache$2)[hashKey] || {
|
|
3119
|
+
values: [],
|
|
3120
|
+
obj: {}
|
|
3121
|
+
};
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
return SdGridService;
|
|
3125
|
+
}());
|
|
3126
|
+
_prefix$1 = new WeakMap(), _cache$2 = new WeakMap();
|
|
3127
|
+
SdGridService.decorators = [
|
|
3128
|
+
{ type: core.Injectable }
|
|
3129
|
+
];
|
|
3130
|
+
SdGridService.ctorParameters = function () { return [
|
|
3131
|
+
{ type: utility.SdUtilityService }
|
|
3132
|
+
]; };
|
|
3133
|
+
|
|
3048
3134
|
var SdColumnTransformPipe = /** @class */ (function () {
|
|
3049
3135
|
function SdColumnTransformPipe(gridService) {
|
|
3050
3136
|
this.gridService = gridService;
|
|
@@ -3183,7 +3269,7 @@
|
|
|
3183
3269
|
SdDesktopCellChildrenView.decorators = [
|
|
3184
3270
|
{ type: core.Component, args: [{
|
|
3185
3271
|
selector: 'sd-desktop-cell-children-view',
|
|
3186
|
-
template: "<ng-container *ngIf=\"column.children?.length\">\r\n <div class=\"row mx-0\">\r\n <div *ngFor=\"let childColumn of column.children | columnChildrenFilter:item\" class=\"px-2\"\r\n [ngClass]=\"{'col-6': childColumn?.colSpan === 1, 'col-12': !childColumn?.colSpan || childColumn?.colSpan === 2}\">\r\n <span class=\"c-title\">\r\n {{item | columnTitle:childColumn | async}}:\r\n </span>\r\n <ng-container *ngIf=\"childColumn.htmlTemplate;else useDefaultView\">\r\n <div (click)=\"childColumn.click && childColumn.click(item[childColumn.field], item)\"\r\n style=\"display:inline-block ;overflow-wrap: break-word;\" [ngClass]=\"{'cursor-pointer':childColumn.click}\"\r\n [innerHTML]=\"(item[childColumn.field] | columnHtmlTemplate:item:childColumn) | safeHtml\">\r\n </div>\r\n </ng-container>\r\n <ng-template #useDefaultView>\r\n <span *ngIf=\"childColumn.type === 'string'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n columnTransform:item:childColumn | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | columnTransform:item:childColumn | async}}</ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'number'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n columnTransform:item:childColumn | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | columnTransform:item:childColumn | async}}\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'datetime'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy HH:mm':childColumn.option?.timeDifferent | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n <span matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[childColumn.field] | date:'dd/MM/yyyy HH:mm'\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy HH:mm':childColumn.option?.timeDifferent | async}}</span>\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'date'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy':childColumn.option?.timeDifferent | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n <span matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[childColumn.field] | date:'dd/MM/yyyy'\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy':childColumn.option?.timeDifferent | async}}</span>\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'time'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] | date:'HH:mm'}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | date:'HH:mm'}}\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'bool'\"\r\n (click)=\"childColumn.click && childColumn.click(item[childColumn.field], item)\">\r\n <strong *ngIf=\"item[childColumn.field]\" class=\"text-success\">{{childColumn.option?.displayOnTrue ||\r\n 'True'}}</strong>\r\n <strong *ngIf=\"!item[childColumn.field]\" class=\"text-danger\">{{childColumn.option?.displayOnFalse ||\r\n 'False'}}</strong>\r\n </span>\r\n <ng-container *ngIf=\"childColumn.type === 'values'\">\r\n <ng-container *ngIf=\"childColumn.transform\">{{item[childColumn.field] | columnTransform:item:childColumn | async}}</ng-container>\r\n <ng-container *ngIf=\"!childColumn.transform\">\r\n <ng-container *ngIf=\"item[childColumn.field] | columnValues:childColumn
|
|
3272
|
+
template: "<ng-container *ngIf=\"column.children?.length\">\r\n <div class=\"row mx-0\">\r\n <div *ngFor=\"let childColumn of column.children | columnChildrenFilter:item\" class=\"px-2\"\r\n [ngClass]=\"{'col-6': childColumn?.colSpan === 1, 'col-12': !childColumn?.colSpan || childColumn?.colSpan === 2}\">\r\n <span class=\"c-title\">\r\n {{item | columnTitle:childColumn | async}}:\r\n </span>\r\n <ng-container *ngIf=\"childColumn.htmlTemplate;else useDefaultView\">\r\n <div (click)=\"childColumn.click && childColumn.click(item[childColumn.field], item)\"\r\n style=\"display:inline-block ;overflow-wrap: break-word;\" [ngClass]=\"{'cursor-pointer':childColumn.click}\"\r\n [innerHTML]=\"(item[childColumn.field] | columnHtmlTemplate:item:childColumn) | safeHtml\">\r\n </div>\r\n </ng-container>\r\n <ng-template #useDefaultView>\r\n <span *ngIf=\"childColumn.type === 'string'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n columnTransform:item:childColumn | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | columnTransform:item:childColumn | async}}</ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'number'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n columnTransform:item:childColumn | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | columnTransform:item:childColumn | async}}\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'datetime'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy HH:mm':childColumn.option?.timeDifferent | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n <span matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[childColumn.field] | date:'dd/MM/yyyy HH:mm'\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy HH:mm':childColumn.option?.timeDifferent | async}}</span>\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'date'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy':childColumn.option?.timeDifferent | async}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n <span matTooltipPosition=\"above\"\r\n [matTooltip]=\"item[childColumn.field] | date:'dd/MM/yyyy'\">{{item[childColumn.field] |\r\n sdTimeDifferent:'dd/MM/yyyy':childColumn.option?.timeDifferent | async}}</span>\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'time'\">\r\n <a *ngIf=\"childColumn.click\" href=\"javascript:;\"\r\n (click)=\"childColumn.click(item[childColumn.field], item)\">{{item[childColumn.field] | date:'HH:mm'}}</a>\r\n <ng-container *ngIf=\"!childColumn.click\">\r\n {{item[childColumn.field] | date:'HH:mm'}}\r\n </ng-container>\r\n </span>\r\n <span *ngIf=\"childColumn.type === 'bool'\"\r\n (click)=\"childColumn.click && childColumn.click(item[childColumn.field], item)\">\r\n <strong *ngIf=\"item[childColumn.field]\" class=\"text-success\">{{childColumn.option?.displayOnTrue ||\r\n 'True'}}</strong>\r\n <strong *ngIf=\"!item[childColumn.field]\" class=\"text-danger\">{{childColumn.option?.displayOnFalse ||\r\n 'False'}}</strong>\r\n </span>\r\n <ng-container *ngIf=\"childColumn.type === 'values'\">\r\n <ng-container *ngIf=\"childColumn.transform\">{{item[childColumn.field] | columnTransform:item:childColumn | async}}</ng-container>\r\n <ng-container *ngIf=\"!childColumn.transform\">\r\n {{item[childColumn.field] | columnValues:childColumn | async}}\r\n <!-- <ng-container *ngIf=\"item[childColumn.field] | columnValues:childColumn | async; $implicit as valueData\">\r\n <div\r\n *ngIf=\"valueData[childColumn.option?.colorField] || valueData[childColumn.option?.backgroundColorField]; else elseNoStatus\"\r\n [ngStyle]=\"{'color':valueData[childColumn.option?.colorField], 'background-color': valueData[childColumn.option?.backgroundColorField]}\">\r\n {{valueData[childColumn.option?.displayField]}}\r\n </div>\r\n <ng-template #elseNoStatus>\r\n {{valueData[childColumn.option?.displayField]}}\r\n </ng-template>\r\n </ng-container> -->\r\n </ng-container>\r\n \r\n </ng-container>\r\n <img *ngIf=\"childColumn.type === 'image'\" [src]=\"item[childColumn.field] | columnTransform:item:childColumn | async\" [width]=\"childColumn.display?.width\"\r\n [height]=\"childColumn.display?.height\" style=\"margin: 5px 0\"\r\n (click)=\"childColumn.click && childColumn.click(item[childColumn.field], item)\">\r\n </ng-template>\r\n </div>\r\n </div>\r\n</ng-container>",
|
|
3187
3273
|
styles: [".c-title{color:#212529;font-size:13px;font-weight:700;line-height:1.7;margin-right:3px}.c-children{color:#212529;font-size:14px;overflow-wrap:break-word}"]
|
|
3188
3274
|
},] }
|
|
3189
3275
|
];
|
|
@@ -3335,7 +3421,7 @@
|
|
|
3335
3421
|
{ type: SdGridConfigurationService }
|
|
3336
3422
|
]; };
|
|
3337
3423
|
|
|
3338
|
-
var _cache$
|
|
3424
|
+
var _cache$3;
|
|
3339
3425
|
var SdPopupGridConfiguration = /** @class */ (function () {
|
|
3340
3426
|
function SdPopupGridConfiguration(ref, notifyService, translateService, gridConfigurationService) {
|
|
3341
3427
|
var _this = this;
|
|
@@ -3344,7 +3430,7 @@
|
|
|
3344
3430
|
this.translateService = translateService;
|
|
3345
3431
|
this.gridConfigurationService = gridConfigurationService;
|
|
3346
3432
|
this.changes = new core.EventEmitter();
|
|
3347
|
-
_cache$
|
|
3433
|
+
_cache$3.set(this, void 0);
|
|
3348
3434
|
this.isCreatingColumn = false;
|
|
3349
3435
|
this.selected = {};
|
|
3350
3436
|
this.disabledDrag = true;
|
|
@@ -3353,9 +3439,9 @@
|
|
|
3353
3439
|
return __generator(this, function (_c) {
|
|
3354
3440
|
switch (_c.label) {
|
|
3355
3441
|
case 0:
|
|
3356
|
-
__classPrivateFieldSet(this, _cache$
|
|
3442
|
+
__classPrivateFieldSet(this, _cache$3, this.gridConfigurationService.init(this.key, this.gridOption));
|
|
3357
3443
|
_b = this;
|
|
3358
|
-
return [4 /*yield*/, __classPrivateFieldGet(this, _cache$
|
|
3444
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _cache$3).get()];
|
|
3359
3445
|
case 1:
|
|
3360
3446
|
_b.configuration = _c.sent();
|
|
3361
3447
|
this.modal.open();
|
|
@@ -3364,7 +3450,7 @@
|
|
|
3364
3450
|
});
|
|
3365
3451
|
}); };
|
|
3366
3452
|
this.onSave = function () {
|
|
3367
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3453
|
+
__classPrivateFieldGet(_this, _cache$3).set(_this.configuration);
|
|
3368
3454
|
_this.modal.close();
|
|
3369
3455
|
_this.ref.detectChanges();
|
|
3370
3456
|
};
|
|
@@ -3374,7 +3460,7 @@
|
|
|
3374
3460
|
return __generator(this, function (_b) {
|
|
3375
3461
|
translate = this.translateService.translate;
|
|
3376
3462
|
this.notifyService.confirm(translate('Reset grid configuration to default')).then(function () {
|
|
3377
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3463
|
+
__classPrivateFieldGet(_this, _cache$3).remove();
|
|
3378
3464
|
_this.modal.close();
|
|
3379
3465
|
_this.ref.detectChanges();
|
|
3380
3466
|
});
|
|
@@ -3406,7 +3492,7 @@
|
|
|
3406
3492
|
generatedColumns: this.configuration.columns.filter(function (e) { var _a; return _this.selected[(_a = e.origin) === null || _a === void 0 ? void 0 : _a.field]; }).map(function (e) { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.field; })
|
|
3407
3493
|
};
|
|
3408
3494
|
this.configuration.columns.push(generatedColumn);
|
|
3409
|
-
this.configuration = __classPrivateFieldGet(this, _cache$
|
|
3495
|
+
this.configuration = __classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
3410
3496
|
this.isCreatingColumn = false;
|
|
3411
3497
|
return [2 /*return*/];
|
|
3412
3498
|
});
|
|
@@ -3429,7 +3515,7 @@
|
|
|
3429
3515
|
};
|
|
3430
3516
|
return SdPopupGridConfiguration;
|
|
3431
3517
|
}());
|
|
3432
|
-
_cache$
|
|
3518
|
+
_cache$3 = new WeakMap();
|
|
3433
3519
|
SdPopupGridConfiguration.decorators = [
|
|
3434
3520
|
{ type: core.Component, args: [{
|
|
3435
3521
|
selector: 'sd-popup-grid-configuration',
|
|
@@ -3712,12 +3798,12 @@
|
|
|
3712
3798
|
},] }
|
|
3713
3799
|
];
|
|
3714
3800
|
|
|
3715
|
-
var _cache$
|
|
3801
|
+
var _cache$4;
|
|
3716
3802
|
var SdGeneratedColumnService = /** @class */ (function () {
|
|
3717
3803
|
function SdGeneratedColumnService(settingService) {
|
|
3718
3804
|
var _this = this;
|
|
3719
3805
|
this.settingService = settingService;
|
|
3720
|
-
_cache$
|
|
3806
|
+
_cache$4.set(this, {});
|
|
3721
3807
|
this.load = function (configuration) {
|
|
3722
3808
|
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.key)) {
|
|
3723
3809
|
return null;
|
|
@@ -3726,22 +3812,22 @@
|
|
|
3726
3812
|
prefix: '260f5e94-5865-4425-8ced-b9c083c390dd',
|
|
3727
3813
|
key: configuration.key
|
|
3728
3814
|
});
|
|
3729
|
-
if (!__classPrivateFieldGet(_this, _cache$
|
|
3815
|
+
if (!__classPrivateFieldGet(_this, _cache$4)[key]) {
|
|
3730
3816
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3731
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3817
|
+
__classPrivateFieldGet(_this, _cache$4)[key] = _this.settingService.createServer(key, {
|
|
3732
3818
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3733
3819
|
default: []
|
|
3734
3820
|
});
|
|
3735
3821
|
}
|
|
3736
3822
|
else {
|
|
3737
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3823
|
+
__classPrivateFieldGet(_this, _cache$4)[key] = _this.settingService.create(key, {
|
|
3738
3824
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3739
3825
|
args: configuration === null || configuration === void 0 ? void 0 : configuration.args,
|
|
3740
3826
|
default: []
|
|
3741
3827
|
});
|
|
3742
3828
|
}
|
|
3743
3829
|
}
|
|
3744
|
-
return __classPrivateFieldGet(_this, _cache$
|
|
3830
|
+
return __classPrivateFieldGet(_this, _cache$4)[key];
|
|
3745
3831
|
};
|
|
3746
3832
|
this.loadSystem = function (configuration) {
|
|
3747
3833
|
var _a, _b;
|
|
@@ -3755,27 +3841,27 @@
|
|
|
3755
3841
|
prefix: '8b8050ca-1f44-4860-bad3-20e646c0d68f',
|
|
3756
3842
|
key: configuration.key
|
|
3757
3843
|
});
|
|
3758
|
-
if (!__classPrivateFieldGet(_this, _cache$
|
|
3844
|
+
if (!__classPrivateFieldGet(_this, _cache$4)[key]) {
|
|
3759
3845
|
if ((configuration === null || configuration === void 0 ? void 0 : configuration.storage) === 'server') {
|
|
3760
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3846
|
+
__classPrivateFieldGet(_this, _cache$4)[key] = _this.settingService.createServer(key, {
|
|
3761
3847
|
args: (_a = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _a === void 0 ? void 0 : _a.args,
|
|
3762
3848
|
default: []
|
|
3763
3849
|
});
|
|
3764
3850
|
}
|
|
3765
3851
|
else {
|
|
3766
|
-
__classPrivateFieldGet(_this, _cache$
|
|
3852
|
+
__classPrivateFieldGet(_this, _cache$4)[key] = _this.settingService.create(key, {
|
|
3767
3853
|
type: configuration === null || configuration === void 0 ? void 0 : configuration.storage,
|
|
3768
3854
|
args: (_b = configuration === null || configuration === void 0 ? void 0 : configuration.systemColumn) === null || _b === void 0 ? void 0 : _b.args,
|
|
3769
3855
|
default: []
|
|
3770
3856
|
});
|
|
3771
3857
|
}
|
|
3772
3858
|
}
|
|
3773
|
-
return __classPrivateFieldGet(_this, _cache$
|
|
3859
|
+
return __classPrivateFieldGet(_this, _cache$4)[key];
|
|
3774
3860
|
};
|
|
3775
3861
|
}
|
|
3776
3862
|
return SdGeneratedColumnService;
|
|
3777
3863
|
}());
|
|
3778
|
-
_cache$
|
|
3864
|
+
_cache$4 = new WeakMap();
|
|
3779
3865
|
SdGeneratedColumnService.decorators = [
|
|
3780
3866
|
{ type: core.Injectable }
|
|
3781
3867
|
];
|
|
@@ -4273,9 +4359,9 @@
|
|
|
4273
4359
|
|
|
4274
4360
|
var _maxSecond, _maxMinute, _maxHour, _maxDay, _maxMonth, _isMobileOrTablet$1;
|
|
4275
4361
|
var SdCellViewPipe = /** @class */ (function () {
|
|
4276
|
-
function SdCellViewPipe(deviceService, utilityService,
|
|
4362
|
+
function SdCellViewPipe(deviceService, utilityService, columnValuesPipe) {
|
|
4277
4363
|
this.utilityService = utilityService;
|
|
4278
|
-
this.
|
|
4364
|
+
this.columnValuesPipe = columnValuesPipe;
|
|
4279
4365
|
_maxSecond.set(this, 60);
|
|
4280
4366
|
_maxMinute.set(this, __classPrivateFieldGet(this, _maxSecond) * 60);
|
|
4281
4367
|
_maxHour.set(this, __classPrivateFieldGet(this, _maxMinute) * 24);
|
|
@@ -4285,11 +4371,11 @@
|
|
|
4285
4371
|
__classPrivateFieldSet(this, _isMobileOrTablet$1, !deviceService.isDesktop());
|
|
4286
4372
|
}
|
|
4287
4373
|
SdCellViewPipe.prototype.transform = function (value, rowData, column, gridOption, key) {
|
|
4288
|
-
var _a
|
|
4374
|
+
var _a;
|
|
4289
4375
|
return __awaiter(this, void 0, void 0, function () {
|
|
4290
|
-
var displayOnEmpty, align, click, tooltip, htmlTemplate, transform, result, val,
|
|
4291
|
-
return __generator(this, function (
|
|
4292
|
-
switch (
|
|
4376
|
+
var displayOnEmpty, align, click, tooltip, htmlTemplate, transform, result, val, _b, option, seconds, _c, option;
|
|
4377
|
+
return __generator(this, function (_d) {
|
|
4378
|
+
switch (_d.label) {
|
|
4293
4379
|
case 0:
|
|
4294
4380
|
displayOnEmpty = gridOption.displayOnEmpty;
|
|
4295
4381
|
align = column.align, click = column.click, tooltip = column.tooltip, htmlTemplate = column.htmlTemplate, transform = column.transform;
|
|
@@ -4310,14 +4396,14 @@
|
|
|
4310
4396
|
if (!(typeof (transform) === 'function')) return [3 /*break*/, 5];
|
|
4311
4397
|
val = transform(value, rowData);
|
|
4312
4398
|
if (!(val instanceof Promise)) return [3 /*break*/, 3];
|
|
4313
|
-
|
|
4399
|
+
_b = result.display;
|
|
4314
4400
|
return [4 /*yield*/, val];
|
|
4315
4401
|
case 2:
|
|
4316
|
-
|
|
4402
|
+
_b.value = _d.sent();
|
|
4317
4403
|
return [3 /*break*/, 4];
|
|
4318
4404
|
case 3:
|
|
4319
4405
|
result.display.value = val;
|
|
4320
|
-
|
|
4406
|
+
_d.label = 4;
|
|
4321
4407
|
case 4: return [3 /*break*/, 9];
|
|
4322
4408
|
case 5:
|
|
4323
4409
|
if (column.type === 'date' || column.type === 'datetime') {
|
|
@@ -4355,22 +4441,22 @@
|
|
|
4355
4441
|
result.display.value = Date.toFormat(value, 'HH:mm');
|
|
4356
4442
|
}
|
|
4357
4443
|
if (!(column.type === 'values')) return [3 /*break*/, 7];
|
|
4358
|
-
|
|
4444
|
+
_c = result.display;
|
|
4445
|
+
return [4 /*yield*/, this.columnValuesPipe.transform(value, column)];
|
|
4359
4446
|
case 6:
|
|
4360
|
-
|
|
4361
|
-
result.display.value = (_c = (_a = data.obj[value]) === null || _a === void 0 ? void 0 : _a[(_b = column.option) === null || _b === void 0 ? void 0 : _b.displayField]) !== null && _c !== void 0 ? _c : value;
|
|
4447
|
+
_c.value = _d.sent();
|
|
4362
4448
|
return [3 /*break*/, 8];
|
|
4363
4449
|
case 7:
|
|
4364
4450
|
if (column.type === 'number' && Number.isNumber(value)) {
|
|
4365
4451
|
result.display.value = Number.toVNCurrency(value);
|
|
4366
4452
|
}
|
|
4367
|
-
|
|
4453
|
+
_d.label = 8;
|
|
4368
4454
|
case 8:
|
|
4369
4455
|
if (column.type === 'bool') {
|
|
4370
4456
|
option = column.option;
|
|
4371
4457
|
result.display.value = value === true ? ((option === null || option === void 0 ? void 0 : option.displayOnTrue) || 'True') : ((option === null || option === void 0 ? void 0 : option.displayOnFalse) || 'False');
|
|
4372
4458
|
}
|
|
4373
|
-
|
|
4459
|
+
_d.label = 9;
|
|
4374
4460
|
case 9:
|
|
4375
4461
|
if (displayOnEmpty && (result.display.value === null || result.display.value === undefined || result.display.value === '')) {
|
|
4376
4462
|
if (typeof (displayOnEmpty) === 'function') {
|
|
@@ -4382,14 +4468,14 @@
|
|
|
4382
4468
|
result.display.html = "<div class=\"T16R text-black400\">--</div>";
|
|
4383
4469
|
}
|
|
4384
4470
|
}
|
|
4385
|
-
|
|
4471
|
+
_d.label = 10;
|
|
4386
4472
|
case 10:
|
|
4387
4473
|
// Badge
|
|
4388
4474
|
if ((column.type === 'string' || column.type === 'number' || column.type === 'values') && column.badge) {
|
|
4389
4475
|
result.badge = {
|
|
4390
4476
|
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
4391
4477
|
color: column.badge(value, rowData),
|
|
4392
|
-
icon: (
|
|
4478
|
+
icon: (_a = column === null || column === void 0 ? void 0 : column.badgeIcon) === null || _a === void 0 ? void 0 : _a.call(column, value, rowData)
|
|
4393
4479
|
};
|
|
4394
4480
|
}
|
|
4395
4481
|
else if (column.type === 'bool') {
|
|
@@ -4423,7 +4509,7 @@
|
|
|
4423
4509
|
SdCellViewPipe.ctorParameters = function () { return [
|
|
4424
4510
|
{ type: ngxDeviceDetector.DeviceDetectorService },
|
|
4425
4511
|
{ type: utility.SdUtilityService },
|
|
4426
|
-
{ type:
|
|
4512
|
+
{ type: SdColumnValuesPipe }
|
|
4427
4513
|
]; };
|
|
4428
4514
|
|
|
4429
4515
|
var MatPaginatorIntlCro = /** @class */ (function (_super) {
|
|
@@ -4548,6 +4634,7 @@
|
|
|
4548
4634
|
SdGridFilterService,
|
|
4549
4635
|
SdGridConfigurationService,
|
|
4550
4636
|
SdGeneratedColumnService,
|
|
4637
|
+
SdColumnValuesPipe,
|
|
4551
4638
|
{
|
|
4552
4639
|
provide: paginator.MatPaginatorIntl, useClass: MatPaginatorIntlCro
|
|
4553
4640
|
}
|
|
@@ -4569,9 +4656,9 @@
|
|
|
4569
4656
|
exports.ɵa = MatPaginatorIntlCro;
|
|
4570
4657
|
exports.ɵb = SdGridFilter;
|
|
4571
4658
|
exports.ɵba = SdCommandTitlePipe;
|
|
4572
|
-
exports.ɵbb =
|
|
4573
|
-
exports.ɵbc =
|
|
4574
|
-
exports.ɵbd =
|
|
4659
|
+
exports.ɵbb = SdColumnHtmlTemplatePipe;
|
|
4660
|
+
exports.ɵbc = SdColumnTransformPipe;
|
|
4661
|
+
exports.ɵbd = SdGridService;
|
|
4575
4662
|
exports.ɵbe = SdColumnTooltipPipe;
|
|
4576
4663
|
exports.ɵbf = SdColumnBadgePipe;
|
|
4577
4664
|
exports.ɵbg = SdFilterColumnPipe;
|
|
@@ -4591,7 +4678,7 @@
|
|
|
4591
4678
|
exports.ɵe = SdPopupExport;
|
|
4592
4679
|
exports.ɵg = GRID_MATERIAL_CONFIG;
|
|
4593
4680
|
exports.ɵh = SdGridConfigurationService;
|
|
4594
|
-
exports.ɵi =
|
|
4681
|
+
exports.ɵi = SdColumnValuesPipe;
|
|
4595
4682
|
exports.ɵj = SdGridQuickAction;
|
|
4596
4683
|
exports.ɵk = SdDesktopCell;
|
|
4597
4684
|
exports.ɵl = SdDesktopCellEditor;
|