@mmlogic/components 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/{index-OvnIRO4Y.js → index-BPj2cBXs.js} +48 -1
  2. package/dist/cjs/index.cjs.js +31 -0
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mosterdcomponents.cjs.js +2 -2
  5. package/dist/cjs/mrd-boolean-field_16.cjs.entry.js +48 -16
  6. package/dist/cjs/mrd-table.cjs.entry.js +46 -31
  7. package/dist/collection/components/mrd-field/mrd-field.js +1 -1
  8. package/dist/collection/components/mrd-form/mrd-form.js +13 -0
  9. package/dist/collection/components/mrd-list-field/mrd-list-field.js +17 -15
  10. package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +31 -6
  11. package/dist/collection/components/mrd-table/mrd-table.js +40 -11
  12. package/dist/collection/components/mrd-table/mrd-table.scss +4 -0
  13. package/dist/collection/types/client-layout.js +31 -0
  14. package/dist/collection/utils/cell-renderer.js +15 -10
  15. package/dist/components/client-layout.js +1 -1
  16. package/dist/components/index.js +1 -1
  17. package/dist/components/mrd-field2.js +1 -1
  18. package/dist/components/mrd-form.js +1 -1
  19. package/dist/components/mrd-list-field2.js +1 -1
  20. package/dist/components/mrd-number-field2.js +1 -1
  21. package/dist/components/mrd-relation-field2.js +1 -1
  22. package/dist/components/mrd-table.js +1 -1
  23. package/dist/components/validation.js +1 -1
  24. package/dist/esm/{index-DQ_he8te.js → index-_tsCCkAi.js} +48 -1
  25. package/dist/esm/index.js +32 -1
  26. package/dist/esm/loader.js +3 -3
  27. package/dist/esm/mosterdcomponents.js +3 -3
  28. package/dist/esm/mrd-boolean-field_16.entry.js +48 -16
  29. package/dist/esm/mrd-table.entry.js +37 -22
  30. package/dist/mosterdcomponents/index.esm.js +1 -1
  31. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  32. package/dist/mosterdcomponents/p-09392901.entry.js +1 -0
  33. package/dist/mosterdcomponents/p-_tsCCkAi.js +2 -0
  34. package/dist/mosterdcomponents/p-baf08615.entry.js +1 -0
  35. package/dist/types/components/mrd-form/mrd-form.d.ts +3 -0
  36. package/dist/types/components/mrd-list-field/mrd-list-field.d.ts +2 -1
  37. package/dist/types/components/mrd-relation-field/mrd-relation-field.d.ts +3 -1
  38. package/dist/types/components/mrd-table/mrd-table.d.ts +3 -0
  39. package/dist/types/components.d.ts +14 -5
  40. package/dist/types/types/client-layout.d.ts +104 -14
  41. package/dist/types/utils/cell-renderer.d.ts +3 -10
  42. package/package.json +1 -1
  43. package/dist/mosterdcomponents/p-88cd0930.entry.js +0 -1
  44. package/dist/mosterdcomponents/p-926ed331.entry.js +0 -1
  45. package/dist/mosterdcomponents/p-DQ_he8te.js +0 -2
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const NAMESPACE = 'mosterdcomponents';
4
- const BUILD = /* mosterdcomponents */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: false, state: true, updatable: true};
4
+ const BUILD = /* mosterdcomponents */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, state: true, updatable: true};
5
5
 
6
6
  /*
7
7
  Stencil Client Platform v4.43.2 | MIT Licensed | https://stenciljs.com
@@ -1077,6 +1077,7 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1077
1077
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
1078
1078
  );
1079
1079
  }
1080
+ const elm = hostRef.$hostElement$ ;
1080
1081
  const oldVal = hostRef.$instanceValues$.get(propName);
1081
1082
  const flags = hostRef.$flags$;
1082
1083
  const instance = hostRef.$lazyInstance$ ;
@@ -1087,6 +1088,27 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1087
1088
  const didValueChange = newVal !== oldVal && !areBothNaN;
1088
1089
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1089
1090
  hostRef.$instanceValues$.set(propName, newVal);
1091
+ if (cmpMeta.$watchers$) {
1092
+ const watchMethods = cmpMeta.$watchers$[propName];
1093
+ if (watchMethods) {
1094
+ watchMethods.map((watcher) => {
1095
+ try {
1096
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1097
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
1098
+ if (!instance) {
1099
+ hostRef.$fetchedCbList$.push(() => {
1100
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
1101
+ });
1102
+ } else {
1103
+ instance[watchMethodName](newVal, oldVal, propName);
1104
+ }
1105
+ }
1106
+ } catch (e) {
1107
+ consoleError(e, elm);
1108
+ }
1109
+ });
1110
+ }
1111
+ }
1090
1112
  if (flags & 2 /* hasRendered */) {
1091
1113
  if (instance.componentShouldUpdate) {
1092
1114
  const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
@@ -1106,6 +1128,17 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1106
1128
  var _a, _b;
1107
1129
  const prototype = Cstr.prototype;
1108
1130
  if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1131
+ {
1132
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1133
+ cmpMeta.$watchers$ = Cstr.watchers;
1134
+ }
1135
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
1136
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1137
+ }
1138
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
1139
+ cmpMeta.$serializers$ = Cstr.serializers;
1140
+ }
1141
+ }
1109
1142
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1110
1143
  members.map(([memberName, [memberFlags]]) => {
1111
1144
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
@@ -1267,6 +1300,11 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1267
1300
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1268
1301
  }
1269
1302
  if (!Cstr.isProxied) {
1303
+ {
1304
+ cmpMeta.$watchers$ = Cstr.watchers;
1305
+ cmpMeta.$serializers$ = Cstr.serializers;
1306
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1307
+ }
1270
1308
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1271
1309
  Cstr.isProxied = true;
1272
1310
  }
@@ -1282,6 +1320,9 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1282
1320
  {
1283
1321
  hostRef.$flags$ &= -9 /* isConstructingInstance */;
1284
1322
  }
1323
+ {
1324
+ hostRef.$flags$ |= 128 /* isWatchReady */;
1325
+ }
1285
1326
  endNewInstance();
1286
1327
  {
1287
1328
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
@@ -1413,6 +1454,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1413
1454
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1414
1455
  lazyBundles.map((lazyBundle) => {
1415
1456
  lazyBundle[1].map((compactMeta) => {
1457
+ var _a2, _b, _c;
1416
1458
  const cmpMeta = {
1417
1459
  $flags$: compactMeta[0],
1418
1460
  $tagName$: compactMeta[1],
@@ -1422,6 +1464,11 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1422
1464
  {
1423
1465
  cmpMeta.$members$ = compactMeta[2];
1424
1466
  }
1467
+ {
1468
+ cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
1469
+ cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
1470
+ cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
1471
+ }
1425
1472
  const tagName = transformTag(cmpMeta.$tagName$);
1426
1473
  const HostElement = class extends HTMLElement {
1427
1474
  ["s-p"];
@@ -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 = {}));
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-OvnIRO4Y.js');
3
+ var index = require('./index-BPj2cBXs.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
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]}],[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],"listValues":[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);
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;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-OvnIRO4Y.js');
3
+ var index = require('./index-BPj2cBXs.js');
4
4
  var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
5
 
6
6
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
@@ -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]}],[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],"listValues":[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);
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;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-OvnIRO4Y.js');
3
+ var index = require('./index-BPj2cBXs.js');
4
4
  var index$1 = require('./index.cjs.js');
5
5
  var format = require('./format-CDw-zie_.js');
6
6
 
@@ -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, listValues: (_0 = field.listValues) !== null && _0 !== void 0 ? _0 : [] }))));
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:
@@ -511,6 +511,13 @@ const MrdForm = class {
511
511
  var _a;
512
512
  this.formValues = Object.assign({}, ((_a = this.values) !== null && _a !== void 0 ? _a : {}));
513
513
  }
514
+ /** Sync formValues when the values prop is set from outside after mount
515
+ * (e.g. when pre-filling an existing record in edit mode). */
516
+ valuesChanged(newValues) {
517
+ this.formValues = Object.assign({}, (newValues !== null && newValues !== void 0 ? newValues : {}));
518
+ this.errors = {};
519
+ this.submitted = false;
520
+ }
514
521
  async setFieldValue(name, value) {
515
522
  this.formValues = Object.assign(Object.assign({}, this.formValues), { [name]: value });
516
523
  if (this.errors[name]) {
@@ -565,6 +572,11 @@ const MrdForm = class {
565
572
  const dir = this.locale.startsWith('ar') ? 'rtl' : 'ltr';
566
573
  return (index.h(index.Host, null, index.h("form", { class: "mrd-form", dir: dir, onSubmit: this.handleSubmit, noValidate: true }, this.layout.title && index.h("h2", { class: "mrd-form__title" }, this.layout.title), index.h("div", { class: "mrd-form__body" }, this.renderItems(this.layout.items)), index.h("div", { class: "mrd-form__footer" }, index.h("button", { type: "submit", class: "mrd-form__submit" }, t('submit', this.locale))))));
567
574
  }
575
+ static get watchers() { return {
576
+ "values": [{
577
+ "valuesChanged": 0
578
+ }]
579
+ }; }
568
580
  };
569
581
  MrdForm.style = mrdFormScss();
570
582
 
@@ -707,7 +719,8 @@ const MrdListField = class {
707
719
  this.disabled = false;
708
720
  this.multiple = false;
709
721
  this.locale = navigator.language;
710
- this.listValues = [];
722
+ /** List items from the API. Each item has a `key` (stored value) and `label`. */
723
+ this.listItems = [];
711
724
  this.error = '';
712
725
  this.selected = [];
713
726
  this.handleSelectChange = (e) => {
@@ -738,12 +751,12 @@ const MrdListField = class {
738
751
  const val = this.multiple ? this.selected : this.value;
739
752
  this.mrdBlur.emit({ name: this.name, value: val });
740
753
  };
741
- this.toggleCheckbox = (val) => {
742
- if (this.selected.includes(val)) {
743
- this.selected = this.selected.filter(v => v !== val);
754
+ this.toggleCheckbox = (key) => {
755
+ if (this.selected.includes(key)) {
756
+ this.selected = this.selected.filter(v => v !== key);
744
757
  }
745
758
  else {
746
- this.selected = [...this.selected, val];
759
+ this.selected = [...this.selected, key];
747
760
  }
748
761
  if (this.required && !validateRequired(this.selected)) {
749
762
  this.error = t('required', this.locale);
@@ -774,15 +787,16 @@ const MrdListField = class {
774
787
  const hasError = !!this.error;
775
788
  const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
776
789
  if (this.multiple) {
777
- // Render checkbox list for multi-select
778
- 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.listValues.map(lv => (index.h("label", { key: lv.value, class: "mrd-list-field__checkbox-item" }, index.h("input", { type: "checkbox", checked: this.selected.includes(lv.value), disabled: this.disabled, onChange: () => this.toggleCheckbox(lv.value) }), lv.color && (index.h("span", { class: "mrd-list-field__color-dot", style: { backgroundColor: lv.color } })), index.h("span", null, lv.label))))), hasError && index.h("span", { class: "mrd-list-field__error" }, this.error))));
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))));
779
794
  }
780
- // Single select dropdown
781
- 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.listValues.map(lv => {
782
- const style = lv.color
783
- ? { backgroundColor: lv.color, color: this.getContrastColor(lv.color) }
784
- : {};
785
- 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));
786
800
  })), hasError && index.h("span", { class: "mrd-list-field__error" }, this.error))));
787
801
  }
788
802
  };
@@ -881,6 +895,7 @@ const MrdRelationField = class {
881
895
  this.displayType = index$1.ClientLayoutItemRelationDisplayType.SEARCH;
882
896
  this.multiple = false;
883
897
  this.dropdownValues = [];
898
+ /** Plain href string/array for normal use; pass { id, label } objects to pre-fill a loaded record. */
884
899
  this.value = null;
885
900
  this.searchQuery = '';
886
901
  this.searchResults = [];
@@ -1001,12 +1016,29 @@ const MrdRelationField = class {
1001
1016
  async setLoading(loading) {
1002
1017
  this.isLoading = loading;
1003
1018
  }
1019
+ componentWillLoad() {
1020
+ var _a;
1021
+ // Pre-fill selectedItems when value is passed as { id, label } objects
1022
+ // (e.g. when editing an existing record fetched from the API).
1023
+ if (!this.value)
1024
+ return;
1025
+ if (Array.isArray(this.value)) {
1026
+ if (this.value.length > 0 && typeof this.value[0] === 'object') {
1027
+ this.selectedItems = this.value;
1028
+ this.searchQuery = '';
1029
+ }
1030
+ }
1031
+ else if (typeof this.value === 'object') {
1032
+ this.selectedItems = [this.value];
1033
+ this.searchQuery = (_a = this.value.label) !== null && _a !== void 0 ? _a : '';
1034
+ }
1035
+ }
1004
1036
  render() {
1005
1037
  var _a, _b;
1006
1038
  const hasError = !!this.error;
1007
1039
  if (this.displayType === index$1.ClientLayoutItemRelationDisplayType.DROPDOWN) {
1008
1040
  const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
1009
- 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.value, value: dv.value, selected: dv.value === currentValue }, dv.label)))), hasError && index.h("span", { class: "mrd-relation-field__error" }, this.error))));
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))));
1010
1042
  }
1011
1043
  // SEARCH mode
1012
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-OvnIRO4Y.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 === 'RELATION') {
10
- const link = (_a = row === null || row === void 0 ? void 0 : row._links) === null || _a === void 0 ? void 0 : _a[column.name];
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 (_b = link.name) !== null && _b !== void 0 ? _b : '';
17
+ return (_d = link.name) !== null && _d !== void 0 ? _d : '';
16
18
  }
17
- const raw = row === null || row === void 0 ? void 0 : row[column.name];
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 => { var _a; return CellRenderer.renderValue((_a = column.dataType) !== null && _a !== void 0 ? _a : 'TEXT', v, column, locale); })
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, column, locale) {
27
- var _a, _b;
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 = (_a = column.listItems) === null || _a === void 0 ? void 0 : _a.find(li => li.key === String(value));
53
- return (_b = item === null || item === void 0 ? void 0 : item.label) !== null && _b !== void 0 ? _b : String(value);
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();
@@ -60,7 +65,7 @@ class CellRenderer {
60
65
  }
61
66
  }
62
67
 
63
- const mrdTableScss = () => `.sc-mrd-table-h{display:block;width:100%}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.65rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient( 90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75% );background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}`;
68
+ const mrdTableScss = () => `.sc-mrd-table-h{display:block;width:100%}.mrd-table__scroll.sc-mrd-table{overflow-y:auto;overflow-x:auto;border:1px solid var(--mrd-border-color);border-radius:var(--mrd-border-radius);overflow-anchor:none}.mrd-table.sc-mrd-table{overflow-x:auto}.mrd-table__table.sc-mrd-table{width:auto;min-width:100%;border-collapse:collapse;font-size:var(--mrd-font-size-sm);color:var(--mrd-color-neutral-900)}.mrd-table__scroll.sc-mrd-table .mrd-table__table.sc-mrd-table{min-width:max-content}.mrd-table__header.sc-mrd-table{position:sticky;top:0;z-index:1;background:var(--mrd-color-white);text-align:left;padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:2px solid var(--mrd-border-color);color:var(--mrd-color-neutral-600);font-weight:var(--mrd-font-weight-medium);white-space:nowrap;font-size:var(--mrd-font-size-xs);text-transform:uppercase;letter-spacing:0.04em}.mrd-table__header--sortable.sc-mrd-table{cursor:pointer;user-select:none}.mrd-table__header--sortable.sc-mrd-table:hover{background:var(--mrd-color-neutral-50);color:var(--mrd-color-neutral-800)}.mrd-table__header--sorted-asc.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table{color:var(--mrd-color-primary);border-bottom-color:var(--mrd-color-primary)}.mrd-table__header-label.sc-mrd-table{margin-right:var(--mrd-space-1)}.mrd-table__sort-icon.sc-mrd-table{font-size:0.65rem;opacity:0.4;vertical-align:middle}.mrd-table__header--sorted-asc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table,.mrd-table__header--sorted-desc.sc-mrd-table .mrd-table__sort-icon.sc-mrd-table{opacity:1;color:var(--mrd-color-primary)}.mrd-table__row.sc-mrd-table{border-bottom:1px solid var(--mrd-border-color)}.mrd-table__row.sc-mrd-table:hover{background:var(--mrd-color-neutral-200) !important}.mrd-table__row--clickable.sc-mrd-table{cursor:pointer}.mrd-table__spacer.sc-mrd-table{border:none}.mrd-table__spacer.sc-mrd-table td.sc-mrd-table{padding:0;border:none}.mrd-table__cell.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);vertical-align:top;white-space:nowrap}.mrd-table__cell--numeric.sc-mrd-table{text-align:right;font-variant-numeric:tabular-nums}.mrd-table__row--loading.sc-mrd-table{background:transparent}.mrd-table__cell--placeholder.sc-mrd-table{padding:var(--mrd-space-2) var(--mrd-space-4);border-bottom:1px solid var(--mrd-border-color)}.mrd-table__placeholder-bar.sc-mrd-table{display:block;height:0.75rem;width:55%;border-radius:var(--mrd-border-radius-sm);background:linear-gradient( 90deg, var(--mrd-color-neutral-200) 25%, var(--mrd-color-neutral-100) 50%, var(--mrd-color-neutral-200) 75% );background-size:200% 100%;animation:mrd-shimmer 1.4s ease infinite}@keyframes mrd-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}.mrd-table__empty.sc-mrd-table{padding:var(--mrd-space-4) var(--mrd-space-3);color:var(--mrd-color-neutral-500);font-size:var(--mrd-font-size-sm);text-align:center;margin:0}`;
64
69
 
65
70
  const BUFFER = 10;
66
71
  /** Wacht deze tijd (ms) na het laatste scroll-event voordat pagina's worden
@@ -68,8 +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");
76
+ index$1.registerInstance(this, hostRef);
77
+ this.mrdLoadPage = index$1.createEvent(this, "mrdLoadPage");
78
+ this.mrdRowClick = index$1.createEvent(this, "mrdRowClick");
73
79
  // ── Debounce internals (geen @State — triggert geen re-render) ─────────────
74
80
  /** Pagina's die wachten op debounce-flush. */
75
81
  this.pendingPages = new Set();
@@ -171,12 +177,17 @@ const MrdTable = class {
171
177
  return this.sortDir === 'desc' ? `${this.sortField},desc` : this.sortField;
172
178
  }
173
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
+ }
174
184
  handleSortClick(col) {
175
- if (this.sortField === col.name) {
185
+ const name = this.colName(col);
186
+ if (this.sortField === name) {
176
187
  this.sortDir = this.sortDir === 'asc' ? 'desc' : 'asc';
177
188
  }
178
189
  else {
179
- this.sortField = col.name;
190
+ this.sortField = name;
180
191
  this.sortDir = 'asc';
181
192
  }
182
193
  // Cancel any pending scroll debounce.
@@ -279,12 +290,15 @@ const MrdTable = class {
279
290
  const numericTypes = new Set(['INTEGER', 'DECIMAL', 'PERCENTAGE', 'CURRENCY']);
280
291
  // ── Non-paginated mode ──────────────────────────────────────────────────
281
292
  if (this.totalElements === 0) {
282
- 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 => (index.h("th", { class: "mrd-table__header" }, col.label))))), index.h("tbody", null, (_b = this.rows) === null || _b === void 0 ? void 0 : _b.map((row, i) => (index.h("tr", { class: "mrd-table__row", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' } }, this.columns.map(col => {
283
- 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;
284
298
  const value = CellRenderer.render(col, row, this.locale);
285
- const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null && _a !== void 0 ? _a : '');
286
- return (index.h("td", { class: `mrd-table__cell${isNumeric ? ' mrd-table__cell--numeric' : ''}` }, value));
287
- })))))), (!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.")))));
288
302
  }
289
303
  // ── Paginated / virtual-scroll mode ────────────────────────────────────
290
304
  const total = this.totalElements;
@@ -295,27 +309,28 @@ const MrdTable = class {
295
309
  for (let i = this.renderStart; i <= this.renderEnd; i++) {
296
310
  const row = this.getRow(i);
297
311
  if (row === null) {
298
- 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" }))));
299
313
  }
300
314
  else {
301
- renderedRows.push(index.h("tr", { class: "mrd-table__row", style: { background: i % 2 === 0 ? '' : 'var(--mrd-color-neutral-100)' } }, this.columns.map(col => {
302
- 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;
303
317
  const value = CellRenderer.render(col, row, this.locale);
304
- const isNumeric = col.type === 'FIELD' && numericTypes.has((_a = col.dataType) !== null && _a !== void 0 ? _a : '');
305
- 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));
306
320
  })));
307
321
  }
308
322
  }
309
323
  const tableStyle = this.colWidths.length > 0
310
324
  ? { tableLayout: 'fixed' }
311
325
  : undefined;
312
- 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) => {
313
- const isActive = this.sortField === col.name;
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);
314
329
  const cls = `mrd-table__header mrd-table__header--sortable${isActive ? ` mrd-table__header--sorted-${this.sortDir}` : ''}`;
315
- 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' ? '▲' : '▼') : '⇅')));
316
- }))), 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."))));
317
332
  }
318
- get el() { return index.getElement(this); }
333
+ get el() { return index$1.getElement(this); }
319
334
  };
320
335
  MrdTable.style = mrdTableScss();
321
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, listValues: (_0 = field.listValues) !== null && _0 !== void 0 ? _0 : [] }))));
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:
@@ -31,6 +31,13 @@ export class MrdForm {
31
31
  var _a;
32
32
  this.formValues = Object.assign({}, ((_a = this.values) !== null && _a !== void 0 ? _a : {}));
33
33
  }
34
+ /** Sync formValues when the values prop is set from outside after mount
35
+ * (e.g. when pre-filling an existing record in edit mode). */
36
+ valuesChanged(newValues) {
37
+ this.formValues = Object.assign({}, (newValues !== null && newValues !== void 0 ? newValues : {}));
38
+ this.errors = {};
39
+ this.submitted = false;
40
+ }
34
41
  async setFieldValue(name, value) {
35
42
  this.formValues = Object.assign(Object.assign({}, this.formValues), { [name]: value });
36
43
  if (this.errors[name]) {
@@ -242,4 +249,10 @@ export class MrdForm {
242
249
  }
243
250
  };
244
251
  }
252
+ static get watchers() {
253
+ return [{
254
+ "propName": "values",
255
+ "methodName": "valuesChanged"
256
+ }];
257
+ }
245
258
  }