@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.
Files changed (117) hide show
  1. package/dist/cjs/{cell-renderer-CmaO0CZT.js → cell-renderer-Coy-aD3k.js} +146 -1
  2. package/dist/cjs/{client-layout-RZ3Ix-4a.js → client-layout-CqVuJumR.js} +9 -0
  3. package/dist/cjs/{index-DzRfoAPz.js → index-DVbdkYO3.js} +468 -6
  4. package/dist/cjs/index.cjs.js +4 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/mosterdcomponents.cjs.js +2 -2
  7. package/dist/cjs/{mrd-boolean-field_23.cjs.entry.js → mrd-boolean-field_25.cjs.entry.js} +5696 -5229
  8. package/dist/cjs/mrd-merge-view.cjs.entry.js +5 -5
  9. package/dist/collection/collection-manifest.json +2 -0
  10. package/dist/collection/components/documents/mrd-document-container/mrd-document-container.css +3 -0
  11. package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +23 -3
  12. package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +76 -2
  13. package/dist/collection/components/documents/mrd-document-view/mrd-document-view.js +7 -8
  14. package/dist/collection/components/email/mrd-email-view/mrd-email-view.css +126 -0
  15. package/dist/collection/components/email/mrd-email-view/mrd-email-view.js +247 -0
  16. package/dist/collection/components/fields/file-upload-common.js +23 -7
  17. package/dist/collection/components/fields/mrd-boolean-field/mrd-boolean-field.js +1 -1
  18. package/dist/collection/components/fields/mrd-currency-field/mrd-currency-field.js +1 -1
  19. package/dist/collection/components/fields/mrd-date-field/mrd-date-field.js +1 -1
  20. package/dist/collection/components/fields/mrd-datetime-field/mrd-datetime-field.js +1 -1
  21. package/dist/collection/components/fields/mrd-email-field/mrd-email-field.js +1 -1
  22. package/dist/collection/components/fields/mrd-file-field/mrd-file-field.css +20 -1
  23. package/dist/collection/components/fields/mrd-file-field/mrd-file-field.js +108 -47
  24. package/dist/collection/components/fields/mrd-image-field/mrd-image-field.css +44 -0
  25. package/dist/collection/components/fields/mrd-image-field/mrd-image-field.js +126 -58
  26. package/dist/collection/components/fields/mrd-longtext-field/mrd-longtext-field.js +1 -1
  27. package/dist/collection/components/fields/mrd-number-field/mrd-number-field.js +1 -1
  28. package/dist/collection/components/fields/mrd-relation-field/mrd-relation-field.js +13 -3
  29. package/dist/collection/components/fields/mrd-secret-field/mrd-secret-field.js +2 -2
  30. package/dist/collection/components/fields/mrd-text-field/mrd-text-field.js +1 -1
  31. package/dist/collection/components/fields/mrd-textarea-field/mrd-textarea-field.js +1 -1
  32. package/dist/collection/components/fields/mrd-time-field/mrd-time-field.js +1 -1
  33. package/dist/collection/components/form/mrd-field/mrd-field.js +5 -5
  34. package/dist/collection/components/form/mrd-form/mrd-form.js +63 -10
  35. package/dist/collection/components/invoice/mrd-invoice-view/mrd-invoice-view.css +145 -0
  36. package/dist/collection/components/invoice/mrd-invoice-view/mrd-invoice-view.js +281 -0
  37. package/dist/collection/components/layout/mrd-layout-section/field-value.js +9 -3
  38. package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +6 -0
  39. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +14 -0
  40. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +45 -15
  41. package/dist/collection/components/merge/mrd-merge-view/mrd-merge-view.js +2 -2
  42. package/dist/collection/dev/api.js +20 -5
  43. package/dist/collection/dev/app.js +51 -13
  44. package/dist/collection/dev/example-data.js +132 -3
  45. package/dist/collection/types/client-layout.js +6 -0
  46. package/dist/collection/utils/document-attachments.js +27 -14
  47. package/dist/collection/utils/i18n.js +144 -0
  48. package/dist/components/cell-renderer.js +1 -1
  49. package/dist/components/client-layout.js +1 -1
  50. package/dist/components/document-attachments.js +1 -1
  51. package/dist/components/file-upload-common.js +1 -1
  52. package/dist/components/format.js +1 -1
  53. package/dist/components/i18n.js +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/components/mrd-boolean-field2.js +1 -1
  56. package/dist/components/mrd-currency-field2.js +1 -1
  57. package/dist/components/mrd-date-field2.js +1 -1
  58. package/dist/components/mrd-datetime-field2.js +1 -1
  59. package/dist/components/mrd-document-container2.js +1 -1
  60. package/dist/components/mrd-document-list2.js +1 -1
  61. package/dist/components/mrd-document-view2.js +1 -1
  62. package/dist/components/mrd-email-field2.js +1 -1
  63. package/dist/components/mrd-email-view.d.ts +11 -0
  64. package/dist/components/mrd-email-view.js +1 -0
  65. package/dist/components/mrd-email-view2.js +1 -0
  66. package/dist/components/mrd-field2.js +1 -1
  67. package/dist/components/mrd-file-field2.js +1 -1
  68. package/dist/components/mrd-form.js +1 -1
  69. package/dist/components/mrd-image-field2.js +1 -1
  70. package/dist/components/mrd-invoice-view.d.ts +11 -0
  71. package/dist/components/mrd-invoice-view.js +1 -0
  72. package/dist/components/mrd-invoice-view2.js +1 -0
  73. package/dist/components/mrd-layout-section.js +1 -1
  74. package/dist/components/mrd-longtext-field2.js +1 -1
  75. package/dist/components/mrd-merge-view.js +1 -1
  76. package/dist/components/mrd-number-field2.js +1 -1
  77. package/dist/components/mrd-relation-field2.js +1 -1
  78. package/dist/components/mrd-secret-field2.js +1 -1
  79. package/dist/components/mrd-table2.js +1 -1
  80. package/dist/components/mrd-text-field2.js +1 -1
  81. package/dist/components/mrd-textarea-field2.js +1 -2
  82. package/dist/components/mrd-time-field2.js +1 -1
  83. package/dist/components/purify.es.js +2 -0
  84. package/dist/esm/{cell-renderer-D63AUZxa.js → cell-renderer-C2FLUrMN.js} +146 -2
  85. package/dist/esm/{client-layout-DCOAAH92.js → client-layout-Bc42CfJB.js} +7 -1
  86. package/dist/esm/{index-DiSe6vjv.js → index-CDiBvvJU.js} +468 -6
  87. package/dist/esm/index.js +1 -1
  88. package/dist/esm/loader.js +3 -3
  89. package/dist/esm/mosterdcomponents.js +3 -3
  90. package/dist/esm/{mrd-boolean-field_23.entry.js → mrd-boolean-field_25.entry.js} +5695 -5230
  91. package/dist/esm/mrd-merge-view.entry.js +5 -5
  92. package/dist/mosterdcomponents/index.esm.js +1 -1
  93. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  94. package/dist/mosterdcomponents/{p-2e16a7d0.entry.js → p-4ea5b97c.entry.js} +1 -1
  95. package/dist/mosterdcomponents/p-8736313b.entry.js +3 -0
  96. package/dist/mosterdcomponents/{p-DCOAAH92.js → p-Bc42CfJB.js} +1 -1
  97. package/dist/mosterdcomponents/p-BgsPVesg.js +1 -0
  98. package/dist/mosterdcomponents/p-CDiBvvJU.js +2 -0
  99. package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +7 -0
  100. package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +17 -0
  101. package/dist/types/components/documents/mrd-document-view/mrd-document-view.d.ts +2 -2
  102. package/dist/types/components/email/mrd-email-view/mrd-email-view.d.ts +52 -0
  103. package/dist/types/components/fields/file-upload-common.d.ts +19 -1
  104. package/dist/types/components/fields/mrd-file-field/mrd-file-field.d.ts +24 -10
  105. package/dist/types/components/fields/mrd-image-field/mrd-image-field.d.ts +27 -11
  106. package/dist/types/components/fields/mrd-relation-field/mrd-relation-field.d.ts +7 -0
  107. package/dist/types/components/form/mrd-form/mrd-form.d.ts +19 -3
  108. package/dist/types/components/invoice/mrd-invoice-view/mrd-invoice-view.d.ts +60 -0
  109. package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +3 -0
  110. package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +13 -0
  111. package/dist/types/components.d.ts +303 -19
  112. package/dist/types/types/client-layout.d.ts +13 -0
  113. package/dist/types/utils/document-attachments.d.ts +12 -5
  114. package/package.json +1 -1
  115. package/dist/mosterdcomponents/p-CnqDM0Gb.js +0 -1
  116. package/dist/mosterdcomponents/p-DiSe6vjv.js +0 -2
  117. package/dist/mosterdcomponents/p-b5f38707.entry.js +0 -3
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DzRfoAPz.js');
4
- var clientLayout = require('./client-layout-RZ3Ix-4a.js');
5
- var cellRenderer = require('./cell-renderer-CmaO0CZT.js');
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: '4b79504f62f85274c9cd9681b6819c2318f4246a', locale: this.locale, searchQuery: this.searchQuery, searchResults: this.searchResults, isLoading: this.isLoading, onSearchInput: this.handleSearchInput, onSelect: this.handleSelect }));
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: 'f3fc046fa728646e2ff686d2eae30024da3121e1' }, index.h("div", { key: '55bef786973d22dce49be021cfb78588b119139c', class: "mrd-merge-view" }, stepContent)));
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"
@@ -42,6 +42,9 @@
42
42
  opacity: 0.5;
43
43
  cursor: not-allowed;
44
44
  }
45
+ .mrd-document-container__file-input {
46
+ display: none;
47
+ }
45
48
  .mrd-document-container__seg {
46
49
  display: inline-flex;
47
50
  gap: 2px;
@@ -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: '4d21f26c956773c63cbf5118394c6afa29d6014d' }, this.renderToolbar(), h("div", { key: 'bc070236bf9a7d0eba57aa2cd70fa3ae36cbf5f1', class: {
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: '308725d741deb384082bd514edd34593f7d662a2', class: "mrd-document-list__empty" }, t('no_results', this.locale));
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: '9d5fde912999b57a0f0b737980d59e94f385f11d' }, h("div", { key: '17191411c2e626995f08b66bad755342fe3b13ae', class: 'mrd-document-list' + (this.rootDropActive ? ' mrd-document-list--drop-active' : ''), onDragOver: this.onRootDragOver, onDragLeave: this.onRootDragLeave, onDrop: this.onRootDrop }, body)));
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 href attachments were last emitted for, so componentDidLoad and
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.lastAttachmentHref = null;
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 href = (_b = (_a = attachments[0]) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : null;
41
- if (href === this.lastAttachmentHref)
39
+ const key = attachmentsKey(attachments);
40
+ if (key === this.lastAttachmentKey)
42
41
  return;
43
- this.lastAttachmentHref = href;
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: 'd4e8d4a6c5c66677df3d4e80943fc4538d9a2be7' }, h("div", { key: 'c67bb1742590dc3ab3cec959f20dfa9030268411', class: "mrd-document-view" }, h("div", { key: '5da6e15d1f67990a9ee06bc07b717e5fa17a2ee7', class: "mrd-document-view__body" }, h("div", { key: '0fc38933add3fff48096c48d2fb6cd06fb5d1eac', class: "mrd-document-view__meta" }, title && h("h1", { key: 'e9ac8d99f9afae6b64dd7e6bd461c54b92a6ea39', class: "mrd-document-view__title" }, title), date && h("p", { key: '8591d77b300ed3c021cfa64b8e9564dee98199cd', class: "mrd-document-view__date" }, date), this.renderContainer(), fileRaw && this.renderFileMeta(fileName, fileHref), summary && (h("div", { key: '8a6d630afcf187fa86c9bab77d06d93695fd5c9f', class: "mrd-document-view__summary" }, h("div", { key: 'bd98e2cf740d08837accd8d260973d4e51cd24f7', class: "mrd-document-view__summary-body", innerHTML: summary }))))))));
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
+ }