@limetech/lime-crm-building-blocks 1.101.0 → 1.102.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/lime-query-validation-6be10fa7.js +558 -0
  4. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +4 -514
  5. package/dist/cjs/{limebb-lime-query-filter-builder_4.cjs.entry.js → limebb-lime-query-filter-builder_3.cjs.entry.js} +1 -243
  6. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
  7. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +165 -71
  8. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
  9. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +242 -0
  10. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +322 -0
  11. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  12. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  14. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  15. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +3 -2
  21. package/dist/collection/components/lime-query-builder/expressions/filter-group-logic.js +150 -0
  22. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
  23. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +15 -71
  24. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
  25. package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
  26. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.css +91 -0
  27. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +355 -0
  28. package/dist/collection/components/lime-query-builder/lime-query-validation.js +40 -0
  29. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
  30. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
  31. package/dist/collection/components/lime-query-builder/{response-format-editor.css → response-format/response-format-editor.css} +1 -1
  32. package/dist/collection/components/lime-query-builder/{response-format-editor.js → response-format/response-format-editor.js} +5 -5
  33. package/dist/collection/components/lime-query-builder/response-format/response-format-helpers.js +92 -0
  34. package/dist/collection/components/lime-query-builder/{response-format-item.css → response-format/response-format-item.css} +1 -1
  35. package/dist/collection/components/lime-query-builder/{response-format-item.js → response-format/response-format-item.js} +6 -6
  36. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  37. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  38. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  39. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  40. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  41. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  42. package/dist/collection/components/text-editor/text-editor.js +1 -1
  43. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  44. package/dist/components/lime-query-filter-comparison.js +1 -1
  45. package/dist/components/lime-query-filter-expression.js +165 -71
  46. package/dist/components/lime-query-validation.js +555 -0
  47. package/dist/components/limebb-lime-query-builder.js +14 -524
  48. package/dist/components/limebb-lime-query-response-format-builder.d.ts +11 -0
  49. package/dist/components/limebb-lime-query-response-format-builder.js +283 -0
  50. package/dist/components/limebb-lime-query-response-format-editor.d.ts +11 -0
  51. package/dist/components/{limebb-response-format-editor.js → limebb-lime-query-response-format-editor.js} +2 -2
  52. package/dist/components/limebb-lime-query-response-format-item.d.ts +11 -0
  53. package/dist/components/{limebb-response-format-item.js → limebb-lime-query-response-format-item.js} +2 -2
  54. package/dist/components/limebb-locale-picker.js +1 -1
  55. package/dist/components/limebb-mention-group-counter.js +2 -2
  56. package/dist/components/limebb-percentage-visualizer.js +2 -2
  57. package/dist/components/limebb-text-editor.js +1 -1
  58. package/dist/components/limebb-trend-indicator.js +1 -1
  59. package/dist/components/limetype-field.js +1 -1
  60. package/dist/components/live-docs-info.js +2 -2
  61. package/dist/components/notification-item.js +1 -1
  62. package/dist/components/order-by-item.js +2 -2
  63. package/dist/components/response-format-editor.js +11 -11
  64. package/dist/components/response-format-item.js +9 -9
  65. package/dist/components/summary-popover.js +3 -3
  66. package/dist/esm/lime-crm-building-blocks.js +1 -1
  67. package/dist/esm/lime-query-validation-573223a5.js +555 -0
  68. package/dist/esm/limebb-lime-query-builder.entry.js +4 -514
  69. package/dist/esm/{limebb-lime-query-filter-builder_4.entry.js → limebb-lime-query-filter-builder_3.entry.js} +2 -243
  70. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
  71. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +165 -71
  72. package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
  73. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +238 -0
  74. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +317 -0
  75. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  76. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  77. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  78. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  79. package/dist/esm/limebb-notification-item.entry.js +1 -1
  80. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  81. package/dist/esm/limebb-text-editor.entry.js +1 -1
  82. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  83. package/dist/esm/loader.js +1 -1
  84. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  85. package/dist/lime-crm-building-blocks/{p-5cf4898d.entry.js → p-0de79b7f.entry.js} +1 -1
  86. package/dist/lime-crm-building-blocks/{p-8c2fb1c9.entry.js → p-0f7135ff.entry.js} +1 -1
  87. package/dist/lime-crm-building-blocks/{p-6aa216ec.entry.js → p-186e9f1a.entry.js} +1 -1
  88. package/dist/lime-crm-building-blocks/p-289ce8b9.entry.js +1 -0
  89. package/dist/lime-crm-building-blocks/p-3351395b.entry.js +1 -0
  90. package/dist/lime-crm-building-blocks/p-33e6d0ec.entry.js +1 -0
  91. package/dist/lime-crm-building-blocks/{p-a1ee8990.entry.js → p-3d1be1c9.entry.js} +1 -1
  92. package/dist/lime-crm-building-blocks/{p-92dfc5f8.entry.js → p-577d8909.entry.js} +1 -1
  93. package/dist/lime-crm-building-blocks/{p-d84874dc.entry.js → p-6f6fed59.entry.js} +1 -1
  94. package/dist/lime-crm-building-blocks/p-7731e1b0.entry.js +1 -0
  95. package/dist/lime-crm-building-blocks/{p-0cd036ed.entry.js → p-7e5528f6.entry.js} +1 -1
  96. package/dist/lime-crm-building-blocks/{p-8601eab5.entry.js → p-a9ac501f.entry.js} +1 -1
  97. package/dist/lime-crm-building-blocks/p-be845252.entry.js +1 -0
  98. package/dist/lime-crm-building-blocks/{p-2725671e.entry.js → p-cb338753.entry.js} +1 -1
  99. package/dist/lime-crm-building-blocks/{p-425eaba2.entry.js → p-d0721b22.entry.js} +1 -1
  100. package/dist/lime-crm-building-blocks/p-fa2da6bc.js +1 -0
  101. package/dist/types/components/lime-query-builder/expressions/filter-group-logic.d.ts +89 -0
  102. package/dist/types/components/lime-query-builder/lime-query-response-format-builder.d.ts +102 -0
  103. package/dist/types/components/lime-query-builder/lime-query-validation.d.ts +13 -0
  104. package/dist/types/components/lime-query-builder/{response-format-editor.d.ts → response-format/response-format-editor.d.ts} +2 -2
  105. package/dist/types/components/lime-query-builder/response-format/response-format-helpers.d.ts +42 -0
  106. package/dist/types/components/lime-query-builder/{response-format-item.d.ts → response-format/response-format-item.d.ts} +2 -2
  107. package/dist/types/components.d.ts +394 -222
  108. package/package.json +1 -1
  109. package/dist/cjs/limebb-response-format-item.cjs.entry.js +0 -80
  110. package/dist/components/limebb-response-format-editor.d.ts +0 -11
  111. package/dist/components/limebb-response-format-item.d.ts +0 -11
  112. package/dist/esm/limebb-response-format-item.entry.js +0 -76
  113. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +0 -1
  114. package/dist/lime-crm-building-blocks/p-67c174d0.entry.js +0 -1
  115. package/dist/lime-crm-building-blocks/p-ccf34631.entry.js +0 -1
  116. package/dist/lime-crm-building-blocks/p-f9efca1d.entry.js +0 -1
@@ -91,11 +91,11 @@ export class PercentageVisualizer {
91
91
  render() {
92
92
  const normalizedValue = this.getNormalizedValue();
93
93
  const zeroPoint = this.getZeroPointPosition();
94
- return (h(Host, { key: '728bef6c27bd5879d971411f812db124c3ac53b3', class: this.getContainerClassList(), style: {
94
+ return (h(Host, { key: 'be67c53d5eb98d9f1f76dfce49242f73c1a1f1ed', class: this.getContainerClassList(), style: {
95
95
  '--limebb-percentage-visualizer-zero-point-position': `${zeroPoint}%`,
96
96
  '--limebb-percentage-visualizer-width': `${Math.abs(normalizedValue)}%`,
97
97
  '--limebb-percentage-visualizer-rotate': `${normalizedValue >= 0 ? '0deg' : '180deg'}`,
98
- } }, h("limel-notched-outline", { key: '0cf575a7e896955572000dd906d98441dec808b1', tabIndex: 0, role: "meter", "aria-valuemin": this.rangeMin, "aria-valuemax": this.rangeMax, "aria-valuenow": this.numValue, "aria-labelledby": this.labelId, "aria-describedby": this.helperTextId, label: this.label, labelId: this.labelId, invalid: this.invalid, required: this.required, hasValue: true, hasFloatingLabel: true, "aria-controls": this.helperTextId }, h("div", { key: '6dc2beefea4d1a5b0a967fd1087db3fe88c8cdf5', slot: "content" }, this.renderVisualization())), this.renderHelperLine()));
98
+ } }, h("limel-notched-outline", { key: '839756a72aaccd97a5f6f2973d5110d1e6ff2aaf', tabIndex: 0, role: "meter", "aria-valuemin": this.rangeMin, "aria-valuemax": this.rangeMax, "aria-valuenow": this.numValue, "aria-labelledby": this.labelId, "aria-describedby": this.helperTextId, label: this.label, labelId: this.labelId, invalid: this.invalid, required: this.required, hasValue: true, hasFloatingLabel: true, "aria-controls": this.helperTextId }, h("div", { key: '02d00150e43a13e1be31e90f09599c067c09cf81', slot: "content" }, this.renderVisualization())), this.renderHelperLine()));
99
99
  }
100
100
  renderVisualization() {
101
101
  if (this.reducePresence && (this.numValue === 0 || !this.hasValue())) {
@@ -118,14 +118,14 @@ export class SummaryPopover {
118
118
  top: '0.125rem',
119
119
  right: '0.125rem',
120
120
  };
121
- return (h("limel-popover", { key: '3ddac967d05644e0e3b18979a051561e08f316c4', style: {
121
+ return (h("limel-popover", { key: '0d6f2ed3dddd353ee8228b84337e2924fc652088', style: {
122
122
  '--limebb-summary-popover-timeout': `${this.triggerDelay}ms`,
123
- }, open: this.isPopoverOpen, onClose: this.onPopoverClose, openDirection: this.openDirection }, h("div", { key: '6187ae07695296c905f2d0bf782b515d15183f05', slot: "trigger", tabIndex: 0, onMouseEnter: this.openPopoverWithDelay, onMouseLeave: this.resetTimeout, onFocus: this.openPopoverWithDelay }, h("slot", { key: '2b338b6ba353104031e0ae9bb1f1380a2f528f1c', name: "trigger" }), h("div", { key: 'ccce297cd4c8a6640a81a0ec54d1b17cafd090a4', class: "opening-countdown-indicator" })), h("limel-card", { key: 'c786b96ad260240ad28b45746f7f3974efe92670', style: {
123
+ }, open: this.isPopoverOpen, onClose: this.onPopoverClose, openDirection: this.openDirection }, h("div", { key: 'f644db3e5d485ace1a2748b4000aca49f3948a35', slot: "trigger", tabIndex: 0, onMouseEnter: this.openPopoverWithDelay, onMouseLeave: this.resetTimeout, onFocus: this.openPopoverWithDelay }, h("slot", { key: '0b5836a870f32b220496c0ddc0abc35a01dc86d8', name: "trigger" }), h("div", { key: '2ffe89c63ef52df0047e6329a21c460faa628c34', class: "opening-countdown-indicator" })), h("limel-card", { key: '786fc57e1de0a6a7e62f6dd844386e9c92045539', style: {
124
124
  'max-width': this.popoverMaxWidth,
125
125
  'max-height': this.popoverMaxHeight,
126
126
  'min-width': '7rem',
127
127
  'min-height': '3rem',
128
- }, orientation: "landscape", heading: this.heading, subheading: this.subheading, icon: this.icon, value: this.value, image: this.image, actions: this.actions, onActionSelected: this.handleSelected }, h("limebb-navigation-button", { key: 'de2b607312164f264c0a344662a69754e1afb7d9', slot: "component", type: "close", style: closeButtonStyle, tooltipLabel: "Close", tooltipHelperLabel: "Esc", onClick: this.handleCloseClick }))));
128
+ }, orientation: "landscape", heading: this.heading, subheading: this.subheading, icon: this.icon, value: this.value, image: this.image, actions: this.actions, onActionSelected: this.handleSelected }, h("limebb-navigation-button", { key: '3aae488dfb00e682400e2f169f98125db9eccd01', slot: "component", type: "close", style: closeButtonStyle, tooltipLabel: "Close", tooltipHelperLabel: "Esc", onClick: this.handleCloseClick }))));
129
129
  }
130
130
  static get is() { return "limebb-summary-popover"; }
131
131
  static get encapsulation() { return "shadow"; }
@@ -13,8 +13,8 @@ export class MentionGroupCounter {
13
13
  render() {
14
14
  const label = this.getLabel();
15
15
  return [
16
- h("span", { key: 'bb868b62f71fe65927d1cd9bad6ee08648a33c73', id: this.tooltipId }, label),
17
- h("limel-tooltip", { key: '5018e97cb9d5522b91ed1c55643ad33c3d7fd51d', elementId: this.tooltipId, label: label, helperLabel: this.helperLabel }),
16
+ h("span", { key: '2ed8fb232e05342565947976d2af9f212cc82331', id: this.tooltipId }, label),
17
+ h("limel-tooltip", { key: '404fcd53eec16a0b0b32a4358125354dd148e339', elementId: this.tooltipId, label: label, helperLabel: this.helperLabel }),
18
18
  ];
19
19
  }
20
20
  getLabel() {
@@ -389,7 +389,7 @@ export class LimeBBTextEditor {
389
389
  }
390
390
  render() {
391
391
  return [
392
- h("limel-text-editor", { key: '3ad4c2bac61f34439bf94b42e0aa7ccceeff9c33', ref: (el) => (this.textEditor = el), tabindex: this.disabled ? -1 : 0, value: this.value, contentType: this.contentType, customElements: this.registeredCustomElements, "aria-disabled": this.disabled, language: this.language, triggers: this.registeredTriggers, onTriggerStart: this.handleTriggerStart, onTriggerStop: this.handleTriggerStop, onTriggerChange: this.handleTriggerChange, onImagePasted: this.handleImagePasted, onMetadataChange: this.handleMetadataChange, ui: this.ui, allowResize: this.allowResize, required: this.required, disabled: this.disabled, readonly: this.readonly, helperText: this.helperText, placeholder: this.placeholder, label: this.label, invalid: this.invalid }),
392
+ h("limel-text-editor", { key: 'b866f4d7a1feabc9a7f04aa9333ec93a0dbb1c60', ref: (el) => (this.textEditor = el), tabindex: this.disabled ? -1 : 0, value: this.value, contentType: this.contentType, customElements: this.registeredCustomElements, "aria-disabled": this.disabled, language: this.language, triggers: this.registeredTriggers, onTriggerStart: this.handleTriggerStart, onTriggerStop: this.handleTriggerStop, onTriggerChange: this.handleTriggerChange, onImagePasted: this.handleImagePasted, onMetadataChange: this.handleMetadataChange, ui: this.ui, allowResize: this.allowResize, required: this.required, disabled: this.disabled, readonly: this.readonly, helperText: this.helperText, placeholder: this.placeholder, label: this.label, invalid: this.invalid }),
393
393
  this.renderPicker(),
394
394
  ];
395
395
  }
@@ -52,7 +52,7 @@ export class TrendIndicator {
52
52
  this.numValue = this.parseValue(this.value);
53
53
  }
54
54
  render() {
55
- return (h(Host, { key: '976bce0393bfff47ba599dc0d534ec9992cec3f8', class: this.getContainerClassList() }, h("limel-notched-outline", { key: '86a89b3773d2fbf3aa9009fd27ce9cb2410f03b5', id: this.tooltipId, label: this.label, labelId: this.labelId, invalid: this.invalid, required: this.required, hasValue: true, hasFloatingLabel: true, "aria-labelledby": this.labelId, "aria-describedby": this.helperTextId, "aria-controls": this.helperTextId }, h("div", { key: '0b9e048eeea62c452671b74db468aa5587e8ddbf', slot: "content", tabIndex: 0 }, this.renderVisualization())), this.renderHelperLine(), this.renderTooltip()));
55
+ return (h(Host, { key: '3718dda17d853d44caaf253480ac0e05017c4696', class: this.getContainerClassList() }, h("limel-notched-outline", { key: '146e3aa3041ade932be6f13766703e2989c24660', id: this.tooltipId, label: this.label, labelId: this.labelId, invalid: this.invalid, required: this.required, hasValue: true, hasFloatingLabel: true, "aria-labelledby": this.labelId, "aria-describedby": this.helperTextId, "aria-controls": this.helperTextId }, h("div", { key: '57eb7eaf1e3a11ba69cf4ef4af9852541abd7902', slot: "content", tabIndex: 0 }, this.renderVisualization())), this.renderHelperLine(), this.renderTooltip()));
56
56
  }
57
57
  renderVisualization() {
58
58
  if (this.reducePresence && (this.numValue === 0 || !this.hasValue())) {
@@ -82,7 +82,7 @@ const LimeQueryFilterComparisonComponent = /*@__PURE__*/ proxyCustomElement(clas
82
82
  };
83
83
  }
84
84
  render() {
85
- return (h("div", { key: 'a077c982ced9840beec3e574cd3e2e336cff6071', class: "expression" }, this.label && h("limel-header", { key: 'fbcb5cf515aac2c8e68d29947c7560684f30822c', heading: this.label }), h("div", { key: 'ffea426ea1295ae11aaa3c910f835acbeed24cd9', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '20064f9fe42a4dfa71b2e1e2d393d50bbe20e2cb', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
85
+ return (h("div", { key: '41fc60ed4ce76de8bbed05ee8cc658a188347cbd', class: "expression" }, this.label && h("limel-header", { key: '95cb9b556e2e0f2c8f3fd8ebe3909c402a844fe3', heading: this.label }), h("div", { key: 'feac7dcf059a0a20ad499d1549fa45d775d6bec8', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), h("limel-icon-button", { key: '0fee01518c1c4a29c347a47ce1ce7856b32dfa8f', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
86
86
  }
87
87
  renderPropertySelector() {
88
88
  return (h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
@@ -4,6 +4,156 @@ import { d as defineCustomElement$3 } from './lime-query-filter-comparison.js';
4
4
  import { d as defineCustomElement$5 } from './lime-query-value-input.js';
5
5
  import { d as defineCustomElement$4 } from './property-selector.js';
6
6
 
7
+ /**
8
+ * Get the subheading text for a filter group based on its operator and expression count
9
+ *
10
+ * @param operator - The group's operator (AND or OR)
11
+ * @param expressionCount - Number of child expressions
12
+ * @returns Subheading text, or empty string if 0 or 1 expressions
13
+ */
14
+ function getFilterGroupSubheading(operator, expressionCount) {
15
+ if (expressionCount <= 1) {
16
+ return '';
17
+ }
18
+ return operator === Zt.AND
19
+ ? 'All of these conditions are true'
20
+ : 'Any of these conditions are true';
21
+ }
22
+ /**
23
+ * Get the label for the "Add condition" button
24
+ *
25
+ * @param operator - The group's operator (AND or OR)
26
+ * @param expressionCount - Number of child expressions
27
+ * @returns Appropriate button label based on context
28
+ */
29
+ function getAddConditionButtonLabel(operator, expressionCount) {
30
+ if (expressionCount === 0) {
31
+ return 'Add a condition';
32
+ }
33
+ return operator === Zt.AND
34
+ ? 'Add another condition'
35
+ : 'Add alternative';
36
+ }
37
+ /**
38
+ * Get the label for the "Add group" button
39
+ *
40
+ * @param operator - The group's operator (AND or OR)
41
+ * @param expressionCount - Number of child expressions
42
+ * @returns Appropriate button label based on context
43
+ */
44
+ function getAddGroupButtonLabel(operator, expressionCount) {
45
+ if (expressionCount === 0) {
46
+ return 'Add a group';
47
+ }
48
+ return operator === Zt.AND
49
+ ? 'Add another group'
50
+ : 'Add alternative group';
51
+ }
52
+ /**
53
+ * Create a new empty comparison expression
54
+ *
55
+ * @returns A new comparison expression with empty key and value
56
+ */
57
+ function createEmptyComparison() {
58
+ return {
59
+ key: '',
60
+ op: Zt.EQUALS,
61
+ exp: '',
62
+ };
63
+ }
64
+ /**
65
+ * Create a new nested group with the opposite operator from the parent
66
+ *
67
+ * @param parentOperator - The parent group's operator
68
+ * @returns A new group with the opposite operator and one empty comparison
69
+ */
70
+ function createNestedGroup(parentOperator) {
71
+ const oppositeOp = parentOperator === Zt.AND ? Zt.OR : Zt.AND;
72
+ return {
73
+ op: oppositeOp,
74
+ exp: [createEmptyComparison()],
75
+ };
76
+ }
77
+ /**
78
+ * Add a new expression to a group immutably
79
+ *
80
+ * @param group - The existing group
81
+ * @param newExpression - The expression to add
82
+ * @returns A new group with the expression added to the end
83
+ */
84
+ function addExpressionToGroup(group, newExpression) {
85
+ return {
86
+ op: group.op,
87
+ exp: [...group.exp, newExpression],
88
+ };
89
+ }
90
+ /**
91
+ * Toggle a group's operator between AND and OR
92
+ *
93
+ * @param group - The group to toggle
94
+ * @returns A new group with the toggled operator
95
+ */
96
+ function toggleGroupOperator(group) {
97
+ const newOperator = group.op === Zt.AND ? Zt.OR : Zt.AND;
98
+ return {
99
+ op: newOperator,
100
+ exp: [...group.exp],
101
+ };
102
+ }
103
+ /**
104
+ * Update a child expression in a group, handling deletion and unwrapping
105
+ *
106
+ * This function handles three scenarios:
107
+ * 1. Update: Replace a child expression with a new one
108
+ * 2. Delete: Remove a child (when updatedChild is undefined)
109
+ * - If last child is deleted, return 'removed' (group should be deleted)
110
+ * - If deletion leaves one child, return 'unwrapped' (unwrap to that child)
111
+ * - Otherwise, return 'updated' with the remaining children
112
+ *
113
+ * @param group - The group containing the child
114
+ * @param childIndex - Index of the child to update
115
+ * @param updatedChild - The new child expression, or undefined to delete
116
+ * @returns Result object with type and resulting expression
117
+ */
118
+ function updateChildExpression(group, childIndex, updatedChild) {
119
+ const expressions = [...group.exp];
120
+ if (!updatedChild) {
121
+ // Deletion - remove the child
122
+ expressions.splice(childIndex, 1);
123
+ if (expressions.length === 0) {
124
+ // No children left - remove the entire group
125
+ return {
126
+ type: 'removed',
127
+ expression: undefined,
128
+ };
129
+ }
130
+ if (expressions.length === 1) {
131
+ // One child left - unwrap to that child
132
+ return {
133
+ type: 'unwrapped',
134
+ expression: expressions[0],
135
+ };
136
+ }
137
+ // Multiple children remain - return updated group
138
+ return {
139
+ type: 'updated',
140
+ expression: {
141
+ op: group.op,
142
+ exp: expressions,
143
+ },
144
+ };
145
+ }
146
+ // Update - replace the child
147
+ expressions[childIndex] = updatedChild;
148
+ return {
149
+ type: 'updated',
150
+ expression: {
151
+ op: group.op,
152
+ exp: expressions,
153
+ },
154
+ };
155
+ }
156
+
7
157
  const limeQueryFilterNotCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem;padding:1rem;border-left:0.25rem solid rgb(var(--contrast-400));background-color:rgb(var(--contrast-100))}";
8
158
  const LimebbLimeQueryFilterNotStyle0 = limeQueryFilterNotCss;
9
159
 
@@ -28,7 +178,7 @@ const LimeQueryFilterNotComponent = /*@__PURE__*/ proxyCustomElement(class LimeQ
28
178
  };
29
179
  }
30
180
  render() {
31
- return (h("div", { key: '9ab4a6b1e99668a0bcee3e3ba8cbbbe5185222e0', class: "expression" }, this.label && h("limel-header", { key: '85e997b0f96db306dd7a4433da959a74303aacfa', heading: this.label }), h("limebb-lime-query-filter-expression", { key: '14f634e125ee78f2aa70c7537b270a31699ba7c2', platform: this.platform, context: this.context, label: "Not", limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression.exp, onExpressionChange: this.handleExpressionChange })));
181
+ return (h("div", { key: '29770b10d0b892750ad2aab3520cec5a82063774', class: "expression" }, this.label && h("limel-header", { key: '9e47d14c6cb526c9c31d67e11a5ed5ec665c7f62', heading: this.label }), h("limebb-lime-query-filter-expression", { key: '943c1529057aa6cc918dc935f1a5782b149351ae', platform: this.platform, context: this.context, label: "Not", limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression.exp, onExpressionChange: this.handleExpressionChange })));
32
182
  }
33
183
  static get style() { return LimebbLimeQueryFilterNotStyle0; }
34
184
  }, [1, "limebb-lime-query-filter-not", {
@@ -84,80 +234,32 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
84
234
  this.expressionChange = createEvent(this, "expressionChange", 7);
85
235
  this.renderChildExpression = (expression, childIndex) => (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
86
236
  this.handleToggleOperator = () => {
87
- const newOperator = this.expression.op === Zt.AND ? Zt.OR : Zt.AND;
88
- this.expressionChange.emit({
89
- op: newOperator,
90
- exp: this.expression.exp,
91
- });
237
+ const newGroup = toggleGroupOperator(this.expression);
238
+ this.expressionChange.emit(newGroup);
92
239
  };
93
240
  this.handleAddChildExpression = () => {
94
- // Always add a new comparison directly to the list
95
- const newChild = {
96
- key: '',
97
- op: Zt.EQUALS,
98
- exp: '',
99
- };
100
- this.expressionChange.emit({
101
- op: this.expression.op,
102
- exp: [...this.expression.exp, newChild],
103
- });
241
+ const newChild = createEmptyComparison();
242
+ const newGroup = addExpressionToGroup(this.expression, newChild);
243
+ this.expressionChange.emit(newGroup);
104
244
  };
105
245
  this.handleAddChildGroup = () => {
106
- // Add a nested group of the opposite type
107
- const oppositeOp = this.expression.op === Zt.AND ? Zt.OR : Zt.AND;
108
- const newChild = {
109
- op: oppositeOp,
110
- exp: [
111
- {
112
- key: '',
113
- op: Zt.EQUALS,
114
- exp: '',
115
- },
116
- ],
117
- };
118
- this.expressionChange.emit({
119
- op: this.expression.op,
120
- exp: [...this.expression.exp, newChild],
121
- });
246
+ const newChild = createNestedGroup(this.expression.op);
247
+ const newGroup = addExpressionToGroup(this.expression, newChild);
248
+ this.expressionChange.emit(newGroup);
122
249
  };
123
250
  this.handleExpressionChange = (updatedChildIndex) => (event) => {
124
251
  event.stopPropagation();
125
252
  const updatedExpression = event.detail;
126
- const expressions = [...this.expression.exp];
127
- if (updatedExpression === undefined) {
128
- // Deletion - remove the child and potentially unwrap
129
- expressions.splice(updatedChildIndex, 1);
130
- if (expressions.length === 0) {
131
- this.expressionChange.emit(undefined);
132
- return;
133
- }
134
- if (expressions.length === 1) {
135
- // Unwrap when only one child remains after deletion
136
- this.expressionChange.emit(expressions[0]);
137
- return;
138
- }
139
- }
140
- else {
141
- // Update - replace the child, don't unwrap
142
- expressions[updatedChildIndex] = updatedExpression;
143
- }
144
- this.expressionChange.emit({
145
- op: this.expression.op,
146
- exp: expressions,
147
- });
253
+ const result = updateChildExpression(this.expression, updatedChildIndex, updatedExpression);
254
+ this.expressionChange.emit(result.expression);
148
255
  };
149
256
  }
150
257
  render() {
151
258
  const subheading = this.getSubheading();
152
- return (h("div", { key: '0ed5a1403d9641926cd6d474910cedf9c7bba89e', class: "expression" }, subheading && (h("limel-header", { key: 'ea88a97df09f0fb5a21bf9afb4745256a611c7f8', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: 'cfbcdd539e84f79bf1d778e075cd3317d7409647' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ec443459245bf5852920bb4d3e341f2490a7b75b', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
259
+ return (h("div", { key: 'bf26300a939b4a2a1b401fa7a81593ec745a2a52', class: "expression" }, subheading && (h("limel-header", { key: 'f5152a2ca09811540b626965f52f5793e6c99728', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: 'c4cad750e47e0b6c94d6a76b2a4d8b72e36b3402' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ddd614f237a0c0314c2977b74a31b365f3251f9d', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
153
260
  }
154
261
  getSubheading() {
155
- if (this.expression.exp.length <= 1) {
156
- return '';
157
- }
158
- return this.expression.op === Zt.AND
159
- ? 'All of these conditions are true'
160
- : 'Any of these conditions are true';
262
+ return getFilterGroupSubheading(this.expression.op, this.expression.exp.length);
161
263
  }
162
264
  renderAddButton() {
163
265
  const label = this.getAddButtonLabel();
@@ -168,18 +270,10 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
168
270
  return (h("limel-button", { label: label, icon: "tree_structure", onClick: this.handleAddChildGroup }));
169
271
  }
170
272
  getAddButtonLabel() {
171
- const isAnd = this.expression.op === Zt.AND;
172
- if (this.expression.exp.length === 0) {
173
- return 'Add a condition';
174
- }
175
- return isAnd ? 'Add another condition' : 'Add alternative';
273
+ return getAddConditionButtonLabel(this.expression.op, this.expression.exp.length);
176
274
  }
177
275
  getAddGroupButtonLabel() {
178
- const isAnd = this.expression.op === Zt.AND;
179
- if (this.expression.exp.length === 0) {
180
- return 'Add a group';
181
- }
182
- return isAnd ? 'Add another group' : 'Add alternative group';
276
+ return getAddGroupButtonLabel(this.expression.op, this.expression.exp.length);
183
277
  }
184
278
  static get style() { return LimebbLimeQueryFilterGroupStyle0; }
185
279
  }, [1, "limebb-lime-query-filter-group", {