@mmlogic/components 0.5.12 → 0.5.14
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/{cell-renderer-pwUGEDql.js → cell-renderer-mjS630f1.js} +16 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_25.cjs.entry.js +212 -45
- package/dist/cjs/mrd-merge-view.cjs.entry.js +1 -1
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +30 -4
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +55 -6
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +27 -3
- package/dist/collection/components/table/mrd-table/mrd-table.css +36 -0
- package/dist/collection/components/table/mrd-table/mrd-table.js +162 -26
- package/dist/collection/components/table/mrd-table/table-parts.js +14 -6
- package/dist/collection/components/table/mrd-table/table-query.js +6 -0
- package/dist/collection/dev/app.js +24 -0
- package/dist/collection/utils/i18n.js +16 -0
- package/dist/components/i18n.js +1 -1
- 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/{cell-renderer-B8rJpnq8.js → cell-renderer-BDY8UXkH.js} +16 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_25.entry.js +212 -45
- package/dist/esm/mrd-merge-view.entry.js +1 -1
- package/dist/mosterdcomponents/cell-renderer-B8u5BCK-.js.map +1 -0
- package/dist/mosterdcomponents/client-layout-Bc42CfJB.js.map +1 -0
- package/dist/mosterdcomponents/document-attachments-BufPmMRv.js.map +1 -0
- package/dist/mosterdcomponents/field-helpers-CNQcI3Hf.js.map +1 -0
- package/dist/mosterdcomponents/file-upload-common-C9wp47CB.js.map +1 -0
- package/dist/mosterdcomponents/format-gcecItcD.js.map +1 -0
- package/dist/mosterdcomponents/i18n-ydNM87-Q.js.map +1 -0
- package/dist/mosterdcomponents/index-1ayBojyN.js.map +1 -0
- package/dist/mosterdcomponents/index-DhffneUF.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-Dkm4WxMy.js +1 -0
- package/dist/mosterdcomponents/p-c834951a.entry.js +3 -0
- package/dist/mosterdcomponents/{p-e540de6a.entry.js → p-e8b0880f.entry.js} +1 -1
- package/dist/mosterdcomponents/purify.es-_duHfPgC.js.map +1 -0
- package/dist/mosterdcomponents/query-params-BZbQoeYF.js.map +1 -0
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
- package/dist/mosterdcomponents/validation-CjjTt66G.js.map +1 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +4 -0
- package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +6 -1
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +4 -0
- package/dist/types/components/table/mrd-table/mrd-table.d.ts +52 -1
- package/dist/types/components/table/mrd-table/table-parts.d.ts +18 -0
- package/dist/types/components/table/mrd-table/table-query.d.ts +6 -0
- package/dist/types/components.d.ts +45 -1
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-eb322d5c.entry.js +0 -3
- package/dist/mosterdcomponents/p-rTM1tU_M.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DVbdkYO3.js');
|
|
4
4
|
var clientLayout = require('./client-layout-CqVuJumR.js');
|
|
5
|
-
var cellRenderer = require('./cell-renderer-
|
|
5
|
+
var cellRenderer = require('./cell-renderer-mjS630f1.js');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Whether a layout item can appear in the merge diff at all. m-n relations
|
package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js
CHANGED
|
@@ -28,6 +28,10 @@ export class MrdDocumentContainer {
|
|
|
28
28
|
* on top, Finder-style. The table manages its own height. */
|
|
29
29
|
this.height = 460;
|
|
30
30
|
this.locale = navigator.language;
|
|
31
|
+
/** When true, this dashboard is read-only: New folder and Upload are disabled
|
|
32
|
+
* (with a tooltip explaining why) and the embedded table/list get it passed
|
|
33
|
+
* through so their own create/upload/drag-drop paths are disabled too. */
|
|
34
|
+
this.readOnly = false;
|
|
31
35
|
/** Active body: folder tree or flat table. */
|
|
32
36
|
this.mode = 'tree';
|
|
33
37
|
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
@@ -42,6 +46,8 @@ export class MrdDocumentContainer {
|
|
|
42
46
|
};
|
|
43
47
|
this.pickFile = () => {
|
|
44
48
|
var _a;
|
|
49
|
+
if (this.readOnly)
|
|
50
|
+
return;
|
|
45
51
|
(_a = this.fileInputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
46
52
|
};
|
|
47
53
|
/** One file per upload, matching the drop handler. Reset the input afterwards
|
|
@@ -78,11 +84,11 @@ export class MrdDocumentContainer {
|
|
|
78
84
|
}
|
|
79
85
|
// ── Toolbar ────────────────────────────────────────────────────────────────
|
|
80
86
|
renderToolbar() {
|
|
81
|
-
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, onClick: this.createFolder }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, title: this.targetLabel ? `${t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined, onClick: this.pickFile }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("path", { d: "M12 3v13M7 8l5-5 5 5" })), t('doc_upload', this.locale))), h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
87
|
+
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : undefined, onClick: this.createFolder }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: this.readOnly || !this.canCreate, title: this.readOnly ? t('readonly_access', this.locale) : (this.targetLabel ? `${t('doc_upload_to', this.locale)} ${this.targetLabel}` : undefined), onClick: this.pickFile }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }), h("path", { d: "M12 3v13M7 8l5-5 5 5" })), t('doc_upload', this.locale))), h("input", { type: "file", class: "mrd-document-container__file-input", ref: el => (this.fileInputEl = el), onChange: this.onFilePicked }), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
82
88
|
}
|
|
83
89
|
// ── Bodies ───────────────────────────────────────────────────────────────
|
|
84
90
|
renderTree() {
|
|
85
|
-
return (h("mrd-document-list", { "data-doclist": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, containerHref: this.containerHref, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
91
|
+
return (h("mrd-document-list", { "data-doclist": this.viewKey, ref: el => (this.listEl = el), item: this.item, archetype: this.archetype, parentId: this.parentId, containerHref: this.containerHref, locale: this.locale, readOnly: this.readOnly, onMrdLoadDistinct: (e) => {
|
|
86
92
|
e.stopPropagation();
|
|
87
93
|
this.mrdLoadDistinct.emit(e.detail);
|
|
88
94
|
}, onMrdLoadPage: (e) => {
|
|
@@ -109,7 +115,7 @@ export class MrdDocumentContainer {
|
|
|
109
115
|
} }));
|
|
110
116
|
}
|
|
111
117
|
renderList() {
|
|
112
|
-
return (h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, onMrdLoadPage: (e) => {
|
|
118
|
+
return (h("mrd-table", { "data-view": this.viewKey, ref: el => (this.tableEl = el), item: this.item, parentId: this.parentId, locale: this.locale, readOnly: this.readOnly, onMrdLoadPage: (e) => {
|
|
113
119
|
e.stopPropagation();
|
|
114
120
|
this.mrdLoadPage.emit(e.detail);
|
|
115
121
|
}, onMrdLoadAggregations: (e) => {
|
|
@@ -133,7 +139,7 @@ export class MrdDocumentContainer {
|
|
|
133
139
|
}
|
|
134
140
|
render() {
|
|
135
141
|
const treeMode = this.mode === 'tree';
|
|
136
|
-
return (h(Host, { key: '
|
|
142
|
+
return (h(Host, { key: '6792d49f08dd19f6c51e4b656df06bbd8bc14f3e' }, this.renderToolbar(), h("div", { key: '702f4c288f8c40bd2c5999beb392b9dfd022b0bc', class: {
|
|
137
143
|
'mrd-document-container__body': true,
|
|
138
144
|
'mrd-document-container__body--tree': treeMode,
|
|
139
145
|
}, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
|
|
@@ -300,6 +306,26 @@ export class MrdDocumentContainer {
|
|
|
300
306
|
"reflect": false,
|
|
301
307
|
"attribute": "locale",
|
|
302
308
|
"defaultValue": "navigator.language"
|
|
309
|
+
},
|
|
310
|
+
"readOnly": {
|
|
311
|
+
"type": "boolean",
|
|
312
|
+
"mutable": false,
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "boolean",
|
|
315
|
+
"resolved": "boolean",
|
|
316
|
+
"references": {}
|
|
317
|
+
},
|
|
318
|
+
"required": false,
|
|
319
|
+
"optional": false,
|
|
320
|
+
"docs": {
|
|
321
|
+
"tags": [],
|
|
322
|
+
"text": "When true, this dashboard is read-only: New folder and Upload are disabled\n(with a tooltip explaining why) and the embedded table/list get it passed\nthrough so their own create/upload/drag-drop paths are disabled too."
|
|
323
|
+
},
|
|
324
|
+
"getter": false,
|
|
325
|
+
"setter": false,
|
|
326
|
+
"reflect": false,
|
|
327
|
+
"attribute": "read-only",
|
|
328
|
+
"defaultValue": "false"
|
|
303
329
|
}
|
|
304
330
|
};
|
|
305
331
|
}
|
|
@@ -34,6 +34,11 @@ export class MrdDocumentList {
|
|
|
34
34
|
* accepts file drops and folder creation. */
|
|
35
35
|
this.containerHref = '';
|
|
36
36
|
this.locale = navigator.language;
|
|
37
|
+
/** When true, folder creation, file upload (button and drag-drop) and moving a
|
|
38
|
+
* document between folders are all disabled — a viewer-role user can browse
|
|
39
|
+
* but not mutate anything. Drives mrdCanCreate(false) so the host toolbar's
|
|
40
|
+
* New folder / Upload buttons stay disabled too. */
|
|
41
|
+
this.readOnly = false;
|
|
37
42
|
this.containers = [];
|
|
38
43
|
this.rootLoading = true;
|
|
39
44
|
/** True when the single-container level is collapsed away (dossier context). */
|
|
@@ -76,6 +81,8 @@ export class MrdDocumentList {
|
|
|
76
81
|
/** The optimistic document row awaiting its self href from the create POST. */
|
|
77
82
|
this.lastOptimisticDoc = null;
|
|
78
83
|
this.startCreateFolder = () => {
|
|
84
|
+
if (this.readOnly)
|
|
85
|
+
return;
|
|
79
86
|
const resolved = this.resolveTarget();
|
|
80
87
|
if (!resolved || this.pendingNode)
|
|
81
88
|
return;
|
|
@@ -115,6 +122,10 @@ export class MrdDocumentList {
|
|
|
115
122
|
// ── Drag & drop: move a document into another folder / container ────────────
|
|
116
123
|
this.onDocDragStart = (e, doc, node) => {
|
|
117
124
|
var _a, _b, _c;
|
|
125
|
+
if (this.readOnly) {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
118
129
|
this.dragDoc = doc;
|
|
119
130
|
this.dragFromId = node.id;
|
|
120
131
|
if (e.dataTransfer) {
|
|
@@ -134,6 +145,11 @@ export class MrdDocumentList {
|
|
|
134
145
|
* root drop-zone; a different node is highlighted (its own folder = no-op). */
|
|
135
146
|
this.onNodeDragOver = (e, node) => {
|
|
136
147
|
const file = this.isFileDrag(e);
|
|
148
|
+
if (this.readOnly) {
|
|
149
|
+
if (file)
|
|
150
|
+
e.preventDefault(); // swallow so the browser doesn't navigate to the dropped file
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
137
153
|
if (!this.dragDoc && !file)
|
|
138
154
|
return;
|
|
139
155
|
e.preventDefault();
|
|
@@ -149,6 +165,10 @@ export class MrdDocumentList {
|
|
|
149
165
|
this.dropTargetId = null;
|
|
150
166
|
};
|
|
151
167
|
this.onNodeDrop = (e, node, container) => {
|
|
168
|
+
if (this.readOnly) {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
152
172
|
if (this.isFileDrag(e)) {
|
|
153
173
|
e.preventDefault();
|
|
154
174
|
e.stopPropagation();
|
|
@@ -167,6 +187,11 @@ export class MrdDocumentList {
|
|
|
167
187
|
if (!this.singleContainer)
|
|
168
188
|
return;
|
|
169
189
|
const file = this.isFileDrag(e);
|
|
190
|
+
if (this.readOnly) {
|
|
191
|
+
if (file)
|
|
192
|
+
e.preventDefault(); // swallow so the browser doesn't navigate to the dropped file
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
170
195
|
if (!this.dragDoc && !file)
|
|
171
196
|
return;
|
|
172
197
|
e.preventDefault();
|
|
@@ -184,6 +209,10 @@ export class MrdDocumentList {
|
|
|
184
209
|
};
|
|
185
210
|
this.onRootDrop = (e) => {
|
|
186
211
|
this.rootDropActive = false;
|
|
212
|
+
if (this.readOnly) {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
187
216
|
if (!this.singleContainer)
|
|
188
217
|
return;
|
|
189
218
|
const only = this.containers[0];
|
|
@@ -454,10 +483,10 @@ export class MrdDocumentList {
|
|
|
454
483
|
return null;
|
|
455
484
|
}
|
|
456
485
|
get canCreateFolder() {
|
|
457
|
-
return !this.pendingNode && this.resolveTarget() !== null;
|
|
486
|
+
return !this.readOnly && !this.pendingNode && this.resolveTarget() !== null;
|
|
458
487
|
}
|
|
459
488
|
/** Start creating a folder under the current target. Called by the host toolbar
|
|
460
|
-
* (mrd-document-container). No-op when there is no valid target. */
|
|
489
|
+
* (mrd-document-container). No-op when there is no valid target, or read-only. */
|
|
461
490
|
async createFolder() {
|
|
462
491
|
this.startCreateFolder();
|
|
463
492
|
}
|
|
@@ -543,7 +572,7 @@ export class MrdDocumentList {
|
|
|
543
572
|
* (mrd-document-container). No-op without a target, or while another upload
|
|
544
573
|
* is still awaiting its setFileReference. */
|
|
545
574
|
async uploadFile(file) {
|
|
546
|
-
if (!file || this.pendingUpload)
|
|
575
|
+
if (this.readOnly || !file || this.pendingUpload)
|
|
547
576
|
return;
|
|
548
577
|
const resolved = this.resolveTarget();
|
|
549
578
|
if (!resolved)
|
|
@@ -684,7 +713,7 @@ export class MrdDocumentList {
|
|
|
684
713
|
body = renderLoadingRow(ctx, 0);
|
|
685
714
|
}
|
|
686
715
|
else if (this.containers.length === 0) {
|
|
687
|
-
body = h("div", { key: '
|
|
716
|
+
body = h("div", { key: '5d473ec3a894361325a71deb14e7b52d0abc5f06', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
688
717
|
}
|
|
689
718
|
else if (this.singleContainer) {
|
|
690
719
|
// Dossier context: render the single container's folder tree at the root.
|
|
@@ -702,7 +731,7 @@ export class MrdDocumentList {
|
|
|
702
731
|
else {
|
|
703
732
|
body = this.containers.map(c => renderContainerNode(ctx, c, 0));
|
|
704
733
|
}
|
|
705
|
-
return (h(Host, { key: '
|
|
734
|
+
return (h(Host, { key: '757babf3ccabbb113ab2a24d632b2b9a02d3c08b' }, h("div", { key: '606c212687482efdc5666333678e2ea406709e75', class: 'mrd-document-list' + (this.rootDropActive ? ' mrd-document-list--drop-active' : ''), onDragOver: this.onRootDragOver, onDragLeave: this.onRootDragLeave, onDrop: this.onRootDrop }, body)));
|
|
706
735
|
}
|
|
707
736
|
static get is() { return "mrd-document-list"; }
|
|
708
737
|
static get encapsulation() { return "scoped"; }
|
|
@@ -826,6 +855,26 @@ export class MrdDocumentList {
|
|
|
826
855
|
"reflect": false,
|
|
827
856
|
"attribute": "locale",
|
|
828
857
|
"defaultValue": "navigator.language"
|
|
858
|
+
},
|
|
859
|
+
"readOnly": {
|
|
860
|
+
"type": "boolean",
|
|
861
|
+
"mutable": false,
|
|
862
|
+
"complexType": {
|
|
863
|
+
"original": "boolean",
|
|
864
|
+
"resolved": "boolean",
|
|
865
|
+
"references": {}
|
|
866
|
+
},
|
|
867
|
+
"required": false,
|
|
868
|
+
"optional": false,
|
|
869
|
+
"docs": {
|
|
870
|
+
"tags": [],
|
|
871
|
+
"text": "When true, folder creation, file upload (button and drag-drop) and moving a\ndocument between folders are all disabled \u2014 a viewer-role user can browse\nbut not mutate anything. Drives mrdCanCreate(false) so the host toolbar's\nNew folder / Upload buttons stay disabled too."
|
|
872
|
+
},
|
|
873
|
+
"getter": false,
|
|
874
|
+
"setter": false,
|
|
875
|
+
"reflect": false,
|
|
876
|
+
"attribute": "read-only",
|
|
877
|
+
"defaultValue": "false"
|
|
829
878
|
}
|
|
830
879
|
};
|
|
831
880
|
}
|
|
@@ -1068,7 +1117,7 @@ export class MrdDocumentList {
|
|
|
1068
1117
|
"return": "Promise<void>"
|
|
1069
1118
|
},
|
|
1070
1119
|
"docs": {
|
|
1071
|
-
"text": "Start creating a folder under the current target. Called by the host toolbar\n(mrd-document-container). No-op when there is no valid target.",
|
|
1120
|
+
"text": "Start creating a folder under the current target. Called by the host toolbar\n(mrd-document-container). No-op when there is no valid target, or read-only.",
|
|
1072
1121
|
"tags": []
|
|
1073
1122
|
}
|
|
1074
1123
|
},
|
|
@@ -17,6 +17,10 @@ export class MrdLayoutSection {
|
|
|
17
17
|
/** Top-level archetypes on the object dashboard. When it contains commons.document,
|
|
18
18
|
* the record is rendered as a single-document view instead of generic fields. */
|
|
19
19
|
this.archetypes = [];
|
|
20
|
+
/** When true, this dashboard is read-only (viewer role): the embedded mrd-table's
|
|
21
|
+
* create ("+") action and the documents view's New folder / Upload are disabled
|
|
22
|
+
* with a tooltip explaining why, so it's clear at a glance the user can't mutate data. */
|
|
23
|
+
this.readOnly = false;
|
|
20
24
|
this.searchQueryMap = {};
|
|
21
25
|
this.searchResultsMap = {};
|
|
22
26
|
this.imagePreviewUrl = null;
|
|
@@ -222,7 +226,7 @@ export class MrdLayoutSection {
|
|
|
222
226
|
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
223
227
|
* the host with the view key, exactly as the raw list/table events were. */
|
|
224
228
|
renderDocumentContainer(item, key, parentId, archetype, containerHref) {
|
|
225
|
-
return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
229
|
+
return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, readOnly: this.readOnly, onMrdLoadDistinct: (e) => {
|
|
226
230
|
e.stopPropagation();
|
|
227
231
|
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
228
232
|
}, onMrdLoadPage: (e) => {
|
|
@@ -255,7 +259,7 @@ export class MrdLayoutSection {
|
|
|
255
259
|
} }));
|
|
256
260
|
}
|
|
257
261
|
renderTable(item, key, parentId) {
|
|
258
|
-
return (h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
|
|
262
|
+
return (h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, readOnly: this.readOnly, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
|
|
259
263
|
var _a;
|
|
260
264
|
e.stopPropagation();
|
|
261
265
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
@@ -359,7 +363,7 @@ export class MrdLayoutSection {
|
|
|
359
363
|
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
360
364
|
const invoiceArchetype = !docArchetype ? resolveArchetype(this.archetypes, ARCHETYPE_INVOICE) : undefined;
|
|
361
365
|
const emailArchetype = !docArchetype && !invoiceArchetype ? resolveArchetype(this.archetypes, ARCHETYPE_EMAIL) : undefined;
|
|
362
|
-
return (h(Host, { key: '
|
|
366
|
+
return (h(Host, { key: '07b1d61b170a5ae971ba54eaf775e1787dea1642' }, h("div", { key: 'd146e0542b1de11bd130eb3d36d54e4faf055309', class: "mrd-layout-section" }, docArchetype && this.renderDocumentObject(docArchetype), invoiceArchetype && this.renderInvoiceObject(invoiceArchetype), emailArchetype && this.renderEmailObject(emailArchetype), !docArchetype && !invoiceArchetype && !emailArchetype && this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
363
367
|
}
|
|
364
368
|
static get is() { return "mrd-layout-section"; }
|
|
365
369
|
static get encapsulation() { return "scoped"; }
|
|
@@ -519,6 +523,26 @@ export class MrdLayoutSection {
|
|
|
519
523
|
"getter": false,
|
|
520
524
|
"setter": false,
|
|
521
525
|
"defaultValue": "[]"
|
|
526
|
+
},
|
|
527
|
+
"readOnly": {
|
|
528
|
+
"type": "boolean",
|
|
529
|
+
"mutable": false,
|
|
530
|
+
"complexType": {
|
|
531
|
+
"original": "boolean",
|
|
532
|
+
"resolved": "boolean",
|
|
533
|
+
"references": {}
|
|
534
|
+
},
|
|
535
|
+
"required": false,
|
|
536
|
+
"optional": false,
|
|
537
|
+
"docs": {
|
|
538
|
+
"tags": [],
|
|
539
|
+
"text": "When true, this dashboard is read-only (viewer role): the embedded mrd-table's\ncreate (\"+\") action and the documents view's New folder / Upload are disabled\nwith a tooltip explaining why, so it's clear at a glance the user can't mutate data."
|
|
540
|
+
},
|
|
541
|
+
"getter": false,
|
|
542
|
+
"setter": false,
|
|
543
|
+
"reflect": false,
|
|
544
|
+
"attribute": "read-only",
|
|
545
|
+
"defaultValue": "false"
|
|
522
546
|
}
|
|
523
547
|
};
|
|
524
548
|
}
|
|
@@ -321,6 +321,42 @@
|
|
|
321
321
|
pointer-events: none;
|
|
322
322
|
z-index: 10;
|
|
323
323
|
}
|
|
324
|
+
.mrd-table__search-box {
|
|
325
|
+
display: inline-flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
gap: var(--mrd-space-1);
|
|
328
|
+
height: 2rem;
|
|
329
|
+
padding: 0 var(--mrd-space-2);
|
|
330
|
+
border: 1px solid var(--mrd-border-color-focus, var(--mrd-color-primary));
|
|
331
|
+
border-radius: var(--mrd-border-radius);
|
|
332
|
+
background: var(--mrd-color-white, #fff);
|
|
333
|
+
box-shadow: var(--mrd-shadow-focus, none);
|
|
334
|
+
color: var(--mrd-color-neutral-400);
|
|
335
|
+
}
|
|
336
|
+
.mrd-table__search-input {
|
|
337
|
+
border: none;
|
|
338
|
+
outline: none;
|
|
339
|
+
background: transparent;
|
|
340
|
+
font-size: var(--mrd-font-size-sm);
|
|
341
|
+
font-family: var(--mrd-font-family);
|
|
342
|
+
color: var(--mrd-color-neutral-800);
|
|
343
|
+
width: 12rem;
|
|
344
|
+
}
|
|
345
|
+
.mrd-table__search-clear {
|
|
346
|
+
display: inline-flex;
|
|
347
|
+
align-items: center;
|
|
348
|
+
justify-content: center;
|
|
349
|
+
background: none;
|
|
350
|
+
border: none;
|
|
351
|
+
padding: 0;
|
|
352
|
+
cursor: pointer;
|
|
353
|
+
color: var(--mrd-color-neutral-400);
|
|
354
|
+
font-size: var(--mrd-font-size-xs);
|
|
355
|
+
line-height: 1;
|
|
356
|
+
}
|
|
357
|
+
.mrd-table__search-clear:hover {
|
|
358
|
+
color: var(--mrd-color-neutral-700);
|
|
359
|
+
}
|
|
324
360
|
.mrd-table__create-picker-wrap {
|
|
325
361
|
position: relative;
|
|
326
362
|
}
|