@mmlogic/components 0.4.2 → 0.4.3
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/mrd-boolean-field_24.cjs.entry.js +34 -18
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +11 -4
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +28 -11
- package/dist/collection/components/documents/mrd-document-list/tree-view.js +1 -1
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +11 -4
- package/dist/collection/components/table/mrd-table/mrd-table.js +19 -5
- package/dist/collection/dev/app.js +4 -3
- package/dist/collection/utils/query-params.js +0 -4
- package/dist/components/mrd-document-container2.js +1 -1
- package/dist/components/mrd-document-list2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/mrd-boolean-field_24.entry.js +34 -18
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-e816d459.entry.js +1 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +2 -0
- package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +8 -1
- package/dist/types/components/documents/mrd-document-list/tree-view.d.ts +1 -1
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +2 -0
- package/dist/types/components/table/mrd-table/mrd-table.d.ts +8 -2
- package/dist/types/components.d.ts +12 -10
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/query-params.d.ts +14 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/cell-renderer-PbcEU4ph.js.map +0 -1
- package/dist/mosterdcomponents/client-layout-DCOAAH92.js.map +0 -1
- package/dist/mosterdcomponents/field-helpers-CASS3akr.js.map +0 -1
- package/dist/mosterdcomponents/file-upload-common-D1ndi6cN.js.map +0 -1
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
- package/dist/mosterdcomponents/i18n-B1IIkRF9.js.map +0 -1
- package/dist/mosterdcomponents/index-AokUFVX0.js.map +0 -1
- package/dist/mosterdcomponents/index-CprJSlzK.js.map +0 -1
- package/dist/mosterdcomponents/index.esm.js.map +0 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
- package/dist/mosterdcomponents/p-aae8a9dc.entry.js +0 -1
- package/dist/mosterdcomponents/query-params-B1HfnMOl.js.map +0 -1
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
- package/dist/mosterdcomponents/validation-DbEViuiw.js.map +0 -1
|
@@ -1008,11 +1008,12 @@ const MrdDocumentContainer = class {
|
|
|
1008
1008
|
}, onMrdRowClick: (e) => {
|
|
1009
1009
|
var _a, _b, _c;
|
|
1010
1010
|
e.stopPropagation();
|
|
1011
|
-
const row = e.detail;
|
|
1011
|
+
const { row, listContext } = e.detail;
|
|
1012
1012
|
this.mrdNavigate.emit({
|
|
1013
1013
|
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,
|
|
1014
1014
|
label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '',
|
|
1015
1015
|
navigateBehaviour: index$1.ClientLayoutNavigateBehaviour.OVERLAY_PAGE,
|
|
1016
|
+
listContext,
|
|
1016
1017
|
});
|
|
1017
1018
|
}, onMrdAction: (e) => {
|
|
1018
1019
|
e.stopPropagation();
|
|
@@ -1021,7 +1022,7 @@ const MrdDocumentContainer = class {
|
|
|
1021
1022
|
}
|
|
1022
1023
|
render() {
|
|
1023
1024
|
const treeMode = this.mode === 'tree';
|
|
1024
|
-
return (index.h(index.Host, { key: '
|
|
1025
|
+
return (index.h(index.Host, { key: '7d0523d66f9a3d189dcc5517cd7281a57456977d' }, this.renderToolbar(), index.h("div", { key: '19b0f416d2ad1b093afd6f799670debf8c18b225', class: {
|
|
1025
1026
|
'mrd-document-container__body': true,
|
|
1026
1027
|
'mrd-document-container__body--tree': treeMode,
|
|
1027
1028
|
}, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
|
|
@@ -1030,10 +1031,6 @@ const MrdDocumentContainer = class {
|
|
|
1030
1031
|
};
|
|
1031
1032
|
MrdDocumentContainer.style = mrdDocumentContainerCss();
|
|
1032
1033
|
|
|
1033
|
-
/**
|
|
1034
|
-
* Shared path/query-param conventions for list requests,
|
|
1035
|
-
* used by mrd-table and mrd-document-list.
|
|
1036
|
-
*/
|
|
1037
1034
|
/** Applies the view-level static filters to `params` using the API operator conventions. */
|
|
1038
1035
|
function applyViewFilters(params, filters) {
|
|
1039
1036
|
var _a, _b, _c;
|
|
@@ -1222,7 +1219,7 @@ function renderDocRow(ctx, doc, node, container, depth) {
|
|
|
1222
1219
|
const label = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc[ctx.titleField]) !== null && _a !== void 0 ? _a : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _b !== void 0 ? _b : '';
|
|
1223
1220
|
const dateRaw = ctx.dateField ? doc === null || doc === void 0 ? void 0 : doc[ctx.dateField] : undefined;
|
|
1224
1221
|
const date = dateRaw ? formatDate(dateRaw, ctx.locale) : '';
|
|
1225
|
-
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: () => ctx.on.openDoc(doc), onDragStart: (e) => ctx.on.docDragStart(e, doc, node), onDragEnd: ctx.on.docDragEnd, onDragOver: (e) => ctx.on.nodeDragOver(e, node), onDragLeave: () => ctx.on.nodeDragLeave(node), onDrop: (e) => ctx.on.nodeDrop(e, node, container) }, indent(depth), chevron(false, true), docIcon(), index.h("span", { class: "mrd-document-list__label" }, label), date && index.h("span", { class: "mrd-document-list__date" }, date)));
|
|
1222
|
+
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: () => ctx.on.openDoc(doc, node, container), onDragStart: (e) => ctx.on.docDragStart(e, doc, node), onDragEnd: ctx.on.docDragEnd, onDragOver: (e) => ctx.on.nodeDragOver(e, node), onDragLeave: () => ctx.on.nodeDragLeave(node), onDrop: (e) => ctx.on.nodeDrop(e, node, container) }, indent(depth), chevron(false, true), docIcon(), index.h("span", { class: "mrd-document-list__label" }, label), date && index.h("span", { class: "mrd-document-list__date" }, date)));
|
|
1226
1223
|
}
|
|
1227
1224
|
function renderFolderEditRow(ctx, node, depth) {
|
|
1228
1225
|
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" }, indent(depth), chevron(false, true), folderIcon(), index.h("input", { class: "mrd-document-list__name-input", type: "text", placeholder: t('folder_name_placeholder', ctx.locale), ref: el => ctx.on.setPendingInputEl(el), onInput: ctx.on.pendingInput, onKeyDown: ctx.on.pendingKeyDown, onBlur: () => ctx.on.cancelFolder() })), node.error && (index.h("div", { class: "mrd-document-list__error", style: { paddingLeft: `${labelOffset(depth)}px` } }, node.error))));
|
|
@@ -1578,18 +1575,24 @@ const MrdDocumentList = class {
|
|
|
1578
1575
|
qs: p.toString(),
|
|
1579
1576
|
});
|
|
1580
1577
|
}
|
|
1581
|
-
|
|
1578
|
+
/** Filter qs scoping a folder's documents: view-level filters + container/folder match.
|
|
1579
|
+
* Shared by emitDocuments() (the fetch) and openDoc() (prev/next list context), so both
|
|
1580
|
+
* always agree on exactly what query a document belongs to. */
|
|
1581
|
+
buildDocQs(container, node) {
|
|
1582
1582
|
var _a, _b;
|
|
1583
1583
|
const p = this.baseParams();
|
|
1584
1584
|
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
1585
1585
|
p.set(this.folderField, (_b = node.fullPath) !== null && _b !== void 0 ? _b : '');
|
|
1586
|
+
return p.toString();
|
|
1587
|
+
}
|
|
1588
|
+
emitDocuments(container, node) {
|
|
1586
1589
|
node.loading = true;
|
|
1587
1590
|
this.mrdLoadPage.emit({
|
|
1588
1591
|
nodeId: node.id,
|
|
1589
1592
|
page: 0,
|
|
1590
1593
|
sort: '',
|
|
1591
1594
|
path: this.buildDataPath(),
|
|
1592
|
-
qs:
|
|
1595
|
+
qs: this.buildDocQs(container, node),
|
|
1593
1596
|
});
|
|
1594
1597
|
}
|
|
1595
1598
|
// ── Public injection API ─────────────────────────────────────────────────
|
|
@@ -1858,11 +1861,15 @@ const MrdDocumentList = class {
|
|
|
1858
1861
|
container.totalCount = Math.max(0, container.totalCount + delta);
|
|
1859
1862
|
}
|
|
1860
1863
|
}
|
|
1861
|
-
openDoc(doc) {
|
|
1864
|
+
openDoc(doc, node, container) {
|
|
1862
1865
|
var _a, _b, _c, _d;
|
|
1863
1866
|
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;
|
|
1864
1867
|
const label = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc[this.titleField]) !== null && _c !== void 0 ? _c : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _d !== void 0 ? _d : '';
|
|
1865
|
-
|
|
1868
|
+
const index = node.docs.indexOf(doc);
|
|
1869
|
+
const listContext = index >= 0
|
|
1870
|
+
? { index, sort: '', path: this.buildDataPath(), qs: this.buildDocQs(container, node) }
|
|
1871
|
+
: undefined;
|
|
1872
|
+
this.mrdNavigate.emit({ href, label, listContext });
|
|
1866
1873
|
}
|
|
1867
1874
|
// ── Render ───────────────────────────────────────────────────────────────
|
|
1868
1875
|
treeCtx() {
|
|
@@ -1876,7 +1883,7 @@ const MrdDocumentList = class {
|
|
|
1876
1883
|
on: {
|
|
1877
1884
|
toggleContainer: node => this.toggleContainer(node),
|
|
1878
1885
|
toggleFolder: (container, node) => this.toggleFolder(container, node),
|
|
1879
|
-
openDoc: doc => this.openDoc(doc),
|
|
1886
|
+
openDoc: (doc, node, container) => this.openDoc(doc, node, container),
|
|
1880
1887
|
docDragStart: this.onDocDragStart,
|
|
1881
1888
|
docDragEnd: this.onDocDragEnd,
|
|
1882
1889
|
nodeDragOver: this.onNodeDragOver,
|
|
@@ -1896,7 +1903,7 @@ const MrdDocumentList = class {
|
|
|
1896
1903
|
body = renderLoadingRow(ctx, 0);
|
|
1897
1904
|
}
|
|
1898
1905
|
else if (this.containers.length === 0) {
|
|
1899
|
-
body = index.h("div", { key: '
|
|
1906
|
+
body = index.h("div", { key: '49157721108db3b03c8c5e6550692b42dfc2e113', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
1900
1907
|
}
|
|
1901
1908
|
else if (this.singleContainer) {
|
|
1902
1909
|
// Dossier context: render the single container's folder tree at the root.
|
|
@@ -1914,7 +1921,7 @@ const MrdDocumentList = class {
|
|
|
1914
1921
|
else {
|
|
1915
1922
|
body = this.containers.map(c => renderContainerNode(ctx, c, 0));
|
|
1916
1923
|
}
|
|
1917
|
-
return (index.h(index.Host, { key: '
|
|
1924
|
+
return (index.h(index.Host, { key: 'b6d3dd44036a9215979a0dbec699902f308fbeb5' }, index.h("div", { key: '8ec0e58cb5e7192f7a9af9062dd5bc7f7bb00713', class: 'mrd-document-list' + (this.rootDropActive ? ' mrd-document-list--drop-active' : ''), onDragOver: this.onRootDragOver, onDragLeave: this.onRootDragLeave, onDrop: this.onRootDrop }, body)));
|
|
1918
1925
|
}
|
|
1919
1926
|
get el() { return index.getElement(this); }
|
|
1920
1927
|
};
|
|
@@ -3515,11 +3522,12 @@ const MrdLayoutSection = class {
|
|
|
3515
3522
|
}, onMrdRowClick: (e) => {
|
|
3516
3523
|
var _a, _b, _c, _d;
|
|
3517
3524
|
e.stopPropagation();
|
|
3518
|
-
const row = e.detail;
|
|
3525
|
+
const { row, listContext } = e.detail;
|
|
3519
3526
|
this.mrdNavigate.emit({
|
|
3520
3527
|
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,
|
|
3521
3528
|
label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '',
|
|
3522
3529
|
navigateBehaviour: (_d = item.navigateBehaviour) !== null && _d !== void 0 ? _d : index$1.ClientLayoutNavigateBehaviour.PAGE,
|
|
3530
|
+
listContext,
|
|
3523
3531
|
});
|
|
3524
3532
|
}, onMrdAction: (e) => {
|
|
3525
3533
|
var _a;
|
|
@@ -3580,7 +3588,7 @@ const MrdLayoutSection = class {
|
|
|
3580
3588
|
}
|
|
3581
3589
|
render() {
|
|
3582
3590
|
const docArchetype = index$1.resolveArchetype(this.archetypes, index$1.ARCHETYPE_DOCUMENT);
|
|
3583
|
-
return (index.h(index.Host, { key: '
|
|
3591
|
+
return (index.h(index.Host, { key: '9b79e194ab3fc37bd9e97e69d06df37a5f26dfab' }, index.h("div", { key: '15db5e082ccfbe4b0b5b75e11a4eaac117c5d577', class: "mrd-layout-section" }, docArchetype
|
|
3584
3592
|
? this.renderDocumentObject(docArchetype)
|
|
3585
3593
|
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
3586
3594
|
}
|
|
@@ -5291,7 +5299,7 @@ const MrdTable = class {
|
|
|
5291
5299
|
this.filterMode ? 'mrd-table__header--sortable' : '',
|
|
5292
5300
|
].filter(Boolean).join(' ');
|
|
5293
5301
|
return (index.h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, index.h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isFiltered && index.h(FilterIcon, null)));
|
|
5294
|
-
}))), index.h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (index.h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(row) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (index.h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal(), this.renderJsonModal()));
|
|
5302
|
+
}))), index.h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (index.h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit({ row }) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (index.h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal(), this.renderJsonModal()));
|
|
5295
5303
|
}
|
|
5296
5304
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
5297
5305
|
// Derive the authoritative row count from loaded pages:
|
|
@@ -5320,7 +5328,15 @@ const MrdTable = class {
|
|
|
5320
5328
|
}
|
|
5321
5329
|
}
|
|
5322
5330
|
else {
|
|
5323
|
-
renderedRows.push(index.h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(
|
|
5331
|
+
renderedRows.push(index.h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit({
|
|
5332
|
+
row,
|
|
5333
|
+
listContext: {
|
|
5334
|
+
index: i,
|
|
5335
|
+
sort: this.sortParam(),
|
|
5336
|
+
path: this.buildDataPath(),
|
|
5337
|
+
qs: this.buildQueryParams(0),
|
|
5338
|
+
},
|
|
5339
|
+
}) }, this.columns.map(col => this.renderCell(col, row))));
|
|
5324
5340
|
}
|
|
5325
5341
|
}
|
|
5326
5342
|
return (index.h(index.Host, null, this.renderToolbar(), index.h("div", { class: "mrd-table__scroll", style: { height: `${this.tableHeight}px` }, onScroll: this.handleScroll }, index.h("table", { class: "mrd-table__table", style: tableStyle }, index.h("thead", null, index.h("tr", null, this.columns.map((col, idx) => {
|
package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js
CHANGED
|
@@ -98,11 +98,12 @@ export class MrdDocumentContainer {
|
|
|
98
98
|
}, onMrdRowClick: (e) => {
|
|
99
99
|
var _a, _b, _c;
|
|
100
100
|
e.stopPropagation();
|
|
101
|
-
const row = e.detail;
|
|
101
|
+
const { row, listContext } = e.detail;
|
|
102
102
|
this.mrdNavigate.emit({
|
|
103
103
|
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,
|
|
104
104
|
label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '',
|
|
105
105
|
navigateBehaviour: ClientLayoutNavigateBehaviour.OVERLAY_PAGE,
|
|
106
|
+
listContext,
|
|
106
107
|
});
|
|
107
108
|
}, onMrdAction: (e) => {
|
|
108
109
|
e.stopPropagation();
|
|
@@ -111,7 +112,7 @@ export class MrdDocumentContainer {
|
|
|
111
112
|
}
|
|
112
113
|
render() {
|
|
113
114
|
const treeMode = this.mode === 'tree';
|
|
114
|
-
return (h(Host, { key: '
|
|
115
|
+
return (h(Host, { key: '7d0523d66f9a3d189dcc5517cd7281a57456977d' }, this.renderToolbar(), h("div", { key: '19b0f416d2ad1b093afd6f799670debf8c18b225', class: {
|
|
115
116
|
'mrd-document-container__body': true,
|
|
116
117
|
'mrd-document-container__body--tree': treeMode,
|
|
117
118
|
}, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
|
|
@@ -344,14 +345,20 @@ export class MrdDocumentContainer {
|
|
|
344
345
|
"text": "A row / document was activated. Host routes to the object page. Documents\nare always the \"quick look\" use case, so navigateBehaviour is hardcoded\nto OVERLAY_PAGE here \u2014 unlike the generic VIEW/RELATED_VIEW table path in\nmrd-layout-section, which takes it from the item's configuration."
|
|
345
346
|
},
|
|
346
347
|
"complexType": {
|
|
347
|
-
"original": "{ href?: string; label: string; navigateBehaviour?: ClientLayoutNavigateBehaviour }",
|
|
348
|
-
"resolved": "{ href?: string | undefined; label: string; navigateBehaviour?: ClientLayoutNavigateBehaviour | undefined; }",
|
|
348
|
+
"original": "{ href?: string; label: string; navigateBehaviour?: ClientLayoutNavigateBehaviour; listContext?: ListNavigationContext }",
|
|
349
|
+
"resolved": "{ href?: string | undefined; label: string; navigateBehaviour?: ClientLayoutNavigateBehaviour | undefined; listContext?: ListNavigationContext | undefined; }",
|
|
349
350
|
"references": {
|
|
350
351
|
"ClientLayoutNavigateBehaviour": {
|
|
351
352
|
"location": "import",
|
|
352
353
|
"path": "../../../types/client-layout",
|
|
353
354
|
"id": "src/types/client-layout.ts::ClientLayoutNavigateBehaviour",
|
|
354
355
|
"referenceLocation": "ClientLayoutNavigateBehaviour"
|
|
356
|
+
},
|
|
357
|
+
"ListNavigationContext": {
|
|
358
|
+
"location": "import",
|
|
359
|
+
"path": "../../../utils/query-params",
|
|
360
|
+
"id": "src/utils/query-params.ts::ListNavigationContext",
|
|
361
|
+
"referenceLocation": "ListNavigationContext"
|
|
355
362
|
}
|
|
356
363
|
}
|
|
357
364
|
}
|
|
@@ -320,18 +320,24 @@ export class MrdDocumentList {
|
|
|
320
320
|
qs: p.toString(),
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
|
-
|
|
323
|
+
/** Filter qs scoping a folder's documents: view-level filters + container/folder match.
|
|
324
|
+
* Shared by emitDocuments() (the fetch) and openDoc() (prev/next list context), so both
|
|
325
|
+
* always agree on exactly what query a document belongs to. */
|
|
326
|
+
buildDocQs(container, node) {
|
|
324
327
|
var _a, _b;
|
|
325
328
|
const p = this.baseParams();
|
|
326
329
|
p.set(this.containerField + '_href', (_a = container.href) !== null && _a !== void 0 ? _a : '');
|
|
327
330
|
p.set(this.folderField, (_b = node.fullPath) !== null && _b !== void 0 ? _b : '');
|
|
331
|
+
return p.toString();
|
|
332
|
+
}
|
|
333
|
+
emitDocuments(container, node) {
|
|
328
334
|
node.loading = true;
|
|
329
335
|
this.mrdLoadPage.emit({
|
|
330
336
|
nodeId: node.id,
|
|
331
337
|
page: 0,
|
|
332
338
|
sort: '',
|
|
333
339
|
path: this.buildDataPath(),
|
|
334
|
-
qs:
|
|
340
|
+
qs: this.buildDocQs(container, node),
|
|
335
341
|
});
|
|
336
342
|
}
|
|
337
343
|
// ── Public injection API ─────────────────────────────────────────────────
|
|
@@ -600,11 +606,15 @@ export class MrdDocumentList {
|
|
|
600
606
|
container.totalCount = Math.max(0, container.totalCount + delta);
|
|
601
607
|
}
|
|
602
608
|
}
|
|
603
|
-
openDoc(doc) {
|
|
609
|
+
openDoc(doc, node, container) {
|
|
604
610
|
var _a, _b, _c, _d;
|
|
605
611
|
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;
|
|
606
612
|
const label = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc[this.titleField]) !== null && _c !== void 0 ? _c : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _d !== void 0 ? _d : '';
|
|
607
|
-
|
|
613
|
+
const index = node.docs.indexOf(doc);
|
|
614
|
+
const listContext = index >= 0
|
|
615
|
+
? { index, sort: '', path: this.buildDataPath(), qs: this.buildDocQs(container, node) }
|
|
616
|
+
: undefined;
|
|
617
|
+
this.mrdNavigate.emit({ href, label, listContext });
|
|
608
618
|
}
|
|
609
619
|
// ── Render ───────────────────────────────────────────────────────────────
|
|
610
620
|
treeCtx() {
|
|
@@ -618,7 +628,7 @@ export class MrdDocumentList {
|
|
|
618
628
|
on: {
|
|
619
629
|
toggleContainer: node => this.toggleContainer(node),
|
|
620
630
|
toggleFolder: (container, node) => this.toggleFolder(container, node),
|
|
621
|
-
openDoc: doc => this.openDoc(doc),
|
|
631
|
+
openDoc: (doc, node, container) => this.openDoc(doc, node, container),
|
|
622
632
|
docDragStart: this.onDocDragStart,
|
|
623
633
|
docDragEnd: this.onDocDragEnd,
|
|
624
634
|
nodeDragOver: this.onNodeDragOver,
|
|
@@ -638,7 +648,7 @@ export class MrdDocumentList {
|
|
|
638
648
|
body = renderLoadingRow(ctx, 0);
|
|
639
649
|
}
|
|
640
650
|
else if (this.containers.length === 0) {
|
|
641
|
-
body = h("div", { key: '
|
|
651
|
+
body = h("div", { key: '49157721108db3b03c8c5e6550692b42dfc2e113', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
642
652
|
}
|
|
643
653
|
else if (this.singleContainer) {
|
|
644
654
|
// Dossier context: render the single container's folder tree at the root.
|
|
@@ -656,7 +666,7 @@ export class MrdDocumentList {
|
|
|
656
666
|
else {
|
|
657
667
|
body = this.containers.map(c => renderContainerNode(ctx, c, 0));
|
|
658
668
|
}
|
|
659
|
-
return (h(Host, { key: '
|
|
669
|
+
return (h(Host, { key: 'b6d3dd44036a9215979a0dbec699902f308fbeb5' }, h("div", { key: '8ec0e58cb5e7192f7a9af9062dd5bc7f7bb00713', class: 'mrd-document-list' + (this.rootDropActive ? ' mrd-document-list--drop-active' : ''), onDragOver: this.onRootDragOver, onDragLeave: this.onRootDragLeave, onDrop: this.onRootDrop }, body)));
|
|
660
670
|
}
|
|
661
671
|
static get is() { return "mrd-document-list"; }
|
|
662
672
|
static get encapsulation() { return "scoped"; }
|
|
@@ -833,12 +843,19 @@ export class MrdDocumentList {
|
|
|
833
843
|
"composed": true,
|
|
834
844
|
"docs": {
|
|
835
845
|
"tags": [],
|
|
836
|
-
"text": "A document row was clicked. Host routes to the document object page."
|
|
846
|
+
"text": "A document row was clicked. Host routes to the document object page. `listContext` can\nbe used to re-fetch this exact record (or its neighbours) via `{path}?{qs}&page={index}&size=1`."
|
|
837
847
|
},
|
|
838
848
|
"complexType": {
|
|
839
|
-
"original": "{ href?: string; label: string }",
|
|
840
|
-
"resolved": "{ href?: string | undefined; label: string; }",
|
|
841
|
-
"references": {
|
|
849
|
+
"original": "{ href?: string; label: string; listContext?: ListNavigationContext }",
|
|
850
|
+
"resolved": "{ href?: string | undefined; label: string; listContext?: ListNavigationContext | undefined; }",
|
|
851
|
+
"references": {
|
|
852
|
+
"ListNavigationContext": {
|
|
853
|
+
"location": "import",
|
|
854
|
+
"path": "../../../utils/query-params",
|
|
855
|
+
"id": "src/utils/query-params.ts::ListNavigationContext",
|
|
856
|
+
"referenceLocation": "ListNavigationContext"
|
|
857
|
+
}
|
|
858
|
+
}
|
|
842
859
|
}
|
|
843
860
|
}, {
|
|
844
861
|
"method": "mrdCanCreate",
|
|
@@ -39,7 +39,7 @@ function renderDocRow(ctx, doc, node, container, depth) {
|
|
|
39
39
|
const label = (_b = (_a = doc === null || doc === void 0 ? void 0 : doc[ctx.titleField]) !== null && _a !== void 0 ? _a : doc === null || doc === void 0 ? void 0 : doc.name) !== null && _b !== void 0 ? _b : '';
|
|
40
40
|
const dateRaw = ctx.dateField ? doc === null || doc === void 0 ? void 0 : doc[ctx.dateField] : undefined;
|
|
41
41
|
const date = dateRaw ? formatDate(dateRaw, ctx.locale) : '';
|
|
42
|
-
return (h("div", { class: "mrd-document-list__row mrd-document-list__row--doc", key: (_e = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : label, draggable: true, onClick: () => ctx.on.openDoc(doc), onDragStart: (e) => ctx.on.docDragStart(e, doc, node), onDragEnd: ctx.on.docDragEnd, onDragOver: (e) => ctx.on.nodeDragOver(e, node), onDragLeave: () => ctx.on.nodeDragLeave(node), onDrop: (e) => ctx.on.nodeDrop(e, node, container) }, indent(depth), chevron(false, true), docIcon(), h("span", { class: "mrd-document-list__label" }, label), date && h("span", { class: "mrd-document-list__date" }, date)));
|
|
42
|
+
return (h("div", { class: "mrd-document-list__row mrd-document-list__row--doc", key: (_e = (_d = (_c = doc === null || doc === void 0 ? void 0 : doc._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : label, draggable: true, onClick: () => ctx.on.openDoc(doc, node, container), onDragStart: (e) => ctx.on.docDragStart(e, doc, node), onDragEnd: ctx.on.docDragEnd, onDragOver: (e) => ctx.on.nodeDragOver(e, node), onDragLeave: () => ctx.on.nodeDragLeave(node), onDrop: (e) => ctx.on.nodeDrop(e, node, container) }, indent(depth), chevron(false, true), docIcon(), h("span", { class: "mrd-document-list__label" }, label), date && h("span", { class: "mrd-document-list__date" }, date)));
|
|
43
43
|
}
|
|
44
44
|
function renderFolderEditRow(ctx, node, depth) {
|
|
45
45
|
return (h("div", { class: "mrd-document-list__node", key: node.id }, h("div", { class: "mrd-document-list__row mrd-document-list__row--edit" }, indent(depth), chevron(false, true), folderIcon(), h("input", { class: "mrd-document-list__name-input", type: "text", placeholder: t('folder_name_placeholder', ctx.locale), ref: el => ctx.on.setPendingInputEl(el), onInput: ctx.on.pendingInput, onKeyDown: ctx.on.pendingKeyDown, onBlur: () => ctx.on.cancelFolder() })), node.error && (h("div", { class: "mrd-document-list__error", style: { paddingLeft: `${labelOffset(depth)}px` } }, node.error))));
|
|
@@ -273,11 +273,12 @@ export class MrdLayoutSection {
|
|
|
273
273
|
}, onMrdRowClick: (e) => {
|
|
274
274
|
var _a, _b, _c, _d;
|
|
275
275
|
e.stopPropagation();
|
|
276
|
-
const row = e.detail;
|
|
276
|
+
const { row, listContext } = e.detail;
|
|
277
277
|
this.mrdNavigate.emit({
|
|
278
278
|
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,
|
|
279
279
|
label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '',
|
|
280
280
|
navigateBehaviour: (_d = item.navigateBehaviour) !== null && _d !== void 0 ? _d : ClientLayoutNavigateBehaviour.PAGE,
|
|
281
|
+
listContext,
|
|
281
282
|
});
|
|
282
283
|
}, onMrdAction: (e) => {
|
|
283
284
|
var _a;
|
|
@@ -338,7 +339,7 @@ export class MrdLayoutSection {
|
|
|
338
339
|
}
|
|
339
340
|
render() {
|
|
340
341
|
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
341
|
-
return (h(Host, { key: '
|
|
342
|
+
return (h(Host, { key: '9b79e194ab3fc37bd9e97e69d06df37a5f26dfab' }, h("div", { key: '15db5e082ccfbe4b0b5b75e11a4eaac117c5d577', class: "mrd-layout-section" }, docArchetype
|
|
342
343
|
? this.renderDocumentObject(docArchetype)
|
|
343
344
|
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
344
345
|
}
|
|
@@ -545,8 +546,8 @@ export class MrdLayoutSection {
|
|
|
545
546
|
"text": ""
|
|
546
547
|
},
|
|
547
548
|
"complexType": {
|
|
548
|
-
"original": "{ href?: string; label: string; navigate?: ClientLayoutItemNavigate; navigateBehaviour?: ClientLayoutNavigateBehaviour }",
|
|
549
|
-
"resolved": "{ href?: string | undefined; label: string; navigate?: ClientLayoutItemNavigate | undefined; navigateBehaviour?: ClientLayoutNavigateBehaviour | undefined; }",
|
|
549
|
+
"original": "{ href?: string; label: string; navigate?: ClientLayoutItemNavigate; navigateBehaviour?: ClientLayoutNavigateBehaviour; listContext?: ListNavigationContext }",
|
|
550
|
+
"resolved": "{ href?: string | undefined; label: string; navigate?: ClientLayoutItemNavigate | undefined; navigateBehaviour?: ClientLayoutNavigateBehaviour | undefined; listContext?: ListNavigationContext | undefined; }",
|
|
550
551
|
"references": {
|
|
551
552
|
"ClientLayoutItemNavigate": {
|
|
552
553
|
"location": "import",
|
|
@@ -559,6 +560,12 @@ export class MrdLayoutSection {
|
|
|
559
560
|
"path": "../../../types/client-layout",
|
|
560
561
|
"id": "src/types/client-layout.ts::ClientLayoutNavigateBehaviour",
|
|
561
562
|
"referenceLocation": "ClientLayoutNavigateBehaviour"
|
|
563
|
+
},
|
|
564
|
+
"ListNavigationContext": {
|
|
565
|
+
"location": "import",
|
|
566
|
+
"path": "../../../utils/query-params",
|
|
567
|
+
"id": "src/utils/query-params.ts::ListNavigationContext",
|
|
568
|
+
"referenceLocation": "ListNavigationContext"
|
|
562
569
|
}
|
|
563
570
|
}
|
|
564
571
|
}
|
|
@@ -794,7 +794,7 @@ export class MrdTable {
|
|
|
794
794
|
this.filterMode ? 'mrd-table__header--sortable' : '',
|
|
795
795
|
].filter(Boolean).join(' ');
|
|
796
796
|
return (h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isFiltered && h(FilterIcon, null)));
|
|
797
|
-
}))), h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(row) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal(), this.renderJsonModal()));
|
|
797
|
+
}))), h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit({ row }) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal(), this.renderJsonModal()));
|
|
798
798
|
}
|
|
799
799
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
800
800
|
// Derive the authoritative row count from loaded pages:
|
|
@@ -823,7 +823,15 @@ export class MrdTable {
|
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
825
|
else {
|
|
826
|
-
renderedRows.push(h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(
|
|
826
|
+
renderedRows.push(h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit({
|
|
827
|
+
row,
|
|
828
|
+
listContext: {
|
|
829
|
+
index: i,
|
|
830
|
+
sort: this.sortParam(),
|
|
831
|
+
path: this.buildDataPath(),
|
|
832
|
+
qs: this.buildQueryParams(0),
|
|
833
|
+
},
|
|
834
|
+
}) }, this.columns.map(col => this.renderCell(col, row))));
|
|
827
835
|
}
|
|
828
836
|
}
|
|
829
837
|
return (h(Host, null, this.renderToolbar(), h("div", { class: "mrd-table__scroll", style: { height: `${this.tableHeight}px` }, onScroll: this.handleScroll }, h("table", { class: "mrd-table__table", style: tableStyle }, h("thead", null, h("tr", null, this.columns.map((col, idx) => {
|
|
@@ -1116,15 +1124,21 @@ export class MrdTable {
|
|
|
1116
1124
|
"composed": true,
|
|
1117
1125
|
"docs": {
|
|
1118
1126
|
"tags": [],
|
|
1119
|
-
"text": "Fired when a data row is clicked.
|
|
1127
|
+
"text": "Fired when a data row is clicked. `listContext` is included in paginated mode and can\nbe used to re-fetch this exact record (or its neighbours) via `{path}?{qs}&page={index}&size=1`\n\u2014 omitted in non-paginated (`rows` prop) mode since the host already holds the full array."
|
|
1120
1128
|
},
|
|
1121
1129
|
"complexType": {
|
|
1122
|
-
"original": "Record<string, any
|
|
1123
|
-
"resolved": "any |
|
|
1130
|
+
"original": "{ row: Record<string, any>; listContext?: ListNavigationContext }",
|
|
1131
|
+
"resolved": "{ row: Record<string, any>; listContext?: ListNavigationContext | undefined; }",
|
|
1124
1132
|
"references": {
|
|
1125
1133
|
"Record": {
|
|
1126
1134
|
"location": "global",
|
|
1127
1135
|
"id": "global::Record"
|
|
1136
|
+
},
|
|
1137
|
+
"ListNavigationContext": {
|
|
1138
|
+
"location": "import",
|
|
1139
|
+
"path": "../../../utils/query-params",
|
|
1140
|
+
"id": "src/utils/query-params.ts::ListNavigationContext",
|
|
1141
|
+
"referenceLocation": "ListNavigationContext"
|
|
1128
1142
|
}
|
|
1129
1143
|
}
|
|
1130
1144
|
}
|
|
@@ -143,7 +143,8 @@ async function initDetailViewTab() {
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
table.addEventListener('mrdRowClick', (e) => {
|
|
146
|
-
|
|
146
|
+
logEvent('mrdRowClick', e.detail);
|
|
147
|
+
showCompanyDetail(e.detail.row);
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
await table.init();
|
|
@@ -700,9 +701,9 @@ async function navigateToClassDashboard(pluralName) {
|
|
|
700
701
|
}
|
|
701
702
|
|
|
702
703
|
async function handleNavigate(detail) {
|
|
703
|
-
const { href, label, navigate } = detail;
|
|
704
|
+
const { href, label, navigate, listContext } = detail;
|
|
704
705
|
if (href) {
|
|
705
|
-
logEvent('mrdNavigate', { href, label });
|
|
706
|
+
logEvent('mrdNavigate', { href, label, listContext });
|
|
706
707
|
await navigateToObjectDashboard(href);
|
|
707
708
|
} else if (navigate?.dataClass) {
|
|
708
709
|
logEvent('mrdNavigate', { dataClass: navigate.dataClass, navigationType: navigate.navigationType, label });
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared path/query-param conventions for list requests,
|
|
3
|
-
* used by mrd-table and mrd-document-list.
|
|
4
|
-
*/
|
|
5
1
|
/** Applies the view-level static filters to `params` using the API operator conventions. */
|
|
6
2
|
export function applyViewFilters(params, filters) {
|
|
7
3
|
var _a, _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as r,HTMLElement as t,createEvent as e,h as o,Host as i,transformTag as n}from"@stencil/core/internal/client";import{e as d}from"./client-layout.js";import{t as a}from"./i18n.js";import{d as s}from"./mrd-document-list2.js";import{d as c}from"./mrd-table2.js";const m=r(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdLoadPage=e(this,"mrdLoadPage",7),this.mrdLoadDistinct=e(this,"mrdLoadDistinct",7),this.mrdLoadAggregations=e(this,"mrdLoadAggregations",7),this.mrdNavigate=e(this,"mrdNavigate",7),this.mrdAction=e(this,"mrdAction",7),this.mrdUpdateObject=e(this,"mrdUpdateObject",7),this.mrdUpload=e(this,"mrdUpload",7),this.mrdCreateObject=e(this,"mrdCreateObject",7),this.item=null,this.parentId="",this.containerHref="",this.viewKey="",this.height=460,this.locale=navigator.language,this.mode="tree",this.canCreate=!1,this.tableInited=!1,this.createFolder=()=>{var r;null===(r=this.listEl)||void 0===r||r.createFolder()}}componentDidRender(){var r;if("list"===this.mode&&this.tableEl&&!this.tableInited){this.tableInited=!0;const t=this.tableEl;Promise.resolve(null===(r=t.componentOnReady)||void 0===r?void 0:r.call(t)).then((()=>t.init()))}}setMode(r){r!==this.mode&&(this.canCreate=!1,this.tableInited=!1,this.mode=r)}renderToolbar(){return o("div",{class:"mrd-document-container__toolbar"},"tree"===this.mode&&o("button",{type:"button",class:"mrd-document-container__action",disabled:!this.canCreate,onClick:this.createFolder},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("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"}),o("path",{d:"M12 11v4M10 13h4"})),a("new_folder",this.locale)),o("div",{class:"mrd-document-container__seg",role:"group","aria-label":a("doc_view_switch",this.locale)},o("button",{class:"mrd-document-container__seg-btn","aria-pressed":String("tree"===this.mode),title:a("doc_view_tree",this.locale),"aria-label":a("doc_view_tree",this.locale),onClick:()=>this.setMode("tree")},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"M3 5h6M3 12h9M3 19h6"}),o("circle",{cx:"18",cy:"5",r:"1.6"}),o("circle",{cx:"18",cy:"19",r:"1.6"}),o("path",{d:"M16 12h4"}))),o("button",{class:"mrd-document-container__seg-btn","aria-pressed":String("list"===this.mode),title:a("doc_view_list",this.locale),"aria-label":a("doc_view_list",this.locale),onClick:()=>this.setMode("list")},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})))))}renderTree(){return o("mrd-document-list",{"data-doclist":this.viewKey,ref:r=>this.listEl=r,item:this.item,archetype:this.archetype,parentId:this.parentId,containerHref:this.containerHref,locale:this.locale,onMrdLoadDistinct:r=>{r.stopPropagation(),this.mrdLoadDistinct.emit(r.detail)},onMrdLoadPage:r=>{r.stopPropagation(),this.mrdLoadPage.emit(r.detail)},onMrdNavigate:r=>{r.stopPropagation(),this.mrdNavigate.emit(Object.assign(Object.assign({},r.detail),{navigateBehaviour:d.OVERLAY_PAGE}))},onMrdCanCreate:r=>{r.stopPropagation(),this.canCreate=r.detail},onMrdUpdateObject:r=>{r.stopPropagation(),this.mrdUpdateObject.emit(r.detail)},onMrdUpload:r=>{r.stopPropagation(),this.mrdUpload.emit(r.detail)},onMrdCreateObject:r=>{r.stopPropagation(),this.mrdCreateObject.emit(r.detail)}})}renderList(){return o("mrd-table",{"data-view":this.viewKey,ref:r=>this.tableEl=r,item:this.item,parentId:this.parentId,locale:this.locale,onMrdLoadPage:r=>{r.stopPropagation(),this.mrdLoadPage.emit(r.detail)},onMrdLoadAggregations:r=>{r.stopPropagation(),this.mrdLoadAggregations.emit(r.detail)},onMrdRowClick:r=>{var t,e,o;r.stopPropagation();const
|
|
1
|
+
import{proxyCustomElement as r,HTMLElement as t,createEvent as e,h as o,Host as i,transformTag as n}from"@stencil/core/internal/client";import{e as d}from"./client-layout.js";import{t as a}from"./i18n.js";import{d as s}from"./mrd-document-list2.js";import{d as c}from"./mrd-table2.js";const m=r(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.mrdLoadPage=e(this,"mrdLoadPage",7),this.mrdLoadDistinct=e(this,"mrdLoadDistinct",7),this.mrdLoadAggregations=e(this,"mrdLoadAggregations",7),this.mrdNavigate=e(this,"mrdNavigate",7),this.mrdAction=e(this,"mrdAction",7),this.mrdUpdateObject=e(this,"mrdUpdateObject",7),this.mrdUpload=e(this,"mrdUpload",7),this.mrdCreateObject=e(this,"mrdCreateObject",7),this.item=null,this.parentId="",this.containerHref="",this.viewKey="",this.height=460,this.locale=navigator.language,this.mode="tree",this.canCreate=!1,this.tableInited=!1,this.createFolder=()=>{var r;null===(r=this.listEl)||void 0===r||r.createFolder()}}componentDidRender(){var r;if("list"===this.mode&&this.tableEl&&!this.tableInited){this.tableInited=!0;const t=this.tableEl;Promise.resolve(null===(r=t.componentOnReady)||void 0===r?void 0:r.call(t)).then((()=>t.init()))}}setMode(r){r!==this.mode&&(this.canCreate=!1,this.tableInited=!1,this.mode=r)}renderToolbar(){return o("div",{class:"mrd-document-container__toolbar"},"tree"===this.mode&&o("button",{type:"button",class:"mrd-document-container__action",disabled:!this.canCreate,onClick:this.createFolder},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("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"}),o("path",{d:"M12 11v4M10 13h4"})),a("new_folder",this.locale)),o("div",{class:"mrd-document-container__seg",role:"group","aria-label":a("doc_view_switch",this.locale)},o("button",{class:"mrd-document-container__seg-btn","aria-pressed":String("tree"===this.mode),title:a("doc_view_tree",this.locale),"aria-label":a("doc_view_tree",this.locale),onClick:()=>this.setMode("tree")},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"M3 5h6M3 12h9M3 19h6"}),o("circle",{cx:"18",cy:"5",r:"1.6"}),o("circle",{cx:"18",cy:"19",r:"1.6"}),o("path",{d:"M16 12h4"}))),o("button",{class:"mrd-document-container__seg-btn","aria-pressed":String("list"===this.mode),title:a("doc_view_list",this.locale),"aria-label":a("doc_view_list",this.locale),onClick:()=>this.setMode("list")},o("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},o("path",{d:"M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"})))))}renderTree(){return o("mrd-document-list",{"data-doclist":this.viewKey,ref:r=>this.listEl=r,item:this.item,archetype:this.archetype,parentId:this.parentId,containerHref:this.containerHref,locale:this.locale,onMrdLoadDistinct:r=>{r.stopPropagation(),this.mrdLoadDistinct.emit(r.detail)},onMrdLoadPage:r=>{r.stopPropagation(),this.mrdLoadPage.emit(r.detail)},onMrdNavigate:r=>{r.stopPropagation(),this.mrdNavigate.emit(Object.assign(Object.assign({},r.detail),{navigateBehaviour:d.OVERLAY_PAGE}))},onMrdCanCreate:r=>{r.stopPropagation(),this.canCreate=r.detail},onMrdUpdateObject:r=>{r.stopPropagation(),this.mrdUpdateObject.emit(r.detail)},onMrdUpload:r=>{r.stopPropagation(),this.mrdUpload.emit(r.detail)},onMrdCreateObject:r=>{r.stopPropagation(),this.mrdCreateObject.emit(r.detail)}})}renderList(){return o("mrd-table",{"data-view":this.viewKey,ref:r=>this.tableEl=r,item:this.item,parentId:this.parentId,locale:this.locale,onMrdLoadPage:r=>{r.stopPropagation(),this.mrdLoadPage.emit(r.detail)},onMrdLoadAggregations:r=>{r.stopPropagation(),this.mrdLoadAggregations.emit(r.detail)},onMrdRowClick:r=>{var t,e,o;r.stopPropagation();const{row:i,listContext:n}=r.detail;this.mrdNavigate.emit({href:null===(e=null===(t=null==i?void 0:i._links)||void 0===t?void 0:t.self)||void 0===e?void 0:e.href,label:null!==(o=null==i?void 0:i.name)&&void 0!==o?o:"",navigateBehaviour:d.OVERLAY_PAGE,listContext:n})},onMrdAction:r=>{r.stopPropagation(),this.mrdAction.emit(r.detail)}})}render(){const r="tree"===this.mode;return o(i,{key:"7d0523d66f9a3d189dcc5517cd7281a57456977d"},this.renderToolbar(),o("div",{key:"19b0f416d2ad1b093afd6f799670debf8c18b225",class:{"mrd-document-container__body":!0,"mrd-document-container__body--tree":r},style:r?{height:`${this.height}px`,overflowY:"auto"}:{}},r?this.renderTree():this.renderList()))}get el(){return this}static get style(){return".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) 0;border-bottom:1px solid var(--mrd-color-neutral-100)}.mrd-document-container__body--tree.sc-mrd-document-container{border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow:hidden}.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:var(--mrd-color-folder)}.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}"}},[2,"mrd-document-container",{item:[16],archetype:[16],parentId:[1,"parent-id"],containerHref:[1,"container-href"],viewKey:[1,"view-key"],height:[2],locale:[1],mode:[32],canCreate:[32]}]);function l(){"undefined"!=typeof customElements&&["mrd-document-container","mrd-document-list","mrd-table"].forEach((r=>{switch(r){case"mrd-document-container":customElements.get(n(r))||customElements.define(n(r),m);break;case"mrd-document-list":customElements.get(n(r))||s();break;case"mrd-table":customElements.get(n(r))||c()}}))}export{m as M,l as d}
|