@form-flow/core 1.1.0 → 2.0.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/README.md +76 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/dist/models/field-definition.d.ts +11 -7
- package/dist/models/field-definition.d.ts.map +1 -1
- package/dist/models/form-definition.d.ts +6 -6
- package/dist/models/form-definition.d.ts.map +1 -1
- package/dist/models/operator-registry.d.ts +3 -3
- package/dist/models/operator-registry.d.ts.map +1 -1
- package/dist/models/operator-registry.js.map +1 -1
- package/dist/models/operators.d.ts +4 -3
- package/dist/models/operators.d.ts.map +1 -1
- package/dist/models/operators.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,64 @@ pnpm add @form-flow/core
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
+
## Breaking Changes v2.0.0
|
|
38
|
+
|
|
39
|
+
### `FieldControlType` is now generic
|
|
40
|
+
|
|
41
|
+
`FieldControlType` no longer represents only the built-in control types. It now accepts custom control types through a generic parameter.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
type FieldControlType<TCustom extends string = never> =
|
|
45
|
+
BuiltInFieldControlType | Exclude<TCustom, BuiltInFieldControlType>;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This means:
|
|
49
|
+
|
|
50
|
+
- use `BuiltInFieldControlType` when you need the built-in union only
|
|
51
|
+
- use `FieldControlType<"myCustomType" | "anotherType">` for built-in + custom types
|
|
52
|
+
- stop using `CustomFieldControlType` in new code; it is still exported only as a deprecated compatibility alias
|
|
53
|
+
|
|
54
|
+
Migration examples:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// Before
|
|
58
|
+
type BuiltInOnly = FieldControlType;
|
|
59
|
+
type AllControls = CustomFieldControlType<"rating" | "currency">;
|
|
60
|
+
|
|
61
|
+
// After
|
|
62
|
+
type BuiltInOnly = BuiltInFieldControlType;
|
|
63
|
+
type AllControls = FieldControlType<"rating" | "currency">;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Custom field definition example:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
type AppFieldTypes = "switch" | "slider" | "radio";
|
|
70
|
+
|
|
71
|
+
const fields: FieldDefinition<AppFieldTypes>[] = [
|
|
72
|
+
|
|
73
|
+
];
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If your code relied on `FieldControlType` being built-in only, this is a breaking change and you should migrate those usages to `BuiltInFieldControlType`.
|
|
77
|
+
|
|
78
|
+
### `FORM_FLOW_OPERATORS_MAP` is no longer publicly exported
|
|
79
|
+
|
|
80
|
+
The package root no longer exposes `FORM_FLOW_OPERATORS_MAP` as part of the public API.
|
|
81
|
+
|
|
82
|
+
Use `FormFlowOperatorRegistry` instead:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { FormFlowOperatorRegistry } from "@form-flow/core";
|
|
86
|
+
|
|
87
|
+
const operators = FormFlowOperatorRegistry.getAll();
|
|
88
|
+
const eqOperator = FormFlowOperatorRegistry.get("eq");
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If you were importing `FORM_FLOW_OPERATORS_MAP` from `@form-flow/core`, this is a breaking change and you should migrate those usages to `FormFlowOperatorRegistry`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
37
95
|
## 📖 Quick Start
|
|
38
96
|
|
|
39
97
|
### Basic Example
|
|
@@ -231,26 +289,37 @@ console.log(availableRules); // ["disabledIf", "readonlyIf"]
|
|
|
231
289
|
### Type Definitions
|
|
232
290
|
|
|
233
291
|
```ts
|
|
234
|
-
type
|
|
292
|
+
type BuiltInFieldControlType =
|
|
293
|
+
| "text"
|
|
294
|
+
| "number"
|
|
295
|
+
| "date"
|
|
296
|
+
| "singleSelect"
|
|
297
|
+
| "multipleSelect"
|
|
298
|
+
| "checkbox";
|
|
299
|
+
|
|
300
|
+
type FieldControlType<TCustom extends string = never> =
|
|
301
|
+
BuiltInFieldControlType | Exclude<TCustom, BuiltInFieldControlType>;
|
|
302
|
+
|
|
303
|
+
type BaseFieldDefinition<TCustom extends string = never> = {
|
|
235
304
|
id: string;
|
|
236
|
-
type:
|
|
305
|
+
type: FieldControlType<TCustom>;
|
|
237
306
|
label: string;
|
|
238
307
|
};
|
|
239
308
|
|
|
240
309
|
// Field with conditional rules
|
|
241
|
-
type FieldDefinition<
|
|
310
|
+
type FieldDefinition<TCustom extends string = never> = BaseFieldDefinition<TCustom> & {
|
|
242
311
|
visibleIf?: FieldRuleGroupDefinition;
|
|
243
312
|
requiredIf?: FieldRuleGroupDefinition;
|
|
244
313
|
disabledIf?: FieldRuleGroupDefinition;
|
|
245
314
|
readonlyIf?: FieldRuleGroupDefinition;
|
|
246
315
|
};
|
|
247
316
|
|
|
248
|
-
type RuleContextFieldDefinition<
|
|
317
|
+
type RuleContextFieldDefinition<TCustom extends string = never> = BaseFieldDefinition<TCustom>;
|
|
249
318
|
|
|
250
|
-
type FormFlowDefinition<
|
|
319
|
+
type FormFlowDefinition<TCustom extends string = never> = {
|
|
251
320
|
formId: string;
|
|
252
|
-
fields: FieldDefinition<
|
|
253
|
-
ruleContextFields?: RuleContextFieldDefinition<
|
|
321
|
+
fields: FieldDefinition<TCustom>[];
|
|
322
|
+
ruleContextFields?: RuleContextFieldDefinition<TCustom>[];
|
|
254
323
|
};
|
|
255
324
|
|
|
256
325
|
// Atomic rule
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { type FormFlowDefinition, type FormFlowSchema, type FormFlowValues, } fr
|
|
|
3
3
|
export { type FieldRuleGroupDefinition, type FieldRuleNode, type LogicalOperator, } from './models/group';
|
|
4
4
|
export { type FieldRuleDefinition } from './models/rule';
|
|
5
5
|
export { RuleEvaluator as FormFlowRuleEvaluator } from './rule-evaluator';
|
|
6
|
-
export {
|
|
6
|
+
export { type RuleOperatorKey, type RuleOperatorMeta, type RuleOperatorValueType, } from './models/operators';
|
|
7
7
|
export { OperatorRegistry as FormFlowOperatorRegistry } from './models/operator-registry';
|
|
8
8
|
export { DependencyGraph as FormFlowDependencyGraph } from './dependency-graph';
|
|
9
9
|
export { RuleBuilder as FormFlowRuleBuilder } from './rule-builder';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,eAAe,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,eAAe,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAIzD,OAAO,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,EAEH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,gBAAgB,IAAI,wBAAwB,EAC/C,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAEhF,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// packages/core/src/index.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.FormFlowFieldHelper = exports.FormFlowRuleHelper = exports.FormFlowRuleMapper = exports.FormFlowRuleBuilder = exports.FormFlowDependencyGraph = exports.FormFlowOperatorRegistry = exports.
|
|
4
|
+
exports.FormFlowFieldHelper = exports.FormFlowRuleHelper = exports.FormFlowRuleMapper = exports.FormFlowRuleBuilder = exports.FormFlowDependencyGraph = exports.FormFlowOperatorRegistry = exports.FormFlowRuleEvaluator = void 0;
|
|
5
5
|
// 3. Valutatore ufficiale del sistema
|
|
6
6
|
var rule_evaluator_1 = require("./rule-evaluator");
|
|
7
7
|
Object.defineProperty(exports, "FormFlowRuleEvaluator", { enumerable: true, get: function () { return rule_evaluator_1.RuleEvaluator; } });
|
|
8
|
-
// 4. (Opzionale) operatori configurabili, se vuoi supportare override dal consumer
|
|
9
|
-
var operators_1 = require("./models/operators");
|
|
10
|
-
Object.defineProperty(exports, "FORM_FLOW_OPERATORS_MAP", { enumerable: true, get: function () { return operators_1.FORM_FLOW_OPERATORS_MAP; } });
|
|
11
8
|
var operator_registry_1 = require("./models/operator-registry");
|
|
12
9
|
Object.defineProperty(exports, "FormFlowOperatorRegistry", { enumerable: true, get: function () { return operator_registry_1.OperatorRegistry; } });
|
|
13
10
|
var dependency_graph_1 = require("./dependency-graph");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;AA2B7B,sCAAsC;AACtC,mDAA0E;AAAjE,uHAAA,aAAa,OAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;AA2B7B,sCAAsC;AACtC,mDAA0E;AAAjE,uHAAA,aAAa,OAAyB;AAU/C,gEAEmC;AAD/B,6HAAA,gBAAgB,OAA4B;AAGhD,uDAAgF;AAAvE,2HAAA,eAAe,OAA2B;AAEnD,+CAAoE;AAA3D,mHAAA,WAAW,OAAuB;AAC3C,qDAAyE;AAAhE,iHAAA,UAAU,OAAsB;AACzC,qDAAyE;AAAhE,iHAAA,UAAU,OAAsB;AACzC,uDAA4E;AAAnE,mHAAA,WAAW,OAAuB"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { FieldRuleGroupDefinition } from './group';
|
|
2
|
-
export type
|
|
2
|
+
export type BuiltInFieldControlType = "text" | "number" | "date" | "singleSelect" | "multipleSelect" | "checkbox";
|
|
3
|
+
export type FieldControlType<TCustom extends string = never> = BuiltInFieldControlType | Exclude<TCustom, BuiltInFieldControlType>;
|
|
4
|
+
/** @deprecated Use FieldControlType<TCustom> */
|
|
3
5
|
export type CustomFieldControlType<T extends string = never> = FieldControlType | Exclude<T, FieldControlType>;
|
|
4
6
|
export type ConditionalFieldProperty = "visibleIf" | "requiredIf" | "disabledIf" | "readonlyIf";
|
|
5
7
|
export type FieldListOption = {
|
|
6
8
|
label: string;
|
|
7
9
|
value: any;
|
|
8
10
|
} & Record<string, any>;
|
|
9
|
-
export interface BaseFieldDefinition<
|
|
11
|
+
export interface BaseFieldDefinition<TCustom extends string = never> {
|
|
10
12
|
id: string;
|
|
11
13
|
label: string;
|
|
12
|
-
type:
|
|
14
|
+
type: FieldControlType<TCustom>;
|
|
13
15
|
metadata?: Record<string, any>;
|
|
14
16
|
/**
|
|
15
17
|
* List of available options for fields like select, checkbox, or radio buttons.
|
|
@@ -22,17 +24,19 @@ export interface BaseFieldDefinition<TControl extends FieldControlType = FieldCo
|
|
|
22
24
|
* to its shape using `satisfies` to ensure compatibility while extending it
|
|
23
25
|
* with additional UI-related metadata (e.g. icons, images, tooltips).
|
|
24
26
|
*
|
|
25
|
-
*
|
|
27
|
+
* @example
|
|
26
28
|
*
|
|
29
|
+
* ```tsx
|
|
27
30
|
* const options = [
|
|
28
31
|
* { label: "Startup", value: "startup", icon: "🚀" },
|
|
29
32
|
* { label: "Agency", value: "agency", icon: "🏢" },
|
|
30
33
|
* { label: "Freelancer", value: "freelancer", icon: "🧑💻" }
|
|
31
34
|
* ] satisfies FieldOption[];
|
|
35
|
+
* ```
|
|
32
36
|
*/
|
|
33
37
|
options?: FieldListOption[];
|
|
34
38
|
}
|
|
35
|
-
export interface FieldDefinition<
|
|
39
|
+
export interface FieldDefinition<TCustom extends string = never> extends BaseFieldDefinition<TCustom> {
|
|
36
40
|
defaultValue?: any;
|
|
37
41
|
visibleIf?: FieldRuleGroupDefinition;
|
|
38
42
|
requiredIf?: FieldRuleGroupDefinition;
|
|
@@ -44,10 +48,10 @@ export interface FieldDefinition<TControl extends FieldControlType = FieldContro
|
|
|
44
48
|
* It can be referenced inside conditions, but it is never evaluated as a target
|
|
45
49
|
* control state by the core runtime.
|
|
46
50
|
*/
|
|
47
|
-
export interface RuleContextFieldDefinition<
|
|
51
|
+
export interface RuleContextFieldDefinition<TCustom extends string = never> extends BaseFieldDefinition<TCustom> {
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
|
-
*
|
|
54
|
+
* Represent target field after conditional rules evaluation
|
|
51
55
|
*/
|
|
52
56
|
export interface FieldControlState {
|
|
53
57
|
visible: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-definition.d.ts","sourceRoot":"","sources":["../../src/models/field-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"field-definition.d.ts","sourceRoot":"","sources":["../../src/models/field-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,QAAQ,GACR,MAAM,GACN,cAAc,GACd,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK,IACzD,uBAAuB,GAAG,OAAO,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;AAEtE,gDAAgD;AAChD,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,IACzD,gBAAgB,GAAG,OAAO,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAClD,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhG,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,GAAG,CAAC;CACZ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExB,MAAM,WAAW,mBAAmB,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;KAoBC;IACD,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK,CAC7D,SAAQ,mBAAmB,CAAC,OAAO,CAAC;IACpC,YAAY,CAAC,EAAE,GAAG,CAAC;IAGnB,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK,CACxE,SAAQ,mBAAmB,CAAC,OAAO,CAAC;CAAI;AAG1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FieldDefinition, RuleContextFieldDefinition } from "./field-definition";
|
|
2
2
|
export type FormFlowValues = Record<string, any>;
|
|
3
|
-
export interface FormFlowDefinition<
|
|
3
|
+
export interface FormFlowDefinition<TCustom extends string = never> {
|
|
4
4
|
formId: string;
|
|
5
|
-
fields: FieldDefinition<
|
|
6
|
-
ruleContextFields?: RuleContextFieldDefinition<
|
|
5
|
+
fields: FieldDefinition<TCustom>[];
|
|
6
|
+
ruleContextFields?: RuleContextFieldDefinition<TCustom>[];
|
|
7
7
|
metadata?: Record<string, any>;
|
|
8
8
|
}
|
|
9
|
-
export interface FormFlowSchema<
|
|
10
|
-
definition: FormFlowDefinition<
|
|
9
|
+
export interface FormFlowSchema<TCustom extends string = never> {
|
|
10
|
+
definition: FormFlowDefinition<TCustom>;
|
|
11
11
|
getValues: () => FormFlowValues;
|
|
12
12
|
getFieldValue: (fieldId: keyof FormFlowValues) => any;
|
|
13
13
|
setValues: (values: FormFlowValues, emit?: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-definition.d.ts","sourceRoot":"","sources":["../../src/models/form-definition.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"form-definition.d.ts","sourceRoot":"","sources":["../../src/models/form-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,eAAe,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEzG,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEjD,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK;IAC1D,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAA;IACvC,SAAS,EAAE,MAAM,cAAc,CAAC;IAChC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,cAAc,KAAK,GAAG,CAAC;IACtD,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnF,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuleOperatorKey, RuleOperatorMeta } from "./operators";
|
|
1
|
+
import { RuleOperatorKey, RuleOperatorMeta, RuleOperatorsMap } from "./operators";
|
|
2
2
|
export declare const OperatorRegistry: {
|
|
3
3
|
/**
|
|
4
4
|
* Get the definition of a specific operator by key.
|
|
@@ -7,12 +7,12 @@ export declare const OperatorRegistry: {
|
|
|
7
7
|
/**
|
|
8
8
|
* Get all operator definitions (e.g., for building UI pickers).
|
|
9
9
|
*/
|
|
10
|
-
getAll: () =>
|
|
10
|
+
getAll: () => RuleOperatorsMap;
|
|
11
11
|
/**
|
|
12
12
|
* Register one or more operator overrides or additions.
|
|
13
13
|
* Existing operators with the same key will be replaced.
|
|
14
14
|
*/
|
|
15
|
-
register: (overrides:
|
|
15
|
+
register: (overrides: RuleOperatorsMap) => void;
|
|
16
16
|
/**
|
|
17
17
|
* Reset the registry to the original default operator map.
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-registry.d.ts","sourceRoot":"","sources":["../../src/models/operator-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"operator-registry.d.ts","sourceRoot":"","sources":["../../src/models/operator-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAK3G,eAAO,MAAM,gBAAgB;IACzB;;OAEG;eACQ,eAAe,KAAG,gBAAgB,GAAG,SAAS;IAEzD;;OAEG;kBACS,gBAAgB;IAE5B;;;OAGG;0BACmB,gBAAgB;IAItC;;OAEG;;CAIN,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-registry.js","sourceRoot":"","sources":["../../src/models/operator-registry.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"operator-registry.js","sourceRoot":"","sources":["../../src/models/operator-registry.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB,2CAA2G;AAE3G,4CAA4C;AAC5C,IAAI,QAAQ,GAAqB,EAAE,GAAG,mCAAuB,EAAE,CAAC;AAEnD,QAAA,gBAAgB,GAAG;IAC5B;;OAEG;IACH,GAAG,EAAE,CAAC,GAAoB,EAAgC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC;IAE1E;;OAEG;IACH,MAAM,EAAE,GAAqB,EAAE,CAAC,QAAQ;IAExC;;;OAGG;IACH,QAAQ,EAAE,CAAC,SAA2B,EAAE,EAAE;QACtC,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,KAAK,EAAE,GAAG,EAAE;QACR,QAAQ,GAAG,EAAE,GAAG,mCAAuB,EAAE,CAAC;IAC9C,CAAC;CACJ,CAAC"}
|
|
@@ -24,20 +24,21 @@ export type RuleOperatorValueType = "list" | "single" | "none" | "field" | undef
|
|
|
24
24
|
/**
|
|
25
25
|
* Metadata for describing how an operator behaves.
|
|
26
26
|
*/
|
|
27
|
-
export interface RuleOperatorMeta {
|
|
27
|
+
export interface RuleOperatorMeta<TCustom extends string = never> {
|
|
28
28
|
/** Label to display in the UI (can be customized by consumers). */
|
|
29
29
|
label: string;
|
|
30
30
|
/** Which field types this operator is allowed for. */
|
|
31
|
-
allowedTypes?: FieldControlType[] | "all";
|
|
31
|
+
allowedTypes?: FieldControlType<TCustom>[] | "all";
|
|
32
32
|
/** The type of value this operator requires. */
|
|
33
33
|
valueType?: RuleOperatorValueType;
|
|
34
34
|
/** If true, the operator will be hidden from the UI picker. */
|
|
35
35
|
hideFromPicker?: boolean;
|
|
36
36
|
}
|
|
37
|
+
export type RuleOperatorsMap<TCustom extends string = never> = Partial<Record<RuleOperatorKey, RuleOperatorMeta<TCustom>>>;
|
|
37
38
|
/**
|
|
38
39
|
* Default operator map shipped with `@form-flow/core`.
|
|
39
40
|
* Consumers may override or extend this map at runtime.
|
|
40
41
|
*/
|
|
41
|
-
export declare const FORM_FLOW_OPERATORS_MAP:
|
|
42
|
+
export declare const FORM_FLOW_OPERATORS_MAP: RuleOperatorsMap;
|
|
42
43
|
export {};
|
|
43
44
|
//# sourceMappingURL=operators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/models/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,OAAO,WAAW,CAAC,KAAK,CAAC;AAEvD;;GAEG;AACH,KAAK,mBAAmB,GAAG,KAAK,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,gBAAgB;
|
|
1
|
+
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/models/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD;;GAEG;AACH,KAAK,gBAAgB,GAAG,MAAM,OAAO,WAAW,CAAC,KAAK,CAAC;AAEvD;;GAEG;AACH,KAAK,mBAAmB,GAAG,KAAK,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK;IAC9D,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IAEd,sDAAsD;IACtD,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC;IAEnD,gDAAgD;IAChD,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,KAAK,IACzD,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAoBrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/models/operators.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/models/operators.ts"],"names":[],"mappings":";;;AAoDA;;;GAGG;AACU,QAAA,uBAAuB,GAAqB;IACvD,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS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