@mmlogic/components 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +31 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/mrd-boolean-field_16.cjs.entry.js +17 -15
- package/dist/cjs/mrd-table.cjs.entry.js +45 -31
- package/dist/collection/components/mrd-field/mrd-field.js +1 -1
- package/dist/collection/components/mrd-list-field/mrd-list-field.js +17 -15
- package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +2 -2
- package/dist/collection/components/mrd-table/mrd-table.js +19 -10
- package/dist/collection/types/client-layout.js +31 -0
- package/dist/collection/utils/cell-renderer.js +15 -10
- package/dist/components/client-layout.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-field2.js +1 -1
- package/dist/components/mrd-form.js +1 -1
- package/dist/components/mrd-list-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-relation-field2.js +1 -1
- package/dist/components/mrd-table.js +1 -1
- package/dist/components/validation.js +1 -1
- package/dist/esm/index.js +32 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_16.entry.js +17 -15
- package/dist/esm/mrd-table.entry.js +33 -19
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-09392901.entry.js +1 -0
- package/dist/mosterdcomponents/p-baf08615.entry.js +1 -0
- package/dist/types/components/mrd-list-field/mrd-list-field.d.ts +2 -1
- package/dist/types/components/mrd-table/mrd-table.d.ts +1 -0
- package/dist/types/components.d.ts +4 -2
- package/dist/types/types/client-layout.d.ts +104 -14
- package/dist/types/utils/cell-renderer.d.ts +3 -10
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-3bc76431.entry.js +0 -1
- package/dist/mosterdcomponents/p-61dac880.entry.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// ─── Layout type ──────────────────────────────────────────────────────────────
|
|
4
|
+
exports.ClientLayoutType = void 0;
|
|
5
|
+
(function (ClientLayoutType) {
|
|
6
|
+
ClientLayoutType["OBJECT_FORM_DASHBOARD"] = "OBJECT_FORM_DASHBOARD";
|
|
7
|
+
ClientLayoutType["CLASS_DASHBOARD"] = "CLASS_DASHBOARD";
|
|
8
|
+
ClientLayoutType["GENERAL_DASHBOARD"] = "GENERAL_DASHBOARD";
|
|
9
|
+
ClientLayoutType["NAVIGATION_PANE"] = "NAVIGATION_PANE";
|
|
10
|
+
})(exports.ClientLayoutType || (exports.ClientLayoutType = {}));
|
|
11
|
+
// ─── Item types ───────────────────────────────────────────────────────────────
|
|
3
12
|
exports.ClientLayoutItemType = void 0;
|
|
4
13
|
(function (ClientLayoutItemType) {
|
|
14
|
+
// Form / data input
|
|
5
15
|
ClientLayoutItemType["FIELD"] = "FIELD";
|
|
6
16
|
ClientLayoutItemType["RELATION"] = "RELATION";
|
|
17
|
+
// Layout structure
|
|
7
18
|
ClientLayoutItemType["SECTION"] = "SECTION";
|
|
8
19
|
ClientLayoutItemType["GROUP"] = "GROUP";
|
|
20
|
+
// Read-only / display
|
|
21
|
+
ClientLayoutItemType["HEADER"] = "HEADER";
|
|
22
|
+
ClientLayoutItemType["TEXT"] = "TEXT";
|
|
23
|
+
// Navigation / actions
|
|
24
|
+
ClientLayoutItemType["NAVIGATE"] = "NAVIGATE";
|
|
25
|
+
ClientLayoutItemType["ACTION"] = "ACTION";
|
|
26
|
+
ClientLayoutItemType["SEARCH"] = "SEARCH";
|
|
27
|
+
// Dashboard views
|
|
28
|
+
ClientLayoutItemType["VIEW"] = "VIEW";
|
|
29
|
+
ClientLayoutItemType["RELATED_VIEW"] = "RELATED_VIEW";
|
|
30
|
+
ClientLayoutItemType["RELATED_OBJECT"] = "RELATED_OBJECT";
|
|
9
31
|
})(exports.ClientLayoutItemType || (exports.ClientLayoutItemType = {}));
|
|
32
|
+
// ─── Field data types ─────────────────────────────────────────────────────────
|
|
10
33
|
exports.ClientLayoutItemFieldDataType = void 0;
|
|
11
34
|
(function (ClientLayoutItemFieldDataType) {
|
|
12
35
|
ClientLayoutItemFieldDataType["TEXT"] = "TEXT";
|
|
@@ -25,8 +48,16 @@ exports.ClientLayoutItemFieldDataType = void 0;
|
|
|
25
48
|
ClientLayoutItemFieldDataType["FILE"] = "FILE";
|
|
26
49
|
ClientLayoutItemFieldDataType["IMAGE"] = "IMAGE";
|
|
27
50
|
})(exports.ClientLayoutItemFieldDataType || (exports.ClientLayoutItemFieldDataType = {}));
|
|
51
|
+
// ─── Relation display / edit behaviour ───────────────────────────────────────
|
|
28
52
|
exports.ClientLayoutItemRelationDisplayType = void 0;
|
|
29
53
|
(function (ClientLayoutItemRelationDisplayType) {
|
|
30
54
|
ClientLayoutItemRelationDisplayType["SEARCH"] = "SEARCH";
|
|
31
55
|
ClientLayoutItemRelationDisplayType["DROPDOWN"] = "DROPDOWN";
|
|
56
|
+
ClientLayoutItemRelationDisplayType["CHECKBOX"] = "CHECKBOX";
|
|
32
57
|
})(exports.ClientLayoutItemRelationDisplayType || (exports.ClientLayoutItemRelationDisplayType = {}));
|
|
58
|
+
exports.ClientLayoutItemRelationEditBehavior = void 0;
|
|
59
|
+
(function (ClientLayoutItemRelationEditBehavior) {
|
|
60
|
+
ClientLayoutItemRelationEditBehavior["SEARCH"] = "SEARCH";
|
|
61
|
+
ClientLayoutItemRelationEditBehavior["DROPDOWN"] = "DROPDOWN";
|
|
62
|
+
ClientLayoutItemRelationEditBehavior["CHECKBOX"] = "CHECKBOX";
|
|
63
|
+
})(exports.ClientLayoutItemRelationEditBehavior || (exports.ClientLayoutItemRelationEditBehavior = {}));
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["mrd-table.cjs",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"init":[64],"setPage":[64]}]]],["mrd-boolean-field_16.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"
|
|
9
|
+
return index.bootstrapLazy([["mrd-table.cjs",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"init":[64],"setPage":[64]}]]],["mrd-boolean-field_16.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"displayType":[1,"display-type"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["mrd-table.cjs",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"init":[64],"setPage":[64]}]]],["mrd-boolean-field_16.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"
|
|
22
|
+
return index.bootstrapLazy([["mrd-table.cjs",[[2,"mrd-table",{"columns":[16],"rows":[16],"locale":[1],"totalElements":[2,"total-elements"],"pageSize":[2,"page-size"],"rowHeight":[2,"row-height"],"tableHeight":[2,"table-height"],"defaultSort":[1,"default-sort"],"loadedPages":[32],"requestedPages":[32],"renderStart":[32],"renderEnd":[32],"colWidths":[32],"sortField":[32],"sortDir":[32],"init":[64],"setPage":[64]}]]],["mrd-boolean-field_16.cjs",[[2,"mrd-form",{"layout":[16],"locale":[1],"values":[16],"formValues":[32],"errors":[32],"submitted":[32],"setFieldValue":[64]},null,{"values":[{"valuesChanged":0}]}],[2,"mrd-field",{"item":[16],"locale":[1],"value":[16]}],[2,"mrd-boolean-field",{"name":[1],"label":[1],"value":[4],"required":[4],"disabled":[4],"locale":[1],"checked":[32]}],[2,"mrd-currency-field",{"name":[1],"label":[1],"value":[16],"required":[4],"disabled":[4],"locale":[1],"amountDisplay":[32],"currency":[32],"error":[32]}],[2,"mrd-date-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-datetime-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-email-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-file-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-hyperlink-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-image-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"accept":[1],"maxSize":[2,"max-size"],"previewUrl":[32],"fileName":[32],"isDragging":[32],"error":[32]}],[2,"mrd-list-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"multiple":[4],"locale":[1],"listItems":[16],"error":[32],"selected":[32]}],[2,"mrd-number-field",{"name":[1],"label":[1],"value":[2],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"dataType":[1,"data-type"],"decimalPrecision":[2,"decimal-precision"],"displayValue":[32],"error":[32]}],[2,"mrd-relation-field",{"name":[1],"label":[1],"required":[4],"disabled":[4],"locale":[1],"relatedClass":[1,"related-class"],"displayType":[1,"display-type"],"multiple":[4],"dropdownValues":[16],"value":[1],"searchQuery":[32],"searchResults":[32],"isLoading":[32],"selectedItems":[32],"showResults":[32],"error":[32],"highlightedIndex":[32],"setSearchResults":[64],"setLoading":[64]}],[2,"mrd-text-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}],[2,"mrd-textarea-field",{"name":[1],"label":[1],"value":[1],"placeholder":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32],"editorReady":[32]}],[2,"mrd-time-field",{"name":[1],"label":[1],"value":[1],"required":[4],"disabled":[4],"locale":[1],"error":[32]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -394,7 +394,7 @@ const MrdField = class {
|
|
|
394
394
|
case index$1.ClientLayoutItemFieldDataType.HYPERLINK:
|
|
395
395
|
return (index.h(index.Host, null, index.h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x = field.placeholder) !== null && _x !== void 0 ? _x : '' }))));
|
|
396
396
|
case index$1.ClientLayoutItemFieldDataType.LIST:
|
|
397
|
-
return (index.h(index.Host, null, index.h("mrd-list-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', multiple: (_z = field.multiple) !== null && _z !== void 0 ? _z : false,
|
|
397
|
+
return (index.h(index.Host, null, index.h("mrd-list-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', multiple: (_z = field.multiple) !== null && _z !== void 0 ? _z : false, listItems: (_0 = field.listItems) !== null && _0 !== void 0 ? _0 : [] }))));
|
|
398
398
|
case index$1.ClientLayoutItemFieldDataType.FILE:
|
|
399
399
|
return (index.h(index.Host, null, index.h("mrd-file-field", Object.assign({}, commonProps, { accept: (_1 = field.accept) !== null && _1 !== void 0 ? _1 : '', maxSize: (_2 = field.maxSize) !== null && _2 !== void 0 ? _2 : 0 }))));
|
|
400
400
|
case index$1.ClientLayoutItemFieldDataType.IMAGE:
|
|
@@ -719,7 +719,8 @@ const MrdListField = class {
|
|
|
719
719
|
this.disabled = false;
|
|
720
720
|
this.multiple = false;
|
|
721
721
|
this.locale = navigator.language;
|
|
722
|
-
|
|
722
|
+
/** List items from the API. Each item has a `key` (stored value) and `label`. */
|
|
723
|
+
this.listItems = [];
|
|
723
724
|
this.error = '';
|
|
724
725
|
this.selected = [];
|
|
725
726
|
this.handleSelectChange = (e) => {
|
|
@@ -750,12 +751,12 @@ const MrdListField = class {
|
|
|
750
751
|
const val = this.multiple ? this.selected : this.value;
|
|
751
752
|
this.mrdBlur.emit({ name: this.name, value: val });
|
|
752
753
|
};
|
|
753
|
-
this.toggleCheckbox = (
|
|
754
|
-
if (this.selected.includes(
|
|
755
|
-
this.selected = this.selected.filter(v => v !==
|
|
754
|
+
this.toggleCheckbox = (key) => {
|
|
755
|
+
if (this.selected.includes(key)) {
|
|
756
|
+
this.selected = this.selected.filter(v => v !== key);
|
|
756
757
|
}
|
|
757
758
|
else {
|
|
758
|
-
this.selected = [...this.selected,
|
|
759
|
+
this.selected = [...this.selected, key];
|
|
759
760
|
}
|
|
760
761
|
if (this.required && !validateRequired(this.selected)) {
|
|
761
762
|
this.error = t('required', this.locale);
|
|
@@ -786,15 +787,16 @@ const MrdListField = class {
|
|
|
786
787
|
const hasError = !!this.error;
|
|
787
788
|
const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
|
|
788
789
|
if (this.multiple) {
|
|
789
|
-
|
|
790
|
-
|
|
790
|
+
return (index.h(index.Host, null, index.h("div", { class: "mrd-list-field" }, this.label && (index.h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), index.h("div", { class: `mrd-list-field__checkbox-list${hasError ? ' mrd-list-field__checkbox-list--error' : ''}` }, this.listItems.map(lv => {
|
|
791
|
+
var _a, _b;
|
|
792
|
+
return (index.h("label", { key: lv.key, class: "mrd-list-field__checkbox-item" }, index.h("input", { type: "checkbox", checked: this.selected.includes(lv.key), disabled: this.disabled, onChange: () => this.toggleCheckbox(lv.key) }), (lv.color || lv.backgroundColor) && (index.h("span", { class: "mrd-list-field__color-dot", style: { backgroundColor: (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : '' } })), index.h("span", null, lv.label)));
|
|
793
|
+
})), hasError && index.h("span", { class: "mrd-list-field__error" }, this.error))));
|
|
791
794
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
return (index.h("option", { key: lv.value, value: lv.value, selected: lv.value === currentValue, style: style }, lv.label));
|
|
795
|
+
return (index.h(index.Host, null, index.h("div", { class: "mrd-list-field" }, this.label && (index.h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), index.h("select", { class: `mrd-list-field__select${hasError ? ' mrd-list-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleSelectChange, onBlur: this.handleBlur }, index.h("option", { value: "" }, t('select_placeholder', this.locale)), this.listItems.map(lv => {
|
|
796
|
+
var _a, _b;
|
|
797
|
+
const bg = (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : null;
|
|
798
|
+
const style = bg ? { backgroundColor: bg, color: this.getContrastColor(bg) } : {};
|
|
799
|
+
return (index.h("option", { key: lv.key, value: lv.key, selected: lv.key === currentValue, style: style }, lv.label));
|
|
798
800
|
})), hasError && index.h("span", { class: "mrd-list-field__error" }, this.error))));
|
|
799
801
|
}
|
|
800
802
|
};
|
|
@@ -1036,7 +1038,7 @@ const MrdRelationField = class {
|
|
|
1036
1038
|
const hasError = !!this.error;
|
|
1037
1039
|
if (this.displayType === index$1.ClientLayoutItemRelationDisplayType.DROPDOWN) {
|
|
1038
1040
|
const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
|
|
1039
|
-
return (index.h(index.Host, null, index.h("div", { class: "mrd-relation-field" }, this.label && (index.h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), index.h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, index.h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (index.h("option", { key: dv.
|
|
1041
|
+
return (index.h(index.Host, null, index.h("div", { class: "mrd-relation-field" }, this.label && (index.h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), index.h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, index.h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (index.h("option", { key: dv.key, value: dv.key, selected: dv.key === currentValue }, dv.label)))), hasError && index.h("span", { class: "mrd-relation-field__error" }, this.error))));
|
|
1040
1042
|
}
|
|
1041
1043
|
// SEARCH mode
|
|
1042
1044
|
const labelEl = this.label && (index.h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label));
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-BPj2cBXs.js');
|
|
3
|
+
var index$1 = require('./index-BPj2cBXs.js');
|
|
4
4
|
var format = require('./format-CDw-zie_.js');
|
|
5
|
+
var index = require('./index.cjs.js');
|
|
5
6
|
|
|
6
7
|
class CellRenderer {
|
|
7
8
|
static render(column, row, locale) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
if (column.type ===
|
|
10
|
-
const
|
|
9
|
+
var _a, _b, _c, _d;
|
|
10
|
+
if (column.type === index.ClientLayoutItemType.RELATION) {
|
|
11
|
+
const name = (_b = (_a = column.relation) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '';
|
|
12
|
+
const link = (_c = row === null || row === void 0 ? void 0 : row._links) === null || _c === void 0 ? void 0 : _c[name];
|
|
11
13
|
if (!link)
|
|
12
14
|
return '';
|
|
13
15
|
if (Array.isArray(link))
|
|
14
16
|
return link.map((l) => { var _a; return (_a = l.name) !== null && _a !== void 0 ? _a : ''; }).filter(Boolean).join(', ');
|
|
15
|
-
return (
|
|
17
|
+
return (_d = link.name) !== null && _d !== void 0 ? _d : '';
|
|
16
18
|
}
|
|
17
|
-
|
|
19
|
+
if (column.type !== index.ClientLayoutItemType.FIELD || !column.field)
|
|
20
|
+
return '';
|
|
21
|
+
const { name, dataType, listItems } = column.field;
|
|
22
|
+
const raw = row === null || row === void 0 ? void 0 : row[name];
|
|
18
23
|
if (raw == null || raw === '')
|
|
19
24
|
return '';
|
|
20
25
|
const values = Array.isArray(raw) ? raw : [raw];
|
|
21
26
|
return values
|
|
22
|
-
.map(v =>
|
|
27
|
+
.map(v => CellRenderer.renderValue(dataType !== null && dataType !== void 0 ? dataType : 'TEXT', v, listItems !== null && listItems !== void 0 ? listItems : [], locale))
|
|
23
28
|
.filter(s => s !== '')
|
|
24
29
|
.join(', ');
|
|
25
30
|
}
|
|
26
|
-
static renderValue(dataType, value,
|
|
27
|
-
var _a
|
|
31
|
+
static renderValue(dataType, value, listItems, locale) {
|
|
32
|
+
var _a;
|
|
28
33
|
switch (dataType) {
|
|
29
34
|
case 'INTEGER':
|
|
30
35
|
return format.formatNumber(Number(value), locale, { maximumFractionDigits: 0 });
|
|
@@ -49,8 +54,8 @@ class CellRenderer {
|
|
|
49
54
|
case 'BOOLEAN':
|
|
50
55
|
return value ? '✓' : '';
|
|
51
56
|
case 'LIST': {
|
|
52
|
-
const item =
|
|
53
|
-
return (
|
|
57
|
+
const item = listItems.find(li => li.key === String(value));
|
|
58
|
+
return (_a = item === null || item === void 0 ? void 0 : item.label) !== null && _a !== void 0 ? _a : String(value);
|
|
54
59
|
}
|
|
55
60
|
case 'TEXTBLOCK':
|
|
56
61
|
return String(value).replace(/<[^>]*>/g, '').trim();
|
|
@@ -68,9 +73,9 @@ const BUFFER = 10;
|
|
|
68
73
|
const REQUEST_DEBOUNCE_MS = 150;
|
|
69
74
|
const MrdTable = class {
|
|
70
75
|
constructor(hostRef) {
|
|
71
|
-
index.registerInstance(this, hostRef);
|
|
72
|
-
this.mrdLoadPage = index.createEvent(this, "mrdLoadPage");
|
|
73
|
-
this.mrdRowClick = index.createEvent(this, "mrdRowClick");
|
|
76
|
+
index$1.registerInstance(this, hostRef);
|
|
77
|
+
this.mrdLoadPage = index$1.createEvent(this, "mrdLoadPage");
|
|
78
|
+
this.mrdRowClick = index$1.createEvent(this, "mrdRowClick");
|
|
74
79
|
// ── Debounce internals (geen @State — triggert geen re-render) ─────────────
|
|
75
80
|
/** Pagina's die wachten op debounce-flush. */
|
|
76
81
|
this.pendingPages = new Set();
|
|
@@ -172,12 +177,17 @@ const MrdTable = class {
|
|
|
172
177
|
return this.sortDir === 'desc' ? `${this.sortField},desc` : this.sortField;
|
|
173
178
|
}
|
|
174
179
|
/** Called when a header cell is clicked. Toggles direction or sets a new column. */
|
|
180
|
+
colName(col) {
|
|
181
|
+
var _a, _b, _c, _d;
|
|
182
|
+
return (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
|
|
183
|
+
}
|
|
175
184
|
handleSortClick(col) {
|
|
176
|
-
|
|
185
|
+
const name = this.colName(col);
|
|
186
|
+
if (this.sortField === name) {
|
|
177
187
|
this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
|
|
178
188
|
}
|
|
179
189
|
else {
|
|
180
|
-
this.sortField =
|
|
190
|
+
this.sortField = name;
|
|
181
191
|
this.sortDir = 'asc';
|
|
182
192
|
}
|
|
183
193
|
// Cancel any pending scroll debounce.
|
|
@@ -280,12 +290,15 @@ const MrdTable = class {
|
|
|
280
290
|
const numericTypes = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
|
|
281
291
|
// ── Non-paginated mode ──────────────────────────────────────────────────
|
|
282
292
|
if (this.totalElements === 0) {
|
|
283
|
-
return (index.h(index.Host, null, 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 =>
|
|
284
|
-
var _a;
|
|
293
|
+
return (index$1.h(index$1.Host, null, index$1.h("div", { class: "mrd-table" }, index$1.h("table", { class: "mrd-table__table" }, index$1.h("thead", null, index$1.h("tr", null, this.columns.map(col => {
|
|
294
|
+
var _a, _b, _c, _d;
|
|
295
|
+
return (index$1.h("th", { class: "mrd-table__header" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''));
|
|
296
|
+
}))), index$1.h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (index$1.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 => {
|
|
297
|
+
var _a, _b;
|
|
285
298
|
const value = CellRenderer.render(col, row, this.locale);
|
|
286
|
-
const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null &&
|
|
287
|
-
return (index.h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
288
|
-
})))))), (!this.rows || this.rows.length === 0) && (index.h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden.")))));
|
|
299
|
+
const isNumeric = col.type === 'FIELD' && numericTypes.has((_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : '');
|
|
300
|
+
return (index$1.h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
301
|
+
})))))), (!this.rows || this.rows.length === 0) && (index$1.h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden.")))));
|
|
289
302
|
}
|
|
290
303
|
// ── Paginated / virtual-scroll mode ────────────────────────────────────
|
|
291
304
|
const total = this.totalElements;
|
|
@@ -296,27 +309,28 @@ const MrdTable = class {
|
|
|
296
309
|
for (let i = this.renderStart; i <= this.renderEnd; i++) {
|
|
297
310
|
const row = this.getRow(i);
|
|
298
311
|
if (row === null) {
|
|
299
|
-
renderedRows.push(index.h("tr", { class: "mrd-table__row mrd-table__row--loading" }, index.h("td", { class: "mrd-table__cell--placeholder", colSpan: colCount }, index.h("span", { class: "mrd-table__placeholder-bar" }))));
|
|
312
|
+
renderedRows.push(index$1.h("tr", { class: "mrd-table__row mrd-table__row--loading" }, index$1.h("td", { class: "mrd-table__cell--placeholder", colSpan: colCount }, index$1.h("span", { class: "mrd-table__placeholder-bar" }))));
|
|
300
313
|
}
|
|
301
314
|
else {
|
|
302
|
-
renderedRows.push(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 => {
|
|
303
|
-
var _a;
|
|
315
|
+
renderedRows.push(index$1.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 => {
|
|
316
|
+
var _a, _b;
|
|
304
317
|
const value = CellRenderer.render(col, row, this.locale);
|
|
305
|
-
const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null &&
|
|
306
|
-
return (index.h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
318
|
+
const isNumeric = col.type === 'FIELD' && numericTypes.has((_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : '');
|
|
319
|
+
return (index$1.h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
307
320
|
})));
|
|
308
321
|
}
|
|
309
322
|
}
|
|
310
323
|
const tableStyle = this.colWidths.length > 0
|
|
311
324
|
? { tableLayout: 'fixed' }
|
|
312
325
|
: undefined;
|
|
313
|
-
return (index.h(index.Host, null, 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) => {
|
|
314
|
-
|
|
326
|
+
return (index$1.h(index$1.Host, null, index$1.h("div", { class: "mrd-table__scroll", style: { height: `${this.tableHeight}px` }, onScroll: this.handleScroll }, index$1.h("table", { class: "mrd-table__table", style: tableStyle }, index$1.h("thead", null, index$1.h("tr", null, this.columns.map((col, idx) => {
|
|
327
|
+
var _a, _b, _c, _d;
|
|
328
|
+
const isActive = this.sortField === this.colName(col);
|
|
315
329
|
const cls = `mrd-table__header mrd-table__header--sortable${isActive ? ` mrd-table__header--sorted-${this.sortDir}` : ''}`;
|
|
316
|
-
return (index.h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: () => this.handleSortClick(col) }, index.h("span", { class: "mrd-table__header-label" }, col.label), index.h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, isActive ? (this.sortDir === 'asc' ? '▲' : '▼') : '⇅')));
|
|
317
|
-
}))), 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 })))))), total === 0 && (index.h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden."))));
|
|
330
|
+
return (index$1.h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: () => this.handleSortClick(col) }, index$1.h("span", { class: "mrd-table__header-label" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''), index$1.h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, isActive ? (this.sortDir === 'asc' ? '▲' : '▼') : '⇅')));
|
|
331
|
+
}))), index$1.h("tbody", null, topSpacerHeight > 0 && (index$1.h("tr", { class: "mrd-table__spacer", style: { height: `${topSpacerHeight}px` } }, index$1.h("td", { colSpan: colCount }))), renderedRows, bottomSpacerHeight > 0 && (index$1.h("tr", { class: "mrd-table__spacer", style: { height: `${bottomSpacerHeight}px` } }, index$1.h("td", { colSpan: colCount })))))), total === 0 && (index$1.h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden."))));
|
|
318
332
|
}
|
|
319
|
-
get el() { return index.getElement(this); }
|
|
333
|
+
get el() { return index$1.getElement(this); }
|
|
320
334
|
};
|
|
321
335
|
MrdTable.style = mrdTableScss();
|
|
322
336
|
|
|
@@ -60,7 +60,7 @@ export class MrdField {
|
|
|
60
60
|
case ClientLayoutItemFieldDataType.HYPERLINK:
|
|
61
61
|
return (h(Host, null, h("mrd-hyperlink-field", Object.assign({}, commonProps, { value: (_w = value) !== null && _w !== void 0 ? _w : '', placeholder: (_x = field.placeholder) !== null && _x !== void 0 ? _x : '' }))));
|
|
62
62
|
case ClientLayoutItemFieldDataType.LIST:
|
|
63
|
-
return (h(Host, null, h("mrd-list-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', multiple: (_z = field.multiple) !== null && _z !== void 0 ? _z : false,
|
|
63
|
+
return (h(Host, null, h("mrd-list-field", Object.assign({}, commonProps, { value: (_y = value) !== null && _y !== void 0 ? _y : '', multiple: (_z = field.multiple) !== null && _z !== void 0 ? _z : false, listItems: (_0 = field.listItems) !== null && _0 !== void 0 ? _0 : [] }))));
|
|
64
64
|
case ClientLayoutItemFieldDataType.FILE:
|
|
65
65
|
return (h(Host, null, h("mrd-file-field", Object.assign({}, commonProps, { accept: (_1 = field.accept) !== null && _1 !== void 0 ? _1 : '', maxSize: (_2 = field.maxSize) !== null && _2 !== void 0 ? _2 : 0 }))));
|
|
66
66
|
case ClientLayoutItemFieldDataType.IMAGE:
|
|
@@ -10,7 +10,8 @@ export class MrdListField {
|
|
|
10
10
|
this.disabled = false;
|
|
11
11
|
this.multiple = false;
|
|
12
12
|
this.locale = navigator.language;
|
|
13
|
-
|
|
13
|
+
/** List items from the API. Each item has a `key` (stored value) and `label`. */
|
|
14
|
+
this.listItems = [];
|
|
14
15
|
this.error = '';
|
|
15
16
|
this.selected = [];
|
|
16
17
|
this.handleSelectChange = (e) => {
|
|
@@ -41,12 +42,12 @@ export class MrdListField {
|
|
|
41
42
|
const val = this.multiple ? this.selected : this.value;
|
|
42
43
|
this.mrdBlur.emit({ name: this.name, value: val });
|
|
43
44
|
};
|
|
44
|
-
this.toggleCheckbox = (
|
|
45
|
-
if (this.selected.includes(
|
|
46
|
-
this.selected = this.selected.filter(v => v !==
|
|
45
|
+
this.toggleCheckbox = (key) => {
|
|
46
|
+
if (this.selected.includes(key)) {
|
|
47
|
+
this.selected = this.selected.filter(v => v !== key);
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
|
-
this.selected = [...this.selected,
|
|
50
|
+
this.selected = [...this.selected, key];
|
|
50
51
|
}
|
|
51
52
|
if (this.required && !validateRequired(this.selected)) {
|
|
52
53
|
this.error = t('required', this.locale);
|
|
@@ -77,15 +78,16 @@ export class MrdListField {
|
|
|
77
78
|
const hasError = !!this.error;
|
|
78
79
|
const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
|
|
79
80
|
if (this.multiple) {
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
return (h(Host, null, h("div", { class: "mrd-list-field" }, this.label && (h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), h("div", { class: `mrd-list-field__checkbox-list${hasError ? ' mrd-list-field__checkbox-list--error' : ''}` }, this.listItems.map(lv => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return (h("label", { key: lv.key, class: "mrd-list-field__checkbox-item" }, h("input", { type: "checkbox", checked: this.selected.includes(lv.key), disabled: this.disabled, onChange: () => this.toggleCheckbox(lv.key) }), (lv.color || lv.backgroundColor) && (h("span", { class: "mrd-list-field__color-dot", style: { backgroundColor: (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : '' } })), h("span", null, lv.label)));
|
|
84
|
+
})), hasError && h("span", { class: "mrd-list-field__error" }, this.error))));
|
|
82
85
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return (h("option", { key: lv.value, value: lv.value, selected: lv.value === currentValue, style: style }, lv.label));
|
|
86
|
+
return (h(Host, null, h("div", { class: "mrd-list-field" }, this.label && (h("label", { class: `mrd-list-field__label${this.required ? ' mrd-list-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-list-field__select${hasError ? ' mrd-list-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleSelectChange, onBlur: this.handleBlur }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.listItems.map(lv => {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
const bg = (_b = (_a = lv.backgroundColor) !== null && _a !== void 0 ? _a : lv.color) !== null && _b !== void 0 ? _b : null;
|
|
89
|
+
const style = bg ? { backgroundColor: bg, color: this.getContrastColor(bg) } : {};
|
|
90
|
+
return (h("option", { key: lv.key, value: lv.key, selected: lv.key === currentValue, style: style }, lv.label));
|
|
89
91
|
})), hasError && h("span", { class: "mrd-list-field__error" }, this.error))));
|
|
90
92
|
}
|
|
91
93
|
static get is() { return "mrd-list-field"; }
|
|
@@ -242,7 +244,7 @@ export class MrdListField {
|
|
|
242
244
|
"attribute": "locale",
|
|
243
245
|
"defaultValue": "navigator.language"
|
|
244
246
|
},
|
|
245
|
-
"
|
|
247
|
+
"listItems": {
|
|
246
248
|
"type": "unknown",
|
|
247
249
|
"mutable": false,
|
|
248
250
|
"complexType": {
|
|
@@ -261,7 +263,7 @@ export class MrdListField {
|
|
|
261
263
|
"optional": false,
|
|
262
264
|
"docs": {
|
|
263
265
|
"tags": [],
|
|
264
|
-
"text": ""
|
|
266
|
+
"text": "List items from the API. Each item has a `key` (stored value) and `label`."
|
|
265
267
|
},
|
|
266
268
|
"getter": false,
|
|
267
269
|
"setter": false,
|
|
@@ -156,7 +156,7 @@ export class MrdRelationField {
|
|
|
156
156
|
const hasError = !!this.error;
|
|
157
157
|
if (this.displayType === ClientLayoutItemRelationDisplayType.DROPDOWN) {
|
|
158
158
|
const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
|
|
159
|
-
return (h(Host, null, h("div", { class: "mrd-relation-field" }, this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (h("option", { key: dv.
|
|
159
|
+
return (h(Host, null, h("div", { class: "mrd-relation-field" }, this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (h("option", { key: dv.key, value: dv.key, selected: dv.key === currentValue }, dv.label)))), hasError && h("span", { class: "mrd-relation-field__error" }, this.error))));
|
|
160
160
|
}
|
|
161
161
|
// SEARCH mode
|
|
162
162
|
const labelEl = this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label));
|
|
@@ -305,7 +305,7 @@ export class MrdRelationField {
|
|
|
305
305
|
"mutable": false,
|
|
306
306
|
"complexType": {
|
|
307
307
|
"original": "ClientLayoutItemRelationDisplayType",
|
|
308
|
-
"resolved": "ClientLayoutItemRelationDisplayType.DROPDOWN | ClientLayoutItemRelationDisplayType.SEARCH",
|
|
308
|
+
"resolved": "ClientLayoutItemRelationDisplayType.CHECKBOX | ClientLayoutItemRelationDisplayType.DROPDOWN | ClientLayoutItemRelationDisplayType.SEARCH",
|
|
309
309
|
"references": {
|
|
310
310
|
"ClientLayoutItemRelationDisplayType": {
|
|
311
311
|
"location": "import",
|
|
@@ -107,12 +107,17 @@ export class MrdTable {
|
|
|
107
107
|
return this.sortDir === 'desc' ? `${this.sortField},desc` : this.sortField;
|
|
108
108
|
}
|
|
109
109
|
/** Called when a header cell is clicked. Toggles direction or sets a new column. */
|
|
110
|
+
colName(col) {
|
|
111
|
+
var _a, _b, _c, _d;
|
|
112
|
+
return (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
|
|
113
|
+
}
|
|
110
114
|
handleSortClick(col) {
|
|
111
|
-
|
|
115
|
+
const name = this.colName(col);
|
|
116
|
+
if (this.sortField === name) {
|
|
112
117
|
this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
|
|
113
118
|
}
|
|
114
119
|
else {
|
|
115
|
-
this.sortField =
|
|
120
|
+
this.sortField = name;
|
|
116
121
|
this.sortDir = 'asc';
|
|
117
122
|
}
|
|
118
123
|
// Cancel any pending scroll debounce.
|
|
@@ -215,10 +220,13 @@ export class MrdTable {
|
|
|
215
220
|
const numericTypes = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
|
|
216
221
|
// ── Non-paginated mode ──────────────────────────────────────────────────
|
|
217
222
|
if (this.totalElements === 0) {
|
|
218
|
-
return (h(Host, null, h("div", { class: "mrd-table" }, h("table", { class: "mrd-table__table" }, h("thead", null, h("tr", null, this.columns.map(col =>
|
|
219
|
-
var _a;
|
|
223
|
+
return (h(Host, null, h("div", { class: "mrd-table" }, h("table", { class: "mrd-table__table" }, h("thead", null, h("tr", null, this.columns.map(col => {
|
|
224
|
+
var _a, _b, _c, _d;
|
|
225
|
+
return (h("th", { class: "mrd-table__header" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''));
|
|
226
|
+
}))), 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 => {
|
|
227
|
+
var _a, _b;
|
|
220
228
|
const value = CellRenderer.render(col, row, this.locale);
|
|
221
|
-
const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null &&
|
|
229
|
+
const isNumeric = col.type === 'FIELD' && numericTypes.has((_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : '');
|
|
222
230
|
return (h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
223
231
|
})))))), (!this.rows || this.rows.length === 0) && (h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden.")))));
|
|
224
232
|
}
|
|
@@ -235,9 +243,9 @@ export class MrdTable {
|
|
|
235
243
|
}
|
|
236
244
|
else {
|
|
237
245
|
renderedRows.push(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 => {
|
|
238
|
-
var _a;
|
|
246
|
+
var _a, _b;
|
|
239
247
|
const value = CellRenderer.render(col, row, this.locale);
|
|
240
|
-
const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null &&
|
|
248
|
+
const isNumeric = col.type === 'FIELD' && numericTypes.has((_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.dataType) !== null && _b !== void 0 ? _b : '');
|
|
241
249
|
return (h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
|
|
242
250
|
})));
|
|
243
251
|
}
|
|
@@ -246,9 +254,10 @@ export class MrdTable {
|
|
|
246
254
|
? { tableLayout: 'fixed' }
|
|
247
255
|
: undefined;
|
|
248
256
|
return (h(Host, null, 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) => {
|
|
249
|
-
|
|
257
|
+
var _a, _b, _c, _d;
|
|
258
|
+
const isActive = this.sortField === this.colName(col);
|
|
250
259
|
const cls = `mrd-table__header mrd-table__header--sortable${isActive ? ` mrd-table__header--sorted-${this.sortDir}` : ''}`;
|
|
251
|
-
return (h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: () => this.handleSortClick(col) }, h("span", { class: "mrd-table__header-label" }, col.label), h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, isActive ? (this.sortDir === 'asc' ? '▲' : '▼') : '⇅')));
|
|
260
|
+
return (h("th", { class: cls, style: this.colWidths[idx] ? { width: `${this.colWidths[idx]}px` } : undefined, onClick: () => this.handleSortClick(col) }, h("span", { class: "mrd-table__header-label" }, (_d = (_b = (_a = col.field) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : (_c = col.relation) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : ''), h("span", { class: "mrd-table__sort-icon", "aria-hidden": "true" }, isActive ? (this.sortDir === 'asc' ? '▲' : '▼') : '⇅')));
|
|
252
261
|
}))), 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 })))))), total === 0 && (h("p", { class: "mrd-table__empty" }, "Geen resultaten gevonden."))));
|
|
253
262
|
}
|
|
254
263
|
static get is() { return "mrd-table"; }
|
|
@@ -270,7 +279,7 @@ export class MrdTable {
|
|
|
270
279
|
"mutable": false,
|
|
271
280
|
"complexType": {
|
|
272
281
|
"original": "TableColumn[]",
|
|
273
|
-
"resolved": "
|
|
282
|
+
"resolved": "ClientLayoutItem[]",
|
|
274
283
|
"references": {
|
|
275
284
|
"TableColumn": {
|
|
276
285
|
"location": "import",
|
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
// ─── Layout type ──────────────────────────────────────────────────────────────
|
|
2
|
+
export var ClientLayoutType;
|
|
3
|
+
(function (ClientLayoutType) {
|
|
4
|
+
ClientLayoutType["OBJECT_FORM_DASHBOARD"] = "OBJECT_FORM_DASHBOARD";
|
|
5
|
+
ClientLayoutType["CLASS_DASHBOARD"] = "CLASS_DASHBOARD";
|
|
6
|
+
ClientLayoutType["GENERAL_DASHBOARD"] = "GENERAL_DASHBOARD";
|
|
7
|
+
ClientLayoutType["NAVIGATION_PANE"] = "NAVIGATION_PANE";
|
|
8
|
+
})(ClientLayoutType || (ClientLayoutType = {}));
|
|
9
|
+
// ─── Item types ───────────────────────────────────────────────────────────────
|
|
1
10
|
export var ClientLayoutItemType;
|
|
2
11
|
(function (ClientLayoutItemType) {
|
|
12
|
+
// Form / data input
|
|
3
13
|
ClientLayoutItemType["FIELD"] = "FIELD";
|
|
4
14
|
ClientLayoutItemType["RELATION"] = "RELATION";
|
|
15
|
+
// Layout structure
|
|
5
16
|
ClientLayoutItemType["SECTION"] = "SECTION";
|
|
6
17
|
ClientLayoutItemType["GROUP"] = "GROUP";
|
|
18
|
+
// Read-only / display
|
|
19
|
+
ClientLayoutItemType["HEADER"] = "HEADER";
|
|
20
|
+
ClientLayoutItemType["TEXT"] = "TEXT";
|
|
21
|
+
// Navigation / actions
|
|
22
|
+
ClientLayoutItemType["NAVIGATE"] = "NAVIGATE";
|
|
23
|
+
ClientLayoutItemType["ACTION"] = "ACTION";
|
|
24
|
+
ClientLayoutItemType["SEARCH"] = "SEARCH";
|
|
25
|
+
// Dashboard views
|
|
26
|
+
ClientLayoutItemType["VIEW"] = "VIEW";
|
|
27
|
+
ClientLayoutItemType["RELATED_VIEW"] = "RELATED_VIEW";
|
|
28
|
+
ClientLayoutItemType["RELATED_OBJECT"] = "RELATED_OBJECT";
|
|
7
29
|
})(ClientLayoutItemType || (ClientLayoutItemType = {}));
|
|
30
|
+
// ─── Field data types ─────────────────────────────────────────────────────────
|
|
8
31
|
export var ClientLayoutItemFieldDataType;
|
|
9
32
|
(function (ClientLayoutItemFieldDataType) {
|
|
10
33
|
ClientLayoutItemFieldDataType["TEXT"] = "TEXT";
|
|
@@ -23,8 +46,16 @@ export var ClientLayoutItemFieldDataType;
|
|
|
23
46
|
ClientLayoutItemFieldDataType["FILE"] = "FILE";
|
|
24
47
|
ClientLayoutItemFieldDataType["IMAGE"] = "IMAGE";
|
|
25
48
|
})(ClientLayoutItemFieldDataType || (ClientLayoutItemFieldDataType = {}));
|
|
49
|
+
// ─── Relation display / edit behaviour ───────────────────────────────────────
|
|
26
50
|
export var ClientLayoutItemRelationDisplayType;
|
|
27
51
|
(function (ClientLayoutItemRelationDisplayType) {
|
|
28
52
|
ClientLayoutItemRelationDisplayType["SEARCH"] = "SEARCH";
|
|
29
53
|
ClientLayoutItemRelationDisplayType["DROPDOWN"] = "DROPDOWN";
|
|
54
|
+
ClientLayoutItemRelationDisplayType["CHECKBOX"] = "CHECKBOX";
|
|
30
55
|
})(ClientLayoutItemRelationDisplayType || (ClientLayoutItemRelationDisplayType = {}));
|
|
56
|
+
export var ClientLayoutItemRelationEditBehavior;
|
|
57
|
+
(function (ClientLayoutItemRelationEditBehavior) {
|
|
58
|
+
ClientLayoutItemRelationEditBehavior["SEARCH"] = "SEARCH";
|
|
59
|
+
ClientLayoutItemRelationEditBehavior["DROPDOWN"] = "DROPDOWN";
|
|
60
|
+
ClientLayoutItemRelationEditBehavior["CHECKBOX"] = "CHECKBOX";
|
|
61
|
+
})(ClientLayoutItemRelationEditBehavior || (ClientLayoutItemRelationEditBehavior = {}));
|