@tekus/design-system 5.18.0 → 5.19.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/assets/tokens/tk-foundations.json +3 -3
- package/components/checkbox/src/checkbox.component.d.ts +9 -2
- package/components/drawer/index.d.ts +5 -0
- package/components/drawer/public-api.d.ts +3 -0
- package/components/drawer/src/drawer.component.d.ts +78 -0
- package/components/drawer/src/drawer.types.d.ts +19 -0
- package/components/drawer/src/services/drawer.service.d.ts +15 -0
- package/components/icon/core/icons/arrows-rotate.d.ts +2 -0
- package/components/icon/core/icons/edit.d.ts +2 -0
- package/components/icon/core/icons/globe-pointer.d.ts +2 -0
- package/components/icon/core/icons/grip-vertical.d.ts +2 -0
- package/components/multiselect/src/multiselect.component.d.ts +115 -19
- package/components/panel/index.d.ts +5 -0
- package/components/panel/public-api.d.ts +1 -0
- package/components/panel/src/panel.component.d.ts +82 -0
- package/components/table/src/table.component.d.ts +45 -1
- package/components/table/src/table.interface.d.ts +1 -1
- package/fesm2022/tekus-design-system-components-checkbox.mjs +32 -14
- package/fesm2022/tekus-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-drawer.mjs +172 -0
- package/fesm2022/tekus-design-system-components-drawer.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-icon.mjs +56 -0
- package/fesm2022/tekus-design-system-components-icon.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-multiselect.mjs +164 -45
- package/fesm2022/tekus-design-system-components-multiselect.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-panel.mjs +102 -0
- package/fesm2022/tekus-design-system-components-panel.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-select.mjs +3 -8
- package/fesm2022/tekus-design-system-components-select.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs +72 -5
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-toolbar.mjs +2 -2
- package/fesm2022/tekus-design-system-components-toolbar.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core-types.mjs +31 -1
- package/fesm2022/tekus-design-system-core-types.mjs.map +1 -1
- package/fesm2022/tekus-design-system-core.mjs +31 -1
- package/fesm2022/tekus-design-system-core.mjs.map +1 -1
- package/package.json +13 -5
- package/styles/variables.css +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, model, input,
|
|
3
|
+
import { inject, model, input, Component } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { NgControl, FormControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
6
6
|
import { Subscription } from 'rxjs';
|
|
@@ -63,12 +63,19 @@ class CheckboxComponent {
|
|
|
63
63
|
* Message to display when the control is invalid and touched.
|
|
64
64
|
*/
|
|
65
65
|
this.errorMessage = input('');
|
|
66
|
+
/**
|
|
67
|
+
* @property {ModelSignal<boolean>} indeterminate
|
|
68
|
+
* @description
|
|
69
|
+
* Indeterminate state of the checkbox (reactive).
|
|
70
|
+
* Useful for parent checkboxes in lists with partial selection.
|
|
71
|
+
*/
|
|
72
|
+
this.indeterminate = model(false);
|
|
66
73
|
/**
|
|
67
74
|
* @property {boolean} disabled
|
|
68
75
|
* @description
|
|
69
76
|
* Whether the checkbox is disabled.
|
|
70
77
|
*/
|
|
71
|
-
this.disabled =
|
|
78
|
+
this.disabled = model(false);
|
|
72
79
|
this.onChange = () => { };
|
|
73
80
|
this.onTouched = () => { };
|
|
74
81
|
this.subscription = new Subscription();
|
|
@@ -81,28 +88,33 @@ class CheckboxComponent {
|
|
|
81
88
|
}
|
|
82
89
|
ngOnInit() {
|
|
83
90
|
const control = this.effectiveControl;
|
|
84
|
-
|
|
91
|
+
// Only read initial value if it exists
|
|
92
|
+
if (control.value !== undefined && control.value !== null) {
|
|
85
93
|
this.model.set(control.value);
|
|
86
94
|
}
|
|
87
95
|
// Sync initial disabled state
|
|
88
|
-
this.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
if (this.control() === control && this.disabled()) {
|
|
97
|
+
// If using internal control and disabled input is true, disable the control
|
|
98
|
+
control.disable({ emitEvent: false });
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Otherwise (external control or enabled), sync from control
|
|
102
|
+
this.disabled.set(control.disabled);
|
|
103
|
+
}
|
|
95
104
|
// Sync disabled state on status change
|
|
96
105
|
this.subscription.add(control.statusChanges.subscribe(() => {
|
|
97
106
|
this.disabled.set(control.disabled);
|
|
98
107
|
}));
|
|
108
|
+
// Sync model on value change (for external control updates)
|
|
109
|
+
this.subscription.add(control.valueChanges.subscribe(value => {
|
|
110
|
+
this.model.set(value);
|
|
111
|
+
}));
|
|
99
112
|
}
|
|
100
113
|
ngOnDestroy() {
|
|
101
114
|
this.subscription.unsubscribe();
|
|
102
115
|
}
|
|
103
116
|
writeValue(value) {
|
|
104
117
|
this.model.set(value);
|
|
105
|
-
this.control().setValue(value, { emitEvent: false });
|
|
106
118
|
}
|
|
107
119
|
registerOnChange(fn) {
|
|
108
120
|
this.onChange = fn;
|
|
@@ -122,7 +134,7 @@ class CheckboxComponent {
|
|
|
122
134
|
onModelChange(value) {
|
|
123
135
|
this.model.set(value);
|
|
124
136
|
this.onChange(value);
|
|
125
|
-
this.effectiveControl.setValue(value);
|
|
137
|
+
this.effectiveControl.setValue(value, { emitEvent: false });
|
|
126
138
|
this.effectiveControl.markAsDirty();
|
|
127
139
|
this.onTouched();
|
|
128
140
|
}
|
|
@@ -131,11 +143,17 @@ class CheckboxComponent {
|
|
|
131
143
|
this.effectiveControl.markAsTouched();
|
|
132
144
|
}
|
|
133
145
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
134
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: CheckboxComponent, isStandalone: true, selector: "tk-checkbox", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, binary: { classPropertyName: "binary", publicName: "binary", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange" }, ngImport: i0, template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if(label()){\n
|
|
146
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: CheckboxComponent, isStandalone: true, selector: "tk-checkbox", inputs: { model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, binary: { classPropertyName: "binary", publicName: "binary", isSignal: true, isRequired: false, transformFunction: null }, control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", indeterminate: "indeterminateChange", disabled: "disabledChange" }, ngImport: i0, template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i2.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i3.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }] }); }
|
|
135
147
|
}
|
|
136
148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
137
149
|
type: Component,
|
|
138
|
-
args: [{ selector: 'tk-checkbox', imports: [
|
|
150
|
+
args: [{ selector: 'tk-checkbox', imports: [
|
|
151
|
+
CommonModule,
|
|
152
|
+
ReactiveFormsModule,
|
|
153
|
+
FormsModule,
|
|
154
|
+
CheckboxModule,
|
|
155
|
+
MessageModule,
|
|
156
|
+
], template: "<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n", styles: [":host ::ng-deep .tk-checkbox-wrapper{display:flex;flex-direction:column}:host ::ng-deep .tk-checkbox-wrapper label{font-size:var(--tk-font-size-paragraph-s, .875rem);font-weight:var(--tk-font-weight-400, \"Regular\")}:host ::ng-deep .tk-checkbox-group{display:flex;align-items:center;gap:var(--tk-spacing-base-50, .5rem)}:host ::ng-deep .tk-checkbox-group.tk-disabled label{color:var(--tk-color-base-surface-600, #424243)}:host ::ng-deep .tk-checkbox-label{margin-top:var(--tk-spacing-base-25, .25rem)}:host ::ng-deep p-message[severity=error] .p-inline-message-text,:host ::ng-deep p-message[severity=error] span{color:var(--tk-color-base-red-700, #cf2604)}:host ::ng-deep p-message[severity=secondary] .p-inline-message-text,:host ::ng-deep p-message[severity=secondary] span{color:var(--tk-color-base-surface-600, #5d5d5e)}:host ::ng-deep .tk-input-bottom{display:flex;justify-content:space-between;align-items:flex-start;margin-top:.25rem;min-height:1.25rem}:host ::ng-deep .tk-input-messages{flex:1;margin-right:1rem}:host ::ng-deep .p-checkbox.p-disabled .p-checkbox-icon{color:var(--tk-color-base-surface-300, #d2d2d2)!important}:host ::ng-deep p-checkbox.ng-invalid.ng-touched .p-checkbox-box,:host ::ng-deep p-checkbox.ng-invalid.ng-dirty .p-checkbox-box{border-color:var(--tk-color-base-red-700, #cf2604)}\n"] }]
|
|
139
157
|
}], ctorParameters: () => [] });
|
|
140
158
|
|
|
141
159
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tekus-design-system-components-checkbox.mjs","sources":["../../../projects/design-system/components/checkbox/src/checkbox.component.ts","../../../projects/design-system/components/checkbox/src/checkbox.component.html","../../../projects/design-system/components/checkbox/tekus-design-system-components-checkbox.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, input, model, signal, OnInit, inject, OnDestroy } from '@angular/core';\nimport { ControlValueAccessor, FormControl, ReactiveFormsModule, NgControl, FormsModule } from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { CheckboxModule } from 'primeng/checkbox';\nimport { MessageModule } from 'primeng/message';\n\n@Component({\n selector: 'tk-checkbox',\n imports: [CommonModule, ReactiveFormsModule, FormsModule, CheckboxModule, MessageModule],\n templateUrl: './checkbox.component.html',\n styleUrl: './checkbox.component.scss'\n})\nexport class CheckboxComponent implements ControlValueAccessor, OnInit, OnDestroy {\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /**\n * @property {ModelSignal<any>} model\n * @description\n * The value of the checkbox model (checked state or array of values).\n * Supports two-way binding via signals.\n */\n model = model<unknown>();\n\n /**\n * @property {InputSignal<any>} value\n * @description\n * The value of the checkbox itself (used when part of a group).\n */\n value = input<unknown>();\n\n /**\n * @property {InputSignal<string>} label\n * @description\n * Label displayed next to the checkbox.\n */\n label = input<string>('');\n\n /**\n * @property {InputSignal<string>} name\n * @description\n * Name attribute for the checkbox.\n */\n name = input<string>('');\n\n /**\n * @property {InputSignal<string>} inputId\n * @description\n * HTML id attribute for the checkbox input.\n */\n inputId = input<string>('');\n\n /**\n * @property {InputSignal<boolean>} binary\n * @description\n * Boolean property to indicate if the checkbox is a binary toggle.\n * @default false\n */\n binary = input<boolean>(false);\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the checkbox value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>(new FormControl());\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 {boolean} disabled\n * @description\n * Whether the checkbox is disabled.\n */\n disabled = signal<boolean>(false);\n\n get effectiveControl(): FormControl {\n return (this.ngControl?.control as FormControl) || this.control();\n }\n\n onChange: (value: unknown) => void = () => {};\n onTouched: () => void = () => {};\n private readonly subscription = new Subscription();\n\n ngOnInit(): void {\n const control = this.effectiveControl;\n if (control.value !== undefined) {\n this.model.set(control.value);\n }\n\n // Sync initial disabled state\n this.disabled.set(control.disabled);\n\n this.subscription.add(\n control.valueChanges.subscribe(val => {\n if (val !== this.model()) {\n this.model.set(val);\n this.onChange(val);\n }\n })\n );\n\n // Sync disabled state on status change\n this.subscription.add(\n control.statusChanges.subscribe(() => {\n this.disabled.set(control.disabled);\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n writeValue(value: unknown): void {\n this.model.set(value);\n this.control().setValue(value, { emitEvent: false });\n }\n\n registerOnChange(fn: (value: unknown) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n if (isDisabled) {\n this.control().disable({ emitEvent: false });\n } else {\n this.control().enable({ emitEvent: false });\n }\n }\n\n onModelChange(value: unknown): void {\n this.model.set(value);\n this.onChange(value);\n this.effectiveControl.setValue(value);\n this.effectiveControl.markAsDirty();\n this.onTouched();\n }\n\n onBlur(): void {\n this.onTouched();\n this.effectiveControl.markAsTouched();\n }\n}\n","<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if(label()){\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n \n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n @if ((effectiveControl.invalid && (effectiveControl.dirty || effectiveControl.touched)) && errorMessage()) {\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{ errorMessage() }}</p-message>\n }\n </div>\n </div>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAaa,iBAAiB,CAAA;AAG5B,IAAA,WAAA,GAAA;AAFS,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAA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"version":3,"file":"tekus-design-system-components-checkbox.mjs","sources":["../../../projects/design-system/components/checkbox/src/checkbox.component.ts","../../../projects/design-system/components/checkbox/src/checkbox.component.html","../../../projects/design-system/components/checkbox/tekus-design-system-components-checkbox.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n Component,\n input,\n model,\n OnInit,\n inject,\n OnDestroy,\n} from '@angular/core';\nimport {\n ControlValueAccessor,\n FormControl,\n ReactiveFormsModule,\n NgControl,\n FormsModule,\n} from '@angular/forms';\nimport { Subscription } from 'rxjs';\nimport { CheckboxModule } from 'primeng/checkbox';\nimport { MessageModule } from 'primeng/message';\n\n@Component({\n selector: 'tk-checkbox',\n imports: [\n CommonModule,\n ReactiveFormsModule,\n FormsModule,\n CheckboxModule,\n MessageModule,\n ],\n templateUrl: './checkbox.component.html',\n styleUrl: './checkbox.component.scss',\n})\nexport class CheckboxComponent\n implements ControlValueAccessor, OnInit, OnDestroy\n{\n readonly ngControl = inject(NgControl, { self: true, optional: true });\n\n constructor() {\n if (this.ngControl) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n /**\n * @property {ModelSignal<any>} model\n * @description\n * The value of the checkbox model (checked state or array of values).\n * Supports two-way binding via signals.\n */\n model = model<unknown>();\n\n /**\n * @property {InputSignal<any>} value\n * @description\n * The value of the checkbox itself (used when part of a group).\n */\n value = input<unknown>();\n\n /**\n * @property {InputSignal<string>} label\n * @description\n * Label displayed next to the checkbox.\n */\n label = input<string>('');\n\n /**\n * @property {InputSignal<string>} name\n * @description\n * Name attribute for the checkbox.\n */\n name = input<string>('');\n\n /**\n * @property {InputSignal<string>} inputId\n * @description\n * HTML id attribute for the checkbox input.\n */\n inputId = input<string>('');\n\n /**\n * @property {InputSignal<boolean>} binary\n * @description\n * Boolean property to indicate if the checkbox is a binary toggle.\n * @default false\n */\n binary = input<boolean>(false);\n\n /**\n * @property {InputSignal<FormControl>} control\n * @description\n * External FormControl used to read/set the checkbox value.\n * If not provided, an internal FormControl is created.\n */\n control = input<FormControl>(new FormControl());\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 {ModelSignal<boolean>} indeterminate\n * @description\n * Indeterminate state of the checkbox (reactive).\n * Useful for parent checkboxes in lists with partial selection.\n */\n indeterminate = model<boolean>(false);\n\n /**\n * @property {boolean} disabled\n * @description\n * Whether the checkbox is disabled.\n */\n disabled = model<boolean>(false);\n\n get effectiveControl(): FormControl {\n return (this.ngControl?.control as FormControl) || this.control();\n }\n\n onChange: (value: unknown) => void = () => {};\n onTouched: () => void = () => {};\n private readonly subscription = new Subscription();\n\n ngOnInit(): void {\n const control = this.effectiveControl;\n\n // Only read initial value if it exists\n if (control.value !== undefined && control.value !== null) {\n this.model.set(control.value);\n }\n\n // Sync initial disabled state\n if (this.control() === control && this.disabled()) {\n // If using internal control and disabled input is true, disable the control\n control.disable({ emitEvent: false });\n } else {\n // Otherwise (external control or enabled), sync from control\n this.disabled.set(control.disabled);\n }\n\n // Sync disabled state on status change\n this.subscription.add(\n control.statusChanges.subscribe(() => {\n this.disabled.set(control.disabled);\n })\n );\n\n // Sync model on value change (for external control updates)\n this.subscription.add(\n control.valueChanges.subscribe(value => {\n this.model.set(value);\n })\n );\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n\n writeValue(value: unknown): void {\n this.model.set(value);\n }\n\n registerOnChange(fn: (value: unknown) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n if (isDisabled) {\n this.control().disable({ emitEvent: false });\n } else {\n this.control().enable({ emitEvent: false });\n }\n }\n\n onModelChange(value: unknown): void {\n this.model.set(value);\n this.onChange(value);\n this.effectiveControl.setValue(value, { emitEvent: false });\n this.effectiveControl.markAsDirty();\n this.onTouched();\n }\n\n onBlur(): void {\n this.onTouched();\n this.effectiveControl.markAsTouched();\n }\n}\n","<div class=\"tk-checkbox-wrapper\">\n <div class=\"tk-checkbox-group\" [class.tk-disabled]=\"disabled()\">\n <p-checkbox\n [inputId]=\"inputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [binary]=\"binary()\"\n [disabled]=\"disabled()\"\n [indeterminate]=\"indeterminate()\"\n [ngModel]=\"model()\"\n (ngModelChange)=\"onModelChange($event)\"\n [class.ng-invalid]=\"effectiveControl.invalid\"\n [class.ng-dirty]=\"effectiveControl.dirty\"\n [class.ng-touched]=\"effectiveControl.touched\">\n </p-checkbox>\n @if (label()) {\n <label [for]=\"inputId()\" class=\"tk-checkbox-label\"> {{ label() }} </label>\n }\n </div>\n @if (\n effectiveControl.invalid &&\n (effectiveControl.dirty || effectiveControl.touched) &&\n errorMessage()\n ) {\n <div class=\"tk-input-bottom\">\n <div class=\"tk-input-messages\">\n <p-message severity=\"error\" size=\"small\" variant=\"simple\">{{\n errorMessage()\n }}</p-message>\n </div>\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAgCa,iBAAiB,CAAA;AAK5B,IAAA,WAAA,GAAA;AAFS,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAQtE;;;;;AAKG;QACH,IAAK,CAAA,KAAA,GAAG,KAAK,EAAW;AAExB;;;;AAIG;QACH,IAAK,CAAA,KAAA,GAAG,KAAK,EAAW;AAExB;;;;AAIG;AACH,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE,CAAC;AAEzB;;;;AAIG;AACH,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAS,EAAE,CAAC;AAExB;;;;AAIG;AACH,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,EAAE,CAAC;AAE3B;;;;;AAKG;AACH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A,EAAA,gjCAAA,EAAA,MAAA,EAAA,CAAA,uyCAAA,CAAA,EAAA;;;AE5BH;;AAEG;;;;"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, model, EventEmitter, Component, createComponent, Injectable } from '@angular/core';
|
|
3
|
+
import { NgComponentOutlet } from '@angular/common';
|
|
4
|
+
import { ButtonComponent } from '@tekus/design-system/components/button';
|
|
5
|
+
import * as i1 from 'primeng/drawer';
|
|
6
|
+
import { DrawerModule } from 'primeng/drawer';
|
|
7
|
+
import * as i2 from 'primeng/api';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @component DrawerComponent
|
|
12
|
+
* @description
|
|
13
|
+
* A programmatically controlled drawer overlay used for displaying dynamic content,
|
|
14
|
+
* titles, and header actions. The drawer is opened through a service with a configuration object,
|
|
15
|
+
* similar to tk-modal.
|
|
16
|
+
*
|
|
17
|
+
* This component supports:
|
|
18
|
+
* - Required title with ellipsis for long text.
|
|
19
|
+
* - Optional header action button + close button.
|
|
20
|
+
* - Content as string or component.
|
|
21
|
+
* - Position: always right.
|
|
22
|
+
* - Sizes: small (500px), large (1024px).
|
|
23
|
+
* - Closable and dismissible mask behavior.
|
|
24
|
+
*
|
|
25
|
+
* @usage
|
|
26
|
+
* ### Open a drawer from TypeScript using the drawer service
|
|
27
|
+
* ```ts
|
|
28
|
+
* this.drawerService.open({
|
|
29
|
+
* title: 'Drawer name',
|
|
30
|
+
* content: 'Content text drawer example',
|
|
31
|
+
* headerAction: {
|
|
32
|
+
* label: 'Action',
|
|
33
|
+
* severity: 'primary',
|
|
34
|
+
* action: () => console.log('Action clicked'),
|
|
35
|
+
* returnValue: true,
|
|
36
|
+
* },
|
|
37
|
+
* size: 'small',
|
|
38
|
+
* }).subscribe((result) => {
|
|
39
|
+
* console.log('Drawer closed with value:', result);
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class DrawerComponent {
|
|
44
|
+
constructor(elementRef) {
|
|
45
|
+
this.elementRef = elementRef;
|
|
46
|
+
/** The required title displayed at the top left of the drawer header */
|
|
47
|
+
this.title = input.required();
|
|
48
|
+
/** The main content of the drawer */
|
|
49
|
+
this.content = input(null);
|
|
50
|
+
/** Optional header action button (displayed before close button) */
|
|
51
|
+
this.headerAction = input(null);
|
|
52
|
+
/** Drawer size: 'small' (500px), 'large' (1024px) */
|
|
53
|
+
this.size = input('small');
|
|
54
|
+
/** Whether the drawer can be closed by the user via close button */
|
|
55
|
+
this.closable = input(true);
|
|
56
|
+
/** Whether clicking the mask closes the drawer */
|
|
57
|
+
this.dismissible = input(true);
|
|
58
|
+
this.isContentString = computed(() => typeof this.content() === 'string');
|
|
59
|
+
this.hasHeaderAction = computed(() => this.headerAction() != null);
|
|
60
|
+
/** Computed: drawer width (responsive) and max-width based on `size`. Always right position. */
|
|
61
|
+
this.drawerStyle = computed(() => {
|
|
62
|
+
const sz = this.size();
|
|
63
|
+
const maxWidth = sz === 'large' ? '1024px' : '500px';
|
|
64
|
+
return {
|
|
65
|
+
width: 'calc(100vw - 1rem)',
|
|
66
|
+
maxWidth,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
/** Visibility flag. Use model for two-way binding when using drawer in template. */
|
|
70
|
+
this.isOpened = model(false);
|
|
71
|
+
/** Emits when the drawer closes, passing the return value from header action or null */
|
|
72
|
+
this.onClose = new EventEmitter();
|
|
73
|
+
this.alreadyEmitted = false;
|
|
74
|
+
this.returnValueOnClose = null;
|
|
75
|
+
}
|
|
76
|
+
/** Opens the drawer */
|
|
77
|
+
open() {
|
|
78
|
+
this.isOpened.set(true);
|
|
79
|
+
this.alreadyEmitted = false;
|
|
80
|
+
this.returnValueOnClose = null;
|
|
81
|
+
}
|
|
82
|
+
/** Closes the drawer and emits onClose */
|
|
83
|
+
handleClose() {
|
|
84
|
+
if (!this.alreadyEmitted) {
|
|
85
|
+
this.onClose.emit(null);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.onClose.emit(this.returnValueOnClose);
|
|
89
|
+
}
|
|
90
|
+
this.alreadyEmitted = false;
|
|
91
|
+
this.returnValueOnClose = null;
|
|
92
|
+
}
|
|
93
|
+
/** Closes the drawer without emitting an event */
|
|
94
|
+
close() {
|
|
95
|
+
this.isOpened.set(false);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Handles header action button click.
|
|
99
|
+
* Executes the action callback, emits onClose with the provided returnValue, then closes the drawer.
|
|
100
|
+
*/
|
|
101
|
+
handleHeaderAction(action, returnValue) {
|
|
102
|
+
if (action)
|
|
103
|
+
action();
|
|
104
|
+
this.alreadyEmitted = true;
|
|
105
|
+
this.returnValueOnClose = returnValue;
|
|
106
|
+
this.isOpened.set(false);
|
|
107
|
+
}
|
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DrawerComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
109
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.18", type: DrawerComponent, isStandalone: true, selector: "tk-drawer", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, headerAction: { classPropertyName: "headerAction", publicName: "headerAction", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, isOpened: { classPropertyName: "isOpened", publicName: "isOpened", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpened: "isOpenedChange" }, ngImport: i0, template: "<p-drawer\n [modal]=\"true\"\n [visible]=\"isOpened()\"\n (visibleChange)=\"isOpened.set($event)\"\n [closable]=\"closable()\"\n [dismissible]=\"dismissible()\"\n [closeOnEscape]=\"true\"\n position=\"right\"\n [style]=\"drawerStyle()\"\n [styleClass]=\"'tk-drawer'\"\n (onHide)=\"handleClose()\"\n>\n <ng-template pTemplate=\"header\">\n <div class=\"tk-drawer__header\">\n <h2 class=\"tk-drawer__title\" [title]=\"title()\">{{ title() }}</h2>\n @if (hasHeaderAction()) {\n <div class=\"tk-drawer__actions\">\n <tk-button\n [label]=\"headerAction()!.label\"\n [severity]=\"headerAction()!.severity\"\n [variant]=\"headerAction()!.variant\"\n (clicked)=\"handleHeaderAction(headerAction()!.action, headerAction()!.returnValue)\"\n />\n </div>\n }\n </div>\n </ng-template>\n\n <section class=\"tk-drawer__content\">\n @if (content()) {\n @if (isContentString()) {\n <p [innerHTML]=\"content()\"></p>\n } @else {\n <ng-container *ngComponentOutlet=\"$any(content())\"></ng-container>\n }\n }\n </section>\n</p-drawer>\n", styles: [":host ::ng-deep .tk-drawer{max-height:100vh;display:flex;flex-direction:column}:host ::ng-deep .p-drawer-content{overflow-y:auto;display:flex;flex-direction:column;flex:1}:host ::ng-deep .p-drawer-close-button{color:var(--tk-color-base-surface-500, #8a8a8b)}:host ::ng-deep .p-drawer-close-button:hover{background:var(--tk-color-base-surface-100, #f0f0f0)!important;color:var(--tk-color-base-surface-500, #8a8a8b)}.tk-drawer__header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--tk-spacing-base-100, 1rem);flex-shrink:0;width:calc(100% - var(--tk-spacing-base-250, 2.5rem))}.tk-drawer__title{margin:0;font-size:var(--tk-font-size-headers-s, 1.125rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #212121);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.tk-drawer__actions{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-base-50, .5rem);flex-shrink:0;padding-right:var(--tk-spacing-paddingX-xs, .25rem)}\n"], dependencies: [{ kind: "ngmodule", type: DrawerModule }, { kind: "component", type: i1.Drawer, selector: "p-drawer", inputs: ["appendTo", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: ButtonComponent, selector: "tk-button", inputs: ["label", "disabled", "type", "severity", "variant", "link", "icon", "tooltipText"], outputs: ["clicked"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }] }); }
|
|
110
|
+
}
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DrawerComponent, decorators: [{
|
|
112
|
+
type: Component,
|
|
113
|
+
args: [{ selector: 'tk-drawer', standalone: true, imports: [DrawerModule, ButtonComponent, NgComponentOutlet], template: "<p-drawer\n [modal]=\"true\"\n [visible]=\"isOpened()\"\n (visibleChange)=\"isOpened.set($event)\"\n [closable]=\"closable()\"\n [dismissible]=\"dismissible()\"\n [closeOnEscape]=\"true\"\n position=\"right\"\n [style]=\"drawerStyle()\"\n [styleClass]=\"'tk-drawer'\"\n (onHide)=\"handleClose()\"\n>\n <ng-template pTemplate=\"header\">\n <div class=\"tk-drawer__header\">\n <h2 class=\"tk-drawer__title\" [title]=\"title()\">{{ title() }}</h2>\n @if (hasHeaderAction()) {\n <div class=\"tk-drawer__actions\">\n <tk-button\n [label]=\"headerAction()!.label\"\n [severity]=\"headerAction()!.severity\"\n [variant]=\"headerAction()!.variant\"\n (clicked)=\"handleHeaderAction(headerAction()!.action, headerAction()!.returnValue)\"\n />\n </div>\n }\n </div>\n </ng-template>\n\n <section class=\"tk-drawer__content\">\n @if (content()) {\n @if (isContentString()) {\n <p [innerHTML]=\"content()\"></p>\n } @else {\n <ng-container *ngComponentOutlet=\"$any(content())\"></ng-container>\n }\n }\n </section>\n</p-drawer>\n", styles: [":host ::ng-deep .tk-drawer{max-height:100vh;display:flex;flex-direction:column}:host ::ng-deep .p-drawer-content{overflow-y:auto;display:flex;flex-direction:column;flex:1}:host ::ng-deep .p-drawer-close-button{color:var(--tk-color-base-surface-500, #8a8a8b)}:host ::ng-deep .p-drawer-close-button:hover{background:var(--tk-color-base-surface-100, #f0f0f0)!important;color:var(--tk-color-base-surface-500, #8a8a8b)}.tk-drawer__header{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:var(--tk-spacing-base-100, 1rem);flex-shrink:0;width:calc(100% - var(--tk-spacing-base-250, 2.5rem))}.tk-drawer__title{margin:0;font-size:var(--tk-font-size-headers-s, 1.125rem);font-weight:var(--tk-font-weight-600, 600);color:var(--tk-color-text-default, #212121);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.tk-drawer__actions{display:flex;flex-direction:row;align-items:center;gap:var(--tk-spacing-base-50, .5rem);flex-shrink:0;padding-right:var(--tk-spacing-paddingX-xs, .25rem)}\n"] }]
|
|
114
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
115
|
+
|
|
116
|
+
class DrawerService {
|
|
117
|
+
constructor(appRef) {
|
|
118
|
+
this.appRef = appRef;
|
|
119
|
+
this.drawerRef = null;
|
|
120
|
+
}
|
|
121
|
+
get _drawerRefForTesting() {
|
|
122
|
+
return this.drawerRef;
|
|
123
|
+
}
|
|
124
|
+
set _drawerRefForTesting(ref) {
|
|
125
|
+
this.drawerRef = ref;
|
|
126
|
+
}
|
|
127
|
+
open(config) {
|
|
128
|
+
if (this.drawerRef) {
|
|
129
|
+
this.drawerRef.instance.close();
|
|
130
|
+
this.appRef.detachView(this.drawerRef.hostView);
|
|
131
|
+
this.drawerRef.destroy();
|
|
132
|
+
this.drawerRef = null;
|
|
133
|
+
}
|
|
134
|
+
const componentRef = createComponent(DrawerComponent, {
|
|
135
|
+
environmentInjector: this.appRef.injector,
|
|
136
|
+
});
|
|
137
|
+
this.appRef.attachView(componentRef.hostView);
|
|
138
|
+
const domElem = componentRef.hostView
|
|
139
|
+
.rootNodes[0];
|
|
140
|
+
document.body.appendChild(domElem);
|
|
141
|
+
componentRef.setInput('title', config.title);
|
|
142
|
+
componentRef.setInput('content', config.content ?? null);
|
|
143
|
+
componentRef.setInput('headerAction', config.headerAction ?? null);
|
|
144
|
+
componentRef.setInput('size', config.size ?? 'small');
|
|
145
|
+
componentRef.setInput('closable', config.closable ?? true);
|
|
146
|
+
componentRef.setInput('dismissible', config.dismissible ?? true);
|
|
147
|
+
const close$ = new Subject();
|
|
148
|
+
componentRef.instance.onClose.subscribe((value) => {
|
|
149
|
+
close$.next(value);
|
|
150
|
+
close$.complete();
|
|
151
|
+
this.appRef.detachView(componentRef.hostView);
|
|
152
|
+
componentRef.destroy();
|
|
153
|
+
this.drawerRef = null;
|
|
154
|
+
});
|
|
155
|
+
componentRef.instance.open();
|
|
156
|
+
this.drawerRef = componentRef;
|
|
157
|
+
return close$.asObservable();
|
|
158
|
+
}
|
|
159
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DrawerService, deps: [{ token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
160
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DrawerService, providedIn: 'root' }); }
|
|
161
|
+
}
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: DrawerService, decorators: [{
|
|
163
|
+
type: Injectable,
|
|
164
|
+
args: [{ providedIn: 'root' }]
|
|
165
|
+
}], ctorParameters: () => [{ type: i0.ApplicationRef }] });
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Generated bundle index. Do not edit.
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
export { DrawerComponent, DrawerService };
|
|
172
|
+
//# sourceMappingURL=tekus-design-system-components-drawer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tekus-design-system-components-drawer.mjs","sources":["../../../projects/design-system/components/drawer/src/drawer.component.ts","../../../projects/design-system/components/drawer/src/drawer.component.html","../../../projects/design-system/components/drawer/src/services/drawer.service.ts","../../../projects/design-system/components/drawer/tekus-design-system-components-drawer.ts"],"sourcesContent":["import {\n Component,\n computed,\n input,\n model,\n EventEmitter,\n Type,\n ElementRef,\n} from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { ButtonComponent } from '@tekus/design-system/components/button';\nimport { DrawerModule } from 'primeng/drawer';\nimport { DrawerHeaderAction, DrawerSizeType } from './drawer.types';\n\n/**\n * @component DrawerComponent\n * @description\n * A programmatically controlled drawer overlay used for displaying dynamic content,\n * titles, and header actions. The drawer is opened through a service with a configuration object,\n * similar to tk-modal.\n *\n * This component supports:\n * - Required title with ellipsis for long text.\n * - Optional header action button + close button.\n * - Content as string or component.\n * - Position: always right.\n * - Sizes: small (500px), large (1024px).\n * - Closable and dismissible mask behavior.\n *\n * @usage\n * ### Open a drawer from TypeScript using the drawer service\n * ```ts\n * this.drawerService.open({\n * title: 'Drawer name',\n * content: 'Content text drawer example',\n * headerAction: {\n * label: 'Action',\n * severity: 'primary',\n * action: () => console.log('Action clicked'),\n * returnValue: true,\n * },\n * size: 'small',\n * }).subscribe((result) => {\n * console.log('Drawer closed with value:', result);\n * });\n * ```\n */\n@Component({\n selector: 'tk-drawer',\n standalone: true,\n imports: [DrawerModule, ButtonComponent, NgComponentOutlet],\n templateUrl: './drawer.component.html',\n styleUrls: ['./drawer.component.scss'],\n})\nexport class DrawerComponent {\n constructor(private readonly elementRef: ElementRef) {}\n\n /** The required title displayed at the top left of the drawer header */\n title = input.required<string>();\n /** The main content of the drawer */\n content = input<string | Type<unknown> | null>(null);\n /** Optional header action button (displayed before close button) */\n headerAction = input<DrawerHeaderAction | null>(null);\n /** Drawer size: 'small' (500px), 'large' (1024px) */\n size = input<DrawerSizeType>('small');\n /** Whether the drawer can be closed by the user via close button */\n closable = input<boolean>(true);\n /** Whether clicking the mask closes the drawer */\n dismissible = input<boolean>(true);\n\n isContentString = computed(() => typeof this.content() === 'string');\n hasHeaderAction = computed(() => this.headerAction() != null);\n\n /** Computed: drawer width (responsive) and max-width based on `size`. Always right position. */\n drawerStyle = computed(() => {\n const sz = this.size();\n const maxWidth = sz === 'large' ? '1024px' : '500px';\n return {\n width: 'calc(100vw - 1rem)',\n maxWidth,\n };\n });\n\n /** Visibility flag. Use model for two-way binding when using drawer in template. */\n isOpened = model<boolean>(false);\n\n /** Emits when the drawer closes, passing the return value from header action or null */\n readonly onClose = new EventEmitter<unknown>();\n private alreadyEmitted = false;\n private returnValueOnClose: unknown = null;\n\n /** Opens the drawer */\n open() {\n this.isOpened.set(true);\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /** Closes the drawer and emits onClose */\n handleClose() {\n if (!this.alreadyEmitted) {\n this.onClose.emit(null);\n } else {\n this.onClose.emit(this.returnValueOnClose);\n }\n this.alreadyEmitted = false;\n this.returnValueOnClose = null;\n }\n\n /** Closes the drawer without emitting an event */\n close() {\n this.isOpened.set(false);\n }\n\n /**\n * Handles header action button click.\n * Executes the action callback, emits onClose with the provided returnValue, then closes the drawer.\n */\n handleHeaderAction(\n action: (() => void) | undefined,\n returnValue: unknown\n ): void {\n if (action) action();\n this.alreadyEmitted = true;\n this.returnValueOnClose = returnValue;\n this.isOpened.set(false);\n }\n}\n","<p-drawer\n [modal]=\"true\"\n [visible]=\"isOpened()\"\n (visibleChange)=\"isOpened.set($event)\"\n [closable]=\"closable()\"\n [dismissible]=\"dismissible()\"\n [closeOnEscape]=\"true\"\n position=\"right\"\n [style]=\"drawerStyle()\"\n [styleClass]=\"'tk-drawer'\"\n (onHide)=\"handleClose()\"\n>\n <ng-template pTemplate=\"header\">\n <div class=\"tk-drawer__header\">\n <h2 class=\"tk-drawer__title\" [title]=\"title()\">{{ title() }}</h2>\n @if (hasHeaderAction()) {\n <div class=\"tk-drawer__actions\">\n <tk-button\n [label]=\"headerAction()!.label\"\n [severity]=\"headerAction()!.severity\"\n [variant]=\"headerAction()!.variant\"\n (clicked)=\"handleHeaderAction(headerAction()!.action, headerAction()!.returnValue)\"\n />\n </div>\n }\n </div>\n </ng-template>\n\n <section class=\"tk-drawer__content\">\n @if (content()) {\n @if (isContentString()) {\n <p [innerHTML]=\"content()\"></p>\n } @else {\n <ng-container *ngComponentOutlet=\"$any(content())\"></ng-container>\n }\n }\n </section>\n</p-drawer>\n","import {\n Injectable,\n ApplicationRef,\n ComponentRef,\n createComponent,\n EmbeddedViewRef,\n} from '@angular/core';\nimport { DrawerComponent } from '../drawer.component';\nimport { Observable, Subject } from 'rxjs';\nimport { DrawerConfig } from '../drawer.types';\n\n@Injectable({ providedIn: 'root' })\nexport class DrawerService {\n private drawerRef: ComponentRef<DrawerComponent> | null = null;\n\n constructor(private readonly appRef: ApplicationRef) {}\n\n get _drawerRefForTesting(): ComponentRef<DrawerComponent> | null {\n return this.drawerRef;\n }\n set _drawerRefForTesting(ref: ComponentRef<DrawerComponent> | null) {\n this.drawerRef = ref;\n }\n\n open(config: DrawerConfig): Observable<unknown> {\n if (this.drawerRef) {\n this.drawerRef.instance.close();\n this.appRef.detachView(this.drawerRef.hostView);\n this.drawerRef.destroy();\n this.drawerRef = null;\n }\n\n const componentRef = createComponent(DrawerComponent, {\n environmentInjector: this.appRef.injector,\n });\n\n this.appRef.attachView(componentRef.hostView);\n\n const domElem = (componentRef.hostView as EmbeddedViewRef<unknown>)\n .rootNodes[0] as HTMLElement;\n document.body.appendChild(domElem);\n\n componentRef.setInput('title', config.title);\n componentRef.setInput('content', config.content ?? null);\n componentRef.setInput('headerAction', config.headerAction ?? null);\n componentRef.setInput('size', config.size ?? 'small');\n componentRef.setInput('closable', config.closable ?? true);\n componentRef.setInput('dismissible', config.dismissible ?? true);\n\n const close$ = new Subject<unknown>();\n\n componentRef.instance.onClose.subscribe((value) => {\n close$.next(value);\n close$.complete();\n\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n this.drawerRef = null;\n });\n\n componentRef.instance.open();\n this.drawerRef = componentRef;\n\n return close$.asObservable();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;MAQU,eAAe,CAAA;AAC1B,IAAA,WAAA,CAA6B,UAAsB,EAAA;QAAtB,IAAU,CAAA,UAAA,GAAV,UAAU;;AAGvC,QAAA,IAAA,CAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAU;;AAEhC,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAgC,IAAI,CAAC;;AAEpD,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAA4B,IAAI,CAAC;;AAErD,QAAA,IAAA,CAAA,IAAI,GAAG,KAAK,CAAiB,OAAO,CAAC;;AAErC,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAU,IAAI,CAAC;;AAE/B,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAAU,IAAI,CAAC;AAElC,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,OAAO,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC;AACpE,QAAA,IAAA,CAAA,eAAe,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC;;AAG7D,QAAA,IAAA,CAA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IAAA,EAAA,aAAa,cADA,MAAM,EAAA,CAAA,CAAA;;4FACnB,aAAa,EAAA,UAAA,EAAA,CAAA;kBADzB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACXlC;;AAEG;;;;"}
|
|
@@ -960,6 +960,58 @@ const plugIcon = {
|
|
|
960
960
|
}
|
|
961
961
|
};
|
|
962
962
|
|
|
963
|
+
const arrowsRotateIcon = {
|
|
964
|
+
'arrows-rotate': {
|
|
965
|
+
name: 'faArrowsRotate',
|
|
966
|
+
tags: ['arrow', 'rotate'],
|
|
967
|
+
source: 'Font awesome',
|
|
968
|
+
styles: {
|
|
969
|
+
light: import('@fortawesome/pro-light-svg-icons').then(m => m.faArrowsRotate),
|
|
970
|
+
regular: import('@fortawesome/pro-regular-svg-icons').then(m => m.faArrowsRotate),
|
|
971
|
+
solid: import('@fortawesome/pro-solid-svg-icons').then(m => m.faArrowsRotate)
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
const editIcon = {
|
|
977
|
+
'edit': {
|
|
978
|
+
name: 'faEdit',
|
|
979
|
+
tags: ['edit'],
|
|
980
|
+
source: 'Font awesome',
|
|
981
|
+
styles: {
|
|
982
|
+
light: import('@fortawesome/pro-light-svg-icons').then(m => m.faEdit),
|
|
983
|
+
regular: import('@fortawesome/pro-regular-svg-icons').then(m => m.faEdit),
|
|
984
|
+
solid: import('@fortawesome/pro-solid-svg-icons').then(m => m.faEdit)
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
|
|
989
|
+
const globePointerIcon = {
|
|
990
|
+
'globe-pointer': {
|
|
991
|
+
name: 'faGlobalPointer',
|
|
992
|
+
tags: ['globe', 'pointer'],
|
|
993
|
+
source: 'Font awesome',
|
|
994
|
+
styles: {
|
|
995
|
+
light: import('@fortawesome/pro-light-svg-icons').then(m => m.faGlobePointer),
|
|
996
|
+
regular: import('@fortawesome/pro-regular-svg-icons').then(m => m.faGlobePointer),
|
|
997
|
+
solid: import('@fortawesome/pro-solid-svg-icons').then(m => m.faGlobePointer)
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
const gridVerticalIcon = {
|
|
1003
|
+
'grip-vertical': {
|
|
1004
|
+
name: 'faGripVertical',
|
|
1005
|
+
tags: ['grip', 'vertical'],
|
|
1006
|
+
source: 'Font awesome',
|
|
1007
|
+
styles: {
|
|
1008
|
+
light: import('@fortawesome/pro-light-svg-icons').then(m => m.faGripDotsVertical),
|
|
1009
|
+
regular: import('@fortawesome/pro-regular-svg-icons').then(m => m.faGripDotsVertical),
|
|
1010
|
+
solid: import('@fortawesome/pro-solid-svg-icons').then(m => m.faGripDotsVertical)
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
|
|
963
1015
|
/**
|
|
964
1016
|
* iconsStylesLight is an array of available light styles for each icon in the IconCatalog.
|
|
965
1017
|
* It allows for easy access and iteration over the light styles.
|
|
@@ -1027,6 +1079,10 @@ const IconCatalog = {
|
|
|
1027
1079
|
...qrCodeIcon,
|
|
1028
1080
|
...plugIcon,
|
|
1029
1081
|
...adsIcons,
|
|
1082
|
+
...arrowsRotateIcon,
|
|
1083
|
+
...editIcon,
|
|
1084
|
+
...globePointerIcon,
|
|
1085
|
+
...gridVerticalIcon
|
|
1030
1086
|
};
|
|
1031
1087
|
|
|
1032
1088
|
class IconComponent {
|