@sdcorejs/angular 19.0.10 → 19.1.0
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/README.md +32 -23
- package/assets/STYLE-GUIDE.md +58 -72
- package/assets/scss/core/_inline-edit.scss +1 -1
- package/assets/scss/core/color.scss +56 -45
- package/assets/scss/core/form.scss +21 -9
- package/assets/scss/core/utilities/_base.scss +3 -3
- package/assets/scss/core/utilities/_border.scss +1 -1
- package/assets/scss/themes/default.scss +46 -32
- package/assets/scss/themes/material-theme.scss +8 -87
- package/components/badge/src/badge.component.d.ts +5 -16
- package/components/button/src/button.component.d.ts +6 -4
- package/components/form-generic/src/components/form-builder/components/group/attribute/group-attribute.component.d.ts +1 -0
- package/components/form-generic/src/components/form-builder/form-builder.component.d.ts +9 -1
- package/components/inform/src/inform.component.d.ts +2 -8
- package/components/modal/src/modal.component.d.ts +1 -1
- package/components/modal-resizable/src/modal-resizable.component.d.ts +1 -1
- package/components/query-bar/src/query-bar.component.d.ts +1 -0
- package/components/query-builder/src/query-builder.component.d.ts +6 -6
- package/components/query-builder/src/query-builder.model.d.ts +3 -3
- package/components/section/src/section.component.d.ts +1 -5
- package/components/side-drawer/src/side-drawer.component.d.ts +1 -1
- package/components/table/src/components/command/desktop-command.component.d.ts +0 -1
- package/components/table/src/models/table-command.model.d.ts +3 -3
- package/components/table/src/models/table-option-selector.model.d.ts +5 -5
- package/components/table/src/services/table-filter/table-filter.model.d.ts +0 -2
- package/components/tree/src/tree.model.d.ts +3 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +5 -6
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +10 -11
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +15 -13
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +10 -11
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +4 -5
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-document-builder.mjs +3 -3
- package/fesm2022/sdcorejs-angular-components-document-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +4 -5
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +117 -46
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +5 -7
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +5 -15
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +5 -6
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +25 -7
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +4 -5
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +7 -8
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +27 -28
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +7 -12
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +3 -4
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +3 -4
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +5 -6
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +3 -4
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +28 -32
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +6 -8
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +8 -9
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +5 -7
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +7 -9
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +5 -7
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +7 -9
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +6 -8
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +465 -343
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +4 -5
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +5 -7
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +5 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +4 -5
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -4
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-select.mjs +6 -8
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +5 -7
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +523 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +29 -29
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +85 -5
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +22 -14
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-models.mjs +3 -2
- package/fesm2022/sdcorejs-angular-utilities-models.mjs.map +1 -1
- package/forms/datetime/src/datetime.component.d.ts +4 -4
- package/forms/datetime/src/material-datetime/index.d.ts +14 -0
- package/forms/datetime/src/material-datetime/lib/core/date-adapter.d.ts +10 -0
- package/forms/datetime/src/material-datetime/lib/core/date-formats.d.ts +18 -0
- package/forms/datetime/src/material-datetime/lib/core/default-options.d.ts +13 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-actions.component.d.ts +5 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-apply.directive.d.ts +7 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-cancel.directive.d.ts +7 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-input.directive.d.ts +24 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-now.directive.d.ts +7 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-toggle.directive.d.ts +8 -0
- package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker.component.d.ts +39 -0
- package/forms/datetime/src/material-datetime/lib/native/native-date-adapter.d.ts +15 -0
- package/forms/datetime/src/material-datetime/lib/native/native-date-formats.d.ts +2 -0
- package/forms/datetime/src/material-datetime/lib/native/provide-native.d.ts +3 -0
- package/forms/datetime/src/material-datetime/lib/time-spinner/time-spinner.component.d.ts +31 -0
- package/modules/icon/index.d.ts +1 -0
- package/modules/icon/src/icon.component.d.ts +101 -0
- package/modules/icon/src/icon.model.d.ts +59 -0
- package/modules/icon/src/icon.provider.d.ts +33 -0
- package/modules/icon/src/index.d.ts +3 -0
- package/modules/index.d.ts +1 -0
- package/package.json +10 -5
- package/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +17 -0
- package/services/confirm/src/lib/confirm.service.d.ts +32 -1
- package/services/excel/src/lib/spreadsheet-formula-injection.util.d.ts +5 -0
- package/utilities/models/src/icon.model.d.ts +4 -2
- package/forms/datetime/src/popup/sd-datetime-picker.component.d.ts +0 -37
- package/forms/datetime/src/popup/sd-time-spinner.component.d.ts +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/angular/utilities/extensions';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = column.field;\n cellTitle.value = column.title;\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = column.description || '';\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = header.value;\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = header.display || header.value;\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = column.field;\n firstSheet.getCell(2, index + 1).value = column.title;\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = column.description || '';\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = header.value;\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = header.display || header.value;\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = item[header.value];\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n if (typeof e[column.field] === 'number') {\n // Format mặc định với kiểu số\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\n } else {\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = e[column.field];\n }\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\n ...this.#cellStyle,\n };\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAWa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE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K,CAAC;AACvC,YAAA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGA7aU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-services-excel.mjs","sources":["../../../projects/sdcorejs-angular/services/excel/src/lib/spreadsheet-formula-injection.util.ts","../../../projects/sdcorejs-angular/services/excel/src/lib/excel.service.ts","../../../projects/sdcorejs-angular/services/excel/sdcorejs-angular-services-excel.ts"],"sourcesContent":["const DANGEROUS_SPREADSHEET_FORMULA_PREFIX = /^[=+\\-@\\t\\r\\n]/;\n\n/**\n * Prefix spreadsheet formula-like strings so exported files treat them as text.\n */\nexport function neutralizeSpreadsheetFormula(value: string): string;\nexport function neutralizeSpreadsheetFormula<T>(value: T): T;\nexport function neutralizeSpreadsheetFormula(value: unknown): unknown {\n if (typeof value !== 'string' || value === '' || value.startsWith(\"'\")) {\n return value;\n }\n\n return DANGEROUS_SPREADSHEET_FORMULA_PREFIX.test(value) ? `'${value}` : value;\n}\n","import { inject, Injectable } from '@angular/core';\nimport type { CellValue, Style } from 'exceljs';\n// import hash from 'object-hash';\nimport { DateUtilities } from '@sdcorejs/angular/utilities/extensions';\nimport { BrowserUtilities } from '@sdcorejs/utils/fns';\nimport { I18nService } from '@sdcorejs/angular/i18n';\nimport { SdExcelExportOption, SdExcelTemplate } from './excel.model';\nimport { neutralizeSpreadsheetFormula } from './spreadsheet-formula-injection.util';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdExcelService {\n readonly #i18n = inject(I18nService);\n #fieldStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FAFAFA',\n },\n },\n };\n #titleColor = 'FFFFFF';\n #titleFgColor = '143180';\n #titleStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n bold: true,\n size: 11,\n color: { argb: this.#titleColor },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: this.#titleFgColor,\n },\n },\n };\n\n #requiredStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n vertical: 'middle',\n horizontal: 'center',\n wrapText: true,\n },\n font: {\n italic: true,\n size: 11,\n color: { argb: 'FFFFFF' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'FF1744',\n },\n },\n };\n\n #descriptionStyle: Partial<Style> = {\n border: {\n bottom: { style: 'thin' },\n left: { style: 'thin' },\n right: { style: 'thin' },\n },\n alignment: {\n wrapText: true,\n },\n font: {\n italic: true,\n size: 9,\n color: { argb: '000000' },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: 'CFD8DC',\n },\n },\n };\n\n #cellStyle: Partial<Style> = {\n alignment: {\n vertical: 'middle',\n wrapText: true,\n },\n };\n\n constructor() {}\n\n // exceljs là CJS module — khi dynamic import từ ESM, named export `Workbook`\n // có thể nằm trên `mod.Workbook` hoặc bị bọc trong `mod.default.Workbook` tuỳ bundler.\n // Helper này chuẩn hoá cả hai trường hợp.\n async #loadWorkbook(): Promise<new () => import('exceljs').Workbook> {\n const mod: any = await import('exceljs');\n return mod.Workbook ?? mod.default?.Workbook;\n }\n\n generateTemplate = async (template: SdExcelTemplate) => {\n const { fileName, columns, sheets } = template;\n if (!Array.isArray(columns)) {\n throw new Error('Excel template columns must be an array');\n }\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n }\n const hasDescription = columns.some(column => column.description);\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook();\n const firstSheet = workbook.addWorksheet('template'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n const { required, fill, fontColor } = column;\n const cellField = firstSheet.getCell(1, index + 1);\n const cellTitle = firstSheet.getCell(2, index + 1);\n const cellDescription = firstSheet.getCell(3, index + 1);\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n cellField.style = this.#fieldStyle;\n if (required) {\n cellField.style = this.#requiredStyle;\n } else {\n cellField.style = this.#fieldStyle;\n }\n cellTitle.style = {\n ...this.#titleStyle,\n font: {\n ...this.#titleStyle?.font,\n color: {\n ...this.#titleStyle?.font?.color,\n argb: fontColor || this.#titleStyle?.font?.color?.argb,\n },\n },\n fill: {\n type: 'pattern',\n pattern: 'solid',\n fgColor: {\n argb: fill || this.#titleFgColor,\n },\n },\n };\n cellField.value = neutralizeSpreadsheetFormula(column.field);\n cellTitle.value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n cellDescription.style = this.#descriptionStyle;\n cellDescription.value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n exportCSV = async (option: SdExcelExportOption): Promise<void> => {\n const { columns, items, fileName } = option;\n const filename = `${fileName || 'CSV'}_${DateUtilities.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.csv`;\n\n // Escape CSV cell: bọc trong dấu \" nếu chứa dấu phẩy / xuống dòng / dấu ngoặc kép.\n // Dấu \" bên trong được nhân đôi theo chuẩn RFC 4180.\n const escape = (v: unknown): string => {\n if (v == null) return '';\n const s = typeof v === 'string' ? neutralizeSpreadsheetFormula(v) : String(v);\n return /[\",\\n\\r]/.test(s) ? `\"${s.replace(/\"/g, '\"\"')}\"` : s;\n };\n\n const headerLine = columns.map(c => escape(c.title)).join(',');\n const dataLines = items.map(item => columns.map(c => escape((item as Record<string, unknown>)[c.field])).join(','));\n\n // Prepend UTF-8 BOM so Excel opens Vietnamese text with the correct encoding.\n // Dùng CRLF vì Excel trên Windows ưu tiên, macOS Excel cũng chấp nhận.\n const csv = '\\uFEFF' + [headerLine, ...dataLines].join('\\r\\n');\n\n BrowserUtilities.downloadBlob(new Blob([csv], { type: 'text/csv;charset=utf-8;' }), filename);\n };\n\n export = async (option: SdExcelExportOption) => {\n const { columns, items, fileName, sheets } = option;\n let hasDescription = false;\n for (const [idx, column] of columns.entries()) {\n if (!column.field) {\n throw new Error(`Column ${idx + 1}: Field is required`);\n }\n if (!column.title) {\n throw new Error(`Column ${idx + 1}: Title is required`);\n }\n if (column.description) {\n hasDescription = true;\n }\n }\n const Workbook = await this.#loadWorkbook();\n const workbook = new Workbook(); //await XlsxPopulate.fromBlankAsync(); // Đọc file sau khi đã download\n const firstSheet = workbook.addWorksheet('data'); // Lấy ra sheet đầu tiên\n columns.forEach((column, index) => {\n let width = 120;\n if (column.width && column.width.endsWith('px')) {\n width = +column.width.replace('px', '');\n }\n firstSheet.getColumn(index + 1).width = width / 7 || 20;\n firstSheet.getCell(1, index + 1).style = this.#fieldStyle;\n if (column.required) {\n firstSheet.getCell(2, index + 1).style = this.#requiredStyle;\n } else {\n firstSheet.getCell(2, index + 1).style = this.#titleStyle;\n }\n firstSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(column.field);\n firstSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(column.title);\n if (hasDescription) {\n firstSheet.getCell(3, index + 1).style = this.#descriptionStyle;\n firstSheet.getCell(3, index + 1).value = neutralizeSpreadsheetFormula(column.description || '');\n }\n });\n if (sheets?.length) {\n for (const sheet of sheets) {\n if (sheet.name && Array.isArray(sheet.items) && Array.isArray(sheet.headers)) {\n const newSheet = workbook.addWorksheet(sheet.name);\n sheet.headers.forEach((header, index) => {\n newSheet.getColumn(index + 1).width = 30;\n newSheet.getCell(1, index + 1).style = this.#titleStyle;\n newSheet.getCell(1, index + 1).value = neutralizeSpreadsheetFormula(header.value);\n newSheet.getCell(2, index + 1).style = this.#titleStyle;\n newSheet.getCell(2, index + 1).value = neutralizeSpreadsheetFormula(header.display || header.value);\n });\n sheet.items.forEach((item, idx1) => {\n sheet.headers.forEach((header, idx2) => {\n newSheet.getCell(3 + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(item[header.value]) as CellValue;\n newSheet.getCell(3 + idx1, 1 + idx2).style = this.#cellStyle;\n });\n });\n }\n }\n }\n\n const fromRow = hasDescription ? 4 : 3;\n items.forEach((e, idx1) => {\n columns.forEach((column, idx2) => {\n if (typeof e[column.field] === 'number') {\n // Format mặc định với kiểu số\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = +e[column.field];\n firstSheet.getCell(fromRow + idx1, 1 + idx2).numFmt = '#';\n } else {\n firstSheet.getCell(fromRow + idx1, 1 + idx2).value = neutralizeSpreadsheetFormula(e[column.field]) as CellValue;\n }\n firstSheet.getCell(fromRow + idx1, 1 + idx2).style = {\n ...this.#cellStyle,\n };\n });\n });\n const file = await workbook.xlsx.writeBuffer();\n BrowserUtilities.downloadBlob(\n new Blob([file], {\n type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n }),\n fileName\n );\n };\n\n // Helper để lấy giá trị text chuẩn từ ô Excel (xử lý RichText, Formula, Hyperlink)\n #getCellValue = (value: CellValue): string | number | null | undefined | boolean | Date => {\n if (value && typeof value === 'object') {\n // Xử lý Rich Text (vd: ô bôi đậm)\n if ('richText' in value) {\n return value.richText.map(t => t.text).join('');\n }\n // Xử lý Hyperlink\n if ('text' in value) {\n return value.text as string; // hoặc value.result nếu là công thức\n }\n // Xử lý Formula\n if ('result' in value) {\n return value.result as any;\n }\n }\n return value as any;\n };\n upload = async (): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n try {\n const fileResult = await BrowserUtilities.upload({\n extensions: ['xlsx'],\n maxSizeInMb: 10,\n });\n\n // Chuẩn hóa file đầu vào (nếu upload trả về mảng thì lấy phần tử đầu)\n const file = Array.isArray(fileResult) ? fileResult[0] : fileResult;\n\n if (!file) {\n return { items: [], file: null };\n }\n\n return await this.parse(file);\n } catch (error) {\n console.error('Upload error:', error);\n throw error; // Hoặc return { items: [], file: null } tùy logic nghiệp vụ\n }\n };\n parse = async (file: File): Promise<{ items: Record<string, any>[]; file: File | null }> => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = async e => {\n try {\n const buffer = e.target?.result as ArrayBuffer;\n if (!buffer) {\n throw new Error(this.#i18n.t('core.excel.cannot-read-file'));\n }\n\n const Workbook = await this.#loadWorkbook();\n const wb = new Workbook();\n await wb.xlsx.load(buffer);\n\n const sheet = wb.worksheets[0];\n if (!sheet) {\n throw new Error(this.#i18n.t('core.excel.no-sheet'));\n }\n\n const items: Record<string, any>[] = [];\n\n // Lấy row Header (Row 1)\n const headerRow = sheet.getRow(1);\n // Map: Column Index (bắt đầu từ 1) -> Tên trường (Key)\n const headerMap: Record<number, string> = {};\n\n // Duyệt qua các ô có dữ liệu thực tế của dòng Header\n headerRow.eachCell((cell, colNumber) => {\n const cellValue = this.#getCellValue(cell.value);\n if (cellValue) {\n // Ép kiểu về string và trim để làm key\n headerMap[colNumber] = String(cellValue).trim();\n }\n });\n\n // Duyệt dữ liệu từ dòng 2 trở đi\n sheet.eachRow((row, rowIndex) => {\n if (rowIndex <= 1 || !row.hasValues) return;\n\n const item: Record<string, any> = {};\n\n // Chỉ duyệt qua các cột đã định nghĩa trong headerMap\n // Cách này an toàn hơn là duyệt mảng values\n Object.keys(headerMap).forEach(colKey => {\n const colNumber = Number(colKey);\n const fieldKey = headerMap[colNumber];\n\n // Lấy giá trị ô tại cột tương ứng\n const rawValue = this.#getCellValue(row.getCell(colNumber).value);\n\n let finalValue = rawValue;\n\n // Xử lý string: trim\n if (typeof finalValue === 'string') {\n finalValue = finalValue.trim();\n }\n\n // Xử lý các keyword đặc biệt\n if (finalValue === '' || finalValue === undefined) {\n finalValue = null;\n } else if (finalValue === 'SET_NULL') {\n finalValue = null;\n } else if (finalValue === 'SET_EMPTY') {\n finalValue = '';\n }\n\n item[fieldKey] = finalValue;\n });\n\n // Chỉ push nếu item có dữ liệu (tùy chọn)\n if (Object.keys(item).length > 0) {\n items.push(item);\n }\n });\n\n resolve({ items, file });\n } catch (err) {\n reject(err);\n }\n };\n\n reader.onerror = error => reject(error);\n reader.readAsArrayBuffer(file);\n });\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA,MAAM,oCAAoC,GAAG,gBAAgB;AAOvD,SAAU,4BAA4B,CAAC,KAAc,EAAA;AACzD,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACtE,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,OAAO,oCAAoC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,GAAG,KAAK;AAC/E;;MCDa,cAAc,CAAA;AAChB,IAAA,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;AACpC,IAAA,WAAW,GAAmB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,YAAA,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;AACzB,SAAA;AACD,QAAA,SAAS,EAAE;AACT,YAAA,QAAQ,EAAE,QAAQ;AAClB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;AAC1B,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,OAAO,EAAE,OAAO;AAChB,YAAA,OAAO,EAAE;AACP,gBAAA,IAAI,EAAE,QAAQ;AACf,aAAA;AAC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KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;wBAClB;AACF,oBAAA,CAAC,CAAC;AAEF,oBAAA,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;gBAC1B;gBAAE,OAAO,GAAG,EAAE;oBACZ,MAAM,CAAC,GAAG,CAAC;gBACb;AACF,YAAA,CAAC;YAED,MAAM,CAAC,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;AACvC,YAAA,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC;AAChC,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;wGA7aU,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAd,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;4FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -49,7 +49,7 @@ class SdLoadingService {
|
|
|
49
49
|
width: '5rem',
|
|
50
50
|
height: '5rem',
|
|
51
51
|
border: '0.5rem solid var(--sd-primary)',
|
|
52
|
-
'border-top': '0.5rem solid var(--sd-
|
|
52
|
+
'border-top': '0.5rem solid var(--sd-border)',
|
|
53
53
|
'border-radius': '50%',
|
|
54
54
|
animation: 'spin 1s linear infinite',
|
|
55
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-services-loading.mjs","sources":["../../../projects/sdcorejs-angular/services/loading/src/loading.service.ts","../../../projects/sdcorejs-angular/services/loading/sdcorejs-angular-services-loading.ts"],"sourcesContent":["import { Injectable, Renderer2, RendererFactory2 } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdLoadingService {\n private loadingId = 'L8d556b9b-f6dd-46e9-9710-757e65d82839';\n\n private renderer: Renderer2;\n\n private loadingMap = new WeakMap<Element, HTMLElement>();\n constructor(rendererFactory: RendererFactory2) {\n this.renderer = rendererFactory.createRenderer(null, null);\n }\n\n start = (element = 'body') => {\n const ele = document.querySelector(element);\n if (ele && !this.loadingMap.has(ele)) {\n const loadingElement = this.#createLoading();\n ele.appendChild(loadingElement);\n this.loadingMap.set(ele, loadingElement);\n }\n };\n\n isLoading = (element = 'body') => {\n const ele = document.querySelector(element);\n return ele && this.loadingMap.has(ele);\n };\n\n stop = (element = 'body') => {\n const ele = document.querySelector(element);\n if (ele && this.loadingMap.has(ele)) {\n const loadingElement = this.loadingMap.get(ele);\n loadingElement?.remove();\n this.loadingMap.delete(ele);\n }\n };\n\n #createLoading = (): HTMLElement => {\n const renderer = this.renderer;\n const container: HTMLElement = this.renderer.createElement('div');\n const spinner: HTMLElement = this.renderer.createElement('div');\n const containerStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n height: '100%',\n width: '100%',\n opacity: 0.6,\n background: '#FFFFFF',\n 'z-index': 99999,\n };\n const spinnerStyle = {\n position: 'absolute',\n top: 'calc(50% - 2.5rem)',\n left: 'calc(50% - 2.5rem)',\n width: '5rem',\n height: '5rem',\n border: '0.5rem solid var(--sd-primary)',\n 'border-top': '0.5rem solid var(--sd-
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-services-loading.mjs","sources":["../../../projects/sdcorejs-angular/services/loading/src/loading.service.ts","../../../projects/sdcorejs-angular/services/loading/sdcorejs-angular-services-loading.ts"],"sourcesContent":["import { Injectable, Renderer2, RendererFactory2 } from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SdLoadingService {\n private loadingId = 'L8d556b9b-f6dd-46e9-9710-757e65d82839';\n\n private renderer: Renderer2;\n\n private loadingMap = new WeakMap<Element, HTMLElement>();\n constructor(rendererFactory: RendererFactory2) {\n this.renderer = rendererFactory.createRenderer(null, null);\n }\n\n start = (element = 'body') => {\n const ele = document.querySelector(element);\n if (ele && !this.loadingMap.has(ele)) {\n const loadingElement = this.#createLoading();\n ele.appendChild(loadingElement);\n this.loadingMap.set(ele, loadingElement);\n }\n };\n\n isLoading = (element = 'body') => {\n const ele = document.querySelector(element);\n return ele && this.loadingMap.has(ele);\n };\n\n stop = (element = 'body') => {\n const ele = document.querySelector(element);\n if (ele && this.loadingMap.has(ele)) {\n const loadingElement = this.loadingMap.get(ele);\n loadingElement?.remove();\n this.loadingMap.delete(ele);\n }\n };\n\n #createLoading = (): HTMLElement => {\n const renderer = this.renderer;\n const container: HTMLElement = this.renderer.createElement('div');\n const spinner: HTMLElement = this.renderer.createElement('div');\n const containerStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n height: '100%',\n width: '100%',\n opacity: 0.6,\n background: '#FFFFFF',\n 'z-index': 99999,\n };\n const spinnerStyle = {\n position: 'absolute',\n top: 'calc(50% - 2.5rem)',\n left: 'calc(50% - 2.5rem)',\n width: '5rem',\n height: '5rem',\n border: '0.5rem solid var(--sd-primary)',\n 'border-top': '0.5rem solid var(--sd-border)',\n 'border-radius': '50%',\n animation: 'spin 1s linear infinite',\n };\n const keyframes = `\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n `;\n\n renderer.addClass(container, 'sd-loading');\n renderer.setAttribute(container, 'id', this.loadingId);\n\n Object.entries(containerStyle).forEach(entry => {\n renderer.setStyle(container, entry[0], entry[1]);\n });\n\n renderer.addClass(spinner, 'sd-loading-spinner');\n Object.entries(spinnerStyle).forEach(entry => {\n renderer.setStyle(spinner, entry[0], entry[1]);\n });\n\n const styleElement = this.renderer.createElement('style');\n this.renderer.appendChild(styleElement, this.renderer.createText(keyframes));\n document.head.appendChild(styleElement);\n\n container.appendChild(spinner);\n return container;\n };\n}\n","/**\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orejs/utils/models';
|
|
5
5
|
export { normalizeAsync, resolveMaybeAsync } from '@sdcorejs/utils/models';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const DefaultSdIconSet = 'material-icons-outlined';
|
|
8
|
+
const DefaultSdMaterialIconSet = 'material-icons-outlined';
|
|
8
9
|
|
|
9
10
|
// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).
|
|
10
11
|
/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */
|
|
@@ -66,5 +67,5 @@ const SdOperators = [
|
|
|
66
67
|
* Generated bundle index. Do not edit.
|
|
67
68
|
*/
|
|
68
69
|
|
|
69
|
-
export {
|
|
70
|
+
export { DefaultSdIconSet, DefaultSdMaterialIconSet, SD_EMPTY_STR, SdNormalizeAsync, SdOperators, SdPatternCommons, SdResolveMaybeAsync };
|
|
70
71
|
//# sourceMappingURL=sdcorejs-angular-utilities-models.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdcorejs-angular-utilities-models.mjs","sources":["../../../projects/sdcorejs-angular/utilities/models/src/icon.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/pattern.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/empty.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/operator.model.ts","../../../projects/sdcorejs-angular/utilities/models/sdcorejs-angular-utilities-models.ts"],"sourcesContent":["export type
|
|
1
|
+
{"version":3,"file":"sdcorejs-angular-utilities-models.mjs","sources":["../../../projects/sdcorejs-angular/utilities/models/src/icon.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/pattern.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/empty.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/maybe-async.model.ts","../../../projects/sdcorejs-angular/utilities/models/src/operator.model.ts","../../../projects/sdcorejs-angular/utilities/models/sdcorejs-angular-utilities-models.ts"],"sourcesContent":["export type SdIconSet = 'material-icons' | 'material-icons-outlined' | 'material-icons-round' | 'material-icons-sharp' | 'lucide';\nexport type SdMaterialIconSet = Exclude<SdIconSet, 'lucide'>;\nexport const DefaultSdIconSet: SdIconSet = 'material-icons-outlined';\nexport const DefaultSdMaterialIconSet: SdMaterialIconSet = 'material-icons-outlined';\n","import type { ValidationPatternType, ValidationPattern } from '@sdcorejs/utils/models';\nimport { VALIDATION_PATTERNS } from '@sdcorejs/utils/constants';\nimport { StringUtilities } from '@sdcorejs/utils/fns';\nexport type { ValidationPatternType, ValidationPattern };\nexport { VALIDATION_PATTERNS };\n\n/**\n * @deprecated Use {@link ValidationPatternType} from `@sdcorejs/utils/models` instead.\n * Note: member names changed — PHONE_VN → VN_PHONE, IDVN → VN_ID, IDVN_OR_PASSPORT → VN_ID_OR_PASSPORT.\n */\nexport type SdPatternType = 'EMAIL' | 'PHONE' | 'PHONE_VN' | 'IDVN' | 'PASSPORT' | 'IDVN_OR_PASSPORT' | 'TIME';\n\n/**\n * @deprecated Use {@link ValidationPattern} from `@sdcorejs/utils/models` instead.\n * Note: `regex` field renamed to `pattern` to align with Angular `Validators.pattern()`.\n */\nexport interface SdPatternCommon {\n type: SdPatternType;\n name: string;\n regex: string;\n errorMessage: string;\n}\n\n// `name` và `errorMessage` chứa i18n KEY (không phải chuỗi đã dịch).\n/** @deprecated Use `VALIDATION_PATTERNS` from `@sdcorejs/utils/constants` instead. */\nexport const SdPatternCommons: SdPatternCommon[] = [\n { type: 'EMAIL', name: 'core.validator.email.name', regex: StringUtilities.REGEX_EMAIL, errorMessage: 'core.validator.email.error' },\n { type: 'PHONE', name: 'core.validator.phone.name', regex: StringUtilities.REGEX_PHONE, errorMessage: 'core.validator.phone.error' },\n {\n type: 'PHONE_VN',\n name: 'core.validator.phone-vn.name',\n regex: StringUtilities.REGEX_VN_PHONE,\n errorMessage: 'core.validator.phone-vn.error',\n },\n { type: 'IDVN', name: 'core.validator.cccd.name', regex: StringUtilities.REGEX_VN_ID, errorMessage: 'core.validator.cccd.error' },\n {\n type: 'PASSPORT',\n name: 'core.validator.passport.name',\n regex: StringUtilities.REGEX_PASSPORT,\n errorMessage: 'core.validator.passport.error',\n },\n {\n type: 'IDVN_OR_PASSPORT',\n name: 'core.validator.id-vn.name',\n regex: StringUtilities.REGEX_VN_ID_OR_PASSPORT,\n errorMessage: 'core.validator.id-vn.error',\n },\n { type: 'TIME', name: 'core.validator.time.name', regex: StringUtilities.REGEX_TIME, errorMessage: 'core.validator.time.error' },\n];\n","import { EMPTY_STR } from '@sdcorejs/utils/constants';\nexport { EMPTY_STR };\n\n/** @deprecated Use {@link EMPTY_STR} from `@sdcorejs/utils/constants` instead */\nexport const SD_EMPTY_STR = EMPTY_STR;\n","import type { MaybeAsync } from '@sdcorejs/utils/models';\nimport { resolveMaybeAsync, normalizeAsync } from '@sdcorejs/utils/models';\nexport type { MaybeAsync };\nexport { resolveMaybeAsync, normalizeAsync };\n\n/** @deprecated Use {@link MaybeAsync} from `@sdcorejs/utils/models` instead */\nexport type SdMaybeAsync<T> = MaybeAsync<T>;\n/** @deprecated Use {@link resolveMaybeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdResolveMaybeAsync = resolveMaybeAsync;\n/** @deprecated Use {@link normalizeAsync} from `@sdcorejs/utils/models` instead */\nexport const SdNormalizeAsync = normalizeAsync;\n","import type { Operator, OperatorHasData, OperatorNoData } from '@sdcorejs/utils/models';\nexport type { Operator, OperatorHasData, OperatorNoData };\n\n/** @deprecated Use {@link Operator} from `@sdcorejs/utils/models` instead */\nexport type SdOperator = Operator;\n/** @deprecated Use {@link OperatorHasData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorHasData = OperatorHasData;\n/** @deprecated Use {@link OperatorNoData} from `@sdcorejs/utils/models` instead */\nexport type SdOperatorNoData = OperatorNoData;\n\n// `display` chứa i18n KEY (không phải chuỗi đã dịch).\n// Consumer phải gọi i18n.t(display) trước khi render ra UI.\n// @deprecated Use `OPERATORS` from `@sdcorejs/utils/constants` instead.\n// Note: OPERATORS has translated display labels; SdOperators uses i18n keys.\nexport const SdOperators: {\n value: Operator;\n symbol?: string;\n display: string;\n}[] = [\n { value: 'EQUAL', symbol: '=', display: 'core.operator.equal.display' },\n { value: 'NOT_EQUAL', symbol: '≠', display: 'core.operator.not-equal.display' },\n { value: 'GREATER_THAN', symbol: '>', display: 'core.operator.greater-than.display' },\n { value: 'LESS_THAN', symbol: '<', display: 'core.operator.less-than.display' },\n { value: 'GREATER_OR_EQUAL', symbol: '≥', display: 'core.operator.greater-or-equal.display' },\n { value: 'LESS_OR_EQUAL', symbol: '≤', display: 'core.operator.less-or-equal.display' },\n { value: 'CONTAIN', symbol: 'join_inner', display: 'core.operator.contain.display' },\n { value: 'NOT_CONTAIN', symbol: 'join', display: 'core.operator.not-contain.display' },\n { value: 'START_WITH', symbol: 'line_start_circle', display: 'core.operator.start-with.display' },\n { value: 'END_WITH', symbol: 'line_end_circle', display: 'core.operator.end-with.display' },\n { value: 'IN', symbol: 'checklist_rtl', display: 'core.operator.in.display' },\n { value: 'NOT_IN', symbol: 'event_list', display: 'core.operator.not-in.display' },\n { value: 'NULL', symbol: 'motion_photos_off', display: 'core.operator.null.display' },\n { value: 'NOT_NULL', symbol: 'adjust', display: 'core.operator.not-null.display' },\n];\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAEO,MAAM,gBAAgB,GAAc;AACpC,MAAM,wBAAwB,GAAsB;;ACoB3D;AACA;AACO,MAAM,gBAAgB,GAAsB;AACjD,IAAA,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,eAAe,CAAC,WAAW,EAAE,YAAY,EAAE,4BAA4B,EAAE;AACpI,IAAA,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,eAAe,CAAC,WAAW,EAAE,YAAY,EAAE,4BAA4B,EAAE;A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AE,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,wCAAwC,EAAE;IAC7F,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,qCAAqC,EAAE;IACvF,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,+BAA+B,EAAE;IACpF,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mCAAmC,EAAE;IACtF,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,kCAAkC,EAAE;IACjG,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,gCAAgC,EAAE;IAC3F,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAE;IAC7E,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,8BAA8B,EAAE;IAClF,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,4BAA4B,EAAE;IACrF,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,gCAAgC,EAAE;;;AChCpF;;AAEG;;;;"}
|
|
@@ -9,13 +9,12 @@ export declare class SdDatetime implements OnDestroy, OnInit {
|
|
|
9
9
|
#private;
|
|
10
10
|
id: string;
|
|
11
11
|
inputRef: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
12
|
+
private readonly dateTimePicker;
|
|
12
13
|
sdLabelTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
13
14
|
sdValueTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
14
15
|
sdViewDef: import("@angular/core").Signal<SdViewDefDirective<any, any> | undefined>;
|
|
15
16
|
private ref;
|
|
16
|
-
private overlay;
|
|
17
17
|
private elementRef;
|
|
18
|
-
private injector;
|
|
19
18
|
private formConfig;
|
|
20
19
|
autoIdInput: import("@angular/core").InputSignal<string | null | undefined>;
|
|
21
20
|
autoId: import("@angular/core").Signal<string | undefined>;
|
|
@@ -71,8 +70,8 @@ export declare class SdDatetime implements OnDestroy, OnInit {
|
|
|
71
70
|
formControl: SdFormControl;
|
|
72
71
|
isFocused: boolean;
|
|
73
72
|
isValid?: boolean;
|
|
74
|
-
/** State popup — true khi đang mở. */
|
|
75
|
-
pickerOpened: import("@angular/core").
|
|
73
|
+
/** State popup — true khi picker package đang mở. */
|
|
74
|
+
pickerOpened: import("@angular/core").Signal<boolean>;
|
|
76
75
|
constructor();
|
|
77
76
|
ngOnInit(): void;
|
|
78
77
|
ngOnDestroy(): void;
|
|
@@ -80,6 +79,7 @@ export declare class SdDatetime implements OnDestroy, OnInit {
|
|
|
80
79
|
open(): void;
|
|
81
80
|
/** Đóng popup (public — gọi từ template nếu cần). */
|
|
82
81
|
close(): void;
|
|
82
|
+
onPickerConfirm(value: Date): void;
|
|
83
83
|
onFocus: () => void;
|
|
84
84
|
onBlur: () => void;
|
|
85
85
|
onClick: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './lib/core/date-adapter';
|
|
2
|
+
export * from './lib/core/date-formats';
|
|
3
|
+
export * from './lib/core/default-options';
|
|
4
|
+
export * from './lib/native/native-date-adapter';
|
|
5
|
+
export * from './lib/native/native-date-formats';
|
|
6
|
+
export * from './lib/native/provide-native';
|
|
7
|
+
export * from './lib/time-spinner/time-spinner.component';
|
|
8
|
+
export * from './lib/datetime-picker/datetime-picker.component';
|
|
9
|
+
export * from './lib/datetime-picker/datetime-picker-input.directive';
|
|
10
|
+
export * from './lib/datetime-picker/datetime-picker-toggle.directive';
|
|
11
|
+
export * from './lib/datetime-picker/datetime-picker-actions.component';
|
|
12
|
+
export * from './lib/datetime-picker/datetime-picker-apply.directive';
|
|
13
|
+
export * from './lib/datetime-picker/datetime-picker-cancel.directive';
|
|
14
|
+
export * from './lib/datetime-picker/datetime-picker-now.directive';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DateAdapter } from '@angular/material/core';
|
|
2
|
+
export declare abstract class SdDateAdapter<D> extends DateAdapter<D> {
|
|
3
|
+
abstract getHour(date: D): number;
|
|
4
|
+
abstract getMinute(date: D): number;
|
|
5
|
+
abstract getSecond(date: D): number;
|
|
6
|
+
abstract setHour(date: D, hour: number): D;
|
|
7
|
+
abstract setMinute(date: D, minute: number): D;
|
|
8
|
+
abstract setSecond(date: D, second: number): D;
|
|
9
|
+
abstract createDatetime(year: number, month: number, date: number, hour: number, minute: number, second: number): D;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export interface SdDateFormats {
|
|
3
|
+
parse: {
|
|
4
|
+
dateInput: string;
|
|
5
|
+
datetimeInput: string;
|
|
6
|
+
timeInput: string;
|
|
7
|
+
};
|
|
8
|
+
display: {
|
|
9
|
+
dateInput: string;
|
|
10
|
+
datetimeInput: string;
|
|
11
|
+
timeInput: string;
|
|
12
|
+
monthYearLabel: string;
|
|
13
|
+
dateA11yLabel: string;
|
|
14
|
+
monthYearA11yLabel: string;
|
|
15
|
+
popupHeaderDateLabel: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare const SD_DATE_FORMATS: InjectionToken<SdDateFormats>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { ThemePalette } from '@angular/material/core';
|
|
3
|
+
export interface SdDatetimeDefaultOptions {
|
|
4
|
+
/** Whether to show the seconds spinner column in the time picker. */
|
|
5
|
+
showSeconds?: boolean;
|
|
6
|
+
/** Minute spinner step (e.g. 5 → 0, 5, 10, ...). */
|
|
7
|
+
stepMinute?: number;
|
|
8
|
+
/** Touch-friendly modal mode instead of inline overlay. */
|
|
9
|
+
touchUi?: boolean;
|
|
10
|
+
/** Material theme palette for the picker UI. */
|
|
11
|
+
color?: ThemePalette;
|
|
12
|
+
}
|
|
13
|
+
export declare const SD_DATETIME_DEFAULT_OPTIONS: InjectionToken<SdDatetimeDefaultOptions>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SdDatetimePickerActions {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerActions, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdDatetimePickerActions, "sd-datetime-picker-actions", never, {}, {}, never, ["*"], true, never>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SdDatetimePickerApply {
|
|
3
|
+
private readonly picker;
|
|
4
|
+
onClick(): void;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerApply, never>;
|
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SdDatetimePickerApply, "button[sdDatetimePickerApply]", never, {}, {}, never, never, true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SdDatetimePickerCancel {
|
|
3
|
+
private readonly picker;
|
|
4
|
+
onClick(): void;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerCancel, never>;
|
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SdDatetimePickerCancel, "button[sdDatetimePickerCancel]", never, {}, {}, never, never, true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { SdDatetimePicker } from './datetime-picker.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class SdDatetimePickerInput<D = Date> implements ControlValueAccessor, OnInit, OnDestroy {
|
|
6
|
+
private readonly adapter;
|
|
7
|
+
private readonly formats;
|
|
8
|
+
private readonly elementRef;
|
|
9
|
+
readonly picker: import("@angular/core").InputSignal<SdDatetimePicker<D>>;
|
|
10
|
+
isDisabled: boolean;
|
|
11
|
+
private onChange;
|
|
12
|
+
private onTouched;
|
|
13
|
+
private subs;
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
writeValue(value: D | null): void;
|
|
17
|
+
registerOnChange(fn: (v: D | null) => void): void;
|
|
18
|
+
registerOnTouched(fn: () => void): void;
|
|
19
|
+
setDisabledState(isDisabled: boolean): void;
|
|
20
|
+
onBlur(): void;
|
|
21
|
+
onInput(raw: string): void;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerInput<any>, never>;
|
|
23
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SdDatetimePickerInput<any>, "input[sdDatetimePicker]", never, { "picker": { "alias": "sdDatetimePicker"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
+
}
|
package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker-now.directive.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SdDatetimePickerNow {
|
|
3
|
+
private readonly picker;
|
|
4
|
+
onClick(): void;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerNow, never>;
|
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SdDatetimePickerNow, "button[sdDatetimePickerNow]", never, {}, {}, never, never, true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SdDatetimePicker } from './datetime-picker.component';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SdDatetimePickerToggle<D> {
|
|
4
|
+
readonly target: import("@angular/core").InputSignal<SdDatetimePicker<D>>;
|
|
5
|
+
onClick(): void;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePickerToggle<any>, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SdDatetimePickerToggle<any>, "button[sdDatetimePickerToggle]", never, { "target": { "alias": "sdDatetimePickerToggle"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
8
|
+
}
|
package/forms/datetime/src/material-datetime/lib/datetime-picker/datetime-picker.component.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { OnDestroy, TemplateRef } from '@angular/core';
|
|
2
|
+
import { SdDateAdapter } from '../core/date-adapter';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class SdDatetimePicker<D = Date> implements OnDestroy {
|
|
5
|
+
protected readonly adapter: SdDateAdapter<D>;
|
|
6
|
+
private readonly overlay;
|
|
7
|
+
private readonly vcr;
|
|
8
|
+
readonly showSeconds: import("@angular/core").InputSignal<boolean>;
|
|
9
|
+
readonly stepMinute: import("@angular/core").InputSignal<number>;
|
|
10
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
11
|
+
readonly minDate: import("@angular/core").InputSignal<D | null>;
|
|
12
|
+
readonly maxDate: import("@angular/core").InputSignal<D | null>;
|
|
13
|
+
readonly startAt: import("@angular/core").InputSignal<D | null>;
|
|
14
|
+
readonly applied: import("@angular/core").OutputEmitterRef<D>;
|
|
15
|
+
readonly cleared: import("@angular/core").OutputEmitterRef<void>;
|
|
16
|
+
readonly closed: import("@angular/core").OutputEmitterRef<void>;
|
|
17
|
+
private readonly _selected;
|
|
18
|
+
private readonly _opened;
|
|
19
|
+
readonly selected: import("@angular/core").Signal<D | null>;
|
|
20
|
+
readonly opened: import("@angular/core").Signal<boolean>;
|
|
21
|
+
readonly disabledEffective: import("@angular/core").Signal<boolean>;
|
|
22
|
+
readonly panelTemplate: import("@angular/core").Signal<TemplateRef<unknown>>;
|
|
23
|
+
private overlayRef;
|
|
24
|
+
private anchorEl;
|
|
25
|
+
private readonly _inputDisabled;
|
|
26
|
+
/** Anchor the overlay to a specific input element (set by the input directive). */
|
|
27
|
+
setAnchor(el: HTMLElement | null): void;
|
|
28
|
+
/** Sync disabled state from the ControlValueAccessor input directive. */
|
|
29
|
+
setInputDisabledState(isDisabled: boolean): void;
|
|
30
|
+
open(): void;
|
|
31
|
+
close(): void;
|
|
32
|
+
select(value: D): void;
|
|
33
|
+
apply(): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
now(): void;
|
|
36
|
+
ngOnDestroy(): void;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdDatetimePicker<any>, never>;
|
|
38
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdDatetimePicker<any>, "sd-datetime-picker", never, { "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "stepMinute": { "alias": "stepMinute"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; }, { "applied": "applied"; "cleared": "cleared"; "closed": "closed"; }, never, ["sd-datetime-picker-actions"], true, never>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NativeDateAdapter } from '@angular/material/core';
|
|
2
|
+
import { SdDateAdapter } from '../core/date-adapter';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class SdNativeDateAdapter extends NativeDateAdapter implements SdDateAdapter<Date> {
|
|
5
|
+
format(date: Date, displayFormat: unknown): string;
|
|
6
|
+
getHour(date: Date): number;
|
|
7
|
+
getMinute(date: Date): number;
|
|
8
|
+
getSecond(date: Date): number;
|
|
9
|
+
setHour(date: Date, hour: number): Date;
|
|
10
|
+
setMinute(date: Date, minute: number): Date;
|
|
11
|
+
setSecond(date: Date, second: number): Date;
|
|
12
|
+
createDatetime(year: number, month: number, date: number, hour: number, minute: number, second: number): Date;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdNativeDateAdapter, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SdNativeDateAdapter>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SdTimeSpinner {
|
|
3
|
+
#private;
|
|
4
|
+
readonly value: import("@angular/core").InputSignal<Date | null>;
|
|
5
|
+
readonly showSeconds: import("@angular/core").InputSignal<boolean>;
|
|
6
|
+
readonly stepMinute: import("@angular/core").InputSignal<number>;
|
|
7
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
8
|
+
readonly valueChange: import("@angular/core").OutputEmitterRef<Date>;
|
|
9
|
+
readonly hour: import("@angular/core").Signal<number>;
|
|
10
|
+
readonly minute: import("@angular/core").Signal<number>;
|
|
11
|
+
readonly second: import("@angular/core").Signal<number>;
|
|
12
|
+
private readonly _focusedUnit;
|
|
13
|
+
/** Display string for each column: unpadded while focused (so the user can type freely), padded to 2 digits otherwise. */
|
|
14
|
+
readonly displayHour: import("@angular/core").Signal<string>;
|
|
15
|
+
readonly displayMinute: import("@angular/core").Signal<string>;
|
|
16
|
+
readonly displaySecond: import("@angular/core").Signal<string>;
|
|
17
|
+
setFocus(unit: 'hour' | 'minute' | 'second'): void;
|
|
18
|
+
clearFocus(): void;
|
|
19
|
+
stepHourUp(): void;
|
|
20
|
+
stepHourDown(): void;
|
|
21
|
+
stepMinuteUp(): void;
|
|
22
|
+
stepMinuteDown(): void;
|
|
23
|
+
stepSecondUp(): void;
|
|
24
|
+
stepSecondDown(): void;
|
|
25
|
+
onHourInput(raw: string): void;
|
|
26
|
+
onMinuteInput(raw: string): void;
|
|
27
|
+
onSecondInput(raw: string): void;
|
|
28
|
+
onDigitKeyDown(event: KeyboardEvent): void;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SdTimeSpinner, never>;
|
|
30
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SdTimeSpinner, "sd-time-spinner", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "stepMinute": { "alias": "stepMinute"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|