@bigbinary/neeto-filters-frontend 2.13.2 → 2.14.1
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 +156 -83
- package/dist/index.cjs.js +24 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +26 -34
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/types.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { curryN, isNil, complement, curry, isEmpty, either, groupBy, anyPass, any, toLower, mergeLeft, identity, omit, mergeRight, toPairs, concat, pluck, has as has$1, equals, pick, modify, prop, isNotNil, append, last, not } from 'ramda';
|
|
4
4
|
import { Tooltip, Typography, Dropdown as Dropdown$2, Button, Pane as Pane$1, Alert, Select, DatePicker, TimePicker, Input as Input$1, Accordion, Spinner } from '@bigbinary/neetoui';
|
|
5
5
|
import { useHistory, useLocation } from 'react-router-dom';
|
|
6
|
-
import { useHotKeys, useDebounce, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { useHotKeys, useMutationWithInvalidation, useDebounce, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
7
7
|
import { Close, Search, Check, MenuHorizontal, Down, Settings } from '@bigbinary/neeto-icons';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import { getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
|
|
@@ -12,7 +12,7 @@ import timezone from 'dayjs/plugin/timezone';
|
|
|
12
12
|
import utc from 'dayjs/plugin/utc';
|
|
13
13
|
import weekday from 'dayjs/plugin/weekday';
|
|
14
14
|
import { Form, Input, ActionBlock } from '@bigbinary/neetoui/formik';
|
|
15
|
-
import { useQuery
|
|
15
|
+
import { useQuery } from 'react-query';
|
|
16
16
|
import axios from 'axios';
|
|
17
17
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
18
18
|
import MenuBar from '@bigbinary/neeto-molecules/MenuBar';
|
|
@@ -3338,8 +3338,8 @@ dayjs.extend(timezone);
|
|
|
3338
3338
|
dayjs.extend(weekday);
|
|
3339
3339
|
dayjs.Ls.en.weekStart = 1;
|
|
3340
3340
|
|
|
3341
|
-
function ownKeys$
|
|
3342
|
-
function _objectSpread$
|
|
3341
|
+
function ownKeys$5(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; }
|
|
3342
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3343
3343
|
var groupByGroup = groupBy(function (_ref) {
|
|
3344
3344
|
var group = _ref.group;
|
|
3345
3345
|
return group || "individual";
|
|
@@ -3632,7 +3632,7 @@ var buildDatePayload = function buildDatePayload(value) {
|
|
|
3632
3632
|
var buildSingleDatePayload = function buildSingleDatePayload(filter) {
|
|
3633
3633
|
var value = filter.value;
|
|
3634
3634
|
var filterValue = Array.isArray(value) ? value.join(",") : value;
|
|
3635
|
-
return _objectSpread$
|
|
3635
|
+
return _objectSpread$5(_objectSpread$5({}, filter), {}, {
|
|
3636
3636
|
value: filterValue,
|
|
3637
3637
|
type: "date"
|
|
3638
3638
|
});
|
|
@@ -3640,7 +3640,7 @@ var buildSingleDatePayload = function buildSingleDatePayload(filter) {
|
|
|
3640
3640
|
var buildSingleTimePayload = function buildSingleTimePayload(filter) {
|
|
3641
3641
|
var value = filter.value;
|
|
3642
3642
|
var filterValue = Array.isArray(value) ? value.join(",") : value;
|
|
3643
|
-
return _objectSpread$
|
|
3643
|
+
return _objectSpread$5(_objectSpread$5({}, filter), {}, {
|
|
3644
3644
|
value: filterValue,
|
|
3645
3645
|
type: "time"
|
|
3646
3646
|
});
|
|
@@ -3889,8 +3889,12 @@ var buildUrlFromSegment = function buildUrlFromSegment(_ref19) {
|
|
|
3889
3889
|
var getKeywordValueFromUrl = function getKeywordValueFromUrl() {
|
|
3890
3890
|
return getQueryParams()["keyword"] || "";
|
|
3891
3891
|
};
|
|
3892
|
-
var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(
|
|
3893
|
-
var
|
|
3892
|
+
var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(_ref21) {
|
|
3893
|
+
var fields = _ref21.fields,
|
|
3894
|
+
_ref21$selectedFields = _ref21.selectedFields,
|
|
3895
|
+
selectedFields = _ref21$selectedFields === void 0 ? [] : _ref21$selectedFields,
|
|
3896
|
+
_ref21$showRuleSelect = _ref21.showRuleSelector,
|
|
3897
|
+
showRuleSelector = _ref21$showRuleSelect === void 0 ? false : _ref21$showRuleSelect;
|
|
3894
3898
|
return fields.reduce(function (columns, field) {
|
|
3895
3899
|
if (isEmpty(selectedFields) || selectedFields.includes(field.name)) {
|
|
3896
3900
|
var id = field.id,
|
|
@@ -3900,7 +3904,8 @@ var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(fields)
|
|
|
3900
3904
|
key: toLower(name),
|
|
3901
3905
|
node: "".concat(name, ":").concat(id),
|
|
3902
3906
|
label: capitalize(name),
|
|
3903
|
-
type: "custom.".concat(kind)
|
|
3907
|
+
type: "custom.".concat(kind),
|
|
3908
|
+
showRuleSelector: showRuleSelector
|
|
3904
3909
|
};
|
|
3905
3910
|
if (kind === "single_option" || kind === "multi_option") {
|
|
3906
3911
|
column.values = field.data.map(function (item) {
|
|
@@ -3917,7 +3922,7 @@ var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(fields)
|
|
|
3917
3922
|
};
|
|
3918
3923
|
var getColumnsWithStandardizedType = function getColumnsWithStandardizedType(columns) {
|
|
3919
3924
|
return columns.map(function (column) {
|
|
3920
|
-
return _objectSpread$
|
|
3925
|
+
return _objectSpread$5(_objectSpread$5({}, column), {}, {
|
|
3921
3926
|
type: standardizeColumnType(column.type)
|
|
3922
3927
|
});
|
|
3923
3928
|
});
|
|
@@ -4138,6 +4143,8 @@ var QUERY_KEYS = {
|
|
|
4138
4143
|
};
|
|
4139
4144
|
var SEGMENTS_STALE_TIME = 900000; // 15 mins
|
|
4140
4145
|
|
|
4146
|
+
function ownKeys$4(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; }
|
|
4147
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4141
4148
|
var SEGMENTS_LIST = QUERY_KEYS.SEGMENTS_LIST;
|
|
4142
4149
|
var useFetchSegments = function useFetchSegments(_ref) {
|
|
4143
4150
|
var entity = _ref.entity,
|
|
@@ -4164,34 +4171,19 @@ var useShowSegment = function useShowSegment(id) {
|
|
|
4164
4171
|
}, options));
|
|
4165
4172
|
};
|
|
4166
4173
|
var useCreateSegment = function useCreateSegment(options) {
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
var _options$onSuccess;
|
|
4171
|
-
queryClient.invalidateQueries(SEGMENTS_LIST);
|
|
4172
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 ? void 0 : _options$onSuccess.call(options);
|
|
4173
|
-
}
|
|
4174
|
-
});
|
|
4174
|
+
return useMutationWithInvalidation(segmentsApi.create, _objectSpread$4({
|
|
4175
|
+
keysToInvalidate: [SEGMENTS_LIST]
|
|
4176
|
+
}, options));
|
|
4175
4177
|
};
|
|
4176
4178
|
var useUpdateSegment = function useUpdateSegment(options) {
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
var _options$onSuccess2;
|
|
4181
|
-
queryClient.invalidateQueries(SEGMENTS_LIST);
|
|
4182
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 ? void 0 : _options$onSuccess2.call(options);
|
|
4183
|
-
}
|
|
4184
|
-
});
|
|
4179
|
+
return useMutationWithInvalidation(segmentsApi.update, _objectSpread$4({
|
|
4180
|
+
keysToInvalidate: [SEGMENTS_LIST]
|
|
4181
|
+
}, options));
|
|
4185
4182
|
};
|
|
4186
4183
|
var useDestroySegment = function useDestroySegment(options) {
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
var _options$onSuccess3;
|
|
4191
|
-
queryClient.invalidateQueries(SEGMENTS_LIST);
|
|
4192
|
-
options === null || options === void 0 ? void 0 : (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 ? void 0 : _options$onSuccess3.call(options);
|
|
4193
|
-
}
|
|
4194
|
-
});
|
|
4184
|
+
return useMutationWithInvalidation(segmentsApi.destroy, _objectSpread$4({
|
|
4185
|
+
keysToInvalidate: [SEGMENTS_LIST]
|
|
4186
|
+
}, options));
|
|
4195
4187
|
};
|
|
4196
4188
|
|
|
4197
4189
|
var Menu = Dropdown$2.Menu,
|