@mmlogic/components 0.3.9 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mosterdcomponents.cjs.js +1 -1
  3. package/dist/cjs/{mrd-boolean-field_22.cjs.entry.js → mrd-boolean-field_23.cjs.entry.js} +591 -36
  4. package/dist/collection/collection-manifest.json +1 -0
  5. package/dist/collection/components/mrd-document-container/mrd-document-container.js +375 -0
  6. package/dist/collection/components/mrd-document-container/mrd-document-container.scss +79 -0
  7. package/dist/collection/components/mrd-document-list/mrd-document-list.js +562 -11
  8. package/dist/collection/components/mrd-document-list/mrd-document-list.scss +55 -0
  9. package/dist/collection/components/mrd-document-view/mrd-document-view.js +1 -1
  10. package/dist/collection/components/mrd-email-field/mrd-email-field.js +1 -1
  11. package/dist/collection/components/mrd-file-field/mrd-file-field.js +1 -1
  12. package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
  13. package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +151 -15
  14. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +0 -44
  15. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
  16. package/dist/collection/components/mrd-number-field/mrd-number-field.js +1 -1
  17. package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +2 -2
  18. package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
  19. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
  20. package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
  21. package/dist/collection/dev/app.js +47 -0
  22. package/dist/collection/utils/i18n.js +10 -0
  23. package/dist/components/i18n.js +1 -1
  24. package/dist/components/mrd-document-container.d.ts +11 -0
  25. package/dist/components/mrd-document-container.js +1 -0
  26. package/dist/components/mrd-document-container2.js +1 -0
  27. package/dist/components/mrd-document-list2.js +1 -1
  28. package/dist/components/mrd-document-view2.js +1 -1
  29. package/dist/components/mrd-email-field2.js +1 -1
  30. package/dist/components/mrd-file-field2.js +1 -1
  31. package/dist/components/mrd-image-field2.js +1 -1
  32. package/dist/components/mrd-layout-section.js +1 -1
  33. package/dist/components/mrd-longtext-field2.js +1 -1
  34. package/dist/components/mrd-number-field2.js +1 -1
  35. package/dist/components/mrd-secret-field2.js +1 -1
  36. package/dist/components/mrd-text-field2.js +1 -1
  37. package/dist/components/mrd-textarea-field2.js +1 -1
  38. package/dist/components/mrd-time-field2.js +1 -1
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/mosterdcomponents.js +1 -1
  41. package/dist/esm/{mrd-boolean-field_22.entry.js → mrd-boolean-field_23.entry.js} +591 -37
  42. package/dist/mosterdcomponents/cell-renderer-B-AJDBcj.js.map +1 -0
  43. package/dist/mosterdcomponents/client-layout-ChqRA3AF.js.map +1 -0
  44. package/dist/mosterdcomponents/format-BAfsQfy1.js.map +1 -0
  45. package/dist/mosterdcomponents/i18n-s1XrKcD2.js.map +1 -0
  46. package/dist/mosterdcomponents/index-DkY-NQj0.js.map +1 -0
  47. package/dist/mosterdcomponents/index-DwF_Sp__.js.map +1 -0
  48. package/dist/mosterdcomponents/index.esm.js.map +1 -0
  49. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  50. package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
  51. package/dist/mosterdcomponents/p-69452249.entry.js +1 -0
  52. package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
  53. package/dist/mosterdcomponents/validation-Br9k2Ztw.js.map +1 -0
  54. package/dist/types/components/mrd-document-container/mrd-document-container.d.ts +94 -0
  55. package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +102 -0
  56. package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +29 -5
  57. package/dist/types/components.d.ts +217 -0
  58. package/package.json +1 -1
  59. package/dist/mosterdcomponents/p-b547291b.entry.js +0 -1
@@ -98,6 +98,11 @@ const translations = {
98
98
  history_until: 'tot',
99
99
  history_badge_tooltip: 'Vorige waarden',
100
100
  hyperlink_name: 'Linktekst (optioneel)',
101
+ // mrd-document-list
102
+ new_folder: 'Nieuwe folder',
103
+ folder_name_placeholder: 'Foldernaam',
104
+ folder_no_slash: "Een foldernaam mag geen '/' bevatten",
105
+ folder_duplicate: 'Er bestaat al een folder met deze naam',
101
106
  },
102
107
  en: {
103
108
  required: 'This field is required',
@@ -164,6 +169,11 @@ const translations = {
164
169
  history_until: 'until',
165
170
  history_badge_tooltip: 'Previous values',
166
171
  hyperlink_name: 'Link text (optional)',
172
+ // mrd-document-list
173
+ new_folder: 'New folder',
174
+ folder_name_placeholder: 'Folder name',
175
+ folder_no_slash: "A folder name cannot contain '/'",
176
+ folder_duplicate: 'A folder with this name already exists',
167
177
  },
168
178
  ar: {
169
179
  required: 'هذا الحقل مطلوب',
@@ -852,7 +862,112 @@ const MrdDatetimeField = class {
852
862
  };
853
863
  MrdDatetimeField.style = mrdDatetimeFieldScss();
854
864
 
855
- const mrdDocumentListScss = () => `.sc-mrd-document-list-h{display:block}.mrd-document-list.sc-mrd-document-list{padding:var(--mrd-space-2) 0}.mrd-document-list__row.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:2.125rem;padding:0 var(--mrd-space-4);cursor:pointer;user-select:none;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-document-list__row.sc-mrd-document-list:hover{background:var(--mrd-color-neutral-50)}.mrd-document-list__row--dossier.sc-mrd-document-list .mrd-document-list__label.sc-mrd-document-list{font-weight:var(--mrd-font-weight-semibold)}.mrd-document-list__indent.sc-mrd-document-list{flex:none}.mrd-document-list__chev.sc-mrd-document-list{width:1rem;height:1rem;flex:none;display:grid;place-items:center;color:var(--mrd-color-neutral-400);transition:transform var(--mrd-transition-fast)}.mrd-document-list__chev.sc-mrd-document-list svg.sc-mrd-document-list{width:0.6875rem;height:0.6875rem}.mrd-document-list__chev--open.sc-mrd-document-list{transform:rotate(90deg)}.mrd-document-list__chev--leaf.sc-mrd-document-list{visibility:hidden}.mrd-document-list__icon.sc-mrd-document-list{width:1.0625rem;height:1.0625rem;flex:none}.mrd-document-list__icon--dossier.sc-mrd-document-list{color:var(--mrd-color-primary)}.mrd-document-list__icon--folder.sc-mrd-document-list{color:#d9a441}.mrd-document-list__icon--doc.sc-mrd-document-list{color:var(--mrd-color-neutral-400)}.mrd-document-list__label.sc-mrd-document-list{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-document-list__count.sc-mrd-document-list{flex:none;font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius-full);padding:0.0625rem 0.5rem}.mrd-document-list__date.sc-mrd-document-list{flex:none;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400);font-variant-numeric:tabular-nums}.mrd-document-list__loading.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:1.875rem;padding:0 var(--mrd-space-4);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400)}.mrd-document-list__spinner.sc-mrd-document-list{width:0.75rem;height:0.75rem;border:2px solid var(--mrd-color-neutral-300);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-document-list-spin 0.7s linear infinite}@keyframes mrd-document-list-spin{to{transform:rotate(360deg)}}.mrd-document-list__empty.sc-mrd-document-list{padding:var(--mrd-space-8) var(--mrd-space-4);text-align:center;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm)}`;
865
+ const mrdDocumentContainerScss = () => `.sc-mrd-document-container-h{display:block}.mrd-document-container__toolbar.sc-mrd-document-container{display:flex;align-items:center;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-color-neutral-100)}.mrd-document-container__action.sc-mrd-document-container{display:inline-flex;align-items:center;gap:var(--mrd-space-2);height:1.625rem;padding:0 var(--mrd-space-3);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-700);background:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);cursor:pointer;transition:background var(--mrd-transition-fast), border-color var(--mrd-transition-fast)}.mrd-document-container__action.sc-mrd-document-container svg.sc-mrd-document-container{width:1rem;height:1rem;color:#d9a441}.mrd-document-container__action.sc-mrd-document-container:hover:not(:disabled){background:var(--mrd-color-neutral-50);border-color:var(--mrd-color-neutral-300)}.mrd-document-container__action.sc-mrd-document-container:disabled{opacity:0.5;cursor:not-allowed}.mrd-document-container__seg.sc-mrd-document-container{display:inline-flex;gap:2px;padding:2px;background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius)}.mrd-document-container__seg-btn.sc-mrd-document-container{width:1.875rem;height:1.625rem;display:grid;place-items:center;border:none;background:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-500);cursor:pointer;transition:color var(--mrd-transition-fast), background var(--mrd-transition-fast)}.mrd-document-container__seg-btn.sc-mrd-document-container:hover{color:var(--mrd-color-neutral-800)}.mrd-document-container__seg-btn[aria-pressed='true'].sc-mrd-document-container{background:var(--mrd-color-white);color:var(--mrd-color-primary-dark);box-shadow:var(--mrd-shadow-sm)}.mrd-document-container__seg-btn.sc-mrd-document-container svg.sc-mrd-document-container{width:1rem;height:1rem}`;
866
+
867
+ const MrdDocumentContainer = class {
868
+ constructor(hostRef) {
869
+ registerInstance(this, hostRef);
870
+ this.mrdLoadPage = createEvent(this, "mrdLoadPage");
871
+ this.mrdLoadDistinct = createEvent(this, "mrdLoadDistinct");
872
+ this.mrdLoadAggregations = createEvent(this, "mrdLoadAggregations");
873
+ this.mrdNavigate = createEvent(this, "mrdNavigate");
874
+ this.mrdAction = createEvent(this, "mrdAction");
875
+ this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
876
+ this.mrdUpload = createEvent(this, "mrdUpload");
877
+ this.mrdCreateObject = createEvent(this, "mrdCreateObject");
878
+ /** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
879
+ this.item = null;
880
+ /** Parent record id — required for RELATED_VIEW path building. */
881
+ this.parentId = '';
882
+ /** Lookup key used for the embedded `data-doclist` / `data-view` attributes. */
883
+ this.viewKey = '';
884
+ this.locale = navigator.language;
885
+ /** Active body: folder tree or flat table. */
886
+ this.mode = 'tree';
887
+ /** Whether the folder tree currently has a valid target for "New folder". */
888
+ this.canCreate = false;
889
+ /** Whether the currently mounted table has been init()'d. Reset on every mode switch. */
890
+ this.tableInited = false;
891
+ this.createFolder = () => {
892
+ var _a, _b;
893
+ (_b = (_a = this.listEl) === null || _a === void 0 ? void 0 : _a.createFolder) === null || _b === void 0 ? void 0 : _b.call(_a);
894
+ };
895
+ }
896
+ /** The embedded table does not self-load: like every mrd-table it waits for the
897
+ * host to call init() (which emits mrdLoadPage, and — once page 0 lands —
898
+ * mrdLoadAggregations). The section only init()s tables mounted at load time, so
899
+ * when the user switches to list view we init the freshly mounted table here. */
900
+ componentDidRender() {
901
+ var _a;
902
+ if (this.mode === 'list' && this.tableEl && !this.tableInited) {
903
+ this.tableInited = true;
904
+ const table = this.tableEl;
905
+ Promise.resolve((_a = table.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(table)).then(() => { var _a; return (_a = table.init) === null || _a === void 0 ? void 0 : _a.call(table); });
906
+ }
907
+ }
908
+ setMode(mode) {
909
+ if (mode === this.mode)
910
+ return;
911
+ // The tree remounts on switch and re-emits mrdCanCreate; until then, disable.
912
+ this.canCreate = false;
913
+ // The table remounts on switch; re-init it once it is back in the DOM.
914
+ this.tableInited = false;
915
+ this.mode = mode;
916
+ }
917
+ // ── Toolbar ────────────────────────────────────────────────────────────────
918
+ renderToolbar() {
919
+ return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, 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))), 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" }))))));
920
+ }
921
+ // ── Bodies ───────────────────────────────────────────────────────────────
922
+ renderTree() {
923
+ return (h("mrd-document-list", { "data-doclist": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, locale: this.locale, onMrdLoadDistinct: (e) => {
924
+ e.stopPropagation();
925
+ this.mrdLoadDistinct.emit(e.detail);
926
+ }, onMrdLoadPage: (e) => {
927
+ e.stopPropagation();
928
+ this.mrdLoadPage.emit(e.detail);
929
+ }, onMrdNavigate: (e) => {
930
+ e.stopPropagation();
931
+ this.mrdNavigate.emit(e.detail);
932
+ }, onMrdCanCreate: (e) => {
933
+ e.stopPropagation();
934
+ this.canCreate = e.detail;
935
+ }, onMrdUpdateObject: (e) => {
936
+ e.stopPropagation();
937
+ this.mrdUpdateObject.emit(e.detail);
938
+ }, onMrdUpload: (e) => {
939
+ e.stopPropagation();
940
+ this.mrdUpload.emit(e.detail);
941
+ }, onMrdCreateObject: (e) => {
942
+ e.stopPropagation();
943
+ this.mrdCreateObject.emit(e.detail);
944
+ } }));
945
+ }
946
+ renderList() {
947
+ return (h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, onMrdLoadPage: (e) => {
948
+ e.stopPropagation();
949
+ this.mrdLoadPage.emit(e.detail);
950
+ }, onMrdLoadAggregations: (e) => {
951
+ e.stopPropagation();
952
+ this.mrdLoadAggregations.emit(e.detail);
953
+ }, onMrdRowClick: (e) => {
954
+ var _a, _b, _c;
955
+ e.stopPropagation();
956
+ const row = e.detail;
957
+ this.mrdNavigate.emit({ href: (_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href, label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '' });
958
+ }, onMrdAction: (e) => {
959
+ e.stopPropagation();
960
+ this.mrdAction.emit(e.detail);
961
+ } }));
962
+ }
963
+ render() {
964
+ return (h(Host, { key: 'a5393d484bdc202b57c6d32d9ce917e760aff95a' }, this.renderToolbar(), h("div", { key: '52f82de8f7734e13f34d323e3e831e6de5676f46', class: "mrd-document-container__body" }, this.mode === 'tree' ? this.renderTree() : this.renderList())));
965
+ }
966
+ get el() { return getElement(this); }
967
+ };
968
+ MrdDocumentContainer.style = mrdDocumentContainerScss();
969
+
970
+ const mrdDocumentListScss = () => `.sc-mrd-document-list-h{display:block}.mrd-document-list.sc-mrd-document-list{padding:var(--mrd-space-2) 0}.mrd-document-list__row.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:2.125rem;padding:0 var(--mrd-space-4);cursor:pointer;user-select:none;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-800)}.mrd-document-list__row.sc-mrd-document-list:hover{background:var(--mrd-color-neutral-50)}.mrd-document-list__row--selected.sc-mrd-document-list{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--selected.sc-mrd-document-list:hover{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--pending.sc-mrd-document-list .mrd-document-list__label.sc-mrd-document-list{font-style:italic;color:var(--mrd-color-neutral-500)}.mrd-document-list__row--doc.sc-mrd-document-list{cursor:grab}.mrd-document-list__row--doc.sc-mrd-document-list:active{cursor:grabbing}.mrd-document-list__row--drop.sc-mrd-document-list{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1));box-shadow:inset 0 0 0 1px var(--mrd-color-primary)}.mrd-document-list__row--drop.sc-mrd-document-list:hover{background:var(--mrd-color-primary-50, rgba(22, 163, 74, 0.1))}.mrd-document-list__row--edit.sc-mrd-document-list{cursor:default}.mrd-document-list__name-input.sc-mrd-document-list{flex:1;min-width:0;height:1.625rem;padding:0 var(--mrd-space-2);font-size:var(--mrd-font-size-sm);font-family:inherit;color:var(--mrd-color-neutral-800);border:1px solid var(--mrd-color-primary);border-radius:var(--mrd-border-radius);outline:none;box-shadow:var(--mrd-shadow-focus)}.mrd-document-list__error.sc-mrd-document-list{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-danger, #dc2626);padding-top:0.125rem;padding-bottom:0.25rem}.mrd-document-list__row--dossier.sc-mrd-document-list .mrd-document-list__label.sc-mrd-document-list{font-weight:var(--mrd-font-weight-semibold)}.mrd-document-list__indent.sc-mrd-document-list{flex:none}.mrd-document-list__chev.sc-mrd-document-list{width:1rem;height:1rem;flex:none;display:grid;place-items:center;color:var(--mrd-color-neutral-400);transition:transform var(--mrd-transition-fast)}.mrd-document-list__chev.sc-mrd-document-list svg.sc-mrd-document-list{width:0.6875rem;height:0.6875rem}.mrd-document-list__chev--open.sc-mrd-document-list{transform:rotate(90deg)}.mrd-document-list__chev--leaf.sc-mrd-document-list{visibility:hidden}.mrd-document-list__icon.sc-mrd-document-list{width:1.0625rem;height:1.0625rem;flex:none}.mrd-document-list__icon--dossier.sc-mrd-document-list{color:var(--mrd-color-primary)}.mrd-document-list__icon--folder.sc-mrd-document-list{color:#d9a441}.mrd-document-list__icon--doc.sc-mrd-document-list{color:var(--mrd-color-neutral-400)}.mrd-document-list__label.sc-mrd-document-list{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mrd-document-list__count.sc-mrd-document-list{flex:none;font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius-full);padding:0.0625rem 0.5rem}.mrd-document-list__date.sc-mrd-document-list{flex:none;font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400);font-variant-numeric:tabular-nums}.mrd-document-list__loading.sc-mrd-document-list{display:flex;align-items:center;gap:var(--mrd-space-2);height:1.875rem;padding:0 var(--mrd-space-4);font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-400)}.mrd-document-list__spinner.sc-mrd-document-list{width:0.75rem;height:0.75rem;border:2px solid var(--mrd-color-neutral-300);border-top-color:var(--mrd-color-primary);border-radius:50%;animation:mrd-document-list-spin 0.7s linear infinite}@keyframes mrd-document-list-spin{to{transform:rotate(360deg)}}.mrd-document-list__empty.sc-mrd-document-list{padding:var(--mrd-space-8) var(--mrd-space-4);text-align:center;color:var(--mrd-color-neutral-400);font-size:var(--mrd-font-size-sm)}`;
856
971
 
857
972
  const MrdDocumentList = class {
858
973
  constructor(hostRef) {
@@ -860,6 +975,10 @@ const MrdDocumentList = class {
860
975
  this.mrdLoadDistinct = createEvent(this, "mrdLoadDistinct");
861
976
  this.mrdLoadPage = createEvent(this, "mrdLoadPage");
862
977
  this.mrdNavigate = createEvent(this, "mrdNavigate");
978
+ this.mrdCanCreate = createEvent(this, "mrdCanCreate");
979
+ this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
980
+ this.mrdUpload = createEvent(this, "mrdUpload");
981
+ this.mrdCreateObject = createEvent(this, "mrdCreateObject");
863
982
  /** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
864
983
  this.item = null;
865
984
  /** Parent record id — required for RELATED_VIEW path building. */
@@ -869,11 +988,168 @@ const MrdDocumentList = class {
869
988
  this.rootLoading = true;
870
989
  /** True when the single-container level is collapsed away (dossier context). */
871
990
  this.singleContainer = false;
991
+ /** Currently selected node id — the target for "New folder" and (later) drops. */
992
+ this.selectedId = null;
993
+ /** Node id currently highlighted as a drag-drop target (null = none). */
994
+ this.dropTargetId = null;
995
+ /** Node id showing an "uploading…" indicator while a dropped file is processed. */
996
+ this.uploadingNodeId = null;
872
997
  this.nodeIndex = new Map();
998
+ // ── New-folder editing state ───────────────────────────────────────────────
999
+ /** The pending node whose inline name input is open (null = not creating). */
1000
+ this.pendingNode = null;
1001
+ /** The node the pending folder is being created under. */
1002
+ this.pendingParent = null;
1003
+ /** The container the pending folder belongs to. */
1004
+ this.pendingContainer = null;
1005
+ /** Current text in the inline name input. */
1006
+ this.pendingName = '';
1007
+ /** Ref to the inline input, so we can focus it after it mounts. */
1008
+ this.pendingInputEl = null;
1009
+ /** Set when a fresh input needs focus on the next render. */
1010
+ this.pendingNeedsFocus = false;
1011
+ /** Monotonic counter for unique temporary pending-node ids. */
1012
+ this.newFolderSeq = 0;
1013
+ /** Last emitted canCreateFolder value, to only emit mrdCanCreate on change. */
1014
+ this.lastCanCreate = false;
1015
+ // ── Drag & drop (move a document into another folder) ──────────────────────
1016
+ /** The document row currently being dragged. */
1017
+ this.dragDoc = null;
1018
+ /** Id of the node the dragged document currently lives in. */
1019
+ this.dragFromId = null;
1020
+ /** External file dropped onto a node, awaiting its upload to complete. */
1021
+ this.pendingUpload = null;
1022
+ /** The optimistic document row awaiting its self href from the create POST. */
1023
+ this.lastOptimisticDoc = null;
1024
+ this.startCreateFolder = () => {
1025
+ const resolved = this.resolveTarget();
1026
+ if (!resolved || this.pendingNode)
1027
+ return;
1028
+ const { target, container } = resolved;
1029
+ const tempId = `${container.id}/__new__${this.newFolderSeq++}`;
1030
+ const node = this.makeFolderNode(tempId, '', container.id);
1031
+ node.pending = true;
1032
+ node.editing = true;
1033
+ target.children = [...target.children, node];
1034
+ target.open = true;
1035
+ this.nodeIndex.set(node.id, node);
1036
+ this.pendingNode = node;
1037
+ this.pendingParent = target;
1038
+ this.pendingContainer = container;
1039
+ this.pendingName = '';
1040
+ this.pendingNeedsFocus = true;
1041
+ this.bump();
1042
+ };
1043
+ this.onPendingInput = (e) => {
1044
+ var _a;
1045
+ this.pendingName = e.target.value;
1046
+ if ((_a = this.pendingNode) === null || _a === void 0 ? void 0 : _a.error) {
1047
+ this.pendingNode.error = undefined;
1048
+ this.bump();
1049
+ }
1050
+ };
1051
+ this.onPendingKeyDown = (e) => {
1052
+ if (e.key === 'Enter') {
1053
+ e.preventDefault();
1054
+ this.commitFolder();
1055
+ }
1056
+ else if (e.key === 'Escape') {
1057
+ e.preventDefault();
1058
+ this.cancelFolder();
1059
+ }
1060
+ };
1061
+ // ── Drag & drop: move a document into another folder / container ────────────
1062
+ this.onDocDragStart = (e, doc, node) => {
1063
+ var _a, _b, _c;
1064
+ this.dragDoc = doc;
1065
+ this.dragFromId = node.id;
1066
+ if (e.dataTransfer) {
1067
+ e.dataTransfer.effectAllowed = 'move';
1068
+ // A payload is required for a drag to start in some browsers.
1069
+ e.dataTransfer.setData('text/plain', (_c = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : '');
1070
+ }
1071
+ };
1072
+ this.onDocDragEnd = () => {
1073
+ this.dragDoc = null;
1074
+ this.dragFromId = null;
1075
+ if (this.dropTargetId !== null)
1076
+ this.dropTargetId = null;
1077
+ };
1078
+ /** A folder/container node (or a document inside it) accepts an internal move
1079
+ * or an external file drop. Always claims the event so it never bubbles to the
1080
+ * root drop-zone; a different node is highlighted (its own folder = no-op). */
1081
+ this.onNodeDragOver = (e, node) => {
1082
+ const file = this.isFileDrag(e);
1083
+ if (!this.dragDoc && !file)
1084
+ return;
1085
+ e.preventDefault();
1086
+ e.stopPropagation();
1087
+ if (e.dataTransfer)
1088
+ e.dataTransfer.dropEffect = file ? 'copy' : 'move';
1089
+ const target = !file && node.id === this.dragFromId ? null : node.id;
1090
+ if (this.dropTargetId !== target)
1091
+ this.dropTargetId = target;
1092
+ };
1093
+ this.onNodeDragLeave = (node) => {
1094
+ if (this.dropTargetId === node.id)
1095
+ this.dropTargetId = null;
1096
+ };
1097
+ this.onNodeDrop = (e, node, container) => {
1098
+ if (this.isFileDrag(e)) {
1099
+ e.preventDefault();
1100
+ e.stopPropagation();
1101
+ this.startFileUpload(e, node, container);
1102
+ return;
1103
+ }
1104
+ if (!this.dragDoc)
1105
+ return;
1106
+ e.preventDefault();
1107
+ e.stopPropagation();
1108
+ this.moveDocument(node, container);
1109
+ this.onDocDragEnd();
1110
+ };
1111
+ /** Root-zone drop (dossier context): target the single container's root. */
1112
+ this.onRootDragOver = (e) => {
1113
+ if (!this.singleContainer)
1114
+ return;
1115
+ const file = this.isFileDrag(e);
1116
+ if (!this.dragDoc && !file)
1117
+ return;
1118
+ e.preventDefault();
1119
+ if (e.dataTransfer)
1120
+ e.dataTransfer.dropEffect = file ? 'copy' : 'move';
1121
+ };
1122
+ this.onRootDrop = (e) => {
1123
+ if (!this.singleContainer)
1124
+ return;
1125
+ const only = this.containers[0];
1126
+ if (this.isFileDrag(e)) {
1127
+ e.preventDefault();
1128
+ this.startFileUpload(e, only, only);
1129
+ return;
1130
+ }
1131
+ if (!this.dragDoc)
1132
+ return;
1133
+ e.preventDefault();
1134
+ this.moveDocument(only, only);
1135
+ this.onDocDragEnd();
1136
+ };
873
1137
  }
874
1138
  componentDidLoad() {
875
1139
  this.emitContainerDistinct();
876
1140
  }
1141
+ componentDidRender() {
1142
+ if (this.pendingNeedsFocus && this.pendingInputEl) {
1143
+ this.pendingInputEl.focus();
1144
+ this.pendingInputEl.select();
1145
+ this.pendingNeedsFocus = false;
1146
+ }
1147
+ const can = this.canCreateFolder;
1148
+ if (can !== this.lastCanCreate) {
1149
+ this.lastCanCreate = can;
1150
+ this.mrdCanCreate.emit(can);
1151
+ }
1152
+ }
877
1153
  // ── Slot field names ─────────────────────────────────────────────────────
878
1154
  get containerField() {
879
1155
  var _a, _b, _c;
@@ -887,6 +1163,10 @@ const MrdDocumentList = class {
887
1163
  var _a, _b, _c;
888
1164
  return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : 'name';
889
1165
  }
1166
+ get fileField() {
1167
+ var _a, _b, _c;
1168
+ return (_c = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.file) !== null && _c !== void 0 ? _c : 'file';
1169
+ }
890
1170
  get dateField() {
891
1171
  var _a, _b;
892
1172
  return (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.date;
@@ -1039,7 +1319,7 @@ const MrdDocumentList = class {
1039
1319
  acc.push(seg);
1040
1320
  let child = node.children.find(c => c.label === seg);
1041
1321
  if (!child) {
1042
- child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg);
1322
+ child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg, container.id);
1043
1323
  node.children.push(child);
1044
1324
  this.nodeIndex.set(child.id, child);
1045
1325
  }
@@ -1075,9 +1355,9 @@ const MrdDocumentList = class {
1075
1355
  open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
1076
1356
  };
1077
1357
  }
1078
- makeFolderNode(id, label) {
1358
+ makeFolderNode(id, label, containerId) {
1079
1359
  return {
1080
- id, kind: 'folder', label,
1360
+ id, kind: 'folder', label, containerId,
1081
1361
  hasDocs: false, docCount: 0, totalCount: 0, children: [],
1082
1362
  open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
1083
1363
  };
@@ -1095,6 +1375,7 @@ const MrdDocumentList = class {
1095
1375
  }
1096
1376
  // ── Interaction ──────────────────────────────────────────────────────────
1097
1377
  toggleContainer(node) {
1378
+ this.selectedId = node.id;
1098
1379
  node.open = !node.open;
1099
1380
  if (node.open && !node.foldersLoaded && !node.loading) {
1100
1381
  this.emitFolderDistinct(node);
@@ -1102,12 +1383,235 @@ const MrdDocumentList = class {
1102
1383
  this.bump();
1103
1384
  }
1104
1385
  toggleFolder(container, node) {
1386
+ this.selectedId = node.id;
1105
1387
  node.open = !node.open;
1106
1388
  if (node.open && node.hasDocs && !node.docsLoaded && !node.loading) {
1107
1389
  this.emitDocuments(container, node);
1108
1390
  }
1109
1391
  this.bump();
1110
1392
  }
1393
+ // ── New folder (client-side pending, materialises on document drop) ─────────
1394
+ /** Resolve the node a new folder should be created under, and its container.
1395
+ * Uses the current selection; falls back to the single container (dossier). */
1396
+ resolveTarget() {
1397
+ if (this.selectedId) {
1398
+ const n = this.nodeIndex.get(this.selectedId);
1399
+ if (n && n.kind === 'container')
1400
+ return { target: n, container: n };
1401
+ if (n && n.kind === 'folder') {
1402
+ const container = n.containerId ? this.nodeIndex.get(n.containerId) : undefined;
1403
+ if (container)
1404
+ return { target: n, container };
1405
+ }
1406
+ }
1407
+ if (this.singleContainer && this.containers[0]) {
1408
+ const only = this.containers[0];
1409
+ return { target: only, container: only };
1410
+ }
1411
+ return null;
1412
+ }
1413
+ get canCreateFolder() {
1414
+ return !this.pendingNode && this.resolveTarget() !== null;
1415
+ }
1416
+ /** Start creating a folder under the current target. Called by the host toolbar
1417
+ * (mrd-document-container). No-op when there is no valid target. */
1418
+ async createFolder() {
1419
+ this.startCreateFolder();
1420
+ }
1421
+ /** Folder path segments of a node relative to its container (derived from its id). */
1422
+ segmentsOf(node, container) {
1423
+ if (node.kind === 'container')
1424
+ return [];
1425
+ const prefix = container.id + '/';
1426
+ const rest = node.id.startsWith(prefix) ? node.id.slice(prefix.length) : '';
1427
+ return rest ? rest.split('/') : [];
1428
+ }
1429
+ commitFolder() {
1430
+ const node = this.pendingNode;
1431
+ const parent = this.pendingParent;
1432
+ const container = this.pendingContainer;
1433
+ if (!node || !parent || !container)
1434
+ return;
1435
+ const name = this.pendingName.trim();
1436
+ if (!name) {
1437
+ this.cancelFolder();
1438
+ return;
1439
+ }
1440
+ if (name.includes('/')) {
1441
+ node.error = t('folder_no_slash', this.locale);
1442
+ this.bump();
1443
+ return;
1444
+ }
1445
+ const dup = parent.children.some(c => c !== node && c.label.toLowerCase() === name.toLowerCase());
1446
+ if (dup) {
1447
+ node.error = t('folder_duplicate', this.locale);
1448
+ this.bump();
1449
+ return;
1450
+ }
1451
+ // Finalise: swap the temp id for the real path-derived id so a later distinct
1452
+ // value with the same folder string merges onto this node.
1453
+ const segs = [...this.segmentsOf(parent, container), name];
1454
+ this.nodeIndex.delete(node.id);
1455
+ node.id = container.id + '/' + segs.join('/');
1456
+ node.fullPath = '/' + segs.join('/');
1457
+ node.label = name;
1458
+ node.editing = false;
1459
+ node.error = undefined;
1460
+ node.open = true;
1461
+ this.nodeIndex.set(node.id, node);
1462
+ this.selectedId = node.id;
1463
+ this.clearPending();
1464
+ this.bump();
1465
+ }
1466
+ cancelFolder() {
1467
+ const node = this.pendingNode;
1468
+ const parent = this.pendingParent;
1469
+ if (node && parent) {
1470
+ parent.children = parent.children.filter(c => c !== node);
1471
+ this.nodeIndex.delete(node.id);
1472
+ }
1473
+ this.clearPending();
1474
+ this.bump();
1475
+ }
1476
+ clearPending() {
1477
+ this.pendingNode = null;
1478
+ this.pendingParent = null;
1479
+ this.pendingContainer = null;
1480
+ this.pendingName = '';
1481
+ this.pendingInputEl = null;
1482
+ this.pendingNeedsFocus = false;
1483
+ }
1484
+ /** True when the drag carries external files (an OS file drop, not an internal move). */
1485
+ isFileDrag(e) {
1486
+ return !this.dragDoc && !!e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files');
1487
+ }
1488
+ // ── External file drop → upload → create document ──────────────────────────
1489
+ /** Begin an upload: emit mrdUpload; the host uploads and calls setFileReference. */
1490
+ startFileUpload(e, node, container) {
1491
+ var _a, _b;
1492
+ const file = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]; // single file per drop
1493
+ this.dropTargetId = null;
1494
+ if (!file)
1495
+ return;
1496
+ this.pendingUpload = { file, node, container };
1497
+ node.open = true;
1498
+ this.uploadingNodeId = node.id;
1499
+ this.bump();
1500
+ this.mrdUpload.emit({ file });
1501
+ }
1502
+ /** Strip a single trailing extension for the document title. */
1503
+ stripExtension(name) {
1504
+ return name.replace(/\.[^./\\]+$/, '');
1505
+ }
1506
+ /** Host callback with the uploaded file reference. Builds the create payload
1507
+ * from the archetype slots and requests the new document. */
1508
+ async setFileReference(uri) {
1509
+ const up = this.pendingUpload;
1510
+ if (!up)
1511
+ return;
1512
+ const { file, node, container } = up;
1513
+ const folder = this.folderStringOf(node, container);
1514
+ const values = {
1515
+ [this.fileField]: uri,
1516
+ [this.titleField]: this.stripExtension(file.name),
1517
+ [this.folderField]: folder,
1518
+ [this.containerField]: container.href,
1519
+ };
1520
+ this.mrdCreateObject.emit({ path: this.buildDataPath(), values });
1521
+ // Optimistically show the new document (no href until a reload).
1522
+ const optimistic = { [this.titleField]: this.stripExtension(file.name), _optimistic: true };
1523
+ const wasUnloadedEmpty = !node.docsLoaded && node.docCount === 0;
1524
+ node.hasDocs = true;
1525
+ node.pending = false;
1526
+ node.docCount += 1;
1527
+ if (wasUnloadedEmpty) {
1528
+ node.docsLoaded = true;
1529
+ node.docs = [optimistic];
1530
+ }
1531
+ else if (node.docsLoaded)
1532
+ node.docs = [...node.docs, optimistic];
1533
+ this.recomputeContainerTotals(container, 1);
1534
+ this.lastOptimisticDoc = optimistic;
1535
+ this.pendingUpload = null;
1536
+ this.uploadingNodeId = null;
1537
+ this.bump();
1538
+ }
1539
+ /** Host callback with the created document's self href, so the optimistic row
1540
+ * becomes navigable without waiting for a reload. */
1541
+ async setCreatedHref(href) {
1542
+ var _a;
1543
+ const doc = this.lastOptimisticDoc;
1544
+ if (!doc || !href)
1545
+ return;
1546
+ doc._links = Object.assign(Object.assign({}, ((_a = doc._links) !== null && _a !== void 0 ? _a : {})), { self: { href } });
1547
+ doc._optimistic = false;
1548
+ this.lastOptimisticDoc = null;
1549
+ this.bump();
1550
+ }
1551
+ /** Folder string a node represents: the raw distinct value when it holds
1552
+ * documents, else derived from its path segments; null for a container root. */
1553
+ folderStringOf(node, container) {
1554
+ if (node.kind === 'container')
1555
+ return null;
1556
+ if (node.fullPath != null && node.fullPath !== '')
1557
+ return node.fullPath;
1558
+ const segs = this.segmentsOf(node, container);
1559
+ return segs.length ? '/' + segs.join('/') : null;
1560
+ }
1561
+ moveDocument(toNode, toContainer) {
1562
+ var _a, _b;
1563
+ const doc = this.dragDoc;
1564
+ const fromNode = this.dragFromId ? this.nodeIndex.get(this.dragFromId) : undefined;
1565
+ if (!doc || !fromNode)
1566
+ return;
1567
+ const fromContainer = fromNode.kind === 'container'
1568
+ ? fromNode
1569
+ : (fromNode.containerId ? this.nodeIndex.get(fromNode.containerId) : undefined);
1570
+ if (!fromContainer)
1571
+ return;
1572
+ const targetFolder = this.folderStringOf(toNode, toContainer);
1573
+ const sourceFolder = this.folderStringOf(fromNode, fromContainer);
1574
+ const sameContainer = toContainer === fromContainer;
1575
+ // No-op: dropped back onto its own folder.
1576
+ if (toNode === fromNode || (sameContainer && targetFolder === sourceFolder))
1577
+ return;
1578
+ // ── Optimistic tree update (fire-and-forget; no refetch) ──
1579
+ fromNode.docs = fromNode.docs.filter(d => d !== doc);
1580
+ fromNode.docCount = Math.max(0, fromNode.docCount - 1);
1581
+ // A now-empty folder should stop showing an expand chevron (it disappears on
1582
+ // the next reload anyway, since it is derived from document folder strings).
1583
+ if (fromNode.docsLoaded)
1584
+ fromNode.hasDocs = fromNode.docs.length > 0;
1585
+ toNode.hasDocs = true;
1586
+ toNode.pending = false; // a pending folder is now materialised
1587
+ toNode.docCount += 1;
1588
+ if (toNode.kind === 'folder')
1589
+ toNode.fullPath = targetFolder !== null && targetFolder !== void 0 ? targetFolder : '';
1590
+ if (toNode.docsLoaded)
1591
+ toNode.docs = [...toNode.docs, doc];
1592
+ this.recomputeContainerTotals(fromContainer, -1);
1593
+ if (!sameContainer)
1594
+ this.recomputeContainerTotals(toContainer, 1);
1595
+ // ── Emit the generic update; host PATCHes the document ──
1596
+ const href = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href;
1597
+ if (href) {
1598
+ const values = { [this.folderField]: targetFolder };
1599
+ if (!sameContainer)
1600
+ values[this.containerField] = toContainer.href;
1601
+ this.mrdUpdateObject.emit({ href, values });
1602
+ }
1603
+ this.bump();
1604
+ }
1605
+ /** Recompute a container's subtree totals from docCounts when its folders are
1606
+ * loaded; otherwise just nudge the aggregate badge by the delta. */
1607
+ recomputeContainerTotals(container, delta) {
1608
+ if (container.foldersLoaded) {
1609
+ this.computeTotals(container);
1610
+ }
1611
+ else {
1612
+ container.totalCount = Math.max(0, container.totalCount + delta);
1613
+ }
1614
+ }
1111
1615
  openDoc(doc) {
1112
1616
  var _a, _b, _c, _d;
1113
1617
  const href = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href;
@@ -1130,12 +1634,12 @@ const MrdDocumentList = class {
1130
1634
  indent(depth) {
1131
1635
  return h("span", { class: "mrd-document-list__indent", style: { width: `${depth * 18}px` } });
1132
1636
  }
1133
- renderDocRow(doc, depth) {
1637
+ renderDocRow(doc, node, container, depth) {
1134
1638
  var _a, _b, _c, _d, _e;
1135
1639
  const label = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc[this.titleField]) !== null && _a !== void 0 ? _a : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _b !== void 0 ? _b : '';
1136
1640
  const dateRaw = this.dateField ? doc === null || doc === void 0 ? void 0 : doc[this.dateField] : undefined;
1137
1641
  const date = dateRaw ? formatDate(dateRaw, this.locale) : '';
1138
- return (h("div", { class: "mrd-document-list__row mrd-document-list__row--doc", key: (_e = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : label, onClick: () => this.openDoc(doc) }, this.indent(depth), this.renderChevron(false, true), this.renderDocIcon(), h("span", { class: "mrd-document-list__label" }, label), date && h("span", { class: "mrd-document-list__date" }, date)));
1642
+ return (h("div", { class: "mrd-document-list__row mrd-document-list__row--doc", key: (_e = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : label, draggable: true, onClick: () => this.openDoc(doc), onDragStart: (e) => this.onDocDragStart(e, doc, node), onDragEnd: this.onDocDragEnd, onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, container) }, this.indent(depth), this.renderChevron(false, true), this.renderDocIcon(), h("span", { class: "mrd-document-list__label" }, label), date && h("span", { class: "mrd-document-list__date" }, date)));
1139
1643
  }
1140
1644
  renderLoadingRow(depth) {
1141
1645
  return (h("div", { class: "mrd-document-list__loading", key: "loading" }, this.indent(depth), h("span", { class: "mrd-document-list__spinner" }), t('loading', this.locale)));
@@ -1146,7 +1650,7 @@ const MrdDocumentList = class {
1146
1650
  if (node.hasDocs) {
1147
1651
  if (node.docsLoaded) {
1148
1652
  for (const doc of node.docs)
1149
- out.push(this.renderDocRow(doc, depth));
1653
+ out.push(this.renderDocRow(doc, node, container, depth));
1150
1654
  }
1151
1655
  else if (node.loading) {
1152
1656
  out.push(this.renderLoadingRow(depth));
@@ -1156,14 +1660,34 @@ const MrdDocumentList = class {
1156
1660
  for (const child of node.children) {
1157
1661
  out.push(this.renderFolderNode(container, child, depth));
1158
1662
  }
1663
+ // An uploading file dropped onto this node.
1664
+ if (node.id === this.uploadingNodeId)
1665
+ out.push(this.renderUploadingRow(depth));
1159
1666
  return out;
1160
1667
  }
1668
+ renderUploadingRow(depth) {
1669
+ return (h("div", { class: "mrd-document-list__loading", key: "uploading" }, this.indent(depth), h("span", { class: "mrd-document-list__spinner" }), t('upload_file', this.locale)));
1670
+ }
1671
+ renderFolderEditRow(node, depth) {
1672
+ return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row mrd-document-list__row--edit" }, this.indent(depth), this.renderChevron(false, true), this.renderFolderIcon(), h("input", { class: "mrd-document-list__name-input", type: "text", placeholder: t('folder_name_placeholder', this.locale), ref: el => (this.pendingInputEl = el), onInput: this.onPendingInput, onKeyDown: this.onPendingKeyDown, onBlur: () => this.cancelFolder() })), node.error && (h("div", { class: "mrd-document-list__error", style: { paddingLeft: `${depth * 18 + 52}px` } }, node.error))));
1673
+ }
1161
1674
  renderFolderNode(container, node, depth) {
1675
+ if (node.editing)
1676
+ return this.renderFolderEditRow(node, depth);
1162
1677
  const leaf = node.children.length === 0 && !node.hasDocs;
1163
- return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row", onClick: () => this.toggleFolder(container, node) }, this.indent(depth), this.renderChevron(node.open, leaf), this.renderFolderIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && h("div", { class: "mrd-document-list__kids" }, this.renderChildren(container, node, depth + 1))));
1678
+ const selected = node.id === this.selectedId;
1679
+ const cls = 'mrd-document-list__row'
1680
+ + (selected ? ' mrd-document-list__row--selected' : '')
1681
+ + (node.pending ? ' mrd-document-list__row--pending' : '')
1682
+ + (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
1683
+ return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: cls, onClick: () => this.toggleFolder(container, node), onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, container) }, this.indent(depth), this.renderChevron(node.open, leaf), this.renderFolderIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && h("div", { class: "mrd-document-list__kids" }, this.renderChildren(container, node, depth + 1))));
1164
1684
  }
1165
1685
  renderContainerNode(node, depth) {
1166
- return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row mrd-document-list__row--dossier", onClick: () => this.toggleContainer(node) }, this.indent(depth), this.renderChevron(node.open, false), this.renderDossierIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && (h("div", { class: "mrd-document-list__kids" }, node.loading && !node.foldersLoaded
1686
+ const selected = node.id === this.selectedId;
1687
+ const cls = 'mrd-document-list__row mrd-document-list__row--dossier'
1688
+ + (selected ? ' mrd-document-list__row--selected' : '')
1689
+ + (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
1690
+ return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: cls, onClick: () => this.toggleContainer(node), onDragOver: (e) => this.onNodeDragOver(e, node), onDragLeave: () => this.onNodeDragLeave(node), onDrop: (e) => this.onNodeDrop(e, node, node) }, this.indent(depth), this.renderChevron(node.open, false), this.renderDossierIcon(), h("span", { class: "mrd-document-list__label" }, node.label), h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && (h("div", { class: "mrd-document-list__kids" }, node.loading && !node.foldersLoaded
1167
1691
  ? this.renderLoadingRow(depth + 1)
1168
1692
  : this.renderChildren(node, node, depth + 1)))));
1169
1693
  }
@@ -1173,7 +1697,7 @@ const MrdDocumentList = class {
1173
1697
  body = this.renderLoadingRow(0);
1174
1698
  }
1175
1699
  else if (this.containers.length === 0) {
1176
- body = h("div", { key: '0c4190bb86543e2d37cc1584b3495eb6eab5664c', class: "mrd-document-list__empty" }, t('no_results', this.locale));
1700
+ body = h("div", { key: 'b8c3297cd7cff5bf79ce694d2ee1a64c570df5ce', class: "mrd-document-list__empty" }, t('no_results', this.locale));
1177
1701
  }
1178
1702
  else if (this.singleContainer) {
1179
1703
  // Dossier context: render the single container's folder tree at the root.
@@ -1185,7 +1709,7 @@ const MrdDocumentList = class {
1185
1709
  else {
1186
1710
  body = this.containers.map(c => this.renderContainerNode(c, 0));
1187
1711
  }
1188
- return (h(Host, { key: '4e38d9ef5a1df137a41516a47dc5debbea6b2f35' }, h("div", { key: '6d2f162624e5bbc8650a2978a3b045c21fe13ea3', class: "mrd-document-list" }, body)));
1712
+ return (h(Host, { key: 'ff3b024a79ba2270aa28861923bc6406f98061aa' }, h("div", { key: '9db121e5336a4e3c82443257f6424db5ab4f0baf', class: "mrd-document-list", onDragOver: this.onRootDragOver, onDrop: this.onRootDrop }, body)));
1189
1713
  }
1190
1714
  get el() { return getElement(this); }
1191
1715
  };
@@ -1243,7 +1767,7 @@ const MrdDocumentView = class {
1243
1767
  const date = dateRaw != null && dateRaw !== '' ? formatDate(dateRaw, this.locale) : null;
1244
1768
  const summaryRaw = this.slotValue('summary');
1245
1769
  const summary = summaryRaw != null && summaryRaw !== '' ? String(summaryRaw) : null;
1246
- return (h(Host, { key: 'b6c2dbc45d5cfe551ac16b43b1a152a0d793b794' }, h("div", { key: 'df70848b4aa54ea414ea5d577a600779ee002b13', class: "mrd-document-view" }, this.renderContainer(), title && h("h1", { key: '46ff550fccd6de02972c6ee77b3cd5e7e394481a', class: "mrd-document-view__title" }, title), date && h("p", { key: '501c75cfc78722bd486d4a1db366675a1c519264', class: "mrd-document-view__date" }, date), this.renderFile(), summary && (h("div", { key: 'ee4475d06e5ca81a760e0c9e1e4b5f32ed894d89', class: "mrd-document-view__summary" }, h("div", { key: '9d196abdcc56b84b2b07203d7e5167be196a342a', class: "mrd-document-view__summary-body", innerHTML: summary }))))));
1770
+ return (h(Host, { key: '0a2071925ecdb21738376d66fa4babf4590e694c' }, h("div", { key: 'a2d29c0b6e211cab142adc780466bc885a602e96', class: "mrd-document-view" }, this.renderContainer(), title && h("h1", { key: '7f5ac202c21bc8a70f0dd15e2e1fa06e651b5bce', class: "mrd-document-view__title" }, title), date && h("p", { key: 'b1dce94d5fd8bfd5e078644f631a38f91b87e7ff', class: "mrd-document-view__date" }, date), this.renderFile(), summary && (h("div", { key: '588b9ca40a49ae9ea303852620bde75333b440ab', class: "mrd-document-view__summary" }, h("div", { key: 'd3b8adb85ac346b72451e789c10aedd539c966de', class: "mrd-document-view__summary-body", innerHTML: summary }))))));
1247
1771
  }
1248
1772
  };
1249
1773
  MrdDocumentView.style = mrdDocumentViewScss();
@@ -1283,7 +1807,7 @@ const MrdEmailField = class {
1283
1807
  }
1284
1808
  render() {
1285
1809
  const hasError = !!this.error;
1286
- return (h(Host, { key: 'bf888feadb6585a845f6d610165e192e342be5d2' }, h("div", { key: 'ab43101242a92df1643d218c0d35bb7b80452fef', class: "mrd-email-field" }, this.label && (h("label", { key: '854c9bd733f5803616ab8b70f0316a7a8a82ffd4', class: `mrd-email-field__label${this.required ? ' mrd-email-field__label--required' : ''}` }, this.label)), h("input", { key: '39ed16119a2329fdc67db578dcc7bafc35f4acf0', class: `mrd-email-field__input${hasError ? ' mrd-email-field__input--error' : ''}`, type: "email", name: this.name, value: this.value, placeholder: this.placeholder || 'name@example.com', required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: 'c5881e21a2314e5d339464b16982add69be9f68a', class: "mrd-email-field__error" }, this.error))));
1810
+ return (h(Host, { key: '0d442ab2a711c26c83fcdbf0fd8cd006d8dd8649' }, h("div", { key: 'ceb2a80679514c4c5b888fe096c90ed6cc973f64', class: "mrd-email-field" }, this.label && (h("label", { key: '663f95eff1002ee56cfc3104514bf31b47e26750', class: `mrd-email-field__label${this.required ? ' mrd-email-field__label--required' : ''}` }, this.label)), h("input", { key: '42dbdec25a47b37cfd68d00d0b8a481f96fe8241', class: `mrd-email-field__input${hasError ? ' mrd-email-field__input--error' : ''}`, type: "email", name: this.name, value: this.value, placeholder: this.placeholder || 'name@example.com', required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: '626ee856ceaa7051fb9dd1de8b7cbd708e83f617', class: "mrd-email-field__error" }, this.error))));
1287
1811
  }
1288
1812
  };
1289
1813
  MrdEmailField.style = mrdEmailFieldScss();
@@ -1566,7 +2090,7 @@ const MrdFileField = class {
1566
2090
  hasError ? 'mrd-file-field__zone--error' : '',
1567
2091
  this.disabled || this.uploading ? 'mrd-file-field__zone--disabled' : '',
1568
2092
  ].filter(Boolean).join(' ');
1569
- return (h(Host, { key: '424a55ff5c141a51ed2e253a126e0046808cf1b1' }, h("div", { key: '49407e31c019a27bbaa3ccbc81cd4597d992d03a', class: "mrd-file-field" }, this.label && (h("label", { key: '0477b203f2b8df03cf9d11153bc547e9490800f7', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), h("div", { key: 'aff3e5f258cfa8320150048af0b0087081cbbc13', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: 'ee4366f0c4b8871524288ca47c98b4749def0b81', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !hasFile, onChange: this.handleInputChange }), hasFile ? (h("div", { class: "mrd-file-field__selected" }, this.uploading ? (h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))), h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (h("div", { class: "mrd-file-field__prompt" }, h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "16 16 12 12 8 16" }), h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'b67b7770e194843a1b75caaff807ea14d62eba6a', class: "mrd-file-field__error" }, this.error))));
2093
+ return (h(Host, { key: '095bb39f3cb1680cf5e7e51bdfd06d8eb087f237' }, h("div", { key: '7e5b5fe6e63b6530221083c8bcb82bcac59a5fe7', class: "mrd-file-field" }, this.label && (h("label", { key: 'c34723f4199371d6fe8ea87463d878b89c038590', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), h("div", { key: '4727667345d3cd4a5c65a431744a09f366943c13', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: '45ed41c0f094dbe269561c8586e473f908cdf4a4', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !hasFile, onChange: this.handleInputChange }), hasFile ? (h("div", { class: "mrd-file-field__selected" }, this.uploading ? (h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))), h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (h("div", { class: "mrd-file-field__prompt" }, h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "16 16 12 12 8 16" }), h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: '00ce94ead3c32ed63e903cfd9d8480084a308d84', class: "mrd-file-field__error" }, this.error))));
1570
2094
  }
1571
2095
  static get watchers() { return {
1572
2096
  "value": [{
@@ -2127,7 +2651,7 @@ const MrdImageField = class {
2127
2651
  hasError ? 'mrd-image-field__zone--error' : '',
2128
2652
  this.disabled || this.uploading ? 'mrd-image-field__zone--disabled' : '',
2129
2653
  ].filter(Boolean).join(' ');
2130
- return (h(Host, { key: '105ebf20023291a1e5c8524eedba4f04573943cd' }, h("div", { key: '59e6fe3b81c2ec1c07db7aaba819d79d2525b21f', class: "mrd-image-field" }, this.label && (h("label", { key: '2f3815ad6fe3f35932a8cc4d625751935272b629', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), h("div", { key: '8b45fbf8d0a229110a53068620a316ab6d48dbb8', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: 'b6039e85f3f456e7c8d8e7d4db29e111a7f6d8d9', ref: el => (this.fileInputRef = el), class: "mrd-image-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !this.previewUrl, onChange: this.handleInputChange }), this.previewUrl ? (h("div", { class: "mrd-image-field__preview-container" }, h("div", { class: "mrd-image-field__preview-thumb" }, h("img", { class: "mrd-image-field__preview", src: this.previewUrl, alt: this.fileName }), this.uploading && h("div", { class: "mrd-image-field__preview-overlay" }, h("span", { class: "mrd-image-field__spinner" }))), h("div", { class: "mrd-image-field__preview-info" }, h("span", { class: "mrd-image-field__preview-name" }, this.fileName), this.uploading && (h("span", { class: "mrd-image-field__upload-status" }, t('loading', this.locale)))), !this.uploading && (h("button", { class: "mrd-image-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, t('remove', this.locale))))) : (h("div", { class: "mrd-image-field__prompt" }, h("svg", { class: "mrd-image-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), h("circle", { cx: "8.5", cy: "8.5", r: "1.5" }), h("polyline", { points: "21 15 16 10 5 21" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-image-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'f53ade0f627f3c840bc133690d40034c12665b5c', class: "mrd-image-field__error" }, this.error))));
2654
+ return (h(Host, { key: '97db2df72839f36b7a46e153a5dd1c208c52b522' }, h("div", { key: 'c8f2d3d858f90d322d26082aaf5adb57acfc78f4', class: "mrd-image-field" }, this.label && (h("label", { key: '6625e5031ff0b7c06f76c1ea0387f1bd5c1858a4', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), h("div", { key: '364216e6a96e845e21c42e821fdff02bd2612ff8', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: '0487706ddd9f48cda1cb0c2a178809d90674486b', ref: el => (this.fileInputRef = el), class: "mrd-image-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !this.previewUrl, onChange: this.handleInputChange }), this.previewUrl ? (h("div", { class: "mrd-image-field__preview-container" }, h("div", { class: "mrd-image-field__preview-thumb" }, h("img", { class: "mrd-image-field__preview", src: this.previewUrl, alt: this.fileName }), this.uploading && h("div", { class: "mrd-image-field__preview-overlay" }, h("span", { class: "mrd-image-field__spinner" }))), h("div", { class: "mrd-image-field__preview-info" }, h("span", { class: "mrd-image-field__preview-name" }, this.fileName), this.uploading && (h("span", { class: "mrd-image-field__upload-status" }, t('loading', this.locale)))), !this.uploading && (h("button", { class: "mrd-image-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, t('remove', this.locale))))) : (h("div", { class: "mrd-image-field__prompt" }, h("svg", { class: "mrd-image-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), h("circle", { cx: "8.5", cy: "8.5", r: "1.5" }), h("polyline", { points: "21 15 16 10 5 21" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-image-field__browse" }, t('browse', this.locale)))))), hasError && h("span", { key: 'bd505ef4f4b67c4e9138d8825c6e600f583f4cab', class: "mrd-image-field__error" }, this.error))));
2131
2655
  }
2132
2656
  static get watchers() { return {
2133
2657
  "value": [{
@@ -2241,7 +2765,7 @@ class CellRenderer {
2241
2765
  }
2242
2766
  }
2243
2767
 
2244
- const mrdLayoutSectionScss = () => `.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-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__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__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__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.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(10 * 1.5 * 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__doc-toolbar.sc-mrd-layout-section{display:flex;align-items:center;justify-content:flex-end;gap:var(--mrd-space-2);padding:var(--mrd-space-2) 0}.mrd-layout-section__seg.sc-mrd-layout-section{display:inline-flex;gap:2px;padding:2px;background:var(--mrd-color-neutral-100);border-radius:var(--mrd-border-radius)}.mrd-layout-section__seg-btn.sc-mrd-layout-section{width:1.875rem;height:1.625rem;display:grid;place-items:center;border:none;background:none;border-radius:var(--mrd-border-radius-sm);color:var(--mrd-color-neutral-500);cursor:pointer;transition:color var(--mrd-transition-fast), background var(--mrd-transition-fast)}.mrd-layout-section__seg-btn.sc-mrd-layout-section:hover{color:var(--mrd-color-neutral-800)}.mrd-layout-section__seg-btn[aria-pressed='true'].sc-mrd-layout-section{background:var(--mrd-color-white);color:var(--mrd-color-primary-dark);box-shadow:var(--mrd-shadow-sm)}.mrd-layout-section__seg-btn.sc-mrd-layout-section svg.sc-mrd-layout-section{width:1rem;height:1rem}.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:#fff;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:#fff;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}`;
2768
+ const mrdLayoutSectionScss = () => `.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-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__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__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__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.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(10 * 1.5 * 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:#fff;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:#fff;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}`;
2245
2769
 
2246
2770
  const MrdLayoutSection = class {
2247
2771
  constructor(hostRef) {
@@ -2254,6 +2778,9 @@ const MrdLayoutSection = class {
2254
2778
  this.mrdViewAction = createEvent(this, "mrdViewAction");
2255
2779
  this.mrdLoadViewAggregations = createEvent(this, "mrdLoadViewAggregations");
2256
2780
  this.mrdLoadViewDistinct = createEvent(this, "mrdLoadViewDistinct");
2781
+ this.mrdUpdateObject = createEvent(this, "mrdUpdateObject");
2782
+ this.mrdViewUpload = createEvent(this, "mrdViewUpload");
2783
+ this.mrdCreateObject = createEvent(this, "mrdCreateObject");
2257
2784
  /** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
2258
2785
  this.items = [];
2259
2786
  /** Record data object; keys are field names, _links holds relation and related-view links. */
@@ -2271,8 +2798,6 @@ const MrdLayoutSection = class {
2271
2798
  this.imagePreviewUrl = null;
2272
2799
  this.imagePreviews = {};
2273
2800
  this.openHistoryField = null;
2274
- /** Per-view display mode for document collection views. Default 'tree'. */
2275
- this.docViewMode = {};
2276
2801
  this.historyClickOutside = null;
2277
2802
  this.searchTimers = {};
2278
2803
  this.handleViewLoadPage = (e, name) => {
@@ -2389,6 +2914,20 @@ const MrdLayoutSection = class {
2389
2914
  if (list === null || list === void 0 ? void 0 : list.setDistinct)
2390
2915
  await list.setDistinct(nodeId, values);
2391
2916
  }
2917
+ /** Inject the uploaded file reference for a dropped file, so the document view
2918
+ * can request creation of the new document (see mrdViewUpload). */
2919
+ async setViewFileReference(name, uri) {
2920
+ const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
2921
+ if (list === null || list === void 0 ? void 0 : list.setFileReference)
2922
+ await list.setFileReference(uri);
2923
+ }
2924
+ /** Inject the created document's href after a file-drop create, so the
2925
+ * optimistic row becomes navigable (see mrdCreateObject). */
2926
+ async setViewCreatedObject(name, href) {
2927
+ const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
2928
+ if (list === null || list === void 0 ? void 0 : list.setCreatedHref)
2929
+ await list.setCreatedHref(href);
2930
+ }
2392
2931
  /** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
2393
2932
  async setImagePreview(fieldName, url) {
2394
2933
  this.imagePreviews = Object.assign(Object.assign({}, this.imagePreviews), { [fieldName]: url });
@@ -2537,7 +3076,7 @@ const MrdLayoutSection = class {
2537
3076
  return (h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, h("div", { class: "mrd-layout-section__search-wrap" }, h("svg", { class: "mrd-layout-section__search-icon", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", "clip-rule": "evenodd" })), h("input", { class: "mrd-layout-section__search-input", type: "text", value: query, placeholder: (_c = item.label) !== null && _c !== void 0 ? _c : '', onInput: e => this.handleSearchInput(dataClass, e.target.value) })), results.length > 0 && (h("ul", { class: "mrd-layout-section__search-results" }, results.map(r => (h("li", { key: r.id, class: "mrd-layout-section__search-result" }, h("button", { class: "mrd-layout-section__search-result-btn", onClick: () => this.mrdNavigate.emit({ href: r.id, label: r.label }) }, h("span", { class: "mrd-layout-section__search-result-label" }, r.label), r.description && h("span", { class: "mrd-layout-section__search-result-desc" }, r.description)))))))));
2538
3077
  }
2539
3078
  renderRelatedView(item) {
2540
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3079
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2541
3080
  const key = this.viewKeyFor(item);
2542
3081
  if (!key)
2543
3082
  return null;
@@ -2550,25 +3089,40 @@ const MrdLayoutSection = class {
2550
3089
  // The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
2551
3090
  // (sibling of `view`), not inside `view`.
2552
3091
  const docArchetype = resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, ARCHETYPE_DOCUMENT);
2553
- const mode = (_j = this.docViewMode[key]) !== null && _j !== void 0 ? _j : 'tree';
2554
- 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.renderDocToolbar(key, mode), docArchetype && mode === 'tree'
2555
- ? this.renderDocumentList(item, key, parentId, docArchetype)
3092
+ 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
3093
+ ? this.renderDocumentContainer(item, key, parentId, docArchetype)
2556
3094
  : this.renderTable(item, key, parentId)));
2557
3095
  }
2558
- /** Tree / list segmented toggle for document collection views (+ upload placeholder). */
2559
- renderDocToolbar(key, mode) {
2560
- return (h("div", { class: "mrd-layout-section__doc-toolbar" }, h("div", { class: "mrd-layout-section__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-layout-section__seg-btn", "aria-pressed": String(mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => { this.docViewMode = Object.assign(Object.assign({}, this.docViewMode), { [key]: '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-layout-section__seg-btn", "aria-pressed": String(mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => { this.docViewMode = Object.assign(Object.assign({}, this.docViewMode), { [key]: '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" }))))));
2561
- }
2562
- renderDocumentList(item, key, parentId, archetype) {
2563
- return (h("mrd-document-list", { "data-doclist": key, item: item, archetype: archetype, parentId: parentId, locale: this.locale, onMrdLoadDistinct: (e) => {
3096
+ /** Document collection view: owns the view-switch + collection actions and
3097
+ * swaps between the folder tree and the flat table. Events are re-emitted to
3098
+ * the host with the view key, exactly as the raw list/table events were. */
3099
+ renderDocumentContainer(item, key, parentId, archetype) {
3100
+ return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
2564
3101
  e.stopPropagation();
2565
3102
  this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
2566
3103
  }, onMrdLoadPage: (e) => {
2567
3104
  e.stopPropagation();
2568
3105
  this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
3106
+ }, onMrdLoadAggregations: (e) => {
3107
+ var _a;
3108
+ e.stopPropagation();
3109
+ this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
2569
3110
  }, onMrdNavigate: (e) => {
2570
3111
  e.stopPropagation();
2571
3112
  this.mrdNavigate.emit(e.detail);
3113
+ }, onMrdAction: (e) => {
3114
+ var _a;
3115
+ e.stopPropagation();
3116
+ this.mrdViewAction.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
3117
+ }, onMrdUpdateObject: (e) => {
3118
+ e.stopPropagation();
3119
+ this.mrdUpdateObject.emit(e.detail);
3120
+ }, onMrdUpload: (e) => {
3121
+ e.stopPropagation();
3122
+ this.mrdViewUpload.emit(Object.assign({ name: key }, e.detail));
3123
+ }, onMrdCreateObject: (e) => {
3124
+ e.stopPropagation();
3125
+ this.mrdCreateObject.emit(Object.assign({ name: key }, e.detail));
2572
3126
  } }));
2573
3127
  }
2574
3128
  renderTable(item, key, parentId) {
@@ -2639,7 +3193,7 @@ const MrdLayoutSection = class {
2639
3193
  }
2640
3194
  render() {
2641
3195
  const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
2642
- return (h(Host, { key: '4fbba410f9b8cab2bf21497467f99ff25f109bcc' }, h("div", { key: '679d2c34f1eaff694873ba18d679cbccecdae1a6', class: "mrd-layout-section" }, docArchetype
3196
+ return (h(Host, { key: '6e737354daec0137b6ebe304efcce9990f02739f' }, h("div", { key: '31a73a8a78999793f5dacee5f2da41df5f23156e', class: "mrd-layout-section" }, docArchetype
2643
3197
  ? this.renderDocumentObject(docArchetype)
2644
3198
  : this.items.map(item => this.renderItem(item))), this.renderImageModal()));
2645
3199
  }
@@ -2781,7 +3335,7 @@ const MrdLongtextField = class {
2781
3335
  }
2782
3336
  render() {
2783
3337
  const hasError = !!this.error;
2784
- return (h(Host, { key: '624be9369a37f0901ada13bd0e8a3bb8b40f54c8' }, h("div", { key: '6544e7b10af59a5628a119d5ea907fb968f21d42', class: "mrd-longtext-field" }, this.label && (h("label", { key: 'd56386e3fc2984b522bcbf5ec6908e044ed6f3d3', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: `mrd-longtext-field__input${hasError ? ' mrd-longtext-field__input--error' : ''}`, name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), hasError && h("span", { key: '9423d70dec9c6439cc629746f1038a61a14da5e4', class: "mrd-longtext-field__error" }, this.error))));
3338
+ return (h(Host, { key: 'f00f81944748f8f09e22d44befe5e288456b7cc8' }, h("div", { key: '7b0ae9cf5b6b684cddb648fe4db6005494322535', class: "mrd-longtext-field" }, this.label && (h("label", { key: '3fc6a8710d0e98fe685c45d214a88ae1b0947973', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: `mrd-longtext-field__input${hasError ? ' mrd-longtext-field__input--error' : ''}`, name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), hasError && h("span", { key: 'e96f1dbc6c00a1602f4ce3c97d514a229aeb7cb7', class: "mrd-longtext-field__error" }, this.error))));
2785
3339
  }
2786
3340
  };
2787
3341
  MrdLongtextField.style = mrdLongtextFieldScss();
@@ -2857,7 +3411,7 @@ const MrdNumberField = class {
2857
3411
  const hasError = !!this.error;
2858
3412
  const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
2859
3413
  this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
2860
- return (h(Host, { key: '2c844e94a7cbb3fcf33f9552329443260e9490ab' }, h("div", { key: 'b87bdc2a17552e74b27d6da16e4db9bfd2f7e4ac', class: "mrd-number-field" }, this.label && (h("label", { key: '4aca381054b0ce27c94a9a7c779642d44dbbebcc', class: `mrd-number-field__label${this.required ? ' mrd-number-field__label--required' : ''}` }, this.label)), h("div", { key: 'b7e8d122bfbd92152ce44a7ba56222425eed73f9', class: "mrd-number-field__input-wrapper" }, h("input", { key: '906330075f0b8a50ff45344e865217fd1938f199', class: `mrd-number-field__input${hasError ? ' mrd-number-field__input--error' : ''}`, type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), hasError && h("span", { key: '5f56d6f2e0a878703f35d50b1932a39a82dace3b', class: "mrd-number-field__error" }, this.error))));
3414
+ return (h(Host, { key: 'b034a3cc8d841641c0ec167e138904586b044121' }, h("div", { key: '7379bfadb8bd0c4e0a945a37013053a4e22477ab', class: "mrd-number-field" }, this.label && (h("label", { key: '5518d40b7158e17704633c2b95ac7e3efc0c5568', class: `mrd-number-field__label${this.required ? ' mrd-number-field__label--required' : ''}` }, this.label)), h("div", { key: '38ad9f3c945d66c23bd77c743306e916eaefed7f', class: "mrd-number-field__input-wrapper" }, h("input", { key: 'ac8b4bc1ea4431cc9306664522ebfda21760ae83', class: `mrd-number-field__input${hasError ? ' mrd-number-field__input--error' : ''}`, type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), hasError && h("span", { key: '09f5a58b769c81acdf4bdd48f9325934c4bb875d', class: "mrd-number-field__error" }, this.error))));
2861
3415
  }
2862
3416
  };
2863
3417
  MrdNumberField.style = mrdNumberFieldScss();
@@ -3151,9 +3705,9 @@ const MrdSecretField = class {
3151
3705
  }
3152
3706
  render() {
3153
3707
  const hasError = !!this.error;
3154
- return (h(Host, { key: 'e0d516f7e76c1fab5441567cc371569a8eab07f8' }, h("div", { key: 'fac6fb517a0f37560429c828251f7db3841d3301', class: "mrd-secret-field" }, this.label && (h("label", { key: 'b2dd3189f2fcf3fd3feea741a39dbd5c3f4d437f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
3708
+ return (h(Host, { key: 'c850ec5bc5967ca0aefca7d7cb65ecae121a9dc1' }, h("div", { key: '3249ffbc441422af054a20806dd8dfce954a8ffc', class: "mrd-secret-field" }, this.label && (h("label", { key: '0b4a86da9cafad32f153af1bc5487a4e9b941e2f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
3155
3709
  ? (h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
3156
- : (h("input", { class: `mrd-secret-field__input${hasError ? ' mrd-secret-field__input--error' : ''}`, type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), hasError && h("span", { key: 'dbd6667d7f2c6ed26220ac83a46235cf3ad777d7', class: "mrd-secret-field__error" }, this.error))));
3710
+ : (h("input", { class: `mrd-secret-field__input${hasError ? ' mrd-secret-field__input--error' : ''}`, type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), hasError && h("span", { key: 'b0d0105f3d43d2e214f070b24e745dbce0e33977', class: "mrd-secret-field__error" }, this.error))));
3157
3711
  }
3158
3712
  };
3159
3713
  MrdSecretField.style = mrdSecretFieldScss();
@@ -4300,7 +4854,7 @@ const MrdTextField = class {
4300
4854
  }
4301
4855
  render() {
4302
4856
  const hasError = !!this.error;
4303
- return (h(Host, { key: '124c46a83d30993aed5045eda42134d5c28ec989' }, h("div", { key: '5497fab2938f875fe9b4cd539a9feaaf907007e1', class: "mrd-text-field" }, this.label && (h("label", { key: '4d43255f45de8e7c4596a211797403479d2240b6', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'df3d61fc60e41731e9783dc4484f3c3ca3ea8b13', class: `mrd-text-field__input${hasError ? ' mrd-text-field__input--error' : ''}`, type: "text", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: '9bf08d3a77d7616674caf3325b6598490f2d50fc', class: "mrd-text-field__error" }, this.error))));
4857
+ return (h(Host, { key: 'e9252b251faf98ab190e643b97c13fa32d12ef22' }, h("div", { key: '37f4259a111c293f2fe12f321f08c00c25e77feb', class: "mrd-text-field" }, this.label && (h("label", { key: 'c59e0346fb71a765ea38629b03c06341567ed210', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'dc09953a672472348719f29904d900966d945843', class: `mrd-text-field__input${hasError ? ' mrd-text-field__input--error' : ''}`, type: "text", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: '037653857a372854a16b28ebf8994b23e3e0d696', class: "mrd-text-field__error" }, this.error))));
4304
4858
  }
4305
4859
  };
4306
4860
  MrdTextField.style = mrdTextFieldScss();
@@ -4374,7 +4928,7 @@ const MrdTextareaField = class {
4374
4928
  }
4375
4929
  }
4376
4930
  render() {
4377
- return (h(Host, { key: '2413906076dee3f48118d44574dadd36bcedadfe' }, h("div", { key: '59e369a54e906b09a1062c7c5f701b8bbd631479', class: "mrd-textarea-field" }, this.label && (h("label", { key: 'd400c499eb6e35581fc2af9d372917287fcc60eb', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: '62765821b5280e71918db0d070a136ef07e1eecd', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: 'f41b73291542d4582c492bce0a89240a171aba32', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: 'eaba5b735be7aa8deebfbc46eac03be970bb1d13', class: "mrd-textarea-field__error" }, this.error))));
4931
+ return (h(Host, { key: 'fe7824c81e082c3f2c1cf18c11dde20cb1f40f2c' }, h("div", { key: 'adf394a7e146d16bc79006873a209b11d88b2e17', class: "mrd-textarea-field" }, this.label && (h("label", { key: '1b0dd2b4cf26c55a0af05c67a3178edc0c9d56c4', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: '7c8fe88b222af0beed08db492aa9f6d890e0dc5b', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: '295968283e94812cb04660117c5bdeaf3647469c', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: '5b5ab61053ab0792d4c249de04bd1d13b51469bf', class: "mrd-textarea-field__error" }, this.error))));
4378
4932
  }
4379
4933
  get el() { return getElement(this); }
4380
4934
  };
@@ -4411,9 +4965,9 @@ const MrdTimeField = class {
4411
4965
  }
4412
4966
  render() {
4413
4967
  const hasError = !!this.error;
4414
- return (h(Host, { key: 'e93a6492a7bdc17f04f5aac0b8ecd63435a6280f' }, h("div", { key: 'b9692c11f21ccd354ba5475e1a60e6afc8ead22e', class: "mrd-time-field" }, this.label && (h("label", { key: '668492f16b6b96065fe65204a4f053c2ef2796e5', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), h("input", { key: 'bd2df39240c42b4a337554b0747c7b89eb5d8760', class: `mrd-time-field__input${hasError ? ' mrd-time-field__input--error' : ''}`, type: "time", name: this.name, value: this.value, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), hasError && h("span", { key: '19a81211f3b630436a379f785768d28ffa01c12c', class: "mrd-time-field__error" }, this.error))));
4968
+ return (h(Host, { key: '579219a478e31325b5a676465807c1d936724a2b' }, h("div", { key: '51b25f6e083a29989505c0ad79edbcd3b0060736', class: "mrd-time-field" }, this.label && (h("label", { key: '67d98bebb8803deea2d2a4a63f36706789ccd8c7', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), h("input", { key: '734741e0db1bdd5886fef37bba3b2f8d7200a0ab', class: `mrd-time-field__input${hasError ? ' mrd-time-field__input--error' : ''}`, type: "time", name: this.name, value: this.value, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), hasError && h("span", { key: '0dbd168d14966dc56a77c97cd8fd8f9b208a4bf5', class: "mrd-time-field__error" }, this.error))));
4415
4969
  }
4416
4970
  };
4417
4971
  MrdTimeField.style = mrdTimeFieldScss();
4418
4972
 
4419
- export { MrdBooleanField as mrd_boolean_field, MrdCurrencyField as mrd_currency_field, MrdDateField as mrd_date_field, MrdDatetimeField as mrd_datetime_field, MrdDocumentList as mrd_document_list, MrdDocumentView as mrd_document_view, MrdEmailField as mrd_email_field, MrdField as mrd_field, MrdFileField as mrd_file_field, MrdForm as mrd_form, MrdHyperlinkField as mrd_hyperlink_field, MrdImageField as mrd_image_field, MrdLayoutSection as mrd_layout_section, MrdListField as mrd_list_field, MrdLongtextField as mrd_longtext_field, MrdNumberField as mrd_number_field, MrdRelationField as mrd_relation_field, MrdSecretField as mrd_secret_field, MrdTable as mrd_table, MrdTextField as mrd_text_field, MrdTextareaField as mrd_textarea_field, MrdTimeField as mrd_time_field };
4973
+ export { MrdBooleanField as mrd_boolean_field, MrdCurrencyField as mrd_currency_field, MrdDateField as mrd_date_field, MrdDatetimeField as mrd_datetime_field, MrdDocumentContainer as mrd_document_container, MrdDocumentList as mrd_document_list, MrdDocumentView as mrd_document_view, MrdEmailField as mrd_email_field, MrdField as mrd_field, MrdFileField as mrd_file_field, MrdForm as mrd_form, MrdHyperlinkField as mrd_hyperlink_field, MrdImageField as mrd_image_field, MrdLayoutSection as mrd_layout_section, MrdListField as mrd_list_field, MrdLongtextField as mrd_longtext_field, MrdNumberField as mrd_number_field, MrdRelationField as mrd_relation_field, MrdSecretField as mrd_secret_field, MrdTable as mrd_table, MrdTextField as mrd_text_field, MrdTextareaField as mrd_textarea_field, MrdTimeField as mrd_time_field };