@itwin/components-react 4.16.5 → 4.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/lib/cjs/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/cjs/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.js +1 -0
- package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.scss +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.js +1 -0
- package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +1 -0
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +3 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +7 -21
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +5 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.scss +7 -6
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +37 -34
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +50 -27
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +2 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js +1 -0
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js +1 -0
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +30 -2
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/cjs/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/cjs/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.d.ts +1 -0
- package/lib/esm/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.js +1 -0
- package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.scss +1 -0
- package/lib/esm/components-react/editors/EditorContainer.d.ts +1 -0
- package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.js +1 -0
- package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.d.ts +1 -0
- package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +1 -0
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.d.ts.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +3 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +7 -21
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +2 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +5 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.scss +7 -6
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +0 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +36 -32
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +48 -26
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +2 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js +1 -0
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +1 -0
- package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js +1 -0
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -21
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js +47 -60
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +2 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js +7 -2
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +1 -0
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +3 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts +2 -0
- package/lib/esm/components-react/selectable-content/SelectableContent.d.ts.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +4 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js +1 -0
- package/lib/esm/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,11 +6,35 @@
|
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module Properties
|
|
8
8
|
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
9
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
33
|
exports.MergedPropertyValueRenderer = void 0;
|
|
34
|
+
const React = __importStar(require("react"));
|
|
11
35
|
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
|
-
const UiComponents_1 = require("../../../UiComponents");
|
|
13
36
|
const WithContextStyle_1 = require("./WithContextStyle");
|
|
37
|
+
const useTranslation_1 = require("../../../l10n/useTranslation");
|
|
14
38
|
/** Default Merged Property Renderer
|
|
15
39
|
* @public
|
|
16
40
|
*/
|
|
@@ -22,8 +46,12 @@ class MergedPropertyValueRenderer {
|
|
|
22
46
|
}
|
|
23
47
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
24
48
|
render(_record, context) {
|
|
25
|
-
return (0, WithContextStyle_1.withContextStyle)(
|
|
49
|
+
return (0, WithContextStyle_1.withContextStyle)(React.createElement(VariesRenderer, null), context);
|
|
26
50
|
}
|
|
27
51
|
}
|
|
28
52
|
exports.MergedPropertyValueRenderer = MergedPropertyValueRenderer;
|
|
53
|
+
function VariesRenderer() {
|
|
54
|
+
const { translate } = (0, useTranslation_1.useTranslation)();
|
|
55
|
+
return React.createElement(React.Fragment, null, translate("property.varies"));
|
|
56
|
+
}
|
|
29
57
|
//# sourceMappingURL=MergedPropertyValueRenderer.js.map
|
package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG
|
|
1
|
+
{"version":3,"file":"MergedPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/MergedPropertyValueRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAA4D;AAK5D,yDAAsD;AACtD,iEAA8D;AAE9D;;GAEG;AACH,MAAa,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,CAAC,CAAC,MAAM,CAAC,QAAQ;YACjB,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,SAAS,CAC3D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,OAAuB,EACvB,OAAsC;QAEtC,OAAO,IAAA,mCAAgB,EAAC,oBAAC,cAAc,OAAG,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAhBD,kEAgBC;AAED,SAAS,cAAc;IACrB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IACvC,OAAO,0CAAG,SAAS,CAAC,iBAAiB,CAAC,CAAI,CAAC;AAC7C,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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { withContextStyle } from \"./WithContextStyle\";\nimport { useTranslation } from \"../../../l10n/useTranslation\";\n\n/** Default Merged Property Renderer\n * @public\n */\nexport class MergedPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n !!record.isMerged &&\n record.value.valueFormat === PropertyValueFormat.Primitive\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n _record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return withContextStyle(<VariesRenderer />, context);\n }\n}\n\nfunction VariesRenderer() {\n const { translate } = useTranslation();\n return <>{translate(\"property.varies\")}</>;\n}\n"]}
|
package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { IPropertyDataProvider } from "../PropertyDataProvider";
|
|
|
7
7
|
import type { CommonPropertyGridProps, PropertyGridContentHighlightProps } from "./PropertyGridCommons";
|
|
8
8
|
/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component
|
|
9
9
|
* @public
|
|
10
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof VirtualizedPropertyGridWithDataProvider>`
|
|
10
11
|
*/
|
|
11
12
|
export interface VirtualizedPropertyGridWithDataProviderProps extends CommonPropertyGridProps {
|
|
12
13
|
/** Property data provider used by the property grid */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAI/B
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AAC1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,uBAAuB,CAAC;AAI/B;;;GAGG;AACH,MAAM,WAAW,4CACf,SAAQ,uBAAuB;IAC/B,uDAAuD;IACvD,YAAY,EAAE,qBAAqB,CAAC;IACpC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,iCAAiC,CAAC;IAC9C,iHAAiH;IACjH,+BAA+B,CAAC,EAAE,+BAA+B,CAAC;IAClE,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,uCAAuC,CAErD,KAAK,EAAE,4CAA4C,qBAoBpD"}
|
package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js
CHANGED
|
@@ -40,7 +40,9 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
40
40
|
* sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
function VirtualizedPropertyGridWithDataProvider(
|
|
43
|
+
function VirtualizedPropertyGridWithDataProvider(
|
|
44
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
|
45
|
+
props) {
|
|
44
46
|
const { modelSource, inProgress } = (0, PropertyGridHooks_1.useTrackedPropertyGridModelSource)({
|
|
45
47
|
dataProvider: props.dataProvider,
|
|
46
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG;;GAEG;AAEH,+CAAmD;AACnD,qEAIuC;AAOvC,uEAAoE;AACpE,wDAAsD;
|
|
1
|
+
{"version":3,"file":"VirtualizedPropertyGridWithDataProvider.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhG;;GAEG;AAEH,+CAAmD;AACnD,qEAIuC;AAOvC,uEAAoE;AACpE,wDAAsD;AAoBtD;;;;GAIG;AACH,SAAgB,uCAAuC;AACrD,sDAAsD;AACtD,KAAmD;IAEnD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,IAAA,qDAAiC,EAAC;QACpE,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,IAAA,wCAAoB,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,IAAA,+CAA2B,EAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAElE,OAAO,CACL,8BAAC,qBAAqB,IAAC,kBAAkB,EAAE,UAAU,IAAI,CAAC,KAAK,IAC5D,KAAK,IAAI,CACR,8BAAC,iDAAuB,OAClB,KAAK,EACT,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,GAC1B,CACH,CACqB,CACzB,CAAC;AACJ,CAAC;AAtBD,0FAsBC;AAMD,SAAS,qBAAqB,CAAC,EAC7B,QAAQ,EACR,kBAAkB,GACkC;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,kBAAkB,CAAC,CAAC;IACnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,cAAc,CAAC,kBAAkB,CAAC,CAAC;YACnC,OAAO;QACT,CAAC;QAED,8DAA8D;QAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9B,cAAc,CAAC,kBAAkB,CAAC,CAAC;QACrC,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,8DAAG,QAAQ,CAAI,CAChB,CAAC,CAAC,CAAC,CACF,uCAAK,SAAS,EAAC,6CAA6C;QAC1D,8BAAC,8BAAc,IAAC,aAAa,QAAC,IAAI,EAAE,OAAO,GAAI,CAC3C,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport React, { useEffect, useState } from \"react\";\nimport {\n usePropertyGridEventHandler,\n usePropertyGridModel,\n useTrackedPropertyGridModelSource,\n} from \"../internal/PropertyGridHooks\";\nimport type { PropertyCategoryRendererManager } from \"../PropertyCategoryRendererManager\";\nimport type { IPropertyDataProvider } from \"../PropertyDataProvider\";\nimport type {\n CommonPropertyGridProps,\n PropertyGridContentHighlightProps,\n} from \"./PropertyGridCommons\";\nimport { VirtualizedPropertyGrid } from \"./VirtualizedPropertyGrid\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[VirtualizedPropertyGridWithDataProvider]] React component\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof VirtualizedPropertyGridWithDataProvider>`\n */\nexport interface VirtualizedPropertyGridWithDataProviderProps\n extends CommonPropertyGridProps {\n /** Property data provider used by the property grid */\n dataProvider: IPropertyDataProvider;\n /** Properties for highlighting property data in the grid. */\n highlight?: PropertyGridContentHighlightProps;\n /** Custom property category renderer manager. Defaults to [[PropertyCategoryRendererManager.defaultManager]]. */\n propertyCategoryRendererManager?: PropertyCategoryRendererManager;\n /** Width of the property grid component. */\n width: number;\n /** Height of the property grid component. */\n height: number;\n}\n\n/**\n * [[VirtualizedPropertyGrid]] React Component which takes a data provider and\n * sets up default implementations for [[IPropertyGridModelSource]] and [[IPropertyGridEventHandler]]\n * @public\n */\nexport function VirtualizedPropertyGridWithDataProvider(\n /* eslint-disable-next-line deprecation/deprecation */\n props: VirtualizedPropertyGridWithDataProviderProps\n) {\n const { modelSource, inProgress } = useTrackedPropertyGridModelSource({\n dataProvider: props.dataProvider,\n });\n\n const model = usePropertyGridModel({ modelSource });\n const eventHandler = usePropertyGridEventHandler({ modelSource });\n\n return (\n <DelayedLoaderRenderer shouldRenderLoader={inProgress || !model}>\n {model && (\n <VirtualizedPropertyGrid\n {...props}\n model={model}\n eventHandler={eventHandler}\n />\n )}\n </DelayedLoaderRenderer>\n );\n}\n\ninterface DelayedLoaderRendererProps {\n shouldRenderLoader: boolean;\n}\n\nfunction DelayedLoaderRenderer({\n children,\n shouldRenderLoader,\n}: React.PropsWithChildren<DelayedLoaderRendererProps>) {\n const [showSpinner, setShowSpinner] = useState(shouldRenderLoader);\n useEffect(() => {\n if (!shouldRenderLoader) {\n setShowSpinner(shouldRenderLoader);\n return;\n }\n\n // only set a timeout when shouldRenderLoader is set to `true`\n const timeout = setTimeout(() => {\n setShowSpinner(shouldRenderLoader);\n }, 250);\n\n return () => clearTimeout(timeout);\n }, [shouldRenderLoader]);\n\n return !showSpinner ? (\n <>{children}</>\n ) : (\n <div className=\"components-virtualized-property-grid-loader\">\n <ProgressRadial indeterminate size={\"large\"} />\n </div>\n );\n}\n"]}
|
|
@@ -16,6 +16,7 @@ export interface SelectableContentDefinition {
|
|
|
16
16
|
/**
|
|
17
17
|
* [[ControlledSelectableContent]] component properties
|
|
18
18
|
* @public
|
|
19
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof ControlledSelectableContent>`
|
|
19
20
|
*/
|
|
20
21
|
export interface ControlledSelectableContentProps {
|
|
21
22
|
selectedContentId: string;
|
|
@@ -34,6 +35,7 @@ export declare function ControlledSelectableContent(props: ControlledSelectableC
|
|
|
34
35
|
/**
|
|
35
36
|
* [[SelectableContent]] component properties
|
|
36
37
|
* @public
|
|
38
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof SelectableContent>`
|
|
37
39
|
*/
|
|
38
40
|
export interface SelectableContentProps {
|
|
39
41
|
defaultSelectedContentId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAIA;;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
|
|
1
|
+
{"version":3,"file":"SelectableContent.d.ts","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":"AAIA;;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;;;;GAIG;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;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAEzC,KAAK,EAAE,gCAAgC,qBA0CxC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,wBAAwB,EAAE,MAAM,CAAC;IACjC,QAAQ,EAAE,2BAA2B,EAAE,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAiB9D"}
|
|
@@ -40,7 +40,9 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
40
40
|
* should be rendered at the bottom.
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
|
-
function ControlledSelectableContent(
|
|
43
|
+
function ControlledSelectableContent(
|
|
44
|
+
/* eslint-disable-next-line deprecation/deprecation */
|
|
45
|
+
props) {
|
|
44
46
|
const { onSelectedContentIdChanged, disabled } = props;
|
|
45
47
|
const onContentIdSelected = React.useCallback((newValue) => {
|
|
46
48
|
onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);
|
|
@@ -63,6 +65,7 @@ exports.ControlledSelectableContent = ControlledSelectableContent;
|
|
|
63
65
|
* should be rendered at the bottom.
|
|
64
66
|
* @public
|
|
65
67
|
*/
|
|
68
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
66
69
|
function SelectableContent(props) {
|
|
67
70
|
const [selectedContentId, setSelectedContentId] = React.useState(props.defaultSelectedContentId);
|
|
68
71
|
const onSelectedContentIdChanged = React.useCallback((id) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAkC;AAClC,6CAA+B;AAE/B,wDAA8C;
|
|
1
|
+
{"version":3,"file":"SelectableContent.js","sourceRoot":"","sources":["../../../../src/components-react/selectable-content/SelectableContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oCAAkC;AAClC,6CAA+B;AAE/B,wDAA8C;AA0B9C;;;;;GAKG;AACH,SAAgB,2BAA2B;AACzC,sDAAsD;AACtD,KAAuC;IAEvC,MAAM,EAAE,0BAA0B,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEvD,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAC3C,CAAC,QAAgB,EAAQ,EAAE;QACzB,0BAA0B,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC,EACD,CAAC,0BAA0B,CAAC,CAC7B,CAAC;IAEF,MAAM,eAAe,GACnB,KAAK,CAAC,QAAQ,CAAC,IAAI,CACjB,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,KAAK,CAAC,iBAAiB,CAC1D,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YAC3C,KAAK,EAAE,YAAY,CAAC,KAAK;YACzB,KAAK,EAAE,YAAY,CAAC,EAAE;SACvB,CAAC,CAA2B,CAAC;IAChC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,+BAA+B;QAC5C,6BAAK,SAAS,EAAC,sCAAsC,IAClD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,oBAAC,sBAAM,IACL,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,wCAAwC,gBACtC,KAAK,CAAC,eAAe,EACjC,KAAK,EAAE,eAAe,CAAC,EAAE,EACzB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,GAClB,CACH,CACG;QACN,6BAAK,SAAS,EAAC,uCAAuC,IACnD,eAAe,EAAE,MAAM,EAAE,CACtB,CACF,CACP,CAAC;AACJ,CAAC;AA5CD,kEA4CC;AAcD;;;;;GAKG;AACH,mDAAmD;AACnD,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC9D,KAAK,CAAC,wBAAwB,CAC/B,CAAC;IACF,MAAM,0BAA0B,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,EAAU,EAAE,EAAE;QAClE,oBAAoB,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL,oBAAC,2BAA2B,IAC1B,iBAAiB,EAAE,iBAAiB,EACpC,0BAA0B,EAAE,0BAA0B,EACtD,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAEvB,KAAK,CAAC,QAAQ,CACa,CAC/B,CAAC;AACJ,CAAC;AAjBD,8CAiBC","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 SelectableContent\n */\n\nimport \"./SelectableContent.scss\";\nimport * as React from \"react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/**\n * A definition for content displayed in [[ControlledSelectableContent]] and\n * [[SelectableContent]] components.\n * @public\n */\nexport interface SelectableContentDefinition {\n id: string;\n label: string;\n render: () => React.ReactNode;\n}\n\n/**\n * [[ControlledSelectableContent]] component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof ControlledSelectableContent>`\n */\nexport interface ControlledSelectableContentProps {\n selectedContentId: string;\n onSelectedContentIdChanged?: (contentId: string) => void;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * A fully-controlled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\nexport function ControlledSelectableContent(\n /* eslint-disable-next-line deprecation/deprecation */\n props: ControlledSelectableContentProps\n) {\n const { onSelectedContentIdChanged, disabled } = props;\n\n const onContentIdSelected = React.useCallback(\n (newValue: string): void => {\n onSelectedContentIdChanged && onSelectedContentIdChanged(newValue);\n },\n [onSelectedContentIdChanged]\n );\n\n const selectedContent =\n props.children.find(\n (contentDef) => contentDef.id === props.selectedContentId\n ) ?? props.children[0];\n const options = React.useMemo(() => {\n return props.children.map((componentDef) => ({\n label: componentDef.label,\n value: componentDef.id,\n })) as SelectOption<string>[];\n }, [props.children]);\n\n return (\n <div className=\"components-selectable-content\">\n <div className=\"components-selectable-content-header\">\n {options.length > 0 && (\n <Select\n onChange={onContentIdSelected}\n size=\"small\"\n className=\"components-selectable-content-selector\"\n aria-label={props.selectAriaLabel}\n value={selectedContent.id}\n options={options}\n disabled={disabled}\n />\n )}\n </div>\n <div className=\"components-selectable-content-wrapper\">\n {selectedContent?.render()}\n </div>\n </div>\n );\n}\n\n/**\n * [[SelectableContent]] component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof SelectableContent>`\n */\nexport interface SelectableContentProps {\n defaultSelectedContentId: string;\n children: SelectableContentDefinition[];\n selectAriaLabel?: string;\n disabled?: boolean;\n}\n\n/**\n * An uncontrolled component that accepts a list of child components with ids and labels and\n * renders a select box at the top, allowing to choose which of the provided child components\n * should be rendered at the bottom.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function SelectableContent(props: SelectableContentProps) {\n const [selectedContentId, setSelectedContentId] = React.useState(\n props.defaultSelectedContentId\n );\n const onSelectedContentIdChanged = React.useCallback((id: string) => {\n setSelectedContentId(id);\n }, []);\n return (\n <ControlledSelectableContent\n selectedContentId={selectedContentId}\n onSelectedContentIdChanged={onSelectedContentIdChanged}\n selectAriaLabel={props.selectAriaLabel}\n disabled={props.disabled}\n >\n {props.children}\n </ControlledSelectableContent>\n );\n}\n"]}
|
|
@@ -10,6 +10,7 @@ import type { TreeNodeEditorRenderer } from "./TreeNodeEditor";
|
|
|
10
10
|
/**
|
|
11
11
|
* Properties for [[TreeNodeContent]] component
|
|
12
12
|
* @public
|
|
13
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeContent>`
|
|
13
14
|
*/
|
|
14
15
|
export interface TreeNodeContentProps extends CommonProps {
|
|
15
16
|
/** Tree node to render label for. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"NodeContent.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG/D;;;;GAIG;AAEH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,qCAAqC;IACrC,IAAI,EAAE,aAAa,CAAC;IACpB,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oFAAoF;IACpF,cAAc,CAAC,EAAE,0BAA0B,CAAC;IAC5C,sDAAsD;IACtD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;CAC7C;AAED;;;GAGG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAuD1D"}
|
|
@@ -47,6 +47,7 @@ const TreeNodeEditor_1 = require("./TreeNodeEditor");
|
|
|
47
47
|
* React component for displaying [[TreeNode]] label
|
|
48
48
|
* @public
|
|
49
49
|
*/
|
|
50
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
50
51
|
function TreeNodeContent(props) {
|
|
51
52
|
const { node, onLabelRendered, highlightProps } = props;
|
|
52
53
|
const label = React.useMemo(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeContent.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAE/B,kDAAwD;AAExD,6DAAkE;AAElE,mFAAwF;AACxF,mFAAiF;AAEjF,iEAA8D;AAG9D,qDAAkD;
|
|
1
|
+
{"version":3,"file":"NodeContent.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/NodeContent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,4DAAoC;AACpC,6CAA+B;AAE/B,kDAAwD;AAExD,6DAAkE;AAElE,mFAAwF;AACxF,mFAAiF;AAEjF,iEAA8D;AAG9D,qDAAkD;AAqBlD;;;GAGG;AACH,mDAAmD;AACnD,SAAgB,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACxD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO;IACzB,qEAAqE;IACrE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,EACpC,CAAC,IAAI,EAAE,cAAc,CAAC,CACvB,CAAC;IACF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAe,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IAEnC,sBAAsB;IACtB,IAAI,MAAuB,CAAC;IAC5B,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QAC3B,iEAAiE;QACjE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,I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C,wCAAwC;IACxC,MAAM,iBAAiB,GAAG,cAAc;QACtC,CAAC,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,uCAAkB,CAAC,eAAe,CAAC,IAAI,EAAE,cAAc,CAAC;QAC5E,CAAC,CAAC,SAAS,CAAC;IAEd,+BAA+B;IAC/B,MAAM,OAAO,GAAiC;QAC5C,aAAa,EAAE,4CAAqB,CAAC,IAAI;QACzC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC;QACjD,eAAe,EAAE,iBAAiB;QAClC,YAAY,EAAE;QACZ,mDAAmD;QACnD,oBAAC,gCAAmB,IAAC,KAAK,EAAE,CAAC,iBAAe,wBAAwB,GAAI,CACzE;KACF,CAAC;IAEF,OAAO,mDAA4B,CAAC,cAAc,CAAC,MAAM,CACvD,IAAI,CAAC,IAAI,CAAC,KAAK,EACf,OAAO,CACR,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CACf,KAAiB,EACjB,UAAoB;IAEpB,OAAO,6BAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;AACvE,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 Tree\n */\n\nimport \"./NodeContent.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { TreeNodePlaceholder } from \"@itwin/core-react\";\nimport type { ItemStyle } from \"../../../properties/ItemStyle\";\nimport { ItemStyleProvider } from \"../../../properties/ItemStyle\";\nimport type { PropertyValueRendererContext } from \"../../../properties/ValueRendererManager\";\nimport { PropertyValueRendererManager } from \"../../../properties/ValueRendererManager\";\nimport { PropertyContainerType } from \"../../../properties/ValueRendererManager\";\nimport type { HighlightableTreeNodeProps } from \"../../HighlightingEngine\";\nimport { HighlightingEngine } from \"../../HighlightingEngine\";\nimport type { TreeModelNode } from \"../TreeModel\";\nimport type { TreeNodeEditorRenderer } from \"./TreeNodeEditor\";\nimport { TreeNodeEditor } from \"./TreeNodeEditor\";\n\n/**\n * Properties for [[TreeNodeContent]] component\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeContent>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeContentProps extends CommonProps {\n /** Tree node to render label for. */\n node: TreeModelNode;\n /** Flag that specified whether the description should be shown or not. */\n showDescription?: boolean;\n /** Props for highlighting label parts that matches filter when tree is filtered. */\n highlightProps?: HighlightableTreeNodeProps;\n /** Callback used to detect when label is rendered. */\n onLabelRendered?: (node: TreeModelNode) => void;\n /** Callback to render custom node editor when node is in editing mode. */\n nodeEditorRenderer?: TreeNodeEditorRenderer;\n}\n\n/**\n * React component for displaying [[TreeNode]] label\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function TreeNodeContent(props: TreeNodeContentProps) {\n const { node, onLabelRendered, highlightProps } = props;\n const label = React.useMemo(\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n () => getLabel(node, highlightProps),\n [node, highlightProps]\n );\n React.useEffect(() => {\n onLabelRendered && onLabelRendered(node);\n }, [label, node, onLabelRendered]);\n\n // handle cell editing\n let editor: React.ReactNode;\n if (props.node.editingInfo) {\n // if cell editing is enabled, return editor instead of the label\n const style = getStyle(props.node.item.style, props.node.isSelected);\n const editorProps = {\n node: props.node,\n onCancel: props.node.editingInfo.onCancel,\n onCommit: props.node.editingInfo.onCommit,\n style,\n };\n editor = props.nodeEditorRenderer ? (\n props.nodeEditorRenderer(editorProps)\n ) : (\n <TreeNodeEditor {...editorProps} />\n );\n }\n\n const isDescriptionEnabled =\n props.node.item.description && props.showDescription;\n\n const containerClassName = classnames(\n \"components-controlledTree-node-content\",\n isDescriptionEnabled ? \"with-description\" : undefined,\n props.className\n );\n\n const descriptionClassName = classnames(\n \"components-controlledTree-node-description\",\n editor ? \"with-editor\" : undefined\n );\n\n return (\n <div className={containerClassName} style={props.style}>\n <>\n {editor ? editor : label}\n {isDescriptionEnabled ? (\n <div className={descriptionClassName}>\n {props.node.item.description}\n </div>\n ) : undefined}\n </>\n </div>\n );\n}\n\nfunction getLabel(\n node: TreeModelNode,\n highlightProps?: HighlightableTreeNodeProps\n): React.ReactNode | Promise<React.ReactNode> {\n // handle filtered matches' highlighting\n const highlightCallback = highlightProps\n ? (text: string) => HighlightingEngine.renderNodeLabel(text, highlightProps)\n : undefined;\n\n // handle custom cell rendering\n const context: PropertyValueRendererContext = {\n containerType: PropertyContainerType.Tree,\n style: getStyle(node.item.style, node.isSelected),\n textHighlighter: highlightCallback,\n defaultValue: (\n // eslint-disable-next-line deprecation/deprecation\n <TreeNodePlaceholder level={0} data-testid={\"node-label-placeholder\"} />\n ),\n };\n\n return PropertyValueRendererManager.defaultManager.render(\n node.item.label,\n context\n );\n}\n\nfunction getStyle(\n style?: ItemStyle,\n isSelected?: boolean\n): React.CSSProperties {\n return ItemStyleProvider.createStyle(style ? style : {}, isSelected);\n}\n"]}
|
|
@@ -51,6 +51,7 @@ export declare const TreeNodeRenderer: React.NamedExoticComponent<TreeNodeRender
|
|
|
51
51
|
/**
|
|
52
52
|
* Props for [[TreeNodeIcon]] component.
|
|
53
53
|
* @public
|
|
54
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeIcon>`
|
|
54
55
|
*/
|
|
55
56
|
export interface TreeNodeIconProps {
|
|
56
57
|
/** Tree node to render icon for. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAA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EAAE,aAAa,KAAK,IAAI,CAAC;IAEhD,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEnE,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,mDAmE3B,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,QAAQ,CAAC,CAAC;AAErE,KAAK,qBAAqB,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG;IACzE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF;;;GAGG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,2BAA2B;IAC3B,IAAI,EAAE,aAAa,CAAC;IAEpB,sBAAsB;IACtB,WAAW,EAAE,WAAW,CAAC;IAEzB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;IAEhD,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,mCAAmC;IACnC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,KAAK,CAAC,SAAS,CAAC;IAErE,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IAE5C;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEhD,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAEnE,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,mDAmE3B,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,gBAAgB,CAAC;CAC/B;AAED;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,4BAQpD"}
|
|
@@ -70,6 +70,7 @@ exports.TreeNodeRenderer = React.memo(function TreeNodeRenderer(props) {
|
|
|
70
70
|
* React component that renders icon for [[TreeNode]].
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
73
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
73
74
|
function TreeNodeIcon(props) {
|
|
74
75
|
const { imageLoader, node } = props;
|
|
75
76
|
const image = imageLoader.load(node.item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAA6C;AAE7C,iEAA8D;AAG9D,mEAAgE;AAGhE,+CAAgD;AAkDhD;;;GAGG;AACU,QAAA,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,gBAAgB,CAClE,KAA4B;IAE5B,MAAM,KAAK,GAAG,CACZ,oBAAC,6BAAe,IACd,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,eAAe,EAAE,KAAK,CAAC,kBAAkB,EACzC,cAAc,EAAE,KAAK,CAAC,kBAAkB,EACxC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,GAC5C,CACH,CAAC;IAEF,SAAS,iBAAiB;QACxB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU;YAAE,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YACvE,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,SAAS,aAAa,CAAC,CAAmB;QACxC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,mBAAmB,GAAG,CAC1B,YAA0B;IAC1B,mDAAmD;MAChC,EAAE,CAAC,CAAC;QACvB,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,UAAU,EAAE,YAAY,CA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,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,sBAAsB,EAAE,iBAAiB,EACzC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,EAAE,cAAc,EAAE,KAAK,CAAC,gBAAgB,EAAE,IAE1D,KAAK,CAAC,QAAQ,CACN,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/tree/controlled/component/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,kDAA6C;AAE7C,iEAA8D;AAG9D,mEAAgE;AAGhE,+CAAgD;AAkDhD;;;GAGG;AACU,QAAA,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,gBAAgB,CAClE,KAA4B;IAE5B,MAAM,KAAK,GAAG,CACZ,oBAAC,6BAAe,IACd,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAClB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,eAAe,EAAE,KAAK,CAAC,kBAAkB,EACzC,cAAc,EAAE,KAAK,CAAC,kBAAkB,EACxC,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,GAC5C,CACH,CAAC;IAEF,SAAS,iBAAiB;QACxB,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU;YAAE,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YACvE,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,SAAS,aAAa,CAAC,CAAmB;QACxC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,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,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,EACzE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EACnE,sBAAsB,EAAE,iBAAiB,EACzC,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,EAAE,cAAc,EAAE,KAAK,CAAC,gBAAgB,EAAE,IAE1D,KAAK,CAAC,QAAQ,CACN,CACZ,CAAC;AACJ,CAAC,CAAC,CAAC;AAcH;;;GAGG;AACH,mDAAmD;AACnD,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE1C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,QAAQ,GAAG,IAAI,6BAAa,EAAE,CAAC;IACrC,OAAO,0CAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAI,CAAC;AACvC,CAAC;AARD,oCAQC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tree\n */\n\nimport * as React from \"react\";\nimport type { CommonProps, NodeCheckboxProps } from \"@itwin/core-react\";\nimport { TreeNode } from \"@itwin/core-react\";\nimport type { Checkbox } from \"@itwin/itwinui-react\";\nimport { ImageRenderer } from \"../../../common/ImageRenderer\";\nimport type { HighlightableTreeNodeProps } from \"../../HighlightingEngine\";\nimport type { ITreeImageLoader } from \"../../ImageLoader\";\nimport { TreeComponentTestId } from \"../../TreeComponentTestId\";\nimport type { TreeActions } from \"../TreeActions\";\nimport type { CheckBoxInfo, TreeModelNode } from \"../TreeModel\";\nimport { TreeNodeContent } from \"./NodeContent\";\nimport type { TreeNodeEditorRenderer } from \"./TreeNodeEditor\";\n\ntype CheckboxProps = React.ComponentPropsWithoutRef<typeof Checkbox>;\n\ntype CheckboxRendererProps = Omit<CheckboxProps, \"onChange\" | \"onClick\"> & {\n onChange: (checked: boolean) => void;\n onClick: (e: React.MouseEvent) => void;\n};\n\n/**\n * Properties for [[TreeNodeRenderer]].\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface TreeNodeRendererProps extends CommonProps {\n /** Tree node to render. */\n node: TreeModelNode;\n\n /** Action handler. */\n treeActions: TreeActions;\n\n /** Properties used to highlight matches when tree is filtered. */\n nodeHighlightProps?: HighlightableTreeNodeProps;\n\n /** Specifies whether to show descriptions or not. */\n descriptionEnabled?: boolean;\n\n /** Image loader for node icons. */\n imageLoader?: ITreeImageLoader;\n\n /** Callback to render custom checkbox. */\n checkboxRenderer?: (props: CheckboxRendererProps) => React.ReactNode;\n\n /** Callback to render custom node editor when node is in editing mode. */\n nodeEditorRenderer?: TreeNodeEditorRenderer;\n\n /**\n * Callback used to detect when label is rendered. It is used by TreeRenderer for scrolling to active match.\n * @internal\n */\n onLabelRendered?: (node: TreeModelNode) => void;\n\n /** Callback that is invoked when context menu should be opened. */\n onContextMenu?: (e: React.MouseEvent, node: TreeModelNode) => void;\n\n /** Child components to render inside the node.*/\n children?: React.ReactNode;\n}\n\n/**\n * Default component for rendering tree node.\n * @public\n */\nexport const TreeNodeRenderer = React.memo(function TreeNodeRenderer(\n props: TreeNodeRendererProps\n) {\n const label = (\n <TreeNodeContent\n key={props.node.id}\n node={props.node}\n showDescription={props.descriptionEnabled}\n highlightProps={props.nodeHighlightProps}\n onLabelRendered={props.onLabelRendered}\n nodeEditorRenderer={props.nodeEditorRenderer}\n />\n );\n\n function onExpansionToggle() {\n if (props.node.isExpanded) props.treeActions.onNodeCollapsed(props.node.id);\n else props.treeActions.onNodeExpanded(props.node.id);\n }\n\n function onContextMenu(e: React.MouseEvent) {\n e.preventDefault();\n props.onContextMenu && props.onContextMenu(e, props.node);\n }\n\n const createCheckboxProps = (\n checkboxInfo: CheckBoxInfo\n // eslint-disable-next-line deprecation/deprecation\n ): NodeCheckboxProps => ({\n state: checkboxInfo.state,\n tooltip: checkboxInfo.tooltip,\n isDisabled: checkboxInfo.isDisabled,\n onClick: (newState) =>\n props.treeActions.onNodeCheckboxClicked(props.node.id, newState),\n });\n\n return (\n // eslint-disable-next-line deprecation/deprecation\n <TreeNode\n data-testid={TreeComponentTestId.Node}\n className={props.className}\n checkboxProps={\n props.node.checkbox.isVisible\n ? createCheckboxProps(props.node.checkbox)\n : undefined\n }\n style={props.style}\n isExpanded={props.node.isExpanded}\n isSelected={props.node.isSelected}\n isLoading={props.node.isLoading}\n isLeaf={props.node.numChildren === 0}\n icon={\n props.imageLoader ? (\n <TreeNodeIcon node={props.node} imageLoader={props.imageLoader} />\n ) : undefined\n }\n label={label}\n level={props.node.depth}\n onClick={(event) => props.treeActions.onNodeClicked(props.node.id, event)}\n onMouseDown={() => props.treeActions.onNodeMouseDown(props.node.id)}\n onMouseMove={() => props.treeActions.onNodeMouseMove(props.node.id)}\n onClickExpansionToggle={onExpansionToggle}\n onContextMenu={onContextMenu}\n renderOverrides={{ renderCheckbox: props.checkboxRenderer }}\n >\n {props.children}\n </TreeNode>\n );\n});\n\n/**\n * Props for [[TreeNodeIcon]] component.\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof TreeNodeIcon>`\n */\nexport interface TreeNodeIconProps {\n /** Tree node to render icon for. */\n node: TreeModelNode;\n /** Image loader used to load tree node icon. */\n imageLoader: ITreeImageLoader;\n}\n\n/**\n * React component that renders icon for [[TreeNode]].\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function TreeNodeIcon(props: TreeNodeIconProps) {\n const { imageLoader, node } = props;\n const image = imageLoader.load(node.item);\n\n if (!image) return null;\n\n const renderer = new ImageRenderer();\n return <>{renderer.render(image)}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightedText.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC
|
|
1
|
+
{"version":3,"file":"HighlightedText.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IAEnC,UAAU,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAW1D"}
|
|
@@ -13,6 +13,7 @@ import { HighlightingEngine } from "../tree/HighlightingEngine";
|
|
|
13
13
|
* Also actively highlights one matched part which is selected with 'activeMatchIndex'
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
export function HighlightedText(props) {
|
|
17
18
|
const { searchText, activeMatchIndex, text, caseSensitive } = props;
|
|
18
19
|
const chunks = useMemo(() => findChunks(text, searchText, caseSensitive), [text, searchText, caseSensitive]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"HighlightedText.js","sourceRoot":"","sources":["../../../../src/components-react/common/HighlightedText.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAkBhE;;;;;GAKG;AACH,mDAAmD;AACnD,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IACpE,MAAM,MAAM,GAAG,OAAO,CACpB,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,EACjD,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,CAClC,CAAC;IACF,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAChD,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,CAAC,CACjC,CAAC;IACF,OAAO,0CAAG,YAAY,CAAI,CAAC;AAC7B,CAAC;AAOD,SAAS,UAAU,CACjB,IAAY,EACZ,UAAkB,EAClB,aAAuB;IAEvB,MAAM,MAAM,GAAuB,EAAE,CAAC;IACtC,MAAM,WAAW,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9D,MAAM,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACxE,IAAI,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE3C,OAAO,KAAK,KAAK,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,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrE,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC;QAC7B,UAAU,CAAC,IAAI,CAAC,8BAAM,GAAG,EAAE,aAAa,IAAG,iBAAiB,CAAQ,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,WAAW,CAAC,MAA0B,EAAE,WAAoB;IACnE,MAAM,YAAY,GAAuB,EAAE,CAAC;IAC5C,IAAI,SAAoE,CAAC;IACzE,IAAI,cAAkC,CAAC;IAEvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,QAAQ,GAAG,CAAC,KAAK,WAAW,CAAC;QACnC,IACE,SAAS;YACT,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK;YAClC,CAAC,QAAQ;YACT,CAAC,SAAS,CAAC,QAAQ,EACnB,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;YAC/B,SAAS;QACX,CAAC;QACD,QAAQ,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;QACxD,SAAS,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACzC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport React, { useMemo } from \"react\";\nimport { HighlightingEngine } from \"../tree/HighlightingEngine\";\n\n/**\n * Properties of [[HighlightedText]]\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof HighlightedText>`\n */\nexport interface HighlightedTextProps {\n /* Filter text which we want to highlight */\n searchText: string;\n /* Index of actively highlighted part in a text */\n activeMatchIndex?: number;\n /* Full text */\n text: string;\n /** Should search be case sensitive */\n caseSensitive?: boolean;\n}\n\n/**\n * Highlighted text\n * Used for highlighting parts in the 'text' which match with 'searchText'\n * Also actively highlights one matched part which is selected with 'activeMatchIndex'\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function HighlightedText(props: HighlightedTextProps) {\n const { searchText, activeMatchIndex, text, caseSensitive } = props;\n const chunks = useMemo(\n () => findChunks(text, searchText, caseSensitive),\n [text, searchText, caseSensitive]\n );\n const markedChunks = useMemo(\n () => markChunks(text, chunks, activeMatchIndex),\n [text, chunks, activeMatchIndex]\n );\n return <>{markedChunks}</>;\n}\n\ninterface HighlightedChunk {\n start: number;\n end: number;\n}\n\nfunction findChunks(\n text: string,\n searchText: string,\n caseSensitive?: boolean\n): HighlightedChunk[] {\n const chunks: HighlightedChunk[] = [];\n const contentText = caseSensitive ? text : text.toLowerCase();\n const inputText = caseSensitive ? searchText : searchText.toLowerCase();\n let index = contentText.indexOf(inputText);\n\n while (index !== -1) {\n chunks.push({ start: index, end: index + inputText.length });\n index = contentText.indexOf(inputText, index + 1);\n }\n\n return chunks;\n}\n\nfunction markChunks(\n text: string,\n chunks: HighlightedChunk[],\n activeChunk?: number\n) {\n const markedText: React.ReactElement[] = [];\n let previousIndex = 0;\n\n const { mergedChunks, newActiveIndex } = mergeChunks(chunks, activeChunk);\n\n for (let i = 0; i < mergedChunks.length; i++) {\n const { start, end } = mergedChunks[i];\n\n // add unmarked text between previous chunk and current one\n const nonMarkedText = text.substring(previousIndex, start);\n if (nonMarkedText.length) {\n markedText.push(<span key={previousIndex}>{nonMarkedText}</span>);\n }\n\n // add marked chunk text\n markedText.push(\n <mark\n key={start}\n className={\n i === newActiveIndex\n ? HighlightingEngine.ACTIVE_CLASS_NAME\n : undefined\n }\n >\n {text.substring(start, end)}\n </mark>\n );\n previousIndex = end;\n }\n\n // add unmarked text after last chunk\n const lastNonMarkedText = text.substring(previousIndex, text.length);\n if (lastNonMarkedText.length) {\n markedText.push(<span key={previousIndex}>{lastNonMarkedText}</span>);\n }\n\n return markedText;\n}\n\nfunction mergeChunks(chunks: HighlightedChunk[], activeChunk?: number) {\n const mergedChunks: HighlightedChunk[] = [];\n let lastChunk: { isActive: boolean; info: HighlightedChunk } | undefined;\n let newActiveIndex: number | undefined;\n\n for (let i = 0; i < chunks.length; i++) {\n const chunk = chunks[i];\n const isActive = i === activeChunk;\n if (\n lastChunk &&\n lastChunk.info.end === chunk.start &&\n !isActive &&\n !lastChunk.isActive\n ) {\n lastChunk.info.end = chunk.end;\n continue;\n }\n isActive && (newActiveIndex = mergedChunks.length);\n const newChunk = { start: chunk.start, end: chunk.end };\n lastChunk = { isActive, info: newChunk };\n mergedChunks.push(newChunk);\n }\n return { mergedChunks, newActiveIndex };\n}\n"]}
|
|
@@ -36,6 +36,7 @@ export interface PropertyEditorProps extends CommonProps {
|
|
|
36
36
|
}
|
|
37
37
|
/** [[EditorContainer]] React component properties
|
|
38
38
|
* @public
|
|
39
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`
|
|
39
40
|
*/
|
|
40
41
|
export interface EditorContainerProps extends CommonProps {
|
|
41
42
|
/** The property being updated. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED
|
|
1
|
+
{"version":3,"file":"EditorContainer.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAGV,cAAc,EACd,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AAEH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,kCAAkC;IAClC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,yBAAyB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,uBAAuB;IACvB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;GAGG;AAEH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,kCAAkC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC9C,yBAAyB;IACzB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gBAAgB;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAC3D,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAmL1D"}
|
|
@@ -13,6 +13,7 @@ import { PropertyEditorManager } from "./PropertyEditorManager";
|
|
|
13
13
|
/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
16
17
|
export function EditorContainer(props) {
|
|
17
18
|
const { ignoreEditorBlur, title, shouldCommitOnChange, propertyRecord, setFocus, onCommit, onCancel, ...rest } = props;
|
|
18
19
|
const editorRef = React.useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAwEhE;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,gBAAgB,EAChB,KAAK,EACL,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAA0B,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAkC,CAAC;IAEzE,MAAM,WAAW,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACjE,MAAM,mBAAmB,GAAG,CAAC,CAAmB,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC;IACzE,MAAM,kBAAkB,GAAG,CAAC,IAAyB,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;IAE5E,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;QACvC,MAAM,QAAQ,G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QAAQ,CAAC,EAAE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,QAAuB,EAAE,QAAuB;IACpE,IACE,QAAQ,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW;QAC7C,QAAQ,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,EACtD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,iBAAiB,GAAG,QAA0B,CAAC;IACrD,IAAI,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IACE,CAAC,CAAC,iBAAiB,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;QAC5C,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"EditorContainer.js","sourceRoot":"","sources":["../../../../src/components-react/editors/EditorContainer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAMrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAyEhE;;GAEG;AACH,mDAAmD;AACnD,MA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AAC;IACD,OAAO,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,KAAM,EAAE,QAAQ,CAAC,KAAM,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyEditors\n */\n\nimport \"./EditorContainer.scss\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, UiAdmin } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type {\n AsyncErrorMessage,\n PropertyEditorBase,\n} from \"./PropertyEditorManager\";\nimport { PropertyEditorManager } from \"./PropertyEditorManager\";\n\n/** Arguments for the Property Updated event callback\n * @public\n */\nexport interface PropertyUpdatedArgs {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** The new value for the property. */\n newValue: PropertyValue;\n}\n\n/** Properties for a property editor component\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface PropertyEditorProps extends CommonProps {\n /** The property being updated. */\n propertyRecord?: PropertyRecord;\n /** Handler for commit */\n onCommit?: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel?: () => void;\n /** Handler for blur */\n onBlur?: (event: React.FocusEvent) => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\n/** [[EditorContainer]] React component properties\n * @public\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof EditorContainer>`\n */\n// eslint-disable-next-line deprecation/deprecation\nexport interface EditorContainerProps extends CommonProps {\n /** The property being updated. */\n propertyRecord: PropertyRecord;\n /** Tooltip text */\n title?: string;\n /** Handler for commit */\n onCommit: (args: PropertyUpdatedArgs) => void;\n /** Handler for cancel */\n onCancel: () => void;\n /** Indicates whether the Property Editor should set focus */\n setFocus?: boolean;\n\n /** @internal */\n ignoreEditorBlur?: boolean;\n /**\n * Indicates whether value change should call onCommit().\n * @internal\n */\n shouldCommitOnChange?: boolean;\n}\n\ninterface CloneProps extends PropertyEditorProps {\n ref: (ref: TypeEditor | null) => void;\n}\n\n/** Interface implemented by React based type editors\n * @public\n */\nexport interface TypeEditor {\n getPropertyValue: () => Promise<PropertyValue | undefined>;\n htmlElement: HTMLElement | null;\n hasFocus: boolean;\n}\n\n/** EditorContainer React component used by the Tree and PropertyGrid for cell editing.\n * @public\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function EditorContainer(props: EditorContainerProps) {\n const {\n ignoreEditorBlur,\n title,\n shouldCommitOnChange,\n propertyRecord,\n setFocus,\n onCommit,\n onCancel,\n ...rest\n } = props;\n\n const editorRef = React.useRef<TypeEditor | undefined>();\n const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();\n\n const handleClick = (e: React.MouseEvent) => e.stopPropagation();\n const handleContainerBlur = (e: React.FocusEvent) => e.stopPropagation();\n const handleEditorCommit = (args: PropertyUpdatedArgs) => void commit(args);\n\n const handleContainerCommit = async () => {\n const newValue = editorRef && (await editorRef.current?.getPropertyValue());\n if (newValue === undefined) return;\n void commit({\n propertyRecord,\n newValue,\n });\n };\n\n const onPressEscape = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEscape) return;\n e.stopPropagation();\n onCancel();\n };\n\n const onPressEnter = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesEnter) return;\n if (editorRef?.current?.hasFocus) e.stopPropagation();\n void handleContainerCommit();\n };\n\n const onPressTab = (e: React.KeyboardEvent) => {\n if (!propertyEditorRef.current?.containerHandlesTab) return;\n e.stopPropagation();\n e.preventDefault();\n void handleContainerCommit();\n };\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case Key.Escape.valueOf():\n onPressEscape(e);\n break;\n case Key.Enter.valueOf():\n onPressEnter(e);\n break;\n case Key.Tab.valueOf():\n onPressTab(e);\n break;\n default:\n if (propertyEditorRef.current?.containerStopsKeydownPropagation)\n e.stopPropagation();\n }\n };\n\n const handleEditorBlur = () => {\n if (ignoreEditorBlur) return;\n if (!propertyEditorRef.current?.containerHandlesBlur) return;\n void handleContainerCommit();\n };\n\n const isNewValueValid = async (value: PropertyValue) => {\n if (!propertyEditorRef.current) return false;\n if (!propertyRecord) return false;\n\n const validateResult = await propertyEditorRef.current.validateValue(\n value,\n propertyRecord\n );\n\n if (validateResult.encounteredError) {\n displayOutputMessage(validateResult.errorMessage);\n return false;\n }\n\n return true;\n };\n\n const displayOutputMessage = (\n errorMessage: AsyncErrorMessage | undefined\n ) => {\n if (!errorMessage) return;\n if (!editorRef) return;\n\n const htmlElement = editorRef.current?.htmlElement;\n if (htmlElement)\n UiAdmin.messagePresenter.displayInputFieldMessage(\n htmlElement,\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage\n );\n else\n UiAdmin.messagePresenter.displayMessage(\n errorMessage.severity,\n errorMessage.briefMessage,\n errorMessage.detailedMessage,\n errorMessage.messageType\n );\n };\n\n const commit = async (args: PropertyUpdatedArgs) => {\n const oldValue = args.propertyRecord.value;\n const newValue = args.newValue;\n\n if (!shouldCommit(oldValue, newValue)) {\n return;\n }\n\n const isValid = await isNewValueValid(newValue);\n if (!isValid) return;\n\n if (propertyEditorRef.current && args.propertyRecord) {\n const commitResult = await propertyEditorRef.current.commitValue(\n newValue,\n args.propertyRecord\n );\n if (commitResult.encounteredError) {\n displayOutputMessage(commitResult.errorMessage);\n return;\n }\n }\n\n onCommit(args);\n };\n\n const editorProps: CloneProps = {\n ref: (ref) => {\n editorRef.current = ref ?? undefined;\n },\n onCommit: handleEditorCommit,\n onCancel,\n onBlur: handleEditorBlur,\n setFocus: setFocus !== undefined ? setFocus : true,\n propertyRecord,\n shouldCommitOnChange,\n ...rest,\n };\n\n const propDescription = propertyRecord.property;\n\n const editorName =\n propDescription.editor !== undefined\n ? propDescription.editor.name\n : undefined;\n\n propertyEditorRef.current = PropertyEditorManager.createEditor(\n propDescription.typename,\n editorName,\n propDescription.dataController\n );\n\n const clonedNode = React.isValidElement(propertyEditorRef.current.reactNode)\n ? React.cloneElement(propertyEditorRef.current.reactNode, editorProps)\n : undefined;\n\n return (\n <span\n className=\"components-editor-container\"\n onBlur={handleContainerBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleClick}\n title={title}\n data-testid=\"editor-container\"\n role=\"presentation\"\n >\n {clonedNode}\n </span>\n );\n}\n\nfunction arePrimitiveValuesEqual(\n oldValue: Primitives.Value,\n newValue: Primitives.Value\n): boolean {\n if (typeof oldValue !== typeof newValue) {\n return false;\n }\n // directly compare simple types\n if (typeof newValue !== \"object\" || newValue instanceof Date) {\n return newValue === oldValue;\n }\n // compare all members of arrays\n if (newValue instanceof Array) {\n if (!(oldValue instanceof Array)) {\n return false;\n }\n if (newValue.length !== oldValue.length) {\n return false;\n }\n for (let i = 0; i < newValue.length; i++) {\n if (oldValue[i] !== newValue[i]) {\n return false;\n }\n }\n return true;\n }\n // compare `Point2d` and `Point3d` types\n if (\"x\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"x\" in oldValue)) {\n return false;\n }\n if (\"z\" in newValue) {\n if (!(\"z\" in oldValue)) {\n return false;\n }\n return (\n newValue.x === oldValue.x &&\n newValue.y === oldValue.y &&\n newValue.z === oldValue.z\n );\n } else if (\"z\" in oldValue) {\n return false;\n }\n return newValue.x === oldValue.x && newValue.y === oldValue.y;\n }\n // compare instance keys\n if (\"className\" in newValue) {\n if (typeof oldValue !== \"object\" || !(\"className\" in oldValue)) {\n return false;\n }\n return (\n oldValue.className === newValue.className && oldValue.id === newValue.id\n );\n }\n return false;\n}\n\nfunction shouldCommit(oldValue: PropertyValue, newValue: PropertyValue) {\n if (\n oldValue.valueFormat !== newValue.valueFormat ||\n newValue.valueFormat !== PropertyValueFormat.Primitive\n ) {\n return true;\n }\n const oldPrimitiveValue = oldValue as PrimitiveValue;\n if (!oldPrimitiveValue.value && !newValue.value) {\n return false;\n }\n if (\n (!oldPrimitiveValue.value && newValue.value) ||\n (oldPrimitiveValue.value && !newValue.value)\n ) {\n return true;\n }\n return !arePrimitiveValuesEqual(oldPrimitiveValue.value!, newValue.value!);\n}\n"]}
|
|
@@ -57,6 +57,7 @@ export declare class PopupButton extends React.PureComponent<PopupButtonProps, P
|
|
|
57
57
|
export declare function PopupContent(props: CommonDivProps): React.JSX.Element;
|
|
58
58
|
/** Properties for [[PopupOkCancelButtons]] component
|
|
59
59
|
* @alpha
|
|
60
|
+
* @deprecated in 4.17.0. Use `React.ComponentProps<typeof PopupOkCancelButtons>`
|
|
60
61
|
*/
|
|
61
62
|
export interface OkCancelProps {
|
|
62
63
|
onOk: (event: React.MouseEvent) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/PopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUrE;;GAEG;AAEH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAEjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wKAAwK;IACxK,WAAW,CAAC,E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;CAoE1C;AAED;;GAEG;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,qBAGjD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AAEH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,qBA+BxD"}
|
|
@@ -79,6 +79,7 @@ export function PopupContent(props) {
|
|
|
79
79
|
/** OK/Cancel Buttons
|
|
80
80
|
* @alpha
|
|
81
81
|
*/
|
|
82
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
82
83
|
export function PopupOkCancelButtons(props) {
|
|
83
84
|
const { translate } = useTranslation();
|
|
84
85
|
return (React.createElement("div", { className: "components-popup-bottom-buttons" },
|