@mmlogic/components 0.3.6 → 0.3.8
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/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-BPj2cBXs.js +1570 -0
- package/dist/cjs/index.cjs.js +66 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/mosterdcomponents.cjs.js +25 -0
- package/dist/cjs/mrd-boolean-field_20.cjs.entry.js +3961 -0
- package/dist/cjs/quill-DmFfnC1f.js +16272 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +199 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.scss +77 -0
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +248 -0
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.scss +100 -0
- package/dist/collection/components/mrd-date-field/mrd-date-field.js +206 -0
- package/dist/collection/components/mrd-date-field/mrd-date-field.scss +66 -0
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +240 -0
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.scss +66 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.js +230 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.scss +69 -0
- package/dist/{mosterdcomponents/mrd-field.entry.js → collection/components/mrd-field/mrd-field.js} +179 -28
- package/dist/collection/components/mrd-field/mrd-field.scss +118 -0
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +341 -0
- package/dist/collection/components/mrd-file-field/mrd-file-field.scss +153 -0
- package/dist/{mosterdcomponents/mrd-form.entry.js → collection/components/mrd-form/mrd-form.js} +308 -31
- package/dist/collection/components/mrd-form/mrd-form.scss +148 -0
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +291 -0
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +91 -0
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +356 -0
- package/dist/collection/components/mrd-image-field/mrd-image-field.scss +190 -0
- package/dist/{mosterdcomponents/mrd-layout-section.entry.js → collection/components/mrd-layout-section/mrd-layout-section.js} +420 -33
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +445 -0
- package/dist/collection/components/mrd-list-field/mrd-list-field.js +313 -0
- package/dist/collection/components/mrd-list-field/mrd-list-field.scss +109 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +227 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +78 -0
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +316 -0
- package/dist/collection/components/mrd-number-field/mrd-number-field.scss +77 -0
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +707 -0
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.scss +266 -0
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +229 -0
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.scss +73 -0
- package/dist/{mosterdcomponents/mrd-table.entry.js → collection/components/mrd-table/mrd-table.js} +394 -32
- package/dist/collection/components/mrd-table/mrd-table.scss +809 -0
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +227 -0
- package/dist/collection/components/mrd-text-field/mrd-text-field.scss +69 -0
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +267 -0
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +79 -0
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +206 -0
- package/dist/collection/components/mrd-time-field/mrd-time-field.scss +66 -0
- package/dist/collection/dev/api.js +145 -0
- package/dist/collection/dev/app.js +890 -0
- package/dist/collection/dev/auth.js +156 -0
- package/dist/collection/dev/example-data.js +403 -0
- package/dist/collection/dev/sprites.svg +55 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/types/client-layout.js +64 -0
- package/dist/collection/types/index.js +1 -0
- package/dist/{mosterdcomponents/cell-renderer-CbRwLOo8.js → collection/utils/cell-renderer.js} +3 -9
- package/dist/{mosterdcomponents/format-BAfsQfy1.js → collection/utils/format.js} +7 -12
- package/dist/{mosterdcomponents/i18n-hoGGKbKU.js → collection/utils/i18n.js} +1 -6
- package/dist/{mosterdcomponents/validation-ixb43cqU.js → collection/utils/validation.js} +5 -12
- package/dist/components/client-layout.js +1 -0
- package/dist/components/format.js +1 -0
- package/dist/components/i18n.js +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mrd-boolean-field.js +1 -0
- package/dist/components/mrd-boolean-field2.js +1 -0
- package/dist/components/mrd-currency-field.js +1 -0
- package/dist/components/mrd-currency-field2.js +1 -0
- package/dist/components/mrd-date-field.js +1 -0
- package/dist/components/mrd-date-field2.js +1 -0
- package/dist/components/mrd-datetime-field.js +1 -0
- package/dist/components/mrd-datetime-field2.js +1 -0
- package/dist/components/mrd-email-field.js +1 -0
- package/dist/components/mrd-email-field2.js +1 -0
- package/dist/components/mrd-field.js +1 -0
- package/dist/components/mrd-field2.js +1 -0
- package/dist/components/mrd-file-field.js +1 -0
- package/dist/components/mrd-file-field2.js +1 -0
- package/dist/components/mrd-form.js +1 -0
- package/dist/components/mrd-hyperlink-field.js +1 -0
- package/dist/components/mrd-hyperlink-field2.js +1 -0
- package/dist/components/mrd-image-field.js +1 -0
- package/dist/components/mrd-image-field2.js +1 -0
- package/dist/components/mrd-layout-section.js +1 -0
- package/dist/components/mrd-list-field.js +1 -0
- package/dist/components/mrd-list-field2.js +1 -0
- package/dist/components/mrd-longtext-field.js +1 -0
- package/dist/components/mrd-longtext-field2.js +1 -0
- package/dist/components/mrd-number-field.js +1 -0
- package/dist/components/mrd-number-field2.js +1 -0
- package/dist/components/mrd-relation-field.js +1 -0
- package/dist/components/mrd-relation-field2.js +1 -0
- package/dist/components/mrd-secret-field.js +1 -0
- package/dist/components/mrd-secret-field2.js +1 -0
- package/dist/components/mrd-table.js +1 -0
- package/dist/components/mrd-table2.js +1 -0
- package/dist/components/mrd-text-field.js +1 -0
- package/dist/components/mrd-text-field2.js +1 -0
- package/dist/components/mrd-textarea-field.js +1 -0
- package/dist/components/mrd-textarea-field2.js +1 -0
- package/dist/components/mrd-time-field.js +1 -0
- package/dist/components/mrd-time-field2.js +1 -0
- package/dist/components/quill.js +1 -0
- package/dist/components/validation.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-_tsCCkAi.js +1561 -0
- package/dist/{mosterdcomponents/client-layout-D88nn5zf.js → esm/index.js} +1 -4
- package/dist/esm/loader.js +11 -0
- package/dist/esm/mosterdcomponents.js +21 -0
- package/dist/esm/mrd-boolean-field_20.entry.js +3940 -0
- package/dist/{mosterdcomponents/quill-C9pgw_k-.js → esm/quill-CiuCgGz_.js} +1347 -16232
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/mosterdcomponents/index-6yQUNVww.js.map +1 -0
- package/dist/mosterdcomponents/index.esm.js +1 -5
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -180
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -50
- package/dist/mosterdcomponents/p-7bfaee51.entry.js +1 -0
- package/dist/mosterdcomponents/p-CiuCgGz_.js +1 -0
- package/dist/mosterdcomponents/p-DQuL1Twl.js +1 -0
- package/dist/mosterdcomponents/p-_tsCCkAi.js +2 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/index-B_tPFIvS.js +0 -4585
- package/dist/mosterdcomponents/index-B_tPFIvS.js.map +0 -1
- package/dist/mosterdcomponents/index-I5SuYv7a.js +0 -4
- package/dist/mosterdcomponents/mrd-boolean-field.entry.js +0 -37
- package/dist/mosterdcomponents/mrd-boolean-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-currency-field.entry.js +0 -67
- package/dist/mosterdcomponents/mrd-currency-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-date-field.entry.js +0 -46
- package/dist/mosterdcomponents/mrd-date-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-datetime-field.entry.js +0 -78
- package/dist/mosterdcomponents/mrd-datetime-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-email-field.entry.js +0 -50
- package/dist/mosterdcomponents/mrd-email-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-file-field.entry.js +0 -108
- package/dist/mosterdcomponents/mrd-file-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-form.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js +0 -87
- package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-image-field.entry.js +0 -122
- package/dist/mosterdcomponents/mrd-image-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-layout-section.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-list-field.entry.js +0 -107
- package/dist/mosterdcomponents/mrd-list-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-longtext-field.entry.js +0 -47
- package/dist/mosterdcomponents/mrd-longtext-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-number-field.entry.js +0 -87
- package/dist/mosterdcomponents/mrd-number-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-relation-field.entry.js +0 -267
- package/dist/mosterdcomponents/mrd-relation-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-secret-field.entry.js +0 -49
- package/dist/mosterdcomponents/mrd-secret-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-table.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-text-field.entry.js +0 -47
- package/dist/mosterdcomponents/mrd-text-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-textarea-field.entry.js +0 -86
- package/dist/mosterdcomponents/mrd-textarea-field.entry.js.map +0 -1
- package/dist/mosterdcomponents/mrd-time-field.entry.js +0 -46
- package/dist/mosterdcomponents/mrd-time-field.entry.js.map +0 -1
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../utils/i18n";
|
|
3
|
+
export class MrdImageField {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.name = '';
|
|
6
|
+
this.label = '';
|
|
7
|
+
this.value = null;
|
|
8
|
+
this.required = false;
|
|
9
|
+
this.disabled = false;
|
|
10
|
+
this.locale = navigator.language;
|
|
11
|
+
this.accept = 'image/*';
|
|
12
|
+
this.maxSize = 0;
|
|
13
|
+
this.previewUrl = '';
|
|
14
|
+
this.fileName = '';
|
|
15
|
+
this.isDragging = false;
|
|
16
|
+
this.uploading = false;
|
|
17
|
+
this.error = '';
|
|
18
|
+
this.handleInputChange = (e) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const files = e.target.files;
|
|
21
|
+
this.handleFile((_a = files === null || files === void 0 ? void 0 : files[0]) !== null && _a !== void 0 ? _a : null);
|
|
22
|
+
};
|
|
23
|
+
this.handleDragOver = (e) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
this.isDragging = true;
|
|
26
|
+
};
|
|
27
|
+
this.handleDragLeave = () => {
|
|
28
|
+
this.isDragging = false;
|
|
29
|
+
};
|
|
30
|
+
this.handleDrop = (e) => {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
this.isDragging = false;
|
|
34
|
+
const file = (_c = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : null;
|
|
35
|
+
this.handleFile(file);
|
|
36
|
+
};
|
|
37
|
+
this.handleZoneClick = () => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (!this.disabled && !this.uploading) {
|
|
40
|
+
(_a = this.fileInputRef) === null || _a === void 0 ? void 0 : _a.click();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.handleClear = (e) => {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
this.previewUrl = '';
|
|
46
|
+
this.fileName = '';
|
|
47
|
+
this.error = '';
|
|
48
|
+
this.uploading = false;
|
|
49
|
+
if (this.fileInputRef)
|
|
50
|
+
this.fileInputRef.value = '';
|
|
51
|
+
this.mrdChange.emit({ name: this.name, value: null });
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** When the host provides a URI back via setFieldValue, the upload is done. */
|
|
55
|
+
valueChanged(newVal) {
|
|
56
|
+
if (typeof newVal === 'string' && newVal) {
|
|
57
|
+
this.uploading = false;
|
|
58
|
+
}
|
|
59
|
+
else if (!newVal) {
|
|
60
|
+
this.uploading = false;
|
|
61
|
+
this.previewUrl = '';
|
|
62
|
+
this.fileName = '';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleFile(file) {
|
|
66
|
+
if (!file) {
|
|
67
|
+
this.previewUrl = '';
|
|
68
|
+
this.fileName = '';
|
|
69
|
+
this.uploading = false;
|
|
70
|
+
this.mrdChange.emit({ name: this.name, value: null });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (this.maxSize > 0 && file.size > this.maxSize) {
|
|
74
|
+
this.error = t('file_too_large', this.locale);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!file.type.startsWith('image/')) {
|
|
78
|
+
this.error = 'Please select an image file';
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.error = '';
|
|
82
|
+
this.fileName = file.name;
|
|
83
|
+
this.uploading = true;
|
|
84
|
+
// Show local preview immediately while upload is in progress
|
|
85
|
+
const reader = new FileReader();
|
|
86
|
+
reader.onload = (ev) => {
|
|
87
|
+
var _a;
|
|
88
|
+
this.previewUrl = (_a = ev.target) === null || _a === void 0 ? void 0 : _a.result;
|
|
89
|
+
};
|
|
90
|
+
reader.readAsDataURL(file);
|
|
91
|
+
this.mrdChange.emit({ name: this.name, value: file });
|
|
92
|
+
this.mrdUpload.emit({ name: this.name, file });
|
|
93
|
+
}
|
|
94
|
+
render() {
|
|
95
|
+
const hasError = !!this.error;
|
|
96
|
+
const zoneClass = [
|
|
97
|
+
'mrd-image-field__zone',
|
|
98
|
+
this.isDragging ? 'mrd-image-field__zone--dragging' : '',
|
|
99
|
+
hasError ? 'mrd-image-field__zone--error' : '',
|
|
100
|
+
this.disabled || this.uploading ? 'mrd-image-field__zone--disabled' : '',
|
|
101
|
+
].filter(Boolean).join(' ');
|
|
102
|
+
return (h(Host, { key: '71be4c1df559cff87280cac30be58beab3149064' }, h("div", { key: '9d0811d87068ce258aca9b2c5223a5594af9f6a3', class: "mrd-image-field" }, this.label && (h("label", { key: '63e129db968a2edfcc04fcac466d908ba4715158', class: `mrd-image-field__label${this.required ? ' mrd-image-field__label--required' : ''}` }, this.label)), h("div", { key: 'c7e560ad4dda43499707a2d1771a8eb561653a1b', class: zoneClass, onClick: this.handleZoneClick, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, h("input", { key: 'd325ee1aa3baccd689cc579e4cfa21abe977a575', 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)))))), hasError && h("span", { key: 'b0442d6f5c07ef22443194b3f1a95d2dfc409c4e', class: "mrd-image-field__error" }, this.error))));
|
|
103
|
+
}
|
|
104
|
+
static get is() { return "mrd-image-field"; }
|
|
105
|
+
static get encapsulation() { return "scoped"; }
|
|
106
|
+
static get originalStyleUrls() {
|
|
107
|
+
return {
|
|
108
|
+
"$": ["mrd-image-field.scss"]
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
static get styleUrls() {
|
|
112
|
+
return {
|
|
113
|
+
"$": ["mrd-image-field.css"]
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
static get properties() {
|
|
117
|
+
return {
|
|
118
|
+
"name": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": ""
|
|
131
|
+
},
|
|
132
|
+
"getter": false,
|
|
133
|
+
"setter": false,
|
|
134
|
+
"reflect": false,
|
|
135
|
+
"attribute": "name",
|
|
136
|
+
"defaultValue": "''"
|
|
137
|
+
},
|
|
138
|
+
"label": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"getter": false,
|
|
153
|
+
"setter": false,
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"attribute": "label",
|
|
156
|
+
"defaultValue": "''"
|
|
157
|
+
},
|
|
158
|
+
"value": {
|
|
159
|
+
"type": "unknown",
|
|
160
|
+
"mutable": false,
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "unknown",
|
|
163
|
+
"resolved": "unknown",
|
|
164
|
+
"references": {}
|
|
165
|
+
},
|
|
166
|
+
"required": false,
|
|
167
|
+
"optional": false,
|
|
168
|
+
"docs": {
|
|
169
|
+
"tags": [],
|
|
170
|
+
"text": ""
|
|
171
|
+
},
|
|
172
|
+
"getter": false,
|
|
173
|
+
"setter": false,
|
|
174
|
+
"defaultValue": "null"
|
|
175
|
+
},
|
|
176
|
+
"required": {
|
|
177
|
+
"type": "boolean",
|
|
178
|
+
"mutable": false,
|
|
179
|
+
"complexType": {
|
|
180
|
+
"original": "boolean",
|
|
181
|
+
"resolved": "boolean",
|
|
182
|
+
"references": {}
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"optional": false,
|
|
186
|
+
"docs": {
|
|
187
|
+
"tags": [],
|
|
188
|
+
"text": ""
|
|
189
|
+
},
|
|
190
|
+
"getter": false,
|
|
191
|
+
"setter": false,
|
|
192
|
+
"reflect": false,
|
|
193
|
+
"attribute": "required",
|
|
194
|
+
"defaultValue": "false"
|
|
195
|
+
},
|
|
196
|
+
"disabled": {
|
|
197
|
+
"type": "boolean",
|
|
198
|
+
"mutable": false,
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "boolean",
|
|
201
|
+
"resolved": "boolean",
|
|
202
|
+
"references": {}
|
|
203
|
+
},
|
|
204
|
+
"required": false,
|
|
205
|
+
"optional": false,
|
|
206
|
+
"docs": {
|
|
207
|
+
"tags": [],
|
|
208
|
+
"text": ""
|
|
209
|
+
},
|
|
210
|
+
"getter": false,
|
|
211
|
+
"setter": false,
|
|
212
|
+
"reflect": false,
|
|
213
|
+
"attribute": "disabled",
|
|
214
|
+
"defaultValue": "false"
|
|
215
|
+
},
|
|
216
|
+
"locale": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"mutable": false,
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "string",
|
|
221
|
+
"resolved": "string",
|
|
222
|
+
"references": {}
|
|
223
|
+
},
|
|
224
|
+
"required": false,
|
|
225
|
+
"optional": false,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": ""
|
|
229
|
+
},
|
|
230
|
+
"getter": false,
|
|
231
|
+
"setter": false,
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"attribute": "locale",
|
|
234
|
+
"defaultValue": "navigator.language"
|
|
235
|
+
},
|
|
236
|
+
"accept": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "string",
|
|
241
|
+
"resolved": "string",
|
|
242
|
+
"references": {}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": ""
|
|
249
|
+
},
|
|
250
|
+
"getter": false,
|
|
251
|
+
"setter": false,
|
|
252
|
+
"reflect": false,
|
|
253
|
+
"attribute": "accept",
|
|
254
|
+
"defaultValue": "'image/*'"
|
|
255
|
+
},
|
|
256
|
+
"maxSize": {
|
|
257
|
+
"type": "number",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "number",
|
|
261
|
+
"resolved": "number",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": ""
|
|
269
|
+
},
|
|
270
|
+
"getter": false,
|
|
271
|
+
"setter": false,
|
|
272
|
+
"reflect": false,
|
|
273
|
+
"attribute": "max-size",
|
|
274
|
+
"defaultValue": "0"
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
static get states() {
|
|
279
|
+
return {
|
|
280
|
+
"previewUrl": {},
|
|
281
|
+
"fileName": {},
|
|
282
|
+
"isDragging": {},
|
|
283
|
+
"uploading": {},
|
|
284
|
+
"error": {}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
static get events() {
|
|
288
|
+
return [{
|
|
289
|
+
"method": "mrdChange",
|
|
290
|
+
"name": "mrdChange",
|
|
291
|
+
"bubbles": true,
|
|
292
|
+
"cancelable": true,
|
|
293
|
+
"composed": true,
|
|
294
|
+
"docs": {
|
|
295
|
+
"tags": [],
|
|
296
|
+
"text": ""
|
|
297
|
+
},
|
|
298
|
+
"complexType": {
|
|
299
|
+
"original": "{ name: string; value: File | null }",
|
|
300
|
+
"resolved": "{ name: string; value: File | null; }",
|
|
301
|
+
"references": {
|
|
302
|
+
"File": {
|
|
303
|
+
"location": "global",
|
|
304
|
+
"id": "global::File"
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}, {
|
|
309
|
+
"method": "mrdBlur",
|
|
310
|
+
"name": "mrdBlur",
|
|
311
|
+
"bubbles": true,
|
|
312
|
+
"cancelable": true,
|
|
313
|
+
"composed": true,
|
|
314
|
+
"docs": {
|
|
315
|
+
"tags": [],
|
|
316
|
+
"text": ""
|
|
317
|
+
},
|
|
318
|
+
"complexType": {
|
|
319
|
+
"original": "{ name: string; value: File | null }",
|
|
320
|
+
"resolved": "{ name: string; value: File | null; }",
|
|
321
|
+
"references": {
|
|
322
|
+
"File": {
|
|
323
|
+
"location": "global",
|
|
324
|
+
"id": "global::File"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
"method": "mrdUpload",
|
|
330
|
+
"name": "mrdUpload",
|
|
331
|
+
"bubbles": true,
|
|
332
|
+
"cancelable": true,
|
|
333
|
+
"composed": true,
|
|
334
|
+
"docs": {
|
|
335
|
+
"tags": [],
|
|
336
|
+
"text": "Emitted when an image is selected and needs to be uploaded.\nHost should upload the file and call form.setFieldValue(name, uri) with the result."
|
|
337
|
+
},
|
|
338
|
+
"complexType": {
|
|
339
|
+
"original": "{ name: string; file: File }",
|
|
340
|
+
"resolved": "{ name: string; file: File; }",
|
|
341
|
+
"references": {
|
|
342
|
+
"File": {
|
|
343
|
+
"location": "global",
|
|
344
|
+
"id": "global::File"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}];
|
|
349
|
+
}
|
|
350
|
+
static get watchers() {
|
|
351
|
+
return [{
|
|
352
|
+
"propName": "value",
|
|
353
|
+
"methodName": "valueChanged"
|
|
354
|
+
}];
|
|
355
|
+
}
|
|
356
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mrd-image-field {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--mrd-space-1);
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mrd-image-field__label {
|
|
13
|
+
display: block;
|
|
14
|
+
font-family: var(--mrd-font-family);
|
|
15
|
+
font-size: var(--mrd-label-font-size);
|
|
16
|
+
font-weight: var(--mrd-label-font-weight);
|
|
17
|
+
color: var(--mrd-label-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.mrd-image-field__label--required::after {
|
|
21
|
+
content: ' *';
|
|
22
|
+
color: var(--mrd-color-danger);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mrd-image-field__zone {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
border: 2px dashed var(--mrd-border-color);
|
|
30
|
+
border-radius: var(--mrd-border-radius-md);
|
|
31
|
+
background-color: var(--mrd-color-neutral-50);
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
transition: border-color var(--mrd-transition), background-color var(--mrd-transition);
|
|
34
|
+
min-height: 100px;
|
|
35
|
+
position: relative;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.mrd-image-field__zone:hover {
|
|
39
|
+
border-color: var(--mrd-color-primary);
|
|
40
|
+
background-color: var(--mrd-color-primary-light);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.mrd-image-field__zone--dragging {
|
|
44
|
+
border-color: var(--mrd-color-primary);
|
|
45
|
+
background-color: var(--mrd-color-primary-light);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mrd-image-field__zone--error {
|
|
49
|
+
border-color: var(--mrd-border-color-error);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.mrd-image-field__zone--disabled {
|
|
53
|
+
opacity: 0.6;
|
|
54
|
+
cursor: not-allowed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.mrd-image-field__zone--disabled:hover {
|
|
58
|
+
border-color: var(--mrd-border-color);
|
|
59
|
+
background-color: var(--mrd-color-neutral-50);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.mrd-image-field__input {
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset: 0;
|
|
65
|
+
opacity: 0;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.mrd-image-field__prompt {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: var(--mrd-space-2);
|
|
76
|
+
padding: var(--mrd-space-6);
|
|
77
|
+
font-family: var(--mrd-font-family);
|
|
78
|
+
font-size: var(--mrd-font-size-sm);
|
|
79
|
+
color: var(--mrd-color-neutral-500);
|
|
80
|
+
text-align: center;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.mrd-image-field__upload-icon {
|
|
84
|
+
width: 40px;
|
|
85
|
+
height: 40px;
|
|
86
|
+
color: var(--mrd-color-neutral-400);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.mrd-image-field__browse {
|
|
90
|
+
color: var(--mrd-color-primary);
|
|
91
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
92
|
+
text-decoration: underline;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Preview: thumbnail + bestandsnaam + verwijder knop */
|
|
96
|
+
.mrd-image-field__preview-container {
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
gap: var(--mrd-space-4);
|
|
100
|
+
padding: var(--mrd-space-4);
|
|
101
|
+
width: 100%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.mrd-image-field__preview-thumb {
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
width: 80px;
|
|
107
|
+
height: 80px;
|
|
108
|
+
border-radius: var(--mrd-border-radius);
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
111
|
+
background-color: var(--mrd-color-neutral-100);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.mrd-image-field__preview {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
object-fit: cover;
|
|
118
|
+
display: block;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.mrd-image-field__preview-info {
|
|
122
|
+
flex: 1;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: var(--mrd-space-1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.mrd-image-field__preview-name {
|
|
130
|
+
font-family: var(--mrd-font-family);
|
|
131
|
+
font-size: var(--mrd-font-size-sm);
|
|
132
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
133
|
+
color: var(--mrd-color-neutral-800);
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
text-overflow: ellipsis;
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.mrd-image-field__preview-overlay {
|
|
140
|
+
position: absolute;
|
|
141
|
+
inset: 0;
|
|
142
|
+
background: rgb(255 255 255 / 0.7);
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
border-radius: var(--mrd-border-radius);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.mrd-image-field__spinner {
|
|
150
|
+
display: inline-block;
|
|
151
|
+
width: 24px;
|
|
152
|
+
height: 24px;
|
|
153
|
+
border: 2px solid var(--mrd-color-neutral-300);
|
|
154
|
+
border-top-color: var(--mrd-color-primary);
|
|
155
|
+
border-radius: 50%;
|
|
156
|
+
animation: mrd-image-spin 0.6s linear infinite;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@keyframes mrd-image-spin { to { transform: rotate(360deg); } }
|
|
160
|
+
|
|
161
|
+
.mrd-image-field__upload-status {
|
|
162
|
+
font-family: var(--mrd-font-family);
|
|
163
|
+
font-size: var(--mrd-font-size-xs);
|
|
164
|
+
color: var(--mrd-color-neutral-500);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.mrd-image-field__clear {
|
|
168
|
+
flex-shrink: 0;
|
|
169
|
+
background-color: var(--mrd-color-white);
|
|
170
|
+
color: var(--mrd-color-danger);
|
|
171
|
+
border: var(--mrd-border-width) solid var(--mrd-color-danger);
|
|
172
|
+
border-radius: var(--mrd-border-radius);
|
|
173
|
+
padding: var(--mrd-space-1) var(--mrd-space-3);
|
|
174
|
+
font-family: var(--mrd-font-family);
|
|
175
|
+
font-size: var(--mrd-font-size-sm);
|
|
176
|
+
font-weight: var(--mrd-font-weight-medium);
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
transition: background-color var(--mrd-transition), color var(--mrd-transition);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.mrd-image-field__clear:hover {
|
|
182
|
+
background-color: var(--mrd-color-danger);
|
|
183
|
+
color: var(--mrd-color-white);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.mrd-image-field__error {
|
|
187
|
+
font-family: var(--mrd-font-family);
|
|
188
|
+
font-size: var(--mrd-error-font-size);
|
|
189
|
+
color: var(--mrd-error-color);
|
|
190
|
+
}
|