@box/combobox-with-api 1.42.33 → 1.42.35
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/chunks/combobox-with-api-error.js +18 -0
- package/dist/chunks/combobox-with-api-pagination.js +168 -0
- package/dist/chunks/combobox-with-api-pagination2.js +229 -0
- package/dist/chunks/combobox-with-api-tree-view.js +423 -0
- package/dist/chunks/dynamic-loading-tree.js +299 -326
- package/dist/chunks/treeReducer.js +60 -78
- package/dist/esm/index.js +6 -16
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-container.js +47 -52
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-error.js +2 -26
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api.js +16 -36
- package/dist/esm/lib/components/combobox-with-api/messages.js +6 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +2 -214
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +3 -205
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +31 -33
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +4 -6
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +113 -128
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +8 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +32 -34
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +72 -82
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +133 -174
- package/dist/esm/lib/components/combobox-with-api-tree-view/dynamic-loading-tree.js +2 -10
- package/dist/esm/lib/components/combobox-with-api-tree-view/index.js +3 -464
- package/dist/esm/lib/components/combobox-with-api-tree-view/tree-utils.js +17 -26
- package/dist/esm/lib/components/combobox-with-api-tree-view/treeReducer.js +2 -6
- package/dist/styles/combobox-with-api-error.css +1 -1
- package/dist/styles/combobox-with-api-pagination.css +1 -1
- package/dist/styles/dynamic-loading-tree.css +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
var e = [
|
|
2
|
+
{
|
|
3
|
+
id: "japan-l1-id",
|
|
4
|
+
ancestors: [],
|
|
5
|
+
displayName: "Japan",
|
|
6
|
+
level: 1,
|
|
7
|
+
selectable: !0
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "uk-l1-id",
|
|
11
|
+
ancestors: [],
|
|
12
|
+
displayName: "United Kingdom",
|
|
13
|
+
level: 1,
|
|
14
|
+
selectable: !0
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "usa-l1-id",
|
|
18
|
+
ancestors: [],
|
|
19
|
+
displayName: "United States",
|
|
20
|
+
level: 1,
|
|
21
|
+
selectable: !0
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "poland-l1-id",
|
|
25
|
+
ancestors: [],
|
|
26
|
+
displayName: "Poland",
|
|
27
|
+
level: 1,
|
|
28
|
+
selectable: !0
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "australia-l1-id",
|
|
32
|
+
ancestors: [],
|
|
33
|
+
displayName: "Australia",
|
|
34
|
+
level: 1,
|
|
35
|
+
selectable: !0
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "spain-l1-id",
|
|
39
|
+
ancestors: [],
|
|
40
|
+
displayName: "Spain",
|
|
41
|
+
level: 1,
|
|
42
|
+
selectable: !0
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "austin-l3-id",
|
|
46
|
+
ancestors: [{
|
|
47
|
+
id: "usa-l1-id",
|
|
48
|
+
displayName: "United States",
|
|
49
|
+
level: 1
|
|
50
|
+
}, {
|
|
51
|
+
id: "texas-l2-id",
|
|
52
|
+
displayName: "Texas",
|
|
53
|
+
level: 2
|
|
54
|
+
}],
|
|
55
|
+
displayName: "Austin",
|
|
56
|
+
level: 3,
|
|
57
|
+
selectable: !0
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "california-l2-id",
|
|
61
|
+
ancestors: [{
|
|
62
|
+
id: "usa-l1-id",
|
|
63
|
+
displayName: "United States",
|
|
64
|
+
level: 1
|
|
65
|
+
}],
|
|
66
|
+
displayName: "California",
|
|
67
|
+
level: 2,
|
|
68
|
+
selectable: !0
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "chicago-l3-id",
|
|
72
|
+
ancestors: [{
|
|
73
|
+
id: "usa-l1-id",
|
|
74
|
+
displayName: "United States",
|
|
75
|
+
level: 1
|
|
76
|
+
}, {
|
|
77
|
+
id: "illinois-l2-id",
|
|
78
|
+
displayName: "Illinois",
|
|
79
|
+
level: 2
|
|
80
|
+
}],
|
|
81
|
+
displayName: "Chicago",
|
|
82
|
+
level: 3,
|
|
83
|
+
selectable: !0
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "illinois-l2-id",
|
|
87
|
+
ancestors: [{
|
|
88
|
+
id: "usa-l1-id",
|
|
89
|
+
displayName: "United States",
|
|
90
|
+
level: 1
|
|
91
|
+
}],
|
|
92
|
+
displayName: "Illinois",
|
|
93
|
+
level: 2,
|
|
94
|
+
selectable: !0
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "london-l3-id",
|
|
98
|
+
ancestors: [{
|
|
99
|
+
id: "uk-l1-id",
|
|
100
|
+
displayName: "United Kingdom",
|
|
101
|
+
level: 1
|
|
102
|
+
}, {
|
|
103
|
+
id: "england-l2-id",
|
|
104
|
+
displayName: "England",
|
|
105
|
+
level: 2
|
|
106
|
+
}],
|
|
107
|
+
displayName: "London",
|
|
108
|
+
level: 3,
|
|
109
|
+
selectable: !0
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "ny-l2-id",
|
|
113
|
+
ancestors: [{
|
|
114
|
+
id: "usa-l1-id",
|
|
115
|
+
displayName: "United States",
|
|
116
|
+
level: 1
|
|
117
|
+
}],
|
|
118
|
+
displayName: "New York",
|
|
119
|
+
level: 2,
|
|
120
|
+
selectable: !0
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "ny-l3-id",
|
|
124
|
+
ancestors: [{
|
|
125
|
+
id: "usa-l1-id",
|
|
126
|
+
displayName: "United States",
|
|
127
|
+
level: 1
|
|
128
|
+
}, {
|
|
129
|
+
id: "ny-l2-id",
|
|
130
|
+
displayName: "New York",
|
|
131
|
+
level: 2
|
|
132
|
+
}],
|
|
133
|
+
displayName: "New York",
|
|
134
|
+
level: 3,
|
|
135
|
+
selectable: !0
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "redwood-l3-id",
|
|
139
|
+
ancestors: [{
|
|
140
|
+
id: "usa-l1-id",
|
|
141
|
+
displayName: "United States",
|
|
142
|
+
level: 1
|
|
143
|
+
}, {
|
|
144
|
+
id: "california-l2-id",
|
|
145
|
+
displayName: "California",
|
|
146
|
+
level: 2
|
|
147
|
+
}],
|
|
148
|
+
displayName: "Redwood City",
|
|
149
|
+
level: 3,
|
|
150
|
+
selectable: !0
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: "sf-l3-id",
|
|
154
|
+
ancestors: [{
|
|
155
|
+
id: "usa-l1-id",
|
|
156
|
+
displayName: "United States",
|
|
157
|
+
level: 1
|
|
158
|
+
}, {
|
|
159
|
+
id: "california-l2-id",
|
|
160
|
+
displayName: "California",
|
|
161
|
+
level: 2
|
|
162
|
+
}],
|
|
163
|
+
displayName: "San Francisco",
|
|
164
|
+
level: 3,
|
|
165
|
+
selectable: !0
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "texas-l2-id",
|
|
169
|
+
ancestors: [{
|
|
170
|
+
id: "usa-l1-id",
|
|
171
|
+
displayName: "United States",
|
|
172
|
+
level: 1
|
|
173
|
+
}],
|
|
174
|
+
displayName: "Texas",
|
|
175
|
+
level: 2,
|
|
176
|
+
selectable: !0
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "tokyo-l2-id",
|
|
180
|
+
ancestors: [{
|
|
181
|
+
id: "japan-l1-id",
|
|
182
|
+
displayName: "Japan",
|
|
183
|
+
level: 1
|
|
184
|
+
}],
|
|
185
|
+
displayName: "Tokyo",
|
|
186
|
+
level: 2,
|
|
187
|
+
selectable: !0
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "tokyo-l3-id",
|
|
191
|
+
ancestors: [{
|
|
192
|
+
id: "japan-l1-id",
|
|
193
|
+
displayName: "Japan",
|
|
194
|
+
level: 1
|
|
195
|
+
}, {
|
|
196
|
+
id: "tokyo-l2-id",
|
|
197
|
+
displayName: "Tokyo",
|
|
198
|
+
level: 2
|
|
199
|
+
}],
|
|
200
|
+
displayName: "Tokyo",
|
|
201
|
+
level: 3,
|
|
202
|
+
selectable: !0
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "long-option-l3-id",
|
|
206
|
+
ancestors: [{
|
|
207
|
+
id: "long-option-l1-id",
|
|
208
|
+
displayName: "Long child node",
|
|
209
|
+
level: 1
|
|
210
|
+
}],
|
|
211
|
+
displayName: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
|
212
|
+
level: 2,
|
|
213
|
+
selectable: !0
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "hokkaido-l2-id",
|
|
217
|
+
ancestors: [{
|
|
218
|
+
id: "japan-l1-id",
|
|
219
|
+
displayName: "Japan",
|
|
220
|
+
level: 1
|
|
221
|
+
}],
|
|
222
|
+
displayName: "Hokkaido",
|
|
223
|
+
level: 2,
|
|
224
|
+
selectable: !0
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "iwate-l2-id",
|
|
228
|
+
ancestors: [{
|
|
229
|
+
id: "japan-l1-id",
|
|
230
|
+
displayName: "Japan",
|
|
231
|
+
level: 1
|
|
232
|
+
}],
|
|
233
|
+
displayName: "Iwate",
|
|
234
|
+
level: 2,
|
|
235
|
+
selectable: !0
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: "fukushima-l2-id",
|
|
239
|
+
ancestors: [{
|
|
240
|
+
id: "japan-l1-id",
|
|
241
|
+
displayName: "Japan",
|
|
242
|
+
level: 1
|
|
243
|
+
}],
|
|
244
|
+
displayName: "Fukushima",
|
|
245
|
+
level: 2,
|
|
246
|
+
selectable: !0
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: "nagano-l2-id",
|
|
250
|
+
ancestors: [{
|
|
251
|
+
id: "japan-l1-id",
|
|
252
|
+
displayName: "Japan",
|
|
253
|
+
level: 1
|
|
254
|
+
}],
|
|
255
|
+
displayName: "Nagano",
|
|
256
|
+
level: 2,
|
|
257
|
+
selectable: !0
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: "niigata-l2-id",
|
|
261
|
+
ancestors: [{
|
|
262
|
+
id: "japan-l1-id",
|
|
263
|
+
displayName: "Japan",
|
|
264
|
+
level: 1
|
|
265
|
+
}],
|
|
266
|
+
displayName: "Niigata",
|
|
267
|
+
level: 2,
|
|
268
|
+
selectable: !0
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: "akita-l2-id",
|
|
272
|
+
ancestors: [{
|
|
273
|
+
id: "japan-l1-id",
|
|
274
|
+
displayName: "Japan",
|
|
275
|
+
level: 1
|
|
276
|
+
}],
|
|
277
|
+
displayName: "Akita",
|
|
278
|
+
level: 2,
|
|
279
|
+
selectable: !0
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: "hiroshima-l2-id",
|
|
283
|
+
ancestors: [{
|
|
284
|
+
id: "japan-l1-id",
|
|
285
|
+
displayName: "Japan",
|
|
286
|
+
level: 1
|
|
287
|
+
}],
|
|
288
|
+
displayName: "Hiroshima",
|
|
289
|
+
level: 2,
|
|
290
|
+
selectable: !0
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: "kagoshima-l2-id",
|
|
294
|
+
ancestors: [{
|
|
295
|
+
id: "japan-l1-id",
|
|
296
|
+
displayName: "Japan",
|
|
297
|
+
level: 1
|
|
298
|
+
}],
|
|
299
|
+
displayName: "Kagoshima",
|
|
300
|
+
level: 2,
|
|
301
|
+
selectable: !0
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "aomori-l2-id",
|
|
305
|
+
ancestors: [{
|
|
306
|
+
id: "japan-l1-id",
|
|
307
|
+
displayName: "Japan",
|
|
308
|
+
level: 1
|
|
309
|
+
}],
|
|
310
|
+
displayName: "Aomori",
|
|
311
|
+
level: 2,
|
|
312
|
+
selectable: !0
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: "hyogo-l2-id",
|
|
316
|
+
ancestors: [{
|
|
317
|
+
id: "japan-l1-id",
|
|
318
|
+
displayName: "Japan",
|
|
319
|
+
level: 1
|
|
320
|
+
}],
|
|
321
|
+
displayName: "Hyogo",
|
|
322
|
+
level: 2,
|
|
323
|
+
selectable: !0
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "england-l2-id",
|
|
327
|
+
ancestors: [{
|
|
328
|
+
id: "uk-l1-id",
|
|
329
|
+
displayName: "United Kingdom",
|
|
330
|
+
level: 1
|
|
331
|
+
}],
|
|
332
|
+
displayName: "England",
|
|
333
|
+
level: 2,
|
|
334
|
+
selectable: !0
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
id: "scotland-l2-id",
|
|
338
|
+
ancestors: [{
|
|
339
|
+
id: "uk-l1-id",
|
|
340
|
+
displayName: "United Kingdom",
|
|
341
|
+
level: 1
|
|
342
|
+
}],
|
|
343
|
+
displayName: "Scotland",
|
|
344
|
+
level: 2,
|
|
345
|
+
selectable: !0
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "wales-l2-id",
|
|
349
|
+
ancestors: [{
|
|
350
|
+
id: "uk-l1-id",
|
|
351
|
+
displayName: "United Kingdom",
|
|
352
|
+
level: 1
|
|
353
|
+
}],
|
|
354
|
+
displayName: "Wales",
|
|
355
|
+
level: 2,
|
|
356
|
+
selectable: !0
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "northern-ireland-l2-id",
|
|
360
|
+
ancestors: [{
|
|
361
|
+
id: "uk-l1-id",
|
|
362
|
+
displayName: "United Kingdom",
|
|
363
|
+
level: 1
|
|
364
|
+
}],
|
|
365
|
+
displayName: "Northern Ireland",
|
|
366
|
+
level: 2,
|
|
367
|
+
selectable: !0
|
|
368
|
+
}
|
|
369
|
+
], t = 5, n = (e, n) => {
|
|
370
|
+
let r = parseInt(e, 10) || 0, i = r + t;
|
|
371
|
+
return n.slice(r, i).map(({ displayName: e, id: t, ...n }) => ({
|
|
372
|
+
displayValue: e,
|
|
373
|
+
value: t,
|
|
374
|
+
...n
|
|
375
|
+
}));
|
|
376
|
+
}, r = (e, n) => {
|
|
377
|
+
let r = (parseInt(e, 10) || 0) + t;
|
|
378
|
+
return r < n.length ? r.toString() : void 0;
|
|
379
|
+
}, i = (() => {
|
|
380
|
+
let t = 0, i = 0;
|
|
381
|
+
return async ({ delay: o, signal: s, level: c, searchInput: l, ancestorId: u, marker: d, failOnLoadMore: f, options: p = e, failOnLoadMoreTimes: m = 2 ** 53 - 1, failOnLoadLevel: h, failOnLoadLevelTimes: g = 2 ** 53 - 1 }) => {
|
|
382
|
+
if (s.aborted) return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
383
|
+
if (f && d != null && t < m) return t += 1, Promise.reject();
|
|
384
|
+
if (c === h && i < g) return i += 1, Promise.reject();
|
|
385
|
+
o && await new Promise((e) => setTimeout(e, o));
|
|
386
|
+
let _ = p.filter((e) => {
|
|
387
|
+
let { displayName: t, level: n, ancestors: r } = { ...e }, i = !0;
|
|
388
|
+
return c && n && n !== c && (i = !1), l && (i &&= t.toLowerCase().includes(l.toLowerCase())), u && (i &&= r?.some(({ id: e }) => e === u)), i;
|
|
389
|
+
});
|
|
390
|
+
return a(await Promise.resolve({
|
|
391
|
+
marker: r(d, _),
|
|
392
|
+
options: n(d, _)
|
|
393
|
+
}));
|
|
394
|
+
};
|
|
395
|
+
})();
|
|
396
|
+
function a(e) {
|
|
397
|
+
return {
|
|
398
|
+
marker: e.marker,
|
|
399
|
+
options: e.options.map(({ value: e, displayValue: t, ...n }) => t ? {
|
|
400
|
+
displayValue: t,
|
|
401
|
+
value: e,
|
|
402
|
+
...n
|
|
403
|
+
} : {
|
|
404
|
+
value: e,
|
|
405
|
+
...n
|
|
406
|
+
})
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
var o = (t) => {
|
|
410
|
+
let n = e.find((e) => e.displayName === t);
|
|
411
|
+
return n ? {
|
|
412
|
+
value: n.id,
|
|
413
|
+
displayValue: n.displayName,
|
|
414
|
+
level: n.level,
|
|
415
|
+
selectable: n.selectable,
|
|
416
|
+
ancestors: n.ancestors
|
|
417
|
+
} : null;
|
|
418
|
+
};
|
|
419
|
+
e.map((e) => ({
|
|
420
|
+
...e,
|
|
421
|
+
selectable: e.level === 2
|
|
422
|
+
}));
|
|
423
|
+
export { i as n, e as r, o as t };
|