@panneau/fields 5.0.0-alpha.21 → 5.0.0-alpha.22
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/relation/RelationField.css +106 -0
- package/dist/relation/RelationField.d.ts +10 -3
- package/dist/relation/RelationField.d.ts.map +1 -1
- package/dist/relation/RelationField.js +641 -379
- package/dist/relation/RelationField.js.map +1 -1
- package/dist/relation/RelationField.module.js +23 -1
- package/dist/relation/RelationField.module.js.map +1 -1
- package/dist/shared/relation.d.ts +32 -5
- package/dist/shared/relation.d.ts.map +1 -1
- package/dist/shared/relation.js +133 -54
- package/dist/shared/relation.js.map +1 -1
- package/package.json +4 -4
|
@@ -5,10 +5,11 @@ import { messages } from "../shared/messages.js";
|
|
|
5
5
|
import { toReferences, useRelationReferences } from "../shared/relation.js";
|
|
6
6
|
import RelationField_module_default from "./RelationField.module.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
|
-
import { ComboBox, Fieldset, IconButton, usePanneauIntl } from "@panneau/ui";
|
|
8
|
+
import { Button, ComboBox, Fieldset, Icon, IconButton, getNamedIcon, usePanneauIntl } from "@panneau/ui";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { X } from "lucide-react";
|
|
11
|
-
import { useEffect, useState } from "react";
|
|
10
|
+
import { File, ImageOff, X } from "lucide-react";
|
|
11
|
+
import { useEffect, useRef, useState } from "react";
|
|
12
|
+
import { Link } from "react-aria-components";
|
|
12
13
|
//#region src/relation/RelationField.tsx
|
|
13
14
|
/** The id of the "Create “…”" option of the picker. */
|
|
14
15
|
var CREATE_ID = "\0create";
|
|
@@ -100,6 +101,7 @@ function useRelationSearch(source, resource, query, t0) {
|
|
|
100
101
|
} else t8 = $[13];
|
|
101
102
|
return t8;
|
|
102
103
|
}
|
|
104
|
+
/** The items of a compact field, as chips. */
|
|
103
105
|
function References(t0) {
|
|
104
106
|
const $ = c(12);
|
|
105
107
|
const { references, onRemove, removeLabel } = t0;
|
|
@@ -149,80 +151,228 @@ function References(t0) {
|
|
|
149
151
|
} else t4 = $[11];
|
|
150
152
|
return t4;
|
|
151
153
|
}
|
|
154
|
+
/** The square before the label of a card or an option: the item's image, or the resource's icon. */
|
|
155
|
+
function Thumbnail(t0) {
|
|
156
|
+
const $ = c(8);
|
|
157
|
+
const { reference, info, className } = t0;
|
|
158
|
+
let t1;
|
|
159
|
+
if ($[0] !== className) {
|
|
160
|
+
t1 = cx(RelationField_module_default.thumbnail, className);
|
|
161
|
+
$[0] = className;
|
|
162
|
+
$[1] = t1;
|
|
163
|
+
} else t1 = $[1];
|
|
164
|
+
let t2;
|
|
165
|
+
if ($[2] !== info || $[3] !== reference.imageUrl) {
|
|
166
|
+
t2 = reference.imageUrl !== void 0 ? /* @__PURE__ */ jsx("img", {
|
|
167
|
+
src: reference.imageUrl,
|
|
168
|
+
alt: "",
|
|
169
|
+
loading: "lazy"
|
|
170
|
+
}) : /* @__PURE__ */ jsx(Icon, { icon: info?.image === true ? ImageOff : info?.icon !== void 0 ? getNamedIcon(info.icon) : File });
|
|
171
|
+
$[2] = info;
|
|
172
|
+
$[3] = reference.imageUrl;
|
|
173
|
+
$[4] = t2;
|
|
174
|
+
} else t2 = $[4];
|
|
175
|
+
let t3;
|
|
176
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
177
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: t1,
|
|
179
|
+
"aria-hidden": "true",
|
|
180
|
+
children: t2
|
|
181
|
+
});
|
|
182
|
+
$[5] = t1;
|
|
183
|
+
$[6] = t2;
|
|
184
|
+
$[7] = t3;
|
|
185
|
+
} else t3 = $[7];
|
|
186
|
+
return t3;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The chosen items, as cards (decision 0067): the image of each one, or its resource's icon, its
|
|
190
|
+
* label, linked to the item when the source says where it opens, its description, and the buttons
|
|
191
|
+
* that change or remove it.
|
|
192
|
+
*/
|
|
193
|
+
function RelationCards(t0) {
|
|
194
|
+
const $ = c(20);
|
|
195
|
+
const { references, info, getHref, onChange, onRemove, removeLabel, changeLabel, changeText, "aria-label": ariaLabel } = t0;
|
|
196
|
+
let t1;
|
|
197
|
+
if ($[0] !== changeLabel || $[1] !== changeText || $[2] !== getHref || $[3] !== info || $[4] !== onChange || $[5] !== onRemove || $[6] !== references || $[7] !== removeLabel) {
|
|
198
|
+
let t2;
|
|
199
|
+
if ($[9] !== changeLabel || $[10] !== changeText || $[11] !== getHref || $[12] !== info || $[13] !== onChange || $[14] !== onRemove || $[15] !== removeLabel) {
|
|
200
|
+
t2 = (reference) => {
|
|
201
|
+
const href = getHref(reference);
|
|
202
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
203
|
+
className: RelationField_module_default.card,
|
|
204
|
+
"data-relation-card": "",
|
|
205
|
+
children: [
|
|
206
|
+
/* @__PURE__ */ jsx(Thumbnail, {
|
|
207
|
+
reference,
|
|
208
|
+
info
|
|
209
|
+
}),
|
|
210
|
+
/* @__PURE__ */ jsxs("span", {
|
|
211
|
+
className: RelationField_module_default.cardText,
|
|
212
|
+
children: [href !== null ? /* @__PURE__ */ jsx(Link, {
|
|
213
|
+
href,
|
|
214
|
+
className: cx(RelationField_module_default.cardLabel, RelationField_module_default.link),
|
|
215
|
+
children: reference.label
|
|
216
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
217
|
+
className: RelationField_module_default.cardLabel,
|
|
218
|
+
children: reference.label
|
|
219
|
+
}), reference.description !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
220
|
+
className: RelationField_module_default.cardDescription,
|
|
221
|
+
children: reference.description
|
|
222
|
+
}) : null]
|
|
223
|
+
}),
|
|
224
|
+
onChange !== void 0 || onRemove !== void 0 ? /* @__PURE__ */ jsxs("span", {
|
|
225
|
+
className: RelationField_module_default.cardActions,
|
|
226
|
+
children: [onChange !== void 0 ? /* @__PURE__ */ jsx(Button, {
|
|
227
|
+
size: "sm",
|
|
228
|
+
appearance: "ghost",
|
|
229
|
+
"aria-label": changeLabel(reference),
|
|
230
|
+
onPress: () => onChange(reference),
|
|
231
|
+
children: changeText
|
|
232
|
+
}) : null, onRemove !== void 0 ? /* @__PURE__ */ jsx(IconButton, {
|
|
233
|
+
icon: X,
|
|
234
|
+
size: "sm",
|
|
235
|
+
label: removeLabel(reference),
|
|
236
|
+
onPress: () => onRemove(reference)
|
|
237
|
+
}) : null]
|
|
238
|
+
}) : null
|
|
239
|
+
]
|
|
240
|
+
}, reference.id);
|
|
241
|
+
};
|
|
242
|
+
$[9] = changeLabel;
|
|
243
|
+
$[10] = changeText;
|
|
244
|
+
$[11] = getHref;
|
|
245
|
+
$[12] = info;
|
|
246
|
+
$[13] = onChange;
|
|
247
|
+
$[14] = onRemove;
|
|
248
|
+
$[15] = removeLabel;
|
|
249
|
+
$[16] = t2;
|
|
250
|
+
} else t2 = $[16];
|
|
251
|
+
t1 = references.map(t2);
|
|
252
|
+
$[0] = changeLabel;
|
|
253
|
+
$[1] = changeText;
|
|
254
|
+
$[2] = getHref;
|
|
255
|
+
$[3] = info;
|
|
256
|
+
$[4] = onChange;
|
|
257
|
+
$[5] = onRemove;
|
|
258
|
+
$[6] = references;
|
|
259
|
+
$[7] = removeLabel;
|
|
260
|
+
$[8] = t1;
|
|
261
|
+
} else t1 = $[8];
|
|
262
|
+
let t2;
|
|
263
|
+
if ($[17] !== ariaLabel || $[18] !== t1) {
|
|
264
|
+
t2 = /* @__PURE__ */ jsx("ul", {
|
|
265
|
+
className: RelationField_module_default.cards,
|
|
266
|
+
"aria-label": ariaLabel,
|
|
267
|
+
children: t1
|
|
268
|
+
});
|
|
269
|
+
$[17] = ariaLabel;
|
|
270
|
+
$[18] = t1;
|
|
271
|
+
$[19] = t2;
|
|
272
|
+
} else t2 = $[19];
|
|
273
|
+
return t2;
|
|
274
|
+
}
|
|
152
275
|
/**
|
|
153
276
|
* A reference to an item of another resource, or several with `multiple`, picked by searching a
|
|
154
277
|
* `RelationSource`. Values are references (`{ id, label }`), as items carry them; plain ids get
|
|
155
|
-
* their labels from the source's `resolve()`.
|
|
156
|
-
*
|
|
157
|
-
*
|
|
278
|
+
* their labels from the source's `resolve()`. The chosen items show as cards (decision 0067), with
|
|
279
|
+
* their image and their description when the source gives them, a link to each one
|
|
280
|
+
* (`getItemHref()`), and buttons to change or remove them. When the source can `create()` (or with
|
|
281
|
+
* `onCreate`), the picker offers to create an item from the typed text. Without a source, the field
|
|
282
|
+
* shows its items and can't change them.
|
|
158
283
|
*/
|
|
159
284
|
function RelationField(props) {
|
|
160
|
-
const $ = c(
|
|
285
|
+
const $ = c(159);
|
|
161
286
|
const intl = usePanneauIntl();
|
|
162
287
|
const context = useFieldsContext();
|
|
163
288
|
const source = props.source === void 0 ? context.relationSource : props.source;
|
|
164
|
-
const { resource, label, description, errors, disabled, readOnly, required, onBlur, name, id, className, labelClassName, descriptionClassName, errorsClassName, controlClassName } = props;
|
|
165
|
-
|
|
289
|
+
const { resource, label, description, errors, disabled, readOnly, required, onBlur, name, id, className, labelClassName, descriptionClassName, errorsClassName, controlClassName, compact: t0 } = props;
|
|
290
|
+
const compact = t0 === void 0 ? false : t0;
|
|
291
|
+
let t1;
|
|
166
292
|
if ($[0] !== intl || $[1] !== props.placeholder) {
|
|
167
|
-
|
|
293
|
+
t1 = props.placeholder ?? intl.formatMessage(messages.search);
|
|
168
294
|
$[0] = intl;
|
|
169
295
|
$[1] = props.placeholder;
|
|
170
|
-
$[2] =
|
|
171
|
-
} else
|
|
172
|
-
const placeholder =
|
|
173
|
-
let
|
|
296
|
+
$[2] = t1;
|
|
297
|
+
} else t1 = $[2];
|
|
298
|
+
const placeholder = t1;
|
|
299
|
+
let t2;
|
|
174
300
|
if ($[3] !== props.value) {
|
|
175
|
-
|
|
301
|
+
t2 = toReferences(props.value);
|
|
176
302
|
$[3] = props.value;
|
|
177
|
-
$[4] =
|
|
178
|
-
} else
|
|
179
|
-
const selected = useRelationReferences(source, resource,
|
|
303
|
+
$[4] = t2;
|
|
304
|
+
} else t2 = $[4];
|
|
305
|
+
const selected = useRelationReferences(source, resource, t2);
|
|
306
|
+
let t3;
|
|
307
|
+
if ($[5] !== resource || $[6] !== source) {
|
|
308
|
+
t3 = source?.describe?.(resource) ?? null;
|
|
309
|
+
$[5] = resource;
|
|
310
|
+
$[6] = source;
|
|
311
|
+
$[7] = t3;
|
|
312
|
+
} else t3 = $[7];
|
|
313
|
+
const info = t3;
|
|
180
314
|
const [query, setQuery] = useState(null);
|
|
181
315
|
const [creating, setCreating] = useState(false);
|
|
182
316
|
const [createError, setCreateError] = useState(null);
|
|
317
|
+
const [changing, setChanging] = useState(false);
|
|
318
|
+
const container = useRef(null);
|
|
319
|
+
const focusNext = useRef(null);
|
|
320
|
+
let t4;
|
|
321
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
322
|
+
t4 = () => {
|
|
323
|
+
const target = focusNext.current;
|
|
324
|
+
if (target === null) return;
|
|
325
|
+
focusNext.current = null;
|
|
326
|
+
const cards = container.current?.querySelectorAll("[data-relation-card]") ?? [];
|
|
327
|
+
const card = target !== "picker" ? cards[Math.min(target, cards.length - 1)] : void 0;
|
|
328
|
+
(card !== void 0 ? card.querySelector("button") : container.current?.querySelector("input"))?.focus();
|
|
329
|
+
};
|
|
330
|
+
$[8] = t4;
|
|
331
|
+
} else t4 = $[8];
|
|
332
|
+
useEffect(t4);
|
|
183
333
|
const editable = source !== null && disabled !== true && readOnly !== true;
|
|
184
|
-
let t2;
|
|
185
|
-
if ($[5] !== editable) {
|
|
186
|
-
t2 = { enabled: editable };
|
|
187
|
-
$[5] = editable;
|
|
188
|
-
$[6] = t2;
|
|
189
|
-
} else t2 = $[6];
|
|
190
|
-
const { items: found, isLoading: searching } = useRelationSearch(source, resource, query ?? "", t2);
|
|
191
|
-
const sourceCreate = source?.create;
|
|
192
|
-
let t3;
|
|
193
|
-
if ($[7] !== props.onCreate || $[8] !== resource || $[9] !== source || $[10] !== sourceCreate) {
|
|
194
|
-
t3 = props.onCreate !== void 0 ? props.onCreate : sourceCreate !== void 0 && source?.canCreate?.(resource) !== false ? (text) => sourceCreate.call(source, resource, text) : null;
|
|
195
|
-
$[7] = props.onCreate;
|
|
196
|
-
$[8] = resource;
|
|
197
|
-
$[9] = source;
|
|
198
|
-
$[10] = sourceCreate;
|
|
199
|
-
$[11] = t3;
|
|
200
|
-
} else t3 = $[11];
|
|
201
|
-
const create = t3;
|
|
202
|
-
const t4 = query ?? "";
|
|
203
|
-
let allErrors;
|
|
204
|
-
let createFrom;
|
|
205
|
-
let isLoading;
|
|
206
|
-
let items;
|
|
207
334
|
let t5;
|
|
208
|
-
if ($[
|
|
209
|
-
t5 =
|
|
335
|
+
if ($[9] !== editable) {
|
|
336
|
+
t5 = { enabled: editable };
|
|
337
|
+
$[9] = editable;
|
|
338
|
+
$[10] = t5;
|
|
339
|
+
} else t5 = $[10];
|
|
340
|
+
const { items: found, isLoading: searching } = useRelationSearch(source, resource, query ?? "", t5);
|
|
341
|
+
const sourceCreate = source?.create;
|
|
342
|
+
let t6;
|
|
343
|
+
if ($[11] !== props.onCreate || $[12] !== resource || $[13] !== source || $[14] !== sourceCreate) {
|
|
344
|
+
t6 = props.onCreate !== void 0 ? props.onCreate : sourceCreate !== void 0 && source?.canCreate?.(resource) !== false ? (text) => sourceCreate.call(source, resource, text) : null;
|
|
345
|
+
$[11] = props.onCreate;
|
|
346
|
+
$[12] = resource;
|
|
347
|
+
$[13] = source;
|
|
348
|
+
$[14] = sourceCreate;
|
|
349
|
+
$[15] = t6;
|
|
350
|
+
} else t6 = $[15];
|
|
351
|
+
const create = t6;
|
|
352
|
+
const t7 = query ?? "";
|
|
353
|
+
let T0;
|
|
354
|
+
let t10;
|
|
355
|
+
let t11;
|
|
356
|
+
let t12;
|
|
357
|
+
let t13;
|
|
358
|
+
let t14;
|
|
359
|
+
let t8;
|
|
360
|
+
let t9;
|
|
361
|
+
if ($[16] !== changing || $[17] !== className || $[18] !== compact || $[19] !== controlClassName || $[20] !== create || $[21] !== createError || $[22] !== creating || $[23] !== description || $[24] !== descriptionClassName || $[25] !== disabled || $[26] !== editable || $[27] !== errors || $[28] !== errorsClassName || $[29] !== found || $[30] !== id || $[31] !== info || $[32] !== intl || $[33] !== label || $[34] !== labelClassName || $[35] !== name || $[36] !== onBlur || $[37] !== placeholder || $[38] !== props || $[39] !== query || $[40] !== readOnly || $[41] !== required || $[42] !== resource || $[43] !== searching || $[44] !== selected || $[45] !== source || $[46] !== t7) {
|
|
362
|
+
t14 = Symbol.for("react.early_return_sentinel");
|
|
210
363
|
bb0: {
|
|
211
|
-
const text_0 =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
} else t6 = $[46];
|
|
224
|
-
allErrors = t6;
|
|
225
|
-
createFrom = (add) => {
|
|
364
|
+
const text_0 = t7.trim();
|
|
365
|
+
const offersCreate = create !== null && text_0 !== "" && !searching && ![...found, ...selected].some((item) => item.label.toLocaleLowerCase(intl.locale) === text_0.toLocaleLowerCase(intl.locale));
|
|
366
|
+
const isLoading = searching || creating;
|
|
367
|
+
let t15;
|
|
368
|
+
if ($[55] !== createError || $[56] !== errors) {
|
|
369
|
+
t15 = createError !== null ? [...errors ?? [], createError] : errors;
|
|
370
|
+
$[55] = createError;
|
|
371
|
+
$[56] = errors;
|
|
372
|
+
$[57] = t15;
|
|
373
|
+
} else t15 = $[57];
|
|
374
|
+
const allErrors = t15;
|
|
375
|
+
const createFrom = (add) => {
|
|
226
376
|
if (create === null) return;
|
|
227
377
|
setCreating(true);
|
|
228
378
|
setCreateError(null);
|
|
@@ -233,16 +383,54 @@ function RelationField(props) {
|
|
|
233
383
|
}
|
|
234
384
|
}).catch(() => setCreateError(intl.formatMessage(messages.createRelationFailed, { text: text_0 }))).finally(() => setCreating(false));
|
|
235
385
|
};
|
|
236
|
-
let
|
|
237
|
-
if ($[
|
|
238
|
-
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
} else
|
|
242
|
-
const removeLabel =
|
|
243
|
-
let
|
|
244
|
-
if ($[
|
|
245
|
-
|
|
386
|
+
let t16;
|
|
387
|
+
if ($[58] !== intl) {
|
|
388
|
+
t16 = (reference_0) => `${intl.formatMessage(messages.remove)} ${reference_0.label}`;
|
|
389
|
+
$[58] = intl;
|
|
390
|
+
$[59] = t16;
|
|
391
|
+
} else t16 = $[59];
|
|
392
|
+
const removeLabel = t16;
|
|
393
|
+
let t17;
|
|
394
|
+
if ($[60] !== intl) {
|
|
395
|
+
t17 = (reference_1) => intl.formatMessage(messages.changeRelation, { item: reference_1.label });
|
|
396
|
+
$[60] = intl;
|
|
397
|
+
$[61] = t17;
|
|
398
|
+
} else t17 = $[61];
|
|
399
|
+
const changeLabel = t17;
|
|
400
|
+
let t18;
|
|
401
|
+
if ($[62] !== resource || $[63] !== source) {
|
|
402
|
+
t18 = (reference_2) => source?.getItemHref?.(resource, reference_2.id) ?? null;
|
|
403
|
+
$[62] = resource;
|
|
404
|
+
$[63] = source;
|
|
405
|
+
$[64] = t18;
|
|
406
|
+
} else t18 = $[64];
|
|
407
|
+
const getHref = t18;
|
|
408
|
+
let t19;
|
|
409
|
+
if ($[65] !== intl) {
|
|
410
|
+
t19 = intl.formatMessage(messages.change);
|
|
411
|
+
$[65] = intl;
|
|
412
|
+
$[66] = t19;
|
|
413
|
+
} else t19 = $[66];
|
|
414
|
+
let t20;
|
|
415
|
+
if ($[67] !== changeLabel || $[68] !== getHref || $[69] !== info || $[70] !== removeLabel || $[71] !== t19) {
|
|
416
|
+
t20 = {
|
|
417
|
+
info,
|
|
418
|
+
getHref,
|
|
419
|
+
removeLabel,
|
|
420
|
+
changeLabel,
|
|
421
|
+
changeText: t19
|
|
422
|
+
};
|
|
423
|
+
$[67] = changeLabel;
|
|
424
|
+
$[68] = getHref;
|
|
425
|
+
$[69] = info;
|
|
426
|
+
$[70] = removeLabel;
|
|
427
|
+
$[71] = t19;
|
|
428
|
+
$[72] = t20;
|
|
429
|
+
} else t20 = $[72];
|
|
430
|
+
const cards_0 = t20;
|
|
431
|
+
let t21;
|
|
432
|
+
if ($[73] !== allErrors || $[74] !== className || $[75] !== descriptionClassName || $[76] !== errorsClassName || $[77] !== label || $[78] !== labelClassName || $[79] !== required) {
|
|
433
|
+
t21 = {
|
|
246
434
|
legend: label,
|
|
247
435
|
errors: allErrors,
|
|
248
436
|
isRequired: required,
|
|
@@ -251,358 +439,432 @@ function RelationField(props) {
|
|
|
251
439
|
descriptionClassName,
|
|
252
440
|
errorsClassName
|
|
253
441
|
};
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
} else
|
|
263
|
-
const chrome =
|
|
442
|
+
$[73] = allErrors;
|
|
443
|
+
$[74] = className;
|
|
444
|
+
$[75] = descriptionClassName;
|
|
445
|
+
$[76] = errorsClassName;
|
|
446
|
+
$[77] = label;
|
|
447
|
+
$[78] = labelClassName;
|
|
448
|
+
$[79] = required;
|
|
449
|
+
$[80] = t21;
|
|
450
|
+
} else t21 = $[80];
|
|
451
|
+
const chrome = t21;
|
|
452
|
+
const comboLabel = typeof label === "string" ? label : props["aria-label"];
|
|
453
|
+
const options = (exclude) => [...found.filter((item_0) => !exclude.some((entry) => entry.id === item_0.id)).map((item_1) => ({
|
|
454
|
+
id: item_1.id,
|
|
455
|
+
label: item_1.label,
|
|
456
|
+
...item_1.description !== void 0 ? { description: item_1.description } : {},
|
|
457
|
+
...info?.image === true || item_1.imageUrl !== void 0 ? { prefix: /* @__PURE__ */ jsx(Thumbnail, {
|
|
458
|
+
reference: item_1,
|
|
459
|
+
info,
|
|
460
|
+
className: RelationField_module_default.optionThumbnail
|
|
461
|
+
}) } : {}
|
|
462
|
+
})), ...offersCreate ? [{
|
|
463
|
+
id: CREATE_ID,
|
|
464
|
+
label: intl.formatMessage(messages.createRelation, { text: text_0 })
|
|
465
|
+
}] : []];
|
|
466
|
+
const pick = (itemId, add_0) => {
|
|
467
|
+
if (itemId === CREATE_ID) {
|
|
468
|
+
createFrom(add_0);
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
const reference_3 = found.find((item_2) => item_2.id === itemId);
|
|
472
|
+
if (reference_3 !== void 0) {
|
|
473
|
+
add_0(reference_3);
|
|
474
|
+
setQuery(null);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const t22 = query ?? "";
|
|
478
|
+
let t23;
|
|
479
|
+
if ($[81] !== intl) {
|
|
480
|
+
t23 = intl.formatMessage(messages.noResults);
|
|
481
|
+
$[81] = intl;
|
|
482
|
+
$[82] = t23;
|
|
483
|
+
} else t23 = $[82];
|
|
484
|
+
let t24;
|
|
485
|
+
if ($[83] !== onBlur) {
|
|
486
|
+
t24 = onBlur !== void 0 ? { onBlur: () => onBlur() } : {};
|
|
487
|
+
$[83] = onBlur;
|
|
488
|
+
$[84] = t24;
|
|
489
|
+
} else t24 = $[84];
|
|
490
|
+
let t25;
|
|
491
|
+
if ($[85] !== name) {
|
|
492
|
+
t25 = name !== void 0 ? { name } : {};
|
|
493
|
+
$[85] = name;
|
|
494
|
+
$[86] = t25;
|
|
495
|
+
} else t25 = $[86];
|
|
496
|
+
let t26;
|
|
497
|
+
if ($[87] !== id) {
|
|
498
|
+
t26 = id !== void 0 ? { id } : {};
|
|
499
|
+
$[87] = id;
|
|
500
|
+
$[88] = t26;
|
|
501
|
+
} else t26 = $[88];
|
|
502
|
+
let t27;
|
|
503
|
+
if ($[89] !== controlClassName) {
|
|
504
|
+
t27 = controlClassName !== void 0 ? { controlClassName } : {};
|
|
505
|
+
$[89] = controlClassName;
|
|
506
|
+
$[90] = t27;
|
|
507
|
+
} else t27 = $[90];
|
|
508
|
+
let t28;
|
|
509
|
+
if ($[91] !== comboLabel || $[92] !== isLoading || $[93] !== placeholder || $[94] !== required || $[95] !== t22 || $[96] !== t23 || $[97] !== t24 || $[98] !== t25 || $[99] !== t26 || $[100] !== t27) {
|
|
510
|
+
t28 = {
|
|
511
|
+
"aria-label": comboLabel,
|
|
512
|
+
inputValue: t22,
|
|
513
|
+
onInputChange: setQuery,
|
|
514
|
+
isLoading,
|
|
515
|
+
isRequired: required,
|
|
516
|
+
placeholder,
|
|
517
|
+
emptyMessage: t23,
|
|
518
|
+
...t24,
|
|
519
|
+
...t25,
|
|
520
|
+
...t26,
|
|
521
|
+
...t27
|
|
522
|
+
};
|
|
523
|
+
$[91] = comboLabel;
|
|
524
|
+
$[92] = isLoading;
|
|
525
|
+
$[93] = placeholder;
|
|
526
|
+
$[94] = required;
|
|
527
|
+
$[95] = t22;
|
|
528
|
+
$[96] = t23;
|
|
529
|
+
$[97] = t24;
|
|
530
|
+
$[98] = t25;
|
|
531
|
+
$[99] = t26;
|
|
532
|
+
$[100] = t27;
|
|
533
|
+
$[101] = t28;
|
|
534
|
+
} else t28 = $[101];
|
|
535
|
+
const pickerProps = t28;
|
|
264
536
|
if (!editable) {
|
|
265
|
-
let
|
|
266
|
-
if ($[
|
|
267
|
-
|
|
537
|
+
let t29;
|
|
538
|
+
if ($[102] !== description || $[103] !== disabled || $[104] !== intl || $[105] !== readOnly || $[106] !== source) {
|
|
539
|
+
t29 = source === null && disabled !== true && readOnly !== true ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
268
540
|
description,
|
|
269
541
|
" ",
|
|
270
542
|
intl.formatMessage(messages.relationUnavailable)
|
|
271
543
|
] }) : description;
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
} else
|
|
279
|
-
let
|
|
280
|
-
if ($[
|
|
281
|
-
|
|
544
|
+
$[102] = description;
|
|
545
|
+
$[103] = disabled;
|
|
546
|
+
$[104] = intl;
|
|
547
|
+
$[105] = readOnly;
|
|
548
|
+
$[106] = source;
|
|
549
|
+
$[107] = t29;
|
|
550
|
+
} else t29 = $[107];
|
|
551
|
+
let t30;
|
|
552
|
+
if ($[108] !== cards_0 || $[109] !== compact || $[110] !== intl || $[111] !== removeLabel || $[112] !== selected) {
|
|
553
|
+
t30 = selected.length > 0 && compact ? /* @__PURE__ */ jsx(References, {
|
|
282
554
|
references: selected,
|
|
283
555
|
removeLabel
|
|
556
|
+
}) : selected.length > 0 ? /* @__PURE__ */ jsx(RelationCards, {
|
|
557
|
+
...cards_0,
|
|
558
|
+
references: selected
|
|
284
559
|
}) : /* @__PURE__ */ jsx("span", {
|
|
285
560
|
className: RelationField_module_default.none,
|
|
286
561
|
children: intl.formatMessage(messages.noRelation)
|
|
287
562
|
});
|
|
288
|
-
$[
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
563
|
+
$[108] = cards_0;
|
|
564
|
+
$[109] = compact;
|
|
565
|
+
$[110] = intl;
|
|
566
|
+
$[111] = removeLabel;
|
|
567
|
+
$[112] = selected;
|
|
568
|
+
$[113] = t30;
|
|
569
|
+
} else t30 = $[113];
|
|
570
|
+
let t31;
|
|
571
|
+
if ($[114] !== chrome || $[115] !== t29 || $[116] !== t30) {
|
|
572
|
+
t31 = /* @__PURE__ */ jsx(Fieldset, {
|
|
296
573
|
...chrome,
|
|
297
|
-
description:
|
|
298
|
-
children:
|
|
574
|
+
description: t29,
|
|
575
|
+
children: t30
|
|
299
576
|
});
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
} else
|
|
305
|
-
|
|
577
|
+
$[114] = chrome;
|
|
578
|
+
$[115] = t29;
|
|
579
|
+
$[116] = t30;
|
|
580
|
+
$[117] = t31;
|
|
581
|
+
} else t31 = $[117];
|
|
582
|
+
t14 = t31;
|
|
306
583
|
break bb0;
|
|
307
584
|
}
|
|
308
|
-
const comboLabel = typeof label === "string" ? label : props["aria-label"];
|
|
309
585
|
if (props.multiple === true) {
|
|
310
586
|
const { onChange } = props;
|
|
311
|
-
let
|
|
312
|
-
if ($[
|
|
313
|
-
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
} else
|
|
317
|
-
const set =
|
|
318
|
-
let
|
|
319
|
-
if ($[
|
|
320
|
-
|
|
587
|
+
let t29;
|
|
588
|
+
if ($[118] !== onChange) {
|
|
589
|
+
t29 = (next) => onChange?.(next.length > 0 ? next : null);
|
|
590
|
+
$[118] = onChange;
|
|
591
|
+
$[119] = t29;
|
|
592
|
+
} else t29 = $[119];
|
|
593
|
+
const set = t29;
|
|
594
|
+
let t30;
|
|
595
|
+
if ($[120] !== cards_0 || $[121] !== compact || $[122] !== removeLabel || $[123] !== selected || $[124] !== set) {
|
|
596
|
+
t30 = selected.length > 0 && compact ? /* @__PURE__ */ jsx(References, {
|
|
321
597
|
references: selected,
|
|
322
598
|
removeLabel,
|
|
323
|
-
onRemove: (
|
|
599
|
+
onRemove: (reference_4) => set(selected.filter((entry_0) => entry_0.id !== reference_4.id))
|
|
600
|
+
}) : selected.length > 0 ? /* @__PURE__ */ jsx(RelationCards, {
|
|
601
|
+
...cards_0,
|
|
602
|
+
references: selected,
|
|
603
|
+
onRemove: (reference_5) => {
|
|
604
|
+
set(selected.filter((entry_1) => entry_1.id !== reference_5.id));
|
|
605
|
+
focusNext.current = selected.indexOf(reference_5);
|
|
606
|
+
}
|
|
324
607
|
}) : null;
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
$[
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
$[
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
608
|
+
$[120] = cards_0;
|
|
609
|
+
$[121] = compact;
|
|
610
|
+
$[122] = removeLabel;
|
|
611
|
+
$[123] = selected;
|
|
612
|
+
$[124] = set;
|
|
613
|
+
$[125] = t30;
|
|
614
|
+
} else t30 = $[125];
|
|
615
|
+
const t31 = /* @__PURE__ */ jsxs("div", {
|
|
616
|
+
ref: container,
|
|
617
|
+
className: RelationField_module_default.multiple,
|
|
618
|
+
children: [t30, /* @__PURE__ */ jsx(ComboBox, {
|
|
619
|
+
...pickerProps,
|
|
620
|
+
items: options(selected),
|
|
621
|
+
value: null,
|
|
622
|
+
onChange: (itemId_0) => pick(itemId_0, (reference_6) => set([...selected, reference_6]))
|
|
623
|
+
})]
|
|
624
|
+
});
|
|
625
|
+
let t32;
|
|
626
|
+
if ($[126] !== chrome || $[127] !== description || $[128] !== t31) {
|
|
627
|
+
t32 = /* @__PURE__ */ jsx(Fieldset, {
|
|
628
|
+
...chrome,
|
|
629
|
+
description,
|
|
630
|
+
children: t31
|
|
631
|
+
});
|
|
632
|
+
$[126] = chrome;
|
|
633
|
+
$[127] = description;
|
|
634
|
+
$[128] = t31;
|
|
635
|
+
$[129] = t32;
|
|
636
|
+
} else t32 = $[129];
|
|
637
|
+
t14 = t32;
|
|
638
|
+
break bb0;
|
|
639
|
+
}
|
|
640
|
+
const { onChange: onChange_0 } = props;
|
|
641
|
+
const current = selected[0] ?? null;
|
|
642
|
+
const items = options([]);
|
|
643
|
+
const shown = current !== null && !items.some((item_3) => item_3.id === current.id) ? [current, ...items] : items;
|
|
644
|
+
if (compact) {
|
|
645
|
+
let t29;
|
|
646
|
+
if ($[130] !== controlClassName) {
|
|
647
|
+
t29 = controlClassName !== void 0 ? { controlClassName } : {};
|
|
648
|
+
$[130] = controlClassName;
|
|
649
|
+
$[131] = t29;
|
|
650
|
+
} else t29 = $[131];
|
|
651
|
+
let t30;
|
|
652
|
+
if ($[132] !== props) {
|
|
653
|
+
t30 = props["aria-label"] !== void 0 ? { "aria-label": props["aria-label"] } : {};
|
|
654
|
+
$[132] = props;
|
|
655
|
+
$[133] = t30;
|
|
656
|
+
} else t30 = $[133];
|
|
657
|
+
const t31 = shown.map(_temp);
|
|
658
|
+
let t32;
|
|
659
|
+
if ($[134] !== current || $[135] !== onChange_0) {
|
|
660
|
+
t32 = (text_1) => {
|
|
661
|
+
setQuery(text_1);
|
|
662
|
+
if (text_1 === "" && current !== null) onChange_0?.(null);
|
|
663
|
+
};
|
|
664
|
+
$[134] = current;
|
|
665
|
+
$[135] = onChange_0;
|
|
666
|
+
$[136] = t32;
|
|
667
|
+
} else t32 = $[136];
|
|
668
|
+
let t33;
|
|
669
|
+
if ($[137] !== intl) {
|
|
670
|
+
t33 = intl.formatMessage(messages.noResults);
|
|
671
|
+
$[137] = intl;
|
|
672
|
+
$[138] = t33;
|
|
673
|
+
} else t33 = $[138];
|
|
674
|
+
let t34;
|
|
675
|
+
if ($[139] !== onBlur) {
|
|
676
|
+
t34 = onBlur !== void 0 ? { onBlur: () => {
|
|
677
|
+
setQuery(null);
|
|
678
|
+
onBlur();
|
|
679
|
+
} } : { onBlur: () => setQuery(null) };
|
|
680
|
+
$[139] = onBlur;
|
|
681
|
+
$[140] = t34;
|
|
682
|
+
} else t34 = $[140];
|
|
683
|
+
let t35;
|
|
684
|
+
if ($[141] !== name) {
|
|
685
|
+
t35 = name !== void 0 ? { name } : {};
|
|
686
|
+
$[141] = name;
|
|
687
|
+
$[142] = t35;
|
|
688
|
+
} else t35 = $[142];
|
|
689
|
+
let t36;
|
|
690
|
+
if ($[143] !== id) {
|
|
691
|
+
t36 = id !== void 0 ? { id } : {};
|
|
692
|
+
$[143] = id;
|
|
693
|
+
$[144] = t36;
|
|
694
|
+
} else t36 = $[144];
|
|
695
|
+
t14 = /* @__PURE__ */ jsx(ComboBox, {
|
|
696
|
+
label,
|
|
697
|
+
description,
|
|
698
|
+
errors: allErrors,
|
|
699
|
+
isRequired: required,
|
|
700
|
+
className,
|
|
701
|
+
labelClassName,
|
|
702
|
+
descriptionClassName,
|
|
703
|
+
errorsClassName,
|
|
704
|
+
...t29,
|
|
705
|
+
...t30,
|
|
706
|
+
items: t31,
|
|
707
|
+
value: current?.id ?? null,
|
|
708
|
+
inputValue: query ?? current?.label ?? "",
|
|
709
|
+
onInputChange: t32,
|
|
710
|
+
onChange: (itemId_1) => {
|
|
711
|
+
if (itemId_1 === CREATE_ID) {
|
|
712
|
+
createFrom((reference_7) => onChange_0?.(reference_7));
|
|
376
713
|
return;
|
|
377
714
|
}
|
|
378
|
-
|
|
379
|
-
if (
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
715
|
+
setQuery(null);
|
|
716
|
+
if (itemId_1 === null) return;
|
|
717
|
+
const reference_8 = shown.find((item_5) => item_5.id === itemId_1) ?? null;
|
|
718
|
+
if (reference_8?.id !== current?.id) onChange_0?.(reference_8);
|
|
383
719
|
},
|
|
384
720
|
isLoading,
|
|
385
721
|
placeholder,
|
|
386
|
-
emptyMessage:
|
|
387
|
-
...
|
|
388
|
-
...
|
|
389
|
-
...
|
|
390
|
-
...t17
|
|
722
|
+
emptyMessage: t33,
|
|
723
|
+
...t34,
|
|
724
|
+
...t35,
|
|
725
|
+
...t36
|
|
391
726
|
});
|
|
392
|
-
let t19;
|
|
393
|
-
if ($[89] !== t10 || $[90] !== t18) {
|
|
394
|
-
t19 = /* @__PURE__ */ jsxs("div", {
|
|
395
|
-
className: RelationField_module_default.multiple,
|
|
396
|
-
children: [t10, t18]
|
|
397
|
-
});
|
|
398
|
-
$[89] = t10;
|
|
399
|
-
$[90] = t18;
|
|
400
|
-
$[91] = t19;
|
|
401
|
-
} else t19 = $[91];
|
|
402
|
-
let t20;
|
|
403
|
-
if ($[92] !== chrome || $[93] !== description || $[94] !== t19) {
|
|
404
|
-
t20 = /* @__PURE__ */ jsx(Fieldset, {
|
|
405
|
-
...chrome,
|
|
406
|
-
description,
|
|
407
|
-
children: t19
|
|
408
|
-
});
|
|
409
|
-
$[92] = chrome;
|
|
410
|
-
$[93] = description;
|
|
411
|
-
$[94] = t19;
|
|
412
|
-
$[95] = t20;
|
|
413
|
-
} else t20 = $[95];
|
|
414
|
-
t5 = t20;
|
|
415
727
|
break bb0;
|
|
416
728
|
}
|
|
729
|
+
let t29;
|
|
730
|
+
if ($[145] === Symbol.for("react.memo_cache_sentinel")) {
|
|
731
|
+
t29 = () => {
|
|
732
|
+
setChanging(false);
|
|
733
|
+
setQuery(null);
|
|
734
|
+
focusNext.current = 0;
|
|
735
|
+
};
|
|
736
|
+
$[145] = t29;
|
|
737
|
+
} else t29 = $[145];
|
|
738
|
+
const cancel = t29;
|
|
739
|
+
T0 = Fieldset;
|
|
740
|
+
t12 = chrome;
|
|
741
|
+
t13 = description;
|
|
742
|
+
t8 = container;
|
|
743
|
+
t9 = RelationField_module_default.single;
|
|
744
|
+
if ($[146] !== changing || $[147] !== current) {
|
|
745
|
+
t10 = (event) => {
|
|
746
|
+
if (event.key === "Escape" && changing && current !== null) cancel();
|
|
747
|
+
};
|
|
748
|
+
$[146] = changing;
|
|
749
|
+
$[147] = current;
|
|
750
|
+
$[148] = t10;
|
|
751
|
+
} else t10 = $[148];
|
|
752
|
+
t11 = current !== null && !changing ? /* @__PURE__ */ jsx(RelationCards, {
|
|
753
|
+
...cards_0,
|
|
754
|
+
references: [current],
|
|
755
|
+
onChange: () => {
|
|
756
|
+
setChanging(true);
|
|
757
|
+
focusNext.current = "picker";
|
|
758
|
+
},
|
|
759
|
+
onRemove: () => {
|
|
760
|
+
onChange_0?.(null);
|
|
761
|
+
focusNext.current = "picker";
|
|
762
|
+
}
|
|
763
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
764
|
+
className: RelationField_module_default.picker,
|
|
765
|
+
children: [/* @__PURE__ */ jsx(ComboBox, {
|
|
766
|
+
...pickerProps,
|
|
767
|
+
items: options(current !== null ? [current] : []),
|
|
768
|
+
value: null,
|
|
769
|
+
onChange: (itemId_2) => pick(itemId_2, (reference_9) => {
|
|
770
|
+
if (reference_9.id !== current?.id) onChange_0?.(reference_9);
|
|
771
|
+
setChanging(false);
|
|
772
|
+
focusNext.current = 0;
|
|
773
|
+
})
|
|
774
|
+
}), changing && current !== null ? /* @__PURE__ */ jsx(Button, {
|
|
775
|
+
size: "sm",
|
|
776
|
+
appearance: "ghost",
|
|
777
|
+
onPress: cancel,
|
|
778
|
+
children: intl.formatMessage(messages.cancelChange)
|
|
779
|
+
}) : null]
|
|
780
|
+
});
|
|
417
781
|
}
|
|
418
|
-
$[
|
|
419
|
-
$[
|
|
420
|
-
$[
|
|
421
|
-
$[
|
|
422
|
-
$[
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
$[
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
436
|
-
$[
|
|
437
|
-
$[
|
|
438
|
-
$[
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
$[
|
|
448
|
-
$[
|
|
449
|
-
$[
|
|
782
|
+
$[16] = changing;
|
|
783
|
+
$[17] = className;
|
|
784
|
+
$[18] = compact;
|
|
785
|
+
$[19] = controlClassName;
|
|
786
|
+
$[20] = create;
|
|
787
|
+
$[21] = createError;
|
|
788
|
+
$[22] = creating;
|
|
789
|
+
$[23] = description;
|
|
790
|
+
$[24] = descriptionClassName;
|
|
791
|
+
$[25] = disabled;
|
|
792
|
+
$[26] = editable;
|
|
793
|
+
$[27] = errors;
|
|
794
|
+
$[28] = errorsClassName;
|
|
795
|
+
$[29] = found;
|
|
796
|
+
$[30] = id;
|
|
797
|
+
$[31] = info;
|
|
798
|
+
$[32] = intl;
|
|
799
|
+
$[33] = label;
|
|
800
|
+
$[34] = labelClassName;
|
|
801
|
+
$[35] = name;
|
|
802
|
+
$[36] = onBlur;
|
|
803
|
+
$[37] = placeholder;
|
|
804
|
+
$[38] = props;
|
|
805
|
+
$[39] = query;
|
|
806
|
+
$[40] = readOnly;
|
|
807
|
+
$[41] = required;
|
|
808
|
+
$[42] = resource;
|
|
809
|
+
$[43] = searching;
|
|
810
|
+
$[44] = selected;
|
|
811
|
+
$[45] = source;
|
|
812
|
+
$[46] = t7;
|
|
813
|
+
$[47] = T0;
|
|
814
|
+
$[48] = t10;
|
|
815
|
+
$[49] = t11;
|
|
816
|
+
$[50] = t12;
|
|
817
|
+
$[51] = t13;
|
|
818
|
+
$[52] = t14;
|
|
819
|
+
$[53] = t8;
|
|
820
|
+
$[54] = t9;
|
|
450
821
|
} else {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
822
|
+
T0 = $[47];
|
|
823
|
+
t10 = $[48];
|
|
824
|
+
t11 = $[49];
|
|
825
|
+
t12 = $[50];
|
|
826
|
+
t13 = $[51];
|
|
827
|
+
t14 = $[52];
|
|
828
|
+
t8 = $[53];
|
|
829
|
+
t9 = $[54];
|
|
456
830
|
}
|
|
457
|
-
if (
|
|
458
|
-
const { onChange: onChange_0 } = props;
|
|
459
|
-
const current = selected[0] ?? null;
|
|
460
|
-
let t6;
|
|
461
|
-
if ($[96] !== current || $[97] !== items) {
|
|
462
|
-
t6 = current !== null && !items.some((item_3) => item_3.id === current.id) ? [current, ...items] : items;
|
|
463
|
-
$[96] = current;
|
|
464
|
-
$[97] = items;
|
|
465
|
-
$[98] = t6;
|
|
466
|
-
} else t6 = $[98];
|
|
467
|
-
const shown = t6;
|
|
468
|
-
let t7;
|
|
469
|
-
if ($[99] !== controlClassName) {
|
|
470
|
-
t7 = controlClassName !== void 0 ? { controlClassName } : {};
|
|
471
|
-
$[99] = controlClassName;
|
|
472
|
-
$[100] = t7;
|
|
473
|
-
} else t7 = $[100];
|
|
474
|
-
let t8;
|
|
475
|
-
if ($[101] !== props) {
|
|
476
|
-
t8 = props["aria-label"] !== void 0 ? { "aria-label": props["aria-label"] } : {};
|
|
477
|
-
$[101] = props;
|
|
478
|
-
$[102] = t8;
|
|
479
|
-
} else t8 = $[102];
|
|
480
|
-
let t9;
|
|
481
|
-
if ($[103] !== shown) {
|
|
482
|
-
t9 = shown.map(_temp2);
|
|
483
|
-
$[103] = shown;
|
|
484
|
-
$[104] = t9;
|
|
485
|
-
} else t9 = $[104];
|
|
486
|
-
const t10 = current?.id ?? null;
|
|
487
|
-
const t11 = query ?? current?.label ?? "";
|
|
488
|
-
let t12;
|
|
489
|
-
if ($[105] !== current || $[106] !== onChange_0) {
|
|
490
|
-
t12 = (text_1) => {
|
|
491
|
-
setQuery(text_1);
|
|
492
|
-
if (text_1 === "" && current !== null) onChange_0?.(null);
|
|
493
|
-
};
|
|
494
|
-
$[105] = current;
|
|
495
|
-
$[106] = onChange_0;
|
|
496
|
-
$[107] = t12;
|
|
497
|
-
} else t12 = $[107];
|
|
498
|
-
let t13;
|
|
499
|
-
if ($[108] !== createFrom || $[109] !== current?.id || $[110] !== onChange_0 || $[111] !== shown) {
|
|
500
|
-
t13 = (itemId_0) => {
|
|
501
|
-
if (itemId_0 === CREATE_ID) {
|
|
502
|
-
createFrom((reference_4) => onChange_0?.(reference_4));
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
setQuery(null);
|
|
506
|
-
if (itemId_0 === null) return;
|
|
507
|
-
const reference_5 = shown.find((item_5) => item_5.id === itemId_0) ?? null;
|
|
508
|
-
if (reference_5?.id !== current?.id) onChange_0?.(reference_5);
|
|
509
|
-
};
|
|
510
|
-
$[108] = createFrom;
|
|
511
|
-
$[109] = current?.id;
|
|
512
|
-
$[110] = onChange_0;
|
|
513
|
-
$[111] = shown;
|
|
514
|
-
$[112] = t13;
|
|
515
|
-
} else t13 = $[112];
|
|
516
|
-
let t14;
|
|
517
|
-
if ($[113] !== intl) {
|
|
518
|
-
t14 = intl.formatMessage(messages.noResults);
|
|
519
|
-
$[113] = intl;
|
|
520
|
-
$[114] = t14;
|
|
521
|
-
} else t14 = $[114];
|
|
831
|
+
if (t14 !== Symbol.for("react.early_return_sentinel")) return t14;
|
|
522
832
|
let t15;
|
|
523
|
-
if ($[
|
|
524
|
-
t15 =
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
833
|
+
if ($[149] !== t10 || $[150] !== t11 || $[151] !== t8 || $[152] !== t9) {
|
|
834
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
835
|
+
ref: t8,
|
|
836
|
+
className: t9,
|
|
837
|
+
onKeyDown: t10,
|
|
838
|
+
children: t11
|
|
839
|
+
});
|
|
840
|
+
$[149] = t10;
|
|
841
|
+
$[150] = t11;
|
|
842
|
+
$[151] = t8;
|
|
843
|
+
$[152] = t9;
|
|
844
|
+
$[153] = t15;
|
|
845
|
+
} else t15 = $[153];
|
|
531
846
|
let t16;
|
|
532
|
-
if ($[
|
|
533
|
-
t16 =
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
let t17;
|
|
538
|
-
if ($[119] !== id) {
|
|
539
|
-
t17 = id !== void 0 ? { id } : {};
|
|
540
|
-
$[119] = id;
|
|
541
|
-
$[120] = t17;
|
|
542
|
-
} else t17 = $[120];
|
|
543
|
-
let t18;
|
|
544
|
-
if ($[121] !== allErrors || $[122] !== className || $[123] !== description || $[124] !== descriptionClassName || $[125] !== errorsClassName || $[126] !== isLoading || $[127] !== label || $[128] !== labelClassName || $[129] !== placeholder || $[130] !== required || $[131] !== t10 || $[132] !== t11 || $[133] !== t12 || $[134] !== t13 || $[135] !== t14 || $[136] !== t15 || $[137] !== t16 || $[138] !== t17 || $[139] !== t7 || $[140] !== t8 || $[141] !== t9) {
|
|
545
|
-
t18 = /* @__PURE__ */ jsx(ComboBox, {
|
|
546
|
-
label,
|
|
547
|
-
description,
|
|
548
|
-
errors: allErrors,
|
|
549
|
-
isRequired: required,
|
|
550
|
-
className,
|
|
551
|
-
labelClassName,
|
|
552
|
-
descriptionClassName,
|
|
553
|
-
errorsClassName,
|
|
554
|
-
...t7,
|
|
555
|
-
...t8,
|
|
556
|
-
items: t9,
|
|
557
|
-
value: t10,
|
|
558
|
-
inputValue: t11,
|
|
559
|
-
onInputChange: t12,
|
|
560
|
-
onChange: t13,
|
|
561
|
-
isLoading,
|
|
562
|
-
placeholder,
|
|
563
|
-
emptyMessage: t14,
|
|
564
|
-
...t15,
|
|
565
|
-
...t16,
|
|
566
|
-
...t17
|
|
847
|
+
if ($[154] !== T0 || $[155] !== t12 || $[156] !== t13 || $[157] !== t15) {
|
|
848
|
+
t16 = /* @__PURE__ */ jsx(T0, {
|
|
849
|
+
...t12,
|
|
850
|
+
description: t13,
|
|
851
|
+
children: t15
|
|
567
852
|
});
|
|
568
|
-
$[
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
$[
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
$[128] = labelClassName;
|
|
576
|
-
$[129] = placeholder;
|
|
577
|
-
$[130] = required;
|
|
578
|
-
$[131] = t10;
|
|
579
|
-
$[132] = t11;
|
|
580
|
-
$[133] = t12;
|
|
581
|
-
$[134] = t13;
|
|
582
|
-
$[135] = t14;
|
|
583
|
-
$[136] = t15;
|
|
584
|
-
$[137] = t16;
|
|
585
|
-
$[138] = t17;
|
|
586
|
-
$[139] = t7;
|
|
587
|
-
$[140] = t8;
|
|
588
|
-
$[141] = t9;
|
|
589
|
-
$[142] = t18;
|
|
590
|
-
} else t18 = $[142];
|
|
591
|
-
return t18;
|
|
853
|
+
$[154] = T0;
|
|
854
|
+
$[155] = t12;
|
|
855
|
+
$[156] = t13;
|
|
856
|
+
$[157] = t15;
|
|
857
|
+
$[158] = t16;
|
|
858
|
+
} else t16 = $[158];
|
|
859
|
+
return t16;
|
|
592
860
|
}
|
|
593
861
|
/** The `relation` type: `resource` and `multiple`. Items search the fields context's source. */
|
|
594
|
-
function
|
|
862
|
+
function _temp(item_4) {
|
|
595
863
|
return {
|
|
596
864
|
id: item_4.id,
|
|
597
865
|
label: item_4.label
|
|
598
866
|
};
|
|
599
867
|
}
|
|
600
|
-
function _temp(item_1) {
|
|
601
|
-
return {
|
|
602
|
-
id: item_1.id,
|
|
603
|
-
label: item_1.label
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
868
|
function RelationFieldEntry(props) {
|
|
607
869
|
const $ = c(15);
|
|
608
870
|
const { field } = props;
|