@itwin/components-react 3.0.0-dev.72 → 3.0.0-dev.73
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/lib/components-react/common/HighlightedText.d.ts +2 -2
- package/lib/components-react/common/HighlightedText.js +1 -1
- package/lib/components-react/common/HighlightedText.js.map +1 -1
- package/lib/components-react/common/HighlightingComponentProps.d.ts +2 -2
- package/lib/components-react/common/HighlightingComponentProps.js.map +1 -1
- package/lib/components-react/common/UseAsyncValue.d.ts +1 -1
- package/lib/components-react/common/UseAsyncValue.js +1 -1
- package/lib/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/components-react/editors/BooleanEditor.d.ts +2 -2
- package/lib/components-react/editors/BooleanEditor.js +2 -2
- package/lib/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.d.ts +2 -2
- package/lib/components-react/editors/EnumButtonGroupEditor.js +2 -2
- package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/components-react/editors/EnumEditor.d.ts +2 -2
- package/lib/components-react/editors/EnumEditor.js +2 -2
- package/lib/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.d.ts +2 -2
- package/lib/components-react/editors/ImageCheckBoxEditor.js +2 -2
- package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.d.ts +2 -2
- package/lib/components-react/editors/NumericInputEditor.js +2 -2
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.d.ts +7 -7
- package/lib/components-react/editors/PropertyEditorManager.js +4 -4
- package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/components-react/editors/SliderEditor.d.ts +2 -2
- package/lib/components-react/editors/SliderEditor.js +2 -2
- package/lib/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/components-react/editors/TextEditor.d.ts +1 -1
- package/lib/components-react/editors/TextEditor.js +1 -1
- package/lib/components-react/editors/TextEditor.js.map +1 -1
- package/lib/components-react/editors/TextareaEditor.d.ts +2 -2
- package/lib/components-react/editors/TextareaEditor.js +2 -2
- package/lib/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/components-react/editors/ThemedEnumEditor.d.ts +3 -3
- package/lib/components-react/editors/ThemedEnumEditor.d.ts.map +1 -1
- package/lib/components-react/editors/ThemedEnumEditor.js +3 -2
- package/lib/components-react/editors/ThemedEnumEditor.js.map +1 -1
- package/lib/components-react/editors/ToggleEditor.d.ts +2 -2
- package/lib/components-react/editors/ToggleEditor.js +2 -2
- package/lib/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/favorite/FavoritePropertiesRenderer.d.ts +1 -1
- package/lib/components-react/favorite/FavoritePropertiesRenderer.js +1 -1
- package/lib/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
- package/lib/components-react/filtering/FilteringInput.d.ts +1 -2
- package/lib/components-react/filtering/FilteringInput.d.ts.map +1 -1
- package/lib/components-react/filtering/FilteringInput.js +1 -1
- package/lib/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/components-react/inputs/ParsedInput.d.ts +2 -2
- package/lib/components-react/inputs/ParsedInput.js +1 -1
- package/lib/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/components-react/properties/renderers/ActionButtonList.d.ts +2 -2
- package/lib/components-react/properties/renderers/ActionButtonList.js +1 -1
- package/lib/components-react/properties/renderers/ActionButtonList.js.map +1 -1
- package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +0 -1
- package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts +5 -10
- package/lib/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts +1 -3
- package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.d.ts.map +1 -1
- package/lib/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.d.ts +1 -1
- package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +1 -1
- package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/components-react/selectable-content/SelectableContent.d.ts +5 -5
- package/lib/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/components-react/selectable-content/SelectableContent.js +3 -2
- package/lib/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/components-react/table/SimpleTableDataProvider.d.ts +2 -2
- package/lib/components-react/table/SimpleTableDataProvider.js +2 -2
- package/lib/components-react/table/SimpleTableDataProvider.js.map +1 -1
- package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.d.ts.map +1 -1
- package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js +1 -0
- package/lib/components-react/table/columnfiltering/data-grid-addons/AutoCompleteFilter.js.map +1 -1
- package/lib/components-react/table/component/Table.d.ts +4 -7
- package/lib/components-react/table/component/Table.d.ts.map +1 -1
- package/lib/components-react/table/component/Table.js.map +1 -1
- package/lib/components-react/toolbar/Item.d.ts +2 -2
- package/lib/components-react/toolbar/Item.js +1 -1
- package/lib/components-react/toolbar/Item.js.map +1 -1
- package/lib/components-react/toolbar/PopupItem.d.ts +2 -2
- package/lib/components-react/toolbar/PopupItem.js +1 -1
- package/lib/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/components-react/toolbar/PopupItemWithDrag.d.ts +2 -2
- package/lib/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/components-react/toolbar/Toolbar.d.ts +2 -2
- package/lib/components-react/toolbar/Toolbar.js +1 -1
- package/lib/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/components-react/toolbar/ToolbarWithOverflow.d.ts +6 -6
- package/lib/components-react/toolbar/ToolbarWithOverflow.js +3 -3
- package/lib/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/components-react/toolbar/utilities/Direction.d.ts +1 -1
- package/lib/components-react/toolbar/utilities/Direction.js +1 -1
- package/lib/components-react/toolbar/utilities/Direction.js.map +1 -1
- package/lib/components-react/tree/HighlightingEngine.d.ts +1 -1
- package/lib/components-react/tree/HighlightingEngine.js +1 -1
- package/lib/components-react/tree/HighlightingEngine.js.map +1 -1
- package/lib/components-react/tree/TreeDataProvider.d.ts +1 -1
- package/lib/components-react/tree/TreeDataProvider.js.map +1 -1
- package/package.json +15 -15
|
@@ -37,7 +37,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
|
37
37
|
const PropertyEditorManager_1 = require("./PropertyEditorManager");
|
|
38
38
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
39
39
|
/** ToggleEditor React component that is a property editor with checkbox input
|
|
40
|
-
* @
|
|
40
|
+
* @public
|
|
41
41
|
*/
|
|
42
42
|
class ToggleEditor extends React.PureComponent {
|
|
43
43
|
constructor() {
|
|
@@ -140,7 +140,7 @@ class ToggleEditor extends React.PureComponent {
|
|
|
140
140
|
exports.ToggleEditor = ToggleEditor;
|
|
141
141
|
/** Toggle Property Editor registered for the "bool" and "boolean" type names and "toggle" editor name.
|
|
142
142
|
* It uses the [[ToggleEditor]] React component.
|
|
143
|
-
* @
|
|
143
|
+
* @public
|
|
144
144
|
*/
|
|
145
145
|
class TogglePropertyEditor extends PropertyEditorManager_1.PropertyEditorBase {
|
|
146
146
|
// istanbul ignore next
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/ToggleEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;G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IAC1D,uBAAuB;IACvB,IAAoB,oBAAoB;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,oBAAC,YAAY,OAAG,CAAC;IAC1B,CAAC;CACF;AATD,oDASC;AAED,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,IAAI,EAAE,oBAAoB,EAAE,oCAAmB,CAAC,MAAM,CAAC,CAAC;AAC/G,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,oBAAoB,EAAE,oCAAmB,CAAC,MAAM,CAAC,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 \"./ToggleEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface ToggleEditorState {\n toggleValue: boolean;\n isDisabled?: boolean;\n}\n\n/** ToggleEditor React component that is a property editor with checkbox input\n * @
|
|
1
|
+
{"version":3,"file":"ToggleEditor.js","sourceRoot":"","sources":["../../../src/components-react/editors/ToggleEditor.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA6B;AAC7B,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAmH;AAEnH,mEAAoF;AACpF,wDAAoD;AAQpD;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,aAAqD;IAA7F;;QACU,eAAU,GAAG,KAAK,CAAC;QACnB,kBAAa,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mB,CAAC,MAAM,CAAC,CAAC;AAC/G,6CAAqB,CAAC,cAAc,CAAC,kCAAiB,CAAC,OAAO,EAAE,oBAAoB,EAAE,oCAAmB,CAAC,MAAM,CAAC,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 \"./ToggleEditor.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { PropertyValue, PropertyValueFormat, StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { PropertyEditorProps, TypeEditor } from \"./EditorContainer\";\nimport { PropertyEditorBase, PropertyEditorManager } from \"./PropertyEditorManager\";\nimport { ToggleSwitch } from \"@itwin/itwinui-react\";\n\n/** @internal */\ninterface ToggleEditorState {\n toggleValue: boolean;\n isDisabled?: boolean;\n}\n\n/** ToggleEditor React component that is a property editor with checkbox input\n * @public\n */\nexport class ToggleEditor extends React.PureComponent<PropertyEditorProps, ToggleEditorState> implements TypeEditor {\n private _isMounted = false;\n private _inputElement = React.createRef<HTMLInputElement>();\n\n /** @internal */\n public override readonly state: Readonly<ToggleEditorState> = {\n toggleValue: false,\n isDisabled: false,\n };\n\n public async getPropertyValue(): Promise<PropertyValue | undefined> {\n const record = this.props.propertyRecord;\n let propertyValue: PropertyValue | undefined;\n\n // istanbul ignore else\n if (record && record.value.valueFormat === PropertyValueFormat.Primitive) {\n propertyValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: this.state.toggleValue,\n displayValue: \"\",\n };\n }\n return propertyValue;\n }\n\n public get htmlElement(): HTMLElement | null {\n return this._inputElement.current;\n }\n\n public get hasFocus(): boolean {\n return document.activeElement === this._inputElement.current;\n }\n\n private _updateToggleValue = (e: React.ChangeEvent<HTMLInputElement>): any => {\n // istanbul ignore else\n if (this._isMounted) {\n // istanbul ignore else\n if (this._isMounted) {\n let toggleValue: boolean = false;\n\n // istanbul ignore if\n if (e.target.checked !== undefined) // Needed for unit test environment\n toggleValue = e.target.checked;\n else {\n // istanbul ignore else\n if (e.target.value !== undefined && typeof e.target.value === \"boolean\")\n toggleValue = e.target.value;\n }\n\n this.setState({\n toggleValue,\n }, async () => {\n // istanbul ignore else\n if (this.props.propertyRecord && this.props.onCommit) {\n const propertyValue = await this.getPropertyValue();\n // istanbul ignore else\n if (propertyValue !== undefined) {\n this.props.onCommit({ propertyRecord: this.props.propertyRecord, newValue: propertyValue });\n }\n }\n });\n }\n }\n };\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n /** @internal */\n public override componentWillUnmount() {\n this._isMounted = false;\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyEditorProps) {\n if (this.props.propertyRecord !== prevProps.propertyRecord) {\n this.setStateFromProps(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n }\n\n private async setStateFromProps() {\n const { propertyRecord } = this.props;\n let toggleValue = false;\n let isDisabled = false;\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.value.valueFormat === PropertyValueFormat.Primitive) {\n const primitiveValue = propertyRecord.value.value;\n toggleValue = primitiveValue as boolean;\n }\n\n // istanbul ignore else\n if (propertyRecord && propertyRecord.isDisabled)\n isDisabled = propertyRecord.isDisabled;\n\n // istanbul ignore else\n if (this._isMounted)\n this.setState({ toggleValue, isDisabled });\n }\n\n /** @internal */\n public override render() {\n const className = classnames(\"components-cell-editor\", \"components-toggle-editor\", this.props.className);\n const isChecked = this.state.toggleValue;\n const isDisabled = !!this.state.isDisabled;\n\n return (\n <ToggleSwitch\n ref={this._inputElement}\n onBlur={this.props.onBlur}\n className={className}\n style={this.props.style}\n checked={isChecked}\n disabled={isDisabled}\n onChange={this._updateToggleValue}\n data-testid=\"components-toggle-editor\"\n setFocus={this.props.setFocus} />\n );\n }\n}\n\n/** Toggle Property Editor registered for the \"bool\" and \"boolean\" type names and \"toggle\" editor name.\n * It uses the [[ToggleEditor]] React component.\n * @public\n */\nexport class TogglePropertyEditor extends PropertyEditorBase {\n // istanbul ignore next\n public override get containerHandlesBlur(): boolean {\n return false;\n }\n\n public get reactNode(): React.ReactNode {\n return <ToggleEditor />;\n }\n}\n\nPropertyEditorManager.registerEditor(StandardTypeNames.Bool, TogglePropertyEditor, StandardEditorNames.Toggle);\nPropertyEditorManager.registerEditor(StandardTypeNames.Boolean, TogglePropertyEditor, StandardEditorNames.Toggle);\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Orientation } from "@itwin/core-react";
|
|
5
5
|
import { PropertyData } from "../propertygrid/PropertyDataProvider";
|
|
6
6
|
/** Renderer for Favorite Property List
|
|
7
|
-
* @
|
|
7
|
+
* @public
|
|
8
8
|
*/
|
|
9
9
|
export declare class FavoritePropertiesRenderer {
|
|
10
10
|
hasFavorites(propertyData: PropertyData): boolean;
|
|
@@ -31,7 +31,7 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const ReactDOM = __importStar(require("react-dom"));
|
|
32
32
|
const FavoritePropertyList_1 = require("./FavoritePropertyList");
|
|
33
33
|
/** Renderer for Favorite Property List
|
|
34
|
-
* @
|
|
34
|
+
* @public
|
|
35
35
|
*/
|
|
36
36
|
class FavoritePropertiesRenderer {
|
|
37
37
|
hasFavorites(propertyData) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FavoritePropertiesRenderer.js","sourceRoot":"","sources":["../../../src/components-react/favorite/FavoritePropertiesRenderer.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,oDAAsC;AAGtC,iEAA8D;AAE9D;;GAEG;AACH,MAAa,0BAA0B;IAE9B,YAAY,CAAC,YAA0B;QAC5C,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC;IACrD,CAAC;IAEM,eAAe,CAAC,YAA0B,EAAE,WAAyB;QAC1E,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,2CAAoB,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACrG,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAXD,gEAWC","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 * as ReactDOM from \"react-dom\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { PropertyData } from \"../propertygrid/PropertyDataProvider\";\nimport { FavoritePropertyList } from \"./FavoritePropertyList\";\n\n/** Renderer for Favorite Property List\n * @
|
|
1
|
+
{"version":3,"file":"FavoritePropertiesRenderer.js","sourceRoot":"","sources":["../../../src/components-react/favorite/FavoritePropertiesRenderer.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,oDAAsC;AAGtC,iEAA8D;AAE9D;;GAEG;AACH,MAAa,0BAA0B;IAE9B,YAAY,CAAC,YAA0B;QAC5C,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC;IACrD,CAAC;IAEM,eAAe,CAAC,YAA0B,EAAE,WAAyB;QAC1E,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,2CAAoB,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACrG,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAXD,gEAWC","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 * as ReactDOM from \"react-dom\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { PropertyData } from \"../propertygrid/PropertyDataProvider\";\nimport { FavoritePropertyList } from \"./FavoritePropertyList\";\n\n/** Renderer for Favorite Property List\n * @public\n */\nexport class FavoritePropertiesRenderer {\n\n public hasFavorites(propertyData: PropertyData): boolean {\n return propertyData.records.Favorite !== undefined;\n }\n\n public renderFavorites(propertyData: PropertyData, orientation?: Orientation): HTMLElement | string {\n const div = document.createElement(\"div\");\n ReactDOM.render(React.createElement(FavoritePropertyList, { propertyData, orientation }, null), div);\n return div;\n }\n}\n"]}
|
|
@@ -31,7 +31,6 @@ export interface FilteringInputProps extends CommonProps {
|
|
|
31
31
|
onFilterClear: () => void;
|
|
32
32
|
/**
|
|
33
33
|
* Tells the component what is the status of filtering.
|
|
34
|
-
* @beta
|
|
35
34
|
*/
|
|
36
35
|
status: FilteringInputStatus;
|
|
37
36
|
/**
|
|
@@ -45,7 +44,7 @@ export interface FilteringInputProps extends CommonProps {
|
|
|
45
44
|
}
|
|
46
45
|
/**
|
|
47
46
|
* Enumeration of possible component contexts
|
|
48
|
-
* @
|
|
47
|
+
* @public
|
|
49
48
|
*/
|
|
50
49
|
export declare enum FilteringInputStatus {
|
|
51
50
|
/** Component is ready to filter */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringInput.d.ts","sourceRoot":"","sources":["../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,KAAK,KAAK,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AAM,EAAE,oBAAoB,CAAC;IAC7B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,mCAAmC;IACnC,aAAa,IAAA;IACb,gDAAgD;IAChD,mBAAmB,IAAA;IACnB,gDAAgD;IAChD,iBAAiB,IAAA;CAClB;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAC/F,OAAO,CAAC,aAAa,CAAuC;IAC5D,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,WAAW,CAAsC;gBAE7C,KAAK,EAAE,mBAAmB;IAStC,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,oBAAoB,CAU1B;IAEF,OAAO,CAAC,oBAAoB,CAI1B;IAEF,OAAO,CAAC,mBAAmB,CAIzB;IAEF,OAAO,CAAC,gBAAgB,CAUtB;IAEF,OAAO,CAAC,eAAe,CAKrB;IAEF,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,mBAAmB;IAMjD,MAAM;CAuCvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAClC,kDAAwD;AACxD,wDAA6C;AAC7C,kDAA+C;AAC/C,qDAAuE;AA2CvE;;;GAGG;AACH,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,mCAAmC;IACnC,iFAAa,CAAA;IACb,gDAAgD;IAChD,6FAAmB,CAAA;IACnB,gDAAgD;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IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,GAAI,CAAC,CAAC,CAAC,SAAS;oBACvE,MAAM,KAAK,oBAAoB,CAAC,mBAAmB,CAAC,CAAC;wBACpD,iEAAiE;wBACjE,8BAAM,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAClE,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,GAAI,CAAC,CAAC,CAAC,SAAS;oBACvE,MAAM,KAAK,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;wBAClD,iEAAiE;wBACjE,8BAAM,SAAS,EAAC,kDAAkD,EAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAClG,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,GAAI,CAAC,CAAC,CAAC,SAAS,CAClE,CACF,CACH,CACP,CAAC;IACJ,CAAC;CACF;AA9GD,wCA8GC","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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { CommonProps, UiCore } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { ResultSelector, ResultSelectorProps } from \"./ResultSelector\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n * @beta\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @beta\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<FilteringInputProps, FilteringInputState> {\n private _inputElement = React.createRef<HTMLInputElement>();\n private _searchLabel = UiCore.translate(\"general.search\");\n private _cancelLabel = UiCore.translate(\"dialog.cancel\");\n private _clearLabel = UiCore.translate(\"general.search\");\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current)\n this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter)\n return;\n\n if (!this.state.searchText)\n return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({ resultSelectorKey: state.resultSelectorKey + 1 }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n return (\n // TODO: What is filtering-input-preload-images?\n <div className={classnames(\"components-filtering-input\", \"filtering-input-preload-images\", this.props.className)}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput:placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={UiCore.translate(\"general.search\")} />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished && this.props.resultSelectorProps ?\n <ResultSelector key={this.state.resultSelectorKey} {...this.props.resultSelectorProps} /> : undefined}\n {status === FilteringInputStatus.ReadyToFilter ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"icon icon-search\" onClick={this._onSearchButtonClick}\n role=\"button\" tabIndex={-1} title={this._searchLabel} /> : undefined}\n {status === FilteringInputStatus.FilteringInProgress ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"icon icon-close\" onClick={this._onCancelButtonClick}\n role=\"button\" tabIndex={-1} title={this._cancelLabel} /> : undefined}\n {status === FilteringInputStatus.FilteringFinished ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"components-filtering-input-clear icon icon-close\" onClick={this._onClearButtonClick}\n role=\"button\" tabIndex={-1} title={this._clearLabel} /> : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAA+B;AAC/B,4DAAoC;AACpC,6CAA+B;AAC/B,6CAAkC;AAClC,kDAAwD;AACxD,wDAA6C;AAC7C,kDAA+C;AAC/C,qDAAuE;AA0CvE;;;GAGG;AACH,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,mCAAmC;IACnC,iFAAa,CAAA;IACb,gDAAgD;IAChD,6FAAmB,CAAA;IACnB,gDAAgD;IAChD,yFAAiB,CAAA;AACnB,CAAC,EAPW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAO/B;AAED;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK,CAAC,aAAuD;IAM/F,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,kBAAa,GAAG,KAAK,CAAC,SAAS,EAAoB,CAAC;QACpD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAClD,iBAAY,GAAG,mBAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;QACjD,gBAAW,GAAG,mBAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QAiBjD,yBAAoB,GAAG,GAAG,EAAE;YAClC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;gBAC1B,0DAA0D;gBAC1D,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,EAAE,KAAK,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IAAI,CAAC,WAAW,GAAI,CAAC,CAAC,CAAC,SAAS,CAClE,CACF,CACH,CACP,CAAC;IACJ,CAAC;CACF;AA9GD,wCA8GC","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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport { CommonProps, UiCore } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { ResultSelector, ResultSelectorProps } from \"./ResultSelector\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @public\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<FilteringInputProps, FilteringInputState> {\n private _inputElement = React.createRef<HTMLInputElement>();\n private _searchLabel = UiCore.translate(\"general.search\");\n private _cancelLabel = UiCore.translate(\"dialog.cancel\");\n private _clearLabel = UiCore.translate(\"general.search\");\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current)\n this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter)\n return;\n\n if (!this.state.searchText)\n return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({ resultSelectorKey: state.resultSelectorKey + 1 }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n return (\n // TODO: What is filtering-input-preload-images?\n <div className={classnames(\"components-filtering-input\", \"filtering-input-preload-images\", this.props.className)}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput:placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={UiCore.translate(\"general.search\")} />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished && this.props.resultSelectorProps ?\n <ResultSelector key={this.state.resultSelectorKey} {...this.props.resultSelectorProps} /> : undefined}\n {status === FilteringInputStatus.ReadyToFilter ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"icon icon-search\" onClick={this._onSearchButtonClick}\n role=\"button\" tabIndex={-1} title={this._searchLabel} /> : undefined}\n {status === FilteringInputStatus.FilteringInProgress ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"icon icon-close\" onClick={this._onCancelButtonClick}\n role=\"button\" tabIndex={-1} title={this._cancelLabel} /> : undefined}\n {status === FilteringInputStatus.FilteringFinished ?\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span className=\"components-filtering-input-clear icon icon-close\" onClick={this._onClearButtonClick}\n role=\"button\" tabIndex={-1} title={this._clearLabel} /> : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { CommonProps } from "@itwin/core-react";
|
|
|
6
6
|
import { ParseResults } from "@itwin/appui-abstract";
|
|
7
7
|
import "./ParsedInput.scss";
|
|
8
8
|
/** Props for [[ParsedInput]] control
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface ParsedInputProps extends CommonProps {
|
|
12
12
|
/** InitialValue which is used to restore input field if ESC is pressed */
|
|
@@ -23,7 +23,7 @@ export interface ParsedInputProps extends CommonProps {
|
|
|
23
23
|
ref?: React.Ref<HTMLInputElement>;
|
|
24
24
|
}
|
|
25
25
|
/** Generic Input component that requires formatting and parsing functions to be passed in as props.
|
|
26
|
-
* @
|
|
26
|
+
* @public
|
|
27
27
|
*/
|
|
28
28
|
export declare const ParsedInput: (props: ParsedInputProps) => JSX.Element | null;
|
|
29
29
|
//# sourceMappingURL=ParsedInput.d.ts.map
|
|
@@ -105,7 +105,7 @@ const ForwardRefParsedInput = React.forwardRef(function ForwardRefParsedInput({
|
|
|
105
105
|
return React.createElement(itwinui_react_1.Input, { "data-testid": "components-parsed-input", ref: ref, style: style, className: classNames, onKeyDown: handleKeyDown, onBlur: handleBlur, onChange: handleChange, value: formattedValue, disabled: readonly });
|
|
106
106
|
});
|
|
107
107
|
/** Generic Input component that requires formatting and parsing functions to be passed in as props.
|
|
108
|
-
* @
|
|
108
|
+
* @public
|
|
109
109
|
*/
|
|
110
110
|
exports.ParsedInput = ForwardRefParsedInput;
|
|
111
111
|
//# sourceMappingURL=ParsedInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedInput.js","sourceRoot":"","sources":["../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,wDAA6C;AAE7C,0DAAiE;AACjE,8BAA4B;AAoB5B,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAC5C,SAAS,qBAAqB,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,GAAG;IAClH,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,qBAAqB,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IACtE,MAAM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iB,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YACxD,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,SAAS,EAAE,yBAAyB,EAAE,WAAW,IAAI,mCAAmC,CAAC,CAAC;IAExH,OAAO,oBAAC,qBAAK,mBAAa,yBAAyB,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAC7I,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC1E,CAAC,CACF,CAAC;AAEF;;GAEG;AACU,QAAA,WAAW,GAAoD,qBAAqB,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 Inputs\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { ParseResults, SpecialKey } from \"@itwin/appui-abstract\";\nimport \"./ParsedInput.scss\";\n\n/** Props for [[ParsedInput]] control\n * @
|
|
1
|
+
{"version":3,"file":"ParsedInput.js","sourceRoot":"","sources":["../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,4DAAoC;AACpC,wDAA6C;AAE7C,0DAAiE;AACjE,8BAA4B;AAoB5B,MAAM,qBAAqB,GAAG,KAAK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C5C,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAA4C,EAAE,EAAE;QACvF,uBAAuB;QACvB,IAAI,KAAK,CAAC,GAAG,KAAK,2BAAU,CAAC,KAAK,EAAE;YAClC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACjD,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;QACD,IAAI,KAAK,CAAC,GAAG,KAAK,2BAAU,CAAC,MAAM,EAAE;YACnC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YACxD,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,KAAK,CAAC,cAAc,EAAE,CAAC;SACxB;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEzC,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC,SAAS,EAAE,yBAAyB,EAAE,WAAW,IAAI,mCAAmC,CAAC,CAAC;IAExH,OAAO,oBAAC,qBAAK,mBAAa,yBAAyB,EAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAC7I,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC1E,CAAC,CACF,CAAC;AAEF;;GAEG;AACU,QAAA,WAAW,GAAoD,qBAAqB,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 Inputs\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { ParseResults, SpecialKey } from \"@itwin/appui-abstract\";\nimport \"./ParsedInput.scss\";\n\n/** Props for [[ParsedInput]] control\n * @public\n */\nexport interface ParsedInputProps extends CommonProps {\n /** InitialValue which is used to restore input field if ESC is pressed */\n initialValue: number;\n /** Function used to format the value */\n formatValue: (value: number) => string;\n /** Function used to parse user input into a value */\n parseString: (stringValue: string) => ParseResults;\n /** Function to call when value is changed */\n onChange?: (newValue: number) => void;\n /** if readonly then only the formatValue function is used. */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\nconst ForwardRefParsedInput = React.forwardRef<HTMLInputElement, ParsedInputProps>(\n function ForwardRefParsedInput({ initialValue, formatValue, parseString, readonly, className, style, onChange }, ref) {\n const currentValueRef = React.useRef(initialValue);\n const isMountedRef = React.useRef(false);\n const lastFormattedValueRef = React.useRef(formatValue(initialValue));\n const [formattedValue, setFormattedValue] = React.useState(() => lastFormattedValueRef.current);\n const [hasBadInput, setHasBadInput] = React.useState(false);\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = initialValue;\n const currentFormattedValue = formatValue(currentValueRef.current);\n if (currentFormattedValue !== lastFormattedValueRef.current) {\n lastFormattedValueRef.current = currentFormattedValue;\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }, [formatValue, initialValue]);\n\n const handleChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n }, []);\n\n const updateValueFromString = React.useCallback((strVal: string) => {\n if (lastFormattedValueRef.current === strVal)\n return;\n\n const parseResults = (parseString(strVal));\n // istanbul ignore else\n if (!parseResults.parseError) {\n // istanbul ignore else\n if (undefined !== parseResults.value && typeof parseResults.value === \"number\") {\n const currentValue = parseResults.value;\n // istanbul ignore else\n if (currentValue !== currentValueRef.current) {\n currentValueRef.current = currentValue;\n onChange && onChange(currentValueRef.current);\n }\n // istanbul ignore else\n if (isMountedRef.current) {\n lastFormattedValueRef.current = formatValue(currentValue);\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }\n } else {\n setHasBadInput(true);\n }\n }, [formatValue, onChange, parseString]);\n\n const handleBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n updateValueFromString(event.target.value);\n }, [updateValueFromString]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === SpecialKey.Enter) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n }\n if (event.key === SpecialKey.Escape) {\n setFormattedValue(formatValue(currentValueRef.current));\n setHasBadInput(false);\n event.preventDefault();\n }\n }, [formatValue, updateValueFromString]);\n\n const classNames = classnames(className, \"components-parsed-input\", hasBadInput && \"components-parsed-input-has-error\");\n\n return <Input data-testid=\"components-parsed-input\" ref={ref} style={style} className={classNames} onKeyDown={handleKeyDown} onBlur={handleBlur}\n onChange={handleChange} value={formattedValue} disabled={readonly} />;\n }\n);\n\n/** Generic Input component that requires formatting and parsing functions to be passed in as props.\n * @public\n */\nexport const ParsedInput: (props: ParsedInputProps) => JSX.Element | null = ForwardRefParsedInput;\n\n"]}
|
|
@@ -7,7 +7,7 @@ import { PropertyRecord } from "@itwin/appui-abstract";
|
|
|
7
7
|
import { Orientation } from "@itwin/core-react";
|
|
8
8
|
import { ActionButtonRenderer } from "./ActionButtonRenderer";
|
|
9
9
|
/** Properties of [[ActionButtonList]] React component
|
|
10
|
-
* @
|
|
10
|
+
* @public
|
|
11
11
|
*/
|
|
12
12
|
export interface ActionButtonListProps {
|
|
13
13
|
/** Orientation to use for displaying the action buttons */
|
|
@@ -20,7 +20,7 @@ export interface ActionButtonListProps {
|
|
|
20
20
|
isPropertyHovered?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/** ActionButtonList React component.
|
|
23
|
-
* @
|
|
23
|
+
* @public
|
|
24
24
|
*/
|
|
25
25
|
export declare class ActionButtonList extends React.PureComponent<ActionButtonListProps> {
|
|
26
26
|
private getClassName;
|
|
@@ -31,7 +31,7 @@ require("./ActionButtonList.scss");
|
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
32
|
const core_react_1 = require("@itwin/core-react");
|
|
33
33
|
/** ActionButtonList React component.
|
|
34
|
-
* @
|
|
34
|
+
* @public
|
|
35
35
|
*/
|
|
36
36
|
class ActionButtonList extends React.PureComponent {
|
|
37
37
|
getClassName(orientation) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButtonList.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/ActionButtonList.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAAiC;AACjC,6CAA+B;AAE/B,kDAAgD;AAiBhD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAoC;IACtE,YAAY,CAAC,WAAwB;QAC3C,OAAO,WAAW,KAAK,wBAAW,CAAC,UAAU;YAC3C,CAAC,CAAC,oDAAoD;YACtD,CAAC,CAAC,kDAAkD,CAAC;IACzD,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IACtD,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CACxD,oBAAC,qBAAqB,IACpB,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE;gBACb,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAC7B,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;aAChD,GACD,CACH,CACG,CACP,CAAC;IACJ,CAAC;CACF;AAxBD,4CAwBC;AAOD,SAAS,qBAAqB,CAAC,KAAiC;IAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACzD,IAAI,CAAC,YAAY;QACf,OAAO,IAAI,CAAC;IAEd,OAAO,CACL,6BAAK,SAAS,EAAC,oCAAoC,IAChD,YAAY,CACT,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 Properties\n */\n\nimport \"./ActionButtonList.scss\";\nimport * as React from \"react\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { ActionButtonRenderer, ActionButtonRendererProps } from \"./ActionButtonRenderer\";\n\n/** Properties of [[ActionButtonList]] React component\n * @
|
|
1
|
+
{"version":3,"file":"ActionButtonList.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/ActionButtonList.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAAiC;AACjC,6CAA+B;AAE/B,kDAAgD;AAiBhD;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,aAAoC;IACtE,YAAY,CAAC,WAAwB;QAC3C,OAAO,WAAW,KAAK,wBAAW,CAAC,UAAU;YAC3C,CAAC,CAAC,oDAAoD;YACtD,CAAC,CAAC,kDAAkD,CAAC;IACzD,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IACtD,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CACxD,oBAAC,qBAAqB,IACpB,GAAG,EAAE,KAAK,EACV,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE;gBACb,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAC7B,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;aAChD,GACD,CACH,CACG,CACP,CAAC;IACJ,CAAC;CACF;AAxBD,4CAwBC;AAOD,SAAS,qBAAqB,CAAC,KAAiC;IAC9D,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACzD,IAAI,CAAC,YAAY;QACf,OAAO,IAAI,CAAC;IAEd,OAAO,CACL,6BAAK,SAAS,EAAC,oCAAoC,IAChD,YAAY,CACT,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 Properties\n */\n\nimport \"./ActionButtonList.scss\";\nimport * as React from \"react\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { ActionButtonRenderer, ActionButtonRendererProps } from \"./ActionButtonRenderer\";\n\n/** Properties of [[ActionButtonList]] React component\n * @public\n */\nexport interface ActionButtonListProps {\n /** Orientation to use for displaying the action buttons */\n orientation: Orientation;\n /** Property that action buttons belong to */\n property: PropertyRecord;\n /** Array of action button renderers */\n actionButtonRenderers: ActionButtonRenderer[];\n /** Indicated whether a property is hovered */\n isPropertyHovered?: boolean;\n}\n\n/** ActionButtonList React component.\n * @public\n */\nexport class ActionButtonList extends React.PureComponent<ActionButtonListProps> {\n private getClassName(orientation: Orientation) {\n return orientation === Orientation.Horizontal\n ? \"components-property-action-button-list--horizontal\"\n : \"components-property-action-button-list--vertical\";\n }\n\n /** @internal */\n public override render() {\n return (\n <div className={this.getClassName(this.props.orientation)}>\n {this.props.actionButtonRenderers.map((renderer, index) =>\n <ActionButtonContainer\n key={index}\n renderer={renderer}\n rendererProps={{\n property: this.props.property,\n isPropertyHovered: this.props.isPropertyHovered,\n }}\n />,\n )}\n </div>\n );\n }\n}\n\ninterface ActionButtonContainerProps {\n renderer: ActionButtonRenderer;\n rendererProps: ActionButtonRendererProps;\n}\n\nfunction ActionButtonContainer(props: ActionButtonContainerProps) {\n const actionButton = props.renderer(props.rendererProps);\n if (!actionButton)\n return null;\n\n return (\n <div className=\"components-action-button-container\">\n {actionButton}\n </div>\n );\n}\n"]}
|
|
@@ -15,7 +15,6 @@ export interface PrimitiveRendererProps extends SharedRendererProps {
|
|
|
15
15
|
/** Multiplier of how much the property is indented to the right */
|
|
16
16
|
indentation?: number;
|
|
17
17
|
/** Properties used for highlighting
|
|
18
|
-
* @beta
|
|
19
18
|
*/
|
|
20
19
|
highlight?: HighlightingComponentProps;
|
|
21
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAGrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,wCAAwC;IACxC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAC7C,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB
|
|
1
|
+
{"version":3,"file":"PrimitivePropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AAGrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,wCAAwC;IACxC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAC7C,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;MACE;IACF,SAAS,CAAC,EAAE,0BAA0B,CAAC;CACxC;AAED;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,KAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC;gBACxE,KAAK,EAAE,sBAAsB;IAIzC,gBAAgB;IACA,MAAM;CAoBvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C;
|
|
1
|
+
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,kDAAgD;AAChD,kEAA+D;AAE/D,qEAAkE;AAClE,2FAAwF;AAExF,iDAA8C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C;IACJ,CAAC;CACF;AA1BD,8DA0BC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { PrimitivePropertyLabelRenderer } from \"./label/PrimitivePropertyLabelRenderer\";\nimport { SharedRendererProps } from \"./PropertyRenderer\";\nimport { PropertyView } from \"./PropertyView\";\n\n/** Properties of [[PrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface PrimitiveRendererProps extends SharedRendererProps {\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Properties used for highlighting\n */\n highlight?: HighlightingComponentProps;\n}\n\n/** React Component that renders primitive properties\n * @public\n */\nexport class PrimitivePropertyRenderer extends React.Component<PrimitiveRendererProps> {\n constructor(props: PrimitiveRendererProps) {\n super(props);\n }\n\n /** @internal */\n public override render() {\n const { children, indentation, highlight, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const displayLabel = this.props.propertyRecord.property.displayLabel;\n const offset = CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio, props.columnInfo?.minLabelWidth);\n\n const activeMatchIndex = this.props.propertyRecord.property.name === highlight?.activeHighlight?.highlightedItemIdentifier ? highlight.activeHighlight.highlightIndex : undefined;\n const label = highlight ?\n (HighlightedText({ text: displayLabel, searchText: highlight.highlightedText, activeMatchIndex })) :\n displayLabel;\n\n return (\n <PropertyView\n {...props}\n labelElement={\n <PrimitivePropertyLabelRenderer offset={offset} renderColon={this.props.orientation === Orientation.Horizontal} tooltip={displayLabel}>\n {label}\n </PrimitivePropertyLabelRenderer>}\n />\n );\n }\n}\n"]}
|
|
@@ -37,8 +37,7 @@ export interface SharedRendererProps {
|
|
|
37
37
|
isSelectable?: boolean;
|
|
38
38
|
/** Width of the whole property element */
|
|
39
39
|
width?: number;
|
|
40
|
-
/** Array of action button renderers
|
|
41
|
-
* @beta */
|
|
40
|
+
/** Array of action button renderers */
|
|
42
41
|
actionButtonRenderers?: ActionButtonRenderer[];
|
|
43
42
|
/** Is resize handle hovered */
|
|
44
43
|
isResizeHandleHovered?: boolean;
|
|
@@ -59,17 +58,13 @@ export interface PropertyRendererProps extends SharedRendererProps {
|
|
|
59
58
|
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
60
59
|
/** Multiplier of how much the property is indented to the right */
|
|
61
60
|
indentation?: number;
|
|
62
|
-
/** Indicates property is being edited
|
|
63
|
-
* @beta */
|
|
61
|
+
/** Indicates property is being edited */
|
|
64
62
|
isEditing?: boolean;
|
|
65
|
-
/** Called when property edit is committed.
|
|
66
|
-
* @beta */
|
|
63
|
+
/** Called when property edit is committed. */
|
|
67
64
|
onEditCommit?: (args: PropertyUpdatedArgs) => void;
|
|
68
|
-
/** Called when property edit is cancelled.
|
|
69
|
-
* @beta */
|
|
65
|
+
/** Called when property edit is cancelled. */
|
|
70
66
|
onEditCancel?: () => void;
|
|
71
|
-
/** Props used for highlighting.
|
|
72
|
-
* @beta */
|
|
67
|
+
/** Props used for highlighting. */
|
|
73
68
|
highlight?: HighlightingComponentProps;
|
|
74
69
|
}
|
|
75
70
|
/** State of [[PropertyRenderer]] React component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,O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K,CAAC,EAAE,MAAM,CAAC;IACf;
|
|
1
|
+
{"version":3,"file":"PropertyRenderer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAmB,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,qHAAqH;IACrH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,WAAW,EAAE,WAAW,CAAC;IACzB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,mDAAmD;IACnD,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxE,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,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C;IACjG,gBAAgB;IAChB,SAAyB,KAAK,EAAE,QAAQ,CAAC,qBAAqB,CAAC,CAE7D;gBAEU,KAAK,EAAE,qBAAqB;WAI1B,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM;IAIzJ,OAAO,CAAC,kBAAkB;IAU1B,OAAO,CAAC,aAAa,CAInB;IAEF,OAAO,CAAC,aAAa,CAInB;IAEF,iDAAiD;IAC1C,0BAA0B,CAAC,KAAK,EAAE,qBAAqB;IAY9D,gBAAgB;IACA,iBAAiB;IAIjC,gBAAgB;IACA,kBAAkB,CAAC,SAAS,EAAE,qBAAqB;IAOnE,gBAAgB;IACA,MAAM;CA8BvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAA4E;AAG5E,mEAAqF;AACrF,qDAAkD;AAGlD,qEAAkE;AAClE,iFAA8E;AAC9E,2EAAgG;AA4EhG;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,SAAuD;IAMjG,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QANf,gBAAgB;QACS,UAAK,GAAoC;YAChE,YAAY,EAAE,2BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,CAAC;QAoBM,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY;gBACzB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAA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AK,CAAC,cAAc;YACxD,SAAS,CAAC,SAAS,KAAK,IAAI,CAAC,KAAK,CAAC,SAAS;YAC5C,SAAS,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW;YAChD,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,KAA8F,IAAI,CAAC,KAAK,EAAxG,EAAE,QAAQ,EAAE,4BAA4B,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,OAAyB,EAApB,KAAK,cAAzF,yFAA2F,CAAa,CAAC,CAAC,wDAAwD;QACxK,MAAM,sBAAsB,mCACvB,KAAK,KACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GACpC,CAAC;QAEF,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,KAAK,oCAAmB,CAAC,SAAS;gBAChC,OAAO,CACL,oBAAC,qDAAyB,oBAAK,sBAAsB,EAAI,CAC1D,CAAC;YACJ,KAAK,oCAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,qDAAyB,oBAAK,sBAAsB,EAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,kBAC3B,aAAa,EAAE,IAAI,IACf,sBAAsB,EAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF;AA7FD,4CA6FC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { EditorContainer, PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { UiComponents } from \"../../UiComponents\";\nimport { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer, PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers\n * @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited\n * @beta */\n isEditing?: boolean;\n /** Called when property edit is committed.\n * @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled.\n * @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting.\n * @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<PropertyRendererProps, PropertyRendererState> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n constructor(props: PropertyRendererProps) {\n super(props);\n }\n\n public static getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number {\n return CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit)\n this.props.onEditCommit(args);\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel)\n this.props.onEditCancel();\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue:\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />,\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation)\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override render() {\n const { children, propertyValueRendererManager, isEditing, onEditCommit, onEditCancel, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA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C5B,uDAAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,qDAAyB,oBAAK,sBAAsB,EAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,kBAC3B,aAAa,EAAE,IAAI,IACf,sBAAsB,EAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF;AA7FD,4CA6FC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport { EditorContainer, PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { UiComponents } from \"../../UiComponents\";\nimport { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer, PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<PropertyRendererProps, PropertyRendererState> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n constructor(props: PropertyRendererProps) {\n super(props);\n }\n\n public static getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number {\n return CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit)\n this.props.onEditCommit(args);\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel)\n this.props.onEditCancel();\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue:\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />,\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation)\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override render() {\n const { children, propertyValueRendererManager, isEditing, onEditCommit, onEditCancel, ...props } = this.props; // eslint-disable-line @typescript-eslint/no-unused-vars\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
@@ -11,9 +11,7 @@ export interface PropertyLabelRendererProps {
|
|
|
11
11
|
children: string | JSX.Element;
|
|
12
12
|
/** Indicates whether to render a colon after the label */
|
|
13
13
|
renderColon?: boolean;
|
|
14
|
-
/** Custom tooltip for the component.
|
|
15
|
-
* @beta
|
|
16
|
-
*/
|
|
14
|
+
/** Custom tooltip for the component. */
|
|
17
15
|
tooltip?: string;
|
|
18
16
|
}
|
|
19
17
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyLabelRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,GAAC,GAAG,CAAC,OAAO,CAAC;IAC7B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"PropertyLabelRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,GAAC,GAAG,CAAC,OAAO,CAAC;IAC7B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,qBAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAa,CAAC,0BAA0B,CAAC;IACxF,6EAA6E;WAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa;IAQ5C,MAAM;CAWvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;
|
|
1
|
+
{"version":3,"file":"PropertyLabelRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/label/PropertyLabelRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,wCAAsC;AACtC,6CAA+B;AAc/B,gBAAgB;AAChB,MAAa,qBAAsB,SAAQ,KAAK,CAAC,aAAyC;IACxF,6EAA6E;IACtE,MAAM,CAAC,QAAQ,CAAC,MAAe;QACpC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,OAAO;YACL,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,eAAe,MAAM,KAAK;SAClC,CAAC;IACJ,CAAC;IAEe,MAAM;;QACpB,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,OAAO,mCAAI,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC;QAC1I,OAAO,CACL;YACE,8BAAM,SAAS,EAAC,oCAAoC,EAAC,KAAK,EAAE,KAAK,IAC9D,IAAI,CAAC,KAAK,CAAC,QAAQ,CACf;YACN,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,8BAAM,SAAS,EAAC,0CAA0C,QAAS,CAAC,CAAC,CAAC,SAAS,CACxG,CACJ,CAAC;IACJ,CAAC;CACF;AArBD,sDAqBC","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 Properties\n */\n\nimport \"./PropertyLabelRenderer.scss\";\nimport * as React from \"react\";\n\n/** Base properties for a property label renderer\n * @public\n */\nexport interface PropertyLabelRendererProps {\n /** Label to be rendered */\n children: string|JSX.Element;\n /** Indicates whether to render a colon after the label */\n renderColon?: boolean;\n /** Custom tooltip for the component. */\n tooltip?: string;\n}\n\n/** @internal */\nexport class PropertyLabelRenderer extends React.PureComponent<PropertyLabelRendererProps> {\n /** Get React CSS style object based on provided offset from the left side */\n public static getStyle(offset?: number): React.CSSProperties {\n offset = offset ? offset : 0;\n return {\n paddingLeft: offset,\n width: `calc(100% - ${offset}px)`,\n };\n }\n\n public override render() {\n const title = this.props.tooltip ?? (typeof this.props.children == \"string\" ? this.props.children : /* istanbul ignore next */ undefined);\n return (\n <>\n <span className=\"components-property-label-renderer\" title={title}>\n {this.props.children}\n </span>\n {this.props.renderColon ? <span className=\"components-property-label-renderer-colon\">:</span> : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -33,7 +33,7 @@ export declare function PrimitivePropertyValueRendererImpl(props: PrimitivePrope
|
|
|
33
33
|
*
|
|
34
34
|
* Default matcher matches all URLs using regex.
|
|
35
35
|
* Default onClick opens window or sets location.href with found URL.
|
|
36
|
-
* @
|
|
36
|
+
* @public
|
|
37
37
|
*/
|
|
38
38
|
export declare const DEFAULT_LINKS_HANDLER: LinkElementsInfo;
|
|
39
39
|
/** @internal */
|
|
@@ -70,7 +70,7 @@ exports.PrimitivePropertyValueRendererImpl = PrimitivePropertyValueRendererImpl;
|
|
|
70
70
|
*
|
|
71
71
|
* Default matcher matches all URLs using regex.
|
|
72
72
|
* Default onClick opens window or sets location.href with found URL.
|
|
73
|
-
* @
|
|
73
|
+
* @public
|
|
74
74
|
*/
|
|
75
75
|
exports.DEFAULT_LINKS_HANDLER = {
|
|
76
76
|
matcher: PropertyGridCommons_1.PropertyGridCommons.getLinks,
|
package/lib/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAA8G;AAC9G,iEAA8D;AAC9D,mFAAgF;AAChF,6FAA0F;AAC1F,mDAAkD;AAGlD;;GAEG;AACH,MAAa,8BAA8B;IAEzC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,kCAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,8BAA8B,GACrD,CAAC;IACL,CAAC;CACF;AAfD,wEAeC;AAED;;;GAGG;AACH,SAAgB,8BAA8B,CAAC,MAAsB;;IACnE,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,OAAO,2CAAoB,CAAC,YAAY,CAAC,MAAM,CAA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AE,CAAC;AACtC,CAAC;AAfD,wDAeC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { LinkElementsInfo, PrimitiveValue, PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { useAsyncValue } from \"../../../common/UseAsyncValue\";\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\nimport { PropertyGridCommons } from \"../../../propertygrid/component/PropertyGridCommons\";\nimport { LinksRenderer } from \"../../LinkHandler\";\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\n\n/** Default Primitive Property Renderer\n * @public\n */\nexport class PrimitivePropertyValueRenderer implements IPropertyValueRenderer {\n\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return record.value.valueFormat === PropertyValueFormat.Primitive;\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\n return <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertPrimitiveRecordToString}\n />;\n }\n}\n\n/**\n * Function that converts primitive [[PropertyRecord]] to string\n * @internal\n */\nexport function convertPrimitiveRecordToString(record: PropertyRecord) {\n const primitive = record.value as PrimitiveValue;\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\n}\n\n/** @internal */\ninterface PrimitivePropertyValueRendererImplProps {\n record: PropertyRecord;\n stringValueCalculator: (record: PropertyRecord) => string | Promise<string>;\n context?: PropertyValueRendererContext;\n linksHandler?: LinkElementsInfo;\n}\n\n/** @internal */\nexport function PrimitivePropertyValueRendererImpl(props: PrimitivePropertyValueRendererImplProps) {\n const { stringValue, element } = useRenderedStringValue(props.record, props.stringValueCalculator, props.context, props.linksHandler);\n return <span style={props.context?.style} title={stringValue}>{element}</span>;\n}\n\n/**\n * Default link handler used for handling records,\n * which did not have any specified LinkElementsInfo.\n *\n * Default matcher matches all URLs using regex.\n * Default onClick opens window or sets location.href with found URL.\n * @
|
|
1
|
+
{"version":3,"file":"PrimitivePropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,0DAA8G;AAC9G,iEAA8D;AAC9D,mFAAgF;AAChF,6FAA0F;AAC1F,mDAAkD;AAGlD;;GAEG;AACH,MAAa,8BAA8B;IAEzC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAAC;IACpE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CAAC,MAAsB,EAAE,OAAsC;QAC1E,OAAO,oBAAC,kCAAkC,IACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,8BAA8B,GACrD,CAAC;IACL,CAAC;CACF;AAfD,wEAeC;AAED;;;GAGG;AACH,SAAgB,8BAA8B,CAAC,MAAsB;;IACnE,MAAM,SAAS,GAAG,MAAM,CAAC,KAAuB,CAAC;IACjD,OAAO,2CAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,SAAS,0CAAE,IAAI,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAChK,CAAC;AAHD,wEAGC;AAUD,gBAAgB;AAChB,SAAgB,kCAAkC,CAAC,KAA8C;;IAC/F,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,sBAAsB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACtI,OAAO,8BAAM,KAAK,EAAE,MAAA,KAAK,CAAC,OAAO,0CAAE,KAAK,EAAE,KAAK,EAAE,WAAW,IAAG,OAAO,CAAQ,CAAC;AACjF,CAAC;AAHD,gFAGC;AAED;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAqB;IACrD,OAAO,EAAE,yCAAmB,CAAC,QAAQ;IACrC,OAAO,EAAE,yCAAmB,CAAC,eAAe;CAC7C,CAAC;AAEF,gBAAgB;AAChB,SAAgB,sBAAsB,CACpC,MAAsB,EACtB,qBAA2E,EAC3E,OAAsC,EACtC,YAA+B;;IAE/B,MAAM,WAAW,GAAG,IAAA,6BAAa,EAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC;QACpC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY;QACvB,CAAC,CAAC,oBAAC,2BAAa,IACd,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,MAAA,MAAA,MAAM,CAAC,KAAK,mCAAI,YAAY,mCAAI,6BAAqB,EAC5D,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,GACrC,CAAC;IACL,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACtC,CAAC;AAfD,wDAeC","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 Properties\n */\n\nimport * as React from \"react\";\nimport { LinkElementsInfo, PrimitiveValue, PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { useAsyncValue } from \"../../../common/UseAsyncValue\";\nimport { TypeConverterManager } from \"../../../converters/TypeConverterManager\";\nimport { PropertyGridCommons } from \"../../../propertygrid/component/PropertyGridCommons\";\nimport { LinksRenderer } from \"../../LinkHandler\";\nimport { IPropertyValueRenderer, PropertyValueRendererContext } from \"../../ValueRendererManager\";\n\n/** Default Primitive Property Renderer\n * @public\n */\nexport class PrimitivePropertyValueRenderer implements IPropertyValueRenderer {\n\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return record.value.valueFormat === PropertyValueFormat.Primitive;\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(record: PropertyRecord, context?: PropertyValueRendererContext) {\n return <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertPrimitiveRecordToString}\n />;\n }\n}\n\n/**\n * Function that converts primitive [[PropertyRecord]] to string\n * @internal\n */\nexport function convertPrimitiveRecordToString(record: PropertyRecord) {\n const primitive = record.value as PrimitiveValue;\n return TypeConverterManager.getConverter(record.property.typename, record.property.converter?.name).convertPropertyToString(record.property, primitive.value);\n}\n\n/** @internal */\ninterface PrimitivePropertyValueRendererImplProps {\n record: PropertyRecord;\n stringValueCalculator: (record: PropertyRecord) => string | Promise<string>;\n context?: PropertyValueRendererContext;\n linksHandler?: LinkElementsInfo;\n}\n\n/** @internal */\nexport function PrimitivePropertyValueRendererImpl(props: PrimitivePropertyValueRendererImplProps) {\n const { stringValue, element } = useRenderedStringValue(props.record, props.stringValueCalculator, props.context, props.linksHandler);\n return <span style={props.context?.style} title={stringValue}>{element}</span>;\n}\n\n/**\n * Default link handler used for handling records,\n * which did not have any specified LinkElementsInfo.\n *\n * Default matcher matches all URLs using regex.\n * Default onClick opens window or sets location.href with found URL.\n * @public\n */\nexport const DEFAULT_LINKS_HANDLER: LinkElementsInfo = {\n matcher: PropertyGridCommons.getLinks,\n onClick: PropertyGridCommons.handleLinkClick,\n};\n\n/** @internal */\nexport function useRenderedStringValue(\n record: PropertyRecord,\n stringValueCalculator: (record: PropertyRecord) => string | Promise<string>,\n context?: PropertyValueRendererContext,\n linksHandler?: LinkElementsInfo,\n): { stringValue?: string, element: React.ReactNode } {\n const stringValue = useAsyncValue(stringValueCalculator(record));\n const el = (stringValue === undefined)\n ? context?.defaultValue\n : <LinksRenderer\n value={stringValue}\n links={record.links ?? linksHandler ?? DEFAULT_LINKS_HANDLER}\n highlighter={context?.textHighlighter}\n />;\n return { stringValue, element: el };\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import * as React from "react";
|
|
|
6
6
|
/**
|
|
7
7
|
* A definition for content displayed in [[ControlledSelectableContent]] and
|
|
8
8
|
* [[SelectableContent]] components.
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface SelectableContentDefinition {
|
|
12
12
|
id: string;
|
|
@@ -15,7 +15,7 @@ export interface SelectableContentDefinition {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* [[ControlledSelectableContent]] component properties
|
|
18
|
-
* @
|
|
18
|
+
* @public
|
|
19
19
|
*/
|
|
20
20
|
export interface ControlledSelectableContentProps {
|
|
21
21
|
selectedContentId: string;
|
|
@@ -27,12 +27,12 @@ export interface ControlledSelectableContentProps {
|
|
|
27
27
|
* A fully-controlled component that accepts a list of child components with ids and labels and
|
|
28
28
|
* renders a select box at the top, allowing to choose which of the provided child components
|
|
29
29
|
* should be rendered at the bottom.
|
|
30
|
-
* @
|
|
30
|
+
* @public
|
|
31
31
|
*/
|
|
32
32
|
export declare function ControlledSelectableContent(props: ControlledSelectableContentProps): JSX.Element;
|
|
33
33
|
/**
|
|
34
34
|
* [[SelectableContent]] component properties
|
|
35
|
-
* @
|
|
35
|
+
* @public
|
|
36
36
|
*/
|
|
37
37
|
export interface SelectableContentProps {
|
|
38
38
|
defaultSelectedContentId: string;
|
|
@@ -43,7 +43,7 @@ export interface SelectableContentProps {
|
|
|
43
43
|
* An uncontrolled component that accepts a list of child components with ids and labels and
|
|
44
44
|
* renders a select box at the top, allowing to choose which of the provided child components
|
|
45
45
|
* should be rendered at the bottom.
|
|
46
|
-
* @
|
|
46
|
+
* @public
|
|
47
47
|
*/
|
|
48
48
|
export declare function SelectableContent(props: SelectableContentProps): JSX.Element;
|
|
49
49
|
//# sourceMappingURL=SelectableContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,gCAAgC;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gCAAgC,eAwBlF;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAU9D"}
|