@doyourjob/gravity-ui-page-constructor 5.31.63 → 5.31.65

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.
@@ -5,6 +5,9 @@ unpredictable css rules order in build */
5
5
  }
6
6
  .pc-reports-block__select {
7
7
  margin-bottom: 32px;
8
+ gap: 16px;
9
+ display: flex;
10
+ flex-wrap: wrap;
8
11
  }
9
12
  .pc-reports-block__empty {
10
13
  font-size: var(--g-text-body-2-font-size, var(--pc-text-body-2-font-size));
@@ -18,15 +18,12 @@ const ReportsBlock = ({ title, typeKey, empty }) => {
18
18
  const initFilters = (0, react_1.useMemo)(() => (selects === null || selects === void 0 ? void 0 : selects.reduce((acc, select) => (Object.assign(Object.assign({}, acc), { [select.name]: select.init })), {})) || {}, [selects]);
19
19
  const [localFilters, setLocalFilters] = (0, react_1.useState)(initFilters);
20
20
  const handleChange = (0, react_1.useCallback)((name, value) => setLocalFilters((prev) => (Object.assign(Object.assign({}, prev), { [name]: value }))), []);
21
- const filteredItems = (0, react_1.useMemo)(() => Object.keys(localFilters).length
22
- ? items.filter((item) => Object.entries(localFilters).reduce((acc, [key, value]) => {
23
- var _a, _b;
24
- if ((_b = (_a = item.filters) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.includes(value)) {
25
- return true;
26
- }
27
- return acc;
28
- }, false))
29
- : items, [items, localFilters]);
21
+ const filteredItems = (0, react_1.useMemo)(() => {
22
+ const f = Object.entries(localFilters).filter(([_, value]) => value !== 'all');
23
+ return f.length
24
+ ? items.filter((item) => f.every(([key, value]) => { var _a, _b; return (_b = (_a = item.filters) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.includes(value); }))
25
+ : items;
26
+ }, [items, localFilters]);
30
27
  const paginatedItems = (0, react_1.useMemo)(() => {
31
28
  if (!itemsPerPage)
32
29
  return filteredItems;
@@ -5,6 +5,9 @@ unpredictable css rules order in build */
5
5
  }
6
6
  .pc-reports-block__select {
7
7
  margin-bottom: 32px;
8
+ gap: 16px;
9
+ display: flex;
10
+ flex-wrap: wrap;
8
11
  }
9
12
  .pc-reports-block__empty {
10
13
  font-size: var(--g-text-body-2-font-size, var(--pc-text-body-2-font-size));
@@ -15,15 +15,12 @@ export const ReportsBlock = ({ title, typeKey, empty }) => {
15
15
  const initFilters = useMemo(() => (selects === null || selects === void 0 ? void 0 : selects.reduce((acc, select) => (Object.assign(Object.assign({}, acc), { [select.name]: select.init })), {})) || {}, [selects]);
16
16
  const [localFilters, setLocalFilters] = useState(initFilters);
17
17
  const handleChange = useCallback((name, value) => setLocalFilters((prev) => (Object.assign(Object.assign({}, prev), { [name]: value }))), []);
18
- const filteredItems = useMemo(() => Object.keys(localFilters).length
19
- ? items.filter((item) => Object.entries(localFilters).reduce((acc, [key, value]) => {
20
- var _a, _b;
21
- if ((_b = (_a = item.filters) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.includes(value)) {
22
- return true;
23
- }
24
- return acc;
25
- }, false))
26
- : items, [items, localFilters]);
18
+ const filteredItems = useMemo(() => {
19
+ const f = Object.entries(localFilters).filter(([_, value]) => value !== 'all');
20
+ return f.length
21
+ ? items.filter((item) => f.every(([key, value]) => { var _a, _b; return (_b = (_a = item.filters) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.includes(value); }))
22
+ : items;
23
+ }, [items, localFilters]);
27
24
  const paginatedItems = useMemo(() => {
28
25
  if (!itemsPerPage)
29
26
  return filteredItems;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doyourjob/gravity-ui-page-constructor",
3
- "version": "5.31.63",
3
+ "version": "5.31.65",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {