@limetech/lime-crm-building-blocks 1.98.0 → 1.100.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 +14 -0
- package/dist/cjs/{index.esm-a894ac76.js → index.esm-d785eb6e.js} +2 -0
- package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
- package/dist/cjs/limebb-browser.cjs.entry.js +1 -1
- package/dist/cjs/limebb-chat-item_2.cjs.entry.js +1 -1
- package/dist/cjs/limebb-chat-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-component-config.cjs.entry.js +1 -1
- package/dist/cjs/limebb-component-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-currency-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-picker.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-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 +68 -179
- package/dist/cjs/limebb-lime-query-filter-and.cjs.entry.js +80 -0
- package/dist/cjs/{limebb-limetype-field_2.cjs.entry.js → limebb-lime-query-filter-builder_3.cjs.entry.js} +108 -6
- package/dist/cjs/limebb-lime-query-filter-comparison_5.cjs.entry.js +705 -0
- package/dist/cjs/limebb-lime-query-filter-expression.cjs.entry.js +45 -0
- package/dist/cjs/limebb-lime-query-filter-or.cjs.entry.js +68 -0
- package/dist/cjs/limebb-limeobject-file-viewer.cjs.entry.js +1 -1
- package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
- package/dist/cjs/limebb-loader.cjs.entry.js +1 -1
- package/dist/cjs/limebb-locale-picker.cjs.entry.js +2 -2
- package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
- package/dist/cjs/limebb-mention.cjs.entry.js +1 -1
- package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
- package/dist/cjs/limebb-notification-item.cjs.entry.js +2 -2
- package/dist/cjs/limebb-notification-list.cjs.entry.js +1 -1
- package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
- package/dist/cjs/limebb-text-editor.cjs.entry.js +3 -3
- package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
- package/dist/cjs/{limetype-1fe0207f.js → limetype-f2e4376e.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +41 -49
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.css +5 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-builder.js +225 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +77 -41
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +35 -46
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.css +130 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +269 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +19 -25
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +34 -34
- package/dist/collection/components/lime-query-builder/lime-query-builder.js +11 -26
- package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.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/summary-popover/summary-popover.js +3 -3
- 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/components/index.esm.js +2 -1
- package/dist/components/lime-query-filter-builder.js +129 -0
- package/dist/components/lime-query-filter-comparison.js +32 -45
- package/dist/components/lime-query-filter-expression.js +315 -0
- package/dist/components/limebb-lime-query-builder.js +73 -182
- package/dist/components/limebb-lime-query-filter-and.js +130 -1
- package/dist/components/limebb-lime-query-filter-builder.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-builder.js +6 -0
- package/dist/components/limebb-lime-query-filter-comparison.js +1 -1
- package/dist/components/limebb-lime-query-filter-expression.js +1 -1
- package/dist/components/limebb-lime-query-filter-group.d.ts +11 -0
- package/dist/components/limebb-lime-query-filter-group.js +6 -0
- package/dist/components/limebb-lime-query-filter-not.js +1 -1
- package/dist/components/limebb-lime-query-filter-or.js +118 -1
- package/dist/components/limebb-locale-picker.js +1 -1
- package/dist/components/limebb-mention-group-counter.js +2 -2
- package/dist/components/limebb-percentage-visualizer.js +2 -2
- package/dist/components/limebb-text-editor.js +1 -1
- package/dist/components/limebb-trend-indicator.js +1 -1
- package/dist/components/limetype-field.js +34 -2
- package/dist/components/live-docs-info.js +2 -2
- package/dist/components/notification-item.js +1 -1
- package/dist/components/summary-popover.js +3 -3
- package/dist/esm/{index.esm-d8fdeb18.js → index.esm-bb569663.js} +2 -1
- package/dist/esm/lime-crm-building-blocks.js +1 -1
- package/dist/esm/limebb-browser.entry.js +1 -1
- package/dist/esm/limebb-chat-item_2.entry.js +1 -1
- package/dist/esm/limebb-chat-list.entry.js +1 -1
- package/dist/esm/limebb-component-config.entry.js +1 -1
- package/dist/esm/limebb-component-picker.entry.js +1 -1
- package/dist/esm/limebb-currency-picker.entry.js +1 -1
- package/dist/esm/limebb-date-picker.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-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 +67 -178
- package/dist/esm/limebb-lime-query-filter-and.entry.js +76 -0
- package/dist/esm/{limebb-limetype-field_2.entry.js → limebb-lime-query-filter-builder_3.entry.js} +107 -6
- package/dist/esm/limebb-lime-query-filter-comparison_5.entry.js +697 -0
- package/dist/esm/limebb-lime-query-filter-expression.entry.js +41 -0
- package/dist/esm/limebb-lime-query-filter-or.entry.js +64 -0
- package/dist/esm/limebb-limeobject-file-viewer.entry.js +1 -1
- package/dist/esm/limebb-live-docs-info.entry.js +2 -2
- package/dist/esm/limebb-loader.entry.js +1 -1
- package/dist/esm/limebb-locale-picker.entry.js +2 -2
- package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
- package/dist/esm/limebb-mention.entry.js +1 -1
- package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
- package/dist/esm/limebb-notification-item.entry.js +2 -2
- package/dist/esm/limebb-notification-list.entry.js +1 -1
- package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
- package/dist/esm/limebb-text-editor.entry.js +3 -3
- package/dist/esm/limebb-trend-indicator.entry.js +1 -1
- package/dist/esm/{limetype-6e7552a7.js → limetype-c0e041f7.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/{p-a1818969.entry.js → p-03af0e66.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f402184f.entry.js → p-098ee6c1.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-42e52b50.entry.js → p-1be0eec7.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-2aa18c2b.entry.js → p-206575e4.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-20bfca36.js +1 -0
- package/dist/lime-crm-building-blocks/p-24aeb928.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-82d33d43.entry.js → p-2faaacbc.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-d4016891.entry.js → p-2fdcb868.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-f52125a0.entry.js → p-3122ea05.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-baf4e428.entry.js → p-3175883d.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-8c8b7115.entry.js → p-32534eb7.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-6c1146ca.entry.js → p-36ea13c0.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-422f6d51.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-1fba0ade.js → p-4838284a.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-5e4ba110.entry.js → p-5464f0de.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-e9d23ef7.entry.js → p-569c86b5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-90e1716a.entry.js → p-5dc574a3.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-00da9b24.entry.js → p-631ca5a5.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-67dbaa4c.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-6d119dab.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-beb0d164.entry.js → p-7271f47a.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-34357744.entry.js → p-9031f136.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-91732502.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-8c4eb49f.entry.js → p-93cadc1e.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3932077b.entry.js → p-9cac4de2.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-79d4668a.entry.js → p-a200954f.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-b198194a.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-d89c44ad.entry.js → p-b9b954d9.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-3a620226.entry.js → p-cfa1a4ad.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-ef8a5266.entry.js → p-e8946134.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-9d9f25da.entry.js → p-eb81bceb.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/{p-50d3d61a.entry.js → p-ee1b00b9.entry.js} +1 -1
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +5 -4
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-builder.d.ts +50 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +6 -4
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-expression.d.ts +10 -14
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-group.d.ts +60 -0
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-not.d.ts +4 -4
- package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +5 -4
- package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +1 -0
- package/dist/types/components/lime-query-builder/lime-query.types.d.ts +2 -1
- package/dist/types/components.d.ts +293 -65
- package/package.json +1 -1
- package/dist/cjs/isEqual-e77cce75.js +0 -37
- package/dist/cjs/lime-query.types-bcb63a22.js +0 -61
- package/dist/cjs/limebb-lime-query-filter-and_5.cjs.entry.js +0 -278
- package/dist/cjs/limebb-lime-query-value-input.cjs.entry.js +0 -239
- package/dist/cjs/limebb-property-selector.cjs.entry.js +0 -234
- package/dist/components/isEqual.js +0 -35
- package/dist/components/lime-query-filter-and.js +0 -408
- package/dist/esm/isEqual-57d0c223.js +0 -35
- package/dist/esm/lime-query.types-f72355e1.js +0 -59
- package/dist/esm/limebb-lime-query-filter-and_5.entry.js +0 -270
- package/dist/esm/limebb-lime-query-value-input.entry.js +0 -235
- package/dist/esm/limebb-property-selector.entry.js +0 -230
- package/dist/lime-crm-building-blocks/p-02c0cc04.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-0957b2a6.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-3b0a15ec.js +0 -1
- package/dist/lime-crm-building-blocks/p-5a6d2e7f.js +0 -1
- package/dist/lime-crm-building-blocks/p-60971d64.js +0 -1
- package/dist/lime-crm-building-blocks/p-70a28b93.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-96beaabc.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-f99c611d.entry.js +0 -1
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ff255a0d.js');
|
|
6
|
+
const index_esm = require('./index.esm-d785eb6e.js');
|
|
7
|
+
const propertyResolution = require('./property-resolution-fb42a46b.js');
|
|
8
|
+
|
|
9
|
+
const limeQueryFilterComparisonCss = ".expression-container{display:flex;flex-direction:row;align-items:flex-start;gap:1rem;flex-wrap:wrap}.expression-container>*{flex-grow:2;width:30%;max-width:calc(100% - 3.25rem)}.expression-container>.operator{flex-grow:1;width:calc(30% + 1rem);min-width:4rem}.expression-container>.remove{flex-grow:0;width:auto;margin-left:auto}@media (max-width: 768px){.expression-container{flex-direction:column}.expression-container>*{width:100%;max-width:100%}.expression-container>.operator{width:100%}.expression-container>.remove{margin-left:0;align-self:flex-end}}";
|
|
10
|
+
const LimebbLimeQueryFilterComparisonStyle0 = limeQueryFilterComparisonCss;
|
|
11
|
+
|
|
12
|
+
const LIME_QUERY_OPERATORS = [
|
|
13
|
+
{ value: index_esm.Zt.EQUALS, label: 'Equals', icon: 'equals' },
|
|
14
|
+
{ value: index_esm.Zt.NOT_EQUALS, label: 'Not Equals', icon: 'not-equal' },
|
|
15
|
+
{
|
|
16
|
+
value: index_esm.Zt.GREATER,
|
|
17
|
+
label: 'Greater Than',
|
|
18
|
+
icon: 'greater-than',
|
|
19
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: index_esm.Zt.GREATER_OR_EQUAL,
|
|
23
|
+
label: 'Greater or Equal',
|
|
24
|
+
icon: 'greater-or-equal',
|
|
25
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
value: index_esm.Zt.LESS,
|
|
29
|
+
label: 'Less Than',
|
|
30
|
+
icon: 'less-than',
|
|
31
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: index_esm.Zt.LESS_OR_EQUAL,
|
|
35
|
+
label: 'Less or Equal',
|
|
36
|
+
icon: 'less-or-equal',
|
|
37
|
+
applicableTypes: ['integer', 'decimal', 'date', 'time'],
|
|
38
|
+
},
|
|
39
|
+
{ value: index_esm.Zt.IN, label: 'In List', icon: 'list' },
|
|
40
|
+
{
|
|
41
|
+
value: index_esm.Zt.LIKE,
|
|
42
|
+
label: 'Contains',
|
|
43
|
+
icon: '-lime-filter-contain',
|
|
44
|
+
applicableTypes: ['string', 'text'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: index_esm.Zt.BEGINS,
|
|
48
|
+
label: 'Begins With',
|
|
49
|
+
icon: '-lime-filter-begin',
|
|
50
|
+
applicableTypes: ['string', 'text'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: index_esm.Zt.ENDS,
|
|
54
|
+
label: 'Ends With',
|
|
55
|
+
icon: '-lime-filter-end',
|
|
56
|
+
applicableTypes: ['string', 'text'],
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
const LimeQueryFilterComparisonComponent = class {
|
|
60
|
+
constructor(hostRef) {
|
|
61
|
+
index.registerInstance(this, hostRef);
|
|
62
|
+
this.expressionChange = index.createEvent(this, "expressionChange", 7);
|
|
63
|
+
this.handlePropertyChange = (event) => {
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { key: event.detail }));
|
|
66
|
+
};
|
|
67
|
+
this.handleOperatorChange = (event) => {
|
|
68
|
+
event.stopPropagation();
|
|
69
|
+
// TODO: Clear value when switching between IN and other operators
|
|
70
|
+
// since array values are incompatible with single-value operators
|
|
71
|
+
this.expressionChange.emit({
|
|
72
|
+
key: this.expression.key,
|
|
73
|
+
op: event.detail.value,
|
|
74
|
+
exp: this.expression.exp,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
this.handleValueChange = (event) => {
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
this.expressionChange.emit(Object.assign(Object.assign({}, this.expression), { exp: event.detail }));
|
|
80
|
+
};
|
|
81
|
+
this.removeExpression = () => {
|
|
82
|
+
this.expressionChange.emit(undefined);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
return (index.h("div", { key: '668e0f05bdb1fb25ffd652ea650c34e5431a3332', class: "expression" }, this.label && index.h("limel-header", { key: '5034070b58afe31cf90699dd2a27f884e647f540', heading: this.label }), index.h("div", { key: '14a2b1270e5e6d7e158e29ebc5f61051e5670e80', class: "expression-container" }, this.renderPropertySelector(), this.renderOperator(), this.renderValueInput(), index.h("limel-icon-button", { key: 'b69bde6e88c40d2623ef015794db28cec3676c73', class: "remove", icon: "trash", label: "Remove condition", onClick: this.removeExpression }))));
|
|
87
|
+
}
|
|
88
|
+
renderPropertySelector() {
|
|
89
|
+
return (index.h("limebb-property-selector", { platform: this.platform, context: this.context, label: "Property", limetype: this.limetype, value: this.expression.key, required: true, onChange: this.handlePropertyChange }));
|
|
90
|
+
}
|
|
91
|
+
renderOperator() {
|
|
92
|
+
const operatorHasBeenSet = !!this.expression.op;
|
|
93
|
+
const options = LIME_QUERY_OPERATORS.map((op) => ({
|
|
94
|
+
text: op.label,
|
|
95
|
+
value: op.value,
|
|
96
|
+
icon: op.icon ? { name: op.icon } : undefined,
|
|
97
|
+
}));
|
|
98
|
+
const selectedOption = options.find((o) => o.value === this.expression.op);
|
|
99
|
+
return (index.h("limel-select", { class: "operator", label: "Operator", value: selectedOption, options: options, disabled: !operatorHasBeenSet && !this.expression.key, onChange: this.handleOperatorChange }));
|
|
100
|
+
}
|
|
101
|
+
renderValueInput() {
|
|
102
|
+
if (!this.expression.op) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return (index.h("limebb-lime-query-value-input", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, propertyPath: this.expression.key, operator: this.expression.op, value: this.expression.exp, onChange: this.handleValueChange }));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
LimeQueryFilterComparisonComponent.style = LimebbLimeQueryFilterComparisonStyle0;
|
|
109
|
+
|
|
110
|
+
const limeQueryFilterGroupCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:0;background-color:rgb(var(--contrast-100));border:1px solid rgb(var(--contrast-500));border-radius:0.75rem}.expression .clickable-header{cursor:pointer;user-select:none}.expression .clickable-header:hover{background-color:rgb(var(--contrast-200))}.expression>ul{margin-top:0;margin-right:1rem;margin-bottom:1rem;margin-left:1rem;padding-left:1rem;list-style:disc}.expression>ul li{margin-top:1rem}.expression>ul li.add-button{list-style:none;display:flex;gap:0.5rem}";
|
|
111
|
+
const LimebbLimeQueryFilterGroupStyle0 = limeQueryFilterGroupCss;
|
|
112
|
+
|
|
113
|
+
const LimeQueryFilterGroupComponent = class {
|
|
114
|
+
constructor(hostRef) {
|
|
115
|
+
index.registerInstance(this, hostRef);
|
|
116
|
+
this.expressionChange = index.createEvent(this, "expressionChange", 7);
|
|
117
|
+
this.renderChildExpression = (expression, childIndex) => (index.h("li", null, index.h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
118
|
+
this.handleToggleOperator = () => {
|
|
119
|
+
const newOperator = this.expression.op === index_esm.Zt.AND ? index_esm.Zt.OR : index_esm.Zt.AND;
|
|
120
|
+
this.expressionChange.emit({
|
|
121
|
+
op: newOperator,
|
|
122
|
+
exp: this.expression.exp,
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
this.handleAddChildExpression = () => {
|
|
126
|
+
// Always add a new comparison directly to the list
|
|
127
|
+
const newChild = {
|
|
128
|
+
key: '',
|
|
129
|
+
op: index_esm.Zt.EQUALS,
|
|
130
|
+
exp: '',
|
|
131
|
+
};
|
|
132
|
+
this.expressionChange.emit({
|
|
133
|
+
op: this.expression.op,
|
|
134
|
+
exp: [...this.expression.exp, newChild],
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
this.handleAddChildGroup = () => {
|
|
138
|
+
// Add a nested group of the opposite type
|
|
139
|
+
const oppositeOp = this.expression.op === index_esm.Zt.AND ? index_esm.Zt.OR : index_esm.Zt.AND;
|
|
140
|
+
const newChild = {
|
|
141
|
+
op: oppositeOp,
|
|
142
|
+
exp: [
|
|
143
|
+
{
|
|
144
|
+
key: '',
|
|
145
|
+
op: index_esm.Zt.EQUALS,
|
|
146
|
+
exp: '',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
};
|
|
150
|
+
this.expressionChange.emit({
|
|
151
|
+
op: this.expression.op,
|
|
152
|
+
exp: [...this.expression.exp, newChild],
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
this.handleExpressionChange = (updatedChildIndex) => (event) => {
|
|
156
|
+
event.stopPropagation();
|
|
157
|
+
const updatedExpression = event.detail;
|
|
158
|
+
const expressions = [...this.expression.exp];
|
|
159
|
+
if (updatedExpression === undefined) {
|
|
160
|
+
// Deletion - remove the child and potentially unwrap
|
|
161
|
+
expressions.splice(updatedChildIndex, 1);
|
|
162
|
+
if (expressions.length === 0) {
|
|
163
|
+
this.expressionChange.emit(undefined);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (expressions.length === 1) {
|
|
167
|
+
// Unwrap when only one child remains after deletion
|
|
168
|
+
this.expressionChange.emit(expressions[0]);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
// Update - replace the child, don't unwrap
|
|
174
|
+
expressions[updatedChildIndex] = updatedExpression;
|
|
175
|
+
}
|
|
176
|
+
this.expressionChange.emit({
|
|
177
|
+
op: this.expression.op,
|
|
178
|
+
exp: expressions,
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
render() {
|
|
183
|
+
const subheading = this.getSubheading();
|
|
184
|
+
return (index.h("div", { key: '43a1d99fd896e3ad49dd97594e54bccaf74c3aa0', class: "expression" }, subheading && (index.h("limel-header", { key: '534eb0a3db2f0194e8a28e2fb071beb545f38458', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), index.h("ul", { key: '9d29d98ab034bf2878e7dc19828bc045dbdd492f' }, this.expression.exp.map(this.renderChildExpression), index.h("li", { key: '44b266c8aeb390b8a68b3e08a51a0760a6421f93', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
|
|
185
|
+
}
|
|
186
|
+
getSubheading() {
|
|
187
|
+
if (this.expression.exp.length <= 1) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
return this.expression.op === index_esm.Zt.AND
|
|
191
|
+
? 'All of these conditions are true'
|
|
192
|
+
: 'Any of these conditions are true';
|
|
193
|
+
}
|
|
194
|
+
renderAddButton() {
|
|
195
|
+
const label = this.getAddButtonLabel();
|
|
196
|
+
return (index.h("limel-button", { label: label, icon: "plus_math", onClick: this.handleAddChildExpression }));
|
|
197
|
+
}
|
|
198
|
+
renderAddGroupButton() {
|
|
199
|
+
const label = this.getAddGroupButtonLabel();
|
|
200
|
+
return (index.h("limel-button", { label: label, icon: "tree_structure", onClick: this.handleAddChildGroup }));
|
|
201
|
+
}
|
|
202
|
+
getAddButtonLabel() {
|
|
203
|
+
const isAnd = this.expression.op === index_esm.Zt.AND;
|
|
204
|
+
if (this.expression.exp.length === 0) {
|
|
205
|
+
return 'Add a condition';
|
|
206
|
+
}
|
|
207
|
+
return isAnd ? 'Add another condition' : 'Add alternative';
|
|
208
|
+
}
|
|
209
|
+
getAddGroupButtonLabel() {
|
|
210
|
+
const isAnd = this.expression.op === index_esm.Zt.AND;
|
|
211
|
+
if (this.expression.exp.length === 0) {
|
|
212
|
+
return 'Add a group';
|
|
213
|
+
}
|
|
214
|
+
return isAnd ? 'Add another group' : 'Add alternative group';
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
LimeQueryFilterGroupComponent.style = LimebbLimeQueryFilterGroupStyle0;
|
|
218
|
+
|
|
219
|
+
const limeQueryFilterNotCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem;padding:1rem;border-left:0.25rem solid rgb(var(--contrast-400));background-color:rgb(var(--contrast-100))}";
|
|
220
|
+
const LimebbLimeQueryFilterNotStyle0 = limeQueryFilterNotCss;
|
|
221
|
+
|
|
222
|
+
const LimeQueryFilterNotComponent = class {
|
|
223
|
+
constructor(hostRef) {
|
|
224
|
+
index.registerInstance(this, hostRef);
|
|
225
|
+
this.expressionChange = index.createEvent(this, "expressionChange", 7);
|
|
226
|
+
this.handleExpressionChange = (event) => {
|
|
227
|
+
var _a;
|
|
228
|
+
event.stopPropagation();
|
|
229
|
+
const updatedExpression = (_a = event.detail) !== null && _a !== void 0 ? _a : undefined;
|
|
230
|
+
if (updatedExpression === undefined) {
|
|
231
|
+
this.expressionChange.emit(undefined);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this.expressionChange.emit({
|
|
235
|
+
op: index_esm.Zt.NOT,
|
|
236
|
+
exp: updatedExpression,
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
render() {
|
|
241
|
+
return (index.h("div", { key: 'f1dfd7fd4ec7dc1873841d1c8b3d2bb6677634fd', class: "expression" }, this.label && index.h("limel-header", { key: '91e1b754f6e45c70f49bf2a770898a590defaf22', heading: this.label }), index.h("limebb-lime-query-filter-expression", { key: 'bf42f3c71521a413e5ecc49a8e0d6401b34384a2', platform: this.platform, context: this.context, label: "Not", limetype: this.limetype, activeLimetype: this.activeLimetype, expression: this.expression.exp, onExpressionChange: this.handleExpressionChange })));
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
LimeQueryFilterNotComponent.style = LimebbLimeQueryFilterNotStyle0;
|
|
245
|
+
|
|
246
|
+
const limeQueryValueInputCss = ":host{display:block}.value-input-container{display:flex;flex-direction:row;align-items:flex-start;gap:0.5rem;width:100%}.mode-toggle{flex-shrink:0;margin-top:0.5rem;opacity:0.7;transition:opacity 0.2s ease}.mode-toggle:hover{opacity:1}.placeholder-input{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}.placeholder-preview{display:flex;align-items:center;gap:0.5rem;padding:0.5rem;background-color:rgba(var(--color-blue-light), 0.1);border-radius:var(--border-radius-small);font-size:0.875rem;color:rgb(var(--color-blue-default));border-left:3px solid rgb(var(--color-blue-default))}.placeholder-preview limel-icon{flex-shrink:0;color:rgb(var(--color-blue-default))}.placeholder-preview span{font-family:var(--font-monospace);word-break:break-all}";
|
|
247
|
+
const LimebbLimeQueryValueInputStyle0 = limeQueryValueInputCss;
|
|
248
|
+
|
|
249
|
+
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
250
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
251
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
252
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
253
|
+
else
|
|
254
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
255
|
+
if (d = decorators[i])
|
|
256
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
257
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
258
|
+
};
|
|
259
|
+
const LimeQueryValueInput = class {
|
|
260
|
+
constructor(hostRef) {
|
|
261
|
+
index.registerInstance(this, hostRef);
|
|
262
|
+
this.change = index.createEvent(this, "change", 7);
|
|
263
|
+
/**
|
|
264
|
+
* Optional label for the input
|
|
265
|
+
*/
|
|
266
|
+
this.label = 'Value';
|
|
267
|
+
this.inputMode = 'value';
|
|
268
|
+
this.handleTextChange = (event) => {
|
|
269
|
+
event.stopPropagation();
|
|
270
|
+
// Try to parse as number for number inputs
|
|
271
|
+
const value = event.detail;
|
|
272
|
+
const numValue = Number(value);
|
|
273
|
+
if (!Number.isNaN(numValue) && value !== '') {
|
|
274
|
+
this.change.emit(numValue);
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
this.change.emit(value);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
this.handleSelectChange = (event) => {
|
|
281
|
+
event.stopPropagation();
|
|
282
|
+
const detail = event.detail;
|
|
283
|
+
if (Array.isArray(detail)) {
|
|
284
|
+
this.change.emit(detail.map((o) => o.value));
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
this.change.emit(detail === null || detail === void 0 ? void 0 : detail.value);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
this.handleBooleanChange = (event) => {
|
|
291
|
+
event.stopPropagation();
|
|
292
|
+
const detail = event.detail;
|
|
293
|
+
if (!Array.isArray(detail)) {
|
|
294
|
+
// Convert string back to boolean
|
|
295
|
+
this.change.emit((detail === null || detail === void 0 ? void 0 : detail.value) === 'true');
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
this.handleDateChange = (event) => {
|
|
299
|
+
event.stopPropagation();
|
|
300
|
+
// Convert Date to ISO string for storage
|
|
301
|
+
const date = event.detail;
|
|
302
|
+
this.change.emit(date ? date.toISOString() : null);
|
|
303
|
+
};
|
|
304
|
+
this.handleMultiValueChange = (event) => {
|
|
305
|
+
event.stopPropagation();
|
|
306
|
+
// Split by comma and trim whitespace
|
|
307
|
+
const values = event.detail
|
|
308
|
+
.split(',')
|
|
309
|
+
.map((v) => v.trim())
|
|
310
|
+
.filter((v) => v.length > 0);
|
|
311
|
+
this.change.emit(values);
|
|
312
|
+
};
|
|
313
|
+
this.handleModeToggle = () => {
|
|
314
|
+
if (this.inputMode === 'value') {
|
|
315
|
+
// Switching to placeholder mode
|
|
316
|
+
this.inputMode = 'placeholder';
|
|
317
|
+
// Emit placeholder value (empty initially)
|
|
318
|
+
this.change.emit('%activeObject%');
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
// Switching to value mode
|
|
322
|
+
this.inputMode = 'value';
|
|
323
|
+
// Emit empty value
|
|
324
|
+
this.change.emit('');
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
this.handlePlaceholderPropertyChange = (event) => {
|
|
328
|
+
event.stopPropagation();
|
|
329
|
+
const propertyPath = event.detail;
|
|
330
|
+
const placeholderValue = this.buildPlaceholderValue(propertyPath);
|
|
331
|
+
this.change.emit(placeholderValue);
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
componentWillLoad() {
|
|
335
|
+
// Detect if the current value is a placeholder
|
|
336
|
+
if (this.isPlaceholder(this.value)) {
|
|
337
|
+
this.inputMode = 'placeholder';
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
componentWillUpdate() {
|
|
341
|
+
// Update mode if value changes externally
|
|
342
|
+
if (this.isPlaceholder(this.value) &&
|
|
343
|
+
this.inputMode !== 'placeholder') {
|
|
344
|
+
this.inputMode = 'placeholder';
|
|
345
|
+
}
|
|
346
|
+
else if (!this.isPlaceholder(this.value) &&
|
|
347
|
+
this.inputMode === 'placeholder') {
|
|
348
|
+
this.inputMode = 'value';
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
isPlaceholder(value) {
|
|
352
|
+
return typeof value === 'string' && value.startsWith('%activeObject%');
|
|
353
|
+
}
|
|
354
|
+
parsePlaceholderPath(value) {
|
|
355
|
+
if (!this.isPlaceholder(value)) {
|
|
356
|
+
return '';
|
|
357
|
+
}
|
|
358
|
+
// Extract path after %activeObject%. (e.g., "%activeObject%.company.name" → "company.name")
|
|
359
|
+
return value.replace(/^%activeObject%\.?/, '');
|
|
360
|
+
}
|
|
361
|
+
buildPlaceholderValue(propertyPath) {
|
|
362
|
+
if (!propertyPath) {
|
|
363
|
+
return '%activeObject%';
|
|
364
|
+
}
|
|
365
|
+
return `%activeObject%.${propertyPath}`;
|
|
366
|
+
}
|
|
367
|
+
render() {
|
|
368
|
+
if (!this.operator) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
return (index.h("div", { class: "value-input-container" }, this.renderModeToggle(), this.inputMode === 'placeholder'
|
|
372
|
+
? this.renderPlaceholderInput()
|
|
373
|
+
: this.renderValueInputByType()));
|
|
374
|
+
}
|
|
375
|
+
renderModeToggle() {
|
|
376
|
+
// Only show toggle if activeLimetype is set
|
|
377
|
+
if (!this.activeLimetype) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
const isPlaceholderMode = this.inputMode === 'placeholder';
|
|
381
|
+
const buttonLabel = isPlaceholderMode ? 'Use Value' : 'Use Placeholder';
|
|
382
|
+
const buttonIcon = isPlaceholderMode ? 'text' : 'link';
|
|
383
|
+
return (index.h("limel-icon-button", { class: "mode-toggle", icon: buttonIcon, label: buttonLabel, onClick: this.handleModeToggle }));
|
|
384
|
+
}
|
|
385
|
+
renderPlaceholderInput() {
|
|
386
|
+
const propertyPath = this.parsePlaceholderPath(this.value);
|
|
387
|
+
return (index.h("div", { class: "placeholder-input" }, index.h("limebb-property-selector", { platform: this.platform, context: this.context, limetype: this.activeLimetype, label: "Active Object Property", value: propertyPath, required: false, helperText: "Select property from the active object", onChange: this.handlePlaceholderPropertyChange }), this.isPlaceholder(this.value) && (index.h("div", { class: "placeholder-preview" }, index.h("limel-icon", { name: "info", size: "small" }), index.h("span", null, "Placeholder: ", this.value)))));
|
|
388
|
+
}
|
|
389
|
+
renderValueInputByType() {
|
|
390
|
+
// Special handling for IN operator - always use chip set for arrays
|
|
391
|
+
if (this.operator === 'IN') {
|
|
392
|
+
return this.renderMultiValueInput();
|
|
393
|
+
}
|
|
394
|
+
const property = this.getProperty();
|
|
395
|
+
if (!property) {
|
|
396
|
+
return this.renderTextInput();
|
|
397
|
+
}
|
|
398
|
+
switch (property.type) {
|
|
399
|
+
case 'integer':
|
|
400
|
+
case 'decimal': {
|
|
401
|
+
return this.renderNumberInput(property.type);
|
|
402
|
+
}
|
|
403
|
+
case 'yesno': {
|
|
404
|
+
return this.renderBooleanInput();
|
|
405
|
+
}
|
|
406
|
+
case 'option': {
|
|
407
|
+
return this.renderOptionInput(property);
|
|
408
|
+
}
|
|
409
|
+
case 'date': {
|
|
410
|
+
return this.renderDateInput();
|
|
411
|
+
}
|
|
412
|
+
case 'time': {
|
|
413
|
+
return this.renderTimeInput();
|
|
414
|
+
}
|
|
415
|
+
default: {
|
|
416
|
+
return this.renderTextInput();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
renderTextInput() {
|
|
421
|
+
var _a;
|
|
422
|
+
return (index.h("limel-input-field", { label: this.label, value: ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) || '', placeholder: "Enter value", onChange: this.handleTextChange }));
|
|
423
|
+
}
|
|
424
|
+
renderNumberInput(type) {
|
|
425
|
+
var _a;
|
|
426
|
+
const step = type === 'integer' ? 1 : 0.01;
|
|
427
|
+
return (index.h("limel-input-field", { label: this.label, type: "number", value: ((_a = this.value) === null || _a === void 0 ? void 0 : _a.toString()) || '', step: step, onChange: this.handleTextChange }));
|
|
428
|
+
}
|
|
429
|
+
renderBooleanInput() {
|
|
430
|
+
const options = [
|
|
431
|
+
{ text: 'True', value: 'true' },
|
|
432
|
+
{ text: 'False', value: 'false' },
|
|
433
|
+
];
|
|
434
|
+
const valueAsString = this.value === true || this.value === 'true' ? 'true' : 'false';
|
|
435
|
+
const selectedOption = options.find((o) => o.value === valueAsString);
|
|
436
|
+
return (index.h("limel-select", { label: this.label, options: options, value: selectedOption, onChange: this.handleBooleanChange }));
|
|
437
|
+
}
|
|
438
|
+
renderOptionInput(property) {
|
|
439
|
+
if (!property.options || property.options.length === 0) {
|
|
440
|
+
return this.renderTextInput();
|
|
441
|
+
}
|
|
442
|
+
const options = property.options.map((opt) => ({
|
|
443
|
+
text: opt.text || opt.key,
|
|
444
|
+
value: opt.key,
|
|
445
|
+
}));
|
|
446
|
+
const selectedOption = options.find((o) => o.value === this.value);
|
|
447
|
+
return (index.h("limel-select", { label: this.label, options: options, value: selectedOption, onChange: this.handleSelectChange }));
|
|
448
|
+
}
|
|
449
|
+
renderDateInput() {
|
|
450
|
+
// Convert string to Date if needed
|
|
451
|
+
const dateValue = typeof this.value === 'string' ? new Date(this.value) : this.value;
|
|
452
|
+
return (index.h("limel-date-picker", { label: this.label, value: dateValue, onChange: this.handleDateChange }));
|
|
453
|
+
}
|
|
454
|
+
renderTimeInput() {
|
|
455
|
+
return (index.h("limel-input-field", { label: this.label, type: "time", value: this.value || '', onChange: this.handleTextChange }));
|
|
456
|
+
}
|
|
457
|
+
renderMultiValueInput() {
|
|
458
|
+
// For IN operator, allow comma-separated values
|
|
459
|
+
const displayValue = Array.isArray(this.value)
|
|
460
|
+
? this.value.join(', ')
|
|
461
|
+
: this.value || '';
|
|
462
|
+
return (index.h("limel-input-field", { label: this.label + ' (comma-separated)', value: displayValue, placeholder: "e.g., won, lost, tender", onChange: this.handleMultiValueChange }));
|
|
463
|
+
}
|
|
464
|
+
getProperty() {
|
|
465
|
+
if (!this.limetypes || !this.limetype || !this.propertyPath) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
return propertyResolution.getPropertyFromPath(this.limetypes, this.limetype, this.propertyPath);
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
__decorate$1([
|
|
472
|
+
index_esm.Te()
|
|
473
|
+
], LimeQueryValueInput.prototype, "limetypes", void 0);
|
|
474
|
+
LimeQueryValueInput.style = LimebbLimeQueryValueInputStyle0;
|
|
475
|
+
|
|
476
|
+
const propertySelectorCss = ":host(limebb-property-selector){display:block}limel-menu{display:block;width:100%}";
|
|
477
|
+
const LimebbPropertySelectorStyle0 = propertySelectorCss;
|
|
478
|
+
|
|
479
|
+
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
480
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
481
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
482
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
483
|
+
else
|
|
484
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
485
|
+
if (d = decorators[i])
|
|
486
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
487
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
488
|
+
};
|
|
489
|
+
const PropertySelector = class {
|
|
490
|
+
constructor(hostRef) {
|
|
491
|
+
index.registerInstance(this, hostRef);
|
|
492
|
+
this.change = index.createEvent(this, "change", 7);
|
|
493
|
+
/**
|
|
494
|
+
* Label for the input
|
|
495
|
+
*/
|
|
496
|
+
this.label = 'Property';
|
|
497
|
+
/**
|
|
498
|
+
* Whether the field is required
|
|
499
|
+
*/
|
|
500
|
+
this.required = false;
|
|
501
|
+
this.isOpen = false;
|
|
502
|
+
this.navigationPath = '';
|
|
503
|
+
this.menuItems = [];
|
|
504
|
+
this.handleChipSetWrapperClick = (event) => {
|
|
505
|
+
// Stop all clicks on the chip-set from bubbling
|
|
506
|
+
// This prevents the menu from opening when clicking chip remove buttons
|
|
507
|
+
event.stopPropagation();
|
|
508
|
+
};
|
|
509
|
+
this.handleChipSetFocus = () => {
|
|
510
|
+
// Open menu when the chip-set input receives focus
|
|
511
|
+
// This happens when user clicks to type/edit
|
|
512
|
+
if (!this.isOpen) {
|
|
513
|
+
this.navigationPath = this.value || '';
|
|
514
|
+
this.loadMenuItems();
|
|
515
|
+
this.isOpen = true;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
this.handleSelect = (event) => {
|
|
519
|
+
event.stopPropagation();
|
|
520
|
+
const selectedPath = event.detail.value;
|
|
521
|
+
if (!selectedPath) {
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
// Check if this is a complete path (leaf property, not a relation)
|
|
525
|
+
const property = propertyResolution.getPropertyFromPath(this.limetypes, this.limetype, selectedPath);
|
|
526
|
+
if (property === null || property === void 0 ? void 0 : property.relation) {
|
|
527
|
+
// This is a relation - update navigation but don't emit
|
|
528
|
+
this.navigationPath = selectedPath;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
// This is a leaf property - emit and close
|
|
532
|
+
this.change.emit(selectedPath);
|
|
533
|
+
this.isOpen = false;
|
|
534
|
+
this.navigationPath = '';
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
this.handleNavigateMenu = (event) => {
|
|
538
|
+
var _a;
|
|
539
|
+
event.stopPropagation();
|
|
540
|
+
if ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.value) {
|
|
541
|
+
// Update navigation path when drilling down
|
|
542
|
+
this.navigationPath = event.detail.value;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
this.handleCancel = () => {
|
|
546
|
+
this.isOpen = false;
|
|
547
|
+
this.navigationPath = '';
|
|
548
|
+
};
|
|
549
|
+
this.handleChipSetChange = (event) => {
|
|
550
|
+
event.stopPropagation();
|
|
551
|
+
const detail = event.detail;
|
|
552
|
+
// Handle both single chip and array of chips
|
|
553
|
+
if (!detail) {
|
|
554
|
+
// Clear all was clicked
|
|
555
|
+
this.change.emit('');
|
|
556
|
+
this.navigationPath = '';
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
// Convert to array if it's a single chip
|
|
560
|
+
const chips = Array.isArray(detail) ? detail : [detail];
|
|
561
|
+
if (chips.length === 0) {
|
|
562
|
+
// All chips removed
|
|
563
|
+
this.change.emit('');
|
|
564
|
+
this.navigationPath = '';
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
// A chip was removed - emit the last remaining chip's value
|
|
568
|
+
const lastChip = chips.at(-1);
|
|
569
|
+
if (lastChip) {
|
|
570
|
+
this.change.emit(lastChip.value);
|
|
571
|
+
}
|
|
572
|
+
this.navigationPath = '';
|
|
573
|
+
}
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
render() {
|
|
577
|
+
if (!this.limetype || !this.limetypes) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
const chips = this.getChipsForPath(this.navigationPath || this.value || '');
|
|
581
|
+
return (index.h("limel-menu", { items: this.menuItems, open: this.isOpen, emptyResultMessage: "No available properties", surfaceWidth: "inherit-from-trigger", openDirection: "bottom-end", onSelect: this.handleSelect, onNavigateMenu: this.handleNavigateMenu, onCancel: this.handleCancel }, index.h("div", { slot: "trigger" }, index.h("div", { onClick: this.handleChipSetWrapperClick }, index.h("limel-chip-set", { type: "input", label: this.label, value: chips, required: this.required, helperText: this.helperText, delimiter: "\u203A", maxItems: 1, onChange: this.handleChipSetChange, onFocus: this.handleChipSetFocus })))));
|
|
582
|
+
}
|
|
583
|
+
loadMenuItems() {
|
|
584
|
+
// Get the limetype we're currently navigating in
|
|
585
|
+
const currentLimetype = this.getCurrentLimetype();
|
|
586
|
+
if (!currentLimetype) {
|
|
587
|
+
this.menuItems = [];
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
this.menuItems = this.createMenuItems(currentLimetype, '');
|
|
591
|
+
}
|
|
592
|
+
getCurrentLimetype() {
|
|
593
|
+
if (!this.navigationPath) {
|
|
594
|
+
return this.limetypes[this.limetype];
|
|
595
|
+
}
|
|
596
|
+
// Get the limetype at the current navigation path
|
|
597
|
+
const property = propertyResolution.getPropertyFromPath(this.limetypes, this.limetype, this.navigationPath);
|
|
598
|
+
if (property === null || property === void 0 ? void 0 : property.relation) {
|
|
599
|
+
return property.relation.getLimetype();
|
|
600
|
+
}
|
|
601
|
+
return this.limetypes[this.limetype];
|
|
602
|
+
}
|
|
603
|
+
createMenuItems(limetype, pathPrefix) {
|
|
604
|
+
const results = [];
|
|
605
|
+
if (!limetype) {
|
|
606
|
+
return results;
|
|
607
|
+
}
|
|
608
|
+
const normalizedProperties = propertyResolution.getNormalizedProperties(limetype);
|
|
609
|
+
for (const [propName, property] of Object.entries(normalizedProperties)) {
|
|
610
|
+
// Skip hasMany and hasAndBelongsToMany relations
|
|
611
|
+
if (property.type === 'hasmany' ||
|
|
612
|
+
property.type === 'hasandbelongstomany') {
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
const fullPath = pathPrefix
|
|
616
|
+
? `${pathPrefix}.${propName}`
|
|
617
|
+
: propName;
|
|
618
|
+
const isRelation = !!property.relation;
|
|
619
|
+
let items;
|
|
620
|
+
if (isRelation && property.relation) {
|
|
621
|
+
// Create submenu for relation (only belongsto at this point)
|
|
622
|
+
const relatedLimetype = property.relation.getLimetype();
|
|
623
|
+
if (relatedLimetype) {
|
|
624
|
+
items = async () => this.createMenuItems(relatedLimetype, fullPath);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
results.push({
|
|
628
|
+
text: property.localname || propName,
|
|
629
|
+
secondaryText: this.getSecondaryText(property),
|
|
630
|
+
icon: this.getIconForProperty(property),
|
|
631
|
+
value: fullPath,
|
|
632
|
+
items: items,
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
if (results.length === 0) {
|
|
636
|
+
return [
|
|
637
|
+
{
|
|
638
|
+
text: 'No available properties',
|
|
639
|
+
value: '',
|
|
640
|
+
disabled: true,
|
|
641
|
+
},
|
|
642
|
+
];
|
|
643
|
+
}
|
|
644
|
+
return results;
|
|
645
|
+
}
|
|
646
|
+
getSecondaryText(property) {
|
|
647
|
+
var _a;
|
|
648
|
+
if (property.relation) {
|
|
649
|
+
const relatedLimetype = property.relation.getLimetype();
|
|
650
|
+
return ((_a = relatedLimetype === null || relatedLimetype === void 0 ? void 0 : relatedLimetype.localname) === null || _a === void 0 ? void 0 : _a.singular) || 'Object';
|
|
651
|
+
}
|
|
652
|
+
// Return the property type as the secondary text
|
|
653
|
+
return property.type.charAt(0).toUpperCase() + property.type.slice(1);
|
|
654
|
+
}
|
|
655
|
+
getIconForProperty(property) {
|
|
656
|
+
if (property.relation) {
|
|
657
|
+
return {
|
|
658
|
+
name: 'link',
|
|
659
|
+
color: 'rgb(var(--color-sky-default))',
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
// Use generic property icon
|
|
663
|
+
return {
|
|
664
|
+
name: 'decision',
|
|
665
|
+
color: 'rgb(var(--color-gray-default))',
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
getChipsForPath(path) {
|
|
669
|
+
if (!path) {
|
|
670
|
+
return [];
|
|
671
|
+
}
|
|
672
|
+
const parts = path.split('.');
|
|
673
|
+
const chips = [];
|
|
674
|
+
let currentLimetype = this.limetypes[this.limetype];
|
|
675
|
+
let currentPath = '';
|
|
676
|
+
for (const part of parts) {
|
|
677
|
+
currentPath = currentPath ? `${currentPath}.${part}` : part;
|
|
678
|
+
// Use getNormalizedProperties to include _id and _timestamp
|
|
679
|
+
const normalizedProperties = propertyResolution.getNormalizedProperties(currentLimetype);
|
|
680
|
+
const property = normalizedProperties[part];
|
|
681
|
+
if (property) {
|
|
682
|
+
chips.push({
|
|
683
|
+
id: currentPath,
|
|
684
|
+
text: property.localname || part,
|
|
685
|
+
icon: this.getIconForProperty(property),
|
|
686
|
+
value: currentPath,
|
|
687
|
+
});
|
|
688
|
+
if (property.relation) {
|
|
689
|
+
currentLimetype = property.relation.getLimetype();
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return chips;
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
__decorate([
|
|
697
|
+
index_esm.Te()
|
|
698
|
+
], PropertySelector.prototype, "limetypes", void 0);
|
|
699
|
+
PropertySelector.style = LimebbPropertySelectorStyle0;
|
|
700
|
+
|
|
701
|
+
exports.limebb_lime_query_filter_comparison = LimeQueryFilterComparisonComponent;
|
|
702
|
+
exports.limebb_lime_query_filter_group = LimeQueryFilterGroupComponent;
|
|
703
|
+
exports.limebb_lime_query_filter_not = LimeQueryFilterNotComponent;
|
|
704
|
+
exports.limebb_lime_query_value_input = LimeQueryValueInput;
|
|
705
|
+
exports.limebb_property_selector = PropertySelector;
|