@limetech/lime-crm-building-blocks 1.125.0 → 1.126.0

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 (245) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  3. package/dist/cjs/limebb-alert-dialog.cjs.entry.js +1 -1
  4. package/dist/cjs/limebb-browser.cjs.entry.js +2 -2
  5. package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +4 -4
  6. package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
  7. package/dist/cjs/limebb-color-palette-picker.cjs.entry.js +1 -1
  8. package/dist/cjs/limebb-color-palette-swatches.cjs.entry.js +1 -1
  9. package/dist/cjs/limebb-component-config.cjs.entry.js +2 -14
  10. package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +3 -3
  11. package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
  12. package/dist/cjs/limebb-dashboard-widget.cjs.entry.js +1 -1
  13. package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
  14. package/dist/cjs/limebb-date-range.cjs.entry.js +1 -1
  15. package/dist/cjs/limebb-document-chips.cjs.entry.js +1 -1
  16. package/dist/cjs/limebb-document-item.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-document-picker.cjs.entry.js +1 -1
  18. package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
  19. package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
  20. package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
  21. package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
  22. package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
  23. package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
  24. package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
  25. package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
  26. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +1 -1
  27. package/dist/cjs/limebb-lime-query-filter-builder_3.cjs.entry.js +2 -2
  28. package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +1 -1
  29. package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +3 -3
  30. package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
  31. package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +1 -1
  32. package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +1 -1
  33. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  34. package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
  35. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  36. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +2 -2
  37. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  38. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  39. package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +59 -0
  40. package/dist/cjs/limebb-rule-editor.cjs.entry.js +646 -0
  41. package/dist/cjs/limebb-rule-gate.cjs.entry.js +5 -1
  42. package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
  43. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  44. package/dist/cjs/loader.cjs.js +1 -1
  45. package/dist/cjs/web-component-template-BWCutZB6.js +18 -0
  46. package/dist/collection/collection-manifest.json +2 -0
  47. package/dist/collection/components/alert-dialog/alert-dialog.js +1 -1
  48. package/dist/collection/components/browser/browser.js +2 -2
  49. package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.js +1 -1
  50. package/dist/collection/components/chat-list/chat-item/chat-item.js +2 -2
  51. package/dist/collection/components/chat-list/chat-list.js +1 -1
  52. package/dist/collection/components/chat-list/typing-indicator/typing-indicator.js +1 -1
  53. package/dist/collection/components/color-palette-picker/color-palette-picker.js +1 -1
  54. package/dist/collection/components/color-palette-picker/color-palette-swatches/color-palette-swatches.js +1 -1
  55. package/dist/collection/components/composer-toolbar/composer-toolbar.js +3 -3
  56. package/dist/collection/components/currency-picker/currency-picker.js +1 -1
  57. package/dist/collection/components/dashboard-widget/dashboard-widget.js +1 -1
  58. package/dist/collection/components/date-picker/date-picker.js +1 -1
  59. package/dist/collection/components/date-range/date-range.js +1 -1
  60. package/dist/collection/components/document-chips/document-chips.js +1 -1
  61. package/dist/collection/components/document-picker/document-item/document-item.js +2 -2
  62. package/dist/collection/components/document-picker/document-picker.js +1 -1
  63. package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
  64. package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
  65. package/dist/collection/components/feed/feed.js +1 -1
  66. package/dist/collection/components/icon-picker/icon-picker.js +1 -1
  67. package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
  68. package/dist/collection/components/info-tile/info-tile.js +1 -1
  69. package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
  70. package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
  71. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +1 -1
  72. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +2 -2
  73. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
  74. package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
  75. package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +1 -1
  76. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
  77. package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +1 -1
  78. package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
  79. package/dist/collection/components/lime-query-builder/response-format/response-format-item.js +1 -1
  80. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  81. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  82. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  83. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  84. package/dist/collection/components/rule-editor/chip-picker-view.js +141 -0
  85. package/dist/collection/components/rule-editor/group-node-view.js +79 -0
  86. package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.css +36 -0
  87. package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +301 -0
  88. package/dist/collection/components/rule-editor/rule-editor-views.js +43 -0
  89. package/dist/collection/components/rule-editor/rule-editor.css +96 -0
  90. package/dist/collection/components/rule-editor/rule-editor.js +457 -0
  91. package/dist/collection/components/rule-editor/rule-operations.js +132 -0
  92. package/dist/collection/components/rule-editor/view-helpers.js +70 -0
  93. package/dist/collection/components/rule-gate/rule-gate.js +9 -4
  94. package/dist/collection/components/summary-popover/summary-popover.js +2 -2
  95. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  96. package/dist/collection/components/text-editor/text-editor.js +1 -1
  97. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  98. package/dist/components/chat-icon-list.js +1 -1
  99. package/dist/components/chat-item.js +1 -1
  100. package/dist/components/currency-picker.js +1 -1
  101. package/dist/components/date-picker.js +1 -1
  102. package/dist/components/document-item.js +1 -1
  103. package/dist/components/feed-item-thumbnail-file-info.js +1 -1
  104. package/dist/components/feed-timeline-item.js +1 -1
  105. package/dist/components/kanban-group.js +1 -1
  106. package/dist/components/kanban-item.js +1 -1
  107. package/dist/components/lime-query-filter-comparison.js +1 -1
  108. package/dist/components/lime-query-filter-expression.js +1 -1
  109. package/dist/components/limebb-alert-dialog.js +1 -1
  110. package/dist/components/limebb-browser.js +1 -1
  111. package/dist/components/limebb-chat-list.js +1 -1
  112. package/dist/components/limebb-color-palette-picker.js +1 -1
  113. package/dist/components/limebb-color-palette-swatches.js +1 -1
  114. package/dist/components/limebb-component-config.js +1 -1
  115. package/dist/components/limebb-composer-toolbar.js +1 -1
  116. package/dist/components/limebb-dashboard-widget.js +1 -1
  117. package/dist/components/limebb-date-range.js +1 -1
  118. package/dist/components/limebb-document-chips.js +1 -1
  119. package/dist/components/limebb-document-picker.js +1 -1
  120. package/dist/components/limebb-feed.js +1 -1
  121. package/dist/components/limebb-icon-picker.js +1 -1
  122. package/dist/components/limebb-info-tile-format.js +1 -1
  123. package/dist/components/limebb-info-tile.js +1 -1
  124. package/dist/components/limebb-lime-query-builder.js +1 -1
  125. package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
  126. package/dist/components/limebb-locale-picker.js +1 -1
  127. package/dist/components/limebb-mention-group-counter.js +1 -1
  128. package/dist/components/limebb-rule-chip-popover.d.ts +11 -0
  129. package/dist/components/limebb-rule-chip-popover.js +1 -0
  130. package/dist/components/limebb-rule-editor.d.ts +11 -0
  131. package/dist/components/limebb-rule-editor.js +1 -0
  132. package/dist/components/limebb-rule-gate.js +1 -1
  133. package/dist/components/limebb-text-editor.js +1 -1
  134. package/dist/components/limebb-trend-indicator.js +1 -1
  135. package/dist/components/limetype-field.js +1 -1
  136. package/dist/components/live-docs-info.js +1 -1
  137. package/dist/components/notification-item.js +1 -1
  138. package/dist/components/order-by-editor.js +1 -1
  139. package/dist/components/order-by-item.js +1 -1
  140. package/dist/components/percentage-visualizer.js +1 -1
  141. package/dist/components/response-format-item.js +1 -1
  142. package/dist/components/rule-chip-popover.js +1 -0
  143. package/dist/components/summary-popover.js +1 -1
  144. package/dist/components/typing-indicator.js +1 -1
  145. package/dist/components/web-component-template.js +1 -0
  146. package/dist/esm/lime-crm-building-blocks.js +1 -1
  147. package/dist/esm/limebb-alert-dialog.entry.js +1 -1
  148. package/dist/esm/limebb-browser.entry.js +2 -2
  149. package/dist/esm/limebb-chat-icon-list_3.entry.js +4 -4
  150. package/dist/esm/limebb-chat-list.entry.js +1 -1
  151. package/dist/esm/limebb-color-palette-picker.entry.js +1 -1
  152. package/dist/esm/limebb-color-palette-swatches.entry.js +1 -1
  153. package/dist/esm/limebb-component-config.entry.js +2 -14
  154. package/dist/esm/limebb-composer-toolbar.entry.js +3 -3
  155. package/dist/esm/limebb-currency-picker.entry.js +1 -1
  156. package/dist/esm/limebb-dashboard-widget.entry.js +1 -1
  157. package/dist/esm/limebb-date-picker.entry.js +1 -1
  158. package/dist/esm/limebb-date-range.entry.js +1 -1
  159. package/dist/esm/limebb-document-chips.entry.js +1 -1
  160. package/dist/esm/limebb-document-item.entry.js +2 -2
  161. package/dist/esm/limebb-document-picker.entry.js +1 -1
  162. package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
  163. package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
  164. package/dist/esm/limebb-feed.entry.js +1 -1
  165. package/dist/esm/limebb-icon-picker.entry.js +1 -1
  166. package/dist/esm/limebb-info-tile-format.entry.js +1 -1
  167. package/dist/esm/limebb-info-tile.entry.js +1 -1
  168. package/dist/esm/limebb-kanban-group.entry.js +1 -1
  169. package/dist/esm/limebb-kanban-item.entry.js +1 -1
  170. package/dist/esm/limebb-lime-query-builder.entry.js +1 -1
  171. package/dist/esm/limebb-lime-query-filter-builder_3.entry.js +2 -2
  172. package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +1 -1
  173. package/dist/esm/limebb-lime-query-filter-group_3.entry.js +3 -3
  174. package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
  175. package/dist/esm/limebb-lime-query-response-format-builder.entry.js +1 -1
  176. package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +1 -1
  177. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  178. package/dist/esm/limebb-locale-picker.entry.js +1 -1
  179. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  180. package/dist/esm/limebb-navigation-button_2.entry.js +2 -2
  181. package/dist/esm/limebb-notification-item.entry.js +1 -1
  182. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  183. package/dist/esm/limebb-rule-chip-popover.entry.js +57 -0
  184. package/dist/esm/limebb-rule-editor.entry.js +644 -0
  185. package/dist/esm/limebb-rule-gate.entry.js +5 -1
  186. package/dist/esm/limebb-text-editor.entry.js +1 -1
  187. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  188. package/dist/esm/loader.js +1 -1
  189. package/dist/esm/web-component-template-6zRYia86.js +16 -0
  190. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  191. package/dist/lime-crm-building-blocks/{p-f3c412b3.entry.js → p-057e1638.entry.js} +1 -1
  192. package/dist/lime-crm-building-blocks/{p-b35ebf4d.entry.js → p-0c572fe9.entry.js} +1 -1
  193. package/dist/lime-crm-building-blocks/{p-8b11a02c.entry.js → p-11494f30.entry.js} +1 -1
  194. package/dist/lime-crm-building-blocks/{p-fc1aec12.entry.js → p-1747221f.entry.js} +1 -1
  195. package/dist/lime-crm-building-blocks/p-1831e571.entry.js +1 -0
  196. package/dist/lime-crm-building-blocks/{p-a4584260.entry.js → p-184ae23d.entry.js} +1 -1
  197. package/dist/lime-crm-building-blocks/{p-0be33708.entry.js → p-20206710.entry.js} +1 -1
  198. package/dist/lime-crm-building-blocks/{p-fa7597f7.entry.js → p-24fc049c.entry.js} +1 -1
  199. package/dist/lime-crm-building-blocks/{p-900b74c0.entry.js → p-277b6ad4.entry.js} +1 -1
  200. package/dist/lime-crm-building-blocks/{p-b74fe1ed.entry.js → p-2cb31064.entry.js} +1 -1
  201. package/dist/lime-crm-building-blocks/{p-c93314a6.entry.js → p-3313e357.entry.js} +1 -1
  202. package/dist/lime-crm-building-blocks/{p-593340d9.entry.js → p-3781a766.entry.js} +1 -1
  203. package/dist/lime-crm-building-blocks/{p-a3d4f2e1.entry.js → p-43a7facd.entry.js} +1 -1
  204. package/dist/lime-crm-building-blocks/{p-152b4f92.entry.js → p-6cceabf1.entry.js} +1 -1
  205. package/dist/lime-crm-building-blocks/{p-c5f0582c.entry.js → p-6d3a9ed3.entry.js} +1 -1
  206. package/dist/lime-crm-building-blocks/{p-b5d84fff.entry.js → p-71a6f624.entry.js} +1 -1
  207. package/dist/lime-crm-building-blocks/{p-4c255e2f.entry.js → p-731820f0.entry.js} +1 -1
  208. package/dist/lime-crm-building-blocks/p-74455a30.entry.js +1 -0
  209. package/dist/lime-crm-building-blocks/p-7922726c.entry.js +1 -0
  210. package/dist/lime-crm-building-blocks/{p-f3ba4ed1.entry.js → p-7a125570.entry.js} +1 -1
  211. package/dist/lime-crm-building-blocks/{p-5c420ada.entry.js → p-7d51a34c.entry.js} +1 -1
  212. package/dist/lime-crm-building-blocks/{p-f04ca19d.entry.js → p-7fee7ef3.entry.js} +1 -1
  213. package/dist/lime-crm-building-blocks/{p-a27e9bbb.entry.js → p-8084e825.entry.js} +1 -1
  214. package/dist/lime-crm-building-blocks/{p-6a27184b.entry.js → p-861ac606.entry.js} +1 -1
  215. package/dist/lime-crm-building-blocks/{p-b4ae3ed3.entry.js → p-8d3fa274.entry.js} +1 -1
  216. package/dist/lime-crm-building-blocks/{p-70957bab.entry.js → p-9f7992b0.entry.js} +1 -1
  217. package/dist/lime-crm-building-blocks/p-C_tMNOSt.js +1 -0
  218. package/dist/lime-crm-building-blocks/{p-6941de0b.entry.js → p-abcb1e49.entry.js} +1 -1
  219. package/dist/lime-crm-building-blocks/{p-9041e7aa.entry.js → p-b1a8d1a0.entry.js} +1 -1
  220. package/dist/lime-crm-building-blocks/p-b8d9ff68.entry.js +1 -0
  221. package/dist/lime-crm-building-blocks/{p-8f70f909.entry.js → p-bec4231f.entry.js} +1 -1
  222. package/dist/lime-crm-building-blocks/{p-8e6446b5.entry.js → p-c139ab98.entry.js} +1 -1
  223. package/dist/lime-crm-building-blocks/{p-e84ff80f.entry.js → p-c4f41ec4.entry.js} +1 -1
  224. package/dist/lime-crm-building-blocks/{p-24004bf3.entry.js → p-c609b5ec.entry.js} +1 -1
  225. package/dist/lime-crm-building-blocks/{p-ebd152ab.entry.js → p-c6a913af.entry.js} +1 -1
  226. package/dist/lime-crm-building-blocks/{p-c60673a4.entry.js → p-dd38e0ba.entry.js} +1 -1
  227. package/dist/lime-crm-building-blocks/{p-53b19393.entry.js → p-de6f4670.entry.js} +1 -1
  228. package/dist/lime-crm-building-blocks/{p-fc6d9cea.entry.js → p-e6ed33ff.entry.js} +1 -1
  229. package/dist/lime-crm-building-blocks/p-e717bdff.entry.js +1 -0
  230. package/dist/lime-crm-building-blocks/{p-da248a53.entry.js → p-ef62c7d8.entry.js} +1 -1
  231. package/dist/lime-crm-building-blocks/{p-23188fe0.entry.js → p-f0a567f3.entry.js} +1 -1
  232. package/dist/lime-crm-building-blocks/{p-befd1d3c.entry.js → p-fd6dcfe3.entry.js} +1 -1
  233. package/dist/types/components/rule-editor/chip-picker-view.d.ts +27 -0
  234. package/dist/types/components/rule-editor/group-node-view.d.ts +11 -0
  235. package/dist/types/components/rule-editor/rule-chip-popover/rule-chip-popover.d.ts +31 -0
  236. package/dist/types/components/rule-editor/rule-editor-views.d.ts +51 -0
  237. package/dist/types/components/rule-editor/rule-editor.d.ts +118 -0
  238. package/dist/types/components/rule-editor/rule-operations.d.ts +62 -0
  239. package/dist/types/components/rule-editor/view-helpers.d.ts +40 -0
  240. package/dist/types/components/rule-gate/rule-gate.d.ts +5 -2
  241. package/dist/types/components.d.ts +300 -6
  242. package/package.json +4 -4
  243. package/dist/lime-crm-building-blocks/p-4a93a4df.entry.js +0 -1
  244. package/dist/lime-crm-building-blocks/p-6318fd46.entry.js +0 -1
  245. package/dist/lime-crm-building-blocks/p-e3a3c291.entry.js +0 -1
@@ -0,0 +1,141 @@
1
+ import { h } from "@stencil/core";
2
+ import { pathsEqual } from "./rule-operations";
3
+ import { createSearcher, resolveItem, } from "./view-helpers";
4
+ const CHIP_TOKEN_PREFIX = '__chip__:';
5
+ function chipTokenFor(index) {
6
+ return `${CHIP_TOKEN_PREFIX}${index}`;
7
+ }
8
+ // The address of a chip inside a group is the group's path followed
9
+ // by a two-segment suffix `['rules', index]`. Build and parse via
10
+ // these helpers so both sides stay in sync.
11
+ const CHIP_PATH_SUFFIX_LENGTH = 2;
12
+ function buildChipPath(groupPath, index) {
13
+ return [...groupPath, 'rules', index];
14
+ }
15
+ function parentGroupPath(chipPath) {
16
+ return chipPath.slice(0, -CHIP_PATH_SUFFIX_LENGTH);
17
+ }
18
+ /**
19
+ * If `node` is a `ref` or a `not(ref)`, return the underlying ref
20
+ * together with its negation flag. Used to decide whether a child of a
21
+ * group renders as a chip (this returns non-null) or as a nested box
22
+ * (this returns null).
23
+ * @param node
24
+ */
25
+ export function extractRef(node) {
26
+ if (node.type === 'ref') {
27
+ return { ref: node, isNegated: false };
28
+ }
29
+ if (node.type === 'not' && node.rule.type === 'ref') {
30
+ return { ref: node.rule, isNegated: true };
31
+ }
32
+ return null;
33
+ }
34
+ export const GroupChipsView = ({ groupNode, groupPath, chipChildren, ctx }) => {
35
+ const chipsByToken = new Map();
36
+ const value = chipChildren.map((entry) => {
37
+ const token = chipTokenFor(entry.index);
38
+ chipsByToken.set(token, entry);
39
+ const base = resolveItem(ctx.primitiveOptions, entry.ref.id);
40
+ return Object.assign(Object.assign({}, base), { text: entry.isNegated ? `¬ ${base.text}` : base.text, value: token });
41
+ });
42
+ const searcher = createSearcher(ctx.primitiveOptions);
43
+ const openChip = findOpenChip(chipChildren, groupPath, ctx.openChipPath);
44
+ const delimiter = groupNode.type === 'all' ? '&' : '|';
45
+ return (h("limel-popover", { class: "rule-node__chips-popover", open: openChip !== null, openDirection: "bottom-start", onClose: ctx.onPopoverClose }, h("div", { slot: "trigger", class: "rule-node__chips" }, h("limel-picker", { multiple: true, label: ctx.translator.get('webclient.rule-editor.rules-label'), value: value, searcher: searcher, delimiter: delimiter, readonly: ctx.readonly, disabled: ctx.disabled, onChange: chipsChangeHandler(groupNode, groupPath, chipsByToken, ctx), onInteract: chipInteractHandler(groupPath, chipsByToken, ctx) })), h("div", null, renderChipPopoverContent(openChip, groupPath, ctx))));
46
+ };
47
+ function renderChipPopoverContent(openChip, groupPath, ctx) {
48
+ if (!openChip) {
49
+ return null;
50
+ }
51
+ const openChipPath = buildChipPath(groupPath, openChip.index);
52
+ return (h("limebb-rule-chip-popover", { platform: ctx.platform, context: ctx.context, refNode: openChip.ref, isNegated: openChip.isNegated, metadata: ctx.metadataById.get(openChip.ref.id), readonly: ctx.readonly, disabled: ctx.disabled, isMutable: ctx.isMutable, onNegate: chipNegateHandler(openChip, openChipPath, ctx), onUpdateArgs: chipArgsHandler(openChip, openChipPath, ctx), onDeleteChip: chipDeleteHandler(openChipPath, ctx) }));
53
+ }
54
+ const chipsChangeHandler = (groupNode, groupPath, chipsByToken, ctx) => (event) => {
55
+ event.stopPropagation();
56
+ const items = Array.isArray(event.detail) ? event.detail : [];
57
+ const openIndex = openChipIndexInGroup(groupPath, ctx.openChipPath);
58
+ if (openIndex !== null) {
59
+ const openToken = chipTokenFor(openIndex);
60
+ if (items.every((item) => item.value !== openToken)) {
61
+ ctx.onPopoverClose();
62
+ }
63
+ }
64
+ const newChipNodes = items.flatMap((item) => {
65
+ if (typeof item.value !== 'string') {
66
+ return [];
67
+ }
68
+ const existing = chipsByToken.get(item.value);
69
+ if (existing) {
70
+ return [
71
+ existing.isNegated
72
+ ? { type: 'not', rule: existing.ref }
73
+ : existing.ref,
74
+ ];
75
+ }
76
+ return [{ type: 'ref', id: item.value }];
77
+ });
78
+ const nestedGroupRules = groupNode.rules.filter((rule) => extractRef(rule) === null);
79
+ ctx.onReplaceNode(groupPath, Object.assign(Object.assign({}, groupNode), { rules: [...newChipNodes, ...nestedGroupRules] }));
80
+ };
81
+ const chipInteractHandler = (groupPath, chipsByToken, ctx) => (event) => {
82
+ event.stopPropagation();
83
+ const token = interactedToken(event.detail);
84
+ const chip = token ? chipsByToken.get(token) : undefined;
85
+ if (!chip) {
86
+ return;
87
+ }
88
+ ctx.onChipInteract([...groupPath, 'rules', chip.index]);
89
+ };
90
+ const chipNegateHandler = (openChip, openChipPath, ctx) => (event) => {
91
+ event.stopPropagation();
92
+ const next = event.detail
93
+ ? { type: 'not', rule: openChip.ref }
94
+ : openChip.ref;
95
+ ctx.onReplaceNode(openChipPath, next);
96
+ };
97
+ const chipArgsHandler = (openChip, openChipPath, ctx) => (event) => {
98
+ event.stopPropagation();
99
+ const argsPath = openChip.isNegated
100
+ ? [...openChipPath, 'rule']
101
+ : openChipPath;
102
+ ctx.onUpdateArgs(argsPath, event.detail);
103
+ };
104
+ const chipDeleteHandler = (openChipPath, ctx) => () => {
105
+ ctx.onDelete(openChipPath);
106
+ };
107
+ /**
108
+ * `limel-picker` declares its `interact` event as
109
+ * `EventEmitter<ListItem<PickerValue>>` but the runtime actually emits
110
+ * the chip's value (a string) — see picker.tsx's handleInteract. This
111
+ * unwraps either shape into the string token.
112
+ * @param detail
113
+ */
114
+ function interactedToken(detail) {
115
+ if (typeof detail === 'string') {
116
+ return detail;
117
+ }
118
+ if (detail && typeof detail === 'object' && 'value' in detail) {
119
+ const value = detail.value;
120
+ return typeof value === 'string' ? value : undefined;
121
+ }
122
+ return undefined;
123
+ }
124
+ function findOpenChip(chipChildren, groupPath, openChipPath) {
125
+ var _a;
126
+ const index = openChipIndexInGroup(groupPath, openChipPath);
127
+ if (index === null) {
128
+ return null;
129
+ }
130
+ return (_a = chipChildren.find((entry) => entry.index === index)) !== null && _a !== void 0 ? _a : null;
131
+ }
132
+ function openChipIndexInGroup(groupPath, openChipPath) {
133
+ if (!openChipPath || openChipPath.length < CHIP_PATH_SUFFIX_LENGTH) {
134
+ return null;
135
+ }
136
+ if (!pathsEqual(parentGroupPath(openChipPath), groupPath)) {
137
+ return null;
138
+ }
139
+ const lastKey = openChipPath.at(-1);
140
+ return typeof lastKey === 'number' ? lastKey : null;
141
+ }
@@ -0,0 +1,79 @@
1
+ import { h } from "@stencil/core";
2
+ import { appendChild, issuesAt, wrapNegated, } from "./rule-operations";
3
+ import { IssuesView, RuleNodeView, } from "./rule-editor-views";
4
+ import { nodeClasses } from "./view-helpers";
5
+ import { extractRef, GroupChipsView } from "./chip-picker-view";
6
+ export const GroupNodeView = ({ node, path, isNegated, ctx }) => {
7
+ const groupBasePath = isNegated ? [...path, 'rule'] : path;
8
+ const issuesHere = isNegated
9
+ ? [
10
+ ...issuesAt(ctx.issues, path),
11
+ ...issuesAt(ctx.issues, groupBasePath),
12
+ ]
13
+ : issuesAt(ctx.issues, path);
14
+ const chipChildren = [];
15
+ const nestedGroups = [];
16
+ for (const [index, child] of node.rules.entries()) {
17
+ const extracted = extractRef(child);
18
+ if (extracted) {
19
+ chipChildren.push(Object.assign(Object.assign({}, extracted), { index }));
20
+ }
21
+ else {
22
+ nestedGroups.push({ child, index });
23
+ }
24
+ }
25
+ const options = combinatorOptions(ctx);
26
+ const selectedCombinator = options.find((option) => option.value === node.type);
27
+ return (h("div", { class: nodeClasses(node.type, issuesHere), key: pathKey(path) }, h("div", { class: "rule-node__header" }, h("limel-select", { class: "rule-node__combinator-select", value: selectedCombinator, options: options, disabled: !ctx.isMutable, onChange: combinatorChangeHandler(node, path, isNegated, ctx) }), renderMutableGroupActions(node, path, isNegated, ctx)), h("div", { class: "rule-node__body" }, h(IssuesView, { issues: issuesHere }), h(GroupChipsView, { groupNode: node, groupPath: groupBasePath, chipChildren: chipChildren, ctx: ctx }), renderNestedGroups(nestedGroups, groupBasePath, ctx), renderAddGroupFooter(node, path, isNegated, ctx))));
28
+ };
29
+ function pathKey(path) {
30
+ return path.length === 0 ? 'root' : path.join('/');
31
+ }
32
+ function combinatorOptions(ctx) {
33
+ return [
34
+ {
35
+ value: 'all',
36
+ text: ctx.translator.get('webclient.rule-editor.combinator.all'),
37
+ },
38
+ {
39
+ value: 'any',
40
+ text: ctx.translator.get('webclient.rule-editor.combinator.any'),
41
+ },
42
+ ];
43
+ }
44
+ function renderMutableGroupActions(node, path, isNegated, ctx) {
45
+ if (!ctx.isMutable) {
46
+ return null;
47
+ }
48
+ return (h("div", { class: "rule-node__header-actions" }, h("limel-switch", { class: "rule-node__negate-switch", label: ctx.translator.get('webclient.rule-editor.negate'), value: isNegated, onChange: negateGroupHandler(node, path, ctx) }), h("limel-icon-button", { icon: "trash", label: ctx.translator.get('webclient.rule-editor.delete'), onClick: () => ctx.onDelete(path) })));
49
+ }
50
+ function renderNestedGroups(nestedGroups, groupBasePath, ctx) {
51
+ if (nestedGroups.length === 0) {
52
+ return null;
53
+ }
54
+ return (h("div", { class: "rule-node__children" }, nestedGroups.map((entry) => (h(RuleNodeView, { node: entry.child, path: [...groupBasePath, 'rules', entry.index], ctx: ctx })))));
55
+ }
56
+ function renderAddGroupFooter(node, path, isNegated, ctx) {
57
+ if (!ctx.isMutable) {
58
+ return null;
59
+ }
60
+ return (h("div", { class: "rule-node__footer" }, h("limel-button", { icon: "add", label: ctx.translator.get('webclient.rule-editor.add-nested-group'), onClick: addGroupHandler(node, path, isNegated, ctx) })));
61
+ }
62
+ function replaceGroup(nextGroup, path, isNegated, ctx) {
63
+ ctx.onReplaceNode(path, wrapNegated(nextGroup, isNegated));
64
+ }
65
+ const combinatorChangeHandler = (node, path, isNegated, ctx) => (event) => {
66
+ event.stopPropagation();
67
+ const newType = event.detail.value;
68
+ if (newType !== node.type) {
69
+ replaceGroup(Object.assign(Object.assign({}, node), { type: newType }), path, isNegated, ctx);
70
+ }
71
+ };
72
+ const addGroupHandler = (node, path, isNegated, ctx) => () => {
73
+ const expanded = appendChild(node, { type: 'all', rules: [] });
74
+ replaceGroup(expanded, path, isNegated, ctx);
75
+ };
76
+ const negateGroupHandler = (node, path, ctx) => (event) => {
77
+ event.stopPropagation();
78
+ ctx.onReplaceNode(path, wrapNegated(node, event.detail));
79
+ };
@@ -0,0 +1,36 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ .popover {
6
+ display: flex;
7
+ flex-direction: column;
8
+ min-width: 24rem;
9
+ background-color: rgb(var(--contrast-100));
10
+ border: 1px solid rgb(var(--contrast-700));
11
+ border-radius: 0.5rem;
12
+ box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
13
+ overflow: hidden;
14
+ }
15
+
16
+ .popover__header {
17
+ --header-background-color: rgba(var(--contrast-300));
18
+ padding-right: 0.5rem;
19
+ gap: 1rem;
20
+ }
21
+
22
+ .popover__header-actions {
23
+ display: grid;
24
+ grid-auto-flow: column;
25
+ grid-gap: 0.75rem;
26
+ padding: 0.25rem;
27
+ align-items: center;
28
+ }
29
+
30
+ .popover__delete-button {
31
+ color: rgb(var(--contrast-1100));
32
+ }
33
+
34
+ .popover__body {
35
+ padding: 1rem;
36
+ }
@@ -0,0 +1,301 @@
1
+ import { PlatformServiceName, } from "@limetech/lime-web-components";
2
+ import { h } from "@stencil/core";
3
+ import { LimeWebComponentTemplate } from "../../../util/web-component-template";
4
+ /**
5
+ * Popover content for a rule-editor chip. Carries its own styles so
6
+ * they travel with the element when `limel-popover` portals it out of
7
+ * the rule-editor's shadow DOM.
8
+ *
9
+ * @private
10
+ */
11
+ export class RuleChipPopover {
12
+ constructor() {
13
+ this.isNegated = false;
14
+ this.readonly = false;
15
+ this.disabled = false;
16
+ this.isMutable = true;
17
+ this.handleNegateChange = (event) => {
18
+ event.stopPropagation();
19
+ this.negate.emit(event.detail);
20
+ };
21
+ this.handleArgsChange = (event) => {
22
+ event.stopPropagation();
23
+ this.updateArgs.emit(event.detail);
24
+ };
25
+ this.handleDelete = () => {
26
+ this.deleteChip.emit();
27
+ };
28
+ }
29
+ render() {
30
+ return (h("div", { key: '6aae573b524737ee3d2a4b2d3df68ec9bf1f1a0f', class: "popover" }, this.renderHeader(), this.renderBody()));
31
+ }
32
+ renderHeader() {
33
+ var _a, _b, _c, _d, _e;
34
+ const title = (_d = (_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : (_c = this.refNode) === null || _c === void 0 ? void 0 : _c.id) !== null && _d !== void 0 ? _d : '';
35
+ return (h("limel-header", { class: "popover__header is-narrow", heading: title, icon: (_e = this.metadata) === null || _e === void 0 ? void 0 : _e.icon }, this.renderHeaderActions()));
36
+ }
37
+ renderHeaderActions() {
38
+ if (!this.isMutable) {
39
+ return null;
40
+ }
41
+ return (h("div", { slot: "actions", class: "popover__header-actions" }, h("limel-switch", { class: "popover__negate-switch", label: this.translator.get('webclient.rule-editor.negate'), value: this.isNegated, onChange: this.handleNegateChange }), h("limel-icon-button", { class: "popover__delete-button", icon: "trash", label: this.translator.get('webclient.rule-editor.delete'), onClick: this.handleDelete })));
42
+ }
43
+ get translator() {
44
+ return this.platform.get(PlatformServiceName.Translate);
45
+ }
46
+ renderBody() {
47
+ var _a, _b;
48
+ const configComponent = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.configComponent;
49
+ if (!configComponent) {
50
+ return null;
51
+ }
52
+ return (h("div", { class: "popover__body" }, h(LimeWebComponentTemplate, { platform: this.platform, context: this.context, name: configComponent.name, props: Object.assign(Object.assign({}, configComponent.props), { value: (_b = this.refNode) === null || _b === void 0 ? void 0 : _b.args, readonly: this.readonly, disabled: this.disabled, onChange: this.handleArgsChange }) })));
53
+ }
54
+ static get is() { return "limebb-rule-chip-popover"; }
55
+ static get encapsulation() { return "shadow"; }
56
+ static get originalStyleUrls() {
57
+ return {
58
+ "$": ["rule-chip-popover.scss"]
59
+ };
60
+ }
61
+ static get styleUrls() {
62
+ return {
63
+ "$": ["rule-chip-popover.css"]
64
+ };
65
+ }
66
+ static get properties() {
67
+ return {
68
+ "platform": {
69
+ "type": "unknown",
70
+ "mutable": false,
71
+ "complexType": {
72
+ "original": "LimeWebComponentPlatform",
73
+ "resolved": "LimeWebComponentPlatform",
74
+ "references": {
75
+ "LimeWebComponentPlatform": {
76
+ "location": "import",
77
+ "path": "@limetech/lime-web-components",
78
+ "id": "node_modules::LimeWebComponentPlatform",
79
+ "referenceLocation": "LimeWebComponentPlatform"
80
+ }
81
+ }
82
+ },
83
+ "required": false,
84
+ "optional": false,
85
+ "docs": {
86
+ "tags": [],
87
+ "text": ""
88
+ },
89
+ "getter": false,
90
+ "setter": false
91
+ },
92
+ "context": {
93
+ "type": "unknown",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "LimeWebComponentContext",
97
+ "resolved": "LimeWebComponentContext",
98
+ "references": {
99
+ "LimeWebComponentContext": {
100
+ "location": "import",
101
+ "path": "@limetech/lime-web-components",
102
+ "id": "node_modules::LimeWebComponentContext",
103
+ "referenceLocation": "LimeWebComponentContext"
104
+ }
105
+ }
106
+ },
107
+ "required": false,
108
+ "optional": false,
109
+ "docs": {
110
+ "tags": [],
111
+ "text": ""
112
+ },
113
+ "getter": false,
114
+ "setter": false
115
+ },
116
+ "refNode": {
117
+ "type": "unknown",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "RuleRef",
121
+ "resolved": "RuleRef",
122
+ "references": {
123
+ "RuleRef": {
124
+ "location": "import",
125
+ "path": "@limetech/lime-web-components",
126
+ "id": "node_modules::RuleRef",
127
+ "referenceLocation": "RuleRef"
128
+ }
129
+ }
130
+ },
131
+ "required": false,
132
+ "optional": false,
133
+ "docs": {
134
+ "tags": [],
135
+ "text": ""
136
+ },
137
+ "getter": false,
138
+ "setter": false
139
+ },
140
+ "isNegated": {
141
+ "type": "boolean",
142
+ "mutable": false,
143
+ "complexType": {
144
+ "original": "boolean",
145
+ "resolved": "boolean",
146
+ "references": {}
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [],
152
+ "text": ""
153
+ },
154
+ "getter": false,
155
+ "setter": false,
156
+ "reflect": false,
157
+ "attribute": "is-negated",
158
+ "defaultValue": "false"
159
+ },
160
+ "metadata": {
161
+ "type": "unknown",
162
+ "mutable": false,
163
+ "complexType": {
164
+ "original": "PrimitiveMetadata",
165
+ "resolved": "ConfigMetadata & { id: string; reads: (keyof SubjectRegistry)[]; } | undefined",
166
+ "references": {
167
+ "PrimitiveMetadata": {
168
+ "location": "import",
169
+ "path": "@limetech/lime-web-components",
170
+ "id": "node_modules::PrimitiveMetadata",
171
+ "referenceLocation": "PrimitiveMetadata"
172
+ }
173
+ }
174
+ },
175
+ "required": false,
176
+ "optional": true,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": ""
180
+ },
181
+ "getter": false,
182
+ "setter": false
183
+ },
184
+ "readonly": {
185
+ "type": "boolean",
186
+ "mutable": false,
187
+ "complexType": {
188
+ "original": "boolean",
189
+ "resolved": "boolean",
190
+ "references": {}
191
+ },
192
+ "required": false,
193
+ "optional": false,
194
+ "docs": {
195
+ "tags": [],
196
+ "text": ""
197
+ },
198
+ "getter": false,
199
+ "setter": false,
200
+ "reflect": false,
201
+ "attribute": "readonly",
202
+ "defaultValue": "false"
203
+ },
204
+ "disabled": {
205
+ "type": "boolean",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "boolean",
209
+ "resolved": "boolean",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": ""
217
+ },
218
+ "getter": false,
219
+ "setter": false,
220
+ "reflect": false,
221
+ "attribute": "disabled",
222
+ "defaultValue": "false"
223
+ },
224
+ "isMutable": {
225
+ "type": "boolean",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "boolean",
229
+ "resolved": "boolean",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": ""
237
+ },
238
+ "getter": false,
239
+ "setter": false,
240
+ "reflect": false,
241
+ "attribute": "is-mutable",
242
+ "defaultValue": "true"
243
+ }
244
+ };
245
+ }
246
+ static get events() {
247
+ return [{
248
+ "method": "negate",
249
+ "name": "negate",
250
+ "bubbles": true,
251
+ "cancelable": true,
252
+ "composed": true,
253
+ "docs": {
254
+ "tags": [],
255
+ "text": ""
256
+ },
257
+ "complexType": {
258
+ "original": "boolean",
259
+ "resolved": "boolean",
260
+ "references": {}
261
+ }
262
+ }, {
263
+ "method": "updateArgs",
264
+ "name": "updateArgs",
265
+ "bubbles": true,
266
+ "cancelable": true,
267
+ "composed": true,
268
+ "docs": {
269
+ "tags": [],
270
+ "text": ""
271
+ },
272
+ "complexType": {
273
+ "original": "JsonValue",
274
+ "resolved": "JsonValue[] | boolean | null | number | string | { [key: string]: JsonValue; }",
275
+ "references": {
276
+ "JsonValue": {
277
+ "location": "import",
278
+ "path": "@limetech/lime-web-components",
279
+ "id": "node_modules::JsonValue",
280
+ "referenceLocation": "JsonValue"
281
+ }
282
+ }
283
+ }
284
+ }, {
285
+ "method": "deleteChip",
286
+ "name": "deleteChip",
287
+ "bubbles": true,
288
+ "cancelable": true,
289
+ "composed": true,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": ""
293
+ },
294
+ "complexType": {
295
+ "original": "void",
296
+ "resolved": "void",
297
+ "references": {}
298
+ }
299
+ }];
300
+ }
301
+ }
@@ -0,0 +1,43 @@
1
+ import { h } from "@stencil/core";
2
+ import { GroupNodeView } from "./group-node-view";
3
+ /**
4
+ * Render a `Rule` node and recurse into its children.
5
+ * @param props
6
+ */
7
+ export const RuleNodeView = (props) => {
8
+ const { node, path, ctx } = props;
9
+ const group = extractGroup(node);
10
+ if (!group) {
11
+ return null;
12
+ }
13
+ return (h(GroupNodeView, { node: group.node, path: path, isNegated: group.isNegated, ctx: ctx }));
14
+ };
15
+ const isNegatedGroup = (node) => node.type === 'not' &&
16
+ (node.rule.type === 'all' || node.rule.type === 'any');
17
+ /**
18
+ * If `node` is a group (`all`/`any`) or a negated group, return the
19
+ * inner group together with its negation flag. Otherwise `null`.
20
+ * Used by the dispatcher and by the editor's input normalization.
21
+ * @param node
22
+ */
23
+ export function extractGroup(node) {
24
+ if (node.type === 'all' || node.type === 'any') {
25
+ return { node, isNegated: false };
26
+ }
27
+ if (isNegatedGroup(node)) {
28
+ return { node: node.rule, isNegated: true };
29
+ }
30
+ if (node.type === 'not') {
31
+ const inner = extractGroup(node.rule);
32
+ if (inner) {
33
+ return { node: inner.node, isNegated: !inner.isNegated };
34
+ }
35
+ }
36
+ return null;
37
+ }
38
+ export const IssuesView = ({ issues }) => {
39
+ if (issues.length === 0) {
40
+ return null;
41
+ }
42
+ return issues.map((issue) => (h("div", { class: "rule-node__issue" }, issue.message)));
43
+ };