@bigbinary/neeto-folders-frontend 2.0.40 → 2.0.41
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/.ready +1 -1
- package/dist/cjs/v2/components.js +26 -19
- package/dist/cjs/v2/components.js.map +1 -1
- package/dist/v2/components.js +27 -20
- package/dist/v2/components.js.map +1 -1
- package/package.json +7 -7
package/dist/v2/components.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import { shallow } from 'zustand/shallow';
|
|
4
|
-
import { Alert, Sheet, Spinner, Typography,
|
|
4
|
+
import { Alert, Sheet, Spinner, Typography, Button, Toastr, Checkbox, Tree } from '@bigbinary/neeto-atoms';
|
|
5
5
|
import { useQueryClient } from '@tanstack/react-query';
|
|
6
6
|
import { useQueryParams, useStateWithDependency } from '@bigbinary/neeto-commons-frontend/v2/react-utils';
|
|
7
7
|
import { buildUrl, showThumbsUpToastr } from '@bigbinary/neeto-commons-frontend/v2/utils';
|
|
@@ -21,6 +21,7 @@ import { Textarea, Switch, Input, Form, ActionBlock, TreeSelect as TreeSelect$1
|
|
|
21
21
|
import { t } from 'i18next';
|
|
22
22
|
import { object, string } from 'yup';
|
|
23
23
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
24
|
+
import { RadioGroupItem, RadioGroup } from '@bigbinary/neeto-atoms/primitives';
|
|
24
25
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
25
26
|
import { hyphenate, isNotPresent, noop, isNotEmpty } from '@bigbinary/neeto-cist';
|
|
26
27
|
import { isEmpty, assoc } from 'ramda';
|
|
@@ -411,6 +412,9 @@ var Node$1 = /*#__PURE__*/forwardRef(Node$2);
|
|
|
411
412
|
var _excluded$5 = ["folder", "item", "depth", "maxDepth", "disabled", "config"];
|
|
412
413
|
function ownKeys$i(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
413
414
|
function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
415
|
+
var toRadioValue = function toRadioValue(id) {
|
|
416
|
+
return id == null ? "__root__" : String(id);
|
|
417
|
+
};
|
|
414
418
|
var _SelectableNode = function SelectableNode(_ref) {
|
|
415
419
|
var _folder$children$leng, _folder$children;
|
|
416
420
|
var folder = _ref.folder,
|
|
@@ -421,8 +425,8 @@ var _SelectableNode = function SelectableNode(_ref) {
|
|
|
421
425
|
disabled = _ref.disabled,
|
|
422
426
|
config = _ref.config,
|
|
423
427
|
rest = _objectWithoutProperties(_ref, _excluded$5);
|
|
424
|
-
|
|
425
|
-
onSelect = rest.onSelect;
|
|
428
|
+
rest.selection;
|
|
429
|
+
var onSelect = rest.onSelect;
|
|
426
430
|
var _useTranslation = useTranslation(config),
|
|
427
431
|
t = _useTranslation.t;
|
|
428
432
|
var isDisabled = disabled || (item === null || item === void 0 ? void 0 : item.id) === folder.id || depth >= maxDepth;
|
|
@@ -455,11 +459,10 @@ var _SelectableNode = function SelectableNode(_ref) {
|
|
|
455
459
|
folderLabel: folderLabel,
|
|
456
460
|
itemLabel: itemLabel
|
|
457
461
|
})), {}, {
|
|
458
|
-
icon: /*#__PURE__*/jsx(
|
|
459
|
-
readOnly: true,
|
|
460
|
-
checked: selection === folder.id,
|
|
462
|
+
icon: /*#__PURE__*/jsx(RadioGroupItem, {
|
|
461
463
|
"data-testid": "".concat(hyphenate(folder.name), "-folder-option"),
|
|
462
|
-
|
|
464
|
+
disabled: isDisabled,
|
|
465
|
+
value: toRadioValue(folder.id)
|
|
463
466
|
}),
|
|
464
467
|
onClick: isDisabled ? noop : function () {
|
|
465
468
|
return onSelect(folder);
|
|
@@ -575,19 +578,23 @@ var PaneBody = function PaneBody(_ref) {
|
|
|
575
578
|
})]
|
|
576
579
|
}), /*#__PURE__*/jsx(Sheet.Body, {
|
|
577
580
|
className: "pb-6",
|
|
578
|
-
children:
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
581
|
+
children: /*#__PURE__*/jsx(RadioGroup, {
|
|
582
|
+
className: "contents",
|
|
583
|
+
value: toRadioValue(selection),
|
|
584
|
+
children: tree.map(function (folder) {
|
|
585
|
+
return /*#__PURE__*/createElement(_SelectableNode, {
|
|
586
|
+
config: config,
|
|
587
|
+
folder: folder,
|
|
588
|
+
item: item,
|
|
589
|
+
maxDepth: maxDepth,
|
|
590
|
+
selection: selection,
|
|
591
|
+
disabled: (item === null || item === void 0 ? void 0 : item.id) === folder.id || maxDepth <= 0,
|
|
592
|
+
key: folder.id,
|
|
593
|
+
onSelect: function onSelect(folder) {
|
|
594
|
+
return setSelection(folder.id);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
})
|
|
591
598
|
})
|
|
592
599
|
}), /*#__PURE__*/jsxs(Sheet.Footer, {
|
|
593
600
|
className: "space-x-2",
|