@mmlogic/components 0.1.30 → 0.3.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/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_19.cjs.entry.js +349 -297
- package/dist/collection/components/mrd-field/mrd-field.js +18 -20
- package/dist/collection/components/mrd-form/mrd-form.js +38 -46
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +82 -212
- package/dist/collection/components/mrd-table/mrd-table.js +255 -219
- package/dist/collection/dev/api.js +32 -103
- package/dist/collection/dev/app.js +386 -283
- package/dist/collection/dev/example-data.js +111 -299
- package/dist/collection/utils/cell-renderer.js +7 -5
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_19.entry.js +349 -297
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-f6d0f02b.entry.js +1 -0
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +16 -29
- package/dist/types/components/mrd-table/mrd-table.d.ts +36 -24
- package/dist/types/components.d.ts +39 -85
- package/dist/types/types/client-layout.d.ts +39 -15
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-9ecefa81.entry.js +0 -1
|
@@ -8,24 +8,19 @@ export class MrdLayoutSection {
|
|
|
8
8
|
this.items = [];
|
|
9
9
|
/** Record data object; keys are field names, _links holds relation and related-view links. */
|
|
10
10
|
this.data = {};
|
|
11
|
-
/**
|
|
11
|
+
/** Legacy: view metadata map (ClientDashboardMetadata.views). Not needed in new flat format. */
|
|
12
12
|
this.views = {};
|
|
13
|
-
/**
|
|
13
|
+
/** Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format. */
|
|
14
14
|
this.links = {};
|
|
15
15
|
this.locale = navigator.language;
|
|
16
16
|
this.searchQueryMap = {};
|
|
17
17
|
this.searchResultsMap = {};
|
|
18
18
|
this.imagePreviewUrl = null;
|
|
19
19
|
this.imagePreviews = {};
|
|
20
|
-
this.activeViewMap = {};
|
|
21
|
-
this.viewLinksMap = {};
|
|
22
|
-
this.activeFiltersMap = {};
|
|
23
20
|
this.searchTimers = {};
|
|
24
21
|
this.handleViewLoadPage = (e, name) => {
|
|
25
|
-
var _a;
|
|
26
22
|
e.stopPropagation();
|
|
27
|
-
|
|
28
|
-
this.mrdLoadViewPage.emit({ name, page: e.detail.page, sort: e.detail.sort, filters });
|
|
23
|
+
this.mrdLoadViewPage.emit({ name, page: e.detail.page, sort: e.detail.sort, path: e.detail.path, qs: e.detail.qs });
|
|
29
24
|
};
|
|
30
25
|
this.handleSearchInput = (dataClass, query) => {
|
|
31
26
|
this.searchQueryMap = Object.assign(Object.assign({}, this.searchQueryMap), { [dataClass]: query });
|
|
@@ -42,65 +37,33 @@ export class MrdLayoutSection {
|
|
|
42
37
|
}
|
|
43
38
|
componentDidLoad() {
|
|
44
39
|
setTimeout(() => {
|
|
45
|
-
this.
|
|
40
|
+
this.initEmbeddedTables();
|
|
46
41
|
this.emitLoadImages();
|
|
47
42
|
}, 0);
|
|
48
43
|
}
|
|
49
|
-
linksChanged(newVal) {
|
|
50
|
-
if (Object.keys(newVal !== null && newVal !== void 0 ? newVal : {}).length > 0) {
|
|
51
|
-
this.emitLoadViews();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
44
|
dataChanged(newVal) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.emitLoadViews();
|
|
45
|
+
if (newVal && Object.keys(newVal).length > 0) {
|
|
46
|
+
setTimeout(() => this.initEmbeddedTables(), 0);
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
switch (f.operator) {
|
|
66
|
-
case 'FROM': return Object.assign(Object.assign({}, base), { from: (_a = f.value) !== null && _a !== void 0 ? _a : null });
|
|
67
|
-
case 'TO': return Object.assign(Object.assign({}, base), { to: (_b = f.value) !== null && _b !== void 0 ? _b : null });
|
|
68
|
-
case 'STARTS_WITH': return Object.assign(Object.assign({}, base), { operator: 'startsWith', value: (_c = f.value) !== null && _c !== void 0 ? _c : null });
|
|
69
|
-
case 'NOT_EMPTY': return Object.assign(Object.assign({}, base), { operator: 'isNotEmpty' });
|
|
70
|
-
case 'EMPTY': return Object.assign(Object.assign({}, base), { operator: 'isEmpty' });
|
|
71
|
-
default: return Object.assign(Object.assign({}, base), { operator: 'equals', value: (_d = f.value) !== null && _d !== void 0 ? _d : null });
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
emitLoadViews() {
|
|
76
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
77
|
-
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
78
|
-
for (const item of this.flattenItems(this.items)) {
|
|
79
|
-
if (item.type === ClientLayoutItemType.RELATED_VIEW && item.relatedView) {
|
|
80
|
-
const rv = item.relatedView;
|
|
81
|
-
const viewConfig = this.views[rv.name];
|
|
82
|
-
if (!viewConfig)
|
|
83
|
-
continue;
|
|
84
|
-
const href = (_c = dataLinks[rv.relatedClass]) === null || _c === void 0 ? void 0 : _c.href;
|
|
85
|
-
this.mrdLoadView.emit({ name: rv.name, href, viewConfig, sort: (_d = viewConfig.defaultSort) !== null && _d !== void 0 ? _d : '', filters: this.resolveViewFilters(viewConfig) });
|
|
86
|
-
}
|
|
87
|
-
else if (item.type === ClientLayoutItemType.VIEW) {
|
|
88
|
-
const viewName = (_f = (_e = item.view) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : item.name;
|
|
89
|
-
if (!viewName)
|
|
90
|
-
continue;
|
|
91
|
-
const viewConfig = this.views[viewName];
|
|
92
|
-
if (!viewConfig)
|
|
93
|
-
continue;
|
|
94
|
-
const href = (_g = this.links[viewName]) === null || _g === void 0 ? void 0 : _g.href;
|
|
95
|
-
this.mrdLoadView.emit({ name: viewName, href, viewConfig, sort: (_h = viewConfig.defaultSort) !== null && _h !== void 0 ? _h : '', filters: this.resolveViewFilters(viewConfig) });
|
|
49
|
+
async initEmbeddedTables() {
|
|
50
|
+
const tables = this.el.querySelectorAll('mrd-table[data-view]');
|
|
51
|
+
for (const table of Array.from(tables)) {
|
|
52
|
+
if (typeof table.init === 'function') {
|
|
53
|
+
await table.init();
|
|
96
54
|
}
|
|
97
55
|
}
|
|
98
56
|
}
|
|
57
|
+
viewKeyFor(item) {
|
|
58
|
+
var _a, _b, _c, _d;
|
|
59
|
+
if (item.type === ClientLayoutItemType.RELATED_VIEW)
|
|
60
|
+
return (_b = (_a = item.relatedClass) !== null && _a !== void 0 ? _a : item.name) !== null && _b !== void 0 ? _b : '';
|
|
61
|
+
return (_d = (_c = item.dataClass) !== null && _c !== void 0 ? _c : item.name) !== null && _d !== void 0 ? _d : '';
|
|
62
|
+
}
|
|
99
63
|
emitLoadImages() {
|
|
100
|
-
var _a;
|
|
101
64
|
for (const item of this.flattenItems(this.items)) {
|
|
102
|
-
if (item.type === ClientLayoutItemType.FIELD &&
|
|
103
|
-
const fieldName = item.
|
|
65
|
+
if (item.type === ClientLayoutItemType.FIELD && item.dataType === ClientLayoutItemFieldDataType.IMAGE) {
|
|
66
|
+
const fieldName = item.name;
|
|
104
67
|
const raw = this.data[fieldName];
|
|
105
68
|
const href = raw === null || raw === void 0 ? void 0 : raw.href;
|
|
106
69
|
if (href)
|
|
@@ -126,19 +89,14 @@ export class MrdLayoutSection {
|
|
|
126
89
|
}
|
|
127
90
|
/**
|
|
128
91
|
* Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.
|
|
129
|
-
* Pass totalElements
|
|
130
|
-
* Pass pageLinks (_links from the page response) on page 0 to enable action hrefs in mrdViewAction.
|
|
92
|
+
* Pass totalElements to update the pagination total (safe to pass on every page).
|
|
131
93
|
*/
|
|
132
|
-
async setViewPage(name, page, rows, totalElements
|
|
133
|
-
if (pageLinks) {
|
|
134
|
-
this.viewLinksMap = Object.assign(Object.assign({}, this.viewLinksMap), { [name]: pageLinks });
|
|
135
|
-
}
|
|
94
|
+
async setViewPage(name, page, rows, totalElements) {
|
|
136
95
|
const table = this.el.querySelector(`mrd-table[data-view="${name}"]`);
|
|
137
96
|
if (!table)
|
|
138
97
|
return;
|
|
139
98
|
if (totalElements !== undefined) {
|
|
140
99
|
table.totalElements = totalElements;
|
|
141
|
-
await table.init();
|
|
142
100
|
}
|
|
143
101
|
await table.setPage(page, rows);
|
|
144
102
|
}
|
|
@@ -158,15 +116,15 @@ export class MrdLayoutSection {
|
|
|
158
116
|
this.imagePreviewUrl = url;
|
|
159
117
|
}
|
|
160
118
|
resolveSearchKey() {
|
|
119
|
+
var _a;
|
|
161
120
|
const items = this.flattenItems(this.items).filter(i => i.type === ClientLayoutItemType.SEARCH);
|
|
162
|
-
if (items.length === 1
|
|
163
|
-
return items[0].
|
|
121
|
+
if (items.length === 1)
|
|
122
|
+
return (_a = items[0].dataClass) !== null && _a !== void 0 ? _a : null;
|
|
164
123
|
return null;
|
|
165
124
|
}
|
|
166
125
|
renderSingleFieldValue(item, value) {
|
|
167
126
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
168
|
-
const
|
|
169
|
-
const dt = field.dataType;
|
|
127
|
+
const dt = item.dataType;
|
|
170
128
|
switch (dt) {
|
|
171
129
|
case ClientLayoutItemFieldDataType.HYPERLINK: {
|
|
172
130
|
const v = value;
|
|
@@ -190,7 +148,7 @@ export class MrdLayoutSection {
|
|
|
190
148
|
const v = value;
|
|
191
149
|
const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
|
|
192
150
|
const fileName = (_g = v === null || v === void 0 ? void 0 : v.fileName) !== null && _g !== void 0 ? _g : '';
|
|
193
|
-
const previewUrl = this.imagePreviews[
|
|
151
|
+
const previewUrl = this.imagePreviews[item.name];
|
|
194
152
|
if (previewUrl) {
|
|
195
153
|
return (h("button", { class: "mrd-layout-section__image-thumb-btn", onClick: () => { this.imagePreviewUrl = previewUrl; }, title: fileName || undefined }, h("img", { class: "mrd-layout-section__image-thumb", src: previewUrl, alt: fileName })));
|
|
196
154
|
}
|
|
@@ -199,7 +157,7 @@ export class MrdLayoutSection {
|
|
|
199
157
|
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
200
158
|
return (h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', this.locale) : t('no', this.locale)));
|
|
201
159
|
case ClientLayoutItemFieldDataType.LIST: {
|
|
202
|
-
const listItem = ((_h =
|
|
160
|
+
const listItem = ((_h = item.listItems) !== null && _h !== void 0 ? _h : []).find(li => li.key === String(value));
|
|
203
161
|
const label = (_j = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _j !== void 0 ? _j : String(value);
|
|
204
162
|
const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
|
|
205
163
|
const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
|
|
@@ -212,7 +170,7 @@ export class MrdLayoutSection {
|
|
|
212
170
|
return label;
|
|
213
171
|
}
|
|
214
172
|
default: {
|
|
215
|
-
const text = CellRenderer.renderValue(dt, value, (_k =
|
|
173
|
+
const text = CellRenderer.renderValue(dt, value, (_k = item.listItems) !== null && _k !== void 0 ? _k : [], this.locale);
|
|
216
174
|
return text || null;
|
|
217
175
|
}
|
|
218
176
|
}
|
|
@@ -220,8 +178,7 @@ export class MrdLayoutSection {
|
|
|
220
178
|
renderFieldValue(item, rawValue) {
|
|
221
179
|
if (rawValue == null || rawValue === '')
|
|
222
180
|
return null;
|
|
223
|
-
|
|
224
|
-
if (field.multiple && Array.isArray(rawValue)) {
|
|
181
|
+
if (item.multiple && Array.isArray(rawValue)) {
|
|
225
182
|
const rendered = rawValue.map(v => this.renderSingleFieldValue(item, v));
|
|
226
183
|
if (rendered.every(r => typeof r === 'string' || r == null)) {
|
|
227
184
|
return rendered.filter(Boolean).join(', ') || null;
|
|
@@ -231,27 +188,26 @@ export class MrdLayoutSection {
|
|
|
231
188
|
return this.renderSingleFieldValue(item, rawValue);
|
|
232
189
|
}
|
|
233
190
|
renderField(item) {
|
|
234
|
-
if (!item.
|
|
191
|
+
if (!item.name)
|
|
235
192
|
return null;
|
|
236
|
-
const
|
|
237
|
-
const rawValue = this.data[field.name];
|
|
193
|
+
const rawValue = this.data[item.name];
|
|
238
194
|
const renderedValue = this.renderFieldValue(item, rawValue);
|
|
239
|
-
if (
|
|
240
|
-
return (h("h1", { class: "mrd-layout-section__field-header", key:
|
|
195
|
+
if (item.header) {
|
|
196
|
+
return (h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
241
197
|
}
|
|
242
198
|
if (renderedValue == null)
|
|
243
199
|
return null;
|
|
244
|
-
const isBlock =
|
|
245
|
-
||
|
|
246
|
-
||
|
|
247
|
-
return (h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key:
|
|
200
|
+
const isBlock = item.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
201
|
+
|| item.dataType === ClientLayoutItemFieldDataType.LONGTEXT
|
|
202
|
+
|| item.dataType === ClientLayoutItemFieldDataType.JSON;
|
|
203
|
+
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)));
|
|
248
204
|
}
|
|
249
205
|
renderRelation(item) {
|
|
250
206
|
var _a, _b, _c;
|
|
251
|
-
if (!item.
|
|
207
|
+
if (!item.name)
|
|
252
208
|
return null;
|
|
253
209
|
const links = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
254
|
-
const link = links[item.
|
|
210
|
+
const link = links[item.name];
|
|
255
211
|
if (!link)
|
|
256
212
|
return null;
|
|
257
213
|
const makeBtn = (href, name) => (h("button", { key: href, class: "mrd-layout-section__relation-link", onClick: () => this.mrdNavigate.emit({ href, label: name }) }, name));
|
|
@@ -264,80 +220,48 @@ export class MrdLayoutSection {
|
|
|
264
220
|
}
|
|
265
221
|
if (!valueContent)
|
|
266
222
|
return null;
|
|
267
|
-
return (h("div", { class: "mrd-layout-section__field", key: item.
|
|
223
|
+
return (h("div", { class: "mrd-layout-section__field", key: item.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, valueContent)));
|
|
268
224
|
}
|
|
269
225
|
renderSearch(item) {
|
|
270
226
|
var _a, _b, _c;
|
|
271
|
-
if (!item.
|
|
227
|
+
if (!item.dataClass)
|
|
272
228
|
return null;
|
|
273
|
-
const dataClass = item.
|
|
229
|
+
const dataClass = item.dataClass;
|
|
274
230
|
const query = (_a = this.searchQueryMap[dataClass]) !== null && _a !== void 0 ? _a : '';
|
|
275
231
|
const results = (_b = this.searchResultsMap[dataClass]) !== null && _b !== void 0 ? _b : [];
|
|
276
232
|
return (h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, h("div", { class: "mrd-layout-section__search-wrap" }, h("svg", { class: "mrd-layout-section__search-icon", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z", "clip-rule": "evenodd" })), h("input", { class: "mrd-layout-section__search-input", type: "text", value: query, placeholder: (_c = item.label) !== null && _c !== void 0 ? _c : '', onInput: e => this.handleSearchInput(dataClass, e.target.value) })), results.length > 0 && (h("ul", { class: "mrd-layout-section__search-results" }, results.map(r => (h("li", { key: r.id, class: "mrd-layout-section__search-result" }, h("button", { class: "mrd-layout-section__search-result-btn", onClick: () => this.mrdNavigate.emit({ href: r.id, label: r.label }) }, h("span", { class: "mrd-layout-section__search-result-label" }, r.label), r.description && h("span", { class: "mrd-layout-section__search-result-desc" }, r.description)))))))));
|
|
277
233
|
}
|
|
278
234
|
renderRelatedView(item) {
|
|
279
|
-
var _a, _b, _c, _d, _e, _f
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const name = isRelated
|
|
283
|
-
? (_a = item.relatedView) === null || _a === void 0 ? void 0 : _a.name
|
|
284
|
-
: ((_c = (_b = item.view) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : item.name);
|
|
285
|
-
if (!name)
|
|
235
|
+
var _a, _b, _c, _d, _e, _f;
|
|
236
|
+
const key = this.viewKeyFor(item);
|
|
237
|
+
if (!key)
|
|
286
238
|
return null;
|
|
287
|
-
|
|
288
|
-
if (!viewConfig)
|
|
239
|
+
if (!item.view)
|
|
289
240
|
return null;
|
|
290
|
-
const showTitle =
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
const originalLabel = (_m = (_l = (_k = viewConfig.pluralLabel) !== null && _k !== void 0 ? _k : viewConfig.singularLabel) !== null && _l !== void 0 ? _l : item.label) !== null && _m !== void 0 ? _m : name;
|
|
297
|
-
const allViews = [{ name, label: originalLabel }, ...((_o = item.alternativeViews) !== null && _o !== void 0 ? _o : [])];
|
|
298
|
-
const activeEntry = allViews.find(v => v.name === activeName);
|
|
299
|
-
const viewLabel = (_r = (_q = (_p = activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.label) !== null && _p !== void 0 ? _p : activeViewConfig.pluralLabel) !== null && _q !== void 0 ? _q : activeViewConfig.singularLabel) !== null && _r !== void 0 ? _r : '';
|
|
300
|
-
const altViews = allViews.filter(v => v.name !== activeName);
|
|
301
|
-
const rawActions = (_s = item.actions) !== null && _s !== void 0 ? _s : ['NEW', 'EXPORT'];
|
|
302
|
-
const tableActions = rawActions.reduce((acc, a) => {
|
|
303
|
-
if (a === 'NEW')
|
|
304
|
-
acc.push({ action: 'create', label: t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary' });
|
|
305
|
-
if (a === 'EXPORT')
|
|
306
|
-
acc.push({ action: 'export', label: t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
|
|
307
|
-
return acc;
|
|
308
|
-
}, []);
|
|
309
|
-
return (h("div", { class: "mrd-layout-section__related-view", key: `view-${name}` }, showTitle && item.label && h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), h("mrd-table", { "data-view": name, columns: activeViewConfig.values, locale: this.locale, defaultSort: (_t = activeViewConfig.defaultSort) !== null && _t !== void 0 ? _t : '', viewLabel: viewLabel, alternativeViews: altViews, actions: tableActions, onMrdLoadPage: (e) => this.handleViewLoadPage(e, name), onMrdSwitchView: (e) => {
|
|
310
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
311
|
-
e.stopPropagation();
|
|
312
|
-
const newViewName = e.detail.name;
|
|
313
|
-
const newViewConfig = this.views[newViewName];
|
|
314
|
-
if (!newViewConfig)
|
|
315
|
-
return;
|
|
316
|
-
this.activeViewMap = Object.assign(Object.assign({}, this.activeViewMap), { [name]: newViewName });
|
|
317
|
-
this.activeFiltersMap = Object.assign(Object.assign({}, this.activeFiltersMap), { [name]: [] });
|
|
318
|
-
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
319
|
-
const href = isRelated
|
|
320
|
-
? (_c = dataLinks[item.relatedView.relatedClass]) === null || _c === void 0 ? void 0 : _c.href
|
|
321
|
-
: ((_e = (_d = this.links[newViewName]) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : (_f = this.links[name]) === null || _f === void 0 ? void 0 : _f.href);
|
|
322
|
-
this.mrdLoadView.emit({ name, href, viewConfig: newViewConfig, sort: (_g = newViewConfig.defaultSort) !== null && _g !== void 0 ? _g : '', filters: this.resolveViewFilters(newViewConfig) });
|
|
323
|
-
}, onMrdFilter: (e) => {
|
|
241
|
+
const showTitle = (_a = item.showTitle) !== null && _a !== void 0 ? _a : false;
|
|
242
|
+
// Extract parentId from data._links.self.href for RELATED_VIEW path construction
|
|
243
|
+
const selfHref = (_e = (_d = (_c = (_b = this.data) === null || _b === void 0 ? void 0 : _b._links) === null || _c === void 0 ? void 0 : _c.self) === null || _d === void 0 ? void 0 : _d.href) !== null && _e !== void 0 ? _e : '';
|
|
244
|
+
const parentId = (_f = selfHref.split('/').filter(Boolean).pop()) !== null && _f !== void 0 ? _f : '';
|
|
245
|
+
return (h("div", { class: "mrd-layout-section__related-view", key: `view-${key}` }, showTitle && item.label && h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), h("mrd-table", { "data-view": key, item: item, parentId: parentId, locale: this.locale, onMrdLoadPage: (e) => this.handleViewLoadPage(e, key), onMrdLoadAggregations: (e) => {
|
|
246
|
+
var _a;
|
|
324
247
|
e.stopPropagation();
|
|
325
|
-
this.
|
|
326
|
-
},
|
|
327
|
-
var _a, _b, _c
|
|
248
|
+
this.mrdLoadViewAggregations.emit(Object.assign({ name: key, dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key }, e.detail));
|
|
249
|
+
}, onMrdRowClick: (e) => {
|
|
250
|
+
var _a, _b, _c;
|
|
328
251
|
e.stopPropagation();
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
? (_c = dataLinks[item.relatedView.relatedClass]) === null || _c === void 0 ? void 0 : _c.href
|
|
332
|
-
: ((_f = (_e = this.links[(_d = this.activeViewMap[name]) !== null && _d !== void 0 ? _d : name]) === null || _e === void 0 ? void 0 : _e.href) !== null && _f !== void 0 ? _f : (_g = this.links[name]) === null || _g === void 0 ? void 0 : _g.href);
|
|
333
|
-
const filters = (_h = this.activeFiltersMap[name]) !== null && _h !== void 0 ? _h : [];
|
|
334
|
-
this.mrdLoadViewAggregations.emit(Object.assign({ name, href, filters }, e.detail));
|
|
252
|
+
const row = e.detail;
|
|
253
|
+
this.mrdNavigate.emit({ href: (_b = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a.self) === null || _b === void 0 ? void 0 : _b.href, label: (_c = row === null || row === void 0 ? void 0 : row.name) !== null && _c !== void 0 ? _c : '' });
|
|
335
254
|
}, onMrdAction: (e) => {
|
|
336
|
-
var _a
|
|
255
|
+
var _a;
|
|
337
256
|
e.stopPropagation();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
257
|
+
this.mrdViewAction.emit({
|
|
258
|
+
name: key,
|
|
259
|
+
action: e.detail.action,
|
|
260
|
+
dataClass: (_a = item.dataClass) !== null && _a !== void 0 ? _a : key,
|
|
261
|
+
path: e.detail.path,
|
|
262
|
+
qs: e.detail.qs,
|
|
263
|
+
parentPath: e.detail.parentPath,
|
|
264
|
+
});
|
|
341
265
|
} })));
|
|
342
266
|
}
|
|
343
267
|
renderItem(item) {
|
|
@@ -352,7 +276,7 @@ export class MrdLayoutSection {
|
|
|
352
276
|
case ClientLayoutItemType.TEXT:
|
|
353
277
|
return h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
|
|
354
278
|
case ClientLayoutItemType.NAVIGATE:
|
|
355
|
-
return (h("button", { class: "mrd-layout-section__navigate", key: `nav-${item.label}`, onClick: () => { var _a; return this.mrdNavigate.emit({ label: (_a = item.label) !== null && _a !== void 0 ? _a : '', navigate: item.navigate }); } }, item.label));
|
|
279
|
+
return (h("button", { class: "mrd-layout-section__navigate", key: `nav-${item.label}`, onClick: () => { var _a, _b, _c; return this.mrdNavigate.emit({ label: (_a = item.label) !== null && _a !== void 0 ? _a : '', navigate: (_b = item.navigate) !== null && _b !== void 0 ? _b : { dataClass: (_c = item.dataClass) !== null && _c !== void 0 ? _c : '', icon: item.icon, navigationType: item.navigationType } }); } }, item.label));
|
|
356
280
|
case ClientLayoutItemType.SEARCH:
|
|
357
281
|
return this.renderSearch(item);
|
|
358
282
|
case ClientLayoutItemType.SECTION:
|
|
@@ -371,7 +295,7 @@ export class MrdLayoutSection {
|
|
|
371
295
|
return (h("div", { class: "mrd-layout-section__modal-backdrop", onClick: () => { this.imagePreviewUrl = null; } }, h("div", { class: "mrd-layout-section__modal", onClick: (e) => e.stopPropagation() }, h("button", { class: "mrd-layout-section__modal-close", onClick: () => { this.imagePreviewUrl = null; } }, "\u2715"), h("img", { class: "mrd-layout-section__modal-image", src: this.imagePreviewUrl, alt: "" }))));
|
|
372
296
|
}
|
|
373
297
|
render() {
|
|
374
|
-
return (h(Host, { key: '
|
|
298
|
+
return (h(Host, { key: 'a7b6514d19cf79261396d9aaf03f459600037566' }, h("div", { key: '331f0558ef3eddf5a9b4332f7ec45c58b52dd8c3', class: "mrd-layout-section" }, this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
375
299
|
}
|
|
376
300
|
static get is() { return "mrd-layout-section"; }
|
|
377
301
|
static get encapsulation() { return "scoped"; }
|
|
@@ -458,7 +382,7 @@ export class MrdLayoutSection {
|
|
|
458
382
|
"optional": false,
|
|
459
383
|
"docs": {
|
|
460
384
|
"tags": [],
|
|
461
|
-
"text": "
|
|
385
|
+
"text": "Legacy: view metadata map (ClientDashboardMetadata.views). Not needed in new flat format."
|
|
462
386
|
},
|
|
463
387
|
"getter": false,
|
|
464
388
|
"setter": false,
|
|
@@ -481,7 +405,7 @@ export class MrdLayoutSection {
|
|
|
481
405
|
"optional": false,
|
|
482
406
|
"docs": {
|
|
483
407
|
"tags": [],
|
|
484
|
-
"text": "
|
|
408
|
+
"text": "Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format."
|
|
485
409
|
},
|
|
486
410
|
"getter": false,
|
|
487
411
|
"setter": false,
|
|
@@ -514,8 +438,7 @@ export class MrdLayoutSection {
|
|
|
514
438
|
"searchQueryMap": {},
|
|
515
439
|
"searchResultsMap": {},
|
|
516
440
|
"imagePreviewUrl": {},
|
|
517
|
-
"imagePreviews": {}
|
|
518
|
-
"activeViewMap": {}
|
|
441
|
+
"imagePreviews": {}
|
|
519
442
|
};
|
|
520
443
|
}
|
|
521
444
|
static get events() {
|
|
@@ -571,34 +494,6 @@ export class MrdLayoutSection {
|
|
|
571
494
|
"resolved": "{ href: string; fileName: string; }",
|
|
572
495
|
"references": {}
|
|
573
496
|
}
|
|
574
|
-
}, {
|
|
575
|
-
"method": "mrdLoadView",
|
|
576
|
-
"name": "mrdLoadView",
|
|
577
|
-
"bubbles": true,
|
|
578
|
-
"cancelable": true,
|
|
579
|
-
"composed": true,
|
|
580
|
-
"docs": {
|
|
581
|
-
"tags": [],
|
|
582
|
-
"text": "Fired once on load for each RELATED_VIEW and VIEW item; host fetches page 0 and calls setViewPage()."
|
|
583
|
-
},
|
|
584
|
-
"complexType": {
|
|
585
|
-
"original": "{ name: string; href?: string; viewConfig: ClientViewMetadata; sort: string; filters: ColumnFilter[] }",
|
|
586
|
-
"resolved": "{ name: string; href?: string | undefined; viewConfig: ClientViewMetadata; sort: string; filters: ColumnFilter[]; }",
|
|
587
|
-
"references": {
|
|
588
|
-
"ClientViewMetadata": {
|
|
589
|
-
"location": "import",
|
|
590
|
-
"path": "../../types/client-layout",
|
|
591
|
-
"id": "src/types/client-layout.ts::ClientViewMetadata",
|
|
592
|
-
"referenceLocation": "ClientViewMetadata"
|
|
593
|
-
},
|
|
594
|
-
"ColumnFilter": {
|
|
595
|
-
"location": "import",
|
|
596
|
-
"path": "../../utils/cell-renderer",
|
|
597
|
-
"id": "src/utils/cell-renderer.ts::ColumnFilter",
|
|
598
|
-
"referenceLocation": "ColumnFilter"
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
497
|
}, {
|
|
603
498
|
"method": "mrdLoadViewPage",
|
|
604
499
|
"name": "mrdLoadViewPage",
|
|
@@ -610,16 +505,9 @@ export class MrdLayoutSection {
|
|
|
610
505
|
"text": "Re-emitted from an embedded mrd-table's mrdLoadPage; host fetches the next page and calls setViewPage()."
|
|
611
506
|
},
|
|
612
507
|
"complexType": {
|
|
613
|
-
"original": "{ name: string; page: number; sort: string;
|
|
614
|
-
"resolved": "{ name: string; page: number; sort: string;
|
|
615
|
-
"references": {
|
|
616
|
-
"ColumnFilter": {
|
|
617
|
-
"location": "import",
|
|
618
|
-
"path": "../../utils/cell-renderer",
|
|
619
|
-
"id": "src/utils/cell-renderer.ts::ColumnFilter",
|
|
620
|
-
"referenceLocation": "ColumnFilter"
|
|
621
|
-
}
|
|
622
|
-
}
|
|
508
|
+
"original": "{ name: string; page: number; sort: string; path: string; qs: string }",
|
|
509
|
+
"resolved": "{ name: string; page: number; sort: string; path: string; qs: string; }",
|
|
510
|
+
"references": {}
|
|
623
511
|
}
|
|
624
512
|
}, {
|
|
625
513
|
"method": "mrdLoadImage",
|
|
@@ -644,11 +532,11 @@ export class MrdLayoutSection {
|
|
|
644
532
|
"composed": true,
|
|
645
533
|
"docs": {
|
|
646
534
|
"tags": [],
|
|
647
|
-
"text": "Re-emitted from an embedded mrd-table's mrdAction;
|
|
535
|
+
"text": "Re-emitted from an embedded mrd-table's mrdAction; host builds the target URL from dataClass."
|
|
648
536
|
},
|
|
649
537
|
"complexType": {
|
|
650
|
-
"original": "{ name: string; action: string;
|
|
651
|
-
"resolved": "{ name: string; action: string;
|
|
538
|
+
"original": "{ name: string; action: string; dataClass: string; path?: string; qs?: string; parentPath?: string | null }",
|
|
539
|
+
"resolved": "{ name: string; action: string; dataClass: string; path?: string | undefined; qs?: string | undefined; parentPath?: string | null | undefined; }",
|
|
652
540
|
"references": {}
|
|
653
541
|
}
|
|
654
542
|
}, {
|
|
@@ -662,16 +550,9 @@ export class MrdLayoutSection {
|
|
|
662
550
|
"text": "Re-emitted from an embedded mrd-table's mrdLoadAggregations; host calls setViewAggregations() with the result."
|
|
663
551
|
},
|
|
664
552
|
"complexType": {
|
|
665
|
-
"original": "{ name: string;
|
|
666
|
-
"resolved": "{ name: string;
|
|
667
|
-
"references": {
|
|
668
|
-
"ColumnFilter": {
|
|
669
|
-
"location": "import",
|
|
670
|
-
"path": "../../utils/cell-renderer",
|
|
671
|
-
"id": "src/utils/cell-renderer.ts::ColumnFilter",
|
|
672
|
-
"referenceLocation": "ColumnFilter"
|
|
673
|
-
}
|
|
674
|
-
}
|
|
553
|
+
"original": "{ name: string; dataClass: string; path: string; qs: string; sum?: string[]; avg?: string[]; count?: string[] }",
|
|
554
|
+
"resolved": "{ name: string; dataClass: string; path: string; qs: string; sum?: string[] | undefined; avg?: string[] | undefined; count?: string[] | undefined; }",
|
|
555
|
+
"references": {}
|
|
675
556
|
}
|
|
676
557
|
}];
|
|
677
558
|
}
|
|
@@ -710,7 +591,7 @@ export class MrdLayoutSection {
|
|
|
710
591
|
},
|
|
711
592
|
"setViewPage": {
|
|
712
593
|
"complexType": {
|
|
713
|
-
"signature": "(name: string, page: number, rows: any[], totalElements?: number
|
|
594
|
+
"signature": "(name: string, page: number, rows: any[], totalElements?: number) => Promise<void>",
|
|
714
595
|
"parameters": [{
|
|
715
596
|
"name": "name",
|
|
716
597
|
"type": "string",
|
|
@@ -727,25 +608,17 @@ export class MrdLayoutSection {
|
|
|
727
608
|
"name": "totalElements",
|
|
728
609
|
"type": "number | undefined",
|
|
729
610
|
"docs": ""
|
|
730
|
-
}, {
|
|
731
|
-
"name": "pageLinks",
|
|
732
|
-
"type": "Record<string, { href: string; }> | undefined",
|
|
733
|
-
"docs": ""
|
|
734
611
|
}],
|
|
735
612
|
"references": {
|
|
736
613
|
"Promise": {
|
|
737
614
|
"location": "global",
|
|
738
615
|
"id": "global::Promise"
|
|
739
|
-
},
|
|
740
|
-
"Record": {
|
|
741
|
-
"location": "global",
|
|
742
|
-
"id": "global::Record"
|
|
743
616
|
}
|
|
744
617
|
},
|
|
745
618
|
"return": "Promise<void>"
|
|
746
619
|
},
|
|
747
620
|
"docs": {
|
|
748
|
-
"text": "Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.\nPass totalElements
|
|
621
|
+
"text": "Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.\nPass totalElements to update the pagination total (safe to pass on every page).",
|
|
749
622
|
"tags": []
|
|
750
623
|
}
|
|
751
624
|
},
|
|
@@ -825,9 +698,6 @@ export class MrdLayoutSection {
|
|
|
825
698
|
static get elementRef() { return "el"; }
|
|
826
699
|
static get watchers() {
|
|
827
700
|
return [{
|
|
828
|
-
"propName": "links",
|
|
829
|
-
"methodName": "linksChanged"
|
|
830
|
-
}, {
|
|
831
701
|
"propName": "data",
|
|
832
702
|
"methodName": "dataChanged"
|
|
833
703
|
}];
|