@ng-forge/dynamic-form-mcp 1.3.0-next.3 → 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 +1522 -436
- package/package.json +6 -6
- package/src/index.js +1522 -436
- package/src/registry/instructions.d.ts +1 -1
- package/src/registry/instructions.d.ts.map +1 -1
- package/src/tools/data/lookup-topics.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
|
}
|
|
@@ -3116,6 +3116,7 @@ Use \`options.fieldWindowing\` for large flat forms:
|
|
|
3116
3116
|
- \`park.margin\` follows \`IntersectionObserver.rootMargin\`: use one to four \`px\` or \`%\` values. Unsupported units fall back to the inherited margin.
|
|
3117
3117
|
- \`fieldWindowing: false\` disables inherited deferred mounting for that form.
|
|
3118
3118
|
- A park-only object changes parking without changing the inherited mounting mode. Use \`{ park: false }\` to opt out or \`{ park: true }\` to opt in.
|
|
3119
|
+
- Deferred fields show an empty box. To show a skeleton, project \`<ng-template dfPlaceholder let-field>\` into the form template (import \`DfPlaceholder\`). \`dfPlaceholderKey="key"\` beats \`dfPlaceholder="type"\`, which beats an empty \`dfPlaceholder\`. This is template-only, not part of the config.
|
|
3119
3120
|
|
|
3120
3121
|
## Validation
|
|
3121
3122
|
|
|
@@ -3249,6 +3250,7 @@ Compares a specific field's value:
|
|
|
3249
3250
|
- \`equals\`, \`notEquals\`
|
|
3250
3251
|
- \`greater\`, \`less\`, \`greaterOrEqual\`, \`lessOrEqual\`
|
|
3251
3252
|
- \`contains\`, \`startsWith\`, \`endsWith\`, \`matches\`
|
|
3253
|
+
- An empty value (null, undefined or '') never satisfies the ordered or string operators. \`matches\` tests it as '', and 0 and false are not empty.
|
|
3252
3254
|
|
|
3253
3255
|
#### JavaScript Condition
|
|
3254
3256
|
|
|
@@ -3261,6 +3263,8 @@ Evaluates a JavaScript expression with access to \`formValue\`, \`fieldValue\`,
|
|
|
3261
3263
|
}
|
|
3262
3264
|
\`\`\`
|
|
3263
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
|
+
|
|
3264
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.
|
|
3265
3269
|
|
|
3266
3270
|
#### Custom Condition
|
|
@@ -3331,6 +3335,8 @@ Combine conditions with \`and\` (all must be true) or \`or\` (at least one must
|
|
|
3331
3335
|
}
|
|
3332
3336
|
\`\`\`
|
|
3333
3337
|
|
|
3338
|
+
An empty \`conditions\` array evaluates to false, so an empty group never fires. Dev mode warns about it at startup.
|
|
3339
|
+
|
|
3334
3340
|
## UI Library Integration
|
|
3335
3341
|
|
|
3336
3342
|
ng-forge supports multiple UI libraries. Configure in \`app.config.ts\`:
|
|
@@ -5451,7 +5457,7 @@ var BaseFormConfigSchema = z19.object({
|
|
|
5451
5457
|
});
|
|
5452
5458
|
|
|
5453
5459
|
// internal/dynamic-forms-validation/validate/src/json-schema/form-config-json-schema.ts
|
|
5454
|
-
import { z as
|
|
5460
|
+
import { z as z59 } from "zod";
|
|
5455
5461
|
|
|
5456
5462
|
// internal/dynamic-forms-validation/material/src/props/mat-common-props.schema.ts
|
|
5457
5463
|
import { z as z20 } from "zod";
|
|
@@ -5774,17 +5780,43 @@ var MatButtonPropsSchema = z30.object({
|
|
|
5774
5780
|
});
|
|
5775
5781
|
|
|
5776
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
|
|
5777
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
|
|
5778
5810
|
var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5779
5811
|
/**
|
|
5780
5812
|
* Field type discriminant.
|
|
5781
5813
|
*/
|
|
5782
|
-
type:
|
|
5783
|
-
nullable:
|
|
5814
|
+
type: z32.literal("input"),
|
|
5815
|
+
nullable: z32.boolean().optional(),
|
|
5784
5816
|
/**
|
|
5785
5817
|
* Initial value for the input.
|
|
5786
5818
|
*/
|
|
5787
|
-
value:
|
|
5819
|
+
value: InputValueSchema,
|
|
5788
5820
|
/**
|
|
5789
5821
|
* Placeholder text (can also be in props).
|
|
5790
5822
|
*/
|
|
@@ -5794,20 +5826,20 @@ var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5794
5826
|
*/
|
|
5795
5827
|
props: MatInputPropsSchema.optional()
|
|
5796
5828
|
});
|
|
5797
|
-
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5829
|
+
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
5798
5830
|
|
|
5799
5831
|
// internal/dynamic-forms-validation/material/src/fields/mat-textarea-field.schema.ts
|
|
5800
|
-
import { z as
|
|
5832
|
+
import { z as z33 } from "zod";
|
|
5801
5833
|
var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5802
5834
|
/**
|
|
5803
5835
|
* Field type discriminant.
|
|
5804
5836
|
*/
|
|
5805
|
-
type:
|
|
5806
|
-
nullable:
|
|
5837
|
+
type: z33.literal("textarea"),
|
|
5838
|
+
nullable: z33.boolean().optional(),
|
|
5807
5839
|
/**
|
|
5808
5840
|
* Initial value for the textarea.
|
|
5809
5841
|
*/
|
|
5810
|
-
value:
|
|
5842
|
+
value: z33.string().nullable().optional(),
|
|
5811
5843
|
/**
|
|
5812
5844
|
* Placeholder text (can also be in props).
|
|
5813
5845
|
*/
|
|
@@ -5820,18 +5852,18 @@ var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationS
|
|
|
5820
5852
|
var MatTextareaFieldSchema = MatTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5821
5853
|
|
|
5822
5854
|
// internal/dynamic-forms-validation/material/src/fields/mat-select-field.schema.ts
|
|
5823
|
-
import { z as
|
|
5855
|
+
import { z as z34 } from "zod";
|
|
5824
5856
|
var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5825
5857
|
/**
|
|
5826
5858
|
* Field type discriminant.
|
|
5827
5859
|
*/
|
|
5828
|
-
type:
|
|
5829
|
-
nullable:
|
|
5860
|
+
type: z34.literal("select"),
|
|
5861
|
+
nullable: z34.boolean().optional(),
|
|
5830
5862
|
/**
|
|
5831
5863
|
* Initial value for the select.
|
|
5832
5864
|
* Can be single value or array if multiple is enabled.
|
|
5833
5865
|
*/
|
|
5834
|
-
value:
|
|
5866
|
+
value: z34.unknown().nullable().optional(),
|
|
5835
5867
|
/**
|
|
5836
5868
|
* Placeholder text (can also be in props).
|
|
5837
5869
|
*/
|
|
@@ -5848,16 +5880,16 @@ var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5848
5880
|
var MatSelectFieldSchema = MatSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5849
5881
|
|
|
5850
5882
|
// internal/dynamic-forms-validation/material/src/fields/mat-checkbox-field.schema.ts
|
|
5851
|
-
import { z as
|
|
5883
|
+
import { z as z35 } from "zod";
|
|
5852
5884
|
var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5853
5885
|
/**
|
|
5854
5886
|
* Field type discriminant.
|
|
5855
5887
|
*/
|
|
5856
|
-
type:
|
|
5888
|
+
type: z35.literal("checkbox"),
|
|
5857
5889
|
/**
|
|
5858
5890
|
* Initial checked state.
|
|
5859
5891
|
*/
|
|
5860
|
-
value:
|
|
5892
|
+
value: z35.boolean().optional(),
|
|
5861
5893
|
/**
|
|
5862
5894
|
* Placeholder/helper text.
|
|
5863
5895
|
*/
|
|
@@ -5869,17 +5901,17 @@ var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema)
|
|
|
5869
5901
|
});
|
|
5870
5902
|
|
|
5871
5903
|
// internal/dynamic-forms-validation/material/src/fields/mat-radio-field.schema.ts
|
|
5872
|
-
import { z as
|
|
5904
|
+
import { z as z36 } from "zod";
|
|
5873
5905
|
var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5874
5906
|
/**
|
|
5875
5907
|
* Field type discriminant.
|
|
5876
5908
|
*/
|
|
5877
|
-
type:
|
|
5878
|
-
nullable:
|
|
5909
|
+
type: z36.literal("radio"),
|
|
5910
|
+
nullable: z36.boolean().optional(),
|
|
5879
5911
|
/**
|
|
5880
5912
|
* Initial selected value.
|
|
5881
5913
|
*/
|
|
5882
|
-
value:
|
|
5914
|
+
value: z36.unknown().nullable().optional(),
|
|
5883
5915
|
/**
|
|
5884
5916
|
* Placeholder/helper text.
|
|
5885
5917
|
*/
|
|
@@ -5896,17 +5928,17 @@ var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5896
5928
|
var MatRadioFieldSchema = MatRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5897
5929
|
|
|
5898
5930
|
// internal/dynamic-forms-validation/material/src/fields/mat-multi-checkbox-field.schema.ts
|
|
5899
|
-
import { z as
|
|
5931
|
+
import { z as z37 } from "zod";
|
|
5900
5932
|
var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5901
5933
|
/**
|
|
5902
5934
|
* Field type discriminant.
|
|
5903
5935
|
*/
|
|
5904
|
-
type:
|
|
5905
|
-
nullable:
|
|
5936
|
+
type: z37.literal("multi-checkbox"),
|
|
5937
|
+
nullable: z37.boolean().optional(),
|
|
5906
5938
|
/**
|
|
5907
5939
|
* Initial selected values (array).
|
|
5908
5940
|
*/
|
|
5909
|
-
value:
|
|
5941
|
+
value: z37.array(z37.unknown()).nullable().optional(),
|
|
5910
5942
|
/**
|
|
5911
5943
|
* Placeholder/helper text.
|
|
5912
5944
|
*/
|
|
@@ -5923,16 +5955,16 @@ var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValida
|
|
|
5923
5955
|
var MatMultiCheckboxFieldSchema = MatMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5924
5956
|
|
|
5925
5957
|
// internal/dynamic-forms-validation/material/src/fields/mat-toggle-field.schema.ts
|
|
5926
|
-
import { z as
|
|
5958
|
+
import { z as z38 } from "zod";
|
|
5927
5959
|
var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5928
5960
|
/**
|
|
5929
5961
|
* Field type discriminant.
|
|
5930
5962
|
*/
|
|
5931
|
-
type:
|
|
5963
|
+
type: z38.literal("toggle"),
|
|
5932
5964
|
/**
|
|
5933
5965
|
* Initial toggle state.
|
|
5934
5966
|
*/
|
|
5935
|
-
value:
|
|
5967
|
+
value: z38.boolean().optional(),
|
|
5936
5968
|
/**
|
|
5937
5969
|
* Placeholder/helper text.
|
|
5938
5970
|
*/
|
|
@@ -5944,29 +5976,36 @@ var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).e
|
|
|
5944
5976
|
});
|
|
5945
5977
|
|
|
5946
5978
|
// internal/dynamic-forms-validation/material/src/fields/mat-slider-field.schema.ts
|
|
5947
|
-
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
|
|
5948
5987
|
var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5949
5988
|
/**
|
|
5950
5989
|
* Field type discriminant.
|
|
5951
5990
|
*/
|
|
5952
|
-
type:
|
|
5953
|
-
nullable:
|
|
5991
|
+
type: z40.literal("slider"),
|
|
5992
|
+
nullable: z40.boolean().optional(),
|
|
5954
5993
|
/**
|
|
5955
5994
|
* Initial slider value.
|
|
5956
5995
|
*/
|
|
5957
|
-
value:
|
|
5996
|
+
value: SliderValueSchema,
|
|
5958
5997
|
/**
|
|
5959
5998
|
* Minimum slider value.
|
|
5960
5999
|
*/
|
|
5961
|
-
minValue:
|
|
6000
|
+
minValue: z40.number().optional(),
|
|
5962
6001
|
/**
|
|
5963
6002
|
* Maximum slider value.
|
|
5964
6003
|
*/
|
|
5965
|
-
maxValue:
|
|
6004
|
+
maxValue: z40.number().optional(),
|
|
5966
6005
|
/**
|
|
5967
6006
|
* Step increment.
|
|
5968
6007
|
*/
|
|
5969
|
-
step:
|
|
6008
|
+
step: z40.number().positive().optional(),
|
|
5970
6009
|
/**
|
|
5971
6010
|
* Placeholder/helper text.
|
|
5972
6011
|
*/
|
|
@@ -5979,18 +6018,18 @@ var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5979
6018
|
var MatSliderFieldSchema = MatSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5980
6019
|
|
|
5981
6020
|
// internal/dynamic-forms-validation/material/src/fields/mat-datepicker-field.schema.ts
|
|
5982
|
-
import { z as
|
|
5983
|
-
var DateValueSchema =
|
|
6021
|
+
import { z as z41 } from "zod";
|
|
6022
|
+
var DateValueSchema = z41.union([z41.string(), z41.null()]);
|
|
5984
6023
|
var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5985
6024
|
/**
|
|
5986
6025
|
* Field type discriminant.
|
|
5987
6026
|
*/
|
|
5988
|
-
type:
|
|
5989
|
-
nullable:
|
|
6027
|
+
type: z41.literal("datepicker"),
|
|
6028
|
+
nullable: z41.boolean().optional(),
|
|
5990
6029
|
/**
|
|
5991
6030
|
* Initial date value (ISO string in JSON configs).
|
|
5992
6031
|
*/
|
|
5993
|
-
value:
|
|
6032
|
+
value: DatepickerValueSchema,
|
|
5994
6033
|
/**
|
|
5995
6034
|
* Minimum selectable date.
|
|
5996
6035
|
*/
|
|
@@ -6015,29 +6054,29 @@ var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidatio
|
|
|
6015
6054
|
var MatDatepickerFieldSchema = MatDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6016
6055
|
|
|
6017
6056
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
6018
|
-
import { z as
|
|
6057
|
+
import { z as z43 } from "zod";
|
|
6019
6058
|
|
|
6020
6059
|
// internal/dynamic-forms-validation/src/lib/schemas/field/array-item-template.schema.ts
|
|
6021
|
-
import { z as
|
|
6022
|
-
var FieldLikeSchema =
|
|
6023
|
-
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)]);
|
|
6024
6063
|
|
|
6025
6064
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
6026
|
-
var EventArgSchema =
|
|
6065
|
+
var EventArgSchema = z43.union([z43.string(), z43.number(), z43.boolean(), z43.null(), z43.undefined()]);
|
|
6027
6066
|
var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6028
6067
|
/**
|
|
6029
6068
|
* Field type discriminant.
|
|
6030
6069
|
*/
|
|
6031
|
-
type:
|
|
6070
|
+
type: z43.literal("button"),
|
|
6032
6071
|
/**
|
|
6033
6072
|
* Event type name (string reference to registered event).
|
|
6034
6073
|
* Note: Full event configuration requires runtime setup.
|
|
6035
6074
|
*/
|
|
6036
|
-
event:
|
|
6075
|
+
event: z43.string().optional(),
|
|
6037
6076
|
/**
|
|
6038
6077
|
* Arguments passed to the event constructor.
|
|
6039
6078
|
*/
|
|
6040
|
-
eventArgs:
|
|
6079
|
+
eventArgs: z43.array(EventArgSchema).optional(),
|
|
6041
6080
|
/**
|
|
6042
6081
|
* Material-specific button properties.
|
|
6043
6082
|
*/
|
|
@@ -6048,17 +6087,17 @@ var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6048
6087
|
logic: LogicArraySchema.optional()
|
|
6049
6088
|
});
|
|
6050
6089
|
var MatSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6051
|
-
type:
|
|
6090
|
+
type: z43.literal("submit"),
|
|
6052
6091
|
props: MatButtonPropsSchema.optional(),
|
|
6053
6092
|
logic: LogicArraySchema.optional()
|
|
6054
6093
|
});
|
|
6055
6094
|
var MatNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6056
|
-
type:
|
|
6095
|
+
type: z43.literal("next"),
|
|
6057
6096
|
props: MatButtonPropsSchema.optional(),
|
|
6058
6097
|
logic: LogicArraySchema.optional()
|
|
6059
6098
|
});
|
|
6060
6099
|
var MatPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6061
|
-
type:
|
|
6100
|
+
type: z43.literal("previous"),
|
|
6062
6101
|
props: MatButtonPropsSchema.optional()
|
|
6063
6102
|
});
|
|
6064
6103
|
var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6067,21 +6106,21 @@ var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6067
6106
|
* item, or a list of them for an object item.
|
|
6068
6107
|
*/
|
|
6069
6108
|
template: ArrayItemTemplateSchema,
|
|
6070
|
-
type:
|
|
6109
|
+
type: z43.literal("add-array-item"),
|
|
6071
6110
|
/**
|
|
6072
6111
|
* Key of the array field to add items to.
|
|
6073
6112
|
* If omitted, uses the parent array context.
|
|
6074
6113
|
*/
|
|
6075
|
-
arrayKey:
|
|
6114
|
+
arrayKey: z43.string().optional(),
|
|
6076
6115
|
props: MatButtonPropsSchema.optional()
|
|
6077
6116
|
});
|
|
6078
6117
|
var MatRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6079
|
-
type:
|
|
6118
|
+
type: z43.literal("remove-array-item"),
|
|
6080
6119
|
/**
|
|
6081
6120
|
* Key of the array field to remove items from.
|
|
6082
6121
|
* If omitted, uses the parent array context.
|
|
6083
6122
|
*/
|
|
6084
|
-
arrayKey:
|
|
6123
|
+
arrayKey: z43.string().optional(),
|
|
6085
6124
|
props: MatButtonPropsSchema.optional()
|
|
6086
6125
|
});
|
|
6087
6126
|
var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6090,12 +6129,12 @@ var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6090
6129
|
* item, or a list of them for an object item.
|
|
6091
6130
|
*/
|
|
6092
6131
|
template: ArrayItemTemplateSchema,
|
|
6093
|
-
type:
|
|
6132
|
+
type: z43.literal("prepend-array-item"),
|
|
6094
6133
|
/**
|
|
6095
6134
|
* Key of the array field to prepend items to.
|
|
6096
6135
|
* If omitted, uses the parent array context.
|
|
6097
6136
|
*/
|
|
6098
|
-
arrayKey:
|
|
6137
|
+
arrayKey: z43.string().optional(),
|
|
6099
6138
|
props: MatButtonPropsSchema.optional()
|
|
6100
6139
|
});
|
|
6101
6140
|
var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6104,38 +6143,38 @@ var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6104
6143
|
* item, or a list of them for an object item.
|
|
6105
6144
|
*/
|
|
6106
6145
|
template: ArrayItemTemplateSchema,
|
|
6107
|
-
type:
|
|
6146
|
+
type: z43.literal("insert-array-item"),
|
|
6108
6147
|
/**
|
|
6109
6148
|
* Key of the array field to insert items into.
|
|
6110
6149
|
* If omitted, uses the parent array context.
|
|
6111
6150
|
*/
|
|
6112
|
-
arrayKey:
|
|
6151
|
+
arrayKey: z43.string().optional(),
|
|
6113
6152
|
/**
|
|
6114
6153
|
* Index at which to insert the new item.
|
|
6115
6154
|
*/
|
|
6116
|
-
index:
|
|
6155
|
+
index: z43.number(),
|
|
6117
6156
|
props: MatButtonPropsSchema.optional()
|
|
6118
6157
|
});
|
|
6119
6158
|
var MatPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6120
|
-
type:
|
|
6159
|
+
type: z43.literal("pop-array-item"),
|
|
6121
6160
|
/**
|
|
6122
6161
|
* Key of the array field to pop items from.
|
|
6123
6162
|
*/
|
|
6124
|
-
arrayKey:
|
|
6163
|
+
arrayKey: z43.string(),
|
|
6125
6164
|
props: MatButtonPropsSchema.optional()
|
|
6126
6165
|
});
|
|
6127
6166
|
var MatShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6128
|
-
type:
|
|
6167
|
+
type: z43.literal("shift-array-item"),
|
|
6129
6168
|
/**
|
|
6130
6169
|
* Key of the array field to shift items from.
|
|
6131
6170
|
*/
|
|
6132
|
-
arrayKey:
|
|
6171
|
+
arrayKey: z43.string(),
|
|
6133
6172
|
props: MatButtonPropsSchema.optional()
|
|
6134
6173
|
});
|
|
6135
6174
|
|
|
6136
6175
|
// internal/dynamic-forms-validation/material/src/mat-leaf-field.schema.ts
|
|
6137
|
-
import { z as
|
|
6138
|
-
var MatLeafFieldSchema =
|
|
6176
|
+
import { z as z44 } from "zod";
|
|
6177
|
+
var MatLeafFieldSchema = z44.discriminatedUnion("type", [
|
|
6139
6178
|
// Default fields
|
|
6140
6179
|
TextFieldSchema,
|
|
6141
6180
|
HiddenFieldSchema,
|
|
@@ -6160,7 +6199,7 @@ var MatLeafFieldSchema = z42.discriminatedUnion("type", [
|
|
|
6160
6199
|
MatInsertArrayItemButtonFieldSchema,
|
|
6161
6200
|
MatPopArrayItemButtonFieldSchema,
|
|
6162
6201
|
MatShiftArrayItemButtonFieldSchema
|
|
6163
|
-
]).superRefine(nullableValueRefine);
|
|
6202
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6164
6203
|
|
|
6165
6204
|
// internal/dynamic-forms-validation/material/src/mat-field.schema.ts
|
|
6166
6205
|
var containerSchemas = createContainerSchemas({
|
|
@@ -6173,8 +6212,8 @@ var MatArrayFieldSchema = containerSchemas.ArrayFieldSchema;
|
|
|
6173
6212
|
var MatFieldSchema = containerSchemas.AllFieldsSchema;
|
|
6174
6213
|
|
|
6175
6214
|
// internal/dynamic-forms-validation/material/src/mat-form-config.schema.ts
|
|
6176
|
-
import { z as
|
|
6177
|
-
var MatFormDefaultPropsSchema =
|
|
6215
|
+
import { z as z45 } from "zod";
|
|
6216
|
+
var MatFormDefaultPropsSchema = z45.object({
|
|
6178
6217
|
/**
|
|
6179
6218
|
* Default form field appearance for all fields.
|
|
6180
6219
|
*/
|
|
@@ -6191,15 +6230,15 @@ var MatFormDefaultPropsSchema = z43.object({
|
|
|
6191
6230
|
var MatFormConfigSchema = createFormConfigSchema(MatFieldSchema, MatFormDefaultPropsSchema);
|
|
6192
6231
|
|
|
6193
6232
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6194
|
-
import { z as
|
|
6233
|
+
import { z as z47 } from "zod";
|
|
6195
6234
|
|
|
6196
6235
|
// internal/dynamic-forms-validation/bootstrap/src/props/bs-common-props.schema.ts
|
|
6197
|
-
import { z as
|
|
6198
|
-
var BsSizeSchema =
|
|
6199
|
-
var BsButtonVariantSchema =
|
|
6200
|
-
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({
|
|
6201
6240
|
size: BsSizeSchema.optional(),
|
|
6202
|
-
floatingLabel:
|
|
6241
|
+
floatingLabel: z46.boolean().optional(),
|
|
6203
6242
|
hint: DynamicTextSchema.optional(),
|
|
6204
6243
|
validFeedback: DynamicTextSchema.optional(),
|
|
6205
6244
|
invalidFeedback: DynamicTextSchema.optional()
|
|
@@ -6207,94 +6246,94 @@ var BsFormFieldPropsSchema = z44.object({
|
|
|
6207
6246
|
|
|
6208
6247
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6209
6248
|
var BsInputPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6210
|
-
type:
|
|
6249
|
+
type: z47.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6211
6250
|
placeholder: DynamicTextSchema.optional(),
|
|
6212
|
-
plaintext:
|
|
6251
|
+
plaintext: z47.boolean().optional()
|
|
6213
6252
|
});
|
|
6214
6253
|
var BsTextareaPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6215
|
-
rows:
|
|
6254
|
+
rows: z47.number().positive().optional(),
|
|
6216
6255
|
placeholder: DynamicTextSchema.optional()
|
|
6217
6256
|
});
|
|
6218
6257
|
var BsSelectPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6219
|
-
multiple:
|
|
6220
|
-
htmlSize:
|
|
6258
|
+
multiple: z47.boolean().optional(),
|
|
6259
|
+
htmlSize: z47.number().positive().optional(),
|
|
6221
6260
|
placeholder: DynamicTextSchema.optional()
|
|
6222
6261
|
});
|
|
6223
|
-
var BsCheckboxPropsSchema =
|
|
6224
|
-
switch:
|
|
6225
|
-
inline:
|
|
6226
|
-
reverse:
|
|
6227
|
-
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(),
|
|
6228
6267
|
hint: DynamicTextSchema.optional()
|
|
6229
6268
|
});
|
|
6230
|
-
var BsRadioPropsSchema =
|
|
6231
|
-
inline:
|
|
6232
|
-
reverse:
|
|
6233
|
-
buttonGroup:
|
|
6269
|
+
var BsRadioPropsSchema = z47.object({
|
|
6270
|
+
inline: z47.boolean().optional(),
|
|
6271
|
+
reverse: z47.boolean().optional(),
|
|
6272
|
+
buttonGroup: z47.boolean().optional(),
|
|
6234
6273
|
buttonSize: BsSizeSchema.optional(),
|
|
6235
6274
|
hint: DynamicTextSchema.optional()
|
|
6236
6275
|
});
|
|
6237
|
-
var BsMultiCheckboxPropsSchema =
|
|
6238
|
-
switch:
|
|
6239
|
-
inline:
|
|
6240
|
-
reverse:
|
|
6276
|
+
var BsMultiCheckboxPropsSchema = z47.object({
|
|
6277
|
+
switch: z47.boolean().optional(),
|
|
6278
|
+
inline: z47.boolean().optional(),
|
|
6279
|
+
reverse: z47.boolean().optional(),
|
|
6241
6280
|
hint: DynamicTextSchema.optional()
|
|
6242
6281
|
});
|
|
6243
|
-
var BsTogglePropsSchema =
|
|
6282
|
+
var BsTogglePropsSchema = z47.object({
|
|
6244
6283
|
size: BsSizeSchema.optional(),
|
|
6245
|
-
reverse:
|
|
6246
|
-
inline:
|
|
6284
|
+
reverse: z47.boolean().optional(),
|
|
6285
|
+
inline: z47.boolean().optional(),
|
|
6247
6286
|
hint: DynamicTextSchema.optional()
|
|
6248
6287
|
});
|
|
6249
6288
|
var BsDatepickerPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6250
|
-
useNgBootstrap:
|
|
6251
|
-
displayMonths:
|
|
6252
|
-
navigation:
|
|
6253
|
-
outsideDays:
|
|
6254
|
-
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(),
|
|
6255
6294
|
placeholder: DynamicTextSchema.optional()
|
|
6256
6295
|
});
|
|
6257
|
-
var BsSliderPropsSchema =
|
|
6258
|
-
showValue:
|
|
6259
|
-
valuePrefix:
|
|
6260
|
-
valueSuffix:
|
|
6296
|
+
var BsSliderPropsSchema = z47.object({
|
|
6297
|
+
showValue: z47.boolean().optional(),
|
|
6298
|
+
valuePrefix: z47.string().optional(),
|
|
6299
|
+
valueSuffix: z47.string().optional(),
|
|
6261
6300
|
hint: DynamicTextSchema.optional(),
|
|
6262
|
-
min:
|
|
6263
|
-
max:
|
|
6264
|
-
step:
|
|
6301
|
+
min: z47.number().optional(),
|
|
6302
|
+
max: z47.number().optional(),
|
|
6303
|
+
step: z47.number().positive().optional()
|
|
6265
6304
|
});
|
|
6266
|
-
var BsButtonPropsSchema =
|
|
6305
|
+
var BsButtonPropsSchema = z47.object({
|
|
6267
6306
|
variant: BsButtonVariantSchema.optional(),
|
|
6268
|
-
outline:
|
|
6307
|
+
outline: z47.boolean().optional(),
|
|
6269
6308
|
size: BsSizeSchema.optional(),
|
|
6270
|
-
block:
|
|
6271
|
-
active:
|
|
6272
|
-
type:
|
|
6309
|
+
block: z47.boolean().optional(),
|
|
6310
|
+
active: z47.boolean().optional(),
|
|
6311
|
+
type: z47.enum(["button", "submit", "reset"]).optional()
|
|
6273
6312
|
});
|
|
6274
6313
|
|
|
6275
6314
|
// internal/dynamic-forms-validation/bootstrap/src/fields/index.ts
|
|
6276
|
-
import { z as
|
|
6315
|
+
import { z as z48 } from "zod";
|
|
6277
6316
|
var BsValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6278
6317
|
var BsInputFieldSchemaObject = BsValueFieldBase.extend({
|
|
6279
|
-
type:
|
|
6280
|
-
nullable:
|
|
6281
|
-
value:
|
|
6318
|
+
type: z48.literal("input"),
|
|
6319
|
+
nullable: z48.boolean().optional(),
|
|
6320
|
+
value: InputValueSchema,
|
|
6282
6321
|
placeholder: DynamicTextSchema.optional(),
|
|
6283
6322
|
props: BsInputPropsSchema.optional()
|
|
6284
6323
|
});
|
|
6285
|
-
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6324
|
+
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6286
6325
|
var BsTextareaFieldSchemaObject = BsValueFieldBase.extend({
|
|
6287
|
-
type:
|
|
6288
|
-
nullable:
|
|
6289
|
-
value:
|
|
6326
|
+
type: z48.literal("textarea"),
|
|
6327
|
+
nullable: z48.boolean().optional(),
|
|
6328
|
+
value: z48.string().nullable().optional(),
|
|
6290
6329
|
placeholder: DynamicTextSchema.optional(),
|
|
6291
6330
|
props: BsTextareaPropsSchema.optional()
|
|
6292
6331
|
});
|
|
6293
6332
|
var BsTextareaFieldSchema = BsTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6294
6333
|
var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
6295
|
-
type:
|
|
6296
|
-
nullable:
|
|
6297
|
-
value:
|
|
6334
|
+
type: z48.literal("select"),
|
|
6335
|
+
nullable: z48.boolean().optional(),
|
|
6336
|
+
value: z48.string().nullable().optional(),
|
|
6298
6337
|
// Bootstrap select only supports strings
|
|
6299
6338
|
placeholder: DynamicTextSchema.optional(),
|
|
6300
6339
|
options: FieldOptionsSchema,
|
|
@@ -6302,76 +6341,76 @@ var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
|
6302
6341
|
});
|
|
6303
6342
|
var BsSelectFieldSchema = BsSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6304
6343
|
var BsCheckboxFieldSchema = BsValueFieldBase.extend({
|
|
6305
|
-
type:
|
|
6306
|
-
value:
|
|
6344
|
+
type: z48.literal("checkbox"),
|
|
6345
|
+
value: z48.boolean().optional(),
|
|
6307
6346
|
placeholder: DynamicTextSchema.optional(),
|
|
6308
6347
|
props: BsCheckboxPropsSchema.optional()
|
|
6309
6348
|
});
|
|
6310
6349
|
var BsRadioFieldSchemaObject = BsValueFieldBase.extend({
|
|
6311
|
-
type:
|
|
6312
|
-
nullable:
|
|
6313
|
-
value:
|
|
6350
|
+
type: z48.literal("radio"),
|
|
6351
|
+
nullable: z48.boolean().optional(),
|
|
6352
|
+
value: z48.unknown().nullable().optional(),
|
|
6314
6353
|
placeholder: DynamicTextSchema.optional(),
|
|
6315
6354
|
options: FieldOptionsSchema,
|
|
6316
6355
|
props: BsRadioPropsSchema.optional()
|
|
6317
6356
|
});
|
|
6318
6357
|
var BsRadioFieldSchema = BsRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6319
6358
|
var BsMultiCheckboxFieldSchemaObject = BsValueFieldBase.extend({
|
|
6320
|
-
type:
|
|
6321
|
-
nullable:
|
|
6322
|
-
value:
|
|
6359
|
+
type: z48.literal("multi-checkbox"),
|
|
6360
|
+
nullable: z48.boolean().optional(),
|
|
6361
|
+
value: z48.array(z48.unknown()).nullable().optional(),
|
|
6323
6362
|
placeholder: DynamicTextSchema.optional(),
|
|
6324
6363
|
options: FieldOptionsSchema,
|
|
6325
6364
|
props: BsMultiCheckboxPropsSchema.optional()
|
|
6326
6365
|
});
|
|
6327
6366
|
var BsMultiCheckboxFieldSchema = BsMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6328
6367
|
var BsToggleFieldSchema = BsValueFieldBase.extend({
|
|
6329
|
-
type:
|
|
6330
|
-
value:
|
|
6368
|
+
type: z48.literal("toggle"),
|
|
6369
|
+
value: z48.boolean().optional(),
|
|
6331
6370
|
placeholder: DynamicTextSchema.optional(),
|
|
6332
6371
|
props: BsTogglePropsSchema.optional()
|
|
6333
6372
|
});
|
|
6334
6373
|
var BsDatepickerFieldSchemaObject = BsValueFieldBase.extend({
|
|
6335
|
-
type:
|
|
6336
|
-
nullable:
|
|
6337
|
-
value:
|
|
6338
|
-
minDate:
|
|
6339
|
-
maxDate:
|
|
6340
|
-
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(),
|
|
6341
6380
|
placeholder: DynamicTextSchema.optional(),
|
|
6342
6381
|
props: BsDatepickerPropsSchema.optional()
|
|
6343
6382
|
});
|
|
6344
6383
|
var BsDatepickerFieldSchema = BsDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6345
6384
|
var BsSliderFieldSchemaObject = BsValueFieldBase.extend({
|
|
6346
|
-
type:
|
|
6347
|
-
nullable:
|
|
6348
|
-
value:
|
|
6349
|
-
minValue:
|
|
6350
|
-
maxValue:
|
|
6351
|
-
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(),
|
|
6352
6391
|
placeholder: DynamicTextSchema.optional(),
|
|
6353
6392
|
props: BsSliderPropsSchema.optional()
|
|
6354
6393
|
});
|
|
6355
6394
|
var BsSliderFieldSchema = BsSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6356
6395
|
var BsButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6357
|
-
type:
|
|
6358
|
-
event:
|
|
6359
|
-
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(),
|
|
6360
6399
|
props: BsButtonPropsSchema.optional(),
|
|
6361
6400
|
logic: LogicArraySchema.optional()
|
|
6362
6401
|
});
|
|
6363
6402
|
var BsSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6364
|
-
type:
|
|
6403
|
+
type: z48.literal("submit"),
|
|
6365
6404
|
props: BsButtonPropsSchema.optional(),
|
|
6366
6405
|
logic: LogicArraySchema.optional()
|
|
6367
6406
|
});
|
|
6368
6407
|
var BsNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6369
|
-
type:
|
|
6408
|
+
type: z48.literal("next"),
|
|
6370
6409
|
props: BsButtonPropsSchema.optional(),
|
|
6371
6410
|
logic: LogicArraySchema.optional()
|
|
6372
6411
|
});
|
|
6373
6412
|
var BsPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6374
|
-
type:
|
|
6413
|
+
type: z48.literal("previous"),
|
|
6375
6414
|
props: BsButtonPropsSchema.optional()
|
|
6376
6415
|
});
|
|
6377
6416
|
var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6380,13 +6419,13 @@ var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6380
6419
|
* item, or a list of them for an object item.
|
|
6381
6420
|
*/
|
|
6382
6421
|
template: ArrayItemTemplateSchema,
|
|
6383
|
-
type:
|
|
6384
|
-
arrayKey:
|
|
6422
|
+
type: z48.literal("add-array-item"),
|
|
6423
|
+
arrayKey: z48.string().optional(),
|
|
6385
6424
|
props: BsButtonPropsSchema.optional()
|
|
6386
6425
|
});
|
|
6387
6426
|
var BsRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6388
|
-
type:
|
|
6389
|
-
arrayKey:
|
|
6427
|
+
type: z48.literal("remove-array-item"),
|
|
6428
|
+
arrayKey: z48.string().optional(),
|
|
6390
6429
|
props: BsButtonPropsSchema.optional()
|
|
6391
6430
|
});
|
|
6392
6431
|
var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6395,8 +6434,8 @@ var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6395
6434
|
* item, or a list of them for an object item.
|
|
6396
6435
|
*/
|
|
6397
6436
|
template: ArrayItemTemplateSchema,
|
|
6398
|
-
type:
|
|
6399
|
-
arrayKey:
|
|
6437
|
+
type: z48.literal("prepend-array-item"),
|
|
6438
|
+
arrayKey: z48.string().optional(),
|
|
6400
6439
|
props: BsButtonPropsSchema.optional()
|
|
6401
6440
|
});
|
|
6402
6441
|
var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6405,25 +6444,25 @@ var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6405
6444
|
* item, or a list of them for an object item.
|
|
6406
6445
|
*/
|
|
6407
6446
|
template: ArrayItemTemplateSchema,
|
|
6408
|
-
type:
|
|
6409
|
-
arrayKey:
|
|
6410
|
-
index:
|
|
6447
|
+
type: z48.literal("insert-array-item"),
|
|
6448
|
+
arrayKey: z48.string().optional(),
|
|
6449
|
+
index: z48.number(),
|
|
6411
6450
|
props: BsButtonPropsSchema.optional()
|
|
6412
6451
|
});
|
|
6413
6452
|
var BsPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6414
|
-
type:
|
|
6415
|
-
arrayKey:
|
|
6453
|
+
type: z48.literal("pop-array-item"),
|
|
6454
|
+
arrayKey: z48.string(),
|
|
6416
6455
|
props: BsButtonPropsSchema.optional()
|
|
6417
6456
|
});
|
|
6418
6457
|
var BsShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6419
|
-
type:
|
|
6420
|
-
arrayKey:
|
|
6458
|
+
type: z48.literal("shift-array-item"),
|
|
6459
|
+
arrayKey: z48.string(),
|
|
6421
6460
|
props: BsButtonPropsSchema.optional()
|
|
6422
6461
|
});
|
|
6423
6462
|
|
|
6424
6463
|
// internal/dynamic-forms-validation/bootstrap/src/bs-leaf-field.schema.ts
|
|
6425
|
-
import { z as
|
|
6426
|
-
var BsLeafFieldSchema =
|
|
6464
|
+
import { z as z49 } from "zod";
|
|
6465
|
+
var BsLeafFieldSchema = z49.discriminatedUnion("type", [
|
|
6427
6466
|
TextFieldSchema,
|
|
6428
6467
|
HiddenFieldSchema,
|
|
6429
6468
|
BsInputFieldSchemaObject,
|
|
@@ -6445,10 +6484,10 @@ var BsLeafFieldSchema = z47.discriminatedUnion("type", [
|
|
|
6445
6484
|
BsInsertArrayItemButtonFieldSchema,
|
|
6446
6485
|
BsPopArrayItemButtonFieldSchema,
|
|
6447
6486
|
BsShiftArrayItemButtonFieldSchema
|
|
6448
|
-
]).superRefine(nullableValueRefine);
|
|
6487
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6449
6488
|
|
|
6450
6489
|
// internal/dynamic-forms-validation/bootstrap/src/bs-form-config.schema.ts
|
|
6451
|
-
import { z as
|
|
6490
|
+
import { z as z50 } from "zod";
|
|
6452
6491
|
var containerSchemas2 = createContainerSchemas({
|
|
6453
6492
|
leafFieldSchema: BsLeafFieldSchema
|
|
6454
6493
|
});
|
|
@@ -6457,173 +6496,173 @@ var BsRowFieldSchema = containerSchemas2.RowFieldSchema;
|
|
|
6457
6496
|
var BsGroupFieldSchema = containerSchemas2.GroupFieldSchema;
|
|
6458
6497
|
var BsArrayFieldSchema = containerSchemas2.ArrayFieldSchema;
|
|
6459
6498
|
var BsFieldSchema = containerSchemas2.AllFieldsSchema;
|
|
6460
|
-
var BsFormDefaultPropsSchema =
|
|
6499
|
+
var BsFormDefaultPropsSchema = z50.object({
|
|
6461
6500
|
size: BsSizeSchema.optional(),
|
|
6462
|
-
floatingLabel:
|
|
6501
|
+
floatingLabel: z50.boolean().optional()
|
|
6463
6502
|
});
|
|
6464
6503
|
var BsFormConfigSchema = createFormConfigSchema(BsFieldSchema, BsFormDefaultPropsSchema);
|
|
6465
6504
|
|
|
6466
6505
|
// internal/dynamic-forms-validation/primeng/src/props/index.ts
|
|
6467
|
-
import { z as
|
|
6468
|
-
var PrimeSeveritySchema =
|
|
6469
|
-
var PrimeCommonPropsSchema =
|
|
6470
|
-
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(),
|
|
6471
6510
|
hint: DynamicTextSchema.optional()
|
|
6472
6511
|
});
|
|
6473
6512
|
var PrimeInputPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6474
|
-
type:
|
|
6513
|
+
type: z51.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6475
6514
|
placeholder: DynamicTextSchema.optional(),
|
|
6476
|
-
size:
|
|
6477
|
-
variant:
|
|
6515
|
+
size: z51.enum(["small", "large"]).optional(),
|
|
6516
|
+
variant: z51.enum(["outlined", "filled"]).optional()
|
|
6478
6517
|
});
|
|
6479
6518
|
var PrimeCheckboxPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6480
|
-
binary:
|
|
6481
|
-
trueValue:
|
|
6482
|
-
falseValue:
|
|
6519
|
+
binary: z51.boolean().optional(),
|
|
6520
|
+
trueValue: z51.unknown().optional(),
|
|
6521
|
+
falseValue: z51.unknown().optional()
|
|
6483
6522
|
});
|
|
6484
6523
|
var PrimeRadioPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6485
|
-
name:
|
|
6524
|
+
name: z51.string().optional()
|
|
6486
6525
|
});
|
|
6487
6526
|
var PrimeSelectPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6488
|
-
multiple:
|
|
6489
|
-
filter:
|
|
6527
|
+
multiple: z51.boolean().optional(),
|
|
6528
|
+
filter: z51.boolean().optional(),
|
|
6490
6529
|
placeholder: DynamicTextSchema.optional(),
|
|
6491
|
-
showClear:
|
|
6530
|
+
showClear: z51.boolean().optional()
|
|
6492
6531
|
});
|
|
6493
6532
|
var PrimeMultiCheckboxPropsSchema = PrimeCommonPropsSchema;
|
|
6494
6533
|
var PrimeDatepickerPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6495
|
-
dateFormat:
|
|
6496
|
-
inline:
|
|
6497
|
-
showIcon:
|
|
6498
|
-
showButtonBar:
|
|
6499
|
-
selectionMode:
|
|
6500
|
-
touchUI:
|
|
6501
|
-
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(),
|
|
6502
6541
|
placeholder: DynamicTextSchema.optional()
|
|
6503
6542
|
});
|
|
6504
6543
|
var PrimeTextareaPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6505
|
-
rows:
|
|
6506
|
-
autoResize:
|
|
6544
|
+
rows: z51.number().positive().optional(),
|
|
6545
|
+
autoResize: z51.boolean().optional(),
|
|
6507
6546
|
placeholder: DynamicTextSchema.optional()
|
|
6508
6547
|
});
|
|
6509
6548
|
var PrimeSliderPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6510
|
-
min:
|
|
6511
|
-
max:
|
|
6512
|
-
step:
|
|
6513
|
-
range:
|
|
6514
|
-
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()
|
|
6515
6554
|
});
|
|
6516
6555
|
var PrimeTogglePropsSchema = PrimeCommonPropsSchema;
|
|
6517
|
-
var PrimeButtonPropsSchema =
|
|
6556
|
+
var PrimeButtonPropsSchema = z51.object({
|
|
6518
6557
|
severity: PrimeSeveritySchema.optional(),
|
|
6519
|
-
text:
|
|
6520
|
-
outlined:
|
|
6521
|
-
raised:
|
|
6522
|
-
rounded:
|
|
6523
|
-
icon:
|
|
6524
|
-
iconPos:
|
|
6525
|
-
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()
|
|
6526
6565
|
});
|
|
6527
6566
|
|
|
6528
6567
|
// internal/dynamic-forms-validation/primeng/src/fields/index.ts
|
|
6529
|
-
import { z as
|
|
6568
|
+
import { z as z52 } from "zod";
|
|
6530
6569
|
var PrimeValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6531
6570
|
var PrimeInputFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6532
|
-
type:
|
|
6533
|
-
nullable:
|
|
6534
|
-
value:
|
|
6571
|
+
type: z52.literal("input"),
|
|
6572
|
+
nullable: z52.boolean().optional(),
|
|
6573
|
+
value: InputValueSchema,
|
|
6535
6574
|
placeholder: DynamicTextSchema.optional(),
|
|
6536
6575
|
props: PrimeInputPropsSchema.optional()
|
|
6537
6576
|
});
|
|
6538
|
-
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6577
|
+
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6539
6578
|
var PrimeCheckboxFieldSchema = PrimeValueFieldBase.extend({
|
|
6540
|
-
type:
|
|
6541
|
-
value:
|
|
6579
|
+
type: z52.literal("checkbox"),
|
|
6580
|
+
value: z52.boolean().optional(),
|
|
6542
6581
|
placeholder: DynamicTextSchema.optional(),
|
|
6543
6582
|
props: PrimeCheckboxPropsSchema.optional()
|
|
6544
6583
|
});
|
|
6545
6584
|
var PrimeRadioFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6546
|
-
type:
|
|
6547
|
-
nullable:
|
|
6548
|
-
value:
|
|
6585
|
+
type: z52.literal("radio"),
|
|
6586
|
+
nullable: z52.boolean().optional(),
|
|
6587
|
+
value: z52.unknown().nullable().optional(),
|
|
6549
6588
|
placeholder: DynamicTextSchema.optional(),
|
|
6550
6589
|
options: FieldOptionsSchema,
|
|
6551
6590
|
props: PrimeRadioPropsSchema.optional()
|
|
6552
6591
|
});
|
|
6553
6592
|
var PrimeRadioFieldSchema = PrimeRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6554
6593
|
var PrimeSelectFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6555
|
-
type:
|
|
6556
|
-
nullable:
|
|
6557
|
-
value:
|
|
6594
|
+
type: z52.literal("select"),
|
|
6595
|
+
nullable: z52.boolean().optional(),
|
|
6596
|
+
value: z52.unknown().nullable().optional(),
|
|
6558
6597
|
placeholder: DynamicTextSchema.optional(),
|
|
6559
6598
|
options: FieldOptionsSchema,
|
|
6560
6599
|
props: PrimeSelectPropsSchema.optional()
|
|
6561
6600
|
});
|
|
6562
6601
|
var PrimeSelectFieldSchema = PrimeSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6563
6602
|
var PrimeMultiCheckboxFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6564
|
-
type:
|
|
6565
|
-
nullable:
|
|
6566
|
-
value:
|
|
6603
|
+
type: z52.literal("multi-checkbox"),
|
|
6604
|
+
nullable: z52.boolean().optional(),
|
|
6605
|
+
value: z52.array(z52.unknown()).nullable().optional(),
|
|
6567
6606
|
placeholder: DynamicTextSchema.optional(),
|
|
6568
6607
|
options: FieldOptionsSchema,
|
|
6569
6608
|
props: PrimeMultiCheckboxPropsSchema.optional()
|
|
6570
6609
|
});
|
|
6571
6610
|
var PrimeMultiCheckboxFieldSchema = PrimeMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6572
6611
|
var PrimeDatepickerFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6573
|
-
type:
|
|
6574
|
-
nullable:
|
|
6575
|
-
value:
|
|
6576
|
-
minDate:
|
|
6577
|
-
maxDate:
|
|
6578
|
-
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(),
|
|
6579
6618
|
placeholder: DynamicTextSchema.optional(),
|
|
6580
6619
|
props: PrimeDatepickerPropsSchema.optional()
|
|
6581
6620
|
});
|
|
6582
6621
|
var PrimeDatepickerFieldSchema = PrimeDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6583
6622
|
var PrimeTextareaFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6584
|
-
type:
|
|
6585
|
-
nullable:
|
|
6586
|
-
value:
|
|
6623
|
+
type: z52.literal("textarea"),
|
|
6624
|
+
nullable: z52.boolean().optional(),
|
|
6625
|
+
value: z52.string().nullable().optional(),
|
|
6587
6626
|
placeholder: DynamicTextSchema.optional(),
|
|
6588
6627
|
props: PrimeTextareaPropsSchema.optional()
|
|
6589
6628
|
});
|
|
6590
6629
|
var PrimeTextareaFieldSchema = PrimeTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6591
6630
|
var PrimeSliderFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6592
|
-
type:
|
|
6593
|
-
nullable:
|
|
6594
|
-
value:
|
|
6595
|
-
minValue:
|
|
6596
|
-
maxValue:
|
|
6597
|
-
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(),
|
|
6598
6637
|
placeholder: DynamicTextSchema.optional(),
|
|
6599
6638
|
props: PrimeSliderPropsSchema.optional()
|
|
6600
6639
|
});
|
|
6601
6640
|
var PrimeSliderFieldSchema = PrimeSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6602
6641
|
var PrimeToggleFieldSchema = PrimeValueFieldBase.extend({
|
|
6603
|
-
type:
|
|
6604
|
-
value:
|
|
6642
|
+
type: z52.literal("toggle"),
|
|
6643
|
+
value: z52.boolean().optional(),
|
|
6605
6644
|
placeholder: DynamicTextSchema.optional(),
|
|
6606
6645
|
props: PrimeTogglePropsSchema.optional()
|
|
6607
6646
|
});
|
|
6608
6647
|
var PrimeButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6609
|
-
type:
|
|
6610
|
-
event:
|
|
6611
|
-
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(),
|
|
6612
6651
|
props: PrimeButtonPropsSchema.optional(),
|
|
6613
6652
|
logic: LogicArraySchema.optional()
|
|
6614
6653
|
});
|
|
6615
6654
|
var PrimeSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6616
|
-
type:
|
|
6655
|
+
type: z52.literal("submit"),
|
|
6617
6656
|
props: PrimeButtonPropsSchema.optional(),
|
|
6618
6657
|
logic: LogicArraySchema.optional()
|
|
6619
6658
|
});
|
|
6620
6659
|
var PrimeNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6621
|
-
type:
|
|
6660
|
+
type: z52.literal("next"),
|
|
6622
6661
|
props: PrimeButtonPropsSchema.optional(),
|
|
6623
6662
|
logic: LogicArraySchema.optional()
|
|
6624
6663
|
});
|
|
6625
6664
|
var PrimePreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6626
|
-
type:
|
|
6665
|
+
type: z52.literal("previous"),
|
|
6627
6666
|
props: PrimeButtonPropsSchema.optional()
|
|
6628
6667
|
});
|
|
6629
6668
|
var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6632,13 +6671,13 @@ var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6632
6671
|
* item, or a list of them for an object item.
|
|
6633
6672
|
*/
|
|
6634
6673
|
template: ArrayItemTemplateSchema,
|
|
6635
|
-
type:
|
|
6636
|
-
arrayKey:
|
|
6674
|
+
type: z52.literal("add-array-item"),
|
|
6675
|
+
arrayKey: z52.string().optional(),
|
|
6637
6676
|
props: PrimeButtonPropsSchema.optional()
|
|
6638
6677
|
});
|
|
6639
6678
|
var PrimeRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6640
|
-
type:
|
|
6641
|
-
arrayKey:
|
|
6679
|
+
type: z52.literal("remove-array-item"),
|
|
6680
|
+
arrayKey: z52.string().optional(),
|
|
6642
6681
|
props: PrimeButtonPropsSchema.optional()
|
|
6643
6682
|
});
|
|
6644
6683
|
var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6647,8 +6686,8 @@ var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6647
6686
|
* item, or a list of them for an object item.
|
|
6648
6687
|
*/
|
|
6649
6688
|
template: ArrayItemTemplateSchema,
|
|
6650
|
-
type:
|
|
6651
|
-
arrayKey:
|
|
6689
|
+
type: z52.literal("prepend-array-item"),
|
|
6690
|
+
arrayKey: z52.string().optional(),
|
|
6652
6691
|
props: PrimeButtonPropsSchema.optional()
|
|
6653
6692
|
});
|
|
6654
6693
|
var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6657,25 +6696,25 @@ var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6657
6696
|
* item, or a list of them for an object item.
|
|
6658
6697
|
*/
|
|
6659
6698
|
template: ArrayItemTemplateSchema,
|
|
6660
|
-
type:
|
|
6661
|
-
arrayKey:
|
|
6662
|
-
index:
|
|
6699
|
+
type: z52.literal("insert-array-item"),
|
|
6700
|
+
arrayKey: z52.string().optional(),
|
|
6701
|
+
index: z52.number(),
|
|
6663
6702
|
props: PrimeButtonPropsSchema.optional()
|
|
6664
6703
|
});
|
|
6665
6704
|
var PrimePopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6666
|
-
type:
|
|
6667
|
-
arrayKey:
|
|
6705
|
+
type: z52.literal("pop-array-item"),
|
|
6706
|
+
arrayKey: z52.string(),
|
|
6668
6707
|
props: PrimeButtonPropsSchema.optional()
|
|
6669
6708
|
});
|
|
6670
6709
|
var PrimeShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6671
|
-
type:
|
|
6672
|
-
arrayKey:
|
|
6710
|
+
type: z52.literal("shift-array-item"),
|
|
6711
|
+
arrayKey: z52.string(),
|
|
6673
6712
|
props: PrimeButtonPropsSchema.optional()
|
|
6674
6713
|
});
|
|
6675
6714
|
|
|
6676
6715
|
// internal/dynamic-forms-validation/primeng/src/prime-leaf-field.schema.ts
|
|
6677
|
-
import { z as
|
|
6678
|
-
var PrimeLeafFieldSchema =
|
|
6716
|
+
import { z as z53 } from "zod";
|
|
6717
|
+
var PrimeLeafFieldSchema = z53.discriminatedUnion("type", [
|
|
6679
6718
|
TextFieldSchema,
|
|
6680
6719
|
HiddenFieldSchema,
|
|
6681
6720
|
PrimeInputFieldSchemaObject,
|
|
@@ -6697,10 +6736,10 @@ var PrimeLeafFieldSchema = z51.discriminatedUnion("type", [
|
|
|
6697
6736
|
PrimeInsertArrayItemButtonFieldSchema,
|
|
6698
6737
|
PrimePopArrayItemButtonFieldSchema,
|
|
6699
6738
|
PrimeShiftArrayItemButtonFieldSchema
|
|
6700
|
-
]).superRefine(nullableValueRefine);
|
|
6739
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6701
6740
|
|
|
6702
6741
|
// internal/dynamic-forms-validation/primeng/src/prime-form-config.schema.ts
|
|
6703
|
-
import { z as
|
|
6742
|
+
import { z as z54 } from "zod";
|
|
6704
6743
|
var containerSchemas3 = createContainerSchemas({
|
|
6705
6744
|
leafFieldSchema: PrimeLeafFieldSchema
|
|
6706
6745
|
});
|
|
@@ -6709,13 +6748,13 @@ var PrimeRowFieldSchema = containerSchemas3.RowFieldSchema;
|
|
|
6709
6748
|
var PrimeGroupFieldSchema = containerSchemas3.GroupFieldSchema;
|
|
6710
6749
|
var PrimeArrayFieldSchema = containerSchemas3.ArrayFieldSchema;
|
|
6711
6750
|
var PrimeFieldSchema = containerSchemas3.AllFieldsSchema;
|
|
6712
|
-
var PrimeFormDefaultPropsSchema =
|
|
6713
|
-
styleClass:
|
|
6751
|
+
var PrimeFormDefaultPropsSchema = z54.object({
|
|
6752
|
+
styleClass: z54.string().optional()
|
|
6714
6753
|
});
|
|
6715
6754
|
var PrimeFormConfigSchema = createFormConfigSchema(PrimeFieldSchema, PrimeFormDefaultPropsSchema);
|
|
6716
6755
|
|
|
6717
6756
|
// internal/dynamic-forms-validation/ionic/src/props/index.ts
|
|
6718
|
-
import { z as
|
|
6757
|
+
import { z as z55 } from "zod";
|
|
6719
6758
|
function isLocaleTag(value) {
|
|
6720
6759
|
try {
|
|
6721
6760
|
return Intl.getCanonicalLocales(value).length > 0;
|
|
@@ -6723,209 +6762,209 @@ function isLocaleTag(value) {
|
|
|
6723
6762
|
return false;
|
|
6724
6763
|
}
|
|
6725
6764
|
}
|
|
6726
|
-
var IonicColorSchema =
|
|
6727
|
-
var IonicLabelPlacementSchema =
|
|
6728
|
-
var IonicJustifySchema =
|
|
6729
|
-
var IonicFillSchema =
|
|
6730
|
-
var IonicInputPropsSchema =
|
|
6731
|
-
fill:
|
|
6732
|
-
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(),
|
|
6733
6772
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6734
6773
|
color: IonicColorSchema.optional(),
|
|
6735
6774
|
hint: DynamicTextSchema.optional(),
|
|
6736
6775
|
errorText: DynamicTextSchema.optional(),
|
|
6737
|
-
counter:
|
|
6738
|
-
clearInput:
|
|
6739
|
-
type:
|
|
6776
|
+
counter: z55.boolean().optional(),
|
|
6777
|
+
clearInput: z55.boolean().optional(),
|
|
6778
|
+
type: z55.enum(["text", "email", "password", "number", "tel", "url", "search"]).optional(),
|
|
6740
6779
|
placeholder: DynamicTextSchema.optional()
|
|
6741
6780
|
});
|
|
6742
|
-
var IonicCheckboxPropsSchema =
|
|
6743
|
-
labelPlacement:
|
|
6781
|
+
var IonicCheckboxPropsSchema = z55.object({
|
|
6782
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6744
6783
|
justify: IonicJustifySchema.optional(),
|
|
6745
|
-
color:
|
|
6746
|
-
indeterminate:
|
|
6784
|
+
color: IonicColorSchema.optional(),
|
|
6785
|
+
indeterminate: z55.boolean().optional(),
|
|
6747
6786
|
hint: DynamicTextSchema.optional()
|
|
6748
6787
|
});
|
|
6749
|
-
var IonicRadioPropsSchema =
|
|
6750
|
-
labelPlacement:
|
|
6788
|
+
var IonicRadioPropsSchema = z55.object({
|
|
6789
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6751
6790
|
justify: IonicJustifySchema.optional(),
|
|
6752
|
-
color:
|
|
6791
|
+
color: IonicColorSchema.optional(),
|
|
6753
6792
|
hint: DynamicTextSchema.optional()
|
|
6754
6793
|
});
|
|
6755
|
-
var IonicTogglePropsSchema =
|
|
6756
|
-
labelPlacement:
|
|
6794
|
+
var IonicTogglePropsSchema = z55.object({
|
|
6795
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6757
6796
|
justify: IonicJustifySchema.optional(),
|
|
6758
|
-
color:
|
|
6759
|
-
enableOnOffLabels:
|
|
6797
|
+
color: IonicColorSchema.optional(),
|
|
6798
|
+
enableOnOffLabels: z55.boolean().optional(),
|
|
6760
6799
|
hint: DynamicTextSchema.optional()
|
|
6761
6800
|
});
|
|
6762
|
-
var IonicSliderPropsSchema =
|
|
6763
|
-
min:
|
|
6764
|
-
max:
|
|
6765
|
-
step:
|
|
6766
|
-
dualKnobs:
|
|
6767
|
-
pin:
|
|
6768
|
-
ticks:
|
|
6769
|
-
snaps:
|
|
6770
|
-
color:
|
|
6771
|
-
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(),
|
|
6772
6811
|
hint: DynamicTextSchema.optional()
|
|
6773
6812
|
});
|
|
6774
|
-
var IonicDatepickerPropsSchema =
|
|
6775
|
-
presentation:
|
|
6776
|
-
multiple:
|
|
6777
|
-
preferWheel:
|
|
6778
|
-
showDefaultButtons:
|
|
6779
|
-
showDefaultTitle:
|
|
6780
|
-
showDefaultTimeLabel:
|
|
6781
|
-
showClearButton:
|
|
6782
|
-
doneText:
|
|
6783
|
-
cancelText:
|
|
6784
|
-
size:
|
|
6785
|
-
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(),
|
|
6786
6825
|
hint: DynamicTextSchema.optional(),
|
|
6787
|
-
locale:
|
|
6826
|
+
locale: z55.string().refine(isLocaleTag, { message: 'Expected a BCP 47 locale tag such as "de-DE"' }).optional(),
|
|
6788
6827
|
placeholder: DynamicTextSchema.optional()
|
|
6789
6828
|
});
|
|
6790
|
-
var IonicSelectPropsSchema =
|
|
6791
|
-
multiple:
|
|
6792
|
-
interface:
|
|
6793
|
-
cancelText:
|
|
6794
|
-
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(),
|
|
6795
6834
|
placeholder: DynamicTextSchema.optional(),
|
|
6796
|
-
fill:
|
|
6797
|
-
shape:
|
|
6835
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6836
|
+
shape: z55.literal("round").optional(),
|
|
6798
6837
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6799
|
-
color:
|
|
6838
|
+
color: IonicColorSchema.optional(),
|
|
6800
6839
|
hint: DynamicTextSchema.optional()
|
|
6801
6840
|
});
|
|
6802
|
-
var IonicTextareaPropsSchema =
|
|
6803
|
-
rows:
|
|
6804
|
-
autoGrow:
|
|
6805
|
-
counter:
|
|
6806
|
-
fill:
|
|
6807
|
-
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(),
|
|
6808
6847
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6809
6848
|
hint: DynamicTextSchema.optional(),
|
|
6810
6849
|
errorText: DynamicTextSchema.optional(),
|
|
6811
6850
|
color: IonicColorSchema.optional(),
|
|
6812
6851
|
placeholder: DynamicTextSchema.optional()
|
|
6813
6852
|
});
|
|
6814
|
-
var IonicMultiCheckboxPropsSchema =
|
|
6815
|
-
labelPlacement:
|
|
6853
|
+
var IonicMultiCheckboxPropsSchema = z55.object({
|
|
6854
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6816
6855
|
justify: IonicJustifySchema.optional(),
|
|
6817
|
-
color:
|
|
6856
|
+
color: IonicColorSchema.optional(),
|
|
6818
6857
|
hint: DynamicTextSchema.optional()
|
|
6819
6858
|
});
|
|
6820
|
-
var IonicButtonPropsSchema =
|
|
6821
|
-
expand:
|
|
6859
|
+
var IonicButtonPropsSchema = z55.object({
|
|
6860
|
+
expand: z55.enum(["full", "block"]).optional(),
|
|
6822
6861
|
fill: IonicFillSchema.optional(),
|
|
6823
|
-
shape:
|
|
6824
|
-
size:
|
|
6862
|
+
shape: z55.literal("round").optional(),
|
|
6863
|
+
size: z55.enum(["small", "default", "large"]).optional(),
|
|
6825
6864
|
color: IonicColorSchema.optional(),
|
|
6826
|
-
strong:
|
|
6827
|
-
type:
|
|
6865
|
+
strong: z55.boolean().optional(),
|
|
6866
|
+
type: z55.enum(["button", "submit", "reset"]).optional()
|
|
6828
6867
|
});
|
|
6829
6868
|
|
|
6830
6869
|
// internal/dynamic-forms-validation/ionic/src/fields/index.ts
|
|
6831
|
-
import { z as
|
|
6870
|
+
import { z as z56 } from "zod";
|
|
6832
6871
|
var IonicValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6833
6872
|
var IonicInputFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6834
|
-
type:
|
|
6835
|
-
nullable:
|
|
6836
|
-
value:
|
|
6873
|
+
type: z56.literal("input"),
|
|
6874
|
+
nullable: z56.boolean().optional(),
|
|
6875
|
+
value: InputValueSchema,
|
|
6837
6876
|
placeholder: DynamicTextSchema.optional(),
|
|
6838
6877
|
props: IonicInputPropsSchema.optional()
|
|
6839
6878
|
});
|
|
6840
|
-
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6879
|
+
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6841
6880
|
var IonicCheckboxFieldSchema = IonicValueFieldBase.extend({
|
|
6842
|
-
type:
|
|
6843
|
-
value:
|
|
6881
|
+
type: z56.literal("checkbox"),
|
|
6882
|
+
value: z56.boolean().optional(),
|
|
6844
6883
|
placeholder: DynamicTextSchema.optional(),
|
|
6845
6884
|
props: IonicCheckboxPropsSchema.optional()
|
|
6846
6885
|
});
|
|
6847
6886
|
var IonicRadioFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6848
|
-
type:
|
|
6849
|
-
nullable:
|
|
6850
|
-
value:
|
|
6887
|
+
type: z56.literal("radio"),
|
|
6888
|
+
nullable: z56.boolean().optional(),
|
|
6889
|
+
value: z56.unknown().nullable().optional(),
|
|
6851
6890
|
placeholder: DynamicTextSchema.optional(),
|
|
6852
6891
|
options: FieldOptionsSchema,
|
|
6853
6892
|
props: IonicRadioPropsSchema.optional()
|
|
6854
6893
|
});
|
|
6855
6894
|
var IonicRadioFieldSchema = IonicRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6856
6895
|
var IonicToggleFieldSchema = IonicValueFieldBase.extend({
|
|
6857
|
-
type:
|
|
6858
|
-
value:
|
|
6896
|
+
type: z56.literal("toggle"),
|
|
6897
|
+
value: z56.boolean().optional(),
|
|
6859
6898
|
placeholder: DynamicTextSchema.optional(),
|
|
6860
6899
|
props: IonicTogglePropsSchema.optional()
|
|
6861
6900
|
});
|
|
6862
6901
|
var IonicSliderFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6863
|
-
type:
|
|
6864
|
-
nullable:
|
|
6865
|
-
value:
|
|
6866
|
-
minValue:
|
|
6867
|
-
maxValue:
|
|
6868
|
-
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(),
|
|
6869
6908
|
placeholder: DynamicTextSchema.optional(),
|
|
6870
6909
|
props: IonicSliderPropsSchema.optional()
|
|
6871
6910
|
});
|
|
6872
6911
|
var IonicSliderFieldSchema = IonicSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6873
6912
|
var IonicDatepickerFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6874
|
-
type:
|
|
6875
|
-
nullable:
|
|
6876
|
-
value:
|
|
6877
|
-
minDate:
|
|
6878
|
-
maxDate:
|
|
6879
|
-
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(),
|
|
6880
6919
|
placeholder: DynamicTextSchema.optional(),
|
|
6881
6920
|
props: IonicDatepickerPropsSchema.optional()
|
|
6882
6921
|
});
|
|
6883
6922
|
var IonicDatepickerFieldSchema = IonicDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6884
6923
|
var IonicSelectFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6885
|
-
type:
|
|
6886
|
-
nullable:
|
|
6887
|
-
value:
|
|
6924
|
+
type: z56.literal("select"),
|
|
6925
|
+
nullable: z56.boolean().optional(),
|
|
6926
|
+
value: z56.unknown().nullable().optional(),
|
|
6888
6927
|
placeholder: DynamicTextSchema.optional(),
|
|
6889
6928
|
options: FieldOptionsSchema,
|
|
6890
6929
|
props: IonicSelectPropsSchema.optional()
|
|
6891
6930
|
});
|
|
6892
6931
|
var IonicSelectFieldSchema = IonicSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6893
6932
|
var IonicTextareaFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6894
|
-
type:
|
|
6895
|
-
nullable:
|
|
6896
|
-
value:
|
|
6933
|
+
type: z56.literal("textarea"),
|
|
6934
|
+
nullable: z56.boolean().optional(),
|
|
6935
|
+
value: z56.string().nullable().optional(),
|
|
6897
6936
|
placeholder: DynamicTextSchema.optional(),
|
|
6898
6937
|
props: IonicTextareaPropsSchema.optional()
|
|
6899
6938
|
});
|
|
6900
6939
|
var IonicTextareaFieldSchema = IonicTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6901
6940
|
var IonicMultiCheckboxFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6902
|
-
type:
|
|
6903
|
-
nullable:
|
|
6904
|
-
value:
|
|
6941
|
+
type: z56.literal("multi-checkbox"),
|
|
6942
|
+
nullable: z56.boolean().optional(),
|
|
6943
|
+
value: z56.array(z56.unknown()).nullable().optional(),
|
|
6905
6944
|
placeholder: DynamicTextSchema.optional(),
|
|
6906
6945
|
options: FieldOptionsSchema,
|
|
6907
6946
|
props: IonicMultiCheckboxPropsSchema.optional()
|
|
6908
6947
|
});
|
|
6909
6948
|
var IonicMultiCheckboxFieldSchema = IonicMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6910
6949
|
var IonicButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6911
|
-
type:
|
|
6912
|
-
event:
|
|
6913
|
-
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(),
|
|
6914
6953
|
props: IonicButtonPropsSchema.optional(),
|
|
6915
6954
|
logic: LogicArraySchema.optional()
|
|
6916
6955
|
});
|
|
6917
6956
|
var IonicSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6918
|
-
type:
|
|
6957
|
+
type: z56.literal("submit"),
|
|
6919
6958
|
props: IonicButtonPropsSchema.optional(),
|
|
6920
6959
|
logic: LogicArraySchema.optional()
|
|
6921
6960
|
});
|
|
6922
6961
|
var IonicNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6923
|
-
type:
|
|
6962
|
+
type: z56.literal("next"),
|
|
6924
6963
|
props: IonicButtonPropsSchema.optional(),
|
|
6925
6964
|
logic: LogicArraySchema.optional()
|
|
6926
6965
|
});
|
|
6927
6966
|
var IonicPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6928
|
-
type:
|
|
6967
|
+
type: z56.literal("previous"),
|
|
6929
6968
|
props: IonicButtonPropsSchema.optional()
|
|
6930
6969
|
});
|
|
6931
6970
|
var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6934,13 +6973,13 @@ var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6934
6973
|
* item, or a list of them for an object item.
|
|
6935
6974
|
*/
|
|
6936
6975
|
template: ArrayItemTemplateSchema,
|
|
6937
|
-
type:
|
|
6938
|
-
arrayKey:
|
|
6976
|
+
type: z56.literal("add-array-item"),
|
|
6977
|
+
arrayKey: z56.string().optional(),
|
|
6939
6978
|
props: IonicButtonPropsSchema.optional()
|
|
6940
6979
|
});
|
|
6941
6980
|
var IonicRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6942
|
-
type:
|
|
6943
|
-
arrayKey:
|
|
6981
|
+
type: z56.literal("remove-array-item"),
|
|
6982
|
+
arrayKey: z56.string().optional(),
|
|
6944
6983
|
props: IonicButtonPropsSchema.optional()
|
|
6945
6984
|
});
|
|
6946
6985
|
var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6949,8 +6988,8 @@ var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6949
6988
|
* item, or a list of them for an object item.
|
|
6950
6989
|
*/
|
|
6951
6990
|
template: ArrayItemTemplateSchema,
|
|
6952
|
-
type:
|
|
6953
|
-
arrayKey:
|
|
6991
|
+
type: z56.literal("prepend-array-item"),
|
|
6992
|
+
arrayKey: z56.string().optional(),
|
|
6954
6993
|
props: IonicButtonPropsSchema.optional()
|
|
6955
6994
|
});
|
|
6956
6995
|
var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6959,25 +6998,25 @@ var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6959
6998
|
* item, or a list of them for an object item.
|
|
6960
6999
|
*/
|
|
6961
7000
|
template: ArrayItemTemplateSchema,
|
|
6962
|
-
type:
|
|
6963
|
-
arrayKey:
|
|
6964
|
-
index:
|
|
7001
|
+
type: z56.literal("insert-array-item"),
|
|
7002
|
+
arrayKey: z56.string().optional(),
|
|
7003
|
+
index: z56.number(),
|
|
6965
7004
|
props: IonicButtonPropsSchema.optional()
|
|
6966
7005
|
});
|
|
6967
7006
|
var IonicPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6968
|
-
type:
|
|
6969
|
-
arrayKey:
|
|
7007
|
+
type: z56.literal("pop-array-item"),
|
|
7008
|
+
arrayKey: z56.string(),
|
|
6970
7009
|
props: IonicButtonPropsSchema.optional()
|
|
6971
7010
|
});
|
|
6972
7011
|
var IonicShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6973
|
-
type:
|
|
6974
|
-
arrayKey:
|
|
7012
|
+
type: z56.literal("shift-array-item"),
|
|
7013
|
+
arrayKey: z56.string(),
|
|
6975
7014
|
props: IonicButtonPropsSchema.optional()
|
|
6976
7015
|
});
|
|
6977
7016
|
|
|
6978
7017
|
// internal/dynamic-forms-validation/ionic/src/ionic-leaf-field.schema.ts
|
|
6979
|
-
import { z as
|
|
6980
|
-
var IonicLeafFieldSchema =
|
|
7018
|
+
import { z as z57 } from "zod";
|
|
7019
|
+
var IonicLeafFieldSchema = z57.discriminatedUnion("type", [
|
|
6981
7020
|
TextFieldSchema,
|
|
6982
7021
|
HiddenFieldSchema,
|
|
6983
7022
|
IonicInputFieldSchemaObject,
|
|
@@ -6999,10 +7038,10 @@ var IonicLeafFieldSchema = z55.discriminatedUnion("type", [
|
|
|
6999
7038
|
IonicInsertArrayItemButtonFieldSchema,
|
|
7000
7039
|
IonicPopArrayItemButtonFieldSchema,
|
|
7001
7040
|
IonicShiftArrayItemButtonFieldSchema
|
|
7002
|
-
]).superRefine(nullableValueRefine);
|
|
7041
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
7003
7042
|
|
|
7004
7043
|
// internal/dynamic-forms-validation/ionic/src/ionic-form-config.schema.ts
|
|
7005
|
-
import { z as
|
|
7044
|
+
import { z as z58 } from "zod";
|
|
7006
7045
|
var containerSchemas4 = createContainerSchemas({
|
|
7007
7046
|
leafFieldSchema: IonicLeafFieldSchema
|
|
7008
7047
|
});
|
|
@@ -7011,7 +7050,7 @@ var IonicRowFieldSchema = containerSchemas4.RowFieldSchema;
|
|
|
7011
7050
|
var IonicGroupFieldSchema = containerSchemas4.GroupFieldSchema;
|
|
7012
7051
|
var IonicArrayFieldSchema = containerSchemas4.ArrayFieldSchema;
|
|
7013
7052
|
var IonicFieldSchema = containerSchemas4.AllFieldsSchema;
|
|
7014
|
-
var IonicFormDefaultPropsSchema =
|
|
7053
|
+
var IonicFormDefaultPropsSchema = z58.object({
|
|
7015
7054
|
color: IonicColorSchema.optional(),
|
|
7016
7055
|
labelPlacement: IonicLabelPlacementSchema.optional()
|
|
7017
7056
|
});
|
|
@@ -7025,7 +7064,7 @@ var formConfigSchemas = {
|
|
|
7025
7064
|
ionic: IonicFormConfigSchema
|
|
7026
7065
|
};
|
|
7027
7066
|
function toJsonSchema(schema, name, basePath) {
|
|
7028
|
-
const jsonSchema =
|
|
7067
|
+
const jsonSchema = z59.toJSONSchema(schema, { target: "draft-7", io: "input", unrepresentable: "any" });
|
|
7029
7068
|
jsonSchema["$id"] = basePath ? `${basePath.replace(/\/$/, "")}/${name}` : name;
|
|
7030
7069
|
return jsonSchema;
|
|
7031
7070
|
}
|
|
@@ -7143,30 +7182,30 @@ function getLeafFieldJsonSchema(uiIntegration) {
|
|
|
7143
7182
|
}
|
|
7144
7183
|
|
|
7145
7184
|
// internal/dynamic-forms-validation/src/lib/schemas/field-type-names.ts
|
|
7146
|
-
import { z as
|
|
7185
|
+
import { z as z60 } from "zod";
|
|
7147
7186
|
var MAX_DEPTH = 20;
|
|
7148
7187
|
function collectDiscriminator(schema, into) {
|
|
7149
|
-
if (schema instanceof
|
|
7188
|
+
if (schema instanceof z60.ZodLiteral) {
|
|
7150
7189
|
for (const value of schema.def.values) {
|
|
7151
7190
|
if (typeof value === "string") into.add(value);
|
|
7152
7191
|
}
|
|
7153
7192
|
return;
|
|
7154
7193
|
}
|
|
7155
|
-
if (schema instanceof
|
|
7194
|
+
if (schema instanceof z60.ZodEnum) {
|
|
7156
7195
|
for (const value of schema.options) into.add(value);
|
|
7157
7196
|
}
|
|
7158
7197
|
}
|
|
7159
7198
|
function visit(schema, into, depth) {
|
|
7160
7199
|
if (depth > MAX_DEPTH) return;
|
|
7161
|
-
if (schema instanceof
|
|
7200
|
+
if (schema instanceof z60.ZodLazy) {
|
|
7162
7201
|
visit(schema.unwrap(), into, depth + 1);
|
|
7163
7202
|
return;
|
|
7164
7203
|
}
|
|
7165
|
-
if (schema instanceof
|
|
7204
|
+
if (schema instanceof z60.ZodUnion) {
|
|
7166
7205
|
for (const option of schema.options) visit(option, into, depth + 1);
|
|
7167
7206
|
return;
|
|
7168
7207
|
}
|
|
7169
|
-
if (schema instanceof
|
|
7208
|
+
if (schema instanceof z60.ZodObject) {
|
|
7170
7209
|
collectDiscriminator(schema.shape["type"], into);
|
|
7171
7210
|
return;
|
|
7172
7211
|
}
|
|
@@ -7177,6 +7216,1040 @@ function collectFieldTypeNames(schema) {
|
|
|
7177
7216
|
return [...names];
|
|
7178
7217
|
}
|
|
7179
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
|
+
|
|
7180
8253
|
// internal/dynamic-forms-validation/validate/src/tools/validate-config.tool.ts
|
|
7181
8254
|
var formConfigSchemas2 = {
|
|
7182
8255
|
material: MatFormConfigSchema,
|
|
@@ -7440,11 +8513,22 @@ function preValidateConfig(config) {
|
|
|
7440
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"`
|
|
7441
8514
|
});
|
|
7442
8515
|
}
|
|
8516
|
+
const reportedExpressions = /* @__PURE__ */ new Set();
|
|
7443
8517
|
function checkField(field, path, parentType) {
|
|
7444
8518
|
if (!field || typeof field !== "object") return;
|
|
7445
8519
|
const f = field;
|
|
7446
8520
|
const fieldType = f["type"];
|
|
7447
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
|
+
}
|
|
7448
8532
|
const validators = f["validators"];
|
|
7449
8533
|
if (Array.isArray(validators)) {
|
|
7450
8534
|
validators.forEach((validator, vIdx) => {
|
|
@@ -8185,6 +9269,7 @@ function parseConfigInput(config) {
|
|
|
8185
9269
|
}
|
|
8186
9270
|
|
|
8187
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.";
|
|
8188
9273
|
var FIX_SUGGESTIONS = {
|
|
8189
9274
|
options: "Move `options` from `props: { options: [...] }` to field level: `{ key, type, options: [...] }`",
|
|
8190
9275
|
label: "Remove `label` from this container field (page/group/row/array). Use a `text` field inside for headings.",
|
|
@@ -8220,6 +9305,7 @@ function pathSegments(path) {
|
|
|
8220
9305
|
return path.split(/[.[\]]+/).filter((segment) => segment.length > 0 && !/^\d+$/.test(segment));
|
|
8221
9306
|
}
|
|
8222
9307
|
function getFixSuggestion(error) {
|
|
9308
|
+
if (error.ruleId === "core/expression-syntax") return EXPRESSION_SYNTAX_SUGGESTION;
|
|
8223
9309
|
for (const segment of pathSegments(error.path).reverse()) {
|
|
8224
9310
|
if (FIX_SUGGESTIONS[segment]) {
|
|
8225
9311
|
return FIX_SUGGESTIONS[segment];
|
|
@@ -8360,6 +9446,11 @@ function rule(id, summary, why) {
|
|
|
8360
9446
|
var RULES = Object.freeze(
|
|
8361
9447
|
Object.fromEntries(
|
|
8362
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
|
+
),
|
|
8363
9454
|
rule(
|
|
8364
9455
|
"core/hidden-minimal",
|
|
8365
9456
|
"Keep hidden fields to `key`, `type`, `value` and `className`",
|
|
@@ -8610,7 +9701,7 @@ function registerResources(server) {
|
|
|
8610
9701
|
}
|
|
8611
9702
|
|
|
8612
9703
|
// packages/dynamic-form-mcp/src/tools/lookup.tool.ts
|
|
8613
|
-
import { z as
|
|
9704
|
+
import { z as z61 } from "zod";
|
|
8614
9705
|
|
|
8615
9706
|
// packages/dynamic-form-mcp/src/tools/data/lookup-topics.ts
|
|
8616
9707
|
var TOPICS = {
|
|
@@ -9660,14 +10751,7 @@ derivation: 'formValue.discount ?? 0' // Nullish coalescing
|
|
|
9660
10751
|
derivation: 'formValue.price * (1 - externalData.discountRate)' // External data
|
|
9661
10752
|
\`\`\`
|
|
9662
10753
|
|
|
9663
|
-
**
|
|
9664
|
-
\`\`\`typescript
|
|
9665
|
-
derivation: \`(() => {
|
|
9666
|
-
const qty = formValue.quantity || 0;
|
|
9667
|
-
const price = formValue.unitPrice || 0;
|
|
9668
|
-
return qty * price;
|
|
9669
|
-
})()\`
|
|
9670
|
-
\`\`\`
|
|
10754
|
+
**Expressions only:** no statements (\`const\`, \`if\`, \`return\`), no \`new\`, and no globals (\`Math\`, \`String()\`, \`Array.isArray\`). Use a ternary for branching and a custom derivation function for anything longer.
|
|
9671
10755
|
|
|
9672
10756
|
**See also:** \`property-derivation\` topic for deriving component properties (minDate, options, label, etc.)`
|
|
9673
10757
|
},
|
|
@@ -10687,10 +11771,14 @@ const config = { fields: [...] } as const satisfies FormConfig;
|
|
|
10687
11771
|
| \`endsWith\` | String ends with | \`'hello'.endsWith('lo')\` |
|
|
10688
11772
|
| \`matches\` | Regex match | \`/^[0-9]+$/.test(value)\` |
|
|
10689
11773
|
|
|
11774
|
+
An empty field value (\`null\`, \`undefined\` or \`''\`) never satisfies \`greater\`, \`less\`, \`greaterOrEqual\`, \`lessOrEqual\`, \`contains\`, \`startsWith\` or \`endsWith\`. \`matches\` tests it as \`''\`, so \`'^$'\` matches an empty field. \`0\` and \`false\` are not empty.
|
|
11775
|
+
|
|
10690
11776
|
For \`matches\`, the value is a pattern string. Use the \`/pattern/flags\` form to pass regex flags, e.g. \`"/john/i"\` for case-insensitive matching. A plain pattern (no \`/.../\` delimiters) is matched case-sensitively with no flags.
|
|
10691
11777
|
|
|
10692
11778
|
## Combining Conditions
|
|
10693
11779
|
|
|
11780
|
+
An \`and\` or \`or\` group with no conditions never fires.
|
|
11781
|
+
|
|
10694
11782
|
**AND (all must be true):**
|
|
10695
11783
|
\`\`\`typescript
|
|
10696
11784
|
condition: {
|
|
@@ -10869,7 +11957,7 @@ expression: '(formValue.contacts?.length || 0) + " contacts"'
|
|
|
10869
11957
|
expression: '(formValue.firstName || "") + " " + (formValue.lastName || "")'
|
|
10870
11958
|
|
|
10871
11959
|
// Address formatting
|
|
10872
|
-
expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip].filter(
|
|
11960
|
+
expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip].filter(x => x).join(", ")\`
|
|
10873
11961
|
\`\`\`
|
|
10874
11962
|
|
|
10875
11963
|
## Math Calculations
|
|
@@ -10878,7 +11966,7 @@ expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip]
|
|
|
10878
11966
|
expression: '(formValue.quantity || 0) * (formValue.unitPrice || 0)'
|
|
10879
11967
|
|
|
10880
11968
|
// Percentage
|
|
10881
|
-
expression: '
|
|
11969
|
+
expression: '((formValue.completed / formValue.total) * 100).toFixed(0) + "%"'
|
|
10882
11970
|
|
|
10883
11971
|
// Sum of array
|
|
10884
11972
|
expression: '(formValue.items || []).reduce((sum, item) => sum + (item.price || 0), 0)'
|
|
@@ -10889,13 +11977,8 @@ expression: '(formValue.items || []).reduce((sum, item) => sum + (item.price ||
|
|
|
10889
11977
|
// Ternary
|
|
10890
11978
|
expression: 'formValue.isPremium ? "Premium Member" : "Standard Member"'
|
|
10891
11979
|
|
|
10892
|
-
// Multiple conditions
|
|
10893
|
-
expression:
|
|
10894
|
-
if (formValue.score >= 90) return 'A';
|
|
10895
|
-
if (formValue.score >= 80) return 'B';
|
|
10896
|
-
if (formValue.score >= 70) return 'C';
|
|
10897
|
-
return 'D';
|
|
10898
|
-
})()\`
|
|
11980
|
+
// Multiple conditions (nested ternary)
|
|
11981
|
+
expression: 'formValue.score >= 90 ? "A" : formValue.score >= 80 ? "B" : formValue.score >= 70 ? "C" : "D"'
|
|
10899
11982
|
\`\`\``
|
|
10900
11983
|
},
|
|
10901
11984
|
"type-narrowing": {
|
|
@@ -11920,11 +13003,11 @@ Patterns: field-placement, logic-matrix, context-api, containers, multi-page-got
|
|
|
11920
13003
|
Use topic="list" to see all available topics with descriptions.
|
|
11921
13004
|
Use ngforge_search query="your question" to find topics by keyword.`,
|
|
11922
13005
|
{
|
|
11923
|
-
topic:
|
|
13006
|
+
topic: z61.string().describe(
|
|
11924
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'
|
|
11925
13008
|
),
|
|
11926
|
-
depth:
|
|
11927
|
-
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")
|
|
11928
13011
|
},
|
|
11929
13012
|
async ({ topic, depth, uiIntegration }) => {
|
|
11930
13013
|
const normalizedTopic = topic.toLowerCase().trim();
|
|
@@ -11972,7 +13055,7 @@ ${nextSteps}`;
|
|
|
11972
13055
|
}
|
|
11973
13056
|
|
|
11974
13057
|
// packages/dynamic-form-mcp/src/tools/examples.tool.ts
|
|
11975
|
-
import { z as
|
|
13058
|
+
import { z as z62 } from "zod";
|
|
11976
13059
|
var PATTERNS = {
|
|
11977
13060
|
// ========== MINIMAL PATTERNS (NEW) ==========
|
|
11978
13061
|
"minimal-multipage": {
|
|
@@ -14053,21 +15136,24 @@ const megaFormConfig = {
|
|
|
14053
15136
|
key: 'sourceA',
|
|
14054
15137
|
type: 'input',
|
|
14055
15138
|
label: 'Source A',
|
|
14056
|
-
value:
|
|
15139
|
+
value: 10,
|
|
15140
|
+
props: { type: 'number' }
|
|
14057
15141
|
},
|
|
14058
15142
|
{
|
|
14059
15143
|
key: 'sourceB',
|
|
14060
15144
|
type: 'input',
|
|
14061
15145
|
label: 'Source B',
|
|
14062
|
-
value:
|
|
15146
|
+
value: 20,
|
|
15147
|
+
props: { type: 'number' }
|
|
14063
15148
|
},
|
|
14064
15149
|
{
|
|
14065
15150
|
key: 'derived',
|
|
14066
15151
|
type: 'input',
|
|
14067
15152
|
label: 'Derived (A + B)',
|
|
14068
15153
|
readonly: true,
|
|
15154
|
+
props: { type: 'number' },
|
|
14069
15155
|
// Self-targeting derivation - no targetField needed
|
|
14070
|
-
derivation: '
|
|
15156
|
+
derivation: '(formValue.sourceA ?? 0) + (formValue.sourceB ?? 0)'
|
|
14071
15157
|
},
|
|
14072
15158
|
|
|
14073
15159
|
// CONDITIONAL VISIBILITY
|
|
@@ -14237,10 +15323,10 @@ Standard patterns: derivation, property-derivation, multi-page, conditional, val
|
|
|
14237
15323
|
Use pattern="list" to see all available patterns.
|
|
14238
15324
|
Use depth="minimal" for code-only output (no markdown).`,
|
|
14239
15325
|
{
|
|
14240
|
-
pattern:
|
|
15326
|
+
pattern: z62.string().optional().describe(
|
|
14241
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.'
|
|
14242
15328
|
),
|
|
14243
|
-
depth:
|
|
15329
|
+
depth: z62.enum(["minimal", "brief", "full", "explained"]).default("full").describe(
|
|
14244
15330
|
"minimal=code only (~20-50 lines), brief=code+summary, full=code+comments (default), explained=code+detailed explanation"
|
|
14245
15331
|
)
|
|
14246
15332
|
},
|
|
@@ -14307,7 +15393,7 @@ function extractCode(markdown) {
|
|
|
14307
15393
|
// packages/dynamic-form-mcp/src/tools/validate.tool.ts
|
|
14308
15394
|
import { access } from "node:fs/promises";
|
|
14309
15395
|
import { dirname as dirname2, join as join2, parse, resolve } from "node:path";
|
|
14310
|
-
import { z as
|
|
15396
|
+
import { z as z63 } from "zod";
|
|
14311
15397
|
var UI_INTEGRATIONS3 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14312
15398
|
async function projectDisabledRules(filePath) {
|
|
14313
15399
|
return (await loadProjectRules(await nearestManifest(dirname2(filePath)))).disabled;
|
|
@@ -14379,10 +15465,10 @@ Example errors you'll see:
|
|
|
14379
15465
|
- "options MUST be at FIELD level, NOT inside props"
|
|
14380
15466
|
- "containers only support 'hidden' logic type"`,
|
|
14381
15467
|
{
|
|
14382
|
-
config:
|
|
15468
|
+
config: z63.union([z63.string(), z63.object({}).passthrough()]).describe(
|
|
14383
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."
|
|
14384
15470
|
),
|
|
14385
|
-
uiIntegration:
|
|
15471
|
+
uiIntegration: z63.enum(UI_INTEGRATIONS3).default("material").describe("UI library to validate against (material, bootstrap, primeng, ionic). Defaults to material.")
|
|
14386
15472
|
},
|
|
14387
15473
|
async ({ config, uiIntegration }) => {
|
|
14388
15474
|
try {
|
|
@@ -14479,7 +15565,7 @@ If validating JSON, ensure:
|
|
|
14479
15565
|
}
|
|
14480
15566
|
|
|
14481
15567
|
// packages/dynamic-form-mcp/src/tools/scaffold.tool.ts
|
|
14482
|
-
import { z as
|
|
15568
|
+
import { z as z64 } from "zod";
|
|
14483
15569
|
var UI_INTEGRATIONS4 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14484
15570
|
function parseFieldDefs(fields) {
|
|
14485
15571
|
return fields.map((f) => {
|
|
@@ -14734,12 +15820,12 @@ Examples:
|
|
|
14734
15820
|
- With groups: pages=0 groups=["address","billing"]
|
|
14735
15821
|
- With hidden: hidden=["userId:abc123","source:web"]`,
|
|
14736
15822
|
{
|
|
14737
|
-
pages:
|
|
14738
|
-
arrays:
|
|
14739
|
-
groups:
|
|
14740
|
-
hidden:
|
|
14741
|
-
fields:
|
|
14742
|
-
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.")
|
|
14743
15829
|
},
|
|
14744
15830
|
async ({ pages, arrays = [], groups = [], hidden = [], fields = [] }) => {
|
|
14745
15831
|
const fieldDefs = parseFieldDefs(fields);
|
|
@@ -14781,7 +15867,7 @@ Examples:
|
|
|
14781
15867
|
}
|
|
14782
15868
|
|
|
14783
15869
|
// packages/dynamic-form-mcp/src/tools/search.tool.ts
|
|
14784
|
-
import { z as
|
|
15870
|
+
import { z as z65 } from "zod";
|
|
14785
15871
|
var searchIndex = null;
|
|
14786
15872
|
function getTopicSubcategory(key) {
|
|
14787
15873
|
const fieldTypes = ["input", "select", "slider", "radio", "checkbox", "textarea", "datepicker", "toggle", "text", "hidden"];
|
|
@@ -14942,7 +16028,7 @@ Use this when you don't know the exact topic name.
|
|
|
14942
16028
|
|
|
14943
16029
|
New to ng-forge? Start with: ngforge_lookup topic="workflow"`,
|
|
14944
16030
|
{
|
|
14945
|
-
query:
|
|
16031
|
+
query: z65.string().describe("Natural language or keywords to search for")
|
|
14946
16032
|
},
|
|
14947
16033
|
async ({ query }) => {
|
|
14948
16034
|
const index = buildIndex();
|