@box/metadata-view 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/table-body-with-data.js +80 -0
- package/dist/esm/lib/components/metadata-table/metadata-table.js +52 -46
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +8 -40
- package/dist/styles/table-body-with-data.css +1 -0
- package/dist/types/lib/components/metadata-table/metadata-table.d.ts +3 -2
- package/dist/types/lib/components/metadata-table/table-body/table-body-with-data.d.ts +1 -1
- package/dist/types/lib/types.d.ts +8 -2
- package/package.json +4 -4
- package/dist/styles/metadata-table.css +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TableBody as L, Row as x, Cell as c, Text as i, ActionCell as A } from "@box/blueprint-web";
|
|
2
|
+
import h from "lodash/get";
|
|
3
|
+
import { ItemTypeIcon as p } from "@box/item-icon";
|
|
4
|
+
import E from "clsx";
|
|
5
|
+
import { jsx as l, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { ItemActionMenu as f } from "../esm/lib/components/item-action-menu/item-action-menu.js";
|
|
7
|
+
import '../styles/table-body-with-data.css';let a = /* @__PURE__ */ function(t) {
|
|
8
|
+
return t.INLINE = "inline", t.COLUMN = "column", t.INLINE_SUBTITLE = "inline-subtitle", t;
|
|
9
|
+
}({});
|
|
10
|
+
const C = "_tableHeaderActionsWrapper_r2hj7_1", S = "_tableHeaderActions_r2hj7_1", y = "_selectAllCheckbox_r2hj7_33", j = "_tableNameCell_r2hj7_38", B = "_tableNameCellSubTitle_r2hj7_44", I = {
|
|
11
|
+
tableHeaderActionsWrapper: C,
|
|
12
|
+
tableHeaderActions: S,
|
|
13
|
+
selectAllCheckbox: y,
|
|
14
|
+
tableNameCell: j,
|
|
15
|
+
tableNameCellSubTitle: B
|
|
16
|
+
}, g = ({
|
|
17
|
+
columns: t,
|
|
18
|
+
iconColumnVariant: r,
|
|
19
|
+
isSelectAllEnabled: _,
|
|
20
|
+
items: T,
|
|
21
|
+
itemActionMenuProps: b
|
|
22
|
+
}) => /* @__PURE__ */ l(L, {
|
|
23
|
+
items: T.map((e) => ({
|
|
24
|
+
key: e.id,
|
|
25
|
+
...e
|
|
26
|
+
})),
|
|
27
|
+
children: (e) => /* @__PURE__ */ o(x, {
|
|
28
|
+
id: e.id,
|
|
29
|
+
children: [r === a.COLUMN ? /* @__PURE__ */ l(c, {
|
|
30
|
+
children: /* @__PURE__ */ l(p, {
|
|
31
|
+
item: e
|
|
32
|
+
})
|
|
33
|
+
}, `item-type-icon-${e.id}`) : null, t.map((s) => {
|
|
34
|
+
const {
|
|
35
|
+
cellRenderer: N,
|
|
36
|
+
id: n,
|
|
37
|
+
subTitle: m,
|
|
38
|
+
textValue: u
|
|
39
|
+
} = s, d = `${u}-${e.id}`;
|
|
40
|
+
return n === "name" && (r === a.INLINE || r === a.INLINE_SUBTITLE) ? /* @__PURE__ */ l(c, {
|
|
41
|
+
children: /* @__PURE__ */ o("div", {
|
|
42
|
+
className: I.tableNameCell,
|
|
43
|
+
children: [/* @__PURE__ */ l(p, {
|
|
44
|
+
item: e
|
|
45
|
+
}), /* @__PURE__ */ o("div", {
|
|
46
|
+
className: E({
|
|
47
|
+
[I.tableNameCellSubTitle]: r === a.INLINE_SUBTITLE
|
|
48
|
+
}),
|
|
49
|
+
children: [/* @__PURE__ */ l(i, {
|
|
50
|
+
as: "span",
|
|
51
|
+
children: h(e, n)
|
|
52
|
+
}), r === a.INLINE_SUBTITLE ? /* @__PURE__ */ l(i, {
|
|
53
|
+
as: "span",
|
|
54
|
+
color: "textOnLightSecondary",
|
|
55
|
+
children: m
|
|
56
|
+
}) : null]
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
}, d) : N ? /* @__PURE__ */ l(c, {
|
|
60
|
+
children: N(e, s)
|
|
61
|
+
}, d) : /* @__PURE__ */ l(c, {
|
|
62
|
+
children: /* @__PURE__ */ l(i, {
|
|
63
|
+
as: "span",
|
|
64
|
+
children: h(e, n)
|
|
65
|
+
})
|
|
66
|
+
}, d);
|
|
67
|
+
}), _ && /* @__PURE__ */ l(A, {
|
|
68
|
+
children: (s) => b ? /* @__PURE__ */ l(f, {
|
|
69
|
+
...b,
|
|
70
|
+
item: e,
|
|
71
|
+
onOpenChange: s
|
|
72
|
+
}) : null
|
|
73
|
+
})]
|
|
74
|
+
}, e.id)
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
a as I,
|
|
78
|
+
g as T,
|
|
79
|
+
I as s
|
|
80
|
+
};
|
|
@@ -1,75 +1,81 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { useIntl as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Text as x, ListCheckbox as T, Table as g, TableHeader as w, Column as W } from "@box/blueprint-web";
|
|
2
|
+
import { useIntl as y } from "react-intl";
|
|
3
|
+
import C from "./table-body/ghost-table-body.js";
|
|
4
|
+
import { I as M, s as l, T as N } from "../../../../chunks/table-body-with-data.js";
|
|
5
5
|
import h from "./messages.js";
|
|
6
|
-
import { jsx as e, jsxs as
|
|
7
|
-
|
|
8
|
-
tableHeaderActionsWrapper: k,
|
|
9
|
-
tableHeaderActions: W,
|
|
10
|
-
selectAllCheckbox: w
|
|
11
|
-
}, D = ({
|
|
6
|
+
import { jsx as e, jsxs as R } from "react/jsx-runtime";
|
|
7
|
+
const v = ({
|
|
12
8
|
columns: r,
|
|
13
|
-
isLoading:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
isLoading: i,
|
|
10
|
+
iconColumnVariant: o,
|
|
11
|
+
isSelectAllEnabled: d,
|
|
12
|
+
items: p,
|
|
13
|
+
itemActionMenuProps: f,
|
|
14
|
+
...u
|
|
18
15
|
}) => {
|
|
19
16
|
const {
|
|
20
|
-
formatMessage:
|
|
21
|
-
} =
|
|
17
|
+
formatMessage: n
|
|
18
|
+
} = y(), a = [];
|
|
19
|
+
o === M.COLUMN && a.push({
|
|
20
|
+
id: "item-type-icon",
|
|
21
|
+
isRowHeader: !1,
|
|
22
|
+
hideHeader: !1,
|
|
23
|
+
maxWidth: 60,
|
|
24
|
+
minWidth: 60
|
|
25
|
+
});
|
|
26
|
+
const b = r.map((s) => {
|
|
22
27
|
const {
|
|
23
|
-
id:
|
|
24
|
-
headerRenderer:
|
|
28
|
+
id: m,
|
|
29
|
+
headerRenderer: c,
|
|
25
30
|
textValue: t,
|
|
26
|
-
...
|
|
27
|
-
} =
|
|
31
|
+
...H
|
|
32
|
+
} = s;
|
|
28
33
|
return {
|
|
29
|
-
children:
|
|
34
|
+
children: c ? c(t, s) : /* @__PURE__ */ e(x, {
|
|
30
35
|
as: "span",
|
|
31
36
|
children: t
|
|
32
37
|
}),
|
|
33
|
-
isRowHeader:
|
|
34
|
-
id:
|
|
38
|
+
isRowHeader: m === "name",
|
|
39
|
+
id: m,
|
|
35
40
|
textValue: t,
|
|
36
|
-
...
|
|
41
|
+
...H
|
|
37
42
|
};
|
|
38
43
|
});
|
|
39
|
-
return
|
|
44
|
+
return a.push(...b), d && a.push({
|
|
40
45
|
id: "actions",
|
|
41
|
-
className:
|
|
46
|
+
className: l.tableHeaderActions,
|
|
42
47
|
children: /* @__PURE__ */ e("div", {
|
|
43
|
-
className:
|
|
44
|
-
children: /* @__PURE__ */ e(
|
|
45
|
-
"aria-label":
|
|
46
|
-
className:
|
|
47
|
-
isDisabled:
|
|
48
|
+
className: l.tableHeaderActionsWrapper,
|
|
49
|
+
children: /* @__PURE__ */ e(T, {
|
|
50
|
+
"aria-label": n(h.selectAll),
|
|
51
|
+
className: l.selectAllCheckbox,
|
|
52
|
+
isDisabled: i
|
|
48
53
|
})
|
|
49
54
|
}),
|
|
50
55
|
isRowHeader: !1,
|
|
51
56
|
hideHeader: !1,
|
|
52
57
|
allowsSorting: !1
|
|
53
|
-
}), /* @__PURE__ */
|
|
54
|
-
"aria-label":
|
|
58
|
+
}), /* @__PURE__ */ R(g, {
|
|
59
|
+
"aria-label": n(h.listView),
|
|
55
60
|
selectionBehavior: "toggle",
|
|
56
61
|
selectionMode: "multiple",
|
|
57
|
-
...
|
|
58
|
-
children: [/* @__PURE__ */ e(
|
|
59
|
-
columns:
|
|
60
|
-
children: (
|
|
61
|
-
...
|
|
62
|
+
...u,
|
|
63
|
+
children: [/* @__PURE__ */ e(w, {
|
|
64
|
+
columns: a,
|
|
65
|
+
children: (s) => /* @__PURE__ */ e(W, {
|
|
66
|
+
...s
|
|
62
67
|
})
|
|
63
|
-
}),
|
|
64
|
-
columnLength:
|
|
65
|
-
}) : /* @__PURE__ */ e(
|
|
68
|
+
}), i ? /* @__PURE__ */ e(C, {
|
|
69
|
+
columnLength: a.length
|
|
70
|
+
}) : /* @__PURE__ */ e(N, {
|
|
66
71
|
columns: r,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
iconColumnVariant: o,
|
|
73
|
+
isSelectAllEnabled: d,
|
|
74
|
+
itemActionMenuProps: f,
|
|
75
|
+
items: p
|
|
70
76
|
})]
|
|
71
77
|
});
|
|
72
78
|
};
|
|
73
79
|
export {
|
|
74
|
-
|
|
80
|
+
v as default
|
|
75
81
|
};
|
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
items: c,
|
|
9
|
-
itemActionMenuProps: n
|
|
10
|
-
}) => /* @__PURE__ */ e(h, {
|
|
11
|
-
items: c.map((r) => ({
|
|
12
|
-
key: r.id,
|
|
13
|
-
...r
|
|
14
|
-
})),
|
|
15
|
-
children: (r) => /* @__PURE__ */ T(m, {
|
|
16
|
-
id: r.id,
|
|
17
|
-
children: [i.map((l) => {
|
|
18
|
-
const {
|
|
19
|
-
cellRenderer: d,
|
|
20
|
-
id: s,
|
|
21
|
-
textValue: u
|
|
22
|
-
} = l, o = `${u}-${r.id}`;
|
|
23
|
-
return d ? /* @__PURE__ */ e(t, {
|
|
24
|
-
children: d(r, l)
|
|
25
|
-
}, o) : /* @__PURE__ */ e(t, {
|
|
26
|
-
children: /* @__PURE__ */ e(p, {
|
|
27
|
-
as: "span",
|
|
28
|
-
children: x(r, s)
|
|
29
|
-
})
|
|
30
|
-
}, o);
|
|
31
|
-
}), a && /* @__PURE__ */ e(f, {
|
|
32
|
-
children: (l) => n ? /* @__PURE__ */ e(y, {
|
|
33
|
-
...n,
|
|
34
|
-
item: r,
|
|
35
|
-
onOpenChange: l
|
|
36
|
-
}) : null
|
|
37
|
-
})]
|
|
38
|
-
}, r.id)
|
|
39
|
-
});
|
|
1
|
+
import "@box/blueprint-web";
|
|
2
|
+
import "lodash/get";
|
|
3
|
+
import "@box/item-icon";
|
|
4
|
+
import "clsx";
|
|
5
|
+
import { T as f } from "../../../../../chunks/table-body-with-data.js";
|
|
6
|
+
import "react/jsx-runtime";
|
|
7
|
+
import "../../item-action-menu/item-action-menu.js";
|
|
40
8
|
export {
|
|
41
|
-
|
|
9
|
+
f as default
|
|
42
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._tableHeaderActionsWrapper_r2hj7_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_r2hj7_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_r2hj7_1{position:sticky;right:0;width:var(--size-6);padding:0}._selectAllCheckbox_r2hj7_33 svg{transform:none!important}._tableNameCell_r2hj7_38{display:flex;gap:var(--space-3);align-items:center}._tableNameCellSubTitle_r2hj7_44{display:flex;flex-direction:column}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { TableProps } from '@box/blueprint-web';
|
|
2
2
|
import { Item } from '@box/types';
|
|
3
3
|
import { ItemActionMenuProps } from '../item-action-menu';
|
|
4
|
-
import { Column } from '../../types';
|
|
4
|
+
import { IconColumnVariant, Column } from '../../types';
|
|
5
5
|
export interface MetadataTableProps extends TableProps {
|
|
6
6
|
columns: Column[];
|
|
7
|
+
iconColumnVariant?: IconColumnVariant;
|
|
7
8
|
isLoading?: boolean;
|
|
8
9
|
isSelectAllEnabled?: boolean;
|
|
9
10
|
items: Item[];
|
|
10
11
|
itemActionMenuProps?: Omit<ItemActionMenuProps, 'item' | 'onOpenChange'>;
|
|
11
12
|
}
|
|
12
|
-
declare const MetadataTable: ({ columns, isLoading, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const MetadataTable: ({ columns, isLoading, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default MetadataTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TableProps } from '@box/blueprint-web';
|
|
2
2
|
import { MetadataTableProps } from '../metadata-table';
|
|
3
|
-
declare const TableBodyWithData: ({ columns, isSelectAllEnabled, items, itemActionMenuProps, }: Omit<MetadataTableProps, keyof TableProps>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const TableBodyWithData: ({ columns, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, }: Omit<MetadataTableProps, keyof TableProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default TableBodyWithData;
|
|
@@ -6,6 +6,12 @@ export interface Column extends Partial<ColumnProps> {
|
|
|
6
6
|
cellRenderer?: (item: Item, column: Column) => React.ReactNode | undefined;
|
|
7
7
|
headerRenderer?: (name: string, column: Column) => React.ReactNode | undefined;
|
|
8
8
|
id: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
subTitle?: string;
|
|
10
|
+
textValue: string | null;
|
|
11
|
+
type: MetadataFieldType | null;
|
|
12
|
+
}
|
|
13
|
+
export declare enum IconColumnVariant {
|
|
14
|
+
INLINE = "inline",
|
|
15
|
+
COLUMN = "column",
|
|
16
|
+
INLINE_SUBTITLE = "inline-subtitle"
|
|
11
17
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^11.12.0",
|
|
7
7
|
"@box/blueprint-web-assets": "^4.44.1",
|
|
8
|
-
"@box/item-icon": "^0.9.
|
|
8
|
+
"@box/item-icon": "^0.9.172",
|
|
9
9
|
"@box/metadata-filter": "^1.8.4",
|
|
10
10
|
"@box/types": "0.1.0",
|
|
11
11
|
"formik": "^2.4.5",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"@box/blueprint-web": "^11.12.0",
|
|
19
19
|
"@box/blueprint-web-assets": "^4.55.0",
|
|
20
20
|
"@box/eslint-plugin-blueprint": "*",
|
|
21
|
-
"@box/item-icon": "^0.
|
|
22
|
-
"@box/metadata-filter": "^1.10.
|
|
21
|
+
"@box/item-icon": "^0.10.1",
|
|
22
|
+
"@box/metadata-filter": "^1.10.1",
|
|
23
23
|
"@box/storybook-utils": "0.13.8",
|
|
24
24
|
"@box/types": "0.2.0",
|
|
25
25
|
"react-intl": "^6.4.2"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._tableHeaderActionsWrapper_hf6y3_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_hf6y3_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_hf6y3_1{position:sticky;right:0;width:var(--size-6);padding:0}._selectAllCheckbox_hf6y3_33 svg{transform:none!important}
|