@box/metadata-view 2.2.39 → 2.2.40
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import messages from"../esm/lib/components/metadata-table/messages.js";import{
|
|
1
|
+
import messages from"../esm/lib/components/metadata-table/messages.js";import{Cell,DropdownMenu,TextButton}from"@box/blueprint-web";import{CaretDown}from"@box/blueprint-web-assets/icons/Fill";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import get from"lodash/get";import isEqual from"lodash/isEqual";import '../styles/inline-editing-cell.css';var inline_editing_cell_module_default={inlineEditingCell:`_inlineEditingCell_sj84k_1`},InlineEditingCell=({column,item,onInlineEditChange})=>{let{formatMessage}=useIntl(),{type,inlineEditingOptions,id:columnId}=column,rawValue=get(item,columnId),currentValue=typeof rawValue==`string`?[rawValue]:rawValue||[],unselectedLabel=formatMessage(messages.unselectedOptionLabel),optionsWithDefault=[{value:null,label:unselectedLabel},...(inlineEditingOptions??[]).map(option=>({value:option,label:option}))],handleOptionSelect=selectedValue=>{if(!onInlineEditChange)return;let newValue;newValue=type===`multiSelect`?selectedValue===null?[]:currentValue.includes(selectedValue)?currentValue.filter(value=>value!==selectedValue):[...currentValue,selectedValue]:selectedValue,(type===`multiSelect`?!isEqual(newValue,currentValue):newValue!==currentValue[0])&&onInlineEditChange(item,newValue,columnId)},isOptionSelected=optionValue=>optionValue===null?currentValue.length===0:currentValue.includes(optionValue);return jsx(Cell,{children:jsxs(DropdownMenu.Root,{children:[jsx(DropdownMenu.Trigger,{children:jsx(TextButton,{className:inline_editing_cell_module_default.inlineEditingCell,ellipsizable:!0,icon:CaretDown,variant:`bodyDefault`,children:currentValue.length>0?currentValue.join(`, `):unselectedLabel})}),jsx(DropdownMenu.Content,{align:`start`,children:optionsWithDefault.map(option=>jsx(DropdownMenu.CheckboxItem,{checked:isOptionSelected(option.value),onSelect:()=>handleOptionSelect(option.value),children:option.label},option.value??unselectedLabel))})]})})};export{InlineEditingCell as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._inlineEditingCell_sj84k_1._inlineEditingCell_sj84k_1,._inlineEditingCell_sj84k_1._inlineEditingCell_sj84k_1:focus-visible,._inlineEditingCell_sj84k_1._inlineEditingCell_sj84k_1:hover{color:var(--bp-text-text-on-light)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.40",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^16.13.1",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@box/box-item-type-selector": "^2.1.36",
|
|
9
9
|
"@box/content-field": "^2.1.35",
|
|
10
10
|
"@box/item-icon": "^3.2.34",
|
|
11
|
-
"@box/metadata-filter": "^2.2.
|
|
11
|
+
"@box/metadata-filter": "^2.2.30",
|
|
12
12
|
"@box/types": "^3.1.11",
|
|
13
13
|
"@tanstack/react-virtual": "^3.10.8",
|
|
14
14
|
"formik": "^2.4.5",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@box/content-field": "^2.1.35",
|
|
26
26
|
"@box/eslint-plugin-blueprint": "2.1.11",
|
|
27
27
|
"@box/item-icon": "^3.2.34",
|
|
28
|
-
"@box/metadata-filter": "^2.2.
|
|
28
|
+
"@box/metadata-filter": "^2.2.30",
|
|
29
29
|
"@box/storybook-utils": "1.1.34",
|
|
30
30
|
"@box/types": "^3.1.11",
|
|
31
31
|
"@tanstack/react-virtual": "^3.10.8",
|