@mmlogic/components 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cjs/client-layout-RZ3Ix-4a.js +87 -0
  2. package/dist/cjs/{index-CAzwGt9u.js → index-DzRfoAPz.js} +36 -9
  3. package/dist/cjs/index.cjs.js +56 -81
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/mosterdcomponents.cjs.js +3 -3
  6. package/dist/cjs/{mrd-boolean-field_24.cjs.entry.js → mrd-boolean-field_23.cjs.entry.js} +175 -287
  7. package/dist/collection/collection-manifest.json +1 -2
  8. package/dist/collection/components/documents/mrd-document-container/mrd-document-container.css +0 -17
  9. package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +20 -5
  10. package/dist/collection/components/documents/mrd-document-list/mrd-document-list.css +9 -43
  11. package/dist/collection/components/documents/mrd-document-list/mrd-document-list.js +36 -11
  12. package/dist/collection/components/documents/mrd-document-list/tree-view.js +1 -1
  13. package/dist/collection/components/documents/mrd-document-view/mrd-document-view.css +3 -44
  14. package/dist/collection/components/documents/mrd-document-view/mrd-document-view.js +37 -85
  15. package/dist/collection/components/fields/mrd-boolean-field/mrd-boolean-field.css +0 -10
  16. package/dist/collection/components/fields/mrd-currency-field/mrd-currency-field.css +0 -7
  17. package/dist/collection/components/fields/mrd-file-field/mrd-file-field.css +0 -11
  18. package/dist/collection/components/fields/mrd-hyperlink-field/mrd-hyperlink-field.css +0 -3
  19. package/dist/collection/components/fields/mrd-image-field/mrd-image-field.css +6 -20
  20. package/dist/collection/components/fields/mrd-list-field/mrd-list-field.css +0 -4
  21. package/dist/collection/components/fields/mrd-longtext-field/mrd-longtext-field.css +0 -1
  22. package/dist/collection/components/fields/mrd-relation-field/mrd-relation-field.css +9 -35
  23. package/dist/collection/components/fields/mrd-textarea-field/mrd-textarea-field.css +0 -9
  24. package/dist/collection/components/form/mrd-field/mrd-field.css +0 -13
  25. package/dist/collection/components/form/mrd-form/mrd-form.css +0 -19
  26. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.css +3 -58
  27. package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +33 -67
  28. package/dist/collection/components/table/mrd-table/mrd-table.css +38 -185
  29. package/dist/collection/components/table/mrd-table/mrd-table.js +20 -6
  30. package/dist/collection/dev/app.js +80 -43
  31. package/dist/collection/index.js +1 -0
  32. package/dist/collection/utils/document-attachments.js +20 -0
  33. package/dist/collection/{components/documents/mrd-file-preview → utils}/file-preview-kind.js +4 -4
  34. package/dist/collection/utils/i18n.js +0 -32
  35. package/dist/collection/utils/query-params.js +0 -4
  36. package/dist/components/document-attachments.js +1 -0
  37. package/dist/components/field-helpers.js +1 -1
  38. package/dist/components/i18n.js +1 -1
  39. package/dist/components/index.js +1 -1
  40. package/dist/components/mrd-document-container2.js +1 -1
  41. package/dist/components/mrd-document-list2.js +1 -1
  42. package/dist/components/mrd-document-view2.js +1 -1
  43. package/dist/components/mrd-email-field2.js +1 -1
  44. package/dist/components/mrd-form.js +1 -1
  45. package/dist/components/mrd-hyperlink-field2.js +1 -1
  46. package/dist/components/mrd-image-field2.js +1 -1
  47. package/dist/components/mrd-layout-section.js +1 -1
  48. package/dist/components/mrd-number-field2.js +1 -1
  49. package/dist/components/mrd-relation-field2.js +1 -1
  50. package/dist/components/mrd-table2.js +1 -1
  51. package/dist/esm/client-layout-DCOAAH92.js +84 -0
  52. package/dist/esm/{index-DiSEJMA8.js → index-DiSe6vjv.js} +36 -9
  53. package/dist/esm/index.js +30 -80
  54. package/dist/esm/loader.js +3 -3
  55. package/dist/esm/mosterdcomponents.js +4 -4
  56. package/dist/esm/{mrd-boolean-field_24.entry.js → mrd-boolean-field_23.entry.js} +85 -196
  57. package/dist/mosterdcomponents/index.esm.js +1 -1
  58. package/dist/mosterdcomponents/mosterdcomponents.css +7 -1
  59. package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
  60. package/dist/mosterdcomponents/p-DCOAAH92.js +1 -0
  61. package/dist/mosterdcomponents/p-DiSe6vjv.js +2 -0
  62. package/dist/mosterdcomponents/p-b56f9802.entry.js +1 -0
  63. package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +6 -2
  64. package/dist/types/components/documents/mrd-document-list/mrd-document-list.d.ts +13 -2
  65. package/dist/types/components/documents/mrd-document-list/tree-view.d.ts +1 -1
  66. package/dist/types/components/documents/mrd-document-view/mrd-document-view.d.ts +21 -27
  67. package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +14 -15
  68. package/dist/types/components/table/mrd-table/mrd-table.d.ts +8 -2
  69. package/dist/types/components.d.ts +54 -190
  70. package/dist/types/index.d.ts +3 -0
  71. package/dist/types/stencil-public-runtime.d.ts +1 -0
  72. package/dist/types/types/client-layout.d.ts +8 -0
  73. package/dist/types/utils/document-attachments.d.ts +8 -0
  74. package/dist/types/utils/file-preview-kind.d.ts +9 -0
  75. package/dist/types/utils/query-params.d.ts +14 -0
  76. package/package.json +10 -12
  77. package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.css +0 -59
  78. package/dist/collection/components/documents/mrd-file-preview/mrd-file-preview.js +0 -212
  79. package/dist/components/mrd-file-preview.d.ts +0 -11
  80. package/dist/components/mrd-file-preview.js +0 -1
  81. package/dist/components/mrd-file-preview2.js +0 -1
  82. package/dist/mosterdcomponents/cell-renderer-PbcEU4ph.js.map +0 -1
  83. package/dist/mosterdcomponents/client-layout-DCOAAH92.js.map +0 -1
  84. package/dist/mosterdcomponents/field-helpers-CASS3akr.js.map +0 -1
  85. package/dist/mosterdcomponents/file-upload-common-D1ndi6cN.js.map +0 -1
  86. package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
  87. package/dist/mosterdcomponents/i18n-B1IIkRF9.js.map +0 -1
  88. package/dist/mosterdcomponents/index-AokUFVX0.js.map +0 -1
  89. package/dist/mosterdcomponents/index-CprJSlzK.js.map +0 -1
  90. package/dist/mosterdcomponents/index.esm.js.map +0 -1
  91. package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
  92. package/dist/mosterdcomponents/p-DiSEJMA8.js +0 -2
  93. package/dist/mosterdcomponents/p-aae8a9dc.entry.js +0 -1
  94. package/dist/mosterdcomponents/query-params-B1HfnMOl.js.map +0 -1
  95. package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
  96. package/dist/mosterdcomponents/validation-DbEViuiw.js.map +0 -1
  97. package/dist/types/components/documents/mrd-file-preview/file-preview-kind.d.ts +0 -9
  98. package/dist/types/components/documents/mrd-file-preview/mrd-file-preview.d.ts +0 -41
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
- import { ClientArchetype, ClientLayoutItem, ClientLayoutNavigateBehaviour } from '../../../types/client-layout';
2
+ import { ClientArchetype, ClientLayoutItem, ClientLayoutNavigateBehaviour, DocumentAttachment } from '../../../types/client-layout';
3
+ import { ListNavigationContext } from '../../../utils/query-params';
3
4
  /**
4
5
  * Owns a document collection view: a single toolbar (view switch + collection
5
6
  * actions like "New folder", and — later — upload / drag-drop) plus the two
@@ -52,11 +53,14 @@ export declare class MrdDocumentContainer {
52
53
  /** A row / document was activated. Host routes to the object page. Documents
53
54
  * are always the "quick look" use case, so navigateBehaviour is hardcoded
54
55
  * to OVERLAY_PAGE here — unlike the generic VIEW/RELATED_VIEW table path in
55
- * mrd-layout-section, which takes it from the item's configuration. */
56
+ * mrd-layout-section, which takes it from the item's configuration.
57
+ * `attachments` prefetches the clicked row's file slot (see TASK-0169). */
56
58
  mrdNavigate: EventEmitter<{
57
59
  href?: string;
58
60
  label: string;
59
61
  navigateBehaviour?: ClientLayoutNavigateBehaviour;
62
+ listContext?: ListNavigationContext;
63
+ attachments?: DocumentAttachment[];
60
64
  }>;
61
65
  /** A table toolbar action was triggered. */
62
66
  mrdAction: EventEmitter<{
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
- import { ClientArchetype, ClientLayoutItem } from '../../../types/client-layout';
2
+ import { ClientArchetype, ClientLayoutItem, DocumentAttachment } from '../../../types/client-layout';
3
+ import { ListNavigationContext } from '../../../utils/query-params';
3
4
  import { DistinctValue, DocRow } from './folder-tree';
4
5
  /**
5
6
  * Archetype-driven document collection view. Renders documents as a lazy,
@@ -48,10 +49,16 @@ export declare class MrdDocumentList {
48
49
  path: string;
49
50
  qs: string;
50
51
  }>;
51
- /** A document row was clicked. Host routes to the document object page. */
52
+ /** A document row was clicked. Host routes to the document object page. `listContext` can
53
+ * be used to re-fetch this exact record (or its neighbours) via `{path}?{qs}&page={index}&size=1`.
54
+ * `attachments` is a prefetch of the clicked row's own file slot (derived from `archetype`)
55
+ * so the host can render a preview immediately, without waiting for the navigated-to
56
+ * page's own mrdAttachments — see TASK-0169 / FINDING-0111. */
52
57
  mrdNavigate: EventEmitter<{
53
58
  href?: string;
54
59
  label: string;
60
+ listContext?: ListNavigationContext;
61
+ attachments?: DocumentAttachment[];
55
62
  }>;
56
63
  /** Emitted whenever the "can create a folder here" state changes, so a host
57
64
  * toolbar (mrd-document-container) can enable/disable its New folder button. */
@@ -143,6 +150,10 @@ export declare class MrdDocumentList {
143
150
  private baseParams;
144
151
  private emitContainerDistinct;
145
152
  private emitFolderDistinct;
153
+ /** Filter qs scoping a folder's documents: view-level filters + container/folder match.
154
+ * Shared by emitDocuments() (the fetch) and openDoc() (prev/next list context), so both
155
+ * always agree on exactly what query a document belongs to. */
156
+ private buildDocQs;
146
157
  private emitDocuments;
147
158
  /** Inject distinct values for a node. `nodeId` is the sentinel root (containers)
148
159
  * or a container node id (folders). */
@@ -14,7 +14,7 @@ export interface TreeViewContext {
14
14
  on: {
15
15
  toggleContainer: (node: TreeNode) => void;
16
16
  toggleFolder: (container: TreeNode, node: TreeNode) => void;
17
- openDoc: (doc: DocRow) => void;
17
+ openDoc: (doc: DocRow, node: TreeNode, container: TreeNode) => void;
18
18
  docDragStart: (e: DragEvent, doc: DocRow, node: TreeNode) => void;
19
19
  docDragEnd: () => void;
20
20
  nodeDragOver: (e: DragEvent, node: TreeNode) => void;
@@ -1,14 +1,20 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
- import { ClientArchetype } from '../../../types/client-layout';
2
+ import { ClientArchetype, DocumentAttachment } from '../../../types/client-layout';
3
3
  /**
4
4
  * Archetype-driven single-document view. Given a `commons.document` binding and a
5
- * data record, renders the document recognisably — title, file preview/download,
5
+ * data record, renders the document recognisably — title, filename/download,
6
6
  * summary and date — plus a navigation link to the container (the dossier),
7
7
  * instead of a generic field form.
8
8
  *
9
9
  * The component keys on the slot→field map (`archetype.slots`) to locate values:
10
10
  * value slots read `data[field]`; the `container` relation slot reads
11
11
  * `data._links[field]` (`{ href, name }`). Empty slots are omitted.
12
+ *
13
+ * This component never renders the file itself (no iframe/image preview) — it
14
+ * only ever exposes the file reference via `mrdAttachments`. The host resolves
15
+ * the href and decides how (or whether) to show it inline, so the preview can
16
+ * live anywhere in the host's own layout instead of being boxed into this
17
+ * component's DOM (see TASK-0165 / FINDING-0111).
12
18
  */
13
19
  export declare class MrdDocumentView {
14
20
  /** Resolved `commons.document` binding: slot name → concrete field/relation name. */
@@ -16,15 +22,6 @@ export declare class MrdDocumentView {
16
22
  /** The data record from the /data endpoint. Fields keyed by name; relations under `_links`. */
17
23
  data: Record<string, unknown>;
18
24
  locale: string;
19
- /** Signed URL for the file's inline preview (mrd-file-preview), resolved by
20
- * the host in response to mrdLoadPreview. Empty while unresolved — the
21
- * preview area shows a loading state until the host injects a value. */
22
- previewUrl: string;
23
- /** Minimum height (px) of the inline preview area — it stretches to fill the
24
- * available row height in the wide side-by-side layout (see mrd-document-view.scss),
25
- * and falls back to this height when stacked. Overlay hosts typically pass a
26
- * smaller value than the full-page default to fit available chrome. */
27
- previewHeight: number;
28
25
  /** Navigate to the container (dossier). Host resolves the href and routes. */
29
26
  mrdNavigate: EventEmitter<{
30
27
  href?: string;
@@ -35,30 +32,27 @@ export declare class MrdDocumentView {
35
32
  href: string;
36
33
  fileName: string;
37
34
  }>;
38
- /** The file slot has an href and needs a signed URL for inline preview.
39
- * Fired once on load and again whenever the file href changes (e.g. the
40
- * overlay is reused for a different document via prev/next). Host resolves
41
- * it and calls back with `previewUrl` the same pattern as mrdLoadImage /
42
- * setImagePreview on mrd-layout-section. */
43
- mrdLoadPreview: EventEmitter<{
44
- href: string;
35
+ /** The file(s) belonging to this document, fired once on load and again
36
+ * whenever the file slot's value changes (e.g. the overlay is reused for a
37
+ * different document via prev/next). The host resolves the href(s) itself
38
+ * and decides whether/how to render them (e.g. pdf.js next to the layout) —
39
+ * this component does not fetch or preview the file. */
40
+ mrdAttachments: EventEmitter<{
41
+ attachments: DocumentAttachment[];
45
42
  }>;
46
- /** Tracks the href a preview was last requested for, so componentDidLoad and
47
- * the data watcher don't emit duplicate requests for the same file. */
48
- private lastPreviewHref;
43
+ /** Tracks the href attachments were last emitted for, so componentDidLoad and
44
+ * the data watcher don't emit duplicate events for the same file. */
45
+ private lastAttachmentHref;
49
46
  componentDidLoad(): void;
50
47
  dataChanged(): void;
51
- private requestPreviewIfNeeded;
48
+ private emitAttachmentsIfNeeded;
52
49
  /** Value of a value-slot: reads data[field] via the slot→field map. */
53
50
  private slotValue;
54
51
  /** Relation link for a relation-slot: reads data._links[field]. */
55
52
  private slotLink;
56
53
  private renderContainer;
57
- /** Filename + download button — part of the metadata column, not the preview
58
- * panel, so it stays next to the title/summary in the wide side-by-side layout. */
54
+ /** Filename + download button — the only file-related UI this component owns;
55
+ * inline preview rendering is entirely the host's responsibility. */
59
56
  private renderFileMeta;
60
- /** The preview panel itself (iframe/image/loading state) — its own grid
61
- * column in the wide layout, so it can take the full available height. */
62
- private renderPreviewPanel;
63
57
  render(): any;
64
58
  }
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
- import { ClientLayoutItem, ClientLayoutItemNavigate, ClientLayoutNavigateBehaviour, ClientViewMetadata, ClientArchetype, RelationSearchResult } from '../../../types/client-layout';
2
+ import { ClientLayoutItem, ClientLayoutItemNavigate, ClientLayoutNavigateBehaviour, ClientViewMetadata, ClientArchetype, RelationSearchResult, DocumentAttachment } from '../../../types/client-layout';
3
3
  import { DistinctValue } from '../../documents/mrd-document-list/folder-tree';
4
+ import { ListNavigationContext } from '../../../utils/query-params';
4
5
  export declare class MrdLayoutSection {
5
6
  el: HTMLElement;
6
7
  /** Items from one layout entry in ClientDashboardMetadata.layouts[]. */
@@ -17,23 +18,23 @@ export declare class MrdLayoutSection {
17
18
  /** Top-level archetypes on the object dashboard. When it contains commons.document,
18
19
  * the record is rendered as a single-document view instead of generic fields. */
19
20
  archetypes: ClientArchetype[];
20
- /** Minimum height (px) of the commons.document inline file preview — it
21
- * stretches taller in the wide side-by-side layout. Pass a smaller value
22
- * when embedding the record in an overlay with limited height. */
23
- documentPreviewHeight: number;
24
21
  private searchQueryMap;
25
22
  private searchResultsMap;
26
23
  private imagePreviewUrl;
27
24
  private imagePreviews;
28
25
  private openHistoryField;
29
- /** Signed URL for the commons.document archetype's inline file preview. */
30
- private documentPreviewUrl;
31
26
  private historyClickOutside;
27
+ /** `attachments`, when present, prefetches the clicked document row's file slot
28
+ * (see TASK-0169 / FINDING-0111) so the host can render a preview immediately,
29
+ * without waiting for the navigated-to page's own mrdAttachments. Only set for
30
+ * commons.document rows opened from an embedded document view. */
32
31
  mrdNavigate: EventEmitter<{
33
32
  href?: string;
34
33
  label: string;
35
34
  navigate?: ClientLayoutItemNavigate;
36
35
  navigateBehaviour?: ClientLayoutNavigateBehaviour;
36
+ listContext?: ListNavigationContext;
37
+ attachments?: DocumentAttachment[];
37
38
  }>;
38
39
  mrdSearch: EventEmitter<{
39
40
  query: string;
@@ -58,11 +59,12 @@ export declare class MrdLayoutSection {
58
59
  fieldName: string;
59
60
  href: string;
60
61
  }>;
61
- /** Re-emitted from an embedded mrd-document-view's mrdLoadPreview (commons.document
62
- * single-object view); host resolves the file href to a signed URL and calls
63
- * setDocumentPreviewUrl(). */
64
- mrdLoadDocumentPreview: EventEmitter<{
65
- href: string;
62
+ /** Re-emitted from an embedded mrd-document-view (commons.document single-object
63
+ * view) whenever its file slot's value changes. The component never renders the
64
+ * file itself — the host resolves the href(s) and decides how/whether to show
65
+ * them, e.g. in a panel next to this mrd-layout-section. */
66
+ mrdAttachments: EventEmitter<{
67
+ attachments: DocumentAttachment[];
66
68
  }>;
67
69
  /** Re-emitted from an embedded mrd-table's mrdAction; host builds the target URL from dataClass. */
68
70
  mrdViewAction: EventEmitter<{
@@ -138,9 +140,6 @@ export declare class MrdLayoutSection {
138
140
  setImagePreview(fieldName: string, url: string): Promise<void>;
139
141
  /** Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field). */
140
142
  openImagePreview(url: string): Promise<void>;
141
- /** Provide a resolved signed URL for the commons.document archetype's inline
142
- * file preview, in response to mrdLoadDocumentPreview. */
143
- setDocumentPreviewUrl(url: string): Promise<void>;
144
143
  private resolveSearchKey;
145
144
  private handleViewLoadPage;
146
145
  private handleSearchInput;
@@ -1,6 +1,7 @@
1
1
  import { EventEmitter } from '../../../stencil-public-runtime';
2
2
  import { ColumnFilter } from '../../../utils/cell-renderer';
3
3
  import { AggregationResult, ClientLayoutItem } from '../../../types/client-layout';
4
+ import { ListNavigationContext } from '../../../utils/query-params';
4
5
  export declare class MrdTable {
5
6
  el: HTMLElement;
6
7
  private pendingPages;
@@ -93,8 +94,13 @@ export declare class MrdTable {
93
94
  mrdPageError: EventEmitter<{
94
95
  page: number;
95
96
  }>;
96
- /** Fired when a data row is clicked. Detail is the full row object including _links. */
97
- mrdRowClick: EventEmitter<Record<string, any>>;
97
+ /** Fired when a data row is clicked. `listContext` is included in paginated mode and can
98
+ * be used to re-fetch this exact record (or its neighbours) via `{path}?{qs}&page={index}&size=1`
99
+ * — omitted in non-paginated (`rows` prop) mode since the host already holds the full array. */
100
+ mrdRowClick: EventEmitter<{
101
+ row: Record<string, any>;
102
+ listContext?: ListNavigationContext;
103
+ }>;
98
104
  /** Fired when a toolbar action button is clicked.
99
105
  * For 'export': includes `path` (relative excel path) and `qs` (current sort+filter params).
100
106
  * For 'create': includes `dataClass` (target type) and `parentPath` (e.g. /buyers/123 for RELATED_VIEW). */