@genesislcap/expression-builder 14.251.0 → 14.251.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.
@@ -136,255 +136,6 @@
136
136
  }
137
137
  ]
138
138
  },
139
- {
140
- "kind": "javascript-module",
141
- "path": "src/utils/data-model.ts",
142
- "declarations": [
143
- {
144
- "kind": "function",
145
- "name": "groupToModelGroup",
146
- "return": {
147
- "type": {
148
- "text": "ModelGroup"
149
- }
150
- },
151
- "parameters": [
152
- {
153
- "name": "group",
154
- "type": {
155
- "text": "Group"
156
- }
157
- },
158
- {
159
- "name": "provider",
160
- "type": {
161
- "text": "MetadataProvider"
162
- }
163
- }
164
- ],
165
- "description": "Converts a Group to a ModelGroup (adds required metadata)"
166
- },
167
- {
168
- "kind": "function",
169
- "name": "modelGroupToGroup",
170
- "return": {
171
- "type": {
172
- "text": ""
173
- }
174
- },
175
- "parameters": [
176
- {
177
- "name": "modelGroup",
178
- "type": {
179
- "text": "ModelGroup"
180
- },
181
- "description": "The internal ModelGroup to convert."
182
- }
183
- ],
184
- "description": "Converts a ModelGroup (internal data structure) to a public Group structure.\nThis function recursively processes the rules within the group."
185
- },
186
- {
187
- "kind": "function",
188
- "name": "modelRuleToRule",
189
- "return": {
190
- "type": {
191
- "text": ""
192
- }
193
- },
194
- "parameters": [
195
- {
196
- "name": "modelRule",
197
- "type": {
198
- "text": "ModelRule"
199
- },
200
- "description": "The internal ModelRule to convert."
201
- }
202
- ],
203
- "description": "Converts a ModelRule (internal data structure) to a public Rule structure."
204
- }
205
- ],
206
- "exports": [
207
- {
208
- "kind": "js",
209
- "name": "groupToModelGroup",
210
- "declaration": {
211
- "name": "groupToModelGroup",
212
- "module": "src/utils/data-model.ts"
213
- }
214
- },
215
- {
216
- "kind": "js",
217
- "name": "modelGroupToGroup",
218
- "declaration": {
219
- "name": "modelGroupToGroup",
220
- "module": "src/utils/data-model.ts"
221
- }
222
- },
223
- {
224
- "kind": "js",
225
- "name": "modelRuleToRule",
226
- "declaration": {
227
- "name": "modelRuleToRule",
228
- "module": "src/utils/data-model.ts"
229
- }
230
- }
231
- ]
232
- },
233
- {
234
- "kind": "javascript-module",
235
- "path": "src/utils/formatting.ts",
236
- "declarations": [
237
- {
238
- "kind": "function",
239
- "name": "formatDateString",
240
- "parameters": [
241
- {
242
- "name": "date",
243
- "type": {
244
- "text": "Date"
245
- }
246
- }
247
- ],
248
- "description": "Gets the string representation from a `Date` which is the format a `date` input uses.\n`yyyy-mm-dd`"
249
- },
250
- {
251
- "kind": "function",
252
- "name": "formatDateTimeString",
253
- "parameters": [
254
- {
255
- "name": "date",
256
- "type": {
257
- "text": "Date"
258
- }
259
- }
260
- ],
261
- "description": "Gets the string representation from a `Date` which is the format a `datetime-local` input uses.\n`yyyy-mm-ddThh:mm:ss`"
262
- }
263
- ],
264
- "exports": [
265
- {
266
- "kind": "js",
267
- "name": "formatDateString",
268
- "declaration": {
269
- "name": "formatDateString",
270
- "module": "src/utils/formatting.ts"
271
- }
272
- },
273
- {
274
- "kind": "js",
275
- "name": "formatDateTimeString",
276
- "declaration": {
277
- "name": "formatDateTimeString",
278
- "module": "src/utils/formatting.ts"
279
- }
280
- }
281
- ]
282
- },
283
- {
284
- "kind": "javascript-module",
285
- "path": "src/utils/index.ts",
286
- "declarations": [],
287
- "exports": [
288
- {
289
- "kind": "js",
290
- "name": "*",
291
- "declaration": {
292
- "name": "*",
293
- "package": "./data-model"
294
- }
295
- },
296
- {
297
- "kind": "js",
298
- "name": "*",
299
- "declaration": {
300
- "name": "*",
301
- "package": "./formatting"
302
- }
303
- },
304
- {
305
- "kind": "js",
306
- "name": "*",
307
- "declaration": {
308
- "name": "*",
309
- "package": "./misc"
310
- }
311
- }
312
- ]
313
- },
314
- {
315
- "kind": "javascript-module",
316
- "path": "src/utils/misc.ts",
317
- "declarations": [
318
- {
319
- "kind": "function",
320
- "name": "processOptGroups",
321
- "return": {
322
- "type": {
323
- "text": "(T | { optgroup: string | null; xs: T[] })[]"
324
- }
325
- },
326
- "parameters": [
327
- {
328
- "name": "xs",
329
- "type": {
330
- "text": "T[]"
331
- }
332
- }
333
- ]
334
- },
335
- {
336
- "kind": "function",
337
- "name": "applyCustomStyles",
338
- "return": {
339
- "type": {
340
- "text": "void"
341
- }
342
- },
343
- "parameters": [
344
- {
345
- "name": "component",
346
- "type": {
347
- "text": "HTMLElement"
348
- },
349
- "description": "The web component instance"
350
- },
351
- {
352
- "name": "styles",
353
- "type": {
354
- "text": "Styles | undefined | null"
355
- },
356
- "description": "The styles configuration object"
357
- },
358
- {
359
- "name": "styleKey",
360
- "type": {
361
- "text": "keyof NonNullable<Styles['customStyles']>"
362
- },
363
- "description": "The key in styles.customStyles to use for custom styles"
364
- }
365
- ],
366
- "description": "Utility function to add custom styles to a web component's shadow root"
367
- }
368
- ],
369
- "exports": [
370
- {
371
- "kind": "js",
372
- "name": "processOptGroups",
373
- "declaration": {
374
- "name": "processOptGroups",
375
- "module": "src/utils/misc.ts"
376
- }
377
- },
378
- {
379
- "kind": "js",
380
- "name": "applyCustomStyles",
381
- "declaration": {
382
- "name": "applyCustomStyles",
383
- "module": "src/utils/misc.ts"
384
- }
385
- }
386
- ]
387
- },
388
139
  {
389
140
  "kind": "javascript-module",
390
141
  "path": "src/main/events.ts",
@@ -829,57 +580,267 @@
829
580
  "privacy": "private"
830
581
  },
831
582
  {
832
- "kind": "method",
833
- "name": "_handleUpdateRuleData",
834
- "privacy": "private",
835
- "parameters": [
836
- {
837
- "name": "event",
838
- "type": {
839
- "text": "CustomEvent<EventsDetailMap[Events.UpdateRule]>"
840
- }
841
- }
842
- ]
583
+ "kind": "method",
584
+ "name": "_handleUpdateRuleData",
585
+ "privacy": "private",
586
+ "parameters": [
587
+ {
588
+ "name": "event",
589
+ "type": {
590
+ "text": "CustomEvent<EventsDetailMap[Events.UpdateRule]>"
591
+ }
592
+ }
593
+ ]
594
+ }
595
+ ],
596
+ "events": [
597
+ {
598
+ "name": "change",
599
+ "type": {
600
+ "text": "CustomEvent"
601
+ }
602
+ }
603
+ ],
604
+ "superclass": {
605
+ "name": "GenesisElement",
606
+ "package": "@genesislcap/web-core"
607
+ },
608
+ "tagName": "expression-builder",
609
+ "customElement": true
610
+ }
611
+ ],
612
+ "exports": [
613
+ {
614
+ "kind": "js",
615
+ "name": "ExpressionBuilder",
616
+ "declaration": {
617
+ "name": "ExpressionBuilder",
618
+ "module": "src/main/expression-builder.ts"
619
+ }
620
+ },
621
+ {
622
+ "kind": "custom-element-definition",
623
+ "name": "expression-builder",
624
+ "declaration": {
625
+ "name": "ExpressionBuilder",
626
+ "module": "src/main/expression-builder.ts"
627
+ }
628
+ }
629
+ ]
630
+ },
631
+ {
632
+ "kind": "javascript-module",
633
+ "path": "src/main/index.ts",
634
+ "declarations": [],
635
+ "exports": [
636
+ {
637
+ "kind": "js",
638
+ "name": "*",
639
+ "declaration": {
640
+ "name": "*",
641
+ "package": "./expression-builder"
642
+ }
643
+ },
644
+ {
645
+ "kind": "js",
646
+ "name": "*",
647
+ "declaration": {
648
+ "name": "*",
649
+ "package": "./expression-builder.styles"
650
+ }
651
+ },
652
+ {
653
+ "kind": "js",
654
+ "name": "*",
655
+ "declaration": {
656
+ "name": "*",
657
+ "package": "./expression-builder.template"
658
+ }
659
+ }
660
+ ]
661
+ },
662
+ {
663
+ "kind": "javascript-module",
664
+ "path": "src/types/index.ts",
665
+ "declarations": [],
666
+ "exports": [
667
+ {
668
+ "kind": "js",
669
+ "name": "*",
670
+ "declaration": {
671
+ "name": "*",
672
+ "package": "./public.types"
673
+ }
674
+ },
675
+ {
676
+ "kind": "js",
677
+ "name": "*",
678
+ "declaration": {
679
+ "name": "*",
680
+ "package": "./private.types"
681
+ }
682
+ }
683
+ ]
684
+ },
685
+ {
686
+ "kind": "javascript-module",
687
+ "path": "src/types/private.types.ts",
688
+ "declarations": [],
689
+ "exports": []
690
+ },
691
+ {
692
+ "kind": "javascript-module",
693
+ "path": "src/types/public.types.ts",
694
+ "declarations": [],
695
+ "exports": []
696
+ },
697
+ {
698
+ "kind": "javascript-module",
699
+ "path": "src/utils/data-model.ts",
700
+ "declarations": [
701
+ {
702
+ "kind": "function",
703
+ "name": "groupToModelGroup",
704
+ "return": {
705
+ "type": {
706
+ "text": "ModelGroup"
707
+ }
708
+ },
709
+ "parameters": [
710
+ {
711
+ "name": "group",
712
+ "type": {
713
+ "text": "Group"
714
+ }
715
+ },
716
+ {
717
+ "name": "provider",
718
+ "type": {
719
+ "text": "MetadataProvider"
720
+ }
721
+ }
722
+ ],
723
+ "description": "Converts a Group to a ModelGroup (adds required metadata)"
724
+ },
725
+ {
726
+ "kind": "function",
727
+ "name": "modelGroupToGroup",
728
+ "return": {
729
+ "type": {
730
+ "text": ""
731
+ }
732
+ },
733
+ "parameters": [
734
+ {
735
+ "name": "modelGroup",
736
+ "type": {
737
+ "text": "ModelGroup"
738
+ },
739
+ "description": "The internal ModelGroup to convert."
740
+ }
741
+ ],
742
+ "description": "Converts a ModelGroup (internal data structure) to a public Group structure.\nThis function recursively processes the rules within the group."
743
+ },
744
+ {
745
+ "kind": "function",
746
+ "name": "modelRuleToRule",
747
+ "return": {
748
+ "type": {
749
+ "text": ""
750
+ }
751
+ },
752
+ "parameters": [
753
+ {
754
+ "name": "modelRule",
755
+ "type": {
756
+ "text": "ModelRule"
757
+ },
758
+ "description": "The internal ModelRule to convert."
759
+ }
760
+ ],
761
+ "description": "Converts a ModelRule (internal data structure) to a public Rule structure."
762
+ }
763
+ ],
764
+ "exports": [
765
+ {
766
+ "kind": "js",
767
+ "name": "groupToModelGroup",
768
+ "declaration": {
769
+ "name": "groupToModelGroup",
770
+ "module": "src/utils/data-model.ts"
771
+ }
772
+ },
773
+ {
774
+ "kind": "js",
775
+ "name": "modelGroupToGroup",
776
+ "declaration": {
777
+ "name": "modelGroupToGroup",
778
+ "module": "src/utils/data-model.ts"
779
+ }
780
+ },
781
+ {
782
+ "kind": "js",
783
+ "name": "modelRuleToRule",
784
+ "declaration": {
785
+ "name": "modelRuleToRule",
786
+ "module": "src/utils/data-model.ts"
787
+ }
788
+ }
789
+ ]
790
+ },
791
+ {
792
+ "kind": "javascript-module",
793
+ "path": "src/utils/formatting.ts",
794
+ "declarations": [
795
+ {
796
+ "kind": "function",
797
+ "name": "formatDateString",
798
+ "parameters": [
799
+ {
800
+ "name": "date",
801
+ "type": {
802
+ "text": "Date"
803
+ }
843
804
  }
844
805
  ],
845
- "events": [
806
+ "description": "Gets the string representation from a `Date` which is the format a `date` input uses.\n`yyyy-mm-dd`"
807
+ },
808
+ {
809
+ "kind": "function",
810
+ "name": "formatDateTimeString",
811
+ "parameters": [
846
812
  {
847
- "name": "change",
813
+ "name": "date",
848
814
  "type": {
849
- "text": "CustomEvent"
815
+ "text": "Date"
850
816
  }
851
817
  }
852
818
  ],
853
- "superclass": {
854
- "name": "GenesisElement",
855
- "package": "@genesislcap/web-core"
856
- },
857
- "tagName": "expression-builder",
858
- "customElement": true
819
+ "description": "Gets the string representation from a `Date` which is the format a `datetime-local` input uses.\n`yyyy-mm-ddThh:mm:ss`"
859
820
  }
860
821
  ],
861
822
  "exports": [
862
823
  {
863
824
  "kind": "js",
864
- "name": "ExpressionBuilder",
825
+ "name": "formatDateString",
865
826
  "declaration": {
866
- "name": "ExpressionBuilder",
867
- "module": "src/main/expression-builder.ts"
827
+ "name": "formatDateString",
828
+ "module": "src/utils/formatting.ts"
868
829
  }
869
830
  },
870
831
  {
871
- "kind": "custom-element-definition",
872
- "name": "expression-builder",
832
+ "kind": "js",
833
+ "name": "formatDateTimeString",
873
834
  "declaration": {
874
- "name": "ExpressionBuilder",
875
- "module": "src/main/expression-builder.ts"
835
+ "name": "formatDateTimeString",
836
+ "module": "src/utils/formatting.ts"
876
837
  }
877
838
  }
878
839
  ]
879
840
  },
880
841
  {
881
842
  "kind": "javascript-module",
882
- "path": "src/main/index.ts",
843
+ "path": "src/utils/index.ts",
883
844
  "declarations": [],
884
845
  "exports": [
885
846
  {
@@ -887,7 +848,7 @@
887
848
  "name": "*",
888
849
  "declaration": {
889
850
  "name": "*",
890
- "package": "./expression-builder"
851
+ "package": "./data-model"
891
852
  }
892
853
  },
893
854
  {
@@ -895,7 +856,7 @@
895
856
  "name": "*",
896
857
  "declaration": {
897
858
  "name": "*",
898
- "package": "./expression-builder.styles"
859
+ "package": "./formatting"
899
860
  }
900
861
  },
901
862
  {
@@ -903,46 +864,85 @@
903
864
  "name": "*",
904
865
  "declaration": {
905
866
  "name": "*",
906
- "package": "./expression-builder.template"
867
+ "package": "./misc"
907
868
  }
908
869
  }
909
870
  ]
910
871
  },
911
872
  {
912
873
  "kind": "javascript-module",
913
- "path": "src/types/index.ts",
914
- "declarations": [],
874
+ "path": "src/utils/misc.ts",
875
+ "declarations": [
876
+ {
877
+ "kind": "function",
878
+ "name": "processOptGroups",
879
+ "return": {
880
+ "type": {
881
+ "text": "(T | { optgroup: string | null; xs: T[] })[]"
882
+ }
883
+ },
884
+ "parameters": [
885
+ {
886
+ "name": "xs",
887
+ "type": {
888
+ "text": "T[]"
889
+ }
890
+ }
891
+ ]
892
+ },
893
+ {
894
+ "kind": "function",
895
+ "name": "applyCustomStyles",
896
+ "return": {
897
+ "type": {
898
+ "text": "void"
899
+ }
900
+ },
901
+ "parameters": [
902
+ {
903
+ "name": "component",
904
+ "type": {
905
+ "text": "HTMLElement"
906
+ },
907
+ "description": "The web component instance"
908
+ },
909
+ {
910
+ "name": "styles",
911
+ "type": {
912
+ "text": "Styles | undefined | null"
913
+ },
914
+ "description": "The styles configuration object"
915
+ },
916
+ {
917
+ "name": "styleKey",
918
+ "type": {
919
+ "text": "keyof NonNullable<Styles['customStyles']>"
920
+ },
921
+ "description": "The key in styles.customStyles to use for custom styles"
922
+ }
923
+ ],
924
+ "description": "Utility function to add custom styles to a web component's shadow root"
925
+ }
926
+ ],
915
927
  "exports": [
916
928
  {
917
929
  "kind": "js",
918
- "name": "*",
930
+ "name": "processOptGroups",
919
931
  "declaration": {
920
- "name": "*",
921
- "package": "./public.types"
932
+ "name": "processOptGroups",
933
+ "module": "src/utils/misc.ts"
922
934
  }
923
935
  },
924
936
  {
925
937
  "kind": "js",
926
- "name": "*",
938
+ "name": "applyCustomStyles",
927
939
  "declaration": {
928
- "name": "*",
929
- "package": "./private.types"
940
+ "name": "applyCustomStyles",
941
+ "module": "src/utils/misc.ts"
930
942
  }
931
943
  }
932
944
  ]
933
945
  },
934
- {
935
- "kind": "javascript-module",
936
- "path": "src/types/private.types.ts",
937
- "declarations": [],
938
- "exports": []
939
- },
940
- {
941
- "kind": "javascript-module",
942
- "path": "src/types/public.types.ts",
943
- "declarations": [],
944
- "exports": []
945
- },
946
946
  {
947
947
  "kind": "javascript-module",
948
948
  "path": "src/main/expression-group/expression-group.styles.ts",
@@ -1417,12 +1417,12 @@
1417
1417
  },
1418
1418
  {
1419
1419
  "kind": "javascript-module",
1420
- "path": "src/main/rule-field/rule-field.template.ts",
1420
+ "path": "src/main/rule-operator/rule-operator.template.ts",
1421
1421
  "declarations": [
1422
1422
  {
1423
1423
  "kind": "variable",
1424
1424
  "name": "template",
1425
- "default": "html<RuleField>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleField>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.dispatchFieldsChanged(c.event)}\n value=${(x) => x.field?.fieldId}\n >\n <${optionTag} value=\"\">Select a field</${optionTag}>\n ${repeat(\n (x) => x.groupedFieldss,\n html<{ optgroup: string | null; xs: Field[] } | Field, RuleField>`\n ${(groupOrFields) => {\n if ('xs' in groupOrFields) {\n return html<{\n optgroup: string | null;\n xs: Field[];\n }>`\n <${optgroupTag} label=\"${(x) => x.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Field>`\n <${optionTag}\n value=\"${(x) => x.fieldId}\"\n ?selected=${(x, c) => x.fieldId === c.parentContext.parent?.field?.fieldId}\n >\n ${(x) => x.label}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Field>`\n <${optionTag}\n value=\"${(x) => x.fieldId}\"\n ?selected=${(x, c) => x.fieldId === c.parent?.field?.fieldId}\n >\n ${(x) => x.label}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
1425
+ "default": "html<RuleOperator>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleOperator>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.handleOperatorChange(c.event)}\n value=${(x) => x.operator?.type}\n >\n <${optionTag} value=\"\">Select an operator</${optionTag}>\n ${repeat(\n (x) => x.groupedOperators,\n html<{ optgroup: string | null; xs: Operator[] } | Operator, RuleOperator>`\n ${(groupOrOperator) => {\n if ('xs' in groupOrOperator) {\n return html<{ optgroup: string | null; xs: Operator[] }, RuleOperator>`\n <${optgroupTag} label=\"${groupOrOperator.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Operator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => x.type === c.parentContext.parent.operator?.type}\n >\n ${(x) => x.type}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Operator, RuleOperator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => c.parent.operator?.type === x.type}\n >\n ${(x) => x.type}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
1426
1426
  }
1427
1427
  ],
1428
1428
  "exports": [
@@ -1431,35 +1431,43 @@
1431
1431
  "name": "template",
1432
1432
  "declaration": {
1433
1433
  "name": "template",
1434
- "module": "src/main/rule-field/rule-field.template.ts"
1434
+ "module": "src/main/rule-operator/rule-operator.template.ts"
1435
1435
  }
1436
1436
  }
1437
1437
  ]
1438
1438
  },
1439
1439
  {
1440
1440
  "kind": "javascript-module",
1441
- "path": "src/main/rule-field/rule-field.ts",
1441
+ "path": "src/main/rule-operator/rule-operator.ts",
1442
1442
  "declarations": [
1443
1443
  {
1444
1444
  "kind": "class",
1445
1445
  "description": "",
1446
- "name": "RuleField",
1446
+ "name": "RuleOperator",
1447
1447
  "members": [
1448
1448
  {
1449
1449
  "kind": "field",
1450
- "name": "fields",
1450
+ "name": "operators",
1451
1451
  "type": {
1452
- "text": "Field[]"
1452
+ "text": "Operator[]"
1453
1453
  },
1454
1454
  "default": "[]"
1455
1455
  },
1456
1456
  {
1457
1457
  "kind": "field",
1458
- "name": "field",
1458
+ "name": "operator",
1459
1459
  "type": {
1460
- "text": "Field"
1460
+ "text": "Operator"
1461
1461
  }
1462
1462
  },
1463
+ {
1464
+ "kind": "field",
1465
+ "name": "field",
1466
+ "type": {
1467
+ "text": "Field | null"
1468
+ },
1469
+ "default": "null"
1470
+ },
1463
1471
  {
1464
1472
  "kind": "field",
1465
1473
  "name": "config",
@@ -1476,15 +1484,23 @@
1476
1484
  },
1477
1485
  {
1478
1486
  "kind": "field",
1479
- "name": "groupedFieldss",
1487
+ "name": "allowedOperators",
1480
1488
  "type": {
1481
- "text": "(Field | { optgroup: string | null; xs: Field[] })[]"
1489
+ "text": "Operator[]"
1490
+ },
1491
+ "readonly": true
1492
+ },
1493
+ {
1494
+ "kind": "field",
1495
+ "name": "groupedOperators",
1496
+ "type": {
1497
+ "text": "(Operator | { optgroup: string | null; xs: Operator[] })[]"
1482
1498
  },
1483
1499
  "readonly": true
1484
1500
  },
1485
1501
  {
1486
1502
  "kind": "method",
1487
- "name": "dispatchFieldsChanged",
1503
+ "name": "handleOperatorChange",
1488
1504
  "parameters": [
1489
1505
  {
1490
1506
  "name": "event",
@@ -1506,37 +1522,37 @@
1506
1522
  "name": "GenesisElement",
1507
1523
  "package": "@genesislcap/web-core"
1508
1524
  },
1509
- "tagName": "expression-rule-field",
1525
+ "tagName": "expression-rule-operator",
1510
1526
  "customElement": true
1511
1527
  }
1512
1528
  ],
1513
1529
  "exports": [
1514
1530
  {
1515
1531
  "kind": "js",
1516
- "name": "RuleField",
1532
+ "name": "RuleOperator",
1517
1533
  "declaration": {
1518
- "name": "RuleField",
1519
- "module": "src/main/rule-field/rule-field.ts"
1534
+ "name": "RuleOperator",
1535
+ "module": "src/main/rule-operator/rule-operator.ts"
1520
1536
  }
1521
1537
  },
1522
1538
  {
1523
1539
  "kind": "custom-element-definition",
1524
- "name": "expression-rule-field",
1540
+ "name": "expression-rule-operator",
1525
1541
  "declaration": {
1526
- "name": "RuleField",
1527
- "module": "src/main/rule-field/rule-field.ts"
1542
+ "name": "RuleOperator",
1543
+ "module": "src/main/rule-operator/rule-operator.ts"
1528
1544
  }
1529
1545
  }
1530
1546
  ]
1531
1547
  },
1532
1548
  {
1533
1549
  "kind": "javascript-module",
1534
- "path": "src/main/rule-operator/rule-operator.template.ts",
1550
+ "path": "src/main/rule-field/rule-field.template.ts",
1535
1551
  "declarations": [
1536
1552
  {
1537
1553
  "kind": "variable",
1538
1554
  "name": "template",
1539
- "default": "html<RuleOperator>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleOperator>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.handleOperatorChange(c.event)}\n value=${(x) => x.operator?.type}\n >\n <${optionTag} value=\"\">Select an operator</${optionTag}>\n ${repeat(\n (x) => x.groupedOperators,\n html<{ optgroup: string | null; xs: Operator[] } | Operator, RuleOperator>`\n ${(groupOrOperator) => {\n if ('xs' in groupOrOperator) {\n return html<{ optgroup: string | null; xs: Operator[] }, RuleOperator>`\n <${optgroupTag} label=\"${groupOrOperator.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Operator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => x.type === c.parentContext.parent.operator?.type}\n >\n ${(x) => x.type}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Operator, RuleOperator>`\n <${optionTag}\n value=\"${(x) => x.type}\"\n ?selected=${(x, c) => c.parent.operator?.type === x.type}\n >\n ${(x) => x.type}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
1555
+ "default": "html<RuleField>`\n ${(context) => {\n const selectTag = context.styles?.customElements?.select || 'select';\n const optionTag = context.styles?.customElements?.option || 'option';\n const optgroupTag = 'optgroup'; // Not supporting custom optgroup for now\n\n return html<RuleField>`\n <${selectTag}\n class=\"form-select\"\n @change=${(x, c) => x.dispatchFieldsChanged(c.event)}\n value=${(x) => x.field?.fieldId}\n >\n <${optionTag} value=\"\">Select a field</${optionTag}>\n ${repeat(\n (x) => x.groupedFieldss,\n html<{ optgroup: string | null; xs: Field[] } | Field, RuleField>`\n ${(groupOrFields) => {\n if ('xs' in groupOrFields) {\n return html<{\n optgroup: string | null;\n xs: Field[];\n }>`\n <${optgroupTag} label=\"${(x) => x.optgroup}\">\n ${repeat(\n (x) => x.xs,\n html<Field>`\n <${optionTag}\n value=\"${(x) => x.fieldId}\"\n ?selected=${(x, c) => x.fieldId === c.parentContext.parent?.field?.fieldId}\n >\n ${(x) => x.label}\n </${optionTag}>\n `,\n )}\n </${optgroupTag}>\n `;\n } else {\n return html<Field>`\n <${optionTag}\n value=\"${(x) => x.fieldId}\"\n ?selected=${(x, c) => x.fieldId === c.parent?.field?.fieldId}\n >\n ${(x) => x.label}\n </${optionTag}>\n `;\n }\n }}\n `,\n )}\n </${selectTag}>\n `;\n }}\n`"
1540
1556
  }
1541
1557
  ],
1542
1558
  "exports": [
@@ -1545,42 +1561,34 @@
1545
1561
  "name": "template",
1546
1562
  "declaration": {
1547
1563
  "name": "template",
1548
- "module": "src/main/rule-operator/rule-operator.template.ts"
1564
+ "module": "src/main/rule-field/rule-field.template.ts"
1549
1565
  }
1550
1566
  }
1551
1567
  ]
1552
1568
  },
1553
1569
  {
1554
1570
  "kind": "javascript-module",
1555
- "path": "src/main/rule-operator/rule-operator.ts",
1571
+ "path": "src/main/rule-field/rule-field.ts",
1556
1572
  "declarations": [
1557
1573
  {
1558
1574
  "kind": "class",
1559
1575
  "description": "",
1560
- "name": "RuleOperator",
1576
+ "name": "RuleField",
1561
1577
  "members": [
1562
1578
  {
1563
1579
  "kind": "field",
1564
- "name": "operators",
1580
+ "name": "fields",
1565
1581
  "type": {
1566
- "text": "Operator[]"
1582
+ "text": "Field[]"
1567
1583
  },
1568
1584
  "default": "[]"
1569
1585
  },
1570
- {
1571
- "kind": "field",
1572
- "name": "operator",
1573
- "type": {
1574
- "text": "Operator"
1575
- }
1576
- },
1577
1586
  {
1578
1587
  "kind": "field",
1579
1588
  "name": "field",
1580
1589
  "type": {
1581
- "text": "Field | null"
1582
- },
1583
- "default": "null"
1590
+ "text": "Field"
1591
+ }
1584
1592
  },
1585
1593
  {
1586
1594
  "kind": "field",
@@ -1598,23 +1606,15 @@
1598
1606
  },
1599
1607
  {
1600
1608
  "kind": "field",
1601
- "name": "allowedOperators",
1602
- "type": {
1603
- "text": "Operator[]"
1604
- },
1605
- "readonly": true
1606
- },
1607
- {
1608
- "kind": "field",
1609
- "name": "groupedOperators",
1609
+ "name": "groupedFieldss",
1610
1610
  "type": {
1611
- "text": "(Operator | { optgroup: string | null; xs: Operator[] })[]"
1611
+ "text": "(Field | { optgroup: string | null; xs: Field[] })[]"
1612
1612
  },
1613
1613
  "readonly": true
1614
1614
  },
1615
1615
  {
1616
1616
  "kind": "method",
1617
- "name": "handleOperatorChange",
1617
+ "name": "dispatchFieldsChanged",
1618
1618
  "parameters": [
1619
1619
  {
1620
1620
  "name": "event",
@@ -1636,25 +1636,25 @@
1636
1636
  "name": "GenesisElement",
1637
1637
  "package": "@genesislcap/web-core"
1638
1638
  },
1639
- "tagName": "expression-rule-operator",
1639
+ "tagName": "expression-rule-field",
1640
1640
  "customElement": true
1641
1641
  }
1642
1642
  ],
1643
1643
  "exports": [
1644
1644
  {
1645
1645
  "kind": "js",
1646
- "name": "RuleOperator",
1646
+ "name": "RuleField",
1647
1647
  "declaration": {
1648
- "name": "RuleOperator",
1649
- "module": "src/main/rule-operator/rule-operator.ts"
1648
+ "name": "RuleField",
1649
+ "module": "src/main/rule-field/rule-field.ts"
1650
1650
  }
1651
1651
  },
1652
1652
  {
1653
1653
  "kind": "custom-element-definition",
1654
- "name": "expression-rule-operator",
1654
+ "name": "expression-rule-field",
1655
1655
  "declaration": {
1656
- "name": "RuleOperator",
1657
- "module": "src/main/rule-operator/rule-operator.ts"
1656
+ "name": "RuleField",
1657
+ "module": "src/main/rule-field/rule-field.ts"
1658
1658
  }
1659
1659
  }
1660
1660
  ]
@@ -8,6 +8,13 @@ export declare class ExpressionBuilder extends GenesisElement implements Metadat
8
8
  model: ModelGroup | null;
9
9
  private ruleCount;
10
10
  private groupCount;
11
+ /**
12
+ * @internal
13
+ * We don't want to dispatch a change event for the model if it's just changed because
14
+ * the user updated it themselves, otherwise if they automatically update the config property
15
+ * on change it'll get into an infinite loop
16
+ */
17
+ private userUpdatingModel;
11
18
  /** @internal */
12
19
  configChanged(_: Config, newConfig: Config): void;
13
20
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"expression-builder.d.ts","sourceRoot":"","sources":["../../../src/main/expression-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAqB,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAkB7F,cAAc;AACd,qBAKa,iBAAkB,SAAQ,cAAe,YAAW,gBAAgB;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAQ;IAE5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;IAEvB,gBAAgB;IAChB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAQ1C,gBAAgB;IAChB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU;IAM5C;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK;IAa1C,gBAAgB;IAChB,SAAS,IAAI,MAAM;IAInB,gBAAgB;IAChB,UAAU;IAKV,gBAAgB;IAChB,SAAS;IAOT,iBAAiB;IA0BjB,oBAAoB,IAAI,IAAI;IAU5B,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB,CAAsC;IAC/D,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,qBAAqB;CAI9B"}
1
+ {"version":3,"file":"expression-builder.d.ts","sourceRoot":"","sources":["../../../src/main/expression-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAqB,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAkB7F,cAAc;AACd,qBAKa,iBAAkB,SAAQ,cAAe,YAAW,gBAAgB;IACnE,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAQ;IAE5C,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;IAEvB;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB,CAAS;IAElC,gBAAgB;IAChB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAU1C,gBAAgB;IAChB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU;IAM5C;;;;;;OAMG;IACH,SAAS,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK;IAa1C,gBAAgB;IAChB,SAAS,IAAI,MAAM;IAInB,gBAAgB;IAChB,UAAU;IAKV,gBAAgB;IAChB,SAAS;IAOT,iBAAiB;IA0BjB,oBAAoB,IAAI,IAAI;IAU5B,OAAO,CAAC,cAAc,CAAmC;IACzD,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB,CAAsC;IAC/D,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,qBAAqB,CAA0C;IACvE,OAAO,CAAC,sBAAsB;IAK9B,OAAO,CAAC,oBAAoB,CAAyC;IACrE,OAAO,CAAC,qBAAqB;CAI9B"}
@@ -16,6 +16,13 @@ let ExpressionBuilder = class ExpressionBuilder extends GenesisElement {
16
16
  this.model = null;
17
17
  this.ruleCount = 0;
18
18
  this.groupCount = 0;
19
+ /**
20
+ * @internal
21
+ * We don't want to dispatch a change event for the model if it's just changed because
22
+ * the user updated it themselves, otherwise if they automatically update the config property
23
+ * on change it'll get into an infinite loop
24
+ */
25
+ this.userUpdatingModel = false;
19
26
  this.handleAddGroup = this._handleAddGroup.bind(this);
20
27
  this.handleAddRule = this._handleAddRule.bind(this);
21
28
  this.handleDeleteGroup = this._handleDeleteGroup.bind(this);
@@ -28,12 +35,14 @@ let ExpressionBuilder = class ExpressionBuilder extends GenesisElement {
28
35
  if (newConfig.model) {
29
36
  this.ruleCount = 0;
30
37
  this.groupCount = 0;
38
+ this.userUpdatingModel = true;
31
39
  this.model = groupToModelGroup(newConfig.model, this);
40
+ this.userUpdatingModel = false;
32
41
  }
33
42
  }
34
43
  /** @internal */
35
44
  modelChanged(_, newModel) {
36
- if (!newModel)
45
+ if (!newModel || this.userUpdatingModel)
37
46
  return;
38
47
  const group = modelGroupToGroup(newModel);
39
48
  this.dispatchChangeEvent(group);
@@ -113,6 +113,13 @@ export declare class ExpressionBuilder extends GenesisElement implements Metadat
113
113
  model: ModelGroup | null;
114
114
  private ruleCount;
115
115
  private groupCount;
116
+ /**
117
+ * @internal
118
+ * We don't want to dispatch a change event for the model if it's just changed because
119
+ * the user updated it themselves, otherwise if they automatically update the config property
120
+ * on change it'll get into an infinite loop
121
+ */
122
+ private userUpdatingModel;
116
123
  /** @internal */
117
124
  configChanged(_: Config_2, newConfig: Config_2): void;
118
125
  /** @internal */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/expression-builder",
3
3
  "description": "Genesis Foundation Expression Builder",
4
- "version": "14.251.0",
4
+ "version": "14.251.2",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/expression-builder.d.ts",
@@ -62,5 +62,5 @@
62
62
  "access": "public"
63
63
  },
64
64
  "customElements": "dist/custom-elements.json",
65
- "gitHead": "2ab61e47fbc752e88ecb2d83d794c590a8093829"
65
+ "gitHead": "328275e4c0bc2bf60422f750f9a0dc4e081a81b4"
66
66
  }