@mmlogic/components 0.5.16 → 0.5.18
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_28.cjs.entry.js +244 -21
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/documents/mrd-document-container/mrd-document-container.js +31 -4
- package/dist/collection/components/layout/mrd-layout-section/mrd-layout-section.js +196 -11
- package/dist/collection/components/memo/mrd-memo-container/mrd-memo-container.js +28 -4
- package/dist/collection/components/table/mrd-table/mrd-table.js +193 -4
- package/dist/collection/dev/api.js +19 -0
- package/dist/collection/dev/app.js +75 -0
- package/dist/components/mrd-document-container2.js +1 -1
- package/dist/components/mrd-layout-section.js +1 -1
- package/dist/components/mrd-memo-container2.js +1 -1
- package/dist/components/mrd-table2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mosterdcomponents.js +1 -1
- package/dist/esm/mrd-boolean-field_28.entry.js +244 -21
- package/dist/mosterdcomponents/mosterdcomponents.esm.js +1 -1
- package/dist/mosterdcomponents/p-29d6dcbc.entry.js +3 -0
- package/dist/types/components/documents/mrd-document-container/mrd-document-container.d.ts +7 -0
- package/dist/types/components/layout/mrd-layout-section/mrd-layout-section.d.ts +69 -0
- package/dist/types/components/memo/mrd-memo-container/mrd-memo-container.d.ts +4 -0
- package/dist/types/components/table/mrd-table/mrd-table.d.ts +75 -0
- package/dist/types/components.d.ts +79 -0
- package/package.json +1 -1
- package/dist/mosterdcomponents/p-8a7fa81d.entry.js +0 -3
|
@@ -33,6 +33,13 @@ export declare class MrdDocumentContainer {
|
|
|
33
33
|
* (with a tooltip explaining why) and the embedded table/list get it passed
|
|
34
34
|
* through so their own create/upload/drag-drop paths are disabled too. */
|
|
35
35
|
readOnly: boolean;
|
|
36
|
+
/** Whether the current user may create a document here — set by mrd-layout-section from
|
|
37
|
+
* its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded
|
|
38
|
+
* table gets in list mode. Named `mayCreate` (not `canCreate`) to avoid colliding with
|
|
39
|
+
* the existing `canCreate` state below, which tracks something unrelated: whether the
|
|
40
|
+
* folder tree currently has a valid drop target selected. Defaults to false (hidden)
|
|
41
|
+
* until confirmed, same as mrd-table. */
|
|
42
|
+
mayCreate: boolean;
|
|
36
43
|
/** Re-emitted from the embedded list/table. `nodeId` present for a folder load. */
|
|
37
44
|
mrdLoadPage: EventEmitter<{
|
|
38
45
|
page: number;
|
|
@@ -22,6 +22,12 @@ export declare class MrdLayoutSection {
|
|
|
22
22
|
* create ("+") action and the documents view's New folder / Upload are disabled
|
|
23
23
|
* with a tooltip explaining why, so it's clear at a glance the user can't mutate data. */
|
|
24
24
|
readOnly: boolean;
|
|
25
|
+
/** When false, skips the mrdViewCheckCapabilities round trip for every VIEW/RELATED_VIEW
|
|
26
|
+
* binding and hands mrd-table/mrd-memo-container/mrd-document-container their create
|
|
27
|
+
* affordance as allowed immediately — for a tenant with no access control configured,
|
|
28
|
+
* the answer would always be mayCreate: true anyway (FINDING-0171 / TASK-0322). Default
|
|
29
|
+
* `true` keeps today's ask-and-hide behaviour unchanged. */
|
|
30
|
+
accessControlEnabled: boolean;
|
|
25
31
|
/** The active account's linked person record (userProfile.links.person), if any.
|
|
26
32
|
* Threaded to mrd-memo-container so a top-level memo VIEW (no parent record to
|
|
27
33
|
* attach a new memo to) can still offer "New memo" by falling back to the
|
|
@@ -32,7 +38,22 @@ export declare class MrdLayoutSection {
|
|
|
32
38
|
private imagePreviewUrl;
|
|
33
39
|
private imagePreviews;
|
|
34
40
|
private openHistoryField;
|
|
41
|
+
/** Answers to mrdViewCheckCapabilities, keyed by view key — see emitCapabilitiesChecks().
|
|
42
|
+
* Passed straight down as a `canCreate`/`mayCreate` prop to whichever body (mrd-table,
|
|
43
|
+
* mrd-memo-container, mrd-document-container) is mounted for that key; a missing entry
|
|
44
|
+
* means "not answered yet" and is treated as false (hidden), same default as mrd-table's
|
|
45
|
+
* own standalone behaviour (TASK-0299). */
|
|
46
|
+
private canCreateMap;
|
|
47
|
+
/** Companion to canCreateMap — concrete types the mrdViewCheckCapabilities answer allows,
|
|
48
|
+
* when the API reports them; passed to mrd-table's `allowedTypes` prop to narrow its
|
|
49
|
+
* create-type picker down to types a create POST would actually accept (FINDING-0176 /
|
|
50
|
+
* TASK-0314). A missing entry means "not answered yet / not reported" — mrd-table then
|
|
51
|
+
* leaves `item.createTypes` unfiltered, same as before this existed. */
|
|
52
|
+
private allowedTypesMap;
|
|
35
53
|
private historyClickOutside;
|
|
54
|
+
/** Signature last asked per view key (see emitCapabilitiesChecks()) — avoids re-emitting
|
|
55
|
+
* mrdViewCheckCapabilities on every data/items update when the binding hasn't changed. */
|
|
56
|
+
private capabilitiesAsked;
|
|
36
57
|
/** `attachments`, when present, prefetches the clicked document row's file slot
|
|
37
58
|
* (see TASK-0169 / FINDING-0111) so the host can render a preview immediately,
|
|
38
59
|
* without waiting for the navigated-to page's own mrdAttachments. Only set for
|
|
@@ -101,6 +122,19 @@ export declare class MrdLayoutSection {
|
|
|
101
122
|
path: string;
|
|
102
123
|
qs: string;
|
|
103
124
|
}>;
|
|
125
|
+
/** Emitted once per VIEW/RELATED_VIEW binding — computed here directly, not relayed from a
|
|
126
|
+
* child (see emitCapabilitiesChecks()), so it covers mrd-table, mrd-memo-container and
|
|
127
|
+
* mrd-document-container uniformly. `name` is the view key (viewKeyFor(item)) — pass it
|
|
128
|
+
* back to setViewCanCreate() to answer it. setViewCanCreate()'s optional third argument
|
|
129
|
+
* narrows a table's `item.createTypes` picker to the concrete types the answer allows,
|
|
130
|
+
* when the API's capabilities response reports them (FINDING-0176 / TASK-0314). */
|
|
131
|
+
mrdViewCheckCapabilities: EventEmitter<{
|
|
132
|
+
name: string;
|
|
133
|
+
type: string;
|
|
134
|
+
refType?: string;
|
|
135
|
+
refId?: string;
|
|
136
|
+
filterClass?: string;
|
|
137
|
+
}>;
|
|
104
138
|
/** Generic "update an existing object" request from an embedded document view
|
|
105
139
|
* (a document dragged into another folder). Host PATCHes `href` with `values`. */
|
|
106
140
|
mrdUpdateObject: EventEmitter<{
|
|
@@ -129,8 +163,29 @@ export declare class MrdLayoutSection {
|
|
|
129
163
|
componentDidLoad(): void;
|
|
130
164
|
disconnectedCallback(): void;
|
|
131
165
|
dataChanged(newVal: Record<string, unknown>): void;
|
|
166
|
+
/** A host can swap `items` (e.g. a different dashboard layout) without `data` changing —
|
|
167
|
+
* dataChanged() alone would miss that binding change. */
|
|
168
|
+
itemsChanged(): void;
|
|
132
169
|
private initEmbeddedTables;
|
|
133
170
|
private emitLoadImages;
|
|
171
|
+
/** Parent record id extracted from `data._links.self.href` — the same value every
|
|
172
|
+
* VIEW/RELATED_VIEW item on this record shares, used for RELATED_VIEW path construction
|
|
173
|
+
* (renderRelatedView) and capability checks (emitCapabilitiesChecks). */
|
|
174
|
+
private computeParentId;
|
|
175
|
+
/** Asks, once per VIEW/RELATED_VIEW binding, whether the current user may create a record
|
|
176
|
+
* there — the single generic place for this check (TASK-0299/FINDING-0155), so mrd-table,
|
|
177
|
+
* mrd-memo-container and mrd-document-container all get the answer the same way: as a plain
|
|
178
|
+
* `canCreate`/`mayCreate` prop from this component, computed here and handed down in
|
|
179
|
+
* renderTable()/renderMemoContainer()/renderDocumentContainer() — none of the three leaf
|
|
180
|
+
* components need to ask on their own when rendered through mrd-layout-section (mrd-table's
|
|
181
|
+
* own self-ask only kicks in for standalone use, i.e. its `canCreate` prop left undefined).
|
|
182
|
+
*
|
|
183
|
+
* The route/path variables mirror what each renderer already uses for its own rows —
|
|
184
|
+
* `type` = `dataClass`, `refType`/`refId` = `fromClass`/parentId for a RELATED_VIEW, and
|
|
185
|
+
* `filterClass` when the view is scoped to one subtype (the same value sent as `?type=` on
|
|
186
|
+
* the row fetch). A signature (not just the key) is tracked per binding so a genuine route
|
|
187
|
+
* change re-asks and hides again, without re-asking on every unrelated data/items update. */
|
|
188
|
+
private emitCapabilitiesChecks;
|
|
134
189
|
/** Inject search results. Pass dataClass to target a specific SEARCH item; omit when there is only one. */
|
|
135
190
|
setSearchResults(results: RelationSearchResult[], dataClass?: string): Promise<void>;
|
|
136
191
|
/**
|
|
@@ -142,6 +197,20 @@ export declare class MrdLayoutSection {
|
|
|
142
197
|
setViewPage(name: string, page: number, rows: any[], totalElements?: number, hasNext?: boolean, nodeId?: string): Promise<void>;
|
|
143
198
|
/** Inject aggregation totals into an embedded mrd-table for a VIEW or RELATED_VIEW item. */
|
|
144
199
|
setViewAggregations(name: string, data: any): Promise<void>;
|
|
200
|
+
/** Host answer to mrdViewCheckCapabilities — whether the current user may create a record
|
|
201
|
+
* for the given view's bound route. `name` is the view key from the event detail. Stored in
|
|
202
|
+
* canCreateMap and passed down as a plain prop to whichever body is mounted for that key
|
|
203
|
+
* (mrd-table, mrd-memo-container or mrd-document-container) — no DOM lookup needed, unlike
|
|
204
|
+
* setViewPage/setViewAggregations, since the prop flows through the next render. */
|
|
205
|
+
setViewCanCreate(name: string, value: boolean, allowedTypes?: string[]): Promise<void>;
|
|
206
|
+
/** `canCreateMap[key]` when access control is configured (default); always allowed
|
|
207
|
+
* when `accessControlEnabled` is false, since emitCapabilitiesChecks() never asked
|
|
208
|
+
* and canCreateMap[key] would otherwise stay permanently unanswered. */
|
|
209
|
+
private effectiveCanCreate;
|
|
210
|
+
/** `allowedTypesMap[key]` when access control is configured; `undefined` (don't filter)
|
|
211
|
+
* when disabled, since emitCapabilitiesChecks() never asked and the map entry would
|
|
212
|
+
* otherwise stay permanently unanswered — see effectiveCanCreate(). */
|
|
213
|
+
private effectiveAllowedTypes;
|
|
145
214
|
/** Inject distinct values into an embedded mrd-document-list for a document view. */
|
|
146
215
|
setViewDistinct(name: string, nodeId: string, values: DistinctValue[]): Promise<void>;
|
|
147
216
|
/** Inject the uploaded file reference for a dropped file, so the document view
|
|
@@ -52,6 +52,10 @@ export declare class MrdMemoContainer {
|
|
|
52
52
|
* tooltip, cards/rows are not clickable, and the embedded table's own
|
|
53
53
|
* create action is disabled too. */
|
|
54
54
|
readOnly: boolean;
|
|
55
|
+
/** Whether the current user may create a memo here — set by mrd-layout-section from its
|
|
56
|
+
* generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table
|
|
57
|
+
* gets in table mode. Defaults to false (hidden) until confirmed, same as mrd-table. */
|
|
58
|
+
canCreate: boolean;
|
|
55
59
|
/** The active account's linked person record (userProfile.links.person), if any.
|
|
56
60
|
* Used both to gate "New memo" (see effectiveContainerHref) and, on submit, to
|
|
57
61
|
* fill the author slot. */
|
|
@@ -63,6 +63,28 @@ export declare class MrdTable {
|
|
|
63
63
|
* explaining why) so a viewer-role user can see at a glance that this dashboard
|
|
64
64
|
* is read-only. Sorting, filtering and export stay available — those don't mutate data. */
|
|
65
65
|
readOnly: boolean;
|
|
66
|
+
/** Whether the current user may create a record for the table's bound route. Leave
|
|
67
|
+
* `undefined` for standalone use — the table then asks on its own via mrdCheckCapabilities
|
|
68
|
+
* and hides the create button until setCanCreate() answers. Set it explicitly when a host
|
|
69
|
+
* already knows the answer (e.g. mrd-layout-section, which asks once per binding and hands
|
|
70
|
+
* the answer to whichever body it mounts) — the table then trusts it directly and never
|
|
71
|
+
* asks on its own (TASK-0299). */
|
|
72
|
+
canCreate?: boolean;
|
|
73
|
+
/** Concrete types (`item.createTypes[].type`) the current user may actually create, when
|
|
74
|
+
* `item.createTypes` offers a picker for a family type — narrows it down to only the types
|
|
75
|
+
* a create POST would accept (FINDING-0176 / TASK-0314). Leave `undefined` for standalone
|
|
76
|
+
* use — the table takes it from the second argument of setCanCreate() alongside `canCreate`.
|
|
77
|
+
* Set it explicitly (e.g. from mrd-layout-section, alongside `canCreate`) when the host
|
|
78
|
+
* already has the answer. `undefined` (not yet answered, or an older host/API that doesn't
|
|
79
|
+
* report it) means "don't filter" — `item.createTypes` is shown unfiltered, same as before
|
|
80
|
+
* this existed. */
|
|
81
|
+
allowedTypes?: string[] | null;
|
|
82
|
+
/** When false, skips the standalone mrdCheckCapabilities round trip entirely and renders
|
|
83
|
+
* the create action immediately as allowed — for a tenant that has no access control
|
|
84
|
+
* configured, the answer would always be true anyway (FINDING-0171 / TASK-0322). Ignored
|
|
85
|
+
* while `canCreate` is set explicitly (the host already controls the answer directly in
|
|
86
|
+
* that mode). Default `true` keeps today's ask-and-hide behaviour unchanged. */
|
|
87
|
+
accessControlEnabled: boolean;
|
|
66
88
|
/** Clamp renderEnd when totalElements shrinks (e.g. after a filter is applied).
|
|
67
89
|
* 0 means "unknown" (hosts that rely on minKnownTotal never set it, and some reset it
|
|
68
90
|
* while a filter is being applied) — clamping to it would collapse the window to a
|
|
@@ -70,6 +92,11 @@ export declare class MrdTable {
|
|
|
70
92
|
totalElementsChanged(newVal: number): void;
|
|
71
93
|
/** Reset to primary view when the item prop is replaced from outside. */
|
|
72
94
|
itemChanged(newVal: ClientLayoutItem | null): void;
|
|
95
|
+
/** A parent-record navigation can reuse the same `item` reference while only `parentId`
|
|
96
|
+
* changes (e.g. clicking a different dossier for the same RELATED_VIEW layout) — itemChanged()
|
|
97
|
+
* would not fire for that. Re-ask so a stale canCreate answer from the previous parent never
|
|
98
|
+
* leaks into the new one. */
|
|
99
|
+
parentIdChanged(): void;
|
|
73
100
|
/** Index into allViews[] for the currently displayed view. 0 = primary, 1+ = alternatives. */
|
|
74
101
|
private activeViewIdx;
|
|
75
102
|
loadedPages: Map<number, Record<string, any>[]>;
|
|
@@ -116,6 +143,13 @@ export declare class MrdTable {
|
|
|
116
143
|
private aggregationsPending;
|
|
117
144
|
/** Lower bound on total derived from setPage() hasNext info; grows as pages load. */
|
|
118
145
|
private minKnownTotal;
|
|
146
|
+
/** Self-asked answer for standalone use (the `canCreate` prop is undefined) — defaults to
|
|
147
|
+
* hidden (TASK-0299) until the host answers mrdCheckCapabilities via setCanCreate(). Ignored
|
|
148
|
+
* when the host controls `canCreate` directly; see effectiveCanCreate(). */
|
|
149
|
+
private selfCanCreate;
|
|
150
|
+
/** Self-asked companion to selfCanCreate — the concrete types setCanCreate() reported allowed,
|
|
151
|
+
* or `undefined` while unanswered / when the host's mrdCheckCapabilities answer omitted it. */
|
|
152
|
+
private selfAllowedTypes;
|
|
119
153
|
/** Fired when a page needs to be fetched. Host fetches and calls setPage().
|
|
120
154
|
* `sort` is the raw query-param value, e.g. "name" or "name,desc". */
|
|
121
155
|
mrdLoadPage: EventEmitter<{
|
|
@@ -160,6 +194,24 @@ export declare class MrdTable {
|
|
|
160
194
|
qs: string;
|
|
161
195
|
aggQs: string;
|
|
162
196
|
}>;
|
|
197
|
+
/** Standalone use only (never fires while the `canCreate` prop is set — see there). Fired
|
|
198
|
+
* once per table binding (initial load, and whenever the bound item, parent record or active
|
|
199
|
+
* view changes) to ask the host whether the current user may create a record here. Carries
|
|
200
|
+
* the same route the table already uses for its own rows, unconstructed — VIEW:
|
|
201
|
+
* GET /data/{tenant}/{type}/capabilities; RELATED_VIEW: GET /data/{tenant}/{refType}/{refId}/{type}/capabilities.
|
|
202
|
+
* `filterClass`, when the view declares one, is the same subtype the row fetch sends as
|
|
203
|
+
* `?type=` — e.g. a "contents" RELATED_VIEW filtered to `document` asks specifically whether
|
|
204
|
+
* a document may be created here, not any content type.
|
|
205
|
+
* The add button stays hidden until the host calls setCanCreate() (FINDING-0155 / TASK-0299).
|
|
206
|
+
* setCanCreate()'s optional second argument narrows `item.createTypes`'s picker down to the
|
|
207
|
+
* concrete types the answer allows, when the API's capabilities response reports them
|
|
208
|
+
* (FINDING-0176 / TASK-0314). */
|
|
209
|
+
mrdCheckCapabilities: EventEmitter<{
|
|
210
|
+
type: string;
|
|
211
|
+
refType?: string;
|
|
212
|
+
refId?: string;
|
|
213
|
+
filterClass?: string;
|
|
214
|
+
}>;
|
|
163
215
|
componentWillLoad(): void;
|
|
164
216
|
componentDidLoad(): void;
|
|
165
217
|
private applyDefaultSort;
|
|
@@ -183,6 +235,12 @@ export declare class MrdTable {
|
|
|
183
235
|
setPage(pageNumber: number, rows: Record<string, any>[], hasNext?: boolean): Promise<void>;
|
|
184
236
|
/** Inject aggregation totals returned by the /aggregations endpoint. */
|
|
185
237
|
setAggregations(data: AggregationResult): Promise<void>;
|
|
238
|
+
/** Host answer to mrdCheckCapabilities — whether the current user may create a record for
|
|
239
|
+
* the table's currently bound route (standalone use only; ignored while the `canCreate`
|
|
240
|
+
* prop is set, since the host controls it directly in that mode). Call it any time after
|
|
241
|
+
* the event fires; a stale answer for an old binding is discarded automatically
|
|
242
|
+
* (selfCanCreate is reset to false before every new mrdCheckCapabilities emission). */
|
|
243
|
+
setCanCreate(value: boolean, allowedTypes?: string[]): Promise<void>;
|
|
186
244
|
disconnectedCallback(): void;
|
|
187
245
|
componentDidRender(): void;
|
|
188
246
|
/** Freeze the column widths once the first data page has rendered.
|
|
@@ -273,6 +331,12 @@ export declare class MrdTable {
|
|
|
273
331
|
* VIEW: /{dataClass}
|
|
274
332
|
* RELATED_VIEW: /{fromClass}/{parentId}/{dataClass} */
|
|
275
333
|
private buildDataPath;
|
|
334
|
+
/** Asks the host whether creating is allowed for the table's current binding (item, parent
|
|
335
|
+
* and active view) — only in standalone use (`canCreate` prop undefined). A host that
|
|
336
|
+
* controls `canCreate` directly already knows the answer, so the table never asks on its
|
|
337
|
+
* own in that mode. Resets selfCanCreate to false first so the add button stays hidden for
|
|
338
|
+
* the new binding until the host answers — it never inherits the previous binding's answer. */
|
|
339
|
+
private emitCapabilitiesCheck;
|
|
276
340
|
/** Build query params for a page request from current sort, view filters, filterClass and active column filters.
|
|
277
341
|
*
|
|
278
342
|
* `q` and column filters are mutually exclusive on the backend — combining them breaks
|
|
@@ -291,6 +355,17 @@ export declare class MrdTable {
|
|
|
291
355
|
* mode must not flip back to the rows prop (and its "no results") while page 0 is in flight. */
|
|
292
356
|
private get isPaginated();
|
|
293
357
|
private get columns();
|
|
358
|
+
/** `canCreate` when the host controls it directly; else, when access control is disabled,
|
|
359
|
+
* always allowed; else the table's own self-asked answer. */
|
|
360
|
+
private get effectiveCanCreate();
|
|
361
|
+
/** `allowedTypes` when the host controls it directly, else the table's own self-asked
|
|
362
|
+
* answer. `undefined` means "unknown — don't filter", not "nothing allowed". */
|
|
363
|
+
private get effectiveAllowedTypes();
|
|
364
|
+
/** `item.createTypes` intersected with effectiveAllowedTypes when that is known, so the
|
|
365
|
+
* create-type picker only offers concrete types a create POST would actually accept
|
|
366
|
+
* (FINDING-0176 / TASK-0314). Unfiltered when the answer isn't known (undefined) — an
|
|
367
|
+
* older host/API that never reports allowedTypes keeps today's unfiltered behaviour. */
|
|
368
|
+
private get effectiveCreateTypes();
|
|
294
369
|
private get tableActions();
|
|
295
370
|
private toggleCreatePicker;
|
|
296
371
|
private closeCreatePicker;
|
|
@@ -156,6 +156,11 @@ export namespace Components {
|
|
|
156
156
|
* @default navigator.language
|
|
157
157
|
*/
|
|
158
158
|
"locale": string;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the current user may create a document here — set by mrd-layout-section from its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table gets in list mode. Named `mayCreate` (not `canCreate`) to avoid colliding with the existing `canCreate` state below, which tracks something unrelated: whether the folder tree currently has a valid drop target selected. Defaults to false (hidden) until confirmed, same as mrd-table.
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
"mayCreate": boolean;
|
|
159
164
|
/**
|
|
160
165
|
* Parent record id — required for RELATED_VIEW path building.
|
|
161
166
|
* @default ''
|
|
@@ -516,6 +521,11 @@ export namespace Components {
|
|
|
516
521
|
"statusListItems": ClientListValue[] | null;
|
|
517
522
|
}
|
|
518
523
|
interface MrdLayoutSection {
|
|
524
|
+
/**
|
|
525
|
+
* When false, skips the mrdViewCheckCapabilities round trip for every VIEW/RELATED_VIEW binding and hands mrd-table/mrd-memo-container/mrd-document-container their create affordance as allowed immediately — for a tenant with no access control configured, the answer would always be mayCreate: true anyway (FINDING-0171 / TASK-0322). Default `true` keeps today's ask-and-hide behaviour unchanged.
|
|
526
|
+
* @default true
|
|
527
|
+
*/
|
|
528
|
+
"accessControlEnabled": boolean;
|
|
519
529
|
/**
|
|
520
530
|
* 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.
|
|
521
531
|
* @default []
|
|
@@ -566,6 +576,10 @@ export namespace Components {
|
|
|
566
576
|
* Inject aggregation totals into an embedded mrd-table for a VIEW or RELATED_VIEW item.
|
|
567
577
|
*/
|
|
568
578
|
"setViewAggregations": (name: string, data: any) => Promise<void>;
|
|
579
|
+
/**
|
|
580
|
+
* Host answer to mrdViewCheckCapabilities — whether the current user may create a record for the given view's bound route. `name` is the view key from the event detail. Stored in canCreateMap and passed down as a plain prop to whichever body is mounted for that key (mrd-table, mrd-memo-container or mrd-document-container) — no DOM lookup needed, unlike setViewPage/setViewAggregations, since the prop flows through the next render.
|
|
581
|
+
*/
|
|
582
|
+
"setViewCanCreate": (name: string, value: boolean, allowedTypes?: string[]) => Promise<void>;
|
|
569
583
|
/**
|
|
570
584
|
* Inject the created document's href after a file-drop create, so the optimistic row becomes navigable (see mrdCreateObject). For a memo quick-create there is no optimistic row to resolve — simply reload the container's current body so the new memo shows up.
|
|
571
585
|
*/
|
|
@@ -674,6 +688,11 @@ export namespace Components {
|
|
|
674
688
|
* Resolved `commons.memo` archetype binding.
|
|
675
689
|
*/
|
|
676
690
|
"archetype": ClientArchetype;
|
|
691
|
+
/**
|
|
692
|
+
* Whether the current user may create a memo here — set by mrd-layout-section from its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table gets in table mode. Defaults to false (hidden) until confirmed, same as mrd-table.
|
|
693
|
+
* @default false
|
|
694
|
+
*/
|
|
695
|
+
"canCreate": boolean;
|
|
677
696
|
/**
|
|
678
697
|
* Canonical parent href — set when this is a RELATED_VIEW embedded under a parent record, which already gives a new memo something to attach to.
|
|
679
698
|
* @default ''
|
|
@@ -997,6 +1016,19 @@ export namespace Components {
|
|
|
997
1016
|
"value": string;
|
|
998
1017
|
}
|
|
999
1018
|
interface MrdTable {
|
|
1019
|
+
/**
|
|
1020
|
+
* When false, skips the standalone mrdCheckCapabilities round trip entirely and renders the create action immediately as allowed — for a tenant that has no access control configured, the answer would always be true anyway (FINDING-0171 / TASK-0322). Ignored while `canCreate` is set explicitly (the host already controls the answer directly in that mode). Default `true` keeps today's ask-and-hide behaviour unchanged.
|
|
1021
|
+
* @default true
|
|
1022
|
+
*/
|
|
1023
|
+
"accessControlEnabled": boolean;
|
|
1024
|
+
/**
|
|
1025
|
+
* Concrete types (`item.createTypes[].type`) the current user may actually create, when `item.createTypes` offers a picker for a family type — narrows it down to only the types a create POST would accept (FINDING-0176 / TASK-0314). Leave `undefined` for standalone use — the table takes it from the second argument of setCanCreate() alongside `canCreate`. Set it explicitly (e.g. from mrd-layout-section, alongside `canCreate`) when the host already has the answer. `undefined` (not yet answered, or an older host/API that doesn't report it) means "don't filter" — `item.createTypes` is shown unfiltered, same as before this existed.
|
|
1026
|
+
*/
|
|
1027
|
+
"allowedTypes"?: string[] | null;
|
|
1028
|
+
/**
|
|
1029
|
+
* Whether the current user may create a record for the table's bound route. Leave `undefined` for standalone use — the table then asks on its own via mrdCheckCapabilities and hides the create button until setCanCreate() answers. Set it explicitly when a host already knows the answer (e.g. mrd-layout-section, which asks once per binding and hands the answer to whichever body it mounts) — the table then trusts it directly and never asks on its own (TASK-0299).
|
|
1030
|
+
*/
|
|
1031
|
+
"canCreate"?: boolean;
|
|
1000
1032
|
/**
|
|
1001
1033
|
* Initialise (or reset) the virtual scroll. Call after setting all props and registering the mrdLoadPage listener, but before calling setPage(0, rows).
|
|
1002
1034
|
*/
|
|
@@ -1044,6 +1076,10 @@ export namespace Components {
|
|
|
1044
1076
|
* Inject aggregation totals returned by the /aggregations endpoint.
|
|
1045
1077
|
*/
|
|
1046
1078
|
"setAggregations": (data: AggregationResult) => Promise<void>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Host answer to mrdCheckCapabilities — whether the current user may create a record for the table's currently bound route (standalone use only; ignored while the `canCreate` prop is set, since the host controls it directly in that mode). Call it any time after the event fires; a stale answer for an old binding is discarded automatically (selfCanCreate is reset to false before every new mrdCheckCapabilities emission).
|
|
1081
|
+
*/
|
|
1082
|
+
"setCanCreate": (value: boolean, allowedTypes?: string[]) => Promise<void>;
|
|
1047
1083
|
/**
|
|
1048
1084
|
* Inject the rows for a given page (0-based). Creates a new Map reference so Stencil detects the state change. When the page contains fewer rows than pageSize it is the last page. renderEnd is clamped immediately so no loading-placeholder rows appear beyond the actual data — without requiring the host to update totalElements. Pass hasNext (from _links.next in the API response) for accurate last-page detection even when rows.length === pageSize (exact multiple of page size).
|
|
1049
1085
|
*/
|
|
@@ -1638,6 +1674,7 @@ declare global {
|
|
|
1638
1674
|
"mrdViewAction": { name: string; action: string; dataClass: string; path?: string; qs?: string; parentPath?: string | null; basicType?: string };
|
|
1639
1675
|
"mrdLoadViewAggregations": { name: string; dataClass: string; path: string; qs: string; aggQs: string };
|
|
1640
1676
|
"mrdLoadViewDistinct": { name: string; nodeId: string; distinct: string; path: string; qs: string };
|
|
1677
|
+
"mrdViewCheckCapabilities": { name: string; type: string; refType?: string; refId?: string; filterClass?: string };
|
|
1641
1678
|
"mrdUpdateObject": { href: string; values: Record<string, unknown> };
|
|
1642
1679
|
"mrdDeleteObject": { href: string };
|
|
1643
1680
|
"mrdViewUpload": { name: string; file: File };
|
|
@@ -1879,6 +1916,7 @@ declare global {
|
|
|
1879
1916
|
"mrdAction": { action: string; path?: string; qs?: string; dataClass?: string; parentPath?: string | null; basicType?: string };
|
|
1880
1917
|
"mrdDownload": { href: string; fileName: string };
|
|
1881
1918
|
"mrdLoadAggregations": { path: string; qs: string; aggQs: string };
|
|
1919
|
+
"mrdCheckCapabilities": { type: string; refType?: string; refId?: string; filterClass?: string };
|
|
1882
1920
|
}
|
|
1883
1921
|
interface HTMLMrdTableElement extends Components.MrdTable, HTMLStencilElement {
|
|
1884
1922
|
addEventListener<K extends keyof HTMLMrdTableElementEventMap>(type: K, listener: (this: HTMLMrdTableElement, ev: MrdTableCustomEvent<HTMLMrdTableElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -2129,6 +2167,11 @@ declare namespace LocalJSX {
|
|
|
2129
2167
|
* @default navigator.language
|
|
2130
2168
|
*/
|
|
2131
2169
|
"locale"?: string;
|
|
2170
|
+
/**
|
|
2171
|
+
* Whether the current user may create a document here — set by mrd-layout-section from its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table gets in list mode. Named `mayCreate` (not `canCreate`) to avoid colliding with the existing `canCreate` state below, which tracks something unrelated: whether the folder tree currently has a valid drop target selected. Defaults to false (hidden) until confirmed, same as mrd-table.
|
|
2172
|
+
* @default false
|
|
2173
|
+
*/
|
|
2174
|
+
"mayCreate"?: boolean;
|
|
2132
2175
|
/**
|
|
2133
2176
|
* A table toolbar action was triggered.
|
|
2134
2177
|
*/
|
|
@@ -2588,6 +2631,11 @@ declare namespace LocalJSX {
|
|
|
2588
2631
|
"statusListItems"?: ClientListValue[] | null;
|
|
2589
2632
|
}
|
|
2590
2633
|
interface MrdLayoutSection {
|
|
2634
|
+
/**
|
|
2635
|
+
* When false, skips the mrdViewCheckCapabilities round trip for every VIEW/RELATED_VIEW binding and hands mrd-table/mrd-memo-container/mrd-document-container their create affordance as allowed immediately — for a tenant with no access control configured, the answer would always be mayCreate: true anyway (FINDING-0171 / TASK-0322). Default `true` keeps today's ask-and-hide behaviour unchanged.
|
|
2636
|
+
* @default true
|
|
2637
|
+
*/
|
|
2638
|
+
"accessControlEnabled"?: boolean;
|
|
2591
2639
|
/**
|
|
2592
2640
|
* 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.
|
|
2593
2641
|
* @default []
|
|
@@ -2659,6 +2707,10 @@ declare namespace LocalJSX {
|
|
|
2659
2707
|
* Re-emitted from an embedded mrd-table's mrdAction; host builds the target URL from dataClass.
|
|
2660
2708
|
*/
|
|
2661
2709
|
"onMrdViewAction"?: (event: MrdLayoutSectionCustomEvent<{ name: string; action: string; dataClass: string; path?: string; qs?: string; parentPath?: string | null; basicType?: string }>) => void;
|
|
2710
|
+
/**
|
|
2711
|
+
* Emitted once per VIEW/RELATED_VIEW binding — computed here directly, not relayed from a child (see emitCapabilitiesChecks()), so it covers mrd-table, mrd-memo-container and mrd-document-container uniformly. `name` is the view key (viewKeyFor(item)) — pass it back to setViewCanCreate() to answer it. setViewCanCreate()'s optional third argument narrows a table's `item.createTypes` picker to the concrete types the answer allows, when the API's capabilities response reports them (FINDING-0176 / TASK-0314).
|
|
2712
|
+
*/
|
|
2713
|
+
"onMrdViewCheckCapabilities"?: (event: MrdLayoutSectionCustomEvent<{ name: string; type: string; refType?: string; refId?: string; filterClass?: string }>) => void;
|
|
2662
2714
|
/**
|
|
2663
2715
|
* An external file was dropped on a document view; host uploads and calls setViewFileReference(name, uri).
|
|
2664
2716
|
*/
|
|
@@ -2764,6 +2816,11 @@ declare namespace LocalJSX {
|
|
|
2764
2816
|
* Resolved `commons.memo` archetype binding.
|
|
2765
2817
|
*/
|
|
2766
2818
|
"archetype": ClientArchetype;
|
|
2819
|
+
/**
|
|
2820
|
+
* Whether the current user may create a memo here — set by mrd-layout-section from its generic capability check (TASK-0299/FINDING-0155), the same answer the embedded table gets in table mode. Defaults to false (hidden) until confirmed, same as mrd-table.
|
|
2821
|
+
* @default false
|
|
2822
|
+
*/
|
|
2823
|
+
"canCreate"?: boolean;
|
|
2767
2824
|
/**
|
|
2768
2825
|
* Canonical parent href — set when this is a RELATED_VIEW embedded under a parent record, which already gives a new memo something to attach to.
|
|
2769
2826
|
* @default ''
|
|
@@ -3107,6 +3164,19 @@ declare namespace LocalJSX {
|
|
|
3107
3164
|
"value"?: string;
|
|
3108
3165
|
}
|
|
3109
3166
|
interface MrdTable {
|
|
3167
|
+
/**
|
|
3168
|
+
* When false, skips the standalone mrdCheckCapabilities round trip entirely and renders the create action immediately as allowed — for a tenant that has no access control configured, the answer would always be true anyway (FINDING-0171 / TASK-0322). Ignored while `canCreate` is set explicitly (the host already controls the answer directly in that mode). Default `true` keeps today's ask-and-hide behaviour unchanged.
|
|
3169
|
+
* @default true
|
|
3170
|
+
*/
|
|
3171
|
+
"accessControlEnabled"?: boolean;
|
|
3172
|
+
/**
|
|
3173
|
+
* Concrete types (`item.createTypes[].type`) the current user may actually create, when `item.createTypes` offers a picker for a family type — narrows it down to only the types a create POST would accept (FINDING-0176 / TASK-0314). Leave `undefined` for standalone use — the table takes it from the second argument of setCanCreate() alongside `canCreate`. Set it explicitly (e.g. from mrd-layout-section, alongside `canCreate`) when the host already has the answer. `undefined` (not yet answered, or an older host/API that doesn't report it) means "don't filter" — `item.createTypes` is shown unfiltered, same as before this existed.
|
|
3174
|
+
*/
|
|
3175
|
+
"allowedTypes"?: string[] | null;
|
|
3176
|
+
/**
|
|
3177
|
+
* Whether the current user may create a record for the table's bound route. Leave `undefined` for standalone use — the table then asks on its own via mrdCheckCapabilities and hides the create button until setCanCreate() answers. Set it explicitly when a host already knows the answer (e.g. mrd-layout-section, which asks once per binding and hands the answer to whichever body it mounts) — the table then trusts it directly and never asks on its own (TASK-0299).
|
|
3178
|
+
*/
|
|
3179
|
+
"canCreate"?: boolean;
|
|
3110
3180
|
/**
|
|
3111
3181
|
* The VIEW or RELATED_VIEW layout item. Contains view config, dataClass, fromClass, actions etc.
|
|
3112
3182
|
* @default null
|
|
@@ -3120,6 +3190,10 @@ declare namespace LocalJSX {
|
|
|
3120
3190
|
* Fired when a toolbar action button is clicked. For 'export': includes `path` (relative excel path) and `qs` (current sort+filter params). For 'create': includes `dataClass` (target type) and `parentPath` (e.g. /buyers/123 for RELATED_VIEW).
|
|
3121
3191
|
*/
|
|
3122
3192
|
"onMrdAction"?: (event: MrdTableCustomEvent<{ action: string; path?: string; qs?: string; dataClass?: string; parentPath?: string | null; basicType?: string }>) => void;
|
|
3193
|
+
/**
|
|
3194
|
+
* Standalone use only (never fires while the `canCreate` prop is set — see there). Fired once per table binding (initial load, and whenever the bound item, parent record or active view changes) to ask the host whether the current user may create a record here. Carries the same route the table already uses for its own rows, unconstructed — VIEW: GET /data/{tenant}/{type}/capabilities; RELATED_VIEW: GET /data/{tenant}/{refType}/{refId}/{type}/capabilities. `filterClass`, when the view declares one, is the same subtype the row fetch sends as `?type=` — e.g. a "contents" RELATED_VIEW filtered to `document` asks specifically whether a document may be created here, not any content type. The add button stays hidden until the host calls setCanCreate() (FINDING-0155 / TASK-0299). setCanCreate()'s optional second argument narrows `item.createTypes`'s picker down to the concrete types the answer allows, when the API's capabilities response reports them (FINDING-0176 / TASK-0314).
|
|
3195
|
+
*/
|
|
3196
|
+
"onMrdCheckCapabilities"?: (event: MrdTableCustomEvent<{ type: string; refType?: string; refId?: string; filterClass?: string }>) => void;
|
|
3123
3197
|
/**
|
|
3124
3198
|
* Fired when a FILE or IMAGE cell is clicked. Host resolves the href to a signed download URL.
|
|
3125
3199
|
*/
|
|
@@ -3317,6 +3391,7 @@ declare namespace LocalJSX {
|
|
|
3317
3391
|
"height": number;
|
|
3318
3392
|
"locale": string;
|
|
3319
3393
|
"readOnly": boolean;
|
|
3394
|
+
"mayCreate": boolean;
|
|
3320
3395
|
}
|
|
3321
3396
|
interface MrdDocumentListAttributes {
|
|
3322
3397
|
"parentId": string;
|
|
@@ -3384,6 +3459,7 @@ declare namespace LocalJSX {
|
|
|
3384
3459
|
interface MrdLayoutSectionAttributes {
|
|
3385
3460
|
"locale": string;
|
|
3386
3461
|
"readOnly": boolean;
|
|
3462
|
+
"accessControlEnabled": boolean;
|
|
3387
3463
|
}
|
|
3388
3464
|
interface MrdListFieldAttributes {
|
|
3389
3465
|
"name": string;
|
|
@@ -3411,6 +3487,7 @@ declare namespace LocalJSX {
|
|
|
3411
3487
|
"viewKey": string;
|
|
3412
3488
|
"locale": string;
|
|
3413
3489
|
"readOnly": boolean;
|
|
3490
|
+
"canCreate": boolean;
|
|
3414
3491
|
}
|
|
3415
3492
|
interface MrdMemoListAttributes {
|
|
3416
3493
|
"parentId": string;
|
|
@@ -3472,6 +3549,8 @@ declare namespace LocalJSX {
|
|
|
3472
3549
|
"tableHeight": number;
|
|
3473
3550
|
"requestTimeoutMs": number;
|
|
3474
3551
|
"readOnly": boolean;
|
|
3552
|
+
"canCreate": boolean;
|
|
3553
|
+
"accessControlEnabled": boolean;
|
|
3475
3554
|
}
|
|
3476
3555
|
interface MrdTextFieldAttributes {
|
|
3477
3556
|
"name": string;
|