@mmlogic/components 0.5.15 → 0.5.17

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 (40) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mosterdcomponents.cjs.js +1 -1
  3. package/dist/cjs/mrd-boolean-field_28.cjs.entry.js +361 -56
  4. package/dist/collection/collection-manifest.json +2 -2
  5. package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +31 -4
  6. package/dist/collection/components/form/mrd-field/mrd-field.css +69 -0
  7. package/dist/collection/components/form/mrd-field/mrd-field.js +95 -25
  8. package/dist/collection/components/layout/mrd-layout-section/field-value.js +19 -2
  9. package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +10 -0
  10. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +4 -3
  11. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +174 -17
  12. package/dist/collection/components/memo/mrd-memo-container/mrd-memo-container.js +105 -6
  13. package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.css +14 -0
  14. package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.js +50 -2
  15. package/dist/collection/components/table/mrd-table/mrd-table.js +105 -2
  16. package/dist/collection/dev/api.js +17 -0
  17. package/dist/collection/dev/app.js +49 -15
  18. package/dist/collection/dev/example-data.js +15 -1
  19. package/dist/components/mrd-document-container2.js +1 -1
  20. package/dist/components/mrd-field2.js +1 -1
  21. package/dist/components/mrd-layout-section.js +1 -1
  22. package/dist/components/mrd-memo-container2.js +1 -1
  23. package/dist/components/mrd-memo-list2.js +1 -1
  24. package/dist/components/mrd-table2.js +1 -1
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/mosterdcomponents.js +1 -1
  27. package/dist/esm/mrd-boolean-field_28.entry.js +361 -56
  28. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  29. package/dist/mosterdcomponents/p-f72668e9.entry.js +3 -0
  30. package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +7 -0
  31. package/dist/types/components/form/mrd-field/mrd-field.d.ts +16 -0
  32. package/dist/types/components/layout/mrd-layout-section/field-value.d.ts +4 -0
  33. package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +3 -0
  34. package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +52 -0
  35. package/dist/types/components/memo/mrd-memo-container/mrd-memo-container.d.ts +26 -1
  36. package/dist/types/components/memo/mrd-memo-list/mrd-memo-list.d.ts +12 -0
  37. package/dist/types/components/table/mrd-table/mrd-table.d.ts +45 -0
  38. package/dist/types/components.d.ts +92 -0
  39. package/package.json +1 -1
  40. package/dist/mosterdcomponents/p-d64ba1f2.entry.js +0 -3
@@ -367,6 +367,13 @@ const MrdDocumentContainer = class {
367
367
  * (with a tooltip explaining why) and the embedded table/list get it passed
368
368
  * through so their own create/upload/drag-drop paths are disabled too. */
369
369
  this.readOnly = false;
370
+ /** Whether the current user may create a document here — set by mrd-layout-section from
371
+ * its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded
372
+ * table gets in list mode. Named `mayCreate` (not `canCreate`) to avoid colliding with
373
+ * the existing `canCreate` state below, which tracks something unrelated: whether the
374
+ * folder tree currently has a valid drop target selected. Defaults to false (hidden)
375
+ * until confirmed, same as mrd-table. */
376
+ this.mayCreate = false;
370
377
  /** Active body: folder tree or flat table. */
371
378
  this.mode = 'tree';
372
379
  /** Whether the folder tree currently has a valid target for "New folder". */
@@ -381,7 +388,7 @@ const MrdDocumentContainer = class {
381
388
  };
382
389
  this.pickFile = () => {
383
390
  var _a;
384
- if (this.readOnly)
391
+ if (this.readOnly || !this.mayCreate)
385
392
  return;
386
393
  (_a = this.fileInputEl) === null || _a === void 0 ? void 0 : _a.click();
387
394
  };
@@ -419,7 +426,7 @@ const MrdDocumentContainer = class {
419
426
  }
420
427
  // ── Toolbar ────────────────────────────────────────────────────────────────
421
428
  renderToolbar() {
422
- return (index.h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (index.h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : undefined, onClick: this.createFolder }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), index.h("path", { d: "M12 11v4M10 13h4" })), cellRenderer.t('new_folder', this.locale))), this.mode === 'tree' && (index.h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : (this.targetLabel ? `${cellRenderer.t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined), onClick: this.pickFile }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), index.h("path", { d: "M12 3v13M7 8l5-5 5 5" })), cellRenderer.t('doc_upload', this.locale))), index.h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), index.h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": cellRenderer.t('doc_view_switch', this.locale) }, index.h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: cellRenderer.t('doc_view_tree', this.locale), "aria-label": cellRenderer.t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 5h6M3 12h9M3 19h6" }), index.h("circle", { cx: "18", cy: "5", r: "1.6" }), index.h("circle", { cx: "18", cy: "19", r: "1.6" }), index.h("path", { d: "M16 12h4" }))), index.h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: cellRenderer.t('doc_view_list', this.locale), "aria-label": cellRenderer.t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
429
+ return (index.h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && this.mayCreate && (index.h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : undefined, onClick: this.createFolder }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), index.h("path", { d: "M12 11v4M10 13h4" })), cellRenderer.t('new_folder', this.locale))), this.mode === 'tree' && this.mayCreate && (index.h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : (this.targetLabel ? `${cellRenderer.t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined), onClick: this.pickFile }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), index.h("path", { d: "M12 3v13M7 8l5-5 5 5" })), cellRenderer.t('doc_upload', this.locale))), index.h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), index.h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": cellRenderer.t('doc_view_switch', this.locale) }, index.h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: cellRenderer.t('doc_view_tree', this.locale), "aria-label": cellRenderer.t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 5h6M3 12h9M3 19h6" }), index.h("circle", { cx: "18", cy: "5", r: "1.6" }), index.h("circle", { cx: "18", cy: "19", r: "1.6" }), index.h("path", { d: "M16 12h4" }))), index.h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: cellRenderer.t('doc_view_list', this.locale), "aria-label": cellRenderer.t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
423
430
  }
424
431
  // ── Bodies ───────────────────────────────────────────────────────────────
425
432
  renderTree() {
@@ -450,7 +457,7 @@ const MrdDocumentContainer = class {
450
457
  } }));
451
458
  }
452
459
  renderList() {
453
- return (index.h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, onMrdLoadPage: (e) => {
460
+ return (index.h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, canCreate: this.mayCreate, onMrdLoadPage: (e) => {
454
461
  e.stopPropagation();
455
462
  this.mrdLoadPage.emit(e.detail);
456
463
  }, onMrdLoadAggregations: (e) => {
@@ -474,7 +481,7 @@ const MrdDocumentContainer = class {
474
481
  }
475
482
  render() {
476
483
  const treeMode = this.mode === 'tree';
477
- return (index.h(index.Host, { key: '6792d49f08dd19f6c51e4b656df06bbd8bc14f3e' }, this.renderToolbar(), index.h("div", { key: '702f4c288f8c40bd2c5999beb392b9dfd022b0bc', class: {
484
+ return (index.h(index.Host, { key: '4b674a508ac7ddf6af80a40836b72dc65f41c741' }, this.renderToolbar(), index.h("div", { key: '19968916f685a2e3cd075dabf170f67fb104251c', class: {
478
485
  'mrd-document-container__body': true,
479
486
  'mrd-document-container__body--tree': treeMode,
480
487
  }, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
@@ -4081,7 +4088,7 @@ const MrdEmailView = class {
4081
4088
  };
4082
4089
  MrdEmailView.style = mrdEmailViewCss();
4083
4090
 
4084
- const mrdFieldCss = () => `.sc-mrd-field-h{display:block}.mrd-field__inner.sc-mrd-field{display:block;width:100%}.mrd-field__history-editor.sc-mrd-field{margin-top:var(--mrd-space-2);display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-field__history-editor-label.sc-mrd-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-500)}.mrd-field__history-editor-row.sc-mrd-field{display:flex;align-items:center;gap:var(--mrd-space-2)}.mrd-field__history-editor-sep.sc-mrd-field{flex-shrink:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500)}.mrd-field__history-editor-value.sc-mrd-field{flex:1 1 0;min-width:0;height:var(--mrd-input-height);padding:0 var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800);background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);outline:none;transition:border-color var(--mrd-transition-fast), box-shadow var(--mrd-transition-fast)}.mrd-field__history-editor-value.sc-mrd-field:focus{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-focus)}.mrd-field__history-editor-until.sc-mrd-field{flex:0 0 10rem;height:var(--mrd-input-height);padding:0 var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800);background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);outline:none;transition:border-color var(--mrd-transition-fast), box-shadow var(--mrd-transition-fast)}.mrd-field__history-editor-until.sc-mrd-field:focus{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-focus)}.mrd-field__history-editor-remove.sc-mrd-field{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:2rem;height:2rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-field__history-editor-remove.sc-mrd-field:hover{color:var(--mrd-color-danger);background-color:var(--mrd-color-danger-light)}.mrd-field__history-editor-remove.sc-mrd-field svg.sc-mrd-field{width:1rem;height:1rem}.mrd-field__history-editor-add.sc-mrd-field{align-self:flex-start;padding:var(--mrd-space-1) var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary);background:transparent;border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius-md);cursor:pointer;transition:background-color var(--mrd-transition-fast), color var(--mrd-transition-fast)}.mrd-field__history-editor-add.sc-mrd-field:hover{background-color:var(--mrd-color-primary-light)}`;
4091
+ const mrdFieldCss = () => `.sc-mrd-field-h{display:block}.mrd-field__inner.sc-mrd-field{display:block;width:100%}.mrd-field__history-editor.sc-mrd-field{margin-top:var(--mrd-space-2);display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-field__history-editor-label.sc-mrd-field{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-500)}.mrd-field__history-editor-row.sc-mrd-field{display:flex;align-items:center;gap:var(--mrd-space-2)}.mrd-field__history-editor-sep.sc-mrd-field{flex-shrink:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500)}.mrd-field__history-editor-value.sc-mrd-field{flex:1 1 0;min-width:0;height:var(--mrd-input-height);padding:0 var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800);background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);outline:none;transition:border-color var(--mrd-transition-fast), box-shadow var(--mrd-transition-fast)}.mrd-field__history-editor-value.sc-mrd-field:focus{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-focus)}.mrd-field__history-editor-until.sc-mrd-field{flex:0 0 10rem;height:var(--mrd-input-height);padding:0 var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800);background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);outline:none;transition:border-color var(--mrd-transition-fast), box-shadow var(--mrd-transition-fast)}.mrd-field__history-editor-until.sc-mrd-field:focus{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-focus)}.mrd-field__history-editor-remove.sc-mrd-field{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:2rem;height:2rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-field__history-editor-remove.sc-mrd-field:hover{color:var(--mrd-color-danger);background-color:var(--mrd-color-danger-light)}.mrd-field__history-editor-remove.sc-mrd-field svg.sc-mrd-field{width:1rem;height:1rem}.mrd-field__history-editor-add.sc-mrd-field{align-self:flex-start;padding:var(--mrd-space-1) var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary);background:transparent;border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius-md);cursor:pointer;transition:background-color var(--mrd-transition-fast), color var(--mrd-transition-fast)}.mrd-field__history-editor-add.sc-mrd-field:hover{background-color:var(--mrd-color-primary-light)}.mrd-field__multi.sc-mrd-field{display:flex;flex-direction:column;gap:var(--mrd-space-1)}.mrd-field__multi__label.sc-mrd-field{display:block;font-family:var(--mrd-font-family);font-size:var(--mrd-label-font-size);font-weight:var(--mrd-label-font-weight);color:var(--mrd-label-color)}.mrd-field__multi__label--required.sc-mrd-field::after{content:" *";color:var(--mrd-color-danger)}.mrd-field__multi__error.sc-mrd-field{font-family:var(--mrd-font-family);font-size:var(--mrd-error-font-size);color:var(--mrd-error-color)}.mrd-field__multi-row.sc-mrd-field{display:flex;align-items:flex-start;gap:var(--mrd-space-2)}.mrd-field__multi-row-input.sc-mrd-field{flex:1 1 0;min-width:0}.mrd-field__multi-remove.sc-mrd-field{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:2rem;height:var(--mrd-input-height);padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-field__multi-remove.sc-mrd-field:hover{color:var(--mrd-color-danger);background-color:var(--mrd-color-danger-light)}.mrd-field__multi-remove.sc-mrd-field svg.sc-mrd-field{width:1rem;height:1rem}.mrd-field__multi-add.sc-mrd-field{align-self:flex-start;padding:var(--mrd-space-1) var(--mrd-space-3);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary);background:transparent;border:var(--mrd-border-width) solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius-md);cursor:pointer;transition:background-color var(--mrd-transition-fast), color var(--mrd-transition-fast)}.mrd-field__multi-add.sc-mrd-field:hover{background-color:var(--mrd-color-primary-light)}`;
4085
4092
 
4086
4093
  const MrdField = class {
4087
4094
  constructor(hostRef) {
@@ -4094,6 +4101,13 @@ const MrdField = class {
4094
4101
  this.locale = navigator.language;
4095
4102
  this.historyEntries = [];
4096
4103
  this.currentValue = undefined;
4104
+ this.multiValues = [];
4105
+ this.multiError = '';
4106
+ this.handleMultiRowBlur = () => {
4107
+ var _a;
4108
+ this.multiError = requiredError(this.multiValues, (_a = this.item.required) !== null && _a !== void 0 ? _a : false, this.locale);
4109
+ this.mrdBlur.emit({ name: this.item.name, value: this.multiValues });
4110
+ };
4097
4111
  this.handleChange = (e) => {
4098
4112
  var _a, _b, _c, _d;
4099
4113
  e.stopPropagation();
@@ -4138,9 +4152,11 @@ const MrdField = class {
4138
4152
  }
4139
4153
  componentWillLoad() {
4140
4154
  this.initHistoryState();
4155
+ this.initMultiState();
4141
4156
  }
4142
4157
  valueChanged() {
4143
4158
  this.initHistoryState();
4159
+ this.initMultiState();
4144
4160
  }
4145
4161
  initHistoryState() {
4146
4162
  var _a, _b, _c, _d, _e;
@@ -4151,6 +4167,43 @@ const MrdField = class {
4151
4167
  this.currentValue = (_e = raw === null || raw === void 0 ? void 0 : raw.current) !== null && _e !== void 0 ? _e : raw;
4152
4168
  this.historyEntries = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.history) ? [...raw.history] : [];
4153
4169
  }
4170
+ /** LIST/FILE/IMAGE already own their multiple-value UI end to end; every
4171
+ * other scalar dataType routes through the generic repeater below instead
4172
+ * of each leaf field re-implementing add/remove itself (FINDING-0149). */
4173
+ isMultiScalar() {
4174
+ var _a, _b;
4175
+ if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) !== clientLayout.ClientLayoutItemType.FIELD || !((_b = this.item) === null || _b === void 0 ? void 0 : _b.multiple))
4176
+ return false;
4177
+ const dt = this.item.dataType;
4178
+ return dt !== clientLayout.ClientLayoutItemFieldDataType.LIST
4179
+ && dt !== clientLayout.ClientLayoutItemFieldDataType.FILE
4180
+ && dt !== clientLayout.ClientLayoutItemFieldDataType.IMAGE;
4181
+ }
4182
+ initMultiState() {
4183
+ if (!this.isMultiScalar())
4184
+ return;
4185
+ const v = this.value;
4186
+ this.multiValues = Array.isArray(v) ? [...v] : (v != null && v !== '' ? [v] : []);
4187
+ }
4188
+ emptyRowValue() {
4189
+ var _a;
4190
+ switch (this.item.dataType) {
4191
+ case clientLayout.ClientLayoutItemFieldDataType.INTEGER:
4192
+ case clientLayout.ClientLayoutItemFieldDataType.DECIMAL:
4193
+ case clientLayout.ClientLayoutItemFieldDataType.PERCENTAGE:
4194
+ return null;
4195
+ case clientLayout.ClientLayoutItemFieldDataType.CURRENCY:
4196
+ return { amount: null, currency: (_a = this.item.currencyCode) !== null && _a !== void 0 ? _a : 'EUR' };
4197
+ case clientLayout.ClientLayoutItemFieldDataType.BOOLEAN:
4198
+ return false;
4199
+ default:
4200
+ return '';
4201
+ }
4202
+ }
4203
+ emitMultiChange(values) {
4204
+ this.multiValues = values;
4205
+ this.mrdChange.emit({ name: this.item.name, value: values });
4206
+ }
4154
4207
  getDisplayValue() {
4155
4208
  var _a, _b, _c, _d;
4156
4209
  const hist = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.historyEnabled) !== null && _b !== void 0 ? _b : (_d = (_c = this.item) === null || _c === void 0 ? void 0 : _c.field) === null || _d === void 0 ? void 0 : _d.historyEnabled;
@@ -4179,6 +4232,9 @@ const MrdField = class {
4179
4232
  value: { current: this.currentValue, history: entries },
4180
4233
  });
4181
4234
  }
4235
+ renderRemoveIcon() {
4236
+ return (index.h("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", d: "M8.75 1A2.75 2.75 0 006 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 10.23 1.482l.149-.022.841 10.518A2.75 2.75 0 007.596 19h4.807a2.75 2.75 0 002.742-2.53l.841-10.52.149.023a.75.75 0 00.23-1.482A41.03 41.03 0 0014 4.193V3.75A2.75 2.75 0 0011.25 1h-2.5zM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4zM8.58 7.72a.75.75 0 00-1.5.06l.3 7.5a.75.75 0 101.5-.06l-.3-7.5zm4.34.06a.75.75 0 10-1.5-.06l-.3 7.5a.75.75 0 101.5.06l.3-7.5z", "clip-rule": "evenodd" })));
4237
+ }
4182
4238
  renderHistoryEditor() {
4183
4239
  var _a, _b, _c, _d;
4184
4240
  const hist = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.historyEnabled) !== null && _b !== void 0 ? _b : (_d = (_c = this.item) === null || _c === void 0 ? void 0 : _c.field) === null || _d === void 0 ? void 0 : _d.historyEnabled;
@@ -4196,62 +4252,80 @@ const MrdField = class {
4196
4252
  const addEntry = () => {
4197
4253
  this.emitHistoryChange([...this.historyEntries, { value: '', until: '' }]);
4198
4254
  };
4199
- return (index.h("div", { class: "mrd-field__history-editor" }, this.historyEntries.length > 0 && (index.h("span", { class: "mrd-field__history-editor-label" }, cellRenderer.t('history_badge_tooltip', locale))), this.historyEntries.map((entry, i) => (index.h("div", { key: String(i), class: "mrd-field__history-editor-row" }, index.h("input", { class: "mrd-field__history-editor-value", type: valueType, value: entry.value, onInput: (e) => updateEntry(i, 'value', e.target.value) }), index.h("span", { class: "mrd-field__history-editor-sep" }, cellRenderer.t('history_until', locale)), index.h("input", { class: "mrd-field__history-editor-until", type: "date", value: entry.until, onInput: (e) => updateEntry(i, 'until', e.target.value) }), index.h("button", { type: "button", class: "mrd-field__history-editor-remove", onClick: () => removeEntry(i), "aria-label": cellRenderer.t('remove', locale) }, index.h("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", d: "M8.75 1A2.75 2.75 0 006 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 10.23 1.482l.149-.022.841 10.518A2.75 2.75 0 007.596 19h4.807a2.75 2.75 0 002.742-2.53l.841-10.52.149.023a.75.75 0 00.23-1.482A41.03 41.03 0 0014 4.193V3.75A2.75 2.75 0 0011.25 1h-2.5zM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4zM8.58 7.72a.75.75 0 00-1.5.06l.3 7.5a.75.75 0 101.5-.06l-.3-7.5zm4.34.06a.75.75 0 10-1.5-.06l-.3 7.5a.75.75 0 101.5.06l.3-7.5z", "clip-rule": "evenodd" })))))), index.h("button", { type: "button", class: "mrd-field__history-editor-add", onClick: addEntry }, "+ ", cellRenderer.t('add', locale))));
4255
+ return (index.h("div", { class: "mrd-field__history-editor" }, this.historyEntries.length > 0 && (index.h("span", { class: "mrd-field__history-editor-label" }, cellRenderer.t('history_badge_tooltip', locale))), this.historyEntries.map((entry, i) => (index.h("div", { key: String(i), class: "mrd-field__history-editor-row" }, index.h("input", { class: "mrd-field__history-editor-value", type: valueType, value: entry.value, onInput: (e) => updateEntry(i, 'value', e.target.value) }), index.h("span", { class: "mrd-field__history-editor-sep" }, cellRenderer.t('history_until', locale)), index.h("input", { class: "mrd-field__history-editor-until", type: "date", value: entry.until, onInput: (e) => updateEntry(i, 'until', e.target.value) }), index.h("button", { type: "button", class: "mrd-field__history-editor-remove", onClick: () => removeEntry(i), "aria-label": cellRenderer.t('remove', locale) }, this.renderRemoveIcon())))), index.h("button", { type: "button", class: "mrd-field__history-editor-add", onClick: addEntry }, "+ ", cellRenderer.t('add', locale))));
4200
4256
  }
4201
- renderLeafField(displayValue) {
4202
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
4257
+ renderLeafField(displayValue, onChange = this.handleChange, onBlur = this.handleBlur, overrides = {}) {
4258
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
4203
4259
  const { item, locale } = this;
4204
4260
  const commonProps = {
4205
4261
  name: item.name,
4206
- label: item.label,
4207
- required: item.required,
4208
- disabled: (_a = item.disabled) !== null && _a !== void 0 ? _a : false,
4262
+ label: (_a = overrides.label) !== null && _a !== void 0 ? _a : item.label,
4263
+ required: (_b = overrides.required) !== null && _b !== void 0 ? _b : item.required,
4264
+ disabled: (_c = item.disabled) !== null && _c !== void 0 ? _c : false,
4209
4265
  locale,
4210
- onMrdChange: this.handleChange,
4211
- onMrdBlur: this.handleBlur,
4266
+ onMrdChange: onChange,
4267
+ onMrdBlur: onBlur,
4212
4268
  };
4213
4269
  switch (item.dataType) {
4214
4270
  case clientLayout.ClientLayoutItemFieldDataType.TEXT:
4215
- return (index.h("mrd-text-field", Object.assign({}, commonProps, { value: (_b = displayValue) !== null && _b !== void 0 ? _b : '', placeholder: (_c = item.placeholder) !== null && _c !== void 0 ? _c : '' })));
4271
+ return (index.h("mrd-text-field", Object.assign({}, commonProps, { value: (_d = displayValue) !== null && _d !== void 0 ? _d : '', placeholder: (_e = item.placeholder) !== null && _e !== void 0 ? _e : '' })));
4216
4272
  case clientLayout.ClientLayoutItemFieldDataType.TEXTBLOCK:
4217
- return (index.h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_d = displayValue) !== null && _d !== void 0 ? _d : '', placeholder: (_e = item.placeholder) !== null && _e !== void 0 ? _e : '' })));
4273
+ return (index.h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_f = displayValue) !== null && _f !== void 0 ? _f : '', placeholder: (_g = item.placeholder) !== null && _g !== void 0 ? _g : '' })));
4218
4274
  case clientLayout.ClientLayoutItemFieldDataType.INTEGER:
4219
4275
  case clientLayout.ClientLayoutItemFieldDataType.DECIMAL:
4220
4276
  case clientLayout.ClientLayoutItemFieldDataType.PERCENTAGE:
4221
- return (index.h("mrd-number-field", Object.assign({}, commonProps, { value: (_f = displayValue) !== null && _f !== void 0 ? _f : null, dataType: item.dataType, decimalPrecision: (_g = item.decimalPrecision) !== null && _g !== void 0 ? _g : 2, placeholder: (_h = item.placeholder) !== null && _h !== void 0 ? _h : '' })));
4277
+ return (index.h("mrd-number-field", Object.assign({}, commonProps, { value: (_h = displayValue) !== null && _h !== void 0 ? _h : null, dataType: item.dataType, decimalPrecision: (_j = item.decimalPrecision) !== null && _j !== void 0 ? _j : 2, placeholder: (_k = item.placeholder) !== null && _k !== void 0 ? _k : '' })));
4222
4278
  case clientLayout.ClientLayoutItemFieldDataType.CURRENCY:
4223
4279
  return (index.h("mrd-currency-field", Object.assign({}, commonProps, {
4224
4280
  // Input-only fallback: it preselects the layout's currencyCode in the dropdown
4225
4281
  // before an amount exists. The field never emits this shape back — an empty
4226
4282
  // amount emits null (FINDING-0141).
4227
- value: (_j = displayValue) !== null && _j !== void 0 ? _j : { amount: null, currency: (_k = item.currencyCode) !== null && _k !== void 0 ? _k : 'EUR' }
4283
+ value: (_l = displayValue) !== null && _l !== void 0 ? _l : { amount: null, currency: (_m = item.currencyCode) !== null && _m !== void 0 ? _m : 'EUR' }
4228
4284
  })));
4229
4285
  case clientLayout.ClientLayoutItemFieldDataType.BOOLEAN:
4230
- return (index.h("mrd-boolean-field", Object.assign({}, commonProps, { value: (_l = displayValue) !== null && _l !== void 0 ? _l : false })));
4286
+ return (index.h("mrd-boolean-field", Object.assign({}, commonProps, { value: (_o = displayValue) !== null && _o !== void 0 ? _o : false })));
4231
4287
  case clientLayout.ClientLayoutItemFieldDataType.DATE:
4232
- return (index.h("mrd-date-field", Object.assign({}, commonProps, { value: (_m = displayValue) !== null && _m !== void 0 ? _m : '' })));
4288
+ return (index.h("mrd-date-field", Object.assign({}, commonProps, { value: (_p = displayValue) !== null && _p !== void 0 ? _p : '' })));
4233
4289
  case clientLayout.ClientLayoutItemFieldDataType.DATETIME:
4234
- return (index.h("mrd-datetime-field", Object.assign({}, commonProps, { value: (_o = displayValue) !== null && _o !== void 0 ? _o : '' })));
4290
+ return (index.h("mrd-datetime-field", Object.assign({}, commonProps, { value: (_q = displayValue) !== null && _q !== void 0 ? _q : '' })));
4235
4291
  case clientLayout.ClientLayoutItemFieldDataType.TIME:
4236
- return (index.h("mrd-time-field", Object.assign({}, commonProps, { value: (_p = displayValue) !== null && _p !== void 0 ? _p : '' })));
4292
+ return (index.h("mrd-time-field", Object.assign({}, commonProps, { value: (_r = displayValue) !== null && _r !== void 0 ? _r : '' })));
4237
4293
  case clientLayout.ClientLayoutItemFieldDataType.EMAIL:
4238
- return (index.h("mrd-email-field", Object.assign({}, commonProps, { value: (_q = displayValue) !== null && _q !== void 0 ? _q : '', placeholder: (_r = item.placeholder) !== null && _r !== void 0 ? _r : '' })));
4294
+ return (index.h("mrd-email-field", Object.assign({}, commonProps, { value: (_s = displayValue) !== null && _s !== void 0 ? _s : '', placeholder: (_t = item.placeholder) !== null && _t !== void 0 ? _t : '' })));
4239
4295
  case clientLayout.ClientLayoutItemFieldDataType.HYPERLINK:
4240
- return (index.h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_s = displayValue) !== null && _s !== void 0 ? _s : '', placeholder: (_t = item.placeholder) !== null && _t !== void 0 ? _t : '' })));
4296
+ return (index.h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_u = displayValue) !== null && _u !== void 0 ? _u : '', placeholder: (_v = item.placeholder) !== null && _v !== void 0 ? _v : '' })));
4241
4297
  case clientLayout.ClientLayoutItemFieldDataType.LIST:
4242
- return (index.h("mrd-list-field", Object.assign({}, commonProps, { value: (_u = displayValue) !== null && _u !== void 0 ? _u : '', multiple: (_v = item.multiple) !== null && _v !== void 0 ? _v : false, listItems: (_w = item.listItems) !== null && _w !== void 0 ? _w : [] })));
4298
+ return (index.h("mrd-list-field", Object.assign({}, commonProps, { value: (_w = displayValue) !== null && _w !== void 0 ? _w : '', multiple: (_x = item.multiple) !== null && _x !== void 0 ? _x : false, listItems: (_y = item.listItems) !== null && _y !== void 0 ? _y : [] })));
4243
4299
  case clientLayout.ClientLayoutItemFieldDataType.FILE:
4244
- return (index.h("mrd-file-field", Object.assign({}, commonProps, { value: displayValue, accept: (_x = item.accept) !== null && _x !== void 0 ? _x : '', maxSize: (_y = item.maxSize) !== null && _y !== void 0 ? _y : 0, multiple: (_z = item.multiple) !== null && _z !== void 0 ? _z : false, onMrdUpload: this.handleUpload })));
4300
+ return (index.h("mrd-file-field", Object.assign({}, commonProps, { value: displayValue, accept: (_z = item.accept) !== null && _z !== void 0 ? _z : '', maxSize: (_0 = item.maxSize) !== null && _0 !== void 0 ? _0 : 0, multiple: (_1 = item.multiple) !== null && _1 !== void 0 ? _1 : false, onMrdUpload: this.handleUpload })));
4245
4301
  case clientLayout.ClientLayoutItemFieldDataType.IMAGE:
4246
- return (index.h("mrd-image-field", Object.assign({}, commonProps, { value: displayValue, accept: (_0 = item.accept) !== null && _0 !== void 0 ? _0 : 'image/*', maxSize: (_1 = item.maxSize) !== null && _1 !== void 0 ? _1 : 0, multiple: (_2 = item.multiple) !== null && _2 !== void 0 ? _2 : false, onMrdUpload: this.handleUpload })));
4302
+ return (index.h("mrd-image-field", Object.assign({}, commonProps, { value: displayValue, accept: (_2 = item.accept) !== null && _2 !== void 0 ? _2 : 'image/*', maxSize: (_3 = item.maxSize) !== null && _3 !== void 0 ? _3 : 0, multiple: (_4 = item.multiple) !== null && _4 !== void 0 ? _4 : false, onMrdUpload: this.handleUpload })));
4247
4303
  case clientLayout.ClientLayoutItemFieldDataType.LONGTEXT:
4248
- return (index.h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_3 = displayValue) !== null && _3 !== void 0 ? _3 : '', placeholder: (_4 = item.placeholder) !== null && _4 !== void 0 ? _4 : '' })));
4304
+ return (index.h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_5 = displayValue) !== null && _5 !== void 0 ? _5 : '', placeholder: (_6 = item.placeholder) !== null && _6 !== void 0 ? _6 : '' })));
4249
4305
  case clientLayout.ClientLayoutItemFieldDataType.SECRET:
4250
- return (index.h("mrd-secret-field", Object.assign({}, commonProps, { value: (_5 = displayValue) !== null && _5 !== void 0 ? _5 : '', placeholder: (_6 = item.placeholder) !== null && _6 !== void 0 ? _6 : '' })));
4306
+ return (index.h("mrd-secret-field", Object.assign({}, commonProps, { value: (_7 = displayValue) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 = item.placeholder) !== null && _8 !== void 0 ? _8 : '' })));
4251
4307
  default:
4252
4308
  return null;
4253
4309
  }
4254
4310
  }
4311
+ /** Repeatable-row UI for a scalar dataType with multiple: true — mirrors the
4312
+ * add/remove pattern already established by renderHistoryEditor(), reusing
4313
+ * the single-row renderLeafField() per entry instead of duplicating repeat
4314
+ * UI into every leaf field component (FINDING-0149). */
4315
+ renderMultiScalarField() {
4316
+ var _a, _b;
4317
+ const { item, locale } = this;
4318
+ const updateRow = (i, val) => {
4319
+ this.emitMultiChange(this.multiValues.map((v, idx) => (idx === i ? val : v)));
4320
+ };
4321
+ const removeRow = (i) => {
4322
+ this.emitMultiChange(this.multiValues.filter((_, idx) => idx !== i));
4323
+ };
4324
+ const addRow = () => {
4325
+ this.emitMultiChange([...this.multiValues, this.emptyRowValue()]);
4326
+ };
4327
+ return (index.h("div", { class: "mrd-field__multi" }, index.h(FieldLabel, { base: "mrd-field__multi", label: (_a = item.label) !== null && _a !== void 0 ? _a : '', required: (_b = item.required) !== null && _b !== void 0 ? _b : false }), this.multiValues.map((v, i) => (index.h("div", { key: String(i), class: "mrd-field__multi-row" }, index.h("div", { class: "mrd-field__multi-row-input" }, this.renderLeafField(v, (e) => { e.stopPropagation(); updateRow(i, e.detail.value); }, (e) => { e.stopPropagation(); this.handleMultiRowBlur(); }, { label: '', required: false })), index.h("button", { type: "button", class: "mrd-field__multi-remove", onClick: () => removeRow(i), "aria-label": cellRenderer.t('remove', locale) }, this.renderRemoveIcon())))), index.h("button", { type: "button", class: "mrd-field__multi-add", onClick: addRow }, "+ ", cellRenderer.t('add', locale)), index.h(FieldError, { base: "mrd-field__multi", error: this.multiError })));
4328
+ }
4255
4329
  render() {
4256
4330
  var _a, _b, _c, _d, _e, _f;
4257
4331
  const { item, locale, value } = this;
@@ -4262,7 +4336,7 @@ const MrdField = class {
4262
4336
  return index.h(index.Host, null);
4263
4337
  }
4264
4338
  const displayValue = this.getDisplayValue();
4265
- return (index.h(index.Host, null, index.h("div", { class: "mrd-field__inner" }, this.renderLeafField(displayValue), this.renderHistoryEditor())));
4339
+ return (index.h(index.Host, null, index.h("div", { class: "mrd-field__inner" }, this.isMultiScalar() ? this.renderMultiScalarField() : this.renderLeafField(displayValue), this.renderHistoryEditor())));
4266
4340
  }
4267
4341
  get el() { return index.getElement(this); }
4268
4342
  static get watchers() { return {
@@ -5201,6 +5275,16 @@ function showsEmpty(item) {
5201
5275
  var _a, _b, _c, _d, _e;
5202
5276
  return (_e = (_c = (_a = item.showEmpty) !== null && _a !== void 0 ? _a : (_b = item.field) === null || _b === void 0 ? void 0 : _b.showEmpty) !== null && _c !== void 0 ? _c : (_d = item.relation) === null || _d === void 0 ? void 0 : _d.showEmpty) !== null && _e !== void 0 ? _e : false;
5203
5277
  }
5278
+ /** Whether a RELATION item has a resolvable link value (`_links[item.name]`
5279
+ * carries either a multi-value `values[]` or a single `name`). */
5280
+ function hasRelationValue(item, data) {
5281
+ var _a, _b;
5282
+ if (!item.name)
5283
+ return false;
5284
+ const links = ((_a = data === null || data === void 0 ? void 0 : data._links) !== null && _a !== void 0 ? _a : {});
5285
+ const link = links[item.name];
5286
+ return !!(((_b = link === null || link === void 0 ? void 0 : link.values) === null || _b === void 0 ? void 0 : _b.length) || (link === null || link === void 0 ? void 0 : link.name));
5287
+ }
5204
5288
  /** Depth-first flatten of the SECTION/GROUP tree. */
5205
5289
  function flattenItems(items) {
5206
5290
  const result = [];
@@ -5313,7 +5397,7 @@ function renderHistoryBadge(ctx, item, raw) {
5313
5397
  ctx.on.toggleHistory(isOpen ? null : item.name);
5314
5398
  } }, index.h("svg", { class: "mrd-layout-section__history-icon", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .207.085.394.22.53l2.5 2.5a.75.75 0 101.06-1.06L10.75 9.69V5z", "clip-rule": "evenodd" }))), isOpen && (index.h("div", { class: "mrd-layout-section__history-popover", role: "listbox" }, sorted.map((entry, i) => (index.h("div", { key: String(i), class: "mrd-layout-section__history-entry" }, entry.value, " (", cellRenderer.t('history_until', ctx.locale), " ", cellRenderer.formatDate(entry.until, ctx.locale), ")")))))));
5315
5399
  }
5316
- function renderField(ctx, item) {
5400
+ function fieldRenderState(ctx, item) {
5317
5401
  var _a, _b;
5318
5402
  if (!item.name)
5319
5403
  return null;
@@ -5323,10 +5407,27 @@ function renderField(ctx, item) {
5323
5407
  ? raw.current
5324
5408
  : raw;
5325
5409
  const renderedValue = renderFieldValue(ctx, item, rawValue);
5410
+ return { raw, rawValue, renderedValue, isEmpty: renderedValue == null };
5411
+ }
5412
+ /** Whether a FIELD item would render anything at all (value, or a showEmpty
5413
+ * placeholder). A `header` field always renders. Used by mrd-layout-section
5414
+ * to decide whether a preceding HEADER item's block is entirely empty. */
5415
+ function isFieldVisible(ctx, item) {
5416
+ if (item.header)
5417
+ return true;
5418
+ const state = fieldRenderState(ctx, item);
5419
+ if (!state)
5420
+ return false;
5421
+ return !state.isEmpty || showsEmpty(item);
5422
+ }
5423
+ function renderField(ctx, item) {
5424
+ const state = fieldRenderState(ctx, item);
5425
+ if (!state)
5426
+ return null;
5427
+ const { raw, rawValue, renderedValue, isEmpty } = state;
5326
5428
  if (item.header) {
5327
5429
  return (index.h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
5328
5430
  }
5329
- const isEmpty = renderedValue == null;
5330
5431
  if (isEmpty && !showsEmpty(item))
5331
5432
  return null;
5332
5433
  const isBlock = item.dataType === clientLayout.ClientLayoutItemFieldDataType.TEXTBLOCK
@@ -5335,7 +5436,7 @@ function renderField(ctx, item) {
5335
5436
  return (index.h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}${isEmpty ? ' mrd-layout-section__field--empty' : ''}`, key: item.name }, index.h("span", { class: "mrd-layout-section__field-label" }, item.label), index.h("span", { class: "mrd-layout-section__field-value" }, isEmpty ? cellRenderer.t('value_empty', ctx.locale) : renderedValue, renderHistoryBadge(ctx, item, raw))));
5336
5437
  }
5337
5438
 
5338
- const mrdLayoutSectionCss = () => `.sc-mrd-layout-section-h{display:block;width:100%}.mrd-layout-section.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-layout-section__field.sc-mrd-layout-section{display:grid;grid-template-columns:200px 1fr;align-items:baseline;gap:0 var(--mrd-space-2);padding:var(--mrd-space-1) 0}.mrd-layout-section__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.mrd-layout-section__field-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-500);padding-top:1px}.mrd-layout-section__field-value.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);word-break:break-word;display:inline-flex;align-items:center;gap:var(--mrd-space-1)}.mrd-layout-section__field--empty.sc-mrd-layout-section .mrd-layout-section__field-value.sc-mrd-layout-section{color:var(--mrd-color-neutral-400);font-weight:var(--mrd-font-weight-normal)}.mrd-layout-section__history-wrap.sc-mrd-layout-section{position:relative;display:inline-flex;align-items:center}.mrd-layout-section__history-btn.sc-mrd-layout-section{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;flex-shrink:0;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-layout-section__history-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-700);background-color:var(--mrd-color-neutral-100)}.mrd-layout-section__history-btn.sc-mrd-layout-section:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__history-icon.sc-mrd-layout-section{width:0.875rem;height:0.875rem}.mrd-layout-section__history-popover.sc-mrd-layout-section{position:absolute;top:calc(100% + 0.25rem);left:0;min-width:24rem;max-width:24rem;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);box-shadow:var(--mrd-shadow-md);padding:var(--mrd-space-1) 0;z-index:var(--mrd-z-dropdown)}.mrd-layout-section__history-entry.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-700);padding:var(--mrd-space-2) var(--mrd-space-3);line-height:var(--mrd-line-height-normal)}.mrd-layout-section__history-entry.sc-mrd-layout-section:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.mrd-layout-section__field-header.sc-mrd-layout-section{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);margin:0 0 var(--mrd-space-4) 0;padding:0}.mrd-layout-section__header.sc-mrd-layout-section{font-size:var(--mrd-font-size-xl);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:var(--mrd-space-4) 0 var(--mrd-space-2) 0;padding:0}.mrd-layout-section__text.sc-mrd-layout-section{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed);margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:1px solid var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light);border-color:var(--mrd-color-primary)}.mrd-layout-section__link.sc-mrd-layout-section{color:var(--mrd-color-primary);text-decoration:none}.mrd-layout-section__link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__relation-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__relation-link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__download-link.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.mrd-layout-section__file-list.sc-mrd-layout-section{display:flex;flex-direction:column;align-items:flex-start;gap:var(--mrd-space-1)}.mrd-layout-section__file-list-item.sc-mrd-layout-section{min-width:0;max-width:100%}.mrd-layout-section__boolean--true.sc-mrd-layout-section{color:var(--mrd-color-success);font-weight:var(--mrd-font-weight-semibold)}.mrd-layout-section__boolean--false.sc-mrd-layout-section{color:var(--mrd-color-neutral-400)}.mrd-layout-section__badge.sc-mrd-layout-section{display:inline-block;font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);padding:2px var(--mrd-space-3);border-radius:10px}.mrd-layout-section__badge-dot-row.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2)}.mrd-layout-section__badge-dot.sc-mrd-layout-section{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.mrd-layout-section__secret-masked.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-label-color);letter-spacing:0.15em;user-select:none;pointer-events:none}.mrd-layout-section__pre.sc-mrd-layout-section{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);background-color:var(--mrd-color-neutral-50);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);margin:0;max-height:calc(15 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y:auto;white-space:pre-wrap;word-break:break-word}.mrd-layout-section__group.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__group-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;letter-spacing:0.01em}.mrd-layout-section__related-view.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__related-view-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-lg);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:0 0 var(--mrd-space-3) 0}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-wrap.sc-mrd-layout-section{position:relative}.mrd-layout-section__search-icon.sc-mrd-layout-section{position:absolute;left:var(--mrd-input-padding-x);top:50%;transform:translateY(-50%);width:1rem;height:1rem;color:var(--mrd-color-neutral-400);pointer-events:none}.mrd-layout-section__search-input.sc-mrd-layout-section{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x) var(--mrd-input-padding-y) calc(var(--mrd-input-padding-x) + 1rem + var(--mrd-space-2));font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;appearance:none;box-sizing:border-box}.mrd-layout-section__search-input.sc-mrd-layout-section:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__search-input.sc-mrd-layout-section::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-layout-section__search-results.sc-mrd-layout-section{position:absolute;top:100%;left:0;right:0;background-color:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-300);border-top:none;border-radius:0 0 var(--mrd-border-radius) var(--mrd-border-radius);box-shadow:var(--mrd-shadow-sm);z-index:100;max-height:300px;overflow-y:auto;list-style:none;margin:0;padding:var(--mrd-space-1) 0}.mrd-layout-section__search-result.sc-mrd-layout-section{margin:0;padding:0}.mrd-layout-section__search-result-btn.sc-mrd-layout-section{display:flex;flex-direction:column;width:100%;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;text-align:left;cursor:pointer;font-family:var(--mrd-font-family)}.mrd-layout-section__search-result-btn.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light)}.mrd-layout-section__search-result-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800)}.mrd-layout-section__search-result-desc.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section{background:none;border:none;padding:0;cursor:pointer;display:inline-block;border-radius:var(--mrd-border-radius);overflow:hidden;line-height:0}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section:hover .mrd-layout-section__image-thumb.sc-mrd-layout-section{opacity:0.85}.mrd-layout-section__image-thumb.sc-mrd-layout-section{display:block;max-width:160px;max-height:100px;border-radius:var(--mrd-border-radius);object-fit:cover;transition:opacity 0.15s}.mrd-layout-section__modal-backdrop.sc-mrd-layout-section{position:fixed;inset:0;background:rgba(0, 0, 0, 0.6);z-index:300;display:flex;align-items:center;justify-content:center}.mrd-layout-section__modal.sc-mrd-layout-section{position:relative;background:var(--mrd-color-white);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);max-width:min(90vw, 900px);max-height:90vh;display:flex;align-items:center;justify-content:center;box-shadow:var(--mrd-shadow-lg)}.mrd-layout-section__modal-close.sc-mrd-layout-section{position:absolute;top:var(--mrd-space-2);right:var(--mrd-space-2);background:rgba(0, 0, 0, 0.5);border:none;border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:var(--mrd-color-white);cursor:pointer;font-size:var(--mrd-font-size-sm);line-height:1;z-index:1}.mrd-layout-section__modal-close.sc-mrd-layout-section:hover{background:rgba(0, 0, 0, 0.8)}.mrd-layout-section__modal-image.sc-mrd-layout-section{display:block;max-width:100%;max-height:calc(90vh - 2rem);border-radius:var(--mrd-border-radius);object-fit:contain}`;
5439
+ const mrdLayoutSectionCss = () => `.sc-mrd-layout-section-h{display:block;width:100%}.mrd-layout-section.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-layout-section__field.sc-mrd-layout-section{display:grid;grid-template-columns:200px 1fr;align-items:baseline;gap:0 var(--mrd-space-2);padding:var(--mrd-space-1) 0}.mrd-layout-section__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.mrd-layout-section__field-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-500);padding-top:1px}.mrd-layout-section__field-value.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);word-break:break-word;display:inline-flex;align-items:center;gap:var(--mrd-space-1)}.mrd-layout-section__field--empty.sc-mrd-layout-section .mrd-layout-section__field-value.sc-mrd-layout-section{color:var(--mrd-color-neutral-400);font-weight:var(--mrd-font-weight-normal)}.mrd-layout-section__history-wrap.sc-mrd-layout-section{position:relative;display:inline-flex;align-items:center}.mrd-layout-section__history-btn.sc-mrd-layout-section{display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;padding:0;background:transparent;border:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-400);cursor:pointer;flex-shrink:0;transition:color var(--mrd-transition-fast), background-color var(--mrd-transition-fast)}.mrd-layout-section__history-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-700);background-color:var(--mrd-color-neutral-100)}.mrd-layout-section__history-btn.sc-mrd-layout-section:focus{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__history-icon.sc-mrd-layout-section{width:0.875rem;height:0.875rem}.mrd-layout-section__history-popover.sc-mrd-layout-section{position:absolute;top:calc(100% + 0.25rem);left:0;min-width:24rem;max-width:24rem;background-color:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);box-shadow:var(--mrd-shadow-md);padding:var(--mrd-space-1) 0;z-index:var(--mrd-z-dropdown)}.mrd-layout-section__history-entry.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-700);padding:var(--mrd-space-2) var(--mrd-space-3);line-height:var(--mrd-line-height-normal)}.mrd-layout-section__history-entry.sc-mrd-layout-section:not(:last-child){border-bottom:var(--mrd-border-width) solid var(--mrd-color-neutral-100)}.mrd-layout-section__field-header.sc-mrd-layout-section{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);margin:0 0 var(--mrd-space-4) 0;padding:0}.mrd-layout-section__header.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);letter-spacing:0.01em;margin:var(--mrd-space-5) 0 var(--mrd-space-2) 0;padding:0}.mrd-layout-section__text.sc-mrd-layout-section{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed);margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:1px solid var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light);border-color:var(--mrd-color-primary)}.mrd-layout-section__link.sc-mrd-layout-section{color:var(--mrd-color-primary);text-decoration:none}.mrd-layout-section__link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__relation-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__relation-link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__download-link.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.mrd-layout-section__file-list.sc-mrd-layout-section{display:flex;flex-direction:column;align-items:flex-start;gap:var(--mrd-space-1)}.mrd-layout-section__file-list-item.sc-mrd-layout-section{min-width:0;max-width:100%}.mrd-layout-section__boolean--true.sc-mrd-layout-section{color:var(--mrd-color-success);font-weight:var(--mrd-font-weight-semibold)}.mrd-layout-section__boolean--false.sc-mrd-layout-section{color:var(--mrd-color-neutral-400)}.mrd-layout-section__badge.sc-mrd-layout-section{display:inline-block;font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);padding:2px var(--mrd-space-3);border-radius:10px}.mrd-layout-section__badge-dot-row.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2)}.mrd-layout-section__badge-dot.sc-mrd-layout-section{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.mrd-layout-section__secret-masked.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-label-color);letter-spacing:0.15em;user-select:none;pointer-events:none}.mrd-layout-section__pre.sc-mrd-layout-section{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);background-color:var(--mrd-color-neutral-50);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);margin:0;max-height:calc(15 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y:auto;white-space:pre-wrap;word-break:break-word}.mrd-layout-section__group.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__group-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;letter-spacing:0.01em}.mrd-layout-section__related-view.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__related-view-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-lg);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:0 0 var(--mrd-space-3) 0}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-wrap.sc-mrd-layout-section{position:relative}.mrd-layout-section__search-icon.sc-mrd-layout-section{position:absolute;left:var(--mrd-input-padding-x);top:50%;transform:translateY(-50%);width:1rem;height:1rem;color:var(--mrd-color-neutral-400);pointer-events:none}.mrd-layout-section__search-input.sc-mrd-layout-section{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x) var(--mrd-input-padding-y) calc(var(--mrd-input-padding-x) + 1rem + var(--mrd-space-2));font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;appearance:none;box-sizing:border-box}.mrd-layout-section__search-input.sc-mrd-layout-section:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__search-input.sc-mrd-layout-section::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-layout-section__search-results.sc-mrd-layout-section{position:absolute;top:100%;left:0;right:0;background-color:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-300);border-top:none;border-radius:0 0 var(--mrd-border-radius) var(--mrd-border-radius);box-shadow:var(--mrd-shadow-sm);z-index:100;max-height:300px;overflow-y:auto;list-style:none;margin:0;padding:var(--mrd-space-1) 0}.mrd-layout-section__search-result.sc-mrd-layout-section{margin:0;padding:0}.mrd-layout-section__search-result-btn.sc-mrd-layout-section{display:flex;flex-direction:column;width:100%;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;text-align:left;cursor:pointer;font-family:var(--mrd-font-family)}.mrd-layout-section__search-result-btn.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light)}.mrd-layout-section__search-result-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800)}.mrd-layout-section__search-result-desc.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section{background:none;border:none;padding:0;cursor:pointer;display:inline-block;border-radius:var(--mrd-border-radius);overflow:hidden;line-height:0}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section:hover .mrd-layout-section__image-thumb.sc-mrd-layout-section{opacity:0.85}.mrd-layout-section__image-thumb.sc-mrd-layout-section{display:block;max-width:160px;max-height:100px;border-radius:var(--mrd-border-radius);object-fit:cover;transition:opacity 0.15s}.mrd-layout-section__modal-backdrop.sc-mrd-layout-section{position:fixed;inset:0;background:rgba(0, 0, 0, 0.6);z-index:300;display:flex;align-items:center;justify-content:center}.mrd-layout-section__modal.sc-mrd-layout-section{position:relative;background:var(--mrd-color-white);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);max-width:min(90vw, 900px);max-height:90vh;display:flex;align-items:center;justify-content:center;box-shadow:var(--mrd-shadow-lg)}.mrd-layout-section__modal-close.sc-mrd-layout-section{position:absolute;top:var(--mrd-space-2);right:var(--mrd-space-2);background:rgba(0, 0, 0, 0.5);border:none;border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:var(--mrd-color-white);cursor:pointer;font-size:var(--mrd-font-size-sm);line-height:1;z-index:1}.mrd-layout-section__modal-close.sc-mrd-layout-section:hover{background:rgba(0, 0, 0, 0.8)}.mrd-layout-section__modal-image.sc-mrd-layout-section{display:block;max-width:100%;max-height:calc(90vh - 2rem);border-radius:var(--mrd-border-radius);object-fit:contain}`;
5339
5440
 
5340
5441
  const MrdLayoutSection = class {
5341
5442
  constructor(hostRef) {
@@ -5349,6 +5450,7 @@ const MrdLayoutSection = class {
5349
5450
  this.mrdViewAction = index.createEvent(this, "mrdViewAction");
5350
5451
  this.mrdLoadViewAggregations = index.createEvent(this, "mrdLoadViewAggregations");
5351
5452
  this.mrdLoadViewDistinct = index.createEvent(this, "mrdLoadViewDistinct");
5453
+ this.mrdViewCheckCapabilities = index.createEvent(this, "mrdViewCheckCapabilities");
5352
5454
  this.mrdUpdateObject = index.createEvent(this, "mrdUpdateObject");
5353
5455
  this.mrdDeleteObject = index.createEvent(this, "mrdDeleteObject");
5354
5456
  this.mrdViewUpload = index.createEvent(this, "mrdViewUpload");
@@ -5379,7 +5481,16 @@ const MrdLayoutSection = class {
5379
5481
  this.imagePreviewUrl = null;
5380
5482
  this.imagePreviews = {};
5381
5483
  this.openHistoryField = null;
5484
+ /** Answers to mrdViewCheckCapabilities, keyed by view key — see emitCapabilitiesChecks().
5485
+ * Passed straight down as a `canCreate`/`mayCreate` prop to whichever body (mrd-table,
5486
+ * mrd-memo-container, mrd-document-container) is mounted for that key; a missing entry
5487
+ * means "not answered yet" and is treated as false (hidden), same default as mrd-table's
5488
+ * own standalone behaviour (TASK-0299). */
5489
+ this.canCreateMap = {};
5382
5490
  this.historyClickOutside = null;
5491
+ /** Signature last asked per view key (see emitCapabilitiesChecks()) — avoids re-emitting
5492
+ * mrdViewCheckCapabilities on every data/items update when the binding hasn't changed. */
5493
+ this.capabilitiesAsked = new Map();
5383
5494
  this.searchTimers = {};
5384
5495
  this.handleViewLoadPage = (e, name) => {
5385
5496
  e.stopPropagation();
@@ -5399,6 +5510,10 @@ const MrdLayoutSection = class {
5399
5510
  };
5400
5511
  }
5401
5512
  componentDidLoad() {
5513
+ // No DOM/child-hydration dependency, unlike initEmbeddedTables()/emitLoadImages() below —
5514
+ // run it immediately rather than deferring, so the host's answer (setViewCanCreate) can
5515
+ // land before the child bodies even mount.
5516
+ this.emitCapabilitiesChecks();
5402
5517
  setTimeout(() => {
5403
5518
  this.initEmbeddedTables();
5404
5519
  this.emitLoadImages();
@@ -5417,9 +5532,15 @@ const MrdLayoutSection = class {
5417
5532
  }
5418
5533
  dataChanged(newVal) {
5419
5534
  if (newVal && Object.keys(newVal).length > 0) {
5535
+ this.emitCapabilitiesChecks();
5420
5536
  setTimeout(() => this.initEmbeddedTables(), 0);
5421
5537
  }
5422
5538
  }
5539
+ /** A host can swap `items` (e.g. a different dashboard layout) without `data` changing —
5540
+ * dataChanged() alone would miss that binding change. */
5541
+ itemsChanged() {
5542
+ this.emitCapabilitiesChecks();
5543
+ }
5423
5544
  async initEmbeddedTables() {
5424
5545
  const tables = this.el.querySelectorAll('mrd-table[data-view]');
5425
5546
  for (const table of Array.from(tables)) {
@@ -5447,6 +5568,53 @@ const MrdLayoutSection = class {
5447
5568
  }
5448
5569
  }
5449
5570
  }
5571
+ /** Parent record id extracted from `data._links.self.href` — the same value every
5572
+ * VIEW/RELATED_VIEW item on this record shares, used for RELATED_VIEW path construction
5573
+ * (renderRelatedView) and capability checks (emitCapabilitiesChecks). */
5574
+ computeParentId() {
5575
+ var _a, _b, _c, _d, _e;
5576
+ const selfHref = (_d = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) === null || _b === void 0 ? void 0 : _b.self) === null || _c === void 0 ? void 0 : _c.href) !== null && _d !== void 0 ? _d : '';
5577
+ return (_e = selfHref.split('/').filter(Boolean).pop()) !== null && _e !== void 0 ? _e : '';
5578
+ }
5579
+ /** Asks, once per VIEW/RELATED_VIEW binding, whether the current user may create a record
5580
+ * there — the single generic place for this check (TASK-0299/FINDING-0155), so mrd-table,
5581
+ * mrd-memo-container and mrd-document-container all get the answer the same way: as a plain
5582
+ * `canCreate`/`mayCreate` prop from this component, computed here and handed down in
5583
+ * renderTable()/renderMemoContainer()/renderDocumentContainer() — none of the three leaf
5584
+ * components need to ask on their own when rendered through mrd-layout-section (mrd-table's
5585
+ * own self-ask only kicks in for standalone use, i.e. its `canCreate` prop left undefined).
5586
+ *
5587
+ * The route/path variables mirror what each renderer already uses for its own rows —
5588
+ * `type` = `dataClass`, `refType`/`refId` = `fromClass`/parentId for a RELATED_VIEW, and
5589
+ * `filterClass` when the view is scoped to one subtype (the same value sent as `?type=` on
5590
+ * the row fetch). A signature (not just the key) is tracked per binding so a genuine route
5591
+ * change re-asks and hides again, without re-asking on every unrelated data/items update. */
5592
+ emitCapabilitiesChecks() {
5593
+ var _a, _b, _c, _d;
5594
+ const parentId = this.computeParentId();
5595
+ for (const item of flattenItems(this.items)) {
5596
+ if (item.type !== clientLayout.ClientLayoutItemType.VIEW && item.type !== clientLayout.ClientLayoutItemType.RELATED_VIEW)
5597
+ continue;
5598
+ const key = viewKeyFor(item);
5599
+ if (!key || !item.view)
5600
+ continue;
5601
+ const isRelatedView = item.type === clientLayout.ClientLayoutItemType.RELATED_VIEW;
5602
+ const type = (_b = (_a = item.dataClass) !== null && _a !== void 0 ? _a : item.relatedClass) !== null && _b !== void 0 ? _b : key;
5603
+ const refType = isRelatedView ? ((_c = item.fromClass) !== null && _c !== void 0 ? _c : '') : undefined;
5604
+ const refId = isRelatedView ? parentId : undefined;
5605
+ const filterClass = (_d = item.filterClass) !== null && _d !== void 0 ? _d : undefined;
5606
+ const signature = JSON.stringify([type, refType, refId, filterClass]);
5607
+ if (this.capabilitiesAsked.get(key) === signature)
5608
+ continue;
5609
+ this.capabilitiesAsked.set(key, signature);
5610
+ if (key in this.canCreateMap) {
5611
+ const next = Object.assign({}, this.canCreateMap);
5612
+ delete next[key];
5613
+ this.canCreateMap = next;
5614
+ }
5615
+ this.mrdViewCheckCapabilities.emit(Object.assign(Object.assign({ name: key, type }, (refType !== undefined ? { refType, refId } : {})), (filterClass ? { filterClass } : {})));
5616
+ }
5617
+ }
5450
5618
  /** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
5451
5619
  async setSearchResults(results, dataClass) {
5452
5620
  const key = dataClass !== null && dataClass !== void 0 ? dataClass : this.resolveSearchKey();
@@ -5488,6 +5656,14 @@ const MrdLayoutSection = class {
5488
5656
  return;
5489
5657
  await table.setAggregations(data);
5490
5658
  }
5659
+ /** Host answer to mrdViewCheckCapabilities — whether the current user may create a record
5660
+ * for the given view's bound route. `name` is the view key from the event detail. Stored in
5661
+ * canCreateMap and passed down as a plain prop to whichever body is mounted for that key
5662
+ * (mrd-table, mrd-memo-container or mrd-document-container) — no DOM lookup needed, unlike
5663
+ * setViewPage/setViewAggregations, since the prop flows through the next render. */
5664
+ async setViewCanCreate(name, value) {
5665
+ this.canCreateMap = Object.assign(Object.assign({}, this.canCreateMap), { [name]: value });
5666
+ }
5491
5667
  /** Inject distinct values into an embedded mrd-document-list for a document view. */
5492
5668
  async setViewDistinct(name, nodeId, values) {
5493
5669
  const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
@@ -5560,7 +5736,7 @@ const MrdLayoutSection = class {
5560
5736
  else if (link === null || link === void 0 ? void 0 : link.name) {
5561
5737
  valueContent = makeBtn(link.href, link.name);
5562
5738
  }
5563
- const isEmpty = !valueContent;
5739
+ const isEmpty = !hasRelationValue(item, this.data);
5564
5740
  if (isEmpty && !showsEmpty(item))
5565
5741
  return null;
5566
5742
  return (index.h("div", { class: `mrd-layout-section__field${isEmpty ? ' mrd-layout-section__field--empty' : ''}`, key: item.name }, index.h("span", { class: "mrd-layout-section__field-label" }, item.label), index.h("span", { class: "mrd-layout-section__field-value" }, isEmpty ? cellRenderer.t('value_empty', this.locale) : valueContent)));
@@ -5582,24 +5758,37 @@ const MrdLayoutSection = class {
5582
5758
  if (!item.view)
5583
5759
  return null;
5584
5760
  const showTitle = (_a = item.showTitle) !== null && _a !== void 0 ? _a : false;
5585
- // Extract parentId from data._links.self.href for RELATED_VIEW path construction
5586
5761
  const selfHref = (_e = (_d = (_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '';
5587
- const parentId = (_f = selfHref.split('/').filter(Boolean).pop()) !== null && _f !== void 0 ? _f : '';
5762
+ const parentId = this.computeParentId();
5588
5763
  // The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
5589
5764
  // (sibling of `view`), not inside `view`.
5590
- const docArchetype = clientLayout.resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, clientLayout.ARCHETYPE_DOCUMENT);
5591
- const memoArchetype = !docArchetype ? clientLayout.resolveArchetype((_j = item.archetypes) !== null && _j !== void 0 ? _j : (_k = item.view) === null || _k === void 0 ? void 0 : _k.archetypes, clientLayout.ARCHETYPE_MEMO) : undefined;
5765
+ const docArchetype = clientLayout.resolveArchetype((_f = item.archetypes) !== null && _f !== void 0 ? _f : (_g = item.view) === null || _g === void 0 ? void 0 : _g.archetypes, clientLayout.ARCHETYPE_DOCUMENT);
5766
+ const memoArchetype = !docArchetype ? clientLayout.resolveArchetype((_h = item.archetypes) !== null && _h !== void 0 ? _h : (_j = item.view) === null || _j === void 0 ? void 0 : _j.archetypes, clientLayout.ARCHETYPE_MEMO) : undefined;
5592
5767
  // Canonical parent href for single-container seeding: use the RELATED_VIEW's
5593
5768
  // fromClass (base class) rather than the route class, so polymorphic subtypes
5594
5769
  // resolve to the same container the documents actually reference.
5595
5770
  const containerHref = buildContainerHref(item, selfHref, parentId);
5596
- return (index.h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && index.h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), docArchetype && this.renderDocumentContainer(item, key, parentId, docArchetype, containerHref), memoArchetype && this.renderMemoContainer(item, key, parentId, memoArchetype, containerHref), !docArchetype && !memoArchetype && this.renderTable(item, key, parentId)));
5771
+ // A memo RELATED_VIEW isn't necessarily scoped by the container relation
5772
+ // e.g. a person's dashboard can show "memos I authored" via the author
5773
+ // relation instead. inverseRelation names which relation on the memo points
5774
+ // back to this parent; only when it matches the container slot does the
5775
+ // parent's own href double as the memo's container.
5776
+ const memoContainerRelated = item.type !== clientLayout.ClientLayoutItemType.RELATED_VIEW
5777
+ || item.inverseRelation === ((_k = memoArchetype === null || memoArchetype === void 0 ? void 0 : memoArchetype.slots) === null || _k === void 0 ? void 0 : _k.container);
5778
+ const memoContainerHref = memoContainerRelated ? containerHref : '';
5779
+ // Distinct from memoContainerRelated: only a genuine container-scoped
5780
+ // RELATED_VIEW (a company's own memo tab) makes every card's container
5781
+ // obvious from the page itself. A top-level VIEW or an author-scoped
5782
+ // RELATED_VIEW both still need the per-card container link.
5783
+ const memoContainerImplied = item.type === clientLayout.ClientLayoutItemType.RELATED_VIEW && memoContainerRelated;
5784
+ return (index.h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && index.h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), docArchetype && this.renderDocumentContainer(item, key, parentId, docArchetype, containerHref), memoArchetype && this.renderMemoContainer(item, key, parentId, memoArchetype, memoContainerHref, memoContainerRelated, !memoContainerImplied), !docArchetype && !memoArchetype && this.renderTable(item, key, parentId)));
5597
5785
  }
5598
5786
  /** Document collection view: owns the view-switch + collection actions and
5599
5787
  * swaps between the folder tree and the flat table. Events are re-emitted to
5600
5788
  * the host with the view key, exactly as the raw list/table events were. */
5601
5789
  renderDocumentContainer(item, key, parentId, archetype, containerHref) {
5602
- return (index.h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, readOnly: this.readOnly, onMrdLoadDistinct: (e) => {
5790
+ var _a;
5791
+ return (index.h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, readOnly: this.readOnly, mayCreate: (_a = this.canCreateMap[key]) !== null && _a !== void 0 ? _a : false, onMrdLoadDistinct: (e) => {
5603
5792
  e.stopPropagation();
5604
5793
  this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
5605
5794
  }, onMrdLoadPage: (e) => {
@@ -5633,10 +5822,14 @@ const MrdLayoutSection = class {
5633
5822
  }
5634
5823
  /** Memo collection view: owns the view-switch + "New memo" and swaps between
5635
5824
  * the card list and the flat table, mirroring renderDocumentContainer(). */
5636
- renderMemoContainer(item, key, parentId, archetype, containerHref) {
5637
- var _a, _b, _c, _d;
5825
+ renderMemoContainer(item, key, parentId, archetype, containerHref, containerRelated, showContainerLink) {
5826
+ var _a, _b, _c, _d, _e;
5638
5827
  const labelsListItems = (_d = (_c = (_b = (_a = item.view) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.find(v => { var _a; return v.name === ((_a = archetype.slots) === null || _a === void 0 ? void 0 : _a.labels); })) === null || _c === void 0 ? void 0 : _c.listItems) !== null && _d !== void 0 ? _d : null;
5639
- return (index.h("mrd-memo-container", { "data-view": key, item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, readOnly: this.readOnly, me: this.me, labelsListItems: labelsListItems, onMrdLoadPage: (e) => {
5828
+ return (index.h("mrd-memo-container", { "data-view": key, item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, containerRelated: containerRelated, showContainerLink: showContainerLink, viewKey: key, locale: this.locale, readOnly: this.readOnly, canCreate: (_e = this.canCreateMap[key]) !== null && _e !== void 0 ? _e : false, me: this.me, labelsListItems: labelsListItems, onMrdNavigate: (e) => {
5829
+ var _a;
5830
+ e.stopPropagation();
5831
+ this.mrdNavigate.emit(Object.assign(Object.assign({}, e.detail), { navigateBehaviour: (_a = item.navigateBehaviour) !== null && _a !== void 0 ? _a : clientLayout.ClientLayoutNavigateBehaviour.PAGE }));
5832
+ }, onMrdLoadPage: (e) => {
5640
5833
  e.stopPropagation();
5641
5834
  this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
5642
5835
  }, onMrdLoadAggregations: (e) => {
@@ -5659,7 +5852,8 @@ const MrdLayoutSection = class {
5659
5852
  } }));
5660
5853
  }
5661
5854
  renderTable(item, key, parentId) {
5662
- return (index.h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, readOnly: this.readOnly, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
5855
+ var _a;
5856
+ return (index.h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, readOnly: this.readOnly, canCreate: (_a = this.canCreateMap[key]) !== null && _a !== void 0 ? _a : false, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
5663
5857
  var _a;
5664
5858
  e.stopPropagation();
5665
5859
  this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
@@ -5687,7 +5881,26 @@ const MrdLayoutSection = class {
5687
5881
  });
5688
5882
  } }));
5689
5883
  }
5690
- renderItem(item) {
5884
+ /** Whether every FIELD/RELATION item following a HEADER (up to the next
5885
+ * HEADER/SECTION/GROUP or the end of `siblings`) would itself render
5886
+ * nothing — i.e. the HEADER would introduce an empty block. Other item
5887
+ * types (VIEW, NAVIGATE, TEXT, ...) always count as visible. */
5888
+ isHeaderBlockEmpty(siblings, index) {
5889
+ const ctx = this.fieldCtx();
5890
+ for (let i = index + 1; i < siblings.length; i++) {
5891
+ const sib = siblings[i];
5892
+ if (sib.type === clientLayout.ClientLayoutItemType.HEADER || sib.type === clientLayout.ClientLayoutItemType.SECTION || sib.type === clientLayout.ClientLayoutItemType.GROUP)
5893
+ break;
5894
+ if (sib.type === clientLayout.ClientLayoutItemType.FIELD && isFieldVisible(ctx, sib))
5895
+ return false;
5896
+ if (sib.type === clientLayout.ClientLayoutItemType.RELATION && (hasRelationValue(sib, this.data) || showsEmpty(sib)))
5897
+ return false;
5898
+ if (sib.type !== clientLayout.ClientLayoutItemType.FIELD && sib.type !== clientLayout.ClientLayoutItemType.RELATION)
5899
+ return false;
5900
+ }
5901
+ return true;
5902
+ }
5903
+ renderItem(item, siblings = this.items, index$1 = -1) {
5691
5904
  var _a, _b;
5692
5905
  switch (item.type) {
5693
5906
  case clientLayout.ClientLayoutItemType.FIELD:
@@ -5695,6 +5908,8 @@ const MrdLayoutSection = class {
5695
5908
  case clientLayout.ClientLayoutItemType.RELATION:
5696
5909
  return this.renderRelation(item);
5697
5910
  case clientLayout.ClientLayoutItemType.HEADER:
5911
+ if (index$1 >= 0 && this.isHeaderBlockEmpty(siblings, index$1))
5912
+ return null;
5698
5913
  return (index.h("h2", { class: "mrd-layout-section__header", key: `header-${item.label}` }, item.label));
5699
5914
  case clientLayout.ClientLayoutItemType.TEXT:
5700
5915
  return index.h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
@@ -5704,7 +5919,7 @@ const MrdLayoutSection = class {
5704
5919
  return this.renderSearch(item);
5705
5920
  case clientLayout.ClientLayoutItemType.SECTION:
5706
5921
  case clientLayout.ClientLayoutItemType.GROUP:
5707
- return (index.h("div", { class: "mrd-layout-section__group", key: `group-${item.label}` }, item.label && index.h("h3", { class: "mrd-layout-section__group-title" }, item.label), ((_b = item.items) !== null && _b !== void 0 ? _b : []).map(child => this.renderItem(child))));
5922
+ return (index.h("div", { class: "mrd-layout-section__group", key: `group-${item.label}` }, item.label && index.h("h3", { class: "mrd-layout-section__group-title" }, item.label), ((_b = item.items) !== null && _b !== void 0 ? _b : []).map((child, i) => { var _a; return this.renderItem(child, (_a = item.items) !== null && _a !== void 0 ? _a : [], i); })));
5708
5923
  case clientLayout.ClientLayoutItemType.RELATED_VIEW:
5709
5924
  case clientLayout.ClientLayoutItemType.VIEW:
5710
5925
  return this.renderRelatedView(item);
@@ -5776,12 +5991,15 @@ const MrdLayoutSection = class {
5776
5991
  const emailArchetype = !docArchetype && !invoiceArchetype ? clientLayout.resolveArchetype(this.archetypes, clientLayout.ARCHETYPE_EMAIL) : undefined;
5777
5992
  const memoArchetype = !docArchetype && !invoiceArchetype && !emailArchetype ? clientLayout.resolveArchetype(this.archetypes, clientLayout.ARCHETYPE_MEMO) : undefined;
5778
5993
  const anyArchetype = docArchetype || invoiceArchetype || emailArchetype || memoArchetype;
5779
- return (index.h(index.Host, { key: '730654d745992b9607f15fcaf2bb54a725429e4d' }, index.h("div", { key: '72a2e7bb767992aa6f206a10f8b2a3a572e86115', class: "mrd-layout-section" }, docArchetype && this.renderDocumentObject(docArchetype), invoiceArchetype && this.renderInvoiceObject(invoiceArchetype), emailArchetype && this.renderEmailObject(emailArchetype), memoArchetype && this.renderMemoObject(memoArchetype), !anyArchetype && this.items.map(item => this.renderItem(item))), this.renderImageModal()));
5994
+ return (index.h(index.Host, { key: '508ca481c777d65d1739f7b5f30f5f3ad8722655' }, index.h("div", { key: 'c02630235a2a21511b391ff7b5bebeca1bcc6903', class: "mrd-layout-section" }, docArchetype && this.renderDocumentObject(docArchetype), invoiceArchetype && this.renderInvoiceObject(invoiceArchetype), emailArchetype && this.renderEmailObject(emailArchetype), memoArchetype && this.renderMemoObject(memoArchetype), !anyArchetype && this.items.map((item, i) => this.renderItem(item, this.items, i))), this.renderImageModal()));
5780
5995
  }
5781
5996
  get el() { return index.getElement(this); }
5782
5997
  static get watchers() { return {
5783
5998
  "data": [{
5784
5999
  "dataChanged": 0
6000
+ }],
6001
+ "items": [{
6002
+ "itemsChanged": 0
5785
6003
  }]
5786
6004
  }; }
5787
6005
  };
@@ -5907,6 +6125,7 @@ const MrdMemoContainer = class {
5907
6125
  index.registerInstance(this, hostRef);
5908
6126
  this.mrdLoadPage = index.createEvent(this, "mrdLoadPage");
5909
6127
  this.mrdLoadAggregations = index.createEvent(this, "mrdLoadAggregations");
6128
+ this.mrdNavigate = index.createEvent(this, "mrdNavigate");
5910
6129
  this.mrdAction = index.createEvent(this, "mrdAction");
5911
6130
  this.mrdCreateObject = index.createEvent(this, "mrdCreateObject");
5912
6131
  this.mrdUpdateObject = index.createEvent(this, "mrdUpdateObject");
@@ -5918,6 +6137,20 @@ const MrdMemoContainer = class {
5918
6137
  /** Canonical parent href — set when this is a RELATED_VIEW embedded under a
5919
6138
  * parent record, which already gives a new memo something to attach to. */
5920
6139
  this.containerHref = '';
6140
+ /** False when this RELATED_VIEW's parent is related via a relation other than
6141
+ * the archetype's container slot (e.g. a person's "memos I authored" list,
6142
+ * related via `author`) — mrd-layout-section resolves this from the item's
6143
+ * `inverseRelation`. In that case the parent is not a valid container for a
6144
+ * new memo, and — unlike a top-level VIEW with no context at all — falling
6145
+ * back to `me` would be wrong too (creating a memo "on myself" from someone
6146
+ * else's authored-memos list makes no sense), so "New memo" is hidden outright. */
6147
+ this.containerRelated = true;
6148
+ /** True unless this is a container-scoped RELATED_VIEW (a company's own memo
6149
+ * tab, say) where every card's container is obviously the page you're
6150
+ * already on — forwarded to mrd-memo-list to show/hide its per-card
6151
+ * container link. A top-level VIEW or an author-scoped RELATED_VIEW both
6152
+ * still need it, since the container isn't implied by the page context. */
6153
+ this.showContainerLink = true;
5921
6154
  /** Lookup key used for the embedded `data-view` attribute. */
5922
6155
  this.viewKey = '';
5923
6156
  this.locale = navigator.language;
@@ -5928,6 +6161,10 @@ const MrdMemoContainer = class {
5928
6161
  * tooltip, cards/rows are not clickable, and the embedded table's own
5929
6162
  * create action is disabled too. */
5930
6163
  this.readOnly = false;
6164
+ /** Whether the current user may create a memo here — set by mrd-layout-section from its
6165
+ * generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table
6166
+ * gets in table mode. Defaults to false (hidden) until confirmed, same as mrd-table. */
6167
+ this.canCreate = false;
5931
6168
  /** The active account's linked person record (userProfile.links.person), if any.
5932
6169
  * Used both to gate "New memo" (see effectiveContainerHref) and, on submit, to
5933
6170
  * fill the author slot. */
@@ -6149,15 +6386,18 @@ const MrdMemoContainer = class {
6149
6386
  return !!((_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.important);
6150
6387
  }
6151
6388
  /** A parent record already gives a new memo somewhere to attach to (RELATED_VIEW);
6152
- * otherwise fall back to the account's own linked person (top-level VIEW). */
6389
+ * otherwise fall back to the account's own linked person (top-level VIEW) — but
6390
+ * only when containerRelated allows it (see its doc comment). */
6153
6391
  get effectiveContainerHref() {
6392
+ if (!this.containerRelated)
6393
+ return '';
6154
6394
  return this.containerHref || this.meHref();
6155
6395
  }
6156
6396
  /** The author slot is always filled from `me` (there is no author picker in
6157
6397
  * the dialog), so without it there is nothing valid to create — regardless
6158
6398
  * of whether a parent record already supplies a container. */
6159
6399
  get canAdd() {
6160
- return !this.readOnly && !!this.meHref() && !!this.effectiveContainerHref;
6400
+ return this.canCreate && !this.readOnly && !!this.meHref() && !!this.effectiveContainerHref;
6161
6401
  }
6162
6402
  /** Path for creating a new memo: `/{dataClass}` for a top-level VIEW, or
6163
6403
  * `/{fromClass}/{parentId}/{dataClass}` when nested under a parent record. */
@@ -6171,7 +6411,7 @@ const MrdMemoContainer = class {
6171
6411
  });
6172
6412
  }
6173
6413
  renderToolbar() {
6174
- return (index.h("div", { class: "mrd-memo-container__toolbar" }, this.mode === 'cards' && (index.h("button", { type: "button", class: "mrd-memo-container__action", disabled: !this.canAdd, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : undefined, onClick: this.openCreate }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M12 5v14M5 12h14" })), cellRenderer.t('memo_new', this.locale))), index.h("div", { class: "mrd-memo-container__seg", role: "group", "aria-label": cellRenderer.t('doc_view_switch', this.locale) }, index.h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'cards'), title: cellRenderer.t('memo_view_cards', this.locale), "aria-label": cellRenderer.t('memo_view_cards', this.locale), onClick: () => this.setMode('cards') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("rect", { x: "3", y: "4", width: "7", height: "7", rx: "1" }), index.h("rect", { x: "14", y: "4", width: "7", height: "7", rx: "1" }), index.h("rect", { x: "3", y: "15", width: "7", height: "5", rx: "1" }), index.h("rect", { x: "14", y: "15", width: "7", height: "5", rx: "1" }))), index.h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'table'), title: cellRenderer.t('memo_view_table', this.locale), "aria-label": cellRenderer.t('memo_view_table', this.locale), onClick: () => this.setMode('table') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
6414
+ return (index.h("div", { class: "mrd-memo-container__toolbar" }, this.mode === 'cards' && this.canCreate && (index.h("button", { type: "button", class: "mrd-memo-container__action", disabled: !this.canAdd, title: this.readOnly ? cellRenderer.t('readonly_access', this.locale) : undefined, onClick: this.openCreate }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M12 5v14M5 12h14" })), cellRenderer.t('memo_new', this.locale))), index.h("div", { class: "mrd-memo-container__seg", role: "group", "aria-label": cellRenderer.t('doc_view_switch', this.locale) }, index.h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'cards'), title: cellRenderer.t('memo_view_cards', this.locale), "aria-label": cellRenderer.t('memo_view_cards', this.locale), onClick: () => this.setMode('cards') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("rect", { x: "3", y: "4", width: "7", height: "7", rx: "1" }), index.h("rect", { x: "14", y: "4", width: "7", height: "7", rx: "1" }), index.h("rect", { x: "3", y: "15", width: "7", height: "5", rx: "1" }), index.h("rect", { x: "14", y: "15", width: "7", height: "5", rx: "1" }))), index.h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'table'), title: cellRenderer.t('memo_view_table', this.locale), "aria-label": cellRenderer.t('memo_view_table', this.locale), onClick: () => this.setMode('table') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
6175
6415
  }
6176
6416
  renderDeleteConfirm() {
6177
6417
  return (index.h("div", null, index.h("h2", { class: "mrd-memo-container__modal-title" }, cellRenderer.t('memo_delete_confirm_title', this.locale)), index.h("p", { class: "mrd-memo-container__modal-warning" }, cellRenderer.t('memo_delete_confirm_body', this.locale)), index.h("div", { class: "mrd-memo-container__modal-actions" }, index.h("button", { type: "button", class: "mrd-memo-container__modal-cancel", onClick: this.cancelDeleteConfirm }, cellRenderer.t('cancel', this.locale)), index.h("button", { type: "button", class: "mrd-memo-container__modal-delete-confirm", onClick: this.confirmDelete }, cellRenderer.t('delete', this.locale)))));
@@ -6196,16 +6436,19 @@ const MrdMemoContainer = class {
6196
6436
  return (index.h("div", { class: "mrd-memo-container__modal-backdrop", onClick: this.closeDialog }, index.h("div", { class: "mrd-memo-container__modal", onClick: (e) => e.stopPropagation() }, this.deleteConfirmOpen ? this.renderDeleteConfirm() : this.renderForm())));
6197
6437
  }
6198
6438
  renderCards() {
6199
- return (index.h("mrd-memo-list", { "data-view": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, labelsListItems: this.labelsListItems, onMrdLoadPage: (e) => {
6439
+ return (index.h("mrd-memo-list", { "data-view": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, labelsListItems: this.labelsListItems, showContainerLink: this.showContainerLink, onMrdLoadPage: (e) => {
6200
6440
  e.stopPropagation();
6201
6441
  this.mrdLoadPage.emit(e.detail);
6202
6442
  }, onMrdEdit: (e) => {
6203
6443
  e.stopPropagation();
6204
6444
  this.openEdit(e.detail.row);
6445
+ }, onMrdNavigate: (e) => {
6446
+ e.stopPropagation();
6447
+ this.mrdNavigate.emit(e.detail);
6205
6448
  } }));
6206
6449
  }
6207
6450
  renderTable() {
6208
- return (index.h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, onMrdLoadPage: (e) => {
6451
+ return (index.h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, canCreate: this.canCreate, onMrdLoadPage: (e) => {
6209
6452
  e.stopPropagation();
6210
6453
  this.mrdLoadPage.emit(e.detail);
6211
6454
  }, onMrdLoadAggregations: (e) => {
@@ -6220,7 +6463,7 @@ const MrdMemoContainer = class {
6220
6463
  } }));
6221
6464
  }
6222
6465
  render() {
6223
- return (index.h(index.Host, { key: 'cf5e9a23e1e8496d061c00218029ec49d92700fe' }, this.renderToolbar(), index.h("div", { key: '5a15a60ea4cc68c77a8928068f7d6d6c3cb91434', class: "mrd-memo-container__body" }, this.mode === 'cards' ? this.renderCards() : this.renderTable()), this.renderDialog()));
6466
+ return (index.h(index.Host, { key: 'b0479aad6dc49935442183fcbdf30c07c2c490ff' }, this.renderToolbar(), index.h("div", { key: '40d0fb882186001ad4984c1ba64c5a5c529f4d76', class: "mrd-memo-container__body" }, this.mode === 'cards' ? this.renderCards() : this.renderTable()), this.renderDialog()));
6224
6467
  }
6225
6468
  static get watchers() { return {
6226
6469
  "dialogOpen": [{
@@ -6414,7 +6657,7 @@ function datetimeFilterToDisplay(existing) {
6414
6657
  return display;
6415
6658
  }
6416
6659
 
6417
- const mrdMemoListCss = () => `@charset "UTF-8";.sc-mrd-memo-list-h{display:block}.mrd-memo-list.sc-mrd-memo-list{display:flex;flex-direction:column;gap:var(--mrd-space-3)}.mrd-memo-list__card.sc-mrd-memo-list{display:flex;flex-direction:column;gap:var(--mrd-space-2);width:100%;padding:var(--mrd-space-4);background:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);font-family:var(--mrd-font-family);text-align:left;cursor:pointer;transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition)}.mrd-memo-list__card.sc-mrd-memo-list:hover{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.06))}.mrd-memo-list__card.sc-mrd-memo-list:focus-visible{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-memo-list__card--readonly.sc-mrd-memo-list{cursor:default}.mrd-memo-list__card--readonly.sc-mrd-memo-list:hover{border-color:var(--mrd-border-color);box-shadow:none}.mrd-memo-list__card-header.sc-mrd-memo-list{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--mrd-space-2)}.mrd-memo-list__card-title.sc-mrd-memo-list{font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-900)}.mrd-memo-list__card-important.sc-mrd-memo-list{display:inline-flex;flex-shrink:0;color:var(--mrd-color-warning)}.mrd-memo-list__card-important.sc-mrd-memo-list svg.sc-mrd-memo-list{width:1rem;height:1rem}.mrd-memo-list__card-body-wrap.sc-mrd-memo-list{display:flex;flex-direction:column;align-items:flex-start;gap:var(--mrd-space-1)}.mrd-memo-list__card-body.sc-mrd-memo-list{margin:0;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-600);line-height:var(--mrd-line-height-relaxed);word-break:break-word}.mrd-memo-list__card-body.sc-mrd-memo-list p.sc-mrd-memo-list,.mrd-memo-list__card-body.sc-mrd-memo-list ul.sc-mrd-memo-list,.mrd-memo-list__card-body.sc-mrd-memo-list ol.sc-mrd-memo-list{margin:0 0 var(--mrd-space-1) 0}.mrd-memo-list__card-body--clamped.sc-mrd-memo-list{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.mrd-memo-list__card-toggle.sc-mrd-memo-list{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary);cursor:pointer}.mrd-memo-list__card-toggle.sc-mrd-memo-list:hover{text-decoration:underline}.mrd-memo-list__labels.sc-mrd-memo-list{display:flex;flex-wrap:wrap;gap:var(--mrd-space-2)}.mrd-memo-list__badge.sc-mrd-memo-list{display:inline-flex;align-items:center;height:1.25rem;padding:0 var(--mrd-space-2);border-radius:var(--mrd-border-radius-full, 999px);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium)}.mrd-memo-list__badge--plain.sc-mrd-memo-list{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-600)}.mrd-memo-list__card-meta.sc-mrd-memo-list{display:flex;align-items:center;gap:var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400)}.mrd-memo-list__card-author.sc-mrd-memo-list+.mrd-memo-list__card-date.sc-mrd-memo-list::before{content:"·";margin-right:var(--mrd-space-2)}.mrd-memo-list__empty.sc-mrd-memo-list{padding:var(--mrd-space-6);text-align:center;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm)}.mrd-memo-list__load-more.sc-mrd-memo-list{align-self:center;height:var(--mrd-input-height);padding:0 var(--mrd-space-6);background:transparent;color:var(--mrd-color-neutral-600);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;transition:background-color var(--mrd-transition)}.mrd-memo-list__load-more.sc-mrd-memo-list:hover:not(:disabled){background-color:var(--mrd-color-neutral-100)}.mrd-memo-list__load-more.sc-mrd-memo-list:disabled{opacity:0.6;cursor:default}`;
6660
+ const mrdMemoListCss = () => `@charset "UTF-8";.sc-mrd-memo-list-h{display:block}.mrd-memo-list.sc-mrd-memo-list{display:flex;flex-direction:column;gap:var(--mrd-space-3)}.mrd-memo-list__card.sc-mrd-memo-list{display:flex;flex-direction:column;gap:var(--mrd-space-2);width:100%;padding:var(--mrd-space-4);background:var(--mrd-color-white);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius-md);font-family:var(--mrd-font-family);text-align:left;cursor:pointer;transition:border-color var(--mrd-transition), box-shadow var(--mrd-transition)}.mrd-memo-list__card.sc-mrd-memo-list:hover{border-color:var(--mrd-color-primary);box-shadow:var(--mrd-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.06))}.mrd-memo-list__card.sc-mrd-memo-list:focus-visible{outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-memo-list__card--readonly.sc-mrd-memo-list{cursor:default}.mrd-memo-list__card--readonly.sc-mrd-memo-list:hover{border-color:var(--mrd-border-color);box-shadow:none}.mrd-memo-list__card-header.sc-mrd-memo-list{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--mrd-space-2)}.mrd-memo-list__card-title.sc-mrd-memo-list{font-size:var(--mrd-font-size-base);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-900)}.mrd-memo-list__card-important.sc-mrd-memo-list{display:inline-flex;flex-shrink:0;color:var(--mrd-color-warning)}.mrd-memo-list__card-important.sc-mrd-memo-list svg.sc-mrd-memo-list{width:1rem;height:1rem}.mrd-memo-list__card-body-wrap.sc-mrd-memo-list{display:flex;flex-direction:column;align-items:flex-start;gap:var(--mrd-space-1)}.mrd-memo-list__card-body.sc-mrd-memo-list{margin:0;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-600);line-height:var(--mrd-line-height-relaxed);word-break:break-word}.mrd-memo-list__card-body.sc-mrd-memo-list p.sc-mrd-memo-list,.mrd-memo-list__card-body.sc-mrd-memo-list ul.sc-mrd-memo-list,.mrd-memo-list__card-body.sc-mrd-memo-list ol.sc-mrd-memo-list{margin:0 0 var(--mrd-space-1) 0}.mrd-memo-list__card-body--clamped.sc-mrd-memo-list{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.mrd-memo-list__card-toggle.sc-mrd-memo-list{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-primary);cursor:pointer}.mrd-memo-list__card-toggle.sc-mrd-memo-list:hover{text-decoration:underline}.mrd-memo-list__labels.sc-mrd-memo-list{display:flex;flex-wrap:wrap;gap:var(--mrd-space-2)}.mrd-memo-list__badge.sc-mrd-memo-list{display:inline-flex;align-items:center;height:1.25rem;padding:0 var(--mrd-space-2);border-radius:var(--mrd-border-radius-full, 999px);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium)}.mrd-memo-list__badge--plain.sc-mrd-memo-list{background:var(--mrd-color-neutral-100);color:var(--mrd-color-neutral-600)}.mrd-memo-list__card-meta.sc-mrd-memo-list{display:flex;align-items:center;gap:var(--mrd-space-2);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400)}.mrd-memo-list__card-author.sc-mrd-memo-list+.mrd-memo-list__card-date.sc-mrd-memo-list::before{content:"·";margin-right:var(--mrd-space-2)}.mrd-memo-list__card-container.sc-mrd-memo-list{align-self:flex-start;background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer}.mrd-memo-list__card-container.sc-mrd-memo-list:hover{text-decoration:underline}.mrd-memo-list__empty.sc-mrd-memo-list{padding:var(--mrd-space-6);text-align:center;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm)}.mrd-memo-list__load-more.sc-mrd-memo-list{align-self:center;height:var(--mrd-input-height);padding:0 var(--mrd-space-6);background:transparent;color:var(--mrd-color-neutral-600);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);cursor:pointer;transition:background-color var(--mrd-transition)}.mrd-memo-list__load-more.sc-mrd-memo-list:hover:not(:disabled){background-color:var(--mrd-color-neutral-100)}.mrd-memo-list__load-more.sc-mrd-memo-list:disabled{opacity:0.6;cursor:default}`;
6418
6661
 
6419
6662
  /** Plain-text length above which a card's body is clamped with a show-more toggle. */
6420
6663
  const BODY_PREVIEW_THRESHOLD = 220;
@@ -6423,6 +6666,7 @@ const MrdMemoList = class {
6423
6666
  index.registerInstance(this, hostRef);
6424
6667
  this.mrdLoadPage = index.createEvent(this, "mrdLoadPage");
6425
6668
  this.mrdEdit = index.createEvent(this, "mrdEdit");
6669
+ this.mrdNavigate = index.createEvent(this, "mrdNavigate");
6426
6670
  /** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
6427
6671
  this.item = null;
6428
6672
  /** Parent record id — required for RELATED_VIEW path building. */
@@ -6436,6 +6680,11 @@ const MrdMemoList = class {
6436
6680
  /** listItems of the FIELD bound to the `labels` slot, resolved by mrd-layout-section
6437
6681
  * from its own items array, same reason mrd-memo-view needs it. */
6438
6682
  this.labelsListItems = null;
6683
+ /** False when the list is already scoped to its own container (a company's own
6684
+ * memo tab) — showing "belongs to: <this same company>" on every card there
6685
+ * would be redundant. True everywhere else (top-level VIEW, or a RELATED_VIEW
6686
+ * scoped by a different relation, e.g. a person's authored-memos list). */
6687
+ this.showContainerLink = true;
6439
6688
  this.rows = [];
6440
6689
  this.loading = false;
6441
6690
  this.exhausted = false;
@@ -6537,6 +6786,14 @@ const MrdMemoList = class {
6537
6786
  return 0;
6538
6787
  return String(raw).replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim().length;
6539
6788
  }
6789
+ renderContainer(row) {
6790
+ if (!this.showContainerLink)
6791
+ return null;
6792
+ const link = this.slotLink(row, 'container');
6793
+ if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
6794
+ return null;
6795
+ return (index.h("button", { type: "button", class: "mrd-memo-list__card-container", onClick: e => { e.stopPropagation(); this.mrdNavigate.emit({ href: link.href, label: link.name }); } }, link.name));
6796
+ }
6540
6797
  renderLabels(row) {
6541
6798
  const raw = this.slotValue(row, 'labels');
6542
6799
  const keys = Array.isArray(raw) ? raw.map(String) : (raw != null && raw !== '' ? [String(raw)] : []);
@@ -6581,10 +6838,10 @@ const MrdMemoList = class {
6581
6838
  e.preventDefault();
6582
6839
  this.mrdEdit.emit({ row });
6583
6840
  }
6584
- } }, index.h("div", { class: "mrd-memo-list__card-header" }, title && index.h("span", { class: "mrd-memo-list__card-title" }, title), important && (index.h("span", { class: "mrd-memo-list__card-important", title: cellRenderer.t('memo_important', this.locale) }, index.h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { d: "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 21 12 17.27 5.82 21 7 14.14l-5-4.87 7.1-1.01z" }))))), this.renderBody(row, href), this.renderLabels(row), index.h("div", { class: "mrd-memo-list__card-meta" }, (author === null || author === void 0 ? void 0 : author.name) && index.h("span", { class: "mrd-memo-list__card-author" }, author.name), dateRaw != null && dateRaw !== '' && (index.h("span", { class: "mrd-memo-list__card-date" }, cellRenderer.formatDateTime(dateRaw, this.locale))))));
6841
+ } }, index.h("div", { class: "mrd-memo-list__card-header" }, title && index.h("span", { class: "mrd-memo-list__card-title" }, title), important && (index.h("span", { class: "mrd-memo-list__card-important", title: cellRenderer.t('memo_important', this.locale) }, index.h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { d: "M12 2l2.9 6.26L22 9.27l-5 4.87L18.18 21 12 17.27 5.82 21 7 14.14l-5-4.87 7.1-1.01z" }))))), this.renderBody(row, href), this.renderLabels(row), index.h("div", { class: "mrd-memo-list__card-meta" }, (author === null || author === void 0 ? void 0 : author.name) && index.h("span", { class: "mrd-memo-list__card-author" }, author.name), dateRaw != null && dateRaw !== '' && (index.h("span", { class: "mrd-memo-list__card-date" }, cellRenderer.formatDateTime(dateRaw, this.locale)))), this.renderContainer(row)));
6585
6842
  }
6586
6843
  render() {
6587
- return (index.h(index.Host, { key: 'c4c5ce4e96bf2aa754d85b260db8920fdde9311d' }, index.h("div", { key: '0db49511231edbf946f98734e0bab91cbdf31795', class: "mrd-memo-list" }, this.rows.map((row, i) => this.renderCard(row, i)), this.started && !this.loading && this.rows.length === 0 && (index.h("div", { key: '2a7a027673d01d63523ce252fe2fbff8ba0515fd', class: "mrd-memo-list__empty" }, cellRenderer.t('no_results', this.locale))), !this.exhausted && this.rows.length > 0 && (index.h("button", { key: '45dfd4a9ccab721d422935c48509d46989c9a360', type: "button", class: "mrd-memo-list__load-more", disabled: this.loading, onClick: this.loadMore }, cellRenderer.t('load_more', this.locale))))));
6844
+ return (index.h(index.Host, { key: '18294fc609b741d38f9933d3ae01d20d6dda5ec5' }, index.h("div", { key: 'ac6c1adc6575ae1edb2cd507c8ac31b1f28ea35c', class: "mrd-memo-list" }, this.rows.map((row, i) => this.renderCard(row, i)), this.started && !this.loading && this.rows.length === 0 && (index.h("div", { key: '271281b2e087f8fd55dc51b32b1fe4cce387cdcb', class: "mrd-memo-list__empty" }, cellRenderer.t('no_results', this.locale))), !this.exhausted && this.rows.length > 0 && (index.h("button", { key: '24861c35323d759d69bfd4f358657fe201ca7727', type: "button", class: "mrd-memo-list__load-more", disabled: this.loading, onClick: this.loadMore }, cellRenderer.t('load_more', this.locale))))));
6588
6845
  }
6589
6846
  };
6590
6847
  MrdMemoList.style = mrdMemoListCss();
@@ -7338,6 +7595,7 @@ const MrdTable = class {
7338
7595
  this.mrdAction = index.createEvent(this, "mrdAction");
7339
7596
  this.mrdDownload = index.createEvent(this, "mrdDownload");
7340
7597
  this.mrdLoadAggregations = index.createEvent(this, "mrdLoadAggregations");
7598
+ this.mrdCheckCapabilities = index.createEvent(this, "mrdCheckCapabilities");
7341
7599
  // ── Non-state internals ────────────────────────────────────────────────────
7342
7600
  this.pendingPages = new Set();
7343
7601
  this.debounceTimer = null;
@@ -7443,6 +7701,10 @@ const MrdTable = class {
7443
7701
  this.aggregationsPending = false;
7444
7702
  /** Lower bound on total derived from setPage() hasNext info; grows as pages load. */
7445
7703
  this.minKnownTotal = 0;
7704
+ /** Self-asked answer for standalone use (the `canCreate` prop is undefined) — defaults to
7705
+ * hidden (TASK-0299) until the host answers mrdCheckCapabilities via setCanCreate(). Ignored
7706
+ * when the host controls `canCreate` directly; see effectiveCanCreate(). */
7707
+ this.selfCanCreate = false;
7446
7708
  this.handleScroll = (e) => {
7447
7709
  const scroller = e.currentTarget;
7448
7710
  const { renderStart, renderEnd } = computeWindow(scroller.scrollTop, this.rowHeight, this.tableHeight, this.baseTotal);
@@ -7477,6 +7739,14 @@ const MrdTable = class {
7477
7739
  this.searchOpen = false;
7478
7740
  this.searchQuery = '';
7479
7741
  this.stashedFilters = null;
7742
+ this.emitCapabilitiesCheck();
7743
+ }
7744
+ /** A parent-record navigation can reuse the same `item` reference while only `parentId`
7745
+ * changes (e.g. clicking a different dossier for the same RELATED_VIEW layout) — itemChanged()
7746
+ * would not fire for that. Re-ask so a stale canCreate answer from the previous parent never
7747
+ * leaks into the new one. */
7748
+ parentIdChanged() {
7749
+ this.emitCapabilitiesCheck();
7480
7750
  }
7481
7751
  // ── Lifecycle ──────────────────────────────────────────────────────────────
7482
7752
  componentWillLoad() {
@@ -7484,6 +7754,7 @@ const MrdTable = class {
7484
7754
  this.applyDefaultSort((_c = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.defaultSort) !== null && _c !== void 0 ? _c : '');
7485
7755
  }
7486
7756
  componentDidLoad() {
7757
+ this.emitCapabilitiesCheck();
7487
7758
  this.staleCheckTimer = setInterval(() => this.checkStalePages(), STALE_CHECK_INTERVAL_MS);
7488
7759
  // A table inside a hidden tab pane renders and loads page 0 without ever having a box, so
7489
7760
  // the width freeze cannot measure anything. ResizeObserver fires the moment the pane is
@@ -7602,6 +7873,14 @@ const MrdTable = class {
7602
7873
  // Fresh totals can be wider than the ones the columns were checked against.
7603
7874
  this.fixedContentMeasured = false;
7604
7875
  }
7876
+ /** Host answer to mrdCheckCapabilities — whether the current user may create a record for
7877
+ * the table's currently bound route (standalone use only; ignored while the `canCreate`
7878
+ * prop is set, since the host controls it directly in that mode). Call it any time after
7879
+ * the event fires; a stale answer for an old binding is discarded automatically
7880
+ * (selfCanCreate is reset to false before every new mrdCheckCapabilities emission). */
7881
+ async setCanCreate(value) {
7882
+ this.selfCanCreate = value;
7883
+ }
7605
7884
  // ── Lifecycle ──────────────────────────────────────────────────────────────
7606
7885
  disconnectedCallback() {
7607
7886
  if (this.resizeObserver) {
@@ -7961,6 +8240,22 @@ const MrdTable = class {
7961
8240
  dataClass: v.dataClass,
7962
8241
  });
7963
8242
  }
8243
+ /** Asks the host whether creating is allowed for the table's current binding (item, parent
8244
+ * and active view) — only in standalone use (`canCreate` prop undefined). A host that
8245
+ * controls `canCreate` directly already knows the answer, so the table never asks on its
8246
+ * own in that mode. Resets selfCanCreate to false first so the add button stays hidden for
8247
+ * the new binding until the host answers — it never inherits the previous binding's answer. */
8248
+ emitCapabilitiesCheck() {
8249
+ var _a, _b;
8250
+ if (this.canCreate !== undefined)
8251
+ return;
8252
+ this.selfCanCreate = false;
8253
+ const v = this.allViews[this.activeViewIdx];
8254
+ if (!(v === null || v === void 0 ? void 0 : v.dataClass))
8255
+ return;
8256
+ const isRelatedView = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === 'RELATED_VIEW';
8257
+ this.mrdCheckCapabilities.emit(Object.assign(Object.assign({ type: v.dataClass }, (isRelatedView ? { refType: (_b = v.fromClass) !== null && _b !== void 0 ? _b : '', refId: this.parentId } : {})), (v.filterClass ? { filterClass: v.filterClass } : {})));
8258
+ }
7964
8259
  /** Build query params for a page request from current sort, view filters, filterClass and active column filters.
7965
8260
  *
7966
8261
  * `q` and column filters are mutually exclusive on the backend — combining them breaks
@@ -7995,11 +8290,17 @@ const MrdTable = class {
7995
8290
  var _a, _b, _c;
7996
8291
  return ((_c = (_b = (_a = this.allViews[this.activeViewIdx]) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.values) !== null && _c !== void 0 ? _c : []);
7997
8292
  }
8293
+ /** `canCreate` when the host controls it directly, else the table's own self-asked answer. */
8294
+ get effectiveCanCreate() {
8295
+ return this.canCreate !== undefined ? this.canCreate : this.selfCanCreate;
8296
+ }
7998
8297
  get tableActions() {
7999
8298
  var _a, _b;
8000
8299
  const raw = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.actions) !== null && _b !== void 0 ? _b : [];
8001
8300
  return (raw !== null && raw !== void 0 ? raw : []).reduce((acc, a) => {
8002
- if (a === 'NEW')
8301
+ // Hidden (not just disabled) until creating is confirmed allowed for this binding —
8302
+ // see effectiveCanCreate() / emitCapabilitiesCheck() (TASK-0299).
8303
+ if (a === 'NEW' && this.effectiveCanCreate)
8003
8304
  acc.push({ action: 'create', label: cellRenderer.t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary', disabled: this.readOnly });
8004
8305
  if (a === 'EXPORT')
8005
8306
  acc.push({ action: 'export', label: cellRenderer.t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
@@ -8407,6 +8708,7 @@ const MrdTable = class {
8407
8708
  this.searchOpen = false;
8408
8709
  this.searchQuery = '';
8409
8710
  this.stashedFilters = null;
8711
+ this.emitCapabilitiesCheck();
8410
8712
  this.init();
8411
8713
  }
8412
8714
  toggleViewPopover(e) {
@@ -8584,6 +8886,9 @@ const MrdTable = class {
8584
8886
  }],
8585
8887
  "item": [{
8586
8888
  "itemChanged": 0
8889
+ }],
8890
+ "parentId": [{
8891
+ "parentIdChanged": 0
8587
8892
  }]
8588
8893
  }; }
8589
8894
  };