@itwin/presentation-testing 4.0.0-dev.4 → 4.0.0-dev.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +972 -959
- package/LICENSE.md +9 -9
- package/README.md +7 -7
- package/lib/cjs/presentation-testing/ContentBuilder.d.ts +92 -89
- package/lib/cjs/presentation-testing/ContentBuilder.d.ts.map +1 -1
- package/lib/cjs/presentation-testing/ContentBuilder.js +178 -149
- package/lib/cjs/presentation-testing/ContentBuilder.js.map +1 -1
- package/lib/cjs/presentation-testing/Helpers.d.ts +45 -42
- package/lib/cjs/presentation-testing/Helpers.d.ts.map +1 -1
- package/lib/cjs/presentation-testing/Helpers.js +152 -139
- package/lib/cjs/presentation-testing/Helpers.js.map +1 -1
- package/lib/cjs/presentation-testing/HierarchyBuilder.d.ts +69 -66
- package/lib/cjs/presentation-testing/HierarchyBuilder.d.ts.map +1 -1
- package/lib/cjs/presentation-testing/HierarchyBuilder.js +80 -67
- package/lib/cjs/presentation-testing/HierarchyBuilder.js.map +1 -1
- package/lib/cjs/presentation-testing/IModelUtilities.d.ts +60 -46
- package/lib/cjs/presentation-testing/IModelUtilities.d.ts.map +1 -1
- package/lib/cjs/presentation-testing/IModelUtilities.js +86 -77
- package/lib/cjs/presentation-testing/IModelUtilities.js.map +1 -1
- package/lib/cjs/presentation-testing.d.ts +28 -28
- package/lib/cjs/presentation-testing.d.ts.map +1 -1
- package/lib/cjs/presentation-testing.js +48 -44
- package/lib/cjs/presentation-testing.js.map +1 -1
- package/lib/esm/presentation-testing/ContentBuilder.d.ts +92 -89
- package/lib/esm/presentation-testing/ContentBuilder.d.ts.map +1 -1
- package/lib/esm/presentation-testing/ContentBuilder.js +174 -145
- package/lib/esm/presentation-testing/ContentBuilder.js.map +1 -1
- package/lib/esm/presentation-testing/Helpers.d.ts +45 -42
- package/lib/esm/presentation-testing/Helpers.d.ts.map +1 -1
- package/lib/esm/presentation-testing/Helpers.js +123 -114
- package/lib/esm/presentation-testing/Helpers.js.map +1 -1
- package/lib/esm/presentation-testing/HierarchyBuilder.d.ts +69 -66
- package/lib/esm/presentation-testing/HierarchyBuilder.d.ts.map +1 -1
- package/lib/esm/presentation-testing/HierarchyBuilder.js +75 -62
- package/lib/esm/presentation-testing/HierarchyBuilder.js.map +1 -1
- package/lib/esm/presentation-testing/IModelUtilities.d.ts +60 -46
- package/lib/esm/presentation-testing/IModelUtilities.d.ts.map +1 -1
- package/lib/esm/presentation-testing/IModelUtilities.js +77 -69
- package/lib/esm/presentation-testing/IModelUtilities.js.map +1 -1
- package/lib/esm/presentation-testing.d.ts +28 -28
- package/lib/esm/presentation-testing.d.ts.map +1 -1
- package/lib/esm/presentation-testing.js +32 -32
- package/lib/esm/presentation-testing.js.map +1 -1
- package/package.json +59 -55
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelUtilities.js","sourceRoot":"","sources":["../../../src/presentation-testing/IModelUtilities.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"IModelUtilities.js","sourceRoot":"","sources":["../../../src/presentation-testing/IModelUtilities.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;AAEH,gDAAwB;AACxB,0EAAyC;AACzC,sDAAuE;AAEvE,oDAU4B;AAC5B,wDAA4E;AAC5E,uCAA6C;AAwCtC,KAAK,UAAU,eAAe,CAAC,SAAiC,EAAE,EAAwC;IAC/G,MAAM,IAAI,GAAG,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,SAAS,CAAC,IAAK,CAAC,SAAS,EAAE,CAAC,CAAC;IAC/G,MAAM,UAAU,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,GAAG,yBAAU,CAAC,WAAW,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAA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,CAAC,QAAgB;IAC/C,MAAM,aAAa,GAAG,IAAA,0BAAgB,GAAE,CAAC;IACzC,CAAC,yBAAU,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,yBAAU,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAE7E,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,QAAQ,MAAM,CAAC,CAAC;IAC/D,yBAAU,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,yBAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACvE,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,gBAAgB;AAChB,SAAgB,wBAAwB,CAAC,GAAW;IAClD,OAAO,IAAA,2BAAQ,EAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;AAC7D,CAAC;AAFD,4DAEC","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 IModel\n */\n\nimport path from \"path\";\nimport sanitize from \"sanitize-filename\";\nimport { IModelDb, IModelJsFs, SnapshotDb } from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport {\n BisCodeSpec,\n Code,\n CodeScopeProps,\n CodeSpec,\n ElementAspectProps,\n ElementProps,\n LocalFileName,\n ModelProps,\n RelationshipProps,\n} from \"@itwin/core-common\";\nimport { IModelConnection, SnapshotConnection } from \"@itwin/core-frontend\";\nimport { getTestOutputDir } from \"./Helpers\";\n\n/**\n * Interface for IModel builder pattern. Used for building IModels to test rulesets.\n * @beta\n */\nexport interface TestIModelBuilder {\n /** Insert a model into the builder's iModel */\n insertModel<TProps extends ModelProps>(props: TProps): Id64String;\n /** Insert an element into the builder's iModel */\n insertElement<TProps extends ElementProps>(props: TProps): Id64String;\n /** Insert an element aspect into the specified element */\n insertAspect<TProps extends ElementAspectProps>(props: TProps): void;\n /**\n * Insert a relationship between two instances. The relationship is expected to be a subclass\n * of `BisCore:ElementRefersToElements` or `BisCore:ElementDrivesElement`.\n */\n insertRelationship<TProps extends RelationshipProps>(props: TProps): Id64String;\n /**\n * Create code for specified element.\n * Code value has to be unique within its scope (see [Codes documentation page]($docs/bis/guide/fundamentals/codes.md)).\n */\n createCode(scopeModelId: CodeScopeProps, codeSpecName: BisCodeSpec, codeValue: string): Code;\n}\n\n/**\n * Function that creates an iModel and returns a connection to it.\n * @param name Name of test IModel\n * @param cb Callback function that receives an [[TestIModelBuilder]] to fill the iModel with data\n * @beta\n */\nexport async function buildTestIModel(name: string, cb: (builder: TestIModelBuilder) => void): Promise<IModelConnection>;\n/**\n * Function that creates an iModel and returns a connection to it.\n * @param mochaContext Mocha context to generate iModel name from\n * @param cb Callback function that receives an [[TestIModelBuilder]] to fill the iModel with data\n * @beta\n */\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport async function buildTestIModel(mochaContext: Mocha.Context, cb: (builder: TestIModelBuilder) => void): Promise<IModelConnection>;\nexport async function buildTestIModel(nameParam: string | Mocha.Context, cb: (builder: TestIModelBuilder) => void): Promise<IModelConnection> {\n const name = typeof nameParam === \"string\" ? nameParam : createFileNameFromString(nameParam.test!.fullTitle());\n const outputFile = setupOutputFileLocation(name);\n const db = SnapshotDb.createEmpty(outputFile, { rootSubject: { name } });\n const builder = new IModelBuilder(db);\n try {\n cb(builder);\n } finally {\n db.saveChanges(\"Created test IModel\");\n db.close();\n }\n return SnapshotConnection.openFile(outputFile);\n}\n\n/**\n * Default implementation of IModel builder pattern. Used for building IModels to test rulesets.\n *\n * @internal\n */\nexport class IModelBuilder implements TestIModelBuilder {\n private _iModel: IModelDb;\n\n constructor(iModel: IModelDb) {\n this._iModel = iModel;\n }\n\n public insertModel<TProps extends ModelProps>(props: TProps): Id64String {\n return this._iModel.models.insertModel(props);\n }\n\n public insertElement<TProps extends ElementProps>(props: TProps): Id64String {\n return this._iModel.elements.insertElement(props);\n }\n\n public insertAspect<TProps extends ElementAspectProps>(props: TProps): void {\n this._iModel.elements.insertAspect(props);\n }\n\n public insertRelationship<TProps extends RelationshipProps>(props: TProps): Id64String {\n return this._iModel.relationships.insertInstance(props);\n }\n\n public createCode(scopeModelId: CodeScopeProps, codeSpecName: BisCodeSpec, codeValue: string): Code {\n const codeSpec: CodeSpec = this._iModel.codeSpecs.getByName(codeSpecName);\n return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });\n }\n}\n\n/**\n * Prepare for an output file by:\n * - Resolving the output file name under the known test output directory\n * - Making directories as necessary\n * - Removing a previous copy of the output file\n * @param fileName Name of output file\n */\nfunction setupOutputFileLocation(fileName: string): LocalFileName {\n const testOutputDir = getTestOutputDir();\n !IModelJsFs.existsSync(testOutputDir) && IModelJsFs.mkdirSync(testOutputDir);\n\n const outputFile = path.join(testOutputDir, `${fileName}.bim`);\n IModelJsFs.existsSync(outputFile) && IModelJsFs.unlinkSync(outputFile);\n return outputFile;\n}\n\n/** @internal */\nexport function createFileNameFromString(str: string) {\n return sanitize(str.replace(\" \", \"-\")).toLocaleLowerCase();\n}\n"]}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Hierarchies
|
|
3
|
-
*
|
|
4
|
-
* @docs-group-description Hierarchies
|
|
5
|
-
* Types for testing hierarchies.
|
|
6
|
-
*/
|
|
7
|
-
export * from "./presentation-testing/HierarchyBuilder";
|
|
8
|
-
/**
|
|
9
|
-
* @module Content
|
|
10
|
-
*
|
|
11
|
-
* @docs-group-description Content
|
|
12
|
-
* Types for testing content.
|
|
13
|
-
*/
|
|
14
|
-
export * from "./presentation-testing/ContentBuilder";
|
|
15
|
-
/**
|
|
16
|
-
* @module Helpers
|
|
17
|
-
*
|
|
18
|
-
* @docs-group-description Helpers
|
|
19
|
-
* Various test helpers.
|
|
20
|
-
*/
|
|
21
|
-
export * from "./presentation-testing/Helpers";
|
|
22
|
-
/**
|
|
23
|
-
* @module IModel
|
|
24
|
-
*
|
|
25
|
-
* @docs-group-description IModel
|
|
26
|
-
* Utilities for creating test iModels that can be used to exercise presentation rules.
|
|
27
|
-
*/
|
|
28
|
-
export * from "./presentation-testing/IModelUtilities";
|
|
1
|
+
/**
|
|
2
|
+
* @module Hierarchies
|
|
3
|
+
*
|
|
4
|
+
* @docs-group-description Hierarchies
|
|
5
|
+
* Types for testing hierarchies.
|
|
6
|
+
*/
|
|
7
|
+
export * from "./presentation-testing/HierarchyBuilder";
|
|
8
|
+
/**
|
|
9
|
+
* @module Content
|
|
10
|
+
*
|
|
11
|
+
* @docs-group-description Content
|
|
12
|
+
* Types for testing content.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./presentation-testing/ContentBuilder";
|
|
15
|
+
/**
|
|
16
|
+
* @module Helpers
|
|
17
|
+
*
|
|
18
|
+
* @docs-group-description Helpers
|
|
19
|
+
* Various test helpers.
|
|
20
|
+
*/
|
|
21
|
+
export * from "./presentation-testing/Helpers";
|
|
22
|
+
/**
|
|
23
|
+
* @module IModel
|
|
24
|
+
*
|
|
25
|
+
* @docs-group-description IModel
|
|
26
|
+
* Utilities for creating test iModels that can be used to exercise presentation rules.
|
|
27
|
+
*/
|
|
28
|
+
export * from "./presentation-testing/IModelUtilities";
|
|
29
29
|
//# sourceMappingURL=presentation-testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-testing.d.ts","sourceRoot":"","sources":["../../src/presentation-testing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presentation-testing.d.ts","sourceRoot":"","sources":["../../src/presentation-testing.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,cAAc,yCAAyC,CAAC;AAExD;;;;;GAKG;AACH,cAAc,uCAAuC,CAAC;AAEtD;;;;;GAKG;AACH,cAAc,gCAAgC,CAAC;AAE/C;;;;;GAKG;AACH,cAAc,wCAAwC,CAAC"}
|
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
/**
|
|
22
|
+
* @module Hierarchies
|
|
23
|
+
*
|
|
24
|
+
* @docs-group-description Hierarchies
|
|
25
|
+
* Types for testing hierarchies.
|
|
26
|
+
*/
|
|
27
|
+
__exportStar(require("./presentation-testing/HierarchyBuilder"), exports);
|
|
28
|
+
/**
|
|
29
|
+
* @module Content
|
|
30
|
+
*
|
|
31
|
+
* @docs-group-description Content
|
|
32
|
+
* Types for testing content.
|
|
33
|
+
*/
|
|
34
|
+
__exportStar(require("./presentation-testing/ContentBuilder"), exports);
|
|
35
|
+
/**
|
|
36
|
+
* @module Helpers
|
|
37
|
+
*
|
|
38
|
+
* @docs-group-description Helpers
|
|
39
|
+
* Various test helpers.
|
|
40
|
+
*/
|
|
41
|
+
__exportStar(require("./presentation-testing/Helpers"), exports);
|
|
42
|
+
/**
|
|
43
|
+
* @module IModel
|
|
44
|
+
*
|
|
45
|
+
* @docs-group-description IModel
|
|
46
|
+
* Utilities for creating test iModels that can be used to exercise presentation rules.
|
|
47
|
+
*/
|
|
48
|
+
__exportStar(require("./presentation-testing/IModelUtilities"), exports);
|
|
45
49
|
//# sourceMappingURL=presentation-testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-testing.js","sourceRoot":"","sources":["../../src/presentation-testing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"presentation-testing.js","sourceRoot":"","sources":["../../src/presentation-testing.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;AAEhG;;;;;GAKG;AACH,0EAAwD;AAExD;;;;;GAKG;AACH,wEAAsD;AAEtD;;;;;GAKG;AACH,iEAA+C;AAE/C;;;;;GAKG;AACH,yEAAuD","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/**\n * @module Hierarchies\n *\n * @docs-group-description Hierarchies\n * Types for testing hierarchies.\n */\nexport * from \"./presentation-testing/HierarchyBuilder\";\n\n/**\n * @module Content\n *\n * @docs-group-description Content\n * Types for testing content.\n */\nexport * from \"./presentation-testing/ContentBuilder\";\n\n/**\n * @module Helpers\n *\n * @docs-group-description Helpers\n * Various test helpers.\n */\nexport * from \"./presentation-testing/Helpers\";\n\n/**\n * @module IModel\n *\n * @docs-group-description IModel\n * Utilities for creating test iModels that can be used to exercise presentation rules.\n */\nexport * from \"./presentation-testing/IModelUtilities\";\n"]}
|
|
@@ -1,90 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
records
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Content
|
|
3
|
+
*/
|
|
4
|
+
import { PropertyRecord } from "@itwin/appui-abstract";
|
|
5
|
+
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
|
+
import { Content, InstanceKey, KeySet, PageOptions, Ruleset } from "@itwin/presentation-common";
|
|
7
|
+
/**
|
|
8
|
+
* Interface for a data provider, which is used by ContentBuilder.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface IContentBuilderDataProvider {
|
|
12
|
+
/** Keys the data provider is creating content for */
|
|
13
|
+
keys: Readonly<KeySet>;
|
|
14
|
+
/** Get the size of content result set */
|
|
15
|
+
getContentSetSize: () => Promise<number>;
|
|
16
|
+
/** Get the content */
|
|
17
|
+
getContent: (options?: PageOptions) => Promise<Readonly<Content> | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Property records grouped under a single className
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface ContentBuilderResult {
|
|
24
|
+
/** Full name of ECClass whose records are contained in this data structure */
|
|
25
|
+
className: string;
|
|
26
|
+
/** Property records for the ECClass instance */
|
|
27
|
+
records: PropertyRecord[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Properties for creating a `ContentBuilder` instance.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export interface ContentBuilderProps {
|
|
34
|
+
/** The iModel to pull data from */
|
|
35
|
+
imodel: IModelConnection;
|
|
36
|
+
/** Custom data provider that allows mocking data ContentBuilder receives */
|
|
37
|
+
dataProvider?: IContentBuilderDataProvider;
|
|
38
|
+
/**
|
|
39
|
+
* Decimal precision or numeric types.
|
|
40
|
+
*
|
|
41
|
+
* Raw numeric values with high precision may slightly differ from platform to platform due to
|
|
42
|
+
* rounding differences on different platforms. This may be a problem when used with snapshot testing,
|
|
43
|
+
* in which case this attribute may be set to supply the maximum precision of raw numeric values.
|
|
44
|
+
*
|
|
45
|
+
* By default no rounding is applied.
|
|
46
|
+
*/
|
|
47
|
+
decimalPrecision?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A class that constructs content from specified imodel and ruleset.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export declare class ContentBuilder {
|
|
54
|
+
private readonly _iModel;
|
|
55
|
+
private _dataProvider;
|
|
56
|
+
private _decimalPrecision?;
|
|
57
|
+
/**
|
|
58
|
+
* Constructor
|
|
59
|
+
* @param iModel
|
|
60
|
+
* @param dataProvider
|
|
61
|
+
*/
|
|
62
|
+
constructor(props: ContentBuilderProps);
|
|
63
|
+
private doCreateContent;
|
|
64
|
+
/**
|
|
65
|
+
* Create a list of property records using the supplied presentation ruleset.
|
|
66
|
+
* @param rulesetOrId Either a [Ruleset]($presentation-common) object or a ruleset id.
|
|
67
|
+
* @param instanceKeys Keys of instances that should be queried.
|
|
68
|
+
* @param displayType Type of content container display. For example:
|
|
69
|
+
* "PropertyPane", "Grid", "List" etc.
|
|
70
|
+
*/
|
|
71
|
+
createContent(rulesetOrId: Ruleset | string, instanceKeys: InstanceKey[], displayType?: string): Promise<PropertyRecord[]>;
|
|
72
|
+
private getECClassNames;
|
|
73
|
+
private createContentForClasses;
|
|
74
|
+
/**
|
|
75
|
+
* Create a list of grouped property records using the supplied presentation ruleset.
|
|
76
|
+
* Each group includes all of the class instances.
|
|
77
|
+
* @param rulesetOrId Either a [Ruleset]($presentation-common) object or a ruleset id.
|
|
78
|
+
* @param displayType Type of content container display. For example:
|
|
79
|
+
* "PropertyPane", "Grid", "List" etc.
|
|
80
|
+
* @deprecated in 3.x. This method turned out to be useless as it creates content for too many instances. Should use [[createContent]] instead.
|
|
81
|
+
*/
|
|
82
|
+
createContentForAllInstances(rulesetOrId: Ruleset | string, displayType?: string): Promise<ContentBuilderResult[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Create a list of grouped property records using the supplied presentation ruleset.
|
|
85
|
+
* Each group includes at most one class instance.
|
|
86
|
+
* @param rulesetOrId Either a [Ruleset]($presentation-common) object or a ruleset id.
|
|
87
|
+
* @param displayType Type of content container display. For example:
|
|
88
|
+
* "PropertyPane", "Grid", "List" etc.
|
|
89
|
+
* @deprecated in 3.x. This method turned out to be useless as it creates content for too many instances. Should use [[createContent]] instead.
|
|
90
|
+
*/
|
|
91
|
+
createContentForInstancePerClass(rulesetOrId: Ruleset | string, displayType?: string): Promise<ContentBuilderResult[]>;
|
|
92
|
+
}
|
|
90
93
|
//# sourceMappingURL=ContentBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentBuilder.d.ts","sourceRoot":"","sources":["../../../src/presentation-testing/ContentBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContentBuilder.d.ts","sourceRoot":"","sources":["../../../src/presentation-testing/ContentBuilder.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,OAAO,EAGP,WAAW,EACX,MAAM,EACN,WAAW,EAGX,OAAO,EAIR,MAAM,4BAA4B,CAAC;AAIpC;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,qDAAqD;IACrD,IAAI,EAAE,QAAQ,CAAC,MAAM,CA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