@masterteam/components 0.0.237 → 0.0.239
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/i18n/ar.json +1 -1
- package/assets/i18n/en.json +1 -1
- package/fesm2022/masterteam-components-business-fields.mjs +413 -82
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +4 -4
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-field-validation.mjs.map +1 -1
- package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-statistic-card.mjs +22 -3
- package/fesm2022/masterteam-components-statistic-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +39 -14
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-treeselect-field.mjs +2 -2
- package/fesm2022/masterteam-components-treeselect-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-upload-field.mjs +11 -2
- package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +99 -8
- package/types/masterteam-components-statistic-card.d.ts +9 -1
- package/types/masterteam-components-table.d.ts +29 -4
- package/types/masterteam-components-upload-field.d.ts +1 -0
|
@@ -663,7 +663,7 @@ class SchedulePredecessorField {
|
|
|
663
663
|
return `${row.predecessorId}${PREDECESSOR_TOKEN_BY_TYPE[row.type]}${lag}`;
|
|
664
664
|
}
|
|
665
665
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SchedulePredecessorField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
666
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", 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: "<div class=\"gap-3 overflow-auto\">\r\n <div class=\"flex items-center justify-between mb-2\">\r\n <div>\r\n @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 </div>\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 size=\"small\"\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 noCard\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 storageKey=\"schedule-predecessor-field-table\"\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.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: "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", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "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", "markCurrentUser"], outputs: ["onChange"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
666
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", 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: "<div class=\"gap-3 overflow-auto\">\r\n <div class=\"flex items-center justify-between mb-2\">\r\n <div>\r\n @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 </div>\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 size=\"small\"\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 noCard\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 storageKey=\"schedule-predecessor-field-table\"\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.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: "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", "hint", "label", "placeholder", "class", "readonly", "pInputs", "format", "useGrouping", "maxFractionDigits", "min", "max", "required"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "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", "markCurrentUser"], outputs: ["onChange"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { kind: "ngmodule", type: TranslocoModule }, { kind: "pipe", type: i2.TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
667
667
|
}
|
|
668
668
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: SchedulePredecessorField, decorators: [{
|
|
669
669
|
type: Component,
|
|
@@ -694,6 +694,22 @@ const UNSORTABLE_ENTITY_VIEW_TYPES = new Set([
|
|
|
694
694
|
'Attachment',
|
|
695
695
|
'Checkbox',
|
|
696
696
|
]);
|
|
697
|
+
const ACCESS_ALIASES = {
|
|
698
|
+
'0': 'Auto',
|
|
699
|
+
'1': 'Read',
|
|
700
|
+
'2': 'Write',
|
|
701
|
+
'3': 'ReadWrite',
|
|
702
|
+
'4': 'None',
|
|
703
|
+
auto: 'Auto',
|
|
704
|
+
read: 'Read',
|
|
705
|
+
write: 'Write',
|
|
706
|
+
readwrite: 'ReadWrite',
|
|
707
|
+
none: 'None',
|
|
708
|
+
};
|
|
709
|
+
/** Internal row keys — not rendered, used to correlate rows with entities. */
|
|
710
|
+
const ROW_ID_KEY = '__rowId';
|
|
711
|
+
const ROW_ENTITY_ID_KEY = '__entityId';
|
|
712
|
+
const ROW_VALUES_KEY = '__values';
|
|
697
713
|
class EntityListField {
|
|
698
714
|
// Inputs
|
|
699
715
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
@@ -711,6 +727,7 @@ class EntityListField {
|
|
|
711
727
|
storedValue = signal(null, ...(ngDevMode ? [{ debugName: "storedValue" }] : /* istanbul ignore next */ []));
|
|
712
728
|
// Loaded table state.
|
|
713
729
|
columns = signal([], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
730
|
+
/** Rows loaded from the backend (existing target records). */
|
|
714
731
|
rows = signal([], ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
715
732
|
loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
716
733
|
errorMessage = signal(null, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
@@ -737,14 +754,24 @@ class EntityListField {
|
|
|
737
754
|
return [];
|
|
738
755
|
return raw.filter((f) => typeof f === 'string' && f.length > 0);
|
|
739
756
|
}, ...(ngDevMode ? [{ debugName: "readFields" }] : /* istanbul ignore next */ []));
|
|
757
|
+
/** Normalized `access` from the property configuration. */
|
|
758
|
+
accessMode = computed(() => {
|
|
759
|
+
const raw = this.configuration()?.access;
|
|
760
|
+
if (raw == null || raw === '')
|
|
761
|
+
return 'Auto';
|
|
762
|
+
return ACCESS_ALIASES[String(raw).trim().toLowerCase()] ?? 'Auto';
|
|
763
|
+
}, ...(ngDevMode ? [{ debugName: "accessMode" }] : /* istanbul ignore next */ []));
|
|
740
764
|
canRead = computed(() => {
|
|
741
|
-
const access =
|
|
742
|
-
return access
|
|
765
|
+
const access = this.accessMode();
|
|
766
|
+
return access === 'Auto' || access === 'Read' || access === 'ReadWrite';
|
|
743
767
|
}, ...(ngDevMode ? [{ debugName: "canRead" }] : /* istanbul ignore next */ []));
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
768
|
+
/** Access allows module-backed create/update/delete. */
|
|
769
|
+
writeAllowed = computed(() => {
|
|
770
|
+
const access = this.accessMode();
|
|
771
|
+
return access === 'Auto' || access === 'Write' || access === 'ReadWrite';
|
|
772
|
+
}, ...(ngDevMode ? [{ debugName: "writeAllowed" }] : /* istanbul ignore next */ []));
|
|
773
|
+
/** Write UI is rendered only when access allows it and the field is editable. */
|
|
774
|
+
canWrite = computed(() => this.writeAllowed() && !this.readonly(), ...(ngDevMode ? [{ debugName: "canWrite" }] : /* istanbul ignore next */ []));
|
|
748
775
|
writeFields = computed(() => {
|
|
749
776
|
const raw = this.configuration()
|
|
750
777
|
?.writeFields;
|
|
@@ -752,10 +779,89 @@ class EntityListField {
|
|
|
752
779
|
return [];
|
|
753
780
|
return raw.filter((f) => typeof f === 'string' && f.length > 0);
|
|
754
781
|
}, ...(ngDevMode ? [{ debugName: "writeFields" }] : /* istanbul ignore next */ []));
|
|
755
|
-
/**
|
|
756
|
-
|
|
782
|
+
/**
|
|
783
|
+
* Pending create/update rows, in the exact shape persisted by the backend
|
|
784
|
+
* (`rows[]` of the stored EntityList JSON). Rows with `entityId > 0` are
|
|
785
|
+
* partial updates of existing records; `entityId = 0` rows are creates.
|
|
786
|
+
*/
|
|
787
|
+
pendingRows = signal([], ...(ngDevMode ? [{ debugName: "pendingRows" }] : /* istanbul ignore next */ []));
|
|
788
|
+
/** Existing entity ids the user removed (submitted as `deletedIds`). */
|
|
789
|
+
deletedIds = signal([], ...(ngDevMode ? [{ debugName: "deletedIds" }] : /* istanbul ignore next */ []));
|
|
790
|
+
/** rowId → original form values / option labels (view state only). */
|
|
791
|
+
rowDrafts = signal({}, ...(ngDevMode ? [{ debugName: "rowDrafts" }] : /* istanbul ignore next */ []));
|
|
757
792
|
localRowSeq = 0;
|
|
758
|
-
|
|
793
|
+
/** Serialized copy of the last value we emitted, to ignore CVA echoes. */
|
|
794
|
+
lastEmittedJson = null;
|
|
795
|
+
/** Server rows indexed by entity id, for merging pending updates. */
|
|
796
|
+
rowsByEntityId = computed(() => {
|
|
797
|
+
const map = new Map();
|
|
798
|
+
for (const row of this.rows()) {
|
|
799
|
+
const entityId = Number(row[ROW_ENTITY_ID_KEY]);
|
|
800
|
+
if (entityId > 0)
|
|
801
|
+
map.set(entityId, row);
|
|
802
|
+
}
|
|
803
|
+
return map;
|
|
804
|
+
}, ...(ngDevMode ? [{ debugName: "rowsByEntityId" }] : /* istanbul ignore next */ []));
|
|
805
|
+
/** Locally created rows (not yet persisted). */
|
|
806
|
+
createdRows = computed(() => {
|
|
807
|
+
const drafts = this.rowDrafts();
|
|
808
|
+
return this.pendingRows()
|
|
809
|
+
.filter((row) => !(row.entityId > 0))
|
|
810
|
+
.map((row) => {
|
|
811
|
+
const draft = drafts[row.rowId];
|
|
812
|
+
return this.buildRow(row.rowId, row.rowId, 0, draft?.values ?? this.toValueMap(row.values), draft?.display ?? {});
|
|
813
|
+
});
|
|
814
|
+
}, ...(ngDevMode ? [{ debugName: "createdRows" }] : /* istanbul ignore next */ []));
|
|
815
|
+
/** Pending edits of existing rows, keyed by entity id. */
|
|
816
|
+
editedRowsByEntityId = computed(() => {
|
|
817
|
+
const drafts = this.rowDrafts();
|
|
818
|
+
const serverRows = this.rowsByEntityId();
|
|
819
|
+
const map = new Map();
|
|
820
|
+
for (const row of this.pendingRows()) {
|
|
821
|
+
if (!(row.entityId > 0))
|
|
822
|
+
continue;
|
|
823
|
+
const base = serverRows.get(row.entityId);
|
|
824
|
+
const draft = drafts[row.rowId];
|
|
825
|
+
// A pending update only carries the keys the user changed.
|
|
826
|
+
const changed = draft?.values ?? this.toValueMap(row.values);
|
|
827
|
+
const display = draft?.display ?? {};
|
|
828
|
+
if (!base) {
|
|
829
|
+
map.set(row.entityId, this.buildRow(row.entityId, row.rowId, row.entityId, changed, display));
|
|
830
|
+
continue;
|
|
831
|
+
}
|
|
832
|
+
// Keep the backend-rendered cells for untouched columns so resolved
|
|
833
|
+
// labels (users, lookups, statuses) are not replaced by raw ids.
|
|
834
|
+
const baseValues = base[ROW_VALUES_KEY] ?? {};
|
|
835
|
+
const next = {
|
|
836
|
+
...base,
|
|
837
|
+
[ROW_ID_KEY]: row.rowId,
|
|
838
|
+
[ROW_VALUES_KEY]: { ...baseValues, ...changed },
|
|
839
|
+
};
|
|
840
|
+
for (const column of this.columns()) {
|
|
841
|
+
const key = column.propertyKey ?? column.key;
|
|
842
|
+
if (!(key in changed))
|
|
843
|
+
continue;
|
|
844
|
+
next[column.key] = this.buildCell(column, changed[key], display[key]);
|
|
845
|
+
}
|
|
846
|
+
map.set(row.entityId, next);
|
|
847
|
+
}
|
|
848
|
+
return map;
|
|
849
|
+
}, ...(ngDevMode ? [{ debugName: "editedRowsByEntityId" }] : /* istanbul ignore next */ []));
|
|
850
|
+
/**
|
|
851
|
+
* Rows rendered in the table. In write mode existing rows are merged with
|
|
852
|
+
* pending edits, removed rows are hidden, and locally created rows are
|
|
853
|
+
* appended.
|
|
854
|
+
*/
|
|
855
|
+
displayRows = computed(() => {
|
|
856
|
+
if (!this.canWrite())
|
|
857
|
+
return this.rows();
|
|
858
|
+
const deleted = new Set(this.deletedIds());
|
|
859
|
+
const edited = this.editedRowsByEntityId();
|
|
860
|
+
const existing = this.rows()
|
|
861
|
+
.filter((row) => !deleted.has(Number(row[ROW_ENTITY_ID_KEY])))
|
|
862
|
+
.map((row) => edited.get(Number(row[ROW_ENTITY_ID_KEY])) ?? row);
|
|
863
|
+
return [...existing, ...this.createdRows()];
|
|
864
|
+
}, ...(ngDevMode ? [{ debugName: "displayRows" }] : /* istanbul ignore next */ []));
|
|
759
865
|
hasRows = computed(() => this.displayRows().length > 0, ...(ngDevMode ? [{ debugName: "hasRows" }] : /* istanbul ignore next */ []));
|
|
760
866
|
hasRequiredContext = computed(() => this.levelId() != null &&
|
|
761
867
|
this.levelDataId() != null &&
|
|
@@ -779,12 +885,11 @@ class EntityListField {
|
|
|
779
885
|
if (this.ngControl) {
|
|
780
886
|
this.ngControl.valueAccessor = this;
|
|
781
887
|
}
|
|
782
|
-
// Trigger fetch when context inputs change.
|
|
783
|
-
// /api/fetch/query
|
|
784
|
-
// mode and replaced by locally-added rows.
|
|
888
|
+
// Trigger fetch when context inputs change. Columns always come from
|
|
889
|
+
// /api/fetch/query; records are kept whenever access allows reading.
|
|
785
890
|
effect(() => {
|
|
786
891
|
const allowedRead = this.canRead();
|
|
787
|
-
const allowedWrite = this.
|
|
892
|
+
const allowedWrite = this.writeAllowed();
|
|
788
893
|
const ready = this.hasRequiredContext();
|
|
789
894
|
const levelId = this.levelId();
|
|
790
895
|
const levelDataId = this.levelDataId();
|
|
@@ -809,13 +914,51 @@ class EntityListField {
|
|
|
809
914
|
// CVA
|
|
810
915
|
// ============================================================================
|
|
811
916
|
writeValue(value) {
|
|
812
|
-
this.
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
this.
|
|
818
|
-
this.
|
|
917
|
+
const incoming = this.coerceStoredValue(value);
|
|
918
|
+
// Ignore the echo of our own emission (DynamicForm re-writes the model on
|
|
919
|
+
// every value change) so pending edits/deletions are not reset.
|
|
920
|
+
if (this.isEchoOfLastEmit(incoming))
|
|
921
|
+
return;
|
|
922
|
+
this.lastEmittedJson = null;
|
|
923
|
+
this.storedValue.set(incoming);
|
|
924
|
+
// Restore rows the backend left unprocessed. `deletedIds` on a loaded
|
|
925
|
+
// value are historical operation markers, not pending intent.
|
|
926
|
+
const rows = Array.isArray(incoming?.rows) ? incoming.rows : [];
|
|
927
|
+
this.pendingRows.set(rows.filter((row) => !!row && typeof row === 'object'));
|
|
928
|
+
this.deletedIds.set([]);
|
|
929
|
+
this.rowDrafts.set({});
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* True when the written value still carries exactly the rows and deletions
|
|
933
|
+
* we last emitted — i.e. the form is echoing our own value back rather than
|
|
934
|
+
* loading a new one.
|
|
935
|
+
*/
|
|
936
|
+
isEchoOfLastEmit(incoming) {
|
|
937
|
+
if (this.lastEmittedJson === null)
|
|
938
|
+
return false;
|
|
939
|
+
return (JSON.stringify({
|
|
940
|
+
rows: incoming?.rows ?? [],
|
|
941
|
+
deletedIds: incoming?.deletedIds ?? [],
|
|
942
|
+
}) === this.lastEmittedJson);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* The stored value is persisted as JSON, so a host may write either the
|
|
946
|
+
* parsed object or its raw string form.
|
|
947
|
+
*/
|
|
948
|
+
coerceStoredValue(value) {
|
|
949
|
+
if (value == null || value === '')
|
|
950
|
+
return null;
|
|
951
|
+
if (typeof value === 'string') {
|
|
952
|
+
try {
|
|
953
|
+
return this.coerceStoredValue(JSON.parse(value));
|
|
954
|
+
}
|
|
955
|
+
catch {
|
|
956
|
+
return null;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
return typeof value === 'object' && !Array.isArray(value)
|
|
960
|
+
? value
|
|
961
|
+
: null;
|
|
819
962
|
}
|
|
820
963
|
registerOnChange(fn) {
|
|
821
964
|
this.onModelChange = fn;
|
|
@@ -827,26 +970,30 @@ class EntityListField {
|
|
|
827
970
|
this.disabled.set(isDisabled);
|
|
828
971
|
}
|
|
829
972
|
// ============================================================================
|
|
830
|
-
// Write mode —
|
|
973
|
+
// Write mode — add / edit / delete
|
|
831
974
|
// ============================================================================
|
|
832
|
-
/** Row actions shown in
|
|
833
|
-
writeRowActions = computed(() =>
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
tooltip: this.transloco.translate('components.entityListField.delete'),
|
|
842
|
-
color: 'danger',
|
|
843
|
-
confirmation: {
|
|
844
|
-
type: 'popup',
|
|
845
|
-
confirmationType: 'delete',
|
|
975
|
+
/** Row actions shown in write mode — edit and delete. */
|
|
976
|
+
writeRowActions = computed(() => {
|
|
977
|
+
if (this.disabled())
|
|
978
|
+
return [];
|
|
979
|
+
return [
|
|
980
|
+
{
|
|
981
|
+
icon: 'custom.pencil',
|
|
982
|
+
tooltip: this.transloco.translate('components.entityListField.edit'),
|
|
983
|
+
action: (row) => this.openEditDialog(row),
|
|
846
984
|
},
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
985
|
+
{
|
|
986
|
+
icon: 'general.trash-01',
|
|
987
|
+
tooltip: this.transloco.translate('components.entityListField.delete'),
|
|
988
|
+
color: 'danger',
|
|
989
|
+
confirmation: {
|
|
990
|
+
type: 'popup',
|
|
991
|
+
confirmationType: 'delete',
|
|
992
|
+
},
|
|
993
|
+
action: (row) => this.deleteRow(row),
|
|
994
|
+
},
|
|
995
|
+
];
|
|
996
|
+
}, ...(ngDevMode ? [{ debugName: "writeRowActions" }] : /* istanbul ignore next */ []));
|
|
850
997
|
openAddDialog() {
|
|
851
998
|
if (this.disabled())
|
|
852
999
|
return;
|
|
@@ -868,11 +1015,16 @@ class EntityListField {
|
|
|
868
1015
|
const parsed = this.parseDialogResult(result);
|
|
869
1016
|
if (!parsed)
|
|
870
1017
|
return;
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const
|
|
874
|
-
this.
|
|
875
|
-
this.
|
|
1018
|
+
// A create row carries every value the user filled in; empty fields are
|
|
1019
|
+
// dropped so the target module keeps its own defaults.
|
|
1020
|
+
const values = this.dropEmptyValues(parsed.values);
|
|
1021
|
+
const rowId = this.nextRowId();
|
|
1022
|
+
this.setRowDraft(rowId, values, parsed.display);
|
|
1023
|
+
this.pendingRows.set([
|
|
1024
|
+
...this.pendingRows(),
|
|
1025
|
+
{ rowId, entityId: 0, values: this.toSubmitValues(values) },
|
|
1026
|
+
]);
|
|
1027
|
+
this.emitValue();
|
|
876
1028
|
});
|
|
877
1029
|
}
|
|
878
1030
|
openEditDialog(row) {
|
|
@@ -881,7 +1033,9 @@ class EntityListField {
|
|
|
881
1033
|
const component = this.addDialogComponent;
|
|
882
1034
|
if (!component)
|
|
883
1035
|
return;
|
|
884
|
-
const
|
|
1036
|
+
const entityId = Number(row[ROW_ENTITY_ID_KEY]) || 0;
|
|
1037
|
+
const rowId = String(row[ROW_ID_KEY] ?? '');
|
|
1038
|
+
const initialValues = row[ROW_VALUES_KEY] ?? {};
|
|
885
1039
|
const ref = this.modal.openModal(component, 'dialog', {
|
|
886
1040
|
header: this.transloco.translate('components.entityListField.edit'),
|
|
887
1041
|
styleClass: '!w-[48rem] max-w-[96vw]',
|
|
@@ -891,25 +1045,82 @@ class EntityListField {
|
|
|
891
1045
|
levelId: this.levelId(),
|
|
892
1046
|
levelDataId: this.levelDataId(),
|
|
893
1047
|
writeFields: this.writeFields(),
|
|
894
|
-
initialValues
|
|
1048
|
+
initialValues,
|
|
1049
|
+
isEdit: true,
|
|
895
1050
|
},
|
|
896
1051
|
});
|
|
897
1052
|
ref.onClose.pipe(take(1)).subscribe((result) => {
|
|
898
1053
|
const parsed = this.parseDialogResult(result);
|
|
899
1054
|
if (!parsed)
|
|
900
1055
|
return;
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1056
|
+
if (entityId > 0) {
|
|
1057
|
+
this.applyExistingRowEdit(entityId, rowId, initialValues, parsed);
|
|
1058
|
+
}
|
|
1059
|
+
else {
|
|
1060
|
+
this.applyCreatedRowEdit(rowId, parsed);
|
|
1061
|
+
}
|
|
1062
|
+
this.emitValue();
|
|
906
1063
|
});
|
|
907
1064
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1065
|
+
/**
|
|
1066
|
+
* Existing target records are updated partially: only values the user
|
|
1067
|
+
* actually changed are submitted, so fields the dialog could not pre-fill
|
|
1068
|
+
* (keys outside `readFields`) are left untouched by the backend.
|
|
1069
|
+
*/
|
|
1070
|
+
applyExistingRowEdit(entityId, fallbackRowId, initialValues, parsed) {
|
|
1071
|
+
const changed = this.diffValues(initialValues, parsed.values);
|
|
1072
|
+
const current = this.pendingRows();
|
|
1073
|
+
const existing = current.find((row) => row.entityId === entityId);
|
|
1074
|
+
const rowId = existing?.rowId || (fallbackRowId ? fallbackRowId : `entity-${entityId}`);
|
|
1075
|
+
const merged = {
|
|
1076
|
+
...(this.rowDrafts()[rowId]?.values ?? {}),
|
|
1077
|
+
...changed,
|
|
1078
|
+
};
|
|
1079
|
+
if (Object.keys(merged).length === 0) {
|
|
1080
|
+
// Nothing left to submit for this record — drop the pending update.
|
|
1081
|
+
this.clearRowDraft(rowId);
|
|
1082
|
+
this.pendingRows.set(current.filter((row) => row.entityId !== entityId));
|
|
1083
|
+
return;
|
|
1084
|
+
}
|
|
1085
|
+
this.setRowDraft(rowId, merged, parsed.display);
|
|
1086
|
+
const next = {
|
|
1087
|
+
rowId,
|
|
1088
|
+
entityId,
|
|
1089
|
+
values: this.toSubmitValues(merged),
|
|
1090
|
+
};
|
|
1091
|
+
this.pendingRows.set(existing
|
|
1092
|
+
? current.map((row) => (row.entityId === entityId ? next : row))
|
|
1093
|
+
: [...current, next]);
|
|
1094
|
+
}
|
|
1095
|
+
/** A locally created row is replaced wholesale by the dialog result. */
|
|
1096
|
+
applyCreatedRowEdit(rowId, parsed) {
|
|
1097
|
+
const values = this.dropEmptyValues(parsed.values);
|
|
1098
|
+
this.setRowDraft(rowId, values, parsed.display);
|
|
1099
|
+
this.pendingRows.set(this.pendingRows().map((row) => row.rowId === rowId
|
|
1100
|
+
? { ...row, values: this.toSubmitValues(values) }
|
|
1101
|
+
: row));
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Remove a row. Locally created rows are dropped from the pending payload;
|
|
1105
|
+
* existing records are queued in `deletedIds` for the backend to delete.
|
|
1106
|
+
*/
|
|
1107
|
+
deleteRow(row) {
|
|
1108
|
+
if (this.disabled())
|
|
1109
|
+
return;
|
|
1110
|
+
const entityId = Number(row[ROW_ENTITY_ID_KEY]) || 0;
|
|
1111
|
+
const rowId = String(row[ROW_ID_KEY] ?? '');
|
|
1112
|
+
if (entityId > 0) {
|
|
1113
|
+
if (!this.deletedIds().includes(entityId)) {
|
|
1114
|
+
this.deletedIds.set([...this.deletedIds(), entityId]);
|
|
1115
|
+
}
|
|
1116
|
+
// A queued update for a deleted record is pointless — drop it.
|
|
1117
|
+
this.pendingRows.set(this.pendingRows().filter((pending) => pending.entityId !== entityId));
|
|
1118
|
+
}
|
|
1119
|
+
else {
|
|
1120
|
+
this.pendingRows.set(this.pendingRows().filter((pending) => pending.rowId !== rowId));
|
|
1121
|
+
}
|
|
1122
|
+
this.clearRowDraft(rowId);
|
|
1123
|
+
this.emitValue();
|
|
913
1124
|
}
|
|
914
1125
|
/**
|
|
915
1126
|
* Normalize the add/edit dialog close payload. The rich dialog returns
|
|
@@ -929,24 +1140,51 @@ class EntityListField {
|
|
|
929
1140
|
}
|
|
930
1141
|
return { values: payload, display: {} };
|
|
931
1142
|
}
|
|
932
|
-
|
|
933
|
-
const
|
|
1143
|
+
nextRowId() {
|
|
1144
|
+
const used = new Set(this.pendingRows().map((row) => row.rowId));
|
|
1145
|
+
let candidate = '';
|
|
1146
|
+
do {
|
|
1147
|
+
this.localRowSeq += 1;
|
|
1148
|
+
candidate = `client-${this.localRowSeq}`;
|
|
1149
|
+
} while (used.has(candidate));
|
|
1150
|
+
return candidate;
|
|
1151
|
+
}
|
|
1152
|
+
setRowDraft(rowId, values, display) {
|
|
1153
|
+
this.rowDrafts.set({ ...this.rowDrafts(), [rowId]: { values, display } });
|
|
1154
|
+
}
|
|
1155
|
+
clearRowDraft(rowId) {
|
|
1156
|
+
if (!rowId || !(rowId in this.rowDrafts()))
|
|
1157
|
+
return;
|
|
1158
|
+
const next = { ...this.rowDrafts() };
|
|
1159
|
+
delete next[rowId];
|
|
1160
|
+
this.rowDrafts.set(next);
|
|
1161
|
+
}
|
|
1162
|
+
buildRow(id, rowId, entityId, values, display = {}) {
|
|
1163
|
+
const row = {
|
|
1164
|
+
Id: id,
|
|
1165
|
+
[ROW_ID_KEY]: rowId,
|
|
1166
|
+
[ROW_ENTITY_ID_KEY]: entityId,
|
|
1167
|
+
[ROW_VALUES_KEY]: values,
|
|
1168
|
+
};
|
|
934
1169
|
for (const column of this.columns()) {
|
|
935
1170
|
// Form values are keyed by catalog property key (e.g. "task_name"),
|
|
936
1171
|
// but column.key is the normalizedKey (e.g. "Name"). Use propertyKey
|
|
937
1172
|
// for the lookup so the value is found.
|
|
938
1173
|
const key = column.propertyKey ?? column.key;
|
|
939
|
-
|
|
940
|
-
row[column.key] = {
|
|
941
|
-
name: column.label ?? column.key,
|
|
942
|
-
key: column.key,
|
|
943
|
-
viewType: column.viewType ?? 'Text',
|
|
944
|
-
value: this.toLocalEntityValue(column.viewType, raw, display[key]),
|
|
945
|
-
rawValue: raw ?? null,
|
|
946
|
-
};
|
|
1174
|
+
row[column.key] = this.buildCell(column, values[key], display[key]);
|
|
947
1175
|
}
|
|
948
1176
|
return row;
|
|
949
1177
|
}
|
|
1178
|
+
/** Render one table cell from a raw form value and its resolved label. */
|
|
1179
|
+
buildCell(column, raw, label) {
|
|
1180
|
+
return {
|
|
1181
|
+
name: column.label ?? column.key,
|
|
1182
|
+
key: column.key,
|
|
1183
|
+
viewType: column.viewType ?? 'Text',
|
|
1184
|
+
value: this.toLocalEntityValue(column.viewType, raw, label),
|
|
1185
|
+
rawValue: raw ?? null,
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
950
1188
|
/**
|
|
951
1189
|
* Shape a raw form value into the value an entity renderer expects for the
|
|
952
1190
|
* given view type. Locally-added rows carry raw form values, but renderers
|
|
@@ -993,13 +1231,96 @@ class EntityListField {
|
|
|
993
1231
|
}
|
|
994
1232
|
return raw ?? '';
|
|
995
1233
|
}
|
|
996
|
-
|
|
1234
|
+
// ============================================================================
|
|
1235
|
+
// Submit payload (see EntityList.md — "Stored Value Shape")
|
|
1236
|
+
// ============================================================================
|
|
1237
|
+
emitValue() {
|
|
997
1238
|
const current = this.storedValue();
|
|
998
|
-
|
|
1239
|
+
// `entityIds` / `createdIds` / `updatedIds` / `snapshot` are backend-owned
|
|
1240
|
+
// and passed through untouched; the frontend only contributes pending rows
|
|
1241
|
+
// and delete intents.
|
|
1242
|
+
const next = {
|
|
1243
|
+
...(current ?? {}),
|
|
1244
|
+
rows: this.pendingRows(),
|
|
1245
|
+
deletedIds: this.deletedIds(),
|
|
1246
|
+
};
|
|
999
1247
|
this.storedValue.set(next);
|
|
1248
|
+
this.lastEmittedJson = JSON.stringify({
|
|
1249
|
+
rows: next.rows,
|
|
1250
|
+
deletedIds: next.deletedIds,
|
|
1251
|
+
});
|
|
1000
1252
|
this.onModelChange(next);
|
|
1001
1253
|
this.onTouched();
|
|
1002
1254
|
}
|
|
1255
|
+
/** `values[]` entries, restricted to `writeFields` when configured. */
|
|
1256
|
+
toSubmitValues(values) {
|
|
1257
|
+
const allowed = new Set(this.writeFields());
|
|
1258
|
+
return Object.entries(values)
|
|
1259
|
+
.filter(([propertyKey]) => allowed.size === 0 || allowed.has(propertyKey))
|
|
1260
|
+
.map(([propertyKey, value]) => ({
|
|
1261
|
+
propertyKey,
|
|
1262
|
+
rawValue: this.toRawValue(value),
|
|
1263
|
+
}));
|
|
1264
|
+
}
|
|
1265
|
+
/** Backend `rawValue` is a serialized scalar; objects/arrays go as JSON. */
|
|
1266
|
+
toRawValue(value) {
|
|
1267
|
+
if (value == null || value === '')
|
|
1268
|
+
return null;
|
|
1269
|
+
if (value instanceof Date)
|
|
1270
|
+
return value.toISOString();
|
|
1271
|
+
if (typeof value === 'object')
|
|
1272
|
+
return JSON.stringify(value);
|
|
1273
|
+
return String(value);
|
|
1274
|
+
}
|
|
1275
|
+
toValueMap(values) {
|
|
1276
|
+
const map = {};
|
|
1277
|
+
for (const value of values ?? []) {
|
|
1278
|
+
if (!value?.propertyKey)
|
|
1279
|
+
continue;
|
|
1280
|
+
map[value.propertyKey] = value.rawValue;
|
|
1281
|
+
}
|
|
1282
|
+
return map;
|
|
1283
|
+
}
|
|
1284
|
+
dropEmptyValues(values) {
|
|
1285
|
+
const next = {};
|
|
1286
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1287
|
+
if (this.isEmptyValue(value))
|
|
1288
|
+
continue;
|
|
1289
|
+
next[key] = value;
|
|
1290
|
+
}
|
|
1291
|
+
return next;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Keys the user actually changed. A key that was empty before and is still
|
|
1295
|
+
* empty is skipped (the dialog simply could not pre-fill it); a key that had
|
|
1296
|
+
* a value and is now empty is kept so the backend clears it.
|
|
1297
|
+
*/
|
|
1298
|
+
diffValues(initial, next) {
|
|
1299
|
+
const changed = {};
|
|
1300
|
+
for (const [key, value] of Object.entries(next)) {
|
|
1301
|
+
const before = initial[key];
|
|
1302
|
+
if (this.isEmptyValue(value) && this.isEmptyValue(before))
|
|
1303
|
+
continue;
|
|
1304
|
+
if (this.isSameValue(before, value))
|
|
1305
|
+
continue;
|
|
1306
|
+
changed[key] = value;
|
|
1307
|
+
}
|
|
1308
|
+
return changed;
|
|
1309
|
+
}
|
|
1310
|
+
isEmptyValue(value) {
|
|
1311
|
+
if (value == null || value === '')
|
|
1312
|
+
return true;
|
|
1313
|
+
if (Array.isArray(value))
|
|
1314
|
+
return value.length === 0;
|
|
1315
|
+
return false;
|
|
1316
|
+
}
|
|
1317
|
+
isSameValue(a, b) {
|
|
1318
|
+
if (a === b)
|
|
1319
|
+
return true;
|
|
1320
|
+
// Values arriving from the read endpoint are serialized; compare the
|
|
1321
|
+
// submit-shaped representation so "5" and 5 are not treated as a change.
|
|
1322
|
+
return this.toRawValue(a) === this.toRawValue(b);
|
|
1323
|
+
}
|
|
1003
1324
|
// ============================================================================
|
|
1004
1325
|
// Read endpoint — POST /api/fetch/query (Table projection)
|
|
1005
1326
|
// ============================================================================
|
|
@@ -1038,7 +1359,7 @@ class EntityListField {
|
|
|
1038
1359
|
}
|
|
1039
1360
|
applyResponse(response) {
|
|
1040
1361
|
// Build property maps first so column defs can include the propertyKey
|
|
1041
|
-
// mapping (normalizedKey → catalog key) needed for
|
|
1362
|
+
// mapping (normalizedKey → catalog key) needed for row value lookup.
|
|
1042
1363
|
const propertyByKey = new Map();
|
|
1043
1364
|
const propertyByNormalizedKey = new Map();
|
|
1044
1365
|
for (const property of response.catalog?.properties ?? []) {
|
|
@@ -1057,25 +1378,35 @@ class EntityListField {
|
|
|
1057
1378
|
order: column.order,
|
|
1058
1379
|
visible: column.visible,
|
|
1059
1380
|
configuration: column.configuration ?? null,
|
|
1060
|
-
// Store the catalog property key so
|
|
1061
|
-
//
|
|
1062
|
-
//
|
|
1381
|
+
// Store the catalog property key so buildRow can look up form values
|
|
1382
|
+
// keyed by property key (e.g. "task_name") rather than the
|
|
1383
|
+
// normalizedKey used as the column display key (e.g. "Name").
|
|
1063
1384
|
propertyKey: propertyByNormalizedKey.get(column.key)?.key ?? column.key,
|
|
1064
1385
|
}));
|
|
1065
1386
|
this.columns.set(columns);
|
|
1066
|
-
//
|
|
1067
|
-
if (this.
|
|
1387
|
+
// Reading blocked (access = Write / None): keep the columns, drop records.
|
|
1388
|
+
if (!this.canRead()) {
|
|
1068
1389
|
this.rows.set([]);
|
|
1069
1390
|
return;
|
|
1070
1391
|
}
|
|
1071
1392
|
const rows = (response.records ?? []).map((record) => {
|
|
1072
|
-
const
|
|
1393
|
+
const values = {};
|
|
1394
|
+
const row = {
|
|
1395
|
+
Id: record.id,
|
|
1396
|
+
[ROW_ID_KEY]: `entity-${record.id}`,
|
|
1397
|
+
[ROW_ENTITY_ID_KEY]: record.id,
|
|
1398
|
+
};
|
|
1073
1399
|
for (const column of columns) {
|
|
1074
1400
|
const property = propertyByKey.get(column.key) ??
|
|
1075
1401
|
propertyByNormalizedKey.get(column.key);
|
|
1076
|
-
const
|
|
1402
|
+
const propertyKey = property?.key ?? column.key;
|
|
1403
|
+
const cell = record.values?.[propertyKey];
|
|
1077
1404
|
row[column.key] = this.toEntityData(column, cell, property, record.id);
|
|
1405
|
+
// Keep the machine-readable value so the edit dialog can pre-fill and
|
|
1406
|
+
// partial updates can be diffed against it.
|
|
1407
|
+
values[propertyKey] = cell?.raw ?? cell?.value ?? null;
|
|
1078
1408
|
}
|
|
1409
|
+
row[ROW_VALUES_KEY] = values;
|
|
1079
1410
|
return row;
|
|
1080
1411
|
});
|
|
1081
1412
|
this.rows.set(rows);
|
|
@@ -1100,7 +1431,7 @@ class EntityListField {
|
|
|
1100
1431
|
};
|
|
1101
1432
|
}
|
|
1102
1433
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1103
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", 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 }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canRead()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.saveFormFirst\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"
|
|
1434
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: EntityListField, isStandalone: true, selector: "mt-entity-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, propertyId: { classPropertyName: "propertyId", publicName: "propertyId", 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 }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canRead()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.saveFormFirst\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }, { kind: "component", type: Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "component", type: Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant", "motionOptions"], outputs: ["onClose"] }, { kind: "component", type: Table, selector: "mt-table", inputs: ["filters", "data", "columns", "rowActions", "size", "showGridlines", "stripedRows", "selectableRows", "clickableRows", "generalSearch", "lazyLocalSearch", "showFilters", "filterMode", "loading", "updating", "lazy", "lazyLocalSort", "lazyTotalRecords", "reorderableColumns", "reorderableRows", "dataKey", "storageKey", "storageMode", "persistStateExclude", "exportable", "printable", "groupable", "groupCountMap", "cellClickFilter", "freezeActions", "virtualScroll", "virtualScrollItemSize", "scrollHeight", "printTitle", "exportFilename", "actionShape", "rowActionsLoadingFn", "tableLayout", "noCard", "tabs", "tabsOptionLabel", "tabsOptionValue", "activeTab", "actions", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "rowActionsRequested", "filtersChange", "activeTabChange", "onTabChange", "pageSizeChange", "currentPageChange", "firstChange", "filterTermChange", "groupByChange", "sortFieldChange", "sortDirectionChange"] }, { 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: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1104
1435
|
}
|
|
1105
1436
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
1106
1437
|
type: Component,
|
|
@@ -1112,7 +1443,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1112
1443
|
Table,
|
|
1113
1444
|
Button,
|
|
1114
1445
|
TranslocoPipe,
|
|
1115
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canRead()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.saveFormFirst\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"
|
|
1446
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-1' }, template: "<div class=\"flex flex-col gap-2\">\r\n @if (label()) {\r\n <label class=\"font-medium text-color\">\r\n {{ label() }}\r\n @if (required()) {\r\n <span class=\"text-red-500\">*</span>\r\n }\r\n </label>\r\n }\r\n\r\n @if (errorMessage(); as err) {\r\n <p-message severity=\"error\" [text]=\"err\" styleClass=\"w-full\" />\r\n } @else if (canWrite()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.entityListField.add' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n [disabled]=\"disabled()\"\r\n (onClick)=\"openAddDialog()\"\r\n />\r\n </div>\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n [rowActions]=\"writeRowActions()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n } @else if (!canRead()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.readingNotAllowed\" | transloco }}\r\n </div>\r\n } @else if (!hasRequiredContext()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.saveFormFirst\" | transloco }}\r\n </div>\r\n } @else if (loading() && !hasRows()) {\r\n <div class=\"flex flex-col gap-2\">\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n <p-skeleton width=\"100%\" height=\"3rem\" />\r\n </div>\r\n } @else if (!hasRows()) {\r\n <div\r\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\r\n >\r\n {{ \"components.entityListField.noRelatedItems\" | transloco }}\r\n </div>\r\n } @else {\r\n <mt-table\r\n [noCard]=\"true\"\r\n [data]=\"displayRows()\"\r\n [columns]=\"columns()\"\r\n dataKey=\"Id\"\r\n [loading]=\"loading()\"\r\n />\r\n }\r\n\r\n @if (ngControl?.control) {\r\n <mt-field-validation\r\n [control]=\"ngControl?.control!\"\r\n [touched]=\"ngControl?.touched ?? false\"\r\n />\r\n }\r\n</div>\r\n", styles: [":host{display:block}\n"] }]
|
|
1116
1447
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], propertyId: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyId", required: false }] }], configuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "configuration", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
1117
1448
|
|
|
1118
1449
|
/** Page size when loading the full deliverable list, and a hard safety cap. */
|
|
@@ -1281,13 +1612,13 @@ class ScheduleItemSelectorField {
|
|
|
1281
1612
|
return ids;
|
|
1282
1613
|
}
|
|
1283
1614
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ScheduleItemSelectorField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1284
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ScheduleItemSelectorField, isStandalone: true, selector: "mt-schedule-item-selector-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 }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block" }, ngImport: i0, template: "@if (isMultiple()) {\
|
|
1615
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: ScheduleItemSelectorField, isStandalone: true, selector: "mt-schedule-item-selector-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 }, propertyKey: { classPropertyName: "propertyKey", publicName: "propertyKey", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "block" }, ngImport: i0, template: "@if (isMultiple()) {\n <mt-multi-select-field\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [options]=\"options()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [filter]=\"options().length > 10\"\n [showClear]=\"!required()\"\n [required]=\"required()\"\n [readonly]=\"readonly() || disabled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onMultiChange($event)\"\n />\n} @else {\n <mt-select-field\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [options]=\"options()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [filter]=\"options().length > 10\"\n [showClear]=\"!required()\"\n [loading]=\"loading()\"\n [required]=\"required()\"\n [readonly]=\"readonly() || disabled()\"\n [ngModel]=\"singleValue()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onSingleChange($event)\"\n />\n}\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { 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", "virtualScroll", "virtualScrollItemSize", "optionGroupLabel", "optionGroupChildren", "optionIcon", "optionIconColor", "optionIconShape", "optionAvatarShape", "optionGroupIcon", "optionGroupIconColor", "optionGroupIconShape", "optionGroupAvatarShape"], outputs: ["onChange"] }, { kind: "component", type: SelectField, selector: "mt-select-field", inputs: ["field", "hint", "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", "markCurrentUser"], outputs: ["onChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1285
1616
|
}
|
|
1286
1617
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: ScheduleItemSelectorField, decorators: [{
|
|
1287
1618
|
type: Component,
|
|
1288
1619
|
args: [{ selector: 'mt-schedule-item-selector-field', standalone: true, imports: [FormsModule, MultiSelectField, SelectField], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1289
1620
|
class: 'block',
|
|
1290
|
-
}, template: "@if (isMultiple()) {\
|
|
1621
|
+
}, template: "@if (isMultiple()) {\n <mt-multi-select-field\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [options]=\"options()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [filter]=\"options().length > 10\"\n [showClear]=\"!required()\"\n [required]=\"required()\"\n [readonly]=\"readonly() || disabled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onMultiChange($event)\"\n />\n} @else {\n <mt-select-field\n [label]=\"label()\"\n [placeholder]=\"placeholder()\"\n [options]=\"options()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [filter]=\"options().length > 10\"\n [showClear]=\"!required()\"\n [loading]=\"loading()\"\n [required]=\"required()\"\n [readonly]=\"readonly() || disabled()\"\n [ngModel]=\"singleValue()\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"onSingleChange($event)\"\n />\n}\n" }]
|
|
1291
1622
|
}], 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 }] }], propertyKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKey", required: false }] }], selectionMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionMode", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
1292
1623
|
|
|
1293
1624
|
/**
|
|
@@ -1524,7 +1855,7 @@ class LookupModuleCheckListField {
|
|
|
1524
1855
|
return [];
|
|
1525
1856
|
}
|
|
1526
1857
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LookupModuleCheckListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1527
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: LookupModuleCheckListField, isStandalone: true, selector: "mt-lookup-module-check-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, lookupOptions: { classPropertyName: "lookupOptions", publicName: "lookupOptions", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, propertyFields: { classPropertyName: "propertyFields", publicName: "propertyFields", isSignal: true, isRequired: false, transformFunction: null }, scopeId: { classPropertyName: "scopeId", publicName: "scopeId", isSignal: true, isRequired: false, transformFunction: null }, propertyKeys: { classPropertyName: "propertyKeys", publicName: "propertyKeys", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-2" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\
|
|
1858
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: LookupModuleCheckListField, isStandalone: true, selector: "mt-lookup-module-check-list-field", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, lookupOptions: { classPropertyName: "lookupOptions", publicName: "lookupOptions", isSignal: true, isRequired: false, transformFunction: null }, lookups: { classPropertyName: "lookups", publicName: "lookups", isSignal: true, isRequired: false, transformFunction: null }, propertyFields: { classPropertyName: "propertyFields", publicName: "propertyFields", isSignal: true, isRequired: false, transformFunction: null }, scopeId: { classPropertyName: "scopeId", publicName: "scopeId", isSignal: true, isRequired: false, transformFunction: null }, propertyKeys: { classPropertyName: "propertyKeys", publicName: "propertyKeys", isSignal: true, isRequired: false, transformFunction: null }, runtimeContext: { classPropertyName: "runtimeContext", publicName: "runtimeContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-2" }, ngImport: i0, template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (useRichForm()) {\n <ng-container\n [ngComponentOutlet]=\"formComponent!\"\n [ngComponentOutletInputs]=\"formInputs()\"\n />\n } @else if (sections().length) {\n <!-- Fallback: plain text inputs per property (no rich form registered) -->\n <div class=\"flex flex-col gap-2\">\n @for (section of sections(); track section.lookupKey) {\n <div class=\"overflow-hidden rounded-lg border border-surface-200\">\n <button\n type=\"button\"\n class=\"flex w-full cursor-pointer items-center justify-between gap-2 bg-surface-50 px-3 py-2 text-start hover:bg-surface-100\"\n [attr.aria-expanded]=\"isExpanded(section.lookupKey)\"\n (click)=\"toggle(section.lookupKey)\"\n >\n <span class=\"flex min-w-0 items-center gap-2\">\n <mt-icon\n [icon]=\"\n isExpanded(section.lookupKey)\n ? 'arrow.chevron-down'\n : 'arrow.chevron-right'\n \"\n size=\"sm\"\n class=\"shrink-0 text-muted-color rtl:-scale-x-100\"\n />\n <span class=\"truncate text-sm font-medium text-color\">\n {{ section.label }}\n </span>\n </span>\n @if (hasValues(section.lookupKey)) {\n <span\n class=\"shrink-0 rounded-full bg-primary-50 px-2 py-0.5 text-xs font-semibold text-primary-700\"\n >\n {{ \"components.lookupModuleCheckListField.filled\" | transloco }}\n </span>\n }\n </button>\n\n @if (isExpanded(section.lookupKey) && propertyFields().length) {\n <div class=\"border-t border-surface-200 p-3\">\n <div class=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n @for (field of propertyFields(); track field.key) {\n <label class=\"flex min-w-0 flex-col gap-1\">\n <span class=\"truncate text-xs text-muted-color\">\n {{ field.label }}\n </span>\n @if (isReadonly()) {\n <span class=\"truncate text-sm text-color\">\n {{ fieldValue(section.lookupKey, field.key) || \"_\" }}\n </span>\n } @else {\n <input\n pInputText\n class=\"w-full\"\n [ngModel]=\"fieldValue(section.lookupKey, field.key)\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"\n setFieldValue(section.lookupKey, field.key, $event)\n \"\n />\n }\n </label>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n } @else {\n <div\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.lookupModuleCheckListField.empty\" | transloco }}\n </div>\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n", 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: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }, { kind: "component", type: FieldValidation, selector: "mt-field-validation", inputs: ["control", "touched"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1528
1859
|
}
|
|
1529
1860
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LookupModuleCheckListField, decorators: [{
|
|
1530
1861
|
type: Component,
|
|
@@ -1535,7 +1866,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1535
1866
|
Icon,
|
|
1536
1867
|
FieldValidation,
|
|
1537
1868
|
TranslocoPipe,
|
|
1538
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-2' }, template: "<div class=\"flex flex-col gap-2\">\
|
|
1869
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-2' }, template: "<div class=\"flex flex-col gap-2\">\n @if (label()) {\n <label class=\"font-medium text-color\">\n {{ label() }}\n @if (required()) {\n <span class=\"text-red-500\">*</span>\n }\n </label>\n }\n\n @if (useRichForm()) {\n <ng-container\n [ngComponentOutlet]=\"formComponent!\"\n [ngComponentOutletInputs]=\"formInputs()\"\n />\n } @else if (sections().length) {\n <!-- Fallback: plain text inputs per property (no rich form registered) -->\n <div class=\"flex flex-col gap-2\">\n @for (section of sections(); track section.lookupKey) {\n <div class=\"overflow-hidden rounded-lg border border-surface-200\">\n <button\n type=\"button\"\n class=\"flex w-full cursor-pointer items-center justify-between gap-2 bg-surface-50 px-3 py-2 text-start hover:bg-surface-100\"\n [attr.aria-expanded]=\"isExpanded(section.lookupKey)\"\n (click)=\"toggle(section.lookupKey)\"\n >\n <span class=\"flex min-w-0 items-center gap-2\">\n <mt-icon\n [icon]=\"\n isExpanded(section.lookupKey)\n ? 'arrow.chevron-down'\n : 'arrow.chevron-right'\n \"\n size=\"sm\"\n class=\"shrink-0 text-muted-color rtl:-scale-x-100\"\n />\n <span class=\"truncate text-sm font-medium text-color\">\n {{ section.label }}\n </span>\n </span>\n @if (hasValues(section.lookupKey)) {\n <span\n class=\"shrink-0 rounded-full bg-primary-50 px-2 py-0.5 text-xs font-semibold text-primary-700\"\n >\n {{ \"components.lookupModuleCheckListField.filled\" | transloco }}\n </span>\n }\n </button>\n\n @if (isExpanded(section.lookupKey) && propertyFields().length) {\n <div class=\"border-t border-surface-200 p-3\">\n <div class=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n @for (field of propertyFields(); track field.key) {\n <label class=\"flex min-w-0 flex-col gap-1\">\n <span class=\"truncate text-xs text-muted-color\">\n {{ field.label }}\n </span>\n @if (isReadonly()) {\n <span class=\"truncate text-sm text-color\">\n {{ fieldValue(section.lookupKey, field.key) || \"_\" }}\n </span>\n } @else {\n <input\n pInputText\n class=\"w-full\"\n [ngModel]=\"fieldValue(section.lookupKey, field.key)\"\n [ngModelOptions]=\"{ standalone: true }\"\n (ngModelChange)=\"\n setFieldValue(section.lookupKey, field.key, $event)\n \"\n />\n }\n </label>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n } @else {\n <div\n class=\"rounded border border-dashed border-surface-300 bg-surface-50 p-3 text-sm text-muted-color\"\n >\n {{ \"components.lookupModuleCheckListField.empty\" | transloco }}\n </div>\n }\n\n @if (ngControl?.control) {\n <mt-field-validation\n [control]=\"ngControl?.control!\"\n [touched]=\"ngControl?.touched ?? false\"\n />\n }\n</div>\n" }]
|
|
1539
1870
|
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], lookupOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookupOptions", required: false }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], propertyFields: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyFields", required: false }] }], scopeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "scopeId", required: false }] }], propertyKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyKeys", required: false }] }], runtimeContext: [{ type: i0.Input, args: [{ isSignal: true, alias: "runtimeContext", required: false }] }] } });
|
|
1540
1871
|
|
|
1541
1872
|
/**
|