@object-ui/plugin-tree 17.7.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +424 -0
- package/dist/ObjectTree.d.ts +6 -4
- package/dist/ObjectTree.d.ts.map +1 -1
- package/dist/index.js +158 -133
- package/dist/index.umd.cjs +1 -1
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,429 @@
|
|
|
1
1
|
# @object-ui/plugin-tree
|
|
2
2
|
|
|
3
|
+
## 18.0.0
|
|
4
|
+
|
|
5
|
+
### Dependency floors
|
|
6
|
+
|
|
7
|
+
Computed from `.objectstack-sha` `06cab4849a8a`: the earliest published `@objectstack/spec` that contains it is `18.0.0`.
|
|
8
|
+
|
|
9
|
+
- `@objectstack/spec` (`dependencies`): `^18.0.0-next.1` → `^18.0.0`
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- 6f3299f: objectui moves to major 18, following `@objectstack/*` from 17 to 18 (objectui#12334). objectui's major is not a count of its own breaking changes: it tracks the major of the `@objectstack/spec` its packages depend on, so that the same major means compatible across the two projects. These packages already declare `@objectstack/*` on the 18 line (objectui#12030), so every package in the fixed release group crosses to 18 together. It is the one `major` that rule admits: objectui's own breaking changes ship as `minor`, described in their entries.
|
|
14
|
+
|
|
15
|
+
The 18 line is released from Changesets pre mode on the `next` tag (`.changeset/pre.json`), as `@objectstack/*` 18 is: these releases are `18.0.0-next.N` on the npm `next` dist-tag, and they do not move `latest`. The first `18.0.0` on `latest` comes when `@objectstack` 18 is generally available and this repository leaves pre mode.
|
|
16
|
+
|
|
17
|
+
What a consumer must do to take it is in the `@objectstack/*` 18 entry of this release (objectui#12030): move its own `@objectstack/*` packages to the 18 line at the same time.
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- f34e877: A tree row's declared deadline reads neutral once the row's record settles it through the field's `settledWhen`, and "Overdue Nd" in red otherwise (objectui#11815).
|
|
22
|
+
- c5406c2: Depend on the `@objectstack/*` 18 prerelease line (objectui#12030).
|
|
23
|
+
|
|
24
|
+
Every `@objectstack/*` range these packages declare in `dependencies` or `peerDependencies` moves from `^17.x` to `^18.0.0-next.0`, the `next` prerelease of `@objectstack/*` 18 (raised to `^18.0.0-next.1` by objectui#12370 before release).
|
|
25
|
+
|
|
26
|
+
**Breaking for consumers:** an install that resolves `@objectstack/spec` (or `@objectstack/client`, `@objectstack/formula`, `@objectstack/lint`) 17.x no longer satisfies these ranges. A consumer must move its own `@objectstack/*` packages to the 18 line, starting with `18.0.0-next.1` (objectui#12370), at the same time as it takes this release.
|
|
27
|
+
|
|
28
|
+
**objectui's own surface moves with it:**
|
|
29
|
+
|
|
30
|
+
- `element:record_picker`'s registration stops publishing the `object`, `filter`, `sort` and `limit` inputs, which spec 18 retires; a JSX page that writes one now gets `unknown-prop`.
|
|
31
|
+
- The `CapabilityMultiSelectField` widget's curated capability set (`@object-ui/fields`) follows spec 18: `manage_mailboxes` in, `manage_org_presentation` out.
|
|
32
|
+
- `element:number` and `element:repeater` nodes that bind no object are accepted, as spec 18's row and `PageComponentSchema` accept them; the two `ELEMENT_*_OBJECT_REQUIRED` refusals are gone.
|
|
33
|
+
|
|
34
|
+
**Retired with the spec:** `@objectstack/spec` 18 tombstones `object-grid`'s `defaultFilters` and refuses it by name, and `ObjectGrid` and `ObjectView` stop reading it (`table.defaultFilters` on an `object-view` included). A view that still carries it renders unfiltered: rename the key to `filter`, whose value is the same rule array.
|
|
35
|
+
- ff9df88: Depend on `@objectstack/*` `18.0.0-next.1` (objectui#12370).
|
|
36
|
+
|
|
37
|
+
Every `@objectstack/*` range these packages declare moves from `^18.0.0-next.0` to `^18.0.0-next.1`; the console and the runner bundle `18.0.0-next.1`. A consumer moves its own `@objectstack/*` packages to `18.0.0-next.1` with this release.
|
|
38
|
+
|
|
39
|
+
**Accept sets that narrow with it.** `@object-ui/types` validates page action rows and view data bindings through the spec's own rows, so its faces (`safeValidateSchema` and `StrictAnyComponentSchema`) now refuse what `18.0.0-next.1` refuses. Each was accepted on `18.0.0-next.0`:
|
|
40
|
+
|
|
41
|
+
- `onSuccess` on an `action:button` / `action:icon` row, or an `action:group` / `action:menu` member, whose executor is the `url`, `navigation`, `modal`, `flow` or `form` built-in, or that has no executor at all. Write the hop on an `api` or `script` action (or a host handler name), or drop it.
|
|
42
|
+
- `onSuccess` beside `operation: 'update'`, and an `onSuccess` block carrying a key outside `{ navigate, openIn }`.
|
|
43
|
+
- `actionType: 'navigation'` on a row (and `type: 'navigation'` on a container member): write `'url'`.
|
|
44
|
+
- A `url` executor's `target` that is not openable, judged on the executor the runner runs, including a row whose `name` selects it.
|
|
45
|
+
- A view `data` binding with `provider: 'api'`: bind the object or static rows; an API call is the page element's binding.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- a58626c: fix(plugin-tree): tree cells draw the same field faces as list cells, so a boolean no longer shows as `true` (objectui#11686)
|
|
50
|
+
|
|
51
|
+
A tree view, such as the Org Chart tab on Setup → Business Units, printed most column values as raw text. Its cells knew only option labels and referenced records; every other type was printed as stored, so the boolean "Active" column read `true`, and dates, numbers and currency amounts showed their stored form while the list tabs on the same page drew them properly.
|
|
52
|
+
|
|
53
|
+
Each tree cell whose column the object defines now draws through the field package's cell display for that field type, the same one the grid, kanban and gallery cards use. A boolean draws the read-only checkbox, a date the locale-aware date, a currency the formatted amount, a select its option badge and a lookup the referenced record's name. Where a display names its own column, as the boolean display's badge for an inactive `active` field does, it uses the column label the tree's header shows, so it reads in the session's language. A column the object does not define keeps the plain text it showed before.
|
|
54
|
+
|
|
55
|
+
`@object-ui/plugin-tree` now declares `@object-ui/fields` as a dependency; it already reached it through `@object-ui/plugin-detail`. Nothing is added to the package entry: no export, prop, type member or language-pack key.
|
|
56
|
+
- Updated dependencies [18d7b48]
|
|
57
|
+
- Updated dependencies [172acc3]
|
|
58
|
+
- Updated dependencies [f0496bd]
|
|
59
|
+
- Updated dependencies [c4c506b]
|
|
60
|
+
- Updated dependencies [9db9ff3]
|
|
61
|
+
- Updated dependencies [c096f03]
|
|
62
|
+
- Updated dependencies [d92b2a1]
|
|
63
|
+
- Updated dependencies [92f4e2b]
|
|
64
|
+
- Updated dependencies [b10c68e]
|
|
65
|
+
- Updated dependencies [bdc9049]
|
|
66
|
+
- Updated dependencies [b61c116]
|
|
67
|
+
- Updated dependencies [e8c0b96]
|
|
68
|
+
- Updated dependencies [b92329c]
|
|
69
|
+
- Updated dependencies [2e818d0]
|
|
70
|
+
- Updated dependencies [fd060f0]
|
|
71
|
+
- Updated dependencies [fd060f0]
|
|
72
|
+
- Updated dependencies [8b14aec]
|
|
73
|
+
- Updated dependencies [2abec3a]
|
|
74
|
+
- Updated dependencies [4c127cd]
|
|
75
|
+
- Updated dependencies [9dfaca6]
|
|
76
|
+
- Updated dependencies [76993f8]
|
|
77
|
+
- Updated dependencies [c000398]
|
|
78
|
+
- Updated dependencies [73b5d77]
|
|
79
|
+
- Updated dependencies [7b17705]
|
|
80
|
+
- Updated dependencies [fc3c2cc]
|
|
81
|
+
- Updated dependencies [f9f4a62]
|
|
82
|
+
- Updated dependencies [848ba0e]
|
|
83
|
+
- Updated dependencies [57d82cb]
|
|
84
|
+
- Updated dependencies [de96f3d]
|
|
85
|
+
- Updated dependencies [9ca3cac]
|
|
86
|
+
- Updated dependencies [c910630]
|
|
87
|
+
- Updated dependencies [ce464d9]
|
|
88
|
+
- Updated dependencies [e6dcd85]
|
|
89
|
+
- Updated dependencies [96fcf30]
|
|
90
|
+
- Updated dependencies [7a2c60b]
|
|
91
|
+
- Updated dependencies [055d350]
|
|
92
|
+
- Updated dependencies [7300fca]
|
|
93
|
+
- Updated dependencies [834c559]
|
|
94
|
+
- Updated dependencies [22b503c]
|
|
95
|
+
- Updated dependencies [9fc68aa]
|
|
96
|
+
- Updated dependencies [d50f724]
|
|
97
|
+
- Updated dependencies [17acfbb]
|
|
98
|
+
- Updated dependencies [6be0f7a]
|
|
99
|
+
- Updated dependencies [db4cb6b]
|
|
100
|
+
- Updated dependencies [4590363]
|
|
101
|
+
- Updated dependencies [89cc738]
|
|
102
|
+
- Updated dependencies [c0862c1]
|
|
103
|
+
- Updated dependencies [c0862c1]
|
|
104
|
+
- Updated dependencies [c0862c1]
|
|
105
|
+
- Updated dependencies [c0862c1]
|
|
106
|
+
- Updated dependencies [c0862c1]
|
|
107
|
+
- Updated dependencies [c0862c1]
|
|
108
|
+
- Updated dependencies [ded4494]
|
|
109
|
+
- Updated dependencies [d172f63]
|
|
110
|
+
- Updated dependencies [885a96f]
|
|
111
|
+
- Updated dependencies [4c0de52]
|
|
112
|
+
- Updated dependencies [a80fef7]
|
|
113
|
+
- Updated dependencies [3bf8894]
|
|
114
|
+
- Updated dependencies [72167a9]
|
|
115
|
+
- Updated dependencies [e06365c]
|
|
116
|
+
- Updated dependencies [3035948]
|
|
117
|
+
- Updated dependencies [1e1f09e]
|
|
118
|
+
- Updated dependencies [455c646]
|
|
119
|
+
- Updated dependencies [f34e877]
|
|
120
|
+
- Updated dependencies [f34e877]
|
|
121
|
+
- Updated dependencies [f34e877]
|
|
122
|
+
- Updated dependencies [f34e877]
|
|
123
|
+
- Updated dependencies [9844bbf]
|
|
124
|
+
- Updated dependencies [cef0eee]
|
|
125
|
+
- Updated dependencies [7ebff39]
|
|
126
|
+
- Updated dependencies [054fd84]
|
|
127
|
+
- Updated dependencies [5275d1f]
|
|
128
|
+
- Updated dependencies [7241a81]
|
|
129
|
+
- Updated dependencies [74add0c]
|
|
130
|
+
- Updated dependencies [aaba865]
|
|
131
|
+
- Updated dependencies [f1781be]
|
|
132
|
+
- Updated dependencies [5ab2f19]
|
|
133
|
+
- Updated dependencies [fbad078]
|
|
134
|
+
- Updated dependencies [45d5853]
|
|
135
|
+
- Updated dependencies [4f4fc03]
|
|
136
|
+
- Updated dependencies [2312bd9]
|
|
137
|
+
- Updated dependencies [6d5eb34]
|
|
138
|
+
- Updated dependencies [c5406c2]
|
|
139
|
+
- Updated dependencies [c5406c2]
|
|
140
|
+
- Updated dependencies [d99b731]
|
|
141
|
+
- Updated dependencies [2571a3e]
|
|
142
|
+
- Updated dependencies [a368ccb]
|
|
143
|
+
- Updated dependencies [2a48bd4]
|
|
144
|
+
- Updated dependencies [8a55f0c]
|
|
145
|
+
- Updated dependencies [c7b30bd]
|
|
146
|
+
- Updated dependencies [e391f87]
|
|
147
|
+
- Updated dependencies [20c6d35]
|
|
148
|
+
- Updated dependencies [417e245]
|
|
149
|
+
- Updated dependencies [69bca0a]
|
|
150
|
+
- Updated dependencies [023f00d]
|
|
151
|
+
- Updated dependencies [158c75d]
|
|
152
|
+
- Updated dependencies [7525045]
|
|
153
|
+
- Updated dependencies [5af42db]
|
|
154
|
+
- Updated dependencies [ce991bd]
|
|
155
|
+
- Updated dependencies [3c0f806]
|
|
156
|
+
- Updated dependencies [1071393]
|
|
157
|
+
- Updated dependencies [5f75cfa]
|
|
158
|
+
- Updated dependencies [29b9949]
|
|
159
|
+
- Updated dependencies [1d1cfe0]
|
|
160
|
+
- Updated dependencies [6757a93]
|
|
161
|
+
- Updated dependencies [b7cd5c8]
|
|
162
|
+
- Updated dependencies [5330038]
|
|
163
|
+
- Updated dependencies [2498a07]
|
|
164
|
+
- Updated dependencies [898bd2c]
|
|
165
|
+
- Updated dependencies [c9fc10b]
|
|
166
|
+
- Updated dependencies [dc6d28e]
|
|
167
|
+
- Updated dependencies [c0c2f79]
|
|
168
|
+
- Updated dependencies [0665c3b]
|
|
169
|
+
- Updated dependencies [d2500d8]
|
|
170
|
+
- Updated dependencies [a7d4920]
|
|
171
|
+
- Updated dependencies [e723f58]
|
|
172
|
+
- Updated dependencies [82bb1d5]
|
|
173
|
+
- Updated dependencies [f3d5408]
|
|
174
|
+
- Updated dependencies [b231607]
|
|
175
|
+
- Updated dependencies [b231607]
|
|
176
|
+
- Updated dependencies [466a219]
|
|
177
|
+
- Updated dependencies [466a219]
|
|
178
|
+
- Updated dependencies [466a219]
|
|
179
|
+
- Updated dependencies [6fb281d]
|
|
180
|
+
- Updated dependencies [54159d3]
|
|
181
|
+
- Updated dependencies [fa778e6]
|
|
182
|
+
- Updated dependencies [334f0cf]
|
|
183
|
+
- Updated dependencies [c08c933]
|
|
184
|
+
- Updated dependencies [92f979d]
|
|
185
|
+
- Updated dependencies [c4dd707]
|
|
186
|
+
- Updated dependencies [c4dd707]
|
|
187
|
+
- Updated dependencies [7578323]
|
|
188
|
+
- Updated dependencies [a491b64]
|
|
189
|
+
- Updated dependencies [38bb373]
|
|
190
|
+
- Updated dependencies [803f678]
|
|
191
|
+
- Updated dependencies [923504f]
|
|
192
|
+
- Updated dependencies [5b45c0d]
|
|
193
|
+
- Updated dependencies [923504f]
|
|
194
|
+
- Updated dependencies [5c2982a]
|
|
195
|
+
- Updated dependencies [0cd322d]
|
|
196
|
+
- Updated dependencies [97e7d4e]
|
|
197
|
+
- Updated dependencies [5d3f437]
|
|
198
|
+
- Updated dependencies [10aba37]
|
|
199
|
+
- Updated dependencies [10aba37]
|
|
200
|
+
- Updated dependencies [5d3f437]
|
|
201
|
+
- Updated dependencies [51c661e]
|
|
202
|
+
- Updated dependencies [7af0ab3]
|
|
203
|
+
- Updated dependencies [b434f5f]
|
|
204
|
+
- Updated dependencies [9f282ef]
|
|
205
|
+
- Updated dependencies [fd4872f]
|
|
206
|
+
- Updated dependencies [f0532d8]
|
|
207
|
+
- Updated dependencies [cea429b]
|
|
208
|
+
- Updated dependencies [3092aca]
|
|
209
|
+
- Updated dependencies [82e5f53]
|
|
210
|
+
- Updated dependencies [d81e460]
|
|
211
|
+
- Updated dependencies [8106db1]
|
|
212
|
+
- Updated dependencies [068a540]
|
|
213
|
+
- Updated dependencies [ca45c6d]
|
|
214
|
+
- Updated dependencies [093d55b]
|
|
215
|
+
- Updated dependencies [b64fda3]
|
|
216
|
+
- Updated dependencies [28ebfb5]
|
|
217
|
+
- Updated dependencies [a8051d6]
|
|
218
|
+
- Updated dependencies [72594f2]
|
|
219
|
+
- Updated dependencies [524136e]
|
|
220
|
+
- Updated dependencies [2b06a91]
|
|
221
|
+
- Updated dependencies [6f3299f]
|
|
222
|
+
- Updated dependencies [065a1cf]
|
|
223
|
+
- Updated dependencies [f2b17c6]
|
|
224
|
+
- Updated dependencies [52d6194]
|
|
225
|
+
- Updated dependencies [23bf859]
|
|
226
|
+
- Updated dependencies [1c72d77]
|
|
227
|
+
- Updated dependencies [789cb16]
|
|
228
|
+
- Updated dependencies [2b4d3f1]
|
|
229
|
+
- Updated dependencies [d75f212]
|
|
230
|
+
- Updated dependencies [37db09f]
|
|
231
|
+
- Updated dependencies [ff9df88]
|
|
232
|
+
- Updated dependencies [70e843f]
|
|
233
|
+
- Updated dependencies [caac3b2]
|
|
234
|
+
- Updated dependencies [a2225f9]
|
|
235
|
+
- Updated dependencies [5c4deb5]
|
|
236
|
+
- Updated dependencies [a8e5b73]
|
|
237
|
+
- Updated dependencies [9782cb2]
|
|
238
|
+
- Updated dependencies [3e2394d]
|
|
239
|
+
- Updated dependencies [d9d9d98]
|
|
240
|
+
- Updated dependencies [c950345]
|
|
241
|
+
- Updated dependencies [21f9577]
|
|
242
|
+
- Updated dependencies [044f231]
|
|
243
|
+
- Updated dependencies [f8267df]
|
|
244
|
+
- Updated dependencies [023087f]
|
|
245
|
+
- Updated dependencies [023087f]
|
|
246
|
+
- Updated dependencies [9b82ced]
|
|
247
|
+
- Updated dependencies [3821a3a]
|
|
248
|
+
- Updated dependencies [3eb3ec1]
|
|
249
|
+
- Updated dependencies [92c2a69]
|
|
250
|
+
- Updated dependencies [518a8e3]
|
|
251
|
+
- Updated dependencies [165f8ff]
|
|
252
|
+
- Updated dependencies [646caea]
|
|
253
|
+
- Updated dependencies [1ffd6a2]
|
|
254
|
+
- Updated dependencies [5f8ecf6]
|
|
255
|
+
- Updated dependencies [6f5dc6b]
|
|
256
|
+
- Updated dependencies [7d0c174]
|
|
257
|
+
- Updated dependencies [8ed7e5a]
|
|
258
|
+
- Updated dependencies [6c4d00d]
|
|
259
|
+
- Updated dependencies [db8ce2f]
|
|
260
|
+
- Updated dependencies [726d8c9]
|
|
261
|
+
- Updated dependencies [f0e760a]
|
|
262
|
+
- Updated dependencies [a5bb7ac]
|
|
263
|
+
- Updated dependencies [f78efdd]
|
|
264
|
+
- Updated dependencies [8a8bcf3]
|
|
265
|
+
- Updated dependencies [f74638c]
|
|
266
|
+
- Updated dependencies [278bc29]
|
|
267
|
+
- Updated dependencies [ef71a09]
|
|
268
|
+
- Updated dependencies [8614705]
|
|
269
|
+
- Updated dependencies [619e3f7]
|
|
270
|
+
- Updated dependencies [ca7a4c3]
|
|
271
|
+
- Updated dependencies [c9e6742]
|
|
272
|
+
- Updated dependencies [4be76e0]
|
|
273
|
+
- Updated dependencies [f62b6ff]
|
|
274
|
+
- Updated dependencies [608033b]
|
|
275
|
+
- Updated dependencies [c6b7d82]
|
|
276
|
+
- Updated dependencies [611566b]
|
|
277
|
+
- Updated dependencies [efa9cb4]
|
|
278
|
+
- Updated dependencies [d66d7e8]
|
|
279
|
+
- Updated dependencies [15d8ca6]
|
|
280
|
+
- Updated dependencies [378896d]
|
|
281
|
+
- Updated dependencies [9d857c9]
|
|
282
|
+
- Updated dependencies [670ea10]
|
|
283
|
+
- Updated dependencies [ff215d9]
|
|
284
|
+
- Updated dependencies [71243db]
|
|
285
|
+
- Updated dependencies [e219a3d]
|
|
286
|
+
- Updated dependencies [a8add5c]
|
|
287
|
+
- Updated dependencies [33ee9de]
|
|
288
|
+
- Updated dependencies [4839f5c]
|
|
289
|
+
- Updated dependencies [a23e804]
|
|
290
|
+
- Updated dependencies [c7462e7]
|
|
291
|
+
- Updated dependencies [36e2f7b]
|
|
292
|
+
- Updated dependencies [263e9dd]
|
|
293
|
+
- Updated dependencies [360e27a]
|
|
294
|
+
- Updated dependencies [ac59073]
|
|
295
|
+
- Updated dependencies [44cb469]
|
|
296
|
+
- Updated dependencies [e058d76]
|
|
297
|
+
- Updated dependencies [464ae62]
|
|
298
|
+
- Updated dependencies [c999d4c]
|
|
299
|
+
- Updated dependencies [8df2608]
|
|
300
|
+
- Updated dependencies [8df2608]
|
|
301
|
+
- Updated dependencies [5483297]
|
|
302
|
+
- Updated dependencies [ed43c79]
|
|
303
|
+
- Updated dependencies [6367bfe]
|
|
304
|
+
- Updated dependencies [260ef71]
|
|
305
|
+
- Updated dependencies [655e897]
|
|
306
|
+
- Updated dependencies [655e897]
|
|
307
|
+
- Updated dependencies [020d178]
|
|
308
|
+
- Updated dependencies [8d80845]
|
|
309
|
+
- Updated dependencies [69a408f]
|
|
310
|
+
- Updated dependencies [1aa622a]
|
|
311
|
+
- Updated dependencies [d2b21a1]
|
|
312
|
+
- Updated dependencies [6e4f144]
|
|
313
|
+
- Updated dependencies [5ff64ef]
|
|
314
|
+
- Updated dependencies [64acb7e]
|
|
315
|
+
- Updated dependencies [4ff5b6b]
|
|
316
|
+
- Updated dependencies [473e5a0]
|
|
317
|
+
- Updated dependencies [b279016]
|
|
318
|
+
- Updated dependencies [bb6c38c]
|
|
319
|
+
- Updated dependencies [15b1065]
|
|
320
|
+
- Updated dependencies [26323c4]
|
|
321
|
+
- Updated dependencies [9753811]
|
|
322
|
+
- Updated dependencies [2727527]
|
|
323
|
+
- Updated dependencies [3da39ae]
|
|
324
|
+
- Updated dependencies [bc281f4]
|
|
325
|
+
- Updated dependencies [d637be3]
|
|
326
|
+
- Updated dependencies [8392f74]
|
|
327
|
+
- Updated dependencies [2cfdc99]
|
|
328
|
+
- Updated dependencies [2cfdc99]
|
|
329
|
+
- Updated dependencies [8523e81]
|
|
330
|
+
- Updated dependencies [1e6d83b]
|
|
331
|
+
- Updated dependencies [1e6d83b]
|
|
332
|
+
- Updated dependencies [32b492b]
|
|
333
|
+
- Updated dependencies [6058bf8]
|
|
334
|
+
- Updated dependencies [c219165]
|
|
335
|
+
- Updated dependencies [79cb8c0]
|
|
336
|
+
- Updated dependencies [a7ae252]
|
|
337
|
+
- Updated dependencies [fb501bc]
|
|
338
|
+
- Updated dependencies [03f1d65]
|
|
339
|
+
- Updated dependencies [30083da]
|
|
340
|
+
- Updated dependencies [7f9cc37]
|
|
341
|
+
- Updated dependencies [b7fe09e]
|
|
342
|
+
- Updated dependencies [025130c]
|
|
343
|
+
- Updated dependencies [76f91f8]
|
|
344
|
+
- Updated dependencies [ea34d9b]
|
|
345
|
+
- Updated dependencies [8aa8e3e]
|
|
346
|
+
- Updated dependencies [024b7b6]
|
|
347
|
+
- Updated dependencies [cb80001]
|
|
348
|
+
- Updated dependencies [bcd9717]
|
|
349
|
+
- Updated dependencies [909c64e]
|
|
350
|
+
- Updated dependencies [9e7e1a5]
|
|
351
|
+
- Updated dependencies [1d3da6c]
|
|
352
|
+
- Updated dependencies [0d97642]
|
|
353
|
+
- Updated dependencies [2493e85]
|
|
354
|
+
- Updated dependencies [d0b9648]
|
|
355
|
+
- Updated dependencies [46dbf32]
|
|
356
|
+
- Updated dependencies [a928aaa]
|
|
357
|
+
- Updated dependencies [47508f3]
|
|
358
|
+
- Updated dependencies [61ed5ad]
|
|
359
|
+
- Updated dependencies [1b94d50]
|
|
360
|
+
- Updated dependencies [6f877f1]
|
|
361
|
+
- Updated dependencies [988aa9f]
|
|
362
|
+
- Updated dependencies [50ba1bb]
|
|
363
|
+
- Updated dependencies [1ce0711]
|
|
364
|
+
- Updated dependencies [fb85637]
|
|
365
|
+
- Updated dependencies [9f1dd79]
|
|
366
|
+
- Updated dependencies [df71568]
|
|
367
|
+
- Updated dependencies [d11174a]
|
|
368
|
+
- Updated dependencies [4c68855]
|
|
369
|
+
- Updated dependencies [2d8a8b7]
|
|
370
|
+
- Updated dependencies [cbac9d7]
|
|
371
|
+
- Updated dependencies [5129caa]
|
|
372
|
+
- Updated dependencies [9eb1479]
|
|
373
|
+
- Updated dependencies [74e37aa]
|
|
374
|
+
- Updated dependencies [961b69f]
|
|
375
|
+
- Updated dependencies [52907d7]
|
|
376
|
+
- Updated dependencies [f466b0a]
|
|
377
|
+
- Updated dependencies [673a71c]
|
|
378
|
+
- Updated dependencies [616df65]
|
|
379
|
+
- Updated dependencies [f48a4d5]
|
|
380
|
+
- Updated dependencies [58798ec]
|
|
381
|
+
- Updated dependencies [8803ca5]
|
|
382
|
+
- Updated dependencies [e70c21d]
|
|
383
|
+
- Updated dependencies [4b92c5a]
|
|
384
|
+
- Updated dependencies [06be396]
|
|
385
|
+
- Updated dependencies [3650d94]
|
|
386
|
+
- Updated dependencies [7c05f21]
|
|
387
|
+
- Updated dependencies [8cd4db4]
|
|
388
|
+
- Updated dependencies [daeb77f]
|
|
389
|
+
- Updated dependencies [eb4552e]
|
|
390
|
+
- Updated dependencies [3c3115e]
|
|
391
|
+
- Updated dependencies [55e90fd]
|
|
392
|
+
- Updated dependencies [9b75509]
|
|
393
|
+
- Updated dependencies [b13ea3c]
|
|
394
|
+
- Updated dependencies [d7e9e9a]
|
|
395
|
+
- Updated dependencies [cf62edf]
|
|
396
|
+
- Updated dependencies [0253416]
|
|
397
|
+
- Updated dependencies [5d77c09]
|
|
398
|
+
- Updated dependencies [3fd8625]
|
|
399
|
+
- Updated dependencies [1473757]
|
|
400
|
+
- Updated dependencies [d73d987]
|
|
401
|
+
- Updated dependencies [12ff256]
|
|
402
|
+
- Updated dependencies [35a2b59]
|
|
403
|
+
- Updated dependencies [26b0bd2]
|
|
404
|
+
- Updated dependencies [26b0bd2]
|
|
405
|
+
- Updated dependencies [d328698]
|
|
406
|
+
- Updated dependencies [d328698]
|
|
407
|
+
- Updated dependencies [d328698]
|
|
408
|
+
- Updated dependencies [b4e0787]
|
|
409
|
+
- Updated dependencies [53ee2f8]
|
|
410
|
+
- Updated dependencies [088e0f7]
|
|
411
|
+
- Updated dependencies [78b07f4]
|
|
412
|
+
- Updated dependencies [0df67f2]
|
|
413
|
+
- Updated dependencies [f962cdc]
|
|
414
|
+
- Updated dependencies [b403bb3]
|
|
415
|
+
- Updated dependencies [8a25fee]
|
|
416
|
+
- Updated dependencies [4016370]
|
|
417
|
+
- Updated dependencies [12dc7b4]
|
|
418
|
+
- @object-ui/types@18.0.0
|
|
419
|
+
- @object-ui/components@18.0.0
|
|
420
|
+
- @object-ui/core@18.0.0
|
|
421
|
+
- @object-ui/i18n@18.0.0
|
|
422
|
+
- @object-ui/react@18.0.0
|
|
423
|
+
- @object-ui/plugin-detail@18.0.0
|
|
424
|
+
- @object-ui/fields@18.0.0
|
|
425
|
+
- @object-ui/permissions@18.0.0
|
|
426
|
+
|
|
3
427
|
## 17.7.0
|
|
4
428
|
|
|
5
429
|
### Minor Changes
|
package/dist/ObjectTree.d.ts
CHANGED
|
@@ -22,10 +22,12 @@ export interface ObjectTreeProps {
|
|
|
22
22
|
*
|
|
23
23
|
* ## ⚠️ The CEILING, so nobody reads this as more than it is
|
|
24
24
|
*
|
|
25
|
-
* `BaseSchema`
|
|
26
|
-
* type still
|
|
27
|
-
* question
|
|
28
|
-
* refused — the same ceiling objectui#5155 /
|
|
25
|
+
* `BaseSchema` ended in `[key: string]: any` when this was written, so an
|
|
26
|
+
* UNDECLARED key read off this type still compiled and typed `any`. What the
|
|
27
|
+
* annotation bought was that the question became ANSWERABLE by the checker, ⛔ not
|
|
28
|
+
* that an undeclared read was refused — the same ceiling objectui#5155 /
|
|
29
|
+
* objectui#7927 recorded for the mirror. objectui#8347 removed the signature, so
|
|
30
|
+
* an undeclared read off this type no longer compiles.
|
|
29
31
|
*/
|
|
30
32
|
schema: ObjectTreeSchema;
|
|
31
33
|
dataSource?: DataSource;
|
package/dist/ObjectTree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectTree.d.ts","sourceRoot":"","sources":["../src/ObjectTree.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAkB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectTree.d.ts","sourceRoot":"","sources":["../src/ObjectTree.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAkB,MAAM,kBAAkB,CAAC;AA4ErF,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChD,sEAAsE;IACtE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAggBD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAwtBhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { useEffect as e, useMemo as t, useState as n } from "react";
|
|
2
|
-
import { ComponentRegistry as r, ValueDataSource as i, applyNonGridRowCeiling as a, buildExpandFields as o, columnIdentity as s, getRecordDisplayName as c, humanizeLabel as l, isExpandableFieldType as u, nonGridRowCeilingQuery as d, resolveRecordSourceConfig as
|
|
3
|
-
import { NonGridRowCeilingNote as p, useDataInvalidation as
|
|
4
|
-
import { NavigationOverlay as
|
|
5
|
-
import { RECORD_OVERLAY_DEFAULT_WIDTH as
|
|
6
|
-
import { createSafeTranslation as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { ComponentRegistry as r, ValueDataSource as i, applyNonGridRowCeiling as a, buildExpandFields as o, columnIdentity as s, getRecordDisplayName as c, humanizeLabel as l, isDeadlineSettled as ee, isExpandableFieldType as u, nonGridRowCeilingQuery as d, resolveRecordSourceConfig as te, resolveRecordSourceObjectName as f } from "@object-ui/core";
|
|
3
|
+
import { NonGridRowCeilingNote as p, useDataInvalidation as ne, useFilterScope as re, useNavigationOverlay as ie, usePredicateScope as m, useResolvedFilter as ae, useSafeFieldLabel as oe, useSchemaContext as h, useSettledSchema as se } from "@object-ui/react";
|
|
4
|
+
import { NavigationOverlay as ce, RefreshIndicator as le, cn as g, legacyRecordDrawerWidthKey as ue, recordOverlayWidthStorageKey as de, useOverlayAnchor as fe } from "@object-ui/components";
|
|
5
|
+
import { RECORD_OVERLAY_DEFAULT_WIDTH as pe, RecordDetailPanel as _ } from "@object-ui/plugin-detail";
|
|
6
|
+
import { createSafeTranslation as v } from "@object-ui/i18n";
|
|
7
|
+
import { getCellRenderer as y, resolveCellRendererType as b } from "@object-ui/fields";
|
|
8
|
+
import { usePermissions as me } from "@object-ui/permissions";
|
|
9
|
+
import { ChevronDown as he, ChevronRight as ge } from "lucide-react";
|
|
10
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
10
11
|
//#region src/ObjectTree.tsx
|
|
11
|
-
var
|
|
12
|
+
var w = v({
|
|
12
13
|
"detail.recordDetail": "Record Detail",
|
|
13
14
|
"grid.refreshing": "Refreshing…"
|
|
14
|
-
}, "detail.recordDetail"),
|
|
15
|
-
function
|
|
15
|
+
}, "detail.recordDetail"), _e = [];
|
|
16
|
+
function T(e) {
|
|
16
17
|
return s(e) || (e && typeof e == "object" ? e.key : void 0) || void 0;
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function ve(e) {
|
|
19
20
|
let t = e.tree || {}, n = Array.isArray(e.fields) ? e.fields : Array.isArray(t.fields) ? t.fields : [];
|
|
20
21
|
return {
|
|
21
|
-
parentField:
|
|
22
|
-
labelField:
|
|
23
|
-
fields: n.map(
|
|
22
|
+
parentField: T(e.parentField ?? t.parentField),
|
|
23
|
+
labelField: T(e.labelField ?? t.labelField) ?? "name",
|
|
24
|
+
fields: n.map(T).filter((e) => !!e),
|
|
24
25
|
defaultExpandedDepth: e.defaultExpandedDepth ?? t.defaultExpandedDepth
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function ye(e, t) {
|
|
28
29
|
let n = e?.fields;
|
|
29
30
|
if (!n || typeof n != "object") return;
|
|
30
31
|
let r;
|
|
@@ -35,11 +36,11 @@ function _e(e, t) {
|
|
|
35
36
|
}
|
|
36
37
|
return r;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function E(e) {
|
|
39
40
|
let t = e?.id ?? e?._id;
|
|
40
41
|
return t == null ? void 0 : String(t);
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function D(e, t) {
|
|
43
44
|
if (!t) return;
|
|
44
45
|
let n = e?.[t];
|
|
45
46
|
if (n != null) {
|
|
@@ -50,10 +51,10 @@ function T(e, t) {
|
|
|
50
51
|
return String(n);
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function be(e, t) {
|
|
54
55
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
55
56
|
for (let t of e) {
|
|
56
|
-
let e =
|
|
57
|
+
let e = E(t);
|
|
57
58
|
e != null && (n.set(e, {
|
|
58
59
|
id: e,
|
|
59
60
|
record: t,
|
|
@@ -63,7 +64,7 @@ function ve(e, t) {
|
|
|
63
64
|
}
|
|
64
65
|
let i = [];
|
|
65
66
|
for (let e of r) {
|
|
66
|
-
let r = n.get(e), a =
|
|
67
|
+
let r = n.get(e), a = D(r.record, t), o = a == null ? void 0 : n.get(a);
|
|
67
68
|
o && o !== r ? o.children.push(r) : i.push(r);
|
|
68
69
|
}
|
|
69
70
|
let a = (e, t) => {
|
|
@@ -71,20 +72,20 @@ function ve(e, t) {
|
|
|
71
72
|
};
|
|
72
73
|
return a(i, 0), i;
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
+
function xe(e, t) {
|
|
75
76
|
let n = [], r = (e) => {
|
|
76
77
|
for (let i of e) n.push(i), i.children.length > 0 && t.has(i.id) && r(i.children);
|
|
77
78
|
};
|
|
78
79
|
return r(e), n;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function O(e, t) {
|
|
81
82
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
82
83
|
for (let i of e) i.children.length !== 0 && (t == null || i.depth < t) && (n.add(i.id), r(i.children));
|
|
83
84
|
};
|
|
84
85
|
return r(e), n;
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
let r =
|
|
87
|
+
function Se(e, t, n) {
|
|
88
|
+
let r = O(e, t);
|
|
88
89
|
if (n.size === 0) return r;
|
|
89
90
|
let i = (e) => {
|
|
90
91
|
for (let t of e) {
|
|
@@ -94,7 +95,26 @@ function be(e, t, n) {
|
|
|
94
95
|
};
|
|
95
96
|
return i(e), r;
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function k(e, t, n = "") {
|
|
99
|
+
let r = t.fieldDef, i = typeof r?.type == "string" ? r.type : "";
|
|
100
|
+
if (!i) return A(e, t) || n;
|
|
101
|
+
let a = b({
|
|
102
|
+
type: i,
|
|
103
|
+
format: r.format
|
|
104
|
+
}), o = y(a), s = Array.isArray(r.options) ? t.objectName ? t.translateOptions(t.objectName, t.fieldName, r.options) : r.options : void 0, c = {
|
|
105
|
+
...r,
|
|
106
|
+
name: t.fieldName,
|
|
107
|
+
type: a,
|
|
108
|
+
label: t.columnLabel,
|
|
109
|
+
...s ? { options: s } : {}
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ S(o, {
|
|
112
|
+
value: e,
|
|
113
|
+
field: c,
|
|
114
|
+
deadlineSettled: t.deadlineSettled
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function A(e, t) {
|
|
98
118
|
if (e == null) return "";
|
|
99
119
|
let n = Array.isArray(t?.fieldDef?.options) ? t.fieldDef.options : null;
|
|
100
120
|
if (n && n.length > 0) {
|
|
@@ -108,215 +128,220 @@ function D(e, t) {
|
|
|
108
128
|
}
|
|
109
129
|
return typeof e == "object" && u(t?.fieldDef) ? c(void 0, e) : String(typeof e == "object" ? e.name ?? e.label ?? e.id ?? e._id ?? "" : e);
|
|
110
130
|
}
|
|
111
|
-
var
|
|
112
|
-
let [
|
|
131
|
+
var j = ({ schema: r, dataSource: s, className: c, onRowClick: l, ...u }) => {
|
|
132
|
+
let [h, v] = n(null), [y, b] = n(null), [T, E] = n(!0), [D, O] = n(null), j = t(() => te(r, "view-data"), [r]), M = f(r, j) ?? "", { ready: N, def: P } = se(M, s), F = j?.provider, I = j?.provider === "object" ? j.object : void 0, L = j?.provider === "value" ? j.items : void 0, R = me(), Ce = re(), z = ae(r.filter, Ce), we = ne(s ? I : void 0);
|
|
113
133
|
e(() => {
|
|
114
134
|
let e = !1;
|
|
115
135
|
return (async () => {
|
|
116
136
|
try {
|
|
117
|
-
if (E(!0),
|
|
118
|
-
if (!
|
|
119
|
-
let t = o(
|
|
120
|
-
$filter:
|
|
137
|
+
if (E(!0), O(null), F === "object" && s && typeof s.find == "function") {
|
|
138
|
+
if (!N) return;
|
|
139
|
+
let t = o(P?.fields), n = R?.isLoaded ? t.filter((e) => R.checkField(I, e, "read")) : t, r = await s.find(I, {
|
|
140
|
+
$filter: z,
|
|
121
141
|
...d(),
|
|
122
142
|
...n.length > 0 ? { $expand: n } : {}
|
|
123
143
|
}), i = a(r);
|
|
124
|
-
e || (
|
|
125
|
-
provider:
|
|
126
|
-
object:
|
|
144
|
+
e || (v({
|
|
145
|
+
provider: F,
|
|
146
|
+
object: I,
|
|
127
147
|
rows: i.rows
|
|
128
|
-
}),
|
|
148
|
+
}), b(i), E(!1));
|
|
129
149
|
return;
|
|
130
150
|
}
|
|
131
151
|
let t = u.data;
|
|
132
152
|
if (Array.isArray(t)) {
|
|
133
|
-
e || (
|
|
134
|
-
provider:
|
|
135
|
-
object:
|
|
153
|
+
e || (v({
|
|
154
|
+
provider: F,
|
|
155
|
+
object: I,
|
|
136
156
|
rows: t
|
|
137
|
-
}),
|
|
157
|
+
}), b(null), E(!1));
|
|
138
158
|
return;
|
|
139
159
|
}
|
|
140
|
-
if (
|
|
141
|
-
let t = await new i({ items:
|
|
142
|
-
$filter:
|
|
160
|
+
if (F === "value") {
|
|
161
|
+
let t = await new i({ items: L ?? [] }).find("", {
|
|
162
|
+
$filter: z,
|
|
143
163
|
...d()
|
|
144
164
|
}), n = a(t);
|
|
145
|
-
e || (
|
|
146
|
-
provider:
|
|
147
|
-
object:
|
|
165
|
+
e || (v({
|
|
166
|
+
provider: F,
|
|
167
|
+
object: I,
|
|
148
168
|
rows: n.rows
|
|
149
|
-
}),
|
|
169
|
+
}), b(n), E(!1));
|
|
150
170
|
return;
|
|
151
171
|
}
|
|
152
|
-
e || (
|
|
153
|
-
provider:
|
|
154
|
-
object:
|
|
172
|
+
e || (v({
|
|
173
|
+
provider: F,
|
|
174
|
+
object: I,
|
|
155
175
|
rows: []
|
|
156
176
|
}), E(!1));
|
|
157
177
|
} catch (t) {
|
|
158
|
-
e || (
|
|
178
|
+
e || (O(t), E(!1));
|
|
159
179
|
}
|
|
160
180
|
})(), () => {
|
|
161
181
|
e = !0;
|
|
162
182
|
};
|
|
163
183
|
}, [
|
|
164
|
-
P,
|
|
165
184
|
F,
|
|
166
185
|
I,
|
|
186
|
+
L,
|
|
167
187
|
s,
|
|
168
|
-
|
|
188
|
+
z,
|
|
189
|
+
P,
|
|
169
190
|
N,
|
|
170
|
-
M,
|
|
171
191
|
u.data,
|
|
172
|
-
|
|
173
|
-
|
|
192
|
+
R,
|
|
193
|
+
we
|
|
174
194
|
]);
|
|
175
|
-
let
|
|
176
|
-
|
|
177
|
-
|
|
195
|
+
let B = t(() => ve(r), [r]), V = t(() => B.parentField ?? ye(P, r.objectName), [
|
|
196
|
+
B.parentField,
|
|
197
|
+
P,
|
|
178
198
|
r.objectName
|
|
179
|
-
]),
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
]),
|
|
199
|
+
]), H = h && h.provider === F && h.object === I ? h.rows : null, U = t(() => be(H ?? _e, V), [H, V]), [W, Te] = n(() => /* @__PURE__ */ new Map()), G = t(() => Se(U, B.defaultExpandedDepth, W), [
|
|
200
|
+
U,
|
|
201
|
+
B.defaultExpandedDepth,
|
|
202
|
+
W
|
|
203
|
+
]), Ee = (e, t) => Te((n) => {
|
|
184
204
|
let r = new Map(n);
|
|
185
205
|
return r.set(e, !t), r;
|
|
186
|
-
}),
|
|
187
|
-
let t =
|
|
188
|
-
return
|
|
189
|
-
},
|
|
190
|
-
fieldDef:
|
|
206
|
+
}), De = t(() => xe(U, G), [U, G]), K = oe(), Oe = m(), q = f(r, j) ?? r.objectName, J = (e) => {
|
|
207
|
+
let t = P?.fields?.[e]?.label || e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
208
|
+
return q ? K.fieldLabel(q, e, t) : t;
|
|
209
|
+
}, Y = (e, t) => ({
|
|
210
|
+
fieldDef: P?.fields?.[e],
|
|
191
211
|
fieldName: e,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
212
|
+
columnLabel: J(e),
|
|
213
|
+
objectName: q,
|
|
214
|
+
translateOptions: K.translateOptions,
|
|
215
|
+
deadlineSettled: ee(P?.fields?.[e], t, {
|
|
216
|
+
scope: Oe,
|
|
217
|
+
fields: P?.fields
|
|
218
|
+
})
|
|
219
|
+
}), X = ie({
|
|
195
220
|
navigation: r.navigation,
|
|
196
|
-
objectName: f(r,
|
|
221
|
+
objectName: f(r, j) ?? r.objectName,
|
|
197
222
|
onRowClick: l
|
|
198
|
-
}), { anchorRef:
|
|
199
|
-
if (
|
|
200
|
-
className:
|
|
201
|
-
children: /* @__PURE__ */
|
|
223
|
+
}), { anchorRef: ke, captureAnchor: Ae } = fe(), { t: Z } = w();
|
|
224
|
+
if (D) return /* @__PURE__ */ S("div", {
|
|
225
|
+
className: g("flex items-center justify-center h-40 text-destructive", c),
|
|
226
|
+
children: /* @__PURE__ */ C("p", { children: ["Failed to load tree: ", D.message] })
|
|
202
227
|
});
|
|
203
|
-
if (
|
|
204
|
-
className:
|
|
205
|
-
children: /* @__PURE__ */
|
|
228
|
+
if (H === null || T && H.length === 0) return /* @__PURE__ */ S("div", {
|
|
229
|
+
className: g("flex items-center justify-center h-40 text-muted-foreground", c),
|
|
230
|
+
children: /* @__PURE__ */ S("p", { children: "Loading…" })
|
|
206
231
|
});
|
|
207
|
-
if (
|
|
208
|
-
className:
|
|
209
|
-
children: /* @__PURE__ */
|
|
232
|
+
if (H.length === 0) return /* @__PURE__ */ S("div", {
|
|
233
|
+
className: g("flex items-center justify-center h-40 text-muted-foreground", c),
|
|
234
|
+
children: /* @__PURE__ */ S("p", { children: "No records" })
|
|
210
235
|
});
|
|
211
236
|
let Q = (e) => {
|
|
212
|
-
if (!
|
|
213
|
-
let t = f(r,
|
|
214
|
-
return /* @__PURE__ */
|
|
215
|
-
...
|
|
237
|
+
if (!X.isOverlay) return null;
|
|
238
|
+
let t = f(r, j) ?? r.objectName;
|
|
239
|
+
return /* @__PURE__ */ S(ce, {
|
|
240
|
+
...X,
|
|
216
241
|
title: Z("detail.recordDetail"),
|
|
217
242
|
mainContent: e,
|
|
218
|
-
popoverAnchorRef:
|
|
219
|
-
storageKey: t ?
|
|
220
|
-
legacyStorageKey: t ?
|
|
221
|
-
width:
|
|
243
|
+
popoverAnchorRef: ke,
|
|
244
|
+
storageKey: t ? de(t) : void 0,
|
|
245
|
+
legacyStorageKey: t ? ue(t) : void 0,
|
|
246
|
+
width: X.width ?? pe,
|
|
222
247
|
children: (e) => {
|
|
223
|
-
let n = e, r = n.id ?? n._id, i = !!
|
|
224
|
-
return !t || r == null || !i ? /* @__PURE__ */
|
|
248
|
+
let n = e, r = n.id ?? n._id, i = !!P?.fields && Object.keys(P.fields).length > 0;
|
|
249
|
+
return !t || r == null || !i ? /* @__PURE__ */ S("div", {
|
|
225
250
|
className: "space-y-3 p-4",
|
|
226
|
-
children: Object.entries(n).map(([e, t]) => /* @__PURE__ */
|
|
251
|
+
children: Object.entries(n).map(([e, t]) => /* @__PURE__ */ C("div", {
|
|
227
252
|
className: "flex flex-col",
|
|
228
|
-
children: [/* @__PURE__ */
|
|
253
|
+
children: [/* @__PURE__ */ S("span", {
|
|
229
254
|
className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
|
|
230
255
|
children: e.replace(/_/g, " ")
|
|
231
|
-
}), /* @__PURE__ */
|
|
256
|
+
}), /* @__PURE__ */ S("span", {
|
|
232
257
|
className: "text-sm",
|
|
233
|
-
children:
|
|
258
|
+
children: A(t, Y(e)) || "—"
|
|
234
259
|
})]
|
|
235
260
|
}, e))
|
|
236
|
-
}) : /* @__PURE__ */
|
|
261
|
+
}) : /* @__PURE__ */ S("div", {
|
|
237
262
|
className: "px-6 pt-6 pb-6",
|
|
238
|
-
children: /* @__PURE__ */
|
|
263
|
+
children: /* @__PURE__ */ S(_, {
|
|
239
264
|
record: n,
|
|
240
265
|
objectName: t,
|
|
241
266
|
recordId: r,
|
|
242
267
|
dataSource: s,
|
|
243
|
-
objectSchema:
|
|
244
|
-
onClose:
|
|
268
|
+
objectSchema: P,
|
|
269
|
+
onClose: X.close
|
|
245
270
|
})
|
|
246
271
|
});
|
|
247
272
|
}
|
|
248
273
|
});
|
|
249
|
-
}, $ = /* @__PURE__ */
|
|
250
|
-
className:
|
|
274
|
+
}, $ = /* @__PURE__ */ C("div", {
|
|
275
|
+
className: g("w-full overflow-auto", c),
|
|
251
276
|
"data-testid": "object-tree",
|
|
252
277
|
children: [
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
active: T &&
|
|
278
|
+
/* @__PURE__ */ S(le, {
|
|
279
|
+
active: T && H.length > 0,
|
|
255
280
|
ariaLabel: Z("grid.refreshing"),
|
|
256
281
|
className: "sticky -mb-0.5"
|
|
257
282
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ C("table", {
|
|
259
284
|
className: "w-full border-collapse text-sm",
|
|
260
|
-
children: [/* @__PURE__ */
|
|
285
|
+
children: [/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ C("tr", {
|
|
261
286
|
className: "border-b text-left text-muted-foreground",
|
|
262
|
-
children: [/* @__PURE__ */
|
|
287
|
+
children: [/* @__PURE__ */ S("th", {
|
|
263
288
|
className: "px-3 py-2 font-medium",
|
|
264
|
-
children:
|
|
265
|
-
}),
|
|
289
|
+
children: J(B.labelField)
|
|
290
|
+
}), B.fields.filter((e) => e !== B.labelField).map((e) => /* @__PURE__ */ S("th", {
|
|
266
291
|
className: "px-3 py-2 font-medium",
|
|
267
|
-
children:
|
|
292
|
+
children: J(e)
|
|
268
293
|
}, e))]
|
|
269
|
-
}) }), /* @__PURE__ */
|
|
270
|
-
let t = e.children.length > 0, n =
|
|
271
|
-
return /* @__PURE__ */
|
|
294
|
+
}) }), /* @__PURE__ */ S("tbody", { children: De.map((e) => {
|
|
295
|
+
let t = e.children.length > 0, n = G.has(e.id);
|
|
296
|
+
return /* @__PURE__ */ C("tr", {
|
|
272
297
|
className: "border-b hover:bg-accent/50 cursor-pointer",
|
|
273
298
|
"data-testid": "object-tree-row",
|
|
274
299
|
"data-depth": e.depth,
|
|
275
300
|
onClick: (t) => {
|
|
276
|
-
|
|
301
|
+
Ae(t), X.handleClick(e.record, t);
|
|
277
302
|
},
|
|
278
|
-
children: [/* @__PURE__ */
|
|
303
|
+
children: [/* @__PURE__ */ S("td", {
|
|
279
304
|
className: "px-3 py-2",
|
|
280
|
-
children: /* @__PURE__ */
|
|
305
|
+
children: /* @__PURE__ */ C("div", {
|
|
281
306
|
className: "flex items-center gap-1",
|
|
282
307
|
style: { paddingLeft: `${e.depth * 20}px` },
|
|
283
|
-
children: [t ? /* @__PURE__ */
|
|
308
|
+
children: [t ? /* @__PURE__ */ S("button", {
|
|
284
309
|
type: "button",
|
|
285
310
|
"aria-label": n ? "Collapse" : "Expand",
|
|
286
311
|
className: "flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted",
|
|
287
312
|
onClick: (t) => {
|
|
288
|
-
t.stopPropagation(),
|
|
313
|
+
t.stopPropagation(), Ee(e.id, n);
|
|
289
314
|
},
|
|
290
|
-
children:
|
|
291
|
-
}) : /* @__PURE__ */
|
|
315
|
+
children: S(n ? he : ge, { className: "h-4 w-4" })
|
|
316
|
+
}) : /* @__PURE__ */ S("span", { className: "inline-block h-5 w-5" }), /* @__PURE__ */ S("span", {
|
|
292
317
|
className: "truncate",
|
|
293
|
-
children:
|
|
318
|
+
children: k(e.record[B.labelField], Y(B.labelField, e.record), "—")
|
|
294
319
|
})]
|
|
295
320
|
})
|
|
296
|
-
}),
|
|
321
|
+
}), B.fields.filter((e) => e !== B.labelField).map((t) => /* @__PURE__ */ S("td", {
|
|
297
322
|
className: "px-3 py-2 text-muted-foreground",
|
|
298
|
-
children:
|
|
323
|
+
children: k(e.record[t], Y(t, e.record))
|
|
299
324
|
}, t))]
|
|
300
325
|
}, e.id);
|
|
301
326
|
}) })]
|
|
302
327
|
}),
|
|
303
|
-
|
|
328
|
+
y && /* @__PURE__ */ S(p, { result: y })
|
|
304
329
|
]
|
|
305
330
|
});
|
|
306
|
-
if (
|
|
331
|
+
if (X.isOverlay && X.mode === "split" && X.isOpen && X.selectedRecord) {
|
|
307
332
|
let e = Q($);
|
|
308
|
-
if (e) return /* @__PURE__ */ x
|
|
333
|
+
if (e) return /* @__PURE__ */ S(x, { children: e });
|
|
309
334
|
}
|
|
310
|
-
return /* @__PURE__ */
|
|
311
|
-
},
|
|
312
|
-
let { dataSource: n } =
|
|
313
|
-
return /* @__PURE__ */
|
|
335
|
+
return /* @__PURE__ */ C(x, { children: [$, Q()] });
|
|
336
|
+
}, M = ({ schema: e, ...t }) => {
|
|
337
|
+
let { dataSource: n } = h() || {};
|
|
338
|
+
return /* @__PURE__ */ S(j, {
|
|
314
339
|
schema: e,
|
|
315
340
|
dataSource: n,
|
|
316
341
|
...t
|
|
317
342
|
});
|
|
318
343
|
};
|
|
319
|
-
r.register("object-tree",
|
|
344
|
+
r.register("object-tree", M, {
|
|
320
345
|
namespace: "plugin-tree",
|
|
321
346
|
label: "Object Tree",
|
|
322
347
|
category: "view",
|
|
@@ -354,4 +379,4 @@ r.register("object-tree", k, {
|
|
|
354
379
|
]
|
|
355
380
|
});
|
|
356
381
|
//#endregion
|
|
357
|
-
export {
|
|
382
|
+
export { j as ObjectTree, M as ObjectTreeRenderer };
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("@object-ui/plugin-detail"),require("@object-ui/i18n"),require("@object-ui/permissions"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`@object-ui/plugin-detail`,`@object-ui/i18n`,`@object-ui/permissions`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginTree={},e.React,e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e._object_ui_plugin_detail,e.ObjectUII18n,e._object_ui_permissions,e.LucideReact,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=Object.create,d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=p(t),a=0,o=i.length,s;a<o;a++)s=i[a],!h.call(e,s)&&s!==n&&d(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=f(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:u(m(e)),g(t||!e||!e.__esModule||!h.call(e,`default`)?d(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var _=(0,o.createSafeTranslation)({"detail.recordDetail":`Record Detail`,"grid.refreshing":`Refreshing…`},`detail.recordDetail`),ee=[];function v(e){return(0,n.columnIdentity)(e)||(e&&typeof e==`object`?e.key:void 0)||void 0}function y(e){let t=e.tree||{},n=Array.isArray(e.fields)?e.fields:Array.isArray(t.fields)?t.fields:[];return{parentField:v(e.parentField??t.parentField),labelField:v(e.labelField??t.labelField)??`name`,fields:n.map(v).filter(e=>!!e),defaultExpandedDepth:e.defaultExpandedDepth??t.defaultExpandedDepth}}function b(e,t){let n=e?.fields;if(!n||typeof n!=`object`)return;let r;for(let[e,i]of Object.entries(n)){let n=i?.reference;if(i?.type===`tree`&&(n===void 0||t&&n===t))return e;!r&&(i?.type===`lookup`||i?.type===`master_detail`)&&n&&t&&n===t&&(r=e)}return r}function x(e){let t=e?.id??e?._id;return t==null?void 0:String(t)}function S(e,t){if(!t)return;let n=e?.[t];if(n!=null){if(typeof n==`object`){let e=n.id??n._id;return e==null?void 0:String(e)}return String(n)}}function C(e,t){let n=new Map,r=[];for(let t of e){let e=x(t);e!=null&&(n.set(e,{id:e,record:t,depth:0,children:[]}),r.push(e))}let i=[];for(let e of r){let r=n.get(e),a=S(r.record,t),o=a==null?void 0:n.get(a);o&&o!==r?o.children.push(r):i.push(r)}let a=(e,t)=>{for(let n of e)n.depth=t,a(n.children,t+1)};return a(i,0),i}function w(e,t){let n=[],r=e=>{for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)};return r(e),n}function T(e,t){let n=new Set,r=e=>{for(let i of e)i.children.length!==0&&(t==null||i.depth<t)&&(n.add(i.id),r(i.children))};return r(e),n}function E(e,t,n){let r=T(e,t);if(n.size===0)return r;let i=e=>{for(let t of e){let e=n.get(t.id);e===!0?r.add(t.id):e===!1&&r.delete(t.id),i(t.children)}};return i(e),r}function D(e,t){if(e==null)return``;let r=Array.isArray(t?.fieldDef?.options)?t.fieldDef.options:null;if(r&&r.length>0){let i=t.objectName?t.translateOptions(t.objectName,t.fieldName,r):r,a=e=>{let t=i.find(t=>t?.value===e);if(t)return String(t.label??e);let r=String(e).toLowerCase(),a=i.find(e=>String(e?.value).toLowerCase()===r);return a?String(a.label??e):(0,n.humanizeLabel)(String(e))};return Array.isArray(e)?e.filter(e=>e!=null).map(a).join(`, `):a(e)}return typeof e==`object`&&(0,n.isExpandableFieldType)(t?.fieldDef)?(0,n.getRecordDisplayName)(void 0,e):String(typeof e==`object`?e.name??e.label??e.id??e._id??``:e)}var O=({schema:e,dataSource:o,className:u,onRowClick:d,...f})=>{let[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),[v,x]=(0,t.useState)(!0),[S,T]=(0,t.useState)(null),O=(0,t.useMemo)(()=>(0,n.resolveRecordSourceConfig)(e,`view-data`),[e]),k=(0,n.resolveRecordSourceObjectName)(e,O)??``,{ready:A,def:j}=(0,r.useSettledSchema)(k,o),M=O?.provider,N=O?.provider===`object`?O.object:void 0,P=O?.provider===`value`?O.items:void 0,F=(0,s.usePermissions)(),te=(0,r.useFilterScope)(),I=(0,r.useResolvedFilter)(e.filter,te),L=(0,r.useDataInvalidation)(o?N:void 0);(0,t.useEffect)(()=>{let e=!1;return(async()=>{try{if(x(!0),T(null),M===`object`&&o&&typeof o.find==`function`){if(!A)return;let t=(0,n.buildExpandFields)(j?.fields),r=F?.isLoaded?t.filter(e=>F.checkField(N,e,`read`)):t,i=await o.find(N,{$filter:I,...(0,n.nonGridRowCeilingQuery)(),...r.length>0?{$expand:r}:{}}),a=(0,n.applyNonGridRowCeiling)(i);e||(m({provider:M,object:N,rows:a.rows}),g(a),x(!1));return}let t=f.data;if(Array.isArray(t)){e||(m({provider:M,object:N,rows:t}),g(null),x(!1));return}if(M===`value`){let t=await new n.ValueDataSource({items:P??[]}).find(``,{$filter:I,...(0,n.nonGridRowCeilingQuery)()}),r=(0,n.applyNonGridRowCeiling)(t);e||(m({provider:M,object:N,rows:r.rows}),g(r),x(!1));return}e||(m({provider:M,object:N,rows:[]}),x(!1))}catch(t){e||(T(t),x(!1))}})(),()=>{e=!0}},[M,N,P,o,I,j,A,f.data,F,L]);let R=(0,t.useMemo)(()=>y(e),[e]),z=(0,t.useMemo)(()=>R.parentField??b(j,e.objectName),[R.parentField,j,e.objectName]),B=p&&p.provider===M&&p.object===N?p.rows:null,V=(0,t.useMemo)(()=>C(B??ee,z),[B,z]),[H,ne]=(0,t.useState)(()=>new Map),U=(0,t.useMemo)(()=>E(V,R.defaultExpandedDepth,H),[V,R.defaultExpandedDepth,H]),W=(e,t)=>ne(n=>{let r=new Map(n);return r.set(e,!t),r}),G=(0,t.useMemo)(()=>w(V,U),[V,U]),K=(0,r.useSafeFieldLabel)(),q=(0,n.resolveRecordSourceObjectName)(e,O)??e.objectName,J=e=>{let t=j?.fields?.[e]?.label||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return q?K.fieldLabel(q,e,t):t},Y=e=>({fieldDef:j?.fields?.[e],fieldName:e,objectName:q,translateOptions:K.translateOptions}),X=(0,r.useNavigationOverlay)({navigation:e.navigation,objectName:(0,n.resolveRecordSourceObjectName)(e,O)??e.objectName,onRowClick:d}),{anchorRef:re,captureAnchor:ie}=(0,i.useOverlayAnchor)(),{t:Z}=_();if(S)return(0,l.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-destructive`,u),children:(0,l.jsxs)(`p`,{children:[`Failed to load tree: `,S.message]})});if(B===null||v&&B.length===0)return(0,l.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-muted-foreground`,u),children:(0,l.jsx)(`p`,{children:`Loading…`})});if(B.length===0)return(0,l.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-muted-foreground`,u),children:(0,l.jsx)(`p`,{children:`No records`})});let Q=t=>{if(!X.isOverlay)return null;let r=(0,n.resolveRecordSourceObjectName)(e,O)??e.objectName;return(0,l.jsx)(i.NavigationOverlay,{...X,title:Z(`detail.recordDetail`),mainContent:t,popoverAnchorRef:re,storageKey:r?(0,i.recordOverlayWidthStorageKey)(r):void 0,legacyStorageKey:r?(0,i.legacyRecordDrawerWidthKey)(r):void 0,width:X.width??a.RECORD_OVERLAY_DEFAULT_WIDTH,children:e=>{let t=e,n=t.id??t._id,i=!!j?.fields&&Object.keys(j.fields).length>0;return!r||n==null||!i?(0,l.jsx)(`div`,{className:`space-y-3 p-4`,children:Object.entries(t).map(([e,t])=>(0,l.jsxs)(`div`,{className:`flex flex-col`,children:[(0,l.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,l.jsx)(`span`,{className:`text-sm`,children:D(t,Y(e))||`—`})]},e))}):(0,l.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,l.jsx)(a.RecordDetailPanel,{record:t,objectName:r,recordId:n,dataSource:o,objectSchema:j,onClose:X.close})})}})},$=(0,l.jsxs)(`div`,{className:(0,i.cn)(`w-full overflow-auto`,u),"data-testid":`object-tree`,children:[(0,l.jsx)(i.RefreshIndicator,{active:v&&B.length>0,ariaLabel:Z(`grid.refreshing`),className:`sticky -mb-0.5`}),(0,l.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,l.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(R.labelField)}),R.fields.filter(e=>e!==R.labelField).map(e=>(0,l.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(e)},e))]})}),(0,l.jsx)(`tbody`,{children:G.map(e=>{let t=e.children.length>0,n=U.has(e.id);return(0,l.jsxs)(`tr`,{className:`border-b hover:bg-accent/50 cursor-pointer`,"data-testid":`object-tree-row`,"data-depth":e.depth,onClick:t=>{ie(t),X.handleClick(e.record,t)},children:[(0,l.jsx)(`td`,{className:`px-3 py-2`,children:(0,l.jsxs)(`div`,{className:`flex items-center gap-1`,style:{paddingLeft:`${e.depth*20}px`},children:[t?(0,l.jsx)(`button`,{type:`button`,"aria-label":n?`Collapse`:`Expand`,className:`flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted`,onClick:t=>{t.stopPropagation(),W(e.id,n)},children:n?(0,l.jsx)(c.ChevronDown,{className:`h-4 w-4`}):(0,l.jsx)(c.ChevronRight,{className:`h-4 w-4`})}):(0,l.jsx)(`span`,{className:`inline-block h-5 w-5`}),(0,l.jsx)(`span`,{className:`truncate`,children:D(e.record[R.labelField],Y(R.labelField))||`—`})]})}),R.fields.filter(e=>e!==R.labelField).map(t=>(0,l.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:D(e.record[t],Y(t))},t))]},e.id)})})]}),h&&(0,l.jsx)(r.NonGridRowCeilingNote,{result:h})]});if(X.isOverlay&&X.mode===`split`&&X.isOpen&&X.selectedRecord){let e=Q($);if(e)return(0,l.jsx)(l.Fragment,{children:e})}return(0,l.jsxs)(l.Fragment,{children:[$,Q()]})},k=({schema:e,...t})=>{let{dataSource:n}=(0,r.useSchemaContext)()||{};return(0,l.jsx)(O,{schema:e,dataSource:n,...t})};n.ComponentRegistry.register(`object-tree`,k,{namespace:`plugin-tree`,label:`Object Tree`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`, read in that order: a tree on `data` or `staticData` never queries this object. On a tree whose rows are inline it still names the record page a new-tab click opens."},{name:`tree`,type:`object`,description:"The field configuration: `parentField` names the field holding each record’s parent id (auto-detected from the object’s self-referencing field when omitted), `labelField` the field drawn indented in the first column (default `name`), `fields` the further fields drawn as flat columns after it, and `defaultExpandedDepth` how many levels open on first draw (`0` shows roots only; omitted, every level is open)."},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a tree carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` draws those records and `{ provider: 'object', object }` queries that object, both narrowed by `filter`. The `api` and `schema` providers draw no rows on the tree. A bare array is not this key’s shape and is not a record source: the tree falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a tree carrying both draws these rows and never queries that object. Each record is placed under the record its `parentField` value names, and one naming no record is drawn as a root. `filter` narrows these rows exactly as it does fetched ones."},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the tree draws — fetched rows and inline (`staticData`, `{ provider: 'value' }`) rows alike. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. A record whose parent the filter removed is drawn as a root. The MongoDB-style record form is not this key’s shape."},{name:`navigation`,type:`object`,description:"What a row click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the row’s record in that overlay, and `split` opens it beside the tree; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of `data.object` when `data` is the object provider, else of the tree’s `objectName`, through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a tree that names neither (inline rows with no `objectName`), there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]}),e.ObjectTree=O,e.ObjectTreeRenderer=k});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("@object-ui/plugin-detail"),require("@object-ui/i18n"),require("@object-ui/fields"),require("@object-ui/permissions"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`@object-ui/plugin-detail`,`@object-ui/i18n`,`@object-ui/fields`,`@object-ui/permissions`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginTree={},e.React,e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e._object_ui_plugin_detail,e.ObjectUII18n,e._object_ui_fields,e._object_ui_permissions,e.LucideReact,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a,o,s,c,l,u){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:d(h(e)),_(t||!e||!e.__esModule||!g.call(e,`default`)?f(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var v=(0,o.createSafeTranslation)({"detail.recordDetail":`Record Detail`,"grid.refreshing":`Refreshing…`},`detail.recordDetail`),y=[];function b(e){return(0,n.columnIdentity)(e)||(e&&typeof e==`object`?e.key:void 0)||void 0}function ee(e){let t=e.tree||{},n=Array.isArray(e.fields)?e.fields:Array.isArray(t.fields)?t.fields:[];return{parentField:b(e.parentField??t.parentField),labelField:b(e.labelField??t.labelField)??`name`,fields:n.map(b).filter(e=>!!e),defaultExpandedDepth:e.defaultExpandedDepth??t.defaultExpandedDepth}}function te(e,t){let n=e?.fields;if(!n||typeof n!=`object`)return;let r;for(let[e,i]of Object.entries(n)){let n=i?.reference;if(i?.type===`tree`&&(n===void 0||t&&n===t))return e;!r&&(i?.type===`lookup`||i?.type===`master_detail`)&&n&&t&&n===t&&(r=e)}return r}function x(e){let t=e?.id??e?._id;return t==null?void 0:String(t)}function S(e,t){if(!t)return;let n=e?.[t];if(n!=null){if(typeof n==`object`){let e=n.id??n._id;return e==null?void 0:String(e)}return String(n)}}function C(e,t){let n=new Map,r=[];for(let t of e){let e=x(t);e!=null&&(n.set(e,{id:e,record:t,depth:0,children:[]}),r.push(e))}let i=[];for(let e of r){let r=n.get(e),a=S(r.record,t),o=a==null?void 0:n.get(a);o&&o!==r?o.children.push(r):i.push(r)}let a=(e,t)=>{for(let n of e)n.depth=t,a(n.children,t+1)};return a(i,0),i}function ne(e,t){let n=[],r=e=>{for(let i of e)n.push(i),i.children.length>0&&t.has(i.id)&&r(i.children)};return r(e),n}function w(e,t){let n=new Set,r=e=>{for(let i of e)i.children.length!==0&&(t==null||i.depth<t)&&(n.add(i.id),r(i.children))};return r(e),n}function re(e,t,n){let r=w(e,t);if(n.size===0)return r;let i=e=>{for(let t of e){let e=n.get(t.id);e===!0?r.add(t.id):e===!1&&r.delete(t.id),i(t.children)}};return i(e),r}function T(e,t,n=``){let r=t.fieldDef,i=typeof r?.type==`string`?r.type:``;if(!i)return E(e,t)||n;let a=(0,s.resolveCellRendererType)({type:i,format:r.format}),o=(0,s.getCellRenderer)(a),c=Array.isArray(r.options)?t.objectName?t.translateOptions(t.objectName,t.fieldName,r.options):r.options:void 0,l={...r,name:t.fieldName,type:a,label:t.columnLabel,...c?{options:c}:{}};return(0,u.jsx)(o,{value:e,field:l,deadlineSettled:t.deadlineSettled})}function E(e,t){if(e==null)return``;let r=Array.isArray(t?.fieldDef?.options)?t.fieldDef.options:null;if(r&&r.length>0){let i=t.objectName?t.translateOptions(t.objectName,t.fieldName,r):r,a=e=>{let t=i.find(t=>t?.value===e);if(t)return String(t.label??e);let r=String(e).toLowerCase(),a=i.find(e=>String(e?.value).toLowerCase()===r);return a?String(a.label??e):(0,n.humanizeLabel)(String(e))};return Array.isArray(e)?e.filter(e=>e!=null).map(a).join(`, `):a(e)}return typeof e==`object`&&(0,n.isExpandableFieldType)(t?.fieldDef)?(0,n.getRecordDisplayName)(void 0,e):String(typeof e==`object`?e.name??e.label??e.id??e._id??``:e)}var D=({schema:e,dataSource:o,className:s,onRowClick:d,...f})=>{let[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),[_,b]=(0,t.useState)(!0),[x,S]=(0,t.useState)(null),w=(0,t.useMemo)(()=>(0,n.resolveRecordSourceConfig)(e,`view-data`),[e]),D=(0,n.resolveRecordSourceObjectName)(e,w)??``,{ready:O,def:k}=(0,r.useSettledSchema)(D,o),A=w?.provider,j=w?.provider===`object`?w.object:void 0,M=w?.provider===`value`?w.items:void 0,N=(0,c.usePermissions)(),P=(0,r.useFilterScope)(),F=(0,r.useResolvedFilter)(e.filter,P),I=(0,r.useDataInvalidation)(o?j:void 0);(0,t.useEffect)(()=>{let e=!1;return(async()=>{try{if(b(!0),S(null),A===`object`&&o&&typeof o.find==`function`){if(!O)return;let t=(0,n.buildExpandFields)(k?.fields),r=N?.isLoaded?t.filter(e=>N.checkField(j,e,`read`)):t,i=await o.find(j,{$filter:F,...(0,n.nonGridRowCeilingQuery)(),...r.length>0?{$expand:r}:{}}),a=(0,n.applyNonGridRowCeiling)(i);e||(m({provider:A,object:j,rows:a.rows}),g(a),b(!1));return}let t=f.data;if(Array.isArray(t)){e||(m({provider:A,object:j,rows:t}),g(null),b(!1));return}if(A===`value`){let t=await new n.ValueDataSource({items:M??[]}).find(``,{$filter:F,...(0,n.nonGridRowCeilingQuery)()}),r=(0,n.applyNonGridRowCeiling)(t);e||(m({provider:A,object:j,rows:r.rows}),g(r),b(!1));return}e||(m({provider:A,object:j,rows:[]}),b(!1))}catch(t){e||(S(t),b(!1))}})(),()=>{e=!0}},[A,j,M,o,F,k,O,f.data,N,I]);let L=(0,t.useMemo)(()=>ee(e),[e]),R=(0,t.useMemo)(()=>L.parentField??te(k,e.objectName),[L.parentField,k,e.objectName]),z=p&&p.provider===A&&p.object===j?p.rows:null,B=(0,t.useMemo)(()=>C(z??y,R),[z,R]),[V,ie]=(0,t.useState)(()=>new Map),H=(0,t.useMemo)(()=>re(B,L.defaultExpandedDepth,V),[B,L.defaultExpandedDepth,V]),U=(e,t)=>ie(n=>{let r=new Map(n);return r.set(e,!t),r}),W=(0,t.useMemo)(()=>ne(B,H),[B,H]),G=(0,r.useSafeFieldLabel)(),K=(0,r.usePredicateScope)(),q=(0,n.resolveRecordSourceObjectName)(e,w)??e.objectName,J=e=>{let t=k?.fields?.[e]?.label||e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase());return q?G.fieldLabel(q,e,t):t},Y=(e,t)=>({fieldDef:k?.fields?.[e],fieldName:e,columnLabel:J(e),objectName:q,translateOptions:G.translateOptions,deadlineSettled:(0,n.isDeadlineSettled)(k?.fields?.[e],t,{scope:K,fields:k?.fields})}),X=(0,r.useNavigationOverlay)({navigation:e.navigation,objectName:(0,n.resolveRecordSourceObjectName)(e,w)??e.objectName,onRowClick:d}),{anchorRef:ae,captureAnchor:oe}=(0,i.useOverlayAnchor)(),{t:Z}=v();if(x)return(0,u.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-destructive`,s),children:(0,u.jsxs)(`p`,{children:[`Failed to load tree: `,x.message]})});if(z===null||_&&z.length===0)return(0,u.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-muted-foreground`,s),children:(0,u.jsx)(`p`,{children:`Loading…`})});if(z.length===0)return(0,u.jsx)(`div`,{className:(0,i.cn)(`flex items-center justify-center h-40 text-muted-foreground`,s),children:(0,u.jsx)(`p`,{children:`No records`})});let Q=t=>{if(!X.isOverlay)return null;let r=(0,n.resolveRecordSourceObjectName)(e,w)??e.objectName;return(0,u.jsx)(i.NavigationOverlay,{...X,title:Z(`detail.recordDetail`),mainContent:t,popoverAnchorRef:ae,storageKey:r?(0,i.recordOverlayWidthStorageKey)(r):void 0,legacyStorageKey:r?(0,i.legacyRecordDrawerWidthKey)(r):void 0,width:X.width??a.RECORD_OVERLAY_DEFAULT_WIDTH,children:e=>{let t=e,n=t.id??t._id,i=!!k?.fields&&Object.keys(k.fields).length>0;return!r||n==null||!i?(0,u.jsx)(`div`,{className:`space-y-3 p-4`,children:Object.entries(t).map(([e,t])=>(0,u.jsxs)(`div`,{className:`flex flex-col`,children:[(0,u.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,u.jsx)(`span`,{className:`text-sm`,children:E(t,Y(e))||`—`})]},e))}):(0,u.jsx)(`div`,{className:`px-6 pt-6 pb-6`,children:(0,u.jsx)(a.RecordDetailPanel,{record:t,objectName:r,recordId:n,dataSource:o,objectSchema:k,onClose:X.close})})}})},$=(0,u.jsxs)(`div`,{className:(0,i.cn)(`w-full overflow-auto`,s),"data-testid":`object-tree`,children:[(0,u.jsx)(i.RefreshIndicator,{active:_&&z.length>0,ariaLabel:Z(`grid.refreshing`),className:`sticky -mb-0.5`}),(0,u.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{className:`border-b text-left text-muted-foreground`,children:[(0,u.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(L.labelField)}),L.fields.filter(e=>e!==L.labelField).map(e=>(0,u.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:J(e)},e))]})}),(0,u.jsx)(`tbody`,{children:W.map(e=>{let t=e.children.length>0,n=H.has(e.id);return(0,u.jsxs)(`tr`,{className:`border-b hover:bg-accent/50 cursor-pointer`,"data-testid":`object-tree-row`,"data-depth":e.depth,onClick:t=>{oe(t),X.handleClick(e.record,t)},children:[(0,u.jsx)(`td`,{className:`px-3 py-2`,children:(0,u.jsxs)(`div`,{className:`flex items-center gap-1`,style:{paddingLeft:`${e.depth*20}px`},children:[t?(0,u.jsx)(`button`,{type:`button`,"aria-label":n?`Collapse`:`Expand`,className:`flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted`,onClick:t=>{t.stopPropagation(),U(e.id,n)},children:n?(0,u.jsx)(l.ChevronDown,{className:`h-4 w-4`}):(0,u.jsx)(l.ChevronRight,{className:`h-4 w-4`})}):(0,u.jsx)(`span`,{className:`inline-block h-5 w-5`}),(0,u.jsx)(`span`,{className:`truncate`,children:T(e.record[L.labelField],Y(L.labelField,e.record),`—`)})]})}),L.fields.filter(e=>e!==L.labelField).map(t=>(0,u.jsx)(`td`,{className:`px-3 py-2 text-muted-foreground`,children:T(e.record[t],Y(t,e.record))},t))]},e.id)})})]}),h&&(0,u.jsx)(r.NonGridRowCeilingNote,{result:h})]});if(X.isOverlay&&X.mode===`split`&&X.isOpen&&X.selectedRecord){let e=Q($);if(e)return(0,u.jsx)(u.Fragment,{children:e})}return(0,u.jsxs)(u.Fragment,{children:[$,Q()]})},O=({schema:e,...t})=>{let{dataSource:n}=(0,r.useSchemaContext)()||{};return(0,u.jsx)(D,{schema:e,dataSource:n,...t})};n.ComponentRegistry.register(`object-tree`,O,{namespace:`plugin-tree`,label:`Object Tree`,category:`view`,inputs:[{name:`objectName`,type:`string`,description:"ObjectQL object name. The record source is one of `data`, `staticData` and `objectName`, read in that order: a tree on `data` or `staticData` never queries this object. On a tree whose rows are inline it still names the record page a new-tab click opens."},{name:`tree`,type:`object`,description:"The field configuration: `parentField` names the field holding each record’s parent id (auto-detected from the object’s self-referencing field when omitted), `labelField` the field drawn indented in the first column (default `name`), `fields` the further fields drawn as flat columns after it, and `defaultExpandedDepth` how many levels open on first draw (`0` shows roots only; omitted, every level is open)."},{name:`data`,type:`object`,description:"A `{ provider, … }` data-source configuration, read FIRST on the record-source ladder: a tree carrying one never reaches `staticData` and never queries `objectName`. `{ provider: 'value', items }` draws those records and `{ provider: 'object', object }` queries that object, both narrowed by `filter`. The `api` and `schema` providers draw no rows on the tree. A bare array is not this key’s shape and is not a record source: the tree falls through to `staticData`, then `objectName`, so inline rows belong under `staticData`."},{name:`staticData`,type:`array`,description:"Inline records, read SECOND on the record-source ladder: a `data` configuration wins and this key is then never reached, while `objectName` is read AFTER it, so a tree carrying both draws these rows and never queries that object. Each record is placed under the record its `parentField` value names, and one naming no record is drawn as a root. `filter` narrows these rows exactly as it does fetched ones."},{name:`filter`,type:`array`,description:"Base query filter in the rule-array form `[{ field, operator, value }, ...]`, narrowing the records the tree draws — fetched rows and inline (`staticData`, `{ provider: 'value' }`) rows alike. Context tokens such as `{current_user_id}` are resolved first, then the filter is lowered to `$filter` on the query. A record whose parent the filter removed is drawn as a root. The MongoDB-style record form is not this key’s shape."},{name:`navigation`,type:`object`,description:"What a row click opens — the `{ mode, size, openNewTab, preventNavigation }` block a list view declares. With the key ABSENT a click opens nothing: this renderer supplies no drawer default. `mode` is an overlay (`drawer`, `modal`, `split`, `popover`), `new_window`, `page` or `none`, and a block written without `mode` takes the spec’s `page` default. `drawer`, `modal` and `popover` open the row’s record in that overlay, and `split` opens it beside the tree; `new_window` opens the record page in a new tab; `none` opens nothing. `page` opens the record page of `data.object` when `data` is the object provider, else of the tree’s `objectName`, through the record navigator the host publishes (the console publishes one on its custom pages, record pages and list views); under a host that publishes none, such as an embedded renderer, or on a tree that names neither (inline rows with no `objectName`), there is no record page to open and the click opens nothing. `preventNavigation: true` opens nothing whatever the mode, `openNewTab: true` opens the record page in a new tab and outranks every mode except `none`, and `size` sets the overlay width. A click handler from a parent view outranks the whole key."}]}),e.ObjectTree=D,e.ObjectTreeRenderer=O});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-tree",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Tree / tree-grid visualization plugin for Object UI",
|
|
@@ -24,15 +24,16 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@objectstack/spec": "^
|
|
27
|
+
"@objectstack/spec": "^18.0.0",
|
|
28
28
|
"lucide-react": "^1.43.0",
|
|
29
|
-
"@object-ui/
|
|
30
|
-
"@object-ui/
|
|
31
|
-
"@object-ui/
|
|
32
|
-
"@object-ui/i18n": "
|
|
33
|
-
"@object-ui/
|
|
34
|
-
"@object-ui/
|
|
35
|
-
"@object-ui/
|
|
29
|
+
"@object-ui/core": "18.0.0",
|
|
30
|
+
"@object-ui/components": "18.0.0",
|
|
31
|
+
"@object-ui/fields": "18.0.0",
|
|
32
|
+
"@object-ui/i18n": "18.0.0",
|
|
33
|
+
"@object-ui/permissions": "18.0.0",
|
|
34
|
+
"@object-ui/plugin-detail": "18.0.0",
|
|
35
|
+
"@object-ui/react": "18.0.0",
|
|
36
|
+
"@object-ui/types": "18.0.0"
|
|
36
37
|
},
|
|
37
38
|
"peerDependencies": {
|
|
38
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"typescript": "^6.0.3",
|
|
46
47
|
"vite": "^8.2.1",
|
|
47
48
|
"vite-plugin-dts": "^5.0.3",
|
|
48
|
-
"@object-ui/sdui-parser": "
|
|
49
|
+
"@object-ui/sdui-parser": "18.0.0",
|
|
49
50
|
"@object-ui/test-support": "17.4.0"
|
|
50
51
|
},
|
|
51
52
|
"keywords": [
|