@bigbinary/neeto-fields-frontend 1.3.18 → 1.3.20
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/README.md +3 -3
- package/dist/index.cjs.js +40 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +42 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/types.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState, useMemo, useLayoutEffect, useCallback, createContext, memo, useReducer, useContext } from 'react';
|
|
2
2
|
import { useFuncDebounce, useOnClickOutside, withT, useMutationWithInvalidation, useQueryParams, handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
3
|
-
import { Checkbox as Checkbox$1, TimePicker, DatePicker,
|
|
3
|
+
import { Checkbox as Checkbox$1, TimePicker, DatePicker, Input, Select as Select$1, Textarea, Typography, Pane, Label, Button as Button$1, Tab, Alert, NoData, Table, Spinner } from '@bigbinary/neetoui';
|
|
4
4
|
import { isNotEmpty, renameKeys, capitalize, findBy, noop as noop$1, filterBy, toLabelAndValue, slugify, humanize, countBy } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { values, isNotNil, isNil, isEmpty, prop, pluck, clone, pipe, mergeAll, omit, map, pick, assoc, not, any, head } from 'ramda';
|
|
6
6
|
import { useFormikContext, useField, FieldArray } from 'formik';
|
|
7
7
|
import { t } from 'i18next';
|
|
8
8
|
import * as yup from 'yup';
|
|
9
|
+
import { Select, Button, ActionBlock as ActionBlock$1, Input as Input$1, Switch, Form } from '@bigbinary/neetoui/formik';
|
|
9
10
|
import { joinHyphenCase, buildUrl, getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
|
|
10
11
|
import { Check, Delete, Info, Reorder } from '@bigbinary/neeto-icons';
|
|
11
|
-
import { Button, ActionBlock as ActionBlock$1, Input as Input$1, Select as Select$1, Switch, Form } from '@bigbinary/neetoui/formik';
|
|
12
12
|
import { useTranslation, Trans } from 'react-i18next';
|
|
13
13
|
import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
14
14
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
@@ -1044,7 +1044,7 @@ var SingleOption = function SingleOption(props) {
|
|
|
1044
1044
|
var _useFormikFields = useFormikFields(props),
|
|
1045
1045
|
handleSubmit = _useFormikFields.handleSubmit,
|
|
1046
1046
|
fieldProps = _useFormikFields.fieldProps;
|
|
1047
|
-
return /*#__PURE__*/React.createElement(Select, _extends({
|
|
1047
|
+
return /*#__PURE__*/React.createElement(Select$1, _extends({
|
|
1048
1048
|
isClearable: true,
|
|
1049
1049
|
isSearchable: true,
|
|
1050
1050
|
strategy: "fixed"
|
|
@@ -1722,7 +1722,7 @@ var FieldForm = function FieldForm(_ref) {
|
|
|
1722
1722
|
name: "name",
|
|
1723
1723
|
placeholder: t("neetoFields.placeholders.enterFieldName"),
|
|
1724
1724
|
ref: initialFocusField
|
|
1725
|
-
}), /*#__PURE__*/React.createElement(Select
|
|
1725
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
1726
1726
|
isSearchable: true,
|
|
1727
1727
|
isDisabled: isSystem,
|
|
1728
1728
|
label: t("neetoFields.labels.fieldKind"),
|
|
@@ -2506,29 +2506,31 @@ var renderMenuBarItems = function renderMenuBarItems(_ref3) {
|
|
|
2506
2506
|
});
|
|
2507
2507
|
});
|
|
2508
2508
|
}
|
|
2509
|
-
return items.length > 1 && items.map(function (
|
|
2510
|
-
var label =
|
|
2509
|
+
return items.length > 1 && items.map(function (_ref4) {
|
|
2510
|
+
var label = _ref4.label,
|
|
2511
|
+
value = _ref4.value;
|
|
2512
|
+
var itemLabel = nameAliases[label] || humanize(label);
|
|
2511
2513
|
return /*#__PURE__*/React.createElement(MenuBar.Item, {
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2514
|
+
active: selectedMenu === value,
|
|
2515
|
+
"data-cy": "neeto-fields-".concat(slugify(itemLabel), "-menu-item"),
|
|
2516
|
+
key: label,
|
|
2517
|
+
label: itemLabel,
|
|
2516
2518
|
description: t("neetoFields.messages.manageTitleForResource", {
|
|
2517
2519
|
title: title,
|
|
2518
|
-
resource:
|
|
2520
|
+
resource: itemLabel.toLocaleLowerCase()
|
|
2519
2521
|
}),
|
|
2520
2522
|
onClick: handleBlockClick({
|
|
2521
|
-
resource:
|
|
2523
|
+
resource: value
|
|
2522
2524
|
})
|
|
2523
2525
|
});
|
|
2524
2526
|
});
|
|
2525
2527
|
};
|
|
2526
|
-
var renderStateFilterTabs = function renderStateFilterTabs(
|
|
2527
|
-
var selectedState =
|
|
2528
|
-
fieldStatesTaxonomy =
|
|
2529
|
-
activeFieldsCount =
|
|
2530
|
-
inactiveFieldsCount =
|
|
2531
|
-
handleBlockClick =
|
|
2528
|
+
var renderStateFilterTabs = function renderStateFilterTabs(_ref5) {
|
|
2529
|
+
var selectedState = _ref5.selectedState,
|
|
2530
|
+
fieldStatesTaxonomy = _ref5.fieldStatesTaxonomy,
|
|
2531
|
+
activeFieldsCount = _ref5.activeFieldsCount,
|
|
2532
|
+
inactiveFieldsCount = _ref5.inactiveFieldsCount,
|
|
2533
|
+
handleBlockClick = _ref5.handleBlockClick;
|
|
2532
2534
|
return /*#__PURE__*/React.createElement(Tab, {
|
|
2533
2535
|
className: "mb-4"
|
|
2534
2536
|
}, /*#__PURE__*/React.createElement(Tab.Item, {
|
|
@@ -2545,23 +2547,27 @@ var renderStateFilterTabs = function renderStateFilterTabs(_ref4) {
|
|
|
2545
2547
|
})
|
|
2546
2548
|
}, fieldStatesTaxonomy.inactive, "(", inactiveFieldsCount, ")"));
|
|
2547
2549
|
};
|
|
2548
|
-
var getResourceName = function getResourceName(
|
|
2549
|
-
var
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2550
|
+
var getResourceName = function getResourceName(_ref6) {
|
|
2551
|
+
var _findBy2;
|
|
2552
|
+
var isOwnerBased = _ref6.isOwnerBased,
|
|
2553
|
+
menuItems = _ref6.menuItems,
|
|
2554
|
+
selectedVal = _ref6.selectedVal,
|
|
2555
|
+
nameAliases = _ref6.nameAliases;
|
|
2553
2556
|
if (isOwnerBased) {
|
|
2554
2557
|
var _findBy;
|
|
2555
2558
|
return (_findBy = findBy({
|
|
2556
2559
|
id: selectedVal
|
|
2557
|
-
},
|
|
2560
|
+
}, menuItems)) === null || _findBy === void 0 ? void 0 : _findBy.name;
|
|
2558
2561
|
}
|
|
2559
|
-
|
|
2562
|
+
var selectedName = (_findBy2 = findBy({
|
|
2563
|
+
value: selectedVal
|
|
2564
|
+
}, menuItems)) === null || _findBy2 === void 0 ? void 0 : _findBy2.label;
|
|
2565
|
+
return nameAliases[selectedName] || selectedName;
|
|
2560
2566
|
};
|
|
2561
|
-
var getDashBoardTitle = function getDashBoardTitle(
|
|
2562
|
-
var resourceName =
|
|
2563
|
-
isSingleResource =
|
|
2564
|
-
title =
|
|
2567
|
+
var getDashBoardTitle = function getDashBoardTitle(_ref7) {
|
|
2568
|
+
var resourceName = _ref7.resourceName,
|
|
2569
|
+
isSingleResource = _ref7.isSingleResource,
|
|
2570
|
+
title = _ref7.title;
|
|
2565
2571
|
var displayTitle = isSingleResource ? title : t("neetoFields.messages.titleForResource", {
|
|
2566
2572
|
title: title,
|
|
2567
2573
|
resource: resourceName
|
|
@@ -2586,10 +2592,10 @@ var renderNoDataHelpText = function renderNoDataHelpText(title, url) {
|
|
|
2586
2592
|
}
|
|
2587
2593
|
});
|
|
2588
2594
|
};
|
|
2589
|
-
var getDeletionConfirmationMessage = function getDeletionConfirmationMessage(
|
|
2590
|
-
var resource =
|
|
2591
|
-
fieldName =
|
|
2592
|
-
affectedResourcesCount =
|
|
2595
|
+
var getDeletionConfirmationMessage = function getDeletionConfirmationMessage(_ref8) {
|
|
2596
|
+
var resource = _ref8.resource,
|
|
2597
|
+
fieldName = _ref8.fieldName,
|
|
2598
|
+
affectedResourcesCount = _ref8.affectedResourcesCount;
|
|
2593
2599
|
return affectedResourcesCount > 0 ? /*#__PURE__*/React.createElement(Trans, {
|
|
2594
2600
|
i18nKey: "neetoFields.messages.confirmDeleteWithCount",
|
|
2595
2601
|
values: {
|
|
@@ -2749,8 +2755,8 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
2749
2755
|
state: state
|
|
2750
2756
|
};
|
|
2751
2757
|
if (!isConfigsLoading && isNil(resource)) {
|
|
2752
|
-
var _menuItems
|
|
2753
|
-
queryParams.resource = isOwnerBased ? menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$ = menuItems[0]) === null || _menuItems$ === void 0 ? void 0 : _menuItems$.id : menuItems === null || menuItems === void 0 ? void 0 : menuItems[0];
|
|
2758
|
+
var _menuItems$, _menuItems$2;
|
|
2759
|
+
queryParams.resource = isOwnerBased ? menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$ = menuItems[0]) === null || _menuItems$ === void 0 ? void 0 : _menuItems$.id : menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$2 = menuItems[0]) === null || _menuItems$2 === void 0 ? void 0 : _menuItems$2.value;
|
|
2754
2760
|
}
|
|
2755
2761
|
if (!isConfigsLoading && isNil(state)) {
|
|
2756
2762
|
queryParams.state = FIELD_STATES.active;
|
|
@@ -2771,7 +2777,7 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
2771
2777
|
return getResourceName({
|
|
2772
2778
|
isOwnerBased: isOwnerBased,
|
|
2773
2779
|
nameAliases: nameAliases,
|
|
2774
|
-
|
|
2780
|
+
menuItems: menuItems,
|
|
2775
2781
|
selectedVal: resource
|
|
2776
2782
|
});
|
|
2777
2783
|
}, [menuItems, resource]);
|