@mmlogic/components 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cell-renderer-7KX9Qbml.js +983 -0
- 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} +3017 -951
- package/dist/cjs/mrd-merge-view.cjs.entry.js +273 -0
- package/dist/collection/collection-manifest.json +3 -0
- 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-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 +9 -5
- 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 +55 -6
- 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 +5 -1
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +10 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +38 -8
- package/dist/collection/components/merge/mrd-merge-view/merge-diff.js +99 -0
- package/dist/collection/components/merge/mrd-merge-view/merge-parts.js +44 -0
- package/dist/collection/components/merge/mrd-merge-view/mrd-merge-view.css +244 -0
- package/dist/collection/components/merge/mrd-merge-view/mrd-merge-view.js +397 -0
- package/dist/collection/dev/api.js +41 -2
- package/dist/collection/dev/app.js +135 -17
- package/dist/collection/dev/example-data.js +126 -2
- package/dist/collection/types/client-layout.js +6 -0
- package/dist/collection/utils/cell-renderer.js +6 -1
- package/dist/collection/utils/document-attachments.js +27 -14
- package/dist/collection/utils/i18n.js +224 -0
- package/dist/components/cell-renderer.js +1 -0
- 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-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.d.ts +11 -0
- package/dist/components/mrd-merge-view.js +1 -0
- package/dist/components/mrd-number-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 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/components/purify.es.js +2 -0
- package/dist/esm/cell-renderer-DIsNX9D7.js +974 -0
- 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} +2949 -885
- package/dist/esm/mrd-merge-view.entry.js +271 -0
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-4e061416.entry.js +1 -0
- package/dist/mosterdcomponents/p-910ebfee.entry.js +3 -0
- package/dist/mosterdcomponents/{p-DCOAAH92.js → p-Bc42CfJB.js} +1 -1
- package/dist/mosterdcomponents/p-CDiBvvJU.js +2 -0
- package/dist/mosterdcomponents/p-Ce2QDq0t.js +1 -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-textarea-field/mrd-textarea-field.d.ts +1 -0
- package/dist/types/components/form/mrd-form/mrd-form.d.ts +16 -1
- package/dist/types/components/invoice/mrd-invoice-view/mrd-invoice-view.d.ts +60 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +13 -0
- package/dist/types/components/merge/mrd-merge-view/merge-diff.d.ts +43 -0
- package/dist/types/components/merge/mrd-merge-view/merge-parts.d.ts +37 -0
- package/dist/types/components/merge/mrd-merge-view/mrd-merge-view.d.ts +68 -0
- package/dist/types/components.d.ts +445 -19
- package/dist/types/types/client-layout.d.ts +6 -0
- package/dist/types/utils/document-attachments.d.ts +12 -5
- package/package.json +2 -1
- package/dist/mosterdcomponents/p-DiSe6vjv.js +0 -2
- package/dist/mosterdcomponents/p-cdecc698.entry.js +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import DOMPurify from "dompurify";
|
|
3
|
+
import { t } from "../../../utils/i18n";
|
|
4
|
+
import { formatDateTime } from "../../../utils/format";
|
|
5
|
+
import { attachmentsFromRecord, attachmentsKey } from "../../../utils/document-attachments";
|
|
6
|
+
/**
|
|
7
|
+
* Archetype-driven single-email view. Given a `commons.email` binding and a data
|
|
8
|
+
* record, renders the message the way an Outlook printout would — subject, a
|
|
9
|
+
* compact From/To/CC/Date header block, the body and attachments — instead of a
|
|
10
|
+
* generic field form. Fully read-only: emails arrive through other channels (mail
|
|
11
|
+
* ingestion gateways), never edited here.
|
|
12
|
+
*
|
|
13
|
+
* Like `mrd-document-view`/`mrd-invoice-view`, this component never resolves file
|
|
14
|
+
* hrefs itself — it only exposes attachment references via `mrdAttachments` (an
|
|
15
|
+
* email can have several) and plain download buttons; the host decides how/whether
|
|
16
|
+
* to render them.
|
|
17
|
+
*/
|
|
18
|
+
export class MrdEmailView {
|
|
19
|
+
constructor() {
|
|
20
|
+
/** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
|
|
21
|
+
this.data = {};
|
|
22
|
+
this.locale = navigator.language;
|
|
23
|
+
/** Tracks the key attachments were last emitted for, so componentDidLoad and the
|
|
24
|
+
* data watcher don't emit duplicate events for the same set of files. */
|
|
25
|
+
this.lastAttachmentKey = null;
|
|
26
|
+
}
|
|
27
|
+
componentDidLoad() {
|
|
28
|
+
this.emitAttachmentsIfNeeded();
|
|
29
|
+
}
|
|
30
|
+
dataChanged() {
|
|
31
|
+
this.emitAttachmentsIfNeeded();
|
|
32
|
+
}
|
|
33
|
+
emitAttachmentsIfNeeded() {
|
|
34
|
+
const attachments = attachmentsFromRecord(this.archetype, this.data, 'attachments');
|
|
35
|
+
const key = attachmentsKey(attachments);
|
|
36
|
+
if (key === this.lastAttachmentKey)
|
|
37
|
+
return;
|
|
38
|
+
this.lastAttachmentKey = key;
|
|
39
|
+
this.mrdAttachments.emit({ attachments });
|
|
40
|
+
}
|
|
41
|
+
/** Value of a value-slot: reads data[field] via the slot→field map. */
|
|
42
|
+
slotValue(slot) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
45
|
+
if (!field)
|
|
46
|
+
return undefined;
|
|
47
|
+
return this.data[field];
|
|
48
|
+
}
|
|
49
|
+
/** Relation link for a relation-slot: reads data._links[field]. */
|
|
50
|
+
slotLink(slot) {
|
|
51
|
+
var _a, _b, _c, _d;
|
|
52
|
+
const field = (_b = (_a = this.archetype) === null || _a === void 0 ? void 0 : _a.slots) === null || _b === void 0 ? void 0 : _b[slot];
|
|
53
|
+
if (!field)
|
|
54
|
+
return undefined;
|
|
55
|
+
const links = ((_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c._links) !== null && _d !== void 0 ? _d : {});
|
|
56
|
+
return links[field];
|
|
57
|
+
}
|
|
58
|
+
renderAddressRow(slot, label) {
|
|
59
|
+
var _a;
|
|
60
|
+
const link = this.slotLink(slot);
|
|
61
|
+
const entries = ((_a = link === null || link === void 0 ? void 0 : link.values) === null || _a === void 0 ? void 0 : _a.length)
|
|
62
|
+
? link.values
|
|
63
|
+
: (link === null || link === void 0 ? void 0 : link.href) && (link === null || link === void 0 ? void 0 : link.name) ? [{ href: link.href, name: link.name }] : [];
|
|
64
|
+
if (!entries.length)
|
|
65
|
+
return null;
|
|
66
|
+
return (h("div", { class: "mrd-email-view__header-row" }, h("span", { class: "mrd-email-view__header-label" }, label), h("span", { class: "mrd-email-view__header-value" }, entries.map((entry, i) => (h("span", { key: entry.href }, h("button", { type: "button", class: "mrd-email-view__link", onClick: () => this.mrdNavigate.emit({ href: entry.href, label: entry.name }) }, entry.name), i < entries.length - 1 ? ', ' : ''))))));
|
|
67
|
+
}
|
|
68
|
+
renderContainer() {
|
|
69
|
+
const link = this.slotLink('container');
|
|
70
|
+
if (!(link === null || link === void 0 ? void 0 : link.href) || !link.name)
|
|
71
|
+
return null;
|
|
72
|
+
return (h("button", { type: "button", class: "mrd-email-view__container-link", onClick: () => this.mrdNavigate.emit({ href: link.href, label: link.name }) }, link.name));
|
|
73
|
+
}
|
|
74
|
+
renderBody() {
|
|
75
|
+
const bodyHtmlRaw = this.slotValue('bodyHtml');
|
|
76
|
+
if (bodyHtmlRaw != null && bodyHtmlRaw !== '') {
|
|
77
|
+
return h("div", { class: "mrd-email-view__body-html", innerHTML: DOMPurify.sanitize(String(bodyHtmlRaw)) });
|
|
78
|
+
}
|
|
79
|
+
const bodyTextRaw = this.slotValue('bodyText');
|
|
80
|
+
if (bodyTextRaw != null && bodyTextRaw !== '') {
|
|
81
|
+
return h("div", { class: "mrd-email-view__body-text" }, String(bodyTextRaw));
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
renderHeaders() {
|
|
86
|
+
const headersRaw = this.slotValue('headers');
|
|
87
|
+
if (headersRaw == null || headersRaw === '')
|
|
88
|
+
return null;
|
|
89
|
+
return (h("details", { class: "mrd-email-view__headers" }, h("summary", null, t('email_show_headers', this.locale)), h("pre", { class: "mrd-email-view__headers-body" }, String(headersRaw))));
|
|
90
|
+
}
|
|
91
|
+
renderAttachments() {
|
|
92
|
+
const attachments = attachmentsFromRecord(this.archetype, this.data, 'attachments');
|
|
93
|
+
if (!attachments.length)
|
|
94
|
+
return null;
|
|
95
|
+
return (h("div", { class: "mrd-email-view__attachments" }, attachments.map(a => (h("button", { type: "button", key: a.href, class: "mrd-email-view__attachment", onClick: () => this.mrdDownload.emit({ href: a.href, fileName: a.fileName }) }, h("svg", { class: "mrd-email-view__attachment-icon", 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.44 11.05l-9.19 9.19a5 5 0 01-7.07-7.07l9.19-9.19a3 3 0 014.24 4.24l-9.2 9.19a1 1 0 01-1.41-1.41l8.49-8.48" })), a.fileName)))));
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
const subjectRaw = this.slotValue('subject');
|
|
99
|
+
const subject = subjectRaw != null && subjectRaw !== '' ? String(subjectRaw) : null;
|
|
100
|
+
const dateRaw = this.slotValue('date');
|
|
101
|
+
return (h(Host, { key: '3f36e4df048a71075193d61d0455f94a9121cacf' }, h("div", { key: '164a3d686a462ede237d1aa0892c041ec7ee30b5', class: "mrd-email-view" }, subject && h("h1", { key: '46111bedb40e60189f00232ec5f670c9d027c781', class: "mrd-email-view__subject" }, subject), h("div", { key: '492616cf77aa2351c680509c14328178426be7ed', class: "mrd-email-view__header" }, this.renderAddressRow('from', t('email_from', this.locale)), this.renderAddressRow('to', t('email_to', this.locale)), this.renderAddressRow('cc', t('email_cc', this.locale)), dateRaw != null && dateRaw !== '' && (h("div", { key: 'bc89fb4adec45280b3cbb7216455a7a8a5530f51', class: "mrd-email-view__header-row" }, h("span", { key: '2c0a90c5061261b8b70ba3eb0bf8b9fab793cc7d', class: "mrd-email-view__header-label" }, t('email_date', this.locale)), h("span", { key: 'de3edda49ec15795c9e91297ade9535f06b53b29', class: "mrd-email-view__header-value" }, formatDateTime(dateRaw, this.locale))))), this.renderContainer(), h("div", { key: '6e834f73168f167dac9b90a492db168b0dacc62e', class: "mrd-email-view__divider" }), this.renderBody(), this.renderAttachments(), this.renderHeaders())));
|
|
102
|
+
}
|
|
103
|
+
static get is() { return "mrd-email-view"; }
|
|
104
|
+
static get encapsulation() { return "scoped"; }
|
|
105
|
+
static get originalStyleUrls() {
|
|
106
|
+
return {
|
|
107
|
+
"$": ["mrd-email-view.scss"]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static get styleUrls() {
|
|
111
|
+
return {
|
|
112
|
+
"$": ["mrd-email-view.css"]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
static get properties() {
|
|
116
|
+
return {
|
|
117
|
+
"archetype": {
|
|
118
|
+
"type": "unknown",
|
|
119
|
+
"mutable": false,
|
|
120
|
+
"complexType": {
|
|
121
|
+
"original": "ClientArchetype",
|
|
122
|
+
"resolved": "ClientArchetype",
|
|
123
|
+
"references": {
|
|
124
|
+
"ClientArchetype": {
|
|
125
|
+
"location": "import",
|
|
126
|
+
"path": "../../../types/client-layout",
|
|
127
|
+
"id": "src/types/client-layout.ts::ClientArchetype",
|
|
128
|
+
"referenceLocation": "ClientArchetype"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"required": true,
|
|
133
|
+
"optional": false,
|
|
134
|
+
"docs": {
|
|
135
|
+
"tags": [],
|
|
136
|
+
"text": "Resolved `commons.email` binding: slot name \u2192 concrete field/relation name."
|
|
137
|
+
},
|
|
138
|
+
"getter": false,
|
|
139
|
+
"setter": false
|
|
140
|
+
},
|
|
141
|
+
"data": {
|
|
142
|
+
"type": "unknown",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "Record<string, unknown>",
|
|
146
|
+
"resolved": "string | unknown",
|
|
147
|
+
"references": {
|
|
148
|
+
"Record": {
|
|
149
|
+
"location": "global",
|
|
150
|
+
"id": "global::Record"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "The data record from the /data endpoint. Fields keyed by name; relations under `_links`."
|
|
159
|
+
},
|
|
160
|
+
"getter": false,
|
|
161
|
+
"setter": false,
|
|
162
|
+
"defaultValue": "{}"
|
|
163
|
+
},
|
|
164
|
+
"locale": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"mutable": false,
|
|
167
|
+
"complexType": {
|
|
168
|
+
"original": "string",
|
|
169
|
+
"resolved": "string",
|
|
170
|
+
"references": {}
|
|
171
|
+
},
|
|
172
|
+
"required": false,
|
|
173
|
+
"optional": false,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": ""
|
|
177
|
+
},
|
|
178
|
+
"getter": false,
|
|
179
|
+
"setter": false,
|
|
180
|
+
"reflect": false,
|
|
181
|
+
"attribute": "locale",
|
|
182
|
+
"defaultValue": "navigator.language"
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
static get events() {
|
|
187
|
+
return [{
|
|
188
|
+
"method": "mrdNavigate",
|
|
189
|
+
"name": "mrdNavigate",
|
|
190
|
+
"bubbles": true,
|
|
191
|
+
"cancelable": true,
|
|
192
|
+
"composed": true,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Navigate to a sender/recipient or the container. Host resolves the href and routes."
|
|
196
|
+
},
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "{ href?: string; label: string }",
|
|
199
|
+
"resolved": "{ href?: string | undefined; label: string; }",
|
|
200
|
+
"references": {}
|
|
201
|
+
}
|
|
202
|
+
}, {
|
|
203
|
+
"method": "mrdDownload",
|
|
204
|
+
"name": "mrdDownload",
|
|
205
|
+
"bubbles": true,
|
|
206
|
+
"cancelable": true,
|
|
207
|
+
"composed": true,
|
|
208
|
+
"docs": {
|
|
209
|
+
"tags": [],
|
|
210
|
+
"text": "Download an attachment. Host resolves the href to a signed URL."
|
|
211
|
+
},
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "{ href: string; fileName: string }",
|
|
214
|
+
"resolved": "{ href: string; fileName: string; }",
|
|
215
|
+
"references": {}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
"method": "mrdAttachments",
|
|
219
|
+
"name": "mrdAttachments",
|
|
220
|
+
"bubbles": true,
|
|
221
|
+
"cancelable": true,
|
|
222
|
+
"composed": true,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "The file(s) belonging to this email, fired once on load and again whenever the\nattachments slot's value changes. The host resolves the href(s) itself."
|
|
226
|
+
},
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "{ attachments: DocumentAttachment[] }",
|
|
229
|
+
"resolved": "{ attachments: DocumentAttachment[]; }",
|
|
230
|
+
"references": {
|
|
231
|
+
"DocumentAttachment": {
|
|
232
|
+
"location": "import",
|
|
233
|
+
"path": "../../../types/client-layout",
|
|
234
|
+
"id": "src/types/client-layout.ts::DocumentAttachment",
|
|
235
|
+
"referenceLocation": "DocumentAttachment"
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}];
|
|
240
|
+
}
|
|
241
|
+
static get watchers() {
|
|
242
|
+
return [{
|
|
243
|
+
"propName": "data",
|
|
244
|
+
"methodName": "dataChanged"
|
|
245
|
+
}];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import { t } from "../../utils/i18n";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
/** True while the entry is still a local `File` awaiting upload resolution. */
|
|
3
|
+
export function isPending(entry) {
|
|
4
|
+
return entry instanceof File;
|
|
5
|
+
}
|
|
6
|
+
/** Display name for an entry: the `File`'s own name, the resolved `fileName`, or — for the
|
|
7
|
+
* legacy bare-href shape — a best-effort basename of the URI. */
|
|
8
|
+
export function entryLabel(entry) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (entry instanceof File)
|
|
11
|
+
return entry.name;
|
|
12
|
+
if (typeof entry !== 'string')
|
|
13
|
+
return entry.fileName || entry.href;
|
|
14
|
+
const base = (_a = entry.split('/').pop()) !== null && _a !== void 0 ? _a : entry;
|
|
15
|
+
try {
|
|
16
|
+
return decodeURIComponent(base);
|
|
17
|
+
}
|
|
18
|
+
catch (_b) {
|
|
19
|
+
return base;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
6
22
|
/** Validates a selected/dropped file; returns a localised error message or '' when accepted. */
|
|
7
23
|
export function validateUploadFile(file, maxSize, locale, requireImage = false) {
|
|
8
24
|
if (maxSize > 0 && file.size > maxSize)
|
|
@@ -21,7 +37,7 @@ export function uploadZoneClass(base, opts) {
|
|
|
21
37
|
].filter(Boolean).join(' ');
|
|
22
38
|
}
|
|
23
39
|
/** Drag-drop handlers for the drop zone; the component owns the dragging state and file handling. */
|
|
24
|
-
export function makeDragHandlers(setDragging,
|
|
40
|
+
export function makeDragHandlers(setDragging, onFiles) {
|
|
25
41
|
return {
|
|
26
42
|
onDragOver: (e) => {
|
|
27
43
|
e.preventDefault();
|
|
@@ -29,10 +45,10 @@ export function makeDragHandlers(setDragging, onFile) {
|
|
|
29
45
|
},
|
|
30
46
|
onDragLeave: () => setDragging(false),
|
|
31
47
|
onDrop: (e) => {
|
|
32
|
-
var _a, _b
|
|
48
|
+
var _a, _b;
|
|
33
49
|
e.preventDefault();
|
|
34
50
|
setDragging(false);
|
|
35
|
-
|
|
51
|
+
onFiles(Array.from((_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []));
|
|
36
52
|
},
|
|
37
53
|
};
|
|
38
54
|
}
|
|
@@ -20,7 +20,7 @@ export class MrdBooleanField {
|
|
|
20
20
|
this.checked = !!this.value;
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: 'd60835bfd40ab3708692991f3c9862dfcbe98191' }, h("div", { key: 'b6ab1893b75f2a826e4bbac11a465e3d2b88f5d7', class: "mrd-boolean-field" }, h("label", { key: '86562c85d903cbf7295e69a11c4c724f0f8beeb5', class: "mrd-boolean-field__toggle-label" }, h("input", { key: '3e92957abb190ff8d0b9c3294c44cb27b81947d0', class: "mrd-boolean-field__checkbox", type: "checkbox", name: this.name, checked: this.checked, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), h("span", { key: 'b632d9da279ebb823120e38540506568bff9ebbb', class: "mrd-boolean-field__toggle", "aria-hidden": "true" }), this.label && (h("span", { key: '9e0eeb0ba9056bf5ae18b893c0566fed2ad2fda2', class: `mrd-boolean-field__text${this.required ? ' mrd-boolean-field__text--required' : ''}` }, this.label))))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "mrd-boolean-field"; }
|
|
26
26
|
static get encapsulation() { return "scoped"; }
|
|
@@ -42,7 +42,7 @@ export class MrdCurrencyField {
|
|
|
42
42
|
}
|
|
43
43
|
render() {
|
|
44
44
|
const hasError = !!this.error;
|
|
45
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: 'e1a76ab778820c0d781d5ec1549448716d368c1f' }, h("div", { key: '8298720abac7f689fe3e697c3c4410702e6a87f2', class: "mrd-currency-field" }, h(FieldLabel, { key: 'b23782aef9a866f1fb72e152cb91aeae00a975fa', base: "mrd-currency-field", label: this.label, required: this.required }), h("div", { key: '51e5177f9be3c5a6bdf3a5c1187f9261fcc349cf', class: "mrd-currency-field__row" }, h("input", { key: 'c6bda6cc92f3a2a34861d44b6163d417e200a6e4', class: controlClass('mrd-currency-field', hasError, 'amount'), type: "text", inputMode: "decimal", name: `${this.name}_amount`, value: this.amountDisplay, placeholder: "0.00", required: this.required, disabled: this.disabled, onInput: this.handleAmountInput, onBlur: this.handleAmountBlur }), h("select", { key: '29231cfa142d26aa81594609f1bf7bd5168df073', class: "mrd-currency-field__currency", disabled: this.disabled, onChange: this.handleCurrencyChange }, COMMON_CURRENCIES.map(c => (h("option", { key: c, value: c, selected: c === this.currency }, c))))), h(FieldError, { key: 'bea9615466427631f08a6ac8a779ae77695d36e3', base: "mrd-currency-field", error: this.error }))));
|
|
46
46
|
}
|
|
47
47
|
static get is() { return "mrd-currency-field"; }
|
|
48
48
|
static get encapsulation() { return "scoped"; }
|
|
@@ -20,7 +20,7 @@ export class MrdDateField {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: 'd83beef11c2b9402e251a50885b92e7a057f02ee' }, h("div", { key: '6a26e4969e9bde8c5c87771d7b8c7b4d6c1dd942', class: "mrd-date-field" }, h(FieldLabel, { key: 'a7bc1b1c56e933a51f6b1b1feb794a4678d9d334', base: "mrd-date-field", label: this.label, required: this.required }), h("input", { key: '82e3855654f3b3c554f80d647e783234cca8dae1', class: controlClass('mrd-date-field', !!this.error), type: "date", name: this.name, value: this.value, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), h(FieldError, { key: '294b3cdc1004725267aa8265366f5009ab324203', base: "mrd-date-field", error: this.error }))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "mrd-date-field"; }
|
|
26
26
|
static get encapsulation() { return "scoped"; }
|
|
@@ -47,7 +47,7 @@ export class MrdDatetimeField {
|
|
|
47
47
|
return d.toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
48
48
|
}
|
|
49
49
|
render() {
|
|
50
|
-
return (h(Host, { key: '
|
|
50
|
+
return (h(Host, { key: '6f8020590ac879992058aa9547b90c11250fa303' }, h("div", { key: '76abff48cae58d156540181a6577729a449bb888', class: "mrd-datetime-field" }, h(FieldLabel, { key: 'a8c3688980347a27d6467987f11a3c4135ac5234', base: "mrd-datetime-field", label: this.label, required: this.required }), h("input", { key: '1bb1aa7536a6a82313f51240030c828028cafd76', class: controlClass('mrd-datetime-field', !!this.error), type: "datetime-local", name: this.name, value: this.localValue, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), h(FieldError, { key: 'c97301640980bf04311751124fc8e87023d59f87', base: "mrd-datetime-field", error: this.error }))));
|
|
51
51
|
}
|
|
52
52
|
static get is() { return "mrd-datetime-field"; }
|
|
53
53
|
static get encapsulation() { return "scoped"; }
|
|
@@ -24,7 +24,7 @@ export class MrdEmailField {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
render() {
|
|
27
|
-
return (h(Host, { key: '
|
|
27
|
+
return (h(Host, { key: '3253124dadc7f0b3f120c11f8c35604a2f671b0a' }, h("div", { key: 'db820652452145c30f21b41a65942c0a4c6f45f1', class: "mrd-email-field" }, h(FieldLabel, { key: '8b1c5a84afce9fd18c3f644e5c92f07363e116d4', base: "mrd-email-field", label: this.label, required: this.required }), h("input", { key: 'dc4bada3208aa6cb7585b1872f53605177371493', class: controlClass('mrd-email-field', !!this.error), type: "email", name: this.name, value: this.value, placeholder: this.placeholder || 'name@example.com', required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), h(FieldError, { key: 'c44377d1b6a4a4c468b080b23eecd4ba9ca326e1', base: "mrd-email-field", error: this.error }))));
|
|
28
28
|
}
|
|
29
29
|
static get is() { return "mrd-email-field"; }
|
|
30
30
|
static get encapsulation() { return "scoped"; }
|
|
@@ -92,6 +92,25 @@
|
|
|
92
92
|
font-size: var(--mrd-font-size-sm);
|
|
93
93
|
color: var(--mrd-color-neutral-700);
|
|
94
94
|
}
|
|
95
|
+
.mrd-file-field__list {
|
|
96
|
+
list-style: none;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: var(--mrd-space-1);
|
|
100
|
+
margin: var(--mrd-space-2) 0 0;
|
|
101
|
+
padding: 0;
|
|
102
|
+
}
|
|
103
|
+
.mrd-file-field__item {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: var(--mrd-space-2);
|
|
107
|
+
padding: var(--mrd-space-1) var(--mrd-space-2);
|
|
108
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
109
|
+
border-radius: var(--mrd-border-radius-sm);
|
|
110
|
+
font-family: var(--mrd-font-family);
|
|
111
|
+
font-size: var(--mrd-font-size-sm);
|
|
112
|
+
color: var(--mrd-color-neutral-700);
|
|
113
|
+
}
|
|
95
114
|
.mrd-file-field__icon {
|
|
96
115
|
width: 20px;
|
|
97
116
|
height: 20px;
|
|
@@ -100,10 +119,10 @@
|
|
|
100
119
|
}
|
|
101
120
|
.mrd-file-field__filename {
|
|
102
121
|
flex: 1;
|
|
122
|
+
min-width: 0;
|
|
103
123
|
overflow: hidden;
|
|
104
124
|
text-overflow: ellipsis;
|
|
105
125
|
white-space: nowrap;
|
|
106
|
-
max-width: 200px;
|
|
107
126
|
}
|
|
108
127
|
.mrd-file-field__clear {
|
|
109
128
|
background: none;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { t } from "../../../utils/i18n";
|
|
3
3
|
import { FieldLabel, FieldError } from "../field-helpers";
|
|
4
|
-
import { validateUploadFile, uploadZoneClass, makeDragHandlers } from "../file-upload-common";
|
|
4
|
+
import { isPending, entryLabel, validateUploadFile, uploadZoneClass, makeDragHandlers } from "../file-upload-common";
|
|
5
5
|
export class MrdFileField {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.name = '';
|
|
@@ -12,69 +12,107 @@ export class MrdFileField {
|
|
|
12
12
|
this.locale = navigator.language;
|
|
13
13
|
this.accept = '';
|
|
14
14
|
this.maxSize = 0; // bytes, 0 = no limit
|
|
15
|
-
this.
|
|
15
|
+
this.multiple = false;
|
|
16
|
+
/** Working copy of the field's files, kept in sync with `value`. Entries still
|
|
17
|
+
* a `File` are pending upload; resolved entries are `{ href, fileName }` (or a
|
|
18
|
+
* bare href string for older hosts). */
|
|
19
|
+
this.entries = [];
|
|
16
20
|
this.isDragging = false;
|
|
17
|
-
this.uploading = false;
|
|
18
21
|
this.error = '';
|
|
19
22
|
this.handleInputChange = (e) => {
|
|
20
23
|
var _a;
|
|
21
|
-
const
|
|
22
|
-
this.
|
|
24
|
+
const input = e.target;
|
|
25
|
+
this.addFiles(Array.from((_a = input.files) !== null && _a !== void 0 ? _a : []));
|
|
26
|
+
input.value = '';
|
|
23
27
|
};
|
|
24
|
-
this.drag = makeDragHandlers(dragging => (this.isDragging = dragging),
|
|
28
|
+
this.drag = makeDragHandlers(dragging => (this.isDragging = dragging), files => this.addFiles(files));
|
|
25
29
|
this.handleZoneClick = () => {
|
|
26
30
|
var _a;
|
|
27
|
-
if (!this.disabled && !this.
|
|
31
|
+
if (!this.disabled && !this.zoneBusy) {
|
|
28
32
|
(_a = this.fileInputRef) === null || _a === void 0 ? void 0 : _a.click();
|
|
29
33
|
}
|
|
30
34
|
};
|
|
31
|
-
this.
|
|
35
|
+
this.handleRemove = (index) => (e) => {
|
|
32
36
|
e.stopPropagation();
|
|
33
|
-
this.
|
|
37
|
+
const next = this.entries.filter((_, i) => i !== index);
|
|
38
|
+
this.entries = next;
|
|
34
39
|
this.error = '';
|
|
35
|
-
this.uploading = false;
|
|
36
40
|
if (this.fileInputRef)
|
|
37
41
|
this.fileInputRef.value = '';
|
|
38
|
-
this.
|
|
42
|
+
this.emitValue(next);
|
|
39
43
|
};
|
|
40
44
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
componentWillLoad() {
|
|
46
|
+
this.syncEntriesFromValue();
|
|
47
|
+
}
|
|
48
|
+
/** The host (via mrd-form.setFieldValue) is the source of truth once a value round-trips back. */
|
|
49
|
+
valueChanged() {
|
|
50
|
+
this.syncEntriesFromValue();
|
|
51
|
+
}
|
|
52
|
+
syncEntriesFromValue() {
|
|
53
|
+
const v = this.value;
|
|
54
|
+
if (this.multiple) {
|
|
55
|
+
this.entries = Array.isArray(v) ? [...v] : v ? [v] : [];
|
|
45
56
|
}
|
|
46
|
-
else
|
|
47
|
-
this.
|
|
48
|
-
this.fileName = '';
|
|
57
|
+
else {
|
|
58
|
+
this.entries = v ? [v] : [];
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
emitValue(entries) {
|
|
62
|
+
var _a;
|
|
63
|
+
const value = this.multiple ? entries : (_a = entries[0]) !== null && _a !== void 0 ? _a : null;
|
|
64
|
+
this.mrdChange.emit({ name: this.name, value: value });
|
|
65
|
+
}
|
|
66
|
+
addFiles(files) {
|
|
67
|
+
if (this.disabled || this.zoneBusy)
|
|
68
|
+
return;
|
|
69
|
+
const candidates = this.multiple ? files : files.slice(0, 1);
|
|
70
|
+
if (!candidates.length)
|
|
56
71
|
return;
|
|
72
|
+
const accepted = [];
|
|
73
|
+
let uploadError = '';
|
|
74
|
+
for (const file of candidates) {
|
|
75
|
+
const err = validateUploadFile(file, this.maxSize, this.locale);
|
|
76
|
+
if (err) {
|
|
77
|
+
uploadError = err;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
accepted.push(file);
|
|
57
81
|
}
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
this.error = uploadError;
|
|
82
|
+
this.error = uploadError;
|
|
83
|
+
if (!accepted.length)
|
|
61
84
|
return;
|
|
85
|
+
const next = this.multiple ? [...this.entries, ...accepted] : [accepted[0]];
|
|
86
|
+
this.entries = next;
|
|
87
|
+
this.emitValue(next);
|
|
88
|
+
for (const file of accepted) {
|
|
89
|
+
this.mrdUpload.emit({ name: this.name, file });
|
|
62
90
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.
|
|
91
|
+
}
|
|
92
|
+
/** In single mode, block re-selection while the one file is still uploading;
|
|
93
|
+
* in multiple mode, more files can always be added alongside pending uploads. */
|
|
94
|
+
get zoneBusy() {
|
|
95
|
+
return !this.multiple && this.entries.some(isPending);
|
|
96
|
+
}
|
|
97
|
+
/** Icon/spinner + filename + remove button — the caller supplies the wrapping element
|
|
98
|
+
* (a plain row for single mode, an `<li>` for the multi-mode list). */
|
|
99
|
+
renderEntry(entry, index) {
|
|
100
|
+
const uploading = isPending(entry);
|
|
101
|
+
return [
|
|
102
|
+
uploading ? (h("span", { class: "mrd-file-field__spinner", "aria-label": t('loading', this.locale) })) : (h("svg", { class: "mrd-file-field__icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }), h("polyline", { points: "14 2 14 8 20 8" }))),
|
|
103
|
+
h("span", { class: "mrd-file-field__filename" }, entryLabel(entry)),
|
|
104
|
+
!uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleRemove(index), "aria-label": t('remove', this.locale) }, "\u2715")),
|
|
105
|
+
];
|
|
68
106
|
}
|
|
69
107
|
render() {
|
|
70
|
-
const hasFile = this.uploading || (typeof this.value === 'string' && this.value) || this.fileName;
|
|
71
108
|
const hasError = !!this.error;
|
|
109
|
+
const hasEntries = this.entries.length > 0;
|
|
72
110
|
const zoneClass = uploadZoneClass('mrd-file-field', {
|
|
73
111
|
dragging: this.isDragging,
|
|
74
112
|
error: hasError,
|
|
75
|
-
disabled: this.disabled || this.
|
|
113
|
+
disabled: this.disabled || this.zoneBusy,
|
|
76
114
|
});
|
|
77
|
-
return (h(Host, { key: '
|
|
115
|
+
return (h(Host, { key: '2e740a0857b069740a6a13616d0a0dfee2b945be' }, h("div", { key: '069b25ced3b2f1ce547819086dadbd53ade2378c', class: "mrd-file-field" }, h(FieldLabel, { key: 'd13f3cb0af766d6328772dab865b2079c85ec075', base: "mrd-file-field", label: this.label, required: this.required }), h("div", { key: '9ffdbb508e3934854034c46e6f719a88d4175920', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.drag.onDragOver, onDragLeave: this.drag.onDragLeave, onDrop: this.drag.onDrop }, h("input", { key: 'c5d6954b8fa050889b5b65e15fde229dd64d7cc7', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, multiple: this.multiple, disabled: this.disabled || this.zoneBusy, required: this.required && !hasEntries, onChange: this.handleInputChange }), hasEntries && !this.multiple ? (h("div", { class: "mrd-file-field__selected" }, this.renderEntry(this.entries[0], 0))) : (h("div", { class: "mrd-file-field__prompt" }, h("svg", { class: "mrd-file-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("polyline", { points: "16 16 12 12 8 16" }), h("line", { x1: "12", y1: "12", x2: "12", y2: "21" }), h("path", { d: "M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-file-field__browse" }, t('browse', this.locale)))))), this.multiple && hasEntries && (h("ul", { key: '910a3e89f74d93ab16fb9f677a4276d5ad88897d', class: "mrd-file-field__list" }, this.entries.map((entry, index) => (h("li", { class: "mrd-file-field__item", key: `${index}-${entryLabel(entry)}` }, this.renderEntry(entry, index)))))), h(FieldError, { key: '4f0f071b0a1460ea1d6067a8fa4f588ebc620f2a', base: "mrd-file-field", error: this.error }))));
|
|
78
116
|
}
|
|
79
117
|
static get is() { return "mrd-file-field"; }
|
|
80
118
|
static get encapsulation() { return "scoped"; }
|
|
@@ -247,14 +285,33 @@ export class MrdFileField {
|
|
|
247
285
|
"reflect": false,
|
|
248
286
|
"attribute": "max-size",
|
|
249
287
|
"defaultValue": "0"
|
|
288
|
+
},
|
|
289
|
+
"multiple": {
|
|
290
|
+
"type": "boolean",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "boolean",
|
|
294
|
+
"resolved": "boolean",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": ""
|
|
302
|
+
},
|
|
303
|
+
"getter": false,
|
|
304
|
+
"setter": false,
|
|
305
|
+
"reflect": false,
|
|
306
|
+
"attribute": "multiple",
|
|
307
|
+
"defaultValue": "false"
|
|
250
308
|
}
|
|
251
309
|
};
|
|
252
310
|
}
|
|
253
311
|
static get states() {
|
|
254
312
|
return {
|
|
255
|
-
"
|
|
313
|
+
"entries": {},
|
|
256
314
|
"isDragging": {},
|
|
257
|
-
"uploading": {},
|
|
258
315
|
"error": {}
|
|
259
316
|
};
|
|
260
317
|
}
|
|
@@ -270,12 +327,14 @@ export class MrdFileField {
|
|
|
270
327
|
"text": ""
|
|
271
328
|
},
|
|
272
329
|
"complexType": {
|
|
273
|
-
"original": "{ name: string; value:
|
|
274
|
-
"resolved": "{ name: string; value:
|
|
330
|
+
"original": "{ name: string; value: FileEntry | FileEntry[] | null }",
|
|
331
|
+
"resolved": "{ name: string; value: FileEntry | FileEntry[] | null; }",
|
|
275
332
|
"references": {
|
|
276
|
-
"
|
|
277
|
-
"location": "
|
|
278
|
-
"
|
|
333
|
+
"FileEntry": {
|
|
334
|
+
"location": "import",
|
|
335
|
+
"path": "../file-upload-common",
|
|
336
|
+
"id": "src/components/fields/file-upload-common.ts::FileEntry",
|
|
337
|
+
"referenceLocation": "FileEntry"
|
|
279
338
|
}
|
|
280
339
|
}
|
|
281
340
|
}
|
|
@@ -290,12 +349,14 @@ export class MrdFileField {
|
|
|
290
349
|
"text": ""
|
|
291
350
|
},
|
|
292
351
|
"complexType": {
|
|
293
|
-
"original": "{ name: string; value:
|
|
294
|
-
"resolved": "{ name: string; value:
|
|
352
|
+
"original": "{ name: string; value: FileEntry | FileEntry[] | null }",
|
|
353
|
+
"resolved": "{ name: string; value: FileEntry | FileEntry[] | null; }",
|
|
295
354
|
"references": {
|
|
296
|
-
"
|
|
297
|
-
"location": "
|
|
298
|
-
"
|
|
355
|
+
"FileEntry": {
|
|
356
|
+
"location": "import",
|
|
357
|
+
"path": "../file-upload-common",
|
|
358
|
+
"id": "src/components/fields/file-upload-common.ts::FileEntry",
|
|
359
|
+
"referenceLocation": "FileEntry"
|
|
299
360
|
}
|
|
300
361
|
}
|
|
301
362
|
}
|
|
@@ -307,7 +368,7 @@ export class MrdFileField {
|
|
|
307
368
|
"composed": true,
|
|
308
369
|
"docs": {
|
|
309
370
|
"tags": [],
|
|
310
|
-
"text": "Emitted
|
|
371
|
+
"text": "Emitted once per selected/dropped file that needs to be uploaded.\nHost should upload the file and call form.setFieldValue(name, { href, fileName: file.name }, file)\nwith the result \u2014 passing `file` back lets mrd-form resolve the right entry in a `multiple` field."
|
|
311
372
|
},
|
|
312
373
|
"complexType": {
|
|
313
374
|
"original": "{ name: string; file: File }",
|