@mmlogic/components 0.3.9 → 0.3.11
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/loader.cjs.js +1 -1
- package/dist/cjs/mosterdcomponents.cjs.js +1 -1
- package/dist/cjs/{mrd-boolean-field_22.cjs.entry.js → mrd-boolean-field_23.cjs.entry.js} +684 -41
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/mrd-document-container/mrd-document-container.js +421 -0
- package/dist/collection/components/mrd-document-container/mrd-document-container.scss +79 -0
- package/dist/collection/components/mrd-document-list/mrd-document-list.js +653 -16
- package/dist/collection/components/mrd-document-list/mrd-document-list.scss +66 -0
- package/dist/collection/components/mrd-document-view/mrd-document-view.js +1 -1
- 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 +165 -14
- package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +0 -44
- 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 +47 -0
- package/dist/collection/utils/i18n.js +12 -0
- package/dist/components/i18n.js +1 -1
- package/dist/components/mrd-document-container.d.ts +11 -0
- package/dist/components/mrd-document-container.js +1 -0
- package/dist/components/mrd-document-container2.js +1 -0
- package/dist/components/mrd-document-list2.js +1 -1
- package/dist/components/mrd-document-view2.js +1 -1
- 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-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/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/{mrd-boolean-field_22.entry.js → mrd-boolean-field_23.entry.js} +684 -42
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-a9618055.entry.js +1 -0
- package/dist/types/components/mrd-document-container/mrd-document-container.d.ts +99 -0
- package/dist/types/components/mrd-document-list/mrd-document-list.d.ts +126 -1
- package/dist/types/components/mrd-layout-section/mrd-layout-section.d.ts +32 -5
- package/dist/types/components.d.ts +250 -0
- package/dist/types/types/client-layout.d.ts +5 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-b547291b.entry.js +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { ClientArchetype, ClientLayoutItem } from '../../types/client-layout';
|
|
3
|
+
/**
|
|
4
|
+
* Owns a document collection view: a single toolbar (view switch + collection
|
|
5
|
+
* actions like "New folder", and — later — upload / drag-drop) plus the two
|
|
6
|
+
* interchangeable bodies, the folder tree (`mrd-document-list`) and the flat
|
|
7
|
+
* table (`mrd-table`).
|
|
8
|
+
*
|
|
9
|
+
* `mrd-layout-section` renders one of these per document VIEW / RELATED_VIEW and
|
|
10
|
+
* forwards the re-emitted load/navigate/action events to the host. The embedded
|
|
11
|
+
* table/list keep their `data-view` / `data-doclist` attributes so the host's
|
|
12
|
+
* existing `setViewPage` / `setViewDistinct` / `setViewAggregations` lookups
|
|
13
|
+
* (recursive querySelector) still resolve them unchanged.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MrdDocumentContainer {
|
|
16
|
+
el: HTMLElement;
|
|
17
|
+
/** The VIEW or RELATED_VIEW layout item (dataClass, fromClass, view config). */
|
|
18
|
+
item: ClientLayoutItem | null;
|
|
19
|
+
/** Resolved `commons.document` archetype binding for the folder tree. */
|
|
20
|
+
archetype: ClientArchetype;
|
|
21
|
+
/** Parent record id — required for RELATED_VIEW path building. */
|
|
22
|
+
parentId: string;
|
|
23
|
+
/** Canonical parent href, forwarded to the folder tree for single-container seeding. */
|
|
24
|
+
containerHref: string;
|
|
25
|
+
/** Lookup key used for the embedded `data-doclist` / `data-view` attributes. */
|
|
26
|
+
viewKey: string;
|
|
27
|
+
/** Fixed height (px) of the scrolling folder-tree body — the toolbar stays put
|
|
28
|
+
* on top, Finder-style. The table manages its own height. */
|
|
29
|
+
height: number;
|
|
30
|
+
locale: string;
|
|
31
|
+
/** Re-emitted from the embedded list/table. `nodeId` present for a folder load. */
|
|
32
|
+
mrdLoadPage: EventEmitter<{
|
|
33
|
+
page: number;
|
|
34
|
+
sort: string;
|
|
35
|
+
path: string;
|
|
36
|
+
qs: string;
|
|
37
|
+
nodeId?: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Re-emitted from the embedded folder tree. */
|
|
40
|
+
mrdLoadDistinct: EventEmitter<{
|
|
41
|
+
nodeId: string;
|
|
42
|
+
distinct: string;
|
|
43
|
+
path: string;
|
|
44
|
+
qs: string;
|
|
45
|
+
}>;
|
|
46
|
+
/** Re-emitted from the embedded table. */
|
|
47
|
+
mrdLoadAggregations: EventEmitter<{
|
|
48
|
+
path: string;
|
|
49
|
+
qs: string;
|
|
50
|
+
aggQs: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** A row / document was activated. Host routes to the object page. */
|
|
53
|
+
mrdNavigate: EventEmitter<{
|
|
54
|
+
href?: string;
|
|
55
|
+
label: string;
|
|
56
|
+
}>;
|
|
57
|
+
/** A table toolbar action was triggered. */
|
|
58
|
+
mrdAction: EventEmitter<{
|
|
59
|
+
action: string;
|
|
60
|
+
path?: string;
|
|
61
|
+
qs?: string;
|
|
62
|
+
parentPath?: string | null;
|
|
63
|
+
basicType?: string;
|
|
64
|
+
}>;
|
|
65
|
+
/** Generic "update an existing object" request, re-emitted from the folder tree
|
|
66
|
+
* (a document was dragged into another folder/container). */
|
|
67
|
+
mrdUpdateObject: EventEmitter<{
|
|
68
|
+
href: string;
|
|
69
|
+
values: Record<string, unknown>;
|
|
70
|
+
}>;
|
|
71
|
+
/** An external file was dropped on a folder; host uploads and calls back. */
|
|
72
|
+
mrdUpload: EventEmitter<{
|
|
73
|
+
file: File;
|
|
74
|
+
}>;
|
|
75
|
+
/** Create a new document from an uploaded file; host POSTs `values` to `path`. */
|
|
76
|
+
mrdCreateObject: EventEmitter<{
|
|
77
|
+
path: string;
|
|
78
|
+
values: Record<string, unknown>;
|
|
79
|
+
}>;
|
|
80
|
+
/** Active body: folder tree or flat table. */
|
|
81
|
+
private mode;
|
|
82
|
+
/** Whether the folder tree currently has a valid target for "New folder". */
|
|
83
|
+
private canCreate;
|
|
84
|
+
private listEl?;
|
|
85
|
+
private tableEl?;
|
|
86
|
+
/** Whether the currently mounted table has been init()'d. Reset on every mode switch. */
|
|
87
|
+
private tableInited;
|
|
88
|
+
/** The embedded table does not self-load: like every mrd-table it waits for the
|
|
89
|
+
* host to call init() (which emits mrdLoadPage, and — once page 0 lands —
|
|
90
|
+
* mrdLoadAggregations). The section only init()s tables mounted at load time, so
|
|
91
|
+
* when the user switches to list view we init the freshly mounted table here. */
|
|
92
|
+
componentDidRender(): void;
|
|
93
|
+
private setMode;
|
|
94
|
+
private createFolder;
|
|
95
|
+
private renderToolbar;
|
|
96
|
+
private renderTree;
|
|
97
|
+
private renderList;
|
|
98
|
+
render(): any;
|
|
99
|
+
}
|
|
@@ -36,6 +36,11 @@ export declare class MrdDocumentList {
|
|
|
36
36
|
archetype: ClientArchetype;
|
|
37
37
|
/** Parent record id — required for RELATED_VIEW path building. */
|
|
38
38
|
parentId: string;
|
|
39
|
+
/** Canonical parent href (`/{base}/{tenant}/{fromClass}/{parentId}`) supplied by
|
|
40
|
+
* the host. When the RELATED_VIEW's `inverseRelation` equals the archetype
|
|
41
|
+
* `container` slot, this seeds a single container so an empty dossier still
|
|
42
|
+
* accepts file drops and folder creation. */
|
|
43
|
+
containerHref: string;
|
|
39
44
|
locale: string;
|
|
40
45
|
/** Request distinct values for a field/relation. Host fetches `{path}?{qs}` and calls `setDistinct(nodeId, values)`. */
|
|
41
46
|
mrdLoadDistinct: EventEmitter<{
|
|
@@ -58,20 +63,92 @@ export declare class MrdDocumentList {
|
|
|
58
63
|
href?: string;
|
|
59
64
|
label: string;
|
|
60
65
|
}>;
|
|
66
|
+
/** Emitted whenever the "can create a folder here" state changes, so a host
|
|
67
|
+
* toolbar (mrd-document-container) can enable/disable its New folder button. */
|
|
68
|
+
mrdCanCreate: EventEmitter<boolean>;
|
|
69
|
+
/** Generic "update an existing object" request — fired when a document is
|
|
70
|
+
* dragged into another folder/container. Host PATCHes `href` with `values`
|
|
71
|
+
* (no move/folder knowledge needed). `values` carries the new folder string
|
|
72
|
+
* (or null for the container root) and, on a cross-container move, the new
|
|
73
|
+
* container relation href. */
|
|
74
|
+
mrdUpdateObject: EventEmitter<{
|
|
75
|
+
href: string;
|
|
76
|
+
values: Record<string, unknown>;
|
|
77
|
+
}>;
|
|
78
|
+
/** An external file was dropped onto a folder/container. Same flow as mrd-form:
|
|
79
|
+
* host uploads the file and calls `setFileReference(uri)` with the result. */
|
|
80
|
+
mrdUpload: EventEmitter<{
|
|
81
|
+
file: File;
|
|
82
|
+
}>;
|
|
83
|
+
/** Fired once the dropped file is uploaded — requests creation of a new document.
|
|
84
|
+
* Host POSTs `values` to `path` (on a 400 it can open the create form itself). */
|
|
85
|
+
mrdCreateObject: EventEmitter<{
|
|
86
|
+
path: string;
|
|
87
|
+
values: Record<string, unknown>;
|
|
88
|
+
}>;
|
|
61
89
|
/** Root sentinel id for the container-level distinct request. */
|
|
62
90
|
private static readonly ROOT;
|
|
63
91
|
private containers;
|
|
64
92
|
private rootLoading;
|
|
65
93
|
/** True when the single-container level is collapsed away (dossier context). */
|
|
66
94
|
private singleContainer;
|
|
95
|
+
/** Currently selected node id — the target for "New folder" and (later) drops. */
|
|
96
|
+
private selectedId;
|
|
97
|
+
/** Node id currently highlighted as a drag-drop target (null = none). */
|
|
98
|
+
private dropTargetId;
|
|
99
|
+
/** Node id showing an "uploading…" indicator while a dropped file is processed. */
|
|
100
|
+
private uploadingNodeId;
|
|
101
|
+
/** Whether a drag is hovering the root drop-zone (single-container area highlight). */
|
|
102
|
+
private rootDropActive;
|
|
67
103
|
private nodeIndex;
|
|
104
|
+
/** The pending node whose inline name input is open (null = not creating). */
|
|
105
|
+
private pendingNode;
|
|
106
|
+
/** The node the pending folder is being created under. */
|
|
107
|
+
private pendingParent;
|
|
108
|
+
/** The container the pending folder belongs to. */
|
|
109
|
+
private pendingContainer;
|
|
110
|
+
/** Current text in the inline name input. */
|
|
111
|
+
private pendingName;
|
|
112
|
+
/** Ref to the inline input, so we can focus it after it mounts. */
|
|
113
|
+
private pendingInputEl;
|
|
114
|
+
/** Set when a fresh input needs focus on the next render. */
|
|
115
|
+
private pendingNeedsFocus;
|
|
116
|
+
/** Monotonic counter for unique temporary pending-node ids. */
|
|
117
|
+
private newFolderSeq;
|
|
118
|
+
/** Last emitted canCreateFolder value, to only emit mrdCanCreate on change. */
|
|
119
|
+
private lastCanCreate;
|
|
120
|
+
/** The document row currently being dragged. */
|
|
121
|
+
private dragDoc;
|
|
122
|
+
/** Id of the node the dragged document currently lives in. */
|
|
123
|
+
private dragFromId;
|
|
124
|
+
/** External file dropped onto a node, awaiting its upload to complete. */
|
|
125
|
+
private pendingUpload;
|
|
126
|
+
/** The optimistic document row awaiting its self href from the create POST. */
|
|
127
|
+
private lastOptimisticDoc;
|
|
68
128
|
componentDidLoad(): void;
|
|
129
|
+
/** True when the view is a single-container context: a RELATED_VIEW whose
|
|
130
|
+
* `inverseRelation` matches the archetype `container` slot, with a known
|
|
131
|
+
* parent href. The container is then implied by context (not by distinct),
|
|
132
|
+
* so it works even with zero documents. */
|
|
133
|
+
private isSeededSingleContainer;
|
|
134
|
+
/** Seed the single implied container from context and load its folders. */
|
|
135
|
+
private seedSingleContainer;
|
|
136
|
+
componentDidRender(): void;
|
|
69
137
|
private get containerField();
|
|
70
138
|
private get folderField();
|
|
71
139
|
private get titleField();
|
|
140
|
+
private get fileField();
|
|
72
141
|
private get dateField();
|
|
73
|
-
/** VIEW: `/{dataClass}`; RELATED_VIEW: `/{fromClass}/{parentId}/{dataClass}`.
|
|
142
|
+
/** VIEW: `/{dataClass}`; RELATED_VIEW: `/{fromClass}/{parentId}/{dataClass}`.
|
|
143
|
+
* Used for reads (list/distinct): `dataClass`/`relatedClass` may be an abstract
|
|
144
|
+
* type (e.g. "contents"), filtered down to the concrete `filterClass` via the
|
|
145
|
+
* `type` query param — see baseParams(). */
|
|
74
146
|
private buildDataPath;
|
|
147
|
+
/** Path for creating a new document (file-drop). Unlike buildDataPath(), this
|
|
148
|
+
* must target the concrete type: `dataClass`/`relatedClass` can be an abstract
|
|
149
|
+
* base type (e.g. "contents") that cannot be POSTed to directly, so prefer
|
|
150
|
+
* `filterClass` (e.g. "documents") when present. */
|
|
151
|
+
private buildCreatePath;
|
|
75
152
|
/** View-level static filters + filterClass, shared by every request. */
|
|
76
153
|
private baseParams;
|
|
77
154
|
private emitContainerDistinct;
|
|
@@ -93,6 +170,52 @@ export declare class MrdDocumentList {
|
|
|
93
170
|
private bump;
|
|
94
171
|
private toggleContainer;
|
|
95
172
|
private toggleFolder;
|
|
173
|
+
/** Resolve the node a new folder should be created under, and its container.
|
|
174
|
+
* Uses the current selection; falls back to the single container (dossier). */
|
|
175
|
+
private resolveTarget;
|
|
176
|
+
private get canCreateFolder();
|
|
177
|
+
/** Start creating a folder under the current target. Called by the host toolbar
|
|
178
|
+
* (mrd-document-container). No-op when there is no valid target. */
|
|
179
|
+
createFolder(): Promise<void>;
|
|
180
|
+
/** Folder path segments of a node relative to its container (derived from its id). */
|
|
181
|
+
private segmentsOf;
|
|
182
|
+
private startCreateFolder;
|
|
183
|
+
private onPendingInput;
|
|
184
|
+
private onPendingKeyDown;
|
|
185
|
+
private commitFolder;
|
|
186
|
+
private cancelFolder;
|
|
187
|
+
private clearPending;
|
|
188
|
+
private onDocDragStart;
|
|
189
|
+
private onDocDragEnd;
|
|
190
|
+
/** True when the drag carries external files (an OS file drop, not an internal move). */
|
|
191
|
+
private isFileDrag;
|
|
192
|
+
/** A folder/container node (or a document inside it) accepts an internal move
|
|
193
|
+
* or an external file drop. Always claims the event so it never bubbles to the
|
|
194
|
+
* root drop-zone; a different node is highlighted (its own folder = no-op). */
|
|
195
|
+
private onNodeDragOver;
|
|
196
|
+
private onNodeDragLeave;
|
|
197
|
+
private onNodeDrop;
|
|
198
|
+
/** Root-zone drop (dossier context): target the single container's root. */
|
|
199
|
+
private onRootDragOver;
|
|
200
|
+
private onRootDragLeave;
|
|
201
|
+
private onRootDrop;
|
|
202
|
+
/** Begin an upload: emit mrdUpload; the host uploads and calls setFileReference. */
|
|
203
|
+
private startFileUpload;
|
|
204
|
+
/** Strip a single trailing extension for the document title. */
|
|
205
|
+
private stripExtension;
|
|
206
|
+
/** Host callback with the uploaded file reference. Builds the create payload
|
|
207
|
+
* from the archetype slots and requests the new document. */
|
|
208
|
+
setFileReference(uri: string): Promise<void>;
|
|
209
|
+
/** Host callback with the created document's self href, so the optimistic row
|
|
210
|
+
* becomes navigable without waiting for a reload. */
|
|
211
|
+
setCreatedHref(href: string): Promise<void>;
|
|
212
|
+
/** Folder string a node represents: the raw distinct value when it holds
|
|
213
|
+
* documents, else derived from its path segments; null for a container root. */
|
|
214
|
+
private folderStringOf;
|
|
215
|
+
private moveDocument;
|
|
216
|
+
/** Recompute a container's subtree totals from docCounts when its folders are
|
|
217
|
+
* loaded; otherwise just nudge the aggregate badge by the delta. */
|
|
218
|
+
private recomputeContainerTotals;
|
|
96
219
|
private openDoc;
|
|
97
220
|
private renderChevron;
|
|
98
221
|
private renderDossierIcon;
|
|
@@ -102,6 +225,8 @@ export declare class MrdDocumentList {
|
|
|
102
225
|
private renderDocRow;
|
|
103
226
|
private renderLoadingRow;
|
|
104
227
|
private renderChildren;
|
|
228
|
+
private renderUploadingRow;
|
|
229
|
+
private renderFolderEditRow;
|
|
105
230
|
private renderFolderNode;
|
|
106
231
|
private renderContainerNode;
|
|
107
232
|
render(): any;
|
|
@@ -22,8 +22,6 @@ export declare class MrdLayoutSection {
|
|
|
22
22
|
private imagePreviewUrl;
|
|
23
23
|
private imagePreviews;
|
|
24
24
|
private openHistoryField;
|
|
25
|
-
/** Per-view display mode for document collection views. Default 'tree'. */
|
|
26
|
-
private docViewMode;
|
|
27
25
|
private historyClickOutside;
|
|
28
26
|
mrdNavigate: EventEmitter<{
|
|
29
27
|
href?: string;
|
|
@@ -79,6 +77,25 @@ export declare class MrdLayoutSection {
|
|
|
79
77
|
path: string;
|
|
80
78
|
qs: string;
|
|
81
79
|
}>;
|
|
80
|
+
/** Generic "update an existing object" request from an embedded document view
|
|
81
|
+
* (a document dragged into another folder). Host PATCHes `href` with `values`. */
|
|
82
|
+
mrdUpdateObject: EventEmitter<{
|
|
83
|
+
href: string;
|
|
84
|
+
values: Record<string, unknown>;
|
|
85
|
+
}>;
|
|
86
|
+
/** An external file was dropped on a document view; host uploads and calls
|
|
87
|
+
* setViewFileReference(name, uri). */
|
|
88
|
+
mrdViewUpload: EventEmitter<{
|
|
89
|
+
name: string;
|
|
90
|
+
file: File;
|
|
91
|
+
}>;
|
|
92
|
+
/** Create a new document from an uploaded file; host POSTs `values` to `path`,
|
|
93
|
+
* then calls setViewCreatedObject(name, href) with the new object's href. */
|
|
94
|
+
mrdCreateObject: EventEmitter<{
|
|
95
|
+
name: string;
|
|
96
|
+
path: string;
|
|
97
|
+
values: Record<string, unknown>;
|
|
98
|
+
}>;
|
|
82
99
|
private searchTimers;
|
|
83
100
|
componentDidLoad(): void;
|
|
84
101
|
disconnectedCallback(): void;
|
|
@@ -100,6 +117,12 @@ export declare class MrdLayoutSection {
|
|
|
100
117
|
setViewAggregations(name: string, data: any): Promise<void>;
|
|
101
118
|
/** Inject distinct values into an embedded mrd-document-list for a document view. */
|
|
102
119
|
setViewDistinct(name: string, nodeId: string, values: DistinctValue[]): Promise<void>;
|
|
120
|
+
/** Inject the uploaded file reference for a dropped file, so the document view
|
|
121
|
+
* can request creation of the new document (see mrdViewUpload). */
|
|
122
|
+
setViewFileReference(name: string, uri: string): Promise<void>;
|
|
123
|
+
/** Inject the created document's href after a file-drop create, so the
|
|
124
|
+
* optimistic row becomes navigable (see mrdCreateObject). */
|
|
125
|
+
setViewCreatedObject(name: string, href: string): Promise<void>;
|
|
103
126
|
/** Provide a resolved URL for an IMAGE field. Shows as thumbnail; clicking opens the lightbox. */
|
|
104
127
|
setImagePreview(fieldName: string, url: string): Promise<void>;
|
|
105
128
|
/** Open the lightbox directly with a URL (e.g. after mrdDownload on a FILE field). */
|
|
@@ -114,9 +137,13 @@ export declare class MrdLayoutSection {
|
|
|
114
137
|
private renderRelation;
|
|
115
138
|
private renderSearch;
|
|
116
139
|
private renderRelatedView;
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
private
|
|
140
|
+
/** Build the canonical parent href `/{base}/{tenant}/{fromClass}/{parentId}` from
|
|
141
|
+
* the object's self href. Empty unless it is a RELATED_VIEW with a fromClass. */
|
|
142
|
+
private buildContainerHref;
|
|
143
|
+
/** Document collection view: owns the view-switch + collection actions and
|
|
144
|
+
* swaps between the folder tree and the flat table. Events are re-emitted to
|
|
145
|
+
* the host with the view key, exactly as the raw list/table events were. */
|
|
146
|
+
private renderDocumentContainer;
|
|
120
147
|
private renderTable;
|
|
121
148
|
private renderItem;
|
|
122
149
|
private renderImageModal;
|