@tekus/design-system 5.21.0 → 5.22.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/fesm2022/tekus-design-system-components-autocomplete.mjs +15 -15
- package/fesm2022/tekus-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-badge.mjs +8 -8
- package/fesm2022/tekus-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-button.mjs +3 -3
- package/fesm2022/tekus-design-system-components-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-checkbox.mjs +14 -16
- package/fesm2022/tekus-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-date-picker.mjs +22 -22
- package/fesm2022/tekus-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-drawer.mjs +29 -29
- package/fesm2022/tekus-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-fallback-view.mjs +4 -5
- package/fesm2022/tekus-design-system-components-fallback-view.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-icon.mjs +13 -15
- package/fesm2022/tekus-design-system-components-icon.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-input-number.mjs +12 -14
- package/fesm2022/tekus-design-system-components-input-number.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-input-text.mjs +17 -18
- package/fesm2022/tekus-design-system-components-input-text.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-modal.mjs +31 -31
- package/fesm2022/tekus-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-multiselect.mjs +19 -19
- package/fesm2022/tekus-design-system-components-multiselect.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-pagination.mjs +12 -12
- package/fesm2022/tekus-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-panel.mjs +3 -3
- package/fesm2022/tekus-design-system-components-panel.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-radio-button.mjs +13 -15
- package/fesm2022/tekus-design-system-components-radio-button.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-select.mjs +16 -16
- package/fesm2022/tekus-design-system-components-select.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs +13 -13
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tabs.mjs +18 -21
- package/fesm2022/tekus-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tag.mjs +11 -19
- package/fesm2022/tekus-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-textarea.mjs +16 -18
- package/fesm2022/tekus-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toolbar.mjs +18 -18
- package/fesm2022/tekus-design-system-components-toolbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-tooltip.mjs +6 -6
- package/fesm2022/tekus-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-topbar.mjs +9 -9
- package/fesm2022/tekus-design-system-components-topbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core-types.mjs +6 -6
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +6 -6
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/fesm2022/tekus-design-system-directives-gird-item.mjs +4 -4
- package/fesm2022/tekus-design-system-directives-gird-item.mjs.map +1 -1
- package/fesm2022/tekus-design-system-utils-sanitizer-utils.mjs.map +1 -1
- package/package.json +53 -48
- package/{components/autocomplete/src/autocomplete.component.d.ts → types/tekus-design-system-components-autocomplete.d.ts} +18 -16
- package/{components/badge/src/badge.component.d.ts → types/tekus-design-system-components-badge.d.ts} +12 -8
- package/{components/button/src/button.component.d.ts → types/tekus-design-system-components-button.d.ts} +8 -4
- package/{components/checkbox/src/checkbox.component.d.ts → types/tekus-design-system-components-checkbox.d.ts} +18 -15
- package/{components/date-picker/src/date-picker.component.d.ts → types/tekus-design-system-components-date-picker.d.ts} +33 -28
- package/{components/drawer/src/drawer.component.d.ts → types/tekus-design-system-components-drawer.d.ts} +54 -19
- package/{components/fallback-view/src/fallback-view.component.d.ts → types/tekus-design-system-components-fallback-view.d.ts} +7 -3
- package/types/tekus-design-system-components-icon.d.ts +108 -0
- package/{components/input-number/src/input-number.component.d.ts → types/tekus-design-system-components-input-number.d.ts} +15 -12
- package/{components/input-text/src/input-text.component.d.ts → types/tekus-design-system-components-input-text.d.ts} +20 -17
- package/types/tekus-design-system-components-modal.d.ts +186 -0
- package/{components/multiselect/src/multiselect.component.d.ts → types/tekus-design-system-components-multiselect.d.ts} +30 -22
- package/{components/pagination/src/pagination.component.d.ts → types/tekus-design-system-components-pagination.d.ts} +16 -13
- package/{components/panel/src/panel.component.d.ts → types/tekus-design-system-components-panel.d.ts} +5 -2
- package/{components/radio-button/src/radio-button.component.d.ts → types/tekus-design-system-components-radio-button.d.ts} +16 -13
- package/{components/select/src/select.component.d.ts → types/tekus-design-system-components-select.d.ts} +20 -17
- package/{components/table/src/table.component.d.ts → types/tekus-design-system-components-table.d.ts} +30 -12
- package/{components/tabs/src/tabs.component.d.ts → types/tekus-design-system-components-tabs.d.ts} +23 -14
- package/{components/tag/src/tag.component.d.ts → types/tekus-design-system-components-tag.d.ts} +14 -10
- package/{components/textarea/src/textarea.component.d.ts → types/tekus-design-system-components-textarea.d.ts} +18 -15
- package/{components/toolbar/src/toolbar.component.d.ts → types/tekus-design-system-components-toolbar.d.ts} +21 -18
- package/types/tekus-design-system-components-tooltip.d.ts +39 -0
- package/types/tekus-design-system-components-topbar.d.ts +37 -0
- package/types/tekus-design-system-core-types.d.ts +182 -0
- package/types/tekus-design-system-core.d.ts +182 -0
- package/{directives/gird-item/src/grid-item.directive.d.ts → types/tekus-design-system-directives-gird-item.d.ts} +11 -7
- package/{utils/sanitizer-utils/src/sanitizer-utils.d.ts → types/tekus-design-system-utils-sanitizer-utils.d.ts} +5 -3
- package/types/tekus-design-system.d.ts +2 -0
- package/components/autocomplete/index.d.ts +0 -5
- package/components/autocomplete/public-api.d.ts +0 -1
- package/components/badge/index.d.ts +0 -5
- package/components/badge/public-api.d.ts +0 -1
- package/components/button/index.d.ts +0 -5
- package/components/button/public-api.d.ts +0 -1
- package/components/checkbox/index.d.ts +0 -5
- package/components/checkbox/public-api.d.ts +0 -1
- package/components/date-picker/index.d.ts +0 -5
- package/components/date-picker/public-api.d.ts +0 -1
- package/components/drawer/index.d.ts +0 -5
- package/components/drawer/public-api.d.ts +0 -3
- package/components/drawer/src/drawer.types.d.ts +0 -22
- package/components/drawer/src/services/drawer.service.d.ts +0 -15
- package/components/fallback-view/index.d.ts +0 -5
- package/components/fallback-view/public-api.d.ts +0 -1
- package/components/icon/core/icon-catalog.d.ts +0 -76
- package/components/icon/core/icons/ads.icons.d.ts +0 -2
- package/components/icon/core/icons/angle.icons.d.ts +0 -2
- package/components/icon/core/icons/arrow.icons.d.ts +0 -2
- package/components/icon/core/icons/arrows-rotate.d.ts +0 -2
- package/components/icon/core/icons/bars.icons.d.ts +0 -2
- package/components/icon/core/icons/bolt.icons.d.ts +0 -2
- package/components/icon/core/icons/book.icons.d.ts +0 -2
- package/components/icon/core/icons/calendar.icons.d.ts +0 -2
- package/components/icon/core/icons/camera.icons.d.ts +0 -2
- package/components/icon/core/icons/chart.icons.d.ts +0 -2
- package/components/icon/core/icons/check.icons.d.ts +0 -2
- package/components/icon/core/icons/chevron.icons.d.ts +0 -2
- package/components/icon/core/icons/circle.icons.d.ts +0 -2
- package/components/icon/core/icons/clock.icons.d.ts +0 -2
- package/components/icon/core/icons/clone.icons.d.ts +0 -2
- package/components/icon/core/icons/download.icons.d.ts +0 -2
- package/components/icon/core/icons/edit.d.ts +0 -2
- package/components/icon/core/icons/ellipsis.icons.d.ts +0 -2
- package/components/icon/core/icons/eye.icons.d.ts +0 -2
- package/components/icon/core/icons/filter.icons.d.ts +0 -2
- package/components/icon/core/icons/folders.icons.d.ts +0 -2
- package/components/icon/core/icons/gears.icons.d.ts +0 -2
- package/components/icon/core/icons/globe-pointer.d.ts +0 -2
- package/components/icon/core/icons/grip-vertical.d.ts +0 -2
- package/components/icon/core/icons/hand.icons.d.ts +0 -2
- package/components/icon/core/icons/language.icons.d.ts +0 -2
- package/components/icon/core/icons/layer.icons.d.ts +0 -2
- package/components/icon/core/icons/link.icons.d.ts +0 -2
- package/components/icon/core/icons/list.icons.d.ts +0 -2
- package/components/icon/core/icons/location.icons.d.ts +0 -2
- package/components/icon/core/icons/lock.icons.d.ts +0 -2
- package/components/icon/core/icons/magnifying-glass.icons.d.ts +0 -2
- package/components/icon/core/icons/media.icons.d.ts +0 -2
- package/components/icon/core/icons/megaphone.icons.d.ts +0 -2
- package/components/icon/core/icons/money.icons.d.ts +0 -2
- package/components/icon/core/icons/pen.icons.d.ts +0 -2
- package/components/icon/core/icons/pencil.icons.d.ts +0 -2
- package/components/icon/core/icons/plug.icons.d.ts +0 -2
- package/components/icon/core/icons/plus.icons.d.ts +0 -2
- package/components/icon/core/icons/qr-code.icons.d.ts +0 -2
- package/components/icon/core/icons/screwdriver-wrench.icons.d.ts +0 -2
- package/components/icon/core/icons/shuffle.icons.d.ts +0 -2
- package/components/icon/core/icons/square.icons.d.ts +0 -2
- package/components/icon/core/icons/tag.icons.d.ts +0 -2
- package/components/icon/core/icons/thumbs.icons.d.ts +0 -2
- package/components/icon/core/icons/trash.icons.d.ts +0 -2
- package/components/icon/core/icons/triangle.icons.d.ts +0 -2
- package/components/icon/core/icons/user.icons.d.ts +0 -2
- package/components/icon/core/icons/xmark.icons.d.ts +0 -2
- package/components/icon/core/svg-icons/ads-icon.svg.d.ts +0 -2
- package/components/icon/core/svg-icons/index.d.ts +0 -1
- package/components/icon/index.d.ts +0 -5
- package/components/icon/public-api.d.ts +0 -2
- package/components/icon/src/icon.component.d.ts +0 -79
- package/components/input-number/index.d.ts +0 -5
- package/components/input-number/public-api.d.ts +0 -1
- package/components/input-text/index.d.ts +0 -5
- package/components/input-text/public-api.d.ts +0 -1
- package/components/modal/index.d.ts +0 -5
- package/components/modal/public-api.d.ts +0 -3
- package/components/modal/src/modal.component.d.ts +0 -118
- package/components/modal/src/modal.types.d.ts +0 -39
- package/components/modal/src/services/modal.service.d.ts +0 -31
- package/components/multiselect/index.d.ts +0 -5
- package/components/multiselect/public-api.d.ts +0 -2
- package/components/multiselect/src/multiselect.types.d.ts +0 -4
- package/components/pagination/index.d.ts +0 -5
- package/components/pagination/public-api.d.ts +0 -1
- package/components/panel/index.d.ts +0 -5
- package/components/panel/public-api.d.ts +0 -1
- package/components/radio-button/index.d.ts +0 -5
- package/components/radio-button/public-api.d.ts +0 -1
- package/components/select/index.d.ts +0 -5
- package/components/select/public-api.d.ts +0 -1
- package/components/table/index.d.ts +0 -5
- package/components/table/public-api.d.ts +0 -2
- package/components/table/src/table.interface.d.ts +0 -14
- package/components/tabs/index.d.ts +0 -5
- package/components/tabs/public-api.d.ts +0 -2
- package/components/tabs/src/tabs.interface.d.ts +0 -11
- package/components/tag/index.d.ts +0 -5
- package/components/tag/public-api.d.ts +0 -1
- package/components/textarea/index.d.ts +0 -5
- package/components/textarea/public-api.d.ts +0 -1
- package/components/toolbar/index.d.ts +0 -5
- package/components/toolbar/public-api.d.ts +0 -1
- package/components/tooltip/index.d.ts +0 -5
- package/components/tooltip/public-api.d.ts +0 -1
- package/components/tooltip/src/tooltip.component.d.ts +0 -35
- package/components/topbar/index.d.ts +0 -5
- package/components/topbar/public-api.d.ts +0 -2
- package/components/topbar/src/topbar.component.d.ts +0 -20
- package/components/topbar/src/topbar.types.d.ts +0 -13
- package/core/index.d.ts +0 -5
- package/core/public-api.d.ts +0 -1
- package/core/types/index.d.ts +0 -5
- package/core/types/public-api.d.ts +0 -10
- package/core/types/src/branding/branding.types.d.ts +0 -15
- package/core/types/src/branding/index.d.ts +0 -1
- package/core/types/src/breakpoints/breakpoints.d.ts +0 -10
- package/core/types/src/breakpoints/index.d.ts +0 -1
- package/core/types/src/grids/grid.enum.d.ts +0 -18
- package/core/types/src/grids/grid.model.d.ts +0 -10
- package/core/types/src/grids/grid.type.d.ts +0 -40
- package/core/types/src/grids/index.d.ts +0 -3
- package/core/types/src/illustration-config/illustration-config.model.d.ts +0 -4
- package/core/types/src/illustration-config/index.d.ts +0 -1
- package/core/types/src/interception/index.d.ts +0 -1
- package/core/types/src/interception/interception.types.d.ts +0 -21
- package/core/types/src/option/index.d.ts +0 -1
- package/core/types/src/option/option.model.d.ts +0 -8
- package/core/types/src/theme/theme.provider.d.ts +0 -1
- package/core/types/src/theme/tk-preset.d.ts +0 -1
- package/core/types/src/typography-styles/index.d.ts +0 -1
- package/core/types/src/typography-styles/typographyStyles.model.d.ts +0 -36
- package/core/types/src/validator-with-message/index.d.ts +0 -1
- package/core/types/src/validator-with-message/validator-with-message.model.d.ts +0 -5
- package/directives/gird-item/index.d.ts +0 -5
- package/directives/gird-item/public-api.d.ts +0 -1
- package/index.d.ts +0 -1
- package/utils/sanitizer-utils/index.d.ts +0 -5
- package/utils/sanitizer-utils/public-api.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-select.mjs","sources":["../../../projects/design-system/components/select/src/select.component.ts","../../../projects/design-system/components/select/src/select.component.html","../../../projects/design-system/components/select/tekus-design-system-components-select.ts"],"sourcesContent":["import {\n Component,\n effect,\n model,\n\n input,\n output,\n signal,\n inject\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n FormControl,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { FloatLabelModule } from 'primeng/floatlabel';\nimport { Select } from 'primeng/select';\nimport { MessageModule } from 'primeng/message';\n\n@Component({\n selector: 'tk-select',\n imports: [FormsModule, Select, FloatLabelModule, MessageModule, ReactiveFormsModule],\n templateUrl: './select.component.html',\n styleUrl: './select.component.scss',\n\n})\nexport class SelectComponent<T = unknown> implements ControlValueAccessor {\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n /**\n * @property {string} id\n * @description\n * HTML id attribute for the multiselect input.\n *\n * @default 'select'\n */\n id = input<string>('select');\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the input value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>();\n\n /**\n * @property {T[]} options\n * @description\n * Array of available options displayed in the dropdown.\n */\n options = input<T[]>([]);\n\n /**\n * @property {string} optionLabel\n * @description\n * Name of the property used to display the text of each option.\n *\n * @default 'label'\n */\n optionLabel = input<string>('label');\n\n /**\n * @property {string} label\n * @description\n * Floating label displayed above the select input.\n */\n label = input<string>('');\n\n /**\n * @property {boolean} showClear\n * @description\n * Enables the clear button to remove the current selection.\n *\n * @default true\n */\n showClear = input<boolean>(true);\n\n /**\n * @property {T | null} value\n * @description\n * Internal selected value. Synced with Angular forms and the model signal.\n *\n * @internal\n */\n value: T | null = null;\n\n /**\n * @property {boolean} disabled\n * @description\n * Determines whether the select field is disabled.\n *\n * @default false\n */\n disabled = input<boolean>(false);\n internalDisabled = signal(false);\n\n /**\n * @property {InputSignal<string>} errorMessage\n * @description\n * Message to display when the control is invalid and touched.\n */\n errorMessage = input<string>('');\n\n /**\n * @property {InputSignal<string>} hint\n * @description\n * Hint text to display below the input.\n */\n hint = input<string>('');\n\n /**\n * @property {Signal<T | null>} model\n * @description\n * Two-way binding model using Angular signals.\n * Allows usage with the syntax: `[(model)]=\"myValue\"`.\n */\n model = model<T | null>();\n\n /**\n * @event modelChange\n * @description\n * Emits whenever the value changes.\n * Payload: the selected item of type `T` or `null`.\n *\n * @example\n * <tk-select (modelChange)=\"onChange($event)\"></tk-select>\n */\n modelChange = output<T | null>();\n\n // CVA callbacks\n private onChangeFn: (value: T | null) => void = () => {};\n private onTouchedFn = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n /**\n * @effect disabled → internalDisabled\n * @description\n * Synchronizes the disabled input signal with the internal disabled state.\n */\n effect(() => {\n this.internalDisabled.set(this.disabled());\n });\n\n /**\n * @effect model → internal value\n * @description\n * Synchronizes changes coming from the Signal `model()` back into the internal value.\n * Ensures consistency between Angular Forms, PrimeNG UI events, and Signals.\n */\n effect(() => {\n const v = this.model();\n if (v !== this.value) {\n this.value = v ?? null;\n this.onChangeFn(v ?? null);\n }\n });\n }\n\n // -----------------------------------\n // CONTROL VALUE ACCESSOR (Forms API)\n // -----------------------------------\n\n /**\n * @method writeValue\n * @description\n * Receives value updates from Angular Forms and writes them into the component.\n *\n * @param {T | null} value - New value from the forms API.\n */\n writeValue(value: T | null): void {\n this.model.set(value);\n }\n\n /**\n * @method registerOnChange\n * @description\n * Registers a callback that is invoked when the component's value changes.\n */\n registerOnChange(fn: (value: T | null) => void): void {\n this.onChangeFn = fn;\n }\n\n /**\n * @method registerOnTouched\n * @description\n * Registers a callback invoked when the component is touched.\n */\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n /**\n * @method setDisabledState\n * @description\n * Updates the disabled state of the select control.\n *\n * @param {boolean} isDisabled - Whether the component should be disabled.\n */\n setDisabledState(isDisabled: boolean): void {\n this.internalDisabled.set(isDisabled);\n }\n\n // -----------------------------------\n // UI EVENTS\n // -----------------------------------\n\n /**\n * @method handleChange\n * @description\n * Handles the selection event emitted by the PrimeNG Select component.\n * Updates Angular Forms, Signals, and emits the modelChange event.\n *\n * @param event - Event containing the `value` of the selected option.\n */\n handleChange(event: { value: T | null }) {\n const value = event.value ?? null;\n\n this.value = value;\n\n this.onChangeFn(value);\n this.onTouchedFn();\n\n this.model.set(value);\n\n this.modelChange.emit(value);\n\n if (this.effectiveControl) {\n this.effectiveControl.setValue(value);\n this.effectiveControl.markAsDirty();\n this.effectiveControl.markAsTouched();\n }\n }\n get effectiveControl() {\n return (this.ngControl?.control as FormControl) || null;\n }\n}\n\n","<p-floatlabel class=\"w-full\">\n <p-select\n [id]=\"id()\"\n class=\"w-full\"\n [options]=\"options()\"\n [optionLabel]=\"optionLabel()\"\n [showClear]=\"showClear()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"value\"\n [class.ng-invalid]=\"\n effectiveControl?.invalid &&\n (effectiveControl?.dirty || effectiveControl?.touched)\n \"\n [class.ng-dirty]=\"effectiveControl?.dirty\"\n [class.ng-touched]=\"effectiveControl?.touched\"\n (onChange)=\"handleChange($event)\" />\n <label [for]=\"id()\">{{ label() }}</label>\n</p-floatlabel>\n\n<div class=\"tk-select-bottom\">\n <div class=\"tk-select-messages\">\n @if (\n effectiveControl?.invalid &&\n (effectiveControl?.dirty || effectiveControl?.touched) &&\n errorMessage()\n ) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\"simple\">{{\n hint()\n }}</p-message>\n }\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;MA4Ba,eAAe,CAAA;AA2G1B,IAAA,WAAA,GAAA;AA1GS,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACtE;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAS,QAAQ,CAAC;AAE5B;;;;;AAKG;QACH,IAAO,CAAA,OAAA,GAAG,KAAK,EAAe;AAE9B;;;;AAIG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAM,EAAE,CAAC;AAExB;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAS,OAAO,CAAC;AAEpC;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AAEzB;;;;;;AAMG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAU,IAAI,CAAC;AAE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,UAAA,EAAA,CAAA;kBAP3B,SAAS;+BACE,WAAW,EAAA,OAAA,EACZ,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,CAAC,EAAA,QAAA,EAAA,skCAAA,EAAA,MAAA,EAAA,CAAA,m7FAAA,CAAA,EAAA;;;AEvBtF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-select.mjs","sources":["../../../projects/design-system/components/select/src/select.component.ts","../../../projects/design-system/components/select/src/select.component.html","../../../projects/design-system/components/select/tekus-design-system-components-select.ts"],"sourcesContent":["import {\n Component,\n effect,\n model,\n\n input,\n output,\n signal,\n inject\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormsModule,\n NgControl,\n FormControl,\n ReactiveFormsModule\n} from '@angular/forms';\nimport { FloatLabelModule } from 'primeng/floatlabel';\nimport { Select } from 'primeng/select';\nimport { MessageModule } from 'primeng/message';\n\n@Component({\n selector: 'tk-select',\n imports: [FormsModule, Select, FloatLabelModule, MessageModule, ReactiveFormsModule],\n templateUrl: './select.component.html',\n styleUrl: './select.component.scss',\n\n})\nexport class SelectComponent<T = unknown> implements ControlValueAccessor {\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n /**\n * @property {string} id\n * @description\n * HTML id attribute for the multiselect input.\n *\n * @default 'select'\n */\n id = input<string>('select');\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the input value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>();\n\n /**\n * @property {T[]} options\n * @description\n * Array of available options displayed in the dropdown.\n */\n options = input<T[]>([]);\n\n /**\n * @property {string} optionLabel\n * @description\n * Name of the property used to display the text of each option.\n *\n * @default 'label'\n */\n optionLabel = input<string>('label');\n\n /**\n * @property {string} label\n * @description\n * Floating label displayed above the select input.\n */\n label = input<string>('');\n\n /**\n * @property {boolean} showClear\n * @description\n * Enables the clear button to remove the current selection.\n *\n * @default true\n */\n showClear = input<boolean>(true);\n\n /**\n * @property {T | null} value\n * @description\n * Internal selected value. Synced with Angular forms and the model signal.\n *\n * @internal\n */\n value: T | null = null;\n\n /**\n * @property {boolean} disabled\n * @description\n * Determines whether the select field is disabled.\n *\n * @default false\n */\n disabled = input<boolean>(false);\n internalDisabled = signal(false);\n\n /**\n * @property {InputSignal<string>} errorMessage\n * @description\n * Message to display when the control is invalid and touched.\n */\n errorMessage = input<string>('');\n\n /**\n * @property {InputSignal<string>} hint\n * @description\n * Hint text to display below the input.\n */\n hint = input<string>('');\n\n /**\n * @property {Signal<T | null>} model\n * @description\n * Two-way binding model using Angular signals.\n * Allows usage with the syntax: `[(model)]=\"myValue\"`.\n */\n model = model<T | null>();\n\n /**\n * @event modelChange\n * @description\n * Emits whenever the value changes.\n * Payload: the selected item of type `T` or `null`.\n *\n * @example\n * <tk-select (modelChange)=\"onChange($event)\"></tk-select>\n */\n modelChange = output<T | null>();\n\n // CVA callbacks\n private onChangeFn: (value: T | null) => void = () => {};\n private onTouchedFn = () => {};\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n /**\n * @effect disabled → internalDisabled\n * @description\n * Synchronizes the disabled input signal with the internal disabled state.\n */\n effect(() => {\n this.internalDisabled.set(this.disabled());\n });\n\n /**\n * @effect model → internal value\n * @description\n * Synchronizes changes coming from the Signal `model()` back into the internal value.\n * Ensures consistency between Angular Forms, PrimeNG UI events, and Signals.\n */\n effect(() => {\n const v = this.model();\n if (v !== this.value) {\n this.value = v ?? null;\n this.onChangeFn(v ?? null);\n }\n });\n }\n\n // -----------------------------------\n // CONTROL VALUE ACCESSOR (Forms API)\n // -----------------------------------\n\n /**\n * @method writeValue\n * @description\n * Receives value updates from Angular Forms and writes them into the component.\n *\n * @param {T | null} value - New value from the forms API.\n */\n writeValue(value: T | null): void {\n this.model.set(value);\n }\n\n /**\n * @method registerOnChange\n * @description\n * Registers a callback that is invoked when the component's value changes.\n */\n registerOnChange(fn: (value: T | null) => void): void {\n this.onChangeFn = fn;\n }\n\n /**\n * @method registerOnTouched\n * @description\n * Registers a callback invoked when the component is touched.\n */\n registerOnTouched(fn: () => void): void {\n this.onTouchedFn = fn;\n }\n\n /**\n * @method setDisabledState\n * @description\n * Updates the disabled state of the select control.\n *\n * @param {boolean} isDisabled - Whether the component should be disabled.\n */\n setDisabledState(isDisabled: boolean): void {\n this.internalDisabled.set(isDisabled);\n }\n\n // -----------------------------------\n // UI EVENTS\n // -----------------------------------\n\n /**\n * @method handleChange\n * @description\n * Handles the selection event emitted by the PrimeNG Select component.\n * Updates Angular Forms, Signals, and emits the modelChange event.\n *\n * @param event - Event containing the `value` of the selected option.\n */\n handleChange(event: { value: T | null }) {\n const value = event.value ?? null;\n\n this.value = value;\n\n this.onChangeFn(value);\n this.onTouchedFn();\n\n this.model.set(value);\n\n this.modelChange.emit(value);\n\n if (this.effectiveControl) {\n this.effectiveControl.setValue(value);\n this.effectiveControl.markAsDirty();\n this.effectiveControl.markAsTouched();\n }\n }\n get effectiveControl(): FormControl | null {\n return (this.ngControl?.control as FormControl) || null;\n }\n}\n\n","<p-floatlabel class=\"w-full\">\n <p-select [id]=\"id()\" class=\"w-full\" [options]=\"options()\" [optionLabel]=\"optionLabel()\" [showClear]=\"showClear()\"\n [disabled]=\"disabled()\" [ngModel]=\"value\" [class.ng-invalid]=\"\n effectiveControl?.invalid &&\n (effectiveControl?.dirty || effectiveControl?.touched)\n \" [class.ng-dirty]=\"effectiveControl?.dirty\" [class.ng-touched]=\"effectiveControl?.touched\"\n (onChange)=\"handleChange($event)\" />\n <label [for]=\"id()\">{{ label() }}</label>\n</p-floatlabel>\n\n<div class=\"tk-select-bottom\">\n <div class=\"tk-select-messages\">\n @if (\n effectiveControl?.invalid &&\n (effectiveControl?.dirty || effectiveControl?.touched) &&\n errorMessage()\n ) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n } @else if (hint()) {\n <p-message severity=\"secondary\" size=\"small\" variant=\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([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
40
40
|
/**
|
|
41
41
|
* @property {InputSignal<TableColumn<T>[]>} columns
|
|
42
42
|
* @description
|
|
@@ -52,25 +52,25 @@ class TableComponent {
|
|
|
52
52
|
* { field: 'status', header: 'Status', renderAs: 'tag' }
|
|
53
53
|
* ]"
|
|
54
54
|
*/
|
|
55
|
-
this.columns = input([]);
|
|
55
|
+
this.columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
56
56
|
/**
|
|
57
57
|
* @property {InputSignal<'single' | 'multiple' | undefined>} selectionMode
|
|
58
58
|
* @description
|
|
59
59
|
* Selection mode of the table.
|
|
60
60
|
*/
|
|
61
|
-
this.selectionMode = input(undefined);
|
|
61
|
+
this.selectionMode = input(undefined, ...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
62
62
|
/**
|
|
63
63
|
* @property {ModelSignal<any[]>} selection
|
|
64
64
|
* @description
|
|
65
65
|
* Selected row(s) in the table.
|
|
66
66
|
*/
|
|
67
|
-
this.selection = model([]);
|
|
67
|
+
this.selection = model([], ...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
68
68
|
/**
|
|
69
69
|
* @property {InputSignal<string | undefined>} dataKey
|
|
70
70
|
* @description
|
|
71
71
|
* Property name to uniquely identify a row.
|
|
72
72
|
*/
|
|
73
|
-
this.dataKey = input(undefined);
|
|
73
|
+
this.dataKey = input(undefined, ...(ngDevMode ? [{ debugName: "dataKey" }] : /* istanbul ignore next */ []));
|
|
74
74
|
this.initialData = [...this.data()];
|
|
75
75
|
this.internalData = [];
|
|
76
76
|
this.isSorted = null;
|
|
@@ -86,7 +86,7 @@ class TableComponent {
|
|
|
86
86
|
return false;
|
|
87
87
|
// We strictly use full objects for selection now.
|
|
88
88
|
return data.every(row => selected.includes(row));
|
|
89
|
-
});
|
|
89
|
+
}, ...(ngDevMode ? [{ debugName: "isAllSelected" }] : /* istanbul ignore next */ []));
|
|
90
90
|
/**
|
|
91
91
|
* @computed isPartiallySelected
|
|
92
92
|
* @description
|
|
@@ -99,7 +99,7 @@ class TableComponent {
|
|
|
99
99
|
return false;
|
|
100
100
|
const allSelected = this.isAllSelected();
|
|
101
101
|
return !allSelected && selected.length > 0;
|
|
102
|
-
});
|
|
102
|
+
}, ...(ngDevMode ? [{ debugName: "isPartiallySelected" }] : /* istanbul ignore next */ []));
|
|
103
103
|
/**
|
|
104
104
|
* @effect data → initialData sync
|
|
105
105
|
* @description
|
|
@@ -175,10 +175,10 @@ class TableComponent {
|
|
|
175
175
|
return (event.order ?? 1) * result;
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
179
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
178
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
179
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", 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 }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selection: "selectionChange" }, viewQueries: [{ propertyName: "tableRef", first: true, predicate: ["tableRef"], descendants: true }], ngImport: i0, template: "<p-table #tableRef [selection]=\"selection()\" (selectionChange)=\"updateSelection($any($event))\"\n [selectionMode]=\"selectionMode()\" [dataKey]=\"dataKey()\" [value]=\"internalData\" [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\" [tableStyle]=\"{ 'min-width': '60rem' }\" responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th [id]=\"col.field\" [style.width]=\"col.width\" [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div class=\"tk-table__header-content\">\n @if (col.type === 'selection' && selectionMode() === 'multiple') {\n <div class=\"tk-table__actions hide-validation-messages\">\n <tk-checkbox [binary]=\"true\" [model]=\"isAllSelected()\" [indeterminate]=\"isPartiallySelected()\"\n (click)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\"\n (modelChange)=\"toggleAll($event)\"></tk-checkbox>\n </div>\n } @else if (col.type !== 'selection') {\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr [pSelectableRow]=\"row\">\n @for (col of columns(); track col.header) {\n <!-- SELECTION -->\n @if (col.type === 'selection') {\n <td>\n @if (selectionMode() === 'multiple') {\n <tk-checkbox [model]=\"selection()\" [value]=\"row\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (modelChange)=\"updateSelection($any($event))\"></tk-checkbox>\n }\n </td>\n }\n\n <!-- CHECKBOX (Boolean field) -->\n @if (col.type === 'checkbox') {\n <td>\n <tk-checkbox [binary]=\"true\" [(model)]=\"row[col.field!]\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"></tk-checkbox>\n </td>\n }\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 [icon]=\"action.icon\" severity=\"secondary\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n }\n }\n </tr>\n </ng-template>\n</p-table>", 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", "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", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "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: "directive", type: i1.SelectableRow, selector: "[pSelectableRow]", inputs: ["pSelectableRow", "pSelectableRowIndex", "pSelectableRowDisabled"] }, { 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"] }, { kind: "component", type: CheckboxComponent, selector: "tk-checkbox", inputs: ["model", "value", "label", "name", "inputId", "binary", "control", "errorMessage", "indeterminate", "disabled"], outputs: ["modelChange", "indeterminateChange", "disabledChange"] }] }); }
|
|
180
180
|
}
|
|
181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TableComponent, decorators: [{
|
|
182
182
|
type: Component,
|
|
183
183
|
args: [{ selector: 'tk-table', standalone: true, imports: [
|
|
184
184
|
TableModule,
|
|
@@ -187,11 +187,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
|
|
|
187
187
|
TagComponent,
|
|
188
188
|
ButtonComponent,
|
|
189
189
|
CheckboxComponent,
|
|
190
|
-
], template: "<p-table
|
|
191
|
-
}], ctorParameters: () => [], propDecorators: { tableRef: [{
|
|
190
|
+
], template: "<p-table #tableRef [selection]=\"selection()\" (selectionChange)=\"updateSelection($any($event))\"\n [selectionMode]=\"selectionMode()\" [dataKey]=\"dataKey()\" [value]=\"internalData\" [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\" [tableStyle]=\"{ 'min-width': '60rem' }\" responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th [id]=\"col.field\" [style.width]=\"col.width\" [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div class=\"tk-table__header-content\">\n @if (col.type === 'selection' && selectionMode() === 'multiple') {\n <div class=\"tk-table__actions hide-validation-messages\">\n <tk-checkbox [binary]=\"true\" [model]=\"isAllSelected()\" [indeterminate]=\"isPartiallySelected()\"\n (click)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\"\n (modelChange)=\"toggleAll($event)\"></tk-checkbox>\n </div>\n } @else if (col.type !== 'selection') {\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr [pSelectableRow]=\"row\">\n @for (col of columns(); track col.header) {\n <!-- SELECTION -->\n @if (col.type === 'selection') {\n <td>\n @if (selectionMode() === 'multiple') {\n <tk-checkbox [model]=\"selection()\" [value]=\"row\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (modelChange)=\"updateSelection($any($event))\"></tk-checkbox>\n }\n </td>\n }\n\n <!-- CHECKBOX (Boolean field) -->\n @if (col.type === 'checkbox') {\n <td>\n <tk-checkbox [binary]=\"true\" [(model)]=\"row[col.field!]\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"></tk-checkbox>\n </td>\n }\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 [icon]=\"action.icon\" severity=\"secondary\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n }\n }\n </tr>\n </ng-template>\n</p-table>", 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"] }]
|
|
191
|
+
}], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], tableRef: [{
|
|
192
192
|
type: ViewChild,
|
|
193
193
|
args: ['tableRef']
|
|
194
|
-
}] } });
|
|
194
|
+
}], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }] } });
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
197
|
* Generated bundle index. Do not edit.
|
|
@@ -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, computed, effect, input, model, 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 { SortEvent } from 'primeng/api';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\nimport { CheckboxComponent } from '@tekus/design-system/components/checkbox';\n\n@Component({\n selector: 'tk-table',\n standalone: true,\n imports: [\n TableModule,\n TagModule,\n ButtonModule,\n TagComponent,\n ButtonComponent,\n CheckboxComponent,\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 /**\n * @property {InputSignal<'single' | 'multiple' | undefined>} selectionMode\n * @description\n * Selection mode of the table.\n */\n selectionMode = input<'single' | 'multiple' | undefined>(undefined);\n\n /**\n * @property {ModelSignal<any[]>} selection\n * @description\n * Selected row(s) in the table.\n */\n selection = model<T[]>([]);\n\n /**\n * @property {InputSignal<string | undefined>} dataKey\n * @description\n * Property name to uniquely identify a row.\n */\n dataKey = input<string | undefined>(undefined);\n\n initialData: T[] = [...this.data()];\n internalData: T[] = [];\n isSorted: boolean | null = null;\n\n /**\n * @computed isAllSelected\n * @description\n * Returns true if all visible rows are selected.\n */\n isAllSelected = computed(() => {\n const data = this.internalData;\n const selected = this.selection();\n if (data.length === 0 || selected.length === 0) return false;\n \n // We strictly use full objects for selection now.\n return data.every(row => selected.includes(row));\n });\n\n /**\n * @computed isPartiallySelected\n * @description\n * Returns true if some but not all rows are selected.\n */\n isPartiallySelected = computed(() => {\n const data = this.internalData;\n const selected = this.selection();\n if (data.length === 0 || selected.length === 0) return false;\n \n const allSelected = this.isAllSelected();\n return !allSelected && selected.length > 0;\n });\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 /**\n * @method toggleAll\n * @description\n * Toggles selection of all visible rows using full objects.\n * @param checked {unknown}\n */\n toggleAll(checked: unknown) {\n if (checked) {\n this.selection.set([...this.internalData]);\n } else {\n this.selection.set([]);\n }\n }\n\n /**\n * @method updateSelection\n * @description\n * Updates row selection state from checkbox interaction.\n * @param value {any[]}\n */\n updateSelection(value: T[]) {\n this.selection.set([...value]);\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 [selection]=\"selection()\"\n (selectionChange)=\"updateSelection($any($event))\"\n [selectionMode]=\"selectionMode()\"\n [dataKey]=\"dataKey()\"\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 class=\"tk-table__header-content\">\n @if (col.type === 'selection' && selectionMode() === 'multiple') {\n <div class=\"tk-table__actions hide-validation-messages\" >\n <tk-checkbox\n [binary]=\"true\"\n [model]=\"isAllSelected()\"\n [indeterminate]=\"isPartiallySelected()\"\n (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"\n (modelChange)=\"toggleAll($event)\"></tk-checkbox>\n </div>\n } @else if (col.type !== 'selection') {\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr [pSelectableRow]=\"row\">\n @for (col of columns(); track col.header) {\n <!-- SELECTION -->\n @if (col.type === 'selection') {\n <td>\n @if (selectionMode() === 'multiple') {\n <tk-checkbox\n [model]=\"selection()\"\n [value]=\"row\"\n (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"\n (modelChange)=\"updateSelection($any($event))\"></tk-checkbox>\n }\n </td>\n }\n\n <!-- CHECKBOX (Boolean field) -->\n @if (col.type === 'checkbox') {\n <td>\n <tk-checkbox\n [binary]=\"true\"\n [(model)]=\"row[col.field!]\"\n (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"></tk-checkbox>\n </td>\n }\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\n [value]=\"row[col.field!]\"\n [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]=\"action.icon\"\n severity=\"secondary\"\n (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"\n (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n }\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;AAgGzB,IAAA,WAAA,GAAA;AA/FA;;;;;;;;;;;;;AAaG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAM,EAAE,CAAC;AAWrB;;;;;;;;;;;;;;AAcG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAmB,EAAE,CAAC;AAErC;;;;AAIG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAoC,SAAS,CAAC;AAEnE;;;;AAIG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAM,EAAE,CAAC;AAE1B;;;;AAIG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAqB,SAAS,CAAC;QAE9C,IAAW,CAAA,WAAA,GAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnC,IAAY,CAAA,YAAA,GAAQ,EAAE;QACtB,IAAQ,CAAA,QAAA,GAAmB,IAAI;AAE/B;;;;AAIG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAK;AAC5B,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY;AAC9B,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE;YACjC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;AAAE,gBAAA,OAAO,KAAK;;AAG5D,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,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,EACT,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,EACZ,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,YAAY,EACZ,QAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,UAAA,EAAA,iBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,eAAe,yKACf,iBAAiB,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,OAAA,EAAA,OAAA,EAAA,MAAA,EAAA,SAAA,EAAA,QAAA,EAAA,SAAA,EAAA,cAAA,EAAA,eAAA,EAAA,UAAA,CAAA,EAAA,OAAA,EAAA,CAAA,aAAA,EAAA,qBAAA,EAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAgBR,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,eAAe;wBACf,iBAAiB;AAClB,qBAAA,EAAA,QAAA,EAAA,k3GAAA,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, computed, effect, input, model, 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 { SortEvent } from 'primeng/api';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\nimport { CheckboxComponent } from '@tekus/design-system/components/checkbox';\n\n@Component({\n selector: 'tk-table',\n standalone: true,\n imports: [\n TableModule,\n TagModule,\n ButtonModule,\n TagComponent,\n ButtonComponent,\n CheckboxComponent,\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 /**\n * @property {InputSignal<'single' | 'multiple' | undefined>} selectionMode\n * @description\n * Selection mode of the table.\n */\n selectionMode = input<'single' | 'multiple' | undefined>(undefined);\n\n /**\n * @property {ModelSignal<any[]>} selection\n * @description\n * Selected row(s) in the table.\n */\n selection = model<T[]>([]);\n\n /**\n * @property {InputSignal<string | undefined>} dataKey\n * @description\n * Property name to uniquely identify a row.\n */\n dataKey = input<string | undefined>(undefined);\n\n initialData: T[] = [...this.data()];\n internalData: T[] = [];\n isSorted: boolean | null = null;\n\n /**\n * @computed isAllSelected\n * @description\n * Returns true if all visible rows are selected.\n */\n isAllSelected = computed(() => {\n const data = this.internalData;\n const selected = this.selection();\n if (data.length === 0 || selected.length === 0) return false;\n\n // We strictly use full objects for selection now.\n return data.every(row => selected.includes(row));\n });\n\n /**\n * @computed isPartiallySelected\n * @description\n * Returns true if some but not all rows are selected.\n */\n isPartiallySelected = computed(() => {\n const data = this.internalData;\n const selected = this.selection();\n if (data.length === 0 || selected.length === 0) return false;\n\n const allSelected = this.isAllSelected();\n return !allSelected && selected.length > 0;\n });\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 /**\n * @method toggleAll\n * @description\n * Toggles selection of all visible rows using full objects.\n * @param checked {unknown}\n */\n toggleAll(checked: unknown) {\n if (checked) {\n this.selection.set([...this.internalData]);\n } else {\n this.selection.set([]);\n }\n }\n\n /**\n * @method updateSelection\n * @description\n * Updates row selection state from checkbox interaction.\n * @param value {any[]}\n */\n updateSelection(value: T[]) {\n this.selection.set([...value]);\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 #tableRef [selection]=\"selection()\" (selectionChange)=\"updateSelection($any($event))\"\n [selectionMode]=\"selectionMode()\" [dataKey]=\"dataKey()\" [value]=\"internalData\" [customSort]=\"true\"\n (sortFunction)=\"customSort($event)\" [tableStyle]=\"{ 'min-width': '60rem' }\" responsiveLayout=\"scroll\">\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr>\n @for (col of columns(); track col.header) {\n <th [id]=\"col.field\" [style.width]=\"col.width\" [pSortableColumn]=\"col.sortable ? col.field : undefined\">\n <div class=\"tk-table__header-content\">\n @if (col.type === 'selection' && selectionMode() === 'multiple') {\n <div class=\"tk-table__actions hide-validation-messages\">\n <tk-checkbox [binary]=\"true\" [model]=\"isAllSelected()\" [indeterminate]=\"isPartiallySelected()\"\n (click)=\"$event.stopPropagation()\" (keypress)=\"$event.stopPropagation()\"\n (modelChange)=\"toggleAll($event)\"></tk-checkbox>\n </div>\n } @else if (col.type !== 'selection') {\n {{ col.header }}\n @if (col.sortable) {\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\n }\n }\n </div>\n </th>\n }\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-row>\n <tr [pSelectableRow]=\"row\">\n @for (col of columns(); track col.header) {\n <!-- SELECTION -->\n @if (col.type === 'selection') {\n <td>\n @if (selectionMode() === 'multiple') {\n <tk-checkbox [model]=\"selection()\" [value]=\"row\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (modelChange)=\"updateSelection($any($event))\"></tk-checkbox>\n }\n </td>\n }\n\n <!-- CHECKBOX (Boolean field) -->\n @if (col.type === 'checkbox') {\n <td>\n <tk-checkbox [binary]=\"true\" [(model)]=\"row[col.field!]\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\"></tk-checkbox>\n </td>\n }\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 [icon]=\"action.icon\" severity=\"secondary\" (click)=\"$event.stopPropagation()\"\n (keypress)=\"$event.stopPropagation()\" (clicked)=\"action?.action(row)\"></tk-button>\n }\n </div>\n </td>\n }\n }\n </tr>\n </ng-template>\n</p-table>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAwBA;;;;;;;;;;AAUG;MACU,cAAc,CAAA;AAgGzB,IAAA,WAAA,GAAA;AA/FA;;;;;;;;;;;;;AAaG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAM,EAAE,2EAAC;AAWrB;;;;;;;;;;;;;;AAcG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAmB,EAAE,8EAAC;AAErC;;;;AAIG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAoC,SAAS,oFAAC;AAEnE;;;;AAIG;AACH,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAM,EAAE,gFAAC;AAE1B;;;;AAIG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAqB,SAAS,8EAAC;QAE9C,IAAA,CAAA,WAAW,GAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACnC,IAAA,CAAA,YAAY,GAAQ,EAAE;QACtB,IAAA,CAAA,QAAQ,GAAmB,IAAI;AAE/B;;;;AAIG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAAC,MAAK;AAC5B,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY;AAC9B,YAAA,MA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
2
|
+
import { input, model, output, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import * as i1 from 'primeng/tabs';
|
|
6
5
|
import { TabsModule } from 'primeng/tabs';
|
|
7
6
|
import { TooltipComponent } from '@tekus/design-system/components/tooltip';
|
|
8
7
|
import { BadgeComponent } from '@tekus/design-system/components/badge';
|
|
@@ -14,14 +13,14 @@ class TabsComponent {
|
|
|
14
13
|
* @description
|
|
15
14
|
* Array of tab configurations to display.
|
|
16
15
|
*/
|
|
17
|
-
this.tabs = input([]);
|
|
16
|
+
this.tabs = input([], ...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
18
17
|
/**
|
|
19
18
|
* @property {ModelSignal<number>} activeIndex
|
|
20
19
|
* @description
|
|
21
20
|
* The index of the currently active tab. Supports two-way binding via signals.
|
|
22
21
|
* @default 0
|
|
23
22
|
*/
|
|
24
|
-
this.activeIndex = model(0);
|
|
23
|
+
this.activeIndex = model(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
25
24
|
/**
|
|
26
25
|
* @event tabChange
|
|
27
26
|
* @description
|
|
@@ -32,12 +31,6 @@ class TabsComponent {
|
|
|
32
31
|
* <tk-tabs (tabChange)="onTabChange($event)"></tk-tabs>
|
|
33
32
|
*/
|
|
34
33
|
this.tabChange = output();
|
|
35
|
-
/**
|
|
36
|
-
* @property {ViewChild<TabsComponent>} tkTabs
|
|
37
|
-
* @description
|
|
38
|
-
* Reference to the tabs component for programmatic access.
|
|
39
|
-
*/
|
|
40
|
-
this.tkTabs = viewChild('tkTabs');
|
|
41
34
|
}
|
|
42
35
|
/**
|
|
43
36
|
* @method visibleTabs
|
|
@@ -55,19 +48,23 @@ class TabsComponent {
|
|
|
55
48
|
* @param {number} index - The index of the newly selected tab.
|
|
56
49
|
*/
|
|
57
50
|
onTabChange(index) {
|
|
51
|
+
if (this.activeIndex() === index)
|
|
52
|
+
return;
|
|
58
53
|
this.activeIndex.set(index);
|
|
59
|
-
this.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
if (this.visibleTabs[index]) {
|
|
55
|
+
this.tabChange.emit({
|
|
56
|
+
index,
|
|
57
|
+
tab: this.visibleTabs[index],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
63
60
|
}
|
|
64
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
65
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
61
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
62
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.3", type: TabsComponent, isStandalone: true, selector: "tk-tabs", inputs: { tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, activeIndex: { classPropertyName: "activeIndex", publicName: "activeIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeIndex: "activeIndexChange", tabChange: "tabChange" }, ngImport: i0, template: "<p-tabs [value]=\"activeIndex()\" (valueChange)=\"onTabChange($event !== undefined ? +$event : activeIndex())\"\n class=\"tk-tabs\">\n <p-tablist>\n @for (tab of visibleTabs; track $index) {\n <p-tab [value]=\"$index\" [disabled]=\"tab.disabled\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span class=\"tk-tab-label\" [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n }\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>", styles: [".tk-tabs{width:100%}.tk-tabs .p-tablist{display:flex;width:100%}.tk-tabs .tk-tab-label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);font-weight:var(--tk-font-weight-regular, 400)}:host ::ng-deep .p-tab{display:flex;align-items:center;gap:.5rem;padding:var(--tk-spacing-base-50, .5rem) var(--tk-spacing-base-100, 1rem);max-width:var(--tk-size-base-1000, 10rem)}:host ::ng-deep .p-tab-active{background-color:var(--tk-primary-100, #b7b0d2);color:var(--tk-primary-700, #10004f)}:host ::ng-deep .tk-tooltip-wrapper{display:flex!important}\n"], dependencies: [{ kind: "ngmodule", type: TabsModule }, { kind: "component", type: i1.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i1.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i1.TabPanel, selector: "p-tabpanel", inputs: ["lazy", "value"], outputs: ["valueChange"] }, { kind: "component", type: i1.TabList, selector: "p-tablist" }, { kind: "component", type: i1.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: TooltipComponent, selector: "tk-tooltip", inputs: ["content", "position"] }, { kind: "component", type: BadgeComponent, selector: "tk-badge", inputs: ["value", "severity"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
66
63
|
}
|
|
67
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TabsComponent, decorators: [{
|
|
68
65
|
type: Component,
|
|
69
|
-
args: [{ selector: 'tk-tabs', imports: [
|
|
70
|
-
}] });
|
|
66
|
+
args: [{ selector: 'tk-tabs', standalone: true, imports: [TabsModule, TooltipComponent, BadgeComponent, NgTemplateOutlet], template: "<p-tabs [value]=\"activeIndex()\" (valueChange)=\"onTabChange($event !== undefined ? +$event : activeIndex())\"\n class=\"tk-tabs\">\n <p-tablist>\n @for (tab of visibleTabs; track $index) {\n <p-tab [value]=\"$index\" [disabled]=\"tab.disabled\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span class=\"tk-tab-label\" [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n }\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>", styles: [".tk-tabs{width:100%}.tk-tabs .p-tablist{display:flex;width:100%}.tk-tabs .tk-tab-label{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--tk-surface-950, #191a1b);font-size:var(--tk-font-size-sm, .875rem);font-weight:var(--tk-font-weight-regular, 400)}:host ::ng-deep .p-tab{display:flex;align-items:center;gap:.5rem;padding:var(--tk-spacing-base-50, .5rem) var(--tk-spacing-base-100, 1rem);max-width:var(--tk-size-base-1000, 10rem)}:host ::ng-deep .p-tab-active{background-color:var(--tk-primary-100, #b7b0d2);color:var(--tk-primary-700, #10004f)}:host ::ng-deep .tk-tooltip-wrapper{display:flex!important}\n"] }]
|
|
67
|
+
}], propDecorators: { tabs: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabs", required: false }] }], activeIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeIndex", required: false }] }, { type: i0.Output, args: ["activeIndexChange"] }], tabChange: [{ type: i0.Output, args: ["tabChange"] }] } });
|
|
71
68
|
|
|
72
69
|
/**
|
|
73
70
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-tabs.mjs","sources":["../../../projects/design-system/components/tabs/src/tabs.component.ts","../../../projects/design-system/components/tabs/src/tabs.component.html","../../../projects/design-system/components/tabs/tekus-design-system-components-tabs.ts"],"sourcesContent":["import { Component, input, output, model
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-tabs.mjs","sources":["../../../projects/design-system/components/tabs/src/tabs.component.ts","../../../projects/design-system/components/tabs/src/tabs.component.html","../../../projects/design-system/components/tabs/tekus-design-system-components-tabs.ts"],"sourcesContent":["import { Component, input, output, model } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { TabsModule } from 'primeng/tabs';\nimport { TabData } from './tabs.interface';\nimport { TooltipComponent } from '@tekus/design-system/components/tooltip';\nimport { BadgeComponent } from '@tekus/design-system/components/badge';\n\n@Component({\n selector: 'tk-tabs',\n standalone: true,\n imports: [TabsModule, TooltipComponent, BadgeComponent, NgTemplateOutlet],\n templateUrl: './tabs.component.html',\n styleUrl: './tabs.component.scss',\n})\nexport class TabsComponent {\n /**\n * @property {InputSignal<TabData[]>} tabs\n * @description\n * Array of tab configurations to display.\n */\n tabs = input<TabData[]>([]);\n\n /**\n * @property {ModelSignal<number>} activeIndex\n * @description\n * The index of the currently active tab. Supports two-way binding via signals.\n * @default 0\n */\n activeIndex = model<number>(0);\n\n /**\n * @event tabChange\n * @description\n * Emitted when the active tab changes.\n * Payload: object containing the tab index and tab data.\n *\n * @example\n * <tk-tabs (tabChange)=\"onTabChange($event)\"></tk-tabs>\n */\n tabChange = output<{\n index: number;\n tab: TabData;\n }>();\n\n /**\n * @method visibleTabs\n * @description\n * Returns only the tabs that are marked as visible.\n * @returns {TabData[]} Array of visible tabs.\n */\n get visibleTabs(): TabData[] {\n return this.tabs().filter(t => t.visible !== false);\n }\n\n /**\n * @method onTabChange\n * @description\n * Handles tab change events and emits the tabChange output.\n * @param {number} index - The index of the newly selected tab.\n */\n onTabChange(index: number) {\n if (this.activeIndex() === index) return;\n\n this.activeIndex.set(index);\n\n if (this.visibleTabs[index]) {\n this.tabChange.emit({\n index,\n tab: this.visibleTabs[index],\n });\n }\n }\n}\n","<p-tabs [value]=\"activeIndex()\" (valueChange)=\"onTabChange($event !== undefined ? +$event : activeIndex())\"\n class=\"tk-tabs\">\n <p-tablist>\n @for (tab of visibleTabs; track $index) {\n <p-tab [value]=\"$index\" [disabled]=\"tab.disabled\">\n <tk-tooltip [content]=\"tab.tooltip ?? ''\" position=\"top\">\n <span class=\"tk-tab-label\" [style.max-width]=\"tab.badge ? '6rem' : '9rem'\">\n {{ tab.label }}\n </span>\n </tk-tooltip>\n @if(tab.badge){\n <tk-badge [value]=\"tab.badge\"></tk-badge>\n }\n </p-tab>\n }\n </p-tablist>\n\n <p-tabpanels>\n @for (tab of visibleTabs; track $index) {\n <p-tabpanel [value]=\"$index\">\n @if (!tab.lazy || activeIndex() === $index) {\n <ng-container *ngTemplateOutlet=\"tab.content || null\"></ng-container>\n }\n </p-tabpanel>\n }\n </p-tabpanels>\n</p-tabs>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;MAca,aAAa,CAAA;AAP1B,IAAA,WAAA,GAAA;AAQE;;;;AAIG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAY,EAAE,2EAAC;AAE3B;;;;;AAKG;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAS,CAAC,kFAAC;AAE9B;;;;;;;;AAQG;QACH,IAAA,CAAA,SAAS,GAAG,MAAM,EAGd;AA8BL,IAAA;AA5BC;;;;;AAKG;AACH,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,IAAI,EAAE,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,EAAA,CAAA,SAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,cAAc,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,UAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAI7D,aAAa,EAAA,UAAA,EAAA,CAAA;kBAPzB,SAAS;+BACE,SAAS,EAAA,UAAA,EACP,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,CAAC,EAAA,QAAA,EAAA,m4BAAA,EAAA,MAAA,EAAA,CAAA,ooBAAA,CAAA,EAAA;;;AEV3E;;AAEG;;;;"}
|
|
@@ -23,32 +23,24 @@ import { TagModule } from 'primeng/tag';
|
|
|
23
23
|
class TagComponent {
|
|
24
24
|
constructor() {
|
|
25
25
|
/** The text content to be displayed in the tag. */
|
|
26
|
-
this.value = input.required();
|
|
26
|
+
this.value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
27
27
|
/**
|
|
28
28
|
* The severity level of the tag, which determines its color and styling.
|
|
29
29
|
* @default 'secondary'
|
|
30
30
|
*/
|
|
31
|
-
this.severity = input('secondary');
|
|
31
|
+
this.severity = input('secondary', ...(ngDevMode ? [{ debugName: "severity" }] : /* istanbul ignore next */ []));
|
|
32
32
|
/**
|
|
33
33
|
* Maximum number of characters to display before truncation.
|
|
34
34
|
*/
|
|
35
|
-
this.truncationLimit = input();
|
|
35
|
+
this.truncationLimit = input(...(ngDevMode ? [undefined, { debugName: "truncationLimit" }] : /* istanbul ignore next */ []));
|
|
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.
|
|
39
39
|
*/
|
|
40
40
|
this.primeSeverity = computed(() => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
success: 'success',
|
|
45
|
-
info: 'info',
|
|
46
|
-
warn: 'warn',
|
|
47
|
-
danger: 'danger',
|
|
48
|
-
contrast: 'contrast',
|
|
49
|
-
};
|
|
50
|
-
return map[this.severity()];
|
|
51
|
-
});
|
|
41
|
+
const severity = this.severity();
|
|
42
|
+
return severity === 'primary' ? undefined : severity;
|
|
43
|
+
}, ...(ngDevMode ? [{ debugName: "primeSeverity" }] : /* istanbul ignore next */ []));
|
|
52
44
|
/**
|
|
53
45
|
* Computed property that processes the `value` for display.
|
|
54
46
|
* Truncates the text with an ellipsis if it exceeds the defined limit and truncate is enabled.
|
|
@@ -61,15 +53,15 @@ class TagComponent {
|
|
|
61
53
|
return val.substring(0, effectiveLimit) + '...';
|
|
62
54
|
}
|
|
63
55
|
return val;
|
|
64
|
-
});
|
|
56
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
65
57
|
}
|
|
66
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
67
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
59
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.3", 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: ["styleClass", "severity", "value", "icon", "rounded"] }] }); }
|
|
68
60
|
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.3", ngImport: i0, type: TagComponent, decorators: [{
|
|
70
62
|
type: Component,
|
|
71
63
|
args: [{ selector: 'tk-tag', imports: [TagModule], 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"] }]
|
|
72
|
-
}] });
|
|
64
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], severity: [{ type: i0.Input, args: [{ isSignal: true, alias: "severity", required: false }] }], truncationLimit: [{ type: i0.Input, args: [{ isSignal: true, alias: "truncationLimit", required: false }] }] } });
|
|
73
65
|
|
|
74
66
|
/**
|
|
75
67
|
* Generated bundle index. Do not edit.
|
|
@@ -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 =\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
|
|
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<Exclude<TagSeverity, 'primary'> | undefined>(() => {\n const severity = this.severity();\n return severity === 'primary' ? undefined : 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,2EAAU;AAEhC;;;AAGG;AACH,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAc,WAAW,+EAAC;AAE1C;;AAEG;QACH,IAAA,CAAA,eAAe,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,iBAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAEjC;;;AAGG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,QAAQ,CAA8C,MAAK;AACzE,YAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE;YAChC,OAAO,QAAQ,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ;AACtD,QAAA,CAAC,oFAAC;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,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