@mmlogic/components 0.3.8 → 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 (77) 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} +504 -23
  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 +153 -15
  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-time-field/mrd-time-field.js +1 -1
  25. package/dist/collection/dev/app.js +19 -2
  26. package/dist/collection/types/client-layout.js +10 -0
  27. package/dist/collection/utils/i18n.js +24 -0
  28. package/dist/components/client-layout.js +1 -1
  29. package/dist/components/format.js +1 -1
  30. package/dist/components/i18n.js +1 -1
  31. package/dist/components/index.js +1 -1
  32. package/dist/components/mrd-boolean-field2.js +1 -1
  33. package/dist/components/mrd-currency-field2.js +1 -1
  34. package/dist/components/mrd-date-field2.js +1 -1
  35. package/dist/components/mrd-datetime-field2.js +1 -1
  36. package/dist/components/mrd-document-list.d.ts +11 -0
  37. package/dist/components/mrd-document-list.js +1 -0
  38. package/dist/components/mrd-document-list2.js +1 -0
  39. package/dist/components/mrd-document-view.d.ts +11 -0
  40. package/dist/components/mrd-document-view.js +1 -0
  41. package/dist/components/mrd-document-view2.js +1 -0
  42. package/dist/components/mrd-email-field2.js +1 -1
  43. package/dist/components/mrd-file-field2.js +1 -1
  44. package/dist/components/mrd-image-field2.js +1 -1
  45. package/dist/components/mrd-layout-section.js +1 -1
  46. package/dist/components/mrd-longtext-field2.js +1 -1
  47. package/dist/components/mrd-number-field2.js +1 -1
  48. package/dist/components/mrd-secret-field2.js +1 -1
  49. package/dist/components/mrd-table2.js +1 -1
  50. package/dist/components/mrd-text-field2.js +1 -1
  51. package/dist/components/mrd-textarea-field2.js +1 -1
  52. package/dist/components/mrd-time-field2.js +1 -1
  53. package/dist/esm/index.js +11 -1
  54. package/dist/esm/loader.js +1 -1
  55. package/dist/esm/mosterdcomponents.js +1 -1
  56. package/dist/esm/{mrd-boolean-field_20.entry.js → mrd-boolean-field_22.entry.js} +504 -25
  57. package/dist/mosterdcomponents/index.esm.js +1 -1
  58. package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
  59. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  60. package/dist/mosterdcomponents/p-b547291b.entry.js +1 -0
  61. package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +108 -0
  62. package/dist/types/components/mrd-document-view/mrd-document-view.d.ts +36 -0
  63. package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +33 -6
  64. package/dist/types/components.d.ts +290 -15
  65. package/dist/types/types/client-layout.d.ts +38 -0
  66. package/package.json +1 -1
  67. package/dist/mosterdcomponents/cell-renderer-CbRwLOo8.js.map +0 -1
  68. package/dist/mosterdcomponents/client-layout-D88nn5zf.js.map +0 -1
  69. package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
  70. package/dist/mosterdcomponents/i18n-hoGGKbKU.js.map +0 -1
  71. package/dist/mosterdcomponents/index-6yQUNVww.js.map +0 -1
  72. package/dist/mosterdcomponents/index-I5SuYv7a.js.map +0 -1
  73. package/dist/mosterdcomponents/index.esm.js.map +0 -1
  74. package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
  75. package/dist/mosterdcomponents/p-7bfaee51.entry.js +0 -1
  76. package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
  77. package/dist/mosterdcomponents/validation-ixb43cqU.js.map +0 -1
@@ -0,0 +1,108 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { ClientArchetype, ClientLayoutItem } from '../../types/client-layout';
3
+ /** A distinct value as returned by the /distinct endpoint. */
4
+ export interface DistinctValue {
5
+ /** Relation slot → `{ href, name }`; value slot (folder) → the raw path string. */
6
+ value: {
7
+ href: string;
8
+ name: string;
9
+ } | string | number | null;
10
+ count: number;
11
+ }
12
+ /** A loaded document row (raw data object from the /data endpoint). */
13
+ export type DocRow = Record<string, any>;
14
+ /**
15
+ * Archetype-driven document collection view. Renders documents as a lazy,
16
+ * file-explorer-style folder tree, grouped by the `commons.document` archetype's
17
+ * `container` (dossier, the top folder) and `folder` (a path string like
18
+ * `/draft documents/may 2020`, the sub-path beneath it).
19
+ *
20
+ * Loading is lazy per level, mirroring the /distinct endpoint (FINDING-0106):
21
+ * - on load → `mrdLoadDistinct` for the `container` relation → top folders;
22
+ * - on expanding a container → `mrdLoadDistinct` for the `folder` field, filtered
23
+ * by `{containerField}_href` → all folder path strings for that container
24
+ * (the client splits them on `/` and builds the sub-tree locally);
25
+ * - on expanding a node that holds documents → `mrdLoadPage` (a plain filtered list
26
+ * load, the same one a table page uses), filtered by container + exact folder string.
27
+ *
28
+ * When exactly one container exists (e.g. a dossier detail page) the container
29
+ * level is hidden and its folder tree is shown directly at the root.
30
+ */
31
+ export declare class MrdDocumentList {
32
+ el: HTMLElement;
33
+ /** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
34
+ item: ClientLayoutItem | null;
35
+ /** Resolved `commons.document` binding: slot name → concrete field/relation name. */
36
+ archetype: ClientArchetype;
37
+ /** Parent record id — required for RELATED_VIEW path building. */
38
+ parentId: string;
39
+ locale: string;
40
+ /** Request distinct values for a field/relation. Host fetches `{path}?{qs}` and calls `setDistinct(nodeId, values)`. */
41
+ mrdLoadDistinct: EventEmitter<{
42
+ nodeId: string;
43
+ distinct: string;
44
+ path: string;
45
+ qs: string;
46
+ }>;
47
+ /** Request the documents in one folder — the same filtered list load a table does.
48
+ * Host fetches `{path}?{qs}` and calls `setDocuments(nodeId, docs)` (via setViewPage). */
49
+ mrdLoadPage: EventEmitter<{
50
+ nodeId: string;
51
+ page: number;
52
+ sort: string;
53
+ path: string;
54
+ qs: string;
55
+ }>;
56
+ /** A document row was clicked. Host routes to the document object page. */
57
+ mrdNavigate: EventEmitter<{
58
+ href?: string;
59
+ label: string;
60
+ }>;
61
+ /** Root sentinel id for the container-level distinct request. */
62
+ private static readonly ROOT;
63
+ private containers;
64
+ private rootLoading;
65
+ /** True when the single-container level is collapsed away (dossier context). */
66
+ private singleContainer;
67
+ private nodeIndex;
68
+ componentDidLoad(): void;
69
+ private get containerField();
70
+ private get folderField();
71
+ private get titleField();
72
+ private get dateField();
73
+ /** VIEW: `/{dataClass}`; RELATED_VIEW: `/{fromClass}/{parentId}/{dataClass}`. */
74
+ private buildDataPath;
75
+ /** View-level static filters + filterClass, shared by every request. */
76
+ private baseParams;
77
+ private emitContainerDistinct;
78
+ private emitFolderDistinct;
79
+ private emitDocuments;
80
+ /** Inject distinct values for a node. `nodeId` is the sentinel root (containers)
81
+ * or a container node id (folders). */
82
+ setDistinct(nodeId: string, values: DistinctValue[]): Promise<void>;
83
+ /** Inject the documents loaded for one folder node. */
84
+ setDocuments(nodeId: string, docs: DocRow[]): Promise<void>;
85
+ private applyContainers;
86
+ private applyFolders;
87
+ /** Normalise a folder path: null/""/"/" → root ([]); else split on "/" dropping empties. */
88
+ private splitFolder;
89
+ private makeContainerNode;
90
+ private makeFolderNode;
91
+ private computeTotals;
92
+ /** Force a re-render after mutating nodes in place. */
93
+ private bump;
94
+ private toggleContainer;
95
+ private toggleFolder;
96
+ private openDoc;
97
+ private renderChevron;
98
+ private renderDossierIcon;
99
+ private renderFolderIcon;
100
+ private renderDocIcon;
101
+ private indent;
102
+ private renderDocRow;
103
+ private renderLoadingRow;
104
+ private renderChildren;
105
+ private renderFolderNode;
106
+ private renderContainerNode;
107
+ render(): any;
108
+ }
@@ -0,0 +1,36 @@
1
+ import { EventEmitter } from '../../stencil-public-runtime';
2
+ import { ClientArchetype } from '../../types/client-layout';
3
+ /**
4
+ * Archetype-driven single-document view. Given a `commons.document` binding and a
5
+ * data record, renders the document recognisably — title, file preview/download,
6
+ * summary and date — plus a navigation link to the container (the dossier),
7
+ * instead of a generic field form.
8
+ *
9
+ * The component keys on the slot→field map (`archetype.slots`) to locate values:
10
+ * value slots read `data[field]`; the `container` relation slot reads
11
+ * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
12
+ */
13
+ export declare class MrdDocumentView {
14
+ /** Resolved `commons.document` binding: slot name → concrete field/relation name. */
15
+ archetype: ClientArchetype;
16
+ /** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
17
+ data: Record<string, unknown>;
18
+ locale: string;
19
+ /** Navigate to the container (dossier). Host resolves the href and routes. */
20
+ mrdNavigate: EventEmitter<{
21
+ href?: string;
22
+ label: string;
23
+ }>;
24
+ /** Download the document file. Host resolves the href to a signed URL. */
25
+ mrdDownload: EventEmitter<{
26
+ href: string;
27
+ fileName: string;
28
+ }>;
29
+ /** Value of a value-slot: reads data[field] via the slot→field map. */
30
+ private slotValue;
31
+ /** Relation link for a relation-slot: reads data._links[field]. */
32
+ private slotLink;
33
+ private renderContainer;
34
+ private renderFile;
35
+ render(): any;
36
+ }
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../stencil-public-runtime';
2
- import { ClientLayoutItem, ClientLayoutItemNavigate, ClientViewMetadata, RelationSearchResult } from '../../types/client-layout';
2
+ import { ClientLayoutItem, ClientLayoutItemNavigate, ClientViewMetadata, ClientArchetype, RelationSearchResult } from '../../types/client-layout';
3
+ import { DistinctValue } from '../mrd-document-list/mrd-document-list';
3
4
  export declare class MrdLayoutSection {
4
5
  el: HTMLElement;
5
6
  /** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
@@ -13,11 +14,16 @@ export declare class MrdLayoutSection {
13
14
  href: string;
14
15
  }>;
15
16
  locale: string;
17
+ /** Top-level archetypes on the object dashboard. When it contains commons.document,
18
+ * the record is rendered as a single-document view instead of generic fields. */
19
+ archetypes: ClientArchetype[];
16
20
  private searchQueryMap;
17
21
  private searchResultsMap;
18
22
  private imagePreviewUrl;
19
23
  private imagePreviews;
20
24
  private openHistoryField;
25
+ /** Per-view display mode for document collection views. Default 'tree'. */
26
+ private docViewMode;
21
27
  private historyClickOutside;
22
28
  mrdNavigate: EventEmitter<{
23
29
  href?: string;
@@ -32,13 +38,15 @@ export declare class MrdLayoutSection {
32
38
  href: string;
33
39
  fileName: string;
34
40
  }>;
35
- /** Re-emitted from an embedded mrd-table's mrdLoadPage; host fetches the next page and calls setViewPage(). */
41
+ /** Re-emitted from an embedded mrd-table's or mrd-document-list's mrdLoadPage; host fetches the
42
+ * rows and calls setViewPage(). `nodeId` is present for a document-list folder load. */
36
43
  mrdLoadViewPage: EventEmitter<{
37
44
  name: string;
38
45
  page: number;
39
46
  sort: string;
40
47
  path: string;
41
48
  qs: string;
49
+ nodeId?: string;
42
50
  }>;
43
51
  /** Fired once on load for each IMAGE field that has an href; host resolves the URL and calls setImagePreview(). */
44
52
  mrdLoadImage: EventEmitter<{
@@ -63,6 +71,14 @@ export declare class MrdLayoutSection {
63
71
  qs: string;
64
72
  aggQs: string;
65
73
  }>;
74
+ /** Re-emitted from an embedded mrd-document-list's mrdLoadDistinct; host fetches distinct values and calls setViewDistinct(). */
75
+ mrdLoadViewDistinct: EventEmitter<{
76
+ name: string;
77
+ nodeId: string;
78
+ distinct: string;
79
+ path: string;
80
+ qs: string;
81
+ }>;
66
82
  private searchTimers;
67
83
  componentDidLoad(): void;
68
84
  disconnectedCallback(): void;
@@ -74,13 +90,16 @@ export declare class MrdLayoutSection {
74
90
  /** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
75
91
  setSearchResults(results: RelationSearchResult[], dataClass?: string): Promise<void>;
76
92
  /**
77
- * Inject data into an embedded mrd-table for a RELATED_VIEW or VIEW item.
78
- * Pass totalElements to update the pagination total (safe to pass on every page).
79
- * Pass hasNext (from _links.next presence) so the table can decide whether to emit aggregations.
93
+ * Inject rows for a VIEW / RELATED_VIEW item.
94
+ * - Table view: injects the page into the embedded mrd-table (pass totalElements/hasNext).
95
+ * - Document view: pass `nodeId` to route the rows to that folder node in the embedded
96
+ * mrd-document-list. Folder loading is just a filtered list load, so it reuses this method.
80
97
  */
81
- setViewPage(name: string, page: number, rows: any[], totalElements?: number, hasNext?: boolean): Promise<void>;
98
+ setViewPage(name: string, page: number, rows: any[], totalElements?: number, hasNext?: boolean, nodeId?: string): Promise<void>;
82
99
  /** Inject aggregation totals into an embedded mrd-table for a VIEW or RELATED_VIEW item. */
83
100
  setViewAggregations(name: string, data: any): Promise<void>;
101
+ /** Inject distinct values into an embedded mrd-document-list for a document view. */
102
+ setViewDistinct(name: string, nodeId: string, values: DistinctValue[]): Promise<void>;
84
103
  /** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
85
104
  setImagePreview(fieldName: string, url: string): Promise<void>;
86
105
  /** Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field). */
@@ -95,7 +114,15 @@ export declare class MrdLayoutSection {
95
114
  private renderRelation;
96
115
  private renderSearch;
97
116
  private renderRelatedView;
117
+ /** Tree / list segmented toggle for document collection views (+ upload placeholder). */
118
+ private renderDocToolbar;
119
+ private renderDocumentList;
120
+ private renderTable;
98
121
  private renderItem;
99
122
  private renderImageModal;
123
+ /** Single-document view: the record's own type carries commons.document. Renders
124
+ * a recognisable document instead of generic fields, keeping any related views/
125
+ * searches below it. */
126
+ private renderDocumentObject;
100
127
  render(): any;
101
128
  }