@box/metadata-view 1.54.8 → 1.54.10

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.
Files changed (109) hide show
  1. package/dist/chunks/action-bar.js +48 -0
  2. package/dist/chunks/empty-state.js +24 -0
  3. package/dist/chunks/error-state.js +23 -0
  4. package/dist/chunks/filter-row.module.js +6 -8
  5. package/dist/chunks/filter-side-panel.js +65 -0
  6. package/dist/chunks/header.js +56 -0
  7. package/dist/chunks/inline-editing-cell.js +34 -0
  8. package/dist/chunks/item-action-menu.js +86 -0
  9. package/dist/chunks/metadata-grid.js +44 -0
  10. package/dist/chunks/metadata-location-field.js +35 -0
  11. package/dist/chunks/metadata-view.js +102 -0
  12. package/dist/chunks/pagination-controls.js +40 -0
  13. package/dist/chunks/table-row.js +72 -0
  14. package/dist/chunks/types.js +6 -11
  15. package/dist/chunks/types2.js +4 -0
  16. package/dist/chunks/zoom-button.js +20 -0
  17. package/dist/esm/index.js +29 -59
  18. package/dist/esm/lib/components/action-bar/action-bar.js +2 -62
  19. package/dist/esm/lib/components/action-bar/index.js +2 -4
  20. package/dist/esm/lib/components/action-bar/messages.js +22 -24
  21. package/dist/esm/lib/components/action-bar/zoom-button.js +2 -30
  22. package/dist/esm/lib/components/constants.js +14 -6
  23. package/dist/esm/lib/components/empty-state/empty-state.js +2 -30
  24. package/dist/esm/lib/components/empty-state/index.js +2 -4
  25. package/dist/esm/lib/components/empty-state/messages.js +10 -12
  26. package/dist/esm/lib/components/error-state/error-state.js +2 -31
  27. package/dist/esm/lib/components/error-state/index.js +2 -4
  28. package/dist/esm/lib/components/error-state/messages.js +10 -12
  29. package/dist/esm/lib/components/filter-row/advanced-field-content.js +30 -52
  30. package/dist/esm/lib/components/filter-row/advanced-filter-context.js +3 -6
  31. package/dist/esm/lib/components/filter-row/all-filters-chip.js +31 -49
  32. package/dist/esm/lib/components/filter-row/filter-row.js +35 -59
  33. package/dist/esm/lib/components/filter-row/form-filter-chip.js +84 -113
  34. package/dist/esm/lib/components/filter-row/index.js +6 -12
  35. package/dist/esm/lib/components/filter-row/initial-field-values.js +31 -51
  36. package/dist/esm/lib/components/filter-row/is-blank-or-not-blank-filter.js +2 -4
  37. package/dist/esm/lib/components/filter-row/is-filter-selected.js +37 -58
  38. package/dist/esm/lib/components/filter-row/messages.js +38 -40
  39. package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +74 -103
  40. package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -6
  41. package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +14 -21
  42. package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +58 -71
  43. package/dist/esm/lib/components/filter-row/select-filter-chip.js +41 -58
  44. package/dist/esm/lib/components/filter-row/use-form-filter-chip.js +36 -40
  45. package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +2 -82
  46. package/dist/esm/lib/components/filter-sidepanel/filter.js +95 -140
  47. package/dist/esm/lib/components/filter-sidepanel/index.js +3 -6
  48. package/dist/esm/lib/components/filter-sidepanel/messages.js +18 -20
  49. package/dist/esm/lib/components/header/header.js +2 -82
  50. package/dist/esm/lib/components/header/index.js +2 -4
  51. package/dist/esm/lib/components/header/messages.js +14 -16
  52. package/dist/esm/lib/components/index.js +26 -53
  53. package/dist/esm/lib/components/item-action-menu/identifier.js +4 -7
  54. package/dist/esm/lib/components/item-action-menu/index.js +2 -4
  55. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +2 -127
  56. package/dist/esm/lib/components/item-action-menu/messages.js +5 -9
  57. package/dist/esm/lib/components/metadata-grid/index.js +2 -4
  58. package/dist/esm/lib/components/metadata-grid/messages.js +5 -9
  59. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +2 -62
  60. package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -5
  61. package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +24 -29
  62. package/dist/esm/lib/components/metadata-table/index.js +4 -8
  63. package/dist/esm/lib/components/metadata-table/messages.js +14 -16
  64. package/dist/esm/lib/components/metadata-table/metadata-table.js +89 -127
  65. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +10 -19
  66. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/ghost-table-row.js +8 -19
  67. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/index.js +2 -4
  68. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +2 -4
  69. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +2 -56
  70. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +135 -209
  71. package/dist/esm/lib/components/metadata-table/table-body/table-row/index.js +2 -4
  72. package/dist/esm/lib/components/metadata-table/table-body/table-row/table-row.js +2 -12
  73. package/dist/esm/lib/components/metadata-table/table-renderer.js +34 -55
  74. package/dist/esm/lib/components/metadata-value/index.js +6 -12
  75. package/dist/esm/lib/components/metadata-value/messages.js +15 -17
  76. package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +24 -34
  77. package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +14 -22
  78. package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -19
  79. package/dist/esm/lib/components/metadata-value/metadata-location-field.js +2 -48
  80. package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +26 -37
  81. package/dist/esm/lib/components/metadata-value/metadata-search-field.js +19 -30
  82. package/dist/esm/lib/components/pagination/index.js +4 -9
  83. package/dist/esm/lib/components/pagination/marker-based-pagination.js +12 -19
  84. package/dist/esm/lib/components/pagination/messages.js +19 -21
  85. package/dist/esm/lib/components/pagination/offset-based-pagination.js +22 -31
  86. package/dist/esm/lib/components/pagination/pagination-controls.js +2 -53
  87. package/dist/esm/lib/components/pagination/pagination.js +20 -35
  88. package/dist/esm/lib/components/pagination/utils.js +4 -6
  89. package/dist/esm/lib/components/sort-dropdown/index.js +2 -4
  90. package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +37 -56
  91. package/dist/esm/lib/components/switch-case/index.js +2 -5
  92. package/dist/esm/lib/components/switch-case/switch-case.js +4 -12
  93. package/dist/esm/lib/hooks/use-header.js +41 -37
  94. package/dist/esm/lib/index.js +28 -59
  95. package/dist/esm/lib/metadata-view.js +2 -151
  96. package/dist/styles/action-bar.css +1 -1
  97. package/dist/styles/empty-state.css +1 -1
  98. package/dist/styles/filter-row.css +1 -1
  99. package/dist/styles/header.css +1 -1
  100. package/dist/styles/inline-editing-cell.css +1 -1
  101. package/dist/styles/item-action-menu.css +1 -1
  102. package/dist/styles/metadata-grid.css +1 -1
  103. package/dist/styles/metadata-view.css +1 -1
  104. package/dist/styles/pagination-controls.css +1 -1
  105. package/dist/styles/table-row.css +1 -0
  106. package/dist/styles/zoom-button.css +1 -1
  107. package/package.json +17 -17
  108. package/dist/chunks/index.js +0 -105
  109. package/dist/styles/index.css +0 -1
@@ -1,60 +1,36 @@
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
- import "./form-filter-chip.js";
11
- import "./select-filter-chip.js";
12
- import "./predefinedFilters/index.js";
13
- const q = ({
14
- predefinedFilterOptions: p,
15
- containerRef: s,
16
- filterGroups: a = [],
17
- initialFilterValues: t,
18
- isAllFiltersDisabled: f,
19
- onAllFiltersClick: n,
20
- onFilterSubmit: o
21
- }) => {
22
- const d = b(p), u = ({
23
- metadata: {
24
- fields: e
25
- }
26
- }) => {
27
- o && o(e);
28
- }, l = [...d, ...a], r = l.flatMap(({
29
- filters: e
30
- }) => e), c = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), h = y(
31
- () => x(r, t),
32
- // Intentionally depend on filterSchemaKey (not filterOptions identity) to prevent unwanted reinitialization
33
- // eslint-disable-next-line react-hooks/exhaustive-deps -- depend on schema key instead of filterOptions identity
34
- [c, t]
35
- ), m = G(null);
36
- return /* @__PURE__ */ i(C, {
37
- enableReinitialize: !0,
38
- initialValues: h,
39
- onSubmit: u,
40
- children: /* @__PURE__ */ i(R, {
41
- ref: m,
42
- children: /* @__PURE__ */ S(F.Group, {
43
- className: w.filterChipGroup,
44
- name: "metadata-view-filters",
45
- type: "multiple",
46
- children: [f ? null : /* @__PURE__ */ i(j, {
47
- containerRef: s,
48
- filterGroups: l,
49
- onAllFiltersClick: n
50
- }), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(M, {
51
- filterOption: e,
52
- formRef: m
53
- }, e.id))]
54
- })
55
- })
56
- });
57
- };
58
- export {
59
- q as FilterRow
1
+ import { getInitialFieldValues as e } from "./initial-field-values.js";
2
+ import { t } from "../../../../chunks/filter-row.module.js";
3
+ import n from "./all-filters-chip.js";
4
+ import { MetadataFilterChip as r } from "./metadata-filter-chip.js";
5
+ import { usePredefinedFilter as i } from "./predefinedFilters/use-predefined-filter.js";
6
+ import { FilterChip as a } from "@box/blueprint-web";
7
+ import { useMemo as o, useRef as s } from "react";
8
+ import { Form as c, Formik as l } from "formik";
9
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
10
+ var f = ({ predefinedFilterOptions: f, containerRef: p, filterGroups: m = [], initialFilterValues: h, isAllFiltersDisabled: g, onAllFiltersClick: _, onFilterSubmit: v }) => {
11
+ let y = i(f), b = ({ metadata: { fields: e } }) => {
12
+ v && v(e);
13
+ }, x = [...y, ...m], S = x.flatMap(({ filters: e }) => e), C = o(() => e(S, h), [S.map((e) => `${e.id}:${e.fieldType}`).join("|"), h]), w = s(null);
14
+ return /* @__PURE__ */ u(l, {
15
+ enableReinitialize: !0,
16
+ initialValues: C,
17
+ onSubmit: b,
18
+ children: /* @__PURE__ */ u(c, {
19
+ ref: w,
20
+ children: /* @__PURE__ */ d(a.Group, {
21
+ className: t.filterChipGroup,
22
+ name: "metadata-view-filters",
23
+ type: "multiple",
24
+ children: [g ? null : /* @__PURE__ */ u(n, {
25
+ containerRef: p,
26
+ filterGroups: x,
27
+ onAllFiltersClick: _
28
+ }), S.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ u(r, {
29
+ filterOption: e,
30
+ formRef: w
31
+ }, e.id))]
32
+ })
33
+ })
34
+ });
60
35
  };
36
+ export { f as FilterRow };
@@ -1,114 +1,85 @@
1
- import { Popover as n, FilterChip as l, Button as O } from "@box/blueprint-web";
2
- import { useFormikContext as X, getIn as i } from "formik";
3
- import { useState as c, useMemo as Y } from "react";
4
- import { useIntl as Z } from "react-intl";
5
- import { AdvancedFilterContext as _ } from "./advanced-filter-context.js";
6
- import { s as T } from "../../../../chunks/filter-row.module.js";
7
- import { getDefaultFieldValue as A } from "./initial-field-values.js";
8
- import { isBlankOrNotBlankFilter as b } from "./is-blank-or-not-blank-filter.js";
9
- import { extractAdvancedFilterOption as E, isFilterSelected as ee } from "./is-filter-selected.js";
10
- import D from "./messages.js";
11
- import { useFormFilterChip as te } from "./use-form-filter-chip.js";
12
- import { jsx as r, jsxs as s } from "react/jsx-runtime";
13
- const he = ({
14
- children: u,
15
- formRef: B,
16
- icon: f,
17
- id: t,
18
- name: d = "",
19
- isAdvancedFilterEnabled: e,
20
- advancedFilterOptionsMap: S
21
- }) => {
22
- const {
23
- formatMessage: h
24
- } = Z(), [k, y] = c(!1), {
25
- handleSubmit: x,
26
- setFieldValue: R,
27
- resetForm: $,
28
- values: a
29
- } = X(), v = i(a, `metadata.fields.${t}.fieldType`), C = i(a, `metadata.fields.${t}.value`), I = e && C ? E(C) : void 0, {
30
- appliedAdvancedFilterOption: F,
31
- currentAdvancedFilterOption: V,
32
- dynamicDisplayName: N,
33
- handleAdvancedFilterOptionChange: M,
34
- handleApply: P,
35
- handleCancel: j,
36
- handleClear: z
37
- } = te({
38
- name: d,
39
- advancedFilterOptionsMap: S,
40
- initialAdvancedFilterOption: I
41
- }), [K, L] = c(0), w = () => {
42
- e && P(), x(), y(!1);
43
- }, [q, G] = c(a), H = (o) => {
44
- y(o), o ? (G(a), e && L((m) => m + 1)) : ($({
45
- values: q
46
- }), e && j());
47
- }, J = () => {
48
- R(`metadata.fields.${t}.value`, A({
49
- fieldType: v,
50
- isAdvancedFilterEnabled: e
51
- })), e && z();
52
- }, p = Y(() => {
53
- if (e && b(F))
54
- return !0;
55
- const o = i(a, `metadata.fields.${t}.value`);
56
- return o ? ee(o) : !1;
57
- }, [a, t, e, F]), Q = () => {
58
- if (v === "date") {
59
- const o = i(a, `metadata.fields.${t}.value.customType`), m = o && o !== "anyTime" && o !== "customRange", g = i(a, `metadata.fields.${t}.value.relativeType`);
60
- return (m || g && g !== "customRange") && !p;
61
- }
62
- return !1;
63
- }, U = e && p ? N : d, W = e ? /* @__PURE__ */ r(_.Provider, {
64
- value: {
65
- currentOption: V,
66
- onOptionChange: M,
67
- resetKey: K
68
- },
69
- children: u
70
- }) : u;
71
- return /* @__PURE__ */ r("div", {
72
- children: /* @__PURE__ */ s(n.Root, {
73
- onOpenChange: H,
74
- open: k,
75
- children: [/* @__PURE__ */ r(n.Trigger, {
76
- children: /* @__PURE__ */ s(l.TriggerChip, {
77
- selected: p,
78
- value: t,
79
- children: [f && /* @__PURE__ */ r(l.Icon, {
80
- icon: f
81
- }), /* @__PURE__ */ r(l.Label, {
82
- children: U
83
- }), /* @__PURE__ */ r(l.DropdownIndicator, {})]
84
- }, t)
85
- }), /* @__PURE__ */ s(n.ContentContainer, {
86
- align: "start",
87
- className: T.popoverContent,
88
- container: B.current,
89
- "data-testid": "form-filter-chip-popover",
90
- children: [/* @__PURE__ */ r(n.MainContent, {
91
- children: W
92
- }), /* @__PURE__ */ s(n.Footer, {
93
- className: T.popoverFooter,
94
- children: [/* @__PURE__ */ r(O, {
95
- onClick: J,
96
- size: "small",
97
- variant: "secondary",
98
- children: h(D.clearButton)
99
- }), /* @__PURE__ */ r(O, {
100
- disabled: Q(),
101
- onClick: w,
102
- size: "small",
103
- type: "submit",
104
- variant: "primary",
105
- children: h(D.applyButton)
106
- })]
107
- })]
108
- })]
109
- })
110
- });
111
- };
112
- export {
113
- he as FormFilterChip
1
+ import { getDefaultFieldValue as e } from "./initial-field-values.js";
2
+ import { isBlankOrNotBlankFilter as t } from "./is-blank-or-not-blank-filter.js";
3
+ import { extractAdvancedFilterOption as n, isFilterSelected as r } from "./is-filter-selected.js";
4
+ import i from "./messages.js";
5
+ import { t as a } from "../../../../chunks/filter-row.module.js";
6
+ import { AdvancedFilterContext as o } from "./advanced-filter-context.js";
7
+ import { useFormFilterChip as s } from "./use-form-filter-chip.js";
8
+ import { Button as c, FilterChip as l, Popover as u } from "@box/blueprint-web";
9
+ import { useMemo as d, useState as f } from "react";
10
+ import { useIntl as p } from "react-intl";
11
+ import { getIn as m, useFormikContext as h } from "formik";
12
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
13
+ var v = ({ children: v, formRef: y, icon: b, id: x, name: S = "", isAdvancedFilterEnabled: C, advancedFilterOptionsMap: w }) => {
14
+ let { formatMessage: T } = p(), [E, D] = f(!1), { handleSubmit: O, setFieldValue: k, resetForm: A, values: j } = h(), M = m(j, `metadata.fields.${x}.fieldType`), N = m(j, `metadata.fields.${x}.value`), { appliedAdvancedFilterOption: P, currentAdvancedFilterOption: F, dynamicDisplayName: I, handleAdvancedFilterOptionChange: L, handleApply: R, handleCancel: z, handleClear: B } = s({
15
+ name: S,
16
+ advancedFilterOptionsMap: w,
17
+ initialAdvancedFilterOption: C && N ? n(N) : void 0
18
+ }), [V, H] = f(0), U = () => {
19
+ C && R(), O(), D(!1);
20
+ }, [W, G] = f(j), K = (e) => {
21
+ D(e), e ? (G(j), C && H((e) => e + 1)) : (A({ values: W }), C && z());
22
+ }, q = () => {
23
+ k(`metadata.fields.${x}.value`, e({
24
+ fieldType: M,
25
+ isAdvancedFilterEnabled: C
26
+ })), C && B();
27
+ }, J = d(() => {
28
+ if (C && t(P)) return !0;
29
+ let e = m(j, `metadata.fields.${x}.value`);
30
+ return e ? r(e) : !1;
31
+ }, [
32
+ j,
33
+ x,
34
+ C,
35
+ P
36
+ ]), Y = () => {
37
+ if (M === "date") {
38
+ let e = m(j, `metadata.fields.${x}.value.customType`), t = e && e !== "anyTime" && e !== "customRange", n = m(j, `metadata.fields.${x}.value.relativeType`);
39
+ return (t || n && n !== "customRange") && !J;
40
+ }
41
+ return !1;
42
+ }, X = C && J ? I : S, Z = C ? /* @__PURE__ */ g(o.Provider, {
43
+ value: {
44
+ currentOption: F,
45
+ onOptionChange: L,
46
+ resetKey: V
47
+ },
48
+ children: v
49
+ }) : v;
50
+ return /* @__PURE__ */ g("div", { children: /* @__PURE__ */ _(u.Root, {
51
+ onOpenChange: K,
52
+ open: E,
53
+ children: [/* @__PURE__ */ g(u.Trigger, { children: /* @__PURE__ */ _(l.TriggerChip, {
54
+ selected: J,
55
+ value: x,
56
+ children: [
57
+ b && /* @__PURE__ */ g(l.Icon, { icon: b }),
58
+ /* @__PURE__ */ g(l.Label, { children: X }),
59
+ /* @__PURE__ */ g(l.DropdownIndicator, {})
60
+ ]
61
+ }, x) }), /* @__PURE__ */ _(u.ContentContainer, {
62
+ align: "start",
63
+ className: a.popoverContent,
64
+ container: y.current,
65
+ "data-testid": "form-filter-chip-popover",
66
+ children: [/* @__PURE__ */ g(u.MainContent, { children: Z }), /* @__PURE__ */ _(u.Footer, {
67
+ className: a.popoverFooter,
68
+ children: [/* @__PURE__ */ g(c, {
69
+ onClick: q,
70
+ size: "small",
71
+ variant: "secondary",
72
+ children: T(i.clearButton)
73
+ }), /* @__PURE__ */ g(c, {
74
+ disabled: Y(),
75
+ onClick: U,
76
+ size: "small",
77
+ type: "submit",
78
+ variant: "primary",
79
+ children: T(i.applyButton)
80
+ })]
81
+ })]
82
+ })]
83
+ }) });
114
84
  };
85
+ export { v as FormFilterChip };
@@ -1,12 +1,6 @@
1
- import { FilterRow as t } from "./filter-row.js";
2
- import { FormFilterChip as i } from "./form-filter-chip.js";
3
- import { MetadataFilterChip as m } from "./metadata-filter-chip.js";
4
- import { SelectFilterChip as l } from "./select-filter-chip.js";
5
- import { PredefinedFilterName as x } from "./predefinedFilters/index.js";
6
- export {
7
- t as FilterRow,
8
- i as FormFilterChip,
9
- m as MetadataFilterChip,
10
- x as PredefinedFilterName,
11
- l as SelectFilterChip
12
- };
1
+ import { FormFilterChip as e } from "./form-filter-chip.js";
2
+ import { SelectFilterChip as t } from "./select-filter-chip.js";
3
+ import { MetadataFilterChip as n } from "./metadata-filter-chip.js";
4
+ import { t as r } from "../../../../chunks/types2.js";
5
+ import { FilterRow as i } from "./filter-row.js";
6
+ export { i as FilterRow, e as FormFilterChip, n as MetadataFilterChip, r as PredefinedFilterName, t as SelectFilterChip };
@@ -1,52 +1,32 @@
1
- const c = (e) => ({
2
- key: e,
3
- id: e
4
- }), d = ({
5
- fieldType: e,
6
- options: t
7
- }) => ["enum", "multiSelect"].includes(e) ? (t || []).map(c) : [], s = ({
8
- fieldType: e,
9
- isAdvancedFilterEnabled: t
10
- }) => e === "date" ? {
11
- customType: "anyTime",
12
- range: {
13
- gt: "",
14
- lt: ""
15
- }
16
- } : e === "float" ? t ? {
17
- enum: []
18
- } : {
19
- range: {
20
- gt: "",
21
- lt: ""
22
- }
23
- } : {
24
- enum: []
25
- }, l = (e) => Array.isArray(e) ? e.length > 1 ? "multiSelect" : "enum" : !e || typeof e != "object" ? "enum" : "customDays" in e || "relativeDays" in e || "customType" in e || "relativeType" in e ? "date" : "range" in e ? "float" : "enum" in e && e.enum.length > 1 ? "multiSelect" : "enum", o = (e, t) => {
26
- const i = e.reduce((n, r) => {
27
- const a = t?.[r.id]?.value, u = s({
28
- fieldType: r.fieldType,
29
- isAdvancedFilterEnabled: r.isAdvancedFilterEnabled
30
- });
31
- return n[r.id] = {
32
- value: a ?? u,
33
- fieldType: r.fieldType,
34
- options: d(r)
35
- }, n;
36
- }, {});
37
- return t && Object.keys(t).filter((n) => !i[n]).forEach((n) => {
38
- i[n] = {
39
- value: t[n].value,
40
- fieldType: l(t[n].value)
41
- };
42
- }), {
43
- metadata: {
44
- fields: i
45
- }
46
- };
47
- };
48
- export {
49
- s as getDefaultFieldValue,
50
- o as getInitialFieldValues,
51
- l as inferFieldType
1
+ var e = (e) => ({
2
+ key: e,
3
+ id: e
4
+ }), t = ({ fieldType: t, options: n }) => ["enum", "multiSelect"].includes(t) ? (n || []).map(e) : [], n = ({ fieldType: e, isAdvancedFilterEnabled: t }) => e === "date" ? {
5
+ customType: "anyTime",
6
+ range: {
7
+ gt: "",
8
+ lt: ""
9
+ }
10
+ } : e === "float" ? t ? { enum: [] } : { range: {
11
+ gt: "",
12
+ lt: ""
13
+ } } : { enum: [] }, r = (e) => Array.isArray(e) ? e.length > 1 ? "multiSelect" : "enum" : !e || typeof e != "object" ? "enum" : "customDays" in e || "relativeDays" in e || "customType" in e || "relativeType" in e ? "date" : "range" in e ? "float" : "enum" in e && e.enum.length > 1 ? "multiSelect" : "enum", i = (e, i) => {
14
+ let a = e.reduce((e, r) => {
15
+ let a = i?.[r.id]?.value, o = n({
16
+ fieldType: r.fieldType,
17
+ isAdvancedFilterEnabled: r.isAdvancedFilterEnabled
18
+ });
19
+ return e[r.id] = {
20
+ value: a ?? o,
21
+ fieldType: r.fieldType,
22
+ options: t(r)
23
+ }, e;
24
+ }, {});
25
+ return i && Object.keys(i).filter((e) => !a[e]).forEach((e) => {
26
+ a[e] = {
27
+ value: i[e].value,
28
+ fieldType: r(i[e].value)
29
+ };
30
+ }), { metadata: { fields: a } };
52
31
  };
32
+ export { n as getDefaultFieldValue, i as getInitialFieldValues, r as inferFieldType };
@@ -1,5 +1,3 @@
1
1
  import { FilterKeyTypes as e } from "@box/metadata-filter";
2
- const l = (r) => r === e.IS_BLANK || r === e.IS_NOT_BLANK;
3
- export {
4
- l as isBlankOrNotBlankFilter
5
- };
2
+ var t = (t) => t === e.IS_BLANK || t === e.IS_NOT_BLANK;
3
+ export { t as isBlankOrNotBlankFilter };
@@ -1,59 +1,38 @@
1
- import { FilterKeyTypes as d } from "@box/metadata-filter";
2
- import { isBlankOrNotBlankFilter as i } from "./is-blank-or-not-blank-filter.js";
3
- const o = (t) => !!t && typeof t == "object" && !Array.isArray(t) && "advancedFilterOption" in t, s = ({
4
- value: t,
5
- advancedFilterOption: r
6
- }) => i(r) ? !0 : !!(t && t.length > 0 && t[0]), c = (t) => !!t && typeof t == "object" && !Array.isArray(t) && "advancedFilterOption" in t, a = ({
7
- value: t,
8
- advancedFilterOption: r
9
- }) => {
10
- if (i(r))
11
- return !0;
12
- if (typeof t == "string")
13
- return !!t;
14
- if (t && typeof t == "object" && "range" in t) {
15
- const {
16
- range: n
17
- } = t;
18
- return !!(n && (n.gt || n.lt));
19
- }
20
- return !1;
21
- }, f = (t) => {
22
- if ("advancedFilterOption" in t)
23
- return t.advancedFilterOption;
24
- if ("enum" in t) {
25
- const r = t.enum;
26
- if (o(r))
27
- return r.advancedFilterOption;
28
- const n = r?.[0];
29
- if (c(n))
30
- return n.advancedFilterOption;
31
- }
32
- }, y = (t) => {
33
- const r = f(t);
34
- return r && r !== d.SELECT_FILTER_TYPE ? r : void 0;
35
- }, m = (t) => {
36
- if ("advancedFilterOption" in t && i(t.advancedFilterOption))
37
- return !0;
38
- if ("range" in t) {
39
- const {
40
- range: r
41
- } = t;
42
- return !!(r && (r.gt || r.lt));
43
- }
44
- if ("enum" in t) {
45
- const r = t.enum;
46
- if (o(r))
47
- return s(r);
48
- const n = r;
49
- if (!n || n.length === 0)
50
- return !1;
51
- const e = n[0];
52
- return c(e) ? a(e) : !!e;
53
- }
54
- return !1;
55
- };
56
- export {
57
- y as extractAdvancedFilterOption,
58
- m as isFilterSelected
1
+ import { isBlankOrNotBlankFilter as e } from "./is-blank-or-not-blank-filter.js";
2
+ import { FilterKeyTypes as t } from "@box/metadata-filter";
3
+ var n = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "advancedFilterOption" in e, r = ({ value: t, advancedFilterOption: n }) => e(n) ? !0 : !!(t && t.length > 0 && t[0]), i = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "advancedFilterOption" in e, a = ({ value: t, advancedFilterOption: n }) => {
4
+ if (e(n)) return !0;
5
+ if (typeof t == "string") return !!t;
6
+ if (t && typeof t == "object" && "range" in t) {
7
+ let { range: e } = t;
8
+ return !!(e && (e.gt || e.lt));
9
+ }
10
+ return !1;
11
+ }, o = (e) => {
12
+ if ("advancedFilterOption" in e) return e.advancedFilterOption;
13
+ if ("enum" in e) {
14
+ let t = e.enum;
15
+ if (n(t)) return t.advancedFilterOption;
16
+ let r = t?.[0];
17
+ if (i(r)) return r.advancedFilterOption;
18
+ }
19
+ }, s = (e) => {
20
+ let n = o(e);
21
+ return n && n !== t.SELECT_FILTER_TYPE ? n : void 0;
22
+ }, c = (t) => {
23
+ if ("advancedFilterOption" in t && e(t.advancedFilterOption)) return !0;
24
+ if ("range" in t) {
25
+ let { range: e } = t;
26
+ return !!(e && (e.gt || e.lt));
27
+ }
28
+ if ("enum" in t) {
29
+ let e = t.enum;
30
+ if (n(e)) return r(e);
31
+ let o = e;
32
+ if (!o || o.length === 0) return !1;
33
+ let s = o[0];
34
+ return i(s) ? a(s) : !!s;
35
+ }
36
+ return !1;
59
37
  };
38
+ export { s as extractAdvancedFilterOption, c as isFilterSelected };
@@ -1,42 +1,40 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- const a = e({
3
- applyButton: {
4
- id: "groupSharedFeatures.metadataView.filterRow.applyButton",
5
- defaultMessage: "Apply"
6
- },
7
- clearButton: {
8
- id: "groupSharedFeatures.metadataView.filterRow.clearButton",
9
- defaultMessage: "Clear"
10
- },
11
- textInputPlaceholder: {
12
- id: "groupSharedFeatures.metadataView.filterRow.textInputPlaceholder",
13
- defaultMessage: "Set Value"
14
- },
15
- allFilters: {
16
- id: "groupSharedFeatures.metadataView.filterRow.AllFilters",
17
- defaultMessage: "All Filters"
18
- },
19
- keywordSearchFilterPlaceholder: {
20
- id: "groupSharedFeatures.metadataView.filterRow.keywordSearchFilterPlaceholder",
21
- defaultMessage: "Enter keywords"
22
- },
23
- chipNameWithCount: {
24
- id: "groupSharedFeatures.metadataView.filterRow.chipNameWithCount",
25
- defaultMessage: "{name} ({count})"
26
- },
27
- fileTypeFilterTitle: {
28
- id: "groupSharedFeatures.metadataView.filterRow.fileTypeFilterTitle",
29
- defaultMessage: "File Type"
30
- },
31
- locationFilterTitle: {
32
- id: "groupSharedFeatures.metadataView.filterRow.locationFilterTitle",
33
- defaultMessage: "Location"
34
- },
35
- chipNameWithFilterOption: {
36
- id: "groupSharedFeatures.metadataView.filterRow.chipNameWithFilterOption",
37
- defaultMessage: "{name} - {optionLabel}"
38
- }
2
+ var t = e({
3
+ applyButton: {
4
+ id: "groupSharedFeatures.metadataView.filterRow.applyButton",
5
+ defaultMessage: "Apply"
6
+ },
7
+ clearButton: {
8
+ id: "groupSharedFeatures.metadataView.filterRow.clearButton",
9
+ defaultMessage: "Clear"
10
+ },
11
+ textInputPlaceholder: {
12
+ id: "groupSharedFeatures.metadataView.filterRow.textInputPlaceholder",
13
+ defaultMessage: "Set Value"
14
+ },
15
+ allFilters: {
16
+ id: "groupSharedFeatures.metadataView.filterRow.AllFilters",
17
+ defaultMessage: "All Filters"
18
+ },
19
+ keywordSearchFilterPlaceholder: {
20
+ id: "groupSharedFeatures.metadataView.filterRow.keywordSearchFilterPlaceholder",
21
+ defaultMessage: "Enter keywords"
22
+ },
23
+ chipNameWithCount: {
24
+ id: "groupSharedFeatures.metadataView.filterRow.chipNameWithCount",
25
+ defaultMessage: "{name} ({count})"
26
+ },
27
+ fileTypeFilterTitle: {
28
+ id: "groupSharedFeatures.metadataView.filterRow.fileTypeFilterTitle",
29
+ defaultMessage: "File Type"
30
+ },
31
+ locationFilterTitle: {
32
+ id: "groupSharedFeatures.metadataView.filterRow.locationFilterTitle",
33
+ defaultMessage: "Location"
34
+ },
35
+ chipNameWithFilterOption: {
36
+ id: "groupSharedFeatures.metadataView.filterRow.chipNameWithFilterOption",
37
+ defaultMessage: "{name} - {optionLabel}"
38
+ }
39
39
  });
40
- export {
41
- a as default
42
- };
40
+ export { t as default };