@genesislcap/expression-builder 14.483.3-alpha-7a2e689.0 → 14.484.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.
@@ -2,6 +2,12 @@ import { ElementStyles } from '@microsoft/fast-element';
2
2
  import { GenesisElement } from '@genesislcap/web-core';
3
3
  import { ViewTemplate } from '@microsoft/fast-element';
4
4
 
5
+ /** @beta Detail payload for the `add-group` event. */
6
+ export declare type AddGroupEventDetail = EventsDetailMap[Events.AddGroup];
7
+
8
+ /** @beta Detail payload for the `add-rule` event. */
9
+ export declare type AddRuleEventDetail = EventsDetailMap[Events.AddRule];
10
+
5
11
  /**
6
12
  * Basic `AND` and `OR` logical combinators which can be used in the model config.
7
13
  * @beta
@@ -18,6 +24,14 @@ declare type BinaryOperator = {
18
24
  nbInputs: 1;
19
25
  } & _Operator;
20
26
 
27
+ /**
28
+ * @beta Detail payload for the `change` event fired by the expression builder component.
29
+ * Alias of `Types.Group` exposed as a plain identifier: `Group` is otherwise only reachable
30
+ * through the `Types` namespace re-export, which the generated React wrapper's detail-type
31
+ * resolution can't follow.
32
+ */
33
+ export declare type ChangeEventDetail = Group;
34
+
21
35
  /**
22
36
  * Configuration for a boolean-type input, which has a boolean value and a checkbox.
23
37
  * @beta **/
@@ -191,6 +205,64 @@ declare type DateTimeInput = {
191
205
  validation?: (x: unknown) => string | null;
192
206
  };
193
207
 
208
+ /** @beta Detail payload for the `del-group` event. */
209
+ export declare type DelGroupEventDetail = EventsDetailMap[Events.DelGroup];
210
+
211
+ /** @beta Detail payload for the `del-rule` event. */
212
+ export declare type DelRuleEventDetail = EventsDetailMap[Events.DelRule];
213
+
214
+ /** @beta Event names dispatched by the expression builder component family. */
215
+ export declare enum Events {
216
+ AddGroup = "add-group",
217
+ DelGroup = "del-group",
218
+ AddRule = "add-rule",
219
+ DelRule = "del-rule",
220
+ UpdateGroup = "update-group",
221
+ UpdateRule = "update-rule",
222
+ FieldSelected = "field-selected",
223
+ OperatorSelected = "operator-selected",
224
+ ValueUpdated = "value-updated",
225
+ RemoveVarArg = "remove-variadic-operand"
226
+ }
227
+
228
+ /** @beta Maps each event name to the `detail` payload carried by its CustomEvent. */
229
+ export declare type EventsDetailMap = {
230
+ [Events.AddGroup]: {
231
+ parentGroupId: string;
232
+ newGroup: Pick<GroupMetadata, 'level'>;
233
+ };
234
+ [Events.DelGroup]: {
235
+ groupId: string;
236
+ };
237
+ [Events.AddRule]: {
238
+ parentGroupId: string;
239
+ };
240
+ [Events.DelRule]: {
241
+ ruleId: string;
242
+ };
243
+ [Events.UpdateGroup]: {
244
+ groupId: string;
245
+ newData: Omit<Group, 'children'>;
246
+ };
247
+ [Events.UpdateRule]: {
248
+ ruleId: string;
249
+ newData: Rule;
250
+ };
251
+ [Events.FieldSelected]: {
252
+ fieldId: string;
253
+ };
254
+ [Events.OperatorSelected]: {
255
+ operatorId: string;
256
+ };
257
+ [Events.ValueUpdated]: {
258
+ value: any;
259
+ index: number;
260
+ };
261
+ [Events.RemoveVarArg]: {
262
+ index: number;
263
+ };
264
+ };
265
+
194
266
  /**
195
267
  * Top level component to allow the user to build expressions. It produces a generic payload which doesn't have any system by itself
196
268
  * to evaluate or execute the built expression.
@@ -203,13 +275,13 @@ declare type DateTimeInput = {
203
275
  * where you want to use a different (e.g. domain specific) model then it will likely override then emit event and instead emit
204
276
  * it's own model. To check the underlying `Types.Group` model check the {@link ExpressionBuilder.model} property.
205
277
  *
206
- * @fires change - Fired when the expression model changes
207
- * @fires add-group - Bubbled when a nested group add is requested
208
- * @fires del-group - Bubbled when a group delete is requested
209
- * @fires add-rule - Bubbled when a rule add is requested
210
- * @fires del-rule - Bubbled when a rule delete is requested
211
- * @fires update-group - Bubbled when group data changes
212
- * @fires update-rule - Bubbled when rule data changes
278
+ * @fires change - Fired when the expression model changes. detail: `ChangeEventDetail`
279
+ * @fires add-group - Bubbled when a nested group add is requested. detail: `AddGroupEventDetail`
280
+ * @fires del-group - Bubbled when a group delete is requested. detail: `DelGroupEventDetail`
281
+ * @fires add-rule - Bubbled when a rule add is requested. detail: `AddRuleEventDetail`
282
+ * @fires del-rule - Bubbled when a rule delete is requested. detail: `DelRuleEventDetail`
283
+ * @fires update-group - Bubbled when group data changes. detail: `UpdateGroupEventDetail`
284
+ * @fires update-rule - Bubbled when rule data changes. detail: `UpdateRuleEventDetail`
213
285
  *
214
286
  * @beta
215
287
  */
@@ -381,6 +453,9 @@ declare type Field = {
381
453
  operators?: string[];
382
454
  } & FieldTypes;
383
455
 
456
+ /** @beta Detail payload for the `field-selected` event. */
457
+ export declare type FieldSelectedEventDetail = EventsDetailMap[Events.FieldSelected];
458
+
384
459
  /**
385
460
  * Union of all input types
386
461
  * @beta **/
@@ -518,6 +593,12 @@ declare type _Operator = {
518
593
  valueType?: FieldTypes;
519
594
  };
520
595
 
596
+ /** @beta Detail payload for the `operator-selected` event. */
597
+ export declare type OperatorSelectedEventDetail = EventsDetailMap[Events.OperatorSelected];
598
+
599
+ /** @beta Detail payload for the `remove-variadic-operand` event. */
600
+ export declare type RemoveVarArgEventDetail = EventsDetailMap[Events.RemoveVarArg];
601
+
521
602
  /**
522
603
  * A rule is a single constituent element of a larger expression, and is the smallest whole part of an expression.
523
604
  *
@@ -637,6 +718,15 @@ declare type UniraryOperator = {
637
718
  nbInputs: 0;
638
719
  } & _Operator;
639
720
 
721
+ /** @beta Detail payload for the `update-group` event. */
722
+ export declare type UpdateGroupEventDetail = EventsDetailMap[Events.UpdateGroup];
723
+
724
+ /** @beta Detail payload for the `update-rule` event. */
725
+ export declare type UpdateRuleEventDetail = EventsDetailMap[Events.UpdateRule];
726
+
727
+ /** @beta Detail payload for the `value-updated` event. */
728
+ export declare type ValueUpdatedEventDetail = EventsDetailMap[Events.ValueUpdated];
729
+
640
730
  /**
641
731
  * An operator which can have any number of values where `NumVals >= 1`, defaulting to 1. Example `one_of`.
642
732
  * @beta **/
package/dist/react.cjs CHANGED
@@ -118,38 +118,38 @@ const ExpressionRule = React.forwardRef(function ExpressionRule(props, ref) {
118
118
  return React.createElement(customElements.getName(ExpressionRuleWC) ?? 'expression-rule', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
119
119
  });
120
120
 
121
- const RuleOperator = React.forwardRef(function RuleOperator(props, ref) {
122
- const { onOperatorSelected, children, ...rest } = props;
121
+ const RuleField = React.forwardRef(function RuleField(props, ref) {
122
+ const { onFieldSelected, children, ...rest } = props;
123
123
  const _innerRef = React.useRef(null);
124
- const _onOperatorSelectedRef = React.useRef(onOperatorSelected);
125
- _onOperatorSelectedRef.current = onOperatorSelected;
124
+ const _onFieldSelectedRef = React.useRef(onFieldSelected);
125
+ _onFieldSelectedRef.current = onFieldSelected;
126
126
  React.useLayoutEffect(() => {
127
127
  const el = _innerRef.current;
128
128
  if (!el) return;
129
- const _onOperatorSelectedFn = (e) => _onOperatorSelectedRef.current?.(e);
130
- el.addEventListener('operator-selected', _onOperatorSelectedFn);
129
+ const _onFieldSelectedFn = (e) => _onFieldSelectedRef.current?.(e);
130
+ el.addEventListener('field-selected', _onFieldSelectedFn);
131
131
  return () => {
132
- el.removeEventListener('operator-selected', _onOperatorSelectedFn);
132
+ el.removeEventListener('field-selected', _onFieldSelectedFn);
133
133
  };
134
134
  }, []);
135
- return React.createElement(customElements.getName(RuleOperatorWC) ?? 'expression-rule-operator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
135
+ return React.createElement(customElements.getName(RuleFieldWC) ?? 'expression-rule-field', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
136
136
  });
137
137
 
138
- const RuleField = React.forwardRef(function RuleField(props, ref) {
139
- const { onFieldSelected, children, ...rest } = props;
138
+ const RuleOperator = React.forwardRef(function RuleOperator(props, ref) {
139
+ const { onOperatorSelected, children, ...rest } = props;
140
140
  const _innerRef = React.useRef(null);
141
- const _onFieldSelectedRef = React.useRef(onFieldSelected);
142
- _onFieldSelectedRef.current = onFieldSelected;
141
+ const _onOperatorSelectedRef = React.useRef(onOperatorSelected);
142
+ _onOperatorSelectedRef.current = onOperatorSelected;
143
143
  React.useLayoutEffect(() => {
144
144
  const el = _innerRef.current;
145
145
  if (!el) return;
146
- const _onFieldSelectedFn = (e) => _onFieldSelectedRef.current?.(e);
147
- el.addEventListener('field-selected', _onFieldSelectedFn);
146
+ const _onOperatorSelectedFn = (e) => _onOperatorSelectedRef.current?.(e);
147
+ el.addEventListener('operator-selected', _onOperatorSelectedFn);
148
148
  return () => {
149
- el.removeEventListener('field-selected', _onFieldSelectedFn);
149
+ el.removeEventListener('operator-selected', _onOperatorSelectedFn);
150
150
  };
151
151
  }, []);
152
- return React.createElement(customElements.getName(RuleFieldWC) ?? 'expression-rule-field', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
152
+ return React.createElement(customElements.getName(RuleOperatorWC) ?? 'expression-rule-operator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
153
153
  });
154
154
 
155
155
  const RuleValue = React.forwardRef(function RuleValue(props, ref) {
@@ -178,7 +178,7 @@ module.exports = {
178
178
  ExpressionBuilder,
179
179
  ExpressionGroup,
180
180
  ExpressionRule,
181
- RuleOperator,
182
181
  RuleField,
182
+ RuleOperator,
183
183
  RuleValue,
184
184
  };
package/dist/react.mjs CHANGED
@@ -116,38 +116,38 @@ export const ExpressionRule = React.forwardRef(function ExpressionRule(props, re
116
116
  return React.createElement(customElements.getName(ExpressionRuleWC) ?? 'expression-rule', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
117
117
  });
118
118
 
119
- export const RuleOperator = React.forwardRef(function RuleOperator(props, ref) {
120
- const { onOperatorSelected, children, ...rest } = props;
119
+ export const RuleField = React.forwardRef(function RuleField(props, ref) {
120
+ const { onFieldSelected, children, ...rest } = props;
121
121
  const _innerRef = React.useRef(null);
122
- const _onOperatorSelectedRef = React.useRef(onOperatorSelected);
123
- _onOperatorSelectedRef.current = onOperatorSelected;
122
+ const _onFieldSelectedRef = React.useRef(onFieldSelected);
123
+ _onFieldSelectedRef.current = onFieldSelected;
124
124
  React.useLayoutEffect(() => {
125
125
  const el = _innerRef.current;
126
126
  if (!el) return;
127
- const _onOperatorSelectedFn = (e) => _onOperatorSelectedRef.current?.(e);
128
- el.addEventListener('operator-selected', _onOperatorSelectedFn);
127
+ const _onFieldSelectedFn = (e) => _onFieldSelectedRef.current?.(e);
128
+ el.addEventListener('field-selected', _onFieldSelectedFn);
129
129
  return () => {
130
- el.removeEventListener('operator-selected', _onOperatorSelectedFn);
130
+ el.removeEventListener('field-selected', _onFieldSelectedFn);
131
131
  };
132
132
  }, []);
133
- return React.createElement(customElements.getName(RuleOperatorWC) ?? 'expression-rule-operator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
133
+ return React.createElement(customElements.getName(RuleFieldWC) ?? 'expression-rule-field', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
134
134
  });
135
135
 
136
- export const RuleField = React.forwardRef(function RuleField(props, ref) {
137
- const { onFieldSelected, children, ...rest } = props;
136
+ export const RuleOperator = React.forwardRef(function RuleOperator(props, ref) {
137
+ const { onOperatorSelected, children, ...rest } = props;
138
138
  const _innerRef = React.useRef(null);
139
- const _onFieldSelectedRef = React.useRef(onFieldSelected);
140
- _onFieldSelectedRef.current = onFieldSelected;
139
+ const _onOperatorSelectedRef = React.useRef(onOperatorSelected);
140
+ _onOperatorSelectedRef.current = onOperatorSelected;
141
141
  React.useLayoutEffect(() => {
142
142
  const el = _innerRef.current;
143
143
  if (!el) return;
144
- const _onFieldSelectedFn = (e) => _onFieldSelectedRef.current?.(e);
145
- el.addEventListener('field-selected', _onFieldSelectedFn);
144
+ const _onOperatorSelectedFn = (e) => _onOperatorSelectedRef.current?.(e);
145
+ el.addEventListener('operator-selected', _onOperatorSelectedFn);
146
146
  return () => {
147
- el.removeEventListener('field-selected', _onFieldSelectedFn);
147
+ el.removeEventListener('operator-selected', _onOperatorSelectedFn);
148
148
  };
149
149
  }, []);
150
- return React.createElement(customElements.getName(RuleFieldWC) ?? 'expression-rule-field', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
150
+ return React.createElement(customElements.getName(RuleOperatorWC) ?? 'expression-rule-operator', { ...rest, ref: _mergeRefs(_innerRef, ref) }, children);
151
151
  });
152
152
 
153
153
  export const RuleValue = React.forwardRef(function RuleValue(props, ref) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/expression-builder",
3
3
  "description": "Genesis Foundation Expression Builder",
4
- "version": "14.483.3-alpha-7a2e689.0",
4
+ "version": "14.484.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/expression-builder.d.ts",
@@ -38,16 +38,16 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@genesislcap/foundation-testing": "14.483.3-alpha-7a2e689.0",
42
- "@genesislcap/genx": "14.483.3-alpha-7a2e689.0",
43
- "@genesislcap/rollup-builder": "14.483.3-alpha-7a2e689.0",
44
- "@genesislcap/ts-builder": "14.483.3-alpha-7a2e689.0",
45
- "@genesislcap/uvu-playwright-builder": "14.483.3-alpha-7a2e689.0",
46
- "@genesislcap/vite-builder": "14.483.3-alpha-7a2e689.0",
47
- "@genesislcap/webpack-builder": "14.483.3-alpha-7a2e689.0"
41
+ "@genesislcap/foundation-testing": "14.484.0",
42
+ "@genesislcap/genx": "14.484.0",
43
+ "@genesislcap/rollup-builder": "14.484.0",
44
+ "@genesislcap/ts-builder": "14.484.0",
45
+ "@genesislcap/uvu-playwright-builder": "14.484.0",
46
+ "@genesislcap/vite-builder": "14.484.0",
47
+ "@genesislcap/webpack-builder": "14.484.0"
48
48
  },
49
49
  "dependencies": {
50
- "@genesislcap/web-core": "14.483.3-alpha-7a2e689.0",
50
+ "@genesislcap/web-core": "14.484.0",
51
51
  "rfdc": "1.4.1"
52
52
  },
53
53
  "repository": {
@@ -70,5 +70,5 @@
70
70
  "require": "./dist/react.cjs"
71
71
  }
72
72
  },
73
- "gitHead": "a42f1a2c0cea394164712c9abdeb96f58775d5e7"
73
+ "gitHead": "1ec7b2318e2447c2cd3ad877666b6fd1f3b87c05"
74
74
  }