@mmlogic/components 0.4.1 → 0.4.2
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/index.cjs.js +8 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_23.cjs.entry.js → mrd-boolean-field_24.cjs.entry.js} +237 -34
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.css +14 -1
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +22 -7
- package/dist/collection/components/documents/mrd-document-list/mrd-document-list.css +8 -5
- package/dist/collection/components/documents/mrd-document-list/tree-view.js +13 -1
- package/dist/collection/components/documents/mrd-document-view/mrd-document-view.css +39 -29
- package/dist/collection/components/documents/mrd-document-view/mrd-document-view.js +109 -8
- package/dist/collection/components/documents/mrd-file-preview/file-preview-kind.js +30 -0
- package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.css +59 -0
- package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.js +212 -0
- 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.js +1 -1
- package/dist/collection/components/fields/mrd-image-field/mrd-image-field.js +1 -1
- 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 +1 -1
- package/dist/collection/components/fields/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +5 -0
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +91 -8
- package/dist/collection/dev/api.js +9 -0
- package/dist/collection/dev/app.js +101 -3
- package/dist/collection/dev/example-data.js +24 -0
- package/dist/collection/types/client-layout.js +8 -0
- package/dist/collection/utils/i18n.js +32 -0
- package/dist/components/client-layout.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-file-field2.js +1 -1
- package/dist/components/mrd-file-preview.d.ts +11 -0
- package/dist/components/mrd-file-preview.js +1 -0
- package/dist/components/mrd-file-preview2.js +1 -0
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-secret-field2.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/esm/index.js +9 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_23.entry.js → mrd-boolean-field_24.entry.js} +238 -36
- package/dist/mosterdcomponents/cell-renderer-PbcEU4ph.js.map +1 -0
- package/dist/mosterdcomponents/client-layout-DCOAAH92.js.map +1 -0
- package/dist/mosterdcomponents/field-helpers-CASS3akr.js.map +1 -0
- package/dist/mosterdcomponents/file-upload-common-D1ndi6cN.js.map +1 -0
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +1 -0
- package/dist/mosterdcomponents/i18n-B1IIkRF9.js.map +1 -0
- package/dist/mosterdcomponents/index-AokUFVX0.js.map +1 -0
- package/dist/mosterdcomponents/index-CprJSlzK.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/index.esm.js.map +1 -0
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
- package/dist/mosterdcomponents/p-aae8a9dc.entry.js +1 -0
- package/dist/mosterdcomponents/query-params-B1HfnMOl.js.map +1 -0
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
- package/dist/mosterdcomponents/validation-DbEViuiw.js.map +1 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +6 -2
- package/dist/types/components/documents/mrd-document-view/mrd-document-view.d.ts +29 -1
- package/dist/types/components/documents/mrd-file-preview/file-preview-kind.d.ts +9 -0
- package/dist/types/components/documents/mrd-file-preview/mrd-file-preview.d.ts +41 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +17 -1
- package/dist/types/components.d.ts +178 -7
- package/dist/types/types/client-layout.d.ts +10 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-b1a2e108.entry.js +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../../utils/i18n";
|
|
3
|
+
import { detectPreviewKind } from "./file-preview-kind";
|
|
4
|
+
/**
|
|
5
|
+
* Renders a signed URL inline as a PDF (native browser viewer, via `<iframe>`)
|
|
6
|
+
* or an image (`<img>`), picked from `mimeType`/`fileName`. Purely
|
|
7
|
+
* presentational: the signed URL is used directly as element `src` — a
|
|
8
|
+
* navigation, not a fetch/XHR, so no CORS handling is needed here. Fetching
|
|
9
|
+
* the signed URL itself is the host's responsibility, same as `mrdLoadImage` /
|
|
10
|
+
* `setImagePreview` on mrd-layout-section.
|
|
11
|
+
*/
|
|
12
|
+
export class MrdFilePreview {
|
|
13
|
+
constructor() {
|
|
14
|
+
/** Signed URL to render. */
|
|
15
|
+
this.src = '';
|
|
16
|
+
/** Declared mime type (e.g. 'application/pdf', 'image/png'), when known.
|
|
17
|
+
* Authoritative over `fileName` when present. */
|
|
18
|
+
this.mimeType = '';
|
|
19
|
+
/** Original file name — used for extension-based detection when `mimeType`
|
|
20
|
+
* is absent, and as alt/title text. */
|
|
21
|
+
this.fileName = '';
|
|
22
|
+
/** The file's own reference href (not the signed preview URL in `src`).
|
|
23
|
+
* When set, an unsupported type falls back to the same download button
|
|
24
|
+
* used elsewhere in the library, so hosts need no new wiring. */
|
|
25
|
+
this.href = '';
|
|
26
|
+
this.locale = navigator.language;
|
|
27
|
+
this.imageFailed = false;
|
|
28
|
+
this.onImageError = () => {
|
|
29
|
+
this.imageFailed = true;
|
|
30
|
+
};
|
|
31
|
+
this.retry = () => {
|
|
32
|
+
this.imageFailed = false;
|
|
33
|
+
this.mrdPreviewReload.emit();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
srcChanged() {
|
|
37
|
+
this.imageFailed = false;
|
|
38
|
+
}
|
|
39
|
+
render() {
|
|
40
|
+
const kind = detectPreviewKind(this.mimeType, this.fileName);
|
|
41
|
+
if (kind === 'pdf') {
|
|
42
|
+
return (h(Host, null, h("iframe", { class: "mrd-file-preview__frame", src: this.src, title: this.fileName || 'preview' })));
|
|
43
|
+
}
|
|
44
|
+
if (kind === 'image') {
|
|
45
|
+
if (this.imageFailed) {
|
|
46
|
+
return (h(Host, null, h("div", { class: "mrd-file-preview__error" }, h("span", { class: "mrd-file-preview__error-text" }, t('preview_error', this.locale)), h("button", { type: "button", class: "mrd-file-preview__retry", onClick: this.retry }, t('retry', this.locale)))));
|
|
47
|
+
}
|
|
48
|
+
return (h(Host, null, h("img", { class: "mrd-file-preview__image", src: this.src, alt: this.fileName || '', onError: this.onImageError })));
|
|
49
|
+
}
|
|
50
|
+
return (h(Host, null, h("div", { class: "mrd-file-preview__unsupported" }, h("span", null, t('preview_unsupported', this.locale)), this.href && (h("button", { type: "button", class: "mrd-file-preview__download", onClick: () => this.mrdDownload.emit({ href: this.href, fileName: this.fileName }) }, 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: "M12 3v12m0 0l-4-4m4 4l4-4M4 21h16" })), t('download', this.locale))))));
|
|
51
|
+
}
|
|
52
|
+
static get is() { return "mrd-file-preview"; }
|
|
53
|
+
static get encapsulation() { return "scoped"; }
|
|
54
|
+
static get originalStyleUrls() {
|
|
55
|
+
return {
|
|
56
|
+
"$": ["mrd-file-preview.scss"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get styleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["mrd-file-preview.css"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get properties() {
|
|
65
|
+
return {
|
|
66
|
+
"src": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"mutable": false,
|
|
69
|
+
"complexType": {
|
|
70
|
+
"original": "string",
|
|
71
|
+
"resolved": "string",
|
|
72
|
+
"references": {}
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"optional": false,
|
|
76
|
+
"docs": {
|
|
77
|
+
"tags": [],
|
|
78
|
+
"text": "Signed URL to render."
|
|
79
|
+
},
|
|
80
|
+
"getter": false,
|
|
81
|
+
"setter": false,
|
|
82
|
+
"reflect": false,
|
|
83
|
+
"attribute": "src",
|
|
84
|
+
"defaultValue": "''"
|
|
85
|
+
},
|
|
86
|
+
"mimeType": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"mutable": false,
|
|
89
|
+
"complexType": {
|
|
90
|
+
"original": "string",
|
|
91
|
+
"resolved": "string",
|
|
92
|
+
"references": {}
|
|
93
|
+
},
|
|
94
|
+
"required": false,
|
|
95
|
+
"optional": false,
|
|
96
|
+
"docs": {
|
|
97
|
+
"tags": [],
|
|
98
|
+
"text": "Declared mime type (e.g. 'application/pdf', 'image/png'), when known.\nAuthoritative over `fileName` when present."
|
|
99
|
+
},
|
|
100
|
+
"getter": false,
|
|
101
|
+
"setter": false,
|
|
102
|
+
"reflect": false,
|
|
103
|
+
"attribute": "mime-type",
|
|
104
|
+
"defaultValue": "''"
|
|
105
|
+
},
|
|
106
|
+
"fileName": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"mutable": false,
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "string",
|
|
111
|
+
"resolved": "string",
|
|
112
|
+
"references": {}
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"optional": false,
|
|
116
|
+
"docs": {
|
|
117
|
+
"tags": [],
|
|
118
|
+
"text": "Original file name \u2014 used for extension-based detection when `mimeType`\nis absent, and as alt/title text."
|
|
119
|
+
},
|
|
120
|
+
"getter": false,
|
|
121
|
+
"setter": false,
|
|
122
|
+
"reflect": false,
|
|
123
|
+
"attribute": "file-name",
|
|
124
|
+
"defaultValue": "''"
|
|
125
|
+
},
|
|
126
|
+
"href": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "The file's own reference href (not the signed preview URL in `src`).\nWhen set, an unsupported type falls back to the same download button\nused elsewhere in the library, so hosts need no new wiring."
|
|
139
|
+
},
|
|
140
|
+
"getter": false,
|
|
141
|
+
"setter": false,
|
|
142
|
+
"reflect": false,
|
|
143
|
+
"attribute": "href",
|
|
144
|
+
"defaultValue": "''"
|
|
145
|
+
},
|
|
146
|
+
"locale": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string",
|
|
151
|
+
"resolved": "string",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": ""
|
|
159
|
+
},
|
|
160
|
+
"getter": false,
|
|
161
|
+
"setter": false,
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"attribute": "locale",
|
|
164
|
+
"defaultValue": "navigator.language"
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
static get states() {
|
|
169
|
+
return {
|
|
170
|
+
"imageFailed": {}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
static get events() {
|
|
174
|
+
return [{
|
|
175
|
+
"method": "mrdPreviewReload",
|
|
176
|
+
"name": "mrdPreviewReload",
|
|
177
|
+
"bubbles": true,
|
|
178
|
+
"cancelable": true,
|
|
179
|
+
"composed": true,
|
|
180
|
+
"docs": {
|
|
181
|
+
"tags": [],
|
|
182
|
+
"text": "The image failed to load \u2014 most likely an expired signed URL. Host\nshould fetch a fresh signed URL and update `src`.\nNote: this is only raised for images. Browsers don't reliably surface\nHTTP-level failures (e.g. a 403 on an expired URL) through an iframe's\nload/error events, so the same detection isn't available for PDFs."
|
|
183
|
+
},
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "void",
|
|
186
|
+
"resolved": "void",
|
|
187
|
+
"references": {}
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
"method": "mrdDownload",
|
|
191
|
+
"name": "mrdDownload",
|
|
192
|
+
"bubbles": true,
|
|
193
|
+
"cancelable": true,
|
|
194
|
+
"composed": true,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "Download the file. Same shape as mrd-document-view / mrd-layout-section's\nmrdDownload \u2014 host resolves `href` to a signed URL."
|
|
198
|
+
},
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "{ href: string; fileName: string }",
|
|
201
|
+
"resolved": "{ href: string; fileName: string; }",
|
|
202
|
+
"references": {}
|
|
203
|
+
}
|
|
204
|
+
}];
|
|
205
|
+
}
|
|
206
|
+
static get watchers() {
|
|
207
|
+
return [{
|
|
208
|
+
"propName": "src",
|
|
209
|
+
"methodName": "srcChanged"
|
|
210
|
+
}];
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -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: 'c0e92a50b1512d7b7f36f151b34bcb5b9497ca59' }, h("div", { key: 'e3f70c88321d8e72784b81092a9ebc0451ba330d', class: "mrd-boolean-field" }, h("label", { key: '3e6d907b72a5e1da7e268685c67811ebf264d5d8', class: "mrd-boolean-field__toggle-label" }, h("input", { key: '2b6df62a72cba19aa26374a2448c26666e28b03d', 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: '77cbe5c1a25153de745f5e91eef589f40cb3237d', class: "mrd-boolean-field__toggle", "aria-hidden": "true" }), this.label && (h("span", { key: '34daaa269ed64ed3be71ecfd15d79eb42d746247', 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: '7265395c3b93c3b4daf4c4221da13e01b2fed2e8' }, h("div", { key: 'e644b67a7aba6e8f5b7175f5f79a4bf5e99cb611', class: "mrd-currency-field" }, h(FieldLabel, { key: 'd47a215c0684aea8a3253ae6edc4628d20733d90', base: "mrd-currency-field", label: this.label, required: this.required }), h("div", { key: 'b8f67f8188ad9cd8ba2b6869fcb2b4cd413dec32', class: "mrd-currency-field__row" }, h("input", { key: '8d643424d8932d11ceea0435353c54bc9399c187', 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: '55b12e960646c2420883df848ae440d45f808300', 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: 'd0a6adbb83af8fde047eff22c8efd9bbe1ae638f', 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: 'c0b9d684c5e0b5e3da785c383472ed5d6c13c39f' }, h("div", { key: '304c9b5c9570a369258f5f6fd0877a01a87d98d5', class: "mrd-date-field" }, h(FieldLabel, { key: '72c5ec21699a314920ea1217aee9a353bc8b4b7e', base: "mrd-date-field", label: this.label, required: this.required }), h("input", { key: 'be18df6c7e5fe89bf00cef38484711a9a685e0dc', 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: 'f16ffb7e14f9ac9af4a34a96361a25dd4d738d68', 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: '0ee285553f3d5e1a9984619795543d67d581c76f' }, h("div", { key: '2c93dffe3701da9099f4b34a9d7c1d0619fa824e', class: "mrd-datetime-field" }, h(FieldLabel, { key: 'ebda087fdcb2a956933758e6250a8e4dc0484ef9', base: "mrd-datetime-field", label: this.label, required: this.required }), h("input", { key: '06b012fc78c76e3b08ef24af5e134aa691975285', 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: '54e7acdd051c00893eb17cbf4911917fceddb54f', 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: 'e113fb3958c06ee4d4e870b6005e07b1793835a1' }, h("div", { key: '9393b859167f1474d944575f464e1523f1dcf469', class: "mrd-email-field" }, h(FieldLabel, { key: '57c134921adb7f941c19d2fa36cce213bc12ae1e', base: "mrd-email-field", label: this.label, required: this.required }), h("input", { key: '67496689526d2fa96a087b00a9436e9de4d69415', 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: '5a151c2995db77771fe8f98a24c627b0060f655a', 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"; }
|
|
@@ -74,7 +74,7 @@ export class MrdFileField {
|
|
|
74
74
|
error: hasError,
|
|
75
75
|
disabled: this.disabled || this.uploading,
|
|
76
76
|
});
|
|
77
|
-
return (h(Host, { key: '
|
|
77
|
+
return (h(Host, { key: '6410e945bb873a05d0a1b3be45bc879b5e153a05' }, h("div", { key: '4d1d69d768b383f0d9190f88a50a87de8679d3d2', class: "mrd-file-field" }, h(FieldLabel, { key: '7e0009908fb4c087de16cf08251ab398199dae60', base: "mrd-file-field", label: this.label, required: this.required }), h("div", { key: '88dfc0d1c34670f7de8f3cf2dea4c95b0ae66f4c', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.drag.onDragOver, onDragLeave: this.drag.onDragLeave, onDrop: this.drag.onDrop }, h("input", { key: 'b6d678b5582a58721c928cef47dd8d6645b26a86', ref: el => (this.fileInputRef = el), class: "mrd-file-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !hasFile, onChange: this.handleInputChange }), hasFile ? (h("div", { class: "mrd-file-field__selected" }, this.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" }))), h("span", { class: "mrd-file-field__filename" }, this.fileName), !this.uploading && (h("button", { class: "mrd-file-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, "\u2715")))) : (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)))))), h(FieldError, { key: '80f1698819c60b15476b953f5f3216f195430b84', base: "mrd-file-field", error: this.error }))));
|
|
78
78
|
}
|
|
79
79
|
static get is() { return "mrd-file-field"; }
|
|
80
80
|
static get encapsulation() { return "scoped"; }
|
|
@@ -84,7 +84,7 @@ export class MrdImageField {
|
|
|
84
84
|
error: hasError,
|
|
85
85
|
disabled: this.disabled || this.uploading,
|
|
86
86
|
});
|
|
87
|
-
return (h(Host, { key: '
|
|
87
|
+
return (h(Host, { key: '700310af716dcc167f98bc7ae7024bb44e1285b6' }, h("div", { key: '95d29a82751249e560404488fb279138eee0c1be', class: "mrd-image-field" }, h(FieldLabel, { key: 'f53f040257a4b65d8435c836846adab137b91a5e', base: "mrd-image-field", label: this.label, required: this.required }), h("div", { key: 'a9cc7a0861b1457d8e4abb11b380b6eeb519a863', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.drag.onDragOver, onDragLeave: this.drag.onDragLeave, onDrop: this.drag.onDrop }, h("input", { key: '7112030bc2b80b4c3b31a4421656da4c926a2fe1', ref: el => (this.fileInputRef = el), class: "mrd-image-field__input", type: "file", name: this.name, accept: this.accept, disabled: this.disabled || this.uploading, required: this.required && !this.previewUrl, onChange: this.handleInputChange }), this.previewUrl ? (h("div", { class: "mrd-image-field__preview-container" }, h("div", { class: "mrd-image-field__preview-thumb" }, h("img", { class: "mrd-image-field__preview", src: this.previewUrl, alt: this.fileName }), this.uploading && h("div", { class: "mrd-image-field__preview-overlay" }, h("span", { class: "mrd-image-field__spinner" }))), h("div", { class: "mrd-image-field__preview-info" }, h("span", { class: "mrd-image-field__preview-name" }, this.fileName), this.uploading && (h("span", { class: "mrd-image-field__upload-status" }, t('loading', this.locale)))), !this.uploading && (h("button", { class: "mrd-image-field__clear", type: "button", onClick: this.handleClear, "aria-label": t('clear', this.locale) }, t('remove', this.locale))))) : (h("div", { class: "mrd-image-field__prompt" }, h("svg", { class: "mrd-image-field__upload-icon", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2" }, h("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), h("circle", { cx: "8.5", cy: "8.5", r: "1.5" }), h("polyline", { points: "21 15 16 10 5 21" })), h("span", null, t('drop_file_here', this.locale), ' ', h("span", { class: "mrd-image-field__browse" }, t('browse', this.locale)))))), h(FieldError, { key: '0cf5346ecb1a5d110822b087081b4b5f05255381', base: "mrd-image-field", error: this.error }))));
|
|
88
88
|
}
|
|
89
89
|
static get is() { return "mrd-image-field"; }
|
|
90
90
|
static get encapsulation() { return "scoped"; }
|
|
@@ -21,7 +21,7 @@ export class MrdLongtextField {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'b27d14772f5184d41c178606629a9945120296ef' }, h("div", { key: '206b1b9ee1d37e05680e31bf8b324455867fd93b', class: "mrd-longtext-field" }, h(FieldLabel, { key: '0b6f4959f32a097907965753ed8708d7580aee53', base: "mrd-longtext-field", label: this.label, required: this.required }), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: controlClass('mrd-longtext-field', !!this.error), name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), h(FieldError, { key: '0803cf0c1b6409e6c8a65121efef97d28d870119', base: "mrd-longtext-field", error: this.error }))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "mrd-longtext-field"; }
|
|
27
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -70,7 +70,7 @@ export class MrdNumberField {
|
|
|
70
70
|
const hasError = !!this.error;
|
|
71
71
|
const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
|
|
72
72
|
this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
|
|
73
|
-
return (h(Host, { key: '
|
|
73
|
+
return (h(Host, { key: '90cae99b332f9554bc80d4044fce892ae37a48cf' }, h("div", { key: '26a9cfcc662eaeb571d17785f10f74269cf78537', class: "mrd-number-field" }, h(FieldLabel, { key: '0d9e70c1591f309ad2875d9e9fe6dbb8aa910323', base: "mrd-number-field", label: this.label, required: this.required }), h("div", { key: '95e9b53fa73c452491f65355915bf04912900ded', class: "mrd-number-field__input-wrapper" }, h("input", { key: '1d341c270a21b1a10c51757e90257e48e741abd7', class: controlClass('mrd-number-field', hasError), type: "text", inputMode: "decimal", name: this.name, value: this.displayValue, placeholder: this.placeholder || (suffix ? `0${suffix}` : '0'), required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus })), h(FieldError, { key: '0dba75e0f7355b71bfa71dab16cd1a6fcc36922f', base: "mrd-number-field", error: this.error }))));
|
|
74
74
|
}
|
|
75
75
|
static get is() { return "mrd-number-field"; }
|
|
76
76
|
static get encapsulation() { return "scoped"; }
|
|
@@ -21,9 +21,9 @@ export class MrdSecretField {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '9883a87b7fcc840aa4bbe0a3cde163cc58bda65d' }, h("div", { key: '3c7ec45d59a1a17863daa39b7c115db5c58815ee', class: "mrd-secret-field" }, h(FieldLabel, { key: '2dda66c7e6d4946661bff5a5a46589a7e17f569a', base: "mrd-secret-field", label: this.label, required: this.required }), this.disabled
|
|
25
25
|
? (h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
|
|
26
|
-
: (h("input", { class: controlClass('mrd-secret-field', !!this.error), type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), h(FieldError, { key: '
|
|
26
|
+
: (h("input", { class: controlClass('mrd-secret-field', !!this.error), type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), h(FieldError, { key: 'ad8f54a7c76c59591fee77e11a12bbd62c392d91', base: "mrd-secret-field", error: this.error }))));
|
|
27
27
|
}
|
|
28
28
|
static get is() { return "mrd-secret-field"; }
|
|
29
29
|
static get encapsulation() { return "scoped"; }
|
|
@@ -21,7 +21,7 @@ export class MrdTextField {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: 'd2a6fb5735a3a01887cc467274a0ff9d71312124' }, h("div", { key: '7864bf852d43f93ebd0120a3ec1b72e54837d1ba', class: "mrd-text-field" }, h(FieldLabel, { key: 'bdad112197b44a643a58dd79c4648e284311199d', base: "mrd-text-field", label: this.label, required: this.required }), h("input", { key: '1d3e1cf3374ea2e5a83794b5110205964fff86e1', class: controlClass('mrd-text-field', !!this.error), type: "text", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), h(FieldError, { key: 'bb4ec51de7b6d360fdb3d46dd53e85a5d497bcce', base: "mrd-text-field", error: this.error }))));
|
|
25
25
|
}
|
|
26
26
|
static get is() { return "mrd-text-field"; }
|
|
27
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -60,7 +60,7 @@ export class MrdTextareaField {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return (h(Host, { key: '
|
|
63
|
+
return (h(Host, { key: 'de39890fc23146b880e69be7a8f04c91786ae9c9' }, h("div", { key: '0ccc855f3ee44553559a9ea8a70690466789f76d', class: "mrd-textarea-field" }, h(FieldLabel, { key: '2a16dcbeedbba8b5d8d1e8e8c0f021f14813f609', base: "mrd-textarea-field", label: this.label, required: this.required }), h("div", { key: '979ecb0ed163e3f753d75635452eea49d76edf29', class: controlClass('mrd-textarea-field', !!this.error, 'container') }, h("div", { key: '8ea96a080086b68df55017a1464f6bce502f9a58', class: "mrd-textarea-field__editor" })), h(FieldError, { key: 'd6ac1a12f7be3594ed8cdb6d94b304c46dc8285b', base: "mrd-textarea-field", error: this.error }))));
|
|
64
64
|
}
|
|
65
65
|
static get is() { return "mrd-textarea-field"; }
|
|
66
66
|
static get encapsulation() { return "scoped"; }
|
|
@@ -20,7 +20,7 @@ export class MrdTimeField {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
return (h(Host, { key: '
|
|
23
|
+
return (h(Host, { key: '588e298c4f52aa4e65d87bfdc6918282ed97b3ae' }, h("div", { key: 'eed7332ca78747d4ff8b6c8d06ad4674e1c37e69', class: "mrd-time-field" }, h(FieldLabel, { key: '6383beb79fd05dabdc408256e3326f9637e4c993', base: "mrd-time-field", label: this.label, required: this.required }), h("input", { key: 'b372d8b5dd523ee6182fe302450ce904ac17cc3c', class: controlClass('mrd-time-field', !!this.error), type: "time", name: this.name, value: this.value, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), h(FieldError, { key: '7d8ce1e557bf583c0409e8f02893a15fadeab634', base: "mrd-time-field", error: this.error }))));
|
|
24
24
|
}
|
|
25
25
|
static get is() { return "mrd-time-field"; }
|
|
26
26
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, resolveArchetype, ARCHETYPE_DOCUMENT, } from "../../../types/client-layout";
|
|
2
|
+
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, ClientLayoutNavigateBehaviour, resolveArchetype, ARCHETYPE_DOCUMENT, } from "../../../types/client-layout";
|
|
3
3
|
import { viewKeyFor, flattenItems, buildContainerHref } from "./layout-helpers";
|
|
4
4
|
import { renderField } from "./field-value";
|
|
5
5
|
export class MrdLayoutSection {
|
|
@@ -16,11 +16,17 @@ export class MrdLayoutSection {
|
|
|
16
16
|
/** Top-level archetypes on the object dashboard. When it contains commons.document,
|
|
17
17
|
* the record is rendered as a single-document view instead of generic fields. */
|
|
18
18
|
this.archetypes = [];
|
|
19
|
+
/** Minimum height (px) of the commons.document inline file preview — it
|
|
20
|
+
* stretches taller in the wide side-by-side layout. Pass a smaller value
|
|
21
|
+
* when embedding the record in an overlay with limited height. */
|
|
22
|
+
this.documentPreviewHeight = 640;
|
|
19
23
|
this.searchQueryMap = {};
|
|
20
24
|
this.searchResultsMap = {};
|
|
21
25
|
this.imagePreviewUrl = null;
|
|
22
26
|
this.imagePreviews = {};
|
|
23
27
|
this.openHistoryField = null;
|
|
28
|
+
/** Signed URL for the commons.document archetype's inline file preview. */
|
|
29
|
+
this.documentPreviewUrl = null;
|
|
24
30
|
this.historyClickOutside = null;
|
|
25
31
|
this.searchTimers = {};
|
|
26
32
|
this.handleViewLoadPage = (e, name) => {
|
|
@@ -144,6 +150,11 @@ export class MrdLayoutSection {
|
|
|
144
150
|
async openImagePreview(url) {
|
|
145
151
|
this.imagePreviewUrl = url;
|
|
146
152
|
}
|
|
153
|
+
/** Provide a resolved signed URL for the commons.document archetype's inline
|
|
154
|
+
* file preview, in response to mrdLoadDocumentPreview. */
|
|
155
|
+
async setDocumentPreviewUrl(url) {
|
|
156
|
+
this.documentPreviewUrl = url;
|
|
157
|
+
}
|
|
147
158
|
resolveSearchKey() {
|
|
148
159
|
var _a;
|
|
149
160
|
const items = flattenItems(this.items).filter(i => i.type === ClientLayoutItemType.SEARCH);
|
|
@@ -233,6 +244,10 @@ export class MrdLayoutSection {
|
|
|
233
244
|
e.stopPropagation();
|
|
234
245
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
235
246
|
}, onMrdNavigate: (e) => {
|
|
247
|
+
// mrd-document-container already hardcodes navigateBehaviour to
|
|
248
|
+
// OVERLAY_PAGE (documents are always the quick-look use case) —
|
|
249
|
+
// relay as-is, unlike the generic table path below which takes it
|
|
250
|
+
// from the item's configuration.
|
|
236
251
|
e.stopPropagation();
|
|
237
252
|
this.mrdNavigate.emit(e.detail);
|
|
238
253
|
}, onMrdAction: (e) => {
|
|
@@ -256,10 +271,14 @@ export class MrdLayoutSection {
|
|
|
256
271
|
e.stopPropagation();
|
|
257
272
|
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
258
273
|
}, onMrdRowClick: (e) => {
|
|
259
|
-
var _a, _b, _c;
|
|
274
|
+
var _a, _b, _c, _d;
|
|
260
275
|
e.stopPropagation();
|
|
261
276
|
const row = e.detail;
|
|
262
|
-
this.mrdNavigate.emit({
|
|
277
|
+
this.mrdNavigate.emit({
|
|
278
|
+
href: (_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href,
|
|
279
|
+
label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '',
|
|
280
|
+
navigateBehaviour: (_d = item.navigateBehaviour) !== null && _d !== void 0 ? _d : ClientLayoutNavigateBehaviour.PAGE,
|
|
281
|
+
});
|
|
263
282
|
}, onMrdAction: (e) => {
|
|
264
283
|
var _a;
|
|
265
284
|
e.stopPropagation();
|
|
@@ -308,17 +327,18 @@ export class MrdLayoutSection {
|
|
|
308
327
|
* a recognisable document instead of generic fields, keeping any related views/
|
|
309
328
|
* searches below it. */
|
|
310
329
|
renderDocumentObject(archetype) {
|
|
330
|
+
var _a;
|
|
311
331
|
const related = this.items.filter(it => it.type === ClientLayoutItemType.VIEW ||
|
|
312
332
|
it.type === ClientLayoutItemType.RELATED_VIEW ||
|
|
313
333
|
it.type === ClientLayoutItemType.SEARCH);
|
|
314
334
|
return [
|
|
315
|
-
h("mrd-document-view", { archetype: archetype, data: this.data, locale: this.locale, onMrdNavigate: (e) => { e.stopPropagation(); this.mrdNavigate.emit(e.detail); }, onMrdDownload: (e) => { e.stopPropagation(); this.mrdDownload.emit(e.detail); } }),
|
|
335
|
+
h("mrd-document-view", { archetype: archetype, data: this.data, locale: this.locale, previewUrl: (_a = this.documentPreviewUrl) !== null && _a !== void 0 ? _a : '', previewHeight: this.documentPreviewHeight, onMrdNavigate: (e) => { e.stopPropagation(); this.mrdNavigate.emit(e.detail); }, onMrdDownload: (e) => { e.stopPropagation(); this.mrdDownload.emit(e.detail); }, onMrdLoadPreview: (e) => { e.stopPropagation(); this.mrdLoadDocumentPreview.emit(e.detail); } }),
|
|
316
336
|
...related.map(it => this.renderItem(it)),
|
|
317
337
|
];
|
|
318
338
|
}
|
|
319
339
|
render() {
|
|
320
340
|
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
321
|
-
return (h(Host, { key: '
|
|
341
|
+
return (h(Host, { key: 'd73b44ed5d3529c5b01a87ddfd9a7ebe202ff3b8' }, h("div", { key: '1e80e202ec7c23afbca8f6a02376f0a4a4a6ba31', class: "mrd-layout-section" }, docArchetype
|
|
322
342
|
? this.renderDocumentObject(docArchetype)
|
|
323
343
|
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
324
344
|
}
|
|
@@ -480,6 +500,26 @@ export class MrdLayoutSection {
|
|
|
480
500
|
"getter": false,
|
|
481
501
|
"setter": false,
|
|
482
502
|
"defaultValue": "[]"
|
|
503
|
+
},
|
|
504
|
+
"documentPreviewHeight": {
|
|
505
|
+
"type": "number",
|
|
506
|
+
"mutable": false,
|
|
507
|
+
"complexType": {
|
|
508
|
+
"original": "number",
|
|
509
|
+
"resolved": "number",
|
|
510
|
+
"references": {}
|
|
511
|
+
},
|
|
512
|
+
"required": false,
|
|
513
|
+
"optional": false,
|
|
514
|
+
"docs": {
|
|
515
|
+
"tags": [],
|
|
516
|
+
"text": "Minimum height (px) of the commons.document inline file preview \u2014 it\nstretches taller in the wide side-by-side layout. Pass a smaller value\nwhen embedding the record in an overlay with limited height."
|
|
517
|
+
},
|
|
518
|
+
"getter": false,
|
|
519
|
+
"setter": false,
|
|
520
|
+
"reflect": false,
|
|
521
|
+
"attribute": "document-preview-height",
|
|
522
|
+
"defaultValue": "640"
|
|
483
523
|
}
|
|
484
524
|
};
|
|
485
525
|
}
|
|
@@ -489,7 +529,8 @@ export class MrdLayoutSection {
|
|
|
489
529
|
"searchResultsMap": {},
|
|
490
530
|
"imagePreviewUrl": {},
|
|
491
531
|
"imagePreviews": {},
|
|
492
|
-
"openHistoryField": {}
|
|
532
|
+
"openHistoryField": {},
|
|
533
|
+
"documentPreviewUrl": {}
|
|
493
534
|
};
|
|
494
535
|
}
|
|
495
536
|
static get events() {
|
|
@@ -504,14 +545,20 @@ export class MrdLayoutSection {
|
|
|
504
545
|
"text": ""
|
|
505
546
|
},
|
|
506
547
|
"complexType": {
|
|
507
|
-
"original": "{ href?: string; label: string; navigate?: ClientLayoutItemNavigate }",
|
|
508
|
-
"resolved": "{ href?: string | undefined; label: string; navigate?: ClientLayoutItemNavigate | undefined; }",
|
|
548
|
+
"original": "{ href?: string; label: string; navigate?: ClientLayoutItemNavigate; navigateBehaviour?: ClientLayoutNavigateBehaviour }",
|
|
549
|
+
"resolved": "{ href?: string | undefined; label: string; navigate?: ClientLayoutItemNavigate | undefined; navigateBehaviour?: ClientLayoutNavigateBehaviour | undefined; }",
|
|
509
550
|
"references": {
|
|
510
551
|
"ClientLayoutItemNavigate": {
|
|
511
552
|
"location": "import",
|
|
512
553
|
"path": "../../../types/client-layout",
|
|
513
554
|
"id": "src/types/client-layout.ts::ClientLayoutItemNavigate",
|
|
514
555
|
"referenceLocation": "ClientLayoutItemNavigate"
|
|
556
|
+
},
|
|
557
|
+
"ClientLayoutNavigateBehaviour": {
|
|
558
|
+
"location": "import",
|
|
559
|
+
"path": "../../../types/client-layout",
|
|
560
|
+
"id": "src/types/client-layout.ts::ClientLayoutNavigateBehaviour",
|
|
561
|
+
"referenceLocation": "ClientLayoutNavigateBehaviour"
|
|
515
562
|
}
|
|
516
563
|
}
|
|
517
564
|
}
|
|
@@ -575,6 +622,21 @@ export class MrdLayoutSection {
|
|
|
575
622
|
"resolved": "{ fieldName: string; href: string; }",
|
|
576
623
|
"references": {}
|
|
577
624
|
}
|
|
625
|
+
}, {
|
|
626
|
+
"method": "mrdLoadDocumentPreview",
|
|
627
|
+
"name": "mrdLoadDocumentPreview",
|
|
628
|
+
"bubbles": true,
|
|
629
|
+
"cancelable": true,
|
|
630
|
+
"composed": true,
|
|
631
|
+
"docs": {
|
|
632
|
+
"tags": [],
|
|
633
|
+
"text": "Re-emitted from an embedded mrd-document-view's mrdLoadPreview (commons.document\nsingle-object view); host resolves the file href to a signed URL and calls\nsetDocumentPreviewUrl()."
|
|
634
|
+
},
|
|
635
|
+
"complexType": {
|
|
636
|
+
"original": "{ href: string }",
|
|
637
|
+
"resolved": "{ href: string; }",
|
|
638
|
+
"references": {}
|
|
639
|
+
}
|
|
578
640
|
}, {
|
|
579
641
|
"method": "mrdViewAction",
|
|
580
642
|
"name": "mrdViewAction",
|
|
@@ -935,6 +997,27 @@ export class MrdLayoutSection {
|
|
|
935
997
|
"text": "Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field).",
|
|
936
998
|
"tags": []
|
|
937
999
|
}
|
|
1000
|
+
},
|
|
1001
|
+
"setDocumentPreviewUrl": {
|
|
1002
|
+
"complexType": {
|
|
1003
|
+
"signature": "(url: string) => Promise<void>",
|
|
1004
|
+
"parameters": [{
|
|
1005
|
+
"name": "url",
|
|
1006
|
+
"type": "string",
|
|
1007
|
+
"docs": ""
|
|
1008
|
+
}],
|
|
1009
|
+
"references": {
|
|
1010
|
+
"Promise": {
|
|
1011
|
+
"location": "global",
|
|
1012
|
+
"id": "global::Promise"
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
"return": "Promise<void>"
|
|
1016
|
+
},
|
|
1017
|
+
"docs": {
|
|
1018
|
+
"text": "Provide a resolved signed URL for the commons.document archetype's inline\nfile preview, in response to mrdLoadDocumentPreview.",
|
|
1019
|
+
"tags": []
|
|
1020
|
+
}
|
|
938
1021
|
}
|
|
939
1022
|
};
|
|
940
1023
|
}
|
|
@@ -22,6 +22,15 @@ async function apiRequest(method, path, token, body) {
|
|
|
22
22
|
return { status: resp.status, ok: resp.ok, body: json };
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
/** Resolve a file/image reference href to a signed, directly-usable URL.
|
|
26
|
+
* Mirrors content-app's ApiClientService.getDownloadLink(): a plain GET on
|
|
27
|
+
* the href, response body is the signed URL string. */
|
|
28
|
+
async function apiGetDownloadLink(token, href) {
|
|
29
|
+
const { ok, status, body } = await apiRequest('GET', href, token);
|
|
30
|
+
if (!ok) throw new Error(`${status}: ${typeof body === 'string' ? body : JSON.stringify(body)}`);
|
|
31
|
+
return body;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
async function apiFetchTenants(token) {
|
|
26
35
|
const { ok, status, body } = await apiRequest('GET', '/tenants', token);
|
|
27
36
|
if (!ok) throw new Error(`${status}: ${typeof body === 'string' ? body : JSON.stringify(body)}`);
|