@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/bin/ng-forge-mcp.js
CHANGED
|
@@ -86,7 +86,7 @@ var FIELD_TYPES = [
|
|
|
86
86
|
multiple: {
|
|
87
87
|
name: "multiple",
|
|
88
88
|
type: "boolean",
|
|
89
|
-
description: "Allow multiple selections",
|
|
89
|
+
description: "Allow multiple selections. The value becomes an array of the selected values",
|
|
90
90
|
required: false,
|
|
91
91
|
default: false
|
|
92
92
|
}
|
|
@@ -3071,6 +3071,7 @@ Use \`options.fieldWindowing\` for large flat forms:
|
|
|
3071
3071
|
- \`park.margin\` follows \`IntersectionObserver.rootMargin\`: use one to four \`px\` or \`%\` values. Unsupported units fall back to the inherited margin.
|
|
3072
3072
|
- \`fieldWindowing: false\` disables inherited deferred mounting for that form.
|
|
3073
3073
|
- A park-only object changes parking without changing the inherited mounting mode. Use \`{ park: false }\` to opt out or \`{ park: true }\` to opt in.
|
|
3074
|
+
- 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.
|
|
3074
3075
|
|
|
3075
3076
|
## Validation
|
|
3076
3077
|
|
|
@@ -3204,6 +3205,7 @@ Compares a specific field's value:
|
|
|
3204
3205
|
- \`equals\`, \`notEquals\`
|
|
3205
3206
|
- \`greater\`, \`less\`, \`greaterOrEqual\`, \`lessOrEqual\`
|
|
3206
3207
|
- \`contains\`, \`startsWith\`, \`endsWith\`, \`matches\`
|
|
3208
|
+
- An empty value (null, undefined or '') never satisfies the ordered or string operators. \`matches\` tests it as '', and 0 and false are not empty.
|
|
3207
3209
|
|
|
3208
3210
|
#### JavaScript Condition
|
|
3209
3211
|
|
|
@@ -3216,6 +3218,8 @@ Evaluates a JavaScript expression with access to \`formValue\`, \`fieldValue\`,
|
|
|
3216
3218
|
}
|
|
3217
3219
|
\`\`\`
|
|
3218
3220
|
|
|
3221
|
+
**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.
|
|
3222
|
+
|
|
3219
3223
|
**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.
|
|
3220
3224
|
|
|
3221
3225
|
#### Custom Condition
|
|
@@ -3286,6 +3290,8 @@ Combine conditions with \`and\` (all must be true) or \`or\` (at least one must
|
|
|
3286
3290
|
}
|
|
3287
3291
|
\`\`\`
|
|
3288
3292
|
|
|
3293
|
+
An empty \`conditions\` array evaluates to false, so an empty group never fires. Dev mode warns about it at startup.
|
|
3294
|
+
|
|
3289
3295
|
## UI Library Integration
|
|
3290
3296
|
|
|
3291
3297
|
ng-forge supports multiple UI libraries. Configure in \`app.config.ts\`:
|
|
@@ -5406,7 +5412,7 @@ var BaseFormConfigSchema = z19.object({
|
|
|
5406
5412
|
});
|
|
5407
5413
|
|
|
5408
5414
|
// internal/dynamic-forms-validation/validate/src/json-schema/form-config-json-schema.ts
|
|
5409
|
-
import { z as
|
|
5415
|
+
import { z as z59 } from "zod";
|
|
5410
5416
|
|
|
5411
5417
|
// internal/dynamic-forms-validation/material/src/props/mat-common-props.schema.ts
|
|
5412
5418
|
import { z as z20 } from "zod";
|
|
@@ -5729,17 +5735,43 @@ var MatButtonPropsSchema = z30.object({
|
|
|
5729
5735
|
});
|
|
5730
5736
|
|
|
5731
5737
|
// internal/dynamic-forms-validation/material/src/fields/mat-input-field.schema.ts
|
|
5738
|
+
import { z as z32 } from "zod";
|
|
5739
|
+
|
|
5740
|
+
// internal/dynamic-forms-validation/src/lib/schemas/field/input-value.schema.ts
|
|
5732
5741
|
import { z as z31 } from "zod";
|
|
5742
|
+
var InputValueSchema = z31.union([z31.string(), z31.number()]).nullable().optional();
|
|
5743
|
+
var inputValueTypeRefine = (data, ctx) => {
|
|
5744
|
+
if (!data || typeof data !== "object") return;
|
|
5745
|
+
const field = data;
|
|
5746
|
+
if (field.type !== "input") return;
|
|
5747
|
+
const numeric = field.props?.type === "number";
|
|
5748
|
+
if (typeof field.value === "number" && !numeric) {
|
|
5749
|
+
ctx.addIssue({
|
|
5750
|
+
code: z31.ZodIssueCode.custom,
|
|
5751
|
+
path: ["value"],
|
|
5752
|
+
message: "A number value needs `props: { type: 'number' }`. Other input types hold strings."
|
|
5753
|
+
});
|
|
5754
|
+
}
|
|
5755
|
+
if (typeof field.value === "string" && numeric) {
|
|
5756
|
+
ctx.addIssue({
|
|
5757
|
+
code: z31.ZodIssueCode.custom,
|
|
5758
|
+
path: ["value"],
|
|
5759
|
+
message: "An input with `props: { type: 'number' }` holds a number, not a string."
|
|
5760
|
+
});
|
|
5761
|
+
}
|
|
5762
|
+
};
|
|
5763
|
+
|
|
5764
|
+
// internal/dynamic-forms-validation/material/src/fields/mat-input-field.schema.ts
|
|
5733
5765
|
var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5734
5766
|
/**
|
|
5735
5767
|
* Field type discriminant.
|
|
5736
5768
|
*/
|
|
5737
|
-
type:
|
|
5738
|
-
nullable:
|
|
5769
|
+
type: z32.literal("input"),
|
|
5770
|
+
nullable: z32.boolean().optional(),
|
|
5739
5771
|
/**
|
|
5740
5772
|
* Initial value for the input.
|
|
5741
5773
|
*/
|
|
5742
|
-
value:
|
|
5774
|
+
value: InputValueSchema,
|
|
5743
5775
|
/**
|
|
5744
5776
|
* Placeholder text (can also be in props).
|
|
5745
5777
|
*/
|
|
@@ -5749,20 +5781,20 @@ var MatInputFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5749
5781
|
*/
|
|
5750
5782
|
props: MatInputPropsSchema.optional()
|
|
5751
5783
|
});
|
|
5752
|
-
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5784
|
+
var MatInputFieldSchema = MatInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
5753
5785
|
|
|
5754
5786
|
// internal/dynamic-forms-validation/material/src/fields/mat-textarea-field.schema.ts
|
|
5755
|
-
import { z as
|
|
5787
|
+
import { z as z33 } from "zod";
|
|
5756
5788
|
var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5757
5789
|
/**
|
|
5758
5790
|
* Field type discriminant.
|
|
5759
5791
|
*/
|
|
5760
|
-
type:
|
|
5761
|
-
nullable:
|
|
5792
|
+
type: z33.literal("textarea"),
|
|
5793
|
+
nullable: z33.boolean().optional(),
|
|
5762
5794
|
/**
|
|
5763
5795
|
* Initial value for the textarea.
|
|
5764
5796
|
*/
|
|
5765
|
-
value:
|
|
5797
|
+
value: z33.string().nullable().optional(),
|
|
5766
5798
|
/**
|
|
5767
5799
|
* Placeholder text (can also be in props).
|
|
5768
5800
|
*/
|
|
@@ -5775,18 +5807,18 @@ var MatTextareaFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationS
|
|
|
5775
5807
|
var MatTextareaFieldSchema = MatTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5776
5808
|
|
|
5777
5809
|
// internal/dynamic-forms-validation/material/src/fields/mat-select-field.schema.ts
|
|
5778
|
-
import { z as
|
|
5810
|
+
import { z as z34 } from "zod";
|
|
5779
5811
|
var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5780
5812
|
/**
|
|
5781
5813
|
* Field type discriminant.
|
|
5782
5814
|
*/
|
|
5783
|
-
type:
|
|
5784
|
-
nullable:
|
|
5815
|
+
type: z34.literal("select"),
|
|
5816
|
+
nullable: z34.boolean().optional(),
|
|
5785
5817
|
/**
|
|
5786
5818
|
* Initial value for the select.
|
|
5787
5819
|
* Can be single value or array if multiple is enabled.
|
|
5788
5820
|
*/
|
|
5789
|
-
value:
|
|
5821
|
+
value: z34.unknown().nullable().optional(),
|
|
5790
5822
|
/**
|
|
5791
5823
|
* Placeholder text (can also be in props).
|
|
5792
5824
|
*/
|
|
@@ -5803,16 +5835,16 @@ var MatSelectFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5803
5835
|
var MatSelectFieldSchema = MatSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5804
5836
|
|
|
5805
5837
|
// internal/dynamic-forms-validation/material/src/fields/mat-checkbox-field.schema.ts
|
|
5806
|
-
import { z as
|
|
5838
|
+
import { z as z35 } from "zod";
|
|
5807
5839
|
var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5808
5840
|
/**
|
|
5809
5841
|
* Field type discriminant.
|
|
5810
5842
|
*/
|
|
5811
|
-
type:
|
|
5843
|
+
type: z35.literal("checkbox"),
|
|
5812
5844
|
/**
|
|
5813
5845
|
* Initial checked state.
|
|
5814
5846
|
*/
|
|
5815
|
-
value:
|
|
5847
|
+
value: z35.boolean().optional(),
|
|
5816
5848
|
/**
|
|
5817
5849
|
* Placeholder/helper text.
|
|
5818
5850
|
*/
|
|
@@ -5824,17 +5856,17 @@ var MatCheckboxFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema)
|
|
|
5824
5856
|
});
|
|
5825
5857
|
|
|
5826
5858
|
// internal/dynamic-forms-validation/material/src/fields/mat-radio-field.schema.ts
|
|
5827
|
-
import { z as
|
|
5859
|
+
import { z as z36 } from "zod";
|
|
5828
5860
|
var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5829
5861
|
/**
|
|
5830
5862
|
* Field type discriminant.
|
|
5831
5863
|
*/
|
|
5832
|
-
type:
|
|
5833
|
-
nullable:
|
|
5864
|
+
type: z36.literal("radio"),
|
|
5865
|
+
nullable: z36.boolean().optional(),
|
|
5834
5866
|
/**
|
|
5835
5867
|
* Initial selected value.
|
|
5836
5868
|
*/
|
|
5837
|
-
value:
|
|
5869
|
+
value: z36.unknown().nullable().optional(),
|
|
5838
5870
|
/**
|
|
5839
5871
|
* Placeholder/helper text.
|
|
5840
5872
|
*/
|
|
@@ -5851,17 +5883,17 @@ var MatRadioFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSche
|
|
|
5851
5883
|
var MatRadioFieldSchema = MatRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5852
5884
|
|
|
5853
5885
|
// internal/dynamic-forms-validation/material/src/fields/mat-multi-checkbox-field.schema.ts
|
|
5854
|
-
import { z as
|
|
5886
|
+
import { z as z37 } from "zod";
|
|
5855
5887
|
var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5856
5888
|
/**
|
|
5857
5889
|
* Field type discriminant.
|
|
5858
5890
|
*/
|
|
5859
|
-
type:
|
|
5860
|
-
nullable:
|
|
5891
|
+
type: z37.literal("multi-checkbox"),
|
|
5892
|
+
nullable: z37.boolean().optional(),
|
|
5861
5893
|
/**
|
|
5862
5894
|
* Initial selected values (array).
|
|
5863
5895
|
*/
|
|
5864
|
-
value:
|
|
5896
|
+
value: z37.array(z37.unknown()).nullable().optional(),
|
|
5865
5897
|
/**
|
|
5866
5898
|
* Placeholder/helper text.
|
|
5867
5899
|
*/
|
|
@@ -5878,16 +5910,16 @@ var MatMultiCheckboxFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValida
|
|
|
5878
5910
|
var MatMultiCheckboxFieldSchema = MatMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5879
5911
|
|
|
5880
5912
|
// internal/dynamic-forms-validation/material/src/fields/mat-toggle-field.schema.ts
|
|
5881
|
-
import { z as
|
|
5913
|
+
import { z as z38 } from "zod";
|
|
5882
5914
|
var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5883
5915
|
/**
|
|
5884
5916
|
* Field type discriminant.
|
|
5885
5917
|
*/
|
|
5886
|
-
type:
|
|
5918
|
+
type: z38.literal("toggle"),
|
|
5887
5919
|
/**
|
|
5888
5920
|
* Initial toggle state.
|
|
5889
5921
|
*/
|
|
5890
|
-
value:
|
|
5922
|
+
value: z38.boolean().optional(),
|
|
5891
5923
|
/**
|
|
5892
5924
|
* Placeholder/helper text.
|
|
5893
5925
|
*/
|
|
@@ -5899,29 +5931,36 @@ var MatToggleFieldSchema = BaseFieldDefSchema.merge(FieldWithValidationSchema).e
|
|
|
5899
5931
|
});
|
|
5900
5932
|
|
|
5901
5933
|
// internal/dynamic-forms-validation/material/src/fields/mat-slider-field.schema.ts
|
|
5902
|
-
import { z as
|
|
5934
|
+
import { z as z40 } from "zod";
|
|
5935
|
+
|
|
5936
|
+
// internal/dynamic-forms-validation/src/lib/schemas/field/multi-value.schema.ts
|
|
5937
|
+
import { z as z39 } from "zod";
|
|
5938
|
+
var SliderValueSchema = z39.union([z39.number(), z39.array(z39.number()), z39.object({ lower: z39.number(), upper: z39.number() })]).nullable().optional();
|
|
5939
|
+
var DatepickerValueSchema = z39.union([z39.string(), z39.array(z39.string())]).nullable().optional();
|
|
5940
|
+
|
|
5941
|
+
// internal/dynamic-forms-validation/material/src/fields/mat-slider-field.schema.ts
|
|
5903
5942
|
var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5904
5943
|
/**
|
|
5905
5944
|
* Field type discriminant.
|
|
5906
5945
|
*/
|
|
5907
|
-
type:
|
|
5908
|
-
nullable:
|
|
5946
|
+
type: z40.literal("slider"),
|
|
5947
|
+
nullable: z40.boolean().optional(),
|
|
5909
5948
|
/**
|
|
5910
5949
|
* Initial slider value.
|
|
5911
5950
|
*/
|
|
5912
|
-
value:
|
|
5951
|
+
value: SliderValueSchema,
|
|
5913
5952
|
/**
|
|
5914
5953
|
* Minimum slider value.
|
|
5915
5954
|
*/
|
|
5916
|
-
minValue:
|
|
5955
|
+
minValue: z40.number().optional(),
|
|
5917
5956
|
/**
|
|
5918
5957
|
* Maximum slider value.
|
|
5919
5958
|
*/
|
|
5920
|
-
maxValue:
|
|
5959
|
+
maxValue: z40.number().optional(),
|
|
5921
5960
|
/**
|
|
5922
5961
|
* Step increment.
|
|
5923
5962
|
*/
|
|
5924
|
-
step:
|
|
5963
|
+
step: z40.number().positive().optional(),
|
|
5925
5964
|
/**
|
|
5926
5965
|
* Placeholder/helper text.
|
|
5927
5966
|
*/
|
|
@@ -5934,18 +5973,18 @@ var MatSliderFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSch
|
|
|
5934
5973
|
var MatSliderFieldSchema = MatSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5935
5974
|
|
|
5936
5975
|
// internal/dynamic-forms-validation/material/src/fields/mat-datepicker-field.schema.ts
|
|
5937
|
-
import { z as
|
|
5938
|
-
var DateValueSchema =
|
|
5976
|
+
import { z as z41 } from "zod";
|
|
5977
|
+
var DateValueSchema = z41.union([z41.string(), z41.null()]);
|
|
5939
5978
|
var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidationSchema).extend({
|
|
5940
5979
|
/**
|
|
5941
5980
|
* Field type discriminant.
|
|
5942
5981
|
*/
|
|
5943
|
-
type:
|
|
5944
|
-
nullable:
|
|
5982
|
+
type: z41.literal("datepicker"),
|
|
5983
|
+
nullable: z41.boolean().optional(),
|
|
5945
5984
|
/**
|
|
5946
5985
|
* Initial date value (ISO string in JSON configs).
|
|
5947
5986
|
*/
|
|
5948
|
-
value:
|
|
5987
|
+
value: DatepickerValueSchema,
|
|
5949
5988
|
/**
|
|
5950
5989
|
* Minimum selectable date.
|
|
5951
5990
|
*/
|
|
@@ -5970,29 +6009,29 @@ var MatDatepickerFieldSchemaObject = BaseFieldDefSchema.merge(FieldWithValidatio
|
|
|
5970
6009
|
var MatDatepickerFieldSchema = MatDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
5971
6010
|
|
|
5972
6011
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
5973
|
-
import { z as
|
|
6012
|
+
import { z as z43 } from "zod";
|
|
5974
6013
|
|
|
5975
6014
|
// internal/dynamic-forms-validation/src/lib/schemas/field/array-item-template.schema.ts
|
|
5976
|
-
import { z as
|
|
5977
|
-
var FieldLikeSchema =
|
|
5978
|
-
var ArrayItemTemplateSchema =
|
|
6015
|
+
import { z as z42 } from "zod";
|
|
6016
|
+
var FieldLikeSchema = z42.object({ type: z42.string() }).passthrough();
|
|
6017
|
+
var ArrayItemTemplateSchema = z42.union([FieldLikeSchema, z42.array(FieldLikeSchema)]);
|
|
5979
6018
|
|
|
5980
6019
|
// internal/dynamic-forms-validation/material/src/fields/mat-button-field.schema.ts
|
|
5981
|
-
var EventArgSchema =
|
|
6020
|
+
var EventArgSchema = z43.union([z43.string(), z43.number(), z43.boolean(), z43.null(), z43.undefined()]);
|
|
5982
6021
|
var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
5983
6022
|
/**
|
|
5984
6023
|
* Field type discriminant.
|
|
5985
6024
|
*/
|
|
5986
|
-
type:
|
|
6025
|
+
type: z43.literal("button"),
|
|
5987
6026
|
/**
|
|
5988
6027
|
* Event type name (string reference to registered event).
|
|
5989
6028
|
* Note: Full event configuration requires runtime setup.
|
|
5990
6029
|
*/
|
|
5991
|
-
event:
|
|
6030
|
+
event: z43.string().optional(),
|
|
5992
6031
|
/**
|
|
5993
6032
|
* Arguments passed to the event constructor.
|
|
5994
6033
|
*/
|
|
5995
|
-
eventArgs:
|
|
6034
|
+
eventArgs: z43.array(EventArgSchema).optional(),
|
|
5996
6035
|
/**
|
|
5997
6036
|
* Material-specific button properties.
|
|
5998
6037
|
*/
|
|
@@ -6003,17 +6042,17 @@ var MatButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6003
6042
|
logic: LogicArraySchema.optional()
|
|
6004
6043
|
});
|
|
6005
6044
|
var MatSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6006
|
-
type:
|
|
6045
|
+
type: z43.literal("submit"),
|
|
6007
6046
|
props: MatButtonPropsSchema.optional(),
|
|
6008
6047
|
logic: LogicArraySchema.optional()
|
|
6009
6048
|
});
|
|
6010
6049
|
var MatNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6011
|
-
type:
|
|
6050
|
+
type: z43.literal("next"),
|
|
6012
6051
|
props: MatButtonPropsSchema.optional(),
|
|
6013
6052
|
logic: LogicArraySchema.optional()
|
|
6014
6053
|
});
|
|
6015
6054
|
var MatPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6016
|
-
type:
|
|
6055
|
+
type: z43.literal("previous"),
|
|
6017
6056
|
props: MatButtonPropsSchema.optional()
|
|
6018
6057
|
});
|
|
6019
6058
|
var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6022,21 +6061,21 @@ var MatAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6022
6061
|
* item, or a list of them for an object item.
|
|
6023
6062
|
*/
|
|
6024
6063
|
template: ArrayItemTemplateSchema,
|
|
6025
|
-
type:
|
|
6064
|
+
type: z43.literal("add-array-item"),
|
|
6026
6065
|
/**
|
|
6027
6066
|
* Key of the array field to add items to.
|
|
6028
6067
|
* If omitted, uses the parent array context.
|
|
6029
6068
|
*/
|
|
6030
|
-
arrayKey:
|
|
6069
|
+
arrayKey: z43.string().optional(),
|
|
6031
6070
|
props: MatButtonPropsSchema.optional()
|
|
6032
6071
|
});
|
|
6033
6072
|
var MatRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6034
|
-
type:
|
|
6073
|
+
type: z43.literal("remove-array-item"),
|
|
6035
6074
|
/**
|
|
6036
6075
|
* Key of the array field to remove items from.
|
|
6037
6076
|
* If omitted, uses the parent array context.
|
|
6038
6077
|
*/
|
|
6039
|
-
arrayKey:
|
|
6078
|
+
arrayKey: z43.string().optional(),
|
|
6040
6079
|
props: MatButtonPropsSchema.optional()
|
|
6041
6080
|
});
|
|
6042
6081
|
var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6045,12 +6084,12 @@ var MatPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6045
6084
|
* item, or a list of them for an object item.
|
|
6046
6085
|
*/
|
|
6047
6086
|
template: ArrayItemTemplateSchema,
|
|
6048
|
-
type:
|
|
6087
|
+
type: z43.literal("prepend-array-item"),
|
|
6049
6088
|
/**
|
|
6050
6089
|
* Key of the array field to prepend items to.
|
|
6051
6090
|
* If omitted, uses the parent array context.
|
|
6052
6091
|
*/
|
|
6053
|
-
arrayKey:
|
|
6092
|
+
arrayKey: z43.string().optional(),
|
|
6054
6093
|
props: MatButtonPropsSchema.optional()
|
|
6055
6094
|
});
|
|
6056
6095
|
var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6059,38 +6098,38 @@ var MatInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6059
6098
|
* item, or a list of them for an object item.
|
|
6060
6099
|
*/
|
|
6061
6100
|
template: ArrayItemTemplateSchema,
|
|
6062
|
-
type:
|
|
6101
|
+
type: z43.literal("insert-array-item"),
|
|
6063
6102
|
/**
|
|
6064
6103
|
* Key of the array field to insert items into.
|
|
6065
6104
|
* If omitted, uses the parent array context.
|
|
6066
6105
|
*/
|
|
6067
|
-
arrayKey:
|
|
6106
|
+
arrayKey: z43.string().optional(),
|
|
6068
6107
|
/**
|
|
6069
6108
|
* Index at which to insert the new item.
|
|
6070
6109
|
*/
|
|
6071
|
-
index:
|
|
6110
|
+
index: z43.number(),
|
|
6072
6111
|
props: MatButtonPropsSchema.optional()
|
|
6073
6112
|
});
|
|
6074
6113
|
var MatPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6075
|
-
type:
|
|
6114
|
+
type: z43.literal("pop-array-item"),
|
|
6076
6115
|
/**
|
|
6077
6116
|
* Key of the array field to pop items from.
|
|
6078
6117
|
*/
|
|
6079
|
-
arrayKey:
|
|
6118
|
+
arrayKey: z43.string(),
|
|
6080
6119
|
props: MatButtonPropsSchema.optional()
|
|
6081
6120
|
});
|
|
6082
6121
|
var MatShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6083
|
-
type:
|
|
6122
|
+
type: z43.literal("shift-array-item"),
|
|
6084
6123
|
/**
|
|
6085
6124
|
* Key of the array field to shift items from.
|
|
6086
6125
|
*/
|
|
6087
|
-
arrayKey:
|
|
6126
|
+
arrayKey: z43.string(),
|
|
6088
6127
|
props: MatButtonPropsSchema.optional()
|
|
6089
6128
|
});
|
|
6090
6129
|
|
|
6091
6130
|
// internal/dynamic-forms-validation/material/src/mat-leaf-field.schema.ts
|
|
6092
|
-
import { z as
|
|
6093
|
-
var MatLeafFieldSchema =
|
|
6131
|
+
import { z as z44 } from "zod";
|
|
6132
|
+
var MatLeafFieldSchema = z44.discriminatedUnion("type", [
|
|
6094
6133
|
// Default fields
|
|
6095
6134
|
TextFieldSchema,
|
|
6096
6135
|
HiddenFieldSchema,
|
|
@@ -6115,7 +6154,7 @@ var MatLeafFieldSchema = z42.discriminatedUnion("type", [
|
|
|
6115
6154
|
MatInsertArrayItemButtonFieldSchema,
|
|
6116
6155
|
MatPopArrayItemButtonFieldSchema,
|
|
6117
6156
|
MatShiftArrayItemButtonFieldSchema
|
|
6118
|
-
]).superRefine(nullableValueRefine);
|
|
6157
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6119
6158
|
|
|
6120
6159
|
// internal/dynamic-forms-validation/material/src/mat-field.schema.ts
|
|
6121
6160
|
var containerSchemas = createContainerSchemas({
|
|
@@ -6128,8 +6167,8 @@ var MatArrayFieldSchema = containerSchemas.ArrayFieldSchema;
|
|
|
6128
6167
|
var MatFieldSchema = containerSchemas.AllFieldsSchema;
|
|
6129
6168
|
|
|
6130
6169
|
// internal/dynamic-forms-validation/material/src/mat-form-config.schema.ts
|
|
6131
|
-
import { z as
|
|
6132
|
-
var MatFormDefaultPropsSchema =
|
|
6170
|
+
import { z as z45 } from "zod";
|
|
6171
|
+
var MatFormDefaultPropsSchema = z45.object({
|
|
6133
6172
|
/**
|
|
6134
6173
|
* Default form field appearance for all fields.
|
|
6135
6174
|
*/
|
|
@@ -6146,15 +6185,15 @@ var MatFormDefaultPropsSchema = z43.object({
|
|
|
6146
6185
|
var MatFormConfigSchema = createFormConfigSchema(MatFieldSchema, MatFormDefaultPropsSchema);
|
|
6147
6186
|
|
|
6148
6187
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6149
|
-
import { z as
|
|
6188
|
+
import { z as z47 } from "zod";
|
|
6150
6189
|
|
|
6151
6190
|
// internal/dynamic-forms-validation/bootstrap/src/props/bs-common-props.schema.ts
|
|
6152
|
-
import { z as
|
|
6153
|
-
var BsSizeSchema =
|
|
6154
|
-
var BsButtonVariantSchema =
|
|
6155
|
-
var BsFormFieldPropsSchema =
|
|
6191
|
+
import { z as z46 } from "zod";
|
|
6192
|
+
var BsSizeSchema = z46.enum(["sm", "lg"]);
|
|
6193
|
+
var BsButtonVariantSchema = z46.enum(["primary", "secondary", "success", "danger", "warning", "info", "light", "dark", "link"]);
|
|
6194
|
+
var BsFormFieldPropsSchema = z46.object({
|
|
6156
6195
|
size: BsSizeSchema.optional(),
|
|
6157
|
-
floatingLabel:
|
|
6196
|
+
floatingLabel: z46.boolean().optional(),
|
|
6158
6197
|
hint: DynamicTextSchema.optional(),
|
|
6159
6198
|
validFeedback: DynamicTextSchema.optional(),
|
|
6160
6199
|
invalidFeedback: DynamicTextSchema.optional()
|
|
@@ -6162,94 +6201,94 @@ var BsFormFieldPropsSchema = z44.object({
|
|
|
6162
6201
|
|
|
6163
6202
|
// internal/dynamic-forms-validation/bootstrap/src/props/index.ts
|
|
6164
6203
|
var BsInputPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6165
|
-
type:
|
|
6204
|
+
type: z47.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6166
6205
|
placeholder: DynamicTextSchema.optional(),
|
|
6167
|
-
plaintext:
|
|
6206
|
+
plaintext: z47.boolean().optional()
|
|
6168
6207
|
});
|
|
6169
6208
|
var BsTextareaPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6170
|
-
rows:
|
|
6209
|
+
rows: z47.number().positive().optional(),
|
|
6171
6210
|
placeholder: DynamicTextSchema.optional()
|
|
6172
6211
|
});
|
|
6173
6212
|
var BsSelectPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6174
|
-
multiple:
|
|
6175
|
-
htmlSize:
|
|
6213
|
+
multiple: z47.boolean().optional(),
|
|
6214
|
+
htmlSize: z47.number().positive().optional(),
|
|
6176
6215
|
placeholder: DynamicTextSchema.optional()
|
|
6177
6216
|
});
|
|
6178
|
-
var BsCheckboxPropsSchema =
|
|
6179
|
-
switch:
|
|
6180
|
-
inline:
|
|
6181
|
-
reverse:
|
|
6182
|
-
indeterminate:
|
|
6217
|
+
var BsCheckboxPropsSchema = z47.object({
|
|
6218
|
+
switch: z47.boolean().optional(),
|
|
6219
|
+
inline: z47.boolean().optional(),
|
|
6220
|
+
reverse: z47.boolean().optional(),
|
|
6221
|
+
indeterminate: z47.boolean().optional(),
|
|
6183
6222
|
hint: DynamicTextSchema.optional()
|
|
6184
6223
|
});
|
|
6185
|
-
var BsRadioPropsSchema =
|
|
6186
|
-
inline:
|
|
6187
|
-
reverse:
|
|
6188
|
-
buttonGroup:
|
|
6224
|
+
var BsRadioPropsSchema = z47.object({
|
|
6225
|
+
inline: z47.boolean().optional(),
|
|
6226
|
+
reverse: z47.boolean().optional(),
|
|
6227
|
+
buttonGroup: z47.boolean().optional(),
|
|
6189
6228
|
buttonSize: BsSizeSchema.optional(),
|
|
6190
6229
|
hint: DynamicTextSchema.optional()
|
|
6191
6230
|
});
|
|
6192
|
-
var BsMultiCheckboxPropsSchema =
|
|
6193
|
-
switch:
|
|
6194
|
-
inline:
|
|
6195
|
-
reverse:
|
|
6231
|
+
var BsMultiCheckboxPropsSchema = z47.object({
|
|
6232
|
+
switch: z47.boolean().optional(),
|
|
6233
|
+
inline: z47.boolean().optional(),
|
|
6234
|
+
reverse: z47.boolean().optional(),
|
|
6196
6235
|
hint: DynamicTextSchema.optional()
|
|
6197
6236
|
});
|
|
6198
|
-
var BsTogglePropsSchema =
|
|
6237
|
+
var BsTogglePropsSchema = z47.object({
|
|
6199
6238
|
size: BsSizeSchema.optional(),
|
|
6200
|
-
reverse:
|
|
6201
|
-
inline:
|
|
6239
|
+
reverse: z47.boolean().optional(),
|
|
6240
|
+
inline: z47.boolean().optional(),
|
|
6202
6241
|
hint: DynamicTextSchema.optional()
|
|
6203
6242
|
});
|
|
6204
6243
|
var BsDatepickerPropsSchema = BsFormFieldPropsSchema.extend({
|
|
6205
|
-
useNgBootstrap:
|
|
6206
|
-
displayMonths:
|
|
6207
|
-
navigation:
|
|
6208
|
-
outsideDays:
|
|
6209
|
-
showWeekNumbers:
|
|
6244
|
+
useNgBootstrap: z47.boolean().optional(),
|
|
6245
|
+
displayMonths: z47.number().positive().optional(),
|
|
6246
|
+
navigation: z47.enum(["select", "arrows", "none"]).optional(),
|
|
6247
|
+
outsideDays: z47.enum(["visible", "collapsed", "hidden"]).optional(),
|
|
6248
|
+
showWeekNumbers: z47.boolean().optional(),
|
|
6210
6249
|
placeholder: DynamicTextSchema.optional()
|
|
6211
6250
|
});
|
|
6212
|
-
var BsSliderPropsSchema =
|
|
6213
|
-
showValue:
|
|
6214
|
-
valuePrefix:
|
|
6215
|
-
valueSuffix:
|
|
6251
|
+
var BsSliderPropsSchema = z47.object({
|
|
6252
|
+
showValue: z47.boolean().optional(),
|
|
6253
|
+
valuePrefix: z47.string().optional(),
|
|
6254
|
+
valueSuffix: z47.string().optional(),
|
|
6216
6255
|
hint: DynamicTextSchema.optional(),
|
|
6217
|
-
min:
|
|
6218
|
-
max:
|
|
6219
|
-
step:
|
|
6256
|
+
min: z47.number().optional(),
|
|
6257
|
+
max: z47.number().optional(),
|
|
6258
|
+
step: z47.number().positive().optional()
|
|
6220
6259
|
});
|
|
6221
|
-
var BsButtonPropsSchema =
|
|
6260
|
+
var BsButtonPropsSchema = z47.object({
|
|
6222
6261
|
variant: BsButtonVariantSchema.optional(),
|
|
6223
|
-
outline:
|
|
6262
|
+
outline: z47.boolean().optional(),
|
|
6224
6263
|
size: BsSizeSchema.optional(),
|
|
6225
|
-
block:
|
|
6226
|
-
active:
|
|
6227
|
-
type:
|
|
6264
|
+
block: z47.boolean().optional(),
|
|
6265
|
+
active: z47.boolean().optional(),
|
|
6266
|
+
type: z47.enum(["button", "submit", "reset"]).optional()
|
|
6228
6267
|
});
|
|
6229
6268
|
|
|
6230
6269
|
// internal/dynamic-forms-validation/bootstrap/src/fields/index.ts
|
|
6231
|
-
import { z as
|
|
6270
|
+
import { z as z48 } from "zod";
|
|
6232
6271
|
var BsValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6233
6272
|
var BsInputFieldSchemaObject = BsValueFieldBase.extend({
|
|
6234
|
-
type:
|
|
6235
|
-
nullable:
|
|
6236
|
-
value:
|
|
6273
|
+
type: z48.literal("input"),
|
|
6274
|
+
nullable: z48.boolean().optional(),
|
|
6275
|
+
value: InputValueSchema,
|
|
6237
6276
|
placeholder: DynamicTextSchema.optional(),
|
|
6238
6277
|
props: BsInputPropsSchema.optional()
|
|
6239
6278
|
});
|
|
6240
|
-
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6279
|
+
var BsInputFieldSchema = BsInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6241
6280
|
var BsTextareaFieldSchemaObject = BsValueFieldBase.extend({
|
|
6242
|
-
type:
|
|
6243
|
-
nullable:
|
|
6244
|
-
value:
|
|
6281
|
+
type: z48.literal("textarea"),
|
|
6282
|
+
nullable: z48.boolean().optional(),
|
|
6283
|
+
value: z48.string().nullable().optional(),
|
|
6245
6284
|
placeholder: DynamicTextSchema.optional(),
|
|
6246
6285
|
props: BsTextareaPropsSchema.optional()
|
|
6247
6286
|
});
|
|
6248
6287
|
var BsTextareaFieldSchema = BsTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6249
6288
|
var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
6250
|
-
type:
|
|
6251
|
-
nullable:
|
|
6252
|
-
value:
|
|
6289
|
+
type: z48.literal("select"),
|
|
6290
|
+
nullable: z48.boolean().optional(),
|
|
6291
|
+
value: z48.string().nullable().optional(),
|
|
6253
6292
|
// Bootstrap select only supports strings
|
|
6254
6293
|
placeholder: DynamicTextSchema.optional(),
|
|
6255
6294
|
options: FieldOptionsSchema,
|
|
@@ -6257,76 +6296,76 @@ var BsSelectFieldSchemaObject = BsValueFieldBase.extend({
|
|
|
6257
6296
|
});
|
|
6258
6297
|
var BsSelectFieldSchema = BsSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6259
6298
|
var BsCheckboxFieldSchema = BsValueFieldBase.extend({
|
|
6260
|
-
type:
|
|
6261
|
-
value:
|
|
6299
|
+
type: z48.literal("checkbox"),
|
|
6300
|
+
value: z48.boolean().optional(),
|
|
6262
6301
|
placeholder: DynamicTextSchema.optional(),
|
|
6263
6302
|
props: BsCheckboxPropsSchema.optional()
|
|
6264
6303
|
});
|
|
6265
6304
|
var BsRadioFieldSchemaObject = BsValueFieldBase.extend({
|
|
6266
|
-
type:
|
|
6267
|
-
nullable:
|
|
6268
|
-
value:
|
|
6305
|
+
type: z48.literal("radio"),
|
|
6306
|
+
nullable: z48.boolean().optional(),
|
|
6307
|
+
value: z48.unknown().nullable().optional(),
|
|
6269
6308
|
placeholder: DynamicTextSchema.optional(),
|
|
6270
6309
|
options: FieldOptionsSchema,
|
|
6271
6310
|
props: BsRadioPropsSchema.optional()
|
|
6272
6311
|
});
|
|
6273
6312
|
var BsRadioFieldSchema = BsRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6274
6313
|
var BsMultiCheckboxFieldSchemaObject = BsValueFieldBase.extend({
|
|
6275
|
-
type:
|
|
6276
|
-
nullable:
|
|
6277
|
-
value:
|
|
6314
|
+
type: z48.literal("multi-checkbox"),
|
|
6315
|
+
nullable: z48.boolean().optional(),
|
|
6316
|
+
value: z48.array(z48.unknown()).nullable().optional(),
|
|
6278
6317
|
placeholder: DynamicTextSchema.optional(),
|
|
6279
6318
|
options: FieldOptionsSchema,
|
|
6280
6319
|
props: BsMultiCheckboxPropsSchema.optional()
|
|
6281
6320
|
});
|
|
6282
6321
|
var BsMultiCheckboxFieldSchema = BsMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6283
6322
|
var BsToggleFieldSchema = BsValueFieldBase.extend({
|
|
6284
|
-
type:
|
|
6285
|
-
value:
|
|
6323
|
+
type: z48.literal("toggle"),
|
|
6324
|
+
value: z48.boolean().optional(),
|
|
6286
6325
|
placeholder: DynamicTextSchema.optional(),
|
|
6287
6326
|
props: BsTogglePropsSchema.optional()
|
|
6288
6327
|
});
|
|
6289
6328
|
var BsDatepickerFieldSchemaObject = BsValueFieldBase.extend({
|
|
6290
|
-
type:
|
|
6291
|
-
nullable:
|
|
6292
|
-
value:
|
|
6293
|
-
minDate:
|
|
6294
|
-
maxDate:
|
|
6295
|
-
startAt:
|
|
6329
|
+
type: z48.literal("datepicker"),
|
|
6330
|
+
nullable: z48.boolean().optional(),
|
|
6331
|
+
value: DatepickerValueSchema,
|
|
6332
|
+
minDate: z48.union([z48.string(), z48.null()]).optional(),
|
|
6333
|
+
maxDate: z48.union([z48.string(), z48.null()]).optional(),
|
|
6334
|
+
startAt: z48.union([z48.string(), z48.null()]).optional(),
|
|
6296
6335
|
placeholder: DynamicTextSchema.optional(),
|
|
6297
6336
|
props: BsDatepickerPropsSchema.optional()
|
|
6298
6337
|
});
|
|
6299
6338
|
var BsDatepickerFieldSchema = BsDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6300
6339
|
var BsSliderFieldSchemaObject = BsValueFieldBase.extend({
|
|
6301
|
-
type:
|
|
6302
|
-
nullable:
|
|
6303
|
-
value:
|
|
6304
|
-
minValue:
|
|
6305
|
-
maxValue:
|
|
6306
|
-
step:
|
|
6340
|
+
type: z48.literal("slider"),
|
|
6341
|
+
nullable: z48.boolean().optional(),
|
|
6342
|
+
value: SliderValueSchema,
|
|
6343
|
+
minValue: z48.number().optional(),
|
|
6344
|
+
maxValue: z48.number().optional(),
|
|
6345
|
+
step: z48.number().positive().optional(),
|
|
6307
6346
|
placeholder: DynamicTextSchema.optional(),
|
|
6308
6347
|
props: BsSliderPropsSchema.optional()
|
|
6309
6348
|
});
|
|
6310
6349
|
var BsSliderFieldSchema = BsSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6311
6350
|
var BsButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6312
|
-
type:
|
|
6313
|
-
event:
|
|
6314
|
-
eventArgs:
|
|
6351
|
+
type: z48.literal("button"),
|
|
6352
|
+
event: z48.string().optional(),
|
|
6353
|
+
eventArgs: z48.array(z48.union([z48.string(), z48.number(), z48.boolean(), z48.null(), z48.undefined()])).optional(),
|
|
6315
6354
|
props: BsButtonPropsSchema.optional(),
|
|
6316
6355
|
logic: LogicArraySchema.optional()
|
|
6317
6356
|
});
|
|
6318
6357
|
var BsSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6319
|
-
type:
|
|
6358
|
+
type: z48.literal("submit"),
|
|
6320
6359
|
props: BsButtonPropsSchema.optional(),
|
|
6321
6360
|
logic: LogicArraySchema.optional()
|
|
6322
6361
|
});
|
|
6323
6362
|
var BsNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6324
|
-
type:
|
|
6363
|
+
type: z48.literal("next"),
|
|
6325
6364
|
props: BsButtonPropsSchema.optional(),
|
|
6326
6365
|
logic: LogicArraySchema.optional()
|
|
6327
6366
|
});
|
|
6328
6367
|
var BsPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6329
|
-
type:
|
|
6368
|
+
type: z48.literal("previous"),
|
|
6330
6369
|
props: BsButtonPropsSchema.optional()
|
|
6331
6370
|
});
|
|
6332
6371
|
var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6335,13 +6374,13 @@ var BsAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6335
6374
|
* item, or a list of them for an object item.
|
|
6336
6375
|
*/
|
|
6337
6376
|
template: ArrayItemTemplateSchema,
|
|
6338
|
-
type:
|
|
6339
|
-
arrayKey:
|
|
6377
|
+
type: z48.literal("add-array-item"),
|
|
6378
|
+
arrayKey: z48.string().optional(),
|
|
6340
6379
|
props: BsButtonPropsSchema.optional()
|
|
6341
6380
|
});
|
|
6342
6381
|
var BsRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6343
|
-
type:
|
|
6344
|
-
arrayKey:
|
|
6382
|
+
type: z48.literal("remove-array-item"),
|
|
6383
|
+
arrayKey: z48.string().optional(),
|
|
6345
6384
|
props: BsButtonPropsSchema.optional()
|
|
6346
6385
|
});
|
|
6347
6386
|
var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6350,8 +6389,8 @@ var BsPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6350
6389
|
* item, or a list of them for an object item.
|
|
6351
6390
|
*/
|
|
6352
6391
|
template: ArrayItemTemplateSchema,
|
|
6353
|
-
type:
|
|
6354
|
-
arrayKey:
|
|
6392
|
+
type: z48.literal("prepend-array-item"),
|
|
6393
|
+
arrayKey: z48.string().optional(),
|
|
6355
6394
|
props: BsButtonPropsSchema.optional()
|
|
6356
6395
|
});
|
|
6357
6396
|
var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6360,25 +6399,25 @@ var BsInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6360
6399
|
* item, or a list of them for an object item.
|
|
6361
6400
|
*/
|
|
6362
6401
|
template: ArrayItemTemplateSchema,
|
|
6363
|
-
type:
|
|
6364
|
-
arrayKey:
|
|
6365
|
-
index:
|
|
6402
|
+
type: z48.literal("insert-array-item"),
|
|
6403
|
+
arrayKey: z48.string().optional(),
|
|
6404
|
+
index: z48.number(),
|
|
6366
6405
|
props: BsButtonPropsSchema.optional()
|
|
6367
6406
|
});
|
|
6368
6407
|
var BsPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6369
|
-
type:
|
|
6370
|
-
arrayKey:
|
|
6408
|
+
type: z48.literal("pop-array-item"),
|
|
6409
|
+
arrayKey: z48.string(),
|
|
6371
6410
|
props: BsButtonPropsSchema.optional()
|
|
6372
6411
|
});
|
|
6373
6412
|
var BsShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6374
|
-
type:
|
|
6375
|
-
arrayKey:
|
|
6413
|
+
type: z48.literal("shift-array-item"),
|
|
6414
|
+
arrayKey: z48.string(),
|
|
6376
6415
|
props: BsButtonPropsSchema.optional()
|
|
6377
6416
|
});
|
|
6378
6417
|
|
|
6379
6418
|
// internal/dynamic-forms-validation/bootstrap/src/bs-leaf-field.schema.ts
|
|
6380
|
-
import { z as
|
|
6381
|
-
var BsLeafFieldSchema =
|
|
6419
|
+
import { z as z49 } from "zod";
|
|
6420
|
+
var BsLeafFieldSchema = z49.discriminatedUnion("type", [
|
|
6382
6421
|
TextFieldSchema,
|
|
6383
6422
|
HiddenFieldSchema,
|
|
6384
6423
|
BsInputFieldSchemaObject,
|
|
@@ -6400,10 +6439,10 @@ var BsLeafFieldSchema = z47.discriminatedUnion("type", [
|
|
|
6400
6439
|
BsInsertArrayItemButtonFieldSchema,
|
|
6401
6440
|
BsPopArrayItemButtonFieldSchema,
|
|
6402
6441
|
BsShiftArrayItemButtonFieldSchema
|
|
6403
|
-
]).superRefine(nullableValueRefine);
|
|
6442
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6404
6443
|
|
|
6405
6444
|
// internal/dynamic-forms-validation/bootstrap/src/bs-form-config.schema.ts
|
|
6406
|
-
import { z as
|
|
6445
|
+
import { z as z50 } from "zod";
|
|
6407
6446
|
var containerSchemas2 = createContainerSchemas({
|
|
6408
6447
|
leafFieldSchema: BsLeafFieldSchema
|
|
6409
6448
|
});
|
|
@@ -6412,173 +6451,173 @@ var BsRowFieldSchema = containerSchemas2.RowFieldSchema;
|
|
|
6412
6451
|
var BsGroupFieldSchema = containerSchemas2.GroupFieldSchema;
|
|
6413
6452
|
var BsArrayFieldSchema = containerSchemas2.ArrayFieldSchema;
|
|
6414
6453
|
var BsFieldSchema = containerSchemas2.AllFieldsSchema;
|
|
6415
|
-
var BsFormDefaultPropsSchema =
|
|
6454
|
+
var BsFormDefaultPropsSchema = z50.object({
|
|
6416
6455
|
size: BsSizeSchema.optional(),
|
|
6417
|
-
floatingLabel:
|
|
6456
|
+
floatingLabel: z50.boolean().optional()
|
|
6418
6457
|
});
|
|
6419
6458
|
var BsFormConfigSchema = createFormConfigSchema(BsFieldSchema, BsFormDefaultPropsSchema);
|
|
6420
6459
|
|
|
6421
6460
|
// internal/dynamic-forms-validation/primeng/src/props/index.ts
|
|
6422
|
-
import { z as
|
|
6423
|
-
var PrimeSeveritySchema =
|
|
6424
|
-
var PrimeCommonPropsSchema =
|
|
6425
|
-
styleClass:
|
|
6461
|
+
import { z as z51 } from "zod";
|
|
6462
|
+
var PrimeSeveritySchema = z51.enum(["primary", "secondary", "success", "info", "warn", "danger", "help", "contrast"]);
|
|
6463
|
+
var PrimeCommonPropsSchema = z51.object({
|
|
6464
|
+
styleClass: z51.string().optional(),
|
|
6426
6465
|
hint: DynamicTextSchema.optional()
|
|
6427
6466
|
});
|
|
6428
6467
|
var PrimeInputPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6429
|
-
type:
|
|
6468
|
+
type: z51.enum(["text", "email", "password", "number", "tel", "url"]).optional(),
|
|
6430
6469
|
placeholder: DynamicTextSchema.optional(),
|
|
6431
|
-
size:
|
|
6432
|
-
variant:
|
|
6470
|
+
size: z51.enum(["small", "large"]).optional(),
|
|
6471
|
+
variant: z51.enum(["outlined", "filled"]).optional()
|
|
6433
6472
|
});
|
|
6434
6473
|
var PrimeCheckboxPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6435
|
-
binary:
|
|
6436
|
-
trueValue:
|
|
6437
|
-
falseValue:
|
|
6474
|
+
binary: z51.boolean().optional(),
|
|
6475
|
+
trueValue: z51.unknown().optional(),
|
|
6476
|
+
falseValue: z51.unknown().optional()
|
|
6438
6477
|
});
|
|
6439
6478
|
var PrimeRadioPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6440
|
-
name:
|
|
6479
|
+
name: z51.string().optional()
|
|
6441
6480
|
});
|
|
6442
6481
|
var PrimeSelectPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6443
|
-
multiple:
|
|
6444
|
-
filter:
|
|
6482
|
+
multiple: z51.boolean().optional(),
|
|
6483
|
+
filter: z51.boolean().optional(),
|
|
6445
6484
|
placeholder: DynamicTextSchema.optional(),
|
|
6446
|
-
showClear:
|
|
6485
|
+
showClear: z51.boolean().optional()
|
|
6447
6486
|
});
|
|
6448
6487
|
var PrimeMultiCheckboxPropsSchema = PrimeCommonPropsSchema;
|
|
6449
6488
|
var PrimeDatepickerPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6450
|
-
dateFormat:
|
|
6451
|
-
inline:
|
|
6452
|
-
showIcon:
|
|
6453
|
-
showButtonBar:
|
|
6454
|
-
selectionMode:
|
|
6455
|
-
touchUI:
|
|
6456
|
-
view:
|
|
6489
|
+
dateFormat: z51.string().optional(),
|
|
6490
|
+
inline: z51.boolean().optional(),
|
|
6491
|
+
showIcon: z51.boolean().optional(),
|
|
6492
|
+
showButtonBar: z51.boolean().optional(),
|
|
6493
|
+
selectionMode: z51.enum(["single", "multiple", "range"]).optional(),
|
|
6494
|
+
touchUI: z51.boolean().optional(),
|
|
6495
|
+
view: z51.enum(["date", "month", "year"]).optional(),
|
|
6457
6496
|
placeholder: DynamicTextSchema.optional()
|
|
6458
6497
|
});
|
|
6459
6498
|
var PrimeTextareaPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6460
|
-
rows:
|
|
6461
|
-
autoResize:
|
|
6499
|
+
rows: z51.number().positive().optional(),
|
|
6500
|
+
autoResize: z51.boolean().optional(),
|
|
6462
6501
|
placeholder: DynamicTextSchema.optional()
|
|
6463
6502
|
});
|
|
6464
6503
|
var PrimeSliderPropsSchema = PrimeCommonPropsSchema.extend({
|
|
6465
|
-
min:
|
|
6466
|
-
max:
|
|
6467
|
-
step:
|
|
6468
|
-
range:
|
|
6469
|
-
orientation:
|
|
6504
|
+
min: z51.number().optional(),
|
|
6505
|
+
max: z51.number().optional(),
|
|
6506
|
+
step: z51.number().positive().optional(),
|
|
6507
|
+
range: z51.boolean().optional(),
|
|
6508
|
+
orientation: z51.enum(["horizontal", "vertical"]).optional()
|
|
6470
6509
|
});
|
|
6471
6510
|
var PrimeTogglePropsSchema = PrimeCommonPropsSchema;
|
|
6472
|
-
var PrimeButtonPropsSchema =
|
|
6511
|
+
var PrimeButtonPropsSchema = z51.object({
|
|
6473
6512
|
severity: PrimeSeveritySchema.optional(),
|
|
6474
|
-
text:
|
|
6475
|
-
outlined:
|
|
6476
|
-
raised:
|
|
6477
|
-
rounded:
|
|
6478
|
-
icon:
|
|
6479
|
-
iconPos:
|
|
6480
|
-
type:
|
|
6513
|
+
text: z51.boolean().optional(),
|
|
6514
|
+
outlined: z51.boolean().optional(),
|
|
6515
|
+
raised: z51.boolean().optional(),
|
|
6516
|
+
rounded: z51.boolean().optional(),
|
|
6517
|
+
icon: z51.string().optional(),
|
|
6518
|
+
iconPos: z51.enum(["left", "right", "top", "bottom"]).optional(),
|
|
6519
|
+
type: z51.enum(["button", "submit", "reset"]).optional()
|
|
6481
6520
|
});
|
|
6482
6521
|
|
|
6483
6522
|
// internal/dynamic-forms-validation/primeng/src/fields/index.ts
|
|
6484
|
-
import { z as
|
|
6523
|
+
import { z as z52 } from "zod";
|
|
6485
6524
|
var PrimeValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6486
6525
|
var PrimeInputFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6487
|
-
type:
|
|
6488
|
-
nullable:
|
|
6489
|
-
value:
|
|
6526
|
+
type: z52.literal("input"),
|
|
6527
|
+
nullable: z52.boolean().optional(),
|
|
6528
|
+
value: InputValueSchema,
|
|
6490
6529
|
placeholder: DynamicTextSchema.optional(),
|
|
6491
6530
|
props: PrimeInputPropsSchema.optional()
|
|
6492
6531
|
});
|
|
6493
|
-
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6532
|
+
var PrimeInputFieldSchema = PrimeInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6494
6533
|
var PrimeCheckboxFieldSchema = PrimeValueFieldBase.extend({
|
|
6495
|
-
type:
|
|
6496
|
-
value:
|
|
6534
|
+
type: z52.literal("checkbox"),
|
|
6535
|
+
value: z52.boolean().optional(),
|
|
6497
6536
|
placeholder: DynamicTextSchema.optional(),
|
|
6498
6537
|
props: PrimeCheckboxPropsSchema.optional()
|
|
6499
6538
|
});
|
|
6500
6539
|
var PrimeRadioFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6501
|
-
type:
|
|
6502
|
-
nullable:
|
|
6503
|
-
value:
|
|
6540
|
+
type: z52.literal("radio"),
|
|
6541
|
+
nullable: z52.boolean().optional(),
|
|
6542
|
+
value: z52.unknown().nullable().optional(),
|
|
6504
6543
|
placeholder: DynamicTextSchema.optional(),
|
|
6505
6544
|
options: FieldOptionsSchema,
|
|
6506
6545
|
props: PrimeRadioPropsSchema.optional()
|
|
6507
6546
|
});
|
|
6508
6547
|
var PrimeRadioFieldSchema = PrimeRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6509
6548
|
var PrimeSelectFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6510
|
-
type:
|
|
6511
|
-
nullable:
|
|
6512
|
-
value:
|
|
6549
|
+
type: z52.literal("select"),
|
|
6550
|
+
nullable: z52.boolean().optional(),
|
|
6551
|
+
value: z52.unknown().nullable().optional(),
|
|
6513
6552
|
placeholder: DynamicTextSchema.optional(),
|
|
6514
6553
|
options: FieldOptionsSchema,
|
|
6515
6554
|
props: PrimeSelectPropsSchema.optional()
|
|
6516
6555
|
});
|
|
6517
6556
|
var PrimeSelectFieldSchema = PrimeSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6518
6557
|
var PrimeMultiCheckboxFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6519
|
-
type:
|
|
6520
|
-
nullable:
|
|
6521
|
-
value:
|
|
6558
|
+
type: z52.literal("multi-checkbox"),
|
|
6559
|
+
nullable: z52.boolean().optional(),
|
|
6560
|
+
value: z52.array(z52.unknown()).nullable().optional(),
|
|
6522
6561
|
placeholder: DynamicTextSchema.optional(),
|
|
6523
6562
|
options: FieldOptionsSchema,
|
|
6524
6563
|
props: PrimeMultiCheckboxPropsSchema.optional()
|
|
6525
6564
|
});
|
|
6526
6565
|
var PrimeMultiCheckboxFieldSchema = PrimeMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6527
6566
|
var PrimeDatepickerFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6528
|
-
type:
|
|
6529
|
-
nullable:
|
|
6530
|
-
value:
|
|
6531
|
-
minDate:
|
|
6532
|
-
maxDate:
|
|
6533
|
-
startAt:
|
|
6567
|
+
type: z52.literal("datepicker"),
|
|
6568
|
+
nullable: z52.boolean().optional(),
|
|
6569
|
+
value: DatepickerValueSchema,
|
|
6570
|
+
minDate: z52.union([z52.string(), z52.null()]).optional(),
|
|
6571
|
+
maxDate: z52.union([z52.string(), z52.null()]).optional(),
|
|
6572
|
+
startAt: z52.union([z52.string(), z52.null()]).optional(),
|
|
6534
6573
|
placeholder: DynamicTextSchema.optional(),
|
|
6535
6574
|
props: PrimeDatepickerPropsSchema.optional()
|
|
6536
6575
|
});
|
|
6537
6576
|
var PrimeDatepickerFieldSchema = PrimeDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6538
6577
|
var PrimeTextareaFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6539
|
-
type:
|
|
6540
|
-
nullable:
|
|
6541
|
-
value:
|
|
6578
|
+
type: z52.literal("textarea"),
|
|
6579
|
+
nullable: z52.boolean().optional(),
|
|
6580
|
+
value: z52.string().nullable().optional(),
|
|
6542
6581
|
placeholder: DynamicTextSchema.optional(),
|
|
6543
6582
|
props: PrimeTextareaPropsSchema.optional()
|
|
6544
6583
|
});
|
|
6545
6584
|
var PrimeTextareaFieldSchema = PrimeTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6546
6585
|
var PrimeSliderFieldSchemaObject = PrimeValueFieldBase.extend({
|
|
6547
|
-
type:
|
|
6548
|
-
nullable:
|
|
6549
|
-
value:
|
|
6550
|
-
minValue:
|
|
6551
|
-
maxValue:
|
|
6552
|
-
step:
|
|
6586
|
+
type: z52.literal("slider"),
|
|
6587
|
+
nullable: z52.boolean().optional(),
|
|
6588
|
+
value: SliderValueSchema,
|
|
6589
|
+
minValue: z52.number().optional(),
|
|
6590
|
+
maxValue: z52.number().optional(),
|
|
6591
|
+
step: z52.number().positive().optional(),
|
|
6553
6592
|
placeholder: DynamicTextSchema.optional(),
|
|
6554
6593
|
props: PrimeSliderPropsSchema.optional()
|
|
6555
6594
|
});
|
|
6556
6595
|
var PrimeSliderFieldSchema = PrimeSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6557
6596
|
var PrimeToggleFieldSchema = PrimeValueFieldBase.extend({
|
|
6558
|
-
type:
|
|
6559
|
-
value:
|
|
6597
|
+
type: z52.literal("toggle"),
|
|
6598
|
+
value: z52.boolean().optional(),
|
|
6560
6599
|
placeholder: DynamicTextSchema.optional(),
|
|
6561
6600
|
props: PrimeTogglePropsSchema.optional()
|
|
6562
6601
|
});
|
|
6563
6602
|
var PrimeButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6564
|
-
type:
|
|
6565
|
-
event:
|
|
6566
|
-
eventArgs:
|
|
6603
|
+
type: z52.literal("button"),
|
|
6604
|
+
event: z52.string().optional(),
|
|
6605
|
+
eventArgs: z52.array(z52.union([z52.string(), z52.number(), z52.boolean(), z52.null(), z52.undefined()])).optional(),
|
|
6567
6606
|
props: PrimeButtonPropsSchema.optional(),
|
|
6568
6607
|
logic: LogicArraySchema.optional()
|
|
6569
6608
|
});
|
|
6570
6609
|
var PrimeSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6571
|
-
type:
|
|
6610
|
+
type: z52.literal("submit"),
|
|
6572
6611
|
props: PrimeButtonPropsSchema.optional(),
|
|
6573
6612
|
logic: LogicArraySchema.optional()
|
|
6574
6613
|
});
|
|
6575
6614
|
var PrimeNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6576
|
-
type:
|
|
6615
|
+
type: z52.literal("next"),
|
|
6577
6616
|
props: PrimeButtonPropsSchema.optional(),
|
|
6578
6617
|
logic: LogicArraySchema.optional()
|
|
6579
6618
|
});
|
|
6580
6619
|
var PrimePreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6581
|
-
type:
|
|
6620
|
+
type: z52.literal("previous"),
|
|
6582
6621
|
props: PrimeButtonPropsSchema.optional()
|
|
6583
6622
|
});
|
|
6584
6623
|
var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6587,13 +6626,13 @@ var PrimeAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6587
6626
|
* item, or a list of them for an object item.
|
|
6588
6627
|
*/
|
|
6589
6628
|
template: ArrayItemTemplateSchema,
|
|
6590
|
-
type:
|
|
6591
|
-
arrayKey:
|
|
6629
|
+
type: z52.literal("add-array-item"),
|
|
6630
|
+
arrayKey: z52.string().optional(),
|
|
6592
6631
|
props: PrimeButtonPropsSchema.optional()
|
|
6593
6632
|
});
|
|
6594
6633
|
var PrimeRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6595
|
-
type:
|
|
6596
|
-
arrayKey:
|
|
6634
|
+
type: z52.literal("remove-array-item"),
|
|
6635
|
+
arrayKey: z52.string().optional(),
|
|
6597
6636
|
props: PrimeButtonPropsSchema.optional()
|
|
6598
6637
|
});
|
|
6599
6638
|
var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6602,8 +6641,8 @@ var PrimePrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6602
6641
|
* item, or a list of them for an object item.
|
|
6603
6642
|
*/
|
|
6604
6643
|
template: ArrayItemTemplateSchema,
|
|
6605
|
-
type:
|
|
6606
|
-
arrayKey:
|
|
6644
|
+
type: z52.literal("prepend-array-item"),
|
|
6645
|
+
arrayKey: z52.string().optional(),
|
|
6607
6646
|
props: PrimeButtonPropsSchema.optional()
|
|
6608
6647
|
});
|
|
6609
6648
|
var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6612,25 +6651,25 @@ var PrimeInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6612
6651
|
* item, or a list of them for an object item.
|
|
6613
6652
|
*/
|
|
6614
6653
|
template: ArrayItemTemplateSchema,
|
|
6615
|
-
type:
|
|
6616
|
-
arrayKey:
|
|
6617
|
-
index:
|
|
6654
|
+
type: z52.literal("insert-array-item"),
|
|
6655
|
+
arrayKey: z52.string().optional(),
|
|
6656
|
+
index: z52.number(),
|
|
6618
6657
|
props: PrimeButtonPropsSchema.optional()
|
|
6619
6658
|
});
|
|
6620
6659
|
var PrimePopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6621
|
-
type:
|
|
6622
|
-
arrayKey:
|
|
6660
|
+
type: z52.literal("pop-array-item"),
|
|
6661
|
+
arrayKey: z52.string(),
|
|
6623
6662
|
props: PrimeButtonPropsSchema.optional()
|
|
6624
6663
|
});
|
|
6625
6664
|
var PrimeShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6626
|
-
type:
|
|
6627
|
-
arrayKey:
|
|
6665
|
+
type: z52.literal("shift-array-item"),
|
|
6666
|
+
arrayKey: z52.string(),
|
|
6628
6667
|
props: PrimeButtonPropsSchema.optional()
|
|
6629
6668
|
});
|
|
6630
6669
|
|
|
6631
6670
|
// internal/dynamic-forms-validation/primeng/src/prime-leaf-field.schema.ts
|
|
6632
|
-
import { z as
|
|
6633
|
-
var PrimeLeafFieldSchema =
|
|
6671
|
+
import { z as z53 } from "zod";
|
|
6672
|
+
var PrimeLeafFieldSchema = z53.discriminatedUnion("type", [
|
|
6634
6673
|
TextFieldSchema,
|
|
6635
6674
|
HiddenFieldSchema,
|
|
6636
6675
|
PrimeInputFieldSchemaObject,
|
|
@@ -6652,10 +6691,10 @@ var PrimeLeafFieldSchema = z51.discriminatedUnion("type", [
|
|
|
6652
6691
|
PrimeInsertArrayItemButtonFieldSchema,
|
|
6653
6692
|
PrimePopArrayItemButtonFieldSchema,
|
|
6654
6693
|
PrimeShiftArrayItemButtonFieldSchema
|
|
6655
|
-
]).superRefine(nullableValueRefine);
|
|
6694
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6656
6695
|
|
|
6657
6696
|
// internal/dynamic-forms-validation/primeng/src/prime-form-config.schema.ts
|
|
6658
|
-
import { z as
|
|
6697
|
+
import { z as z54 } from "zod";
|
|
6659
6698
|
var containerSchemas3 = createContainerSchemas({
|
|
6660
6699
|
leafFieldSchema: PrimeLeafFieldSchema
|
|
6661
6700
|
});
|
|
@@ -6664,13 +6703,13 @@ var PrimeRowFieldSchema = containerSchemas3.RowFieldSchema;
|
|
|
6664
6703
|
var PrimeGroupFieldSchema = containerSchemas3.GroupFieldSchema;
|
|
6665
6704
|
var PrimeArrayFieldSchema = containerSchemas3.ArrayFieldSchema;
|
|
6666
6705
|
var PrimeFieldSchema = containerSchemas3.AllFieldsSchema;
|
|
6667
|
-
var PrimeFormDefaultPropsSchema =
|
|
6668
|
-
styleClass:
|
|
6706
|
+
var PrimeFormDefaultPropsSchema = z54.object({
|
|
6707
|
+
styleClass: z54.string().optional()
|
|
6669
6708
|
});
|
|
6670
6709
|
var PrimeFormConfigSchema = createFormConfigSchema(PrimeFieldSchema, PrimeFormDefaultPropsSchema);
|
|
6671
6710
|
|
|
6672
6711
|
// internal/dynamic-forms-validation/ionic/src/props/index.ts
|
|
6673
|
-
import { z as
|
|
6712
|
+
import { z as z55 } from "zod";
|
|
6674
6713
|
function isLocaleTag(value) {
|
|
6675
6714
|
try {
|
|
6676
6715
|
return Intl.getCanonicalLocales(value).length > 0;
|
|
@@ -6678,209 +6717,209 @@ function isLocaleTag(value) {
|
|
|
6678
6717
|
return false;
|
|
6679
6718
|
}
|
|
6680
6719
|
}
|
|
6681
|
-
var IonicColorSchema =
|
|
6682
|
-
var IonicLabelPlacementSchema =
|
|
6683
|
-
var IonicJustifySchema =
|
|
6684
|
-
var IonicFillSchema =
|
|
6685
|
-
var IonicInputPropsSchema =
|
|
6686
|
-
fill:
|
|
6687
|
-
shape:
|
|
6720
|
+
var IonicColorSchema = z55.enum(["primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", "dark"]);
|
|
6721
|
+
var IonicLabelPlacementSchema = z55.enum(["start", "end", "fixed", "stacked", "floating"]);
|
|
6722
|
+
var IonicJustifySchema = z55.enum(["start", "end", "space-between"]);
|
|
6723
|
+
var IonicFillSchema = z55.enum(["solid", "outline", "clear", "default"]);
|
|
6724
|
+
var IonicInputPropsSchema = z55.object({
|
|
6725
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6726
|
+
shape: z55.literal("round").optional(),
|
|
6688
6727
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6689
6728
|
color: IonicColorSchema.optional(),
|
|
6690
6729
|
hint: DynamicTextSchema.optional(),
|
|
6691
6730
|
errorText: DynamicTextSchema.optional(),
|
|
6692
|
-
counter:
|
|
6693
|
-
clearInput:
|
|
6694
|
-
type:
|
|
6731
|
+
counter: z55.boolean().optional(),
|
|
6732
|
+
clearInput: z55.boolean().optional(),
|
|
6733
|
+
type: z55.enum(["text", "email", "password", "number", "tel", "url", "search"]).optional(),
|
|
6695
6734
|
placeholder: DynamicTextSchema.optional()
|
|
6696
6735
|
});
|
|
6697
|
-
var IonicCheckboxPropsSchema =
|
|
6698
|
-
labelPlacement:
|
|
6736
|
+
var IonicCheckboxPropsSchema = z55.object({
|
|
6737
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6699
6738
|
justify: IonicJustifySchema.optional(),
|
|
6700
|
-
color:
|
|
6701
|
-
indeterminate:
|
|
6739
|
+
color: IonicColorSchema.optional(),
|
|
6740
|
+
indeterminate: z55.boolean().optional(),
|
|
6702
6741
|
hint: DynamicTextSchema.optional()
|
|
6703
6742
|
});
|
|
6704
|
-
var IonicRadioPropsSchema =
|
|
6705
|
-
labelPlacement:
|
|
6743
|
+
var IonicRadioPropsSchema = z55.object({
|
|
6744
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6706
6745
|
justify: IonicJustifySchema.optional(),
|
|
6707
|
-
color:
|
|
6746
|
+
color: IonicColorSchema.optional(),
|
|
6708
6747
|
hint: DynamicTextSchema.optional()
|
|
6709
6748
|
});
|
|
6710
|
-
var IonicTogglePropsSchema =
|
|
6711
|
-
labelPlacement:
|
|
6749
|
+
var IonicTogglePropsSchema = z55.object({
|
|
6750
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6712
6751
|
justify: IonicJustifySchema.optional(),
|
|
6713
|
-
color:
|
|
6714
|
-
enableOnOffLabels:
|
|
6752
|
+
color: IonicColorSchema.optional(),
|
|
6753
|
+
enableOnOffLabels: z55.boolean().optional(),
|
|
6715
6754
|
hint: DynamicTextSchema.optional()
|
|
6716
6755
|
});
|
|
6717
|
-
var IonicSliderPropsSchema =
|
|
6718
|
-
min:
|
|
6719
|
-
max:
|
|
6720
|
-
step:
|
|
6721
|
-
dualKnobs:
|
|
6722
|
-
pin:
|
|
6723
|
-
ticks:
|
|
6724
|
-
snaps:
|
|
6725
|
-
color:
|
|
6726
|
-
labelPlacement:
|
|
6756
|
+
var IonicSliderPropsSchema = z55.object({
|
|
6757
|
+
min: z55.number().optional(),
|
|
6758
|
+
max: z55.number().optional(),
|
|
6759
|
+
step: z55.number().positive().optional(),
|
|
6760
|
+
dualKnobs: z55.boolean().optional(),
|
|
6761
|
+
pin: z55.boolean().optional(),
|
|
6762
|
+
ticks: z55.boolean().optional(),
|
|
6763
|
+
snaps: z55.boolean().optional(),
|
|
6764
|
+
color: IonicColorSchema.optional(),
|
|
6765
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6727
6766
|
hint: DynamicTextSchema.optional()
|
|
6728
6767
|
});
|
|
6729
|
-
var IonicDatepickerPropsSchema =
|
|
6730
|
-
presentation:
|
|
6731
|
-
multiple:
|
|
6732
|
-
preferWheel:
|
|
6733
|
-
showDefaultButtons:
|
|
6734
|
-
showDefaultTitle:
|
|
6735
|
-
showDefaultTimeLabel:
|
|
6736
|
-
showClearButton:
|
|
6737
|
-
doneText:
|
|
6738
|
-
cancelText:
|
|
6739
|
-
size:
|
|
6740
|
-
color:
|
|
6768
|
+
var IonicDatepickerPropsSchema = z55.object({
|
|
6769
|
+
presentation: z55.enum(["date", "date-time", "time", "time-date", "month", "month-year", "year"]).optional(),
|
|
6770
|
+
multiple: z55.boolean().optional(),
|
|
6771
|
+
preferWheel: z55.boolean().optional(),
|
|
6772
|
+
showDefaultButtons: z55.boolean().optional(),
|
|
6773
|
+
showDefaultTitle: z55.boolean().optional(),
|
|
6774
|
+
showDefaultTimeLabel: z55.boolean().optional(),
|
|
6775
|
+
showClearButton: z55.boolean().optional(),
|
|
6776
|
+
doneText: DynamicTextSchema.optional(),
|
|
6777
|
+
cancelText: DynamicTextSchema.optional(),
|
|
6778
|
+
size: z55.enum(["cover", "fixed"]).optional(),
|
|
6779
|
+
color: IonicColorSchema.optional(),
|
|
6741
6780
|
hint: DynamicTextSchema.optional(),
|
|
6742
|
-
locale:
|
|
6781
|
+
locale: z55.string().refine(isLocaleTag, { message: 'Expected a BCP 47 locale tag such as "de-DE"' }).optional(),
|
|
6743
6782
|
placeholder: DynamicTextSchema.optional()
|
|
6744
6783
|
});
|
|
6745
|
-
var IonicSelectPropsSchema =
|
|
6746
|
-
multiple:
|
|
6747
|
-
interface:
|
|
6748
|
-
cancelText:
|
|
6749
|
-
okText:
|
|
6784
|
+
var IonicSelectPropsSchema = z55.object({
|
|
6785
|
+
multiple: z55.boolean().optional(),
|
|
6786
|
+
interface: z55.enum(["action-sheet", "popover", "alert"]).optional(),
|
|
6787
|
+
cancelText: DynamicTextSchema.optional(),
|
|
6788
|
+
okText: DynamicTextSchema.optional(),
|
|
6750
6789
|
placeholder: DynamicTextSchema.optional(),
|
|
6751
|
-
fill:
|
|
6752
|
-
shape:
|
|
6790
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6791
|
+
shape: z55.literal("round").optional(),
|
|
6753
6792
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6754
|
-
color:
|
|
6793
|
+
color: IonicColorSchema.optional(),
|
|
6755
6794
|
hint: DynamicTextSchema.optional()
|
|
6756
6795
|
});
|
|
6757
|
-
var IonicTextareaPropsSchema =
|
|
6758
|
-
rows:
|
|
6759
|
-
autoGrow:
|
|
6760
|
-
counter:
|
|
6761
|
-
fill:
|
|
6762
|
-
shape:
|
|
6796
|
+
var IonicTextareaPropsSchema = z55.object({
|
|
6797
|
+
rows: z55.number().positive().optional(),
|
|
6798
|
+
autoGrow: z55.boolean().optional(),
|
|
6799
|
+
counter: z55.boolean().optional(),
|
|
6800
|
+
fill: z55.enum(["solid", "outline"]).optional(),
|
|
6801
|
+
shape: z55.literal("round").optional(),
|
|
6763
6802
|
labelPlacement: IonicLabelPlacementSchema.optional(),
|
|
6764
6803
|
hint: DynamicTextSchema.optional(),
|
|
6765
6804
|
errorText: DynamicTextSchema.optional(),
|
|
6766
6805
|
color: IonicColorSchema.optional(),
|
|
6767
6806
|
placeholder: DynamicTextSchema.optional()
|
|
6768
6807
|
});
|
|
6769
|
-
var IonicMultiCheckboxPropsSchema =
|
|
6770
|
-
labelPlacement:
|
|
6808
|
+
var IonicMultiCheckboxPropsSchema = z55.object({
|
|
6809
|
+
labelPlacement: z55.enum(["start", "end", "fixed", "stacked"]).optional(),
|
|
6771
6810
|
justify: IonicJustifySchema.optional(),
|
|
6772
|
-
color:
|
|
6811
|
+
color: IonicColorSchema.optional(),
|
|
6773
6812
|
hint: DynamicTextSchema.optional()
|
|
6774
6813
|
});
|
|
6775
|
-
var IonicButtonPropsSchema =
|
|
6776
|
-
expand:
|
|
6814
|
+
var IonicButtonPropsSchema = z55.object({
|
|
6815
|
+
expand: z55.enum(["full", "block"]).optional(),
|
|
6777
6816
|
fill: IonicFillSchema.optional(),
|
|
6778
|
-
shape:
|
|
6779
|
-
size:
|
|
6817
|
+
shape: z55.literal("round").optional(),
|
|
6818
|
+
size: z55.enum(["small", "default", "large"]).optional(),
|
|
6780
6819
|
color: IonicColorSchema.optional(),
|
|
6781
|
-
strong:
|
|
6782
|
-
type:
|
|
6820
|
+
strong: z55.boolean().optional(),
|
|
6821
|
+
type: z55.enum(["button", "submit", "reset"]).optional()
|
|
6783
6822
|
});
|
|
6784
6823
|
|
|
6785
6824
|
// internal/dynamic-forms-validation/ionic/src/fields/index.ts
|
|
6786
|
-
import { z as
|
|
6825
|
+
import { z as z56 } from "zod";
|
|
6787
6826
|
var IonicValueFieldBase = BaseFieldDefSchema.merge(FieldWithValidationSchema);
|
|
6788
6827
|
var IonicInputFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6789
|
-
type:
|
|
6790
|
-
nullable:
|
|
6791
|
-
value:
|
|
6828
|
+
type: z56.literal("input"),
|
|
6829
|
+
nullable: z56.boolean().optional(),
|
|
6830
|
+
value: InputValueSchema,
|
|
6792
6831
|
placeholder: DynamicTextSchema.optional(),
|
|
6793
6832
|
props: IonicInputPropsSchema.optional()
|
|
6794
6833
|
});
|
|
6795
|
-
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6834
|
+
var IonicInputFieldSchema = IonicInputFieldSchemaObject.superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6796
6835
|
var IonicCheckboxFieldSchema = IonicValueFieldBase.extend({
|
|
6797
|
-
type:
|
|
6798
|
-
value:
|
|
6836
|
+
type: z56.literal("checkbox"),
|
|
6837
|
+
value: z56.boolean().optional(),
|
|
6799
6838
|
placeholder: DynamicTextSchema.optional(),
|
|
6800
6839
|
props: IonicCheckboxPropsSchema.optional()
|
|
6801
6840
|
});
|
|
6802
6841
|
var IonicRadioFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6803
|
-
type:
|
|
6804
|
-
nullable:
|
|
6805
|
-
value:
|
|
6842
|
+
type: z56.literal("radio"),
|
|
6843
|
+
nullable: z56.boolean().optional(),
|
|
6844
|
+
value: z56.unknown().nullable().optional(),
|
|
6806
6845
|
placeholder: DynamicTextSchema.optional(),
|
|
6807
6846
|
options: FieldOptionsSchema,
|
|
6808
6847
|
props: IonicRadioPropsSchema.optional()
|
|
6809
6848
|
});
|
|
6810
6849
|
var IonicRadioFieldSchema = IonicRadioFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6811
6850
|
var IonicToggleFieldSchema = IonicValueFieldBase.extend({
|
|
6812
|
-
type:
|
|
6813
|
-
value:
|
|
6851
|
+
type: z56.literal("toggle"),
|
|
6852
|
+
value: z56.boolean().optional(),
|
|
6814
6853
|
placeholder: DynamicTextSchema.optional(),
|
|
6815
6854
|
props: IonicTogglePropsSchema.optional()
|
|
6816
6855
|
});
|
|
6817
6856
|
var IonicSliderFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6818
|
-
type:
|
|
6819
|
-
nullable:
|
|
6820
|
-
value:
|
|
6821
|
-
minValue:
|
|
6822
|
-
maxValue:
|
|
6823
|
-
step:
|
|
6857
|
+
type: z56.literal("slider"),
|
|
6858
|
+
nullable: z56.boolean().optional(),
|
|
6859
|
+
value: SliderValueSchema,
|
|
6860
|
+
minValue: z56.number().optional(),
|
|
6861
|
+
maxValue: z56.number().optional(),
|
|
6862
|
+
step: z56.number().positive().optional(),
|
|
6824
6863
|
placeholder: DynamicTextSchema.optional(),
|
|
6825
6864
|
props: IonicSliderPropsSchema.optional()
|
|
6826
6865
|
});
|
|
6827
6866
|
var IonicSliderFieldSchema = IonicSliderFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6828
6867
|
var IonicDatepickerFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6829
|
-
type:
|
|
6830
|
-
nullable:
|
|
6831
|
-
value:
|
|
6832
|
-
minDate:
|
|
6833
|
-
maxDate:
|
|
6834
|
-
startAt:
|
|
6868
|
+
type: z56.literal("datepicker"),
|
|
6869
|
+
nullable: z56.boolean().optional(),
|
|
6870
|
+
value: DatepickerValueSchema,
|
|
6871
|
+
minDate: z56.union([z56.string(), z56.null()]).optional(),
|
|
6872
|
+
maxDate: z56.union([z56.string(), z56.null()]).optional(),
|
|
6873
|
+
startAt: z56.union([z56.string(), z56.null()]).optional(),
|
|
6835
6874
|
placeholder: DynamicTextSchema.optional(),
|
|
6836
6875
|
props: IonicDatepickerPropsSchema.optional()
|
|
6837
6876
|
});
|
|
6838
6877
|
var IonicDatepickerFieldSchema = IonicDatepickerFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6839
6878
|
var IonicSelectFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6840
|
-
type:
|
|
6841
|
-
nullable:
|
|
6842
|
-
value:
|
|
6879
|
+
type: z56.literal("select"),
|
|
6880
|
+
nullable: z56.boolean().optional(),
|
|
6881
|
+
value: z56.unknown().nullable().optional(),
|
|
6843
6882
|
placeholder: DynamicTextSchema.optional(),
|
|
6844
6883
|
options: FieldOptionsSchema,
|
|
6845
6884
|
props: IonicSelectPropsSchema.optional()
|
|
6846
6885
|
});
|
|
6847
6886
|
var IonicSelectFieldSchema = IonicSelectFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6848
6887
|
var IonicTextareaFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6849
|
-
type:
|
|
6850
|
-
nullable:
|
|
6851
|
-
value:
|
|
6888
|
+
type: z56.literal("textarea"),
|
|
6889
|
+
nullable: z56.boolean().optional(),
|
|
6890
|
+
value: z56.string().nullable().optional(),
|
|
6852
6891
|
placeholder: DynamicTextSchema.optional(),
|
|
6853
6892
|
props: IonicTextareaPropsSchema.optional()
|
|
6854
6893
|
});
|
|
6855
6894
|
var IonicTextareaFieldSchema = IonicTextareaFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6856
6895
|
var IonicMultiCheckboxFieldSchemaObject = IonicValueFieldBase.extend({
|
|
6857
|
-
type:
|
|
6858
|
-
nullable:
|
|
6859
|
-
value:
|
|
6896
|
+
type: z56.literal("multi-checkbox"),
|
|
6897
|
+
nullable: z56.boolean().optional(),
|
|
6898
|
+
value: z56.array(z56.unknown()).nullable().optional(),
|
|
6860
6899
|
placeholder: DynamicTextSchema.optional(),
|
|
6861
6900
|
options: FieldOptionsSchema,
|
|
6862
6901
|
props: IonicMultiCheckboxPropsSchema.optional()
|
|
6863
6902
|
});
|
|
6864
6903
|
var IonicMultiCheckboxFieldSchema = IonicMultiCheckboxFieldSchemaObject.superRefine(nullableValueRefine);
|
|
6865
6904
|
var IonicButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6866
|
-
type:
|
|
6867
|
-
event:
|
|
6868
|
-
eventArgs:
|
|
6905
|
+
type: z56.literal("button"),
|
|
6906
|
+
event: z56.string().optional(),
|
|
6907
|
+
eventArgs: z56.array(z56.union([z56.string(), z56.number(), z56.boolean(), z56.null(), z56.undefined()])).optional(),
|
|
6869
6908
|
props: IonicButtonPropsSchema.optional(),
|
|
6870
6909
|
logic: LogicArraySchema.optional()
|
|
6871
6910
|
});
|
|
6872
6911
|
var IonicSubmitButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6873
|
-
type:
|
|
6912
|
+
type: z56.literal("submit"),
|
|
6874
6913
|
props: IonicButtonPropsSchema.optional(),
|
|
6875
6914
|
logic: LogicArraySchema.optional()
|
|
6876
6915
|
});
|
|
6877
6916
|
var IonicNextButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6878
|
-
type:
|
|
6917
|
+
type: z56.literal("next"),
|
|
6879
6918
|
props: IonicButtonPropsSchema.optional(),
|
|
6880
6919
|
logic: LogicArraySchema.optional()
|
|
6881
6920
|
});
|
|
6882
6921
|
var IonicPreviousButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6883
|
-
type:
|
|
6922
|
+
type: z56.literal("previous"),
|
|
6884
6923
|
props: IonicButtonPropsSchema.optional()
|
|
6885
6924
|
});
|
|
6886
6925
|
var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6889,13 +6928,13 @@ var IonicAddArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6889
6928
|
* item, or a list of them for an object item.
|
|
6890
6929
|
*/
|
|
6891
6930
|
template: ArrayItemTemplateSchema,
|
|
6892
|
-
type:
|
|
6893
|
-
arrayKey:
|
|
6931
|
+
type: z56.literal("add-array-item"),
|
|
6932
|
+
arrayKey: z56.string().optional(),
|
|
6894
6933
|
props: IonicButtonPropsSchema.optional()
|
|
6895
6934
|
});
|
|
6896
6935
|
var IonicRemoveArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6897
|
-
type:
|
|
6898
|
-
arrayKey:
|
|
6936
|
+
type: z56.literal("remove-array-item"),
|
|
6937
|
+
arrayKey: z56.string().optional(),
|
|
6899
6938
|
props: IonicButtonPropsSchema.optional()
|
|
6900
6939
|
});
|
|
6901
6940
|
var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6904,8 +6943,8 @@ var IonicPrependArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6904
6943
|
* item, or a list of them for an object item.
|
|
6905
6944
|
*/
|
|
6906
6945
|
template: ArrayItemTemplateSchema,
|
|
6907
|
-
type:
|
|
6908
|
-
arrayKey:
|
|
6946
|
+
type: z56.literal("prepend-array-item"),
|
|
6947
|
+
arrayKey: z56.string().optional(),
|
|
6909
6948
|
props: IonicButtonPropsSchema.optional()
|
|
6910
6949
|
});
|
|
6911
6950
|
var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
@@ -6914,25 +6953,25 @@ var IonicInsertArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
|
6914
6953
|
* item, or a list of them for an object item.
|
|
6915
6954
|
*/
|
|
6916
6955
|
template: ArrayItemTemplateSchema,
|
|
6917
|
-
type:
|
|
6918
|
-
arrayKey:
|
|
6919
|
-
index:
|
|
6956
|
+
type: z56.literal("insert-array-item"),
|
|
6957
|
+
arrayKey: z56.string().optional(),
|
|
6958
|
+
index: z56.number(),
|
|
6920
6959
|
props: IonicButtonPropsSchema.optional()
|
|
6921
6960
|
});
|
|
6922
6961
|
var IonicPopArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6923
|
-
type:
|
|
6924
|
-
arrayKey:
|
|
6962
|
+
type: z56.literal("pop-array-item"),
|
|
6963
|
+
arrayKey: z56.string(),
|
|
6925
6964
|
props: IonicButtonPropsSchema.optional()
|
|
6926
6965
|
});
|
|
6927
6966
|
var IonicShiftArrayItemButtonFieldSchema = BaseFieldDefSchema.extend({
|
|
6928
|
-
type:
|
|
6929
|
-
arrayKey:
|
|
6967
|
+
type: z56.literal("shift-array-item"),
|
|
6968
|
+
arrayKey: z56.string(),
|
|
6930
6969
|
props: IonicButtonPropsSchema.optional()
|
|
6931
6970
|
});
|
|
6932
6971
|
|
|
6933
6972
|
// internal/dynamic-forms-validation/ionic/src/ionic-leaf-field.schema.ts
|
|
6934
|
-
import { z as
|
|
6935
|
-
var IonicLeafFieldSchema =
|
|
6973
|
+
import { z as z57 } from "zod";
|
|
6974
|
+
var IonicLeafFieldSchema = z57.discriminatedUnion("type", [
|
|
6936
6975
|
TextFieldSchema,
|
|
6937
6976
|
HiddenFieldSchema,
|
|
6938
6977
|
IonicInputFieldSchemaObject,
|
|
@@ -6954,10 +6993,10 @@ var IonicLeafFieldSchema = z55.discriminatedUnion("type", [
|
|
|
6954
6993
|
IonicInsertArrayItemButtonFieldSchema,
|
|
6955
6994
|
IonicPopArrayItemButtonFieldSchema,
|
|
6956
6995
|
IonicShiftArrayItemButtonFieldSchema
|
|
6957
|
-
]).superRefine(nullableValueRefine);
|
|
6996
|
+
]).superRefine(nullableValueRefine).superRefine(inputValueTypeRefine);
|
|
6958
6997
|
|
|
6959
6998
|
// internal/dynamic-forms-validation/ionic/src/ionic-form-config.schema.ts
|
|
6960
|
-
import { z as
|
|
6999
|
+
import { z as z58 } from "zod";
|
|
6961
7000
|
var containerSchemas4 = createContainerSchemas({
|
|
6962
7001
|
leafFieldSchema: IonicLeafFieldSchema
|
|
6963
7002
|
});
|
|
@@ -6966,7 +7005,7 @@ var IonicRowFieldSchema = containerSchemas4.RowFieldSchema;
|
|
|
6966
7005
|
var IonicGroupFieldSchema = containerSchemas4.GroupFieldSchema;
|
|
6967
7006
|
var IonicArrayFieldSchema = containerSchemas4.ArrayFieldSchema;
|
|
6968
7007
|
var IonicFieldSchema = containerSchemas4.AllFieldsSchema;
|
|
6969
|
-
var IonicFormDefaultPropsSchema =
|
|
7008
|
+
var IonicFormDefaultPropsSchema = z58.object({
|
|
6970
7009
|
color: IonicColorSchema.optional(),
|
|
6971
7010
|
labelPlacement: IonicLabelPlacementSchema.optional()
|
|
6972
7011
|
});
|
|
@@ -6974,7 +7013,7 @@ var IonicFormConfigSchema = createFormConfigSchema(IonicFieldSchema, IonicFormDe
|
|
|
6974
7013
|
|
|
6975
7014
|
// internal/dynamic-forms-validation/validate/src/json-schema/form-config-json-schema.ts
|
|
6976
7015
|
function toJsonSchema(schema, name, basePath) {
|
|
6977
|
-
const jsonSchema =
|
|
7016
|
+
const jsonSchema = z59.toJSONSchema(schema, { target: "draft-7", io: "input", unrepresentable: "any" });
|
|
6978
7017
|
jsonSchema["$id"] = basePath ? `${basePath.replace(/\/$/, "")}/${name}` : name;
|
|
6979
7018
|
return jsonSchema;
|
|
6980
7019
|
}
|
|
@@ -7072,30 +7111,30 @@ function getFieldTypeJsonSchema(uiIntegration, fieldType) {
|
|
|
7072
7111
|
}
|
|
7073
7112
|
|
|
7074
7113
|
// internal/dynamic-forms-validation/src/lib/schemas/field-type-names.ts
|
|
7075
|
-
import { z as
|
|
7114
|
+
import { z as z60 } from "zod";
|
|
7076
7115
|
var MAX_DEPTH = 20;
|
|
7077
7116
|
function collectDiscriminator(schema, into) {
|
|
7078
|
-
if (schema instanceof
|
|
7117
|
+
if (schema instanceof z60.ZodLiteral) {
|
|
7079
7118
|
for (const value of schema.def.values) {
|
|
7080
7119
|
if (typeof value === "string") into.add(value);
|
|
7081
7120
|
}
|
|
7082
7121
|
return;
|
|
7083
7122
|
}
|
|
7084
|
-
if (schema instanceof
|
|
7123
|
+
if (schema instanceof z60.ZodEnum) {
|
|
7085
7124
|
for (const value of schema.options) into.add(value);
|
|
7086
7125
|
}
|
|
7087
7126
|
}
|
|
7088
7127
|
function visit(schema, into, depth) {
|
|
7089
7128
|
if (depth > MAX_DEPTH) return;
|
|
7090
|
-
if (schema instanceof
|
|
7129
|
+
if (schema instanceof z60.ZodLazy) {
|
|
7091
7130
|
visit(schema.unwrap(), into, depth + 1);
|
|
7092
7131
|
return;
|
|
7093
7132
|
}
|
|
7094
|
-
if (schema instanceof
|
|
7133
|
+
if (schema instanceof z60.ZodUnion) {
|
|
7095
7134
|
for (const option of schema.options) visit(option, into, depth + 1);
|
|
7096
7135
|
return;
|
|
7097
7136
|
}
|
|
7098
|
-
if (schema instanceof
|
|
7137
|
+
if (schema instanceof z60.ZodObject) {
|
|
7099
7138
|
collectDiscriminator(schema.shape["type"], into);
|
|
7100
7139
|
return;
|
|
7101
7140
|
}
|
|
@@ -7106,6 +7145,1040 @@ function collectFieldTypeNames(schema) {
|
|
|
7106
7145
|
return [...names];
|
|
7107
7146
|
}
|
|
7108
7147
|
|
|
7148
|
+
// packages/dynamic-forms/internal/src/lib/errors/dynamic-form-error.ts
|
|
7149
|
+
var DynamicFormError = class _DynamicFormError extends Error {
|
|
7150
|
+
static PREFIX = "[Dynamic Forms]";
|
|
7151
|
+
constructor(message) {
|
|
7152
|
+
super(`${_DynamicFormError.PREFIX} ${message}`);
|
|
7153
|
+
this.name = "DynamicFormError";
|
|
7154
|
+
}
|
|
7155
|
+
};
|
|
7156
|
+
|
|
7157
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/types.ts
|
|
7158
|
+
var ExpressionParserError = class extends DynamicFormError {
|
|
7159
|
+
constructor(message, position, expression) {
|
|
7160
|
+
super(`${message} at position ${position} in expression: ${expression}`);
|
|
7161
|
+
this.position = position;
|
|
7162
|
+
this.expression = expression;
|
|
7163
|
+
this.name = "ExpressionParserError";
|
|
7164
|
+
}
|
|
7165
|
+
position;
|
|
7166
|
+
expression;
|
|
7167
|
+
};
|
|
7168
|
+
|
|
7169
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/evaluator.ts
|
|
7170
|
+
var STRING_SAFE_METHODS = [
|
|
7171
|
+
"charAt",
|
|
7172
|
+
"charCodeAt",
|
|
7173
|
+
"concat",
|
|
7174
|
+
"endsWith",
|
|
7175
|
+
"includes",
|
|
7176
|
+
"indexOf",
|
|
7177
|
+
"lastIndexOf",
|
|
7178
|
+
"match",
|
|
7179
|
+
"padEnd",
|
|
7180
|
+
"padStart",
|
|
7181
|
+
"repeat",
|
|
7182
|
+
"replace",
|
|
7183
|
+
"search",
|
|
7184
|
+
"slice",
|
|
7185
|
+
"split",
|
|
7186
|
+
"startsWith",
|
|
7187
|
+
"substring",
|
|
7188
|
+
"toLowerCase",
|
|
7189
|
+
"toUpperCase",
|
|
7190
|
+
"trim",
|
|
7191
|
+
"trimEnd",
|
|
7192
|
+
"trimStart",
|
|
7193
|
+
"toString"
|
|
7194
|
+
];
|
|
7195
|
+
var NUMBER_SAFE_METHODS = ["toExponential", "toFixed", "toPrecision", "toString"];
|
|
7196
|
+
var ARRAY_SAFE_METHODS = [
|
|
7197
|
+
"concat",
|
|
7198
|
+
"every",
|
|
7199
|
+
"filter",
|
|
7200
|
+
"find",
|
|
7201
|
+
"findIndex",
|
|
7202
|
+
"flat",
|
|
7203
|
+
"flatMap",
|
|
7204
|
+
"includes",
|
|
7205
|
+
"indexOf",
|
|
7206
|
+
"join",
|
|
7207
|
+
"lastIndexOf",
|
|
7208
|
+
"map",
|
|
7209
|
+
"reduce",
|
|
7210
|
+
"reduceRight",
|
|
7211
|
+
"slice",
|
|
7212
|
+
"some",
|
|
7213
|
+
"toString",
|
|
7214
|
+
"entries",
|
|
7215
|
+
"keys",
|
|
7216
|
+
"values"
|
|
7217
|
+
];
|
|
7218
|
+
var DATE_SAFE_METHODS = [
|
|
7219
|
+
"getDate",
|
|
7220
|
+
"getDay",
|
|
7221
|
+
"getFullYear",
|
|
7222
|
+
"getHours",
|
|
7223
|
+
"getMilliseconds",
|
|
7224
|
+
"getMinutes",
|
|
7225
|
+
"getMonth",
|
|
7226
|
+
"getSeconds",
|
|
7227
|
+
"getTime",
|
|
7228
|
+
"getTimezoneOffset",
|
|
7229
|
+
"getUTCDate",
|
|
7230
|
+
"getUTCDay",
|
|
7231
|
+
"getUTCFullYear",
|
|
7232
|
+
"getUTCHours",
|
|
7233
|
+
"getUTCMilliseconds",
|
|
7234
|
+
"getUTCMinutes",
|
|
7235
|
+
"getUTCMonth",
|
|
7236
|
+
"getUTCSeconds",
|
|
7237
|
+
"toDateString",
|
|
7238
|
+
"toISOString",
|
|
7239
|
+
"toJSON",
|
|
7240
|
+
"toString",
|
|
7241
|
+
"toTimeString",
|
|
7242
|
+
"toUTCString"
|
|
7243
|
+
];
|
|
7244
|
+
var SAFE_METHODS = {
|
|
7245
|
+
string: new Set(STRING_SAFE_METHODS),
|
|
7246
|
+
number: new Set(NUMBER_SAFE_METHODS),
|
|
7247
|
+
array: new Set(ARRAY_SAFE_METHODS),
|
|
7248
|
+
date: new Set(DATE_SAFE_METHODS)
|
|
7249
|
+
};
|
|
7250
|
+
var ALLOWED_METHOD_NAMES = new Set(Object.values(SAFE_METHODS).flatMap((methods) => [...methods]));
|
|
7251
|
+
var BLOCKED_PROPERTIES = /* @__PURE__ */ new Set([
|
|
7252
|
+
"constructor",
|
|
7253
|
+
"__proto__",
|
|
7254
|
+
"prototype",
|
|
7255
|
+
"__defineGetter__",
|
|
7256
|
+
"__defineSetter__",
|
|
7257
|
+
"__lookupGetter__",
|
|
7258
|
+
"__lookupSetter__"
|
|
7259
|
+
]);
|
|
7260
|
+
var Evaluator = class _Evaluator {
|
|
7261
|
+
scope;
|
|
7262
|
+
expression;
|
|
7263
|
+
constructor(scope, expression) {
|
|
7264
|
+
this.scope = scope;
|
|
7265
|
+
this.expression = expression;
|
|
7266
|
+
}
|
|
7267
|
+
/** Evaluate an AST node */
|
|
7268
|
+
evaluate(node) {
|
|
7269
|
+
switch (node.type) {
|
|
7270
|
+
case "Literal":
|
|
7271
|
+
return node.value;
|
|
7272
|
+
case "Identifier":
|
|
7273
|
+
return this.evaluateIdentifier(node.name);
|
|
7274
|
+
case "MemberAccess":
|
|
7275
|
+
return this.evaluateMemberAccess(node);
|
|
7276
|
+
case "ComputedMemberAccess":
|
|
7277
|
+
return this.evaluateComputedMemberAccess(node);
|
|
7278
|
+
case "BinaryOp":
|
|
7279
|
+
return this.evaluateBinaryOp(node);
|
|
7280
|
+
case "UnaryOp":
|
|
7281
|
+
return this.evaluateUnaryOp(node);
|
|
7282
|
+
case "CallExpression":
|
|
7283
|
+
return this.evaluateCallExpression(node);
|
|
7284
|
+
case "Conditional":
|
|
7285
|
+
return this.evaluate(node.test) ? this.evaluate(node.consequent) : this.evaluate(node.alternate);
|
|
7286
|
+
case "ArrayLiteral":
|
|
7287
|
+
return this.evaluateArrayLiteral(node);
|
|
7288
|
+
case "ObjectLiteral":
|
|
7289
|
+
return this.evaluateObjectLiteral(node);
|
|
7290
|
+
case "ArrowFunction":
|
|
7291
|
+
return this.evaluateArrowFunction(node);
|
|
7292
|
+
default:
|
|
7293
|
+
throw new ExpressionParserError(`Unknown node type: ${node.type}`, 0, this.expression);
|
|
7294
|
+
}
|
|
7295
|
+
}
|
|
7296
|
+
evaluateIdentifier(name) {
|
|
7297
|
+
if (name in this.scope) {
|
|
7298
|
+
return this.scope[name];
|
|
7299
|
+
}
|
|
7300
|
+
return void 0;
|
|
7301
|
+
}
|
|
7302
|
+
evaluateMemberAccess(node) {
|
|
7303
|
+
const obj = this.evaluate(node.object);
|
|
7304
|
+
if (obj === null || obj === void 0) {
|
|
7305
|
+
return void 0;
|
|
7306
|
+
}
|
|
7307
|
+
if (BLOCKED_PROPERTIES.has(node.property)) {
|
|
7308
|
+
throw new ExpressionParserError(`Property "${node.property}" is not accessible for security reasons`, 0, this.expression);
|
|
7309
|
+
}
|
|
7310
|
+
if (typeof obj === "object" || typeof obj === "string" || typeof obj === "number") {
|
|
7311
|
+
return obj[node.property];
|
|
7312
|
+
}
|
|
7313
|
+
return void 0;
|
|
7314
|
+
}
|
|
7315
|
+
evaluateComputedMemberAccess(node) {
|
|
7316
|
+
const obj = this.evaluate(node.object);
|
|
7317
|
+
if (obj === null || obj === void 0) {
|
|
7318
|
+
return void 0;
|
|
7319
|
+
}
|
|
7320
|
+
const rawKey = this.evaluate(node.property);
|
|
7321
|
+
if (rawKey === null || rawKey === void 0) return void 0;
|
|
7322
|
+
const key = String(rawKey);
|
|
7323
|
+
if (BLOCKED_PROPERTIES.has(key)) {
|
|
7324
|
+
throw new ExpressionParserError(`Property "${key}" is not accessible for security reasons`, 0, this.expression);
|
|
7325
|
+
}
|
|
7326
|
+
if (typeof obj === "object" || typeof obj === "string" || typeof obj === "number") {
|
|
7327
|
+
return obj[key];
|
|
7328
|
+
}
|
|
7329
|
+
return void 0;
|
|
7330
|
+
}
|
|
7331
|
+
evaluateBinaryOp(node) {
|
|
7332
|
+
if (node.operator === "&&") {
|
|
7333
|
+
const left2 = this.evaluate(node.left);
|
|
7334
|
+
return left2 ? this.evaluate(node.right) : left2;
|
|
7335
|
+
}
|
|
7336
|
+
if (node.operator === "||") {
|
|
7337
|
+
const left2 = this.evaluate(node.left);
|
|
7338
|
+
return left2 ? left2 : this.evaluate(node.right);
|
|
7339
|
+
}
|
|
7340
|
+
if (node.operator === "??") {
|
|
7341
|
+
const left2 = this.evaluate(node.left);
|
|
7342
|
+
return left2 ?? this.evaluate(node.right);
|
|
7343
|
+
}
|
|
7344
|
+
const left = this.evaluate(node.left);
|
|
7345
|
+
const right = this.evaluate(node.right);
|
|
7346
|
+
switch (node.operator) {
|
|
7347
|
+
// Arithmetic
|
|
7348
|
+
case "+":
|
|
7349
|
+
return left + right;
|
|
7350
|
+
case "-":
|
|
7351
|
+
return left - right;
|
|
7352
|
+
case "*":
|
|
7353
|
+
return left * right;
|
|
7354
|
+
case "/":
|
|
7355
|
+
if (right === 0) return null;
|
|
7356
|
+
return left / right;
|
|
7357
|
+
case "%":
|
|
7358
|
+
if (right === 0) return null;
|
|
7359
|
+
return left % right;
|
|
7360
|
+
// Comparison - using == and != intentionally for loose equality
|
|
7361
|
+
case "==":
|
|
7362
|
+
return left == right;
|
|
7363
|
+
case "===":
|
|
7364
|
+
return left === right;
|
|
7365
|
+
case "!=":
|
|
7366
|
+
return left != right;
|
|
7367
|
+
case "!==":
|
|
7368
|
+
return left !== right;
|
|
7369
|
+
case ">":
|
|
7370
|
+
return left > right;
|
|
7371
|
+
case "<":
|
|
7372
|
+
return left < right;
|
|
7373
|
+
case ">=":
|
|
7374
|
+
return left >= right;
|
|
7375
|
+
case "<=":
|
|
7376
|
+
return left <= right;
|
|
7377
|
+
default:
|
|
7378
|
+
throw new ExpressionParserError(`Unknown binary operator: ${node.operator}`, 0, this.expression);
|
|
7379
|
+
}
|
|
7380
|
+
}
|
|
7381
|
+
evaluateUnaryOp(node) {
|
|
7382
|
+
const operand = this.evaluate(node.operand);
|
|
7383
|
+
switch (node.operator) {
|
|
7384
|
+
case "!":
|
|
7385
|
+
return !operand;
|
|
7386
|
+
case "-":
|
|
7387
|
+
return -operand;
|
|
7388
|
+
case "+":
|
|
7389
|
+
return +operand;
|
|
7390
|
+
default:
|
|
7391
|
+
throw new ExpressionParserError(`Unknown unary operator: ${node.operator}`, 0, this.expression);
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7394
|
+
evaluateCallExpression(node) {
|
|
7395
|
+
if (node.callee.type !== "MemberAccess") {
|
|
7396
|
+
throw new ExpressionParserError("Only method calls are allowed, not arbitrary function calls", 0, this.expression);
|
|
7397
|
+
}
|
|
7398
|
+
const obj = this.evaluate(node.callee.object);
|
|
7399
|
+
if (obj === null || obj === void 0) {
|
|
7400
|
+
return void 0;
|
|
7401
|
+
}
|
|
7402
|
+
const methodName = node.callee.property;
|
|
7403
|
+
if (BLOCKED_PROPERTIES.has(methodName)) {
|
|
7404
|
+
throw new ExpressionParserError(`Property "${methodName}" is not accessible for security reasons`, 0, this.expression);
|
|
7405
|
+
}
|
|
7406
|
+
if (!this.isMethodSafe(obj, methodName)) {
|
|
7407
|
+
throw new ExpressionParserError(`Method "${methodName}" is not allowed for security reasons`, 0, this.expression);
|
|
7408
|
+
}
|
|
7409
|
+
const args = node.arguments.map((arg) => this.evaluate(arg));
|
|
7410
|
+
const method = obj[methodName];
|
|
7411
|
+
if (typeof method === "function") {
|
|
7412
|
+
return method.call(obj, ...args);
|
|
7413
|
+
}
|
|
7414
|
+
return void 0;
|
|
7415
|
+
}
|
|
7416
|
+
evaluateArrayLiteral(node) {
|
|
7417
|
+
return node.elements.map((element) => this.evaluate(element));
|
|
7418
|
+
}
|
|
7419
|
+
evaluateObjectLiteral(node) {
|
|
7420
|
+
const result = {};
|
|
7421
|
+
for (const { key, value } of node.properties) {
|
|
7422
|
+
if (BLOCKED_PROPERTIES.has(key)) {
|
|
7423
|
+
throw new ExpressionParserError(`Property "${key}" is not allowed in object literals for security reasons`, 0, this.expression);
|
|
7424
|
+
}
|
|
7425
|
+
result[key] = this.evaluate(value);
|
|
7426
|
+
}
|
|
7427
|
+
return result;
|
|
7428
|
+
}
|
|
7429
|
+
evaluateArrowFunction(node) {
|
|
7430
|
+
const parentScope = this.scope;
|
|
7431
|
+
const expression = this.expression;
|
|
7432
|
+
return (...args) => {
|
|
7433
|
+
const childScope = { ...parentScope };
|
|
7434
|
+
for (let i = 0; i < node.params.length; i++) {
|
|
7435
|
+
childScope[node.params[i]] = args[i];
|
|
7436
|
+
}
|
|
7437
|
+
const childEvaluator = new _Evaluator(childScope, expression);
|
|
7438
|
+
return childEvaluator.evaluate(node.body);
|
|
7439
|
+
};
|
|
7440
|
+
}
|
|
7441
|
+
isMethodSafe(obj, methodName) {
|
|
7442
|
+
if (obj === null || obj === void 0) {
|
|
7443
|
+
return false;
|
|
7444
|
+
}
|
|
7445
|
+
const type = Array.isArray(obj) ? "array" : obj instanceof Date ? "date" : typeof obj;
|
|
7446
|
+
const safeMethods = SAFE_METHODS[type];
|
|
7447
|
+
if (!safeMethods) {
|
|
7448
|
+
return false;
|
|
7449
|
+
}
|
|
7450
|
+
return safeMethods.has(methodName);
|
|
7451
|
+
}
|
|
7452
|
+
};
|
|
7453
|
+
|
|
7454
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/tokenizer.ts
|
|
7455
|
+
var IDENTIFIER_START = /[\p{ID_Start}$_]/u;
|
|
7456
|
+
var IDENTIFIER_PART = /[\p{ID_Continue}$]/u;
|
|
7457
|
+
var Tokenizer = class {
|
|
7458
|
+
position = 0;
|
|
7459
|
+
expression;
|
|
7460
|
+
constructor(expression) {
|
|
7461
|
+
this.expression = expression;
|
|
7462
|
+
}
|
|
7463
|
+
/** Tokenize the entire expression */
|
|
7464
|
+
tokenize() {
|
|
7465
|
+
const tokens = [];
|
|
7466
|
+
while (this.position < this.expression.length) {
|
|
7467
|
+
this.skipWhitespace();
|
|
7468
|
+
if (this.position >= this.expression.length) {
|
|
7469
|
+
break;
|
|
7470
|
+
}
|
|
7471
|
+
const token = this.nextToken();
|
|
7472
|
+
tokens.push(token);
|
|
7473
|
+
}
|
|
7474
|
+
tokens.push({ type: "EOF" /* EOF */, value: "", position: this.position });
|
|
7475
|
+
return tokens;
|
|
7476
|
+
}
|
|
7477
|
+
skipWhitespace() {
|
|
7478
|
+
while (this.position < this.expression.length && /\s/.test(this.expression[this.position])) {
|
|
7479
|
+
this.position++;
|
|
7480
|
+
}
|
|
7481
|
+
}
|
|
7482
|
+
nextToken() {
|
|
7483
|
+
const char = this.expression[this.position];
|
|
7484
|
+
if (char === '"' || char === "'") {
|
|
7485
|
+
return this.readString(char);
|
|
7486
|
+
}
|
|
7487
|
+
if (/[0-9]/.test(char)) {
|
|
7488
|
+
return this.readNumber();
|
|
7489
|
+
}
|
|
7490
|
+
if (IDENTIFIER_START.test(this.codePointAt(this.position))) {
|
|
7491
|
+
return this.readIdentifierOrKeyword();
|
|
7492
|
+
}
|
|
7493
|
+
return this.readOperatorOrPunctuation();
|
|
7494
|
+
}
|
|
7495
|
+
readString(quote) {
|
|
7496
|
+
const start = this.position;
|
|
7497
|
+
this.position++;
|
|
7498
|
+
let value = "";
|
|
7499
|
+
while (this.position < this.expression.length) {
|
|
7500
|
+
const char = this.expression[this.position];
|
|
7501
|
+
if (char === quote) {
|
|
7502
|
+
this.position++;
|
|
7503
|
+
return { type: "STRING" /* STRING */, value, position: start };
|
|
7504
|
+
}
|
|
7505
|
+
if (char === "\\" && this.position + 1 < this.expression.length) {
|
|
7506
|
+
this.position++;
|
|
7507
|
+
const nextChar = this.expression[this.position];
|
|
7508
|
+
switch (nextChar) {
|
|
7509
|
+
case "n":
|
|
7510
|
+
value += "\n";
|
|
7511
|
+
break;
|
|
7512
|
+
case "t":
|
|
7513
|
+
value += " ";
|
|
7514
|
+
break;
|
|
7515
|
+
case "r":
|
|
7516
|
+
value += "\r";
|
|
7517
|
+
break;
|
|
7518
|
+
case "\\":
|
|
7519
|
+
value += "\\";
|
|
7520
|
+
break;
|
|
7521
|
+
case quote:
|
|
7522
|
+
value += quote;
|
|
7523
|
+
break;
|
|
7524
|
+
default:
|
|
7525
|
+
value += nextChar;
|
|
7526
|
+
}
|
|
7527
|
+
this.position++;
|
|
7528
|
+
} else {
|
|
7529
|
+
value += char;
|
|
7530
|
+
this.position++;
|
|
7531
|
+
}
|
|
7532
|
+
}
|
|
7533
|
+
throw new ExpressionParserError("Unterminated string literal", start, this.expression);
|
|
7534
|
+
}
|
|
7535
|
+
readNumber() {
|
|
7536
|
+
const start = this.position;
|
|
7537
|
+
let value = "";
|
|
7538
|
+
while (this.position < this.expression.length && /[0-9.]/.test(this.expression[this.position])) {
|
|
7539
|
+
value += this.expression[this.position];
|
|
7540
|
+
this.position++;
|
|
7541
|
+
}
|
|
7542
|
+
if (!/^\d+(\.\d+)?$/.test(value)) {
|
|
7543
|
+
throw new ExpressionParserError(`Invalid number: ${value}`, start, this.expression);
|
|
7544
|
+
}
|
|
7545
|
+
return { type: "NUMBER" /* NUMBER */, value, position: start };
|
|
7546
|
+
}
|
|
7547
|
+
readIdentifierOrKeyword() {
|
|
7548
|
+
const start = this.position;
|
|
7549
|
+
let value = "";
|
|
7550
|
+
while (this.position < this.expression.length) {
|
|
7551
|
+
const char = this.codePointAt(this.position);
|
|
7552
|
+
if (!IDENTIFIER_PART.test(char)) {
|
|
7553
|
+
break;
|
|
7554
|
+
}
|
|
7555
|
+
value += char;
|
|
7556
|
+
this.position += char.length;
|
|
7557
|
+
}
|
|
7558
|
+
const type = this.getKeywordType(value);
|
|
7559
|
+
return { type, value, position: start };
|
|
7560
|
+
}
|
|
7561
|
+
/** Reads the whole code point at `position`, keeping surrogate pairs intact. */
|
|
7562
|
+
codePointAt(position) {
|
|
7563
|
+
const codePoint = this.expression.codePointAt(position);
|
|
7564
|
+
return codePoint === void 0 ? "" : String.fromCodePoint(codePoint);
|
|
7565
|
+
}
|
|
7566
|
+
getKeywordType(value) {
|
|
7567
|
+
switch (value) {
|
|
7568
|
+
case "true":
|
|
7569
|
+
return "TRUE" /* TRUE */;
|
|
7570
|
+
case "false":
|
|
7571
|
+
return "FALSE" /* FALSE */;
|
|
7572
|
+
case "null":
|
|
7573
|
+
return "NULL" /* NULL */;
|
|
7574
|
+
case "undefined":
|
|
7575
|
+
return "UNDEFINED" /* UNDEFINED */;
|
|
7576
|
+
default:
|
|
7577
|
+
return "IDENTIFIER" /* IDENTIFIER */;
|
|
7578
|
+
}
|
|
7579
|
+
}
|
|
7580
|
+
readOperatorOrPunctuation() {
|
|
7581
|
+
const start = this.position;
|
|
7582
|
+
const char = this.expression[this.position];
|
|
7583
|
+
const nextChar = this.position + 1 < this.expression.length ? this.expression[this.position + 1] : "";
|
|
7584
|
+
const thirdChar = this.position + 2 < this.expression.length ? this.expression[this.position + 2] : "";
|
|
7585
|
+
const threeChar = char + nextChar + thirdChar;
|
|
7586
|
+
if (threeChar === "===") {
|
|
7587
|
+
this.position += 3;
|
|
7588
|
+
return { type: "EQUAL" /* EQUAL */, value: "===", position: start };
|
|
7589
|
+
}
|
|
7590
|
+
if (threeChar === "!==") {
|
|
7591
|
+
this.position += 3;
|
|
7592
|
+
return { type: "NOT_EQUAL" /* NOT_EQUAL */, value: "!==", position: start };
|
|
7593
|
+
}
|
|
7594
|
+
const twoChar = char + nextChar;
|
|
7595
|
+
switch (twoChar) {
|
|
7596
|
+
case "==":
|
|
7597
|
+
this.position += 2;
|
|
7598
|
+
return { type: "EQUAL" /* EQUAL */, value: "==", position: start };
|
|
7599
|
+
case "!=":
|
|
7600
|
+
this.position += 2;
|
|
7601
|
+
return { type: "NOT_EQUAL" /* NOT_EQUAL */, value: "!=", position: start };
|
|
7602
|
+
case ">=":
|
|
7603
|
+
this.position += 2;
|
|
7604
|
+
return { type: "GREATER_EQUAL" /* GREATER_EQUAL */, value: ">=", position: start };
|
|
7605
|
+
case "<=":
|
|
7606
|
+
this.position += 2;
|
|
7607
|
+
return { type: "LESS_EQUAL" /* LESS_EQUAL */, value: "<=", position: start };
|
|
7608
|
+
case "&&":
|
|
7609
|
+
this.position += 2;
|
|
7610
|
+
return { type: "AND" /* AND */, value: "&&", position: start };
|
|
7611
|
+
case "||":
|
|
7612
|
+
this.position += 2;
|
|
7613
|
+
return { type: "OR" /* OR */, value: "||", position: start };
|
|
7614
|
+
case "=>":
|
|
7615
|
+
this.position += 2;
|
|
7616
|
+
return { type: "ARROW" /* ARROW */, value: "=>", position: start };
|
|
7617
|
+
case "??":
|
|
7618
|
+
this.position += 2;
|
|
7619
|
+
return { type: "NULLISH" /* NULLISH */, value: "??", position: start };
|
|
7620
|
+
case "?.":
|
|
7621
|
+
this.position += 2;
|
|
7622
|
+
return { type: "OPTIONAL_DOT" /* OPTIONAL_DOT */, value: "?.", position: start };
|
|
7623
|
+
}
|
|
7624
|
+
this.position++;
|
|
7625
|
+
switch (char) {
|
|
7626
|
+
case "+":
|
|
7627
|
+
return { type: "PLUS" /* PLUS */, value: "+", position: start };
|
|
7628
|
+
case "-":
|
|
7629
|
+
return { type: "MINUS" /* MINUS */, value: "-", position: start };
|
|
7630
|
+
case "*":
|
|
7631
|
+
return { type: "MULTIPLY" /* MULTIPLY */, value: "*", position: start };
|
|
7632
|
+
case "/":
|
|
7633
|
+
return { type: "DIVIDE" /* DIVIDE */, value: "/", position: start };
|
|
7634
|
+
case "%":
|
|
7635
|
+
return { type: "MODULO" /* MODULO */, value: "%", position: start };
|
|
7636
|
+
case ">":
|
|
7637
|
+
return { type: "GREATER" /* GREATER */, value: ">", position: start };
|
|
7638
|
+
case "<":
|
|
7639
|
+
return { type: "LESS" /* LESS */, value: "<", position: start };
|
|
7640
|
+
case "!":
|
|
7641
|
+
return { type: "NOT" /* NOT */, value: "!", position: start };
|
|
7642
|
+
case ".":
|
|
7643
|
+
return { type: "DOT" /* DOT */, value: ".", position: start };
|
|
7644
|
+
case ",":
|
|
7645
|
+
return { type: "COMMA" /* COMMA */, value: ",", position: start };
|
|
7646
|
+
case ":":
|
|
7647
|
+
return { type: "COLON" /* COLON */, value: ":", position: start };
|
|
7648
|
+
case "(":
|
|
7649
|
+
return { type: "LPAREN" /* LPAREN */, value: "(", position: start };
|
|
7650
|
+
case ")":
|
|
7651
|
+
return { type: "RPAREN" /* RPAREN */, value: ")", position: start };
|
|
7652
|
+
case "[":
|
|
7653
|
+
return { type: "LBRACKET" /* LBRACKET */, value: "[", position: start };
|
|
7654
|
+
case "]":
|
|
7655
|
+
return { type: "RBRACKET" /* RBRACKET */, value: "]", position: start };
|
|
7656
|
+
case "{":
|
|
7657
|
+
return { type: "LBRACE" /* LBRACE */, value: "{", position: start };
|
|
7658
|
+
case "}":
|
|
7659
|
+
return { type: "RBRACE" /* RBRACE */, value: "}", position: start };
|
|
7660
|
+
case "?":
|
|
7661
|
+
return { type: "QUESTION" /* QUESTION */, value: "?", position: start };
|
|
7662
|
+
default:
|
|
7663
|
+
throw new ExpressionParserError(`Unexpected character: ${char}`, start, this.expression);
|
|
7664
|
+
}
|
|
7665
|
+
}
|
|
7666
|
+
};
|
|
7667
|
+
|
|
7668
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/parser.ts
|
|
7669
|
+
var Parser = class {
|
|
7670
|
+
tokens = [];
|
|
7671
|
+
current = 0;
|
|
7672
|
+
expression;
|
|
7673
|
+
constructor(expression) {
|
|
7674
|
+
this.expression = expression;
|
|
7675
|
+
}
|
|
7676
|
+
/** Parse the expression into an AST */
|
|
7677
|
+
parse() {
|
|
7678
|
+
const tokenizer = new Tokenizer(this.expression);
|
|
7679
|
+
this.tokens = tokenizer.tokenize();
|
|
7680
|
+
this.current = 0;
|
|
7681
|
+
if (this.isAtEnd()) {
|
|
7682
|
+
throw new ExpressionParserError("Empty expression", 0, this.expression);
|
|
7683
|
+
}
|
|
7684
|
+
const result = this.parseExpression();
|
|
7685
|
+
if (!this.isAtEnd()) {
|
|
7686
|
+
const token = this.peek();
|
|
7687
|
+
throw new ExpressionParserError(
|
|
7688
|
+
`Unexpected token '${token.value}' at position ${token.position} \u2014 expression has trailing content`,
|
|
7689
|
+
token.position,
|
|
7690
|
+
this.expression
|
|
7691
|
+
);
|
|
7692
|
+
}
|
|
7693
|
+
return result;
|
|
7694
|
+
}
|
|
7695
|
+
parseExpression() {
|
|
7696
|
+
const arrow = this.tryParseArrowFunction();
|
|
7697
|
+
if (arrow) return arrow;
|
|
7698
|
+
return this.parseConditional();
|
|
7699
|
+
}
|
|
7700
|
+
/**
|
|
7701
|
+
* Ternary `test ? consequent : alternate` — right-associative, sits between
|
|
7702
|
+
* the arrow-function check and logical-or in precedence.
|
|
7703
|
+
*/
|
|
7704
|
+
parseConditional() {
|
|
7705
|
+
const test = this.parseShortCircuit();
|
|
7706
|
+
if (!this.match("QUESTION" /* QUESTION */)) return test;
|
|
7707
|
+
const consequent = this.parseExpression();
|
|
7708
|
+
this.consume("COLON" /* COLON */, 'Expected ":" between ternary branches');
|
|
7709
|
+
const alternate = this.parseExpression();
|
|
7710
|
+
return { type: "Conditional", test, consequent, alternate };
|
|
7711
|
+
}
|
|
7712
|
+
/**
|
|
7713
|
+
* Attempts to parse an arrow function. Returns null and leaves position
|
|
7714
|
+
* unchanged if the next tokens don't form an arrow function head.
|
|
7715
|
+
*/
|
|
7716
|
+
tryParseArrowFunction() {
|
|
7717
|
+
const savedPos = this.current;
|
|
7718
|
+
if (this.check("IDENTIFIER" /* IDENTIFIER */) && this.checkAt(this.current + 1, "ARROW" /* ARROW */)) {
|
|
7719
|
+
const param = this.advance().value;
|
|
7720
|
+
this.advance();
|
|
7721
|
+
const body = this.parseExpression();
|
|
7722
|
+
return { type: "ArrowFunction", params: [param], body };
|
|
7723
|
+
}
|
|
7724
|
+
if (this.check("LPAREN" /* LPAREN */)) {
|
|
7725
|
+
this.advance();
|
|
7726
|
+
const params = [];
|
|
7727
|
+
if (this.check("RPAREN" /* RPAREN */)) {
|
|
7728
|
+
this.advance();
|
|
7729
|
+
} else if (this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7730
|
+
params.push(this.advance().value);
|
|
7731
|
+
while (this.check("COMMA" /* COMMA */)) {
|
|
7732
|
+
this.advance();
|
|
7733
|
+
if (!this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7734
|
+
this.current = savedPos;
|
|
7735
|
+
return null;
|
|
7736
|
+
}
|
|
7737
|
+
params.push(this.advance().value);
|
|
7738
|
+
}
|
|
7739
|
+
if (!this.check("RPAREN" /* RPAREN */)) {
|
|
7740
|
+
this.current = savedPos;
|
|
7741
|
+
return null;
|
|
7742
|
+
}
|
|
7743
|
+
this.advance();
|
|
7744
|
+
} else {
|
|
7745
|
+
this.current = savedPos;
|
|
7746
|
+
return null;
|
|
7747
|
+
}
|
|
7748
|
+
if (!this.check("ARROW" /* ARROW */)) {
|
|
7749
|
+
this.current = savedPos;
|
|
7750
|
+
return null;
|
|
7751
|
+
}
|
|
7752
|
+
this.advance();
|
|
7753
|
+
const body = this.parseExpression();
|
|
7754
|
+
return { type: "ArrowFunction", params, body };
|
|
7755
|
+
}
|
|
7756
|
+
return null;
|
|
7757
|
+
}
|
|
7758
|
+
checkAt(index, type) {
|
|
7759
|
+
if (index < 0 || index >= this.tokens.length) return false;
|
|
7760
|
+
return this.tokens[index].type === type;
|
|
7761
|
+
}
|
|
7762
|
+
/**
|
|
7763
|
+
* `a ?? b` or an `||`/`&&` chain. As in JavaScript, `??` can't be mixed with
|
|
7764
|
+
* `&&` or `||` without parentheses.
|
|
7765
|
+
*/
|
|
7766
|
+
parseShortCircuit() {
|
|
7767
|
+
const first = this.parseEquality();
|
|
7768
|
+
if (!this.check("NULLISH" /* NULLISH */)) {
|
|
7769
|
+
const node2 = this.parseLogicalOr(first);
|
|
7770
|
+
if (this.check("NULLISH" /* NULLISH */)) this.throwMixedNullish();
|
|
7771
|
+
return node2;
|
|
7772
|
+
}
|
|
7773
|
+
let node = first;
|
|
7774
|
+
while (this.match("NULLISH" /* NULLISH */)) {
|
|
7775
|
+
node = { type: "BinaryOp", operator: "??", left: node, right: this.parseEquality() };
|
|
7776
|
+
}
|
|
7777
|
+
if (this.check("AND" /* AND */) || this.check("OR" /* OR */)) this.throwMixedNullish();
|
|
7778
|
+
return node;
|
|
7779
|
+
}
|
|
7780
|
+
throwMixedNullish() {
|
|
7781
|
+
throw new ExpressionParserError('Cannot mix "??" with "&&" or "||" without parentheses', this.peek().position, this.expression);
|
|
7782
|
+
}
|
|
7783
|
+
parseLogicalOr(first) {
|
|
7784
|
+
let node = this.parseLogicalAnd(first);
|
|
7785
|
+
while (this.match("OR" /* OR */)) {
|
|
7786
|
+
const operator = this.previous().value;
|
|
7787
|
+
const right = this.parseLogicalAnd();
|
|
7788
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7789
|
+
}
|
|
7790
|
+
return node;
|
|
7791
|
+
}
|
|
7792
|
+
parseLogicalAnd(first) {
|
|
7793
|
+
let node = first ?? this.parseEquality();
|
|
7794
|
+
while (this.match("AND" /* AND */)) {
|
|
7795
|
+
const operator = this.previous().value;
|
|
7796
|
+
const right = this.parseEquality();
|
|
7797
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7798
|
+
}
|
|
7799
|
+
return node;
|
|
7800
|
+
}
|
|
7801
|
+
parseEquality() {
|
|
7802
|
+
let node = this.parseComparison();
|
|
7803
|
+
while (this.match("EQUAL" /* EQUAL */, "NOT_EQUAL" /* NOT_EQUAL */)) {
|
|
7804
|
+
const operator = this.previous().value;
|
|
7805
|
+
const right = this.parseComparison();
|
|
7806
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7807
|
+
}
|
|
7808
|
+
return node;
|
|
7809
|
+
}
|
|
7810
|
+
parseComparison() {
|
|
7811
|
+
let node = this.parseAddition();
|
|
7812
|
+
while (this.match("GREATER" /* GREATER */, "GREATER_EQUAL" /* GREATER_EQUAL */, "LESS" /* LESS */, "LESS_EQUAL" /* LESS_EQUAL */)) {
|
|
7813
|
+
const operator = this.previous().value;
|
|
7814
|
+
const right = this.parseAddition();
|
|
7815
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7816
|
+
}
|
|
7817
|
+
return node;
|
|
7818
|
+
}
|
|
7819
|
+
parseAddition() {
|
|
7820
|
+
let node = this.parseMultiplication();
|
|
7821
|
+
while (this.match("PLUS" /* PLUS */, "MINUS" /* MINUS */)) {
|
|
7822
|
+
const operator = this.previous().value;
|
|
7823
|
+
const right = this.parseMultiplication();
|
|
7824
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7825
|
+
}
|
|
7826
|
+
return node;
|
|
7827
|
+
}
|
|
7828
|
+
parseMultiplication() {
|
|
7829
|
+
let node = this.parseUnary();
|
|
7830
|
+
while (this.match("MULTIPLY" /* MULTIPLY */, "DIVIDE" /* DIVIDE */, "MODULO" /* MODULO */)) {
|
|
7831
|
+
const operator = this.previous().value;
|
|
7832
|
+
const right = this.parseUnary();
|
|
7833
|
+
node = { type: "BinaryOp", operator, left: node, right };
|
|
7834
|
+
}
|
|
7835
|
+
return node;
|
|
7836
|
+
}
|
|
7837
|
+
parseUnary() {
|
|
7838
|
+
if (this.match("NOT" /* NOT */, "MINUS" /* MINUS */, "PLUS" /* PLUS */)) {
|
|
7839
|
+
const operator = this.previous().value;
|
|
7840
|
+
const operand = this.parseUnary();
|
|
7841
|
+
return { type: "UnaryOp", operator, operand };
|
|
7842
|
+
}
|
|
7843
|
+
return this.parsePostfix();
|
|
7844
|
+
}
|
|
7845
|
+
parsePostfix() {
|
|
7846
|
+
let node = this.parsePrimary();
|
|
7847
|
+
while (true) {
|
|
7848
|
+
if (this.match("DOT" /* DOT */)) {
|
|
7849
|
+
if (!this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7850
|
+
throw new ExpressionParserError('Expected property name after "."', this.peek().position, this.expression);
|
|
7851
|
+
}
|
|
7852
|
+
const property = this.advance().value;
|
|
7853
|
+
node = { type: "MemberAccess", object: node, property };
|
|
7854
|
+
} else if (this.match("OPTIONAL_DOT" /* OPTIONAL_DOT */)) {
|
|
7855
|
+
if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7856
|
+
const property = this.parseExpression();
|
|
7857
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after computed property');
|
|
7858
|
+
node = { type: "ComputedMemberAccess", object: node, property, optional: true };
|
|
7859
|
+
} else if (this.match("LPAREN" /* LPAREN */)) {
|
|
7860
|
+
const args = this.parseArgumentList();
|
|
7861
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after arguments');
|
|
7862
|
+
node = { type: "CallExpression", callee: node, arguments: args, optional: true };
|
|
7863
|
+
} else if (this.check("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7864
|
+
const property = this.advance().value;
|
|
7865
|
+
node = { type: "MemberAccess", object: node, property, optional: true };
|
|
7866
|
+
} else {
|
|
7867
|
+
throw new ExpressionParserError('Expected property name, "[", or "(" after "?."', this.peek().position, this.expression);
|
|
7868
|
+
}
|
|
7869
|
+
} else if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7870
|
+
const property = this.parseExpression();
|
|
7871
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after computed property');
|
|
7872
|
+
node = { type: "ComputedMemberAccess", object: node, property };
|
|
7873
|
+
} else if (this.match("LPAREN" /* LPAREN */)) {
|
|
7874
|
+
const args = this.parseArgumentList();
|
|
7875
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after arguments');
|
|
7876
|
+
node = { type: "CallExpression", callee: node, arguments: args };
|
|
7877
|
+
} else {
|
|
7878
|
+
break;
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
return node;
|
|
7882
|
+
}
|
|
7883
|
+
parsePrimary() {
|
|
7884
|
+
if (this.match("TRUE" /* TRUE */)) {
|
|
7885
|
+
return { type: "Literal", value: true };
|
|
7886
|
+
}
|
|
7887
|
+
if (this.match("FALSE" /* FALSE */)) {
|
|
7888
|
+
return { type: "Literal", value: false };
|
|
7889
|
+
}
|
|
7890
|
+
if (this.match("NULL" /* NULL */)) {
|
|
7891
|
+
return { type: "Literal", value: null };
|
|
7892
|
+
}
|
|
7893
|
+
if (this.match("UNDEFINED" /* UNDEFINED */)) {
|
|
7894
|
+
return { type: "Literal", value: void 0 };
|
|
7895
|
+
}
|
|
7896
|
+
if (this.match("NUMBER" /* NUMBER */)) {
|
|
7897
|
+
return { type: "Literal", value: parseFloat(this.previous().value) };
|
|
7898
|
+
}
|
|
7899
|
+
if (this.match("STRING" /* STRING */)) {
|
|
7900
|
+
return { type: "Literal", value: this.previous().value };
|
|
7901
|
+
}
|
|
7902
|
+
if (this.match("LBRACKET" /* LBRACKET */)) {
|
|
7903
|
+
const elements = this.parseArrayElements();
|
|
7904
|
+
this.consume("RBRACKET" /* RBRACKET */, 'Expected "]" after array elements');
|
|
7905
|
+
return { type: "ArrayLiteral", elements };
|
|
7906
|
+
}
|
|
7907
|
+
if (this.match("LBRACE" /* LBRACE */)) {
|
|
7908
|
+
const properties = this.parseObjectProperties();
|
|
7909
|
+
this.consume("RBRACE" /* RBRACE */, 'Expected "}" after object properties');
|
|
7910
|
+
return { type: "ObjectLiteral", properties };
|
|
7911
|
+
}
|
|
7912
|
+
if (this.match("IDENTIFIER" /* IDENTIFIER */)) {
|
|
7913
|
+
return { type: "Identifier", name: this.previous().value };
|
|
7914
|
+
}
|
|
7915
|
+
if (this.match("LPAREN" /* LPAREN */)) {
|
|
7916
|
+
const expr = this.parseExpression();
|
|
7917
|
+
this.consume("RPAREN" /* RPAREN */, 'Expected ")" after expression');
|
|
7918
|
+
return expr;
|
|
7919
|
+
}
|
|
7920
|
+
throw new ExpressionParserError(`Unexpected token: ${this.peek().value}`, this.peek().position, this.expression);
|
|
7921
|
+
}
|
|
7922
|
+
parseArgumentList() {
|
|
7923
|
+
const args = [];
|
|
7924
|
+
if (!this.check("RPAREN" /* RPAREN */)) {
|
|
7925
|
+
do {
|
|
7926
|
+
args.push(this.parseExpression());
|
|
7927
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
7928
|
+
}
|
|
7929
|
+
return args;
|
|
7930
|
+
}
|
|
7931
|
+
parseArrayElements() {
|
|
7932
|
+
const elements = [];
|
|
7933
|
+
if (!this.check("RBRACKET" /* RBRACKET */)) {
|
|
7934
|
+
do {
|
|
7935
|
+
elements.push(this.parseExpression());
|
|
7936
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
7937
|
+
}
|
|
7938
|
+
return elements;
|
|
7939
|
+
}
|
|
7940
|
+
parseObjectProperties() {
|
|
7941
|
+
const properties = [];
|
|
7942
|
+
if (this.check("RBRACE" /* RBRACE */)) {
|
|
7943
|
+
return properties;
|
|
7944
|
+
}
|
|
7945
|
+
do {
|
|
7946
|
+
if (this.check("RBRACE" /* RBRACE */)) break;
|
|
7947
|
+
let key;
|
|
7948
|
+
if (this.check("IDENTIFIER" /* IDENTIFIER */) || this.check("STRING" /* STRING */)) {
|
|
7949
|
+
key = this.advance().value;
|
|
7950
|
+
} else {
|
|
7951
|
+
throw new ExpressionParserError(
|
|
7952
|
+
`Expected property name (identifier or string) in object literal, got '${this.peek().value}'`,
|
|
7953
|
+
this.peek().position,
|
|
7954
|
+
this.expression
|
|
7955
|
+
);
|
|
7956
|
+
}
|
|
7957
|
+
this.consume("COLON" /* COLON */, 'Expected ":" after property name in object literal');
|
|
7958
|
+
const value = this.parseExpression();
|
|
7959
|
+
properties.push({ key, value });
|
|
7960
|
+
} while (this.match("COMMA" /* COMMA */));
|
|
7961
|
+
return properties;
|
|
7962
|
+
}
|
|
7963
|
+
match(...types) {
|
|
7964
|
+
for (const type of types) {
|
|
7965
|
+
if (this.check(type)) {
|
|
7966
|
+
this.advance();
|
|
7967
|
+
return true;
|
|
7968
|
+
}
|
|
7969
|
+
}
|
|
7970
|
+
return false;
|
|
7971
|
+
}
|
|
7972
|
+
check(type) {
|
|
7973
|
+
if (this.isAtEnd()) return false;
|
|
7974
|
+
return this.peek().type === type;
|
|
7975
|
+
}
|
|
7976
|
+
advance() {
|
|
7977
|
+
if (!this.isAtEnd()) this.current++;
|
|
7978
|
+
return this.previous();
|
|
7979
|
+
}
|
|
7980
|
+
isAtEnd() {
|
|
7981
|
+
return this.peek().type === "EOF" /* EOF */;
|
|
7982
|
+
}
|
|
7983
|
+
peek() {
|
|
7984
|
+
return this.tokens[this.current];
|
|
7985
|
+
}
|
|
7986
|
+
previous() {
|
|
7987
|
+
return this.tokens[this.current - 1];
|
|
7988
|
+
}
|
|
7989
|
+
consume(type, message) {
|
|
7990
|
+
if (this.check(type)) return this.advance();
|
|
7991
|
+
throw new ExpressionParserError(message, this.peek().position, this.expression);
|
|
7992
|
+
}
|
|
7993
|
+
};
|
|
7994
|
+
|
|
7995
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/expression-parser.ts
|
|
7996
|
+
var MAX_AST_CACHE_SIZE = 1e3;
|
|
7997
|
+
var LRUCache = class {
|
|
7998
|
+
cache = /* @__PURE__ */ new Map();
|
|
7999
|
+
maxSize;
|
|
8000
|
+
constructor(maxSize) {
|
|
8001
|
+
this.maxSize = maxSize;
|
|
8002
|
+
}
|
|
8003
|
+
get(key) {
|
|
8004
|
+
const value = this.cache.get(key);
|
|
8005
|
+
if (value !== void 0) {
|
|
8006
|
+
this.cache.delete(key);
|
|
8007
|
+
this.cache.set(key, value);
|
|
8008
|
+
}
|
|
8009
|
+
return value;
|
|
8010
|
+
}
|
|
8011
|
+
set(key, value) {
|
|
8012
|
+
if (this.cache.has(key)) {
|
|
8013
|
+
this.cache.delete(key);
|
|
8014
|
+
}
|
|
8015
|
+
this.cache.set(key, value);
|
|
8016
|
+
if (this.cache.size > this.maxSize) {
|
|
8017
|
+
const firstKey = this.cache.keys().next().value;
|
|
8018
|
+
if (firstKey !== void 0) {
|
|
8019
|
+
this.cache.delete(firstKey);
|
|
8020
|
+
}
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
8023
|
+
clear() {
|
|
8024
|
+
this.cache.clear();
|
|
8025
|
+
}
|
|
8026
|
+
get size() {
|
|
8027
|
+
return this.cache.size;
|
|
8028
|
+
}
|
|
8029
|
+
};
|
|
8030
|
+
var astCache = new LRUCache(MAX_AST_CACHE_SIZE);
|
|
8031
|
+
var ExpressionParser = class {
|
|
8032
|
+
/**
|
|
8033
|
+
* Parse an expression string into an AST
|
|
8034
|
+
* Results are cached for performance using LRU eviction
|
|
8035
|
+
*/
|
|
8036
|
+
static parse(expression) {
|
|
8037
|
+
const cached = astCache.get(expression);
|
|
8038
|
+
if (cached) {
|
|
8039
|
+
return cached;
|
|
8040
|
+
}
|
|
8041
|
+
const parser = new Parser(expression);
|
|
8042
|
+
const ast = parser.parse();
|
|
8043
|
+
astCache.set(expression, ast);
|
|
8044
|
+
return ast;
|
|
8045
|
+
}
|
|
8046
|
+
/** Evaluate an expression with a given scope */
|
|
8047
|
+
static evaluate(expression, scope) {
|
|
8048
|
+
try {
|
|
8049
|
+
const ast = this.parse(expression);
|
|
8050
|
+
const evaluator = new Evaluator(scope, expression);
|
|
8051
|
+
return evaluator.evaluate(ast);
|
|
8052
|
+
} catch (error) {
|
|
8053
|
+
if (error instanceof ExpressionParserError) {
|
|
8054
|
+
throw error;
|
|
8055
|
+
}
|
|
8056
|
+
throw new ExpressionParserError(
|
|
8057
|
+
`Error evaluating expression: ${error instanceof Error ? error.message : String(error)}`,
|
|
8058
|
+
0,
|
|
8059
|
+
expression
|
|
8060
|
+
);
|
|
8061
|
+
}
|
|
8062
|
+
}
|
|
8063
|
+
/** Clear the AST cache */
|
|
8064
|
+
static clearCache() {
|
|
8065
|
+
astCache.clear();
|
|
8066
|
+
}
|
|
8067
|
+
/** Get cache statistics */
|
|
8068
|
+
static getCacheStats() {
|
|
8069
|
+
return {
|
|
8070
|
+
size: astCache.size,
|
|
8071
|
+
maxSize: MAX_AST_CACHE_SIZE
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
8074
|
+
};
|
|
8075
|
+
|
|
8076
|
+
// packages/dynamic-forms/internal/src/lib/core/expressions/parser/static-check.ts
|
|
8077
|
+
var CONDITION_SCOPE_VARIABLES = /* @__PURE__ */ new Set([
|
|
8078
|
+
"fieldValue",
|
|
8079
|
+
"formValue",
|
|
8080
|
+
"fieldPath",
|
|
8081
|
+
"customFunctions",
|
|
8082
|
+
"groupValue",
|
|
8083
|
+
"rootFormValue",
|
|
8084
|
+
"arrayIndex",
|
|
8085
|
+
"arrayPath",
|
|
8086
|
+
"externalData",
|
|
8087
|
+
"fieldState",
|
|
8088
|
+
"formFieldState"
|
|
8089
|
+
]);
|
|
8090
|
+
function findStaticExpressionProblems(ast, scope) {
|
|
8091
|
+
const problems = /* @__PURE__ */ new Set();
|
|
8092
|
+
const visit2 = (node, locals) => {
|
|
8093
|
+
switch (node.type) {
|
|
8094
|
+
case "Identifier":
|
|
8095
|
+
if (!scope.has(node.name) && !locals.has(node.name)) problems.add(`'${node.name}' is not available in expressions`);
|
|
8096
|
+
return;
|
|
8097
|
+
case "MemberAccess":
|
|
8098
|
+
visit2(node.object, locals);
|
|
8099
|
+
return;
|
|
8100
|
+
case "ComputedMemberAccess":
|
|
8101
|
+
visit2(node.object, locals);
|
|
8102
|
+
visit2(node.property, locals);
|
|
8103
|
+
return;
|
|
8104
|
+
case "CallExpression":
|
|
8105
|
+
if (node.callee.type === "MemberAccess") {
|
|
8106
|
+
if (!ALLOWED_METHOD_NAMES.has(node.callee.property)) problems.add(`method '${node.callee.property}' is not allowed`);
|
|
8107
|
+
} else {
|
|
8108
|
+
problems.add(`'${describeCallee(node.callee)}(...)' is a direct function call; only allowed methods can be called`);
|
|
8109
|
+
}
|
|
8110
|
+
visit2(node.callee.type === "MemberAccess" ? node.callee.object : node.callee, locals);
|
|
8111
|
+
node.arguments.forEach((arg) => visit2(arg, locals));
|
|
8112
|
+
return;
|
|
8113
|
+
case "BinaryOp":
|
|
8114
|
+
visit2(node.left, locals);
|
|
8115
|
+
visit2(node.right, locals);
|
|
8116
|
+
return;
|
|
8117
|
+
case "UnaryOp":
|
|
8118
|
+
visit2(node.operand, locals);
|
|
8119
|
+
return;
|
|
8120
|
+
case "Conditional":
|
|
8121
|
+
visit2(node.test, locals);
|
|
8122
|
+
visit2(node.consequent, locals);
|
|
8123
|
+
visit2(node.alternate, locals);
|
|
8124
|
+
return;
|
|
8125
|
+
case "ArrayLiteral":
|
|
8126
|
+
node.elements.forEach((element) => visit2(element, locals));
|
|
8127
|
+
return;
|
|
8128
|
+
case "ObjectLiteral":
|
|
8129
|
+
node.properties.forEach((property) => visit2(property.value, locals));
|
|
8130
|
+
return;
|
|
8131
|
+
case "ArrowFunction":
|
|
8132
|
+
visit2(node.body, /* @__PURE__ */ new Set([...locals, ...node.params]));
|
|
8133
|
+
return;
|
|
8134
|
+
case "Literal":
|
|
8135
|
+
return;
|
|
8136
|
+
}
|
|
8137
|
+
};
|
|
8138
|
+
visit2(ast, /* @__PURE__ */ new Set());
|
|
8139
|
+
return [...problems];
|
|
8140
|
+
}
|
|
8141
|
+
function describeCallee(node) {
|
|
8142
|
+
return node.type === "Identifier" ? node.name : "expression";
|
|
8143
|
+
}
|
|
8144
|
+
function findFieldExpressionProblems(field) {
|
|
8145
|
+
const found = [];
|
|
8146
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
8147
|
+
const check = (expression, path) => {
|
|
8148
|
+
let problems;
|
|
8149
|
+
try {
|
|
8150
|
+
problems = findStaticExpressionProblems(ExpressionParser.parse(expression), CONDITION_SCOPE_VARIABLES);
|
|
8151
|
+
} catch (e) {
|
|
8152
|
+
problems = [e instanceof Error ? e.message : String(e)];
|
|
8153
|
+
}
|
|
8154
|
+
if (problems.length > 0) found.push({ path, expression, message: problems.join("; ") });
|
|
8155
|
+
};
|
|
8156
|
+
const visit2 = (node, path) => {
|
|
8157
|
+
if (node === null || typeof node !== "object" || seen.has(node)) return;
|
|
8158
|
+
seen.add(node);
|
|
8159
|
+
if (Array.isArray(node)) {
|
|
8160
|
+
node.forEach((item, i) => visit2(item, `${path}[${i}]`));
|
|
8161
|
+
return;
|
|
8162
|
+
}
|
|
8163
|
+
const record = node;
|
|
8164
|
+
const type = record["type"];
|
|
8165
|
+
if ((type === "javascript" || type === "derivation") && typeof record["expression"] === "string") {
|
|
8166
|
+
check(record["expression"], path);
|
|
8167
|
+
}
|
|
8168
|
+
if ((type === "and" || type === "or") && Array.isArray(record["conditions"]) && record["conditions"].length === 0) {
|
|
8169
|
+
found.push({ path, message: `an empty '${type}' group never fires` });
|
|
8170
|
+
}
|
|
8171
|
+
for (const [key, value] of Object.entries(record)) {
|
|
8172
|
+
if (key !== "fields") visit2(value, path ? `${path}.${key}` : key);
|
|
8173
|
+
}
|
|
8174
|
+
};
|
|
8175
|
+
if (field !== null && typeof field === "object" && typeof field["derivation"] === "string") {
|
|
8176
|
+
check(field["derivation"], "derivation");
|
|
8177
|
+
}
|
|
8178
|
+
visit2(field, "");
|
|
8179
|
+
return found;
|
|
8180
|
+
}
|
|
8181
|
+
|
|
7109
8182
|
// internal/dynamic-forms-validation/validate/src/tools/validate-config.tool.ts
|
|
7110
8183
|
var formConfigSchemas = {
|
|
7111
8184
|
material: MatFormConfigSchema,
|
|
@@ -7369,11 +8442,22 @@ function preValidateConfig(config) {
|
|
|
7369
8442
|
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"`
|
|
7370
8443
|
});
|
|
7371
8444
|
}
|
|
8445
|
+
const reportedExpressions = /* @__PURE__ */ new Set();
|
|
7372
8446
|
function checkField(field, path, parentType) {
|
|
7373
8447
|
if (!field || typeof field !== "object") return;
|
|
7374
8448
|
const f = field;
|
|
7375
8449
|
const fieldType = f["type"];
|
|
7376
8450
|
const fieldKey = f["key"];
|
|
8451
|
+
for (const problem of findFieldExpressionProblems(field)) {
|
|
8452
|
+
const problemPath = `${path}.${problem.path}`;
|
|
8453
|
+
if (reportedExpressions.has(problemPath)) continue;
|
|
8454
|
+
reportedExpressions.add(problemPath);
|
|
8455
|
+
errors.push({
|
|
8456
|
+
path: problemPath,
|
|
8457
|
+
ruleId: "core/expression-syntax",
|
|
8458
|
+
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.`
|
|
8459
|
+
});
|
|
8460
|
+
}
|
|
7377
8461
|
const validators = f["validators"];
|
|
7378
8462
|
if (Array.isArray(validators)) {
|
|
7379
8463
|
validators.forEach((validator, vIdx) => {
|
|
@@ -8111,6 +9195,7 @@ function parseConfigInput(config) {
|
|
|
8111
9195
|
}
|
|
8112
9196
|
|
|
8113
9197
|
// internal/dynamic-forms-validation/reporting/fix-suggestions.ts
|
|
9198
|
+
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.";
|
|
8114
9199
|
var FIX_SUGGESTIONS = {
|
|
8115
9200
|
options: "Move `options` from `props: { options: [...] }` to field level: `{ key, type, options: [...] }`",
|
|
8116
9201
|
label: "Remove `label` from this container field (page/group/row/array). Use a `text` field inside for headings.",
|
|
@@ -8146,6 +9231,7 @@ function pathSegments(path) {
|
|
|
8146
9231
|
return path.split(/[.[\]]+/).filter((segment) => segment.length > 0 && !/^\d+$/.test(segment));
|
|
8147
9232
|
}
|
|
8148
9233
|
function getFixSuggestion(error) {
|
|
9234
|
+
if (error.ruleId === "core/expression-syntax") return EXPRESSION_SYNTAX_SUGGESTION;
|
|
8149
9235
|
for (const segment of pathSegments(error.path).reverse()) {
|
|
8150
9236
|
if (FIX_SUGGESTIONS[segment]) {
|
|
8151
9237
|
return FIX_SUGGESTIONS[segment];
|
|
@@ -8286,6 +9372,11 @@ function rule(id, summary, why) {
|
|
|
8286
9372
|
var RULES = Object.freeze(
|
|
8287
9373
|
Object.fromEntries(
|
|
8288
9374
|
[
|
|
9375
|
+
rule(
|
|
9376
|
+
"core/expression-syntax",
|
|
9377
|
+
"Write conditions and derivations the expression parser can run",
|
|
9378
|
+
"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."
|
|
9379
|
+
),
|
|
8289
9380
|
rule(
|
|
8290
9381
|
"core/hidden-minimal",
|
|
8291
9382
|
"Keep hidden fields to `key`, `type`, `value` and `className`",
|
|
@@ -8536,7 +9627,7 @@ function registerResources(server) {
|
|
|
8536
9627
|
}
|
|
8537
9628
|
|
|
8538
9629
|
// packages/dynamic-form-mcp/src/tools/lookup.tool.ts
|
|
8539
|
-
import { z as
|
|
9630
|
+
import { z as z61 } from "zod";
|
|
8540
9631
|
|
|
8541
9632
|
// packages/dynamic-form-mcp/src/tools/data/lookup-topics.ts
|
|
8542
9633
|
var TOPICS = {
|
|
@@ -9586,14 +10677,7 @@ derivation: 'formValue.discount ?? 0' // Nullish coalescing
|
|
|
9586
10677
|
derivation: 'formValue.price * (1 - externalData.discountRate)' // External data
|
|
9587
10678
|
\`\`\`
|
|
9588
10679
|
|
|
9589
|
-
**
|
|
9590
|
-
\`\`\`typescript
|
|
9591
|
-
derivation: \`(() => {
|
|
9592
|
-
const qty = formValue.quantity || 0;
|
|
9593
|
-
const price = formValue.unitPrice || 0;
|
|
9594
|
-
return qty * price;
|
|
9595
|
-
})()\`
|
|
9596
|
-
\`\`\`
|
|
10680
|
+
**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.
|
|
9597
10681
|
|
|
9598
10682
|
**See also:** \`property-derivation\` topic for deriving component properties (minDate, options, label, etc.)`
|
|
9599
10683
|
},
|
|
@@ -10613,10 +11697,14 @@ const config = { fields: [...] } as const satisfies FormConfig;
|
|
|
10613
11697
|
| \`endsWith\` | String ends with | \`'hello'.endsWith('lo')\` |
|
|
10614
11698
|
| \`matches\` | Regex match | \`/^[0-9]+$/.test(value)\` |
|
|
10615
11699
|
|
|
11700
|
+
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.
|
|
11701
|
+
|
|
10616
11702
|
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.
|
|
10617
11703
|
|
|
10618
11704
|
## Combining Conditions
|
|
10619
11705
|
|
|
11706
|
+
An \`and\` or \`or\` group with no conditions never fires.
|
|
11707
|
+
|
|
10620
11708
|
**AND (all must be true):**
|
|
10621
11709
|
\`\`\`typescript
|
|
10622
11710
|
condition: {
|
|
@@ -10795,7 +11883,7 @@ expression: '(formValue.contacts?.length || 0) + " contacts"'
|
|
|
10795
11883
|
expression: '(formValue.firstName || "") + " " + (formValue.lastName || "")'
|
|
10796
11884
|
|
|
10797
11885
|
// Address formatting
|
|
10798
|
-
expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip].filter(
|
|
11886
|
+
expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip].filter(x => x).join(", ")\`
|
|
10799
11887
|
\`\`\`
|
|
10800
11888
|
|
|
10801
11889
|
## Math Calculations
|
|
@@ -10804,7 +11892,7 @@ expression: \`[formValue.street, formValue.city, formValue.state, formValue.zip]
|
|
|
10804
11892
|
expression: '(formValue.quantity || 0) * (formValue.unitPrice || 0)'
|
|
10805
11893
|
|
|
10806
11894
|
// Percentage
|
|
10807
|
-
expression: '
|
|
11895
|
+
expression: '((formValue.completed / formValue.total) * 100).toFixed(0) + "%"'
|
|
10808
11896
|
|
|
10809
11897
|
// Sum of array
|
|
10810
11898
|
expression: '(formValue.items || []).reduce((sum, item) => sum + (item.price || 0), 0)'
|
|
@@ -10815,13 +11903,8 @@ expression: '(formValue.items || []).reduce((sum, item) => sum + (item.price ||
|
|
|
10815
11903
|
// Ternary
|
|
10816
11904
|
expression: 'formValue.isPremium ? "Premium Member" : "Standard Member"'
|
|
10817
11905
|
|
|
10818
|
-
// Multiple conditions
|
|
10819
|
-
expression:
|
|
10820
|
-
if (formValue.score >= 90) return 'A';
|
|
10821
|
-
if (formValue.score >= 80) return 'B';
|
|
10822
|
-
if (formValue.score >= 70) return 'C';
|
|
10823
|
-
return 'D';
|
|
10824
|
-
})()\`
|
|
11906
|
+
// Multiple conditions (nested ternary)
|
|
11907
|
+
expression: 'formValue.score >= 90 ? "A" : formValue.score >= 80 ? "B" : formValue.score >= 70 ? "C" : "D"'
|
|
10825
11908
|
\`\`\``
|
|
10826
11909
|
},
|
|
10827
11910
|
"type-narrowing": {
|
|
@@ -11846,11 +12929,11 @@ Patterns: field-placement, logic-matrix, context-api, containers, multi-page-got
|
|
|
11846
12929
|
Use topic="list" to see all available topics with descriptions.
|
|
11847
12930
|
Use ngforge_search query="your question" to find topics by keyword.`,
|
|
11848
12931
|
{
|
|
11849
|
-
topic:
|
|
12932
|
+
topic: z61.string().describe(
|
|
11850
12933
|
'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'
|
|
11851
12934
|
),
|
|
11852
|
-
depth:
|
|
11853
|
-
uiIntegration:
|
|
12935
|
+
depth: z61.enum(["brief", "full", "schema"]).default("full").describe("brief=quick syntax (~20 lines), full=complete docs with examples, schema=include JSON schema"),
|
|
12936
|
+
uiIntegration: z61.enum(UI_INTEGRATIONS2).optional().describe("Filter UI-specific info (only with depth=schema). material, bootstrap, primeng, ionic")
|
|
11854
12937
|
},
|
|
11855
12938
|
async ({ topic, depth, uiIntegration }) => {
|
|
11856
12939
|
const normalizedTopic = topic.toLowerCase().trim();
|
|
@@ -11898,7 +12981,7 @@ ${nextSteps}`;
|
|
|
11898
12981
|
}
|
|
11899
12982
|
|
|
11900
12983
|
// packages/dynamic-form-mcp/src/tools/examples.tool.ts
|
|
11901
|
-
import { z as
|
|
12984
|
+
import { z as z62 } from "zod";
|
|
11902
12985
|
var PATTERNS = {
|
|
11903
12986
|
// ========== MINIMAL PATTERNS (NEW) ==========
|
|
11904
12987
|
"minimal-multipage": {
|
|
@@ -13979,21 +15062,24 @@ const megaFormConfig = {
|
|
|
13979
15062
|
key: 'sourceA',
|
|
13980
15063
|
type: 'input',
|
|
13981
15064
|
label: 'Source A',
|
|
13982
|
-
value:
|
|
15065
|
+
value: 10,
|
|
15066
|
+
props: { type: 'number' }
|
|
13983
15067
|
},
|
|
13984
15068
|
{
|
|
13985
15069
|
key: 'sourceB',
|
|
13986
15070
|
type: 'input',
|
|
13987
15071
|
label: 'Source B',
|
|
13988
|
-
value:
|
|
15072
|
+
value: 20,
|
|
15073
|
+
props: { type: 'number' }
|
|
13989
15074
|
},
|
|
13990
15075
|
{
|
|
13991
15076
|
key: 'derived',
|
|
13992
15077
|
type: 'input',
|
|
13993
15078
|
label: 'Derived (A + B)',
|
|
13994
15079
|
readonly: true,
|
|
15080
|
+
props: { type: 'number' },
|
|
13995
15081
|
// Self-targeting derivation - no targetField needed
|
|
13996
|
-
derivation: '
|
|
15082
|
+
derivation: '(formValue.sourceA ?? 0) + (formValue.sourceB ?? 0)'
|
|
13997
15083
|
},
|
|
13998
15084
|
|
|
13999
15085
|
// CONDITIONAL VISIBILITY
|
|
@@ -14163,10 +15249,10 @@ Standard patterns: derivation, property-derivation, multi-page, conditional, val
|
|
|
14163
15249
|
Use pattern="list" to see all available patterns.
|
|
14164
15250
|
Use depth="minimal" for code-only output (no markdown).`,
|
|
14165
15251
|
{
|
|
14166
|
-
pattern:
|
|
15252
|
+
pattern: z62.string().optional().describe(
|
|
14167
15253
|
'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.'
|
|
14168
15254
|
),
|
|
14169
|
-
depth:
|
|
15255
|
+
depth: z62.enum(["minimal", "brief", "full", "explained"]).default("full").describe(
|
|
14170
15256
|
"minimal=code only (~20-50 lines), brief=code+summary, full=code+comments (default), explained=code+detailed explanation"
|
|
14171
15257
|
)
|
|
14172
15258
|
},
|
|
@@ -14233,7 +15319,7 @@ function extractCode(markdown) {
|
|
|
14233
15319
|
// packages/dynamic-form-mcp/src/tools/validate.tool.ts
|
|
14234
15320
|
import { access } from "node:fs/promises";
|
|
14235
15321
|
import { dirname as dirname2, join as join2, parse, resolve } from "node:path";
|
|
14236
|
-
import { z as
|
|
15322
|
+
import { z as z63 } from "zod";
|
|
14237
15323
|
var UI_INTEGRATIONS3 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14238
15324
|
async function projectDisabledRules(filePath) {
|
|
14239
15325
|
return (await loadProjectRules(await nearestManifest(dirname2(filePath)))).disabled;
|
|
@@ -14305,10 +15391,10 @@ Example errors you'll see:
|
|
|
14305
15391
|
- "options MUST be at FIELD level, NOT inside props"
|
|
14306
15392
|
- "containers only support 'hidden' logic type"`,
|
|
14307
15393
|
{
|
|
14308
|
-
config:
|
|
15394
|
+
config: z63.union([z63.string(), z63.object({}).passthrough()]).describe(
|
|
14309
15395
|
"File path (.ts/.js) OR JSON string OR JSON object. Auto-detects: paths ending in .ts/.js or starting with / are treated as files."
|
|
14310
15396
|
),
|
|
14311
|
-
uiIntegration:
|
|
15397
|
+
uiIntegration: z63.enum(UI_INTEGRATIONS3).default("material").describe("UI library to validate against (material, bootstrap, primeng, ionic). Defaults to material.")
|
|
14312
15398
|
},
|
|
14313
15399
|
async ({ config, uiIntegration }) => {
|
|
14314
15400
|
try {
|
|
@@ -14405,7 +15491,7 @@ If validating JSON, ensure:
|
|
|
14405
15491
|
}
|
|
14406
15492
|
|
|
14407
15493
|
// packages/dynamic-form-mcp/src/tools/scaffold.tool.ts
|
|
14408
|
-
import { z as
|
|
15494
|
+
import { z as z64 } from "zod";
|
|
14409
15495
|
var UI_INTEGRATIONS4 = ["material", "bootstrap", "primeng", "ionic"];
|
|
14410
15496
|
function parseFieldDefs(fields) {
|
|
14411
15497
|
return fields.map((f) => {
|
|
@@ -14660,12 +15746,12 @@ Examples:
|
|
|
14660
15746
|
- With groups: pages=0 groups=["address","billing"]
|
|
14661
15747
|
- With hidden: hidden=["userId:abc123","source:web"]`,
|
|
14662
15748
|
{
|
|
14663
|
-
pages:
|
|
14664
|
-
arrays:
|
|
14665
|
-
groups:
|
|
14666
|
-
hidden:
|
|
14667
|
-
fields:
|
|
14668
|
-
uiIntegration:
|
|
15749
|
+
pages: z64.number().min(0).max(10).default(0).describe("Number of pages (0 = single-page form, 1-10 = multi-page wizard)"),
|
|
15750
|
+
arrays: z64.array(z64.string()).optional().describe('Array field names for dynamic lists, e.g., ["contacts", "addresses"]'),
|
|
15751
|
+
groups: z64.array(z64.string()).optional().describe('Group field names for nested objects, e.g., ["address", "billing"]'),
|
|
15752
|
+
hidden: z64.array(z64.string()).optional().describe('Hidden fields as "name:value" pairs, e.g., ["userId:abc", "version:1"]'),
|
|
15753
|
+
fields: z64.array(z64.string()).optional().describe('Basic fields as "name:type" pairs, e.g., ["email:input", "country:select", "age:slider"]'),
|
|
15754
|
+
uiIntegration: z64.enum(UI_INTEGRATIONS4).default("material").describe("UI library (for future UI-specific props). Defaults to material.")
|
|
14669
15755
|
},
|
|
14670
15756
|
async ({ pages, arrays = [], groups = [], hidden = [], fields = [] }) => {
|
|
14671
15757
|
const fieldDefs = parseFieldDefs(fields);
|
|
@@ -14707,7 +15793,7 @@ Examples:
|
|
|
14707
15793
|
}
|
|
14708
15794
|
|
|
14709
15795
|
// packages/dynamic-form-mcp/src/tools/search.tool.ts
|
|
14710
|
-
import { z as
|
|
15796
|
+
import { z as z65 } from "zod";
|
|
14711
15797
|
var searchIndex = null;
|
|
14712
15798
|
function getTopicSubcategory(key) {
|
|
14713
15799
|
const fieldTypes = ["input", "select", "slider", "radio", "checkbox", "textarea", "datepicker", "toggle", "text", "hidden"];
|
|
@@ -14868,7 +15954,7 @@ Use this when you don't know the exact topic name.
|
|
|
14868
15954
|
|
|
14869
15955
|
New to ng-forge? Start with: ngforge_lookup topic="workflow"`,
|
|
14870
15956
|
{
|
|
14871
|
-
query:
|
|
15957
|
+
query: z65.string().describe("Natural language or keywords to search for")
|
|
14872
15958
|
},
|
|
14873
15959
|
async ({ query }) => {
|
|
14874
15960
|
const index = buildIndex();
|