@box/metadata-view 0.23.2 → 0.24.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/form-filter-chip.js +66 -0
- package/dist/esm/lib/components/error-state/error-state.js +1 -1
- package/dist/esm/lib/components/filter-row/filter-row.js +41 -64
- package/dist/esm/lib/components/filter-row/{string-filter-chip.js → form-filter-chip.js} +4 -4
- package/dist/esm/lib/components/filter-row/initial-field-values.js +16 -11
- package/dist/esm/lib/components/filter-row/messages.js +4 -0
- package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +50 -0
- package/dist/esm/lib/components/filter-row/select-filter-chip.js +54 -0
- package/dist/esm/lib/components/pagination/index.js +10 -0
- package/dist/esm/lib/components/pagination/marker-based-pagination.js +20 -0
- package/dist/esm/lib/components/pagination/messages.js +22 -0
- package/dist/esm/lib/components/pagination/offset-based-pagination.js +32 -0
- package/dist/esm/lib/components/pagination/pagination-controls.js +53 -0
- package/dist/esm/lib/components/pagination/pagination.js +34 -5
- package/dist/esm/lib/components/pagination/utils.js +7 -0
- package/dist/esm/lib/metadata-view.js +42 -38
- package/dist/i18n/bn-IN.js +6 -1
- package/dist/i18n/da-DK.js +6 -1
- package/dist/i18n/de-DE.js +6 -1
- package/dist/i18n/en-AU.js +6 -1
- package/dist/i18n/en-CA.js +6 -1
- package/dist/i18n/en-GB.js +6 -1
- package/dist/i18n/en-US.js +6 -1
- package/dist/i18n/en-US.properties +10 -0
- package/dist/i18n/en-x-pseudo.js +6 -1
- package/dist/i18n/es-419.js +6 -1
- package/dist/i18n/es-ES.js +6 -1
- package/dist/i18n/fi-FI.js +6 -1
- package/dist/i18n/fr-CA.js +6 -1
- package/dist/i18n/fr-FR.js +6 -1
- package/dist/i18n/hi-IN.js +6 -1
- package/dist/i18n/it-IT.js +6 -1
- package/dist/i18n/ja-JP.js +6 -1
- package/dist/i18n/json/src/lib/components/filter-row/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/pagination/messages.json +1 -0
- package/dist/i18n/ko-KR.js +6 -1
- package/dist/i18n/nb-NO.js +6 -1
- package/dist/i18n/nl-NL.js +6 -1
- package/dist/i18n/pl-PL.js +6 -1
- package/dist/i18n/pt-BR.js +6 -1
- package/dist/i18n/ru-RU.js +6 -1
- package/dist/i18n/sv-SE.js +6 -1
- package/dist/i18n/tr-TR.js +6 -1
- package/dist/i18n/zh-CN.js +6 -1
- package/dist/i18n/zh-TW.js +6 -1
- package/dist/styles/pagination-controls.css +1 -0
- package/dist/types/lib/components/filter-row/form-filter-chip.d.ts +10 -0
- package/dist/types/lib/components/filter-row/messages.d.ts +5 -0
- package/dist/types/lib/components/filter-row/metadata-filter-chip.d.ts +8 -0
- package/dist/types/lib/components/filter-row/select-filter-chip.d.ts +11 -0
- package/dist/types/lib/components/filter-row/types.d.ts +1 -0
- package/dist/types/lib/components/pagination/index.d.ts +8 -0
- package/dist/types/lib/components/pagination/marker-based-pagination.d.ts +7 -0
- package/dist/types/lib/components/pagination/messages.d.ts +23 -0
- package/dist/types/lib/components/pagination/offset-based-pagination.d.ts +8 -0
- package/dist/types/lib/components/pagination/pagination-controls.d.ts +12 -0
- package/dist/types/lib/components/pagination/pagination.d.ts +8 -1
- package/dist/types/lib/components/pagination/utils.d.ts +8 -0
- package/dist/types/lib/metadata-view.d.ts +5 -3
- package/dist/types/lib/test-utils/mock-data.d.ts +55 -0
- package/package.json +3 -3
- package/dist/chunks/string-filter-chip.js +0 -69
- package/dist/types/lib/components/filter-row/string-filter-chip.d.ts +0 -2
- /package/dist/styles/{string-filter-chip.css → form-filter-chip.css} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useState as v } from "react";
|
|
2
|
+
import { useIntl as F } from "react-intl";
|
|
3
|
+
import { Popover as e, FilterChip as r, Button as l } from "@box/blueprint-web";
|
|
4
|
+
import { useFormikContext as g } from "formik";
|
|
5
|
+
import m from "../esm/lib/components/filter-row/messages.js";
|
|
6
|
+
import { jsx as o, jsxs as t } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/form-filter-chip.css';const y = "_popoverFooter_6tqyh_1", _ = "_filterChipGroup_6tqyh_9", b = {
|
|
8
|
+
popoverFooter: y,
|
|
9
|
+
filterChipGroup: _
|
|
10
|
+
}, j = ({
|
|
11
|
+
children: c,
|
|
12
|
+
formRef: h,
|
|
13
|
+
icon: i,
|
|
14
|
+
id: n,
|
|
15
|
+
name: u,
|
|
16
|
+
selected: d
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage: s
|
|
20
|
+
} = F(), [f, p] = v(!1), a = g(), C = () => {
|
|
21
|
+
a.handleSubmit(), p(!1);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ o("div", {
|
|
24
|
+
children: /* @__PURE__ */ t(e.Root, {
|
|
25
|
+
onOpenChange: p,
|
|
26
|
+
open: f,
|
|
27
|
+
children: [/* @__PURE__ */ o(e.Trigger, {
|
|
28
|
+
children: /* @__PURE__ */ t(r.TriggerChip, {
|
|
29
|
+
selected: d,
|
|
30
|
+
value: n,
|
|
31
|
+
children: [i && /* @__PURE__ */ o(r.Icon, {
|
|
32
|
+
icon: i
|
|
33
|
+
}), /* @__PURE__ */ o(r.Label, {
|
|
34
|
+
children: u
|
|
35
|
+
}), /* @__PURE__ */ o(r.DropdownIndicator, {})]
|
|
36
|
+
}, n)
|
|
37
|
+
}), /* @__PURE__ */ t(e.ContentContainer, {
|
|
38
|
+
align: "start",
|
|
39
|
+
container: h.current,
|
|
40
|
+
children: [/* @__PURE__ */ o(e.MainContent, {
|
|
41
|
+
children: c
|
|
42
|
+
}), /* @__PURE__ */ t(e.Footer, {
|
|
43
|
+
className: b.popoverFooter,
|
|
44
|
+
children: [/* @__PURE__ */ o(l, {
|
|
45
|
+
onClick: () => {
|
|
46
|
+
a.setFieldValue(`metadata.fields.${n}.value.enum`, []);
|
|
47
|
+
},
|
|
48
|
+
size: "small",
|
|
49
|
+
variant: "secondary",
|
|
50
|
+
children: s(m.clearButton)
|
|
51
|
+
}), /* @__PURE__ */ o(l, {
|
|
52
|
+
onClick: C,
|
|
53
|
+
size: "small",
|
|
54
|
+
type: "submit",
|
|
55
|
+
variant: "primary",
|
|
56
|
+
children: s(m.applyButton)
|
|
57
|
+
})]
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
j as F,
|
|
65
|
+
b as s
|
|
66
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmptyState as r, Text as a } from "@box/blueprint-web";
|
|
2
|
-
import { Unplugged as s } from "@box/blueprint-web-assets/illustrations/Medium
|
|
2
|
+
import { Unplugged as s } from "@box/blueprint-web-assets/illustrations/Medium";
|
|
3
3
|
import { useIntl as i } from "react-intl";
|
|
4
4
|
import o from "./messages.js";
|
|
5
5
|
import { jsx as t } from "react/jsx-runtime";
|
|
@@ -1,76 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Formik as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { getInitialFieldValues as
|
|
6
|
-
import {
|
|
7
|
-
import { usePredefinedFilter as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
case "string":
|
|
16
|
-
return /* @__PURE__ */ r(j, {
|
|
17
|
-
formRef: m,
|
|
18
|
-
icon: i,
|
|
19
|
-
id: e.id,
|
|
20
|
-
name: e.name,
|
|
21
|
-
selected: n
|
|
22
|
-
}, e.id);
|
|
23
|
-
case "date":
|
|
24
|
-
case "enum":
|
|
25
|
-
case "multiSelect":
|
|
26
|
-
return /* @__PURE__ */ p(a.Chip, {
|
|
27
|
-
value: e.id,
|
|
28
|
-
children: [i && /* @__PURE__ */ r(a.Icon, {
|
|
29
|
-
icon: i
|
|
30
|
-
}), /* @__PURE__ */ r(a.Label, {
|
|
31
|
-
children: e.name
|
|
32
|
-
})]
|
|
33
|
-
}, e.id);
|
|
34
|
-
default:
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}, _ = ({
|
|
38
|
-
disabledPredefinedFilters: e = [],
|
|
39
|
-
filterGroups: n,
|
|
40
|
-
isAllFiltersDisabled: m,
|
|
41
|
-
onFilterSubmit: i
|
|
1
|
+
import { useState as S, useRef as C } from "react";
|
|
2
|
+
import { Formik as v, Form as G } from "formik";
|
|
3
|
+
import { FilterChip as I } from "@box/blueprint-web";
|
|
4
|
+
import R from "./all-filters-chip.js";
|
|
5
|
+
import { getInitialFieldValues as b } from "./initial-field-values.js";
|
|
6
|
+
import { MetadataFilterChip as g } from "./metadata-filter-chip.js";
|
|
7
|
+
import { usePredefinedFilter as j } from "./use-predefined-filter.js";
|
|
8
|
+
import { s as w } from "../../../../chunks/form-filter-chip.js";
|
|
9
|
+
import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
10
|
+
const z = ({
|
|
11
|
+
disabledPredefinedFilters: n = [],
|
|
12
|
+
filterGroups: a,
|
|
13
|
+
isAllFiltersDisabled: d,
|
|
14
|
+
onFilterSubmit: p
|
|
42
15
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
var
|
|
45
|
-
return ((
|
|
46
|
-
},
|
|
16
|
+
const [l, u] = S([]), c = j(n), f = ([e, t]) => {
|
|
17
|
+
var r;
|
|
18
|
+
return ((r = t.value) == null ? void 0 : r.enum) && t.value.enum.length > 0;
|
|
19
|
+
}, F = ({
|
|
47
20
|
metadata: {
|
|
48
|
-
fields:
|
|
21
|
+
fields: e
|
|
49
22
|
}
|
|
50
23
|
}) => {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
filters:
|
|
55
|
-
}) =>
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
initialValues:
|
|
58
|
-
onSubmit:
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
ref:
|
|
61
|
-
children: /* @__PURE__ */
|
|
62
|
-
className:
|
|
24
|
+
const t = Object.entries(e).filter(f).map(([r]) => r);
|
|
25
|
+
u(t), p(e);
|
|
26
|
+
}, s = [...c, ...a], o = s.flatMap(({
|
|
27
|
+
filters: e
|
|
28
|
+
}) => e), h = b(o), m = C(null);
|
|
29
|
+
return /* @__PURE__ */ i(v, {
|
|
30
|
+
initialValues: h,
|
|
31
|
+
onSubmit: F,
|
|
32
|
+
children: /* @__PURE__ */ i(G, {
|
|
33
|
+
ref: m,
|
|
34
|
+
children: /* @__PURE__ */ x(I.Group, {
|
|
35
|
+
className: w.filterChipGroup,
|
|
63
36
|
name: "metadata-view-filters",
|
|
64
37
|
type: "multiple",
|
|
65
|
-
children: [
|
|
66
|
-
activeFilterCount:
|
|
67
|
-
filterGroups:
|
|
68
|
-
}),
|
|
38
|
+
children: [d ? null : /* @__PURE__ */ i(R, {
|
|
39
|
+
activeFilterCount: l.length,
|
|
40
|
+
filterGroups: s
|
|
41
|
+
}), o.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(g, {
|
|
42
|
+
filterOption: e,
|
|
43
|
+
formRef: m,
|
|
44
|
+
selected: l.includes(e.id)
|
|
45
|
+
}, e.id))]
|
|
69
46
|
})
|
|
70
47
|
})
|
|
71
48
|
});
|
|
72
49
|
};
|
|
73
50
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
z as FilterRow,
|
|
52
|
+
z as default
|
|
76
53
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "@box/blueprint-web";
|
|
2
|
-
import "@box/metadata-filter";
|
|
3
1
|
import "react";
|
|
4
2
|
import "react-intl";
|
|
3
|
+
import "@box/blueprint-web";
|
|
5
4
|
import "formik";
|
|
6
|
-
import {
|
|
5
|
+
import { F as e, F as f } from "../../../../chunks/form-filter-chip.js";
|
|
7
6
|
import "./messages.js";
|
|
8
7
|
import "react/jsx-runtime";
|
|
9
8
|
export {
|
|
10
|
-
|
|
9
|
+
e as FormFilterChip,
|
|
10
|
+
f as default
|
|
11
11
|
};
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
const
|
|
1
|
+
const s = (t) => ({
|
|
2
2
|
metadata: {
|
|
3
|
-
fields:
|
|
4
|
-
let
|
|
5
|
-
switch (
|
|
6
|
-
case "
|
|
3
|
+
fields: t.reduce((l, e) => {
|
|
4
|
+
let a;
|
|
5
|
+
switch (e.fieldType) {
|
|
6
|
+
case "date":
|
|
7
7
|
case "float":
|
|
8
|
-
|
|
8
|
+
case "string":
|
|
9
|
+
a = [""];
|
|
10
|
+
break;
|
|
11
|
+
case "enum":
|
|
12
|
+
case "multiSelect":
|
|
13
|
+
e.options && (a = [...e.options]);
|
|
9
14
|
break;
|
|
10
15
|
default:
|
|
11
|
-
|
|
16
|
+
a = null;
|
|
12
17
|
}
|
|
13
|
-
return
|
|
14
|
-
value:
|
|
15
|
-
},
|
|
18
|
+
return l[e.id] = {
|
|
19
|
+
value: a
|
|
20
|
+
}, l;
|
|
16
21
|
}, {})
|
|
17
22
|
}
|
|
18
23
|
});
|
|
19
24
|
export {
|
|
20
|
-
|
|
25
|
+
s as getInitialFieldValues
|
|
21
26
|
};
|
|
@@ -19,6 +19,10 @@ const t = e({
|
|
|
19
19
|
keywordSearchFilterPlaceholder: {
|
|
20
20
|
id: "groupSharedFeatures.metadataView.filterRow.keywordSearchFilterPlaceholder",
|
|
21
21
|
defaultMessage: "Enter keywords"
|
|
22
|
+
},
|
|
23
|
+
chipNameWithCount: {
|
|
24
|
+
id: "groupSharedFeatures.metadataView.filterRow.chipNameWithCount",
|
|
25
|
+
defaultMessage: "{name} ({count})"
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
28
|
export {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { MetadataStringField as m } from "@box/metadata-filter";
|
|
2
|
+
import { F as d } from "../../../../chunks/form-filter-chip.js";
|
|
3
|
+
import { SelectFilterChip as p } from "./select-filter-chip.js";
|
|
4
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
5
|
+
const x = ({
|
|
6
|
+
filterOption: s,
|
|
7
|
+
formRef: i,
|
|
8
|
+
selected: n
|
|
9
|
+
}) => {
|
|
10
|
+
const {
|
|
11
|
+
fieldType: r,
|
|
12
|
+
icon: l,
|
|
13
|
+
id: e,
|
|
14
|
+
name: t,
|
|
15
|
+
options: c
|
|
16
|
+
} = s, o = `metadata.fields.${e}`;
|
|
17
|
+
switch (r) {
|
|
18
|
+
case "float":
|
|
19
|
+
case "string":
|
|
20
|
+
return /* @__PURE__ */ a(d, {
|
|
21
|
+
formRef: i,
|
|
22
|
+
icon: l,
|
|
23
|
+
id: e,
|
|
24
|
+
name: t,
|
|
25
|
+
selected: n,
|
|
26
|
+
children: /* @__PURE__ */ a(m, {
|
|
27
|
+
fieldNamePrefix: o,
|
|
28
|
+
label: t
|
|
29
|
+
})
|
|
30
|
+
}, e);
|
|
31
|
+
case "date":
|
|
32
|
+
case "enum":
|
|
33
|
+
case "multiSelect":
|
|
34
|
+
return /* @__PURE__ */ a(p, {
|
|
35
|
+
fieldNamePrefix: o,
|
|
36
|
+
formRef: i,
|
|
37
|
+
icon: l,
|
|
38
|
+
id: e,
|
|
39
|
+
name: t,
|
|
40
|
+
options: c,
|
|
41
|
+
type: r
|
|
42
|
+
});
|
|
43
|
+
default:
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
x as MetadataFilterChip,
|
|
49
|
+
x as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useState as a } from "react";
|
|
2
|
+
import { useFormikContext as O } from "formik";
|
|
3
|
+
import { DropdownMenu as c, FilterChip as o } from "@box/blueprint-web";
|
|
4
|
+
import { useIntl as S } from "react-intl";
|
|
5
|
+
import V from "./messages.js";
|
|
6
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
7
|
+
const T = ({
|
|
8
|
+
fieldNamePrefix: d,
|
|
9
|
+
formRef: C,
|
|
10
|
+
icon: h,
|
|
11
|
+
id: m,
|
|
12
|
+
name: s,
|
|
13
|
+
options: i,
|
|
14
|
+
type: f
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
formatMessage: g
|
|
18
|
+
} = S(), [b, k] = a(!1), [w, p] = a(s), [l, x] = a(/* @__PURE__ */ new Set()), {
|
|
19
|
+
setFieldValue: F,
|
|
20
|
+
submitForm: v
|
|
21
|
+
} = O(), I = async (r, n) => {
|
|
22
|
+
const e = new Set(l);
|
|
23
|
+
f === "enum" ? e.clear() : e.delete(n), r && e.add(n), x(e), e.size > 0 ? p(g(V.chipNameWithCount, {
|
|
24
|
+
name: s,
|
|
25
|
+
count: e.size
|
|
26
|
+
})) : p(s), F(`${d}.value.enum`, Array.from(e)), v();
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ u(c.Root, {
|
|
29
|
+
onOpenChange: k,
|
|
30
|
+
open: b,
|
|
31
|
+
children: [/* @__PURE__ */ t(c.Trigger, {
|
|
32
|
+
asChild: !0,
|
|
33
|
+
children: /* @__PURE__ */ u(o.TriggerChip, {
|
|
34
|
+
selected: l.size > 0,
|
|
35
|
+
value: m,
|
|
36
|
+
children: [h && /* @__PURE__ */ t(o.Icon, {
|
|
37
|
+
icon: h
|
|
38
|
+
}), /* @__PURE__ */ t(o.Label, {
|
|
39
|
+
children: w
|
|
40
|
+
}), /* @__PURE__ */ t(o.DropdownIndicator, {})]
|
|
41
|
+
}, m)
|
|
42
|
+
}), /* @__PURE__ */ t(c.Content, {
|
|
43
|
+
container: C.current,
|
|
44
|
+
children: i == null ? void 0 : i.map((r) => /* @__PURE__ */ t(c.CheckboxItem, {
|
|
45
|
+
checked: l.has(r),
|
|
46
|
+
onCheckedChange: (n) => I(n, r),
|
|
47
|
+
children: r
|
|
48
|
+
}, r))
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
T as SelectFilterChip
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as t } from "./pagination.js";
|
|
2
|
+
import { default as e } from "./pagination-controls.js";
|
|
3
|
+
import { OffsetBasedPagination as f } from "./offset-based-pagination.js";
|
|
4
|
+
import { MarkerBasedPagination as s } from "./marker-based-pagination.js";
|
|
5
|
+
export {
|
|
6
|
+
s as MarkerBasedPagination,
|
|
7
|
+
f as OffsetBasedPagination,
|
|
8
|
+
t as Pagination,
|
|
9
|
+
e as PaginationControls
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import i from "./pagination-controls.js";
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
const c = ({
|
|
4
|
+
hasNextMarker: t,
|
|
5
|
+
hasPrevMarker: e,
|
|
6
|
+
onMarkerBasedPageChange: o
|
|
7
|
+
}) => /* @__PURE__ */ a(i, {
|
|
8
|
+
handleNextClick: () => {
|
|
9
|
+
o(1);
|
|
10
|
+
},
|
|
11
|
+
handlePreviousClick: () => {
|
|
12
|
+
o(-1);
|
|
13
|
+
},
|
|
14
|
+
hasNextPage: t,
|
|
15
|
+
hasPreviousPage: e
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
c as MarkerBasedPagination,
|
|
19
|
+
c as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineMessages as a } from "react-intl";
|
|
2
|
+
const t = a({
|
|
3
|
+
nextPageButton: {
|
|
4
|
+
id: "groupSharedFeatures.metadataView.pagination.nextPageButton",
|
|
5
|
+
defaultMessage: "Next"
|
|
6
|
+
},
|
|
7
|
+
pageEntryStatus: {
|
|
8
|
+
id: "groupSharedFeatures.metadataView.pagination.pageEntryStatus",
|
|
9
|
+
defaultMessage: "Showing {startEntryIndex} to {endEntryIndex} of {totalCount} entries"
|
|
10
|
+
},
|
|
11
|
+
paginationAriaLabel: {
|
|
12
|
+
id: "groupSharedFeatures.metadataView.pagination.paginationLabel",
|
|
13
|
+
defaultMessage: "Pagination navigation controls and current page information"
|
|
14
|
+
},
|
|
15
|
+
previousPageButton: {
|
|
16
|
+
id: "groupSharedFeatures.metadataView.pagination.previousPageButton",
|
|
17
|
+
defaultMessage: "Previous"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
t as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import h from "./pagination-controls.js";
|
|
2
|
+
import { getOffsetForPage as c } from "./utils.js";
|
|
3
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
4
|
+
const x = ({
|
|
5
|
+
offset: n,
|
|
6
|
+
onOffsetChange: o,
|
|
7
|
+
pageSize: t,
|
|
8
|
+
totalCount: r
|
|
9
|
+
}) => {
|
|
10
|
+
const e = Math.ceil(r / t);
|
|
11
|
+
if (e <= 1)
|
|
12
|
+
return null;
|
|
13
|
+
const a = Math.floor(n / t) + 1, s = a > 0 ? Math.min(e, a) : 1, i = s < e, l = s > 1;
|
|
14
|
+
return /* @__PURE__ */ P(h, {
|
|
15
|
+
handleNextClick: () => {
|
|
16
|
+
o(c(s + 1, t, r));
|
|
17
|
+
},
|
|
18
|
+
handlePreviousClick: () => {
|
|
19
|
+
o(c(s - 1, t, r));
|
|
20
|
+
},
|
|
21
|
+
hasNextPage: i,
|
|
22
|
+
hasPageEntryStatus: !0,
|
|
23
|
+
hasPreviousPage: l,
|
|
24
|
+
offset: n,
|
|
25
|
+
pageSize: t,
|
|
26
|
+
totalCount: r
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
x as OffsetBasedPagination,
|
|
31
|
+
x as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Button as r } from "@box/blueprint-web";
|
|
2
|
+
import { useIntl as x, FormattedMessage as B } from "react-intl";
|
|
3
|
+
import n from "./messages.js";
|
|
4
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
5
|
+
import '../../../../styles/pagination-controls.css';const h = "_pagination_1ozaq_1", y = "_paginationButtonContainer_1ozaq_9", i = {
|
|
6
|
+
pagination: h,
|
|
7
|
+
paginationButtonContainer: y
|
|
8
|
+
}, E = ({
|
|
9
|
+
handleNextClick: l,
|
|
10
|
+
handlePreviousClick: c,
|
|
11
|
+
hasNextPage: d,
|
|
12
|
+
hasPageEntryStatus: p,
|
|
13
|
+
hasPreviousPage: g,
|
|
14
|
+
offset: o = 0,
|
|
15
|
+
pageSize: m = 0,
|
|
16
|
+
totalCount: e = 0
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage: t
|
|
20
|
+
} = x(), u = o + 1, v = Math.min(o + m, e);
|
|
21
|
+
return /* @__PURE__ */ s("div", {
|
|
22
|
+
"aria-label": t(n.paginationAriaLabel),
|
|
23
|
+
"aria-live": "polite",
|
|
24
|
+
className: i.pagination,
|
|
25
|
+
children: [p && /* @__PURE__ */ a("div", {
|
|
26
|
+
className: i.paginationText,
|
|
27
|
+
children: /* @__PURE__ */ a(B, {
|
|
28
|
+
...n.pageEntryStatus,
|
|
29
|
+
values: {
|
|
30
|
+
startEntryIndex: u,
|
|
31
|
+
endEntryIndex: v,
|
|
32
|
+
totalCount: e
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
}), /* @__PURE__ */ s("div", {
|
|
36
|
+
className: i.paginationButtonContainer,
|
|
37
|
+
children: [/* @__PURE__ */ a(r, {
|
|
38
|
+
disabled: !g,
|
|
39
|
+
onClick: c,
|
|
40
|
+
variant: "secondary",
|
|
41
|
+
children: t(n.previousPageButton)
|
|
42
|
+
}), /* @__PURE__ */ a(r, {
|
|
43
|
+
disabled: !d,
|
|
44
|
+
onClick: l,
|
|
45
|
+
variant: "secondary",
|
|
46
|
+
children: t(n.nextPageButton)
|
|
47
|
+
})]
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
E as default
|
|
53
|
+
};
|
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { MarkerBasedPagination as g } from "./marker-based-pagination.js";
|
|
2
|
+
import { OffsetBasedPagination as p } from "./offset-based-pagination.js";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
import "./pagination-controls.js";
|
|
5
|
+
const u = ({
|
|
6
|
+
type: e,
|
|
7
|
+
...a
|
|
8
|
+
}) => {
|
|
9
|
+
if (e === "marker") {
|
|
10
|
+
const {
|
|
11
|
+
hasNextMarker: s,
|
|
12
|
+
hasPrevMarker: f,
|
|
13
|
+
onMarkerBasedPageChange: m
|
|
14
|
+
} = a;
|
|
15
|
+
return /* @__PURE__ */ r(g, {
|
|
16
|
+
hasNextMarker: s,
|
|
17
|
+
hasPrevMarker: f,
|
|
18
|
+
onMarkerBasedPageChange: m
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const {
|
|
22
|
+
offset: t,
|
|
23
|
+
onOffsetChange: o,
|
|
24
|
+
pageSize: n,
|
|
25
|
+
totalCount: i
|
|
26
|
+
} = a;
|
|
27
|
+
return /* @__PURE__ */ r(p, {
|
|
28
|
+
offset: t,
|
|
29
|
+
onOffsetChange: o,
|
|
30
|
+
pageSize: n,
|
|
31
|
+
totalCount: i
|
|
32
|
+
});
|
|
33
|
+
};
|
|
5
34
|
export {
|
|
6
|
-
|
|
35
|
+
u as default
|
|
7
36
|
};
|
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as V } from "react";
|
|
2
2
|
import u from "./components/error-state/error-state.js";
|
|
3
|
-
import
|
|
4
|
-
import { MetadataGrid as
|
|
5
|
-
import { SwitchCase as
|
|
6
|
-
import { V as
|
|
7
|
-
import { jsxs as
|
|
8
|
-
import { ActionBar as
|
|
9
|
-
import
|
|
3
|
+
import I from "./components/pagination/pagination.js";
|
|
4
|
+
import { MetadataGrid as T } from "./components/metadata-grid/metadata-grid.js";
|
|
5
|
+
import { SwitchCase as y, Case as i } from "./components/switch-case/switch-case.js";
|
|
6
|
+
import { V as e } from "../../chunks/types.js";
|
|
7
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
8
|
+
import { ActionBar as L } from "./components/action-bar/action-bar.js";
|
|
9
|
+
import x from "./components/empty-state/empty-state.js";
|
|
10
10
|
import g from "./components/metadata-table/metadata-table.js";
|
|
11
|
-
import '../../styles/metadata-view.css';const
|
|
12
|
-
contentContainer:
|
|
11
|
+
import '../../styles/metadata-view.css';const v = "_contentContainer_19ns1_8", p = {
|
|
12
|
+
contentContainer: v
|
|
13
13
|
};
|
|
14
|
-
function
|
|
14
|
+
function q({
|
|
15
15
|
actionBarProps: a,
|
|
16
|
-
columns:
|
|
17
|
-
tableProps:
|
|
18
|
-
hasError:
|
|
19
|
-
onRefresh:
|
|
20
|
-
initialViewMode:
|
|
16
|
+
columns: m,
|
|
17
|
+
tableProps: d,
|
|
18
|
+
hasError: f,
|
|
19
|
+
onRefresh: h,
|
|
20
|
+
initialViewMode: C = e.LIST,
|
|
21
|
+
paginationProps: c,
|
|
21
22
|
...r
|
|
22
23
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
className:
|
|
28
|
-
children: [/* @__PURE__ */ t(
|
|
24
|
+
const [o, s] = V(C), M = () => {
|
|
25
|
+
o === e.LIST ? s(e.GRID) : s(e.LIST);
|
|
26
|
+
}, S = !d.isLoading && r.items.length === 0, w = a.sortDropdownProps && m.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue);
|
|
27
|
+
return /* @__PURE__ */ l("div", {
|
|
28
|
+
className: p.container,
|
|
29
|
+
children: [/* @__PURE__ */ t(L, {
|
|
29
30
|
...a,
|
|
30
|
-
onViewModeClick:
|
|
31
|
-
sortableColumnNames:
|
|
32
|
-
viewMode:
|
|
31
|
+
onViewModeClick: M,
|
|
32
|
+
sortableColumnNames: w,
|
|
33
|
+
viewMode: o
|
|
33
34
|
}), /* @__PURE__ */ t("div", {
|
|
34
|
-
className:
|
|
35
|
-
children: /* @__PURE__ */
|
|
35
|
+
className: p.contentContainer,
|
|
36
|
+
children: /* @__PURE__ */ l(y, {
|
|
36
37
|
children: [/* @__PURE__ */ t(i, {
|
|
37
|
-
condition:
|
|
38
|
+
condition: f,
|
|
38
39
|
children: /* @__PURE__ */ t(u, {
|
|
39
|
-
onRefresh:
|
|
40
|
+
onRefresh: h
|
|
40
41
|
})
|
|
41
42
|
}), /* @__PURE__ */ t(i, {
|
|
42
|
-
condition:
|
|
43
|
-
children: /* @__PURE__ */ t(
|
|
43
|
+
condition: S,
|
|
44
|
+
children: /* @__PURE__ */ t(x, {})
|
|
44
45
|
}), /* @__PURE__ */ t(i, {
|
|
45
|
-
condition:
|
|
46
|
+
condition: o === e.LIST,
|
|
46
47
|
children: /* @__PURE__ */ t(g, {
|
|
48
|
+
columns: m,
|
|
47
49
|
...r,
|
|
48
|
-
...
|
|
50
|
+
...d
|
|
49
51
|
})
|
|
50
52
|
}), /* @__PURE__ */ t(i, {
|
|
51
|
-
condition:
|
|
52
|
-
children: /* @__PURE__ */ t(
|
|
53
|
+
condition: o === e.GRID,
|
|
54
|
+
children: /* @__PURE__ */ t(T, {
|
|
53
55
|
...r
|
|
54
56
|
})
|
|
55
57
|
})]
|
|
56
58
|
})
|
|
57
|
-
}), /* @__PURE__ */ t(
|
|
59
|
+
}), c && /* @__PURE__ */ t(I, {
|
|
60
|
+
...c
|
|
61
|
+
})]
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
64
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
q as MetadataView,
|
|
66
|
+
q as default
|
|
63
67
|
};
|