@flowgram.ai/form-materials 0.2.13 → 0.2.15

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/esm/index.js CHANGED
@@ -543,9 +543,6 @@ function useVariableTree(params) {
543
543
  let children;
544
544
  if (ASTMatch2.isObject(type)) {
545
545
  children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
546
- if (!children?.length) {
547
- return null;
548
- }
549
546
  }
550
547
  const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
551
548
  const key = keyPath.join(".");
@@ -1247,7 +1244,7 @@ function JsonSchemaEditor(props) {
1247
1244
  value,
1248
1245
  onChangeProps
1249
1246
  );
1250
- return /* @__PURE__ */ React9.createElement(UIContainer, null, /* @__PURE__ */ React9.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1247
+ return /* @__PURE__ */ React9.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React9.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ React9.createElement(
1251
1248
  PropertyEdit,
1252
1249
  {
1253
1250
  key: _property.key,
@@ -1261,7 +1258,16 @@ function JsonSchemaEditor(props) {
1261
1258
  onRemoveProperty(_property.key);
1262
1259
  }
1263
1260
  }
1264
- ))), /* @__PURE__ */ React9.createElement(Button2, { size: "small", style: { marginTop: 10 }, icon: /* @__PURE__ */ React9.createElement(IconPlus, null), onClick: onAddProperty }, config?.addButtonText ?? "Add"));
1261
+ ))), /* @__PURE__ */ React9.createElement(
1262
+ Button2,
1263
+ {
1264
+ size: "small",
1265
+ style: { marginTop: 10, marginLeft: 16 },
1266
+ icon: /* @__PURE__ */ React9.createElement(IconPlus, null),
1267
+ onClick: onAddProperty
1268
+ },
1269
+ config?.addButtonText ?? "Add"
1270
+ ));
1265
1271
  }
1266
1272
  function PropertyEdit(props) {
1267
1273
  const {
@@ -1914,6 +1920,46 @@ function traverseRef(name, value, cb) {
1914
1920
  }
1915
1921
  return;
1916
1922
  }
1923
+
1924
+ // src/effects/provide-json-schema-outputs/index.ts
1925
+ import {
1926
+ ASTFactory as ASTFactory4,
1927
+ createEffectFromVariableProvider as createEffectFromVariableProvider3,
1928
+ getNodeForm as getNodeForm3
1929
+ } from "@flowgram.ai/editor";
1930
+ var provideJsonSchemaOutputs = createEffectFromVariableProvider3({
1931
+ parse: (value, ctx) => [
1932
+ ASTFactory4.createVariableDeclaration({
1933
+ key: `${ctx.node.id}`,
1934
+ meta: {
1935
+ title: getNodeForm3(ctx.node)?.getValueIn("title") || ctx.node.id,
1936
+ icon: ctx.node.getNodeRegistry().info?.icon
1937
+ },
1938
+ type: JsonSchemaUtils.schemaToAST(value)
1939
+ })
1940
+ ]
1941
+ });
1942
+
1943
+ // src/effects/sync-variable-title/index.ts
1944
+ import {
1945
+ DataEvent as DataEvent2,
1946
+ FlowNodeVariableData
1947
+ } from "@flowgram.ai/editor";
1948
+ var syncVariableTitle = [
1949
+ {
1950
+ event: DataEvent2.onValueChange,
1951
+ effect: ({ value, context }) => {
1952
+ context.node.getData(FlowNodeVariableData).allScopes.forEach((_scope) => {
1953
+ _scope.output.variables.forEach((_var) => {
1954
+ _var.updateMeta({
1955
+ title: value || context.node.id,
1956
+ icon: context.node.getNodeRegistry().info?.icon
1957
+ });
1958
+ });
1959
+ });
1960
+ }
1961
+ }
1962
+ ];
1917
1963
  export {
1918
1964
  ArrayIcons,
1919
1965
  BatchVariableSelector,
@@ -1936,6 +1982,8 @@ export {
1936
1982
  isNewFlowRefValueSchema,
1937
1983
  parseTypeSelectValue,
1938
1984
  provideBatchInputEffect,
1939
- provideBatchOutputsEffect
1985
+ provideBatchOutputsEffect,
1986
+ provideJsonSchemaOutputs,
1987
+ syncVariableTitle
1940
1988
  };
1941
1989
  //# sourceMappingURL=index.js.map