@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.
- package/dist/cjs/index.cjs.js +13 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_20.cjs.entry.js → mrd-boolean-field_22.cjs.entry.js} +504 -23
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +1 -1
- package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +1 -1
- package/dist/collection/components/mrd-date-field/mrd-date-field.js +1 -1
- package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +1 -1
- package/dist/collection/components/mrd-document-list/mrd-document-list.js +578 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.scss +126 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.js +177 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.scss +121 -0
- package/dist/collection/components/mrd-email-field/mrd-email-field.js +1 -1
- package/dist/collection/components/mrd-file-field/mrd-file-field.js +1 -1
- package/dist/collection/components/mrd-image-field/mrd-image-field.js +1 -1
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.js +153 -15
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +46 -3
- package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +1 -1
- package/dist/collection/components/mrd-number-field/mrd-number-field.js +1 -1
- package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +2 -2
- package/dist/collection/components/mrd-text-field/mrd-text-field.js +1 -1
- package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +1 -1
- package/dist/collection/components/mrd-time-field/mrd-time-field.js +1 -1
- package/dist/collection/dev/app.js +19 -2
- package/dist/collection/types/client-layout.js +10 -0
- package/dist/collection/utils/i18n.js +24 -0
- package/dist/components/client-layout.js +1 -1
- package/dist/components/format.js +1 -1
- package/dist/components/i18n.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/mrd-boolean-field2.js +1 -1
- package/dist/components/mrd-currency-field2.js +1 -1
- package/dist/components/mrd-date-field2.js +1 -1
- package/dist/components/mrd-datetime-field2.js +1 -1
- package/dist/components/mrd-document-list.d.ts +11 -0
- package/dist/components/mrd-document-list.js +1 -0
- package/dist/components/mrd-document-list2.js +1 -0
- package/dist/components/mrd-document-view.d.ts +11 -0
- package/dist/components/mrd-document-view.js +1 -0
- package/dist/components/mrd-document-view2.js +1 -0
- package/dist/components/mrd-email-field2.js +1 -1
- package/dist/components/mrd-file-field2.js +1 -1
- package/dist/components/mrd-image-field2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-longtext-field2.js +1 -1
- package/dist/components/mrd-number-field2.js +1 -1
- package/dist/components/mrd-secret-field2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/components/mrd-text-field2.js +1 -1
- package/dist/components/mrd-textarea-field2.js +1 -1
- package/dist/components/mrd-time-field2.js +1 -1
- package/dist/esm/index.js +11 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_20.entry.js → mrd-boolean-field_22.entry.js} +504 -25
- package/dist/mosterdcomponents/index.esm.js +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.css +1 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-b547291b.entry.js +1 -0
- package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +108 -0
- package/dist/types/components/mrd-document-view/mrd-document-view.d.ts +36 -0
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +33 -6
- package/dist/types/components.d.ts +290 -15
- package/dist/types/types/client-layout.d.ts +38 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/cell-renderer-CbRwLOo8.js.map +0 -1
- package/dist/mosterdcomponents/client-layout-D88nn5zf.js.map +0 -1
- package/dist/mosterdcomponents/format-BAfsQfy1.js.map +0 -1
- package/dist/mosterdcomponents/i18n-hoGGKbKU.js.map +0 -1
- package/dist/mosterdcomponents/index-6yQUNVww.js.map +0 -1
- package/dist/mosterdcomponents/index-I5SuYv7a.js.map +0 -1
- package/dist/mosterdcomponents/index.esm.js.map +0 -1
- package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +0 -1
- package/dist/mosterdcomponents/p-7bfaee51.entry.js +0 -1
- package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +0 -1
- package/dist/mosterdcomponents/validation-ixb43cqU.js.map +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
|
|
10
|
-
|
|
11
|
-
|
|
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":
|
|
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":
|
|
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
|
|
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":
|
|
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":
|
|
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"?:
|
|
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-
|
|
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"?:
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cell-renderer-CbRwLOo8.js","sources":["src/utils/cell-renderer.ts"],"sourcesContent":["import { formatNumber, formatPercentage, formatCurrency, formatDate, formatDateTime, formatTime } from './format';\nimport { ClientLayoutItem, ClientLayoutItemType } from '../types/client-layout';\n\n/** TableColumn is an alias for ClientLayoutItem — used for table column definitions. */\nexport type TableColumn = ClientLayoutItem;\n\n/** One entry in the alternativeViews array for mrd-table. */\nexport interface AlternativeView {\n /** Named view identifier, emitted in mrdSwitchView. */\n name: string;\n /** Display text; falls back to name when absent. */\n label?: string;\n /** Optional class override (TypeFQN); emitted in mrdSwitchView. */\n class?: string;\n}\n\n/** Defines a toolbar action button for mrd-table. */\nexport interface TableAction {\n /** Machine-readable identifier, e.g. 'create' | 'export'. Emitted in mrdAction event. */\n action: string;\n /** Tooltip text (and label fallback when no icon is provided). */\n label: string;\n /** SVG sprite href, e.g. \"assets/sprites.svg#icon-plus\". Optional. */\n icon?: string;\n /** Button style variant. Defaults to 'secondary'. */\n variant?: 'primary' | 'secondary' | 'danger';\n disabled?: boolean;\n basicType?: string;\n}\n\n/** Represents an active filter on a single column. */\nexport interface ColumnFilter {\n field: string;\n dataType: string;\n /** Text operator — only relevant for text-like data types. */\n operator?: 'contains' | 'startsWith' | 'equals' | 'isEmpty' | 'isNotEmpty';\n /** Single value (boolean, exact text/number/date). */\n value?: string | number | boolean | null;\n /** Range start (≥) — future API support. */\n from?: string | number | null;\n /** Range end (≤) — future API support. */\n to?: string | number | null;\n /** LIST: keys of selected items to include. */\n values?: string[];\n}\n\nexport class CellRenderer {\n static render(column: TableColumn, row: Record<string, any>, locale: string): string {\n if (column.type === ClientLayoutItemType.RELATION) {\n const name = column.name ?? '';\n const link = row?._links?.[name];\n if (!link) return '';\n if (Array.isArray(link)) return link.map((l: any) => l.name ?? '').filter(Boolean).join(', ');\n return link.name ?? '';\n }\n\n if (column.type !== ClientLayoutItemType.FIELD) return '';\n\n const name = column.name ?? '';\n const dataType = column.dataType;\n const listItems = column.listItems;\n const raw = row?.[name];\n if (raw == null || raw === '') return '';\n\n const values = Array.isArray(raw) ? raw : [raw];\n return values\n .map(v => CellRenderer.renderValue(dataType ?? 'TEXT', v, listItems ?? [], locale))\n .filter(s => s !== '')\n .join(', ');\n }\n\n static renderValue(\n dataType: string,\n value: any,\n listItems: Array<{ key: string; label: string }>,\n locale: string,\n ): string {\n switch (dataType) {\n case 'INTEGER':\n return formatNumber(Number(value), locale, { maximumFractionDigits: 0 });\n case 'DECIMAL':\n return formatNumber(Number(value), locale);\n case 'PERCENTAGE':\n return formatPercentage(Number(value), locale);\n case 'CURRENCY': {\n const { amount, currency } = typeof value === 'object' && value !== null\n ? value\n : { amount: value, currency: '' };\n return currency\n ? formatCurrency(Number(amount), currency, locale)\n : formatNumber(Number(amount), locale);\n }\n case 'DATE':\n return formatDate(value, locale);\n case 'DATETIME':\n return formatDateTime(value, locale);\n case 'TIME':\n return formatTime(value, locale);\n case 'BOOLEAN':\n return value ? '✓' : '';\n case 'FILE':\n case 'IMAGE':\n return typeof value === 'object' && value !== null ? (value.fileName ?? '') : '';\n case 'LIST': {\n const item = listItems.find(li => li.key === String(value));\n return item?.label ?? String(value);\n }\n case 'TEXTBLOCK': {\n const stripped = String(value).replace(/<[^>]*>/g, '');\n const txt = document.createElement('textarea');\n txt.innerHTML = stripped;\n return txt.value.trim();\n }\n case 'LONGTEXT':\n return String(value).replace(/[\\r\\n]+/g, ' ').trim();\n case 'JSON': {\n const str = typeof value === 'object' ? JSON.stringify(value) : String(value);\n return str.replace(/[\\r\\n]+/g, ' ').trim();\n }\n case 'SECRET':\n return value ? '••••••••' : '';\n default:\n return String(value);\n }\n }\n\n /**\n * Returns syntax-highlighted JSON as an HTML string with inline styles.\n * compact=true → single line (no indentation); compact=false → pretty-printed.\n */\n static formatJson(value: any, compact = false): string {\n try {\n const parsed = typeof value === 'string' ? JSON.parse(value) : value;\n const json = compact ? JSON.stringify(parsed) : JSON.stringify(parsed, null, 2);\n return json.replace(\n /(\"(\\\\u[a-zA-Z0-9]{4}|\\\\[^u]|[^\\\\\"])*\"(\\s*:)?|\\b(true|false|null)\\b|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)/g,\n match => {\n let style = 'color:#2aa198';\n if (/^\"/.test(match)) {\n style = /:$/.test(match) ? 'color:#881391' : 'color:#268bd2';\n } else if (/true|false/.test(match)) {\n style = 'color:#b58900';\n } else if (/null/.test(match)) {\n style = 'color:#dc322f';\n }\n return `<span style=\"${style}\">${match}</span>`;\n },\n );\n } catch {\n return String(value);\n }\n }\n}\n"],"names":[],"mappings":";;;MA8Ca,YAAY,CAA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A,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;oBACnC,KAAK,GAAG,eAAe;;AAClB,qBAAA,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;oBAC7B,KAAK,GAAG,eAAe;;AAEzB,gBAAA,OAAO,CAAA,aAAA,EAAgB,KAAK,CAAA,EAAA,EAAK,KAAK,SAAS;AACjD,aAAC,CACF;;QACD,OAAA,EAAA,EAAM;AACN,YAAA,OAAO,MAAM,CAAC,KAAK,CAAC;;;AAGzB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-layout-D88nn5zf.js","sources":["src/types/client-layout.ts"],"sourcesContent":["// ─── Layout type ──────────────────────────────────────────────────────────────\n\nexport enum ClientLayoutType {\n OBJECT_FORM_DASHBOARD = 'OBJECT_FORM_DASHBOARD',\n CLASS_DASHBOARD = 'CLASS_DASHBOARD',\n GENERAL_DASHBOARD = 'GENERAL_DASHBOARD',\n NAVIGATION_PANE = 'NAVIGATION_PANE',\n}\n\n// ─── Item types ───────────────────────────────────────────────────────────────\n\nexport enum ClientLayoutItemType {\n // Form / data input\n FIELD = 'FIELD',\n RELATION = 'RELATION',\n // Layout structure\n SECTION = 'SECTION',\n GROUP = 'GROUP',\n // Read-only / display\n HEADER = 'HEADER',\n TEXT = 'TEXT',\n // Navigation / actions\n NAVIGATE = 'NAVIGATE',\n ACTION = 'ACTION',\n SEARCH = 'SEARCH',\n // Dashboard views\n VIEW = 'VIEW',\n RELATED_VIEW = 'RELATED_VIEW',\n RELATED_OBJECT = 'RELATED_OBJECT',\n}\n\n// ─── Field data types ─────────────────────────────────────────────────────────\n\nexport enum ClientLayoutItemFieldDataType {\n TEXT = 'TEXT',\n TEXTBLOCK = 'TEXTBLOCK',\n INTEGER = 'INTEGER',\n DECIMAL = 'DECIMAL',\n PERCENTAGE = 'PERCENTAGE',\n CURRENCY = 'CURRENCY',\n BOOLEAN = 'BOOLEAN',\n DATE = 'DATE',\n DATETIME = 'DATETIME',\n TIME = 'TIME',\n EMAIL = 'EMAIL',\n HYPERLINK = 'HYPERLINK',\n LIST = 'LIST',\n FILE = 'FILE',\n IMAGE = 'IMAGE',\n LONGTEXT = 'LONGTEXT',\n JSON = 'JSON',\n SECRET = 'SECRET',\n}\n\n// ─── Relation display / edit behaviour ───────────────────────────────────────\n\nexport enum ClientLayoutItemRelationDisplayType {\n SEARCH = 'SEARCH',\n DROPDOWN = 'DROPDOWN',\n CHECKBOX = 'CHECKBOX',\n}\n\nexport enum ClientLayoutItemRelationEditBehavior {\n SEARCH = 'SEARCH',\n DROPDOWN = 'DROPDOWN',\n CHECKBOX = 'CHECKBOX',\n}\n\n// ─── Data object link types (API _links shape) ───────────────────────────────\n\n/** A single sub-link within a multi-value relation link. */\nexport interface DataObjectSubLink {\n href: string;\n name: string;\n}\n\n/** Link object as returned by the API on a data object's `_links` map. */\nexport interface DataObjectLink {\n href: string;\n name?: string;\n values?: DataObjectSubLink[];\n}\n\n// ─── Shared value types ───────────────────────────────────────────────────────\n\n/** A selectable list item as returned by the API. */\nexport interface ClientListValue {\n /** Raw key stored in the database (API uses `key`, older code used `value`). */\n key: string;\n label: string;\n color?: string | null;\n backgroundColor?: string | null;\n}\n\nexport interface CurrencyValue {\n amount: number | null;\n currency: string;\n decimals?: number;\n}\n\nexport interface HyperlinkValue {\n href: string;\n name?: string;\n}\n\nexport interface RelationSearchResult {\n id: string;\n label: string;\n description?: string;\n}\n\n// ─── Item definitions ─────────────────────────────────────────────────────────\n\nexport interface ClientLayoutItemField {\n name: string;\n label: string;\n dataType: ClientLayoutItemFieldDataType;\n required: boolean;\n disabled?: boolean;\n multiple?: boolean;\n header?: boolean;\n defaultValue?: string | null;\n listItems?: ClientListValue[] | null;\n // UI hints — optional, not sent by API\n placeholder?: string;\n accept?: string;\n maxSize?: number;\n decimalPrecision?: number;\n currencyCode?: string;\n /** Aggregate function to render in the table totals row. */\n aggregate?: 'sum' | 'avg' | 'count' | null;\n historyEnabled?: boolean;\n}\n\n/** Response shape from the /aggregations endpoint.\n * `count` is a plain number (total record count) when returned at the top level. */\nexport interface AggregationResult {\n total?: number;\n count?: number | Record<string, number>;\n sum?: Record<string, number>;\n avg?: Record<string, number>;\n}\n\nexport interface ClientLayoutItemRelation {\n name: string;\n label: string;\n relatedClass: string;\n mostSignificantClass?: string;\n displayType?: ClientLayoutItemRelationDisplayType;\n editBehavior?: ClientLayoutItemRelationEditBehavior | null;\n commonRelation?: string;\n required: boolean;\n disabled?: boolean;\n multiple?: boolean;\n defaultValue?: string | null;\n dropdownValues?: ClientListValue[];\n}\n\nexport interface ClientLayoutItemNavigate {\n dataClass: string;\n icon?: string | null;\n navigationType?: string | null;\n}\n\nexport interface ClientLayoutItemRelatedView {\n name: string;\n fromClass?: string | null;\n relatedClass: string;\n filterClass?: string | null;\n showTitle: boolean;\n}\n\nexport interface ClientLayoutItemRelatedObject {\n name: string;\n relatedClass: string;\n}\n\nexport interface ClientLayoutItemSearch {\n dataClass: string;\n showTitle: boolean;\n}\n\n// ─── Generic item ─────────────────────────────────────────────────────────────\n\nexport interface ClientCreateType {\n type: string;\n label: string;\n}\n\n/**\n * A single item in a ClientLayout. The `type` discriminator determines which\n * optional fields are present. Components should only act on types they\n * understand and ignore others.\n */\nexport interface ClientLayoutItem {\n type: ClientLayoutItemType;\n label?: string;\n\n // FIELD\n field?: ClientLayoutItemField;\n\n // RELATION\n relation?: ClientLayoutItemRelation;\n\n // SECTION / GROUP — nested items\n items?: ClientLayoutItem[];\n\n // NAVIGATE\n navigate?: ClientLayoutItemNavigate;\n\n // VIEW — embedded view config (new flat format)\n view?: ClientViewMetadata;\n\n // RELATED_VIEW\n relatedView?: ClientLayoutItemRelatedView;\n\n // RELATED_OBJECT\n relatedObject?: ClientLayoutItemRelatedObject;\n\n // SEARCH\n search?: ClientLayoutItemSearch;\n\n // ─── Flat API fields ──────────────────────────────────────────────────────\n // Shared / ACTION / VIEW\n name?: string;\n showTitle?: boolean;\n /** Embedded alternative view configs (new flat format). */\n alternativeViews?: Array<{ label?: string; dataClass?: string; fromClass?: string | null; filterClass?: string | null; view?: ClientViewMetadata }>;\n /** Toolbar buttons for embedded views. null/omitted = [\"NEW\",\"EXPORT\"]; [] = none. */\n actions?: string[] | null;\n /** Concrete subtypes available for create. When set, the NEW button expands into one button per entry. */\n createTypes?: ClientCreateType[] | null;\n\n // FIELD (flat)\n dataType?: ClientLayoutItemFieldDataType;\n required?: boolean;\n disabled?: boolean;\n multiple?: boolean;\n header?: boolean;\n defaultValue?: string | null;\n listItems?: ClientListValue[] | null;\n aggregate?: 'sum' | 'avg' | 'count' | null;\n placeholder?: string;\n accept?: string;\n maxSize?: number;\n decimalPrecision?: number;\n currencyCode?: string;\n historyEnabled?: boolean;\n\n // RELATION (flat)\n relatedClass?: string;\n mostSignificantClass?: string;\n displayType?: ClientLayoutItemRelationDisplayType;\n editBehavior?: ClientLayoutItemRelationEditBehavior | null;\n commonRelation?: string;\n dropdownValues?: ClientListValue[];\n\n // VIEW / NAVIGATE / SEARCH (flat) — API sends 'dataClass' (renamed from reserved 'class')\n dataClass?: string;\n\n // RELATED_VIEW (flat)\n fromClass?: string | null;\n filterClass?: string | null;\n\n // NAVIGATE (flat)\n icon?: string | null;\n navigationType?: string | null;\n\n // ACTION (flat)\n actionType?: string;\n}\n\n// ─── Layout ───────────────────────────────────────────────────────────────────\n\nexport interface ClientLayout {\n type?: ClientLayoutType;\n label?: string;\n /** Used as the form title (mrd-form). */\n title?: string;\n tabPage?: boolean;\n items: ClientLayoutItem[];\n}\n\n// ─── ViewMetadata (from DashboardMetadata.views) ─────────────────────────────\n\nexport interface ViewFilter {\n name: string;\n value?: string | null;\n operator?: 'EQUALS' | 'FROM' | 'TO' | 'STARTS_WITH' | 'NOT_EMPTY' | 'EMPTY' | null;\n}\n\nexport interface ClientViewMetadata {\n name: string | null;\n defaultView: boolean;\n defaultSort?: string | null;\n /** Column definitions — each item is a FIELD or RELATION item. */\n values: ClientLayoutItem[];\n /** Static query-param filters baked into the view definition. */\n filter?: ViewFilter[] | null;\n type?: string;\n referenceType?: string | null;\n filterType?: string | null;\n singularLabel?: string;\n pluralLabel?: string;\n}\n\n// ─── DashboardMetadata ────────────────────────────────────────────────────────\n\nexport interface ClientDashboardMetadata {\n layouts: ClientLayout[];\n /** Legacy: view metadata map keyed by generated name. Absent in new flat format. */\n views?: Record<string, ClientViewMetadata>;\n layoutType: ClientLayoutType;\n _links?: Record<string, { href: string }>;\n}\n"],"names":[],"mappings":"AAAA;AAEA,IAAY;AAAZ,CAAA,UAAY,gBAAgB,EAAA;AAC1B,IAAA,gBAAA,CAAA,uBAAA,CAAA,GAAA,uBAA+C;AAC/C,IAAA,gBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAyC;AACzC,IAAA,gBAAA,CAAA,mBAAA,CAAA,GAAA,mBAA2C;AAC3C,IAAA,gBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAyC;AAC3C,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,GAAA,EAAA,CAAA,CAAA;AAO5B;AAEA,IAAY;AAAZ,CAAA,UAAY,oBAAoB,EAAA;;AAE9B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAwB;AACxB,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,UAA2B;;AAE3B,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAA0B;AAC1B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAwB;;AAExB,IAAA,oBAAA,CAAA,QAAA,CAAA,GAAA,QAAyB;AACzB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAuB;;AAEvB,IAAA,oBAAA,CAAA,UAAA,CAAA,GAAA,UAA2B;AAC3B,IAAA,oBAAA,CAAA,QAAA,CAAA,GAAA,QAAyB;AACzB,IAAA,oBAAA,CAAA,QAAA,CAAA,GAAA,QAAyB;;AAEzB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAuB;AAC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A,UAAY,mCAAmC,EAAA;AAC7C,IAAA,mCAAA,CAAA,QAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,mCAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,mCAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAJW,mCAAmC,KAAnC,mCAAmC,GAAA,EAAA,CAAA,CAAA;AAM/C,IAAY;AAAZ,CAAA,UAAY,oCAAoC,EAAA;AAC9C,IAAA,oCAAA,CAAA,QAAA,CAAA,GAAA,QAAmB;AACnB,IAAA,oCAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrB,IAAA,oCAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAJW,oCAAoC,KAApC,oCAAoC,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format-BAfsQfy1.js","sources":["src/utils/format.ts"],"sourcesContent":["export function formatNumber(value: number, locale: string, options?: Intl.NumberFormatOptions): string {\n if (value === null || value === undefined || isNaN(value)) return '';\n return new Intl.NumberFormat(locale, options).format(value);\n}\n\nexport function formatCurrency(amount: number, currency: string, locale: string): string {\n if (amount === null || amount === undefined || isNaN(amount)) return '';\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n }).format(amount);\n}\n\nexport function formatPercentage(value: number, locale: string, decimalPrecision = 2): string {\n if (value === null || value === undefined || isNaN(value)) return '';\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalPrecision,\n maximumFractionDigits: decimalPrecision,\n }).format(value);\n}\n\nexport function formatDate(value: string | Date, locale: string): string {\n if (!value) return '';\n const date = typeof value === 'string' ? new Date(value) : value;\n if (isNaN(date.getTime())) return '';\n return new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit' }).format(date);\n}\n\nexport function formatDateTime(value: string | Date, locale: string): string {\n if (!value) return '';\n const date = typeof value === 'string' ? new Date(value) : value;\n if (isNaN(date.getTime())) return '';\n return new Intl.DateTimeFormat(locale, {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n }).format(date);\n}\n\nexport function formatTime(value: string, locale: string): string {\n if (!value) return '';\n // value is HH:MM or HH:MM:SS\n const [hours, minutes] = value.split(':').map(Number);\n const date = new Date();\n date.setHours(hours, minutes, 0, 0);\n return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date);\n}\n\nexport function parseLocalizedNumber(str: string, locale: string): number | null {\n if (!str || !str.trim()) return null;\n // Detect decimal and thousands separators from the locale\n const parts = new Intl.NumberFormat(locale).formatToParts(1234567.89);\n const groupSep = parts.find((p: Intl.NumberFormatPart) => p.type === 'group')?.value ?? ',';\n const decimalSep = parts.find((p: Intl.NumberFormatPart) => p.type === 'decimal')?.value ?? '.';\n\n // Remove group separators, replace decimal separator with '.'\n const normalized = str\n .replace(new RegExp(`\\\\${groupSep}`, 'g'), '')\n .replace(new RegExp(`\\\\${decimalSep}`), '.')\n .replace('%', '')\n .trim();\n\n const parsed = parseFloat(normalized);\n return isNaN(parsed) ? null : parsed;\n}\n"],"names":[],"mappings":"SAAgB,YAAY,CAAC,KAAa,EAAE,MAAc,EAAE,OAAkC,EAAA;IAC5F,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;AACpE,IAAA,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AAC7D;SAEgB,cAAc,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAc,EAAA;IAC7E,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC;AAAE,QAAA,OAAO,EAAE;AAC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