@sd-angular/core 1.2.76 → 1.2.79
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-api.umd.js +1 -1
- package/bundles/sd-angular-core-api.umd.js.map +1 -1
- package/bundles/sd-angular-core-api.umd.min.js +1 -1
- package/bundles/sd-angular-core-api.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-export.umd.js +34 -13
- package/bundles/sd-angular-core-export.umd.js.map +1 -1
- package/bundles/sd-angular-core-export.umd.min.js +1 -1
- package/bundles/sd-angular-core-export.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.js +326 -292
- package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
- package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
- package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.js +7 -8
- package/bundles/sd-angular-core-upload-excel.umd.js.map +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.min.js +1 -1
- package/bundles/sd-angular-core-upload-excel.umd.min.js.map +1 -1
- package/esm2015/api/src/lib/api.service.js +2 -2
- package/esm2015/export/src/lib/export.model.js +3 -2
- package/esm2015/export/src/lib/export.service.js +17 -7
- package/esm2015/grid-material/src/lib/components/popup-export/popup-export.component.js +44 -24
- package/esm2015/grid-material/src/lib/grid-material.component.js +56 -29
- package/esm2015/upload-excel/src/lib/upload-excel.component.js +7 -8
- package/esm2015/upload-excel/src/lib/upload-excel.model.js +1 -1
- package/export/sd-angular-core-export.metadata.json +1 -1
- package/export/src/lib/export.model.d.ts +3 -0
- package/export/src/lib/export.service.d.ts +2 -5
- package/fesm2015/sd-angular-core-api.js +1 -1
- package/fesm2015/sd-angular-core-api.js.map +1 -1
- package/fesm2015/sd-angular-core-export.js +18 -7
- package/fesm2015/sd-angular-core-export.js.map +1 -1
- package/fesm2015/sd-angular-core-grid-material.js +98 -51
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/fesm2015/sd-angular-core-upload-excel.js +6 -7
- package/fesm2015/sd-angular-core-upload-excel.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/components/popup-export/popup-export.component.d.ts +6 -1
- package/grid-material/src/lib/grid-material.component.d.ts +1 -0
- package/package.json +1 -1
- package/{sd-angular-core-1.2.76.tgz → sd-angular-core-1.2.79.tgz} +0 -0
- package/upload-excel/src/lib/upload-excel.model.d.ts +2 -0
|
@@ -6,28 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
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 uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
|
|
31
9
|
var hash__default = /*#__PURE__*/_interopDefaultLegacy(hash);
|
|
32
10
|
|
|
33
11
|
var SdMaterialCellDefDirective = /** @class */ (function () {
|
|
@@ -847,7 +825,7 @@
|
|
|
847
825
|
filterChange: [{ type: core.Output }]
|
|
848
826
|
};
|
|
849
827
|
|
|
850
|
-
var _getExportableColumns, _getExportableGroups, _initTemplate;
|
|
828
|
+
var _getExportableColumns, _getExportableGroups, _getExportColumns, _initTemplate;
|
|
851
829
|
var SdPopupExport = /** @class */ (function () {
|
|
852
830
|
function SdPopupExport(ref, loadingService, exportService, notifyService, translateService) {
|
|
853
831
|
var _this = this;
|
|
@@ -910,7 +888,7 @@
|
|
|
910
888
|
});
|
|
911
889
|
this.open = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
912
890
|
var _a, _b;
|
|
913
|
-
return __generator(this, function (
|
|
891
|
+
return __generator(this, function (_x) {
|
|
914
892
|
if (!this.key) {
|
|
915
893
|
this.exportDefault();
|
|
916
894
|
return [2 /*return*/];
|
|
@@ -927,29 +905,52 @@
|
|
|
927
905
|
return [2 /*return*/];
|
|
928
906
|
});
|
|
929
907
|
}); };
|
|
930
|
-
this
|
|
931
|
-
if (
|
|
908
|
+
_getExportColumns.set(this, function () {
|
|
909
|
+
if (_this.configuration) {
|
|
910
|
+
var _x = _this.configuration, firstColumns = _x.firstColumns, secondColumns = _x.secondColumns;
|
|
911
|
+
return __spread(firstColumns, secondColumns).map(function (e) { return (Object.assign(Object.assign({}, e), { data: _this.columns.find(function (e1) { return e1.field === e.field; }) })); }).filter(function (e) { return !!e.data; })
|
|
912
|
+
.map(function (e) { return e.data; });
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
return _this.columns;
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
this.exportDefault = function () {
|
|
919
|
+
_this.export.emit({
|
|
920
|
+
file: null,
|
|
921
|
+
columns: __classPrivateFieldGet(_this, _getExportColumns).call(_this),
|
|
922
|
+
isCSV: false
|
|
923
|
+
});
|
|
924
|
+
};
|
|
925
|
+
this.exportCSV = function () {
|
|
926
|
+
_this.export.emit({
|
|
927
|
+
file: null,
|
|
928
|
+
columns: __classPrivateFieldGet(_this, _getExportColumns).call(_this),
|
|
929
|
+
isCSV: true
|
|
930
|
+
});
|
|
931
|
+
};
|
|
932
|
+
this.exportRaw = function () {
|
|
932
933
|
_this.export.emit({
|
|
933
934
|
file: null,
|
|
934
|
-
columns: _this.
|
|
935
|
-
|
|
935
|
+
columns: __classPrivateFieldGet(_this, _getExportColumns).call(_this),
|
|
936
|
+
isRaw: true
|
|
936
937
|
});
|
|
937
938
|
};
|
|
938
939
|
this.loadFiles = function (group) {
|
|
939
940
|
if (group === void 0) { group = null; }
|
|
940
941
|
return __awaiter(_this, void 0, void 0, function () {
|
|
941
|
-
var
|
|
942
|
-
return __generator(this, function (
|
|
943
|
-
switch (
|
|
942
|
+
var _x;
|
|
943
|
+
return __generator(this, function (_y) {
|
|
944
|
+
switch (_y.label) {
|
|
944
945
|
case 0:
|
|
945
946
|
this.selectedGroup = this.groups.find(function (e) { return e.code === group; });
|
|
946
|
-
|
|
947
|
+
_x = this;
|
|
947
948
|
return [4 /*yield*/, this.exportService.filesInFolder({
|
|
948
949
|
key: this.key,
|
|
949
950
|
group: group
|
|
950
951
|
})];
|
|
951
952
|
case 1:
|
|
952
|
-
|
|
953
|
+
_x.files = _y.sent();
|
|
953
954
|
this.ref.markForCheck();
|
|
954
955
|
return [2 /*return*/];
|
|
955
956
|
}
|
|
@@ -957,21 +958,21 @@
|
|
|
957
958
|
});
|
|
958
959
|
};
|
|
959
960
|
_initTemplate.set(this, function (fileName) { return __awaiter(_this, void 0, void 0, function () {
|
|
960
|
-
var _c, _d, _e, _f, sheets,
|
|
961
|
-
var e_1,
|
|
962
|
-
return __generator(this, function (
|
|
963
|
-
switch (
|
|
961
|
+
var _c, _d, _e, _f, sheets, _x, _y, sheet, _z, _0, _1, e_1_1;
|
|
962
|
+
var e_1, _2;
|
|
963
|
+
return __generator(this, function (_3) {
|
|
964
|
+
switch (_3.label) {
|
|
964
965
|
case 0:
|
|
965
966
|
sheets = [];
|
|
966
967
|
if (!Array.isArray((_d = (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.export) === null || _d === void 0 ? void 0 : _d.sheets)) return [3 /*break*/, 9];
|
|
967
|
-
|
|
968
|
+
_3.label = 1;
|
|
968
969
|
case 1:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
970
|
+
_3.trys.push([1, 7, 8, 9]);
|
|
971
|
+
_x = __values(this.gridOption.export.sheets), _y = _x.next();
|
|
972
|
+
_3.label = 2;
|
|
972
973
|
case 2:
|
|
973
|
-
if (!!
|
|
974
|
-
sheet =
|
|
974
|
+
if (!!_y.done) return [3 /*break*/, 6];
|
|
975
|
+
sheet = _y.value;
|
|
975
976
|
if (!(sheet.name && sheet.items && sheet.fields)) return [3 /*break*/, 5];
|
|
976
977
|
if (!Array.isArray(sheet.items)) return [3 /*break*/, 3];
|
|
977
978
|
sheets.push({
|
|
@@ -981,27 +982,27 @@
|
|
|
981
982
|
});
|
|
982
983
|
return [3 /*break*/, 5];
|
|
983
984
|
case 3:
|
|
984
|
-
|
|
985
|
-
|
|
985
|
+
_0 = (_z = sheets).push;
|
|
986
|
+
_1 = {
|
|
986
987
|
name: sheet.name
|
|
987
988
|
};
|
|
988
989
|
return [4 /*yield*/, sheet.items()];
|
|
989
990
|
case 4:
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
991
|
+
_0.apply(_z, [(_1.items = _3.sent(),
|
|
992
|
+
_1.fields = sheet.fields,
|
|
993
|
+
_1)]);
|
|
994
|
+
_3.label = 5;
|
|
994
995
|
case 5:
|
|
995
|
-
|
|
996
|
+
_y = _x.next();
|
|
996
997
|
return [3 /*break*/, 2];
|
|
997
998
|
case 6: return [3 /*break*/, 9];
|
|
998
999
|
case 7:
|
|
999
|
-
e_1_1 =
|
|
1000
|
+
e_1_1 = _3.sent();
|
|
1000
1001
|
e_1 = { error: e_1_1 };
|
|
1001
1002
|
return [3 /*break*/, 9];
|
|
1002
1003
|
case 8:
|
|
1003
1004
|
try {
|
|
1004
|
-
if (
|
|
1005
|
+
if (_y && !_y.done && (_2 = _x.return)) _2.call(_x);
|
|
1005
1006
|
}
|
|
1006
1007
|
finally { if (e_1) throw e_1.error; }
|
|
1007
1008
|
return [7 /*endfinally*/];
|
|
@@ -1010,43 +1011,39 @@
|
|
|
1010
1011
|
columns: this.columns,
|
|
1011
1012
|
sheets: sheets
|
|
1012
1013
|
})];
|
|
1013
|
-
case 10: return [2 /*return*/,
|
|
1014
|
+
case 10: return [2 /*return*/, _3.sent()];
|
|
1014
1015
|
}
|
|
1015
1016
|
});
|
|
1016
1017
|
}); });
|
|
1017
1018
|
this.generateTemplate = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
switch (_z.label) {
|
|
1019
|
+
return __generator(this, function (_x) {
|
|
1020
|
+
switch (_x.label) {
|
|
1021
1021
|
case 0:
|
|
1022
1022
|
this.loadingService.start();
|
|
1023
1023
|
return [4 /*yield*/, __classPrivateFieldGet(this, _initTemplate).call(this).finally(this.loadingService.stop)];
|
|
1024
1024
|
case 1:
|
|
1025
|
-
|
|
1026
|
-
if (result === null || result === void 0 ? void 0 : result.filePath) {
|
|
1027
|
-
this.exportService.download(result.filePath, (((_h = (_g = this.gridOption) === null || _g === void 0 ? void 0 : _g.export) === null || _h === void 0 ? void 0 : _h.fileName) || uuid__namespace) + ".xlsx");
|
|
1028
|
-
}
|
|
1025
|
+
_x.sent();
|
|
1029
1026
|
return [2 /*return*/];
|
|
1030
1027
|
}
|
|
1031
1028
|
});
|
|
1032
1029
|
}); };
|
|
1033
1030
|
this.generateAndUploadTemplate = function (fileName) { return __awaiter(_this, void 0, void 0, function () {
|
|
1034
|
-
var _j, _k, _l, _m, _o,
|
|
1035
|
-
var e_2,
|
|
1031
|
+
var _g, _h, _j, _k, _l, _m, _o, sheets, _x, _y, sheet, _z, _0, _1, e_2_1;
|
|
1032
|
+
var e_2, _2;
|
|
1036
1033
|
var _this = this;
|
|
1037
|
-
return __generator(this, function (
|
|
1038
|
-
switch (
|
|
1034
|
+
return __generator(this, function (_3) {
|
|
1035
|
+
switch (_3.label) {
|
|
1039
1036
|
case 0:
|
|
1040
1037
|
sheets = [];
|
|
1041
|
-
if (!Array.isArray((
|
|
1042
|
-
|
|
1038
|
+
if (!Array.isArray((_h = (_g = this.gridOption) === null || _g === void 0 ? void 0 : _g.export) === null || _h === void 0 ? void 0 : _h.sheets)) return [3 /*break*/, 9];
|
|
1039
|
+
_3.label = 1;
|
|
1043
1040
|
case 1:
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1041
|
+
_3.trys.push([1, 7, 8, 9]);
|
|
1042
|
+
_x = __values((_k = (_j = this.gridOption) === null || _j === void 0 ? void 0 : _j.export) === null || _k === void 0 ? void 0 : _k.sheets), _y = _x.next();
|
|
1043
|
+
_3.label = 2;
|
|
1047
1044
|
case 2:
|
|
1048
|
-
if (!!
|
|
1049
|
-
sheet =
|
|
1045
|
+
if (!!_y.done) return [3 /*break*/, 6];
|
|
1046
|
+
sheet = _y.value;
|
|
1050
1047
|
if (!(sheet.name && sheet.items && sheet.fields)) return [3 /*break*/, 5];
|
|
1051
1048
|
if (!Array.isArray(sheet.items)) return [3 /*break*/, 3];
|
|
1052
1049
|
sheets.push({
|
|
@@ -1056,40 +1053,40 @@
|
|
|
1056
1053
|
});
|
|
1057
1054
|
return [3 /*break*/, 5];
|
|
1058
1055
|
case 3:
|
|
1059
|
-
|
|
1060
|
-
|
|
1056
|
+
_0 = (_z = sheets).push;
|
|
1057
|
+
_1 = {
|
|
1061
1058
|
name: sheet.name
|
|
1062
1059
|
};
|
|
1063
1060
|
return [4 /*yield*/, sheet.items()];
|
|
1064
1061
|
case 4:
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1062
|
+
_0.apply(_z, [(_1.items = _3.sent(),
|
|
1063
|
+
_1.fields = sheet.fields,
|
|
1064
|
+
_1)]);
|
|
1065
|
+
_3.label = 5;
|
|
1069
1066
|
case 5:
|
|
1070
|
-
|
|
1067
|
+
_y = _x.next();
|
|
1071
1068
|
return [3 /*break*/, 2];
|
|
1072
1069
|
case 6: return [3 /*break*/, 9];
|
|
1073
1070
|
case 7:
|
|
1074
|
-
e_2_1 =
|
|
1071
|
+
e_2_1 = _3.sent();
|
|
1075
1072
|
e_2 = { error: e_2_1 };
|
|
1076
1073
|
return [3 /*break*/, 9];
|
|
1077
1074
|
case 8:
|
|
1078
1075
|
try {
|
|
1079
|
-
if (
|
|
1076
|
+
if (_y && !_y.done && (_2 = _x.return)) _2.call(_x);
|
|
1080
1077
|
}
|
|
1081
1078
|
finally { if (e_2) throw e_2.error; }
|
|
1082
1079
|
return [7 /*endfinally*/];
|
|
1083
1080
|
case 9: return [4 /*yield*/, this.exportService.generateUploadTemplate({
|
|
1084
1081
|
key: this.key,
|
|
1085
1082
|
template: {
|
|
1086
|
-
fileName: fileName || ((
|
|
1083
|
+
fileName: fileName || ((_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName),
|
|
1087
1084
|
columns: this.columns.filter(function (e) { return _this.selected[e.field]; }),
|
|
1088
1085
|
sheets: sheets
|
|
1089
1086
|
},
|
|
1090
|
-
group: (
|
|
1087
|
+
group: (_o = this.selectedGroup) === null || _o === void 0 ? void 0 : _o.code
|
|
1091
1088
|
})];
|
|
1092
|
-
case 10: return [2 /*return*/,
|
|
1089
|
+
case 10: return [2 /*return*/, _3.sent()];
|
|
1093
1090
|
}
|
|
1094
1091
|
});
|
|
1095
1092
|
}); };
|
|
@@ -1101,16 +1098,16 @@
|
|
|
1101
1098
|
_this.ref.detectChanges();
|
|
1102
1099
|
};
|
|
1103
1100
|
this.uploadTemplate = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1104
|
-
var
|
|
1105
|
-
return __generator(this, function (
|
|
1106
|
-
switch (
|
|
1101
|
+
var _p, _q, _r, file;
|
|
1102
|
+
return __generator(this, function (_x) {
|
|
1103
|
+
switch (_x.label) {
|
|
1107
1104
|
case 0: return [4 /*yield*/, this.exportService.uploadTemplate({
|
|
1108
1105
|
key: this.key,
|
|
1109
|
-
group: (
|
|
1110
|
-
validator: (
|
|
1106
|
+
group: (_p = this.selectedGroup) === null || _p === void 0 ? void 0 : _p.code,
|
|
1107
|
+
validator: (_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.validators
|
|
1111
1108
|
})];
|
|
1112
1109
|
case 1:
|
|
1113
|
-
file =
|
|
1110
|
+
file = _x.sent();
|
|
1114
1111
|
if (file) {
|
|
1115
1112
|
this.files = __spread(this.files, [file]);
|
|
1116
1113
|
this.ref.detectChanges();
|
|
@@ -1134,10 +1131,10 @@
|
|
|
1134
1131
|
});
|
|
1135
1132
|
};
|
|
1136
1133
|
this.createTemplate = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1137
|
-
var
|
|
1134
|
+
var _s, _t, _u, _v, _w, translate, fileName, result, file;
|
|
1138
1135
|
var _this = this;
|
|
1139
|
-
return __generator(this, function (
|
|
1140
|
-
switch (
|
|
1136
|
+
return __generator(this, function (_x) {
|
|
1137
|
+
switch (_x.label) {
|
|
1141
1138
|
case 0:
|
|
1142
1139
|
translate = this.translateService.translate;
|
|
1143
1140
|
if (this.form.invalid) {
|
|
@@ -1150,16 +1147,16 @@
|
|
|
1150
1147
|
}
|
|
1151
1148
|
this.loadingService.start();
|
|
1152
1149
|
fileName = this.templateName + '.xlsx';
|
|
1153
|
-
|
|
1150
|
+
_x.label = 1;
|
|
1154
1151
|
case 1:
|
|
1155
|
-
|
|
1156
|
-
if ((
|
|
1157
|
-
this.notifyService.notify.warning((
|
|
1152
|
+
_x.trys.push([1, , 3, 4]);
|
|
1153
|
+
if ((_u = (_t = (_s = this.gridOption) === null || _s === void 0 ? void 0 : _s.export) === null || _t === void 0 ? void 0 : _t.validators) === null || _u === void 0 ? void 0 : _u.call(_t, fileName)) {
|
|
1154
|
+
this.notifyService.notify.warning((_w = (_v = this.gridOption) === null || _v === void 0 ? void 0 : _v.export) === null || _w === void 0 ? void 0 : _w.validators(fileName));
|
|
1158
1155
|
return [2 /*return*/];
|
|
1159
1156
|
}
|
|
1160
1157
|
return [4 /*yield*/, this.generateAndUploadTemplate(fileName)];
|
|
1161
1158
|
case 2:
|
|
1162
|
-
result =
|
|
1159
|
+
result = _x.sent();
|
|
1163
1160
|
if (result === null || result === void 0 ? void 0 : result.filePath) {
|
|
1164
1161
|
file = {
|
|
1165
1162
|
filePath: result.filePath,
|
|
@@ -1228,7 +1225,7 @@
|
|
|
1228
1225
|
};
|
|
1229
1226
|
return SdPopupExport;
|
|
1230
1227
|
}());
|
|
1231
|
-
_getExportableColumns = new WeakMap(), _getExportableGroups = new WeakMap(), _initTemplate = new WeakMap();
|
|
1228
|
+
_getExportableColumns = new WeakMap(), _getExportableGroups = new WeakMap(), _getExportColumns = new WeakMap(), _initTemplate = new WeakMap();
|
|
1232
1229
|
SdPopupExport.decorators = [
|
|
1233
1230
|
{ type: core.Component, args: [{
|
|
1234
1231
|
selector: 'sd-popup-export',
|
|
@@ -1248,7 +1245,8 @@
|
|
|
1248
1245
|
modal: [{ type: core.ViewChild, args: ['modal',] }],
|
|
1249
1246
|
listGroups: [{ type: core.ViewChild, args: ['listGroups',] }],
|
|
1250
1247
|
export: [{ type: core.Output }],
|
|
1251
|
-
_gridOption: [{ type: core.Input, args: ['gridOption',] }]
|
|
1248
|
+
_gridOption: [{ type: core.Input, args: ['gridOption',] }],
|
|
1249
|
+
configuration: [{ type: core.Input }]
|
|
1252
1250
|
};
|
|
1253
1251
|
|
|
1254
1252
|
var _COLUMNS, _cache, _getKey, _default, _load, _get, _set, _remove;
|
|
@@ -1849,11 +1847,11 @@
|
|
|
1849
1847
|
this.isSelectAll = false;
|
|
1850
1848
|
this.exportTitle = 'Export';
|
|
1851
1849
|
_initCellDef.set(this, function () {
|
|
1852
|
-
var e_1,
|
|
1850
|
+
var e_1, _2;
|
|
1853
1851
|
_this.cellDef = {};
|
|
1854
1852
|
try {
|
|
1855
|
-
for (var
|
|
1856
|
-
var cellDef =
|
|
1853
|
+
for (var _3 = __values(_this.sdCellDefs), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
1854
|
+
var cellDef = _4.value;
|
|
1857
1855
|
if (cellDef.sdMaterialCellDef) {
|
|
1858
1856
|
_this.cellDef[cellDef.sdMaterialCellDef] = cellDef;
|
|
1859
1857
|
}
|
|
@@ -1862,35 +1860,35 @@
|
|
|
1862
1860
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1863
1861
|
finally {
|
|
1864
1862
|
try {
|
|
1865
|
-
if (
|
|
1863
|
+
if (_4 && !_4.done && (_2 = _3.return)) _2.call(_3);
|
|
1866
1864
|
}
|
|
1867
1865
|
finally { if (e_1) throw e_1.error; }
|
|
1868
1866
|
}
|
|
1869
1867
|
});
|
|
1870
1868
|
_initFilterDef.set(this, function () {
|
|
1871
|
-
var e_2,
|
|
1869
|
+
var e_2, _2;
|
|
1872
1870
|
_this.filterDefs = [];
|
|
1873
1871
|
try {
|
|
1874
|
-
for (var
|
|
1875
|
-
var filterDef =
|
|
1872
|
+
for (var _3 = __values(_this.sdFilterDefs), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
1873
|
+
var filterDef = _4.value;
|
|
1876
1874
|
_this.filterDefs.push(filterDef);
|
|
1877
1875
|
}
|
|
1878
1876
|
}
|
|
1879
1877
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1880
1878
|
finally {
|
|
1881
1879
|
try {
|
|
1882
|
-
if (
|
|
1880
|
+
if (_4 && !_4.done && (_2 = _3.return)) _2.call(_3);
|
|
1883
1881
|
}
|
|
1884
1882
|
finally { if (e_2) throw e_2.error; }
|
|
1885
1883
|
}
|
|
1886
1884
|
});
|
|
1887
1885
|
_initFooterDef.set(this, function () {
|
|
1888
|
-
var e_3,
|
|
1886
|
+
var e_3, _2;
|
|
1889
1887
|
_this.footerDef = {};
|
|
1890
1888
|
_this.hasFooter = false;
|
|
1891
1889
|
try {
|
|
1892
|
-
for (var
|
|
1893
|
-
var footerDef =
|
|
1890
|
+
for (var _3 = __values(_this.sdFooterDefs), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
1891
|
+
var footerDef = _4.value;
|
|
1894
1892
|
if (footerDef.sdMaterialFooterDef) {
|
|
1895
1893
|
_this.hasFooter = true;
|
|
1896
1894
|
_this.footerDef[footerDef.sdMaterialFooterDef] = footerDef;
|
|
@@ -1900,7 +1898,7 @@
|
|
|
1900
1898
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1901
1899
|
finally {
|
|
1902
1900
|
try {
|
|
1903
|
-
if (
|
|
1901
|
+
if (_4 && !_4.done && (_2 = _3.return)) _2.call(_3);
|
|
1904
1902
|
}
|
|
1905
1903
|
finally { if (e_3) throw e_3.error; }
|
|
1906
1904
|
}
|
|
@@ -1932,7 +1930,7 @@
|
|
|
1932
1930
|
var columns = _this.gridOption.columns;
|
|
1933
1931
|
var rawColumnFilter = filterInfo.rawColumnFilter, orderBy = filterInfo.orderBy, orderDirection = filterInfo.orderDirection, pageSize = filterInfo.pageSize, pageNumber = filterInfo.pageNumber;
|
|
1934
1932
|
var items = localItems.filter(function (item) {
|
|
1935
|
-
var e_4,
|
|
1933
|
+
var e_4, _2;
|
|
1936
1934
|
var _a, _b, _c, _d;
|
|
1937
1935
|
try {
|
|
1938
1936
|
for (var columns_1 = __values(columns), columns_1_1 = columns_1.next(); !columns_1_1.done; columns_1_1 = columns_1.next()) {
|
|
@@ -2006,7 +2004,7 @@
|
|
|
2006
2004
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2007
2005
|
finally {
|
|
2008
2006
|
try {
|
|
2009
|
-
if (columns_1_1 && !columns_1_1.done && (
|
|
2007
|
+
if (columns_1_1 && !columns_1_1.done && (_2 = columns_1.return)) _2.call(columns_1);
|
|
2010
2008
|
}
|
|
2011
2009
|
finally { if (e_4) throw e_4.error; }
|
|
2012
2010
|
}
|
|
@@ -2064,37 +2062,37 @@
|
|
|
2064
2062
|
_load$1.set(this, function (filterReq, force) {
|
|
2065
2063
|
if (force === void 0) { force = true; }
|
|
2066
2064
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2067
|
-
var result, results,
|
|
2068
|
-
return __generator(this, function (
|
|
2069
|
-
switch (
|
|
2065
|
+
var result, results, _2, error_1;
|
|
2066
|
+
return __generator(this, function (_3) {
|
|
2067
|
+
switch (_3.label) {
|
|
2070
2068
|
case 0:
|
|
2071
2069
|
this.isLoading = true;
|
|
2072
|
-
|
|
2070
|
+
_3.label = 1;
|
|
2073
2071
|
case 1:
|
|
2074
|
-
|
|
2072
|
+
_3.trys.push([1, 8, 9, 10]);
|
|
2075
2073
|
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 3];
|
|
2076
2074
|
result = this.gridOption.items(filterReq);
|
|
2077
2075
|
if (rxjs.isObservable(result)) {
|
|
2078
2076
|
result = result.toPromise();
|
|
2079
2077
|
}
|
|
2080
2078
|
return [4 /*yield*/, result];
|
|
2081
|
-
case 2: return [2 /*return*/,
|
|
2079
|
+
case 2: return [2 /*return*/, _3.sent()];
|
|
2082
2080
|
case 3:
|
|
2083
2081
|
if (!force) return [3 /*break*/, 6];
|
|
2084
2082
|
results = this.gridOption.items();
|
|
2085
2083
|
if (!(results instanceof Promise)) return [3 /*break*/, 5];
|
|
2086
|
-
|
|
2084
|
+
_2 = this;
|
|
2087
2085
|
return [4 /*yield*/, results];
|
|
2088
2086
|
case 4:
|
|
2089
|
-
|
|
2087
|
+
_2.localItems = _3.sent();
|
|
2090
2088
|
return [3 /*break*/, 6];
|
|
2091
2089
|
case 5:
|
|
2092
2090
|
this.localItems = results;
|
|
2093
|
-
|
|
2091
|
+
_3.label = 6;
|
|
2094
2092
|
case 6: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, this.localItems, filterReq)];
|
|
2095
2093
|
case 7: return [3 /*break*/, 10];
|
|
2096
2094
|
case 8:
|
|
2097
|
-
error_1 =
|
|
2095
|
+
error_1 = _3.sent();
|
|
2098
2096
|
this.notifyService.handle.error(error_1);
|
|
2099
2097
|
return [3 /*break*/, 10];
|
|
2100
2098
|
case 9:
|
|
@@ -2108,8 +2106,8 @@
|
|
|
2108
2106
|
});
|
|
2109
2107
|
_render.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2110
2108
|
var _a, _b, _c;
|
|
2111
|
-
return __generator(this, function (
|
|
2112
|
-
switch (
|
|
2109
|
+
return __generator(this, function (_2) {
|
|
2110
|
+
switch (_2.label) {
|
|
2113
2111
|
case 0:
|
|
2114
2112
|
this.items = (args === null || args === void 0 ? void 0 : args.items) || [];
|
|
2115
2113
|
this.total = (args === null || args === void 0 ? void 0 : args.total) || 0;
|
|
@@ -2119,7 +2117,7 @@
|
|
|
2119
2117
|
});
|
|
2120
2118
|
return [4 /*yield*/, ((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.reload) === null || _b === void 0 ? void 0 : _b.onReload) === null || _c === void 0 ? void 0 : _c.call(_b, this.items))];
|
|
2121
2119
|
case 1:
|
|
2122
|
-
|
|
2120
|
+
_2.sent();
|
|
2123
2121
|
this.isSelectAll = this.items.every(function (e) { return e.isSelected; });
|
|
2124
2122
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
2125
2123
|
return [2 /*return*/];
|
|
@@ -2130,11 +2128,11 @@
|
|
|
2130
2128
|
if (force === void 0) { force = true; }
|
|
2131
2129
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2132
2130
|
var _d, data;
|
|
2133
|
-
return __generator(this, function (
|
|
2134
|
-
switch (
|
|
2131
|
+
return __generator(this, function (_2) {
|
|
2132
|
+
switch (_2.label) {
|
|
2135
2133
|
case 0: return [4 /*yield*/, __classPrivateFieldGet(this, _load$1).call(this, __classPrivateFieldGet(this, _getFilter).call(this), force)];
|
|
2136
2134
|
case 1:
|
|
2137
|
-
data =
|
|
2135
|
+
data = _2.sent();
|
|
2138
2136
|
(_d = this.sdScroll) === null || _d === void 0 ? void 0 : _d.scrollTop();
|
|
2139
2137
|
__classPrivateFieldGet(this, _render).call(this, data);
|
|
2140
2138
|
return [2 /*return*/];
|
|
@@ -2147,8 +2145,8 @@
|
|
|
2147
2145
|
if (pageSize === void 0) { pageSize = 10000; }
|
|
2148
2146
|
return __awaiter(_this, void 0, void 0, function () {
|
|
2149
2147
|
var _e, _f, result, filterInfo, result, exportedItems, results;
|
|
2150
|
-
return __generator(this, function (
|
|
2151
|
-
switch (
|
|
2148
|
+
return __generator(this, function (_2) {
|
|
2149
|
+
switch (_2.label) {
|
|
2152
2150
|
case 0:
|
|
2153
2151
|
if (!((_e = this.gridOption.export) === null || _e === void 0 ? void 0 : _e.items)) return [3 /*break*/, 2];
|
|
2154
2152
|
result = (_f = this.gridOption.export) === null || _f === void 0 ? void 0 : _f.items(__classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize));
|
|
@@ -2162,7 +2160,7 @@
|
|
|
2162
2160
|
result = result.toPromise();
|
|
2163
2161
|
}
|
|
2164
2162
|
return [4 /*yield*/, result];
|
|
2165
|
-
case 1: return [2 /*return*/,
|
|
2163
|
+
case 1: return [2 /*return*/, _2.sent()];
|
|
2166
2164
|
case 2:
|
|
2167
2165
|
filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
2168
2166
|
if (!(this.gridOption.type === 'server')) return [3 /*break*/, 4];
|
|
@@ -2171,7 +2169,7 @@
|
|
|
2171
2169
|
result = result.toPromise();
|
|
2172
2170
|
}
|
|
2173
2171
|
return [4 /*yield*/, result];
|
|
2174
|
-
case 3: return [2 /*return*/,
|
|
2172
|
+
case 3: return [2 /*return*/, _2.sent()];
|
|
2175
2173
|
case 4:
|
|
2176
2174
|
exportedItems = [];
|
|
2177
2175
|
if (!(typeof (this.gridOption.items) === 'function')) return [3 /*break*/, 8];
|
|
@@ -2179,15 +2177,15 @@
|
|
|
2179
2177
|
if (!(results instanceof Promise)) return [3 /*break*/, 6];
|
|
2180
2178
|
return [4 /*yield*/, results];
|
|
2181
2179
|
case 5:
|
|
2182
|
-
exportedItems =
|
|
2180
|
+
exportedItems = _2.sent();
|
|
2183
2181
|
return [3 /*break*/, 7];
|
|
2184
2182
|
case 6:
|
|
2185
2183
|
exportedItems = results;
|
|
2186
|
-
|
|
2184
|
+
_2.label = 7;
|
|
2187
2185
|
case 7: return [3 /*break*/, 9];
|
|
2188
2186
|
case 8:
|
|
2189
2187
|
exportedItems = this.gridOption.items;
|
|
2190
|
-
|
|
2188
|
+
_2.label = 9;
|
|
2191
2189
|
case 9: return [2 /*return*/, __classPrivateFieldGet(this, _filterLocal).call(this, exportedItems, filterInfo)];
|
|
2192
2190
|
}
|
|
2193
2191
|
});
|
|
@@ -2227,63 +2225,80 @@
|
|
|
2227
2225
|
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); })) || [];
|
|
2228
2226
|
});
|
|
2229
2227
|
_onExport.set(this, function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2230
|
-
var _g, _h, _j, _k, _l, _m, _o, _p, _q, file, columns_2,
|
|
2231
|
-
var e_5,
|
|
2228
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, file, isCSV, isRaw, columns_2, pageSize_1, batch, total_1, pageNumber_1, exportItems_1, items_1, promises_1, handleData, sheets, _2, _3, sheet, _4, _5, _6, e_5_1;
|
|
2229
|
+
var e_5, _7;
|
|
2232
2230
|
var _this = this;
|
|
2233
|
-
return __generator(this, function (
|
|
2234
|
-
switch (
|
|
2231
|
+
return __generator(this, function (_8) {
|
|
2232
|
+
switch (_8.label) {
|
|
2235
2233
|
case 0:
|
|
2236
|
-
|
|
2237
|
-
file = args.file,
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2234
|
+
_8.trys.push([0, , 22, 23]);
|
|
2235
|
+
file = args.file, isCSV = args.isCSV, isRaw = args.isRaw;
|
|
2236
|
+
columns_2 = args.columns;
|
|
2237
|
+
pageSize_1 = ((_h = (_g = this.gridOption) === null || _g === void 0 ? void 0 : _g.export) === null || _h === void 0 ? void 0 : _h.maxItemsPerRequest) || 1000;
|
|
2238
|
+
batch = ((_k = (_j = this.gridOption) === null || _j === void 0 ? void 0 : _j.export) === null || _k === void 0 ? void 0 : _k.batch) || 1;
|
|
2239
|
+
total_1 = this.total;
|
|
2240
|
+
pageNumber_1 = 0;
|
|
2241
|
+
exportItems_1 = [];
|
|
2242
2242
|
this.isExporting = true;
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
var
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2243
|
+
items_1 = [];
|
|
2244
|
+
promises_1 = [];
|
|
2245
|
+
handleData = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
2246
|
+
var _u, results, results_1, results_1_1, result, results_2, totalPage, percent, allColumns, allExportedColumns, _loop_1, exportItems_2, exportItems_2_1, item, e_6_1;
|
|
2247
|
+
var e_7, _2, e_6, _3;
|
|
2248
|
+
var _this = this;
|
|
2249
|
+
return __generator(this, function (_4) {
|
|
2250
|
+
switch (_4.label) {
|
|
2251
|
+
case 0: return [4 /*yield*/, Promise.all(promises_1)];
|
|
2250
2252
|
case 1:
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2253
|
+
results = _4.sent();
|
|
2254
|
+
promises_1 = [];
|
|
2255
|
+
exportItems_1 = [];
|
|
2256
|
+
try {
|
|
2257
|
+
for (results_1 = __values(results), results_1_1 = results_1.next(); !results_1_1.done; results_1_1 = results_1.next()) {
|
|
2258
|
+
result = results_1_1.value;
|
|
2259
|
+
if ('items' in result) {
|
|
2260
|
+
exportItems_1 = __spread(exportItems_1, result.items);
|
|
2261
|
+
total_1 = result.total;
|
|
2262
|
+
}
|
|
2263
|
+
else {
|
|
2264
|
+
exportItems_1 = __spread(exportItems_1, result);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2255
2267
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2268
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2269
|
+
finally {
|
|
2270
|
+
try {
|
|
2271
|
+
if (results_1_1 && !results_1_1.done && (_2 = results_1.return)) _2.call(results_1);
|
|
2272
|
+
}
|
|
2273
|
+
finally { if (e_7) throw e_7.error; }
|
|
2259
2274
|
}
|
|
2260
|
-
if (!((
|
|
2261
|
-
|
|
2262
|
-
if (!(
|
|
2263
|
-
return [4 /*yield*/,
|
|
2275
|
+
if (!((_u = this.gridOption.export) === null || _u === void 0 ? void 0 : _u.mapping)) return [3 /*break*/, 4];
|
|
2276
|
+
results_2 = this.gridOption.export.mapping(exportItems_1);
|
|
2277
|
+
if (!(results_2 instanceof Promise)) return [3 /*break*/, 3];
|
|
2278
|
+
return [4 /*yield*/, results_2];
|
|
2264
2279
|
case 2:
|
|
2265
|
-
|
|
2280
|
+
exportItems_1 = _4.sent();
|
|
2266
2281
|
return [3 /*break*/, 4];
|
|
2267
2282
|
case 3:
|
|
2268
|
-
|
|
2269
|
-
|
|
2283
|
+
exportItems_1 = results_2;
|
|
2284
|
+
_4.label = 4;
|
|
2270
2285
|
case 4:
|
|
2271
|
-
totalPage =
|
|
2272
|
-
percent = Math.round(
|
|
2273
|
-
|
|
2274
|
-
allColumns = __classPrivateFieldGet(
|
|
2275
|
-
allExportedColumns = __classPrivateFieldGet(
|
|
2276
|
-
|
|
2277
|
-
var obj, handle, columns_3, columns_3_1, exportColumn,
|
|
2278
|
-
var
|
|
2279
|
-
return __generator(this, function (
|
|
2280
|
-
switch (
|
|
2286
|
+
totalPage = total_1 / pageSize_1;
|
|
2287
|
+
percent = Math.round((pageNumber_1 - 1) * 100.0 / totalPage);
|
|
2288
|
+
this.exportTitle = "Exporting..." + percent + "%";
|
|
2289
|
+
allColumns = __classPrivateFieldGet(this, _allColumns).call(this);
|
|
2290
|
+
allExportedColumns = __classPrivateFieldGet(this, _allExportedColumns).call(this);
|
|
2291
|
+
_loop_1 = function (item) {
|
|
2292
|
+
var obj, handle, columns_3, columns_3_1, exportColumn, e_8_1;
|
|
2293
|
+
var e_8, _2;
|
|
2294
|
+
return __generator(this, function (_3) {
|
|
2295
|
+
switch (_3.label) {
|
|
2281
2296
|
case 0:
|
|
2282
2297
|
obj = {};
|
|
2283
2298
|
handle = function (exportColumn) { return __awaiter(_this, void 0, void 0, function () {
|
|
2284
|
-
var
|
|
2285
|
-
return __generator(this, function (
|
|
2286
|
-
switch (
|
|
2299
|
+
var _v, _w, column, exportedColumn, transform, _2, _3, date, transformDate, date, transformDate, date, transformDate, _4, _5;
|
|
2300
|
+
return __generator(this, function (_6) {
|
|
2301
|
+
switch (_6.label) {
|
|
2287
2302
|
case 0:
|
|
2288
2303
|
obj[exportColumn.field] = item[exportColumn.field];
|
|
2289
2304
|
column = allColumns.find(function (e) { return e.field === exportColumn.field; });
|
|
@@ -2305,15 +2320,15 @@
|
|
|
2305
2320
|
if (!column.transform) return [3 /*break*/, 4];
|
|
2306
2321
|
transform = column.transform(item[column.field], item);
|
|
2307
2322
|
if (!(transform instanceof Promise)) return [3 /*break*/, 2];
|
|
2308
|
-
|
|
2309
|
-
|
|
2323
|
+
_2 = obj;
|
|
2324
|
+
_3 = column.field;
|
|
2310
2325
|
return [4 /*yield*/, transform];
|
|
2311
2326
|
case 1:
|
|
2312
|
-
|
|
2327
|
+
_2[_3] = _6.sent();
|
|
2313
2328
|
return [3 /*break*/, 3];
|
|
2314
2329
|
case 2:
|
|
2315
2330
|
obj[column.field] = transform;
|
|
2316
|
-
|
|
2331
|
+
_6.label = 3;
|
|
2317
2332
|
case 3: return [3 /*break*/, 13];
|
|
2318
2333
|
case 4:
|
|
2319
2334
|
if (!(item[column.field] === undefined || item[column.field] === null || item[column.field] === '')) return [3 /*break*/, 5];
|
|
@@ -2328,10 +2343,10 @@
|
|
|
2328
2343
|
if (!(column.type === 'bool')) return [3 /*break*/, 7];
|
|
2329
2344
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
2330
2345
|
if (item[column.field]) {
|
|
2331
|
-
obj[column.field] = ((
|
|
2346
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnTrue) || 'True';
|
|
2332
2347
|
}
|
|
2333
2348
|
else if (obj[column.field] !== undefined && obj[column.field] !== null) {
|
|
2334
|
-
obj[column.field] = ((
|
|
2349
|
+
obj[column.field] = ((_w = column.option) === null || _w === void 0 ? void 0 : _w.displayOnFalse) || 'False';
|
|
2335
2350
|
}
|
|
2336
2351
|
return [3 /*break*/, 13];
|
|
2337
2352
|
case 7:
|
|
@@ -2367,184 +2382,203 @@
|
|
|
2367
2382
|
case 10:
|
|
2368
2383
|
if (!(column.type === 'values')) return [3 /*break*/, 12];
|
|
2369
2384
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
2370
|
-
|
|
2371
|
-
|
|
2385
|
+
_4 = obj;
|
|
2386
|
+
_5 = column.field;
|
|
2372
2387
|
return [4 /*yield*/, this.columnValuesPipe.transform(item[column.field], column)];
|
|
2373
2388
|
case 11:
|
|
2374
2389
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
2375
|
-
|
|
2390
|
+
_4[_5] = _6.sent();
|
|
2376
2391
|
return [3 /*break*/, 13];
|
|
2377
2392
|
case 12:
|
|
2378
2393
|
obj[column.field] = item[column.field];
|
|
2379
|
-
|
|
2394
|
+
_6.label = 13;
|
|
2380
2395
|
case 13: return [2 /*return*/];
|
|
2381
2396
|
}
|
|
2382
2397
|
});
|
|
2383
2398
|
}); };
|
|
2384
|
-
|
|
2399
|
+
_3.label = 1;
|
|
2385
2400
|
case 1:
|
|
2386
|
-
|
|
2387
|
-
columns_3 = (
|
|
2388
|
-
|
|
2401
|
+
_3.trys.push([1, 6, 7, 8]);
|
|
2402
|
+
columns_3 = (e_8 = void 0, __values(columns_2)), columns_3_1 = columns_3.next();
|
|
2403
|
+
_3.label = 2;
|
|
2389
2404
|
case 2:
|
|
2390
2405
|
if (!!columns_3_1.done) return [3 /*break*/, 5];
|
|
2391
2406
|
exportColumn = columns_3_1.value;
|
|
2392
2407
|
return [4 /*yield*/, handle(exportColumn)];
|
|
2393
2408
|
case 3:
|
|
2394
|
-
|
|
2395
|
-
|
|
2409
|
+
_3.sent();
|
|
2410
|
+
_3.label = 4;
|
|
2396
2411
|
case 4:
|
|
2397
2412
|
columns_3_1 = columns_3.next();
|
|
2398
2413
|
return [3 /*break*/, 2];
|
|
2399
2414
|
case 5: return [3 /*break*/, 8];
|
|
2400
2415
|
case 6:
|
|
2401
|
-
|
|
2402
|
-
|
|
2416
|
+
e_8_1 = _3.sent();
|
|
2417
|
+
e_8 = { error: e_8_1 };
|
|
2403
2418
|
return [3 /*break*/, 8];
|
|
2404
2419
|
case 7:
|
|
2405
2420
|
try {
|
|
2406
|
-
if (columns_3_1 && !columns_3_1.done && (
|
|
2421
|
+
if (columns_3_1 && !columns_3_1.done && (_2 = columns_3.return)) _2.call(columns_3);
|
|
2407
2422
|
}
|
|
2408
|
-
finally { if (
|
|
2423
|
+
finally { if (e_8) throw e_8.error; }
|
|
2409
2424
|
return [7 /*endfinally*/];
|
|
2410
2425
|
case 8:
|
|
2411
|
-
|
|
2426
|
+
items_1.push(obj);
|
|
2412
2427
|
return [2 /*return*/];
|
|
2413
2428
|
}
|
|
2414
2429
|
});
|
|
2415
2430
|
};
|
|
2416
|
-
|
|
2431
|
+
_4.label = 5;
|
|
2417
2432
|
case 5:
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2433
|
+
_4.trys.push([5, 10, 11, 12]);
|
|
2434
|
+
exportItems_2 = __values(exportItems_1), exportItems_2_1 = exportItems_2.next();
|
|
2435
|
+
_4.label = 6;
|
|
2421
2436
|
case 6:
|
|
2422
|
-
if (!!
|
|
2423
|
-
item =
|
|
2424
|
-
return [5 /*yield**/,
|
|
2437
|
+
if (!!exportItems_2_1.done) return [3 /*break*/, 9];
|
|
2438
|
+
item = exportItems_2_1.value;
|
|
2439
|
+
return [5 /*yield**/, _loop_1(item)];
|
|
2425
2440
|
case 7:
|
|
2426
|
-
|
|
2427
|
-
|
|
2441
|
+
_4.sent();
|
|
2442
|
+
_4.label = 8;
|
|
2428
2443
|
case 8:
|
|
2429
|
-
|
|
2444
|
+
exportItems_2_1 = exportItems_2.next();
|
|
2430
2445
|
return [3 /*break*/, 6];
|
|
2431
2446
|
case 9: return [3 /*break*/, 12];
|
|
2432
2447
|
case 10:
|
|
2433
|
-
e_6_1 =
|
|
2448
|
+
e_6_1 = _4.sent();
|
|
2434
2449
|
e_6 = { error: e_6_1 };
|
|
2435
2450
|
return [3 /*break*/, 12];
|
|
2436
2451
|
case 11:
|
|
2437
2452
|
try {
|
|
2438
|
-
if (
|
|
2453
|
+
if (exportItems_2_1 && !exportItems_2_1.done && (_3 = exportItems_2.return)) _3.call(exportItems_2);
|
|
2439
2454
|
}
|
|
2440
2455
|
finally { if (e_6) throw e_6.error; }
|
|
2441
2456
|
return [7 /*endfinally*/];
|
|
2442
|
-
case 12:
|
|
2443
|
-
pageNumber++;
|
|
2444
|
-
return [2 /*return*/];
|
|
2457
|
+
case 12: return [2 /*return*/];
|
|
2445
2458
|
}
|
|
2446
2459
|
});
|
|
2447
|
-
};
|
|
2448
|
-
|
|
2449
|
-
_4.label = 1;
|
|
2460
|
+
}); };
|
|
2461
|
+
_8.label = 1;
|
|
2450
2462
|
case 1:
|
|
2451
|
-
if (!(
|
|
2452
|
-
|
|
2463
|
+
if (!(pageNumber_1 * pageSize_1 < total_1)) return [3 /*break*/, 3];
|
|
2464
|
+
promises_1.push(__classPrivateFieldGet(this, _exportedItems).call(this, pageNumber_1, pageSize_1));
|
|
2465
|
+
pageNumber_1++;
|
|
2466
|
+
if (promises_1.length < batch) {
|
|
2467
|
+
return [3 /*break*/, 1];
|
|
2468
|
+
}
|
|
2469
|
+
return [4 /*yield*/, handleData()];
|
|
2453
2470
|
case 2:
|
|
2454
|
-
|
|
2471
|
+
_8.sent();
|
|
2455
2472
|
return [3 /*break*/, 1];
|
|
2456
2473
|
case 3:
|
|
2457
|
-
if (
|
|
2458
|
-
|
|
2474
|
+
if (!(promises_1.length > 0)) return [3 /*break*/, 5];
|
|
2475
|
+
return [4 /*yield*/, handleData()];
|
|
2476
|
+
case 4:
|
|
2477
|
+
_8.sent();
|
|
2478
|
+
_8.label = 5;
|
|
2479
|
+
case 5:
|
|
2480
|
+
if (!!(file === null || file === void 0 ? void 0 : file.filePath)) return [3 /*break*/, 20];
|
|
2481
|
+
if (!isCSV) return [3 /*break*/, 7];
|
|
2459
2482
|
return [4 /*yield*/, this.exportService.exportCSV({
|
|
2460
2483
|
columns: columns_2,
|
|
2461
|
-
items:
|
|
2462
|
-
fileName: (
|
|
2484
|
+
items: items_1,
|
|
2485
|
+
fileName: (_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName
|
|
2463
2486
|
})];
|
|
2464
|
-
case 4:
|
|
2465
|
-
_4.sent();
|
|
2466
|
-
return [2 /*return*/];
|
|
2467
|
-
case 5:
|
|
2468
|
-
sheets = [];
|
|
2469
|
-
if (!Array.isArray((_o = (_m = this.gridOption) === null || _m === void 0 ? void 0 : _m.export) === null || _o === void 0 ? void 0 : _o.sheets)) return [3 /*break*/, 14];
|
|
2470
|
-
_4.label = 6;
|
|
2471
2487
|
case 6:
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
_4.label = 7;
|
|
2488
|
+
_8.sent();
|
|
2489
|
+
return [2 /*return*/];
|
|
2475
2490
|
case 7:
|
|
2476
|
-
if (
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2491
|
+
if (!isRaw) return [3 /*break*/, 9];
|
|
2492
|
+
return [4 /*yield*/, this.exportService.exportExcelRaw({
|
|
2493
|
+
columns: columns_2,
|
|
2494
|
+
items: items_1,
|
|
2495
|
+
fileName: (_p = (_o = this.gridOption) === null || _o === void 0 ? void 0 : _o.export) === null || _p === void 0 ? void 0 : _p.fileName
|
|
2496
|
+
})];
|
|
2497
|
+
case 8:
|
|
2498
|
+
_8.sent();
|
|
2499
|
+
return [2 /*return*/];
|
|
2500
|
+
case 9:
|
|
2501
|
+
sheets = [];
|
|
2502
|
+
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*/, 18];
|
|
2503
|
+
_8.label = 10;
|
|
2504
|
+
case 10:
|
|
2505
|
+
_8.trys.push([10, 16, 17, 18]);
|
|
2506
|
+
_2 = __values(this.gridOption.export.sheets), _3 = _2.next();
|
|
2507
|
+
_8.label = 11;
|
|
2508
|
+
case 11:
|
|
2509
|
+
if (!!_3.done) return [3 /*break*/, 15];
|
|
2510
|
+
sheet = _3.value;
|
|
2511
|
+
if (!(sheet.name && sheet.items && sheet.fields)) return [3 /*break*/, 14];
|
|
2512
|
+
if (!Array.isArray(sheet.items)) return [3 /*break*/, 12];
|
|
2480
2513
|
sheets.push({
|
|
2481
2514
|
name: sheet.name,
|
|
2482
2515
|
items: sheet.items,
|
|
2483
2516
|
fields: sheet.fields
|
|
2484
2517
|
});
|
|
2485
|
-
return [3 /*break*/,
|
|
2486
|
-
case
|
|
2487
|
-
|
|
2488
|
-
|
|
2518
|
+
return [3 /*break*/, 14];
|
|
2519
|
+
case 12:
|
|
2520
|
+
_5 = (_4 = sheets).push;
|
|
2521
|
+
_6 = {
|
|
2489
2522
|
name: sheet.name
|
|
2490
2523
|
};
|
|
2491
2524
|
return [4 /*yield*/, sheet.items()];
|
|
2492
|
-
case 9:
|
|
2493
|
-
_1.apply(_0, [(_2.items = _4.sent(),
|
|
2494
|
-
_2.fields = sheet.fields,
|
|
2495
|
-
_2)]);
|
|
2496
|
-
_4.label = 10;
|
|
2497
|
-
case 10:
|
|
2498
|
-
_z = _y.next();
|
|
2499
|
-
return [3 /*break*/, 7];
|
|
2500
|
-
case 11: return [3 /*break*/, 14];
|
|
2501
|
-
case 12:
|
|
2502
|
-
e_5_1 = _4.sent();
|
|
2503
|
-
e_5 = { error: e_5_1 };
|
|
2504
|
-
return [3 /*break*/, 14];
|
|
2505
2525
|
case 13:
|
|
2526
|
+
_5.apply(_4, [(_6.items = _8.sent(),
|
|
2527
|
+
_6.fields = sheet.fields,
|
|
2528
|
+
_6)]);
|
|
2529
|
+
_8.label = 14;
|
|
2530
|
+
case 14:
|
|
2531
|
+
_3 = _2.next();
|
|
2532
|
+
return [3 /*break*/, 11];
|
|
2533
|
+
case 15: return [3 /*break*/, 18];
|
|
2534
|
+
case 16:
|
|
2535
|
+
e_5_1 = _8.sent();
|
|
2536
|
+
e_5 = { error: e_5_1 };
|
|
2537
|
+
return [3 /*break*/, 18];
|
|
2538
|
+
case 17:
|
|
2506
2539
|
try {
|
|
2507
|
-
if (
|
|
2540
|
+
if (_3 && !_3.done && (_7 = _2.return)) _7.call(_2);
|
|
2508
2541
|
}
|
|
2509
2542
|
finally { if (e_5) throw e_5.error; }
|
|
2510
2543
|
return [7 /*endfinally*/];
|
|
2511
|
-
case
|
|
2544
|
+
case 18: return [4 /*yield*/, this.exportService.export({
|
|
2512
2545
|
columns: columns_2,
|
|
2513
|
-
items:
|
|
2514
|
-
fileName: (
|
|
2546
|
+
items: items_1,
|
|
2547
|
+
fileName: (_t = (_s = this.gridOption) === null || _s === void 0 ? void 0 : _s.export) === null || _t === void 0 ? void 0 : _t.fileName,
|
|
2515
2548
|
sheets: sheets
|
|
2516
2549
|
})];
|
|
2517
|
-
case
|
|
2518
|
-
|
|
2550
|
+
case 19:
|
|
2551
|
+
_8.sent();
|
|
2519
2552
|
return [2 /*return*/];
|
|
2520
|
-
case
|
|
2553
|
+
case 20: return [4 /*yield*/, this.exportService.exportByTemplate({
|
|
2521
2554
|
filePath: file.filePath,
|
|
2522
2555
|
fileName: file.fileName,
|
|
2523
2556
|
columns: columns_2,
|
|
2524
|
-
items:
|
|
2557
|
+
items: items_1
|
|
2525
2558
|
})];
|
|
2526
|
-
case
|
|
2527
|
-
|
|
2528
|
-
return [3 /*break*/,
|
|
2529
|
-
case
|
|
2559
|
+
case 21:
|
|
2560
|
+
_8.sent();
|
|
2561
|
+
return [3 /*break*/, 23];
|
|
2562
|
+
case 22:
|
|
2530
2563
|
this.isExporting = false;
|
|
2531
2564
|
this.exportTitle = "Export";
|
|
2532
2565
|
this.ref.detectChanges();
|
|
2533
2566
|
return [7 /*endfinally*/];
|
|
2534
|
-
case
|
|
2567
|
+
case 23: return [2 /*return*/];
|
|
2535
2568
|
}
|
|
2536
2569
|
});
|
|
2537
2570
|
}); });
|
|
2538
2571
|
this.onExport = function (args) { return __awaiter(_this, void 0, void 0, function () {
|
|
2539
2572
|
var translate;
|
|
2540
|
-
|
|
2541
|
-
return __generator(this, function (_y) {
|
|
2573
|
+
return __generator(this, function (_2) {
|
|
2542
2574
|
translate = this.translateService.translate;
|
|
2543
2575
|
if (!args.isCSV && this.gridOption.export.max && this.total > this.gridOption.export.max) {
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2576
|
+
args.isRaw = true;
|
|
2577
|
+
__classPrivateFieldGet(this, _onExport).call(this, args);
|
|
2578
|
+
// this.notifyService.confirm(translate(`Total rows reach limit, do you want to export CSV`)).then(() => {
|
|
2579
|
+
// args.isCSV = true;
|
|
2580
|
+
// this.#onExport(args);
|
|
2581
|
+
// });
|
|
2548
2582
|
return [2 /*return*/];
|
|
2549
2583
|
}
|
|
2550
2584
|
__classPrivateFieldGet(this, _onExport).call(this, args);
|
|
@@ -2556,9 +2590,9 @@
|
|
|
2556
2590
|
_this.reload(false);
|
|
2557
2591
|
};
|
|
2558
2592
|
this.onExpand = function (rowData) { return __awaiter(_this, void 0, void 0, function () {
|
|
2559
|
-
var
|
|
2560
|
-
return __generator(this, function (
|
|
2561
|
-
if ((
|
|
2593
|
+
var _x, _y, _z, _0, _1, data;
|
|
2594
|
+
return __generator(this, function (_2) {
|
|
2595
|
+
if ((_x = this.gridOption.subInformation) === null || _x === void 0 ? void 0 : _x.always) {
|
|
2562
2596
|
return [2 /*return*/];
|
|
2563
2597
|
}
|
|
2564
2598
|
if (rowData.isExpanding) {
|
|
@@ -2568,8 +2602,8 @@
|
|
|
2568
2602
|
rowData.isExpanded = false;
|
|
2569
2603
|
return [2 /*return*/];
|
|
2570
2604
|
}
|
|
2571
|
-
data = (
|
|
2572
|
-
if (!((
|
|
2605
|
+
data = (_0 = (_z = (_y = this.gridOption) === null || _y === void 0 ? void 0 : _y.subInformation) === null || _z === void 0 ? void 0 : _z.onExpand) === null || _0 === void 0 ? void 0 : _0.call(_z, rowData);
|
|
2606
|
+
if (!((_1 = this.gridOption.subInformation) === null || _1 === void 0 ? void 0 : _1.multiple)) {
|
|
2573
2607
|
this.items.forEach(function (item) { return item.isExpanding = item.isExpanded = false; });
|
|
2574
2608
|
}
|
|
2575
2609
|
if (data instanceof Promise) {
|
|
@@ -2642,7 +2676,7 @@
|
|
|
2642
2676
|
};
|
|
2643
2677
|
this.onCreate = function () {
|
|
2644
2678
|
var _a, _b;
|
|
2645
|
-
var
|
|
2679
|
+
var _2 = _this.gridOption, type = _2.type, editor = _2.editor, columns = _2.columns;
|
|
2646
2680
|
if (!(editor === null || editor === void 0 ? void 0 : editor.addable)) {
|
|
2647
2681
|
return;
|
|
2648
2682
|
}
|
|
@@ -2698,23 +2732,23 @@
|
|
|
2698
2732
|
};
|
|
2699
2733
|
this.onSave = function (item) { return __awaiter(_this, void 0, void 0, function () {
|
|
2700
2734
|
var editor, result, message, result, err_1;
|
|
2701
|
-
return __generator(this, function (
|
|
2702
|
-
switch (
|
|
2735
|
+
return __generator(this, function (_2) {
|
|
2736
|
+
switch (_2.label) {
|
|
2703
2737
|
case 0:
|
|
2704
2738
|
if (item.editorHandlerRow.saving) {
|
|
2705
2739
|
return [2 /*return*/];
|
|
2706
2740
|
}
|
|
2707
2741
|
editor = this.gridOption.editor;
|
|
2708
|
-
|
|
2742
|
+
_2.label = 1;
|
|
2709
2743
|
case 1:
|
|
2710
|
-
|
|
2744
|
+
_2.trys.push([1, 7, 8, 9]);
|
|
2711
2745
|
item.editorHandlerRow.saving = true;
|
|
2712
2746
|
if (!editor.validate) return [3 /*break*/, 4];
|
|
2713
2747
|
result = editor.validate(item, this.items.indexOf(item));
|
|
2714
2748
|
if (!(result instanceof Promise)) return [3 /*break*/, 3];
|
|
2715
2749
|
return [4 /*yield*/, result];
|
|
2716
2750
|
case 2:
|
|
2717
|
-
message =
|
|
2751
|
+
message = _2.sent();
|
|
2718
2752
|
if (message) {
|
|
2719
2753
|
throw message;
|
|
2720
2754
|
}
|
|
@@ -2723,15 +2757,15 @@
|
|
|
2723
2757
|
if (result) {
|
|
2724
2758
|
throw result;
|
|
2725
2759
|
}
|
|
2726
|
-
|
|
2760
|
+
_2.label = 4;
|
|
2727
2761
|
case 4:
|
|
2728
2762
|
if (!editor.onSave) return [3 /*break*/, 6];
|
|
2729
2763
|
result = editor.onSave(item);
|
|
2730
2764
|
if (!(result instanceof Promise)) return [3 /*break*/, 6];
|
|
2731
2765
|
return [4 /*yield*/, result];
|
|
2732
2766
|
case 5:
|
|
2733
|
-
|
|
2734
|
-
|
|
2767
|
+
_2.sent();
|
|
2768
|
+
_2.label = 6;
|
|
2735
2769
|
case 6:
|
|
2736
2770
|
if (item.editorStatus === 'create' && editor.type === 'popup') {
|
|
2737
2771
|
if (this.gridOption.type === 'local') {
|
|
@@ -2742,7 +2776,7 @@
|
|
|
2742
2776
|
item.editorStatus = undefined;
|
|
2743
2777
|
return [3 /*break*/, 9];
|
|
2744
2778
|
case 7:
|
|
2745
|
-
err_1 =
|
|
2779
|
+
err_1 = _2.sent();
|
|
2746
2780
|
this.notifyService.notify.warning(err_1);
|
|
2747
2781
|
return [3 /*break*/, 9];
|
|
2748
2782
|
case 8:
|
|
@@ -2957,7 +2991,7 @@
|
|
|
2957
2991
|
SdGridMaterial.decorators = [
|
|
2958
2992
|
{ type: core.Component, args: [{
|
|
2959
2993
|
selector: 'sd-grid-material',
|
|
2960
|
-
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <ng-container *ngIf=\"items | sdGroup:gridOption; $implicit as groupedItems\">\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"groupedItems\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n\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?.subInformation?.always;else useExpandCollapse\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #useExpandCollapse>\r\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </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 class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding && !gridOption?.subInformation?.always\" mat-icon-button\r\n aria-label=\"Expand & Collapse\" (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"!item?.sdGroup ? 1 : configuration.displayedColumns.length\">\r\n <div [innerHtml]=\"item?.sdGroup?.htmlTemplate | safeHtml\">\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [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\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\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 class=\"d-block px-8\" *ngIf=\"!item?.sdGroup\" [sdId]=\"item.sdId\" [key]=\"key\"\r\n [value]=\"item[column.field]\" [column]=\"column\" [item]=\"item\" [idx]=\"i\" [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=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\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 class=\"d-block px-8\" [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\"\r\n [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [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\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault(true)\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\"\r\n (clear)=\"onClearSelection(groupedItems)\">\r\n </sd-grid-quick-action>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>",
|
|
2994
|
+
template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <ng-container *ngIf=\"items | sdGroup:gridOption; $implicit as groupedItems\">\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" sdScroll [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"groupedItems\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n\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?.subInformation?.always;else useExpandCollapse\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #useExpandCollapse>\r\n <div [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </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 class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding && !gridOption?.subInformation?.always\" mat-icon-button\r\n aria-label=\"Expand & Collapse\" (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [items]=\"items\"\r\n [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item; index as idx\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"!item?.sdGroup ? 1 : configuration.displayedColumns.length\">\r\n <div [innerHtml]=\"item?.sdGroup?.htmlTemplate | safeHtml\">\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [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\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\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 class=\"d-block px-8\" *ngIf=\"!item?.sdGroup\" [sdId]=\"item.sdId\" [key]=\"key\"\r\n [value]=\"item[column.field]\" [column]=\"column\" [item]=\"item\" [idx]=\"i\" [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=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\">\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 class=\"d-block px-8\" [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\"\r\n [column]=\"column\" [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\"\r\n [class.selected]=\"row.isSelected\" [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button class=\"c-btn-add\"\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon-add\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdGroup\">\r\n <th mat-header-cell *matHeaderCellDef class=\"px-8 py-8\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [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\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [class.text-right]=\"column.align === 'right' || (!column.align && column.type === 'number')\"\r\n [class.text-center]=\"column.align === 'center'\" [innerHTML]=\"column.titleHtml || column.title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleExcelRaw !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportRaw()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel raw\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportCSV()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\"\r\n (clear)=\"onClearSelection(groupedItems)\">\r\n </sd-grid-quick-action>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [configuration]=\"configuration\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>",
|
|
2961
2995
|
animations: [
|
|
2962
2996
|
animations.trigger('detailExpand', [
|
|
2963
2997
|
animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
|