@sd-angular/core 1.3.146 → 1.3.148
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/bundles/sd-angular-core-grid-material.umd.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-table.umd.js +4077 -0
- package/bundles/sd-angular-core-table.umd.js.map +1 -0
- package/bundles/sd-angular-core-table.umd.min.js +2 -0
- package/bundles/sd-angular-core-table.umd.min.js.map +1 -0
- package/bundles/sd-angular-core.umd.js +6 -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/grid-material/src/lib/components/column-inline-filter/column-inline-filter.component.js +2 -2
- package/esm2015/lib/core.module.js +4 -1
- package/esm2015/public-api.js +2 -1
- package/esm2015/table/index.js +2 -0
- package/esm2015/table/sd-angular-core-table.js +40 -0
- package/esm2015/table/src/lib/components/column-inline-filter/column-inline-filter.component.js +96 -0
- package/esm2015/table/src/lib/components/desktop-cell/desktop-cell.component.js +25 -0
- package/esm2015/table/src/lib/components/desktop-cell-view/desktop-cell-view.component.js +21 -0
- package/esm2015/table/src/lib/components/desktop-command/desktop-command.component.js +20 -0
- package/esm2015/table/src/lib/components/grid-filter/grid-filter.component.js +99 -0
- package/esm2015/table/src/lib/components/popup-filter/popup-filter.component.js +79 -0
- package/esm2015/table/src/lib/components/popup-grid-configuration/popup-grid-configuration.component.js +96 -0
- package/esm2015/table/src/lib/components/quick-action/quick-action.component.js +24 -0
- package/esm2015/table/src/lib/directives/sd-material-cell-def.directive.js +18 -0
- package/esm2015/table/src/lib/directives/sd-material-empty-data-def.directive.js +15 -0
- package/esm2015/table/src/lib/directives/sd-material-filter-def.directive.js +22 -0
- package/esm2015/table/src/lib/directives/sd-material-footer-def.directive.js +18 -0
- package/esm2015/table/src/lib/directives/sd-material-sub-information-def.directive.js +15 -0
- package/esm2015/table/src/lib/models/grid-cell.model.js +2 -0
- package/esm2015/table/src/lib/models/index.js +4 -0
- package/esm2015/table/src/lib/models/table-column.model.js +63 -0
- package/esm2015/table/src/lib/models/table-command.model.js +2 -0
- package/esm2015/table/src/lib/models/table-configuration.model.js +9 -0
- package/esm2015/table/src/lib/models/table-item.model.js +15 -0
- package/esm2015/table/src/lib/models/table-option-config.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-expand.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-export.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-group.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-paginate.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-reload.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-selector.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-sort.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option-style.model.js +2 -0
- package/esm2015/table/src/lib/models/table-option.model.js +2 -0
- package/esm2015/table/src/lib/pipes/cell-view.pipe.js +180 -0
- package/esm2015/table/src/lib/pipes/column-badge.pipe.js +43 -0
- package/esm2015/table/src/lib/pipes/column-children-filter.pipe.js +31 -0
- package/esm2015/table/src/lib/pipes/column-html-template.pipe.js +23 -0
- package/esm2015/table/src/lib/pipes/column-tooltip.pipe.js +17 -0
- package/esm2015/table/src/lib/pipes/column-transform.pipe.js +35 -0
- package/esm2015/table/src/lib/pipes/column-values.pipe.js +63 -0
- package/esm2015/table/src/lib/pipes/command-disable.pipe.js +18 -0
- package/esm2015/table/src/lib/pipes/command-filter.pipe.js +79 -0
- package/esm2015/table/src/lib/pipes/command-icon.pipe.js +18 -0
- package/esm2015/table/src/lib/pipes/command-title.pipe.js +18 -0
- package/esm2015/table/src/lib/pipes/filter-column.pipe.js +30 -0
- package/esm2015/table/src/lib/pipes/filter-external.pipe.js +19 -0
- package/esm2015/table/src/lib/pipes/grid-configuration-result.pipe.js +21 -0
- package/esm2015/table/src/lib/pipes/sd-group.pipe.js +45 -0
- package/esm2015/table/src/lib/pipes/selection-action-filter.pipe.js +72 -0
- package/esm2015/table/src/lib/pipes/selection-disable.pipe.js +55 -0
- package/esm2015/table/src/lib/pipes/selection-visible-select-all.pipe.js +34 -0
- package/esm2015/table/src/lib/pipes/selection-visible.pipe.js +82 -0
- package/esm2015/table/src/lib/services/table-configuration.service.js +292 -0
- package/esm2015/table/src/lib/services/table-filter/table-filter.model.js +3 -0
- package/esm2015/table/src/lib/services/table-filter/table-filter.service.js +229 -0
- package/esm2015/table/src/lib/table.component.js +832 -0
- package/esm2015/table/src/lib/table.module.js +175 -0
- package/esm2015/table/src/public-api.js +5 -0
- package/fesm2015/sd-angular-core-grid-material.js +1 -1
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-table.js +2927 -0
- package/fesm2015/sd-angular-core-table.js.map +1 -0
- package/fesm2015/sd-angular-core.js +3 -0
- package/fesm2015/sd-angular-core.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/{sd-angular-core-1.3.146.tgz → sd-angular-core-1.3.148.tgz} +0 -0
- package/sd-angular-core.metadata.json +1 -1
- package/table/index.d.ts +1 -0
- package/table/package.json +12 -0
- package/table/sd-angular-core-table.d.ts +39 -0
- package/table/sd-angular-core-table.metadata.json +1 -0
- package/table/src/lib/components/column-inline-filter/column-inline-filter.component.d.ts +29 -0
- package/table/src/lib/components/desktop-cell/desktop-cell.component.d.ts +17 -0
- package/table/src/lib/components/desktop-cell-view/desktop-cell-view.component.d.ts +11 -0
- package/table/src/lib/components/desktop-command/desktop-command.component.d.ts +7 -0
- package/table/src/lib/components/grid-filter/grid-filter.component.d.ts +35 -0
- package/table/src/lib/components/popup-filter/popup-filter.component.d.ts +27 -0
- package/table/src/lib/components/popup-grid-configuration/popup-grid-configuration.component.d.ts +39 -0
- package/table/src/lib/components/quick-action/quick-action.component.d.ts +9 -0
- package/table/src/lib/directives/sd-material-cell-def.directive.d.ts +6 -0
- package/table/src/lib/directives/sd-material-empty-data-def.directive.d.ts +5 -0
- package/table/src/lib/directives/sd-material-filter-def.directive.d.ts +8 -0
- package/table/src/lib/directives/sd-material-footer-def.directive.d.ts +6 -0
- package/table/src/lib/directives/sd-material-sub-information-def.directive.d.ts +5 -0
- package/table/src/lib/models/grid-cell.model.d.ts +16 -0
- package/table/src/lib/models/index.d.ts +3 -0
- package/table/src/lib/models/table-column.model.d.ts +125 -0
- package/table/src/lib/models/table-command.model.d.ts +19 -0
- package/table/src/lib/models/table-configuration.model.d.ts +20 -0
- package/table/src/lib/models/table-item.model.d.ts +25 -0
- package/table/src/lib/models/table-option-config.model.d.ts +62 -0
- package/table/src/lib/models/table-option-expand.model.d.ts +6 -0
- package/table/src/lib/models/table-option-export.model.d.ts +31 -0
- package/table/src/lib/models/table-option-group.model.d.ts +4 -0
- package/table/src/lib/models/table-option-paginate.model.d.ts +6 -0
- package/table/src/lib/models/table-option-reload.model.d.ts +5 -0
- package/table/src/lib/models/table-option-selector.model.d.ts +32 -0
- package/table/src/lib/models/table-option-sort.model.d.ts +3 -0
- package/table/src/lib/models/table-option-style.model.d.ts +6 -0
- package/table/src/lib/models/table-option.model.d.ts +44 -0
- package/table/src/lib/pipes/cell-view.pipe.d.ts +15 -0
- package/table/src/lib/pipes/column-badge.pipe.d.ts +11 -0
- package/table/src/lib/pipes/column-children-filter.pipe.d.ts +8 -0
- package/table/src/lib/pipes/column-html-template.pipe.d.ts +8 -0
- package/table/src/lib/pipes/column-tooltip.pipe.d.ts +6 -0
- package/table/src/lib/pipes/column-transform.pipe.d.ts +8 -0
- package/table/src/lib/pipes/column-values.pipe.d.ts +6 -0
- package/table/src/lib/pipes/command-disable.pipe.d.ts +5 -0
- package/table/src/lib/pipes/command-filter.pipe.d.ts +6 -0
- package/table/src/lib/pipes/command-icon.pipe.d.ts +5 -0
- package/table/src/lib/pipes/command-title.pipe.d.ts +5 -0
- package/table/src/lib/pipes/filter-column.pipe.d.ts +5 -0
- package/table/src/lib/pipes/filter-external.pipe.d.ts +5 -0
- package/table/src/lib/pipes/grid-configuration-result.pipe.d.ts +10 -0
- package/table/src/lib/pipes/sd-group.pipe.d.ts +6 -0
- package/table/src/lib/pipes/selection-action-filter.pipe.d.ts +7 -0
- package/table/src/lib/pipes/selection-disable.pipe.d.ts +6 -0
- package/table/src/lib/pipes/selection-visible-select-all.pipe.d.ts +6 -0
- package/table/src/lib/pipes/selection-visible.pipe.d.ts +6 -0
- package/table/src/lib/services/table-configuration.service.d.ts +13 -0
- package/table/src/lib/services/table-filter/table-filter.model.d.ts +117 -0
- package/table/src/lib/services/table-filter/table-filter.service.d.ts +15 -0
- package/table/src/lib/table.component.d.ts +87 -0
- package/table/src/lib/table.module.d.ts +11 -0
- package/table/src/public-api.d.ts +5 -0
|
@@ -0,0 +1,4077 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sd-angular/core/common'), require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/input'), require('@angular/material/paginator'), require('@angular/material/sort'), require('@angular/animations'), require('uuid'), require('rxjs'), require('@sd-angular/core/notify'), require('rxjs/operators'), require('@sd-angular/core/modal'), require('ngx-device-detector'), require('@sd-angular/core/export'), require('object-hash'), require('@sd-angular/core/setting'), require('@sd-angular/core/quick-action'), require('@angular/material/table'), require('@angular/material/progress-spinner'), require('@angular/cdk/table'), require('@angular/cdk/scrolling'), require('@angular/cdk/drag-drop'), require('@angular/material/menu'), require('@angular/material/slider'), require('@angular/material/button'), 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('@sd-angular/core/translate'), require('@angular/material/list'), require('@angular/material/divider'), require('@sd-angular/core/utility'), require('@sd-angular/core/group')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@sd-angular/core/table', ['exports', '@sd-angular/core/common', '@angular/core', '@angular/common', '@angular/forms', '@angular/material/form-field', '@angular/material/icon', '@angular/material/input', '@angular/material/paginator', '@angular/material/sort', '@angular/animations', 'uuid', 'rxjs', '@sd-angular/core/notify', 'rxjs/operators', '@sd-angular/core/modal', 'ngx-device-detector', '@sd-angular/core/export', 'object-hash', '@sd-angular/core/setting', '@sd-angular/core/quick-action', '@angular/material/table', '@angular/material/progress-spinner', '@angular/cdk/table', '@angular/cdk/scrolling', '@angular/cdk/drag-drop', '@angular/material/menu', '@angular/material/slider', '@angular/material/button', '@sd-angular/core/service', '@angular/material/tooltip', '@angular/material/chips', '@angular/material/radio', '@angular/material/slide-toggle', '@sd-angular/core/form', '@angular/material/checkbox', '@sd-angular/core/translate', '@angular/material/list', '@angular/material/divider', '@sd-angular/core/utility', '@sd-angular/core/group'], 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.table = {}), global['sd-angular'].core.common, global.ng.core, global.ng.common, global.ng.forms, global.ng.material.formField, global.ng.material.icon, global.ng.material.input, global.ng.material.paginator, global.ng.material.sort, global.ng.animations, global.uuid, global.rxjs, global['sd-angular'].core.notify, global.rxjs.operators, global['sd-angular'].core.modal, global['ngx-device-detector'], global['sd-angular'].core.export, global['object-hash'], global['sd-angular'].core.setting, global['sd-angular'].core['quick-action'], global.ng.material.table, global.ng.material.progressSpinner, global.ng.cdk.table, global.ng.cdk.scrolling, global.ng.cdk.dragDrop, global.ng.material.menu, global.ng.material.slider, global.ng.material.button, 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['sd-angular'].core.translate, global.ng.material.list, global.ng.material.divider, global['sd-angular'].core.utility, global['sd-angular'].core.group));
|
|
5
|
+
}(this, (function (exports, common, core, common$1, forms, formField, icon, input, paginator, sort, animations, uuid, rxjs, notify, operators, modal, ngxDeviceDetector, _export, hash, setting, quickAction, table, progressSpinner, table$1, scrolling, dragDrop, menu, slider, button, service, tooltip, chips, radio, slideToggle, form, checkbox, translate, list, divider, utility, group) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) { return e; } else {
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return e[k];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n['default'] = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
|
|
31
|
+
var hash__namespace = /*#__PURE__*/_interopNamespace(hash);
|
|
32
|
+
|
|
33
|
+
/*! *****************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
/* global Reflect, Promise */
|
|
48
|
+
var extendStatics = function (d, b) {
|
|
49
|
+
extendStatics = Object.setPrototypeOf ||
|
|
50
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
51
|
+
function (d, b) { for (var p in b)
|
|
52
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
53
|
+
d[p] = b[p]; };
|
|
54
|
+
return extendStatics(d, b);
|
|
55
|
+
};
|
|
56
|
+
function __extends(d, b) {
|
|
57
|
+
if (typeof b !== "function" && b !== null)
|
|
58
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
59
|
+
extendStatics(d, b);
|
|
60
|
+
function __() { this.constructor = d; }
|
|
61
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
62
|
+
}
|
|
63
|
+
var __assign = function () {
|
|
64
|
+
__assign = Object.assign || function __assign(t) {
|
|
65
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
66
|
+
s = arguments[i];
|
|
67
|
+
for (var p in s)
|
|
68
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
69
|
+
t[p] = s[p];
|
|
70
|
+
}
|
|
71
|
+
return t;
|
|
72
|
+
};
|
|
73
|
+
return __assign.apply(this, arguments);
|
|
74
|
+
};
|
|
75
|
+
function __rest(s, e) {
|
|
76
|
+
var t = {};
|
|
77
|
+
for (var p in s)
|
|
78
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
79
|
+
t[p] = s[p];
|
|
80
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
81
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
82
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
83
|
+
t[p[i]] = s[p[i]];
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}
|
|
87
|
+
function __decorate(decorators, target, key, desc) {
|
|
88
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
89
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
90
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
91
|
+
else
|
|
92
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
93
|
+
if (d = decorators[i])
|
|
94
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
95
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
96
|
+
}
|
|
97
|
+
function __param(paramIndex, decorator) {
|
|
98
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
99
|
+
}
|
|
100
|
+
function __metadata(metadataKey, metadataValue) {
|
|
101
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
102
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
103
|
+
}
|
|
104
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
105
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
106
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
107
|
+
function fulfilled(value) { try {
|
|
108
|
+
step(generator.next(value));
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
reject(e);
|
|
112
|
+
} }
|
|
113
|
+
function rejected(value) { try {
|
|
114
|
+
step(generator["throw"](value));
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
reject(e);
|
|
118
|
+
} }
|
|
119
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
120
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function __generator(thisArg, body) {
|
|
124
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
125
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
126
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
127
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
128
|
+
function step(op) {
|
|
129
|
+
if (f)
|
|
130
|
+
throw new TypeError("Generator is already executing.");
|
|
131
|
+
while (_)
|
|
132
|
+
try {
|
|
133
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
134
|
+
return t;
|
|
135
|
+
if (y = 0, t)
|
|
136
|
+
op = [op[0] & 2, t.value];
|
|
137
|
+
switch (op[0]) {
|
|
138
|
+
case 0:
|
|
139
|
+
case 1:
|
|
140
|
+
t = op;
|
|
141
|
+
break;
|
|
142
|
+
case 4:
|
|
143
|
+
_.label++;
|
|
144
|
+
return { value: op[1], done: false };
|
|
145
|
+
case 5:
|
|
146
|
+
_.label++;
|
|
147
|
+
y = op[1];
|
|
148
|
+
op = [0];
|
|
149
|
+
continue;
|
|
150
|
+
case 7:
|
|
151
|
+
op = _.ops.pop();
|
|
152
|
+
_.trys.pop();
|
|
153
|
+
continue;
|
|
154
|
+
default:
|
|
155
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
156
|
+
_ = 0;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
160
|
+
_.label = op[1];
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
164
|
+
_.label = t[1];
|
|
165
|
+
t = op;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
if (t && _.label < t[2]) {
|
|
169
|
+
_.label = t[2];
|
|
170
|
+
_.ops.push(op);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
if (t[2])
|
|
174
|
+
_.ops.pop();
|
|
175
|
+
_.trys.pop();
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
op = body.call(thisArg, _);
|
|
179
|
+
}
|
|
180
|
+
catch (e) {
|
|
181
|
+
op = [6, e];
|
|
182
|
+
y = 0;
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
f = t = 0;
|
|
186
|
+
}
|
|
187
|
+
if (op[0] & 5)
|
|
188
|
+
throw op[1];
|
|
189
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
193
|
+
if (k2 === undefined)
|
|
194
|
+
k2 = k;
|
|
195
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
196
|
+
}) : (function (o, m, k, k2) {
|
|
197
|
+
if (k2 === undefined)
|
|
198
|
+
k2 = k;
|
|
199
|
+
o[k2] = m[k];
|
|
200
|
+
});
|
|
201
|
+
function __exportStar(m, o) {
|
|
202
|
+
for (var p in m)
|
|
203
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
204
|
+
__createBinding(o, m, p);
|
|
205
|
+
}
|
|
206
|
+
function __values(o) {
|
|
207
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
208
|
+
if (m)
|
|
209
|
+
return m.call(o);
|
|
210
|
+
if (o && typeof o.length === "number")
|
|
211
|
+
return {
|
|
212
|
+
next: function () {
|
|
213
|
+
if (o && i >= o.length)
|
|
214
|
+
o = void 0;
|
|
215
|
+
return { value: o && o[i++], done: !o };
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
219
|
+
}
|
|
220
|
+
function __read(o, n) {
|
|
221
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
222
|
+
if (!m)
|
|
223
|
+
return o;
|
|
224
|
+
var i = m.call(o), r, ar = [], e;
|
|
225
|
+
try {
|
|
226
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
227
|
+
ar.push(r.value);
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
e = { error: error };
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
try {
|
|
234
|
+
if (r && !r.done && (m = i["return"]))
|
|
235
|
+
m.call(i);
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
if (e)
|
|
239
|
+
throw e.error;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return ar;
|
|
243
|
+
}
|
|
244
|
+
/** @deprecated */
|
|
245
|
+
function __spread() {
|
|
246
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
247
|
+
ar = ar.concat(__read(arguments[i]));
|
|
248
|
+
return ar;
|
|
249
|
+
}
|
|
250
|
+
/** @deprecated */
|
|
251
|
+
function __spreadArrays() {
|
|
252
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
253
|
+
s += arguments[i].length;
|
|
254
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
255
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
256
|
+
r[k] = a[j];
|
|
257
|
+
return r;
|
|
258
|
+
}
|
|
259
|
+
function __spreadArray(to, from, pack) {
|
|
260
|
+
if (pack || arguments.length === 2)
|
|
261
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
262
|
+
if (ar || !(i in from)) {
|
|
263
|
+
if (!ar)
|
|
264
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
265
|
+
ar[i] = from[i];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
269
|
+
}
|
|
270
|
+
function __await(v) {
|
|
271
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
272
|
+
}
|
|
273
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
274
|
+
if (!Symbol.asyncIterator)
|
|
275
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
276
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
277
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
278
|
+
function verb(n) { if (g[n])
|
|
279
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
280
|
+
function resume(n, v) { try {
|
|
281
|
+
step(g[n](v));
|
|
282
|
+
}
|
|
283
|
+
catch (e) {
|
|
284
|
+
settle(q[0][3], e);
|
|
285
|
+
} }
|
|
286
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
287
|
+
function fulfill(value) { resume("next", value); }
|
|
288
|
+
function reject(value) { resume("throw", value); }
|
|
289
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
290
|
+
resume(q[0][0], q[0][1]); }
|
|
291
|
+
}
|
|
292
|
+
function __asyncDelegator(o) {
|
|
293
|
+
var i, p;
|
|
294
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
295
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
296
|
+
}
|
|
297
|
+
function __asyncValues(o) {
|
|
298
|
+
if (!Symbol.asyncIterator)
|
|
299
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
300
|
+
var m = o[Symbol.asyncIterator], i;
|
|
301
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
302
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
303
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
304
|
+
}
|
|
305
|
+
function __makeTemplateObject(cooked, raw) {
|
|
306
|
+
if (Object.defineProperty) {
|
|
307
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
cooked.raw = raw;
|
|
311
|
+
}
|
|
312
|
+
return cooked;
|
|
313
|
+
}
|
|
314
|
+
;
|
|
315
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
316
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
317
|
+
}) : function (o, v) {
|
|
318
|
+
o["default"] = v;
|
|
319
|
+
};
|
|
320
|
+
function __importStar(mod) {
|
|
321
|
+
if (mod && mod.__esModule)
|
|
322
|
+
return mod;
|
|
323
|
+
var result = {};
|
|
324
|
+
if (mod != null)
|
|
325
|
+
for (var k in mod)
|
|
326
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
327
|
+
__createBinding(result, mod, k);
|
|
328
|
+
__setModuleDefault(result, mod);
|
|
329
|
+
return result;
|
|
330
|
+
}
|
|
331
|
+
function __importDefault(mod) {
|
|
332
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
333
|
+
}
|
|
334
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
335
|
+
if (kind === "a" && !f)
|
|
336
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
337
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
338
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
339
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
340
|
+
}
|
|
341
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
342
|
+
if (kind === "m")
|
|
343
|
+
throw new TypeError("Private method is not writable");
|
|
344
|
+
if (kind === "a" && !f)
|
|
345
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
346
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
347
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
348
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
var DEFAULT_TABLE_CONFIG = {
|
|
352
|
+
paginate: {
|
|
353
|
+
pageSize: 50,
|
|
354
|
+
pages: [50, 100, 200]
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
var TABLE_CONFIG = new core.InjectionToken('sd-table.configuration');
|
|
358
|
+
|
|
359
|
+
var SdMaterialCellDefDirective = /** @class */ (function () {
|
|
360
|
+
function SdMaterialCellDefDirective(templateRef) {
|
|
361
|
+
this.templateRef = templateRef;
|
|
362
|
+
}
|
|
363
|
+
return SdMaterialCellDefDirective;
|
|
364
|
+
}());
|
|
365
|
+
SdMaterialCellDefDirective.decorators = [
|
|
366
|
+
{ type: core.Directive, args: [{
|
|
367
|
+
selector: '[sdMaterialCellDef]'
|
|
368
|
+
},] }
|
|
369
|
+
];
|
|
370
|
+
SdMaterialCellDefDirective.ctorParameters = function () { return [
|
|
371
|
+
{ type: core.TemplateRef }
|
|
372
|
+
]; };
|
|
373
|
+
SdMaterialCellDefDirective.propDecorators = {
|
|
374
|
+
sdMaterialCellDef: [{ type: core.Input }]
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
var _filterRegister;
|
|
378
|
+
var SdPopupFilter = /** @class */ (function () {
|
|
379
|
+
function SdPopupFilter(cdRef) {
|
|
380
|
+
var _this = this;
|
|
381
|
+
this.cdRef = cdRef;
|
|
382
|
+
_filterRegister.set(this, void 0);
|
|
383
|
+
this.externalFilters = [];
|
|
384
|
+
this.externalFilter = {};
|
|
385
|
+
this.inlineExternal = {};
|
|
386
|
+
this.columns = [];
|
|
387
|
+
this.columnFilter = {};
|
|
388
|
+
this.inlineColumn = {};
|
|
389
|
+
this.filterDefs = [];
|
|
390
|
+
this.filterDef = {};
|
|
391
|
+
this.inlineFilterDef = {};
|
|
392
|
+
this.open = function () {
|
|
393
|
+
var configuration = __classPrivateFieldGet(_this, _filterRegister).configuration.get();
|
|
394
|
+
_this.inlineColumn = JSON.parse(JSON.stringify(configuration.inlineColumn));
|
|
395
|
+
_this.inlineExternal = JSON.parse(JSON.stringify(configuration.inlineExternal));
|
|
396
|
+
_this.inlineFilterDef = JSON.parse(JSON.stringify(configuration.inlineFilterDef));
|
|
397
|
+
var filterValue = __classPrivateFieldGet(_this, _filterRegister).value.get();
|
|
398
|
+
_this.columnFilter = JSON.parse(JSON.stringify(filterValue.columnFilter));
|
|
399
|
+
_this.externalFilter = JSON.parse(JSON.stringify(filterValue.externalFilter));
|
|
400
|
+
_this.filterDef = JSON.parse(JSON.stringify(filterValue.filterDef));
|
|
401
|
+
_this.modal.open();
|
|
402
|
+
_this.cdRef.markForCheck();
|
|
403
|
+
};
|
|
404
|
+
this.close = function () {
|
|
405
|
+
_this.modal.close();
|
|
406
|
+
_this.cdRef.markForCheck();
|
|
407
|
+
};
|
|
408
|
+
this.onApply = function () {
|
|
409
|
+
__classPrivateFieldGet(_this, _filterRegister).configuration.set({
|
|
410
|
+
inlineColumn: _this.inlineColumn,
|
|
411
|
+
inlineExternal: _this.inlineExternal,
|
|
412
|
+
inlineFilterDef: _this.inlineFilterDef,
|
|
413
|
+
});
|
|
414
|
+
__classPrivateFieldGet(_this, _filterRegister).value.set({
|
|
415
|
+
columnFilter: _this.columnFilter,
|
|
416
|
+
externalFilter: _this.externalFilter,
|
|
417
|
+
filterDef: _this.filterDef,
|
|
418
|
+
});
|
|
419
|
+
_this.modal.close();
|
|
420
|
+
_this.cdRef.markForCheck();
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
Object.defineProperty(SdPopupFilter.prototype, "filterRegister", {
|
|
424
|
+
set: function (value) {
|
|
425
|
+
__classPrivateFieldSet(this, _filterRegister, value);
|
|
426
|
+
},
|
|
427
|
+
enumerable: false,
|
|
428
|
+
configurable: true
|
|
429
|
+
});
|
|
430
|
+
SdPopupFilter.prototype.ngAfterViewInit = function () { };
|
|
431
|
+
SdPopupFilter.prototype.ngOnDestroy = function () { };
|
|
432
|
+
SdPopupFilter.prototype.onClear = function () {
|
|
433
|
+
__classPrivateFieldGet(this, _filterRegister).value.remove();
|
|
434
|
+
this.modal.close();
|
|
435
|
+
this.cdRef.markForCheck();
|
|
436
|
+
};
|
|
437
|
+
return SdPopupFilter;
|
|
438
|
+
}());
|
|
439
|
+
_filterRegister = new WeakMap();
|
|
440
|
+
SdPopupFilter.decorators = [
|
|
441
|
+
{ type: core.Component, args: [{
|
|
442
|
+
selector: 'sd-popup-filter',
|
|
443
|
+
template: "<sd-modal width=\"500px\" [title]=\"'Filter' | sdTranslate\">\r\n <sd-modal-body class=\"c-popup-filter\">\r\n <ng-container *ngFor=\"let column of columns | sdFilterColumn\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineColumn[column.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n *ngIf=\"column.type === 'string'\"\r\n [label]=\"column.title\"\r\n type=\"text\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input\r\n *ngIf=\"column.type === 'number'\"\r\n [label]=\"column.title\"\r\n type=\" number\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-select\r\n *ngIf=\"column.type === 'bool'\"\r\n [label]=\"column.title\"\r\n [items]=\"[\r\n { value: '1', display: column.trueValue || 'True' },\r\n { value: '0', display: column.falseValue || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"column.type === 'values' && !column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"column.type === 'values' && column?.editor?.autocomplete\"\r\n [label]=\"column.title\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time\r\n *ngIf=\"column.type === 'date' || column.type === 'datetime' || column.type === 'time'\"\r\n [label]=\"column.title\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n type=\"date\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineExternal[item.field]\" color=\"primary\"></mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <sd-input\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'string'\"\r\n type=\"text\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'bool'\"\r\n [items]=\"[\r\n { value: '1', display: item.option?.displayOnTrue || 'True' },\r\n { value: '0', display: item.option?.displayOnFalse || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values'\">\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-autocomplete>\r\n <sd-select\r\n *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [label]=\"item.title\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n filtered=\"true\"\r\n multiple>\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"!item.option?.selection\"\r\n [label]=\"item.title\"\r\n [items]=\"item.values\"\r\n [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\"\r\n [displayField]=\"item.option.displayField\"\r\n appearance=\"outline\"\r\n [(model)]=\"externalFilter[item.field]\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'date' || item.type === 'datetime'\"\r\n [(model)]=\"externalFilter[item.field]\"\r\n [type]=\"item.type\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range\r\n [label]=\"item.title\"\r\n *ngIf=\"item.type === 'daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\"\r\n [(to)]=\"externalFilter[item.field].to\"\r\n [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\"\r\n appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngFor=\"let filter of filterDefs\">\r\n <div class=\"d-flex align-items-baseline\">\r\n <ng-container>\r\n <div *sdDesktop class=\"c-checkable\">\r\n <mat-slide-toggle [(ngModel)]=\"inlineFilterDef[filter.sdMaterialFilterDef]\" color=\"primary\"> </mat-slide-toggle>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-filterable\">\r\n <ng-container *ngTemplateOutlet=\"filter.templateRef; context: { filterDef: filterDef }\"> </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </sd-modal-body>\r\n <sd-modal-footer *sdDesktop>\r\n <sd-button class=\"mr-auto\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" size=\"sm\" type=\"link\"> </sd-button>\r\n <sd-button (action)=\"onApply()\" title=\"\u0110\u1ED3ng \u00FD\" color=\"primary\" size=\"sm\" type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n <sd-modal-footer *sdMobileTablet>\r\n <sd-button style=\"flex: 1; padding-right: 5px\" (action)=\"onClear()\" title=\"M\u1EB7c \u0111\u1ECBnh\" width=\"100%\" size=\"sm\" type=\"link\"></sd-button>\r\n <sd-button\r\n style=\"flex: 1; padding-left: 5px\"\r\n (action)=\"onApply()\"\r\n title=\"\u0110\u1ED3ng \u00FD\"\r\n color=\"primary\"\r\n width=\"100%\"\r\n size=\"sm\"\r\n type=\"fill\"></sd-button>\r\n </sd-modal-footer>\r\n</sd-modal>\r\n",
|
|
444
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
445
|
+
styles: [".c-checkable{width:50px}.c-filterable{flex:1}::ng-deep sd-modal-body.c-popup-filter .mat-form-field-wrapper{padding-bottom:0}"]
|
|
446
|
+
},] }
|
|
447
|
+
];
|
|
448
|
+
SdPopupFilter.ctorParameters = function () { return [
|
|
449
|
+
{ type: core.ChangeDetectorRef }
|
|
450
|
+
]; };
|
|
451
|
+
SdPopupFilter.propDecorators = {
|
|
452
|
+
modal: [{ type: core.ViewChild, args: [modal.SdModal,] }],
|
|
453
|
+
filterRegister: [{ type: core.Input }],
|
|
454
|
+
externalFilters: [{ type: core.Input }],
|
|
455
|
+
columns: [{ type: core.Input }],
|
|
456
|
+
filterDefs: [{ type: core.Input }]
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
var _subscription;
|
|
460
|
+
var SdGridFilter = /** @class */ (function () {
|
|
461
|
+
function SdGridFilter(ref, deviceService) {
|
|
462
|
+
var _this = this;
|
|
463
|
+
this.ref = ref;
|
|
464
|
+
this.deviceService = deviceService;
|
|
465
|
+
this.columns = [];
|
|
466
|
+
this.externalFilters = [];
|
|
467
|
+
this.filterDefs = [];
|
|
468
|
+
this.filterRegisterChange = new rxjs.BehaviorSubject(null);
|
|
469
|
+
this.filterDef = {};
|
|
470
|
+
this.inlineFilterDef = {};
|
|
471
|
+
this.columnFilter = {};
|
|
472
|
+
this.inlineColumn = {};
|
|
473
|
+
this.externalFilter = {};
|
|
474
|
+
this.inlineExternal = {};
|
|
475
|
+
_subscription.set(this, new rxjs.Subscription());
|
|
476
|
+
this.onFilter = function (item) {
|
|
477
|
+
_this.filterRegister.value.set({
|
|
478
|
+
columnFilter: _this.columnFilter,
|
|
479
|
+
externalFilter: _this.externalFilter,
|
|
480
|
+
filterDef: _this.filterDef,
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
this.updateFilter = function () {
|
|
484
|
+
_this.filterRegister.value.set({
|
|
485
|
+
columnFilter: _this.columnFilter,
|
|
486
|
+
externalFilter: _this.externalFilter,
|
|
487
|
+
filterDef: _this.filterDef,
|
|
488
|
+
notReload: true
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
this.open = function () {
|
|
492
|
+
_this.popupFilter.open();
|
|
493
|
+
};
|
|
494
|
+
this.isMobileOrTablet = !this.deviceService.isDesktop();
|
|
495
|
+
this.ref.markForCheck();
|
|
496
|
+
}
|
|
497
|
+
Object.defineProperty(SdGridFilter.prototype, "_filter", {
|
|
498
|
+
set: function (filter) {
|
|
499
|
+
this.filter = filter;
|
|
500
|
+
},
|
|
501
|
+
enumerable: false,
|
|
502
|
+
configurable: true
|
|
503
|
+
});
|
|
504
|
+
Object.defineProperty(SdGridFilter.prototype, "_externalFilters", {
|
|
505
|
+
set: function (value) {
|
|
506
|
+
this.externalFilters = value || [];
|
|
507
|
+
},
|
|
508
|
+
enumerable: false,
|
|
509
|
+
configurable: true
|
|
510
|
+
});
|
|
511
|
+
Object.defineProperty(SdGridFilter.prototype, "_filterRegister", {
|
|
512
|
+
set: function (value) {
|
|
513
|
+
this.filterRegister = value;
|
|
514
|
+
this.filterRegisterChange.next(this.filterRegister);
|
|
515
|
+
},
|
|
516
|
+
enumerable: false,
|
|
517
|
+
configurable: true
|
|
518
|
+
});
|
|
519
|
+
SdGridFilter.prototype.ngAfterViewInit = function () {
|
|
520
|
+
var _this = this;
|
|
521
|
+
__classPrivateFieldGet(this, _subscription).add(this.filterRegisterChange.pipe(operators.startWith(this.filterRegister)).subscribe(function (filterRegister) {
|
|
522
|
+
if (_this.filterRegister) {
|
|
523
|
+
__classPrivateFieldGet(_this, _subscription).add(_this.filterRegister.configuration.observer.subscribe(function (configuration) {
|
|
524
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
525
|
+
_this.inlineColumn = inlineColumn;
|
|
526
|
+
_this.inlineExternal = inlineExternal;
|
|
527
|
+
_this.inlineFilterDef = inlineFilterDef;
|
|
528
|
+
_this.ref.markForCheck();
|
|
529
|
+
}));
|
|
530
|
+
__classPrivateFieldGet(_this, _subscription).add(_this.filterRegister.value.observer.subscribe(function (value) {
|
|
531
|
+
var columnFilter = value.columnFilter, externalFilter = value.externalFilter, filterDef = value.filterDef;
|
|
532
|
+
_this.columnFilter = columnFilter;
|
|
533
|
+
_this.externalFilter = externalFilter;
|
|
534
|
+
_this.filterDef = filterDef;
|
|
535
|
+
_this.ref.markForCheck();
|
|
536
|
+
}));
|
|
537
|
+
}
|
|
538
|
+
}));
|
|
539
|
+
};
|
|
540
|
+
SdGridFilter.prototype.ngOnDestroy = function () {
|
|
541
|
+
__classPrivateFieldGet(this, _subscription).unsubscribe();
|
|
542
|
+
};
|
|
543
|
+
return SdGridFilter;
|
|
544
|
+
}());
|
|
545
|
+
_subscription = new WeakMap();
|
|
546
|
+
SdGridFilter.decorators = [
|
|
547
|
+
{ type: core.Component, args: [{
|
|
548
|
+
selector: 'sd-grid-filter',
|
|
549
|
+
template: "<ng-container *ngIf=\"!filter?.disabled\">\r\n <ng-container *ngIf=\"filter?.enableCollapse;else noCollapse\">\r\n <sd-group class=\"p-12\" [isExpanded]=\"false\" title=\"T\u00ECm ki\u1EBFm\" expandable>\r\n <div sdGroupBody>\r\n <ng-container *ngTemplateOutlet=\"noCollapse\"></ng-container>\r\n </div>\r\n </sd-group>\r\n </ng-container>\r\n <ng-template #noCollapse>\r\n <div\r\n *ngIf=\"!isMobileOrTablet && ((columns?.length && !filter?.inlineColumn) || externalFilters?.length || filterDefs?.length)\"\r\n class=\"row mx-0\">\r\n <ng-container *ngIf=\"filter?.sorts?.length\">\r\n <ng-container *ngFor=\"let field of filter?.sorts\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn:field\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal:field\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef] && item.sdMaterialFilterDef === field\"\r\n class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"!filter?.sorts?.length\">\r\n <ng-container *ngIf=\"columns?.length && !filter?.inlineColumn\">\r\n <ng-container *ngFor=\"let item of columns | sdFilterColumn\">\r\n <ng-container *ngTemplateOutlet=\"filterColumn; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngIf=\"externalFilters?.length\">\r\n <ng-container *ngFor=\"let item of externalFilters | sdFilterExternal\">\r\n <ng-container *ngTemplateOutlet=\"filterExternal; context: {item: item}\"></ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngFor=\"let item of filterDefs\">\r\n <div *ngIf=\"inlineFilterDef[item.sdMaterialFilterDef]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <ng-container *ngTemplateOutlet=\"item.templateRef;context:{filterDef:filterDef, isInline: true}\">\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <ng-template #filterColumn let-item=\"item\">\r\n <div *ngIf=\"inlineColumn[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"columnFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-select *ngIf=\"item.type === 'values' && item?.option?.selection !== 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n [multiple]=\"item?.option?.selection === 'MULTIPLE' || item?.item?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [filtered]=\"item?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" appearance=\"outline\">\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.type === 'values' && item?.option?.selection === 'AUTOCOMPLETE'\"\r\n [items]=\"item.option?.items\" [valueField]=\"item.option?.valueField\" [displayField]=\"item.option?.displayField\"\r\n [(model)]=\"columnFilter[item.field]\" (sdChange)=\"onFilter(item)\" [disabled]=\"item.filter?.disabled\"\r\n appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-date-time *ngIf=\"item.type === 'date' || item.type === 'datetime' || item.type === 'time'\"\r\n [label]=\"item.title\" [(model)]=\"columnFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\"\r\n appearance=\"outline\">\r\n </sd-date-time>\r\n </div>\r\n </ng-template>\r\n <ng-template #filterExternal let-item=\"item\">\r\n <div *ngIf=\"inlineExternal[item.field]\" class=\"col-lg-2 col-md-3 col-sm-6 px-8\">\r\n <sd-input [label]=\"item.title\" *ngIf=\"item.type === 'string'\" type=\"text\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input>\r\n <sd-input-number [label]=\"item.title\" *ngIf=\"item.type === 'number'\" [(model)]=\"externalFilter[item.field]\"\r\n (keyupEnter)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-input-number>\r\n <sd-select [label]=\"item.title\" *ngIf=\"item.type === 'bool'\" [items]=\"[{value:'1',display:item.option?.displayOnTrue || 'True' },\r\n {value:'0',display:item.option?.displayOnFalse || 'False' }]\" valueField=\"value\" displayField=\"display\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n <ng-container *ngIf=\"item.type === 'values' && item.option\">\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLE'\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" [selectAll]=\"item.option.selectAll\"\r\n appearance=\"outline\" multiple>\r\n </sd-select>\r\n <sd-autocomplete *ngIf=\"item.option?.selection === 'AUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-autocomplete>\r\n <sd-select *ngIf=\"item.option?.selection === 'MULTIPLEAUTOCOMPLETE'\" [label]=\"item.title\"\r\n [items]=\"item.option.items\" [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" filtered=\"true\" appearance=\"outline\"\r\n multiple>\r\n </sd-select>\r\n <sd-select *ngIf=\"!item.option?.selection\" [label]=\"item.title\" [items]=\"item.option.items\"\r\n [valueField]=\"item.option.valueField\" [displayField]=\"item.option.displayField\"\r\n [(model)]=\"externalFilter[item.field]\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-select>\r\n </ng-container>\r\n <sd-date-time [label]=\"item.title\" *ngIf=\"item.type ==='date' || item.type ==='datetime'\"\r\n [(model)]=\"externalFilter[item.field]\" [type]=\"item.type\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-time>\r\n <sd-date-range [label]=\"item.title\" *ngIf=\"item.type ==='daterange' && externalFilter[item.field]\"\r\n [(from)]=\"externalFilter[item.field].from\" [(to)]=\"externalFilter[item.field].to\" [min]=\"item.minDate\"\r\n [max]=\"item.maxDate\" (sdChange)=\"onFilter(item)\" appearance=\"outline\">\r\n </sd-date-range>\r\n </div>\r\n </ng-template>\r\n <sd-popup-filter [filterRegister]=\"filterRegister\" [columns]=\"columns\"\r\n [externalFilters]=\"externalFilters\" [filterDefs]=\"filterDefs\">\r\n </sd-popup-filter>\r\n </ng-template>\r\n</ng-container>",
|
|
550
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
551
|
+
styles: [":host{display:block;padding-bottom:10px;padding-left:0;padding-right:0}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}"]
|
|
552
|
+
},] }
|
|
553
|
+
];
|
|
554
|
+
SdGridFilter.ctorParameters = function () { return [
|
|
555
|
+
{ type: core.ChangeDetectorRef },
|
|
556
|
+
{ type: ngxDeviceDetector.DeviceDetectorService }
|
|
557
|
+
]; };
|
|
558
|
+
SdGridFilter.propDecorators = {
|
|
559
|
+
popupFilter: [{ type: core.ViewChild, args: [SdPopupFilter,] }],
|
|
560
|
+
_filter: [{ type: core.Input, args: ['filter',] }],
|
|
561
|
+
columns: [{ type: core.Input }],
|
|
562
|
+
_externalFilters: [{ type: core.Input, args: ['externalFilters',] }],
|
|
563
|
+
filterDefs: [{ type: core.Input }],
|
|
564
|
+
_filterRegister: [{ type: core.Input, args: ['filterRegister',] }]
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
var SdMaterialFilterDefDirective = /** @class */ (function () {
|
|
568
|
+
function SdMaterialFilterDefDirective(templateRef) {
|
|
569
|
+
this.templateRef = templateRef;
|
|
570
|
+
}
|
|
571
|
+
Object.defineProperty(SdMaterialFilterDefDirective.prototype, "showing", {
|
|
572
|
+
set: function (val) {
|
|
573
|
+
this.defaultShowing = (val === '') || val;
|
|
574
|
+
},
|
|
575
|
+
enumerable: false,
|
|
576
|
+
configurable: true
|
|
577
|
+
});
|
|
578
|
+
return SdMaterialFilterDefDirective;
|
|
579
|
+
}());
|
|
580
|
+
SdMaterialFilterDefDirective.decorators = [
|
|
581
|
+
{ type: core.Directive, args: [{
|
|
582
|
+
selector: '[sdMaterialFilterDef]'
|
|
583
|
+
},] }
|
|
584
|
+
];
|
|
585
|
+
SdMaterialFilterDefDirective.ctorParameters = function () { return [
|
|
586
|
+
{ type: core.TemplateRef }
|
|
587
|
+
]; };
|
|
588
|
+
SdMaterialFilterDefDirective.propDecorators = {
|
|
589
|
+
sdMaterialFilterDef: [{ type: core.Input }],
|
|
590
|
+
showing: [{ type: core.Input, args: ['defaultShowing',] }]
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
var SdMaterialSubInformationDefDirective = /** @class */ (function () {
|
|
594
|
+
function SdMaterialSubInformationDefDirective(templateRef) {
|
|
595
|
+
this.templateRef = templateRef;
|
|
596
|
+
}
|
|
597
|
+
return SdMaterialSubInformationDefDirective;
|
|
598
|
+
}());
|
|
599
|
+
SdMaterialSubInformationDefDirective.decorators = [
|
|
600
|
+
{ type: core.Directive, args: [{
|
|
601
|
+
selector: '[sdMaterialSubInformationDef]'
|
|
602
|
+
},] }
|
|
603
|
+
];
|
|
604
|
+
SdMaterialSubInformationDefDirective.ctorParameters = function () { return [
|
|
605
|
+
{ type: core.TemplateRef }
|
|
606
|
+
]; };
|
|
607
|
+
|
|
608
|
+
var SdMaterialFooterDefDirective = /** @class */ (function () {
|
|
609
|
+
function SdMaterialFooterDefDirective(templateRef) {
|
|
610
|
+
this.templateRef = templateRef;
|
|
611
|
+
}
|
|
612
|
+
return SdMaterialFooterDefDirective;
|
|
613
|
+
}());
|
|
614
|
+
SdMaterialFooterDefDirective.decorators = [
|
|
615
|
+
{ type: core.Directive, args: [{
|
|
616
|
+
selector: '[sdMaterialFooterDef]'
|
|
617
|
+
},] }
|
|
618
|
+
];
|
|
619
|
+
SdMaterialFooterDefDirective.ctorParameters = function () { return [
|
|
620
|
+
{ type: core.TemplateRef }
|
|
621
|
+
]; };
|
|
622
|
+
SdMaterialFooterDefDirective.propDecorators = {
|
|
623
|
+
sdMaterialFooterDef: [{ type: core.Input }]
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
var SdMaterialEmptyDataDefDirective = /** @class */ (function () {
|
|
627
|
+
function SdMaterialEmptyDataDefDirective(templateRef) {
|
|
628
|
+
this.templateRef = templateRef;
|
|
629
|
+
}
|
|
630
|
+
return SdMaterialEmptyDataDefDirective;
|
|
631
|
+
}());
|
|
632
|
+
SdMaterialEmptyDataDefDirective.decorators = [
|
|
633
|
+
{ type: core.Directive, args: [{
|
|
634
|
+
selector: '[sdMaterialEmptyDataDef]'
|
|
635
|
+
},] }
|
|
636
|
+
];
|
|
637
|
+
SdMaterialEmptyDataDefDirective.ctorParameters = function () { return [
|
|
638
|
+
{ type: core.TemplateRef }
|
|
639
|
+
]; };
|
|
640
|
+
|
|
641
|
+
var _COLUMNS, _cache, _getKey, _default, _load, _get, _set, _remove;
|
|
642
|
+
var SdTableConfigurationService = /** @class */ (function () {
|
|
643
|
+
function SdTableConfigurationService(settingService, gridMaterialConfiguration) {
|
|
644
|
+
var _this = this;
|
|
645
|
+
this.settingService = settingService;
|
|
646
|
+
this.gridMaterialConfiguration = gridMaterialConfiguration;
|
|
647
|
+
_COLUMNS.set(this, {
|
|
648
|
+
EDITORVALIDATION: 'sdEditorValidation',
|
|
649
|
+
EDITOR: 'sdEditor',
|
|
650
|
+
SUBINFORMATION: 'sdSubInformationAction',
|
|
651
|
+
COMMAND: 'sdCommand',
|
|
652
|
+
SELECTION: 'sdSelection',
|
|
653
|
+
GROUP: 'sdGroup',
|
|
654
|
+
});
|
|
655
|
+
_cache.set(this, {});
|
|
656
|
+
this.init = function (key, gridOption) {
|
|
657
|
+
if (!__classPrivateFieldGet(_this, _cache)[key]) {
|
|
658
|
+
var subject_1 = new rxjs.Subject();
|
|
659
|
+
__classPrivateFieldGet(_this, _cache)[key] = {
|
|
660
|
+
load: __classPrivateFieldGet(_this, _load).call(_this, gridOption, subject_1),
|
|
661
|
+
get: __classPrivateFieldGet(_this, _get).call(_this, gridOption),
|
|
662
|
+
set: function (configuration) {
|
|
663
|
+
configuration = __classPrivateFieldGet(_this, _set).call(_this, gridOption, configuration);
|
|
664
|
+
subject_1.next(Object.assign({}, configuration));
|
|
665
|
+
return configuration;
|
|
666
|
+
},
|
|
667
|
+
remove: function () {
|
|
668
|
+
__classPrivateFieldGet(_this, _remove).call(_this, gridOption)();
|
|
669
|
+
subject_1.next(__classPrivateFieldGet(_this, _default).call(_this, gridOption));
|
|
670
|
+
},
|
|
671
|
+
observer: subject_1,
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
return __classPrivateFieldGet(_this, _cache)[key];
|
|
675
|
+
};
|
|
676
|
+
_getKey.set(this, function (gridOption) {
|
|
677
|
+
var _a, _b;
|
|
678
|
+
var prefix = 'c9e94836-6ace-4aeb-b148-4f0be63589ee';
|
|
679
|
+
if (!((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _a === void 0 ? void 0 : _a.key) && !(gridOption === null || gridOption === void 0 ? void 0 : gridOption.key)) {
|
|
680
|
+
return null;
|
|
681
|
+
}
|
|
682
|
+
return hash__default['default']({
|
|
683
|
+
prefix: prefix,
|
|
684
|
+
key: ((_b = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _b === void 0 ? void 0 : _b.key) || !(gridOption === null || gridOption === void 0 ? void 0 : gridOption.key),
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
_default.set(this, function (gridOption) {
|
|
688
|
+
var _a;
|
|
689
|
+
var columns = ((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.columns) === null || _a === void 0 ? void 0 : _a.filter(function (e) { return !e.hidden; }).map(function (e) { return ({
|
|
690
|
+
origin: {
|
|
691
|
+
field: e.field,
|
|
692
|
+
title: e.title,
|
|
693
|
+
width: e.width,
|
|
694
|
+
invisible: e.invisible,
|
|
695
|
+
},
|
|
696
|
+
invisible: e.invisible,
|
|
697
|
+
fixed: false,
|
|
698
|
+
}); })) || [];
|
|
699
|
+
return {
|
|
700
|
+
columns: columns,
|
|
701
|
+
};
|
|
702
|
+
});
|
|
703
|
+
_load.set(this, function (gridOption, subject) {
|
|
704
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
705
|
+
var get, configuration;
|
|
706
|
+
return __generator(this, function (_e) {
|
|
707
|
+
switch (_e.label) {
|
|
708
|
+
case 0:
|
|
709
|
+
get = __classPrivateFieldGet(this, _get).call(this, gridOption);
|
|
710
|
+
return [4 /*yield*/, get()];
|
|
711
|
+
case 1:
|
|
712
|
+
configuration = _e.sent();
|
|
713
|
+
subject.next(Object.assign({}, configuration));
|
|
714
|
+
return [2 /*return*/];
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}); };
|
|
718
|
+
});
|
|
719
|
+
_get.set(this, function (gridOption) {
|
|
720
|
+
return function () { return __awaiter(_this, void 0, void 0, function () {
|
|
721
|
+
var key, columns, config, configuration, _e, get, remove, _f, get, remove;
|
|
722
|
+
return __generator(this, function (_g) {
|
|
723
|
+
switch (_g.label) {
|
|
724
|
+
case 0:
|
|
725
|
+
key = __classPrivateFieldGet(this, _getKey).call(this, gridOption);
|
|
726
|
+
if (!key) {
|
|
727
|
+
return [2 /*return*/, __classPrivateFieldGet(this, _default).call(this, gridOption)];
|
|
728
|
+
}
|
|
729
|
+
columns = gridOption.columns, config = gridOption.config;
|
|
730
|
+
if (!((config === null || config === void 0 ? void 0 : config.storage) === 'server')) return [3 /*break*/, 2];
|
|
731
|
+
_e = this.settingService.createServer(key, {
|
|
732
|
+
args: config === null || config === void 0 ? void 0 : config.args,
|
|
733
|
+
}), get = _e.get, remove = _e.remove;
|
|
734
|
+
return [4 /*yield*/, get().catch(function () { return undefined; })];
|
|
735
|
+
case 1:
|
|
736
|
+
configuration = _g.sent();
|
|
737
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.columns)) {
|
|
738
|
+
remove().catch(console.error);
|
|
739
|
+
return [2 /*return*/, __classPrivateFieldGet(this, _default).call(this, gridOption)];
|
|
740
|
+
}
|
|
741
|
+
return [3 /*break*/, 3];
|
|
742
|
+
case 2:
|
|
743
|
+
_f = this.settingService.create(key, {
|
|
744
|
+
type: config === null || config === void 0 ? void 0 : config.storage,
|
|
745
|
+
args: config === null || config === void 0 ? void 0 : config.args,
|
|
746
|
+
}), get = _f.get, remove = _f.remove;
|
|
747
|
+
configuration = get();
|
|
748
|
+
if (!(configuration === null || configuration === void 0 ? void 0 : configuration.columns)) {
|
|
749
|
+
remove();
|
|
750
|
+
return [2 /*return*/, __classPrivateFieldGet(this, _default).call(this, gridOption)];
|
|
751
|
+
}
|
|
752
|
+
_g.label = 3;
|
|
753
|
+
case 3:
|
|
754
|
+
configuration.columns = configuration.columns.filter(function (column) { return columns.some(function (e) { return !e.hidden && e.field === column.origin.field; }); });
|
|
755
|
+
// Thêm những column mới vào storage nếu có
|
|
756
|
+
columns.forEach(function (column) {
|
|
757
|
+
var col = configuration.columns.find(function (e) { var _a; return ((_a = e.origin) === null || _a === void 0 ? void 0 : _a.field) === column.field; });
|
|
758
|
+
if (!col) {
|
|
759
|
+
configuration.columns.push({
|
|
760
|
+
origin: {
|
|
761
|
+
field: column.field,
|
|
762
|
+
title: column.title,
|
|
763
|
+
width: column.width,
|
|
764
|
+
invisible: column.invisible,
|
|
765
|
+
},
|
|
766
|
+
invisible: column.invisible,
|
|
767
|
+
fixed: false,
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
col.origin = {
|
|
772
|
+
field: column.field,
|
|
773
|
+
title: column.title,
|
|
774
|
+
width: column.width,
|
|
775
|
+
invisible: column.invisible,
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
return [2 /*return*/, configuration];
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
}); };
|
|
783
|
+
});
|
|
784
|
+
_set.set(this, function (gridOption, configuration) {
|
|
785
|
+
var _a, _b, _c, _d;
|
|
786
|
+
var key = __classPrivateFieldGet(_this, _getKey).call(_this, gridOption);
|
|
787
|
+
if (key) {
|
|
788
|
+
if (((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _a === void 0 ? void 0 : _a.storage) === 'server') {
|
|
789
|
+
var set = _this.settingService.createServer(key, {
|
|
790
|
+
args: (_b = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _b === void 0 ? void 0 : _b.args,
|
|
791
|
+
}).set;
|
|
792
|
+
set(configuration);
|
|
793
|
+
}
|
|
794
|
+
else {
|
|
795
|
+
var set = _this.settingService.create(key, {
|
|
796
|
+
type: (_c = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _c === void 0 ? void 0 : _c.storage,
|
|
797
|
+
args: (_d = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _d === void 0 ? void 0 : _d.args,
|
|
798
|
+
}).set;
|
|
799
|
+
set(configuration);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
return JSON.parse(JSON.stringify(configuration));
|
|
803
|
+
});
|
|
804
|
+
_remove.set(this, function (gridOption) {
|
|
805
|
+
return function () {
|
|
806
|
+
var _a, _b, _c, _d;
|
|
807
|
+
var key = __classPrivateFieldGet(_this, _getKey).call(_this, gridOption);
|
|
808
|
+
if (key) {
|
|
809
|
+
if (((_a = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _a === void 0 ? void 0 : _a.storage) === 'server') {
|
|
810
|
+
var remove = _this.settingService.createServer(key, {
|
|
811
|
+
args: (_b = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _b === void 0 ? void 0 : _b.args,
|
|
812
|
+
}).remove;
|
|
813
|
+
remove();
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
var remove = _this.settingService.create(key, {
|
|
817
|
+
type: (_c = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _c === void 0 ? void 0 : _c.storage,
|
|
818
|
+
args: (_d = gridOption === null || gridOption === void 0 ? void 0 : gridOption.config) === null || _d === void 0 ? void 0 : _d.args,
|
|
819
|
+
}).remove;
|
|
820
|
+
remove();
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
});
|
|
825
|
+
// get = async (gridOption: SdGridMaterialOption): Promise<SdGridConfiguration> => {
|
|
826
|
+
// if (!gridOption?.key) {
|
|
827
|
+
// return this.#getDefaultConfiguration(gridOption);
|
|
828
|
+
// }
|
|
829
|
+
// const { key, columns } = gridOption;
|
|
830
|
+
// const configuration: SdGridConfiguration = await this.settingService.get(this.#getKey(key)).catch(() => undefined);
|
|
831
|
+
// if (!configuration?.columns) {
|
|
832
|
+
// this.settingService.remove(this.#getKey(key)).catch(console.error);
|
|
833
|
+
// return this.#getDefaultConfiguration(gridOption);
|
|
834
|
+
// }
|
|
835
|
+
// configuration.columns = configuration.columns
|
|
836
|
+
// .filter(column => columns.some(e => !e.hidden && e.field === column.origin.field));
|
|
837
|
+
// // Thêm những column mới vào storage nếu có
|
|
838
|
+
// columns.forEach(column => {
|
|
839
|
+
// const col = configuration.columns.find(e => e.origin?.field === column.field);
|
|
840
|
+
// if (!col) {
|
|
841
|
+
// configuration.columns.push({
|
|
842
|
+
// origin: {
|
|
843
|
+
// field: column.field,
|
|
844
|
+
// title: column.title,
|
|
845
|
+
// width: column.width,
|
|
846
|
+
// invisible: column.invisible,
|
|
847
|
+
// },
|
|
848
|
+
// invisible: column.invisible,
|
|
849
|
+
// fixed: false
|
|
850
|
+
// });
|
|
851
|
+
// } else {
|
|
852
|
+
// col.origin = {
|
|
853
|
+
// field: column.field,
|
|
854
|
+
// title: column.title,
|
|
855
|
+
// width: column.width,
|
|
856
|
+
// invisible: column.invisible
|
|
857
|
+
// };
|
|
858
|
+
// }
|
|
859
|
+
// });
|
|
860
|
+
// return configuration;
|
|
861
|
+
// }
|
|
862
|
+
// set = async (key: string, configuration: SdGridConfiguration): Promise<SdGridConfiguration> => {
|
|
863
|
+
// if (key) {
|
|
864
|
+
// this.settingService.set(this.#getKey(key), configuration);
|
|
865
|
+
// }
|
|
866
|
+
// return configuration;
|
|
867
|
+
// }
|
|
868
|
+
// remove = (key: string) => {
|
|
869
|
+
// if (key) {
|
|
870
|
+
// this.settingService.remove(this.#getKey(key));
|
|
871
|
+
// }
|
|
872
|
+
// }
|
|
873
|
+
this.generateConfigurationResult = function (configuration, gridOption, sdSubInformation) {
|
|
874
|
+
var _a, _b;
|
|
875
|
+
var result = {
|
|
876
|
+
column: {},
|
|
877
|
+
fixedColumn: {},
|
|
878
|
+
firstColumns: [],
|
|
879
|
+
secondColumns: [],
|
|
880
|
+
firstHeaders: [],
|
|
881
|
+
secondHeaders: [],
|
|
882
|
+
displayedColumns: [],
|
|
883
|
+
displayedFooters: [],
|
|
884
|
+
multipleHeader: false,
|
|
885
|
+
};
|
|
886
|
+
var _e = gridOption || {}, selector = _e.selector, commands = _e.commands, group = _e.group;
|
|
887
|
+
if (selector === null || selector === void 0 ? void 0 : selector.visible) {
|
|
888
|
+
result.firstHeaders.push(__classPrivateFieldGet(_this, _COLUMNS).SELECTION);
|
|
889
|
+
result.displayedColumns.push(__classPrivateFieldGet(_this, _COLUMNS).SELECTION);
|
|
890
|
+
}
|
|
891
|
+
if (commands === null || commands === void 0 ? void 0 : commands.length) {
|
|
892
|
+
result.firstHeaders.push(__classPrivateFieldGet(_this, _COLUMNS).COMMAND);
|
|
893
|
+
result.displayedColumns.push(__classPrivateFieldGet(_this, _COLUMNS).COMMAND);
|
|
894
|
+
}
|
|
895
|
+
if ((_a = group === null || group === void 0 ? void 0 : group.fields) === null || _a === void 0 ? void 0 : _a.length) {
|
|
896
|
+
result.firstHeaders.push(__classPrivateFieldGet(_this, _COLUMNS).GROUP);
|
|
897
|
+
result.displayedColumns.push(__classPrivateFieldGet(_this, _COLUMNS).GROUP);
|
|
898
|
+
}
|
|
899
|
+
(_b = configuration === null || configuration === void 0 ? void 0 : configuration.columns) === null || _b === void 0 ? void 0 : _b.filter(function (col) { return !col.invisible; }).forEach(function (col) {
|
|
900
|
+
var _a;
|
|
901
|
+
var column = gridOption === null || gridOption === void 0 ? void 0 : gridOption.columns.find(function (e) { return e.field === col.origin.field; });
|
|
902
|
+
if (column) {
|
|
903
|
+
result.column[col.origin.field] = {
|
|
904
|
+
title: col.title || col.origin.title,
|
|
905
|
+
width: col.width || col.origin.width,
|
|
906
|
+
};
|
|
907
|
+
if (col.fixed) {
|
|
908
|
+
result.fixedColumn[col.origin.field] = {
|
|
909
|
+
title: col.title || col.origin.title,
|
|
910
|
+
width: col.width || col.origin.width,
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
result.firstColumns.push(Object.assign(Object.assign({}, column), { title: col.title || col.origin.title, width: col.width || col.origin.width }));
|
|
914
|
+
result.firstHeaders.push(col.origin.field);
|
|
915
|
+
result.displayedColumns.push(col.origin.field);
|
|
916
|
+
if (column.type === 'children') {
|
|
917
|
+
(_a = column.children) === null || _a === void 0 ? void 0 : _a.forEach(function (childColumn) {
|
|
918
|
+
result.secondColumns.push(childColumn);
|
|
919
|
+
result.secondHeaders.push(childColumn.field);
|
|
920
|
+
result.displayedColumns.push(childColumn.field);
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
if (sdSubInformation === null || sdSubInformation === void 0 ? void 0 : sdSubInformation.templateRef) {
|
|
926
|
+
result.firstHeaders.push(__classPrivateFieldGet(_this, _COLUMNS).SUBINFORMATION);
|
|
927
|
+
result.displayedColumns.push(__classPrivateFieldGet(_this, _COLUMNS).SUBINFORMATION);
|
|
928
|
+
}
|
|
929
|
+
result.multipleHeader = result.secondHeaders.length > 0;
|
|
930
|
+
// Sub infomation không thể có footer
|
|
931
|
+
result.displayedFooters = result.displayedColumns.filter(function (val) { return val !== __classPrivateFieldGet(_this, _COLUMNS).SUBINFORMATION; });
|
|
932
|
+
return result;
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
return SdTableConfigurationService;
|
|
936
|
+
}());
|
|
937
|
+
_COLUMNS = new WeakMap(), _cache = new WeakMap(), _getKey = new WeakMap(), _default = new WeakMap(), _load = new WeakMap(), _get = new WeakMap(), _set = new WeakMap(), _remove = new WeakMap();
|
|
938
|
+
SdTableConfigurationService.decorators = [
|
|
939
|
+
{ type: core.Injectable }
|
|
940
|
+
];
|
|
941
|
+
SdTableConfigurationService.ctorParameters = function () { return [
|
|
942
|
+
{ type: setting.SdSettingService },
|
|
943
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [TABLE_CONFIG,] }, { type: core.Optional }] }
|
|
944
|
+
]; };
|
|
945
|
+
|
|
946
|
+
var MapToSdTableItem = function (item) { return ({
|
|
947
|
+
current: JSON.parse(JSON.stringify(item)),
|
|
948
|
+
origin: item,
|
|
949
|
+
meta: {
|
|
950
|
+
id: hash__namespace(item),
|
|
951
|
+
expand: {
|
|
952
|
+
isExpanding: false,
|
|
953
|
+
isExpanded: false,
|
|
954
|
+
},
|
|
955
|
+
group: {},
|
|
956
|
+
selector: { actions: [], isSelected: false, selectable: false },
|
|
957
|
+
},
|
|
958
|
+
}); };
|
|
959
|
+
|
|
960
|
+
var _prefix, _cache$1;
|
|
961
|
+
var SdColumnValuesPipe = /** @class */ (function () {
|
|
962
|
+
function SdColumnValuesPipe() {
|
|
963
|
+
var _this = this;
|
|
964
|
+
_prefix.set(this, 'a1e67660-8aa2-4c11-b02d-71a32188719f');
|
|
965
|
+
_cache$1.set(this, {});
|
|
966
|
+
this.transform = function (value, column) { return __awaiter(_this, void 0, void 0, function () {
|
|
967
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, items, valueField, displayField, selection, remain, key, isMultible, values, result, result;
|
|
968
|
+
return __generator(this, function (_m) {
|
|
969
|
+
switch (_m.label) {
|
|
970
|
+
case 0:
|
|
971
|
+
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)) {
|
|
972
|
+
return [2 /*return*/, value];
|
|
973
|
+
}
|
|
974
|
+
_l = column.option, items = _l.items, valueField = _l.valueField, displayField = _l.displayField, selection = _l.selection, remain = __rest(_l, ["items", "valueField", "displayField", "selection"]);
|
|
975
|
+
key = hash__default['default']({
|
|
976
|
+
prefix: __classPrivateFieldGet(this, _prefix),
|
|
977
|
+
valueField: valueField,
|
|
978
|
+
displayField: displayField,
|
|
979
|
+
selection: selection,
|
|
980
|
+
remain: remain,
|
|
981
|
+
value: value
|
|
982
|
+
});
|
|
983
|
+
isMultible = ['MULTIPLE', 'MULTIPLEAUTOCOMPLETE', 'MULTIPLE_EDITOR', 'MULTIPLEAUTOCOMPLETE_EDITOR'].includes(selection);
|
|
984
|
+
if (!(typeof (items) === 'function')) return [3 /*break*/, 3];
|
|
985
|
+
if (!!__classPrivateFieldGet(this, _cache$1)[key]) return [3 /*break*/, 2];
|
|
986
|
+
return [4 /*yield*/, items(value, true)];
|
|
987
|
+
case 1:
|
|
988
|
+
values = _m.sent();
|
|
989
|
+
result = '';
|
|
990
|
+
if (isMultible && Array.isArray(value)) {
|
|
991
|
+
result = ((_e = (_d = values === null || values === void 0 ? void 0 : values.filter(function (e) { return value === null || value === void 0 ? void 0 : value.includes(e === null || e === void 0 ? void 0 : e[valueField]); })) === null || _d === void 0 ? void 0 : _d.map(function (e) { return e === null || e === void 0 ? void 0 : e[displayField]; })) === null || _e === void 0 ? void 0 : _e.join(', ')) || (value === null || value === void 0 ? void 0 : value.join(', '));
|
|
992
|
+
}
|
|
993
|
+
else {
|
|
994
|
+
result = ((_f = values === null || values === void 0 ? void 0 : values.find(function (e) { return (e === null || e === void 0 ? void 0 : e[valueField]) === value; })) === null || _f === void 0 ? void 0 : _f[displayField]) || value;
|
|
995
|
+
}
|
|
996
|
+
__classPrivateFieldGet(this, _cache$1)[key] = {
|
|
997
|
+
result: result
|
|
998
|
+
};
|
|
999
|
+
_m.label = 2;
|
|
1000
|
+
case 2: return [3 /*break*/, 4];
|
|
1001
|
+
case 3:
|
|
1002
|
+
if (!__classPrivateFieldGet(this, _cache$1)[key]) {
|
|
1003
|
+
result = '';
|
|
1004
|
+
if (isMultible && Array.isArray(value)) {
|
|
1005
|
+
result = (_j = (_h = (_g = items === null || items === void 0 ? void 0 : items.filter(function (e) { return value === null || value === void 0 ? void 0 : value.includes(e === null || e === void 0 ? void 0 : e[valueField]); })) === null || _g === void 0 ? void 0 : _g.map(function (e) { return e === null || e === void 0 ? void 0 : e[displayField]; })) === null || _h === void 0 ? void 0 : _h.join(', ')) !== null && _j !== void 0 ? _j : value === null || value === void 0 ? void 0 : value.join(', ');
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
result = ((_k = items === null || items === void 0 ? void 0 : items.find(function (e) { return (e === null || e === void 0 ? void 0 : e[valueField]) === value; })) === null || _k === void 0 ? void 0 : _k[displayField]) || value;
|
|
1009
|
+
}
|
|
1010
|
+
__classPrivateFieldGet(this, _cache$1)[key] = {
|
|
1011
|
+
result: result
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
_m.label = 4;
|
|
1015
|
+
case 4: return [2 /*return*/, __classPrivateFieldGet(this, _cache$1)[key].result];
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
}); };
|
|
1019
|
+
}
|
|
1020
|
+
return SdColumnValuesPipe;
|
|
1021
|
+
}());
|
|
1022
|
+
_prefix = new WeakMap(), _cache$1 = new WeakMap();
|
|
1023
|
+
SdColumnValuesPipe.decorators = [
|
|
1024
|
+
{ type: core.Pipe, args: [{
|
|
1025
|
+
name: 'columnValues'
|
|
1026
|
+
},] }
|
|
1027
|
+
];
|
|
1028
|
+
|
|
1029
|
+
var _filterConfiguration, _filterValue, _cache$2, _defaultConfiguration, _defaultValue, _initConfiguration, _initValue;
|
|
1030
|
+
var SdTableFilterService = /** @class */ (function () {
|
|
1031
|
+
function SdTableFilterService(settingService) {
|
|
1032
|
+
var _this = this;
|
|
1033
|
+
this.settingService = settingService;
|
|
1034
|
+
_filterConfiguration.set(this, 'GRID-FILTER-CONFIGURATION');
|
|
1035
|
+
_filterValue.set(this, 'GRID-FILTER-VALUE');
|
|
1036
|
+
_cache$2.set(this, {});
|
|
1037
|
+
this.register = function (filter, args) {
|
|
1038
|
+
var cacheSession = false;
|
|
1039
|
+
var id = args.id, columns = args.columns, externalFilters = args.externalFilters;
|
|
1040
|
+
var tempKey = hash__default['default']({
|
|
1041
|
+
id: id,
|
|
1042
|
+
columns: (columns === null || columns === void 0 ? void 0 : columns.map(function (e) { return e.field; }).filter(function (field) { return !!field; })) || [],
|
|
1043
|
+
externalFilters: (externalFilters === null || externalFilters === void 0 ? void 0 : externalFilters.map(function (e) { return e.field; }).filter(function (field) { return !!field; })) || [],
|
|
1044
|
+
});
|
|
1045
|
+
var key = (filter === null || filter === void 0 ? void 0 : filter.key) || tempKey;
|
|
1046
|
+
if (!(filter === null || filter === void 0 ? void 0 : filter.key)) {
|
|
1047
|
+
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1048
|
+
}
|
|
1049
|
+
if (!__classPrivateFieldGet(_this, _cache$2)[key]) {
|
|
1050
|
+
// Setting của filter configuration
|
|
1051
|
+
var filterConfiguration_1 = _this.settingService.create({
|
|
1052
|
+
prefix: __classPrivateFieldGet(_this, _filterConfiguration),
|
|
1053
|
+
key: key,
|
|
1054
|
+
}, {
|
|
1055
|
+
default: __classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args),
|
|
1056
|
+
type: cacheSession ? 'session' : undefined,
|
|
1057
|
+
});
|
|
1058
|
+
// Lấy giá trị configuration merge với giá trị defaultShowing của args nếu như args có thay đổi
|
|
1059
|
+
filterConfiguration_1.set(__classPrivateFieldGet(_this, _initConfiguration).call(_this, args, filterConfiguration_1.get()));
|
|
1060
|
+
// Setting của filter value
|
|
1061
|
+
var filterValue_1 = _this.settingService.create({
|
|
1062
|
+
prefix: __classPrivateFieldGet(_this, _filterValue),
|
|
1063
|
+
key: !(filter === null || filter === void 0 ? void 0 : filter.cacheFilter) ? tempKey : key,
|
|
1064
|
+
}, {
|
|
1065
|
+
default: __classPrivateFieldGet(_this, _defaultValue).call(_this, args),
|
|
1066
|
+
type: cacheSession || !(filter === null || filter === void 0 ? void 0 : filter.cacheFilter) ? 'session' : undefined,
|
|
1067
|
+
});
|
|
1068
|
+
// Lấy giá trị value merge với giá trị default của args nếu như args có thay đổi
|
|
1069
|
+
filterValue_1.set(__classPrivateFieldGet(_this, _initValue).call(_this, args, filterValue_1.get()));
|
|
1070
|
+
__classPrivateFieldGet(_this, _cache$2)[key] = {
|
|
1071
|
+
configuration: {
|
|
1072
|
+
get: function () {
|
|
1073
|
+
return filterConfiguration_1.get();
|
|
1074
|
+
},
|
|
1075
|
+
set: function (configuration) {
|
|
1076
|
+
var inlineColumn = configuration.inlineColumn, inlineExternal = configuration.inlineExternal, inlineFilterDef = configuration.inlineFilterDef;
|
|
1077
|
+
filterConfiguration_1.set({
|
|
1078
|
+
inlineColumn: inlineColumn,
|
|
1079
|
+
inlineExternal: inlineExternal,
|
|
1080
|
+
inlineFilterDef: inlineFilterDef,
|
|
1081
|
+
});
|
|
1082
|
+
return {
|
|
1083
|
+
inlineColumn: inlineColumn,
|
|
1084
|
+
inlineExternal: inlineExternal,
|
|
1085
|
+
inlineFilterDef: inlineFilterDef,
|
|
1086
|
+
};
|
|
1087
|
+
},
|
|
1088
|
+
remove: function () {
|
|
1089
|
+
filterConfiguration_1.set(__classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args));
|
|
1090
|
+
},
|
|
1091
|
+
observer: filterConfiguration_1.observer.pipe(operators.startWith(filterConfiguration_1.get()),
|
|
1092
|
+
// Sử dụng mặc định nếu bị reset
|
|
1093
|
+
operators.map(function (configuration) { return configuration || __classPrivateFieldGet(_this, _defaultConfiguration).call(_this, args); })),
|
|
1094
|
+
},
|
|
1095
|
+
value: {
|
|
1096
|
+
get: function () {
|
|
1097
|
+
return filterValue_1.get();
|
|
1098
|
+
},
|
|
1099
|
+
set: function (value) {
|
|
1100
|
+
var keys = Object.keys(value || {});
|
|
1101
|
+
var current = filterValue_1.get();
|
|
1102
|
+
var columnOperator = current.columnOperator, columnFilter = current.columnFilter, externalFilter = current.externalFilter, filterDef = current.filterDef, notReload = current.notReload;
|
|
1103
|
+
var updatedFilter = {
|
|
1104
|
+
// Filter column
|
|
1105
|
+
columnOperator: keys.includes('columnOperator') ? (value === null || value === void 0 ? void 0 : value.columnOperator) || {} : columnOperator,
|
|
1106
|
+
columnFilter: keys.includes('columnFilter') ? (value === null || value === void 0 ? void 0 : value.columnFilter) || {} : columnFilter,
|
|
1107
|
+
// Filter external
|
|
1108
|
+
externalFilter: keys.includes('externalFilter') ? (value === null || value === void 0 ? void 0 : value.externalFilter) || {} : externalFilter,
|
|
1109
|
+
// Filter def
|
|
1110
|
+
filterDef: keys.includes('filterDef') ? (value === null || value === void 0 ? void 0 : value.filterDef) || {} : filterDef,
|
|
1111
|
+
// Force
|
|
1112
|
+
notReload: !!notReload,
|
|
1113
|
+
};
|
|
1114
|
+
filterValue_1.set(updatedFilter);
|
|
1115
|
+
return updatedFilter;
|
|
1116
|
+
},
|
|
1117
|
+
remove: function () {
|
|
1118
|
+
filterValue_1.set(__classPrivateFieldGet(_this, _defaultValue).call(_this, args));
|
|
1119
|
+
},
|
|
1120
|
+
observer: filterValue_1.observer.pipe(operators.startWith(filterValue_1.get()),
|
|
1121
|
+
// Sử dụng mặc định nếu bị reset
|
|
1122
|
+
operators.map(function (value) { return value || __classPrivateFieldGet(_this, _defaultValue).call(_this, args); })),
|
|
1123
|
+
},
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
return __classPrivateFieldGet(_this, _cache$2)[key];
|
|
1127
|
+
};
|
|
1128
|
+
_defaultConfiguration.set(this, function (args) {
|
|
1129
|
+
var e_1, _r, e_2, _s, e_3, _t;
|
|
1130
|
+
var _a;
|
|
1131
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1132
|
+
var inlineColumn = {};
|
|
1133
|
+
var inlineExternal = {};
|
|
1134
|
+
var inlineFilterDef = {};
|
|
1135
|
+
try {
|
|
1136
|
+
// Filter column
|
|
1137
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1138
|
+
var item = _v.value;
|
|
1139
|
+
inlineColumn[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.defaultShowing;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1143
|
+
finally {
|
|
1144
|
+
try {
|
|
1145
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1146
|
+
}
|
|
1147
|
+
finally { if (e_1) throw e_1.error; }
|
|
1148
|
+
}
|
|
1149
|
+
try {
|
|
1150
|
+
// Filter external
|
|
1151
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1152
|
+
var item = _x.value;
|
|
1153
|
+
inlineExternal[item.field] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1157
|
+
finally {
|
|
1158
|
+
try {
|
|
1159
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1160
|
+
}
|
|
1161
|
+
finally { if (e_2) throw e_2.error; }
|
|
1162
|
+
}
|
|
1163
|
+
try {
|
|
1164
|
+
// Filter def
|
|
1165
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1166
|
+
var item = _z.value;
|
|
1167
|
+
inlineFilterDef[item.sdMaterialFilterDef] = item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1171
|
+
finally {
|
|
1172
|
+
try {
|
|
1173
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1174
|
+
}
|
|
1175
|
+
finally { if (e_3) throw e_3.error; }
|
|
1176
|
+
}
|
|
1177
|
+
return {
|
|
1178
|
+
// Filter column
|
|
1179
|
+
inlineColumn: inlineColumn,
|
|
1180
|
+
// Filter external
|
|
1181
|
+
inlineExternal: inlineExternal,
|
|
1182
|
+
// Filter def
|
|
1183
|
+
inlineFilterDef: inlineFilterDef,
|
|
1184
|
+
};
|
|
1185
|
+
});
|
|
1186
|
+
_defaultValue.set(this, function (args) {
|
|
1187
|
+
var e_4, _r, e_5, _s, e_6, _t;
|
|
1188
|
+
var _a;
|
|
1189
|
+
var columnFilter = {};
|
|
1190
|
+
var externalFilter = {};
|
|
1191
|
+
var filterDef = {};
|
|
1192
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1193
|
+
try {
|
|
1194
|
+
// Filter column
|
|
1195
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1196
|
+
var item = _v.value;
|
|
1197
|
+
columnFilter[item.field] = (_a = item === null || item === void 0 ? void 0 : item.filter) === null || _a === void 0 ? void 0 : _a.default;
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1201
|
+
finally {
|
|
1202
|
+
try {
|
|
1203
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1204
|
+
}
|
|
1205
|
+
finally { if (e_4) throw e_4.error; }
|
|
1206
|
+
}
|
|
1207
|
+
try {
|
|
1208
|
+
// Filter external
|
|
1209
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1210
|
+
var item = _x.value;
|
|
1211
|
+
externalFilter[item.field] = item === null || item === void 0 ? void 0 : item.default;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1215
|
+
finally {
|
|
1216
|
+
try {
|
|
1217
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1218
|
+
}
|
|
1219
|
+
finally { if (e_5) throw e_5.error; }
|
|
1220
|
+
}
|
|
1221
|
+
try {
|
|
1222
|
+
// Filter def
|
|
1223
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1224
|
+
var item = _z.value;
|
|
1225
|
+
filterDef[item.sdMaterialFilterDef] = undefined;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1229
|
+
finally {
|
|
1230
|
+
try {
|
|
1231
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1232
|
+
}
|
|
1233
|
+
finally { if (e_6) throw e_6.error; }
|
|
1234
|
+
}
|
|
1235
|
+
return {
|
|
1236
|
+
// Filter column
|
|
1237
|
+
columnFilter: columnFilter,
|
|
1238
|
+
// Filter external
|
|
1239
|
+
externalFilter: externalFilter,
|
|
1240
|
+
// Filter def
|
|
1241
|
+
filterDef: filterDef,
|
|
1242
|
+
};
|
|
1243
|
+
});
|
|
1244
|
+
_initConfiguration.set(this, function (args, configuration) {
|
|
1245
|
+
var e_7, _r, e_8, _s, e_9, _t;
|
|
1246
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1247
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1248
|
+
var inlineColumn = {};
|
|
1249
|
+
var inlineExternal = {};
|
|
1250
|
+
var inlineFilterDef = {};
|
|
1251
|
+
try {
|
|
1252
|
+
// Filter column
|
|
1253
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1254
|
+
var item = _v.value;
|
|
1255
|
+
inlineColumn[item.field] = (_b = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) === null || _a === void 0 ? void 0 : _a[item.field]) !== null && _b !== void 0 ? _b : (_c = item === null || item === void 0 ? void 0 : item.filter) === null || _c === void 0 ? void 0 : _c.defaultShowing;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1259
|
+
finally {
|
|
1260
|
+
try {
|
|
1261
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1262
|
+
}
|
|
1263
|
+
finally { if (e_7) throw e_7.error; }
|
|
1264
|
+
}
|
|
1265
|
+
try {
|
|
1266
|
+
// Filter external
|
|
1267
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1268
|
+
var item = _x.value;
|
|
1269
|
+
inlineExternal[item.field] = (_e = (_d = configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) === null || _d === void 0 ? void 0 : _d[item.field]) !== null && _e !== void 0 ? _e : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1273
|
+
finally {
|
|
1274
|
+
try {
|
|
1275
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1276
|
+
}
|
|
1277
|
+
finally { if (e_8) throw e_8.error; }
|
|
1278
|
+
}
|
|
1279
|
+
try {
|
|
1280
|
+
// Filter def
|
|
1281
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1282
|
+
var item = _z.value;
|
|
1283
|
+
inlineFilterDef[item.sdMaterialFilterDef] = (_g = (_f = configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) === null || _f === void 0 ? void 0 : _f[item.sdMaterialFilterDef]) !== null && _g !== void 0 ? _g : item === null || item === void 0 ? void 0 : item.defaultShowing;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1287
|
+
finally {
|
|
1288
|
+
try {
|
|
1289
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1290
|
+
}
|
|
1291
|
+
finally { if (e_9) throw e_9.error; }
|
|
1292
|
+
}
|
|
1293
|
+
return {
|
|
1294
|
+
// Filter column
|
|
1295
|
+
inlineColumn: inlineColumn,
|
|
1296
|
+
// Filter external
|
|
1297
|
+
inlineExternal: inlineExternal,
|
|
1298
|
+
// Filter def
|
|
1299
|
+
inlineFilterDef: inlineFilterDef,
|
|
1300
|
+
};
|
|
1301
|
+
});
|
|
1302
|
+
_initValue.set(this, function (args, value) {
|
|
1303
|
+
var e_10, _r, e_11, _s, e_12, _t;
|
|
1304
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1305
|
+
var columnFilter = {};
|
|
1306
|
+
var externalFilter = {};
|
|
1307
|
+
var filterDef = {};
|
|
1308
|
+
var columns = args.columns, externalFilters = args.externalFilters, filterDefs = args.filterDefs;
|
|
1309
|
+
try {
|
|
1310
|
+
// Filter column
|
|
1311
|
+
for (var _u = __values(columns || []), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1312
|
+
var item = _v.value;
|
|
1313
|
+
columnFilter[item.field] = (_b = (_a = value === null || value === void 0 ? void 0 : value.columnFilter) === null || _a === void 0 ? void 0 : _a[item.field]) !== null && _b !== void 0 ? _b : (_c = item === null || item === void 0 ? void 0 : item.filter) === null || _c === void 0 ? void 0 : _c.default;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1317
|
+
finally {
|
|
1318
|
+
try {
|
|
1319
|
+
if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
|
|
1320
|
+
}
|
|
1321
|
+
finally { if (e_10) throw e_10.error; }
|
|
1322
|
+
}
|
|
1323
|
+
try {
|
|
1324
|
+
// Filter external
|
|
1325
|
+
for (var _w = __values(externalFilters || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
1326
|
+
var item = _x.value;
|
|
1327
|
+
if (item.type === 'daterange') {
|
|
1328
|
+
externalFilter[item.field] = {
|
|
1329
|
+
from: (_f = (_e = (_d = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _d === void 0 ? void 0 : _d[item.field]) === null || _e === void 0 ? void 0 : _e.from) !== null && _f !== void 0 ? _f : (_g = item.default) === null || _g === void 0 ? void 0 : _g.from,
|
|
1330
|
+
to: (_k = (_j = (_h = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _h === void 0 ? void 0 : _h[item.field]) === null || _j === void 0 ? void 0 : _j.to) !== null && _k !== void 0 ? _k : (_l = item.default) === null || _l === void 0 ? void 0 : _l.to,
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
else {
|
|
1334
|
+
externalFilter[item.field] = (_o = (_m = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _m === void 0 ? void 0 : _m[item.field]) !== null && _o !== void 0 ? _o : item === null || item === void 0 ? void 0 : item.default;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1339
|
+
finally {
|
|
1340
|
+
try {
|
|
1341
|
+
if (_x && !_x.done && (_s = _w.return)) _s.call(_w);
|
|
1342
|
+
}
|
|
1343
|
+
finally { if (e_11) throw e_11.error; }
|
|
1344
|
+
}
|
|
1345
|
+
try {
|
|
1346
|
+
// Filter def
|
|
1347
|
+
for (var _y = __values(filterDefs || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
1348
|
+
var item = _z.value;
|
|
1349
|
+
filterDef[item.sdMaterialFilterDef] = (_q = (_p = value === null || value === void 0 ? void 0 : value.filterDef) === null || _p === void 0 ? void 0 : _p[item.sdMaterialFilterDef]) !== null && _q !== void 0 ? _q : undefined;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1353
|
+
finally {
|
|
1354
|
+
try {
|
|
1355
|
+
if (_z && !_z.done && (_t = _y.return)) _t.call(_y);
|
|
1356
|
+
}
|
|
1357
|
+
finally { if (e_12) throw e_12.error; }
|
|
1358
|
+
}
|
|
1359
|
+
return {
|
|
1360
|
+
// Filter column
|
|
1361
|
+
columnFilter: columnFilter,
|
|
1362
|
+
// Filter external
|
|
1363
|
+
externalFilter: externalFilter,
|
|
1364
|
+
// Filter def
|
|
1365
|
+
filterDef: filterDef,
|
|
1366
|
+
};
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
return SdTableFilterService;
|
|
1370
|
+
}());
|
|
1371
|
+
_filterConfiguration = new WeakMap(), _filterValue = new WeakMap(), _cache$2 = new WeakMap(), _defaultConfiguration = new WeakMap(), _defaultValue = new WeakMap(), _initConfiguration = new WeakMap(), _initValue = new WeakMap();
|
|
1372
|
+
SdTableFilterService.decorators = [
|
|
1373
|
+
{ type: core.Injectable }
|
|
1374
|
+
];
|
|
1375
|
+
SdTableFilterService.ctorParameters = function () { return [
|
|
1376
|
+
{ type: setting.SdSettingService }
|
|
1377
|
+
]; };
|
|
1378
|
+
|
|
1379
|
+
var _gridId, _optionChanges, _localItems, _paginator, _sort, _subscription$1, _reload, _loadCompleted, _initCellDef, _initFilterDef, _initFooterDef, _filterExportInfo, _initConfiguration$1, _loadFilterRegister, _filterLocal, _getFilter, _load$1, _render, _exportedItems, _allColumns, _allExportedColumns, _onExport, _getExportColumns, _updateSelectedItems;
|
|
1380
|
+
var SdTable = /** @class */ (function () {
|
|
1381
|
+
function SdTable(ref, configuration, gridConfigurationService, exportService, notifyService, columnValuesPipe, gridFilterService) {
|
|
1382
|
+
var _this = this;
|
|
1383
|
+
this.ref = ref;
|
|
1384
|
+
this.configuration = configuration;
|
|
1385
|
+
this.gridConfigurationService = gridConfigurationService;
|
|
1386
|
+
this.exportService = exportService;
|
|
1387
|
+
this.notifyService = notifyService;
|
|
1388
|
+
this.columnValuesPipe = columnValuesPipe;
|
|
1389
|
+
this.gridFilterService = gridFilterService;
|
|
1390
|
+
_gridId.set(this, uuid.v4());
|
|
1391
|
+
this.key = uuid.v4();
|
|
1392
|
+
_optionChanges.set(this, new rxjs.Subject());
|
|
1393
|
+
_localItems.set(this, []);
|
|
1394
|
+
this.items = [];
|
|
1395
|
+
this.selectedItems = [];
|
|
1396
|
+
// Loading
|
|
1397
|
+
this.isLoading = false;
|
|
1398
|
+
// Paginate
|
|
1399
|
+
this.isHiddenPaginator = false;
|
|
1400
|
+
_paginator.set(this, void 0);
|
|
1401
|
+
// Sorting
|
|
1402
|
+
_sort.set(this, void 0);
|
|
1403
|
+
// Cell Def
|
|
1404
|
+
this.sdCellDefs = new core.QueryList();
|
|
1405
|
+
this.cellDef = {};
|
|
1406
|
+
// Footer Def
|
|
1407
|
+
this.sdFooterDefs = new core.QueryList();
|
|
1408
|
+
this.footerDef = {};
|
|
1409
|
+
this.hasFooter = false;
|
|
1410
|
+
// Filter Def
|
|
1411
|
+
this.sdFilterDefs = new core.QueryList();
|
|
1412
|
+
this.filterDefs = [];
|
|
1413
|
+
// Filter
|
|
1414
|
+
this.columnOperator = {};
|
|
1415
|
+
this.columnFilter = {};
|
|
1416
|
+
// Subcription
|
|
1417
|
+
_subscription$1.set(this, new rxjs.Subscription());
|
|
1418
|
+
_reload.set(this, new rxjs.Subject());
|
|
1419
|
+
this.isExporting = false;
|
|
1420
|
+
this.isSelectAll = false;
|
|
1421
|
+
this.exportTitle = 'Export';
|
|
1422
|
+
_loadCompleted.set(this, false);
|
|
1423
|
+
_initCellDef.set(this, function () {
|
|
1424
|
+
var e_1, _8;
|
|
1425
|
+
_this.cellDef = {};
|
|
1426
|
+
try {
|
|
1427
|
+
for (var _9 = __values(_this.sdCellDefs), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
1428
|
+
var cellDef = _10.value;
|
|
1429
|
+
if (cellDef.sdMaterialCellDef) {
|
|
1430
|
+
_this.cellDef[cellDef.sdMaterialCellDef] = cellDef;
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1435
|
+
finally {
|
|
1436
|
+
try {
|
|
1437
|
+
if (_10 && !_10.done && (_8 = _9.return)) _8.call(_9);
|
|
1438
|
+
}
|
|
1439
|
+
finally { if (e_1) throw e_1.error; }
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
_initFilterDef.set(this, function () {
|
|
1443
|
+
var e_2, _8;
|
|
1444
|
+
_this.filterDefs = [];
|
|
1445
|
+
try {
|
|
1446
|
+
for (var _9 = __values(_this.sdFilterDefs), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
1447
|
+
var filterDef = _10.value;
|
|
1448
|
+
_this.filterDefs.push(filterDef);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1452
|
+
finally {
|
|
1453
|
+
try {
|
|
1454
|
+
if (_10 && !_10.done && (_8 = _9.return)) _8.call(_9);
|
|
1455
|
+
}
|
|
1456
|
+
finally { if (e_2) throw e_2.error; }
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
_initFooterDef.set(this, function () {
|
|
1460
|
+
var e_3, _8;
|
|
1461
|
+
_this.footerDef = {};
|
|
1462
|
+
_this.hasFooter = false;
|
|
1463
|
+
try {
|
|
1464
|
+
for (var _9 = __values(_this.sdFooterDefs), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
1465
|
+
var footerDef = _10.value;
|
|
1466
|
+
if (footerDef.sdMaterialFooterDef) {
|
|
1467
|
+
_this.hasFooter = true;
|
|
1468
|
+
_this.footerDef[footerDef.sdMaterialFooterDef] = footerDef;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1473
|
+
finally {
|
|
1474
|
+
try {
|
|
1475
|
+
if (_10 && !_10.done && (_8 = _9.return)) _8.call(_9);
|
|
1476
|
+
}
|
|
1477
|
+
finally { if (e_3) throw e_3.error; }
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
_filterExportInfo.set(this, function (pageNumber, pageSize) {
|
|
1481
|
+
var _a, _b;
|
|
1482
|
+
var _8 = _this.filterRegister.value.get(), columnOperator = _8.columnOperator, columnFilter = _8.columnFilter, externalFilter = _8.externalFilter, filterDef = _8.filterDef;
|
|
1483
|
+
return {
|
|
1484
|
+
columnOperator: columnOperator || {},
|
|
1485
|
+
rawColumnFilter: columnFilter || {},
|
|
1486
|
+
rawExternalFilter: externalFilter || {},
|
|
1487
|
+
rawFilterDef: filterDef || {},
|
|
1488
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1489
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1490
|
+
pageNumber: pageNumber,
|
|
1491
|
+
pageSize: pageSize,
|
|
1492
|
+
isExported: true,
|
|
1493
|
+
};
|
|
1494
|
+
});
|
|
1495
|
+
_initConfiguration$1.set(this, function (option) {
|
|
1496
|
+
var e_4, _8;
|
|
1497
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
1498
|
+
// Init pagination
|
|
1499
|
+
option.paginate = {
|
|
1500
|
+
hidden: (_a = option === null || option === void 0 ? void 0 : option.paginate) === null || _a === void 0 ? void 0 : _a.hidden,
|
|
1501
|
+
pageSize: (_f = (_c = (_b = option === null || option === void 0 ? void 0 : option.paginate) === null || _b === void 0 ? void 0 : _b.pageSize) !== null && _c !== void 0 ? _c : (_e = (_d = _this.configuration) === null || _d === void 0 ? void 0 : _d.paginate) === null || _e === void 0 ? void 0 : _e.pageSize) !== null && _f !== void 0 ? _f : (_g = DEFAULT_TABLE_CONFIG.paginate) === null || _g === void 0 ? void 0 : _g.pageSize,
|
|
1502
|
+
pages: (_m = (_j = (_h = option === null || option === void 0 ? void 0 : option.paginate) === null || _h === void 0 ? void 0 : _h.pages) !== null && _j !== void 0 ? _j : (_l = (_k = _this.configuration) === null || _k === void 0 ? void 0 : _k.paginate) === null || _l === void 0 ? void 0 : _l.pages) !== null && _m !== void 0 ? _m : (_o = DEFAULT_TABLE_CONFIG.paginate) === null || _o === void 0 ? void 0 : _o.pages,
|
|
1503
|
+
showFirstLastButtons: (_q = (_p = option === null || option === void 0 ? void 0 : option.paginate) === null || _p === void 0 ? void 0 : _p.showFirstLastButtons) !== null && _q !== void 0 ? _q : false,
|
|
1504
|
+
};
|
|
1505
|
+
try {
|
|
1506
|
+
for (var _9 = __values(option.columns || []), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
1507
|
+
var column = _10.value;
|
|
1508
|
+
if (((_s = (_r = column.filter) === null || _r === void 0 ? void 0 : _r.operator) === null || _s === void 0 ? void 0 : _s.enable) && !((_v = (_u = (_t = column.filter) === null || _t === void 0 ? void 0 : _t.operator) === null || _u === void 0 ? void 0 : _u.list) === null || _v === void 0 ? void 0 : _v.length)) {
|
|
1509
|
+
if (column.type === 'string') {
|
|
1510
|
+
column.filter.operator.list = ((_y = (_x = (_w = _this.configuration) === null || _w === void 0 ? void 0 : _w.filter) === null || _x === void 0 ? void 0 : _x.operator) === null || _y === void 0 ? void 0 : _y.defaultListString) || [];
|
|
1511
|
+
}
|
|
1512
|
+
if (column.type === 'number') {
|
|
1513
|
+
column.filter.operator.list = ((_1 = (_0 = (_z = _this.configuration) === null || _z === void 0 ? void 0 : _z.filter) === null || _0 === void 0 ? void 0 : _0.operator) === null || _1 === void 0 ? void 0 : _1.defaultListNumber) || [];
|
|
1514
|
+
}
|
|
1515
|
+
if (column.type === 'values') {
|
|
1516
|
+
column.filter.operator.list = ((_4 = (_3 = (_2 = _this.configuration) === null || _2 === void 0 ? void 0 : _2.filter) === null || _3 === void 0 ? void 0 : _3.operator) === null || _4 === void 0 ? void 0 : _4.defaultListValues) || [];
|
|
1517
|
+
}
|
|
1518
|
+
if (column.type === 'date' || column.type === 'datetime') {
|
|
1519
|
+
column.filter.operator.list = ((_7 = (_6 = (_5 = _this.configuration) === null || _5 === void 0 ? void 0 : _5.filter) === null || _6 === void 0 ? void 0 : _6.operator) === null || _7 === void 0 ? void 0 : _7.defaultListDate) || [];
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1525
|
+
finally {
|
|
1526
|
+
try {
|
|
1527
|
+
if (_10 && !_10.done && (_8 = _9.return)) _8.call(_9);
|
|
1528
|
+
}
|
|
1529
|
+
finally { if (e_4) throw e_4.error; }
|
|
1530
|
+
}
|
|
1531
|
+
return option;
|
|
1532
|
+
});
|
|
1533
|
+
_loadFilterRegister.set(this, function () {
|
|
1534
|
+
var _a, _b, _c, _d;
|
|
1535
|
+
// Init filter
|
|
1536
|
+
if (_this.gridOption) {
|
|
1537
|
+
if (!_this.filterRegister) {
|
|
1538
|
+
_this.filterRegister = _this.gridFilterService.register((_a = _this.gridOption) === null || _a === void 0 ? void 0 : _a.filter, {
|
|
1539
|
+
id: __classPrivateFieldGet(_this, _gridId),
|
|
1540
|
+
columns: (_b = _this.gridOption) === null || _b === void 0 ? void 0 : _b.columns,
|
|
1541
|
+
externalFilters: (_d = (_c = _this.gridOption) === null || _c === void 0 ? void 0 : _c.filter) === null || _d === void 0 ? void 0 : _d.externalFilters,
|
|
1542
|
+
filterDefs: _this.filterDefs,
|
|
1543
|
+
});
|
|
1544
|
+
__classPrivateFieldGet(_this, _subscription$1).add(_this.filterRegister.value.observer
|
|
1545
|
+
.pipe(operators.debounceTime(500), operators.map(function (filterValue) {
|
|
1546
|
+
var columnOperator = filterValue.columnOperator, columnFilter = filterValue.columnFilter, notReload = filterValue.notReload;
|
|
1547
|
+
_this.columnOperator = columnOperator;
|
|
1548
|
+
_this.columnFilter = columnFilter;
|
|
1549
|
+
if (!notReload) {
|
|
1550
|
+
__classPrivateFieldGet(_this, _paginator).pageIndex = 0;
|
|
1551
|
+
__classPrivateFieldGet(_this, _reload).next({
|
|
1552
|
+
force: false,
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
}))
|
|
1556
|
+
.subscribe());
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
_filterLocal.set(this, function (localItems, filterInfo) {
|
|
1561
|
+
var columns = _this.gridOption.columns;
|
|
1562
|
+
var rawColumnFilter = filterInfo.rawColumnFilter, orderBy = filterInfo.orderBy, orderDirection = filterInfo.orderDirection, pageSize = filterInfo.pageSize, pageNumber = filterInfo.pageNumber;
|
|
1563
|
+
var items = localItems.filter(function (tableItem) {
|
|
1564
|
+
var e_5, _8;
|
|
1565
|
+
var _a, _b, _c, _d;
|
|
1566
|
+
var item = tableItem.current;
|
|
1567
|
+
try {
|
|
1568
|
+
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
1569
|
+
var column = columns_1_1.value;
|
|
1570
|
+
var field = column.field, type = column.type;
|
|
1571
|
+
var filterValue = (rawColumnFilter[field] || '').toString().trim().toLowerCase();
|
|
1572
|
+
var columnValue = (item[field] || '').toString().trim().toLowerCase();
|
|
1573
|
+
if (filterValue) {
|
|
1574
|
+
if (!columnValue && type !== 'datetime' && type !== 'date' && type !== 'time') {
|
|
1575
|
+
return false;
|
|
1576
|
+
}
|
|
1577
|
+
if (type === 'string') {
|
|
1578
|
+
if (columnValue.indexOf(filterValue) === -1) {
|
|
1579
|
+
return false;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
else if (type === 'values') {
|
|
1583
|
+
if (columnValue !== filterValue) {
|
|
1584
|
+
return false;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
else if (type === 'number') {
|
|
1588
|
+
var fValue = +filterValue.replace('>=', '').replace('<=', '').replace('>', '').replace('<', '');
|
|
1589
|
+
var cValue = +columnValue;
|
|
1590
|
+
if (fValue || fValue === 0) {
|
|
1591
|
+
if (!cValue && cValue !== 0) {
|
|
1592
|
+
return false;
|
|
1593
|
+
}
|
|
1594
|
+
if (filterValue.indexOf('>=') > -1 && cValue < fValue) {
|
|
1595
|
+
return false;
|
|
1596
|
+
}
|
|
1597
|
+
else if (filterValue.indexOf('<=') > -1 && cValue > fValue) {
|
|
1598
|
+
return false;
|
|
1599
|
+
}
|
|
1600
|
+
else if (filterValue.indexOf('<') > -1 && cValue >= fValue) {
|
|
1601
|
+
return false;
|
|
1602
|
+
}
|
|
1603
|
+
else if (filterValue.indexOf('>') > -1 && cValue <= fValue) {
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1606
|
+
else if (cValue !== fValue) {
|
|
1607
|
+
return false;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
else if (type === 'bool') {
|
|
1612
|
+
if (filterValue === '1' && columnValue !== '1' && columnValue !== 'true') {
|
|
1613
|
+
return false;
|
|
1614
|
+
}
|
|
1615
|
+
else if (filterValue === '0' && columnValue !== '0' && columnValue !== 'false') {
|
|
1616
|
+
return false;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
else if (type === 'datetime' || type === 'date' || type === 'time') {
|
|
1620
|
+
var from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
1621
|
+
var to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
1622
|
+
var fromDate = Date.begin(from);
|
|
1623
|
+
var toDate = Date.end(to);
|
|
1624
|
+
if (fromDate || toDate) {
|
|
1625
|
+
if (!columnValue) {
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
var columnTime = new Date(columnValue).getTime();
|
|
1629
|
+
var fromDateTime = (fromDate === null || fromDate === void 0 ? void 0 : fromDate.getTime()) || null;
|
|
1630
|
+
var toDateTime = (toDate === null || toDate === void 0 ? void 0 : toDate.getTime()) || null;
|
|
1631
|
+
if (fromDateTime && fromDateTime > columnTime) {
|
|
1632
|
+
return false;
|
|
1633
|
+
}
|
|
1634
|
+
if (toDateTime && columnTime > toDateTime) {
|
|
1635
|
+
return false;
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1643
|
+
finally {
|
|
1644
|
+
try {
|
|
1645
|
+
if (columns_1_1 && !columns_1_1.done && (_8 = columns_1.return)) _8.call(columns_1);
|
|
1646
|
+
}
|
|
1647
|
+
finally { if (e_5) throw e_5.error; }
|
|
1648
|
+
}
|
|
1649
|
+
return true;
|
|
1650
|
+
});
|
|
1651
|
+
// Sort
|
|
1652
|
+
if (orderBy && orderDirection) {
|
|
1653
|
+
var column = columns.find(function (e) { return e.field === orderBy; });
|
|
1654
|
+
if (column) {
|
|
1655
|
+
var type_1 = column.type, field_1 = column.field;
|
|
1656
|
+
items.sort(function (tableItemCurrent, tableItemNext) {
|
|
1657
|
+
var current = tableItemCurrent.current;
|
|
1658
|
+
var next = tableItemNext.current;
|
|
1659
|
+
if (type_1 === 'number') {
|
|
1660
|
+
return (current[field_1] || 0) - (next[field_1] || 0);
|
|
1661
|
+
}
|
|
1662
|
+
if (type_1 === 'date' || type_1 === 'datetime' || type_1 === 'time') {
|
|
1663
|
+
var d1 = new Date(current[field_1] || '').getTime();
|
|
1664
|
+
var d2 = new Date(current[field_1] || '').getTime();
|
|
1665
|
+
return d1 - d2;
|
|
1666
|
+
}
|
|
1667
|
+
var s1 = (current[field_1] || '').toString();
|
|
1668
|
+
var s2 = (next[field_1] || '').toString();
|
|
1669
|
+
if (s1 > s2) {
|
|
1670
|
+
return 1;
|
|
1671
|
+
}
|
|
1672
|
+
if (s1 < s2) {
|
|
1673
|
+
return -1;
|
|
1674
|
+
}
|
|
1675
|
+
return 0;
|
|
1676
|
+
});
|
|
1677
|
+
if (orderDirection === 'desc') {
|
|
1678
|
+
items.reverse();
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
return {
|
|
1683
|
+
items: items.filter(function (item, index) {
|
|
1684
|
+
return index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize;
|
|
1685
|
+
}),
|
|
1686
|
+
total: items.length,
|
|
1687
|
+
};
|
|
1688
|
+
});
|
|
1689
|
+
_getFilter.set(this, function () {
|
|
1690
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1691
|
+
var _8 = _this.filterRegister.value.get(), columnOperator = _8.columnOperator, columnFilter = _8.columnFilter, externalFilter = _8.externalFilter, filterDef = _8.filterDef;
|
|
1692
|
+
return {
|
|
1693
|
+
columnOperator: columnOperator || {},
|
|
1694
|
+
rawColumnFilter: columnFilter || {},
|
|
1695
|
+
rawExternalFilter: externalFilter || {},
|
|
1696
|
+
rawFilterDef: filterDef || {},
|
|
1697
|
+
orderBy: ((_a = __classPrivateFieldGet(_this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || '',
|
|
1698
|
+
orderDirection: ((_b = __classPrivateFieldGet(_this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || '',
|
|
1699
|
+
pageNumber: ((_c = __classPrivateFieldGet(_this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1700
|
+
pageSize: ((_d = __classPrivateFieldGet(_this, _paginator)) === null || _d === void 0 ? void 0 : _d.pageSize) || ((_f = (_e = _this.gridOption) === null || _e === void 0 ? void 0 : _e.paginate) === null || _f === void 0 ? void 0 : _f.pageSize) || 50,
|
|
1701
|
+
};
|
|
1702
|
+
});
|
|
1703
|
+
_load$1.set(this, function (filterReq, force) {
|
|
1704
|
+
if (force === void 0) { force = true; }
|
|
1705
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1706
|
+
var items, data, items, results, data;
|
|
1707
|
+
var _this = this;
|
|
1708
|
+
return __generator(this, function (_8) {
|
|
1709
|
+
switch (_8.label) {
|
|
1710
|
+
case 0:
|
|
1711
|
+
this.isLoading = true;
|
|
1712
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 2];
|
|
1713
|
+
items = this.gridOption.items;
|
|
1714
|
+
return [4 /*yield*/, items(filterReq).catch(function (err) {
|
|
1715
|
+
_this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1716
|
+
console.error(err);
|
|
1717
|
+
return {
|
|
1718
|
+
items: [],
|
|
1719
|
+
total: 0,
|
|
1720
|
+
};
|
|
1721
|
+
})];
|
|
1722
|
+
case 1:
|
|
1723
|
+
data = _8.sent();
|
|
1724
|
+
this.isLoading = false;
|
|
1725
|
+
return [2 /*return*/, {
|
|
1726
|
+
items: (data === null || data === void 0 ? void 0 : data.items.map(MapToSdTableItem)) || [],
|
|
1727
|
+
total: (data === null || data === void 0 ? void 0 : data.total) || 0,
|
|
1728
|
+
}];
|
|
1729
|
+
case 2:
|
|
1730
|
+
if (!force) return [3 /*break*/, 6];
|
|
1731
|
+
items = this.gridOption.items;
|
|
1732
|
+
results = items();
|
|
1733
|
+
data = [];
|
|
1734
|
+
if (!(results instanceof Promise)) return [3 /*break*/, 4];
|
|
1735
|
+
return [4 /*yield*/, results.catch(function (err) {
|
|
1736
|
+
_this.notifyService.notify.warning('Có lỗi xảy ra');
|
|
1737
|
+
console.error(err);
|
|
1738
|
+
return [];
|
|
1739
|
+
})];
|
|
1740
|
+
case 3:
|
|
1741
|
+
data = _8.sent();
|
|
1742
|
+
return [3 /*break*/, 5];
|
|
1743
|
+
case 4:
|
|
1744
|
+
data = results;
|
|
1745
|
+
_8.label = 5;
|
|
1746
|
+
case 5:
|
|
1747
|
+
if (!Array.isArray(data)) {
|
|
1748
|
+
this.notifyService.notify.warning('Dữ liệu không phải là một mảng');
|
|
1749
|
+
data = [];
|
|
1750
|
+
}
|
|
1751
|
+
__classPrivateFieldSet(this, _localItems, data.map(MapToSdTableItem));
|
|
1752
|
+
this.isLoading = false;
|
|
1753
|
+
_8.label = 6;
|
|
1754
|
+
case 6: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, __classPrivateFieldGet(this, _localItems), filterReq)];
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
});
|
|
1758
|
+
});
|
|
1759
|
+
_render.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
1760
|
+
var _a, _b, _c, _d;
|
|
1761
|
+
return __generator(this, function (_8) {
|
|
1762
|
+
switch (_8.label) {
|
|
1763
|
+
case 0:
|
|
1764
|
+
(_a = this.sdScroll) === null || _a === void 0 ? void 0 : _a.scrollTop();
|
|
1765
|
+
this.items = (args === null || args === void 0 ? void 0 : args.items) || [];
|
|
1766
|
+
this.total = (args === null || args === void 0 ? void 0 : args.total) || 0;
|
|
1767
|
+
return [4 /*yield*/, ((_d = (_c = (_b = this.gridOption) === null || _b === void 0 ? void 0 : _b.reload) === null || _c === void 0 ? void 0 : _c.onReload) === null || _d === void 0 ? void 0 : _d.call(_c, this.items))];
|
|
1768
|
+
case 1:
|
|
1769
|
+
_8.sent();
|
|
1770
|
+
this.isSelectAll = this.items.every(function (e) { return e.meta.selector.isSelected; });
|
|
1771
|
+
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1772
|
+
return [2 /*return*/];
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
}); });
|
|
1776
|
+
this.reload = function (force) {
|
|
1777
|
+
if (force === void 0) { force = true; }
|
|
1778
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1779
|
+
var _e, _f, data;
|
|
1780
|
+
return __generator(this, function (_8) {
|
|
1781
|
+
switch (_8.label) {
|
|
1782
|
+
case 0:
|
|
1783
|
+
(_f = (_e = this.gridFilter) === null || _e === void 0 ? void 0 : _e.updateFilter) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
1784
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _load$1).call(this, __classPrivateFieldGet(this, _getFilter).call(this), force)];
|
|
1785
|
+
case 1:
|
|
1786
|
+
data = _8.sent();
|
|
1787
|
+
__classPrivateFieldGet(this, _render).call(this, data);
|
|
1788
|
+
return [2 /*return*/];
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
});
|
|
1792
|
+
};
|
|
1793
|
+
_exportedItems.set(this, function (pageNumber, pageSize) {
|
|
1794
|
+
if (pageNumber === void 0) { pageNumber = 0; }
|
|
1795
|
+
if (pageSize === void 0) { pageSize = 10000; }
|
|
1796
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
1797
|
+
var _g, _h, result, filterInfo, result, exportedItems, results;
|
|
1798
|
+
return __generator(this, function (_8) {
|
|
1799
|
+
switch (_8.label) {
|
|
1800
|
+
case 0:
|
|
1801
|
+
if (!((_g = this.gridOption.export) === null || _g === void 0 ? void 0 : _g.items)) return [3 /*break*/, 2];
|
|
1802
|
+
result = (_h = this.gridOption.export) === null || _h === void 0 ? void 0 : _h.items(__classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize));
|
|
1803
|
+
if (Array.isArray(result)) {
|
|
1804
|
+
return [2 /*return*/, result];
|
|
1805
|
+
}
|
|
1806
|
+
if (rxjs.isObservable(result)) {
|
|
1807
|
+
result = result.toPromise();
|
|
1808
|
+
}
|
|
1809
|
+
if (rxjs.isObservable(result)) {
|
|
1810
|
+
result = result.toPromise();
|
|
1811
|
+
}
|
|
1812
|
+
return [4 /*yield*/, result];
|
|
1813
|
+
case 1: return [2 /*return*/, _8.sent()];
|
|
1814
|
+
case 2:
|
|
1815
|
+
filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
1816
|
+
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 4];
|
|
1817
|
+
result = this.gridOption.items(filterInfo);
|
|
1818
|
+
return [4 /*yield*/, result];
|
|
1819
|
+
case 3: return [2 /*return*/, _8.sent()];
|
|
1820
|
+
case 4:
|
|
1821
|
+
exportedItems = [];
|
|
1822
|
+
if (!(typeof this.gridOption.items === 'function')) return [3 /*break*/, 8];
|
|
1823
|
+
results = this.gridOption.items();
|
|
1824
|
+
if (!(results instanceof Promise)) return [3 /*break*/, 6];
|
|
1825
|
+
return [4 /*yield*/, results];
|
|
1826
|
+
case 5:
|
|
1827
|
+
exportedItems = _8.sent();
|
|
1828
|
+
return [3 /*break*/, 7];
|
|
1829
|
+
case 6:
|
|
1830
|
+
exportedItems = results;
|
|
1831
|
+
_8.label = 7;
|
|
1832
|
+
case 7: return [3 /*break*/, 9];
|
|
1833
|
+
case 8:
|
|
1834
|
+
exportedItems = this.gridOption.items;
|
|
1835
|
+
_8.label = 9;
|
|
1836
|
+
case 9: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, exportedItems, filterInfo)];
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
});
|
|
1840
|
+
});
|
|
1841
|
+
_allColumns.set(this, function () {
|
|
1842
|
+
var columns = [];
|
|
1843
|
+
_this.gridOption.columns
|
|
1844
|
+
.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
1845
|
+
.forEach(function (column) {
|
|
1846
|
+
var _a;
|
|
1847
|
+
if (column.type === 'children') {
|
|
1848
|
+
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(function (childColumn) {
|
|
1849
|
+
columns.push(childColumn);
|
|
1850
|
+
});
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
columns.push(column);
|
|
1854
|
+
});
|
|
1855
|
+
return columns;
|
|
1856
|
+
});
|
|
1857
|
+
_allExportedColumns.set(this, function () {
|
|
1858
|
+
var _a, _b;
|
|
1859
|
+
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); })) || [];
|
|
1860
|
+
});
|
|
1861
|
+
_onExport.set(this, function (isCSV) { return __awaiter(_this, void 0, void 0, function () {
|
|
1862
|
+
var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, columns_2, pageSize_1, batch, total_1, pageNumber_1, exportItems_1, items_1, promises_1, handleData, sheets, _8, _9, sheet, _10, _11, _12, e_6_1;
|
|
1863
|
+
var e_6, _13;
|
|
1864
|
+
var _this = this;
|
|
1865
|
+
return __generator(this, function (_14) {
|
|
1866
|
+
switch (_14.label) {
|
|
1867
|
+
case 0:
|
|
1868
|
+
_14.trys.push([0, , 18, 19]);
|
|
1869
|
+
columns_2 = __classPrivateFieldGet(this, _getExportColumns).call(this);
|
|
1870
|
+
pageSize_1 = ((_k = (_j = this.gridOption) === null || _j === void 0 ? void 0 : _j.export) === null || _k === void 0 ? void 0 : _k.maxItemsPerRequest) || 1000;
|
|
1871
|
+
batch = ((_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.batch) || 1;
|
|
1872
|
+
total_1 = this.total;
|
|
1873
|
+
pageNumber_1 = 0;
|
|
1874
|
+
exportItems_1 = [];
|
|
1875
|
+
this.isExporting = true;
|
|
1876
|
+
items_1 = [];
|
|
1877
|
+
promises_1 = [];
|
|
1878
|
+
handleData = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1879
|
+
var _u, results, results_1, results_1_1, result, results_2, totalPage, percent, allColumns, allExportedColumns, _loop_1, exportItems_2, exportItems_2_1, item, e_7_1;
|
|
1880
|
+
var e_8, _8, e_7, _9;
|
|
1881
|
+
var _this = this;
|
|
1882
|
+
return __generator(this, function (_10) {
|
|
1883
|
+
switch (_10.label) {
|
|
1884
|
+
case 0: return [4 /*yield*/, Promise.all(promises_1)];
|
|
1885
|
+
case 1:
|
|
1886
|
+
results = _10.sent();
|
|
1887
|
+
promises_1 = [];
|
|
1888
|
+
exportItems_1 = [];
|
|
1889
|
+
try {
|
|
1890
|
+
for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
1891
|
+
result = results_1_1.value;
|
|
1892
|
+
if ('items' in result) {
|
|
1893
|
+
exportItems_1 = __spread(exportItems_1, result.items);
|
|
1894
|
+
total_1 = result.total;
|
|
1895
|
+
}
|
|
1896
|
+
else {
|
|
1897
|
+
exportItems_1 = __spread(exportItems_1, result);
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1902
|
+
finally {
|
|
1903
|
+
try {
|
|
1904
|
+
if (results_1_1 && !results_1_1.done && (_8 = results_1.return)) _8.call(results_1);
|
|
1905
|
+
}
|
|
1906
|
+
finally { if (e_8) throw e_8.error; }
|
|
1907
|
+
}
|
|
1908
|
+
if (!((_u = this.gridOption.export) === null || _u === void 0 ? void 0 : _u.mapping)) return [3 /*break*/, 4];
|
|
1909
|
+
results_2 = this.gridOption.export.mapping(exportItems_1);
|
|
1910
|
+
if (!(results_2 instanceof Promise)) return [3 /*break*/, 3];
|
|
1911
|
+
return [4 /*yield*/, results_2];
|
|
1912
|
+
case 2:
|
|
1913
|
+
exportItems_1 = _10.sent();
|
|
1914
|
+
return [3 /*break*/, 4];
|
|
1915
|
+
case 3:
|
|
1916
|
+
exportItems_1 = results_2;
|
|
1917
|
+
_10.label = 4;
|
|
1918
|
+
case 4:
|
|
1919
|
+
totalPage = total_1 / pageSize_1;
|
|
1920
|
+
percent = Math.round(((pageNumber_1 - 1) * 100.0) / totalPage);
|
|
1921
|
+
this.exportTitle = "Exporting..." + percent + "%";
|
|
1922
|
+
allColumns = __classPrivateFieldGet(this, _allColumns).call(this);
|
|
1923
|
+
allExportedColumns = __classPrivateFieldGet(this, _allExportedColumns).call(this);
|
|
1924
|
+
_loop_1 = function (item) {
|
|
1925
|
+
var obj, handle, columns_3, columns_3_1, exportColumn, e_9_1;
|
|
1926
|
+
var e_9, _8;
|
|
1927
|
+
return __generator(this, function (_9) {
|
|
1928
|
+
switch (_9.label) {
|
|
1929
|
+
case 0:
|
|
1930
|
+
obj = {};
|
|
1931
|
+
handle = function (exportColumn) { return __awaiter(_this, void 0, void 0, function () {
|
|
1932
|
+
var _v, _w, _x, column, exportedColumn, transform, _8, _9, date, transformDate, date, transformDate, date, transformDate, _10, _11;
|
|
1933
|
+
return __generator(this, function (_12) {
|
|
1934
|
+
switch (_12.label) {
|
|
1935
|
+
case 0:
|
|
1936
|
+
obj[exportColumn.field] = item[exportColumn.field];
|
|
1937
|
+
column = allColumns.find(function (e) { return e.field === exportColumn.field; });
|
|
1938
|
+
exportedColumn = allExportedColumns.find(function (e) { return e.field === exportColumn.field; });
|
|
1939
|
+
if (exportedColumn === null || exportedColumn === void 0 ? void 0 : exportedColumn.transform) {
|
|
1940
|
+
obj[exportedColumn.field] = exportedColumn.transform(item[exportedColumn.field], item);
|
|
1941
|
+
return [2 /*return*/];
|
|
1942
|
+
}
|
|
1943
|
+
if (!column) {
|
|
1944
|
+
return [2 /*return*/];
|
|
1945
|
+
}
|
|
1946
|
+
if (column.type === 'children') {
|
|
1947
|
+
column === null || column === void 0 ? void 0 : column.children.forEach(function (childColumn) { return handle(childColumn); });
|
|
1948
|
+
return [2 /*return*/];
|
|
1949
|
+
}
|
|
1950
|
+
if (!columns_2.some(function (e) { return e.field === column.field; })) {
|
|
1951
|
+
return [2 /*return*/];
|
|
1952
|
+
}
|
|
1953
|
+
if (!column.transform) return [3 /*break*/, 4];
|
|
1954
|
+
transform = column.transform(item[column.field], item, {
|
|
1955
|
+
isExport: true,
|
|
1956
|
+
});
|
|
1957
|
+
if (!(transform instanceof Promise)) return [3 /*break*/, 2];
|
|
1958
|
+
_8 = obj;
|
|
1959
|
+
_9 = column.field;
|
|
1960
|
+
return [4 /*yield*/, transform];
|
|
1961
|
+
case 1:
|
|
1962
|
+
_8[_9] = _12.sent();
|
|
1963
|
+
return [3 /*break*/, 3];
|
|
1964
|
+
case 2:
|
|
1965
|
+
obj[column.field] = transform;
|
|
1966
|
+
_12.label = 3;
|
|
1967
|
+
case 3:
|
|
1968
|
+
obj[column.field] = (_v = obj[column.field]) !== null && _v !== void 0 ? _v : '';
|
|
1969
|
+
return [3 /*break*/, 13];
|
|
1970
|
+
case 4:
|
|
1971
|
+
if (!(item[column.field] === undefined || item[column.field] === null || item[column.field] === '')) return [3 /*break*/, 5];
|
|
1972
|
+
obj[column.field] = '';
|
|
1973
|
+
return [3 /*break*/, 13];
|
|
1974
|
+
case 5:
|
|
1975
|
+
if (!(column.type === 'string' || column.type === 'number')) return [3 /*break*/, 6];
|
|
1976
|
+
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
1977
|
+
obj[column.field] = item[column.field];
|
|
1978
|
+
return [3 /*break*/, 13];
|
|
1979
|
+
case 6:
|
|
1980
|
+
if (!(column.type === 'bool')) return [3 /*break*/, 7];
|
|
1981
|
+
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
1982
|
+
if (item[column.field]) {
|
|
1983
|
+
obj[column.field] = ((_w = column.option) === null || _w === void 0 ? void 0 : _w.displayOnTrue) || 'True';
|
|
1984
|
+
}
|
|
1985
|
+
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
1986
|
+
obj[column.field] = ((_x = column.option) === null || _x === void 0 ? void 0 : _x.displayOnFalse) || 'False';
|
|
1987
|
+
}
|
|
1988
|
+
return [3 /*break*/, 13];
|
|
1989
|
+
case 7:
|
|
1990
|
+
if (!(column.type === 'date')) return [3 /*break*/, 8];
|
|
1991
|
+
date = item[column.field];
|
|
1992
|
+
transformDate = column.transformDate;
|
|
1993
|
+
if (transformDate) {
|
|
1994
|
+
date = transformDate(date, item);
|
|
1995
|
+
}
|
|
1996
|
+
// Nếu là date thì convert theo đúng format
|
|
1997
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy');
|
|
1998
|
+
return [3 /*break*/, 13];
|
|
1999
|
+
case 8:
|
|
2000
|
+
if (!(column.type === 'datetime')) return [3 /*break*/, 9];
|
|
2001
|
+
date = item[column.field];
|
|
2002
|
+
transformDate = column.transformDate;
|
|
2003
|
+
if (transformDate) {
|
|
2004
|
+
date = transformDate(date, item);
|
|
2005
|
+
}
|
|
2006
|
+
// Nếu là datetime thì convert theo đúng format
|
|
2007
|
+
obj[column.field] = Date.toFormat(date, 'dd/MM/yyyy HH:mm');
|
|
2008
|
+
return [3 /*break*/, 13];
|
|
2009
|
+
case 9:
|
|
2010
|
+
if (!(column.type === 'time')) return [3 /*break*/, 10];
|
|
2011
|
+
date = item[column.field];
|
|
2012
|
+
transformDate = column.transformDate;
|
|
2013
|
+
if (transformDate) {
|
|
2014
|
+
date = transformDate(date, item);
|
|
2015
|
+
}
|
|
2016
|
+
// Nếu là time thì convert theo đúng format
|
|
2017
|
+
obj[column.field] = Date.toFormat(date, 'HH:mm');
|
|
2018
|
+
return [3 /*break*/, 13];
|
|
2019
|
+
case 10:
|
|
2020
|
+
if (!(column.type === 'values')) return [3 /*break*/, 12];
|
|
2021
|
+
// Nếu là values thì lấy giá trị của value được chọn
|
|
2022
|
+
_10 = obj;
|
|
2023
|
+
_11 = column.field;
|
|
2024
|
+
return [4 /*yield*/, this.columnValuesPipe.transform(item[column.field], column)];
|
|
2025
|
+
case 11:
|
|
2026
|
+
// Nếu là values thì lấy giá trị của value được chọn
|
|
2027
|
+
_10[_11] = _12.sent();
|
|
2028
|
+
return [3 /*break*/, 13];
|
|
2029
|
+
case 12:
|
|
2030
|
+
obj[column.field] = item[column.field];
|
|
2031
|
+
_12.label = 13;
|
|
2032
|
+
case 13: return [2 /*return*/];
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
}); };
|
|
2036
|
+
_9.label = 1;
|
|
2037
|
+
case 1:
|
|
2038
|
+
_9.trys.push([1, 6, 7, 8]);
|
|
2039
|
+
columns_3 = (e_9 = void 0, __values(columns_2)), columns_3_1 = columns_3.next();
|
|
2040
|
+
_9.label = 2;
|
|
2041
|
+
case 2:
|
|
2042
|
+
if (!!columns_3_1.done) return [3 /*break*/, 5];
|
|
2043
|
+
exportColumn = columns_3_1.value;
|
|
2044
|
+
return [4 /*yield*/, handle(exportColumn)];
|
|
2045
|
+
case 3:
|
|
2046
|
+
_9.sent();
|
|
2047
|
+
_9.label = 4;
|
|
2048
|
+
case 4:
|
|
2049
|
+
columns_3_1 = columns_3.next();
|
|
2050
|
+
return [3 /*break*/, 2];
|
|
2051
|
+
case 5: return [3 /*break*/, 8];
|
|
2052
|
+
case 6:
|
|
2053
|
+
e_9_1 = _9.sent();
|
|
2054
|
+
e_9 = { error: e_9_1 };
|
|
2055
|
+
return [3 /*break*/, 8];
|
|
2056
|
+
case 7:
|
|
2057
|
+
try {
|
|
2058
|
+
if (columns_3_1 && !columns_3_1.done && (_8 = columns_3.return)) _8.call(columns_3);
|
|
2059
|
+
}
|
|
2060
|
+
finally { if (e_9) throw e_9.error; }
|
|
2061
|
+
return [7 /*endfinally*/];
|
|
2062
|
+
case 8:
|
|
2063
|
+
items_1.push(obj);
|
|
2064
|
+
return [2 /*return*/];
|
|
2065
|
+
}
|
|
2066
|
+
});
|
|
2067
|
+
};
|
|
2068
|
+
_10.label = 5;
|
|
2069
|
+
case 5:
|
|
2070
|
+
_10.trys.push([5, 10, 11, 12]);
|
|
2071
|
+
exportItems_2 = __values(exportItems_1), exportItems_2_1 = exportItems_2.next();
|
|
2072
|
+
_10.label = 6;
|
|
2073
|
+
case 6:
|
|
2074
|
+
if (!!exportItems_2_1.done) return [3 /*break*/, 9];
|
|
2075
|
+
item = exportItems_2_1.value;
|
|
2076
|
+
return [5 /*yield**/, _loop_1(item)];
|
|
2077
|
+
case 7:
|
|
2078
|
+
_10.sent();
|
|
2079
|
+
_10.label = 8;
|
|
2080
|
+
case 8:
|
|
2081
|
+
exportItems_2_1 = exportItems_2.next();
|
|
2082
|
+
return [3 /*break*/, 6];
|
|
2083
|
+
case 9: return [3 /*break*/, 12];
|
|
2084
|
+
case 10:
|
|
2085
|
+
e_7_1 = _10.sent();
|
|
2086
|
+
e_7 = { error: e_7_1 };
|
|
2087
|
+
return [3 /*break*/, 12];
|
|
2088
|
+
case 11:
|
|
2089
|
+
try {
|
|
2090
|
+
if (exportItems_2_1 && !exportItems_2_1.done && (_9 = exportItems_2.return)) _9.call(exportItems_2);
|
|
2091
|
+
}
|
|
2092
|
+
finally { if (e_7) throw e_7.error; }
|
|
2093
|
+
return [7 /*endfinally*/];
|
|
2094
|
+
case 12: return [2 /*return*/];
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
}); };
|
|
2098
|
+
_14.label = 1;
|
|
2099
|
+
case 1:
|
|
2100
|
+
if (!(pageNumber_1 * pageSize_1 < total_1)) return [3 /*break*/, 3];
|
|
2101
|
+
promises_1.push(__classPrivateFieldGet(this, _exportedItems).call(this, pageNumber_1, pageSize_1));
|
|
2102
|
+
pageNumber_1++;
|
|
2103
|
+
if (promises_1.length < batch) {
|
|
2104
|
+
return [3 /*break*/, 1];
|
|
2105
|
+
}
|
|
2106
|
+
return [4 /*yield*/, handleData()];
|
|
2107
|
+
case 2:
|
|
2108
|
+
_14.sent();
|
|
2109
|
+
return [3 /*break*/, 1];
|
|
2110
|
+
case 3:
|
|
2111
|
+
if (!(promises_1.length > 0)) return [3 /*break*/, 5];
|
|
2112
|
+
return [4 /*yield*/, handleData()];
|
|
2113
|
+
case 4:
|
|
2114
|
+
_14.sent();
|
|
2115
|
+
_14.label = 5;
|
|
2116
|
+
case 5:
|
|
2117
|
+
if (!isCSV) return [3 /*break*/, 7];
|
|
2118
|
+
return [4 /*yield*/, this.exportService.exportCSV({
|
|
2119
|
+
columns: columns_2,
|
|
2120
|
+
items: items_1,
|
|
2121
|
+
fileName: (_p = (_o = this.gridOption) === null || _o === void 0 ? void 0 : _o.export) === null || _p === void 0 ? void 0 : _p.fileName,
|
|
2122
|
+
})];
|
|
2123
|
+
case 6:
|
|
2124
|
+
_14.sent();
|
|
2125
|
+
return [2 /*return*/];
|
|
2126
|
+
case 7:
|
|
2127
|
+
sheets = [];
|
|
2128
|
+
if (!Array.isArray((_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.sheets)) return [3 /*break*/, 16];
|
|
2129
|
+
_14.label = 8;
|
|
2130
|
+
case 8:
|
|
2131
|
+
_14.trys.push([8, 14, 15, 16]);
|
|
2132
|
+
_8 = __values(this.gridOption.export.sheets), _9 = _8.next();
|
|
2133
|
+
_14.label = 9;
|
|
2134
|
+
case 9:
|
|
2135
|
+
if (!!_9.done) return [3 /*break*/, 13];
|
|
2136
|
+
sheet = _9.value;
|
|
2137
|
+
if (!(sheet.name && sheet.items && sheet.fields)) return [3 /*break*/, 12];
|
|
2138
|
+
if (!Array.isArray(sheet.items)) return [3 /*break*/, 10];
|
|
2139
|
+
sheets.push({
|
|
2140
|
+
name: sheet.name,
|
|
2141
|
+
items: sheet.items,
|
|
2142
|
+
fields: sheet.fields,
|
|
2143
|
+
});
|
|
2144
|
+
return [3 /*break*/, 12];
|
|
2145
|
+
case 10:
|
|
2146
|
+
_11 = (_10 = sheets).push;
|
|
2147
|
+
_12 = {
|
|
2148
|
+
name: sheet.name
|
|
2149
|
+
};
|
|
2150
|
+
return [4 /*yield*/, sheet.items()];
|
|
2151
|
+
case 11:
|
|
2152
|
+
_11.apply(_10, [(_12.items = _14.sent(),
|
|
2153
|
+
_12.fields = sheet.fields,
|
|
2154
|
+
_12)]);
|
|
2155
|
+
_14.label = 12;
|
|
2156
|
+
case 12:
|
|
2157
|
+
_9 = _8.next();
|
|
2158
|
+
return [3 /*break*/, 9];
|
|
2159
|
+
case 13: return [3 /*break*/, 16];
|
|
2160
|
+
case 14:
|
|
2161
|
+
e_6_1 = _14.sent();
|
|
2162
|
+
e_6 = { error: e_6_1 };
|
|
2163
|
+
return [3 /*break*/, 16];
|
|
2164
|
+
case 15:
|
|
2165
|
+
try {
|
|
2166
|
+
if (_9 && !_9.done && (_13 = _8.return)) _13.call(_8);
|
|
2167
|
+
}
|
|
2168
|
+
finally { if (e_6) throw e_6.error; }
|
|
2169
|
+
return [7 /*endfinally*/];
|
|
2170
|
+
case 16: return [4 /*yield*/, this.exportService.export({
|
|
2171
|
+
columns: columns_2,
|
|
2172
|
+
items: items_1,
|
|
2173
|
+
fileName: (_t = (_s = this.gridOption) === null || _s === void 0 ? void 0 : _s.export) === null || _t === void 0 ? void 0 : _t.fileName,
|
|
2174
|
+
sheets: sheets,
|
|
2175
|
+
})];
|
|
2176
|
+
case 17:
|
|
2177
|
+
_14.sent();
|
|
2178
|
+
return [2 /*return*/];
|
|
2179
|
+
case 18:
|
|
2180
|
+
this.isExporting = false;
|
|
2181
|
+
this.exportTitle = "Export";
|
|
2182
|
+
this.ref.detectChanges();
|
|
2183
|
+
return [7 /*endfinally*/];
|
|
2184
|
+
case 19: return [2 /*return*/];
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2187
|
+
}); });
|
|
2188
|
+
_getExportColumns.set(this, function () {
|
|
2189
|
+
var _a, _b;
|
|
2190
|
+
var columns = __spread(_this.gridOption.columns.filter(function (e) { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }), (((_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); })) || []));
|
|
2191
|
+
return columns;
|
|
2192
|
+
});
|
|
2193
|
+
this.exportExcel = function () {
|
|
2194
|
+
__classPrivateFieldGet(_this, _onExport).call(_this);
|
|
2195
|
+
};
|
|
2196
|
+
this.exportCSV = function () {
|
|
2197
|
+
__classPrivateFieldGet(_this, _onExport).call(_this, true);
|
|
2198
|
+
};
|
|
2199
|
+
this.onFilterChange = function () {
|
|
2200
|
+
var _a, _b, _c, _d;
|
|
2201
|
+
(_b = (_a = _this.gridFilter) === null || _a === void 0 ? void 0 : _a.updateFilter) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
2202
|
+
if ((_d = (_c = _this.gridOption) === null || _c === void 0 ? void 0 : _c.filter) === null || _d === void 0 ? void 0 : _d.inlineColumn) {
|
|
2203
|
+
_this.filterRegister.value.set({
|
|
2204
|
+
columnOperator: _this.columnOperator,
|
|
2205
|
+
columnFilter: _this.columnFilter,
|
|
2206
|
+
});
|
|
2207
|
+
}
|
|
2208
|
+
else {
|
|
2209
|
+
_this.filterRegister.value.set({});
|
|
2210
|
+
}
|
|
2211
|
+
};
|
|
2212
|
+
this.onExpand = function (rowData) { return __awaiter(_this, void 0, void 0, function () {
|
|
2213
|
+
var _y, _z, _0, _1, _2, data;
|
|
2214
|
+
return __generator(this, function (_8) {
|
|
2215
|
+
if ((_y = this.gridOption.expand) === null || _y === void 0 ? void 0 : _y.always) {
|
|
2216
|
+
return [2 /*return*/];
|
|
2217
|
+
}
|
|
2218
|
+
if (rowData.meta.expand.isExpanding) {
|
|
2219
|
+
return [2 /*return*/];
|
|
2220
|
+
}
|
|
2221
|
+
if (rowData.meta.expand.isExpanded) {
|
|
2222
|
+
rowData.meta.expand.isExpanded = false;
|
|
2223
|
+
return [2 /*return*/];
|
|
2224
|
+
}
|
|
2225
|
+
data = (_1 = (_0 = (_z = this.gridOption) === null || _z === void 0 ? void 0 : _z.expand) === null || _0 === void 0 ? void 0 : _0.onExpand) === null || _1 === void 0 ? void 0 : _1.call(_0, rowData.current);
|
|
2226
|
+
if (!((_2 = this.gridOption.expand) === null || _2 === void 0 ? void 0 : _2.multiple)) {
|
|
2227
|
+
this.items.forEach(function (item) { return (item.meta.expand.isExpanding = item.meta.expand.isExpanded = false); });
|
|
2228
|
+
}
|
|
2229
|
+
if (data instanceof Promise) {
|
|
2230
|
+
rowData.meta.expand.isExpanding = true;
|
|
2231
|
+
data
|
|
2232
|
+
.then(function (res) {
|
|
2233
|
+
rowData.meta.expand.data = res;
|
|
2234
|
+
rowData.meta.expand.isExpanded = true;
|
|
2235
|
+
})
|
|
2236
|
+
.finally(function () { return (rowData.meta.expand.isExpanding = false); });
|
|
2237
|
+
}
|
|
2238
|
+
else {
|
|
2239
|
+
rowData.meta.expand.data = data;
|
|
2240
|
+
rowData.meta.expand.isExpanded = true;
|
|
2241
|
+
}
|
|
2242
|
+
return [2 /*return*/];
|
|
2243
|
+
});
|
|
2244
|
+
}); };
|
|
2245
|
+
this.onSelect = function (rowData) {
|
|
2246
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2247
|
+
if ((_b = (_a = rowData.meta.group) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length) {
|
|
2248
|
+
rowData.meta.group.items.forEach(function (e) { return (e.meta.selector.isSelected = rowData.meta.selector.isSelected); });
|
|
2249
|
+
(_d = (_c = _this.gridOption.selector) === null || _c === void 0 ? void 0 : _c.onSelect) === null || _d === void 0 ? void 0 : _d.call(_c, rowData.current, _this.items.filter(function (e) { return e.meta.selector.isSelected; }).map(function (e) { return e.current; }));
|
|
2250
|
+
_this.isSelectAll = _this.items.every(function (e) { return e.meta.selector.isSelected; });
|
|
2251
|
+
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2252
|
+
}
|
|
2253
|
+
else {
|
|
2254
|
+
if ((_e = _this.gridOption.selector) === null || _e === void 0 ? void 0 : _e.single) {
|
|
2255
|
+
_this.items.filter(function (e) { return e !== rowData; }).forEach(function (e) { return (e.meta.selector.isSelected = false); });
|
|
2256
|
+
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2257
|
+
return;
|
|
2258
|
+
}
|
|
2259
|
+
(_g = (_f = _this.gridOption.selector) === null || _f === void 0 ? void 0 : _f.onSelect) === null || _g === void 0 ? void 0 : _g.call(_f, rowData.current, _this.items.filter(function (e) { return e.meta.selector.isSelected; }).map(function (e) { return e.current; }));
|
|
2260
|
+
_this.isSelectAll = _this.items.every(function (e) { return e.meta.selector.isSelected; });
|
|
2261
|
+
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2262
|
+
}
|
|
2263
|
+
};
|
|
2264
|
+
this.onSelectAll = function () {
|
|
2265
|
+
var _a, _b, _c;
|
|
2266
|
+
(_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) {
|
|
2267
|
+
var _a, _b, _c, _d;
|
|
2268
|
+
if (e.meta.selector.selectable && (!((_c = (_b = (_a = _this.gridOption) === null || _a === void 0 ? void 0 : _a.selector) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.length) || ((_d = e.meta.selector.actions) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
2269
|
+
e.meta.selector.isSelected = _this.isSelectAll;
|
|
2270
|
+
}
|
|
2271
|
+
});
|
|
2272
|
+
(_c = (_b = _this.gridOption.selector) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, _this.items.filter(function (e) { return e.meta.selector.isSelected; }).map(function (e) { return e.current; }));
|
|
2273
|
+
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2274
|
+
};
|
|
2275
|
+
this.onClearSelection = function (items) {
|
|
2276
|
+
items = items || _this.items;
|
|
2277
|
+
_this.isSelectAll = false;
|
|
2278
|
+
items === null || items === void 0 ? void 0 : items.forEach(function (e) { return (e.meta.selector.isSelected = false); });
|
|
2279
|
+
__classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
|
|
2280
|
+
};
|
|
2281
|
+
_updateSelectedItems.set(this, function () {
|
|
2282
|
+
_this.selectedItems = _this.items.filter(function (item) { return item.meta.selector.isSelected; }).map(function (item) { return item.current; });
|
|
2283
|
+
_this.ref.detectChanges();
|
|
2284
|
+
});
|
|
2285
|
+
this.clearFilter = function () {
|
|
2286
|
+
_this.filterRegister.value.remove();
|
|
2287
|
+
};
|
|
2288
|
+
this.setFilter = function (args) {
|
|
2289
|
+
var _a, _b;
|
|
2290
|
+
var _8 = args || {}, columnFilter = _8.columnFilter, externalFilter = _8.externalFilter, filterDef = _8.filterDef;
|
|
2291
|
+
if (((_b = (_a = _this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.inlineColumn) && columnFilter) {
|
|
2292
|
+
_this.columnFilter = columnFilter;
|
|
2293
|
+
}
|
|
2294
|
+
_this.filterRegister.value.set({
|
|
2295
|
+
columnFilter: columnFilter,
|
|
2296
|
+
externalFilter: externalFilter,
|
|
2297
|
+
filterDef: filterDef,
|
|
2298
|
+
});
|
|
2299
|
+
};
|
|
2300
|
+
this.detectChanges = function () { return _this.ref.detectChanges(); };
|
|
2301
|
+
}
|
|
2302
|
+
Object.defineProperty(SdTable.prototype, "_gridFilter", {
|
|
2303
|
+
set: function (gridFilter) {
|
|
2304
|
+
if (gridFilter && this.gridFilter !== gridFilter) {
|
|
2305
|
+
this.gridFilter = gridFilter;
|
|
2306
|
+
// this.#subscription.add(gridFilter.filterChange.pipe(
|
|
2307
|
+
// filter(reload => reload),
|
|
2308
|
+
// debounceTime(500),
|
|
2309
|
+
// map(() => {
|
|
2310
|
+
// this.#paginator.pageIndex = 0;
|
|
2311
|
+
// this.#reload.next({
|
|
2312
|
+
// force: false,
|
|
2313
|
+
// source: 'FILTER'
|
|
2314
|
+
// });
|
|
2315
|
+
// }),
|
|
2316
|
+
// ).subscribe());
|
|
2317
|
+
}
|
|
2318
|
+
},
|
|
2319
|
+
enumerable: false,
|
|
2320
|
+
configurable: true
|
|
2321
|
+
});
|
|
2322
|
+
Object.defineProperty(SdTable.prototype, "option", {
|
|
2323
|
+
set: function (option) {
|
|
2324
|
+
if (option) {
|
|
2325
|
+
option = __classPrivateFieldGet(this, _initConfiguration$1).call(this, option);
|
|
2326
|
+
this.gridOption = option;
|
|
2327
|
+
__classPrivateFieldSet(this, _loadCompleted, false);
|
|
2328
|
+
var configuration = this.gridConfigurationService.init(this.key, this.gridOption);
|
|
2329
|
+
this.gridConfigurationObserver = configuration.observer;
|
|
2330
|
+
configuration.load();
|
|
2331
|
+
__classPrivateFieldGet(this, _optionChanges).next(this.gridOption);
|
|
2332
|
+
}
|
|
2333
|
+
},
|
|
2334
|
+
enumerable: false,
|
|
2335
|
+
configurable: true
|
|
2336
|
+
});
|
|
2337
|
+
Object.defineProperty(SdTable.prototype, "paginator", {
|
|
2338
|
+
set: function (paginator) {
|
|
2339
|
+
var _this = this;
|
|
2340
|
+
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2341
|
+
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2342
|
+
__classPrivateFieldGet(this, _subscription$1).add(paginator.page
|
|
2343
|
+
.pipe(operators.map(function () {
|
|
2344
|
+
__classPrivateFieldGet(_this, _reload).next({
|
|
2345
|
+
force: false,
|
|
2346
|
+
});
|
|
2347
|
+
}))
|
|
2348
|
+
.subscribe());
|
|
2349
|
+
}
|
|
2350
|
+
},
|
|
2351
|
+
enumerable: false,
|
|
2352
|
+
configurable: true
|
|
2353
|
+
});
|
|
2354
|
+
Object.defineProperty(SdTable.prototype, "sort", {
|
|
2355
|
+
set: function (sort) {
|
|
2356
|
+
var _this = this;
|
|
2357
|
+
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2358
|
+
__classPrivateFieldSet(this, _sort, sort);
|
|
2359
|
+
__classPrivateFieldGet(this, _subscription$1).add(sort.sortChange
|
|
2360
|
+
.pipe(operators.map(function () {
|
|
2361
|
+
__classPrivateFieldGet(_this, _reload).next({
|
|
2362
|
+
force: false,
|
|
2363
|
+
});
|
|
2364
|
+
}))
|
|
2365
|
+
.subscribe());
|
|
2366
|
+
}
|
|
2367
|
+
},
|
|
2368
|
+
enumerable: false,
|
|
2369
|
+
configurable: true
|
|
2370
|
+
});
|
|
2371
|
+
SdTable.prototype.ngOnInit = function () {
|
|
2372
|
+
__classPrivateFieldGet(this, _initCellDef).call(this);
|
|
2373
|
+
};
|
|
2374
|
+
SdTable.prototype.ngAfterViewInit = function () {
|
|
2375
|
+
var _this = this;
|
|
2376
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _reload).pipe(operators.debounceTime(200), operators.switchMap(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
2377
|
+
var filterInfo, result;
|
|
2378
|
+
return __generator(this, function (_8) {
|
|
2379
|
+
switch (_8.label) {
|
|
2380
|
+
case 0:
|
|
2381
|
+
filterInfo = __classPrivateFieldGet(this, _getFilter).call(this);
|
|
2382
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force)];
|
|
2383
|
+
case 1:
|
|
2384
|
+
result = _8.sent();
|
|
2385
|
+
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2386
|
+
return [2 /*return*/, result];
|
|
2387
|
+
}
|
|
2388
|
+
});
|
|
2389
|
+
}); }))
|
|
2390
|
+
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2391
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdCellDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2392
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFooterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2393
|
+
__classPrivateFieldGet(this, _subscription$1).add(this.sdFilterDefs.changes.pipe(operators.startWith([])).subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2394
|
+
__classPrivateFieldGet(this, _subscription$1).add(rxjs.combineLatest([
|
|
2395
|
+
__classPrivateFieldGet(this, _optionChanges).pipe(operators.startWith(this.gridOption)),
|
|
2396
|
+
this.sdFilterDefs.changes.pipe(operators.startWith(this.filterDefs)),
|
|
2397
|
+
]).subscribe(function () {
|
|
2398
|
+
__classPrivateFieldGet(_this, _loadFilterRegister).call(_this);
|
|
2399
|
+
}));
|
|
2400
|
+
__classPrivateFieldGet(this, _subscription$1).add(__classPrivateFieldGet(this, _optionChanges).subscribe(function () {
|
|
2401
|
+
if (_this.filterRegister) {
|
|
2402
|
+
__classPrivateFieldGet(_this, _reload).next({
|
|
2403
|
+
force: true,
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
}));
|
|
2407
|
+
this.ref.detectChanges();
|
|
2408
|
+
};
|
|
2409
|
+
SdTable.prototype.ngOnDestroy = function () {
|
|
2410
|
+
__classPrivateFieldGet(this, _subscription$1).unsubscribe();
|
|
2411
|
+
};
|
|
2412
|
+
Object.defineProperty(SdTable.prototype, "gridItems", {
|
|
2413
|
+
get: function () {
|
|
2414
|
+
return this.items.map(function (item) { return item.current; });
|
|
2415
|
+
},
|
|
2416
|
+
enumerable: false,
|
|
2417
|
+
configurable: true
|
|
2418
|
+
});
|
|
2419
|
+
return SdTable;
|
|
2420
|
+
}());
|
|
2421
|
+
_gridId = new WeakMap(), _optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$1 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration$1 = new WeakMap(), _loadFilterRegister = 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(), _getExportColumns = new WeakMap(), _updateSelectedItems = new WeakMap();
|
|
2422
|
+
SdTable.decorators = [
|
|
2423
|
+
{ type: core.Component, args: [{
|
|
2424
|
+
selector: 'sd-table',
|
|
2425
|
+
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"gridConfiguration | sdGridConfigurationResult : gridOption : sdSubInformation as configuration\">\r\n <sd-grid-filter\r\n *ngIf=\"!gridOption.filter?.disabled && filterRegister\"\r\n [filterRegister]=\"filterRegister\"\r\n [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\"\r\n [externalFilters]=\"gridOption?.filter?.externalFilters\"\r\n [filterDefs]=\"filterDefs\"\r\n #gridFilter>\r\n </sd-grid-filter>\r\n <ng-container *ngIf=\"items | sdGroup : gridOption; $implicit as groupedItems\">\r\n <div class=\"c-container\">\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\r\n class=\"c-table\"\r\n sdScroll\r\n [ngStyle]=\"{\r\n 'max-height': gridOption?.style?.maxHeight,\r\n 'min-height': gridOption?.style?.minHeight\r\n }\">\r\n <table\r\n *ngIf=\"items?.length; else elseEmpty\"\r\n mat-table\r\n [dataSource]=\"groupedItems\"\r\n matSort\r\n [matSortDisabled]=\"!gridOption.sort?.enable\"\r\n 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 <ng-container *ngIf=\"sdSubInformation?.templateRef\">\r\n <ng-container *ngIf=\"gridOption?.expand?.always; else useExpandCollapse\">\r\n <ng-container *ngTemplateOutlet=\"sdSubInformation.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n <ng-template #useExpandCollapse>\r\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"sdSubInformation.templateRef; context: { item: item }\"> </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-template>\r\n </ng-container>\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\r\n class=\"p-0\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button\r\n *ngIf=\"!element.isExpanding && !gridOption?.expand?.always\"\r\n mat-icon-button\r\n 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\r\n class=\"text-center px-15\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll : gridOption?.selector | async\">\r\n <mat-checkbox\r\n *ngIf=\"!gridOption.selector?.single\"\r\n class=\"c-selection\"\r\n color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\"\r\n (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\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?.selector\">\r\n <mat-checkbox\r\n class=\"c-selection\"\r\n color=\"primary\"\r\n [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\"\r\n [disabled]=\"selectedItems | selectionDisable : item : gridOption?.selector\">\r\n </mat-checkbox>\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\r\n class=\"px-8 py-8\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n 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 matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\" [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"!item?.sdGroup ? 1 : configuration.displayedColumns.length\">\r\n <div [innerHtml]=\"item?.sdGroup?.htmlTemplate | safeHtml\"></div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container\r\n *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th\r\n mat-header-cell\r\n *matHeaderCellDef\r\n cdkDrag\r\n class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\"\r\n [attr.rowspan]=\"configuration.multipleHeader && column.type !== 'children-col' ? 2 : 1\"\r\n [attr.colspan]=\"column.type === 'children-col' ? column.children?.length : 1\">\r\n <div>\r\n <div\r\n aria-hidden=\"false\"\r\n role=\"presentation\"\r\n mat-sort-header\r\n [disabled]=\"!column.sortable || column.type === 'children-col'\"\r\n [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\"></div>\r\n <sd-column-inline-filter\r\n *ngIf=\"gridOption.filter?.inlineColumn && columnOperator\"\r\n [value]=\"columnFilter[column.field]\"\r\n [(inlineOperator)]=\"columnOperator[column.field]\"\r\n [columnFilter]=\"columnFilter\"\r\n [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell\r\n class=\"d-block px-8\"\r\n *ngIf=\"!item?.sdGroup\"\r\n [sdId]=\"item.meta.id\"\r\n [key]=\"key\"\r\n [value]=\"item[column.field]\"\r\n [column]=\"column\"\r\n [item]=\"item\"\r\n [idx]=\"i\"\r\n [cellDef]=\"cellDef\"\r\n [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=\"footerDef[column.field].templateRef; context: { items: items, column: column }\">\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\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div\r\n [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter\r\n *ngIf=\"gridOption.filter?.inlineColumn && columnOperator\"\r\n [value]=\"columnFilter[column.field]\"\r\n [(inlineOperator)]=\"columnOperator[column.field]\"\r\n [columnFilter]=\"columnFilter\"\r\n [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-0\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell\r\n class=\"d-block px-8\"\r\n [sdId]=\"item.meta.id\"\r\n [key]=\"key\"\r\n [value]=\"item[column.field]\"\r\n [column]=\"column\"\r\n [item]=\"item\"\r\n [idx]=\"i\"\r\n [cellDef]=\"cellDef\"\r\n [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=\"footerDef[column.field].templateRef; context: { items: items, column: column }\">\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\"></tr>\r\n </ng-container>\r\n <tr\r\n mat-row\r\n *matRowDef=\"let row; columns: configuration.displayedColumns\"\r\n matRipple\r\n class=\"c-row\"\r\n [class.selected]=\"row.isSelected\"></tr>\r\n\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\r\n class=\"px-15\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n 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=\"sdCommand\">\r\n <th\r\n class=\"px-8\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n 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\r\n class=\"p-0\"\r\n mat-header-cell\r\n *matHeaderCellDef\r\n 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\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"sdEmptyData.templateRef; context: { item: item }\"> </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 matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\" [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\"></td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container\r\n *ngFor=\"let column of configuration.columns\"\r\n [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\r\n [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [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\r\n *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th\r\n mat-header-cell\r\n *matHeaderCellDef\r\n class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\"\r\n [attr.rowspan]=\"configuration.multipleHeader && column.type !== 'children-col' ? 2 : 1\"\r\n [attr.colspan]=\"column.type === 'children-col' ? column.children?.length : 1\">\r\n <div>\r\n <div\r\n [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\"></div>\r\n <sd-column-inline-filter\r\n *ngIf=\"gridOption.filter?.inlineColumn && columnOperator\"\r\n [value]=\"columnFilter[column.field]\"\r\n [(inlineOperator)]=\"columnOperator[column.field]\"\r\n [columnFilter]=\"columnFilter\"\r\n [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\r\n </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\r\n [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\"\r\n [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter\r\n *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\"\r\n [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\"></tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\"></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\r\n *ngIf=\"gridFilter && !gridOption.filter?.inlineColumn\"\r\n class=\"mr-10\"\r\n [title]=\"'Filter' | sdTranslate\"\r\n icon=\"filter_alt\"\r\n size=\"sm\"\r\n (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button\r\n *ngIf=\"gridOption.reload?.visible\"\r\n class=\"mr-10\"\r\n [title]=\"'Reload' | sdTranslate\"\r\n icon=\"refresh\"\r\n size=\"sm\"\r\n (action)=\"reload()\"\r\n [disabled]=\"!items?.length\"\r\n 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\" size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button\r\n class=\"mr-10\"\r\n [title]=\"exportTitle | sdTranslate\"\r\n icon=\"get_app\"\r\n size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\"\r\n type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button mat-menu-item (click)=\"exportExcel()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> Xu\u1EA5t excel</span>\r\n </button>\r\n <button mat-menu-item (click)=\"exportCSV()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> Xu\u1EA5t CSV</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button\r\n *ngIf=\"gridOption.config?.visible\"\r\n class=\"mr-10\"\r\n [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\"\r\n size=\"sm\"\r\n (action)=\"popupGridConfiguration.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator\r\n [class.d-none]=\"gridOption.paginate?.hidden\"\r\n [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\"\r\n [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\" (clear)=\"onClearSelection(groupedItems)\">\r\n </sd-grid-quick-action>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration> </sd-popup-grid-configuration>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>\r\n",
|
|
2426
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
2427
|
+
animations: [
|
|
2428
|
+
animations.trigger('detailExpand', [
|
|
2429
|
+
animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|
|
2430
|
+
animations.state('expanded', animations.style({ height: '*', visibility: 'visible' })),
|
|
2431
|
+
animations.transition('expanded <=> collapsed', animations.animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
|
|
2432
|
+
]),
|
|
2433
|
+
],
|
|
2434
|
+
styles: [".text-black400{color:#757575}:host{display:flex;flex-direction:column;height:100%;overflow:auto}:host .c-container{display:flex;flex:1;flex-direction:column;min-height:200px;position:relative}:host .c-container .c-table{flex:1;min-height:300px;position:relative}:host .c-container .c-table table{border-collapse:separate;width:100%}:host .c-container .c-table table tr.c-first-header.mat-header-row,:host .c-container .c-table table tr.c-second-header.mat-header-row{height:40px}:host .c-container .c-table table tr.c-detail-row{height:0}:host .c-container .c-table table tr.c-row.activated{background-color:#e5ecff}:host .c-container .c-table table tr.c-row.selected{background-color:#eef2ff}:host .c-container .c-table table tr.c-row:not(.selected):not(.activated):hover{background-color:#f5f5f5}:host .c-container .c-table table tr.c-row td{border-bottom-width:0}:host .c-container .c-table table tr.c-row.c-expandable{cursor:pointer}:host .c-container .c-table table tr.c-row.c-expandable:hover{background:#f5f5f5}:host .c-container .c-table table th.mat-header-cell{background-color:#f2f3f4;border-bottom:0!important}:host .c-container .c-table table td.mat-cell,:host .c-container .c-table table td.mat-footer-cell,:host .c-container .c-table table th.mat-header-cell{border-bottom-color:#f2f2f2!important}:host .c-container .c-table .c-th{color:#212121;font-size:14px;font-weight:500;line-height:20px;vertical-align:middle}:host .c-container .c-table .c-td:first{padding-left:10px}:host .c-container .c-loading{align-items:center;background:rgba(0,0,0,.15);bottom:56px;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:2}:host .c-container .c-paginator{align-items:center;background-color:#fff;display:flex;flex-direction:row;justify-content:space-between}:host .c-container .c-paginator .c-action{padding:5px}:host .c-container .c-empty{background-color:#fff;border:none!important;text-align:center}:host .c-container .c-empty mat-icon{font-size:150px;height:auto;margin-bottom:30px;margin-top:30px;opacity:.2;width:auto}:host button.c-btn-add{background-color:#fff;box-shadow:0 2px 4px rgba(47,49,54,.16)}:host mat-icon.c-icon{color:rgba(0,0,0,.54)!important}:host mat-icon.c-icon-add{color:#2962ff!important}:host .lds-ring{display:inline-block;height:40px;position:relative;width:40px}:host .lds-ring div{-webkit-animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border:4px solid transparent;border-radius:50%;border-top-color:#cef;box-sizing:border-box;display:block;height:32px;margin:4px;position:absolute;width:32px}:host .lds-ring div:first-child{-webkit-animation-delay:-.45s;animation-delay:-.45s}:host .lds-ring div:nth-child(2){-webkit-animation-delay:-.3s;animation-delay:-.3s}:host .lds-ring div:nth-child(3){-webkit-animation-delay:-.15s;animation-delay:-.15s}@-webkit-keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes lds-ring{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}:host ::ng-deep .mat-sort-header-content{display:block;text-align:left;width:100%}:host ::ng-deep .mat-select-arrow{color:#a6a6a6}:host ::ng-deep .mat-sort-header-disabled{background-image:none!important;cursor:default!important;padding-right:0!important}:host ::ng-deep .mat-sort-header-container{align-items:start!important}:host ::ng-deep .mat-sort-header-arrow{margin-top:4px!important}:host ::ng-deep .mat-sort-header{cursor:pointer}:host ::ng-deep .mat-sort-header[aria-sort]{background-position:center right 0;background-repeat:no-repeat;background-size:16px 16px;cursor:pointer;padding-right:24px}:host ::ng-deep .mat-sort-header[aria-sort=none]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=ascending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z'/%3E%3C/svg%3E\")}:host ::ng-deep .mat-sort-header[aria-sort=descending]{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24px' viewBox='0 0 24 24' width='24px' fill='%23000000'%3E%3Cpath d='M0 0h24v24H0V0z' fill='none'/%3E%3Cpath fill='%237A7A7A' d='M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z'/%3E%3C/svg%3E\")}"]
|
|
2435
|
+
},] }
|
|
2436
|
+
];
|
|
2437
|
+
SdTable.ctorParameters = function () { return [
|
|
2438
|
+
{ type: core.ChangeDetectorRef },
|
|
2439
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [TABLE_CONFIG,] }, { type: core.Optional }] },
|
|
2440
|
+
{ type: SdTableConfigurationService },
|
|
2441
|
+
{ type: _export.SdExportService },
|
|
2442
|
+
{ type: notify.SdNotifyService },
|
|
2443
|
+
{ type: SdColumnValuesPipe },
|
|
2444
|
+
{ type: SdTableFilterService }
|
|
2445
|
+
]; };
|
|
2446
|
+
SdTable.propDecorators = {
|
|
2447
|
+
sdScroll: [{ type: core.ViewChild, args: [common.SdScrollDirective,] }],
|
|
2448
|
+
quickAction: [{ type: core.ViewChild, args: [quickAction.SdQuickAction,] }],
|
|
2449
|
+
_gridFilter: [{ type: core.ViewChild, args: [SdGridFilter,] }],
|
|
2450
|
+
option: [{ type: core.Input }],
|
|
2451
|
+
paginator: [{ type: core.ViewChild, args: [paginator.MatPaginator,] }],
|
|
2452
|
+
sort: [{ type: core.ViewChild, args: [sort.MatSort,] }],
|
|
2453
|
+
sdSubInformation: [{ type: core.ContentChild, args: [SdMaterialSubInformationDefDirective,] }],
|
|
2454
|
+
sdEmptyData: [{ type: core.ContentChild, args: [SdMaterialEmptyDataDefDirective,] }],
|
|
2455
|
+
sdCellDefs: [{ type: core.ContentChildren, args: [SdMaterialCellDefDirective,] }],
|
|
2456
|
+
sdFooterDefs: [{ type: core.ContentChildren, args: [SdMaterialFooterDefDirective,] }],
|
|
2457
|
+
sdFilterDefs: [{ type: core.ContentChildren, args: [SdMaterialFilterDefDirective,] }]
|
|
2458
|
+
};
|
|
2459
|
+
|
|
2460
|
+
var SdCommandFilterPipe = /** @class */ (function () {
|
|
2461
|
+
function SdCommandFilterPipe() {
|
|
2462
|
+
}
|
|
2463
|
+
SdCommandFilterPipe.prototype.transform = function (item, commands) {
|
|
2464
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2465
|
+
var results, commands_1, commands_1_1, command, flag, hidden, isHidden, children, _a, _b, childCommand, hidden_1, isHidden, e_1_1, e_2_1;
|
|
2466
|
+
var e_2, _c, e_1, _d;
|
|
2467
|
+
return __generator(this, function (_e) {
|
|
2468
|
+
switch (_e.label) {
|
|
2469
|
+
case 0:
|
|
2470
|
+
results = [];
|
|
2471
|
+
if (!commands) {
|
|
2472
|
+
return [2 /*return*/, results];
|
|
2473
|
+
}
|
|
2474
|
+
_e.label = 1;
|
|
2475
|
+
case 1:
|
|
2476
|
+
_e.trys.push([1, 22, 23, 24]);
|
|
2477
|
+
commands_1 = __values(commands), commands_1_1 = commands_1.next();
|
|
2478
|
+
_e.label = 2;
|
|
2479
|
+
case 2:
|
|
2480
|
+
if (!!commands_1_1.done) return [3 /*break*/, 21];
|
|
2481
|
+
command = commands_1_1.value;
|
|
2482
|
+
flag = false;
|
|
2483
|
+
hidden = command.hidden;
|
|
2484
|
+
if (!(hidden === undefined)) return [3 /*break*/, 3];
|
|
2485
|
+
flag = true;
|
|
2486
|
+
return [3 /*break*/, 7];
|
|
2487
|
+
case 3:
|
|
2488
|
+
if (!(typeof (hidden) === 'boolean')) return [3 /*break*/, 4];
|
|
2489
|
+
if (!hidden) {
|
|
2490
|
+
flag = true;
|
|
2491
|
+
}
|
|
2492
|
+
return [3 /*break*/, 7];
|
|
2493
|
+
case 4:
|
|
2494
|
+
isHidden = hidden(item);
|
|
2495
|
+
if (!(isHidden instanceof Promise)) return [3 /*break*/, 6];
|
|
2496
|
+
return [4 /*yield*/, isHidden];
|
|
2497
|
+
case 5:
|
|
2498
|
+
if (!(_e.sent())) {
|
|
2499
|
+
flag = true;
|
|
2500
|
+
}
|
|
2501
|
+
return [3 /*break*/, 7];
|
|
2502
|
+
case 6:
|
|
2503
|
+
if (!isHidden) {
|
|
2504
|
+
flag = true;
|
|
2505
|
+
}
|
|
2506
|
+
_e.label = 7;
|
|
2507
|
+
case 7:
|
|
2508
|
+
if (!flag) return [3 /*break*/, 20];
|
|
2509
|
+
if (!('children' in command)) return [3 /*break*/, 19];
|
|
2510
|
+
children = [];
|
|
2511
|
+
_e.label = 8;
|
|
2512
|
+
case 8:
|
|
2513
|
+
_e.trys.push([8, 16, 17, 18]);
|
|
2514
|
+
_a = (e_1 = void 0, __values(command.children)), _b = _a.next();
|
|
2515
|
+
_e.label = 9;
|
|
2516
|
+
case 9:
|
|
2517
|
+
if (!!_b.done) return [3 /*break*/, 15];
|
|
2518
|
+
childCommand = _b.value;
|
|
2519
|
+
hidden_1 = childCommand.hidden;
|
|
2520
|
+
if (!(hidden_1 === undefined)) return [3 /*break*/, 10];
|
|
2521
|
+
children.push(childCommand);
|
|
2522
|
+
return [3 /*break*/, 14];
|
|
2523
|
+
case 10:
|
|
2524
|
+
if (!(typeof (hidden_1) === 'boolean')) return [3 /*break*/, 11];
|
|
2525
|
+
if (!hidden_1) {
|
|
2526
|
+
children.push(childCommand);
|
|
2527
|
+
}
|
|
2528
|
+
return [3 /*break*/, 14];
|
|
2529
|
+
case 11:
|
|
2530
|
+
isHidden = hidden_1(item);
|
|
2531
|
+
if (!(isHidden instanceof Promise)) return [3 /*break*/, 13];
|
|
2532
|
+
return [4 /*yield*/, isHidden];
|
|
2533
|
+
case 12:
|
|
2534
|
+
if (!(_e.sent())) {
|
|
2535
|
+
children.push(childCommand);
|
|
2536
|
+
}
|
|
2537
|
+
return [3 /*break*/, 14];
|
|
2538
|
+
case 13:
|
|
2539
|
+
if (!isHidden) {
|
|
2540
|
+
children.push(childCommand);
|
|
2541
|
+
}
|
|
2542
|
+
_e.label = 14;
|
|
2543
|
+
case 14:
|
|
2544
|
+
_b = _a.next();
|
|
2545
|
+
return [3 /*break*/, 9];
|
|
2546
|
+
case 15: return [3 /*break*/, 18];
|
|
2547
|
+
case 16:
|
|
2548
|
+
e_1_1 = _e.sent();
|
|
2549
|
+
e_1 = { error: e_1_1 };
|
|
2550
|
+
return [3 /*break*/, 18];
|
|
2551
|
+
case 17:
|
|
2552
|
+
try {
|
|
2553
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
2554
|
+
}
|
|
2555
|
+
finally { if (e_1) throw e_1.error; }
|
|
2556
|
+
return [7 /*endfinally*/];
|
|
2557
|
+
case 18:
|
|
2558
|
+
if (children.length > 0) {
|
|
2559
|
+
results.push(Object.assign(Object.assign({}, command), { children: children }));
|
|
2560
|
+
}
|
|
2561
|
+
return [3 /*break*/, 20];
|
|
2562
|
+
case 19:
|
|
2563
|
+
results.push(command);
|
|
2564
|
+
_e.label = 20;
|
|
2565
|
+
case 20:
|
|
2566
|
+
commands_1_1 = commands_1.next();
|
|
2567
|
+
return [3 /*break*/, 2];
|
|
2568
|
+
case 21: return [3 /*break*/, 24];
|
|
2569
|
+
case 22:
|
|
2570
|
+
e_2_1 = _e.sent();
|
|
2571
|
+
e_2 = { error: e_2_1 };
|
|
2572
|
+
return [3 /*break*/, 24];
|
|
2573
|
+
case 23:
|
|
2574
|
+
try {
|
|
2575
|
+
if (commands_1_1 && !commands_1_1.done && (_c = commands_1.return)) _c.call(commands_1);
|
|
2576
|
+
}
|
|
2577
|
+
finally { if (e_2) throw e_2.error; }
|
|
2578
|
+
return [7 /*endfinally*/];
|
|
2579
|
+
case 24: return [2 /*return*/, results];
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
});
|
|
2583
|
+
};
|
|
2584
|
+
return SdCommandFilterPipe;
|
|
2585
|
+
}());
|
|
2586
|
+
SdCommandFilterPipe.decorators = [
|
|
2587
|
+
{ type: core.Pipe, args: [{
|
|
2588
|
+
name: 'commandFilter'
|
|
2589
|
+
},] }
|
|
2590
|
+
];
|
|
2591
|
+
|
|
2592
|
+
var SdCommandDisablePipe = /** @class */ (function () {
|
|
2593
|
+
function SdCommandDisablePipe() {
|
|
2594
|
+
}
|
|
2595
|
+
SdCommandDisablePipe.prototype.transform = function (item, command) {
|
|
2596
|
+
if (!(command === null || command === void 0 ? void 0 : command.disabled)) {
|
|
2597
|
+
return false;
|
|
2598
|
+
}
|
|
2599
|
+
if (typeof (command.disabled) === 'boolean') {
|
|
2600
|
+
return command.disabled;
|
|
2601
|
+
}
|
|
2602
|
+
return command.disabled(item);
|
|
2603
|
+
};
|
|
2604
|
+
return SdCommandDisablePipe;
|
|
2605
|
+
}());
|
|
2606
|
+
SdCommandDisablePipe.decorators = [
|
|
2607
|
+
{ type: core.Pipe, args: [{
|
|
2608
|
+
name: 'commandDisable'
|
|
2609
|
+
},] }
|
|
2610
|
+
];
|
|
2611
|
+
|
|
2612
|
+
var SdCommandIconPipe = /** @class */ (function () {
|
|
2613
|
+
function SdCommandIconPipe() {
|
|
2614
|
+
}
|
|
2615
|
+
SdCommandIconPipe.prototype.transform = function (command, item) {
|
|
2616
|
+
if (!(command === null || command === void 0 ? void 0 : command.icon)) {
|
|
2617
|
+
return '';
|
|
2618
|
+
}
|
|
2619
|
+
if (typeof (command.icon) === 'string') {
|
|
2620
|
+
return command.icon;
|
|
2621
|
+
}
|
|
2622
|
+
return command.icon(item);
|
|
2623
|
+
};
|
|
2624
|
+
return SdCommandIconPipe;
|
|
2625
|
+
}());
|
|
2626
|
+
SdCommandIconPipe.decorators = [
|
|
2627
|
+
{ type: core.Pipe, args: [{
|
|
2628
|
+
name: 'commandIcon'
|
|
2629
|
+
},] }
|
|
2630
|
+
];
|
|
2631
|
+
|
|
2632
|
+
var SdCommandTitlePipe = /** @class */ (function () {
|
|
2633
|
+
function SdCommandTitlePipe() {
|
|
2634
|
+
}
|
|
2635
|
+
SdCommandTitlePipe.prototype.transform = function (command, item) {
|
|
2636
|
+
if (!(command === null || command === void 0 ? void 0 : command.title)) {
|
|
2637
|
+
return '';
|
|
2638
|
+
}
|
|
2639
|
+
if (typeof (command.title) === 'string') {
|
|
2640
|
+
return command.title;
|
|
2641
|
+
}
|
|
2642
|
+
return command.title(item);
|
|
2643
|
+
};
|
|
2644
|
+
return SdCommandTitlePipe;
|
|
2645
|
+
}());
|
|
2646
|
+
SdCommandTitlePipe.decorators = [
|
|
2647
|
+
{ type: core.Pipe, args: [{
|
|
2648
|
+
name: 'commandTitle'
|
|
2649
|
+
},] }
|
|
2650
|
+
];
|
|
2651
|
+
|
|
2652
|
+
var SdColumnHtmlTemplatePipe = /** @class */ (function () {
|
|
2653
|
+
function SdColumnHtmlTemplatePipe(deviceService) {
|
|
2654
|
+
this.isMobileOrTablet = false;
|
|
2655
|
+
this.isMobileOrTablet = !deviceService.isDesktop();
|
|
2656
|
+
}
|
|
2657
|
+
SdColumnHtmlTemplatePipe.prototype.transform = function (value, rowData, column) {
|
|
2658
|
+
if (typeof (column === null || column === void 0 ? void 0 : column.htmlTemplate) !== 'function') {
|
|
2659
|
+
return value;
|
|
2660
|
+
}
|
|
2661
|
+
return column === null || column === void 0 ? void 0 : column.htmlTemplate(value, rowData, this.isMobileOrTablet);
|
|
2662
|
+
};
|
|
2663
|
+
return SdColumnHtmlTemplatePipe;
|
|
2664
|
+
}());
|
|
2665
|
+
SdColumnHtmlTemplatePipe.decorators = [
|
|
2666
|
+
{ type: core.Pipe, args: [{
|
|
2667
|
+
name: 'columnHtmlTemplate'
|
|
2668
|
+
},] }
|
|
2669
|
+
];
|
|
2670
|
+
SdColumnHtmlTemplatePipe.ctorParameters = function () { return [
|
|
2671
|
+
{ type: ngxDeviceDetector.DeviceDetectorService }
|
|
2672
|
+
]; };
|
|
2673
|
+
|
|
2674
|
+
var SdDesktopCellView = /** @class */ (function () {
|
|
2675
|
+
function SdDesktopCellView() {
|
|
2676
|
+
}
|
|
2677
|
+
return SdDesktopCellView;
|
|
2678
|
+
}());
|
|
2679
|
+
SdDesktopCellView.decorators = [
|
|
2680
|
+
{ type: core.Component, args: [{
|
|
2681
|
+
selector: 'sd-desktop-cell-view',
|
|
2682
|
+
template: "<ng-container *ngIf=\"item.current[column.field] | cellView : item : column : gridOption | async as view\">\r\n <ng-container *ngIf=\"view.display.hasHtml; else useValue\">\r\n <div\r\n *ngIf=\"view.click\"\r\n (click)=\"view.click()\"\r\n class=\"text-break cursor-pointer\"\r\n [matTooltip]=\"view.tooltip\"\r\n [class.text-center]=\"view.display.align === 'center'\"\r\n [class.text-right]=\"view.display.align === 'right'\"\r\n [innerHTML]=\"view.display.html | safeHtml\"></div>\r\n <div\r\n *ngIf=\"!view.click\"\r\n class=\"text-break\"\r\n [matTooltip]=\"view.tooltip\"\r\n [class.text-center]=\"view.display.align === 'center'\"\r\n [class.text-right]=\"view.display.align === 'right'\"\r\n [innerHTML]=\"view.display.html | safeHtml\"></div>\r\n </ng-container>\r\n <ng-template #useValue>\r\n <ng-container *ngIf=\"!!view.badge; else noBadge\">\r\n <sd-badge\r\n *ngIf=\"view.display.value\"\r\n [type]=\"view.badge.type\"\r\n [title]=\"view.display.value\"\r\n [color]=\"view.badge.color\"\r\n [icon]=\"view.badge.icon\"\r\n [tooltip]=\"view.tooltip\"\r\n (sdClick)=\"!!view.click && view.click()\"></sd-badge>\r\n </ng-container>\r\n <ng-template #noBadge>\r\n <div\r\n class=\"text-break\"\r\n [class.text-center]=\"view.display.align === 'center'\"\r\n [class.text-right]=\"view.display.align === 'right'\"\r\n [matTooltip]=\"view.tooltip\">\r\n <a *ngIf=\"!!view.click\" href=\"javascript:;\" (click)=\"view.click()\">{{ view.display.value }}</a>\r\n <ng-container *ngIf=\"!view.click\">{{ view.display.value }} </ng-container>\r\n </div>\r\n </ng-template>\r\n </ng-template>\r\n</ng-container>\r\n",
|
|
2683
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
2684
|
+
styles: [".text-black400{color:#757575}.c-color-success{color:#4caf50}.c-color-danger{color:#f82c13}.c-image{-o-object-fit:contain;margin:5px 0;object-fit:contain}.c-img{font-size:30px;opacity:.5}.c-img.pointer:hover{opacity:.9}"]
|
|
2685
|
+
},] }
|
|
2686
|
+
];
|
|
2687
|
+
SdDesktopCellView.ctorParameters = function () { return []; };
|
|
2688
|
+
SdDesktopCellView.propDecorators = {
|
|
2689
|
+
sdId: [{ type: core.Input }],
|
|
2690
|
+
key: [{ type: core.Input }],
|
|
2691
|
+
column: [{ type: core.Input }],
|
|
2692
|
+
item: [{ type: core.Input }],
|
|
2693
|
+
gridOption: [{ type: core.Input }]
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2696
|
+
var SdColumnTransformPipe = /** @class */ (function () {
|
|
2697
|
+
function SdColumnTransformPipe(columnValuesPipe) {
|
|
2698
|
+
this.columnValuesPipe = columnValuesPipe;
|
|
2699
|
+
}
|
|
2700
|
+
SdColumnTransformPipe.prototype.transform = function (value, rowData, column, key) {
|
|
2701
|
+
var _a, _b;
|
|
2702
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2703
|
+
return __generator(this, function (_c) {
|
|
2704
|
+
switch (_c.label) {
|
|
2705
|
+
case 0:
|
|
2706
|
+
if (column === null || column === void 0 ? void 0 : column.transform) {
|
|
2707
|
+
return [2 /*return*/, column.transform(value, rowData)];
|
|
2708
|
+
}
|
|
2709
|
+
if (!(column.type === 'values')) return [3 /*break*/, 2];
|
|
2710
|
+
return [4 /*yield*/, this.columnValuesPipe.transform(value, column)];
|
|
2711
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
2712
|
+
case 2:
|
|
2713
|
+
if (column.type === 'number' && Number.isNumber(value)) {
|
|
2714
|
+
return [2 /*return*/, Number.toVNCurrency(value)]; // this.decimalPipe.transform(value, '1.0-2');
|
|
2715
|
+
}
|
|
2716
|
+
if (column.type === 'bool') {
|
|
2717
|
+
return [2 /*return*/, value === true ? (((_a = column.option) === null || _a === void 0 ? void 0 : _a.displayOnTrue) || 'True') : (((_b = column.option) === null || _b === void 0 ? void 0 : _b.displayOnFalse) || 'False')];
|
|
2718
|
+
}
|
|
2719
|
+
return [2 /*return*/, value];
|
|
2720
|
+
}
|
|
2721
|
+
});
|
|
2722
|
+
});
|
|
2723
|
+
};
|
|
2724
|
+
return SdColumnTransformPipe;
|
|
2725
|
+
}());
|
|
2726
|
+
SdColumnTransformPipe.decorators = [
|
|
2727
|
+
{ type: core.Pipe, args: [{
|
|
2728
|
+
name: 'columnTransform'
|
|
2729
|
+
},] }
|
|
2730
|
+
];
|
|
2731
|
+
SdColumnTransformPipe.ctorParameters = function () { return [
|
|
2732
|
+
{ type: SdColumnValuesPipe }
|
|
2733
|
+
]; };
|
|
2734
|
+
|
|
2735
|
+
var SdFilterExternalPipe = /** @class */ (function () {
|
|
2736
|
+
function SdFilterExternalPipe() {
|
|
2737
|
+
}
|
|
2738
|
+
SdFilterExternalPipe.prototype.transform = function (externalFilters, field) {
|
|
2739
|
+
var e_1, _a;
|
|
2740
|
+
var results = [];
|
|
2741
|
+
if (!externalFilters) {
|
|
2742
|
+
return results;
|
|
2743
|
+
}
|
|
2744
|
+
try {
|
|
2745
|
+
for (var externalFilters_1 = __values(externalFilters), externalFilters_1_1 = externalFilters_1.next(); !externalFilters_1_1.done; externalFilters_1_1 = externalFilters_1.next()) {
|
|
2746
|
+
var filter = externalFilters_1_1.value;
|
|
2747
|
+
results.push(filter);
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2751
|
+
finally {
|
|
2752
|
+
try {
|
|
2753
|
+
if (externalFilters_1_1 && !externalFilters_1_1.done && (_a = externalFilters_1.return)) _a.call(externalFilters_1);
|
|
2754
|
+
}
|
|
2755
|
+
finally { if (e_1) throw e_1.error; }
|
|
2756
|
+
}
|
|
2757
|
+
return results.filter(function (e) { return !field || e.field === field; });
|
|
2758
|
+
};
|
|
2759
|
+
return SdFilterExternalPipe;
|
|
2760
|
+
}());
|
|
2761
|
+
SdFilterExternalPipe.decorators = [
|
|
2762
|
+
{ type: core.Pipe, args: [{
|
|
2763
|
+
name: 'sdFilterExternal'
|
|
2764
|
+
},] }
|
|
2765
|
+
];
|
|
2766
|
+
|
|
2767
|
+
var SdFilterColumnPipe = /** @class */ (function () {
|
|
2768
|
+
function SdFilterColumnPipe() {
|
|
2769
|
+
}
|
|
2770
|
+
SdFilterColumnPipe.prototype.transform = function (columns, field) {
|
|
2771
|
+
var e_1, _c, e_2, _d;
|
|
2772
|
+
var _a, _b;
|
|
2773
|
+
var results = [];
|
|
2774
|
+
if (!columns) {
|
|
2775
|
+
return results;
|
|
2776
|
+
}
|
|
2777
|
+
try {
|
|
2778
|
+
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
2779
|
+
var column = columns_1_1.value;
|
|
2780
|
+
if (column.type === 'children') {
|
|
2781
|
+
try {
|
|
2782
|
+
for (var _e = (e_2 = void 0, __values(column === null || column === void 0 ? void 0 : column.children)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
2783
|
+
var columnChildren = _f.value;
|
|
2784
|
+
if (!((_a = columnChildren.filter) === null || _a === void 0 ? void 0 : _a.disabled)) {
|
|
2785
|
+
results.push(columnChildren);
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2790
|
+
finally {
|
|
2791
|
+
try {
|
|
2792
|
+
if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
|
|
2793
|
+
}
|
|
2794
|
+
finally { if (e_2) throw e_2.error; }
|
|
2795
|
+
}
|
|
2796
|
+
continue;
|
|
2797
|
+
}
|
|
2798
|
+
if (!((_b = column.filter) === null || _b === void 0 ? void 0 : _b.disabled)) {
|
|
2799
|
+
results.push(column);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2804
|
+
finally {
|
|
2805
|
+
try {
|
|
2806
|
+
if (columns_1_1 && !columns_1_1.done && (_c = columns_1.return)) _c.call(columns_1);
|
|
2807
|
+
}
|
|
2808
|
+
finally { if (e_1) throw e_1.error; }
|
|
2809
|
+
}
|
|
2810
|
+
return results.filter(function (e) { return !field || e.field === field; });
|
|
2811
|
+
};
|
|
2812
|
+
return SdFilterColumnPipe;
|
|
2813
|
+
}());
|
|
2814
|
+
SdFilterColumnPipe.decorators = [
|
|
2815
|
+
{ type: core.Pipe, args: [{
|
|
2816
|
+
name: 'sdFilterColumn'
|
|
2817
|
+
},] }
|
|
2818
|
+
];
|
|
2819
|
+
|
|
2820
|
+
var _isMobileOrTablet;
|
|
2821
|
+
var SdColumnChildrenFilterPipe = /** @class */ (function () {
|
|
2822
|
+
function SdColumnChildrenFilterPipe(deviceService) {
|
|
2823
|
+
_isMobileOrTablet.set(this, false);
|
|
2824
|
+
__classPrivateFieldSet(this, _isMobileOrTablet, !deviceService.isDesktop());
|
|
2825
|
+
}
|
|
2826
|
+
SdColumnChildrenFilterPipe.prototype.transform = function (columns, item) {
|
|
2827
|
+
var _this = this;
|
|
2828
|
+
return columns.filter(function (column) {
|
|
2829
|
+
var _a, _b;
|
|
2830
|
+
var value = item === null || item === void 0 ? void 0 : item[column.field];
|
|
2831
|
+
var transformValue = (_a = column.transform) === null || _a === void 0 ? void 0 : _a.call(column, item[column.field], item);
|
|
2832
|
+
var templateValue = (_b = column.htmlTemplate) === null || _b === void 0 ? void 0 : _b.call(column, item[column.field], item, __classPrivateFieldGet(_this, _isMobileOrTablet));
|
|
2833
|
+
return (value !== undefined && value !== null && value !== '')
|
|
2834
|
+
|| (transformValue !== undefined && transformValue !== null && transformValue !== '')
|
|
2835
|
+
|| (templateValue !== undefined && templateValue !== null && templateValue !== '');
|
|
2836
|
+
});
|
|
2837
|
+
};
|
|
2838
|
+
return SdColumnChildrenFilterPipe;
|
|
2839
|
+
}());
|
|
2840
|
+
_isMobileOrTablet = new WeakMap();
|
|
2841
|
+
SdColumnChildrenFilterPipe.decorators = [
|
|
2842
|
+
{ type: core.Pipe, args: [{
|
|
2843
|
+
name: 'columnChildrenFilter'
|
|
2844
|
+
},] }
|
|
2845
|
+
];
|
|
2846
|
+
SdColumnChildrenFilterPipe.ctorParameters = function () { return [
|
|
2847
|
+
{ type: ngxDeviceDetector.DeviceDetectorService }
|
|
2848
|
+
]; };
|
|
2849
|
+
|
|
2850
|
+
var SdDesktopCommand = /** @class */ (function () {
|
|
2851
|
+
function SdDesktopCommand() {
|
|
2852
|
+
this.commands = [];
|
|
2853
|
+
}
|
|
2854
|
+
return SdDesktopCommand;
|
|
2855
|
+
}());
|
|
2856
|
+
SdDesktopCommand.decorators = [
|
|
2857
|
+
{ type: core.Component, args: [{
|
|
2858
|
+
selector: 'sd-desktop-command',
|
|
2859
|
+
template: "<ng-container *ngIf=\"item | commandFilter:commands | async; $implicit as filteredCommands\">\r\n <ng-container *ngFor=\"let command of filteredCommands\">\r\n <ng-container *ngIf=\"command?.click; else elseChildren\">\r\n <button (click)=\"command.click(item)\" [matTooltip]=\"command | commandTitle:item\" aria-hidden=\"true\"\r\n [disabled]=\"item | commandDisable:command\" mat-icon-button>\r\n <mat-icon class=\"c-icon\" [fontSet]=\"command.fontSet\">{{command | commandIcon:item}}</mat-icon>\r\n </button>\r\n </ng-container>\r\n <ng-template #elseChildren>\r\n <button [matMenuTriggerFor]=\"menu\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon *ngIf=\"command?.icon\" class=\"c-icon\" [fontSet]=\"command.fontSet\">{{command | commandIcon:item}}\r\n </mat-icon>\r\n <mat-icon *ngIf=\"!command?.icon\" class=\"c-icon\">more_vert</mat-icon>\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n <span>\r\n <button *ngFor=\"let childCommand of command.children\" mat-menu-item (click)=\"childCommand.click(item)\"\r\n [disabled]=\"item | commandDisable:childCommand\">\r\n <ng-container *ngIf=\"!childCommand.htmlTemplate\">\r\n <mat-icon [fontSet]=\"command.fontSet\" class=\"c-icon\">{{childCommand | commandIcon:item}}\r\n </mat-icon>\r\n <span> {{childCommand | commandTitle:item}}</span>\r\n </ng-container>\r\n <ng-container *ngIf=\"childCommand.htmlTemplate\">\r\n <div [innerHTML]=\"childCommand.htmlTemplate(item)\"></div>\r\n </ng-container>\r\n </button>\r\n </span>\r\n </mat-menu>\r\n </ng-template>\r\n </ng-container>\r\n</ng-container>\r\n",
|
|
2860
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
2861
|
+
styles: [":host{align-items:center;display:flex}mat-icon.c-icon{color:rgba(0,0,0,.54)!important}"]
|
|
2862
|
+
},] }
|
|
2863
|
+
];
|
|
2864
|
+
SdDesktopCommand.ctorParameters = function () { return []; };
|
|
2865
|
+
SdDesktopCommand.propDecorators = {
|
|
2866
|
+
item: [{ type: core.Input }],
|
|
2867
|
+
commands: [{ type: core.Input }]
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
var SdColumnBadgePipe = /** @class */ (function () {
|
|
2871
|
+
function SdColumnBadgePipe() {
|
|
2872
|
+
}
|
|
2873
|
+
SdColumnBadgePipe.prototype.transform = function (value, rowData, column) {
|
|
2874
|
+
var _a, _b, _c;
|
|
2875
|
+
if (column.type === 'string' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2876
|
+
return {
|
|
2877
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
2878
|
+
color: column.badge(value, rowData),
|
|
2879
|
+
icon: (_a = column === null || column === void 0 ? void 0 : column.badgeIcon) === null || _a === void 0 ? void 0 : _a.call(column, value, rowData)
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
if (column.type === 'number' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2883
|
+
return {
|
|
2884
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
2885
|
+
color: column.badge(value, rowData),
|
|
2886
|
+
icon: (_b = column === null || column === void 0 ? void 0 : column.badgeIcon) === null || _b === void 0 ? void 0 : _b.call(column, value, rowData)
|
|
2887
|
+
};
|
|
2888
|
+
}
|
|
2889
|
+
if (column.type === 'bool') {
|
|
2890
|
+
return {
|
|
2891
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
2892
|
+
color: !!value ? 'success' : 'danger',
|
|
2893
|
+
icon: null
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
if (column.type === 'values' && (column === null || column === void 0 ? void 0 : column.badge)) {
|
|
2897
|
+
return {
|
|
2898
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
2899
|
+
color: column.badge(value, rowData),
|
|
2900
|
+
icon: (_c = column === null || column === void 0 ? void 0 : column.badgeIcon) === null || _c === void 0 ? void 0 : _c.call(column, value, rowData)
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
return null;
|
|
2904
|
+
};
|
|
2905
|
+
return SdColumnBadgePipe;
|
|
2906
|
+
}());
|
|
2907
|
+
SdColumnBadgePipe.decorators = [
|
|
2908
|
+
{ type: core.Pipe, args: [{
|
|
2909
|
+
name: 'columnBadge'
|
|
2910
|
+
},] }
|
|
2911
|
+
];
|
|
2912
|
+
SdColumnBadgePipe.ctorParameters = function () { return []; };
|
|
2913
|
+
|
|
2914
|
+
var SdGridConfigurationResultPipe = /** @class */ (function () {
|
|
2915
|
+
function SdGridConfigurationResultPipe(gridConfigurationService) {
|
|
2916
|
+
this.gridConfigurationService = gridConfigurationService;
|
|
2917
|
+
}
|
|
2918
|
+
SdGridConfigurationResultPipe.prototype.transform = function (configuration, gridOption, sdSubInformation) {
|
|
2919
|
+
var a = this.gridConfigurationService.generateConfigurationResult(configuration, gridOption, sdSubInformation);
|
|
2920
|
+
console.log(a);
|
|
2921
|
+
return a;
|
|
2922
|
+
};
|
|
2923
|
+
return SdGridConfigurationResultPipe;
|
|
2924
|
+
}());
|
|
2925
|
+
SdGridConfigurationResultPipe.decorators = [
|
|
2926
|
+
{ type: core.Pipe, args: [{
|
|
2927
|
+
name: 'sdGridConfigurationResult'
|
|
2928
|
+
},] }
|
|
2929
|
+
];
|
|
2930
|
+
SdGridConfigurationResultPipe.ctorParameters = function () { return [
|
|
2931
|
+
{ type: SdTableConfigurationService }
|
|
2932
|
+
]; };
|
|
2933
|
+
|
|
2934
|
+
var _cache$3;
|
|
2935
|
+
var SdPopupGridConfiguration = /** @class */ (function () {
|
|
2936
|
+
function SdPopupGridConfiguration(ref, notifyService, translateService, gridConfigurationService) {
|
|
2937
|
+
var _this = this;
|
|
2938
|
+
this.ref = ref;
|
|
2939
|
+
this.notifyService = notifyService;
|
|
2940
|
+
this.translateService = translateService;
|
|
2941
|
+
this.gridConfigurationService = gridConfigurationService;
|
|
2942
|
+
this.changes = new core.EventEmitter();
|
|
2943
|
+
_cache$3.set(this, void 0);
|
|
2944
|
+
this.isCreatingColumn = false;
|
|
2945
|
+
this.selected = {};
|
|
2946
|
+
this.disabledDrag = true;
|
|
2947
|
+
this.open = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2948
|
+
var _a;
|
|
2949
|
+
return __generator(this, function (_b) {
|
|
2950
|
+
switch (_b.label) {
|
|
2951
|
+
case 0:
|
|
2952
|
+
__classPrivateFieldSet(this, _cache$3, this.gridConfigurationService.init(this.key, this.gridOption));
|
|
2953
|
+
_a = this;
|
|
2954
|
+
return [4 /*yield*/, __classPrivateFieldGet(this, _cache$3).get()];
|
|
2955
|
+
case 1:
|
|
2956
|
+
_a.configuration = _b.sent();
|
|
2957
|
+
this.modal.open();
|
|
2958
|
+
return [2 /*return*/];
|
|
2959
|
+
}
|
|
2960
|
+
});
|
|
2961
|
+
}); };
|
|
2962
|
+
this.onSave = function () {
|
|
2963
|
+
__classPrivateFieldGet(_this, _cache$3).set(_this.configuration);
|
|
2964
|
+
_this.modal.close();
|
|
2965
|
+
_this.ref.detectChanges();
|
|
2966
|
+
};
|
|
2967
|
+
this.onReset = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2968
|
+
var translate;
|
|
2969
|
+
var _this = this;
|
|
2970
|
+
return __generator(this, function (_a) {
|
|
2971
|
+
translate = this.translateService.translate;
|
|
2972
|
+
this.notifyService.confirm(translate('Reset grid configuration to default')).then(function () {
|
|
2973
|
+
__classPrivateFieldGet(_this, _cache$3).remove();
|
|
2974
|
+
_this.modal.close();
|
|
2975
|
+
_this.ref.detectChanges();
|
|
2976
|
+
});
|
|
2977
|
+
return [2 /*return*/];
|
|
2978
|
+
});
|
|
2979
|
+
}); };
|
|
2980
|
+
this.createColumn = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2981
|
+
return __generator(this, function (_a) {
|
|
2982
|
+
this.selected = {};
|
|
2983
|
+
this.isCreatingColumn = true;
|
|
2984
|
+
return [2 /*return*/];
|
|
2985
|
+
});
|
|
2986
|
+
}); };
|
|
2987
|
+
this.confirm = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2988
|
+
var generatedColumn;
|
|
2989
|
+
return __generator(this, function (_a) {
|
|
2990
|
+
generatedColumn = {
|
|
2991
|
+
origin: {
|
|
2992
|
+
field: uuid.v4(),
|
|
2993
|
+
title: 'Generated',
|
|
2994
|
+
width: '300px',
|
|
2995
|
+
},
|
|
2996
|
+
fixed: false,
|
|
2997
|
+
invisible: false,
|
|
2998
|
+
title: 'Generated',
|
|
2999
|
+
width: '300px',
|
|
3000
|
+
};
|
|
3001
|
+
this.configuration.columns.push(generatedColumn);
|
|
3002
|
+
this.configuration = __classPrivateFieldGet(this, _cache$3).set(this.configuration);
|
|
3003
|
+
this.isCreatingColumn = false;
|
|
3004
|
+
return [2 /*return*/];
|
|
3005
|
+
});
|
|
3006
|
+
}); };
|
|
3007
|
+
}
|
|
3008
|
+
SdPopupGridConfiguration.prototype.ngOnInit = function () { };
|
|
3009
|
+
SdPopupGridConfiguration.prototype.mouseUp = function (event) {
|
|
3010
|
+
this.disabledDrag = true;
|
|
3011
|
+
};
|
|
3012
|
+
SdPopupGridConfiguration.prototype.dropTable = function (event) {
|
|
3013
|
+
dragDrop.moveItemInArray(this.configuration.columns, event.previousIndex, event.currentIndex);
|
|
3014
|
+
this.table.renderRows();
|
|
3015
|
+
};
|
|
3016
|
+
SdPopupGridConfiguration.prototype.handleMouseDown = function () {
|
|
3017
|
+
this.disabledDrag = false;
|
|
3018
|
+
};
|
|
3019
|
+
SdPopupGridConfiguration.prototype.handleMouseUp = function () {
|
|
3020
|
+
this.disabledDrag = true;
|
|
3021
|
+
};
|
|
3022
|
+
return SdPopupGridConfiguration;
|
|
3023
|
+
}());
|
|
3024
|
+
_cache$3 = new WeakMap();
|
|
3025
|
+
SdPopupGridConfiguration.decorators = [
|
|
3026
|
+
{ type: core.Component, args: [{
|
|
3027
|
+
selector: 'sd-popup-grid-configuration',
|
|
3028
|
+
template: "<sd-modal width=\"sm\" [title]=\"'Configuration' | sdTranslate\" #modal>\r\n <sd-modal-body *ngIf=\"configuration\">\r\n <div *ngIf=\"!isCreatingColumn\" class=\"c-container\">\r\n <div class=\"c-table\" style=\"max-height:70vh\">\r\n <table #table mat-table [dataSource]=\"configuration.columns\"\r\n cdkDropList\r\n [cdkDropListData]=\"configuration.columns\"\r\n (cdkDropListDropped)=\"dropTable($event)\">\r\n >\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <div class=\"c-handle\" (mousedown) = \"handleMouseDown()\" (mouseup)=\"handleMouseUp()\">\r\n <svg width=\"24px\" fill=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path d=\"M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z\"></path>\r\n <path d=\"M0 0h24v24H0z\" fill=\"none\"></path>\r\n </svg>\r\n </div>\r\n\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <sd-input [placeholder]=\"item?.origin?.title\" [(model)]=\"item.title\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"width\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef style=\"width:80px\">{{'Width' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <!-- <span>{{item.width}}</span>\r\n <mat-slider\r\n step=\"1\"\r\n min=\"0\"\r\n [max]=\"+item?.origin?.width*3\"\r\n [(ngModel)]=\"+item.width\"\r\n aria-label=\"units\">\r\n </mat-slider> -->\r\n <sd-input [placeholder]=\"item?.origin?.width\" [(model)]=\"item.width\" disableErrorMessage></sd-input>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"invisible\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Hidden' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.invisible\" color=\"primary\">\r\n </mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"fixed\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:80px\">{{'Freeze' |\r\n sdTranslate}}\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item;\">\r\n <mat-slide-toggle [(ngModel)]=\"item.fixed\" color=\"primary\"></mat-slide-toggle>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title', 'width', 'invisible', 'fixed']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title', 'width', 'invisible', 'fixed'];\" cdkDrag [cdkDragData]=\"row\" cdkDragLockAxis=\"y\" [cdkDragDisabled] = \"disabledDrag\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n <div *ngIf=\"isCreatingColumn\">\r\n <div class=\"c-table\" style=\"max-height:50vh\">\r\n <table mat-table [dataSource]=\"configuration.columns\">\r\n <ng-container matColumnDef=\"stt\">\r\n <th mat-header-cell class=\"c-th text-center px-5\" *matHeaderCellDef style=\"width:50px\">#\r\n </th>\r\n <td class=\"text-center px-5\" mat-cell *matCellDef=\"let item; let idx = index\">\r\n <sd-checkbox *ngIf=\"isCreatingColumn\" [(model)]=\"selected[item.origin?.field]\"></sd-checkbox>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"title\">\r\n <th mat-header-cell class=\"c-th px-5\" *matHeaderCellDef>{{'Title' | sdTranslate}}\r\n </th>\r\n <td class=\"px-5\" mat-cell *matCellDef=\"let item;\">\r\n <span *ngIf=\"isCreatingColumn\">{{item.title || item?.origin?.title}}</span>\r\n </td>\r\n </ng-container>\r\n <tr mat-header-row *matHeaderRowDef=\"['stt', 'title']; sticky: true\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['stt', 'title'];\"></tr>\r\n </table>\r\n </div>\r\n </div>\r\n </sd-modal-body>\r\n <sd-modal-footer>\r\n <ng-container *ngIf=\"!isCreatingColumn\">\r\n <!-- <sd-button class=\"mr-auto\" (action)=\"createColumn()\" [title]=\"'Create column' | sdTranslate\" color=\"info\"\r\n size=\"sm\">\r\n </sd-button> -->\r\n <sd-button class=\"mr-5\" (action)=\"onReset()\" [title]=\"'Default' | sdTranslate\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n <sd-button (action)=\"onSave()\" [title]=\"'Save' | sdTranslate\" type=\"fill\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-container *ngIf=\"isCreatingColumn\">\r\n <sd-button class=\"mr-auto\" (action)=\"isCreatingColumn = false\" [title]=\"'Cancel' | sdTranslate\" color=\"info\"\r\n size=\"sm\">\r\n </sd-button>\r\n <sd-button (action)=\"confirm()\" [title]=\"'Confirm' | sdTranslate\" type=\"fill\" color=\"info\" size=\"sm\">\r\n </sd-button>\r\n </ng-container>\r\n </sd-modal-footer>\r\n</sd-modal>",
|
|
3029
|
+
styles: [".c-table{overflow:auto;position:relative}.c-table table{width:100%}.c-table .c-th{color:#000;font-size:14px;font-weight:500;line-height:20px}.c-container{min-height:200px;position:relative}.c-handle{color:#ccc;cursor:move}"]
|
|
3030
|
+
},] }
|
|
3031
|
+
];
|
|
3032
|
+
SdPopupGridConfiguration.ctorParameters = function () { return [
|
|
3033
|
+
{ type: core.ChangeDetectorRef },
|
|
3034
|
+
{ type: notify.SdNotifyService },
|
|
3035
|
+
{ type: translate.SdTranslateService },
|
|
3036
|
+
{ type: SdTableConfigurationService }
|
|
3037
|
+
]; };
|
|
3038
|
+
SdPopupGridConfiguration.propDecorators = {
|
|
3039
|
+
gridOption: [{ type: core.Input }],
|
|
3040
|
+
key: [{ type: core.Input }],
|
|
3041
|
+
modal: [{ type: core.ViewChild, args: ['modal',] }],
|
|
3042
|
+
table: [{ type: core.ViewChild, args: ['table',] }],
|
|
3043
|
+
mouseUp: [{ type: core.HostListener, args: ['window:mouseup', ['$event'],] }]
|
|
3044
|
+
};
|
|
3045
|
+
|
|
3046
|
+
var SdColumnTooltipPipe = /** @class */ (function () {
|
|
3047
|
+
function SdColumnTooltipPipe() {
|
|
3048
|
+
}
|
|
3049
|
+
SdColumnTooltipPipe.prototype.transform = function (value, rowData, column) {
|
|
3050
|
+
if (column === null || column === void 0 ? void 0 : column.tooltip) {
|
|
3051
|
+
return column.tooltip(value, rowData);
|
|
3052
|
+
}
|
|
3053
|
+
return null;
|
|
3054
|
+
};
|
|
3055
|
+
return SdColumnTooltipPipe;
|
|
3056
|
+
}());
|
|
3057
|
+
SdColumnTooltipPipe.decorators = [
|
|
3058
|
+
{ type: core.Pipe, args: [{
|
|
3059
|
+
name: 'columnTooltip'
|
|
3060
|
+
},] }
|
|
3061
|
+
];
|
|
3062
|
+
SdColumnTooltipPipe.ctorParameters = function () { return []; };
|
|
3063
|
+
|
|
3064
|
+
var _convert;
|
|
3065
|
+
var SdSelectionActionFilterPipe = /** @class */ (function () {
|
|
3066
|
+
function SdSelectionActionFilterPipe() {
|
|
3067
|
+
var _this = this;
|
|
3068
|
+
_convert.set(this, function (action) {
|
|
3069
|
+
if ('children' in action) {
|
|
3070
|
+
return {
|
|
3071
|
+
title: action.title,
|
|
3072
|
+
icon: action.icon,
|
|
3073
|
+
fontSet: action.fontSet,
|
|
3074
|
+
tooltip: action.tooltip,
|
|
3075
|
+
color: action.color,
|
|
3076
|
+
type: action.type,
|
|
3077
|
+
children: action.children.map(function (e) { return ({
|
|
3078
|
+
title: e.title,
|
|
3079
|
+
icon: e.icon,
|
|
3080
|
+
color: action.color,
|
|
3081
|
+
type: action.type,
|
|
3082
|
+
fontSet: e.fontSet,
|
|
3083
|
+
tooltip: e.tooltip,
|
|
3084
|
+
click: e.click
|
|
3085
|
+
}); })
|
|
3086
|
+
};
|
|
3087
|
+
}
|
|
3088
|
+
return {
|
|
3089
|
+
title: action.title,
|
|
3090
|
+
icon: action.icon,
|
|
3091
|
+
color: action.color,
|
|
3092
|
+
type: action.type,
|
|
3093
|
+
fontSet: action.fontSet,
|
|
3094
|
+
tooltip: action.tooltip,
|
|
3095
|
+
click: action.click
|
|
3096
|
+
};
|
|
3097
|
+
});
|
|
3098
|
+
this.transform = function (selectedItems, actions) {
|
|
3099
|
+
var e_1, _a;
|
|
3100
|
+
var results = [];
|
|
3101
|
+
if (!(actions === null || actions === void 0 ? void 0 : actions.length) || !(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.length)) {
|
|
3102
|
+
return [];
|
|
3103
|
+
}
|
|
3104
|
+
var _loop_1 = function (action) {
|
|
3105
|
+
var e_2, _a;
|
|
3106
|
+
if ('children' in action) {
|
|
3107
|
+
var children = [];
|
|
3108
|
+
var _loop_2 = function (childAction) {
|
|
3109
|
+
var key = hash__default['default'](childAction);
|
|
3110
|
+
if (selectedItems.every(function (e) { return e.meta.selector.actions.includes(key); })) {
|
|
3111
|
+
children.push(childAction);
|
|
3112
|
+
}
|
|
3113
|
+
};
|
|
3114
|
+
try {
|
|
3115
|
+
for (var _b = (e_2 = void 0, __values(action.children)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3116
|
+
var childAction = _c.value;
|
|
3117
|
+
_loop_2(childAction);
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3121
|
+
finally {
|
|
3122
|
+
try {
|
|
3123
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3124
|
+
}
|
|
3125
|
+
finally { if (e_2) throw e_2.error; }
|
|
3126
|
+
}
|
|
3127
|
+
if (children.length > 0) {
|
|
3128
|
+
results.push(Object.assign(Object.assign({}, action), { children: children }));
|
|
3129
|
+
}
|
|
3130
|
+
}
|
|
3131
|
+
else {
|
|
3132
|
+
var key_1 = hash__default['default'](action);
|
|
3133
|
+
if (selectedItems.every(function (e) { return e.meta.selector.actions.includes(key_1); })) {
|
|
3134
|
+
results.push(action);
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
};
|
|
3138
|
+
try {
|
|
3139
|
+
for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
|
|
3140
|
+
var action = actions_1_1.value;
|
|
3141
|
+
_loop_1(action);
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3145
|
+
finally {
|
|
3146
|
+
try {
|
|
3147
|
+
if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
|
|
3148
|
+
}
|
|
3149
|
+
finally { if (e_1) throw e_1.error; }
|
|
3150
|
+
}
|
|
3151
|
+
return results.map(function (result) { return __classPrivateFieldGet(_this, _convert).call(_this, result); });
|
|
3152
|
+
};
|
|
3153
|
+
}
|
|
3154
|
+
return SdSelectionActionFilterPipe;
|
|
3155
|
+
}());
|
|
3156
|
+
_convert = new WeakMap();
|
|
3157
|
+
SdSelectionActionFilterPipe.decorators = [
|
|
3158
|
+
{ type: core.Pipe, args: [{
|
|
3159
|
+
name: 'selectionActionFilter'
|
|
3160
|
+
},] }
|
|
3161
|
+
];
|
|
3162
|
+
|
|
3163
|
+
var SdSelectionDisablePipe = /** @class */ (function () {
|
|
3164
|
+
function SdSelectionDisablePipe() {
|
|
3165
|
+
this.transform = function (selectedItems, rowData, selection) {
|
|
3166
|
+
var e_1, _a, e_2, _b;
|
|
3167
|
+
var disabled = selection.disabled, actions = selection.actions;
|
|
3168
|
+
if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
|
|
3169
|
+
if (!disabled) {
|
|
3170
|
+
rowData.meta.selector.selectable = true;
|
|
3171
|
+
return false;
|
|
3172
|
+
}
|
|
3173
|
+
rowData.meta.selector.selectable = !disabled(rowData, selectedItems);
|
|
3174
|
+
return !rowData.meta.selector.selectable;
|
|
3175
|
+
}
|
|
3176
|
+
// Lọc các action theo selectedItems hiện tại
|
|
3177
|
+
var availableActions = actions.filter(function (action) {
|
|
3178
|
+
var e_3, _a;
|
|
3179
|
+
if ('children' in action) {
|
|
3180
|
+
var _loop_1 = function (childAction) {
|
|
3181
|
+
var key = hash__default['default'](childAction);
|
|
3182
|
+
if (selectedItems.every(function (e) { return e.meta.selector.actions.includes(key); })) {
|
|
3183
|
+
return { value: true };
|
|
3184
|
+
}
|
|
3185
|
+
};
|
|
3186
|
+
try {
|
|
3187
|
+
for (var _b = __values(action.children), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3188
|
+
var childAction = _c.value;
|
|
3189
|
+
var state_1 = _loop_1(childAction);
|
|
3190
|
+
if (typeof state_1 === "object")
|
|
3191
|
+
return state_1.value;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3195
|
+
finally {
|
|
3196
|
+
try {
|
|
3197
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3198
|
+
}
|
|
3199
|
+
finally { if (e_3) throw e_3.error; }
|
|
3200
|
+
}
|
|
3201
|
+
return false;
|
|
3202
|
+
}
|
|
3203
|
+
else {
|
|
3204
|
+
var key_1 = hash__default['default'](action);
|
|
3205
|
+
return selectedItems.every(function (e) { return e.meta.selector.actions.includes(key_1); });
|
|
3206
|
+
}
|
|
3207
|
+
});
|
|
3208
|
+
try {
|
|
3209
|
+
// Kiểm tra rowData có action nào thỏa hay ko, nếu ko thì disabled
|
|
3210
|
+
for (var availableActions_1 = __values(availableActions), availableActions_1_1 = availableActions_1.next(); !availableActions_1_1.done; availableActions_1_1 = availableActions_1.next()) {
|
|
3211
|
+
var action = availableActions_1_1.value;
|
|
3212
|
+
if ('children' in action) {
|
|
3213
|
+
try {
|
|
3214
|
+
for (var _c = (e_2 = void 0, __values(action.children)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3215
|
+
var childAction = _d.value;
|
|
3216
|
+
if (rowData.meta.selector.actions.includes(hash__default['default'](childAction))) {
|
|
3217
|
+
return false;
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3222
|
+
finally {
|
|
3223
|
+
try {
|
|
3224
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
3225
|
+
}
|
|
3226
|
+
finally { if (e_2) throw e_2.error; }
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
else {
|
|
3230
|
+
if (rowData.meta.selector.actions.includes(hash__default['default'](action))) {
|
|
3231
|
+
return false;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3237
|
+
finally {
|
|
3238
|
+
try {
|
|
3239
|
+
if (availableActions_1_1 && !availableActions_1_1.done && (_a = availableActions_1.return)) _a.call(availableActions_1);
|
|
3240
|
+
}
|
|
3241
|
+
finally { if (e_1) throw e_1.error; }
|
|
3242
|
+
}
|
|
3243
|
+
return true;
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
return SdSelectionDisablePipe;
|
|
3247
|
+
}());
|
|
3248
|
+
SdSelectionDisablePipe.decorators = [
|
|
3249
|
+
{ type: core.Pipe, args: [{
|
|
3250
|
+
name: 'selectionDisable'
|
|
3251
|
+
},] }
|
|
3252
|
+
];
|
|
3253
|
+
|
|
3254
|
+
var SdSelectionVisibleSelectAllPipe = /** @class */ (function () {
|
|
3255
|
+
function SdSelectionVisibleSelectAllPipe() {
|
|
3256
|
+
var _this = this;
|
|
3257
|
+
this.transform = function (items, selection) { return __awaiter(_this, void 0, void 0, function () {
|
|
3258
|
+
var actions, first, _loop_1, _b, _c, action, state_1;
|
|
3259
|
+
var e_1, _d;
|
|
3260
|
+
return __generator(this, function (_e) {
|
|
3261
|
+
switch (_e.label) {
|
|
3262
|
+
case 0:
|
|
3263
|
+
actions = selection.actions;
|
|
3264
|
+
if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
|
|
3265
|
+
return [2 /*return*/, true];
|
|
3266
|
+
}
|
|
3267
|
+
if (!items.length) {
|
|
3268
|
+
return [2 /*return*/, false];
|
|
3269
|
+
}
|
|
3270
|
+
if (actions.some(function (e) { return ('children' in e && e.children.some(function (e1) { return e1.isGrouped; })) || e.isGrouped; })) {
|
|
3271
|
+
return [2 /*return*/, false];
|
|
3272
|
+
}
|
|
3273
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 500); })];
|
|
3274
|
+
case 1:
|
|
3275
|
+
_e.sent();
|
|
3276
|
+
first = items.find(function (t) { var _a; return (_a = t.meta.selector.actions) === null || _a === void 0 ? void 0 : _a.length; });
|
|
3277
|
+
if (first) {
|
|
3278
|
+
_loop_1 = function (action) {
|
|
3279
|
+
if (items.filter(function (t) { var _a; return (_a = t.meta.selector.actions) === null || _a === void 0 ? void 0 : _a.length; }).every(function (e) { return e.meta.selector.actions.includes(action); })) {
|
|
3280
|
+
return { value: true };
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3283
|
+
try {
|
|
3284
|
+
for (_b = __values(first.meta.selector.actions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3285
|
+
action = _c.value;
|
|
3286
|
+
state_1 = _loop_1(action);
|
|
3287
|
+
if (typeof state_1 === "object")
|
|
3288
|
+
return [2 /*return*/, state_1.value];
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3292
|
+
finally {
|
|
3293
|
+
try {
|
|
3294
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
3295
|
+
}
|
|
3296
|
+
finally { if (e_1) throw e_1.error; }
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
return [2 /*return*/, false];
|
|
3300
|
+
}
|
|
3301
|
+
});
|
|
3302
|
+
}); };
|
|
3303
|
+
}
|
|
3304
|
+
return SdSelectionVisibleSelectAllPipe;
|
|
3305
|
+
}());
|
|
3306
|
+
SdSelectionVisibleSelectAllPipe.decorators = [
|
|
3307
|
+
{ type: core.Pipe, args: [{
|
|
3308
|
+
name: 'selectionVisibleSelectAll'
|
|
3309
|
+
},] }
|
|
3310
|
+
];
|
|
3311
|
+
|
|
3312
|
+
var SdDesktopCell = /** @class */ (function () {
|
|
3313
|
+
function SdDesktopCell() {
|
|
3314
|
+
this.cellDef = {};
|
|
3315
|
+
}
|
|
3316
|
+
return SdDesktopCell;
|
|
3317
|
+
}());
|
|
3318
|
+
SdDesktopCell.decorators = [
|
|
3319
|
+
{ type: core.Component, args: [{
|
|
3320
|
+
selector: 'sd-desktop-cell',
|
|
3321
|
+
template: "<ng-container *ngIf=\"cellDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"cellDef[column.field].templateRef; context: { item: item, column: column, idx: idx }\"> </ng-container>\r\n</ng-container>\r\n<sd-desktop-cell-view\r\n *ngIf=\"!cellDef[column.field]\"\r\n [sdId]=\"item.meta.id\"\r\n [key]=\"key\"\r\n [column]=\"column\"\r\n [gridOption]=\"gridOption\"\r\n [item]=\"item\">\r\n</sd-desktop-cell-view>\r\n",
|
|
3322
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
3323
|
+
},] }
|
|
3324
|
+
];
|
|
3325
|
+
SdDesktopCell.ctorParameters = function () { return []; };
|
|
3326
|
+
SdDesktopCell.propDecorators = {
|
|
3327
|
+
sdId: [{ type: core.Input }],
|
|
3328
|
+
value: [{ type: core.Input }],
|
|
3329
|
+
key: [{ type: core.Input }],
|
|
3330
|
+
column: [{ type: core.Input }],
|
|
3331
|
+
item: [{ type: core.Input }],
|
|
3332
|
+
gridOption: [{ type: core.Input }],
|
|
3333
|
+
cellDef: [{ type: core.Input }],
|
|
3334
|
+
idx: [{ type: core.Input }]
|
|
3335
|
+
};
|
|
3336
|
+
|
|
3337
|
+
var SdFilterOperators = [
|
|
3338
|
+
{
|
|
3339
|
+
value: 'EQUAL',
|
|
3340
|
+
symbol: '=',
|
|
3341
|
+
display: 'Bằng',
|
|
3342
|
+
},
|
|
3343
|
+
{
|
|
3344
|
+
value: 'NOT_EQUAL',
|
|
3345
|
+
symbol: '≠',
|
|
3346
|
+
display: 'Không bằng',
|
|
3347
|
+
},
|
|
3348
|
+
{
|
|
3349
|
+
value: 'GREATER_THAN',
|
|
3350
|
+
symbol: '>',
|
|
3351
|
+
display: 'Lớn hơn',
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
value: 'LESS_THAN',
|
|
3355
|
+
symbol: '<',
|
|
3356
|
+
display: 'Nhỏ hơn',
|
|
3357
|
+
},
|
|
3358
|
+
{
|
|
3359
|
+
value: 'GREATER_OR_EQUAL',
|
|
3360
|
+
symbol: '≥',
|
|
3361
|
+
display: 'Lớn hơn, hoặc bằng'
|
|
3362
|
+
},
|
|
3363
|
+
{
|
|
3364
|
+
value: 'LESS_OR_EQUAL',
|
|
3365
|
+
symbol: '≤',
|
|
3366
|
+
display: 'Nhỏ hơn, hoặc bằng'
|
|
3367
|
+
},
|
|
3368
|
+
{
|
|
3369
|
+
value: 'CONTAIN',
|
|
3370
|
+
symbol: 'join_inner',
|
|
3371
|
+
display: 'Chứa',
|
|
3372
|
+
},
|
|
3373
|
+
{
|
|
3374
|
+
value: 'NOT_CONTAIN',
|
|
3375
|
+
symbol: 'join',
|
|
3376
|
+
display: 'Không chứa',
|
|
3377
|
+
},
|
|
3378
|
+
{
|
|
3379
|
+
value: 'START_WITH',
|
|
3380
|
+
symbol: 'line_start_circle',
|
|
3381
|
+
display: 'Bắt đầu bởi'
|
|
3382
|
+
},
|
|
3383
|
+
{
|
|
3384
|
+
value: 'END_WITH',
|
|
3385
|
+
symbol: 'line_end_circle',
|
|
3386
|
+
display: 'Kết thúc bởi'
|
|
3387
|
+
},
|
|
3388
|
+
{
|
|
3389
|
+
value: 'IN',
|
|
3390
|
+
symbol: 'checklist_rtl',
|
|
3391
|
+
display: 'Nằm trong'
|
|
3392
|
+
},
|
|
3393
|
+
{
|
|
3394
|
+
value: 'NOT_IN',
|
|
3395
|
+
symbol: 'event_list',
|
|
3396
|
+
display: 'Không nằm trong'
|
|
3397
|
+
},
|
|
3398
|
+
];
|
|
3399
|
+
|
|
3400
|
+
var _inlineOperator_1, _valueChanges, _subcription;
|
|
3401
|
+
var SdColumnInlineFilter = /** @class */ (function () {
|
|
3402
|
+
function SdColumnInlineFilter(ref) {
|
|
3403
|
+
var _this = this;
|
|
3404
|
+
this.ref = ref;
|
|
3405
|
+
this.inlineSymbol = 'filter_alt';
|
|
3406
|
+
_inlineOperator_1.set(this, void 0);
|
|
3407
|
+
this.inlineOperatorChange = new core.EventEmitter();
|
|
3408
|
+
this.columnFilter = {};
|
|
3409
|
+
this.operators = [];
|
|
3410
|
+
this.filterChange = new core.EventEmitter();
|
|
3411
|
+
_valueChanges.set(this, new rxjs.Subject());
|
|
3412
|
+
_subcription.set(this, new rxjs.Subscription());
|
|
3413
|
+
this.onFilterChange = function () {
|
|
3414
|
+
_this.filterChange.emit();
|
|
3415
|
+
};
|
|
3416
|
+
this.onChangeOperator = function (operator) {
|
|
3417
|
+
if (operator) {
|
|
3418
|
+
__classPrivateFieldSet(_this, _inlineOperator_1, operator.value);
|
|
3419
|
+
_this.inlineSymbol = operator.symbol;
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
__classPrivateFieldSet(_this, _inlineOperator_1, null);
|
|
3423
|
+
_this.inlineSymbol = 'filter_alt';
|
|
3424
|
+
}
|
|
3425
|
+
_this.inlineOperatorChange.emit(__classPrivateFieldGet(_this, _inlineOperator_1));
|
|
3426
|
+
_this.ref.markForCheck();
|
|
3427
|
+
};
|
|
3428
|
+
}
|
|
3429
|
+
SdColumnInlineFilter.prototype._value = function (value) {
|
|
3430
|
+
this.value = value;
|
|
3431
|
+
__classPrivateFieldGet(this, _valueChanges).next();
|
|
3432
|
+
};
|
|
3433
|
+
Object.defineProperty(SdColumnInlineFilter.prototype, "_inlineOperator", {
|
|
3434
|
+
set: function (inlineOperator) {
|
|
3435
|
+
var _a, _b;
|
|
3436
|
+
if (__classPrivateFieldGet(this, _inlineOperator_1) !== inlineOperator) {
|
|
3437
|
+
__classPrivateFieldSet(this, _inlineOperator_1, inlineOperator);
|
|
3438
|
+
this.inlineSymbol = (_b = (_a = SdFilterOperators.find(function (e) { return e.value === inlineOperator; })) === null || _a === void 0 ? void 0 : _a.symbol) !== null && _b !== void 0 ? _b : 'filter_alt';
|
|
3439
|
+
}
|
|
3440
|
+
},
|
|
3441
|
+
enumerable: false,
|
|
3442
|
+
configurable: true
|
|
3443
|
+
});
|
|
3444
|
+
Object.defineProperty(SdColumnInlineFilter.prototype, "_columnFilter", {
|
|
3445
|
+
set: function (columnFilter) {
|
|
3446
|
+
this.columnFilter = columnFilter || {};
|
|
3447
|
+
__classPrivateFieldGet(this, _valueChanges).next();
|
|
3448
|
+
},
|
|
3449
|
+
enumerable: false,
|
|
3450
|
+
configurable: true
|
|
3451
|
+
});
|
|
3452
|
+
Object.defineProperty(SdColumnInlineFilter.prototype, "_column", {
|
|
3453
|
+
set: function (column) {
|
|
3454
|
+
var _a, _b, _c;
|
|
3455
|
+
this.column = column;
|
|
3456
|
+
if (!((_a = column === null || column === void 0 ? void 0 : column.filter) === null || _a === void 0 ? void 0 : _a.disabled) && ((_c = (_b = column === null || column === void 0 ? void 0 : column.filter) === null || _b === void 0 ? void 0 : _b.operator) === null || _c === void 0 ? void 0 : _c.enable)) {
|
|
3457
|
+
this.operators = SdFilterOperators.filter(function (e) { var _a, _b; return (_b = (_a = column.filter.operator.list) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, e.value); });
|
|
3458
|
+
}
|
|
3459
|
+
else {
|
|
3460
|
+
this.operators = [];
|
|
3461
|
+
}
|
|
3462
|
+
},
|
|
3463
|
+
enumerable: false,
|
|
3464
|
+
configurable: true
|
|
3465
|
+
});
|
|
3466
|
+
SdColumnInlineFilter.prototype.ngOnInit = function () {
|
|
3467
|
+
var _this = this;
|
|
3468
|
+
__classPrivateFieldGet(this, _subcription).add(__classPrivateFieldGet(this, _valueChanges).pipe(operators.startWith(this.columnFilter)).subscribe(function () {
|
|
3469
|
+
var _a, _b;
|
|
3470
|
+
if (_this.column.type === 'date' || _this.column.type === 'time' || _this.column.type === 'datetime') {
|
|
3471
|
+
if (!((_b = (_a = _this.column) === null || _a === void 0 ? void 0 : _a.option) === null || _b === void 0 ? void 0 : _b.useFilterDate)) {
|
|
3472
|
+
_this.columnFilter[_this.column.field] = _this.columnFilter[_this.column.field] || {
|
|
3473
|
+
from: null,
|
|
3474
|
+
to: null,
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
}));
|
|
3479
|
+
};
|
|
3480
|
+
SdColumnInlineFilter.prototype.ngOnDestroy = function () {
|
|
3481
|
+
__classPrivateFieldGet(this, _subcription).unsubscribe();
|
|
3482
|
+
};
|
|
3483
|
+
return SdColumnInlineFilter;
|
|
3484
|
+
}());
|
|
3485
|
+
_inlineOperator_1 = new WeakMap(), _valueChanges = new WeakMap(), _subcription = new WeakMap();
|
|
3486
|
+
SdColumnInlineFilter.decorators = [
|
|
3487
|
+
{ type: core.Component, args: [{
|
|
3488
|
+
selector: 'sd-column-inline-filter',
|
|
3489
|
+
template: "<div class=\"d-flex c-inline-column\">\r\n <ng-container\r\n *ngIf=\"\r\n column.type === 'string' ||\r\n column.type === 'number' ||\r\n column.type === 'bool' ||\r\n column.type === 'values' ||\r\n column.type === 'date' ||\r\n column.type === 'datetime' ||\r\n column.type === 'time';\r\n else noFilter\r\n \">\r\n <div class=\"d-flex align-items-center\" *ngIf=\"operators.length\">\r\n <!-- Only number column icon broken. add mb when not default symbol -->\r\n <sd-button class=\"{{ (column.type === 'number' && inlineSymbol !== 'filter_alt') ? 'mb-4 mr-2 ' :'mr-2 '}}\" fontSet=\"material-symbols-outlined\" [icon]=\"inlineSymbol\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\"> </sd-button>\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngFor=\"let operator of operators\" (click)=\"onChangeOperator(operator)\" mat-menu-item type=\"button\">\r\n <mat-icon fontSet=\"material-symbols-outlined\" class=\"{{column.type === 'number' ? 'mb-8 ':''}}\">{{ operator.symbol }}</mat-icon>\r\n <span> {{ operator.display }}</span>\r\n </button>\r\n </mat-menu>\r\n </div>\r\n <sd-input\r\n *ngIf=\"column.type === 'string'\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n type=\"text\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (keyupEnter)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n </sd-input>\r\n <sd-input-number\r\n *ngIf=\"column.type === 'number'\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (keyupEnter)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n </sd-input-number>\r\n <sd-select\r\n *ngIf=\"column.type === 'bool'\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n [items]=\"[\r\n { value: '1', display: column.option?.displayOnTrue || 'True' },\r\n { value: '0', display: column.option?.displayOnFalse || 'False' }\r\n ]\"\r\n valueField=\"value\"\r\n displayField=\"display\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (sdChange)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n <ng-template sdSelectDisplayDef let-item=\"item\">\r\n <sd-badge *ngIf=\"item.value === '1'\" color=\"success\" [title]=\"column.option?.displayOnTrue || 'True'\"> </sd-badge>\r\n <sd-badge *ngIf=\"item.value === '0'\" color=\"danger\" [title]=\"column.option?.displayOnFalse || 'False'\"> </sd-badge>\r\n </ng-template>\r\n </sd-select>\r\n <sd-select\r\n *ngIf=\"column.type === 'values' && column?.option?.selection !== 'AUTOCOMPLETE'\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (sdChange)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\"\r\n [multiple]=\"column?.option?.selection === 'MULTIPLE' || column?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\"\r\n [filtered]=\"column?.option?.selection === 'MULTIPLEAUTOCOMPLETE'\">\r\n </sd-select>\r\n <sd-autocomplete\r\n *ngIf=\"column.type === 'values' && column?.option?.selection === 'AUTOCOMPLETE'\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n [items]=\"column.option.items\"\r\n [valueField]=\"column.option.valueField\"\r\n [displayField]=\"column.option.displayField\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (sdChange)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n </sd-autocomplete>\r\n <ng-container *ngIf=\"column.type === 'date' || column.type === 'datetime' || column.type === 'time'\">\r\n <sd-date-range\r\n *ngIf=\"!column.option?.useFilterDate\"\r\n style=\"flex: 1\"\r\n size=\"sm\"\r\n [(from)]=\"columnFilter[column.field].from\"\r\n [(to)]=\"columnFilter[column.field].to\"\r\n (sdChange)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n </sd-date-range>\r\n <sd-date-time\r\n *ngIf=\"column.option?.useFilterDate\"\r\n style=\"flex: 1\"\r\n type=\"date\"\r\n size=\"sm\"\r\n [(model)]=\"columnFilter[column.field]\"\r\n (sdChange)=\"onFilterChange()\"\r\n [disabled]=\"column.filter?.disabled\">\r\n </sd-date-time>\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #noFilter>\r\n <sd-input type=\"text\" size=\"sm\" disabled> </sd-input>\r\n </ng-template>\r\n</div>\r\n",
|
|
3490
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
3491
|
+
styles: [":host ::ng-deep .c-inline-column .mat-form-field-wrapper{background-color:#fff;border-radius:8px;margin:8px 0 0!important;padding:0!important}"]
|
|
3492
|
+
},] }
|
|
3493
|
+
];
|
|
3494
|
+
SdColumnInlineFilter.ctorParameters = function () { return [
|
|
3495
|
+
{ type: core.ChangeDetectorRef }
|
|
3496
|
+
]; };
|
|
3497
|
+
SdColumnInlineFilter.propDecorators = {
|
|
3498
|
+
_value: [{ type: core.Input, args: ['value',] }],
|
|
3499
|
+
_inlineOperator: [{ type: core.Input, args: ['inlineOperator',] }],
|
|
3500
|
+
inlineOperatorChange: [{ type: core.Output }],
|
|
3501
|
+
_columnFilter: [{ type: core.Input, args: ['columnFilter',] }],
|
|
3502
|
+
_column: [{ type: core.Input, args: ['column',] }],
|
|
3503
|
+
filterChange: [{ type: core.Output }]
|
|
3504
|
+
};
|
|
3505
|
+
|
|
3506
|
+
var SdSelectionVisiblePipe = /** @class */ (function () {
|
|
3507
|
+
function SdSelectionVisiblePipe() {
|
|
3508
|
+
this.transform = function (rowData, selection) {
|
|
3509
|
+
var e_1, _d, e_2, _e;
|
|
3510
|
+
var _a, _b, _c;
|
|
3511
|
+
var actions = selection.actions;
|
|
3512
|
+
var groupedActions = [];
|
|
3513
|
+
rowData.meta.selector.actions = rowData.meta.selector.actions || [];
|
|
3514
|
+
if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
|
|
3515
|
+
rowData.meta.selector.selectable = true;
|
|
3516
|
+
return rowData.meta.selector.selectable;
|
|
3517
|
+
}
|
|
3518
|
+
try {
|
|
3519
|
+
for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
|
|
3520
|
+
var action = actions_1_1.value;
|
|
3521
|
+
if ('children' in action) {
|
|
3522
|
+
var flag = false;
|
|
3523
|
+
var hasGroup = false;
|
|
3524
|
+
try {
|
|
3525
|
+
for (var _f = (e_2 = void 0, __values(action.children)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
3526
|
+
var childAction = _g.value;
|
|
3527
|
+
var hidden = childAction.hidden, isGrouped = childAction.isGrouped;
|
|
3528
|
+
var key = hash__default['default'](childAction);
|
|
3529
|
+
if (isGrouped) {
|
|
3530
|
+
hasGroup = true;
|
|
3531
|
+
}
|
|
3532
|
+
if (typeof (hidden) === 'function') {
|
|
3533
|
+
if (!hidden(rowData)) {
|
|
3534
|
+
flag = true;
|
|
3535
|
+
rowData.meta.selector.actions.push(key);
|
|
3536
|
+
if (isGrouped) {
|
|
3537
|
+
groupedActions.push(key);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
else if (!hidden) {
|
|
3542
|
+
flag = true;
|
|
3543
|
+
rowData.meta.selector.actions.push(key);
|
|
3544
|
+
if (isGrouped) {
|
|
3545
|
+
groupedActions.push(key);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3551
|
+
finally {
|
|
3552
|
+
try {
|
|
3553
|
+
if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
|
|
3554
|
+
}
|
|
3555
|
+
finally { if (e_2) throw e_2.error; }
|
|
3556
|
+
}
|
|
3557
|
+
if (flag) {
|
|
3558
|
+
rowData.meta.selector.actions.push(hash__default['default'](action));
|
|
3559
|
+
if (hasGroup) {
|
|
3560
|
+
groupedActions.push(hash__default['default'](action));
|
|
3561
|
+
}
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
else {
|
|
3565
|
+
var hidden = action.hidden, isGrouped = action.isGrouped;
|
|
3566
|
+
var key = hash__default['default'](action);
|
|
3567
|
+
if (typeof (hidden) === 'function') {
|
|
3568
|
+
if (!hidden(rowData)) {
|
|
3569
|
+
rowData.meta.selector.actions.push(key);
|
|
3570
|
+
if (isGrouped) {
|
|
3571
|
+
groupedActions.push(key);
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
else if (!hidden) {
|
|
3576
|
+
rowData.meta.selector.actions.push(key);
|
|
3577
|
+
if (isGrouped) {
|
|
3578
|
+
groupedActions.push(key);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3585
|
+
finally {
|
|
3586
|
+
try {
|
|
3587
|
+
if (actions_1_1 && !actions_1_1.done && (_d = actions_1.return)) _d.call(actions_1);
|
|
3588
|
+
}
|
|
3589
|
+
finally { if (e_1) throw e_1.error; }
|
|
3590
|
+
}
|
|
3591
|
+
rowData.meta.selector.selectable = !!((_a = rowData.meta.selector.actions) === null || _a === void 0 ? void 0 : _a.length);
|
|
3592
|
+
if (!rowData.meta.selector.selectable || !groupedActions.length || ((_c = (_b = rowData === null || rowData === void 0 ? void 0 : rowData.meta.group) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
3593
|
+
return rowData.meta.selector.selectable;
|
|
3594
|
+
}
|
|
3595
|
+
// Đối với trường hợp grouped, tuy selectable là true nhưng vẫn ẩn đi checkbox
|
|
3596
|
+
// nếu các action đều thuộc groupedActions và rowData ko phải là dòng group
|
|
3597
|
+
return rowData.meta.selector.actions.some(function (action) { return !groupedActions.includes(action); });
|
|
3598
|
+
};
|
|
3599
|
+
}
|
|
3600
|
+
return SdSelectionVisiblePipe;
|
|
3601
|
+
}());
|
|
3602
|
+
SdSelectionVisiblePipe.decorators = [
|
|
3603
|
+
{ type: core.Pipe, args: [{
|
|
3604
|
+
name: 'selectionVisible'
|
|
3605
|
+
},] }
|
|
3606
|
+
];
|
|
3607
|
+
|
|
3608
|
+
var SdGridQuickAction = /** @class */ (function () {
|
|
3609
|
+
function SdGridQuickAction() {
|
|
3610
|
+
var _this = this;
|
|
3611
|
+
this.clear = new core.EventEmitter();
|
|
3612
|
+
this.onClear = function () {
|
|
3613
|
+
_this.clear.emit();
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
3616
|
+
return SdGridQuickAction;
|
|
3617
|
+
}());
|
|
3618
|
+
SdGridQuickAction.decorators = [
|
|
3619
|
+
{ type: core.Component, args: [{
|
|
3620
|
+
selector: 'sd-grid-quick-action',
|
|
3621
|
+
template: "<sd-quick-action *ngIf=\"selectedItems | selectionActionFilter: gridOption?.selector?.actions as actions\"\r\n [isOpened]=\"actions?.length\">\r\n <div class=\"d-flex align-items-center\" sdMessage>\r\n <div class=\"c-bg-length\">\r\n <span class=\"c-length\">{{ selectedItems.length }}</span>\r\n </div>\r\n <div class=\"c-message\">{{ gridOption?.selector?.message || 'd\u1EEF li\u1EC7u \u0111\u01B0\u1EE3c ch\u1ECDn' }}</div>\r\n </div>\r\n <div class=\"d-flex align-items-center mr-8\" sdAction>\r\n <ng-container *ngFor=\"let action of actions\">\r\n <sd-button *ngIf=\"action.click\" class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" (action)=\"action.click(selectedItems)\"></sd-button>\r\n <ng-container *ngIf=\"action.children?.length\">\r\n <sd-button class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon || 'more_vert'\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" [matMenuTriggerFor]=\"menu\">\r\n </sd-button>\r\n <mat-menu #menu=\"matMenu\">\r\n <span>\r\n <button *ngFor=\"let childAction of action.children\" mat-menu-item (click)=\"childAction.click(selectedItems)\"\r\n [disabled]=\"childAction.disabled\">\r\n <mat-icon [fontSet]=\"childAction.fontSet\" class=\"c-icon\">{{ childAction.icon }}\r\n </mat-icon>\r\n <span> {{ childAction.title }}</span>\r\n </button>\r\n </span>\r\n </mat-menu>\r\n </ng-container>\r\n </ng-container>\r\n <sd-button class=\"ml-5\" icon=\"close\" color=\"secondary\" type=\"outline\" size=\"sm\"\r\n (action)=\"onClear()\" width=\"35px\"></sd-button>\r\n </div>\r\n</sd-quick-action>",
|
|
3622
|
+
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
|
3623
|
+
styles: [".c-bg-length{align-items:flex-start;background:#2962ff;border-radius:4px 0 0 4px;display:flex;flex-direction:column;height:48px;left:0;min-width:48px;padding:12px 8px;position:static;top:0;width:auto}.c-bg-length .c-length{color:#fff;font-size:16px;font-weight:500;height:24px;left:8px;line-height:24px;min-width:32px;text-align:center;top:12px;width:auto}.c-bg-length .c-length,.c-message{font-family:Roboto;font-style:normal;position:static}.c-message{color:#000;font-size:14px;font-weight:400;height:20px;left:0;line-height:20px;margin:0 0 0 16px;min-width:200px;top:6px}"]
|
|
3624
|
+
},] }
|
|
3625
|
+
];
|
|
3626
|
+
SdGridQuickAction.ctorParameters = function () { return []; };
|
|
3627
|
+
SdGridQuickAction.propDecorators = {
|
|
3628
|
+
gridOption: [{ type: core.Input }],
|
|
3629
|
+
selectedItems: [{ type: core.Input }],
|
|
3630
|
+
clear: [{ type: core.Output }]
|
|
3631
|
+
};
|
|
3632
|
+
|
|
3633
|
+
var _maxSecond, _maxMinute, _maxHour, _maxDay, _maxMonth, _isMobileOrTablet$1;
|
|
3634
|
+
var SdCellViewPipe = /** @class */ (function () {
|
|
3635
|
+
function SdCellViewPipe(deviceService, utilityService, columnValuesPipe) {
|
|
3636
|
+
this.utilityService = utilityService;
|
|
3637
|
+
this.columnValuesPipe = columnValuesPipe;
|
|
3638
|
+
_maxSecond.set(this, 60);
|
|
3639
|
+
_maxMinute.set(this, __classPrivateFieldGet(this, _maxSecond) * 60);
|
|
3640
|
+
_maxHour.set(this, __classPrivateFieldGet(this, _maxMinute) * 24);
|
|
3641
|
+
_maxDay.set(this, __classPrivateFieldGet(this, _maxHour) * 30);
|
|
3642
|
+
_maxMonth.set(this, __classPrivateFieldGet(this, _maxHour) * 365);
|
|
3643
|
+
_isMobileOrTablet$1.set(this, false);
|
|
3644
|
+
__classPrivateFieldSet(this, _isMobileOrTablet$1, !deviceService.isDesktop());
|
|
3645
|
+
}
|
|
3646
|
+
SdCellViewPipe.prototype.transform = function (value, tableItem, column, gridOption) {
|
|
3647
|
+
var _a;
|
|
3648
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3649
|
+
var displayOnEmpty, rowData, align, click, tooltip, htmlTemplate, transform, result, transformDate, val, _b, option, seconds, date, time, dateTime, _c, option, values, display, emptyValues;
|
|
3650
|
+
return __generator(this, function (_d) {
|
|
3651
|
+
switch (_d.label) {
|
|
3652
|
+
case 0:
|
|
3653
|
+
displayOnEmpty = gridOption.displayOnEmpty;
|
|
3654
|
+
rowData = tableItem.current;
|
|
3655
|
+
align = column.align, click = column.click, tooltip = column.tooltip, htmlTemplate = column.htmlTemplate, transform = column.transform;
|
|
3656
|
+
result = {
|
|
3657
|
+
badge: null,
|
|
3658
|
+
tooltip: null,
|
|
3659
|
+
display: {
|
|
3660
|
+
align: align || (column.type === 'number' ? 'right' : 'left'),
|
|
3661
|
+
value: value
|
|
3662
|
+
},
|
|
3663
|
+
click: null
|
|
3664
|
+
};
|
|
3665
|
+
if (!(typeof (htmlTemplate) === 'function')) return [3 /*break*/, 1];
|
|
3666
|
+
result.display.hasHtml = true;
|
|
3667
|
+
result.display.html = htmlTemplate(value, rowData, __classPrivateFieldGet(this, _isMobileOrTablet$1));
|
|
3668
|
+
return [3 /*break*/, 10];
|
|
3669
|
+
case 1:
|
|
3670
|
+
if (column.type === 'datetime' || column.type === 'date' || column.type === 'time') {
|
|
3671
|
+
transformDate = column.transformDate;
|
|
3672
|
+
if (transformDate) {
|
|
3673
|
+
value = transformDate(value, rowData);
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
if (!(typeof (transform) === 'function')) return [3 /*break*/, 5];
|
|
3677
|
+
val = transform(value, rowData);
|
|
3678
|
+
if (!(val instanceof Promise)) return [3 /*break*/, 3];
|
|
3679
|
+
_b = result.display;
|
|
3680
|
+
return [4 /*yield*/, val];
|
|
3681
|
+
case 2:
|
|
3682
|
+
_b.value = _d.sent();
|
|
3683
|
+
return [3 /*break*/, 4];
|
|
3684
|
+
case 3:
|
|
3685
|
+
result.display.value = val;
|
|
3686
|
+
_d.label = 4;
|
|
3687
|
+
case 4: return [3 /*break*/, 9];
|
|
3688
|
+
case 5:
|
|
3689
|
+
if (column.type === 'date' || column.type === 'datetime') {
|
|
3690
|
+
option = column.option;
|
|
3691
|
+
seconds = Math.round((new Date().getTime() - new Date(value).getTime()) / 1000);
|
|
3692
|
+
if ((option === null || option === void 0 ? void 0 : option.timeDifferent) === 'month' && seconds < __classPrivateFieldGet(this, _maxMonth)) {
|
|
3693
|
+
result.display.value = this.utilityService.timeDifference(value);
|
|
3694
|
+
result.tooltip = Date.toFormat(value, column.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm');
|
|
3695
|
+
}
|
|
3696
|
+
else if ((option === null || option === void 0 ? void 0 : option.timeDifferent) === 'day' && seconds < __classPrivateFieldGet(this, _maxDay)) {
|
|
3697
|
+
result.display.value = this.utilityService.timeDifference(value);
|
|
3698
|
+
result.tooltip = Date.toFormat(value, column.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm');
|
|
3699
|
+
}
|
|
3700
|
+
else if ((option === null || option === void 0 ? void 0 : option.timeDifferent) === 'hour' && seconds < __classPrivateFieldGet(this, _maxHour)) {
|
|
3701
|
+
result.display.value = this.utilityService.timeDifference(value);
|
|
3702
|
+
result.tooltip = Date.toFormat(value, column.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm');
|
|
3703
|
+
}
|
|
3704
|
+
else if ((option === null || option === void 0 ? void 0 : option.timeDifferent) === 'minute' && seconds < __classPrivateFieldGet(this, _maxMinute)) {
|
|
3705
|
+
result.display.value = this.utilityService.timeDifference(value);
|
|
3706
|
+
result.tooltip = Date.toFormat(value, column.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm');
|
|
3707
|
+
}
|
|
3708
|
+
else if ((option === null || option === void 0 ? void 0 : option.timeDifferent) === 'second' && seconds < __classPrivateFieldGet(this, _maxSecond)) {
|
|
3709
|
+
result.display.value = this.utilityService.timeDifference(value);
|
|
3710
|
+
result.tooltip = Date.toFormat(value, column.type === 'date' ? 'dd/MM/yyyy' : 'dd/MM/yyyy HH:mm');
|
|
3711
|
+
}
|
|
3712
|
+
else {
|
|
3713
|
+
date = Date.toFormat(value, 'dd/MM/yyyy');
|
|
3714
|
+
time = Date.toFormat(value, 'HH:mm');
|
|
3715
|
+
dateTime = Date.toFormat(value, 'HH:mm');
|
|
3716
|
+
if (column.type === 'datetime' && time && time !== '00:00') {
|
|
3717
|
+
result.display.value = dateTime;
|
|
3718
|
+
result.display.hasHtml = true;
|
|
3719
|
+
result.display.html = "<span class=\"d-block T14R text-black400\">" + Date.toFormat(value, 'HH:mm') + "</span><span class=\"d-block T14R\">" + Date.toFormat(value, 'dd/MM/yyyy') + "</span>";
|
|
3720
|
+
}
|
|
3721
|
+
else {
|
|
3722
|
+
result.display.value = date;
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3726
|
+
if (column.type === 'time') {
|
|
3727
|
+
result.display.value = Date.toFormat(value, 'HH:mm');
|
|
3728
|
+
}
|
|
3729
|
+
if (!(column.type === 'values')) return [3 /*break*/, 7];
|
|
3730
|
+
_c = result.display;
|
|
3731
|
+
return [4 /*yield*/, this.columnValuesPipe.transform(value, column)];
|
|
3732
|
+
case 6:
|
|
3733
|
+
_c.value = _d.sent();
|
|
3734
|
+
return [3 /*break*/, 8];
|
|
3735
|
+
case 7:
|
|
3736
|
+
if (column.type === 'number' && Number.isNumber(value)) {
|
|
3737
|
+
result.display.value = Number.toVNCurrency(value);
|
|
3738
|
+
}
|
|
3739
|
+
_d.label = 8;
|
|
3740
|
+
case 8:
|
|
3741
|
+
if (column.type === 'bool') {
|
|
3742
|
+
option = column.option;
|
|
3743
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
3744
|
+
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');
|
|
3745
|
+
}
|
|
3746
|
+
else {
|
|
3747
|
+
result.display.value = null;
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
_d.label = 9;
|
|
3751
|
+
case 9:
|
|
3752
|
+
if (displayOnEmpty) {
|
|
3753
|
+
values = [null, undefined, ''];
|
|
3754
|
+
if (typeof (displayOnEmpty) === 'object') {
|
|
3755
|
+
display = displayOnEmpty.display, emptyValues = displayOnEmpty.emptyValues;
|
|
3756
|
+
values = __spread([null, undefined, ''], emptyValues);
|
|
3757
|
+
if (values.includes(result.display.value)) {
|
|
3758
|
+
if (typeof (display) === 'function') {
|
|
3759
|
+
result.display.hasHtml = true;
|
|
3760
|
+
result.display.html = display(rowData, column);
|
|
3761
|
+
}
|
|
3762
|
+
else {
|
|
3763
|
+
result.display.hasHtml = true;
|
|
3764
|
+
result.display.html = "<div class=\"T16R text-black400\">--</div>";
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
if (values.includes(result.display.value)) {
|
|
3770
|
+
if (typeof (displayOnEmpty) === 'function') {
|
|
3771
|
+
result.display.hasHtml = true;
|
|
3772
|
+
result.display.html = displayOnEmpty(rowData, column);
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
result.display.hasHtml = true;
|
|
3776
|
+
result.display.html = "<div class=\"T16R text-black400\">--</div>";
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
}
|
|
3781
|
+
_d.label = 10;
|
|
3782
|
+
case 10:
|
|
3783
|
+
// Badge
|
|
3784
|
+
if ((column.type === 'string' || column.type === 'number' || column.type === 'values') && column.badge) {
|
|
3785
|
+
result.badge = {
|
|
3786
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
3787
|
+
color: column.badge(value, rowData),
|
|
3788
|
+
icon: (_a = column === null || column === void 0 ? void 0 : column.badgeIcon) === null || _a === void 0 ? void 0 : _a.call(column, value, rowData)
|
|
3789
|
+
};
|
|
3790
|
+
}
|
|
3791
|
+
else if (column.type === 'bool') {
|
|
3792
|
+
result.badge = {
|
|
3793
|
+
type: !(column === null || column === void 0 ? void 0 : column.badgeType) ? 'round' : column.badgeType,
|
|
3794
|
+
color: !!value ? 'success' : 'danger',
|
|
3795
|
+
icon: null
|
|
3796
|
+
};
|
|
3797
|
+
}
|
|
3798
|
+
// Tooltip
|
|
3799
|
+
if (typeof (tooltip) === 'function') {
|
|
3800
|
+
result.tooltip = tooltip(value, rowData);
|
|
3801
|
+
}
|
|
3802
|
+
// Clickable
|
|
3803
|
+
if (typeof (click) === 'function') {
|
|
3804
|
+
result.click = function () { return click(value, rowData); };
|
|
3805
|
+
}
|
|
3806
|
+
return [2 /*return*/, result];
|
|
3807
|
+
}
|
|
3808
|
+
});
|
|
3809
|
+
});
|
|
3810
|
+
};
|
|
3811
|
+
return SdCellViewPipe;
|
|
3812
|
+
}());
|
|
3813
|
+
_maxSecond = new WeakMap(), _maxMinute = new WeakMap(), _maxHour = new WeakMap(), _maxDay = new WeakMap(), _maxMonth = new WeakMap(), _isMobileOrTablet$1 = new WeakMap();
|
|
3814
|
+
SdCellViewPipe.decorators = [
|
|
3815
|
+
{ type: core.Pipe, args: [{
|
|
3816
|
+
name: 'cellView'
|
|
3817
|
+
},] }
|
|
3818
|
+
];
|
|
3819
|
+
SdCellViewPipe.ctorParameters = function () { return [
|
|
3820
|
+
{ type: ngxDeviceDetector.DeviceDetectorService },
|
|
3821
|
+
{ type: utility.SdUtilityService },
|
|
3822
|
+
{ type: SdColumnValuesPipe }
|
|
3823
|
+
]; };
|
|
3824
|
+
|
|
3825
|
+
var SdGroupPipe = /** @class */ (function () {
|
|
3826
|
+
function SdGroupPipe() {
|
|
3827
|
+
}
|
|
3828
|
+
SdGroupPipe.prototype.transform = function (items, gridOption) {
|
|
3829
|
+
var e_1, _b, e_2, _c, _d, e_3, _e, e_4, _f;
|
|
3830
|
+
var _a;
|
|
3831
|
+
var group = gridOption.group;
|
|
3832
|
+
if (!group) {
|
|
3833
|
+
return items;
|
|
3834
|
+
}
|
|
3835
|
+
var fields = group.fields, htmlTemplate = group.htmlTemplate;
|
|
3836
|
+
if (!(fields === null || fields === void 0 ? void 0 : fields.length)) {
|
|
3837
|
+
return items;
|
|
3838
|
+
}
|
|
3839
|
+
var groupItem = {};
|
|
3840
|
+
try {
|
|
3841
|
+
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
3842
|
+
var item = items_1_1.value;
|
|
3843
|
+
var obj = {};
|
|
3844
|
+
try {
|
|
3845
|
+
for (var fields_1 = (e_2 = void 0, __values(fields)), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
|
|
3846
|
+
var field = fields_1_1.value;
|
|
3847
|
+
obj = Object.assign(Object.assign({}, obj), ((_a = item[field]) !== null && _a !== void 0 ? _a : (_d = {}, _d[field] = item[field], _d)));
|
|
3848
|
+
}
|
|
3849
|
+
}
|
|
3850
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3851
|
+
finally {
|
|
3852
|
+
try {
|
|
3853
|
+
if (fields_1_1 && !fields_1_1.done && (_c = fields_1.return)) _c.call(fields_1);
|
|
3854
|
+
}
|
|
3855
|
+
finally { if (e_2) throw e_2.error; }
|
|
3856
|
+
}
|
|
3857
|
+
var key = hash__default['default'](obj);
|
|
3858
|
+
if (!groupItem[key]) {
|
|
3859
|
+
groupItem[key] = [];
|
|
3860
|
+
}
|
|
3861
|
+
groupItem[key].push(item);
|
|
3862
|
+
}
|
|
3863
|
+
}
|
|
3864
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3865
|
+
finally {
|
|
3866
|
+
try {
|
|
3867
|
+
if (items_1_1 && !items_1_1.done && (_b = items_1.return)) _b.call(items_1);
|
|
3868
|
+
}
|
|
3869
|
+
finally { if (e_1) throw e_1.error; }
|
|
3870
|
+
}
|
|
3871
|
+
var results = [];
|
|
3872
|
+
try {
|
|
3873
|
+
for (var _g = __values(Object.keys(groupItem)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
3874
|
+
var key = _h.value;
|
|
3875
|
+
var result = MapToSdTableItem({});
|
|
3876
|
+
result.meta.group.items = groupItem[key];
|
|
3877
|
+
result.meta.group.htmlTemplate = htmlTemplate(groupItem[key]);
|
|
3878
|
+
results.push(result);
|
|
3879
|
+
try {
|
|
3880
|
+
for (var _j = (e_4 = void 0, __values(groupItem[key])), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
3881
|
+
var item = _k.value;
|
|
3882
|
+
results.push(item);
|
|
3883
|
+
}
|
|
3884
|
+
}
|
|
3885
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
3886
|
+
finally {
|
|
3887
|
+
try {
|
|
3888
|
+
if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
|
|
3889
|
+
}
|
|
3890
|
+
finally { if (e_4) throw e_4.error; }
|
|
3891
|
+
}
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3895
|
+
finally {
|
|
3896
|
+
try {
|
|
3897
|
+
if (_h && !_h.done && (_e = _g.return)) _e.call(_g);
|
|
3898
|
+
}
|
|
3899
|
+
finally { if (e_3) throw e_3.error; }
|
|
3900
|
+
}
|
|
3901
|
+
return results;
|
|
3902
|
+
};
|
|
3903
|
+
return SdGroupPipe;
|
|
3904
|
+
}());
|
|
3905
|
+
SdGroupPipe.decorators = [
|
|
3906
|
+
{ type: core.Pipe, args: [{
|
|
3907
|
+
name: 'sdGroup',
|
|
3908
|
+
},] }
|
|
3909
|
+
];
|
|
3910
|
+
|
|
3911
|
+
var MatPaginatorIntlCro = /** @class */ (function (_super) {
|
|
3912
|
+
__extends(MatPaginatorIntlCro, _super);
|
|
3913
|
+
function MatPaginatorIntlCro() {
|
|
3914
|
+
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
3915
|
+
_this.firstPageLabel = 'Trang đầu';
|
|
3916
|
+
_this.lastPageLabel = 'Trang cuối';
|
|
3917
|
+
_this.itemsPerPageLabel = 'Kích thước trang';
|
|
3918
|
+
_this.nextPageLabel = 'Trang sau';
|
|
3919
|
+
_this.previousPageLabel = 'Trang trước';
|
|
3920
|
+
_this.getRangeLabel = function (page, pageSize, length) {
|
|
3921
|
+
if (length === 0 || pageSize === 0) {
|
|
3922
|
+
return '';
|
|
3923
|
+
}
|
|
3924
|
+
var from = page * pageSize + 1;
|
|
3925
|
+
var to = from + (length - page * pageSize > pageSize ? pageSize : length - page * pageSize) - 1;
|
|
3926
|
+
return from + "-" + to + " tr\u00EAn " + length;
|
|
3927
|
+
};
|
|
3928
|
+
return _this;
|
|
3929
|
+
}
|
|
3930
|
+
return MatPaginatorIntlCro;
|
|
3931
|
+
}(paginator.MatPaginatorIntl));
|
|
3932
|
+
MatPaginatorIntlCro.decorators = [
|
|
3933
|
+
{ type: core.Injectable }
|
|
3934
|
+
];
|
|
3935
|
+
var SdTableModule = /** @class */ (function () {
|
|
3936
|
+
function SdTableModule() {
|
|
3937
|
+
}
|
|
3938
|
+
return SdTableModule;
|
|
3939
|
+
}());
|
|
3940
|
+
SdTableModule.decorators = [
|
|
3941
|
+
{ type: core.NgModule, args: [{
|
|
3942
|
+
imports: [
|
|
3943
|
+
common$1.CommonModule,
|
|
3944
|
+
forms.FormsModule,
|
|
3945
|
+
forms.ReactiveFormsModule,
|
|
3946
|
+
input.MatInputModule,
|
|
3947
|
+
formField.MatFormFieldModule,
|
|
3948
|
+
sort.MatSortModule,
|
|
3949
|
+
paginator.MatPaginatorModule,
|
|
3950
|
+
table.MatTableModule,
|
|
3951
|
+
menu.MatMenuModule,
|
|
3952
|
+
icon.MatIconModule,
|
|
3953
|
+
button.MatButtonModule,
|
|
3954
|
+
tooltip.MatTooltipModule,
|
|
3955
|
+
progressSpinner.MatProgressSpinnerModule,
|
|
3956
|
+
chips.MatChipsModule,
|
|
3957
|
+
radio.MatRadioModule,
|
|
3958
|
+
slideToggle.MatSlideToggleModule,
|
|
3959
|
+
checkbox.MatCheckboxModule,
|
|
3960
|
+
list.MatListModule,
|
|
3961
|
+
divider.MatDividerModule,
|
|
3962
|
+
table$1.CdkTableModule,
|
|
3963
|
+
dragDrop.DragDropModule,
|
|
3964
|
+
form.SdFormModule,
|
|
3965
|
+
service.SdServiceModule,
|
|
3966
|
+
slider.MatSliderModule,
|
|
3967
|
+
scrolling.ScrollingModule,
|
|
3968
|
+
common.SdCommonModule,
|
|
3969
|
+
group.SdGroupModule,
|
|
3970
|
+
],
|
|
3971
|
+
declarations: [
|
|
3972
|
+
SdGridQuickAction,
|
|
3973
|
+
SdDesktopCell,
|
|
3974
|
+
SdDesktopCellView,
|
|
3975
|
+
SdDesktopCommand,
|
|
3976
|
+
SdColumnInlineFilter,
|
|
3977
|
+
SdTable,
|
|
3978
|
+
SdMaterialFooterDefDirective,
|
|
3979
|
+
SdMaterialCellDefDirective,
|
|
3980
|
+
SdMaterialFilterDefDirective,
|
|
3981
|
+
SdMaterialSubInformationDefDirective,
|
|
3982
|
+
SdMaterialEmptyDataDefDirective,
|
|
3983
|
+
SdPopupGridConfiguration,
|
|
3984
|
+
SdGridFilter,
|
|
3985
|
+
SdPopupFilter,
|
|
3986
|
+
// Pipes
|
|
3987
|
+
SdGridConfigurationResultPipe,
|
|
3988
|
+
SdColumnChildrenFilterPipe,
|
|
3989
|
+
SdCommandFilterPipe,
|
|
3990
|
+
SdCommandDisablePipe,
|
|
3991
|
+
SdCommandIconPipe,
|
|
3992
|
+
SdCommandTitlePipe,
|
|
3993
|
+
SdColumnValuesPipe,
|
|
3994
|
+
SdColumnHtmlTemplatePipe,
|
|
3995
|
+
SdColumnTransformPipe,
|
|
3996
|
+
SdColumnTooltipPipe,
|
|
3997
|
+
SdColumnBadgePipe,
|
|
3998
|
+
SdFilterColumnPipe,
|
|
3999
|
+
SdFilterExternalPipe,
|
|
4000
|
+
SdSelectionActionFilterPipe,
|
|
4001
|
+
SdSelectionVisiblePipe,
|
|
4002
|
+
SdSelectionDisablePipe,
|
|
4003
|
+
SdSelectionVisibleSelectAllPipe,
|
|
4004
|
+
SdCellViewPipe,
|
|
4005
|
+
SdGroupPipe,
|
|
4006
|
+
],
|
|
4007
|
+
exports: [
|
|
4008
|
+
SdTable,
|
|
4009
|
+
SdMaterialFooterDefDirective,
|
|
4010
|
+
SdMaterialCellDefDirective,
|
|
4011
|
+
SdMaterialFilterDefDirective,
|
|
4012
|
+
SdMaterialEmptyDataDefDirective,
|
|
4013
|
+
SdMaterialSubInformationDefDirective,
|
|
4014
|
+
],
|
|
4015
|
+
providers: [
|
|
4016
|
+
common$1.DatePipe,
|
|
4017
|
+
common$1.DecimalPipe,
|
|
4018
|
+
table$1.CdkColumnDef,
|
|
4019
|
+
SdTableFilterService,
|
|
4020
|
+
SdTableConfigurationService,
|
|
4021
|
+
SdColumnValuesPipe,
|
|
4022
|
+
{
|
|
4023
|
+
provide: paginator.MatPaginatorIntl,
|
|
4024
|
+
useClass: MatPaginatorIntlCro,
|
|
4025
|
+
},
|
|
4026
|
+
],
|
|
4027
|
+
},] }
|
|
4028
|
+
];
|
|
4029
|
+
|
|
4030
|
+
/**
|
|
4031
|
+
* Generated bundle index. Do not edit.
|
|
4032
|
+
*/
|
|
4033
|
+
|
|
4034
|
+
exports.MatPaginatorIntlCro = MatPaginatorIntlCro;
|
|
4035
|
+
exports.SdFilterOperators = SdFilterOperators;
|
|
4036
|
+
exports.SdTable = SdTable;
|
|
4037
|
+
exports.SdTableModule = SdTableModule;
|
|
4038
|
+
exports.ɵa = SdGridQuickAction;
|
|
4039
|
+
exports.ɵb = SdDesktopCell;
|
|
4040
|
+
exports.ɵba = SdColumnTooltipPipe;
|
|
4041
|
+
exports.ɵbb = SdColumnBadgePipe;
|
|
4042
|
+
exports.ɵbc = SdFilterColumnPipe;
|
|
4043
|
+
exports.ɵbd = SdFilterExternalPipe;
|
|
4044
|
+
exports.ɵbe = SdSelectionActionFilterPipe;
|
|
4045
|
+
exports.ɵbf = SdSelectionVisiblePipe;
|
|
4046
|
+
exports.ɵbg = SdSelectionDisablePipe;
|
|
4047
|
+
exports.ɵbh = SdSelectionVisibleSelectAllPipe;
|
|
4048
|
+
exports.ɵbi = SdCellViewPipe;
|
|
4049
|
+
exports.ɵbj = SdGroupPipe;
|
|
4050
|
+
exports.ɵc = SdDesktopCellView;
|
|
4051
|
+
exports.ɵd = SdDesktopCommand;
|
|
4052
|
+
exports.ɵe = SdColumnInlineFilter;
|
|
4053
|
+
exports.ɵf = SdGridFilter;
|
|
4054
|
+
exports.ɵg = SdPopupFilter;
|
|
4055
|
+
exports.ɵh = SdMaterialSubInformationDefDirective;
|
|
4056
|
+
exports.ɵi = SdMaterialEmptyDataDefDirective;
|
|
4057
|
+
exports.ɵj = SdMaterialCellDefDirective;
|
|
4058
|
+
exports.ɵk = SdMaterialFooterDefDirective;
|
|
4059
|
+
exports.ɵl = SdMaterialFilterDefDirective;
|
|
4060
|
+
exports.ɵn = TABLE_CONFIG;
|
|
4061
|
+
exports.ɵo = SdTableConfigurationService;
|
|
4062
|
+
exports.ɵp = SdColumnValuesPipe;
|
|
4063
|
+
exports.ɵq = SdTableFilterService;
|
|
4064
|
+
exports.ɵr = SdPopupGridConfiguration;
|
|
4065
|
+
exports.ɵs = SdGridConfigurationResultPipe;
|
|
4066
|
+
exports.ɵt = SdColumnChildrenFilterPipe;
|
|
4067
|
+
exports.ɵu = SdCommandFilterPipe;
|
|
4068
|
+
exports.ɵv = SdCommandDisablePipe;
|
|
4069
|
+
exports.ɵw = SdCommandIconPipe;
|
|
4070
|
+
exports.ɵx = SdCommandTitlePipe;
|
|
4071
|
+
exports.ɵy = SdColumnHtmlTemplatePipe;
|
|
4072
|
+
exports.ɵz = SdColumnTransformPipe;
|
|
4073
|
+
|
|
4074
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4075
|
+
|
|
4076
|
+
})));
|
|
4077
|
+
//# sourceMappingURL=sd-angular-core-table.umd.js.map
|