@box/metadata-view 1.50.16 → 1.51.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/dist/esm/lib/components/filter-row/all-filters-chip.js +28 -27
- package/dist/esm/lib/components/filter-row/filter-row.js +28 -26
- package/dist/types/lib/components/filter-row/all-filters-chip.d.ts +4 -3
- package/dist/types/lib/components/filter-row/filter-row.d.ts +2 -1
- package/package.json +15 -15
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
import { FilterChip as e } from "@box/blueprint-web";
|
|
2
|
-
import { Filter as
|
|
2
|
+
import { Filter as u } from "@box/blueprint-web-assets/icons/Line";
|
|
3
3
|
import { useFormikContext as d } from "formik";
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { getInitialFieldValues as
|
|
7
|
-
import { isFilterSelected as
|
|
4
|
+
import { useState as h, useMemo as F } from "react";
|
|
5
|
+
import { useIntl as g } from "react-intl";
|
|
6
|
+
import { getInitialFieldValues as C } from "./initial-field-values.js";
|
|
7
|
+
import { isFilterSelected as I } from "./is-filter-selected.js";
|
|
8
8
|
import S from "./messages.js";
|
|
9
|
-
import { s as
|
|
10
|
-
import { jsxs as
|
|
11
|
-
import { FilterSidePanel as
|
|
12
|
-
const
|
|
13
|
-
containerRef:
|
|
14
|
-
filterGroups: l
|
|
9
|
+
import { s as v } from "../../../../chunks/filter-row.module.js";
|
|
10
|
+
import { jsxs as m, Fragment as O, jsx as t } from "react/jsx-runtime";
|
|
11
|
+
import { FilterSidePanel as x } from "../filter-sidepanel/filter-side-panel.js";
|
|
12
|
+
const q = ({
|
|
13
|
+
containerRef: p,
|
|
14
|
+
filterGroups: l,
|
|
15
|
+
onAllFiltersClick: r
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
|
-
formatMessage:
|
|
18
|
-
} =
|
|
19
|
-
values:
|
|
20
|
-
} = d(), [
|
|
21
|
-
return /* @__PURE__ */
|
|
18
|
+
formatMessage: c
|
|
19
|
+
} = g(), {
|
|
20
|
+
values: o
|
|
21
|
+
} = d(), [s, a] = h(!1), f = () => r ? r() : a(!0), n = F(() => Object.values(o.metadata.fields).filter((i) => I(i.value)).length, [o.metadata.fields]);
|
|
22
|
+
return /* @__PURE__ */ m(O, {
|
|
22
23
|
children: [
|
|
23
24
|
// We need to initialize the sidepanel state at the moment it is opened
|
|
24
|
-
|
|
25
|
-
containerRef:
|
|
25
|
+
s && /* @__PURE__ */ t(x, {
|
|
26
|
+
containerRef: p,
|
|
26
27
|
filterGroups: l,
|
|
27
|
-
getInitialFormValues: () =>
|
|
28
|
+
getInitialFormValues: () => C(l.flatMap(({
|
|
28
29
|
filters: i
|
|
29
30
|
}) => i)),
|
|
30
|
-
isOpen:
|
|
31
|
-
onIsOpenChange:
|
|
31
|
+
isOpen: s,
|
|
32
|
+
onIsOpenChange: a
|
|
32
33
|
}),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
onClick:
|
|
34
|
+
/* @__PURE__ */ m(e.ChipButton, {
|
|
35
|
+
onClick: f,
|
|
35
36
|
value: "all-filters-chip-btn",
|
|
36
37
|
children: [/* @__PURE__ */ t(e.Icon, {
|
|
37
|
-
className:
|
|
38
|
-
icon:
|
|
38
|
+
className: v.filterChipIcon,
|
|
39
|
+
icon: u
|
|
39
40
|
}), /* @__PURE__ */ t(e.Label, {
|
|
40
|
-
children:
|
|
41
|
+
children: c(S.allFilters)
|
|
41
42
|
}), n > 0 ? /* @__PURE__ */ t(e.Status, {
|
|
42
43
|
children: n.toString()
|
|
43
44
|
}) : null]
|
|
@@ -46,5 +47,5 @@ const P = ({
|
|
|
46
47
|
});
|
|
47
48
|
};
|
|
48
49
|
export {
|
|
49
|
-
|
|
50
|
+
q as default
|
|
50
51
|
};
|
|
@@ -1,51 +1,53 @@
|
|
|
1
|
-
import { FilterChip as
|
|
2
|
-
import { Formik as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import
|
|
5
|
-
import { getInitialFieldValues as
|
|
6
|
-
import { MetadataFilterChip as
|
|
7
|
-
import { usePredefinedFilter as
|
|
8
|
-
import { s as
|
|
9
|
-
import { jsx as i, jsxs as
|
|
1
|
+
import { FilterChip as F } from "@box/blueprint-web";
|
|
2
|
+
import { Formik as C, Form as R } from "formik";
|
|
3
|
+
import { useMemo as y, useRef as G } from "react";
|
|
4
|
+
import j from "./all-filters-chip.js";
|
|
5
|
+
import { getInitialFieldValues as x } from "./initial-field-values.js";
|
|
6
|
+
import { MetadataFilterChip as M } from "./metadata-filter-chip.js";
|
|
7
|
+
import { usePredefinedFilter as b } from "./predefinedFilters/use-predefined-filter.js";
|
|
8
|
+
import { s as w } from "../../../../chunks/filter-row.module.js";
|
|
9
|
+
import { jsx as i, jsxs as S } from "react/jsx-runtime";
|
|
10
10
|
import "./form-filter-chip.js";
|
|
11
11
|
import "./select-filter-chip.js";
|
|
12
12
|
import "./predefinedFilters/index.js";
|
|
13
|
-
const
|
|
13
|
+
const q = ({
|
|
14
14
|
predefinedFilterOptions: p,
|
|
15
15
|
containerRef: s,
|
|
16
16
|
filterGroups: a = [],
|
|
17
17
|
initialFilterValues: t,
|
|
18
18
|
isAllFiltersDisabled: f,
|
|
19
|
+
onAllFiltersClick: n,
|
|
19
20
|
onFilterSubmit: o
|
|
20
21
|
}) => {
|
|
21
|
-
const
|
|
22
|
+
const d = b(p), u = ({
|
|
22
23
|
metadata: {
|
|
23
24
|
fields: e
|
|
24
25
|
}
|
|
25
26
|
}) => {
|
|
26
27
|
o && o(e);
|
|
27
|
-
}, l = [...
|
|
28
|
+
}, l = [...d, ...a], r = l.flatMap(({
|
|
28
29
|
filters: e
|
|
29
|
-
}) => e),
|
|
30
|
-
() =>
|
|
30
|
+
}) => e), c = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), h = y(
|
|
31
|
+
() => x(r, t),
|
|
31
32
|
// Intentionally depend on filterSchemaKey (not filterOptions identity) to prevent unwanted reinitialization
|
|
32
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- depend on schema key instead of filterOptions identity
|
|
33
|
-
[
|
|
34
|
-
), m =
|
|
35
|
-
return /* @__PURE__ */ i(
|
|
34
|
+
[c, t]
|
|
35
|
+
), m = G(null);
|
|
36
|
+
return /* @__PURE__ */ i(C, {
|
|
36
37
|
enableReinitialize: !0,
|
|
37
|
-
initialValues:
|
|
38
|
-
onSubmit:
|
|
39
|
-
children: /* @__PURE__ */ i(
|
|
38
|
+
initialValues: h,
|
|
39
|
+
onSubmit: u,
|
|
40
|
+
children: /* @__PURE__ */ i(R, {
|
|
40
41
|
ref: m,
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
className:
|
|
42
|
+
children: /* @__PURE__ */ S(F.Group, {
|
|
43
|
+
className: w.filterChipGroup,
|
|
43
44
|
name: "metadata-view-filters",
|
|
44
45
|
type: "multiple",
|
|
45
|
-
children: [f ? null : /* @__PURE__ */ i(
|
|
46
|
+
children: [f ? null : /* @__PURE__ */ i(j, {
|
|
46
47
|
containerRef: s,
|
|
47
|
-
filterGroups: l
|
|
48
|
-
|
|
48
|
+
filterGroups: l,
|
|
49
|
+
onAllFiltersClick: n
|
|
50
|
+
}), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(M, {
|
|
49
51
|
filterOption: e,
|
|
50
52
|
formRef: m
|
|
51
53
|
}, e.id))]
|
|
@@ -54,5 +56,5 @@ const T = ({
|
|
|
54
56
|
});
|
|
55
57
|
};
|
|
56
58
|
export {
|
|
57
|
-
|
|
59
|
+
q as FilterRow
|
|
58
60
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FilterGroup } from './types';
|
|
2
|
-
|
|
2
|
+
type AllFiltersChipProps = {
|
|
3
3
|
containerRef?: React.RefObject<HTMLElement>;
|
|
4
4
|
filterGroups: Array<FilterGroup>;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
onAllFiltersClick?: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare const AllFiltersChip: ({ containerRef, filterGroups, onAllFiltersClick }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export default AllFiltersChip;
|
|
@@ -6,6 +6,7 @@ export interface FilterRowProps {
|
|
|
6
6
|
filterGroups?: Array<FilterGroup>;
|
|
7
7
|
initialFilterValues?: InitialFilterValues;
|
|
8
8
|
isAllFiltersDisabled?: boolean;
|
|
9
|
+
onAllFiltersClick?: () => void;
|
|
9
10
|
onFilterSubmit?: (fields: FilterValues) => void;
|
|
10
11
|
}
|
|
11
|
-
export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onAllFiltersClick, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.51.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^13.5.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.104.
|
|
8
|
-
"@box/box-item-type-selector": "^1.38.
|
|
9
|
-
"@box/item-icon": "^2.30.
|
|
10
|
-
"@box/metadata-filter": "^1.78.
|
|
11
|
-
"@box/types": "2.1.
|
|
6
|
+
"@box/blueprint-web": "^13.5.10",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.104.5",
|
|
8
|
+
"@box/box-item-type-selector": "^1.38.15",
|
|
9
|
+
"@box/item-icon": "^2.30.16",
|
|
10
|
+
"@box/metadata-filter": "^1.78.7",
|
|
11
|
+
"@box/types": "2.1.6",
|
|
12
12
|
"@tanstack/react-virtual": "^3.10.8",
|
|
13
13
|
"formik": "^2.4.5",
|
|
14
14
|
"lodash": "^4.17.15",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"react-intl": "^6.4.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@box/blueprint-web": "^13.5.
|
|
22
|
-
"@box/blueprint-web-assets": "^4.104.
|
|
23
|
-
"@box/box-item-type-selector": "^1.38.
|
|
24
|
-
"@box/eslint-plugin-blueprint": "1.1.
|
|
25
|
-
"@box/item-icon": "^2.30.
|
|
26
|
-
"@box/metadata-filter": "^1.78.
|
|
27
|
-
"@box/storybook-utils": "0.16.
|
|
28
|
-
"@box/types": "2.1.
|
|
21
|
+
"@box/blueprint-web": "^13.5.10",
|
|
22
|
+
"@box/blueprint-web-assets": "^4.104.5",
|
|
23
|
+
"@box/box-item-type-selector": "^1.38.15",
|
|
24
|
+
"@box/eslint-plugin-blueprint": "1.1.5",
|
|
25
|
+
"@box/item-icon": "^2.30.16",
|
|
26
|
+
"@box/metadata-filter": "^1.78.7",
|
|
27
|
+
"@box/storybook-utils": "0.16.66",
|
|
28
|
+
"@box/types": "2.1.6",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|
|
30
30
|
"react-intl": "^6.4.2"
|
|
31
31
|
},
|