@masterteam/components 0.0.218 → 0.0.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/common.css +2 -257
- package/fesm2022/masterteam-components-slider-field.mjs +128 -0
- package/fesm2022/masterteam-components-slider-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-statistic-card.mjs +22 -0
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -0
- package/fesm2022/masterteam-components-textarea-field.mjs +122 -0
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -0
- package/fesm2022/masterteam-components-topbar.mjs +32 -0
- package/fesm2022/masterteam-components-topbar.mjs.map +1 -0
- package/fesm2022/masterteam-components-tree.mjs +260 -0
- package/fesm2022/masterteam-components-tree.mjs.map +1 -0
- package/package.json +1 -1
- package/types/masterteam-components-entities.d.ts +1 -1
- package/types/masterteam-components-slider-field.d.ts +41 -0
- package/types/masterteam-components-statistic-card.d.ts +18 -0
- package/types/masterteam-components-table.d.ts +2 -2
- package/types/masterteam-components-textarea-field.d.ts +41 -0
- package/types/masterteam-components-topbar.d.ts +20 -0
- package/types/masterteam-components-tree.d.ts +106 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, Component } from '@angular/core';
|
|
3
|
+
import { Card } from '@masterteam/components/card';
|
|
4
|
+
import { Avatar } from '@masterteam/components/avatar';
|
|
5
|
+
|
|
6
|
+
class StatisticCard {
|
|
7
|
+
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
8
|
+
cardClass = input('shadow-md', ...(ngDevMode ? [{ debugName: "cardClass" }] : /* istanbul ignore next */ []));
|
|
9
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: StatisticCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.8", type: StatisticCard, isStandalone: true, selector: "mt-statistic-card", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, cardClass: { classPropertyName: "cardClass", publicName: "cardClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<mt-card headless class=\"shadow-sm\">\r\n <div class=\"flex items-center gap-3 p-2\">\r\n <mt-avatar\r\n [style.--p-avatar-background]=\"'var(--p-' + data().color + '-100)'\"\r\n [style.--p-avatar-color]=\"'var(--p-' + data().color + '-600)'\"\r\n [icon]=\"data().icon\"\r\n size=\"large\"\r\n shape=\"square\"\r\n ></mt-avatar>\r\n\r\n <div class=\"flex flex-col gap-0.5\">\r\n <span\r\n class=\"text-lg font-semibold\"\r\n [style.color]=\"'var(--p-' + data().color + '-600)'\"\r\n >\r\n {{ data().title }}\r\n </span>\r\n <span class=\"text-sm text-surface-500\">\r\n {{ data().subTitle }}\r\n </span>\r\n </div>\r\n </div>\r\n</mt-card>\r\n", styles: [""], dependencies: [{ kind: "component", type: Card, selector: "mt-card", inputs: ["class", "title", "paddingless"] }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }] });
|
|
11
|
+
}
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: StatisticCard, decorators: [{
|
|
13
|
+
type: Component,
|
|
14
|
+
args: [{ selector: 'mt-statistic-card', standalone: true, imports: [Card, Avatar], template: "<mt-card headless class=\"shadow-sm\">\r\n <div class=\"flex items-center gap-3 p-2\">\r\n <mt-avatar\r\n [style.--p-avatar-background]=\"'var(--p-' + data().color + '-100)'\"\r\n [style.--p-avatar-color]=\"'var(--p-' + data().color + '-600)'\"\r\n [icon]=\"data().icon\"\r\n size=\"large\"\r\n shape=\"square\"\r\n ></mt-avatar>\r\n\r\n <div class=\"flex flex-col gap-0.5\">\r\n <span\r\n class=\"text-lg font-semibold\"\r\n [style.color]=\"'var(--p-' + data().color + '-600)'\"\r\n >\r\n {{ data().title }}\r\n </span>\r\n <span class=\"text-sm text-surface-500\">\r\n {{ data().subTitle }}\r\n </span>\r\n </div>\r\n </div>\r\n</mt-card>\r\n" }]
|
|
15
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], cardClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "cardClass", required: false }] }] } });
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generated bundle index. Do not edit.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export { StatisticCard };
|
|
22
|
+
//# sourceMappingURL=masterteam-components-statistic-card.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-statistic-card.mjs","sources":["../../../../packages/masterteam/components/statistic-card/statistic-card.ts","../../../../packages/masterteam/components/statistic-card/statistic-card.html","../../../../packages/masterteam/components/statistic-card/masterteam-components-statistic-card.ts"],"sourcesContent":["import { Component, input } from '@angular/core';\r\nimport { Card } from '@masterteam/components/card';\r\nimport { Avatar } from '@masterteam/components/avatar';\r\nimport { MTIcon } from '@masterteam/icons';\r\n\r\nexport interface StatisticCardData {\r\n title: string;\r\n subTitle: string;\r\n icon: MTIcon;\r\n color: string;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-statistic-card',\r\n standalone: true,\r\n templateUrl: './statistic-card.html',\r\n styleUrl: './statistic-card.scss',\r\n imports: [Card, Avatar],\r\n})\r\nexport class StatisticCard {\r\n readonly data = input.required<StatisticCardData>();\r\n readonly cardClass = input('shadow-md');\r\n}\r\n","<mt-card headless class=\"shadow-sm\">\r\n <div class=\"flex items-center gap-3 p-2\">\r\n <mt-avatar\r\n [style.--p-avatar-background]=\"'var(--p-' + data().color + '-100)'\"\r\n [style.--p-avatar-color]=\"'var(--p-' + data().color + '-600)'\"\r\n [icon]=\"data().icon\"\r\n size=\"large\"\r\n shape=\"square\"\r\n ></mt-avatar>\r\n\r\n <div class=\"flex flex-col gap-0.5\">\r\n <span\r\n class=\"text-lg font-semibold\"\r\n [style.color]=\"'var(--p-' + data().color + '-600)'\"\r\n >\r\n {{ data().title }}\r\n </span>\r\n <span class=\"text-sm text-surface-500\">\r\n {{ data().subTitle }}\r\n </span>\r\n </div>\r\n </div>\r\n</mt-card>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,aAAa,CAAA;AACf,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,0EAAqB;AAC1C,IAAA,SAAS,GAAG,KAAK,CAAC,WAAW,gFAAC;uGAF5B,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECnB1B,kuBAuBA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDNY,IAAI,+FAAE,MAAM,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAAA,YAAA,EAAA,MAAA,EAAA,OAAA,EAAA,OAAA,EAAA,WAAA,EAAA,eAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAEX,aAAa,EAAA,UAAA,EAAA,CAAA;kBAPzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,cACjB,IAAI,EAAA,OAAA,EAGP,CAAC,IAAI,EAAE,MAAM,CAAC,EAAA,QAAA,EAAA,kuBAAA,EAAA;;;AEjBzB;;AAEG;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { numberAttribute, input, signal, inject, effect, HostBinding, ViewChild, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i2 from 'primeng/textarea';
|
|
4
|
+
import { TextareaModule } from 'primeng/textarea';
|
|
5
|
+
import * as i1 from '@angular/forms';
|
|
6
|
+
import { Validators, NgControl, FormsModule } from '@angular/forms';
|
|
7
|
+
import { characterLimitValidator, FieldValidation } from '@masterteam/components/field-validation';
|
|
8
|
+
import { isInvalid } from '@masterteam/components';
|
|
9
|
+
import { Tooltip } from '@masterteam/components/tooltip';
|
|
10
|
+
import { Icon } from '@masterteam/icons';
|
|
11
|
+
|
|
12
|
+
const TEXTAREA_FIELD_MAX_LENGTH = 2000;
|
|
13
|
+
const optionalNumberAttribute = (value) => value === null || value === undefined
|
|
14
|
+
? null
|
|
15
|
+
: numberAttribute(value, TEXTAREA_FIELD_MAX_LENGTH);
|
|
16
|
+
// TODO: text stuck when reset
|
|
17
|
+
class TextareaField {
|
|
18
|
+
textarea;
|
|
19
|
+
field = input(true, ...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
20
|
+
hint = input(...(ngDevMode ? [undefined, { debugName: "hint" }] : /* istanbul ignore next */ []));
|
|
21
|
+
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
22
|
+
placeholder = input(...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
23
|
+
class = input('', ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
24
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
|
|
25
|
+
noErrorStyle = input(false, ...(ngDevMode ? [{ debugName: "noErrorStyle" }] : /* istanbul ignore next */ []));
|
|
26
|
+
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : /* istanbul ignore next */ []));
|
|
27
|
+
rows = input('4', ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
28
|
+
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
29
|
+
maxLength = input(TEXTAREA_FIELD_MAX_LENGTH, { ...(ngDevMode ? { debugName: "maxLength" } : /* istanbul ignore next */ {}), transform: optionalNumberAttribute });
|
|
30
|
+
styleClass;
|
|
31
|
+
requiredValidator = Validators.required;
|
|
32
|
+
maxLengthValidator = null;
|
|
33
|
+
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
34
|
+
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
35
|
+
onTouched = () => { };
|
|
36
|
+
onModelChange = () => { };
|
|
37
|
+
ngControl = inject(NgControl, { self: true, optional: true });
|
|
38
|
+
isInvalid = isInvalid;
|
|
39
|
+
constructor() {
|
|
40
|
+
if (this.ngControl) {
|
|
41
|
+
this.ngControl.valueAccessor = this;
|
|
42
|
+
}
|
|
43
|
+
effect(() => {
|
|
44
|
+
const control = this.ngControl?.control;
|
|
45
|
+
if (!control) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.required()) {
|
|
49
|
+
control.addValidators(this.requiredValidator);
|
|
50
|
+
}
|
|
51
|
+
if (this.maxLengthValidator) {
|
|
52
|
+
control.removeValidators(this.maxLengthValidator);
|
|
53
|
+
this.maxLengthValidator = null;
|
|
54
|
+
}
|
|
55
|
+
const maxLength = this.maxLength();
|
|
56
|
+
if (maxLength !== null) {
|
|
57
|
+
this.maxLengthValidator = characterLimitValidator(maxLength);
|
|
58
|
+
control.addValidators(this.maxLengthValidator);
|
|
59
|
+
}
|
|
60
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
applyInputsToTextarea() {
|
|
64
|
+
Object.assign(this.textarea, this.pInputs());
|
|
65
|
+
}
|
|
66
|
+
ngOnInit() {
|
|
67
|
+
this.styleClass = this.class();
|
|
68
|
+
if (this.pInputs()) {
|
|
69
|
+
this.applyInputsToTextarea();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
onValueChange(value) {
|
|
73
|
+
this.value.set(value);
|
|
74
|
+
const control = this.ngControl?.control;
|
|
75
|
+
if (control) {
|
|
76
|
+
control.setValue(value);
|
|
77
|
+
control.markAsDirty();
|
|
78
|
+
control.markAsTouched();
|
|
79
|
+
control.updateValueAndValidity({ emitEvent: false });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.onModelChange(value);
|
|
83
|
+
}
|
|
84
|
+
ngOnChanges(changes) {
|
|
85
|
+
if (changes['pInputs']) {
|
|
86
|
+
this.applyInputsToTextarea();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
writeValue(value) {
|
|
90
|
+
this.value.set(value);
|
|
91
|
+
}
|
|
92
|
+
registerOnChange(fn) {
|
|
93
|
+
this.onModelChange = fn;
|
|
94
|
+
}
|
|
95
|
+
registerOnTouched(fn) {
|
|
96
|
+
this.onTouched = fn;
|
|
97
|
+
}
|
|
98
|
+
setDisabledState(disabled) {
|
|
99
|
+
this.disabled.set(disabled);
|
|
100
|
+
}
|
|
101
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TextareaField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
102
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: TextareaField, isStandalone: true, selector: "mt-textarea-field", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, noErrorStyle: { classPropertyName: "noErrorStyle", publicName: "noErrorStyle", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, maxLength: { classPropertyName: "maxLength", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this.styleClass" }, classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: ["textarea"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\r\n }\r\n @if (hint()) {\r\n <span\r\n class=\"inline-flex text-surface-400\"\r\n [mtTooltip]=\"hint()\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n}\r\n<textarea\r\n #textarea\r\n pTextarea\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"ngControl?.name || label()\"\r\n [invalid]=\"!noErrorStyle() && isInvalid(ngControl?.control)\"\r\n (blur)=\"onTouched()\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n class=\"w-full\"\r\n [rows]=\"rows()\"\r\n style=\"resize: none\"\r\n></textarea>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i2.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["pTextareaPT", "pTextareaUnstyled", "autoResize", "pSize", "variant", "fluid", "invalid"], outputs: ["onResize"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
103
|
+
}
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: TextareaField, decorators: [{
|
|
105
|
+
type: Component,
|
|
106
|
+
args: [{ selector: 'mt-textarea-field', standalone: true, imports: [FormsModule, TextareaModule, FieldValidation, Tooltip, Icon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
107
|
+
class: 'grid gap-1',
|
|
108
|
+
}, template: "@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\r\n }\r\n @if (hint()) {\r\n <span\r\n class=\"inline-flex text-surface-400\"\r\n [mtTooltip]=\"hint()\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n}\r\n<textarea\r\n #textarea\r\n pTextarea\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"ngControl?.name || label()\"\r\n [invalid]=\"!noErrorStyle() && isInvalid(ngControl?.control)\"\r\n (blur)=\"onTouched()\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n class=\"w-full\"\r\n [rows]=\"rows()\"\r\n style=\"resize: none\"\r\n></textarea>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n" }]
|
|
109
|
+
}], ctorParameters: () => [], propDecorators: { textarea: [{
|
|
110
|
+
type: ViewChild,
|
|
111
|
+
args: ['textarea', { static: true }]
|
|
112
|
+
}], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: false }] }], hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], noErrorStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "noErrorStyle", required: false }] }], pInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pInputs", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], maxLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], styleClass: [{
|
|
113
|
+
type: HostBinding,
|
|
114
|
+
args: ['class']
|
|
115
|
+
}] } });
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Generated bundle index. Do not edit.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export { TextareaField };
|
|
122
|
+
//# sourceMappingURL=masterteam-components-textarea-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-textarea-field.mjs","sources":["../../../../packages/masterteam/components/textarea-field/textarea-field.ts","../../../../packages/masterteam/components/textarea-field/textarea-field.html","../../../../packages/masterteam/components/textarea-field/masterteam-components-textarea-field.ts"],"sourcesContent":["import {\r\n Component,\r\n HostBinding,\r\n SimpleChanges,\r\n ViewChild,\r\n numberAttribute,\r\n signal,\r\n input,\r\n OnInit,\r\n OnChanges,\r\n inject,\r\n ChangeDetectionStrategy,\r\n effect,\r\n} from '@angular/core';\r\nimport { TextareaModule } from 'primeng/textarea';\r\nimport {\r\n ControlValueAccessor,\r\n FormsModule,\r\n NgControl,\r\n ValidatorFn,\r\n Validators,\r\n} from '@angular/forms';\r\nimport {\r\n characterLimitValidator,\r\n FieldValidation,\r\n} from '@masterteam/components/field-validation';\r\nimport { isInvalid } from '@masterteam/components';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\n\r\nconst TEXTAREA_FIELD_MAX_LENGTH = 2000;\r\n\r\nconst optionalNumberAttribute = (value: unknown): number | null =>\r\n value === null || value === undefined\r\n ? null\r\n : numberAttribute(value, TEXTAREA_FIELD_MAX_LENGTH);\r\n\r\n// TODO: text stuck when reset\r\n@Component({\r\n selector: 'mt-textarea-field',\r\n standalone: true,\r\n imports: [FormsModule, TextareaModule, FieldValidation, Tooltip, Icon],\r\n templateUrl: './textarea-field.html',\r\n styleUrls: ['./textarea-field.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'grid gap-1',\r\n },\r\n})\r\nexport class TextareaField implements ControlValueAccessor, OnInit, OnChanges {\r\n @ViewChild('textarea', { static: true })\r\n textarea: HTMLTextAreaElement;\r\n\r\n readonly field = input<boolean>(true);\r\n readonly hint = input<string>();\r\n readonly label = input<string>();\r\n readonly placeholder = input<string>();\r\n readonly class = input<string>('');\r\n readonly readonly = input<boolean>(false);\r\n readonly noErrorStyle = input<boolean>(false);\r\n readonly pInputs = input<Partial<HTMLTextAreaElement>>();\r\n readonly rows = input<string>('4');\r\n readonly required = input<boolean>(false);\r\n readonly maxLength = input<number | null, unknown>(\r\n TEXTAREA_FIELD_MAX_LENGTH,\r\n {\r\n transform: optionalNumberAttribute,\r\n },\r\n );\r\n\r\n @HostBinding('class') styleClass: string;\r\n\r\n requiredValidator = Validators.required;\r\n private maxLengthValidator: ValidatorFn | null = null;\r\n value = signal<string | null>(null);\r\n disabled = signal<boolean>(false);\r\n\r\n onTouched: () => void = () => {};\r\n onModelChange: (value: string | null) => void = () => {};\r\n\r\n public ngControl = inject(NgControl, { self: true, optional: true });\r\n\r\n isInvalid = isInvalid;\r\n\r\n constructor() {\r\n if (this.ngControl) {\r\n this.ngControl.valueAccessor = this;\r\n }\r\n effect(() => {\r\n const control = this.ngControl?.control;\r\n if (!control) {\r\n return;\r\n }\r\n\r\n if (this.required()) {\r\n control.addValidators(this.requiredValidator);\r\n }\r\n\r\n if (this.maxLengthValidator) {\r\n control.removeValidators(this.maxLengthValidator);\r\n this.maxLengthValidator = null;\r\n }\r\n\r\n const maxLength = this.maxLength();\r\n if (maxLength !== null) {\r\n this.maxLengthValidator = characterLimitValidator(maxLength);\r\n control.addValidators(this.maxLengthValidator);\r\n }\r\n\r\n control.updateValueAndValidity({ emitEvent: false });\r\n });\r\n }\r\n\r\n applyInputsToTextarea() {\r\n Object.assign(this.textarea, this.pInputs());\r\n }\r\n\r\n ngOnInit() {\r\n this.styleClass = this.class();\r\n if (this.pInputs()) {\r\n this.applyInputsToTextarea();\r\n }\r\n }\r\n\r\n onValueChange(value: string | null) {\r\n this.value.set(value);\r\n\r\n const control = this.ngControl?.control;\r\n if (control) {\r\n control.setValue(value);\r\n control.markAsDirty();\r\n control.markAsTouched();\r\n control.updateValueAndValidity({ emitEvent: false });\r\n return;\r\n }\r\n\r\n this.onModelChange(value);\r\n }\r\n\r\n ngOnChanges(changes: SimpleChanges) {\r\n if (changes['pInputs']) {\r\n this.applyInputsToTextarea();\r\n }\r\n }\r\n\r\n writeValue(value: string) {\r\n this.value.set(value);\r\n }\r\n\r\n registerOnChange(fn: any) {\r\n this.onModelChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: any) {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(disabled: boolean) {\r\n this.disabled.set(disabled);\r\n }\r\n}\r\n","@if (label() || hint()) {\r\n <div class=\"flex items-center gap-1\">\r\n @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >{{ label() }}</label\r\n >\r\n }\r\n @if (hint()) {\r\n <span\r\n class=\"inline-flex text-surface-400\"\r\n [mtTooltip]=\"hint()\"\r\n tooltipPosition=\"top\"\r\n >\r\n <mt-icon icon=\"general.help-circle\" />\r\n </span>\r\n }\r\n </div>\r\n}\r\n<textarea\r\n #textarea\r\n pTextarea\r\n [ngModel]=\"value()\"\r\n (ngModelChange)=\"onValueChange($event)\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"disabled() || readonly()\"\r\n [id]=\"ngControl?.name || label()\"\r\n [invalid]=\"!noErrorStyle() && isInvalid(ngControl?.control)\"\r\n (blur)=\"onTouched()\"\r\n placeholder=\"{{ placeholder() ?? label() ?? '' }}\"\r\n class=\"w-full\"\r\n [rows]=\"rows()\"\r\n style=\"resize: none\"\r\n></textarea>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AA8BA,MAAM,yBAAyB,GAAG,IAAI;AAEtC,MAAM,uBAAuB,GAAG,CAAC,KAAc,KAC7C,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK;AAC1B,MAAE;AACF,MAAE,eAAe,CAAC,KAAK,EAAE,yBAAyB,CAAC;AAEvD;MAYa,aAAa,CAAA;AAExB,IAAA,QAAQ;AAEC,IAAA,KAAK,GAAG,KAAK,CAAU,IAAI,4EAAC;IAC5B,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACtB,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACvB,WAAW,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAC7B,IAAA,KAAK,GAAG,KAAK,CAAS,EAAE,4EAAC;AACzB,IAAA,QAAQ,GAAG,KAAK,CAAU,KAAK,+EAAC;AAChC,IAAA,YAAY,GAAG,KAAK,CAAU,KAAK,mFAAC;IACpC,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAA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AAA,UAAA,EAAA,CAAA;kBAXzB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,cACjB,IAAI,EAAA,OAAA,EACP,CAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,mBAGrD,uBAAuB,CAAC,MAAM,EAAA,IAAA,EACzC;AACJ,wBAAA,KAAK,EAAE,YAAY;AACpB,qBAAA,EAAA,QAAA,EAAA,gmCAAA,EAAA;;sBAGA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;sBAoBtC,WAAW;uBAAC,OAAO;;;AEtEtB;;AAEG;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, Component } from '@angular/core';
|
|
3
|
+
import { RouterLink } from '@angular/router';
|
|
4
|
+
import { TranslocoPipe } from '@jsverse/transloco';
|
|
5
|
+
|
|
6
|
+
class Topbar {
|
|
7
|
+
logo = input(...(ngDevMode ? [undefined, { debugName: "logo" }] : /* istanbul ignore next */ []));
|
|
8
|
+
logoLink = input(...(ngDevMode ? [undefined, { debugName: "logoLink" }] : /* istanbul ignore next */ []));
|
|
9
|
+
bgColor = input('var(--p-primary-color)', ...(ngDevMode ? [{ debugName: "bgColor" }] : /* istanbul ignore next */ []));
|
|
10
|
+
bgImage = input(...(ngDevMode ? [undefined, { debugName: "bgImage" }] : /* istanbul ignore next */ []));
|
|
11
|
+
bgRepeat = input(false, { ...(ngDevMode ? { debugName: "bgRepeat" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
12
|
+
textColor = input('var(--p-primary-contrast-color)', ...(ngDevMode ? [{ debugName: "textColor" }] : /* istanbul ignore next */ []));
|
|
13
|
+
title = input(...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
|
|
14
|
+
subTitle = input(...(ngDevMode ? [undefined, { debugName: "subTitle" }] : /* istanbul ignore next */ []));
|
|
15
|
+
showBranding = input(true, { ...(ngDevMode ? { debugName: "showBranding" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
16
|
+
logoClass = input(...(ngDevMode ? [undefined, { debugName: "logoClass" }] : /* istanbul ignore next */ []));
|
|
17
|
+
titleClass = input(...(ngDevMode ? [undefined, { debugName: "titleClass" }] : /* istanbul ignore next */ []));
|
|
18
|
+
subTitleClass = input(...(ngDevMode ? [undefined, { debugName: "subTitleClass" }] : /* istanbul ignore next */ []));
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Topbar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Topbar, isStandalone: true, selector: "mt-topbar", inputs: { logo: { classPropertyName: "logo", publicName: "logo", isSignal: true, isRequired: false, transformFunction: null }, logoLink: { classPropertyName: "logoLink", publicName: "logoLink", isSignal: true, isRequired: false, transformFunction: null }, bgColor: { classPropertyName: "bgColor", publicName: "bgColor", isSignal: true, isRequired: false, transformFunction: null }, bgImage: { classPropertyName: "bgImage", publicName: "bgImage", isSignal: true, isRequired: false, transformFunction: null }, bgRepeat: { classPropertyName: "bgRepeat", publicName: "bgRepeat", isSignal: true, isRequired: false, transformFunction: null }, textColor: { classPropertyName: "textColor", publicName: "textColor", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, subTitle: { classPropertyName: "subTitle", publicName: "subTitle", isSignal: true, isRequired: false, transformFunction: null }, showBranding: { classPropertyName: "showBranding", publicName: "showBranding", isSignal: true, isRequired: false, transformFunction: null }, logoClass: { classPropertyName: "logoClass", publicName: "logoClass", isSignal: true, isRequired: false, transformFunction: null }, titleClass: { classPropertyName: "titleClass", publicName: "titleClass", isSignal: true, isRequired: false, transformFunction: null }, subTitleClass: { classPropertyName: "subTitleClass", publicName: "subTitleClass", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"w-full flex justify-between align-center bg-primary px-4 py-2 h-[var(--header-height)]\"\r\n [style.backgroundColor]=\"bgColor()\"\r\n [style.backgroundImage]=\"bgImage() ? 'url(' + bgImage() + ')' : null\"\r\n [style.backgroundSize]=\"bgImage() && !bgRepeat() ? 'cover' : null\"\r\n [style.backgroundPosition]=\"bgImage() && !bgRepeat() ? 'center' : null\"\r\n [class.bg-no-repeat]=\"!bgRepeat()\"\r\n [class.bg-repeat]=\"bgRepeat()\"\r\n>\r\n <div class=\"flex gap-4 items-center\" [style.color]=\"textColor()\">\r\n <div\r\n class=\"flex gap-3 items-center h-full overflow-hidden transition-all duration-400 ease-in-out\"\r\n [class.max-w-0]=\"!showBranding()\"\r\n [class.opacity-0]=\"!showBranding()\"\r\n [class.max-w-lg]=\"showBranding()\"\r\n [class.opacity-100]=\"showBranding()\"\r\n >\r\n @if (logo()) {\r\n <img\r\n [src]=\"logo()\"\r\n [alt]=\"'components.topbar.logoAlt' | transloco\"\r\n class=\"h-10 shrink-0\"\r\n [class]=\"logoClass()\"\r\n [routerLink]=\"logoLink()\"\r\n [class.cursor-pointer]=\"logoLink()\"\r\n />\r\n }\r\n @if (logo() && (title() || subTitle())) {\r\n <div class=\"h-3/4 w-[1px] bg-current shrink-0 opacity-30\"></div>\r\n }\r\n @if (title() || subTitle()) {\r\n <div class=\"flex flex-col shrink-0\">\r\n <h2\r\n class=\"text-md font-semibold product-name whitespace-nowrap\"\r\n [class]=\"titleClass()\"\r\n >\r\n {{ title() }}\r\n </h2>\r\n <span\r\n class=\"text-sm product-tagline whitespace-nowrap\"\r\n [class]=\"subTitleClass()\"\r\n >{{ subTitle() }}</span\r\n >\r\n </div>\r\n }\r\n </div>\r\n <ng-content select=\"[start]\"></ng-content>\r\n </div>\r\n <div class=\"flex gap-2 items-center\">\r\n <ng-content select=\"[actions]\"></ng-content>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }] });
|
|
21
|
+
}
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Topbar, decorators: [{
|
|
23
|
+
type: Component,
|
|
24
|
+
args: [{ selector: 'mt-topbar', standalone: true, imports: [RouterLink, TranslocoPipe], template: "<div\r\n class=\"w-full flex justify-between align-center bg-primary px-4 py-2 h-[var(--header-height)]\"\r\n [style.backgroundColor]=\"bgColor()\"\r\n [style.backgroundImage]=\"bgImage() ? 'url(' + bgImage() + ')' : null\"\r\n [style.backgroundSize]=\"bgImage() && !bgRepeat() ? 'cover' : null\"\r\n [style.backgroundPosition]=\"bgImage() && !bgRepeat() ? 'center' : null\"\r\n [class.bg-no-repeat]=\"!bgRepeat()\"\r\n [class.bg-repeat]=\"bgRepeat()\"\r\n>\r\n <div class=\"flex gap-4 items-center\" [style.color]=\"textColor()\">\r\n <div\r\n class=\"flex gap-3 items-center h-full overflow-hidden transition-all duration-400 ease-in-out\"\r\n [class.max-w-0]=\"!showBranding()\"\r\n [class.opacity-0]=\"!showBranding()\"\r\n [class.max-w-lg]=\"showBranding()\"\r\n [class.opacity-100]=\"showBranding()\"\r\n >\r\n @if (logo()) {\r\n <img\r\n [src]=\"logo()\"\r\n [alt]=\"'components.topbar.logoAlt' | transloco\"\r\n class=\"h-10 shrink-0\"\r\n [class]=\"logoClass()\"\r\n [routerLink]=\"logoLink()\"\r\n [class.cursor-pointer]=\"logoLink()\"\r\n />\r\n }\r\n @if (logo() && (title() || subTitle())) {\r\n <div class=\"h-3/4 w-[1px] bg-current shrink-0 opacity-30\"></div>\r\n }\r\n @if (title() || subTitle()) {\r\n <div class=\"flex flex-col shrink-0\">\r\n <h2\r\n class=\"text-md font-semibold product-name whitespace-nowrap\"\r\n [class]=\"titleClass()\"\r\n >\r\n {{ title() }}\r\n </h2>\r\n <span\r\n class=\"text-sm product-tagline whitespace-nowrap\"\r\n [class]=\"subTitleClass()\"\r\n >{{ subTitle() }}</span\r\n >\r\n </div>\r\n }\r\n </div>\r\n <ng-content select=\"[start]\"></ng-content>\r\n </div>\r\n <div class=\"flex gap-2 items-center\">\r\n <ng-content select=\"[actions]\"></ng-content>\r\n </div>\r\n</div>\r\n" }]
|
|
25
|
+
}], propDecorators: { logo: [{ type: i0.Input, args: [{ isSignal: true, alias: "logo", required: false }] }], logoLink: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoLink", required: false }] }], bgColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "bgColor", required: false }] }], bgImage: [{ type: i0.Input, args: [{ isSignal: true, alias: "bgImage", required: false }] }], bgRepeat: [{ type: i0.Input, args: [{ isSignal: true, alias: "bgRepeat", required: false }] }], textColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "textColor", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], subTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "subTitle", required: false }] }], showBranding: [{ type: i0.Input, args: [{ isSignal: true, alias: "showBranding", required: false }] }], logoClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoClass", required: false }] }], titleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "titleClass", required: false }] }], subTitleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "subTitleClass", required: false }] }] } });
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generated bundle index. Do not edit.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export { Topbar };
|
|
32
|
+
//# sourceMappingURL=masterteam-components-topbar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masterteam-components-topbar.mjs","sources":["../../../../packages/masterteam/components/topbar/topbar.ts","../../../../packages/masterteam/components/topbar/topbar.html","../../../../packages/masterteam/components/topbar/masterteam-components-topbar.ts"],"sourcesContent":["import { booleanAttribute, Component, input } from '@angular/core';\r\nimport { RouterLink } from '@angular/router';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\n\r\n@Component({\r\n selector: 'mt-topbar',\r\n standalone: true,\r\n imports: [RouterLink, TranslocoPipe],\r\n templateUrl: './topbar.html',\r\n})\r\nexport class Topbar {\r\n logo = input<string>();\r\n logoLink = input<string | any[]>();\r\n bgColor = input<string>('var(--p-primary-color)');\r\n bgImage = input<string>();\r\n bgRepeat = input<boolean, unknown>(false, { transform: booleanAttribute });\r\n textColor = input<string>('var(--p-primary-contrast-color)');\r\n title = input<string>();\r\n subTitle = input<string>();\r\n showBranding = input<boolean, unknown>(true, { transform: booleanAttribute });\r\n logoClass = input<string>();\r\n titleClass = input<string>();\r\n subTitleClass = input<string>();\r\n}\r\n","<div\r\n class=\"w-full flex justify-between align-center bg-primary px-4 py-2 h-[var(--header-height)]\"\r\n [style.backgroundColor]=\"bgColor()\"\r\n [style.backgroundImage]=\"bgImage() ? 'url(' + bgImage() + ')' : null\"\r\n [style.backgroundSize]=\"bgImage() && !bgRepeat() ? 'cover' : null\"\r\n [style.backgroundPosition]=\"bgImage() && !bgRepeat() ? 'center' : null\"\r\n [class.bg-no-repeat]=\"!bgRepeat()\"\r\n [class.bg-repeat]=\"bgRepeat()\"\r\n>\r\n <div class=\"flex gap-4 items-center\" [style.color]=\"textColor()\">\r\n <div\r\n class=\"flex gap-3 items-center h-full overflow-hidden transition-all duration-400 ease-in-out\"\r\n [class.max-w-0]=\"!showBranding()\"\r\n [class.opacity-0]=\"!showBranding()\"\r\n [class.max-w-lg]=\"showBranding()\"\r\n [class.opacity-100]=\"showBranding()\"\r\n >\r\n @if (logo()) {\r\n <img\r\n [src]=\"logo()\"\r\n [alt]=\"'components.topbar.logoAlt' | transloco\"\r\n class=\"h-10 shrink-0\"\r\n [class]=\"logoClass()\"\r\n [routerLink]=\"logoLink()\"\r\n [class.cursor-pointer]=\"logoLink()\"\r\n />\r\n }\r\n @if (logo() && (title() || subTitle())) {\r\n <div class=\"h-3/4 w-[1px] bg-current shrink-0 opacity-30\"></div>\r\n }\r\n @if (title() || subTitle()) {\r\n <div class=\"flex flex-col shrink-0\">\r\n <h2\r\n class=\"text-md font-semibold product-name whitespace-nowrap\"\r\n [class]=\"titleClass()\"\r\n >\r\n {{ title() }}\r\n </h2>\r\n <span\r\n class=\"text-sm product-tagline whitespace-nowrap\"\r\n [class]=\"subTitleClass()\"\r\n >{{ subTitle() }}</span\r\n >\r\n </div>\r\n }\r\n </div>\r\n <ng-content select=\"[start]\"></ng-content>\r\n </div>\r\n <div class=\"flex gap-2 items-center\">\r\n <ng-content select=\"[actions]\"></ng-content>\r\n </div>\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAUa,MAAM,CAAA;IACjB,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACtB,QAAQ,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAkB;AAClC,IAAA,OAAO,GAAG,KAAK,CAAS,wBAAwB,8EAAC;IACjD,OAAO,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACzB,QAAQ,GAAG,KAAK,CAAmB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAC1E,IAAA,SAAS,GAAG,KAAK,CAAS,iCAAiC,gFAAC;IAC5D,KAAK,GAAG,KAAK,C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AA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,aAAA,EAAA,EAAA,iBAAA,EAAA,eAAA,EAAA,UAAA,EAAA,eAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECVnB,m+DAoDA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,ED7CY,UAAU,+NAAE,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAGxB,MAAM,EAAA,UAAA,EAAA,CAAA;kBANlB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,cACT,IAAI,EAAA,OAAA,EACP,CAAC,UAAU,EAAE,aAAa,CAAC,EAAA,QAAA,EAAA,m+DAAA,EAAA;;;AEPtC;;AAEG;;;;"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { ToggleField } from '@masterteam/components/toggle-field';
|
|
2
|
+
import { Avatar } from '@masterteam/components/avatar';
|
|
3
|
+
import { Button } from '@masterteam/components/button';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { inject, viewChild, input, model, computed, output, signal, effect, Component } from '@angular/core';
|
|
6
|
+
import * as i1 from 'primeng/tree';
|
|
7
|
+
import { TreeModule } from 'primeng/tree';
|
|
8
|
+
import { Icon } from '@masterteam/icons';
|
|
9
|
+
import { CommonModule } from '@angular/common';
|
|
10
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
11
|
+
import * as i3 from '@angular/forms';
|
|
12
|
+
import { FormsModule } from '@angular/forms';
|
|
13
|
+
import * as i4 from 'primeng/contextmenu';
|
|
14
|
+
import { ContextMenuModule } from 'primeng/contextmenu';
|
|
15
|
+
import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
|
|
16
|
+
import * as i2 from 'primeng/api';
|
|
17
|
+
|
|
18
|
+
class Tree {
|
|
19
|
+
transloco = inject(TranslocoService);
|
|
20
|
+
dir = inject(Directionality, { optional: true });
|
|
21
|
+
primeTree = viewChild('primeTree', ...(ngDevMode ? [{ debugName: "primeTree" }] : /* istanbul ignore next */ []));
|
|
22
|
+
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
23
|
+
selection = model(...(ngDevMode ? [undefined, { debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
24
|
+
selectionMode = input(...(ngDevMode ? [undefined, { debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
25
|
+
nodeIcon = input(...(ngDevMode ? [undefined, { debugName: "nodeIcon" }] : /* istanbul ignore next */ []));
|
|
26
|
+
propagateSelectionUp = input(false, ...(ngDevMode ? [{ debugName: "propagateSelectionUp" }] : /* istanbul ignore next */ []));
|
|
27
|
+
propagateSelectionDown = input(false, ...(ngDevMode ? [{ debugName: "propagateSelectionDown" }] : /* istanbul ignore next */ []));
|
|
28
|
+
checkAllChildren = input(false, ...(ngDevMode ? [{ debugName: "checkAllChildren" }] : /* istanbul ignore next */ []));
|
|
29
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
30
|
+
emptyMessage = input(this.transloco.translate('components.tree.no-data-found'), ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
31
|
+
checkAllLabel = input(this.transloco.translate('components.tree.check-all'), ...(ngDevMode ? [{ debugName: "checkAllLabel" }] : /* istanbul ignore next */ []));
|
|
32
|
+
filterPlaceholder = input(this.transloco.translate('components.tree.search'), ...(ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []));
|
|
33
|
+
dataKey = input('key', ...(ngDevMode ? [{ debugName: "dataKey" }] : /* istanbul ignore next */ []));
|
|
34
|
+
filter = input(false, ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
|
|
35
|
+
filterMode = input('lenient', ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
36
|
+
virtualScroll = input(false, ...(ngDevMode ? [{ debugName: "virtualScroll" }] : /* istanbul ignore next */ []));
|
|
37
|
+
virtualScrollItemSize = input(46, ...(ngDevMode ? [{ debugName: "virtualScrollItemSize" }] : /* istanbul ignore next */ []));
|
|
38
|
+
scrollHeight = input(...(ngDevMode ? [undefined, { debugName: "scrollHeight" }] : /* istanbul ignore next */ []));
|
|
39
|
+
styleClass = input('', ...(ngDevMode ? [{ debugName: "styleClass" }] : /* istanbul ignore next */ []));
|
|
40
|
+
style = input(...(ngDevMode ? [undefined, { debugName: "style" }] : /* istanbul ignore next */ []));
|
|
41
|
+
pInputs = input(...(ngDevMode ? [undefined, { debugName: "pInputs" }] : /* istanbul ignore next */ []));
|
|
42
|
+
nodeActions = input([], ...(ngDevMode ? [{ debugName: "nodeActions" }] : /* istanbul ignore next */ []));
|
|
43
|
+
nodeContextmenuActions = input([], ...(ngDevMode ? [{ debugName: "nodeContextmenuActions" }] : /* istanbul ignore next */ []));
|
|
44
|
+
// Context menu state
|
|
45
|
+
contextMenuSelection = model(null, ...(ngDevMode ? [{ debugName: "contextMenuSelection" }] : /* istanbul ignore next */ []));
|
|
46
|
+
contextMenuItems = computed(() => {
|
|
47
|
+
const actions = this.nodeContextmenuActions();
|
|
48
|
+
return actions.map((action) => ({
|
|
49
|
+
label: action.label,
|
|
50
|
+
icon: action.icon,
|
|
51
|
+
command: () => {
|
|
52
|
+
const node = this.contextMenuSelection();
|
|
53
|
+
if (node) {
|
|
54
|
+
action.action(node);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
}));
|
|
58
|
+
}, ...(ngDevMode ? [{ debugName: "contextMenuItems" }] : /* istanbul ignore next */ []));
|
|
59
|
+
action = output();
|
|
60
|
+
CheckAllValue = signal(false, ...(ngDevMode ? [{ debugName: "CheckAllValue" }] : /* istanbul ignore next */ []));
|
|
61
|
+
// Computed tree value with "Check All" nodes added recursively to all parents
|
|
62
|
+
treeValue = computed(() => {
|
|
63
|
+
const nodes = this.value();
|
|
64
|
+
const shouldAddCheckAll = this.checkAllChildren() && this.selectionMode() === 'checkbox';
|
|
65
|
+
if (!shouldAddCheckAll) {
|
|
66
|
+
return nodes;
|
|
67
|
+
}
|
|
68
|
+
// Recursively add "Check All" child to any parent node
|
|
69
|
+
const addCheckAllRecursive = (node) => {
|
|
70
|
+
if (node.children && node.children.length > 0) {
|
|
71
|
+
const checkAllNode = {
|
|
72
|
+
key: `${node.key}-check-all`,
|
|
73
|
+
label: this.checkAllLabel(),
|
|
74
|
+
icon: 'general.check-square-broken',
|
|
75
|
+
data: node,
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
...node,
|
|
79
|
+
children: [checkAllNode, ...node.children.map(addCheckAllRecursive)],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return node;
|
|
83
|
+
};
|
|
84
|
+
// Transform all nodes
|
|
85
|
+
const transformedNodes = nodes.map(addCheckAllRecursive);
|
|
86
|
+
// Add "Check All" for entire tree at the beginning
|
|
87
|
+
const treeCheckAllNode = {
|
|
88
|
+
key: 'tree-check-all',
|
|
89
|
+
label: this.checkAllLabel(),
|
|
90
|
+
icon: 'general.check-square-broken',
|
|
91
|
+
data: { isTreeRoot: true, children: transformedNodes },
|
|
92
|
+
};
|
|
93
|
+
return [treeCheckAllNode, ...transformedNodes];
|
|
94
|
+
}, ...(ngDevMode ? [{ debugName: "treeValue" }] : /* istanbul ignore next */ []));
|
|
95
|
+
constructor() {
|
|
96
|
+
// Apply pInputs to the PrimeNG tree instance
|
|
97
|
+
effect(() => {
|
|
98
|
+
const tree = this.primeTree();
|
|
99
|
+
const inputs = this.pInputs();
|
|
100
|
+
if (tree && inputs) {
|
|
101
|
+
Object.assign(tree, inputs);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
// Sync checked state when selection changes (including initial value)
|
|
105
|
+
effect(() => {
|
|
106
|
+
const value = this.treeValue();
|
|
107
|
+
// Only run if we have nodes and selection
|
|
108
|
+
if (value.length > 0 && this.selectionMode() === 'checkbox') {
|
|
109
|
+
this.handleCheckedNodes();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
isProcessingBatchSelection = signal(false, ...(ngDevMode ? [{ debugName: "isProcessingBatchSelection" }] : /* istanbul ignore next */ []));
|
|
114
|
+
onSelectionChange(event) {
|
|
115
|
+
// Skip emitting if we're in the middle of batch processing
|
|
116
|
+
if (this.isProcessingBatchSelection()) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this.handleCheckedNodes();
|
|
120
|
+
this.action.emit({ action: 'selectionChange', data: event });
|
|
121
|
+
}
|
|
122
|
+
onNodeSelect(event) {
|
|
123
|
+
this.action.emit({ action: 'nodeSelect', data: event });
|
|
124
|
+
}
|
|
125
|
+
onNodeUnselect(event) {
|
|
126
|
+
this.action.emit({ action: 'nodeUnselect', data: event });
|
|
127
|
+
}
|
|
128
|
+
onNodeExpand(event) {
|
|
129
|
+
this.action.emit({ action: 'nodeExpand', data: event });
|
|
130
|
+
}
|
|
131
|
+
onNodeCollapse(event) {
|
|
132
|
+
this.action.emit({ action: 'nodeCollapse', data: event });
|
|
133
|
+
}
|
|
134
|
+
onContextMenuSelect(event) {
|
|
135
|
+
this.contextMenuSelection.set(event);
|
|
136
|
+
}
|
|
137
|
+
getCheckAllValue(event) {
|
|
138
|
+
this.CheckAllValue.set(event);
|
|
139
|
+
}
|
|
140
|
+
toggleNodeExpanded(node, event) {
|
|
141
|
+
event.stopPropagation();
|
|
142
|
+
node.expanded = !node.expanded;
|
|
143
|
+
const tree = this.primeTree();
|
|
144
|
+
if (tree && this.virtualScroll()) {
|
|
145
|
+
tree.updateSerializedValue();
|
|
146
|
+
}
|
|
147
|
+
this.action.emit({
|
|
148
|
+
action: node.expanded ? 'nodeExpand' : 'nodeCollapse',
|
|
149
|
+
data: { node },
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
toggleNodeSelection(node, event) {
|
|
153
|
+
event.stopPropagation();
|
|
154
|
+
if (node.selectable === false) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const tree = this.primeTree();
|
|
158
|
+
if (this.selectionMode() === 'checkbox' && tree) {
|
|
159
|
+
if (node.key?.includes('check-all') && node.data) {
|
|
160
|
+
const checkValue = this.CheckAllValue() ?? true;
|
|
161
|
+
// Handle parent-level "Check All" - only check immediate children
|
|
162
|
+
const parentNode = node.data;
|
|
163
|
+
// Start batch processing to prevent multiple selection change events
|
|
164
|
+
this.isProcessingBatchSelection.set(true);
|
|
165
|
+
parentNode?.children?.forEach((child) => {
|
|
166
|
+
if (!child.key?.includes('check-all')) {
|
|
167
|
+
const isSelected = tree.isSelected(child);
|
|
168
|
+
// Only toggle if the current state doesn't match desired state
|
|
169
|
+
if ((checkValue && !isSelected) || (!checkValue && isSelected)) {
|
|
170
|
+
tree.onNodeClick(event, child);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
// End batch processing and emit single selection change event
|
|
175
|
+
this.isProcessingBatchSelection.set(false);
|
|
176
|
+
this.handleCheckedNodes();
|
|
177
|
+
this.action.emit({
|
|
178
|
+
action: 'selectionChange',
|
|
179
|
+
data: this.selection(),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
tree.onNodeClick(event, node);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
handleCheckedNodes() {
|
|
188
|
+
const tree = this.primeTree();
|
|
189
|
+
if (!tree)
|
|
190
|
+
return;
|
|
191
|
+
// Build a Set of selected keys for O(1) lookup instead of repeated isSelected() calls
|
|
192
|
+
const selection = this.selection();
|
|
193
|
+
const selectedKeys = new Set();
|
|
194
|
+
if (Array.isArray(selection)) {
|
|
195
|
+
for (const node of selection) {
|
|
196
|
+
if (node.key)
|
|
197
|
+
selectedKeys.add(node.key);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const updateNodeCheckedState = (nodes) => {
|
|
201
|
+
for (const node of nodes) {
|
|
202
|
+
if (node.key?.includes('check-all')) {
|
|
203
|
+
node.checked = nodes.every((n) => n.key?.includes('check-all') || selectedKeys.has(n.key));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
node.checked = selectedKeys.has(node.key);
|
|
207
|
+
}
|
|
208
|
+
if (node.children) {
|
|
209
|
+
updateNodeCheckedState(node.children);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
updateNodeCheckedState(this.treeValue());
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Clears the tree's search/filter input and resets the filtered nodes.
|
|
217
|
+
*/
|
|
218
|
+
resetFilter() {
|
|
219
|
+
const tree = this.primeTree();
|
|
220
|
+
if (!tree)
|
|
221
|
+
return;
|
|
222
|
+
tree.resetFilter();
|
|
223
|
+
// PrimeNG's resetFilter() does not re-serialize the nodes, so the
|
|
224
|
+
// (virtual-scrolled) list keeps showing the previously filtered set.
|
|
225
|
+
// Refresh the serialized value so the full tree is rendered again.
|
|
226
|
+
tree.updateSerializedValue();
|
|
227
|
+
}
|
|
228
|
+
resolveActionLoading(action, node) {
|
|
229
|
+
if (typeof action.loading === 'function') {
|
|
230
|
+
return action.loading(node);
|
|
231
|
+
}
|
|
232
|
+
return action.loading;
|
|
233
|
+
}
|
|
234
|
+
nodeAction(action, node) {
|
|
235
|
+
action.action(node);
|
|
236
|
+
}
|
|
237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
238
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: Tree, isStandalone: true, selector: "mt-tree", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, nodeIcon: { classPropertyName: "nodeIcon", publicName: "nodeIcon", isSignal: true, isRequired: false, transformFunction: null }, propagateSelectionUp: { classPropertyName: "propagateSelectionUp", publicName: "propagateSelectionUp", isSignal: true, isRequired: false, transformFunction: null }, propagateSelectionDown: { classPropertyName: "propagateSelectionDown", publicName: "propagateSelectionDown", isSignal: true, isRequired: false, transformFunction: null }, checkAllChildren: { classPropertyName: "checkAllChildren", publicName: "checkAllChildren", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, checkAllLabel: { classPropertyName: "checkAllLabel", publicName: "checkAllLabel", isSignal: true, isRequired: false, transformFunction: null }, filterPlaceholder: { classPropertyName: "filterPlaceholder", publicName: "filterPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, dataKey: { classPropertyName: "dataKey", publicName: "dataKey", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null }, scrollHeight: { classPropertyName: "scrollHeight", publicName: "scrollHeight", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, style: { classPropertyName: "style", publicName: "style", isSignal: true, isRequired: false, transformFunction: null }, pInputs: { classPropertyName: "pInputs", publicName: "pInputs", isSignal: true, isRequired: false, transformFunction: null }, nodeActions: { classPropertyName: "nodeActions", publicName: "nodeActions", isSignal: true, isRequired: false, transformFunction: null }, nodeContextmenuActions: { classPropertyName: "nodeContextmenuActions", publicName: "nodeContextmenuActions", isSignal: true, isRequired: false, transformFunction: null }, contextMenuSelection: { classPropertyName: "contextMenuSelection", publicName: "contextMenuSelection", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selection: "selectionChange", contextMenuSelection: "contextMenuSelectionChange", action: "action" }, viewQueries: [{ propertyName: "primeTree", first: true, predicate: ["primeTree"], descendants: true, isSignal: true }], ngImport: i0, template: "<p-tree\r\n #primeTree\r\n [value]=\"treeValue()\"\r\n [(selection)]=\"selection\"\r\n [selectionMode]=\"selectionMode()\"\r\n [propagateSelectionUp]=\"propagateSelectionUp()\"\r\n [propagateSelectionDown]=\"propagateSelectionDown()\"\r\n [loading]=\"loading()\"\r\n [emptyMessage]=\"emptyMessage()\"\r\n [filter]=\"filter()\"\r\n [virtualScroll]=\"virtualScroll()\"\r\n [virtualScrollItemSize]=\"virtualScrollItemSize()\"\r\n [scrollHeight]=\"scrollHeight()\"\r\n [filterMode]=\"filterMode()\"\r\n [filterPlaceholder]=\"filterPlaceholder()\"\r\n [styleClass]=\"'mt-tree ' + styleClass()\"\r\n [style]=\"style()\"\r\n [contextMenu]=\"contextMenuItems().length ? cm : null\"\r\n [(contextMenuSelection)]=\"contextMenuSelection\"\r\n contextMenuSelectionMode=\"separate\"\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n (onNodeSelect)=\"onNodeSelect($event)\"\r\n (onNodeUnselect)=\"onNodeUnselect($event)\"\r\n (onNodeExpand)=\"onNodeExpand($event)\"\r\n (onNodeCollapse)=\"onNodeCollapse($event)\"\r\n (onNodeContextMenuSelect)=\"onContextMenuSelect($event.node)\"\r\n>\r\n <ng-template let-node pTemplate=\"default\">\r\n <div\r\n (click)=\"selectionMode() === 'checkbox' ? $event.stopPropagation() : null\"\r\n class=\"mt-tree-node border-1 border-gray-300 cursor-default rounded-lg flex items-center hover:bg-surface-100 justify-between\"\r\n [class]=\"node?.key.includes('check-all') ? 'bg-surface-100 ' : ''\"\r\n >\r\n <div\r\n class=\"px-3 flex items-center justify-between flex-1\"\r\n [class.cursor-pointer]=\"\r\n selectionMode() === 'single' || selectionMode() === 'multiple'\r\n \"\r\n >\r\n <div class=\"flex items-center\">\r\n @if (node.children && node.children.length > 0) {\r\n <div class=\"py-3\" (click)=\"toggleNodeExpanded(node, $event)\">\r\n <mt-icon\r\n class=\"text-2xl cursor-pointer\"\r\n [icon]=\"\r\n node.expanded\r\n ? 'arrow.chevron-down'\r\n : dir?.value === 'rtl'\r\n ? 'arrow.chevron-left'\r\n : 'arrow.chevron-right'\r\n \"\r\n />\r\n </div>\r\n }\r\n @if (node.icon || nodeIcon()) {\r\n <mt-avatar\r\n class=\"ms-2\"\r\n [icon]=\"node.icon || nodeIcon()\"\r\n shape=\"square\"\r\n size=\"small\"\r\n style=\"\r\n --p-avatar-background: var(--p-primary-50);\r\n --p-avatar-color: var(--p-primary-color);\r\n \"\r\n [style]=\"\r\n node?.key.includes('check-all')\r\n ? ' --p-avatar-background: var(--p-primary-color); --p-avatar-color: white'\r\n : ''\r\n \"\r\n >\r\n </mt-avatar>\r\n }\r\n <div class=\"text-md mx-3 py-4\">{{ node.label }}</div>\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (nodeActions().length > 0) {\r\n <div class=\"flex items-center\">\r\n @for (action of nodeActions(); track action.icon) {\r\n @let hidden = action.hidden?.(node);\r\n @if (!hidden) {\r\n <mt-button\r\n [variant]=\"action.variant\"\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.severity\"\r\n [size]=\"action.size\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n [loading]=\"resolveActionLoading(action, node)\"\r\n (click)=\"nodeAction(action, node)\"\r\n >\r\n </mt-button>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n @if (selectionMode() === \"checkbox\") {\r\n <div\r\n class=\"me-3\"\r\n [class.cursor-pointer]=\"node.selectable !== false\"\r\n (click)=\"toggleNodeSelection(node, $event)\"\r\n >\r\n <mt-toggle-field\r\n (ngModelChange)=\"getCheckAllValue($event)\"\r\n [ngModel]=\"node.checked\"\r\n [disabled]=\"node.selectable === false\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</p-tree>\r\n\r\n<p-contextMenu #cm [model]=\"contextMenuItems()\" appendTo=\"body\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <div class=\"p-menu-item-content\" (click)=\"item.command()\">\r\n <a class=\"p-menu-item-link flex items-center gap-2\">\r\n @if (item.icon) {\r\n <mt-icon [icon]=\"item.icon\" class=\"text-lg\" />\r\n }\r\n <span class=\"p-menu-item-label\">{{ item.label }}</span>\r\n </a>\r\n </div>\r\n </ng-template>\r\n</p-contextMenu>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: TreeModule }, { kind: "component", type: i1.Tree, selector: "p-tree", inputs: ["value", "selectionMode", "loadingMode", "selection", "styleClass", "contextMenu", "contextMenuSelectionMode", "contextMenuSelection", "draggableScope", "droppableScope", "draggableNodes", "droppableNodes", "metaKeySelection", "propagateSelectionUp", "propagateSelectionDown", "loading", "loadingIcon", "emptyMessage", "ariaLabel", "togglerAriaLabel", "ariaLabelledBy", "validateDrop", "filter", "filterInputAutoFocus", "filterBy", "filterMode", "filterOptions", "filterPlaceholder", "filteredNodes", "filterLocale", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "indentation", "_templateMap", "trackBy", "highlightOnSelect"], outputs: ["selectionChange", "contextMenuSelectionChange", "onNodeSelect", "onNodeUnselect", "onNodeExpand", "onNodeCollapse", "onNodeContextMenuSelect", "onNodeDoubleClick", "onNodeDrop", "onLazyLoad", "onScroll", "onScrollIndexChange", "onFilter"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "component", type: Avatar, selector: "mt-avatar", inputs: ["label", "icon", "image", "styleClass", "size", "shape", "badge", "badgeSize", "badgeSeverity"], outputs: ["onImageError"] }, { kind: "component", type: Button, selector: "mt-button", inputs: ["icon", "label", "tooltip", "class", "type", "styleClass", "severity", "badge", "variant", "badgeSeverity", "size", "iconPos", "autofocus", "fluid", "raised", "rounded", "text", "plain", "outlined", "link", "disabled", "loading", "pInputs"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ToggleField, selector: "mt-toggle-field", inputs: ["label", "inputId", "labelPosition", "placeholder", "readonly", "pInputs", "required", "toggleShape", "size", "icon", "descriptionCard"], outputs: ["onChange"] }, { kind: "ngmodule", type: ContextMenuModule }, { kind: "component", type: i4.ContextMenu, selector: "p-contextMenu, p-contextmenu, p-context-menu", inputs: ["model", "triggerEvent", "target", "global", "style", "styleClass", "autoZIndex", "baseZIndex", "id", "breakpoint", "ariaLabel", "ariaLabelledBy", "pressDelay", "appendTo", "motionOptions"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: TranslocoModule }] });
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: Tree, decorators: [{
|
|
241
|
+
type: Component,
|
|
242
|
+
args: [{ selector: 'mt-tree', standalone: true, imports: [
|
|
243
|
+
TreeModule,
|
|
244
|
+
Icon,
|
|
245
|
+
CommonModule,
|
|
246
|
+
Avatar,
|
|
247
|
+
Button,
|
|
248
|
+
FormsModule,
|
|
249
|
+
ToggleField,
|
|
250
|
+
ContextMenuModule,
|
|
251
|
+
TranslocoModule,
|
|
252
|
+
], template: "<p-tree\r\n #primeTree\r\n [value]=\"treeValue()\"\r\n [(selection)]=\"selection\"\r\n [selectionMode]=\"selectionMode()\"\r\n [propagateSelectionUp]=\"propagateSelectionUp()\"\r\n [propagateSelectionDown]=\"propagateSelectionDown()\"\r\n [loading]=\"loading()\"\r\n [emptyMessage]=\"emptyMessage()\"\r\n [filter]=\"filter()\"\r\n [virtualScroll]=\"virtualScroll()\"\r\n [virtualScrollItemSize]=\"virtualScrollItemSize()\"\r\n [scrollHeight]=\"scrollHeight()\"\r\n [filterMode]=\"filterMode()\"\r\n [filterPlaceholder]=\"filterPlaceholder()\"\r\n [styleClass]=\"'mt-tree ' + styleClass()\"\r\n [style]=\"style()\"\r\n [contextMenu]=\"contextMenuItems().length ? cm : null\"\r\n [(contextMenuSelection)]=\"contextMenuSelection\"\r\n contextMenuSelectionMode=\"separate\"\r\n (selectionChange)=\"onSelectionChange($event)\"\r\n (onNodeSelect)=\"onNodeSelect($event)\"\r\n (onNodeUnselect)=\"onNodeUnselect($event)\"\r\n (onNodeExpand)=\"onNodeExpand($event)\"\r\n (onNodeCollapse)=\"onNodeCollapse($event)\"\r\n (onNodeContextMenuSelect)=\"onContextMenuSelect($event.node)\"\r\n>\r\n <ng-template let-node pTemplate=\"default\">\r\n <div\r\n (click)=\"selectionMode() === 'checkbox' ? $event.stopPropagation() : null\"\r\n class=\"mt-tree-node border-1 border-gray-300 cursor-default rounded-lg flex items-center hover:bg-surface-100 justify-between\"\r\n [class]=\"node?.key.includes('check-all') ? 'bg-surface-100 ' : ''\"\r\n >\r\n <div\r\n class=\"px-3 flex items-center justify-between flex-1\"\r\n [class.cursor-pointer]=\"\r\n selectionMode() === 'single' || selectionMode() === 'multiple'\r\n \"\r\n >\r\n <div class=\"flex items-center\">\r\n @if (node.children && node.children.length > 0) {\r\n <div class=\"py-3\" (click)=\"toggleNodeExpanded(node, $event)\">\r\n <mt-icon\r\n class=\"text-2xl cursor-pointer\"\r\n [icon]=\"\r\n node.expanded\r\n ? 'arrow.chevron-down'\r\n : dir?.value === 'rtl'\r\n ? 'arrow.chevron-left'\r\n : 'arrow.chevron-right'\r\n \"\r\n />\r\n </div>\r\n }\r\n @if (node.icon || nodeIcon()) {\r\n <mt-avatar\r\n class=\"ms-2\"\r\n [icon]=\"node.icon || nodeIcon()\"\r\n shape=\"square\"\r\n size=\"small\"\r\n style=\"\r\n --p-avatar-background: var(--p-primary-50);\r\n --p-avatar-color: var(--p-primary-color);\r\n \"\r\n [style]=\"\r\n node?.key.includes('check-all')\r\n ? ' --p-avatar-background: var(--p-primary-color); --p-avatar-color: white'\r\n : ''\r\n \"\r\n >\r\n </mt-avatar>\r\n }\r\n <div class=\"text-md mx-3 py-4\">{{ node.label }}</div>\r\n </div>\r\n <div class=\"flex items-center gap-2\">\r\n @if (nodeActions().length > 0) {\r\n <div class=\"flex items-center\">\r\n @for (action of nodeActions(); track action.icon) {\r\n @let hidden = action.hidden?.(node);\r\n @if (!hidden) {\r\n <mt-button\r\n [variant]=\"action.variant\"\r\n [icon]=\"action.icon\"\r\n [severity]=\"action.severity\"\r\n [size]=\"action.size\"\r\n [label]=\"action.label\"\r\n [tooltip]=\"action.tooltip\"\r\n [loading]=\"resolveActionLoading(action, node)\"\r\n (click)=\"nodeAction(action, node)\"\r\n >\r\n </mt-button>\r\n }\r\n }\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n @if (selectionMode() === \"checkbox\") {\r\n <div\r\n class=\"me-3\"\r\n [class.cursor-pointer]=\"node.selectable !== false\"\r\n (click)=\"toggleNodeSelection(node, $event)\"\r\n >\r\n <mt-toggle-field\r\n (ngModelChange)=\"getCheckAllValue($event)\"\r\n [ngModel]=\"node.checked\"\r\n [disabled]=\"node.selectable === false\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </ng-template>\r\n</p-tree>\r\n\r\n<p-contextMenu #cm [model]=\"contextMenuItems()\" appendTo=\"body\">\r\n <ng-template pTemplate=\"item\" let-item>\r\n <div class=\"p-menu-item-content\" (click)=\"item.command()\">\r\n <a class=\"p-menu-item-link flex items-center gap-2\">\r\n @if (item.icon) {\r\n <mt-icon [icon]=\"item.icon\" class=\"text-lg\" />\r\n }\r\n <span class=\"p-menu-item-label\">{{ item.label }}</span>\r\n </a>\r\n </div>\r\n </ng-template>\r\n</p-contextMenu>\r\n" }]
|
|
253
|
+
}], ctorParameters: () => [], propDecorators: { primeTree: [{ type: i0.ViewChild, args: ['primeTree', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], nodeIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeIcon", required: false }] }], propagateSelectionUp: [{ type: i0.Input, args: [{ isSignal: true, alias: "propagateSelectionUp", required: false }] }], propagateSelectionDown: [{ type: i0.Input, args: [{ isSignal: true, alias: "propagateSelectionDown", required: false }] }], checkAllChildren: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkAllChildren", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], checkAllLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkAllLabel", required: false }] }], filterPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterPlaceholder", required: false }] }], dataKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataKey", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], scrollHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollHeight", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], style: [{ type: i0.Input, args: [{ isSignal: true, alias: "style", required: false }] }], pInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "pInputs", required: false }] }], nodeActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeActions", required: false }] }], nodeContextmenuActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodeContextmenuActions", required: false }] }], contextMenuSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "contextMenuSelection", required: false }] }, { type: i0.Output, args: ["contextMenuSelectionChange"] }], action: [{ type: i0.Output, args: ["action"] }] } });
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Generated bundle index. Do not edit.
|
|
257
|
+
*/
|
|
258
|
+
|
|
259
|
+
export { Tree };
|
|
260
|
+
//# sourceMappingURL=masterteam-components-tree.mjs.map
|