@tekus/design-system 5.9.0 → 5.9.1
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/components/tag/src/tag.component.d.ts +3 -3
- package/fesm2022/tekus-design-system-components-table.mjs +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tag.mjs +8 -6
- package/fesm2022/tekus-design-system-components-tag.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -28,7 +28,7 @@ export declare class TagComponent {
|
|
|
28
28
|
/**
|
|
29
29
|
* Maximum number of characters to display before truncation.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
truncationLimit: import("@angular/core").InputSignal<number | undefined>;
|
|
32
32
|
/**
|
|
33
33
|
* Computed property that maps the custom `TagSeverity` to the underlying PrimeNG `severity`.
|
|
34
34
|
* Returns `undefined` for 'primary' as it uses the default style, and maps others accordingly.
|
|
@@ -36,9 +36,9 @@ export declare class TagComponent {
|
|
|
36
36
|
primeSeverity: import("@angular/core").Signal<string | undefined>;
|
|
37
37
|
/**
|
|
38
38
|
* Computed property that processes the `value` for display.
|
|
39
|
-
* Truncates the text with an ellipsis if it exceeds the defined limit.
|
|
39
|
+
* Truncates the text with an ellipsis if it exceeds the defined limit and truncate is enabled.
|
|
40
40
|
*/
|
|
41
41
|
displayValue: import("@angular/core").Signal<string>;
|
|
42
42
|
static ɵfac: i0.ɵɵFactoryDeclaration<TagComponent, never>;
|
|
43
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<TagComponent, "tk-tag", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
43
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TagComponent, "tk-tag", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "severity": { "alias": "severity"; "required": false; "isSignal": true; }; "truncationLimit": { "alias": "truncationLimit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
44
44
|
}
|
|
@@ -109,7 +109,7 @@ class TableComponent {
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
112
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TableComponent, isStandalone: true, selector: "tk-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "tableRef", first: true, predicate: ["tableRef"], descendants: true }], ngImport: i0, template: "<p-table\n #tableRef\n [value]=\"internalData\"\n [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\"\n [tableStyle]=\"{ 'min-width': '60rem' }\"\n responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th\n [id]=\"col.field\"\n [style.width]=\"col.width\"\n [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div>\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr>\n @for (col of columns(); track col.header) {\n\n <!-- TEXT (default) -->\n @if (!col.type || col.type === 'text') {\n <td>{{ row[col.field!] }}</td>\n }\n\n <!-- TAG -->\n @if (col.type === 'tag') {\n <td>\n <tk-tag [value]=\"row[col.field!]\" [severity]=\"col.tagSeverity!(row)\" />\n </td>\n }\n\n <!-- ACTIONS -->\n @if (col.type === 'actions') {\n <td>\n <div class=\"tk-table__actions\">\n @for (action of col.actions!; track action.icon) {\n <tk-button\n [icon]=\"'eye'\"\n severity=\"secondary\"\n (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n } }\n </tr>\n </ng-template>\n</p-table>\n", styles: [":host ::ng-deep .p-datatable-column-sorted{background-color:var(--tk-primary-100, #b7b0d2)!important;color:var(--tk-primary-700, #10004f)!important}:host ::ng-deep .p-datatable-column-sorted svg{color:var(--tk-primary-700, #10004f)!important}:host ::ng-deep .p-datatable-sortable-column{font-size:var(--tk-font-size-sm, .875rem);color:var(--tk-surface-950, #191a1b);padding:.625rem}:host ::ng-deep .p-datatable-sortable-column svg{color:var(--tk-surface-500, #424243)}:host ::ng-deep .p-button-secondary{background-color:var(--tk-surface-0, #ffffff);border:1px solid var(--tk-surface-0, #ffffff)}:host ::ng-deep .p-datatable-tbody td{color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);padding:.625rem}.tk-table__actions{display:flex;gap:var(--tk-spacing-gap-s, .25rem)}\n"], dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "component", type: i1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "ngmodule", type: TagModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: TagComponent, selector: "tk-tag", inputs: ["value", "severity"] }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "tooltipText"], outputs: ["clicked"] }] }); }
|
|
112
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: TableComponent, isStandalone: true, selector: "tk-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "tableRef", first: true, predicate: ["tableRef"], descendants: true }], ngImport: i0, template: "<p-table\n #tableRef\n [value]=\"internalData\"\n [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\"\n [tableStyle]=\"{ 'min-width': '60rem' }\"\n responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th\n [id]=\"col.field\"\n [style.width]=\"col.width\"\n [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div>\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr>\n @for (col of columns(); track col.header) {\n\n <!-- TEXT (default) -->\n @if (!col.type || col.type === 'text') {\n <td>{{ row[col.field!] }}</td>\n }\n\n <!-- TAG -->\n @if (col.type === 'tag') {\n <td>\n <tk-tag [value]=\"row[col.field!]\" [severity]=\"col.tagSeverity!(row)\" />\n </td>\n }\n\n <!-- ACTIONS -->\n @if (col.type === 'actions') {\n <td>\n <div class=\"tk-table__actions\">\n @for (action of col.actions!; track action.icon) {\n <tk-button\n [icon]=\"'eye'\"\n severity=\"secondary\"\n (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n } }\n </tr>\n </ng-template>\n</p-table>\n", styles: [":host ::ng-deep .p-datatable-column-sorted{background-color:var(--tk-primary-100, #b7b0d2)!important;color:var(--tk-primary-700, #10004f)!important}:host ::ng-deep .p-datatable-column-sorted svg{color:var(--tk-primary-700, #10004f)!important}:host ::ng-deep .p-datatable-sortable-column{font-size:var(--tk-font-size-sm, .875rem);color:var(--tk-surface-950, #191a1b);padding:.625rem}:host ::ng-deep .p-datatable-sortable-column svg{color:var(--tk-surface-500, #424243)}:host ::ng-deep .p-button-secondary{background-color:var(--tk-surface-0, #ffffff);border:1px solid var(--tk-surface-0, #ffffff)}:host ::ng-deep .p-datatable-tbody td{color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);padding:.625rem}.tk-table__actions{display:flex;gap:var(--tk-spacing-gap-s, .25rem)}\n"], dependencies: [{ kind: "ngmodule", type: TableModule }, { kind: "component", type: i1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "ngmodule", type: TagModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: TagComponent, selector: "tk-tag", inputs: ["value", "severity", "truncationLimit"] }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "tooltipText"], outputs: ["clicked"] }] }); }
|
|
113
113
|
}
|
|
114
114
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TableComponent, decorators: [{
|
|
115
115
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-table.mjs","sources":["../../../projects/design-system/components/table/src/table.component.ts","../../../projects/design-system/components/table/src/table.component.html","../../../projects/design-system/components/table/tekus-design-system-components-table.ts"],"sourcesContent":["import { Component, effect, input, ViewChild } from '@angular/core';\nimport { Table, TableModule } from 'primeng/table';\nimport { TagModule } from 'primeng/tag';\nimport { ButtonModule } from 'primeng/button';\nimport { TableColumn } from './table.interface';\nimport { TagComponent } from '@tekus/design-system/components/tag';\nimport { IconComponent } from '@tekus/design-system/components/icon';\nimport { SortEvent } from 'primeng/api';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\n\n@Component({\n selector: 'tk-table',\n standalone: true,\n imports: [\n TableModule,\n TagModule,\n ButtonModule,\n TagComponent,\n IconComponent,\n ButtonComponent,\n ],\n templateUrl: './table.component.html',\n styleUrl: './table.component.scss',\n})\n/**\n * @component TableComponent\n * @description\n * Generic table wrapper around PrimeNG Table component.\n * Displays tabular data with configurable columns and support for custom rendering via template.\n *\n * @usage\n * ```html\n * <tk-table [data]=\"items\" [columns]=\"columnConfig\"></tk-table>\n * ```\n */\nexport class TableComponent<T = unknown> {\n /**\n * @property {InputSignal<T[]>} data\n * @description\n * Array of data objects to display in the table rows.\n * Each object corresponds to one row; properties are mapped to columns via the `columns` input.\n *\n * @default []\n *\n * @example\n * [data]=\"[\n * { id: 1, name: 'John', status: 'active' },\n * { id: 2, name: 'Jane', status: 'inactive' }\n * ]\"\n */\n data = input<T[]>([]);\n\n /**\n * @property {ViewChild} tableRef\n * @description\n * Reference to the PrimeNG Table component instance.\n * Used to access table methods and properties directly.\n */\n @ViewChild('tableRef')\n tableRef!: Table;\n\n /**\n * @property {InputSignal<TableColumn<T>[]>} columns\n * @description\n * Array of column definitions that describe how to render each column.\n * Each column object specifies the field name, header label, and optional rendering behavior.\n *\n * @default []\n *\n * @example\n * [columns]=\"[\n * { field: 'id', header: 'ID' },\n * { field: 'name', header: 'Name' },\n * { field: 'status', header: 'Status', renderAs: 'tag' }\n * ]\"\n */\n columns = input<TableColumn<T>[]>([]);\n\n initialData: T[] = [...this.data()];\n internalData: T[] = [];\n isSorted: boolean | null = null;\n\n constructor() {\n /**\n * @effect data → initialData sync\n * @description\n * Whenever the data input changes, update initialData and reset sort state.\n */\n effect(() => {\n this.internalData = [...this.data()];\n this.initialData = [...this.data()];\n });\n }\n\n customSort(event: SortEvent) {\n if (this.isSorted === null || this.isSorted === undefined) {\n this.isSorted = true;\n this.sortTableData(event);\n } else if (this.isSorted) {\n this.isSorted = false;\n this.sortTableData(event);\n } else {\n this.isSorted = null;\n this.internalData = [...this.initialData];\n this.tableRef.reset();\n }\n }\n\n sortTableData(event: SortEvent) {\n if (!event.data || !event.field) return;\n\n event.data.sort((data1, data2) => {\n const value1 = data1[event.field!];\n const value2 = data2[event.field!];\n let result = null;\n if (value1 == null && value2 != null) result = -1;\n else if (value1 != null && value2 == null) result = 1;\n else if (value1 == null && value2 == null) result = 0;\n else if (typeof value1 === 'string' && typeof value2 === 'string')\n result = value1.localeCompare(value2);\n else if (value1 < value2) {\n result = -1;\n } else if (value1 > value2) {\n result = 1;\n } else {\n result = 0;\n }\n\n return (event.order ?? 1) * result;\n });\n }\n}\n","<p-table\n #tableRef\n [value]=\"internalData\"\n [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\"\n [tableStyle]=\"{ 'min-width': '60rem' }\"\n responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th\n [id]=\"col.field\"\n [style.width]=\"col.width\"\n [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div>\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr>\n @for (col of columns(); track col.header) {\n\n <!-- TEXT (default) -->\n @if (!col.type || col.type === 'text') {\n <td>{{ row[col.field!] }}</td>\n }\n\n <!-- TAG -->\n @if (col.type === 'tag') {\n <td>\n <tk-tag [value]=\"row[col.field!]\" [severity]=\"col.tagSeverity!(row)\" />\n </td>\n }\n\n <!-- ACTIONS -->\n @if (col.type === 'actions') {\n <td>\n <div class=\"tk-table__actions\">\n @for (action of col.actions!; track action.icon) {\n <tk-button\n [icon]=\"'eye'\"\n severity=\"secondary\"\n (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n } }\n </tr>\n </ng-template>\n</p-table>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAwBA;;;;;;;;;;AAUG;MACU,cAAc,CAAA;AA+CzB,IAAA,WAAA,GAAA;AA9CA;;;;;;;;;;;;;AAaG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAM,EAAE,CAAC;AAWrB;;;;;;;;;;;;;;AAcG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAmB,EAAE,CAAC;QAErC,IAAW,CAAA,WAAA,GAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;Q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A,UAAA,EAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAgBN,cAAc,EAAA,UAAA,EAAA,CAAA;kBAzB1B,SAAS;+BACE,UAAU,EAAA,UAAA,EACR,IAAI,EACP,OAAA,EAAA;wBACP,WAAW;wBACX,SAAS;wBACT,YAAY;wBACZ,YAAY;wBACZ,aAAa;wBACb,eAAe;AAChB,qBAAA,EAAA,QAAA,EAAA,m/CAAA,EAAA,MAAA,EAAA,CAAA,iyBAAA,CAAA,EAAA;wDAuCD,QAAQ,EAAA,CAAA;sBADP,SAAS;uBAAC,UAAU;;;AE1DvB;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-table.mjs","sources":["../../../projects/design-system/components/table/src/table.component.ts","../../../projects/design-system/components/table/src/table.component.html","../../../projects/design-system/components/table/tekus-design-system-components-table.ts"],"sourcesContent":["import { Component, effect, input, ViewChild } from '@angular/core';\nimport { Table, TableModule } from 'primeng/table';\nimport { TagModule } from 'primeng/tag';\nimport { ButtonModule } from 'primeng/button';\nimport { TableColumn } from './table.interface';\nimport { TagComponent } from '@tekus/design-system/components/tag';\nimport { IconComponent } from '@tekus/design-system/components/icon';\nimport { SortEvent } from 'primeng/api';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\n\n@Component({\n selector: 'tk-table',\n standalone: true,\n imports: [\n TableModule,\n TagModule,\n ButtonModule,\n TagComponent,\n IconComponent,\n ButtonComponent,\n ],\n templateUrl: './table.component.html',\n styleUrl: './table.component.scss',\n})\n/**\n * @component TableComponent\n * @description\n * Generic table wrapper around PrimeNG Table component.\n * Displays tabular data with configurable columns and support for custom rendering via template.\n *\n * @usage\n * ```html\n * <tk-table [data]=\"items\" [columns]=\"columnConfig\"></tk-table>\n * ```\n */\nexport class TableComponent<T = unknown> {\n /**\n * @property {InputSignal<T[]>} data\n * @description\n * Array of data objects to display in the table rows.\n * Each object corresponds to one row; properties are mapped to columns via the `columns` input.\n *\n * @default []\n *\n * @example\n * [data]=\"[\n * { id: 1, name: 'John', status: 'active' },\n * { id: 2, name: 'Jane', status: 'inactive' }\n * ]\"\n */\n data = input<T[]>([]);\n\n /**\n * @property {ViewChild} tableRef\n * @description\n * Reference to the PrimeNG Table component instance.\n * Used to access table methods and properties directly.\n */\n @ViewChild('tableRef')\n tableRef!: Table;\n\n /**\n * @property {InputSignal<TableColumn<T>[]>} columns\n * @description\n * Array of column definitions that describe how to render each column.\n * Each column object specifies the field name, header label, and optional rendering behavior.\n *\n * @default []\n *\n * @example\n * [columns]=\"[\n * { field: 'id', header: 'ID' },\n * { field: 'name', header: 'Name' },\n * { field: 'status', header: 'Status', renderAs: 'tag' }\n * ]\"\n */\n columns = input<TableColumn<T>[]>([]);\n\n initialData: T[] = [...this.data()];\n internalData: T[] = [];\n isSorted: boolean | null = null;\n\n constructor() {\n /**\n * @effect data → initialData sync\n * @description\n * Whenever the data input changes, update initialData and reset sort state.\n */\n effect(() => {\n this.internalData = [...this.data()];\n this.initialData = [...this.data()];\n });\n }\n\n customSort(event: SortEvent) {\n if (this.isSorted === null || this.isSorted === undefined) {\n this.isSorted = true;\n this.sortTableData(event);\n } else if (this.isSorted) {\n this.isSorted = false;\n this.sortTableData(event);\n } else {\n this.isSorted = null;\n this.internalData = [...this.initialData];\n this.tableRef.reset();\n }\n }\n\n sortTableData(event: SortEvent) {\n if (!event.data || !event.field) return;\n\n event.data.sort((data1, data2) => {\n const value1 = data1[event.field!];\n const value2 = data2[event.field!];\n let result = null;\n if (value1 == null && value2 != null) result = -1;\n else if (value1 != null && value2 == null) result = 1;\n else if (value1 == null && value2 == null) result = 0;\n else if (typeof value1 === 'string' && typeof value2 === 'string')\n result = value1.localeCompare(value2);\n else if (value1 < value2) {\n result = -1;\n } else if (value1 > value2) {\n result = 1;\n } else {\n result = 0;\n }\n\n return (event.order ?? 1) * result;\n });\n }\n}\n","<p-table\n #tableRef\n [value]=\"internalData\"\n [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\"\n [tableStyle]=\"{ 'min-width': '60rem' }\"\n responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th\n [id]=\"col.field\"\n [style.width]=\"col.width\"\n [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div>\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr>\n @for (col of columns(); track col.header) {\n\n <!-- TEXT (default) -->\n @if (!col.type || col.type === 'text') {\n <td>{{ row[col.field!] }}</td>\n }\n\n <!-- TAG -->\n @if (col.type === 'tag') {\n <td>\n <tk-tag [value]=\"row[col.field!]\" [severity]=\"col.tagSeverity!(row)\" />\n </td>\n }\n\n <!-- ACTIONS -->\n @if (col.type === 'actions') {\n <td>\n <div class=\"tk-table__actions\">\n @for (action of col.actions!; track action.icon) {\n <tk-button\n [icon]=\"'eye'\"\n severity=\"secondary\"\n (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n } }\n </tr>\n </ng-template>\n</p-table>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAwBA;;;;;;;;;;AAUG;MACU,cAAc,CAAA;AA+CzB,IAAA,WAAA,GAAA;AA9CA;;;;;;;;;;;;;AAaG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAM,EAAE,CAAC;AAWrB;;;;;;;;;;;;;;AAcG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAmB,EAAE,CAAC;QAErC,IAAW,CAAA,WAAA,GAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC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A,OAAA,EAAA,UAAA,EAAA,MAAA,EAAA,UAAA,EAAA,SAAA,EAAA,MAAA,EAAA,MAAA,EAAA,aAAA,CAAA,EAAA,OAAA,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAgBN,cAAc,EAAA,UAAA,EAAA,CAAA;kBAzB1B,SAAS;+BACE,UAAU,EAAA,UAAA,EACR,IAAI,EACP,OAAA,EAAA;wBACP,WAAW;wBACX,SAAS;wBACT,YAAY;wBACZ,YAAY;wBACZ,aAAa;wBACb,eAAe;AAChB,qBAAA,EAAA,QAAA,EAAA,m/CAAA,EAAA,MAAA,EAAA,CAAA,iyBAAA,CAAA,EAAA;wDAuCD,QAAQ,EAAA,CAAA;sBADP,SAAS;uBAAC,UAAU;;;AE1DvB;;AAEG;;;;"}
|
|
@@ -32,7 +32,7 @@ class TagComponent {
|
|
|
32
32
|
/**
|
|
33
33
|
* Maximum number of characters to display before truncation.
|
|
34
34
|
*/
|
|
35
|
-
this.
|
|
35
|
+
this.truncationLimit = input();
|
|
36
36
|
/**
|
|
37
37
|
* Computed property that maps the custom `TagSeverity` to the underlying PrimeNG `severity`.
|
|
38
38
|
* Returns `undefined` for 'primary' as it uses the default style, and maps others accordingly.
|
|
@@ -45,24 +45,26 @@ class TagComponent {
|
|
|
45
45
|
info: 'info',
|
|
46
46
|
warn: 'warn',
|
|
47
47
|
danger: 'danger',
|
|
48
|
-
contrast: 'contrast'
|
|
48
|
+
contrast: 'contrast',
|
|
49
49
|
};
|
|
50
50
|
return map[this.severity()];
|
|
51
51
|
});
|
|
52
52
|
/**
|
|
53
53
|
* Computed property that processes the `value` for display.
|
|
54
|
-
* Truncates the text with an ellipsis if it exceeds the defined limit.
|
|
54
|
+
* Truncates the text with an ellipsis if it exceeds the defined limit and truncate is enabled.
|
|
55
55
|
*/
|
|
56
56
|
this.displayValue = computed(() => {
|
|
57
57
|
const val = this.value();
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
const limit = this.truncationLimit();
|
|
59
|
+
if (limit && val && val.length > limit) {
|
|
60
|
+
const effectiveLimit = Math.max(0, limit);
|
|
61
|
+
return val.substring(0, effectiveLimit) + '...';
|
|
60
62
|
}
|
|
61
63
|
return val;
|
|
62
64
|
});
|
|
63
65
|
}
|
|
64
66
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
65
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.15", type: TagComponent, isStandalone: true, selector: "tk-tag", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<p-tag \n [value]=\"displayValue()\" \n [severity]=\"primeSeverity()\" \n [styleClass]=\"'tk-tag-' + severity()\"\n></p-tag>", styles: [":host ::ng-deep .tk-tag-primary .p-tag-label{color:var(--tk-color-base-primary-700)!important}:host ::ng-deep .tk-tag-secondary .p-tag-label{color:var(--tk-color-base-surface-950)!important}:host ::ng-deep .tk-tag-success .p-tag-label{color:var(--tk-color-base-green-700)!important}:host ::ng-deep .tk-tag-info .p-tag-label{color:var(--tk-color-base-sky-700)!important}:host ::ng-deep .tk-tag-warn .p-tag-label{color:var(--tk-color-base-yellow-700)!important}:host ::ng-deep .tk-tag-danger .p-tag-label{color:var(--tk-color-base-red-700)!important}:host ::ng-deep .tk-tag-contrast .p-tag-label{color:var(--tk-color-base-surface-0)!important}:host ::ng-deep .tk-tag-contrast{background-color:var(--tk-color-base-surface-950)!important}\n"], dependencies: [{ kind: "ngmodule", type: TagModule }, { kind: "component", type: i1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] }); }
|
|
67
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.15", type: TagComponent, isStandalone: true, selector: "tk-tag", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, severity: { classPropertyName: "severity", publicName: "severity", isSignal: true, isRequired: false, transformFunction: null }, truncationLimit: { classPropertyName: "truncationLimit", publicName: "truncationLimit", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<p-tag \n [value]=\"displayValue()\" \n [severity]=\"primeSeverity()\" \n [styleClass]=\"'tk-tag-' + severity()\"\n></p-tag>", styles: [":host ::ng-deep .tk-tag-primary .p-tag-label{color:var(--tk-color-base-primary-700)!important}:host ::ng-deep .tk-tag-secondary .p-tag-label{color:var(--tk-color-base-surface-950)!important}:host ::ng-deep .tk-tag-success .p-tag-label{color:var(--tk-color-base-green-700)!important}:host ::ng-deep .tk-tag-info .p-tag-label{color:var(--tk-color-base-sky-700)!important}:host ::ng-deep .tk-tag-warn .p-tag-label{color:var(--tk-color-base-yellow-700)!important}:host ::ng-deep .tk-tag-danger .p-tag-label{color:var(--tk-color-base-red-700)!important}:host ::ng-deep .tk-tag-contrast .p-tag-label{color:var(--tk-color-base-surface-0)!important}:host ::ng-deep .tk-tag-contrast{background-color:var(--tk-color-base-surface-950)!important}\n"], dependencies: [{ kind: "ngmodule", type: TagModule }, { kind: "component", type: i1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] }); }
|
|
66
68
|
}
|
|
67
69
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TagComponent, decorators: [{
|
|
68
70
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-tag.mjs","sources":["../../../projects/design-system/components/tag/src/tag.component.ts","../../../projects/design-system/components/tag/src/tag.component.html","../../../projects/design-system/components/tag/tekus-design-system-components-tag.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\nimport { TagModule } from 'primeng/tag';\n\nexport type TagSeverity
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-tag.mjs","sources":["../../../projects/design-system/components/tag/src/tag.component.ts","../../../projects/design-system/components/tag/src/tag.component.html","../../../projects/design-system/components/tag/tekus-design-system-components-tag.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\nimport { TagModule } from 'primeng/tag';\n\nexport type TagSeverity =\n | 'primary'\n | 'secondary'\n | 'success'\n | 'info'\n | 'warn'\n | 'danger'\n | 'contrast';\n\n/**\n * @component TagComponent\n * @description\n * A component used to categorize or label content using keywords.\n * It wraps PrimeNG's `p-tag` component with custom styling and behavior.\n *\n * This component supports:\n * - `value`: The text to display. Truncates automatically if it exceeds 15 characters.\n * - `severity`: The color scheme of the tag. Options: `'primary' | 'secondary' | 'success' | 'info' | 'warn' | 'danger' | 'contrast'`.\n * - Rounded corners by default.\n *\n * @usage\n * ### Basic Usage\n * ```html\n * <tk-tag value=\"New\" severity=\"success\"></tk-tag>\n * ```\n */\n@Component({\n selector: 'tk-tag',\n imports: [TagModule],\n templateUrl: './tag.component.html',\n styleUrl: './tag.component.scss',\n})\nexport class TagComponent {\n /** The text content to be displayed in the tag. */\n value = input.required<string>();\n\n /**\n * The severity level of the tag, which determines its color and styling.\n * @default 'secondary'\n */\n severity = input<TagSeverity>('secondary');\n\n /**\n * Maximum number of characters to display before truncation.\n */\n truncationLimit = input<number>();\n\n /**\n * Computed property that maps the custom `TagSeverity` to the underlying PrimeNG `severity`.\n * Returns `undefined` for 'primary' as it uses the default style, and maps others accordingly.\n */\n primeSeverity = computed(() => {\n const map: Record<string, string | undefined> = {\n primary: undefined,\n secondary: 'secondary',\n success: 'success',\n info: 'info',\n warn: 'warn',\n danger: 'danger',\n contrast: 'contrast',\n };\n return map[this.severity()];\n });\n\n /**\n * Computed property that processes the `value` for display.\n * Truncates the text with an ellipsis if it exceeds the defined limit and truncate is enabled.\n */\n displayValue = computed(() => {\n const val = this.value();\n const limit = this.truncationLimit();\n if (limit && val && val.length > limit) {\n const effectiveLimit = Math.max(0, limit);\n return val.substring(0, effectiveLimit) + '...';\n }\n return val;\n });\n}\n","<p-tag \n [value]=\"displayValue()\" \n [severity]=\"primeSeverity()\" \n [styleClass]=\"'tk-tag-' + severity()\"\n></p-tag>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAYA;;;;;;;;;;;;;;;;AAgBG;MAOU,YAAY,CAAA;AANzB,IAAA,WAAA,GAAA;;AAQE,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;AAEhC;;;AAGG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAc,WAAW,CAAC;AAE1C;;AAEG;QACH,IAAe,CAAA,eAAA,GAAG,KAAK,EAAU;AAEjC;;;AAGG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAK;AAC5B,YAAA,MAAM,GAAG,GAAuC;AAC9C,gBAAA,OAAO,EAAE,SAAS;AAClB,gBAAA,SAAS,EAAE,WAAW;AACtB,gBAAA,OAAO,EAAE,SAAS;AAClB,gBAAA,IAAI,EAAE,MAAM;AACZ,gBAAA,IAAI,EAAE,MAAM;AACZ,gBAAA,MAAM,EAAE,QAAQ;AAChB,gBAAA,QAAQ,EAAE,UAAU;aACrB;AACD,YAAA,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC7B,SAAC,CAAC;AAEF;;;AAGG;AACH,QAAA,IAAA,CAAA,YAAY,GAAG,QAAQ,CAAC,MAAK;AAC3B,YAAA,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE;AACxB,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE;YACpC,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,KAAK,EAAE;gBACtC,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;gB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S,CAAC,EAAA,QAAA,EAAA,uIAAA,EAAA,MAAA,EAAA,CAAA,kuBAAA,CAAA,EAAA;;;AE/BtB;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tekus/design-system",
|
|
3
3
|
"description": "Tekus design system library",
|
|
4
|
-
"version": "5.9.
|
|
4
|
+
"version": "5.9.1",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"@angular/core": "^19.2.15",
|
|
@@ -39,6 +39,14 @@
|
|
|
39
39
|
"types": "./core/index.d.ts",
|
|
40
40
|
"default": "./fesm2022/tekus-design-system-core.mjs"
|
|
41
41
|
},
|
|
42
|
+
"./core/types": {
|
|
43
|
+
"types": "./core/types/index.d.ts",
|
|
44
|
+
"default": "./fesm2022/tekus-design-system-core-types.mjs"
|
|
45
|
+
},
|
|
46
|
+
"./directives/gird-item": {
|
|
47
|
+
"types": "./directives/gird-item/index.d.ts",
|
|
48
|
+
"default": "./fesm2022/tekus-design-system-directives-gird-item.mjs"
|
|
49
|
+
},
|
|
42
50
|
"./components/autocomplete": {
|
|
43
51
|
"types": "./components/autocomplete/index.d.ts",
|
|
44
52
|
"default": "./fesm2022/tekus-design-system-components-autocomplete.mjs"
|
|
@@ -103,14 +111,6 @@
|
|
|
103
111
|
"types": "./components/tooltip/index.d.ts",
|
|
104
112
|
"default": "./fesm2022/tekus-design-system-components-tooltip.mjs"
|
|
105
113
|
},
|
|
106
|
-
"./core/types": {
|
|
107
|
-
"types": "./core/types/index.d.ts",
|
|
108
|
-
"default": "./fesm2022/tekus-design-system-core-types.mjs"
|
|
109
|
-
},
|
|
110
|
-
"./directives/gird-item": {
|
|
111
|
-
"types": "./directives/gird-item/index.d.ts",
|
|
112
|
-
"default": "./fesm2022/tekus-design-system-directives-gird-item.mjs"
|
|
113
|
-
},
|
|
114
114
|
"./utils/sanitizer-utils": {
|
|
115
115
|
"types": "./utils/sanitizer-utils/index.d.ts",
|
|
116
116
|
"default": "./fesm2022/tekus-design-system-utils-sanitizer-utils.mjs"
|