@ng-forge/dynamic-form-mcp 1.3.0-next.4 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ng-forge-mcp.js +1511 -419
- package/package.json +6 -6
- package/src/index.js +1511 -419
- package/src/registry/instructions.d.ts +1 -1
- package/src/registry/instructions.d.ts.map +1 -1
- package/src/tools/examples.tool.d.ts +1 -1
- package/src/tools/examples.tool.d.ts.map +1 -1
package/src/index.js
CHANGED
|
@@ -84,7 +84,7 @@ var FIELD_TYPES = [
|
|
|
84
84
|
multiple: {
|
|
85
85
|
name: "multiple",
|
|
86
86
|
type: "boolean",
|
|
87
|
-
description: "Allow multiple selections",
|
|
87
|
+
description: "Allow multiple selections. The value becomes an array of the selected values",
|
|
88
88
|
required: false,
|
|
89
89
|
default: false
|
|
90
90
|
}
|
|
@@ -3263,6 +3263,8 @@ Evaluates a JavaScript expression with access to \`formValue\`, \`fieldValue\`,
|
|
|
3263
3263
|
}
|
|
3264
3264
|
\`\`\`
|
|
3265
3265
|
|
|
3266
|
+
**Expression syntax** (javascript conditions and derivations): property access with \`?.\`, arithmetic, comparisons, \`&&\`, \`||\`, \`!\`, \`??\`, ternaries, array and object literals, and arrow functions as method arguments (\`formValue.items.some(i => i.done)\`). Mixing \`??\` with \`&&\` or \`||\` needs parentheses, as in JavaScript. Methods are limited to safe string, number, array and date methods (\`toFixed\`, \`includes\`, \`map\`, \`getFullYear\`, ...). There are no statements, no \`new\`, no direct function calls (\`parseInt(x)\`, \`String(x)\`) and no globals (\`Math\`, \`Date\`, \`JSON\`): an unknown name reads as \`undefined\`. Use a number input (\`props: { type: 'number' }\`) instead of parsing, and a custom function for anything else. The validator (MCP or CLI) reports an expression that breaks these rules, with its path, under \`core/expression-syntax\`, and in dev mode the library warns about it at startup.
|
|
3267
|
+
|
|
3266
3268
|
**Condition scoping:** in logic conditions, \`formValue\` is the whole form value regardless of where the field sits, except inside array items where it is scoped to the current item (use \`rootFormValue\` for the rest of the form). Reference group-nested fields by their full path, e.g. \`formValue.person.firstName\`. Note that \`derivation\` expressions scope differently: there \`formValue\` is also scoped to the parent group for group-nested fields.
|
|
3267
3269
|
|
|
3268
3270
|
#### Custom Condition
|
|
@@ -3333,6 +3335,8 @@ Combine conditions with \`and\` (all must be true) or \`or\` (at least one must
|
|
|
3333
3335
|
}
|
|
3334
3336
|
\`\`\`
|
|
3335
3337
|
|
|
3338
|
+
An empty \`conditions\` array evaluates to false, so an empty group never fires. Dev mode warns about it at startup.
|
|
3339
|
+
|
|
3336
3340
|
## UI Library Integration
|
|
3337
3341
|
|
|
3338
3342
|
ng-forge supports multiple UI libraries. Configure in \`app.config.ts\`:
|
|
@@ -5453,7 +5457,7 @@ var BaseFormConfigSchema = z19.object({
|
|
|
5453
5457
|
});
|
|
5454
5458
|
|
|
5455
5459
|
// internal/dynamic-forms-validation/validate/src/json-schema/form-config-json-schema.ts
|
|
5456
|
-
import { z as
|
|
5460
|
+
import { z as z59 } from "zod";
|
|
5457
5461
|
|
|
5458
5462
|
// internal/dynamic-forms-validation/material/src/props/mat-common-props.schema.ts
|
|
5459
5463
|
import { z as z20 } from "zod";
|
|
@@ -5776,17 +5780,43 @@ var MatButtonPropsSchema = z30.object({
|
|
|
5776
5780
|
});
|
|
5777
5781
|
|
|
5778
5782
|
// internal/dynamic-forms-validation/material/src/fields/mat-input-field.schema.ts
|
|
5783
|
+
import { z as z32 } from "zod";
|
|
5784
|
+
|
|
5785
|
+
// internal/dynamic-forms-validation/src/lib/schemas/field/input-value.schema.ts
|
|
5779
5786
|
import { z as z31 } from "zod";
|
|
5787
|
+
var InputValueSchema = z31.union([z31.string(), z31.number()]).nullable().optional();
|
|
5788
|
+
var inputValueTypeRefine = (data, ctx) => {
|
|
5789
|
+
if (!data || typeof data !== "object") return;
|
|
5790
|
+
const field = data;
|
|
5791
|
+
if (field.type !== "input") return;
|
|
5792
|
+
const numeric = field.props?.type === "number";
|
|
5793
|
+
if (typeof field.value === "number" && !numeric) {
|
|
5794
|
+
ctx.addIssue({
|
|
5795
|
+
code: z31.ZodIssueCode.custom,
|
|
5796
|
+
path: ["value"],
|
|
5797
|
+
message: "A number value needs `props: { type: 'number' }`. Other input types hold strings."
|
|
5798
|
+
});
|
|
5799
|
+
}
|
|
5800
|
+
if (typeof field.value === "string" && numeric) {
|
|
5801
|
+
ctx.addIssue({
|
|
5802
|
+
code: z31.ZodIssueCode.custom,
|
|
5803
|
+
path: ["value"],
|
|
5804
|
+
message: "An input with `props: { type: 'number' }` holds a number, not a string."
|
|
5805
|
+
});
|
|
5806
|
+
}
|
|
5807
|
+
};
|
|
5808
|
+
|
|
5809
|
+
// internal/dynamic-forms-validation/material/src/fields/mat-input-field.schema.ts
|
|
5780
5810
|
var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5781
5811
|
/**
|
|
5782
5812
|
* Field type discriminant.
|
|
5783
5813
|
*/
|
|
5784
|
-
type:
|
|
5785
|
-
nullable:
|
|
5814
|
+
type: z32.literal("input"),
|
|
5815
|
+
nullable: z32.boolean().optional(),
|
|
5786
5816
|
/**
|
|
5787
5817
|
* Initial value for the input.
|
|
5788
5818
|
*/
|
|
5789
|
-
value:
|
|
5819
|
+
value: InputValueSchema,
|
|
5790
5820
|
/**
|
|
5791
5821
|
* Placeholder text (can also be in props).
|
|
5792
5822
|
*/
|
|
@@ -5796,20 +5826,20 @@ var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5796
5826
|
*/
|
|
5797
5827
|
props: MatInputPropsSchema.optional()
|
|
5798
5828
|
});
|
|
5799
|
-
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5829
|
+
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
5800
5830
|
|
|
5801
5831
|
// internal/dynamic-forms-validation/material/src/fields/mat-textarea-field.schema.ts
|
|
5802
|
-
import { z as
|
|
5832
|
+
import { z as z33 } from "zod";
|
|
5803
5833
|
var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5804
5834
|
/**
|
|
5805
5835
|
* Field type discriminant.
|
|
5806
5836
|
*/
|
|
5807
|
-
type:
|
|
5808
|
-
nullable:
|
|
5837
|
+
type: z33.literal("textarea"),
|
|
5838
|
+
nullable: z33.boolean().optional(),
|
|
5809
5839
|
/**
|
|
5810
5840
|
* Initial value for the textarea.
|
|
5811
5841
|
*/
|
|
5812
|
-
value:
|
|
5842
|
+
value: z33.string().nullable().optional(),
|
|
5813
5843
|
/**
|
|
5814
5844
|
* Placeholder text (can also be in props).
|
|
5815
5845
|
*/
|
|
@@ -5822,18 +5852,18 @@ var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationS
|
|
|
5822
5852
|
var MatTextareaFieldSchema = MatTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5823
5853
|
|
|
5824
5854
|
// internal/dynamic-forms-validation/material/src/fields/mat-select-field.schema.ts
|
|
5825
|
-
import { z as
|
|
5855
|
+
import { z as z34 } from "zod";
|
|
5826
5856
|
var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5827
5857
|
/**
|
|
5828
5858
|
* Field type discriminant.
|
|
5829
5859
|
*/
|
|
5830
|
-
type:
|
|
5831
|
-
nullable:
|
|
5860
|
+
type: z34.literal("select"),
|
|
5861
|
+
nullable: z34.boolean().optional(),
|
|
5832
5862
|
/**
|
|
5833
5863
|
* Initial value for the select.
|
|
5834
5864
|
* Can be single value or array if multiple is enabled.
|
|
5835
5865
|
*/
|
|
5836
|
-
value:
|
|
5866
|
+
value: z34.unknown().nullable().optional(),
|
|
5837
5867
|
/**
|
|
5838
5868
|
* Placeholder text (can also be in props).
|
|
5839
5869
|
*/
|
|
@@ -5850,16 +5880,16 @@ var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5850
5880
|
var MatSelectFieldSchema = MatSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5851
5881
|
|
|
5852
5882
|
// internal/dynamic-forms-validation/material/src/fields/mat-checkbox-field.schema.ts
|
|
5853
|
-
import { z as
|
|
5883
|
+
import { z as z35 } from "zod";
|
|
5854
5884
|
var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5855
5885
|
/**
|
|
5856
5886
|
* Field type discriminant.
|
|
5857
5887
|
*/
|
|
5858
|
-
type:
|
|
5888
|
+
type: z35.literal("checkbox"),
|
|
5859
5889
|
/**
|
|
5860
5890
|
* Initial checked state.
|
|
5861
5891
|
*/
|
|
5862
|
-
value:
|
|
5892
|
+
value: z35.boolean().optional(),
|
|
5863
5893
|
/**
|
|
5864
5894
|
* Placeholder/helper text.
|
|
5865
5895
|
*/
|
|
@@ -5871,17 +5901,17 @@ var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema)
|
|
|
5871
5901
|
});
|
|
5872
5902
|
|
|
5873
5903
|
// internal/dynamic-forms-validation/material/src/fields/mat-radio-field.schema.ts
|
|
5874
|
-
import { z as
|
|
5904
|
+
import { z as z36 } from "zod";
|
|
5875
5905
|
var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5876
5906
|
/**
|
|
5877
5907
|
* Field type discriminant.
|
|
5878
5908
|
*/
|
|
5879
|
-
type:
|
|
5880
|
-
nullable:
|
|
5909
|
+
type: z36.literal("radio"),
|
|
5910
|
+
nullable: z36.boolean().optional(),
|
|
5881
5911
|
/**
|
|
5882
5912
|
* Initial selected value.
|
|
5883
5913
|
*/
|
|
5884
|
-
value:
|
|
5914
|
+
value: z36.unknown().nullable().optional(),
|
|
5885
5915
|
/**
|
|
5886
5916
|
* Placeholder/helper text.
|
|
5887
5917
|
*/
|
|
@@ -5898,17 +5928,17 @@ var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5898
5928
|
var MatRadioFieldSchema = MatRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5899
5929
|
|
|
5900
5930
|
// internal/dynamic-forms-validation/material/src/fields/mat-multi-checkbox-field.schema.ts
|
|
5901
|
-
import { z as
|
|
5931
|
+
import { z as z37 } from "zod";
|
|
5902
5932
|
var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5903
5933
|
/**
|
|
5904
5934
|
* Field type discriminant.
|
|
5905
5935
|
*/
|
|
5906
|
-
type:
|
|
5907
|
-
nullable:
|
|
5936
|
+
type: z37.literal("multi-checkbox"),
|
|
5937
|
+
nullable: z37.boolean().optional(),
|
|
5908
5938
|
/**
|
|
5909
5939
|
* Initial selected values (array).
|
|
5910
5940
|
*/
|
|
5911
|
-
value:
|
|
5941
|
+
value: z37.array(z37.unknown()).nullable().optional(),
|
|
5912
5942
|
/**
|
|
5913
5943
|
* Placeholder/helper text.
|
|
5914
5944
|
*/
|
|
@@ -5925,16 +5955,16 @@ var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValida
|
|
|
5925
5955
|
var MatMultiCheckboxFieldSchema = MatMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5926
5956
|
|
|
5927
5957
|
// internal/dynamic-forms-validation/material/src/fields/mat-toggle-field.schema.ts
|
|
5928
|
-
import { z as
|
|
5958
|
+
import { z as z38 } from "zod";
|
|
5929
5959
|
var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5930
5960
|
/**
|
|
5931
5961
|
* Field type discriminant.
|
|
5932
5962
|
*/
|
|
5933
|
-
type:
|
|
5963
|
+
type: z38.literal("toggle"),
|
|
5934
5964
|
/**
|
|
5935
5965
|
* Initial toggle state.
|
|
5936
5966
|
*/
|
|
5937
|
-
value:
|
|
5967
|
+
value: z38.boolean().optional(),
|
|
5938
5968
|
/**
|
|
5939
5969
|
* Placeholder/helper text.
|
|
5940
5970
|
*/
|
|
@@ -5946,29 +5976,36 @@ var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).e
|
|
|
5946
5976
|
});
|
|
5947
5977
|
|
|
5948
5978
|
// internal/dynamic-forms-validation/material/src/fields/mat-slider-field.schema.ts
|
|
5949
|
-
import { z as
|
|
5979
|
+
import { z as z40 } from "zod";
|
|
5980
|
+
|
|
5981
|
+
// internal/dynamic-forms-validation/src/lib/schemas/field/multi-value.schema.ts
|
|
5982
|
+
import { z as z39 } from "zod";
|
|
5983
|
+
var SliderValueSchema = z39.union([z39.number(), z39.array(z39.number()), z39.object({ lower: z39.number(), upper: z39.number() })]).nullable().optional();
|
|
5984
|
+
var DatepickerValueSchema = z39.union([z39.string(), z39.array(z39.string())]).nullable().optional();
|
|
5985
|
+
|
|
5986
|
+
// internal/dynamic-forms-validation/material/src/fields/mat-slider-field.schema.ts
|
|
5950
5987
|
var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5951
5988
|
/**
|
|
5952
5989
|
* Field type discriminant.
|
|
5953
5990
|
*/
|
|
5954
|
-
type:
|
|
5955
|
-
nullable:
|
|
5991
|
+
type: z40.literal("slider"),
|
|
5992
|
+
nullable: z40.boolean().optional(),
|
|
5956
5993
|
/**
|
|
5957
5994
|
* Initial slider value.
|
|
5958
5995
|
*/
|
|
5959
|
-
value:
|
|
5996
|
+
value: SliderValueSchema,
|
|
5960
5997
|
/**
|
|
5961
5998
|
* Minimum slider value.
|
|
5962
5999
|
*/
|
|
5963
|
-
minValue:
|
|
6000
|
+
minValue: z40.number().optional(),
|
|
5964
6001
|
/**
|
|
5965
6002
|
* Maximum slider value.
|
|
5966
6003
|
*/
|
|
5967
|
-
maxValue:
|
|
6004
|
+
maxValue: z40.number().optional(),
|
|
5968
6005
|
/**
|
|
5969
6006
|
* Step increment.
|
|
5970
6007
|
*/
|
|
5971
|
-
step:
|
|
6008
|
+
step: z40.number().positive().optional(),
|
|
5972
6009
|
/**
|
|
5973
6010
|
* Placeholder/helper text.
|
|
5974
6011
|
*/
|
|
@@ -5981,18 +6018,18 @@ var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5981
6018
|
var MatSliderFieldSchema = MatSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5982
6019
|
|
|
5983
6020
|
// internal/dynamic-forms-validation/material/src/fields/mat-datepicker-field.schema.ts
|
|
5984
|
-
import { z as
|
|
5985
|
-
var DateValueSchema =
|
|
6021
|
+
import { z as z41 } from "zod";
|
|
6022
|
+
var DateValueSchema = z41.union([z41.string(), z41.null()]);
|
|
5986
6023
|
var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5987
6024
|
/**
|
|
5988
6025
|
* Field type discriminant.
|
|
5989
6026
|
*/
|
|
5990
|
-
type:
|
|
5991
|
-
nullable:
|
|
6027
|
+
type: z41.literal("datepicker"),
|
|
6028
|
+
nullable: z41.boolean().optional(),
|
|
5992
6029
|
/**
|
|
5993
6030
|
* Initial date value (ISO string in JSON configs).
|
|
5994
6031
|
*/
|
|
5995
|
-
value:
|
|
6032
|
+
value: DatepickerValueSchema,
|
|
5996
6033
|
/**
|
|
5997
6034
|
* Minimum selectable date.
|
|
5998
6035
|
*/
|
|
@@ -6017,29 +6054,29 @@ var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidatio
|
|
|
6017
6054
|
var MatDatepickerFieldSchema = MatDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6018
6055
|
|
|
6019
6056
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
6020
|
-
import { z as
|
|
6057
|
+
import { z as z43 } from "zod";
|
|
6021
6058
|
|
|
6022
6059
|
// internal/dynamic-forms-validation/src/lib/schemas/field/array-item-template.schema.ts
|
|
6023
|
-
import { z as
|
|
6024
|
-
var FieldLikeSchema =
|
|
6025
|
-
var ArrayItemTemplateSchema =
|
|
6060
|
+
import { z as z42 } from "zod";
|
|
6061
|
+
var FieldLikeSchema = z42.object({ type: z42.string() }).passthrough();
|
|
6062
|
+
var ArrayItemTemplateSchema = z42.union([FieldLikeSchema, z42.array(FieldLikeSchema)]);
|
|
6026
6063
|
|
|
6027
6064
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
6028
|
-
var EventArgSchema =
|
|
6065
|
+
var EventArgSchema = z43.union([z43.string(), z43.number(), z43.boolean(), z43.null(), z43.undefined()]);
|
|
6029
6066
|
var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6030
6067
|
/**
|
|
6031
6068
|
* Field type discriminant.
|
|
6032
6069
|
*/
|
|
6033
|
-
type:
|
|
6070
|
+
type: z43.literal("button"),
|
|
6034
6071
|
/**
|
|
6035
6072
|
* Event type name (string reference to registered event).
|
|
6036
6073
|
* Note: Full event configuration requires runtime setup.
|
|
6037
6074
|
*/
|
|
6038
|
-
event:
|
|
6075
|
+
event: z43.string().optional(),
|
|
6039
6076
|
/**
|
|
6040
6077
|
* Arguments passed to the event constructor.
|
|
6041
6078
|
*/
|
|
6042
|
-
eventArgs:
|
|
6079
|
+
eventArgs: z43.array(EventArgSchema).optional(),
|
|
6043
6080
|
/**
|
|
6044
6081
|
* Material-specific button properties.
|
|
6045
6082
|
*/
|
|
@@ -6050,17 +6087,17 @@ var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6050
6087
|
logic: LogicArraySchema.optional()
|
|
6051
6088
|
});
|
|
6052
6089
|
var MatSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6053
|
-
type:
|
|
6090
|
+
type: z43.literal("submit"),
|
|
6054
6091
|
props: MatButtonPropsSchema.optional(),
|
|
6055
6092
|
logic: LogicArraySchema.optional()
|
|
6056
6093
|
});
|
|
6057
6094
|
var MatNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6058
|
-
type:
|
|
6095
|
+
type: z43.literal("next"),
|
|
6059
6096
|
props: MatButtonPropsSchema.optional(),
|
|
6060
6097
|
logic: LogicArraySchema.optional()
|
|
6061
6098
|
});
|
|
6062
6099
|
var MatPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6063
|
-
type:
|
|
6100
|
+
type: z43.literal("previous"),
|
|
6064
6101
|
props: MatButtonPropsSchema.optional()
|
|
6065
6102
|
});
|
|
6066
6103
|
var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6069,21 +6106,21 @@ var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6069
6106
|
* item, or a list of them for an object item.
|
|
6070
6107
|
*/
|
|
6071
6108
|
template: ArrayItemTemplateSchema,
|
|
6072
|
-
type:
|
|
6109
|
+
type: z43.literal("add-array-item"),
|
|
6073
6110
|
/**
|
|
6074
6111
|
* Key of the array field to add items to.
|
|
6075
6112
|
* If omitted, uses the parent array context.
|
|
6076
6113
|
*/
|
|
6077
|
-
arrayKey:
|
|
6114
|
+
arrayKey: z43.string().optional(),
|
|
6078
6115
|
props: MatButtonPropsSchema.optional()
|
|
6079
6116
|
});
|
|
6080
6117
|
var MatRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6081
|
-
type:
|
|
6118
|
+
type: z43.literal("remove-array-item"),
|
|
6082
6119
|
/**
|
|
6083
6120
|
* Key of the array field to remove items from.
|
|
6084
6121
|
* If omitted, uses the parent array context.
|
|
6085
6122
|
*/
|
|
6086
|
-
arrayKey:
|
|
6123
|
+
arrayKey: z43.string().optional(),
|
|
6087
6124
|
props: MatButtonPropsSchema.optional()
|
|
6088
6125
|
});
|
|
6089
6126
|
var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6092,12 +6129,12 @@ var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6092
6129
|
* item, or a list of them for an object item.
|
|
6093
6130
|
*/
|
|
6094
6131
|
template: ArrayItemTemplateSchema,
|
|
6095
|
-
type:
|
|
6132
|
+
type: z43.literal("prepend-array-item"),
|
|
6096
6133
|
/**
|
|
6097
6134
|
* Key of the array field to prepend items to.
|
|
6098
6135
|
* If omitted, uses the parent array context.
|
|
6099
6136
|
*/
|
|
6100
|
-
arrayKey:
|
|
6137
|
+
arrayKey: z43.string().optional(),
|
|
6101
6138
|
props: MatButtonPropsSchema.optional()
|
|
6102
6139
|
});
|
|
6103
6140
|
var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6106,38 +6143,38 @@ var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6106
6143
|
* item, or a list of them for an object item.
|
|
6107
6144
|
*/
|
|
6108
6145
|
template: ArrayItemTemplateSchema,
|
|
6109
|
-
type:
|
|
6146
|
+
type: z43.literal("insert-array-item"),
|
|
6110
6147
|
/**
|
|
6111
6148
|
* Key of the array field to insert items into.
|
|
6112
6149
|
* If omitted, uses the parent array context.
|
|
6113
6150
|
*/
|
|
6114
|
-
arrayKey:
|
|
6151
|
+
arrayKey: z43.string().optional(),
|
|
6115
6152
|
/**
|
|
6116
6153
|
* Index at which to insert the new item.
|
|
6117
6154
|
*/
|
|
6118
|
-
index:
|
|
6155
|
+
index: z43.number(),
|
|
6119
6156
|
props: MatButtonPropsSchema.optional()
|
|
6120
6157
|
});
|
|
6121
6158
|
var MatPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6122
|
-
type:
|
|
6159
|
+
type: z43.literal("pop-array-item"),
|
|
6123
6160
|
/**
|
|
6124
6161
|
* Key of the array field to pop items from.
|
|
6125
6162
|
*/
|
|
6126
|
-
arrayKey:
|
|
6163
|
+
arrayKey: z43.string(),
|
|
6127
6164
|
props: MatButtonPropsSchema.optional()
|
|
6128
6165
|
});
|
|
6129
6166
|
var MatShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6130
|
-
type:
|
|
6167
|
+
type: z43.literal("shift-array-item"),
|
|
6131
6168
|
/**
|
|
6132
6169
|
* Key of the array field to shift items from.
|
|
6133
6170
|
*/
|
|
6134
|
-
arrayKey:
|
|
6171
|
+
arrayKey: z43.string(),
|
|
6135
6172
|
props: MatButtonPropsSchema.optional()
|
|
6136
6173
|
});
|
|
6137
6174
|
|
|
6138
6175
|
// internal/dynamic-forms-validation/material/src/mat-leaf-field.schema.ts
|
|
6139
|
-
import { z as
|
|
6140
|
-
var MatLeafFieldSchema =
|
|
6176
|
+
import { z as z44 } from "zod";
|
|
6177
|
+
var MatLeafFieldSchema = z44.discriminatedUnion("type", [
|
|
6141
6178
|
// Default fields
|
|
6142
6179
|
TextFieldSchema,
|
|
6143
6180
|
HiddenFieldSchema,
|
|
@@ -6162,7 +6199,7 @@ var MatLeafFieldSchema = z42.discriminatedUnion("type", [
|
|
|
6162
6199
|
MatInsertArrayItemButtonFieldSchema,
|
|
6163
6200
|
MatPopArrayItemButtonFieldSchema,
|
|
6164
6201
|
MatShiftArrayItemButtonFieldSchema
|
|
6165
|
-
]).superRefine(nullableValueRefine);
|
|
6202
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6166
6203
|
|
|
6167
6204
|
// internal/dynamic-forms-validation/material/src/mat-field.schema.ts
|
|
6168
6205
|
var containerSchemas = createContainerSchemas({
|
|
@@ -6175,8 +6212,8 @@ var MatArrayFieldSchema = containerSchemas.ArrayFieldSchema;
|
|
|
6175
6212
|
var MatFieldSchema = containerSchemas.AllFieldsSchema;
|
|
6176
6213
|
|
|
6177
6214
|
// internal/dynamic-forms-validation/material/src/mat-form-config.schema.ts
|
|
6178
|
-
import { z as
|
|
6179
|
-
var MatFormDefaultPropsSchema =
|
|
6215
|
+
import { z as z45 } from "zod";
|
|
6216
|
+
var MatFormDefaultPropsSchema = z45.object({
|
|
6180
6217
|
/**
|
|
6181
6218
|
* Default form field appearance for all fields.
|
|
6182
6219
|
*/
|
|
@@ -6193,15 +6230,15 @@ var MatFormDefaultPropsSchema = z43.object({
|
|
|
6193
6230
|
var MatFormConfigSchema = createFormConfigSchema(MatFieldSchema, MatFormDefaultPropsSchema);
|
|
6194
6231
|
|
|
6195
6232
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6196
|
-
import { z as
|
|
6233
|
+
import { z as z47 } from "zod";
|
|
6197
6234
|
|
|
6198
6235
|
// internal/dynamic-forms-validation/bootstrap/src/props/bs-common-props.schema.ts
|
|
6199
|
-
import { z as
|
|
6200
|
-
var BsSizeSchema =
|
|
6201
|
-
var BsButtonVariantSchema =
|
|
6202
|
-
var BsFormFieldPropsSchema =
|
|
6236
|
+
import { z as z46 } from "zod";
|
|
6237
|
+
var BsSizeSchema = z46.enum(["sm", "lg"]);
|
|
6238
|
+
var BsButtonVariantSchema = z46.enum(["primary", "secondary", "success", "danger", "warning", "info", "light", "dark", "link"]);
|
|
6239
|
+
var BsFormFieldPropsSchema = z46.object({
|
|
6203
6240
|
size: BsSizeSchema.optional(),
|
|
6204
|
-
floatingLabel:
|
|
6241
|
+
floatingLabel: z46.boolean().optional(),
|
|
6205
6242
|
hint: DynamicTextSchema.optional(),
|
|
6206
6243
|
validFeedback: DynamicTextSchema.optional(),
|
|
6207
6244
|
invalidFeedback: DynamicTextSchema.optional()
|
|
@@ -6209,94 +6246,94 @@ var BsFormFieldPropsSchema = z44.object({
|
|
|
6209
6246
|
|
|
6210
6247
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6211
6248
|
var BsInputPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6212
|
-
type:
|
|
6249
|
+
type: z47.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6213
6250
|
placeholder: DynamicTextSchema.optional(),
|
|
6214
|
-
plaintext:
|
|
6251
|
+
plaintext: z47.boolean().optional()
|
|
6215
6252
|
});
|
|
6216
6253
|
var BsTextareaPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6217
|
-
rows:
|
|
6254
|
+
rows: z47.number().positive().optional(),
|
|
6218
6255
|
placeholder: DynamicTextSchema.optional()
|
|
6219
6256
|
});
|
|
6220
6257
|
var BsSelectPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6221
|
-
multiple:
|
|
6222
|
-
htmlSize:
|
|
6258
|
+
multiple: z47.boolean().optional(),
|
|
6259
|
+
htmlSize: z47.number().positive().optional(),
|
|
6223
6260
|
placeholder: DynamicTextSchema.optional()
|
|
6224
6261
|
});
|
|
6225
|
-
var BsCheckboxPropsSchema =
|
|
6226
|
-
switch:
|
|
6227
|
-
inline:
|
|
6228
|
-
reverse:
|
|
6229
|
-
indeterminate:
|
|
6262
|
+
var BsCheckboxPropsSchema = z47.object({
|
|
6263
|
+
switch: z47.boolean().optional(),
|
|
6264
|
+
inline: z47.boolean().optional(),
|
|
6265
|
+
reverse: z47.boolean().optional(),
|
|
6266
|
+
indeterminate: z47.boolean().optional(),
|
|
6230
6267
|
hint: DynamicTextSchema.optional()
|
|
6231
6268
|
});
|
|
6232
|
-
var BsRadioPropsSchema =
|
|
6233
|
-
inline:
|
|
6234
|
-
reverse:
|
|
6235
|
-
buttonGroup:
|
|
6269
|
+
var BsRadioPropsSchema = z47.object({
|
|
6270
|
+
inline: z47.boolean().optional(),
|
|
6271
|
+
reverse: z47.boolean().optional(),
|
|
6272
|
+
buttonGroup: z47.boolean().optional(),
|
|
6236
6273
|
buttonSize: BsSizeSchema.optional(),
|
|
6237
6274
|
hint: DynamicTextSchema.optional()
|
|
6238
6275
|
});
|
|
6239
|
-
var BsMultiCheckboxPropsSchema =
|
|
6240
|
-
switch:
|
|
6241
|
-
inline:
|
|
6242
|
-
reverse:
|
|
6276
|
+
var BsMultiCheckboxPropsSchema = z47.object({
|
|
6277
|
+
switch: z47.boolean().optional(),
|
|
6278
|
+
inline: z47.boolean().optional(),
|
|
6279
|
+
reverse: z47.boolean().optional(),
|
|
6243
6280
|
hint: DynamicTextSchema.optional()
|
|
6244
6281
|
});
|
|
6245
|
-
var BsTogglePropsSchema =
|
|
6282
|
+
var BsTogglePropsSchema = z47.object({
|
|
6246
6283
|
size: BsSizeSchema.optional(),
|
|
6247
|
-
reverse:
|
|
6248
|
-
inline:
|
|
6284
|
+
reverse: z47.boolean().optional(),
|
|
6285
|
+
inline: z47.boolean().optional(),
|
|
6249
6286
|
hint: DynamicTextSchema.optional()
|
|
6250
6287
|
});
|
|
6251
6288
|
var BsDatepickerPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6252
|
-
useNgBootstrap:
|
|
6253
|
-
displayMonths:
|
|
6254
|
-
navigation:
|
|
6255
|
-
outsideDays:
|
|
6256
|
-
showWeekNumbers:
|
|
6289
|
+
useNgBootstrap: z47.boolean().optional(),
|
|
6290
|
+
displayMonths: z47.number().positive().optional(),
|
|
6291
|
+
navigation: z47.enum(["select", "arrows", "none"]).optional(),
|
|
6292
|
+
outsideDays: z47.enum(["visible", "collapsed", "hidden"]).optional(),
|
|
6293
|
+
showWeekNumbers: z47.boolean().optional(),
|
|
6257
6294
|
placeholder: DynamicTextSchema.optional()
|
|
6258
6295
|
});
|
|
6259
|
-
var BsSliderPropsSchema =
|
|
6260
|
-
showValue:
|
|
6261
|
-
valuePrefix:
|
|
6262
|
-
valueSuffix:
|
|
6296
|
+
var BsSliderPropsSchema = z47.object({
|
|
6297
|
+
showValue: z47.boolean().optional(),
|
|
6298
|
+
valuePrefix: z47.string().optional(),
|
|
6299
|
+
valueSuffix: z47.string().optional(),
|
|
6263
6300
|
hint: DynamicTextSchema.optional(),
|
|
6264
|
-
min:
|
|
6265
|
-
max:
|
|
6266
|
-
step:
|
|
6301
|
+
min: z47.number().optional(),
|
|
6302
|
+
max: z47.number().optional(),
|
|
6303
|
+
step: z47.number().positive().optional()
|
|
6267
6304
|
});
|
|
6268
|
-
var BsButtonPropsSchema =
|
|
6305
|
+
var BsButtonPropsSchema = z47.object({
|
|
6269
6306
|
variant: BsButtonVariantSchema.optional(),
|
|
6270
|
-
outline:
|
|
6307
|
+
outline: z47.boolean().optional(),
|
|
6271
6308
|
size: BsSizeSchema.optional(),
|
|
6272
|
-
block:
|
|
6273
|
-
active:
|
|
6274
|
-
type:
|
|
6309
|
+
block: z47.boolean().optional(),
|
|
6310
|
+
active: z47.boolean().optional(),
|
|
6311
|
+
type: z47.enum(["button", "submit", "reset"]).optional()
|
|
6275
6312
|
});
|
|
6276
6313
|
|
|
6277
6314
|
// internal/dynamic-forms-validation/bootstrap/src/fields/index.ts
|
|
6278
|
-
import { z as
|
|
6315
|
+
import { z as z48 } from "zod";
|
|
6279
6316
|
var BsValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6280
6317
|
var BsInputFieldSchemaObject = BsValueFieldBase.extend({
|
|
6281
|
-
type:
|
|
6282
|
-
nullable:
|
|
6283
|
-
value:
|
|
6318
|
+
type: z48.literal("input"),
|
|
6319
|
+
nullable: z48.boolean().optional(),
|
|
6320
|
+
value: InputValueSchema,
|
|
6284
6321
|
placeholder: DynamicTextSchema.optional(),
|
|
6285
6322
|
props: BsInputPropsSchema.optional()
|
|
6286
6323
|
});
|
|
6287
|
-
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6324
|
+
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6288
6325
|
var BsTextareaFieldSchemaObject = BsValueFieldBase.extend({
|
|
6289
|
-
type:
|
|
6290
|
-
nullable:
|
|
6291
|
-
value:
|
|
6326
|
+
type: z48.literal("textarea"),
|
|
6327
|
+
nullable: z48.boolean().optional(),
|
|
6328
|
+
value: z48.string().nullable().optional(),
|
|
6292
6329
|
placeholder: DynamicTextSchema.optional(),
|
|
6293
6330
|
props: BsTextareaPropsSchema.optional()
|
|
6294
6331
|
});
|
|
6295
6332
|
var BsTextareaFieldSchema = BsTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6296
6333
|
var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
6297
|
-
type:
|
|
6298
|
-
nullable:
|
|
6299
|
-
value:
|
|
6334
|
+
type: z48.literal("select"),
|
|
6335
|
+
nullable: z48.boolean().optional(),
|
|
6336
|
+
value: z48.string().nullable().optional(),
|
|
6300
6337
|
// Bootstrap select only supports strings
|
|
6301
6338
|
placeholder: DynamicTextSchema.optional(),
|
|
6302
6339
|
options: FieldOptionsSchema,
|
|
@@ -6304,76 +6341,76 @@ var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
|
6304
6341
|
});
|
|
6305
6342
|
var BsSelectFieldSchema = BsSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6306
6343
|
var BsCheckboxFieldSchema = BsValueFieldBase.extend({
|
|
6307
|
-
type:
|
|
6308
|
-
value:
|
|
6344
|
+
type: z48.literal("checkbox"),
|
|
6345
|
+
value: z48.boolean().optional(),
|
|
6309
6346
|
placeholder: DynamicTextSchema.optional(),
|
|
6310
6347
|
props: BsCheckboxPropsSchema.optional()
|
|
6311
6348
|
});
|
|
6312
6349
|
var BsRadioFieldSchemaObject = BsValueFieldBase.extend({
|
|
6313
|
-
type:
|
|
6314
|
-
nullable:
|
|
6315
|
-
value:
|
|
6350
|
+
type: z48.literal("radio"),
|
|
6351
|
+
nullable: z48.boolean().optional(),
|
|
6352
|
+
value: z48.unknown().nullable().optional(),
|
|
6316
6353
|
placeholder: DynamicTextSchema.optional(),
|
|
6317
6354
|
options: FieldOptionsSchema,
|
|
6318
6355
|
props: BsRadioPropsSchema.optional()
|
|
6319
6356
|
});
|
|
6320
6357
|
var BsRadioFieldSchema = BsRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6321
6358
|
var BsMultiCheckboxFieldSchemaObject = BsValueFieldBase.extend({
|
|
6322
|
-
type:
|
|
6323
|
-
nullable:
|
|
6324
|
-
value:
|
|
6359
|
+
type: z48.literal("multi-checkbox"),
|
|
6360
|
+
nullable: z48.boolean().optional(),
|
|
6361
|
+
value: z48.array(z48.unknown()).nullable().optional(),
|
|
6325
6362
|
placeholder: DynamicTextSchema.optional(),
|
|
6326
6363
|
options: FieldOptionsSchema,
|
|
6327
6364
|
props: BsMultiCheckboxPropsSchema.optional()
|
|
6328
6365
|
});
|
|
6329
6366
|
var BsMultiCheckboxFieldSchema = BsMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6330
6367
|
var BsToggleFieldSchema = BsValueFieldBase.extend({
|
|
6331
|
-
type:
|
|
6332
|
-
value:
|
|
6368
|
+
type: z48.literal("toggle"),
|
|
6369
|
+
value: z48.boolean().optional(),
|
|
6333
6370
|
placeholder: DynamicTextSchema.optional(),
|
|
6334
6371
|
props: BsTogglePropsSchema.optional()
|
|
6335
6372
|
});
|
|
6336
6373
|
var BsDatepickerFieldSchemaObject = BsValueFieldBase.extend({
|
|
6337
|
-
type:
|
|
6338
|
-
nullable:
|
|
6339
|
-
value:
|
|
6340
|
-
minDate:
|
|
6341
|
-
maxDate:
|
|
6342
|
-
startAt:
|
|
6374
|
+
type: z48.literal("datepicker"),
|
|
6375
|
+
nullable: z48.boolean().optional(),
|
|
6376
|
+
value: DatepickerValueSchema,
|
|
6377
|
+
minDate: z48.union([z48.string(), z48.null()]).optional(),
|
|
6378
|
+
maxDate: z48.union([z48.string(), z48.null()]).optional(),
|
|
6379
|
+
startAt: z48.union([z48.string(), z48.null()]).optional(),
|
|
6343
6380
|
placeholder: DynamicTextSchema.optional(),
|
|
6344
6381
|
props: BsDatepickerPropsSchema.optional()
|
|
6345
6382
|
});
|
|
6346
6383
|
var BsDatepickerFieldSchema = BsDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6347
6384
|
var BsSliderFieldSchemaObject = BsValueFieldBase.extend({
|
|
6348
|
-
type:
|
|
6349
|
-
nullable:
|
|
6350
|
-
value:
|
|
6351
|
-
minValue:
|
|
6352
|
-
maxValue:
|
|
6353
|
-
step:
|
|
6385
|
+
type: z48.literal("slider"),
|
|
6386
|
+
nullable: z48.boolean().optional(),
|
|
6387
|
+
value: SliderValueSchema,
|
|
6388
|
+
minValue: z48.number().optional(),
|
|
6389
|
+
maxValue: z48.number().optional(),
|
|
6390
|
+
step: z48.number().positive().optional(),
|
|
6354
6391
|
placeholder: DynamicTextSchema.optional(),
|
|
6355
6392
|
props: BsSliderPropsSchema.optional()
|
|
6356
6393
|
});
|
|
6357
6394
|
var BsSliderFieldSchema = BsSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6358
6395
|
var BsButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6359
|
-
type:
|
|
6360
|
-
event:
|
|
6361
|
-
eventArgs:
|
|
6396
|
+
type: z48.literal("button"),
|
|
6397
|
+
event: z48.string().optional(),
|
|
6398
|
+
eventArgs: z48.array(z48.union([z48.string(), z48.number(), z48.boolean(), z48.null(), z48.undefined()])).optional(),
|
|
6362
6399
|
props: BsButtonPropsSchema.optional(),
|
|
6363
6400
|
logic: LogicArraySchema.optional()
|
|
6364
6401
|
});
|
|
6365
6402
|
var BsSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6366
|
-
type:
|
|
6403
|
+
type: z48.literal("submit"),
|
|
6367
6404
|
props: BsButtonPropsSchema.optional(),
|
|
6368
6405
|
logic: LogicArraySchema.optional()
|
|
6369
6406
|
});
|
|
6370
6407
|
var BsNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6371
|
-
type:
|
|
6408
|
+
type: z48.literal("next"),
|
|
6372
6409
|
props: BsButtonPropsSchema.optional(),
|
|
6373
6410
|
logic: LogicArraySchema.optional()
|
|
6374
6411
|
});
|
|
6375
6412
|
var BsPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6376
|
-
type:
|
|
6413
|
+
type: z48.literal("previous"),
|
|
6377
6414
|
props: BsButtonPropsSchema.optional()
|
|
6378
6415
|
});
|
|
6379
6416
|
var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6382,13 +6419,13 @@ var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6382
6419
|
* item, or a list of them for an object item.
|
|
6383
6420
|
*/
|
|
6384
6421
|
template: ArrayItemTemplateSchema,
|
|
6385
|
-
type:
|
|
6386
|
-
arrayKey:
|
|
6422
|
+
type: z48.literal("add-array-item"),
|
|
6423
|
+
arrayKey: z48.string().optional(),
|
|
6387
6424
|
props: BsButtonPropsSchema.optional()
|
|
6388
6425
|
});
|
|
6389
6426
|
var BsRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6390
|
-
type:
|
|
6391
|
-
arrayKey:
|
|
6427
|
+
type: z48.literal("remove-array-item"),
|
|
6428
|
+
arrayKey: z48.string().optional(),
|
|
6392
6429
|
props: BsButtonPropsSchema.optional()
|
|
6393
6430
|
});
|
|
6394
6431
|
var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6397,8 +6434,8 @@ var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6397
6434
|
* item, or a list of them for an object item.
|
|
6398
6435
|
*/
|
|
6399
6436
|
template: ArrayItemTemplateSchema,
|
|
6400
|
-
type:
|
|
6401
|
-
arrayKey:
|
|
6437
|
+
type: z48.literal("prepend-array-item"),
|
|
6438
|
+
arrayKey: z48.string().optional(),
|
|
6402
6439
|
props: BsButtonPropsSchema.optional()
|
|
6403
6440
|
});
|
|
6404
6441
|
var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6407,25 +6444,25 @@ var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6407
6444
|
* item, or a list of them for an object item.
|
|
6408
6445
|
*/
|
|
6409
6446
|
template: ArrayItemTemplateSchema,
|
|
6410
|
-
type:
|
|
6411
|
-
arrayKey:
|
|
6412
|
-
index:
|
|
6447
|
+
type: z48.literal("insert-array-item"),
|
|
6448
|
+
arrayKey: z48.string().optional(),
|
|
6449
|
+
index: z48.number(),
|
|
6413
6450
|
props: BsButtonPropsSchema.optional()
|
|
6414
6451
|
});
|
|
6415
6452
|
var BsPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6416
|
-
type:
|
|
6417
|
-
arrayKey:
|
|
6453
|
+
type: z48.literal("pop-array-item"),
|
|
6454
|
+
arrayKey: z48.string(),
|
|
6418
6455
|
props: BsButtonPropsSchema.optional()
|
|
6419
6456
|
});
|
|
6420
6457
|
var BsShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6421
|
-
type:
|
|
6422
|
-
arrayKey:
|
|
6458
|
+
type: z48.literal("shift-array-item"),
|
|
6459
|
+
arrayKey: z48.string(),
|
|
6423
6460
|
props: BsButtonPropsSchema.optional()
|
|
6424
6461
|
});
|
|
6425
6462
|
|
|
6426
6463
|
// internal/dynamic-forms-validation/bootstrap/src/bs-leaf-field.schema.ts
|
|
6427
|
-
import { z as
|
|
6428
|
-
var BsLeafFieldSchema =
|
|
6464
|
+
import { z as z49 } from "zod";
|
|
6465
|
+
var BsLeafFieldSchema = z49.discriminatedUnion("type", [
|
|
6429
6466
|
TextFieldSchema,
|
|
6430
6467
|
HiddenFieldSchema,
|
|
6431
6468
|
BsInputFieldSchemaObject,
|
|
@@ -6447,10 +6484,10 @@ var BsLeafFieldSchema = z47.discriminatedUnion("type", [
|
|
|
6447
6484
|
BsInsertArrayItemButtonFieldSchema,
|
|
6448
6485
|
BsPopArrayItemButtonFieldSchema,
|
|
6449
6486
|
BsShiftArrayItemButtonFieldSchema
|
|
6450
|
-
]).superRefine(nullableValueRefine);
|
|
6487
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6451
6488
|
|
|
6452
6489
|
// internal/dynamic-forms-validation/bootstrap/src/bs-form-config.schema.ts
|
|
6453
|
-
import { z as
|
|
6490
|
+
import { z as z50 } from "zod";
|
|
6454
6491
|
var containerSchemas2 = createContainerSchemas({
|
|
6455
6492
|
leafFieldSchema: BsLeafFieldSchema
|
|
6456
6493
|
});
|
|
@@ -6459,173 +6496,173 @@ var BsRowFieldSchema = containerSchemas2.RowFieldSchema;
|
|
|
6459
6496
|
var BsGroupFieldSchema = containerSchemas2.GroupFieldSchema;
|
|
6460
6497
|
var BsArrayFieldSchema = containerSchemas2.ArrayFieldSchema;
|
|
6461
6498
|
var BsFieldSchema = containerSchemas2.AllFieldsSchema;
|
|
6462
|
-
var BsFormDefaultPropsSchema =
|
|
6499
|
+
var BsFormDefaultPropsSchema = z50.object({
|
|
6463
6500
|
size: BsSizeSchema.optional(),
|
|
6464
|
-
floatingLabel:
|
|
6501
|
+
floatingLabel: z50.boolean().optional()
|
|
6465
6502
|
});
|
|
6466
6503
|
var BsFormConfigSchema = createFormConfigSchema(BsFieldSchema, BsFormDefaultPropsSchema);
|
|
6467
6504
|
|
|
6468
6505
|
// internal/dynamic-forms-validation/primeng/src/props/index.ts
|
|
6469
|
-
import { z as
|
|
6470
|
-
var PrimeSeveritySchema =
|
|
6471
|
-
var PrimeCommonPropsSchema =
|
|
6472
|
-
styleClass:
|
|
6506
|
+
import { z as z51 } from "zod";
|
|
6507
|
+
var PrimeSeveritySchema = z51.enum(["primary", "secondary", "success", "info", "warn", "danger", "help", "contrast"]);
|
|
6508
|
+
var PrimeCommonPropsSchema = z51.object({
|
|
6509
|
+
styleClass: z51.string().optional(),
|
|
6473
6510
|
hint: DynamicTextSchema.optional()
|
|
6474
6511
|
});
|
|
6475
6512
|
var PrimeInputPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6476
|
-
type:
|
|
6513
|
+
type: z51.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6477
6514
|
placeholder: DynamicTextSchema.optional(),
|
|
6478
|
-
size:
|
|
6479
|
-
variant:
|
|
6515
|
+
size: z51.enum(["small", "large"]).optional(),
|
|
6516
|
+
variant: z51.enum(["outlined", "filled"]).optional()
|
|
6480
6517
|
});
|
|
6481
6518
|
var PrimeCheckboxPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6482
|
-
binary:
|
|
6483
|
-
trueValue:
|
|
6484
|
-
falseValue:
|
|
6519
|
+
binary: z51.boolean().optional(),
|
|
6520
|
+
trueValue: z51.unknown().optional(),
|
|
6521
|
+
falseValue: z51.unknown().optional()
|
|
6485
6522
|
});
|
|
6486
6523
|
var PrimeRadioPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6487
|
-
name:
|
|
6524
|
+
name: z51.string().optional()
|
|
6488
6525
|
});
|
|
6489
6526
|
var PrimeSelectPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6490
|
-
multiple:
|
|
6491
|
-
filter:
|
|
6527
|
+
multiple: z51.boolean().optional(),
|
|
6528
|
+
filter: z51.boolean().optional(),
|
|
6492
6529
|
placeholder: DynamicTextSchema.optional(),
|
|
6493
|
-
showClear:
|
|
6530
|
+
showClear: z51.boolean().optional()
|
|
6494
6531
|
});
|
|
6495
6532
|
var PrimeMultiCheckboxPropsSchema = PrimeCommonPropsSchema;
|
|
6496
6533
|
var PrimeDatepickerPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6497
|
-
dateFormat:
|
|
6498
|
-
inline:
|
|
6499
|
-
showIcon:
|
|
6500
|
-
showButtonBar:
|
|
6501
|
-
selectionMode:
|
|
6502
|
-
touchUI:
|
|
6503
|
-
view:
|
|
6534
|
+
dateFormat: z51.string().optional(),
|
|
6535
|
+
inline: z51.boolean().optional(),
|
|
6536
|
+
showIcon: z51.boolean().optional(),
|
|
6537
|
+
showButtonBar: z51.boolean().optional(),
|
|
6538
|
+
selectionMode: z51.enum(["single", "multiple", "range"]).optional(),
|
|
6539
|
+
touchUI: z51.boolean().optional(),
|
|
6540
|
+
view: z51.enum(["date", "month", "year"]).optional(),
|
|
6504
6541
|
placeholder: DynamicTextSchema.optional()
|
|
6505
6542
|
});
|
|
6506
6543
|
var PrimeTextareaPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6507
|
-
rows:
|
|
6508
|
-
autoResize:
|
|
6544
|
+
rows: z51.number().positive().optional(),
|
|
6545
|
+
autoResize: z51.boolean().optional(),
|
|
6509
6546
|
placeholder: DynamicTextSchema.optional()
|
|
6510
6547
|
});
|
|
6511
6548
|
var PrimeSliderPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6512
|
-
min:
|
|
6513
|
-
max:
|
|
6514
|
-
step:
|
|
6515
|
-
range:
|
|
6516
|
-
orientation:
|
|
6549
|
+
min: z51.number().optional(),
|
|
6550
|
+
max: z51.number().optional(),
|
|
6551
|
+
step: z51.number().positive().optional(),
|
|
6552
|
+
range: z51.boolean().optional(),
|
|
6553
|
+
orientation: z51.enum(["horizontal", "vertical"]).optional()
|
|
6517
6554
|
});
|
|
6518
6555
|
var PrimeTogglePropsSchema = PrimeCommonPropsSchema;
|
|
6519
|
-
var PrimeButtonPropsSchema =
|
|
6556
|
+
var PrimeButtonPropsSchema = z51.object({
|
|
6520
6557
|
severity: PrimeSeveritySchema.optional(),
|
|
6521
|
-
text:
|
|
6522
|
-
outlined:
|
|
6523
|
-
raised:
|
|
6524
|
-
rounded:
|
|
6525
|
-
icon:
|
|
6526
|
-
iconPos:
|
|
6527
|
-
type:
|
|
6558
|
+
text: z51.boolean().optional(),
|
|
6559
|
+
outlined: z51.boolean().optional(),
|
|
6560
|
+
raised: z51.boolean().optional(),
|
|
6561
|
+
rounded: z51.boolean().optional(),
|
|
6562
|
+
icon: z51.string().optional(),
|
|
6563
|
+
iconPos: z51.enum(["left", "right", "top", "bottom"]).optional(),
|
|
6564
|
+
type: z51.enum(["button", "submit", "reset"]).optional()
|
|
6528
6565
|
});
|
|
6529
6566
|
|
|
6530
6567
|
// internal/dynamic-forms-validation/primeng/src/fields/index.ts
|
|
6531
|
-
import { z as
|
|
6568
|
+
import { z as z52 } from "zod";
|
|
6532
6569
|
var PrimeValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6533
6570
|
var PrimeInputFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6534
|
-
type:
|
|
6535
|
-
nullable:
|
|
6536
|
-
value:
|
|
6571
|
+
type: z52.literal("input"),
|
|
6572
|
+
nullable: z52.boolean().optional(),
|
|
6573
|
+
value: InputValueSchema,
|
|
6537
6574
|
placeholder: DynamicTextSchema.optional(),
|
|
6538
6575
|
props: PrimeInputPropsSchema.optional()
|
|
6539
6576
|
});
|
|
6540
|
-
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6577
|
+
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6541
6578
|
var PrimeCheckboxFieldSchema = PrimeValueFieldBase.extend({
|
|
6542
|
-
type:
|
|
6543
|
-
value:
|
|
6579
|
+
type: z52.literal("checkbox"),
|
|
6580
|
+
value: z52.boolean().optional(),
|
|
6544
6581
|
placeholder: DynamicTextSchema.optional(),
|
|
6545
6582
|
props: PrimeCheckboxPropsSchema.optional()
|
|
6546
6583
|
});
|
|
6547
6584
|
var PrimeRadioFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6548
|
-
type:
|
|
6549
|
-
nullable:
|
|
6550
|
-
value:
|
|
6585
|
+
type: z52.literal("radio"),
|
|
6586
|
+
nullable: z52.boolean().optional(),
|
|
6587
|
+
value: z52.unknown().nullable().optional(),
|
|
6551
6588
|
placeholder: DynamicTextSchema.optional(),
|
|
6552
6589
|
options: FieldOptionsSchema,
|
|
6553
6590
|
props: PrimeRadioPropsSchema.optional()
|
|
6554
6591
|
});
|
|
6555
6592
|
var PrimeRadioFieldSchema = PrimeRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6556
6593
|
var PrimeSelectFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6557
|
-
type:
|
|
6558
|
-
nullable:
|
|
6559
|
-
value:
|
|
6594
|
+
type: z52.literal("select"),
|
|
6595
|
+
nullable: z52.boolean().optional(),
|
|
6596
|
+
value: z52.unknown().nullable().optional(),
|
|
6560
6597
|
placeholder: DynamicTextSchema.optional(),
|
|
6561
6598
|
options: FieldOptionsSchema,
|
|
6562
6599
|
props: PrimeSelectPropsSchema.optional()
|
|
6563
6600
|
});
|
|
6564
6601
|
var PrimeSelectFieldSchema = PrimeSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6565
6602
|
var PrimeMultiCheckboxFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6566
|
-
type:
|
|
6567
|
-
nullable:
|
|
6568
|
-
value:
|
|
6603
|
+
type: z52.literal("multi-checkbox"),
|
|
6604
|
+
nullable: z52.boolean().optional(),
|
|
6605
|
+
value: z52.array(z52.unknown()).nullable().optional(),
|
|
6569
6606
|
placeholder: DynamicTextSchema.optional(),
|
|
6570
6607
|
options: FieldOptionsSchema,
|
|
6571
6608
|
props: PrimeMultiCheckboxPropsSchema.optional()
|
|
6572
6609
|
});
|
|
6573
6610
|
var PrimeMultiCheckboxFieldSchema = PrimeMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6574
6611
|
var PrimeDatepickerFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6575
|
-
type:
|
|
6576
|
-
nullable:
|
|
6577
|
-
value:
|
|
6578
|
-
minDate:
|
|
6579
|
-
maxDate:
|
|
6580
|
-
startAt:
|
|
6612
|
+
type: z52.literal("datepicker"),
|
|
6613
|
+
nullable: z52.boolean().optional(),
|
|
6614
|
+
value: DatepickerValueSchema,
|
|
6615
|
+
minDate: z52.union([z52.string(), z52.null()]).optional(),
|
|
6616
|
+
maxDate: z52.union([z52.string(), z52.null()]).optional(),
|
|
6617
|
+
startAt: z52.union([z52.string(), z52.null()]).optional(),
|
|
6581
6618
|
placeholder: DynamicTextSchema.optional(),
|
|
6582
6619
|
props: PrimeDatepickerPropsSchema.optional()
|
|
6583
6620
|
});
|
|
6584
6621
|
var PrimeDatepickerFieldSchema = PrimeDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6585
6622
|
var PrimeTextareaFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6586
|
-
type:
|
|
6587
|
-
nullable:
|
|
6588
|
-
value:
|
|
6623
|
+
type: z52.literal("textarea"),
|
|
6624
|
+
nullable: z52.boolean().optional(),
|
|
6625
|
+
value: z52.string().nullable().optional(),
|
|
6589
6626
|
placeholder: DynamicTextSchema.optional(),
|
|
6590
6627
|
props: PrimeTextareaPropsSchema.optional()
|
|
6591
6628
|
});
|
|
6592
6629
|
var PrimeTextareaFieldSchema = PrimeTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6593
6630
|
var PrimeSliderFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6594
|
-
type:
|
|
6595
|
-
nullable:
|
|
6596
|
-
value:
|
|
6597
|
-
minValue:
|
|
6598
|
-
maxValue:
|
|
6599
|
-
step:
|
|
6631
|
+
type: z52.literal("slider"),
|
|
6632
|
+
nullable: z52.boolean().optional(),
|
|
6633
|
+
value: SliderValueSchema,
|
|
6634
|
+
minValue: z52.number().optional(),
|
|
6635
|
+
maxValue: z52.number().optional(),
|
|
6636
|
+
step: z52.number().positive().optional(),
|
|
6600
6637
|
placeholder: DynamicTextSchema.optional(),
|
|
6601
6638
|
props: PrimeSliderPropsSchema.optional()
|
|
6602
6639
|
});
|
|
6603
6640
|
var PrimeSliderFieldSchema = PrimeSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6604
6641
|
var PrimeToggleFieldSchema = PrimeValueFieldBase.extend({
|
|
6605
|
-
type:
|
|
6606
|
-
value:
|
|
6642
|
+
type: z52.literal("toggle"),
|
|
6643
|
+
value: z52.boolean().optional(),
|
|
6607
6644
|
placeholder: DynamicTextSchema.optional(),
|
|
6608
6645
|
props: PrimeTogglePropsSchema.optional()
|
|
6609
6646
|
});
|
|
6610
6647
|
var PrimeButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6611
|
-
type:
|
|
6612
|
-
event:
|
|
6613
|
-
eventArgs:
|
|
6648
|
+
type: z52.literal("button"),
|
|
6649
|
+
event: z52.string().optional(),
|
|
6650
|
+
eventArgs: z52.array(z52.union([z52.string(), z52.number(), z52.boolean(), z52.null(), z52.undefined()])).optional(),
|
|
6614
6651
|
props: PrimeButtonPropsSchema.optional(),
|
|
6615
6652
|
logic: LogicArraySchema.optional()
|
|
6616
6653
|
});
|
|
6617
6654
|
var PrimeSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6618
|
-
type:
|
|
6655
|
+
type: z52.literal("submit"),
|
|
6619
6656
|
props: PrimeButtonPropsSchema.optional(),
|
|
6620
6657
|
logic: LogicArraySchema.optional()
|
|
6621
6658
|
});
|
|
6622
6659
|
var PrimeNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6623
|
-
type:
|
|
6660
|
+
type: z52.literal("next"),
|
|
6624
6661
|
props: PrimeButtonPropsSchema.optional(),
|
|
6625
6662
|
logic: LogicArraySchema.optional()
|
|
6626
6663
|
});
|
|
6627
6664
|
var PrimePreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6628
|
-
type:
|
|
6665
|
+
type: z52.literal("previous"),
|
|
6629
6666
|
props: PrimeButtonPropsSchema.optional()
|
|
6630
6667
|
});
|
|
6631
6668
|
var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6634,13 +6671,13 @@ var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6634
6671
|
* item, or a list of them for an object item.
|
|
6635
6672
|
*/
|
|
6636
6673
|
template: ArrayItemTemplateSchema,
|
|
6637
|
-
type:
|
|
6638
|
-
arrayKey:
|
|
6674
|
+
type: z52.literal("add-array-item"),
|
|
6675
|
+
arrayKey: z52.string().optional(),
|
|
6639
6676
|
props: PrimeButtonPropsSchema.optional()
|
|
6640
6677
|
});
|
|
6641
6678
|
var PrimeRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6642
|
-
type:
|
|
6643
|
-
arrayKey:
|
|
6679
|
+
type: z52.literal("remove-array-item"),
|
|
6680
|
+
arrayKey: z52.string().optional(),
|
|
6644
6681
|
props: PrimeButtonPropsSchema.optional()
|
|
6645
6682
|
});
|
|
6646
6683
|
var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6649,8 +6686,8 @@ var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6649
6686
|
* item, or a list of them for an object item.
|
|
6650
6687
|
*/
|
|
6651
6688
|
template: ArrayItemTemplateSchema,
|
|
6652
|
-
type:
|
|
6653
|
-
arrayKey:
|
|
6689
|
+
type: z52.literal("prepend-array-item"),
|
|
6690
|
+
arrayKey: z52.string().optional(),
|
|
6654
6691
|
props: PrimeButtonPropsSchema.optional()
|
|
6655
6692
|
});
|
|
6656
6693
|
var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6659,25 +6696,25 @@ var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6659
6696
|
* item, or a list of them for an object item.
|
|
6660
6697
|
*/
|
|
6661
6698
|
template: ArrayItemTemplateSchema,
|
|
6662
|
-
type:
|
|
6663
|
-
arrayKey:
|
|
6664
|
-
index:
|
|
6699
|
+
type: z52.literal("insert-array-item"),
|
|
6700
|
+
arrayKey: z52.string().optional(),
|
|
6701
|
+
index: z52.number(),
|
|
6665
6702
|
props: PrimeButtonPropsSchema.optional()
|
|
6666
6703
|
});
|
|
6667
6704
|
var PrimePopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6668
|
-
type:
|
|
6669
|
-
arrayKey:
|
|
6705
|
+
type: z52.literal("pop-array-item"),
|
|
6706
|
+
arrayKey: z52.string(),
|
|
6670
6707
|
props: PrimeButtonPropsSchema.optional()
|
|
6671
6708
|
});
|
|
6672
6709
|
var PrimeShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6673
|
-
type:
|
|
6674
|
-
arrayKey:
|
|
6710
|
+
type: z52.literal("shift-array-item"),
|
|
6711
|
+
arrayKey: z52.string(),
|
|
6675
6712
|
props: PrimeButtonPropsSchema.optional()
|
|
6676
6713
|
});
|
|
6677
6714
|
|
|
6678
6715
|
// internal/dynamic-forms-validation/primeng/src/prime-leaf-field.schema.ts
|
|
6679
|
-
import { z as
|
|
6680
|
-
var PrimeLeafFieldSchema =
|
|
6716
|
+
import { z as z53 } from "zod";
|
|
6717
|
+
var PrimeLeafFieldSchema = z53.discriminatedUnion("type", [
|
|
6681
6718
|
TextFieldSchema,
|
|
6682
6719
|
HiddenFieldSchema,
|
|
6683
6720
|
PrimeInputFieldSchemaObject,
|
|
@@ -6699,10 +6736,10 @@ var PrimeLeafFieldSchema = z51.discriminatedUnion("type", [
|
|
|
6699
6736
|
PrimeInsertArrayItemButtonFieldSchema,
|
|
6700
6737
|
PrimePopArrayItemButtonFieldSchema,
|
|
6701
6738
|
PrimeShiftArrayItemButtonFieldSchema
|
|
6702
|
-
]).superRefine(nullableValueRefine);
|
|
6739
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6703
6740
|
|
|
6704
6741
|
// internal/dynamic-forms-validation/primeng/src/prime-form-config.schema.ts
|
|
6705
|
-
import { z as
|
|
6742
|
+
import { z as z54 } from "zod";
|
|
6706
6743
|
var containerSchemas3 = createContainerSchemas({
|
|
6707
6744
|
leafFieldSchema: PrimeLeafFieldSchema
|
|
6708
6745
|
});
|
|
@@ -6711,13 +6748,13 @@ var PrimeRowFieldSchema = containerSchemas3.RowFieldSchema;
|
|
|
6711
6748
|
var PrimeGroupFieldSchema = containerSchemas3.GroupFieldSchema;
|
|
6712
6749
|
var PrimeArrayFieldSchema = containerSchemas3.ArrayFieldSchema;
|
|
6713
6750
|
var PrimeFieldSchema = containerSchemas3.AllFieldsSchema;
|
|
6714
|
-
var PrimeFormDefaultPropsSchema =
|
|
6715
|
-
styleClass:
|
|
6751
|
+
var PrimeFormDefaultPropsSchema = z54.object({
|
|
6752
|
+
styleClass: z54.string().optional()
|
|
6716
6753
|
});
|
|
6717
6754
|
var PrimeFormConfigSchema = createFormConfigSchema(PrimeFieldSchema, PrimeFormDefaultPropsSchema);
|
|
6718
6755
|
|
|
6719
6756
|
// internal/dynamic-forms-validation/ionic/src/props/index.ts
|
|
6720
|
-
import { z as
|
|
6757
|
+
import { z as z55 } from "zod";
|
|
6721
6758
|
function isLocaleTag(value) {
|
|
6722
6759
|
try {
|
|
6723
6760
|
return Intl.getCanonicalLocales(value).length > 0;
|
|
@@ -6725,209 +6762,209 @@ function isLocaleTag(value) {
|
|
|
6725
6762
|
return false;
|
|
6726
6763
|
}
|
|
6727
6764
|
}
|
|
6728
|
-
var IonicColorSchema =
|
|
6729
|
-
var IonicLabelPlacementSchema =
|
|
6730
|
-
var IonicJustifySchema =
|
|
6731
|
-
var IonicFillSchema =
|
|
6732
|
-
var IonicInputPropsSchema =
|
|
6733
|
-
fill:
|
|
6734
|
-
shape:
|
|
6765
|
+
var IonicColorSchema = z55.enum(["primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", "dark"]);
|
|
6766
|
+
var IonicLabelPlacementSchema = z55.enum(["start", "end", "fixed", "stacked", "floating"]);
|
|
6767
|
+
var IonicJustifySchema = z55.enum(["start", "end", "space-between"]);
|
|
6768
|
+
var IonicFillSchema = z55.enum(["solid", "outline", "clear", "default"]);
|
|
6769
|
+
var IonicInputPropsSchema = z55.object({
|
|
6770
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6771
|
+
shape: z55.literal("round").optional(),
|
|
6735
6772
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6736
6773
|
color: IonicColorSchema.optional(),
|
|
6737
6774
|
hint: DynamicTextSchema.optional(),
|
|
6738
6775
|
errorText: DynamicTextSchema.optional(),
|
|
6739
|
-
counter:
|
|
6740
|
-
clearInput:
|
|
6741
|
-
type:
|
|
6776
|
+
counter: z55.boolean().optional(),
|
|
6777
|
+
clearInput: z55.boolean().optional(),
|
|
6778
|
+
type: z55.enum(["text", "email", "password", "number", "tel", "url", "search"]).optional(),
|
|
6742
6779
|
placeholder: DynamicTextSchema.optional()
|
|
6743
6780
|
});
|
|
6744
|
-
var IonicCheckboxPropsSchema =
|
|
6745
|
-
labelPlacement:
|
|
6781
|
+
var IonicCheckboxPropsSchema = z55.object({
|
|
6782
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6746
6783
|
justify: IonicJustifySchema.optional(),
|
|
6747
|
-
color:
|
|
6748
|
-
indeterminate:
|
|
6784
|
+
color: IonicColorSchema.optional(),
|
|
6785
|
+
indeterminate: z55.boolean().optional(),
|
|
6749
6786
|
hint: DynamicTextSchema.optional()
|
|
6750
6787
|
});
|
|
6751
|
-
var IonicRadioPropsSchema =
|
|
6752
|
-
labelPlacement:
|
|
6788
|
+
var IonicRadioPropsSchema = z55.object({
|
|
6789
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6753
6790
|
justify: IonicJustifySchema.optional(),
|
|
6754
|
-
color:
|
|
6791
|
+
color: IonicColorSchema.optional(),
|
|
6755
6792
|
hint: DynamicTextSchema.optional()
|
|
6756
6793
|
});
|
|
6757
|
-
var IonicTogglePropsSchema =
|
|
6758
|
-
labelPlacement:
|
|
6794
|
+
var IonicTogglePropsSchema = z55.object({
|
|
6795
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6759
6796
|
justify: IonicJustifySchema.optional(),
|
|
6760
|
-
color:
|
|
6761
|
-
enableOnOffLabels:
|
|
6797
|
+
color: IonicColorSchema.optional(),
|
|
6798
|
+
enableOnOffLabels: z55.boolean().optional(),
|
|
6762
6799
|
hint: DynamicTextSchema.optional()
|
|
6763
6800
|
});
|
|
6764
|
-
var IonicSliderPropsSchema =
|
|
6765
|
-
min:
|
|
6766
|
-
max:
|
|
6767
|
-
step:
|
|
6768
|
-
dualKnobs:
|
|
6769
|
-
pin:
|
|
6770
|
-
ticks:
|
|
6771
|
-
snaps:
|
|
6772
|
-
color:
|
|
6773
|
-
labelPlacement:
|
|
6801
|
+
var IonicSliderPropsSchema = z55.object({
|
|
6802
|
+
min: z55.number().optional(),
|
|
6803
|
+
max: z55.number().optional(),
|
|
6804
|
+
step: z55.number().positive().optional(),
|
|
6805
|
+
dualKnobs: z55.boolean().optional(),
|
|
6806
|
+
pin: z55.boolean().optional(),
|
|
6807
|
+
ticks: z55.boolean().optional(),
|
|
6808
|
+
snaps: z55.boolean().optional(),
|
|
6809
|
+
color: IonicColorSchema.optional(),
|
|
6810
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6774
6811
|
hint: DynamicTextSchema.optional()
|
|
6775
6812
|
});
|
|
6776
|
-
var IonicDatepickerPropsSchema =
|
|
6777
|
-
presentation:
|
|
6778
|
-
multiple:
|
|
6779
|
-
preferWheel:
|
|
6780
|
-
showDefaultButtons:
|
|
6781
|
-
showDefaultTitle:
|
|
6782
|
-
showDefaultTimeLabel:
|
|
6783
|
-
showClearButton:
|
|
6784
|
-
doneText:
|
|
6785
|
-
cancelText:
|
|
6786
|
-
size:
|
|
6787
|
-
color:
|
|
6813
|
+
var IonicDatepickerPropsSchema = z55.object({
|
|
6814
|
+
presentation: z55.enum(["date", "date-time", "time", "time-date", "month", "month-year", "year"]).optional(),
|
|
6815
|
+
multiple: z55.boolean().optional(),
|
|
6816
|
+
preferWheel: z55.boolean().optional(),
|
|
6817
|
+
showDefaultButtons: z55.boolean().optional(),
|
|
6818
|
+
showDefaultTitle: z55.boolean().optional(),
|
|
6819
|
+
showDefaultTimeLabel: z55.boolean().optional(),
|
|
6820
|
+
showClearButton: z55.boolean().optional(),
|
|
6821
|
+
doneText: DynamicTextSchema.optional(),
|
|
6822
|
+
cancelText: DynamicTextSchema.optional(),
|
|
6823
|
+
size: z55.enum(["cover", "fixed"]).optional(),
|
|
6824
|
+
color: IonicColorSchema.optional(),
|
|
6788
6825
|
hint: DynamicTextSchema.optional(),
|
|
6789
|
-
locale:
|
|
6826
|
+
locale: z55.string().refine(isLocaleTag, { message: 'Expected a BCP 47 locale tag such as "de-DE"' }).optional(),
|
|
6790
6827
|
placeholder: DynamicTextSchema.optional()
|
|
6791
6828
|
});
|
|
6792
|
-
var IonicSelectPropsSchema =
|
|
6793
|
-
multiple:
|
|
6794
|
-
interface:
|
|
6795
|
-
cancelText:
|
|
6796
|
-
okText:
|
|
6829
|
+
var IonicSelectPropsSchema = z55.object({
|
|
6830
|
+
multiple: z55.boolean().optional(),
|
|
6831
|
+
interface: z55.enum(["action-sheet", "popover", "alert"]).optional(),
|
|
6832
|
+
cancelText: DynamicTextSchema.optional(),
|
|
6833
|
+
okText: DynamicTextSchema.optional(),
|
|
6797
6834
|
placeholder: DynamicTextSchema.optional(),
|
|
6798
|
-
fill:
|
|
6799
|
-
shape:
|
|
6835
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6836
|
+
shape: z55.literal("round").optional(),
|
|
6800
6837
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6801
|
-
color:
|
|
6838
|
+
color: IonicColorSchema.optional(),
|
|
6802
6839
|
hint: DynamicTextSchema.optional()
|
|
6803
6840
|
});
|
|
6804
|
-
var IonicTextareaPropsSchema =
|
|
6805
|
-
rows:
|
|
6806
|
-
autoGrow:
|
|
6807
|
-
counter:
|
|
6808
|
-
fill:
|
|
6809
|
-
shape:
|
|
6841
|
+
var IonicTextareaPropsSchema = z55.object({
|
|
6842
|
+
rows: z55.number().positive().optional(),
|
|
6843
|
+
autoGrow: z55.boolean().optional(),
|
|
6844
|
+
counter: z55.boolean().optional(),
|
|
6845
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6846
|
+
shape: z55.literal("round").optional(),
|
|
6810
6847
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6811
6848
|
hint: DynamicTextSchema.optional(),
|
|
6812
6849
|
errorText: DynamicTextSchema.optional(),
|
|
6813
6850
|
color: IonicColorSchema.optional(),
|
|
6814
6851
|
placeholder: DynamicTextSchema.optional()
|
|
6815
6852
|
});
|
|
6816
|
-
var IonicMultiCheckboxPropsSchema =
|
|
6817
|
-
labelPlacement:
|
|
6853
|
+
var IonicMultiCheckboxPropsSchema = z55.object({
|
|
6854
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6818
6855
|
justify: IonicJustifySchema.optional(),
|
|
6819
|
-
color:
|
|
6856
|
+
color: IonicColorSchema.optional(),
|
|
6820
6857
|
hint: DynamicTextSchema.optional()
|
|
6821
6858
|
});
|
|
6822
|
-
var IonicButtonPropsSchema =
|
|
6823
|
-
expand:
|
|
6859
|
+
var IonicButtonPropsSchema = z55.object({
|
|
6860
|
+
expand: z55.enum(["full", "block"]).optional(),
|
|
6824
6861
|
fill: IonicFillSchema.optional(),
|
|
6825
|
-
shape:
|
|
6826
|
-
size:
|
|
6862
|
+
shape: z55.literal("round").optional(),
|
|
6863
|
+
size: z55.enum(["small", "default", "large"]).optional(),
|
|
6827
6864
|
color: IonicColorSchema.optional(),
|
|
6828
|
-
strong:
|
|
6829
|
-
type:
|
|
6865
|
+
strong: z55.boolean().optional(),
|
|
6866
|
+
type: z55.enum(["button", "submit", "reset"]).optional()
|
|
6830
6867
|
});
|
|
6831
6868
|
|
|
6832
6869
|
// internal/dynamic-forms-validation/ionic/src/fields/index.ts
|
|
6833
|
-
import { z as
|
|
6870
|
+
import { z as z56 } from "zod";
|
|
6834
6871
|
var IonicValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6835
6872
|
var IonicInputFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6836
|
-
type:
|
|
6837
|
-
nullable:
|
|
6838
|
-
value:
|
|
6873
|
+
type: z56.literal("input"),
|
|
6874
|
+
nullable: z56.boolean().optional(),
|
|
6875
|
+
value: InputValueSchema,
|
|
6839
6876
|
placeholder: DynamicTextSchema.optional(),
|
|
6840
6877
|
props: IonicInputPropsSchema.optional()
|
|
6841
6878
|
});
|
|
6842
|
-
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6879
|
+
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6843
6880
|
var IonicCheckboxFieldSchema = IonicValueFieldBase.extend({
|
|
6844
|
-
type:
|
|
6845
|
-
value:
|
|
6881
|
+
type: z56.literal("checkbox"),
|
|
6882
|
+
value: z56.boolean().optional(),
|
|
6846
6883
|
placeholder: DynamicTextSchema.optional(),
|
|
6847
6884
|
props: IonicCheckboxPropsSchema.optional()
|
|
6848
6885
|
});
|
|
6849
6886
|
var IonicRadioFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6850
|
-
type:
|
|
6851
|
-
nullable:
|
|
6852
|
-
value:
|
|
6887
|
+
type: z56.literal("radio"),
|
|
6888
|
+
nullable: z56.boolean().optional(),
|
|
6889
|
+
value: z56.unknown().nullable().optional(),
|
|
6853
6890
|
placeholder: DynamicTextSchema.optional(),
|
|
6854
6891
|
options: FieldOptionsSchema,
|
|
6855
6892
|
props: IonicRadioPropsSchema.optional()
|
|
6856
6893
|
});
|
|
6857
6894
|
var IonicRadioFieldSchema = IonicRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6858
6895
|
var IonicToggleFieldSchema = IonicValueFieldBase.extend({
|
|
6859
|
-
type:
|
|
6860
|
-
value:
|
|
6896
|
+
type: z56.literal("toggle"),
|
|
6897
|
+
value: z56.boolean().optional(),
|
|
6861
6898
|
placeholder: DynamicTextSchema.optional(),
|
|
6862
6899
|
props: IonicTogglePropsSchema.optional()
|
|
6863
6900
|
});
|
|
6864
6901
|
var IonicSliderFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6865
|
-
type:
|
|
6866
|
-
nullable:
|
|
6867
|
-
value:
|
|
6868
|
-
minValue:
|
|
6869
|
-
maxValue:
|
|
6870
|
-
step:
|
|
6902
|
+
type: z56.literal("slider"),
|
|
6903
|
+
nullable: z56.boolean().optional(),
|
|
6904
|
+
value: SliderValueSchema,
|
|
6905
|
+
minValue: z56.number().optional(),
|
|
6906
|
+
maxValue: z56.number().optional(),
|
|
6907
|
+
step: z56.number().positive().optional(),
|
|
6871
6908
|
placeholder: DynamicTextSchema.optional(),
|
|
6872
6909
|
props: IonicSliderPropsSchema.optional()
|
|
6873
6910
|
});
|
|
6874
6911
|
var IonicSliderFieldSchema = IonicSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6875
6912
|
var IonicDatepickerFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6876
|
-
type:
|
|
6877
|
-
nullable:
|
|
6878
|
-
value:
|
|
6879
|
-
minDate:
|
|
6880
|
-
maxDate:
|
|
6881
|
-
startAt:
|
|
6913
|
+
type: z56.literal("datepicker"),
|
|
6914
|
+
nullable: z56.boolean().optional(),
|
|
6915
|
+
value: DatepickerValueSchema,
|
|
6916
|
+
minDate: z56.union([z56.string(), z56.null()]).optional(),
|
|
6917
|
+
maxDate: z56.union([z56.string(), z56.null()]).optional(),
|
|
6918
|
+
startAt: z56.union([z56.string(), z56.null()]).optional(),
|
|
6882
6919
|
placeholder: DynamicTextSchema.optional(),
|
|
6883
6920
|
props: IonicDatepickerPropsSchema.optional()
|
|
6884
6921
|
});
|
|
6885
6922
|
var IonicDatepickerFieldSchema = IonicDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6886
6923
|
var IonicSelectFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6887
|
-
type:
|
|
6888
|
-
nullable:
|
|
6889
|
-
value:
|
|
6924
|
+
type: z56.literal("select"),
|
|
6925
|
+
nullable: z56.boolean().optional(),
|
|
6926
|
+
value: z56.unknown().nullable().optional(),
|
|
6890
6927
|
placeholder: DynamicTextSchema.optional(),
|
|
6891
6928
|
options: FieldOptionsSchema,
|
|
6892
6929
|
props: IonicSelectPropsSchema.optional()
|
|
6893
6930
|
});
|
|
6894
6931
|
var IonicSelectFieldSchema = IonicSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6895
6932
|
var IonicTextareaFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6896
|
-
type:
|
|
6897
|
-
nullable:
|
|
6898
|
-
value:
|
|
6933
|
+
type: z56.literal("textarea"),
|
|
6934
|
+
nullable: z56.boolean().optional(),
|
|
6935
|
+
value: z56.string().nullable().optional(),
|
|
6899
6936
|
placeholder: DynamicTextSchema.optional(),
|
|
6900
6937
|
props: IonicTextareaPropsSchema.optional()
|
|
6901
6938
|
});
|
|
6902
6939
|
var IonicTextareaFieldSchema = IonicTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6903
6940
|
var IonicMultiCheckboxFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6904
|
-
type:
|
|
6905
|
-
nullable:
|
|
6906
|
-
value:
|
|
6941
|
+
type: z56.literal("multi-checkbox"),
|
|
6942
|
+
nullable: z56.boolean().optional(),
|
|
6943
|
+
value: z56.array(z56.unknown()).nullable().optional(),
|
|
6907
6944
|
placeholder: DynamicTextSchema.optional(),
|
|
6908
6945
|
options: FieldOptionsSchema,
|
|
6909
6946
|
props: IonicMultiCheckboxPropsSchema.optional()
|
|
6910
6947
|
});
|
|
6911
6948
|
var IonicMultiCheckboxFieldSchema = IonicMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6912
6949
|
var IonicButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6913
|
-
type:
|
|
6914
|
-
event:
|
|
6915
|
-
eventArgs:
|
|
6950
|
+
type: z56.literal("button"),
|
|
6951
|
+
event: z56.string().optional(),
|
|
6952
|
+
eventArgs: z56.array(z56.union([z56.string(), z56.number(), z56.boolean(), z56.null(), z56.undefined()])).optional(),
|
|
6916
6953
|
props: IonicButtonPropsSchema.optional(),
|
|
6917
6954
|
logic: LogicArraySchema.optional()
|
|
6918
6955
|
});
|
|
6919
6956
|
var IonicSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6920
|
-
type:
|
|
6957
|
+
type: z56.literal("submit"),
|
|
6921
6958
|
props: IonicButtonPropsSchema.optional(),
|
|
6922
6959
|
logic: LogicArraySchema.optional()
|
|
6923
6960
|
});
|
|
6924
6961
|
var IonicNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6925
|
-
type:
|
|
6962
|
+
type: z56.literal("next"),
|
|
6926
6963
|
props: IonicButtonPropsSchema.optional(),
|
|
6927
6964
|
logic: LogicArraySchema.optional()
|
|
6928
6965
|
});
|
|
6929
6966
|
var IonicPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6930
|
-
type:
|
|
6967
|
+
type: z56.literal("previous"),
|
|
6931
6968
|
props: IonicButtonPropsSchema.optional()
|
|
6932
6969
|
});
|
|
6933
6970
|
var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6936,13 +6973,13 @@ var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6936
6973
|
* item, or a list of them for an object item.
|
|
6937
6974
|
*/
|
|
6938
6975
|
template: ArrayItemTemplateSchema,
|
|
6939
|
-
type:
|
|
6940
|
-
arrayKey:
|
|
6976
|
+
type: z56.literal("add-array-item"),
|
|
6977
|
+
arrayKey: z56.string().optional(),
|
|
6941
6978
|
props: IonicButtonPropsSchema.optional()
|
|
6942
6979
|
});
|
|
6943
6980
|
var IonicRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6944
|
-
type:
|
|
6945
|
-
arrayKey:
|
|
6981
|
+
type: z56.literal("remove-array-item"),
|
|
6982
|
+
arrayKey: z56.string().optional(),
|
|
6946
6983
|
props: IonicButtonPropsSchema.optional()
|
|
6947
6984
|
});
|
|
6948
6985
|
var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6951,8 +6988,8 @@ var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6951
6988
|
* item, or a list of them for an object item.
|
|
6952
6989
|
*/
|
|
6953
6990
|
template: ArrayItemTemplateSchema,
|
|
6954
|
-
type:
|
|
6955
|
-
arrayKey:
|
|
6991
|
+
type: z56.literal("prepend-array-item"),
|
|
6992
|
+
arrayKey: z56.string().optional(),
|
|
6956
6993
|
props: IonicButtonPropsSchema.optional()
|
|
6957
6994
|
});
|
|
6958
6995
|
var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6961,25 +6998,25 @@ var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6961
6998
|
* item, or a list of them for an object item.
|
|
6962
6999
|
*/
|
|
6963
7000
|
template: ArrayItemTemplateSchema,
|
|
6964
|
-
type:
|
|
6965
|
-
arrayKey:
|
|
6966
|
-
index:
|
|
7001
|
+
type: z56.literal("insert-array-item"),
|
|
7002
|
+
arrayKey: z56.string().optional(),
|
|
7003
|
+
index: z56.number(),
|
|
6967
7004
|
props: IonicButtonPropsSchema.optional()
|
|
6968
7005
|
});
|
|
6969
7006
|
var IonicPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6970
|
-
type:
|
|
6971
|
-
arrayKey:
|
|
7007
|
+
type: z56.literal("pop-array-item"),
|
|
7008
|
+
arrayKey: z56.string(),
|
|
6972
7009
|
props: IonicButtonPropsSchema.optional()
|
|
6973
7010
|
});
|
|
6974
7011
|
var IonicShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6975
|
-
type:
|
|
6976
|
-
arrayKey:
|
|
7012
|
+
type: z56.literal("shift-array-item"),
|
|
7013
|
+
arrayKey: z56.string(),
|
|
6977
7014
|
props: IonicButtonPropsSchema.optional()
|
|
6978
7015
|
});
|
|
6979
7016
|
|
|
6980
7017
|
// internal/dynamic-forms-validation/ionic/src/ionic-leaf-field.schema.ts
|
|
6981
|
-
import { z as
|
|
6982
|
-
var IonicLeafFieldSchema =
|
|
7018
|
+
import { z as z57 } from "zod";
|
|
7019
|
+
var IonicLeafFieldSchema = z57.discriminatedUnion("type", [
|
|
6983
7020
|
TextFieldSchema,
|
|
6984
7021
|
HiddenFieldSchema,
|
|
6985
7022
|
IonicInputFieldSchemaObject,
|
|
@@ -7001,10 +7038,10 @@ var IonicLeafFieldSchema = z55.discriminatedUnion("type", [
|
|
|
7001
7038
|
IonicInsertArrayItemButtonFieldSchema,
|
|
7002
7039
|
IonicPopArrayItemButtonFieldSchema,
|
|
7003
7040
|
IonicShiftArrayItemButtonFieldSchema
|
|
7004
|
-
]).superRefine(nullableValueRefine);
|
|
7041
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
7005
7042
|
|
|
7006
7043
|
// internal/dynamic-forms-validation/ionic/src/ionic-form-config.schema.ts
|
|
7007
|
-
import { z as
|
|
7044
|
+
import { z as z58 } from "zod";
|
|
7008
7045
|
var containerSchemas4 = createContainerSchemas({
|
|
7009
7046
|
leafFieldSchema: IonicLeafFieldSchema
|
|
7010
7047
|
});
|
|
@@ -7013,7 +7050,7 @@ var IonicRowFieldSchema = containerSchemas4.RowFieldSchema;
|
|
|
7013
7050
|
var IonicGroupFieldSchema = containerSchemas4.GroupFieldSchema;
|
|
7014
7051
|
var IonicArrayFieldSchema = containerSchemas4.ArrayFieldSchema;
|
|
7015
7052
|
var IonicFieldSchema = containerSchemas4.AllFieldsSchema;
|
|
7016
|
-
var IonicFormDefaultPropsSchema =
|
|
7053
|
+
var IonicFormDefaultPropsSchema = z58.object({
|
|
7017
7054
|
color: IonicColorSchema.optional(),
|
|
7018
7055
|
labelPlacement: IonicLabelPlacementSchema.optional()
|
|
7019
7056
|
});
|
|
@@ -7027,7 +7064,7 @@ var formConfigSchemas = {
|
|
|
7027
7064
|
ionic: IonicFormConfigSchema
|
|
7028
7065
|
};
|
|
7029
7066
|
function toJsonSchema(schema, name, basePath) {
|
|
7030
|
-
const jsonSchema =
|
|
7067
|
+
const jsonSchema = z59.toJSONSchema(schema, { target: "draft-7", io: "input", unrepresentable: "any" });
|
|
7031
7068
|
jsonSchema["$id"] = basePath ? `${basePath.replace(/\/$/, "")}/${name}` : name;
|
|
7032
7069
|
return jsonSchema;
|
|
7033
7070
|
}
|
|
@@ -7145,30 +7182,30 @@ function getLeafFieldJsonSchema(uiIntegration) {
|
|
|
7145
7182
|
}
|
|
7146
7183
|
|
|
7147
7184
|
// internal/dynamic-forms-validation/src/lib/schemas/field-type-names.ts
|
|
7148
|
-
import { z as
|
|
7185
|
+
import { z as z60 } from "zod";
|
|
7149
7186
|
var MAX_DEPTH = 20;
|
|
7150
7187
|
function collectDiscriminator(schema, into) {
|
|
7151
|
-
if (schema instanceof
|
|
7188
|
+
if (schema instanceof z60.ZodLiteral) {
|
|
7152
7189
|
for (const value of schema.def.values) {
|
|
7153
7190
|
if (typeof value === "string") into.add(value);
|
|
7154
7191
|
}
|
|
7155
7192
|
return;
|
|
7156
7193
|
}
|
|
7157
|
-
if (schema instanceof
|
|
7194
|
+
if (schema instanceof z60.ZodEnum) {
|
|
7158
7195
|
for (const value of schema.options) into.add(value);
|
|
7159
7196
|
}
|
|
7160
7197
|
}
|
|
7161
7198
|
function visit(schema, into, depth) {
|
|
7162
7199
|
if (depth > MAX_DEPTH) return;
|
|
7163
|
-
if (schema instanceof
|
|
7200
|
+
if (schema instanceof z60.ZodLazy) {
|
|
7164
7201
|
visit(schema.unwrap(), into, depth + 1);
|
|
7165
7202
|
return;
|
|
7166
7203
|
}
|
|
7167
|
-
if (schema instanceof
|
|
7204
|
+
if (schema instanceof z60.ZodUnion) {
|
|
7168
7205
|
for (const option of schema.options) visit(option, into, depth + 1);
|
|
7169
7206
|
return;
|
|
7170
7207
|
}
|
|
7171
|
-
if (schema instanceof
|
|
7208
|
+
if (schema instanceof z60.ZodObject) {
|
|
7172
7209
|
collectDiscriminator(schema.shape["type"], into);
|
|
7173
7210
|
return;
|
|
7174
7211
|
}
|
|
@@ -7179,6 +7216,1040 @@ function collectFieldTypeNames(schema) {
|
|
|
7179
7216
|
return [...names];
|
|
7180
7217
|
}
|
|
7181
7218
|
|
|
7219
|
+
// packages/dynamic-forms/internal/src/lib/errors/dynamic-form-error.ts
|
|
7220
|
+
var DynamicFormError = class _DynamicFormError extends Error {
|
|
7221
|
+
static PREFIX = "[Dynamic Forms]";
|
|
7222
|
+
constructor(message) {
|
|
7223
|
+
super(`${_DynamicFormError.PREFIX} ${message}`);
|
|
7224
|
+
this.name = "DynamicFormError";
|
|
7225
|
+
}
|
|
7226
|
+
};
|
|
7227
|
+
|
|
7228
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/types.ts
|
|
7229
|
+
var ExpressionParserError = class extends DynamicFormError {
|
|
7230
|
+
constructor(message, position, expression) {
|
|
7231
|
+
super(`${message} at position ${position} in expression: ${expression}`);
|
|
7232
|
+
this.position = position;
|
|
7233
|
+
this.expression = expression;
|
|
7234
|
+
this.name = "ExpressionParserError";
|
|
7235
|
+
}
|
|
7236
|
+
position;
|
|
7237
|
+
expression;
|
|
7238
|
+
};
|
|
7239
|
+
|
|
7240
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/evaluator.ts
|
|
7241
|
+
var STRING_SAFE_METHODS = [
|
|
7242
|
+
"charAt",
|
|
7243
|
+
"charCodeAt",
|
|
7244
|
+
"concat",
|
|
7245
|
+
"endsWith",
|
|
7246
|
+
"includes",
|
|
7247
|
+
"indexOf",
|
|
7248
|
+
"lastIndexOf",
|
|
7249
|
+
"match",
|
|
7250
|
+
"padEnd",
|
|
7251
|
+
"padStart",
|
|
7252
|
+
"repeat",
|
|
7253
|
+
"replace",
|
|
7254
|
+
"search",
|
|
7255
|
+
"slice",
|
|
7256
|
+
"split",
|
|
7257
|
+
"startsWith",
|
|
7258
|
+
"substring",
|
|
7259
|
+
"toLowerCase",
|
|
7260
|
+
"toUpperCase",
|
|
7261
|
+
"trim",
|
|
7262
|
+
"trimEnd",
|
|
7263
|
+
"trimStart",
|
|
7264
|
+
"toString"
|
|
7265
|
+
];
|
|
7266
|
+
var NUMBER_SAFE_METHODS = ["toExponential", "toFixed", "toPrecision", "toString"];
|
|
7267
|
+
var ARRAY_SAFE_METHODS = [
|
|
7268
|
+
"concat",
|
|
7269
|
+
"every",
|
|
7270
|
+
"filter",
|
|
7271
|
+
"find",
|
|
7272
|
+
"findIndex",
|
|
7273
|
+
"flat",
|
|
7274
|
+
"flatMap",
|
|
7275
|
+
"includes",
|
|
7276
|
+
"indexOf",
|
|
7277
|
+
"join",
|
|
7278
|
+
"lastIndexOf",
|
|
7279
|
+
"map",
|
|
7280
|
+
"reduce",
|
|
7281
|
+
"reduceRight",
|
|
7282
|
+
"slice",
|
|
7283
|
+
"some",
|
|
7284
|
+
"toString",
|
|
7285
|
+
"entries",
|
|
7286
|
+
"keys",
|
|
7287
|
+
"values"
|
|
7288
|
+
];
|
|
7289
|
+
var DATE_SAFE_METHODS = [
|
|
7290
|
+
"getDate",
|
|
7291
|
+
"getDay",
|
|
7292
|
+
"getFullYear",
|
|
7293
|
+
"getHours",
|
|
7294
|
+
"getMilliseconds",
|
|
7295
|
+
"getMinutes",
|
|
7296
|
+
"getMonth",
|
|
7297
|
+
"getSeconds",
|
|
7298
|
+
"getTime",
|
|
7299
|
+
"getTimezoneOffset",
|
|
7300
|
+
"getUTCDate",
|
|
7301
|
+
"getUTCDay",
|
|
7302
|
+
"getUTCFullYear",
|
|
7303
|
+
"getUTCHours",
|
|
7304
|
+
"getUTCMilliseconds",
|
|
7305
|
+
"getUTCMinutes",
|
|
7306
|
+
"getUTCMonth",
|
|
7307
|
+
"getUTCSeconds",
|
|
7308
|
+
"toDateString",
|
|
7309
|
+
"toISOString",
|
|
7310
|
+
"toJSON",
|
|
7311
|
+
"toString",
|
|
7312
|
+
"toTimeString",
|
|
7313
|
+
"toUTCString"
|
|
7314
|
+
];
|
|
7315
|
+
var SAFE_METHODS = {
|
|
7316
|
+
string: new Set(STRING_SAFE_METHODS),
|
|
7317
|
+
number: new Set(NUMBER_SAFE_METHODS),
|
|
7318
|
+
array: new Set(ARRAY_SAFE_METHODS),
|
|
7319
|
+
date: new Set(DATE_SAFE_METHODS)
|
|
7320
|
+
};
|
|
7321
|
+
var ALLOWED_METHOD_NAMES = new Set(Object.values(SAFE_METHODS).flatMap((methods) => [...methods]));
|
|
7322
|
+
var BLOCKED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
7323
|
+
"constructor",
|
|
7324
|
+
"__proto__",
|
|
7325
|
+
"prototype",
|
|
7326
|
+
"__defineGetter__",
|
|
7327
|
+
"__defineSetter__",
|
|
7328
|
+
"__lookupGetter__",
|
|
7329
|
+
"__lookupSetter__"
|
|
7330
|
+
]);
|
|
7331
|
+
var Evaluator = class _Evaluator {
|
|
7332
|
+
scope;
|
|
7333
|
+
expression;
|
|
7334
|
+
constructor(scope, expression) {
|
|
7335
|
+
this.scope = scope;
|
|
7336
|
+
this.expression = expression;
|
|
7337
|
+
}
|
|
7338
|
+
/** Evaluate an AST node */
|
|
7339
|
+
evaluate(node) {
|
|
7340
|
+
switch (node.type) {
|
|
7341
|
+
case "Literal":
|
|
7342
|
+
return node.value;
|
|
7343
|
+
case "Identifier":
|
|
7344
|
+
return this.evaluateIdentifier(node.name);
|
|
7345
|
+
case "MemberAccess":
|
|
7346
|
+
return this.evaluateMemberAccess(node);
|
|
7347
|
+
case "ComputedMemberAccess":
|
|
7348
|
+
return this.evaluateComputedMemberAccess(node);
|
|
7349
|
+
case "BinaryOp":
|
|
7350
|
+
return this.evaluateBinaryOp(node);
|
|
7351
|
+
case "UnaryOp":
|
|
7352
|
+
return this.evaluateUnaryOp(node);
|
|
7353
|
+
case "CallExpression":
|
|
7354
|
+
return this.evaluateCallExpression(node);
|
|
7355
|
+
case "Conditional":
|
|
7356
|
+
return this.evaluate(node.test) ? this.evaluate(node.consequent) : this.evaluate(node.alternate);
|
|
7357
|
+
case "ArrayLiteral":
|
|
7358
|
+
return this.evaluateArrayLiteral(node);
|
|
7359
|
+
case "ObjectLiteral":
|
|
7360
|
+
return this.evaluateObjectLiteral(node);
|
|
7361
|
+
case "ArrowFunction":
|
|
7362
|
+
return this.evaluateArrowFunction(node);
|
|
7363
|
+
default:
|
|
7364
|
+
throw new ExpressionParserError(`Unknown node type: ${node.type}`, 0, this.expression);
|
|
7365
|
+
}
|
|
7366
|
+
}
|
|
7367
|
+
evaluateIdentifier(name) {
|
|
7368
|
+
if (name in this.scope) {
|
|
7369
|
+
return this.scope[name];
|
|
7370
|
+
}
|
|
7371
|
+
return void 0;
|
|
7372
|
+
}
|
|
7373
|
+
evaluateMemberAccess(node) {
|
|
7374
|
+
const obj = this.evaluate(node.object);
|
|
7375
|
+
if (obj === null || obj === void 0) {
|
|
7376
|
+
return void 0;
|
|
7377
|
+
}
|
|
7378
|
+
if (BLOCKED_PROPERTIES.has(node.property)) {
|
|
7379
|
+
throw new ExpressionParserError(`Property "${node.property}" is not accessible for security reasons`, 0, this.expression);
|
|
7380
|
+
}
|
|
7381
|
+
if (typeof obj === "object" || typeof obj === "string" || typeof obj === "number") {
|
|
7382
|
+
return obj[node.property];
|
|
7383
|
+
}
|
|
7384
|
+
return void 0;
|
|
7385
|
+
}
|
|
7386
|
+
evaluateComputedMemberAccess(node) {
|
|
7387
|
+
const obj = this.evaluate(node.object);
|
|
7388
|
+
if (obj === null || obj === void 0) {
|
|
7389
|
+
return void 0;
|
|
7390
|
+
}
|
|
7391
|
+
const rawKey = this.evaluate(node.property);
|
|
7392
|
+
if (rawKey === null || rawKey === void 0) return void 0;
|
|
7393
|
+
const key = String(rawKey);
|
|
7394
|
+
if (BLOCKED_PROPERTIES.has(key)) {
|
|
7395
|
+
throw new ExpressionParserError(`Property "${key}" is not accessible for security reasons`, 0, this.expression);
|
|
7396
|
+
}
|
|
7397
|
+
if (typeof obj === "object" || typeof obj === "string" || typeof obj === "number") {
|
|
7398
|
+
return obj[key];
|
|
7399
|
+
}
|
|
7400
|
+
return void 0;
|
|
7401
|
+
}
|
|
7402
|
+
evaluateBinaryOp(node) {
|
|
7403
|
+
if (node.operator === "&&") {
|
|
7404
|
+
const left2 = this.evaluate(node.left);
|
|
7405
|
+
return left2 ? this.evaluate(node.right) : left2;
|
|
7406
|
+
}
|
|
7407
|
+
if (node.operator === "||") {
|
|
7408
|
+
const left2 = this.evaluate(node.left);
|
|
7409
|
+
return left2 ? left2 : this.evaluate(node.right);
|
|
7410
|
+
}
|
|
7411
|
+
if (node.operator === "??") {
|
|
7412
|
+
const left2 = this.evaluate(node.left);
|
|
7413
|
+
return left2 ?? this.evaluate(node.right);
|
|
7414
|
+
}
|
|
7415
|
+
const left = this.evaluate(node.left);
|
|
7416
|
+
const right = this.evaluate(node.right);
|
|
7417
|
+
switch (node.operator) {
|
|
7418
|
+
// Arithmetic
|
|
7419
|
+
case "+":
|
|
7420
|
+
return left + right;
|
|
7421
|
+
case "-":
|
|
7422
|
+
return left - right;
|
|
7423
|
+
case "*":
|
|
7424
|
+
return left * right;
|
|
7425
|
+
case "/":
|
|
7426
|
+
if (right === 0) return null;
|
|
7427
|
+
return left / right;
|
|
7428
|
+
case "%":
|
|
7429
|
+
if (right === 0) return null;
|
|
7430
|
+
return left % right;
|
|
7431
|
+
// Comparison - using == and != intentionally for loose equality
|
|
7432
|
+
case "==":
|
|
7433
|
+
return left == right;
|
|
7434
|
+
case "===":
|
|
7435
|
+
return left === right;
|
|
7436
|
+
case "!=":
|
|
7437
|
+
return left != right;
|
|
7438
|
+
case "!==":
|
|
7439
|
+
return left !== right;
|
|
7440
|
+
case ">":
|
|
7441
|
+
return left > right;
|
|
7442
|
+
case "<":
|
|
7443
|
+
return left < right;
|
|
7444
|
+
case ">=":
|
|
7445
|
+
return left >= right;
|
|
7446
|
+
case "<=":
|
|
7447
|
+
return left <= right;
|
|
7448
|
+
default:
|
|
7449
|
+
throw new ExpressionParserError(`Unknown binary operator: ${node.operator}`, 0, this.expression);
|
|
7450
|
+
}
|
|
7451
|
+
}
|
|
7452
|
+
evaluateUnaryOp(node) {
|
|
7453
|
+
const operand = this.evaluate(node.operand);
|
|
7454
|
+
switch (node.operator) {
|
|
7455
|
+
case "!":
|
|
7456
|
+
return !operand;
|
|
7457
|
+
case "-":
|
|
7458
|
+
return -operand;
|
|
7459
|
+
case "+":
|
|
7460
|
+
return +operand;
|
|
7461
|
+
default:
|
|
7462
|
+
throw new ExpressionParserError(`Unknown unary operator: ${node.operator}`, 0, this.expression);
|
|
7463
|
+
}
|
|
7464
|
+
}
|
|
7465
|
+
evaluateCallExpression(node) {
|
|
7466
|
+
if (node.callee.type !== "MemberAccess") {
|
|
7467
|
+
throw new ExpressionParserError("Only method calls are allowed, not arbitrary function calls", 0, this.expression);
|
|
7468
|
+
}
|
|
7469
|
+
const obj = this.evaluate(node.callee.object);
|
|
7470
|
+
if (obj === null || obj === void 0) {
|
|
7471
|
+
return void 0;
|
|
7472
|
+
}
|
|
7473
|
+
const methodName = node.callee.property;
|
|
7474
|
+
if (BLOCKED_PROPERTIES.has(methodName)) {
|
|
7475
|
+
throw new ExpressionParserError(`Property "${methodName}" is not accessible for security reasons`, 0, this.expression);
|
|
7476
|
+
}
|
|
7477
|
+
if (!this.isMethodSafe(obj, methodName)) {
|
|
7478
|
+
throw new ExpressionParserError(`Method "${methodName}" is not allowed for security reasons`, 0, this.expression);
|
|
7479
|
+
}
|
|
7480
|
+
const args = node.arguments.map((arg) => this.evaluate(arg));
|
|
7481
|
+
const method = obj[methodName];
|
|
7482
|
+
if (typeof method === "function") {
|
|
7483
|
+
return method.call(obj, ...args);
|
|
7484
|
+
}
|
|
7485
|
+
return void 0;
|
|
7486
|
+
}
|
|
7487
|
+
evaluateArrayLiteral(node) {
|
|
7488
|
+
return node.elements.map((element) => this.evaluate(element));
|
|
7489
|
+
}
|
|
7490
|
+
evaluateObjectLiteral(node) {
|
|
7491
|
+
const result = {};
|
|
7492
|
+
for (const { key, value } of node.properties) {
|
|
7493
|
+
if (BLOCKED_PROPERTIES.has(key)) {
|
|
7494
|
+
throw new ExpressionParserError(`Property "${key}" is not allowed in object literals for security reasons`, 0, this.expression);
|
|
7495
|
+
}
|
|
7496
|
+
result[key] = this.evaluate(value);
|
|
7497
|
+
}
|
|
7498
|
+
return result;
|
|
7499
|
+
}
|
|
7500
|
+
evaluateArrowFunction(node) {
|
|
7501
|
+
const parentScope = this.scope;
|
|
7502
|
+
const expression = this.expression;
|
|
7503
|
+
return (...args) => {
|
|
7504
|
+
const childScope = { ...parentScope };
|
|
7505
|
+
for (let i = 0; i < node.params.length; i++) {
|
|
7506
|
+
childScope[node.params[i]] = args[i];
|
|
7507
|
+
}
|
|
7508
|
+
const childEvaluator = new _Evaluator(childScope, expression);
|
|
7509
|
+
return childEvaluator.evaluate(node.body);
|
|
7510
|
+
};
|
|
7511
|
+
}
|
|
7512
|
+
isMethodSafe(obj, methodName) {
|
|
7513
|
+
if (obj === null || obj === void 0) {
|
|
7514
|
+
return false;
|
|
7515
|
+
}
|
|
7516
|
+
const type = Array.isArray(obj) ? "array" : obj instanceof Date ? "date" : typeof obj;
|
|
7517
|
+
const safeMethods = SAFE_METHODS[type];
|
|
7518
|
+
if (!safeMethods) {
|
|
7519
|
+
return false;
|
|
7520
|
+
}
|
|
7521
|
+
return safeMethods.has(methodName);
|
|
7522
|
+
}
|
|
7523
|
+
};
|
|
7524
|
+
|
|
7525
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/tokenizer.ts
|
|
7526
|
+
var IDENTIFIER_START = /[\p{ID_Start}$_]/u;
|
|
7527
|
+
var IDENTIFIER_PART = /[\p{ID_Continue}$]/u;
|
|
7528
|
+
var Tokenizer = class {
|
|
7529
|
+
position = 0;
|
|
7530
|
+
expression;
|
|
7531
|
+
constructor(expression) {
|
|
7532
|
+
this.expression = expression;
|
|
7533
|
+
}
|
|
7534
|
+
/** Tokenize the entire expression */
|
|
7535
|
+
tokenize() {
|
|
7536
|
+
const tokens = [];
|
|
7537
|
+
while (this.position < this.expression.length) {
|
|
7538
|
+
this.skipWhitespace();
|
|
7539
|
+
if (this.position >= this.expression.length) {
|
|
7540
|
+
break;
|
|
7541
|
+
}
|
|
7542
|
+
const token = this.nextToken();
|
|
7543
|
+
tokens.push(token);
|
|
7544
|
+
}
|
|
7545
|
+
tokens.push({ type: "EOF" /* EOF */, value: "", position: this.position });
|
|
7546
|
+
return tokens;
|
|
7547
|
+
}
|
|
7548
|
+
skipWhitespace() {
|
|
7549
|
+
while (this.position < this.expression.length && /\s/.test(this.expression[this.position])) {
|
|
7550
|
+
this.position++;
|
|
7551
|
+
}
|
|
7552
|
+
}
|
|
7553
|
+
nextToken() {
|
|
7554
|
+
const char = this.expression[this.position];
|
|
7555
|
+
if (char === '"' || char === "'") {
|
|
7556
|
+
return this.readString(char);
|
|
7557
|
+
}
|
|
7558
|
+
if (/[0-9]/.test(char)) {
|
|
7559
|
+
return this.readNumber();
|
|
7560
|
+
}
|
|
7561
|
+
if (IDENTIFIER_START.test(this.codePointAt(this.position))) {
|
|
7562
|
+
return this.readIdentifierOrKeyword();
|
|
7563
|
+
}
|
|
7564
|
+
return this.readOperatorOrPunctuation();
|
|
7565
|
+
}
|
|
7566
|
+
readString(quote) {
|
|
7567
|
+
const start = this.position;
|
|
7568
|
+
this.position++;
|
|
7569
|
+
let value = "";
|
|
7570
|
+
while (this.position < this.expression.length) {
|
|
7571
|
+
const char = this.expression[this.position];
|
|
7572
|
+
if (char === quote) {
|
|
7573
|
+
this.position++;
|
|
7574
|
+
return { type: "STRING" /* STRING */, value, position: start };
|
|
7575
|
+
}
|
|
7576
|
+
if (char === "\\" && this.position + 1 < this.expression.length) {
|
|
7577
|
+
this.position++;
|
|
7578
|
+
const nextChar = this.expression[this.position];
|
|
7579
|
+
switch (nextChar) {
|
|
7580
|
+
case "n":
|
|
7581
|
+
value += "\n";
|
|
7582
|
+
break;
|
|
7583
|
+
case "t":
|
|
7584
|
+
value += " ";
|
|
7585
|
+
break;
|
|
7586
|
+
case "r":
|
|
7587
|
+
value += "\r";
|
|
7588
|
+
break;
|
|
7589
|
+
case "\\":
|
|
7590
|
+
value += "\\";
|
|
7591
|
+
break;
|
|
7592
|
+
case quote:
|
|
7593
|
+
value += quote;
|
|
7594
|
+
break;
|
|
7595
|
+
default:
|
|
7596
|
+
value += nextChar;
|
|
7597
|
+
}
|
|
7598
|
+
this.position++;
|
|
7599
|
+
} else {
|
|
7600
|
+
value += char;
|
|
7601
|
+
this.position++;
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
throw new ExpressionParserError("Unterminated string literal", start, this.expression);
|
|
7605
|
+
}
|
|
7606
|
+
readNumber() {
|
|
7607
|
+
const start = this.position;
|
|
7608
|
+
let value = "";
|
|
7609
|
+
while (this.position < this.expression.length && /[0-9.]/.test(this.expression[this.position])) {
|
|
7610
|
+
value += this.expression[this.position];
|
|
7611
|
+
this.position++;
|
|
7612
|
+
}
|
|
7613
|
+
if (!/^\d+(\.\d+)?$/.test(value)) {
|
|
7614
|
+
throw new ExpressionParserError(`Invalid number: ${value}`, start, this.expression);
|
|
7615
|
+
}
|
|
7616
|
+
return { type: "NUMBER" /* NUMBER */, value, position: start };
|
|
7617
|
+
}
|
|
7618
|
+
readIdentifierOrKeyword() {
|
|
7619
|
+
const start = this.position;
|
|
7620
|
+
let value = "";
|
|
7621
|
+
while (this.position < this.expression.length) {
|
|
7622
|
+
const char = this.codePointAt(this.position);
|
|
7623
|
+
if (!IDENTIFIER_PART.test(char)) {
|
|
7624
|
+
break;
|
|
7625
|
+
}
|
|
7626
|
+
value += char;
|
|
7627
|
+
this.position += char.length;
|
|
7628
|
+
}
|
|
7629
|
+
const type = this.getKeywordType(value);
|
|
7630
|
+
return { type, value, position: start };
|
|
7631
|
+
}
|
|
7632
|
+
/** Reads the whole code point at `position`, keeping surrogate pairs intact. */
|
|
7633
|
+
codePointAt(position) {
|
|
7634
|
+
const codePoint = this.expression.codePointAt(position);
|
|
7635
|
+
return codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
|
|
7636
|
+
}
|
|
7637
|
+
getKeywordType(value) {
|
|
7638
|
+
switch (value) {
|
|
7639
|
+
case "true":
|
|
7640
|
+
return "TRUE" /* TRUE */;
|
|
7641
|
+
case "false":
|
|
7642
|
+
return "FALSE" /* FALSE */;
|
|
7643
|
+
case "null":
|
|
7644
|
+
return "NULL" /* NULL */;
|
|
7645
|
+
case "undefined":
|
|
7646
|
+
return "UNDEFINED" /* UNDEFINED */;
|
|
7647
|
+
default:
|
|
7648
|
+
return "IDENTIFIER" /* IDENTIFIER */;
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7651
|
+
readOperatorOrPunctuation() {
|
|
7652
|
+
const start = this.position;
|
|
7653
|
+
const char = this.expression[this.position];
|
|
7654
|
+
const nextChar = this.position + 1 < this.expression.length ? this.expression[this.position + 1] : "";
|
|
7655
|
+
const thirdChar = this.position + 2 < this.expression.length ? this.expression[this.position + 2] : "";
|
|
7656
|
+
const threeChar = char + nextChar + thirdChar;
|
|
7657
|
+
if (threeChar === "===") {
|
|
7658
|
+
this.position += 3;
|
|
7659
|
+
return { type: "EQUAL" /* EQUAL */, value: "===", position: start };
|
|
7660
|
+
}
|
|
7661
|
+
if (threeChar === "!==") {
|
|
7662
|
+
this.position += 3;
|
|
7663
|
+
return { type: "NOT_EQUAL" /* NOT_EQUAL */, value: "!==", position: start };
|
|
7664
|
+
}
|
|
7665
|
+
const twoChar = char + nextChar;
|
|
7666
|
+
switch (twoChar) {
|
|
7667
|
+
case "==":
|
|
7668
|
+
this.position += 2;
|
|
7669
|
+
return { type: "EQUAL" /* EQUAL */, value: "==", position: start };
|
|
7670
|
+
case "!=":
|
|
7671
|
+
this.position += 2;
|
|
7672
|
+
return { type: "NOT_EQUAL" /* NOT_EQUAL */, value: "!=", position: start };
|
|
7673
|
+
case ">=":
|
|
7674
|
+
this.position += 2;
|
|
7675
|
+
return { type: "GREATER_EQUAL" /* GREATER_EQUAL */, value: ">=", position: start };
|
|
7676
|
+
case "<=":
|
|
7677
|
+
this.position += 2;
|
|
7678
|
+
return { type: "LESS_EQUAL" /* LESS_EQUAL */, value: "<=", position: start };
|
|
7679
|
+
case "&&":
|
|
7680
|
+
this.position += 2;
|
|
7681
|
+
return { type: "AND" /* AND */, value: "&&", position: start };
|
|
7682
|
+
case "||":
|
|
7683
|
+
this.position += 2;
|
|
7684
|
+
return { type: "OR" /* OR */, value: "||", position: start };
|
|
7685
|
+
case "=>":
|
|
7686
|
+
this.position += 2;
|
|
7687
|
+
return { type: "ARROW" /* ARROW */, value: "=>", position: start };
|
|
7688
|
+
case "??":
|
|
7689
|
+
this.position += 2;
|
|
7690
|
+
return { type: "NULLISH" /* NULLISH */, value: "??", position: start };
|
|
7691
|
+
case "?.":
|
|
7692
|
+
this.position += 2;
|
|
7693
|
+
return { type: "OPTIONAL_DOT" /* OPTIONAL_DOT */, value: "?.", position: start };
|
|
7694
|
+
}
|
|
7695
|
+
this.position++;
|
|
7696
|
+
switch (char) {
|
|
7697
|
+
case "+":
|
|
7698
|
+
return { type: "PLUS" /* PLUS */, value: "+", position: start };
|
|
7699
|
+
case "-":
|
|
7700
|
+
return { type: "MINUS" /* MINUS */, value: "-", position: start };
|
|
7701
|
+
case "*":
|
|
7702
|
+
return { type: "MULTIPLY" /* MULTIPLY */, value: "*", position: start };
|
|
7703
|
+
case "/":
|
|
7704
|
+
return { type: "DIVIDE" /* DIVIDE */, value: "/", position: start };
|
|
7705
|
+
case "%":
|
|
7706
|
+
return { type: "MODULO" /* MODULO */, value: "%", position: start };
|
|
7707
|
+
case ">":
|
|
7708
|
+
return { type: "GREATER" /* GREATER */, value: ">", position: start };
|
|
7709
|
+
case "<":
|
|
7710
|
+
return { type: "LESS" /* LESS */, value: "<", position: start };
|
|
7711
|
+
case "!":
|
|
7712
|
+
return { type: "NOT" /* NOT */, value: "!", position: start };
|
|
7713
|
+
case ".":
|
|
7714
|
+
return { type: "DOT" /* DOT */, value: ".", position: start };
|
|
7715
|
+
case ",":
|
|
7716
|
+
return { type: "COMMA" /* COMMA */, value: ",", position: start };
|
|
7717
|
+
case ":":
|
|
7718
|
+
return { type: "COLON" /* COLON */, value: ":", position: start };
|
|
7719
|
+
case "(":
|
|
7720
|
+
return { type: "LPAREN" /* LPAREN */, value: "(", position: start };
|
|
7721
|
+
case ")":
|
|
7722
|
+
return { type: "RPAREN" /* RPAREN */, value: ")", position: start };
|
|
7723
|
+
case "[":
|
|
7724
|
+
return { type: "LBRACKET" /* LBRACKET */, value: "[", position: start };
|
|
7725
|
+
case "]":
|
|
7726
|
+
return { type: "RBRACKET" /* RBRACKET */, value: "]", position: start };
|
|
7727
|
+
case "{":
|
|
7728
|
+
return { type: "LBRACE" /* LBRACE */, value: "{", position: start };
|
|
7729
|
+
case "}":
|
|
7730
|
+
return { type: "RBRACE" /* RBRACE */, value: "}", position: start };
|
|
7731
|
+
case "?":
|
|
7732
|
+
return { type: "QUESTION" /* QUESTION */, value: "?", position: start };
|
|
7733
|
+
default:
|
|
7734
|
+
throw new ExpressionParserError(`Unexpected character: ${char}`, start, this.expression);
|
|
7735
|
+
}
|
|
7736
|
+
}
|
|
7737
|
+
};
|
|
7738
|
+
|
|
7739
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/parser.ts
|
|
7740
|
+
var Parser = class {
|
|
7741
|
+
tokens = [];
|
|
7742
|
+
current = 0;
|
|
7743
|
+
expression;
|
|
7744
|
+
constructor(expression) {
|
|
7745
|
+
this.expression = expression;
|
|
7746
|
+
}
|
|
7747
|
+
/** Parse the expression into an AST */
|
|
7748
|
+
parse() {
|
|
7749
|
+
const tokenizer = new Tokenizer(this.expression);
|
|
7750
|
+
this.tokens = tokenizer.tokenize();
|
|
7751
|
+
this.current = 0;
|
|
7752
|
+
if (this.isAtEnd()) {
|
|
7753
|
+
throw new ExpressionParserError("Empty expression", 0, this.expression);
|
|
7754
|
+
}
|
|
7755
|
+
const result = this.parseExpression();
|
|
7756
|
+
if (!this.isAtEnd()) {
|
|
7757
|
+
const token = this.peek();
|
|
7758
|
+
throw new ExpressionParserError(
|
|
7759
|
+
`Unexpected token '${token.value}' at position ${token.position} \u2014 expression has trailing content`,
|
|
7760
|
+
token.position,
|
|
7761
|
+
this.expression
|
|
7762
|
+
);
|
|
7763
|
+
}
|
|
7764
|
+
return result;
|
|
7765
|
+
}
|
|
7766
|
+
parseExpression() {
|
|
7767
|
+
const arrow = this.tryParseArrowFunction();
|
|
7768
|
+
if (arrow) return arrow;
|
|
7769
|
+
return this.parseConditional();
|
|
7770
|
+
}
|
|
7771
|
+
/**
|
|
7772
|
+
* Ternary `test ? consequent : alternate` — right-associative, sits between
|
|
7773
|
+
* the arrow-function check and logical-or in precedence.
|
|
7774
|
+
*/
|
|
7775
|
+
parseConditional() {
|
|
7776
|
+
const test = this.parseShortCircuit();
|
|
7777
|
+
if (!this.match("QUESTION" /* QUESTION */)) return test;
|
|
7778
|
+
const consequent = this.parseExpression();
|
|
7779
|
+
this.consume("COLON" /* COLON */, 'Expected ":" between ternary branches');
|
|
7780
|
+
const alternate = this.parseExpression();
|
|
7781
|
+
return { type: "Conditional", test, consequent, alternate };
|
|
7782
|
+
}
|
|
7783
|
+
/**
|
|
7784
|
+
* Attempts to parse an arrow function. Returns null and leaves position
|
|
7785
|
+
* unchanged if the next tokens don't form an arrow function head.
|
|
7786
|
+
*/
|
|
7787
|
+
tryParseArrowFunction() {
|
|
7788
|
+
const savedPos = this.current;
|
|
7789
|
+
if (this.check("IDENTIFIER" /* IDENTIFIER */) && this.checkAt(this.current + 1, "ARROW" /* ARROW */)) {
|
|
7790
|
+
const param = this.advance().value;
|
|
7791
|
+
this.advance();
|
|
7792
|
+
const body = this.parseExpression();
|
|
7793
|
+
return { type: "ArrowFunction", params: [param], body };
|
|
7794
|
+
}
|
|
7795
|
+
if (this.check("LPAREN" /* LPAREN */)) {
|
|
7796
|
+
this.advance();
|
|
7797
|
+
const params = [];
|
|
7798
|
+
if (this.check("RPAREN" /* RPAREN */)) {
|
|
7799
|
+
this.advance();
|
|
7800
|
+
} else if (this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7801
|
+
params.push(this.advance().value);
|
|
7802
|
+
while (this.check("COMMA" /* COMMA */)) {
|
|
7803
|
+
this.advance();
|
|
7804
|
+
if (!this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7805
|
+
this.current = savedPos;
|
|
7806
|
+
return null;
|
|
7807
|
+
}
|
|
7808
|
+
params.push(this.advance().value);
|
|
7809
|
+
}
|
|
7810
|
+
if (!this.check("RPAREN" /* RPAREN */)) {
|
|
7811
|
+
this.current = savedPos;
|
|
7812
|
+
return null;
|
|
7813
|
+
}
|
|
7814
|
+
this.advance();
|
|
7815
|
+
} else {
|
|
7816
|
+
this.current = savedPos;
|
|
7817
|
+
return null;
|
|
7818
|
+
}
|
|
7819
|
+
if (!this.check("ARROW" /* ARROW */)) {
|
|
7820
|
+
this.current = savedPos;
|
|
7821
|
+
return null;
|
|
7822
|
+
}
|
|
7823
|
+
this.advance();
|
|
7824
|
+
const body = this.parseExpression();
|
|
7825
|
+
return { type: "ArrowFunction", params, body };
|
|
7826
|
+
}
|
|
7827
|
+
return null;
|
|
7828
|
+
}
|
|
7829
|
+
checkAt(index, type) {
|
|
7830
|
+
if (index < 0 || index >= this.tokens.length) return false;
|
|
7831
|
+
return this.tokens[index].type === type;
|
|
7832
|
+
}
|
|
7833
|
+
/**
|
|
7834
|
+
* `a ?? b` or an `||`/`&&` chain. As in JavaScript, `??` can't be mixed with
|
|
7835
|
+
* `&&` or `||` without parentheses.
|
|
7836
|
+
*/
|
|
7837
|
+
parseShortCircuit() {
|
|
7838
|
+
const first = this.parseEquality();
|
|
7839
|
+
if (!this.check("NULLISH" /* NULLISH */)) {
|
|
7840
|
+
const node2 = this.parseLogicalOr(first);
|
|
7841
|
+
if (this.check("NULLISH" /* NULLISH */)) this.throwMixedNullish();
|
|
7842
|
+
return node2;
|
|
7843
|
+
}
|
|
7844
|
+
let node = first;
|
|
7845
|
+
while (this.match("NULLISH" /* NULLISH */)) {
|
|
7846
|
+
node = { type: "BinaryOp", operator: "??", left: node, right: this.parseEquality() };
|
|
7847
|
+
}
|
|
7848
|
+
if (this.check("AND" /* AND */) || this.check("OR" /* OR */)) this.throwMixedNullish();
|
|
7849
|
+
return node;
|
|
7850
|
+
}
|
|
7851
|
+
throwMixedNullish() {
|
|
7852
|
+
throw new ExpressionParserError('Cannot mix "??" with "&&" or "||" without parentheses', this.peek().position, this.expression);
|
|
7853
|
+
}
|
|
7854
|
+
parseLogicalOr(first) {
|
|
7855
|
+
let node = this.parseLogicalAnd(first);
|
|
7856
|
+
while (this.match("OR" /* OR */)) {
|
|
7857
|
+
const operator = this.previous().value;
|
|
7858
|
+
const right = this.parseLogicalAnd();
|
|
7859
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7860
|
+
}
|
|
7861
|
+
return node;
|
|
7862
|
+
}
|
|
7863
|
+
parseLogicalAnd(first) {
|
|
7864
|
+
let node = first ?? this.parseEquality();
|
|
7865
|
+
while (this.match("AND" /* AND */)) {
|
|
7866
|
+
const operator = this.previous().value;
|
|
7867
|
+
const right = this.parseEquality();
|
|
7868
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7869
|
+
}
|
|
7870
|
+
return node;
|
|
7871
|
+
}
|
|
7872
|
+
parseEquality() {
|
|
7873
|
+
let node = this.parseComparison();
|
|
7874
|
+
while (this.match("EQUAL" /* EQUAL */, "NOT_EQUAL" /* NOT_EQUAL */)) {
|
|
7875
|
+
const operator = this.previous().value;
|
|
7876
|
+
const right = this.parseComparison();
|
|
7877
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7878
|
+
}
|
|
7879
|
+
return node;
|
|
7880
|
+
}
|
|
7881
|
+
parseComparison() {
|
|
7882
|
+
let node = this.parseAddition();
|
|
7883
|
+
while (this.match("GREATER" /* GREATER */, "GREATER_EQUAL" /* GREATER_EQUAL */, "LESS" /* LESS */, "LESS_EQUAL" /* LESS_EQUAL */)) {
|
|
7884
|
+
const operator = this.previous().value;
|
|
7885
|
+
const right = this.parseAddition();
|
|
7886
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7887
|
+
}
|
|
7888
|
+
return node;
|
|
7889
|
+
}
|
|
7890
|
+
parseAddition() {
|
|
7891
|
+
let node = this.parseMultiplication();
|
|
7892
|
+
while (this.match("PLUS" /* PLUS */, "MINUS" /* MINUS */)) {
|
|
7893
|
+
const operator = this.previous().value;
|
|
7894
|
+
const right = this.parseMultiplication();
|
|
7895
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7896
|
+
}
|
|
7897
|
+
return node;
|
|
7898
|
+
}
|
|
7899
|
+
parseMultiplication() {
|
|
7900
|
+
let node = this.parseUnary();
|
|
7901
|
+
while (this.match("MULTIPLY" /* MULTIPLY */, "DIVIDE" /* DIVIDE */, "MODULO" /* MODULO */)) {
|
|
7902
|
+
const operator = this.previous().value;
|
|
7903
|
+
const right = this.parseUnary();
|
|
7904
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7905
|
+
}
|
|
7906
|
+
return node;
|
|
7907
|
+
}
|
|
7908
|
+
parseUnary() {
|
|
7909
|
+
if (this.match("NOT" /* NOT */, "MINUS" /* MINUS */, "PLUS" /* PLUS */)) {
|
|
7910
|
+
const operator = this.previous().value;
|
|
7911
|
+
const operand = this.parseUnary();
|
|
7912
|
+
return { type: "UnaryOp", operator, operand };
|
|
7913
|
+
}
|
|
7914
|
+
return this.parsePostfix();
|
|
7915
|
+
}
|
|
7916
|
+
parsePostfix() {
|
|
7917
|
+
let node = this.parsePrimary();
|
|
7918
|
+
while (true) {
|
|
7919
|
+
if (this.match("DOT" /* DOT */)) {
|
|
7920
|
+
if (!this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7921
|
+
throw new ExpressionParserError('Expected property name after "."', this.peek().position, this.expression);
|
|
7922
|
+
}
|
|
7923
|
+
const property = this.advance().value;
|
|
7924
|
+
node = { type: "MemberAccess", object: node, property };
|
|
7925
|
+
} else if (this.match("OPTIONAL_DOT" /* OPTIONAL_DOT */)) {
|
|
7926
|
+
if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7927
|
+
const property = this.parseExpression();
|
|
7928
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after computed property');
|
|
7929
|
+
node = { type: "ComputedMemberAccess", object: node, property, optional: true };
|
|
7930
|
+
} else if (this.match("LPAREN" /* LPAREN */)) {
|
|
7931
|
+
const args = this.parseArgumentList();
|
|
7932
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after arguments');
|
|
7933
|
+
node = { type: "CallExpression", callee: node, arguments: args, optional: true };
|
|
7934
|
+
} else if (this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7935
|
+
const property = this.advance().value;
|
|
7936
|
+
node = { type: "MemberAccess", object: node, property, optional: true };
|
|
7937
|
+
} else {
|
|
7938
|
+
throw new ExpressionParserError('Expected property name, "[", or "(" after "?."', this.peek().position, this.expression);
|
|
7939
|
+
}
|
|
7940
|
+
} else if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7941
|
+
const property = this.parseExpression();
|
|
7942
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after computed property');
|
|
7943
|
+
node = { type: "ComputedMemberAccess", object: node, property };
|
|
7944
|
+
} else if (this.match("LPAREN" /* LPAREN */)) {
|
|
7945
|
+
const args = this.parseArgumentList();
|
|
7946
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after arguments');
|
|
7947
|
+
node = { type: "CallExpression", callee: node, arguments: args };
|
|
7948
|
+
} else {
|
|
7949
|
+
break;
|
|
7950
|
+
}
|
|
7951
|
+
}
|
|
7952
|
+
return node;
|
|
7953
|
+
}
|
|
7954
|
+
parsePrimary() {
|
|
7955
|
+
if (this.match("TRUE" /* TRUE */)) {
|
|
7956
|
+
return { type: "Literal", value: true };
|
|
7957
|
+
}
|
|
7958
|
+
if (this.match("FALSE" /* FALSE */)) {
|
|
7959
|
+
return { type: "Literal", value: false };
|
|
7960
|
+
}
|
|
7961
|
+
if (this.match("NULL" /* NULL */)) {
|
|
7962
|
+
return { type: "Literal", value: null };
|
|
7963
|
+
}
|
|
7964
|
+
if (this.match("UNDEFINED" /* UNDEFINED */)) {
|
|
7965
|
+
return { type: "Literal", value: void 0 };
|
|
7966
|
+
}
|
|
7967
|
+
if (this.match("NUMBER" /* NUMBER */)) {
|
|
7968
|
+
return { type: "Literal", value: parseFloat(this.previous().value) };
|
|
7969
|
+
}
|
|
7970
|
+
if (this.match("STRING" /* STRING */)) {
|
|
7971
|
+
return { type: "Literal", value: this.previous().value };
|
|
7972
|
+
}
|
|
7973
|
+
if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7974
|
+
const elements = this.parseArrayElements();
|
|
7975
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after array elements');
|
|
7976
|
+
return { type: "ArrayLiteral", elements };
|
|
7977
|
+
}
|
|
7978
|
+
if (this.match("LBRACE" /* LBRACE */)) {
|
|
7979
|
+
const properties = this.parseObjectProperties();
|
|
7980
|
+
this.consume("RBRACE" /* RBRACE */, 'Expected "}" after object properties');
|
|
7981
|
+
return { type: "ObjectLiteral", properties };
|
|
7982
|
+
}
|
|
7983
|
+
if (this.match("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7984
|
+
return { type: "Identifier", name: this.previous().value };
|
|
7985
|
+
}
|
|
7986
|
+
if (this.match("LPAREN" /* LPAREN */)) {
|
|
7987
|
+
const expr = this.parseExpression();
|
|
7988
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after expression');
|
|
7989
|
+
return expr;
|
|
7990
|
+
}
|
|
7991
|
+
throw new ExpressionParserError(`Unexpected token: ${this.peek().value}`, this.peek().position, this.expression);
|
|
7992
|
+
}
|
|
7993
|
+
parseArgumentList() {
|
|
7994
|
+
const args = [];
|
|
7995
|
+
if (!this.check("RPAREN" /* RPAREN */)) {
|
|
7996
|
+
do {
|
|
7997
|
+
args.push(this.parseExpression());
|
|
7998
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
7999
|
+
}
|
|
8000
|
+
return args;
|
|
8001
|
+
}
|
|
8002
|
+
parseArrayElements() {
|
|
8003
|
+
const elements = [];
|
|
8004
|
+
if (!this.check("RBRACKET" /* RBRACKET */)) {
|
|
8005
|
+
do {
|
|
8006
|
+
elements.push(this.parseExpression());
|
|
8007
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
8008
|
+
}
|
|
8009
|
+
return elements;
|
|
8010
|
+
}
|
|
8011
|
+
parseObjectProperties() {
|
|
8012
|
+
const properties = [];
|
|
8013
|
+
if (this.check("RBRACE" /* RBRACE */)) {
|
|
8014
|
+
return properties;
|
|
8015
|
+
}
|
|
8016
|
+
do {
|
|
8017
|
+
if (this.check("RBRACE" /* RBRACE */)) break;
|
|
8018
|
+
let key;
|
|
8019
|
+
if (this.check("IDENTIFIER" /* IDENTIFIER */) || this.check("STRING" /* STRING */)) {
|
|
8020
|
+
key = this.advance().value;
|
|
8021
|
+
} else {
|
|
8022
|
+
throw new ExpressionParserError(
|
|
8023
|
+
`Expected property name (identifier or string) in object literal, got '${this.peek().value}'`,
|
|
8024
|
+
this.peek().position,
|
|
8025
|
+
this.expression
|
|
8026
|
+
);
|
|
8027
|
+
}
|
|
8028
|
+
this.consume("COLON" /* COLON */, 'Expected ":" after property name in object literal');
|
|
8029
|
+
const value = this.parseExpression();
|
|
8030
|
+
properties.push({ key, value });
|
|
8031
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
8032
|
+
return properties;
|
|
8033
|
+
}
|
|
8034
|
+
match(...types) {
|
|
8035
|
+
for (const type of types) {
|
|
8036
|
+
if (this.check(type)) {
|
|
8037
|
+
this.advance();
|
|
8038
|
+
return true;
|
|
8039
|
+
}
|
|
8040
|
+
}
|
|
8041
|
+
return false;
|
|
8042
|
+
}
|
|
8043
|
+
check(type) {
|
|
8044
|
+
if (this.isAtEnd()) return false;
|
|
8045
|
+
return this.peek().type === type;
|
|
8046
|
+
}
|
|
8047
|
+
advance() {
|
|
8048
|
+
if (!this.isAtEnd()) this.current++;
|
|
8049
|
+
return this.previous();
|
|
8050
|
+
}
|
|
8051
|
+
isAtEnd() {
|
|
8052
|
+
return this.peek().type === "EOF" /* EOF */;
|
|
8053
|
+
}
|
|
8054
|
+
peek() {
|
|
8055
|
+
return this.tokens[this.current];
|
|
8056
|
+
}
|
|
8057
|
+
previous() {
|
|
8058
|
+
return this.tokens[this.current - 1];
|
|
8059
|
+
}
|
|
8060
|
+
consume(type, message) {
|
|
8061
|
+
if (this.check(type)) return this.advance();
|
|
8062
|
+
throw new ExpressionParserError(message, this.peek().position, this.expression);
|
|
8063
|
+
}
|
|
8064
|
+
};
|
|
8065
|
+
|
|
8066
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/expression-parser.ts
|
|
8067
|
+
var MAX_AST_CACHE_SIZE = 1e3;
|
|
8068
|
+
var LRUCache = class {
|
|
8069
|
+
cache = /* @__PURE__ */ new Map();
|
|
8070
|
+
maxSize;
|
|
8071
|
+
constructor(maxSize) {
|
|
8072
|
+
this.maxSize = maxSize;
|
|
8073
|
+
}
|
|
8074
|
+
get(key) {
|
|
8075
|
+
const value = this.cache.get(key);
|
|
8076
|
+
if (value !== void 0) {
|
|
8077
|
+
this.cache.delete(key);
|
|
8078
|
+
this.cache.set(key, value);
|
|
8079
|
+
}
|
|
8080
|
+
return value;
|
|
8081
|
+
}
|
|
8082
|
+
set(key, value) {
|
|
8083
|
+
if (this.cache.has(key)) {
|
|
8084
|
+
this.cache.delete(key);
|
|
8085
|
+
}
|
|
8086
|
+
this.cache.set(key, value);
|
|
8087
|
+
if (this.cache.size > this.maxSize) {
|
|
8088
|
+
const firstKey = this.cache.keys().next().value;
|
|
8089
|
+
if (firstKey !== void 0) {
|
|
8090
|
+
this.cache.delete(firstKey);
|
|
8091
|
+
}
|
|
8092
|
+
}
|
|
8093
|
+
}
|
|
8094
|
+
clear() {
|
|
8095
|
+
this.cache.clear();
|
|
8096
|
+
}
|
|
8097
|
+
get size() {
|
|
8098
|
+
return this.cache.size;
|
|
8099
|
+
}
|
|
8100
|
+
};
|
|
8101
|
+
var astCache = new LRUCache(MAX_AST_CACHE_SIZE);
|
|
8102
|
+
var ExpressionParser = class {
|
|
8103
|
+
/**
|
|
8104
|
+
* Parse an expression string into an AST
|
|
8105
|
+
* Results are cached for performance using LRU eviction
|
|
8106
|
+
*/
|
|
8107
|
+
static parse(expression) {
|
|
8108
|
+
const cached = astCache.get(expression);
|
|
8109
|
+
if (cached) {
|
|
8110
|
+
return cached;
|
|
8111
|
+
}
|
|
8112
|
+
const parser = new Parser(expression);
|
|
8113
|
+
const ast = parser.parse();
|
|
8114
|
+
astCache.set(expression, ast);
|
|
8115
|
+
return ast;
|
|
8116
|
+
}
|
|
8117
|
+
/** Evaluate an expression with a given scope */
|
|
8118
|
+
static evaluate(expression, scope) {
|
|
8119
|
+
try {
|
|
8120
|
+
const ast = this.parse(expression);
|
|
8121
|
+
const evaluator = new Evaluator(scope, expression);
|
|
8122
|
+
return evaluator.evaluate(ast);
|
|
8123
|
+
} catch (error) {
|
|
8124
|
+
if (error instanceof ExpressionParserError) {
|
|
8125
|
+
throw error;
|
|
8126
|
+
}
|
|
8127
|
+
throw new ExpressionParserError(
|
|
8128
|
+
`Error evaluating expression: ${error instanceof Error ? error.message : String(error)}`,
|
|
8129
|
+
0,
|
|
8130
|
+
expression
|
|
8131
|
+
);
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
/** Clear the AST cache */
|
|
8135
|
+
static clearCache() {
|
|
8136
|
+
astCache.clear();
|
|
8137
|
+
}
|
|
8138
|
+
/** Get cache statistics */
|
|
8139
|
+
static getCacheStats() {
|
|
8140
|
+
return {
|
|
8141
|
+
size: astCache.size,
|
|
8142
|
+
maxSize: MAX_AST_CACHE_SIZE
|
|
8143
|
+
};
|
|
8144
|
+
}
|
|
8145
|
+
};
|
|
8146
|
+
|
|
8147
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/static-check.ts
|
|
8148
|
+
var CONDITION_SCOPE_VARIABLES = /* @__PURE__ */ new Set([
|
|
8149
|
+
"fieldValue",
|
|
8150
|
+
"formValue",
|
|
8151
|
+
"fieldPath",
|
|
8152
|
+
"customFunctions",
|
|
8153
|
+
"groupValue",
|
|
8154
|
+
"rootFormValue",
|
|
8155
|
+
"arrayIndex",
|
|
8156
|
+
"arrayPath",
|
|
8157
|
+
"externalData",
|
|
8158
|
+
"fieldState",
|
|
8159
|
+
"formFieldState"
|
|
8160
|
+
]);
|
|
8161
|
+
function findStaticExpressionProblems(ast, scope) {
|
|
8162
|
+
const problems = /* @__PURE__ */ new Set();
|
|
8163
|
+
const visit2 = (node, locals) => {
|
|
8164
|
+
switch (node.type) {
|
|
8165
|
+
case "Identifier":
|
|
8166
|
+
if (!scope.has(node.name) && !locals.has(node.name)) problems.add(`'${node.name}' is not available in expressions`);
|
|
8167
|
+
return;
|
|
8168
|
+
case "MemberAccess":
|
|
8169
|
+
visit2(node.object, locals);
|
|
8170
|
+
return;
|
|
8171
|
+
case "ComputedMemberAccess":
|
|
8172
|
+
visit2(node.object, locals);
|
|
8173
|
+
visit2(node.property, locals);
|
|
8174
|
+
return;
|
|
8175
|
+
case "CallExpression":
|
|
8176
|
+
if (node.callee.type === "MemberAccess") {
|
|
8177
|
+
if (!ALLOWED_METHOD_NAMES.has(node.callee.property)) problems.add(`method '${node.callee.property}' is not allowed`);
|
|
8178
|
+
} else {
|
|
8179
|
+
problems.add(`'${describeCallee(node.callee)}(...)' is a direct function call; only allowed methods can be called`);
|
|
8180
|
+
}
|
|
8181
|
+
visit2(node.callee.type === "MemberAccess" ? node.callee.object : node.callee, locals);
|
|
8182
|
+
node.arguments.forEach((arg) => visit2(arg, locals));
|
|
8183
|
+
return;
|
|
8184
|
+
case "BinaryOp":
|
|
8185
|
+
visit2(node.left, locals);
|
|
8186
|
+
visit2(node.right, locals);
|
|
8187
|
+
return;
|
|
8188
|
+
case "UnaryOp":
|
|
8189
|
+
visit2(node.operand, locals);
|
|
8190
|
+
return;
|
|
8191
|
+
case "Conditional":
|
|
8192
|
+
visit2(node.test, locals);
|
|
8193
|
+
visit2(node.consequent, locals);
|
|
8194
|
+
visit2(node.alternate, locals);
|
|
8195
|
+
return;
|
|
8196
|
+
case "ArrayLiteral":
|
|
8197
|
+
node.elements.forEach((element) => visit2(element, locals));
|
|
8198
|
+
return;
|
|
8199
|
+
case "ObjectLiteral":
|
|
8200
|
+
node.properties.forEach((property) => visit2(property.value, locals));
|
|
8201
|
+
return;
|
|
8202
|
+
case "ArrowFunction":
|
|
8203
|
+
visit2(node.body, /* @__PURE__ */ new Set([...locals, ...node.params]));
|
|
8204
|
+
return;
|
|
8205
|
+
case "Literal":
|
|
8206
|
+
return;
|
|
8207
|
+
}
|
|
8208
|
+
};
|
|
8209
|
+
visit2(ast, /* @__PURE__ */ new Set());
|
|
8210
|
+
return [...problems];
|
|
8211
|
+
}
|
|
8212
|
+
function describeCallee(node) {
|
|
8213
|
+
return node.type === "Identifier" ? node.name : "expression";
|
|
8214
|
+
}
|
|
8215
|
+
function findFieldExpressionProblems(field) {
|
|
8216
|
+
const found = [];
|
|
8217
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
8218
|
+
const check = (expression, path) => {
|
|
8219
|
+
let problems;
|
|
8220
|
+
try {
|
|
8221
|
+
problems = findStaticExpressionProblems(ExpressionParser.parse(expression), CONDITION_SCOPE_VARIABLES);
|
|
8222
|
+
} catch (e) {
|
|
8223
|
+
problems = [e instanceof Error ? e.message : String(e)];
|
|
8224
|
+
}
|
|
8225
|
+
if (problems.length > 0) found.push({ path, expression, message: problems.join("; ") });
|
|
8226
|
+
};
|
|
8227
|
+
const visit2 = (node, path) => {
|
|
8228
|
+
if (node === null || typeof node !== "object" || seen.has(node)) return;
|
|
8229
|
+
seen.add(node);
|
|
8230
|
+
if (Array.isArray(node)) {
|
|
8231
|
+
node.forEach((item, i) => visit2(item, `${path}[${i}]`));
|
|
8232
|
+
return;
|
|
8233
|
+
}
|
|
8234
|
+
const record = node;
|
|
8235
|
+
const type = record["type"];
|
|
8236
|
+
if ((type === "javascript" || type === "derivation") && typeof record["expression"] === "string") {
|
|
8237
|
+
check(record["expression"], path);
|
|
8238
|
+
}
|
|
8239
|
+
if ((type === "and" || type === "or") && Array.isArray(record["conditions"]) && record["conditions"].length === 0) {
|
|
8240
|
+
found.push({ path, message: `an empty '${type}' group never fires` });
|
|
8241
|
+
}
|
|
8242
|
+
for (const [key, value] of Object.entries(record)) {
|
|
8243
|
+
if (key !== "fields") visit2(value, path ? `${path}.${key}` : key);
|
|
8244
|
+
}
|
|
8245
|
+
};
|
|
8246
|
+
if (field !== null && typeof field === "object" && typeof field["derivation"] === "string") {
|
|
8247
|
+
check(field["derivation"], "derivation");
|
|
8248
|
+
}
|
|
8249
|
+
visit2(field, "");
|
|
8250
|
+
return found;
|
|
8251
|
+
}
|
|
8252
|
+
|
|
7182
8253
|
// internal/dynamic-forms-validation/validate/src/tools/validate-config.tool.ts
|
|
7183
8254
|
var formConfigSchemas2 = {
|
|
7184
8255
|
material: MatFormConfigSchema,
|
|
@@ -7442,11 +8513,22 @@ function preValidateConfig(config) {
|
|
|
7442
8513
|
message: `Cannot mix page and non-page fields at top level. Found non-page fields: ${nonPageFields.join(", ")}. FIX: Move these fields INSIDE ${firstPageKey ? `the "${firstPageKey}" page` : "the first page"}'s fields array. In multi-page mode, hidden fields and other non-page fields must be placed inside a page (usually the first one). See: ngforge_quick_lookup topic="multi-page-gotchas"`
|
|
7443
8514
|
});
|
|
7444
8515
|
}
|
|
8516
|
+
const reportedExpressions = /* @__PURE__ */ new Set();
|
|
7445
8517
|
function checkField(field, path, parentType) {
|
|
7446
8518
|
if (!field || typeof field !== "object") return;
|
|
7447
8519
|
const f = field;
|
|
7448
8520
|
const fieldType = f["type"];
|
|
7449
8521
|
const fieldKey = f["key"];
|
|
8522
|
+
for (const problem of findFieldExpressionProblems(field)) {
|
|
8523
|
+
const problemPath = `${path}.${problem.path}`;
|
|
8524
|
+
if (reportedExpressions.has(problemPath)) continue;
|
|
8525
|
+
reportedExpressions.add(problemPath);
|
|
8526
|
+
errors.push({
|
|
8527
|
+
path: problemPath,
|
|
8528
|
+
ruleId: "core/expression-syntax",
|
|
8529
|
+
message: problem.expression === void 0 ? `${problem.message[0].toUpperCase()}${problem.message.slice(1)}: an empty group evaluates to false.` : `Expression '${problem.expression}' can never work: ${problem.message}. Expressions support property access, operators, ternaries and allowed methods only; use a custom function for anything else.`
|
|
8530
|
+
});
|
|
8531
|
+
}
|
|
7450
8532
|
const validators = f["validators"];
|
|
7451
8533
|
if (Array.isArray(validators)) {
|
|
7452
8534
|
validators.forEach((validator, vIdx) => {
|
|
@@ -8187,6 +9269,7 @@ function parseConfigInput(config) {
|
|
|
8187
9269
|
}
|
|
8188
9270
|
|
|
8189
9271
|
// internal/dynamic-forms-validation/reporting/fix-suggestions.ts
|
|
9272
|
+
var EXPRESSION_SYNTAX_SUGGESTION = "Rewrite with property access, operators, `??`, ternaries and allowed methods, for example `(formValue.a ?? 0) + 1` instead of `parseInt(formValue.a)`, or move the logic into a custom function.";
|
|
8190
9273
|
var FIX_SUGGESTIONS = {
|
|
8191
9274
|
options: "Move `options` from `props: { options: [...] }` to field level: `{ key, type, options: [...] }`",
|
|
8192
9275
|
label: "Remove `label` from this container field (page/group/row/array). Use a `text` field inside for headings.",
|
|
@@ -8222,6 +9305,7 @@ function pathSegments(path) {
|
|
|
8222
9305
|
return path.split(/[.[\]]+/).filter((segment) => segment.length > 0 && !/^\d+$/.test(segment));
|
|
8223
9306
|
}
|
|
8224
9307
|
function getFixSuggestion(error) {
|
|
9308
|
+
if (error.ruleId === "core/expression-syntax") return EXPRESSION_SYNTAX_SUGGESTION;
|
|
8225
9309
|
for (const segment of pathSegments(error.path).reverse()) {
|
|
8226
9310
|
if (FIX_SUGGESTIONS[segment]) {
|
|
8227
9311
|
return FIX_SUGGESTIONS[segment];
|
|
@@ -8362,6 +9446,11 @@ function rule(id, summary, why) {
|
|
|
8362
9446
|
var RULES = Object.freeze(
|
|
8363
9447
|
Object.fromEntries(
|
|
8364
9448
|
[
|
|
9449
|
+
rule(
|
|
9450
|
+
"core/expression-syntax",
|
|
9451
|
+
"Write conditions and derivations the expression parser can run",
|
|
9452
|
+
"An expression is a string, so the compiler never sees it. One using a global, a direct call or unparseable syntax evaluates to false or undefined at runtime instead of failing."
|
|
9453
|
+
),
|
|
8365
9454
|
rule(
|
|
8366
9455
|
"core/hidden-minimal",
|
|
8367
9456
|
"Keep hidden fields to `key`, `type`, `value` and `className`",
|
|
@@ -8612,7 +9701,7 @@ function registerResources(server) {
|
|
|
8612
9701
|
}
|
|
8613
9702
|
|
|
8614
9703
|
// packages/dynamic-form-mcp/src/tools/lookup.tool.ts
|
|
8615
|
-
import { z as
|
|
9704
|
+
import { z as z61 } from "zod";
|
|
8616
9705
|
|
|
8617
9706
|
// packages/dynamic-form-mcp/src/tools/data/lookup-topics.ts
|
|
8618
9707
|
var TOPICS = {
|
|
@@ -11914,11 +13003,11 @@ Patterns: field-placement, logic-matrix, context-api, containers, multi-page-got
|
|
|
11914
13003
|
Use topic="list" to see all available topics with descriptions.
|
|
11915
13004
|
Use ngforge_search query="your question" to find topics by keyword.`,
|
|
11916
13005
|
{
|
|
11917
|
-
topic:
|
|
13006
|
+
topic: z61.string().describe(
|
|
11918
13007
|
'Topic to look up: field types (input, select, hidden, group, row, array, container, page), wrappers (wrappers, css, section, arraySection), concepts (validation, conditional, derivation, property-derivation, options-format), patterns (golden-path, pitfalls, multi-page-gotchas), or "list" to see all topics'
|
|
11919
13008
|
),
|
|
11920
|
-
depth:
|
|
11921
|
-
uiIntegration:
|
|
13009
|
+
depth: z61.enum(["brief", "full", "schema"]).default("full").describe("brief=quick syntax (~20 lines), full=complete docs with examples, schema=include JSON schema"),
|
|
13010
|
+
uiIntegration: z61.enum(UI_INTEGRATIONS2).optional().describe("Filter UI-specific info (only with depth=schema). material, bootstrap, primeng, ionic")
|
|
11922
13011
|
},
|
|
11923
13012
|
async ({ topic, depth, uiIntegration }) => {
|
|
11924
13013
|
const normalizedTopic = topic.toLowerCase().trim();
|
|
@@ -11966,7 +13055,7 @@ ${nextSteps}`;
|
|
|
11966
13055
|
}
|
|
11967
13056
|
|
|
11968
13057
|
// packages/dynamic-form-mcp/src/tools/examples.tool.ts
|
|
11969
|
-
import { z as
|
|
13058
|
+
import { z as z62 } from "zod";
|
|
11970
13059
|
var PATTERNS = {
|
|
11971
13060
|
// ========== MINIMAL PATTERNS (NEW) ==========
|
|
11972
13061
|
"minimal-multipage": {
|
|
@@ -14047,21 +15136,24 @@ const megaFormConfig = {
|
|
|
14047
15136
|
key: 'sourceA',
|
|
14048
15137
|
type: 'input',
|
|
14049
15138
|
label: 'Source A',
|
|
14050
|
-
value:
|
|
15139
|
+
value: 10,
|
|
15140
|
+
props: { type: 'number' }
|
|
14051
15141
|
},
|
|
14052
15142
|
{
|
|
14053
15143
|
key: 'sourceB',
|
|
14054
15144
|
type: 'input',
|
|
14055
15145
|
label: 'Source B',
|
|
14056
|
-
value:
|
|
15146
|
+
value: 20,
|
|
15147
|
+
props: { type: 'number' }
|
|
14057
15148
|
},
|
|
14058
15149
|
{
|
|
14059
15150
|
key: 'derived',
|
|
14060
15151
|
type: 'input',
|
|
14061
15152
|
label: 'Derived (A + B)',
|
|
14062
15153
|
readonly: true,
|
|
15154
|
+
props: { type: 'number' },
|
|
14063
15155
|
// Self-targeting derivation - no targetField needed
|
|
14064
|
-
derivation: '
|
|
15156
|
+
derivation: '(formValue.sourceA ?? 0) + (formValue.sourceB ?? 0)'
|
|
14065
15157
|
},
|
|
14066
15158
|
|
|
14067
15159
|
// CONDITIONAL VISIBILITY
|
|
@@ -14231,10 +15323,10 @@ Standard patterns: derivation, property-derivation, multi-page, conditional, val
|
|
|
14231
15323
|
Use pattern="list" to see all available patterns.
|
|
14232
15324
|
Use depth="minimal" for code-only output (no markdown).`,
|
|
14233
15325
|
{
|
|
14234
|
-
pattern:
|
|
15326
|
+
pattern: z62.string().optional().describe(
|
|
14235
15327
|
'Pattern to get: minimal-multipage, minimal-array, minimal-simplified-array, minimal-conditional, minimal-validation, minimal-hidden, derivation, property-derivation, multi-page, conditional, validation, complete, mega. Use "list" to see all.'
|
|
14236
15328
|
),
|
|
14237
|
-
depth:
|
|
15329
|
+
depth: z62.enum(["minimal", "brief", "full", "explained"]).default("full").describe(
|
|
14238
15330
|
"minimal=code only (~20-50 lines), brief=code+summary, full=code+comments (default), explained=code+detailed explanation"
|
|
14239
15331
|
)
|
|
14240
15332
|
},
|
|
@@ -14301,7 +15393,7 @@ function extractCode(markdown) {
|
|
|
14301
15393
|
// packages/dynamic-form-mcp/src/tools/validate.tool.ts
|
|
14302
15394
|
import { access } from "node:fs/promises";
|
|
14303
15395
|
import { dirname as dirname2, join as join2, parse, resolve } from "node:path";
|
|
14304
|
-
import { z as
|
|
15396
|
+
import { z as z63 } from "zod";
|
|
14305
15397
|
var UI_INTEGRATIONS3 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14306
15398
|
async function projectDisabledRules(filePath) {
|
|
14307
15399
|
return (await loadProjectRules(await nearestManifest(dirname2(filePath)))).disabled;
|
|
@@ -14373,10 +15465,10 @@ Example errors you'll see:
|
|
|
14373
15465
|
- "options MUST be at FIELD level, NOT inside props"
|
|
14374
15466
|
- "containers only support 'hidden' logic type"`,
|
|
14375
15467
|
{
|
|
14376
|
-
config:
|
|
15468
|
+
config: z63.union([z63.string(), z63.object({}).passthrough()]).describe(
|
|
14377
15469
|
"File path (.ts/.js) OR JSON string OR JSON object. Auto-detects: paths ending in .ts/.js or starting with / are treated as files."
|
|
14378
15470
|
),
|
|
14379
|
-
uiIntegration:
|
|
15471
|
+
uiIntegration: z63.enum(UI_INTEGRATIONS3).default("material").describe("UI library to validate against (material, bootstrap, primeng, ionic). Defaults to material.")
|
|
14380
15472
|
},
|
|
14381
15473
|
async ({ config, uiIntegration }) => {
|
|
14382
15474
|
try {
|
|
@@ -14473,7 +15565,7 @@ If validating JSON, ensure:
|
|
|
14473
15565
|
}
|
|
14474
15566
|
|
|
14475
15567
|
// packages/dynamic-form-mcp/src/tools/scaffold.tool.ts
|
|
14476
|
-
import { z as
|
|
15568
|
+
import { z as z64 } from "zod";
|
|
14477
15569
|
var UI_INTEGRATIONS4 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14478
15570
|
function parseFieldDefs(fields) {
|
|
14479
15571
|
return fields.map((f) => {
|
|
@@ -14728,12 +15820,12 @@ Examples:
|
|
|
14728
15820
|
- With groups: pages=0 groups=["address","billing"]
|
|
14729
15821
|
- With hidden: hidden=["userId:abc123","source:web"]`,
|
|
14730
15822
|
{
|
|
14731
|
-
pages:
|
|
14732
|
-
arrays:
|
|
14733
|
-
groups:
|
|
14734
|
-
hidden:
|
|
14735
|
-
fields:
|
|
14736
|
-
uiIntegration:
|
|
15823
|
+
pages: z64.number().min(0).max(10).default(0).describe("Number of pages (0 = single-page form, 1-10 = multi-page wizard)"),
|
|
15824
|
+
arrays: z64.array(z64.string()).optional().describe('Array field names for dynamic lists, e.g., ["contacts", "addresses"]'),
|
|
15825
|
+
groups: z64.array(z64.string()).optional().describe('Group field names for nested objects, e.g., ["address", "billing"]'),
|
|
15826
|
+
hidden: z64.array(z64.string()).optional().describe('Hidden fields as "name:value" pairs, e.g., ["userId:abc", "version:1"]'),
|
|
15827
|
+
fields: z64.array(z64.string()).optional().describe('Basic fields as "name:type" pairs, e.g., ["email:input", "country:select", "age:slider"]'),
|
|
15828
|
+
uiIntegration: z64.enum(UI_INTEGRATIONS4).default("material").describe("UI library (for future UI-specific props). Defaults to material.")
|
|
14737
15829
|
},
|
|
14738
15830
|
async ({ pages, arrays = [], groups = [], hidden = [], fields = [] }) => {
|
|
14739
15831
|
const fieldDefs = parseFieldDefs(fields);
|
|
@@ -14775,7 +15867,7 @@ Examples:
|
|
|
14775
15867
|
}
|
|
14776
15868
|
|
|
14777
15869
|
// packages/dynamic-form-mcp/src/tools/search.tool.ts
|
|
14778
|
-
import { z as
|
|
15870
|
+
import { z as z65 } from "zod";
|
|
14779
15871
|
var searchIndex = null;
|
|
14780
15872
|
function getTopicSubcategory(key) {
|
|
14781
15873
|
const fieldTypes = ["input", "select", "slider", "radio", "checkbox", "textarea", "datepicker", "toggle", "text", "hidden"];
|
|
@@ -14936,7 +16028,7 @@ Use this when you don't know the exact topic name.
|
|
|
14936
16028
|
|
|
14937
16029
|
New to ng-forge? Start with: ngforge_lookup topic="workflow"`,
|
|
14938
16030
|
{
|
|
14939
|
-
query:
|
|
16031
|
+
query: z65.string().describe("Natural language or keywords to search for")
|
|
14940
16032
|
},
|
|
14941
16033
|
async ({ query }) => {
|
|
14942
16034
|
const index = buildIndex();
|