@limetech/lime-crm-building-blocks 1.102.0 → 1.102.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/limebb-lime-query-filter-group_3.cjs.entry.js +164 -70
- package/dist/collection/components/lime-query-builder/expressions/filter-group-logic.js +150 -0
- package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-group.js +15 -71
- package/dist/components/lime-query-filter-expression.js +164 -70
- package/dist/esm/limebb-lime-query-filter-group_3.entry.js +164 -70
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-7731e1b0.entry.js +1 -0
- package/dist/types/components/lime-query-builder/expressions/filter-group-logic.d.ts +89 -0
- package/package.json +1 -1
- package/dist/lime-crm-building-blocks/p-6579412e.entry.js +0 -1
|
@@ -4,6 +4,156 @@ import { d as defineCustomElement$3 } from './lime-query-filter-comparison.js';
|
|
|
4
4
|
import { d as defineCustomElement$5 } from './lime-query-value-input.js';
|
|
5
5
|
import { d as defineCustomElement$4 } from './property-selector.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Get the subheading text for a filter group based on its operator and expression count
|
|
9
|
+
*
|
|
10
|
+
* @param operator - The group's operator (AND or OR)
|
|
11
|
+
* @param expressionCount - Number of child expressions
|
|
12
|
+
* @returns Subheading text, or empty string if 0 or 1 expressions
|
|
13
|
+
*/
|
|
14
|
+
function getFilterGroupSubheading(operator, expressionCount) {
|
|
15
|
+
if (expressionCount <= 1) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
return operator === Zt.AND
|
|
19
|
+
? 'All of these conditions are true'
|
|
20
|
+
: 'Any of these conditions are true';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the label for the "Add condition" button
|
|
24
|
+
*
|
|
25
|
+
* @param operator - The group's operator (AND or OR)
|
|
26
|
+
* @param expressionCount - Number of child expressions
|
|
27
|
+
* @returns Appropriate button label based on context
|
|
28
|
+
*/
|
|
29
|
+
function getAddConditionButtonLabel(operator, expressionCount) {
|
|
30
|
+
if (expressionCount === 0) {
|
|
31
|
+
return 'Add a condition';
|
|
32
|
+
}
|
|
33
|
+
return operator === Zt.AND
|
|
34
|
+
? 'Add another condition'
|
|
35
|
+
: 'Add alternative';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get the label for the "Add group" button
|
|
39
|
+
*
|
|
40
|
+
* @param operator - The group's operator (AND or OR)
|
|
41
|
+
* @param expressionCount - Number of child expressions
|
|
42
|
+
* @returns Appropriate button label based on context
|
|
43
|
+
*/
|
|
44
|
+
function getAddGroupButtonLabel(operator, expressionCount) {
|
|
45
|
+
if (expressionCount === 0) {
|
|
46
|
+
return 'Add a group';
|
|
47
|
+
}
|
|
48
|
+
return operator === Zt.AND
|
|
49
|
+
? 'Add another group'
|
|
50
|
+
: 'Add alternative group';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a new empty comparison expression
|
|
54
|
+
*
|
|
55
|
+
* @returns A new comparison expression with empty key and value
|
|
56
|
+
*/
|
|
57
|
+
function createEmptyComparison() {
|
|
58
|
+
return {
|
|
59
|
+
key: '',
|
|
60
|
+
op: Zt.EQUALS,
|
|
61
|
+
exp: '',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a new nested group with the opposite operator from the parent
|
|
66
|
+
*
|
|
67
|
+
* @param parentOperator - The parent group's operator
|
|
68
|
+
* @returns A new group with the opposite operator and one empty comparison
|
|
69
|
+
*/
|
|
70
|
+
function createNestedGroup(parentOperator) {
|
|
71
|
+
const oppositeOp = parentOperator === Zt.AND ? Zt.OR : Zt.AND;
|
|
72
|
+
return {
|
|
73
|
+
op: oppositeOp,
|
|
74
|
+
exp: [createEmptyComparison()],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Add a new expression to a group immutably
|
|
79
|
+
*
|
|
80
|
+
* @param group - The existing group
|
|
81
|
+
* @param newExpression - The expression to add
|
|
82
|
+
* @returns A new group with the expression added to the end
|
|
83
|
+
*/
|
|
84
|
+
function addExpressionToGroup(group, newExpression) {
|
|
85
|
+
return {
|
|
86
|
+
op: group.op,
|
|
87
|
+
exp: [...group.exp, newExpression],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Toggle a group's operator between AND and OR
|
|
92
|
+
*
|
|
93
|
+
* @param group - The group to toggle
|
|
94
|
+
* @returns A new group with the toggled operator
|
|
95
|
+
*/
|
|
96
|
+
function toggleGroupOperator(group) {
|
|
97
|
+
const newOperator = group.op === Zt.AND ? Zt.OR : Zt.AND;
|
|
98
|
+
return {
|
|
99
|
+
op: newOperator,
|
|
100
|
+
exp: [...group.exp],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Update a child expression in a group, handling deletion and unwrapping
|
|
105
|
+
*
|
|
106
|
+
* This function handles three scenarios:
|
|
107
|
+
* 1. Update: Replace a child expression with a new one
|
|
108
|
+
* 2. Delete: Remove a child (when updatedChild is undefined)
|
|
109
|
+
* - If last child is deleted, return 'removed' (group should be deleted)
|
|
110
|
+
* - If deletion leaves one child, return 'unwrapped' (unwrap to that child)
|
|
111
|
+
* - Otherwise, return 'updated' with the remaining children
|
|
112
|
+
*
|
|
113
|
+
* @param group - The group containing the child
|
|
114
|
+
* @param childIndex - Index of the child to update
|
|
115
|
+
* @param updatedChild - The new child expression, or undefined to delete
|
|
116
|
+
* @returns Result object with type and resulting expression
|
|
117
|
+
*/
|
|
118
|
+
function updateChildExpression(group, childIndex, updatedChild) {
|
|
119
|
+
const expressions = [...group.exp];
|
|
120
|
+
if (!updatedChild) {
|
|
121
|
+
// Deletion - remove the child
|
|
122
|
+
expressions.splice(childIndex, 1);
|
|
123
|
+
if (expressions.length === 0) {
|
|
124
|
+
// No children left - remove the entire group
|
|
125
|
+
return {
|
|
126
|
+
type: 'removed',
|
|
127
|
+
expression: undefined,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (expressions.length === 1) {
|
|
131
|
+
// One child left - unwrap to that child
|
|
132
|
+
return {
|
|
133
|
+
type: 'unwrapped',
|
|
134
|
+
expression: expressions[0],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
// Multiple children remain - return updated group
|
|
138
|
+
return {
|
|
139
|
+
type: 'updated',
|
|
140
|
+
expression: {
|
|
141
|
+
op: group.op,
|
|
142
|
+
exp: expressions,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// Update - replace the child
|
|
147
|
+
expressions[childIndex] = updatedChild;
|
|
148
|
+
return {
|
|
149
|
+
type: 'updated',
|
|
150
|
+
expression: {
|
|
151
|
+
op: group.op,
|
|
152
|
+
exp: expressions,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
7
157
|
const limeQueryFilterNotCss = "@charset \"UTF-8\";.expression{display:flex;flex-direction:column;margin-bottom:1rem;gap:1rem;padding:1rem;border-left:0.25rem solid rgb(var(--contrast-400));background-color:rgb(var(--contrast-100))}";
|
|
8
158
|
const LimebbLimeQueryFilterNotStyle0 = limeQueryFilterNotCss;
|
|
9
159
|
|
|
@@ -84,80 +234,32 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
|
|
|
84
234
|
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
85
235
|
this.renderChildExpression = (expression, childIndex) => (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
86
236
|
this.handleToggleOperator = () => {
|
|
87
|
-
const
|
|
88
|
-
this.expressionChange.emit(
|
|
89
|
-
op: newOperator,
|
|
90
|
-
exp: this.expression.exp,
|
|
91
|
-
});
|
|
237
|
+
const newGroup = toggleGroupOperator(this.expression);
|
|
238
|
+
this.expressionChange.emit(newGroup);
|
|
92
239
|
};
|
|
93
240
|
this.handleAddChildExpression = () => {
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
op: Zt.EQUALS,
|
|
98
|
-
exp: '',
|
|
99
|
-
};
|
|
100
|
-
this.expressionChange.emit({
|
|
101
|
-
op: this.expression.op,
|
|
102
|
-
exp: [...this.expression.exp, newChild],
|
|
103
|
-
});
|
|
241
|
+
const newChild = createEmptyComparison();
|
|
242
|
+
const newGroup = addExpressionToGroup(this.expression, newChild);
|
|
243
|
+
this.expressionChange.emit(newGroup);
|
|
104
244
|
};
|
|
105
245
|
this.handleAddChildGroup = () => {
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
op: oppositeOp,
|
|
110
|
-
exp: [
|
|
111
|
-
{
|
|
112
|
-
key: '',
|
|
113
|
-
op: Zt.EQUALS,
|
|
114
|
-
exp: '',
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
};
|
|
118
|
-
this.expressionChange.emit({
|
|
119
|
-
op: this.expression.op,
|
|
120
|
-
exp: [...this.expression.exp, newChild],
|
|
121
|
-
});
|
|
246
|
+
const newChild = createNestedGroup(this.expression.op);
|
|
247
|
+
const newGroup = addExpressionToGroup(this.expression, newChild);
|
|
248
|
+
this.expressionChange.emit(newGroup);
|
|
122
249
|
};
|
|
123
250
|
this.handleExpressionChange = (updatedChildIndex) => (event) => {
|
|
124
251
|
event.stopPropagation();
|
|
125
252
|
const updatedExpression = event.detail;
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
// Deletion - remove the child and potentially unwrap
|
|
129
|
-
expressions.splice(updatedChildIndex, 1);
|
|
130
|
-
if (expressions.length === 0) {
|
|
131
|
-
this.expressionChange.emit(undefined);
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (expressions.length === 1) {
|
|
135
|
-
// Unwrap when only one child remains after deletion
|
|
136
|
-
this.expressionChange.emit(expressions[0]);
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
// Update - replace the child, don't unwrap
|
|
142
|
-
expressions[updatedChildIndex] = updatedExpression;
|
|
143
|
-
}
|
|
144
|
-
this.expressionChange.emit({
|
|
145
|
-
op: this.expression.op,
|
|
146
|
-
exp: expressions,
|
|
147
|
-
});
|
|
253
|
+
const result = updateChildExpression(this.expression, updatedChildIndex, updatedExpression);
|
|
254
|
+
this.expressionChange.emit(result.expression);
|
|
148
255
|
};
|
|
149
256
|
}
|
|
150
257
|
render() {
|
|
151
258
|
const subheading = this.getSubheading();
|
|
152
|
-
return (h("div", { key: '
|
|
259
|
+
return (h("div", { key: 'bf26300a939b4a2a1b401fa7a81593ec745a2a52', class: "expression" }, subheading && (h("limel-header", { key: 'f5152a2ca09811540b626965f52f5793e6c99728', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: 'c4cad750e47e0b6c94d6a76b2a4d8b72e36b3402' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ddd614f237a0c0314c2977b74a31b365f3251f9d', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
|
|
153
260
|
}
|
|
154
261
|
getSubheading() {
|
|
155
|
-
|
|
156
|
-
return '';
|
|
157
|
-
}
|
|
158
|
-
return this.expression.op === Zt.AND
|
|
159
|
-
? 'All of these conditions are true'
|
|
160
|
-
: 'Any of these conditions are true';
|
|
262
|
+
return getFilterGroupSubheading(this.expression.op, this.expression.exp.length);
|
|
161
263
|
}
|
|
162
264
|
renderAddButton() {
|
|
163
265
|
const label = this.getAddButtonLabel();
|
|
@@ -168,18 +270,10 @@ const LimeQueryFilterGroupComponent = /*@__PURE__*/ proxyCustomElement(class Lim
|
|
|
168
270
|
return (h("limel-button", { label: label, icon: "tree_structure", onClick: this.handleAddChildGroup }));
|
|
169
271
|
}
|
|
170
272
|
getAddButtonLabel() {
|
|
171
|
-
|
|
172
|
-
if (this.expression.exp.length === 0) {
|
|
173
|
-
return 'Add a condition';
|
|
174
|
-
}
|
|
175
|
-
return isAnd ? 'Add another condition' : 'Add alternative';
|
|
273
|
+
return getAddConditionButtonLabel(this.expression.op, this.expression.exp.length);
|
|
176
274
|
}
|
|
177
275
|
getAddGroupButtonLabel() {
|
|
178
|
-
|
|
179
|
-
if (this.expression.exp.length === 0) {
|
|
180
|
-
return 'Add a group';
|
|
181
|
-
}
|
|
182
|
-
return isAnd ? 'Add another group' : 'Add alternative group';
|
|
276
|
+
return getAddGroupButtonLabel(this.expression.op, this.expression.exp.length);
|
|
183
277
|
}
|
|
184
278
|
static get style() { return LimebbLimeQueryFilterGroupStyle0; }
|
|
185
279
|
}, [1, "limebb-lime-query-filter-group", {
|
|
@@ -2,6 +2,156 @@ import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js'
|
|
|
2
2
|
import { Z as Zt, T as Te } from './index.esm-bb569663.js';
|
|
3
3
|
import { g as getPropertyFromPath } from './property-resolution-c21a1369.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Get the subheading text for a filter group based on its operator and expression count
|
|
7
|
+
*
|
|
8
|
+
* @param operator - The group's operator (AND or OR)
|
|
9
|
+
* @param expressionCount - Number of child expressions
|
|
10
|
+
* @returns Subheading text, or empty string if 0 or 1 expressions
|
|
11
|
+
*/
|
|
12
|
+
function getFilterGroupSubheading(operator, expressionCount) {
|
|
13
|
+
if (expressionCount <= 1) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
return operator === Zt.AND
|
|
17
|
+
? 'All of these conditions are true'
|
|
18
|
+
: 'Any of these conditions are true';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the label for the "Add condition" button
|
|
22
|
+
*
|
|
23
|
+
* @param operator - The group's operator (AND or OR)
|
|
24
|
+
* @param expressionCount - Number of child expressions
|
|
25
|
+
* @returns Appropriate button label based on context
|
|
26
|
+
*/
|
|
27
|
+
function getAddConditionButtonLabel(operator, expressionCount) {
|
|
28
|
+
if (expressionCount === 0) {
|
|
29
|
+
return 'Add a condition';
|
|
30
|
+
}
|
|
31
|
+
return operator === Zt.AND
|
|
32
|
+
? 'Add another condition'
|
|
33
|
+
: 'Add alternative';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the label for the "Add group" button
|
|
37
|
+
*
|
|
38
|
+
* @param operator - The group's operator (AND or OR)
|
|
39
|
+
* @param expressionCount - Number of child expressions
|
|
40
|
+
* @returns Appropriate button label based on context
|
|
41
|
+
*/
|
|
42
|
+
function getAddGroupButtonLabel(operator, expressionCount) {
|
|
43
|
+
if (expressionCount === 0) {
|
|
44
|
+
return 'Add a group';
|
|
45
|
+
}
|
|
46
|
+
return operator === Zt.AND
|
|
47
|
+
? 'Add another group'
|
|
48
|
+
: 'Add alternative group';
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create a new empty comparison expression
|
|
52
|
+
*
|
|
53
|
+
* @returns A new comparison expression with empty key and value
|
|
54
|
+
*/
|
|
55
|
+
function createEmptyComparison() {
|
|
56
|
+
return {
|
|
57
|
+
key: '',
|
|
58
|
+
op: Zt.EQUALS,
|
|
59
|
+
exp: '',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a new nested group with the opposite operator from the parent
|
|
64
|
+
*
|
|
65
|
+
* @param parentOperator - The parent group's operator
|
|
66
|
+
* @returns A new group with the opposite operator and one empty comparison
|
|
67
|
+
*/
|
|
68
|
+
function createNestedGroup(parentOperator) {
|
|
69
|
+
const oppositeOp = parentOperator === Zt.AND ? Zt.OR : Zt.AND;
|
|
70
|
+
return {
|
|
71
|
+
op: oppositeOp,
|
|
72
|
+
exp: [createEmptyComparison()],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Add a new expression to a group immutably
|
|
77
|
+
*
|
|
78
|
+
* @param group - The existing group
|
|
79
|
+
* @param newExpression - The expression to add
|
|
80
|
+
* @returns A new group with the expression added to the end
|
|
81
|
+
*/
|
|
82
|
+
function addExpressionToGroup(group, newExpression) {
|
|
83
|
+
return {
|
|
84
|
+
op: group.op,
|
|
85
|
+
exp: [...group.exp, newExpression],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Toggle a group's operator between AND and OR
|
|
90
|
+
*
|
|
91
|
+
* @param group - The group to toggle
|
|
92
|
+
* @returns A new group with the toggled operator
|
|
93
|
+
*/
|
|
94
|
+
function toggleGroupOperator(group) {
|
|
95
|
+
const newOperator = group.op === Zt.AND ? Zt.OR : Zt.AND;
|
|
96
|
+
return {
|
|
97
|
+
op: newOperator,
|
|
98
|
+
exp: [...group.exp],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Update a child expression in a group, handling deletion and unwrapping
|
|
103
|
+
*
|
|
104
|
+
* This function handles three scenarios:
|
|
105
|
+
* 1. Update: Replace a child expression with a new one
|
|
106
|
+
* 2. Delete: Remove a child (when updatedChild is undefined)
|
|
107
|
+
* - If last child is deleted, return 'removed' (group should be deleted)
|
|
108
|
+
* - If deletion leaves one child, return 'unwrapped' (unwrap to that child)
|
|
109
|
+
* - Otherwise, return 'updated' with the remaining children
|
|
110
|
+
*
|
|
111
|
+
* @param group - The group containing the child
|
|
112
|
+
* @param childIndex - Index of the child to update
|
|
113
|
+
* @param updatedChild - The new child expression, or undefined to delete
|
|
114
|
+
* @returns Result object with type and resulting expression
|
|
115
|
+
*/
|
|
116
|
+
function updateChildExpression(group, childIndex, updatedChild) {
|
|
117
|
+
const expressions = [...group.exp];
|
|
118
|
+
if (!updatedChild) {
|
|
119
|
+
// Deletion - remove the child
|
|
120
|
+
expressions.splice(childIndex, 1);
|
|
121
|
+
if (expressions.length === 0) {
|
|
122
|
+
// No children left - remove the entire group
|
|
123
|
+
return {
|
|
124
|
+
type: 'removed',
|
|
125
|
+
expression: undefined,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
if (expressions.length === 1) {
|
|
129
|
+
// One child left - unwrap to that child
|
|
130
|
+
return {
|
|
131
|
+
type: 'unwrapped',
|
|
132
|
+
expression: expressions[0],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Multiple children remain - return updated group
|
|
136
|
+
return {
|
|
137
|
+
type: 'updated',
|
|
138
|
+
expression: {
|
|
139
|
+
op: group.op,
|
|
140
|
+
exp: expressions,
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// Update - replace the child
|
|
145
|
+
expressions[childIndex] = updatedChild;
|
|
146
|
+
return {
|
|
147
|
+
type: 'updated',
|
|
148
|
+
expression: {
|
|
149
|
+
op: group.op,
|
|
150
|
+
exp: expressions,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
5
155
|
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}";
|
|
6
156
|
const LimebbLimeQueryFilterGroupStyle0 = limeQueryFilterGroupCss;
|
|
7
157
|
|
|
@@ -11,80 +161,32 @@ const LimeQueryFilterGroupComponent = class {
|
|
|
11
161
|
this.expressionChange = createEvent(this, "expressionChange", 7);
|
|
12
162
|
this.renderChildExpression = (expression, childIndex) => (h("li", null, h("limebb-lime-query-filter-expression", { platform: this.platform, context: this.context, limetype: this.limetype, activeLimetype: this.activeLimetype, expression: expression, onExpressionChange: this.handleExpressionChange(childIndex) })));
|
|
13
163
|
this.handleToggleOperator = () => {
|
|
14
|
-
const
|
|
15
|
-
this.expressionChange.emit(
|
|
16
|
-
op: newOperator,
|
|
17
|
-
exp: this.expression.exp,
|
|
18
|
-
});
|
|
164
|
+
const newGroup = toggleGroupOperator(this.expression);
|
|
165
|
+
this.expressionChange.emit(newGroup);
|
|
19
166
|
};
|
|
20
167
|
this.handleAddChildExpression = () => {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
op: Zt.EQUALS,
|
|
25
|
-
exp: '',
|
|
26
|
-
};
|
|
27
|
-
this.expressionChange.emit({
|
|
28
|
-
op: this.expression.op,
|
|
29
|
-
exp: [...this.expression.exp, newChild],
|
|
30
|
-
});
|
|
168
|
+
const newChild = createEmptyComparison();
|
|
169
|
+
const newGroup = addExpressionToGroup(this.expression, newChild);
|
|
170
|
+
this.expressionChange.emit(newGroup);
|
|
31
171
|
};
|
|
32
172
|
this.handleAddChildGroup = () => {
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
op: oppositeOp,
|
|
37
|
-
exp: [
|
|
38
|
-
{
|
|
39
|
-
key: '',
|
|
40
|
-
op: Zt.EQUALS,
|
|
41
|
-
exp: '',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
this.expressionChange.emit({
|
|
46
|
-
op: this.expression.op,
|
|
47
|
-
exp: [...this.expression.exp, newChild],
|
|
48
|
-
});
|
|
173
|
+
const newChild = createNestedGroup(this.expression.op);
|
|
174
|
+
const newGroup = addExpressionToGroup(this.expression, newChild);
|
|
175
|
+
this.expressionChange.emit(newGroup);
|
|
49
176
|
};
|
|
50
177
|
this.handleExpressionChange = (updatedChildIndex) => (event) => {
|
|
51
178
|
event.stopPropagation();
|
|
52
179
|
const updatedExpression = event.detail;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
// Deletion - remove the child and potentially unwrap
|
|
56
|
-
expressions.splice(updatedChildIndex, 1);
|
|
57
|
-
if (expressions.length === 0) {
|
|
58
|
-
this.expressionChange.emit(undefined);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (expressions.length === 1) {
|
|
62
|
-
// Unwrap when only one child remains after deletion
|
|
63
|
-
this.expressionChange.emit(expressions[0]);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// Update - replace the child, don't unwrap
|
|
69
|
-
expressions[updatedChildIndex] = updatedExpression;
|
|
70
|
-
}
|
|
71
|
-
this.expressionChange.emit({
|
|
72
|
-
op: this.expression.op,
|
|
73
|
-
exp: expressions,
|
|
74
|
-
});
|
|
180
|
+
const result = updateChildExpression(this.expression, updatedChildIndex, updatedExpression);
|
|
181
|
+
this.expressionChange.emit(result.expression);
|
|
75
182
|
};
|
|
76
183
|
}
|
|
77
184
|
render() {
|
|
78
185
|
const subheading = this.getSubheading();
|
|
79
|
-
return (h("div", { key: '
|
|
186
|
+
return (h("div", { key: 'bf26300a939b4a2a1b401fa7a81593ec745a2a52', class: "expression" }, subheading && (h("limel-header", { key: 'f5152a2ca09811540b626965f52f5793e6c99728', subheading: subheading, onClick: this.handleToggleOperator, class: "clickable-header" })), h("ul", { key: 'c4cad750e47e0b6c94d6a76b2a4d8b72e36b3402' }, this.expression.exp.map(this.renderChildExpression), h("li", { key: 'ddd614f237a0c0314c2977b74a31b365f3251f9d', class: "add-button" }, this.renderAddButton(), this.renderAddGroupButton()))));
|
|
80
187
|
}
|
|
81
188
|
getSubheading() {
|
|
82
|
-
|
|
83
|
-
return '';
|
|
84
|
-
}
|
|
85
|
-
return this.expression.op === Zt.AND
|
|
86
|
-
? 'All of these conditions are true'
|
|
87
|
-
: 'Any of these conditions are true';
|
|
189
|
+
return getFilterGroupSubheading(this.expression.op, this.expression.exp.length);
|
|
88
190
|
}
|
|
89
191
|
renderAddButton() {
|
|
90
192
|
const label = this.getAddButtonLabel();
|
|
@@ -95,18 +197,10 @@ const LimeQueryFilterGroupComponent = class {
|
|
|
95
197
|
return (h("limel-button", { label: label, icon: "tree_structure", onClick: this.handleAddChildGroup }));
|
|
96
198
|
}
|
|
97
199
|
getAddButtonLabel() {
|
|
98
|
-
|
|
99
|
-
if (this.expression.exp.length === 0) {
|
|
100
|
-
return 'Add a condition';
|
|
101
|
-
}
|
|
102
|
-
return isAnd ? 'Add another condition' : 'Add alternative';
|
|
200
|
+
return getAddConditionButtonLabel(this.expression.op, this.expression.exp.length);
|
|
103
201
|
}
|
|
104
202
|
getAddGroupButtonLabel() {
|
|
105
|
-
|
|
106
|
-
if (this.expression.exp.length === 0) {
|
|
107
|
-
return 'Add a group';
|
|
108
|
-
}
|
|
109
|
-
return isAnd ? 'Add another group' : 'Add alternative group';
|
|
203
|
+
return getAddGroupButtonLabel(this.expression.op, this.expression.exp.length);
|
|
110
204
|
}
|
|
111
205
|
};
|
|
112
206
|
LimeQueryFilterGroupComponent.style = LimebbLimeQueryFilterGroupStyle0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-be845252",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-33e6d0ec",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-6f6fed59",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-e35299e0",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-0de79b7f",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-d0721b22",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-3d1be1c9",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-577d8909",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-a9ac501f",[[1,"limebb-live-docs-info"]]],["p-0f7135ff",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-289ce8b9",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-cb338753",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-abfc7815",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-3351395b",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-7e5528f6",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-6579412e",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-186e9f1a",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
1
|
+
import{p as e,b as t}from"./p-1556b545.js";export{s as setNonce}from"./p-1556b545.js";import{g as i}from"./p-e1255160.js";(()=>{const t=import.meta.url,i={};return""!==t&&(i.resourcesUrl=new URL(".",t).href),e(i)})().then((async e=>(await i(),t(JSON.parse('[["p-be845252",[[1,"limebb-lime-query-builder",{"platform":[16],"context":[16],"value":[16],"label":[1],"activeLimetype":[1,"active-limetype"],"limetypes":[32],"mode":[32],"codeValue":[32],"limetype":[32],"filter":[32],"internalResponseFormat":[32],"limit":[32],"orderBy":[32]}]]],["p-ee1b00b9",[[1,"limebb-feed",{"platform":[16],"context":[16],"items":[16],"emptyStateMessage":[1,"empty-state-message"],"heading":[1],"loading":[4],"minutesOfProximity":[2,"minutes-of-proximity"],"totalCount":[2,"total-count"],"direction":[513],"lastVisitedTimestamp":[1,"last-visited-timestamp"],"highlightedItemId":[8,"highlighted-item-id"]},null,{"highlightedItemId":["highlightedItemIdChanged"]}]]],["p-3a406a20",[[1,"limebb-kanban",{"platform":[16],"context":[16],"groups":[16]}]]],["p-33e6d0ec",[[1,"limebb-lime-query-response-format-builder",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"limetypes":[32],"mode":[32],"codeValue":[32],"internalValue":[32]}]]],["p-32534eb7",[[1,"limebb-chat-list",{"platform":[16],"context":[16],"items":[16],"loading":[516],"isTypingIndicatorVisible":[516,"is-typing-indicator-visible"],"lastVisitedTimestamp":[513,"last-visited-timestamp"],"order":[513]},null,{"items":["handleItemsChange"]}]]],["p-03af0e66",[[1,"limebb-limeobject-file-viewer",{"platform":[16],"context":[16],"property":[1],"fileTypes":[16],"limeobject":[32],"limetype":[32]}]]],["p-6f6fed59",[[1,"limebb-text-editor",{"platform":[16],"context":[16],"allowMentioning":[4,"allow-mentioning"],"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"required":[516],"selectedContext":[16],"ui":[513],"allowResize":[4,"allow-resize"],"value":[1],"draftIdentifier":[1,"draft-identifier"],"triggerMap":[16],"customElements":[16],"allowInlineImages":[4,"allow-inline-images"],"items":[32],"highlightedItemIndex":[32],"editorPickerQuery":[32],"searchableLimetypes":[32],"isPickerOpen":[32],"isSearching":[32]},null,{"isPickerOpen":["watchOpen"],"editorPickerQuery":["watchQuery"]}]]],["p-8491aaa1",[[1,"limebb-date-range",{"platform":[16],"context":[16],"startTime":[16],"endTime":[16],"startTimeLabel":[1,"start-time-label"],"endTimeLabel":[1,"end-time-label"],"language":[1],"timeFormat":[1,"time-format"],"type":[1]}]]],["p-4a82410e",[[1,"limebb-document-picker",{"platform":[16],"context":[16],"items":[16],"label":[513],"helperText":[513,"helper-text"],"invalid":[516],"required":[516],"type":[513]}]]],["p-568b7520",[[1,"limebb-info-tile-currency-format",{"platform":[16],"context":[16],"value":[16]}]]],["p-2fdcb868",[[1,"limebb-notification-list",{"platform":[16],"context":[16],"items":[16],"loading":[4],"lastVisitedTimestamp":[1,"last-visited-timestamp"]},null,{"items":["handleItemsChange"]}]]],["p-5464f0de",[[17,"limebb-browser",{"platform":[16],"context":[16],"items":[16],"layout":[1],"filter":[32]}]]],["p-3175883d",[[1,"limebb-component-config",{"platform":[16],"context":[16],"value":[16],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"formInfo":[16],"type":[1],"nameField":[1,"name-field"],"configComponent":[32],"configViewType":[32]},null,{"formInfo":["watchFormInfo"],"configComponent":["watchconfigComponent"]}]]],["p-1be0eec7",[[1,"limebb-component-picker",{"platform":[16],"context":[16],"type":[1],"tags":[16],"value":[1],"copyLabel":[1,"copy-label"],"hideCopyButton":[4,"hide-copy-button"],"required":[4],"readonly":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-10ac8b3e",[[1,"limebb-dashboard-widget",{"heading":[513],"subheading":[513],"supportingText":[513,"supporting-text"],"icon":[513]}]]],["p-e35299e0",[[1,"limebb-icon-picker",{"value":[1],"required":[4],"readonly":[4],"invalid":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"]}]]],["p-a200954f",[[1,"limebb-info-tile",{"platform":[16],"context":[16],"filterId":[513,"filter-id"],"disabled":[4],"icon":[513],"label":[1],"prefix":[1],"suffix":[1],"propertyName":[1,"property-name"],"aggregateOperator":[1,"aggregate-operator"],"format":[16],"config":[32],"filters":[32],"value":[32],"loading":[32],"error":[32]},null,{"filterId":["watchFilterId"],"propertyName":["watchPropertyName"],"aggregateOperator":["watchAggregateOperator"]}]]],["p-01cff04f",[[1,"limebb-info-tile-date-format",{"value":[16]}]]],["p-4caa8bbe",[[1,"limebb-info-tile-decimal-format",{"value":[16]}]]],["p-ff0b244b",[[1,"limebb-info-tile-format",{"platform":[16],"context":[16],"type":[1],"value":[16]}]]],["p-25e1a434",[[1,"limebb-info-tile-relative-date-format",{"value":[16]}]]],["p-6c56121c",[[1,"limebb-info-tile-unit-format",{"value":[16]}]]],["p-206575e4",[[1,"limebb-loader",{"platform":[16],"context":[16]}]]],["p-0de79b7f",[[1,"limebb-locale-picker",{"platform":[16],"context":[16],"value":[1],"required":[4],"disabled":[4],"label":[1],"helperText":[1,"helper-text"],"readonly":[4],"multipleChoice":[4,"multiple-choice"],"allLanguages":[32]}]]],["p-cfa1a4ad",[[1,"limebb-mention",{"limetype":[1],"objectid":[2],"limeobject":[32]}]]],["p-d0721b22",[[1,"limebb-mention-group-counter",{"count":[2],"limetype":[16],"helperLabel":[1,"helper-label"]}]]],["p-3d1be1c9",[[1,"limebb-percentage-visualizer",{"platform":[16],"context":[16],"value":[520],"rangeMax":[514,"range-max"],"rangeMin":[514,"range-min"],"multiplier":[514],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"],"displayPercentageColors":[516,"display-percentage-colors"]},null,{"value":["valueChanged"]}]]],["p-577d8909",[[1,"limebb-trend-indicator",{"platform":[16],"context":[16],"value":[520],"formerValue":[514,"former-value"],"suffix":[513],"label":[513],"invalid":[516],"required":[516],"helperText":[513,"helper-text"],"reducePresence":[516,"reduce-presence"]},null,{"value":["valueChanged"]}]]],["p-7271f47a",[[1,"limebb-feed-timeline-item",{"platform":[16],"context":[16],"item":[16],"ui":[513],"helperText":[1,"helper-text"],"hasError":[516,"has-error"],"isBundled":[516,"is-bundled"],"headingCanExpand":[32],"isHeadingExpanded":[32],"showMore":[32],"isTall":[32]}]]],["p-eb81bceb",[[1,"limebb-kanban-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-2faaacbc",[[1,"limebb-kanban-group",{"platform":[16],"context":[16],"identifier":[1],"heading":[513],"help":[1],"items":[16],"summary":[1],"loading":[516],"totalCount":[514,"total-count"]}]]],["p-218b7f38",[[1,"limebb-text-editor-picker",{"items":[16],"open":[516],"isSearching":[4,"is-searching"],"emptyMessage":[1,"empty-message"]},null,{"open":["watchOpen"]}]]],["p-9031f136",[[1,"limebb-currency-picker",{"platform":[16],"context":[16],"label":[513],"currencies":[16],"helperText":[513,"helper-text"],"required":[516],"readonly":[516],"invalid":[516],"disabled":[516],"value":[1]}]]],["p-098ee6c1",[[1,"limebb-date-picker",{"platform":[16],"context":[16],"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[1],"type":[513]}]]],["p-9d25ed5a",[[17,"limebb-document-item",{"platform":[16],"context":[16],"item":[16],"type":[513]}]]],["p-a9ac501f",[[1,"limebb-live-docs-info"]]],["p-0f7135ff",[[1,"limebb-notification-item",{"platform":[16],"context":[16],"item":[16]}]]],["p-289ce8b9",[[1,"limebb-lime-query-order-by-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16]}]]],["p-5dc574a3",[[1,"limebb-chat-item",{"platform":[16],"context":[16],"item":[16],"helperText":[1,"helper-text"],"hasError":[516,"has-error"]}],[1,"limebb-typing-indicator"]]],["p-61282e1a",[[1,"limebb-feed-item-thumbnail-file-info",{"description":[1]}]]],["p-cb338753",[[1,"limebb-lime-query-filter-builder",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-order-by-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]},null,{"value":["handleValueChange"]}],[0,"limebb-limetype-field",{"platform":[16],"context":[16],"label":[513],"required":[516],"readonly":[516],"disabled":[516],"value":[513],"helperText":[513,"helper-text"],"invalid":[4],"limetypes":[16],"propertyFields":[16],"fieldName":[1,"field-name"],"formInfo":[16]}]]],["p-292631ea",[[1,"limebb-empty-state",{"heading":[513],"value":[513],"icon":[16]}]]],["p-abfc7815",[[1,"limebb-property-selector",{"platform":[16],"context":[16],"limetype":[1],"value":[1],"label":[1],"required":[4],"helperText":[1,"helper-text"],"limetypes":[32],"isOpen":[32],"navigationPath":[32]}]]],["p-3351395b",[[1,"limebb-lime-query-response-format-editor",{"platform":[16],"context":[16],"limetype":[1],"value":[16],"label":[1],"items":[32]}],[1,"limebb-lime-query-response-format-item",{"platform":[16],"context":[16],"limetype":[1],"item":[16],"showAliasInput":[32],"showDescriptionInput":[32]}]]],["p-7e5528f6",[[1,"limebb-summary-popover",{"triggerDelay":[514,"trigger-delay"],"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"openDirection":[513,"open-direction"],"popoverMaxWidth":[513,"popover-max-width"],"popoverMaxHeight":[513,"popover-max-height"],"actions":[16],"isPopoverOpen":[32]}],[17,"limebb-navigation-button",{"href":[513],"tooltipLabel":[513,"tooltip-label"],"tooltipHelperLabel":[513,"tooltip-helper-label"],"type":[513]}]]],["p-7731e1b0",[[1,"limebb-lime-query-value-input",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"propertyPath":[1,"property-path"],"operator":[1],"value":[8],"label":[1],"limetypes":[32],"inputMode":[32]}],[1,"limebb-lime-query-filter-group",{"platform":[16],"context":[16],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-not",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]],["p-186e9f1a",[[1,"limebb-lime-query-filter-expression",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}],[1,"limebb-lime-query-filter-comparison",{"platform":[16],"context":[16],"label":[1],"limetype":[1],"activeLimetype":[1,"active-limetype"],"expression":[16]}]]]]'),e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as i}from"./p-1556b545.js";import{Z as r,T as s}from"./p-4838284a.js";import{g as l}from"./p-b748c770.js";function o(){return{key:"",op:r.EQUALS,exp:""}}function n(e,t){return{op:e.op,exp:[...e.exp,t]}}const a=class{constructor(s){e(this,s),this.expressionChange=t(this,"expressionChange",7),this.renderChildExpression=(e,t)=>i("li",null,i("limebb-lime-query-filter-expression",{platform:this.platform,context:this.context,limetype:this.limetype,activeLimetype:this.activeLimetype,expression:e,onExpressionChange:this.handleExpressionChange(t)})),this.handleToggleOperator=()=>{const e={op:(t=this.expression).op===r.AND?r.OR:r.AND,exp:[...t.exp]};var t;this.expressionChange.emit(e)},this.handleAddChildExpression=()=>{const e=o(),t=n(this.expression,e);this.expressionChange.emit(t)},this.handleAddChildGroup=()=>{const e={op:this.expression.op===r.AND?r.OR:r.AND,exp:[o()]},t=n(this.expression,e);this.expressionChange.emit(t)},this.handleExpressionChange=e=>t=>{t.stopPropagation();const i=function(e,t,i){const r=[...e.exp];return i?(r[t]=i,{type:"updated",expression:{op:e.op,exp:r}}):(r.splice(t,1),0===r.length?{type:"removed",expression:void 0}:1===r.length?{type:"unwrapped",expression:r[0]}:{type:"updated",expression:{op:e.op,exp:r}})}(this.expression,e,t.detail);this.expressionChange.emit(i.expression)}}render(){const e=this.getSubheading();return i("div",{key:"bf26300a939b4a2a1b401fa7a81593ec745a2a52",class:"expression"},e&&i("limel-header",{key:"f5152a2ca09811540b626965f52f5793e6c99728",subheading:e,onClick:this.handleToggleOperator,class:"clickable-header"}),i("ul",{key:"c4cad750e47e0b6c94d6a76b2a4d8b72e36b3402"},this.expression.exp.map(this.renderChildExpression),i("li",{key:"ddd614f237a0c0314c2977b74a31b365f3251f9d",class:"add-button"},this.renderAddButton(),this.renderAddGroupButton())))}getSubheading(){return this.expression.exp.length<=1?"":this.expression.op===r.AND?"All of these conditions are true":"Any of these conditions are true"}renderAddButton(){const e=this.getAddButtonLabel();return i("limel-button",{label:e,icon:"plus_math",onClick:this.handleAddChildExpression})}renderAddGroupButton(){const e=this.getAddGroupButtonLabel();return i("limel-button",{label:e,icon:"tree_structure",onClick:this.handleAddChildGroup})}getAddButtonLabel(){return 0===this.expression.exp.length?"Add a condition":this.expression.op===r.AND?"Add another condition":"Add alternative"}getAddGroupButtonLabel(){return 0===this.expression.exp.length?"Add a group":this.expression.op===r.AND?"Add another group":"Add alternative group"}};a.style='@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}';const h=class{constructor(i){e(this,i),this.expressionChange=t(this,"expressionChange",7),this.handleExpressionChange=e=>{var t;e.stopPropagation();const i=null!==(t=e.detail)&&void 0!==t?t:void 0;this.expressionChange.emit(void 0!==i?{op:r.NOT,exp:i}:void 0)}}render(){return i("div",{key:"29770b10d0b892750ad2aab3520cec5a82063774",class:"expression"},this.label&&i("limel-header",{key:"9e47d14c6cb526c9c31d67e11a5ed5ec665c7f62",heading:this.label}),i("limebb-lime-query-filter-expression",{key:"943c1529057aa6cc918dc935f1a5782b149351ae",platform:this.platform,context:this.context,label:"Not",limetype:this.limetype,activeLimetype:this.activeLimetype,expression:this.expression.exp,onExpressionChange:this.handleExpressionChange}))}};h.style='@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))}';const c=class{constructor(i){e(this,i),this.change=t(this,"change",7),this.label="Value",this.inputMode="value",this.handleTextChange=e=>{e.stopPropagation();const t=e.detail,i=Number(t);Number.isNaN(i)||""===t?this.change.emit(t):this.change.emit(i)},this.handleSelectChange=e=>{e.stopPropagation();const t=e.detail;Array.isArray(t)?this.change.emit(t.map((e=>e.value))):this.change.emit(null==t?void 0:t.value)},this.handleBooleanChange=e=>{e.stopPropagation();const t=e.detail;Array.isArray(t)||this.change.emit("true"===(null==t?void 0:t.value))},this.handleDateChange=e=>{e.stopPropagation();const t=e.detail;this.change.emit(t?t.toISOString():null)},this.handleMultiValueChange=e=>{e.stopPropagation();const t=e.detail.split(",").map((e=>e.trim())).filter((e=>e.length>0));this.change.emit(t)},this.handleModeToggle=()=>{"value"===this.inputMode?(this.inputMode="placeholder",this.change.emit("%activeObject%")):(this.inputMode="value",this.change.emit(""))},this.handlePlaceholderPropertyChange=e=>{e.stopPropagation();const t=this.buildPlaceholderValue(e.detail);this.change.emit(t)}}componentWillLoad(){this.isPlaceholder(this.value)&&(this.inputMode="placeholder")}componentWillUpdate(){this.isPlaceholder(this.value)&&"placeholder"!==this.inputMode?this.inputMode="placeholder":this.isPlaceholder(this.value)||"placeholder"!==this.inputMode||(this.inputMode="value")}isPlaceholder(e){return"string"==typeof e&&e.startsWith("%activeObject%")}parsePlaceholderPath(e){return this.isPlaceholder(e)?e.replace(/^%activeObject%\.?/,""):""}buildPlaceholderValue(e){return e?`%activeObject%.${e}`:"%activeObject%"}render(){return this.operator?i("div",{class:"value-input-container"},this.renderModeToggle(),"placeholder"===this.inputMode?this.renderPlaceholderInput():this.renderValueInputByType()):null}renderModeToggle(){if(!this.activeLimetype)return null;const e="placeholder"===this.inputMode;return i("limel-icon-button",{class:"mode-toggle",icon:e?"text":"link",label:e?"Use Value":"Use Placeholder",onClick:this.handleModeToggle})}renderPlaceholderInput(){const e=this.parsePlaceholderPath(this.value);return i("div",{class:"placeholder-input"},i("limebb-property-selector",{platform:this.platform,context:this.context,limetype:this.activeLimetype,label:"Active Object Property",value:e,required:!1,helperText:"Select property from the active object",onChange:this.handlePlaceholderPropertyChange}),this.isPlaceholder(this.value)&&i("div",{class:"placeholder-preview"},i("limel-icon",{name:"info",size:"small"}),i("span",null,"Placeholder: ",this.value)))}renderValueInputByType(){if(this.operator===r.IN)return this.renderMultiValueInput();const e=this.getProperty();if(!e)return this.renderTextInput();switch(e.type){case"integer":case"decimal":return this.renderNumberInput(e.type);case"yesno":return this.renderBooleanInput();case"option":return this.renderOptionInput(e);case"date":return this.renderDateInput();case"time":return this.renderTimeInput();default:return this.renderTextInput()}}renderTextInput(){var e;return i("limel-input-field",{label:this.label,value:(null===(e=this.value)||void 0===e?void 0:e.toString())||"",placeholder:"Enter value",onChange:this.handleTextChange})}renderNumberInput(e){var t;const r="integer"===e?1:.01;return i("limel-input-field",{label:this.label,type:"number",value:(null===(t=this.value)||void 0===t?void 0:t.toString())||"",step:r,onChange:this.handleTextChange})}renderBooleanInput(){const e=[{text:"True",value:"true"},{text:"False",value:"false"}],t=!0===this.value||"true"===this.value?"true":"false",r=e.find((e=>e.value===t));return i("limel-select",{label:this.label,options:e,value:r,onChange:this.handleBooleanChange})}renderOptionInput(e){if(!e.options||0===e.options.length)return this.renderTextInput();const t=e.options.map((e=>({text:e.text||e.key,value:e.key}))),r=t.find((e=>e.value===this.value));return i("limel-select",{label:this.label,options:t,value:r,onChange:this.handleSelectChange})}renderDateInput(){const e="string"==typeof this.value?new Date(this.value):this.value;return i("limel-date-picker",{label:this.label,value:e,onChange:this.handleDateChange})}renderTimeInput(){return i("limel-input-field",{label:this.label,type:"time",value:this.value||"",onChange:this.handleTextChange})}renderMultiValueInput(){const e=Array.isArray(this.value)?this.value.join(", "):this.value||"";return i("limel-input-field",{label:this.label+" (comma-separated)",value:e,placeholder:"e.g., won, lost, tender",onChange:this.handleMultiValueChange})}getProperty(){if(this.limetypes&&this.limetype&&this.propertyPath)return l(this.limetypes,this.limetype,this.propertyPath)}};(function(e,t,i,r){var s,l=arguments.length,o=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var n=e.length-1;n>=0;n--)(s=e[n])&&(o=(l<3?s(o):l>3?s(t,i,o):s(t,i))||o);l>3&&o&&Object.defineProperty(t,i,o)})([s()],c.prototype,"limetypes",void 0),c.style=":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}";export{a as limebb_lime_query_filter_group,h as limebb_lime_query_filter_not,c as limebb_lime_query_value_input}
|