@box/metadata-view 0.33.0 → 0.35.0
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/predefined-filter-options-factory.js +25 -0
- package/dist/chunks/table-row.js +52 -52
- package/dist/esm/lib/components/filter-row/filter-row.js +2 -2
- package/dist/esm/lib/components/filter-row/messages.js +6 -2
- package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +5 -0
- package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +71 -0
- package/dist/esm/lib/components/filter-sidepanel/filter-sidepanel.js +29 -28
- package/dist/esm/lib/components/filter-sidepanel/filter.js +37 -11
- package/dist/esm/lib/components/metadata-table/metadata-table.js +42 -40
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +4 -0
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +37 -0
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +89 -95
- package/dist/esm/lib/components/metadata-table/table-renderer.js +17 -15
- package/dist/esm/lib/components/metadata-value/messages.js +4 -0
- package/dist/esm/lib/components/metadata-value/metadata-location-field.js +44 -0
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +8 -8
- package/dist/i18n/bn-IN.js +2 -0
- package/dist/i18n/da-DK.js +2 -0
- package/dist/i18n/de-DE.js +2 -0
- package/dist/i18n/en-AU.js +2 -0
- package/dist/i18n/en-CA.js +2 -0
- package/dist/i18n/en-GB.js +2 -0
- package/dist/i18n/en-US.js +2 -0
- package/dist/i18n/en-US.properties +4 -0
- package/dist/i18n/en-x-pseudo.js +2 -0
- package/dist/i18n/es-419.js +2 -0
- package/dist/i18n/es-ES.js +2 -0
- package/dist/i18n/fi-FI.js +2 -0
- package/dist/i18n/fr-CA.js +2 -0
- package/dist/i18n/fr-FR.js +2 -0
- package/dist/i18n/hi-IN.js +2 -0
- package/dist/i18n/it-IT.js +2 -0
- package/dist/i18n/ja-JP.js +2 -0
- package/dist/i18n/json/src/lib/components/filter-row/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/metadata-value/messages.json +1 -1
- package/dist/i18n/ko-KR.js +2 -0
- package/dist/i18n/nb-NO.js +2 -0
- package/dist/i18n/nl-NL.js +2 -0
- package/dist/i18n/pl-PL.js +2 -0
- package/dist/i18n/pt-BR.js +2 -0
- package/dist/i18n/ru-RU.js +2 -0
- package/dist/i18n/sv-SE.js +2 -0
- package/dist/i18n/tr-TR.js +2 -0
- package/dist/i18n/zh-CN.js +2 -0
- package/dist/i18n/zh-TW.js +2 -0
- package/dist/styles/inline-editing-cell.css +1 -0
- package/dist/styles/metadata-location-field.css +1 -0
- package/dist/styles/table-row.css +1 -1
- package/dist/types/lib/components/action-bar/action-bar.d.ts +1 -1
- package/dist/types/lib/components/filter-row/filter-row.d.ts +4 -3
- package/dist/types/lib/components/filter-row/messages.d.ts +5 -0
- package/dist/types/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.d.ts +2 -0
- package/dist/types/lib/components/filter-row/predefinedFilters/types.d.ts +20 -0
- package/dist/types/lib/components/filter-row/predefinedFilters/use-predefined-filter.d.ts +3 -0
- package/dist/types/lib/components/filter-row/types.d.ts +3 -1
- package/dist/types/lib/components/filter-sidepanel/filter-sidepanel.d.ts +1 -1
- package/dist/types/lib/components/metadata-table/metadata-table.d.ts +3 -1
- package/dist/types/lib/components/metadata-table/table-body/inline-editing-cell/index.d.ts +1 -0
- package/dist/types/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.d.ts +9 -0
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +12 -1
- package/dist/types/lib/components/metadata-table/table-renderer.d.ts +4 -2
- package/dist/types/lib/components/metadata-value/messages.d.ts +5 -0
- package/dist/types/lib/components/metadata-value/metadata-location-field.d.ts +14 -0
- package/dist/types/lib/components/metadata-value/metadata-search-field.d.ts +2 -2
- package/dist/types/lib/types.d.ts +4 -3
- package/package.json +1 -1
- package/dist/esm/lib/components/filter-row/use-predefined-filter.js +0 -44
- package/dist/types/lib/components/filter-row/use-predefined-filter.d.ts +0 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import i from "lodash/merge";
|
|
2
|
+
let e = /* @__PURE__ */ function(r) {
|
|
3
|
+
return r.KeywordSearchFilterGroup = "KeywordSearchFilterGroup", r.FileTypeFilterGroup = "FileTypeFilterGroup", r.LocationFilterGroup = "LocationFilterGroup", r;
|
|
4
|
+
}({});
|
|
5
|
+
function l(r = {}) {
|
|
6
|
+
const o = {
|
|
7
|
+
[e.KeywordSearchFilterGroup]: {
|
|
8
|
+
isDisabled: !1
|
|
9
|
+
},
|
|
10
|
+
[e.FileTypeFilterGroup]: {
|
|
11
|
+
isDisabled: !1
|
|
12
|
+
},
|
|
13
|
+
[e.LocationFilterGroup]: {
|
|
14
|
+
isDisabled: !1,
|
|
15
|
+
triggerCallback: () => {
|
|
16
|
+
console.error("Custom callback needs to be provided");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return i(o, r);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
e as P,
|
|
24
|
+
l as p
|
|
25
|
+
};
|
package/dist/chunks/table-row.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { Row as
|
|
1
|
+
import { Row as H, Cell as a, Text as s, ActionCell as L } from "@box/blueprint-web";
|
|
2
2
|
import b from "lodash/get";
|
|
3
|
-
import { ItemTypeIcon as
|
|
4
|
-
import
|
|
3
|
+
import { ItemTypeIcon as p } from "@box/item-icon";
|
|
4
|
+
import A from "clsx";
|
|
5
5
|
import { I as n } from "./types.js";
|
|
6
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
6
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as x } from "../esm/lib/components/constants.js";
|
|
7
7
|
import { jsxs as _, jsx as e } from "react/jsx-runtime";
|
|
8
|
-
import { ItemActionMenu as
|
|
9
|
-
import '../styles/table-row.css';const
|
|
10
|
-
tableHeaderActionsWrapper:
|
|
11
|
-
tableHeaderActions:
|
|
12
|
-
tableRow:
|
|
13
|
-
selectAllCheckbox:
|
|
14
|
-
tableNameCell:
|
|
15
|
-
|
|
16
|
-
infiniteScrollTableContainerFullHeight:
|
|
17
|
-
iconCell:
|
|
18
|
-
},
|
|
8
|
+
import { ItemActionMenu as E } from "../esm/lib/components/item-action-menu/item-action-menu.js";
|
|
9
|
+
import '../styles/table-row.css';const q = "_tableHeaderActionsWrapper_zlqta_1", z = "_tableHeaderActions_zlqta_1", y = "_tableRow_zlqta_33", R = "_selectAllCheckbox_zlqta_42", g = "_tableNameCell_zlqta_47", w = "_tableNameCellSubtitle_zlqta_53", U = "_infiniteScrollTableContainerFullHeight_zlqta_58", k = "_iconCell_zlqta_64", i = {
|
|
10
|
+
tableHeaderActionsWrapper: q,
|
|
11
|
+
tableHeaderActions: z,
|
|
12
|
+
tableRow: y,
|
|
13
|
+
selectAllCheckbox: R,
|
|
14
|
+
tableNameCell: g,
|
|
15
|
+
tableNameCellSubtitle: w,
|
|
16
|
+
infiniteScrollTableContainerFullHeight: U,
|
|
17
|
+
iconCell: k
|
|
18
|
+
}, G = ({
|
|
19
19
|
item: l,
|
|
20
|
-
columns:
|
|
20
|
+
columns: h,
|
|
21
21
|
iconColumnVariant: t,
|
|
22
|
-
isSelectAllEnabled:
|
|
22
|
+
isSelectAllEnabled: I,
|
|
23
23
|
itemActionMenuProps: d,
|
|
24
|
-
zoomLevel:
|
|
24
|
+
zoomLevel: u = 0
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */ _(
|
|
26
|
+
const C = u;
|
|
27
|
+
return /* @__PURE__ */ _(H, {
|
|
28
28
|
className: i.tableRow,
|
|
29
29
|
id: l.id,
|
|
30
|
-
children: [t === n.COLUMN ? /* @__PURE__ */ e(
|
|
30
|
+
children: [t === n.COLUMN ? /* @__PURE__ */ e(a, {
|
|
31
31
|
style: {
|
|
32
|
-
height:
|
|
32
|
+
height: x[C]
|
|
33
33
|
},
|
|
34
|
-
children: /* @__PURE__ */ e(
|
|
34
|
+
children: /* @__PURE__ */ e(p, {
|
|
35
35
|
className: i.iconCell,
|
|
36
36
|
item: l
|
|
37
37
|
})
|
|
38
|
-
}, `item-type-icon-${l.id}`) : null,
|
|
38
|
+
}, `item-type-icon-${l.id}`) : null, h.map((o) => {
|
|
39
39
|
const {
|
|
40
|
-
cellRenderer:
|
|
41
|
-
id:
|
|
42
|
-
|
|
40
|
+
cellRenderer: m,
|
|
41
|
+
id: r,
|
|
42
|
+
subtitle: T,
|
|
43
43
|
textValue: f,
|
|
44
|
-
type:
|
|
45
|
-
} = o,
|
|
46
|
-
if (
|
|
47
|
-
return /* @__PURE__ */ e(
|
|
44
|
+
type: S
|
|
45
|
+
} = o, c = `${f}-${l.id}`;
|
|
46
|
+
if (r === "name" && (t === n.INLINE || t === n.INLINE_SUBTITLE))
|
|
47
|
+
return /* @__PURE__ */ e(a, {
|
|
48
48
|
children: /* @__PURE__ */ _("div", {
|
|
49
49
|
className: i.tableNameCell,
|
|
50
|
-
children: [/* @__PURE__ */ e(
|
|
50
|
+
children: [/* @__PURE__ */ e(p, {
|
|
51
51
|
item: l
|
|
52
52
|
}), /* @__PURE__ */ _("div", {
|
|
53
|
-
className:
|
|
54
|
-
[i.
|
|
53
|
+
className: A({
|
|
54
|
+
[i.tableNameCellSubtitle]: t === n.INLINE_SUBTITLE
|
|
55
55
|
}),
|
|
56
56
|
children: [/* @__PURE__ */ e(s, {
|
|
57
57
|
as: "span",
|
|
58
|
-
children: b(l,
|
|
58
|
+
children: b(l, r)
|
|
59
59
|
}), t === n.INLINE_SUBTITLE ? /* @__PURE__ */ e(s, {
|
|
60
60
|
as: "span",
|
|
61
61
|
color: "textOnLightSecondary",
|
|
62
|
-
children:
|
|
62
|
+
children: T
|
|
63
63
|
}) : null]
|
|
64
64
|
})]
|
|
65
65
|
})
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
return /* @__PURE__ */ e(
|
|
69
|
-
children:
|
|
70
|
-
},
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
return /* @__PURE__ */ e(
|
|
74
|
-
children:
|
|
75
|
-
},
|
|
66
|
+
}, c);
|
|
67
|
+
if (m)
|
|
68
|
+
return /* @__PURE__ */ e(a, {
|
|
69
|
+
children: m(l, o)
|
|
70
|
+
}, c);
|
|
71
|
+
if (S === "multiSelect") {
|
|
72
|
+
const N = b(l, r);
|
|
73
|
+
return /* @__PURE__ */ e(a, {
|
|
74
|
+
children: N ? N.join(" ") : ""
|
|
75
|
+
}, c);
|
|
76
76
|
}
|
|
77
|
-
return /* @__PURE__ */ e(
|
|
77
|
+
return /* @__PURE__ */ e(a, {
|
|
78
78
|
children: /* @__PURE__ */ e(s, {
|
|
79
79
|
as: "span",
|
|
80
|
-
children: b(l,
|
|
80
|
+
children: b(l, r)
|
|
81
81
|
})
|
|
82
|
-
},
|
|
83
|
-
}),
|
|
84
|
-
children: (o) => d ? /* @__PURE__ */ e(
|
|
82
|
+
}, c);
|
|
83
|
+
}), I && /* @__PURE__ */ e(L, {
|
|
84
|
+
children: (o) => d ? /* @__PURE__ */ e(E, {
|
|
85
85
|
...d,
|
|
86
86
|
item: l,
|
|
87
87
|
onOpenChange: o
|
|
@@ -90,6 +90,6 @@ import '../styles/table-row.css';const E = "_tableHeaderActionsWrapper_uw3hc_1",
|
|
|
90
90
|
}, l.id);
|
|
91
91
|
};
|
|
92
92
|
export {
|
|
93
|
-
|
|
93
|
+
G as T,
|
|
94
94
|
i as s
|
|
95
95
|
};
|
|
@@ -4,11 +4,11 @@ import { useState as G, useRef as I } from "react";
|
|
|
4
4
|
import R from "./all-filters-chip.js";
|
|
5
5
|
import { getInitialFieldValues as g } from "./initial-field-values.js";
|
|
6
6
|
import { MetadataFilterChip as j } from "./metadata-filter-chip.js";
|
|
7
|
-
import { usePredefinedFilter as w } from "./use-predefined-filter.js";
|
|
7
|
+
import { usePredefinedFilter as w } from "./predefinedFilters/use-predefined-filter.js";
|
|
8
8
|
import { s as x } from "../../../../chunks/form-filter-chip.js";
|
|
9
9
|
import { jsx as i, jsxs as b } from "react/jsx-runtime";
|
|
10
10
|
const z = ({
|
|
11
|
-
|
|
11
|
+
predefinedFilterOptions: n,
|
|
12
12
|
filterGroups: d = [],
|
|
13
13
|
isAllFiltersDisabled: p,
|
|
14
14
|
onFilterSubmit: l
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineMessages as e } from "react-intl";
|
|
2
|
-
const
|
|
2
|
+
const a = e({
|
|
3
3
|
applyButton: {
|
|
4
4
|
id: "groupSharedFeatures.metadataView.filterRow.applyButton",
|
|
5
5
|
defaultMessage: "Apply"
|
|
@@ -27,8 +27,12 @@ const t = e({
|
|
|
27
27
|
fileTypeFilterTitle: {
|
|
28
28
|
id: "groupSharedFeatures.metadataView.filterRow.fileTypeFilterTitle",
|
|
29
29
|
defaultMessage: "File Type"
|
|
30
|
+
},
|
|
31
|
+
locationFilterTitle: {
|
|
32
|
+
id: "groupSharedFeatures.metadataView.filterRow.locationFilterTitle",
|
|
33
|
+
defaultMessage: "Location"
|
|
30
34
|
}
|
|
31
35
|
});
|
|
32
36
|
export {
|
|
33
|
-
|
|
37
|
+
a as default
|
|
34
38
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useIntl as l } from "react-intl";
|
|
2
|
+
import o from "../messages.js";
|
|
3
|
+
import { p as a, P as i } from "../../../../../chunks/predefined-filter-options-factory.js";
|
|
4
|
+
const p = {
|
|
5
|
+
fieldType: "string",
|
|
6
|
+
id: "keyword-filter",
|
|
7
|
+
name: "",
|
|
8
|
+
selected: !1,
|
|
9
|
+
variant: "search"
|
|
10
|
+
}, f = {
|
|
11
|
+
fieldType: "multiSelect",
|
|
12
|
+
id: "mimetype-filter",
|
|
13
|
+
name: "",
|
|
14
|
+
selected: !1,
|
|
15
|
+
shouldRenderChip: !0,
|
|
16
|
+
variant: "file"
|
|
17
|
+
}, c = {
|
|
18
|
+
fieldType: "enum",
|
|
19
|
+
id: "location-filter",
|
|
20
|
+
name: "",
|
|
21
|
+
selected: !1,
|
|
22
|
+
shouldRenderChip: !1,
|
|
23
|
+
variant: "file"
|
|
24
|
+
}, d = ({
|
|
25
|
+
isDisabled: t
|
|
26
|
+
}) => {
|
|
27
|
+
const {
|
|
28
|
+
formatMessage: e
|
|
29
|
+
} = l();
|
|
30
|
+
return t ? [] : [{
|
|
31
|
+
filters: [{
|
|
32
|
+
...p,
|
|
33
|
+
placeholder: e(o.keywordSearchFilterPlaceholder)
|
|
34
|
+
}],
|
|
35
|
+
toggleable: !1
|
|
36
|
+
}];
|
|
37
|
+
}, u = ({
|
|
38
|
+
isDisabled: t
|
|
39
|
+
}) => {
|
|
40
|
+
const {
|
|
41
|
+
formatMessage: e
|
|
42
|
+
} = l();
|
|
43
|
+
return t ? [] : [{
|
|
44
|
+
filters: [{
|
|
45
|
+
...f
|
|
46
|
+
}],
|
|
47
|
+
title: e(o.fileTypeFilterTitle),
|
|
48
|
+
toggleable: !0
|
|
49
|
+
}];
|
|
50
|
+
}, F = ({
|
|
51
|
+
isDisabled: t,
|
|
52
|
+
...e
|
|
53
|
+
}) => {
|
|
54
|
+
const {
|
|
55
|
+
formatMessage: r
|
|
56
|
+
} = l();
|
|
57
|
+
return t ? [] : [{
|
|
58
|
+
filters: [{
|
|
59
|
+
...c,
|
|
60
|
+
...e
|
|
61
|
+
}],
|
|
62
|
+
title: r(o.locationFilterTitle),
|
|
63
|
+
toggleable: !0
|
|
64
|
+
}];
|
|
65
|
+
}, g = (t = {}) => {
|
|
66
|
+
const e = a(t), r = d(e[i.KeywordSearchFilterGroup]), n = u(e[i.FileTypeFilterGroup]), s = F(e[i.LocationFilterGroup]);
|
|
67
|
+
return [...r, ...n, ...s];
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
g as usePredefinedFilter
|
|
71
|
+
};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { SidePanel as t, Accordion as c } from "@box/blueprint-web";
|
|
2
2
|
import { useIntl as b } from "react-intl";
|
|
3
3
|
import { useFormikContext as y } from "formik";
|
|
4
|
-
import
|
|
5
|
-
import x from "
|
|
4
|
+
import g from "lodash/noop";
|
|
5
|
+
import { useState as x } from "react";
|
|
6
|
+
import B from "./filter.js";
|
|
6
7
|
import o from "./messages.js";
|
|
7
8
|
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
8
|
-
const
|
|
9
|
-
filterGroups:
|
|
9
|
+
const V = ({
|
|
10
|
+
filterGroups: a,
|
|
10
11
|
isOpen: u,
|
|
11
|
-
onIsOpenChange: i,
|
|
12
|
+
onIsOpenChange: i = g,
|
|
12
13
|
getInitialFormValues: h
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
15
|
-
formatMessage:
|
|
16
|
+
formatMessage: l
|
|
16
17
|
} = b(), {
|
|
17
18
|
handleSubmit: p,
|
|
18
|
-
resetForm:
|
|
19
|
-
values:
|
|
20
|
-
} = y(), [
|
|
21
|
-
|
|
19
|
+
resetForm: m,
|
|
20
|
+
values: f
|
|
21
|
+
} = y(), [F] = x(f), C = () => {
|
|
22
|
+
m({
|
|
22
23
|
values: h()
|
|
23
24
|
});
|
|
24
|
-
}, v = (
|
|
25
|
-
|
|
26
|
-
values:
|
|
27
|
-
}), i(
|
|
25
|
+
}, v = (r) => {
|
|
26
|
+
m({
|
|
27
|
+
values: F
|
|
28
|
+
}), i(r);
|
|
28
29
|
}, S = () => {
|
|
29
30
|
p(), i(!1);
|
|
30
31
|
};
|
|
@@ -35,37 +36,37 @@ const O = ({
|
|
|
35
36
|
children: /* @__PURE__ */ e(t.Overlay, {
|
|
36
37
|
children: /* @__PURE__ */ d(t.Content, {
|
|
37
38
|
children: [/* @__PURE__ */ e(t.Header, {
|
|
38
|
-
children:
|
|
39
|
+
children: l(o.filtersHeader)
|
|
39
40
|
}), /* @__PURE__ */ e(t.ScrollableContainer, {
|
|
40
41
|
children: /* @__PURE__ */ e(c, {
|
|
41
|
-
defaultValue:
|
|
42
|
+
defaultValue: a.map((r, n) => `item-${n}`),
|
|
42
43
|
type: "multiple",
|
|
43
|
-
children:
|
|
44
|
-
...
|
|
44
|
+
children: a.map((r, n) => /* @__PURE__ */ e(c.Item, {
|
|
45
|
+
...r.toggleable ? {} : {
|
|
45
46
|
fixed: "true"
|
|
46
47
|
},
|
|
47
|
-
title:
|
|
48
|
-
value: `item-${
|
|
49
|
-
children:
|
|
50
|
-
...
|
|
51
|
-
},
|
|
52
|
-
}, `accordion-item-${
|
|
48
|
+
title: r.title,
|
|
49
|
+
value: `item-${n}`,
|
|
50
|
+
children: r.filters.map((s) => /* @__PURE__ */ e(B, {
|
|
51
|
+
...s
|
|
52
|
+
}, s.id))
|
|
53
|
+
}, `accordion-item-${r.title || "unnamed"}`))
|
|
53
54
|
})
|
|
54
55
|
}), /* @__PURE__ */ d(t.Footer, {
|
|
55
56
|
children: [/* @__PURE__ */ e(t.Footer.SecondaryButton, {
|
|
56
57
|
onClick: C,
|
|
57
|
-
children:
|
|
58
|
+
children: l(o.clearAllButton)
|
|
58
59
|
}), /* @__PURE__ */ e(t.Footer.PrimaryButton, {
|
|
59
60
|
onClick: S,
|
|
60
|
-
children:
|
|
61
|
+
children: l(o.showResultsButton)
|
|
61
62
|
})]
|
|
62
63
|
}), /* @__PURE__ */ e(t.Close, {
|
|
63
|
-
"aria-label":
|
|
64
|
+
"aria-label": l(o.closeAriaLabel)
|
|
64
65
|
})]
|
|
65
66
|
})
|
|
66
67
|
})
|
|
67
68
|
});
|
|
68
69
|
};
|
|
69
70
|
export {
|
|
70
|
-
|
|
71
|
+
V as default
|
|
71
72
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { MetadataStringField as r } from "@box/metadata-filter";
|
|
2
2
|
import { MetadataFileField as d } from "../metadata-value/metadata-file-field.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MetadataLocationField as c } from "../metadata-value/metadata-location-field.js";
|
|
4
|
+
import { MetadataSearchField as u } from "../metadata-value/metadata-search-field.js";
|
|
4
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
-
const
|
|
6
|
+
const m = ({
|
|
6
7
|
id: e,
|
|
7
8
|
name: a,
|
|
8
9
|
placeholder: l,
|
|
@@ -10,7 +11,7 @@ const c = ({
|
|
|
10
11
|
}) => {
|
|
11
12
|
switch (i) {
|
|
12
13
|
case "search":
|
|
13
|
-
return /* @__PURE__ */ t(
|
|
14
|
+
return /* @__PURE__ */ t(u, {
|
|
14
15
|
id: e,
|
|
15
16
|
name: a,
|
|
16
17
|
placeholder: l
|
|
@@ -19,10 +20,10 @@ const c = ({
|
|
|
19
20
|
default:
|
|
20
21
|
return /* @__PURE__ */ t(r, {
|
|
21
22
|
fieldNamePrefix: `metadata.fields.${e}`,
|
|
22
|
-
label: a
|
|
23
|
+
label: a || ""
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, n = ({
|
|
26
27
|
id: e,
|
|
27
28
|
name: a,
|
|
28
29
|
variant: l
|
|
@@ -36,28 +37,53 @@ const c = ({
|
|
|
36
37
|
default:
|
|
37
38
|
return /* @__PURE__ */ t(r, {
|
|
38
39
|
fieldNamePrefix: `metadata.fields.${e}`,
|
|
39
|
-
label: a
|
|
40
|
+
label: a || ""
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
+
}, s = ({
|
|
44
|
+
id: e,
|
|
45
|
+
name: a,
|
|
46
|
+
variant: l,
|
|
47
|
+
renderer: i,
|
|
48
|
+
triggerCallback: f
|
|
49
|
+
}) => {
|
|
50
|
+
switch (l) {
|
|
51
|
+
case "file":
|
|
52
|
+
return /* @__PURE__ */ t(c, {
|
|
53
|
+
id: e,
|
|
54
|
+
renderer: i,
|
|
55
|
+
triggerSetValueCallback: f
|
|
56
|
+
});
|
|
57
|
+
case "default":
|
|
58
|
+
default:
|
|
59
|
+
return /* @__PURE__ */ t(r, {
|
|
60
|
+
fieldNamePrefix: `metadata.fields.${e}`,
|
|
61
|
+
label: a || ""
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, b = ({
|
|
43
65
|
...e
|
|
44
66
|
}) => {
|
|
45
67
|
switch (e.fieldType) {
|
|
46
68
|
case "string":
|
|
47
|
-
return /* @__PURE__ */ t(
|
|
69
|
+
return /* @__PURE__ */ t(m, {
|
|
48
70
|
...e
|
|
49
71
|
});
|
|
50
72
|
case "multiSelect":
|
|
51
|
-
return /* @__PURE__ */ t(
|
|
73
|
+
return /* @__PURE__ */ t(n, {
|
|
74
|
+
...e
|
|
75
|
+
});
|
|
76
|
+
case "enum":
|
|
77
|
+
return /* @__PURE__ */ t(s, {
|
|
52
78
|
...e
|
|
53
79
|
});
|
|
54
80
|
default:
|
|
55
81
|
return /* @__PURE__ */ t(r, {
|
|
56
82
|
fieldNamePrefix: `metadata.fields.${e.id}`,
|
|
57
|
-
label: e.name
|
|
83
|
+
label: e.name || ""
|
|
58
84
|
});
|
|
59
85
|
}
|
|
60
86
|
};
|
|
61
87
|
export {
|
|
62
|
-
|
|
88
|
+
b as default
|
|
63
89
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useInfiniteScrollTableItems as
|
|
1
|
+
import { useRef as v } from "react";
|
|
2
|
+
import { useIntl as M } from "react-intl";
|
|
3
|
+
import { Text as E, ListCheckbox as S, TableHeader as k, Column as B } from "@box/blueprint-web";
|
|
4
|
+
import { useInfiniteScrollTableItems as O } from "./hooks/useInfiniteScrollTableItems.js";
|
|
5
5
|
import T from "./table-renderer.js";
|
|
6
|
-
import { I as
|
|
7
|
-
import { THUMBNAIL_WIDTHS as
|
|
6
|
+
import { I as P } from "../../../../chunks/types.js";
|
|
7
|
+
import { THUMBNAIL_WIDTHS as U } from "../constants.js";
|
|
8
8
|
import { s } from "../../../../chunks/table-row.js";
|
|
9
|
-
import
|
|
9
|
+
import j from "./messages.js";
|
|
10
10
|
import { jsx as e } from "react/jsx-runtime";
|
|
11
|
-
const
|
|
11
|
+
const F = 40, Q = ({
|
|
12
12
|
columns: o,
|
|
13
13
|
isLoading: l = !1,
|
|
14
14
|
iconColumnVariant: n,
|
|
@@ -17,28 +17,29 @@ const U = 40, K = ({
|
|
|
17
17
|
itemActionMenuProps: I,
|
|
18
18
|
isInfiniteScrollEnabled: R = !1,
|
|
19
19
|
hasNextPage: x = !1,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
onInlineEditChange: C,
|
|
21
|
+
onGetNextPage: W,
|
|
22
|
+
placeholderRowsCount: g,
|
|
22
23
|
zoomLevel: r,
|
|
23
|
-
...
|
|
24
|
+
...w
|
|
24
25
|
}) => {
|
|
25
26
|
var u;
|
|
26
27
|
const {
|
|
27
28
|
formatMessage: c
|
|
28
|
-
} =
|
|
29
|
+
} = M(), f = v(null), {
|
|
29
30
|
virtualItemsToDisplay: p,
|
|
30
|
-
getTableHeight:
|
|
31
|
-
} =
|
|
31
|
+
getTableHeight: y
|
|
32
|
+
} = O({
|
|
32
33
|
items: m,
|
|
33
34
|
hasNextPage: x,
|
|
34
35
|
isLoading: l,
|
|
35
36
|
parentRef: f,
|
|
36
|
-
onGetNextPage:
|
|
37
|
-
placeholderRowsCount:
|
|
38
|
-
}), a = [],
|
|
39
|
-
if (n ===
|
|
40
|
-
r = r ||
|
|
41
|
-
const t = parseInt(
|
|
37
|
+
onGetNextPage: W,
|
|
38
|
+
placeholderRowsCount: g
|
|
39
|
+
}), a = [], A = 0;
|
|
40
|
+
if (n === P.COLUMN) {
|
|
41
|
+
r = r || A;
|
|
42
|
+
const t = parseInt(U[r], 10) + 24;
|
|
42
43
|
a.push({
|
|
43
44
|
id: "item-type-icon",
|
|
44
45
|
isRowHeader: !1,
|
|
@@ -47,31 +48,31 @@ const U = 40, K = ({
|
|
|
47
48
|
maxWidth: t
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
const
|
|
51
|
+
const N = o.map((t) => {
|
|
51
52
|
const {
|
|
52
53
|
id: H,
|
|
53
54
|
headerRenderer: b,
|
|
54
55
|
textValue: i,
|
|
55
|
-
...
|
|
56
|
+
..._
|
|
56
57
|
} = t;
|
|
57
58
|
return {
|
|
58
|
-
children: b ? b(i, t) : /* @__PURE__ */ e(
|
|
59
|
+
children: b ? b(i, t) : /* @__PURE__ */ e(E, {
|
|
59
60
|
as: "span",
|
|
60
61
|
children: i
|
|
61
62
|
}),
|
|
62
63
|
isRowHeader: H === "name",
|
|
63
64
|
id: H,
|
|
64
65
|
textValue: i,
|
|
65
|
-
...
|
|
66
|
+
..._
|
|
66
67
|
};
|
|
67
68
|
});
|
|
68
|
-
a.push(...
|
|
69
|
+
a.push(...N), d && a.push({
|
|
69
70
|
id: "actions",
|
|
70
71
|
className: s.tableHeaderActions,
|
|
71
72
|
children: /* @__PURE__ */ e("div", {
|
|
72
73
|
className: s.tableHeaderActionsWrapper,
|
|
73
|
-
children: /* @__PURE__ */ e(
|
|
74
|
-
"aria-label": c(
|
|
74
|
+
children: /* @__PURE__ */ e(S, {
|
|
75
|
+
"aria-label": c(j.selectAll),
|
|
75
76
|
className: s.selectAllCheckbox,
|
|
76
77
|
isDisabled: l
|
|
77
78
|
})
|
|
@@ -80,22 +81,23 @@ const U = 40, K = ({
|
|
|
80
81
|
hideHeader: !1,
|
|
81
82
|
allowsSorting: !1
|
|
82
83
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const D = /* @__PURE__ */ e(k, {
|
|
85
|
+
columns: a,
|
|
86
|
+
children: (t) => /* @__PURE__ */ e(B, {
|
|
87
|
+
...t
|
|
88
|
+
})
|
|
89
|
+
}), h = {
|
|
90
|
+
columnCount: a.length,
|
|
90
91
|
columns: o,
|
|
92
|
+
formatMessage: c,
|
|
91
93
|
iconColumnVariant: n,
|
|
94
|
+
isLoading: l,
|
|
92
95
|
isSelectAllEnabled: d,
|
|
93
96
|
itemActionMenuProps: I,
|
|
94
97
|
items: m,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
tableProps:
|
|
98
|
-
columnCount: a.length,
|
|
98
|
+
onInlineEditChange: C,
|
|
99
|
+
tableHeader: D,
|
|
100
|
+
tableProps: w,
|
|
99
101
|
zoomLevel: r
|
|
100
102
|
};
|
|
101
103
|
return R ? /* @__PURE__ */ e("div", {
|
|
@@ -105,7 +107,7 @@ const U = 40, K = ({
|
|
|
105
107
|
style: {
|
|
106
108
|
position: "relative",
|
|
107
109
|
width: "100%",
|
|
108
|
-
height:
|
|
110
|
+
height: y() + F
|
|
109
111
|
},
|
|
110
112
|
children: /* @__PURE__ */ e(T, {
|
|
111
113
|
...h,
|
|
@@ -125,5 +127,5 @@ const U = 40, K = ({
|
|
|
125
127
|
});
|
|
126
128
|
};
|
|
127
129
|
export {
|
|
128
|
-
|
|
130
|
+
Q as default
|
|
129
131
|
};
|
package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Cell as c, DropdownMenu as l, Button as a } from "@box/blueprint-web";
|
|
2
|
+
import { CaretDown as g } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import h from "lodash/get";
|
|
4
|
+
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
5
|
+
import '../../../../../../styles/inline-editing-cell.css';const E = "_inlineEditingCell_1xsiq_1", p = {
|
|
6
|
+
inlineEditingCell: E
|
|
7
|
+
}, I = ({
|
|
8
|
+
column: n,
|
|
9
|
+
item: d,
|
|
10
|
+
onInlineEditChange: r
|
|
11
|
+
}) => {
|
|
12
|
+
const s = `${n.id}-${d.id}`, e = h(d, n.id) || "--", o = (i, f) => {
|
|
13
|
+
r(d, i, n.id);
|
|
14
|
+
};
|
|
15
|
+
return /* @__PURE__ */ t(c, {
|
|
16
|
+
children: /* @__PURE__ */ C(l.Root, {
|
|
17
|
+
children: [/* @__PURE__ */ t(l.Trigger, {
|
|
18
|
+
children: /* @__PURE__ */ t(a, {
|
|
19
|
+
className: p.inlineEditingCell,
|
|
20
|
+
icon: g,
|
|
21
|
+
variant: "secondary",
|
|
22
|
+
children: e
|
|
23
|
+
})
|
|
24
|
+
}), /* @__PURE__ */ t(l.Content, {
|
|
25
|
+
align: "start",
|
|
26
|
+
children: n.inlineEditingOptions && n.inlineEditingOptions.map((i) => /* @__PURE__ */ t(l.CheckboxItem, {
|
|
27
|
+
checked: e === i || (e == null ? void 0 : e.includes(i)),
|
|
28
|
+
onSelect: () => o(i, n.id),
|
|
29
|
+
children: i
|
|
30
|
+
}, i))
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
}, s);
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
I as default
|
|
37
|
+
};
|