@mmlogic/components 0.1.30 → 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 +147 -164
- 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 +51 -60
- package/dist/collection/components/mrd-table/mrd-table.js +33 -33
- package/dist/collection/dev/api.js +9 -97
- package/dist/collection/dev/app.js +23 -17
- package/dist/collection/dev/example-data.js +111 -299
- package/dist/collection/utils/cell-renderer.js +7 -5
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/mrd-boolean-field_19.entry.js +147 -164
- 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-9ecefa81.entry.js +0 -1
|
@@ -631,34 +631,32 @@ const MrdField = class {
|
|
|
631
631
|
render() {
|
|
632
632
|
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;
|
|
633
633
|
const { item, locale, value } = this;
|
|
634
|
-
if (item.type === index$1.ClientLayoutItemType.RELATION
|
|
635
|
-
|
|
636
|
-
return (index.h(index.Host, null, index.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 : index$1.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 })));
|
|
634
|
+
if (item.type === index$1.ClientLayoutItemType.RELATION) {
|
|
635
|
+
return (index.h(index.Host, null, index.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 : index$1.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 })));
|
|
637
636
|
}
|
|
638
|
-
if (item.type !== index$1.ClientLayoutItemType.FIELD
|
|
637
|
+
if (item.type !== index$1.ClientLayoutItemType.FIELD) {
|
|
639
638
|
return index.h(index.Host, null);
|
|
640
639
|
}
|
|
641
|
-
const field = item.field;
|
|
642
640
|
const commonProps = {
|
|
643
|
-
name:
|
|
644
|
-
label:
|
|
645
|
-
required:
|
|
646
|
-
disabled: (_g =
|
|
641
|
+
name: item.name,
|
|
642
|
+
label: item.label,
|
|
643
|
+
required: item.required,
|
|
644
|
+
disabled: (_g = item.disabled) !== null && _g !== void 0 ? _g : false,
|
|
647
645
|
locale,
|
|
648
646
|
onMrdChange: this.handleChange,
|
|
649
647
|
onMrdBlur: this.handleBlur,
|
|
650
648
|
};
|
|
651
|
-
switch (
|
|
649
|
+
switch (item.dataType) {
|
|
652
650
|
case index$1.ClientLayoutItemFieldDataType.TEXT:
|
|
653
|
-
return (index.h(index.Host, null, index.h("mrd-text-field", Object.assign({}, commonProps, { value: (_h = value) !== null && _h !== void 0 ? _h : '', placeholder: (_j =
|
|
651
|
+
return (index.h(index.Host, null, index.h("mrd-text-field", Object.assign({}, commonProps, { value: (_h = value) !== null && _h !== void 0 ? _h : '', placeholder: (_j = item.placeholder) !== null && _j !== void 0 ? _j : '' }))));
|
|
654
652
|
case index$1.ClientLayoutItemFieldDataType.TEXTBLOCK:
|
|
655
|
-
return (index.h(index.Host, null, index.h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_k = value) !== null && _k !== void 0 ? _k : '', placeholder: (_l =
|
|
653
|
+
return (index.h(index.Host, null, index.h("mrd-textarea-field", Object.assign({}, commonProps, { value: (_k = value) !== null && _k !== void 0 ? _k : '', placeholder: (_l = item.placeholder) !== null && _l !== void 0 ? _l : '' }))));
|
|
656
654
|
case index$1.ClientLayoutItemFieldDataType.INTEGER:
|
|
657
655
|
case index$1.ClientLayoutItemFieldDataType.DECIMAL:
|
|
658
656
|
case index$1.ClientLayoutItemFieldDataType.PERCENTAGE:
|
|
659
|
-
return (index.h(index.Host, null, index.h("mrd-number-field", Object.assign({}, commonProps, { value: (_m = value) !== null && _m !== void 0 ? _m : null, dataType:
|
|
657
|
+
return (index.h(index.Host, null, index.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 : '' }))));
|
|
660
658
|
case index$1.ClientLayoutItemFieldDataType.CURRENCY:
|
|
661
|
-
return (index.h(index.Host, null, index.h("mrd-currency-field", Object.assign({}, commonProps, { value: (_q = value) !== null && _q !== void 0 ? _q : { amount: null, currency: (_r =
|
|
659
|
+
return (index.h(index.Host, null, index.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' } }))));
|
|
662
660
|
case index$1.ClientLayoutItemFieldDataType.BOOLEAN:
|
|
663
661
|
return (index.h(index.Host, null, index.h("mrd-boolean-field", Object.assign({}, commonProps, { value: (_s = value) !== null && _s !== void 0 ? _s : false }))));
|
|
664
662
|
case index$1.ClientLayoutItemFieldDataType.DATE:
|
|
@@ -668,17 +666,17 @@ const MrdField = class {
|
|
|
668
666
|
case index$1.ClientLayoutItemFieldDataType.TIME:
|
|
669
667
|
return (index.h(index.Host, null, index.h("mrd-time-field", Object.assign({}, commonProps, { value: (_v = value) !== null && _v !== void 0 ? _v : '' }))));
|
|
670
668
|
case index$1.ClientLayoutItemFieldDataType.EMAIL:
|
|
671
|
-
return (index.h(index.Host, null, index.h("mrd-email-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x =
|
|
669
|
+
return (index.h(index.Host, null, index.h("mrd-email-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x = item.placeholder) !== null && _x !== void 0 ? _x : '' }))));
|
|
672
670
|
case index$1.ClientLayoutItemFieldDataType.HYPERLINK:
|
|
673
|
-
return (index.h(index.Host, null, index.h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', placeholder: (_z =
|
|
671
|
+
return (index.h(index.Host, null, index.h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', placeholder: (_z = item.placeholder) !== null && _z !== void 0 ? _z : '' }))));
|
|
674
672
|
case index$1.ClientLayoutItemFieldDataType.LIST:
|
|
675
|
-
return (index.h(index.Host, null, index.h("mrd-list-field", Object.assign({}, commonProps, { value: (_0 = value) !== null && _0 !== void 0 ? _0 : '', multiple: (_1 =
|
|
673
|
+
return (index.h(index.Host, null, index.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 : [] }))));
|
|
676
674
|
case index$1.ClientLayoutItemFieldDataType.FILE:
|
|
677
|
-
return (index.h(index.Host, null, index.h("mrd-file-field", Object.assign({}, commonProps, { value: value, accept: (_3 =
|
|
675
|
+
return (index.h(index.Host, null, index.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 }))));
|
|
678
676
|
case index$1.ClientLayoutItemFieldDataType.IMAGE:
|
|
679
|
-
return (index.h(index.Host, null, index.h("mrd-image-field", Object.assign({}, commonProps, { value: value, accept: (_5 =
|
|
677
|
+
return (index.h(index.Host, null, index.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 }))));
|
|
680
678
|
case index$1.ClientLayoutItemFieldDataType.LONGTEXT:
|
|
681
|
-
return (index.h(index.Host, null, index.h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_7 = value) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 =
|
|
679
|
+
return (index.h(index.Host, null, index.h("mrd-longtext-field", Object.assign({}, commonProps, { value: (_7 = value) !== null && _7 !== void 0 ? _7 : '', placeholder: (_8 = item.placeholder) !== null && _8 !== void 0 ? _8 : '' }))));
|
|
682
680
|
case index$1.ClientLayoutItemFieldDataType.JSON:
|
|
683
681
|
return index.h(index.Host, null);
|
|
684
682
|
default:
|
|
@@ -839,17 +837,17 @@ const MrdForm = class {
|
|
|
839
837
|
const newHref = this.getHref(value);
|
|
840
838
|
if (newHref === prevHref)
|
|
841
839
|
return;
|
|
842
|
-
for (const
|
|
843
|
-
if (
|
|
840
|
+
for (const item of this.collectDependentDropdowns()) {
|
|
841
|
+
if (item.commonRelation !== name)
|
|
844
842
|
continue;
|
|
845
843
|
// Clear the dependent field's current selection (options have changed)
|
|
846
|
-
this.formValues = Object.assign(Object.assign({}, this.formValues), { [
|
|
844
|
+
this.formValues = Object.assign(Object.assign({}, this.formValues), { [item.name]: null });
|
|
847
845
|
this.mrdFetchAll.emit({
|
|
848
|
-
name:
|
|
849
|
-
relatedClass:
|
|
850
|
-
mostSignificantClass:
|
|
851
|
-
commonRelation:
|
|
852
|
-
filter:
|
|
846
|
+
name: item.name,
|
|
847
|
+
relatedClass: item.relatedClass,
|
|
848
|
+
mostSignificantClass: item.mostSignificantClass,
|
|
849
|
+
commonRelation: item.commonRelation,
|
|
850
|
+
filter: item.commonRelation + '_href',
|
|
853
851
|
filterValue: newHref, // empty string when dependency was cleared → host should clear the list
|
|
854
852
|
});
|
|
855
853
|
}
|
|
@@ -924,24 +922,20 @@ const MrdForm = class {
|
|
|
924
922
|
var _a, _b;
|
|
925
923
|
const allItems = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
926
924
|
// Strategy 1: direct match on mostSignificantClass
|
|
927
|
-
const direct = allItems.find(item =>
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
});
|
|
932
|
-
if (direct === null || direct === void 0 ? void 0 : direct.relation)
|
|
933
|
-
return direct.relation.name;
|
|
925
|
+
const direct = allItems.find(item => item.type === index$1.ClientLayoutItemType.RELATION &&
|
|
926
|
+
item.mostSignificantClass === this.referenceClass);
|
|
927
|
+
if (direct === null || direct === void 0 ? void 0 : direct.name)
|
|
928
|
+
return direct.name;
|
|
934
929
|
// Strategy 2: a DROPDOWN whose commonRelation field was omitted from the layout
|
|
935
930
|
const layoutRelationNames = new Set(allItems
|
|
936
931
|
.filter(item => item.type === index$1.ClientLayoutItemType.RELATION)
|
|
937
|
-
.map(item => item.
|
|
932
|
+
.map(item => item.name));
|
|
938
933
|
for (const item of allItems) {
|
|
939
|
-
const rel = item.relation;
|
|
940
934
|
if (item.type === index$1.ClientLayoutItemType.RELATION &&
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
!layoutRelationNames.has(
|
|
944
|
-
return
|
|
935
|
+
item.editBehavior === index$1.ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
936
|
+
item.commonRelation &&
|
|
937
|
+
!layoutRelationNames.has(item.commonRelation)) {
|
|
938
|
+
return item.commonRelation;
|
|
945
939
|
}
|
|
946
940
|
}
|
|
947
941
|
return null;
|
|
@@ -956,25 +950,21 @@ const MrdForm = class {
|
|
|
956
950
|
collectDependentDropdowns() {
|
|
957
951
|
var _a, _b;
|
|
958
952
|
return this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : [])
|
|
959
|
-
.filter(item =>
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
((_a = item.relation) === null || _a === void 0 ? void 0 : _a.editBehavior) === index$1.ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
963
|
-
!!item.relation.commonRelation;
|
|
964
|
-
})
|
|
965
|
-
.map(item => item.relation);
|
|
953
|
+
.filter(item => item.type === index$1.ClientLayoutItemType.RELATION &&
|
|
954
|
+
item.editBehavior === index$1.ClientLayoutItemRelationEditBehavior.DROPDOWN &&
|
|
955
|
+
!!item.commonRelation);
|
|
966
956
|
}
|
|
967
957
|
/** Emit mrdFetchAll for every dependent DROPDOWN whose filter value is currently set. */
|
|
968
958
|
emitDependentFetchAll() {
|
|
969
|
-
for (const
|
|
970
|
-
const filterValue = this.getHref(this.formValues[
|
|
959
|
+
for (const item of this.collectDependentDropdowns()) {
|
|
960
|
+
const filterValue = this.getHref(this.formValues[item.commonRelation]);
|
|
971
961
|
if (filterValue) {
|
|
972
962
|
this.mrdFetchAll.emit({
|
|
973
|
-
name:
|
|
974
|
-
relatedClass:
|
|
975
|
-
mostSignificantClass:
|
|
976
|
-
commonRelation:
|
|
977
|
-
filter:
|
|
963
|
+
name: item.name,
|
|
964
|
+
relatedClass: item.relatedClass,
|
|
965
|
+
mostSignificantClass: item.mostSignificantClass,
|
|
966
|
+
commonRelation: item.commonRelation,
|
|
967
|
+
filter: item.commonRelation + '_href',
|
|
978
968
|
filterValue,
|
|
979
969
|
});
|
|
980
970
|
}
|
|
@@ -1004,15 +994,14 @@ const MrdForm = class {
|
|
|
1004
994
|
return fields;
|
|
1005
995
|
}
|
|
1006
996
|
validate() {
|
|
1007
|
-
var _a, _b
|
|
997
|
+
var _a, _b;
|
|
1008
998
|
const newErrors = {};
|
|
1009
999
|
const allFields = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
1010
1000
|
for (const item of allFields) {
|
|
1011
|
-
|
|
1012
|
-
if (!def)
|
|
1001
|
+
if (!item.name)
|
|
1013
1002
|
continue;
|
|
1014
|
-
if (
|
|
1015
|
-
newErrors[
|
|
1003
|
+
if (item.required && !validateRequired(this.formValues[item.name])) {
|
|
1004
|
+
newErrors[item.name] = t('required', this.locale);
|
|
1016
1005
|
}
|
|
1017
1006
|
}
|
|
1018
1007
|
this.errors = newErrors;
|
|
@@ -1060,8 +1049,10 @@ const MrdForm = class {
|
|
|
1060
1049
|
const payload = {};
|
|
1061
1050
|
const allFields = this.collectFields((_b = (_a = this.layout) === null || _a === void 0 ? void 0 : _a.items) !== null && _b !== void 0 ? _b : []);
|
|
1062
1051
|
for (const item of allFields) {
|
|
1063
|
-
if (item.
|
|
1064
|
-
|
|
1052
|
+
if (!item.name)
|
|
1053
|
+
continue;
|
|
1054
|
+
const name = item.name;
|
|
1055
|
+
if (item.type === index$1.ClientLayoutItemType.FIELD) {
|
|
1065
1056
|
const value = this.formValues[name];
|
|
1066
1057
|
if (value instanceof File)
|
|
1067
1058
|
continue;
|
|
@@ -1071,8 +1062,7 @@ const MrdForm = class {
|
|
|
1071
1062
|
continue;
|
|
1072
1063
|
payload[name] = current;
|
|
1073
1064
|
}
|
|
1074
|
-
else if (item.type === index$1.ClientLayoutItemType.RELATION
|
|
1075
|
-
const name = item.relation.name;
|
|
1065
|
+
else if (item.type === index$1.ClientLayoutItemType.RELATION) {
|
|
1076
1066
|
const current = this.normalizeRelationValue(this.formValues[name]);
|
|
1077
1067
|
const initial = this.normalizeRelationValue(this.initialValues[name]);
|
|
1078
1068
|
if (this.deepEqual(current, initial))
|
|
@@ -1084,14 +1074,14 @@ const MrdForm = class {
|
|
|
1084
1074
|
}
|
|
1085
1075
|
renderItems(items) {
|
|
1086
1076
|
return items.map(item => {
|
|
1087
|
-
var _a
|
|
1077
|
+
var _a;
|
|
1088
1078
|
if (item.type === index$1.ClientLayoutItemType.SECTION) {
|
|
1089
1079
|
return (index.h("fieldset", { class: "mrd-form__section" }, item.label && index.h("legend", { class: "mrd-form__section-legend" }, item.label), index.h("div", { class: "mrd-form__section-body" }, item.items && this.renderItems(item.items))));
|
|
1090
1080
|
}
|
|
1091
1081
|
if (item.type === index$1.ClientLayoutItemType.GROUP) {
|
|
1092
1082
|
return (index.h("div", { class: "mrd-form__group" }, item.label && index.h("div", { class: "mrd-form__group-label" }, item.label), index.h("div", { class: "mrd-form__group-body" }, item.items && this.renderItems(item.items))));
|
|
1093
1083
|
}
|
|
1094
|
-
const fieldName = (
|
|
1084
|
+
const fieldName = (_a = item.name) !== null && _a !== void 0 ? _a : '';
|
|
1095
1085
|
const fieldValue = this.formValues[fieldName];
|
|
1096
1086
|
return (index.h("div", { class: "mrd-form__field" }, index.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] && (index.h("span", { class: "mrd-form__field-error" }, this.errors[fieldName]))));
|
|
1097
1087
|
});
|
|
@@ -1270,17 +1260,19 @@ class CellRenderer {
|
|
|
1270
1260
|
static render(column, row, locale) {
|
|
1271
1261
|
var _a, _b, _c, _d;
|
|
1272
1262
|
if (column.type === index$1.ClientLayoutItemType.RELATION) {
|
|
1273
|
-
const name = (
|
|
1274
|
-
const link = (
|
|
1263
|
+
const name = (_a = column.name) !== null && _a !== void 0 ? _a : '';
|
|
1264
|
+
const link = (_b = row === null || row === void 0 ? void 0 : row._links) === null || _b === void 0 ? void 0 : _b[name];
|
|
1275
1265
|
if (!link)
|
|
1276
1266
|
return '';
|
|
1277
1267
|
if (Array.isArray(link))
|
|
1278
1268
|
return link.map((l) => { var _a; return (_a = l.name) !== null && _a !== void 0 ? _a : ''; }).filter(Boolean).join(', ');
|
|
1279
|
-
return (
|
|
1269
|
+
return (_c = link.name) !== null && _c !== void 0 ? _c : '';
|
|
1280
1270
|
}
|
|
1281
|
-
if (column.type !== index$1.ClientLayoutItemType.FIELD
|
|
1271
|
+
if (column.type !== index$1.ClientLayoutItemType.FIELD)
|
|
1282
1272
|
return '';
|
|
1283
|
-
const
|
|
1273
|
+
const name = (_d = column.name) !== null && _d !== void 0 ? _d : '';
|
|
1274
|
+
const dataType = column.dataType;
|
|
1275
|
+
const listItems = column.listItems;
|
|
1284
1276
|
const raw = row === null || row === void 0 ? void 0 : row[name];
|
|
1285
1277
|
if (raw == null || raw === '')
|
|
1286
1278
|
return '';
|
|
@@ -1448,34 +1440,32 @@ const MrdLayoutSection = class {
|
|
|
1448
1440
|
});
|
|
1449
1441
|
}
|
|
1450
1442
|
emitLoadViews() {
|
|
1451
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
1443
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1452
1444
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1453
1445
|
for (const item of this.flattenItems(this.items)) {
|
|
1454
|
-
if (item.type === index$1.ClientLayoutItemType.RELATED_VIEW && item.
|
|
1455
|
-
const
|
|
1456
|
-
const viewConfig = this.views[rv.name];
|
|
1446
|
+
if (item.type === index$1.ClientLayoutItemType.RELATED_VIEW && item.name) {
|
|
1447
|
+
const viewConfig = this.views[item.name];
|
|
1457
1448
|
if (!viewConfig)
|
|
1458
1449
|
continue;
|
|
1459
|
-
const href = (
|
|
1460
|
-
this.mrdLoadView.emit({ name:
|
|
1450
|
+
const href = (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href;
|
|
1451
|
+
this.mrdLoadView.emit({ name: item.name, href, viewConfig, sort: (_e = viewConfig.defaultSort) !== null && _e !== void 0 ? _e : '', filters: this.resolveViewFilters(viewConfig) });
|
|
1461
1452
|
}
|
|
1462
1453
|
else if (item.type === index$1.ClientLayoutItemType.VIEW) {
|
|
1463
|
-
const viewName =
|
|
1454
|
+
const viewName = item.name;
|
|
1464
1455
|
if (!viewName)
|
|
1465
1456
|
continue;
|
|
1466
1457
|
const viewConfig = this.views[viewName];
|
|
1467
1458
|
if (!viewConfig)
|
|
1468
1459
|
continue;
|
|
1469
|
-
const href = (
|
|
1470
|
-
this.mrdLoadView.emit({ name: viewName, href, viewConfig, sort: (
|
|
1460
|
+
const href = (_f = this.links[viewName]) === null || _f === void 0 ? void 0 : _f.href;
|
|
1461
|
+
this.mrdLoadView.emit({ name: viewName, href, viewConfig, sort: (_g = viewConfig.defaultSort) !== null && _g !== void 0 ? _g : '', filters: this.resolveViewFilters(viewConfig) });
|
|
1471
1462
|
}
|
|
1472
1463
|
}
|
|
1473
1464
|
}
|
|
1474
1465
|
emitLoadImages() {
|
|
1475
|
-
var _a;
|
|
1476
1466
|
for (const item of this.flattenItems(this.items)) {
|
|
1477
|
-
if (item.type === index$1.ClientLayoutItemType.FIELD &&
|
|
1478
|
-
const fieldName = item.
|
|
1467
|
+
if (item.type === index$1.ClientLayoutItemType.FIELD && item.dataType === index$1.ClientLayoutItemFieldDataType.IMAGE) {
|
|
1468
|
+
const fieldName = item.name;
|
|
1479
1469
|
const raw = this.data[fieldName];
|
|
1480
1470
|
const href = raw === null || raw === void 0 ? void 0 : raw.href;
|
|
1481
1471
|
if (href)
|
|
@@ -1533,15 +1523,15 @@ const MrdLayoutSection = class {
|
|
|
1533
1523
|
this.imagePreviewUrl = url;
|
|
1534
1524
|
}
|
|
1535
1525
|
resolveSearchKey() {
|
|
1526
|
+
var _a;
|
|
1536
1527
|
const items = this.flattenItems(this.items).filter(i => i.type === index$1.ClientLayoutItemType.SEARCH);
|
|
1537
|
-
if (items.length === 1
|
|
1538
|
-
return items[0].
|
|
1528
|
+
if (items.length === 1)
|
|
1529
|
+
return (_a = items[0].dataClass) !== null && _a !== void 0 ? _a : null;
|
|
1539
1530
|
return null;
|
|
1540
1531
|
}
|
|
1541
1532
|
renderSingleFieldValue(item, value) {
|
|
1542
1533
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1543
|
-
const
|
|
1544
|
-
const dt = field.dataType;
|
|
1534
|
+
const dt = item.dataType;
|
|
1545
1535
|
switch (dt) {
|
|
1546
1536
|
case index$1.ClientLayoutItemFieldDataType.HYPERLINK: {
|
|
1547
1537
|
const v = value;
|
|
@@ -1565,7 +1555,7 @@ const MrdLayoutSection = class {
|
|
|
1565
1555
|
const v = value;
|
|
1566
1556
|
const href = (_f = v === null || v === void 0 ? void 0 : v.href) !== null && _f !== void 0 ? _f : '';
|
|
1567
1557
|
const fileName = (_g = v === null || v === void 0 ? void 0 : v.fileName) !== null && _g !== void 0 ? _g : '';
|
|
1568
|
-
const previewUrl = this.imagePreviews[
|
|
1558
|
+
const previewUrl = this.imagePreviews[item.name];
|
|
1569
1559
|
if (previewUrl) {
|
|
1570
1560
|
return (index.h("button", { class: "mrd-layout-section__image-thumb-btn", onClick: () => { this.imagePreviewUrl = previewUrl; }, title: fileName || undefined }, index.h("img", { class: "mrd-layout-section__image-thumb", src: previewUrl, alt: fileName })));
|
|
1571
1561
|
}
|
|
@@ -1574,7 +1564,7 @@ const MrdLayoutSection = class {
|
|
|
1574
1564
|
case index$1.ClientLayoutItemFieldDataType.BOOLEAN:
|
|
1575
1565
|
return (index.h("span", { class: `mrd-layout-section__boolean mrd-layout-section__boolean--${value ? 'true' : 'false'}` }, value ? t('yes', this.locale) : t('no', this.locale)));
|
|
1576
1566
|
case index$1.ClientLayoutItemFieldDataType.LIST: {
|
|
1577
|
-
const listItem = ((_h =
|
|
1567
|
+
const listItem = ((_h = item.listItems) !== null && _h !== void 0 ? _h : []).find(li => li.key === String(value));
|
|
1578
1568
|
const label = (_j = listItem === null || listItem === void 0 ? void 0 : listItem.label) !== null && _j !== void 0 ? _j : String(value);
|
|
1579
1569
|
const color = listItem === null || listItem === void 0 ? void 0 : listItem.color;
|
|
1580
1570
|
const bg = listItem === null || listItem === void 0 ? void 0 : listItem.backgroundColor;
|
|
@@ -1587,7 +1577,7 @@ const MrdLayoutSection = class {
|
|
|
1587
1577
|
return label;
|
|
1588
1578
|
}
|
|
1589
1579
|
default: {
|
|
1590
|
-
const text = CellRenderer.renderValue(dt, value, (_k =
|
|
1580
|
+
const text = CellRenderer.renderValue(dt, value, (_k = item.listItems) !== null && _k !== void 0 ? _k : [], this.locale);
|
|
1591
1581
|
return text || null;
|
|
1592
1582
|
}
|
|
1593
1583
|
}
|
|
@@ -1595,8 +1585,7 @@ const MrdLayoutSection = class {
|
|
|
1595
1585
|
renderFieldValue(item, rawValue) {
|
|
1596
1586
|
if (rawValue == null || rawValue === '')
|
|
1597
1587
|
return null;
|
|
1598
|
-
|
|
1599
|
-
if (field.multiple && Array.isArray(rawValue)) {
|
|
1588
|
+
if (item.multiple && Array.isArray(rawValue)) {
|
|
1600
1589
|
const rendered = rawValue.map(v => this.renderSingleFieldValue(item, v));
|
|
1601
1590
|
if (rendered.every(r => typeof r === 'string' || r == null)) {
|
|
1602
1591
|
return rendered.filter(Boolean).join(', ') || null;
|
|
@@ -1606,27 +1595,26 @@ const MrdLayoutSection = class {
|
|
|
1606
1595
|
return this.renderSingleFieldValue(item, rawValue);
|
|
1607
1596
|
}
|
|
1608
1597
|
renderField(item) {
|
|
1609
|
-
if (!item.
|
|
1598
|
+
if (!item.name)
|
|
1610
1599
|
return null;
|
|
1611
|
-
const
|
|
1612
|
-
const rawValue = this.data[field.name];
|
|
1600
|
+
const rawValue = this.data[item.name];
|
|
1613
1601
|
const renderedValue = this.renderFieldValue(item, rawValue);
|
|
1614
|
-
if (
|
|
1615
|
-
return (index.h("h1", { class: "mrd-layout-section__field-header", key:
|
|
1602
|
+
if (item.header) {
|
|
1603
|
+
return (index.h("h1", { class: "mrd-layout-section__field-header", key: item.name }, typeof renderedValue === 'string' ? renderedValue : rawValue != null ? String(rawValue) : item.label));
|
|
1616
1604
|
}
|
|
1617
1605
|
if (renderedValue == null)
|
|
1618
1606
|
return null;
|
|
1619
|
-
const isBlock =
|
|
1620
|
-
||
|
|
1621
|
-
||
|
|
1622
|
-
return (index.h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key:
|
|
1607
|
+
const isBlock = item.dataType === index$1.ClientLayoutItemFieldDataType.TEXTBLOCK
|
|
1608
|
+
|| item.dataType === index$1.ClientLayoutItemFieldDataType.LONGTEXT
|
|
1609
|
+
|| item.dataType === index$1.ClientLayoutItemFieldDataType.JSON;
|
|
1610
|
+
return (index.h("div", { class: `mrd-layout-section__field${isBlock ? ' mrd-layout-section__field--block' : ''}`, key: item.name }, index.h("span", { class: "mrd-layout-section__field-label" }, item.label), index.h("span", { class: "mrd-layout-section__field-value" }, renderedValue)));
|
|
1623
1611
|
}
|
|
1624
1612
|
renderRelation(item) {
|
|
1625
1613
|
var _a, _b, _c;
|
|
1626
|
-
if (!item.
|
|
1614
|
+
if (!item.name)
|
|
1627
1615
|
return null;
|
|
1628
1616
|
const links = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1629
|
-
const link = links[item.
|
|
1617
|
+
const link = links[item.name];
|
|
1630
1618
|
if (!link)
|
|
1631
1619
|
return null;
|
|
1632
1620
|
const makeBtn = (href, name) => (index.h("button", { key: href, class: "mrd-layout-section__relation-link", onClick: () => this.mrdNavigate.emit({ href, label: name }) }, name));
|
|
@@ -1639,41 +1627,36 @@ const MrdLayoutSection = class {
|
|
|
1639
1627
|
}
|
|
1640
1628
|
if (!valueContent)
|
|
1641
1629
|
return null;
|
|
1642
|
-
return (index.h("div", { class: "mrd-layout-section__field", key: item.
|
|
1630
|
+
return (index.h("div", { class: "mrd-layout-section__field", key: item.name }, index.h("span", { class: "mrd-layout-section__field-label" }, item.label), index.h("span", { class: "mrd-layout-section__field-value" }, valueContent)));
|
|
1643
1631
|
}
|
|
1644
1632
|
renderSearch(item) {
|
|
1645
1633
|
var _a, _b, _c;
|
|
1646
|
-
if (!item.
|
|
1634
|
+
if (!item.dataClass)
|
|
1647
1635
|
return null;
|
|
1648
|
-
const dataClass = item.
|
|
1636
|
+
const dataClass = item.dataClass;
|
|
1649
1637
|
const query = (_a = this.searchQueryMap[dataClass]) !== null && _a !== void 0 ? _a : '';
|
|
1650
1638
|
const results = (_b = this.searchResultsMap[dataClass]) !== null && _b !== void 0 ? _b : [];
|
|
1651
1639
|
return (index.h("div", { class: "mrd-layout-section__search", key: `search-${dataClass}` }, index.h("div", { class: "mrd-layout-section__search-wrap" }, index.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" }, index.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" })), index.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 && (index.h("ul", { class: "mrd-layout-section__search-results" }, results.map(r => (index.h("li", { key: r.id, class: "mrd-layout-section__search-result" }, index.h("button", { class: "mrd-layout-section__search-result-btn", onClick: () => this.mrdNavigate.emit({ href: r.id, label: r.label }) }, index.h("span", { class: "mrd-layout-section__search-result-label" }, r.label), r.description && index.h("span", { class: "mrd-layout-section__search-result-desc" }, r.description)))))))));
|
|
1652
1640
|
}
|
|
1653
1641
|
renderRelatedView(item) {
|
|
1654
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m
|
|
1642
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1655
1643
|
const isRelated = item.type === index$1.ClientLayoutItemType.RELATED_VIEW;
|
|
1656
|
-
|
|
1657
|
-
const name = isRelated
|
|
1658
|
-
? (_a = item.relatedView) === null || _a === void 0 ? void 0 : _a.name
|
|
1659
|
-
: ((_c = (_b = item.view) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : item.name);
|
|
1644
|
+
const name = item.name;
|
|
1660
1645
|
if (!name)
|
|
1661
1646
|
return null;
|
|
1662
1647
|
const viewConfig = this.views[name];
|
|
1663
1648
|
if (!viewConfig)
|
|
1664
1649
|
return null;
|
|
1665
|
-
const showTitle =
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
const activeName = (_h = this.activeViewMap[name]) !== null && _h !== void 0 ? _h : name;
|
|
1669
|
-
const activeViewConfig = (_j = this.views[activeName]) !== null && _j !== void 0 ? _j : viewConfig;
|
|
1650
|
+
const showTitle = (_a = item.showTitle) !== null && _a !== void 0 ? _a : false;
|
|
1651
|
+
const activeName = (_b = this.activeViewMap[name]) !== null && _b !== void 0 ? _b : name;
|
|
1652
|
+
const activeViewConfig = (_c = this.views[activeName]) !== null && _c !== void 0 ? _c : viewConfig;
|
|
1670
1653
|
// Build the full view list (original + alternatives) so the switcher can always go back.
|
|
1671
|
-
const originalLabel = (
|
|
1672
|
-
const allViews = [{ name, label: originalLabel }, ...((
|
|
1654
|
+
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;
|
|
1655
|
+
const allViews = [{ name, label: originalLabel }, ...((_g = item.alternativeViews) !== null && _g !== void 0 ? _g : [])];
|
|
1673
1656
|
const activeEntry = allViews.find(v => v.name === activeName);
|
|
1674
|
-
const viewLabel = (
|
|
1657
|
+
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 : '';
|
|
1675
1658
|
const altViews = allViews.filter(v => v.name !== activeName);
|
|
1676
|
-
const rawActions = (
|
|
1659
|
+
const rawActions = (_l = item.actions) !== null && _l !== void 0 ? _l : ['NEW', 'EXPORT'];
|
|
1677
1660
|
const tableActions = rawActions.reduce((acc, a) => {
|
|
1678
1661
|
if (a === 'NEW')
|
|
1679
1662
|
acc.push({ action: 'create', label: t('table_new_record', this.locale), icon: 'assets/sprites.svg#icon-plus', variant: 'primary' });
|
|
@@ -1681,8 +1664,8 @@ const MrdLayoutSection = class {
|
|
|
1681
1664
|
acc.push({ action: 'export', label: t('table_export_excel', this.locale), icon: 'assets/sprites.svg#icon-file-excel' });
|
|
1682
1665
|
return acc;
|
|
1683
1666
|
}, []);
|
|
1684
|
-
return (index.h("div", { class: "mrd-layout-section__related-view", key: `view-${name}` }, showTitle && item.label && index.h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), index.h("mrd-table", { "data-view": name, columns: activeViewConfig.values, locale: this.locale, defaultSort: (
|
|
1685
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1667
|
+
return (index.h("div", { class: "mrd-layout-section__related-view", key: `view-${name}` }, showTitle && item.label && index.h("h3", { class: "mrd-layout-section__related-view-title" }, item.label), index.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) => {
|
|
1668
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1686
1669
|
e.stopPropagation();
|
|
1687
1670
|
const newViewName = e.detail.name;
|
|
1688
1671
|
const newViewConfig = this.views[newViewName];
|
|
@@ -1692,20 +1675,20 @@ const MrdLayoutSection = class {
|
|
|
1692
1675
|
this.activeFiltersMap = Object.assign(Object.assign({}, this.activeFiltersMap), { [name]: [] });
|
|
1693
1676
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1694
1677
|
const href = isRelated
|
|
1695
|
-
? (
|
|
1696
|
-
: ((
|
|
1697
|
-
this.mrdLoadView.emit({ name, href, viewConfig: newViewConfig, sort: (
|
|
1678
|
+
? (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href
|
|
1679
|
+
: ((_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);
|
|
1680
|
+
this.mrdLoadView.emit({ name, href, viewConfig: newViewConfig, sort: (_h = newViewConfig.defaultSort) !== null && _h !== void 0 ? _h : '', filters: this.resolveViewFilters(newViewConfig) });
|
|
1698
1681
|
}, onMrdFilter: (e) => {
|
|
1699
1682
|
e.stopPropagation();
|
|
1700
1683
|
this.activeFiltersMap = Object.assign(Object.assign({}, this.activeFiltersMap), { [name]: e.detail.filters });
|
|
1701
1684
|
}, onMrdLoadAggregations: (e) => {
|
|
1702
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1685
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1703
1686
|
e.stopPropagation();
|
|
1704
1687
|
const dataLinks = ((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links) !== null && _b !== void 0 ? _b : {});
|
|
1705
1688
|
const href = isRelated
|
|
1706
|
-
? (
|
|
1707
|
-
: ((
|
|
1708
|
-
const filters = (
|
|
1689
|
+
? (_d = dataLinks[(_c = item.relatedClass) !== null && _c !== void 0 ? _c : '']) === null || _d === void 0 ? void 0 : _d.href
|
|
1690
|
+
: ((_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);
|
|
1691
|
+
const filters = (_j = this.activeFiltersMap[name]) !== null && _j !== void 0 ? _j : [];
|
|
1709
1692
|
this.mrdLoadViewAggregations.emit(Object.assign({ name, href, filters }, e.detail));
|
|
1710
1693
|
}, onMrdAction: (e) => {
|
|
1711
1694
|
var _a, _b, _c;
|
|
@@ -1727,7 +1710,7 @@ const MrdLayoutSection = class {
|
|
|
1727
1710
|
case index$1.ClientLayoutItemType.TEXT:
|
|
1728
1711
|
return index.h("div", { class: "mrd-layout-section__text", key: `text-${item.label}`, innerHTML: (_a = item.label) !== null && _a !== void 0 ? _a : '' });
|
|
1729
1712
|
case index$1.ClientLayoutItemType.NAVIGATE:
|
|
1730
|
-
return (index.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));
|
|
1713
|
+
return (index.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));
|
|
1731
1714
|
case index$1.ClientLayoutItemType.SEARCH:
|
|
1732
1715
|
return this.renderSearch(item);
|
|
1733
1716
|
case index$1.ClientLayoutItemType.SECTION:
|
|
@@ -1746,7 +1729,7 @@ const MrdLayoutSection = class {
|
|
|
1746
1729
|
return (index.h("div", { class: "mrd-layout-section__modal-backdrop", onClick: () => { this.imagePreviewUrl = null; } }, index.h("div", { class: "mrd-layout-section__modal", onClick: (e) => e.stopPropagation() }, index.h("button", { class: "mrd-layout-section__modal-close", onClick: () => { this.imagePreviewUrl = null; } }, "\u2715"), index.h("img", { class: "mrd-layout-section__modal-image", src: this.imagePreviewUrl, alt: "" }))));
|
|
1747
1730
|
}
|
|
1748
1731
|
render() {
|
|
1749
|
-
return (index.h(index.Host, { key: '
|
|
1732
|
+
return (index.h(index.Host, { key: '7a91a541e056965dc79d74a50827e8c270c33a0d' }, index.h("div", { key: 'bcf4a2e81e704d136fb437cd2cb22acb4a05a8b3', class: "mrd-layout-section" }, this.items.map(item => this.renderItem(item))), this.renderImageModal()));
|
|
1750
1733
|
}
|
|
1751
1734
|
get el() { return index.getElement(this); }
|
|
1752
1735
|
static get watchers() { return {
|
|
@@ -2391,25 +2374,25 @@ const MrdTable = class {
|
|
|
2391
2374
|
return this.sortDir === 'desc' ? `${this.sortField},desc` : this.sortField;
|
|
2392
2375
|
}
|
|
2393
2376
|
colName(col) {
|
|
2394
|
-
var _a
|
|
2395
|
-
return (
|
|
2377
|
+
var _a;
|
|
2378
|
+
return (_a = col.name) !== null && _a !== void 0 ? _a : '';
|
|
2396
2379
|
}
|
|
2397
2380
|
colDataType(col) {
|
|
2398
|
-
var _a
|
|
2381
|
+
var _a;
|
|
2399
2382
|
if (col.type === 'RELATION')
|
|
2400
2383
|
return 'RELATION';
|
|
2401
|
-
return (
|
|
2384
|
+
return (_a = col.dataType) !== null && _a !== void 0 ? _a : 'TEXT';
|
|
2402
2385
|
}
|
|
2403
2386
|
// ── Aggregation helpers ────────────────────────────────────────────────────
|
|
2404
2387
|
buildAggregationParams() {
|
|
2405
2388
|
var _a;
|
|
2406
2389
|
const groups = { sum: [], avg: [], count: [] };
|
|
2407
2390
|
for (const col of this.columns) {
|
|
2408
|
-
if (col.type !== 'FIELD' || !
|
|
2391
|
+
if (col.type !== 'FIELD' || !col.aggregate)
|
|
2409
2392
|
continue;
|
|
2410
|
-
const fn = col.
|
|
2393
|
+
const fn = col.aggregate.toLowerCase();
|
|
2411
2394
|
if (fn in groups)
|
|
2412
|
-
groups[fn].push(col.
|
|
2395
|
+
groups[fn].push((_a = col.name) !== null && _a !== void 0 ? _a : '');
|
|
2413
2396
|
}
|
|
2414
2397
|
const params = {};
|
|
2415
2398
|
if (groups.sum.length)
|
|
@@ -2427,19 +2410,19 @@ const MrdTable = class {
|
|
|
2427
2410
|
}
|
|
2428
2411
|
renderAggregationValue(col) {
|
|
2429
2412
|
var _a, _b;
|
|
2430
|
-
if (col.type !== 'FIELD' || !
|
|
2413
|
+
if (col.type !== 'FIELD' || !col.aggregate || !this.aggregations)
|
|
2431
2414
|
return '';
|
|
2432
|
-
const fn = col.
|
|
2433
|
-
const val = (
|
|
2415
|
+
const fn = col.aggregate.toLowerCase();
|
|
2416
|
+
const val = (_a = this.aggregations[fn]) === null || _a === void 0 ? void 0 : _a[(_b = col.name) !== null && _b !== void 0 ? _b : ''];
|
|
2434
2417
|
if (val == null)
|
|
2435
2418
|
return '';
|
|
2436
|
-
const dt = col.
|
|
2419
|
+
const dt = col.dataType;
|
|
2437
2420
|
if (dt === 'INTEGER')
|
|
2438
2421
|
return formatNumber(val, this.locale, { maximumFractionDigits: 0 });
|
|
2439
2422
|
if (dt === 'PERCENTAGE')
|
|
2440
2423
|
return formatPercentage(val, this.locale);
|
|
2441
|
-
if (dt === 'CURRENCY' && col.
|
|
2442
|
-
return formatCurrency(val, col.
|
|
2424
|
+
if (dt === 'CURRENCY' && col.currencyCode)
|
|
2425
|
+
return formatCurrency(val, col.currencyCode, this.locale);
|
|
2443
2426
|
return formatNumber(val, this.locale);
|
|
2444
2427
|
}
|
|
2445
2428
|
// ── Reset pagination ───────────────────────────────────────────────────────
|
|
@@ -2784,7 +2767,7 @@ const MrdTable = class {
|
|
|
2784
2767
|
}
|
|
2785
2768
|
// ── Render: filter popup ───────────────────────────────────────────────────
|
|
2786
2769
|
renderFilterEditor(col) {
|
|
2787
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
2770
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2788
2771
|
const pf = (_a = this.pendingFilter) !== null && _a !== void 0 ? _a : {};
|
|
2789
2772
|
const dataType = this.colDataType(col);
|
|
2790
2773
|
if (NO_FILTER_TYPES.has(dataType)) {
|
|
@@ -2800,19 +2783,19 @@ const MrdTable = class {
|
|
|
2800
2783
|
].map(opt => (index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)))), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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))));
|
|
2801
2784
|
}
|
|
2802
2785
|
if (dataType === 'LIST') {
|
|
2803
|
-
const items = (
|
|
2804
|
-
const selected = (
|
|
2786
|
+
const items = (_b = col.listItems) !== null && _b !== void 0 ? _b : [];
|
|
2787
|
+
const selected = (_c = pf.values) !== null && _c !== void 0 ? _c : [];
|
|
2805
2788
|
return (index.h("div", { class: "mrd-table__filter-list" }, index.h("div", { class: "mrd-table__filter-list-controls" }, index.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)), index.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 => (index.h("label", { class: "mrd-table__filter-checkbox-label" }, index.h("input", { type: "checkbox", checked: selected.includes(item.key), onChange: (e) => this.togglePendingValue(item.key, e.target.checked) }), item.label)))));
|
|
2806
2789
|
}
|
|
2807
2790
|
if (TEXT_TYPES.has(dataType) || dataType === 'RELATION') {
|
|
2808
|
-
const op = (
|
|
2791
|
+
const op = (_d = pf.operator) !== null && _d !== void 0 ? _d : 'startsWith';
|
|
2809
2792
|
const noInput = op === 'isEmpty' || op === 'isNotEmpty';
|
|
2810
2793
|
return (index.h("div", { class: "mrd-table__filter-editor" }, index.h("select", { class: "mrd-table__filter-select", onChange: (e) => this.setPending('operator', e.target.value) }, [
|
|
2811
2794
|
{ val: 'startsWith', labelKey: 'filter_starts_with' },
|
|
2812
2795
|
{ val: 'equals', labelKey: 'filter_equals' },
|
|
2813
2796
|
{ val: 'isEmpty', labelKey: 'filter_is_empty' },
|
|
2814
2797
|
{ val: 'isNotEmpty', labelKey: 'filter_is_not_empty' },
|
|
2815
|
-
].map(o => index.h("option", { value: o.val, selected: op === o.val }, t(o.labelKey, this.locale)))), !noInput && (index.h("input", { type: "text", class: "mrd-table__filter-input", value: String((
|
|
2798
|
+
].map(o => index.h("option", { value: o.val, selected: op === o.val }, t(o.labelKey, this.locale)))), !noInput && (index.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) }))));
|
|
2816
2799
|
}
|
|
2817
2800
|
if (NUMERIC_TYPES.has(dataType)) {
|
|
2818
2801
|
const numOp = pf.operator;
|
|
@@ -2840,7 +2823,7 @@ const MrdTable = class {
|
|
|
2840
2823
|
else {
|
|
2841
2824
|
this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: undefined });
|
|
2842
2825
|
}
|
|
2843
|
-
} }, index.h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), index.h("option", { value: "isEmpty", selected: dtOp === 'isEmpty' }, t('filter_is_empty', this.locale)), index.h("option", { value: "isNotEmpty", selected: dtOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (index.h("div", { class: "mrd-table__filter-editor" }, index.h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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 ? (index.h("input", { type: "date", class: "mrd-table__filter-input", value: String((
|
|
2826
|
+
} }, index.h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), index.h("option", { value: "isEmpty", selected: dtOp === 'isEmpty' }, t('filter_is_empty', this.locale)), index.h("option", { value: "isNotEmpty", selected: dtOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (index.h("div", { class: "mrd-table__filter-editor" }, index.h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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 ? (index.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) })) : (index.h("div", { class: "mrd-table__filter-range mrd-table__filter-range--stacked" }, index.h("label", { class: "mrd-table__filter-range-label" }, t('filter_from', this.locale)), index.h("input", { type: "date", class: "mrd-table__filter-input", value: pf.from != null ? String(pf.from) : '', onInput: (e) => this.setPending('from', e.target.value) }), index.h("label", { class: "mrd-table__filter-range-label" }, t('filter_to', this.locale)), index.h("input", { type: "date", class: "mrd-table__filter-input", value: pf.to != null ? String(pf.to) : '', onInput: (e) => this.setPending('to', e.target.value) })))))));
|
|
2844
2827
|
}
|
|
2845
2828
|
if (DATE_TYPES.has(dataType)) {
|
|
2846
2829
|
const inputType = dataType === 'DATE' ? 'date' : 'time';
|
|
@@ -2855,18 +2838,18 @@ const MrdTable = class {
|
|
|
2855
2838
|
else {
|
|
2856
2839
|
this.pendingFilter = Object.assign(Object.assign({}, pf), { operator: undefined });
|
|
2857
2840
|
}
|
|
2858
|
-
} }, index.h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), index.h("option", { value: "isEmpty", selected: dtdOp === 'isEmpty' }, t('filter_is_empty', this.locale)), index.h("option", { value: "isNotEmpty", selected: dtdOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (index.h("div", { class: "mrd-table__filter-editor" }, index.h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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 ? (index.h("input", { type: inputType, class: "mrd-table__filter-input", value: String((
|
|
2841
|
+
} }, index.h("option", { value: "", selected: !noInput }, t('filter_has_value', this.locale)), index.h("option", { value: "isEmpty", selected: dtdOp === 'isEmpty' }, t('filter_is_empty', this.locale)), index.h("option", { value: "isNotEmpty", selected: dtdOp === 'isNotEmpty' }, t('filter_is_not_empty', this.locale))), !noInput && (index.h("div", { class: "mrd-table__filter-editor" }, index.h("div", { class: "mrd-table__filter-radio-group mrd-table__filter-radio-group--inline" }, index.h("label", { class: "mrd-table__filter-radio-label" }, index.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)), index.h("label", { class: "mrd-table__filter-radio-label" }, index.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 ? (index.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) })) : (index.h("div", { class: "mrd-table__filter-range" }, index.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) }), index.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) })))))));
|
|
2859
2842
|
}
|
|
2860
2843
|
return null;
|
|
2861
2844
|
}
|
|
2862
2845
|
renderFilterPopup() {
|
|
2863
|
-
var _a
|
|
2846
|
+
var _a;
|
|
2864
2847
|
if (!this.openFilterCol || !this.pendingFilter)
|
|
2865
2848
|
return null;
|
|
2866
2849
|
const col = this.columns.find(c => this.colName(c) === this.openFilterCol);
|
|
2867
2850
|
if (!col)
|
|
2868
2851
|
return null;
|
|
2869
|
-
const label = (
|
|
2852
|
+
const label = (_a = col.label) !== null && _a !== void 0 ? _a : this.openFilterCol;
|
|
2870
2853
|
const sortActive = this.sortField === this.openFilterCol;
|
|
2871
2854
|
return (index.h("div", { class: "mrd-table__filter-popup", style: { top: `${this.popupPos.top}px`, left: `${this.popupPos.left}px` }, onClick: (e) => e.stopPropagation() }, index.h("div", { class: "mrd-table__filter-popup-header" }, index.h("span", { class: "mrd-table__filter-popup-title" }, label), index.h("button", { class: "mrd-table__filter-close", onClick: () => this.closeFilterPopup() }, "\u2715")), index.h("div", { class: "mrd-table__filter-section" }, index.h("div", { class: "mrd-table__filter-section-label" }, t('filter_sorting', this.locale)), index.h("div", { class: "mrd-table__filter-sort-buttons" }, index.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)), index.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)))), index.h("div", { class: "mrd-table__filter-divider" }), index.h("div", { class: "mrd-table__filter-section" }, index.h("div", { class: "mrd-table__filter-section-label" }, t('filter_section', this.locale)), this.renderFilterEditor(col)), index.h("div", { class: "mrd-table__filter-popup-footer" }, index.h("button", { class: "mrd-table__filter-btn mrd-table__filter-btn--clear", onClick: () => this.clearFilter() }, t('filter_clear', this.locale)), index.h("button", { class: "mrd-table__filter-btn mrd-table__filter-btn--apply", onClick: () => this.applyFilter() }, t('filter_apply', this.locale)))));
|
|
2872
2855
|
}
|
|
@@ -2893,13 +2876,13 @@ const MrdTable = class {
|
|
|
2893
2876
|
}
|
|
2894
2877
|
// ── Render: cell ──────────────────────────────────────────────────────────
|
|
2895
2878
|
renderCell(col, row) {
|
|
2896
|
-
var _a, _b, _c
|
|
2879
|
+
var _a, _b, _c;
|
|
2897
2880
|
const numericTypes = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
|
|
2898
|
-
const dataType = (
|
|
2881
|
+
const dataType = (_a = col.dataType) !== null && _a !== void 0 ? _a : '';
|
|
2899
2882
|
const isNumeric = col.type === 'FIELD' && numericTypes.has(dataType);
|
|
2900
2883
|
const isFile = col.type === 'FIELD' && (dataType === 'FILE' || dataType === 'IMAGE');
|
|
2901
2884
|
if (isFile) {
|
|
2902
|
-
const name = (
|
|
2885
|
+
const name = (_b = col.name) !== null && _b !== void 0 ? _b : '';
|
|
2903
2886
|
const fileVal = row === null || row === void 0 ? void 0 : row[name];
|
|
2904
2887
|
const href = fileVal === null || fileVal === void 0 ? void 0 : fileVal.href;
|
|
2905
2888
|
const fileName = fileVal === null || fileVal === void 0 ? void 0 : fileVal.fileName;
|
|
@@ -2909,7 +2892,7 @@ const MrdTable = class {
|
|
|
2909
2892
|
} }, index.h("svg", { class: "mrd-table__file-icon", viewBox: "0 0 24 24", "aria-hidden": "true" }, index.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))) : ''));
|
|
2910
2893
|
}
|
|
2911
2894
|
if (dataType === 'JSON') {
|
|
2912
|
-
const name = (
|
|
2895
|
+
const name = (_c = col.name) !== null && _c !== void 0 ? _c : '';
|
|
2913
2896
|
const rawValue = name ? row === null || row === void 0 ? void 0 : row[name] : undefined;
|
|
2914
2897
|
if (rawValue == null || rawValue === '')
|
|
2915
2898
|
return index.h("td", { class: "mrd-table__cell" });
|
|
@@ -2933,12 +2916,12 @@ const MrdTable = class {
|
|
|
2933
2916
|
renderTotalsRow() {
|
|
2934
2917
|
if (!this.aggregations)
|
|
2935
2918
|
return null;
|
|
2936
|
-
if (!this.columns.some(c =>
|
|
2919
|
+
if (!this.columns.some(c => c.type === 'FIELD' && c.aggregate))
|
|
2937
2920
|
return null;
|
|
2938
2921
|
return (index.h("tfoot", null, index.h("tr", { class: "mrd-table__totals-row" }, this.columns.map(col => {
|
|
2939
|
-
var _a
|
|
2922
|
+
var _a;
|
|
2940
2923
|
const val = this.renderAggregationValue(col);
|
|
2941
|
-
const isNumeric = col.type === 'FIELD' && NUMERIC_TYPES.has((
|
|
2924
|
+
const isNumeric = col.type === 'FIELD' && NUMERIC_TYPES.has((_a = col.dataType) !== null && _a !== void 0 ? _a : '');
|
|
2942
2925
|
return (index.h("td", { class: `mrd-table__totals-cell${isNumeric ? ' mrd-table__totals-cell--numeric' : ''}` }, val));
|
|
2943
2926
|
}))));
|
|
2944
2927
|
}
|
|
@@ -2950,7 +2933,7 @@ const MrdTable = class {
|
|
|
2950
2933
|
// ── Non-paginated mode ──────────────────────────────────────────────────
|
|
2951
2934
|
if (this.totalElements === 0) {
|
|
2952
2935
|
return (index.h(index.Host, null, this.renderToolbar(), index.h("div", { class: "mrd-table" }, index.h("table", { class: "mrd-table__table" }, index.h("thead", null, index.h("tr", null, this.columns.map(col => {
|
|
2953
|
-
var _a
|
|
2936
|
+
var _a;
|
|
2954
2937
|
const name = this.colName(col);
|
|
2955
2938
|
const isFiltered = this.activeFilters.has(name);
|
|
2956
2939
|
const cls = [
|
|
@@ -2958,7 +2941,7 @@ const MrdTable = class {
|
|
|
2958
2941
|
isFiltered ? 'mrd-table__header--filtered' : '',
|
|
2959
2942
|
this.filterMode ? 'mrd-table__header--sortable' : '',
|
|
2960
2943
|
].filter(Boolean).join(' ');
|
|
2961
|
-
return (index.h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, index.h("span", { class: "mrd-table__header-label" }, (
|
|
2944
|
+
return (index.h("th", { class: cls, onClick: this.filterMode ? (e) => this.handleFilterOpen(col, e) : undefined }, index.h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isFiltered && this.renderFilterIcon()));
|
|
2962
2945
|
}))), index.h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (index.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) && (index.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()));
|
|
2963
2946
|
}
|
|
2964
2947
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
@@ -2991,7 +2974,7 @@ const MrdTable = class {
|
|
|
2991
2974
|
}
|
|
2992
2975
|
}
|
|
2993
2976
|
return (index.h(index.Host, null, this.renderToolbar(), index.h("div", { class: "mrd-table__scroll", style: { height: `${this.tableHeight}px` }, onScroll: this.handleScroll }, index.h("table", { class: "mrd-table__table", style: tableStyle }, index.h("thead", null, index.h("tr", null, this.columns.map((col, idx) => {
|
|
2994
|
-
var _a
|
|
2977
|
+
var _a;
|
|
2995
2978
|
const name = this.colName(col);
|
|
2996
2979
|
const isActive = this.sortField === name;
|
|
2997
2980
|
const isFiltered = this.activeFilters.has(name);
|
|
@@ -3002,7 +2985,7 @@ const MrdTable = class {
|
|
|
3002
2985
|
isActive ? `mrd-table__header--sorted-${this.sortDir}` : '',
|
|
3003
2986
|
isFiltered ? 'mrd-table__header--filtered' : '',
|
|
3004
2987
|
].filter(Boolean).join(' ');
|
|
3005
|
-
return (index.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 }, index.h("span", { class: "mrd-table__header-label" }, (
|
|
2988
|
+
return (index.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 }, index.h("span", { class: "mrd-table__header-label" }, (_a = col.label) !== null && _a !== void 0 ? _a : ''), isInteractive && isActive && (index.h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, this.sortDir === 'asc' ? '▲' : '▼')), isInteractive && !isActive && !this.filterMode && (index.h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, "\u21C5")), isInteractive && isFiltered && this.renderFilterIcon()));
|
|
3006
2989
|
}))), index.h("tbody", null, topSpacerHeight > 0 && (index.h("tr", { class: "mrd-table__spacer", style: { height: `${topSpacerHeight}px` } }, index.h("td", { colSpan: colCount }))), renderedRows, bottomSpacerHeight > 0 && (index.h("tr", { class: "mrd-table__spacer", style: { height: `${bottomSpacerHeight}px` } }, index.h("td", { colSpan: colCount })))), this.renderTotalsRow())), effectiveTotal === 0 && this.loadedPages.has(0) && (index.h("p", { class: "mrd-table__empty" }, t('no_results', this.locale))), effectiveTotal > 0 && this.renderFooter(undefined, effectiveTotal), this.renderFilterPopup(), this.renderTextblockModal()));
|
|
3007
2990
|
}
|
|
3008
2991
|
renderFilterIcon() {
|