@itwin/grouping-mapping-widget 0.9.0 → 0.9.2

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 (85) hide show
  1. package/lib/cjs/test/GroupPropertyUtils.test.js +61 -1
  2. package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
  3. package/lib/cjs/test/GroupingMappingCustomUI.test.js +44 -53
  4. package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
  5. package/lib/cjs/test/QueryBuilder.test.js +30 -2
  6. package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
  7. package/lib/cjs/test/QueryBuilder.testdata.js +471 -7
  8. package/lib/cjs/test/QueryBuilder.testdata.js.map +1 -1
  9. package/lib/cjs/test/QueryBuilderTestData.d.ts +3 -1
  10. package/lib/cjs/test/QueryBuilderTestData.js.map +1 -1
  11. package/lib/cjs/widget/components/GroupAction.js +2 -21
  12. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  13. package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -1
  14. package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
  15. package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  16. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +38 -45
  17. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  18. package/lib/cjs/widget/components/Grouping.js +1 -1
  19. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  20. package/lib/cjs/widget/components/Grouping.scss +1 -1
  21. package/lib/cjs/widget/components/QueryBuilder.d.ts +35 -21
  22. package/lib/cjs/widget/components/QueryBuilder.js +153 -181
  23. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  24. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  25. package/lib/cjs/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +13 -9
  26. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  27. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  28. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +2 -2
  29. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  30. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  31. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +18 -8
  32. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  33. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +1 -1
  34. package/lib/cjs/widget/components/property-grid/PropertyView.js +46 -60
  35. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  36. package/lib/cjs/widget/components/viewerUtils.js +1 -3
  37. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  38. package/lib/esm/test/GroupPropertyUtils.test.js +61 -1
  39. package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
  40. package/lib/esm/test/GroupingMappingCustomUI.test.js +45 -54
  41. package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
  42. package/lib/esm/test/QueryBuilder.test.js +31 -3
  43. package/lib/esm/test/QueryBuilder.test.js.map +1 -1
  44. package/lib/esm/test/QueryBuilder.testdata.js +471 -7
  45. package/lib/esm/test/QueryBuilder.testdata.js.map +1 -1
  46. package/lib/esm/test/QueryBuilderTestData.d.ts +3 -1
  47. package/lib/esm/test/QueryBuilderTestData.js.map +1 -1
  48. package/lib/esm/widget/components/GroupAction.js +2 -21
  49. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  50. package/lib/esm/widget/components/GroupPropertyUtils.js +2 -1
  51. package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
  52. package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  53. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +34 -25
  54. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  55. package/lib/esm/widget/components/Grouping.js +1 -1
  56. package/lib/esm/widget/components/Grouping.js.map +1 -1
  57. package/lib/esm/widget/components/Grouping.scss +1 -1
  58. package/lib/esm/widget/components/QueryBuilder.d.ts +35 -21
  59. package/lib/esm/widget/components/QueryBuilder.js +153 -181
  60. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  61. package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  62. package/lib/esm/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +11 -8
  63. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  64. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  65. package/lib/esm/widget/components/property-grid/PropertyGrid.js +2 -2
  66. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  67. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  68. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +16 -6
  69. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  70. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +1 -1
  71. package/lib/esm/widget/components/property-grid/PropertyView.js +32 -30
  72. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  73. package/lib/esm/widget/components/viewerUtils.js +1 -3
  74. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  75. package/package.json +2 -2
  76. package/lib/cjs/api/GroupQueryBuilderApi.d.ts +0 -15
  77. package/lib/cjs/api/GroupQueryBuilderApi.js +0 -27
  78. package/lib/cjs/api/GroupQueryBuilderApi.js.map +0 -1
  79. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  80. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
  81. package/lib/esm/api/GroupQueryBuilderApi.d.ts +0 -15
  82. package/lib/esm/api/GroupQueryBuilderApi.js +0 -23
  83. package/lib/esm/api/GroupQueryBuilderApi.js.map +0 -1
  84. package/lib/esm/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  85. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
@@ -1,12 +1,18 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { FieldDescriptorType } from "@itwin/presentation-common";
1
6
  export const testCases = {
2
7
  testCases: [
3
8
  {
4
9
  name: "when non-relational property added, return query string with property value",
5
- expectedResult: "SELECT A.B.ECInstanceId FROM A.B WHERE A.B.somePropName=1",
10
+ expectedResult: "SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 1",
6
11
  operations: [
7
12
  {
8
13
  expectedResult: true,
9
14
  operationType: "addProperty",
15
+ fieldDescriptorType: FieldDescriptorType.Properties,
10
16
  propertyRecord: {
11
17
  value: {
12
18
  valueFormat: 0,
@@ -41,11 +47,12 @@ export const testCases = {
41
47
  },
42
48
  {
43
49
  name: "when relational property added, return query string with property value and relation chain to it",
44
- expectedResult: "SELECT Z.X.ECInstanceId FROM Z.X JOIN Rel.CX ON Rel.CX.SourceECInstanceId=A.C.ECInstanceId JOIN A.C ON A.C.ECInstanceId=Rel.BC.SourceECInstanceId JOIN Rel.BC ON Rel.BC.TargetECInstanceId=A.B.ECInstanceId JOIN A.B ON A.B.somePropName='someString' WHERE Z.X.ECInstanceId=Rel.CX.TargetECInstanceId",
50
+ expectedResult: "SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString'",
45
51
  operations: [
46
52
  {
47
53
  expectedResult: true,
48
54
  operationType: "addProperty",
55
+ fieldDescriptorType: FieldDescriptorType.Properties,
49
56
  propertyRecord: {
50
57
  value: {
51
58
  valueFormat: 0,
@@ -122,6 +129,404 @@ export const testCases = {
122
129
  },
123
130
  ],
124
131
  },
132
+ {
133
+ name: "when multiple relational properties added, return query string with property values and relation chains to them",
134
+ expectedResult: "SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN G.H ON Rel.BC.TargetECInstanceId = G.H.ECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE G.H.someOtherPropName = 'someOtherString' AND A.B.somePropName = 'someString'",
135
+ operations: [
136
+ {
137
+ expectedResult: true,
138
+ operationType: "addProperty",
139
+ fieldDescriptorType: FieldDescriptorType.Properties,
140
+ propertyRecord: {
141
+ value: {
142
+ valueFormat: 0,
143
+ value: "someOtherString",
144
+ },
145
+ property: {
146
+ typename: "notNavigation",
147
+ name: "otherPropertyName",
148
+ displayLabel: "propertyDisplayLabel",
149
+ },
150
+ },
151
+ propertiesField: {
152
+ properties: [
153
+ {
154
+ property: {
155
+ name: "someOtherPropName",
156
+ classInfo: {
157
+ name: "A:B",
158
+ },
159
+ },
160
+ },
161
+ ],
162
+ type: {
163
+ typeName: "string",
164
+ },
165
+ parent: {
166
+ pathToPrimaryClass: [
167
+ {
168
+ sourceClassInfo: {
169
+ id: "id1",
170
+ name: "G:H",
171
+ label: "AB label",
172
+ },
173
+ targetClassInfo: {
174
+ id: "id2",
175
+ name: "A:C",
176
+ label: "AC label",
177
+ },
178
+ isPolymorphicTargetClass: true,
179
+ relationshipInfo: {
180
+ id: "id3",
181
+ name: "Rel:BC",
182
+ label: "Relationship BC label",
183
+ },
184
+ isPolymorphicRelationship: true,
185
+ isForwardRelationship: false,
186
+ },
187
+ {
188
+ sourceClassInfo: {
189
+ id: "id2",
190
+ name: "A:C",
191
+ label: "AC label",
192
+ },
193
+ targetClassInfo: {
194
+ id: "id4",
195
+ name: "Z:X",
196
+ label: "ZX label",
197
+ },
198
+ isPolymorphicTargetClass: false,
199
+ relationshipInfo: {
200
+ id: "id5",
201
+ name: "Rel:CX",
202
+ label: "Relationship CX label",
203
+ },
204
+ isPolymorphicRelationship: true,
205
+ isForwardRelationship: true,
206
+ },
207
+ ],
208
+ contentClassInfo: {
209
+ name: "G:H",
210
+ },
211
+ },
212
+ },
213
+ },
214
+ {
215
+ expectedResult: true,
216
+ operationType: "addProperty",
217
+ fieldDescriptorType: FieldDescriptorType.Properties,
218
+ propertyRecord: {
219
+ value: {
220
+ valueFormat: 0,
221
+ value: "someString",
222
+ },
223
+ property: {
224
+ typename: "notNavigation",
225
+ name: "propertyName",
226
+ displayLabel: "propertyDisplayLabel",
227
+ },
228
+ },
229
+ propertiesField: {
230
+ properties: [
231
+ {
232
+ property: {
233
+ name: "somePropName",
234
+ classInfo: {
235
+ name: "A:B",
236
+ },
237
+ },
238
+ },
239
+ ],
240
+ type: {
241
+ typeName: "string",
242
+ },
243
+ parent: {
244
+ pathToPrimaryClass: [
245
+ {
246
+ sourceClassInfo: {
247
+ id: "id1",
248
+ name: "A:B",
249
+ label: "AB label",
250
+ },
251
+ targetClassInfo: {
252
+ id: "id2",
253
+ name: "A:C",
254
+ label: "AC label",
255
+ },
256
+ isPolymorphicTargetClass: true,
257
+ relationshipInfo: {
258
+ id: "id3",
259
+ name: "Rel:BC",
260
+ label: "Relationship BC label",
261
+ },
262
+ isPolymorphicRelationship: true,
263
+ isForwardRelationship: false,
264
+ },
265
+ {
266
+ sourceClassInfo: {
267
+ id: "id2",
268
+ name: "A:C",
269
+ label: "AC label",
270
+ },
271
+ targetClassInfo: {
272
+ id: "id4",
273
+ name: "Z:X",
274
+ label: "ZX label",
275
+ },
276
+ isPolymorphicTargetClass: false,
277
+ relationshipInfo: {
278
+ id: "id5",
279
+ name: "Rel:CX",
280
+ label: "Relationship CX label",
281
+ },
282
+ isPolymorphicRelationship: true,
283
+ isForwardRelationship: true,
284
+ },
285
+ ],
286
+ contentClassInfo: {
287
+ name: "A:B",
288
+ },
289
+ },
290
+ },
291
+ },
292
+ ],
293
+ },
294
+ {
295
+ name: "when relational property and non-relational property from one of relational chain classes added, return query string with property values and relation chain",
296
+ expectedResult: "SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.C.SomeOtherPropName = 1",
297
+ operations: [
298
+ {
299
+ expectedResult: true,
300
+ operationType: "addProperty",
301
+ fieldDescriptorType: FieldDescriptorType.Properties,
302
+ propertyRecord: {
303
+ value: {
304
+ valueFormat: 0,
305
+ value: "someString",
306
+ },
307
+ property: {
308
+ typename: "notNavigation",
309
+ name: "somePropName",
310
+ displayLabel: "propertyDisplayLabel",
311
+ },
312
+ },
313
+ propertiesField: {
314
+ properties: [
315
+ {
316
+ property: {
317
+ name: "somePropName",
318
+ classInfo: {
319
+ name: "A:C",
320
+ },
321
+ },
322
+ },
323
+ ],
324
+ type: {
325
+ typeName: "string",
326
+ },
327
+ parent: {
328
+ pathToPrimaryClass: [
329
+ {
330
+ sourceClassInfo: {
331
+ id: "id1",
332
+ name: "A:B",
333
+ label: "AB label",
334
+ },
335
+ targetClassInfo: {
336
+ id: "id2",
337
+ name: "A:C",
338
+ label: "AC label",
339
+ },
340
+ isPolymorphicTargetClass: true,
341
+ relationshipInfo: {
342
+ id: "id3",
343
+ name: "Rel:BC",
344
+ label: "Relationship BC label",
345
+ },
346
+ isPolymorphicRelationship: true,
347
+ isForwardRelationship: false,
348
+ },
349
+ {
350
+ sourceClassInfo: {
351
+ id: "id2",
352
+ name: "A:C",
353
+ label: "AC label",
354
+ },
355
+ targetClassInfo: {
356
+ id: "id4",
357
+ name: "Z:X",
358
+ label: "ZX label",
359
+ },
360
+ isPolymorphicTargetClass: false,
361
+ relationshipInfo: {
362
+ id: "id5",
363
+ name: "Rel:CX",
364
+ label: "Relationship CX label",
365
+ },
366
+ isPolymorphicRelationship: true,
367
+ isForwardRelationship: true,
368
+ },
369
+ ],
370
+ contentClassInfo: {
371
+ name: "A:B",
372
+ },
373
+ },
374
+ },
375
+ },
376
+ {
377
+ expectedResult: true,
378
+ operationType: "addProperty",
379
+ fieldDescriptorType: FieldDescriptorType.Properties,
380
+ propertyRecord: {
381
+ value: {
382
+ valueFormat: 0,
383
+ value: 1,
384
+ },
385
+ property: {
386
+ typename: "notNavigation",
387
+ name: "SomeOtherPropName",
388
+ displayLabel: "propertyDisplayLabel",
389
+ },
390
+ },
391
+ propertiesField: {
392
+ properties: [
393
+ {
394
+ property: {
395
+ name: "SomeOtherPropName",
396
+ classInfo: {
397
+ name: "A:C",
398
+ },
399
+ },
400
+ },
401
+ ],
402
+ type: {
403
+ typeName: "number",
404
+ },
405
+ parent: {
406
+ pathToPrimaryClass: [],
407
+ },
408
+ },
409
+ },
410
+ ],
411
+ },
412
+ {
413
+ name: "when relational and non-relational property from the same class added, return query string with property values and relation chain",
414
+ expectedResult: "SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someString' AND A.B.SomeOtherPropName = 1",
415
+ operations: [
416
+ {
417
+ expectedResult: true,
418
+ operationType: "addProperty",
419
+ fieldDescriptorType: FieldDescriptorType.Properties,
420
+ propertyRecord: {
421
+ value: {
422
+ valueFormat: 0,
423
+ value: "someString",
424
+ },
425
+ property: {
426
+ typename: "notNavigation",
427
+ name: "propertyName",
428
+ displayLabel: "propertyDisplayLabel",
429
+ },
430
+ },
431
+ propertiesField: {
432
+ properties: [
433
+ {
434
+ property: {
435
+ name: "somePropName",
436
+ classInfo: {
437
+ name: "A:B",
438
+ },
439
+ },
440
+ },
441
+ ],
442
+ type: {
443
+ typeName: "string",
444
+ },
445
+ parent: {
446
+ pathToPrimaryClass: [
447
+ {
448
+ sourceClassInfo: {
449
+ id: "id1",
450
+ name: "A:B",
451
+ label: "AB label",
452
+ },
453
+ targetClassInfo: {
454
+ id: "id2",
455
+ name: "A:C",
456
+ label: "AC label",
457
+ },
458
+ isPolymorphicTargetClass: true,
459
+ relationshipInfo: {
460
+ id: "id3",
461
+ name: "Rel:BC",
462
+ label: "Relationship BC label",
463
+ },
464
+ isPolymorphicRelationship: true,
465
+ isForwardRelationship: false,
466
+ },
467
+ {
468
+ sourceClassInfo: {
469
+ id: "id2",
470
+ name: "A:C",
471
+ label: "AC label",
472
+ },
473
+ targetClassInfo: {
474
+ id: "id4",
475
+ name: "Z:X",
476
+ label: "ZX label",
477
+ },
478
+ isPolymorphicTargetClass: false,
479
+ relationshipInfo: {
480
+ id: "id5",
481
+ name: "Rel:CX",
482
+ label: "Relationship CX label",
483
+ },
484
+ isPolymorphicRelationship: true,
485
+ isForwardRelationship: true,
486
+ },
487
+ ],
488
+ contentClassInfo: {
489
+ name: "A:B",
490
+ },
491
+ },
492
+ },
493
+ },
494
+ {
495
+ expectedResult: true,
496
+ operationType: "addProperty",
497
+ fieldDescriptorType: FieldDescriptorType.Properties,
498
+ propertyRecord: {
499
+ value: {
500
+ valueFormat: 0,
501
+ value: 1,
502
+ },
503
+ property: {
504
+ typename: "notNavigation",
505
+ name: "propertyName2",
506
+ displayLabel: "propertyDisplayLabel",
507
+ },
508
+ },
509
+ propertiesField: {
510
+ properties: [
511
+ {
512
+ property: {
513
+ name: "SomeOtherPropName",
514
+ classInfo: {
515
+ name: "A:B",
516
+ },
517
+ },
518
+ },
519
+ ],
520
+ type: {
521
+ typeName: "number",
522
+ },
523
+ parent: {
524
+ pathToPrimaryClass: [],
525
+ },
526
+ },
527
+ },
528
+ ],
529
+ },
125
530
  {
126
531
  name: "when non-relational property removed, return empty string",
127
532
  expectedResult: "",
@@ -129,6 +534,7 @@ export const testCases = {
129
534
  {
130
535
  expectedResult: true,
131
536
  operationType: "addProperty",
537
+ fieldDescriptorType: FieldDescriptorType.Properties,
132
538
  propertyRecord: {
133
539
  value: {
134
540
  valueFormat: 0,
@@ -164,6 +570,7 @@ export const testCases = {
164
570
  },
165
571
  {
166
572
  operationType: "removeProperty",
573
+ fieldDescriptorType: FieldDescriptorType.Properties,
167
574
  propertyRecord: {
168
575
  value: {
169
576
  valueFormat: 0,
@@ -206,6 +613,7 @@ export const testCases = {
206
613
  {
207
614
  expectedResult: true,
208
615
  operationType: "addProperty",
616
+ fieldDescriptorType: FieldDescriptorType.Properties,
209
617
  propertyRecord: {
210
618
  value: {
211
619
  valueFormat: 0,
@@ -282,6 +690,7 @@ export const testCases = {
282
690
  },
283
691
  {
284
692
  operationType: "removeProperty",
693
+ fieldDescriptorType: FieldDescriptorType.Properties,
285
694
  propertyRecord: {
286
695
  value: {
287
696
  valueFormat: 0,
@@ -360,11 +769,12 @@ export const testCases = {
360
769
  },
361
770
  {
362
771
  name: "when non-relational property re-added after removing, return query string with property value",
363
- expectedResult: "SELECT A.B.ECInstanceId FROM A.B WHERE A.B.somePropName='someOtherString'",
772
+ expectedResult: "SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'someOtherString'",
364
773
  operations: [
365
774
  {
366
775
  expectedResult: true,
367
776
  operationType: "addProperty",
777
+ fieldDescriptorType: FieldDescriptorType.Properties,
368
778
  propertyRecord: {
369
779
  value: {
370
780
  valueFormat: 0,
@@ -400,6 +810,7 @@ export const testCases = {
400
810
  },
401
811
  {
402
812
  operationType: "removeProperty",
813
+ fieldDescriptorType: FieldDescriptorType.Properties,
403
814
  propertyRecord: {
404
815
  value: {
405
816
  valueFormat: 0,
@@ -436,6 +847,7 @@ export const testCases = {
436
847
  {
437
848
  operationType: "addProperty",
438
849
  expectedResult: true,
850
+ fieldDescriptorType: FieldDescriptorType.Properties,
439
851
  propertyRecord: {
440
852
  value: {
441
853
  valueFormat: 0,
@@ -473,11 +885,12 @@ export const testCases = {
473
885
  },
474
886
  {
475
887
  name: "when relational property re-added after removing, return query string with property value and relation chain to it",
476
- expectedResult: "SELECT Z.X.ECInstanceId FROM Z.X JOIN Rel.CX ON Rel.CX.SourceECInstanceId=A.C.ECInstanceId JOIN A.C ON A.C.ECInstanceId=Rel.BC.SourceECInstanceId JOIN Rel.BC ON Rel.BC.TargetECInstanceId=A.B.ECInstanceId JOIN A.B ON A.B.somePropName='someOtherString' WHERE Z.X.ECInstanceId=Rel.CX.TargetECInstanceId",
888
+ expectedResult: "SELECT Z.X.ECInstanceId, Z.X.ECClassId FROM Z.X JOIN Rel.CX ON Z.X.ECInstanceId = Rel.CX.TargetECInstanceId JOIN A.C ON Rel.CX.SourceECInstanceId = A.C.ECInstanceId JOIN Rel.BC ON A.C.ECInstanceId = Rel.BC.SourceECInstanceId JOIN A.B ON Rel.BC.TargetECInstanceId = A.B.ECInstanceId WHERE A.B.somePropName = 'someOtherString'",
477
889
  operations: [
478
890
  {
479
891
  expectedResult: true,
480
892
  operationType: "addProperty",
893
+ fieldDescriptorType: FieldDescriptorType.Properties,
481
894
  propertyRecord: {
482
895
  value: {
483
896
  valueFormat: 0,
@@ -554,6 +967,7 @@ export const testCases = {
554
967
  },
555
968
  {
556
969
  operationType: "removeProperty",
970
+ fieldDescriptorType: FieldDescriptorType.Properties,
557
971
  propertyRecord: {
558
972
  value: {
559
973
  valueFormat: 0,
@@ -631,6 +1045,7 @@ export const testCases = {
631
1045
  {
632
1046
  expectedResult: true,
633
1047
  operationType: "addProperty",
1048
+ fieldDescriptorType: FieldDescriptorType.Properties,
634
1049
  propertyRecord: {
635
1050
  value: {
636
1051
  valueFormat: 0,
@@ -714,11 +1129,12 @@ export const testCases = {
714
1129
  },
715
1130
  {
716
1131
  name: "when property is float, return query string with ROUND",
717
- expectedResult: "SELECT A.B.ECInstanceId FROM A.B WHERE ROUND(A.B.somePropName, 4)=3.1416",
1132
+ expectedResult: "SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE ROUND(A.B.somePropName, 4) = 3.1416",
718
1133
  operations: [
719
1134
  {
720
1135
  expectedResult: true,
721
1136
  operationType: "addProperty",
1137
+ fieldDescriptorType: FieldDescriptorType.Properties,
722
1138
  propertyRecord: {
723
1139
  value: {
724
1140
  valueFormat: 0,
@@ -753,11 +1169,12 @@ export const testCases = {
753
1169
  },
754
1170
  {
755
1171
  name: "when property needsQuotes, return query string with property value in quotes",
756
- expectedResult: "SELECT A.B.ECInstanceId FROM A.B WHERE A.B.somePropName='https://valueThatNeedsQuotes.com'",
1172
+ expectedResult: "SELECT A.B.ECInstanceId, A.B.ECClassId FROM A.B WHERE A.B.somePropName = 'https://valueThatNeedsQuotes.com'",
757
1173
  operations: [
758
1174
  {
759
1175
  expectedResult: true,
760
1176
  operationType: "addProperty",
1177
+ fieldDescriptorType: FieldDescriptorType.Properties,
761
1178
  propertyRecord: {
762
1179
  value: {
763
1180
  valueFormat: 0,
@@ -792,11 +1209,58 @@ export const testCases = {
792
1209
  },
793
1210
  {
794
1211
  name: "when property is category, return a category query string",
795
- expectedResult: "SELECT BisCore.B.ECInstanceId FROM BisCore.B JOIN bis.Category ON bis.Category.ECInstanceId = bis.GeometricElement3d.category.id AND ((bis.Category.CodeValue='displayValueString') OR (bis.Category.UserLabel='displayValueString'))",
1212
+ expectedResult: "SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))",
1213
+ operations: [
1214
+ {
1215
+ expectedResult: true,
1216
+ operationType: "addProperty",
1217
+ fieldDescriptorType: FieldDescriptorType.Properties,
1218
+ propertyRecord: {
1219
+ value: {
1220
+ valueFormat: 0,
1221
+ value: "someString",
1222
+ displayValue: "displayValueString",
1223
+ },
1224
+ property: {
1225
+ typename: "navigation",
1226
+ name: "propertyName",
1227
+ displayLabel: "propertyDisplayLabel",
1228
+ },
1229
+ },
1230
+ propertiesField: {
1231
+ properties: [
1232
+ {
1233
+ property: {
1234
+ name: "somePropName",
1235
+ classInfo: {
1236
+ name: "BisCore:B",
1237
+ },
1238
+ navigationPropertyInfo: {
1239
+ classInfo: {
1240
+ name: "BisCore:GeometricElement3dIsInCategory",
1241
+ },
1242
+ },
1243
+ },
1244
+ },
1245
+ ],
1246
+ type: {
1247
+ typeName: "string",
1248
+ },
1249
+ parent: {
1250
+ pathToPrimaryClass: [],
1251
+ },
1252
+ },
1253
+ },
1254
+ ],
1255
+ },
1256
+ {
1257
+ name: "when category property and relational property added, return query string with property value, relational chain and with category joined",
1258
+ expectedResult: "SELECT BisCore.B.ECInstanceId, BisCore.B.ECClassId FROM BisCore.B JOIN BisCore.Category ON BisCore.Category.ECInstanceId = BisCore.GeometricElement3d.category.id WHERE ((BisCore.Category.CodeValue = 'displayValueString') OR (BisCore.Category.UserLabel = 'displayValueString'))",
796
1259
  operations: [
797
1260
  {
798
1261
  expectedResult: true,
799
1262
  operationType: "addProperty",
1263
+ fieldDescriptorType: FieldDescriptorType.Properties,
800
1264
  propertyRecord: {
801
1265
  value: {
802
1266
  valueFormat: 0,