@mmlogic/components 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_19.cjs.entry.js → mrd-boolean-field_20.cjs.entry.js} +313 -55
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/mrd-field/mrd-field.js +14 -2
- package/dist/collection/components/mrd-form/mrd-form.js +79 -0
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +79 -18
- package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +22 -0
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +15 -12
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +9 -0
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +2 -2
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +42 -13
- 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/collection/components/mrd-table/mrd-table.js +82 -11
- package/dist/collection/components/mrd-table/mrd-table.scss +106 -3
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +56 -0
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/dev/api.js +10 -1
- package/dist/collection/dev/app.js +56 -34
- package/dist/collection/dev/example-data.js +12 -2
- package/dist/collection/types/client-layout.js +1 -0
- package/dist/collection/utils/cell-renderer.js +2 -0
- package/dist/collection/utils/i18n.js +8 -0
- package/dist/collection/utils/validation.js +6 -2
- package/dist/components/client-layout.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/mrd-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-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-field.d.ts +11 -0
- package/dist/components/mrd-secret-field.js +1 -0
- package/dist/components/mrd-secret-field2.js +1 -0
- 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/validation.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_19.entry.js → mrd-boolean-field_20.entry.js} +313 -56
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-e477187c.entry.js +1 -0
- package/dist/types/components/mrd-form/mrd-form.d.ts +13 -1
- package/dist/types/components/mrd-hyperlink-field/mrd-hyperlink-field.d.ts +12 -4
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +1 -0
- package/dist/types/components/mrd-relation-field/mrd-relation-field.d.ts +3 -0
- package/dist/types/components/mrd-secret-field/mrd-secret-field.d.ts +22 -0
- package/dist/types/components/mrd-table/mrd-table.d.ts +10 -0
- package/dist/types/components.d.ts +126 -20
- package/dist/types/types/client-layout.d.ts +12 -1
- package/dist/types/utils/cell-renderer.d.ts +1 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-74d100dd.entry.js +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { t } from "../../utils/i18n";
|
|
3
|
+
import { validateRequired } from "../../utils/validation";
|
|
4
|
+
export class MrdSecretField {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = '';
|
|
7
|
+
this.label = '';
|
|
8
|
+
this.value = '';
|
|
9
|
+
this.placeholder = '';
|
|
10
|
+
this.required = false;
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.locale = navigator.language;
|
|
13
|
+
this.error = '';
|
|
14
|
+
this.handleInput = (e) => {
|
|
15
|
+
const val = e.target.value;
|
|
16
|
+
this.mrdChange.emit({ name: this.name, value: val });
|
|
17
|
+
};
|
|
18
|
+
this.handleBlur = (e) => {
|
|
19
|
+
const val = e.target.value;
|
|
20
|
+
if (this.required && !validateRequired(val)) {
|
|
21
|
+
this.error = t('required', this.locale);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.error = '';
|
|
25
|
+
}
|
|
26
|
+
this.mrdBlur.emit({ name: this.name, value: val });
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
const hasError = !!this.error;
|
|
31
|
+
return (h(Host, { key: '08f1aa9d8ab9f4e41abb6d3286e5e383427a5409' }, h("div", { key: 'fabe38aa130e211cea81f2c2f227bc15ad3ebf7d', class: "mrd-secret-field" }, this.label && (h("label", { key: '69af8844eff8ce84daa622635c79130fb491eb0b', class: `mrd-secret-field__label${this.required ? ' mrd-secret-field__label--required' : ''}` }, this.label)), this.disabled
|
|
32
|
+
? (h("span", { class: "mrd-secret-field__masked", "aria-label": this.label }, this.value ? '••••••••' : ''))
|
|
33
|
+
: (h("input", { class: `mrd-secret-field__input${hasError ? ' mrd-secret-field__input--error' : ''}`, type: "password", name: this.name, value: this.value, placeholder: this.placeholder, required: this.required, autocomplete: "new-password", onInput: this.handleInput, onBlur: this.handleBlur })), hasError && h("span", { key: 'e602004f0bb10916d1015e3c2b003523a292997c', class: "mrd-secret-field__error" }, this.error))));
|
|
34
|
+
}
|
|
35
|
+
static get is() { return "mrd-secret-field"; }
|
|
36
|
+
static get encapsulation() { return "scoped"; }
|
|
37
|
+
static get originalStyleUrls() {
|
|
38
|
+
return {
|
|
39
|
+
"$": ["mrd-secret-field.scss"]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
static get styleUrls() {
|
|
43
|
+
return {
|
|
44
|
+
"$": ["mrd-secret-field.css"]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static get properties() {
|
|
48
|
+
return {
|
|
49
|
+
"name": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"mutable": false,
|
|
52
|
+
"complexType": {
|
|
53
|
+
"original": "string",
|
|
54
|
+
"resolved": "string",
|
|
55
|
+
"references": {}
|
|
56
|
+
},
|
|
57
|
+
"required": false,
|
|
58
|
+
"optional": false,
|
|
59
|
+
"docs": {
|
|
60
|
+
"tags": [],
|
|
61
|
+
"text": ""
|
|
62
|
+
},
|
|
63
|
+
"getter": false,
|
|
64
|
+
"setter": false,
|
|
65
|
+
"reflect": false,
|
|
66
|
+
"attribute": "name",
|
|
67
|
+
"defaultValue": "''"
|
|
68
|
+
},
|
|
69
|
+
"label": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"mutable": false,
|
|
72
|
+
"complexType": {
|
|
73
|
+
"original": "string",
|
|
74
|
+
"resolved": "string",
|
|
75
|
+
"references": {}
|
|
76
|
+
},
|
|
77
|
+
"required": false,
|
|
78
|
+
"optional": false,
|
|
79
|
+
"docs": {
|
|
80
|
+
"tags": [],
|
|
81
|
+
"text": ""
|
|
82
|
+
},
|
|
83
|
+
"getter": false,
|
|
84
|
+
"setter": false,
|
|
85
|
+
"reflect": false,
|
|
86
|
+
"attribute": "label",
|
|
87
|
+
"defaultValue": "''"
|
|
88
|
+
},
|
|
89
|
+
"value": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "string",
|
|
94
|
+
"resolved": "string",
|
|
95
|
+
"references": {}
|
|
96
|
+
},
|
|
97
|
+
"required": false,
|
|
98
|
+
"optional": false,
|
|
99
|
+
"docs": {
|
|
100
|
+
"tags": [],
|
|
101
|
+
"text": ""
|
|
102
|
+
},
|
|
103
|
+
"getter": false,
|
|
104
|
+
"setter": false,
|
|
105
|
+
"reflect": false,
|
|
106
|
+
"attribute": "value",
|
|
107
|
+
"defaultValue": "''"
|
|
108
|
+
},
|
|
109
|
+
"placeholder": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": ""
|
|
122
|
+
},
|
|
123
|
+
"getter": false,
|
|
124
|
+
"setter": false,
|
|
125
|
+
"reflect": false,
|
|
126
|
+
"attribute": "placeholder",
|
|
127
|
+
"defaultValue": "''"
|
|
128
|
+
},
|
|
129
|
+
"required": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"mutable": false,
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
},
|
|
137
|
+
"required": false,
|
|
138
|
+
"optional": false,
|
|
139
|
+
"docs": {
|
|
140
|
+
"tags": [],
|
|
141
|
+
"text": ""
|
|
142
|
+
},
|
|
143
|
+
"getter": false,
|
|
144
|
+
"setter": false,
|
|
145
|
+
"reflect": false,
|
|
146
|
+
"attribute": "required",
|
|
147
|
+
"defaultValue": "false"
|
|
148
|
+
},
|
|
149
|
+
"disabled": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"mutable": false,
|
|
152
|
+
"complexType": {
|
|
153
|
+
"original": "boolean",
|
|
154
|
+
"resolved": "boolean",
|
|
155
|
+
"references": {}
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"optional": false,
|
|
159
|
+
"docs": {
|
|
160
|
+
"tags": [],
|
|
161
|
+
"text": ""
|
|
162
|
+
},
|
|
163
|
+
"getter": false,
|
|
164
|
+
"setter": false,
|
|
165
|
+
"reflect": false,
|
|
166
|
+
"attribute": "disabled",
|
|
167
|
+
"defaultValue": "false"
|
|
168
|
+
},
|
|
169
|
+
"locale": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "string",
|
|
174
|
+
"resolved": "string",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": ""
|
|
182
|
+
},
|
|
183
|
+
"getter": false,
|
|
184
|
+
"setter": false,
|
|
185
|
+
"reflect": false,
|
|
186
|
+
"attribute": "locale",
|
|
187
|
+
"defaultValue": "navigator.language"
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
static get states() {
|
|
192
|
+
return {
|
|
193
|
+
"error": {}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static get events() {
|
|
197
|
+
return [{
|
|
198
|
+
"method": "mrdChange",
|
|
199
|
+
"name": "mrdChange",
|
|
200
|
+
"bubbles": true,
|
|
201
|
+
"cancelable": true,
|
|
202
|
+
"composed": true,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": ""
|
|
206
|
+
},
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "{ name: string; value: string }",
|
|
209
|
+
"resolved": "{ name: string; value: string; }",
|
|
210
|
+
"references": {}
|
|
211
|
+
}
|
|
212
|
+
}, {
|
|
213
|
+
"method": "mrdBlur",
|
|
214
|
+
"name": "mrdBlur",
|
|
215
|
+
"bubbles": true,
|
|
216
|
+
"cancelable": true,
|
|
217
|
+
"composed": true,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": ""
|
|
221
|
+
},
|
|
222
|
+
"complexType": {
|
|
223
|
+
"original": "{ name: string; value: string }",
|
|
224
|
+
"resolved": "{ name: string; value: string; }",
|
|
225
|
+
"references": {}
|
|
226
|
+
}
|
|
227
|
+
}];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.mrd-secret-field {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: var(--mrd-space-1);
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mrd-secret-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-secret-field__label--required::after {
|
|
21
|
+
content: ' *';
|
|
22
|
+
color: var(--mrd-color-danger);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.mrd-secret-field__input {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: var(--mrd-input-height);
|
|
29
|
+
padding: var(--mrd-input-padding-y) var(--mrd-input-padding-x);
|
|
30
|
+
font-family: var(--mrd-font-family);
|
|
31
|
+
font-size: var(--mrd-font-size-base);
|
|
32
|
+
color: var(--mrd-input-color);
|
|
33
|
+
background-color: var(--mrd-input-bg);
|
|
34
|
+
border: var(--mrd-border-width) solid var(--mrd-border-color);
|
|
35
|
+
border-radius: var(--mrd-border-radius);
|
|
36
|
+
transition: border-color var(--mrd-transition), box-shadow var(--mrd-transition);
|
|
37
|
+
outline: none;
|
|
38
|
+
appearance: none;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.mrd-secret-field__input::placeholder {
|
|
43
|
+
color: var(--mrd-input-placeholder-color);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.mrd-secret-field__input:focus {
|
|
47
|
+
border-color: var(--mrd-border-color-focus);
|
|
48
|
+
box-shadow: var(--mrd-shadow-focus);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.mrd-secret-field__input--error {
|
|
52
|
+
border-color: var(--mrd-border-color-error);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.mrd-secret-field__input--error:focus {
|
|
56
|
+
box-shadow: var(--mrd-shadow-focus-error);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.mrd-secret-field__error {
|
|
60
|
+
font-family: var(--mrd-font-family);
|
|
61
|
+
font-size: var(--mrd-error-font-size);
|
|
62
|
+
color: var(--mrd-error-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.mrd-secret-field__masked {
|
|
66
|
+
display: block;
|
|
67
|
+
font-family: var(--mrd-font-family);
|
|
68
|
+
font-size: var(--mrd-font-size-base);
|
|
69
|
+
color: var(--mrd-label-color);
|
|
70
|
+
letter-spacing: 0.15em;
|
|
71
|
+
user-select: none;
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
}
|
|
@@ -21,6 +21,8 @@ export class MrdTable {
|
|
|
21
21
|
this.debounceTimer = null;
|
|
22
22
|
this.outsideClickHandler = null;
|
|
23
23
|
this.keydownHandler = null;
|
|
24
|
+
this.createPickerClickHandler = null;
|
|
25
|
+
this.viewPopoverClickHandler = null;
|
|
24
26
|
// ── Props ──────────────────────────────────────────────────────────────────
|
|
25
27
|
/** The VIEW or RELATED_VIEW layout item. Contains view config, dataClass, fromClass, actions etc. */
|
|
26
28
|
this.item = null;
|
|
@@ -57,6 +59,10 @@ export class MrdTable {
|
|
|
57
59
|
this.pendingFilter = null;
|
|
58
60
|
/** Viewport-relative position for the filter popup. */
|
|
59
61
|
this.popupPos = { top: 0, left: 0 };
|
|
62
|
+
/** Whether the create-type picker dropdown is open. */
|
|
63
|
+
this.createPickerOpen = false;
|
|
64
|
+
/** Whether the view-switcher popover (full list) is open. */
|
|
65
|
+
this.viewPopoverOpen = false;
|
|
60
66
|
/** Current scroll offset of the scroll container — drives pagination footer. */
|
|
61
67
|
this.scrollTop = 0;
|
|
62
68
|
/** Full text shown in the TEXTBLOCK expand modal (null = closed). */
|
|
@@ -193,10 +199,18 @@ export class MrdTable {
|
|
|
193
199
|
document.removeEventListener('click', this.outsideClickHandler);
|
|
194
200
|
this.outsideClickHandler = null;
|
|
195
201
|
}
|
|
202
|
+
if (this.createPickerClickHandler) {
|
|
203
|
+
document.removeEventListener('click', this.createPickerClickHandler);
|
|
204
|
+
this.createPickerClickHandler = null;
|
|
205
|
+
}
|
|
196
206
|
if (this.keydownHandler) {
|
|
197
207
|
document.removeEventListener('keydown', this.keydownHandler);
|
|
198
208
|
this.keydownHandler = null;
|
|
199
209
|
}
|
|
210
|
+
if (this.viewPopoverClickHandler) {
|
|
211
|
+
document.removeEventListener('click', this.viewPopoverClickHandler);
|
|
212
|
+
this.viewPopoverClickHandler = null;
|
|
213
|
+
}
|
|
200
214
|
}
|
|
201
215
|
componentDidRender() {
|
|
202
216
|
if (this.colWidths.length === 0 && this.loadedPages.size > 0 && this.totalElements > 0) {
|
|
@@ -248,7 +262,7 @@ export class MrdTable {
|
|
|
248
262
|
}
|
|
249
263
|
return `/excel/${(_d = v.dataClass) !== null && _d !== void 0 ? _d : ''}`;
|
|
250
264
|
}
|
|
251
|
-
buildActionDetail(action) {
|
|
265
|
+
buildActionDetail(action, basicType) {
|
|
252
266
|
var _a, _b, _c;
|
|
253
267
|
if (action === 'export') {
|
|
254
268
|
return { action, path: this.buildExcelPath(), qs: this.buildQueryParams(0) };
|
|
@@ -258,7 +272,7 @@ export class MrdTable {
|
|
|
258
272
|
const parentPath = ((_a = this.item) === null || _a === void 0 ? void 0 : _a.type) === 'RELATED_VIEW'
|
|
259
273
|
? `/${(_b = v === null || v === void 0 ? void 0 : v.fromClass) !== null && _b !== void 0 ? _b : ''}/${this.parentId}`
|
|
260
274
|
: null;
|
|
261
|
-
return { action, dataClass: (_c = v === null || v === void 0 ? void 0 : v.dataClass) !== null && _c !== void 0 ? _c : '', parentPath };
|
|
275
|
+
return Object.assign({ action, dataClass: (_c = v === null || v === void 0 ? void 0 : v.dataClass) !== null && _c !== void 0 ? _c : '', parentPath }, (basicType ? { basicType } : {}));
|
|
262
276
|
}
|
|
263
277
|
return { action };
|
|
264
278
|
}
|
|
@@ -356,6 +370,29 @@ export class MrdTable {
|
|
|
356
370
|
return acc;
|
|
357
371
|
}, []);
|
|
358
372
|
}
|
|
373
|
+
toggleCreatePicker() {
|
|
374
|
+
if (this.createPickerOpen) {
|
|
375
|
+
this.closeCreatePicker();
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
this.createPickerOpen = true;
|
|
379
|
+
if (this.createPickerClickHandler)
|
|
380
|
+
document.removeEventListener('click', this.createPickerClickHandler);
|
|
381
|
+
this.createPickerClickHandler = (ev) => {
|
|
382
|
+
const wrap = this.el.querySelector('.mrd-table__create-picker-wrap');
|
|
383
|
+
if (wrap && !wrap.contains(ev.target))
|
|
384
|
+
this.closeCreatePicker();
|
|
385
|
+
};
|
|
386
|
+
document.addEventListener('click', this.createPickerClickHandler);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
closeCreatePicker() {
|
|
390
|
+
this.createPickerOpen = false;
|
|
391
|
+
if (this.createPickerClickHandler) {
|
|
392
|
+
document.removeEventListener('click', this.createPickerClickHandler);
|
|
393
|
+
this.createPickerClickHandler = null;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
359
396
|
colName(col) {
|
|
360
397
|
var _a;
|
|
361
398
|
return (_a = col.name) !== null && _a !== void 0 ? _a : '';
|
|
@@ -767,20 +804,52 @@ export class MrdTable {
|
|
|
767
804
|
this.activeFilters = new Map();
|
|
768
805
|
this.init();
|
|
769
806
|
}
|
|
807
|
+
toggleViewPopover(e) {
|
|
808
|
+
e.stopPropagation();
|
|
809
|
+
if (this.viewPopoverOpen) {
|
|
810
|
+
this.viewPopoverOpen = false;
|
|
811
|
+
if (this.viewPopoverClickHandler) {
|
|
812
|
+
document.removeEventListener('click', this.viewPopoverClickHandler);
|
|
813
|
+
this.viewPopoverClickHandler = null;
|
|
814
|
+
}
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
this.viewPopoverOpen = true;
|
|
818
|
+
this.viewPopoverClickHandler = () => {
|
|
819
|
+
this.viewPopoverOpen = false;
|
|
820
|
+
document.removeEventListener('click', this.viewPopoverClickHandler);
|
|
821
|
+
this.viewPopoverClickHandler = null;
|
|
822
|
+
};
|
|
823
|
+
document.addEventListener('click', this.viewPopoverClickHandler);
|
|
824
|
+
}
|
|
770
825
|
// ── Render: toolbar ────────────────────────────────────────────────────────
|
|
771
826
|
renderToolbar() {
|
|
827
|
+
var _a;
|
|
772
828
|
const filterCount = this.activeFilters.size;
|
|
773
829
|
const actions = this.tableActions;
|
|
774
830
|
const allViews = this.allViews;
|
|
775
831
|
const hasActions = actions.length > 0;
|
|
776
832
|
const hasViewSwitcher = allViews.length > 1;
|
|
777
|
-
return (h("div", { class: "mrd-table__toolbar" }, h("div", { class: "mrd-table__toolbar-left" }, h("button", { class: `mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle${this.filterMode ? ' mrd-table__filter-toggle--active' : ''}`, onClick: () => this.handleFilterToggle() }, h("svg", { class: "mrd-table__action-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" })), filterCount > 0 && h("span", { class: "mrd-table__filter-badge" }, filterCount), h("span", { class: "mrd-table__action-tooltip" }, this.filterMode ? t('table_filter_hide', this.locale) : t('table_filter', this.locale), filterCount > 0 ? ` (${filterCount} ${t('table_filter_active', this.locale)})` : '')), filterCount > 0 && (h("button", { class: "mrd-table__action mrd-table__action--secondary", onClick: () => this.clearAllFilters() }, h("svg", { class: "mrd-table__action-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })), h("span", { class: "mrd-table__action-tooltip" }, t('table_filter_clear_all', this.locale))))), hasViewSwitcher && (h("div", { class: "mrd-table__toolbar-center" }, h("
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
833
|
+
return (h("div", { class: "mrd-table__toolbar" }, h("div", { class: "mrd-table__toolbar-left" }, h("button", { class: `mrd-table__action mrd-table__action--secondary mrd-table__filter-toggle${this.filterMode ? ' mrd-table__filter-toggle--active' : ''}`, onClick: () => this.handleFilterToggle() }, h("svg", { class: "mrd-table__action-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z" })), filterCount > 0 && h("span", { class: "mrd-table__filter-badge" }, filterCount), h("span", { class: "mrd-table__action-tooltip" }, this.filterMode ? t('table_filter_hide', this.locale) : t('table_filter', this.locale), filterCount > 0 ? ` (${filterCount} ${t('table_filter_active', this.locale)})` : '')), filterCount > 0 && (h("button", { class: "mrd-table__action mrd-table__action--secondary", onClick: () => this.clearAllFilters() }, h("svg", { class: "mrd-table__action-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })), h("span", { class: "mrd-table__action-tooltip" }, t('table_filter_clear_all', this.locale))))), hasViewSwitcher && (h("div", { class: "mrd-table__toolbar-center" }, h("div", { class: "mrd-table__view-switcher" }, h("button", { class: "mrd-table__view-arrow", "aria-label": "Previous view", onClick: () => this.handleViewSwitch((this.activeViewIdx - 1 + allViews.length) % allViews.length) }, "\u25C0"), h("div", { class: "mrd-table__view-title-wrap" }, h("button", { class: "mrd-table__view-title", onClick: (e) => this.toggleViewPopover(e) }, (_a = allViews[this.activeViewIdx]) === null || _a === void 0 ? void 0 : _a.label), this.viewPopoverOpen && (h("div", { class: "mrd-table__view-popover", onClick: (e) => e.stopPropagation() }, allViews.map((v, i) => (h("button", { key: String(i), class: `mrd-table__view-popover-item${i === this.activeViewIdx ? ' mrd-table__view-popover-item--active' : ''}`, onClick: () => {
|
|
834
|
+
if (i !== this.activeViewIdx)
|
|
835
|
+
this.handleViewSwitch(i);
|
|
836
|
+
this.viewPopoverOpen = false;
|
|
837
|
+
if (this.viewPopoverClickHandler) {
|
|
838
|
+
document.removeEventListener('click', this.viewPopoverClickHandler);
|
|
839
|
+
this.viewPopoverClickHandler = null;
|
|
840
|
+
}
|
|
841
|
+
} }, v.label)))))), h("button", { class: "mrd-table__view-arrow", "aria-label": "Next view", onClick: () => this.handleViewSwitch((this.activeViewIdx + 1) % allViews.length) }, "\u25B6")))), hasActions && (h("div", { class: "mrd-table__toolbar-right" }, actions.map(a => {
|
|
842
|
+
var _a, _b, _c;
|
|
843
|
+
const createTypes = a.action === 'create' ? (_a = this.item) === null || _a === void 0 ? void 0 : _a.createTypes : null;
|
|
844
|
+
if (createTypes === null || createTypes === void 0 ? void 0 : createTypes.length) {
|
|
845
|
+
return (h("div", { class: "mrd-table__create-picker-wrap", key: `action-${a.action}` }, h("button", { class: `mrd-table__action mrd-table__action--${(_b = a.variant) !== null && _b !== void 0 ? _b : 'secondary'}`, onClick: () => this.toggleCreatePicker() }, a.icon
|
|
846
|
+
? h("svg", { class: "mrd-table__action-icon", "aria-hidden": "true" }, h("use", { href: a.icon }))
|
|
847
|
+
: a.label, h("span", { class: "mrd-table__action-tooltip" }, a.label)), this.createPickerOpen && (h("div", { class: "mrd-table__create-picker" }, createTypes.map(ct => (h("button", { key: ct.type, class: "mrd-table__create-picker-item", onClick: () => {
|
|
848
|
+
this.mrdAction.emit(this.buildActionDetail('create', ct.type));
|
|
849
|
+
this.closeCreatePicker();
|
|
850
|
+
} }, ct.label)))))));
|
|
851
|
+
}
|
|
852
|
+
return (h("button", { key: `action-${a.action}`, class: `mrd-table__action mrd-table__action--${(_c = a.variant) !== null && _c !== void 0 ? _c : 'secondary'}`, disabled: a.disabled, onClick: () => this.mrdAction.emit(this.buildActionDetail(a.action)) }, a.icon
|
|
784
853
|
? h("svg", { class: "mrd-table__action-icon", "aria-hidden": "true" }, h("use", { href: a.icon }))
|
|
785
854
|
: a.label, h("span", { class: "mrd-table__action-tooltip" }, a.label)));
|
|
786
855
|
})))));
|
|
@@ -1222,6 +1291,8 @@ export class MrdTable {
|
|
|
1222
1291
|
"openFilterCol": {},
|
|
1223
1292
|
"pendingFilter": {},
|
|
1224
1293
|
"popupPos": {},
|
|
1294
|
+
"createPickerOpen": {},
|
|
1295
|
+
"viewPopoverOpen": {},
|
|
1225
1296
|
"scrollTop": {},
|
|
1226
1297
|
"textblockModal": {},
|
|
1227
1298
|
"jsonModal": {},
|
|
@@ -1277,8 +1348,8 @@ export class MrdTable {
|
|
|
1277
1348
|
"text": "Fired when a toolbar action button is clicked.\nFor 'export': includes `path` (relative excel path) and `qs` (current sort+filter params).\nFor 'create': includes `dataClass` (target type) and `parentPath` (e.g. /buyers/123 for RELATED_VIEW)."
|
|
1278
1349
|
},
|
|
1279
1350
|
"complexType": {
|
|
1280
|
-
"original": "{ action: string; path?: string; qs?: string; dataClass?: string; parentPath?: string | null }",
|
|
1281
|
-
"resolved": "{ action: string; path?: string | undefined; qs?: string | undefined; dataClass?: string | undefined; parentPath?: string | null | undefined; }",
|
|
1351
|
+
"original": "{ action: string; path?: string; qs?: string; dataClass?: string; parentPath?: string | null; basicType?: string }",
|
|
1352
|
+
"resolved": "{ action: string; path?: string | undefined; qs?: string | undefined; dataClass?: string | undefined; parentPath?: string | null | undefined; basicType?: string | undefined; }",
|
|
1282
1353
|
"references": {}
|
|
1283
1354
|
}
|
|
1284
1355
|
}, {
|
|
@@ -183,9 +183,32 @@
|
|
|
183
183
|
gap: var(--mrd-space-1);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
/* ── View title ──────────────────────────────────────────────────────────── */
|
|
187
186
|
/* ── View switcher ───────────────────────────────────────────────────────── */
|
|
188
|
-
.mrd-table__view-
|
|
187
|
+
.mrd-table__view-switcher {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: var(--mrd-space-1);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.mrd-table__view-arrow {
|
|
194
|
+
background: none;
|
|
195
|
+
border: none;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
padding: 0 var(--mrd-space-1);
|
|
198
|
+
color: var(--mrd-color-neutral-500);
|
|
199
|
+
font-size: var(--mrd-font-size-xs);
|
|
200
|
+
line-height: 1;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.mrd-table__view-arrow:hover {
|
|
204
|
+
color: var(--mrd-color-neutral-800);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.mrd-table__view-title-wrap {
|
|
208
|
+
position: relative;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.mrd-table__view-title {
|
|
189
212
|
font-size: var(--mrd-font-size-sm);
|
|
190
213
|
font-weight: 600;
|
|
191
214
|
color: var(--mrd-color-neutral-800);
|
|
@@ -194,8 +217,52 @@
|
|
|
194
217
|
border: none;
|
|
195
218
|
outline: none;
|
|
196
219
|
cursor: pointer;
|
|
197
|
-
padding: 0;
|
|
220
|
+
padding: 0 var(--mrd-space-1);
|
|
198
221
|
max-width: 220px;
|
|
222
|
+
white-space: nowrap;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.mrd-table__view-title:hover {
|
|
228
|
+
color: var(--mrd-color-primary);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.mrd-table__view-popover {
|
|
232
|
+
position: absolute;
|
|
233
|
+
top: calc(100% + var(--mrd-space-1));
|
|
234
|
+
left: 50%;
|
|
235
|
+
transform: translateX(-50%);
|
|
236
|
+
background: var(--mrd-color-white);
|
|
237
|
+
border: 1px solid var(--mrd-color-neutral-200);
|
|
238
|
+
border-radius: var(--mrd-radius-md);
|
|
239
|
+
box-shadow: var(--mrd-shadow-md);
|
|
240
|
+
z-index: 100;
|
|
241
|
+
min-width: 160px;
|
|
242
|
+
padding: var(--mrd-space-1) 0;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.mrd-table__view-popover-item {
|
|
246
|
+
display: block;
|
|
247
|
+
width: 100%;
|
|
248
|
+
text-align: left;
|
|
249
|
+
background: none;
|
|
250
|
+
border: none;
|
|
251
|
+
cursor: pointer;
|
|
252
|
+
padding: var(--mrd-space-2) var(--mrd-space-3);
|
|
253
|
+
font-size: var(--mrd-font-size-sm);
|
|
254
|
+
font-family: var(--mrd-font-family);
|
|
255
|
+
color: var(--mrd-color-neutral-700);
|
|
256
|
+
white-space: nowrap;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.mrd-table__view-popover-item:hover {
|
|
260
|
+
background: var(--mrd-color-neutral-50);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.mrd-table__view-popover-item--active {
|
|
264
|
+
font-weight: 600;
|
|
265
|
+
color: var(--mrd-color-primary);
|
|
199
266
|
}
|
|
200
267
|
|
|
201
268
|
.mrd-table__action {
|
|
@@ -273,6 +340,42 @@
|
|
|
273
340
|
display: block;
|
|
274
341
|
}
|
|
275
342
|
|
|
343
|
+
/* ── Create-type picker ──────────────────────────────────────────────────── */
|
|
344
|
+
.mrd-table__create-picker-wrap {
|
|
345
|
+
position: relative;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.mrd-table__create-picker {
|
|
349
|
+
position: absolute;
|
|
350
|
+
right: 0;
|
|
351
|
+
top: calc(100% + 4px);
|
|
352
|
+
background: var(--mrd-color-white, #fff);
|
|
353
|
+
border: 1px solid var(--mrd-border-color);
|
|
354
|
+
border-radius: var(--mrd-border-radius);
|
|
355
|
+
box-shadow: var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));
|
|
356
|
+
z-index: 10;
|
|
357
|
+
min-width: 10rem;
|
|
358
|
+
padding: var(--mrd-space-1) 0;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.mrd-table__create-picker-item {
|
|
362
|
+
display: block;
|
|
363
|
+
width: 100%;
|
|
364
|
+
text-align: left;
|
|
365
|
+
padding: var(--mrd-space-2) var(--mrd-space-3);
|
|
366
|
+
background: none;
|
|
367
|
+
border: none;
|
|
368
|
+
cursor: pointer;
|
|
369
|
+
font-size: var(--mrd-font-size-sm);
|
|
370
|
+
font-family: var(--mrd-font-family);
|
|
371
|
+
color: var(--mrd-color-neutral-800);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.mrd-table__create-picker-item:hover {
|
|
375
|
+
background: var(--mrd-color-neutral-50);
|
|
376
|
+
color: var(--mrd-color-neutral-900);
|
|
377
|
+
}
|
|
378
|
+
|
|
276
379
|
/* ── Filter toggle active state ────────────────────────────────────────── */
|
|
277
380
|
.mrd-table__filter-toggle--active {
|
|
278
381
|
background: var(--mrd-color-primary);
|
|
@@ -28,7 +28,7 @@ export class MrdTextField {
|
|
|
28
28
|
}
|
|
29
29
|
render() {
|
|
30
30
|
const hasError = !!this.error;
|
|
31
|
-
return (h(Host, { key: '
|
|
31
|
+
return (h(Host, { key: 'fd4e1f389cb452ab80a1e1c7295d884ca935999e' }, h("div", { key: '7b7bde7a18fcd9b8d5779daab88ddabb45dd8692', class: "mrd-text-field" }, this.label && (h("label", { key: '8e2ad4053473cfad4eae4c4634b863ac5ef32fea', class: `mrd-text-field__label${this.required ? ' mrd-text-field__label--required' : ''}` }, this.label)), h("input", { key: 'd32712a6dc2aee4691bc4a580d5ca2ad81e0ff9f', 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: '31585dbf82020c81834e1eeada5cd9907a5ead56', class: "mrd-text-field__error" }, this.error))));
|
|
32
32
|
}
|
|
33
33
|
static get is() { return "mrd-text-field"; }
|
|
34
34
|
static get encapsulation() { return "scoped"; }
|
|
@@ -66,7 +66,7 @@ export class MrdTextareaField {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
render() {
|
|
69
|
-
return (h(Host, { key: '
|
|
69
|
+
return (h(Host, { key: 'e1fd819c598f01e3986946357ec18d608f2c7adc' }, h("div", { key: '20c28e54e61429655b2d4f297bd84e183ad7e971', class: "mrd-textarea-field" }, this.label && (h("label", { key: 'fa46a20badc35c931563600f24a32e0a8c8c07ad', class: `mrd-textarea-field__label${this.required ? ' mrd-textarea-field__label--required' : ''}` }, this.label)), h("div", { key: 'ee928eca0a1b85401b346b7fae8adbe9214a7664', class: `mrd-textarea-field__container${this.error ? ' mrd-textarea-field__container--error' : ''}` }, h("div", { key: '89b00f3c526623c47f0aff7ad862f70dfdc2fe15', class: "mrd-textarea-field__editor" })), this.error && h("span", { key: '458cf8fddee36ddbc384ce4d25765e5aacd3c9d5', class: "mrd-textarea-field__error" }, this.error))));
|
|
70
70
|
}
|
|
71
71
|
static get is() { return "mrd-textarea-field"; }
|
|
72
72
|
static get encapsulation() { return "scoped"; }
|