@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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_22.cjs.entry.js → mrd-boolean-field_23.cjs.entry.js} +591 -36
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/mrd-document-container/mrd-document-container.js +375 -0
- package/dist/collection/components/mrd-document-container/mrd-document-container.scss +79 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.js +562 -11
- package/dist/collection/components/mrd-document-list/mrd-document-list.scss +55 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.js +1 -1
- package/dist/collection/components/mrd-email-field/mrd-email-field.js +1 -1
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +1 -1
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +151 -15
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +0 -44
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +1 -1
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +2 -2
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/dev/app.js +47 -0
- package/dist/collection/utils/i18n.js +10 -0
- package/dist/components/i18n.js +1 -1
- package/dist/components/mrd-document-container.d.ts +11 -0
- package/dist/components/mrd-document-container.js +1 -0
- package/dist/components/mrd-document-container2.js +1 -0
- package/dist/components/mrd-document-list2.js +1 -1
- package/dist/components/mrd-document-view2.js +1 -1
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_22.entry.js → mrd-boolean-field_23.entry.js} +591 -37
- package/dist/mosterdcomponents/cell-renderer-B-AJDBcj.js.map +1 -0
- package/dist/mosterdcomponents/client-layout-ChqRA3AF.js.map +1 -0
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +1 -0
- package/dist/mosterdcomponents/i18n-s1XrKcD2.js.map +1 -0
- package/dist/mosterdcomponents/index-DkY-NQj0.js.map +1 -0
- package/dist/mosterdcomponents/index-DwF_Sp__.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js.map +1 -0
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
- package/dist/mosterdcomponents/p-69452249.entry.js +1 -0
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
- package/dist/mosterdcomponents/validation-Br9k2Ztw.js.map +1 -0
- package/dist/types/components/mrd-document-container/mrd-document-container.d.ts +94 -0
- package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +102 -0
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +29 -5
- package/dist/types/components.d.ts +217 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-b547291b.entry.js +0 -1
|
@@ -100,6 +100,11 @@ const translations = {
|
|
|
100
100
|
history_until: 'tot',
|
|
101
101
|
history_badge_tooltip: 'Vorige waarden',
|
|
102
102
|
hyperlink_name: 'Linktekst (optioneel)',
|
|
103
|
+
// mrd-document-list
|
|
104
|
+
new_folder: 'Nieuwe folder',
|
|
105
|
+
folder_name_placeholder: 'Foldernaam',
|
|
106
|
+
folder_no_slash: "Een foldernaam mag geen '/' bevatten",
|
|
107
|
+
folder_duplicate: 'Er bestaat al een folder met deze naam',
|
|
103
108
|
},
|
|
104
109
|
en: {
|
|
105
110
|
required: 'This field is required',
|
|
@@ -166,6 +171,11 @@ const translations = {
|
|
|
166
171
|
history_until: 'until',
|
|
167
172
|
history_badge_tooltip: 'Previous values',
|
|
168
173
|
hyperlink_name: 'Link text (optional)',
|
|
174
|
+
// mrd-document-list
|
|
175
|
+
new_folder: 'New folder',
|
|
176
|
+
folder_name_placeholder: 'Folder name',
|
|
177
|
+
folder_no_slash: "A folder name cannot contain '/'",
|
|
178
|
+
folder_duplicate: 'A folder with this name already exists',
|
|
169
179
|
},
|
|
170
180
|
ar: {
|
|
171
181
|
required: 'هذا الحقل مطلوب',
|
|
@@ -854,7 +864,112 @@ const MrdDatetimeField = class {
|
|
|
854
864
|
};
|
|
855
865
|
MrdDatetimeField.style = mrdDatetimeFieldScss();
|
|
856
866
|
|
|
857
|
-
const
|
|
867
|
+
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}`;
|
|
868
|
+
|
|
869
|
+
const MrdDocumentContainer = class {
|
|
870
|
+
constructor(hostRef) {
|
|
871
|
+
index.registerInstance(this, hostRef);
|
|
872
|
+
this.mrdLoadPage = index.createEvent(this, "mrdLoadPage");
|
|
873
|
+
this.mrdLoadDistinct = index.createEvent(this, "mrdLoadDistinct");
|
|
874
|
+
this.mrdLoadAggregations = index.createEvent(this, "mrdLoadAggregations");
|
|
875
|
+
this.mrdNavigate = index.createEvent(this, "mrdNavigate");
|
|
876
|
+
this.mrdAction = index.createEvent(this, "mrdAction");
|
|
877
|
+
this.mrdUpdateObject = index.createEvent(this, "mrdUpdateObject");
|
|
878
|
+
this.mrdUpload = index.createEvent(this, "mrdUpload");
|
|
879
|
+
this.mrdCreateObject = index.createEvent(this, "mrdCreateObject");
|
|
880
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
881
|
+
this.item = null;
|
|
882
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
883
|
+
this.parentId = '';
|
|
884
|
+
/** Lookup key used for the embedded `data-doclist` / `data-view` attributes. */
|
|
885
|
+
this.viewKey = '';
|
|
886
|
+
this.locale = navigator.language;
|
|
887
|
+
/** Active body: folder tree or flat table. */
|
|
888
|
+
this.mode = 'tree';
|
|
889
|
+
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
890
|
+
this.canCreate = false;
|
|
891
|
+
/** Whether the currently mounted table has been init()'d. Reset on every mode switch. */
|
|
892
|
+
this.tableInited = false;
|
|
893
|
+
this.createFolder = () => {
|
|
894
|
+
var _a, _b;
|
|
895
|
+
(_b = (_a = this.listEl) === null || _a === void 0 ? void 0 : _a.createFolder) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
/** The embedded table does not self-load: like every mrd-table it waits for the
|
|
899
|
+
* host to call init() (which emits mrdLoadPage, and — once page 0 lands —
|
|
900
|
+
* mrdLoadAggregations). The section only init()s tables mounted at load time, so
|
|
901
|
+
* when the user switches to list view we init the freshly mounted table here. */
|
|
902
|
+
componentDidRender() {
|
|
903
|
+
var _a;
|
|
904
|
+
if (this.mode === 'list' && this.tableEl && !this.tableInited) {
|
|
905
|
+
this.tableInited = true;
|
|
906
|
+
const table = this.tableEl;
|
|
907
|
+
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); });
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
setMode(mode) {
|
|
911
|
+
if (mode === this.mode)
|
|
912
|
+
return;
|
|
913
|
+
// The tree remounts on switch and re-emits mrdCanCreate; until then, disable.
|
|
914
|
+
this.canCreate = false;
|
|
915
|
+
// The table remounts on switch; re-init it once it is back in the DOM.
|
|
916
|
+
this.tableInited = false;
|
|
917
|
+
this.mode = mode;
|
|
918
|
+
}
|
|
919
|
+
// ── Toolbar ────────────────────────────────────────────────────────────────
|
|
920
|
+
renderToolbar() {
|
|
921
|
+
return (index.h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (index.h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, onClick: this.createFolder }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), index.h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), index.h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, index.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') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M3 5h6M3 12h9M3 19h6" }), index.h("circle", { cx: "18", cy: "5", r: "1.6" }), index.h("circle", { cx: "18", cy: "19", r: "1.6" }), index.h("path", { d: "M16 12h4" }))), index.h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, index.h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
922
|
+
}
|
|
923
|
+
// ── Bodies ───────────────────────────────────────────────────────────────
|
|
924
|
+
renderTree() {
|
|
925
|
+
return (index.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) => {
|
|
926
|
+
e.stopPropagation();
|
|
927
|
+
this.mrdLoadDistinct.emit(e.detail);
|
|
928
|
+
}, onMrdLoadPage: (e) => {
|
|
929
|
+
e.stopPropagation();
|
|
930
|
+
this.mrdLoadPage.emit(e.detail);
|
|
931
|
+
}, onMrdNavigate: (e) => {
|
|
932
|
+
e.stopPropagation();
|
|
933
|
+
this.mrdNavigate.emit(e.detail);
|
|
934
|
+
}, onMrdCanCreate: (e) => {
|
|
935
|
+
e.stopPropagation();
|
|
936
|
+
this.canCreate = e.detail;
|
|
937
|
+
}, onMrdUpdateObject: (e) => {
|
|
938
|
+
e.stopPropagation();
|
|
939
|
+
this.mrdUpdateObject.emit(e.detail);
|
|
940
|
+
}, onMrdUpload: (e) => {
|
|
941
|
+
e.stopPropagation();
|
|
942
|
+
this.mrdUpload.emit(e.detail);
|
|
943
|
+
}, onMrdCreateObject: (e) => {
|
|
944
|
+
e.stopPropagation();
|
|
945
|
+
this.mrdCreateObject.emit(e.detail);
|
|
946
|
+
} }));
|
|
947
|
+
}
|
|
948
|
+
renderList() {
|
|
949
|
+
return (index.h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, onMrdLoadPage: (e) => {
|
|
950
|
+
e.stopPropagation();
|
|
951
|
+
this.mrdLoadPage.emit(e.detail);
|
|
952
|
+
}, onMrdLoadAggregations: (e) => {
|
|
953
|
+
e.stopPropagation();
|
|
954
|
+
this.mrdLoadAggregations.emit(e.detail);
|
|
955
|
+
}, onMrdRowClick: (e) => {
|
|
956
|
+
var _a, _b, _c;
|
|
957
|
+
e.stopPropagation();
|
|
958
|
+
const row = e.detail;
|
|
959
|
+
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 : '' });
|
|
960
|
+
}, onMrdAction: (e) => {
|
|
961
|
+
e.stopPropagation();
|
|
962
|
+
this.mrdAction.emit(e.detail);
|
|
963
|
+
} }));
|
|
964
|
+
}
|
|
965
|
+
render() {
|
|
966
|
+
return (index.h(index.Host, { key: 'a5393d484bdc202b57c6d32d9ce917e760aff95a' }, this.renderToolbar(), index.h("div", { key: '52f82de8f7734e13f34d323e3e831e6de5676f46', class: "mrd-document-container__body" }, this.mode === 'tree' ? this.renderTree() : this.renderList())));
|
|
967
|
+
}
|
|
968
|
+
get el() { return index.getElement(this); }
|
|
969
|
+
};
|
|
970
|
+
MrdDocumentContainer.style = mrdDocumentContainerScss();
|
|
971
|
+
|
|
972
|
+
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)}`;
|
|
858
973
|
|
|
859
974
|
const MrdDocumentList = class {
|
|
860
975
|
constructor(hostRef) {
|
|
@@ -862,6 +977,10 @@ const MrdDocumentList = class {
|
|
|
862
977
|
this.mrdLoadDistinct = index.createEvent(this, "mrdLoadDistinct");
|
|
863
978
|
this.mrdLoadPage = index.createEvent(this, "mrdLoadPage");
|
|
864
979
|
this.mrdNavigate = index.createEvent(this, "mrdNavigate");
|
|
980
|
+
this.mrdCanCreate = index.createEvent(this, "mrdCanCreate");
|
|
981
|
+
this.mrdUpdateObject = index.createEvent(this, "mrdUpdateObject");
|
|
982
|
+
this.mrdUpload = index.createEvent(this, "mrdUpload");
|
|
983
|
+
this.mrdCreateObject = index.createEvent(this, "mrdCreateObject");
|
|
865
984
|
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
866
985
|
this.item = null;
|
|
867
986
|
/** Parent record id — required for RELATED_VIEW path building. */
|
|
@@ -871,11 +990,168 @@ const MrdDocumentList = class {
|
|
|
871
990
|
this.rootLoading = true;
|
|
872
991
|
/** True when the single-container level is collapsed away (dossier context). */
|
|
873
992
|
this.singleContainer = false;
|
|
993
|
+
/** Currently selected node id — the target for "New folder" and (later) drops. */
|
|
994
|
+
this.selectedId = null;
|
|
995
|
+
/** Node id currently highlighted as a drag-drop target (null = none). */
|
|
996
|
+
this.dropTargetId = null;
|
|
997
|
+
/** Node id showing an "uploading…" indicator while a dropped file is processed. */
|
|
998
|
+
this.uploadingNodeId = null;
|
|
874
999
|
this.nodeIndex = new Map();
|
|
1000
|
+
// ── New-folder editing state ───────────────────────────────────────────────
|
|
1001
|
+
/** The pending node whose inline name input is open (null = not creating). */
|
|
1002
|
+
this.pendingNode = null;
|
|
1003
|
+
/** The node the pending folder is being created under. */
|
|
1004
|
+
this.pendingParent = null;
|
|
1005
|
+
/** The container the pending folder belongs to. */
|
|
1006
|
+
this.pendingContainer = null;
|
|
1007
|
+
/** Current text in the inline name input. */
|
|
1008
|
+
this.pendingName = '';
|
|
1009
|
+
/** Ref to the inline input, so we can focus it after it mounts. */
|
|
1010
|
+
this.pendingInputEl = null;
|
|
1011
|
+
/** Set when a fresh input needs focus on the next render. */
|
|
1012
|
+
this.pendingNeedsFocus = false;
|
|
1013
|
+
/** Monotonic counter for unique temporary pending-node ids. */
|
|
1014
|
+
this.newFolderSeq = 0;
|
|
1015
|
+
/** Last emitted canCreateFolder value, to only emit mrdCanCreate on change. */
|
|
1016
|
+
this.lastCanCreate = false;
|
|
1017
|
+
// ── Drag & drop (move a document into another folder) ──────────────────────
|
|
1018
|
+
/** The document row currently being dragged. */
|
|
1019
|
+
this.dragDoc = null;
|
|
1020
|
+
/** Id of the node the dragged document currently lives in. */
|
|
1021
|
+
this.dragFromId = null;
|
|
1022
|
+
/** External file dropped onto a node, awaiting its upload to complete. */
|
|
1023
|
+
this.pendingUpload = null;
|
|
1024
|
+
/** The optimistic document row awaiting its self href from the create POST. */
|
|
1025
|
+
this.lastOptimisticDoc = null;
|
|
1026
|
+
this.startCreateFolder = () => {
|
|
1027
|
+
const resolved = this.resolveTarget();
|
|
1028
|
+
if (!resolved || this.pendingNode)
|
|
1029
|
+
return;
|
|
1030
|
+
const { target, container } = resolved;
|
|
1031
|
+
const tempId = `${container.id}/__new__${this.newFolderSeq++}`;
|
|
1032
|
+
const node = this.makeFolderNode(tempId, '', container.id);
|
|
1033
|
+
node.pending = true;
|
|
1034
|
+
node.editing = true;
|
|
1035
|
+
target.children = [...target.children, node];
|
|
1036
|
+
target.open = true;
|
|
1037
|
+
this.nodeIndex.set(node.id, node);
|
|
1038
|
+
this.pendingNode = node;
|
|
1039
|
+
this.pendingParent = target;
|
|
1040
|
+
this.pendingContainer = container;
|
|
1041
|
+
this.pendingName = '';
|
|
1042
|
+
this.pendingNeedsFocus = true;
|
|
1043
|
+
this.bump();
|
|
1044
|
+
};
|
|
1045
|
+
this.onPendingInput = (e) => {
|
|
1046
|
+
var _a;
|
|
1047
|
+
this.pendingName = e.target.value;
|
|
1048
|
+
if ((_a = this.pendingNode) === null || _a === void 0 ? void 0 : _a.error) {
|
|
1049
|
+
this.pendingNode.error = undefined;
|
|
1050
|
+
this.bump();
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
this.onPendingKeyDown = (e) => {
|
|
1054
|
+
if (e.key === 'Enter') {
|
|
1055
|
+
e.preventDefault();
|
|
1056
|
+
this.commitFolder();
|
|
1057
|
+
}
|
|
1058
|
+
else if (e.key === 'Escape') {
|
|
1059
|
+
e.preventDefault();
|
|
1060
|
+
this.cancelFolder();
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
// ── Drag & drop: move a document into another folder / container ────────────
|
|
1064
|
+
this.onDocDragStart = (e, doc, node) => {
|
|
1065
|
+
var _a, _b, _c;
|
|
1066
|
+
this.dragDoc = doc;
|
|
1067
|
+
this.dragFromId = node.id;
|
|
1068
|
+
if (e.dataTransfer) {
|
|
1069
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
1070
|
+
// A payload is required for a drag to start in some browsers.
|
|
1071
|
+
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 : '');
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
this.onDocDragEnd = () => {
|
|
1075
|
+
this.dragDoc = null;
|
|
1076
|
+
this.dragFromId = null;
|
|
1077
|
+
if (this.dropTargetId !== null)
|
|
1078
|
+
this.dropTargetId = null;
|
|
1079
|
+
};
|
|
1080
|
+
/** A folder/container node (or a document inside it) accepts an internal move
|
|
1081
|
+
* or an external file drop. Always claims the event so it never bubbles to the
|
|
1082
|
+
* root drop-zone; a different node is highlighted (its own folder = no-op). */
|
|
1083
|
+
this.onNodeDragOver = (e, node) => {
|
|
1084
|
+
const file = this.isFileDrag(e);
|
|
1085
|
+
if (!this.dragDoc && !file)
|
|
1086
|
+
return;
|
|
1087
|
+
e.preventDefault();
|
|
1088
|
+
e.stopPropagation();
|
|
1089
|
+
if (e.dataTransfer)
|
|
1090
|
+
e.dataTransfer.dropEffect = file ? 'copy' : 'move';
|
|
1091
|
+
const target = !file && node.id === this.dragFromId ? null : node.id;
|
|
1092
|
+
if (this.dropTargetId !== target)
|
|
1093
|
+
this.dropTargetId = target;
|
|
1094
|
+
};
|
|
1095
|
+
this.onNodeDragLeave = (node) => {
|
|
1096
|
+
if (this.dropTargetId === node.id)
|
|
1097
|
+
this.dropTargetId = null;
|
|
1098
|
+
};
|
|
1099
|
+
this.onNodeDrop = (e, node, container) => {
|
|
1100
|
+
if (this.isFileDrag(e)) {
|
|
1101
|
+
e.preventDefault();
|
|
1102
|
+
e.stopPropagation();
|
|
1103
|
+
this.startFileUpload(e, node, container);
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
if (!this.dragDoc)
|
|
1107
|
+
return;
|
|
1108
|
+
e.preventDefault();
|
|
1109
|
+
e.stopPropagation();
|
|
1110
|
+
this.moveDocument(node, container);
|
|
1111
|
+
this.onDocDragEnd();
|
|
1112
|
+
};
|
|
1113
|
+
/** Root-zone drop (dossier context): target the single container's root. */
|
|
1114
|
+
this.onRootDragOver = (e) => {
|
|
1115
|
+
if (!this.singleContainer)
|
|
1116
|
+
return;
|
|
1117
|
+
const file = this.isFileDrag(e);
|
|
1118
|
+
if (!this.dragDoc && !file)
|
|
1119
|
+
return;
|
|
1120
|
+
e.preventDefault();
|
|
1121
|
+
if (e.dataTransfer)
|
|
1122
|
+
e.dataTransfer.dropEffect = file ? 'copy' : 'move';
|
|
1123
|
+
};
|
|
1124
|
+
this.onRootDrop = (e) => {
|
|
1125
|
+
if (!this.singleContainer)
|
|
1126
|
+
return;
|
|
1127
|
+
const only = this.containers[0];
|
|
1128
|
+
if (this.isFileDrag(e)) {
|
|
1129
|
+
e.preventDefault();
|
|
1130
|
+
this.startFileUpload(e, only, only);
|
|
1131
|
+
return;
|
|
1132
|
+
}
|
|
1133
|
+
if (!this.dragDoc)
|
|
1134
|
+
return;
|
|
1135
|
+
e.preventDefault();
|
|
1136
|
+
this.moveDocument(only, only);
|
|
1137
|
+
this.onDocDragEnd();
|
|
1138
|
+
};
|
|
875
1139
|
}
|
|
876
1140
|
componentDidLoad() {
|
|
877
1141
|
this.emitContainerDistinct();
|
|
878
1142
|
}
|
|
1143
|
+
componentDidRender() {
|
|
1144
|
+
if (this.pendingNeedsFocus && this.pendingInputEl) {
|
|
1145
|
+
this.pendingInputEl.focus();
|
|
1146
|
+
this.pendingInputEl.select();
|
|
1147
|
+
this.pendingNeedsFocus = false;
|
|
1148
|
+
}
|
|
1149
|
+
const can = this.canCreateFolder;
|
|
1150
|
+
if (can !== this.lastCanCreate) {
|
|
1151
|
+
this.lastCanCreate = can;
|
|
1152
|
+
this.mrdCanCreate.emit(can);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
879
1155
|
// ── Slot field names ─────────────────────────────────────────────────────
|
|
880
1156
|
get containerField() {
|
|
881
1157
|
var _a, _b, _c;
|
|
@@ -889,6 +1165,10 @@ const MrdDocumentList = class {
|
|
|
889
1165
|
var _a, _b, _c;
|
|
890
1166
|
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';
|
|
891
1167
|
}
|
|
1168
|
+
get fileField() {
|
|
1169
|
+
var _a, _b, _c;
|
|
1170
|
+
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';
|
|
1171
|
+
}
|
|
892
1172
|
get dateField() {
|
|
893
1173
|
var _a, _b;
|
|
894
1174
|
return (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b.date;
|
|
@@ -1041,7 +1321,7 @@ const MrdDocumentList = class {
|
|
|
1041
1321
|
acc.push(seg);
|
|
1042
1322
|
let child = node.children.find(c => c.label === seg);
|
|
1043
1323
|
if (!child) {
|
|
1044
|
-
child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg);
|
|
1324
|
+
child = this.makeFolderNode(container.id + '/' + acc.join('/'), seg, container.id);
|
|
1045
1325
|
node.children.push(child);
|
|
1046
1326
|
this.nodeIndex.set(child.id, child);
|
|
1047
1327
|
}
|
|
@@ -1077,9 +1357,9 @@ const MrdDocumentList = class {
|
|
|
1077
1357
|
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1078
1358
|
};
|
|
1079
1359
|
}
|
|
1080
|
-
makeFolderNode(id, label) {
|
|
1360
|
+
makeFolderNode(id, label, containerId) {
|
|
1081
1361
|
return {
|
|
1082
|
-
id, kind: 'folder', label,
|
|
1362
|
+
id, kind: 'folder', label, containerId,
|
|
1083
1363
|
hasDocs: false, docCount: 0, totalCount: 0, children: [],
|
|
1084
1364
|
open: false, loading: false, foldersLoaded: false, docsLoaded: false, docs: [],
|
|
1085
1365
|
};
|
|
@@ -1097,6 +1377,7 @@ const MrdDocumentList = class {
|
|
|
1097
1377
|
}
|
|
1098
1378
|
// ── Interaction ──────────────────────────────────────────────────────────
|
|
1099
1379
|
toggleContainer(node) {
|
|
1380
|
+
this.selectedId = node.id;
|
|
1100
1381
|
node.open = !node.open;
|
|
1101
1382
|
if (node.open && !node.foldersLoaded && !node.loading) {
|
|
1102
1383
|
this.emitFolderDistinct(node);
|
|
@@ -1104,12 +1385,235 @@ const MrdDocumentList = class {
|
|
|
1104
1385
|
this.bump();
|
|
1105
1386
|
}
|
|
1106
1387
|
toggleFolder(container, node) {
|
|
1388
|
+
this.selectedId = node.id;
|
|
1107
1389
|
node.open = !node.open;
|
|
1108
1390
|
if (node.open && node.hasDocs && !node.docsLoaded && !node.loading) {
|
|
1109
1391
|
this.emitDocuments(container, node);
|
|
1110
1392
|
}
|
|
1111
1393
|
this.bump();
|
|
1112
1394
|
}
|
|
1395
|
+
// ── New folder (client-side pending, materialises on document drop) ─────────
|
|
1396
|
+
/** Resolve the node a new folder should be created under, and its container.
|
|
1397
|
+
* Uses the current selection; falls back to the single container (dossier). */
|
|
1398
|
+
resolveTarget() {
|
|
1399
|
+
if (this.selectedId) {
|
|
1400
|
+
const n = this.nodeIndex.get(this.selectedId);
|
|
1401
|
+
if (n && n.kind === 'container')
|
|
1402
|
+
return { target: n, container: n };
|
|
1403
|
+
if (n && n.kind === 'folder') {
|
|
1404
|
+
const container = n.containerId ? this.nodeIndex.get(n.containerId) : undefined;
|
|
1405
|
+
if (container)
|
|
1406
|
+
return { target: n, container };
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
if (this.singleContainer && this.containers[0]) {
|
|
1410
|
+
const only = this.containers[0];
|
|
1411
|
+
return { target: only, container: only };
|
|
1412
|
+
}
|
|
1413
|
+
return null;
|
|
1414
|
+
}
|
|
1415
|
+
get canCreateFolder() {
|
|
1416
|
+
return !this.pendingNode && this.resolveTarget() !== null;
|
|
1417
|
+
}
|
|
1418
|
+
/** Start creating a folder under the current target. Called by the host toolbar
|
|
1419
|
+
* (mrd-document-container). No-op when there is no valid target. */
|
|
1420
|
+
async createFolder() {
|
|
1421
|
+
this.startCreateFolder();
|
|
1422
|
+
}
|
|
1423
|
+
/** Folder path segments of a node relative to its container (derived from its id). */
|
|
1424
|
+
segmentsOf(node, container) {
|
|
1425
|
+
if (node.kind === 'container')
|
|
1426
|
+
return [];
|
|
1427
|
+
const prefix = container.id + '/';
|
|
1428
|
+
const rest = node.id.startsWith(prefix) ? node.id.slice(prefix.length) : '';
|
|
1429
|
+
return rest ? rest.split('/') : [];
|
|
1430
|
+
}
|
|
1431
|
+
commitFolder() {
|
|
1432
|
+
const node = this.pendingNode;
|
|
1433
|
+
const parent = this.pendingParent;
|
|
1434
|
+
const container = this.pendingContainer;
|
|
1435
|
+
if (!node || !parent || !container)
|
|
1436
|
+
return;
|
|
1437
|
+
const name = this.pendingName.trim();
|
|
1438
|
+
if (!name) {
|
|
1439
|
+
this.cancelFolder();
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
if (name.includes('/')) {
|
|
1443
|
+
node.error = t('folder_no_slash', this.locale);
|
|
1444
|
+
this.bump();
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
const dup = parent.children.some(c => c !== node && c.label.toLowerCase() === name.toLowerCase());
|
|
1448
|
+
if (dup) {
|
|
1449
|
+
node.error = t('folder_duplicate', this.locale);
|
|
1450
|
+
this.bump();
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
// Finalise: swap the temp id for the real path-derived id so a later distinct
|
|
1454
|
+
// value with the same folder string merges onto this node.
|
|
1455
|
+
const segs = [...this.segmentsOf(parent, container), name];
|
|
1456
|
+
this.nodeIndex.delete(node.id);
|
|
1457
|
+
node.id = container.id + '/' + segs.join('/');
|
|
1458
|
+
node.fullPath = '/' + segs.join('/');
|
|
1459
|
+
node.label = name;
|
|
1460
|
+
node.editing = false;
|
|
1461
|
+
node.error = undefined;
|
|
1462
|
+
node.open = true;
|
|
1463
|
+
this.nodeIndex.set(node.id, node);
|
|
1464
|
+
this.selectedId = node.id;
|
|
1465
|
+
this.clearPending();
|
|
1466
|
+
this.bump();
|
|
1467
|
+
}
|
|
1468
|
+
cancelFolder() {
|
|
1469
|
+
const node = this.pendingNode;
|
|
1470
|
+
const parent = this.pendingParent;
|
|
1471
|
+
if (node && parent) {
|
|
1472
|
+
parent.children = parent.children.filter(c => c !== node);
|
|
1473
|
+
this.nodeIndex.delete(node.id);
|
|
1474
|
+
}
|
|
1475
|
+
this.clearPending();
|
|
1476
|
+
this.bump();
|
|
1477
|
+
}
|
|
1478
|
+
clearPending() {
|
|
1479
|
+
this.pendingNode = null;
|
|
1480
|
+
this.pendingParent = null;
|
|
1481
|
+
this.pendingContainer = null;
|
|
1482
|
+
this.pendingName = '';
|
|
1483
|
+
this.pendingInputEl = null;
|
|
1484
|
+
this.pendingNeedsFocus = false;
|
|
1485
|
+
}
|
|
1486
|
+
/** True when the drag carries external files (an OS file drop, not an internal move). */
|
|
1487
|
+
isFileDrag(e) {
|
|
1488
|
+
return !this.dragDoc && !!e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files');
|
|
1489
|
+
}
|
|
1490
|
+
// ── External file drop → upload → create document ──────────────────────────
|
|
1491
|
+
/** Begin an upload: emit mrdUpload; the host uploads and calls setFileReference. */
|
|
1492
|
+
startFileUpload(e, node, container) {
|
|
1493
|
+
var _a, _b;
|
|
1494
|
+
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
|
|
1495
|
+
this.dropTargetId = null;
|
|
1496
|
+
if (!file)
|
|
1497
|
+
return;
|
|
1498
|
+
this.pendingUpload = { file, node, container };
|
|
1499
|
+
node.open = true;
|
|
1500
|
+
this.uploadingNodeId = node.id;
|
|
1501
|
+
this.bump();
|
|
1502
|
+
this.mrdUpload.emit({ file });
|
|
1503
|
+
}
|
|
1504
|
+
/** Strip a single trailing extension for the document title. */
|
|
1505
|
+
stripExtension(name) {
|
|
1506
|
+
return name.replace(/\.[^./\\]+$/, '');
|
|
1507
|
+
}
|
|
1508
|
+
/** Host callback with the uploaded file reference. Builds the create payload
|
|
1509
|
+
* from the archetype slots and requests the new document. */
|
|
1510
|
+
async setFileReference(uri) {
|
|
1511
|
+
const up = this.pendingUpload;
|
|
1512
|
+
if (!up)
|
|
1513
|
+
return;
|
|
1514
|
+
const { file, node, container } = up;
|
|
1515
|
+
const folder = this.folderStringOf(node, container);
|
|
1516
|
+
const values = {
|
|
1517
|
+
[this.fileField]: uri,
|
|
1518
|
+
[this.titleField]: this.stripExtension(file.name),
|
|
1519
|
+
[this.folderField]: folder,
|
|
1520
|
+
[this.containerField]: container.href,
|
|
1521
|
+
};
|
|
1522
|
+
this.mrdCreateObject.emit({ path: this.buildDataPath(), values });
|
|
1523
|
+
// Optimistically show the new document (no href until a reload).
|
|
1524
|
+
const optimistic = { [this.titleField]: this.stripExtension(file.name), _optimistic: true };
|
|
1525
|
+
const wasUnloadedEmpty = !node.docsLoaded && node.docCount === 0;
|
|
1526
|
+
node.hasDocs = true;
|
|
1527
|
+
node.pending = false;
|
|
1528
|
+
node.docCount += 1;
|
|
1529
|
+
if (wasUnloadedEmpty) {
|
|
1530
|
+
node.docsLoaded = true;
|
|
1531
|
+
node.docs = [optimistic];
|
|
1532
|
+
}
|
|
1533
|
+
else if (node.docsLoaded)
|
|
1534
|
+
node.docs = [...node.docs, optimistic];
|
|
1535
|
+
this.recomputeContainerTotals(container, 1);
|
|
1536
|
+
this.lastOptimisticDoc = optimistic;
|
|
1537
|
+
this.pendingUpload = null;
|
|
1538
|
+
this.uploadingNodeId = null;
|
|
1539
|
+
this.bump();
|
|
1540
|
+
}
|
|
1541
|
+
/** Host callback with the created document's self href, so the optimistic row
|
|
1542
|
+
* becomes navigable without waiting for a reload. */
|
|
1543
|
+
async setCreatedHref(href) {
|
|
1544
|
+
var _a;
|
|
1545
|
+
const doc = this.lastOptimisticDoc;
|
|
1546
|
+
if (!doc || !href)
|
|
1547
|
+
return;
|
|
1548
|
+
doc._links = Object.assign(Object.assign({}, ((_a = doc._links) !== null && _a !== void 0 ? _a : {})), { self: { href } });
|
|
1549
|
+
doc._optimistic = false;
|
|
1550
|
+
this.lastOptimisticDoc = null;
|
|
1551
|
+
this.bump();
|
|
1552
|
+
}
|
|
1553
|
+
/** Folder string a node represents: the raw distinct value when it holds
|
|
1554
|
+
* documents, else derived from its path segments; null for a container root. */
|
|
1555
|
+
folderStringOf(node, container) {
|
|
1556
|
+
if (node.kind === 'container')
|
|
1557
|
+
return null;
|
|
1558
|
+
if (node.fullPath != null && node.fullPath !== '')
|
|
1559
|
+
return node.fullPath;
|
|
1560
|
+
const segs = this.segmentsOf(node, container);
|
|
1561
|
+
return segs.length ? '/' + segs.join('/') : null;
|
|
1562
|
+
}
|
|
1563
|
+
moveDocument(toNode, toContainer) {
|
|
1564
|
+
var _a, _b;
|
|
1565
|
+
const doc = this.dragDoc;
|
|
1566
|
+
const fromNode = this.dragFromId ? this.nodeIndex.get(this.dragFromId) : undefined;
|
|
1567
|
+
if (!doc || !fromNode)
|
|
1568
|
+
return;
|
|
1569
|
+
const fromContainer = fromNode.kind === 'container'
|
|
1570
|
+
? fromNode
|
|
1571
|
+
: (fromNode.containerId ? this.nodeIndex.get(fromNode.containerId) : undefined);
|
|
1572
|
+
if (!fromContainer)
|
|
1573
|
+
return;
|
|
1574
|
+
const targetFolder = this.folderStringOf(toNode, toContainer);
|
|
1575
|
+
const sourceFolder = this.folderStringOf(fromNode, fromContainer);
|
|
1576
|
+
const sameContainer = toContainer === fromContainer;
|
|
1577
|
+
// No-op: dropped back onto its own folder.
|
|
1578
|
+
if (toNode === fromNode || (sameContainer && targetFolder === sourceFolder))
|
|
1579
|
+
return;
|
|
1580
|
+
// ── Optimistic tree update (fire-and-forget; no refetch) ──
|
|
1581
|
+
fromNode.docs = fromNode.docs.filter(d => d !== doc);
|
|
1582
|
+
fromNode.docCount = Math.max(0, fromNode.docCount - 1);
|
|
1583
|
+
// A now-empty folder should stop showing an expand chevron (it disappears on
|
|
1584
|
+
// the next reload anyway, since it is derived from document folder strings).
|
|
1585
|
+
if (fromNode.docsLoaded)
|
|
1586
|
+
fromNode.hasDocs = fromNode.docs.length > 0;
|
|
1587
|
+
toNode.hasDocs = true;
|
|
1588
|
+
toNode.pending = false; // a pending folder is now materialised
|
|
1589
|
+
toNode.docCount += 1;
|
|
1590
|
+
if (toNode.kind === 'folder')
|
|
1591
|
+
toNode.fullPath = targetFolder !== null && targetFolder !== void 0 ? targetFolder : '';
|
|
1592
|
+
if (toNode.docsLoaded)
|
|
1593
|
+
toNode.docs = [...toNode.docs, doc];
|
|
1594
|
+
this.recomputeContainerTotals(fromContainer, -1);
|
|
1595
|
+
if (!sameContainer)
|
|
1596
|
+
this.recomputeContainerTotals(toContainer, 1);
|
|
1597
|
+
// ── Emit the generic update; host PATCHes the document ──
|
|
1598
|
+
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;
|
|
1599
|
+
if (href) {
|
|
1600
|
+
const values = { [this.folderField]: targetFolder };
|
|
1601
|
+
if (!sameContainer)
|
|
1602
|
+
values[this.containerField] = toContainer.href;
|
|
1603
|
+
this.mrdUpdateObject.emit({ href, values });
|
|
1604
|
+
}
|
|
1605
|
+
this.bump();
|
|
1606
|
+
}
|
|
1607
|
+
/** Recompute a container's subtree totals from docCounts when its folders are
|
|
1608
|
+
* loaded; otherwise just nudge the aggregate badge by the delta. */
|
|
1609
|
+
recomputeContainerTotals(container, delta) {
|
|
1610
|
+
if (container.foldersLoaded) {
|
|
1611
|
+
this.computeTotals(container);
|
|
1612
|
+
}
|
|
1613
|
+
else {
|
|
1614
|
+
container.totalCount = Math.max(0, container.totalCount + delta);
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1113
1617
|
openDoc(doc) {
|
|
1114
1618
|
var _a, _b, _c, _d;
|
|
1115
1619
|
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;
|
|
@@ -1132,12 +1636,12 @@ const MrdDocumentList = class {
|
|
|
1132
1636
|
indent(depth) {
|
|
1133
1637
|
return index.h("span", { class: "mrd-document-list__indent", style: { width: `${depth * 18}px` } });
|
|
1134
1638
|
}
|
|
1135
|
-
renderDocRow(doc, depth) {
|
|
1639
|
+
renderDocRow(doc, node, container, depth) {
|
|
1136
1640
|
var _a, _b, _c, _d, _e;
|
|
1137
1641
|
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 : '';
|
|
1138
1642
|
const dateRaw = this.dateField ? doc === null || doc === void 0 ? void 0 : doc[this.dateField] : undefined;
|
|
1139
1643
|
const date = dateRaw ? formatDate(dateRaw, this.locale) : '';
|
|
1140
|
-
return (index.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(), index.h("span", { class: "mrd-document-list__label" }, label), date && index.h("span", { class: "mrd-document-list__date" }, date)));
|
|
1644
|
+
return (index.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(), index.h("span", { class: "mrd-document-list__label" }, label), date && index.h("span", { class: "mrd-document-list__date" }, date)));
|
|
1141
1645
|
}
|
|
1142
1646
|
renderLoadingRow(depth) {
|
|
1143
1647
|
return (index.h("div", { class: "mrd-document-list__loading", key: "loading" }, this.indent(depth), index.h("span", { class: "mrd-document-list__spinner" }), t('loading', this.locale)));
|
|
@@ -1148,7 +1652,7 @@ const MrdDocumentList = class {
|
|
|
1148
1652
|
if (node.hasDocs) {
|
|
1149
1653
|
if (node.docsLoaded) {
|
|
1150
1654
|
for (const doc of node.docs)
|
|
1151
|
-
out.push(this.renderDocRow(doc, depth));
|
|
1655
|
+
out.push(this.renderDocRow(doc, node, container, depth));
|
|
1152
1656
|
}
|
|
1153
1657
|
else if (node.loading) {
|
|
1154
1658
|
out.push(this.renderLoadingRow(depth));
|
|
@@ -1158,14 +1662,34 @@ const MrdDocumentList = class {
|
|
|
1158
1662
|
for (const child of node.children) {
|
|
1159
1663
|
out.push(this.renderFolderNode(container, child, depth));
|
|
1160
1664
|
}
|
|
1665
|
+
// An uploading file dropped onto this node.
|
|
1666
|
+
if (node.id === this.uploadingNodeId)
|
|
1667
|
+
out.push(this.renderUploadingRow(depth));
|
|
1161
1668
|
return out;
|
|
1162
1669
|
}
|
|
1670
|
+
renderUploadingRow(depth) {
|
|
1671
|
+
return (index.h("div", { class: "mrd-document-list__loading", key: "uploading" }, this.indent(depth), index.h("span", { class: "mrd-document-list__spinner" }), t('upload_file', this.locale)));
|
|
1672
|
+
}
|
|
1673
|
+
renderFolderEditRow(node, depth) {
|
|
1674
|
+
return (index.h("div", { class: "mrd-document-list__node", key: node.id }, index.h("div", { class: "mrd-document-list__row mrd-document-list__row--edit" }, this.indent(depth), this.renderChevron(false, true), this.renderFolderIcon(), index.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 && (index.h("div", { class: "mrd-document-list__error", style: { paddingLeft: `${depth * 18 + 52}px` } }, node.error))));
|
|
1675
|
+
}
|
|
1163
1676
|
renderFolderNode(container, node, depth) {
|
|
1677
|
+
if (node.editing)
|
|
1678
|
+
return this.renderFolderEditRow(node, depth);
|
|
1164
1679
|
const leaf = node.children.length === 0 && !node.hasDocs;
|
|
1165
|
-
|
|
1680
|
+
const selected = node.id === this.selectedId;
|
|
1681
|
+
const cls = 'mrd-document-list__row'
|
|
1682
|
+
+ (selected ? ' mrd-document-list__row--selected' : '')
|
|
1683
|
+
+ (node.pending ? ' mrd-document-list__row--pending' : '')
|
|
1684
|
+
+ (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
|
|
1685
|
+
return (index.h("div", { class: "mrd-document-list__node", key: node.id }, index.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(), index.h("span", { class: "mrd-document-list__label" }, node.label), index.h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && index.h("div", { class: "mrd-document-list__kids" }, this.renderChildren(container, node, depth + 1))));
|
|
1166
1686
|
}
|
|
1167
1687
|
renderContainerNode(node, depth) {
|
|
1168
|
-
|
|
1688
|
+
const selected = node.id === this.selectedId;
|
|
1689
|
+
const cls = 'mrd-document-list__row mrd-document-list__row--dossier'
|
|
1690
|
+
+ (selected ? ' mrd-document-list__row--selected' : '')
|
|
1691
|
+
+ (node.id === this.dropTargetId ? ' mrd-document-list__row--drop' : '');
|
|
1692
|
+
return (index.h("div", { class: "mrd-document-list__node", key: node.id }, index.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(), index.h("span", { class: "mrd-document-list__label" }, node.label), index.h("span", { class: "mrd-document-list__count" }, node.totalCount)), node.open && (index.h("div", { class: "mrd-document-list__kids" }, node.loading && !node.foldersLoaded
|
|
1169
1693
|
? this.renderLoadingRow(depth + 1)
|
|
1170
1694
|
: this.renderChildren(node, node, depth + 1)))));
|
|
1171
1695
|
}
|
|
@@ -1175,7 +1699,7 @@ const MrdDocumentList = class {
|
|
|
1175
1699
|
body = this.renderLoadingRow(0);
|
|
1176
1700
|
}
|
|
1177
1701
|
else if (this.containers.length === 0) {
|
|
1178
|
-
body = index.h("div", { key: '
|
|
1702
|
+
body = index.h("div", { key: 'b8c3297cd7cff5bf79ce694d2ee1a64c570df5ce', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
1179
1703
|
}
|
|
1180
1704
|
else if (this.singleContainer) {
|
|
1181
1705
|
// Dossier context: render the single container's folder tree at the root.
|
|
@@ -1187,7 +1711,7 @@ const MrdDocumentList = class {
|
|
|
1187
1711
|
else {
|
|
1188
1712
|
body = this.containers.map(c => this.renderContainerNode(c, 0));
|
|
1189
1713
|
}
|
|
1190
|
-
return (index.h(index.Host, { key: '
|
|
1714
|
+
return (index.h(index.Host, { key: 'ff3b024a79ba2270aa28861923bc6406f98061aa' }, index.h("div", { key: '9db121e5336a4e3c82443257f6424db5ab4f0baf', class: "mrd-document-list", onDragOver: this.onRootDragOver, onDrop: this.onRootDrop }, body)));
|
|
1191
1715
|
}
|
|
1192
1716
|
get el() { return index.getElement(this); }
|
|
1193
1717
|
};
|
|
@@ -1245,7 +1769,7 @@ const MrdDocumentView = class {
|
|
|
1245
1769
|
const date = dateRaw != null && dateRaw !== '' ? formatDate(dateRaw, this.locale) : null;
|
|
1246
1770
|
const summaryRaw = this.slotValue('summary');
|
|
1247
1771
|
const summary = summaryRaw != null && summaryRaw !== '' ? String(summaryRaw) : null;
|
|
1248
|
-
return (index.h(index.Host, { key: '
|
|
1772
|
+
return (index.h(index.Host, { key: '0a2071925ecdb21738376d66fa4babf4590e694c' }, index.h("div", { key: 'a2d29c0b6e211cab142adc780466bc885a602e96', class: "mrd-document-view" }, this.renderContainer(), title && index.h("h1", { key: '7f5ac202c21bc8a70f0dd15e2e1fa06e651b5bce', class: "mrd-document-view__title" }, title), date && index.h("p", { key: 'b1dce94d5fd8bfd5e078644f631a38f91b87e7ff', class: "mrd-document-view__date" }, date), this.renderFile(), summary && (index.h("div", { key: '588b9ca40a49ae9ea303852620bde75333b440ab', class: "mrd-document-view__summary" }, index.h("div", { key: 'd3b8adb85ac346b72451e789c10aedd539c966de', class: "mrd-document-view__summary-body", innerHTML: summary }))))));
|
|
1249
1773
|
}
|
|
1250
1774
|
};
|
|
1251
1775
|
MrdDocumentView.style = mrdDocumentViewScss();
|
|
@@ -1285,7 +1809,7 @@ const MrdEmailField = class {
|
|
|
1285
1809
|
}
|
|
1286
1810
|
render() {
|
|
1287
1811
|
const hasError = !!this.error;
|
|
1288
|
-
return (index.h(index.Host, { key: '
|
|
1812
|
+
return (index.h(index.Host, { key: '0d442ab2a711c26c83fcdbf0fd8cd006d8dd8649' }, index.h("div", { key: 'ceb2a80679514c4c5b888fe096c90ed6cc973f64', class: "mrd-email-field" }, this.label && (index.h("label", { key: '663f95eff1002ee56cfc3104514bf31b47e26750', class: `mrd-email-field__label${this.required ? ' mrd-email-field__label--required' : ''}` }, this.label)), index.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 && index.h("span", { key: '626ee856ceaa7051fb9dd1de8b7cbd708e83f617', class: "mrd-email-field__error" }, this.error))));
|
|
1289
1813
|
}
|
|
1290
1814
|
};
|
|
1291
1815
|
MrdEmailField.style = mrdEmailFieldScss();
|
|
@@ -1568,7 +2092,7 @@ const MrdFileField = class {
|
|
|
1568
2092
|
hasError ? 'mrd-file-field__zone--error' : '',
|
|
1569
2093
|
this.disabled || this.uploading ? 'mrd-file-field__zone--disabled' : '',
|
|
1570
2094
|
].filter(Boolean).join(' ');
|
|
1571
|
-
return (index.h(index.Host, { key: '
|
|
2095
|
+
return (index.h(index.Host, { key: '095bb39f3cb1680cf5e7e51bdfd06d8eb087f237' }, index.h("div", { key: '7e5b5fe6e63b6530221083c8bcb82bcac59a5fe7', class: "mrd-file-field" }, this.label && (index.h("label", { key: 'c34723f4199371d6fe8ea87463d878b89c038590', class: `mrd-file-field__label${this.required ? ' mrd-file-field__label--required' : ''}` }, this.label)), index.h("div", { key: '4727667345d3cd4a5c65a431744a09f366943c13', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, index.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 ? (index.h("div", { class: "mrd-file-field__selected" }, this.uploading ? (index.h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (index.h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, index.h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), index.h("polyline", { points: "14 2 14 8 20 8" }))), index.h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (index.h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (index.h("div", { class: "mrd-file-field__prompt" }, index.h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, index.h("polyline", { points: "16 16 12 12 8 16" }), index.h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), index.h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), index.h("span", null, t('drop_file_here', this.locale), ' ', index.h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), hasError && index.h("span", { key: '00ce94ead3c32ed63e903cfd9d8480084a308d84', class: "mrd-file-field__error" }, this.error))));
|
|
1572
2096
|
}
|
|
1573
2097
|
static get watchers() { return {
|
|
1574
2098
|
"value": [{
|
|
@@ -2129,7 +2653,7 @@ const MrdImageField = class {
|
|
|
2129
2653
|
hasError ? 'mrd-image-field__zone--error' : '',
|
|
2130
2654
|
this.disabled || this.uploading ? 'mrd-image-field__zone--disabled' : '',
|
|
2131
2655
|
].filter(Boolean).join(' ');
|
|
2132
|
-
return (index.h(index.Host, { key: '
|
|
2656
|
+
return (index.h(index.Host, { key: '97db2df72839f36b7a46e153a5dd1c208c52b522' }, index.h("div", { key: 'c8f2d3d858f90d322d26082aaf5adb57acfc78f4', class: "mrd-image-field" }, this.label && (index.h("label", { key: '6625e5031ff0b7c06f76c1ea0387f1bd5c1858a4', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), index.h("div", { key: '364216e6a96e845e21c42e821fdff02bd2612ff8', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, index.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 ? (index.h("div", { class: "mrd-image-field__preview-container" }, index.h("div", { class: "mrd-image-field__preview-thumb" }, index.h("img", { class: "mrd-image-field__preview", src: this.previewUrl, alt: this.fileName }), this.uploading && index.h("div", { class: "mrd-image-field__preview-overlay" }, index.h("span", { class: "mrd-image-field__spinner" }))), index.h("div", { class: "mrd-image-field__preview-info" }, index.h("span", { class: "mrd-image-field__preview-name" }, this.fileName), this.uploading && (index.h("span", { class: "mrd-image-field__upload-status" }, t('loading', this.locale)))), !this.uploading && (index.h("button", { class: "mrd-image-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, t('remove', this.locale))))) : (index.h("div", { class: "mrd-image-field__prompt" }, index.h("svg", { class: "mrd-image-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, index.h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), index.h("circle", { cx: "8.5", cy: "8.5", r: "1.5" }), index.h("polyline", { points: "21 15 16 10 5 21" })), index.h("span", null, t('drop_file_here', this.locale), ' ', index.h("span", { class: "mrd-image-field__browse" }, t('browse', this.locale)))))), hasError && index.h("span", { key: 'bd505ef4f4b67c4e9138d8825c6e600f583f4cab', class: "mrd-image-field__error" }, this.error))));
|
|
2133
2657
|
}
|
|
2134
2658
|
static get watchers() { return {
|
|
2135
2659
|
"value": [{
|
|
@@ -2243,7 +2767,7 @@ class CellRenderer {
|
|
|
2243
2767
|
}
|
|
2244
2768
|
}
|
|
2245
2769
|
|
|
2246
|
-
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}`;
|
|
2770
|
+
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}`;
|
|
2247
2771
|
|
|
2248
2772
|
const MrdLayoutSection = class {
|
|
2249
2773
|
constructor(hostRef) {
|
|
@@ -2256,6 +2780,9 @@ const MrdLayoutSection = class {
|
|
|
2256
2780
|
this.mrdViewAction = index.createEvent(this, "mrdViewAction");
|
|
2257
2781
|
this.mrdLoadViewAggregations = index.createEvent(this, "mrdLoadViewAggregations");
|
|
2258
2782
|
this.mrdLoadViewDistinct = index.createEvent(this, "mrdLoadViewDistinct");
|
|
2783
|
+
this.mrdUpdateObject = index.createEvent(this, "mrdUpdateObject");
|
|
2784
|
+
this.mrdViewUpload = index.createEvent(this, "mrdViewUpload");
|
|
2785
|
+
this.mrdCreateObject = index.createEvent(this, "mrdCreateObject");
|
|
2259
2786
|
/** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
|
|
2260
2787
|
this.items = [];
|
|
2261
2788
|
/** Record data object; keys are field names, _links holds relation and related-view links. */
|
|
@@ -2273,8 +2800,6 @@ const MrdLayoutSection = class {
|
|
|
2273
2800
|
this.imagePreviewUrl = null;
|
|
2274
2801
|
this.imagePreviews = {};
|
|
2275
2802
|
this.openHistoryField = null;
|
|
2276
|
-
/** Per-view display mode for document collection views. Default 'tree'. */
|
|
2277
|
-
this.docViewMode = {};
|
|
2278
2803
|
this.historyClickOutside = null;
|
|
2279
2804
|
this.searchTimers = {};
|
|
2280
2805
|
this.handleViewLoadPage = (e, name) => {
|
|
@@ -2391,6 +2916,20 @@ const MrdLayoutSection = class {
|
|
|
2391
2916
|
if (list === null || list === void 0 ? void 0 : list.setDistinct)
|
|
2392
2917
|
await list.setDistinct(nodeId, values);
|
|
2393
2918
|
}
|
|
2919
|
+
/** Inject the uploaded file reference for a dropped file, so the document view
|
|
2920
|
+
* can request creation of the new document (see mrdViewUpload). */
|
|
2921
|
+
async setViewFileReference(name, uri) {
|
|
2922
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2923
|
+
if (list === null || list === void 0 ? void 0 : list.setFileReference)
|
|
2924
|
+
await list.setFileReference(uri);
|
|
2925
|
+
}
|
|
2926
|
+
/** Inject the created document's href after a file-drop create, so the
|
|
2927
|
+
* optimistic row becomes navigable (see mrdCreateObject). */
|
|
2928
|
+
async setViewCreatedObject(name, href) {
|
|
2929
|
+
const list = this.el.querySelector(`mrd-document-list[data-doclist="${name}"]`);
|
|
2930
|
+
if (list === null || list === void 0 ? void 0 : list.setCreatedHref)
|
|
2931
|
+
await list.setCreatedHref(href);
|
|
2932
|
+
}
|
|
2394
2933
|
/** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
|
|
2395
2934
|
async setImagePreview(fieldName, url) {
|
|
2396
2935
|
this.imagePreviews = Object.assign(Object.assign({}, this.imagePreviews), { [fieldName]: url });
|
|
@@ -2539,7 +3078,7 @@ const MrdLayoutSection = class {
|
|
|
2539
3078
|
return (index.h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, index.h("div", { class: "mrd-layout-section__search-wrap" }, index.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" }, index.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" })), index.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 && (index.h("ul", { class: "mrd-layout-section__search-results" }, results.map(r => (index.h("li", { key: r.id, class: "mrd-layout-section__search-result" }, index.h("button", { class: "mrd-layout-section__search-result-btn", onClick: () => this.mrdNavigate.emit({ href: r.id, label: r.label }) }, index.h("span", { class: "mrd-layout-section__search-result-label" }, r.label), r.description && index.h("span", { class: "mrd-layout-section__search-result-desc" }, r.description)))))))));
|
|
2540
3079
|
}
|
|
2541
3080
|
renderRelatedView(item) {
|
|
2542
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
3081
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2543
3082
|
const key = this.viewKeyFor(item);
|
|
2544
3083
|
if (!key)
|
|
2545
3084
|
return null;
|
|
@@ -2552,25 +3091,40 @@ const MrdLayoutSection = class {
|
|
|
2552
3091
|
// The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
|
|
2553
3092
|
// (sibling of `view`), not inside `view`.
|
|
2554
3093
|
const docArchetype = index$1.resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, index$1.ARCHETYPE_DOCUMENT);
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
? this.renderDocumentList(item, key, parentId, docArchetype)
|
|
3094
|
+
return (index.h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && index.h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), docArchetype
|
|
3095
|
+
? this.renderDocumentContainer(item, key, parentId, docArchetype)
|
|
2558
3096
|
: this.renderTable(item, key, parentId)));
|
|
2559
3097
|
}
|
|
2560
|
-
/**
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
return (index.h("mrd-document-list", { "data-doclist": key, item: item, archetype: archetype, parentId: parentId, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
3098
|
+
/** Document collection view: owns the view-switch + collection actions and
|
|
3099
|
+
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
3100
|
+
* the host with the view key, exactly as the raw list/table events were. */
|
|
3101
|
+
renderDocumentContainer(item, key, parentId, archetype) {
|
|
3102
|
+
return (index.h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
2566
3103
|
e.stopPropagation();
|
|
2567
3104
|
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
2568
3105
|
}, onMrdLoadPage: (e) => {
|
|
2569
3106
|
e.stopPropagation();
|
|
2570
3107
|
this.mrdLoadViewPage.emit(Object.assign({ name: key }, e.detail));
|
|
3108
|
+
}, onMrdLoadAggregations: (e) => {
|
|
3109
|
+
var _a;
|
|
3110
|
+
e.stopPropagation();
|
|
3111
|
+
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
2571
3112
|
}, onMrdNavigate: (e) => {
|
|
2572
3113
|
e.stopPropagation();
|
|
2573
3114
|
this.mrdNavigate.emit(e.detail);
|
|
3115
|
+
}, onMrdAction: (e) => {
|
|
3116
|
+
var _a;
|
|
3117
|
+
e.stopPropagation();
|
|
3118
|
+
this.mrdViewAction.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
3119
|
+
}, onMrdUpdateObject: (e) => {
|
|
3120
|
+
e.stopPropagation();
|
|
3121
|
+
this.mrdUpdateObject.emit(e.detail);
|
|
3122
|
+
}, onMrdUpload: (e) => {
|
|
3123
|
+
e.stopPropagation();
|
|
3124
|
+
this.mrdViewUpload.emit(Object.assign({ name: key }, e.detail));
|
|
3125
|
+
}, onMrdCreateObject: (e) => {
|
|
3126
|
+
e.stopPropagation();
|
|
3127
|
+
this.mrdCreateObject.emit(Object.assign({ name: key }, e.detail));
|
|
2574
3128
|
} }));
|
|
2575
3129
|
}
|
|
2576
3130
|
renderTable(item, key, parentId) {
|
|
@@ -2641,7 +3195,7 @@ const MrdLayoutSection = class {
|
|
|
2641
3195
|
}
|
|
2642
3196
|
render() {
|
|
2643
3197
|
const docArchetype = index$1.resolveArchetype(this.archetypes, index$1.ARCHETYPE_DOCUMENT);
|
|
2644
|
-
return (index.h(index.Host, { key: '
|
|
3198
|
+
return (index.h(index.Host, { key: '6e737354daec0137b6ebe304efcce9990f02739f' }, index.h("div", { key: '31a73a8a78999793f5dacee5f2da41df5f23156e', class: "mrd-layout-section" }, docArchetype
|
|
2645
3199
|
? this.renderDocumentObject(docArchetype)
|
|
2646
3200
|
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
2647
3201
|
}
|
|
@@ -2783,7 +3337,7 @@ const MrdLongtextField = class {
|
|
|
2783
3337
|
}
|
|
2784
3338
|
render() {
|
|
2785
3339
|
const hasError = !!this.error;
|
|
2786
|
-
return (index.h(index.Host, { key: '
|
|
3340
|
+
return (index.h(index.Host, { key: 'f00f81944748f8f09e22d44befe5e288456b7cc8' }, index.h("div", { key: '7b0ae9cf5b6b684cddb648fe4db6005494322535', class: "mrd-longtext-field" }, this.label && (index.h("label", { key: '3fc6a8710d0e98fe685c45d214a88ae1b0947973', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (index.h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (index.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 && index.h("span", { key: 'e96f1dbc6c00a1602f4ce3c97d514a229aeb7cb7', class: "mrd-longtext-field__error" }, this.error))));
|
|
2787
3341
|
}
|
|
2788
3342
|
};
|
|
2789
3343
|
MrdLongtextField.style = mrdLongtextFieldScss();
|
|
@@ -2859,7 +3413,7 @@ const MrdNumberField = class {
|
|
|
2859
3413
|
const hasError = !!this.error;
|
|
2860
3414
|
const suffix = this.dataType === index$1.ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
|
|
2861
3415
|
this.dataType === index$1.ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
|
|
2862
|
-
return (index.h(index.Host, { key: '
|
|
3416
|
+
return (index.h(index.Host, { key: 'b034a3cc8d841641c0ec167e138904586b044121' }, index.h("div", { key: '7379bfadb8bd0c4e0a945a37013053a4e22477ab', class: "mrd-number-field" }, this.label && (index.h("label", { key: '5518d40b7158e17704633c2b95ac7e3efc0c5568', class: `mrd-number-field__label${this.required ? ' mrd-number-field__label--required' : ''}` }, this.label)), index.h("div", { key: '38ad9f3c945d66c23bd77c743306e916eaefed7f', class: "mrd-number-field__input-wrapper" }, index.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 && index.h("span", { key: '09f5a58b769c81acdf4bdd48f9325934c4bb875d', class: "mrd-number-field__error" }, this.error))));
|
|
2863
3417
|
}
|
|
2864
3418
|
};
|
|
2865
3419
|
MrdNumberField.style = mrdNumberFieldScss();
|
|
@@ -3153,9 +3707,9 @@ const MrdSecretField = class {
|
|
|
3153
3707
|
}
|
|
3154
3708
|
render() {
|
|
3155
3709
|
const hasError = !!this.error;
|
|
3156
|
-
return (index.h(index.Host, { key: '
|
|
3710
|
+
return (index.h(index.Host, { key: 'c850ec5bc5967ca0aefca7d7cb65ecae121a9dc1' }, index.h("div", { key: '3249ffbc441422af054a20806dd8dfce954a8ffc', class: "mrd-secret-field" }, this.label && (index.h("label", { key: '0b4a86da9cafad32f153af1bc5487a4e9b941e2f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
|
|
3157
3711
|
? (index.h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
|
|
3158
|
-
: (index.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 && index.h("span", { key: '
|
|
3712
|
+
: (index.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 && index.h("span", { key: 'b0d0105f3d43d2e214f070b24e745dbce0e33977', class: "mrd-secret-field__error" }, this.error))));
|
|
3159
3713
|
}
|
|
3160
3714
|
};
|
|
3161
3715
|
MrdSecretField.style = mrdSecretFieldScss();
|
|
@@ -4302,7 +4856,7 @@ const MrdTextField = class {
|
|
|
4302
4856
|
}
|
|
4303
4857
|
render() {
|
|
4304
4858
|
const hasError = !!this.error;
|
|
4305
|
-
return (index.h(index.Host, { key: '
|
|
4859
|
+
return (index.h(index.Host, { key: 'e9252b251faf98ab190e643b97c13fa32d12ef22' }, index.h("div", { key: '37f4259a111c293f2fe12f321f08c00c25e77feb', class: "mrd-text-field" }, this.label && (index.h("label", { key: 'c59e0346fb71a765ea38629b03c06341567ed210', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), index.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 && index.h("span", { key: '037653857a372854a16b28ebf8994b23e3e0d696', class: "mrd-text-field__error" }, this.error))));
|
|
4306
4860
|
}
|
|
4307
4861
|
};
|
|
4308
4862
|
MrdTextField.style = mrdTextFieldScss();
|
|
@@ -4376,7 +4930,7 @@ const MrdTextareaField = class {
|
|
|
4376
4930
|
}
|
|
4377
4931
|
}
|
|
4378
4932
|
render() {
|
|
4379
|
-
return (index.h(index.Host, { key: '
|
|
4933
|
+
return (index.h(index.Host, { key: 'fe7824c81e082c3f2c1cf18c11dde20cb1f40f2c' }, index.h("div", { key: 'adf394a7e146d16bc79006873a209b11d88b2e17', class: "mrd-textarea-field" }, this.label && (index.h("label", { key: '1b0dd2b4cf26c55a0af05c67a3178edc0c9d56c4', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), index.h("div", { key: '7c8fe88b222af0beed08db492aa9f6d890e0dc5b', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, index.h("div", { key: '295968283e94812cb04660117c5bdeaf3647469c', class: "mrd-textarea-field__editor" })), this.error && index.h("span", { key: '5b5ab61053ab0792d4c249de04bd1d13b51469bf', class: "mrd-textarea-field__error" }, this.error))));
|
|
4380
4934
|
}
|
|
4381
4935
|
get el() { return index.getElement(this); }
|
|
4382
4936
|
};
|
|
@@ -4413,7 +4967,7 @@ const MrdTimeField = class {
|
|
|
4413
4967
|
}
|
|
4414
4968
|
render() {
|
|
4415
4969
|
const hasError = !!this.error;
|
|
4416
|
-
return (index.h(index.Host, { key: '
|
|
4970
|
+
return (index.h(index.Host, { key: '579219a478e31325b5a676465807c1d936724a2b' }, index.h("div", { key: '51b25f6e083a29989505c0ad79edbcd3b0060736', class: "mrd-time-field" }, this.label && (index.h("label", { key: '67d98bebb8803deea2d2a4a63f36706789ccd8c7', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), index.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 && index.h("span", { key: '0dbd168d14966dc56a77c97cd8fd8f9b208a4bf5', class: "mrd-time-field__error" }, this.error))));
|
|
4417
4971
|
}
|
|
4418
4972
|
};
|
|
4419
4973
|
MrdTimeField.style = mrdTimeFieldScss();
|
|
@@ -4422,6 +4976,7 @@ exports.mrd_boolean_field = MrdBooleanField;
|
|
|
4422
4976
|
exports.mrd_currency_field = MrdCurrencyField;
|
|
4423
4977
|
exports.mrd_date_field = MrdDateField;
|
|
4424
4978
|
exports.mrd_datetime_field = MrdDatetimeField;
|
|
4979
|
+
exports.mrd_document_container = MrdDocumentContainer;
|
|
4425
4980
|
exports.mrd_document_list = MrdDocumentList;
|
|
4426
4981
|
exports.mrd_document_view = MrdDocumentView;
|
|
4427
4982
|
exports.mrd_email_field = MrdEmailField;
|