@mmlogic/components 0.3.10 → 0.4.0
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-BPj2cBXs.js → index-CAzwGt9u.js} +38 -0
- 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 +1280 -1073
- package/dist/collection/collection-manifest.json +23 -23
- package/dist/collection/components/{mrd-document-container/mrd-document-container.scss → documents/mrd-document-container/mrd-document-container.css} +3 -3
- package/dist/collection/components/{mrd-document-container → documents/mrd-document-container}/mrd-document-container.js +54 -8
- package/dist/collection/components/documents/mrd-document-list/folder-tree.js +109 -0
- package/dist/collection/components/{mrd-document-list/mrd-document-list.scss → documents/mrd-document-list/mrd-document-list.css} +17 -4
- package/dist/collection/components/{mrd-document-list → documents/mrd-document-list}/mrd-document-list.js +166 -237
- package/dist/collection/components/documents/mrd-document-list/tree-view.js +75 -0
- package/dist/collection/components/{mrd-document-view/mrd-document-view.scss → documents/mrd-document-view/mrd-document-view.css} +1 -1
- package/dist/collection/components/{mrd-document-view → documents/mrd-document-view}/mrd-document-view.js +4 -4
- package/dist/collection/components/fields/field-helpers.js +17 -0
- package/dist/collection/components/fields/file-upload-common.js +38 -0
- package/dist/collection/components/{mrd-boolean-field/mrd-boolean-field.scss → fields/mrd-boolean-field/mrd-boolean-field.css} +3 -3
- package/dist/collection/components/{mrd-boolean-field → fields/mrd-boolean-field}/mrd-boolean-field.js +1 -1
- package/dist/collection/components/{mrd-currency-field/mrd-currency-field.scss → fields/mrd-currency-field/mrd-currency-field.css} +11 -9
- package/dist/collection/components/{mrd-currency-field → fields/mrd-currency-field}/mrd-currency-field.js +7 -13
- package/dist/collection/components/{mrd-date-field/mrd-date-field.scss → fields/mrd-date-field/mrd-date-field.css} +8 -10
- package/dist/collection/components/{mrd-date-field → fields/mrd-date-field}/mrd-date-field.js +3 -10
- package/dist/collection/components/{mrd-datetime-field/mrd-datetime-field.scss → fields/mrd-datetime-field/mrd-datetime-field.css} +8 -10
- package/dist/collection/components/{mrd-datetime-field → fields/mrd-datetime-field}/mrd-datetime-field.js +3 -10
- package/dist/collection/components/{mrd-email-field/mrd-email-field.scss → fields/mrd-email-field/mrd-email-field.css} +2 -11
- package/dist/collection/components/{mrd-email-field → fields/mrd-email-field}/mrd-email-field.js +6 -13
- package/dist/collection/components/{mrd-file-field/mrd-file-field.scss → fields/mrd-file-field/mrd-file-field.css} +19 -24
- package/dist/collection/components/{mrd-file-field → fields/mrd-file-field}/mrd-file-field.js +13 -24
- package/dist/collection/components/{mrd-hyperlink-field/mrd-hyperlink-field.scss → fields/mrd-hyperlink-field/mrd-hyperlink-field.css} +7 -16
- package/dist/collection/components/{mrd-hyperlink-field → fields/mrd-hyperlink-field}/mrd-hyperlink-field.js +9 -15
- package/dist/collection/components/{mrd-image-field/mrd-image-field.scss → fields/mrd-image-field/mrd-image-field.css} +15 -24
- package/dist/collection/components/{mrd-image-field → fields/mrd-image-field}/mrd-image-field.js +13 -28
- package/dist/collection/components/{mrd-list-field/mrd-list-field.scss → fields/mrd-list-field/mrd-list-field.css} +18 -21
- package/dist/collection/components/{mrd-list-field → fields/mrd-list-field}/mrd-list-field.js +10 -25
- package/dist/collection/components/{mrd-longtext-field/mrd-longtext-field.scss → fields/mrd-longtext-field/mrd-longtext-field.css} +21 -18
- package/dist/collection/components/{mrd-longtext-field → fields/mrd-longtext-field}/mrd-longtext-field.js +3 -10
- package/dist/collection/components/{mrd-number-field/mrd-number-field.scss → fields/mrd-number-field/mrd-number-field.css} +9 -10
- package/dist/collection/components/{mrd-number-field → fields/mrd-number-field}/mrd-number-field.js +7 -6
- package/dist/collection/components/{mrd-relation-field/mrd-relation-field.scss → fields/mrd-relation-field/mrd-relation-field.css} +61 -59
- package/dist/collection/components/{mrd-relation-field → fields/mrd-relation-field}/mrd-relation-field.js +16 -26
- package/dist/collection/components/{mrd-secret-field/mrd-secret-field.scss → fields/mrd-secret-field/mrd-secret-field.css} +7 -10
- package/dist/collection/components/{mrd-secret-field → fields/mrd-secret-field}/mrd-secret-field.js +4 -11
- package/dist/collection/components/{mrd-text-field/mrd-text-field.scss → fields/mrd-text-field/mrd-text-field.css} +2 -11
- package/dist/collection/components/{mrd-text-field → fields/mrd-text-field}/mrd-text-field.js +3 -10
- package/dist/collection/components/{mrd-textarea-field/mrd-textarea-field.scss → fields/mrd-textarea-field/mrd-textarea-field.css} +7 -10
- package/dist/collection/components/{mrd-textarea-field → fields/mrd-textarea-field}/mrd-textarea-field.js +3 -9
- package/dist/collection/components/{mrd-time-field/mrd-time-field.scss → fields/mrd-time-field/mrd-time-field.css} +8 -10
- package/dist/collection/components/{mrd-time-field → fields/mrd-time-field}/mrd-time-field.js +3 -10
- package/dist/collection/components/{mrd-field/mrd-field.scss → form/mrd-field/mrd-field.css} +1 -1
- package/dist/collection/components/{mrd-field → form/mrd-field}/mrd-field.js +3 -3
- package/dist/collection/components/{mrd-form/mrd-form.scss → form/mrd-form/mrd-form.css} +1 -1
- package/dist/collection/components/{mrd-form → form/mrd-form}/mrd-form.js +5 -5
- package/dist/collection/components/layout/mrd-layout-section/field-value.js +111 -0
- package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +29 -0
- package/dist/collection/components/{mrd-layout-section/mrd-layout-section.scss → layout/mrd-layout-section/mrd-layout-section.css} +4 -4
- package/dist/collection/components/{mrd-layout-section → layout/mrd-layout-section}/mrd-layout-section.js +58 -133
- package/dist/collection/components/{mrd-table/mrd-table.scss → table/mrd-table/mrd-table.css} +11 -13
- package/dist/collection/components/{mrd-table → table/mrd-table}/mrd-table.js +111 -439
- package/dist/collection/components/table/mrd-table/table-filter-popup.js +85 -0
- package/dist/collection/components/table/mrd-table/table-parts.js +110 -0
- package/dist/collection/components/table/mrd-table/table-query.js +178 -0
- package/dist/collection/components/table/mrd-table/virtual-scroll.js +49 -0
- package/dist/collection/dev/app.js +19 -18
- package/dist/collection/dev/example-data.js +58 -43
- package/dist/collection/utils/i18n.js +10 -0
- package/dist/collection/utils/query-params.js +43 -0
- package/dist/components/field-helpers.js +1 -0
- package/dist/components/file-upload-common.js +1 -0
- package/dist/components/i18n.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-form.js +1 -1
- package/dist/components/mrd-hyperlink-field2.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-list-field2.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-relation-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/components/query-params.js +1 -0
- package/dist/esm/{index-_tsCCkAi.js → index-DiSEJMA8.js} +38 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mosterdcomponents.js +3 -3
- package/dist/esm/mrd-boolean-field_23.entry.js +1280 -1073
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-9b3c0917.entry.js +1 -0
- package/dist/mosterdcomponents/p-DiSEJMA8.js +2 -0
- package/dist/types/components/{mrd-document-container → documents/mrd-document-container}/mrd-document-container.d.ts +7 -2
- package/dist/types/components/documents/mrd-document-list/folder-tree.d.ts +66 -0
- package/dist/types/components/{mrd-document-list → documents/mrd-document-list}/mrd-document-list.d.ts +28 -38
- package/dist/types/components/documents/mrd-document-list/tree-view.d.ts +32 -0
- package/dist/types/components/{mrd-document-view → documents/mrd-document-view}/mrd-document-view.d.ts +2 -2
- package/dist/types/components/fields/field-helpers.d.ts +18 -0
- package/dist/types/components/fields/file-upload-common.d.ts +18 -0
- package/dist/types/components/{mrd-boolean-field → fields/mrd-boolean-field}/mrd-boolean-field.d.ts +1 -1
- package/dist/types/components/{mrd-currency-field → fields/mrd-currency-field}/mrd-currency-field.d.ts +2 -2
- package/dist/types/components/{mrd-date-field → fields/mrd-date-field}/mrd-date-field.d.ts +1 -1
- package/dist/types/components/{mrd-datetime-field → fields/mrd-datetime-field}/mrd-datetime-field.d.ts +1 -1
- package/dist/types/components/{mrd-email-field → fields/mrd-email-field}/mrd-email-field.d.ts +1 -1
- package/dist/types/components/{mrd-file-field → fields/mrd-file-field}/mrd-file-field.d.ts +2 -4
- package/dist/types/components/{mrd-hyperlink-field → fields/mrd-hyperlink-field}/mrd-hyperlink-field.d.ts +2 -2
- package/dist/types/components/{mrd-image-field → fields/mrd-image-field}/mrd-image-field.d.ts +2 -4
- package/dist/types/components/{mrd-list-field → fields/mrd-list-field}/mrd-list-field.d.ts +2 -2
- package/dist/types/components/{mrd-longtext-field → fields/mrd-longtext-field}/mrd-longtext-field.d.ts +1 -1
- package/dist/types/components/{mrd-number-field → fields/mrd-number-field}/mrd-number-field.d.ts +2 -2
- package/dist/types/components/{mrd-relation-field → fields/mrd-relation-field}/mrd-relation-field.d.ts +2 -2
- package/dist/types/components/{mrd-secret-field → fields/mrd-secret-field}/mrd-secret-field.d.ts +1 -1
- package/dist/types/components/{mrd-text-field → fields/mrd-text-field}/mrd-text-field.d.ts +1 -1
- package/dist/types/components/{mrd-textarea-field → fields/mrd-textarea-field}/mrd-textarea-field.d.ts +1 -1
- package/dist/types/components/{mrd-time-field → fields/mrd-time-field}/mrd-time-field.d.ts +1 -1
- package/dist/types/components/{mrd-field → form/mrd-field}/mrd-field.d.ts +2 -2
- package/dist/types/components/{mrd-form → form/mrd-form}/mrd-form.d.ts +2 -2
- package/dist/types/components/layout/mrd-layout-section/field-value.d.ts +22 -0
- package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +8 -0
- package/dist/types/components/{mrd-layout-section → layout/mrd-layout-section}/mrd-layout-section.d.ts +4 -8
- package/dist/types/components/{mrd-table → table/mrd-table}/mrd-table.d.ts +6 -13
- package/dist/types/components/table/mrd-table/table-filter-popup.d.ts +35 -0
- package/dist/types/components/table/mrd-table/table-parts.d.ts +61 -0
- package/dist/types/components/table/mrd-table/table-query.d.ts +50 -0
- package/dist/types/components/table/mrd-table/virtual-scroll.d.ts +26 -0
- package/dist/types/components.d.ts +36 -5
- package/dist/types/types/client-layout.d.ts +5 -0
- package/dist/types/utils/query-params.d.ts +14 -0
- package/package.json +7 -2
- package/dist/components/validation.js +0 -1
- package/dist/mosterdcomponents/cell-renderer-B-AJDBcj.js.map +0 -1
- package/dist/mosterdcomponents/client-layout-ChqRA3AF.js.map +0 -1
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
- package/dist/mosterdcomponents/i18n-s1XrKcD2.js.map +0 -1
- package/dist/mosterdcomponents/index-DkY-NQj0.js.map +0 -1
- package/dist/mosterdcomponents/index-DwF_Sp__.js.map +0 -1
- package/dist/mosterdcomponents/index.esm.js.map +0 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
- package/dist/mosterdcomponents/p-69452249.entry.js +0 -1
- package/dist/mosterdcomponents/p-_tsCCkAi.js +0 -2
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
- package/dist/mosterdcomponents/validation-Br9k2Ztw.js.map +0 -1
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
gap: var(--mrd-space-1);
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
.mrd-text-field__label {
|
|
13
12
|
display: block;
|
|
14
13
|
font-family: var(--mrd-font-family);
|
|
@@ -16,12 +15,10 @@
|
|
|
16
15
|
font-weight: var(--mrd-label-font-weight);
|
|
17
16
|
color: var(--mrd-label-color);
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
.mrd-text-field__label--required::after {
|
|
21
|
-
content:
|
|
19
|
+
content: " *";
|
|
22
20
|
color: var(--mrd-color-danger);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
.mrd-text-field__input {
|
|
26
23
|
display: block;
|
|
27
24
|
width: 100%;
|
|
@@ -38,32 +35,26 @@
|
|
|
38
35
|
appearance: none;
|
|
39
36
|
box-sizing: border-box;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
.mrd-text-field__input::placeholder {
|
|
43
39
|
color: var(--mrd-input-placeholder-color);
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
.mrd-text-field__input:focus {
|
|
47
42
|
border-color: var(--mrd-border-color-focus);
|
|
48
43
|
box-shadow: var(--mrd-shadow-focus);
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
.mrd-text-field__input:disabled {
|
|
52
46
|
background-color: var(--mrd-input-bg-disabled);
|
|
53
47
|
cursor: not-allowed;
|
|
54
48
|
opacity: 0.7;
|
|
55
49
|
}
|
|
56
|
-
|
|
57
50
|
.mrd-text-field__input--error {
|
|
58
51
|
border-color: var(--mrd-border-color-error);
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
.mrd-text-field__input--error:focus {
|
|
62
54
|
box-shadow: var(--mrd-shadow-focus-error);
|
|
63
55
|
}
|
|
64
|
-
|
|
65
56
|
.mrd-text-field__error {
|
|
66
57
|
font-family: var(--mrd-font-family);
|
|
67
58
|
font-size: var(--mrd-error-font-size);
|
|
68
59
|
color: var(--mrd-error-color);
|
|
69
|
-
}
|
|
60
|
+
}
|
package/dist/collection/components/{mrd-text-field → fields/mrd-text-field}/mrd-text-field.js
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import {
|
|
3
|
-
import { validateRequired } from "../../utils/validation";
|
|
2
|
+
import { FieldLabel, FieldError, controlClass, requiredError } from "../field-helpers";
|
|
4
3
|
export class MrdTextField {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.name = '';
|
|
@@ -17,18 +16,12 @@ export class MrdTextField {
|
|
|
17
16
|
};
|
|
18
17
|
this.handleBlur = (e) => {
|
|
19
18
|
const val = e.target.value;
|
|
20
|
-
|
|
21
|
-
this.error = t('required', this.locale);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
this.error = '';
|
|
25
|
-
}
|
|
19
|
+
this.error = requiredError(val, this.required, this.locale);
|
|
26
20
|
this.mrdBlur.emit({ name: this.name, value: val });
|
|
27
21
|
};
|
|
28
22
|
}
|
|
29
23
|
render() {
|
|
30
|
-
|
|
31
|
-
return (h(Host, { key: 'e9252b251faf98ab190e643b97c13fa32d12ef22' }, h("div", { key: '37f4259a111c293f2fe12f321f08c00c25e77feb', class: "mrd-text-field" }, this.label && (h("label", { key: 'c59e0346fb71a765ea38629b03c06341567ed210', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'dc09953a672472348719f29904d900966d945843', class: `mrd-text-field__input${hasError ? ' mrd-text-field__input--error' : ''}`, type: "text", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, disabled: this.disabled, onInput: this.handleInput, onBlur: this.handleBlur }), hasError && h("span", { key: '037653857a372854a16b28ebf8994b23e3e0d696', class: "mrd-text-field__error" }, this.error))));
|
|
24
|
+
return (h(Host, { key: '71de1ae949941820574fc2d45cac6cca8264d8f9' }, h("div", { key: 'a63d3dd0811e012ae3d5a9f02c1a2ad1fcc0af86', class: "mrd-text-field" }, h(FieldLabel, { key: '1a6db878b634364f47522209344540a9cdc20635', base: "mrd-text-field", label: this.label, required: this.required }), h("input", { key: 'b3cd0338f13c5c2c8b744df62d3d02f3bc380aa1', 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: '1530066fefbda722df0c37871978995a139fcef0', base: "mrd-text-field", error: this.error }))));
|
|
32
25
|
}
|
|
33
26
|
static get is() { return "mrd-text-field"; }
|
|
34
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
gap: var(--mrd-space-1);
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
.mrd-textarea-field__label {
|
|
13
12
|
display: block;
|
|
14
13
|
font-family: var(--mrd-font-family);
|
|
@@ -16,11 +15,15 @@
|
|
|
16
15
|
font-weight: var(--mrd-label-font-weight);
|
|
17
16
|
color: var(--mrd-label-color);
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
.mrd-textarea-field__label--required::after {
|
|
21
|
-
content:
|
|
19
|
+
content: " *";
|
|
22
20
|
color: var(--mrd-color-danger);
|
|
23
21
|
}
|
|
22
|
+
.mrd-textarea-field__error {
|
|
23
|
+
font-family: var(--mrd-font-family);
|
|
24
|
+
font-size: var(--mrd-error-font-size);
|
|
25
|
+
color: var(--mrd-error-color);
|
|
26
|
+
}
|
|
24
27
|
|
|
25
28
|
.mrd-textarea-field__container {
|
|
26
29
|
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
@@ -70,10 +73,4 @@
|
|
|
70
73
|
.mrd-textarea-field__editor .ql-editor.ql-blank::before {
|
|
71
74
|
color: var(--mrd-input-placeholder-color);
|
|
72
75
|
font-style: normal;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.mrd-textarea-field__error {
|
|
76
|
-
font-family: var(--mrd-font-family);
|
|
77
|
-
font-size: var(--mrd-error-font-size);
|
|
78
|
-
color: var(--mrd-error-color);
|
|
79
|
-
}
|
|
76
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import {
|
|
3
|
-
import { validateRequired } from "../../utils/validation";
|
|
2
|
+
import { FieldLabel, FieldError, controlClass, requiredError } from "../field-helpers";
|
|
4
3
|
export class MrdTextareaField {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.name = '';
|
|
@@ -49,12 +48,7 @@ export class MrdTextareaField {
|
|
|
49
48
|
var _a, _b;
|
|
50
49
|
if (!range) {
|
|
51
50
|
const html = (_b = (_a = this.editorEl.querySelector('.ql-editor')) === null || _a === void 0 ? void 0 : _a.innerHTML) !== null && _b !== void 0 ? _b : '';
|
|
52
|
-
|
|
53
|
-
this.error = t('required', this.locale);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this.error = '';
|
|
57
|
-
}
|
|
51
|
+
this.error = requiredError(html, this.required, this.locale);
|
|
58
52
|
this.mrdBlur.emit({ name: this.name, value: html });
|
|
59
53
|
}
|
|
60
54
|
});
|
|
@@ -66,7 +60,7 @@ export class MrdTextareaField {
|
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
62
|
render() {
|
|
69
|
-
return (h(Host, { key: '
|
|
63
|
+
return (h(Host, { key: '464c1edde8447043d9352f1b5f9757bba97e9b17' }, h("div", { key: '8d06728214f54feeb1063700e5aaf7c439eb5473', class: "mrd-textarea-field" }, h(FieldLabel, { key: 'dbf93ecf41bd704706b49f8c455262798fbbe10b', base: "mrd-textarea-field", label: this.label, required: this.required }), h("div", { key: '9c39ccfa38ee01b880973966e910ee32aa60b144', class: controlClass('mrd-textarea-field', !!this.error, 'container') }, h("div", { key: '0217cd4350c1933018b2b8f489516b6d43a52538', class: "mrd-textarea-field__editor" })), h(FieldError, { key: '62d2a5db053ea6e4ec6868440f3ab31e1c05e633', base: "mrd-textarea-field", error: this.error }))));
|
|
70
64
|
}
|
|
71
65
|
static get is() { return "mrd-textarea-field"; }
|
|
72
66
|
static get encapsulation() { return "scoped"; }
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
gap: var(--mrd-space-1);
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
.mrd-time-field__label {
|
|
13
12
|
display: block;
|
|
14
13
|
font-family: var(--mrd-font-family);
|
|
@@ -16,12 +15,10 @@
|
|
|
16
15
|
font-weight: var(--mrd-label-font-weight);
|
|
17
16
|
color: var(--mrd-label-color);
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
.mrd-time-field__label--required::after {
|
|
21
|
-
content:
|
|
19
|
+
content: " *";
|
|
22
20
|
color: var(--mrd-color-danger);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
.mrd-time-field__input {
|
|
26
23
|
display: block;
|
|
27
24
|
width: 100%;
|
|
@@ -37,30 +34,31 @@
|
|
|
37
34
|
outline: none;
|
|
38
35
|
appearance: none;
|
|
39
36
|
box-sizing: border-box;
|
|
40
|
-
cursor: pointer;
|
|
41
37
|
}
|
|
42
|
-
|
|
38
|
+
.mrd-time-field__input::placeholder {
|
|
39
|
+
color: var(--mrd-input-placeholder-color);
|
|
40
|
+
}
|
|
43
41
|
.mrd-time-field__input:focus {
|
|
44
42
|
border-color: var(--mrd-border-color-focus);
|
|
45
43
|
box-shadow: var(--mrd-shadow-focus);
|
|
46
44
|
}
|
|
47
|
-
|
|
48
45
|
.mrd-time-field__input:disabled {
|
|
49
46
|
background-color: var(--mrd-input-bg-disabled);
|
|
50
47
|
cursor: not-allowed;
|
|
51
48
|
opacity: 0.7;
|
|
52
49
|
}
|
|
53
|
-
|
|
54
50
|
.mrd-time-field__input--error {
|
|
55
51
|
border-color: var(--mrd-border-color-error);
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
.mrd-time-field__input--error:focus {
|
|
59
54
|
box-shadow: var(--mrd-shadow-focus-error);
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
.mrd-time-field__error {
|
|
63
57
|
font-family: var(--mrd-font-family);
|
|
64
58
|
font-size: var(--mrd-error-font-size);
|
|
65
59
|
color: var(--mrd-error-color);
|
|
66
60
|
}
|
|
61
|
+
|
|
62
|
+
.mrd-time-field__input {
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
package/dist/collection/components/{mrd-time-field → fields/mrd-time-field}/mrd-time-field.js
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import {
|
|
3
|
-
import { validateRequired } from "../../utils/validation";
|
|
2
|
+
import { FieldLabel, FieldError, controlClass, requiredError } from "../field-helpers";
|
|
4
3
|
export class MrdTimeField {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.name = '';
|
|
@@ -12,12 +11,7 @@ export class MrdTimeField {
|
|
|
12
11
|
this.error = '';
|
|
13
12
|
this.handleChange = (e) => {
|
|
14
13
|
const val = e.target.value;
|
|
15
|
-
|
|
16
|
-
this.error = t('required', this.locale);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
this.error = '';
|
|
20
|
-
}
|
|
14
|
+
this.error = requiredError(val, this.required, this.locale);
|
|
21
15
|
this.mrdChange.emit({ name: this.name, value: val });
|
|
22
16
|
};
|
|
23
17
|
this.handleBlur = (e) => {
|
|
@@ -26,8 +20,7 @@ export class MrdTimeField {
|
|
|
26
20
|
};
|
|
27
21
|
}
|
|
28
22
|
render() {
|
|
29
|
-
|
|
30
|
-
return (h(Host, { key: '579219a478e31325b5a676465807c1d936724a2b' }, h("div", { key: '51b25f6e083a29989505c0ad79edbcd3b0060736', class: "mrd-time-field" }, this.label && (h("label", { key: '67d98bebb8803deea2d2a4a63f36706789ccd8c7', class: `mrd-time-field__label${this.required ? ' mrd-time-field__label--required' : ''}` }, this.label)), h("input", { key: '734741e0db1bdd5886fef37bba3b2f8d7200a0ab', class: `mrd-time-field__input${hasError ? ' mrd-time-field__input--error' : ''}`, type: "time", name: this.name, value: this.value, required: this.required, disabled: this.disabled, onChange: this.handleChange, onBlur: this.handleBlur }), hasError && h("span", { key: '0dbd168d14966dc56a77c97cd8fd8f9b208a4bf5', class: "mrd-time-field__error" }, this.error))));
|
|
23
|
+
return (h(Host, { key: 'fc30bdeb7c8d37bebc67a768f48013602879fb3d' }, h("div", { key: '52f899a889376773c1948f0c116670684db25cf4', class: "mrd-time-field" }, h(FieldLabel, { key: '3aba58f122fa4bb9f0ba4ad0b56fc3b29f03d4a3', base: "mrd-time-field", label: this.label, required: this.required }), h("input", { key: 'e39718394a195eafaf47aa2e62d560341bb0daed', 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: '07ad4ccbc5188e129d8bd3085e856839ec6a81c9', base: "mrd-time-field", error: this.error }))));
|
|
31
24
|
}
|
|
32
25
|
static get is() { return "mrd-time-field"; }
|
|
33
26
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, } from "
|
|
3
|
-
import { t } from "
|
|
2
|
+
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, } from "../../../types";
|
|
3
|
+
import { t } from "../../../utils/i18n";
|
|
4
4
|
export class MrdField {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.locale = navigator.language;
|
|
@@ -194,7 +194,7 @@ export class MrdField {
|
|
|
194
194
|
"references": {
|
|
195
195
|
"ClientLayoutItem": {
|
|
196
196
|
"location": "import",
|
|
197
|
-
"path": "
|
|
197
|
+
"path": "../../../types",
|
|
198
198
|
"id": "src/types/index.ts::ClientLayoutItem",
|
|
199
199
|
"referenceLocation": "ClientLayoutItem"
|
|
200
200
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { ClientLayoutItemType, ClientLayoutItemRelationEditBehavior } from "
|
|
3
|
-
import { t } from "
|
|
4
|
-
import { validateRequired } from "
|
|
2
|
+
import { ClientLayoutItemType, ClientLayoutItemRelationEditBehavior } from "../../../types";
|
|
3
|
+
import { t } from "../../../utils/i18n";
|
|
4
|
+
import { validateRequired } from "../../../utils/validation";
|
|
5
5
|
export class MrdForm {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.locale = navigator.language;
|
|
@@ -375,7 +375,7 @@ export class MrdForm {
|
|
|
375
375
|
"references": {
|
|
376
376
|
"ClientLayout": {
|
|
377
377
|
"location": "import",
|
|
378
|
-
"path": "
|
|
378
|
+
"path": "../../../types",
|
|
379
379
|
"id": "src/types/index.ts::ClientLayout",
|
|
380
380
|
"referenceLocation": "ClientLayout"
|
|
381
381
|
}
|
|
@@ -502,7 +502,7 @@ export class MrdForm {
|
|
|
502
502
|
"references": {
|
|
503
503
|
"RelationSearchResult": {
|
|
504
504
|
"location": "import",
|
|
505
|
-
"path": "
|
|
505
|
+
"path": "../../../types",
|
|
506
506
|
"id": "src/types/index.ts::RelationSearchResult",
|
|
507
507
|
"referenceLocation": "RelationSearchResult"
|
|
508
508
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { ClientLayoutItemFieldDataType } from "../../../types/client-layout";
|
|
3
|
+
import { CellRenderer } from "../../../utils/cell-renderer";
|
|
4
|
+
import { t } from "../../../utils/i18n";
|
|
5
|
+
import { formatDate } from "../../../utils/format";
|
|
6
|
+
/** FILE and IMAGE cells share the same download button. */
|
|
7
|
+
function downloadLink(ctx, href, fileName, label) {
|
|
8
|
+
return (h("button", { class: "mrd-layout-section__download-link", onClick: () => href && ctx.on.download({ href, fileName }) }, h("svg", { class: "mrd-layout-section__file-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z" })), label));
|
|
9
|
+
}
|
|
10
|
+
function renderSingleFieldValue(ctx, item, value) {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
12
|
+
const dt = item.dataType;
|
|
13
|
+
switch (dt) {
|
|
14
|
+
case ClientLayoutItemFieldDataType.HYPERLINK: {
|
|
15
|
+
const v = value;
|
|
16
|
+
const href = (_a = v === null || v === void 0 ? void 0 : v.href) !== null && _a !== void 0 ? _a : String(value);
|
|
17
|
+
const label = (_d = (_c = (_b = v === null || v === void 0 ? void 0 : v.name) !== null && _b !== void 0 ? _b : v === null || v === void 0 ? void 0 : v.text) !== null && _c !== void 0 ? _c : v === null || v === void 0 ? void 0 : v.label) !== null && _d !== void 0 ? _d : href;
|
|
18
|
+
return (h("a", { class: "mrd-layout-section__link", href: href, target: "_blank", rel: "noopener noreferrer" }, label));
|
|
19
|
+
}
|
|
20
|
+
case ClientLayoutItemFieldDataType.TEXTBLOCK:
|
|
21
|
+
return h("div", { class: "mrd-layout-section__prose", innerHTML: String(value) });
|
|
22
|
+
case ClientLayoutItemFieldDataType.LONGTEXT:
|
|
23
|
+
return h("pre", { class: "mrd-layout-section__pre" }, String(value));
|
|
24
|
+
case ClientLayoutItemFieldDataType.JSON:
|
|
25
|
+
return h("pre", { class: "mrd-layout-section__pre", innerHTML: CellRenderer.formatJson(value) });
|
|
26
|
+
case ClientLayoutItemFieldDataType.FILE: {
|
|
27
|
+
const v = value;
|
|
28
|
+
const fileName = (_e = v === null || v === void 0 ? void 0 : v.fileName) !== null && _e !== void 0 ? _e : String(value);
|
|
29
|
+
const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
|
|
30
|
+
return downloadLink(ctx, href, fileName, t('download', ctx.locale));
|
|
31
|
+
}
|
|
32
|
+
case ClientLayoutItemFieldDataType.IMAGE: {
|
|
33
|
+
const v = value;
|
|
34
|
+
const href = (_g = v === null || v === void 0 ? void 0 : v.href) !== null && _g !== void 0 ? _g : '';
|
|
35
|
+
const fileName = (_h = v === null || v === void 0 ? void 0 : v.fileName) !== null && _h !== void 0 ? _h : '';
|
|
36
|
+
const previewUrl = ctx.imagePreviews[item.name];
|
|
37
|
+
if (previewUrl) {
|
|
38
|
+
return (h("button", { class: "mrd-layout-section__image-thumb-btn", onClick: () => ctx.on.openImage(previewUrl), title: fileName || undefined }, h("img", { class: "mrd-layout-section__image-thumb", src: previewUrl, alt: fileName })));
|
|
39
|
+
}
|
|
40
|
+
return downloadLink(ctx, href, fileName, fileName || href);
|
|
41
|
+
}
|
|
42
|
+
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
43
|
+
return (h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', ctx.locale) : t('no', ctx.locale)));
|
|
44
|
+
case ClientLayoutItemFieldDataType.LIST: {
|
|
45
|
+
const listItem = ((_j = item.listItems) !== null && _j !== void 0 ? _j : []).find(li => li.key === String(value));
|
|
46
|
+
const label = (_k = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _k !== void 0 ? _k : String(value);
|
|
47
|
+
const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
|
|
48
|
+
const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
|
|
49
|
+
if (color && bg) {
|
|
50
|
+
return (h("span", { class: "mrd-layout-section__badge", style: { color, backgroundColor: bg } }, label));
|
|
51
|
+
}
|
|
52
|
+
if (color) {
|
|
53
|
+
return (h("span", { class: "mrd-layout-section__badge-dot-row" }, h("span", { class: "mrd-layout-section__badge-dot", style: { backgroundColor: color } }), label));
|
|
54
|
+
}
|
|
55
|
+
return label;
|
|
56
|
+
}
|
|
57
|
+
case ClientLayoutItemFieldDataType.SECRET:
|
|
58
|
+
return value ? h("span", { class: "mrd-layout-section__secret-masked" }, '••••••••') : null;
|
|
59
|
+
default: {
|
|
60
|
+
const text = CellRenderer.renderValue(dt, value, (_l = item.listItems) !== null && _l !== void 0 ? _l : [], ctx.locale);
|
|
61
|
+
return text || null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export function renderFieldValue(ctx, item, rawValue) {
|
|
66
|
+
if (rawValue == null || rawValue === '')
|
|
67
|
+
return null;
|
|
68
|
+
if (item.multiple && Array.isArray(rawValue)) {
|
|
69
|
+
const rendered = rawValue.map(v => renderSingleFieldValue(ctx, item, v));
|
|
70
|
+
if (rendered.every(r => typeof r === 'string' || r == null)) {
|
|
71
|
+
return rendered.filter(Boolean).join(', ') || null;
|
|
72
|
+
}
|
|
73
|
+
return (h("span", null, rendered.map((r, i) => (h("span", { key: String(i) }, r, i < rendered.length - 1 ? ', ' : '')))));
|
|
74
|
+
}
|
|
75
|
+
return renderSingleFieldValue(ctx, item, rawValue);
|
|
76
|
+
}
|
|
77
|
+
function renderHistoryBadge(ctx, item, raw) {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const hist = (_a = item.historyEnabled) !== null && _a !== void 0 ? _a : (_b = item.field) === null || _b === void 0 ? void 0 : _b.historyEnabled;
|
|
80
|
+
if (!hist || !item.name)
|
|
81
|
+
return null;
|
|
82
|
+
const history = (_c = raw === null || raw === void 0 ? void 0 : raw.history) !== null && _c !== void 0 ? _c : [];
|
|
83
|
+
if (!history.length)
|
|
84
|
+
return null;
|
|
85
|
+
const sorted = [...history].sort((a, b) => b.until.localeCompare(a.until));
|
|
86
|
+
const isOpen = ctx.openHistoryField === item.name;
|
|
87
|
+
return (h("span", { class: "mrd-layout-section__history-wrap" }, h("button", { type: "button", class: "mrd-layout-section__history-btn", title: t('history_badge_tooltip', ctx.locale), "aria-label": t('history_badge_tooltip', ctx.locale), onClick: (e) => {
|
|
88
|
+
e.stopPropagation();
|
|
89
|
+
ctx.on.toggleHistory(isOpen ? null : item.name);
|
|
90
|
+
} }, h("svg", { class: "mrd-layout-section__history-icon", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .207.085.394.22.53l2.5 2.5a.75.75 0 101.06-1.06L10.75 9.69V5z", "clip-rule": "evenodd" }))), isOpen && (h("div", { class: "mrd-layout-section__history-popover", role: "listbox" }, sorted.map((entry, i) => (h("div", { key: String(i), class: "mrd-layout-section__history-entry" }, entry.value, " (", t('history_until', ctx.locale), " ", formatDate(entry.until, ctx.locale), ")")))))));
|
|
91
|
+
}
|
|
92
|
+
export function renderField(ctx, item) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
if (!item.name)
|
|
95
|
+
return null;
|
|
96
|
+
const raw = ctx.data[item.name];
|
|
97
|
+
const hist = (_a = item.historyEnabled) !== null && _a !== void 0 ? _a : (_b = item.field) === null || _b === void 0 ? void 0 : _b.historyEnabled;
|
|
98
|
+
const rawValue = hist && raw !== null && typeof raw === 'object' && 'current' in raw
|
|
99
|
+
? raw.current
|
|
100
|
+
: raw;
|
|
101
|
+
const renderedValue = renderFieldValue(ctx, item, rawValue);
|
|
102
|
+
if (item.header) {
|
|
103
|
+
return (h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
104
|
+
}
|
|
105
|
+
if (renderedValue == null)
|
|
106
|
+
return null;
|
|
107
|
+
const isBlock = item.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
108
|
+
|| item.dataType === ClientLayoutItemFieldDataType.LONGTEXT
|
|
109
|
+
|| item.dataType === ClientLayoutItemFieldDataType.JSON;
|
|
110
|
+
return (h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key: item.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, renderedValue, renderHistoryBadge(ctx, item, raw))));
|
|
111
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClientLayoutItemType } from "../../../types/client-layout";
|
|
2
|
+
/** Key an embedded view is addressed by (setViewPage etc.). */
|
|
3
|
+
export function viewKeyFor(item) {
|
|
4
|
+
var _a, _b, _c, _d;
|
|
5
|
+
if (item.type === ClientLayoutItemType.RELATED_VIEW)
|
|
6
|
+
return (_b = (_a = item.relatedClass) !== null && _a !== void 0 ? _a : item.name) !== null && _b !== void 0 ? _b : '';
|
|
7
|
+
return (_d = (_c = item.dataClass) !== null && _c !== void 0 ? _c : item.name) !== null && _d !== void 0 ? _d : '';
|
|
8
|
+
}
|
|
9
|
+
/** Depth-first flatten of the SECTION/GROUP tree. */
|
|
10
|
+
export function flattenItems(items) {
|
|
11
|
+
const result = [];
|
|
12
|
+
for (const item of items) {
|
|
13
|
+
result.push(item);
|
|
14
|
+
if (item.items)
|
|
15
|
+
result.push(...flattenItems(item.items));
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
/** Build the canonical parent href `/{base}/{tenant}/{fromClass}/{parentId}` from
|
|
20
|
+
* the object's self href. Empty unless it is a RELATED_VIEW with a fromClass. */
|
|
21
|
+
export function buildContainerHref(item, selfHref, parentId) {
|
|
22
|
+
if (item.type !== ClientLayoutItemType.RELATED_VIEW || !item.fromClass || !parentId)
|
|
23
|
+
return '';
|
|
24
|
+
const segs = selfHref.split('/').filter(Boolean);
|
|
25
|
+
if (segs.length < 2)
|
|
26
|
+
return '';
|
|
27
|
+
const [base, tenant] = segs;
|
|
28
|
+
return `/${base}/${tenant}/${item.fromClass}/${parentId}`;
|
|
29
|
+
}
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
border-radius: var(--mrd-border-radius);
|
|
239
239
|
padding: var(--mrd-space-3);
|
|
240
240
|
margin: 0;
|
|
241
|
-
max-height: calc(
|
|
241
|
+
max-height: calc(15 * var(--mrd-font-size-xs));
|
|
242
242
|
overflow-x: auto;
|
|
243
243
|
overflow-y: auto;
|
|
244
244
|
white-space: pre-wrap;
|
|
@@ -401,7 +401,7 @@
|
|
|
401
401
|
|
|
402
402
|
.mrd-layout-section__modal {
|
|
403
403
|
position: relative;
|
|
404
|
-
background:
|
|
404
|
+
background: var(--mrd-color-white);
|
|
405
405
|
border-radius: var(--mrd-border-radius);
|
|
406
406
|
padding: var(--mrd-space-3);
|
|
407
407
|
max-width: min(90vw, 900px);
|
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
display: flex;
|
|
425
425
|
align-items: center;
|
|
426
426
|
justify-content: center;
|
|
427
|
-
color:
|
|
427
|
+
color: var(--mrd-color-white);
|
|
428
428
|
cursor: pointer;
|
|
429
429
|
font-size: var(--mrd-font-size-sm);
|
|
430
430
|
line-height: 1;
|
|
@@ -441,4 +441,4 @@
|
|
|
441
441
|
max-height: calc(90vh - 2rem);
|
|
442
442
|
border-radius: var(--mrd-border-radius);
|
|
443
443
|
object-fit: contain;
|
|
444
|
-
}
|
|
444
|
+
}
|