@flowgram.ai/form-materials 0.4.1 → 0.4.2

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/dist/index.js CHANGED
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  ConditionRow: () => ConditionRow,
41
41
  ConstantInput: () => ConstantInput,
42
42
  DisplayFlowValue: () => DisplayFlowValue,
43
+ DisplayInputsValueAllInTag: () => DisplayInputsValueAllInTag,
43
44
  DisplayInputsValues: () => DisplayInputsValues,
44
45
  DisplayOutputs: () => DisplayOutputs,
45
46
  DisplaySchemaTag: () => DisplaySchemaTag,
@@ -193,7 +194,7 @@ var extraSchema = import_zod.default.object({
193
194
  }).optional();
194
195
  var constantSchema = import_zod.default.object({
195
196
  type: import_zod.default.literal("constant"),
196
- content: import_zod.default.union([import_zod.default.string(), import_zod.default.number(), import_zod.default.boolean()]).optional(),
197
+ content: import_zod.default.any().optional(),
197
198
  schema: import_zod.default.any().optional(),
198
199
  extra: extraSchema
199
200
  });
@@ -1685,8 +1686,25 @@ function useSelectSchema(schemaFromProps, constantProps, value) {
1685
1686
  if (value?.type === "constant") {
1686
1687
  defaultSelectSchema = value?.schema || defaultSelectSchema;
1687
1688
  }
1689
+ const changeVersion = (0, import_react22.useRef)(0);
1690
+ const effectVersion = (0, import_react22.useRef)(0);
1688
1691
  const [selectSchema, setSelectSchema] = (0, import_react22.useState)(defaultSelectSchema);
1689
- return [selectSchema, setSelectSchema];
1692
+ (0, import_react22.useEffect)(() => {
1693
+ effectVersion.current += 1;
1694
+ if (changeVersion.current === effectVersion.current) {
1695
+ return;
1696
+ }
1697
+ effectVersion.current = changeVersion.current;
1698
+ if (value?.type === "constant" && value?.schema) {
1699
+ setSelectSchema(value?.schema);
1700
+ return;
1701
+ }
1702
+ }, [value]);
1703
+ const setSelectSchemaWithVersionUpdate = (schema) => {
1704
+ setSelectSchema(schema);
1705
+ changeVersion.current += 1;
1706
+ };
1707
+ return [selectSchema, setSelectSchemaWithVersionUpdate];
1690
1708
  }
1691
1709
  function useIncludeSchema(schemaFromProps) {
1692
1710
  const includeSchema = (0, import_react22.useMemo)(() => {
@@ -1768,7 +1786,6 @@ function DynamicValueInput({
1768
1786
  onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema2 }),
1769
1787
  schema: constantSchema2 || { type: "string" },
1770
1788
  readonly,
1771
- strategies: [...constantProps?.strategies || []],
1772
1789
  fallbackRenderer: () => /* @__PURE__ */ import_react23.default.createElement(
1773
1790
  InjectVariableSelector,
1774
1791
  {
@@ -1778,7 +1795,8 @@ function DynamicValueInput({
1778
1795
  readonly
1779
1796
  }
1780
1797
  ),
1781
- ...constantProps
1798
+ ...constantProps,
1799
+ strategies: [...constantProps?.strategies || []]
1782
1800
  }
1783
1801
  );
1784
1802
  };
@@ -3278,18 +3296,7 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3278
3296
  return { type: "string" };
3279
3297
  }
3280
3298
  if (value?.type === "constant") {
3281
- if (value?.schema) {
3282
- return value?.schema;
3283
- }
3284
- if (typeof value?.content === "string") {
3285
- return { type: "string" };
3286
- }
3287
- if (typeof value?.content === "number") {
3288
- return { type: "number" };
3289
- }
3290
- if (typeof value?.content === "boolean") {
3291
- return { type: "boolean" };
3292
- }
3299
+ return FlowValueUtils.inferConstantJsonSchema(value);
3293
3300
  }
3294
3301
  return { type: "unknown" };
3295
3302
  }, [value, variable?.hash]);
@@ -3306,6 +3313,8 @@ function DisplayFlowValue({ value, title, showIconInTree }) {
3306
3313
 
3307
3314
  // src/components/display-inputs-values/index.tsx
3308
3315
  var import_react56 = __toESM(require("react"));
3316
+ var import_lodash8 = require("lodash");
3317
+ var import_editor29 = require("@flowgram.ai/editor");
3309
3318
 
3310
3319
  // src/components/display-inputs-values/styles.ts
3311
3320
  var import_styled_components14 = __toESM(require("styled-components"));
@@ -3318,12 +3327,40 @@ var DisplayInputsWrapper = import_styled_components14.default.div`
3318
3327
  // src/components/display-inputs-values/index.tsx
3319
3328
  function DisplayInputsValues({ value, showIconInTree }) {
3320
3329
  const childEntries = Object.entries(value || {});
3321
- return /* @__PURE__ */ import_react56.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => /* @__PURE__ */ import_react56.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree })));
3330
+ return /* @__PURE__ */ import_react56.default.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
3331
+ if (FlowValueUtils.isFlowValue(value2)) {
3332
+ return /* @__PURE__ */ import_react56.default.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
3333
+ }
3334
+ if ((0, import_lodash8.isPlainObject)(value2)) {
3335
+ return /* @__PURE__ */ import_react56.default.createElement(
3336
+ DisplayInputsValueAllInTag,
3337
+ {
3338
+ key,
3339
+ title: key,
3340
+ value: value2,
3341
+ showIconInTree
3342
+ }
3343
+ );
3344
+ }
3345
+ return null;
3346
+ }));
3347
+ }
3348
+ function DisplayInputsValueAllInTag({
3349
+ value,
3350
+ title,
3351
+ showIconInTree
3352
+ }) {
3353
+ const available = (0, import_editor29.useScopeAvailable)();
3354
+ const schema = (0, import_react56.useMemo)(
3355
+ () => FlowValueUtils.inferJsonSchema(value, available.scope),
3356
+ [available.version, value]
3357
+ );
3358
+ return /* @__PURE__ */ import_react56.default.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
3322
3359
  }
3323
3360
 
3324
3361
  // src/components/assign-rows/index.tsx
3325
3362
  var import_react59 = __toESM(require("react"));
3326
- var import_editor29 = require("@flowgram.ai/editor");
3363
+ var import_editor30 = require("@flowgram.ai/editor");
3327
3364
  var import_semi_ui27 = require("@douyinfe/semi-ui");
3328
3365
  var import_semi_icons11 = require("@douyinfe/semi-icons");
3329
3366
 
@@ -3410,7 +3447,7 @@ function AssignRow(props) {
3410
3447
  // src/components/assign-rows/index.tsx
3411
3448
  function AssignRows(props) {
3412
3449
  const { name, readonly } = props;
3413
- return /* @__PURE__ */ import_react59.default.createElement(import_editor29.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react59.default.createElement(
3450
+ return /* @__PURE__ */ import_react59.default.createElement(import_editor30.FieldArray, { name }, ({ field }) => /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, field.map((childField, index) => /* @__PURE__ */ import_react59.default.createElement(
3414
3451
  AssignRow,
3415
3452
  {
3416
3453
  key: childField.key,
@@ -3444,7 +3481,7 @@ function AssignRows(props) {
3444
3481
 
3445
3482
  // src/components/inputs-values-tree/index.tsx
3446
3483
  var import_react63 = __toESM(require("react"));
3447
- var import_editor31 = require("@flowgram.ai/editor");
3484
+ var import_editor32 = require("@flowgram.ai/editor");
3448
3485
  var import_semi_ui29 = require("@douyinfe/semi-ui");
3449
3486
  var import_semi_icons14 = require("@douyinfe/semi-icons");
3450
3487
 
@@ -3554,16 +3591,16 @@ var IconAddChildren2 = () => /* @__PURE__ */ import_react60.default.createElemen
3554
3591
 
3555
3592
  // src/components/inputs-values-tree/row.tsx
3556
3593
  var import_react62 = __toESM(require("react"));
3557
- var import_editor30 = require("@flowgram.ai/editor");
3594
+ var import_editor31 = require("@flowgram.ai/editor");
3558
3595
  var import_semi_ui28 = require("@douyinfe/semi-ui");
3559
3596
  var import_semi_icons13 = require("@douyinfe/semi-icons");
3560
3597
 
3561
3598
  // src/components/inputs-values-tree/hooks/use-child-list.tsx
3562
3599
  var import_react61 = require("react");
3563
- var import_lodash8 = require("lodash");
3600
+ var import_lodash9 = require("lodash");
3564
3601
  function useChildList(value, onChange) {
3565
3602
  const canAddField = (0, import_react61.useMemo)(() => {
3566
- if (!(0, import_lodash8.isPlainObject)(value)) {
3603
+ if (!(0, import_lodash9.isPlainObject)(value)) {
3567
3604
  return false;
3568
3605
  }
3569
3606
  if (FlowValueUtils.isFlowValue(value)) {
@@ -3572,7 +3609,7 @@ function useChildList(value, onChange) {
3572
3609
  return true;
3573
3610
  }, [value]);
3574
3611
  const objectListValue = (0, import_react61.useMemo)(() => {
3575
- if ((0, import_lodash8.isPlainObject)(value)) {
3612
+ if ((0, import_lodash9.isPlainObject)(value)) {
3576
3613
  if (FlowValueUtils.isFlowValue(value)) {
3577
3614
  return void 0;
3578
3615
  }
@@ -3580,7 +3617,6 @@ function useChildList(value, onChange) {
3580
3617
  }
3581
3618
  return void 0;
3582
3619
  }, [value]);
3583
- console.log("debugger objectListValue", objectListValue);
3584
3620
  const { list, add, updateKey, updateValue, remove } = useObjectList({
3585
3621
  value: objectListValue,
3586
3622
  onChange: (value2) => {
@@ -3588,8 +3624,13 @@ function useChildList(value, onChange) {
3588
3624
  },
3589
3625
  sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
3590
3626
  });
3627
+ const hasChildren = (0, import_react61.useMemo)(
3628
+ () => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
3629
+ [canAddField, list.length, Object.keys(objectListValue || {}).length]
3630
+ );
3591
3631
  return {
3592
3632
  canAddField,
3633
+ hasChildren,
3593
3634
  list,
3594
3635
  add,
3595
3636
  updateKey,
@@ -3607,7 +3648,7 @@ var AddObjectChildStrategy = {
3607
3648
  size: "small",
3608
3649
  disabled: true,
3609
3650
  style: { pointerEvents: "none" },
3610
- value: import_editor30.I18n.t("Configure via child fields")
3651
+ value: import_editor31.I18n.t("Configure via child fields")
3611
3652
  }
3612
3653
  )
3613
3654
  };
@@ -3625,12 +3666,21 @@ function InputValueRow(props) {
3625
3666
  readonly
3626
3667
  } = props;
3627
3668
  const [collapse, setCollapse] = (0, import_react62.useState)(false);
3628
- const { canAddField, list, add, updateKey, updateValue, remove } = useChildList(
3669
+ const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
3629
3670
  value,
3630
3671
  onUpdateValue
3631
3672
  );
3632
- const hasChildren = canAddField && list.length > 0;
3633
- const flowDisplayValue = hasChildren ? { type: "constant", schema: { type: " object" } } : value;
3673
+ const strategies = (0, import_react62.useMemo)(
3674
+ () => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
3675
+ [hasChildren, constantProps?.strategies]
3676
+ );
3677
+ const flowDisplayValue = (0, import_react62.useMemo)(
3678
+ () => hasChildren ? {
3679
+ type: "constant",
3680
+ schema: { type: "object" }
3681
+ } : value,
3682
+ [hasChildren, value]
3683
+ );
3634
3684
  return /* @__PURE__ */ import_react62.default.createElement(import_react62.default.Fragment, null, /* @__PURE__ */ import_react62.default.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ import_react62.default.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ import_react62.default.createElement(import_semi_icons13.IconChevronDown, { size: "small" }) : /* @__PURE__ */ import_react62.default.createElement(import_semi_icons13.IconChevronRight, { size: "small" }))), /* @__PURE__ */ import_react62.default.createElement(UITreeItemRight2, null, /* @__PURE__ */ import_react62.default.createElement(UITreeItemMain2, null, /* @__PURE__ */ import_react62.default.createElement(UIRow4, null, /* @__PURE__ */ import_react62.default.createElement(
3635
3685
  BlurInput,
3636
3686
  {
@@ -3639,7 +3689,7 @@ function InputValueRow(props) {
3639
3689
  size: "small",
3640
3690
  value: keyName,
3641
3691
  onChange: (v) => onUpdateKey?.(v),
3642
- placeholder: import_editor30.I18n.t("Input Key")
3692
+ placeholder: import_editor31.I18n.t("Input Key")
3643
3693
  }
3644
3694
  ), /* @__PURE__ */ import_react62.default.createElement(
3645
3695
  InjectDynamicValueInput,
@@ -3651,10 +3701,7 @@ function InputValueRow(props) {
3651
3701
  hasError,
3652
3702
  constantProps: {
3653
3703
  ...constantProps,
3654
- strategies: [
3655
- ...hasChildren ? [AddObjectChildStrategy] : [],
3656
- ...constantProps?.strategies || []
3657
- ]
3704
+ strategies
3658
3705
  }
3659
3706
  }
3660
3707
  ), /* @__PURE__ */ import_react62.default.createElement(UIActions2, null, canAddField && /* @__PURE__ */ import_react62.default.createElement(
@@ -3732,34 +3779,34 @@ function InputsValuesTree(props) {
3732
3779
  size: "small",
3733
3780
  onClick: add
3734
3781
  },
3735
- import_editor31.I18n.t("Add")
3782
+ import_editor32.I18n.t("Add")
3736
3783
  ));
3737
3784
  }
3738
3785
 
3739
3786
  // src/effects/provide-batch-input/index.ts
3740
- var import_editor32 = require("@flowgram.ai/editor");
3741
- var provideBatchInputEffect = (0, import_editor32.createEffectFromVariableProvider)({
3787
+ var import_editor33 = require("@flowgram.ai/editor");
3788
+ var provideBatchInputEffect = (0, import_editor33.createEffectFromVariableProvider)({
3742
3789
  private: true,
3743
3790
  parse: (value, ctx) => [
3744
- import_editor32.ASTFactory.createVariableDeclaration({
3791
+ import_editor33.ASTFactory.createVariableDeclaration({
3745
3792
  key: `${ctx.node.id}_locals`,
3746
3793
  meta: {
3747
- title: (0, import_editor32.getNodeForm)(ctx.node)?.getValueIn("title"),
3794
+ title: (0, import_editor33.getNodeForm)(ctx.node)?.getValueIn("title"),
3748
3795
  icon: ctx.node.getNodeRegistry().info?.icon
3749
3796
  },
3750
- type: import_editor32.ASTFactory.createObject({
3797
+ type: import_editor33.ASTFactory.createObject({
3751
3798
  properties: [
3752
- import_editor32.ASTFactory.createProperty({
3799
+ import_editor33.ASTFactory.createProperty({
3753
3800
  key: "item",
3754
- initializer: import_editor32.ASTFactory.createEnumerateExpression({
3755
- enumerateFor: import_editor32.ASTFactory.createKeyPathExpression({
3801
+ initializer: import_editor33.ASTFactory.createEnumerateExpression({
3802
+ enumerateFor: import_editor33.ASTFactory.createKeyPathExpression({
3756
3803
  keyPath: value.content || []
3757
3804
  })
3758
3805
  })
3759
3806
  }),
3760
- import_editor32.ASTFactory.createProperty({
3807
+ import_editor33.ASTFactory.createProperty({
3761
3808
  key: "index",
3762
- type: import_editor32.ASTFactory.createNumber()
3809
+ type: import_editor33.ASTFactory.createNumber()
3763
3810
  })
3764
3811
  ]
3765
3812
  })
@@ -3768,13 +3815,13 @@ var provideBatchInputEffect = (0, import_editor32.createEffectFromVariableProvid
3768
3815
  });
3769
3816
 
3770
3817
  // src/effects/auto-rename-ref/index.ts
3771
- var import_editor33 = require("@flowgram.ai/editor");
3818
+ var import_editor34 = require("@flowgram.ai/editor");
3772
3819
  var autoRenameRefEffect = [
3773
3820
  {
3774
- event: import_editor33.DataEvent.onValueInit,
3821
+ event: import_editor34.DataEvent.onValueInit,
3775
3822
  effect: (params) => {
3776
3823
  const { context, form, name } = params;
3777
- const renameService = context.node.getService(import_editor33.VariableFieldKeyRenameService);
3824
+ const renameService = context.node.getService(import_editor34.VariableFieldKeyRenameService);
3778
3825
  const disposable = renameService.onRename(({ before, after }) => {
3779
3826
  const beforeKeyPath = [
3780
3827
  ...before.parentFields.map((_field) => _field.key).reverse(),
@@ -3832,13 +3879,13 @@ function traverseRef(name, value, cb) {
3832
3879
 
3833
3880
  // src/effects/provide-json-schema-outputs/index.ts
3834
3881
  var import_json_schema11 = require("@flowgram.ai/json-schema");
3835
- var import_editor34 = require("@flowgram.ai/editor");
3836
- var provideJsonSchemaOutputs = (0, import_editor34.createEffectFromVariableProvider)({
3882
+ var import_editor35 = require("@flowgram.ai/editor");
3883
+ var provideJsonSchemaOutputs = (0, import_editor35.createEffectFromVariableProvider)({
3837
3884
  parse: (value, ctx) => [
3838
- import_editor34.ASTFactory.createVariableDeclaration({
3885
+ import_editor35.ASTFactory.createVariableDeclaration({
3839
3886
  key: `${ctx.node.id}`,
3840
3887
  meta: {
3841
- title: (0, import_editor34.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3888
+ title: (0, import_editor35.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
3842
3889
  icon: ctx.node.getNodeRegistry().info?.icon
3843
3890
  },
3844
3891
  type: import_json_schema11.JsonSchemaUtils.schemaToAST(value)
@@ -3847,12 +3894,12 @@ var provideJsonSchemaOutputs = (0, import_editor34.createEffectFromVariableProvi
3847
3894
  });
3848
3895
 
3849
3896
  // src/effects/sync-variable-title/index.ts
3850
- var import_editor35 = require("@flowgram.ai/editor");
3897
+ var import_editor36 = require("@flowgram.ai/editor");
3851
3898
  var syncVariableTitle = [
3852
3899
  {
3853
- event: import_editor35.DataEvent.onValueChange,
3900
+ event: import_editor36.DataEvent.onValueChange,
3854
3901
  effect: ({ value, context }) => {
3855
- context.node.getData(import_editor35.FlowNodeVariableData).allScopes.forEach((_scope) => {
3902
+ context.node.getData(import_editor36.FlowNodeVariableData).allScopes.forEach((_scope) => {
3856
3903
  _scope.output.variables.forEach((_var) => {
3857
3904
  _var.updateMeta({
3858
3905
  ..._var.meta || {},
@@ -3866,17 +3913,17 @@ var syncVariableTitle = [
3866
3913
  ];
3867
3914
 
3868
3915
  // src/effects/validate-when-variable-sync/index.ts
3869
- var import_lodash9 = require("lodash");
3870
- var import_editor36 = require("@flowgram.ai/editor");
3916
+ var import_lodash10 = require("lodash");
3917
+ var import_editor37 = require("@flowgram.ai/editor");
3871
3918
  var validateWhenVariableSync = ({
3872
3919
  scope
3873
3920
  } = {}) => [
3874
3921
  {
3875
- event: import_editor36.DataEvent.onValueInit,
3922
+ event: import_editor37.DataEvent.onValueInit,
3876
3923
  effect: ({ context, form }) => {
3877
- const nodeScope = scope === "private" ? (0, import_editor36.getNodePrivateScope)(context.node) : (0, import_editor36.getNodeScope)(context.node);
3924
+ const nodeScope = scope === "private" ? (0, import_editor37.getNodePrivateScope)(context.node) : (0, import_editor37.getNodeScope)(context.node);
3878
3925
  const disposable = nodeScope.available.onListOrAnyVarChange(() => {
3879
- if (!(0, import_lodash9.isEmpty)(form.state.errors)) {
3926
+ if (!(0, import_lodash10.isEmpty)(form.state.errors)) {
3880
3927
  form.validate();
3881
3928
  }
3882
3929
  });
@@ -3886,16 +3933,16 @@ var validateWhenVariableSync = ({
3886
3933
  ];
3887
3934
 
3888
3935
  // src/effects/listen-ref-value-change/index.ts
3889
- var import_editor37 = require("@flowgram.ai/editor");
3936
+ var import_editor38 = require("@flowgram.ai/editor");
3890
3937
  var listenRefValueChange = (cb) => [
3891
3938
  {
3892
- event: import_editor37.DataEvent.onValueInitOrChange,
3939
+ event: import_editor38.DataEvent.onValueInitOrChange,
3893
3940
  effect: (params) => {
3894
3941
  const { context, value } = params;
3895
3942
  if (value?.type !== "ref") {
3896
3943
  return () => null;
3897
3944
  }
3898
- const disposable = (0, import_editor37.getNodeScope)(context.node).available.trackByKeyPath(
3945
+ const disposable = (0, import_editor38.getNodeScope)(context.node).available.trackByKeyPath(
3899
3946
  value?.content || [],
3900
3947
  (v) => {
3901
3948
  cb({ ...params, variable: v });
@@ -3910,16 +3957,16 @@ var listenRefValueChange = (cb) => [
3910
3957
 
3911
3958
  // src/effects/listen-ref-schema-change/index.ts
3912
3959
  var import_json_schema12 = require("@flowgram.ai/json-schema");
3913
- var import_editor38 = require("@flowgram.ai/editor");
3960
+ var import_editor39 = require("@flowgram.ai/editor");
3914
3961
  var listenRefSchemaChange = (cb) => [
3915
3962
  {
3916
- event: import_editor38.DataEvent.onValueInitOrChange,
3963
+ event: import_editor39.DataEvent.onValueInitOrChange,
3917
3964
  effect: (params) => {
3918
3965
  const { context, value } = params;
3919
3966
  if (value?.type !== "ref") {
3920
3967
  return () => null;
3921
3968
  }
3922
- const disposable = (0, import_editor38.getNodeScope)(context.node).available.trackByKeyPath(
3969
+ const disposable = (0, import_editor39.getNodeScope)(context.node).available.trackByKeyPath(
3923
3970
  value?.content || [],
3924
3971
  (_type) => {
3925
3972
  cb({ ...params, schema: import_json_schema12.JsonSchemaUtils.astToSchema(_type) });
@@ -3936,21 +3983,21 @@ var listenRefSchemaChange = (cb) => [
3936
3983
  ];
3937
3984
 
3938
3985
  // src/form-plugins/batch-outputs-plugin/index.ts
3939
- var import_editor39 = require("@flowgram.ai/editor");
3940
- var provideBatchOutputsEffect = (0, import_editor39.createEffectFromVariableProvider)({
3986
+ var import_editor40 = require("@flowgram.ai/editor");
3987
+ var provideBatchOutputsEffect = (0, import_editor40.createEffectFromVariableProvider)({
3941
3988
  parse: (value, ctx) => [
3942
- import_editor39.ASTFactory.createVariableDeclaration({
3989
+ import_editor40.ASTFactory.createVariableDeclaration({
3943
3990
  key: `${ctx.node.id}`,
3944
3991
  meta: {
3945
- title: (0, import_editor39.getNodeForm)(ctx.node)?.getValueIn("title"),
3992
+ title: (0, import_editor40.getNodeForm)(ctx.node)?.getValueIn("title"),
3946
3993
  icon: ctx.node.getNodeRegistry().info?.icon
3947
3994
  },
3948
- type: import_editor39.ASTFactory.createObject({
3995
+ type: import_editor40.ASTFactory.createObject({
3949
3996
  properties: Object.entries(value).map(
3950
- ([_key, value2]) => import_editor39.ASTFactory.createProperty({
3997
+ ([_key, value2]) => import_editor40.ASTFactory.createProperty({
3951
3998
  key: _key,
3952
- initializer: import_editor39.ASTFactory.createWrapArrayExpression({
3953
- wrapFor: import_editor39.ASTFactory.createKeyPathExpression({
3999
+ initializer: import_editor40.ASTFactory.createWrapArrayExpression({
4000
+ wrapFor: import_editor40.ASTFactory.createKeyPathExpression({
3954
4001
  keyPath: value2?.content || []
3955
4002
  })
3956
4003
  })
@@ -3960,7 +4007,7 @@ var provideBatchOutputsEffect = (0, import_editor39.createEffectFromVariableProv
3960
4007
  })
3961
4008
  ]
3962
4009
  });
3963
- var createBatchOutputsFormPlugin = (0, import_editor39.defineFormPluginCreator)({
4010
+ var createBatchOutputsFormPlugin = (0, import_editor40.defineFormPluginCreator)({
3964
4011
  name: "batch-outputs-plugin",
3965
4012
  onSetupFormMeta({ mergeEffect }, { outputKey }) {
3966
4013
  mergeEffect({
@@ -3968,7 +4015,7 @@ var createBatchOutputsFormPlugin = (0, import_editor39.defineFormPluginCreator)(
3968
4015
  });
3969
4016
  },
3970
4017
  onInit(ctx, { outputKey }) {
3971
- const chainTransformService = ctx.node.getService(import_editor39.ScopeChainTransformService);
4018
+ const chainTransformService = ctx.node.getService(import_editor40.ScopeChainTransformService);
3972
4019
  const batchNodeType = ctx.node.flowNodeType;
3973
4020
  const transformerId = `${batchNodeType}-outputs`;
3974
4021
  if (chainTransformService.hasTransformer(transformerId)) {
@@ -3978,21 +4025,21 @@ var createBatchOutputsFormPlugin = (0, import_editor39.defineFormPluginCreator)(
3978
4025
  transformCovers: (covers, ctx2) => {
3979
4026
  const node = ctx2.scope.meta?.node;
3980
4027
  if (node?.parent?.flowNodeType === batchNodeType) {
3981
- return [...covers, (0, import_editor39.getNodeScope)(node.parent)];
4028
+ return [...covers, (0, import_editor40.getNodeScope)(node.parent)];
3982
4029
  }
3983
4030
  return covers;
3984
4031
  },
3985
4032
  transformDeps(scopes, ctx2) {
3986
4033
  const scopeMeta = ctx2.scope.meta;
3987
- if (scopeMeta?.type === import_editor39.FlowNodeScopeType.private) {
4034
+ if (scopeMeta?.type === import_editor40.FlowNodeScopeType.private) {
3988
4035
  return scopes;
3989
4036
  }
3990
4037
  const node = scopeMeta?.node;
3991
4038
  if (node?.flowNodeType === batchNodeType) {
3992
4039
  const childBlocks = node.blocks;
3993
4040
  return [
3994
- (0, import_editor39.getNodePrivateScope)(node),
3995
- ...childBlocks.map((_childBlock) => (0, import_editor39.getNodeScope)(_childBlock))
4041
+ (0, import_editor40.getNodePrivateScope)(node),
4042
+ ...childBlocks.map((_childBlock) => (0, import_editor40.getNodeScope)(_childBlock))
3996
4043
  ];
3997
4044
  }
3998
4045
  return scopes;
@@ -4002,20 +4049,20 @@ var createBatchOutputsFormPlugin = (0, import_editor39.defineFormPluginCreator)(
4002
4049
  });
4003
4050
 
4004
4051
  // src/form-plugins/infer-inputs-plugin/index.ts
4005
- var import_lodash10 = require("lodash");
4006
- var import_editor40 = require("@flowgram.ai/editor");
4007
- var createInferInputsPlugin = (0, import_editor40.defineFormPluginCreator)({
4052
+ var import_lodash11 = require("lodash");
4053
+ var import_editor41 = require("@flowgram.ai/editor");
4054
+ var createInferInputsPlugin = (0, import_editor41.defineFormPluginCreator)({
4008
4055
  onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
4009
4056
  if (!sourceKey || !targetKey) {
4010
4057
  return;
4011
4058
  }
4012
4059
  addFormatOnSubmit((formData, ctx) => {
4013
- (0, import_lodash10.set)(
4060
+ (0, import_lodash11.set)(
4014
4061
  formData,
4015
4062
  targetKey,
4016
4063
  FlowValueUtils.inferJsonSchema(
4017
- (0, import_lodash10.get)(formData, sourceKey),
4018
- scope === "private" ? (0, import_editor40.getNodePrivateScope)(ctx.node) : (0, import_editor40.getNodeScope)(ctx.node)
4064
+ (0, import_lodash11.get)(formData, sourceKey),
4065
+ scope === "private" ? (0, import_editor41.getNodePrivateScope)(ctx.node) : (0, import_editor41.getNodeScope)(ctx.node)
4019
4066
  )
4020
4067
  );
4021
4068
  return formData;
@@ -4024,34 +4071,34 @@ var createInferInputsPlugin = (0, import_editor40.defineFormPluginCreator)({
4024
4071
  });
4025
4072
 
4026
4073
  // src/form-plugins/infer-assign-plugin/index.ts
4027
- var import_lodash11 = require("lodash");
4074
+ var import_lodash12 = require("lodash");
4028
4075
  var import_json_schema13 = require("@flowgram.ai/json-schema");
4029
- var import_editor41 = require("@flowgram.ai/editor");
4030
- var createInferAssignPlugin = (0, import_editor41.defineFormPluginCreator)({
4076
+ var import_editor42 = require("@flowgram.ai/editor");
4077
+ var createInferAssignPlugin = (0, import_editor42.defineFormPluginCreator)({
4031
4078
  onSetupFormMeta({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
4032
4079
  if (!assignKey || !outputKey) {
4033
4080
  return;
4034
4081
  }
4035
4082
  mergeEffect({
4036
- [assignKey]: (0, import_editor41.createEffectFromVariableProvider)({
4083
+ [assignKey]: (0, import_editor42.createEffectFromVariableProvider)({
4037
4084
  parse: (value, ctx) => {
4038
- const declareRows = (0, import_lodash11.uniqBy)(
4085
+ const declareRows = (0, import_lodash12.uniqBy)(
4039
4086
  value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
4040
4087
  "left"
4041
4088
  );
4042
4089
  return [
4043
- import_editor41.ASTFactory.createVariableDeclaration({
4090
+ import_editor42.ASTFactory.createVariableDeclaration({
4044
4091
  key: `${ctx.node.id}`,
4045
4092
  meta: {
4046
- title: (0, import_editor41.getNodeForm)(ctx.node)?.getValueIn("title"),
4093
+ title: (0, import_editor42.getNodeForm)(ctx.node)?.getValueIn("title"),
4047
4094
  icon: ctx.node.getNodeRegistry().info?.icon
4048
4095
  },
4049
- type: import_editor41.ASTFactory.createObject({
4096
+ type: import_editor42.ASTFactory.createObject({
4050
4097
  properties: declareRows.map(
4051
- (_v) => import_editor41.ASTFactory.createProperty({
4098
+ (_v) => import_editor42.ASTFactory.createProperty({
4052
4099
  key: _v.left,
4053
4100
  type: _v.right?.type === "constant" ? import_json_schema13.JsonSchemaUtils.schemaToAST(_v.right?.schema || {}) : void 0,
4054
- initializer: _v.right?.type === "ref" ? import_editor41.ASTFactory.createKeyPathExpression({
4101
+ initializer: _v.right?.type === "ref" ? import_editor42.ASTFactory.createKeyPathExpression({
4055
4102
  keyPath: _v.right?.content || []
4056
4103
  }) : {}
4057
4104
  })
@@ -4063,10 +4110,10 @@ var createInferAssignPlugin = (0, import_editor41.defineFormPluginCreator)({
4063
4110
  })
4064
4111
  });
4065
4112
  addFormatOnSubmit((formData, ctx) => {
4066
- (0, import_lodash11.set)(
4113
+ (0, import_lodash12.set)(
4067
4114
  formData,
4068
4115
  outputKey,
4069
- import_json_schema13.JsonSchemaUtils.astToSchema((0, import_editor41.getNodeScope)(ctx.node).output.variables?.[0]?.type)
4116
+ import_json_schema13.JsonSchemaUtils.astToSchema((0, import_editor42.getNodeScope)(ctx.node).output.variables?.[0]?.type)
4070
4117
  );
4071
4118
  return formData;
4072
4119
  });
@@ -4074,25 +4121,25 @@ var createInferAssignPlugin = (0, import_editor41.defineFormPluginCreator)({
4074
4121
  });
4075
4122
 
4076
4123
  // src/validate/validate-flow-value/index.tsx
4077
- var import_lodash12 = require("lodash");
4078
- var import_editor42 = require("@flowgram.ai/editor");
4124
+ var import_lodash13 = require("lodash");
4125
+ var import_editor43 = require("@flowgram.ai/editor");
4079
4126
  function validateFlowValue(value, ctx) {
4080
4127
  const { node, required, errorMessages } = ctx;
4081
4128
  const {
4082
4129
  required: requiredMessage = "Field is required",
4083
4130
  unknownVariable: unknownVariableMessage = "Unknown Variable"
4084
4131
  } = errorMessages || {};
4085
- if (required && ((0, import_lodash12.isNil)(value) || (0, import_lodash12.isNil)(value?.content) || value?.content === "")) {
4132
+ if (required && ((0, import_lodash13.isNil)(value) || (0, import_lodash13.isNil)(value?.content) || value?.content === "")) {
4086
4133
  return {
4087
- level: import_editor42.FeedbackLevel.Error,
4134
+ level: import_editor43.FeedbackLevel.Error,
4088
4135
  message: requiredMessage
4089
4136
  };
4090
4137
  }
4091
4138
  if (value?.type === "ref") {
4092
- const variable = (0, import_editor42.getNodeScope)(node).available.getByKeyPath(value?.content || []);
4139
+ const variable = (0, import_editor43.getNodeScope)(node).available.getByKeyPath(value?.content || []);
4093
4140
  if (!variable) {
4094
4141
  return {
4095
- level: import_editor42.FeedbackLevel.Error,
4142
+ level: import_editor43.FeedbackLevel.Error,
4096
4143
  message: unknownVariableMessage
4097
4144
  };
4098
4145
  }
@@ -4100,10 +4147,10 @@ function validateFlowValue(value, ctx) {
4100
4147
  if (value?.type === "template") {
4101
4148
  const allRefs = getTemplateKeyPaths(value);
4102
4149
  for (const ref of allRefs) {
4103
- const variable = (0, import_editor42.getNodeScope)(node).available.getByKeyPath(ref);
4150
+ const variable = (0, import_editor43.getNodeScope)(node).available.getByKeyPath(ref);
4104
4151
  if (!variable) {
4105
4152
  return {
4106
- level: import_editor42.FeedbackLevel.Error,
4153
+ level: import_editor43.FeedbackLevel.Error,
4107
4154
  message: unknownVariableMessage
4108
4155
  };
4109
4156
  }
@@ -4113,7 +4160,7 @@ function validateFlowValue(value, ctx) {
4113
4160
  }
4114
4161
  function getTemplateKeyPaths(value) {
4115
4162
  const keyPathReg = /{{(.*?)}}/g;
4116
- return (0, import_lodash12.uniq)(value.content?.match(keyPathReg) || []).map(
4163
+ return (0, import_lodash13.uniq)(value.content?.match(keyPathReg) || []).map(
4117
4164
  (_keyPath) => _keyPath.slice(2, -2).split(".")
4118
4165
  );
4119
4166
  }
@@ -4129,6 +4176,7 @@ function getTemplateKeyPaths(value) {
4129
4176
  ConditionRow,
4130
4177
  ConstantInput,
4131
4178
  DisplayFlowValue,
4179
+ DisplayInputsValueAllInTag,
4132
4180
  DisplayInputsValues,
4133
4181
  DisplayOutputs,
4134
4182
  DisplaySchemaTag,