@mmlogic/components 0.1.23 → 0.1.25

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.
Files changed (57) hide show
  1. package/dist/cjs/index.cjs.js +2 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mosterdcomponents.cjs.js +1 -1
  4. package/dist/cjs/mrd-boolean-field_19.cjs.entry.js +3150 -0
  5. package/dist/collection/collection-manifest.json +2 -0
  6. package/dist/collection/components/mrd-field/mrd-field.js +5 -1
  7. package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +715 -0
  8. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +339 -0
  9. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +227 -0
  10. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +78 -0
  11. package/dist/collection/components/mrd-number-field/mrd-number-field.js +2 -2
  12. package/dist/collection/components/mrd-table/mrd-table.js +41 -4
  13. package/dist/collection/components/mrd-table/mrd-table.scss +23 -0
  14. package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
  15. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
  16. package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
  17. package/dist/collection/dev/app.js +109 -3
  18. package/dist/collection/dev/example-data.js +324 -0
  19. package/dist/collection/types/client-layout.js +2 -0
  20. package/dist/collection/utils/cell-renderer.js +32 -0
  21. package/dist/components/client-layout.js +1 -1
  22. package/dist/components/mrd-field2.js +1 -1
  23. package/dist/components/mrd-form.js +1 -1
  24. package/dist/components/mrd-layout-section.d.ts +11 -0
  25. package/dist/components/mrd-layout-section.js +1 -0
  26. package/dist/components/mrd-longtext-field.d.ts +11 -0
  27. package/dist/components/mrd-longtext-field.js +1 -0
  28. package/dist/components/mrd-longtext-field2.js +1 -0
  29. package/dist/components/mrd-number-field2.js +1 -1
  30. package/dist/components/mrd-table.js +1 -1
  31. package/dist/components/mrd-table2.js +1 -0
  32. package/dist/components/mrd-text-field2.js +1 -1
  33. package/dist/components/mrd-textarea-field2.js +1 -1
  34. package/dist/components/mrd-time-field2.js +1 -1
  35. package/dist/esm/index.js +2 -0
  36. package/dist/esm/loader.js +1 -1
  37. package/dist/esm/mosterdcomponents.js +1 -1
  38. package/dist/esm/mrd-boolean-field_19.entry.js +3130 -0
  39. package/dist/mosterdcomponents/index.esm.js +1 -1
  40. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  41. package/dist/mosterdcomponents/p-a3255fc4.entry.js +1 -0
  42. package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +92 -0
  43. package/dist/types/components/mrd-longtext-field/mrd-longtext-field.d.ts +22 -0
  44. package/dist/types/components/mrd-table/mrd-table.d.ts +5 -0
  45. package/dist/types/components.d.ts +224 -8
  46. package/dist/types/types/client-layout.d.ts +22 -1
  47. package/dist/types/utils/cell-renderer.d.ts +9 -1
  48. package/package.json +1 -1
  49. package/dist/cjs/format-DExY8_nu.js +0 -328
  50. package/dist/cjs/mrd-boolean-field_16.cjs.entry.js +0 -1512
  51. package/dist/cjs/mrd-table.cjs.entry.js +0 -882
  52. package/dist/esm/format-CcRjWvcb.js +0 -319
  53. package/dist/esm/mrd-boolean-field_16.entry.js +0 -1495
  54. package/dist/esm/mrd-table.entry.js +0 -880
  55. package/dist/mosterdcomponents/p-16dcbcdf.entry.js +0 -1
  56. package/dist/mosterdcomponents/p-17e5a251.entry.js +0 -1
  57. package/dist/mosterdcomponents/p-CcRjWvcb.js +0 -1
@@ -0,0 +1,715 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { ClientLayoutItemType, ClientLayoutItemFieldDataType, } from "../../types/client-layout";
3
+ import { CellRenderer } from "../../utils/cell-renderer";
4
+ import { t } from "../../utils/i18n";
5
+ export class MrdLayoutSection {
6
+ constructor() {
7
+ /** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
8
+ this.items = [];
9
+ /** Record data object; keys are field names, _links holds relation and related-view links. */
10
+ this.data = {};
11
+ /** View metadata map (ClientDashboardMetadata.views) for RELATED_VIEW and VIEW items. */
12
+ this.views = {};
13
+ /** Top-level _links from ClientDashboardMetadata; used to resolve hrefs for VIEW items. */
14
+ this.links = {};
15
+ this.locale = navigator.language;
16
+ this.searchQueryMap = {};
17
+ this.searchResultsMap = {};
18
+ this.imagePreviewUrl = null;
19
+ this.imagePreviews = {};
20
+ this.viewLinksMap = {};
21
+ this.searchTimers = {};
22
+ this.handleViewLoadPage = (e, name) => {
23
+ e.stopPropagation();
24
+ this.mrdLoadViewPage.emit({ name, page: e.detail.page, sort: e.detail.sort });
25
+ };
26
+ this.handleSearchInput = (dataClass, query) => {
27
+ this.searchQueryMap = Object.assign(Object.assign({}, this.searchQueryMap), { [dataClass]: query });
28
+ if (this.searchTimers[dataClass])
29
+ clearTimeout(this.searchTimers[dataClass]);
30
+ if (query.length < 2) {
31
+ this.searchResultsMap = Object.assign(Object.assign({}, this.searchResultsMap), { [dataClass]: [] });
32
+ return;
33
+ }
34
+ this.searchTimers[dataClass] = setTimeout(() => {
35
+ this.mrdSearch.emit({ query, dataClass });
36
+ }, 300);
37
+ };
38
+ }
39
+ componentDidLoad() {
40
+ setTimeout(() => {
41
+ this.emitLoadViews();
42
+ this.emitLoadImages();
43
+ }, 0);
44
+ }
45
+ linksChanged(newVal) {
46
+ if (Object.keys(newVal !== null && newVal !== void 0 ? newVal : {}).length > 0) {
47
+ this.emitLoadViews();
48
+ }
49
+ }
50
+ dataChanged(newVal) {
51
+ var _a;
52
+ if (newVal && Object.keys((_a = newVal === null || newVal === void 0 ? void 0 : newVal._links) !== null && _a !== void 0 ? _a : {}).length > 0) {
53
+ this.emitLoadViews();
54
+ }
55
+ }
56
+ emitLoadViews() {
57
+ var _a, _b, _c, _d, _e, _f;
58
+ const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
59
+ for (const item of this.flattenItems(this.items)) {
60
+ if (item.type === ClientLayoutItemType.RELATED_VIEW && item.relatedView) {
61
+ const rv = item.relatedView;
62
+ const viewConfig = this.views[rv.name];
63
+ if (!viewConfig)
64
+ continue;
65
+ const href = (_c = dataLinks[rv.relatedClass]) === null || _c === void 0 ? void 0 : _c.href;
66
+ this.mrdLoadView.emit({ name: rv.name, href, viewConfig });
67
+ }
68
+ else if (item.type === ClientLayoutItemType.VIEW) {
69
+ const viewName = (_e = (_d = item.view) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : item.name;
70
+ if (!viewName)
71
+ continue;
72
+ const viewConfig = this.views[viewName];
73
+ if (!viewConfig)
74
+ continue;
75
+ const href = (_f = this.links[viewName]) === null || _f === void 0 ? void 0 : _f.href;
76
+ this.mrdLoadView.emit({ name: viewName, href, viewConfig });
77
+ }
78
+ }
79
+ }
80
+ emitLoadImages() {
81
+ var _a;
82
+ for (const item of this.flattenItems(this.items)) {
83
+ if (item.type === ClientLayoutItemType.FIELD && ((_a = item.field) === null || _a === void 0 ? void 0 : _a.dataType) === ClientLayoutItemFieldDataType.IMAGE) {
84
+ const fieldName = item.field.name;
85
+ const raw = this.data[fieldName];
86
+ const href = raw === null || raw === void 0 ? void 0 : raw.href;
87
+ if (href)
88
+ this.mrdLoadImage.emit({ fieldName, href });
89
+ }
90
+ }
91
+ }
92
+ flattenItems(items) {
93
+ const result = [];
94
+ for (const item of items) {
95
+ result.push(item);
96
+ if (item.items)
97
+ result.push(...this.flattenItems(item.items));
98
+ }
99
+ return result;
100
+ }
101
+ /** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
102
+ async setSearchResults(results, dataClass) {
103
+ const key = dataClass !== null && dataClass !== void 0 ? dataClass : this.resolveSearchKey();
104
+ if (key) {
105
+ this.searchResultsMap = Object.assign(Object.assign({}, this.searchResultsMap), { [key]: results });
106
+ }
107
+ }
108
+ /**
109
+ * Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.
110
+ * Pass totalElements on page 0 to initialise the table; omit on subsequent pages.
111
+ * Pass pageLinks (_links from the page response) on page 0 to enable action hrefs in mrdViewAction.
112
+ */
113
+ async setViewPage(name, page, rows, totalElements, pageLinks) {
114
+ if (pageLinks) {
115
+ this.viewLinksMap = Object.assign(Object.assign({}, this.viewLinksMap), { [name]: pageLinks });
116
+ }
117
+ const table = this.el.querySelector(`mrd-table[data-view="${name}"]`);
118
+ if (!table)
119
+ return;
120
+ if (totalElements !== undefined) {
121
+ table.totalElements = totalElements;
122
+ await table.init();
123
+ }
124
+ await table.setPage(page, rows);
125
+ }
126
+ /** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
127
+ async setImagePreview(fieldName, url) {
128
+ this.imagePreviews = Object.assign(Object.assign({}, this.imagePreviews), { [fieldName]: url });
129
+ }
130
+ /** Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field). */
131
+ async openImagePreview(url) {
132
+ this.imagePreviewUrl = url;
133
+ }
134
+ resolveSearchKey() {
135
+ const items = this.flattenItems(this.items).filter(i => i.type === ClientLayoutItemType.SEARCH);
136
+ if (items.length === 1 && items[0].search)
137
+ return items[0].search.dataClass;
138
+ return null;
139
+ }
140
+ renderSingleFieldValue(item, value) {
141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
142
+ const field = item.field;
143
+ const dt = field.dataType;
144
+ switch (dt) {
145
+ case ClientLayoutItemFieldDataType.HYPERLINK: {
146
+ const v = value;
147
+ const href = (_a = v === null || v === void 0 ? void 0 : v.href) !== null && _a !== void 0 ? _a : String(value);
148
+ const label = (_c = (_b = v === null || v === void 0 ? void 0 : v.text) !== null && _b !== void 0 ? _b : v === null || v === void 0 ? void 0 : v.label) !== null && _c !== void 0 ? _c : href;
149
+ return (h("a", { class: "mrd-layout-section__link", href: href, target: "_blank", rel: "noopener noreferrer" }, label));
150
+ }
151
+ case ClientLayoutItemFieldDataType.TEXTBLOCK:
152
+ return h("span", { innerHTML: String(value) });
153
+ case ClientLayoutItemFieldDataType.LONGTEXT:
154
+ return h("pre", { class: "mrd-layout-section__pre" }, String(value));
155
+ case ClientLayoutItemFieldDataType.JSON:
156
+ return h("pre", { class: "mrd-layout-section__pre", innerHTML: CellRenderer.formatJson(value) });
157
+ case ClientLayoutItemFieldDataType.FILE: {
158
+ const v = value;
159
+ const fileName = (_d = v === null || v === void 0 ? void 0 : v.fileName) !== null && _d !== void 0 ? _d : String(value);
160
+ const href = (_e = v === null || v === void 0 ? void 0 : v.href) !== null && _e !== void 0 ? _e : '';
161
+ return (h("button", { class: "mrd-layout-section__download-link", onClick: () => href && this.mrdDownload.emit({ href, fileName }) }, t('download', this.locale)));
162
+ }
163
+ case ClientLayoutItemFieldDataType.IMAGE: {
164
+ const v = value;
165
+ const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
166
+ const fileName = (_g = v === null || v === void 0 ? void 0 : v.fileName) !== null && _g !== void 0 ? _g : '';
167
+ const previewUrl = this.imagePreviews[field.name];
168
+ if (previewUrl) {
169
+ 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 })));
170
+ }
171
+ return (h("button", { class: "mrd-layout-section__download-link", onClick: () => href && this.mrdDownload.emit({ href, fileName }) }, fileName || href));
172
+ }
173
+ case ClientLayoutItemFieldDataType.BOOLEAN:
174
+ return (h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', this.locale) : t('no', this.locale)));
175
+ case ClientLayoutItemFieldDataType.LIST: {
176
+ const listItem = ((_h = field.listItems) !== null && _h !== void 0 ? _h : []).find(li => li.key === String(value));
177
+ const label = (_j = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _j !== void 0 ? _j : String(value);
178
+ const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
179
+ const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
180
+ if (color && bg) {
181
+ return (h("span", { class: "mrd-layout-section__badge", style: { color, backgroundColor: bg } }, label));
182
+ }
183
+ if (color) {
184
+ return (h("span", { class: "mrd-layout-section__badge-dot-row" }, h("span", { class: "mrd-layout-section__badge-dot", style: { backgroundColor: color } }), label));
185
+ }
186
+ return label;
187
+ }
188
+ default: {
189
+ const text = CellRenderer.renderValue(dt, value, (_k = field.listItems) !== null && _k !== void 0 ? _k : [], this.locale);
190
+ return text || null;
191
+ }
192
+ }
193
+ }
194
+ renderFieldValue(item, rawValue) {
195
+ if (rawValue == null || rawValue === '')
196
+ return null;
197
+ const field = item.field;
198
+ if (field.multiple && Array.isArray(rawValue)) {
199
+ const rendered = rawValue.map(v => this.renderSingleFieldValue(item, v));
200
+ if (rendered.every(r => typeof r === 'string' || r == null)) {
201
+ return rendered.filter(Boolean).join(', ') || null;
202
+ }
203
+ return (h("span", null, rendered.map((r, i) => (h("span", { key: String(i) }, r, i < rendered.length - 1 ? ', ' : '')))));
204
+ }
205
+ return this.renderSingleFieldValue(item, rawValue);
206
+ }
207
+ renderField(item) {
208
+ if (!item.field)
209
+ return null;
210
+ const field = item.field;
211
+ const rawValue = this.data[field.name];
212
+ const renderedValue = this.renderFieldValue(item, rawValue);
213
+ if (field.header) {
214
+ return (h("h1", { class: "mrd-layout-section__field-header", key: field.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
215
+ }
216
+ if (renderedValue == null)
217
+ return null;
218
+ const isBlock = field.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
219
+ || field.dataType === ClientLayoutItemFieldDataType.LONGTEXT
220
+ || field.dataType === ClientLayoutItemFieldDataType.JSON;
221
+ return (h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key: field.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, renderedValue)));
222
+ }
223
+ renderRelation(item) {
224
+ var _a, _b, _c;
225
+ if (!item.relation)
226
+ return null;
227
+ const links = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
228
+ const link = links[item.relation.name];
229
+ if (!link)
230
+ return null;
231
+ const makeBtn = (href, name) => (h("button", { key: href, class: "mrd-layout-section__relation-link", onClick: () => this.mrdNavigate.emit({ href, label: name }) }, name));
232
+ let valueContent;
233
+ if ((_c = link.values) === null || _c === void 0 ? void 0 : _c.length) {
234
+ valueContent = link.values.map(v => makeBtn(v.href, v.name));
235
+ }
236
+ else if (link.name) {
237
+ valueContent = makeBtn(link.href, link.name);
238
+ }
239
+ if (!valueContent)
240
+ return null;
241
+ return (h("div", { class: "mrd-layout-section__field", key: item.relation.name }, h("span", { class: "mrd-layout-section__field-label" }, item.label), h("span", { class: "mrd-layout-section__field-value" }, valueContent)));
242
+ }
243
+ renderSearch(item) {
244
+ var _a, _b, _c;
245
+ if (!item.search)
246
+ return null;
247
+ const dataClass = item.search.dataClass;
248
+ const query = (_a = this.searchQueryMap[dataClass]) !== null && _a !== void 0 ? _a : '';
249
+ const results = (_b = this.searchResultsMap[dataClass]) !== null && _b !== void 0 ? _b : [];
250
+ return (h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, 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)))))))));
251
+ }
252
+ renderRelatedView(item) {
253
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
254
+ const isRelated = item.type === ClientLayoutItemType.RELATED_VIEW;
255
+ // Support both nested (item.view / item.relatedView) and flat API format (item.name)
256
+ const name = isRelated
257
+ ? (_a = item.relatedView) === null || _a === void 0 ? void 0 : _a.name
258
+ : ((_c = (_b = item.view) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : item.name);
259
+ if (!name)
260
+ return null;
261
+ const viewConfig = this.views[name];
262
+ if (!viewConfig)
263
+ return null;
264
+ const showTitle = isRelated
265
+ ? (_d = item.relatedView) === null || _d === void 0 ? void 0 : _d.showTitle
266
+ : ((_g = (_f = (_e = item.view) === null || _e === void 0 ? void 0 : _e.showTitle) !== null && _f !== void 0 ? _f : item.showTitle) !== null && _g !== void 0 ? _g : false);
267
+ const altViews = isRelated ? undefined : item.alternativeViews;
268
+ const rawActions = (_h = item.actions) !== null && _h !== void 0 ? _h : ['NEW', 'EXPORT'];
269
+ const tableActions = rawActions.reduce((acc, a) => {
270
+ if (a === 'NEW')
271
+ acc.push({ action: 'create', label: t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary' });
272
+ if (a === 'EXPORT')
273
+ acc.push({ action: 'export', label: t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
274
+ return acc;
275
+ }, []);
276
+ 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: viewConfig.values, locale: this.locale, defaultSort: (_j = viewConfig.defaultSort) !== null && _j !== void 0 ? _j : '', alternativeViews: altViews, actions: tableActions, onMrdLoadPage: (e) => this.handleViewLoadPage(e, name), onMrdAction: (e) => {
277
+ var _a, _b, _c;
278
+ e.stopPropagation();
279
+ const pl = (_a = this.viewLinksMap[name]) !== null && _a !== void 0 ? _a : {};
280
+ const href = e.detail.action === 'export' ? (_b = pl['excel']) === null || _b === void 0 ? void 0 : _b.href : (_c = pl['self']) === null || _c === void 0 ? void 0 : _c.href;
281
+ this.mrdViewAction.emit({ name, action: e.detail.action, href });
282
+ } })));
283
+ }
284
+ renderItem(item) {
285
+ var _a, _b;
286
+ switch (item.type) {
287
+ case ClientLayoutItemType.FIELD:
288
+ return this.renderField(item);
289
+ case ClientLayoutItemType.RELATION:
290
+ return this.renderRelation(item);
291
+ case ClientLayoutItemType.HEADER:
292
+ return (h("h2", { class: "mrd-layout-section__header", key: `header-${item.label}` }, item.label));
293
+ case ClientLayoutItemType.TEXT:
294
+ return h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
295
+ case ClientLayoutItemType.NAVIGATE:
296
+ 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));
297
+ case ClientLayoutItemType.SEARCH:
298
+ return this.renderSearch(item);
299
+ case ClientLayoutItemType.SECTION:
300
+ case ClientLayoutItemType.GROUP:
301
+ return (h("div", { class: "mrd-layout-section__group", key: `group-${item.label}` }, item.label && h("h3", { class: "mrd-layout-section__group-title" }, item.label), ((_b = item.items) !== null && _b !== void 0 ? _b : []).map(child => this.renderItem(child))));
302
+ case ClientLayoutItemType.RELATED_VIEW:
303
+ case ClientLayoutItemType.VIEW:
304
+ return this.renderRelatedView(item);
305
+ default:
306
+ return null;
307
+ }
308
+ }
309
+ renderImageModal() {
310
+ if (!this.imagePreviewUrl)
311
+ return null;
312
+ 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: "" }))));
313
+ }
314
+ render() {
315
+ return (h(Host, { key: '007077c73ddcc5c9e6ce546f083f42c07f8b94a4' }, h("div", { key: 'e9904536e9361d9a36d613c20af55ddf8d9acda6', class: "mrd-layout-section" }, this.items.map(item => this.renderItem(item))), this.renderImageModal()));
316
+ }
317
+ static get is() { return "mrd-layout-section"; }
318
+ static get encapsulation() { return "scoped"; }
319
+ static get originalStyleUrls() {
320
+ return {
321
+ "$": ["mrd-layout-section.scss"]
322
+ };
323
+ }
324
+ static get styleUrls() {
325
+ return {
326
+ "$": ["mrd-layout-section.css"]
327
+ };
328
+ }
329
+ static get properties() {
330
+ return {
331
+ "items": {
332
+ "type": "unknown",
333
+ "mutable": false,
334
+ "complexType": {
335
+ "original": "ClientLayoutItem[]",
336
+ "resolved": "ClientLayoutItem[]",
337
+ "references": {
338
+ "ClientLayoutItem": {
339
+ "location": "import",
340
+ "path": "../../types/client-layout",
341
+ "id": "src/types/client-layout.ts::ClientLayoutItem",
342
+ "referenceLocation": "ClientLayoutItem"
343
+ }
344
+ }
345
+ },
346
+ "required": false,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [],
350
+ "text": "Items from one layout entry in ClientDashboardMetadata.layouts[]."
351
+ },
352
+ "getter": false,
353
+ "setter": false,
354
+ "defaultValue": "[]"
355
+ },
356
+ "data": {
357
+ "type": "unknown",
358
+ "mutable": false,
359
+ "complexType": {
360
+ "original": "Record<string, unknown>",
361
+ "resolved": "string | unknown",
362
+ "references": {
363
+ "Record": {
364
+ "location": "global",
365
+ "id": "global::Record"
366
+ }
367
+ }
368
+ },
369
+ "required": false,
370
+ "optional": false,
371
+ "docs": {
372
+ "tags": [],
373
+ "text": "Record data object; keys are field names, _links holds relation and related-view links."
374
+ },
375
+ "getter": false,
376
+ "setter": false,
377
+ "defaultValue": "{}"
378
+ },
379
+ "views": {
380
+ "type": "unknown",
381
+ "mutable": false,
382
+ "complexType": {
383
+ "original": "Record<string, ClientViewMetadata>",
384
+ "resolved": "ClientViewMetadata | string",
385
+ "references": {
386
+ "Record": {
387
+ "location": "global",
388
+ "id": "global::Record"
389
+ },
390
+ "ClientViewMetadata": {
391
+ "location": "import",
392
+ "path": "../../types/client-layout",
393
+ "id": "src/types/client-layout.ts::ClientViewMetadata",
394
+ "referenceLocation": "ClientViewMetadata"
395
+ }
396
+ }
397
+ },
398
+ "required": false,
399
+ "optional": false,
400
+ "docs": {
401
+ "tags": [],
402
+ "text": "View metadata map (ClientDashboardMetadata.views) for RELATED_VIEW and VIEW items."
403
+ },
404
+ "getter": false,
405
+ "setter": false,
406
+ "defaultValue": "{}"
407
+ },
408
+ "links": {
409
+ "type": "unknown",
410
+ "mutable": false,
411
+ "complexType": {
412
+ "original": "Record<string, { href: string }>",
413
+ "resolved": "string | { href: string; }",
414
+ "references": {
415
+ "Record": {
416
+ "location": "global",
417
+ "id": "global::Record"
418
+ }
419
+ }
420
+ },
421
+ "required": false,
422
+ "optional": false,
423
+ "docs": {
424
+ "tags": [],
425
+ "text": "Top-level _links from ClientDashboardMetadata; used to resolve hrefs for VIEW items."
426
+ },
427
+ "getter": false,
428
+ "setter": false,
429
+ "defaultValue": "{}"
430
+ },
431
+ "locale": {
432
+ "type": "string",
433
+ "mutable": false,
434
+ "complexType": {
435
+ "original": "string",
436
+ "resolved": "string",
437
+ "references": {}
438
+ },
439
+ "required": false,
440
+ "optional": false,
441
+ "docs": {
442
+ "tags": [],
443
+ "text": ""
444
+ },
445
+ "getter": false,
446
+ "setter": false,
447
+ "reflect": false,
448
+ "attribute": "locale",
449
+ "defaultValue": "navigator.language"
450
+ }
451
+ };
452
+ }
453
+ static get states() {
454
+ return {
455
+ "searchQueryMap": {},
456
+ "searchResultsMap": {},
457
+ "imagePreviewUrl": {},
458
+ "imagePreviews": {}
459
+ };
460
+ }
461
+ static get events() {
462
+ return [{
463
+ "method": "mrdNavigate",
464
+ "name": "mrdNavigate",
465
+ "bubbles": true,
466
+ "cancelable": true,
467
+ "composed": true,
468
+ "docs": {
469
+ "tags": [],
470
+ "text": ""
471
+ },
472
+ "complexType": {
473
+ "original": "{ href?: string; label: string; navigate?: ClientLayoutItemNavigate }",
474
+ "resolved": "{ href?: string | undefined; label: string; navigate?: ClientLayoutItemNavigate | undefined; }",
475
+ "references": {
476
+ "ClientLayoutItemNavigate": {
477
+ "location": "import",
478
+ "path": "../../types/client-layout",
479
+ "id": "src/types/client-layout.ts::ClientLayoutItemNavigate",
480
+ "referenceLocation": "ClientLayoutItemNavigate"
481
+ }
482
+ }
483
+ }
484
+ }, {
485
+ "method": "mrdSearch",
486
+ "name": "mrdSearch",
487
+ "bubbles": true,
488
+ "cancelable": true,
489
+ "composed": true,
490
+ "docs": {
491
+ "tags": [],
492
+ "text": ""
493
+ },
494
+ "complexType": {
495
+ "original": "{ query: string; dataClass: string }",
496
+ "resolved": "{ query: string; dataClass: string; }",
497
+ "references": {}
498
+ }
499
+ }, {
500
+ "method": "mrdDownload",
501
+ "name": "mrdDownload",
502
+ "bubbles": true,
503
+ "cancelable": true,
504
+ "composed": true,
505
+ "docs": {
506
+ "tags": [],
507
+ "text": ""
508
+ },
509
+ "complexType": {
510
+ "original": "{ href: string; fileName: string }",
511
+ "resolved": "{ href: string; fileName: string; }",
512
+ "references": {}
513
+ }
514
+ }, {
515
+ "method": "mrdLoadView",
516
+ "name": "mrdLoadView",
517
+ "bubbles": true,
518
+ "cancelable": true,
519
+ "composed": true,
520
+ "docs": {
521
+ "tags": [],
522
+ "text": "Fired once on load for each RELATED_VIEW and VIEW item; host fetches page 0 and calls setViewPage()."
523
+ },
524
+ "complexType": {
525
+ "original": "{ name: string; href?: string; viewConfig: ClientViewMetadata }",
526
+ "resolved": "{ name: string; href?: string | undefined; viewConfig: ClientViewMetadata; }",
527
+ "references": {
528
+ "ClientViewMetadata": {
529
+ "location": "import",
530
+ "path": "../../types/client-layout",
531
+ "id": "src/types/client-layout.ts::ClientViewMetadata",
532
+ "referenceLocation": "ClientViewMetadata"
533
+ }
534
+ }
535
+ }
536
+ }, {
537
+ "method": "mrdLoadViewPage",
538
+ "name": "mrdLoadViewPage",
539
+ "bubbles": true,
540
+ "cancelable": true,
541
+ "composed": true,
542
+ "docs": {
543
+ "tags": [],
544
+ "text": "Re-emitted from an embedded mrd-table's mrdLoadPage; host fetches the next page and calls setViewPage()."
545
+ },
546
+ "complexType": {
547
+ "original": "{ name: string; page: number; sort: string }",
548
+ "resolved": "{ name: string; page: number; sort: string; }",
549
+ "references": {}
550
+ }
551
+ }, {
552
+ "method": "mrdLoadImage",
553
+ "name": "mrdLoadImage",
554
+ "bubbles": true,
555
+ "cancelable": true,
556
+ "composed": true,
557
+ "docs": {
558
+ "tags": [],
559
+ "text": "Fired once on load for each IMAGE field that has an href; host resolves the URL and calls setImagePreview()."
560
+ },
561
+ "complexType": {
562
+ "original": "{ fieldName: string; href: string }",
563
+ "resolved": "{ fieldName: string; href: string; }",
564
+ "references": {}
565
+ }
566
+ }, {
567
+ "method": "mrdViewAction",
568
+ "name": "mrdViewAction",
569
+ "bubbles": true,
570
+ "cancelable": true,
571
+ "composed": true,
572
+ "docs": {
573
+ "tags": [],
574
+ "text": "Re-emitted from an embedded mrd-table's mrdAction; includes the view name and resolved href."
575
+ },
576
+ "complexType": {
577
+ "original": "{ name: string; action: string; href?: string }",
578
+ "resolved": "{ name: string; action: string; href?: string | undefined; }",
579
+ "references": {}
580
+ }
581
+ }];
582
+ }
583
+ static get methods() {
584
+ return {
585
+ "setSearchResults": {
586
+ "complexType": {
587
+ "signature": "(results: RelationSearchResult[], dataClass?: string) => Promise<void>",
588
+ "parameters": [{
589
+ "name": "results",
590
+ "type": "RelationSearchResult[]",
591
+ "docs": ""
592
+ }, {
593
+ "name": "dataClass",
594
+ "type": "string | undefined",
595
+ "docs": ""
596
+ }],
597
+ "references": {
598
+ "Promise": {
599
+ "location": "global",
600
+ "id": "global::Promise"
601
+ },
602
+ "RelationSearchResult": {
603
+ "location": "import",
604
+ "path": "../../types/client-layout",
605
+ "id": "src/types/client-layout.ts::RelationSearchResult",
606
+ "referenceLocation": "RelationSearchResult"
607
+ }
608
+ },
609
+ "return": "Promise<void>"
610
+ },
611
+ "docs": {
612
+ "text": "Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one.",
613
+ "tags": []
614
+ }
615
+ },
616
+ "setViewPage": {
617
+ "complexType": {
618
+ "signature": "(name: string, page: number, rows: any[], totalElements?: number, pageLinks?: Record<string, { href: string; }>) => Promise<void>",
619
+ "parameters": [{
620
+ "name": "name",
621
+ "type": "string",
622
+ "docs": ""
623
+ }, {
624
+ "name": "page",
625
+ "type": "number",
626
+ "docs": ""
627
+ }, {
628
+ "name": "rows",
629
+ "type": "any[]",
630
+ "docs": ""
631
+ }, {
632
+ "name": "totalElements",
633
+ "type": "number | undefined",
634
+ "docs": ""
635
+ }, {
636
+ "name": "pageLinks",
637
+ "type": "Record<string, { href: string; }> | undefined",
638
+ "docs": ""
639
+ }],
640
+ "references": {
641
+ "Promise": {
642
+ "location": "global",
643
+ "id": "global::Promise"
644
+ },
645
+ "Record": {
646
+ "location": "global",
647
+ "id": "global::Record"
648
+ }
649
+ },
650
+ "return": "Promise<void>"
651
+ },
652
+ "docs": {
653
+ "text": "Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.\nPass totalElements on page 0 to initialise the table; omit on subsequent pages.\nPass pageLinks (_links from the page response) on page 0 to enable action hrefs in mrdViewAction.",
654
+ "tags": []
655
+ }
656
+ },
657
+ "setImagePreview": {
658
+ "complexType": {
659
+ "signature": "(fieldName: string, url: string) => Promise<void>",
660
+ "parameters": [{
661
+ "name": "fieldName",
662
+ "type": "string",
663
+ "docs": ""
664
+ }, {
665
+ "name": "url",
666
+ "type": "string",
667
+ "docs": ""
668
+ }],
669
+ "references": {
670
+ "Promise": {
671
+ "location": "global",
672
+ "id": "global::Promise"
673
+ }
674
+ },
675
+ "return": "Promise<void>"
676
+ },
677
+ "docs": {
678
+ "text": "Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox.",
679
+ "tags": []
680
+ }
681
+ },
682
+ "openImagePreview": {
683
+ "complexType": {
684
+ "signature": "(url: string) => Promise<void>",
685
+ "parameters": [{
686
+ "name": "url",
687
+ "type": "string",
688
+ "docs": ""
689
+ }],
690
+ "references": {
691
+ "Promise": {
692
+ "location": "global",
693
+ "id": "global::Promise"
694
+ }
695
+ },
696
+ "return": "Promise<void>"
697
+ },
698
+ "docs": {
699
+ "text": "Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field).",
700
+ "tags": []
701
+ }
702
+ }
703
+ };
704
+ }
705
+ static get elementRef() { return "el"; }
706
+ static get watchers() {
707
+ return [{
708
+ "propName": "links",
709
+ "methodName": "linksChanged"
710
+ }, {
711
+ "propName": "data",
712
+ "methodName": "dataChanged"
713
+ }];
714
+ }
715
+ }