@masterteam/components 0.0.285 → 0.0.286
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 +49 -13
- package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
- package/fesm2022/masterteam-components-entities.mjs +48 -8
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-formula.mjs +12 -1
- package/fesm2022/masterteam-components-formula.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-business-fields.d.ts +3 -1
- package/types/masterteam-components-entities.d.ts +45 -2
- package/types/masterteam-components-formula.d.ts +12 -0
package/assets/i18n/ar.json
CHANGED
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"edit": "تعديل",
|
|
120
120
|
"delete": "حذف",
|
|
121
121
|
"readingNotAllowed": "القراءة غير مسموح بها لهذا الحقل.",
|
|
122
|
-
"
|
|
122
|
+
"missingConfiguration": "لم يتم إعداد هذا الحقل بالكامل.",
|
|
123
123
|
"noRelatedItems": "لا توجد عناصر مرتبطة.",
|
|
124
124
|
"loadFailed": "فشل تحميل العناصر المرتبطة"
|
|
125
125
|
},
|
package/assets/i18n/en.json
CHANGED
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"edit": "Edit",
|
|
120
120
|
"delete": "Delete",
|
|
121
121
|
"readingNotAllowed": "Reading is not allowed for this field.",
|
|
122
|
-
"
|
|
122
|
+
"missingConfiguration": "This field is not fully configured.",
|
|
123
123
|
"noRelatedItems": "No related items.",
|
|
124
124
|
"loadFailed": "Failed to load related items"
|
|
125
125
|
},
|
|
@@ -918,13 +918,13 @@ class EntityListField {
|
|
|
918
918
|
return [...existing, ...this.createdRows()];
|
|
919
919
|
}, ...(ngDevMode ? [{ debugName: "displayRows" }] : /* istanbul ignore next */ []));
|
|
920
920
|
hasRows = computed(() => this.displayRows().length > 0, ...(ngDevMode ? [{ debugName: "hasRows" }] : /* istanbul ignore next */ []));
|
|
921
|
-
hasRequiredContext = computed(() => this.levelId()
|
|
922
|
-
this.
|
|
923
|
-
this.moduleId() != null &&
|
|
921
|
+
hasRequiredContext = computed(() => Number(this.levelId()) > 0 &&
|
|
922
|
+
Number(this.moduleId()) > 0 &&
|
|
924
923
|
this.readFields().length > 0, ...(ngDevMode ? [{ debugName: "hasRequiredContext" }] : /* istanbul ignore next */ []));
|
|
925
924
|
onTouched = () => { };
|
|
926
925
|
onModelChange = () => { };
|
|
927
926
|
http = inject(HttpClient);
|
|
927
|
+
fetchSubscription;
|
|
928
928
|
destroyRef = inject(DestroyRef);
|
|
929
929
|
modal = inject(ModalService);
|
|
930
930
|
transloco = inject(TranslocoService);
|
|
@@ -940,8 +940,8 @@ class EntityListField {
|
|
|
940
940
|
if (this.ngControl) {
|
|
941
941
|
this.ngControl.valueAccessor = this;
|
|
942
942
|
}
|
|
943
|
-
//
|
|
944
|
-
//
|
|
943
|
+
// Draft parents load column metadata only. Persisted parents load the
|
|
944
|
+
// Table projection, scoped to their record ID.
|
|
945
945
|
effect(() => {
|
|
946
946
|
const allowedRead = this.canRead();
|
|
947
947
|
const allowedWrite = this.writeAllowed();
|
|
@@ -951,17 +951,22 @@ class EntityListField {
|
|
|
951
951
|
const moduleId = this.moduleId();
|
|
952
952
|
const readFields = this.readFields();
|
|
953
953
|
untracked(() => {
|
|
954
|
+
this.fetchSubscription?.unsubscribe();
|
|
955
|
+
this.columns.set([]);
|
|
956
|
+
this.rows.set([]);
|
|
957
|
+
this.errorMessage.set(null);
|
|
954
958
|
if ((!allowedRead && !allowedWrite) ||
|
|
955
959
|
!ready ||
|
|
956
960
|
levelId == null ||
|
|
957
|
-
levelDataId == null ||
|
|
958
961
|
moduleId == null) {
|
|
959
|
-
this.columns.set([]);
|
|
960
|
-
this.rows.set([]);
|
|
961
|
-
this.errorMessage.set(null);
|
|
962
962
|
return;
|
|
963
963
|
}
|
|
964
|
-
|
|
964
|
+
if (levelDataId == null || Number(levelDataId) <= 0 || !allowedRead) {
|
|
965
|
+
this.fetchDraftColumns(levelId, moduleId, readFields);
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
this.fetchRows(levelId, levelDataId, moduleId, readFields);
|
|
969
|
+
}
|
|
965
970
|
});
|
|
966
971
|
});
|
|
967
972
|
}
|
|
@@ -1381,6 +1386,37 @@ class EntityListField {
|
|
|
1381
1386
|
// ============================================================================
|
|
1382
1387
|
// Read endpoint — POST /api/fetch/query (Table projection)
|
|
1383
1388
|
// ============================================================================
|
|
1389
|
+
fetchDraftColumns(levelId, moduleId, propertyKeys) {
|
|
1390
|
+
this.loading.set(true);
|
|
1391
|
+
const ctx = this.context();
|
|
1392
|
+
this.fetchSubscription = this.http
|
|
1393
|
+
.get('fetch/catalog', {
|
|
1394
|
+
params: { contextKey: `level:${levelId}/module:${moduleId}` },
|
|
1395
|
+
...(ctx ? { context: ctx } : {}),
|
|
1396
|
+
})
|
|
1397
|
+
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)))
|
|
1398
|
+
.subscribe({
|
|
1399
|
+
next: (response) => {
|
|
1400
|
+
const properties = response.data.properties.filter((property) => propertyKeys.includes(property.key) ||
|
|
1401
|
+
propertyKeys.includes(property.normalizedKey));
|
|
1402
|
+
this.applyResponse({
|
|
1403
|
+
catalog: { properties },
|
|
1404
|
+
records: [],
|
|
1405
|
+
projectionMeta: {
|
|
1406
|
+
columns: properties.map((property) => ({
|
|
1407
|
+
key: property.normalizedKey || property.key,
|
|
1408
|
+
label: property.label,
|
|
1409
|
+
viewType: property.viewType,
|
|
1410
|
+
order: property.order,
|
|
1411
|
+
visible: true,
|
|
1412
|
+
configuration: property.configuration ?? null,
|
|
1413
|
+
})),
|
|
1414
|
+
},
|
|
1415
|
+
});
|
|
1416
|
+
},
|
|
1417
|
+
error: () => this.errorMessage.set(this.transloco.translate('components.entityListField.loadFailed')),
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1384
1420
|
fetchRows(levelId, levelDataId, moduleId, propertyKeys) {
|
|
1385
1421
|
this.loading.set(true);
|
|
1386
1422
|
this.errorMessage.set(null);
|
|
@@ -1400,7 +1436,7 @@ class EntityListField {
|
|
|
1400
1436
|
page: 1,
|
|
1401
1437
|
pageSize: 3000,
|
|
1402
1438
|
};
|
|
1403
|
-
this.http
|
|
1439
|
+
this.fetchSubscription = this.http
|
|
1404
1440
|
.post('fetch/query', body, ctx ? { context: ctx } : {})
|
|
1405
1441
|
.pipe(takeUntilDestroyed(this.destroyRef), finalize(() => this.loading.set(false)), catchError((err) => {
|
|
1406
1442
|
console.error('EntityList fetch/query failed', err);
|
|
@@ -1486,7 +1522,7 @@ class EntityListField {
|
|
|
1486
1522
|
};
|
|
1487
1523
|
}
|
|
1488
1524
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1489
|
-
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 }, lookups: { classPropertyName: "lookups", publicName: "lookups", 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.
|
|
1525
|
+
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 }, lookups: { classPropertyName: "lookups", publicName: "lookups", 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.missingConfiguration\" | 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", "messageId"] }, { 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", "captionStartTemplate", "captionEndTemplate", "emptyTitle", "emptyDescription", "emptyActionLabel", "emptyActionIcon", "paginatorPosition", "alwaysShowPaginator", "rowsPerPageOptions", "pageSize", "currentPage", "first", "filterTerm", "groupBy", "sortField", "sortDirection"], outputs: ["selectionChange", "cellChange", "lazyLoad", "columnReorder", "rowReorder", "rowClick", "emptyAction", "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", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: TranslocoPipe, name: "transloco" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1490
1526
|
}
|
|
1491
1527
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: EntityListField, decorators: [{
|
|
1492
1528
|
type: Component,
|
|
@@ -1498,7 +1534,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
|
|
|
1498
1534
|
Table,
|
|
1499
1535
|
Button,
|
|
1500
1536
|
TranslocoPipe,
|
|
1501
|
-
], 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.
|
|
1537
|
+
], 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.missingConfiguration\" | 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"] }]
|
|
1502
1538
|
}], 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 }] }], lookups: [{ type: i0.Input, args: [{ isSignal: true, alias: "lookups", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: false }] }] } });
|
|
1503
1539
|
|
|
1504
1540
|
/** Page size when loading the full deliverable list, and a hard safety cap. */
|