@masterteam/components 0.0.129 → 0.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/masterteam-components-tooltip.mjs.map +1 -1
- package/package.json +1 -1
- package/fesm2022/masterteam-components-business-fields.mjs +0 -597
- package/fesm2022/masterteam-components-business-fields.mjs.map +0 -1
- package/fesm2022/masterteam-components-button-group.mjs +0 -20
- package/fesm2022/masterteam-components-button-group.mjs.map +0 -1
- package/fesm2022/masterteam-components-chip.mjs +0 -35
- package/fesm2022/masterteam-components-chip.mjs.map +0 -1
- package/fesm2022/masterteam-components-client-page-menu.mjs +0 -92
- package/fesm2022/masterteam-components-client-page-menu.mjs.map +0 -1
- package/fesm2022/masterteam-components-client-page.mjs +0 -160
- package/fesm2022/masterteam-components-client-page.mjs.map +0 -1
- package/fesm2022/masterteam-components-color-picker-field.mjs +0 -94
- package/fesm2022/masterteam-components-color-picker-field.mjs.map +0 -1
- package/fesm2022/masterteam-components-date-field.mjs +0 -93
- package/fesm2022/masterteam-components-date-field.mjs.map +0 -1
- package/fesm2022/masterteam-components-drawer.mjs +0 -69
- package/fesm2022/masterteam-components-drawer.mjs.map +0 -1
- package/fesm2022/masterteam-components-editor-field.mjs +0 -96
- package/fesm2022/masterteam-components-editor-field.mjs.map +0 -1
- package/fesm2022/masterteam-components-entities.mjs +0 -864
- package/fesm2022/masterteam-components-entities.mjs.map +0 -1
- package/fesm2022/masterteam-components-formula.mjs +0 -3116
- package/fesm2022/masterteam-components-formula.mjs.map +0 -1
- package/fesm2022/masterteam-components-list.mjs +0 -31
- package/fesm2022/masterteam-components-list.mjs.map +0 -1
- package/fesm2022/masterteam-components-progress.mjs +0 -49
- package/fesm2022/masterteam-components-progress.mjs.map +0 -1
- package/fesm2022/masterteam-components-table.mjs +0 -1153
- package/fesm2022/masterteam-components-table.mjs.map +0 -1
- package/fesm2022/masterteam-components-upload-field.mjs +0 -554
- package/fesm2022/masterteam-components-upload-field.mjs.map +0 -1
- package/fesm2022/masterteam-components-user-search-field.mjs +0 -153
- package/fesm2022/masterteam-components-user-search-field.mjs.map +0 -1
- package/types/masterteam-components-business-fields.d.ts +0 -213
- package/types/masterteam-components-button-group.d.ts +0 -8
- package/types/masterteam-components-chip.d.ts +0 -19
- package/types/masterteam-components-client-page-menu.d.ts +0 -35
- package/types/masterteam-components-client-page.d.ts +0 -56
- package/types/masterteam-components-color-picker-field.d.ts +0 -35
- package/types/masterteam-components-date-field.d.ts +0 -41
- package/types/masterteam-components-drawer.d.ts +0 -30
- package/types/masterteam-components-editor-field.d.ts +0 -34
- package/types/masterteam-components-entities.d.ts +0 -367
- package/types/masterteam-components-formula.d.ts +0 -654
- package/types/masterteam-components-list.d.ts +0 -18
- package/types/masterteam-components-progress.d.ts +0 -22
- package/types/masterteam-components-table.d.ts +0 -255
- package/types/masterteam-components-upload-field.d.ts +0 -77
- package/types/masterteam-components-user-search-field.d.ts +0 -61
|
@@ -1,597 +0,0 @@
|
|
|
1
|
-
import * as i1 from '@angular/common';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { input, inject, DestroyRef, signal, computed, ChangeDetectionStrategy, Component, effect, untracked, viewChild, linkedSignal } from '@angular/core';
|
|
5
|
-
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
-
import * as i1$1 from '@angular/forms';
|
|
7
|
-
import { ControlContainer, Validators, NgControl, FormsModule } from '@angular/forms';
|
|
8
|
-
import { startWith, finalize, catchError, of } from 'rxjs';
|
|
9
|
-
import { Tooltip } from '@masterteam/components/tooltip';
|
|
10
|
-
import { Icon } from '@masterteam/icons';
|
|
11
|
-
import { SelectField } from '@masterteam/components/select-field';
|
|
12
|
-
import { MultiSelectField } from '@masterteam/components/multi-select-field';
|
|
13
|
-
import { FieldValidation } from '@masterteam/components/field-validation';
|
|
14
|
-
import { HttpClient } from '@angular/common/http';
|
|
15
|
-
import * as i2 from '@jsverse/transloco';
|
|
16
|
-
import { TranslocoService, TranslocoModule } from '@jsverse/transloco';
|
|
17
|
-
import { Button } from '@masterteam/components/button';
|
|
18
|
-
import { NumberField } from '@masterteam/components/number-field';
|
|
19
|
-
import { Table } from '@masterteam/components/table';
|
|
20
|
-
|
|
21
|
-
class LookupMatrixField {
|
|
22
|
-
config = input.required(...(ngDevMode ? [{ debugName: "config" }] : []));
|
|
23
|
-
controlContainer = inject(ControlContainer, {
|
|
24
|
-
optional: true,
|
|
25
|
-
});
|
|
26
|
-
destroyRef = inject(DestroyRef);
|
|
27
|
-
valueVersion = signal(0, ...(ngDevMode ? [{ debugName: "valueVersion" }] : []));
|
|
28
|
-
xOptions = computed(() => this.config().xOptions ?? [], ...(ngDevMode ? [{ debugName: "xOptions" }] : []));
|
|
29
|
-
yOptions = computed(() => this.config().yOptions ?? [], ...(ngDevMode ? [{ debugName: "yOptions" }] : []));
|
|
30
|
-
hasMatrix = computed(() => this.config().cells.length > 0, ...(ngDevMode ? [{ debugName: "hasMatrix" }] : []));
|
|
31
|
-
cellMap = computed(() => new Map(this.config().cells.map((cell) => [
|
|
32
|
-
this.cellKey(cell.xLookupItemId, cell.yLookupItemId),
|
|
33
|
-
cell,
|
|
34
|
-
])), ...(ngDevMode ? [{ debugName: "cellMap" }] : []));
|
|
35
|
-
selectedXOption = computed(() => {
|
|
36
|
-
this.valueVersion();
|
|
37
|
-
return this.resolveSelectedOption(this.xOptions(), this.getControlValue(this.config().xFieldKey));
|
|
38
|
-
}, ...(ngDevMode ? [{ debugName: "selectedXOption" }] : []));
|
|
39
|
-
selectedYOption = computed(() => {
|
|
40
|
-
this.valueVersion();
|
|
41
|
-
return this.resolveSelectedOption(this.yOptions(), this.getControlValue(this.config().yFieldKey));
|
|
42
|
-
}, ...(ngDevMode ? [{ debugName: "selectedYOption" }] : []));
|
|
43
|
-
activeCell = computed(() => {
|
|
44
|
-
const selectedX = this.selectedXOption();
|
|
45
|
-
const selectedY = this.selectedYOption();
|
|
46
|
-
if (!selectedX || !selectedY) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return this.getCell(selectedX.id ?? selectedX.value, selectedY.id ?? selectedY.value);
|
|
50
|
-
}, ...(ngDevMode ? [{ debugName: "activeCell" }] : []));
|
|
51
|
-
selectionSummary = computed(() => {
|
|
52
|
-
const parts = [];
|
|
53
|
-
const xAxisLabel = this.config().xAxisLabel.trim() || 'X';
|
|
54
|
-
const yAxisLabel = this.config().yAxisLabel.trim() || 'Y';
|
|
55
|
-
const selectedX = this.selectedXOption();
|
|
56
|
-
const selectedY = this.selectedYOption();
|
|
57
|
-
if (selectedX) {
|
|
58
|
-
parts.push(`${xAxisLabel}: ${selectedX.label}`);
|
|
59
|
-
}
|
|
60
|
-
if (selectedY) {
|
|
61
|
-
parts.push(`${yAxisLabel}: ${selectedY.label}`);
|
|
62
|
-
}
|
|
63
|
-
return parts.join(' / ');
|
|
64
|
-
}, ...(ngDevMode ? [{ debugName: "selectionSummary" }] : []));
|
|
65
|
-
pendingMessage = computed(() => {
|
|
66
|
-
const xAxisLabel = this.config().xAxisLabel.trim() || 'the first value';
|
|
67
|
-
const yAxisLabel = this.config().yAxisLabel.trim() || 'the second value';
|
|
68
|
-
return `Select ${xAxisLabel} and ${yAxisLabel} first.`;
|
|
69
|
-
}, ...(ngDevMode ? [{ debugName: "pendingMessage" }] : []));
|
|
70
|
-
missingResultMessage = computed(() => {
|
|
71
|
-
if (!this.selectedXOption() || !this.selectedYOption()) {
|
|
72
|
-
return this.pendingMessage();
|
|
73
|
-
}
|
|
74
|
-
return 'No matching value for the selected combination.';
|
|
75
|
-
}, ...(ngDevMode ? [{ debugName: "missingResultMessage" }] : []));
|
|
76
|
-
constructor() {
|
|
77
|
-
const control = this.controlContainer?.control;
|
|
78
|
-
if (!control)
|
|
79
|
-
return;
|
|
80
|
-
control.valueChanges
|
|
81
|
-
.pipe(startWith(control.getRawValue()), takeUntilDestroyed(this.destroyRef))
|
|
82
|
-
.subscribe(() => {
|
|
83
|
-
this.valueVersion.update((value) => value + 1);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
getCell(xLookupItemId, yLookupItemId) {
|
|
87
|
-
return (this.cellMap().get(this.cellKey(xLookupItemId, yLookupItemId)) ?? null);
|
|
88
|
-
}
|
|
89
|
-
getSwatchStyle(color) {
|
|
90
|
-
const resolvedColor = this.resolveColor(color);
|
|
91
|
-
if (!resolvedColor)
|
|
92
|
-
return {};
|
|
93
|
-
return {
|
|
94
|
-
backgroundColor: resolvedColor,
|
|
95
|
-
borderColor: resolvedColor,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
getControlValue(path) {
|
|
99
|
-
if (!path)
|
|
100
|
-
return null;
|
|
101
|
-
return this.controlContainer?.control?.get(path)?.value ?? null;
|
|
102
|
-
}
|
|
103
|
-
resolveSelectedOption(options, rawValue) {
|
|
104
|
-
if (rawValue == null || rawValue === '')
|
|
105
|
-
return null;
|
|
106
|
-
return (options.find((option) => this.optionMatchesValue(option, rawValue)) ??
|
|
107
|
-
null);
|
|
108
|
-
}
|
|
109
|
-
optionMatchesValue(option, rawValue) {
|
|
110
|
-
return [option.value, option.key, option.id].some((candidate) => candidate != null && String(candidate) === String(rawValue));
|
|
111
|
-
}
|
|
112
|
-
cellKey(xLookupItemId, yLookupItemId) {
|
|
113
|
-
return `${String(xLookupItemId)}::${String(yLookupItemId)}`;
|
|
114
|
-
}
|
|
115
|
-
resolveColor(color) {
|
|
116
|
-
if (!color)
|
|
117
|
-
return null;
|
|
118
|
-
if (color.startsWith('#') ||
|
|
119
|
-
color.startsWith('rgb') ||
|
|
120
|
-
color.startsWith('hsl') ||
|
|
121
|
-
color.startsWith('var(')) {
|
|
122
|
-
return color;
|
|
123
|
-
}
|
|
124
|
-
return `var(--p-${color}-500)`;
|
|
125
|
-
}
|
|
126
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: LookupMatrixField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
127
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: LookupMatrixField, isStandalone: true, selector: "mt-lookup-matrix-field", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "grid gap-2" }, ngImport: i0, template: "@if (config().label) {\r\n <label class=\"text-sm font-medium text-color\">\r\n {{ config().label }}\r\n </label>\r\n}\r\n\r\n<div\r\n class=\"rounded-lg border border-surface-200 bg-surface-50 px-3 flex items-center\"\r\n>\r\n @if (activeCell(); as cell) {\r\n <div class=\"flex flex-1 min-h-6 items-center gap-2 justify-between\">\r\n <span\r\n class=\"h-6 w-2 shrink-0 rounded-[2px] border border-surface-200\"\r\n [ngStyle]=\"getSwatchStyle(cell.color)\"\r\n ></span>\r\n\r\n <div class=\"min-w-0 flex-1 py-2 flex items-center justify-between\">\r\n <div class=\"truncate font-semibold text-gray-500\">\r\n {{ cell.label }}\r\n </div>\r\n\r\n @if (selectionSummary()) {\r\n <div class=\"font-bold text-gray-500\">\r\n <mt-icon\r\n [mtTooltip]=\"selectionSummary()\"\r\n icon=\"general.info-circle\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n } @else {\r\n <div class=\"flex min-h-6 items-center text-muted-color py-2\">\r\n {{ hasMatrix() ? missingResultMessage() : config().emptyMessage }}\r\n </div>\r\n }\r\n</div>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: Tooltip, selector: "[mtTooltip]" }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
128
|
-
}
|
|
129
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: LookupMatrixField, decorators: [{
|
|
130
|
-
type: Component,
|
|
131
|
-
args: [{ selector: 'mt-lookup-matrix-field', standalone: true, imports: [CommonModule, Tooltip, Icon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
132
|
-
class: 'grid gap-2',
|
|
133
|
-
}, template: "@if (config().label) {\r\n <label class=\"text-sm font-medium text-color\">\r\n {{ config().label }}\r\n </label>\r\n}\r\n\r\n<div\r\n class=\"rounded-lg border border-surface-200 bg-surface-50 px-3 flex items-center\"\r\n>\r\n @if (activeCell(); as cell) {\r\n <div class=\"flex flex-1 min-h-6 items-center gap-2 justify-between\">\r\n <span\r\n class=\"h-6 w-2 shrink-0 rounded-[2px] border border-surface-200\"\r\n [ngStyle]=\"getSwatchStyle(cell.color)\"\r\n ></span>\r\n\r\n <div class=\"min-w-0 flex-1 py-2 flex items-center justify-between\">\r\n <div class=\"truncate font-semibold text-gray-500\">\r\n {{ cell.label }}\r\n </div>\r\n\r\n @if (selectionSummary()) {\r\n <div class=\"font-bold text-gray-500\">\r\n <mt-icon\r\n [mtTooltip]=\"selectionSummary()\"\r\n icon=\"general.info-circle\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n </div>\r\n } @else {\r\n <div class=\"flex min-h-6 items-center text-muted-color py-2\">\r\n {{ hasMatrix() ? missingResultMessage() : config().emptyMessage }}\r\n </div>\r\n }\r\n</div>\r\n" }]
|
|
134
|
-
}], ctorParameters: () => [], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }] } });
|
|
135
|
-
|
|
136
|
-
class SchemaConnectionField {
|
|
137
|
-
// ============================================================================
|
|
138
|
-
// Inputs
|
|
139
|
-
// ============================================================================
|
|
140
|
-
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
141
|
-
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
142
|
-
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
143
|
-
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
144
|
-
filter = input(true, ...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
145
|
-
/**
|
|
146
|
-
* Full connection configuration object from the API.
|
|
147
|
-
* Includes `targetLevelId`, `sourceLevels[]`, `payloadTemplate`, etc.
|
|
148
|
-
*/
|
|
149
|
-
configuration = input.required(...(ngDevMode ? [{ debugName: "configuration" }] : []));
|
|
150
|
-
/**
|
|
151
|
-
* Optional HttpContext for API requests (e.g. to set base URL behavior).
|
|
152
|
-
*/
|
|
153
|
-
context = input(undefined, ...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
154
|
-
// ============================================================================
|
|
155
|
-
// Internal State
|
|
156
|
-
// ============================================================================
|
|
157
|
-
/** The full ConnectionPayload value */
|
|
158
|
-
value = signal(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
|
|
159
|
-
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
160
|
-
/** Per-source-level state: options + loading */
|
|
161
|
-
sourceLevelStates = signal([], ...(ngDevMode ? [{ debugName: "sourceLevelStates" }] : []));
|
|
162
|
-
/** Mutable selections per source level: sourceLevelId -> selected value */
|
|
163
|
-
selections = {};
|
|
164
|
-
requiredValidator = Validators.required;
|
|
165
|
-
onTouched = () => { };
|
|
166
|
-
onModelChange = () => { };
|
|
167
|
-
ngControl = null;
|
|
168
|
-
http = inject(HttpClient);
|
|
169
|
-
destroyRef = inject(DestroyRef);
|
|
170
|
-
/**
|
|
171
|
-
* Source levels from configuration.
|
|
172
|
-
*/
|
|
173
|
-
sourceLevels = computed(() => {
|
|
174
|
-
return this.configuration()?.sourceLevels ?? [];
|
|
175
|
-
}, ...(ngDevMode ? [{ debugName: "sourceLevels" }] : []));
|
|
176
|
-
/**
|
|
177
|
-
* Percentage width for each dropdown, evenly divided.
|
|
178
|
-
*/
|
|
179
|
-
dropdownWidth = computed(() => {
|
|
180
|
-
const count = this.sourceLevels().length;
|
|
181
|
-
if (count <= 0)
|
|
182
|
-
return '100%';
|
|
183
|
-
return `${100 / count}%`;
|
|
184
|
-
}, ...(ngDevMode ? [{ debugName: "dropdownWidth" }] : []));
|
|
185
|
-
constructor() {
|
|
186
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
187
|
-
if (this.ngControl) {
|
|
188
|
-
this.ngControl.valueAccessor = this;
|
|
189
|
-
}
|
|
190
|
-
effect(() => {
|
|
191
|
-
if (this.ngControl?.control && this.required()) {
|
|
192
|
-
this.ngControl.control.addValidators(Validators.required);
|
|
193
|
-
this.ngControl.control.updateValueAndValidity();
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
// Load options for each source level when configuration changes
|
|
197
|
-
effect(() => {
|
|
198
|
-
const levels = this.sourceLevels();
|
|
199
|
-
if (!levels.length)
|
|
200
|
-
return;
|
|
201
|
-
// Everything below must NOT create signal dependencies,
|
|
202
|
-
// only sourceLevels() (→ configuration) should trigger this effect.
|
|
203
|
-
untracked(() => {
|
|
204
|
-
// Initialize per-source states + selections
|
|
205
|
-
this.sourceLevelStates.set(levels.map((source) => ({
|
|
206
|
-
source,
|
|
207
|
-
options: [],
|
|
208
|
-
loading: false,
|
|
209
|
-
})));
|
|
210
|
-
for (const source of levels) {
|
|
211
|
-
if (!(source.levelId in this.selections)) {
|
|
212
|
-
this.selections[source.levelId] = source.allowManyToMany
|
|
213
|
-
? []
|
|
214
|
-
: null;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
// Distribute existing value to selections
|
|
218
|
-
this.distributeToSelections(this.value());
|
|
219
|
-
// Load options for each source level
|
|
220
|
-
for (const source of levels) {
|
|
221
|
-
this.loadOptions(source);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
// ============================================================================
|
|
227
|
-
// Option Loading (per source level)
|
|
228
|
-
// ============================================================================
|
|
229
|
-
loadOptions(source) {
|
|
230
|
-
this.updateSourceState(source.levelId, { loading: true });
|
|
231
|
-
const ctx = this.context();
|
|
232
|
-
const payload = {
|
|
233
|
-
contextKey: `level:${source.levelId}`,
|
|
234
|
-
projection: 'Flat',
|
|
235
|
-
propertyKeys: ['name'],
|
|
236
|
-
};
|
|
237
|
-
this.http
|
|
238
|
-
.post('fetch/query', payload, {
|
|
239
|
-
...(ctx ? { context: ctx } : {}),
|
|
240
|
-
})
|
|
241
|
-
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.updateSourceState(source.levelId, { loading: false })), catchError((err) => {
|
|
242
|
-
console.error(`Connection options load failed for ${source.levelKey}:`, err);
|
|
243
|
-
return of({ data: { records: [] } });
|
|
244
|
-
}))
|
|
245
|
-
.subscribe((response) => {
|
|
246
|
-
const options = (response?.data?.records ?? [])
|
|
247
|
-
.filter((record) => record?.id != null)
|
|
248
|
-
.map((record) => ({
|
|
249
|
-
...record,
|
|
250
|
-
id: record.id,
|
|
251
|
-
name: record.name,
|
|
252
|
-
}));
|
|
253
|
-
this.updateSourceState(source.levelId, {
|
|
254
|
-
options,
|
|
255
|
-
loading: false,
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
updateSourceState(levelId, patch) {
|
|
260
|
-
this.sourceLevelStates.update((states) => states.map((s) => s.source.levelId === levelId ? { ...s, ...patch } : s));
|
|
261
|
-
}
|
|
262
|
-
// ============================================================================
|
|
263
|
-
// Value Handling
|
|
264
|
-
// ============================================================================
|
|
265
|
-
/**
|
|
266
|
-
* Single handler — no params. Reads all selections, builds the combined payload.
|
|
267
|
-
*/
|
|
268
|
-
syncValue() {
|
|
269
|
-
const cfg = this.configuration();
|
|
270
|
-
const states = this.sourceLevelStates();
|
|
271
|
-
const sources = [];
|
|
272
|
-
for (const state of states) {
|
|
273
|
-
const val = this.selections[state.source.levelId];
|
|
274
|
-
if (val == null)
|
|
275
|
-
continue;
|
|
276
|
-
if (state.source.allowManyToMany && Array.isArray(val)) {
|
|
277
|
-
for (const id of val) {
|
|
278
|
-
sources.push({
|
|
279
|
-
sourceLevelId: state.source.levelId,
|
|
280
|
-
sourceLevelDataId: id,
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
else if (typeof val === 'number') {
|
|
285
|
-
sources.push({
|
|
286
|
-
sourceLevelId: state.source.levelId,
|
|
287
|
-
sourceLevelDataId: val,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
const payload = sources.length > 0 ? { levelId: cfg.targetLevelId, sources } : null;
|
|
292
|
-
this.value.set(payload);
|
|
293
|
-
this.onModelChange(payload);
|
|
294
|
-
this.onTouched();
|
|
295
|
-
}
|
|
296
|
-
distributeToSelections(payload) {
|
|
297
|
-
const states = this.sourceLevelStates();
|
|
298
|
-
for (const state of states) {
|
|
299
|
-
const ids = (payload?.sources ?? [])
|
|
300
|
-
.filter((s) => s.sourceLevelId === state.source.levelId)
|
|
301
|
-
.map((s) => s.sourceLevelDataId);
|
|
302
|
-
this.selections[state.source.levelId] = state.source.allowManyToMany
|
|
303
|
-
? ids
|
|
304
|
-
: (ids[0] ?? null);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
// ============================================================================
|
|
308
|
-
// ControlValueAccessor
|
|
309
|
-
// ============================================================================
|
|
310
|
-
writeValue(value) {
|
|
311
|
-
if (typeof value === 'string') {
|
|
312
|
-
try {
|
|
313
|
-
value = JSON.parse(value);
|
|
314
|
-
}
|
|
315
|
-
catch {
|
|
316
|
-
value = null;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
this.value.set(value ?? null);
|
|
320
|
-
this.distributeToSelections(value ?? null);
|
|
321
|
-
}
|
|
322
|
-
registerOnChange(fn) {
|
|
323
|
-
this.onModelChange = fn;
|
|
324
|
-
}
|
|
325
|
-
registerOnTouched(fn) {
|
|
326
|
-
this.onTouched = fn;
|
|
327
|
-
}
|
|
328
|
-
setDisabledState(disabled) {
|
|
329
|
-
this.disabled.set(disabled);
|
|
330
|
-
}
|
|
331
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: SchemaConnectionField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
332
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: SchemaConnectionField, isStandalone: true, selector: "mt-schema-connection-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: true, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "<!-- @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n} -->\r\n\r\n<div class=\"flex gap-4 w-full\">\r\n @for (state of sourceLevelStates(); track state.source.levelId) {\r\n <div [style.width]=\"dropdownWidth()\" class=\"min-w-0\">\r\n @if (sourceLevelStates().length > 1) {\r\n <span class=\"text-sm text-muted-color mb-1 block truncate\">\r\n {{ state.source.name?.en || state.source.levelKey }}\r\n </span>\r\n }\r\n\r\n @if (state.source.allowManyToMany) {\r\n <mt-multi-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[state.source.levelId]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [showClear]=\"true\"\r\n display=\"chip\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[state.source.levelId]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [loading]=\"state.loading\"\r\n [showClear]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n</div>\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$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: MultiSelectField, selector: "mt-multi-select-field", inputs: ["field", "label", "placeholder", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "display", "required", "maxSelectedLabels", "group", "optionGroupLabel", "optionGroupChildren", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
333
|
-
}
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: SchemaConnectionField, decorators: [{
|
|
335
|
-
type: Component,
|
|
336
|
-
args: [{ selector: 'mt-schema-connection-field', standalone: true, imports: [FormsModule, SelectField, MultiSelectField, FieldValidation], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
337
|
-
class: 'grid gap-1',
|
|
338
|
-
}, template: "<!-- @if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n} -->\r\n\r\n<div class=\"flex gap-4 w-full\">\r\n @for (state of sourceLevelStates(); track state.source.levelId) {\r\n <div [style.width]=\"dropdownWidth()\" class=\"min-w-0\">\r\n @if (sourceLevelStates().length > 1) {\r\n <span class=\"text-sm text-muted-color mb-1 block truncate\">\r\n {{ state.source.name?.en || state.source.levelKey }}\r\n </span>\r\n }\r\n\r\n @if (state.source.allowManyToMany) {\r\n <mt-multi-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[state.source.levelId]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [showClear]=\"true\"\r\n display=\"chip\"\r\n />\r\n } @else {\r\n <mt-select-field\r\n [field]=\"false\"\r\n [(ngModel)]=\"selections[state.source.levelId]\"\r\n (ngModelChange)=\"syncValue()\"\r\n [options]=\"state.options\"\r\n optionLabel=\"name\"\r\n optionValue=\"id\"\r\n [placeholder]=\"placeholder() || state.source.name?.en || 'Select...'\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [filter]=\"filter()\"\r\n [loading]=\"state.loading\"\r\n [showClear]=\"true\"\r\n />\r\n }\r\n </div>\r\n }\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n" }]
|
|
339
|
-
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: true }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
340
|
-
|
|
341
|
-
const PREDECESSOR_TYPE_BY_TOKEN = {
|
|
342
|
-
FS: 0,
|
|
343
|
-
SS: 1,
|
|
344
|
-
FF: 2,
|
|
345
|
-
SF: 3,
|
|
346
|
-
};
|
|
347
|
-
const PREDECESSOR_TOKEN_BY_TYPE = {
|
|
348
|
-
0: 'FS',
|
|
349
|
-
1: 'SS',
|
|
350
|
-
2: 'FF',
|
|
351
|
-
3: 'SF',
|
|
352
|
-
};
|
|
353
|
-
class SchedulePredecessorField {
|
|
354
|
-
predecessorCellTpl = viewChild.required('predecessorCellTpl');
|
|
355
|
-
typeCellTpl = viewChild.required('typeCellTpl');
|
|
356
|
-
lagCellTpl = viewChild.required('lagCellTpl');
|
|
357
|
-
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
358
|
-
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
359
|
-
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
360
|
-
required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : []));
|
|
361
|
-
configuration = input(null, ...(ngDevMode ? [{ debugName: "configuration" }] : []));
|
|
362
|
-
runtimeContext = input(null, ...(ngDevMode ? [{ debugName: "runtimeContext" }] : []));
|
|
363
|
-
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
|
|
364
|
-
taskOptions = signal([], ...(ngDevMode ? [{ debugName: "taskOptions" }] : []));
|
|
365
|
-
rows = signal([], ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
366
|
-
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
367
|
-
typeOptions = computed(() => [
|
|
368
|
-
{ label: 'FS', value: 0 },
|
|
369
|
-
{ label: 'SS', value: 1 },
|
|
370
|
-
{ label: 'FF', value: 2 },
|
|
371
|
-
{ label: 'SF', value: 3 },
|
|
372
|
-
], ...(ngDevMode ? [{ debugName: "typeOptions" }] : []));
|
|
373
|
-
availableTaskOptions = computed(() => {
|
|
374
|
-
const currentTaskId = this.runtimeContext()?.moduleDataId;
|
|
375
|
-
return this.taskOptions().filter((item) => String(item.value) !== String(currentTaskId ?? ''));
|
|
376
|
-
}, ...(ngDevMode ? [{ debugName: "availableTaskOptions" }] : []));
|
|
377
|
-
canAddRow = computed(() => !!this.runtimeContext()?.levelId &&
|
|
378
|
-
!!this.runtimeContext()?.levelDataId &&
|
|
379
|
-
this.availableTaskOptions().length > 0, ...(ngDevMode ? [{ debugName: "canAddRow" }] : []));
|
|
380
|
-
addTooltip = computed(() => this.canAddRow() ? undefined : this.texts().noAvailable, ...(ngDevMode ? [{ debugName: "addTooltip" }] : []));
|
|
381
|
-
pageSize = computed(() => this.rows().length > 0 ? this.rows().length : 1, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
|
|
382
|
-
columns = linkedSignal(() => [
|
|
383
|
-
{
|
|
384
|
-
key: 'predecessorId',
|
|
385
|
-
label: this.texts().predecessor,
|
|
386
|
-
type: 'custom',
|
|
387
|
-
customCellTpl: this.predecessorCellTpl(),
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
key: 'type',
|
|
391
|
-
label: this.texts().type,
|
|
392
|
-
type: 'custom',
|
|
393
|
-
customCellTpl: this.typeCellTpl(),
|
|
394
|
-
},
|
|
395
|
-
{
|
|
396
|
-
key: 'lagDays',
|
|
397
|
-
label: this.texts().lagDays,
|
|
398
|
-
type: 'custom',
|
|
399
|
-
customCellTpl: this.lagCellTpl(),
|
|
400
|
-
},
|
|
401
|
-
], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
402
|
-
rowActions = computed(() => [
|
|
403
|
-
{
|
|
404
|
-
icon: 'general.trash-01',
|
|
405
|
-
color: 'danger',
|
|
406
|
-
variant: 'text',
|
|
407
|
-
tooltip: this.texts().delete,
|
|
408
|
-
hidden: () => this.disabled() || this.readonly(),
|
|
409
|
-
action: (row) => this.removeRow(row.key),
|
|
410
|
-
},
|
|
411
|
-
], ...(ngDevMode ? [{ debugName: "rowActions" }] : []));
|
|
412
|
-
requiredValidator = Validators.required;
|
|
413
|
-
onTouched = () => { };
|
|
414
|
-
onModelChange = () => { };
|
|
415
|
-
ngControl = null;
|
|
416
|
-
http = inject(HttpClient);
|
|
417
|
-
transloco = inject(TranslocoService);
|
|
418
|
-
destroyRef = inject(DestroyRef);
|
|
419
|
-
activeLang = toSignal(this.transloco.langChanges$, {
|
|
420
|
-
initialValue: this.transloco.getActiveLang(),
|
|
421
|
-
});
|
|
422
|
-
rowKey = 0;
|
|
423
|
-
texts = computed(() => {
|
|
424
|
-
this.activeLang();
|
|
425
|
-
return {
|
|
426
|
-
noAvailable: this.transloco.translate('components.schedulePredecessorField.noAvailable'),
|
|
427
|
-
predecessor: this.transloco.translate('components.schedulePredecessorField.predecessor'),
|
|
428
|
-
type: this.transloco.translate('components.schedulePredecessorField.type'),
|
|
429
|
-
lagDays: this.transloco.translate('components.schedulePredecessorField.lagDays'),
|
|
430
|
-
delete: this.transloco.translate('components.schedulePredecessorField.delete'),
|
|
431
|
-
};
|
|
432
|
-
}, ...(ngDevMode ? [{ debugName: "texts" }] : []));
|
|
433
|
-
constructor() {
|
|
434
|
-
this.ngControl = inject(NgControl, { self: true, optional: true });
|
|
435
|
-
if (this.ngControl) {
|
|
436
|
-
this.ngControl.valueAccessor = this;
|
|
437
|
-
}
|
|
438
|
-
effect(() => {
|
|
439
|
-
if (this.ngControl?.control && this.required()) {
|
|
440
|
-
this.ngControl.control.addValidators(Validators.required);
|
|
441
|
-
this.ngControl.control.updateValueAndValidity();
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
effect(() => {
|
|
445
|
-
const context = this.runtimeContext();
|
|
446
|
-
const levelId = context?.levelId;
|
|
447
|
-
const levelDataId = context?.levelDataId;
|
|
448
|
-
if (levelId == null || levelDataId == null) {
|
|
449
|
-
this.taskOptions.set([]);
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
untracked(() => this.loadTaskOptions(levelId, levelDataId));
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
addRow() {
|
|
456
|
-
if (this.disabled() || this.readonly() || !this.canAddRow()) {
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
this.syncRows([
|
|
460
|
-
...this.rows(),
|
|
461
|
-
{
|
|
462
|
-
key: this.nextRowKey(),
|
|
463
|
-
predecessorId: '',
|
|
464
|
-
type: 0,
|
|
465
|
-
lagDays: 0,
|
|
466
|
-
},
|
|
467
|
-
]);
|
|
468
|
-
}
|
|
469
|
-
removeRow(key) {
|
|
470
|
-
if (this.disabled() || this.readonly()) {
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
this.syncRows(this.rows().filter((row) => row.key !== key));
|
|
474
|
-
}
|
|
475
|
-
updateRow(key, patch) {
|
|
476
|
-
if (this.disabled() || this.readonly()) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
this.syncRows(this.rows().map((row) => (row.key === key ? { ...row, ...patch } : row)));
|
|
480
|
-
}
|
|
481
|
-
writeValue(value) {
|
|
482
|
-
const rows = typeof value === 'string'
|
|
483
|
-
? value
|
|
484
|
-
.split(',')
|
|
485
|
-
.map((item) => item.trim())
|
|
486
|
-
.filter(Boolean)
|
|
487
|
-
.map((item) => this.parseCompactValue(item))
|
|
488
|
-
.filter((item) => item != null)
|
|
489
|
-
.map((item) => ({
|
|
490
|
-
key: this.nextRowKey(),
|
|
491
|
-
...item,
|
|
492
|
-
}))
|
|
493
|
-
: [];
|
|
494
|
-
this.rows.set(rows);
|
|
495
|
-
}
|
|
496
|
-
registerOnChange(fn) {
|
|
497
|
-
this.onModelChange = fn;
|
|
498
|
-
}
|
|
499
|
-
registerOnTouched(fn) {
|
|
500
|
-
this.onTouched = fn;
|
|
501
|
-
}
|
|
502
|
-
setDisabledState(disabled) {
|
|
503
|
-
this.disabled.set(disabled);
|
|
504
|
-
}
|
|
505
|
-
syncRows(rows) {
|
|
506
|
-
this.rows.set(rows);
|
|
507
|
-
const value = rows
|
|
508
|
-
.filter((row) => row.predecessorId !== null &&
|
|
509
|
-
row.predecessorId !== undefined &&
|
|
510
|
-
String(row.predecessorId).trim() !== '')
|
|
511
|
-
.map((row) => this.formatCompactValue(row))
|
|
512
|
-
.join(',');
|
|
513
|
-
this.onModelChange(value || null);
|
|
514
|
-
this.onTouched();
|
|
515
|
-
}
|
|
516
|
-
loadTaskOptions(levelId, levelDataId) {
|
|
517
|
-
this.loading.set(true);
|
|
518
|
-
this.http
|
|
519
|
-
.post(`levels/${levelId}/${levelDataId}/schedule/query`, {
|
|
520
|
-
projection: 'Tree',
|
|
521
|
-
propertyKeys: ['name'],
|
|
522
|
-
})
|
|
523
|
-
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)), catchError(() => of({ data: { records: [] } })))
|
|
524
|
-
.subscribe((response) => {
|
|
525
|
-
this.taskOptions.set(this.mapTaskOptions(response.data));
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
mapTaskOptions(data) {
|
|
529
|
-
return this.flattenRecords(this.resolveRootRecords(data?.records ?? [], data?.projectionMeta?.rootIds ?? [])).map((record) => ({
|
|
530
|
-
label: `${record.id} - ${record.name ?? record.id}`,
|
|
531
|
-
value: String(record.id),
|
|
532
|
-
}));
|
|
533
|
-
}
|
|
534
|
-
resolveRootRecords(records, rootIds) {
|
|
535
|
-
if (!rootIds?.length) {
|
|
536
|
-
return records;
|
|
537
|
-
}
|
|
538
|
-
const recordsById = new Map(records.map((record) => [String(record.id), record]));
|
|
539
|
-
return rootIds
|
|
540
|
-
.map((id) => recordsById.get(String(id)))
|
|
541
|
-
.filter((record) => record != null);
|
|
542
|
-
}
|
|
543
|
-
flattenRecords(records) {
|
|
544
|
-
const output = [];
|
|
545
|
-
const walk = (items) => {
|
|
546
|
-
items.forEach((item) => {
|
|
547
|
-
output.push(item);
|
|
548
|
-
walk(item.children ?? []);
|
|
549
|
-
});
|
|
550
|
-
};
|
|
551
|
-
walk(records);
|
|
552
|
-
return output;
|
|
553
|
-
}
|
|
554
|
-
nextRowKey() {
|
|
555
|
-
this.rowKey += 1;
|
|
556
|
-
return `predecessor-${this.rowKey}`;
|
|
557
|
-
}
|
|
558
|
-
parseCompactValue(value) {
|
|
559
|
-
const match = value.match(/^(.+?)(FS|SS|FF|SF)([+-]\d+)?$/);
|
|
560
|
-
if (!match) {
|
|
561
|
-
return null;
|
|
562
|
-
}
|
|
563
|
-
return {
|
|
564
|
-
predecessorId: match[1],
|
|
565
|
-
type: PREDECESSOR_TYPE_BY_TOKEN[match[2]],
|
|
566
|
-
lagDays: match[3] ? Number(match[3]) : 0,
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
formatCompactValue(row) {
|
|
570
|
-
const lag = row.lagDays > 0 ? `+${row.lagDays}` : row.lagDays < 0 ? row.lagDays : '';
|
|
571
|
-
return `${row.predecessorId}${PREDECESSOR_TOKEN_BY_TYPE[row.type]}${lag}`;
|
|
572
|
-
}
|
|
573
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: SchedulePredecessorField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
574
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: SchedulePredecessorField, isStandalone: true, selector: "mt-schedule-predecessor-field", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, configuration: { classPropertyName: "configuration", publicName: "configuration", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, viewQueries: [{ propertyName: "predecessorCellTpl", first: true, predicate: ["predecessorCellTpl"], descendants: true, isSignal: true }, { propertyName: "typeCellTpl", first: true, predicate: ["typeCellTpl"], descendants: true, isSignal: true }, { propertyName: "lagCellTpl", first: true, predicate: ["lagCellTpl"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n<div class=\"grid gap-3\">\r\n <div class=\"flex items-center justify-end\">\r\n <mt-button\r\n icon=\"general.plus\"\r\n [label]=\"'components.schedulePredecessorField.add' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [disabled]=\"disabled() || readonly() || !canAddRow()\"\r\n [tooltip]=\"addTooltip()\"\r\n (onClick)=\"addRow()\"\r\n />\r\n </div>\r\n\r\n <ng-template #predecessorCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"availableTaskOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [placeholder]=\"\r\n placeholder() ||\r\n ('components.schedulePredecessorField.selectPredecessor' | transloco)\r\n \"\r\n [filter]=\"true\"\r\n [showClear]=\"true\"\r\n [loading]=\"loading()\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.predecessorId || undefined\"\r\n (onChange)=\"updateRow(row.key, { predecessorId: $event ?? '' })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #typeCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"typeOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.type\"\r\n (onChange)=\"updateRow(row.key, { type: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #lagCellTpl let-row>\r\n <mt-number-field\r\n [field]=\"false\"\r\n [useGrouping]=\"false\"\r\n [placeholder]=\"'components.schedulePredecessorField.lagDays' | transloco\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.lagDays\"\r\n (ngModelChange)=\"updateRow(row.key, { lagDays: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [pageSize]=\"pageSize()\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [dataKey]=\"'key'\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div\r\n class=\"rounded-xl border border-dashed border-surface px-4 py-5 text-sm text-muted-color\"\r\n >\r\n {{ \"components.schedulePredecessorField.empty\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }, { kind: "component", type: NumberField, selector: "mt-number-field", inputs: ["field", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "label", "placeholder", "hasPlaceholderPrefix", "class", "readonly", "pInputs", "options", "optionValue", "optionLabel", "filter", "filterBy", "dataKey", "showClear", "clearAfterSelect", "required", "group", "size", "optionGroupLabel", "optionGroupChildren", "loading", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "exportable", "exportFilename", "actionShape", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "pageSize", "currentPage", "first", "filterTerm"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
575
|
-
}
|
|
576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: SchedulePredecessorField, decorators: [{
|
|
577
|
-
type: Component,
|
|
578
|
-
args: [{ selector: 'mt-schedule-predecessor-field', standalone: true, imports: [
|
|
579
|
-
CommonModule,
|
|
580
|
-
FormsModule,
|
|
581
|
-
Button,
|
|
582
|
-
FieldValidation,
|
|
583
|
-
NumberField,
|
|
584
|
-
SelectField,
|
|
585
|
-
Table,
|
|
586
|
-
TranslocoModule,
|
|
587
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
588
|
-
class: 'grid gap-1',
|
|
589
|
-
}, template: "@if (label()) {\r\n <label\r\n [class.required]=\"ngControl?.control?.hasValidator(requiredValidator)\"\r\n [for]=\"ngControl?.name || label()\"\r\n >\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n<div class=\"grid gap-3\">\r\n <div class=\"flex items-center justify-end\">\r\n <mt-button\r\n icon=\"general.plus\"\r\n [label]=\"'components.schedulePredecessorField.add' | transloco\"\r\n severity=\"secondary\"\r\n variant=\"outlined\"\r\n [disabled]=\"disabled() || readonly() || !canAddRow()\"\r\n [tooltip]=\"addTooltip()\"\r\n (onClick)=\"addRow()\"\r\n />\r\n </div>\r\n\r\n <ng-template #predecessorCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"availableTaskOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [placeholder]=\"\r\n placeholder() ||\r\n ('components.schedulePredecessorField.selectPredecessor' | transloco)\r\n \"\r\n [filter]=\"true\"\r\n [showClear]=\"true\"\r\n [loading]=\"loading()\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.predecessorId || undefined\"\r\n (onChange)=\"updateRow(row.key, { predecessorId: $event ?? '' })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #typeCellTpl let-row>\r\n <mt-select-field\r\n [field]=\"false\"\r\n [options]=\"typeOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.type\"\r\n (onChange)=\"updateRow(row.key, { type: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <ng-template #lagCellTpl let-row>\r\n <mt-number-field\r\n [field]=\"false\"\r\n [useGrouping]=\"false\"\r\n [placeholder]=\"'components.schedulePredecessorField.lagDays' | transloco\"\r\n [readonly]=\"disabled() || readonly()\"\r\n [ngModel]=\"row.lagDays\"\r\n (ngModelChange)=\"updateRow(row.key, { lagDays: $event ?? 0 })\"\r\n />\r\n </ng-template>\r\n\r\n <mt-table\r\n [data]=\"rows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"rowActions()\"\r\n [pageSize]=\"pageSize()\"\r\n [generalSearch]=\"false\"\r\n [showFilters]=\"false\"\r\n [dataKey]=\"'key'\"\r\n [loading]=\"loading()\"\r\n >\r\n <ng-template #empty>\r\n <div\r\n class=\"rounded-xl border border-dashed border-surface px-4 py-5 text-sm text-muted-color\"\r\n >\r\n {{ \"components.schedulePredecessorField.empty\" | transloco }}\r\n </div>\r\n </ng-template>\r\n </mt-table>\r\n</div>\r\n\r\n<mt-field-validation [control]=\"ngControl?.control\"></mt-field-validation>\r\n" }]
|
|
590
|
-
}], ctorParameters: () => [], propDecorators: { predecessorCellTpl: [{ type: i0.ViewChild, args: ['predecessorCellTpl', { isSignal: true }] }], typeCellTpl: [{ type: i0.ViewChild, args: ['typeCellTpl', { isSignal: true }] }], lagCellTpl: [{ type: i0.ViewChild, args: ['lagCellTpl', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }] } });
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Generated bundle index. Do not edit.
|
|
594
|
-
*/
|
|
595
|
-
|
|
596
|
-
export { LookupMatrixField, SchedulePredecessorField, SchemaConnectionField };
|
|
597
|
-
//# sourceMappingURL=masterteam-components-business-fields.mjs.map
|