@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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_28.cjs.entry.js +361 -56
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +31 -4
- package/dist/collection/components/form/mrd-field/mrd-field.css +69 -0
- package/dist/collection/components/form/mrd-field/mrd-field.js +95 -25
- package/dist/collection/components/layout/mrd-layout-section/field-value.js +19 -2
- package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +10 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +4 -3
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +174 -17
- package/dist/collection/components/memo/mrd-memo-container/mrd-memo-container.js +105 -6
- package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.css +14 -0
- package/dist/collection/components/memo/mrd-memo-list/mrd-memo-list.js +50 -2
- package/dist/collection/components/table/mrd-table/mrd-table.js +105 -2
- package/dist/collection/dev/api.js +17 -0
- package/dist/collection/dev/app.js +49 -15
- package/dist/collection/dev/example-data.js +15 -1
- package/dist/components/mrd-document-container2.js +1 -1
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-memo-container2.js +1 -1
- package/dist/components/mrd-memo-list2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_28.entry.js +361 -56
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-f72668e9.entry.js +3 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +7 -0
- package/dist/types/components/form/mrd-field/mrd-field.d.ts +16 -0
- package/dist/types/components/layout/mrd-layout-section/field-value.d.ts +4 -0
- package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +3 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +52 -0
- package/dist/types/components/memo/mrd-memo-container/mrd-memo-container.d.ts +26 -1
- package/dist/types/components/memo/mrd-memo-list/mrd-memo-list.d.ts +12 -0
- package/dist/types/components/table/mrd-table/mrd-table.d.ts +45 -0
- package/dist/types/components.d.ts +92 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-d64ba1f2.entry.js +0 -3
|
@@ -365,6 +365,13 @@ const MrdDocumentContainer = class {
|
|
|
365
365
|
* (with a tooltip explaining why) and the embedded table/list get it passed
|
|
366
366
|
* through so their own create/upload/drag-drop paths are disabled too. */
|
|
367
367
|
this.readOnly = false;
|
|
368
|
+
/** Whether the current user may create a document here — set by mrd-layout-section from
|
|
369
|
+
* its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded
|
|
370
|
+
* table gets in list mode. Named `mayCreate` (not `canCreate`) to avoid colliding with
|
|
371
|
+
* the existing `canCreate` state below, which tracks something unrelated: whether the
|
|
372
|
+
* folder tree currently has a valid drop target selected. Defaults to false (hidden)
|
|
373
|
+
* until confirmed, same as mrd-table. */
|
|
374
|
+
this.mayCreate = false;
|
|
368
375
|
/** Active body: folder tree or flat table. */
|
|
369
376
|
this.mode = 'tree';
|
|
370
377
|
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
@@ -379,7 +386,7 @@ const MrdDocumentContainer = class {
|
|
|
379
386
|
};
|
|
380
387
|
this.pickFile = () => {
|
|
381
388
|
var _a;
|
|
382
|
-
if (this.readOnly)
|
|
389
|
+
if (this.readOnly || !this.mayCreate)
|
|
383
390
|
return;
|
|
384
391
|
(_a = this.fileInputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
385
392
|
};
|
|
@@ -417,7 +424,7 @@ const MrdDocumentContainer = class {
|
|
|
417
424
|
}
|
|
418
425
|
// ── Toolbar ────────────────────────────────────────────────────────────────
|
|
419
426
|
renderToolbar() {
|
|
420
|
-
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : undefined, onClick: this.createFolder }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, 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" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : (this.targetLabel ? `${t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined), onClick: this.pickFile }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("path", { d: "M12 3v13M7 8l5-5 5 5" })), t('doc_upload', this.locale))), h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
427
|
+
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && this.mayCreate && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : undefined, onClick: this.createFolder }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, 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" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), this.mode === 'tree' && this.mayCreate && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : (this.targetLabel ? `${t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined), onClick: this.pickFile }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("path", { d: "M12 3v13M7 8l5-5 5 5" })), t('doc_upload', this.locale))), h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
421
428
|
}
|
|
422
429
|
// ── Bodies ───────────────────────────────────────────────────────────────
|
|
423
430
|
renderTree() {
|
|
@@ -448,7 +455,7 @@ const MrdDocumentContainer = class {
|
|
|
448
455
|
} }));
|
|
449
456
|
}
|
|
450
457
|
renderList() {
|
|
451
|
-
return (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) => {
|
|
458
|
+
return (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) => {
|
|
452
459
|
e.stopPropagation();
|
|
453
460
|
this.mrdLoadPage.emit(e.detail);
|
|
454
461
|
}, onMrdLoadAggregations: (e) => {
|
|
@@ -472,7 +479,7 @@ const MrdDocumentContainer = class {
|
|
|
472
479
|
}
|
|
473
480
|
render() {
|
|
474
481
|
const treeMode = this.mode === 'tree';
|
|
475
|
-
return (h(Host, { key: '
|
|
482
|
+
return (h(Host, { key: '4b674a508ac7ddf6af80a40836b72dc65f41c741' }, this.renderToolbar(), h("div", { key: '19968916f685a2e3cd075dabf170f67fb104251c', class: {
|
|
476
483
|
'mrd-document-container__body': true,
|
|
477
484
|
'mrd-document-container__body--tree': treeMode,
|
|
478
485
|
}, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
|
|
@@ -4079,7 +4086,7 @@ const MrdEmailView = class {
|
|
|
4079
4086
|
};
|
|
4080
4087
|
MrdEmailView.style = mrdEmailViewCss();
|
|
4081
4088
|
|
|
4082
|
-
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)}`;
|
|
4089
|
+
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)}`;
|
|
4083
4090
|
|
|
4084
4091
|
const MrdField = class {
|
|
4085
4092
|
constructor(hostRef) {
|
|
@@ -4092,6 +4099,13 @@ const MrdField = class {
|
|
|
4092
4099
|
this.locale = navigator.language;
|
|
4093
4100
|
this.historyEntries = [];
|
|
4094
4101
|
this.currentValue = undefined;
|
|
4102
|
+
this.multiValues = [];
|
|
4103
|
+
this.multiError = '';
|
|
4104
|
+
this.handleMultiRowBlur = () => {
|
|
4105
|
+
var _a;
|
|
4106
|
+
this.multiError = requiredError(this.multiValues, (_a = this.item.required) !== null && _a !== void 0 ? _a : false, this.locale);
|
|
4107
|
+
this.mrdBlur.emit({ name: this.item.name, value: this.multiValues });
|
|
4108
|
+
};
|
|
4095
4109
|
this.handleChange = (e) => {
|
|
4096
4110
|
var _a, _b, _c, _d;
|
|
4097
4111
|
e.stopPropagation();
|
|
@@ -4136,9 +4150,11 @@ const MrdField = class {
|
|
|
4136
4150
|
}
|
|
4137
4151
|
componentWillLoad() {
|
|
4138
4152
|
this.initHistoryState();
|
|
4153
|
+
this.initMultiState();
|
|
4139
4154
|
}
|
|
4140
4155
|
valueChanged() {
|
|
4141
4156
|
this.initHistoryState();
|
|
4157
|
+
this.initMultiState();
|
|
4142
4158
|
}
|
|
4143
4159
|
initHistoryState() {
|
|
4144
4160
|
var _a, _b, _c, _d, _e;
|
|
@@ -4149,6 +4165,43 @@ const MrdField = class {
|
|
|
4149
4165
|
this.currentValue = (_e = raw === null || raw === void 0 ? void 0 : raw.current) !== null && _e !== void 0 ? _e : raw;
|
|
4150
4166
|
this.historyEntries = Array.isArray(raw === null || raw === void 0 ? void 0 : raw.history) ? [...raw.history] : [];
|
|
4151
4167
|
}
|
|
4168
|
+
/** LIST/FILE/IMAGE already own their multiple-value UI end to end; every
|
|
4169
|
+
* other scalar dataType routes through the generic repeater below instead
|
|
4170
|
+
* of each leaf field re-implementing add/remove itself (FINDING-0149). */
|
|
4171
|
+
isMultiScalar() {
|
|
4172
|
+
var _a, _b;
|
|
4173
|
+
if (((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) !== ClientLayoutItemType.FIELD || !((_b = this.item) === null || _b === void 0 ? void 0 : _b.multiple))
|
|
4174
|
+
return false;
|
|
4175
|
+
const dt = this.item.dataType;
|
|
4176
|
+
return dt !== ClientLayoutItemFieldDataType.LIST
|
|
4177
|
+
&& dt !== ClientLayoutItemFieldDataType.FILE
|
|
4178
|
+
&& dt !== ClientLayoutItemFieldDataType.IMAGE;
|
|
4179
|
+
}
|
|
4180
|
+
initMultiState() {
|
|
4181
|
+
if (!this.isMultiScalar())
|
|
4182
|
+
return;
|
|
4183
|
+
const v = this.value;
|
|
4184
|
+
this.multiValues = Array.isArray(v) ? [...v] : (v != null && v !== '' ? [v] : []);
|
|
4185
|
+
}
|
|
4186
|
+
emptyRowValue() {
|
|
4187
|
+
var _a;
|
|
4188
|
+
switch (this.item.dataType) {
|
|
4189
|
+
case ClientLayoutItemFieldDataType.INTEGER:
|
|
4190
|
+
case ClientLayoutItemFieldDataType.DECIMAL:
|
|
4191
|
+
case ClientLayoutItemFieldDataType.PERCENTAGE:
|
|
4192
|
+
return null;
|
|
4193
|
+
case ClientLayoutItemFieldDataType.CURRENCY:
|
|
4194
|
+
return { amount: null, currency: (_a = this.item.currencyCode) !== null && _a !== void 0 ? _a : 'EUR' };
|
|
4195
|
+
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
4196
|
+
return false;
|
|
4197
|
+
default:
|
|
4198
|
+
return '';
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
emitMultiChange(values) {
|
|
4202
|
+
this.multiValues = values;
|
|
4203
|
+
this.mrdChange.emit({ name: this.item.name, value: values });
|
|
4204
|
+
}
|
|
4152
4205
|
getDisplayValue() {
|
|
4153
4206
|
var _a, _b, _c, _d;
|
|
4154
4207
|
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;
|
|
@@ -4177,6 +4230,9 @@ const MrdField = class {
|
|
|
4177
4230
|
value: { current: this.currentValue, history: entries },
|
|
4178
4231
|
});
|
|
4179
4232
|
}
|
|
4233
|
+
renderRemoveIcon() {
|
|
4234
|
+
return (h("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, 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" })));
|
|
4235
|
+
}
|
|
4180
4236
|
renderHistoryEditor() {
|
|
4181
4237
|
var _a, _b, _c, _d;
|
|
4182
4238
|
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;
|
|
@@ -4194,62 +4250,80 @@ const MrdField = class {
|
|
|
4194
4250
|
const addEntry = () => {
|
|
4195
4251
|
this.emitHistoryChange([...this.historyEntries, { value: '', until: '' }]);
|
|
4196
4252
|
};
|
|
4197
|
-
return (h("div", { class: "mrd-field__history-editor" }, this.historyEntries.length > 0 && (h("span", { class: "mrd-field__history-editor-label" }, t('history_badge_tooltip', locale))), this.historyEntries.map((entry, i) => (h("div", { key: String(i), class: "mrd-field__history-editor-row" }, h("input", { class: "mrd-field__history-editor-value", type: valueType, value: entry.value, onInput: (e) => updateEntry(i, 'value', e.target.value) }), h("span", { class: "mrd-field__history-editor-sep" }, t('history_until', locale)), h("input", { class: "mrd-field__history-editor-until", type: "date", value: entry.until, onInput: (e) => updateEntry(i, 'until', e.target.value) }), h("button", { type: "button", class: "mrd-field__history-editor-remove", onClick: () => removeEntry(i), "aria-label": t('remove', locale) },
|
|
4253
|
+
return (h("div", { class: "mrd-field__history-editor" }, this.historyEntries.length > 0 && (h("span", { class: "mrd-field__history-editor-label" }, t('history_badge_tooltip', locale))), this.historyEntries.map((entry, i) => (h("div", { key: String(i), class: "mrd-field__history-editor-row" }, h("input", { class: "mrd-field__history-editor-value", type: valueType, value: entry.value, onInput: (e) => updateEntry(i, 'value', e.target.value) }), h("span", { class: "mrd-field__history-editor-sep" }, t('history_until', locale)), h("input", { class: "mrd-field__history-editor-until", type: "date", value: entry.until, onInput: (e) => updateEntry(i, 'until', e.target.value) }), h("button", { type: "button", class: "mrd-field__history-editor-remove", onClick: () => removeEntry(i), "aria-label": t('remove', locale) }, this.renderRemoveIcon())))), h("button", { type: "button", class: "mrd-field__history-editor-add", onClick: addEntry }, "+ ", t('add', locale))));
|
|
4198
4254
|
}
|
|
4199
|
-
renderLeafField(displayValue) {
|
|
4200
|
-
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;
|
|
4255
|
+
renderLeafField(displayValue, onChange = this.handleChange, onBlur = this.handleBlur, overrides = {}) {
|
|
4256
|
+
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;
|
|
4201
4257
|
const { item, locale } = this;
|
|
4202
4258
|
const commonProps = {
|
|
4203
4259
|
name: item.name,
|
|
4204
|
-
label: item.label,
|
|
4205
|
-
required: item.required,
|
|
4206
|
-
disabled: (
|
|
4260
|
+
label: (_a = overrides.label) !== null && _a !== void 0 ? _a : item.label,
|
|
4261
|
+
required: (_b = overrides.required) !== null && _b !== void 0 ? _b : item.required,
|
|
4262
|
+
disabled: (_c = item.disabled) !== null && _c !== void 0 ? _c : false,
|
|
4207
4263
|
locale,
|
|
4208
|
-
onMrdChange:
|
|
4209
|
-
onMrdBlur:
|
|
4264
|
+
onMrdChange: onChange,
|
|
4265
|
+
onMrdBlur: onBlur,
|
|
4210
4266
|
};
|
|
4211
4267
|
switch (item.dataType) {
|
|
4212
4268
|
case ClientLayoutItemFieldDataType.TEXT:
|
|
4213
|
-
return (h("mrd-text-field", Object.assign({}, commonProps, { value: (
|
|
4269
|
+
return (h("mrd-text-field", Object.assign({}, commonProps, { value: (_d = displayValue) !== null && _d !== void 0 ? _d : '', placeholder: (_e = item.placeholder) !== null && _e !== void 0 ? _e : '' })));
|
|
4214
4270
|
case ClientLayoutItemFieldDataType.TEXTBLOCK:
|
|
4215
|
-
return (h("mrd-textarea-field", Object.assign({}, commonProps, { value: (
|
|
4271
|
+
return (h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_f = displayValue) !== null && _f !== void 0 ? _f : '', placeholder: (_g = item.placeholder) !== null && _g !== void 0 ? _g : '' })));
|
|
4216
4272
|
case ClientLayoutItemFieldDataType.INTEGER:
|
|
4217
4273
|
case ClientLayoutItemFieldDataType.DECIMAL:
|
|
4218
4274
|
case ClientLayoutItemFieldDataType.PERCENTAGE:
|
|
4219
|
-
return (h("mrd-number-field", Object.assign({}, commonProps, { value: (
|
|
4275
|
+
return (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 : '' })));
|
|
4220
4276
|
case ClientLayoutItemFieldDataType.CURRENCY:
|
|
4221
4277
|
return (h("mrd-currency-field", Object.assign({}, commonProps, {
|
|
4222
4278
|
// Input-only fallback: it preselects the layout's currencyCode in the dropdown
|
|
4223
4279
|
// before an amount exists. The field never emits this shape back — an empty
|
|
4224
4280
|
// amount emits null (FINDING-0141).
|
|
4225
|
-
value: (
|
|
4281
|
+
value: (_l = displayValue) !== null && _l !== void 0 ? _l : { amount: null, currency: (_m = item.currencyCode) !== null && _m !== void 0 ? _m : 'EUR' }
|
|
4226
4282
|
})));
|
|
4227
4283
|
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
4228
|
-
return (h("mrd-boolean-field", Object.assign({}, commonProps, { value: (
|
|
4284
|
+
return (h("mrd-boolean-field", Object.assign({}, commonProps, { value: (_o = displayValue) !== null && _o !== void 0 ? _o : false })));
|
|
4229
4285
|
case ClientLayoutItemFieldDataType.DATE:
|
|
4230
|
-
return (h("mrd-date-field", Object.assign({}, commonProps, { value: (
|
|
4286
|
+
return (h("mrd-date-field", Object.assign({}, commonProps, { value: (_p = displayValue) !== null && _p !== void 0 ? _p : '' })));
|
|
4231
4287
|
case ClientLayoutItemFieldDataType.DATETIME:
|
|
4232
|
-
return (h("mrd-datetime-field", Object.assign({}, commonProps, { value: (
|
|
4288
|
+
return (h("mrd-datetime-field", Object.assign({}, commonProps, { value: (_q = displayValue) !== null && _q !== void 0 ? _q : '' })));
|
|
4233
4289
|
case ClientLayoutItemFieldDataType.TIME:
|
|
4234
|
-
return (h("mrd-time-field", Object.assign({}, commonProps, { value: (
|
|
4290
|
+
return (h("mrd-time-field", Object.assign({}, commonProps, { value: (_r = displayValue) !== null && _r !== void 0 ? _r : '' })));
|
|
4235
4291
|
case ClientLayoutItemFieldDataType.EMAIL:
|
|
4236
|
-
return (h("mrd-email-field", Object.assign({}, commonProps, { value: (
|
|
4292
|
+
return (h("mrd-email-field", Object.assign({}, commonProps, { value: (_s = displayValue) !== null && _s !== void 0 ? _s : '', placeholder: (_t = item.placeholder) !== null && _t !== void 0 ? _t : '' })));
|
|
4237
4293
|
case ClientLayoutItemFieldDataType.HYPERLINK:
|
|
4238
|
-
return (h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (
|
|
4294
|
+
return (h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_u = displayValue) !== null && _u !== void 0 ? _u : '', placeholder: (_v = item.placeholder) !== null && _v !== void 0 ? _v : '' })));
|
|
4239
4295
|
case ClientLayoutItemFieldDataType.LIST:
|
|
4240
|
-
return (h("mrd-list-field", Object.assign({}, commonProps, { value: (
|
|
4296
|
+
return (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 : [] })));
|
|
4241
4297
|
case ClientLayoutItemFieldDataType.FILE:
|
|
4242
|
-
return (h("mrd-file-field", Object.assign({}, commonProps, { value: displayValue, accept: (
|
|
4298
|
+
return (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 })));
|
|
4243
4299
|
case ClientLayoutItemFieldDataType.IMAGE:
|
|
4244
|
-
return (h("mrd-image-field", Object.assign({}, commonProps, { value: displayValue, accept: (
|
|
4300
|
+
return (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 })));
|
|
4245
4301
|
case ClientLayoutItemFieldDataType.LONGTEXT:
|
|
4246
|
-
return (h("mrd-longtext-field", Object.assign({}, commonProps, { value: (
|
|
4302
|
+
return (h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_5 = displayValue) !== null && _5 !== void 0 ? _5 : '', placeholder: (_6 = item.placeholder) !== null && _6 !== void 0 ? _6 : '' })));
|
|
4247
4303
|
case ClientLayoutItemFieldDataType.SECRET:
|
|
4248
|
-
return (h("mrd-secret-field", Object.assign({}, commonProps, { value: (
|
|
4304
|
+
return (h("mrd-secret-field", Object.assign({}, commonProps, { value: (_7 = displayValue) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 = item.placeholder) !== null && _8 !== void 0 ? _8 : '' })));
|
|
4249
4305
|
default:
|
|
4250
4306
|
return null;
|
|
4251
4307
|
}
|
|
4252
4308
|
}
|
|
4309
|
+
/** Repeatable-row UI for a scalar dataType with multiple: true — mirrors the
|
|
4310
|
+
* add/remove pattern already established by renderHistoryEditor(), reusing
|
|
4311
|
+
* the single-row renderLeafField() per entry instead of duplicating repeat
|
|
4312
|
+
* UI into every leaf field component (FINDING-0149). */
|
|
4313
|
+
renderMultiScalarField() {
|
|
4314
|
+
var _a, _b;
|
|
4315
|
+
const { item, locale } = this;
|
|
4316
|
+
const updateRow = (i, val) => {
|
|
4317
|
+
this.emitMultiChange(this.multiValues.map((v, idx) => (idx === i ? val : v)));
|
|
4318
|
+
};
|
|
4319
|
+
const removeRow = (i) => {
|
|
4320
|
+
this.emitMultiChange(this.multiValues.filter((_, idx) => idx !== i));
|
|
4321
|
+
};
|
|
4322
|
+
const addRow = () => {
|
|
4323
|
+
this.emitMultiChange([...this.multiValues, this.emptyRowValue()]);
|
|
4324
|
+
};
|
|
4325
|
+
return (h("div", { class: "mrd-field__multi" }, 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) => (h("div", { key: String(i), class: "mrd-field__multi-row" }, 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 })), h("button", { type: "button", class: "mrd-field__multi-remove", onClick: () => removeRow(i), "aria-label": t('remove', locale) }, this.renderRemoveIcon())))), h("button", { type: "button", class: "mrd-field__multi-add", onClick: addRow }, "+ ", t('add', locale)), h(FieldError, { base: "mrd-field__multi", error: this.multiError })));
|
|
4326
|
+
}
|
|
4253
4327
|
render() {
|
|
4254
4328
|
var _a, _b, _c, _d, _e, _f;
|
|
4255
4329
|
const { item, locale, value } = this;
|
|
@@ -4260,7 +4334,7 @@ const MrdField = class {
|
|
|
4260
4334
|
return h(Host, null);
|
|
4261
4335
|
}
|
|
4262
4336
|
const displayValue = this.getDisplayValue();
|
|
4263
|
-
return (h(Host, null, h("div", { class: "mrd-field__inner" }, this.renderLeafField(displayValue), this.renderHistoryEditor())));
|
|
4337
|
+
return (h(Host, null, h("div", { class: "mrd-field__inner" }, this.isMultiScalar() ? this.renderMultiScalarField() : this.renderLeafField(displayValue), this.renderHistoryEditor())));
|
|
4264
4338
|
}
|
|
4265
4339
|
get el() { return getElement(this); }
|
|
4266
4340
|
static get watchers() { return {
|
|
@@ -5199,6 +5273,16 @@ function showsEmpty(item) {
|
|
|
5199
5273
|
var _a, _b, _c, _d, _e;
|
|
5200
5274
|
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;
|
|
5201
5275
|
}
|
|
5276
|
+
/** Whether a RELATION item has a resolvable link value (`_links[item.name]`
|
|
5277
|
+
* carries either a multi-value `values[]` or a single `name`). */
|
|
5278
|
+
function hasRelationValue(item, data) {
|
|
5279
|
+
var _a, _b;
|
|
5280
|
+
if (!item.name)
|
|
5281
|
+
return false;
|
|
5282
|
+
const links = ((_a = data === null || data === void 0 ? void 0 : data._links) !== null && _a !== void 0 ? _a : {});
|
|
5283
|
+
const link = links[item.name];
|
|
5284
|
+
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));
|
|
5285
|
+
}
|
|
5202
5286
|
/** Depth-first flatten of the SECTION/GROUP tree. */
|
|
5203
5287
|
function flattenItems(items) {
|
|
5204
5288
|
const result = [];
|
|
@@ -5311,7 +5395,7 @@ function renderHistoryBadge(ctx, item, raw) {
|
|
|
5311
5395
|
ctx.on.toggleHistory(isOpen ? null : item.name);
|
|
5312
5396
|
} }, h("svg", { class: "mrd-layout-section__history-icon", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, 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 && (h("div", { class: "mrd-layout-section__history-popover", role: "listbox" }, sorted.map((entry, i) => (h("div", { key: String(i), class: "mrd-layout-section__history-entry" }, entry.value, " (", t('history_until', ctx.locale), " ", formatDate(entry.until, ctx.locale), ")")))))));
|
|
5313
5397
|
}
|
|
5314
|
-
function
|
|
5398
|
+
function fieldRenderState(ctx, item) {
|
|
5315
5399
|
var _a, _b;
|
|
5316
5400
|
if (!item.name)
|
|
5317
5401
|
return null;
|
|
@@ -5321,10 +5405,27 @@ function renderField(ctx, item) {
|
|
|
5321
5405
|
? raw.current
|
|
5322
5406
|
: raw;
|
|
5323
5407
|
const renderedValue = renderFieldValue(ctx, item, rawValue);
|
|
5408
|
+
return { raw, rawValue, renderedValue, isEmpty: renderedValue == null };
|
|
5409
|
+
}
|
|
5410
|
+
/** Whether a FIELD item would render anything at all (value, or a showEmpty
|
|
5411
|
+
* placeholder). A `header` field always renders. Used by mrd-layout-section
|
|
5412
|
+
* to decide whether a preceding HEADER item's block is entirely empty. */
|
|
5413
|
+
function isFieldVisible(ctx, item) {
|
|
5414
|
+
if (item.header)
|
|
5415
|
+
return true;
|
|
5416
|
+
const state = fieldRenderState(ctx, item);
|
|
5417
|
+
if (!state)
|
|
5418
|
+
return false;
|
|
5419
|
+
return !state.isEmpty || showsEmpty(item);
|
|
5420
|
+
}
|
|
5421
|
+
function renderField(ctx, item) {
|
|
5422
|
+
const state = fieldRenderState(ctx, item);
|
|
5423
|
+
if (!state)
|
|
5424
|
+
return null;
|
|
5425
|
+
const { raw, rawValue, renderedValue, isEmpty } = state;
|
|
5324
5426
|
if (item.header) {
|
|
5325
5427
|
return (h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
5326
5428
|
}
|
|
5327
|
-
const isEmpty = renderedValue == null;
|
|
5328
5429
|
if (isEmpty && !showsEmpty(item))
|
|
5329
5430
|
return null;
|
|
5330
5431
|
const isBlock = item.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
@@ -5333,7 +5434,7 @@ function renderField(ctx, item) {
|
|
|
5333
5434
|
return (h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}${isEmpty ? ' mrd-layout-section__field--empty' : ''}`, key: item.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, isEmpty ? t('value_empty', ctx.locale) : renderedValue, renderHistoryBadge(ctx, item, raw))));
|
|
5334
5435
|
}
|
|
5335
5436
|
|
|
5336
|
-
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}`;
|
|
5437
|
+
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}`;
|
|
5337
5438
|
|
|
5338
5439
|
const MrdLayoutSection = class {
|
|
5339
5440
|
constructor(hostRef) {
|
|
@@ -5347,6 +5448,7 @@ const MrdLayoutSection = class {
|
|
|
5347
5448
|
this.mrdViewAction = createEvent(this, "mrdViewAction");
|
|
5348
5449
|
this.mrdLoadViewAggregations = createEvent(this, "mrdLoadViewAggregations");
|
|
5349
5450
|
this.mrdLoadViewDistinct = createEvent(this, "mrdLoadViewDistinct");
|
|
5451
|
+
this.mrdViewCheckCapabilities = createEvent(this, "mrdViewCheckCapabilities");
|
|
5350
5452
|
this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
|
|
5351
5453
|
this.mrdDeleteObject = createEvent(this, "mrdDeleteObject");
|
|
5352
5454
|
this.mrdViewUpload = createEvent(this, "mrdViewUpload");
|
|
@@ -5377,7 +5479,16 @@ const MrdLayoutSection = class {
|
|
|
5377
5479
|
this.imagePreviewUrl = null;
|
|
5378
5480
|
this.imagePreviews = {};
|
|
5379
5481
|
this.openHistoryField = null;
|
|
5482
|
+
/** Answers to mrdViewCheckCapabilities, keyed by view key — see emitCapabilitiesChecks().
|
|
5483
|
+
* Passed straight down as a `canCreate`/`mayCreate` prop to whichever body (mrd-table,
|
|
5484
|
+
* mrd-memo-container, mrd-document-container) is mounted for that key; a missing entry
|
|
5485
|
+
* means "not answered yet" and is treated as false (hidden), same default as mrd-table's
|
|
5486
|
+
* own standalone behaviour (TASK-0299). */
|
|
5487
|
+
this.canCreateMap = {};
|
|
5380
5488
|
this.historyClickOutside = null;
|
|
5489
|
+
/** Signature last asked per view key (see emitCapabilitiesChecks()) — avoids re-emitting
|
|
5490
|
+
* mrdViewCheckCapabilities on every data/items update when the binding hasn't changed. */
|
|
5491
|
+
this.capabilitiesAsked = new Map();
|
|
5381
5492
|
this.searchTimers = {};
|
|
5382
5493
|
this.handleViewLoadPage = (e, name) => {
|
|
5383
5494
|
e.stopPropagation();
|
|
@@ -5397,6 +5508,10 @@ const MrdLayoutSection = class {
|
|
|
5397
5508
|
};
|
|
5398
5509
|
}
|
|
5399
5510
|
componentDidLoad() {
|
|
5511
|
+
// No DOM/child-hydration dependency, unlike initEmbeddedTables()/emitLoadImages() below —
|
|
5512
|
+
// run it immediately rather than deferring, so the host's answer (setViewCanCreate) can
|
|
5513
|
+
// land before the child bodies even mount.
|
|
5514
|
+
this.emitCapabilitiesChecks();
|
|
5400
5515
|
setTimeout(() => {
|
|
5401
5516
|
this.initEmbeddedTables();
|
|
5402
5517
|
this.emitLoadImages();
|
|
@@ -5415,9 +5530,15 @@ const MrdLayoutSection = class {
|
|
|
5415
5530
|
}
|
|
5416
5531
|
dataChanged(newVal) {
|
|
5417
5532
|
if (newVal && Object.keys(newVal).length > 0) {
|
|
5533
|
+
this.emitCapabilitiesChecks();
|
|
5418
5534
|
setTimeout(() => this.initEmbeddedTables(), 0);
|
|
5419
5535
|
}
|
|
5420
5536
|
}
|
|
5537
|
+
/** A host can swap `items` (e.g. a different dashboard layout) without `data` changing —
|
|
5538
|
+
* dataChanged() alone would miss that binding change. */
|
|
5539
|
+
itemsChanged() {
|
|
5540
|
+
this.emitCapabilitiesChecks();
|
|
5541
|
+
}
|
|
5421
5542
|
async initEmbeddedTables() {
|
|
5422
5543
|
const tables = this.el.querySelectorAll('mrd-table[data-view]');
|
|
5423
5544
|
for (const table of Array.from(tables)) {
|
|
@@ -5445,6 +5566,53 @@ const MrdLayoutSection = class {
|
|
|
5445
5566
|
}
|
|
5446
5567
|
}
|
|
5447
5568
|
}
|
|
5569
|
+
/** Parent record id extracted from `data._links.self.href` — the same value every
|
|
5570
|
+
* VIEW/RELATED_VIEW item on this record shares, used for RELATED_VIEW path construction
|
|
5571
|
+
* (renderRelatedView) and capability checks (emitCapabilitiesChecks). */
|
|
5572
|
+
computeParentId() {
|
|
5573
|
+
var _a, _b, _c, _d, _e;
|
|
5574
|
+
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 : '';
|
|
5575
|
+
return (_e = selfHref.split('/').filter(Boolean).pop()) !== null && _e !== void 0 ? _e : '';
|
|
5576
|
+
}
|
|
5577
|
+
/** Asks, once per VIEW/RELATED_VIEW binding, whether the current user may create a record
|
|
5578
|
+
* there — the single generic place for this check (TASK-0299/FINDING-0155), so mrd-table,
|
|
5579
|
+
* mrd-memo-container and mrd-document-container all get the answer the same way: as a plain
|
|
5580
|
+
* `canCreate`/`mayCreate` prop from this component, computed here and handed down in
|
|
5581
|
+
* renderTable()/renderMemoContainer()/renderDocumentContainer() — none of the three leaf
|
|
5582
|
+
* components need to ask on their own when rendered through mrd-layout-section (mrd-table's
|
|
5583
|
+
* own self-ask only kicks in for standalone use, i.e. its `canCreate` prop left undefined).
|
|
5584
|
+
*
|
|
5585
|
+
* The route/path variables mirror what each renderer already uses for its own rows —
|
|
5586
|
+
* `type` = `dataClass`, `refType`/`refId` = `fromClass`/parentId for a RELATED_VIEW, and
|
|
5587
|
+
* `filterClass` when the view is scoped to one subtype (the same value sent as `?type=` on
|
|
5588
|
+
* the row fetch). A signature (not just the key) is tracked per binding so a genuine route
|
|
5589
|
+
* change re-asks and hides again, without re-asking on every unrelated data/items update. */
|
|
5590
|
+
emitCapabilitiesChecks() {
|
|
5591
|
+
var _a, _b, _c, _d;
|
|
5592
|
+
const parentId = this.computeParentId();
|
|
5593
|
+
for (const item of flattenItems(this.items)) {
|
|
5594
|
+
if (item.type !== ClientLayoutItemType.VIEW && item.type !== ClientLayoutItemType.RELATED_VIEW)
|
|
5595
|
+
continue;
|
|
5596
|
+
const key = viewKeyFor(item);
|
|
5597
|
+
if (!key || !item.view)
|
|
5598
|
+
continue;
|
|
5599
|
+
const isRelatedView = item.type === ClientLayoutItemType.RELATED_VIEW;
|
|
5600
|
+
const type = (_b = (_a = item.dataClass) !== null && _a !== void 0 ? _a : item.relatedClass) !== null && _b !== void 0 ? _b : key;
|
|
5601
|
+
const refType = isRelatedView ? ((_c = item.fromClass) !== null && _c !== void 0 ? _c : '') : undefined;
|
|
5602
|
+
const refId = isRelatedView ? parentId : undefined;
|
|
5603
|
+
const filterClass = (_d = item.filterClass) !== null && _d !== void 0 ? _d : undefined;
|
|
5604
|
+
const signature = JSON.stringify([type, refType, refId, filterClass]);
|
|
5605
|
+
if (this.capabilitiesAsked.get(key) === signature)
|
|
5606
|
+
continue;
|
|
5607
|
+
this.capabilitiesAsked.set(key, signature);
|
|
5608
|
+
if (key in this.canCreateMap) {
|
|
5609
|
+
const next = Object.assign({}, this.canCreateMap);
|
|
5610
|
+
delete next[key];
|
|
5611
|
+
this.canCreateMap = next;
|
|
5612
|
+
}
|
|
5613
|
+
this.mrdViewCheckCapabilities.emit(Object.assign(Object.assign({ name: key, type }, (refType !== undefined ? { refType, refId } : {})), (filterClass ? { filterClass } : {})));
|
|
5614
|
+
}
|
|
5615
|
+
}
|
|
5448
5616
|
/** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
|
|
5449
5617
|
async setSearchResults(results, dataClass) {
|
|
5450
5618
|
const key = dataClass !== null && dataClass !== void 0 ? dataClass : this.resolveSearchKey();
|
|
@@ -5486,6 +5654,14 @@ const MrdLayoutSection = class {
|
|
|
5486
5654
|
return;
|
|
5487
5655
|
await table.setAggregations(data);
|
|
5488
5656
|
}
|
|
5657
|
+
/** Host answer to mrdViewCheckCapabilities — whether the current user may create a record
|
|
5658
|
+
* for the given view's bound route. `name` is the view key from the event detail. Stored in
|
|
5659
|
+
* canCreateMap and passed down as a plain prop to whichever body is mounted for that key
|
|
5660
|
+
* (mrd-table, mrd-memo-container or mrd-document-container) — no DOM lookup needed, unlike
|
|
5661
|
+
* setViewPage/setViewAggregations, since the prop flows through the next render. */
|
|
5662
|
+
async setViewCanCreate(name, value) {
|
|
5663
|
+
this.canCreateMap = Object.assign(Object.assign({}, this.canCreateMap), { [name]: value });
|
|
5664
|
+
}
|
|
5489
5665
|
/** Inject distinct values into an embedded mrd-document-list for a document view. */
|
|
5490
5666
|
async setViewDistinct(name, nodeId, values) {
|
|
5491
5667
|
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
@@ -5558,7 +5734,7 @@ const MrdLayoutSection = class {
|
|
|
5558
5734
|
else if (link === null || link === void 0 ? void 0 : link.name) {
|
|
5559
5735
|
valueContent = makeBtn(link.href, link.name);
|
|
5560
5736
|
}
|
|
5561
|
-
const isEmpty = !
|
|
5737
|
+
const isEmpty = !hasRelationValue(item, this.data);
|
|
5562
5738
|
if (isEmpty && !showsEmpty(item))
|
|
5563
5739
|
return null;
|
|
5564
5740
|
return (h("div", { class: `mrd-layout-section__field${isEmpty ? ' mrd-layout-section__field--empty' : ''}`, key: item.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, isEmpty ? t('value_empty', this.locale) : valueContent)));
|
|
@@ -5580,24 +5756,37 @@ const MrdLayoutSection = class {
|
|
|
5580
5756
|
if (!item.view)
|
|
5581
5757
|
return null;
|
|
5582
5758
|
const showTitle = (_a = item.showTitle) !== null && _a !== void 0 ? _a : false;
|
|
5583
|
-
// Extract parentId from data._links.self.href for RELATED_VIEW path construction
|
|
5584
5759
|
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 : '';
|
|
5585
|
-
const parentId =
|
|
5760
|
+
const parentId = this.computeParentId();
|
|
5586
5761
|
// The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
|
|
5587
5762
|
// (sibling of `view`), not inside `view`.
|
|
5588
|
-
const docArchetype = resolveArchetype((
|
|
5589
|
-
const memoArchetype = !docArchetype ? resolveArchetype((
|
|
5763
|
+
const docArchetype = resolveArchetype((_f = item.archetypes) !== null && _f !== void 0 ? _f : (_g = item.view) === null || _g === void 0 ? void 0 : _g.archetypes, ARCHETYPE_DOCUMENT);
|
|
5764
|
+
const memoArchetype = !docArchetype ? resolveArchetype((_h = item.archetypes) !== null && _h !== void 0 ? _h : (_j = item.view) === null || _j === void 0 ? void 0 : _j.archetypes, ARCHETYPE_MEMO) : undefined;
|
|
5590
5765
|
// Canonical parent href for single-container seeding: use the RELATED_VIEW's
|
|
5591
5766
|
// fromClass (base class) rather than the route class, so polymorphic subtypes
|
|
5592
5767
|
// resolve to the same container the documents actually reference.
|
|
5593
5768
|
const containerHref = buildContainerHref(item, selfHref, parentId);
|
|
5594
|
-
|
|
5769
|
+
// A memo RELATED_VIEW isn't necessarily scoped by the container relation —
|
|
5770
|
+
// e.g. a person's dashboard can show "memos I authored" via the author
|
|
5771
|
+
// relation instead. inverseRelation names which relation on the memo points
|
|
5772
|
+
// back to this parent; only when it matches the container slot does the
|
|
5773
|
+
// parent's own href double as the memo's container.
|
|
5774
|
+
const memoContainerRelated = item.type !== ClientLayoutItemType.RELATED_VIEW
|
|
5775
|
+
|| item.inverseRelation === ((_k = memoArchetype === null || memoArchetype === void 0 ? void 0 : memoArchetype.slots) === null || _k === void 0 ? void 0 : _k.container);
|
|
5776
|
+
const memoContainerHref = memoContainerRelated ? containerHref : '';
|
|
5777
|
+
// Distinct from memoContainerRelated: only a genuine container-scoped
|
|
5778
|
+
// RELATED_VIEW (a company's own memo tab) makes every card's container
|
|
5779
|
+
// obvious from the page itself. A top-level VIEW or an author-scoped
|
|
5780
|
+
// RELATED_VIEW both still need the per-card container link.
|
|
5781
|
+
const memoContainerImplied = item.type === ClientLayoutItemType.RELATED_VIEW && memoContainerRelated;
|
|
5782
|
+
return (h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && 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)));
|
|
5595
5783
|
}
|
|
5596
5784
|
/** Document collection view: owns the view-switch + collection actions and
|
|
5597
5785
|
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
5598
5786
|
* the host with the view key, exactly as the raw list/table events were. */
|
|
5599
5787
|
renderDocumentContainer(item, key, parentId, archetype, containerHref) {
|
|
5600
|
-
|
|
5788
|
+
var _a;
|
|
5789
|
+
return (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) => {
|
|
5601
5790
|
e.stopPropagation();
|
|
5602
5791
|
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
5603
5792
|
}, onMrdLoadPage: (e) => {
|
|
@@ -5631,10 +5820,14 @@ const MrdLayoutSection = class {
|
|
|
5631
5820
|
}
|
|
5632
5821
|
/** Memo collection view: owns the view-switch + "New memo" and swaps between
|
|
5633
5822
|
* the card list and the flat table, mirroring renderDocumentContainer(). */
|
|
5634
|
-
renderMemoContainer(item, key, parentId, archetype, containerHref) {
|
|
5635
|
-
var _a, _b, _c, _d;
|
|
5823
|
+
renderMemoContainer(item, key, parentId, archetype, containerHref, containerRelated, showContainerLink) {
|
|
5824
|
+
var _a, _b, _c, _d, _e;
|
|
5636
5825
|
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;
|
|
5637
|
-
return (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,
|
|
5826
|
+
return (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) => {
|
|
5827
|
+
var _a;
|
|
5828
|
+
e.stopPropagation();
|
|
5829
|
+
this.mrdNavigate.emit(Object.assign(Object.assign({}, e.detail), { navigateBehaviour: (_a = item.navigateBehaviour) !== null && _a !== void 0 ? _a : ClientLayoutNavigateBehaviour.PAGE }));
|
|
5830
|
+
}, onMrdLoadPage: (e) => {
|
|
5638
5831
|
e.stopPropagation();
|
|
5639
5832
|
this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
|
|
5640
5833
|
}, onMrdLoadAggregations: (e) => {
|
|
@@ -5657,7 +5850,8 @@ const MrdLayoutSection = class {
|
|
|
5657
5850
|
} }));
|
|
5658
5851
|
}
|
|
5659
5852
|
renderTable(item, key, parentId) {
|
|
5660
|
-
|
|
5853
|
+
var _a;
|
|
5854
|
+
return (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) => {
|
|
5661
5855
|
var _a;
|
|
5662
5856
|
e.stopPropagation();
|
|
5663
5857
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
@@ -5685,7 +5879,26 @@ const MrdLayoutSection = class {
|
|
|
5685
5879
|
});
|
|
5686
5880
|
} }));
|
|
5687
5881
|
}
|
|
5688
|
-
|
|
5882
|
+
/** Whether every FIELD/RELATION item following a HEADER (up to the next
|
|
5883
|
+
* HEADER/SECTION/GROUP or the end of `siblings`) would itself render
|
|
5884
|
+
* nothing — i.e. the HEADER would introduce an empty block. Other item
|
|
5885
|
+
* types (VIEW, NAVIGATE, TEXT, ...) always count as visible. */
|
|
5886
|
+
isHeaderBlockEmpty(siblings, index) {
|
|
5887
|
+
const ctx = this.fieldCtx();
|
|
5888
|
+
for (let i = index + 1; i < siblings.length; i++) {
|
|
5889
|
+
const sib = siblings[i];
|
|
5890
|
+
if (sib.type === ClientLayoutItemType.HEADER || sib.type === ClientLayoutItemType.SECTION || sib.type === ClientLayoutItemType.GROUP)
|
|
5891
|
+
break;
|
|
5892
|
+
if (sib.type === ClientLayoutItemType.FIELD && isFieldVisible(ctx, sib))
|
|
5893
|
+
return false;
|
|
5894
|
+
if (sib.type === ClientLayoutItemType.RELATION && (hasRelationValue(sib, this.data) || showsEmpty(sib)))
|
|
5895
|
+
return false;
|
|
5896
|
+
if (sib.type !== ClientLayoutItemType.FIELD && sib.type !== ClientLayoutItemType.RELATION)
|
|
5897
|
+
return false;
|
|
5898
|
+
}
|
|
5899
|
+
return true;
|
|
5900
|
+
}
|
|
5901
|
+
renderItem(item, siblings = this.items, index = -1) {
|
|
5689
5902
|
var _a, _b;
|
|
5690
5903
|
switch (item.type) {
|
|
5691
5904
|
case ClientLayoutItemType.FIELD:
|
|
@@ -5693,6 +5906,8 @@ const MrdLayoutSection = class {
|
|
|
5693
5906
|
case ClientLayoutItemType.RELATION:
|
|
5694
5907
|
return this.renderRelation(item);
|
|
5695
5908
|
case ClientLayoutItemType.HEADER:
|
|
5909
|
+
if (index >= 0 && this.isHeaderBlockEmpty(siblings, index))
|
|
5910
|
+
return null;
|
|
5696
5911
|
return (h("h2", { class: "mrd-layout-section__header", key: `header-${item.label}` }, item.label));
|
|
5697
5912
|
case ClientLayoutItemType.TEXT:
|
|
5698
5913
|
return h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
|
|
@@ -5702,7 +5917,7 @@ const MrdLayoutSection = class {
|
|
|
5702
5917
|
return this.renderSearch(item);
|
|
5703
5918
|
case ClientLayoutItemType.SECTION:
|
|
5704
5919
|
case ClientLayoutItemType.GROUP:
|
|
5705
|
-
return (h("div", { class: "mrd-layout-section__group", key: `group-${item.label}` }, item.label && h("h3", { class: "mrd-layout-section__group-title" }, item.label), ((_b = item.items) !== null && _b !== void 0 ? _b : []).map(child => this.renderItem(child))));
|
|
5920
|
+
return (h("div", { class: "mrd-layout-section__group", key: `group-${item.label}` }, item.label && 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); })));
|
|
5706
5921
|
case ClientLayoutItemType.RELATED_VIEW:
|
|
5707
5922
|
case ClientLayoutItemType.VIEW:
|
|
5708
5923
|
return this.renderRelatedView(item);
|
|
@@ -5774,12 +5989,15 @@ const MrdLayoutSection = class {
|
|
|
5774
5989
|
const emailArchetype = !docArchetype && !invoiceArchetype ? resolveArchetype(this.archetypes, ARCHETYPE_EMAIL) : undefined;
|
|
5775
5990
|
const memoArchetype = !docArchetype && !invoiceArchetype && !emailArchetype ? resolveArchetype(this.archetypes, ARCHETYPE_MEMO) : undefined;
|
|
5776
5991
|
const anyArchetype = docArchetype || invoiceArchetype || emailArchetype || memoArchetype;
|
|
5777
|
-
return (h(Host, { key: '
|
|
5992
|
+
return (h(Host, { key: '508ca481c777d65d1739f7b5f30f5f3ad8722655' }, 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()));
|
|
5778
5993
|
}
|
|
5779
5994
|
get el() { return getElement(this); }
|
|
5780
5995
|
static get watchers() { return {
|
|
5781
5996
|
"data": [{
|
|
5782
5997
|
"dataChanged": 0
|
|
5998
|
+
}],
|
|
5999
|
+
"items": [{
|
|
6000
|
+
"itemsChanged": 0
|
|
5783
6001
|
}]
|
|
5784
6002
|
}; }
|
|
5785
6003
|
};
|
|
@@ -5905,6 +6123,7 @@ const MrdMemoContainer = class {
|
|
|
5905
6123
|
registerInstance(this, hostRef);
|
|
5906
6124
|
this.mrdLoadPage = createEvent(this, "mrdLoadPage");
|
|
5907
6125
|
this.mrdLoadAggregations = createEvent(this, "mrdLoadAggregations");
|
|
6126
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
5908
6127
|
this.mrdAction = createEvent(this, "mrdAction");
|
|
5909
6128
|
this.mrdCreateObject = createEvent(this, "mrdCreateObject");
|
|
5910
6129
|
this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
|
|
@@ -5916,6 +6135,20 @@ const MrdMemoContainer = class {
|
|
|
5916
6135
|
/** Canonical parent href — set when this is a RELATED_VIEW embedded under a
|
|
5917
6136
|
* parent record, which already gives a new memo something to attach to. */
|
|
5918
6137
|
this.containerHref = '';
|
|
6138
|
+
/** False when this RELATED_VIEW's parent is related via a relation other than
|
|
6139
|
+
* the archetype's container slot (e.g. a person's "memos I authored" list,
|
|
6140
|
+
* related via `author`) — mrd-layout-section resolves this from the item's
|
|
6141
|
+
* `inverseRelation`. In that case the parent is not a valid container for a
|
|
6142
|
+
* new memo, and — unlike a top-level VIEW with no context at all — falling
|
|
6143
|
+
* back to `me` would be wrong too (creating a memo "on myself" from someone
|
|
6144
|
+
* else's authored-memos list makes no sense), so "New memo" is hidden outright. */
|
|
6145
|
+
this.containerRelated = true;
|
|
6146
|
+
/** True unless this is a container-scoped RELATED_VIEW (a company's own memo
|
|
6147
|
+
* tab, say) where every card's container is obviously the page you're
|
|
6148
|
+
* already on — forwarded to mrd-memo-list to show/hide its per-card
|
|
6149
|
+
* container link. A top-level VIEW or an author-scoped RELATED_VIEW both
|
|
6150
|
+
* still need it, since the container isn't implied by the page context. */
|
|
6151
|
+
this.showContainerLink = true;
|
|
5919
6152
|
/** Lookup key used for the embedded `data-view` attribute. */
|
|
5920
6153
|
this.viewKey = '';
|
|
5921
6154
|
this.locale = navigator.language;
|
|
@@ -5926,6 +6159,10 @@ const MrdMemoContainer = class {
|
|
|
5926
6159
|
* tooltip, cards/rows are not clickable, and the embedded table's own
|
|
5927
6160
|
* create action is disabled too. */
|
|
5928
6161
|
this.readOnly = false;
|
|
6162
|
+
/** Whether the current user may create a memo here — set by mrd-layout-section from its
|
|
6163
|
+
* generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table
|
|
6164
|
+
* gets in table mode. Defaults to false (hidden) until confirmed, same as mrd-table. */
|
|
6165
|
+
this.canCreate = false;
|
|
5929
6166
|
/** The active account's linked person record (userProfile.links.person), if any.
|
|
5930
6167
|
* Used both to gate "New memo" (see effectiveContainerHref) and, on submit, to
|
|
5931
6168
|
* fill the author slot. */
|
|
@@ -6147,15 +6384,18 @@ const MrdMemoContainer = class {
|
|
|
6147
6384
|
return !!((_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.important);
|
|
6148
6385
|
}
|
|
6149
6386
|
/** A parent record already gives a new memo somewhere to attach to (RELATED_VIEW);
|
|
6150
|
-
* otherwise fall back to the account's own linked person (top-level VIEW)
|
|
6387
|
+
* otherwise fall back to the account's own linked person (top-level VIEW) — but
|
|
6388
|
+
* only when containerRelated allows it (see its doc comment). */
|
|
6151
6389
|
get effectiveContainerHref() {
|
|
6390
|
+
if (!this.containerRelated)
|
|
6391
|
+
return '';
|
|
6152
6392
|
return this.containerHref || this.meHref();
|
|
6153
6393
|
}
|
|
6154
6394
|
/** The author slot is always filled from `me` (there is no author picker in
|
|
6155
6395
|
* the dialog), so without it there is nothing valid to create — regardless
|
|
6156
6396
|
* of whether a parent record already supplies a container. */
|
|
6157
6397
|
get canAdd() {
|
|
6158
|
-
return !this.readOnly && !!this.meHref() && !!this.effectiveContainerHref;
|
|
6398
|
+
return this.canCreate && !this.readOnly && !!this.meHref() && !!this.effectiveContainerHref;
|
|
6159
6399
|
}
|
|
6160
6400
|
/** Path for creating a new memo: `/{dataClass}` for a top-level VIEW, or
|
|
6161
6401
|
* `/{fromClass}/{parentId}/{dataClass}` when nested under a parent record. */
|
|
@@ -6169,7 +6409,7 @@ const MrdMemoContainer = class {
|
|
|
6169
6409
|
});
|
|
6170
6410
|
}
|
|
6171
6411
|
renderToolbar() {
|
|
6172
|
-
return (h("div", { class: "mrd-memo-container__toolbar" }, this.mode === 'cards' && (h("button", { type: "button", class: "mrd-memo-container__action", disabled: !this.canAdd, title: this.readOnly ? t('readonly_access', this.locale) : undefined, onClick: this.openCreate }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M12 5v14M5 12h14" })), t('memo_new', this.locale))), h("div", { class: "mrd-memo-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'cards'), title: t('memo_view_cards', this.locale), "aria-label": t('memo_view_cards', this.locale), onClick: () => this.setMode('cards') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("rect", { x: "3", y: "4", width: "7", height: "7", rx: "1" }), h("rect", { x: "14", y: "4", width: "7", height: "7", rx: "1" }), h("rect", { x: "3", y: "15", width: "7", height: "5", rx: "1" }), h("rect", { x: "14", y: "15", width: "7", height: "5", rx: "1" }))), h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'table'), title: t('memo_view_table', this.locale), "aria-label": t('memo_view_table', this.locale), onClick: () => this.setMode('table') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
6412
|
+
return (h("div", { class: "mrd-memo-container__toolbar" }, this.mode === 'cards' && this.canCreate && (h("button", { type: "button", class: "mrd-memo-container__action", disabled: !this.canAdd, title: this.readOnly ? t('readonly_access', this.locale) : undefined, onClick: this.openCreate }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M12 5v14M5 12h14" })), t('memo_new', this.locale))), h("div", { class: "mrd-memo-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'cards'), title: t('memo_view_cards', this.locale), "aria-label": t('memo_view_cards', this.locale), onClick: () => this.setMode('cards') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("rect", { x: "3", y: "4", width: "7", height: "7", rx: "1" }), h("rect", { x: "14", y: "4", width: "7", height: "7", rx: "1" }), h("rect", { x: "3", y: "15", width: "7", height: "5", rx: "1" }), h("rect", { x: "14", y: "15", width: "7", height: "5", rx: "1" }))), h("button", { class: "mrd-memo-container__seg-btn", "aria-pressed": String(this.mode === 'table'), title: t('memo_view_table', this.locale), "aria-label": t('memo_view_table', this.locale), onClick: () => this.setMode('table') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
6173
6413
|
}
|
|
6174
6414
|
renderDeleteConfirm() {
|
|
6175
6415
|
return (h("div", null, h("h2", { class: "mrd-memo-container__modal-title" }, t('memo_delete_confirm_title', this.locale)), h("p", { class: "mrd-memo-container__modal-warning" }, t('memo_delete_confirm_body', this.locale)), h("div", { class: "mrd-memo-container__modal-actions" }, h("button", { type: "button", class: "mrd-memo-container__modal-cancel", onClick: this.cancelDeleteConfirm }, t('cancel', this.locale)), h("button", { type: "button", class: "mrd-memo-container__modal-delete-confirm", onClick: this.confirmDelete }, t('delete', this.locale)))));
|
|
@@ -6194,16 +6434,19 @@ const MrdMemoContainer = class {
|
|
|
6194
6434
|
return (h("div", { class: "mrd-memo-container__modal-backdrop", onClick: this.closeDialog }, h("div", { class: "mrd-memo-container__modal", onClick: (e) => e.stopPropagation() }, this.deleteConfirmOpen ? this.renderDeleteConfirm() : this.renderForm())));
|
|
6195
6435
|
}
|
|
6196
6436
|
renderCards() {
|
|
6197
|
-
return (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) => {
|
|
6437
|
+
return (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) => {
|
|
6198
6438
|
e.stopPropagation();
|
|
6199
6439
|
this.mrdLoadPage.emit(e.detail);
|
|
6200
6440
|
}, onMrdEdit: (e) => {
|
|
6201
6441
|
e.stopPropagation();
|
|
6202
6442
|
this.openEdit(e.detail.row);
|
|
6443
|
+
}, onMrdNavigate: (e) => {
|
|
6444
|
+
e.stopPropagation();
|
|
6445
|
+
this.mrdNavigate.emit(e.detail);
|
|
6203
6446
|
} }));
|
|
6204
6447
|
}
|
|
6205
6448
|
renderTable() {
|
|
6206
|
-
return (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) => {
|
|
6449
|
+
return (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) => {
|
|
6207
6450
|
e.stopPropagation();
|
|
6208
6451
|
this.mrdLoadPage.emit(e.detail);
|
|
6209
6452
|
}, onMrdLoadAggregations: (e) => {
|
|
@@ -6218,7 +6461,7 @@ const MrdMemoContainer = class {
|
|
|
6218
6461
|
} }));
|
|
6219
6462
|
}
|
|
6220
6463
|
render() {
|
|
6221
|
-
return (h(Host, { key: '
|
|
6464
|
+
return (h(Host, { key: 'b0479aad6dc49935442183fcbdf30c07c2c490ff' }, this.renderToolbar(), h("div", { key: '40d0fb882186001ad4984c1ba64c5a5c529f4d76', class: "mrd-memo-container__body" }, this.mode === 'cards' ? this.renderCards() : this.renderTable()), this.renderDialog()));
|
|
6222
6465
|
}
|
|
6223
6466
|
static get watchers() { return {
|
|
6224
6467
|
"dialogOpen": [{
|
|
@@ -6412,7 +6655,7 @@ function datetimeFilterToDisplay(existing) {
|
|
|
6412
6655
|
return display;
|
|
6413
6656
|
}
|
|
6414
6657
|
|
|
6415
|
-
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}`;
|
|
6658
|
+
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}`;
|
|
6416
6659
|
|
|
6417
6660
|
/** Plain-text length above which a card's body is clamped with a show-more toggle. */
|
|
6418
6661
|
const BODY_PREVIEW_THRESHOLD = 220;
|
|
@@ -6421,6 +6664,7 @@ const MrdMemoList = class {
|
|
|
6421
6664
|
registerInstance(this, hostRef);
|
|
6422
6665
|
this.mrdLoadPage = createEvent(this, "mrdLoadPage");
|
|
6423
6666
|
this.mrdEdit = createEvent(this, "mrdEdit");
|
|
6667
|
+
this.mrdNavigate = createEvent(this, "mrdNavigate");
|
|
6424
6668
|
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
6425
6669
|
this.item = null;
|
|
6426
6670
|
/** Parent record id — required for RELATED_VIEW path building. */
|
|
@@ -6434,6 +6678,11 @@ const MrdMemoList = class {
|
|
|
6434
6678
|
/** listItems of the FIELD bound to the `labels` slot, resolved by mrd-layout-section
|
|
6435
6679
|
* from its own items array, same reason mrd-memo-view needs it. */
|
|
6436
6680
|
this.labelsListItems = null;
|
|
6681
|
+
/** False when the list is already scoped to its own container (a company's own
|
|
6682
|
+
* memo tab) — showing "belongs to: <this same company>" on every card there
|
|
6683
|
+
* would be redundant. True everywhere else (top-level VIEW, or a RELATED_VIEW
|
|
6684
|
+
* scoped by a different relation, e.g. a person's authored-memos list). */
|
|
6685
|
+
this.showContainerLink = true;
|
|
6437
6686
|
this.rows = [];
|
|
6438
6687
|
this.loading = false;
|
|
6439
6688
|
this.exhausted = false;
|
|
@@ -6535,6 +6784,14 @@ const MrdMemoList = class {
|
|
|
6535
6784
|
return 0;
|
|
6536
6785
|
return String(raw).replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim().length;
|
|
6537
6786
|
}
|
|
6787
|
+
renderContainer(row) {
|
|
6788
|
+
if (!this.showContainerLink)
|
|
6789
|
+
return null;
|
|
6790
|
+
const link = this.slotLink(row, 'container');
|
|
6791
|
+
if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
|
|
6792
|
+
return null;
|
|
6793
|
+
return (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));
|
|
6794
|
+
}
|
|
6538
6795
|
renderLabels(row) {
|
|
6539
6796
|
const raw = this.slotValue(row, 'labels');
|
|
6540
6797
|
const keys = Array.isArray(raw) ? raw.map(String) : (raw != null && raw !== '' ? [String(raw)] : []);
|
|
@@ -6579,10 +6836,10 @@ const MrdMemoList = class {
|
|
|
6579
6836
|
e.preventDefault();
|
|
6580
6837
|
this.mrdEdit.emit({ row });
|
|
6581
6838
|
}
|
|
6582
|
-
} }, h("div", { class: "mrd-memo-list__card-header" }, title && h("span", { class: "mrd-memo-list__card-title" }, title), important && (h("span", { class: "mrd-memo-list__card-important", title: t('memo_important', this.locale) }, h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, 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), h("div", { class: "mrd-memo-list__card-meta" }, (author === null || author === void 0 ? void 0 : author.name) && h("span", { class: "mrd-memo-list__card-author" }, author.name), dateRaw != null && dateRaw !== '' && (h("span", { class: "mrd-memo-list__card-date" }, formatDateTime(dateRaw, this.locale))))));
|
|
6839
|
+
} }, h("div", { class: "mrd-memo-list__card-header" }, title && h("span", { class: "mrd-memo-list__card-title" }, title), important && (h("span", { class: "mrd-memo-list__card-important", title: t('memo_important', this.locale) }, h("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true" }, 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), h("div", { class: "mrd-memo-list__card-meta" }, (author === null || author === void 0 ? void 0 : author.name) && h("span", { class: "mrd-memo-list__card-author" }, author.name), dateRaw != null && dateRaw !== '' && (h("span", { class: "mrd-memo-list__card-date" }, formatDateTime(dateRaw, this.locale)))), this.renderContainer(row)));
|
|
6583
6840
|
}
|
|
6584
6841
|
render() {
|
|
6585
|
-
return (h(Host, { key: '
|
|
6842
|
+
return (h(Host, { key: '18294fc609b741d38f9933d3ae01d20d6dda5ec5' }, 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 && (h("div", { key: '271281b2e087f8fd55dc51b32b1fe4cce387cdcb', class: "mrd-memo-list__empty" }, t('no_results', this.locale))), !this.exhausted && this.rows.length > 0 && (h("button", { key: '24861c35323d759d69bfd4f358657fe201ca7727', type: "button", class: "mrd-memo-list__load-more", disabled: this.loading, onClick: this.loadMore }, t('load_more', this.locale))))));
|
|
6586
6843
|
}
|
|
6587
6844
|
};
|
|
6588
6845
|
MrdMemoList.style = mrdMemoListCss();
|
|
@@ -7336,6 +7593,7 @@ const MrdTable = class {
|
|
|
7336
7593
|
this.mrdAction = createEvent(this, "mrdAction");
|
|
7337
7594
|
this.mrdDownload = createEvent(this, "mrdDownload");
|
|
7338
7595
|
this.mrdLoadAggregations = createEvent(this, "mrdLoadAggregations");
|
|
7596
|
+
this.mrdCheckCapabilities = createEvent(this, "mrdCheckCapabilities");
|
|
7339
7597
|
// ── Non-state internals ────────────────────────────────────────────────────
|
|
7340
7598
|
this.pendingPages = new Set();
|
|
7341
7599
|
this.debounceTimer = null;
|
|
@@ -7441,6 +7699,10 @@ const MrdTable = class {
|
|
|
7441
7699
|
this.aggregationsPending = false;
|
|
7442
7700
|
/** Lower bound on total derived from setPage() hasNext info; grows as pages load. */
|
|
7443
7701
|
this.minKnownTotal = 0;
|
|
7702
|
+
/** Self-asked answer for standalone use (the `canCreate` prop is undefined) — defaults to
|
|
7703
|
+
* hidden (TASK-0299) until the host answers mrdCheckCapabilities via setCanCreate(). Ignored
|
|
7704
|
+
* when the host controls `canCreate` directly; see effectiveCanCreate(). */
|
|
7705
|
+
this.selfCanCreate = false;
|
|
7444
7706
|
this.handleScroll = (e) => {
|
|
7445
7707
|
const scroller = e.currentTarget;
|
|
7446
7708
|
const { renderStart, renderEnd } = computeWindow(scroller.scrollTop, this.rowHeight, this.tableHeight, this.baseTotal);
|
|
@@ -7475,6 +7737,14 @@ const MrdTable = class {
|
|
|
7475
7737
|
this.searchOpen = false;
|
|
7476
7738
|
this.searchQuery = '';
|
|
7477
7739
|
this.stashedFilters = null;
|
|
7740
|
+
this.emitCapabilitiesCheck();
|
|
7741
|
+
}
|
|
7742
|
+
/** A parent-record navigation can reuse the same `item` reference while only `parentId`
|
|
7743
|
+
* changes (e.g. clicking a different dossier for the same RELATED_VIEW layout) — itemChanged()
|
|
7744
|
+
* would not fire for that. Re-ask so a stale canCreate answer from the previous parent never
|
|
7745
|
+
* leaks into the new one. */
|
|
7746
|
+
parentIdChanged() {
|
|
7747
|
+
this.emitCapabilitiesCheck();
|
|
7478
7748
|
}
|
|
7479
7749
|
// ── Lifecycle ──────────────────────────────────────────────────────────────
|
|
7480
7750
|
componentWillLoad() {
|
|
@@ -7482,6 +7752,7 @@ const MrdTable = class {
|
|
|
7482
7752
|
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 : '');
|
|
7483
7753
|
}
|
|
7484
7754
|
componentDidLoad() {
|
|
7755
|
+
this.emitCapabilitiesCheck();
|
|
7485
7756
|
this.staleCheckTimer = setInterval(() => this.checkStalePages(), STALE_CHECK_INTERVAL_MS);
|
|
7486
7757
|
// A table inside a hidden tab pane renders and loads page 0 without ever having a box, so
|
|
7487
7758
|
// the width freeze cannot measure anything. ResizeObserver fires the moment the pane is
|
|
@@ -7600,6 +7871,14 @@ const MrdTable = class {
|
|
|
7600
7871
|
// Fresh totals can be wider than the ones the columns were checked against.
|
|
7601
7872
|
this.fixedContentMeasured = false;
|
|
7602
7873
|
}
|
|
7874
|
+
/** Host answer to mrdCheckCapabilities — whether the current user may create a record for
|
|
7875
|
+
* the table's currently bound route (standalone use only; ignored while the `canCreate`
|
|
7876
|
+
* prop is set, since the host controls it directly in that mode). Call it any time after
|
|
7877
|
+
* the event fires; a stale answer for an old binding is discarded automatically
|
|
7878
|
+
* (selfCanCreate is reset to false before every new mrdCheckCapabilities emission). */
|
|
7879
|
+
async setCanCreate(value) {
|
|
7880
|
+
this.selfCanCreate = value;
|
|
7881
|
+
}
|
|
7603
7882
|
// ── Lifecycle ──────────────────────────────────────────────────────────────
|
|
7604
7883
|
disconnectedCallback() {
|
|
7605
7884
|
if (this.resizeObserver) {
|
|
@@ -7959,6 +8238,22 @@ const MrdTable = class {
|
|
|
7959
8238
|
dataClass: v.dataClass,
|
|
7960
8239
|
});
|
|
7961
8240
|
}
|
|
8241
|
+
/** Asks the host whether creating is allowed for the table's current binding (item, parent
|
|
8242
|
+
* and active view) — only in standalone use (`canCreate` prop undefined). A host that
|
|
8243
|
+
* controls `canCreate` directly already knows the answer, so the table never asks on its
|
|
8244
|
+
* own in that mode. Resets selfCanCreate to false first so the add button stays hidden for
|
|
8245
|
+
* the new binding until the host answers — it never inherits the previous binding's answer. */
|
|
8246
|
+
emitCapabilitiesCheck() {
|
|
8247
|
+
var _a, _b;
|
|
8248
|
+
if (this.canCreate !== undefined)
|
|
8249
|
+
return;
|
|
8250
|
+
this.selfCanCreate = false;
|
|
8251
|
+
const v = this.allViews[this.activeViewIdx];
|
|
8252
|
+
if (!(v === null || v === void 0 ? void 0 : v.dataClass))
|
|
8253
|
+
return;
|
|
8254
|
+
const isRelatedView = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === 'RELATED_VIEW';
|
|
8255
|
+
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 } : {})));
|
|
8256
|
+
}
|
|
7962
8257
|
/** Build query params for a page request from current sort, view filters, filterClass and active column filters.
|
|
7963
8258
|
*
|
|
7964
8259
|
* `q` and column filters are mutually exclusive on the backend — combining them breaks
|
|
@@ -7993,11 +8288,17 @@ const MrdTable = class {
|
|
|
7993
8288
|
var _a, _b, _c;
|
|
7994
8289
|
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 : []);
|
|
7995
8290
|
}
|
|
8291
|
+
/** `canCreate` when the host controls it directly, else the table's own self-asked answer. */
|
|
8292
|
+
get effectiveCanCreate() {
|
|
8293
|
+
return this.canCreate !== undefined ? this.canCreate : this.selfCanCreate;
|
|
8294
|
+
}
|
|
7996
8295
|
get tableActions() {
|
|
7997
8296
|
var _a, _b;
|
|
7998
8297
|
const raw = (_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.actions) !== null && _b !== void 0 ? _b : [];
|
|
7999
8298
|
return (raw !== null && raw !== void 0 ? raw : []).reduce((acc, a) => {
|
|
8000
|
-
|
|
8299
|
+
// Hidden (not just disabled) until creating is confirmed allowed for this binding —
|
|
8300
|
+
// see effectiveCanCreate() / emitCapabilitiesCheck() (TASK-0299).
|
|
8301
|
+
if (a === 'NEW' && this.effectiveCanCreate)
|
|
8001
8302
|
acc.push({ action: 'create', label: t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary', disabled: this.readOnly });
|
|
8002
8303
|
if (a === 'EXPORT')
|
|
8003
8304
|
acc.push({ action: 'export', label: t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
|
|
@@ -8405,6 +8706,7 @@ const MrdTable = class {
|
|
|
8405
8706
|
this.searchOpen = false;
|
|
8406
8707
|
this.searchQuery = '';
|
|
8407
8708
|
this.stashedFilters = null;
|
|
8709
|
+
this.emitCapabilitiesCheck();
|
|
8408
8710
|
this.init();
|
|
8409
8711
|
}
|
|
8410
8712
|
toggleViewPopover(e) {
|
|
@@ -8582,6 +8884,9 @@ const MrdTable = class {
|
|
|
8582
8884
|
}],
|
|
8583
8885
|
"item": [{
|
|
8584
8886
|
"itemChanged": 0
|
|
8887
|
+
}],
|
|
8888
|
+
"parentId": [{
|
|
8889
|
+
"parentIdChanged": 0
|
|
8585
8890
|
}]
|
|
8586
8891
|
}; }
|
|
8587
8892
|
};
|