@mmlogic/components 0.3.5 → 0.3.9

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 (68) hide show
  1. package/dist/cjs/index.cjs.js +13 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mosterdcomponents.cjs.js +1 -1
  4. package/dist/cjs/{mrd-boolean-field_20.cjs.entry.js → mrd-boolean-field_22.cjs.entry.js} +506 -25
  5. package/dist/collection/collection-manifest.json +2 -0
  6. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +1 -1
  7. package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +1 -1
  8. package/dist/collection/components/mrd-date-field/mrd-date-field.js +1 -1
  9. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +1 -1
  10. package/dist/collection/components/mrd-document-list/mrd-document-list.js +578 -0
  11. package/dist/collection/components/mrd-document-list/mrd-document-list.scss +126 -0
  12. package/dist/collection/components/mrd-document-view/mrd-document-view.js +177 -0
  13. package/dist/collection/components/mrd-document-view/mrd-document-view.scss +121 -0
  14. package/dist/collection/components/mrd-email-field/mrd-email-field.js +1 -1
  15. package/dist/collection/components/mrd-file-field/mrd-file-field.js +1 -1
  16. package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
  17. package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +154 -16
  18. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +46 -3
  19. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
  20. package/dist/collection/components/mrd-number-field/mrd-number-field.js +1 -1
  21. package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +2 -2
  22. package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
  23. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
  24. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +0 -56
  25. package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
  26. package/dist/collection/dev/app.js +19 -2
  27. package/dist/collection/types/client-layout.js +10 -0
  28. package/dist/collection/utils/i18n.js +24 -0
  29. package/dist/components/client-layout.js +1 -1
  30. package/dist/components/format.js +1 -1
  31. package/dist/components/i18n.js +1 -1
  32. package/dist/components/index.js +1 -1
  33. package/dist/components/mrd-boolean-field2.js +1 -1
  34. package/dist/components/mrd-currency-field2.js +1 -1
  35. package/dist/components/mrd-date-field2.js +1 -1
  36. package/dist/components/mrd-datetime-field2.js +1 -1
  37. package/dist/components/mrd-document-list.d.ts +11 -0
  38. package/dist/components/mrd-document-list.js +1 -0
  39. package/dist/components/mrd-document-list2.js +1 -0
  40. package/dist/components/mrd-document-view.d.ts +11 -0
  41. package/dist/components/mrd-document-view.js +1 -0
  42. package/dist/components/mrd-document-view2.js +1 -0
  43. package/dist/components/mrd-email-field2.js +1 -1
  44. package/dist/components/mrd-file-field2.js +1 -1
  45. package/dist/components/mrd-image-field2.js +1 -1
  46. package/dist/components/mrd-layout-section.js +1 -1
  47. package/dist/components/mrd-longtext-field2.js +1 -1
  48. package/dist/components/mrd-number-field2.js +1 -1
  49. package/dist/components/mrd-secret-field2.js +1 -1
  50. package/dist/components/mrd-table2.js +1 -1
  51. package/dist/components/mrd-text-field2.js +1 -1
  52. package/dist/components/mrd-textarea-field2.js +1 -1
  53. package/dist/components/mrd-time-field2.js +1 -1
  54. package/dist/esm/index.js +11 -1
  55. package/dist/esm/loader.js +1 -1
  56. package/dist/esm/mosterdcomponents.js +1 -1
  57. package/dist/esm/{mrd-boolean-field_20.entry.js → mrd-boolean-field_22.entry.js} +506 -27
  58. package/dist/mosterdcomponents/index.esm.js +1 -1
  59. package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
  60. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  61. package/dist/mosterdcomponents/p-b547291b.entry.js +1 -0
  62. package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +108 -0
  63. package/dist/types/components/mrd-document-view/mrd-document-view.d.ts +36 -0
  64. package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +33 -6
  65. package/dist/types/components.d.ts +290 -15
  66. package/dist/types/types/client-layout.d.ts +38 -0
  67. package/package.json +1 -1
  68. package/dist/mosterdcomponents/p-e477187c.entry.js +0 -1
@@ -5,10 +5,14 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
- import { ClientLayout, ClientLayoutItem, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
9
- import { AggregationResult, ClientLayoutItem as ClientLayoutItem1, ClientLayoutItemNavigate, ClientViewMetadata, HyperlinkValue, RelationSearchResult as RelationSearchResult1 } from "./types/client-layout";
10
- export { ClientLayout, ClientLayoutItem, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
11
- export { AggregationResult, ClientLayoutItem as ClientLayoutItem1, ClientLayoutItemNavigate, ClientViewMetadata, HyperlinkValue, RelationSearchResult as RelationSearchResult1 } from "./types/client-layout";
8
+ import { ClientLayout, ClientLayoutItem as ClientLayoutItem1, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
9
+ import { AggregationResult, ClientArchetype, ClientLayoutItem, ClientLayoutItemNavigate, ClientViewMetadata, HyperlinkValue, RelationSearchResult as RelationSearchResult1 } from "./types/client-layout";
10
+ import { DistinctValue, DocRow } from "./components/mrd-document-list/mrd-document-list";
11
+ import { DistinctValue as DistinctValue1 } from "./components/mrd-document-list/mrd-document-list";
12
+ export { ClientLayout, ClientLayoutItem as ClientLayoutItem1, ClientLayoutItemFieldDataType, ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior, ClientListValue, CurrencyValue, RelationSearchResult } from "./types";
13
+ export { AggregationResult, ClientArchetype, ClientLayoutItem, ClientLayoutItemNavigate, ClientViewMetadata, HyperlinkValue, RelationSearchResult as RelationSearchResult1 } from "./types/client-layout";
14
+ export { DistinctValue, DocRow } from "./components/mrd-document-list/mrd-document-list";
15
+ export { DistinctValue as DistinctValue1 } from "./components/mrd-document-list/mrd-document-list";
12
16
  export namespace Components {
13
17
  interface MrdBooleanField {
14
18
  /**
@@ -114,6 +118,73 @@ export namespace Components {
114
118
  */
115
119
  "value": string;
116
120
  }
121
+ /**
122
+ * Archetype-driven document collection view. Renders documents as a lazy,
123
+ * file-explorer-style folder tree, grouped by the `commons.document` archetype's
124
+ * `container` (dossier, the top folder) and `folder` (a path string like
125
+ * `/draft documents/may 2020`, the sub-path beneath it).
126
+ * Loading is lazy per level, mirroring the /distinct endpoint (FINDING-0106):
127
+ * - on load → `mrdLoadDistinct` for the `container` relation → top folders;
128
+ * - on expanding a container → `mrdLoadDistinct` for the `folder` field, filtered
129
+ * by `{containerField}_href` → all folder path strings for that container
130
+ * (the client splits them on `/` and builds the sub-tree locally);
131
+ * - on expanding a node that holds documents → `mrdLoadPage` (a plain filtered list
132
+ * load, the same one a table page uses), filtered by container + exact folder string.
133
+ * When exactly one container exists (e.g. a dossier detail page) the container
134
+ * level is hidden and its folder tree is shown directly at the root.
135
+ */
136
+ interface MrdDocumentList {
137
+ /**
138
+ * Resolved `commons.document` binding: slot name → concrete field/relation name.
139
+ */
140
+ "archetype": ClientArchetype;
141
+ /**
142
+ * The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config).
143
+ * @default null
144
+ */
145
+ "item": ClientLayoutItem | null;
146
+ /**
147
+ * @default navigator.language
148
+ */
149
+ "locale": string;
150
+ /**
151
+ * Parent record id — required for RELATED_VIEW path building.
152
+ * @default ''
153
+ */
154
+ "parentId": string;
155
+ /**
156
+ * Inject distinct values for a node. `nodeId` is the sentinel root (containers) or a container node id (folders).
157
+ */
158
+ "setDistinct": (nodeId: string, values: DistinctValue[]) => Promise<void>;
159
+ /**
160
+ * Inject the documents loaded for one folder node.
161
+ */
162
+ "setDocuments": (nodeId: string, docs: DocRow[]) => Promise<void>;
163
+ }
164
+ /**
165
+ * Archetype-driven single-document view. Given a `commons.document` binding and a
166
+ * data record, renders the document recognisably — title, file preview/download,
167
+ * summary and date — plus a navigation link to the container (the dossier),
168
+ * instead of a generic field form.
169
+ * The component keys on the slot→field map (`archetype.slots`) to locate values:
170
+ * value slots read `data[field]`; the `container` relation slot reads
171
+ * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
172
+ */
173
+ interface MrdDocumentView {
174
+ /**
175
+ * Resolved `commons.document` binding: slot name → concrete field/relation name.
176
+ */
177
+ "archetype": ClientArchetype;
178
+ /**
179
+ * The data record from the /data endpoint. Fields keyed by name; relations under `_links`.
180
+ * @default {}
181
+ */
182
+ "data": Record<string, unknown>;
183
+ /**
184
+ * @default navigator.language
185
+ */
186
+ "locale": string;
187
+ }
117
188
  interface MrdEmailField {
118
189
  /**
119
190
  * @default false
@@ -145,7 +216,7 @@ export namespace Components {
145
216
  "value": string;
146
217
  }
147
218
  interface MrdField {
148
- "item": ClientLayoutItem;
219
+ "item": ClientLayoutItem1;
149
220
  /**
150
221
  * @default navigator.language
151
222
  */
@@ -283,6 +354,11 @@ export namespace Components {
283
354
  "value": unknown;
284
355
  }
285
356
  interface MrdLayoutSection {
357
+ /**
358
+ * Top-level archetypes on the object dashboard. When it contains commons.document, the record is rendered as a single-document view instead of generic fields.
359
+ * @default []
360
+ */
361
+ "archetypes": ClientArchetype[];
286
362
  /**
287
363
  * Record data object; keys are field names, _links holds relation and related-view links.
288
364
  * @default {}
@@ -292,7 +368,7 @@ export namespace Components {
292
368
  * Items from one layout entry in ClientDashboardMetadata.layouts[].
293
369
  * @default []
294
370
  */
295
- "items": ClientLayoutItem1[];
371
+ "items": ClientLayoutItem[];
296
372
  /**
297
373
  * Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format.
298
374
  * @default {}
@@ -319,9 +395,13 @@ export namespace Components {
319
395
  */
320
396
  "setViewAggregations": (name: string, data: any) => Promise<void>;
321
397
  /**
322
- * Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item. Pass totalElements to update the pagination total (safe to pass on every page). Pass hasNext (from _links.next presence) so the table can decide whether to emit aggregations.
398
+ * Inject distinct values into an embedded mrd-document-list for a document view.
399
+ */
400
+ "setViewDistinct": (name: string, nodeId: string, values: DistinctValue1[]) => Promise<void>;
401
+ /**
402
+ * Inject rows for a VIEW / RELATED_VIEW item. - Table view: injects the page into the embedded mrd-table (pass totalElements/hasNext). - Document view: pass `nodeId` to route the rows to that folder node in the embedded mrd-document-list. Folder loading is just a filtered list load, so it reuses this method.
323
403
  */
324
- "setViewPage": (name: string, page: number, rows: any[], totalElements?: number, hasNext?: boolean) => Promise<void>;
404
+ "setViewPage": (name: string, page: number, rows: any[], totalElements?: number, hasNext?: boolean, nodeId?: string) => Promise<void>;
325
405
  /**
326
406
  * Legacy: view metadata map (ClientDashboardMetadata.views). Not needed in new flat format.
327
407
  * @default {}
@@ -523,7 +603,7 @@ export namespace Components {
523
603
  * The VIEW or RELATED_VIEW layout item. Contains view config, dataClass, fromClass, actions etc.
524
604
  * @default null
525
605
  */
526
- "item": ClientLayoutItem1 | null;
606
+ "item": ClientLayoutItem | null;
527
607
  /**
528
608
  * @default navigator.language
529
609
  */
@@ -670,6 +750,14 @@ export interface MrdDatetimeFieldCustomEvent<T> extends CustomEvent<T> {
670
750
  detail: T;
671
751
  target: HTMLMrdDatetimeFieldElement;
672
752
  }
753
+ export interface MrdDocumentListCustomEvent<T> extends CustomEvent<T> {
754
+ detail: T;
755
+ target: HTMLMrdDocumentListElement;
756
+ }
757
+ export interface MrdDocumentViewCustomEvent<T> extends CustomEvent<T> {
758
+ detail: T;
759
+ target: HTMLMrdDocumentViewElement;
760
+ }
673
761
  export interface MrdEmailFieldCustomEvent<T> extends CustomEvent<T> {
674
762
  detail: T;
675
763
  target: HTMLMrdEmailFieldElement;
@@ -807,6 +895,67 @@ declare global {
807
895
  prototype: HTMLMrdDatetimeFieldElement;
808
896
  new (): HTMLMrdDatetimeFieldElement;
809
897
  };
898
+ interface HTMLMrdDocumentListElementEventMap {
899
+ "mrdLoadDistinct": { nodeId: string; distinct: string; path: string; qs: string };
900
+ "mrdLoadPage": { nodeId: string; page: number; sort: string; path: string; qs: string };
901
+ "mrdNavigate": { href?: string; label: string };
902
+ }
903
+ /**
904
+ * Archetype-driven document collection view. Renders documents as a lazy,
905
+ * file-explorer-style folder tree, grouped by the `commons.document` archetype's
906
+ * `container` (dossier, the top folder) and `folder` (a path string like
907
+ * `/draft documents/may 2020`, the sub-path beneath it).
908
+ * Loading is lazy per level, mirroring the /distinct endpoint (FINDING-0106):
909
+ * - on load → `mrdLoadDistinct` for the `container` relation → top folders;
910
+ * - on expanding a container → `mrdLoadDistinct` for the `folder` field, filtered
911
+ * by `{containerField}_href` → all folder path strings for that container
912
+ * (the client splits them on `/` and builds the sub-tree locally);
913
+ * - on expanding a node that holds documents → `mrdLoadPage` (a plain filtered list
914
+ * load, the same one a table page uses), filtered by container + exact folder string.
915
+ * When exactly one container exists (e.g. a dossier detail page) the container
916
+ * level is hidden and its folder tree is shown directly at the root.
917
+ */
918
+ interface HTMLMrdDocumentListElement extends Components.MrdDocumentList, HTMLStencilElement {
919
+ addEventListener<K extends keyof HTMLMrdDocumentListElementEventMap>(type: K, listener: (this: HTMLMrdDocumentListElement, ev: MrdDocumentListCustomEvent<HTMLMrdDocumentListElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
920
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
921
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
922
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
923
+ removeEventListener<K extends keyof HTMLMrdDocumentListElementEventMap>(type: K, listener: (this: HTMLMrdDocumentListElement, ev: MrdDocumentListCustomEvent<HTMLMrdDocumentListElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
924
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
925
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
926
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
927
+ }
928
+ var HTMLMrdDocumentListElement: {
929
+ prototype: HTMLMrdDocumentListElement;
930
+ new (): HTMLMrdDocumentListElement;
931
+ };
932
+ interface HTMLMrdDocumentViewElementEventMap {
933
+ "mrdNavigate": { href?: string; label: string };
934
+ "mrdDownload": { href: string; fileName: string };
935
+ }
936
+ /**
937
+ * Archetype-driven single-document view. Given a `commons.document` binding and a
938
+ * data record, renders the document recognisably — title, file preview/download,
939
+ * summary and date — plus a navigation link to the container (the dossier),
940
+ * instead of a generic field form.
941
+ * The component keys on the slot→field map (`archetype.slots`) to locate values:
942
+ * value slots read `data[field]`; the `container` relation slot reads
943
+ * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
944
+ */
945
+ interface HTMLMrdDocumentViewElement extends Components.MrdDocumentView, HTMLStencilElement {
946
+ addEventListener<K extends keyof HTMLMrdDocumentViewElementEventMap>(type: K, listener: (this: HTMLMrdDocumentViewElement, ev: MrdDocumentViewCustomEvent<HTMLMrdDocumentViewElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
947
+ addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
948
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
949
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
950
+ removeEventListener<K extends keyof HTMLMrdDocumentViewElementEventMap>(type: K, listener: (this: HTMLMrdDocumentViewElement, ev: MrdDocumentViewCustomEvent<HTMLMrdDocumentViewElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
951
+ removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
952
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
953
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
954
+ }
955
+ var HTMLMrdDocumentViewElement: {
956
+ prototype: HTMLMrdDocumentViewElement;
957
+ new (): HTMLMrdDocumentViewElement;
958
+ };
810
959
  interface HTMLMrdEmailFieldElementEventMap {
811
960
  "mrdChange": { name: string; value: string };
812
961
  "mrdBlur": { name: string; value: string };
@@ -927,10 +1076,11 @@ declare global {
927
1076
  "mrdNavigate": { href?: string; label: string; navigate?: ClientLayoutItemNavigate };
928
1077
  "mrdSearch": { query: string; dataClass: string };
929
1078
  "mrdDownload": { href: string; fileName: string };
930
- "mrdLoadViewPage": { name: string; page: number; sort: string; path: string; qs: string };
1079
+ "mrdLoadViewPage": { name: string; page: number; sort: string; path: string; qs: string; nodeId?: string };
931
1080
  "mrdLoadImage": { fieldName: string; href: string };
932
1081
  "mrdViewAction": { name: string; action: string; dataClass: string; path?: string; qs?: string; parentPath?: string | null; basicType?: string };
933
1082
  "mrdLoadViewAggregations": { name: string; dataClass: string; path: string; qs: string; aggQs: string };
1083
+ "mrdLoadViewDistinct": { name: string; nodeId: string; distinct: string; path: string; qs: string };
934
1084
  }
935
1085
  interface HTMLMrdLayoutSectionElement extends Components.MrdLayoutSection, HTMLStencilElement {
936
1086
  addEventListener<K extends keyof HTMLMrdLayoutSectionElementEventMap>(type: K, listener: (this: HTMLMrdLayoutSectionElement, ev: MrdLayoutSectionCustomEvent<HTMLMrdLayoutSectionElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -1118,6 +1268,8 @@ declare global {
1118
1268
  "mrd-currency-field": HTMLMrdCurrencyFieldElement;
1119
1269
  "mrd-date-field": HTMLMrdDateFieldElement;
1120
1270
  "mrd-datetime-field": HTMLMrdDatetimeFieldElement;
1271
+ "mrd-document-list": HTMLMrdDocumentListElement;
1272
+ "mrd-document-view": HTMLMrdDocumentViewElement;
1121
1273
  "mrd-email-field": HTMLMrdEmailFieldElement;
1122
1274
  "mrd-field": HTMLMrdFieldElement;
1123
1275
  "mrd-file-field": HTMLMrdFileFieldElement;
@@ -1249,6 +1401,85 @@ declare namespace LocalJSX {
1249
1401
  */
1250
1402
  "value"?: string;
1251
1403
  }
1404
+ /**
1405
+ * Archetype-driven document collection view. Renders documents as a lazy,
1406
+ * file-explorer-style folder tree, grouped by the `commons.document` archetype's
1407
+ * `container` (dossier, the top folder) and `folder` (a path string like
1408
+ * `/draft documents/may 2020`, the sub-path beneath it).
1409
+ * Loading is lazy per level, mirroring the /distinct endpoint (FINDING-0106):
1410
+ * - on load → `mrdLoadDistinct` for the `container` relation → top folders;
1411
+ * - on expanding a container → `mrdLoadDistinct` for the `folder` field, filtered
1412
+ * by `{containerField}_href` → all folder path strings for that container
1413
+ * (the client splits them on `/` and builds the sub-tree locally);
1414
+ * - on expanding a node that holds documents → `mrdLoadPage` (a plain filtered list
1415
+ * load, the same one a table page uses), filtered by container + exact folder string.
1416
+ * When exactly one container exists (e.g. a dossier detail page) the container
1417
+ * level is hidden and its folder tree is shown directly at the root.
1418
+ */
1419
+ interface MrdDocumentList {
1420
+ /**
1421
+ * Resolved `commons.document` binding: slot name → concrete field/relation name.
1422
+ */
1423
+ "archetype": ClientArchetype;
1424
+ /**
1425
+ * The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config).
1426
+ * @default null
1427
+ */
1428
+ "item"?: ClientLayoutItem | null;
1429
+ /**
1430
+ * @default navigator.language
1431
+ */
1432
+ "locale"?: string;
1433
+ /**
1434
+ * Request distinct values for a field/relation. Host fetches `{path}?{qs}` and calls `setDistinct(nodeId, values)`.
1435
+ */
1436
+ "onMrdLoadDistinct"?: (event: MrdDocumentListCustomEvent<{ nodeId: string; distinct: string; path: string; qs: string }>) => void;
1437
+ /**
1438
+ * Request the documents in one folder — the same filtered list load a table does. Host fetches `{path}?{qs}` and calls `setDocuments(nodeId, docs)` (via setViewPage).
1439
+ */
1440
+ "onMrdLoadPage"?: (event: MrdDocumentListCustomEvent<{ nodeId: string; page: number; sort: string; path: string; qs: string }>) => void;
1441
+ /**
1442
+ * A document row was clicked. Host routes to the document object page.
1443
+ */
1444
+ "onMrdNavigate"?: (event: MrdDocumentListCustomEvent<{ href?: string; label: string }>) => void;
1445
+ /**
1446
+ * Parent record id — required for RELATED_VIEW path building.
1447
+ * @default ''
1448
+ */
1449
+ "parentId"?: string;
1450
+ }
1451
+ /**
1452
+ * Archetype-driven single-document view. Given a `commons.document` binding and a
1453
+ * data record, renders the document recognisably — title, file preview/download,
1454
+ * summary and date — plus a navigation link to the container (the dossier),
1455
+ * instead of a generic field form.
1456
+ * The component keys on the slot→field map (`archetype.slots`) to locate values:
1457
+ * value slots read `data[field]`; the `container` relation slot reads
1458
+ * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
1459
+ */
1460
+ interface MrdDocumentView {
1461
+ /**
1462
+ * Resolved `commons.document` binding: slot name → concrete field/relation name.
1463
+ */
1464
+ "archetype": ClientArchetype;
1465
+ /**
1466
+ * The data record from the /data endpoint. Fields keyed by name; relations under `_links`.
1467
+ * @default {}
1468
+ */
1469
+ "data"?: Record<string, unknown>;
1470
+ /**
1471
+ * @default navigator.language
1472
+ */
1473
+ "locale"?: string;
1474
+ /**
1475
+ * Download the document file. Host resolves the href to a signed URL.
1476
+ */
1477
+ "onMrdDownload"?: (event: MrdDocumentViewCustomEvent<{ href: string; fileName: string }>) => void;
1478
+ /**
1479
+ * Navigate to the container (dossier). Host resolves the href and routes.
1480
+ */
1481
+ "onMrdNavigate"?: (event: MrdDocumentViewCustomEvent<{ href?: string; label: string }>) => void;
1482
+ }
1252
1483
  interface MrdEmailField {
1253
1484
  /**
1254
1485
  * @default false
@@ -1282,7 +1513,7 @@ declare namespace LocalJSX {
1282
1513
  "value"?: string;
1283
1514
  }
1284
1515
  interface MrdField {
1285
- "item": ClientLayoutItem;
1516
+ "item": ClientLayoutItem1;
1286
1517
  /**
1287
1518
  * @default navigator.language
1288
1519
  */
@@ -1443,6 +1674,11 @@ declare namespace LocalJSX {
1443
1674
  "value"?: unknown;
1444
1675
  }
1445
1676
  interface MrdLayoutSection {
1677
+ /**
1678
+ * Top-level archetypes on the object dashboard. When it contains commons.document, the record is rendered as a single-document view instead of generic fields.
1679
+ * @default []
1680
+ */
1681
+ "archetypes"?: ClientArchetype[];
1446
1682
  /**
1447
1683
  * Record data object; keys are field names, _links holds relation and related-view links.
1448
1684
  * @default {}
@@ -1452,7 +1688,7 @@ declare namespace LocalJSX {
1452
1688
  * Items from one layout entry in ClientDashboardMetadata.layouts[].
1453
1689
  * @default []
1454
1690
  */
1455
- "items"?: ClientLayoutItem1[];
1691
+ "items"?: ClientLayoutItem[];
1456
1692
  /**
1457
1693
  * Legacy: top-level _links from ClientDashboardMetadata. Not needed in new flat format.
1458
1694
  * @default {}
@@ -1472,9 +1708,13 @@ declare namespace LocalJSX {
1472
1708
  */
1473
1709
  "onMrdLoadViewAggregations"?: (event: MrdLayoutSectionCustomEvent<{ name: string; dataClass: string; path: string; qs: string; aggQs: string }>) => void;
1474
1710
  /**
1475
- * Re-emitted from an embedded mrd-table's mrdLoadPage; host fetches the next page and calls setViewPage().
1711
+ * Re-emitted from an embedded mrd-document-list's mrdLoadDistinct; host fetches distinct values and calls setViewDistinct().
1712
+ */
1713
+ "onMrdLoadViewDistinct"?: (event: MrdLayoutSectionCustomEvent<{ name: string; nodeId: string; distinct: string; path: string; qs: string }>) => void;
1714
+ /**
1715
+ * Re-emitted from an embedded mrd-table's or mrd-document-list's mrdLoadPage; host fetches the rows and calls setViewPage(). `nodeId` is present for a document-list folder load.
1476
1716
  */
1477
- "onMrdLoadViewPage"?: (event: MrdLayoutSectionCustomEvent<{ name: string; page: number; sort: string; path: string; qs: string }>) => void;
1717
+ "onMrdLoadViewPage"?: (event: MrdLayoutSectionCustomEvent<{ name: string; page: number; sort: string; path: string; qs: string; nodeId?: string }>) => void;
1478
1718
  "onMrdNavigate"?: (event: MrdLayoutSectionCustomEvent<{ href?: string; label: string; navigate?: ClientLayoutItemNavigate }>) => void;
1479
1719
  "onMrdSearch"?: (event: MrdLayoutSectionCustomEvent<{ query: string; dataClass: string }>) => void;
1480
1720
  /**
@@ -1687,7 +1927,7 @@ declare namespace LocalJSX {
1687
1927
  * The VIEW or RELATED_VIEW layout item. Contains view config, dataClass, fromClass, actions etc.
1688
1928
  * @default null
1689
1929
  */
1690
- "item"?: ClientLayoutItem1 | null;
1930
+ "item"?: ClientLayoutItem | null;
1691
1931
  /**
1692
1932
  * @default navigator.language
1693
1933
  */
@@ -1867,6 +2107,13 @@ declare namespace LocalJSX {
1867
2107
  "disabled": boolean;
1868
2108
  "locale": string;
1869
2109
  }
2110
+ interface MrdDocumentListAttributes {
2111
+ "parentId": string;
2112
+ "locale": string;
2113
+ }
2114
+ interface MrdDocumentViewAttributes {
2115
+ "locale": string;
2116
+ }
1870
2117
  interface MrdEmailFieldAttributes {
1871
2118
  "name": string;
1872
2119
  "label": string;
@@ -2007,6 +2254,8 @@ declare namespace LocalJSX {
2007
2254
  "mrd-currency-field": Omit<MrdCurrencyField, keyof MrdCurrencyFieldAttributes> & { [K in keyof MrdCurrencyField & keyof MrdCurrencyFieldAttributes]?: MrdCurrencyField[K] } & { [K in keyof MrdCurrencyField & keyof MrdCurrencyFieldAttributes as `attr:${K}`]?: MrdCurrencyFieldAttributes[K] } & { [K in keyof MrdCurrencyField & keyof MrdCurrencyFieldAttributes as `prop:${K}`]?: MrdCurrencyField[K] };
2008
2255
  "mrd-date-field": Omit<MrdDateField, keyof MrdDateFieldAttributes> & { [K in keyof MrdDateField & keyof MrdDateFieldAttributes]?: MrdDateField[K] } & { [K in keyof MrdDateField & keyof MrdDateFieldAttributes as `attr:${K}`]?: MrdDateFieldAttributes[K] } & { [K in keyof MrdDateField & keyof MrdDateFieldAttributes as `prop:${K}`]?: MrdDateField[K] };
2009
2256
  "mrd-datetime-field": Omit<MrdDatetimeField, keyof MrdDatetimeFieldAttributes> & { [K in keyof MrdDatetimeField & keyof MrdDatetimeFieldAttributes]?: MrdDatetimeField[K] } & { [K in keyof MrdDatetimeField & keyof MrdDatetimeFieldAttributes as `attr:${K}`]?: MrdDatetimeFieldAttributes[K] } & { [K in keyof MrdDatetimeField & keyof MrdDatetimeFieldAttributes as `prop:${K}`]?: MrdDatetimeField[K] };
2257
+ "mrd-document-list": Omit<MrdDocumentList, keyof MrdDocumentListAttributes> & { [K in keyof MrdDocumentList & keyof MrdDocumentListAttributes]?: MrdDocumentList[K] } & { [K in keyof MrdDocumentList & keyof MrdDocumentListAttributes as `attr:${K}`]?: MrdDocumentListAttributes[K] } & { [K in keyof MrdDocumentList & keyof MrdDocumentListAttributes as `prop:${K}`]?: MrdDocumentList[K] };
2258
+ "mrd-document-view": Omit<MrdDocumentView, keyof MrdDocumentViewAttributes> & { [K in keyof MrdDocumentView & keyof MrdDocumentViewAttributes]?: MrdDocumentView[K] } & { [K in keyof MrdDocumentView & keyof MrdDocumentViewAttributes as `attr:${K}`]?: MrdDocumentViewAttributes[K] } & { [K in keyof MrdDocumentView & keyof MrdDocumentViewAttributes as `prop:${K}`]?: MrdDocumentView[K] };
2010
2259
  "mrd-email-field": Omit<MrdEmailField, keyof MrdEmailFieldAttributes> & { [K in keyof MrdEmailField & keyof MrdEmailFieldAttributes]?: MrdEmailField[K] } & { [K in keyof MrdEmailField & keyof MrdEmailFieldAttributes as `attr:${K}`]?: MrdEmailFieldAttributes[K] } & { [K in keyof MrdEmailField & keyof MrdEmailFieldAttributes as `prop:${K}`]?: MrdEmailField[K] };
2011
2260
  "mrd-field": Omit<MrdField, keyof MrdFieldAttributes> & { [K in keyof MrdField & keyof MrdFieldAttributes]?: MrdField[K] } & { [K in keyof MrdField & keyof MrdFieldAttributes as `attr:${K}`]?: MrdFieldAttributes[K] } & { [K in keyof MrdField & keyof MrdFieldAttributes as `prop:${K}`]?: MrdField[K] };
2012
2261
  "mrd-file-field": Omit<MrdFileField, keyof MrdFileFieldAttributes> & { [K in keyof MrdFileField & keyof MrdFileFieldAttributes]?: MrdFileField[K] } & { [K in keyof MrdFileField & keyof MrdFileFieldAttributes as `attr:${K}`]?: MrdFileFieldAttributes[K] } & { [K in keyof MrdFileField & keyof MrdFileFieldAttributes as `prop:${K}`]?: MrdFileField[K] };
@@ -2033,6 +2282,32 @@ declare module "@stencil/core" {
2033
2282
  "mrd-currency-field": LocalJSX.IntrinsicElements["mrd-currency-field"] & JSXBase.HTMLAttributes<HTMLMrdCurrencyFieldElement>;
2034
2283
  "mrd-date-field": LocalJSX.IntrinsicElements["mrd-date-field"] & JSXBase.HTMLAttributes<HTMLMrdDateFieldElement>;
2035
2284
  "mrd-datetime-field": LocalJSX.IntrinsicElements["mrd-datetime-field"] & JSXBase.HTMLAttributes<HTMLMrdDatetimeFieldElement>;
2285
+ /**
2286
+ * Archetype-driven document collection view. Renders documents as a lazy,
2287
+ * file-explorer-style folder tree, grouped by the `commons.document` archetype's
2288
+ * `container` (dossier, the top folder) and `folder` (a path string like
2289
+ * `/draft documents/may 2020`, the sub-path beneath it).
2290
+ * Loading is lazy per level, mirroring the /distinct endpoint (FINDING-0106):
2291
+ * - on load → `mrdLoadDistinct` for the `container` relation → top folders;
2292
+ * - on expanding a container → `mrdLoadDistinct` for the `folder` field, filtered
2293
+ * by `{containerField}_href` → all folder path strings for that container
2294
+ * (the client splits them on `/` and builds the sub-tree locally);
2295
+ * - on expanding a node that holds documents → `mrdLoadPage` (a plain filtered list
2296
+ * load, the same one a table page uses), filtered by container + exact folder string.
2297
+ * When exactly one container exists (e.g. a dossier detail page) the container
2298
+ * level is hidden and its folder tree is shown directly at the root.
2299
+ */
2300
+ "mrd-document-list": LocalJSX.IntrinsicElements["mrd-document-list"] & JSXBase.HTMLAttributes<HTMLMrdDocumentListElement>;
2301
+ /**
2302
+ * Archetype-driven single-document view. Given a `commons.document` binding and a
2303
+ * data record, renders the document recognisably — title, file preview/download,
2304
+ * summary and date — plus a navigation link to the container (the dossier),
2305
+ * instead of a generic field form.
2306
+ * The component keys on the slot→field map (`archetype.slots`) to locate values:
2307
+ * value slots read `data[field]`; the `container` relation slot reads
2308
+ * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
2309
+ */
2310
+ "mrd-document-view": LocalJSX.IntrinsicElements["mrd-document-view"] & JSXBase.HTMLAttributes<HTMLMrdDocumentViewElement>;
2036
2311
  "mrd-email-field": LocalJSX.IntrinsicElements["mrd-email-field"] & JSXBase.HTMLAttributes<HTMLMrdEmailFieldElement>;
2037
2312
  "mrd-field": LocalJSX.IntrinsicElements["mrd-field"] & JSXBase.HTMLAttributes<HTMLMrdFieldElement>;
2038
2313
  "mrd-file-field": LocalJSX.IntrinsicElements["mrd-file-field"] & JSXBase.HTMLAttributes<HTMLMrdFileFieldElement>;
@@ -81,6 +81,26 @@ export interface RelationSearchResult {
81
81
  label: string;
82
82
  description?: string;
83
83
  }
84
+ /**
85
+ * A resolved archetype binding as published on a dashboard.
86
+ * `archetype` is the platform-defined id (e.g. `commons.document`); `slots` maps
87
+ * each slot name to the concrete field/relation name on this type. The client
88
+ * keys on the archetype id and reads values from the data endpoint via the map;
89
+ * the slot kind (value vs relation) is known from the archetype id itself and is
90
+ * not published.
91
+ */
92
+ export interface ClientArchetype {
93
+ archetype: string;
94
+ slots: Record<string, string>;
95
+ }
96
+ /** Well-known archetype ids the client renders specially. */
97
+ export declare const ARCHETYPE_DOCUMENT = "commons.document";
98
+ /**
99
+ * Find a binding for `archetypeId` in a published `archetypes` list.
100
+ * Returns `undefined` when the archetype is absent — callers fall back to the
101
+ * generic table/field rendering.
102
+ */
103
+ export declare function resolveArchetype(archetypes: ClientArchetype[] | null | undefined, archetypeId: string): ClientArchetype | undefined;
84
104
  export interface ClientLayoutItemField {
85
105
  name: string;
86
106
  label: string;
@@ -162,6 +182,15 @@ export interface ClientLayoutItem {
162
182
  relatedView?: ClientLayoutItemRelatedView;
163
183
  relatedObject?: ClientLayoutItemRelatedObject;
164
184
  search?: ClientLayoutItemSearch;
185
+ /**
186
+ * Archetype bindings for this item. The API publishes them on the item itself
187
+ * (sibling of `view`), for two cases:
188
+ * - object dashboard top-level: the type of the object itself → mrd-layout-section
189
+ * renders a recognisable single-document view instead of generic fields;
190
+ * - a VIEW / RELATED_VIEW item: → mrd-layout-section offers the document
191
+ * collection view (folder tree) alongside the generic table.
192
+ */
193
+ archetypes?: ClientArchetype[];
165
194
  name?: string;
166
195
  showTitle?: boolean;
167
196
  /** Embedded alternative view configs (new flat format). */
@@ -229,9 +258,18 @@ export interface ClientViewMetadata {
229
258
  filterType?: string | null;
230
259
  singularLabel?: string;
231
260
  pluralLabel?: string;
261
+ /**
262
+ * Archetype bindings published on this VIEW / RELATED_VIEW item. When it
263
+ * contains `commons.document`, mrd-layout-section offers the document
264
+ * collection view (folder tree) alongside the generic table.
265
+ */
266
+ archetypes?: ClientArchetype[];
232
267
  }
233
268
  export interface ClientDashboardMetadata {
234
269
  layouts: ClientLayout[];
270
+ /** Top-level archetypes on an object dashboard (the object's own type). Drives the
271
+ * single-document view; passed to the main layout's mrd-layout-section. */
272
+ archetypes?: ClientArchetype[];
235
273
  /** Legacy: view metadata map keyed by generated name. Absent in new flat format. */
236
274
  views?: Record<string, ClientViewMetadata>;
237
275
  layoutType: ClientLayoutType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmlogic/components",
3
- "version": "0.3.5",
3
+ "version": "0.3.9",
4
4
  "description": "Stencil.js web component library for dynamic forms and virtual-scroll data tables",
5
5
  "license": "MIT",
6
6
  "author": "Mosterd",