@box/metadata-view 0.59.1 → 0.60.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/index.js +67 -63
- package/dist/esm/lib/components/filter-sidepanel/filter.js +45 -36
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +92 -90
- package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +35 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/lib/components/metadata-value/metadata-checkbox-field.d.ts +5 -0
- package/dist/types/lib/types.d.ts +1 -1
- package/package.json +2 -2
package/dist/chunks/index.js
CHANGED
|
@@ -1,96 +1,100 @@
|
|
|
1
|
-
import { Row as L, Cell as n, Text as
|
|
2
|
-
import
|
|
3
|
-
import { ItemTypeIcon as
|
|
4
|
-
import
|
|
5
|
-
import { I as
|
|
6
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as
|
|
1
|
+
import { Row as L, Cell as n, Text as r, ActionCell as E } from "@box/blueprint-web";
|
|
2
|
+
import I from "lodash/get";
|
|
3
|
+
import { ItemTypeIcon as C } from "@box/item-icon";
|
|
4
|
+
import y from "clsx";
|
|
5
|
+
import { I as o } from "./types.js";
|
|
6
|
+
import { THUMBNAIL_LIST_VIEW_HEIGHTS as R } from "../esm/lib/components/constants.js";
|
|
7
7
|
import { jsxs as b, jsx as e } from "react/jsx-runtime";
|
|
8
|
-
import { ItemActionMenu as
|
|
9
|
-
import '../styles/index.css';const
|
|
10
|
-
tableHeaderActionsWrapper:
|
|
11
|
-
tableHeaderActions:
|
|
12
|
-
tableRow:
|
|
13
|
-
selectAllCheckbox:
|
|
14
|
-
tableNameCell:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import { ItemActionMenu as g } from "../esm/lib/components/item-action-menu/item-action-menu.js";
|
|
9
|
+
import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k = "_tableHeaderActions_1a999_1", U = "_tableRow_1a999_33", B = "_selectAllCheckbox_1a999_42", W = "_tableNameCell_1a999_47", j = "_tableNameCellTitle_1a999_53", F = "_hasSubtitle_1a999_57", M = "_tableNameCellText_1a999_62", $ = "_tableNameCellIconInline_1a999_67", v = "_infiniteScrollTableContainerFullHeight_1a999_71", O = "_iconCell_1a999_77", t = {
|
|
10
|
+
tableHeaderActionsWrapper: w,
|
|
11
|
+
tableHeaderActions: k,
|
|
12
|
+
tableRow: U,
|
|
13
|
+
selectAllCheckbox: B,
|
|
14
|
+
tableNameCell: W,
|
|
15
|
+
tableNameCellTitle: j,
|
|
16
|
+
hasSubtitle: F,
|
|
17
|
+
tableNameCellText: M,
|
|
18
|
+
tableNameCellIconInline: $,
|
|
19
|
+
infiniteScrollTableContainerFullHeight: v,
|
|
20
|
+
iconCell: O
|
|
21
|
+
}, Y = ({
|
|
20
22
|
item: l,
|
|
21
23
|
columns: h,
|
|
22
|
-
iconColumnVariant:
|
|
23
|
-
isSelectAllEnabled:
|
|
24
|
-
itemActionMenuProps:
|
|
25
|
-
areSelectionCheckboxesDisabled:
|
|
26
|
-
zoomLevel:
|
|
24
|
+
iconColumnVariant: a,
|
|
25
|
+
isSelectAllEnabled: T,
|
|
26
|
+
itemActionMenuProps: _,
|
|
27
|
+
areSelectionCheckboxesDisabled: p,
|
|
28
|
+
zoomLevel: u = 0
|
|
27
29
|
}) => /* @__PURE__ */ b(L, {
|
|
28
|
-
className:
|
|
30
|
+
className: t.tableRow,
|
|
29
31
|
id: l.id,
|
|
30
|
-
children: [
|
|
32
|
+
children: [a === o.COLUMN ? /* @__PURE__ */ e(n, {
|
|
31
33
|
style: {
|
|
32
|
-
height:
|
|
34
|
+
height: R[u]
|
|
33
35
|
},
|
|
34
|
-
children: /* @__PURE__ */ e(
|
|
35
|
-
className:
|
|
36
|
+
children: /* @__PURE__ */ e(C, {
|
|
37
|
+
className: t.iconCell,
|
|
36
38
|
item: l
|
|
37
39
|
})
|
|
38
|
-
}, `item-type-icon-${l.id}`) : null, h.map((
|
|
40
|
+
}, `item-type-icon-${l.id}`) : null, h.map((c) => {
|
|
39
41
|
const {
|
|
40
|
-
cellRenderer:
|
|
41
|
-
id:
|
|
42
|
-
isItemMetadata:
|
|
43
|
-
subtitle:
|
|
44
|
-
textValue:
|
|
45
|
-
type:
|
|
46
|
-
} =
|
|
47
|
-
if (
|
|
42
|
+
cellRenderer: d,
|
|
43
|
+
id: s,
|
|
44
|
+
isItemMetadata: x,
|
|
45
|
+
subtitle: f,
|
|
46
|
+
textValue: S,
|
|
47
|
+
type: H
|
|
48
|
+
} = c, i = `${S}-${l.id}`, A = x ? s.split(".")[1] : s, m = I(l, A);
|
|
49
|
+
if (s === "name" && (a === o.INLINE || a === o.INLINE_SUBTITLE))
|
|
48
50
|
return /* @__PURE__ */ e(n, {
|
|
49
51
|
children: /* @__PURE__ */ b("div", {
|
|
50
|
-
className:
|
|
51
|
-
children: [/* @__PURE__ */ e(
|
|
52
|
+
className: t.tableNameCell,
|
|
53
|
+
children: [/* @__PURE__ */ e(C, {
|
|
52
54
|
item: l
|
|
53
55
|
}), /* @__PURE__ */ b("div", {
|
|
54
|
-
className:
|
|
55
|
-
[
|
|
56
|
+
className: y(t.tableNameCellTitle, {
|
|
57
|
+
[t.hasSubtitle]: a === o.INLINE_SUBTITLE
|
|
56
58
|
}),
|
|
57
|
-
children: [/* @__PURE__ */ e(
|
|
59
|
+
children: [/* @__PURE__ */ e(r, {
|
|
58
60
|
as: "span",
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
className: t.tableNameCellText,
|
|
62
|
+
children: m
|
|
63
|
+
}), a === o.INLINE_SUBTITLE ? /* @__PURE__ */ e(r, {
|
|
61
64
|
as: "span",
|
|
65
|
+
className: t.tableNameCellText,
|
|
62
66
|
color: "textOnLightSecondary",
|
|
63
|
-
children:
|
|
67
|
+
children: f
|
|
64
68
|
}) : null]
|
|
65
69
|
})]
|
|
66
70
|
})
|
|
67
|
-
},
|
|
68
|
-
if (
|
|
71
|
+
}, i);
|
|
72
|
+
if (d)
|
|
69
73
|
return /* @__PURE__ */ e(n, {
|
|
70
|
-
children:
|
|
71
|
-
},
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
+
children: d(l, c)
|
|
75
|
+
}, i);
|
|
76
|
+
if (H === "multiSelect") {
|
|
77
|
+
const N = I(l, s);
|
|
74
78
|
return /* @__PURE__ */ e(n, {
|
|
75
|
-
children:
|
|
76
|
-
},
|
|
79
|
+
children: N ? N.join(" ") : ""
|
|
80
|
+
}, i);
|
|
77
81
|
}
|
|
78
82
|
return /* @__PURE__ */ e(n, {
|
|
79
|
-
children: /* @__PURE__ */ e(
|
|
83
|
+
children: /* @__PURE__ */ e(r, {
|
|
80
84
|
as: "span",
|
|
81
|
-
children:
|
|
85
|
+
children: m
|
|
82
86
|
})
|
|
83
|
-
},
|
|
84
|
-
}),
|
|
85
|
-
isCheckboxDisabled:
|
|
86
|
-
children: (
|
|
87
|
-
...
|
|
87
|
+
}, i);
|
|
88
|
+
}), T && /* @__PURE__ */ e(E, {
|
|
89
|
+
isCheckboxDisabled: p,
|
|
90
|
+
children: (c) => _ ? /* @__PURE__ */ e(g, {
|
|
91
|
+
..._,
|
|
88
92
|
item: l,
|
|
89
|
-
onOpenChange:
|
|
93
|
+
onOpenChange: c
|
|
90
94
|
}) : null
|
|
91
95
|
})]
|
|
92
96
|
}, l.id);
|
|
93
97
|
export {
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
Y as T,
|
|
99
|
+
t as s
|
|
96
100
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { MetadataStringField as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import { MetadataFileField as
|
|
4
|
-
import { MetadataLocationField as
|
|
5
|
-
import { MetadataRadioField as
|
|
6
|
-
import {
|
|
1
|
+
import { MetadataStringField as f, MetadataMultiSelectField as s, MetadataEnumField as m, MetadataFloatField as F, MetadataDateField as M } from "@box/metadata-filter";
|
|
2
|
+
import { useIntl as d } from "react-intl";
|
|
3
|
+
import { MetadataFileField as x } from "../metadata-value/metadata-file-field.js";
|
|
4
|
+
import { MetadataLocationField as b } from "../metadata-value/metadata-location-field.js";
|
|
5
|
+
import { MetadataRadioField as h } from "../metadata-value/metadata-radio-field.js";
|
|
6
|
+
import { MetadataCheckboxField as S } from "../metadata-value/metadata-checkbox-field.js";
|
|
7
|
+
import { MetadataSearchField as g } from "../metadata-value/metadata-search-field.js";
|
|
7
8
|
import { jsx as t } from "react/jsx-runtime";
|
|
8
|
-
const i = (e) => `metadata.fields.${e}`,
|
|
9
|
+
const i = (e) => `metadata.fields.${e}`, P = ({
|
|
9
10
|
id: e,
|
|
10
11
|
name: a,
|
|
11
12
|
placeholder: l,
|
|
@@ -13,19 +14,20 @@ const i = (e) => `metadata.fields.${e}`, g = ({
|
|
|
13
14
|
}) => {
|
|
14
15
|
switch (r) {
|
|
15
16
|
case "search":
|
|
16
|
-
return /* @__PURE__ */ t(
|
|
17
|
+
return /* @__PURE__ */ t(g, {
|
|
17
18
|
id: e,
|
|
18
19
|
name: a,
|
|
19
20
|
placeholder: l
|
|
20
21
|
});
|
|
21
22
|
case "default":
|
|
22
23
|
default:
|
|
23
|
-
return /* @__PURE__ */ t(
|
|
24
|
+
return /* @__PURE__ */ t(f, {
|
|
24
25
|
fieldNamePrefix: i(e),
|
|
25
|
-
label: a || ""
|
|
26
|
+
label: a || "",
|
|
27
|
+
placeholder: l
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
|
-
},
|
|
30
|
+
}, N = ({
|
|
29
31
|
id: e,
|
|
30
32
|
name: a,
|
|
31
33
|
variant: l,
|
|
@@ -33,56 +35,63 @@ const i = (e) => `metadata.fields.${e}`, g = ({
|
|
|
33
35
|
}) => {
|
|
34
36
|
switch (l) {
|
|
35
37
|
case "file":
|
|
36
|
-
return /* @__PURE__ */ t(
|
|
38
|
+
return /* @__PURE__ */ t(x, {
|
|
37
39
|
id: e
|
|
38
40
|
});
|
|
41
|
+
case "checkbox":
|
|
42
|
+
return /* @__PURE__ */ t(S, {
|
|
43
|
+
id: e,
|
|
44
|
+
name: a
|
|
45
|
+
});
|
|
39
46
|
case "default":
|
|
40
47
|
default:
|
|
41
|
-
return /* @__PURE__ */ t(
|
|
48
|
+
return /* @__PURE__ */ t(s, {
|
|
42
49
|
fieldNamePrefix: i(e),
|
|
43
50
|
label: a || "",
|
|
44
51
|
portalElement: r
|
|
45
52
|
});
|
|
46
53
|
}
|
|
47
|
-
},
|
|
54
|
+
}, w = ({
|
|
48
55
|
id: e,
|
|
49
56
|
name: a,
|
|
50
57
|
parentRef: l,
|
|
51
58
|
variant: r,
|
|
52
59
|
renderer: c,
|
|
53
|
-
triggerCallback:
|
|
60
|
+
triggerCallback: o,
|
|
61
|
+
placeholder: n
|
|
54
62
|
}) => {
|
|
55
63
|
const {
|
|
56
|
-
locale:
|
|
57
|
-
} =
|
|
64
|
+
locale: u
|
|
65
|
+
} = d();
|
|
58
66
|
switch (r) {
|
|
59
67
|
case "file":
|
|
60
|
-
return /* @__PURE__ */ t(
|
|
68
|
+
return /* @__PURE__ */ t(b, {
|
|
61
69
|
id: e,
|
|
62
70
|
renderer: c,
|
|
63
|
-
triggerSetValueCallback:
|
|
71
|
+
triggerSetValueCallback: o
|
|
64
72
|
});
|
|
65
73
|
case "radio":
|
|
66
|
-
return /* @__PURE__ */ t(
|
|
74
|
+
return /* @__PURE__ */ t(h, {
|
|
67
75
|
id: e,
|
|
68
76
|
name: a
|
|
69
77
|
});
|
|
70
78
|
case "default":
|
|
71
79
|
default:
|
|
72
|
-
return /* @__PURE__ */ t(
|
|
80
|
+
return /* @__PURE__ */ t(m, {
|
|
73
81
|
fieldNamePrefix: i(e),
|
|
74
82
|
label: a || "",
|
|
75
|
-
locale:
|
|
83
|
+
locale: u,
|
|
84
|
+
placeholder: n,
|
|
76
85
|
portalElement: l
|
|
77
86
|
});
|
|
78
87
|
}
|
|
79
|
-
},
|
|
88
|
+
}, E = ({
|
|
80
89
|
id: e,
|
|
81
90
|
name: a
|
|
82
|
-
}) => /* @__PURE__ */ t(
|
|
91
|
+
}) => /* @__PURE__ */ t(F, {
|
|
83
92
|
fieldNamePrefix: i(e),
|
|
84
93
|
label: a || ""
|
|
85
|
-
}),
|
|
94
|
+
}), k = ({
|
|
86
95
|
customLabels: e,
|
|
87
96
|
canUseRelativeDates: a,
|
|
88
97
|
customDateFilterOptions: l,
|
|
@@ -90,39 +99,39 @@ const i = (e) => `metadata.fields.${e}`, g = ({
|
|
|
90
99
|
name: c
|
|
91
100
|
}) => {
|
|
92
101
|
const {
|
|
93
|
-
locale:
|
|
94
|
-
} =
|
|
95
|
-
return /* @__PURE__ */ t(
|
|
102
|
+
locale: o
|
|
103
|
+
} = d();
|
|
104
|
+
return /* @__PURE__ */ t(M, {
|
|
96
105
|
canUseRelativeDates: a,
|
|
97
106
|
customDateFilterOptions: l,
|
|
98
107
|
customFieldLabels: e,
|
|
99
108
|
direction: "vertical",
|
|
100
109
|
fieldNamePrefix: i(r),
|
|
101
110
|
label: c || "",
|
|
102
|
-
locale:
|
|
111
|
+
locale: o
|
|
103
112
|
});
|
|
104
|
-
},
|
|
113
|
+
}, R = ({
|
|
105
114
|
...e
|
|
106
115
|
}) => {
|
|
107
116
|
switch (e.fieldType) {
|
|
108
117
|
case "string":
|
|
109
|
-
return /* @__PURE__ */ t(
|
|
118
|
+
return /* @__PURE__ */ t(P, {
|
|
110
119
|
...e
|
|
111
120
|
});
|
|
112
121
|
case "float":
|
|
113
|
-
return /* @__PURE__ */ t(
|
|
122
|
+
return /* @__PURE__ */ t(E, {
|
|
114
123
|
...e
|
|
115
124
|
});
|
|
116
125
|
case "date":
|
|
117
|
-
return /* @__PURE__ */ t(
|
|
126
|
+
return /* @__PURE__ */ t(k, {
|
|
118
127
|
...e
|
|
119
128
|
});
|
|
120
129
|
case "multiSelect":
|
|
121
|
-
return /* @__PURE__ */ t(
|
|
130
|
+
return /* @__PURE__ */ t(N, {
|
|
122
131
|
...e
|
|
123
132
|
});
|
|
124
133
|
case "enum":
|
|
125
|
-
return /* @__PURE__ */ t(
|
|
134
|
+
return /* @__PURE__ */ t(w, {
|
|
126
135
|
...e
|
|
127
136
|
});
|
|
128
137
|
default:
|
|
@@ -130,5 +139,5 @@ const i = (e) => `metadata.fields.${e}`, g = ({
|
|
|
130
139
|
}
|
|
131
140
|
};
|
|
132
141
|
export {
|
|
133
|
-
|
|
142
|
+
R as Filter
|
|
134
143
|
};
|
|
@@ -1,130 +1,132 @@
|
|
|
1
|
-
import { TableBody as
|
|
1
|
+
import { TableBody as C, Row as L, Cell as h, ActionCell as g, Text as u } from "@box/blueprint-web";
|
|
2
2
|
import { ItemTypeIcon as y } from "@box/item-icon";
|
|
3
3
|
import R from "clsx";
|
|
4
4
|
import $ from "lodash/get";
|
|
5
|
-
import
|
|
6
|
-
import { I as
|
|
5
|
+
import I from "react";
|
|
6
|
+
import { I as N } from "../../../../../chunks/types.js";
|
|
7
7
|
import { THUMBNAIL_LIST_VIEW_HEIGHTS as S } from "../../constants.js";
|
|
8
|
-
import { s as
|
|
9
|
-
import { jsx as
|
|
8
|
+
import { s as i, T as w } from "../../../../../chunks/index.js";
|
|
9
|
+
import { jsx as l, jsxs as T } from "react/jsx-runtime";
|
|
10
10
|
import { InlineEditingCell as B } from "./inline-editing-cell/inline-editing-cell.js";
|
|
11
11
|
import { ItemActionMenu as _ } from "../../item-action-menu/item-action-menu.js";
|
|
12
12
|
import { GhostTableRow as k } from "./ghost-table-row/ghost-table-row.js";
|
|
13
|
-
const
|
|
14
|
-
const n =
|
|
13
|
+
const b = (t, e, r) => {
|
|
14
|
+
const n = r ? e.split(".")[1] : e;
|
|
15
15
|
return $(t, n);
|
|
16
|
-
}, M = /* @__PURE__ */
|
|
16
|
+
}, M = /* @__PURE__ */ I.memo(({
|
|
17
17
|
item: t,
|
|
18
18
|
column: e,
|
|
19
|
-
iconColumnVariant:
|
|
19
|
+
iconColumnVariant: r
|
|
20
20
|
}) => {
|
|
21
21
|
const {
|
|
22
22
|
id: n,
|
|
23
23
|
isItemMetadata: s,
|
|
24
|
-
subtitle:
|
|
25
|
-
textValue:
|
|
26
|
-
} = e,
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
className:
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
className:
|
|
24
|
+
subtitle: a,
|
|
25
|
+
textValue: m
|
|
26
|
+
} = e, d = `${m}-${t.id}`;
|
|
27
|
+
return /* @__PURE__ */ l(h, {
|
|
28
|
+
children: /* @__PURE__ */ T("div", {
|
|
29
|
+
className: i.tableNameCell,
|
|
30
|
+
children: [/* @__PURE__ */ l(y, {
|
|
31
|
+
className: i.tableNameCellIconInline,
|
|
32
32
|
item: t
|
|
33
|
-
}), /* @__PURE__ */
|
|
34
|
-
className: R({
|
|
35
|
-
[
|
|
33
|
+
}), /* @__PURE__ */ T("div", {
|
|
34
|
+
className: R(i.tableNameCellTitle, {
|
|
35
|
+
[i.hasSubtitle]: r === N.INLINE_SUBTITLE
|
|
36
36
|
}),
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ l(u, {
|
|
38
38
|
as: "span",
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
className: i.tableNameCellText,
|
|
40
|
+
children: b(t, n, s)
|
|
41
|
+
}), r === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
|
|
41
42
|
as: "span",
|
|
43
|
+
className: i.tableNameCellText,
|
|
42
44
|
color: "textOnLightSecondary",
|
|
43
|
-
children:
|
|
45
|
+
children: a
|
|
44
46
|
})]
|
|
45
47
|
})]
|
|
46
48
|
})
|
|
47
|
-
},
|
|
48
|
-
}), U = /* @__PURE__ */
|
|
49
|
+
}, d);
|
|
50
|
+
}), U = /* @__PURE__ */ I.memo(({
|
|
49
51
|
item: t,
|
|
50
52
|
column: e
|
|
51
53
|
}) => {
|
|
52
54
|
var n;
|
|
53
|
-
const
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
+
const r = `${e.textValue}-${t.id}`;
|
|
56
|
+
return /* @__PURE__ */ l(h, {
|
|
55
57
|
children: (n = e.cellRenderer) == null ? void 0 : n.call(e, t, e)
|
|
56
|
-
},
|
|
57
|
-
}), W = /* @__PURE__ */
|
|
58
|
+
}, r);
|
|
59
|
+
}), W = /* @__PURE__ */ I.memo(({
|
|
58
60
|
item: t,
|
|
59
61
|
column: e
|
|
60
62
|
}) => {
|
|
61
|
-
const
|
|
62
|
-
return n ? /* @__PURE__ */
|
|
63
|
+
const r = `${e.textValue}-${t.id}`, n = $(t, e.id);
|
|
64
|
+
return n ? /* @__PURE__ */ l(h, {
|
|
63
65
|
children: n.join(" ")
|
|
64
|
-
},
|
|
65
|
-
}), j = /* @__PURE__ */
|
|
66
|
+
}, r) : /* @__PURE__ */ l(h, {}, r);
|
|
67
|
+
}), j = /* @__PURE__ */ I.memo(({
|
|
66
68
|
item: t,
|
|
67
69
|
column: e
|
|
68
70
|
}) => {
|
|
69
71
|
const {
|
|
70
|
-
id:
|
|
72
|
+
id: r,
|
|
71
73
|
isItemMetadata: n,
|
|
72
74
|
textValue: s
|
|
73
|
-
} = e,
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
children: /* @__PURE__ */
|
|
75
|
+
} = e, a = `${s}-${t.id}`;
|
|
76
|
+
return /* @__PURE__ */ l(h, {
|
|
77
|
+
children: /* @__PURE__ */ l(u, {
|
|
76
78
|
as: "span",
|
|
77
|
-
children:
|
|
79
|
+
children: b(t, r, n)
|
|
78
80
|
})
|
|
79
|
-
},
|
|
80
|
-
}), D = /* @__PURE__ */
|
|
81
|
+
}, a);
|
|
82
|
+
}), D = /* @__PURE__ */ I.memo(({
|
|
81
83
|
item: t,
|
|
82
84
|
column: e,
|
|
83
|
-
iconColumnVariant:
|
|
85
|
+
iconColumnVariant: r,
|
|
84
86
|
onInlineEditChange: n
|
|
85
87
|
}) => {
|
|
86
88
|
const {
|
|
87
89
|
cellRenderer: s,
|
|
88
|
-
id:
|
|
89
|
-
isInlineEditingEnabled:
|
|
90
|
-
type:
|
|
90
|
+
id: a,
|
|
91
|
+
isInlineEditingEnabled: m,
|
|
92
|
+
type: d
|
|
91
93
|
} = e;
|
|
92
|
-
return
|
|
94
|
+
return a === "item.name" && (r === N.INLINE || r === N.INLINE_SUBTITLE) ? /* @__PURE__ */ l(M, {
|
|
93
95
|
column: e,
|
|
94
|
-
iconColumnVariant:
|
|
96
|
+
iconColumnVariant: r,
|
|
95
97
|
item: t
|
|
96
|
-
}) : s ? /* @__PURE__ */
|
|
98
|
+
}) : s ? /* @__PURE__ */ l(U, {
|
|
97
99
|
column: e,
|
|
98
100
|
item: t
|
|
99
|
-
}) :
|
|
101
|
+
}) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ l(B, {
|
|
100
102
|
column: e,
|
|
101
103
|
item: t,
|
|
102
104
|
onInlineEditChange: n
|
|
103
|
-
}, `${e.id}-${t.id}`) :
|
|
105
|
+
}, `${e.id}-${t.id}`) : d === "multiSelect" ? /* @__PURE__ */ l(W, {
|
|
104
106
|
column: e,
|
|
105
107
|
item: t
|
|
106
|
-
}) : /* @__PURE__ */
|
|
108
|
+
}) : /* @__PURE__ */ l(j, {
|
|
107
109
|
column: e,
|
|
108
110
|
item: t
|
|
109
111
|
});
|
|
110
|
-
}), G = /* @__PURE__ */
|
|
112
|
+
}), G = /* @__PURE__ */ I.memo(({
|
|
111
113
|
item: t,
|
|
112
114
|
zoomLevel: e
|
|
113
|
-
}) => /* @__PURE__ */
|
|
115
|
+
}) => /* @__PURE__ */ l(h, {
|
|
114
116
|
style: {
|
|
115
117
|
height: S[e]
|
|
116
118
|
},
|
|
117
|
-
children: /* @__PURE__ */
|
|
118
|
-
className:
|
|
119
|
+
children: /* @__PURE__ */ l(y, {
|
|
120
|
+
className: i.iconCell,
|
|
119
121
|
item: t
|
|
120
122
|
})
|
|
121
|
-
}, `item-type-icon-${t.id}`)), H = /* @__PURE__ */
|
|
123
|
+
}, `item-type-icon-${t.id}`)), H = /* @__PURE__ */ I.memo(({
|
|
122
124
|
item: t,
|
|
123
125
|
itemActionMenuProps: e,
|
|
124
|
-
isCheckboxDisabled:
|
|
125
|
-
}) => /* @__PURE__ */
|
|
126
|
-
isCheckboxDisabled:
|
|
127
|
-
children: (n) => e ? /* @__PURE__ */
|
|
126
|
+
isCheckboxDisabled: r
|
|
127
|
+
}) => /* @__PURE__ */ l(g, {
|
|
128
|
+
isCheckboxDisabled: r,
|
|
129
|
+
children: (n) => e ? /* @__PURE__ */ l(_, {
|
|
128
130
|
...e,
|
|
129
131
|
item: t,
|
|
130
132
|
onOpenChange: n
|
|
@@ -132,54 +134,54 @@ const E = (t, e, l) => {
|
|
|
132
134
|
})), z = ({
|
|
133
135
|
columns: t,
|
|
134
136
|
iconColumnVariant: e,
|
|
135
|
-
isSelectAllEnabled:
|
|
137
|
+
isSelectAllEnabled: r,
|
|
136
138
|
items: n,
|
|
137
139
|
itemActionMenuProps: s,
|
|
138
|
-
areSelectionCheckboxesDisabled:
|
|
139
|
-
virtualItems:
|
|
140
|
-
columnCount:
|
|
141
|
-
zoomLevel:
|
|
142
|
-
onInlineEditChange:
|
|
140
|
+
areSelectionCheckboxesDisabled: a,
|
|
141
|
+
virtualItems: m,
|
|
142
|
+
columnCount: d,
|
|
143
|
+
zoomLevel: p,
|
|
144
|
+
onInlineEditChange: x
|
|
143
145
|
}) => {
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
146
|
-
const o = (
|
|
147
|
-
columnLength:
|
|
148
|
-
rowKey: `ghost-${
|
|
149
|
-
}),
|
|
150
|
-
areSelectionCheckboxesDisabled:
|
|
146
|
+
const E = e === N.COLUMN;
|
|
147
|
+
if (m) {
|
|
148
|
+
const o = (c) => /* @__PURE__ */ l(k, {
|
|
149
|
+
columnLength: d || 0,
|
|
150
|
+
rowKey: `ghost-${c}`
|
|
151
|
+
}), f = (c) => /* @__PURE__ */ l(w, {
|
|
152
|
+
areSelectionCheckboxesDisabled: a,
|
|
151
153
|
columns: t,
|
|
152
154
|
iconColumnVariant: e,
|
|
153
|
-
isSelectAllEnabled:
|
|
154
|
-
item:
|
|
155
|
+
isSelectAllEnabled: r,
|
|
156
|
+
item: c,
|
|
155
157
|
itemActionMenuProps: s,
|
|
156
|
-
zoomLevel:
|
|
158
|
+
zoomLevel: p
|
|
157
159
|
});
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
items:
|
|
160
|
+
return /* @__PURE__ */ l(C, {
|
|
161
|
+
items: m,
|
|
160
162
|
children: ({
|
|
161
|
-
index:
|
|
162
|
-
}) =>
|
|
163
|
+
index: c
|
|
164
|
+
}) => c >= n.length ? o(c) : f(n[c])
|
|
163
165
|
});
|
|
164
166
|
}
|
|
165
|
-
return /* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ l(C, {
|
|
166
168
|
items: n.map((o) => ({
|
|
167
169
|
key: o.id,
|
|
168
170
|
...o
|
|
169
171
|
})),
|
|
170
|
-
children: (o) => /* @__PURE__ */
|
|
171
|
-
className:
|
|
172
|
+
children: (o) => /* @__PURE__ */ T(L, {
|
|
173
|
+
className: i.tableRow,
|
|
172
174
|
id: o.id,
|
|
173
|
-
children: [
|
|
175
|
+
children: [E && /* @__PURE__ */ l(G, {
|
|
174
176
|
item: o,
|
|
175
|
-
zoomLevel:
|
|
176
|
-
}), t.map((
|
|
177
|
-
column:
|
|
177
|
+
zoomLevel: p
|
|
178
|
+
}), t.map((f) => /* @__PURE__ */ l(D, {
|
|
179
|
+
column: f,
|
|
178
180
|
iconColumnVariant: e,
|
|
179
181
|
item: o,
|
|
180
|
-
onInlineEditChange:
|
|
181
|
-
}, `${
|
|
182
|
-
isCheckboxDisabled:
|
|
182
|
+
onInlineEditChange: x
|
|
183
|
+
}, `${f.textValue}-${o.id}`)), r && /* @__PURE__ */ l(H, {
|
|
184
|
+
isCheckboxDisabled: a,
|
|
183
185
|
item: o,
|
|
184
186
|
itemActionMenuProps: s
|
|
185
187
|
})]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useFormikContext as C } from "formik";
|
|
2
|
+
import { Checkbox as c } from "@box/blueprint-web";
|
|
3
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
+
const b = ({
|
|
5
|
+
id: a,
|
|
6
|
+
name: i
|
|
7
|
+
}) => {
|
|
8
|
+
var l, s, r;
|
|
9
|
+
const {
|
|
10
|
+
values: n,
|
|
11
|
+
setFieldValue: u
|
|
12
|
+
} = C(), h = ((l = n.metadata.fields[a]) == null ? void 0 : l.options) || [], d = ((r = (s = n.metadata.fields[a]) == null ? void 0 : s.value) == null ? void 0 : r.enum) || [], f = (e, o) => {
|
|
13
|
+
const t = new Set(d);
|
|
14
|
+
o ? t.add(e) : t.delete(e), u(`metadata.fields.${a}.value.enum`, Array.from(t));
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ m(c.Legend, {
|
|
17
|
+
header: i,
|
|
18
|
+
children: h.map(({
|
|
19
|
+
key: e
|
|
20
|
+
}) => {
|
|
21
|
+
const o = d.includes(e);
|
|
22
|
+
return /* @__PURE__ */ m(c.Item, {
|
|
23
|
+
checked: o,
|
|
24
|
+
label: e,
|
|
25
|
+
onCheckedChange: (t) => {
|
|
26
|
+
f(e, t === !0);
|
|
27
|
+
},
|
|
28
|
+
value: e
|
|
29
|
+
}, e);
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
b as MetadataCheckboxField
|
|
35
|
+
};
|
package/dist/styles/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._tableHeaderActionsWrapper_1a999_1{position:absolute;top:0;right:var(--size-4);bottom:0;display:flex;gap:var(--space-2);align-items:center;justify-content:center;padding:0 var(--space-2);background:var(--item-background);margin-block:var(--space-2)}._tableHeaderActionsWrapper_1a999_1:before{position:absolute;left:0;z-index:0;display:block;width:0;height:50%;box-shadow:-.25rem 0 .625rem .625rem var(--item-background);content:""}._tableHeaderActions_1a999_1{position:sticky;right:0;width:var(--size-6);padding:0}._tableRow_1a999_33:after{height:100%!important}._tableRow_1a999_33[aria-selected=true]:after{height:100%!important}._selectAllCheckbox_1a999_42 svg{transform:none!important}._tableNameCell_1a999_47{display:flex;gap:var(--space-3);align-items:center}._tableNameCellTitle_1a999_53{overflow:hidden;text-overflow:ellipsis}._tableNameCellTitle_1a999_53._hasSubtitle_1a999_57{display:flex;flex-direction:column}._tableNameCellText_1a999_62{overflow:hidden;text-overflow:ellipsis}._tableNameCellIconInline_1a999_67{flex-shrink:0}._infiniteScrollTableContainerFullHeight_1a999_71{width:100%;height:100%;overflow:auto}._iconCell_1a999_77{width:100%!important;height:100%!important}
|
|
@@ -2,7 +2,7 @@ import { ColumnProps } from '@box/blueprint-web';
|
|
|
2
2
|
import { Item } from '@box/types';
|
|
3
3
|
import { ItemActionMenuProps } from './components/item-action-menu';
|
|
4
4
|
export type MetadataFieldType = 'date' | 'enum' | 'float' | 'multiSelect' | 'string';
|
|
5
|
-
export type FilterVariant = 'default' | 'search' | 'file' | 'radio' | 'relative';
|
|
5
|
+
export type FilterVariant = 'default' | 'search' | 'file' | 'radio' | 'relative' | 'checkbox';
|
|
6
6
|
export interface Column extends Partial<ColumnProps> {
|
|
7
7
|
cellRenderer?: (item: Item, column: Column) => React.ReactNode | undefined;
|
|
8
8
|
headerRenderer?: (name: string, column: Column) => React.ReactNode | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^12.76.2",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@box/box-item-type-selector": "^0.76.4",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
25
25
|
"@box/item-icon": "^0.30.4",
|
|
26
|
-
"@box/metadata-filter": "^1.
|
|
26
|
+
"@box/metadata-filter": "^1.36.0",
|
|
27
27
|
"@box/storybook-utils": "0.14.7",
|
|
28
28
|
"@box/types": "0.2.1",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|