@bigbinary/neeto-fields-frontend 1.3.4 → 1.3.5
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/index.cjs.js +22 -72
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +25 -75
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useContext, useState, useRef, useEffect, useMemo, useLayoutEffect, useCallback, createContext, memo, useReducer } from 'react';
|
|
2
2
|
import { Checkbox as Checkbox$1, TimePicker, DatePicker, Select, Input, Textarea, Typography, Pane, Label, Button as Button$1, Dropdown, Tab, Alert, NoData, Table, Spinner } from '@bigbinary/neetoui';
|
|
3
|
-
import { isNotEmpty, renameKeys, capitalize as capitalize$1, findBy, filterBy, toLabelAndValue, slugify, humanize,
|
|
3
|
+
import { isNotEmpty, renameKeys, capitalize as capitalize$1, findBy, filterBy, toLabelAndValue, slugify, humanize, countBy, noop as noop$2 } from '@bigbinary/neeto-commons-frontend/pure';
|
|
4
4
|
import { values, isNotNil, isNil, isEmpty, prop, pluck, clone as clone$1, pipe, mergeAll, omit, map, pick, assoc, any, head } from 'ramda';
|
|
5
5
|
import { useFormikContext, useField, FieldArray } from 'formik';
|
|
6
|
-
import { useFuncDebounce, useDebounce, handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { useFuncDebounce, useMutationWithInvalidation, useDebounce, handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
7
7
|
import * as yup from 'yup';
|
|
8
8
|
import { joinHyphenCase, buildUrl, getQueryParams } from '@bigbinary/neeto-commons-frontend/utils';
|
|
9
9
|
import { Check, Delete, MenuHorizontal, Info, Reorder } from '@bigbinary/neeto-icons';
|
|
@@ -11,7 +11,7 @@ import { Button, ActionBlock as ActionBlock$1, Input as Input$1, Select as Selec
|
|
|
11
11
|
import { DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
12
12
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
13
13
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
14
|
-
import { useQuery
|
|
14
|
+
import { useQuery } from 'react-query';
|
|
15
15
|
import axios from 'axios';
|
|
16
16
|
import { v4 } from 'uuid';
|
|
17
17
|
import { Link, useHistory } from 'react-router-dom';
|
|
@@ -6507,17 +6507,9 @@ var useFetchFields = function useFetchFields(_ref, options) {
|
|
|
6507
6507
|
}, options));
|
|
6508
6508
|
};
|
|
6509
6509
|
var useCreateField = function useCreateField(options) {
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
var _options$onSuccess;
|
|
6514
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6515
|
-
args[_key] = arguments[_key];
|
|
6516
|
-
}
|
|
6517
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call.apply(_options$onSuccess, [options].concat(args));
|
|
6518
|
-
queryClient.invalidateQueries(FIELDS);
|
|
6519
|
-
}
|
|
6520
|
-
}));
|
|
6510
|
+
return useMutationWithInvalidation(fieldsApi.create, _objectSpread$9({
|
|
6511
|
+
keysToInvalidate: [FIELDS]
|
|
6512
|
+
}, options));
|
|
6521
6513
|
};
|
|
6522
6514
|
var useShowField = function useShowField(_ref2, options) {
|
|
6523
6515
|
var fieldId = _ref2.fieldId,
|
|
@@ -6541,37 +6533,18 @@ var useFetchDependencies = function useFetchDependencies(_ref3, options) {
|
|
|
6541
6533
|
}, options);
|
|
6542
6534
|
};
|
|
6543
6535
|
var useUpdateField = function useUpdateField(options) {
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
var _options$onSuccess2;
|
|
6548
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
6549
|
-
args[_key2] = arguments[_key2];
|
|
6550
|
-
}
|
|
6551
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 ? void 0 : _options$onSuccess2.call.apply(_options$onSuccess2, [options].concat(args));
|
|
6552
|
-
queryClient.invalidateQueries(FIELDS);
|
|
6553
|
-
}
|
|
6554
|
-
}));
|
|
6536
|
+
return useMutationWithInvalidation(fieldsApi.update, _objectSpread$9({
|
|
6537
|
+
keysToInvalidate: [FIELDS]
|
|
6538
|
+
}, options));
|
|
6555
6539
|
};
|
|
6556
6540
|
var useDestroyField = function useDestroyField(options) {
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
var _options$onSuccess3;
|
|
6561
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
6562
|
-
args[_key3] = arguments[_key3];
|
|
6563
|
-
}
|
|
6564
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call.apply(_options$onSuccess3, [options].concat(args));
|
|
6565
|
-
queryClient.invalidateQueries(FIELDS);
|
|
6566
|
-
}
|
|
6567
|
-
}));
|
|
6541
|
+
return useMutationWithInvalidation(fieldsApi.destroy, _objectSpread$9({
|
|
6542
|
+
keysToInvalidate: [FIELDS]
|
|
6543
|
+
}, options));
|
|
6568
6544
|
};
|
|
6569
6545
|
var useReorderFields = function useReorderFields() {
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
onSuccess: function onSuccess() {
|
|
6573
|
-
queryClient.invalidateQueries(FIELDS);
|
|
6574
|
-
}
|
|
6546
|
+
return useMutationWithInvalidation(fieldsApi.reorder, {
|
|
6547
|
+
keysToInvalidate: [FIELDS]
|
|
6575
6548
|
});
|
|
6576
6549
|
};
|
|
6577
6550
|
|
|
@@ -7966,7 +7939,7 @@ var useFieldsDashboard = function useFieldsDashboard(_ref) {
|
|
|
7966
7939
|
}, [menuItems, resource]);
|
|
7967
7940
|
useEffect(function () {
|
|
7968
7941
|
handleURLWithDefaultValues();
|
|
7969
|
-
}, [isConfigsLoading, resources]);
|
|
7942
|
+
}, [isConfigsLoading, resources, resource, state]);
|
|
7970
7943
|
useEffect(function () {
|
|
7971
7944
|
setPageProps({
|
|
7972
7945
|
pageIndex: DEFAULT_PAGE_INDEX,
|
|
@@ -8143,11 +8116,9 @@ var Header = function Header(_ref) {
|
|
|
8143
8116
|
actionBlockProps = _objectWithoutProperties(_ref, _excluded);
|
|
8144
8117
|
return /*#__PURE__*/React.createElement(NeetoUIHeader, {
|
|
8145
8118
|
size: "small",
|
|
8119
|
+
breadcrumbs: breadcrumbs,
|
|
8146
8120
|
searchProps: searchProps,
|
|
8147
8121
|
actionBlock: /*#__PURE__*/React.createElement(ActionBlock, actionBlockProps),
|
|
8148
|
-
breadcrumbs: [].concat(_toConsumableArray(breadcrumbs), [{
|
|
8149
|
-
text: truncate(title, 50)
|
|
8150
|
-
}]),
|
|
8151
8122
|
title: /*#__PURE__*/React.createElement(TitleWithHelpLink, {
|
|
8152
8123
|
helpUrl: helpDocUrl,
|
|
8153
8124
|
title: title
|
|
@@ -12706,40 +12677,19 @@ var fieldValuesApi = {
|
|
|
12706
12677
|
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12707
12678
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12708
12679
|
var useCreateFieldValue = function useCreateFieldValue(options) {
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12713
|
-
args[_key] = arguments[_key];
|
|
12714
|
-
}
|
|
12715
|
-
options === null || options === void 0 ? void 0 : options.onSuccess.apply(options, args);
|
|
12716
|
-
queryClient.invalidateQueries([QUERY_KEYS.FIELD_VALUES]);
|
|
12717
|
-
}
|
|
12718
|
-
}));
|
|
12680
|
+
return useMutationWithInvalidation(fieldValuesApi.create, _objectSpread$2({
|
|
12681
|
+
keysToInvalidate: [[QUERY_KEYS.FIELD_VALUES]]
|
|
12682
|
+
}, options));
|
|
12719
12683
|
};
|
|
12720
12684
|
var useUpdateFieldValue = function useUpdateFieldValue(options) {
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12725
|
-
args[_key2] = arguments[_key2];
|
|
12726
|
-
}
|
|
12727
|
-
options === null || options === void 0 ? void 0 : options.onSuccess.apply(options, args);
|
|
12728
|
-
queryClient.invalidateQueries([QUERY_KEYS.FIELD_VALUES]);
|
|
12729
|
-
}
|
|
12730
|
-
}));
|
|
12685
|
+
return useMutationWithInvalidation(fieldValuesApi.update, _objectSpread$2({
|
|
12686
|
+
keysToInvalidate: [[QUERY_KEYS.FIELD_VALUES]]
|
|
12687
|
+
}, options));
|
|
12731
12688
|
};
|
|
12732
12689
|
var useDeleteFieldValue = function useDeleteFieldValue(options) {
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
12737
|
-
args[_key3] = arguments[_key3];
|
|
12738
|
-
}
|
|
12739
|
-
options === null || options === void 0 ? void 0 : options.onSuccess.apply(options, args);
|
|
12740
|
-
queryClient.invalidateQueries([QUERY_KEYS.FIELD_VALUES]);
|
|
12741
|
-
}
|
|
12742
|
-
}));
|
|
12690
|
+
return useMutationWithInvalidation(fieldValuesApi.destroy, _objectSpread$2({
|
|
12691
|
+
keysToInvalidate: [[QUERY_KEYS.FIELD_VALUES]]
|
|
12692
|
+
}, options));
|
|
12743
12693
|
};
|
|
12744
12694
|
|
|
12745
12695
|
const useNavPrompt = ({
|