@masterteam/components 0.0.193 → 0.0.195

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.
Files changed (41) hide show
  1. package/README.md +70 -70
  2. package/assets/common.css +1 -1
  3. package/assets/i18n/ar.json +2 -0
  4. package/assets/i18n/en.json +2 -0
  5. package/fesm2022/masterteam-components-business-fields.mjs +157 -72
  6. package/fesm2022/masterteam-components-business-fields.mjs.map +1 -1
  7. package/fesm2022/masterteam-components-drawer.mjs +2 -2
  8. package/fesm2022/masterteam-components-drawer.mjs.map +1 -1
  9. package/fesm2022/masterteam-components-dynamic-drawer.mjs.map +1 -1
  10. package/fesm2022/masterteam-components-entities.mjs +12 -12
  11. package/fesm2022/masterteam-components-entities.mjs.map +1 -1
  12. package/fesm2022/masterteam-components-formula.mjs +18 -4
  13. package/fesm2022/masterteam-components-formula.mjs.map +1 -1
  14. package/fesm2022/masterteam-components-icon-field.mjs.map +1 -1
  15. package/fesm2022/masterteam-components-location-field.mjs +143 -51
  16. package/fesm2022/masterteam-components-location-field.mjs.map +1 -1
  17. package/fesm2022/masterteam-components-multi-select-field.mjs +2 -2
  18. package/fesm2022/masterteam-components-multi-select-field.mjs.map +1 -1
  19. package/fesm2022/masterteam-components-number-field.mjs +2 -2
  20. package/fesm2022/masterteam-components-number-field.mjs.map +1 -1
  21. package/fesm2022/masterteam-components-radio-cards-field.mjs +2 -2
  22. package/fesm2022/masterteam-components-radio-cards-field.mjs.map +1 -1
  23. package/fesm2022/masterteam-components-runtime-action.mjs.map +1 -1
  24. package/fesm2022/masterteam-components-table.mjs +4 -4
  25. package/fesm2022/masterteam-components-table.mjs.map +1 -1
  26. package/fesm2022/masterteam-components-text-field.mjs +2 -2
  27. package/fesm2022/masterteam-components-text-field.mjs.map +1 -1
  28. package/fesm2022/masterteam-components-textarea-field.mjs +2 -2
  29. package/fesm2022/masterteam-components-textarea-field.mjs.map +1 -1
  30. package/fesm2022/masterteam-components-toggle-field.mjs +2 -2
  31. package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
  32. package/fesm2022/masterteam-components-upload-field.mjs +2 -2
  33. package/fesm2022/masterteam-components-upload-field.mjs.map +1 -1
  34. package/fesm2022/masterteam-components.mjs +13 -4
  35. package/fesm2022/masterteam-components.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/types/masterteam-components-business-fields.d.ts +94 -19
  38. package/types/masterteam-components-entities.d.ts +1 -1
  39. package/types/masterteam-components-location-field.d.ts +27 -9
  40. package/types/masterteam-components-table.d.ts +2 -2
  41. package/types/masterteam-components.d.ts +17 -2
@@ -1,4 +1,4 @@
1
- import { CommonModule } from '@angular/common';
1
+ import { CommonModule, NgComponentOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
3
  import { input, inject, DestroyRef, signal, computed, ChangeDetectionStrategy, Component, effect, untracked, viewChild, linkedSignal, InjectionToken } from '@angular/core';
4
4
  import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
@@ -19,7 +19,6 @@ import { Table } from '@masterteam/components/table';
19
19
  import { Skeleton } from 'primeng/skeleton';
20
20
  import { Message } from 'primeng/message';
21
21
  import { ModalService } from '@masterteam/components/modal';
22
- import { Select } from 'primeng/select';
23
22
  import * as i2$1 from 'primeng/inputtext';
24
23
  import { InputTextModule } from 'primeng/inputtext';
25
24
 
@@ -1186,31 +1185,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1186
1185
  }, template: "@if (isMultiple()) {\r\n <mt-multi-select-field\r\n [label]=\"label()\"\r\n [placeholder]=\"placeholder()\"\r\n [options]=\"options()\"\r\n [optionLabel]=\"'label'\"\r\n [optionValue]=\"'value'\"\r\n [filter]=\"options().length > 10\"\r\n [showClear]=\"!required()\"\r\n [required]=\"required()\"\r\n [readonly]=\"readonly() || disabled()\"\r\n [ngModel]=\"value()\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"onMultiChange($event)\"\r\n />\r\n} @else {\r\n <mt-select-field\r\n [label]=\"label()\"\r\n [placeholder]=\"placeholder()\"\r\n [options]=\"options()\"\r\n [optionLabel]=\"'label'\"\r\n [optionValue]=\"'value'\"\r\n [filter]=\"options().length > 10\"\r\n [showClear]=\"!required()\"\r\n [loading]=\"loading()\"\r\n [required]=\"required()\"\r\n [readonly]=\"readonly() || disabled()\"\r\n [ngModel]=\"singleValue()\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"onSingleChange($event)\"\r\n />\r\n}\r\n" }]
1187
1186
  }], 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 }] }] } });
1188
1187
 
1188
+ /**
1189
+ * Token used by `mt-lookup-module-check-list-field` to render the checklist
1190
+ * sections + per-section forms via `@masterteam/forms`'s `mt-client-form`
1191
+ * machinery (`/api/process-form-load`, loaded once). Apps register it with
1192
+ * `provideLookupModuleCheckListForm()` from
1193
+ * `@masterteam/forms/lookup-module-check-list-form`. When the token is not
1194
+ * registered, the field falls back to plain text inputs per property.
1195
+ */
1196
+ const LOOKUP_CHECK_LIST_FORM_COMPONENT = new InjectionToken('LOOKUP_CHECK_LIST_FORM_COMPONENT');
1197
+
1189
1198
  class LookupModuleCheckListField {
1190
1199
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
1191
1200
  readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
1192
1201
  required = input(false, ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
1193
- /** Lookup items the user can pick for each checklist entry. */
1202
+ /** Lookup items rendered as collapsible checklist sections. */
1194
1203
  lookupOptions = input([], ...(ngDevMode ? [{ debugName: "lookupOptions" }] : /* istanbul ignore next */ []));
1195
- /** Module property keys/labels captured per checklist entry. */
1204
+ /** Module property keys/labels (used by the text fallback + labels). */
1196
1205
  propertyFields = input([], ...(ngDevMode ? [{ debugName: "propertyFields" }] : /* istanbul ignore next */ []));
1197
- entries = signal([], ...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
1206
+ /** Scope module id whose form is loaded for each section. */
1207
+ scopeId = input(null, ...(ngDevMode ? [{ debugName: "scopeId" }] : /* istanbul ignore next */ []));
1208
+ /** Property keys to render in each section form. */
1209
+ propertyKeys = input([], ...(ngDevMode ? [{ debugName: "propertyKeys" }] : /* istanbul ignore next */ []));
1210
+ /** Runtime ids needed to load each section form. */
1211
+ runtimeContext = input(null, ...(ngDevMode ? [{ debugName: "runtimeContext" }] : /* istanbul ignore next */ []));
1212
+ /** Per-lookupKey captured values, keyed by property key. */
1213
+ sectionValues = signal({}, ...(ngDevMode ? [{ debugName: "sectionValues" }] : /* istanbul ignore next */ []));
1214
+ expandedKeys = signal(new Set(), ...(ngDevMode ? [{ debugName: "expandedKeys" }] : /* istanbul ignore next */ []));
1198
1215
  disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
1216
+ /** True when a section's required inner fields are unfilled. */
1217
+ incomplete = signal(false, ...(ngDevMode ? [{ debugName: "incomplete" }] : /* istanbul ignore next */ []));
1199
1218
  ngControl = null;
1219
+ /**
1220
+ * Rich checklist form provided by `@masterteam/forms`
1221
+ * (`provideLookupModuleCheckListForm()`). When absent the field falls back to
1222
+ * plain text inputs per property.
1223
+ */
1224
+ formComponent = inject(LOOKUP_CHECK_LIST_FORM_COMPONENT, {
1225
+ optional: true,
1226
+ });
1200
1227
  isReadonly = computed(() => this.readonly() || this.disabled(), ...(ngDevMode ? [{ debugName: "isReadonly" }] : /* istanbul ignore next */ []));
1228
+ sections = computed(() => this.lookupOptions().map((option) => ({
1229
+ lookupKey: String(option.value ?? option.key ?? ''),
1230
+ label: option.label ?? String(option.value ?? option.key ?? ''),
1231
+ })), ...(ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []));
1232
+ /** Use the rich form only when registered and the runtime context is ready. */
1233
+ useRichForm = computed(() => !!this.formComponent &&
1234
+ this.scopeId() != null &&
1235
+ this.runtimeContext()?.levelId != null &&
1236
+ this.runtimeContext()?.levelDataId != null, ...(ngDevMode ? [{ debugName: "useRichForm" }] : /* istanbul ignore next */ []));
1237
+ /**
1238
+ * The last externally-written value (via `writeValue`). Passed to the rich
1239
+ * form as its initial value. It is intentionally NOT updated from the form's
1240
+ * own `valueChange` — feeding emitted values back as an input would create an
1241
+ * infinite change-detection loop.
1242
+ */
1243
+ incomingValue = signal(null, ...(ngDevMode ? [{ debugName: "incomingValue" }] : /* istanbul ignore next */ []));
1201
1244
  onTouched = () => { };
1202
1245
  onModelChange = () => { };
1246
+ control = null;
1247
+ validatorAttached = false;
1248
+ /**
1249
+ * Validator attached imperatively to the host control. Attaching it here
1250
+ * (rather than via an `NG_VALIDATORS` provider) avoids a circular dependency
1251
+ * with the self-injected `NgControl` used as the value accessor.
1252
+ */
1253
+ checklistValidator = () => this.incomplete() ? { checklistIncomplete: true } : null;
1254
+ /** Stable callbacks so the outlet inputs object stays referentially calm. */
1255
+ emitValue = (value) => {
1256
+ // The rich form is the source of truth; forward its value without writing
1257
+ // back into `incomingValue` (which would re-feed the form and loop).
1258
+ this.onModelChange(value ?? null);
1259
+ this.onTouched();
1260
+ };
1261
+ emitValidity = (invalid) => {
1262
+ if (this.incomplete() === invalid)
1263
+ return;
1264
+ this.incomplete.set(invalid);
1265
+ this.ensureValidator();
1266
+ this.control?.updateValueAndValidity({ emitEvent: false });
1267
+ };
1203
1268
  constructor() {
1204
1269
  this.ngControl = inject(NgControl, { self: true, optional: true });
1205
1270
  if (this.ngControl) {
1206
1271
  this.ngControl.valueAccessor = this;
1207
1272
  }
1208
1273
  }
1274
+ ngOnInit() {
1275
+ this.ensureValidator();
1276
+ this.control?.updateValueAndValidity({ emitEvent: false });
1277
+ }
1278
+ ensureValidator() {
1279
+ if (this.validatorAttached)
1280
+ return;
1281
+ const control = this.ngControl?.control;
1282
+ if (!control)
1283
+ return;
1284
+ this.control = control;
1285
+ control.addValidators(this.checklistValidator);
1286
+ this.validatorAttached = true;
1287
+ }
1209
1288
  // ============================================================================
1210
1289
  // CVA
1211
1290
  // ============================================================================
1212
1291
  writeValue(value) {
1213
- this.entries.set(this.normalizeIncoming(value));
1292
+ this.incomingValue.set(value);
1293
+ this.sectionValues.set(this.normalizeIncoming(value));
1214
1294
  }
1215
1295
  registerOnChange(fn) {
1216
1296
  this.onModelChange = fn;
@@ -1222,63 +1302,84 @@ class LookupModuleCheckListField {
1222
1302
  this.disabled.set(isDisabled);
1223
1303
  }
1224
1304
  // ============================================================================
1225
- // Editing
1305
+ // Rich form host
1226
1306
  // ============================================================================
1227
- addEntry() {
1228
- if (this.isReadonly())
1229
- return;
1230
- this.entries.update((current) => [
1231
- ...current,
1232
- { lookupKey: '', values: {} },
1233
- ]);
1234
- this.emit();
1307
+ formInputs = computed(() => ({
1308
+ lookupOptions: this.lookupOptions(),
1309
+ propertyKeys: this.propertyKeys(),
1310
+ moduleId: this.scopeId(),
1311
+ levelId: this.runtimeContext()?.levelId ?? null,
1312
+ levelDataId: this.runtimeContext()?.levelDataId ?? null,
1313
+ value: this.incomingValue(),
1314
+ readonly: this.isReadonly(),
1315
+ valueChange: this.emitValue,
1316
+ validityChange: this.emitValidity,
1317
+ }), ...(ngDevMode ? [{ debugName: "formInputs" }] : /* istanbul ignore next */ []));
1318
+ // ============================================================================
1319
+ // Text fallback (no rich form registered)
1320
+ // ============================================================================
1321
+ isExpanded(lookupKey) {
1322
+ return this.expandedKeys().has(lookupKey);
1235
1323
  }
1236
- removeEntry(index) {
1237
- if (this.isReadonly())
1238
- return;
1239
- this.entries.update((current) => current.filter((_, i) => i !== index));
1240
- this.emit();
1324
+ toggle(lookupKey) {
1325
+ const next = new Set(this.expandedKeys());
1326
+ if (next.has(lookupKey)) {
1327
+ next.delete(lookupKey);
1328
+ }
1329
+ else {
1330
+ next.add(lookupKey);
1331
+ }
1332
+ this.expandedKeys.set(next);
1241
1333
  }
1242
- setLookupKey(index, lookupKey) {
1243
- this.entries.update((current) => current.map((entry, i) => i === index
1244
- ? { ...entry, lookupKey: lookupKey == null ? '' : String(lookupKey) }
1245
- : entry));
1246
- this.emit();
1334
+ hasValues(lookupKey) {
1335
+ const values = this.sectionValues()[lookupKey];
1336
+ if (!values)
1337
+ return false;
1338
+ return Object.values(values).some((v) => v != null && v !== '');
1247
1339
  }
1248
- setPropValue(index, key, value) {
1249
- this.entries.update((current) => current.map((entry, i) => i === index
1250
- ? { ...entry, values: { ...entry.values, [key]: value } }
1251
- : entry));
1252
- this.emit();
1340
+ fieldValue(lookupKey, propKey) {
1341
+ const raw = this.sectionValues()[lookupKey]?.[propKey];
1342
+ return raw == null ? '' : String(raw);
1253
1343
  }
1254
- lookupLabel(lookupKey) {
1255
- const option = this.lookupOptions().find((item) => String(item.value) === lookupKey || item.key === lookupKey);
1256
- return option?.label ?? lookupKey;
1344
+ setFieldValue(lookupKey, propKey, value) {
1345
+ this.sectionValues.update((current) => ({
1346
+ ...current,
1347
+ [lookupKey]: { ...(current[lookupKey] ?? {}), [propKey]: value },
1348
+ }));
1349
+ this.pushModelValue();
1257
1350
  }
1258
1351
  // ============================================================================
1259
1352
  // Value mapping
1260
1353
  // ============================================================================
1261
- emit() {
1262
- const fields = this.propertyFields();
1263
- const payload = this.entries()
1264
- .filter((entry) => entry.lookupKey)
1265
- .map((entry) => ({
1266
- lookupKey: entry.lookupKey,
1267
- props: fields.map((field) => ({
1268
- key: field.key,
1269
- value: entry.values[field.key] ?? null,
1270
- })),
1271
- }));
1354
+ pushModelValue() {
1355
+ const payload = this.buildPayload();
1272
1356
  this.onModelChange(payload.length ? payload : null);
1273
1357
  this.onTouched();
1274
1358
  }
1359
+ buildPayload() {
1360
+ const keys = this.propertyKeys();
1361
+ const values = this.sectionValues();
1362
+ return this.sections()
1363
+ .filter((section) => this.hasValues(section.lookupKey))
1364
+ .map((section) => ({
1365
+ lookupKey: section.lookupKey,
1366
+ props: keys.map((key) => ({
1367
+ key,
1368
+ value: values[section.lookupKey]?.[key] ?? null,
1369
+ })),
1370
+ }));
1371
+ }
1275
1372
  normalizeIncoming(value) {
1276
1373
  const raw = this.extractEntries(value);
1277
- return raw
1278
- .filter((entry) => entry && typeof entry === 'object')
1279
- .map((entry) => {
1374
+ const result = {};
1375
+ for (const entry of raw) {
1376
+ if (!entry || typeof entry !== 'object')
1377
+ continue;
1280
1378
  const record = entry;
1281
1379
  const lookupKeyRaw = record['lookupKey'] ?? record['Lookupkey'] ?? record['lookupkey'];
1380
+ const lookupKey = lookupKeyRaw == null ? '' : String(lookupKeyRaw);
1381
+ if (!lookupKey)
1382
+ continue;
1282
1383
  const propsRaw = record['props'] ?? record['Props'];
1283
1384
  const values = {};
1284
1385
  if (Array.isArray(propsRaw)) {
@@ -1287,14 +1388,12 @@ class LookupModuleCheckListField {
1287
1388
  const key = String(propRecord['key'] ?? propRecord['Key'] ?? '');
1288
1389
  if (!key)
1289
1390
  continue;
1290
- values[key] = this.coerceToString(propRecord['value'] ?? propRecord['Value'] ?? null);
1391
+ values[key] = propRecord['value'] ?? propRecord['Value'] ?? null;
1291
1392
  }
1292
1393
  }
1293
- return {
1294
- lookupKey: lookupKeyRaw == null ? '' : String(lookupKeyRaw),
1295
- values,
1296
- };
1297
- });
1394
+ result[lookupKey] = values;
1395
+ }
1396
+ return result;
1298
1397
  }
1299
1398
  extractEntries(value) {
1300
1399
  if (Array.isArray(value)) {
@@ -1314,38 +1413,24 @@ class LookupModuleCheckListField {
1314
1413
  }
1315
1414
  return [];
1316
1415
  }
1317
- coerceToString(value) {
1318
- if (value === null || value === undefined)
1319
- return '';
1320
- if (typeof value === 'object') {
1321
- try {
1322
- return JSON.stringify(value);
1323
- }
1324
- catch {
1325
- return String(value);
1326
- }
1327
- }
1328
- return String(value);
1329
- }
1330
1416
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LookupModuleCheckListField, deps: [], target: i0.ɵɵFactoryTarget.Component });
1331
- 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 }, propertyFields: { classPropertyName: "propertyFields", publicName: "propertyFields", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "grid gap-2" }, 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 @for (entry of entries(); track $index) {\r\n <div class=\"rounded-lg border border-surface-200 bg-surface-50 p-3\">\r\n <div class=\"flex items-start gap-2\">\r\n <div class=\"min-w-0 flex-1\">\r\n @if (isReadonly()) {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-primary-50 px-2 py-1 text-xs font-semibold text-primary-700\"\r\n >\r\n {{ lookupLabel(entry.lookupKey) }}\r\n </span>\r\n } @else {\r\n <p-select\r\n [options]=\"lookupOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [filter]=\"lookupOptions().length > 10\"\r\n [showClear]=\"true\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n [placeholder]=\"\r\n 'components.lookupModuleCheckListField.selectLookup' | transloco\r\n \"\r\n [ngModel]=\"entry.lookupKey\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"setLookupKey($index, $event)\"\r\n />\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 rounded-md p-2 text-muted-color hover:bg-surface-100 hover:text-red-600\"\r\n [attr.aria-label]=\"\r\n 'components.lookupModuleCheckListField.removeEntry' | transloco\r\n \"\r\n (click)=\"removeEntry($index)\"\r\n >\r\n <mt-icon icon=\"general.trash-01\" size=\"sm\" />\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (propertyFields().length) {\r\n <div class=\"mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2\">\r\n @for (field of propertyFields(); track field.key) {\r\n <label class=\"flex min-w-0 flex-col gap-1\">\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ field.label }}\r\n </span>\r\n @if (isReadonly()) {\r\n <span class=\"truncate text-sm text-color\">\r\n {{ entry.values[field.key] || \"_\" }}\r\n </span>\r\n } @else {\r\n <input\r\n pInputText\r\n class=\"w-full\"\r\n [ngModel]=\"entry.values[field.key] ?? ''\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"setPropValue($index, field.key, $event)\"\r\n />\r\n }\r\n </label>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.lookupModuleCheckListField.addEntry' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n variant=\"outlined\"\r\n (onClick)=\"addEntry()\"\r\n />\r\n </div>\r\n } @else if (!entries().length) {\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.lookupModuleCheckListField.empty\" | transloco }}\r\n </div>\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", 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: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { 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: 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 });
1417
+ 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 }, 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\">\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 (useRichForm()) {\r\n <ng-container\r\n [ngComponentOutlet]=\"formComponent!\"\r\n [ngComponentOutletInputs]=\"formInputs()\"\r\n />\r\n } @else if (sections().length) {\r\n <!-- Fallback: plain text inputs per property (no rich form registered) -->\r\n <div class=\"flex flex-col gap-2\">\r\n @for (section of sections(); track section.lookupKey) {\r\n <div class=\"overflow-hidden rounded-lg border border-surface-200\">\r\n <button\r\n type=\"button\"\r\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\"\r\n [attr.aria-expanded]=\"isExpanded(section.lookupKey)\"\r\n (click)=\"toggle(section.lookupKey)\"\r\n >\r\n <span class=\"flex min-w-0 items-center gap-2\">\r\n <mt-icon\r\n [icon]=\"\r\n isExpanded(section.lookupKey)\r\n ? 'arrow.chevron-down'\r\n : 'arrow.chevron-right'\r\n \"\r\n size=\"sm\"\r\n class=\"shrink-0 text-muted-color rtl:-scale-x-100\"\r\n />\r\n <span class=\"truncate text-sm font-medium text-color\">\r\n {{ section.label }}\r\n </span>\r\n </span>\r\n @if (hasValues(section.lookupKey)) {\r\n <span\r\n class=\"shrink-0 rounded-full bg-primary-50 px-2 py-0.5 text-xs font-semibold text-primary-700\"\r\n >\r\n {{ \"components.lookupModuleCheckListField.filled\" | transloco }}\r\n </span>\r\n }\r\n </button>\r\n\r\n @if (isExpanded(section.lookupKey) && propertyFields().length) {\r\n <div class=\"border-t border-surface-200 p-3\">\r\n <div class=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\r\n @for (field of propertyFields(); track field.key) {\r\n <label class=\"flex min-w-0 flex-col gap-1\">\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ field.label }}\r\n </span>\r\n @if (isReadonly()) {\r\n <span class=\"truncate text-sm text-color\">\r\n {{ fieldValue(section.lookupKey, field.key) || \"_\" }}\r\n </span>\r\n } @else {\r\n <input\r\n pInputText\r\n class=\"w-full\"\r\n [ngModel]=\"fieldValue(section.lookupKey, field.key)\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"\r\n setFieldValue(section.lookupKey, field.key, $event)\r\n \"\r\n />\r\n }\r\n </label>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n } @else {\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.lookupModuleCheckListField.empty\" | transloco }}\r\n </div>\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", 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 });
1332
1418
  }
1333
1419
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: LookupModuleCheckListField, decorators: [{
1334
1420
  type: Component,
1335
1421
  args: [{ selector: 'mt-lookup-module-check-list-field', standalone: true, imports: [
1336
1422
  FormsModule,
1337
- Select,
1423
+ NgComponentOutlet,
1338
1424
  InputTextModule,
1339
- Button,
1340
1425
  Icon,
1341
1426
  FieldValidation,
1342
1427
  TranslocoPipe,
1343
- ], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-2' }, 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 @for (entry of entries(); track $index) {\r\n <div class=\"rounded-lg border border-surface-200 bg-surface-50 p-3\">\r\n <div class=\"flex items-start gap-2\">\r\n <div class=\"min-w-0 flex-1\">\r\n @if (isReadonly()) {\r\n <span\r\n class=\"inline-flex w-fit items-center rounded-md bg-primary-50 px-2 py-1 text-xs font-semibold text-primary-700\"\r\n >\r\n {{ lookupLabel(entry.lookupKey) }}\r\n </span>\r\n } @else {\r\n <p-select\r\n [options]=\"lookupOptions()\"\r\n optionLabel=\"label\"\r\n optionValue=\"value\"\r\n [filter]=\"lookupOptions().length > 10\"\r\n [showClear]=\"true\"\r\n appendTo=\"body\"\r\n styleClass=\"w-full\"\r\n [placeholder]=\"\r\n 'components.lookupModuleCheckListField.selectLookup' | transloco\r\n \"\r\n [ngModel]=\"entry.lookupKey\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"setLookupKey($index, $event)\"\r\n />\r\n }\r\n </div>\r\n\r\n @if (!isReadonly()) {\r\n <button\r\n type=\"button\"\r\n class=\"shrink-0 rounded-md p-2 text-muted-color hover:bg-surface-100 hover:text-red-600\"\r\n [attr.aria-label]=\"\r\n 'components.lookupModuleCheckListField.removeEntry' | transloco\r\n \"\r\n (click)=\"removeEntry($index)\"\r\n >\r\n <mt-icon icon=\"general.trash-01\" size=\"sm\" />\r\n </button>\r\n }\r\n </div>\r\n\r\n @if (propertyFields().length) {\r\n <div class=\"mt-3 grid grid-cols-1 gap-3 sm:grid-cols-2\">\r\n @for (field of propertyFields(); track field.key) {\r\n <label class=\"flex min-w-0 flex-col gap-1\">\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ field.label }}\r\n </span>\r\n @if (isReadonly()) {\r\n <span class=\"truncate text-sm text-color\">\r\n {{ entry.values[field.key] || \"_\" }}\r\n </span>\r\n } @else {\r\n <input\r\n pInputText\r\n class=\"w-full\"\r\n [ngModel]=\"entry.values[field.key] ?? ''\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"setPropValue($index, field.key, $event)\"\r\n />\r\n }\r\n </label>\r\n }\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (!isReadonly()) {\r\n <div class=\"flex justify-end\">\r\n <mt-button\r\n [label]=\"'components.lookupModuleCheckListField.addEntry' | transloco\"\r\n icon=\"general.plus\"\r\n size=\"small\"\r\n variant=\"outlined\"\r\n (onClick)=\"addEntry()\"\r\n />\r\n </div>\r\n } @else if (!entries().length) {\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.lookupModuleCheckListField.empty\" | transloco }}\r\n </div>\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" }]
1344
- }], 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 }] }], propertyFields: [{ type: i0.Input, args: [{ isSignal: true, alias: "propertyFields", required: false }] }] } });
1428
+ ], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'grid gap-2' }, 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 (useRichForm()) {\r\n <ng-container\r\n [ngComponentOutlet]=\"formComponent!\"\r\n [ngComponentOutletInputs]=\"formInputs()\"\r\n />\r\n } @else if (sections().length) {\r\n <!-- Fallback: plain text inputs per property (no rich form registered) -->\r\n <div class=\"flex flex-col gap-2\">\r\n @for (section of sections(); track section.lookupKey) {\r\n <div class=\"overflow-hidden rounded-lg border border-surface-200\">\r\n <button\r\n type=\"button\"\r\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\"\r\n [attr.aria-expanded]=\"isExpanded(section.lookupKey)\"\r\n (click)=\"toggle(section.lookupKey)\"\r\n >\r\n <span class=\"flex min-w-0 items-center gap-2\">\r\n <mt-icon\r\n [icon]=\"\r\n isExpanded(section.lookupKey)\r\n ? 'arrow.chevron-down'\r\n : 'arrow.chevron-right'\r\n \"\r\n size=\"sm\"\r\n class=\"shrink-0 text-muted-color rtl:-scale-x-100\"\r\n />\r\n <span class=\"truncate text-sm font-medium text-color\">\r\n {{ section.label }}\r\n </span>\r\n </span>\r\n @if (hasValues(section.lookupKey)) {\r\n <span\r\n class=\"shrink-0 rounded-full bg-primary-50 px-2 py-0.5 text-xs font-semibold text-primary-700\"\r\n >\r\n {{ \"components.lookupModuleCheckListField.filled\" | transloco }}\r\n </span>\r\n }\r\n </button>\r\n\r\n @if (isExpanded(section.lookupKey) && propertyFields().length) {\r\n <div class=\"border-t border-surface-200 p-3\">\r\n <div class=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\r\n @for (field of propertyFields(); track field.key) {\r\n <label class=\"flex min-w-0 flex-col gap-1\">\r\n <span class=\"truncate text-xs text-muted-color\">\r\n {{ field.label }}\r\n </span>\r\n @if (isReadonly()) {\r\n <span class=\"truncate text-sm text-color\">\r\n {{ fieldValue(section.lookupKey, field.key) || \"_\" }}\r\n </span>\r\n } @else {\r\n <input\r\n pInputText\r\n class=\"w-full\"\r\n [ngModel]=\"fieldValue(section.lookupKey, field.key)\"\r\n [ngModelOptions]=\"{ standalone: true }\"\r\n (ngModelChange)=\"\r\n setFieldValue(section.lookupKey, field.key, $event)\r\n \"\r\n />\r\n }\r\n </label>\r\n }\r\n </div>\r\n </div>\r\n }\r\n </div>\r\n }\r\n </div>\r\n } @else {\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.lookupModuleCheckListField.empty\" | transloco }}\r\n </div>\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" }]
1429
+ }], 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 }] }], 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 }] }] } });
1345
1430
 
1346
1431
  /**
1347
1432
  * Generated bundle index. Do not edit.
1348
1433
  */
1349
1434
 
1350
- export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField };
1435
+ export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LOOKUP_CHECK_LIST_FORM_COMPONENT, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField };
1351
1436
  //# sourceMappingURL=masterteam-components-business-fields.mjs.map