@box/metadata-view 2.2.38 → 2.2.39
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/action-bar.js +1 -52
- package/dist/chunks/empty-state.js +1 -24
- package/dist/chunks/error-state.js +1 -23
- package/dist/chunks/filter-row.module.js +1 -7
- package/dist/chunks/filter-side-panel.js +1 -65
- package/dist/chunks/header.js +1 -62
- package/dist/chunks/inline-editing-cell.js +1 -34
- package/dist/chunks/item-action-menu.js +1 -86
- package/dist/chunks/metadata-grid.js +1 -44
- package/dist/chunks/metadata-location-field.js +1 -35
- package/dist/chunks/metadata-view.js +1 -104
- package/dist/chunks/pagination-controls.js +1 -40
- package/dist/chunks/table-row.js +1 -71
- package/dist/chunks/types.js +1 -6
- package/dist/chunks/types2.js +1 -4
- package/dist/chunks/zoom-button.js +1 -20
- package/dist/esm/index.js +1 -29
- package/dist/esm/lib/components/action-bar/action-bar.js +1 -2
- package/dist/esm/lib/components/action-bar/index.js +1 -2
- package/dist/esm/lib/components/action-bar/messages.js +1 -24
- package/dist/esm/lib/components/action-bar/zoom-button.js +1 -2
- package/dist/esm/lib/components/constants.js +1 -14
- package/dist/esm/lib/components/empty-state/empty-state.js +1 -2
- package/dist/esm/lib/components/empty-state/index.js +1 -2
- package/dist/esm/lib/components/empty-state/messages.js +1 -12
- package/dist/esm/lib/components/error-state/error-state.js +1 -2
- package/dist/esm/lib/components/error-state/index.js +1 -2
- package/dist/esm/lib/components/error-state/messages.js +1 -12
- package/dist/esm/lib/components/filter-row/advanced-field-content.js +1 -39
- package/dist/esm/lib/components/filter-row/advanced-filter-context.js +1 -3
- package/dist/esm/lib/components/filter-row/all-filters-chip.js +1 -34
- package/dist/esm/lib/components/filter-row/custom-trigger-chip.js +1 -40
- package/dist/esm/lib/components/filter-row/filter-chip-popover-context.js +1 -3
- package/dist/esm/lib/components/filter-row/filter-row.js +1 -46
- package/dist/esm/lib/components/filter-row/form-filter-chip.js +1 -99
- package/dist/esm/lib/components/filter-row/format-advanced-filter-label.js +1 -163
- package/dist/esm/lib/components/filter-row/index.js +1 -6
- package/dist/esm/lib/components/filter-row/initial-field-values.js +1 -51
- package/dist/esm/lib/components/filter-row/is-blank-or-not-blank-filter.js +1 -3
- package/dist/esm/lib/components/filter-row/is-filter-selected.js +1 -40
- package/dist/esm/lib/components/filter-row/messages.js +1 -112
- package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +1 -87
- package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +1 -2
- package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +1 -15
- package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +1 -63
- package/dist/esm/lib/components/filter-row/select-filter-chip.js +1 -42
- package/dist/esm/lib/components/filter-row/use-form-filter-chip.js +1 -40
- package/dist/esm/lib/components/filter-row/use-nested-overlay-popover-open-change.js +1 -30
- package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +1 -2
- package/dist/esm/lib/components/filter-sidepanel/filter.js +1 -96
- package/dist/esm/lib/components/filter-sidepanel/index.js +1 -3
- package/dist/esm/lib/components/filter-sidepanel/messages.js +1 -20
- package/dist/esm/lib/components/header/header.js +1 -2
- package/dist/esm/lib/components/header/index.js +1 -2
- package/dist/esm/lib/components/header/messages.js +1 -16
- package/dist/esm/lib/components/index.js +1 -26
- package/dist/esm/lib/components/item-action-menu/identifier.js +1 -5
- package/dist/esm/lib/components/item-action-menu/index.js +1 -2
- package/dist/esm/lib/components/item-action-menu/item-action-menu.js +1 -2
- package/dist/esm/lib/components/item-action-menu/messages.js +1 -6
- package/dist/esm/lib/components/metadata-grid/index.js +1 -2
- package/dist/esm/lib/components/metadata-grid/messages.js +1 -6
- package/dist/esm/lib/components/metadata-grid/metadata-grid.js +1 -2
- package/dist/esm/lib/components/metadata-table/actionColumn.js +1 -4
- package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +1 -52
- package/dist/esm/lib/components/metadata-table/index.js +1 -4
- package/dist/esm/lib/components/metadata-table/messages.js +1 -16
- package/dist/esm/lib/components/metadata-table/metadata-table.js +1 -94
- package/dist/esm/lib/components/metadata-table/table-body/action-cell-content.js +1 -13
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +1 -11
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/ghost-table-row.js +1 -9
- package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/index.js +1 -2
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +1 -2
- package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +1 -2
- package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +1 -133
- package/dist/esm/lib/components/metadata-table/table-body/table-row/index.js +1 -2
- package/dist/esm/lib/components/metadata-table/table-body/table-row/table-row.js +1 -2
- package/dist/esm/lib/components/metadata-table/table-renderer.js +1 -37
- package/dist/esm/lib/components/metadata-value/index.js +1 -6
- package/dist/esm/lib/components/metadata-value/messages.js +1 -16
- package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +1 -25
- package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +1 -15
- package/dist/esm/lib/components/metadata-value/metadata-file-field.js +1 -13
- package/dist/esm/lib/components/metadata-value/metadata-location-field.js +1 -2
- package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +1 -27
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +1 -20
- package/dist/esm/lib/components/pagination/index.js +1 -5
- package/dist/esm/lib/components/pagination/marker-based-pagination.js +1 -13
- package/dist/esm/lib/components/pagination/messages.js +1 -20
- package/dist/esm/lib/components/pagination/offset-based-pagination.js +1 -23
- package/dist/esm/lib/components/pagination/pagination-controls.js +1 -2
- package/dist/esm/lib/components/pagination/pagination.js +1 -21
- package/dist/esm/lib/components/pagination/utils.js +1 -5
- package/dist/esm/lib/components/sort-dropdown/index.js +1 -2
- package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +1 -39
- package/dist/esm/lib/components/switch-case/index.js +1 -2
- package/dist/esm/lib/components/switch-case/switch-case.js +1 -6
- package/dist/esm/lib/hooks/use-header.js +1 -45
- package/dist/esm/lib/index.js +1 -28
- package/dist/esm/lib/metadata-view.js +1 -2
- package/package.json +17 -17
package/dist/chunks/table-row.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { THUMBNAIL_LIST_VIEW_HEIGHTS as t } from "../esm/lib/components/constants.js";
|
|
3
|
-
import { ActionCellContent as n } from "../esm/lib/components/metadata-table/table-body/action-cell-content.js";
|
|
4
|
-
import { Cell as r, Row as i, Text as a } from "@box/blueprint-web";
|
|
5
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
-
import { ItemTypeIcon as c } from "@box/item-icon";
|
|
7
|
-
import l from "clsx";
|
|
8
|
-
import u from "lodash/get";
|
|
9
|
-
import '../styles/table-row.css';var d = {
|
|
10
|
-
tableHeaderActionsWrapper: "_tableHeaderActionsWrapper_1sntd_1",
|
|
11
|
-
tableHeaderActions: "_tableHeaderActions_1sntd_1",
|
|
12
|
-
tableRow: "_tableRow_1sntd_33",
|
|
13
|
-
isClickable: "_isClickable_1sntd_41",
|
|
14
|
-
selectAllCheckbox: "_selectAllCheckbox_1sntd_45",
|
|
15
|
-
tableNameCell: "_tableNameCell_1sntd_50",
|
|
16
|
-
tableNameCellTitle: "_tableNameCellTitle_1sntd_56",
|
|
17
|
-
hasSubtitle: "_hasSubtitle_1sntd_60",
|
|
18
|
-
tableNameCellText: "_tableNameCellText_1sntd_65",
|
|
19
|
-
tableNameCellIconInline: "_tableNameCellIconInline_1sntd_70",
|
|
20
|
-
iconCell: "_iconCell_1sntd_74"
|
|
21
|
-
}, f = ({ areSelectionCheckboxesDisabled: f, columns: p, dataTargetPrefix: m, iconColumnVariant: h, item: g, itemActionMenuProps: _, onTableRowClick: v, renderActionCell: y, shouldRenderActionColumn: b, zoomLevel: x = 0 }) => /* @__PURE__ */ s(i, {
|
|
22
|
-
className: l(d.tableRow, { [d.isClickable]: v }),
|
|
23
|
-
"data-target-id": m ? `${m}-itemRow-${g.id}` : void 0,
|
|
24
|
-
id: g.id,
|
|
25
|
-
onAction: () => v?.(g),
|
|
26
|
-
children: [
|
|
27
|
-
h === e.COLUMN ? /* @__PURE__ */ o(r, {
|
|
28
|
-
style: { height: t[x] },
|
|
29
|
-
children: /* @__PURE__ */ o(c, {
|
|
30
|
-
className: d.iconCell,
|
|
31
|
-
item: g
|
|
32
|
-
})
|
|
33
|
-
}, `item-type-icon-${g.id}`) : null,
|
|
34
|
-
p.map((t) => {
|
|
35
|
-
let { cellRenderer: n, id: i, isItemMetadata: f, subtitle: p, textValue: m, type: _ } = t, v = `${m}-${g.id}`;
|
|
36
|
-
if (n) return /* @__PURE__ */ o(r, { children: n(g, t) }, v);
|
|
37
|
-
let y = u(g, f ? i.split(".")[1] : i);
|
|
38
|
-
if (i === "name" && (h === e.INLINE || h === e.INLINE_SUBTITLE)) return /* @__PURE__ */ o(r, { children: /* @__PURE__ */ s("div", {
|
|
39
|
-
className: d.tableNameCell,
|
|
40
|
-
children: [/* @__PURE__ */ o(c, { item: g }), /* @__PURE__ */ s("div", {
|
|
41
|
-
className: l(d.tableNameCellTitle, { [d.hasSubtitle]: h === e.INLINE_SUBTITLE }),
|
|
42
|
-
children: [/* @__PURE__ */ o(a, {
|
|
43
|
-
as: "span",
|
|
44
|
-
className: d.tableNameCellText,
|
|
45
|
-
children: y
|
|
46
|
-
}), h === e.INLINE_SUBTITLE ? /* @__PURE__ */ o(a, {
|
|
47
|
-
as: "span",
|
|
48
|
-
className: d.tableNameCellText,
|
|
49
|
-
color: "textOnLightSecondary",
|
|
50
|
-
children: p
|
|
51
|
-
}) : null]
|
|
52
|
-
})]
|
|
53
|
-
}) }, v);
|
|
54
|
-
if (_ === "multiSelect") {
|
|
55
|
-
let e = u(g, i);
|
|
56
|
-
return /* @__PURE__ */ o(r, { children: e ? e.join(" ") : "" }, v);
|
|
57
|
-
}
|
|
58
|
-
return /* @__PURE__ */ o(r, { children: /* @__PURE__ */ o(a, {
|
|
59
|
-
as: "span",
|
|
60
|
-
children: y
|
|
61
|
-
}) }, v);
|
|
62
|
-
}),
|
|
63
|
-
b && /* @__PURE__ */ o(n, {
|
|
64
|
-
isCheckboxDisabled: f,
|
|
65
|
-
item: g,
|
|
66
|
-
itemActionMenuProps: _,
|
|
67
|
-
renderActionCell: y
|
|
68
|
-
})
|
|
69
|
-
]
|
|
70
|
-
}, g.id);
|
|
71
|
-
export { d as n, f as t };
|
|
1
|
+
import{t as IconColumnVariant}from"./types.js";import{THUMBNAIL_LIST_VIEW_HEIGHTS}from"../esm/lib/components/constants.js";import{ActionCellContent}from"../esm/lib/components/metadata-table/table-body/action-cell-content.js";import{Cell,Row,Text}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{ItemTypeIcon}from"@box/item-icon";import clsx from"clsx";import get from"lodash/get";import '../styles/table-row.css';var metadata_table_module_default={tableHeaderActionsWrapper:`_tableHeaderActionsWrapper_1sntd_1`,tableHeaderActions:`_tableHeaderActions_1sntd_1`,tableRow:`_tableRow_1sntd_33`,isClickable:`_isClickable_1sntd_41`,selectAllCheckbox:`_selectAllCheckbox_1sntd_45`,tableNameCell:`_tableNameCell_1sntd_50`,tableNameCellTitle:`_tableNameCellTitle_1sntd_56`,hasSubtitle:`_hasSubtitle_1sntd_60`,tableNameCellText:`_tableNameCellText_1sntd_65`,tableNameCellIconInline:`_tableNameCellIconInline_1sntd_70`,iconCell:`_iconCell_1sntd_74`},TableRow=({areSelectionCheckboxesDisabled,columns,dataTargetPrefix,iconColumnVariant,item,itemActionMenuProps,onTableRowClick,renderActionCell,shouldRenderActionColumn,zoomLevel=0})=>jsxs(Row,{className:clsx(metadata_table_module_default.tableRow,{[metadata_table_module_default.isClickable]:onTableRowClick}),"data-target-id":dataTargetPrefix?`${dataTargetPrefix}-itemRow-${item.id}`:void 0,id:item.id,onAction:()=>onTableRowClick?.(item),children:[iconColumnVariant===IconColumnVariant.COLUMN?jsx(Cell,{style:{height:THUMBNAIL_LIST_VIEW_HEIGHTS[zoomLevel]},children:jsx(ItemTypeIcon,{className:metadata_table_module_default.iconCell,item})},`item-type-icon-${item.id}`):null,columns.map(column=>{let{cellRenderer,id:columnId,isItemMetadata,subtitle,textValue:columnName,type}=column,key=`${columnName}-${item.id}`;if(cellRenderer)return jsx(Cell,{children:cellRenderer(item,column)},key);let data=get(item,isItemMetadata?columnId.split(`.`)[1]:columnId);if(columnId===`name`&&(iconColumnVariant===IconColumnVariant.INLINE||iconColumnVariant===IconColumnVariant.INLINE_SUBTITLE))return jsx(Cell,{children:jsxs(`div`,{className:metadata_table_module_default.tableNameCell,children:[jsx(ItemTypeIcon,{item}),jsxs(`div`,{className:clsx(metadata_table_module_default.tableNameCellTitle,{[metadata_table_module_default.hasSubtitle]:iconColumnVariant===IconColumnVariant.INLINE_SUBTITLE}),children:[jsx(Text,{as:`span`,className:metadata_table_module_default.tableNameCellText,children:data}),iconColumnVariant===IconColumnVariant.INLINE_SUBTITLE?jsx(Text,{as:`span`,className:metadata_table_module_default.tableNameCellText,color:`textOnLightSecondary`,children:subtitle}):null]})]})},key);if(type===`multiSelect`){let options=get(item,columnId);return jsx(Cell,{children:options?options.join(` `):``},key)}return jsx(Cell,{children:jsx(Text,{as:`span`,children:data})},key)}),shouldRenderActionColumn&&jsx(ActionCellContent,{isCheckboxDisabled:areSelectionCheckboxesDisabled,item,itemActionMenuProps,renderActionCell})]},item.id);export{metadata_table_module_default as n,TableRow as t};
|
package/dist/chunks/types.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
return e.INLINE = "inline", e.COLUMN = "column", e.INLINE_SUBTITLE = "inline-subtitle", e;
|
|
3
|
-
}({}), n = /* @__PURE__ */ function(e) {
|
|
4
|
-
return e.GRID = "grid", e.LIST = "list", e;
|
|
5
|
-
}({});
|
|
6
|
-
export { e as n, n as r, t };
|
|
1
|
+
var SELECT_ALL=`all`,IconColumnVariant=function(IconColumnVariant){return IconColumnVariant.INLINE=`inline`,IconColumnVariant.COLUMN=`column`,IconColumnVariant.INLINE_SUBTITLE=`inline-subtitle`,IconColumnVariant}({}),ViewMode=function(ViewMode){return ViewMode.GRID=`grid`,ViewMode.LIST=`list`,ViewMode}({});export{SELECT_ALL as n,ViewMode as r,IconColumnVariant as t};
|
package/dist/chunks/types2.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
return e.KeywordSearchFilterGroup = "KeywordSearchFilterGroup", e.FileTypeFilterGroup = "FileTypeFilterGroup", e.LocationFilterGroup = "LocationFilterGroup", e;
|
|
3
|
-
}({});
|
|
4
|
-
export { e as t };
|
|
1
|
+
var PredefinedFilterName=function(PredefinedFilterName){return PredefinedFilterName.KeywordSearchFilterGroup=`KeywordSearchFilterGroup`,PredefinedFilterName.FileTypeFilterGroup=`FileTypeFilterGroup`,PredefinedFilterName.LocationFilterGroup=`LocationFilterGroup`,PredefinedFilterName}({});export{PredefinedFilterName as t};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Slider as t } from "@box/blueprint-web";
|
|
3
|
-
import { useIntl as n } from "react-intl";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import '../styles/zoom-button.css';var i = { sliderContainer: "_sliderContainer_1entc_1" }, a = ({ onZoomLevelChange: a, zoomLevel: o }) => {
|
|
6
|
-
let { formatMessage: s } = n();
|
|
7
|
-
return /* @__PURE__ */ r("div", {
|
|
8
|
-
className: i.sliderContainer,
|
|
9
|
-
children: /* @__PURE__ */ r(t, {
|
|
10
|
-
max: 2,
|
|
11
|
-
min: 0,
|
|
12
|
-
minusButtonLabel: s(e.sliderDecreaseSize),
|
|
13
|
-
onValueChange: a,
|
|
14
|
-
plusButtonLabel: s(e.sliderIncreaseSize),
|
|
15
|
-
sliderLabel: s(e.sliderLabel),
|
|
16
|
-
value: o
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
export { a as t };
|
|
1
|
+
import messages from"../esm/lib/components/action-bar/messages.js";import{Slider}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx}from"react/jsx-runtime";import '../styles/zoom-button.css';var zoom_button_module_default={sliderContainer:`_sliderContainer_1entc_1`},ZoomButton=({onZoomLevelChange,zoomLevel})=>{let{formatMessage}=useIntl();return jsx(`div`,{className:zoom_button_module_default.sliderContainer,children:jsx(Slider,{max:2,min:0,minusButtonLabel:formatMessage(messages.sliderDecreaseSize),onValueChange:onZoomLevelChange,plusButtonLabel:formatMessage(messages.sliderIncreaseSize),sliderLabel:formatMessage(messages.sliderLabel),value:zoomLevel})})};export{ZoomButton as t};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,29 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MetadataFileField as r } from "./lib/components/metadata-value/metadata-file-field.js";
|
|
3
|
-
import { t as i } from "../chunks/metadata-location-field.js";
|
|
4
|
-
import { MetadataRadioField as a } from "./lib/components/metadata-value/metadata-radio-field.js";
|
|
5
|
-
import { MetadataSearchField as o } from "./lib/components/metadata-value/metadata-search-field.js";
|
|
6
|
-
import { Filter as s } from "./lib/components/filter-sidepanel/filter.js";
|
|
7
|
-
import { t as c } from "../chunks/filter-side-panel.js";
|
|
8
|
-
import { MetadataFileChip as l } from "./lib/components/metadata-value/metadata-file-chip.js";
|
|
9
|
-
import { FormFilterChip as u } from "./lib/components/filter-row/form-filter-chip.js";
|
|
10
|
-
import { SelectFilterChip as d } from "./lib/components/filter-row/select-filter-chip.js";
|
|
11
|
-
import { MetadataFilterChip as f } from "./lib/components/filter-row/metadata-filter-chip.js";
|
|
12
|
-
import { t as p } from "../chunks/types2.js";
|
|
13
|
-
import { FilterRow as m } from "./lib/components/filter-row/filter-row.js";
|
|
14
|
-
import { SortDropdown as h } from "./lib/components/sort-dropdown/sort-dropdown.js";
|
|
15
|
-
import { t as g } from "../chunks/action-bar.js";
|
|
16
|
-
import { t as _ } from "../chunks/item-action-menu.js";
|
|
17
|
-
import { t as v } from "../chunks/metadata-grid.js";
|
|
18
|
-
import { t as y } from "../chunks/inline-editing-cell.js";
|
|
19
|
-
import { TableRenderer as b } from "./lib/components/metadata-table/table-renderer.js";
|
|
20
|
-
import { MetadataTable as x } from "./lib/components/metadata-table/metadata-table.js";
|
|
21
|
-
import { t as S } from "../chunks/pagination-controls.js";
|
|
22
|
-
import { MarkerBasedPagination as C } from "./lib/components/pagination/marker-based-pagination.js";
|
|
23
|
-
import { OffsetBasedPagination as w } from "./lib/components/pagination/offset-based-pagination.js";
|
|
24
|
-
import { Pagination as T } from "./lib/components/pagination/pagination.js";
|
|
25
|
-
import { Case as E, SwitchCase as D } from "./lib/components/switch-case/switch-case.js";
|
|
26
|
-
import { t as O } from "../chunks/header.js";
|
|
27
|
-
import { t as k } from "../chunks/metadata-view.js";
|
|
28
|
-
import "./lib/index.js";
|
|
29
|
-
export { g as ActionBar, E as Case, s as Filter, m as FilterRow, c as FilterSidePanel, u as FormFilterChip, O as Header, n as IconColumnVariant, y as InlineEditingCell, _ as ItemActionMenu, C as MarkerBasedPagination, l as MetadataFileChip, r as MetadataFileField, f as MetadataFilterChip, v as MetadataGrid, i as MetadataLocationField, a as MetadataRadioField, o as MetadataSearchField, x as MetadataTable, k as MetadataView, w as OffsetBasedPagination, T as Pagination, S as PaginationControls, p as PredefinedFilterName, e as SELECT_ALL, d as SelectFilterChip, h as SortDropdown, D as SwitchCase, b as TableRenderer, t as ViewMode };
|
|
1
|
+
import{n as SELECT_ALL,r as ViewMode,t as IconColumnVariant}from"../chunks/types.js";import{MetadataFileField}from"./lib/components/metadata-value/metadata-file-field.js";import{t as MetadataLocationField}from"../chunks/metadata-location-field.js";import{MetadataRadioField}from"./lib/components/metadata-value/metadata-radio-field.js";import{MetadataSearchField}from"./lib/components/metadata-value/metadata-search-field.js";import{Filter}from"./lib/components/filter-sidepanel/filter.js";import{t as FilterSidePanel}from"../chunks/filter-side-panel.js";import{MetadataFileChip}from"./lib/components/metadata-value/metadata-file-chip.js";import{FormFilterChip}from"./lib/components/filter-row/form-filter-chip.js";import{SelectFilterChip}from"./lib/components/filter-row/select-filter-chip.js";import{MetadataFilterChip}from"./lib/components/filter-row/metadata-filter-chip.js";import{t as PredefinedFilterName}from"../chunks/types2.js";import{FilterRow}from"./lib/components/filter-row/filter-row.js";import{SortDropdown}from"./lib/components/sort-dropdown/sort-dropdown.js";import{t as ActionBar}from"../chunks/action-bar.js";import{t as ItemActionMenu}from"../chunks/item-action-menu.js";import{t as MetadataGrid}from"../chunks/metadata-grid.js";import{t as InlineEditingCell}from"../chunks/inline-editing-cell.js";import{TableRenderer}from"./lib/components/metadata-table/table-renderer.js";import{MetadataTable}from"./lib/components/metadata-table/metadata-table.js";import{t as PaginationControls}from"../chunks/pagination-controls.js";import{MarkerBasedPagination}from"./lib/components/pagination/marker-based-pagination.js";import{OffsetBasedPagination}from"./lib/components/pagination/offset-based-pagination.js";import{Pagination}from"./lib/components/pagination/pagination.js";import{Case,SwitchCase}from"./lib/components/switch-case/switch-case.js";import{t as Header}from"../chunks/header.js";import{t as MetadataView}from"../chunks/metadata-view.js";import"./lib/index.js";export{ActionBar,Case,Filter,FilterRow,FilterSidePanel,FormFilterChip,Header,IconColumnVariant,InlineEditingCell,ItemActionMenu,MarkerBasedPagination,MetadataFileChip,MetadataFileField,MetadataFilterChip,MetadataGrid,MetadataLocationField,MetadataRadioField,MetadataSearchField,MetadataTable,MetadataView,OffsetBasedPagination,Pagination,PaginationControls,PredefinedFilterName,SELECT_ALL,SelectFilterChip,SortDropdown,SwitchCase,TableRenderer,ViewMode};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ActionBar };
|
|
1
|
+
import{t as ActionBar}from"../../../../chunks/action-bar.js";export{ActionBar};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ActionBar };
|
|
1
|
+
import{t as ActionBar}from"../../../../chunks/action-bar.js";export{ActionBar};
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
switchToGridView: {
|
|
4
|
-
id: "groupSharedFeatures.metadataView.actionBar.switchToGridView",
|
|
5
|
-
defaultMessage: "Switch to Grid View"
|
|
6
|
-
},
|
|
7
|
-
switchToListView: {
|
|
8
|
-
id: "groupSharedFeatures.metadataView.actionBar.switchToListView",
|
|
9
|
-
defaultMessage: "Switch to List View"
|
|
10
|
-
},
|
|
11
|
-
sliderDecreaseSize: {
|
|
12
|
-
id: "groupSharedFeatures.metadataView.actionBar.sliderDecreaseSize",
|
|
13
|
-
defaultMessage: "Decrease"
|
|
14
|
-
},
|
|
15
|
-
sliderIncreaseSize: {
|
|
16
|
-
id: "groupSharedFeatures.metadataView.actionBar.sliderIncreaseSize",
|
|
17
|
-
defaultMessage: "Increase"
|
|
18
|
-
},
|
|
19
|
-
sliderLabel: {
|
|
20
|
-
id: "groupSharedFeatures.metadataView.actionBar.sliderLabel",
|
|
21
|
-
defaultMessage: "Slider"
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({switchToGridView:{id:`groupSharedFeatures.metadataView.actionBar.switchToGridView`,defaultMessage:`Switch to Grid View`},switchToListView:{id:`groupSharedFeatures.metadataView.actionBar.switchToListView`,defaultMessage:`Switch to List View`},sliderDecreaseSize:{id:`groupSharedFeatures.metadataView.actionBar.sliderDecreaseSize`,defaultMessage:`Decrease`},sliderIncreaseSize:{id:`groupSharedFeatures.metadataView.actionBar.sliderIncreaseSize`,defaultMessage:`Increase`},sliderLabel:{id:`groupSharedFeatures.metadataView.actionBar.sliderLabel`,defaultMessage:`Slider`}});export{messages as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ZoomButton, e as default };
|
|
1
|
+
import{t as ZoomButton}from"../../../../chunks/zoom-button.js";export{ZoomButton,ZoomButton as default};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
8,
|
|
3
|
-
5,
|
|
4
|
-
3
|
|
5
|
-
], t = [
|
|
6
|
-
"36px",
|
|
7
|
-
"84px",
|
|
8
|
-
"111px"
|
|
9
|
-
], n = [
|
|
10
|
-
"36px",
|
|
11
|
-
"111px",
|
|
12
|
-
"147px"
|
|
13
|
-
];
|
|
14
|
-
export { e as THUMBNAIL_GRID_VIEW_SIZES, t as THUMBNAIL_LIST_VIEW_HEIGHTS, n as THUMBNAIL_WIDTHS };
|
|
1
|
+
var THUMBNAIL_GRID_VIEW_SIZES=[8,5,3],THUMBNAIL_LIST_VIEW_HEIGHTS=[`36px`,`84px`,`111px`],THUMBNAIL_WIDTHS=[`36px`,`111px`,`147px`];export{THUMBNAIL_GRID_VIEW_SIZES,THUMBNAIL_LIST_VIEW_HEIGHTS,THUMBNAIL_WIDTHS};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as default };
|
|
1
|
+
import{t as EmptyStateComponent}from"../../../../chunks/empty-state.js";export{EmptyStateComponent as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as default };
|
|
1
|
+
import{t as EmptyStateComponent}from"../../../../chunks/empty-state.js";export{EmptyStateComponent as default};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
emptyStateHeading: {
|
|
4
|
-
id: "groupSharedFeatures.emptyState.heading",
|
|
5
|
-
defaultMessage: "Sorry, we couldn't find what you're looking for."
|
|
6
|
-
},
|
|
7
|
-
emptyStateBody: {
|
|
8
|
-
id: "groupSharedFeatures.emptyState.body",
|
|
9
|
-
defaultMessage: "Try adjusting your filters or keywords."
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({emptyStateHeading:{id:`groupSharedFeatures.emptyState.heading`,defaultMessage:`Sorry, we couldn't find what you're looking for.`},emptyStateBody:{id:`groupSharedFeatures.emptyState.body`,defaultMessage:`Try adjusting your filters or keywords.`}});export{messages as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ErrorState };
|
|
1
|
+
import{t as ErrorState}from"../../../../chunks/error-state.js";export{ErrorState};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as ErrorState };
|
|
1
|
+
import{t as ErrorState}from"../../../../chunks/error-state.js";export{ErrorState};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = e({
|
|
3
|
-
errorMessage: {
|
|
4
|
-
id: "groupSharedFeatures.metadataView.itemList.errorMessage",
|
|
5
|
-
defaultMessage: "Something went wrong. Please refresh this page."
|
|
6
|
-
},
|
|
7
|
-
refreshButton: {
|
|
8
|
-
id: "groupSharedFeatures.metadataView.itemList.refreshButton",
|
|
9
|
-
defaultMessage: "Refresh"
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
export { t as default };
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({errorMessage:{id:`groupSharedFeatures.metadataView.itemList.errorMessage`,defaultMessage:`Something went wrong. Please refresh this page.`},refreshButton:{id:`groupSharedFeatures.metadataView.itemList.refreshButton`,defaultMessage:`Refresh`}});export{messages as default};
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useFilterChipPopoverPortalElement as t } from "./filter-chip-popover-context.js";
|
|
3
|
-
import { MetadataDateField as n, MetadataFloatField as r, MetadataMultiSelectField as i, MetadataStringField as a, MetadataTaxonomyFieldAdvanced as o } from "@box/metadata-filter";
|
|
4
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
-
var c = ({ fieldNamePrefix: t, filterOptionsMap: n, label: r, portalElement: i }) => {
|
|
6
|
-
let a = e();
|
|
7
|
-
return {
|
|
8
|
-
key: a?.resetKey,
|
|
9
|
-
fieldAdvancedFilterOptions: a?.currentOption,
|
|
10
|
-
fieldNamePrefix: t,
|
|
11
|
-
filterOptionsMap: n,
|
|
12
|
-
isAdvancedFilterEnabled: !0,
|
|
13
|
-
label: r,
|
|
14
|
-
onAdvancedFilterOptionChange: a ? (e, t) => a.onOptionChange(t) : void 0,
|
|
15
|
-
portalElement: i ?? void 0
|
|
16
|
-
};
|
|
17
|
-
}, l = ({ fieldType: e, fieldNamePrefix: l, filterOptionsMap: u, isMultilevelTaxonomyFieldEnabled: d, label: f, locale: p, portalElement: m, taxonomyOptionsFetcher: h }) => {
|
|
18
|
-
let g = c({
|
|
19
|
-
fieldNamePrefix: l,
|
|
20
|
-
filterOptionsMap: u,
|
|
21
|
-
label: f,
|
|
22
|
-
portalElement: t() ?? m
|
|
23
|
-
});
|
|
24
|
-
switch (e) {
|
|
25
|
-
case "date": return /* @__PURE__ */ s(n, {
|
|
26
|
-
...g,
|
|
27
|
-
locale: p
|
|
28
|
-
});
|
|
29
|
-
case "float": return /* @__PURE__ */ s(r, { ...g });
|
|
30
|
-
case "string": return /* @__PURE__ */ s(a, { ...g });
|
|
31
|
-
case "taxonomy": return /* @__PURE__ */ s(o, {
|
|
32
|
-
...g,
|
|
33
|
-
isMultilevelTaxonomyFieldEnabled: d,
|
|
34
|
-
taxonomyOptionsFetcher: h
|
|
35
|
-
});
|
|
36
|
-
default: return /* @__PURE__ */ s(i, { ...g });
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export { l as AdvancedFieldContent };
|
|
1
|
+
import{useAdvancedFilterContext}from"./advanced-filter-context.js";import{useFilterChipPopoverPortalElement}from"./filter-chip-popover-context.js";import{MetadataDateField,MetadataFloatField,MetadataMultiSelectField,MetadataStringField,MetadataTaxonomyFieldAdvanced}from"@box/metadata-filter";import{jsx}from"react/jsx-runtime";var useAdvancedFieldProps=({fieldNamePrefix,filterOptionsMap,label,portalElement})=>{let advancedFilter=useAdvancedFilterContext();return{key:advancedFilter?.resetKey,fieldAdvancedFilterOptions:advancedFilter?.currentOption,fieldNamePrefix,filterOptionsMap,isAdvancedFilterEnabled:!0,label,onAdvancedFilterOptionChange:advancedFilter?(_fieldKey,option)=>advancedFilter.onOptionChange(option):void 0,portalElement:portalElement??void 0}},AdvancedFieldContent=({fieldType,fieldNamePrefix,filterOptionsMap,isMultilevelTaxonomyFieldEnabled,label,locale,portalElement,taxonomyOptionsFetcher})=>{let commonProps=useAdvancedFieldProps({fieldNamePrefix,filterOptionsMap,label,portalElement:useFilterChipPopoverPortalElement()??portalElement});switch(fieldType){case`date`:return jsx(MetadataDateField,{...commonProps,locale});case`float`:return jsx(MetadataFloatField,{...commonProps});case`string`:return jsx(MetadataStringField,{...commonProps});case`taxonomy`:return jsx(MetadataTaxonomyFieldAdvanced,{...commonProps,isMultilevelTaxonomyFieldEnabled,taxonomyOptionsFetcher});default:return jsx(MetadataMultiSelectField,{...commonProps})}};export{AdvancedFieldContent};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var n = /*#__PURE__*/ e(null), r = () => t(n);
|
|
3
|
-
export { n as AdvancedFilterContext, r as useAdvancedFilterContext };
|
|
1
|
+
import{createContext,useContext}from"react";var AdvancedFilterContext=createContext(null),useAdvancedFilterContext=()=>useContext(AdvancedFilterContext);export{AdvancedFilterContext,useAdvancedFilterContext};
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getInitialFieldValues as t } from "./initial-field-values.js";
|
|
3
|
-
import { isFilterSelected as n } from "./is-filter-selected.js";
|
|
4
|
-
import r from "./messages.js";
|
|
5
|
-
import { t as i } from "../../../../chunks/filter-row.module.js";
|
|
6
|
-
import { FilterChip as a } from "@box/blueprint-web";
|
|
7
|
-
import { useMemo as o, useState as s } from "react";
|
|
8
|
-
import { useIntl as c } from "react-intl";
|
|
9
|
-
import { useFormikContext as l } from "formik";
|
|
10
|
-
import { Filter as u } from "@box/blueprint-web-assets/icons/Line";
|
|
11
|
-
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
-
var m = ({ containerRef: m, dataTargetPrefix: h, filterGroups: g, onAllFiltersClick: _ }) => {
|
|
13
|
-
let { formatMessage: v } = c(), { values: y } = l(), [b, x] = s(!1), S = () => _ ? _() : x(!0), C = o(() => Object.values(y.metadata.fields).filter((e) => n(e.value)).length, [y.metadata.fields]);
|
|
14
|
-
return /* @__PURE__ */ p(d, { children: [b && /* @__PURE__ */ f(e, {
|
|
15
|
-
containerRef: m,
|
|
16
|
-
filterGroups: g,
|
|
17
|
-
getInitialFormValues: () => t(g.flatMap(({ filters: e }) => e)),
|
|
18
|
-
isOpen: b,
|
|
19
|
-
onIsOpenChange: x
|
|
20
|
-
}), /* @__PURE__ */ p(a.ChipButton, {
|
|
21
|
-
"data-target-id": h ? `${h}-allFilters` : void 0,
|
|
22
|
-
onClick: S,
|
|
23
|
-
value: "all-filters-chip-btn",
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ f(a.Icon, {
|
|
26
|
-
className: i.filterChipIcon,
|
|
27
|
-
icon: u
|
|
28
|
-
}),
|
|
29
|
-
/* @__PURE__ */ f(a.Label, { children: v(r.allFilters) }),
|
|
30
|
-
C > 0 ? /* @__PURE__ */ f(a.Status, { children: C.toString() }) : null
|
|
31
|
-
]
|
|
32
|
-
})] });
|
|
33
|
-
};
|
|
34
|
-
export { m as default };
|
|
1
|
+
import{t as FilterSidePanel}from"../../../../chunks/filter-side-panel.js";import{getInitialFieldValues}from"./initial-field-values.js";import{isFilterSelected}from"./is-filter-selected.js";import messages from"./messages.js";import{t as filter_row_module_default}from"../../../../chunks/filter-row.module.js";import{FilterChip}from"@box/blueprint-web";import{useMemo,useState}from"react";import{useIntl}from"react-intl";import{useFormikContext}from"formik";import{Filter}from"@box/blueprint-web-assets/icons/Line";import{Fragment,jsx,jsxs}from"react/jsx-runtime";var AllFiltersChip=({containerRef,dataTargetPrefix,filterGroups,onAllFiltersClick})=>{let{formatMessage}=useIntl(),{values}=useFormikContext(),[isSidepanelOpen,setIsSidepanelOpen]=useState(!1),handleChipClick=()=>onAllFiltersClick?onAllFiltersClick():setIsSidepanelOpen(!0),getActiveFilterCount=useMemo(()=>Object.values(values.metadata.fields).filter(fieldContent=>isFilterSelected(fieldContent.value)).length,[values.metadata.fields]);return jsxs(Fragment,{children:[isSidepanelOpen&&jsx(FilterSidePanel,{containerRef,filterGroups,getInitialFormValues:()=>getInitialFieldValues(filterGroups.flatMap(({filters})=>filters)),isOpen:isSidepanelOpen,onIsOpenChange:setIsSidepanelOpen}),jsxs(FilterChip.ChipButton,{"data-target-id":dataTargetPrefix?`${dataTargetPrefix}-allFilters`:void 0,onClick:handleChipClick,value:`all-filters-chip-btn`,children:[jsx(FilterChip.Icon,{className:filter_row_module_default.filterChipIcon,icon:Filter}),jsx(FilterChip.Label,{children:formatMessage(messages.allFilters)}),getActiveFilterCount>0?jsx(FilterChip.Status,{children:getActiveFilterCount.toString()}):null]})]})};export{AllFiltersChip as default};
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isFilterSelected as t } from "./is-filter-selected.js";
|
|
3
|
-
import n from "./messages.js";
|
|
4
|
-
import { FilterChip as r, IconButton as i } from "@box/blueprint-web";
|
|
5
|
-
import { XMark as a } from "@box/blueprint-web-assets/icons/Fill";
|
|
6
|
-
import { useIntl as o } from "react-intl";
|
|
7
|
-
import { useFormikContext as s } from "formik";
|
|
8
|
-
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
-
var u = ({ id: u, label: d, icon: f, isAdvancedFilterEnabled: p, onTrigger: m, onClear: h }) => {
|
|
10
|
-
let { formatMessage: g } = o(), { values: _, setFieldValue: v, submitForm: y } = s(), b = _.metadata.fields[u], x = b?.value, S = x ? t(x) : !1, C = {
|
|
11
|
-
value: x,
|
|
12
|
-
setValue: (e) => v(`metadata.fields.${u}.value`, e),
|
|
13
|
-
submit: y
|
|
14
|
-
}, w = {
|
|
15
|
-
value: x,
|
|
16
|
-
clear: () => v(`metadata.fields.${u}.value`, e({
|
|
17
|
-
fieldType: b?.fieldType,
|
|
18
|
-
isAdvancedFilterEnabled: p
|
|
19
|
-
})),
|
|
20
|
-
submit: y
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ l(r.TriggerChip, {
|
|
23
|
-
selected: S,
|
|
24
|
-
value: u,
|
|
25
|
-
onClick: () => m(C),
|
|
26
|
-
children: [
|
|
27
|
-
f && /* @__PURE__ */ c(r.Icon, { icon: f }),
|
|
28
|
-
/* @__PURE__ */ c(r.Label, { children: d }),
|
|
29
|
-
S && h ? /* @__PURE__ */ c(i, {
|
|
30
|
-
"aria-label": g(n.clearButton),
|
|
31
|
-
icon: a,
|
|
32
|
-
size: "small",
|
|
33
|
-
onClick: (e) => {
|
|
34
|
-
e.stopPropagation(), h?.(w);
|
|
35
|
-
}
|
|
36
|
-
}) : null
|
|
37
|
-
]
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
export { u as CustomTriggerChip };
|
|
1
|
+
import{getDefaultFieldValue}from"./initial-field-values.js";import{isFilterSelected}from"./is-filter-selected.js";import messages from"./messages.js";import{FilterChip,IconButton}from"@box/blueprint-web";import{XMark}from"@box/blueprint-web-assets/icons/Fill";import{useIntl}from"react-intl";import{useFormikContext}from"formik";import{jsx,jsxs}from"react/jsx-runtime";var CustomTriggerChip=({id,label,icon,isAdvancedFilterEnabled,onTrigger,onClear})=>{let{formatMessage}=useIntl(),{values,setFieldValue,submitForm}=useFormikContext(),field=values.metadata.fields[id],value=field?.value,selected=value?isFilterSelected(value):!1,triggerBindings={value,setValue:next=>setFieldValue(`metadata.fields.${id}.value`,next),submit:submitForm},clearBindings={value,clear:()=>setFieldValue(`metadata.fields.${id}.value`,getDefaultFieldValue({fieldType:field?.fieldType,isAdvancedFilterEnabled})),submit:submitForm};return jsxs(FilterChip.TriggerChip,{selected,value:id,onClick:()=>onTrigger(triggerBindings),children:[icon&&jsx(FilterChip.Icon,{icon}),jsx(FilterChip.Label,{children:label}),selected&&onClear?jsx(IconButton,{"aria-label":formatMessage(messages.clearButton),icon:XMark,size:`small`,onClick:event=>{event.stopPropagation(),onClear?.(clearBindings)}}):null]})};export{CustomTriggerChip};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var n = /*#__PURE__*/ e(null), r = n.Provider, i = () => t(n);
|
|
3
|
-
export { r as FilterChipPopoverPortalProvider, i as useFilterChipPopoverPortalElement };
|
|
1
|
+
import{createContext,useContext}from"react";var FilterChipPopoverPortalContext=createContext(null),FilterChipPopoverPortalProvider=FilterChipPopoverPortalContext.Provider,useFilterChipPopoverPortalElement=()=>useContext(FilterChipPopoverPortalContext);export{FilterChipPopoverPortalProvider,useFilterChipPopoverPortalElement};
|
|
@@ -1,46 +1 @@
|
|
|
1
|
-
import
|
|
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 = (e) => {
|
|
11
|
-
let t = e.fieldType === "taxonomy" ? [
|
|
12
|
-
e.key,
|
|
13
|
-
JSON.stringify(e.optionsRules),
|
|
14
|
-
JSON.stringify(e.levels),
|
|
15
|
-
e.scope,
|
|
16
|
-
e.templateKey
|
|
17
|
-
].join(":") : "";
|
|
18
|
-
return `${e.id}:${e.fieldType}:${t}`;
|
|
19
|
-
}, p = ({ dataTargetPrefix: p, predefinedFilterOptions: m, containerRef: h, filterGroups: g = [], initialFilterValues: _, isAllFiltersDisabled: v, onAllFiltersClick: y, onFilterSubmit: b }) => {
|
|
20
|
-
let x = i(m), S = ({ metadata: { fields: e } }) => {
|
|
21
|
-
b && b(e);
|
|
22
|
-
}, C = [...x, ...g], w = C.flatMap(({ filters: e }) => e).sort((e, t) => (e.position ?? 0) - (t.position ?? 0)), T = o(() => e(w, _), [w.map((e) => f(e)).sort().join("|"), _]), E = s(null);
|
|
23
|
-
return /* @__PURE__ */ u(l, {
|
|
24
|
-
enableReinitialize: !0,
|
|
25
|
-
initialValues: T,
|
|
26
|
-
onSubmit: S,
|
|
27
|
-
children: /* @__PURE__ */ u(c, {
|
|
28
|
-
ref: E,
|
|
29
|
-
children: /* @__PURE__ */ d(a.Group, {
|
|
30
|
-
className: t.filterChipGroup,
|
|
31
|
-
name: "metadata-view-filters",
|
|
32
|
-
type: "multiple",
|
|
33
|
-
children: [v ? null : /* @__PURE__ */ u(n, {
|
|
34
|
-
containerRef: h,
|
|
35
|
-
dataTargetPrefix: p,
|
|
36
|
-
filterGroups: C,
|
|
37
|
-
onAllFiltersClick: y
|
|
38
|
-
}), w.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ u(r, {
|
|
39
|
-
filterOption: e,
|
|
40
|
-
formRef: E
|
|
41
|
-
}, e.id))]
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
export { p as FilterRow };
|
|
1
|
+
import{getInitialFieldValues}from"./initial-field-values.js";import{t as filter_row_module_default}from"../../../../chunks/filter-row.module.js";import AllFiltersChip from"./all-filters-chip.js";import{MetadataFilterChip}from"./metadata-filter-chip.js";import{usePredefinedFilter}from"./predefinedFilters/use-predefined-filter.js";import{FilterChip}from"@box/blueprint-web";import{useMemo,useRef}from"react";import{Form,Formik}from"formik";import{jsx,jsxs}from"react/jsx-runtime";var getFilterSchemaEntry=filterOption=>{let taxonomyMetadata=filterOption.fieldType===`taxonomy`?[filterOption.key,JSON.stringify(filterOption.optionsRules),JSON.stringify(filterOption.levels),filterOption.scope,filterOption.templateKey].join(`:`):``;return`${filterOption.id}:${filterOption.fieldType}:${taxonomyMetadata}`},FilterRow=({dataTargetPrefix,predefinedFilterOptions,containerRef,filterGroups:customFilterGroups=[],initialFilterValues:customFilterValues,isAllFiltersDisabled,onAllFiltersClick,onFilterSubmit})=>{let predefinedFilters=usePredefinedFilter(predefinedFilterOptions),handleSubmit=({metadata:{fields}})=>{onFilterSubmit&&onFilterSubmit(fields)},filterGroups=[...predefinedFilters,...customFilterGroups],filterOptions=filterGroups.flatMap(({filters})=>filters).sort((a,b)=>(a.position??0)-(b.position??0)),initialValues=useMemo(()=>getInitialFieldValues(filterOptions,customFilterValues),[filterOptions.map(filterOption=>getFilterSchemaEntry(filterOption)).sort().join(`|`),customFilterValues]),formRef=useRef(null);return jsx(Formik,{enableReinitialize:!0,initialValues,onSubmit:handleSubmit,children:jsx(Form,{ref:formRef,children:jsxs(FilterChip.Group,{className:filter_row_module_default.filterChipGroup,name:`metadata-view-filters`,type:`multiple`,children:[isAllFiltersDisabled?null:jsx(AllFiltersChip,{containerRef,dataTargetPrefix,filterGroups,onAllFiltersClick}),filterOptions.filter(filterOption=>filterOption.shouldRenderChip).map(filterOption=>jsx(MetadataFilterChip,{filterOption,formRef},filterOption.id))]})})})};export{FilterRow};
|
|
@@ -1,99 +1 @@
|
|
|
1
|
-
import
|
|
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 { FilterChipPopoverPortalProvider as s } from "./filter-chip-popover-context.js";
|
|
8
|
-
import { useFormFilterChip as c } from "./use-form-filter-chip.js";
|
|
9
|
-
import { useNestedOverlayPopoverOpenChange as l } from "./use-nested-overlay-popover-open-change.js";
|
|
10
|
-
import { Button as u, FilterChip as d, Popover as f } from "@box/blueprint-web";
|
|
11
|
-
import { useMemo as p, useState as m } from "react";
|
|
12
|
-
import { useIntl as h } from "react-intl";
|
|
13
|
-
import { getIn as g, useFormikContext as _ } from "formik";
|
|
14
|
-
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
|
-
var b = ({ children: b, formRef: x, icon: S, id: C, name: w = "", isAdvancedFilterEnabled: T, advancedFilterOptionsMap: ee }) => {
|
|
16
|
-
let { formatMessage: E } = h(), [D, O] = m(!1), { handleSubmit: k, setFieldValue: A, resetForm: j, values: M } = _(), N = g(M, `metadata.fields.${C}.fieldType`), P = g(M, `metadata.fields.${C}.value`), { appliedAdvancedFilterOption: F, currentAdvancedFilterOption: I, dynamicDisplayName: L, handleAdvancedFilterOptionChange: R, handleApply: z, handleCancel: B, handleClear: V } = c({
|
|
17
|
-
name: w,
|
|
18
|
-
initialAdvancedFilterOption: T && P ? n(P) : void 0,
|
|
19
|
-
filterValue: P
|
|
20
|
-
}), [H, U] = m(0), W = () => {
|
|
21
|
-
T && z(), k(), O(!1);
|
|
22
|
-
}, [G, K] = m(M), { handlePopoverOpenChange: q, portalElement: J, setPopoverContentRef: Y } = l({
|
|
23
|
-
onOpenChange: (e) => {
|
|
24
|
-
O(e), e ? (K(M), T && U((e) => e + 1)) : (j({ values: G }), T && B());
|
|
25
|
-
},
|
|
26
|
-
popoverOpen: D
|
|
27
|
-
}), X = () => {
|
|
28
|
-
A(`metadata.fields.${C}.value`, e({
|
|
29
|
-
fieldType: N,
|
|
30
|
-
isAdvancedFilterEnabled: T
|
|
31
|
-
})), T && V();
|
|
32
|
-
}, Z = p(() => {
|
|
33
|
-
if (T && t(F)) return !0;
|
|
34
|
-
let e = g(M, `metadata.fields.${C}.value`);
|
|
35
|
-
return e ? r(e) : !1;
|
|
36
|
-
}, [
|
|
37
|
-
M,
|
|
38
|
-
C,
|
|
39
|
-
T,
|
|
40
|
-
F
|
|
41
|
-
]), Q = () => {
|
|
42
|
-
if (N === "date") {
|
|
43
|
-
let e = g(M, `metadata.fields.${C}.value.customType`), t = e && e !== "anyTime" && e !== "customRange", n = g(M, `metadata.fields.${C}.value.relativeType`);
|
|
44
|
-
return (t || n && n !== "customRange") && !Z;
|
|
45
|
-
}
|
|
46
|
-
return !1;
|
|
47
|
-
}, $ = T && Z ? L : w, te = p(() => ({
|
|
48
|
-
currentOption: I,
|
|
49
|
-
onOptionChange: R,
|
|
50
|
-
resetKey: H
|
|
51
|
-
}), [
|
|
52
|
-
I,
|
|
53
|
-
R,
|
|
54
|
-
H
|
|
55
|
-
]), ne = T ? /* @__PURE__ */ v(o.Provider, {
|
|
56
|
-
value: te,
|
|
57
|
-
children: b
|
|
58
|
-
}) : b;
|
|
59
|
-
return /* @__PURE__ */ v("div", { children: /* @__PURE__ */ y(f.Root, {
|
|
60
|
-
modal: !1,
|
|
61
|
-
onOpenChange: q,
|
|
62
|
-
open: D,
|
|
63
|
-
children: [/* @__PURE__ */ v(f.Trigger, { children: /* @__PURE__ */ y(d.TriggerChip, {
|
|
64
|
-
selected: Z,
|
|
65
|
-
value: C,
|
|
66
|
-
children: [
|
|
67
|
-
S && /* @__PURE__ */ v(d.Icon, { icon: S }),
|
|
68
|
-
/* @__PURE__ */ v(d.Label, { children: $ }),
|
|
69
|
-
/* @__PURE__ */ v(d.DropdownIndicator, {})
|
|
70
|
-
]
|
|
71
|
-
}, C) }), /* @__PURE__ */ v(f.ContentContainer, {
|
|
72
|
-
ref: Y,
|
|
73
|
-
align: "start",
|
|
74
|
-
className: a.popoverContent,
|
|
75
|
-
container: x.current,
|
|
76
|
-
"data-testid": "form-filter-chip-popover",
|
|
77
|
-
children: /* @__PURE__ */ y(s, {
|
|
78
|
-
value: J,
|
|
79
|
-
children: [/* @__PURE__ */ v(f.MainContent, { children: ne }), /* @__PURE__ */ y(f.Footer, {
|
|
80
|
-
className: a.popoverFooter,
|
|
81
|
-
children: [/* @__PURE__ */ v(u, {
|
|
82
|
-
onClick: X,
|
|
83
|
-
size: "small",
|
|
84
|
-
variant: "secondary",
|
|
85
|
-
children: E(i.clearButton)
|
|
86
|
-
}), /* @__PURE__ */ v(u, {
|
|
87
|
-
disabled: Q(),
|
|
88
|
-
onClick: W,
|
|
89
|
-
size: "small",
|
|
90
|
-
type: "submit",
|
|
91
|
-
variant: "primary",
|
|
92
|
-
children: E(i.applyButton)
|
|
93
|
-
})]
|
|
94
|
-
})]
|
|
95
|
-
})
|
|
96
|
-
})]
|
|
97
|
-
}) });
|
|
98
|
-
};
|
|
99
|
-
export { b as FormFilterChip };
|
|
1
|
+
import{getDefaultFieldValue}from"./initial-field-values.js";import{isBlankOrNotBlankFilter}from"./is-blank-or-not-blank-filter.js";import{extractAdvancedFilterOption,isFilterSelected}from"./is-filter-selected.js";import messages from"./messages.js";import{t as filter_row_module_default}from"../../../../chunks/filter-row.module.js";import{AdvancedFilterContext}from"./advanced-filter-context.js";import{FilterChipPopoverPortalProvider}from"./filter-chip-popover-context.js";import{useFormFilterChip}from"./use-form-filter-chip.js";import{useNestedOverlayPopoverOpenChange}from"./use-nested-overlay-popover-open-change.js";import{Button,FilterChip,Popover}from"@box/blueprint-web";import{useMemo,useState}from"react";import{useIntl}from"react-intl";import{getIn,useFormikContext}from"formik";import{jsx,jsxs}from"react/jsx-runtime";var FormFilterChip=({children,formRef,icon,id,name=``,isAdvancedFilterEnabled,advancedFilterOptionsMap})=>{let{formatMessage}=useIntl(),[popoverOpen,setPopoverOpen]=useState(!1),{handleSubmit,setFieldValue,resetForm,values}=useFormikContext(),fieldType=getIn(values,`metadata.fields.${id}.fieldType`),formFieldValue=getIn(values,`metadata.fields.${id}.value`),{appliedAdvancedFilterOption,currentAdvancedFilterOption,dynamicDisplayName,handleAdvancedFilterOptionChange,handleApply,handleCancel,handleClear}=useFormFilterChip({name,initialAdvancedFilterOption:isAdvancedFilterEnabled&&formFieldValue?extractAdvancedFilterOption(formFieldValue):void 0,filterValue:formFieldValue}),[resetKey,setResetKey]=useState(0),submitForm=()=>{isAdvancedFilterEnabled&&handleApply(),handleSubmit(),setPopoverOpen(!1)},[dirtyValues,setDirtyValues]=useState(values),{handlePopoverOpenChange,portalElement,setPopoverContentRef}=useNestedOverlayPopoverOpenChange({onOpenChange:open=>{setPopoverOpen(open),open?(setDirtyValues(values),isAdvancedFilterEnabled&&setResetKey(k=>k+1)):(resetForm({values:dirtyValues}),isAdvancedFilterEnabled&&handleCancel())},popoverOpen}),handleClearButtonClick=()=>{setFieldValue(`metadata.fields.${id}.value`,getDefaultFieldValue({fieldType,isAdvancedFilterEnabled})),isAdvancedFilterEnabled&&handleClear()},isSelected=useMemo(()=>{if(isAdvancedFilterEnabled&&isBlankOrNotBlankFilter(appliedAdvancedFilterOption))return!0;let value=getIn(values,`metadata.fields.${id}.value`);return value?isFilterSelected(value):!1},[values,id,isAdvancedFilterEnabled,appliedAdvancedFilterOption]),shouldDisableApplyButton=()=>{if(fieldType===`date`){let customDateFilterType=getIn(values,`metadata.fields.${id}.value.customType`),isCustomDateFilterTypeSelected=customDateFilterType&&customDateFilterType!==`anyTime`&&customDateFilterType!==`customRange`,relativeType=getIn(values,`metadata.fields.${id}.value.relativeType`);return(isCustomDateFilterTypeSelected||relativeType&&relativeType!==`customRange`)&&!isSelected}return!1},chipLabel=isAdvancedFilterEnabled&&isSelected?dynamicDisplayName:name,advancedFilterContextValue=useMemo(()=>({currentOption:currentAdvancedFilterOption,onOptionChange:handleAdvancedFilterOptionChange,resetKey}),[currentAdvancedFilterOption,handleAdvancedFilterOptionChange,resetKey]),mainContent=isAdvancedFilterEnabled?jsx(AdvancedFilterContext.Provider,{value:advancedFilterContextValue,children}):children;return jsx(`div`,{children:jsxs(Popover.Root,{modal:!1,onOpenChange:handlePopoverOpenChange,open:popoverOpen,children:[jsx(Popover.Trigger,{children:jsxs(FilterChip.TriggerChip,{selected:isSelected,value:id,children:[icon&&jsx(FilterChip.Icon,{icon}),jsx(FilterChip.Label,{children:chipLabel}),jsx(FilterChip.DropdownIndicator,{})]},id)}),jsx(Popover.ContentContainer,{ref:setPopoverContentRef,align:`start`,className:filter_row_module_default.popoverContent,container:formRef.current,"data-testid":`form-filter-chip-popover`,children:jsxs(FilterChipPopoverPortalProvider,{value:portalElement,children:[jsx(Popover.MainContent,{children:mainContent}),jsxs(Popover.Footer,{className:filter_row_module_default.popoverFooter,children:[jsx(Button,{onClick:handleClearButtonClick,size:`small`,variant:`secondary`,children:formatMessage(messages.clearButton)}),jsx(Button,{disabled:shouldDisableApplyButton(),onClick:submitForm,size:`small`,type:`submit`,variant:`primary`,children:formatMessage(messages.applyButton)})]})]})})]})})};export{FormFilterChip};
|