@bigbinary/neeto-approvals-frontend 0.2.11 → 0.2.12

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,11 +1,11 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
+ import { useMutationWithInvalidation, useDebounce, withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
2
3
  import Container from '@bigbinary/neeto-molecules/Container';
3
4
  import { Link, useLocation, useHistory, Switch, Route, Redirect, useParams } from 'react-router-dom';
4
5
  import i18next, { t as t$1 } from 'i18next';
5
6
  import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL, SINGULAR } from '@bigbinary/neeto-commons-frontend/constants';
6
7
  import { Button, Tag, Pane, Typography, Label, Textarea, Table as Table$1, NoData, Alert, Tab as Tab$1, Select as Select$1, Callout } from '@bigbinary/neetoui';
7
8
  import { curryN, isNil, curry, complement, either, isEmpty, keys } from 'ramda';
8
- import { useMutationWithInvalidation, useDebounce, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
9
9
  import { useTranslation, Trans } from 'react-i18next';
10
10
  import { useQuery, useQueryClient } from 'react-query';
11
11
  import axios from 'axios';
@@ -1475,9 +1475,7 @@ var createRoutes = function createRoutes(_ref) {
1475
1475
  var Header = function Header(_ref) {
1476
1476
  var _currentTab$actionBlo;
1477
1477
  var appRoutes = _ref.appRoutes,
1478
- breadcrumbs = _ref.breadcrumbs,
1479
- setSearchTerm = _ref.setSearchTerm,
1480
- searchTerm = _ref.searchTerm;
1478
+ breadcrumbs = _ref.breadcrumbs;
1481
1479
  var _useTranslation = useTranslation(),
1482
1480
  t = _useTranslation.t;
1483
1481
  var _useLocation = useLocation(),
@@ -1489,10 +1487,6 @@ var Header = function Header(_ref) {
1489
1487
  actionBlock: currentTab === null || currentTab === void 0 ? void 0 : (_currentTab$actionBlo = currentTab.actionBlock) === null || _currentTab$actionBlo === void 0 ? void 0 : _currentTab$actionBlo.call(currentTab),
1490
1488
  title: t("neetoApprovals.common.approval", PLURAL),
1491
1489
  searchProps: (currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder) && {
1492
- onChange: function onChange(event) {
1493
- return setSearchTerm(event.target.value);
1494
- },
1495
- value: searchTerm,
1496
1490
  placeholder: currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder
1497
1491
  },
1498
1492
  breadcrumbs: breadcrumbs
@@ -1556,14 +1550,13 @@ function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if
1556
1550
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1557
1551
  var Approvals = function Approvals(_ref) {
1558
1552
  var config = _ref.config;
1559
- var _useState = useState(""),
1553
+ var _useQueryParams = useQueryParams(),
1554
+ _useQueryParams$searc = _useQueryParams.search_ter,
1555
+ searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
1556
+ var _useState = useState(false),
1560
1557
  _useState2 = _slicedToArray$1(_useState, 2),
1561
- searchTerm = _useState2[0],
1562
- setSearchTerm = _useState2[1];
1563
- var _useState3 = useState(false),
1564
- _useState4 = _slicedToArray$1(_useState3, 2),
1565
- isNewTemplatePaneOpen = _useState4[0],
1566
- setIsNewTemplatePaneOpen = _useState4[1];
1558
+ isNewTemplatePaneOpen = _useState2[0],
1559
+ setIsNewTemplatePaneOpen = _useState2[1];
1567
1560
  var appRoutes = createRoutes({
1568
1561
  config: config,
1569
1562
  searchTerm: searchTerm,
@@ -1573,9 +1566,7 @@ var Approvals = function Approvals(_ref) {
1573
1566
  return /*#__PURE__*/React.createElement("div", {
1574
1567
  className: "neeto-approvals"
1575
1568
  }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, _objectSpread$1({
1576
- appRoutes: appRoutes,
1577
- searchTerm: searchTerm,
1578
- setSearchTerm: setSearchTerm
1569
+ appRoutes: appRoutes
1579
1570
  }, config)), /*#__PURE__*/React.createElement(Tab, {
1580
1571
  approvalsPath: config.approvalsPath
1581
1572
  }), /*#__PURE__*/React.createElement(Switch, null, appRoutes.map(function (_ref2) {