@mmlogic/components 0.5.2 → 0.5.4
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-CmaO0CZT.js → cell-renderer-Coy-aD3k.js} +146 -1
- package/dist/cjs/{client-layout-RZ3Ix-4a.js → client-layout-CqVuJumR.js} +9 -0
- package/dist/cjs/{index-DzRfoAPz.js → index-DVbdkYO3.js} +468 -6
- package/dist/cjs/index.cjs.js +4 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mosterdcomponents.cjs.js +2 -2
- package/dist/cjs/{mrd-boolean-field_23.cjs.entry.js → mrd-boolean-field_25.cjs.entry.js} +5696 -5229
- package/dist/cjs/mrd-merge-view.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.css +3 -0
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +23 -3
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +76 -2
- package/dist/collection/components/documents/mrd-document-view/mrd-document-view.js +7 -8
- package/dist/collection/components/email/mrd-email-view/mrd-email-view.css +126 -0
- package/dist/collection/components/email/mrd-email-view/mrd-email-view.js +247 -0
- package/dist/collection/components/fields/file-upload-common.js +23 -7
- package/dist/collection/components/fields/mrd-boolean-field/mrd-boolean-field.js +1 -1
- package/dist/collection/components/fields/mrd-currency-field/mrd-currency-field.js +1 -1
- package/dist/collection/components/fields/mrd-date-field/mrd-date-field.js +1 -1
- package/dist/collection/components/fields/mrd-datetime-field/mrd-datetime-field.js +1 -1
- package/dist/collection/components/fields/mrd-email-field/mrd-email-field.js +1 -1
- package/dist/collection/components/fields/mrd-file-field/mrd-file-field.css +20 -1
- package/dist/collection/components/fields/mrd-file-field/mrd-file-field.js +108 -47
- package/dist/collection/components/fields/mrd-image-field/mrd-image-field.css +44 -0
- package/dist/collection/components/fields/mrd-image-field/mrd-image-field.js +126 -58
- package/dist/collection/components/fields/mrd-longtext-field/mrd-longtext-field.js +1 -1
- package/dist/collection/components/fields/mrd-number-field/mrd-number-field.js +1 -1
- package/dist/collection/components/fields/mrd-relation-field/mrd-relation-field.js +13 -3
- package/dist/collection/components/fields/mrd-secret-field/mrd-secret-field.js +2 -2
- package/dist/collection/components/fields/mrd-text-field/mrd-text-field.js +1 -1
- package/dist/collection/components/fields/mrd-textarea-field/mrd-textarea-field.js +1 -1
- package/dist/collection/components/fields/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/components/form/mrd-field/mrd-field.js +5 -5
- package/dist/collection/components/form/mrd-form/mrd-form.js +63 -10
- package/dist/collection/components/invoice/mrd-invoice-view/mrd-invoice-view.css +145 -0
- package/dist/collection/components/invoice/mrd-invoice-view/mrd-invoice-view.js +281 -0
- package/dist/collection/components/layout/mrd-layout-section/field-value.js +9 -3
- package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +6 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +14 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +45 -15
- package/dist/collection/components/merge/mrd-merge-view/mrd-merge-view.js +2 -2
- package/dist/collection/dev/api.js +20 -5
- package/dist/collection/dev/app.js +51 -13
- package/dist/collection/dev/example-data.js +132 -3
- package/dist/collection/types/client-layout.js +6 -0
- package/dist/collection/utils/document-attachments.js +27 -14
- package/dist/collection/utils/i18n.js +144 -0
- package/dist/components/cell-renderer.js +1 -1
- package/dist/components/client-layout.js +1 -1
- package/dist/components/document-attachments.js +1 -1
- package/dist/components/file-upload-common.js +1 -1
- package/dist/components/format.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-boolean-field2.js +1 -1
- package/dist/components/mrd-currency-field2.js +1 -1
- package/dist/components/mrd-date-field2.js +1 -1
- package/dist/components/mrd-datetime-field2.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-document-view2.js +1 -1
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-email-view.d.ts +11 -0
- package/dist/components/mrd-email-view.js +1 -0
- package/dist/components/mrd-email-view2.js +1 -0
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-invoice-view.d.ts +11 -0
- package/dist/components/mrd-invoice-view.js +1 -0
- package/dist/components/mrd-invoice-view2.js +1 -0
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-merge-view.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-relation-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -2
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/components/purify.es.js +2 -0
- package/dist/esm/{cell-renderer-D63AUZxa.js → cell-renderer-C2FLUrMN.js} +146 -2
- package/dist/esm/{client-layout-DCOAAH92.js → client-layout-Bc42CfJB.js} +7 -1
- package/dist/esm/{index-DiSe6vjv.js → index-CDiBvvJU.js} +468 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mosterdcomponents.js +3 -3
- package/dist/esm/{mrd-boolean-field_23.entry.js → mrd-boolean-field_25.entry.js} +5695 -5230
- package/dist/esm/mrd-merge-view.entry.js +5 -5
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/{p-2e16a7d0.entry.js → p-4ea5b97c.entry.js} +1 -1
- package/dist/mosterdcomponents/p-8736313b.entry.js +3 -0
- package/dist/mosterdcomponents/{p-DCOAAH92.js → p-Bc42CfJB.js} +1 -1
- package/dist/mosterdcomponents/p-BgsPVesg.js +1 -0
- package/dist/mosterdcomponents/p-CDiBvvJU.js +2 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +7 -0
- package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +17 -0
- package/dist/types/components/documents/mrd-document-view/mrd-document-view.d.ts +2 -2
- package/dist/types/components/email/mrd-email-view/mrd-email-view.d.ts +52 -0
- package/dist/types/components/fields/file-upload-common.d.ts +19 -1
- package/dist/types/components/fields/mrd-file-field/mrd-file-field.d.ts +24 -10
- package/dist/types/components/fields/mrd-image-field/mrd-image-field.d.ts +27 -11
- package/dist/types/components/fields/mrd-relation-field/mrd-relation-field.d.ts +7 -0
- package/dist/types/components/form/mrd-form/mrd-form.d.ts +19 -3
- package/dist/types/components/invoice/mrd-invoice-view/mrd-invoice-view.d.ts +60 -0
- package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +3 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +13 -0
- package/dist/types/components.d.ts +303 -19
- package/dist/types/types/client-layout.d.ts +13 -0
- package/dist/types/utils/document-attachments.d.ts +12 -5
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-CnqDM0Gb.js +0 -1
- package/dist/mosterdcomponents/p-DiSe6vjv.js +0 -2
- package/dist/mosterdcomponents/p-b5f38707.entry.js +0 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var clientLayout = require('./client-layout-
|
|
5
|
-
var cellRenderer = require('./cell-renderer-
|
|
3
|
+
var index = require('./index-DVbdkYO3.js');
|
|
4
|
+
var clientLayout = require('./client-layout-CqVuJumR.js');
|
|
5
|
+
var cellRenderer = require('./cell-renderer-Coy-aD3k.js');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Whether a layout item can appear in the merge diff at all. m-n relations
|
|
@@ -257,14 +257,14 @@ const MrdMergeView = class {
|
|
|
257
257
|
var _a, _b;
|
|
258
258
|
let stepContent;
|
|
259
259
|
if (this.step === 'search') {
|
|
260
|
-
stepContent = (index.h(MergeSearchStep, { key: '
|
|
260
|
+
stepContent = (index.h(MergeSearchStep, { key: '3adb36fb46aa7260641a46a2cf27cc0ef320876f', locale: this.locale, searchQuery: this.searchQuery, searchResults: this.searchResults, isLoading: this.isLoading, onSearchInput: this.handleSearchInput, onSelect: this.handleSelect }));
|
|
261
261
|
}
|
|
262
262
|
else {
|
|
263
263
|
const diff = diffFields(this.fields, this.currentRecord, this.candidate);
|
|
264
264
|
const bLabel = candidateLabel(this.candidate);
|
|
265
265
|
stepContent = this.step === 'compare' ? (index.h(MergeCompareStep, { locale: this.locale, currentLabel: this.currentLabel, candidateLabel: bLabel, conflicts: diff.conflicts, autoFilled: diff.autoFilled, recordA: this.currentRecord, recordB: (_a = this.candidate) !== null && _a !== void 0 ? _a : {}, resolutions: this.resolutions, openHistoryKey: this.openHistoryKey, onResolve: this.handleResolve, onToggleHistory: this.handleToggleHistory, onChangeCandidate: this.handleChangeCandidate, onContinue: this.handleContinue })) : (index.h(MergeConfirmStep, { locale: this.locale, candidateLabel: bLabel, conflicts: diff.conflicts, autoFilled: diff.autoFilled, resolutions: this.resolutions, recordB: (_b = this.candidate) !== null && _b !== void 0 ? _b : {}, openHistoryKey: this.openHistoryKey, onToggleHistory: this.handleToggleHistory, onBack: this.handleBack, onConfirm: this.handleConfirm }));
|
|
266
266
|
}
|
|
267
|
-
return (index.h(index.Host, { key: '
|
|
267
|
+
return (index.h(index.Host, { key: 'e33a6d66a220b28cc9533da78dc274e2d7ec5c4a' }, index.h("div", { key: 'b5fb1390d86192f9f6f15e3ccb89e2d21d9c7c8b', class: "mrd-merge-view" }, stepContent)));
|
|
268
268
|
}
|
|
269
269
|
get el() { return index.getElement(this); }
|
|
270
270
|
};
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"components/documents/mrd-document-container/mrd-document-container.js",
|
|
4
4
|
"components/documents/mrd-document-list/mrd-document-list.js",
|
|
5
5
|
"components/documents/mrd-document-view/mrd-document-view.js",
|
|
6
|
+
"components/email/mrd-email-view/mrd-email-view.js",
|
|
6
7
|
"components/fields/mrd-boolean-field/mrd-boolean-field.js",
|
|
7
8
|
"components/fields/mrd-currency-field/mrd-currency-field.js",
|
|
8
9
|
"components/fields/mrd-date-field/mrd-date-field.js",
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"components/fields/mrd-time-field/mrd-time-field.js",
|
|
22
23
|
"components/form/mrd-field/mrd-field.js",
|
|
23
24
|
"components/form/mrd-form/mrd-form.js",
|
|
25
|
+
"components/invoice/mrd-invoice-view/mrd-invoice-view.js",
|
|
24
26
|
"components/layout/mrd-layout-section/mrd-layout-section.js",
|
|
25
27
|
"components/merge/mrd-merge-view/mrd-merge-view.js",
|
|
26
28
|
"components/table/mrd-table/mrd-table.js"
|
package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js
CHANGED
|
@@ -32,12 +32,28 @@ export class MrdDocumentContainer {
|
|
|
32
32
|
this.mode = 'tree';
|
|
33
33
|
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
34
34
|
this.canCreate = false;
|
|
35
|
+
/** Name of that target (folder path, or the container's label), for the upload tooltip. */
|
|
36
|
+
this.targetLabel = '';
|
|
35
37
|
/** Whether the currently mounted table has been init()'d. Reset on every mode switch. */
|
|
36
38
|
this.tableInited = false;
|
|
37
39
|
this.createFolder = () => {
|
|
38
40
|
var _a;
|
|
39
41
|
(_a = this.listEl) === null || _a === void 0 ? void 0 : _a.createFolder();
|
|
40
42
|
};
|
|
43
|
+
this.pickFile = () => {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = this.fileInputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
46
|
+
};
|
|
47
|
+
/** One file per upload, matching the drop handler. Reset the input afterwards
|
|
48
|
+
* so picking the same file twice in a row still fires a change event. */
|
|
49
|
+
this.onFilePicked = (e) => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
const input = e.target;
|
|
52
|
+
const file = (_a = input.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
53
|
+
if (file)
|
|
54
|
+
(_b = this.listEl) === null || _b === void 0 ? void 0 : _b.uploadFile(file);
|
|
55
|
+
input.value = '';
|
|
56
|
+
};
|
|
41
57
|
}
|
|
42
58
|
/** The embedded table does not self-load: like every mrd-table it waits for the
|
|
43
59
|
* host to call init() (which emits mrdLoadPage, and — once page 0 lands —
|
|
@@ -62,7 +78,7 @@ export class MrdDocumentContainer {
|
|
|
62
78
|
}
|
|
63
79
|
// ── Toolbar ────────────────────────────────────────────────────────────────
|
|
64
80
|
renderToolbar() {
|
|
65
|
-
return (h("div", { class: "mrd-document-container__toolbar" }, this.mode === 'tree' && (h("button", { type: "button", class: "mrd-document-container__action", disabled: !this.canCreate, onClick: this.createFolder }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }), h("path", { d: "M12 11v4M10 13h4" })), t('new_folder', this.locale))), h("div", { class: "mrd-document-container__seg", role: "group", "aria-label": t('doc_view_switch', this.locale) }, h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'tree'), title: t('doc_view_tree', this.locale), "aria-label": t('doc_view_tree', this.locale), onClick: () => this.setMode('tree') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M3 5h6M3 12h9M3 19h6" }), h("circle", { cx: "18", cy: "5", r: "1.6" }), h("circle", { cx: "18", cy: "19", r: "1.6" }), h("path", { d: "M16 12h4" }))), h("button", { class: "mrd-document-container__seg-btn", "aria-pressed": String(this.mode === 'list'), title: t('doc_view_list', this.locale), "aria-label": t('doc_view_list', this.locale), onClick: () => this.setMode('list') }, h("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true" }, h("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }))))));
|
|
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" }))))));
|
|
66
82
|
}
|
|
67
83
|
// ── Bodies ───────────────────────────────────────────────────────────────
|
|
68
84
|
renderTree() {
|
|
@@ -78,6 +94,9 @@ export class MrdDocumentContainer {
|
|
|
78
94
|
}, onMrdCanCreate: (e) => {
|
|
79
95
|
e.stopPropagation();
|
|
80
96
|
this.canCreate = e.detail;
|
|
97
|
+
}, onMrdTargetLabel: (e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
this.targetLabel = e.detail;
|
|
81
100
|
}, onMrdUpdateObject: (e) => {
|
|
82
101
|
e.stopPropagation();
|
|
83
102
|
this.mrdUpdateObject.emit(e.detail);
|
|
@@ -114,7 +133,7 @@ export class MrdDocumentContainer {
|
|
|
114
133
|
}
|
|
115
134
|
render() {
|
|
116
135
|
const treeMode = this.mode === 'tree';
|
|
117
|
-
return (h(Host, { key: '
|
|
136
|
+
return (h(Host, { key: 'ae948e2458d9087179e850b527802c489067d93f' }, this.renderToolbar(), h("div", { key: 'a04e1a78413aa794d0bda551aeb9c6245f1aafa2', class: {
|
|
118
137
|
'mrd-document-container__body': true,
|
|
119
138
|
'mrd-document-container__body--tree': treeMode,
|
|
120
139
|
}, style: treeMode ? { height: `${this.height}px`, overflowY: 'auto' } : {} }, treeMode ? this.renderTree() : this.renderList())));
|
|
@@ -287,7 +306,8 @@ export class MrdDocumentContainer {
|
|
|
287
306
|
static get states() {
|
|
288
307
|
return {
|
|
289
308
|
"mode": {},
|
|
290
|
-
"canCreate": {}
|
|
309
|
+
"canCreate": {},
|
|
310
|
+
"targetLabel": {}
|
|
291
311
|
};
|
|
292
312
|
}
|
|
293
313
|
static get events() {
|
|
@@ -64,6 +64,8 @@ export class MrdDocumentList {
|
|
|
64
64
|
this.newFolderSeq = 0;
|
|
65
65
|
/** Last emitted canCreateFolder value, to only emit mrdCanCreate on change. */
|
|
66
66
|
this.lastCanCreate = false;
|
|
67
|
+
/** Last emitted upload-target label, to only emit mrdTargetLabel on change. */
|
|
68
|
+
this.lastTargetLabel = '';
|
|
67
69
|
// ── Drag & drop (move a document into another folder) ──────────────────────
|
|
68
70
|
/** The document row currently being dragged. */
|
|
69
71
|
this.dragDoc = null;
|
|
@@ -237,6 +239,22 @@ export class MrdDocumentList {
|
|
|
237
239
|
this.lastCanCreate = can;
|
|
238
240
|
this.mrdCanCreate.emit(can);
|
|
239
241
|
}
|
|
242
|
+
const label = this.targetLabel;
|
|
243
|
+
if (label !== this.lastTargetLabel) {
|
|
244
|
+
this.lastTargetLabel = label;
|
|
245
|
+
this.mrdTargetLabel.emit(label);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** Human-readable name of the node a new folder or upload lands in — the
|
|
249
|
+
* folder path when one is selected, otherwise the container's own label.
|
|
250
|
+
* Empty when there is no target at all. */
|
|
251
|
+
get targetLabel() {
|
|
252
|
+
var _a;
|
|
253
|
+
const resolved = this.resolveTarget();
|
|
254
|
+
if (!resolved)
|
|
255
|
+
return '';
|
|
256
|
+
const { target, container } = resolved;
|
|
257
|
+
return (_a = folderStringOf(target, container)) !== null && _a !== void 0 ? _a : target.label;
|
|
240
258
|
}
|
|
241
259
|
// ── Slot field names ─────────────────────────────────────────────────────
|
|
242
260
|
get containerField() {
|
|
@@ -510,12 +528,28 @@ export class MrdDocumentList {
|
|
|
510
528
|
this.dropTargetId = null;
|
|
511
529
|
if (!file)
|
|
512
530
|
return;
|
|
531
|
+
this.beginUpload(file, node, container);
|
|
532
|
+
}
|
|
533
|
+
/** Shared by the file drop and the host toolbar's upload button. */
|
|
534
|
+
beginUpload(file, node, container) {
|
|
513
535
|
this.pendingUpload = { file, node, container };
|
|
514
536
|
node.open = true;
|
|
515
537
|
this.uploadingNodeId = node.id;
|
|
516
538
|
this.bump();
|
|
517
539
|
this.mrdUpload.emit({ file });
|
|
518
540
|
}
|
|
541
|
+
/** Upload a file into the current target — the selected folder/container, or
|
|
542
|
+
* the only container when there is just one. Called by the host toolbar
|
|
543
|
+
* (mrd-document-container). No-op without a target, or while another upload
|
|
544
|
+
* is still awaiting its setFileReference. */
|
|
545
|
+
async uploadFile(file) {
|
|
546
|
+
if (!file || this.pendingUpload)
|
|
547
|
+
return;
|
|
548
|
+
const resolved = this.resolveTarget();
|
|
549
|
+
if (!resolved)
|
|
550
|
+
return;
|
|
551
|
+
this.beginUpload(file, resolved.target, resolved.container);
|
|
552
|
+
}
|
|
519
553
|
/** Host callback with the uploaded file reference. Builds the create payload
|
|
520
554
|
* from the archetype slots and requests the new document. */
|
|
521
555
|
async setFileReference(uri) {
|
|
@@ -650,7 +684,7 @@ export class MrdDocumentList {
|
|
|
650
684
|
body = renderLoadingRow(ctx, 0);
|
|
651
685
|
}
|
|
652
686
|
else if (this.containers.length === 0) {
|
|
653
|
-
body = h("div", { key: '
|
|
687
|
+
body = h("div", { key: '63604a99fc62d9108f61b8efc126c0cd3e8fc5ed', class: "mrd-document-list__empty" }, t('no_results', this.locale));
|
|
654
688
|
}
|
|
655
689
|
else if (this.singleContainer) {
|
|
656
690
|
// Dossier context: render the single container's folder tree at the root.
|
|
@@ -668,7 +702,7 @@ export class MrdDocumentList {
|
|
|
668
702
|
else {
|
|
669
703
|
body = this.containers.map(c => renderContainerNode(ctx, c, 0));
|
|
670
704
|
}
|
|
671
|
-
return (h(Host, { key: '
|
|
705
|
+
return (h(Host, { key: '2a092e3a7483deb1fb30753b0c0428aaf75c303a' }, h("div", { key: '2b716c912a272b925a95133de5b1ff2abedd9dbc', class: 'mrd-document-list' + (this.rootDropActive ? ' mrd-document-list--drop-active' : ''), onDragOver: this.onRootDragOver, onDragLeave: this.onRootDragLeave, onDrop: this.onRootDrop }, body)));
|
|
672
706
|
}
|
|
673
707
|
static get is() { return "mrd-document-list"; }
|
|
674
708
|
static get encapsulation() { return "scoped"; }
|
|
@@ -880,6 +914,21 @@ export class MrdDocumentList {
|
|
|
880
914
|
"resolved": "boolean",
|
|
881
915
|
"references": {}
|
|
882
916
|
}
|
|
917
|
+
}, {
|
|
918
|
+
"method": "mrdTargetLabel",
|
|
919
|
+
"name": "mrdTargetLabel",
|
|
920
|
+
"bubbles": true,
|
|
921
|
+
"cancelable": true,
|
|
922
|
+
"composed": true,
|
|
923
|
+
"docs": {
|
|
924
|
+
"tags": [],
|
|
925
|
+
"text": "Emitted whenever the current target changes: the folder path a new folder or\nupload lands in, or the container's label when no folder is selected. Empty\nwhen there is no target. Lets a host toolbar name the destination."
|
|
926
|
+
},
|
|
927
|
+
"complexType": {
|
|
928
|
+
"original": "string",
|
|
929
|
+
"resolved": "string",
|
|
930
|
+
"references": {}
|
|
931
|
+
}
|
|
883
932
|
}, {
|
|
884
933
|
"method": "mrdUpdateObject",
|
|
885
934
|
"name": "mrdUpdateObject",
|
|
@@ -1023,6 +1072,31 @@ export class MrdDocumentList {
|
|
|
1023
1072
|
"tags": []
|
|
1024
1073
|
}
|
|
1025
1074
|
},
|
|
1075
|
+
"uploadFile": {
|
|
1076
|
+
"complexType": {
|
|
1077
|
+
"signature": "(file: File) => Promise<void>",
|
|
1078
|
+
"parameters": [{
|
|
1079
|
+
"name": "file",
|
|
1080
|
+
"type": "File",
|
|
1081
|
+
"docs": ""
|
|
1082
|
+
}],
|
|
1083
|
+
"references": {
|
|
1084
|
+
"Promise": {
|
|
1085
|
+
"location": "global",
|
|
1086
|
+
"id": "global::Promise"
|
|
1087
|
+
},
|
|
1088
|
+
"File": {
|
|
1089
|
+
"location": "global",
|
|
1090
|
+
"id": "global::File"
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
|
+
"return": "Promise<void>"
|
|
1094
|
+
},
|
|
1095
|
+
"docs": {
|
|
1096
|
+
"text": "Upload a file into the current target \u2014 the selected folder/container, or\nthe only container when there is just one. Called by the host toolbar\n(mrd-document-container). No-op without a target, or while another upload\nis still awaiting its setFileReference.",
|
|
1097
|
+
"tags": []
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1026
1100
|
"setFileReference": {
|
|
1027
1101
|
"complexType": {
|
|
1028
1102
|
"signature": "(uri: string) => Promise<void>",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { t } from "../../../utils/i18n";
|
|
3
3
|
import { formatDate } from "../../../utils/format";
|
|
4
|
-
import { attachmentsFromRecord } from "../../../utils/document-attachments";
|
|
4
|
+
import { attachmentsFromRecord, attachmentsKey } from "../../../utils/document-attachments";
|
|
5
5
|
/**
|
|
6
6
|
* Archetype-driven single-document view. Given a `commons.document` binding and a
|
|
7
7
|
* data record, renders the document recognisably — title, date, a navigation
|
|
@@ -24,9 +24,9 @@ export class MrdDocumentView {
|
|
|
24
24
|
/** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
|
|
25
25
|
this.data = {};
|
|
26
26
|
this.locale = navigator.language;
|
|
27
|
-
/** Tracks the
|
|
27
|
+
/** Tracks the key attachments were last emitted for, so componentDidLoad and
|
|
28
28
|
* the data watcher don't emit duplicate events for the same file. */
|
|
29
|
-
this.
|
|
29
|
+
this.lastAttachmentKey = null;
|
|
30
30
|
}
|
|
31
31
|
componentDidLoad() {
|
|
32
32
|
this.emitAttachmentsIfNeeded();
|
|
@@ -35,12 +35,11 @@ export class MrdDocumentView {
|
|
|
35
35
|
this.emitAttachmentsIfNeeded();
|
|
36
36
|
}
|
|
37
37
|
emitAttachmentsIfNeeded() {
|
|
38
|
-
var _a, _b;
|
|
39
38
|
const attachments = attachmentsFromRecord(this.archetype, this.data);
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
39
|
+
const key = attachmentsKey(attachments);
|
|
40
|
+
if (key === this.lastAttachmentKey)
|
|
42
41
|
return;
|
|
43
|
-
this.
|
|
42
|
+
this.lastAttachmentKey = key;
|
|
44
43
|
this.mrdAttachments.emit({ attachments });
|
|
45
44
|
}
|
|
46
45
|
/** Value of a value-slot: reads data[field] via the slot→field map. */
|
|
@@ -88,7 +87,7 @@ export class MrdDocumentView {
|
|
|
88
87
|
const fileRaw = this.slotValue('file');
|
|
89
88
|
const fileHref = (_a = fileRaw === null || fileRaw === void 0 ? void 0 : fileRaw.href) !== null && _a !== void 0 ? _a : '';
|
|
90
89
|
const fileName = (_b = fileRaw === null || fileRaw === void 0 ? void 0 : fileRaw.fileName) !== null && _b !== void 0 ? _b : (fileRaw ? String(fileRaw) : '');
|
|
91
|
-
return (h(Host, { key: '
|
|
90
|
+
return (h(Host, { key: '405890ef9135d4e9f15532dbc669c4d8d1e8b201' }, h("div", { key: 'be60f0867664a0ded6a85b17999ab207f042d8e2', class: "mrd-document-view" }, h("div", { key: 'f0202da7e83a05f782ba70c3cff91049d56c3e04', class: "mrd-document-view__body" }, h("div", { key: '85d5075c6751200ae3840b1d9e4544792ea52b5e', class: "mrd-document-view__meta" }, title && h("h1", { key: '63a4676ef488f2b0cf2347e0aa4e3c728b2d9351', class: "mrd-document-view__title" }, title), date && h("p", { key: '4ff630a9967509f661050ba04eece5ca26773ce2', class: "mrd-document-view__date" }, date), this.renderContainer(), fileRaw && this.renderFileMeta(fileName, fileHref), summary && (h("div", { key: '412e4934755e801e8a6cd10f5d00da82f9b6aa6a', class: "mrd-document-view__summary" }, h("div", { key: 'fc5c1b88cdba2f2398d09b42ede0b4dc556cd0f3', class: "mrd-document-view__summary-body", innerHTML: summary }))))))));
|
|
92
91
|
}
|
|
93
92
|
static get is() { return "mrd-document-view"; }
|
|
94
93
|
static get encapsulation() { return "scoped"; }
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mrd-email-view {
|
|
6
|
+
max-width: 720px;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: var(--mrd-space-4);
|
|
10
|
+
}
|
|
11
|
+
.mrd-email-view__subject {
|
|
12
|
+
font-size: var(--mrd-font-size-2xl);
|
|
13
|
+
font-weight: var(--mrd-font-weight-bold);
|
|
14
|
+
color: var(--mrd-color-neutral-900);
|
|
15
|
+
letter-spacing: -0.02em;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
.mrd-email-view__header {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: var(--mrd-space-1);
|
|
22
|
+
}
|
|
23
|
+
.mrd-email-view__header-row {
|
|
24
|
+
display: flex;
|
|
25
|
+
gap: var(--mrd-space-3);
|
|
26
|
+
font-size: var(--mrd-font-size-sm);
|
|
27
|
+
}
|
|
28
|
+
.mrd-email-view__header-label {
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
width: 3rem;
|
|
31
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
32
|
+
color: var(--mrd-color-neutral-400);
|
|
33
|
+
}
|
|
34
|
+
.mrd-email-view__header-value {
|
|
35
|
+
color: var(--mrd-color-neutral-700);
|
|
36
|
+
}
|
|
37
|
+
.mrd-email-view__link {
|
|
38
|
+
background: none;
|
|
39
|
+
border: none;
|
|
40
|
+
padding: 0;
|
|
41
|
+
font-family: var(--mrd-font-family);
|
|
42
|
+
font-size: inherit;
|
|
43
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
44
|
+
color: var(--mrd-color-primary);
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
.mrd-email-view__link:hover {
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
}
|
|
50
|
+
.mrd-email-view__container-link {
|
|
51
|
+
align-self: flex-start;
|
|
52
|
+
background: none;
|
|
53
|
+
border: none;
|
|
54
|
+
padding: 0;
|
|
55
|
+
font-family: var(--mrd-font-family);
|
|
56
|
+
font-size: var(--mrd-font-size-sm);
|
|
57
|
+
font-weight: var(--mrd-font-weight-semibold);
|
|
58
|
+
color: var(--mrd-color-primary);
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
.mrd-email-view__container-link:hover {
|
|
62
|
+
text-decoration: underline;
|
|
63
|
+
}
|
|
64
|
+
.mrd-email-view__divider {
|
|
65
|
+
height: var(--mrd-border-width);
|
|
66
|
+
background: var(--mrd-color-neutral-200);
|
|
67
|
+
}
|
|
68
|
+
.mrd-email-view__body-html {
|
|
69
|
+
font-size: var(--mrd-font-size-base);
|
|
70
|
+
color: var(--mrd-color-neutral-700);
|
|
71
|
+
line-height: var(--mrd-line-height-relaxed);
|
|
72
|
+
word-break: break-word;
|
|
73
|
+
}
|
|
74
|
+
.mrd-email-view__body-text {
|
|
75
|
+
font-size: var(--mrd-font-size-base);
|
|
76
|
+
color: var(--mrd-color-neutral-700);
|
|
77
|
+
line-height: var(--mrd-line-height-relaxed);
|
|
78
|
+
white-space: pre-wrap;
|
|
79
|
+
word-break: break-word;
|
|
80
|
+
}
|
|
81
|
+
.mrd-email-view__attachments {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
gap: var(--mrd-space-2);
|
|
85
|
+
}
|
|
86
|
+
.mrd-email-view__attachment {
|
|
87
|
+
display: inline-flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
gap: var(--mrd-space-2);
|
|
90
|
+
align-self: flex-start;
|
|
91
|
+
height: 2rem;
|
|
92
|
+
padding: 0 var(--mrd-space-3);
|
|
93
|
+
background: var(--mrd-color-white);
|
|
94
|
+
border: 1px solid var(--mrd-color-neutral-300);
|
|
95
|
+
border-radius: var(--mrd-border-radius);
|
|
96
|
+
font-family: var(--mrd-font-family);
|
|
97
|
+
font-size: var(--mrd-font-size-sm);
|
|
98
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
99
|
+
color: var(--mrd-color-neutral-700);
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
.mrd-email-view__attachment:hover {
|
|
103
|
+
background: var(--mrd-color-neutral-100);
|
|
104
|
+
color: var(--mrd-color-neutral-900);
|
|
105
|
+
}
|
|
106
|
+
.mrd-email-view__attachment-icon {
|
|
107
|
+
width: 0.9375rem;
|
|
108
|
+
height: 0.9375rem;
|
|
109
|
+
flex-shrink: 0;
|
|
110
|
+
}
|
|
111
|
+
.mrd-email-view__headers {
|
|
112
|
+
font-size: var(--mrd-font-size-xs);
|
|
113
|
+
color: var(--mrd-color-neutral-400);
|
|
114
|
+
}
|
|
115
|
+
.mrd-email-view__headers summary {
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
118
|
+
}
|
|
119
|
+
.mrd-email-view__headers-body {
|
|
120
|
+
margin: var(--mrd-space-2) 0 0 0;
|
|
121
|
+
padding: var(--mrd-space-3);
|
|
122
|
+
background: var(--mrd-color-neutral-50);
|
|
123
|
+
border-radius: var(--mrd-border-radius);
|
|
124
|
+
white-space: pre-wrap;
|
|
125
|
+
word-break: break-word;
|
|
126
|
+
}
|