@sd-angular/core 1.3.103 → 1.3.104
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 +400 -198
- 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/esm2015/grid-material/src/lib/grid-material.component.js +217 -170
- package/esm2015/grid-material/src/lib/services/grid-filter/grid-filter.service.js +140 -56
- package/fesm2015/sd-angular-core-grid-material.js +328 -198
- package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
- package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
- package/grid-material/src/lib/grid-material.component.d.ts +25 -25
- package/grid-material/src/lib/services/grid-filter/grid-filter.service.d.ts +4 -4
- package/package.json +1 -1
- package/{sd-angular-core-1.3.103.tgz → sd-angular-core-1.3.104.tgz} +0 -0
|
@@ -8,7 +8,7 @@ import { v4 } from 'uuid';
|
|
|
8
8
|
import { Subscription, BehaviorSubject, Subject, isObservable, combineLatest } from 'rxjs';
|
|
9
9
|
import { SdNotifyService } from '@sd-angular/core/notify';
|
|
10
10
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
11
|
-
import {
|
|
11
|
+
import { map, debounceTime, switchMap, startWith } from 'rxjs/operators';
|
|
12
12
|
import { DeviceDetectorService } from 'ngx-device-detector';
|
|
13
13
|
import { SdLoadingService } from '@sd-angular/core/loading';
|
|
14
14
|
import { SdTranslateService } from '@sd-angular/core/translate';
|
|
@@ -1132,8 +1132,8 @@ var _filterConfiguration, _filterValue, _cache$2, _loadDefaultConfiguration, _lo
|
|
|
1132
1132
|
class SdGridFilterService {
|
|
1133
1133
|
constructor(settingService) {
|
|
1134
1134
|
this.settingService = settingService;
|
|
1135
|
-
_filterConfiguration.set(this,
|
|
1136
|
-
_filterValue.set(this,
|
|
1135
|
+
_filterConfiguration.set(this, "GRID-FILTER-CONFIGURATION");
|
|
1136
|
+
_filterValue.set(this, "GRID-FILTER-VALUE");
|
|
1137
1137
|
_cache$2.set(this, {});
|
|
1138
1138
|
this.register = (key, args) => {
|
|
1139
1139
|
let cacheSession = false;
|
|
@@ -1141,37 +1141,106 @@ class SdGridFilterService {
|
|
|
1141
1141
|
const { columns, externalFilters } = args;
|
|
1142
1142
|
key = hash({
|
|
1143
1143
|
columns,
|
|
1144
|
-
externalFilters
|
|
1144
|
+
externalFilters,
|
|
1145
1145
|
});
|
|
1146
1146
|
cacheSession = true; // Nếu không có key thì chỉ lưu theo session
|
|
1147
1147
|
}
|
|
1148
1148
|
if (!__classPrivateFieldGet(this, _cache$2)[key]) {
|
|
1149
|
+
const t1 = this.settingService.create({
|
|
1150
|
+
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1151
|
+
key,
|
|
1152
|
+
}, {
|
|
1153
|
+
type: cacheSession ? "session" : undefined,
|
|
1154
|
+
});
|
|
1155
|
+
const defaultConfiguration = __classPrivateFieldGet(this, _loadDefaultConfiguration).call(this, args, t1.get());
|
|
1156
|
+
const t2 = this.settingService.create({
|
|
1157
|
+
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1158
|
+
key,
|
|
1159
|
+
}, {
|
|
1160
|
+
type: cacheSession ? "session" : undefined,
|
|
1161
|
+
});
|
|
1162
|
+
const defaultValue = __classPrivateFieldGet(this, _loadDefaultValue).call(this, args, t2.get());
|
|
1149
1163
|
const filterConfiguration = this.settingService.create({
|
|
1150
1164
|
prefix: __classPrivateFieldGet(this, _filterConfiguration),
|
|
1151
|
-
key
|
|
1165
|
+
key,
|
|
1152
1166
|
}, {
|
|
1153
|
-
default:
|
|
1154
|
-
type: cacheSession ?
|
|
1167
|
+
default: defaultConfiguration,
|
|
1168
|
+
type: cacheSession ? "session" : undefined,
|
|
1155
1169
|
});
|
|
1156
1170
|
const filterValue = this.settingService.create({
|
|
1157
1171
|
prefix: __classPrivateFieldGet(this, _filterValue),
|
|
1158
|
-
key
|
|
1172
|
+
key,
|
|
1159
1173
|
}, {
|
|
1160
|
-
default:
|
|
1161
|
-
type: cacheSession ?
|
|
1174
|
+
default: defaultValue,
|
|
1175
|
+
type: cacheSession ? "session" : undefined,
|
|
1162
1176
|
});
|
|
1177
|
+
const configurationGet = (configuration) => {
|
|
1178
|
+
var _a, _b, _c;
|
|
1179
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1180
|
+
const inlineColumn = {};
|
|
1181
|
+
const inlineExternal = {};
|
|
1182
|
+
const inlineFilterDef = {};
|
|
1183
|
+
// Filter column
|
|
1184
|
+
for (const item of columns || []) {
|
|
1185
|
+
inlineColumn[item.field] = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1186
|
+
}
|
|
1187
|
+
// Filter external
|
|
1188
|
+
for (const item of externalFilters || []) {
|
|
1189
|
+
inlineExternal[item.field] = (_b = configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) === null || _b === void 0 ? void 0 : _b[item.field];
|
|
1190
|
+
}
|
|
1191
|
+
// Filter def
|
|
1192
|
+
for (const item of filterDefs || []) {
|
|
1193
|
+
inlineFilterDef[item.sdMaterialFilterDef] = (_c = configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) === null || _c === void 0 ? void 0 : _c[item.sdMaterialFilterDef];
|
|
1194
|
+
}
|
|
1195
|
+
return {
|
|
1196
|
+
// Filter column
|
|
1197
|
+
inlineColumn,
|
|
1198
|
+
// Filter external
|
|
1199
|
+
inlineExternal,
|
|
1200
|
+
// Filter def
|
|
1201
|
+
inlineFilterDef,
|
|
1202
|
+
};
|
|
1203
|
+
};
|
|
1204
|
+
const valueGet = (value) => {
|
|
1205
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1206
|
+
const columnFilter = {};
|
|
1207
|
+
const externalFilter = {};
|
|
1208
|
+
const filterDef = {};
|
|
1209
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1210
|
+
// Filter column
|
|
1211
|
+
for (const item of columns || []) {
|
|
1212
|
+
columnFilter[item.field] = (_a = value === null || value === void 0 ? void 0 : value.columnFilter) === null || _a === void 0 ? void 0 : _a[item.field];
|
|
1213
|
+
}
|
|
1214
|
+
// Filter external
|
|
1215
|
+
for (const item of externalFilters || []) {
|
|
1216
|
+
if (item.type === "daterange") {
|
|
1217
|
+
externalFilter[item.field] = {
|
|
1218
|
+
from: (_c = (_b = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _b === void 0 ? void 0 : _b[item.field]) === null || _c === void 0 ? void 0 : _c.from,
|
|
1219
|
+
to: (_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.to,
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
externalFilter[item.field] = (_f = value === null || value === void 0 ? void 0 : value.externalFilter) === null || _f === void 0 ? void 0 : _f[item.field];
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
// Filter def
|
|
1227
|
+
for (const item of filterDefs || []) {
|
|
1228
|
+
filterDef[item.sdMaterialFilterDef] = (_g = value === null || value === void 0 ? void 0 : value.filterDef) === null || _g === void 0 ? void 0 : _g[item.sdMaterialFilterDef];
|
|
1229
|
+
}
|
|
1230
|
+
return {
|
|
1231
|
+
// Filter column
|
|
1232
|
+
columnFilter,
|
|
1233
|
+
// Filter external
|
|
1234
|
+
externalFilter,
|
|
1235
|
+
// Filter def
|
|
1236
|
+
filterDef,
|
|
1237
|
+
};
|
|
1238
|
+
};
|
|
1163
1239
|
__classPrivateFieldGet(this, _cache$2)[key] = {
|
|
1164
1240
|
configuration: {
|
|
1165
1241
|
get: () => {
|
|
1166
1242
|
const configuration = filterConfiguration.get();
|
|
1167
|
-
return
|
|
1168
|
-
// Filter column
|
|
1169
|
-
inlineColumn: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {},
|
|
1170
|
-
// Filter external
|
|
1171
|
-
inlineExternal: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {},
|
|
1172
|
-
// Filter def
|
|
1173
|
-
inlineFilterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {},
|
|
1174
|
-
};
|
|
1243
|
+
return configurationGet(configuration);
|
|
1175
1244
|
},
|
|
1176
1245
|
set: (configuration) => {
|
|
1177
1246
|
const keys = Object.keys(configuration || {});
|
|
@@ -1179,11 +1248,17 @@ class SdGridFilterService {
|
|
|
1179
1248
|
const { inlineColumn, inlineExternal, inlineFilterDef } = current;
|
|
1180
1249
|
const updatedConfiguration = {
|
|
1181
1250
|
// Filter column
|
|
1182
|
-
inlineColumn: keys.includes(
|
|
1251
|
+
inlineColumn: keys.includes("inlineColumn")
|
|
1252
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineColumn) || {}
|
|
1253
|
+
: inlineColumn,
|
|
1183
1254
|
// Filter external
|
|
1184
|
-
inlineExternal: keys.includes(
|
|
1255
|
+
inlineExternal: keys.includes("inlineExternal")
|
|
1256
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineExternal) || {}
|
|
1257
|
+
: inlineExternal,
|
|
1185
1258
|
// Filter def
|
|
1186
|
-
inlineFilterDef: keys.includes(
|
|
1259
|
+
inlineFilterDef: keys.includes("inlineFilterDef")
|
|
1260
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.inlineFilterDef) || {}
|
|
1261
|
+
: inlineFilterDef,
|
|
1187
1262
|
};
|
|
1188
1263
|
filterConfiguration.set(updatedConfiguration);
|
|
1189
1264
|
return updatedConfiguration;
|
|
@@ -1191,19 +1266,12 @@ class SdGridFilterService {
|
|
|
1191
1266
|
remove: () => {
|
|
1192
1267
|
filterConfiguration.remove();
|
|
1193
1268
|
},
|
|
1194
|
-
observer: filterConfiguration.observer
|
|
1269
|
+
observer: filterConfiguration.observer.pipe(map(configurationGet)),
|
|
1195
1270
|
},
|
|
1196
1271
|
value: {
|
|
1197
1272
|
get: () => {
|
|
1198
1273
|
const configuration = filterValue.get();
|
|
1199
|
-
return
|
|
1200
|
-
// Filter column
|
|
1201
|
-
columnFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {},
|
|
1202
|
-
// Filter external
|
|
1203
|
-
externalFilter: (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {},
|
|
1204
|
-
// Filter def
|
|
1205
|
-
filterDef: (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1206
|
-
};
|
|
1274
|
+
return valueGet(configuration);
|
|
1207
1275
|
},
|
|
1208
1276
|
set: (configuration) => {
|
|
1209
1277
|
const keys = Object.keys(configuration || {});
|
|
@@ -1211,11 +1279,17 @@ class SdGridFilterService {
|
|
|
1211
1279
|
const { columnFilter, externalFilter, filterDef } = current;
|
|
1212
1280
|
const updatedConfiguration = {
|
|
1213
1281
|
// Filter column
|
|
1214
|
-
columnFilter: keys.includes(
|
|
1282
|
+
columnFilter: keys.includes("columnFilter")
|
|
1283
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.columnFilter) || {}
|
|
1284
|
+
: columnFilter,
|
|
1215
1285
|
// Filter external
|
|
1216
|
-
externalFilter: keys.includes(
|
|
1286
|
+
externalFilter: keys.includes("externalFilter")
|
|
1287
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.externalFilter) || {}
|
|
1288
|
+
: externalFilter,
|
|
1217
1289
|
// Filter def
|
|
1218
|
-
filterDef: keys.includes(
|
|
1290
|
+
filterDef: keys.includes("filterDef")
|
|
1291
|
+
? (configuration === null || configuration === void 0 ? void 0 : configuration.filterDef) || {}
|
|
1292
|
+
: filterDef,
|
|
1219
1293
|
};
|
|
1220
1294
|
filterValue.set(updatedConfiguration);
|
|
1221
1295
|
return updatedConfiguration;
|
|
@@ -1223,62 +1297,71 @@ class SdGridFilterService {
|
|
|
1223
1297
|
remove: () => {
|
|
1224
1298
|
filterValue.remove();
|
|
1225
1299
|
},
|
|
1226
|
-
observer: filterValue.observer
|
|
1227
|
-
}
|
|
1300
|
+
observer: filterValue.observer.pipe(map(valueGet)),
|
|
1301
|
+
},
|
|
1228
1302
|
};
|
|
1229
1303
|
}
|
|
1230
1304
|
return __classPrivateFieldGet(this, _cache$2)[key];
|
|
1231
1305
|
};
|
|
1232
|
-
_loadDefaultConfiguration.set(this, (args) => {
|
|
1233
|
-
var _a, _b, _c, _d;
|
|
1306
|
+
_loadDefaultConfiguration.set(this, (args, configuration) => {
|
|
1307
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1234
1308
|
const { columns, externalFilters, filterDefs } = args;
|
|
1235
1309
|
const inlineColumn = {};
|
|
1236
1310
|
const inlineExternal = {};
|
|
1237
1311
|
const inlineFilterDef = {};
|
|
1238
1312
|
// Filter column
|
|
1239
|
-
for (const item of
|
|
1240
|
-
inlineColumn[item.field] = (_a = inlineColumn[item.field]) !== null &&
|
|
1313
|
+
for (const item of columns || []) {
|
|
1314
|
+
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;
|
|
1241
1315
|
}
|
|
1242
1316
|
// Filter external
|
|
1243
|
-
for (const item of
|
|
1244
|
-
inlineExternal[item.field] = (
|
|
1317
|
+
for (const item of externalFilters || []) {
|
|
1318
|
+
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;
|
|
1245
1319
|
}
|
|
1246
1320
|
// Filter def
|
|
1247
|
-
for (const item of
|
|
1248
|
-
inlineFilterDef[item.sdMaterialFilterDef] = (
|
|
1321
|
+
for (const item of filterDefs || []) {
|
|
1322
|
+
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;
|
|
1249
1323
|
}
|
|
1250
1324
|
return {
|
|
1325
|
+
// Filter column
|
|
1251
1326
|
inlineColumn,
|
|
1327
|
+
// Filter external
|
|
1252
1328
|
inlineExternal,
|
|
1329
|
+
// Filter def
|
|
1253
1330
|
inlineFilterDef,
|
|
1254
1331
|
};
|
|
1255
1332
|
});
|
|
1256
|
-
_loadDefaultValue.set(this, (args) => {
|
|
1257
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1258
|
-
const { columns, externalFilters, filterDefs } = args;
|
|
1333
|
+
_loadDefaultValue.set(this, (args, value) => {
|
|
1334
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
1259
1335
|
const columnFilter = {};
|
|
1260
1336
|
const externalFilter = {};
|
|
1261
1337
|
const filterDef = {};
|
|
1338
|
+
const { columns, externalFilters, filterDefs } = args;
|
|
1262
1339
|
// Filter column
|
|
1263
|
-
for (const item of
|
|
1264
|
-
columnFilter[item.field] = (_a = columnFilter[item.field]) !== null &&
|
|
1340
|
+
for (const item of columns || []) {
|
|
1341
|
+
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;
|
|
1265
1342
|
}
|
|
1266
1343
|
// Filter external
|
|
1267
|
-
for (const item of
|
|
1268
|
-
if (item.type ===
|
|
1344
|
+
for (const item of externalFilters || []) {
|
|
1345
|
+
if (item.type === "daterange") {
|
|
1269
1346
|
externalFilter[item.field] = {
|
|
1270
|
-
from: (_f = (
|
|
1271
|
-
to: (_k = (
|
|
1347
|
+
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,
|
|
1348
|
+
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,
|
|
1272
1349
|
};
|
|
1273
1350
|
}
|
|
1274
1351
|
else {
|
|
1275
|
-
externalFilter[item.field] = (
|
|
1352
|
+
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;
|
|
1276
1353
|
}
|
|
1277
1354
|
}
|
|
1278
1355
|
// Filter def
|
|
1356
|
+
for (const item of filterDefs || []) {
|
|
1357
|
+
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;
|
|
1358
|
+
}
|
|
1279
1359
|
return {
|
|
1360
|
+
// Filter column
|
|
1280
1361
|
columnFilter,
|
|
1362
|
+
// Filter external
|
|
1281
1363
|
externalFilter,
|
|
1364
|
+
// Filter def
|
|
1282
1365
|
filterDef,
|
|
1283
1366
|
};
|
|
1284
1367
|
});
|
|
@@ -1332,7 +1415,7 @@ class SdGridMaterial {
|
|
|
1332
1415
|
_reload.set(this, new Subject());
|
|
1333
1416
|
this.isExporting = false;
|
|
1334
1417
|
this.isSelectAll = false;
|
|
1335
|
-
this.exportTitle =
|
|
1418
|
+
this.exportTitle = "Export";
|
|
1336
1419
|
_loadCompleted.set(this, false);
|
|
1337
1420
|
_initCellDef.set(this, () => {
|
|
1338
1421
|
this.cellDef = {};
|
|
@@ -1368,11 +1451,11 @@ class SdGridMaterial {
|
|
|
1368
1451
|
rawColumnFilter: columnFilter || {},
|
|
1369
1452
|
rawExternalFilter: externalFilter || {},
|
|
1370
1453
|
rawFilterDef: filterDef || {},
|
|
1371
|
-
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
1372
|
-
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
1454
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || "",
|
|
1455
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || "",
|
|
1373
1456
|
pageNumber,
|
|
1374
1457
|
pageSize,
|
|
1375
|
-
isExported: true
|
|
1458
|
+
isExported: true,
|
|
1376
1459
|
};
|
|
1377
1460
|
});
|
|
1378
1461
|
_initConfiguration.set(this, (option) => {
|
|
@@ -1382,7 +1465,7 @@ class SdGridMaterial {
|
|
|
1382
1465
|
hidden: (_a = option === null || option === void 0 ? void 0 : option.paginate) === null || _a === void 0 ? void 0 : _a.hidden,
|
|
1383
1466
|
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_GRID_MATERIAL_CONFIG.paginate) === null || _g === void 0 ? void 0 : _g.pageSize,
|
|
1384
1467
|
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_GRID_MATERIAL_CONFIG.paginate) === null || _o === void 0 ? void 0 : _o.pages,
|
|
1385
|
-
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
|
|
1468
|
+
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,
|
|
1386
1469
|
};
|
|
1387
1470
|
return option;
|
|
1388
1471
|
});
|
|
@@ -1394,59 +1477,79 @@ class SdGridMaterial {
|
|
|
1394
1477
|
this.filterRegister = this.gridFilterService.register((_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.filter) === null || _b === void 0 ? void 0 : _b.key, {
|
|
1395
1478
|
columns: (_c = this.gridOption) === null || _c === void 0 ? void 0 : _c.columns,
|
|
1396
1479
|
externalFilters: (_e = (_d = this.gridOption) === null || _d === void 0 ? void 0 : _d.filter) === null || _e === void 0 ? void 0 : _e.externalFilters,
|
|
1397
|
-
filterDefs: this.filterDefs
|
|
1480
|
+
filterDefs: this.filterDefs,
|
|
1398
1481
|
});
|
|
1399
1482
|
if (!hasRegister) {
|
|
1400
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer
|
|
1483
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.filterRegister.value.observer
|
|
1484
|
+
.pipe(debounceTime(500), map((filterValue) => {
|
|
1401
1485
|
this.columnFilter = filterValue.columnFilter;
|
|
1402
1486
|
__classPrivateFieldGet(this, _paginator).pageIndex = 0;
|
|
1403
1487
|
__classPrivateFieldGet(this, _reload).next({
|
|
1404
1488
|
force: false,
|
|
1405
1489
|
});
|
|
1406
|
-
}))
|
|
1490
|
+
}))
|
|
1491
|
+
.subscribe());
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
__classPrivateFieldGet(this, _reload).next({
|
|
1495
|
+
force: true,
|
|
1496
|
+
});
|
|
1407
1497
|
}
|
|
1408
1498
|
}
|
|
1409
1499
|
});
|
|
1410
1500
|
_filterLocal.set(this, (localItems, filterInfo) => {
|
|
1411
1501
|
const { columns } = this.gridOption;
|
|
1412
1502
|
const { rawColumnFilter, orderBy, orderDirection, pageSize, pageNumber } = filterInfo;
|
|
1413
|
-
const items = localItems.filter(item => {
|
|
1503
|
+
const items = localItems.filter((item) => {
|
|
1414
1504
|
var _a, _b, _c, _d;
|
|
1415
1505
|
for (const column of columns) {
|
|
1416
1506
|
const { field, type } = column;
|
|
1417
|
-
const filterValue = (rawColumnFilter[field] ||
|
|
1418
|
-
|
|
1507
|
+
const filterValue = (rawColumnFilter[field] || "")
|
|
1508
|
+
.toString()
|
|
1509
|
+
.trim()
|
|
1510
|
+
.toLowerCase();
|
|
1511
|
+
const columnValue = (item[field] || "")
|
|
1512
|
+
.toString()
|
|
1513
|
+
.trim()
|
|
1514
|
+
.toLowerCase();
|
|
1419
1515
|
if (filterValue) {
|
|
1420
|
-
if (!columnValue &&
|
|
1516
|
+
if (!columnValue &&
|
|
1517
|
+
type !== "datetime" &&
|
|
1518
|
+
type !== "date" &&
|
|
1519
|
+
type !== "time") {
|
|
1421
1520
|
return false;
|
|
1422
1521
|
}
|
|
1423
|
-
if (type ===
|
|
1522
|
+
if (type === "string") {
|
|
1424
1523
|
if (columnValue.indexOf(filterValue) === -1) {
|
|
1425
1524
|
return false;
|
|
1426
1525
|
}
|
|
1427
1526
|
}
|
|
1428
|
-
else if (type ===
|
|
1527
|
+
else if (type === "values") {
|
|
1429
1528
|
if (columnValue !== filterValue) {
|
|
1430
1529
|
return false;
|
|
1431
1530
|
}
|
|
1432
1531
|
}
|
|
1433
|
-
else if (type ===
|
|
1434
|
-
const fValue = +filterValue
|
|
1532
|
+
else if (type === "number") {
|
|
1533
|
+
const fValue = +filterValue
|
|
1534
|
+
.replace(">=", "")
|
|
1535
|
+
.replace("<=", "")
|
|
1536
|
+
.replace(">", "")
|
|
1537
|
+
.replace("<", "");
|
|
1435
1538
|
const cValue = +columnValue;
|
|
1436
1539
|
if (fValue || fValue === 0) {
|
|
1437
1540
|
if (!cValue && cValue !== 0) {
|
|
1438
1541
|
return false;
|
|
1439
1542
|
}
|
|
1440
|
-
if (filterValue.indexOf(
|
|
1543
|
+
if (filterValue.indexOf(">=") > -1 && cValue < fValue) {
|
|
1441
1544
|
return false;
|
|
1442
1545
|
}
|
|
1443
|
-
else if (filterValue.indexOf(
|
|
1546
|
+
else if (filterValue.indexOf("<=") > -1 && cValue > fValue) {
|
|
1444
1547
|
return false;
|
|
1445
1548
|
}
|
|
1446
|
-
else if (filterValue.indexOf(
|
|
1549
|
+
else if (filterValue.indexOf("<") > -1 && cValue >= fValue) {
|
|
1447
1550
|
return false;
|
|
1448
1551
|
}
|
|
1449
|
-
else if (filterValue.indexOf(
|
|
1552
|
+
else if (filterValue.indexOf(">") > -1 && cValue <= fValue) {
|
|
1450
1553
|
return false;
|
|
1451
1554
|
}
|
|
1452
1555
|
else if (cValue !== fValue) {
|
|
@@ -1454,15 +1557,21 @@ class SdGridMaterial {
|
|
|
1454
1557
|
}
|
|
1455
1558
|
}
|
|
1456
1559
|
}
|
|
1457
|
-
else if (type ===
|
|
1458
|
-
if (filterValue ===
|
|
1560
|
+
else if (type === "bool") {
|
|
1561
|
+
if (filterValue === "1" &&
|
|
1562
|
+
columnValue !== "1" &&
|
|
1563
|
+
columnValue !== "true") {
|
|
1459
1564
|
return false;
|
|
1460
1565
|
}
|
|
1461
|
-
else if (filterValue ===
|
|
1566
|
+
else if (filterValue === "0" &&
|
|
1567
|
+
columnValue !== "0" &&
|
|
1568
|
+
columnValue !== "false") {
|
|
1462
1569
|
return false;
|
|
1463
1570
|
}
|
|
1464
1571
|
}
|
|
1465
|
-
else if (type ===
|
|
1572
|
+
else if (type === "datetime" ||
|
|
1573
|
+
type === "date" ||
|
|
1574
|
+
type === "time") {
|
|
1466
1575
|
const from = (_b = (_a = rawColumnFilter[field]) === null || _a === void 0 ? void 0 : _a.from) !== null && _b !== void 0 ? _b : rawColumnFilter[field];
|
|
1467
1576
|
const to = (_d = (_c = rawColumnFilter[field]) === null || _c === void 0 ? void 0 : _c.to) !== null && _d !== void 0 ? _d : rawColumnFilter[field];
|
|
1468
1577
|
const fromDate = Date.begin(from);
|
|
@@ -1488,20 +1597,20 @@ class SdGridMaterial {
|
|
|
1488
1597
|
});
|
|
1489
1598
|
// Sort
|
|
1490
1599
|
if (orderBy && orderDirection) {
|
|
1491
|
-
const column = columns.find(e => e.field === orderBy);
|
|
1600
|
+
const column = columns.find((e) => e.field === orderBy);
|
|
1492
1601
|
if (column) {
|
|
1493
1602
|
const { type, field } = column;
|
|
1494
1603
|
items.sort((current, next) => {
|
|
1495
|
-
if (type ===
|
|
1604
|
+
if (type === "number") {
|
|
1496
1605
|
return (current[field] || 0) - (next[field] || 0);
|
|
1497
1606
|
}
|
|
1498
|
-
if (type ===
|
|
1499
|
-
const d1 = new Date(current[field] ||
|
|
1500
|
-
const d2 = new Date(current[field] ||
|
|
1607
|
+
if (type === "date" || type === "datetime" || type === "time") {
|
|
1608
|
+
const d1 = new Date(current[field] || "").getTime();
|
|
1609
|
+
const d2 = new Date(current[field] || "").getTime();
|
|
1501
1610
|
return d1 - d2;
|
|
1502
1611
|
}
|
|
1503
|
-
const s1 = (current[field] ||
|
|
1504
|
-
const s2 = (next[field] ||
|
|
1612
|
+
const s1 = (current[field] || "").toString();
|
|
1613
|
+
const s2 = (next[field] || "").toString();
|
|
1505
1614
|
if (s1 > s2) {
|
|
1506
1615
|
return 1;
|
|
1507
1616
|
}
|
|
@@ -1510,17 +1619,16 @@ class SdGridMaterial {
|
|
|
1510
1619
|
}
|
|
1511
1620
|
return 0;
|
|
1512
1621
|
});
|
|
1513
|
-
if (orderDirection ===
|
|
1622
|
+
if (orderDirection === "desc") {
|
|
1514
1623
|
items.reverse();
|
|
1515
1624
|
}
|
|
1516
1625
|
}
|
|
1517
1626
|
}
|
|
1518
1627
|
return {
|
|
1519
1628
|
items: items.filter((item, index) => {
|
|
1520
|
-
return index >= pageNumber * pageSize
|
|
1521
|
-
&& index < (pageNumber + 1) * pageSize;
|
|
1629
|
+
return (index >= pageNumber * pageSize && index < (pageNumber + 1) * pageSize);
|
|
1522
1630
|
}),
|
|
1523
|
-
total: items.length
|
|
1631
|
+
total: items.length,
|
|
1524
1632
|
};
|
|
1525
1633
|
});
|
|
1526
1634
|
_getFilter.set(this, () => {
|
|
@@ -1530,15 +1638,15 @@ class SdGridMaterial {
|
|
|
1530
1638
|
rawColumnFilter: columnFilter || {},
|
|
1531
1639
|
rawExternalFilter: externalFilter || {},
|
|
1532
1640
|
rawFilterDef: filterDef || {},
|
|
1533
|
-
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) ||
|
|
1534
|
-
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) ||
|
|
1641
|
+
orderBy: ((_a = __classPrivateFieldGet(this, _sort)) === null || _a === void 0 ? void 0 : _a.active) || "",
|
|
1642
|
+
orderDirection: ((_b = __classPrivateFieldGet(this, _sort)) === null || _b === void 0 ? void 0 : _b.direction) || "",
|
|
1535
1643
|
pageNumber: ((_c = __classPrivateFieldGet(this, _paginator)) === null || _c === void 0 ? void 0 : _c.pageIndex) || 0,
|
|
1536
|
-
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
|
|
1644
|
+
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,
|
|
1537
1645
|
};
|
|
1538
1646
|
});
|
|
1539
1647
|
_load$1.set(this, (filterReq, force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
1540
1648
|
this.isLoading = true;
|
|
1541
|
-
if (this.gridOption.type ===
|
|
1649
|
+
if (this.gridOption.type === "server") {
|
|
1542
1650
|
try {
|
|
1543
1651
|
let result = this.gridOption.items(filterReq);
|
|
1544
1652
|
if (isObservable(result)) {
|
|
@@ -1547,15 +1655,15 @@ class SdGridMaterial {
|
|
|
1547
1655
|
const data = yield result;
|
|
1548
1656
|
return {
|
|
1549
1657
|
items: (data === null || data === void 0 ? void 0 : data.items) || [],
|
|
1550
|
-
total: (data === null || data === void 0 ? void 0 : data.total) || 0
|
|
1658
|
+
total: (data === null || data === void 0 ? void 0 : data.total) || 0,
|
|
1551
1659
|
};
|
|
1552
1660
|
}
|
|
1553
1661
|
catch (error) {
|
|
1554
1662
|
console.error(error);
|
|
1555
|
-
this.notifyService.notify.warning(
|
|
1663
|
+
this.notifyService.notify.warning("Có lỗi xảy ra");
|
|
1556
1664
|
return {
|
|
1557
1665
|
items: [],
|
|
1558
|
-
total: 0
|
|
1666
|
+
total: 0,
|
|
1559
1667
|
};
|
|
1560
1668
|
}
|
|
1561
1669
|
finally {
|
|
@@ -1574,13 +1682,13 @@ class SdGridMaterial {
|
|
|
1574
1682
|
__classPrivateFieldSet(this, _localItems, results || []);
|
|
1575
1683
|
}
|
|
1576
1684
|
if (!Array.isArray(__classPrivateFieldGet(this, _localItems))) {
|
|
1577
|
-
this.notifyService.notify.warning(
|
|
1685
|
+
this.notifyService.notify.warning("Dữ liệu không phải là một mảng");
|
|
1578
1686
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1579
1687
|
}
|
|
1580
1688
|
}
|
|
1581
1689
|
catch (error) {
|
|
1582
1690
|
console.error(error);
|
|
1583
|
-
this.notifyService.notify.warning(
|
|
1691
|
+
this.notifyService.notify.warning("Có lỗi xảy ra");
|
|
1584
1692
|
__classPrivateFieldSet(this, _localItems, []);
|
|
1585
1693
|
}
|
|
1586
1694
|
finally {
|
|
@@ -1603,7 +1711,7 @@ class SdGridMaterial {
|
|
|
1603
1711
|
item.originItem = Object.assign({}, item);
|
|
1604
1712
|
});
|
|
1605
1713
|
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));
|
|
1606
|
-
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
1714
|
+
this.isSelectAll = this.items.every((e) => e.isSelected);
|
|
1607
1715
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1608
1716
|
}));
|
|
1609
1717
|
this.reload = (force = true) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1628,7 +1736,7 @@ class SdGridMaterial {
|
|
|
1628
1736
|
}
|
|
1629
1737
|
else {
|
|
1630
1738
|
const filterInfo = __classPrivateFieldGet(this, _filterExportInfo).call(this, pageNumber, pageSize);
|
|
1631
|
-
if (this.gridOption.type ===
|
|
1739
|
+
if (this.gridOption.type === "server") {
|
|
1632
1740
|
let result = this.gridOption.items(filterInfo);
|
|
1633
1741
|
if (isObservable(result)) {
|
|
1634
1742
|
result = result.toPromise();
|
|
@@ -1637,7 +1745,7 @@ class SdGridMaterial {
|
|
|
1637
1745
|
}
|
|
1638
1746
|
else {
|
|
1639
1747
|
let exportedItems = [];
|
|
1640
|
-
if (typeof
|
|
1748
|
+
if (typeof this.gridOption.items === "function") {
|
|
1641
1749
|
const results = this.gridOption.items();
|
|
1642
1750
|
if (results instanceof Promise) {
|
|
1643
1751
|
exportedItems = yield results;
|
|
@@ -1655,23 +1763,25 @@ class SdGridMaterial {
|
|
|
1655
1763
|
}));
|
|
1656
1764
|
_allColumns.set(this, () => {
|
|
1657
1765
|
const columns = [];
|
|
1658
|
-
this.gridOption.columns
|
|
1766
|
+
this.gridOption.columns
|
|
1767
|
+
.filter((e) => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })
|
|
1768
|
+
.forEach((column) => {
|
|
1659
1769
|
var _a, _b;
|
|
1660
|
-
if (column.type ===
|
|
1770
|
+
if (column.type === "image") {
|
|
1661
1771
|
return;
|
|
1662
1772
|
}
|
|
1663
|
-
if (column.type ===
|
|
1664
|
-
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(childColumn => {
|
|
1665
|
-
if (childColumn.type ===
|
|
1773
|
+
if (column.type === "children") {
|
|
1774
|
+
(_a = column.children) === null || _a === void 0 ? void 0 : _a.filter((e) => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach((childColumn) => {
|
|
1775
|
+
if (childColumn.type === "image") {
|
|
1666
1776
|
return;
|
|
1667
1777
|
}
|
|
1668
1778
|
columns.push(childColumn);
|
|
1669
1779
|
});
|
|
1670
1780
|
return;
|
|
1671
1781
|
}
|
|
1672
|
-
if (column.type ===
|
|
1673
|
-
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach(childColumn => {
|
|
1674
|
-
if (childColumn.type ===
|
|
1782
|
+
if (column.type === "children-col") {
|
|
1783
|
+
(_b = column.children) === null || _b === void 0 ? void 0 : _b.filter((e) => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); }).forEach((childColumn) => {
|
|
1784
|
+
if (childColumn.type === "image") {
|
|
1675
1785
|
return;
|
|
1676
1786
|
}
|
|
1677
1787
|
columns.push(childColumn);
|
|
@@ -1684,7 +1794,7 @@ class SdGridMaterial {
|
|
|
1684
1794
|
});
|
|
1685
1795
|
_allExportedColumns.set(this, () => {
|
|
1686
1796
|
var _a, _b;
|
|
1687
|
-
return ((_b = (_a = this.gridOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter(e => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || [];
|
|
1797
|
+
return (((_b = (_a = this.gridOption.export) === null || _a === void 0 ? void 0 : _a.columns) === null || _b === void 0 ? void 0 : _b.filter((e) => { var _a; return !((_a = e.export) === null || _a === void 0 ? void 0 : _a.disabled); })) || []);
|
|
1688
1798
|
});
|
|
1689
1799
|
_onExport.set(this, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
1690
1800
|
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -1705,7 +1815,7 @@ class SdGridMaterial {
|
|
|
1705
1815
|
promises = [];
|
|
1706
1816
|
exportItems = [];
|
|
1707
1817
|
for (const result of results) {
|
|
1708
|
-
if (
|
|
1818
|
+
if ("items" in result) {
|
|
1709
1819
|
exportItems = [...exportItems, ...result.items];
|
|
1710
1820
|
total = result.total;
|
|
1711
1821
|
}
|
|
@@ -1723,7 +1833,7 @@ class SdGridMaterial {
|
|
|
1723
1833
|
}
|
|
1724
1834
|
}
|
|
1725
1835
|
const totalPage = total / pageSize;
|
|
1726
|
-
const percent = Math.round((pageNumber - 1) * 100.0 / totalPage);
|
|
1836
|
+
const percent = Math.round(((pageNumber - 1) * 100.0) / totalPage);
|
|
1727
1837
|
this.exportTitle = `Exporting...${percent}%`;
|
|
1728
1838
|
const allColumns = __classPrivateFieldGet(this, _allColumns).call(this);
|
|
1729
1839
|
const allExportedColumns = __classPrivateFieldGet(this, _allExportedColumns).call(this);
|
|
@@ -1732,8 +1842,8 @@ class SdGridMaterial {
|
|
|
1732
1842
|
const handle = (exportColumn) => __awaiter(this, void 0, void 0, function* () {
|
|
1733
1843
|
var _t, _u, _v;
|
|
1734
1844
|
obj[exportColumn.field] = item[exportColumn.field];
|
|
1735
|
-
const column = allColumns.find(e => e.field === exportColumn.field);
|
|
1736
|
-
const exportedColumn = allExportedColumns.find(e => e.field === exportColumn.field);
|
|
1845
|
+
const column = allColumns.find((e) => e.field === exportColumn.field);
|
|
1846
|
+
const exportedColumn = allExportedColumns.find((e) => e.field === exportColumn.field);
|
|
1737
1847
|
if (exportedColumn === null || exportedColumn === void 0 ? void 0 : exportedColumn.transform) {
|
|
1738
1848
|
obj[exportedColumn.field] = exportedColumn.transform(item[exportedColumn.field], item);
|
|
1739
1849
|
return;
|
|
@@ -1741,16 +1851,16 @@ class SdGridMaterial {
|
|
|
1741
1851
|
if (!column) {
|
|
1742
1852
|
return;
|
|
1743
1853
|
}
|
|
1744
|
-
if (column.type ===
|
|
1745
|
-
column === null || column === void 0 ? void 0 : column.children.forEach(childColumn => handle(childColumn));
|
|
1854
|
+
if (column.type === "children" || column.type === "children-col") {
|
|
1855
|
+
column === null || column === void 0 ? void 0 : column.children.forEach((childColumn) => handle(childColumn));
|
|
1746
1856
|
return;
|
|
1747
1857
|
}
|
|
1748
|
-
if (!columns.some(e => e.field === column.field)) {
|
|
1858
|
+
if (!columns.some((e) => e.field === column.field)) {
|
|
1749
1859
|
return;
|
|
1750
1860
|
}
|
|
1751
1861
|
if (column.transform) {
|
|
1752
1862
|
const transform = column.transform(item[column.field], item, {
|
|
1753
|
-
isExport: true
|
|
1863
|
+
isExport: true,
|
|
1754
1864
|
});
|
|
1755
1865
|
if (transform instanceof Promise) {
|
|
1756
1866
|
obj[column.field] = yield transform;
|
|
@@ -1758,52 +1868,55 @@ class SdGridMaterial {
|
|
|
1758
1868
|
else {
|
|
1759
1869
|
obj[column.field] = transform;
|
|
1760
1870
|
}
|
|
1761
|
-
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t :
|
|
1871
|
+
obj[column.field] = (_t = obj[column.field]) !== null && _t !== void 0 ? _t : "";
|
|
1762
1872
|
}
|
|
1763
|
-
else if (item[column.field] === undefined ||
|
|
1764
|
-
|
|
1873
|
+
else if (item[column.field] === undefined ||
|
|
1874
|
+
item[column.field] === null ||
|
|
1875
|
+
item[column.field] === "") {
|
|
1876
|
+
obj[column.field] = "";
|
|
1765
1877
|
}
|
|
1766
|
-
else if (column.type ===
|
|
1878
|
+
else if (column.type === "string" || column.type === "number") {
|
|
1767
1879
|
// Nếu cell là string hoặc number thì gán bằng chính nó
|
|
1768
1880
|
obj[column.field] = item[column.field];
|
|
1769
1881
|
}
|
|
1770
|
-
else if (column.type ===
|
|
1882
|
+
else if (column.type === "bool") {
|
|
1771
1883
|
// Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
|
|
1772
1884
|
if (item[column.field]) {
|
|
1773
|
-
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) ||
|
|
1885
|
+
obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnTrue) || "True";
|
|
1774
1886
|
}
|
|
1775
|
-
else if (obj[column.field] !== undefined &&
|
|
1776
|
-
obj[column.field]
|
|
1887
|
+
else if (obj[column.field] !== undefined &&
|
|
1888
|
+
obj[column.field] !== null) {
|
|
1889
|
+
obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnFalse) || "False";
|
|
1777
1890
|
}
|
|
1778
1891
|
}
|
|
1779
|
-
else if (column.type ===
|
|
1892
|
+
else if (column.type === "date") {
|
|
1780
1893
|
let date = item[column.field];
|
|
1781
1894
|
const { transformDate } = column;
|
|
1782
1895
|
if (transformDate) {
|
|
1783
1896
|
date = transformDate(date, item);
|
|
1784
1897
|
}
|
|
1785
1898
|
// Nếu là date thì convert theo đúng format
|
|
1786
|
-
obj[column.field] = Date.toFormat(date,
|
|
1899
|
+
obj[column.field] = Date.toFormat(date, "dd/MM/yyyy");
|
|
1787
1900
|
}
|
|
1788
|
-
else if (column.type ===
|
|
1901
|
+
else if (column.type === "datetime") {
|
|
1789
1902
|
let date = item[column.field];
|
|
1790
1903
|
const { transformDate } = column;
|
|
1791
1904
|
if (transformDate) {
|
|
1792
1905
|
date = transformDate(date, item);
|
|
1793
1906
|
}
|
|
1794
1907
|
// Nếu là datetime thì convert theo đúng format
|
|
1795
|
-
obj[column.field] = Date.toFormat(date,
|
|
1908
|
+
obj[column.field] = Date.toFormat(date, "dd/MM/yyyy HH:mm");
|
|
1796
1909
|
}
|
|
1797
|
-
else if (column.type ===
|
|
1910
|
+
else if (column.type === "time") {
|
|
1798
1911
|
let date = item[column.field];
|
|
1799
1912
|
const { transformDate } = column;
|
|
1800
1913
|
if (transformDate) {
|
|
1801
1914
|
date = transformDate(date, item);
|
|
1802
1915
|
}
|
|
1803
1916
|
// Nếu là time thì convert theo đúng format
|
|
1804
|
-
obj[column.field] = Date.toFormat(date,
|
|
1917
|
+
obj[column.field] = Date.toFormat(date, "HH:mm");
|
|
1805
1918
|
}
|
|
1806
|
-
else if (column.type ===
|
|
1919
|
+
else if (column.type === "values") {
|
|
1807
1920
|
// Nếu là values thì lấy giá trị của value được chọn
|
|
1808
1921
|
obj[column.field] = yield this.columnValuesPipe.transform(item[column.field], column);
|
|
1809
1922
|
}
|
|
@@ -1834,7 +1947,7 @@ class SdGridMaterial {
|
|
|
1834
1947
|
yield this.exportService.exportCSV({
|
|
1835
1948
|
columns,
|
|
1836
1949
|
items,
|
|
1837
|
-
fileName: (_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName
|
|
1950
|
+
fileName: (_m = (_l = this.gridOption) === null || _l === void 0 ? void 0 : _l.export) === null || _m === void 0 ? void 0 : _m.fileName,
|
|
1838
1951
|
});
|
|
1839
1952
|
return;
|
|
1840
1953
|
}
|
|
@@ -1846,14 +1959,14 @@ class SdGridMaterial {
|
|
|
1846
1959
|
sheets.push({
|
|
1847
1960
|
name: sheet.name,
|
|
1848
1961
|
items: sheet.items,
|
|
1849
|
-
fields: sheet.fields
|
|
1962
|
+
fields: sheet.fields,
|
|
1850
1963
|
});
|
|
1851
1964
|
}
|
|
1852
1965
|
else {
|
|
1853
1966
|
sheets.push({
|
|
1854
1967
|
name: sheet.name,
|
|
1855
1968
|
items: yield sheet.items(),
|
|
1856
|
-
fields: sheet.fields
|
|
1969
|
+
fields: sheet.fields,
|
|
1857
1970
|
});
|
|
1858
1971
|
}
|
|
1859
1972
|
}
|
|
@@ -1863,7 +1976,7 @@ class SdGridMaterial {
|
|
|
1863
1976
|
columns,
|
|
1864
1977
|
items,
|
|
1865
1978
|
fileName: (_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.fileName,
|
|
1866
|
-
sheets
|
|
1979
|
+
sheets,
|
|
1867
1980
|
});
|
|
1868
1981
|
return;
|
|
1869
1982
|
}
|
|
@@ -1871,7 +1984,7 @@ class SdGridMaterial {
|
|
|
1871
1984
|
filePath: file.filePath,
|
|
1872
1985
|
fileName: file.fileName,
|
|
1873
1986
|
columns,
|
|
1874
|
-
items
|
|
1987
|
+
items,
|
|
1875
1988
|
});
|
|
1876
1989
|
}
|
|
1877
1990
|
finally {
|
|
@@ -1901,14 +2014,16 @@ class SdGridMaterial {
|
|
|
1901
2014
|
}
|
|
1902
2015
|
const data = (_z = (_y = (_x = this.gridOption) === null || _x === void 0 ? void 0 : _x.subInformation) === null || _y === void 0 ? void 0 : _y.onExpand) === null || _z === void 0 ? void 0 : _z.call(_y, rowData);
|
|
1903
2016
|
if (!((_0 = this.gridOption.subInformation) === null || _0 === void 0 ? void 0 : _0.multiple)) {
|
|
1904
|
-
this.items.forEach(item => item.isExpanding = item.isExpanded = false);
|
|
2017
|
+
this.items.forEach((item) => (item.isExpanding = item.isExpanded = false));
|
|
1905
2018
|
}
|
|
1906
2019
|
if (data instanceof Promise) {
|
|
1907
2020
|
rowData.isExpanding = true;
|
|
1908
|
-
data
|
|
2021
|
+
data
|
|
2022
|
+
.then((res) => {
|
|
1909
2023
|
rowData.expandDetail = res;
|
|
1910
2024
|
rowData.isExpanded = true;
|
|
1911
|
-
})
|
|
2025
|
+
})
|
|
2026
|
+
.finally(() => (rowData.isExpanding = false));
|
|
1912
2027
|
}
|
|
1913
2028
|
else {
|
|
1914
2029
|
rowData.expandDetail = data;
|
|
@@ -1918,42 +2033,46 @@ class SdGridMaterial {
|
|
|
1918
2033
|
this.onSelect = (rowData) => {
|
|
1919
2034
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1920
2035
|
if ((_b = (_a = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1921
|
-
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach(e => e.isSelected = rowData.isSelected);
|
|
1922
|
-
(_e = (_d = this.gridOption.selection) === null || _d === void 0 ? void 0 : _d.onSelect) === null || _e === void 0 ? void 0 : _e.call(_d, rowData, this.items.filter(e => e.isSelected));
|
|
1923
|
-
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2036
|
+
(_c = rowData === null || rowData === void 0 ? void 0 : rowData.sdGroup) === null || _c === void 0 ? void 0 : _c.items.forEach((e) => (e.isSelected = rowData.isSelected));
|
|
2037
|
+
(_e = (_d = this.gridOption.selection) === null || _d === void 0 ? void 0 : _d.onSelect) === null || _e === void 0 ? void 0 : _e.call(_d, rowData, this.items.filter((e) => e.isSelected));
|
|
2038
|
+
this.isSelectAll = this.items.every((e) => e.isSelected);
|
|
1924
2039
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1925
2040
|
}
|
|
1926
2041
|
else {
|
|
1927
2042
|
if ((_f = this.gridOption.selection) === null || _f === void 0 ? void 0 : _f.single) {
|
|
1928
|
-
this.items
|
|
2043
|
+
this.items
|
|
2044
|
+
.filter((e) => e !== rowData)
|
|
2045
|
+
.forEach((e) => (e.isSelected = false));
|
|
1929
2046
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1930
2047
|
return;
|
|
1931
2048
|
}
|
|
1932
|
-
(_h = (_g = this.gridOption.selection) === null || _g === void 0 ? void 0 : _g.onSelect) === null || _h === void 0 ? void 0 : _h.call(_g, rowData, this.items.filter(e => e.isSelected));
|
|
1933
|
-
this.isSelectAll = this.items.every(e => e.isSelected);
|
|
2049
|
+
(_h = (_g = this.gridOption.selection) === null || _g === void 0 ? void 0 : _g.onSelect) === null || _h === void 0 ? void 0 : _h.call(_g, rowData, this.items.filter((e) => e.isSelected));
|
|
2050
|
+
this.isSelectAll = this.items.every((e) => e.isSelected);
|
|
1934
2051
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1935
2052
|
}
|
|
1936
2053
|
};
|
|
1937
2054
|
this.onSelectAll = () => {
|
|
1938
2055
|
var _a, _b, _c;
|
|
1939
|
-
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(e => {
|
|
2056
|
+
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach((e) => {
|
|
1940
2057
|
var _a, _b, _c, _d;
|
|
1941
|
-
if (e.selectable &&
|
|
2058
|
+
if (e.selectable &&
|
|
2059
|
+
(!((_c = (_b = (_a = this.gridOption) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.length) || ((_d = e.actions) === null || _d === void 0 ? void 0 : _d.length))) {
|
|
1942
2060
|
e.isSelected = this.isSelectAll;
|
|
1943
2061
|
}
|
|
1944
2062
|
});
|
|
1945
|
-
(_c = (_b = this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, this.items.filter(e => e.isSelected));
|
|
2063
|
+
(_c = (_b = this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, this.items.filter((e) => e.isSelected));
|
|
1946
2064
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1947
2065
|
};
|
|
1948
2066
|
this.onClearSelection = (items) => {
|
|
1949
2067
|
items = items || this.items;
|
|
1950
2068
|
this.isSelectAll = false;
|
|
1951
|
-
items === null || items === void 0 ? void 0 : items.forEach(e => e.isSelected = false);
|
|
2069
|
+
items === null || items === void 0 ? void 0 : items.forEach((e) => (e.isSelected = false));
|
|
1952
2070
|
__classPrivateFieldGet(this, _updateSelectedItems).call(this);
|
|
1953
2071
|
};
|
|
1954
2072
|
_updateSelectedItems.set(this, () => {
|
|
1955
|
-
this.selectedItems = this.items
|
|
1956
|
-
.
|
|
2073
|
+
this.selectedItems = this.items
|
|
2074
|
+
.filter((item) => item.isSelected)
|
|
2075
|
+
.map((item) => {
|
|
1957
2076
|
const { isSelected, isExpanded, isExpanding, expandDetail, editorErrorMessage, editorHandlerColumn, editorHandlerRow, editorStatus, originItem, sdId, sdVersion } = item,
|
|
1958
2077
|
// Giữ lại các trường thông tin cho selectable (action, groupedAction, sdGroup, selectable)
|
|
1959
2078
|
result = __rest(item, ["isSelected", "isExpanded", "isExpanding", "expandDetail", "editorErrorMessage", "editorHandlerColumn", "editorHandlerRow", "editorStatus", "originItem", "sdId", "sdVersion"]);
|
|
@@ -1969,7 +2088,7 @@ class SdGridMaterial {
|
|
|
1969
2088
|
this.filterRegister.value.set({
|
|
1970
2089
|
columnFilter,
|
|
1971
2090
|
externalFilter,
|
|
1972
|
-
filterDef
|
|
2091
|
+
filterDef,
|
|
1973
2092
|
});
|
|
1974
2093
|
// if (this.gridOption?.filter?.inlineColumn && args?.columnFilter) {
|
|
1975
2094
|
// this.columnFilter = args.columnFilter;
|
|
@@ -1984,49 +2103,49 @@ class SdGridMaterial {
|
|
|
1984
2103
|
}
|
|
1985
2104
|
const item = {};
|
|
1986
2105
|
// Gán giá trị mặc định
|
|
1987
|
-
columns.forEach(column => {
|
|
1988
|
-
if (column.type ===
|
|
1989
|
-
item[column.field] =
|
|
2106
|
+
columns.forEach((column) => {
|
|
2107
|
+
if (column.type === "values") {
|
|
2108
|
+
item[column.field] = "";
|
|
1990
2109
|
}
|
|
1991
|
-
else if (column.type ===
|
|
2110
|
+
else if (column.type === "bool") {
|
|
1992
2111
|
item[column.field] = true;
|
|
1993
2112
|
}
|
|
1994
|
-
else if (column.type ===
|
|
2113
|
+
else if (column.type === "number") {
|
|
1995
2114
|
item[column.field] = null;
|
|
1996
2115
|
}
|
|
1997
2116
|
});
|
|
1998
|
-
if (type ===
|
|
2117
|
+
if (type === "local") {
|
|
1999
2118
|
(_a = editor.onAdd) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2000
2119
|
}
|
|
2001
2120
|
else {
|
|
2002
2121
|
(_b = editor.onAdd) === null || _b === void 0 ? void 0 : _b.call(editor, item, this.items);
|
|
2003
2122
|
}
|
|
2004
2123
|
// Đưa item lên dòng đầu tiên nếu type khác popup
|
|
2005
|
-
if (editor.type !==
|
|
2124
|
+
if (editor.type !== "popup") {
|
|
2006
2125
|
if (editor.addToLast) {
|
|
2007
|
-
if (type ===
|
|
2126
|
+
if (type === "local") {
|
|
2008
2127
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems), item]);
|
|
2009
2128
|
}
|
|
2010
2129
|
this.items = [...this.items, item];
|
|
2011
2130
|
}
|
|
2012
2131
|
else {
|
|
2013
|
-
if (type ===
|
|
2132
|
+
if (type === "local") {
|
|
2014
2133
|
__classPrivateFieldSet(this, _localItems, [item, ...__classPrivateFieldGet(this, _localItems)]);
|
|
2015
2134
|
}
|
|
2016
2135
|
this.items = [item, ...this.items];
|
|
2017
2136
|
}
|
|
2018
2137
|
}
|
|
2019
|
-
item.editorStatus =
|
|
2138
|
+
item.editorStatus = "create";
|
|
2020
2139
|
item.editorHandlerRow = {
|
|
2021
|
-
temporary: Object.assign({}, item)
|
|
2140
|
+
temporary: Object.assign({}, item),
|
|
2022
2141
|
};
|
|
2023
2142
|
};
|
|
2024
2143
|
this.onUpdate = (item) => {
|
|
2025
2144
|
const { editor } = this.gridOption;
|
|
2026
|
-
item.editorStatus =
|
|
2145
|
+
item.editorStatus = "update";
|
|
2027
2146
|
item.editorHandlerRow = Object.assign(Object.assign({}, item.editorHandlerRow), { temporary: Object.assign({}, item) });
|
|
2028
2147
|
// this.generateEditorHanlder(item);
|
|
2029
|
-
if (editor.type ===
|
|
2148
|
+
if (editor.type === "popup") {
|
|
2030
2149
|
// Xử lý case popup
|
|
2031
2150
|
// this.sdGridPopupEditor.open(item, columns, isModified);
|
|
2032
2151
|
}
|
|
@@ -2059,8 +2178,8 @@ class SdGridMaterial {
|
|
|
2059
2178
|
yield result;
|
|
2060
2179
|
}
|
|
2061
2180
|
}
|
|
2062
|
-
if (item.editorStatus ===
|
|
2063
|
-
if (this.gridOption.type ===
|
|
2181
|
+
if (item.editorStatus === "create" && editor.type === "popup") {
|
|
2182
|
+
if (this.gridOption.type === "local") {
|
|
2064
2183
|
this.items.splice(0, 0, item);
|
|
2065
2184
|
}
|
|
2066
2185
|
// this.viewItems.splice(0, 0, item);
|
|
@@ -2079,8 +2198,8 @@ class SdGridMaterial {
|
|
|
2079
2198
|
this.onCancel = (item) => {
|
|
2080
2199
|
var _a, _b;
|
|
2081
2200
|
const { editor } = this.gridOption;
|
|
2082
|
-
if (editor.type ===
|
|
2083
|
-
if (this.gridOption.type ===
|
|
2201
|
+
if (editor.type === "inline") {
|
|
2202
|
+
if (this.gridOption.type === "local") {
|
|
2084
2203
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2085
2204
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2086
2205
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2088,7 +2207,7 @@ class SdGridMaterial {
|
|
|
2088
2207
|
const idx1 = this.items.indexOf(item);
|
|
2089
2208
|
this.items.splice(idx1, 1);
|
|
2090
2209
|
this.items = [...this.items];
|
|
2091
|
-
if (this.gridOption.type ===
|
|
2210
|
+
if (this.gridOption.type === "local") {
|
|
2092
2211
|
(_a = editor === null || editor === void 0 ? void 0 : editor.onCancel) === null || _a === void 0 ? void 0 : _a.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2093
2212
|
}
|
|
2094
2213
|
else {
|
|
@@ -2097,9 +2216,9 @@ class SdGridMaterial {
|
|
|
2097
2216
|
this.ref.detectChanges();
|
|
2098
2217
|
return;
|
|
2099
2218
|
}
|
|
2100
|
-
if (editor.type ===
|
|
2101
|
-
if (item.editorStatus ===
|
|
2102
|
-
if (this.gridOption.type ===
|
|
2219
|
+
if (editor.type === "focus") {
|
|
2220
|
+
if (item.editorStatus === "create") {
|
|
2221
|
+
if (this.gridOption.type === "local") {
|
|
2103
2222
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2104
2223
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2105
2224
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2132,8 +2251,8 @@ class SdGridMaterial {
|
|
|
2132
2251
|
}
|
|
2133
2252
|
}
|
|
2134
2253
|
}
|
|
2135
|
-
if (editor.type ===
|
|
2136
|
-
if (this.gridOption.type ===
|
|
2254
|
+
if (editor.type === "inline") {
|
|
2255
|
+
if (this.gridOption.type === "local") {
|
|
2137
2256
|
const idx2 = __classPrivateFieldGet(this, _localItems).indexOf(item);
|
|
2138
2257
|
__classPrivateFieldGet(this, _localItems).splice(idx2, 1);
|
|
2139
2258
|
__classPrivateFieldSet(this, _localItems, [...__classPrivateFieldGet(this, _localItems)]);
|
|
@@ -2141,7 +2260,7 @@ class SdGridMaterial {
|
|
|
2141
2260
|
const idx1 = this.items.indexOf(item);
|
|
2142
2261
|
this.items.splice(idx1, 1);
|
|
2143
2262
|
this.items = [...this.items];
|
|
2144
|
-
if (this.gridOption.type ===
|
|
2263
|
+
if (this.gridOption.type === "local") {
|
|
2145
2264
|
(_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, __classPrivateFieldGet(this, _localItems));
|
|
2146
2265
|
}
|
|
2147
2266
|
else {
|
|
@@ -2212,21 +2331,25 @@ class SdGridMaterial {
|
|
|
2212
2331
|
set paginator(paginator) {
|
|
2213
2332
|
if (paginator && __classPrivateFieldGet(this, _paginator) !== paginator) {
|
|
2214
2333
|
__classPrivateFieldSet(this, _paginator, paginator);
|
|
2215
|
-
__classPrivateFieldGet(this, _subscription$2).add(paginator.page
|
|
2334
|
+
__classPrivateFieldGet(this, _subscription$2).add(paginator.page
|
|
2335
|
+
.pipe(map(() => {
|
|
2216
2336
|
__classPrivateFieldGet(this, _reload).next({
|
|
2217
|
-
force: false
|
|
2337
|
+
force: false,
|
|
2218
2338
|
});
|
|
2219
|
-
}))
|
|
2339
|
+
}))
|
|
2340
|
+
.subscribe());
|
|
2220
2341
|
}
|
|
2221
2342
|
}
|
|
2222
2343
|
set sort(sort) {
|
|
2223
2344
|
if (sort && __classPrivateFieldGet(this, _sort) !== sort) {
|
|
2224
2345
|
__classPrivateFieldSet(this, _sort, sort);
|
|
2225
|
-
__classPrivateFieldGet(this, _subscription$2).add(sort.sortChange
|
|
2346
|
+
__classPrivateFieldGet(this, _subscription$2).add(sort.sortChange
|
|
2347
|
+
.pipe(map(() => {
|
|
2226
2348
|
__classPrivateFieldGet(this, _reload).next({
|
|
2227
|
-
force: false
|
|
2349
|
+
force: false,
|
|
2228
2350
|
});
|
|
2229
|
-
}))
|
|
2351
|
+
}))
|
|
2352
|
+
.subscribe());
|
|
2230
2353
|
}
|
|
2231
2354
|
}
|
|
2232
2355
|
ngOnInit() {
|
|
@@ -2238,13 +2361,18 @@ class SdGridMaterial {
|
|
|
2238
2361
|
const result = yield __classPrivateFieldGet(this, _load$1).call(this, filterInfo, !__classPrivateFieldGet(this, _loadCompleted) || data.force);
|
|
2239
2362
|
__classPrivateFieldSet(this, _loadCompleted, true);
|
|
2240
2363
|
return result;
|
|
2241
|
-
})))
|
|
2364
|
+
})))
|
|
2365
|
+
.subscribe(__classPrivateFieldGet(this, _render)));
|
|
2242
2366
|
__classPrivateFieldGet(this, _subscription$2).add(this.sdCellDefs.changes.pipe(startWith([])).subscribe(__classPrivateFieldGet(this, _initCellDef)));
|
|
2243
|
-
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes
|
|
2244
|
-
|
|
2367
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFooterDefs.changes
|
|
2368
|
+
.pipe(startWith([]))
|
|
2369
|
+
.subscribe(__classPrivateFieldGet(this, _initFooterDef)));
|
|
2370
|
+
__classPrivateFieldGet(this, _subscription$2).add(this.sdFilterDefs.changes
|
|
2371
|
+
.pipe(startWith([]))
|
|
2372
|
+
.subscribe(__classPrivateFieldGet(this, _initFilterDef)));
|
|
2245
2373
|
__classPrivateFieldGet(this, _subscription$2).add(combineLatest([
|
|
2246
2374
|
__classPrivateFieldGet(this, _optionChanges).pipe(startWith(this.gridOption)),
|
|
2247
|
-
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs))
|
|
2375
|
+
this.sdFilterDefs.changes.pipe(startWith(this.filterDefs)),
|
|
2248
2376
|
]).subscribe((a) => {
|
|
2249
2377
|
__classPrivateFieldGet(this, _loadFilterRegister).call(this);
|
|
2250
2378
|
}));
|
|
@@ -2257,21 +2385,23 @@ class SdGridMaterial {
|
|
|
2257
2385
|
moveItemInArray(columns, event.previousIndex, event.currentIndex);
|
|
2258
2386
|
}
|
|
2259
2387
|
get editedItems() {
|
|
2260
|
-
return this.items
|
|
2388
|
+
return this.items
|
|
2389
|
+
.filter((item) => {
|
|
2261
2390
|
if (!item.originItem) {
|
|
2262
2391
|
return true;
|
|
2263
2392
|
}
|
|
2264
|
-
if (Object.keys(item.originItem).some(key => item.originItem[key] !== item[key])) {
|
|
2393
|
+
if (Object.keys(item.originItem).some((key) => item.originItem[key] !== item[key])) {
|
|
2265
2394
|
return true;
|
|
2266
2395
|
}
|
|
2267
2396
|
return false;
|
|
2268
|
-
})
|
|
2397
|
+
})
|
|
2398
|
+
.map((item) => {
|
|
2269
2399
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, editorErrorMessage, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "editorErrorMessage", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2270
2400
|
return Object.assign(Object.assign({}, result), { editorErrorMessage });
|
|
2271
2401
|
});
|
|
2272
2402
|
}
|
|
2273
2403
|
get gridItems() {
|
|
2274
|
-
return this.items.map(item => {
|
|
2404
|
+
return this.items.map((item) => {
|
|
2275
2405
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2276
2406
|
return result;
|
|
2277
2407
|
});
|
|
@@ -2280,25 +2410,25 @@ class SdGridMaterial {
|
|
|
2280
2410
|
return __classPrivateFieldGet(this, _localItems);
|
|
2281
2411
|
}
|
|
2282
2412
|
get localGridItems() {
|
|
2283
|
-
return __classPrivateFieldGet(this, _localItems).map(item => {
|
|
2413
|
+
return __classPrivateFieldGet(this, _localItems).map((item) => {
|
|
2284
2414
|
const { editorStatus, editorHandlerRow, editorHandlerColumn, expandDetail, isExpanded, isExpanding, isSelected, originItem, sdId, sdVersion, selectable, actions, groupedActions, sdGroup, temporary } = item, result = __rest(item, ["editorStatus", "editorHandlerRow", "editorHandlerColumn", "expandDetail", "isExpanded", "isExpanding", "isSelected", "originItem", "sdId", "sdVersion", "selectable", "actions", "groupedActions", "sdGroup", "temporary"]);
|
|
2285
2415
|
return result;
|
|
2286
2416
|
});
|
|
2287
2417
|
}
|
|
2288
2418
|
get isEditing() {
|
|
2289
|
-
return this.items.some(e => e.editorStatus !== undefined);
|
|
2419
|
+
return this.items.some((e) => e.editorStatus !== undefined);
|
|
2290
2420
|
}
|
|
2291
2421
|
}
|
|
2292
2422
|
_optionChanges = new WeakMap(), _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(), _subscription$2 = new WeakMap(), _reload = new WeakMap(), _loadCompleted = new WeakMap(), _initCellDef = new WeakMap(), _initFilterDef = new WeakMap(), _initFooterDef = new WeakMap(), _filterExportInfo = new WeakMap(), _initConfiguration = 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(), _updateSelectedItems = new WeakMap();
|
|
2293
2423
|
SdGridMaterial.decorators = [
|
|
2294
2424
|
{ type: Component, args: [{
|
|
2295
|
-
selector:
|
|
2425
|
+
selector: "sd-grid-material",
|
|
2296
2426
|
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 <sd-grid-filter *ngIf=\"!gridOption.filter?.disabled && filterRegister\" [filterRegister]=\"filterRegister\" [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\" [externalFilters]=\"gridOption?.filter?.externalFilters\" [filterDefs]=\"filterDefs\" #gridFilter>\r\n </sd-grid-filter>\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=\"gridFilter && !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.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\"\r\n (export)=\"onExport($event)\" #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>",
|
|
2297
2427
|
animations: [
|
|
2298
|
-
trigger(
|
|
2299
|
-
state(
|
|
2300
|
-
state(
|
|
2301
|
-
transition(
|
|
2428
|
+
trigger("detailExpand", [
|
|
2429
|
+
state("collapsed", style({ height: "0", minHeight: "0", visibility: "hidden" })),
|
|
2430
|
+
state("expanded", style({ height: "*", visibility: "visible" })),
|
|
2431
|
+
transition("expanded <=> collapsed", animate("225ms cubic-bezier(0.4, 0.0, 0.2, 1)")),
|
|
2302
2432
|
]),
|
|
2303
2433
|
],
|
|
2304
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}:host .style1 .mat-table{border:1px solid #dde0e5}:host .style1 .mat-table tr.mat-header-row{background:#f2f3f4}:host .style1 .mat-table th.mat-header-cell{padding:10px 0}:host .style1 .c-paginator{border:1px solid #dde0e5;border-top:none!important}:host .style1 .mat-form-field-wrapper{background:#fff;padding:0}@-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\")}"]
|