@sd-angular/core 1.3.35 → 1.3.36

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.
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ3JpZC1leHBvcnQubW9kZWwuanMiLCJzb3VyY2VSb290IjoiQzovVXNlcnMvbmdoaWF0dDE1X29uZW1vdW50L0RvY3VtZW50cy9saWItY29yZS11aS9wcm9qZWN0cy9zZC1jb3JlL2dyaWQtbWF0ZXJpYWwvIiwic291cmNlcyI6WyJzcmMvbGliL21vZGVscy9ncmlkLWV4cG9ydC5tb2RlbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgU2RHcmlkTWF0ZXJpYWxGaWx0ZXJSZXF1ZXN0IH0gZnJvbSAnLi9ncmlkLWZpbHRlci5tb2RlbCc7XHJcbmltcG9ydCB7IFNkR3JpZE1hdGVyaWFsQ29sdW1uIH0gZnJvbSAnLi9ncmlkLWNvbHVtbi5tb2RlbCc7XHJcbmltcG9ydCB7IE9ic2VydmFibGUgfSBmcm9tICdyeGpzJztcclxuXHJcbmV4cG9ydCBpbnRlcmZhY2UgU2RHcmlkTWF0ZXJpYWxFeHBvcnRPcHRpb248VCA9IGFueT4ge1xyXG4gIGtleT86IHN0cmluZztcclxuICB2aXNpYmxlPzogYm9vbGVhbjtcclxuICB2aXNpYmxlRXhjZWw/OiBib29sZWFuO1xyXG4gIHZpc2libGVFeGNlbFJhdz86IGJvb2xlYW47XHJcbiAgdmlzaWJsZUNTVj86IGJvb2xlYW47XHJcbiAgZW5hYmxlVXBsb2FkPzogYm9vbGVhbjtcclxuICBmaWxlTmFtZT86IHN0cmluZztcclxuICBtYXg/OiBudW1iZXI7IC8vIFPhu5EgZMOybmcgZOG7ryBsaeG7h3UgdOG7kWkgxJFhIGN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JcbiJdfQ==
@@ -43,9 +43,8 @@ export declare class SdExportService {
43
43
  items: any[];
44
44
  fileName?: string;
45
45
  }) => Promise<void>;
46
- export: (option: IExportOption) => Promise<void>;
47
46
  exportCSV: (option: IExportOption) => Promise<void>;
48
- exportExcelRaw: (option: IExportOption) => Promise<void>;
47
+ export: (option: IExportOption) => Promise<void>;
49
48
  mergePDF: (urls: string[]) => Promise<void>;
50
49
  loadExportedItems: (items: (pageSize: number, pageNumber: number) => {
51
50
  total: number;
@@ -240,35 +240,6 @@ class SdExportService {
240
240
  const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });
241
241
  __classPrivateFieldGet(this, _blobToSaveAs).call(this, blob, fileName);
242
242
  });
243
- this.export = (option) => __awaiter(this, void 0, void 0, function* () {
244
- const { sdExport } = API;
245
- const url = `${this.functionUrl}${sdExport}`;
246
- const buffer = yield this.apiService.post(url, option, null, {
247
- responseType: 'arraybuffer'
248
- });
249
- const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });
250
- __classPrivateFieldGet(this, _blobToSaveAs).call(this, blob, option === null || option === void 0 ? void 0 : option.fileName);
251
- });
252
- // exportCSV = async (option: IExportOption) => {
253
- // const { columns, items, fileName } = option;
254
- // const options = {
255
- // fieldSeparator: ',',
256
- // quoteStrings: '"',
257
- // decimalseparator: '.',
258
- // showLabels: true,
259
- // showTitle: false,
260
- // title: fileName || 'CSV',
261
- // useBom: true,
262
- // noDownload: false,
263
- // useHeader: false,
264
- // nullToEmptyString: true,
265
- // };
266
- // const headerCSV = {};
267
- // for (const column of columns) {
268
- // headerCSV[column.field] = column.title;
269
- // }
270
- // return new AngularCsv([...[headerCSV], ...items], `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`, options);
271
- // }
272
243
  this.exportCSV = (option) => __awaiter(this, void 0, void 0, function* () {
273
244
  const { columns, items, fileName } = option;
274
245
  const headerCSV = {};
@@ -287,19 +258,7 @@ class SdExportService {
287
258
  });
288
259
  csvExporter.generateCsv([headerCSV, ...items]);
289
260
  });
290
- // exportExcelRaw = async (option: IExportOption) => {
291
- // const { columns, items, fileName } = option;
292
- // const header = {};
293
- // for (const column of columns) {
294
- // header[column.field] = column.title;
295
- // }
296
- // const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet([header, ...items]);
297
- // const wb: XLSX.WorkBook = { Sheets: { data: ws }, SheetNames: ['data'] };
298
- // const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
299
- // const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' });
300
- // this.#blobToSaveAs(blob, fileName);
301
- // }
302
- this.exportExcelRaw = (option) => __awaiter(this, void 0, void 0, function* () {
261
+ this.export = (option) => __awaiter(this, void 0, void 0, function* () {
303
262
  const { columns, items, fileName, sheets } = option;
304
263
  let hasDescription = false;
305
264
  for (const [idx, column] of columns.entries()) {
@@ -1 +1 @@
1
- {"version":3,"file":"sd-angular-core-export.js","sources":["../../../../projects/sd-core/export/src/lib/export.model.ts","../../../../projects/sd-core/export/src/lib/export.service.ts","../../../../projects/sd-core/export/src/public-api.ts","../../../../projects/sd-core/export/sd-angular-core-export.ts"],"sourcesContent":["export interface SdExportTemplate {\r\n fileName?: string;\r\n columns: SdExportTempateColumn[];\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface SdExportTempateColumn {\r\n field: string;\r\n title: string;\r\n required?: boolean;\r\n color?: string;\r\n width?: string;\r\n description?: string;\r\n fontColor?: string;\r\n fill?: string;\r\n}\r\n\r\nexport interface SdExportFile {\r\n fileName?: string;\r\n filePath?: string;\r\n}\r\n\r\nexport interface SdExportColumn {\r\n field: string;\r\n title: string;\r\n description?: string;\r\n width?: string;\r\n}\r\n\r\nexport interface IExportOption {\r\n columns: SdExportTempateColumn[];\r\n items: any[];\r\n fileName?: string;\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface IBigExportRequest {\r\n filePath?: string;\r\n destination?: string;\r\n latestRow: number;\r\n columns: {\r\n field: string,\r\n title: string,\r\n description?: string,\r\n width?: string,\r\n }[];\r\n items: any[];\r\n}\r\n\r\nexport interface IBigExportResponse {\r\n filePath: string;\r\n destination: string;\r\n latestRow: number;\r\n}\r\n\r\nexport type GroupPermission = 'view' | 'add' | 'delete';\r\n\r\nexport const API = {\r\n generateTemplate: '/excel/generateTemplate',\r\n uploadTemplate: '/excel/uploadTemplate',\r\n generateUploadTemplate: '/excel/generateUploadTemplate',\r\n export: '/excel/export',\r\n downloadByTemplate: '/excel/downloadByTemplate',\r\n filesInFolder: '/excel/filesInFolder',\r\n removeFile: '/excel/remove',\r\n sdExport: '/excel/sd-export',\r\n sdExportByTemplate: '/excel/sd-export-by-template',\r\n sdMergePDF: '/excel/sd-merge-pdf',\r\n sdGenerateTemplate: '/excel/sd-generate-template',\r\n};\r\n","import { Optional } from '@angular/core';\r\nimport { Injectable, Inject } from '@angular/core';\r\nimport { SdApiService } from '@sd-angular/core/api';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { ExportToCsv } from 'export-to-csv';\r\nimport { Workbook, Style } from 'exceljs';\r\nimport { SdExportTemplate, IExportOption, API, SdExportFile } from './export.model';\r\nimport { SdNotifyService } from '@sd-angular/core/notify';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FIREBASE_CONFIG, IFirebaseConfiguration } from '@sd-angular/core/common';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SdExportService {\r\n private get functionUrl() {\r\n return this.firebaseConfiguration?.functionUrl;\r\n }\r\n\r\n private get folder() {\r\n const { project, env } = this.firebaseConfiguration;\r\n return `${project}-${env}`;\r\n }\r\n\r\n private get userFolder() {\r\n const { folder } = this.firebaseConfiguration;\r\n if (!folder) {\r\n return;\r\n }\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n #fieldStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FAFAFA'\r\n }\r\n }\r\n }\r\n\r\n #titleStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: '143180'\r\n }\r\n }\r\n }\r\n\r\n #requiredStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n italic: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FF1744'\r\n }\r\n }\r\n }\r\n\r\n #descriptionStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n wrapText: true\r\n },\r\n font: {\r\n italic: true,\r\n size: 9,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'CFD8DC'\r\n }\r\n }\r\n }\r\n\r\n #cellStyle: Partial<Style> = {\r\n alignment: {\r\n vertical: 'middle',\r\n wrapText: true\r\n }\r\n }\r\n\r\n constructor(\r\n private apiService: SdApiService,\r\n private utilityService: SdUtilityService,\r\n private notifyService: SdNotifyService,\r\n @Inject(FIREBASE_CONFIG) @Optional() private firebaseConfiguration: IFirebaseConfiguration) {\r\n }\r\n\r\n #directory = (key: string, group: string) => {\r\n let hashedFolder = hash({\r\n folder: this.folder,\r\n userFolder: this.userFolder\r\n });\r\n if (!group) {\r\n return `dir1=${this.folder}&dir2=U-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n hashedFolder = hash({\r\n folder: this.folder,\r\n group\r\n });\r\n return `dir1=${this.folder}&dir2=G-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n\r\n // generateTemplate = async (template: SdExportTemplate) => {\r\n // const { sdGenerateTemplate } = API;\r\n // const url = `${this.functionUrl}${sdGenerateTemplate}`;\r\n // const buffer = await this.apiService.post(url, template, null, {\r\n // responseType: 'arraybuffer'\r\n // });\r\n // const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n // this.#blobToSaveAs(blob, template.fileName || 'Template');\r\n // }\r\n\r\n generateTemplate = async (template: SdExportTemplate) => {\r\n const { sdGenerateTemplate } = API;\r\n const url = `${this.functionUrl}${sdGenerateTemplate}`;\r\n const buffer = await this.apiService.post(url, template, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, template.fileName || 'Template');\r\n }\r\n\r\n uploadTemplate = async (args: {\r\n key: string;\r\n group?: string;\r\n validator?: (fileName: string) => string\r\n }): Promise<SdExportFile> => {\r\n const { key, group, validator } = args;\r\n const { uploadTemplate } = API;\r\n const url = `${this.functionUrl}${uploadTemplate}?${this.#directory(key, group)}`;\r\n const file = await this.utilityService.upload({\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 0.1,\r\n validator\r\n });\r\n if (file) {\r\n const { filePath, fileName } = await this.apiService.upload(url, file).catch((err: Error) => {\r\n this.notifyService.notify.warning(err?.message);\r\n throw err;\r\n });\r\n return {\r\n filePath,\r\n fileName,\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n generateUploadTemplate = async (args: {\r\n key: string;\r\n template: SdExportTemplate;\r\n group?: string;\r\n }) => {\r\n const { key, template, group } = args;\r\n const { generateUploadTemplate } = API;\r\n const url = `${this.functionUrl}${generateUploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n removeFile = async (args: {\r\n key: string;\r\n group?: string;\r\n fileName?: string;\r\n }) => {\r\n const { key, group, fileName } = args;\r\n const { removeFile } = API;\r\n const url = `${this.functionUrl}${removeFile}?${this.#directory(key, group)}&name=${fileName}`;\r\n await this.apiService.post(url);\r\n }\r\n\r\n filesInFolder = async (args: {\r\n key: string;\r\n group?: string;\r\n }): Promise<SdExportFile[]> => {\r\n interface FilesInFolderRes {\r\n directory: string;\r\n files: {\r\n publicUrl: string, fullPath: string, name: string\r\n }[];\r\n }\r\n const { key, group } = args;\r\n const { filesInFolder } = API;\r\n const url = `${this.functionUrl}${filesInFolder}?${this.#directory(key, group)}`;\r\n const res = await this.apiService.get<FilesInFolderRes>(url);\r\n return res.files?.map(e => ({\r\n filePath: e.publicUrl,\r\n fileName: e.name\r\n })) || [];\r\n }\r\n\r\n download = (filePath: string, fileName?: string) => {\r\n const link: any = document.createElement('a');\r\n link.download = `${fileName || uuid.v4()}.xlsx`;\r\n link.href = filePath;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n exportByTemplate = async (args: {\r\n filePath: string,\r\n columns: any[],\r\n items: any[],\r\n fileName?: string\r\n }) => {\r\n const { filePath, columns, items, fileName } = args;\r\n const { sdExportByTemplate } = API;\r\n const url = `${this.functionUrl}${sdExportByTemplate}`;\r\n const buffer = await this.apiService.post(url, {\r\n filePath,\r\n columns,\r\n items,\r\n fileName\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, fileName);\r\n }\r\n\r\n export = async (option: IExportOption) => {\r\n const { sdExport } = API;\r\n const url = `${this.functionUrl}${sdExport}`;\r\n const buffer = await this.apiService.post(url, option, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, option?.fileName);\r\n }\r\n\r\n // exportCSV = async (option: IExportOption) => {\r\n // const { columns, items, fileName } = option;\r\n // const options = {\r\n // fieldSeparator: ',',\r\n // quoteStrings: '\"',\r\n // decimalseparator: '.',\r\n // showLabels: true,\r\n // showTitle: false,\r\n // title: fileName || 'CSV',\r\n // useBom: true,\r\n // noDownload: false,\r\n // useHeader: false,\r\n // nullToEmptyString: true,\r\n // };\r\n // const headerCSV = {};\r\n // for (const column of columns) {\r\n // headerCSV[column.field] = column.title;\r\n // }\r\n // return new AngularCsv([...[headerCSV], ...items], `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`, options);\r\n // }\r\n\r\n exportCSV = async (option: IExportOption) => {\r\n const { columns, items, fileName } = option;\r\n const headerCSV = {};\r\n for (const column of columns) {\r\n headerCSV[column.field] = column.title;\r\n }\r\n const csvExporter = new ExportToCsv({\r\n filename: `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`,\r\n fieldSeparator: ',',\r\n quoteStrings: '\"',\r\n decimalSeparator: '.',\r\n showLabels: true,\r\n showTitle: false,\r\n title: fileName || 'CSV',\r\n useBom: true,\r\n });\r\n csvExporter.generateCsv([headerCSV, ...items]);\r\n }\r\n\r\n // exportExcelRaw = async (option: IExportOption) => {\r\n // const { columns, items, fileName } = option;\r\n // const header = {};\r\n // for (const column of columns) {\r\n // header[column.field] = column.title;\r\n // }\r\n // const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet([header, ...items]);\r\n // const wb: XLSX.WorkBook = { Sheets: { data: ws }, SheetNames: ['data'] };\r\n // const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });\r\n // const blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8' });\r\n // this.#blobToSaveAs(blob, fileName);\r\n // }\r\n\r\n exportExcelRaw = async (option: IExportOption) => {\r\n const { columns, items, fileName, sheets } = option;\r\n let hasDescription = false;\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n if (column.description) {\r\n hasDescription = true;\r\n }\r\n }\r\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\r\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle\r\n if (column.required) {\r\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\r\n } else {\r\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n }\r\n firstSheet.getCell(1, index + 1).value = column.field;\r\n firstSheet.getCell(2, index + 1).value = column.title;\r\n if (hasDescription) {\r\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\r\n firstSheet.getCell(3, index + 1).value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.fields)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.fields.forEach((field, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = field;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.fields.forEach((field, idx2) => {\r\n newSheet.getCell(2 + idx1, 1 + idx2).value = item[field];\r\n newSheet.getCell(2 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n\r\n const fromRow = hasDescription ? 4 : 3;\r\n items.forEach((e, idx1) => {\r\n columns.forEach((column, idx2) => {\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n const file = await workbook.xlsx.writeBuffer();\r\n this.#blobToSaveAs(new Blob([file], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }), fileName);\r\n }\r\n\r\n mergePDF = async (urls: string[]) => {\r\n const { sdMergePDF } = API;\r\n const url = `${this.functionUrl}${sdMergePDF}`;\r\n const buffer = await this.apiService.post(url, {\r\n urls\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/pdf' });\r\n this.#blobToSaveAs(blob, `${uuid.v4()}`);\r\n }\r\n\r\n loadExportedItems = async (items: (pageSize: number, pageNumber: number) => { total: number, }) => {\r\n\r\n }\r\n\r\n #blobToSaveAs = (blob: Blob, fileName: string = 'Export') => {\r\n try {\r\n const url = window.URL.createObjectURL(blob);\r\n const link = document.createElement('a');\r\n fileName = fileName.replace(/.xlsx/i, '');\r\n fileName = fileName.replace(/.pdf/i, '');\r\n if (link.download !== undefined) { // feature detection\r\n link.setAttribute('href', url);\r\n link.setAttribute('download', `${fileName}_${new Date().toFormat('yyyy_MM_dd_HH_mm')}`);\r\n link.style.visibility = 'hidden';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n } catch (e) {\r\n console.error('BlobToSaveAs error', e);\r\n }\r\n }\r\n}\r\n\r\nexport interface IExportInfo {\r\n data: any[];\r\n sheetName?: string;\r\n fileName?: string;\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/export.model';\r\nexport * from './lib/export.service';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;MAiEa,GAAG,GAAG;IACjB,gBAAgB,EAAE,yBAAyB;IAC3C,cAAc,EAAE,uBAAuB;IACvC,sBAAsB,EAAE,+BAA+B;IACvD,MAAM,EAAE,eAAe;IACvB,kBAAkB,EAAE,2BAA2B;IAC/C,aAAa,EAAE,sBAAsB;IACrC,UAAU,EAAE,eAAe;IAC3B,QAAQ,EAAE,kBAAkB;IAC5B,kBAAkB,EAAE,8BAA8B;IAClD,UAAU,EAAE,qBAAqB;IACjC,kBAAkB,EAAE,6BAA6B;;;;MC7DtC,eAAe;IA8H1B,YACU,UAAwB,EACxB,cAAgC,EAChC,aAA8B,EACO,qBAA6C;QAHlF,eAAU,GAAV,UAAU,CAAc;QACxB,mBAAc,GAAd,cAAc,CAAkB;QAChC,kBAAa,GAAb,aAAa,CAAiB;QACO,0BAAqB,GAArB,qBAAqB,CAAwB;QA7G5F,sBAA8B;YAC5B,MAAM,EAAE;gBACN,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;gBACzB,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;gBACvB,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;aACzB;YACD,SAAS,EAAE;gBACT,QAAQ,EAAE,QAAQ;gBAClB,UAAU,EAAE,QAAQ;gBACpB,QAAQ,EAAE,IAAI;a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G,QAAQ,IAAI,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;oBACxF,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;oBACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBAChC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACb,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;iBACjC;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;aACxC;SACF,EAAA;KAzSA;IAlID,IAAY,WAAW;;QACrB,aAAO,IAAI,CAAC,qBAAqB,0CAAE,WAAW,CAAC;KAChD;IAED,IAAY,MAAM;QAChB,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACpD,OAAO,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC;KAC5B;IAED,IAAY,UAAU;QACpB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,IAAI,QAAQ,MAAM,CAAC,KAAK,QAAQ,EAAE;YAChC,OAAO,MAAM,CAAC;SACf;QACD,OAAO,MAAM,EAAE,CAAC;KACjB;;;;;YAtBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;YAZQ,YAAY;YAOZ,gBAAgB;YADhB,eAAe;4CAyInB,MAAM,SAAC,eAAe,cAAG,QAAQ;;;ACjJtC;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"sd-angular-core-export.js","sources":["../../../../projects/sd-core/export/src/lib/export.model.ts","../../../../projects/sd-core/export/src/lib/export.service.ts","../../../../projects/sd-core/export/src/public-api.ts","../../../../projects/sd-core/export/sd-angular-core-export.ts"],"sourcesContent":["export interface SdExportTemplate {\r\n fileName?: string;\r\n columns: SdExportTempateColumn[];\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface SdExportTempateColumn {\r\n field: string;\r\n title: string;\r\n required?: boolean;\r\n color?: string;\r\n width?: string;\r\n description?: string;\r\n fontColor?: string;\r\n fill?: string;\r\n}\r\n\r\nexport interface SdExportFile {\r\n fileName?: string;\r\n filePath?: string;\r\n}\r\n\r\nexport interface SdExportColumn {\r\n field: string;\r\n title: string;\r\n description?: string;\r\n width?: string;\r\n}\r\n\r\nexport interface IExportOption {\r\n columns: SdExportTempateColumn[];\r\n items: any[];\r\n fileName?: string;\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface IBigExportRequest {\r\n filePath?: string;\r\n destination?: string;\r\n latestRow: number;\r\n columns: {\r\n field: string,\r\n title: string,\r\n description?: string,\r\n width?: string,\r\n }[];\r\n items: any[];\r\n}\r\n\r\nexport interface IBigExportResponse {\r\n filePath: string;\r\n destination: string;\r\n latestRow: number;\r\n}\r\n\r\nexport type GroupPermission = 'view' | 'add' | 'delete';\r\n\r\nexport const API = {\r\n generateTemplate: '/excel/generateTemplate',\r\n uploadTemplate: '/excel/uploadTemplate',\r\n generateUploadTemplate: '/excel/generateUploadTemplate',\r\n export: '/excel/export',\r\n downloadByTemplate: '/excel/downloadByTemplate',\r\n filesInFolder: '/excel/filesInFolder',\r\n removeFile: '/excel/remove',\r\n sdExport: '/excel/sd-export',\r\n sdExportByTemplate: '/excel/sd-export-by-template',\r\n sdMergePDF: '/excel/sd-merge-pdf',\r\n sdGenerateTemplate: '/excel/sd-generate-template',\r\n};\r\n","import { Optional } from '@angular/core';\r\nimport { Injectable, Inject } from '@angular/core';\r\nimport { SdApiService } from '@sd-angular/core/api';\r\nimport * as uuid from 'uuid';\r\nimport hash from 'object-hash';\r\nimport { ExportToCsv } from 'export-to-csv';\r\nimport { Workbook, Style } from 'exceljs';\r\nimport { SdExportTemplate, IExportOption, API, SdExportFile } from './export.model';\r\nimport { SdNotifyService } from '@sd-angular/core/notify';\r\nimport { SdUtilityService } from '@sd-angular/core/utility';\r\nimport { FIREBASE_CONFIG, IFirebaseConfiguration } from '@sd-angular/core/common';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SdExportService {\r\n private get functionUrl() {\r\n return this.firebaseConfiguration?.functionUrl;\r\n }\r\n\r\n private get folder() {\r\n const { project, env } = this.firebaseConfiguration;\r\n return `${project}-${env}`;\r\n }\r\n\r\n private get userFolder() {\r\n const { folder } = this.firebaseConfiguration;\r\n if (!folder) {\r\n return;\r\n }\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n #fieldStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FAFAFA'\r\n }\r\n }\r\n }\r\n\r\n #titleStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n bold: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: '143180'\r\n }\r\n }\r\n }\r\n\r\n #requiredStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n vertical: 'middle',\r\n horizontal: 'center',\r\n wrapText: true\r\n },\r\n font: {\r\n italic: true,\r\n size: 11,\r\n color: { argb: 'FFFFFF' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'FF1744'\r\n }\r\n }\r\n }\r\n\r\n #descriptionStyle: Partial<Style> = {\r\n border: {\r\n bottom: { style: 'thin' },\r\n left: { style: 'thin' },\r\n right: { style: 'thin' }\r\n },\r\n alignment: {\r\n wrapText: true\r\n },\r\n font: {\r\n italic: true,\r\n size: 9,\r\n color: { argb: '000000' },\r\n },\r\n fill: {\r\n type: 'pattern',\r\n pattern: 'solid',\r\n fgColor: {\r\n argb: 'CFD8DC'\r\n }\r\n }\r\n }\r\n\r\n #cellStyle: Partial<Style> = {\r\n alignment: {\r\n vertical: 'middle',\r\n wrapText: true\r\n }\r\n }\r\n\r\n constructor(\r\n private apiService: SdApiService,\r\n private utilityService: SdUtilityService,\r\n private notifyService: SdNotifyService,\r\n @Inject(FIREBASE_CONFIG) @Optional() private firebaseConfiguration: IFirebaseConfiguration) {\r\n }\r\n\r\n #directory = (key: string, group: string) => {\r\n let hashedFolder = hash({\r\n folder: this.folder,\r\n userFolder: this.userFolder\r\n });\r\n if (!group) {\r\n return `dir1=${this.folder}&dir2=U-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n hashedFolder = hash({\r\n folder: this.folder,\r\n group\r\n });\r\n return `dir1=${this.folder}&dir2=G-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n\r\n // generateTemplate = async (template: SdExportTemplate) => {\r\n // const { sdGenerateTemplate } = API;\r\n // const url = `${this.functionUrl}${sdGenerateTemplate}`;\r\n // const buffer = await this.apiService.post(url, template, null, {\r\n // responseType: 'arraybuffer'\r\n // });\r\n // const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n // this.#blobToSaveAs(blob, template.fileName || 'Template');\r\n // }\r\n\r\n generateTemplate = async (template: SdExportTemplate) => {\r\n const { sdGenerateTemplate } = API;\r\n const url = `${this.functionUrl}${sdGenerateTemplate}`;\r\n const buffer = await this.apiService.post(url, template, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, template.fileName || 'Template');\r\n }\r\n\r\n uploadTemplate = async (args: {\r\n key: string;\r\n group?: string;\r\n validator?: (fileName: string) => string\r\n }): Promise<SdExportFile> => {\r\n const { key, group, validator } = args;\r\n const { uploadTemplate } = API;\r\n const url = `${this.functionUrl}${uploadTemplate}?${this.#directory(key, group)}`;\r\n const file = await this.utilityService.upload({\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 0.1,\r\n validator\r\n });\r\n if (file) {\r\n const { filePath, fileName } = await this.apiService.upload(url, file).catch((err: Error) => {\r\n this.notifyService.notify.warning(err?.message);\r\n throw err;\r\n });\r\n return {\r\n filePath,\r\n fileName,\r\n };\r\n }\r\n return null;\r\n }\r\n\r\n generateUploadTemplate = async (args: {\r\n key: string;\r\n template: SdExportTemplate;\r\n group?: string;\r\n }) => {\r\n const { key, template, group } = args;\r\n const { generateUploadTemplate } = API;\r\n const url = `${this.functionUrl}${generateUploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n removeFile = async (args: {\r\n key: string;\r\n group?: string;\r\n fileName?: string;\r\n }) => {\r\n const { key, group, fileName } = args;\r\n const { removeFile } = API;\r\n const url = `${this.functionUrl}${removeFile}?${this.#directory(key, group)}&name=${fileName}`;\r\n await this.apiService.post(url);\r\n }\r\n\r\n filesInFolder = async (args: {\r\n key: string;\r\n group?: string;\r\n }): Promise<SdExportFile[]> => {\r\n interface FilesInFolderRes {\r\n directory: string;\r\n files: {\r\n publicUrl: string, fullPath: string, name: string\r\n }[];\r\n }\r\n const { key, group } = args;\r\n const { filesInFolder } = API;\r\n const url = `${this.functionUrl}${filesInFolder}?${this.#directory(key, group)}`;\r\n const res = await this.apiService.get<FilesInFolderRes>(url);\r\n return res.files?.map(e => ({\r\n filePath: e.publicUrl,\r\n fileName: e.name\r\n })) || [];\r\n }\r\n\r\n download = (filePath: string, fileName?: string) => {\r\n const link: any = document.createElement('a');\r\n link.download = `${fileName || uuid.v4()}.xlsx`;\r\n link.href = filePath;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n exportByTemplate = async (args: {\r\n filePath: string,\r\n columns: any[],\r\n items: any[],\r\n fileName?: string\r\n }) => {\r\n const { filePath, columns, items, fileName } = args;\r\n const { sdExportByTemplate } = API;\r\n const url = `${this.functionUrl}${sdExportByTemplate}`;\r\n const buffer = await this.apiService.post(url, {\r\n filePath,\r\n columns,\r\n items,\r\n fileName\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, fileName);\r\n }\r\n\r\n\r\n exportCSV = async (option: IExportOption) => {\r\n const { columns, items, fileName } = option;\r\n const headerCSV = {};\r\n for (const column of columns) {\r\n headerCSV[column.field] = column.title;\r\n }\r\n const csvExporter = new ExportToCsv({\r\n filename: `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`,\r\n fieldSeparator: ',',\r\n quoteStrings: '\"',\r\n decimalSeparator: '.',\r\n showLabels: true,\r\n showTitle: false,\r\n title: fileName || 'CSV',\r\n useBom: true,\r\n });\r\n csvExporter.generateCsv([headerCSV, ...items]);\r\n }\r\n\r\n export = async (option: IExportOption) => {\r\n const { columns, items, fileName, sheets } = option;\r\n let hasDescription = false;\r\n for (const [idx, column] of columns.entries()) {\r\n if (!column.field) {\r\n throw new Error(`Column ${idx + 1}: Field is required`);\r\n }\r\n if (!column.title) {\r\n throw new Error(`Column ${idx + 1}: Title is required`);\r\n }\r\n if (column.description) {\r\n hasDescription = true;\r\n }\r\n }\r\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\r\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\r\n columns.forEach((column, index) => {\r\n let width = 120;\r\n if (column.width && column.width.endsWith('px')) {\r\n width = +column.width.replace('px', '');\r\n }\r\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\r\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle\r\n if (column.required) {\r\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\r\n } else {\r\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\r\n }\r\n firstSheet.getCell(1, index + 1).value = column.field;\r\n firstSheet.getCell(2, index + 1).value = column.title;\r\n if (hasDescription) {\r\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\r\n firstSheet.getCell(3, index + 1).value = column.description || '';\r\n }\r\n });\r\n if (sheets?.length) {\r\n for (const sheet of sheets) {\r\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.fields)) {\r\n const newSheet = workbook.addWorksheet(sheet.name);\r\n sheet.fields.forEach((field, index) => {\r\n newSheet.getColumn(index + 1).width = 30;\r\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\r\n newSheet.getCell(1, index + 1).value = field;\r\n });\r\n sheet.items.forEach((item, idx1) => {\r\n sheet.fields.forEach((field, idx2) => {\r\n newSheet.getCell(2 + idx1, 1 + idx2).value = item[field];\r\n newSheet.getCell(2 + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n }\r\n }\r\n }\r\n\r\n const fromRow = hasDescription ? 4 : 3;\r\n items.forEach((e, idx1) => {\r\n columns.forEach((column, idx2) => {\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\r\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = this.#cellStyle;\r\n });\r\n });\r\n const file = await workbook.xlsx.writeBuffer();\r\n this.#blobToSaveAs(new Blob([file], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }), fileName);\r\n }\r\n\r\n mergePDF = async (urls: string[]) => {\r\n const { sdMergePDF } = API;\r\n const url = `${this.functionUrl}${sdMergePDF}`;\r\n const buffer = await this.apiService.post(url, {\r\n urls\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/pdf' });\r\n this.#blobToSaveAs(blob, `${uuid.v4()}`);\r\n }\r\n\r\n loadExportedItems = async (items: (pageSize: number, pageNumber: number) => { total: number, }) => {\r\n\r\n }\r\n\r\n #blobToSaveAs = (blob: Blob, fileName: string = 'Export') => {\r\n try {\r\n const url = window.URL.createObjectURL(blob);\r\n const link = document.createElement('a');\r\n fileName = fileName.replace(/.xlsx/i, '');\r\n fileName = fileName.replace(/.pdf/i, '');\r\n if (link.download !== undefined) { // feature detection\r\n link.setAttribute('href', url);\r\n link.setAttribute('download', `${fileName}_${new Date().toFormat('yyyy_MM_dd_HH_mm')}`);\r\n link.style.visibility = 'hidden';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n } catch (e) {\r\n console.error('BlobToSaveAs error', e);\r\n }\r\n }\r\n}\r\n\r\nexport interface IExportInfo {\r\n data: any[];\r\n sheetName?: string;\r\n fileName?: string;\r\n}\r\n","/*\r\n * Public API Surface of superdev-angular-core\r\n */\r\n\r\nexport * from './lib/export.model';\r\nexport * from './lib/export.service';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["uuid.v4"],"mappings":";;;;;;;;;;;MAiEa,GAAG,GAAG;IACjB,gBAAgB,EAAE,yBAAyB;IAC3C,cAAc,EAAE,uBAAuB;IACvC,sBAAsB,EAAE,+BAA+B;IACvD,MAAM,EAAE,eAAe;IACvB,kBAAkB,EAAE,2BAA2B;IAC/C,aAAa,EAAE,sBAAsB;IACrC,UAAU,EAAE,eAAe;IAC3B,QAAQ,EA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AY,CAAC,UAAU,EAAE,GAAG,QAAQ,IAAI,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;oBACxF,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;oBACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBAChC,IAAI,CAAC,KAAK,EAAE,CAAC;oBACb,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;iBACjC;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC;aACxC;SACF,EAAA;KA9PA;IAlID,IAAY,WAAW;;QACrB,aAAO,IAAI,CAAC,qBAAqB,0CAAE,WAAW,CAAC;KAChD;IAED,IAAY,MAAM;QAChB,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC;QACpD,OAAO,GAAG,OAAO,IAAI,GAAG,EAAE,CAAC;KAC5B;IAED,IAAY,UAAU;QACpB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC;QAC9C,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QACD,IAAI,QAAQ,MAAM,CAAC,KAAK,QAAQ,EAAE;YAChC,OAAO,MAAM,CAAC;SACf;QACD,OAAO,MAAM,EAAE,CAAC;KACjB;;;;;YAtBF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;YAZQ,YAAY;YAOZ,gBAAgB;YADhB,eAAe;4CAyInB,MAAM,SAAC,eAAe,cAAG,QAAQ;;;ACjJtC;;;;ACAA;;;;;;"}
@@ -535,13 +535,6 @@ class SdPopupExport {
535
535
  isCSV: true
536
536
  });
537
537
  };
538
- this.exportRaw = () => {
539
- this.export.emit({
540
- file: null,
541
- columns: __classPrivateFieldGet(this, _getExportColumns).call(this),
542
- isRaw: true
543
- });
544
- };
545
538
  this.loadFiles = (group = null) => __awaiter(this, void 0, void 0, function* () {
546
539
  this.selectedGroup = this.groups.find(e => e.code === group);
547
540
  this.files = yield this.exportService.filesInFolder({
@@ -1633,9 +1626,9 @@ class SdGridMaterial {
1633
1626
  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); })) || [];
1634
1627
  });
1635
1628
  _onExport.set(this, (args) => __awaiter(this, void 0, void 0, function* () {
1636
- var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
1629
+ var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1637
1630
  try {
1638
- const { file, isCSV, isRaw } = args;
1631
+ const { file, isCSV } = args;
1639
1632
  let { columns } = args;
1640
1633
  const pageSize = ((_h = (_g = this.gridOption) === null || _g === void 0 ? void 0 : _g.export) === null || _h === void 0 ? void 0 : _h.maxItemsPerRequest) || 1000;
1641
1634
  const batch = ((_k = (_j = this.gridOption) === null || _j === void 0 ? void 0 : _j.export) === null || _k === void 0 ? void 0 : _k.batch) || 1;
@@ -1646,7 +1639,7 @@ class SdGridMaterial {
1646
1639
  const items = [];
1647
1640
  let promises = [];
1648
1641
  const handleData = () => __awaiter(this, void 0, void 0, function* () {
1649
- var _u;
1642
+ var _s;
1650
1643
  const results = yield Promise.all(promises);
1651
1644
  promises = [];
1652
1645
  exportItems = [];
@@ -1659,7 +1652,7 @@ class SdGridMaterial {
1659
1652
  exportItems = [...exportItems, ...result];
1660
1653
  }
1661
1654
  }
1662
- if ((_u = this.gridOption.export) === null || _u === void 0 ? void 0 : _u.mapping) {
1655
+ if ((_s = this.gridOption.export) === null || _s === void 0 ? void 0 : _s.mapping) {
1663
1656
  const results = this.gridOption.export.mapping(exportItems);
1664
1657
  if (results instanceof Promise) {
1665
1658
  exportItems = yield results;
@@ -1676,7 +1669,7 @@ class SdGridMaterial {
1676
1669
  for (const item of exportItems) {
1677
1670
  const obj = {};
1678
1671
  const handle = (exportColumn) => __awaiter(this, void 0, void 0, function* () {
1679
- var _v, _w;
1672
+ var _t, _u;
1680
1673
  obj[exportColumn.field] = item[exportColumn.field];
1681
1674
  const column = allColumns.find(e => e.field === exportColumn.field);
1682
1675
  const exportedColumn = allExportedColumns.find(e => e.field === exportColumn.field);
@@ -1715,10 +1708,10 @@ class SdGridMaterial {
1715
1708
  else if (column.type === 'bool') {
1716
1709
  // Nếu là bool thì gán bằng giá trị trueValue và falseValue (nếu có), mặc định là TRUE/FALSE
1717
1710
  if (item[column.field]) {
1718
- obj[column.field] = ((_v = column.option) === null || _v === void 0 ? void 0 : _v.displayOnTrue) || 'True';
1711
+ obj[column.field] = ((_t = column.option) === null || _t === void 0 ? void 0 : _t.displayOnTrue) || 'True';
1719
1712
  }
1720
1713
  else if (obj[column.field] !== undefined && obj[column.field] !== null) {
1721
- obj[column.field] = ((_w = column.option) === null || _w === void 0 ? void 0 : _w.displayOnFalse) || 'False';
1714
+ obj[column.field] = ((_u = column.option) === null || _u === void 0 ? void 0 : _u.displayOnFalse) || 'False';
1722
1715
  }
1723
1716
  }
1724
1717
  else if (column.type === 'date') {
@@ -1783,16 +1776,8 @@ class SdGridMaterial {
1783
1776
  });
1784
1777
  return;
1785
1778
  }
1786
- if (isRaw) {
1787
- yield this.exportService.exportExcelRaw({
1788
- columns,
1789
- items,
1790
- fileName: (_p = (_o = this.gridOption) === null || _o === void 0 ? void 0 : _o.export) === null || _p === void 0 ? void 0 : _p.fileName
1791
- });
1792
- return;
1793
- }
1794
1779
  const sheets = [];
1795
- if (Array.isArray((_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.sheets)) {
1780
+ if (Array.isArray((_p = (_o = this.gridOption) === null || _o === void 0 ? void 0 : _o.export) === null || _p === void 0 ? void 0 : _p.sheets)) {
1796
1781
  for (const sheet of this.gridOption.export.sheets) {
1797
1782
  if (sheet.name && sheet.items && sheet.fields) {
1798
1783
  if (Array.isArray(sheet.items)) {
@@ -1815,7 +1800,7 @@ class SdGridMaterial {
1815
1800
  yield this.exportService.export({
1816
1801
  columns,
1817
1802
  items,
1818
- fileName: (_t = (_s = this.gridOption) === null || _s === void 0 ? void 0 : _s.export) === null || _t === void 0 ? void 0 : _t.fileName,
1803
+ fileName: (_r = (_q = this.gridOption) === null || _q === void 0 ? void 0 : _q.export) === null || _r === void 0 ? void 0 : _r.fileName,
1819
1804
  sheets
1820
1805
  });
1821
1806
  return;
@@ -1834,16 +1819,6 @@ class SdGridMaterial {
1834
1819
  }
1835
1820
  }));
1836
1821
  this.onExport = (args) => __awaiter(this, void 0, void 0, function* () {
1837
- const { translate } = this.translateService;
1838
- if (!args.isCSV && this.gridOption.export.max && this.total > this.gridOption.export.max) {
1839
- args.isRaw = true;
1840
- __classPrivateFieldGet(this, _onExport).call(this, args);
1841
- // this.notifyService.confirm(translate(`Total rows reach limit, do you want to export CSV`)).then(() => {
1842
- // args.isCSV = true;
1843
- // this.#onExport(args);
1844
- // });
1845
- return;
1846
- }
1847
1822
  __classPrivateFieldGet(this, _onExport).call(this, args);
1848
1823
  });
1849
1824
  this.onFilterChange = () => {
@@ -1851,8 +1826,8 @@ class SdGridMaterial {
1851
1826
  this.reload(false);
1852
1827
  };
1853
1828
  this.onExpand = (rowData) => __awaiter(this, void 0, void 0, function* () {
1854
- var _x, _y, _z, _0, _1;
1855
- if ((_x = this.gridOption.subInformation) === null || _x === void 0 ? void 0 : _x.always) {
1829
+ var _v, _w, _x, _y, _z;
1830
+ if ((_v = this.gridOption.subInformation) === null || _v === void 0 ? void 0 : _v.always) {
1856
1831
  return;
1857
1832
  }
1858
1833
  if (rowData.isExpanding) {
@@ -1862,8 +1837,8 @@ class SdGridMaterial {
1862
1837
  rowData.isExpanded = false;
1863
1838
  return;
1864
1839
  }
1865
- const 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);
1866
- if (!((_1 = this.gridOption.subInformation) === null || _1 === void 0 ? void 0 : _1.multiple)) {
1840
+ const data = (_y = (_x = (_w = this.gridOption) === null || _w === void 0 ? void 0 : _w.subInformation) === null || _x === void 0 ? void 0 : _x.onExpand) === null || _y === void 0 ? void 0 : _y.call(_x, rowData);
1841
+ if (!((_z = this.gridOption.subInformation) === null || _z === void 0 ? void 0 : _z.multiple)) {
1867
1842
  this.items.forEach(item => item.isExpanding = item.isExpanded = false);
1868
1843
  }
1869
1844
  if (data instanceof Promise) {
@@ -2072,7 +2047,7 @@ class SdGridMaterial {
2072
2047
  this.ref.detectChanges();
2073
2048
  };
2074
2049
  this.onRemove = (item) => __awaiter(this, void 0, void 0, function* () {
2075
- var _2, _3;
2050
+ var _0, _1;
2076
2051
  const { editor } = this.gridOption;
2077
2052
  if (editor === null || editor === void 0 ? void 0 : editor.beforeRemove) {
2078
2053
  const beforeRemove = editor === null || editor === void 0 ? void 0 : editor.beforeRemove(item);
@@ -2098,10 +2073,10 @@ class SdGridMaterial {
2098
2073
  this.items.splice(idx1, 1);
2099
2074
  this.items = [...this.items];
2100
2075
  if (this.gridOption.type === 'local') {
2101
- (_2 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _2 === void 0 ? void 0 : _2.call(editor, item, __classPrivateFieldGet(this, _localItems));
2076
+ (_0 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _0 === void 0 ? void 0 : _0.call(editor, item, __classPrivateFieldGet(this, _localItems));
2102
2077
  }
2103
2078
  else {
2104
- (_3 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _3 === void 0 ? void 0 : _3.call(editor, item, this.items);
2079
+ (_1 = editor === null || editor === void 0 ? void 0 : editor.onRemove) === null || _1 === void 0 ? void 0 : _1.call(editor, item, this.items);
2105
2080
  }
2106
2081
  this.ref.detectChanges();
2107
2082
  return;
@@ -2262,7 +2237,7 @@ _localItems = new WeakMap(), _paginator = new WeakMap(), _sort = new WeakMap(),
2262
2237
  SdGridMaterial.decorators = [
2263
2238
  { type: Component, args: [{
2264
2239
  selector: 'sd-grid-material',
2265
- 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\" [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\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=\"\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\"\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>",
2240
+ 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\" [filter]=\"gridOption?.filter\"\r\n [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\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=\"\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.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>",
2266
2241
  animations: [
2267
2242
  trigger('detailExpand', [
2268
2243
  state('collapsed', style({ height: '0', minHeight: '0', visibility: 'hidden' })),