@itwin/components-react 4.16.5 → 4.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/lib/cjs/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.js +1 -0
- package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.js +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +1 -0
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +37 -34
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +50 -27
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +30 -2
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.js +1 -0
- package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.js +1 -0
- package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +1 -0
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +4 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +36 -32
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +48 -26
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js +1 -0
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +7 -2
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAA6C;AAE7C,iEAA8D;AAG9D,mEAAgE;AAGhE,+CAAgD;AAkDhD;;;GAGG;AACU,QAAA,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,gBAAgB,CAClE,KAA4B;IAE5B,MAAM,KAAK,GAAG,CACZ,oBAAC,6BAAe,IACd,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,eAAe,EAAE,KAAK,CAAC,kBAAkB,EACzC,cAAc,EAAE,KAAK,CAAC,kBAAkB,EACxC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,GAC5C,CACH,CAAC;IAEF,SAAS,iBAAiB;QACxB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU;YAAE,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YACvE,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,SAAS,aAAa,CAAC,CAAmB;QACxC,CAAC,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,KAAK,EACvB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,EACzE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,sBAAsB,EAAE,iBAAiB,EACzC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,EAAE,cAAc,EAAE,KAAK,CAAC,gBAAgB,EAAE,IAE1D,KAAK,CAAC,QAAQ,CACN,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAA6C;AAE7C,iEAA8D;AAG9D,mEAAgE;AAGhE,+CAAgD;AAkDhD;;;GAGG;AACU,QAAA,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,gBAAgB,CAClE,KAA4B;IAE5B,MAAM,KAAK,GAAG,CACZ,oBAAC,6BAAe,IACd,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,eAAe,EAAE,KAAK,CAAC,kBAAkB,EACzC,cAAc,EAAE,KAAK,CAAC,kBAAkB,EACxC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,GAC5C,CACH,CAAC;IAEF,SAAS,iBAAiB;QACxB,IAAI,KAAK,CAAC,I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,IAAI,EACF,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAClB,oBAAC,YAAY,IAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,GAAI,CACnE,CAAC,CAAC,CAAC,SAAS,EAEf,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EACvB,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,EACzE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,sBAAsB,EAAE,iBAAiB,EACzC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,EAAE,cAAc,EAAE,KAAK,CAAC,gBAAgB,EAAE,IAE1D,KAAK,CAAC,QAAQ,CACN,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC;AAcH;;;GAGG;AACH,mDAAmD;AACnD,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,QAAQ,GAAG,IAAI,6BAAa,EAAE,CAAC;IACrC,OAAO,0CAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAI,CAAC;AACvC,CAAC;AARD,oCAQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps, NodeCheckboxProps } from \"@itwin/core-react\";\nimport { TreeNode } from \"@itwin/core-react\";\nimport type { Checkbox } from \"@itwin/itwinui-react\";\nimport { ImageRenderer } from \"../../../common/ImageRenderer\";\nimport type { HighlightableTreeNodeProps } from \"../../HighlightingEngine\";\nimport type { ITreeImageLoader } from \"../../ImageLoader\";\nimport { TreeComponentTestId } from \"../../TreeComponentTestId\";\nimport type { TreeActions } from \"../TreeActions\";\nimport type { CheckBoxInfo, TreeModelNode } from \"../TreeModel\";\nimport { TreeNodeContent } from \"./NodeContent\";\nimport type { TreeNodeEditorRenderer } from \"./TreeNodeEditor\";\n\ntype CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;\n\ntype CheckboxRendererProps = Omit<CheckboxProps, \"onChange\" | \"onClick\"> & {\n onChange: (checked: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n};\n\n/**\n * Properties for [[TreeNodeRenderer]].\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeRendererProps extends CommonProps {\n /** Tree node to render. */\n node: TreeModelNode;\n\n /** Action handler. */\n treeActions: TreeActions;\n\n /** Properties used to highlight matches when tree is filtered. */\n nodeHighlightProps?: HighlightableTreeNodeProps;\n\n /** Specifies whether to show descriptions or not. */\n descriptionEnabled?: boolean;\n\n /** Image loader for node icons. */\n imageLoader?: ITreeImageLoader;\n\n /** Callback to render custom checkbox. */\n checkboxRenderer?: (props: CheckboxRendererProps) => React.ReactNode;\n\n /** Callback to render custom node editor when node is in editing mode. */\n nodeEditorRenderer?: TreeNodeEditorRenderer;\n\n /**\n * Callback used to detect when label is rendered. It is used by TreeRenderer for scrolling to active match.\n * @internal\n */\n onLabelRendered?: (node: TreeModelNode) => void;\n\n /** Callback that is invoked when context menu should be opened. */\n onContextMenu?: (e: React.MouseEvent, node: TreeModelNode) => void;\n\n /** Child components to render inside the node.*/\n children?: React.ReactNode;\n}\n\n/**\n * Default component for rendering tree node.\n * @public\n */\nexport const TreeNodeRenderer = React.memo(function TreeNodeRenderer(\n props: TreeNodeRendererProps\n) {\n const label = (\n <TreeNodeContent\n key={props.node.id}\n node={props.node}\n showDescription={props.descriptionEnabled}\n highlightProps={props.nodeHighlightProps}\n onLabelRendered={props.onLabelRendered}\n nodeEditorRenderer={props.nodeEditorRenderer}\n />\n );\n\n function onExpansionToggle() {\n if (props.node.isExpanded) props.treeActions.onNodeCollapsed(props.node.id);\n else props.treeActions.onNodeExpanded(props.node.id);\n }\n\n function onContextMenu(e: React.MouseEvent) {\n e.preventDefault();\n props.onContextMenu && props.onContextMenu(e, props.node);\n }\n\n const createCheckboxProps = (\n checkboxInfo: CheckBoxInfo\n // eslint-disable-next-line deprecation/deprecation\n ): NodeCheckboxProps => ({\n state: checkboxInfo.state,\n tooltip: checkboxInfo.tooltip,\n isDisabled: checkboxInfo.isDisabled,\n onClick: (newState) =>\n props.treeActions.onNodeCheckboxClicked(props.node.id, newState),\n });\n\n return (\n // eslint-disable-next-line deprecation/deprecation\n <TreeNode\n data-testid={TreeComponentTestId.Node}\n className={props.className}\n checkboxProps={\n props.node.checkbox.isVisible\n ? createCheckboxProps(props.node.checkbox)\n : undefined\n }\n style={props.style}\n isExpanded={props.node.isExpanded}\n isSelected={props.node.isSelected}\n isLoading={props.node.isLoading}\n isLeaf={props.node.numChildren === 0}\n icon={\n props.imageLoader ? (\n <TreeNodeIcon node={props.node} imageLoader={props.imageLoader} />\n ) : undefined\n }\n label={label}\n level={props.node.depth}\n onClick={(event) => props.treeActions.onNodeClicked(props.node.id, event)}\n onMouseDown={() => props.treeActions.onNodeMouseDown(props.node.id)}\n onMouseMove={() => props.treeActions.onNodeMouseMove(props.node.id)}\n onClickExpansionToggle={onExpansionToggle}\n onContextMenu={onContextMenu}\n renderOverrides={{ renderCheckbox: props.checkboxRenderer }}\n >\n {props.children}\n </TreeNode>\n );\n});\n\n/**\n * Props for [[TreeNodeIcon]] component.\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeIcon>`\n */\nexport interface TreeNodeIconProps {\n /** Tree node to render icon for. */\n node: TreeModelNode;\n /** Image loader used to load tree node icon. */\n imageLoader: ITreeImageLoader;\n}\n\n/**\n * React component that renders icon for [[TreeNode]].\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function TreeNodeIcon(props: TreeNodeIconProps) {\n const { imageLoader, node } = props;\n const image = imageLoader.load(node.item);\n\n if (!image) return null;\n\n const renderer = new ImageRenderer();\n return <>{renderer.render(image)}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightedText.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC
|
|
1
|
+
{"version":3,"file":"HighlightedText.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IAEnC,UAAU,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAW1D"}
|
|
@@ -13,6 +13,7 @@ import { HighlightingEngine } from "../tree/HighlightingEngine";
|
|
|
13
13
|
* Also actively highlights one matched part which is selected with 'activeMatchIndex'
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
export function HighlightedText(props) {
|
|
17
18
|
const { searchText, activeMatchIndex, text, caseSensitive } = props;
|
|
18
19
|
const chunks = useMemo(() => findChunks(text, searchText, caseSensitive), [text, searchText, caseSensitive]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAkBhE;;;;;GAKG;AACH,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpE,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,EACjD,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAClC,CAAC;IACF,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAChD,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,CACjC,CAAC;IACF,OAAO,0CAAG,YAAY,CAAI,CAAC;AAC7B,CAAC;AAOD,SAAS,UAAU,CACjB,IAAY,EACZ,UAAkB,EAClB,aAAuB;IAEvB,MAAM,MAAM,GAA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AAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;QACxD,SAAS,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACzC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport React, { useMemo } from \"react\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof HighlightedText>`\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n const chunks = useMemo(\n () => findChunks(text, searchText, caseSensitive),\n [text, searchText, caseSensitive]\n );\n const markedChunks = useMemo(\n () => markChunks(text, chunks, activeMatchIndex),\n [text, chunks, activeMatchIndex]\n );\n return <>{markedChunks}</>;\n}\n\ninterface HighlightedChunk {\n start: number;\n end: number;\n}\n\nfunction findChunks(\n text: string,\n searchText: string,\n caseSensitive?: boolean\n): HighlightedChunk[] {\n const chunks: HighlightedChunk[] = [];\n const contentText = caseSensitive ? text : text.toLowerCase();\n const inputText = caseSensitive ? searchText : searchText.toLowerCase();\n let index = contentText.indexOf(inputText);\n\n while (index !== -1) {\n chunks.push({ start: index, end: index + inputText.length });\n index = contentText.indexOf(inputText, index + 1);\n }\n\n return chunks;\n}\n\nfunction markChunks(\n text: string,\n chunks: HighlightedChunk[],\n activeChunk?: number\n) {\n const markedText: React.ReactElement[] = [];\n let previousIndex = 0;\n\n const { mergedChunks, newActiveIndex } = mergeChunks(chunks, activeChunk);\n\n for (let i = 0; i < mergedChunks.length; i++) {\n const { start, end } = mergedChunks[i];\n\n // add unmarked text between previous chunk and current one\n const nonMarkedText = text.substring(previousIndex, start);\n if (nonMarkedText.length) {\n markedText.push(<span key={previousIndex}>{nonMarkedText}</span>);\n }\n\n // add marked chunk text\n markedText.push(\n <mark\n key={start}\n className={\n i === newActiveIndex\n ? HighlightingEngine.ACTIVE_CLASS_NAME\n : undefined\n }\n >\n {text.substring(start, end)}\n </mark>\n );\n previousIndex = end;\n }\n\n // add unmarked text after last chunk\n const lastNonMarkedText = text.substring(previousIndex, text.length);\n if (lastNonMarkedText.length) {\n markedText.push(<span key={previousIndex}>{lastNonMarkedText}</span>);\n }\n\n return markedText;\n}\n\nfunction mergeChunks(chunks: HighlightedChunk[], activeChunk?: number) {\n const mergedChunks: HighlightedChunk[] = [];\n let lastChunk: { isActive: boolean; info: HighlightedChunk } | undefined;\n let newActiveIndex: number | undefined;\n\n for (let i = 0; i < chunks.length; i++) {\n const chunk = chunks[i];\n const isActive = i === activeChunk;\n if (\n lastChunk &&\n lastChunk.info.end === chunk.start &&\n !isActive &&\n !lastChunk.isActive\n ) {\n lastChunk.info.end = chunk.end;\n continue;\n }\n isActive && (newActiveIndex = mergedChunks.length);\n const newChunk = { start: chunk.start, end: chunk.end };\n lastChunk = { isActive, info: newChunk };\n mergedChunks.push(newChunk);\n }\n return { mergedChunks, newActiveIndex };\n}\n"]}
|
|
@@ -36,6 +36,7 @@ export interface PropertyEditorProps extends CommonProps {
|
|
|
36
36
|
}
|
|
37
37
|
/** [[EditorContainer]] React component properties
|
|
38
38
|
* @public
|
|
39
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`
|
|
39
40
|
*/
|
|
40
41
|
export interface EditorContainerProps extends CommonProps {
|
|
41
42
|
/** The property being updated. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KA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gB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAC3D,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAmL1D"}
|
|
@@ -13,6 +13,7 @@ import { PropertyEditorManager } from "./PropertyEditorManager";
|
|
|
13
13
|
/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
export function EditorContainer(props) {
|
|
17
18
|
const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, ...rest } = props;
|
|
18
19
|
const editorRef = React.useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAwEhE;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAkC,CAAC;IAEzE,MAAM,WAAW,GA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Q,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,wBAAwB;IACxB,IAAI,WAAW,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,WAAW,IAAI,QAAQ,CAAC,EAAE,CAAC;YAC/D,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,CACL,QAAQ,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,QAAuB,EAAE,QAAuB;IACpE,IACE,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW;QAC7C,QAAQ,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,EACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,iBAAiB,GAAG,QAA0B,CAAC;IACrD,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,CAAC,CAAC,iBAAiB,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;QAC5C,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],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0B,CAAC;IACrD,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,CAAC,CAAC,iBAAiB,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;QAC5C,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
@@ -57,6 +57,7 @@ export declare class PopupButton extends React.PureComponent<PopupButtonProps, P
|
|
|
57
57
|
export declare function PopupContent(props: CommonDivProps): React.JSX.Element;
|
|
58
58
|
/** Properties for [[PopupOkCancelButtons]] component
|
|
59
59
|
* @alpha
|
|
60
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof PopupOkCancelButtons>`
|
|
60
61
|
*/
|
|
61
62
|
export interface OkCancelProps {
|
|
62
63
|
onOk: (event: React.MouseEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrE;;GAEG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,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AAY,SAAQ,KAAK,CAAC,aAAa,CAClD,gBAAgB,EAChB,gBAAgB,CACjB;IACC,OAAO,CAAC,UAAU,CAAqC;IAEvD,SAAyB,KAAK,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAExD;IAEc,iBAAiB;IAKjC,OAAO,CAAC,YAAY,CAKlB;IAEK,UAAU;IAIjB,OAAO,CAAC,WAAW,CAMjB;IAEF,OAAO,CAAC,cAAc,CAWpB;IAEc,MAAM,IAAI,KAAK,CAAC,SAAS;CAoE1C;AAED;;GAEG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,qBAGjD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AAEH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,qBA+BxD"}
|
|
@@ -79,6 +79,7 @@ export function PopupContent(props) {
|
|
|
79
79
|
/** OK/Cancel Buttons
|
|
80
80
|
* @alpha
|
|
81
81
|
*/
|
|
82
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
82
83
|
export function PopupOkCancelButtons(props) {
|
|
83
84
|
const { translate } = useTranslation();
|
|
84
85
|
return (React.createElement("div", { className: "components-popup-bottom-buttons" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MA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,EAAC,iCAAiC,GAAG,CAAC;AAC5E,CAAC;AAUD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,4BAA4B,CAC7B,iBACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,EAC7B,OAAO,EAAE,KAAK,CAAC,IAAI;YAGnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,YAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAGvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n portalTarget={\n this._buttonRef.current?.ownerDocument.querySelector(\n \".uifw-configurableui-portalContainer\"\n ) ?? undefined\n }\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line deprecation/deprecation\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AA2CxD;;GAEG;AACH,M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ACW,4BAA4B,EACxC,SAAS,EAAC,KAAK,EACf,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,EAC7B,OAAO,EAAE,KAAK,CAAC,IAAI;YAGnB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,YAAY,OAAG,GAAI,CAC7B;QACT,oBAAC,MAAM,IACL,SAAS,EAAE,UAAU,CACnB,+BAA+B,EAC/B,gCAAgC,CACjC,iBACW,gCAAgC,EAC5C,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,KAAK,CAAC,QAAQ;YAGvB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI,CAC1B,CACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./PopupButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonDivProps, CommonProps } from \"@itwin/core-react\";\nimport { Div, Icon, Popup } from \"@itwin/core-react\";\nimport { Button } from \"@itwin/itwinui-react\";\nimport {\n SvgCheckmark,\n SvgChevronDown,\n SvgRemove,\n} from \"@itwin/itwinui-icons-react\";\nimport { useTranslation } from \"../l10n/useTranslation\";\n\n/** Properties for [[PopupButton]] component\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PopupButtonProps extends CommonProps {\n /** Label to display in click area. */\n label?: string | React.ReactNode;\n /* Placeholder text used when there is no label yet */\n placeholder?: string;\n /** Contents of the popup */\n children: React.ReactNode;\n /** Title to display as tooltip. */\n title?: string;\n\n /** Set focus to popup - default is to set focus */\n moveFocus?: boolean;\n /** Element to receive focus, specified by React.RefObject or CSS selector string. If undefined and moveFocus is true then focus is moved to first focusable element. */\n focusTarget?: React.RefObject<HTMLElement> | string;\n\n /** Show or hide the box shadow (defaults to false) */\n showShadow?: boolean;\n /** Show or hide the arrow (defaults to false) */\n showArrow?: boolean;\n /** Indicates whether to set focus to the input element */\n setFocus?: boolean;\n /** Indicates whether to close the popup when Enter is pressed (defaults to true) */\n closeOnEnter?: boolean;\n\n /** Listens for click events on button area */\n onClick?: (event: React.MouseEvent) => void;\n /** Listens for popup close events */\n onClose?: () => void;\n /** Listens for Enter key in popup */\n onEnter?: () => void;\n}\n\n/** @internal */\ninterface PopupButtonState {\n showPopup: boolean;\n}\n\n/** PopupButton React component that is a button and property editor popup host\n * @alpha\n */\nexport class PopupButton extends React.PureComponent<\n PopupButtonProps,\n PopupButtonState\n> {\n private _buttonRef = React.createRef<HTMLDivElement>();\n\n public override readonly state: Readonly<PopupButtonState> = {\n showPopup: false,\n };\n\n public override componentDidMount() {\n if (this.props.setFocus && this._buttonRef.current)\n this._buttonRef.current.focus();\n }\n\n private _togglePopup = (event: React.MouseEvent) => {\n this.setState(\n (prevState) => ({ showPopup: !prevState.showPopup }),\n () => this.props.onClick && this.props.onClick(event)\n );\n };\n\n public closePopup() {\n this._closePopup();\n }\n\n private _closePopup = () => {\n this.setState({ showPopup: false }, () => {\n this.props.onClose && this.props.onClose();\n\n if (this._buttonRef.current) this._buttonRef.current.focus();\n });\n };\n\n private _handleKeyDown = (event: React.KeyboardEvent) => {\n if (\n (event.key === Key.ArrowDown.valueOf() ||\n event.key === \" \" ||\n event.key === Key.Enter.valueOf()) &&\n !this.state.showPopup\n ) {\n event.preventDefault();\n event.stopPropagation();\n this.setState({ showPopup: true });\n }\n };\n\n public override render(): React.ReactNode {\n const showArrow = this.props.showArrow ?? false;\n const showShadow = this.props.showShadow ?? false;\n const moveFocus = this.props.moveFocus ?? true;\n const showPlaceholder =\n this.props.label === undefined && this.props.placeholder !== undefined;\n\n const classNames = classnames(\n \"components-popup-button\",\n this.state.showPopup && \"components-popup-expanded\"\n );\n\n const valueClassNames = classnames(\n \"components-popup-button-value\",\n showPlaceholder && \"components-popup-button-placeholder\"\n );\n\n return (\n <div className={this.props.className}>\n <div\n className={classNames}\n onClick={this._togglePopup}\n onKeyDown={this._handleKeyDown}\n data-testid=\"components-popup-button\"\n tabIndex={0}\n ref={this._buttonRef}\n title={this.props.title}\n role=\"button\"\n >\n <div className={valueClassNames}>\n {this.props.label || this.props.placeholder}\n </div>\n <div className={\"components-popup-button-arrow\"}>\n <div\n className={classnames(\n \"components-popup-button-arrow-icon\",\n \"icon\"\n )}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgChevronDown />} />\n </div>\n </div>\n </div>\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Popup\n className=\"components-popup-button-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.Bottom}\n onClose={this._closePopup}\n onEnter={this.props.onEnter}\n closeOnEnter={this.props.closeOnEnter}\n target={this._buttonRef.current}\n showArrow={showArrow}\n showShadow={showShadow}\n moveFocus={moveFocus}\n focusTarget={this.props.focusTarget}\n portalTarget={\n this._buttonRef.current?.ownerDocument.querySelector(\n \".uifw-configurableui-portalContainer\"\n ) ?? undefined\n }\n >\n {this.props.children}\n </Popup>\n </div>\n );\n }\n}\n\n/** Popup content with padding\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function PopupContent(props: CommonDivProps) {\n // eslint-disable-next-line deprecation/deprecation\n return <Div {...props} mainClassName=\"components-editor-popup-content\" />;\n}\n\n/** Properties for [[PopupOkCancelButtons]] component\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof PopupOkCancelButtons>`\n */\nexport interface OkCancelProps {\n onOk: (event: React.MouseEvent) => void;\n onCancel: (event: React.MouseEvent) => void;\n}\n\n/** OK/Cancel Buttons\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function PopupOkCancelButtons(props: OkCancelProps) {\n const { translate } = useTranslation();\n return (\n <div className=\"components-popup-bottom-buttons\">\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-ok-button\"\n )}\n data-testid=\"components-popup-ok-button\"\n styleType=\"cta\"\n title={translate(\"dialog.ok\")}\n onClick={props.onOk}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgCheckmark />} />\n </Button>\n <Button\n className={classnames(\n \"components-popup-large-button\",\n \"components-popup-cancel-button\"\n )}\n data-testid=\"components-popup-cancel-button\"\n title={translate(\"dialog.cancel\")}\n onClick={props.onCancel}\n >\n {/* eslint-disable-next-line deprecation/deprecation */}\n <Icon iconSpec={<SvgRemove />} />\n </Button>\n </div>\n );\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import type { PropertyData } from "../propertygrid/PropertyDataProvider";
|
|
|
7
7
|
import { Orientation } from "../common/Orientation";
|
|
8
8
|
/** Properties for [[FavoritePropertyList]] React component
|
|
9
9
|
* @alpha
|
|
10
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof FavoritePropertyList>`
|
|
10
11
|
*/
|
|
11
12
|
export interface FavoritePropertyListProps {
|
|
12
13
|
propertyData: PropertyData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"FavoritePropertyList.d.ts","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,YAAY,CAAC;IAC3B,4BAA4B,CAAC,EAAE,4BAA4B,CAAC;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AAEH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,4BAyBpE"}
|
|
@@ -13,6 +13,7 @@ import { Orientation } from "../common/Orientation";
|
|
|
13
13
|
/** Favorite Property List React component
|
|
14
14
|
* @alpha
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
export function FavoritePropertyList(props) {
|
|
17
18
|
const [listWidth, setListWidth] = React.useState();
|
|
18
19
|
const onListResize = React.useCallback(setListWidth, [setListWidth]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertyList.js","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"FavoritePropertyList.js","sourceRoot":"","sources":["../../../../src/components-react/favorite/FavoritePropertyList.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAYpD;;GAEG;AACH,mDAAmD;AACnD,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IACvE,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACtD,MAAM,4BAA4B,GAChC,KAAK,CAAC,4BAA4B;YAClC,4BAA4B,CAAC,cAAc,CAAC;QAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,WAAW,CAAC,UAAU,CAAC;QAChE,OAAO,CACL,6BAAK,SAAS,EAAC,mCAAmC;YAEhD,oBAAC,0BAA0B,IAAC,QAAQ,EAAE,YAAY,GAAI;YACrD,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,YAAY,IACX,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,EAC/C,WAAW,EAAE,CAAC,GAAG,CAAC,EAClB,4BAA4B,EAAE,4BAA4B,GAC1D,CACH,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Favorite\n */\n\nimport * as React from \"react\";\nimport { ResizableContainerObserver } from \"@itwin/core-react\";\nimport { PropertyValueRendererManager } from \"../properties/ValueRendererManager\";\nimport { PropertyList } from \"../propertygrid/component/PropertyList\";\nimport type { PropertyData } from \"../propertygrid/PropertyDataProvider\";\nimport { Orientation } from \"../common/Orientation\";\n\n/** Properties for [[FavoritePropertyList]] React component\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof FavoritePropertyList>`\n */\nexport interface FavoritePropertyListProps {\n propertyData: PropertyData;\n propertyValueRendererManager?: PropertyValueRendererManager;\n orientation?: Orientation;\n}\n\n/** Favorite Property List React component\n * @alpha\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function FavoritePropertyList(props: FavoritePropertyListProps) {\n const [listWidth, setListWidth] = React.useState<number | undefined>();\n const onListResize = React.useCallback(setListWidth, [setListWidth]);\n if (props.propertyData.records.Favorite !== undefined) {\n const propertyValueRendererManager =\n props.propertyValueRendererManager ??\n PropertyValueRendererManager.defaultManager;\n const orientation = props.orientation ?? Orientation.Horizontal;\n return (\n <div className=\"components-favorite-property-list\">\n {/* eslint-disable-next-line deprecation/deprecation */}\n <ResizableContainerObserver onResize={onListResize} />\n {listWidth ? (\n <PropertyList\n orientation={orientation}\n width={listWidth}\n properties={props.propertyData.records.Favorite}\n columnRatio={1 / 3}\n propertyValueRendererManager={propertyValueRendererManager}\n />\n ) : null}\n </div>\n );\n }\n return null;\n}\n"]}
|
|
@@ -47,6 +47,8 @@ export interface PropertyFilterBuilderRendererProps {
|
|
|
47
47
|
isDisabled?: boolean;
|
|
48
48
|
/** Controls whether the group operator is toggle-able. */
|
|
49
49
|
isGroupOperatorDisabled?: boolean;
|
|
50
|
+
/** Controls whether the last rule remaining in a group is deletable */
|
|
51
|
+
allowLastRuleDelete?: boolean;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
54
|
* Renderer for [[PropertyFilterBuilder]] component.
|
|
@@ -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AS,CAAC;IACrB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAUjE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,0BAA0B,CAAC;AAK5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EACV,4BAA4B,EAC5B,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,kCAAkC,EAAE,SAAS,GAAG,WAAW,CAAC,EACvE,6BAA6B;IAC/B,oDAAoD;IACpD,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;CACpD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,qBAuBtE;AAED;;;GAGG;AACH,MAAM,WAAW,kCAAkC;IACjD,kEAAkE;IAClE,SAAS,EAAE,8BAA8B,CAAC;IAC1C,6DAA6D;IAC7D,OAAO,EAAE,4BAA4B,CAAC;IACtC,+DAA+D;IAC/D,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjE,kDAAkD;IAClD,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE,sCAAsC,KAC1C,KAAK,CAAC,SAAS,CAAC;IACrB,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,2CAA2C,KAC/C,KAAK,CAAC,SAAS,CAAC;IACrB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACrD;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAID;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,qBA+C1C"}
|
|
@@ -33,7 +33,7 @@ const ROOT_GROUP_PATH = [];
|
|
|
33
33
|
* @beta
|
|
34
34
|
*/
|
|
35
35
|
export function PropertyFilterBuilderRenderer(props) {
|
|
36
|
-
const { rootGroup, actions, properties, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled, isGroupOperatorDisabled, } = props;
|
|
36
|
+
const { rootGroup, actions, properties, onRulePropertySelected, ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled, isGroupOperatorDisabled, allowLastRuleDelete, } = props;
|
|
37
37
|
const contextValue = React.useMemo(() => ({
|
|
38
38
|
actions,
|
|
39
39
|
properties,
|
|
@@ -47,6 +47,6 @@ export function PropertyFilterBuilderRenderer(props) {
|
|
|
47
47
|
}), [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]);
|
|
48
48
|
return (React.createElement(PropertyFilterBuilderRuleRenderingContext.Provider, { value: renderingContextValue },
|
|
49
49
|
React.createElement(PropertyFilterBuilderContext.Provider, { value: contextValue },
|
|
50
|
-
React.createElement(PropertyFilterBuilderRuleGroupRenderer, { path: ROOT_GROUP_PATH, group: rootGroup, isGroupOperatorDisabled: isGroupOperatorDisabled }))));
|
|
50
|
+
React.createElement(PropertyFilterBuilderRuleGroupRenderer, { path: ROOT_GROUP_PATH, group: rootGroup, isGroupOperatorDisabled: isGroupOperatorDisabled, allowLastRuleDelete: allowLastRuleDelete }))));
|
|
51
51
|
}
|
|
52
52
|
//# sourceMappingURL=FilterBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,4BAA4B,EAC5B,yCAAyC,GAC1C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sCAAsC,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAmB9B;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,wBAAwB,CAAC;QACtD,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAC1B,GAAG,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACpC,CAAC,SAAS,CAAC,CACZ,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAClD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,6BAA6B,OACxB,KAAK,EACT,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterBuilder.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilder.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EACL,4BAA4B,EAC5B,yCAAyC,GAC1C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sCAAsC,EAAE,MAAM,0BAA0B,CAAC;AAGlF,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAmB9B;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACrE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,wBAAwB,CAAC;QACtD,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAC1B,GAAG,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,EACpC,CAAC,SAAS,CAAC,CACZ,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAClD,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IAE9B,OAAO,CACL,oBAAC,6BAA6B,OACxB,KAAK,EACT,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;AACJ,CAAC;AAqCD,MAAM,eAAe,GAAa,EAAE,CAAC;AAErC;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,KAAyC;IAEzC,MAAM,EACJ,SAAS,EACT,OAAO,EACP,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,uBAAuB,EACvB,mBAAmB,GACpB,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU;QACV,sBAAsB;KACvB,CAAC,EACF,CAAC,OAAO,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAC9C,CAAC;IACF,MAAM,qBAAqB,GACzB,KAAK,CAAC,OAAO,CACX,GAAG,EAAE,CAAC,CAAC;QACL,oBAAoB;QACpB,iBAAiB;QACjB,gBAAgB;QAChB,UAAU;KACX,CAAC,EACF,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,CAAC,CACxE,CAAC;IACJ,OAAO,CACL,oBAAC,yCAAyC,CAAC,QAAQ,IACjD,KAAK,EAAE,qBAAqB;QAE5B,oBAAC,4BAA4B,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;YACxD,oBAAC,sCAAsC,IACrC,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,SAAS,EAChB,uBAAuB,EAAE,uBAAuB,EAChD,mBAAmB,EAAE,mBAAmB,GACxC,CACoC,CACW,CACtD,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyFilterBuilder\n */\n\nimport * as React from \"react\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport type {\n PropertyFilterBuilderContextProps,\n PropertyFilterBuilderRuleRenderingContextProps,\n} from \"./FilterBuilderContext\";\nimport {\n PropertyFilterBuilderContext,\n PropertyFilterBuilderRuleRenderingContext,\n} from \"./FilterBuilderContext\";\nimport { PropertyFilterBuilderRuleGroupRenderer } from \"./FilterBuilderRuleGroup\";\nimport type { PropertyFilterBuilderRuleOperatorProps } from \"./FilterBuilderRuleOperator\";\nimport type { PropertyFilterBuilderRuleValueRendererProps } from \"./FilterBuilderRuleValue\";\nimport {\n buildPropertyFilter,\n usePropertyFilterBuilder,\n} from \"./FilterBuilderState\";\nimport type { PropertyFilter } from \"./Types\";\nimport type {\n PropertyFilterBuilderActions,\n PropertyFilterBuilderRuleGroup,\n UsePropertyFilterBuilderProps,\n} from \"./FilterBuilderState\";\n\n/**\n * Props for [[PropertyFilterBuilder]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderProps\n extends Omit<PropertyFilterBuilderRendererProps, \"actions\" | \"rootGroup\">,\n UsePropertyFilterBuilderProps {\n /** Callback that is invoked when filter changes. */\n onFilterChanged: (filter?: PropertyFilter) => void;\n}\n\n/**\n * Component for building complex filters. It allows to create filter rules or rule groups based on provided list of properties.\n * @beta\n */\nexport function PropertyFilterBuilder(props: PropertyFilterBuilderProps) {\n const { initialFilter, onFilterChanged } = props;\n const { actions, rootGroup } = usePropertyFilterBuilder({\n initialFilter,\n });\n\n const firstRender = React.useRef(true);\n const filter = React.useMemo(\n () => buildPropertyFilter(rootGroup),\n [rootGroup]\n );\n React.useEffect(() => {\n if (!firstRender.current) onFilterChanged(filter);\n firstRender.current = false;\n }, [filter, onFilterChanged]);\n\n return (\n <PropertyFilterBuilderRenderer\n {...props}\n actions={actions}\n rootGroup={rootGroup}\n />\n );\n}\n\n/**\n * Props for [[PropertyFilterBuilderRenderer]] component.\n * @beta\n */\nexport interface PropertyFilterBuilderRendererProps {\n /** Root group of rules in [[PropertyFilterBuilder]] component. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n /** Actions for modifying [[PropertyFilterBuilder]] state. */\n actions: PropertyFilterBuilderActions;\n /** List of properties available to be used in filter rules. */\n properties: PropertyDescription[];\n /** Callback that is invoked when property is selected in any rule. */\n onRulePropertySelected?: (property: PropertyDescription) => void;\n /** Custom renderer for rule operator selector. */\n ruleOperatorRenderer?: (\n props: PropertyFilterBuilderRuleOperatorProps\n ) => React.ReactNode;\n /** Custom renderer for rule value input. */\n ruleValueRenderer?: (\n props: PropertyFilterBuilderRuleValueRendererProps\n ) => React.ReactNode;\n /** Custom renderer for property selector in rule. */\n propertyRenderer?: (name: string) => React.ReactNode;\n /** Specifies how deep rule groups can be nested.\n * @deprecated in 4.9.0. Nesting is no longer supported moving forward.\n */\n ruleGroupDepthLimit?: number;\n /** Specifies whether component is disabled or not. */\n isDisabled?: boolean;\n /** Controls whether the group operator is toggle-able. */\n isGroupOperatorDisabled?: boolean;\n /** Controls whether the last rule remaining in a group is deletable */\n allowLastRuleDelete?: boolean;\n}\n\nconst ROOT_GROUP_PATH: string[] = [];\n\n/**\n * Renderer for [[PropertyFilterBuilder]] component.\n * @beta\n */\nexport function PropertyFilterBuilderRenderer(\n props: PropertyFilterBuilderRendererProps\n) {\n const {\n rootGroup,\n actions,\n properties,\n onRulePropertySelected,\n ruleOperatorRenderer,\n ruleValueRenderer,\n propertyRenderer,\n isDisabled,\n isGroupOperatorDisabled,\n allowLastRuleDelete,\n } = props;\n\n const contextValue = React.useMemo<PropertyFilterBuilderContextProps>(\n () => ({\n actions,\n properties,\n onRulePropertySelected,\n }),\n [actions, properties, onRulePropertySelected]\n );\n const renderingContextValue =\n React.useMemo<PropertyFilterBuilderRuleRenderingContextProps>(\n () => ({\n ruleOperatorRenderer,\n ruleValueRenderer,\n propertyRenderer,\n isDisabled,\n }),\n [ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled]\n );\n return (\n <PropertyFilterBuilderRuleRenderingContext.Provider\n value={renderingContextValue}\n >\n <PropertyFilterBuilderContext.Provider value={contextValue}>\n <PropertyFilterBuilderRuleGroupRenderer\n path={ROOT_GROUP_PATH}\n group={rootGroup}\n isGroupOperatorDisabled={isGroupOperatorDisabled}\n allowLastRuleDelete={allowLastRuleDelete}\n />\n </PropertyFilterBuilderContext.Provider>\n </PropertyFilterBuilderRuleRenderingContext.Provider>\n );\n}\n"]}
|
|
@@ -15,6 +15,8 @@ export interface PropertyFilterBuilderRuleRendererProps {
|
|
|
15
15
|
rule: PropertyFilterBuilderRule;
|
|
16
16
|
/** Function to add rule to group */
|
|
17
17
|
onRuleAdded: () => void;
|
|
18
|
+
/** Boolean to allow last rule to be removed */
|
|
19
|
+
allowLastRuleDelete?: boolean;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Component that renders single rule in [[PropertyFilterBuilder]] component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRule.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD,6DAA6D;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,yBAAyB,CAAC;IAChC,oCAAoC;IACpC,WAAW,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterBuilderRule.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE;;;GAGG;AACH,MAAM,WAAW,sCAAsC;IACrD,6DAA6D;IAC7D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,yBAAyB,CAAC;IAChC,oCAAoC;IACpC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,+CAA+C;IAC/C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,sCAAsC,qBAoH9C"}
|
|
@@ -20,7 +20,7 @@ import { PropertyFilterBuilderToolbar } from "./FilterBuilderToolbar";
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export function PropertyFilterBuilderRuleRenderer(props) {
|
|
23
|
-
const { path, rule, onRuleAdded } = props;
|
|
23
|
+
const { path, rule, onRuleAdded, allowLastRuleDelete } = props;
|
|
24
24
|
const { properties, actions, onRulePropertySelected } = React.useContext(PropertyFilterBuilderContext);
|
|
25
25
|
const { ruleOperatorRenderer, ruleValueRenderer, propertyRenderer, isDisabled, } = React.useContext(PropertyFilterBuilderRuleRenderingContext);
|
|
26
26
|
const { property, operator, value } = rule;
|
|
@@ -37,7 +37,7 @@ export function PropertyFilterBuilderRuleRenderer(props) {
|
|
|
37
37
|
const onRuleValueChange = React.useCallback((newValue) => {
|
|
38
38
|
actions.setRuleValue(path, newValue);
|
|
39
39
|
}, [path, actions]);
|
|
40
|
-
const removeRule = () => actions.removeItem(path);
|
|
40
|
+
const removeRule = () => actions.removeItem(path, allowLastRuleDelete);
|
|
41
41
|
const handleRuleAdded = () => {
|
|
42
42
|
actions.addItem([], "RULE");
|
|
43
43
|
onRuleAdded();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRule.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,4BAA4B,EAC5B,yCAAyC,GAC1C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yCAAyC,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EACL,oCAAoC,GAErC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterBuilderRule.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRule.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,4BAA4B,EAC5B,yCAAyC,GAC1C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,yCAAyC,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EACL,oCAAoC,GAErC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAiBtE;;;GAGG;AACH,MAAM,UAAU,iCAA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QAAQ,EAC/B,yBAAyB,EAAE,yBAAyB,EACpD,gBAAgB,EAAE,gBAAgB,EAClC,UAAU,EAAE,UAAU,GACtB;YACD,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;YAC1D,QAAQ,KAAK,SAAS;gBACvB,QAAQ,KAAK,SAAS;gBACtB,CAAC,oCAAoC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAChD,6BAAK,SAAS,EAAC,mBAAmB;gBAC/B,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC;gBACjC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACnB,oBAAC,IAAI;oBACH,oBAAC,cAAc,OAAG;oBAClB,oBAAC,IAAI,QAAE,IAAI,CAAC,YAAY,CAAQ,CAC3B,CACR,CAAC,CAAC,CAAC,IAAI,CACJ,CACP,CAAC,CAAC,CAAC,IAAI;YACR,oBAAC,4BAA4B,IAC3B,UAAU,EAAE,eAAe,EAC3B,QAAQ,EAAE,UAAU,GACpB,CACG,CACH,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyFilterBuilder\n */\n\nimport \"./FilterBuilderRule.scss\";\nimport * as React from \"react\";\nimport type { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { SvgStatusError } from \"@itwin/itwinui-icons-react\";\nimport { Flex, Text } from \"@itwin/itwinui-react\";\nimport {\n PropertyFilterBuilderContext,\n PropertyFilterBuilderRuleRenderingContext,\n} from \"./FilterBuilderContext\";\nimport { PropertyFilterBuilderRuleOperatorRenderer } from \"./FilterBuilderRuleOperator\";\nimport { PropertyFilterBuilderRuleProperty } from \"./FilterBuilderRuleProperty\";\nimport { PropertyFilterBuilderRuleValue } from \"./FilterBuilderRuleValue\";\nimport type { PropertyFilterBuilderRule } from \"./FilterBuilderState\";\nimport {\n isUnaryPropertyFilterBuilderOperator,\n type PropertyFilterBuilderRuleOperator,\n} from \"./Operators\";\nimport { PropertyFilterBuilderToolbar } from \"./FilterBuilderToolbar\";\n\n/**\n * Props for [[PropertyFilterBuilderRuleRenderer]] component.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleRendererProps {\n /** Path from [[PropertyFilterBuilder]] root to this rule. */\n path: string[];\n /** Rule to render. */\n rule: PropertyFilterBuilderRule;\n /** Function to add rule to group */\n onRuleAdded: () => void;\n /** Boolean to allow last rule to be removed */\n allowLastRuleDelete?: boolean;\n}\n\n/**\n * Component that renders single rule in [[PropertyFilterBuilder]] component.\n * @internal\n */\nexport function PropertyFilterBuilderRuleRenderer(\n props: PropertyFilterBuilderRuleRendererProps\n) {\n const { path, rule, onRuleAdded, allowLastRuleDelete } = props;\n const { properties, actions, onRulePropertySelected } = React.useContext(\n PropertyFilterBuilderContext\n );\n const {\n ruleOperatorRenderer,\n ruleValueRenderer,\n propertyRenderer,\n isDisabled,\n } = React.useContext(PropertyFilterBuilderRuleRenderingContext);\n const { property, operator, value } = rule;\n\n const onSelectedPropertyChanged = React.useCallback(\n (newProperty?: PropertyDescription) => {\n actions.setRuleProperty(path, newProperty);\n // invoke 'onRulePropertySelected' when new property is selected. There is no way to deselect property\n // so 'newProperty' will be 'undefined' only if selected property is no longer in 'properties' list.\n if (onRulePropertySelected && newProperty)\n onRulePropertySelected(newProperty);\n },\n [path, onRulePropertySelected, actions]\n );\n\n const onRuleOperatorChange = React.useCallback(\n (newOperator: PropertyFilterBuilderRuleOperator) => {\n actions.setRuleOperator(path, newOperator);\n },\n [path, actions]\n );\n\n const onRuleValueChange = React.useCallback(\n (newValue: PropertyValue) => {\n actions.setRuleValue(path, newValue);\n },\n [path, actions]\n );\n\n const removeRule = () => actions.removeItem(path, allowLastRuleDelete);\n const handleRuleAdded = () => {\n actions.addItem([], \"RULE\");\n onRuleAdded();\n };\n\n const operatorRenderer = React.useCallback(\n (prop: PropertyDescription) => {\n if (ruleOperatorRenderer)\n return ruleOperatorRenderer({\n property: prop,\n operator,\n onChange: onRuleOperatorChange,\n });\n return (\n <PropertyFilterBuilderRuleOperatorRenderer\n property={prop}\n onChange={onRuleOperatorChange}\n operator={operator}\n />\n );\n },\n [operator, ruleOperatorRenderer, onRuleOperatorChange]\n );\n\n const valueRenderer = React.useCallback(\n (prop: PropertyDescription, op: PropertyFilterBuilderRuleOperator) => {\n if (ruleValueRenderer)\n return ruleValueRenderer({\n property: prop,\n value,\n onChange: onRuleValueChange,\n operator: op,\n });\n return (\n <PropertyFilterBuilderRuleValue\n property={prop}\n onChange={onRuleValueChange}\n value={value}\n operator={op}\n />\n );\n },\n [value, ruleValueRenderer, onRuleValueChange]\n );\n\n return (\n <div className=\"fb-component-row\">\n <Flex className=\"fb-row-container\" gap=\"s\" alignItems=\"flex-start\">\n <PropertyFilterBuilderRuleProperty\n properties={properties}\n selectedProperty={rule.property}\n onSelectedPropertyChanged={onSelectedPropertyChanged}\n propertyRenderer={propertyRenderer}\n isDisabled={isDisabled}\n />\n {property !== undefined ? operatorRenderer(property) : null}\n {property !== undefined &&\n operator !== undefined &&\n !isUnaryPropertyFilterBuilderOperator(operator) ? (\n <div className=\"fb-property-value\">\n {valueRenderer(property, operator)}\n {rule.errorMessage ? (\n <Flex>\n <SvgStatusError />\n <Text>{rule.errorMessage}</Text>\n </Flex>\n ) : null}\n </div>\n ) : null}\n <PropertyFilterBuilderToolbar\n onAddChild={handleRuleAdded}\n onDelete={removeRule}\n />\n </Flex>\n </div>\n );\n}\n"]}
|
|
@@ -16,6 +16,8 @@ export interface PropertyFilterBuilderRuleGroupRendererProps {
|
|
|
16
16
|
group: PropertyFilterBuilderRuleGroup;
|
|
17
17
|
/** Controls whether the group operator is toggle-able. */
|
|
18
18
|
isGroupOperatorDisabled?: boolean;
|
|
19
|
+
/** Controls whether the last rule remaining in a group is deletable */
|
|
20
|
+
allowLastRuleDelete?: boolean;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Component that renders group of rules in [[PropertyFilterBuilder]] component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderRuleGroup.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleGroup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,8BAA8B,EAE/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAGnE;;;GAGG;AACH,MAAM,WAAW,2CAA2C;IAC1D,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,8BAA8B,CAAC;IACtC,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FilterBuilderRuleGroup.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderRuleGroup.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,+BAA+B,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EACV,8BAA8B,EAE/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAGnE;;;GAGG;AACH,MAAM,WAAW,2CAA2C;IAC1D,mEAAmE;IACnE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,8BAA8B,CAAC;IACtC,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,2CAA2C,qBA2CnD;AAED;;;GAGG;AACH,MAAM,WAAW,2CAA2C;IAC1D,mCAAmC;IACnC,QAAQ,EAAE,GAAG,+BAA+B,EAAE,CAAC;IAC/C,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,QAAQ,EAAE,GAAG,+BAA+B,EAAE,KAAK,IAAI,CAAC;IACnE,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,2CAA2C,qBAcnD"}
|
|
@@ -17,7 +17,7 @@ import { PropertyFilterBuilderLogicalOperator } from "./FilterBuilderLogicalOper
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export function PropertyFilterBuilderRuleGroupRenderer(props) {
|
|
20
|
-
const { path, group, isGroupOperatorDisabled } = props;
|
|
20
|
+
const { path, group, isGroupOperatorDisabled, allowLastRuleDelete } = props;
|
|
21
21
|
const { actions } = React.useContext(PropertyFilterBuilderContext);
|
|
22
22
|
const { onRuleAdded, groupRef } = useRulePropertyFocus(group.items.length);
|
|
23
23
|
const onOperatorChange = React.useCallback((operator) => {
|
|
@@ -27,7 +27,7 @@ export function PropertyFilterBuilderRuleGroupRenderer(props) {
|
|
|
27
27
|
return (React.createElement(Flex, { ref: groupRef, style: { alignSelf: "flex-start" }, className: "fb-group", gap: "0px" },
|
|
28
28
|
showOperator ? (React.createElement(PropertyFilterBuilderRuleGroupOperator, { operator: group.operator, onChange: onOperatorChange, isGroupOperatorDisabled: isGroupOperatorDisabled })) : null,
|
|
29
29
|
React.createElement("div", { className: "fb-wrapper" }, group.items.map((item) => (React.createElement("div", { className: "fb-row", key: item.id },
|
|
30
|
-
React.createElement(PropertyFilterBuilderGroupOrRule, { path: path, item: item, onRuleAdded: onRuleAdded })))))));
|
|
30
|
+
React.createElement(PropertyFilterBuilderGroupOrRule, { path: path, item: item, onRuleAdded: onRuleAdded, allowLastRuleDelete: allowLastRuleDelete })))))));
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Component that renders [[PropertyFilterBuilderRuleGroup]] operator selector.
|
|
@@ -38,11 +38,11 @@ export function PropertyFilterBuilderRuleGroupOperator(props) {
|
|
|
38
38
|
return (React.createElement(Flex.Item, { alignSelf: "stretch" },
|
|
39
39
|
React.createElement(PropertyFilterBuilderLogicalOperator, { className: "fb-group-operator", operator: operator, onOperatorChange: onChange, isDisabled: isGroupOperatorDisabled })));
|
|
40
40
|
}
|
|
41
|
-
const PropertyFilterBuilderGroupOrRule = React.memo(function PropertyFilterBuilderGroupOrRule({ path, item, onRuleAdded, }) {
|
|
41
|
+
const PropertyFilterBuilderGroupOrRule = React.memo(function PropertyFilterBuilderGroupOrRule({ path, item, onRuleAdded, allowLastRuleDelete, }) {
|
|
42
42
|
const itemPath = [...path, item.id];
|
|
43
43
|
if (isPropertyFilterBuilderRuleGroup(item))
|
|
44
44
|
return (React.createElement(PropertyFilterBuilderRuleGroupRenderer, { path: itemPath, group: item }));
|
|
45
|
-
return (React.createElement(PropertyFilterBuilderRuleRenderer, { path: itemPath, rule: item, onRuleAdded: onRuleAdded }));
|
|
45
|
+
return (React.createElement(PropertyFilterBuilderRuleRenderer, { path: itemPath, rule: item, onRuleAdded: onRuleAdded, allowLastRuleDelete: allowLastRuleDelete }));
|
|
46
46
|
});
|
|
47
47
|
const useRulePropertyFocus = (currentGroupItemsLength) => {
|
|
48
48
|
const previousGroupItemsLength = React.useRef(0);
|