@mmlogic/components 0.3.10 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-BPj2cBXs.js → index-CAzwGt9u.js} +38 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mosterdcomponents.cjs.js +2 -2
- package/dist/cjs/mrd-boolean-field_23.cjs.entry.js +1280 -1073
- package/dist/collection/collection-manifest.json +23 -23
- package/dist/collection/components/{mrd-document-container/mrd-document-container.scss → documents/mrd-document-container/mrd-document-container.css} +3 -3
- package/dist/collection/components/{mrd-document-container → documents/mrd-document-container}/mrd-document-container.js +54 -8
- package/dist/collection/components/documents/mrd-document-list/folder-tree.js +109 -0
- package/dist/collection/components/{mrd-document-list/mrd-document-list.scss → documents/mrd-document-list/mrd-document-list.css} +17 -4
- package/dist/collection/components/{mrd-document-list → documents/mrd-document-list}/mrd-document-list.js +166 -237
- package/dist/collection/components/documents/mrd-document-list/tree-view.js +75 -0
- package/dist/collection/components/{mrd-document-view/mrd-document-view.scss → documents/mrd-document-view/mrd-document-view.css} +1 -1
- package/dist/collection/components/{mrd-document-view → documents/mrd-document-view}/mrd-document-view.js +4 -4
- package/dist/collection/components/fields/field-helpers.js +17 -0
- package/dist/collection/components/fields/file-upload-common.js +38 -0
- package/dist/collection/components/{mrd-boolean-field/mrd-boolean-field.scss → fields/mrd-boolean-field/mrd-boolean-field.css} +3 -3
- package/dist/collection/components/{mrd-boolean-field → fields/mrd-boolean-field}/mrd-boolean-field.js +1 -1
- package/dist/collection/components/{mrd-currency-field/mrd-currency-field.scss → fields/mrd-currency-field/mrd-currency-field.css} +11 -9
- package/dist/collection/components/{mrd-currency-field → fields/mrd-currency-field}/mrd-currency-field.js +7 -13
- package/dist/collection/components/{mrd-date-field/mrd-date-field.scss → fields/mrd-date-field/mrd-date-field.css} +8 -10
- package/dist/collection/components/{mrd-date-field → fields/mrd-date-field}/mrd-date-field.js +3 -10
- package/dist/collection/components/{mrd-datetime-field/mrd-datetime-field.scss → fields/mrd-datetime-field/mrd-datetime-field.css} +8 -10
- package/dist/collection/components/{mrd-datetime-field → fields/mrd-datetime-field}/mrd-datetime-field.js +3 -10
- package/dist/collection/components/{mrd-email-field/mrd-email-field.scss → fields/mrd-email-field/mrd-email-field.css} +2 -11
- package/dist/collection/components/{mrd-email-field → fields/mrd-email-field}/mrd-email-field.js +6 -13
- package/dist/collection/components/{mrd-file-field/mrd-file-field.scss → fields/mrd-file-field/mrd-file-field.css} +19 -24
- package/dist/collection/components/{mrd-file-field → fields/mrd-file-field}/mrd-file-field.js +13 -24
- package/dist/collection/components/{mrd-hyperlink-field/mrd-hyperlink-field.scss → fields/mrd-hyperlink-field/mrd-hyperlink-field.css} +7 -16
- package/dist/collection/components/{mrd-hyperlink-field → fields/mrd-hyperlink-field}/mrd-hyperlink-field.js +9 -15
- package/dist/collection/components/{mrd-image-field/mrd-image-field.scss → fields/mrd-image-field/mrd-image-field.css} +15 -24
- package/dist/collection/components/{mrd-image-field → fields/mrd-image-field}/mrd-image-field.js +13 -28
- package/dist/collection/components/{mrd-list-field/mrd-list-field.scss → fields/mrd-list-field/mrd-list-field.css} +18 -21
- package/dist/collection/components/{mrd-list-field → fields/mrd-list-field}/mrd-list-field.js +10 -25
- package/dist/collection/components/{mrd-longtext-field/mrd-longtext-field.scss → fields/mrd-longtext-field/mrd-longtext-field.css} +21 -18
- package/dist/collection/components/{mrd-longtext-field → fields/mrd-longtext-field}/mrd-longtext-field.js +3 -10
- package/dist/collection/components/{mrd-number-field/mrd-number-field.scss → fields/mrd-number-field/mrd-number-field.css} +9 -10
- package/dist/collection/components/{mrd-number-field → fields/mrd-number-field}/mrd-number-field.js +7 -6
- package/dist/collection/components/{mrd-relation-field/mrd-relation-field.scss → fields/mrd-relation-field/mrd-relation-field.css} +61 -59
- package/dist/collection/components/{mrd-relation-field → fields/mrd-relation-field}/mrd-relation-field.js +16 -26
- package/dist/collection/components/{mrd-secret-field/mrd-secret-field.scss → fields/mrd-secret-field/mrd-secret-field.css} +7 -10
- package/dist/collection/components/{mrd-secret-field → fields/mrd-secret-field}/mrd-secret-field.js +4 -11
- package/dist/collection/components/{mrd-text-field/mrd-text-field.scss → fields/mrd-text-field/mrd-text-field.css} +2 -11
- package/dist/collection/components/{mrd-text-field → fields/mrd-text-field}/mrd-text-field.js +3 -10
- package/dist/collection/components/{mrd-textarea-field/mrd-textarea-field.scss → fields/mrd-textarea-field/mrd-textarea-field.css} +7 -10
- package/dist/collection/components/{mrd-textarea-field → fields/mrd-textarea-field}/mrd-textarea-field.js +3 -9
- package/dist/collection/components/{mrd-time-field/mrd-time-field.scss → fields/mrd-time-field/mrd-time-field.css} +8 -10
- package/dist/collection/components/{mrd-time-field → fields/mrd-time-field}/mrd-time-field.js +3 -10
- package/dist/collection/components/{mrd-field/mrd-field.scss → form/mrd-field/mrd-field.css} +1 -1
- package/dist/collection/components/{mrd-field → form/mrd-field}/mrd-field.js +3 -3
- package/dist/collection/components/{mrd-form/mrd-form.scss → form/mrd-form/mrd-form.css} +1 -1
- package/dist/collection/components/{mrd-form → form/mrd-form}/mrd-form.js +5 -5
- package/dist/collection/components/layout/mrd-layout-section/field-value.js +111 -0
- package/dist/collection/components/layout/mrd-layout-section/layout-helpers.js +29 -0
- package/dist/collection/components/{mrd-layout-section/mrd-layout-section.scss → layout/mrd-layout-section/mrd-layout-section.css} +4 -4
- package/dist/collection/components/{mrd-layout-section → layout/mrd-layout-section}/mrd-layout-section.js +58 -133
- package/dist/collection/components/{mrd-table/mrd-table.scss → table/mrd-table/mrd-table.css} +11 -13
- package/dist/collection/components/{mrd-table → table/mrd-table}/mrd-table.js +111 -439
- package/dist/collection/components/table/mrd-table/table-filter-popup.js +85 -0
- package/dist/collection/components/table/mrd-table/table-parts.js +110 -0
- package/dist/collection/components/table/mrd-table/table-query.js +178 -0
- package/dist/collection/components/table/mrd-table/virtual-scroll.js +49 -0
- package/dist/collection/dev/app.js +19 -18
- package/dist/collection/dev/example-data.js +58 -43
- package/dist/collection/utils/i18n.js +10 -0
- package/dist/collection/utils/query-params.js +43 -0
- package/dist/components/field-helpers.js +1 -0
- package/dist/components/file-upload-common.js +1 -0
- package/dist/components/i18n.js +1 -1
- package/dist/components/mrd-boolean-field2.js +1 -1
- package/dist/components/mrd-currency-field2.js +1 -1
- package/dist/components/mrd-date-field2.js +1 -1
- package/dist/components/mrd-datetime-field2.js +1 -1
- package/dist/components/mrd-document-container2.js +1 -1
- package/dist/components/mrd-document-list2.js +1 -1
- package/dist/components/mrd-document-view2.js +1 -1
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-hyperlink-field2.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-list-field2.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-relation-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/components/query-params.js +1 -0
- package/dist/esm/{index-_tsCCkAi.js → index-DiSEJMA8.js} +38 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mosterdcomponents.js +3 -3
- package/dist/esm/mrd-boolean-field_23.entry.js +1280 -1073
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-9b3c0917.entry.js +1 -0
- package/dist/mosterdcomponents/p-DiSEJMA8.js +2 -0
- package/dist/types/components/{mrd-document-container → documents/mrd-document-container}/mrd-document-container.d.ts +7 -2
- package/dist/types/components/documents/mrd-document-list/folder-tree.d.ts +66 -0
- package/dist/types/components/{mrd-document-list → documents/mrd-document-list}/mrd-document-list.d.ts +28 -38
- package/dist/types/components/documents/mrd-document-list/tree-view.d.ts +32 -0
- package/dist/types/components/{mrd-document-view → documents/mrd-document-view}/mrd-document-view.d.ts +2 -2
- package/dist/types/components/fields/field-helpers.d.ts +18 -0
- package/dist/types/components/fields/file-upload-common.d.ts +18 -0
- package/dist/types/components/{mrd-boolean-field → fields/mrd-boolean-field}/mrd-boolean-field.d.ts +1 -1
- package/dist/types/components/{mrd-currency-field → fields/mrd-currency-field}/mrd-currency-field.d.ts +2 -2
- package/dist/types/components/{mrd-date-field → fields/mrd-date-field}/mrd-date-field.d.ts +1 -1
- package/dist/types/components/{mrd-datetime-field → fields/mrd-datetime-field}/mrd-datetime-field.d.ts +1 -1
- package/dist/types/components/{mrd-email-field → fields/mrd-email-field}/mrd-email-field.d.ts +1 -1
- package/dist/types/components/{mrd-file-field → fields/mrd-file-field}/mrd-file-field.d.ts +2 -4
- package/dist/types/components/{mrd-hyperlink-field → fields/mrd-hyperlink-field}/mrd-hyperlink-field.d.ts +2 -2
- package/dist/types/components/{mrd-image-field → fields/mrd-image-field}/mrd-image-field.d.ts +2 -4
- package/dist/types/components/{mrd-list-field → fields/mrd-list-field}/mrd-list-field.d.ts +2 -2
- package/dist/types/components/{mrd-longtext-field → fields/mrd-longtext-field}/mrd-longtext-field.d.ts +1 -1
- package/dist/types/components/{mrd-number-field → fields/mrd-number-field}/mrd-number-field.d.ts +2 -2
- package/dist/types/components/{mrd-relation-field → fields/mrd-relation-field}/mrd-relation-field.d.ts +2 -2
- package/dist/types/components/{mrd-secret-field → fields/mrd-secret-field}/mrd-secret-field.d.ts +1 -1
- package/dist/types/components/{mrd-text-field → fields/mrd-text-field}/mrd-text-field.d.ts +1 -1
- package/dist/types/components/{mrd-textarea-field → fields/mrd-textarea-field}/mrd-textarea-field.d.ts +1 -1
- package/dist/types/components/{mrd-time-field → fields/mrd-time-field}/mrd-time-field.d.ts +1 -1
- package/dist/types/components/{mrd-field → form/mrd-field}/mrd-field.d.ts +2 -2
- package/dist/types/components/{mrd-form → form/mrd-form}/mrd-form.d.ts +2 -2
- package/dist/types/components/layout/mrd-layout-section/field-value.d.ts +22 -0
- package/dist/types/components/layout/mrd-layout-section/layout-helpers.d.ts +8 -0
- package/dist/types/components/{mrd-layout-section → layout/mrd-layout-section}/mrd-layout-section.d.ts +4 -8
- package/dist/types/components/{mrd-table → table/mrd-table}/mrd-table.d.ts +6 -13
- package/dist/types/components/table/mrd-table/table-filter-popup.d.ts +35 -0
- package/dist/types/components/table/mrd-table/table-parts.d.ts +61 -0
- package/dist/types/components/table/mrd-table/table-query.d.ts +50 -0
- package/dist/types/components/table/mrd-table/virtual-scroll.d.ts +26 -0
- package/dist/types/components.d.ts +36 -5
- package/dist/types/types/client-layout.d.ts +5 -0
- package/dist/types/utils/query-params.d.ts +14 -0
- package/package.json +7 -2
- package/dist/components/validation.js +0 -1
- package/dist/mosterdcomponents/cell-renderer-B-AJDBcj.js.map +0 -1
- package/dist/mosterdcomponents/client-layout-ChqRA3AF.js.map +0 -1
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
- package/dist/mosterdcomponents/i18n-s1XrKcD2.js.map +0 -1
- package/dist/mosterdcomponents/index-DkY-NQj0.js.map +0 -1
- package/dist/mosterdcomponents/index-DwF_Sp__.js.map +0 -1
- package/dist/mosterdcomponents/index.esm.js.map +0 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
- package/dist/mosterdcomponents/p-69452249.entry.js +0 -1
- package/dist/mosterdcomponents/p-_tsCCkAi.js +0 -2
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
- package/dist/mosterdcomponents/validation-Br9k2Ztw.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, resolveArchetype, ARCHETYPE_DOCUMENT, } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { formatDate } from "../../utils/format";
|
|
2
|
+
import { ClientLayoutItemType, ClientLayoutItemFieldDataType, resolveArchetype, ARCHETYPE_DOCUMENT, } from "../../../types/client-layout";
|
|
3
|
+
import { viewKeyFor, flattenItems, buildContainerHref } from "./layout-helpers";
|
|
4
|
+
import { renderField } from "./field-value";
|
|
6
5
|
export class MrdLayoutSection {
|
|
7
6
|
constructor() {
|
|
8
7
|
/** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
|
|
@@ -71,14 +70,8 @@ export class MrdLayoutSection {
|
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
|
-
viewKeyFor(item) {
|
|
75
|
-
var _a, _b, _c, _d;
|
|
76
|
-
if (item.type === ClientLayoutItemType.RELATED_VIEW)
|
|
77
|
-
return (_b = (_a = item.relatedClass) !== null && _a !== void 0 ? _a : item.name) !== null && _b !== void 0 ? _b : '';
|
|
78
|
-
return (_d = (_c = item.dataClass) !== null && _c !== void 0 ? _c : item.name) !== null && _d !== void 0 ? _d : '';
|
|
79
|
-
}
|
|
80
73
|
emitLoadImages() {
|
|
81
|
-
for (const item of
|
|
74
|
+
for (const item of flattenItems(this.items)) {
|
|
82
75
|
if (item.type === ClientLayoutItemType.FIELD && item.dataType === ClientLayoutItemFieldDataType.IMAGE) {
|
|
83
76
|
const fieldName = item.name;
|
|
84
77
|
const raw = this.data[fieldName];
|
|
@@ -88,15 +81,6 @@ export class MrdLayoutSection {
|
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
}
|
|
91
|
-
flattenItems(items) {
|
|
92
|
-
const result = [];
|
|
93
|
-
for (const item of items) {
|
|
94
|
-
result.push(item);
|
|
95
|
-
if (item.items)
|
|
96
|
-
result.push(...this.flattenItems(item.items));
|
|
97
|
-
}
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
100
84
|
/** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
|
|
101
85
|
async setSearchResults(results, dataClass) {
|
|
102
86
|
const key = dataClass !== null && dataClass !== void 0 ? dataClass : this.resolveSearchKey();
|
|
@@ -162,113 +146,26 @@ export class MrdLayoutSection {
|
|
|
162
146
|
}
|
|
163
147
|
resolveSearchKey() {
|
|
164
148
|
var _a;
|
|
165
|
-
const items =
|
|
149
|
+
const items = flattenItems(this.items).filter(i => i.type === ClientLayoutItemType.SEARCH);
|
|
166
150
|
if (items.length === 1)
|
|
167
151
|
return (_a = items[0].dataClass) !== null && _a !== void 0 ? _a : null;
|
|
168
152
|
return null;
|
|
169
153
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
case ClientLayoutItemFieldDataType.LONGTEXT:
|
|
183
|
-
return h("pre", { class: "mrd-layout-section__pre" }, String(value));
|
|
184
|
-
case ClientLayoutItemFieldDataType.JSON:
|
|
185
|
-
return h("pre", { class: "mrd-layout-section__pre", innerHTML: CellRenderer.formatJson(value) });
|
|
186
|
-
case ClientLayoutItemFieldDataType.FILE: {
|
|
187
|
-
const v = value;
|
|
188
|
-
const fileName = (_e = v === null || v === void 0 ? void 0 : v.fileName) !== null && _e !== void 0 ? _e : String(value);
|
|
189
|
-
const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
|
|
190
|
-
return (h("button", { class: "mrd-layout-section__download-link", onClick: () => href && this.mrdDownload.emit({ href, fileName }) }, h("svg", { class: "mrd-layout-section__file-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z" })), t('download', this.locale)));
|
|
191
|
-
}
|
|
192
|
-
case ClientLayoutItemFieldDataType.IMAGE: {
|
|
193
|
-
const v = value;
|
|
194
|
-
const href = (_g = v === null || v === void 0 ? void 0 : v.href) !== null && _g !== void 0 ? _g : '';
|
|
195
|
-
const fileName = (_h = v === null || v === void 0 ? void 0 : v.fileName) !== null && _h !== void 0 ? _h : '';
|
|
196
|
-
const previewUrl = this.imagePreviews[item.name];
|
|
197
|
-
if (previewUrl) {
|
|
198
|
-
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 })));
|
|
199
|
-
}
|
|
200
|
-
return (h("button", { class: "mrd-layout-section__download-link", onClick: () => href && this.mrdDownload.emit({ href, fileName }) }, h("svg", { class: "mrd-layout-section__file-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, h("path", { fill: "currentColor", d: "M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 8l-3-3 1.41-1.41L10 14.17l4.59-4.58L16 11l-6 6z" })), fileName || href));
|
|
201
|
-
}
|
|
202
|
-
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
203
|
-
return (h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', this.locale) : t('no', this.locale)));
|
|
204
|
-
case ClientLayoutItemFieldDataType.LIST: {
|
|
205
|
-
const listItem = ((_j = item.listItems) !== null && _j !== void 0 ? _j : []).find(li => li.key === String(value));
|
|
206
|
-
const label = (_k = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _k !== void 0 ? _k : String(value);
|
|
207
|
-
const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
|
|
208
|
-
const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
|
|
209
|
-
if (color && bg) {
|
|
210
|
-
return (h("span", { class: "mrd-layout-section__badge", style: { color, backgroundColor: bg } }, label));
|
|
211
|
-
}
|
|
212
|
-
if (color) {
|
|
213
|
-
return (h("span", { class: "mrd-layout-section__badge-dot-row" }, h("span", { class: "mrd-layout-section__badge-dot", style: { backgroundColor: color } }), label));
|
|
214
|
-
}
|
|
215
|
-
return label;
|
|
216
|
-
}
|
|
217
|
-
case ClientLayoutItemFieldDataType.SECRET:
|
|
218
|
-
return value ? h("span", { class: "mrd-layout-section__secret-masked" }, '••••••••') : null;
|
|
219
|
-
default: {
|
|
220
|
-
const text = CellRenderer.renderValue(dt, value, (_l = item.listItems) !== null && _l !== void 0 ? _l : [], this.locale);
|
|
221
|
-
return text || null;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
renderFieldValue(item, rawValue) {
|
|
226
|
-
if (rawValue == null || rawValue === '')
|
|
227
|
-
return null;
|
|
228
|
-
if (item.multiple && Array.isArray(rawValue)) {
|
|
229
|
-
const rendered = rawValue.map(v => this.renderSingleFieldValue(item, v));
|
|
230
|
-
if (rendered.every(r => typeof r === 'string' || r == null)) {
|
|
231
|
-
return rendered.filter(Boolean).join(', ') || null;
|
|
232
|
-
}
|
|
233
|
-
return (h("span", null, rendered.map((r, i) => (h("span", { key: String(i) }, r, i < rendered.length - 1 ? ', ' : '')))));
|
|
234
|
-
}
|
|
235
|
-
return this.renderSingleFieldValue(item, rawValue);
|
|
236
|
-
}
|
|
237
|
-
renderHistoryBadge(item, raw) {
|
|
238
|
-
var _a, _b, _c;
|
|
239
|
-
const hist = (_a = item.historyEnabled) !== null && _a !== void 0 ? _a : (_b = item.field) === null || _b === void 0 ? void 0 : _b.historyEnabled;
|
|
240
|
-
if (!hist || !item.name)
|
|
241
|
-
return null;
|
|
242
|
-
const history = (_c = raw === null || raw === void 0 ? void 0 : raw.history) !== null && _c !== void 0 ? _c : [];
|
|
243
|
-
if (!history.length)
|
|
244
|
-
return null;
|
|
245
|
-
const sorted = [...history].sort((a, b) => b.until.localeCompare(a.until));
|
|
246
|
-
const isOpen = this.openHistoryField === item.name;
|
|
247
|
-
const { locale } = this;
|
|
248
|
-
return (h("span", { class: "mrd-layout-section__history-wrap" }, h("button", { type: "button", class: "mrd-layout-section__history-btn", title: t('history_badge_tooltip', locale), "aria-label": t('history_badge_tooltip', locale), onClick: (e) => {
|
|
249
|
-
e.stopPropagation();
|
|
250
|
-
this.openHistoryField = isOpen ? null : item.name;
|
|
251
|
-
} }, h("svg", { class: "mrd-layout-section__history-icon", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, h("path", { "fill-rule": "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-13a.75.75 0 00-1.5 0v5c0 .207.085.394.22.53l2.5 2.5a.75.75 0 101.06-1.06L10.75 9.69V5z", "clip-rule": "evenodd" }))), isOpen && (h("div", { class: "mrd-layout-section__history-popover", role: "listbox" }, sorted.map((entry, i) => (h("div", { key: String(i), class: "mrd-layout-section__history-entry" }, entry.value, " (", t('history_until', locale), " ", formatDate(entry.until, locale), ")")))))));
|
|
154
|
+
fieldCtx() {
|
|
155
|
+
return {
|
|
156
|
+
locale: this.locale,
|
|
157
|
+
data: this.data,
|
|
158
|
+
imagePreviews: this.imagePreviews,
|
|
159
|
+
openHistoryField: this.openHistoryField,
|
|
160
|
+
on: {
|
|
161
|
+
download: detail => this.mrdDownload.emit(detail),
|
|
162
|
+
openImage: url => { this.imagePreviewUrl = url; },
|
|
163
|
+
toggleHistory: fieldName => { this.openHistoryField = fieldName; },
|
|
164
|
+
},
|
|
165
|
+
};
|
|
252
166
|
}
|
|
253
167
|
renderField(item) {
|
|
254
|
-
|
|
255
|
-
if (!item.name)
|
|
256
|
-
return null;
|
|
257
|
-
const raw = this.data[item.name];
|
|
258
|
-
const hist = (_a = item.historyEnabled) !== null && _a !== void 0 ? _a : (_b = item.field) === null || _b === void 0 ? void 0 : _b.historyEnabled;
|
|
259
|
-
const rawValue = hist && raw !== null && typeof raw === 'object' && 'current' in raw
|
|
260
|
-
? raw.current
|
|
261
|
-
: raw;
|
|
262
|
-
const renderedValue = this.renderFieldValue(item, rawValue);
|
|
263
|
-
if (item.header) {
|
|
264
|
-
return (h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
265
|
-
}
|
|
266
|
-
if (renderedValue == null)
|
|
267
|
-
return null;
|
|
268
|
-
const isBlock = item.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
269
|
-
|| item.dataType === ClientLayoutItemFieldDataType.LONGTEXT
|
|
270
|
-
|| item.dataType === ClientLayoutItemFieldDataType.JSON;
|
|
271
|
-
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, this.renderHistoryBadge(item, raw))));
|
|
168
|
+
return renderField(this.fieldCtx(), item);
|
|
272
169
|
}
|
|
273
170
|
renderRelation(item) {
|
|
274
171
|
var _a, _b, _c;
|
|
@@ -301,7 +198,7 @@ export class MrdLayoutSection {
|
|
|
301
198
|
}
|
|
302
199
|
renderRelatedView(item) {
|
|
303
200
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
304
|
-
const key =
|
|
201
|
+
const key = viewKeyFor(item);
|
|
305
202
|
if (!key)
|
|
306
203
|
return null;
|
|
307
204
|
if (!item.view)
|
|
@@ -313,15 +210,19 @@ export class MrdLayoutSection {
|
|
|
313
210
|
// The API publishes `archetypes` on the VIEW/RELATED_VIEW item itself
|
|
314
211
|
// (sibling of `view`), not inside `view`.
|
|
315
212
|
const docArchetype = resolveArchetype((_g = item.archetypes) !== null && _g !== void 0 ? _g : (_h = item.view) === null || _h === void 0 ? void 0 : _h.archetypes, ARCHETYPE_DOCUMENT);
|
|
213
|
+
// Canonical parent href for single-container seeding: use the RELATED_VIEW's
|
|
214
|
+
// fromClass (base class) rather than the route class, so polymorphic subtypes
|
|
215
|
+
// resolve to the same container the documents actually reference.
|
|
216
|
+
const containerHref = buildContainerHref(item, selfHref, parentId);
|
|
316
217
|
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), docArchetype
|
|
317
|
-
? this.renderDocumentContainer(item, key, parentId, docArchetype)
|
|
218
|
+
? this.renderDocumentContainer(item, key, parentId, docArchetype, containerHref)
|
|
318
219
|
: this.renderTable(item, key, parentId)));
|
|
319
220
|
}
|
|
320
221
|
/** Document collection view: owns the view-switch + collection actions and
|
|
321
222
|
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
322
223
|
* the host with the view key, exactly as the raw list/table events were. */
|
|
323
|
-
renderDocumentContainer(item, key, parentId, archetype) {
|
|
324
|
-
return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
224
|
+
renderDocumentContainer(item, key, parentId, archetype, containerHref) {
|
|
225
|
+
return (h("mrd-document-container", { item: item, archetype: archetype, parentId: parentId, containerHref: containerHref, viewKey: key, locale: this.locale, onMrdLoadDistinct: (e) => {
|
|
325
226
|
e.stopPropagation();
|
|
326
227
|
this.mrdLoadViewDistinct.emit(Object.assign({ name: key }, e.detail));
|
|
327
228
|
}, onMrdLoadPage: (e) => {
|
|
@@ -417,7 +318,7 @@ export class MrdLayoutSection {
|
|
|
417
318
|
}
|
|
418
319
|
render() {
|
|
419
320
|
const docArchetype = resolveArchetype(this.archetypes, ARCHETYPE_DOCUMENT);
|
|
420
|
-
return (h(Host, { key: '
|
|
321
|
+
return (h(Host, { key: '5d778188356a25ea13d45745dc5ed573ab2b2ef0' }, h("div", { key: '0b673a4bcf8b36cd21662bb8a3506cc3f30edb04', class: "mrd-layout-section" }, docArchetype
|
|
421
322
|
? this.renderDocumentObject(docArchetype)
|
|
422
323
|
: this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
423
324
|
}
|
|
@@ -444,7 +345,7 @@ export class MrdLayoutSection {
|
|
|
444
345
|
"references": {
|
|
445
346
|
"ClientLayoutItem": {
|
|
446
347
|
"location": "import",
|
|
447
|
-
"path": "
|
|
348
|
+
"path": "../../../types/client-layout",
|
|
448
349
|
"id": "src/types/client-layout.ts::ClientLayoutItem",
|
|
449
350
|
"referenceLocation": "ClientLayoutItem"
|
|
450
351
|
}
|
|
@@ -496,7 +397,7 @@ export class MrdLayoutSection {
|
|
|
496
397
|
},
|
|
497
398
|
"ClientViewMetadata": {
|
|
498
399
|
"location": "import",
|
|
499
|
-
"path": "
|
|
400
|
+
"path": "../../../types/client-layout",
|
|
500
401
|
"id": "src/types/client-layout.ts::ClientViewMetadata",
|
|
501
402
|
"referenceLocation": "ClientViewMetadata"
|
|
502
403
|
}
|
|
@@ -564,7 +465,7 @@ export class MrdLayoutSection {
|
|
|
564
465
|
"references": {
|
|
565
466
|
"ClientArchetype": {
|
|
566
467
|
"location": "import",
|
|
567
|
-
"path": "
|
|
468
|
+
"path": "../../../types/client-layout",
|
|
568
469
|
"id": "src/types/client-layout.ts::ClientArchetype",
|
|
569
470
|
"referenceLocation": "ClientArchetype"
|
|
570
471
|
}
|
|
@@ -608,7 +509,7 @@ export class MrdLayoutSection {
|
|
|
608
509
|
"references": {
|
|
609
510
|
"ClientLayoutItemNavigate": {
|
|
610
511
|
"location": "import",
|
|
611
|
-
"path": "
|
|
512
|
+
"path": "../../../types/client-layout",
|
|
612
513
|
"id": "src/types/client-layout.ts::ClientLayoutItemNavigate",
|
|
613
514
|
"referenceLocation": "ClientLayoutItemNavigate"
|
|
614
515
|
}
|
|
@@ -802,7 +703,7 @@ export class MrdLayoutSection {
|
|
|
802
703
|
},
|
|
803
704
|
"RelationSearchResult": {
|
|
804
705
|
"location": "import",
|
|
805
|
-
"path": "
|
|
706
|
+
"path": "../../../types/client-layout",
|
|
806
707
|
"id": "src/types/client-layout.ts::RelationSearchResult",
|
|
807
708
|
"referenceLocation": "RelationSearchResult"
|
|
808
709
|
}
|
|
@@ -846,6 +747,14 @@ export class MrdLayoutSection {
|
|
|
846
747
|
"Promise": {
|
|
847
748
|
"location": "global",
|
|
848
749
|
"id": "global::Promise"
|
|
750
|
+
},
|
|
751
|
+
"HTMLMrdDocumentListElement": {
|
|
752
|
+
"location": "global",
|
|
753
|
+
"id": "global::HTMLMrdDocumentListElement"
|
|
754
|
+
},
|
|
755
|
+
"HTMLMrdTableElement": {
|
|
756
|
+
"location": "global",
|
|
757
|
+
"id": "global::HTMLMrdTableElement"
|
|
849
758
|
}
|
|
850
759
|
},
|
|
851
760
|
"return": "Promise<void>"
|
|
@@ -871,6 +780,10 @@ export class MrdLayoutSection {
|
|
|
871
780
|
"Promise": {
|
|
872
781
|
"location": "global",
|
|
873
782
|
"id": "global::Promise"
|
|
783
|
+
},
|
|
784
|
+
"HTMLMrdTableElement": {
|
|
785
|
+
"location": "global",
|
|
786
|
+
"id": "global::HTMLMrdTableElement"
|
|
874
787
|
}
|
|
875
788
|
},
|
|
876
789
|
"return": "Promise<void>"
|
|
@@ -903,9 +816,13 @@ export class MrdLayoutSection {
|
|
|
903
816
|
},
|
|
904
817
|
"DistinctValue": {
|
|
905
818
|
"location": "import",
|
|
906
|
-
"path": "
|
|
907
|
-
"id": "src/components/mrd-document-list/
|
|
819
|
+
"path": "../../documents/mrd-document-list/folder-tree",
|
|
820
|
+
"id": "src/components/documents/mrd-document-list/folder-tree.ts::DistinctValue",
|
|
908
821
|
"referenceLocation": "DistinctValue"
|
|
822
|
+
},
|
|
823
|
+
"HTMLMrdDocumentListElement": {
|
|
824
|
+
"location": "global",
|
|
825
|
+
"id": "global::HTMLMrdDocumentListElement"
|
|
909
826
|
}
|
|
910
827
|
},
|
|
911
828
|
"return": "Promise<void>"
|
|
@@ -931,6 +848,10 @@ export class MrdLayoutSection {
|
|
|
931
848
|
"Promise": {
|
|
932
849
|
"location": "global",
|
|
933
850
|
"id": "global::Promise"
|
|
851
|
+
},
|
|
852
|
+
"HTMLMrdDocumentListElement": {
|
|
853
|
+
"location": "global",
|
|
854
|
+
"id": "global::HTMLMrdDocumentListElement"
|
|
934
855
|
}
|
|
935
856
|
},
|
|
936
857
|
"return": "Promise<void>"
|
|
@@ -956,6 +877,10 @@ export class MrdLayoutSection {
|
|
|
956
877
|
"Promise": {
|
|
957
878
|
"location": "global",
|
|
958
879
|
"id": "global::Promise"
|
|
880
|
+
},
|
|
881
|
+
"HTMLMrdDocumentListElement": {
|
|
882
|
+
"location": "global",
|
|
883
|
+
"id": "global::HTMLMrdDocumentListElement"
|
|
959
884
|
}
|
|
960
885
|
},
|
|
961
886
|
"return": "Promise<void>"
|
package/dist/collection/components/{mrd-table/mrd-table.scss → table/mrd-table/mrd-table.css}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
:host {
|
|
2
3
|
display: block;
|
|
3
4
|
width: 100%;
|
|
@@ -145,21 +146,19 @@
|
|
|
145
146
|
height: 0.75rem;
|
|
146
147
|
width: 55%;
|
|
147
148
|
border-radius: var(--mrd-border-radius-sm);
|
|
148
|
-
background: linear-gradient(
|
|
149
|
-
90deg,
|
|
150
|
-
var(--mrd-color-neutral-200) 25%,
|
|
151
|
-
var(--mrd-color-neutral-100) 50%,
|
|
152
|
-
var(--mrd-color-neutral-200) 75%
|
|
153
|
-
);
|
|
149
|
+
background: linear-gradient(90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75%);
|
|
154
150
|
background-size: 200% 100%;
|
|
155
151
|
animation: mrd-shimmer 1.4s ease infinite;
|
|
156
152
|
}
|
|
157
153
|
|
|
158
154
|
@keyframes mrd-shimmer {
|
|
159
|
-
0%
|
|
160
|
-
|
|
155
|
+
0% {
|
|
156
|
+
background-position: 200% 0;
|
|
157
|
+
}
|
|
158
|
+
100% {
|
|
159
|
+
background-position: -200% 0;
|
|
160
|
+
}
|
|
161
161
|
}
|
|
162
|
-
|
|
163
162
|
/* ── Toolbar ───────────────────────────────────────────────────────────── */
|
|
164
163
|
.mrd-table__toolbar {
|
|
165
164
|
display: flex;
|
|
@@ -420,7 +419,7 @@
|
|
|
420
419
|
background: var(--mrd-color-white);
|
|
421
420
|
border: 1px solid var(--mrd-border-color);
|
|
422
421
|
border-radius: var(--mrd-border-radius);
|
|
423
|
-
box-shadow: var(--mrd-shadow-md, 0 4px 12px rgba(0,0,0
|
|
422
|
+
box-shadow: var(--mrd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));
|
|
424
423
|
z-index: var(--mrd-z-dropdown, 200);
|
|
425
424
|
font-size: var(--mrd-font-size-sm);
|
|
426
425
|
}
|
|
@@ -523,7 +522,7 @@
|
|
|
523
522
|
.mrd-table__filter-input:focus {
|
|
524
523
|
outline: none;
|
|
525
524
|
border-color: var(--mrd-color-primary);
|
|
526
|
-
box-shadow: 0 0 0 2px rgba(0,0,0
|
|
525
|
+
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);
|
|
527
526
|
}
|
|
528
527
|
|
|
529
528
|
.mrd-table__filter-range {
|
|
@@ -805,5 +804,4 @@
|
|
|
805
804
|
line-height: 1.6;
|
|
806
805
|
background: none;
|
|
807
806
|
border: none;
|
|
808
|
-
}
|
|
809
|
-
|
|
807
|
+
}
|