@limetech/lime-crm-building-blocks 2.1.0 → 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 +8 -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-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 +1 -1
- package/dist/cjs/limebb-rule-editor.cjs.entry.js +159 -19
- 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/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/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/rule-chip-popover/rule-chip-popover.js +1 -1
- 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/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-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/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-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 +1 -1
- package/dist/esm/limebb-rule-editor.entry.js +160 -20
- 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-a0dee52a.entry.js → p-0445035f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-5b80d92a.entry.js → p-0a05b3e9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-fb45e6d5.entry.js → p-0dd64440.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-76064593.entry.js → p-170ab4be.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-5b000748.entry.js → p-27b9c824.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-c4e40c2c.entry.js → p-2d1c7b6f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-1731f5c3.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-d0c75083.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-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-3c72400d.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-a2b9c410.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-3fe4f3f4.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-b48c23f4.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-11b41423.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-b46722c8.entry.js → p-fc372344.entry.js} +1 -1
- 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 +64 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interface.d.ts +1 -0
- package/package.json +2 -2
- 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-e6605577.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-e8a7a94c.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c as r,h as i}from"./p-COtSgrC5.js";const t=class{constructor(i){e(this,i),this.changeStartTime=r(this,"changeStartTime"),this.changeEndTime=r(this,"changeEndTime"),this.handleStartTimeChange=e=>{e.stopPropagation(),this.changeStartTime.emit(e.detail)},this.handleEndTimeChange=e=>{e.stopPropagation(),this.changeEndTime.emit(e.detail)}}componentWillLoad(){this.originalStartTime=this.startTime,this.originalEndTime=this.endTime}render(){return i("div",{key:"
|
|
1
|
+
import{r as e,c as r,h as i}from"./p-COtSgrC5.js";const t=class{constructor(i){e(this,i),this.changeStartTime=r(this,"changeStartTime"),this.changeEndTime=r(this,"changeEndTime"),this.handleStartTimeChange=e=>{e.stopPropagation(),this.changeStartTime.emit(e.detail)},this.handleEndTimeChange=e=>{e.stopPropagation(),this.changeEndTime.emit(e.detail)}}componentWillLoad(){this.originalStartTime=this.startTime,this.originalEndTime=this.endTime}render(){return i("div",{key:"164c0dd19a89356dcd9186768033d7974006dcb5",class:"date-pickers"},this.renderStartDatePicker(),this.renderEndDatePicker())}renderStartDatePicker(){if(this.originalStartTime)return i("div",{class:"start-time"},this.renderDatePicker(this.startTimeLabel,this.startTime,!this.startTime,this.handleStartTimeChange))}renderEndDatePicker(){if(this.originalEndTime)return i("div",{class:"end-time"},this.renderDatePicker(this.endTimeLabel,this.endTime,!this.endTime,this.handleEndTimeChange))}renderDatePicker(e,r,t,a){const l=this.platform&&i("limebb-date-picker",{platform:this.platform,context:this.context,type:this.type,value:r,onChange:a,invalid:t});return[i("div",{class:"label-group"},i("span",{class:"circle"}),i("span",{class:"label"},e),i("span",{class:"line"})),l||i("limel-date-picker",{type:this.type,value:r,format:this.timeFormat,language:this.language,onChange:a,invalid:t})]}};t.style=":host(limebb-date-range){isolation:isolate;display:block;position:relative}*{box-sizing:border-box}.date-pickers{display:grid;grid-template-columns:repeat(auto-fit, minmax(13.5rem, 1fr));gap:0.5rem;padding:0.75rem 1rem 1.25rem 1rem}.label-group{display:flex;align-items:center;margin-bottom:0.25rem}.end-time .label-group{flex-direction:row-reverse}.label-group .label{font-size:0.75rem;padding:0 0.25rem}.label-group .circle{flex-shrink:0;width:0.5rem;height:0.5rem;border-radius:50%}.start-time .label-group .circle{background-color:rgb(var(--color-green-default))}.end-time .label-group .circle{background-color:rgb(var(--color-coral-default))}.label-group .line{flex-grow:1;height:0.25rem;border-radius:1rem}.start-time .label-group .line{background-image:linear-gradient(to right, rgb(var(--color-green-light)), rgb(var(--contrast-400)) 30%)}.end-time .label-group .line{background-image:linear-gradient(to left, rgb(var(--color-coral-light)), rgb(var(--contrast-400)) 30%)}.date-pickers:has(>:last-child:nth-child(2)) .start-time .line{margin-right:-0.5rem}.date-pickers:has(>:last-child:nth-child(2)) .end-time .line{margin-left:-0.5rem}";export{t as limebb_date_range}
|
|
@@ -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
|
|
@@ -34,6 +34,7 @@ import { LanguagePickerType } from "./components/locale-picker/language-picker.t
|
|
|
34
34
|
import { NavigationButtonType } from "./components/navigation-button/navigation-button.types";
|
|
35
35
|
import { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
|
|
36
36
|
import { RuleArgFilterEditorValue } from "./components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor";
|
|
37
|
+
import { RuleEditorMode } from "./components/rule-editor/rule-editor.types";
|
|
37
38
|
import { TriggerMap } from "./components/text-editor/text-editor.types";
|
|
38
39
|
import { ValueComparisonEditorValue } from "./components/rule-editor/value-comparison-editor/value-comparison-editor";
|
|
39
40
|
export { AlertType } from "./components/alert-dialog/alert-dialog.types";
|
|
@@ -65,6 +66,7 @@ export { LanguagePickerType } from "./components/locale-picker/language-picker.t
|
|
|
65
66
|
export { NavigationButtonType } from "./components/navigation-button/navigation-button.types";
|
|
66
67
|
export { NotificationItem } from "./components/notification-list/notification-item/notification-item.types";
|
|
67
68
|
export { RuleArgFilterEditorValue } from "./components/rule-editor/rule-arg-filter-editor/rule-arg-filter-editor";
|
|
69
|
+
export { RuleEditorMode } from "./components/rule-editor/rule-editor.types";
|
|
68
70
|
export { TriggerMap } from "./components/text-editor/text-editor.types";
|
|
69
71
|
export { ValueComparisonEditorValue } from "./components/rule-editor/value-comparison-editor/value-comparison-editor";
|
|
70
72
|
export namespace Components {
|
|
@@ -2583,7 +2585,16 @@ export namespace Components {
|
|
|
2583
2585
|
* that provides it. An explicit Prop with a `limetype` wins, so an empty
|
|
2584
2586
|
* default (e.g. an admin form's "no selection" context) doesn't shadow a
|
|
2585
2587
|
* DOM-provided one.
|
|
2588
|
+
* Pass `modes` to offer the author a few pre-defined answers above the
|
|
2589
|
+
* tree — "Never", "Always", "Conditionally" — so an
|
|
2590
|
+
* unconditional state is one click instead of an empty tree they have
|
|
2591
|
+
* to reason about. A mode is a way of writing a rule, not a second
|
|
2592
|
+
* output: all of them end up in `value`, and `ruleForMode` builds the
|
|
2593
|
+
* same rule a click does.
|
|
2586
2594
|
* @exampleComponent limebb-example-rule-editor
|
|
2595
|
+
* @exampleComponent limebb-example-rule-editor-modes
|
|
2596
|
+
* @exampleComponent limebb-example-rule-editor-invalid
|
|
2597
|
+
* @exampleComponent limebb-example-rule-editor-help
|
|
2587
2598
|
* @alpha
|
|
2588
2599
|
* @private
|
|
2589
2600
|
*/
|
|
@@ -2601,16 +2612,28 @@ export namespace Components {
|
|
|
2601
2612
|
* @inheritdoc
|
|
2602
2613
|
*/
|
|
2603
2614
|
"disabled": boolean;
|
|
2615
|
+
/**
|
|
2616
|
+
* Contextual help for the setting as a whole, rendered as a `?` beside the label that opens a popover on click. Markdown. For what a rule *is* rather than what this one is for — the helper text is the shorter, always-legible answer, and the two are meant to be used together rather than instead of each other.
|
|
2617
|
+
*/
|
|
2618
|
+
"help"?: string;
|
|
2604
2619
|
/**
|
|
2605
2620
|
* The helper text for the current property
|
|
2606
2621
|
* @inheritdoc
|
|
2607
2622
|
*/
|
|
2608
2623
|
"helperText": string;
|
|
2624
|
+
/**
|
|
2625
|
+
* Set to `true` to mark the rule as invalid, which reddens the outline and the helper text. This is the caller's verdict on the rule as a whole — typically a form reporting that the field is required and empty. It is separate from the diagnostics the editor finds itself, which mark the individual nodes they belong to and show regardless of this prop.
|
|
2626
|
+
*/
|
|
2627
|
+
"invalid": boolean;
|
|
2609
2628
|
/**
|
|
2610
2629
|
* The label of the current property
|
|
2611
2630
|
* @inheritdoc
|
|
2612
2631
|
*/
|
|
2613
2632
|
"label": string;
|
|
2633
|
+
/**
|
|
2634
|
+
* The ways of writing a rule offered above the tree, in the order given. Leave it unset to offer none, and render the tree alone. Which modes make sense is the caller's to decide, because it differs per setting: a "when to show" toggle offers `always` and `conditional`, while a "when to make required" one also offers `never`. `conditional` is not forced into the list — a caller passing only the unconditional modes usually gets a plain toggle with no tree, which is a legitimate thing to want. "Usually", because the offered modes do not constrain `value`. A stored condition tree is still drawn, and the control then shows no mode as selected, because none of the offered ones describes what is stored. Hiding a rule the author cannot otherwise see would be worse than an unselected control.
|
|
2635
|
+
*/
|
|
2636
|
+
"modes"?: RuleEditorMode[];
|
|
2614
2637
|
/**
|
|
2615
2638
|
* Reference to the platform service container. Use this to access all platform services like repositories, HTTP client, command bus, navigator, and more. The platform instance is shared across all components in the same application context.
|
|
2616
2639
|
*/
|
|
@@ -4941,7 +4964,16 @@ declare global {
|
|
|
4941
4964
|
* that provides it. An explicit Prop with a `limetype` wins, so an empty
|
|
4942
4965
|
* default (e.g. an admin form's "no selection" context) doesn't shadow a
|
|
4943
4966
|
* DOM-provided one.
|
|
4967
|
+
* Pass `modes` to offer the author a few pre-defined answers above the
|
|
4968
|
+
* tree — "Never", "Always", "Conditionally" — so an
|
|
4969
|
+
* unconditional state is one click instead of an empty tree they have
|
|
4970
|
+
* to reason about. A mode is a way of writing a rule, not a second
|
|
4971
|
+
* output: all of them end up in `value`, and `ruleForMode` builds the
|
|
4972
|
+
* same rule a click does.
|
|
4944
4973
|
* @exampleComponent limebb-example-rule-editor
|
|
4974
|
+
* @exampleComponent limebb-example-rule-editor-modes
|
|
4975
|
+
* @exampleComponent limebb-example-rule-editor-invalid
|
|
4976
|
+
* @exampleComponent limebb-example-rule-editor-help
|
|
4945
4977
|
* @alpha
|
|
4946
4978
|
* @private
|
|
4947
4979
|
*/
|
|
@@ -7982,7 +8014,16 @@ declare namespace LocalJSX {
|
|
|
7982
8014
|
* that provides it. An explicit Prop with a `limetype` wins, so an empty
|
|
7983
8015
|
* default (e.g. an admin form's "no selection" context) doesn't shadow a
|
|
7984
8016
|
* DOM-provided one.
|
|
8017
|
+
* Pass `modes` to offer the author a few pre-defined answers above the
|
|
8018
|
+
* tree — "Never", "Always", "Conditionally" — so an
|
|
8019
|
+
* unconditional state is one click instead of an empty tree they have
|
|
8020
|
+
* to reason about. A mode is a way of writing a rule, not a second
|
|
8021
|
+
* output: all of them end up in `value`, and `ruleForMode` builds the
|
|
8022
|
+
* same rule a click does.
|
|
7985
8023
|
* @exampleComponent limebb-example-rule-editor
|
|
8024
|
+
* @exampleComponent limebb-example-rule-editor-modes
|
|
8025
|
+
* @exampleComponent limebb-example-rule-editor-invalid
|
|
8026
|
+
* @exampleComponent limebb-example-rule-editor-help
|
|
7986
8027
|
* @alpha
|
|
7987
8028
|
* @private
|
|
7988
8029
|
*/
|
|
@@ -8000,16 +8041,28 @@ declare namespace LocalJSX {
|
|
|
8000
8041
|
* @inheritdoc
|
|
8001
8042
|
*/
|
|
8002
8043
|
"disabled"?: boolean;
|
|
8044
|
+
/**
|
|
8045
|
+
* Contextual help for the setting as a whole, rendered as a `?` beside the label that opens a popover on click. Markdown. For what a rule *is* rather than what this one is for — the helper text is the shorter, always-legible answer, and the two are meant to be used together rather than instead of each other.
|
|
8046
|
+
*/
|
|
8047
|
+
"help"?: string;
|
|
8003
8048
|
/**
|
|
8004
8049
|
* The helper text for the current property
|
|
8005
8050
|
* @inheritdoc
|
|
8006
8051
|
*/
|
|
8007
8052
|
"helperText"?: string;
|
|
8053
|
+
/**
|
|
8054
|
+
* Set to `true` to mark the rule as invalid, which reddens the outline and the helper text. This is the caller's verdict on the rule as a whole — typically a form reporting that the field is required and empty. It is separate from the diagnostics the editor finds itself, which mark the individual nodes they belong to and show regardless of this prop.
|
|
8055
|
+
*/
|
|
8056
|
+
"invalid"?: boolean;
|
|
8008
8057
|
/**
|
|
8009
8058
|
* The label of the current property
|
|
8010
8059
|
* @inheritdoc
|
|
8011
8060
|
*/
|
|
8012
8061
|
"label"?: string;
|
|
8062
|
+
/**
|
|
8063
|
+
* The ways of writing a rule offered above the tree, in the order given. Leave it unset to offer none, and render the tree alone. Which modes make sense is the caller's to decide, because it differs per setting: a "when to show" toggle offers `always` and `conditional`, while a "when to make required" one also offers `never`. `conditional` is not forced into the list — a caller passing only the unconditional modes usually gets a plain toggle with no tree, which is a legitimate thing to want. "Usually", because the offered modes do not constrain `value`. A stored condition tree is still drawn, and the control then shows no mode as selected, because none of the offered ones describes what is stored. Hiding a rule the author cannot otherwise see would be worse than an unselected control.
|
|
8064
|
+
*/
|
|
8065
|
+
"modes"?: RuleEditorMode[];
|
|
8013
8066
|
/**
|
|
8014
8067
|
* Emitted when the rule tree is mutated. Detail is the new rule, or `undefined` when the user has cleared the editor to an empty root group — callers can persist `undefined` as "no rule" without having to inspect the rule shape themselves.
|
|
8015
8068
|
*/
|
|
@@ -8752,8 +8805,10 @@ declare namespace LocalJSX {
|
|
|
8752
8805
|
"required": boolean;
|
|
8753
8806
|
"readonly": boolean;
|
|
8754
8807
|
"disabled": boolean;
|
|
8808
|
+
"invalid": boolean;
|
|
8755
8809
|
"label": string;
|
|
8756
8810
|
"helperText": string;
|
|
8811
|
+
"help": string;
|
|
8757
8812
|
}
|
|
8758
8813
|
interface LimebbSummaryPopoverAttributes {
|
|
8759
8814
|
"triggerDelay": number;
|
|
@@ -9744,7 +9799,16 @@ declare module "@stencil/core" {
|
|
|
9744
9799
|
* that provides it. An explicit Prop with a `limetype` wins, so an empty
|
|
9745
9800
|
* default (e.g. an admin form's "no selection" context) doesn't shadow a
|
|
9746
9801
|
* DOM-provided one.
|
|
9802
|
+
* Pass `modes` to offer the author a few pre-defined answers above the
|
|
9803
|
+
* tree — "Never", "Always", "Conditionally" — so an
|
|
9804
|
+
* unconditional state is one click instead of an empty tree they have
|
|
9805
|
+
* to reason about. A mode is a way of writing a rule, not a second
|
|
9806
|
+
* output: all of them end up in `value`, and `ruleForMode` builds the
|
|
9807
|
+
* same rule a click does.
|
|
9747
9808
|
* @exampleComponent limebb-example-rule-editor
|
|
9809
|
+
* @exampleComponent limebb-example-rule-editor-modes
|
|
9810
|
+
* @exampleComponent limebb-example-rule-editor-invalid
|
|
9811
|
+
* @exampleComponent limebb-example-rule-editor-help
|
|
9748
9812
|
* @alpha
|
|
9749
9813
|
* @private
|
|
9750
9814
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,5 +5,7 @@ export * from './util/color-palettes';
|
|
|
5
5
|
export * from './components/filter-chip/filter-chip.types';
|
|
6
6
|
export * from './components/filter-chip/filter-condition-icons';
|
|
7
7
|
export * from './components/filter-chip/filter-operators';
|
|
8
|
+
export * from './components/rule-editor/rule-editor.types';
|
|
9
|
+
export * from './components/rule-editor/rule-editor-modes';
|
|
8
10
|
import '@lundalogik/lime-icons8';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -17,3 +17,4 @@ export {
|
|
|
17
17
|
export * from './components/document-chips/document-chips.types';
|
|
18
18
|
export * from './components/filter-chip/filter-chip.types';
|
|
19
19
|
export * from './components/condition-tree/condition-tree.types';
|
|
20
|
+
export * from './components/rule-editor/rule-editor.types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-crm-building-blocks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A home for shared components meant for use with Lime CRM",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@limetech/lime-elements": "^39.45.3",
|
|
38
38
|
"@limetech/lime-web-components": "^7.4.0",
|
|
39
39
|
"@lundalogik/lime-icons8": "^2.41.0",
|
|
40
|
-
"@lundalogik/limeclient.js": "^1.
|
|
40
|
+
"@lundalogik/limeclient.js": "^1.115.0",
|
|
41
41
|
"@stencil/core": "^4.44.2",
|
|
42
42
|
"@stencil/sass": "^3.3.3",
|
|
43
43
|
"@stencil/vitest": "^1.14.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as r,H as t}from"./p-COtSgrC5.js";const a=class{constructor(r){e(this,r),this.colors=[]}render(){return r(t,{key:"37c886a976b9cd342aa1d12cfffad8b5639f6f39","aria-hidden":"true"},r("ol",{key:"41165c8cfb34050c17ae45d127e7d2326dee12fb"},this.colors.map(((e,t)=>r("li",{key:t,style:{backgroundColor:e}})))))}};a.style=":host(limebb-color-palette-swatches){pointer-events:none;transform:var(--color-palette-swatches-transform, unset);box-sizing:border-box;display:block;width:100%}*{box-sizing:border-box;min-width:0;min-height:0}ol{list-style:none;display:grid;grid-template-columns:repeat(auto-fit, minmax(0.75rem, 1fr));gap:var(--color-palette-swatches-gap, 0.25rem);margin:0;padding:var(--color-palette-swatches-gap, 0.25rem);border-radius:0.5rem}li{aspect-ratio:1;border-radius:0.25rem}";export{a as limebb_color_palette_swatches}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i}from"./p-COtSgrC5.js";import{n as l}from"./p-Cj_3f9vm.js";const n=[{trigger:"rich-text",icon:"font_style_formatting",translationKey:"webclient.composer-toolbar.rich-text"},{trigger:"mention",icon:"email_sign_92447",translationKey:"webclient.composer-toolbar.mention",helperLabel:"@"},{trigger:"text-snippet",icon:"add_text",translationKey:"webclient.composer-toolbar.text-snippet",helperLabel:"!"},{trigger:"internal-link",icon:"hashtag_large",translationKey:"webclient.composer-toolbar.internal-link",helperLabel:"#"}],o=class{constructor(i){e(this,i),this.triggerInsert=t(this,"triggerInsert"),this.filesSelected=t(this,"filesSelected"),this.mentions=!1,this.textSnippets=!1,this.internalLinks=!1,this.richText=!1,this.handleTriggerSelected=e=>{e.stopPropagation(),this.triggerInsert.emit(e.detail.value)},this.handleFilesSelected=e=>{e.stopPropagation(),this.filesSelected.emit(e.detail)}}render(){return[i("div",{key:"475b730dee1ec915324640d2dc49e4e5c153b828",class:"actions"},i("slot",{key:"199c6ffa29f8785d7ce9a25ceddc1d34194a24b7",name:"leading"}),this.renderFileInput(),this.renderTriggerActions(),i("slot",{key:"f29ce72acf0ece6f92592ca27ade0f2048315ab7",name:"trailing"})),i("slot",{key:"afcf9f1fdd3b8fbce732eb5026331959290f4ee9",name:"primary-action"})]}get translator(){var e;return null===(e=this.platform)||void 0===e?void 0:e.get(l.Translate)}get triggerActions(){const e={mention:this.mentions,"text-snippet":this.textSnippets,"internal-link":this.internalLinks,"rich-text":this.richText};return n.filter((t=>e[t.trigger])).map((e=>{var t,i;return{text:null!==(i=null===(t=this.translator)||void 0===t?void 0:t.get(e.translationKey))&&void 0!==i?i:e.trigger,commandText:e.helperLabel,icon:e.icon,iconOnly:!0,value:e.trigger}}))}renderTriggerActions(){const e=this.triggerActions;if(0!==e.length)return i("limel-action-bar",{actions:e,onItemSelected:this.handleTriggerSelected})}renderFileInput(){var e,t,l,n,o,r;if(this.fileInput)return i("limel-file-input",{accept:null!==(e=this.fileInput.accept)&&void 0!==e?e:"*",multiple:null!==(t=this.fileInput.multiple)&&void 0!==t&&t,disabled:null!==(l=this.fileInput.disabled)&&void 0!==l&&l,onFilesSelected:this.handleFilesSelected},i("limel-icon-button",{icon:"attach",disabled:null!==(n=this.fileInput.disabled)&&void 0!==n&&n,label:null===(o=this.translator)||void 0===o?void 0:o.get("webclient.attach-files"),helperLabel:null===(r=this.translator)||void 0===r?void 0:r.get("webclient.attach-files-helper")}))}};o.style="*{box-sizing:border-box;min-width:0}:host(limebb-composer-toolbar){box-sizing:border-box;display:flex;align-items:center;width:100%;max-width:100%;gap:0.5rem}.actions{display:flex;align-items:center;flex-wrap:nowrap;flex-grow:1}limel-icon-button,::slotted(limel-icon-button){display:inline-block;scale:0.86}limel-file-input{flex-shrink:0}";export{o as limebb_composer_toolbar}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t,c as n,g as r}from"./p-COtSgrC5.js";import{M as i,n as l}from"./p-Cj_3f9vm.js";function o(e,t){return t?{type:"not",rule:e}:e}function s(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))}function u(e,t){return e.filter((e=>s(e.path,t)))}function a(e,t){let n=e;for(const e of t){if(void 0===n)return;n=d(n,e)}return n}function c(e,t,n){if(0===t.length)return n;const[r,...i]=t;if("not"===e.type&&"rule"===r)return Object.assign(Object.assign({},e),{rule:c(e.rule,i,n)});if(("all"===e.type||"any"===e.type)&&"rules"===r){if(0===i.length)return n;const[t,...r]=i;if("number"!=typeof t)return e;const l=[...e.rules];return l[t]=c(l[t],r,n),Object.assign(Object.assign({},e),{rules:l})}return e}function d(e,t){return"not"===e.type&&"rule"===t?e.rule:"all"!==e.type&&"any"!==e.type||"rules"!==t?"all"!==e.type&&"any"!==e.type||"number"!=typeof t?e:e.rules[t]:e}const h={name:"question",color:"rgb(var(--color-glaucous-light))"};function f(e,t){return[...e.values()].map((e=>({value:e.id,text:e.title?t.get(e.title):e.id,secondaryText:e.description?t.get(e.description):"",icon:e.icon}))).sort(((e,t)=>e.text.localeCompare(t.text)))}function p(e,t){return e.reads.every((e=>t.has(e)))}function v(e){return`__chip__:${e}`}function b(e,t){return[...e,"rules",t]}function m(e){return"ref"===e.type?{ref:e,isNegated:!1}:"not"===e.type&&"ref"===e.rule.type?{ref:e.rule,isNegated:!0}:null}const g=({groupNode:t,groupPath:n,chipChildren:r,ctx:i})=>{const l=new Map,o=r.map((e=>{const t=v(e.index);l.set(t,e);const n=(r=e.ref.id,null!==(o=i.allPrimitiveOptions.find((e=>e.value===r)))&&void 0!==o?o:{value:r,text:r,icon:h});var r,o;return Object.assign(Object.assign({},n),{text:e.isNegated?`¬ ${n.text}`:n.text,value:t})})),s=(u=i.availablePrimitiveOptions,e=>Promise.resolve(function(e,t){if(!t)return e;const n=t.toLocaleLowerCase().split(/\s+/);return e.filter((e=>n.every((t=>{var n,r;return e.text.toLocaleLowerCase().includes(t)||(null===(n=e.secondaryText)||void 0===n?void 0:n.toLocaleLowerCase().includes(t))||(null===(r=e.value)||void 0===r?void 0:r.toLocaleLowerCase().includes(t))}))))}(u,e)));var u;const a=function(e,t,n){var r;const i=C(t,n);return null===i?null:null!==(r=e.find((e=>e.index===i)))&&void 0!==r?r:null}(r,n,i.openChipPath),c="all"===t.type?"&":"|";return e("limel-popover",{class:"rule-node__chips-popover",open:null!==a,openDirection:"bottom-start",onClose:i.onPopoverClose},e("div",{slot:"trigger",class:"rule-node__chips"},e("limel-picker",{multiple:!0,label:i.translator.get("webclient.rule-editor.rules-label"),value:o,searcher:s,delimiter:c,readonly:i.readonly,disabled:i.disabled,onChange:_(t,n,l,i),onInteract:y(n,l,i)})),e("div",null,function(t,n,r){if(!t)return null;const i=b(n,t.index);return e("limebb-rule-chip-popover",{platform:r.platform,context:r.context,refNode:t.ref,isNegated:t.isNegated,metadata:r.metadataById.get(t.ref.id),readonly:r.readonly,disabled:r.disabled,isMutable:r.isMutable,focusOnOpen:r.focusOnOpen,onNegate:x(t,i,r),onUpdateArgs:O(t,i,r),onDeleteChip:j(i,r)})}(a,n,i)))},_=(e,t,n,r)=>i=>{i.stopPropagation();const l=Array.isArray(i.detail)?i.detail:[],o=C(t,r.openChipPath);if(null!==o){const e=v(o);l.every((t=>t.value!==e))&&r.onPopoverClose()}const s=l.flatMap((e=>{if("string"!=typeof e.value)return[];const t=n.get(e.value);return t?[t.isNegated?{type:"not",rule:t.ref}:t.ref]:[{type:"ref",id:e.value}]})),u=e.rules.filter((e=>null===m(e)));r.onReplaceNode(t,Object.assign(Object.assign({},e),{rules:[...s,...u]}))},y=(e,t,n)=>r=>{r.stopPropagation();const i=function(e){if("string"==typeof e)return e;if(e&&"object"==typeof e&&"value"in e){const t=e.value;return"string"==typeof t?t:void 0}}(r.detail),l=i?t.get(i):void 0;l&&n.onChipInteract([...e,"rules",l.index])},x=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,r.detail?{type:"not",rule:e.ref}:e.ref)},O=(e,t,n)=>r=>{r.stopPropagation();const i=e.isNegated?[...t,"rule"]:t;n.onUpdateArgs(i,r.detail)},j=(e,t)=>()=>{t.onDelete(e)};function C(e,t){if(!t||t.length<2)return null;if(!s((n=t,n.slice(0,-2)),e))return null;var n;const r=t.at(-1);return"number"==typeof r?r:null}const w=({node:t,path:n,isNegated:r,ctx:i})=>{const l=r?[...n,"rule"]:n,o=r?[...u(i.issues,n),...u(i.issues,l)]:u(i.issues,n),s=[],a=[];for(const[e,n]of t.rules.entries()){const t=m(n);t?s.push(Object.assign(Object.assign({},t),{index:e})):a.push({child:n,index:e})}const c=function(e){return[{value:"all",text:e.translator.get("webclient.combinator.all")},{value:"any",text:e.translator.get("webclient.combinator.any")}]}(i),d=c.find((e=>e.value===t.type));return e("div",{class:(h=t.type,f=o,{"rule-node":!0,[`rule-node--${h}`]:!0,"rule-node--invalid":f.length>0}),key:N(n)},e("div",{class:"rule-node__header"},e("limel-select",{class:"rule-node__combinator-select",value:d,options:c,disabled:!i.isMutable,onChange:M(t,n,r,i)}),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__header-actions"},e("limel-switch",{class:"rule-node__negate-switch",label:i.translator.get("webclient.negate"),value:r,onChange:R(t,n,i)}),e("limel-icon-button",{icon:"trash",label:i.translator.get("webclient.rule-editor.delete"),onClick:()=>i.onDelete(n)})):null}(t,n,r,i)),e("div",{class:"rule-node__body"},e(D,{issues:o}),e(g,{groupNode:t,groupPath:l,chipChildren:s,ctx:i}),function(t,n,r){return 0===t.length?null:e("div",{class:"rule-node__children"},t.map((t=>e(z,{node:t.child,path:[...n,"rules",t.index],ctx:r}))))}(a,l,i),function(t,n,r,i){return i.isMutable?e("div",{class:"rule-node__footer"},e("limel-button",{icon:"add",label:i.translator.get("webclient.rule-editor.add-nested-group"),onClick:P(t,n,r,i)})):null}(t,n,r,i)));var h,f};function N(e){return 0===e.length?"root":e.join("/")}function k(e,t,n,r){r.onReplaceNode(t,o(e,n))}const M=(e,t,n,r)=>i=>{i.stopPropagation();const l=i.detail.value;l!==e.type&&k(Object.assign(Object.assign({},e),{type:l}),t,n,r)},P=(e,t,n,r)=>()=>{var i,l;k((i=e,l={type:"all",rules:[]},Object.assign(Object.assign({},i),{rules:[...i.rules,l]})),t,n,r)},R=(e,t,n)=>r=>{r.stopPropagation(),n.onReplaceNode(t,o(e,r.detail))},z=t=>{const{node:n,path:r,ctx:i}=t,l=S(n);return l?e(w,{node:l.node,path:r,isNegated:l.isNegated,ctx:i}):null},A=e=>"not"===e.type&&("all"===e.rule.type||"any"===e.rule.type);function S(e){if("all"===e.type||"any"===e.type)return{node:e,isNegated:!1};if(A(e))return{node:e.rule,isNegated:!0};if("not"===e.type){const t=S(e.rule);if(t)return{node:t.node,isNegated:!t.isNegated}}return null}const D=({issues:t})=>0===t.length?null:t.map((t=>e("div",{class:"rule-node__issue"},t.message)));const I=class{constructor(e){t(this,e),this.change=n(this,"change"),this.issues=[],this.openChipPath=null,this.focusOnOpen=!1,this.metadataById=new Map,this.allPrimitiveOptions=[],this.availablePrimitiveOptions=[],this.reachableSlots=new Set,this.normalizedCache=null,this.hasLoaded=!1,this.handleDelete=e=>{this.openChipPath=null,this.focusOnOpen=!1,this.emitIfChanged(function(e,t){if(0===t.length)return{type:"all",rules:[]};const n=t.slice(0,-1),r=t.at(-1),i=a(e,n);if(void 0===i)return e;if(("all"===i.type||"any"===i.type)&&"number"==typeof r){const t=[...i.rules];return t.splice(r,1),c(e,n,Object.assign(Object.assign({},i),{rules:t}))}return"not"===i.type&&"rule"===r?c(e,n,{type:"all",rules:[]}):e}(this.normalizedValue,e))},this.handleUpdateArgs=(e,t)=>{this.emitIfChanged(function(e,t,n){const r=a(e,t);return void 0===r||"ref"!==r.type?e:c(e,t,Object.assign(Object.assign({},r),{args:n}))}(this.normalizedValue,e,t))},this.handleReplaceNode=(e,t)=>{const n=this.autoOpenPathFor(e,t);this.focusOnOpen=null!==n,null!==n&&(this.openChipPath=n),this.emitIfChanged(function(e,t,n){return c(e,t,n)}(this.normalizedValue,e,t))},this.handleChipInteract=e=>{this.openChipPath=e,this.focusOnOpen=!1},this.handlePopoverClose=()=>{this.openChipPath=null,this.focusOnOpen=!1}}componentWillLoad(){this.rebuildFromRegistries()}rebuildFromRegistries(){this.computeReachableSlots(),this.indexMetadata(),this.rebuildAvailableOptions(),this.runValidation()}connectedCallback(){this.hasLoaded&&(this.computeReachableSlots(),this.rebuildAvailableOptions(),this.runValidation())}componentDidLoad(){this.hasLoaded=!0,this.emitNormalization()}onValueChange(){this.emitNormalization()||this.runValidation()}onAvailableContextsChange(){this.rebuildFromRegistries()}render(){return e("div",{key:"135743195612e7553075236f0dabfbab52331338",class:{"rule-editor":!0,"rule-editor--disabled":this.disabled}},this.renderLabel(),e(z,{key:"4c58eb82dd0fb9c60b24905d6a12b9c2a17f1e52",node:this.normalizedValue,path:[],ctx:this.createRenderContext()}),this.renderHelperText())}renderLabel(){return this.label?e("div",{class:"rule-editor__label"},this.label):null}renderHelperText(){return this.helperText?e("div",{class:"rule-editor__helper-text"},this.helperText):null}createRenderContext(){return{issues:this.issues,metadataById:this.metadataById,allPrimitiveOptions:this.allPrimitiveOptions,availablePrimitiveOptions:this.availablePrimitiveOptions,isMutable:!this.readonly&&!this.disabled,readonly:this.readonly,disabled:this.disabled,platform:this.platform,context:this.effectiveContext,translator:this.translator,openChipPath:this.openChipPath,focusOnOpen:this.focusOnOpen,onDelete:this.handleDelete,onUpdateArgs:this.handleUpdateArgs,onReplaceNode:this.handleReplaceNode,onChipInteract:this.handleChipInteract,onPopoverClose:this.handlePopoverClose}}autoOpenPathFor(e,t){var n;if("all"!==t.type&&"any"!==t.type)return null;const r=a(this.normalizedValue,e);if(void 0===r||"all"!==r.type&&"any"!==r.type)return null;const i=new Set(r.rules.map((e=>{var t;return null===(t=m(e))||void 0===t?void 0:t.ref})).filter((e=>void 0!==e))),l=t.rules.map(((e,t)=>{var n;const r=null===(n=m(e))||void 0===n?void 0:n.ref;return r&&!i.has(r)?{ref:r,index:t}:null})).filter((e=>null!==e));if(1!==l.length)return null;const[{ref:o,index:s}]=l;return(null===(n=this.metadataById.get(o.id))||void 0===n?void 0:n.configComponent)?b(e,s):null}indexMetadata(){var e,t,n;const r=null!==(n=null===(t=(e=this.ruleRegistry).listMetadata)||void 0===t?void 0:t.call(e))&&void 0!==n?n:[];this.metadataById=new Map(r.map((e=>[e.id,e]))),this.allPrimitiveOptions=f(this.metadataById,this.translator)}rebuildAvailableOptions(){this.availablePrimitiveOptions=f(this.availablePrimitiveMetadata(),this.translator)}availablePrimitiveMetadata(){const e=new Map;for(const[t,n]of this.metadataById)p(n,this.reachableSlots)&&e.set(t,n);return e}computeReachableSlots(){var e;const t=this.contextRegistry,n=t.list().map((e=>e.id)).filter((e=>void 0!==t.get(e,this.host)));this.reachableSlots=new Set([...n,...null!==(e=this.availableContexts)&&void 0!==e?e:[]])}runValidation(){if(!this.value)return void(this.issues=[]);const e=this.ruleRegistry.validate(this.normalizedValue,[...this.reachableSlots]);this.issues=e.ok?[]:e.issues}emitIfChanged(e){var t;e!==this.normalizedValue&&this.change.emit("all"!==(t=e).type&&"any"!==t.type?t:0===t.rules.length?void 0:t)}get normalizedValue(){if(null!==this.normalizedCache&&this.normalizedCache.source===this.value)return this.normalizedCache.normalized;const e=(t=this.value)?S(t)?t:{type:"all",rules:[t]}:{type:"all",rules:[]};var t;return this.normalizedCache={source:this.value,normalized:e},e}emitNormalization(){if(!this.value)return!1;const e=this.normalizedValue;return e!==this.value&&(this.change.emit(e),!0)}get ruleRegistry(){return this.platform.get(l.RuleRegistry)}get translator(){return this.platform.get(l.Translate)}get contextRegistry(){return this.platform.get(l.ContextRegistry)}get effectiveContext(){var e,t;return(null===(e=this.context)||void 0===e?void 0:e.limetype)?this.context:(null===(t=this.resolvedContext)||void 0===t?void 0:t.limetype)?this.resolvedContext:V}get host(){return r(this)}static get watchers(){return{value:[{onValueChange:0}],availableContexts:[{onAvailableContextsChange:0}]}}};!function(e,t,n,r){var i,l=arguments.length,o=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(l<3?i(o):l>3?i(t,n,o):i(t,n))||o);l>3&&o&&Object.defineProperty(t,n,o)}([i("context")],I.prototype,"resolvedContext",void 0);const V=Object.freeze({limetype:null,id:null});I.style=":host{display:block}.rule-editor--disabled{opacity:0.6;pointer-events:none}.rule-editor__label{font-size:0.75rem;font-weight:600;color:rgb(var(--contrast-1500));margin-bottom:0.25rem}.rule-editor__helper-text{font-size:0.75rem;color:rgb(var(--contrast-1300));margin-top:0.25rem}.rule-node{border:1px solid rgb(var(--contrast-500));border-radius:0.5rem;margin:0.25rem 0;overflow:hidden;background-color:rgb(var(--contrast-100))}.rule-node--invalid{border-color:rgb(var(--color-red-default))}.rule-node--all>.rule-node__header,.rule-node--any>.rule-node__header{background-color:rgb(var(--contrast-300));padding:0.375rem 0.75rem;border-bottom:1px solid rgb(var(--contrast-500))}.rule-node__header{display:flex;align-items:center;gap:0.5rem}.rule-node__header-actions{margin-left:auto;display:grid;grid-auto-flow:column;grid-gap:0.5rem;padding:0.125rem;align-items:center}.rule-node__combinator-select{min-width:6rem}.rule-node__body{padding:0.75rem;display:flex;flex-direction:column;gap:0.75rem}limel-popover.rule-node__chips-popover{display:contents;--popover-surface-width:min(calc(100vw - 4rem), 50rem)}.rule-node__chips{display:block;width:100%}.rule-node__chips limel-picker{display:block;width:100%}.rule-node__children{display:flex;flex-direction:column;gap:0.5rem}.rule-node__footer{display:flex;justify-content:center}.rule-node__issue{color:rgb(var(--color-red-default));font-size:0.875rem}";export{I as limebb_rule_editor}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as i,H as r}from"./p-COtSgrC5.js";import{n as s}from"./p-Cj_3f9vm.js";import{g as o}from"./p-Cz5s8qGk.js";import{i as n}from"./p-CkTg5UPD.js";import{b as l}from"./p-CKEnwX6j.js";import{i as a,a as d,b as h}from"./p-BgAfMcRA.js";import"./p-CtcTT7BK.js";function c(e){return"string"==typeof e||!d(e)&&a(e)&&"[object String]"==h(e)}const m=class{constructor(i){e(this,i),this.change=t(this,"change"),this.label="Sort Order",this.items=[],this.handleItemChange=e=>t=>{t.stopPropagation();const i=[...this.items];null===t.detail?i.splice(e,1):i[e]=t.detail,this.items=i,this.emitChange()},this.handleAddSortField=()=>{this.items=[...this.items,{"":"ASC"}],this.emitChange()}}componentWillLoad(){this.value&&this.value.length>0&&(this.items=[...this.value])}handleValueChange(e){e&&(e.length!==this.items.length||!e.every(((e,t)=>{const i=this.items[t];if(!i)return!1;const r=Object.keys(e)[0],s=Object.keys(i)[0];return r===s&&e[r]===i[s]})))&&(this.items=e.length>0?[...e]:[])}render(){return i(r,{key:"2b90c0e70b2ec2e55809cecd5141cc52acc400de"},this.renderEmptyState(),this.renderOrderByEditor())}renderEmptyState(){return this.limetype?null:i("div",{class:"empty-state"},i("p",null,"Select a limetype to configure sorting"))}renderOrderByEditor(){return this.limetype?[this.renderHeader(),this.renderOrderByList(),this.renderActions()]:null}renderHeader(){return i("limel-header",{class:"is-narrow",heading:this.label,icon:"sorting_arrows"})}renderOrderByList(){return 0===this.items.length?null:i("div",{class:"order-by-list"},this.items.map(((e,t)=>this.renderItem(e,t))))}renderActions(){return i("limel-button",{label:"Add Sort Field",icon:"plus_math",onClick:this.handleAddSortField})}renderItem(e,t){const r=Object.keys(e)[0]||"";return i("limebb-lime-query-order-by-item",{key:`${r}-${t}`,class:"order-by-item",platform:this.platform,context:this.context,limetype:this.limetype,item:e,onItemChange:this.handleItemChange(t)})}emitChange(){this.change.emit(this.items)}static get watchers(){return{value:[{handleValueChange:0}]}}};m.style=":host(limebb-lime-query-order-by-editor){display:flex;flex-direction:column;gap:1rem;padding:1rem 0}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.order-by-list{display:flex;flex-direction:column;gap:1rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.order-by-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.order-by-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;width:100%}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}limel-header.is-narrow{--header-top-right-left-border-radius:0;width:calc(100% + var(--limebb-lime-query-builder-visual-mode-padding) * 2);margin-left:calc(var(--limebb-lime-query-builder-visual-mode-padding) * -1)}.empty-state{padding:0 2rem;text-align:center;color:rgb(var(--contrast-700))}";const u=["string","text","phone","integer","decimal","percent","time","date","year","quarter","month","yesno","link","user","xml","option","set","file","system"],p=u.filter((e=>"system"!==e));p.push("belongsto","hasone","hasmany","hasandbelongstomany");const b=class{constructor(i){e(this,i),this.change=t(this,"change"),this.propertyFields=[],this.fieldName="limetype",this.handleChange=e=>{e.stopPropagation();let t="";e.detail&&"value"in e.detail&&(t=e.detail.value),this.change.emit(t||void 0)}}componentWillLoad(){const e=this.platform.get(s.Application).getLanguage();this.collator=new Intl.Collator(e,{numeric:!0,sensitivity:"base"})}componentShouldUpdate(e,t,i){var r,s,o,n;return"formInfo"!==i||(o=null===(r=null==e?void 0:e.schema)||void 0===r?void 0:r.oneOf,n=null===(s=null==t?void 0:t.schema)||void 0===s?void 0:s.oneOf,!l(o,n))}render(){var e;const t=this.getLimeTypes().map(g);t.sort(((e,t)=>this.collator.compare(e.text,t.text)));let r=t.find((e=>e.value===this.value)),s=this.invalid;return this.value&&!r&&(s=!0,t.unshift({text:(null===(e=this.limeTypeRepository.getLimeType(this.value))||void 0===e?void 0:e.localname.singular)||this.value,value:this.value}),r=t[0]),t.unshift({text:"",value:""}),i("limel-select",{key:"886b6adf250756fd5170f144e6ff055e70554902",label:this.label,options:t,value:r,required:this.required,helperText:this.helperText,invalid:s,disabled:this.disabled||this.readonly,onChange:this.handleChange})}componentWillRender(){this.updatePropertyFields(this.value||"")}getLimeTypes(){var e,t;let i=this.limetypes;return(null===(t=null===(e=this.formInfo)||void 0===e?void 0:e.schema)||void 0===t?void 0:t.oneOf)&&(i=this.formInfo.schema.oneOf.map((e=>e.const)).filter(c)),i?i.map((e=>this.limeTypeRepository.getLimeType(e))).filter(n):this.limeTypeRepository.getLimeTypes()}updatePropertyFields(e){for(const t of this.propertyFields)t.limetype=e,t.allowedPropertyTypes===u&&(t.allowedPropertyTypes=p)}get limeTypeRepository(){return this.platform.get(s.LimeTypeRepository)}},g=e=>({text:e.localname.singular,value:e.name,icon:o(e)});export{m as limebb_lime_query_order_by_editor,b as limebb_limetype_field}
|