@box/metadata-view 1.54.9 → 1.54.11
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/chunks/action-bar.js +48 -0
- package/dist/chunks/empty-state.js +24 -0
- package/dist/chunks/error-state.js +23 -0
- package/dist/chunks/filter-row.module.js +6 -8
- package/dist/chunks/filter-side-panel.js +65 -0
- package/dist/chunks/header.js +56 -0
- package/dist/chunks/inline-editing-cell.js +34 -0
- package/dist/chunks/item-action-menu.js +86 -0
- package/dist/chunks/metadata-grid.js +44 -0
- package/dist/chunks/metadata-location-field.js +35 -0
- package/dist/chunks/metadata-view.js +102 -0
- package/dist/chunks/pagination-controls.js +40 -0
- package/dist/chunks/table-row.js +72 -0
- package/dist/chunks/types.js +6 -11
- package/dist/chunks/types2.js +4 -0
- package/dist/chunks/zoom-button.js +20 -0
- package/dist/esm/index.js +29 -59
- package/dist/esm/lib/components/action-bar/action-bar.js +2 -62
- package/dist/esm/lib/components/action-bar/index.js +2 -4
- package/dist/esm/lib/components/action-bar/messages.js +22 -24
- package/dist/esm/lib/components/action-bar/zoom-button.js +2 -30
- package/dist/esm/lib/components/constants.js +14 -6
- package/dist/esm/lib/components/empty-state/empty-state.js +2 -30
- package/dist/esm/lib/components/empty-state/index.js +2 -4
- package/dist/esm/lib/components/empty-state/messages.js +10 -12
- package/dist/esm/lib/components/error-state/error-state.js +2 -31
- package/dist/esm/lib/components/error-state/index.js +2 -4
- package/dist/esm/lib/components/error-state/messages.js +10 -12
- package/dist/esm/lib/components/filter-row/advanced-field-content.js +30 -52
- package/dist/esm/lib/components/filter-row/advanced-filter-context.js +3 -6
- package/dist/esm/lib/components/filter-row/all-filters-chip.js +31 -49
- package/dist/esm/lib/components/filter-row/filter-row.js +35 -59
- package/dist/esm/lib/components/filter-row/form-filter-chip.js +84 -113
- package/dist/esm/lib/components/filter-row/index.js +6 -12
- package/dist/esm/lib/components/filter-row/initial-field-values.js +31 -51
- package/dist/esm/lib/components/filter-row/is-blank-or-not-blank-filter.js +2 -4
- package/dist/esm/lib/components/filter-row/is-filter-selected.js +37 -58
- package/dist/esm/lib/components/filter-row/messages.js +38 -40
- package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +74 -103
- package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -6
- package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +14 -21
- package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +58 -71
- package/dist/esm/lib/components/filter-row/select-filter-chip.js +41 -58
- package/dist/esm/lib/components/filter-row/use-form-filter-chip.js +36 -40
- package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +2 -82
- package/dist/esm/lib/components/filter-sidepanel/filter.js +95 -140
- package/dist/esm/lib/components/filter-sidepanel/index.js +3 -6
- package/dist/esm/lib/components/filter-sidepanel/messages.js +18 -20
- package/dist/esm/lib/components/header/header.js +2 -82
- package/dist/esm/lib/components/header/index.js +2 -4
- package/dist/esm/lib/components/header/messages.js +14 -16
- package/dist/esm/lib/components/index.js +26 -53
- package/dist/esm/lib/components/item-action-menu/identifier.js +4 -7
- package/dist/esm/lib/components/item-action-menu/index.js +2 -4
- package/dist/esm/lib/components/item-action-menu/item-action-menu.js +2 -127
- package/dist/esm/lib/components/item-action-menu/messages.js +5 -9
- package/dist/esm/lib/components/metadata-grid/index.js +2 -4
- package/dist/esm/lib/components/metadata-grid/messages.js +5 -9
- package/dist/esm/lib/components/metadata-grid/metadata-grid.js +2 -62
- package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -5
- package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +24 -29
- package/dist/esm/lib/components/metadata-table/index.js +4 -8
- package/dist/esm/lib/components/metadata-table/messages.js +14 -16
- package/dist/esm/lib/components/metadata-table/metadata-table.js +89 -127
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +10 -19
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/ghost-table-row.js +8 -19
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/index.js +2 -4
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +2 -4
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +2 -56
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +135 -209
- package/dist/esm/lib/components/metadata-table/table-body/table-row/index.js +2 -4
- package/dist/esm/lib/components/metadata-table/table-body/table-row/table-row.js +2 -12
- package/dist/esm/lib/components/metadata-table/table-renderer.js +34 -55
- package/dist/esm/lib/components/metadata-value/index.js +6 -12
- package/dist/esm/lib/components/metadata-value/messages.js +15 -17
- package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +24 -34
- package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +14 -22
- package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -19
- package/dist/esm/lib/components/metadata-value/metadata-location-field.js +2 -48
- package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +26 -37
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +19 -30
- package/dist/esm/lib/components/pagination/index.js +4 -9
- package/dist/esm/lib/components/pagination/marker-based-pagination.js +12 -19
- package/dist/esm/lib/components/pagination/messages.js +19 -21
- package/dist/esm/lib/components/pagination/offset-based-pagination.js +22 -31
- package/dist/esm/lib/components/pagination/pagination-controls.js +2 -53
- package/dist/esm/lib/components/pagination/pagination.js +20 -35
- package/dist/esm/lib/components/pagination/utils.js +4 -6
- package/dist/esm/lib/components/sort-dropdown/index.js +2 -4
- package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +37 -56
- package/dist/esm/lib/components/switch-case/index.js +2 -5
- package/dist/esm/lib/components/switch-case/switch-case.js +4 -12
- package/dist/esm/lib/hooks/use-header.js +41 -37
- package/dist/esm/lib/index.js +28 -59
- package/dist/esm/lib/metadata-view.js +2 -151
- package/dist/styles/action-bar.css +1 -1
- package/dist/styles/empty-state.css +1 -1
- package/dist/styles/filter-row.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/inline-editing-cell.css +1 -1
- package/dist/styles/item-action-menu.css +1 -1
- package/dist/styles/metadata-grid.css +1 -1
- package/dist/styles/metadata-view.css +1 -1
- package/dist/styles/pagination-controls.css +1 -1
- package/dist/styles/table-row.css +1 -0
- package/dist/styles/zoom-button.css +1 -1
- package/package.json +14 -14
- package/dist/chunks/index.js +0 -105
- package/dist/styles/index.css +0 -1
|
@@ -1,104 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { jsx as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
case "string":
|
|
75
|
-
return /* @__PURE__ */ t(o, {
|
|
76
|
-
formRef: a,
|
|
77
|
-
icon: r,
|
|
78
|
-
id: e,
|
|
79
|
-
name: i,
|
|
80
|
-
children: /* @__PURE__ */ t(M, {
|
|
81
|
-
fieldNamePrefix: l,
|
|
82
|
-
label: d
|
|
83
|
-
})
|
|
84
|
-
}, e);
|
|
85
|
-
case "multiSelect":
|
|
86
|
-
case "enum":
|
|
87
|
-
return /* @__PURE__ */ t(D, {
|
|
88
|
-
fieldNamePrefix: l,
|
|
89
|
-
formRef: a,
|
|
90
|
-
icon: r,
|
|
91
|
-
id: e,
|
|
92
|
-
name: i,
|
|
93
|
-
options: f,
|
|
94
|
-
placeholder: h,
|
|
95
|
-
type: n
|
|
96
|
-
});
|
|
97
|
-
default:
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
export {
|
|
102
|
-
N as MetadataFilterChip,
|
|
103
|
-
N as default
|
|
1
|
+
import { MetadataFileChip as e } from "../metadata-value/metadata-file-chip.js";
|
|
2
|
+
import { AdvancedFieldContent as t } from "./advanced-field-content.js";
|
|
3
|
+
import { FormFilterChip as n } from "./form-filter-chip.js";
|
|
4
|
+
import { SelectFilterChip as r } from "./select-filter-chip.js";
|
|
5
|
+
import { useIntl as i } from "react-intl";
|
|
6
|
+
import { MetadataDateField as a, MetadataFloatField as o, MetadataStringField as s } from "@box/metadata-filter";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
var l = ({ filterOption: l, formRef: u }) => {
|
|
9
|
+
let { advancedFilterOptionsMap: d, canUseRelativeDates: f, customDateFilterOptions: p, fieldType: m, icon: h, id: g, isAdvancedFilterEnabled: _, name: v, options: y, placeholder: b, variant: x } = l, { locale: S } = i(), C = `metadata.fields.${g}`, w = v ?? "";
|
|
10
|
+
if (m === "multiSelect" && x === "file") return /* @__PURE__ */ c(e, { id: g });
|
|
11
|
+
if (_) return /* @__PURE__ */ c(n, {
|
|
12
|
+
advancedFilterOptionsMap: d,
|
|
13
|
+
formRef: u,
|
|
14
|
+
icon: h,
|
|
15
|
+
id: g,
|
|
16
|
+
isAdvancedFilterEnabled: !0,
|
|
17
|
+
name: v,
|
|
18
|
+
children: /* @__PURE__ */ c(t, {
|
|
19
|
+
fieldType: m,
|
|
20
|
+
fieldNamePrefix: C,
|
|
21
|
+
filterOptionsMap: d,
|
|
22
|
+
label: w,
|
|
23
|
+
locale: S
|
|
24
|
+
})
|
|
25
|
+
}, g);
|
|
26
|
+
switch (m) {
|
|
27
|
+
case "date": return /* @__PURE__ */ c(n, {
|
|
28
|
+
formRef: u,
|
|
29
|
+
icon: h,
|
|
30
|
+
id: g,
|
|
31
|
+
name: v,
|
|
32
|
+
children: /* @__PURE__ */ c(a, {
|
|
33
|
+
canUseRelativeDates: f,
|
|
34
|
+
customDateFilterOptions: p,
|
|
35
|
+
direction: "vertical",
|
|
36
|
+
fieldNamePrefix: C,
|
|
37
|
+
label: w,
|
|
38
|
+
locale: S
|
|
39
|
+
})
|
|
40
|
+
}, g);
|
|
41
|
+
case "float": return /* @__PURE__ */ c(n, {
|
|
42
|
+
formRef: u,
|
|
43
|
+
icon: h,
|
|
44
|
+
id: g,
|
|
45
|
+
name: v,
|
|
46
|
+
children: /* @__PURE__ */ c(o, {
|
|
47
|
+
fieldNamePrefix: C,
|
|
48
|
+
label: w
|
|
49
|
+
})
|
|
50
|
+
}, g);
|
|
51
|
+
case "string": return /* @__PURE__ */ c(n, {
|
|
52
|
+
formRef: u,
|
|
53
|
+
icon: h,
|
|
54
|
+
id: g,
|
|
55
|
+
name: v,
|
|
56
|
+
children: /* @__PURE__ */ c(s, {
|
|
57
|
+
fieldNamePrefix: C,
|
|
58
|
+
label: w
|
|
59
|
+
})
|
|
60
|
+
}, g);
|
|
61
|
+
case "multiSelect":
|
|
62
|
+
case "enum": return /* @__PURE__ */ c(r, {
|
|
63
|
+
fieldNamePrefix: C,
|
|
64
|
+
formRef: u,
|
|
65
|
+
icon: h,
|
|
66
|
+
id: g,
|
|
67
|
+
name: v,
|
|
68
|
+
options: y,
|
|
69
|
+
placeholder: b,
|
|
70
|
+
type: m
|
|
71
|
+
});
|
|
72
|
+
default: return null;
|
|
73
|
+
}
|
|
104
74
|
};
|
|
75
|
+
export { l as MetadataFilterChip, l as default };
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
})({});
|
|
4
|
-
export {
|
|
5
|
-
o as PredefinedFilterName
|
|
6
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../chunks/types2.js";
|
|
2
|
+
export { e as PredefinedFilterName };
|
package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
console.error("Custom callback needs to be provided");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
return o(i, r);
|
|
1
|
+
import { t as e } from "../../../../../chunks/types2.js";
|
|
2
|
+
import t from "lodash/merge";
|
|
3
|
+
function n(n = {}) {
|
|
4
|
+
return t({
|
|
5
|
+
[e.KeywordSearchFilterGroup]: { isDisabled: !1 },
|
|
6
|
+
[e.FileTypeFilterGroup]: { isDisabled: !1 },
|
|
7
|
+
[e.LocationFilterGroup]: {
|
|
8
|
+
isDisabled: !1,
|
|
9
|
+
triggerCallback: () => {
|
|
10
|
+
console.error("Custom callback needs to be provided");
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}, n);
|
|
19
14
|
}
|
|
20
|
-
export {
|
|
21
|
-
a as predefinedFilterOptionsFactory
|
|
22
|
-
};
|
|
15
|
+
export { n as predefinedFilterOptionsFactory };
|
|
@@ -1,72 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { predefinedFilterOptionsFactory as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return t ? [] : [{
|
|
59
|
-
filters: [{
|
|
60
|
-
...c,
|
|
61
|
-
...e
|
|
62
|
-
}],
|
|
63
|
-
title: r(o.locationFilterTitle),
|
|
64
|
-
toggleable: !0
|
|
65
|
-
}];
|
|
66
|
-
}, h = (t = {}) => {
|
|
67
|
-
const e = a(t), r = d(e[i.KeywordSearchFilterGroup]), n = u(e[i.FileTypeFilterGroup]), s = m(e[i.LocationFilterGroup]);
|
|
68
|
-
return [...r, ...n, ...s];
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
h as usePredefinedFilter
|
|
1
|
+
import e from "../messages.js";
|
|
2
|
+
import { t } from "../../../../../chunks/types2.js";
|
|
3
|
+
import { predefinedFilterOptionsFactory as n } from "./predefined-filter-options-factory.js";
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
var i = {
|
|
6
|
+
fieldType: "string",
|
|
7
|
+
id: "keyword-filter",
|
|
8
|
+
name: "",
|
|
9
|
+
selected: !1,
|
|
10
|
+
variant: "search"
|
|
11
|
+
}, a = {
|
|
12
|
+
fieldType: "multiSelect",
|
|
13
|
+
id: "mimetype-filter",
|
|
14
|
+
name: "",
|
|
15
|
+
selected: !1,
|
|
16
|
+
shouldRenderChip: !0,
|
|
17
|
+
variant: "file"
|
|
18
|
+
}, o = {
|
|
19
|
+
fieldType: "enum",
|
|
20
|
+
id: "location-filter",
|
|
21
|
+
name: "",
|
|
22
|
+
selected: !1,
|
|
23
|
+
shouldRenderChip: !1,
|
|
24
|
+
variant: "file"
|
|
25
|
+
}, s = ({ isDisabled: t }) => {
|
|
26
|
+
let { formatMessage: n } = r();
|
|
27
|
+
return t ? [] : [{
|
|
28
|
+
filters: [{
|
|
29
|
+
...i,
|
|
30
|
+
placeholder: n(e.keywordSearchFilterPlaceholder)
|
|
31
|
+
}],
|
|
32
|
+
toggleable: !1
|
|
33
|
+
}];
|
|
34
|
+
}, c = ({ isDisabled: t }) => {
|
|
35
|
+
let { formatMessage: n } = r();
|
|
36
|
+
return t ? [] : [{
|
|
37
|
+
filters: [{ ...a }],
|
|
38
|
+
title: n(e.fileTypeFilterTitle),
|
|
39
|
+
toggleable: !0
|
|
40
|
+
}];
|
|
41
|
+
}, l = ({ isDisabled: t, ...n }) => {
|
|
42
|
+
let { formatMessage: i } = r();
|
|
43
|
+
return t ? [] : [{
|
|
44
|
+
filters: [{
|
|
45
|
+
...o,
|
|
46
|
+
...n
|
|
47
|
+
}],
|
|
48
|
+
title: i(e.locationFilterTitle),
|
|
49
|
+
toggleable: !0
|
|
50
|
+
}];
|
|
51
|
+
}, u = (e = {}) => {
|
|
52
|
+
let r = n(e), i = s(r[t.KeywordSearchFilterGroup]), a = c(r[t.FileTypeFilterGroup]), o = l(r[t.LocationFilterGroup]);
|
|
53
|
+
return [
|
|
54
|
+
...i,
|
|
55
|
+
...a,
|
|
56
|
+
...o
|
|
57
|
+
];
|
|
72
58
|
};
|
|
59
|
+
export { u as usePredefinedFilter };
|
|
@@ -1,59 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}), /* @__PURE__ */ t(c.DropdownIndicator, {})]
|
|
42
|
-
}, i)
|
|
43
|
-
}), /* @__PURE__ */ a(o.Content, {
|
|
44
|
-
container: C.current,
|
|
45
|
-
children: [y && /* @__PURE__ */ t(o.CheckboxItem, {
|
|
46
|
-
checked: e.size === 0,
|
|
47
|
-
onCheckedChange: (r) => d(r, n),
|
|
48
|
-
children: n
|
|
49
|
-
}, n), f?.map((r) => /* @__PURE__ */ t(o.CheckboxItem, {
|
|
50
|
-
checked: e.has(r),
|
|
51
|
-
onCheckedChange: (s) => d(s, r),
|
|
52
|
-
children: r
|
|
53
|
-
}, r))]
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
R as SelectFilterChip
|
|
1
|
+
import e from "./messages.js";
|
|
2
|
+
import { DropdownMenu as t, FilterChip as n } from "@box/blueprint-web";
|
|
3
|
+
import { useState as r } from "react";
|
|
4
|
+
import { useIntl as i } from "react-intl";
|
|
5
|
+
import { useFormikContext as a } from "formik";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
var c = ({ fieldNamePrefix: c, formRef: l, icon: u, id: d, name: f = "", options: p, type: m, placeholder: h }) => {
|
|
8
|
+
let { formatMessage: g } = i(), [_, v] = r(!1), { values: y, setFieldValue: b, submitForm: x } = a(), S = y.metadata?.fields?.[d]?.value?.enum, C = new Set(Array.isArray(S) ? S : []), w = C.size > 0 ? g(e.chipNameWithCount, {
|
|
9
|
+
name: f,
|
|
10
|
+
count: C.size
|
|
11
|
+
}) : f, T = !!h && m !== "multiSelect", E = async (e, t) => {
|
|
12
|
+
m === "enum" ? C.clear() : C.delete(t), e && t !== h && C.add(t), await b(`${c}.value.enum`, Array.from(C)), x();
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ s(t.Root, {
|
|
15
|
+
onOpenChange: v,
|
|
16
|
+
open: _,
|
|
17
|
+
children: [/* @__PURE__ */ o(t.Trigger, {
|
|
18
|
+
asChild: !0,
|
|
19
|
+
children: /* @__PURE__ */ s(n.TriggerChip, {
|
|
20
|
+
selected: C.size > 0,
|
|
21
|
+
value: d,
|
|
22
|
+
children: [
|
|
23
|
+
u && /* @__PURE__ */ o(n.Icon, { icon: u }),
|
|
24
|
+
/* @__PURE__ */ o(n.Label, { children: w }),
|
|
25
|
+
/* @__PURE__ */ o(n.DropdownIndicator, {})
|
|
26
|
+
]
|
|
27
|
+
}, d)
|
|
28
|
+
}), /* @__PURE__ */ s(t.Content, {
|
|
29
|
+
container: l.current,
|
|
30
|
+
children: [T && /* @__PURE__ */ o(t.CheckboxItem, {
|
|
31
|
+
checked: C.size === 0,
|
|
32
|
+
onCheckedChange: (e) => E(e, h),
|
|
33
|
+
children: h
|
|
34
|
+
}, h), p?.map((e) => /* @__PURE__ */ o(t.CheckboxItem, {
|
|
35
|
+
checked: C.has(e),
|
|
36
|
+
onCheckedChange: (t) => E(t, e),
|
|
37
|
+
children: e
|
|
38
|
+
}, e))]
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
59
41
|
};
|
|
42
|
+
export { c as SelectFilterChip };
|
|
@@ -1,41 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
handleClear: h
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
b as useFormFilterChip
|
|
1
|
+
import { isBlankOrNotBlankFilter as e } from "./is-blank-or-not-blank-filter.js";
|
|
2
|
+
import t from "./messages.js";
|
|
3
|
+
import { useCallback as n, useMemo as r, useState as i } from "react";
|
|
4
|
+
import { useIntl as a } from "react-intl";
|
|
5
|
+
var o = ({ name: o, advancedFilterOptionsMap: s, initialAdvancedFilterOption: c }) => {
|
|
6
|
+
let { formatMessage: l } = a(), [u, d] = i(c), [f, p] = i(c), m = n((e) => {
|
|
7
|
+
d(e);
|
|
8
|
+
}, []), h = n(() => {
|
|
9
|
+
p(u);
|
|
10
|
+
}, [u]), g = n(() => {
|
|
11
|
+
d(f);
|
|
12
|
+
}, [f]), _ = n(() => {
|
|
13
|
+
d(void 0), p(void 0);
|
|
14
|
+
}, []);
|
|
15
|
+
return {
|
|
16
|
+
currentAdvancedFilterOption: u,
|
|
17
|
+
appliedAdvancedFilterOption: f,
|
|
18
|
+
dynamicDisplayName: r(() => {
|
|
19
|
+
if (!f || !e(f)) return o;
|
|
20
|
+
let [, n] = s?.find(([e]) => e === f) ?? [];
|
|
21
|
+
return n ? l(t.chipNameWithFilterOption, {
|
|
22
|
+
name: o,
|
|
23
|
+
optionLabel: n
|
|
24
|
+
}) : o;
|
|
25
|
+
}, [
|
|
26
|
+
o,
|
|
27
|
+
f,
|
|
28
|
+
s,
|
|
29
|
+
l
|
|
30
|
+
]),
|
|
31
|
+
handleAdvancedFilterOptionChange: m,
|
|
32
|
+
handleApply: h,
|
|
33
|
+
handleCancel: g,
|
|
34
|
+
handleClear: _
|
|
35
|
+
};
|
|
41
36
|
};
|
|
37
|
+
export { o as useFormFilterChip };
|
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useIntl as j } from "react-intl";
|
|
4
|
-
import { useFormikContext as B } from "formik";
|
|
5
|
-
import R from "lodash/noop";
|
|
6
|
-
import { useState as u } from "react";
|
|
7
|
-
import i from "./messages.js";
|
|
8
|
-
import { jsx as e, jsxs as p } from "react/jsx-runtime";
|
|
9
|
-
import '../../../../styles/filter-side-panel.css';const k = "_sidePanelContent_1j6pr_1", A = "_staticPosition_1j6pr_1", a = {
|
|
10
|
-
sidePanelContent: k,
|
|
11
|
-
staticPosition: A
|
|
12
|
-
}, M = ({
|
|
13
|
-
containerRef: h,
|
|
14
|
-
filterGroups: r,
|
|
15
|
-
isOpen: C,
|
|
16
|
-
onIsOpenChange: s = R,
|
|
17
|
-
getInitialFormValues: f
|
|
18
|
-
}) => {
|
|
19
|
-
const {
|
|
20
|
-
formatMessage: o
|
|
21
|
-
} = j(), {
|
|
22
|
-
handleSubmit: P,
|
|
23
|
-
resetForm: c,
|
|
24
|
-
values: F
|
|
25
|
-
} = B(), [S] = u(F), [v, y] = u(null), _ = () => {
|
|
26
|
-
c({
|
|
27
|
-
values: f()
|
|
28
|
-
});
|
|
29
|
-
}, b = (n) => {
|
|
30
|
-
c({
|
|
31
|
-
values: S
|
|
32
|
-
}), s(n);
|
|
33
|
-
}, g = () => {
|
|
34
|
-
P(), s(!1);
|
|
35
|
-
};
|
|
36
|
-
return /* @__PURE__ */ e(t, {
|
|
37
|
-
onOpenChange: b,
|
|
38
|
-
open: C,
|
|
39
|
-
variant: "overlay",
|
|
40
|
-
children: /* @__PURE__ */ e(t.Overlay, {
|
|
41
|
-
container: h?.current,
|
|
42
|
-
children: /* @__PURE__ */ p(t.Content, {
|
|
43
|
-
className: a.sidePanelContent,
|
|
44
|
-
children: [/* @__PURE__ */ e(t.Header, {
|
|
45
|
-
className: a.staticPosition,
|
|
46
|
-
children: o(i.filtersHeader)
|
|
47
|
-
}), /* @__PURE__ */ e(t.ScrollableContainer, {
|
|
48
|
-
ref: y,
|
|
49
|
-
children: /* @__PURE__ */ e(d, {
|
|
50
|
-
defaultValue: r.map((n, l) => `item-${l}`),
|
|
51
|
-
type: "multiple",
|
|
52
|
-
children: r.map((n, l) => /* @__PURE__ */ e(d.Item, {
|
|
53
|
-
...n.toggleable ? {} : {
|
|
54
|
-
fixed: "true"
|
|
55
|
-
},
|
|
56
|
-
title: n.title,
|
|
57
|
-
value: `item-${l}`,
|
|
58
|
-
children: n.filters.map((m) => /* @__PURE__ */ e(x, {
|
|
59
|
-
...m,
|
|
60
|
-
parentRef: v
|
|
61
|
-
}, m.id))
|
|
62
|
-
}, `accordion-item-${n.title || "unnamed"}`))
|
|
63
|
-
})
|
|
64
|
-
}), /* @__PURE__ */ p(t.Footer, {
|
|
65
|
-
className: a.staticPosition,
|
|
66
|
-
children: [/* @__PURE__ */ e(t.Footer.SecondaryButton, {
|
|
67
|
-
onClick: _,
|
|
68
|
-
children: o(i.clearAllButton)
|
|
69
|
-
}), /* @__PURE__ */ e(t.Footer.PrimaryButton, {
|
|
70
|
-
onClick: g,
|
|
71
|
-
children: o(i.showResultsButton)
|
|
72
|
-
})]
|
|
73
|
-
}), /* @__PURE__ */ e(t.Close, {
|
|
74
|
-
"aria-label": o(i.closeAriaLabel)
|
|
75
|
-
})]
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
export {
|
|
81
|
-
M as FilterSidePanel
|
|
82
|
-
};
|
|
1
|
+
import { t as e } from "../../../../chunks/filter-side-panel.js";
|
|
2
|
+
export { e as FilterSidePanel };
|