@itwin/presentation-frontend 4.5.0-dev.2 → 4.5.0-dev.21

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +1 -1
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  5. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +10 -6
  6. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  7. package/lib/cjs/presentation-frontend/Diagnostics.d.ts.map +1 -1
  8. package/lib/cjs/presentation-frontend/Diagnostics.js +18 -13
  9. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  10. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +3 -3
  11. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  13. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +3 -3
  14. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  15. package/lib/cjs/presentation-frontend/LocalizationHelper.js +3 -3
  16. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  17. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  18. package/lib/cjs/presentation-frontend/Presentation.js +26 -16
  19. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  20. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +7 -4
  21. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  22. package/lib/cjs/presentation-frontend/PresentationManager.js +131 -96
  23. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  24. package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
  25. package/lib/cjs/presentation-frontend/RulesetManager.js +11 -7
  26. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  28. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +53 -31
  29. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  30. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  32. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +179 -74
  33. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  34. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  38. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  39. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +16 -10
  40. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +3 -3
  42. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  43. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  44. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
  45. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  46. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +15 -9
  48. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  50. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +7 -5
  51. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  52. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +31 -16
  54. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  55. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  56. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +25 -14
  57. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  58. package/lib/cjs/presentation-frontend.js +3 -3
  59. package/lib/cjs/presentation-frontend.js.map +1 -1
  60. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts.map +1 -1
  61. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +10 -6
  62. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  63. package/lib/esm/presentation-frontend/Diagnostics.d.ts.map +1 -1
  64. package/lib/esm/presentation-frontend/Diagnostics.js +18 -13
  65. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  66. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +3 -3
  67. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  68. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  69. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +3 -3
  70. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  71. package/lib/esm/presentation-frontend/LocalizationHelper.js +3 -3
  72. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  73. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  74. package/lib/esm/presentation-frontend/Presentation.js +26 -16
  75. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  76. package/lib/esm/presentation-frontend/PresentationManager.d.ts +7 -4
  77. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  78. package/lib/esm/presentation-frontend/PresentationManager.js +131 -96
  79. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  80. package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
  81. package/lib/esm/presentation-frontend/RulesetManager.js +11 -7
  82. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  84. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +53 -31
  85. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  86. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +33 -4
  87. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  88. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +179 -74
  89. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  90. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  91. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +54 -25
  92. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  93. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  94. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  95. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +17 -11
  96. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  97. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +3 -3
  98. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  99. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  100. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +3 -3
  101. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  102. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  103. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +15 -9
  104. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  106. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +7 -5
  107. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  109. package/lib/esm/presentation-frontend/selection/SelectionManager.js +31 -16
  110. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  111. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  112. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +25 -14
  113. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  114. package/lib/esm/presentation-frontend.js +3 -3
  115. package/lib/esm/presentation-frontend.js.map +1 -1
  116. package/package.json +19 -16
@@ -1,172 +1,172 @@
1
- {
2
- "$schema": "../../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
- "id": "presentation-frontend/HiliteRules",
4
- "rules": [
5
- {
6
- "ruleType": "Content",
7
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Subject\", \"BisCore\")",
8
- "onlyIfNotHandled": true,
9
- "specifications": [
10
- {
11
- "specType": "ContentRelatedInstances",
12
- "relationshipPaths": [
13
- [
14
- {
15
- "relationship": {
16
- "schemaName": "BisCore",
17
- "className": "ElementOwnsChildElements"
18
- },
19
- "direction": "Forward",
20
- "targetClass": {
21
- "schemaName": "BisCore",
22
- "className": "Subject"
23
- },
24
- "count": "*"
25
- },
26
- {
27
- "relationship": {
28
- "schemaName": "BisCore",
29
- "className": "ElementOwnsChildElements"
30
- },
31
- "direction": "Forward",
32
- "targetClass": {
33
- "schemaName": "BisCore",
34
- "className": "PhysicalPartition"
35
- }
36
- }
37
- ]
38
- ]
39
- }
40
- ]
41
- },
42
- {
43
- "ruleType": "Content",
44
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Model\", \"BisCore\")",
45
- "onlyIfNotHandled": true,
46
- "specifications": [
47
- {
48
- "specType": "SelectedNodeInstances"
49
- }
50
- ]
51
- },
52
- {
53
- "ruleType": "ExtendedData",
54
- "condition": "ThisNode.IsOfClass(\"Model\", \"BisCore\") ORELSE ThisNode.IsOfClass(\"PhysicalPartition\", \"BisCore\")",
55
- "items": {
56
- "isModel": "true"
57
- }
58
- },
59
- {
60
- "ruleType": "Content",
61
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Category\", \"BisCore\")",
62
- "onlyIfNotHandled": true,
63
- "specifications": [
64
- {
65
- "specType": "ContentRelatedInstances",
66
- "relationshipPaths": [
67
- {
68
- "relationship": {
69
- "schemaName": "BisCore",
70
- "className": "CategoryOwnsSubCategories"
71
- },
72
- "direction": "Forward"
73
- }
74
- ]
75
- }
76
- ]
77
- },
78
- {
79
- "ruleType": "Content",
80
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"SubCategory\", \"BisCore\")",
81
- "onlyIfNotHandled": true,
82
- "specifications": [
83
- {
84
- "specType": "SelectedNodeInstances"
85
- }
86
- ]
87
- },
88
- {
89
- "ruleType": "ExtendedData",
90
- "condition": "ThisNode.IsOfClass(\"SubCategory\", \"BisCore\")",
91
- "items": {
92
- "isSubCategory": "true"
93
- }
94
- },
95
- {
96
- "ruleType": "Content",
97
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
98
- "onlyIfNotHandled": true,
99
- "specifications": [
100
- {
101
- "specType": "ContentRelatedInstances",
102
- "relationshipPaths": [
103
- [
104
- {
105
- "relationship": {
106
- "schemaName": "BisCore",
107
- "className": "ElementGroupsMembers"
108
- },
109
- "direction": "Forward"
110
- },
111
- {
112
- "relationship": {
113
- "schemaName": "BisCore",
114
- "className": "ElementOwnsChildElements"
115
- },
116
- "direction": "Forward",
117
- "count": "*"
118
- }
119
- ]
120
- ],
121
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
122
- }
123
- ]
124
- },
125
- {
126
- "ruleType": "Content",
127
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GeometricElement\", \"BisCore\")",
128
- "onlyIfNotHandled": true,
129
- "specifications": [
130
- {
131
- "specType": "ContentRelatedInstances",
132
- "relationshipPaths": [
133
- {
134
- "relationship": {
135
- "schemaName": "BisCore",
136
- "className": "ElementOwnsChildElements"
137
- },
138
- "direction": "Forward",
139
- "count": "*"
140
- }
141
- ],
142
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
143
- },
144
- {
145
- "specType": "SelectedNodeInstances"
146
- }
147
- ]
148
- },
149
- {
150
- "ruleType": "Content",
151
- "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Element\", \"BisCore\")",
152
- "priority": 0,
153
- "onlyIfNotHandled": true,
154
- "specifications": [
155
- {
156
- "specType": "ContentRelatedInstances",
157
- "relationshipPaths": [
158
- {
159
- "relationship": {
160
- "schemaName": "BisCore",
161
- "className": "ElementOwnsChildElements"
162
- },
163
- "direction": "Forward",
164
- "count": "*"
165
- }
166
- ],
167
- "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
168
- }
169
- ]
170
- }
171
- ]
172
- }
1
+ {
2
+ "$schema": "../../../node_modules/@itwin/presentation-common/Ruleset.schema.json",
3
+ "id": "presentation-frontend/HiliteRules",
4
+ "rules": [
5
+ {
6
+ "ruleType": "Content",
7
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Subject\", \"BisCore\")",
8
+ "onlyIfNotHandled": true,
9
+ "specifications": [
10
+ {
11
+ "specType": "ContentRelatedInstances",
12
+ "relationshipPaths": [
13
+ [
14
+ {
15
+ "relationship": {
16
+ "schemaName": "BisCore",
17
+ "className": "ElementOwnsChildElements"
18
+ },
19
+ "direction": "Forward",
20
+ "targetClass": {
21
+ "schemaName": "BisCore",
22
+ "className": "Subject"
23
+ },
24
+ "count": "*"
25
+ },
26
+ {
27
+ "relationship": {
28
+ "schemaName": "BisCore",
29
+ "className": "ElementOwnsChildElements"
30
+ },
31
+ "direction": "Forward",
32
+ "targetClass": {
33
+ "schemaName": "BisCore",
34
+ "className": "PhysicalPartition"
35
+ }
36
+ }
37
+ ]
38
+ ]
39
+ }
40
+ ]
41
+ },
42
+ {
43
+ "ruleType": "Content",
44
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Model\", \"BisCore\")",
45
+ "onlyIfNotHandled": true,
46
+ "specifications": [
47
+ {
48
+ "specType": "SelectedNodeInstances"
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ "ruleType": "ExtendedData",
54
+ "condition": "ThisNode.IsOfClass(\"Model\", \"BisCore\") ORELSE ThisNode.IsOfClass(\"PhysicalPartition\", \"BisCore\")",
55
+ "items": {
56
+ "isModel": "true"
57
+ }
58
+ },
59
+ {
60
+ "ruleType": "Content",
61
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Category\", \"BisCore\")",
62
+ "onlyIfNotHandled": true,
63
+ "specifications": [
64
+ {
65
+ "specType": "ContentRelatedInstances",
66
+ "relationshipPaths": [
67
+ {
68
+ "relationship": {
69
+ "schemaName": "BisCore",
70
+ "className": "CategoryOwnsSubCategories"
71
+ },
72
+ "direction": "Forward"
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "ruleType": "Content",
80
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"SubCategory\", \"BisCore\")",
81
+ "onlyIfNotHandled": true,
82
+ "specifications": [
83
+ {
84
+ "specType": "SelectedNodeInstances"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "ruleType": "ExtendedData",
90
+ "condition": "ThisNode.IsOfClass(\"SubCategory\", \"BisCore\")",
91
+ "items": {
92
+ "isSubCategory": "true"
93
+ }
94
+ },
95
+ {
96
+ "ruleType": "Content",
97
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GroupInformationElement\", \"BisCore\")",
98
+ "onlyIfNotHandled": true,
99
+ "specifications": [
100
+ {
101
+ "specType": "ContentRelatedInstances",
102
+ "relationshipPaths": [
103
+ [
104
+ {
105
+ "relationship": {
106
+ "schemaName": "BisCore",
107
+ "className": "ElementGroupsMembers"
108
+ },
109
+ "direction": "Forward"
110
+ },
111
+ {
112
+ "relationship": {
113
+ "schemaName": "BisCore",
114
+ "className": "ElementOwnsChildElements"
115
+ },
116
+ "direction": "Forward",
117
+ "count": "*"
118
+ }
119
+ ]
120
+ ],
121
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ "ruleType": "Content",
127
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"GeometricElement\", \"BisCore\")",
128
+ "onlyIfNotHandled": true,
129
+ "specifications": [
130
+ {
131
+ "specType": "ContentRelatedInstances",
132
+ "relationshipPaths": [
133
+ {
134
+ "relationship": {
135
+ "schemaName": "BisCore",
136
+ "className": "ElementOwnsChildElements"
137
+ },
138
+ "direction": "Forward",
139
+ "count": "*"
140
+ }
141
+ ],
142
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
143
+ },
144
+ {
145
+ "specType": "SelectedNodeInstances"
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "ruleType": "Content",
151
+ "condition": "ContentDisplayType = \"Graphics\" ANDALSO SelectedNode.IsOfClass(\"Element\", \"BisCore\")",
152
+ "priority": 0,
153
+ "onlyIfNotHandled": true,
154
+ "specifications": [
155
+ {
156
+ "specType": "ContentRelatedInstances",
157
+ "relationshipPaths": [
158
+ {
159
+ "relationship": {
160
+ "schemaName": "BisCore",
161
+ "className": "ElementOwnsChildElements"
162
+ },
163
+ "direction": "Forward",
164
+ "count": "*"
165
+ }
166
+ ],
167
+ "instanceFilter": "this.IsOfClass(\"GeometricElement\", \"BisCore\")"
168
+ }
169
+ ]
170
+ }
171
+ ]
172
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"HiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAC8F,MAAM,EAAE,OAAO,EACnH,MAAM,4BAA4B,CAAC;AAIpC,gBAAgB;AAEhB,eAAO,MAAM,cAAc,EAAE,OAAuC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,MAAM,CAAsE;IAEpF,OAAO;IAIP;;OAEG;WACW,MAAM,CAAC,KAAK,EAAE,sBAAsB;IAElD;;;;;;OAMG;IACU,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAmB1E;;;OAGG;IACI,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC;YAWvC,uBAAuB;IA2BvC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,mBAAmB;CAgB5B"}
1
+ {"version":3,"file":"HiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAqG,MAAM,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAIhK,gBAAgB;AAEhB,eAAO,MAAM,cAAc,EAAE,OAAuC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,UAAU,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,MAAM,CAAsE;IAEpF,OAAO;IAIP;;OAEG;WACW,MAAM,CAAC,KAAK,EAAE,sBAAsB;IAIlD;;;;;;OAMG;IACU,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAmB1E;;;OAGG;IACI,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC;YAWxC,uBAAuB;IA+BtC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,mBAAmB;CAgB5B"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module UnifiedSelection
8
8
  */
@@ -30,7 +30,9 @@ class HiliteSetProvider {
30
30
  /**
31
31
  * Create a hilite set provider for the specified iModel.
32
32
  */
33
- static create(props) { return new HiliteSetProvider(props); }
33
+ static create(props) {
34
+ return new HiliteSetProvider(props);
35
+ }
34
36
  /**
35
37
  * Get hilite set for instances and/or nodes whose keys are specified in the
36
38
  * given KeySet.
@@ -44,9 +46,9 @@ class HiliteSetProvider {
44
46
  const elementIds = new Array();
45
47
  const iterator = this.getHiliteSetIterator(selection);
46
48
  for await (const set of iterator) {
47
- modelIds.push(...set.models ?? []);
48
- subCategoryIds.push(...set.subCategories ?? []);
49
- elementIds.push(...set.elements ?? []);
49
+ modelIds.push(...(set.models ?? []));
50
+ subCategoryIds.push(...(set.subCategories ?? []));
51
+ elementIds.push(...(set.elements ?? []));
50
52
  }
51
53
  return {
52
54
  models: modelIds.length ? modelIds : undefined,
@@ -76,7 +78,11 @@ class HiliteSetProvider {
76
78
  for (const batch of keyBatches) {
77
79
  let loadedItems = 0;
78
80
  while (true) {
79
- const content = await Presentation_1.Presentation.presentation.getContentAndSize({ ...options, paging: { start: loadedItems, size: CONTENT_SET_PAGE_SIZE }, keys: batch });
81
+ const content = await Presentation_1.Presentation.presentation.getContentAndSize({
82
+ ...options,
83
+ paging: { start: loadedItems, size: CONTENT_SET_PAGE_SIZE },
84
+ keys: batch,
85
+ });
80
86
  if (!content) {
81
87
  break;
82
88
  }
@@ -141,6 +147,6 @@ class HiliteSetProvider {
141
147
  }
142
148
  exports.HiliteSetProvider = HiliteSetProvider;
143
149
  const CONTENT_SET_PAGE_SIZE = 1000;
144
- const isModelRecord = (rec) => (rec.extendedData && rec.extendedData.isModel);
145
- const isSubCategoryRecord = (rec) => (rec.extendedData && rec.extendedData.isSubCategory);
150
+ const isModelRecord = (rec) => rec.extendedData && rec.extendedData.isModel;
151
+ const isSubCategoryRecord = (rec) => rec.extendedData && rec.extendedData.isSubCategory;
146
152
  //# sourceMappingURL=HiliteSetProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HiliteSetProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAAqD;AACrD,mDAA+C;AAG/C,oEAEoC;AACpC,kDAA+C;AAC/C,yDAAiE;AAEjE,gBAAgB;AAChB,8DAA8D;AACjD,QAAA,cAAc,GAAY,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAsBrE;;;;;;GAMG;AACH,MAAa,iBAAiB;IAI5B,YAAoB,KAA6B;QAC/C,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAM,CAAC,KAA6B,IAAI,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE5F;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CAAC,SAA2B;QACnD,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAc,CAAC;QACzC,MAAM,cAAc,GAAG,IAAI,KAAK,EAAc,CAAC;QAC/C,MAAM,UAAU,GAAG,IAAI,KAAK,EAAc,CAAC;QAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QACtD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,QAAQ,EAAE;YAChC,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;YACnC,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC;YAChD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GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAEpF,MAAM,mBAAmB,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { from, Observable, shareReplay } from \"rxjs\";\nimport { eachValueFrom } from \"rxjs-for-await\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport {\n ContentFlags, DEFAULT_KEYS_BATCH_SIZE, DefaultContentDisplayTypes, DescriptorOverrides, Item, Key, KeySet, Ruleset,\n} from \"@itwin/presentation-common\";\nimport { Presentation } from \"../Presentation\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./SelectionManager\";\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nexport const HILITE_RULESET: Ruleset = require(\"./HiliteRules.json\");\n\n/**\n * A set of model, subcategory and element ids that can be used for specifying\n * viewport hilite.\n *\n * @public\n */\nexport interface HiliteSet {\n models?: Id64String[];\n subCategories?: Id64String[];\n elements?: Id64String[];\n}\n\n/**\n * Properties for creating a `HiliteSetProvider` instance.\n * @public\n */\nexport interface HiliteSetProviderProps {\n imodel: IModelConnection;\n}\n\n/**\n * Presentation-based provider which uses presentation ruleset to determine\n * what `HiliteSet` should be hilited in the graphics viewport based on the\n * supplied `KeySet`.\n *\n * @public\n */\nexport class HiliteSetProvider {\n private _imodel: IModelConnection;\n private _cache: undefined | { keysGuid: string, observable: Observable<HiliteSet> };\n\n private constructor(props: HiliteSetProviderProps) {\n this._imodel = props.imodel;\n }\n\n /**\n * Create a hilite set provider for the specified iModel.\n */\n public static create(props: HiliteSetProviderProps) { return new HiliteSetProvider(props); }\n\n /**\n * Get hilite set for instances and/or nodes whose keys are specified in the\n * given KeySet.\n *\n * Note: The provider caches result of the last request, so subsequent requests\n * for the same input doesn't cost.\n */\n public async getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet> {\n const modelIds = new Array<Id64String>();\n const subCategoryIds = new Array<Id64String>();\n const elementIds = new Array<Id64String>();\n\n const iterator = this.getHiliteSetIterator(selection);\n for await (const set of iterator) {\n modelIds.push(...set.models ?? []);\n subCategoryIds.push(...set.subCategories ?? []);\n elementIds.push(...set.elements ?? []);\n }\n\n return {\n models: modelIds.length ? modelIds : undefined,\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\n elements: elementIds.length ? elementIds : undefined,\n };\n }\n\n /**\n * Get hilite set iterator for provided keys. It loads content in batches and\n * yields hilite set created from each batch after it is loaded.\n */\n public getHiliteSetIterator(selection: Readonly<KeySet>) {\n if (!this._cache || this._cache.keysGuid !== selection.guid) {\n this._cache = {\n keysGuid: selection.guid,\n observable: from(this.createHiliteSetIterator(selection)).pipe(shareReplay({ refCount: true })),\n };\n }\n\n return eachValueFrom(this._cache.observable);\n }\n\n private async * createHiliteSetIterator(selection: Readonly<KeySet>) {\n const {keys, transientIds} = this.handleTransientKeys(selection);\n const {options, keyBatches} = this.getContentOptions(keys);\n\n if (transientIds.length !== 0) {\n yield { elements: transientIds };\n }\n\n for (const batch of keyBatches) {\n let loadedItems = 0;\n while (true) {\n const content = await Presentation.presentation.getContentAndSize({...options, paging: {start: loadedItems, size: CONTENT_SET_PAGE_SIZE}, keys: batch});\n if (!content) {\n break;\n }\n\n const result = this.createHiliteSet(content.content.contentSet);\n yield result;\n\n loadedItems += content.content.contentSet.length;\n if (loadedItems >= content.size) {\n break;\n }\n }\n }\n }\n\n private createHiliteSet(records: Item[]): HiliteSet {\n const modelIds = new Array<Id64String>();\n const subCategoryIds = new Array<Id64String>();\n const elementIds = new Array<Id64String>();\n records.forEach((rec) => {\n const ids = isModelRecord(rec) ? modelIds : isSubCategoryRecord(rec) ? subCategoryIds : elementIds;\n rec.primaryKeys.forEach((pk) => ids.push(pk.id));\n });\n return {\n models: modelIds.length ? modelIds : undefined,\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\n elements: elementIds.length ? elementIds : undefined,\n };\n }\n\n private getContentOptions(keys: KeySet) {\n const descriptor: DescriptorOverrides = {\n displayType: DefaultContentDisplayTypes.Viewport,\n contentFlags: ContentFlags.KeysOnly,\n };\n const options = {\n imodel: this._imodel,\n rulesetOrId: HILITE_RULESET,\n descriptor,\n };\n const keyBatches = new Array<KeySet>();\n keys.forEachBatch(DEFAULT_KEYS_BATCH_SIZE, (batch: KeySet) => {\n keyBatches.push(batch);\n });\n return {\n options,\n keyBatches,\n };\n }\n\n private handleTransientKeys(selection: Readonly<KeySet>) {\n // need to create a new set without transients\n const transientIds = new Array<Id64String>();\n const keys = new KeySet();\n keys.add(selection, (key: Key) => {\n if (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) {\n transientIds.push(key.id);\n return false;\n }\n return true;\n });\n return {\n transientIds,\n keys,\n };\n }\n}\n\nconst CONTENT_SET_PAGE_SIZE = 1000;\n\nconst isModelRecord = (rec: Item) => (rec.extendedData && rec.extendedData.isModel);\n\nconst isSubCategoryRecord = (rec: Item) => (rec.extendedData && rec.extendedData.isSubCategory);\n"]}
1
+ {"version":3,"file":"HiliteSetProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/HiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,+BAAqD;AACrD,mDAA+C;AAG/C,oEAAgK;AAChK,kDAA+C;AAC/C,yDAAiE;AAEjE,gBAAgB;AAChB,8DAA8D;AACjD,QAAA,cAAc,GAAY,OAAO,CAAC,oBAA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;QACF,MAAM,UAAU,GAAG,IAAI,KAAK,EAAU,CAAC;QACvC,IAAI,CAAC,YAAY,CAAC,6CAAuB,EAAE,CAAC,KAAa,EAAE,EAAE;YAC3D,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,OAAO;YACL,OAAO;YACP,UAAU;SACX,CAAC;IACJ,CAAC;IAEO,mBAAmB,CAAC,SAA2B;QACrD,8CAA8C;QAC9C,MAAM,YAAY,GAAG,IAAI,KAAK,EAAc,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,4BAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAQ,EAAE,EAAE;YAC/B,IAAI,yBAAG,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,SAAS,KAAK,8CAA2B,EAAE;gBAC3E,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC1B,OAAO,KAAK,CAAC;aACd;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QACH,OAAO;YACL,YAAY;YACZ,IAAI;SACL,CAAC;IACJ,CAAC;CACF;AA1ID,8CA0IC;AAED,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,aAAa,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC;AAElF,MAAM,mBAAmB,GAAG,CAAC,GAAS,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,aAAa,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { from, Observable, shareReplay } from \"rxjs\";\r\nimport { eachValueFrom } from \"rxjs-for-await\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { ContentFlags, DEFAULT_KEYS_BATCH_SIZE, DefaultContentDisplayTypes, DescriptorOverrides, Item, Key, KeySet, Ruleset } from \"@itwin/presentation-common\";\r\nimport { Presentation } from \"../Presentation\";\r\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./SelectionManager\";\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nexport const HILITE_RULESET: Ruleset = require(\"./HiliteRules.json\");\r\n\r\n/**\r\n * A set of model, subcategory and element ids that can be used for specifying\r\n * viewport hilite.\r\n *\r\n * @public\r\n */\r\nexport interface HiliteSet {\r\n models?: Id64String[];\r\n subCategories?: Id64String[];\r\n elements?: Id64String[];\r\n}\r\n\r\n/**\r\n * Properties for creating a `HiliteSetProvider` instance.\r\n * @public\r\n */\r\nexport interface HiliteSetProviderProps {\r\n imodel: IModelConnection;\r\n}\r\n\r\n/**\r\n * Presentation-based provider which uses presentation ruleset to determine\r\n * what `HiliteSet` should be hilited in the graphics viewport based on the\r\n * supplied `KeySet`.\r\n *\r\n * @public\r\n */\r\nexport class HiliteSetProvider {\r\n private _imodel: IModelConnection;\r\n private _cache: undefined | { keysGuid: string; observable: Observable<HiliteSet> };\r\n\r\n private constructor(props: HiliteSetProviderProps) {\r\n this._imodel = props.imodel;\r\n }\r\n\r\n /**\r\n * Create a hilite set provider for the specified iModel.\r\n */\r\n public static create(props: HiliteSetProviderProps) {\r\n return new HiliteSetProvider(props);\r\n }\r\n\r\n /**\r\n * Get hilite set for instances and/or nodes whose keys are specified in the\r\n * given KeySet.\r\n *\r\n * Note: The provider caches result of the last request, so subsequent requests\r\n * for the same input doesn't cost.\r\n */\r\n public async getHiliteSet(selection: Readonly<KeySet>): Promise<HiliteSet> {\r\n const modelIds = new Array<Id64String>();\r\n const subCategoryIds = new Array<Id64String>();\r\n const elementIds = new Array<Id64String>();\r\n\r\n const iterator = this.getHiliteSetIterator(selection);\r\n for await (const set of iterator) {\r\n modelIds.push(...(set.models ?? []));\r\n subCategoryIds.push(...(set.subCategories ?? []));\r\n elementIds.push(...(set.elements ?? []));\r\n }\r\n\r\n return {\r\n models: modelIds.length ? modelIds : undefined,\r\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\r\n elements: elementIds.length ? elementIds : undefined,\r\n };\r\n }\r\n\r\n /**\r\n * Get hilite set iterator for provided keys. It loads content in batches and\r\n * yields hilite set created from each batch after it is loaded.\r\n */\r\n public getHiliteSetIterator(selection: Readonly<KeySet>) {\r\n if (!this._cache || this._cache.keysGuid !== selection.guid) {\r\n this._cache = {\r\n keysGuid: selection.guid,\r\n observable: from(this.createHiliteSetIterator(selection)).pipe(shareReplay({ refCount: true })),\r\n };\r\n }\r\n\r\n return eachValueFrom(this._cache.observable);\r\n }\r\n\r\n private async *createHiliteSetIterator(selection: Readonly<KeySet>) {\r\n const { keys, transientIds } = this.handleTransientKeys(selection);\r\n const { options, keyBatches } = this.getContentOptions(keys);\r\n\r\n if (transientIds.length !== 0) {\r\n yield { elements: transientIds };\r\n }\r\n\r\n for (const batch of keyBatches) {\r\n let loadedItems = 0;\r\n while (true) {\r\n const content = await Presentation.presentation.getContentAndSize({\r\n ...options,\r\n paging: { start: loadedItems, size: CONTENT_SET_PAGE_SIZE },\r\n keys: batch,\r\n });\r\n if (!content) {\r\n break;\r\n }\r\n\r\n const result = this.createHiliteSet(content.content.contentSet);\r\n yield result;\r\n\r\n loadedItems += content.content.contentSet.length;\r\n if (loadedItems >= content.size) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n private createHiliteSet(records: Item[]): HiliteSet {\r\n const modelIds = new Array<Id64String>();\r\n const subCategoryIds = new Array<Id64String>();\r\n const elementIds = new Array<Id64String>();\r\n records.forEach((rec) => {\r\n const ids = isModelRecord(rec) ? modelIds : isSubCategoryRecord(rec) ? subCategoryIds : elementIds;\r\n rec.primaryKeys.forEach((pk) => ids.push(pk.id));\r\n });\r\n return {\r\n models: modelIds.length ? modelIds : undefined,\r\n subCategories: subCategoryIds.length ? subCategoryIds : undefined,\r\n elements: elementIds.length ? elementIds : undefined,\r\n };\r\n }\r\n\r\n private getContentOptions(keys: KeySet) {\r\n const descriptor: DescriptorOverrides = {\r\n displayType: DefaultContentDisplayTypes.Viewport,\r\n contentFlags: ContentFlags.KeysOnly,\r\n };\r\n const options = {\r\n imodel: this._imodel,\r\n rulesetOrId: HILITE_RULESET,\r\n descriptor,\r\n };\r\n const keyBatches = new Array<KeySet>();\r\n keys.forEachBatch(DEFAULT_KEYS_BATCH_SIZE, (batch: KeySet) => {\r\n keyBatches.push(batch);\r\n });\r\n return {\r\n options,\r\n keyBatches,\r\n };\r\n }\r\n\r\n private handleTransientKeys(selection: Readonly<KeySet>) {\r\n // need to create a new set without transients\r\n const transientIds = new Array<Id64String>();\r\n const keys = new KeySet();\r\n keys.add(selection, (key: Key) => {\r\n if (Key.isInstanceKey(key) && key.className === TRANSIENT_ELEMENT_CLASSNAME) {\r\n transientIds.push(key.id);\r\n return false;\r\n }\r\n return true;\r\n });\r\n return {\r\n transientIds,\r\n keys,\r\n };\r\n }\r\n}\r\n\r\nconst CONTENT_SET_PAGE_SIZE = 1000;\r\n\r\nconst isModelRecord = (rec: Item) => rec.extendedData && rec.extendedData.isModel;\r\n\r\nconst isSubCategoryRecord = (rec: Item) => rec.extendedData && rec.extendedData.isSubCategory;\r\n"]}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module UnifiedSelection
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ISelectionProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/ISelectionProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","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 UnifiedSelection\n */\n\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { SelectionChangeEvent } from \"./SelectionChangeEvent\";\n\n/**\n * Selection provider interface which provides main selection and sub-selection.\n * @public\n */\nexport interface ISelectionProvider {\n /** An event that's fired when selection changes */\n selectionChange: SelectionChangeEvent;\n\n /** Get the selection stored in the provider.\n * @param imodel iModel connection which the selection is associated with.\n * @param level Level of the selection (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n */\n getSelection(imodel: IModelConnection, level: number): Readonly<KeySet>;\n}\n"]}
1
+ {"version":3,"file":"ISelectionProvider.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/ISelectionProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { KeySet } from \"@itwin/presentation-common\";\r\nimport { SelectionChangeEvent } from \"./SelectionChangeEvent\";\r\n\r\n/**\r\n * Selection provider interface which provides main selection and sub-selection.\r\n * @public\r\n */\r\nexport interface ISelectionProvider {\r\n /** An event that's fired when selection changes */\r\n selectionChange: SelectionChangeEvent;\r\n\r\n /** Get the selection stored in the provider.\r\n * @param imodel iModel connection which the selection is associated with.\r\n * @param level Level of the selection (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\r\n */\r\n getSelection(imodel: IModelConnection, level: number): Readonly<KeySet>;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionChangeEvent.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,wBAAwB,EAAE,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEtH;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,wBAAwB,CAAC;CAAI;AAE/E;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,GAAG,IAAA;IAEH,8BAA8B;IAC9B,MAAM,IAAA;IAEN,8BAA8B;IAC9B,OAAO,IAAA;IAEP,6BAA6B;IAC7B,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IAEf,yIAAyI;IACzI,KAAK,EAAE,MAAM,CAAC;IAEd,iCAAiC;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAEhC,2DAA2D;IAC3D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEvB,qEAAqE;IACrE,MAAM,EAAE,gBAAgB,CAAC;IAEzB,0DAA0D;IAC1D,SAAS,EAAE,IAAI,CAAC;IAEhB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"SelectionChangeEvent.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,OAAO,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,wBAAwB,EAAE,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAEtH;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,wBAAwB,CAAC;CAAG;AAE9E;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,GAAG,IAAA;IAEH,8BAA8B;IAC9B,MAAM,IAAA;IAEN,8BAA8B;IAC9B,OAAO,IAAA;IAEP,6BAA6B;IAC7B,KAAK,IAAA;CACN;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IAEf,yIAAyI;IACzI,KAAK,EAAE,MAAM,CAAC;IAEd,iCAAiC;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAEhC,2DAA2D;IAC3D,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEvB,qEAAqE;IACrE,MAAM,EAAE,gBAAgB,CAAC;IAEzB,0DAA0D;IAC1D,SAAS,EAAE,IAAI,CAAC;IAEhB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module UnifiedSelection
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA8C;AAW9C;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,sBAAiC;CAAI;AAA/E,oDAA+E;AAE/E;;;GAGG;AACH,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,2DAAG,CAAA;IAEH,8BAA8B;IAC9B,iEAAM,CAAA;IAEN,8BAA8B;IAC9B,mEAAO,CAAA;IAEP,6BAA6B;IAC7B,+DAAK,CAAA;AACP,CAAC,EAZW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAY9B","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 UnifiedSelection\n */\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\n\n/**\n * An interface for selection change listeners.\n * @public\n */\nexport declare type SelectionChangesListener = (args: SelectionChangeEventArgs, provider: ISelectionProvider) => void;\n\n/**\n * An event broadcasted on selection changes\n * @public\n */\nexport class SelectionChangeEvent extends BeEvent<SelectionChangesListener> { }\n\n/**\n * The type of selection change\n * @public\n */\nexport enum SelectionChangeType {\n /** Added to selection. */\n Add,\n\n /** Removed from selection. */\n Remove,\n\n /** Selection was replaced. */\n Replace,\n\n /** Selection was cleared. */\n Clear,\n}\n\n/**\n * The event object that's sent when the selection changes.\n * @public\n */\nexport interface SelectionChangeEventArgs {\n /** The name of the selection source which caused the selection change. */\n source: string;\n\n /** Level of the selection. See [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels). */\n level: number;\n\n /** The selection change type. */\n changeType: SelectionChangeType;\n\n /** Set of keys affected by this selection change event. */\n keys: Readonly<KeySet>;\n\n /** iModel connection with which the selection is associated with. */\n imodel: IModelConnection;\n\n /** The timestamp of when the selection change happened */\n timestamp: Date;\n\n /** Id of the ruleset associated with the selection change. */\n rulesetId?: string;\n}\n"]}
1
+ {"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,sDAA8C;AAW9C;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,sBAAiC;CAAG;AAA9E,oDAA8E;AAE9E;;;GAGG;AACH,IAAY,mBAYX;AAZD,WAAY,mBAAmB;IAC7B,0BAA0B;IAC1B,2DAAG,CAAA;IAEH,8BAA8B;IAC9B,iEAAM,CAAA;IAEN,8BAA8B;IAC9B,mEAAO,CAAA;IAEP,6BAA6B;IAC7B,+DAAK,CAAA;AACP,CAAC,EAZW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAY9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { BeEvent } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { KeySet } from \"@itwin/presentation-common\";\r\nimport { ISelectionProvider } from \"./ISelectionProvider\";\r\n\r\n/**\r\n * An interface for selection change listeners.\r\n * @public\r\n */\r\nexport declare type SelectionChangesListener = (args: SelectionChangeEventArgs, provider: ISelectionProvider) => void;\r\n\r\n/**\r\n * An event broadcasted on selection changes\r\n * @public\r\n */\r\nexport class SelectionChangeEvent extends BeEvent<SelectionChangesListener> {}\r\n\r\n/**\r\n * The type of selection change\r\n * @public\r\n */\r\nexport enum SelectionChangeType {\r\n /** Added to selection. */\r\n Add,\r\n\r\n /** Removed from selection. */\r\n Remove,\r\n\r\n /** Selection was replaced. */\r\n Replace,\r\n\r\n /** Selection was cleared. */\r\n Clear,\r\n}\r\n\r\n/**\r\n * The event object that's sent when the selection changes.\r\n * @public\r\n */\r\nexport interface SelectionChangeEventArgs {\r\n /** The name of the selection source which caused the selection change. */\r\n source: string;\r\n\r\n /** Level of the selection. See [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels). */\r\n level: number;\r\n\r\n /** The selection change type. */\r\n changeType: SelectionChangeType;\r\n\r\n /** Set of keys affected by this selection change event. */\r\n keys: Readonly<KeySet>;\r\n\r\n /** iModel connection with which the selection is associated with. */\r\n imodel: IModelConnection;\r\n\r\n /** The timestamp of when the selection change happened */\r\n timestamp: Date;\r\n\r\n /** Id of the ruleset associated with the selection change. */\r\n rulesetId?: string;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionHandler.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAkB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,E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I;IAO1D;;;;OAIG;IACI,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAO/D;;;;OAIG;IACI,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAO5D;;;OAGG;IACI,cAAc,CAAC,KAAK,GAAE,MAAU,GAAG,IAAI;CAM/C"}
1
+ {"version":3,"file":"SelectionHandler.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAkB,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,wDAAwD;IACxD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,uEAAuE;IACvE,MAAM,EAAE,gBAAgB,CAAC;IACzB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,WAAW;IAClD,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,YAAY,CAAiB;IAErC,iEAAiE;IACjE,SAAgB,OAAO,EAAE,gBAAgB,CAAC;IAC1C,0FAA0F;IACnF,IAAI,EAAE,MAAM,CAAC;IACpB,8CAA8C;IACvC,MAAM,EAAE,gBAAgB,CAAC;IAChC;;;OAGG;IACI,SAAS,CAAC,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IAC/C,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IAE3C;;OAEG;gBACS,KAAK,EAAE,qBAAqB;IAWxC;;;OAGG;IACI,OAAO,IAAI,IAAI;IAItB;;;OAGG;IAEH,SAAS,CAAC,kBAAkB,QAAS,wBAAwB,YAAY,kBAAkB,KAAG,IAAI,CAQhG;IAEF,0EAA0E;IAC1E,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO;IAO9D,kEAAkE;IAC3D,kBAAkB,IAAI,MAAM,EAAE;IAIrC;;;OAGG;IACI,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAIrD;;;;OAIG;IACI,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAQ1D;;;;OAIG;IACI,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAQ/D;;;;OAIG;IACI,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAQ5D;;;OAGG;IACI,cAAc,CAAC,KAAK,GAAE,MAAU,GAAG,IAAI;CAO/C"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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
- *--------------------------------------------------------------------------------------------*/
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
6
  /** @packageDocumentation
7
7
  * @module UnifiedSelection
8
8
  */
@@ -26,8 +26,9 @@ class SelectionHandler {
26
26
  */
27
27
  // eslint-disable-next-line @typescript-eslint/naming-convention
28
28
  this.onSelectionChanged = (evt, provider) => {
29
- if (!this.onSelect || !this.shouldHandle(evt))
29
+ if (!this.onSelect || !this.shouldHandle(evt)) {
30
30
  return;
31
+ }
31
32
  this._inSelect = true;
32
33
  this.onSelect(evt, provider);
33
34
  this._inSelect = false;
@@ -50,8 +51,9 @@ class SelectionHandler {
50
51
  }
51
52
  /** Called to check whether the event should be handled by this handler */
52
53
  shouldHandle(evt) {
53
- if (this.name === evt.source)
54
+ if (this.name === evt.source) {
54
55
  return false;
56
+ }
55
57
  return true;
56
58
  }
57
59
  /** Get selection levels for the imodel managed by this handler */
@@ -71,8 +73,9 @@ class SelectionHandler {
71
73
  * @param level Level of the selection.
72
74
  */
73
75
  addToSelection(keys, level = 0) {
74
- if (this._inSelect)
76
+ if (this._inSelect) {
75
77
  return;
78
+ }
76
79
  return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);
77
80
  }
78
81
  /**
@@ -81,8 +84,9 @@ class SelectionHandler {
81
84
  * @param level Level of the selection.
82
85
  */
83
86
  removeFromSelection(keys, level = 0) {
84
- if (this._inSelect)
87
+ if (this._inSelect) {
85
88
  return;
89
+ }
86
90
  return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);
87
91
  }
88
92
  /**
@@ -91,8 +95,9 @@ class SelectionHandler {
91
95
  * @param level Level of the selection.
92
96
  */
93
97
  replaceSelection(keys, level = 0) {
94
- if (this._inSelect)
98
+ if (this._inSelect) {
95
99
  return;
100
+ }
96
101
  return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);
97
102
  }
98
103
  /**
@@ -100,8 +105,9 @@ class SelectionHandler {
100
105
  * @param level Level of the selection.
101
106
  */
102
107
  clearSelection(level = 0) {
103
- if (this._inSelect)
108
+ if (this._inSelect) {
104
109
  return;
110
+ }
105
111
  return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);
106
112
  }
107
113
  }