@bigbinary/neeto-filters-frontend 2.12.3 → 2.12.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.js CHANGED
@@ -1,8 +1,8 @@
1
- import React, { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
1
+ import React, { createContext, useContext, useState, useRef, useEffect, useMemo } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { capitalize as capitalize$1, removeBy, findBy, isNotEmpty, humanize, noop as noop$2, toLabelAndValue, replaceBy, isPresent, existsBy, filterBy } from '@bigbinary/neeto-commons-frontend/pure';
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
- import { groupBy, anyPass, isNil, isEmpty, any, mergeLeft, identity, omit, mergeRight, concat, pluck, either, has as has$1, toPairs, equals, pick, modify, prop, isNotNil, append, last, not } from 'ramda';
5
+ import { groupBy, anyPass, isNil, isEmpty, any, toLower, mergeLeft, identity, omit, mergeRight, concat, pluck, either, has as has$1, toPairs, equals, pick, modify, prop, isNotNil, append, last, not } from 'ramda';
6
6
  import { useHistory, useLocation } from 'react-router-dom';
7
7
  import { useHotKeys, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
8
8
  import { Close, Search, Check, MenuHorizontal, Down, Settings } from '@bigbinary/neeto-icons';
@@ -2554,11 +2554,9 @@ var common = {
2554
2554
  done: "Done",
2555
2555
  filter: "Filter",
2556
2556
  filters: "Filters",
2557
- name: "Name",
2558
2557
  no: "No",
2559
2558
  proceed: "Proceed",
2560
2559
  rename: "Rename",
2561
- reset: "Reset",
2562
2560
  segments: "Segments",
2563
2561
  userCount: "{{count}} Users",
2564
2562
  yes: "Yes"
@@ -2900,7 +2898,7 @@ var isBoolean = function isBoolean(type) {
2900
2898
  return type === "boolean" || type === "custom.boolean";
2901
2899
  };
2902
2900
  var isDate = function isDate(type) {
2903
- return type === "date" || type === "custom.date";
2901
+ return type === "date" || type === "custom.date" || type === "custom.datetime";
2904
2902
  };
2905
2903
  var isSingleDate = function isSingleDate(type) {
2906
2904
  return type === "single_date" || type === "custom.single_date";
@@ -3433,30 +3431,26 @@ var getKeywordValueFromUrl = function getKeywordValueFromUrl() {
3433
3431
  };
3434
3432
  var buildFilterColumnsFromFields = function buildFilterColumnsFromFields(fields) {
3435
3433
  var selectedFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
3436
- if (isEmpty(selectedFields)) {
3437
- return fields.map(function (field) {
3438
- var id = field.id,
3439
- name = field.name,
3440
- kind = field.kind;
3441
- return {
3442
- key: name,
3443
- node: "".concat(name, ":").concat(id),
3444
- label: capitalize$1(name),
3445
- type: "custom.".concat(kind)
3446
- };
3447
- });
3448
- }
3449
3434
  return fields.reduce(function (columns, field) {
3450
- if (selectedFields.includes(field.name)) {
3435
+ if (isEmpty(selectedFields) || selectedFields.includes(field.name)) {
3451
3436
  var id = field.id,
3452
3437
  name = field.name,
3453
3438
  kind = field.kind;
3454
- columns.push({
3455
- key: name,
3439
+ var column = {
3440
+ key: toLower(name),
3456
3441
  node: "".concat(name, ":").concat(id),
3457
3442
  label: capitalize$1(name),
3458
3443
  type: "custom.".concat(kind)
3459
- });
3444
+ };
3445
+ if (kind === "single_option" || kind === "multi_option") {
3446
+ column.values = field.data.map(function (item) {
3447
+ return {
3448
+ label: capitalize$1(item.label),
3449
+ value: item.label
3450
+ };
3451
+ });
3452
+ }
3453
+ columns.push(column);
3460
3454
  }
3461
3455
  return columns;
3462
3456
  }, []);
@@ -3922,7 +3916,7 @@ var Bar = function Bar(_ref) {
3922
3916
  search: params
3923
3917
  });
3924
3918
  };
3925
- var handleDelete = useCallback(function (key) {
3919
+ var handleDelete = function handleDelete(key) {
3926
3920
  if (key === "keyword") {
3927
3921
  keyword.setValue("");
3928
3922
  keyword.value = "";
@@ -3937,7 +3931,7 @@ var Bar = function Bar(_ref) {
3937
3931
  key: key
3938
3932
  }, filters);
3939
3933
  handleSubmit(newFilters);
3940
- }, []);
3934
+ };
3941
3935
  var handleClearAll = function handleClearAll() {
3942
3936
  keyword.setValue("");
3943
3937
  keyword.value = "";