taly-shared-ui-lib 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/fesm2022/taly-shared-ui-lib.mjs +920 -0
- package/fesm2022/taly-shared-ui-lib.mjs.map +1 -0
- package/index.d.ts +268 -0
- package/package.json +27 -0
- package/styles/_theme.scss +4 -0
- package/styles/_variables.scss +57 -0
- package/styles/index.scss +21 -0
|
@@ -0,0 +1,920 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, HostListener, Input, Directive, inject, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef, EventEmitter, Output, ContentChild, forwardRef } from '@angular/core';
|
|
3
|
+
import * as i2$1 from '@angular/forms';
|
|
4
|
+
import { NgControl, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
|
+
import { CommonModule } from '@angular/common';
|
|
7
|
+
import * as i2 from 'primeng/inputtext';
|
|
8
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
9
|
+
import * as i3 from 'primeng/floatlabel';
|
|
10
|
+
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
11
|
+
import * as i3$1 from 'primeng/select';
|
|
12
|
+
import { SelectModule } from 'primeng/select';
|
|
13
|
+
import * as i4 from 'primeng/api';
|
|
14
|
+
import * as i2$2 from 'primeng/table';
|
|
15
|
+
import { TableModule } from 'primeng/table';
|
|
16
|
+
import * as i2$3 from 'primeng/accordion';
|
|
17
|
+
import { AccordionModule } from 'primeng/accordion';
|
|
18
|
+
import * as i2$4 from 'primeng/button';
|
|
19
|
+
import { ButtonModule } from 'primeng/button';
|
|
20
|
+
import * as i2$5 from 'ng-otp-input';
|
|
21
|
+
import { NgOtpInputModule } from 'ng-otp-input';
|
|
22
|
+
|
|
23
|
+
class TalySharedUiLib {
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalySharedUiLib, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
25
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalySharedUiLib, isStandalone: true, selector: "lib-taly-shared-ui-lib", ngImport: i0, template: `
|
|
26
|
+
<p>
|
|
27
|
+
taly-shared-ui-lib works!
|
|
28
|
+
</p>
|
|
29
|
+
`, isInline: true, styles: [""] });
|
|
30
|
+
}
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalySharedUiLib, decorators: [{
|
|
32
|
+
type: Component,
|
|
33
|
+
args: [{ selector: 'lib-taly-shared-ui-lib', imports: [], template: `
|
|
34
|
+
<p>
|
|
35
|
+
taly-shared-ui-lib works!
|
|
36
|
+
</p>
|
|
37
|
+
` }]
|
|
38
|
+
}] });
|
|
39
|
+
|
|
40
|
+
class NumericOnlyDirective {
|
|
41
|
+
talyAppNumericOnly = true;
|
|
42
|
+
navigationKeys = [
|
|
43
|
+
'Backspace',
|
|
44
|
+
'Delete',
|
|
45
|
+
'Tab',
|
|
46
|
+
'Escape',
|
|
47
|
+
'Enter',
|
|
48
|
+
'Home',
|
|
49
|
+
'End',
|
|
50
|
+
'ArrowLeft',
|
|
51
|
+
'ArrowRight',
|
|
52
|
+
'Clear',
|
|
53
|
+
'Copy',
|
|
54
|
+
'Paste'
|
|
55
|
+
];
|
|
56
|
+
onKeyDown(e) {
|
|
57
|
+
if (!this.talyAppNumericOnly) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (this.navigationKeys.indexOf(e.key) > -1 || // Allow: navigation keys
|
|
61
|
+
(e.key === 'a' && (e.ctrlKey || e.metaKey)) || // Allow: Ctrl+A
|
|
62
|
+
(e.key === 'c' && (e.ctrlKey || e.metaKey)) || // Allow: Ctrl+C
|
|
63
|
+
(e.key === 'v' && (e.ctrlKey || e.metaKey)) || // Allow: Ctrl+V
|
|
64
|
+
(e.key === 'x' && (e.ctrlKey || e.metaKey)) // Allow: Ctrl+X
|
|
65
|
+
) {
|
|
66
|
+
// let it happen, don't do anything
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Ensure that it is a number and stop the keypress
|
|
70
|
+
if (e.key === ' ' || isNaN(Number(e.key))) {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
onPaste(event) {
|
|
75
|
+
if (!this.talyAppNumericOnly) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const pastedInput = event.clipboardData?.getData('text/plain');
|
|
79
|
+
if (pastedInput && !/^\d+$/.test(pastedInput)) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
onDrop(event) {
|
|
84
|
+
if (!this.talyAppNumericOnly) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const textData = event.dataTransfer?.getData('text');
|
|
88
|
+
if (textData && !/^\d+$/.test(textData)) {
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: NumericOnlyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
93
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.15", type: NumericOnlyDirective, isStandalone: true, selector: "[talyAppNumericOnly]", inputs: { talyAppNumericOnly: "talyAppNumericOnly" }, host: { listeners: { "keydown": "onKeyDown($event)", "paste": "onPaste($event)", "drop": "onDrop($event)" } }, ngImport: i0 });
|
|
94
|
+
}
|
|
95
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: NumericOnlyDirective, decorators: [{
|
|
96
|
+
type: Directive,
|
|
97
|
+
args: [{
|
|
98
|
+
selector: '[talyAppNumericOnly]',
|
|
99
|
+
standalone: true
|
|
100
|
+
}]
|
|
101
|
+
}], propDecorators: { talyAppNumericOnly: [{
|
|
102
|
+
type: Input
|
|
103
|
+
}], onKeyDown: [{
|
|
104
|
+
type: HostListener,
|
|
105
|
+
args: ['keydown', ['$event']]
|
|
106
|
+
}], onPaste: [{
|
|
107
|
+
type: HostListener,
|
|
108
|
+
args: ['paste', ['$event']]
|
|
109
|
+
}], onDrop: [{
|
|
110
|
+
type: HostListener,
|
|
111
|
+
args: ['drop', ['$event']]
|
|
112
|
+
}] } });
|
|
113
|
+
|
|
114
|
+
class TalyInput {
|
|
115
|
+
cdr;
|
|
116
|
+
id = '';
|
|
117
|
+
label = '';
|
|
118
|
+
placeholderText = '';
|
|
119
|
+
inputType = 'text';
|
|
120
|
+
inputmodeType = 'text';
|
|
121
|
+
min;
|
|
122
|
+
max;
|
|
123
|
+
autofocus = false;
|
|
124
|
+
_disabled = false;
|
|
125
|
+
_value = null;
|
|
126
|
+
isFocused = false;
|
|
127
|
+
inputRef;
|
|
128
|
+
onChange = (_) => { };
|
|
129
|
+
onTouched = () => { };
|
|
130
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
131
|
+
constructor(cdr) {
|
|
132
|
+
this.cdr = cdr;
|
|
133
|
+
if (this.ngControl) {
|
|
134
|
+
this.ngControl.valueAccessor = this;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
writeValue(value) {
|
|
138
|
+
this._value = value;
|
|
139
|
+
this.cdr.markForCheck();
|
|
140
|
+
}
|
|
141
|
+
registerOnChange(fn) {
|
|
142
|
+
this.onChange = fn;
|
|
143
|
+
}
|
|
144
|
+
registerOnTouched(fn) {
|
|
145
|
+
this.onTouched = fn;
|
|
146
|
+
}
|
|
147
|
+
setDisabledState(isDisabled) {
|
|
148
|
+
this._disabled = isDisabled;
|
|
149
|
+
this.cdr.markForCheck();
|
|
150
|
+
}
|
|
151
|
+
get value() {
|
|
152
|
+
return this._value;
|
|
153
|
+
}
|
|
154
|
+
set value(val) {
|
|
155
|
+
if (val !== this._value) {
|
|
156
|
+
this._value = val;
|
|
157
|
+
this.onChange(val);
|
|
158
|
+
this.cdr.markForCheck();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
handleInputEvent(value) {
|
|
162
|
+
this.value = value;
|
|
163
|
+
}
|
|
164
|
+
onFocus() {
|
|
165
|
+
this.isFocused = true;
|
|
166
|
+
}
|
|
167
|
+
onBlur() {
|
|
168
|
+
this.isFocused = false;
|
|
169
|
+
this.onTouched();
|
|
170
|
+
}
|
|
171
|
+
onReset(event) {
|
|
172
|
+
if (event) {
|
|
173
|
+
event.stopPropagation();
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
}
|
|
176
|
+
this._value = null;
|
|
177
|
+
if (this.inputRef) {
|
|
178
|
+
this.inputRef.nativeElement.value = '';
|
|
179
|
+
this.inputRef.nativeElement.focus();
|
|
180
|
+
}
|
|
181
|
+
this.onChange(null);
|
|
182
|
+
this.cdr.markForCheck();
|
|
183
|
+
}
|
|
184
|
+
get disabled() {
|
|
185
|
+
return this._disabled;
|
|
186
|
+
}
|
|
187
|
+
validate(control) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyInput, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
191
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyInput, isStandalone: true, selector: "lib-taly-input", inputs: { id: "id", label: "label", placeholderText: "placeholderText", inputType: "inputType", inputmodeType: "inputmodeType", min: "min", max: "max", autofocus: "autofocus" }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true }], ngImport: i0, template: "<div class=\"relative flex flex-col rounded-lg border bg-white px-4 py-2 h-[60px]\n transition-all\n focus-within:border-2 focus-within:border-gray-400\" [ngClass]=\"{\n 'bg-gray-100 border-gray-300': disabled,\n 'border-red-500 bg-red-50': ngControl?.invalid && ngControl?.touched\n }\">\n <p-floatlabel class=\"block w-full\">\n <input #inputRef pInputText class=\"w-full h-[48px] border-none outline-none bg-transparent\n text-base text-gray-900 pt-5\n disabled:bg-transparent\" [id]=\"id\" [type]=\"inputType\" [placeholder]=\"''\" [attr.inputmode]=\"inputmodeType\"\n [attr.maxlength]=\"max ?? null\" [disabled]=\"!!disabled\" [value]=\"value\"\n [talyAppNumericOnly]=\"inputType === 'number'\" [min]=\"min\" [max]=\"max\" [autofocus]=\"autofocus\"\n (input)=\"handleInputEvent($event.target.value)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <label [for]=\"id\" class=\"text-gray-600 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n\n <!-- Clear Icon -->\n <button *ngIf=\"!disabled && value\" type=\"button\" class=\"absolute right-4 top-1/2 -translate-y-1/2\n flex items-center justify-center\n w-5 h-5 rounded-full bg-gray-500 text-white\n hover:bg-gray-700 transition-colors z-20\" (click)=\"onReset($event)\">\n <i class=\"pi pi-times !text-[8px] !m-0 !p-0\"></i>\n </button>\n</div>\n\n<!-- Validation messages -->\n<div *ngIf=\"ngControl && ngControl.invalid && ngControl.touched\" class=\"mt-1 text-sm text-red-600\">\n <span *ngIf=\"ngControl.errors?.['required']\">\n {{ label }} is required\n </span>\n\n <span *ngIf=\"ngControl.errors?.['minlength']\">\n Minimum length is {{ ngControl.errors?.['minlength']?.requiredLength }}\n </span>\n\n <span *ngIf=\"ngControl.errors?.['maxlength']\">\n Maximum length is {{ ngControl.errors?.['maxlength']?.requiredLength }}\n </span>\n\n <span *ngIf=\"ngControl.errors?.['email']\">\n Invalid email address\n </span>\n\n <span *ngIf=\"ngControl.errors?.['pattern']\">\n Please enter a valid {{ label }}\n </span>\n</div>", styles: [":host .pi{display:inline-flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel input:focus~label,:host ::ng-deep p-floatlabel input.p-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{border:none!important;box-shadow:none!important;background:transparent!important;outline:none!important;padding-left:0!important;padding-right:0!important;padding-top:1.25rem!important}:host ::ng-deep .p-inputtext:focus{border:none!important;box-shadow:none!important}:host ::ng-deep button{width:20px!important;height:20px!important;padding:0!important;min-width:20px!important;min-height:20px!important}:host ::ng-deep button .pi{font-size:8px!important;width:auto!important;height:auto!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "directive", type: NumericOnlyDirective, selector: "[talyAppNumericOnly]", inputs: ["talyAppNumericOnly"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
192
|
+
}
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyInput, decorators: [{
|
|
194
|
+
type: Component,
|
|
195
|
+
args: [{ selector: 'lib-taly-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, FormsModule, ReactiveFormsModule, InputTextModule, FloatLabelModule, NumericOnlyDirective], template: "<div class=\"relative flex flex-col rounded-lg border bg-white px-4 py-2 h-[60px]\n transition-all\n focus-within:border-2 focus-within:border-gray-400\" [ngClass]=\"{\n 'bg-gray-100 border-gray-300': disabled,\n 'border-red-500 bg-red-50': ngControl?.invalid && ngControl?.touched\n }\">\n <p-floatlabel class=\"block w-full\">\n <input #inputRef pInputText class=\"w-full h-[48px] border-none outline-none bg-transparent\n text-base text-gray-900 pt-5\n disabled:bg-transparent\" [id]=\"id\" [type]=\"inputType\" [placeholder]=\"''\" [attr.inputmode]=\"inputmodeType\"\n [attr.maxlength]=\"max ?? null\" [disabled]=\"!!disabled\" [value]=\"value\"\n [talyAppNumericOnly]=\"inputType === 'number'\" [min]=\"min\" [max]=\"max\" [autofocus]=\"autofocus\"\n (input)=\"handleInputEvent($event.target.value)\" (focus)=\"onFocus()\" (blur)=\"onBlur()\" />\n <label [for]=\"id\" class=\"text-gray-600 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n\n <!-- Clear Icon -->\n <button *ngIf=\"!disabled && value\" type=\"button\" class=\"absolute right-4 top-1/2 -translate-y-1/2\n flex items-center justify-center\n w-5 h-5 rounded-full bg-gray-500 text-white\n hover:bg-gray-700 transition-colors z-20\" (click)=\"onReset($event)\">\n <i class=\"pi pi-times !text-[8px] !m-0 !p-0\"></i>\n </button>\n</div>\n\n<!-- Validation messages -->\n<div *ngIf=\"ngControl && ngControl.invalid && ngControl.touched\" class=\"mt-1 text-sm text-red-600\">\n <span *ngIf=\"ngControl.errors?.['required']\">\n {{ label }} is required\n </span>\n\n <span *ngIf=\"ngControl.errors?.['minlength']\">\n Minimum length is {{ ngControl.errors?.['minlength']?.requiredLength }}\n </span>\n\n <span *ngIf=\"ngControl.errors?.['maxlength']\">\n Maximum length is {{ ngControl.errors?.['maxlength']?.requiredLength }}\n </span>\n\n <span *ngIf=\"ngControl.errors?.['email']\">\n Invalid email address\n </span>\n\n <span *ngIf=\"ngControl.errors?.['pattern']\">\n Please enter a valid {{ label }}\n </span>\n</div>", styles: [":host .pi{display:inline-flex;align-items:center;justify-content:center;line-height:1}:host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel input:focus~label,:host ::ng-deep p-floatlabel input.p-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{border:none!important;box-shadow:none!important;background:transparent!important;outline:none!important;padding-left:0!important;padding-right:0!important;padding-top:1.25rem!important}:host ::ng-deep .p-inputtext:focus{border:none!important;box-shadow:none!important}:host ::ng-deep button{width:20px!important;height:20px!important;padding:0!important;min-width:20px!important;min-height:20px!important}:host ::ng-deep button .pi{font-size:8px!important;width:auto!important;height:auto!important}\n"] }]
|
|
196
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { id: [{
|
|
197
|
+
type: Input
|
|
198
|
+
}], label: [{
|
|
199
|
+
type: Input
|
|
200
|
+
}], placeholderText: [{
|
|
201
|
+
type: Input
|
|
202
|
+
}], inputType: [{
|
|
203
|
+
type: Input
|
|
204
|
+
}], inputmodeType: [{
|
|
205
|
+
type: Input
|
|
206
|
+
}], min: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], max: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], autofocus: [{
|
|
211
|
+
type: Input
|
|
212
|
+
}], inputRef: [{
|
|
213
|
+
type: ViewChild,
|
|
214
|
+
args: ['inputRef']
|
|
215
|
+
}] } });
|
|
216
|
+
|
|
217
|
+
class TalySelect {
|
|
218
|
+
cdr = inject(ChangeDetectorRef);
|
|
219
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
220
|
+
constructor() {
|
|
221
|
+
if (this.ngControl) {
|
|
222
|
+
this.ngControl.valueAccessor = this;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// ===== Inputs =====
|
|
226
|
+
id;
|
|
227
|
+
label;
|
|
228
|
+
options = [];
|
|
229
|
+
optionsValue;
|
|
230
|
+
optionsLabel;
|
|
231
|
+
placeholderText = '';
|
|
232
|
+
formGroup;
|
|
233
|
+
controlName;
|
|
234
|
+
min;
|
|
235
|
+
max;
|
|
236
|
+
textDirection;
|
|
237
|
+
set isDisabled(value) {
|
|
238
|
+
this.disabled = value;
|
|
239
|
+
this.cdr.markForCheck();
|
|
240
|
+
}
|
|
241
|
+
disabled = false;
|
|
242
|
+
showErrorMessages = false;
|
|
243
|
+
// ===== Internal value =====
|
|
244
|
+
_value = null;
|
|
245
|
+
get f() {
|
|
246
|
+
return this.formGroup?.controls;
|
|
247
|
+
}
|
|
248
|
+
get value() {
|
|
249
|
+
return this._value;
|
|
250
|
+
}
|
|
251
|
+
set value(val) {
|
|
252
|
+
this._value = val;
|
|
253
|
+
this.onChange(val);
|
|
254
|
+
this.cdr.markForCheck();
|
|
255
|
+
}
|
|
256
|
+
// ===== ControlValueAccessor =====
|
|
257
|
+
onChange = () => { };
|
|
258
|
+
onTouched = () => { };
|
|
259
|
+
writeValue(value) {
|
|
260
|
+
this._value = value;
|
|
261
|
+
if (this.formGroup && this.controlName) {
|
|
262
|
+
this.formGroup.get(this.controlName)?.setValue(value, {
|
|
263
|
+
emitEvent: false,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
this.cdr.markForCheck();
|
|
267
|
+
}
|
|
268
|
+
registerOnChange(fn) {
|
|
269
|
+
this.onChange = fn;
|
|
270
|
+
}
|
|
271
|
+
registerOnTouched(fn) {
|
|
272
|
+
this.onTouched = fn;
|
|
273
|
+
}
|
|
274
|
+
setDisabledState(isDisabled) {
|
|
275
|
+
this.disabled = isDisabled;
|
|
276
|
+
this.cdr.markForCheck();
|
|
277
|
+
}
|
|
278
|
+
// ===== Validator =====
|
|
279
|
+
validate() {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
// ===== UI Events =====
|
|
283
|
+
onReset(event) {
|
|
284
|
+
event.inputField = null;
|
|
285
|
+
this._value = null;
|
|
286
|
+
this.onChange(null);
|
|
287
|
+
this.cdr.markForCheck();
|
|
288
|
+
}
|
|
289
|
+
onHide() {
|
|
290
|
+
this.showErrorMessages = true;
|
|
291
|
+
this.cdr.markForCheck();
|
|
292
|
+
}
|
|
293
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalySelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
294
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: TalySelect, isStandalone: true, selector: "lib-taly-select", inputs: { id: "id", label: "label", options: "options", optionsValue: "optionsValue", optionsLabel: "optionsLabel", placeholderText: "placeholderText", formGroup: "formGroup", controlName: "controlName", min: "min", max: "max", textDirection: "textDirection", isDisabled: "isDisabled" }, ngImport: i0, template: "<div [formGroup]=\"formGroup\" class=\"flex flex-col gap-1\" [ngClass]=\"{\n 'opacity-50 pointer-events-none': disabled,\n 'rtl': textDirection === 'rtl'\n }\">\n <!-- Select Wrapper -->\n <div class=\"flex flex-col rounded-lg border bg-white px-4 py-2 h-[60px]\n transition-all\n focus-within:border-2 focus-within:border-gray-400\" [ngClass]=\"{\n 'bg-gray-100 border-gray-300': disabled,\n 'border-red-500 bg-red-50': showErrorMessages && f[controlName].invalid && f[controlName].touched\n }\">\n <p-floatlabel class=\"block w-full\">\n <p-select class=\"w-full\" [options]=\"options\" [placeholder]=\"''\" [formControlName]=\"controlName\"\n [disabled]=\"disabled\" [optionLabel]=\"optionsLabel\" [optionValue]=\"optionsValue\" [inputId]=\"id\"\n (onHide)=\"onHide()\">\n <ng-template pTemplate=\"selectedItem\" let-item>\n {{ item?.[optionsLabel] }}\n </ng-template>\n\n <ng-template pTemplate=\"option\" let-item>\n {{ item?.[optionsLabel] }}\n </ng-template>\n </p-select>\n\n <!-- Label -->\n <label [for]=\"id\" class=\"text-gray-600 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n </div>\n</div>\n\n<!-- Validation Error -->\n@if (showErrorMessages && f[controlName].invalid && f[controlName].touched) {\n<div class=\"mt-1 text-sm text-red-600\">\n @if (f[controlName].hasError('required')) {\n <span>{{ label }} is required</span>\n }\n</div>\n}", styles: [":host ::ng-deep .pi{cursor:pointer;background:var(--shades-10);color:var(--brand-white);border-radius:9999px;padding:3px;font-weight:700}:host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel .p-select.p-focus~label,:host ::ng-deep p-floatlabel .p-select.p-inputwrapper-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{padding:0 16px}:host ::ng-deep .p-inputtext:enabled:focus{box-shadow:none}:host ::ng-deep .p-select{background:transparent;border:none!important;width:100%;border-radius:0;box-shadow:none!important}:host ::ng-deep .p-select:not(.p-disabled).p-focus{box-shadow:none!important;border:none!important}:host ::ng-deep .p-select .p-select-label{padding-left:0;padding-top:1.25rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i3$1.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
295
|
+
}
|
|
296
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalySelect, decorators: [{
|
|
297
|
+
type: Component,
|
|
298
|
+
args: [{ selector: 'lib-taly-select', standalone: true, imports: [
|
|
299
|
+
CommonModule,
|
|
300
|
+
ReactiveFormsModule,
|
|
301
|
+
SelectModule,
|
|
302
|
+
FloatLabelModule,
|
|
303
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [formGroup]=\"formGroup\" class=\"flex flex-col gap-1\" [ngClass]=\"{\n 'opacity-50 pointer-events-none': disabled,\n 'rtl': textDirection === 'rtl'\n }\">\n <!-- Select Wrapper -->\n <div class=\"flex flex-col rounded-lg border bg-white px-4 py-2 h-[60px]\n transition-all\n focus-within:border-2 focus-within:border-gray-400\" [ngClass]=\"{\n 'bg-gray-100 border-gray-300': disabled,\n 'border-red-500 bg-red-50': showErrorMessages && f[controlName].invalid && f[controlName].touched\n }\">\n <p-floatlabel class=\"block w-full\">\n <p-select class=\"w-full\" [options]=\"options\" [placeholder]=\"''\" [formControlName]=\"controlName\"\n [disabled]=\"disabled\" [optionLabel]=\"optionsLabel\" [optionValue]=\"optionsValue\" [inputId]=\"id\"\n (onHide)=\"onHide()\">\n <ng-template pTemplate=\"selectedItem\" let-item>\n {{ item?.[optionsLabel] }}\n </ng-template>\n\n <ng-template pTemplate=\"option\" let-item>\n {{ item?.[optionsLabel] }}\n </ng-template>\n </p-select>\n\n <!-- Label -->\n <label [for]=\"id\" class=\"text-gray-600 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n </div>\n</div>\n\n<!-- Validation Error -->\n@if (showErrorMessages && f[controlName].invalid && f[controlName].touched) {\n<div class=\"mt-1 text-sm text-red-600\">\n @if (f[controlName].hasError('required')) {\n <span>{{ label }} is required</span>\n }\n</div>\n}", styles: [":host ::ng-deep .pi{cursor:pointer;background:var(--shades-10);color:var(--brand-white);border-radius:9999px;padding:3px;font-weight:700}:host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel .p-select.p-focus~label,:host ::ng-deep p-floatlabel .p-select.p-inputwrapper-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{padding:0 16px}:host ::ng-deep .p-inputtext:enabled:focus{box-shadow:none}:host ::ng-deep .p-select{background:transparent;border:none!important;width:100%;border-radius:0;box-shadow:none!important}:host ::ng-deep .p-select:not(.p-disabled).p-focus{box-shadow:none!important;border:none!important}:host ::ng-deep .p-select .p-select-label{padding-left:0;padding-top:1.25rem}\n"] }]
|
|
304
|
+
}], ctorParameters: () => [], propDecorators: { id: [{
|
|
305
|
+
type: Input,
|
|
306
|
+
args: [{ required: true }]
|
|
307
|
+
}], label: [{
|
|
308
|
+
type: Input,
|
|
309
|
+
args: [{ required: true }]
|
|
310
|
+
}], options: [{
|
|
311
|
+
type: Input,
|
|
312
|
+
args: [{ required: true }]
|
|
313
|
+
}], optionsValue: [{
|
|
314
|
+
type: Input
|
|
315
|
+
}], optionsLabel: [{
|
|
316
|
+
type: Input
|
|
317
|
+
}], placeholderText: [{
|
|
318
|
+
type: Input
|
|
319
|
+
}], formGroup: [{
|
|
320
|
+
type: Input,
|
|
321
|
+
args: [{ required: true }]
|
|
322
|
+
}], controlName: [{
|
|
323
|
+
type: Input,
|
|
324
|
+
args: [{ required: true }]
|
|
325
|
+
}], min: [{
|
|
326
|
+
type: Input
|
|
327
|
+
}], max: [{
|
|
328
|
+
type: Input
|
|
329
|
+
}], textDirection: [{
|
|
330
|
+
type: Input
|
|
331
|
+
}], isDisabled: [{
|
|
332
|
+
type: Input
|
|
333
|
+
}] } });
|
|
334
|
+
|
|
335
|
+
class TalyInputGroup {
|
|
336
|
+
cdr = inject(ChangeDetectorRef);
|
|
337
|
+
inputField;
|
|
338
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
339
|
+
// Optional NgControl injection
|
|
340
|
+
constructor() {
|
|
341
|
+
if (this.ngControl != null) {
|
|
342
|
+
this.ngControl.valueAccessor = this;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// ===== Inputs =====
|
|
346
|
+
id = '';
|
|
347
|
+
label = '';
|
|
348
|
+
placeholderText = '';
|
|
349
|
+
inputType = 'text';
|
|
350
|
+
formGroup;
|
|
351
|
+
controlName;
|
|
352
|
+
min;
|
|
353
|
+
max;
|
|
354
|
+
inputmodeType = 'none';
|
|
355
|
+
autofocus = false;
|
|
356
|
+
set isDisabled(disable) {
|
|
357
|
+
this.disabled = disable;
|
|
358
|
+
this.cdr.markForCheck();
|
|
359
|
+
}
|
|
360
|
+
disabled = false;
|
|
361
|
+
textDirection;
|
|
362
|
+
get f() {
|
|
363
|
+
return this.formGroup?.controls;
|
|
364
|
+
}
|
|
365
|
+
// ===== ControlValueAccessor internal value =====
|
|
366
|
+
_value = null;
|
|
367
|
+
set value(val) {
|
|
368
|
+
this._value = val;
|
|
369
|
+
this.onChange(val);
|
|
370
|
+
this.cdr.markForCheck();
|
|
371
|
+
}
|
|
372
|
+
get value() {
|
|
373
|
+
return this._value;
|
|
374
|
+
}
|
|
375
|
+
onChange = () => { };
|
|
376
|
+
onTouched = () => { };
|
|
377
|
+
writeValue(value) {
|
|
378
|
+
this._value = value;
|
|
379
|
+
this.cdr.markForCheck();
|
|
380
|
+
}
|
|
381
|
+
registerOnChange(fn) {
|
|
382
|
+
this.onChange = fn;
|
|
383
|
+
}
|
|
384
|
+
registerOnTouched(fn) {
|
|
385
|
+
this.onTouched = fn;
|
|
386
|
+
}
|
|
387
|
+
validate() {
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
onReset(event) {
|
|
391
|
+
if (event) {
|
|
392
|
+
event.stopPropagation();
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
}
|
|
395
|
+
const control = this.formGroup?.get(this.controlName);
|
|
396
|
+
if (control) {
|
|
397
|
+
control.setValue(null);
|
|
398
|
+
control.markAsPristine();
|
|
399
|
+
control.markAsUntouched();
|
|
400
|
+
}
|
|
401
|
+
if (this.inputField) {
|
|
402
|
+
this.inputField.nativeElement.value = '';
|
|
403
|
+
}
|
|
404
|
+
this.cdr.markForCheck();
|
|
405
|
+
}
|
|
406
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyInputGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
407
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyInputGroup, isStandalone: true, selector: "lib-taly-input-group", inputs: { id: "id", label: "label", placeholderText: "placeholderText", inputType: "inputType", formGroup: "formGroup", controlName: "controlName", min: "min", max: "max", inputmodeType: "inputmodeType", autofocus: "autofocus", isDisabled: "isDisabled" }, viewQueries: [{ propertyName: "inputField", first: true, predicate: ["inputField"], descendants: true }], ngImport: i0, template: "<div [formGroup]=\"formGroup\" [class.opacity-50]=\"disabled\" class=\"flex flex-col gap-1 w-full\">\n\n <!-- Input group -->\n <div class=\"relative flex items-center border rounded-lg px-4 py-2\n bg-white\n focus-within:ring-2 focus-within:ring-blue-500\n [&.input-error]:border-red-500 [&.input-error]:bg-red-50\n [&.disabled]:bg-gray-200\" [class.input-error]=\"f[controlName]?.invalid && f[controlName]?.touched\"\n [class.disabled]=\"disabled\" dir=\"ltr\">\n\n <!-- Addon content -->\n <span class=\"mr-2 text-gray-700 flex-shrink-0\">\n <ng-content select=\"[addonContent]\"></ng-content>\n </span>\n\n <p-floatlabel class=\"flex-1\">\n <!-- Input -->\n <input [type]=\"inputType\" [formControlName]=\"controlName\" [id]=\"id\" [placeholder]=\"''\" [disabled]=\"disabled\"\n [attr.inputmode]=\"inputmodeType\" class=\"peer w-full bg-transparent text-gray-900 text-base focus:outline-none\"\n #inputField [talyAppNumericOnly]=\"inputType === 'number'\" pInputText pAutoFocus [min]=\"min\" [max]=\"max\"\n [attr.maxlength]=\"max\" />\n\n <label [for]=\"id\" class=\"text-gray-500 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n\n <!-- Clear icon -->\n <button *ngIf=\"!disabled && f[controlName]?.value\" type=\"button\" class=\"cursor-pointer rounded-full bg-gray-500 text-white\n w-5 h-5 flex-shrink-0 flex items-center justify-center hover:bg-gray-700 ml-2 transition-colors z-20\"\n (click)=\"onReset($event)\">\n <i class=\"pi pi-times !text-[8px] !m-0 !p-0\"></i>\n </button>\n </div>\n\n <!-- Error messages -->\n <div *ngIf=\"f[controlName]?.invalid && f[controlName]?.touched\" class=\"text-red-600 text-sm mt-1\">\n <span *ngIf=\"f[controlName]?.hasError('required')\">{{ label }} is required</span>\n <span *ngIf=\"f[controlName]?.hasError('minlength') && !f[controlName]?.hasError('required')\">\n Minimum length is {{ f[controlName]?.getError('minlength')?.requiredLength }}\n </span>\n <span *ngIf=\"f[controlName]?.hasError('maxlength') && \n !f[controlName]?.hasError('required') &&\n !f[controlName]?.hasError('minlength')\">\n Maximum length is {{ f[controlName]?.getError('maxlength')?.requiredLength }}\n </span>\n <span *ngIf=\"f[controlName]?.hasError('email') &&\n !f[controlName]?.hasError('required')\">\n Invalid email address\n </span>\n <span *ngIf=\"f[controlName]?.hasError('pattern') &&\n !f[controlName]?.hasError('required') &&\n !f[controlName]?.hasError('email') &&\n !f[controlName]?.hasError('minlength') &&\n !f[controlName]?.hasError('maxlength')\">\n Please enter a valid {{ label }}\n </span>\n </div>\n</div>", styles: [":host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel input:focus~label,:host ::ng-deep p-floatlabel input.p-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{border:none!important;box-shadow:none!important;background:transparent!important;outline:none!important;padding-left:0!important;padding-right:0!important;padding-top:1.25rem!important}:host ::ng-deep .p-inputtext:focus{border:none!important;box-shadow:none!important}:host ::ng-deep button{width:20px!important;height:20px!important;padding:0!important;min-width:20px!important;min-height:20px!important;display:flex!important;align-items:center!important;justify-content:center!important}:host ::ng-deep button .pi{font-size:8px!important;width:auto!important;height:auto!important;margin:0!important;padding:0!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: FloatLabelModule }, { kind: "component", type: i3.FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }, { kind: "directive", type: NumericOnlyDirective, selector: "[talyAppNumericOnly]", inputs: ["talyAppNumericOnly"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
408
|
+
}
|
|
409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyInputGroup, decorators: [{
|
|
410
|
+
type: Component,
|
|
411
|
+
args: [{ selector: 'lib-taly-input-group', standalone: true, imports: [CommonModule, ReactiveFormsModule, FloatLabelModule, InputTextModule, NumericOnlyDirective], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [formGroup]=\"formGroup\" [class.opacity-50]=\"disabled\" class=\"flex flex-col gap-1 w-full\">\n\n <!-- Input group -->\n <div class=\"relative flex items-center border rounded-lg px-4 py-2\n bg-white\n focus-within:ring-2 focus-within:ring-blue-500\n [&.input-error]:border-red-500 [&.input-error]:bg-red-50\n [&.disabled]:bg-gray-200\" [class.input-error]=\"f[controlName]?.invalid && f[controlName]?.touched\"\n [class.disabled]=\"disabled\" dir=\"ltr\">\n\n <!-- Addon content -->\n <span class=\"mr-2 text-gray-700 flex-shrink-0\">\n <ng-content select=\"[addonContent]\"></ng-content>\n </span>\n\n <p-floatlabel class=\"flex-1\">\n <!-- Input -->\n <input [type]=\"inputType\" [formControlName]=\"controlName\" [id]=\"id\" [placeholder]=\"''\" [disabled]=\"disabled\"\n [attr.inputmode]=\"inputmodeType\" class=\"peer w-full bg-transparent text-gray-900 text-base focus:outline-none\"\n #inputField [talyAppNumericOnly]=\"inputType === 'number'\" pInputText pAutoFocus [min]=\"min\" [max]=\"max\"\n [attr.maxlength]=\"max\" />\n\n <label [for]=\"id\" class=\"text-gray-500 font-medium\">\n {{ label }}\n </label>\n </p-floatlabel>\n\n <!-- Clear icon -->\n <button *ngIf=\"!disabled && f[controlName]?.value\" type=\"button\" class=\"cursor-pointer rounded-full bg-gray-500 text-white\n w-5 h-5 flex-shrink-0 flex items-center justify-center hover:bg-gray-700 ml-2 transition-colors z-20\"\n (click)=\"onReset($event)\">\n <i class=\"pi pi-times !text-[8px] !m-0 !p-0\"></i>\n </button>\n </div>\n\n <!-- Error messages -->\n <div *ngIf=\"f[controlName]?.invalid && f[controlName]?.touched\" class=\"text-red-600 text-sm mt-1\">\n <span *ngIf=\"f[controlName]?.hasError('required')\">{{ label }} is required</span>\n <span *ngIf=\"f[controlName]?.hasError('minlength') && !f[controlName]?.hasError('required')\">\n Minimum length is {{ f[controlName]?.getError('minlength')?.requiredLength }}\n </span>\n <span *ngIf=\"f[controlName]?.hasError('maxlength') && \n !f[controlName]?.hasError('required') &&\n !f[controlName]?.hasError('minlength')\">\n Maximum length is {{ f[controlName]?.getError('maxlength')?.requiredLength }}\n </span>\n <span *ngIf=\"f[controlName]?.hasError('email') &&\n !f[controlName]?.hasError('required')\">\n Invalid email address\n </span>\n <span *ngIf=\"f[controlName]?.hasError('pattern') &&\n !f[controlName]?.hasError('required') &&\n !f[controlName]?.hasError('email') &&\n !f[controlName]?.hasError('minlength') &&\n !f[controlName]?.hasError('maxlength')\">\n Please enter a valid {{ label }}\n </span>\n </div>\n</div>", styles: [":host ::ng-deep p-floatlabel{display:block;width:100%;position:relative}:host ::ng-deep p-floatlabel label{left:0!important;top:50%!important;transform:translateY(-50%)!important;transition:all .2s ease!important;pointer-events:none;color:var(--shades-8);font-weight:500}:host ::ng-deep p-floatlabel input:focus~label,:host ::ng-deep p-floatlabel input.p-filled~label{top:4px!important;transform:translateY(0)!important;font-size:11px!important;color:var(--shades-6)!important}:host ::ng-deep .p-inputtext{border:none!important;box-shadow:none!important;background:transparent!important;outline:none!important;padding-left:0!important;padding-right:0!important;padding-top:1.25rem!important}:host ::ng-deep .p-inputtext:focus{border:none!important;box-shadow:none!important}:host ::ng-deep button{width:20px!important;height:20px!important;padding:0!important;min-width:20px!important;min-height:20px!important;display:flex!important;align-items:center!important;justify-content:center!important}:host ::ng-deep button .pi{font-size:8px!important;width:auto!important;height:auto!important;margin:0!important;padding:0!important}\n"] }]
|
|
412
|
+
}], ctorParameters: () => [], propDecorators: { inputField: [{
|
|
413
|
+
type: ViewChild,
|
|
414
|
+
args: ['inputField']
|
|
415
|
+
}], id: [{
|
|
416
|
+
type: Input,
|
|
417
|
+
args: [{ required: true }]
|
|
418
|
+
}], label: [{
|
|
419
|
+
type: Input,
|
|
420
|
+
args: [{ required: true }]
|
|
421
|
+
}], placeholderText: [{
|
|
422
|
+
type: Input
|
|
423
|
+
}], inputType: [{
|
|
424
|
+
type: Input
|
|
425
|
+
}], formGroup: [{
|
|
426
|
+
type: Input
|
|
427
|
+
}], controlName: [{
|
|
428
|
+
type: Input
|
|
429
|
+
}], min: [{
|
|
430
|
+
type: Input
|
|
431
|
+
}], max: [{
|
|
432
|
+
type: Input
|
|
433
|
+
}], inputmodeType: [{
|
|
434
|
+
type: Input
|
|
435
|
+
}], autofocus: [{
|
|
436
|
+
type: Input
|
|
437
|
+
}], isDisabled: [{
|
|
438
|
+
type: Input
|
|
439
|
+
}] } });
|
|
440
|
+
|
|
441
|
+
class TalyTable {
|
|
442
|
+
// Table data
|
|
443
|
+
value = [];
|
|
444
|
+
// Table loading indicator
|
|
445
|
+
loading = false;
|
|
446
|
+
// Pagination options
|
|
447
|
+
paginator = true;
|
|
448
|
+
rows = 100;
|
|
449
|
+
first = 0;
|
|
450
|
+
lazy = false;
|
|
451
|
+
totalRecords = 0;
|
|
452
|
+
// Sorting
|
|
453
|
+
sortable = true;
|
|
454
|
+
sortField;
|
|
455
|
+
sortOrder;
|
|
456
|
+
// Selection
|
|
457
|
+
selection;
|
|
458
|
+
selectionChange = new EventEmitter();
|
|
459
|
+
userId;
|
|
460
|
+
// Filtering
|
|
461
|
+
globalFilterFields;
|
|
462
|
+
// Columns
|
|
463
|
+
columns = [];
|
|
464
|
+
// UI options
|
|
465
|
+
showSelectionCheckbox = false;
|
|
466
|
+
showRowIndex = false;
|
|
467
|
+
selectionMode = null;
|
|
468
|
+
dataKey;
|
|
469
|
+
// Templates
|
|
470
|
+
actionTemplate;
|
|
471
|
+
statusTemplate;
|
|
472
|
+
// Events
|
|
473
|
+
rowSelect = new EventEmitter();
|
|
474
|
+
onLazyLoad = new EventEmitter();
|
|
475
|
+
onSort = new EventEmitter();
|
|
476
|
+
onPage = new EventEmitter();
|
|
477
|
+
onFilter = new EventEmitter();
|
|
478
|
+
onRowSelect = new EventEmitter();
|
|
479
|
+
onRowUnselect = new EventEmitter();
|
|
480
|
+
pageChange = new EventEmitter();
|
|
481
|
+
rowClick = new EventEmitter();
|
|
482
|
+
onSelectionChange(event) {
|
|
483
|
+
this.selectionChange.emit(event.value);
|
|
484
|
+
}
|
|
485
|
+
onPageChange(event) {
|
|
486
|
+
this.onPage.emit(event);
|
|
487
|
+
}
|
|
488
|
+
onSortChange(event) {
|
|
489
|
+
this.onSort.emit(event);
|
|
490
|
+
}
|
|
491
|
+
onFilterChange(event) {
|
|
492
|
+
this.onFilter.emit(event);
|
|
493
|
+
}
|
|
494
|
+
onRowSelectEvent(event) {
|
|
495
|
+
this.onRowSelect.emit(event.data);
|
|
496
|
+
}
|
|
497
|
+
onRowUnselectEvent(event) {
|
|
498
|
+
this.onRowUnselect.emit(event.data);
|
|
499
|
+
}
|
|
500
|
+
onRowClick(rowData) {
|
|
501
|
+
this.rowClick.emit(rowData);
|
|
502
|
+
}
|
|
503
|
+
onPaginate(event) {
|
|
504
|
+
const page = Math.floor(event.first / event.rows);
|
|
505
|
+
const size = event.rows;
|
|
506
|
+
this.pageChange.emit({ page, size });
|
|
507
|
+
}
|
|
508
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
509
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyTable, isStandalone: true, selector: "lib-taly-table", inputs: { value: "value", loading: "loading", paginator: "paginator", rows: "rows", first: "first", lazy: "lazy", totalRecords: "totalRecords", sortable: "sortable", sortField: "sortField", sortOrder: "sortOrder", selection: "selection", userId: "userId", globalFilterFields: "globalFilterFields", columns: "columns", showSelectionCheckbox: "showSelectionCheckbox", showRowIndex: "showRowIndex", selectionMode: "selectionMode", dataKey: "dataKey" }, outputs: { selectionChange: "selectionChange", rowSelect: "rowSelect", onLazyLoad: "onLazyLoad", onSort: "onSort", onPage: "onPage", onFilter: "onFilter", onRowSelect: "onRowSelect", onRowUnselect: "onRowUnselect", pageChange: "pageChange", rowClick: "rowClick" }, queries: [{ propertyName: "actionTemplate", first: true, predicate: ["actionTemplate"], descendants: true }, { propertyName: "statusTemplate", first: true, predicate: ["statusTemplate"], descendants: true }], ngImport: i0, template: "<p-table [lazy]=\"lazy\" [value]=\"value\" [loading]=\"loading\" [paginator]=\"paginator\" [rows]=\"rows\"\n [totalRecords]=\"totalRecords\" [sortField]=\"sortField\" [sortOrder]=\"sortOrder ?? 1\" [(selection)]=\"selection\"\n [selectionMode]=\"selectionMode\" [dataKey]=\"dataKey\" [rowsPerPageOptions]=\"[50,100,200,300,400,500]\"\n [showCurrentPageReport]=\"true\" [first]=\"first\" [globalFilterFields]=\"globalFilterFields\"\n (onRowSelect)=\"onRowSelectEvent($event)\" (selectionChange)=\"onSelectionChange($event)\" (onSort)=\"onSortChange($event)\"\n (onFilter)=\"onFilterChange($event)\" (onPage)=\"onPaginate($event)\" showGridlines responsiveLayout=\"scroll\"\n currentPageReportTemplate=\"Showing {first} to {last} of {totalRecords} entries\"\n class=\"min-w-full border-separate border-spacing-0 border border-gray-200 rounded-xl overflow-hidden shadow-md bg-white\">\n\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr class=\"bg-gray-50 text-left text-gray-700 font-medium text-sm\">\n <th *ngIf=\"showRowIndex\" class=\"px-4 py-2 w-16\">#</th>\n <th *ngIf=\"showSelectionCheckbox\" class=\"px-4 py-2 w-12\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"(sortable && col.sortable) ? col.field : undefined\"\n class=\"px-4 py-2\" [style.width]=\"col.width || 'auto'\" [ngStyle]=\"col.style\">\n <div class=\"flex items-center gap-2\">\n {{ col.header }}\n <p-sortIcon *ngIf=\"sortable && col.sortable\" [field]=\"col.field\"></p-sortIcon>\n </div>\n <p-columnFilter *ngIf=\"col.filter\" [field]=\"col.field\" matchMode=\"contains\"></p-columnFilter>\n </th>\n\n <th *ngIf=\"actionTemplate\" class=\"px-4 py-2 w-32\">Actions</th>\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n <tr (click)=\"onRowClick(rowData)\" class=\"hover:bg-gray-50 cursor-pointer border-b border-gray-100\">\n <td *ngIf=\"showRowIndex\" class=\"px-4 py-2 text-gray-500\">\n {{ rowIndex + 1 }}\n </td>\n <td *ngIf=\"showSelectionCheckbox\" class=\"px-4 py-2\" (click)=\"$event.stopPropagation()\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngFor=\"let col of columns\" class=\"px-4 py-2\">\n <ng-container [ngSwitch]=\"col.type || 'text'\">\n\n <!-- TEXT -->\n <span *ngSwitchCase=\"'text'\" class=\"text-gray-800\">\n {{ rowData[col.field] }}\n </span>\n\n <!-- DATE -->\n <span *ngSwitchCase=\"'date'\" class=\"text-gray-700\">\n {{ rowData[col.field] | date:'short' }}\n </span>\n\n <!-- NUMBER -->\n <span *ngSwitchCase=\"'number'\" class=\"text-gray-800\">\n {{ rowData[col.field] | number }}\n </span>\n\n <!-- BOOLEAN -->\n <i *ngSwitchCase=\"'boolean'\" class=\"pi\" [ngClass]=\"{\n 'pi-check-circle text-green-500': rowData[col.field],\n 'pi-times-circle text-red-500': !rowData[col.field]\n }\"></i>\n\n <!-- STATUS -->\n <ng-container *ngSwitchCase=\"'status'\">\n <span class=\"px-2 py-1 rounded-full text-xs font-semibold text-white\" [ngClass]=\"{\n 'bg-gray-500': rowData[col.field] === 'PENDING',\n 'bg-blue-500': rowData[col.field] === 'JOINED' || rowData[col.field] === 'ONBOARDED',\n 'bg-green-500': rowData[col.field] === 'APPROVED' || rowData[col.field] === 'PAID' || rowData[col.field] === 'CONFIRMED',\n 'bg-red-500': rowData[col.field] === 'REJECTED' || rowData[col.field] === 'UNPAID' || rowData[col.field] === 'CANCELED' || rowData[col.field] === 'Over Due',\n 'bg-yellow-400': rowData[col.field] === 'Missed'\n }\">\n {{ rowData[col.field] }}\n </span>\n </ng-container>\n\n <!-- DEACTIVATED -->\n <ng-container *ngSwitchCase=\"'deactivated'\">\n <span class=\"px-2 py-1 rounded-full text-xs font-semibold text-white\"\n [ngClass]=\"rowData.deactivated ? 'bg-red-500' : 'bg-green-500'\">\n {{ rowData.deactivated ? 'Deactivated' : 'Active' }}\n </span>\n </ng-container>\n\n <!-- LINK -->\n <ng-container *ngSwitchCase=\"'link'\">\n <span class=\"text-blue-500 hover:underline cursor-pointer\" (click)=\"$event.stopPropagation()\">\n {{ rowData[col.field] }}\n </span>\n </ng-container>\n\n <!-- DEFAULT -->\n <span *ngSwitchDefault class=\"text-gray-800\">\n {{ rowData[col.field] }}\n </span>\n\n </ng-container>\n </td>\n\n <td *ngIf=\"actionTemplate\" class=\"px-4 py-2\">\n <ng-container *ngTemplateOutlet=\"actionTemplate; context: { $implicit: rowData }\"></ng-container>\n </td>\n </tr>\n </ng-template>\n\n <!-- EMPTY -->\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td class=\"text-center text-gray-500 py-4\"\n [attr.colspan]=\"columns.length + (actionTemplate ? 1 : 0) + (showRowIndex ? 1 : 0) + (showSelectionCheckbox ? 1 : 0)\">\n No records found\n </td>\n </tr>\n </ng-template>\n</p-table>", styles: [":host .p-datatable-thead>tr>th{@apply text-left font-bold text-gray-700 bg-gray-100 px-3 py-2 border-b border-gray-200;transition:box-shadow .2s}:host .p-datatable-tbody>tr>td{@apply text-gray-800 px-3 py-2 border-b border-gray-200 text-sm;}:host .p-datatable{@apply w-full border border-gray-200 rounded-lg;}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i2$2.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: i4.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i2$2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i2$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i2$2.TableCheckbox, selector: "p-tableCheckbox", inputs: ["value", "disabled", "required", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i2$2.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i2$2.ColumnFilter, selector: "p-columnFilter, p-column-filter, p-columnfilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "filterOn", "useGrouping", "showButtons", "ariaLabel", "filterButtonProps"], outputs: ["onShow", "onHide"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
|
|
510
|
+
}
|
|
511
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyTable, decorators: [{
|
|
512
|
+
type: Component,
|
|
513
|
+
args: [{ selector: 'lib-taly-table', standalone: true, imports: [
|
|
514
|
+
CommonModule,
|
|
515
|
+
TableModule, // required if using p-table
|
|
516
|
+
], template: "<p-table [lazy]=\"lazy\" [value]=\"value\" [loading]=\"loading\" [paginator]=\"paginator\" [rows]=\"rows\"\n [totalRecords]=\"totalRecords\" [sortField]=\"sortField\" [sortOrder]=\"sortOrder ?? 1\" [(selection)]=\"selection\"\n [selectionMode]=\"selectionMode\" [dataKey]=\"dataKey\" [rowsPerPageOptions]=\"[50,100,200,300,400,500]\"\n [showCurrentPageReport]=\"true\" [first]=\"first\" [globalFilterFields]=\"globalFilterFields\"\n (onRowSelect)=\"onRowSelectEvent($event)\" (selectionChange)=\"onSelectionChange($event)\" (onSort)=\"onSortChange($event)\"\n (onFilter)=\"onFilterChange($event)\" (onPage)=\"onPaginate($event)\" showGridlines responsiveLayout=\"scroll\"\n currentPageReportTemplate=\"Showing {first} to {last} of {totalRecords} entries\"\n class=\"min-w-full border-separate border-spacing-0 border border-gray-200 rounded-xl overflow-hidden shadow-md bg-white\">\n\n <!-- HEADER -->\n <ng-template pTemplate=\"header\">\n <tr class=\"bg-gray-50 text-left text-gray-700 font-medium text-sm\">\n <th *ngIf=\"showRowIndex\" class=\"px-4 py-2 w-16\">#</th>\n <th *ngIf=\"showSelectionCheckbox\" class=\"px-4 py-2 w-12\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"(sortable && col.sortable) ? col.field : undefined\"\n class=\"px-4 py-2\" [style.width]=\"col.width || 'auto'\" [ngStyle]=\"col.style\">\n <div class=\"flex items-center gap-2\">\n {{ col.header }}\n <p-sortIcon *ngIf=\"sortable && col.sortable\" [field]=\"col.field\"></p-sortIcon>\n </div>\n <p-columnFilter *ngIf=\"col.filter\" [field]=\"col.field\" matchMode=\"contains\"></p-columnFilter>\n </th>\n\n <th *ngIf=\"actionTemplate\" class=\"px-4 py-2 w-32\">Actions</th>\n </tr>\n </ng-template>\n\n <!-- BODY -->\n <ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n <tr (click)=\"onRowClick(rowData)\" class=\"hover:bg-gray-50 cursor-pointer border-b border-gray-100\">\n <td *ngIf=\"showRowIndex\" class=\"px-4 py-2 text-gray-500\">\n {{ rowIndex + 1 }}\n </td>\n <td *ngIf=\"showSelectionCheckbox\" class=\"px-4 py-2\" (click)=\"$event.stopPropagation()\">\n <p-tableCheckbox [value]=\"rowData\"></p-tableCheckbox>\n </td>\n <td *ngFor=\"let col of columns\" class=\"px-4 py-2\">\n <ng-container [ngSwitch]=\"col.type || 'text'\">\n\n <!-- TEXT -->\n <span *ngSwitchCase=\"'text'\" class=\"text-gray-800\">\n {{ rowData[col.field] }}\n </span>\n\n <!-- DATE -->\n <span *ngSwitchCase=\"'date'\" class=\"text-gray-700\">\n {{ rowData[col.field] | date:'short' }}\n </span>\n\n <!-- NUMBER -->\n <span *ngSwitchCase=\"'number'\" class=\"text-gray-800\">\n {{ rowData[col.field] | number }}\n </span>\n\n <!-- BOOLEAN -->\n <i *ngSwitchCase=\"'boolean'\" class=\"pi\" [ngClass]=\"{\n 'pi-check-circle text-green-500': rowData[col.field],\n 'pi-times-circle text-red-500': !rowData[col.field]\n }\"></i>\n\n <!-- STATUS -->\n <ng-container *ngSwitchCase=\"'status'\">\n <span class=\"px-2 py-1 rounded-full text-xs font-semibold text-white\" [ngClass]=\"{\n 'bg-gray-500': rowData[col.field] === 'PENDING',\n 'bg-blue-500': rowData[col.field] === 'JOINED' || rowData[col.field] === 'ONBOARDED',\n 'bg-green-500': rowData[col.field] === 'APPROVED' || rowData[col.field] === 'PAID' || rowData[col.field] === 'CONFIRMED',\n 'bg-red-500': rowData[col.field] === 'REJECTED' || rowData[col.field] === 'UNPAID' || rowData[col.field] === 'CANCELED' || rowData[col.field] === 'Over Due',\n 'bg-yellow-400': rowData[col.field] === 'Missed'\n }\">\n {{ rowData[col.field] }}\n </span>\n </ng-container>\n\n <!-- DEACTIVATED -->\n <ng-container *ngSwitchCase=\"'deactivated'\">\n <span class=\"px-2 py-1 rounded-full text-xs font-semibold text-white\"\n [ngClass]=\"rowData.deactivated ? 'bg-red-500' : 'bg-green-500'\">\n {{ rowData.deactivated ? 'Deactivated' : 'Active' }}\n </span>\n </ng-container>\n\n <!-- LINK -->\n <ng-container *ngSwitchCase=\"'link'\">\n <span class=\"text-blue-500 hover:underline cursor-pointer\" (click)=\"$event.stopPropagation()\">\n {{ rowData[col.field] }}\n </span>\n </ng-container>\n\n <!-- DEFAULT -->\n <span *ngSwitchDefault class=\"text-gray-800\">\n {{ rowData[col.field] }}\n </span>\n\n </ng-container>\n </td>\n\n <td *ngIf=\"actionTemplate\" class=\"px-4 py-2\">\n <ng-container *ngTemplateOutlet=\"actionTemplate; context: { $implicit: rowData }\"></ng-container>\n </td>\n </tr>\n </ng-template>\n\n <!-- EMPTY -->\n <ng-template pTemplate=\"emptymessage\">\n <tr>\n <td class=\"text-center text-gray-500 py-4\"\n [attr.colspan]=\"columns.length + (actionTemplate ? 1 : 0) + (showRowIndex ? 1 : 0) + (showSelectionCheckbox ? 1 : 0)\">\n No records found\n </td>\n </tr>\n </ng-template>\n</p-table>", styles: [":host .p-datatable-thead>tr>th{@apply text-left font-bold text-gray-700 bg-gray-100 px-3 py-2 border-b border-gray-200;transition:box-shadow .2s}:host .p-datatable-tbody>tr>td{@apply text-gray-800 px-3 py-2 border-b border-gray-200 text-sm;}:host .p-datatable{@apply w-full border border-gray-200 rounded-lg;}\n"] }]
|
|
517
|
+
}], propDecorators: { value: [{
|
|
518
|
+
type: Input
|
|
519
|
+
}], loading: [{
|
|
520
|
+
type: Input
|
|
521
|
+
}], paginator: [{
|
|
522
|
+
type: Input
|
|
523
|
+
}], rows: [{
|
|
524
|
+
type: Input
|
|
525
|
+
}], first: [{
|
|
526
|
+
type: Input
|
|
527
|
+
}], lazy: [{
|
|
528
|
+
type: Input
|
|
529
|
+
}], totalRecords: [{
|
|
530
|
+
type: Input
|
|
531
|
+
}], sortable: [{
|
|
532
|
+
type: Input
|
|
533
|
+
}], sortField: [{
|
|
534
|
+
type: Input
|
|
535
|
+
}], sortOrder: [{
|
|
536
|
+
type: Input
|
|
537
|
+
}], selection: [{
|
|
538
|
+
type: Input
|
|
539
|
+
}], selectionChange: [{
|
|
540
|
+
type: Output
|
|
541
|
+
}], userId: [{
|
|
542
|
+
type: Input
|
|
543
|
+
}], globalFilterFields: [{
|
|
544
|
+
type: Input
|
|
545
|
+
}], columns: [{
|
|
546
|
+
type: Input
|
|
547
|
+
}], showSelectionCheckbox: [{
|
|
548
|
+
type: Input
|
|
549
|
+
}], showRowIndex: [{
|
|
550
|
+
type: Input
|
|
551
|
+
}], selectionMode: [{
|
|
552
|
+
type: Input
|
|
553
|
+
}], dataKey: [{
|
|
554
|
+
type: Input
|
|
555
|
+
}], actionTemplate: [{
|
|
556
|
+
type: ContentChild,
|
|
557
|
+
args: ['actionTemplate']
|
|
558
|
+
}], statusTemplate: [{
|
|
559
|
+
type: ContentChild,
|
|
560
|
+
args: ['statusTemplate']
|
|
561
|
+
}], rowSelect: [{
|
|
562
|
+
type: Output
|
|
563
|
+
}], onLazyLoad: [{
|
|
564
|
+
type: Output
|
|
565
|
+
}], onSort: [{
|
|
566
|
+
type: Output
|
|
567
|
+
}], onPage: [{
|
|
568
|
+
type: Output
|
|
569
|
+
}], onFilter: [{
|
|
570
|
+
type: Output
|
|
571
|
+
}], onRowSelect: [{
|
|
572
|
+
type: Output
|
|
573
|
+
}], onRowUnselect: [{
|
|
574
|
+
type: Output
|
|
575
|
+
}], pageChange: [{
|
|
576
|
+
type: Output
|
|
577
|
+
}], rowClick: [{
|
|
578
|
+
type: Output
|
|
579
|
+
}] } });
|
|
580
|
+
|
|
581
|
+
class TalyAccordion {
|
|
582
|
+
items = [];
|
|
583
|
+
textDirection = 'ltr';
|
|
584
|
+
multiple = true;
|
|
585
|
+
/**
|
|
586
|
+
* Value can be a string (single) or string array (multiple).
|
|
587
|
+
*/
|
|
588
|
+
value = null;
|
|
589
|
+
ngOnInit() {
|
|
590
|
+
if (this.multiple) {
|
|
591
|
+
this.value = [];
|
|
592
|
+
}
|
|
593
|
+
else {
|
|
594
|
+
this.value = null;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
isActive(index) {
|
|
598
|
+
const sIndex = index.toString();
|
|
599
|
+
if (this.multiple) {
|
|
600
|
+
return Array.isArray(this.value) && this.value.includes(sIndex);
|
|
601
|
+
}
|
|
602
|
+
return this.value === sIndex;
|
|
603
|
+
}
|
|
604
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyAccordion, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
605
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyAccordion, isStandalone: true, selector: "lib-taly-accordion", inputs: { items: "items", textDirection: "textDirection", multiple: "multiple" }, ngImport: i0, template: "<p-accordion [multiple]=\"multiple\" [(value)]=\"value\"\n class=\"w-full rounded-2xl bg-[var(--brand-white)] p-2 font-manrope\">\n <p-accordion-panel *ngFor=\"let item of items; let i = index; let last = last\" [value]=\"i.toString()\"\n [disabled]=\"!!item.disabled\" class=\"mb-2 last:mb-0 border-none\">\n <!-- HEADER -->\n <p-accordion-header>\n <div class=\"flex items-center justify-between w-full\n px-6 py-4\n text-base font-medium leading-7 tracking-[-0.16px]\n text-[var(--ui-taly-dark-black)]\n bg-[var(--brand-white)]\n rounded-t-2xl\n focus:outline-none focus:ring-0\" [class.opacity-50]=\"item.disabled\" [dir]=\"textDirection\">\n <span class=\"flex-grow\">\n {{ textDirection === 'rtl'\n ? item.itemTitleAr\n : item.itemTitleEn }}\n </span>\n\n <!-- ICON CONTAINER -->\n <div class=\"accordion-toggle-icon flex items-center justify-center rounded-full\"\n [ngClass]=\"isActive(i) ? 'is-active bg-transparent' : 'bg-[var(--shades-6)]'\">\n <i class=\"pi font-bold\"\n [ngClass]=\"isActive(i) ? 'pi-minus text-[var(--ui-taly-dark-black)]' : 'pi-plus text-[var(--ui-taly-dark-black)]'\"></i>\n </div>\n </div>\n </p-accordion-header>\n\n <!-- CONTENT -->\n <p-accordion-content>\n <div class=\"px-6 py-4\n text-base font-medium leading-7 tracking-[-0.16px]\n bg-[var(--shades-6)]\n text-[var(--ui-taly-dark-black)]\n rounded-b-2xl\" [dir]=\"textDirection\">\n {{ textDirection === 'rtl'\n ? item.descriptionAr\n : item.descriptionEn }}\n </div>\n </p-accordion-content>\n </p-accordion-panel>\n</p-accordion>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "ngmodule", type: AccordionModule }, { kind: "component", type: i2$3.Accordion, selector: "p-accordion", inputs: ["value", "multiple", "styleClass", "expandIcon", "collapseIcon", "selectOnFocus", "transitionOptions"], outputs: ["valueChange", "onClose", "onOpen"] }, { kind: "component", type: i2$3.AccordionPanel, selector: "p-accordion-panel, p-accordionpanel", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: i2$3.AccordionHeader, selector: "p-accordion-header, p-accordionheader" }, { kind: "component", type: i2$3.AccordionContent, selector: "p-accordion-content, p-accordioncontent" }] });
|
|
606
|
+
}
|
|
607
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyAccordion, decorators: [{
|
|
608
|
+
type: Component,
|
|
609
|
+
args: [{ selector: 'lib-taly-accordion', standalone: true, imports: [CommonModule, AccordionModule], template: "<p-accordion [multiple]=\"multiple\" [(value)]=\"value\"\n class=\"w-full rounded-2xl bg-[var(--brand-white)] p-2 font-manrope\">\n <p-accordion-panel *ngFor=\"let item of items; let i = index; let last = last\" [value]=\"i.toString()\"\n [disabled]=\"!!item.disabled\" class=\"mb-2 last:mb-0 border-none\">\n <!-- HEADER -->\n <p-accordion-header>\n <div class=\"flex items-center justify-between w-full\n px-6 py-4\n text-base font-medium leading-7 tracking-[-0.16px]\n text-[var(--ui-taly-dark-black)]\n bg-[var(--brand-white)]\n rounded-t-2xl\n focus:outline-none focus:ring-0\" [class.opacity-50]=\"item.disabled\" [dir]=\"textDirection\">\n <span class=\"flex-grow\">\n {{ textDirection === 'rtl'\n ? item.itemTitleAr\n : item.itemTitleEn }}\n </span>\n\n <!-- ICON CONTAINER -->\n <div class=\"accordion-toggle-icon flex items-center justify-center rounded-full\"\n [ngClass]=\"isActive(i) ? 'is-active bg-transparent' : 'bg-[var(--shades-6)]'\">\n <i class=\"pi font-bold\"\n [ngClass]=\"isActive(i) ? 'pi-minus text-[var(--ui-taly-dark-black)]' : 'pi-plus text-[var(--ui-taly-dark-black)]'\"></i>\n </div>\n </div>\n </p-accordion-header>\n\n <!-- CONTENT -->\n <p-accordion-content>\n <div class=\"px-6 py-4\n text-base font-medium leading-7 tracking-[-0.16px]\n bg-[var(--shades-6)]\n text-[var(--ui-taly-dark-black)]\n rounded-b-2xl\" [dir]=\"textDirection\">\n {{ textDirection === 'rtl'\n ? item.descriptionAr\n : item.descriptionEn }}\n </div>\n </p-accordion-content>\n </p-accordion-panel>\n</p-accordion>" }]
|
|
610
|
+
}], propDecorators: { items: [{
|
|
611
|
+
type: Input
|
|
612
|
+
}], textDirection: [{
|
|
613
|
+
type: Input
|
|
614
|
+
}], multiple: [{
|
|
615
|
+
type: Input
|
|
616
|
+
}] } });
|
|
617
|
+
|
|
618
|
+
class TalyPasswordComponents {
|
|
619
|
+
cdr = inject(ChangeDetectorRef);
|
|
620
|
+
id = '';
|
|
621
|
+
label = '';
|
|
622
|
+
placeholderText = '';
|
|
623
|
+
formGroup;
|
|
624
|
+
controlName;
|
|
625
|
+
max;
|
|
626
|
+
inputmodeType = 'password';
|
|
627
|
+
disabled = false;
|
|
628
|
+
fieldTextType = false;
|
|
629
|
+
get f() {
|
|
630
|
+
return this.formGroup?.controls;
|
|
631
|
+
}
|
|
632
|
+
writeValue(value) {
|
|
633
|
+
this._value = value;
|
|
634
|
+
this.cdr.markForCheck();
|
|
635
|
+
}
|
|
636
|
+
registerOnChange(fn) {
|
|
637
|
+
this.onChange = fn;
|
|
638
|
+
}
|
|
639
|
+
registerOnTouched(fn) {
|
|
640
|
+
this.onTouched = fn;
|
|
641
|
+
}
|
|
642
|
+
validate() {
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
onReset() {
|
|
646
|
+
this.formGroup?.get(this.controlName)?.setValue(null);
|
|
647
|
+
}
|
|
648
|
+
toggleFieldTextType() {
|
|
649
|
+
this.fieldTextType = !this.fieldTextType;
|
|
650
|
+
}
|
|
651
|
+
_value = null;
|
|
652
|
+
onChange = (_) => { };
|
|
653
|
+
onTouched = () => { };
|
|
654
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyPasswordComponents, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
655
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: TalyPasswordComponents, isStandalone: true, selector: "lib-taly-password", inputs: { id: "id", label: "label", placeholderText: "placeholderText", formGroup: "formGroup", controlName: "controlName", max: "max", inputmodeType: "inputmodeType" }, providers: [
|
|
656
|
+
{
|
|
657
|
+
provide: NG_VALUE_ACCESSOR,
|
|
658
|
+
useExisting: forwardRef(() => TalyPasswordComponents),
|
|
659
|
+
multi: true,
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
provide: NG_VALIDATORS,
|
|
663
|
+
useExisting: forwardRef(() => TalyPasswordComponents),
|
|
664
|
+
multi: true,
|
|
665
|
+
},
|
|
666
|
+
], ngImport: i0, template: "<div class=\"input-wrapper\" [formGroup]=\"formGroup\" [class.disabled]=\"disabled\"\n [class.input-error]=\"f[controlName].invalid && f[controlName].touched\">\n <span class=\"p-float-label p-input-icon-right\">\n <input class=\"taly-input\" dir=\"ltr\" [formControlName]=\"controlName\" pInputText [id]=\"id\"\n [placeholder]=\"placeholderText\" [type]=\"fieldTextType ? 'text' : 'password'\"\n [attr.inputmode]=\"inputmodeType\" #inputField [disabled]=\"disabled\" [maxlength]=\"max\" />\n\n @if (!disabled && inputField.value) {\n <img class=\"eye\" src=\"assets/images/show-password-icon.svg\" alt=\"password-reset\" role=\"button\" tabindex=\"0\"\n (click)=\"toggleFieldTextType()\" (keyup.enter)=\"toggleFieldTextType()\" />\n }\n\n </span>\n</div>\n\n<div class=\"alert\">\n @if (f[controlName].invalid && f[controlName].touched) {\n @if (f[controlName].hasError('required')) {\n <span class=\"alert-danger\">\n {{ label }} <span translate> is required </span>\n </span>\n }\n }\n\n @if (\n f[controlName]?.invalid &&\n id === 'confirmPassword' &&\n f[controlName]?.errors?.['passwordMismatch'] === true\n ) {\n <div [ngClass]=\"\n f[controlName]?.errors?.['passwordMismatch'] === false\n ? 'text-success'\n : 'alert-danger'\n \">\n <img src=\"assets/images/error-icon.svg\" />\n <span>Passwords don\u2019t match!</span>\n </div>\n }\n\n\n @if (f[controlName]?.dirty && id === 'password' && f[controlName].touched) {\n <div [ngClass]=\"\n f[controlName]?.value?.match('^(?=.*[A-Z])') ? 'text-success' : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('^(?=.*[A-Z])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"statu-icon\" />\n <span> Must contain one uppercase </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(?=.*[a-z])') ? 'text-success' : 'alert-danger alert-grey'\n \" alt=\"status-icons\">\n <img [src]=\"\n f[controlName]?.value?.match('(?=.*[a-z])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> Must contain one lowercase </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(.*[0-9].*)') ? 'text-success' : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('(.*[0-9].*)')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> Must contain one number </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(?=.*[!@#$%^&*])')\n ? 'text-success'\n : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('(?=.*[!@#$%^&*])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> At least one special character. </span>\n </div>\n\n <div [ngClass]=\"f[controlName]?.value?.match('.{8}') ? 'text-success' : 'alert-danger alert-grey'\">\n <img [src]=\"\n f[controlName]?.value?.match('.{8}')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> 6 Character minimum </span>\n </div>\n }\n</div>", styles: [".input-wrapper{border-radius:8px;border:1px solid var(--shades-6);background:var(--brand-white);display:flex;height:60px;padding:6px 16px;align-items:center;gap:0px;align-self:stretch;flex-direction:column}.input-wrapper.disabled,.input-wrapper.disabled .taly-input{background:var(--shades-6)}.input-wrapper.input-error{border-radius:8px;border:1px solid var(--ui-error);background:var(--ui-error-light)}.input-wrapper.input-error .taly-input{background:var(--ui-error-light);color:var(--shades-8)}.input-wrapper .taly-label{color:var(--shades-3);font-weight:500;line-height:20px;width:100%}.input-wrapper .taly-input{color:var(--shades-1);font-size:16px;line-height:48px;letter-spacing:-.16px;height:48px;outline:none;border:none;width:100%;padding-top:10px}.input-wrapper .taly-input::placeholder{color:var(--shades-3);font-size:12px}:host ::ng-deep .f-flex{display:flex;flex-direction:column}:host ::ng-deep .eye{position:absolute;right:5px;top:10px;cursor:pointer}:host ::ng-deep .p-float-label{width:100%;height:48px}:host ::ng-deep .p-float-label label{left:0;margin-top:-10px;color:var(--shades-11);font-weight:500;line-height:20px;font-size:16px}:host ::ng-deep input:focus~label{top:5px;margin-top:-6px;font-size:12px}:host ::ng-deep input.p-filled~label{top:5px;margin-top:-6px}:host ::ng-deep .p-inputtext{padding:0}:host ::ng-deep .p-inputtext:enabled:focus{box-shadow:none}:host ::ng-deep .input-wrapper:focus-within{border:2px solid var(--shades-2)}:host ::ng-deep .alert-danger{display:flex;gap:4px}:host ::ng-deep .alert-danger.alert-grey{color:var(--shades-9)}:host ::ng-deep .text-success{color:var(--success-taly);font-size:12px;font-style:normal;font-weight:500;line-height:20px;display:flex;gap:4px}:host ::ng-deep .d-flex{display:flex;flex-direction:column;gap:4px}@media (max-width: 768px){.p-float-label label{right:0!important}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
667
|
+
}
|
|
668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyPasswordComponents, decorators: [{
|
|
669
|
+
type: Component,
|
|
670
|
+
args: [{ selector: 'lib-taly-password', standalone: true, imports: [
|
|
671
|
+
CommonModule,
|
|
672
|
+
ReactiveFormsModule,
|
|
673
|
+
InputTextModule,
|
|
674
|
+
], providers: [
|
|
675
|
+
{
|
|
676
|
+
provide: NG_VALUE_ACCESSOR,
|
|
677
|
+
useExisting: forwardRef(() => TalyPasswordComponents),
|
|
678
|
+
multi: true,
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
provide: NG_VALIDATORS,
|
|
682
|
+
useExisting: forwardRef(() => TalyPasswordComponents),
|
|
683
|
+
multi: true,
|
|
684
|
+
},
|
|
685
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"input-wrapper\" [formGroup]=\"formGroup\" [class.disabled]=\"disabled\"\n [class.input-error]=\"f[controlName].invalid && f[controlName].touched\">\n <span class=\"p-float-label p-input-icon-right\">\n <input class=\"taly-input\" dir=\"ltr\" [formControlName]=\"controlName\" pInputText [id]=\"id\"\n [placeholder]=\"placeholderText\" [type]=\"fieldTextType ? 'text' : 'password'\"\n [attr.inputmode]=\"inputmodeType\" #inputField [disabled]=\"disabled\" [maxlength]=\"max\" />\n\n @if (!disabled && inputField.value) {\n <img class=\"eye\" src=\"assets/images/show-password-icon.svg\" alt=\"password-reset\" role=\"button\" tabindex=\"0\"\n (click)=\"toggleFieldTextType()\" (keyup.enter)=\"toggleFieldTextType()\" />\n }\n\n </span>\n</div>\n\n<div class=\"alert\">\n @if (f[controlName].invalid && f[controlName].touched) {\n @if (f[controlName].hasError('required')) {\n <span class=\"alert-danger\">\n {{ label }} <span translate> is required </span>\n </span>\n }\n }\n\n @if (\n f[controlName]?.invalid &&\n id === 'confirmPassword' &&\n f[controlName]?.errors?.['passwordMismatch'] === true\n ) {\n <div [ngClass]=\"\n f[controlName]?.errors?.['passwordMismatch'] === false\n ? 'text-success'\n : 'alert-danger'\n \">\n <img src=\"assets/images/error-icon.svg\" />\n <span>Passwords don\u2019t match!</span>\n </div>\n }\n\n\n @if (f[controlName]?.dirty && id === 'password' && f[controlName].touched) {\n <div [ngClass]=\"\n f[controlName]?.value?.match('^(?=.*[A-Z])') ? 'text-success' : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('^(?=.*[A-Z])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"statu-icon\" />\n <span> Must contain one uppercase </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(?=.*[a-z])') ? 'text-success' : 'alert-danger alert-grey'\n \" alt=\"status-icons\">\n <img [src]=\"\n f[controlName]?.value?.match('(?=.*[a-z])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> Must contain one lowercase </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(.*[0-9].*)') ? 'text-success' : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('(.*[0-9].*)')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> Must contain one number </span>\n </div>\n <div [ngClass]=\"\n f[controlName]?.value?.match('(?=.*[!@#$%^&*])')\n ? 'text-success'\n : 'alert-danger alert-grey'\n \">\n <img [src]=\"\n f[controlName]?.value?.match('(?=.*[!@#$%^&*])')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> At least one special character. </span>\n </div>\n\n <div [ngClass]=\"f[controlName]?.value?.match('.{8}') ? 'text-success' : 'alert-danger alert-grey'\">\n <img [src]=\"\n f[controlName]?.value?.match('.{8}')\n ? 'assets/images/success-img.svg'\n : 'assets/images/error-icon-grey.svg'\n \" alt=\"status-icons\" />\n <span> 6 Character minimum </span>\n </div>\n }\n</div>", styles: [".input-wrapper{border-radius:8px;border:1px solid var(--shades-6);background:var(--brand-white);display:flex;height:60px;padding:6px 16px;align-items:center;gap:0px;align-self:stretch;flex-direction:column}.input-wrapper.disabled,.input-wrapper.disabled .taly-input{background:var(--shades-6)}.input-wrapper.input-error{border-radius:8px;border:1px solid var(--ui-error);background:var(--ui-error-light)}.input-wrapper.input-error .taly-input{background:var(--ui-error-light);color:var(--shades-8)}.input-wrapper .taly-label{color:var(--shades-3);font-weight:500;line-height:20px;width:100%}.input-wrapper .taly-input{color:var(--shades-1);font-size:16px;line-height:48px;letter-spacing:-.16px;height:48px;outline:none;border:none;width:100%;padding-top:10px}.input-wrapper .taly-input::placeholder{color:var(--shades-3);font-size:12px}:host ::ng-deep .f-flex{display:flex;flex-direction:column}:host ::ng-deep .eye{position:absolute;right:5px;top:10px;cursor:pointer}:host ::ng-deep .p-float-label{width:100%;height:48px}:host ::ng-deep .p-float-label label{left:0;margin-top:-10px;color:var(--shades-11);font-weight:500;line-height:20px;font-size:16px}:host ::ng-deep input:focus~label{top:5px;margin-top:-6px;font-size:12px}:host ::ng-deep input.p-filled~label{top:5px;margin-top:-6px}:host ::ng-deep .p-inputtext{padding:0}:host ::ng-deep .p-inputtext:enabled:focus{box-shadow:none}:host ::ng-deep .input-wrapper:focus-within{border:2px solid var(--shades-2)}:host ::ng-deep .alert-danger{display:flex;gap:4px}:host ::ng-deep .alert-danger.alert-grey{color:var(--shades-9)}:host ::ng-deep .text-success{color:var(--success-taly);font-size:12px;font-style:normal;font-weight:500;line-height:20px;display:flex;gap:4px}:host ::ng-deep .d-flex{display:flex;flex-direction:column;gap:4px}@media (max-width: 768px){.p-float-label label{right:0!important}}\n"] }]
|
|
686
|
+
}], propDecorators: { id: [{
|
|
687
|
+
type: Input,
|
|
688
|
+
args: [{ required: true }]
|
|
689
|
+
}], label: [{
|
|
690
|
+
type: Input,
|
|
691
|
+
args: [{ required: true }]
|
|
692
|
+
}], placeholderText: [{
|
|
693
|
+
type: Input
|
|
694
|
+
}], formGroup: [{
|
|
695
|
+
type: Input
|
|
696
|
+
}], controlName: [{
|
|
697
|
+
type: Input
|
|
698
|
+
}], max: [{
|
|
699
|
+
type: Input
|
|
700
|
+
}], inputmodeType: [{
|
|
701
|
+
type: Input
|
|
702
|
+
}] } });
|
|
703
|
+
|
|
704
|
+
class TalyButtons {
|
|
705
|
+
label = '';
|
|
706
|
+
icon = '';
|
|
707
|
+
iconPosition = 'left';
|
|
708
|
+
severity = 'primary';
|
|
709
|
+
outlined = false;
|
|
710
|
+
text = false;
|
|
711
|
+
raised = false;
|
|
712
|
+
rounded = false;
|
|
713
|
+
loading = false;
|
|
714
|
+
disabled = false;
|
|
715
|
+
fullWidth = false;
|
|
716
|
+
type = 'button';
|
|
717
|
+
clicked = new EventEmitter();
|
|
718
|
+
get buttonClasses() {
|
|
719
|
+
const classes = [
|
|
720
|
+
this.fullWidth ? 'w-full' : 'w-auto',
|
|
721
|
+
];
|
|
722
|
+
// Severity colors (Tailwind) - Restored to match previous 'working' behavior
|
|
723
|
+
const severityMap = {
|
|
724
|
+
primary: '!bg-blue-600 !text-white hover:!bg-blue-700',
|
|
725
|
+
secondary: '!bg-gray-600 !text-white hover:!bg-gray-700',
|
|
726
|
+
success: '!bg-green-600 !text-white hover:!bg-green-700',
|
|
727
|
+
info: '!bg-cyan-500 !text-white hover:!bg-cyan-600',
|
|
728
|
+
warn: '!bg-yellow-400 !text-black hover:!bg-yellow-500', // Changed warning to warn
|
|
729
|
+
help: '!bg-purple-600 !text-white hover:!bg-purple-700',
|
|
730
|
+
danger: '!bg-red-600 !text-white hover:!bg-red-700',
|
|
731
|
+
contrast: '!bg-black !text-white hover:!bg-gray-800',
|
|
732
|
+
};
|
|
733
|
+
// Apply colors only if the button is not text/outlined, OR apply specific text/outlined colors
|
|
734
|
+
// We check inputs to decide which map to use, effectively overriding PrimeNG theme colors
|
|
735
|
+
// but letting PrimeNG handle structure (rounded, raised, iconPos).
|
|
736
|
+
if (!this.text && !this.outlined) {
|
|
737
|
+
classes.push(severityMap[this.severity || 'primary']);
|
|
738
|
+
}
|
|
739
|
+
if (this.outlined) {
|
|
740
|
+
const outlinedMap = {
|
|
741
|
+
primary: '!border-blue-600 !text-blue-600 hover:!bg-blue-50',
|
|
742
|
+
secondary: '!border-gray-600 !text-gray-600 hover:!bg-gray-50',
|
|
743
|
+
success: '!border-green-600 !text-green-600 hover:!bg-green-50',
|
|
744
|
+
info: '!border-cyan-500 !text-cyan-500 hover:!bg-cyan-50',
|
|
745
|
+
warn: '!border-yellow-400 !text-yellow-400 hover:!bg-yellow-50',
|
|
746
|
+
help: '!border-purple-600 !text-purple-600 hover:!bg-purple-50',
|
|
747
|
+
danger: '!border-red-600 !text-red-600 hover:!bg-red-50',
|
|
748
|
+
contrast: '!border-black !text-black hover:!bg-gray-100',
|
|
749
|
+
};
|
|
750
|
+
classes.push(outlinedMap[this.severity || 'primary']);
|
|
751
|
+
}
|
|
752
|
+
if (this.text) {
|
|
753
|
+
const textMap = {
|
|
754
|
+
primary: '!text-blue-600 hover:!underline',
|
|
755
|
+
secondary: '!text-gray-600 hover:!underline',
|
|
756
|
+
success: '!text-green-600 hover:!underline',
|
|
757
|
+
info: '!text-cyan-500 hover:!underline',
|
|
758
|
+
warn: '!text-yellow-400 hover:!underline',
|
|
759
|
+
help: '!text-purple-600 hover:!underline',
|
|
760
|
+
danger: '!text-red-600 hover:!underline',
|
|
761
|
+
contrast: '!text-black hover:!underline',
|
|
762
|
+
};
|
|
763
|
+
classes.push(textMap[this.severity || 'primary']);
|
|
764
|
+
}
|
|
765
|
+
return classes.join(' ');
|
|
766
|
+
}
|
|
767
|
+
handleClick(event) {
|
|
768
|
+
if (this.disabled || this.loading) {
|
|
769
|
+
event.preventDefault();
|
|
770
|
+
return;
|
|
771
|
+
}
|
|
772
|
+
this.clicked.emit(event);
|
|
773
|
+
}
|
|
774
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyButtons, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
775
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyButtons, isStandalone: true, selector: "lib-taly-buttons", inputs: { label: "label", icon: "icon", iconPosition: "iconPosition", severity: "severity", outlined: "outlined", text: "text", raised: "raised", rounded: "rounded", loading: "loading", disabled: "disabled", fullWidth: "fullWidth", type: "type" }, outputs: { clicked: "clicked" }, ngImport: i0, template: "<button pButton [type]=\"type\" [disabled]=\"disabled || loading\" [icon]=\"icon\" [iconPos]=\"iconPosition\" [label]=\"label\"\n [loading]=\"loading\" [severity]=\"$any(severity)\" [outlined]=\"outlined\" [text]=\"text\" [raised]=\"raised\"\n [rounded]=\"rounded\" [ngClass]=\"buttonClasses\" (click)=\"handleClick($event)\">\n</button>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2$4.ButtonDirective, selector: "[pButton]", inputs: ["ptButtonDirective", "hostName", "text", "plain", "raised", "size", "outlined", "rounded", "iconPos", "loadingIcon", "fluid", "label", "icon", "loading", "buttonProps", "severity"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
776
|
+
}
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyButtons, decorators: [{
|
|
778
|
+
type: Component,
|
|
779
|
+
args: [{ selector: 'lib-taly-buttons', standalone: true, imports: [CommonModule, ButtonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button pButton [type]=\"type\" [disabled]=\"disabled || loading\" [icon]=\"icon\" [iconPos]=\"iconPosition\" [label]=\"label\"\n [loading]=\"loading\" [severity]=\"$any(severity)\" [outlined]=\"outlined\" [text]=\"text\" [raised]=\"raised\"\n [rounded]=\"rounded\" [ngClass]=\"buttonClasses\" (click)=\"handleClick($event)\">\n</button>" }]
|
|
780
|
+
}], propDecorators: { label: [{
|
|
781
|
+
type: Input
|
|
782
|
+
}], icon: [{
|
|
783
|
+
type: Input
|
|
784
|
+
}], iconPosition: [{
|
|
785
|
+
type: Input
|
|
786
|
+
}], severity: [{
|
|
787
|
+
type: Input
|
|
788
|
+
}], outlined: [{
|
|
789
|
+
type: Input
|
|
790
|
+
}], text: [{
|
|
791
|
+
type: Input
|
|
792
|
+
}], raised: [{
|
|
793
|
+
type: Input
|
|
794
|
+
}], rounded: [{
|
|
795
|
+
type: Input
|
|
796
|
+
}], loading: [{
|
|
797
|
+
type: Input
|
|
798
|
+
}], disabled: [{
|
|
799
|
+
type: Input
|
|
800
|
+
}], fullWidth: [{
|
|
801
|
+
type: Input
|
|
802
|
+
}], type: [{
|
|
803
|
+
type: Input
|
|
804
|
+
}], clicked: [{
|
|
805
|
+
type: Output
|
|
806
|
+
}] } });
|
|
807
|
+
|
|
808
|
+
class TalyOtpInput {
|
|
809
|
+
cdr;
|
|
810
|
+
label = 'OTP';
|
|
811
|
+
length = 6;
|
|
812
|
+
numericOnly = true;
|
|
813
|
+
autofocus = false;
|
|
814
|
+
_value = '';
|
|
815
|
+
_disabled = false;
|
|
816
|
+
otpConfig = {};
|
|
817
|
+
onChange = (_) => { };
|
|
818
|
+
onTouched = () => { };
|
|
819
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
820
|
+
constructor(cdr) {
|
|
821
|
+
this.cdr = cdr;
|
|
822
|
+
if (this.ngControl) {
|
|
823
|
+
this.ngControl.valueAccessor = this;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
ngOnInit() {
|
|
827
|
+
this.updateOtpConfig();
|
|
828
|
+
}
|
|
829
|
+
ngOnChanges(changes) {
|
|
830
|
+
if (changes['length'] || changes['numericOnly'] || changes['autofocus']) {
|
|
831
|
+
this.updateOtpConfig();
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
updateOtpConfig() {
|
|
835
|
+
this.otpConfig = {
|
|
836
|
+
length: this.length,
|
|
837
|
+
inputClass: 'taly-otp-input',
|
|
838
|
+
allowNumbersOnly: this.numericOnly,
|
|
839
|
+
autofocus: this.autofocus,
|
|
840
|
+
};
|
|
841
|
+
this.cdr.markForCheck();
|
|
842
|
+
}
|
|
843
|
+
writeValue(value) {
|
|
844
|
+
this._value = value || '';
|
|
845
|
+
this.cdr.markForCheck();
|
|
846
|
+
}
|
|
847
|
+
registerOnChange(fn) {
|
|
848
|
+
this.onChange = fn;
|
|
849
|
+
}
|
|
850
|
+
registerOnTouched(fn) {
|
|
851
|
+
this.onTouched = fn;
|
|
852
|
+
}
|
|
853
|
+
setDisabledState(isDisabled) {
|
|
854
|
+
this._disabled = isDisabled;
|
|
855
|
+
this.cdr.markForCheck();
|
|
856
|
+
}
|
|
857
|
+
onOtpChange(value) {
|
|
858
|
+
this._value = value;
|
|
859
|
+
this.onChange(value);
|
|
860
|
+
this.onTouched();
|
|
861
|
+
}
|
|
862
|
+
get disabled() {
|
|
863
|
+
return this._disabled;
|
|
864
|
+
}
|
|
865
|
+
validate(control) {
|
|
866
|
+
if (!control.value)
|
|
867
|
+
return null;
|
|
868
|
+
if (control.value.length !== this.length) {
|
|
869
|
+
return { minlength: { requiredLength: this.length } };
|
|
870
|
+
}
|
|
871
|
+
return null;
|
|
872
|
+
}
|
|
873
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyOtpInput, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: TalyOtpInput, isStandalone: true, selector: "lib-taly-otp-input", inputs: { label: "label", length: "length", numericOnly: "numericOnly", autofocus: "autofocus" }, providers: [
|
|
875
|
+
{
|
|
876
|
+
provide: NG_VALUE_ACCESSOR,
|
|
877
|
+
useExisting: forwardRef(() => TalyOtpInput),
|
|
878
|
+
multi: true,
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
provide: NG_VALIDATORS,
|
|
882
|
+
useExisting: forwardRef(() => TalyOtpInput),
|
|
883
|
+
multi: true,
|
|
884
|
+
},
|
|
885
|
+
], usesOnChanges: true, ngImport: i0, template: "<div class=\"block\" [ngClass]=\"{\n 'pointer-events-none opacity-60': disabled,\n 'border-red-500': ngControl?.invalid && ngControl?.touched\n }\">\n <!-- Label -->\n <label class=\"mb-1 block text-sm font-medium text-gray-700\">\n {{ label }}\n </label>\n\n <!-- OTP Input -->\n <ng-otp-input [config]=\"otpConfig\" [disabled]=\"disabled\" (onInputChange)=\"onOtpChange($event)\"></ng-otp-input>\n</div>\n\n<!-- Error Messages -->\n<div *ngIf=\"ngControl?.invalid && ngControl?.touched\" class=\"mt-1 text-sm text-red-600\">\n <div *ngIf=\"ngControl?.errors?.['required']\">\n {{ label }} is required\n </div>\n\n <div *ngIf=\"ngControl?.errors?.['minlength']\">\n OTP must be {{ ngControl?.errors?.['minlength']?.requiredLength }} digits\n </div>\n\n <div *ngIf=\"ngControl?.errors?.['maxlength']\">\n OTP must be {{ ngControl?.errors?.['maxlength']?.requiredLength }} digits\n </div>\n</div>", styles: [":host{display:block}.otp-label{display:block;margin-bottom:6px;font-weight:500}::ng-deep .taly-otp-input{width:42px;height:42px;margin-right:6px;font-size:18px;text-align:center}.input-error ::ng-deep .taly-otp-input{border-color:var(--dark-border-radius)}.disabled{pointer-events:none;opacity:.6}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: NgOtpInputModule }, { kind: "component", type: i2$5.NgOtpInputComponent, selector: "ng-otp-input, ngx-otp-input", inputs: ["config", "formCtrl", "disabled"], outputs: ["onBlur", "onInputChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
886
|
+
}
|
|
887
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TalyOtpInput, decorators: [{
|
|
888
|
+
type: Component,
|
|
889
|
+
args: [{ selector: 'lib-taly-otp-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule, FormsModule, ReactiveFormsModule, NgOtpInputModule], providers: [
|
|
890
|
+
{
|
|
891
|
+
provide: NG_VALUE_ACCESSOR,
|
|
892
|
+
useExisting: forwardRef(() => TalyOtpInput),
|
|
893
|
+
multi: true,
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
provide: NG_VALIDATORS,
|
|
897
|
+
useExisting: forwardRef(() => TalyOtpInput),
|
|
898
|
+
multi: true,
|
|
899
|
+
},
|
|
900
|
+
], template: "<div class=\"block\" [ngClass]=\"{\n 'pointer-events-none opacity-60': disabled,\n 'border-red-500': ngControl?.invalid && ngControl?.touched\n }\">\n <!-- Label -->\n <label class=\"mb-1 block text-sm font-medium text-gray-700\">\n {{ label }}\n </label>\n\n <!-- OTP Input -->\n <ng-otp-input [config]=\"otpConfig\" [disabled]=\"disabled\" (onInputChange)=\"onOtpChange($event)\"></ng-otp-input>\n</div>\n\n<!-- Error Messages -->\n<div *ngIf=\"ngControl?.invalid && ngControl?.touched\" class=\"mt-1 text-sm text-red-600\">\n <div *ngIf=\"ngControl?.errors?.['required']\">\n {{ label }} is required\n </div>\n\n <div *ngIf=\"ngControl?.errors?.['minlength']\">\n OTP must be {{ ngControl?.errors?.['minlength']?.requiredLength }} digits\n </div>\n\n <div *ngIf=\"ngControl?.errors?.['maxlength']\">\n OTP must be {{ ngControl?.errors?.['maxlength']?.requiredLength }} digits\n </div>\n</div>", styles: [":host{display:block}.otp-label{display:block;margin-bottom:6px;font-weight:500}::ng-deep .taly-otp-input{width:42px;height:42px;margin-right:6px;font-size:18px;text-align:center}.input-error ::ng-deep .taly-otp-input{border-color:var(--dark-border-radius)}.disabled{pointer-events:none;opacity:.6}\n"] }]
|
|
901
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { label: [{
|
|
902
|
+
type: Input
|
|
903
|
+
}], length: [{
|
|
904
|
+
type: Input
|
|
905
|
+
}], numericOnly: [{
|
|
906
|
+
type: Input
|
|
907
|
+
}], autofocus: [{
|
|
908
|
+
type: Input
|
|
909
|
+
}] } });
|
|
910
|
+
|
|
911
|
+
/*
|
|
912
|
+
* Public API Surface of taly-shared-ui-lib
|
|
913
|
+
*/
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Generated bundle index. Do not edit.
|
|
917
|
+
*/
|
|
918
|
+
|
|
919
|
+
export { TalyAccordion, TalyButtons, TalyInput, TalyInputGroup, TalyOtpInput, TalyPasswordComponents, TalySelect, TalySharedUiLib, TalyTable };
|
|
920
|
+
//# sourceMappingURL=taly-shared-ui-lib.mjs.map
|