@panneau/field-resource-item 4.0.2 → 4.0.4
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/es/index.js +108 -98
- package/package.json +12 -12
package/es/index.js
CHANGED
|
@@ -18,8 +18,7 @@ import ResourceForm from '@panneau/form-resource';
|
|
|
18
18
|
import { useResourceValues } from '@panneau/intl';
|
|
19
19
|
import Dialog from '@panneau/modal-dialog';
|
|
20
20
|
import ResourceItemsModal from '@panneau/modal-resource-items';
|
|
21
|
-
|
|
22
|
-
// TODO: improve the modals (esc key) and switch to FormModal
|
|
21
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
23
22
|
|
|
24
23
|
function ResourceItemField(_ref) {
|
|
25
24
|
var _ref$name = _ref.name,
|
|
@@ -285,109 +284,120 @@ function ResourceItemField(_ref) {
|
|
|
285
284
|
if (reload) reload();
|
|
286
285
|
}
|
|
287
286
|
}, [onChange, paginated, defaultPage, reload]);
|
|
288
|
-
var form = formOpen ? /*#__PURE__*/
|
|
287
|
+
var form = formOpen ? /*#__PURE__*/jsx(ResourceForm, {
|
|
289
288
|
resource: resource,
|
|
290
289
|
type: finalType,
|
|
291
290
|
item: !multiple ? value : null,
|
|
292
291
|
onSuccess: onFormSuccess,
|
|
293
292
|
isModal: true
|
|
294
293
|
}) : null;
|
|
295
|
-
return /*#__PURE__*/
|
|
296
|
-
className: classNames(['position-relative', _defineProperty({}, className, className != null)])
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
294
|
+
return /*#__PURE__*/jsxs("div", {
|
|
295
|
+
className: classNames(['position-relative', _defineProperty({}, className, className != null)]),
|
|
296
|
+
children: [hasValue && !multiple ? /*#__PURE__*/jsx("div", {
|
|
297
|
+
className: "row",
|
|
298
|
+
children: /*#__PURE__*/jsx("div", {
|
|
299
|
+
className: "col-10 flex-grow-1",
|
|
300
|
+
children: /*#__PURE__*/jsx(ResourceCard, {
|
|
301
|
+
className: "flex-grow-1",
|
|
302
|
+
item: value,
|
|
303
|
+
getItemLabel: initialGetItemLabel,
|
|
304
|
+
getItemDescription: getItemDescription,
|
|
305
|
+
getItemImage: getItemImage,
|
|
306
|
+
itemLabelPath: itemLabelPath,
|
|
307
|
+
itemDescriptionPath: itemDescriptionPath,
|
|
308
|
+
itemImagePath: itemImagePath,
|
|
309
|
+
itemLabelWithId: itemLabelWithId,
|
|
310
|
+
disable: disabled,
|
|
311
|
+
onClickEdit: canEdit && !multiple ? formOpen ? onCloseForm : onOpenForm : null,
|
|
312
|
+
onClickRemove: onClickRemove,
|
|
313
|
+
editButtonLabel: editButtonLabel
|
|
314
|
+
})
|
|
315
|
+
})
|
|
316
|
+
}) : /*#__PURE__*/jsxs("div", {
|
|
317
|
+
className: "row align-items-center",
|
|
318
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
319
|
+
className: "col-8 flex-grow-1",
|
|
320
|
+
children: /*#__PURE__*/jsx(Select, {
|
|
321
|
+
className: classNames(['py-1', 'shadow-none', _defineProperty(_defineProperty(_defineProperty({}, disabled, disabled), 'is-invalid', errors !== null), inputClassName, inputClassName !== null)]),
|
|
322
|
+
disabled: disabled,
|
|
323
|
+
name: name,
|
|
324
|
+
value: finalValue,
|
|
325
|
+
options: options,
|
|
326
|
+
isClearable: true,
|
|
327
|
+
isSearchable: true,
|
|
328
|
+
placeholder: isMessage(placeholder) ? intl.formatMessage(placeholder) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
329
|
+
id: "oc3YLT",
|
|
330
|
+
defaultMessage: [{
|
|
331
|
+
"type": 0,
|
|
332
|
+
"value": "Choose an item"
|
|
333
|
+
}]
|
|
334
|
+
}),
|
|
335
|
+
onChange: onValueChange,
|
|
336
|
+
onInputChange: onInputChange
|
|
337
|
+
// onFocus={onFocus}
|
|
338
|
+
,
|
|
339
|
+
onMenuScrollToBottom: onScrollEnd,
|
|
340
|
+
multiple: multiple
|
|
341
|
+
})
|
|
342
|
+
}), canFind ? /*#__PURE__*/jsx("div", {
|
|
343
|
+
className: "col-auto",
|
|
344
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
345
|
+
theme: "primary",
|
|
346
|
+
icon: findButtonLabel === null ? 'search' : null,
|
|
347
|
+
onClick: listOpen ? onCloseList : onOpenList,
|
|
348
|
+
outline: true,
|
|
349
|
+
children: findButtonLabel
|
|
350
|
+
})
|
|
351
|
+
}) : null, canCreate ? /*#__PURE__*/jsx("div", {
|
|
352
|
+
className: "col-auto",
|
|
353
|
+
children: /*#__PURE__*/jsx(Button, {
|
|
354
|
+
theme: "primary",
|
|
355
|
+
icon: createButtonLabel === null ? 'plus-lg' : null,
|
|
356
|
+
onClick: formOpen ? onCloseForm : onOpenForm,
|
|
357
|
+
outline: true,
|
|
358
|
+
children: createButtonLabel
|
|
359
|
+
})
|
|
360
|
+
}) : null]
|
|
361
|
+
}), formOpen ? withoutModal ? /*#__PURE__*/jsx("div", {
|
|
362
|
+
className: "card mt-4 p-4",
|
|
363
|
+
children: form
|
|
364
|
+
}) : /*#__PURE__*/jsx(Dialog, {
|
|
365
|
+
id: resourceId,
|
|
366
|
+
title: hasValue && !multiple ? /*#__PURE__*/jsx(FormattedMessage, {
|
|
367
|
+
values: resourceValues,
|
|
368
|
+
id: "mCfzkJ",
|
|
369
|
+
defaultMessage: [{
|
|
370
|
+
"type": 0,
|
|
371
|
+
"value": "Edit "
|
|
372
|
+
}, {
|
|
373
|
+
"type": 1,
|
|
374
|
+
"value": "a_singular"
|
|
375
|
+
}]
|
|
376
|
+
}) : /*#__PURE__*/jsx(FormattedMessage, {
|
|
377
|
+
values: resourceValues,
|
|
378
|
+
id: "6viUpq",
|
|
379
|
+
defaultMessage: [{
|
|
380
|
+
"type": 0,
|
|
381
|
+
"value": "Create "
|
|
382
|
+
}, {
|
|
383
|
+
"type": 1,
|
|
384
|
+
"value": "a_singular"
|
|
385
|
+
}]
|
|
386
|
+
}),
|
|
387
|
+
size: "lg",
|
|
388
|
+
onClose: onCloseForm,
|
|
389
|
+
children: form
|
|
390
|
+
}) : null, listOpen ? /*#__PURE__*/jsx(ResourceItemsModal, {
|
|
391
|
+
resource: resourceId,
|
|
392
|
+
onClose: onCloseList,
|
|
393
|
+
listProps: {
|
|
394
|
+
actions: ['select'],
|
|
395
|
+
actionsProps: {
|
|
396
|
+
onClickSelect: onSelectListItem
|
|
397
|
+
}
|
|
388
398
|
}
|
|
389
|
-
}
|
|
390
|
-
})
|
|
399
|
+
}) : null]
|
|
400
|
+
});
|
|
391
401
|
}
|
|
392
402
|
|
|
393
403
|
var definition = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/field-resource-item",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "An item mapping a resource",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.12.5",
|
|
52
|
-
"@panneau/core": "^4.0.
|
|
53
|
-
"@panneau/data": "^4.0.
|
|
54
|
-
"@panneau/element-button": "^4.0.
|
|
55
|
-
"@panneau/element-resource-card": "^4.0.
|
|
56
|
-
"@panneau/element-select": "^4.0.
|
|
57
|
-
"@panneau/form-resource": "^4.0.
|
|
58
|
-
"@panneau/intl": "^4.0.
|
|
59
|
-
"@panneau/modal-dialog": "^4.0.
|
|
60
|
-
"@panneau/modal-resource-form": "^4.0.
|
|
61
|
-
"@panneau/modal-resource-items": "^4.0.
|
|
52
|
+
"@panneau/core": "^4.0.4",
|
|
53
|
+
"@panneau/data": "^4.0.4",
|
|
54
|
+
"@panneau/element-button": "^4.0.4",
|
|
55
|
+
"@panneau/element-resource-card": "^4.0.4",
|
|
56
|
+
"@panneau/element-select": "^4.0.4",
|
|
57
|
+
"@panneau/form-resource": "^4.0.4",
|
|
58
|
+
"@panneau/intl": "^4.0.4",
|
|
59
|
+
"@panneau/modal-dialog": "^4.0.4",
|
|
60
|
+
"@panneau/modal-resource-form": "^4.0.4",
|
|
61
|
+
"@panneau/modal-resource-items": "^4.0.4",
|
|
62
62
|
"classnames": "^2.5.1",
|
|
63
63
|
"lodash-es": "^4.17.21",
|
|
64
64
|
"prop-types": "^15.7.2",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
|
|
71
71
|
}
|