@mmlogic/components 0.1.29 → 0.2.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/mrd-boolean-field_19.cjs.entry.js +150 -167
- 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 +52 -61
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +16 -1
- package/dist/collection/components/mrd-table/mrd-table.js +34 -34
- package/dist/collection/dev/api.js +9 -97
- package/dist/collection/dev/app.js +34 -17
- package/dist/collection/dev/example-data.js +111 -298
- 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/mrd-boolean-field_19.entry.js +150 -167
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-61ef0232.entry.js +1 -0
- package/dist/types/types/client-layout.d.ts +25 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-3aacd101.entry.js +0 -1
|
@@ -629,34 +629,32 @@ const MrdField = class {
|
|
|
629
629
|
render() {
|
|
630
630
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
631
631
|
const { item, locale, value } = this;
|
|
632
|
-
if (item.type === ClientLayoutItemType.RELATION
|
|
633
|
-
|
|
634
|
-
return (h(Host, null, h("mrd-relation-field", { name: rel.name, label: rel.label, required: rel.required, disabled: (_a = rel.disabled) !== null && _a !== void 0 ? _a : false, locale: locale, relatedClass: rel.relatedClass, mostSignificantClass: (_b = rel.mostSignificantClass) !== null && _b !== void 0 ? _b : '', displayType: (_c = rel.displayType) !== null && _c !== void 0 ? _c : ClientLayoutItemRelationDisplayType.SEARCH, editBehavior: (_d = rel.editBehavior) !== null && _d !== void 0 ? _d : null, commonRelation: rel.commonRelation, multiple: (_e = rel.multiple) !== null && _e !== void 0 ? _e : false, dropdownValues: (_f = rel.dropdownValues) !== null && _f !== void 0 ? _f : [], value: value, onMrdChange: this.handleChange, onMrdBlur: this.handleBlur, onMrdSearch: this.handleSearch, onMrdFetchAll: this.handleFetchAll })));
|
|
632
|
+
if (item.type === ClientLayoutItemType.RELATION) {
|
|
633
|
+
return (h(Host, null, h("mrd-relation-field", { name: item.name, label: item.label, required: item.required, disabled: (_a = item.disabled) !== null && _a !== void 0 ? _a : false, locale: locale, relatedClass: item.relatedClass, mostSignificantClass: (_b = item.mostSignificantClass) !== null && _b !== void 0 ? _b : '', displayType: (_c = item.displayType) !== null && _c !== void 0 ? _c : ClientLayoutItemRelationDisplayType.SEARCH, editBehavior: (_d = item.editBehavior) !== null && _d !== void 0 ? _d : null, commonRelation: item.commonRelation, multiple: (_e = item.multiple) !== null && _e !== void 0 ? _e : false, dropdownValues: (_f = item.dropdownValues) !== null && _f !== void 0 ? _f : [], value: value, onMrdChange: this.handleChange, onMrdBlur: this.handleBlur, onMrdSearch: this.handleSearch, onMrdFetchAll: this.handleFetchAll })));
|
|
635
634
|
}
|
|
636
|
-
if (item.type !== ClientLayoutItemType.FIELD
|
|
635
|
+
if (item.type !== ClientLayoutItemType.FIELD) {
|
|
637
636
|
return h(Host, null);
|
|
638
637
|
}
|
|
639
|
-
const field = item.field;
|
|
640
638
|
const commonProps = {
|
|
641
|
-
name:
|
|
642
|
-
label:
|
|
643
|
-
required:
|
|
644
|
-
disabled: (_g =
|
|
639
|
+
name: item.name,
|
|
640
|
+
label: item.label,
|
|
641
|
+
required: item.required,
|
|
642
|
+
disabled: (_g = item.disabled) !== null && _g !== void 0 ? _g : false,
|
|
645
643
|
locale,
|
|
646
644
|
onMrdChange: this.handleChange,
|
|
647
645
|
onMrdBlur: this.handleBlur,
|
|
648
646
|
};
|
|
649
|
-
switch (
|
|
647
|
+
switch (item.dataType) {
|
|
650
648
|
case ClientLayoutItemFieldDataType.TEXT:
|
|
651
|
-
return (h(Host, null, h("mrd-text-field", Object.assign({}, commonProps, { value: (_h = value) !== null && _h !== void 0 ? _h : '', placeholder: (_j =
|
|
649
|
+
return (h(Host, null, h("mrd-text-field", Object.assign({}, commonProps, { value: (_h = value) !== null && _h !== void 0 ? _h : '', placeholder: (_j = item.placeholder) !== null && _j !== void 0 ? _j : '' }))));
|
|
652
650
|
case ClientLayoutItemFieldDataType.TEXTBLOCK:
|
|
653
|
-
return (h(Host, null, h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_k = value) !== null && _k !== void 0 ? _k : '', placeholder: (_l =
|
|
651
|
+
return (h(Host, null, h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_k = value) !== null && _k !== void 0 ? _k : '', placeholder: (_l = item.placeholder) !== null && _l !== void 0 ? _l : '' }))));
|
|
654
652
|
case ClientLayoutItemFieldDataType.INTEGER:
|
|
655
653
|
case ClientLayoutItemFieldDataType.DECIMAL:
|
|
656
654
|
case ClientLayoutItemFieldDataType.PERCENTAGE:
|
|
657
|
-
return (h(Host, null, h("mrd-number-field", Object.assign({}, commonProps, { value: (_m = value) !== null && _m !== void 0 ? _m : null, dataType:
|
|
655
|
+
return (h(Host, null, h("mrd-number-field", Object.assign({}, commonProps, { value: (_m = value) !== null && _m !== void 0 ? _m : null, dataType: item.dataType, decimalPrecision: (_o = item.decimalPrecision) !== null && _o !== void 0 ? _o : 2, placeholder: (_p = item.placeholder) !== null && _p !== void 0 ? _p : '' }))));
|
|
658
656
|
case ClientLayoutItemFieldDataType.CURRENCY:
|
|
659
|
-
return (h(Host, null, h("mrd-currency-field", Object.assign({}, commonProps, { value: (_q = value) !== null && _q !== void 0 ? _q : { amount: null, currency: (_r =
|
|
657
|
+
return (h(Host, null, h("mrd-currency-field", Object.assign({}, commonProps, { value: (_q = value) !== null && _q !== void 0 ? _q : { amount: null, currency: (_r = item.currencyCode) !== null && _r !== void 0 ? _r : 'EUR' } }))));
|
|
660
658
|
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
661
659
|
return (h(Host, null, h("mrd-boolean-field", Object.assign({}, commonProps, { value: (_s = value) !== null && _s !== void 0 ? _s : false }))));
|
|
662
660
|
case ClientLayoutItemFieldDataType.DATE:
|
|
@@ -666,17 +664,17 @@ const MrdField = class {
|
|
|
666
664
|
case ClientLayoutItemFieldDataType.TIME:
|
|
667
665
|
return (h(Host, null, h("mrd-time-field", Object.assign({}, commonProps, { value: (_v = value) !== null && _v !== void 0 ? _v : '' }))));
|
|
668
666
|
case ClientLayoutItemFieldDataType.EMAIL:
|
|
669
|
-
return (h(Host, null, h("mrd-email-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x =
|
|
667
|
+
return (h(Host, null, h("mrd-email-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x = item.placeholder) !== null && _x !== void 0 ? _x : '' }))));
|
|
670
668
|
case ClientLayoutItemFieldDataType.HYPERLINK:
|
|
671
|
-
return (h(Host, null, h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', placeholder: (_z =
|
|
669
|
+
return (h(Host, null, h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', placeholder: (_z = item.placeholder) !== null && _z !== void 0 ? _z : '' }))));
|
|
672
670
|
case ClientLayoutItemFieldDataType.LIST:
|
|
673
|
-
return (h(Host, null, h("mrd-list-field", Object.assign({}, commonProps, { value: (_0 = value) !== null && _0 !== void 0 ? _0 : '', multiple: (_1 =
|
|
671
|
+
return (h(Host, null, h("mrd-list-field", Object.assign({}, commonProps, { value: (_0 = value) !== null && _0 !== void 0 ? _0 : '', multiple: (_1 = item.multiple) !== null && _1 !== void 0 ? _1 : false, listItems: (_2 = item.listItems) !== null && _2 !== void 0 ? _2 : [] }))));
|
|
674
672
|
case ClientLayoutItemFieldDataType.FILE:
|
|
675
|
-
return (h(Host, null, h("mrd-file-field", Object.assign({}, commonProps, { value: value, accept: (_3 =
|
|
673
|
+
return (h(Host, null, h("mrd-file-field", Object.assign({}, commonProps, { value: value, accept: (_3 = item.accept) !== null && _3 !== void 0 ? _3 : '', maxSize: (_4 = item.maxSize) !== null && _4 !== void 0 ? _4 : 0, onMrdUpload: this.handleUpload }))));
|
|
676
674
|
case ClientLayoutItemFieldDataType.IMAGE:
|
|
677
|
-
return (h(Host, null, h("mrd-image-field", Object.assign({}, commonProps, { value: value, accept: (_5 =
|
|
675
|
+
return (h(Host, null, h("mrd-image-field", Object.assign({}, commonProps, { value: value, accept: (_5 = item.accept) !== null && _5 !== void 0 ? _5 : 'image/*', maxSize: (_6 = item.maxSize) !== null && _6 !== void 0 ? _6 : 0, onMrdUpload: this.handleUpload }))));
|
|
678
676
|
case ClientLayoutItemFieldDataType.LONGTEXT:
|
|
679
|
-
return (h(Host, null, h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_7 = value) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 =
|
|
677
|
+
return (h(Host, null, h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_7 = value) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 = item.placeholder) !== null && _8 !== void 0 ? _8 : '' }))));
|
|
680
678
|
case ClientLayoutItemFieldDataType.JSON:
|
|
681
679
|
return h(Host, null);
|
|
682
680
|
default:
|
|
@@ -837,17 +835,17 @@ const MrdForm = class {
|
|
|
837
835
|
const newHref = this.getHref(value);
|
|
838
836
|
if (newHref === prevHref)
|
|
839
837
|
return;
|
|
840
|
-
for (const
|
|
841
|
-
if (
|
|
838
|
+
for (const item of this.collectDependentDropdowns()) {
|
|
839
|
+
if (item.commonRelation !== name)
|
|
842
840
|
continue;
|
|
843
841
|
// Clear the dependent field's current selection (options have changed)
|
|
844
|
-
this.formValues = Object.assign(Object.assign({}, this.formValues), { [
|
|
842
|
+
this.formValues = Object.assign(Object.assign({}, this.formValues), { [item.name]: null });
|
|
845
843
|
this.mrdFetchAll.emit({
|
|
846
|
-
name:
|
|
847
|
-
relatedClass:
|
|
848
|
-
mostSignificantClass:
|
|
849
|
-
commonRelation:
|
|
850
|
-
filter:
|
|
844
|
+
name: item.name,
|
|
845
|
+
relatedClass: item.relatedClass,
|
|
846
|
+
mostSignificantClass: item.mostSignificantClass,
|
|
847
|
+
commonRelation: item.commonRelation,
|
|
848
|
+
filter: item.commonRelation + '_href',
|
|
851
849
|
filterValue: newHref, // empty string when dependency was cleared → host should clear the list
|
|
852
850
|
});
|
|
853
851
|
}
|
|
@@ -922,24 +920,20 @@ const MrdForm = class {
|
|
|
922
920
|
var _a, _b;
|
|
923
921
|
const allItems = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
924
922
|
// Strategy 1: direct match on mostSignificantClass
|
|
925
|
-
const direct = allItems.find(item =>
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
});
|
|
930
|
-
if (direct === null || direct === void 0 ? void 0 : direct.relation)
|
|
931
|
-
return direct.relation.name;
|
|
923
|
+
const direct = allItems.find(item => item.type === ClientLayoutItemType.RELATION &&
|
|
924
|
+
item.mostSignificantClass === this.referenceClass);
|
|
925
|
+
if (direct === null || direct === void 0 ? void 0 : direct.name)
|
|
926
|
+
return direct.name;
|
|
932
927
|
// Strategy 2: a DROPDOWN whose commonRelation field was omitted from the layout
|
|
933
928
|
const layoutRelationNames = new Set(allItems
|
|
934
929
|
.filter(item => item.type === ClientLayoutItemType.RELATION)
|
|
935
|
-
.map(item => item.
|
|
930
|
+
.map(item => item.name));
|
|
936
931
|
for (const item of allItems) {
|
|
937
|
-
const rel = item.relation;
|
|
938
932
|
if (item.type === ClientLayoutItemType.RELATION &&
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
!layoutRelationNames.has(
|
|
942
|
-
return
|
|
933
|
+
item.editBehavior === ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
934
|
+
item.commonRelation &&
|
|
935
|
+
!layoutRelationNames.has(item.commonRelation)) {
|
|
936
|
+
return item.commonRelation;
|
|
943
937
|
}
|
|
944
938
|
}
|
|
945
939
|
return null;
|
|
@@ -954,25 +948,21 @@ const MrdForm = class {
|
|
|
954
948
|
collectDependentDropdowns() {
|
|
955
949
|
var _a, _b;
|
|
956
950
|
return this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [])
|
|
957
|
-
.filter(item =>
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
((_a = item.relation) === null || _a === void 0 ? void 0 : _a.editBehavior) === ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
961
|
-
!!item.relation.commonRelation;
|
|
962
|
-
})
|
|
963
|
-
.map(item => item.relation);
|
|
951
|
+
.filter(item => item.type === ClientLayoutItemType.RELATION &&
|
|
952
|
+
item.editBehavior === ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
953
|
+
!!item.commonRelation);
|
|
964
954
|
}
|
|
965
955
|
/** Emit mrdFetchAll for every dependent DROPDOWN whose filter value is currently set. */
|
|
966
956
|
emitDependentFetchAll() {
|
|
967
|
-
for (const
|
|
968
|
-
const filterValue = this.getHref(this.formValues[
|
|
957
|
+
for (const item of this.collectDependentDropdowns()) {
|
|
958
|
+
const filterValue = this.getHref(this.formValues[item.commonRelation]);
|
|
969
959
|
if (filterValue) {
|
|
970
960
|
this.mrdFetchAll.emit({
|
|
971
|
-
name:
|
|
972
|
-
relatedClass:
|
|
973
|
-
mostSignificantClass:
|
|
974
|
-
commonRelation:
|
|
975
|
-
filter:
|
|
961
|
+
name: item.name,
|
|
962
|
+
relatedClass: item.relatedClass,
|
|
963
|
+
mostSignificantClass: item.mostSignificantClass,
|
|
964
|
+
commonRelation: item.commonRelation,
|
|
965
|
+
filter: item.commonRelation + '_href',
|
|
976
966
|
filterValue,
|
|
977
967
|
});
|
|
978
968
|
}
|
|
@@ -1002,15 +992,14 @@ const MrdForm = class {
|
|
|
1002
992
|
return fields;
|
|
1003
993
|
}
|
|
1004
994
|
validate() {
|
|
1005
|
-
var _a, _b
|
|
995
|
+
var _a, _b;
|
|
1006
996
|
const newErrors = {};
|
|
1007
997
|
const allFields = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
1008
998
|
for (const item of allFields) {
|
|
1009
|
-
|
|
1010
|
-
if (!def)
|
|
999
|
+
if (!item.name)
|
|
1011
1000
|
continue;
|
|
1012
|
-
if (
|
|
1013
|
-
newErrors[
|
|
1001
|
+
if (item.required && !validateRequired(this.formValues[item.name])) {
|
|
1002
|
+
newErrors[item.name] = t('required', this.locale);
|
|
1014
1003
|
}
|
|
1015
1004
|
}
|
|
1016
1005
|
this.errors = newErrors;
|
|
@@ -1058,8 +1047,10 @@ const MrdForm = class {
|
|
|
1058
1047
|
const payload = {};
|
|
1059
1048
|
const allFields = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
1060
1049
|
for (const item of allFields) {
|
|
1061
|
-
if (item.
|
|
1062
|
-
|
|
1050
|
+
if (!item.name)
|
|
1051
|
+
continue;
|
|
1052
|
+
const name = item.name;
|
|
1053
|
+
if (item.type === ClientLayoutItemType.FIELD) {
|
|
1063
1054
|
const value = this.formValues[name];
|
|
1064
1055
|
if (value instanceof File)
|
|
1065
1056
|
continue;
|
|
@@ -1069,8 +1060,7 @@ const MrdForm = class {
|
|
|
1069
1060
|
continue;
|
|
1070
1061
|
payload[name] = current;
|
|
1071
1062
|
}
|
|
1072
|
-
else if (item.type === ClientLayoutItemType.RELATION
|
|
1073
|
-
const name = item.relation.name;
|
|
1063
|
+
else if (item.type === ClientLayoutItemType.RELATION) {
|
|
1074
1064
|
const current = this.normalizeRelationValue(this.formValues[name]);
|
|
1075
1065
|
const initial = this.normalizeRelationValue(this.initialValues[name]);
|
|
1076
1066
|
if (this.deepEqual(current, initial))
|
|
@@ -1082,14 +1072,14 @@ const MrdForm = class {
|
|
|
1082
1072
|
}
|
|
1083
1073
|
renderItems(items) {
|
|
1084
1074
|
return items.map(item => {
|
|
1085
|
-
var _a
|
|
1075
|
+
var _a;
|
|
1086
1076
|
if (item.type === ClientLayoutItemType.SECTION) {
|
|
1087
1077
|
return (h("fieldset", { class: "mrd-form__section" }, item.label && h("legend", { class: "mrd-form__section-legend" }, item.label), h("div", { class: "mrd-form__section-body" }, item.items && this.renderItems(item.items))));
|
|
1088
1078
|
}
|
|
1089
1079
|
if (item.type === ClientLayoutItemType.GROUP) {
|
|
1090
1080
|
return (h("div", { class: "mrd-form__group" }, item.label && h("div", { class: "mrd-form__group-label" }, item.label), h("div", { class: "mrd-form__group-body" }, item.items && this.renderItems(item.items))));
|
|
1091
1081
|
}
|
|
1092
|
-
const fieldName = (
|
|
1082
|
+
const fieldName = (_a = item.name) !== null && _a !== void 0 ? _a : '';
|
|
1093
1083
|
const fieldValue = this.formValues[fieldName];
|
|
1094
1084
|
return (h("div", { class: "mrd-form__field" }, h("mrd-field", { item: item, locale: this.locale, value: fieldValue, onMrdChange: this.handleFieldChange, onMrdBlur: this.handleFieldChange, onMrdSearch: this.handleSearch, onMrdFetchAll: this.handleFetchAll, onMrdUpload: this.handleUpload }), this.errors[fieldName] && (h("span", { class: "mrd-form__field-error" }, this.errors[fieldName]))));
|
|
1095
1085
|
});
|
|
@@ -1268,17 +1258,19 @@ class CellRenderer {
|
|
|
1268
1258
|
static render(column, row, locale) {
|
|
1269
1259
|
var _a, _b, _c, _d;
|
|
1270
1260
|
if (column.type === ClientLayoutItemType.RELATION) {
|
|
1271
|
-
const name = (
|
|
1272
|
-
const link = (
|
|
1261
|
+
const name = (_a = column.name) !== null && _a !== void 0 ? _a : '';
|
|
1262
|
+
const link = (_b = row === null || row === void 0 ? void 0 : row._links) === null || _b === void 0 ? void 0 : _b[name];
|
|
1273
1263
|
if (!link)
|
|
1274
1264
|
return '';
|
|
1275
1265
|
if (Array.isArray(link))
|
|
1276
1266
|
return link.map((l) => { var _a; return (_a = l.name) !== null && _a !== void 0 ? _a : ''; }).filter(Boolean).join(', ');
|
|
1277
|
-
return (
|
|
1267
|
+
return (_c = link.name) !== null && _c !== void 0 ? _c : '';
|
|
1278
1268
|
}
|
|
1279
|
-
if (column.type !== ClientLayoutItemType.FIELD
|
|
1269
|
+
if (column.type !== ClientLayoutItemType.FIELD)
|
|
1280
1270
|
return '';
|
|
1281
|
-
const
|
|
1271
|
+
const name = (_d = column.name) !== null && _d !== void 0 ? _d : '';
|
|
1272
|
+
const dataType = column.dataType;
|
|
1273
|
+
const listItems = column.listItems;
|
|
1282
1274
|
const raw = row === null || row === void 0 ? void 0 : row[name];
|
|
1283
1275
|
if (raw == null || raw === '')
|
|
1284
1276
|
return '';
|
|
@@ -1364,7 +1356,7 @@ class CellRenderer {
|
|
|
1364
1356
|
}
|
|
1365
1357
|
}
|
|
1366
1358
|
|
|
1367
|
-
const mrdLayoutSectionScss = () => `.mrd-layout-section.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-layout-section__field.sc-mrd-layout-section{display:grid;grid-template-columns:200px 1fr;align-items:baseline;gap:0 var(--mrd-space-2);padding:var(--mrd-space-1) 0}.mrd-layout-section__field-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-500);padding-top:1px}.mrd-layout-section__field-value.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);word-break:break-word}.mrd-layout-section__field-header.sc-mrd-layout-section{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);margin:0 0 var(--mrd-space-4) 0;padding:0}.mrd-layout-section__header.sc-mrd-layout-section{font-size:var(--mrd-font-size-xl);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:var(--mrd-space-4) 0 var(--mrd-space-2) 0;padding:0}.mrd-layout-section__text.sc-mrd-layout-section{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed);margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:1px solid var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light);border-color:var(--mrd-color-primary)}.mrd-layout-section__link.sc-mrd-layout-section{color:var(--mrd-color-primary);text-decoration:none}.mrd-layout-section__link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__relation-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__relation-link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__download-link.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.mrd-layout-section__boolean--true.sc-mrd-layout-section{color:var(--mrd-color-success);font-weight:var(--mrd-font-weight-semibold)}.mrd-layout-section__boolean--false.sc-mrd-layout-section{color:var(--mrd-color-neutral-400)}.mrd-layout-section__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.mrd-layout-section__badge.sc-mrd-layout-section{display:inline-block;font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);padding:2px var(--mrd-space-3);border-radius:10px}.mrd-layout-section__badge-dot-row.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2)}.mrd-layout-section__badge-dot.sc-mrd-layout-section{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.mrd-layout-section__pre.sc-mrd-layout-section{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);background-color:var(--mrd-color-neutral-50);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);margin:0;max-height:calc(10 * 1.5 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y:auto;white-space:pre-wrap;word-break:break-word}.mrd-layout-section__group.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__group-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;text-transform:uppercase;letter-spacing:0.05em}.mrd-layout-section__related-view.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__related-view-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-lg);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:0 0 var(--mrd-space-3) 0}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-input.sc-mrd-layout-section{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;appearance:none;box-sizing:border-box}.mrd-layout-section__search-input.sc-mrd-layout-section:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__search-input.sc-mrd-layout-section::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-layout-section__search-results.sc-mrd-layout-section{position:absolute;top:100%;left:0;right:0;background-color:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-300);border-top:none;border-radius:0 0 var(--mrd-border-radius) var(--mrd-border-radius);box-shadow:var(--mrd-shadow-sm);z-index:100;max-height:300px;overflow-y:auto;list-style:none;margin:0;padding:var(--mrd-space-1) 0}.mrd-layout-section__search-result.sc-mrd-layout-section{margin:0;padding:0}.mrd-layout-section__search-result-btn.sc-mrd-layout-section{display:flex;flex-direction:column;width:100%;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;text-align:left;cursor:pointer;font-family:var(--mrd-font-family)}.mrd-layout-section__search-result-btn.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light)}.mrd-layout-section__search-result-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800)}.mrd-layout-section__search-result-desc.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section{background:none;border:none;padding:0;cursor:pointer;display:inline-block;border-radius:var(--mrd-border-radius);overflow:hidden;line-height:0}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section:hover .mrd-layout-section__image-thumb.sc-mrd-layout-section{opacity:0.85}.mrd-layout-section__image-thumb.sc-mrd-layout-section{display:block;max-width:160px;max-height:100px;border-radius:var(--mrd-border-radius);object-fit:cover;transition:opacity 0.15s}.mrd-layout-section__modal-backdrop.sc-mrd-layout-section{position:fixed;inset:0;background:rgba(0, 0, 0, 0.6);z-index:300;display:flex;align-items:center;justify-content:center}.mrd-layout-section__modal.sc-mrd-layout-section{position:relative;background:#fff;border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);max-width:min(90vw, 900px);max-height:90vh;display:flex;align-items:center;justify-content:center;box-shadow:var(--mrd-shadow-lg)}.mrd-layout-section__modal-close.sc-mrd-layout-section{position:absolute;top:var(--mrd-space-2);right:var(--mrd-space-2);background:rgba(0, 0, 0, 0.5);border:none;border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;font-size:var(--mrd-font-size-sm);line-height:1;z-index:1}.mrd-layout-section__modal-close.sc-mrd-layout-section:hover{background:rgba(0, 0, 0, 0.8)}.mrd-layout-section__modal-image.sc-mrd-layout-section{display:block;max-width:100%;max-height:calc(90vh - 2rem);border-radius:var(--mrd-border-radius);object-fit:contain}`;
|
|
1359
|
+
const mrdLayoutSectionScss = () => `.mrd-layout-section.sc-mrd-layout-section{font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-800)}.mrd-layout-section__field.sc-mrd-layout-section{display:grid;grid-template-columns:200px 1fr;align-items:baseline;gap:0 var(--mrd-space-2);padding:var(--mrd-space-1) 0}.mrd-layout-section__field-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-normal);color:var(--mrd-color-neutral-500);padding-top:1px}.mrd-layout-section__field-value.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800);word-break:break-word}.mrd-layout-section__field-header.sc-mrd-layout-section{font-size:var(--mrd-font-size-2xl);font-weight:var(--mrd-font-weight-bold);color:var(--mrd-color-neutral-900);margin:0 0 var(--mrd-space-4) 0;padding:0}.mrd-layout-section__header.sc-mrd-layout-section{font-size:var(--mrd-font-size-xl);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:var(--mrd-space-4) 0 var(--mrd-space-2) 0;padding:0}.mrd-layout-section__text.sc-mrd-layout-section{font-size:var(--mrd-font-size-base);color:var(--mrd-color-neutral-700);line-height:var(--mrd-line-height-relaxed);margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2);padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:1px solid var(--mrd-color-neutral-300);border-radius:var(--mrd-border-radius);font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;margin:var(--mrd-space-2) 0}.mrd-layout-section__navigate.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light);border-color:var(--mrd-color-primary)}.mrd-layout-section__link.sc-mrd-layout-section{color:var(--mrd-color-primary);text-decoration:none}.mrd-layout-section__link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__relation-link.sc-mrd-layout-section{background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__relation-link.sc-mrd-layout-section:hover{text-decoration:underline}.mrd-layout-section__download-link.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-1);background:none;border:none;padding:0;font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-sm);color:var(--mrd-color-primary);cursor:pointer;text-align:left}.mrd-layout-section__download-link.sc-mrd-layout-section:hover{text-decoration:underline;color:var(--mrd-color-primary-dark)}.mrd-layout-section__file-icon.sc-mrd-layout-section{flex-shrink:0;width:1rem;height:1rem}.mrd-layout-section__boolean--true.sc-mrd-layout-section{color:var(--mrd-color-success);font-weight:var(--mrd-font-weight-semibold)}.mrd-layout-section__boolean--false.sc-mrd-layout-section{color:var(--mrd-color-neutral-400)}.mrd-layout-section__field--block.sc-mrd-layout-section{grid-template-columns:1fr}.mrd-layout-section__badge.sc-mrd-layout-section{display:inline-block;font-size:var(--mrd-font-size-xs);font-weight:var(--mrd-font-weight-medium);padding:2px var(--mrd-space-3);border-radius:10px}.mrd-layout-section__badge-dot-row.sc-mrd-layout-section{display:inline-flex;align-items:center;gap:var(--mrd-space-2)}.mrd-layout-section__badge-dot.sc-mrd-layout-section{display:inline-block;width:10px;height:10px;border-radius:50%;flex-shrink:0}.mrd-layout-section__pre.sc-mrd-layout-section{font-family:var(--mrd-font-family-mono);font-size:var(--mrd-font-size-xs);background-color:var(--mrd-color-neutral-50);border:1px solid var(--mrd-color-neutral-200);border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);margin:0;max-height:calc(10 * 1.5 * var(--mrd-font-size-xs));overflow-x:auto;overflow-y:auto;white-space:pre-wrap;word-break:break-word}.mrd-layout-section__group.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__group-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-500);margin:0 0 var(--mrd-space-2) 0;padding-bottom:0;text-transform:uppercase;letter-spacing:0.05em}.mrd-layout-section__related-view.sc-mrd-layout-section{margin:var(--mrd-space-4) 0}.mrd-layout-section__related-view-title.sc-mrd-layout-section{font-size:var(--mrd-font-size-lg);font-weight:var(--mrd-font-weight-semibold);color:var(--mrd-color-neutral-800);margin:0 0 var(--mrd-space-3) 0}.mrd-layout-section__search.sc-mrd-layout-section{position:relative;margin:var(--mrd-space-2) 0}.mrd-layout-section__search-wrap.sc-mrd-layout-section{position:relative}.mrd-layout-section__search-icon.sc-mrd-layout-section{position:absolute;left:var(--mrd-input-padding-x);top:50%;transform:translateY(-50%);width:1rem;height:1rem;color:var(--mrd-color-neutral-400);pointer-events:none}.mrd-layout-section__search-input.sc-mrd-layout-section{display:block;width:100%;height:var(--mrd-input-height);padding:var(--mrd-input-padding-y) var(--mrd-input-padding-x) var(--mrd-input-padding-y) calc(var(--mrd-input-padding-x) + 1rem + var(--mrd-space-2));font-family:var(--mrd-font-family);font-size:var(--mrd-font-size-base);color:var(--mrd-input-color);background-color:var(--mrd-input-bg);border:var(--mrd-border-width) solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);outline:none;appearance:none;box-sizing:border-box}.mrd-layout-section__search-input.sc-mrd-layout-section:focus{border-color:var(--mrd-border-color-focus);box-shadow:var(--mrd-shadow-focus)}.mrd-layout-section__search-input.sc-mrd-layout-section::placeholder{color:var(--mrd-input-placeholder-color)}.mrd-layout-section__search-results.sc-mrd-layout-section{position:absolute;top:100%;left:0;right:0;background-color:var(--mrd-color-white);border:1px solid var(--mrd-color-neutral-300);border-top:none;border-radius:0 0 var(--mrd-border-radius) var(--mrd-border-radius);box-shadow:var(--mrd-shadow-sm);z-index:100;max-height:300px;overflow-y:auto;list-style:none;margin:0;padding:var(--mrd-space-1) 0}.mrd-layout-section__search-result.sc-mrd-layout-section{margin:0;padding:0}.mrd-layout-section__search-result-btn.sc-mrd-layout-section{display:flex;flex-direction:column;width:100%;padding:var(--mrd-space-2) var(--mrd-space-3);background:none;border:none;text-align:left;cursor:pointer;font-family:var(--mrd-font-family)}.mrd-layout-section__search-result-btn.sc-mrd-layout-section:hover{background-color:var(--mrd-color-primary-light)}.mrd-layout-section__search-result-label.sc-mrd-layout-section{font-size:var(--mrd-font-size-sm);font-weight:var(--mrd-font-weight-medium);color:var(--mrd-color-neutral-800)}.mrd-layout-section__search-result-desc.sc-mrd-layout-section{font-size:var(--mrd-font-size-xs);color:var(--mrd-color-neutral-500);margin-top:var(--mrd-space-1)}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section{background:none;border:none;padding:0;cursor:pointer;display:inline-block;border-radius:var(--mrd-border-radius);overflow:hidden;line-height:0}.mrd-layout-section__image-thumb-btn.sc-mrd-layout-section:hover .mrd-layout-section__image-thumb.sc-mrd-layout-section{opacity:0.85}.mrd-layout-section__image-thumb.sc-mrd-layout-section{display:block;max-width:160px;max-height:100px;border-radius:var(--mrd-border-radius);object-fit:cover;transition:opacity 0.15s}.mrd-layout-section__modal-backdrop.sc-mrd-layout-section{position:fixed;inset:0;background:rgba(0, 0, 0, 0.6);z-index:300;display:flex;align-items:center;justify-content:center}.mrd-layout-section__modal.sc-mrd-layout-section{position:relative;background:#fff;border-radius:var(--mrd-border-radius);padding:var(--mrd-space-3);max-width:min(90vw, 900px);max-height:90vh;display:flex;align-items:center;justify-content:center;box-shadow:var(--mrd-shadow-lg)}.mrd-layout-section__modal-close.sc-mrd-layout-section{position:absolute;top:var(--mrd-space-2);right:var(--mrd-space-2);background:rgba(0, 0, 0, 0.5);border:none;border-radius:50%;width:28px;height:28px;display:flex;align-items:center;justify-content:center;color:#fff;cursor:pointer;font-size:var(--mrd-font-size-sm);line-height:1;z-index:1}.mrd-layout-section__modal-close.sc-mrd-layout-section:hover{background:rgba(0, 0, 0, 0.8)}.mrd-layout-section__modal-image.sc-mrd-layout-section{display:block;max-width:100%;max-height:calc(90vh - 2rem);border-radius:var(--mrd-border-radius);object-fit:contain}`;
|
|
1368
1360
|
|
|
1369
1361
|
const MrdLayoutSection = class {
|
|
1370
1362
|
constructor(hostRef) {
|
|
@@ -1446,34 +1438,32 @@ const MrdLayoutSection = class {
|
|
|
1446
1438
|
});
|
|
1447
1439
|
}
|
|
1448
1440
|
emitLoadViews() {
|
|
1449
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1441
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1450
1442
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1451
1443
|
for (const item of this.flattenItems(this.items)) {
|
|
1452
|
-
if (item.type === ClientLayoutItemType.RELATED_VIEW && item.
|
|
1453
|
-
const
|
|
1454
|
-
const viewConfig = this.views[rv.name];
|
|
1444
|
+
if (item.type === ClientLayoutItemType.RELATED_VIEW && item.name) {
|
|
1445
|
+
const viewConfig = this.views[item.name];
|
|
1455
1446
|
if (!viewConfig)
|
|
1456
1447
|
continue;
|
|
1457
|
-
const href = (
|
|
1458
|
-
this.mrdLoadView.emit({ name:
|
|
1448
|
+
const href = (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href;
|
|
1449
|
+
this.mrdLoadView.emit({ name: item.name, href, viewConfig, sort: (_e = viewConfig.defaultSort) !== null && _e !== void 0 ? _e : '', filters: this.resolveViewFilters(viewConfig) });
|
|
1459
1450
|
}
|
|
1460
1451
|
else if (item.type === ClientLayoutItemType.VIEW) {
|
|
1461
|
-
const viewName =
|
|
1452
|
+
const viewName = item.name;
|
|
1462
1453
|
if (!viewName)
|
|
1463
1454
|
continue;
|
|
1464
1455
|
const viewConfig = this.views[viewName];
|
|
1465
1456
|
if (!viewConfig)
|
|
1466
1457
|
continue;
|
|
1467
|
-
const href = (
|
|
1468
|
-
this.mrdLoadView.emit({ name: viewName, href, viewConfig, sort: (
|
|
1458
|
+
const href = (_f = this.links[viewName]) === null || _f === void 0 ? void 0 : _f.href;
|
|
1459
|
+
this.mrdLoadView.emit({ name: viewName, href, viewConfig, sort: (_g = viewConfig.defaultSort) !== null && _g !== void 0 ? _g : '', filters: this.resolveViewFilters(viewConfig) });
|
|
1469
1460
|
}
|
|
1470
1461
|
}
|
|
1471
1462
|
}
|
|
1472
1463
|
emitLoadImages() {
|
|
1473
|
-
var _a;
|
|
1474
1464
|
for (const item of this.flattenItems(this.items)) {
|
|
1475
|
-
if (item.type === ClientLayoutItemType.FIELD &&
|
|
1476
|
-
const fieldName = item.
|
|
1465
|
+
if (item.type === ClientLayoutItemType.FIELD && item.dataType === ClientLayoutItemFieldDataType.IMAGE) {
|
|
1466
|
+
const fieldName = item.name;
|
|
1477
1467
|
const raw = this.data[fieldName];
|
|
1478
1468
|
const href = raw === null || raw === void 0 ? void 0 : raw.href;
|
|
1479
1469
|
if (href)
|
|
@@ -1531,15 +1521,15 @@ const MrdLayoutSection = class {
|
|
|
1531
1521
|
this.imagePreviewUrl = url;
|
|
1532
1522
|
}
|
|
1533
1523
|
resolveSearchKey() {
|
|
1524
|
+
var _a;
|
|
1534
1525
|
const items = this.flattenItems(this.items).filter(i => i.type === ClientLayoutItemType.SEARCH);
|
|
1535
|
-
if (items.length === 1
|
|
1536
|
-
return items[0].
|
|
1526
|
+
if (items.length === 1)
|
|
1527
|
+
return (_a = items[0].dataClass) !== null && _a !== void 0 ? _a : null;
|
|
1537
1528
|
return null;
|
|
1538
1529
|
}
|
|
1539
1530
|
renderSingleFieldValue(item, value) {
|
|
1540
1531
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1541
|
-
const
|
|
1542
|
-
const dt = field.dataType;
|
|
1532
|
+
const dt = item.dataType;
|
|
1543
1533
|
switch (dt) {
|
|
1544
1534
|
case ClientLayoutItemFieldDataType.HYPERLINK: {
|
|
1545
1535
|
const v = value;
|
|
@@ -1563,7 +1553,7 @@ const MrdLayoutSection = class {
|
|
|
1563
1553
|
const v = value;
|
|
1564
1554
|
const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
|
|
1565
1555
|
const fileName = (_g = v === null || v === void 0 ? void 0 : v.fileName) !== null && _g !== void 0 ? _g : '';
|
|
1566
|
-
const previewUrl = this.imagePreviews[
|
|
1556
|
+
const previewUrl = this.imagePreviews[item.name];
|
|
1567
1557
|
if (previewUrl) {
|
|
1568
1558
|
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 })));
|
|
1569
1559
|
}
|
|
@@ -1572,7 +1562,7 @@ const MrdLayoutSection = class {
|
|
|
1572
1562
|
case ClientLayoutItemFieldDataType.BOOLEAN:
|
|
1573
1563
|
return (h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', this.locale) : t('no', this.locale)));
|
|
1574
1564
|
case ClientLayoutItemFieldDataType.LIST: {
|
|
1575
|
-
const listItem = ((_h =
|
|
1565
|
+
const listItem = ((_h = item.listItems) !== null && _h !== void 0 ? _h : []).find(li => li.key === String(value));
|
|
1576
1566
|
const label = (_j = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _j !== void 0 ? _j : String(value);
|
|
1577
1567
|
const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
|
|
1578
1568
|
const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
|
|
@@ -1585,7 +1575,7 @@ const MrdLayoutSection = class {
|
|
|
1585
1575
|
return label;
|
|
1586
1576
|
}
|
|
1587
1577
|
default: {
|
|
1588
|
-
const text = CellRenderer.renderValue(dt, value, (_k =
|
|
1578
|
+
const text = CellRenderer.renderValue(dt, value, (_k = item.listItems) !== null && _k !== void 0 ? _k : [], this.locale);
|
|
1589
1579
|
return text || null;
|
|
1590
1580
|
}
|
|
1591
1581
|
}
|
|
@@ -1593,8 +1583,7 @@ const MrdLayoutSection = class {
|
|
|
1593
1583
|
renderFieldValue(item, rawValue) {
|
|
1594
1584
|
if (rawValue == null || rawValue === '')
|
|
1595
1585
|
return null;
|
|
1596
|
-
|
|
1597
|
-
if (field.multiple && Array.isArray(rawValue)) {
|
|
1586
|
+
if (item.multiple && Array.isArray(rawValue)) {
|
|
1598
1587
|
const rendered = rawValue.map(v => this.renderSingleFieldValue(item, v));
|
|
1599
1588
|
if (rendered.every(r => typeof r === 'string' || r == null)) {
|
|
1600
1589
|
return rendered.filter(Boolean).join(', ') || null;
|
|
@@ -1604,27 +1593,26 @@ const MrdLayoutSection = class {
|
|
|
1604
1593
|
return this.renderSingleFieldValue(item, rawValue);
|
|
1605
1594
|
}
|
|
1606
1595
|
renderField(item) {
|
|
1607
|
-
if (!item.
|
|
1596
|
+
if (!item.name)
|
|
1608
1597
|
return null;
|
|
1609
|
-
const
|
|
1610
|
-
const rawValue = this.data[field.name];
|
|
1598
|
+
const rawValue = this.data[item.name];
|
|
1611
1599
|
const renderedValue = this.renderFieldValue(item, rawValue);
|
|
1612
|
-
if (
|
|
1613
|
-
return (h("h1", { class: "mrd-layout-section__field-header", key:
|
|
1600
|
+
if (item.header) {
|
|
1601
|
+
return (h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
1614
1602
|
}
|
|
1615
1603
|
if (renderedValue == null)
|
|
1616
1604
|
return null;
|
|
1617
|
-
const isBlock =
|
|
1618
|
-
||
|
|
1619
|
-
||
|
|
1620
|
-
return (h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key:
|
|
1605
|
+
const isBlock = item.dataType === ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
1606
|
+
|| item.dataType === ClientLayoutItemFieldDataType.LONGTEXT
|
|
1607
|
+
|| item.dataType === ClientLayoutItemFieldDataType.JSON;
|
|
1608
|
+
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)));
|
|
1621
1609
|
}
|
|
1622
1610
|
renderRelation(item) {
|
|
1623
1611
|
var _a, _b, _c;
|
|
1624
|
-
if (!item.
|
|
1612
|
+
if (!item.name)
|
|
1625
1613
|
return null;
|
|
1626
1614
|
const links = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1627
|
-
const link = links[item.
|
|
1615
|
+
const link = links[item.name];
|
|
1628
1616
|
if (!link)
|
|
1629
1617
|
return null;
|
|
1630
1618
|
const makeBtn = (href, name) => (h("button", { key: href, class: "mrd-layout-section__relation-link", onClick: () => this.mrdNavigate.emit({ href, label: name }) }, name));
|
|
@@ -1637,41 +1625,36 @@ const MrdLayoutSection = class {
|
|
|
1637
1625
|
}
|
|
1638
1626
|
if (!valueContent)
|
|
1639
1627
|
return null;
|
|
1640
|
-
return (h("div", { class: "mrd-layout-section__field", key: item.
|
|
1628
|
+
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)));
|
|
1641
1629
|
}
|
|
1642
1630
|
renderSearch(item) {
|
|
1643
1631
|
var _a, _b, _c;
|
|
1644
|
-
if (!item.
|
|
1632
|
+
if (!item.dataClass)
|
|
1645
1633
|
return null;
|
|
1646
|
-
const dataClass = item.
|
|
1634
|
+
const dataClass = item.dataClass;
|
|
1647
1635
|
const query = (_a = this.searchQueryMap[dataClass]) !== null && _a !== void 0 ? _a : '';
|
|
1648
1636
|
const results = (_b = this.searchResultsMap[dataClass]) !== null && _b !== void 0 ? _b : [];
|
|
1649
|
-
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)))))))));
|
|
1637
|
+
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)))))))));
|
|
1650
1638
|
}
|
|
1651
1639
|
renderRelatedView(item) {
|
|
1652
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
1640
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1653
1641
|
const isRelated = item.type === ClientLayoutItemType.RELATED_VIEW;
|
|
1654
|
-
|
|
1655
|
-
const name = isRelated
|
|
1656
|
-
? (_a = item.relatedView) === null || _a === void 0 ? void 0 : _a.name
|
|
1657
|
-
: ((_c = (_b = item.view) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : item.name);
|
|
1642
|
+
const name = item.name;
|
|
1658
1643
|
if (!name)
|
|
1659
1644
|
return null;
|
|
1660
1645
|
const viewConfig = this.views[name];
|
|
1661
1646
|
if (!viewConfig)
|
|
1662
1647
|
return null;
|
|
1663
|
-
const showTitle =
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
const activeName = (_h = this.activeViewMap[name]) !== null && _h !== void 0 ? _h : name;
|
|
1667
|
-
const activeViewConfig = (_j = this.views[activeName]) !== null && _j !== void 0 ? _j : viewConfig;
|
|
1648
|
+
const showTitle = (_a = item.showTitle) !== null && _a !== void 0 ? _a : false;
|
|
1649
|
+
const activeName = (_b = this.activeViewMap[name]) !== null && _b !== void 0 ? _b : name;
|
|
1650
|
+
const activeViewConfig = (_c = this.views[activeName]) !== null && _c !== void 0 ? _c : viewConfig;
|
|
1668
1651
|
// Build the full view list (original + alternatives) so the switcher can always go back.
|
|
1669
|
-
const originalLabel = (
|
|
1670
|
-
const allViews = [{ name, label: originalLabel }, ...((
|
|
1652
|
+
const originalLabel = (_f = (_e = (_d = viewConfig.pluralLabel) !== null && _d !== void 0 ? _d : viewConfig.singularLabel) !== null && _e !== void 0 ? _e : item.label) !== null && _f !== void 0 ? _f : name;
|
|
1653
|
+
const allViews = [{ name, label: originalLabel }, ...((_g = item.alternativeViews) !== null && _g !== void 0 ? _g : [])];
|
|
1671
1654
|
const activeEntry = allViews.find(v => v.name === activeName);
|
|
1672
|
-
const viewLabel = (
|
|
1655
|
+
const viewLabel = (_k = (_j = (_h = activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.label) !== null && _h !== void 0 ? _h : activeViewConfig.pluralLabel) !== null && _j !== void 0 ? _j : activeViewConfig.singularLabel) !== null && _k !== void 0 ? _k : '';
|
|
1673
1656
|
const altViews = allViews.filter(v => v.name !== activeName);
|
|
1674
|
-
const rawActions = (
|
|
1657
|
+
const rawActions = (_l = item.actions) !== null && _l !== void 0 ? _l : ['NEW', 'EXPORT'];
|
|
1675
1658
|
const tableActions = rawActions.reduce((acc, a) => {
|
|
1676
1659
|
if (a === 'NEW')
|
|
1677
1660
|
acc.push({ action: 'create', label: t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary' });
|
|
@@ -1679,8 +1662,8 @@ const MrdLayoutSection = class {
|
|
|
1679
1662
|
acc.push({ action: 'export', label: t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
|
|
1680
1663
|
return acc;
|
|
1681
1664
|
}, []);
|
|
1682
|
-
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: (
|
|
1683
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1665
|
+
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: (_m = activeViewConfig.defaultSort) !== null && _m !== void 0 ? _m : '', viewLabel: viewLabel, alternativeViews: altViews, actions: tableActions, onMrdLoadPage: (e) => this.handleViewLoadPage(e, name), onMrdSwitchView: (e) => {
|
|
1666
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1684
1667
|
e.stopPropagation();
|
|
1685
1668
|
const newViewName = e.detail.name;
|
|
1686
1669
|
const newViewConfig = this.views[newViewName];
|
|
@@ -1690,20 +1673,20 @@ const MrdLayoutSection = class {
|
|
|
1690
1673
|
this.activeFiltersMap = Object.assign(Object.assign({}, this.activeFiltersMap), { [name]: [] });
|
|
1691
1674
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1692
1675
|
const href = isRelated
|
|
1693
|
-
? (
|
|
1694
|
-
: ((
|
|
1695
|
-
this.mrdLoadView.emit({ name, href, viewConfig: newViewConfig, sort: (
|
|
1676
|
+
? (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href
|
|
1677
|
+
: ((_f = (_e = this.links[newViewName]) === 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);
|
|
1678
|
+
this.mrdLoadView.emit({ name, href, viewConfig: newViewConfig, sort: (_h = newViewConfig.defaultSort) !== null && _h !== void 0 ? _h : '', filters: this.resolveViewFilters(newViewConfig) });
|
|
1696
1679
|
}, onMrdFilter: (e) => {
|
|
1697
1680
|
e.stopPropagation();
|
|
1698
1681
|
this.activeFiltersMap = Object.assign(Object.assign({}, this.activeFiltersMap), { [name]: e.detail.filters });
|
|
1699
1682
|
}, onMrdLoadAggregations: (e) => {
|
|
1700
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1683
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1701
1684
|
e.stopPropagation();
|
|
1702
1685
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1703
1686
|
const href = isRelated
|
|
1704
|
-
? (
|
|
1705
|
-
: ((
|
|
1706
|
-
const filters = (
|
|
1687
|
+
? (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href
|
|
1688
|
+
: ((_g = (_f = this.links[(_e = this.activeViewMap[name]) !== null && _e !== void 0 ? _e : name]) === null || _f === void 0 ? void 0 : _f.href) !== null && _g !== void 0 ? _g : (_h = this.links[name]) === null || _h === void 0 ? void 0 : _h.href);
|
|
1689
|
+
const filters = (_j = this.activeFiltersMap[name]) !== null && _j !== void 0 ? _j : [];
|
|
1707
1690
|
this.mrdLoadViewAggregations.emit(Object.assign({ name, href, filters }, e.detail));
|
|
1708
1691
|
}, onMrdAction: (e) => {
|
|
1709
1692
|
var _a, _b, _c;
|
|
@@ -1725,7 +1708,7 @@ const MrdLayoutSection = class {
|
|
|
1725
1708
|
case ClientLayoutItemType.TEXT:
|
|
1726
1709
|
return h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
|
|
1727
1710
|
case ClientLayoutItemType.NAVIGATE:
|
|
1728
|
-
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));
|
|
1711
|
+
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));
|
|
1729
1712
|
case ClientLayoutItemType.SEARCH:
|
|
1730
1713
|
return this.renderSearch(item);
|
|
1731
1714
|
case ClientLayoutItemType.SECTION:
|
|
@@ -1744,7 +1727,7 @@ const MrdLayoutSection = class {
|
|
|
1744
1727
|
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: "" }))));
|
|
1745
1728
|
}
|
|
1746
1729
|
render() {
|
|
1747
|
-
return (h(Host, { key: '
|
|
1730
|
+
return (h(Host, { key: '7a91a541e056965dc79d74a50827e8c270c33a0d' }, h("div", { key: 'bcf4a2e81e704d136fb437cd2cb22acb4a05a8b3', class: "mrd-layout-section" }, this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
1748
1731
|
}
|
|
1749
1732
|
get el() { return getElement(this); }
|
|
1750
1733
|
static get watchers() { return {
|
|
@@ -2209,7 +2192,7 @@ const NUMERIC_TYPES = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
|
|
|
2209
2192
|
const DATE_TYPES = new Set(['DATE', 'DATETIME', 'TIME']);
|
|
2210
2193
|
const NO_FILTER_TYPES = new Set(['FILE', 'IMAGE']);
|
|
2211
2194
|
/** Column types that cannot be sorted or filtered (not stored in PostgreSQL). */
|
|
2212
|
-
const NON_INTERACTIVE_TYPES = new Set(['LONGTEXT', 'JSON']);
|
|
2195
|
+
const NON_INTERACTIVE_TYPES = new Set(['LONGTEXT', 'JSON', 'FILE', 'IMAGE']);
|
|
2213
2196
|
const MrdTable = class {
|
|
2214
2197
|
constructor(hostRef) {
|
|
2215
2198
|
registerInstance(this, hostRef);
|
|
@@ -2389,25 +2372,25 @@ const MrdTable = class {
|
|
|
2389
2372
|
return this.sortDir === 'desc' ? `${this.sortField},desc` : this.sortField;
|
|
2390
2373
|
}
|
|
2391
2374
|
colName(col) {
|
|
2392
|
-
var _a
|
|
2393
|
-
return (
|
|
2375
|
+
var _a;
|
|
2376
|
+
return (_a = col.name) !== null && _a !== void 0 ? _a : '';
|
|
2394
2377
|
}
|
|
2395
2378
|
colDataType(col) {
|
|
2396
|
-
var _a
|
|
2379
|
+
var _a;
|
|
2397
2380
|
if (col.type === 'RELATION')
|
|
2398
2381
|
return 'RELATION';
|
|
2399
|
-
return (
|
|
2382
|
+
return (_a = col.dataType) !== null && _a !== void 0 ? _a : 'TEXT';
|
|
2400
2383
|
}
|
|
2401
2384
|
// ── Aggregation helpers ────────────────────────────────────────────────────
|
|
2402
2385
|
buildAggregationParams() {
|
|
2403
2386
|
var _a;
|
|
2404
2387
|
const groups = { sum: [], avg: [], count: [] };
|
|
2405
2388
|
for (const col of this.columns) {
|
|
2406
|
-
if (col.type !== 'FIELD' || !
|
|
2389
|
+
if (col.type !== 'FIELD' || !col.aggregate)
|
|
2407
2390
|
continue;
|
|
2408
|
-
const fn = col.
|
|
2391
|
+
const fn = col.aggregate.toLowerCase();
|
|
2409
2392
|
if (fn in groups)
|
|
2410
|
-
groups[fn].push(col.
|
|
2393
|
+
groups[fn].push((_a = col.name) !== null && _a !== void 0 ? _a : '');
|
|
2411
2394
|
}
|
|
2412
2395
|
const params = {};
|
|
2413
2396
|
if (groups.sum.length)
|
|
@@ -2425,19 +2408,19 @@ const MrdTable = class {
|
|
|
2425
2408
|
}
|
|
2426
2409
|
renderAggregationValue(col) {
|
|
2427
2410
|
var _a, _b;
|
|
2428
|
-
if (col.type !== 'FIELD' || !
|
|
2411
|
+
if (col.type !== 'FIELD' || !col.aggregate || !this.aggregations)
|
|
2429
2412
|
return '';
|
|
2430
|
-
const fn = col.
|
|
2431
|
-
const val = (
|
|
2413
|
+
const fn = col.aggregate.toLowerCase();
|
|
2414
|
+
const val = (_a = this.aggregations[fn]) === null || _a === void 0 ? void 0 : _a[(_b = col.name) !== null && _b !== void 0 ? _b : ''];
|
|
2432
2415
|
if (val == null)
|
|
2433
2416
|
return '';
|
|
2434
|
-
const dt = col.
|
|
2417
|
+
const dt = col.dataType;
|
|
2435
2418
|
if (dt === 'INTEGER')
|
|
2436
2419
|
return formatNumber(val, this.locale, { maximumFractionDigits: 0 });
|
|
2437
2420
|
if (dt === 'PERCENTAGE')
|
|
2438
2421
|
return formatPercentage(val, this.locale);
|
|
2439
|
-
if (dt === 'CURRENCY' && col.
|
|
2440
|
-
return formatCurrency(val, col.
|
|
2422
|
+
if (dt === 'CURRENCY' && col.currencyCode)
|
|
2423
|
+
return formatCurrency(val, col.currencyCode, this.locale);
|
|
2441
2424
|
return formatNumber(val, this.locale);
|
|
2442
2425
|
}
|
|
2443
2426
|
// ── Reset pagination ───────────────────────────────────────────────────────
|
|
@@ -2782,7 +2765,7 @@ const MrdTable = class {
|
|
|
2782
2765
|
}
|
|
2783
2766
|
// ── Render: filter popup ───────────────────────────────────────────────────
|
|
2784
2767
|
renderFilterEditor(col) {
|
|
2785
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
2768
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2786
2769
|
const pf = (_a = this.pendingFilter) !== null && _a !== void 0 ? _a : {};
|
|
2787
2770
|
const dataType = this.colDataType(col);
|
|
2788
2771
|
if (NO_FILTER_TYPES.has(dataType)) {
|
|
@@ -2798,19 +2781,19 @@ const MrdTable = class {
|
|
|
2798
2781
|
].map(opt => (h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `bf-${this.openFilterCol}`, checked: !noValueOp && pf.value === opt.value, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: undefined, value: opt.value }); } }), t(opt.labelKey, this.locale)))), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `bf-${this.openFilterCol}`, checked: boolOp === 'isEmpty', onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: 'isEmpty', value: undefined }); } }), t('filter_is_empty', this.locale)), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `bf-${this.openFilterCol}`, checked: boolOp === 'isNotEmpty', onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: 'isNotEmpty', value: undefined }); } }), t('filter_is_not_empty', this.locale))));
|
|
2799
2782
|
}
|
|
2800
2783
|
if (dataType === 'LIST') {
|
|
2801
|
-
const items = (
|
|
2802
|
-
const selected = (
|
|
2784
|
+
const items = (_b = col.listItems) !== null && _b !== void 0 ? _b : [];
|
|
2785
|
+
const selected = (_c = pf.values) !== null && _c !== void 0 ? _c : [];
|
|
2803
2786
|
return (h("div", { class: "mrd-table__filter-list" }, h("div", { class: "mrd-table__filter-list-controls" }, h("button", { class: "mrd-table__filter-list-btn", onClick: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { values: items.map(i => i.key) }); } }, t('filter_select_all', this.locale)), h("button", { class: "mrd-table__filter-list-btn", onClick: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { values: [] }); } }, t('filter_select_none', this.locale))), items.map(item => (h("label", { class: "mrd-table__filter-checkbox-label" }, h("input", { type: "checkbox", checked: selected.includes(item.key), onChange: (e) => this.togglePendingValue(item.key, e.target.checked) }), item.label)))));
|
|
2804
2787
|
}
|
|
2805
2788
|
if (TEXT_TYPES.has(dataType) || dataType === 'RELATION') {
|
|
2806
|
-
const op = (
|
|
2789
|
+
const op = (_d = pf.operator) !== null && _d !== void 0 ? _d : 'startsWith';
|
|
2807
2790
|
const noInput = op === 'isEmpty' || op === 'isNotEmpty';
|
|
2808
2791
|
return (h("div", { class: "mrd-table__filter-editor" }, h("select", { class: "mrd-table__filter-select", onChange: (e) => this.setPending('operator', e.target.value) }, [
|
|
2809
2792
|
{ val: 'startsWith', labelKey: 'filter_starts_with' },
|
|
2810
2793
|
{ val: 'equals', labelKey: 'filter_equals' },
|
|
2811
2794
|
{ val: 'isEmpty', labelKey: 'filter_is_empty' },
|
|
2812
2795
|
{ val: 'isNotEmpty', labelKey: 'filter_is_not_empty' },
|
|
2813
|
-
].map(o => h("option", { value: o.val, selected: op === o.val }, t(o.labelKey, this.locale)))), !noInput && (h("input", { type: "text", class: "mrd-table__filter-input", value: String((
|
|
2796
|
+
].map(o => h("option", { value: o.val, selected: op === o.val }, t(o.labelKey, this.locale)))), !noInput && (h("input", { type: "text", class: "mrd-table__filter-input", value: String((_e = pf.value) !== null && _e !== void 0 ? _e : ''), placeholder: t('filter_search_value', this.locale), onInput: (e) => this.setPending('value', e.target.value) }))));
|
|
2814
2797
|
}
|
|
2815
2798
|
if (NUMERIC_TYPES.has(dataType)) {
|
|
2816
2799
|
const numOp = pf.operator;
|
|
@@ -2838,7 +2821,7 @@ const MrdTable = class {
|
|
|
2838
2821
|
else {
|
|
2839
2822
|
this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: undefined });
|
|
2840
2823
|
}
|
|
2841
|
-
} }, h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), h("option", { value: "isEmpty", selected: dtOp === 'isEmpty' }, t('filter_is_empty', this.locale)), h("option", { value: "isNotEmpty", selected: dtOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (h("div", { class: "mrd-table__filter-editor" }, h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: !rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { from: undefined, to: undefined }); } }), t('filter_exact', this.locale)), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { value: undefined, from: null, to: null }); } }), t('filter_range', this.locale))), !rangeMode ? (h("input", { type: "date", class: "mrd-table__filter-input", value: String((
|
|
2824
|
+
} }, h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), h("option", { value: "isEmpty", selected: dtOp === 'isEmpty' }, t('filter_is_empty', this.locale)), h("option", { value: "isNotEmpty", selected: dtOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (h("div", { class: "mrd-table__filter-editor" }, h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: !rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { from: undefined, to: undefined }); } }), t('filter_exact', this.locale)), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { value: undefined, from: null, to: null }); } }), t('filter_range', this.locale))), !rangeMode ? (h("input", { type: "date", class: "mrd-table__filter-input", value: String((_f = pf.value) !== null && _f !== void 0 ? _f : ''), onInput: (e) => this.setPending('value', e.target.value) })) : (h("div", { class: "mrd-table__filter-range mrd-table__filter-range--stacked" }, h("label", { class: "mrd-table__filter-range-label" }, t('filter_from', this.locale)), h("input", { type: "date", class: "mrd-table__filter-input", value: pf.from != null ? String(pf.from) : '', onInput: (e) => this.setPending('from', e.target.value) }), h("label", { class: "mrd-table__filter-range-label" }, t('filter_to', this.locale)), h("input", { type: "date", class: "mrd-table__filter-input", value: pf.to != null ? String(pf.to) : '', onInput: (e) => this.setPending('to', e.target.value) })))))));
|
|
2842
2825
|
}
|
|
2843
2826
|
if (DATE_TYPES.has(dataType)) {
|
|
2844
2827
|
const inputType = dataType === 'DATE' ? 'date' : 'time';
|
|
@@ -2853,18 +2836,18 @@ const MrdTable = class {
|
|
|
2853
2836
|
else {
|
|
2854
2837
|
this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: undefined });
|
|
2855
2838
|
}
|
|
2856
|
-
} }, h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), h("option", { value: "isEmpty", selected: dtdOp === 'isEmpty' }, t('filter_is_empty', this.locale)), h("option", { value: "isNotEmpty", selected: dtdOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (h("div", { class: "mrd-table__filter-editor" }, h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: !rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { from: undefined, to: undefined }); } }), t('filter_exact', this.locale)), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { value: undefined, from: null, to: null }); } }), t('filter_range', this.locale))), !rangeMode ? (h("input", { type: inputType, class: "mrd-table__filter-input", value: String((
|
|
2839
|
+
} }, h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), h("option", { value: "isEmpty", selected: dtdOp === 'isEmpty' }, t('filter_is_empty', this.locale)), h("option", { value: "isNotEmpty", selected: dtdOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (h("div", { class: "mrd-table__filter-editor" }, h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: !rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { from: undefined, to: undefined }); } }), t('filter_exact', this.locale)), h("label", { class: "mrd-table__filter-radio-label" }, h("input", { type: "radio", name: `dt-${this.openFilterCol}`, checked: rangeMode, onChange: () => { this.pendingFilter = Object.assign(Object.assign({}, pf), { value: undefined, from: null, to: null }); } }), t('filter_range', this.locale))), !rangeMode ? (h("input", { type: inputType, class: "mrd-table__filter-input", value: String((_g = pf.value) !== null && _g !== void 0 ? _g : ''), onInput: (e) => this.setPending('value', e.target.value) })) : (h("div", { class: "mrd-table__filter-range" }, h("input", { type: inputType, class: "mrd-table__filter-input", placeholder: t('filter_from', this.locale), value: pf.from != null ? String(pf.from) : '', onInput: (e) => this.setPending('from', e.target.value) }), h("input", { type: inputType, class: "mrd-table__filter-input", placeholder: t('filter_to', this.locale), value: pf.to != null ? String(pf.to) : '', onInput: (e) => this.setPending('to', e.target.value) })))))));
|
|
2857
2840
|
}
|
|
2858
2841
|
return null;
|
|
2859
2842
|
}
|
|
2860
2843
|
renderFilterPopup() {
|
|
2861
|
-
var _a
|
|
2844
|
+
var _a;
|
|
2862
2845
|
if (!this.openFilterCol || !this.pendingFilter)
|
|
2863
2846
|
return null;
|
|
2864
2847
|
const col = this.columns.find(c => this.colName(c) === this.openFilterCol);
|
|
2865
2848
|
if (!col)
|
|
2866
2849
|
return null;
|
|
2867
|
-
const label = (
|
|
2850
|
+
const label = (_a = col.label) !== null && _a !== void 0 ? _a : this.openFilterCol;
|
|
2868
2851
|
const sortActive = this.sortField === this.openFilterCol;
|
|
2869
2852
|
return (h("div", { class: "mrd-table__filter-popup", style: { top: `${this.popupPos.top}px`, left: `${this.popupPos.left}px` }, onClick: (e) => e.stopPropagation() }, h("div", { class: "mrd-table__filter-popup-header" }, h("span", { class: "mrd-table__filter-popup-title" }, label), h("button", { class: "mrd-table__filter-close", onClick: () => this.closeFilterPopup() }, "\u2715")), h("div", { class: "mrd-table__filter-section" }, h("div", { class: "mrd-table__filter-section-label" }, t('filter_sorting', this.locale)), h("div", { class: "mrd-table__filter-sort-buttons" }, h("button", { class: `mrd-table__filter-sort-btn${sortActive && this.sortDir === 'asc' ? ' mrd-table__filter-sort-btn--active' : ''}`, onClick: () => this.applySort(col, 'asc') }, "\u25B2 ", t('filter_ascending', this.locale)), h("button", { class: `mrd-table__filter-sort-btn${sortActive && this.sortDir === 'desc' ? ' mrd-table__filter-sort-btn--active' : ''}`, onClick: () => this.applySort(col, 'desc') }, "\u25BC ", t('filter_descending', this.locale)))), h("div", { class: "mrd-table__filter-divider" }), h("div", { class: "mrd-table__filter-section" }, h("div", { class: "mrd-table__filter-section-label" }, t('filter_section', this.locale)), this.renderFilterEditor(col)), h("div", { class: "mrd-table__filter-popup-footer" }, h("button", { class: "mrd-table__filter-btn mrd-table__filter-btn--clear", onClick: () => this.clearFilter() }, t('filter_clear', this.locale)), h("button", { class: "mrd-table__filter-btn mrd-table__filter-btn--apply", onClick: () => this.applyFilter() }, t('filter_apply', this.locale)))));
|
|
2870
2853
|
}
|
|
@@ -2891,13 +2874,13 @@ const MrdTable = class {
|
|
|
2891
2874
|
}
|
|
2892
2875
|
// ── Render: cell ──────────────────────────────────────────────────────────
|
|
2893
2876
|
renderCell(col, row) {
|
|
2894
|
-
var _a, _b, _c
|
|
2877
|
+
var _a, _b, _c;
|
|
2895
2878
|
const numericTypes = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
|
|
2896
|
-
const dataType = (
|
|
2879
|
+
const dataType = (_a = col.dataType) !== null && _a !== void 0 ? _a : '';
|
|
2897
2880
|
const isNumeric = col.type === 'FIELD' && numericTypes.has(dataType);
|
|
2898
2881
|
const isFile = col.type === 'FIELD' && (dataType === 'FILE' || dataType === 'IMAGE');
|
|
2899
2882
|
if (isFile) {
|
|
2900
|
-
const name = (
|
|
2883
|
+
const name = (_b = col.name) !== null && _b !== void 0 ? _b : '';
|
|
2901
2884
|
const fileVal = row === null || row === void 0 ? void 0 : row[name];
|
|
2902
2885
|
const href = fileVal === null || fileVal === void 0 ? void 0 : fileVal.href;
|
|
2903
2886
|
const fileName = fileVal === null || fileVal === void 0 ? void 0 : fileVal.fileName;
|
|
@@ -2907,7 +2890,7 @@ const MrdTable = class {
|
|
|
2907
2890
|
} }, h("svg", { class: "mrd-table__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))) : ''));
|
|
2908
2891
|
}
|
|
2909
2892
|
if (dataType === 'JSON') {
|
|
2910
|
-
const name = (
|
|
2893
|
+
const name = (_c = col.name) !== null && _c !== void 0 ? _c : '';
|
|
2911
2894
|
const rawValue = name ? row === null || row === void 0 ? void 0 : row[name] : undefined;
|
|
2912
2895
|
if (rawValue == null || rawValue === '')
|
|
2913
2896
|
return h("td", { class: "mrd-table__cell" });
|
|
@@ -2931,12 +2914,12 @@ const MrdTable = class {
|
|
|
2931
2914
|
renderTotalsRow() {
|
|
2932
2915
|
if (!this.aggregations)
|
|
2933
2916
|
return null;
|
|
2934
|
-
if (!this.columns.some(c =>
|
|
2917
|
+
if (!this.columns.some(c => c.type === 'FIELD' && c.aggregate))
|
|
2935
2918
|
return null;
|
|
2936
2919
|
return (h("tfoot", null, h("tr", { class: "mrd-table__totals-row" }, this.columns.map(col => {
|
|
2937
|
-
var _a
|
|
2920
|
+
var _a;
|
|
2938
2921
|
const val = this.renderAggregationValue(col);
|
|
2939
|
-
const isNumeric = col.type === 'FIELD' && NUMERIC_TYPES.has((
|
|
2922
|
+
const isNumeric = col.type === 'FIELD' && NUMERIC_TYPES.has((_a = col.dataType) !== null && _a !== void 0 ? _a : '');
|
|
2940
2923
|
return (h("td", { class: `mrd-table__totals-cell${isNumeric ? ' mrd-table__totals-cell--numeric' : ''}` }, val));
|
|
2941
2924
|
}))));
|
|
2942
2925
|
}
|
|
@@ -2948,7 +2931,7 @@ const MrdTable = class {
|
|
|
2948
2931
|
// ── Non-paginated mode ──────────────────────────────────────────────────
|
|
2949
2932
|
if (this.totalElements === 0) {
|
|
2950
2933
|
return (h(Host, null, this.renderToolbar(), h("div", { class: "mrd-table" }, h("table", { class: "mrd-table__table" }, h("thead", null, h("tr", null, this.columns.map(col => {
|
|
2951
|
-
var _a
|
|
2934
|
+
var _a;
|
|
2952
2935
|
const name = this.colName(col);
|
|
2953
2936
|
const isFiltered = this.activeFilters.has(name);
|
|
2954
2937
|
const cls = [
|
|
@@ -2956,7 +2939,7 @@ const MrdTable = class {
|
|
|
2956
2939
|
isFiltered ? 'mrd-table__header--filtered' : '',
|
|
2957
2940
|
this.filterMode ? 'mrd-table__header--sortable' : '',
|
|
2958
2941
|
].filter(Boolean).join(' ');
|
|
2959
|
-
return (h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, h("span", { class: "mrd-table__header-label" }, (
|
|
2942
|
+
return (h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isFiltered && this.renderFilterIcon()));
|
|
2960
2943
|
}))), h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (h("tr", { class: "mrd-table__row mrd-table__row--clickable", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' }, onClick: () => this.mrdRowClick.emit(row) }, this.columns.map(col => this.renderCell(col, row)))))), this.renderTotalsRow()), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale)))), this.renderFooter((_c = this.rows) === null || _c === void 0 ? void 0 : _c.length), this.renderFilterPopup(), this.renderTextblockModal(), this.renderJsonModal()));
|
|
2961
2944
|
}
|
|
2962
2945
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
@@ -2989,7 +2972,7 @@ const MrdTable = class {
|
|
|
2989
2972
|
}
|
|
2990
2973
|
}
|
|
2991
2974
|
return (h(Host, null, this.renderToolbar(), h("div", { class: "mrd-table__scroll", style: { height: `${this.tableHeight}px` }, onScroll: this.handleScroll }, h("table", { class: "mrd-table__table", style: tableStyle }, h("thead", null, h("tr", null, this.columns.map((col, idx) => {
|
|
2992
|
-
var _a
|
|
2975
|
+
var _a;
|
|
2993
2976
|
const name = this.colName(col);
|
|
2994
2977
|
const isActive = this.sortField === name;
|
|
2995
2978
|
const isFiltered = this.activeFilters.has(name);
|
|
@@ -3000,7 +2983,7 @@ const MrdTable = class {
|
|
|
3000
2983
|
isActive ? `mrd-table__header--sorted-${this.sortDir}` : '',
|
|
3001
2984
|
isFiltered ? 'mrd-table__header--filtered' : '',
|
|
3002
2985
|
].filter(Boolean).join(' ');
|
|
3003
|
-
return (h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: isInteractive ? ((e) => this.filterMode ? this.handleFilterOpen(col, e) : this.handleSortClick(col)) : undefined }, h("span", { class: "mrd-table__header-label" }, (
|
|
2986
|
+
return (h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: isInteractive ? ((e) => this.filterMode ? this.handleFilterOpen(col, e) : this.handleSortClick(col)) : undefined }, h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isInteractive && isActive && (h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, this.sortDir === 'asc' ? '▲' : '▼')), isInteractive && !isActive && !this.filterMode && (h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, "\u21C5")), isInteractive && isFiltered && this.renderFilterIcon()));
|
|
3004
2987
|
}))), h("tbody", null, topSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${topSpacerHeight}px` } }, h("td", { colSpan: colCount }))), renderedRows, bottomSpacerHeight > 0 && (h("tr", { class: "mrd-table__spacer", style: { height: `${bottomSpacerHeight}px` } }, h("td", { colSpan: colCount })))), this.renderTotalsRow())), effectiveTotal === 0 && this.loadedPages.has(0) && (h("p", { class: "mrd-table__empty" }, t('no_results', this.locale))), effectiveTotal > 0 && this.renderFooter(undefined, effectiveTotal), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
3005
2988
|
}
|
|
3006
2989
|
renderFilterIcon() {
|