@mmlogic/components 0.3.11 → 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 +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_23.cjs.entry.js +1203 -1084
- 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 +7 -7
- 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} +6 -4
- package/dist/collection/components/{mrd-document-list → documents/mrd-document-list}/mrd-document-list.js +83 -240
- 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 +52 -142
- 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 +8 -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 +2 -2
- package/dist/esm/mosterdcomponents.js +2 -2
- package/dist/esm/mrd-boolean-field_23.entry.js +1203 -1084
- 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 +2 -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 +4 -37
- 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 -11
- 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 +3 -5
- 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/p-_tsCCkAi.js +0 -2
- package/dist/mosterdcomponents/p-a9618055.entry.js +0 -1
|
@@ -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 MrdLongtextField {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.name = '';
|
|
@@ -17,18 +16,12 @@ export class MrdLongtextField {
|
|
|
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: 'f00f81944748f8f09e22d44befe5e288456b7cc8' }, h("div", { key: '7b0ae9cf5b6b684cddb648fe4db6005494322535', class: "mrd-longtext-field" }, this.label && (h("label", { key: '3fc6a8710d0e98fe685c45d214a88ae1b0947973', class: `mrd-longtext-field__label${this.required ? ' mrd-longtext-field__label--required' : ''}` }, this.label)), this.disabled ? (h("pre", { class: "mrd-longtext-field__content" }, this.value)) : (h("textarea", { class: `mrd-longtext-field__input${hasError ? ' mrd-longtext-field__input--error' : ''}`, name: this.name, placeholder: this.placeholder, required: this.required, rows: 10, onInput: this.handleInput, onBlur: this.handleBlur }, this.value)), hasError && h("span", { key: 'e96f1dbc6c00a1602f4ce3c97d514a229aeb7cb7', class: "mrd-longtext-field__error" }, this.error))));
|
|
24
|
+
return (h(Host, { key: '1d23db1324fa0fc97a07fdae65f2d84e43419a72' }, h("div", { key: '0ad2b262088aa3745f088a44af26649593805840', class: "mrd-longtext-field" }, h(FieldLabel, { key: '5a78739d6ced4e2df77589b64c66401819c4b5c7', 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: '5b870a75b518e2808518b83c9abebf8589a86108', base: "mrd-longtext-field", error: this.error }))));
|
|
32
25
|
}
|
|
33
26
|
static get is() { return "mrd-longtext-field"; }
|
|
34
27
|
static get encapsulation() { return "scoped"; }
|
|
@@ -16,9 +16,8 @@
|
|
|
16
16
|
font-weight: var(--mrd-label-font-weight);
|
|
17
17
|
color: var(--mrd-label-color);
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
.mrd-number-field__label--required::after {
|
|
21
|
-
content:
|
|
20
|
+
content: " *";
|
|
22
21
|
color: var(--mrd-color-danger);
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -43,35 +42,35 @@
|
|
|
43
42
|
outline: none;
|
|
44
43
|
appearance: none;
|
|
45
44
|
box-sizing: border-box;
|
|
46
|
-
text-align: right;
|
|
47
45
|
}
|
|
48
|
-
|
|
49
46
|
.mrd-number-field__input::placeholder {
|
|
50
47
|
color: var(--mrd-input-placeholder-color);
|
|
51
|
-
text-align: left;
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
.mrd-number-field__input:focus {
|
|
55
50
|
border-color: var(--mrd-border-color-focus);
|
|
56
51
|
box-shadow: var(--mrd-shadow-focus);
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
.mrd-number-field__input:disabled {
|
|
60
54
|
background-color: var(--mrd-input-bg-disabled);
|
|
61
55
|
cursor: not-allowed;
|
|
62
56
|
opacity: 0.7;
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
.mrd-number-field__input--error {
|
|
66
59
|
border-color: var(--mrd-border-color-error);
|
|
67
60
|
}
|
|
68
|
-
|
|
69
61
|
.mrd-number-field__input--error:focus {
|
|
70
62
|
box-shadow: var(--mrd-shadow-focus-error);
|
|
71
63
|
}
|
|
64
|
+
.mrd-number-field__input {
|
|
65
|
+
text-align: right;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.mrd-number-field__input::placeholder {
|
|
69
|
+
text-align: left;
|
|
70
|
+
}
|
|
72
71
|
|
|
73
72
|
.mrd-number-field__error {
|
|
74
73
|
font-family: var(--mrd-font-family);
|
|
75
74
|
font-size: var(--mrd-error-font-size);
|
|
76
75
|
color: var(--mrd-error-color);
|
|
77
|
-
}
|
|
76
|
+
}
|
package/dist/collection/components/{mrd-number-field → fields/mrd-number-field}/mrd-number-field.js
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { t } from "
|
|
3
|
-
import { validateRequired, validateNumber } from "
|
|
4
|
-
import { formatNumber, parseLocalizedNumber } from "
|
|
5
|
-
import { ClientLayoutItemFieldDataType } from "
|
|
2
|
+
import { t } from "../../../utils/i18n";
|
|
3
|
+
import { validateRequired, validateNumber } from "../../../utils/validation";
|
|
4
|
+
import { formatNumber, parseLocalizedNumber } from "../../../utils/format";
|
|
5
|
+
import { ClientLayoutItemFieldDataType } from "../../../types";
|
|
6
|
+
import { FieldLabel, FieldError, controlClass } from "../field-helpers";
|
|
6
7
|
export class MrdNumberField {
|
|
7
8
|
constructor() {
|
|
8
9
|
this.name = '';
|
|
@@ -69,7 +70,7 @@ export class MrdNumberField {
|
|
|
69
70
|
const hasError = !!this.error;
|
|
70
71
|
const suffix = this.dataType === ClientLayoutItemFieldDataType.PERCENTAGE ? '%' :
|
|
71
72
|
this.dataType === ClientLayoutItemFieldDataType.DECIMAL ? '' : '';
|
|
72
|
-
return (h(Host, { key: '
|
|
73
|
+
return (h(Host, { key: 'fd7220e0a7f574ab0c61094a9ba7fd764e1adafd' }, h("div", { key: 'ef6118a339c9766f187cd2b1fa3fcc85ef8cb69f', class: "mrd-number-field" }, h(FieldLabel, { key: '015207ae65df07f7ee7bbc24ccab45524176dbf7', base: "mrd-number-field", label: this.label, required: this.required }), h("div", { key: '954b99cbcf4002b0336810e354f1a46d39cb8076', class: "mrd-number-field__input-wrapper" }, h("input", { key: 'dddc08e090b200736d186960db1436e44f42703c', 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: '87e12bd737aed0a845470cef66d7a6d61d11de0b', base: "mrd-number-field", error: this.error }))));
|
|
73
74
|
}
|
|
74
75
|
static get is() { return "mrd-number-field"; }
|
|
75
76
|
static get encapsulation() { return "scoped"; }
|
|
@@ -234,7 +235,7 @@ export class MrdNumberField {
|
|
|
234
235
|
"references": {
|
|
235
236
|
"ClientLayoutItemFieldDataType": {
|
|
236
237
|
"location": "import",
|
|
237
|
-
"path": "
|
|
238
|
+
"path": "../../../types",
|
|
238
239
|
"id": "src/types/index.ts::ClientLayoutItemFieldDataType",
|
|
239
240
|
"referenceLocation": "ClientLayoutItemFieldDataType"
|
|
240
241
|
}
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
font-weight: var(--mrd-label-font-weight);
|
|
18
18
|
color: var(--mrd-label-color);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
20
|
.mrd-relation-field__label--required::after {
|
|
22
|
-
content:
|
|
21
|
+
content: " *";
|
|
23
22
|
color: var(--mrd-color-danger);
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -28,41 +27,85 @@
|
|
|
28
27
|
width: 100%;
|
|
29
28
|
height: var(--mrd-input-height);
|
|
30
29
|
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
31
|
-
padding-right: calc(var(--mrd-input-padding-x) + 1.5rem);
|
|
32
30
|
font-family: var(--mrd-font-family);
|
|
33
31
|
font-size: var(--mrd-font-size-base);
|
|
34
32
|
color: var(--mrd-input-color);
|
|
35
33
|
background-color: var(--mrd-input-bg);
|
|
36
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
|
|
37
|
-
background-repeat: no-repeat;
|
|
38
|
-
background-position: right var(--mrd-space-3) center;
|
|
39
34
|
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
40
35
|
border-radius: var(--mrd-border-radius);
|
|
36
|
+
transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
|
|
41
37
|
outline: none;
|
|
42
38
|
appearance: none;
|
|
43
|
-
cursor: pointer;
|
|
44
39
|
box-sizing: border-box;
|
|
45
40
|
}
|
|
46
|
-
|
|
41
|
+
.mrd-relation-field__select::placeholder {
|
|
42
|
+
color: var(--mrd-input-placeholder-color);
|
|
43
|
+
}
|
|
47
44
|
.mrd-relation-field__select:focus {
|
|
48
45
|
border-color: var(--mrd-border-color-focus);
|
|
49
46
|
box-shadow: var(--mrd-shadow-focus);
|
|
50
47
|
}
|
|
51
|
-
|
|
52
48
|
.mrd-relation-field__select:disabled {
|
|
53
49
|
background-color: var(--mrd-input-bg-disabled);
|
|
54
50
|
cursor: not-allowed;
|
|
55
51
|
opacity: 0.7;
|
|
56
52
|
}
|
|
57
|
-
|
|
58
53
|
.mrd-relation-field__select--error {
|
|
59
54
|
border-color: var(--mrd-border-color-error);
|
|
60
55
|
}
|
|
61
|
-
|
|
62
56
|
.mrd-relation-field__select--error:focus {
|
|
63
57
|
box-shadow: var(--mrd-shadow-focus-error);
|
|
64
58
|
}
|
|
59
|
+
.mrd-relation-field__select {
|
|
60
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
|
|
61
|
+
background-repeat: no-repeat;
|
|
62
|
+
background-position: right var(--mrd-space-3) center;
|
|
63
|
+
padding-right: calc(var(--mrd-input-padding-x) + 1.5rem);
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.mrd-relation-field__search {
|
|
68
|
+
display: block;
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: var(--mrd-input-height);
|
|
71
|
+
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
72
|
+
font-family: var(--mrd-font-family);
|
|
73
|
+
font-size: var(--mrd-font-size-base);
|
|
74
|
+
color: var(--mrd-input-color);
|
|
75
|
+
background-color: var(--mrd-input-bg);
|
|
76
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
77
|
+
border-radius: var(--mrd-border-radius);
|
|
78
|
+
transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
|
|
79
|
+
outline: none;
|
|
80
|
+
appearance: none;
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
}
|
|
83
|
+
.mrd-relation-field__search::placeholder {
|
|
84
|
+
color: var(--mrd-input-placeholder-color);
|
|
85
|
+
}
|
|
86
|
+
.mrd-relation-field__search:focus {
|
|
87
|
+
border-color: var(--mrd-border-color-focus);
|
|
88
|
+
box-shadow: var(--mrd-shadow-focus);
|
|
89
|
+
}
|
|
90
|
+
.mrd-relation-field__search:disabled {
|
|
91
|
+
background-color: var(--mrd-input-bg-disabled);
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
opacity: 0.7;
|
|
94
|
+
}
|
|
95
|
+
.mrd-relation-field__search--error {
|
|
96
|
+
border-color: var(--mrd-border-color-error);
|
|
97
|
+
}
|
|
98
|
+
.mrd-relation-field__search--error:focus {
|
|
99
|
+
box-shadow: var(--mrd-shadow-focus-error);
|
|
100
|
+
}
|
|
65
101
|
|
|
102
|
+
.mrd-relation-field__error {
|
|
103
|
+
font-family: var(--mrd-font-family);
|
|
104
|
+
font-size: var(--mrd-error-font-size);
|
|
105
|
+
color: var(--mrd-error-color);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Multi-select tags */
|
|
66
109
|
.mrd-relation-field__tags {
|
|
67
110
|
display: flex;
|
|
68
111
|
flex-wrap: wrap;
|
|
@@ -98,51 +141,13 @@
|
|
|
98
141
|
opacity: 1;
|
|
99
142
|
}
|
|
100
143
|
|
|
144
|
+
/* Search input with spinner */
|
|
101
145
|
.mrd-relation-field__search-wrapper {
|
|
102
146
|
position: relative;
|
|
103
147
|
display: flex;
|
|
104
148
|
align-items: center;
|
|
105
149
|
}
|
|
106
150
|
|
|
107
|
-
.mrd-relation-field__search {
|
|
108
|
-
display: block;
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: var(--mrd-input-height);
|
|
111
|
-
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
112
|
-
font-family: var(--mrd-font-family);
|
|
113
|
-
font-size: var(--mrd-font-size-base);
|
|
114
|
-
color: var(--mrd-input-color);
|
|
115
|
-
background-color: var(--mrd-input-bg);
|
|
116
|
-
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
117
|
-
border-radius: var(--mrd-border-radius);
|
|
118
|
-
outline: none;
|
|
119
|
-
appearance: none;
|
|
120
|
-
box-sizing: border-box;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.mrd-relation-field__search::placeholder {
|
|
124
|
-
color: var(--mrd-input-placeholder-color);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.mrd-relation-field__search:focus {
|
|
128
|
-
border-color: var(--mrd-border-color-focus);
|
|
129
|
-
box-shadow: var(--mrd-shadow-focus);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.mrd-relation-field__search:disabled {
|
|
133
|
-
background-color: var(--mrd-input-bg-disabled);
|
|
134
|
-
cursor: not-allowed;
|
|
135
|
-
opacity: 0.7;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.mrd-relation-field__search--error {
|
|
139
|
-
border-color: var(--mrd-border-color-error);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.mrd-relation-field__search--error:focus {
|
|
143
|
-
box-shadow: var(--mrd-shadow-focus-error);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
151
|
.mrd-relation-field__spinner {
|
|
147
152
|
position: absolute;
|
|
148
153
|
right: var(--mrd-space-3);
|
|
@@ -155,9 +160,11 @@
|
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
@keyframes mrd-spin {
|
|
158
|
-
to {
|
|
163
|
+
to {
|
|
164
|
+
transform: rotate(360deg);
|
|
165
|
+
}
|
|
159
166
|
}
|
|
160
|
-
|
|
167
|
+
/* Search results dropdown */
|
|
161
168
|
.mrd-relation-field__results {
|
|
162
169
|
position: absolute;
|
|
163
170
|
top: calc(100% + var(--mrd-space-1));
|
|
@@ -206,6 +213,7 @@
|
|
|
206
213
|
background-color: var(--mrd-color-primary-light);
|
|
207
214
|
}
|
|
208
215
|
|
|
216
|
+
/* Selected single value */
|
|
209
217
|
.mrd-relation-field__selected-value {
|
|
210
218
|
display: flex;
|
|
211
219
|
align-items: center;
|
|
@@ -257,10 +265,4 @@
|
|
|
257
265
|
font-size: var(--mrd-font-size-sm);
|
|
258
266
|
color: var(--mrd-color-neutral-500);
|
|
259
267
|
text-align: center;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.mrd-relation-field__error {
|
|
263
|
-
font-family: var(--mrd-font-family);
|
|
264
|
-
font-size: var(--mrd-error-font-size);
|
|
265
|
-
color: var(--mrd-error-color);
|
|
266
|
-
}
|
|
268
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { t } from "../../../utils/i18n";
|
|
3
|
+
import { ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior } from "../../../types";
|
|
4
|
+
import { FieldLabel, FieldError, controlClass, requiredError } from "../field-helpers";
|
|
5
5
|
export class MrdRelationField {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.name = '';
|
|
@@ -96,12 +96,7 @@ export class MrdRelationField {
|
|
|
96
96
|
this.showResults = false;
|
|
97
97
|
this.mrdChange.emit({ name: this.name, value: result.id });
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
this.error = t('required', this.locale);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
this.error = '';
|
|
104
|
-
}
|
|
99
|
+
this.error = requiredError(this.selectedItems, this.required, this.locale);
|
|
105
100
|
};
|
|
106
101
|
this.handleRemoveSelected = (id) => {
|
|
107
102
|
this.selectedItems = this.selectedItems.filter(i => i.id !== id);
|
|
@@ -110,12 +105,7 @@ export class MrdRelationField {
|
|
|
110
105
|
};
|
|
111
106
|
this.handleDropdownChange = (e) => {
|
|
112
107
|
const val = e.target.value;
|
|
113
|
-
|
|
114
|
-
this.error = t('required', this.locale);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this.error = '';
|
|
118
|
-
}
|
|
108
|
+
this.error = requiredError(val, this.required, this.locale);
|
|
119
109
|
this.mrdChange.emit({ name: this.name, value: val });
|
|
120
110
|
};
|
|
121
111
|
this.handleBlur = () => {
|
|
@@ -226,19 +216,19 @@ export class MrdRelationField {
|
|
|
226
216
|
const hasError = !!this.error;
|
|
227
217
|
if (this.editBehavior === ClientLayoutItemRelationEditBehavior.DROPDOWN) {
|
|
228
218
|
const currentValue = this.getValueHref();
|
|
229
|
-
return (h(Host, null, h("div", { class: "mrd-relation-field" },
|
|
219
|
+
return (h(Host, null, h("div", { class: "mrd-relation-field" }, h(FieldLabel, { base: "mrd-relation-field", label: this.label, required: this.required }), h("select", { class: controlClass('mrd-relation-field', hasError, 'select'), name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.allRecords.map(record => (h("option", { key: record.id, value: record.id, selected: record.id === currentValue }, record.label)))), h(FieldError, { base: "mrd-relation-field", error: this.error }))));
|
|
230
220
|
}
|
|
231
221
|
if (this.displayType === ClientLayoutItemRelationDisplayType.DROPDOWN) {
|
|
232
222
|
const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
|
|
233
|
-
return (h(Host, null, h("div", { class: "mrd-relation-field" },
|
|
223
|
+
return (h(Host, null, h("div", { class: "mrd-relation-field" }, h(FieldLabel, { base: "mrd-relation-field", label: this.label, required: this.required }), h("select", { class: controlClass('mrd-relation-field', hasError, 'select'), name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (h("option", { key: dv.key, value: dv.key, selected: dv.key === currentValue }, dv.label)))), h(FieldError, { base: "mrd-relation-field", error: this.error }))));
|
|
234
224
|
}
|
|
235
225
|
// SEARCH mode
|
|
236
|
-
const labelEl =
|
|
226
|
+
const labelEl = h(FieldLabel, { base: "mrd-relation-field", label: this.label, required: this.required });
|
|
237
227
|
// Single selection: show selected value as a badge, hide the search input
|
|
238
228
|
if (!this.multiple && this.selectedItems.length > 0) {
|
|
239
|
-
return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, h("div", { class: `mrd-relation-field__selected-value${hasError ? ' mrd-relation-field__selected-value--error' : ''}` }, h("span", { class: "mrd-relation-field__selected-name" }, this.selectedItems[0].label), h("button", { type: "button", class: "mrd-relation-field__selected-clear", onClick: this.clearSelection, "aria-label": t('remove', this.locale) }, "\u2715")),
|
|
229
|
+
return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, h("div", { class: `mrd-relation-field__selected-value${hasError ? ' mrd-relation-field__selected-value--error' : ''}` }, h("span", { class: "mrd-relation-field__selected-name" }, this.selectedItems[0].label), h("button", { type: "button", class: "mrd-relation-field__selected-clear", onClick: this.clearSelection, "aria-label": t('remove', this.locale) }, "\u2715")), h(FieldError, { base: "mrd-relation-field", error: this.error }))));
|
|
240
230
|
}
|
|
241
|
-
return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, this.multiple && this.selectedItems.length > 0 && (h("div", { class: "mrd-relation-field__tags" }, this.selectedItems.map(item => (h("span", { key: item.id, class: "mrd-relation-field__tag" }, item.label, h("button", { type: "button", class: "mrd-relation-field__tag-remove", onClick: () => this.handleRemoveSelected(item.id), "aria-label": t('remove', this.locale) }, "\u2715")))))), h("div", { class: "mrd-relation-field__search-wrapper" }, h("input", { class: `mrd-relation-field__search${hasError ? ' mrd-relation-field__search--error' : ''}`, type: "text", value: this.searchQuery, placeholder: t('search_placeholder', this.locale), disabled: this.disabled, onInput: this.handleSearchInput, onKeyDown: this.handleKeyDown, onBlur: this.handleBlur }), this.isLoading && (h("span", { class: "mrd-relation-field__spinner", "aria-label": t('loading', this.locale) }))), this.showResults && (h("div", { class: "mrd-relation-field__results" }, this.searchResults.length === 0 && !this.isLoading ? (h("div", { class: "mrd-relation-field__no-results" }, t('no_results', this.locale))) : (this.searchResults.map((result, i) => (h("div", { key: result.id, class: `mrd-relation-field__result-item${i === this.highlightedIndex ? ' mrd-relation-field__result-item--highlighted' : ''}`, onMouseDown: () => this.handleResultSelect(result) }, h("span", { class: "mrd-relation-field__result-label" }, result.label), result.description && (h("span", { class: "mrd-relation-field__result-desc" }, result.description)))))))),
|
|
231
|
+
return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, this.multiple && this.selectedItems.length > 0 && (h("div", { class: "mrd-relation-field__tags" }, this.selectedItems.map(item => (h("span", { key: item.id, class: "mrd-relation-field__tag" }, item.label, h("button", { type: "button", class: "mrd-relation-field__tag-remove", onClick: () => this.handleRemoveSelected(item.id), "aria-label": t('remove', this.locale) }, "\u2715")))))), h("div", { class: "mrd-relation-field__search-wrapper" }, h("input", { class: `mrd-relation-field__search${hasError ? ' mrd-relation-field__search--error' : ''}`, type: "text", value: this.searchQuery, placeholder: t('search_placeholder', this.locale), disabled: this.disabled, onInput: this.handleSearchInput, onKeyDown: this.handleKeyDown, onBlur: this.handleBlur }), this.isLoading && (h("span", { class: "mrd-relation-field__spinner", "aria-label": t('loading', this.locale) }))), this.showResults && (h("div", { class: "mrd-relation-field__results" }, this.searchResults.length === 0 && !this.isLoading ? (h("div", { class: "mrd-relation-field__no-results" }, t('no_results', this.locale))) : (this.searchResults.map((result, i) => (h("div", { key: result.id, class: `mrd-relation-field__result-item${i === this.highlightedIndex ? ' mrd-relation-field__result-item--highlighted' : ''}`, onMouseDown: () => this.handleResultSelect(result) }, h("span", { class: "mrd-relation-field__result-label" }, result.label), result.description && (h("span", { class: "mrd-relation-field__result-desc" }, result.description)))))))), h(FieldError, { base: "mrd-relation-field", error: this.error }))));
|
|
242
232
|
}
|
|
243
233
|
static get is() { return "mrd-relation-field"; }
|
|
244
234
|
static get encapsulation() { return "scoped"; }
|
|
@@ -403,7 +393,7 @@ export class MrdRelationField {
|
|
|
403
393
|
"references": {
|
|
404
394
|
"ClientLayoutItemRelationDisplayType": {
|
|
405
395
|
"location": "import",
|
|
406
|
-
"path": "
|
|
396
|
+
"path": "../../../types",
|
|
407
397
|
"id": "src/types/index.ts::ClientLayoutItemRelationDisplayType",
|
|
408
398
|
"referenceLocation": "ClientLayoutItemRelationDisplayType"
|
|
409
399
|
}
|
|
@@ -430,7 +420,7 @@ export class MrdRelationField {
|
|
|
430
420
|
"references": {
|
|
431
421
|
"ClientLayoutItemRelationEditBehavior": {
|
|
432
422
|
"location": "import",
|
|
433
|
-
"path": "
|
|
423
|
+
"path": "../../../types",
|
|
434
424
|
"id": "src/types/index.ts::ClientLayoutItemRelationEditBehavior",
|
|
435
425
|
"referenceLocation": "ClientLayoutItemRelationEditBehavior"
|
|
436
426
|
}
|
|
@@ -495,7 +485,7 @@ export class MrdRelationField {
|
|
|
495
485
|
"references": {
|
|
496
486
|
"ClientListValue": {
|
|
497
487
|
"location": "import",
|
|
498
|
-
"path": "
|
|
488
|
+
"path": "../../../types",
|
|
499
489
|
"id": "src/types/index.ts::ClientListValue",
|
|
500
490
|
"referenceLocation": "ClientListValue"
|
|
501
491
|
}
|
|
@@ -520,7 +510,7 @@ export class MrdRelationField {
|
|
|
520
510
|
"references": {
|
|
521
511
|
"RelationSearchResult": {
|
|
522
512
|
"location": "import",
|
|
523
|
-
"path": "
|
|
513
|
+
"path": "../../../types",
|
|
524
514
|
"id": "src/types/index.ts::RelationSearchResult",
|
|
525
515
|
"referenceLocation": "RelationSearchResult"
|
|
526
516
|
}
|
|
@@ -632,7 +622,7 @@ export class MrdRelationField {
|
|
|
632
622
|
},
|
|
633
623
|
"RelationSearchResult": {
|
|
634
624
|
"location": "import",
|
|
635
|
-
"path": "
|
|
625
|
+
"path": "../../../types",
|
|
636
626
|
"id": "src/types/index.ts::RelationSearchResult",
|
|
637
627
|
"referenceLocation": "RelationSearchResult"
|
|
638
628
|
}
|
|
@@ -659,7 +649,7 @@ export class MrdRelationField {
|
|
|
659
649
|
},
|
|
660
650
|
"RelationSearchResult": {
|
|
661
651
|
"location": "import",
|
|
662
|
-
"path": "
|
|
652
|
+
"path": "../../../types",
|
|
663
653
|
"id": "src/types/index.ts::RelationSearchResult",
|
|
664
654
|
"referenceLocation": "RelationSearchResult"
|
|
665
655
|
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
gap: var(--mrd-space-1);
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
.mrd-secret-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-secret-field__label--required::after {
|
|
21
|
-
content:
|
|
19
|
+
content: " *";
|
|
22
20
|
color: var(--mrd-color-danger);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
.mrd-secret-field__input {
|
|
26
23
|
display: block;
|
|
27
24
|
width: 100%;
|
|
@@ -38,24 +35,24 @@
|
|
|
38
35
|
appearance: none;
|
|
39
36
|
box-sizing: border-box;
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
.mrd-secret-field__input::placeholder {
|
|
43
39
|
color: var(--mrd-input-placeholder-color);
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
.mrd-secret-field__input:focus {
|
|
47
42
|
border-color: var(--mrd-border-color-focus);
|
|
48
43
|
box-shadow: var(--mrd-shadow-focus);
|
|
49
44
|
}
|
|
50
|
-
|
|
45
|
+
.mrd-secret-field__input:disabled {
|
|
46
|
+
background-color: var(--mrd-input-bg-disabled);
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
opacity: 0.7;
|
|
49
|
+
}
|
|
51
50
|
.mrd-secret-field__input--error {
|
|
52
51
|
border-color: var(--mrd-border-color-error);
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
.mrd-secret-field__input--error:focus {
|
|
56
54
|
box-shadow: var(--mrd-shadow-focus-error);
|
|
57
55
|
}
|
|
58
|
-
|
|
59
56
|
.mrd-secret-field__error {
|
|
60
57
|
font-family: var(--mrd-font-family);
|
|
61
58
|
font-size: var(--mrd-error-font-size);
|
|
@@ -70,4 +67,4 @@
|
|
|
70
67
|
letter-spacing: 0.15em;
|
|
71
68
|
user-select: none;
|
|
72
69
|
pointer-events: none;
|
|
73
|
-
}
|
|
70
|
+
}
|
package/dist/collection/components/{mrd-secret-field → fields/mrd-secret-field}/mrd-secret-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 MrdSecretField {
|
|
5
4
|
constructor() {
|
|
6
5
|
this.name = '';
|
|
@@ -17,20 +16,14 @@ export class MrdSecretField {
|
|
|
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: 'c850ec5bc5967ca0aefca7d7cb65ecae121a9dc1' }, h("div", { key: '3249ffbc441422af054a20806dd8dfce954a8ffc', class: "mrd-secret-field" }, this.label && (h("label", { key: '0b4a86da9cafad32f153af1bc5487a4e9b941e2f', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
|
|
24
|
+
return (h(Host, { key: 'acb865b235652feba713aedda7a7fccbdc01ad20' }, h("div", { key: 'e7471ade9c683cac9469ec89778c967badb046f9', class: "mrd-secret-field" }, h(FieldLabel, { key: '2f9b864779ead352fda53af8597ddcd31377249d', base: "mrd-secret-field", label: this.label, required: this.required }), this.disabled
|
|
32
25
|
? (h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
|
|
33
|
-
: (h("input", { class:
|
|
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: '438418e2cf0f53a6c247d5f332aae8e8978b94ea', base: "mrd-secret-field", error: this.error }))));
|
|
34
27
|
}
|
|
35
28
|
static get is() { return "mrd-secret-field"; }
|
|
36
29
|
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-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
|
+
}
|