@limetech/lime-crm-building-blocks 2.0.4 → 2.2.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.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/condition-tree-translate-B_qIQz9s.js +27 -0
- package/dist/cjs/index.cjs.js +6 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-alert-dialog.cjs.entry.js +1 -1
- package/dist/cjs/limebb-browser.cjs.entry.js +2 -2
- package/dist/cjs/limebb-chat-icon-list_3.cjs.entry.js +4 -4
- package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-color-palette-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-color-palette-swatches.cjs.entry.js +1 -1
- package/dist/cjs/limebb-composer-toolbar.cjs.entry.js +2 -2
- package/dist/cjs/limebb-condition-tree-editor.cjs.entry.js +90 -0
- package/dist/cjs/limebb-condition-tree.cjs.entry.js +882 -0
- package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-dashboard-widget.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-range.cjs.entry.js +1 -1
- package/dist/cjs/limebb-document-chips.cjs.entry.js +1 -1
- package/dist/cjs/limebb-document-item.cjs.entry.js +2 -2
- package/dist/cjs/limebb-document-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-item-thumbnail-file-info.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed-timeline-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-feed.cjs.entry.js +1 -1
- package/dist/cjs/limebb-filter-chip_6.cjs.entry.js +7 -7
- package/dist/cjs/limebb-icon-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile-format.cjs.entry.js +1 -1
- package/dist/cjs/limebb-info-tile.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-group.cjs.entry.js +1 -1
- package/dist/cjs/limebb-kanban-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-filter-comparison_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-order-by-editor_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-order-by-item.cjs.entry.js +2 -2
- package/dist/cjs/limebb-lime-query-response-format-builder.cjs.entry.js +1 -1
- package/dist/cjs/limebb-lime-query-response-format-editor_2.cjs.entry.js +1 -1
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +2 -2
- package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-rule-chip-popover.cjs.entry.js +2 -2
- package/dist/cjs/limebb-rule-editor.cjs.entry.js +162 -22
- package/dist/cjs/limebb-rule-gate.cjs.entry.js +1 -1
- package/dist/cjs/limebb-text-editor.cjs.entry.js +1 -1
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/limebb-value-comparison-editor.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/rule-editor-modes-Dc6rnwD2.js +76 -0
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/alert-dialog/alert-dialog.js +1 -1
- package/dist/collection/components/browser/browser.js +2 -2
- package/dist/collection/components/chat-list/chat-icon-list/chat-icon-list.js +1 -1
- package/dist/collection/components/chat-list/chat-item/chat-item.js +2 -2
- package/dist/collection/components/chat-list/chat-list.js +1 -1
- package/dist/collection/components/chat-list/typing-indicator/typing-indicator.js +1 -1
- package/dist/collection/components/color-palette-picker/color-palette-picker.js +1 -1
- package/dist/collection/components/color-palette-picker/color-palette-swatches/color-palette-swatches.js +1 -1
- package/dist/collection/components/composer-toolbar/composer-toolbar.js +2 -2
- package/dist/collection/components/condition-tree/condition-tree-combinators.js +78 -0
- package/dist/collection/components/condition-tree/condition-tree-editor/condition-tree-editor.css +17 -0
- package/dist/collection/components/condition-tree/condition-tree-editor/condition-tree-editor.js +333 -0
- package/dist/collection/components/condition-tree/condition-tree-nodes.js +218 -0
- package/dist/collection/components/condition-tree/condition-tree-open-state.js +127 -0
- package/dist/collection/components/condition-tree/condition-tree-translate.js +22 -0
- package/dist/collection/components/condition-tree/condition-tree-view-context.js +22 -0
- package/dist/collection/components/condition-tree/condition-tree.css +132 -0
- package/dist/collection/components/condition-tree/condition-tree.js +461 -0
- package/dist/collection/components/condition-tree/condition-tree.types.js +1 -0
- package/dist/collection/components/condition-tree/group-node-view.js +153 -0
- package/dist/collection/components/condition-tree/leaf-node-view.js +74 -0
- package/dist/collection/components/currency-picker/currency-picker.js +1 -1
- package/dist/collection/components/dashboard-widget/dashboard-widget.js +1 -1
- package/dist/collection/components/date-picker/date-picker.js +1 -1
- package/dist/collection/components/date-range/date-range.js +1 -1
- package/dist/collection/components/document-chips/document-chips.js +1 -1
- package/dist/collection/components/document-picker/document-item/document-item.js +2 -2
- package/dist/collection/components/document-picker/document-picker.js +1 -1
- package/dist/collection/components/feed/feed-item/feed-timeline-item.js +1 -1
- package/dist/collection/components/feed/feed-item-thumbnail-file-info/feed-item-thumbnail-file-info.js +1 -1
- package/dist/collection/components/feed/feed.js +1 -1
- package/dist/collection/components/filter-chip/filter-chip.js +2 -2
- package/dist/collection/components/filter-condition-picker/filter-condition-picker.js +1 -1
- package/dist/collection/components/icon-picker/icon-picker.js +1 -1
- package/dist/collection/components/info-tile/format/config/info-tile-format.js +1 -1
- package/dist/collection/components/info-tile/info-tile.js +1 -1
- package/dist/collection/components/kanban/kanban-group/kanban-group.js +1 -1
- package/dist/collection/components/kanban/kanban-item/kanban-item.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison-editor.js +1 -1
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +2 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +2 -2
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +1 -1
- package/dist/collection/components/lime-query-builder/lime-query-response-format-builder.js +1 -1
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +1 -1
- package/dist/collection/components/lime-query-builder/order-by/order-by-editor.js +1 -1
- package/dist/collection/components/lime-query-builder/order-by/order-by-item.js +2 -2
- package/dist/collection/components/lime-query-builder/response-format/response-format-item.js +1 -1
- package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
- package/dist/collection/components/locale-picker/locale-picker.js +1 -1
- package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
- package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
- package/dist/collection/components/rule-editor/group-node-view.js +3 -3
- package/dist/collection/components/rule-editor/rule-chip-popover/rule-chip-popover.js +2 -2
- package/dist/collection/components/rule-editor/rule-editor-mode-view.js +32 -0
- package/dist/collection/components/rule-editor/rule-editor-modes.js +68 -0
- package/dist/collection/components/rule-editor/rule-editor.css +153 -12
- package/dist/collection/components/rule-editor/rule-editor.js +201 -19
- package/dist/collection/components/rule-editor/rule-editor.types.js +1 -0
- package/dist/collection/components/rule-editor/value-comparison-editor/value-comparison-editor.js +1 -1
- package/dist/collection/components/rule-gate/rule-gate.js +1 -1
- package/dist/collection/components/summary-popover/summary-popover.js +2 -2
- package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
- package/dist/collection/components/text-editor/text-editor.js +1 -1
- package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
- package/dist/collection/index.js +2 -0
- package/dist/components/chat-icon-list.js +1 -1
- package/dist/components/chat-item.js +1 -1
- package/dist/components/condition-tree-editor.js +1 -0
- package/dist/components/currency-picker.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/document-item.js +1 -1
- package/dist/components/feed-item-thumbnail-file-info.js +1 -1
- package/dist/components/feed-timeline-item.js +1 -1
- package/dist/components/filter-chip.js +1 -1
- package/dist/components/filter-condition-picker.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/kanban-group.js +1 -1
- package/dist/components/kanban-item.js +1 -1
- package/dist/components/lime-query-filter-comparison-editor.js +1 -1
- package/dist/components/lime-query-filter-comparison.js +1 -1
- package/dist/components/lime-query-filter-expression.js +1 -1
- package/dist/components/limebb-alert-dialog.js +1 -1
- package/dist/components/limebb-browser.js +1 -1
- package/dist/components/limebb-chat-list.js +1 -1
- package/dist/components/limebb-color-palette-picker.js +1 -1
- package/dist/components/limebb-color-palette-swatches.js +1 -1
- package/dist/components/limebb-composer-toolbar.js +1 -1
- package/dist/components/limebb-condition-tree-editor.d.ts +11 -0
- package/dist/components/limebb-condition-tree-editor.js +1 -0
- package/dist/components/limebb-condition-tree.d.ts +11 -0
- package/dist/components/limebb-condition-tree.js +1 -0
- package/dist/components/limebb-dashboard-widget.js +1 -1
- package/dist/components/limebb-date-range.js +1 -1
- package/dist/components/limebb-document-chips.js +1 -1
- package/dist/components/limebb-document-picker.js +1 -1
- package/dist/components/limebb-feed.js +1 -1
- package/dist/components/limebb-icon-picker.js +1 -1
- package/dist/components/limebb-info-tile-format.js +1 -1
- package/dist/components/limebb-info-tile.js +1 -1
- package/dist/components/limebb-lime-query-builder.js +1 -1
- package/dist/components/limebb-lime-query-response-format-builder.js +1 -1
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +1 -1
- package/dist/components/limebb-rule-editor.js +1 -1
- package/dist/components/limebb-rule-gate.js +1 -1
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limebb-value-comparison-editor.js +1 -1
- package/dist/components/limetype-field.js +1 -1
- package/dist/components/live-docs-info.js +1 -1
- package/dist/components/notification-item.js +1 -1
- package/dist/components/order-by-editor.js +1 -1
- package/dist/components/order-by-item.js +1 -1
- package/dist/components/percentage-visualizer.js +1 -1
- package/dist/components/response-format-item.js +1 -1
- package/dist/components/rule-chip-popover.js +1 -1
- package/dist/components/rule-editor-modes.js +1 -0
- package/dist/components/summary-popover.js +1 -1
- package/dist/components/typing-indicator.js +1 -1
- package/dist/esm/condition-tree-translate-CBeXbZ_z.js +25 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-alert-dialog.entry.js +1 -1
- package/dist/esm/limebb-browser.entry.js +2 -2
- package/dist/esm/limebb-chat-icon-list_3.entry.js +4 -4
- package/dist/esm/limebb-chat-list.entry.js +1 -1
- package/dist/esm/limebb-color-palette-picker.entry.js +1 -1
- package/dist/esm/limebb-color-palette-swatches.entry.js +1 -1
- package/dist/esm/limebb-composer-toolbar.entry.js +2 -2
- package/dist/esm/limebb-condition-tree-editor.entry.js +88 -0
- package/dist/esm/limebb-condition-tree.entry.js +880 -0
- package/dist/esm/limebb-currency-picker.entry.js +1 -1
- package/dist/esm/limebb-dashboard-widget.entry.js +1 -1
- package/dist/esm/limebb-date-picker.entry.js +1 -1
- package/dist/esm/limebb-date-range.entry.js +1 -1
- package/dist/esm/limebb-document-chips.entry.js +1 -1
- package/dist/esm/limebb-document-item.entry.js +2 -2
- package/dist/esm/limebb-document-picker.entry.js +1 -1
- package/dist/esm/limebb-feed-item-thumbnail-file-info.entry.js +1 -1
- package/dist/esm/limebb-feed-timeline-item.entry.js +1 -1
- package/dist/esm/limebb-feed.entry.js +1 -1
- package/dist/esm/limebb-filter-chip_6.entry.js +7 -7
- package/dist/esm/limebb-icon-picker.entry.js +1 -1
- package/dist/esm/limebb-info-tile-format.entry.js +1 -1
- package/dist/esm/limebb-info-tile.entry.js +1 -1
- package/dist/esm/limebb-kanban-group.entry.js +1 -1
- package/dist/esm/limebb-kanban-item.entry.js +1 -1
- package/dist/esm/limebb-lime-query-builder.entry.js +1 -1
- package/dist/esm/limebb-lime-query-filter-comparison_2.entry.js +2 -2
- package/dist/esm/limebb-lime-query-order-by-editor_2.entry.js +2 -2
- package/dist/esm/limebb-lime-query-order-by-item.entry.js +2 -2
- package/dist/esm/limebb-lime-query-response-format-builder.entry.js +1 -1
- package/dist/esm/limebb-lime-query-response-format-editor_2.entry.js +1 -1
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-locale-picker.entry.js +1 -1
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-navigation-button_2.entry.js +2 -2
- package/dist/esm/limebb-notification-item.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-rule-chip-popover.entry.js +2 -2
- package/dist/esm/limebb-rule-editor.entry.js +163 -23
- package/dist/esm/limebb-rule-gate.entry.js +1 -1
- package/dist/esm/limebb-text-editor.entry.js +1 -1
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/limebb-value-comparison-editor.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/rule-editor-modes-BCglve2Z.js +70 -0
- package/dist/lime-crm-building-blocks/index.esm.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-2f8540ab.entry.js → p-02fba38e.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-76151fce.entry.js → p-0445035f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4f0a4893.entry.js → p-0a05b3e9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-0dd64440.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-1578c8f0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-76064593.entry.js → p-170ab4be.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-542047c4.entry.js → p-27b9c824.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2628fe8e.entry.js → p-2d1c7b6f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c2c181f1.entry.js → p-3fd84800.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c7daffb6.entry.js → p-45dd8663.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-cede8095.entry.js → p-4e4d096c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-51eb53ee.entry.js → p-54735042.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c2899d68.entry.js → p-568c4e76.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9907deb1.entry.js → p-584a48e4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-ac4bddfc.entry.js → p-5b97d4f4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-615770be.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-edfaf566.entry.js → p-6d8efe87.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-705c53c0.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-031b1648.entry.js → p-73f23d08.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2baab674.entry.js → p-7c5ecffe.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1fac8130.entry.js → p-7cd8dffd.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-93af3e81.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-247fcace.entry.js → p-97e2e5c9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-BCglve2Z.js +1 -0
- package/dist/lime-crm-building-blocks/p-BxCq236x.js +1 -0
- package/dist/lime-crm-building-blocks/p-a2b9c410.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-f9f7020f.entry.js → p-a716b3a8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-b3529254.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-2bfd351d.entry.js → p-b48d7d23.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-b373c60f.entry.js → p-b6807166.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-318369ae.entry.js → p-b6c2d93b.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-d82a2424.entry.js → p-c46802cd.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9099b440.entry.js → p-c635f826.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-fec173db.entry.js → p-d816fcc8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4594c2b1.entry.js → p-d8ce3497.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-0f74d662.entry.js → p-d8d32cb1.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-99556fc0.entry.js → p-de7724f0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-92403251.entry.js → p-e910963c.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-4274cbe3.entry.js → p-ea6ab8b0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-eedbf69a.entry.js → p-ee7bd504.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e1f35866.entry.js → p-f024c185.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-7bb2788b.entry.js → p-f102f169.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2984005d.entry.js → p-f1060c88.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-17588c29.entry.js → p-f3905fa2.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-ac97c7cc.entry.js → p-fc372344.entry.js} +1 -1
- package/dist/types/components/condition-tree/condition-tree-combinators.d.ts +47 -0
- package/dist/types/components/condition-tree/condition-tree-editor/condition-tree-editor.d.ts +84 -0
- package/dist/types/components/condition-tree/condition-tree-nodes.d.ts +130 -0
- package/dist/types/components/condition-tree/condition-tree-open-state.d.ts +76 -0
- package/dist/types/components/condition-tree/condition-tree-translate.d.ts +11 -0
- package/dist/types/components/condition-tree/condition-tree-view-context.d.ts +48 -0
- package/dist/types/components/condition-tree/condition-tree.d.ts +177 -0
- package/dist/types/components/condition-tree/condition-tree.types.d.ts +323 -0
- package/dist/types/components/condition-tree/group-node-view.d.ts +30 -0
- package/dist/types/components/condition-tree/leaf-node-view.d.ts +21 -0
- package/dist/types/components/rule-editor/rule-editor-mode-view.d.ts +22 -0
- package/dist/types/components/rule-editor/rule-editor-modes.d.ts +43 -0
- package/dist/types/components/rule-editor/rule-editor.d.ts +129 -5
- package/dist/types/components/rule-editor/rule-editor.types.d.ts +16 -0
- package/dist/types/components.d.ts +412 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interface.d.ts +2 -0
- package/package.json +3 -3
- package/dist/lime-crm-building-blocks/p-1e83a491.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-73f79d42.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-761deada.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-b8d74591.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-e8a7a94c.entry.js +0 -1
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { IconName, MenuItem } from '@limetech/lime-elements';
|
|
3
|
+
import { ComponentDescriptor, LimeWebComponentContext, LimeWebComponentPlatform } from '@limetech/lime-web-components';
|
|
4
|
+
/**
|
|
5
|
+
* How a group joins the conditions inside it.
|
|
6
|
+
*
|
|
7
|
+
* - `all` — every condition must hold (`AND`)
|
|
8
|
+
* - `any` — at least one condition must hold (`OR`)
|
|
9
|
+
* - `not-all` — at least one condition must fail (`NOT AND`)
|
|
10
|
+
* - `none` — every condition must fail (`NOT OR`)
|
|
11
|
+
*
|
|
12
|
+
* The last two are the negations of the first two. Consumers whose data model
|
|
13
|
+
* expresses negation as a wrapper (`NOT[AND[…]]`, `not(all(…))`) fold that
|
|
14
|
+
* wrapper into the combinator in `describe`, and unfold it again in `group`. A
|
|
15
|
+
* consumer that would rather not expose the negated forms to its users lists
|
|
16
|
+
* only the ones it wants via `combinators`.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export type ConditionTreeCombinator = 'all' | 'any' | 'not-all' | 'none';
|
|
21
|
+
/**
|
|
22
|
+
* How one condition reads when it is collapsed.
|
|
23
|
+
*
|
|
24
|
+
* This is the whole vocabulary the tree itself has for a condition: a name, a
|
|
25
|
+
* value, an icon, and whether something is wrong with it. It says nothing
|
|
26
|
+
* about what the condition *means* — that is the consumer's business, and a
|
|
27
|
+
* consumer whose chips need to say more replaces the chip through
|
|
28
|
+
* `component`.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export interface ConditionTreeChip {
|
|
33
|
+
/**
|
|
34
|
+
* The name of what is being tested — typically a property name, but for an
|
|
35
|
+
* opaque condition simply its title (e.g. "User is an administrator").
|
|
36
|
+
*
|
|
37
|
+
* It also becomes the heading of the editor when the condition is opened.
|
|
38
|
+
*/
|
|
39
|
+
label?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The value(s) tested against.
|
|
42
|
+
*/
|
|
43
|
+
value?: string | string[];
|
|
44
|
+
/**
|
|
45
|
+
* The glyph shown between the label and the value.
|
|
46
|
+
*/
|
|
47
|
+
icon?: IconName;
|
|
48
|
+
/**
|
|
49
|
+
* Set to `true` to mark the condition as unresolvable or malformed.
|
|
50
|
+
*/
|
|
51
|
+
invalid?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* A component to draw in place of the built-in chip, for a condition whose
|
|
54
|
+
* summary needs more than the four fields above can say.
|
|
55
|
+
*
|
|
56
|
+
* The tree knows nothing about filters, operators or data types, so a
|
|
57
|
+
* consumer that wants the full `limebb-filter-chip` summary — the glyph
|
|
58
|
+
* and wording derived from a condition and a property type — names that
|
|
59
|
+
* component here and passes the rest through `props`:
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* component: {
|
|
63
|
+
* name: 'limebb-filter-chip',
|
|
64
|
+
* props: { condition: 'greater-than', propertyType: 'date' },
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* The four fields above are still forwarded, and the tree's own state
|
|
69
|
+
* always wins over `props`. See {@link ConditionChip} for the contract the
|
|
70
|
+
* component is held to.
|
|
71
|
+
*/
|
|
72
|
+
component?: ComponentDescriptor;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* What the tree should draw for one of the consumer's nodes that holds others.
|
|
76
|
+
*
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export interface ConditionTreeGroupDescription<T> {
|
|
80
|
+
kind: 'group';
|
|
81
|
+
/**
|
|
82
|
+
* How the conditions inside the group are joined.
|
|
83
|
+
*/
|
|
84
|
+
combinator: ConditionTreeCombinator;
|
|
85
|
+
/**
|
|
86
|
+
* The consumer's own nodes inside this group, in display order. They are
|
|
87
|
+
* passed straight back to `describe` one level down, so they need no
|
|
88
|
+
* translating: a group hands over what it already holds.
|
|
89
|
+
*/
|
|
90
|
+
children: T[];
|
|
91
|
+
/**
|
|
92
|
+
* Problems to show on the group, for example from a validation pass.
|
|
93
|
+
*/
|
|
94
|
+
issues?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* What the tree should draw for one of the consumer's nodes that is a single
|
|
98
|
+
* condition: a chip, and the editor that opens when it is clicked.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export interface ConditionTreeLeafDescription {
|
|
103
|
+
kind: 'leaf';
|
|
104
|
+
/**
|
|
105
|
+
* How the condition reads when collapsed.
|
|
106
|
+
*/
|
|
107
|
+
chip: ConditionTreeChip;
|
|
108
|
+
/**
|
|
109
|
+
* The component to mount in the condition's editor popover. It is created
|
|
110
|
+
* by tag name and receives `platform`, `context` and the condition itself
|
|
111
|
+
* as `value`, alongside the `props` given here, so a consumer can hand over
|
|
112
|
+
* any editor it likes — including one supplied by a third party — without
|
|
113
|
+
* the tree knowing what it edits. See {@link ConditionEditor} for the
|
|
114
|
+
* contract that editor is held to.
|
|
115
|
+
*
|
|
116
|
+
* A leaf without an editor is not clickable.
|
|
117
|
+
*/
|
|
118
|
+
editor?: ComponentDescriptor;
|
|
119
|
+
/**
|
|
120
|
+
* Whether this condition is negated.
|
|
121
|
+
*
|
|
122
|
+
* Leave it `undefined` when the condition carries its own polarity — one
|
|
123
|
+
* that tests a property can say "is not between" in its own vocabulary of
|
|
124
|
+
* conditions, and a second, outer negation there would be both redundant
|
|
125
|
+
* and ambiguous. The tree then renders no negation control.
|
|
126
|
+
*
|
|
127
|
+
* Set it — to `false` as much as to `true` — for an opaque condition that
|
|
128
|
+
* is simply true or false, with nothing inside it able to express the
|
|
129
|
+
* opposite, so that wrapping it is the only negation available. The tree
|
|
130
|
+
* then offers the control, and rebuilds the condition through
|
|
131
|
+
* `ConditionTreeAdapter.negate` when it is used.
|
|
132
|
+
*/
|
|
133
|
+
negated?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Set to `true` to open this condition's editor as soon as it appears,
|
|
136
|
+
* for example because the user just added it and it has nothing in it yet.
|
|
137
|
+
*
|
|
138
|
+
* It is acted on once per condition, so there is no need to clear it
|
|
139
|
+
* afterwards: a condition the user has closed stays closed, and the next
|
|
140
|
+
* condition to carry the flag still opens.
|
|
141
|
+
*/
|
|
142
|
+
autoOpen?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Problems to show on the condition, for example from a validation pass.
|
|
145
|
+
*/
|
|
146
|
+
issues?: string[];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* What the tree should draw for one of the consumer's nodes: either a group of
|
|
150
|
+
* others, or a single condition.
|
|
151
|
+
*
|
|
152
|
+
* @public
|
|
153
|
+
*/
|
|
154
|
+
export type ConditionTreeDescription<T> = ConditionTreeGroupDescription<T> | ConditionTreeLeafDescription;
|
|
155
|
+
/**
|
|
156
|
+
* What the tree knows about the user's dealings with one node, handed to
|
|
157
|
+
* `describe` so a consumer does not have to keep the tally itself.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export interface ConditionTreeNodeState {
|
|
162
|
+
/**
|
|
163
|
+
* Whether the user has opened this condition's editor and closed it again.
|
|
164
|
+
*
|
|
165
|
+
* The tree is the only thing that knows this — it opens the editors — so
|
|
166
|
+
* it is the tree that remembers. A consumer uses it to tell a condition
|
|
167
|
+
* nobody has reached yet from one the user saw and left as it is: the
|
|
168
|
+
* first is not at fault for being empty, the second may well be.
|
|
169
|
+
*
|
|
170
|
+
* Always `false` for a group, which has no editor to open.
|
|
171
|
+
*/
|
|
172
|
+
visited: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* How `limebb-condition-tree` reads and rebuilds a consumer's own tree.
|
|
176
|
+
*
|
|
177
|
+
* The tree holds no model of its own. It is given the consumer's tree as-is,
|
|
178
|
+
* asks this adapter what each node should look like, and — when the user
|
|
179
|
+
* changes something — hands back a tree of the same kind with the change
|
|
180
|
+
* applied. Conditions travel by identity: the tree moves the very objects it
|
|
181
|
+
* was given, and only asks for groups to be rebuilt, because only a group's
|
|
182
|
+
* combinator and children can change.
|
|
183
|
+
*
|
|
184
|
+
* Build the adapter once and hold on to it. One built inside `render()` is a
|
|
185
|
+
* new object every time, which makes the tree re-render for no reason.
|
|
186
|
+
*
|
|
187
|
+
* @public
|
|
188
|
+
*/
|
|
189
|
+
export interface ConditionTreeAdapter<T> {
|
|
190
|
+
/**
|
|
191
|
+
* What the tree should draw for one of the consumer's nodes.
|
|
192
|
+
*
|
|
193
|
+
* This runs for every node on every render, so it must be pure and cheap.
|
|
194
|
+
* Work that is not — resolving a property name against a repository, say —
|
|
195
|
+
* belongs in the consumer's own state, resolved once and read from here.
|
|
196
|
+
*
|
|
197
|
+
* `state` is what the tree knows about the user's dealings with this node.
|
|
198
|
+
* Most consumers ignore it; one that marks a condition the user left
|
|
199
|
+
* unfinished reads `visited` from it, rather than keeping that tally
|
|
200
|
+
* itself.
|
|
201
|
+
* @param node
|
|
202
|
+
* @param state
|
|
203
|
+
*/
|
|
204
|
+
describe(node: T, state: ConditionTreeNodeState): ConditionTreeDescription<T>;
|
|
205
|
+
/**
|
|
206
|
+
* A group of the consumer's own kind, joining `children` the way
|
|
207
|
+
* `combinator` says.
|
|
208
|
+
*
|
|
209
|
+
* The tree calls this for every group along the path from the edit up to
|
|
210
|
+
* the root, so a consumer whose model wraps negation (`NOT[AND[…]]`)
|
|
211
|
+
* unfolds `not-all` and `none` back into that wrapper here.
|
|
212
|
+
*
|
|
213
|
+
* `children` is empty in one case only: the user asked for a new group
|
|
214
|
+
* while `addOptions` is set, so the tree cannot know which kind of
|
|
215
|
+
* condition to put in it and leaves that to the user. A group emptied by
|
|
216
|
+
* an edit is dropped rather than rebuilt, so it never reaches here.
|
|
217
|
+
* @param combinator
|
|
218
|
+
* @param children
|
|
219
|
+
*/
|
|
220
|
+
group(combinator: ConditionTreeCombinator, children: T[]): T;
|
|
221
|
+
/**
|
|
222
|
+
* A new condition, for the user to fill in.
|
|
223
|
+
*
|
|
224
|
+
* `item` is the kind the user picked from `addOptions`, and is absent when
|
|
225
|
+
* the tree was given no options to offer: the consumer is then free to
|
|
226
|
+
* decide what a new condition is — typically a blank one, left for its
|
|
227
|
+
* editor to fill in.
|
|
228
|
+
* @param item
|
|
229
|
+
*/
|
|
230
|
+
createLeaf(item?: MenuItem): T;
|
|
231
|
+
/**
|
|
232
|
+
* The same condition, negated or not.
|
|
233
|
+
*
|
|
234
|
+
* Leave it out and the tree offers no negation control, whatever a leaf
|
|
235
|
+
* description says about `negated`.
|
|
236
|
+
* @param node
|
|
237
|
+
* @param negated
|
|
238
|
+
*/
|
|
239
|
+
negate?(node: T, negated: boolean): T;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The contract an editor mounted by `limebb-condition-tree` is held to.
|
|
243
|
+
*
|
|
244
|
+
* The tree sets all five props on the component named by
|
|
245
|
+
* `ConditionTreeLeafDescription.editor`, and listens for one event.
|
|
246
|
+
*
|
|
247
|
+
* @public
|
|
248
|
+
*/
|
|
249
|
+
export interface ConditionEditor<T> {
|
|
250
|
+
/**
|
|
251
|
+
* Platform service provider.
|
|
252
|
+
*/
|
|
253
|
+
platform: LimeWebComponentPlatform;
|
|
254
|
+
/**
|
|
255
|
+
* Component context.
|
|
256
|
+
*/
|
|
257
|
+
context: LimeWebComponentContext;
|
|
258
|
+
/**
|
|
259
|
+
* The condition being edited, in the consumer's own model.
|
|
260
|
+
*/
|
|
261
|
+
value: T;
|
|
262
|
+
/**
|
|
263
|
+
* @inheritdoc
|
|
264
|
+
*/
|
|
265
|
+
readonly: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* @inheritdoc
|
|
268
|
+
*/
|
|
269
|
+
disabled: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Emitted with the replacement condition when the user changes something.
|
|
272
|
+
*
|
|
273
|
+
* Named `conditionChange` rather than `change` on purpose: every
|
|
274
|
+
* `limel-input-field`, `limel-picker` and `limel-select` inside an editor
|
|
275
|
+
* emits a bubbling, composed `change`, and the tree would catch all of
|
|
276
|
+
* them.
|
|
277
|
+
*/
|
|
278
|
+
conditionChange: EventEmitter<T>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The contract a chip mounted by `limebb-condition-tree` is held to.
|
|
282
|
+
*
|
|
283
|
+
* The tree sets these props on the component named by
|
|
284
|
+
* `ConditionTreeChip.component`, and listens for two events. Anything else the
|
|
285
|
+
* chip needs comes from the descriptor's `props`, which the tree passes
|
|
286
|
+
* through untouched — except where a name below collides, and then the tree
|
|
287
|
+
* wins: a chip that stayed on screen while the tree was locked must not be the
|
|
288
|
+
* one place the lock does not reach.
|
|
289
|
+
*
|
|
290
|
+
* `limebb-filter-chip` satisfies this contract, which is why it is what the
|
|
291
|
+
* tree draws when no component is named.
|
|
292
|
+
*
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
|
+
export interface ConditionChip extends Omit<ConditionTreeChip, 'component'> {
|
|
296
|
+
/**
|
|
297
|
+
* Platform service provider.
|
|
298
|
+
*/
|
|
299
|
+
platform: LimeWebComponentPlatform;
|
|
300
|
+
/**
|
|
301
|
+
* Whether this condition's editor is the one currently open.
|
|
302
|
+
*/
|
|
303
|
+
selected: boolean;
|
|
304
|
+
/**
|
|
305
|
+
* @inheritdoc
|
|
306
|
+
*/
|
|
307
|
+
readonly: boolean;
|
|
308
|
+
/**
|
|
309
|
+
* @inheritdoc
|
|
310
|
+
*/
|
|
311
|
+
disabled: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Whether the chip offers a control that deletes the condition. It is
|
|
314
|
+
* `false` while the tree is read-only.
|
|
315
|
+
*/
|
|
316
|
+
removable: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Emitted when the user asks for the condition to be deleted. Its payload
|
|
319
|
+
* is ignored: the tree already knows which condition the chip stands for.
|
|
320
|
+
*/
|
|
321
|
+
remove: EventEmitter<unknown>;
|
|
322
|
+
}
|
|
323
|
+
//# sourceMappingURL=condition-tree.types.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FunctionalComponent } from '../../stencil-public-runtime';
|
|
2
|
+
import { ConditionTreeDescription, ConditionTreeGroupDescription } from './condition-tree.types';
|
|
3
|
+
import { ConditionTreePath } from './condition-tree-nodes';
|
|
4
|
+
import { ConditionTreeRenderContext } from './condition-tree-view-context';
|
|
5
|
+
/**
|
|
6
|
+
* Render one of the consumer's nodes, whichever kind the adapter says it is.
|
|
7
|
+
*
|
|
8
|
+
* It lives beside `GroupView` because a group is what holds nodes of either
|
|
9
|
+
* kind: the recursion is the group's, and keeping the choice here is what lets
|
|
10
|
+
* a group draw a group without two modules importing each other.
|
|
11
|
+
* @param props
|
|
12
|
+
*/
|
|
13
|
+
export declare const NodeView: FunctionalComponent<{
|
|
14
|
+
node: unknown;
|
|
15
|
+
description: ConditionTreeDescription<unknown>;
|
|
16
|
+
path: ConditionTreePath;
|
|
17
|
+
ctx: ConditionTreeRenderContext;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* A box holding a combinator, the conditions joined by it, and the two buttons
|
|
21
|
+
* that grow it.
|
|
22
|
+
* @param props
|
|
23
|
+
*/
|
|
24
|
+
export declare const GroupView: FunctionalComponent<{
|
|
25
|
+
description: ConditionTreeGroupDescription<unknown>;
|
|
26
|
+
path: ConditionTreePath;
|
|
27
|
+
ctx: ConditionTreeRenderContext;
|
|
28
|
+
placeholder?: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=group-node-view.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FunctionalComponent } from '../../stencil-public-runtime';
|
|
2
|
+
import { ConditionTreeLeafDescription } from './condition-tree.types';
|
|
3
|
+
import { ConditionTreePath } from './condition-tree-nodes';
|
|
4
|
+
import { ConditionTreeRenderContext } from './condition-tree-view-context';
|
|
5
|
+
/**
|
|
6
|
+
* What both halves of a condition need: the node itself, what to draw for it,
|
|
7
|
+
* where it sits, and the state and callbacks of the tree around it.
|
|
8
|
+
*/
|
|
9
|
+
interface LeafProps {
|
|
10
|
+
node: unknown;
|
|
11
|
+
description: ConditionTreeLeafDescription;
|
|
12
|
+
path: ConditionTreePath;
|
|
13
|
+
ctx: ConditionTreeRenderContext;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One condition: a chip that summarizes it, and the editor it opens.
|
|
17
|
+
* @param props
|
|
18
|
+
*/
|
|
19
|
+
export declare const LeafView: FunctionalComponent<LeafProps>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=leaf-node-view.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FunctionalComponent } from '../../stencil-public-runtime';
|
|
2
|
+
import { Translator } from '@limetech/lime-web-components';
|
|
3
|
+
import { RuleEditorMode } from './rule-editor.types';
|
|
4
|
+
interface ModeProps {
|
|
5
|
+
modes: RuleEditorMode[];
|
|
6
|
+
selected: RuleEditorMode;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
translator: Translator;
|
|
9
|
+
onModeChange: (mode: RuleEditorMode) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The segmented control that picks how the rule is written.
|
|
13
|
+
*
|
|
14
|
+
* `limel-button-group` renders radio inputs in one group, so at most
|
|
15
|
+
* one mode is ever selected. None is selected when `selected` is a mode
|
|
16
|
+
* the caller does not offer — a stored condition tree under a setting
|
|
17
|
+
* that offers only the unconditional modes.
|
|
18
|
+
* @param props
|
|
19
|
+
*/
|
|
20
|
+
export declare const RuleModeView: FunctionalComponent<ModeProps>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=rule-editor-mode-view.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Rule } from '@limetech/lime-web-components';
|
|
2
|
+
import { RuleEditorMode } from './rule-editor.types';
|
|
3
|
+
/**
|
|
4
|
+
* The id of the platform's "no condition" rule primitive. It reads
|
|
5
|
+
* nothing and always holds, which makes it the literal the
|
|
6
|
+
* unconditional modes are written with. Build those through
|
|
7
|
+
* {@link RULE_ALWAYS} and {@link RULE_NEVER} rather than from the id.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare const ALWAYS_PRIMITIVE_ID = "limetech.always";
|
|
12
|
+
/**
|
|
13
|
+
* The rule that always holds.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare const RULE_ALWAYS: Rule;
|
|
18
|
+
/**
|
|
19
|
+
* The rule that never holds.
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare const RULE_NEVER: Rule;
|
|
24
|
+
/**
|
|
25
|
+
* The rule a mode writes. `conditional` writes no rule of its own —
|
|
26
|
+
* its rule is whatever tree the author builds.
|
|
27
|
+
* @param mode
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function ruleForMode(mode: RuleEditorMode): Rule | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The mode a rule reads back as, or `undefined` when there is no rule.
|
|
33
|
+
*
|
|
34
|
+
* The match is structural: only the two sentinels read back as an
|
|
35
|
+
* unconditional mode, and everything else — a group, a ref, a negation
|
|
36
|
+
* of anything but the always primitive — reads back as `conditional`.
|
|
37
|
+
* So a rule authored elsewhere as `all(always)` is `conditional` with
|
|
38
|
+
* one condition in it, even though it holds just as unconditionally.
|
|
39
|
+
* @param rule
|
|
40
|
+
* @alpha
|
|
41
|
+
*/
|
|
42
|
+
export declare function ruleMode(rule: Rule | undefined): RuleEditorMode | undefined;
|
|
43
|
+
//# sourceMappingURL=rule-editor-modes.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { FormComponent } from '@limetech/lime-elements';
|
|
3
3
|
import { ContextMap, LimeWebComponent, LimeWebComponentContext, LimeWebComponentPlatform, Rule } from '@limetech/lime-web-components';
|
|
4
|
+
import { RuleEditorMode } from './rule-editor.types';
|
|
4
5
|
/**
|
|
5
6
|
* Tree editor for {@link Rule}.
|
|
6
7
|
*
|
|
@@ -31,7 +32,17 @@ import { ContextMap, LimeWebComponent, LimeWebComponentContext, LimeWebComponent
|
|
|
31
32
|
* default (e.g. an admin form's "no selection" context) doesn't shadow a
|
|
32
33
|
* DOM-provided one.
|
|
33
34
|
*
|
|
35
|
+
* Pass `modes` to offer the author a few pre-defined answers above the
|
|
36
|
+
* tree — "Never", "Always", "Conditionally" — so an
|
|
37
|
+
* unconditional state is one click instead of an empty tree they have
|
|
38
|
+
* to reason about. A mode is a way of writing a rule, not a second
|
|
39
|
+
* output: all of them end up in `value`, and `ruleForMode` builds the
|
|
40
|
+
* same rule a click does.
|
|
41
|
+
*
|
|
34
42
|
* @exampleComponent limebb-example-rule-editor
|
|
43
|
+
* @exampleComponent limebb-example-rule-editor-modes
|
|
44
|
+
* @exampleComponent limebb-example-rule-editor-invalid
|
|
45
|
+
* @exampleComponent limebb-example-rule-editor-help
|
|
35
46
|
*
|
|
36
47
|
* @alpha
|
|
37
48
|
* @private
|
|
@@ -57,6 +68,24 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
57
68
|
* the saved-rule library.
|
|
58
69
|
*/
|
|
59
70
|
availableContexts?: (keyof ContextMap)[];
|
|
71
|
+
/**
|
|
72
|
+
* The ways of writing a rule offered above the tree, in the order
|
|
73
|
+
* given. Leave it unset to offer none, and render the tree alone.
|
|
74
|
+
*
|
|
75
|
+
* Which modes make sense is the caller's to decide, because it
|
|
76
|
+
* differs per setting: a "when to show" toggle offers `always` and
|
|
77
|
+
* `conditional`, while a "when to make required" one also offers
|
|
78
|
+
* `never`. `conditional` is not forced into the list — a caller
|
|
79
|
+
* passing only the unconditional modes usually gets a plain toggle
|
|
80
|
+
* with no tree, which is a legitimate thing to want.
|
|
81
|
+
*
|
|
82
|
+
* "Usually", because the offered modes do not constrain `value`. A
|
|
83
|
+
* stored condition tree is still drawn, and the control then shows
|
|
84
|
+
* no mode as selected, because none of the offered ones describes
|
|
85
|
+
* what is stored. Hiding a rule the author cannot otherwise see
|
|
86
|
+
* would be worse than an unselected control.
|
|
87
|
+
*/
|
|
88
|
+
modes?: RuleEditorMode[];
|
|
60
89
|
/**
|
|
61
90
|
* @inheritdoc
|
|
62
91
|
*/
|
|
@@ -76,6 +105,17 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
76
105
|
* @inheritdoc
|
|
77
106
|
*/
|
|
78
107
|
disabled: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Set to `true` to mark the rule as invalid, which reddens the
|
|
110
|
+
* outline and the helper text.
|
|
111
|
+
*
|
|
112
|
+
* This is the caller's verdict on the rule as a whole — typically a
|
|
113
|
+
* form reporting that the field is required and empty. It is
|
|
114
|
+
* separate from the diagnostics the editor finds itself, which mark
|
|
115
|
+
* the individual nodes they belong to and show regardless of this
|
|
116
|
+
* prop.
|
|
117
|
+
*/
|
|
118
|
+
invalid: boolean;
|
|
79
119
|
/**
|
|
80
120
|
* @inheritdoc
|
|
81
121
|
*/
|
|
@@ -84,6 +124,15 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
84
124
|
* @inheritdoc
|
|
85
125
|
*/
|
|
86
126
|
helperText: string;
|
|
127
|
+
/**
|
|
128
|
+
* Contextual help for the setting as a whole, rendered as a `?`
|
|
129
|
+
* beside the label that opens a popover on click. Markdown.
|
|
130
|
+
*
|
|
131
|
+
* For what a rule *is* rather than what this one is for — the
|
|
132
|
+
* helper text is the shorter, always-legible answer, and the two
|
|
133
|
+
* are meant to be used together rather than instead of each other.
|
|
134
|
+
*/
|
|
135
|
+
help?: string;
|
|
87
136
|
/**
|
|
88
137
|
* Emitted when the rule tree is mutated. Detail is the new rule, or
|
|
89
138
|
* `undefined` when the user has cleared the editor to an empty root
|
|
@@ -94,13 +143,35 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
94
143
|
private resolvedContext?;
|
|
95
144
|
private issues;
|
|
96
145
|
private openChipPath;
|
|
146
|
+
/**
|
|
147
|
+
* The mode the author last clicked, held until `value` reads back
|
|
148
|
+
* as it.
|
|
149
|
+
*
|
|
150
|
+
* A purely derived mode cannot express one case: `conditional` with
|
|
151
|
+
* nothing to restore emits no rule, so the derivation would fall
|
|
152
|
+
* back to the first offered mode and snap the control away from
|
|
153
|
+
* what the author just clicked.
|
|
154
|
+
*/
|
|
155
|
+
private modeOverride;
|
|
97
156
|
private focusOnOpen;
|
|
98
157
|
private metadataById;
|
|
99
158
|
private allPrimitiveOptions;
|
|
100
159
|
private availablePrimitiveOptions;
|
|
101
160
|
private reachableSlots;
|
|
161
|
+
/**
|
|
162
|
+
* The conditional rule the author had when they switched to an
|
|
163
|
+
* unconditional mode, put back when they switch to `conditional`
|
|
164
|
+
* again.
|
|
165
|
+
*
|
|
166
|
+
* It is not emitted, so a remount loses it. That is the trade:
|
|
167
|
+
* a mis-click is forgiven without inventing a state the emitted
|
|
168
|
+
* `Rule` has no way to carry.
|
|
169
|
+
*/
|
|
170
|
+
private stashedTree;
|
|
102
171
|
private normalizedCache;
|
|
103
172
|
private hasLoaded;
|
|
173
|
+
private readonly labelId;
|
|
174
|
+
private readonly helperTextId;
|
|
104
175
|
componentWillLoad(): void;
|
|
105
176
|
private rebuildFromRegistries;
|
|
106
177
|
/**
|
|
@@ -114,9 +185,48 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
114
185
|
protected onValueChange(): void;
|
|
115
186
|
protected onAvailableContextsChange(): void;
|
|
116
187
|
render(): any;
|
|
117
|
-
private
|
|
118
|
-
|
|
188
|
+
private renderModes;
|
|
189
|
+
/**
|
|
190
|
+
* The condition tree, shown unless a mode other than `conditional`
|
|
191
|
+
* is selected — an unconditional rule has no conditions to show.
|
|
192
|
+
* A caller offering no modes at all gets the tree, as before.
|
|
193
|
+
*/
|
|
194
|
+
private renderTree;
|
|
195
|
+
private renderHelperLine;
|
|
196
|
+
private renderHelp;
|
|
119
197
|
private createRenderContext;
|
|
198
|
+
/**
|
|
199
|
+
* The mode the editor is in, or `undefined` when it offers none —
|
|
200
|
+
* then it is the plain tree editor it was before modes existed.
|
|
201
|
+
*
|
|
202
|
+
* Derived from `value`, falling back to the first offered mode for
|
|
203
|
+
* a caller who has not stored a rule yet: the control has to show
|
|
204
|
+
* something, and nothing is emitted until the author picks.
|
|
205
|
+
*/
|
|
206
|
+
private get currentMode();
|
|
207
|
+
/**
|
|
208
|
+
* Write the picked mode as a rule and emit it. The tree the author
|
|
209
|
+
* had is stashed on the way out, so picking `conditional` again
|
|
210
|
+
* puts it back instead of starting from empty. An emptied tree is
|
|
211
|
+
* stashed too — restoring it is what tells the author their
|
|
212
|
+
* conditions are gone, rather than handing back the ones they
|
|
213
|
+
* removed. With nothing stashed, `conditional` emits no rule, which
|
|
214
|
+
* is how the editor already says "the author cleared this".
|
|
215
|
+
* @param mode
|
|
216
|
+
*/
|
|
217
|
+
private handleModeChange;
|
|
218
|
+
/**
|
|
219
|
+
* Drop the override once `value` contradicts it, handing the mode
|
|
220
|
+
* back to the derivation — that is how a later value from the
|
|
221
|
+
* caller wins over the mode the author picked.
|
|
222
|
+
*
|
|
223
|
+
* A value that expresses no mode at all does not contradict
|
|
224
|
+
* anything: an emptied tree emits no rule, and the author is still
|
|
225
|
+
* in `conditional`. Dropping the override there would read the
|
|
226
|
+
* empty value back as the first offered mode and rewrite the
|
|
227
|
+
* setting under the author.
|
|
228
|
+
*/
|
|
229
|
+
private clearReachedModeOverride;
|
|
120
230
|
private handleDelete;
|
|
121
231
|
private handleUpdateArgs;
|
|
122
232
|
private handleReplaceNode;
|
|
@@ -146,9 +256,12 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
146
256
|
/**
|
|
147
257
|
* The subset of registered metadata offered for adding in the
|
|
148
258
|
* palette: primitives whose `reads` aren't fully covered by the
|
|
149
|
-
* reachable slots are dropped
|
|
150
|
-
*
|
|
151
|
-
*
|
|
259
|
+
* reachable slots are dropped, and so is the always primitive —
|
|
260
|
+
* it reads nothing, so it is always covered, but an "Always" chip
|
|
261
|
+
* among a group's conditions says nothing. Filtering only the
|
|
262
|
+
* palette — not the full `allPrimitiveOptions` — keeps
|
|
263
|
+
* already-placed chips resolving to their proper title even when
|
|
264
|
+
* their read slot isn't reachable.
|
|
152
265
|
*/
|
|
153
266
|
private availablePrimitiveMetadata;
|
|
154
267
|
/**
|
|
@@ -166,6 +279,13 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
166
279
|
*/
|
|
167
280
|
private computeReachableSlots;
|
|
168
281
|
private runValidation;
|
|
282
|
+
/**
|
|
283
|
+
* Emit an edited tree. Editing the tree is only possible in
|
|
284
|
+
* `conditional`, so the edit itself records the mode: an edit that
|
|
285
|
+
* empties the tree emits no rule, and without this the empty value
|
|
286
|
+
* would read back as the first offered mode.
|
|
287
|
+
* @param next
|
|
288
|
+
*/
|
|
169
289
|
private emitIfChanged;
|
|
170
290
|
/**
|
|
171
291
|
* Wrap any non-group `value` in a top-level `all` so the editor
|
|
@@ -174,6 +294,10 @@ export declare class RuleEditor implements LimeWebComponent, FormComponent<Rule
|
|
|
174
294
|
* `emitNormalization` will *not* push that placeholder back to the
|
|
175
295
|
* caller, so an unset value stays unset until the user edits.
|
|
176
296
|
*
|
|
297
|
+
* An unconditional mode is the exception: its sentinel is left
|
|
298
|
+
* exactly as it came in, because wrapping it would rewrite the
|
|
299
|
+
* shape the mode is read back from.
|
|
300
|
+
*
|
|
177
301
|
* Memoized so callers that read this several times in one handler
|
|
178
302
|
* see the same reference — the identity check in `emitIfChanged`
|
|
179
303
|
* depends on it.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A way of writing a rule.
|
|
3
|
+
*
|
|
4
|
+
* - `never` — the rule never holds
|
|
5
|
+
* - `always` — the rule always holds
|
|
6
|
+
* - `conditional` — the rule holds when the author's conditions are met
|
|
7
|
+
*
|
|
8
|
+
* The first two are one click each, which spares the author from
|
|
9
|
+
* reasoning about an empty condition tree to say something
|
|
10
|
+
* unconditional. All three end up in the same `Rule` value — a mode is
|
|
11
|
+
* a way of writing a rule, not a second output.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type RuleEditorMode = 'never' | 'always' | 'conditional';
|
|
16
|
+
//# sourceMappingURL=rule-editor.types.d.ts.map
|