@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 +54 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +50 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/json-schema-editor/index.tsx +8 -2
- package/src/components/variable-selector/use-variable-tree.tsx +1 -4
- package/src/effects/index.ts +2 -0
- package/src/effects/provide-json-schema-outputs/config.json +8 -0
- package/src/effects/provide-json-schema-outputs/index.ts +23 -0
- package/src/effects/sync-variable-title/config.json +5 -0
- package/src/effects/sync-variable-title/index.ts +23 -0
package/dist/index.d.mts
CHANGED
|
@@ -91,6 +91,7 @@ declare function JsonSchemaEditor(props: {
|
|
|
91
91
|
value?: IJsonSchema;
|
|
92
92
|
onChange?: (value: IJsonSchema) => void;
|
|
93
93
|
config?: ConfigType;
|
|
94
|
+
className?: string;
|
|
94
95
|
}): React$1.JSX.Element;
|
|
95
96
|
|
|
96
97
|
declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JSX.Element;
|
|
@@ -173,6 +174,10 @@ declare const provideBatchOutputsEffect: EffectOptions[];
|
|
|
173
174
|
*/
|
|
174
175
|
declare const autoRenameRefEffect: EffectOptions[];
|
|
175
176
|
|
|
177
|
+
declare const provideJsonSchemaOutputs: EffectOptions[];
|
|
178
|
+
|
|
179
|
+
declare const syncVariableTitle: EffectOptions[];
|
|
180
|
+
|
|
176
181
|
interface LegacyFlowRefValueSchema {
|
|
177
182
|
type: 'ref';
|
|
178
183
|
content: string;
|
|
@@ -282,4 +287,4 @@ declare namespace JsonSchemaUtils {
|
|
|
282
287
|
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
283
288
|
}
|
|
284
289
|
|
|
285
|
-
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect };
|
|
290
|
+
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle };
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,7 @@ declare function JsonSchemaEditor(props: {
|
|
|
91
91
|
value?: IJsonSchema;
|
|
92
92
|
onChange?: (value: IJsonSchema) => void;
|
|
93
93
|
config?: ConfigType;
|
|
94
|
+
className?: string;
|
|
94
95
|
}): React$1.JSX.Element;
|
|
95
96
|
|
|
96
97
|
declare function BatchVariableSelector(props: VariableSelectorProps): React$1.JSX.Element;
|
|
@@ -173,6 +174,10 @@ declare const provideBatchOutputsEffect: EffectOptions[];
|
|
|
173
174
|
*/
|
|
174
175
|
declare const autoRenameRefEffect: EffectOptions[];
|
|
175
176
|
|
|
177
|
+
declare const provideJsonSchemaOutputs: EffectOptions[];
|
|
178
|
+
|
|
179
|
+
declare const syncVariableTitle: EffectOptions[];
|
|
180
|
+
|
|
176
181
|
interface LegacyFlowRefValueSchema {
|
|
177
182
|
type: 'ref';
|
|
178
183
|
content: string;
|
|
@@ -282,4 +287,4 @@ declare namespace JsonSchemaUtils {
|
|
|
282
287
|
function isASTMatchSchema(typeAST: BaseType, schema: IJsonSchema | IJsonSchema[]): boolean;
|
|
283
288
|
}
|
|
284
289
|
|
|
285
|
-
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect };
|
|
290
|
+
export { ArrayIcons, BatchVariableSelector, ConditionRow, type ConditionRowValueType, ConstantInput, DynamicValueInput, type IBasicJsonSchema, type IFlowConstantRefValue, type IFlowConstantValue, type IFlowExpressionValue, type IFlowRefValue, type IFlowTemplateValue, type IFlowValue, type IJsonSchema, type JsonSchemaBasicType, JsonSchemaEditor, JsonSchemaUtils, TypeSelector, VariableSelector, type VariableSelectorProps, VariableTypeIcons, autoRenameRefEffect, formatLegacyRefOnInit, formatLegacyRefOnSubmit, formatLegacyRefToNewRef, formatNewRefToLegacyRef, getSchemaIcon, getTypeSelectValue, isLegacyFlowRefValueSchema, isNewFlowRefValueSchema, parseTypeSelectValue, provideBatchInputEffect, provideBatchOutputsEffect, provideJsonSchemaOutputs, syncVariableTitle };
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,9 @@ __export(src_exports, {
|
|
|
51
51
|
isNewFlowRefValueSchema: () => isNewFlowRefValueSchema,
|
|
52
52
|
parseTypeSelectValue: () => parseTypeSelectValue,
|
|
53
53
|
provideBatchInputEffect: () => provideBatchInputEffect,
|
|
54
|
-
provideBatchOutputsEffect: () => provideBatchOutputsEffect
|
|
54
|
+
provideBatchOutputsEffect: () => provideBatchOutputsEffect,
|
|
55
|
+
provideJsonSchemaOutputs: () => provideJsonSchemaOutputs,
|
|
56
|
+
syncVariableTitle: () => syncVariableTitle
|
|
55
57
|
});
|
|
56
58
|
module.exports = __toCommonJS(src_exports);
|
|
57
59
|
|
|
@@ -600,9 +602,6 @@ function useVariableTree(params) {
|
|
|
600
602
|
let children;
|
|
601
603
|
if (import_editor2.ASTMatch.isObject(type)) {
|
|
602
604
|
children = (type.properties || []).map((_property) => renderVariable(_property, [...parentFields, variable])).filter(Boolean);
|
|
603
|
-
if (!children?.length) {
|
|
604
|
-
return null;
|
|
605
|
-
}
|
|
606
605
|
}
|
|
607
606
|
const keyPath = [...parentFields.map((_field) => _field.key), variable.key];
|
|
608
607
|
const key = keyPath.join(".");
|
|
@@ -1297,7 +1296,7 @@ function JsonSchemaEditor(props) {
|
|
|
1297
1296
|
value,
|
|
1298
1297
|
onChangeProps
|
|
1299
1298
|
);
|
|
1300
|
-
return /* @__PURE__ */ import_react10.default.createElement(UIContainer,
|
|
1299
|
+
return /* @__PURE__ */ import_react10.default.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ import_react10.default.createElement(UIProperties, null, propertyList.map((_property, index) => /* @__PURE__ */ import_react10.default.createElement(
|
|
1301
1300
|
PropertyEdit,
|
|
1302
1301
|
{
|
|
1303
1302
|
key: _property.key,
|
|
@@ -1311,7 +1310,16 @@ function JsonSchemaEditor(props) {
|
|
|
1311
1310
|
onRemoveProperty(_property.key);
|
|
1312
1311
|
}
|
|
1313
1312
|
}
|
|
1314
|
-
))), /* @__PURE__ */ import_react10.default.createElement(
|
|
1313
|
+
))), /* @__PURE__ */ import_react10.default.createElement(
|
|
1314
|
+
import_semi_ui6.Button,
|
|
1315
|
+
{
|
|
1316
|
+
size: "small",
|
|
1317
|
+
style: { marginTop: 10, marginLeft: 16 },
|
|
1318
|
+
icon: /* @__PURE__ */ import_react10.default.createElement(import_semi_icons5.IconPlus, null),
|
|
1319
|
+
onClick: onAddProperty
|
|
1320
|
+
},
|
|
1321
|
+
config?.addButtonText ?? "Add"
|
|
1322
|
+
));
|
|
1315
1323
|
}
|
|
1316
1324
|
function PropertyEdit(props) {
|
|
1317
1325
|
const {
|
|
@@ -1953,6 +1961,39 @@ function traverseRef(name, value, cb) {
|
|
|
1953
1961
|
}
|
|
1954
1962
|
return;
|
|
1955
1963
|
}
|
|
1964
|
+
|
|
1965
|
+
// src/effects/provide-json-schema-outputs/index.ts
|
|
1966
|
+
var import_editor8 = require("@flowgram.ai/editor");
|
|
1967
|
+
var provideJsonSchemaOutputs = (0, import_editor8.createEffectFromVariableProvider)({
|
|
1968
|
+
parse: (value, ctx) => [
|
|
1969
|
+
import_editor8.ASTFactory.createVariableDeclaration({
|
|
1970
|
+
key: `${ctx.node.id}`,
|
|
1971
|
+
meta: {
|
|
1972
|
+
title: (0, import_editor8.getNodeForm)(ctx.node)?.getValueIn("title") || ctx.node.id,
|
|
1973
|
+
icon: ctx.node.getNodeRegistry().info?.icon
|
|
1974
|
+
},
|
|
1975
|
+
type: JsonSchemaUtils.schemaToAST(value)
|
|
1976
|
+
})
|
|
1977
|
+
]
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
// src/effects/sync-variable-title/index.ts
|
|
1981
|
+
var import_editor9 = require("@flowgram.ai/editor");
|
|
1982
|
+
var syncVariableTitle = [
|
|
1983
|
+
{
|
|
1984
|
+
event: import_editor9.DataEvent.onValueChange,
|
|
1985
|
+
effect: ({ value, context }) => {
|
|
1986
|
+
context.node.getData(import_editor9.FlowNodeVariableData).allScopes.forEach((_scope) => {
|
|
1987
|
+
_scope.output.variables.forEach((_var) => {
|
|
1988
|
+
_var.updateMeta({
|
|
1989
|
+
title: value || context.node.id,
|
|
1990
|
+
icon: context.node.getNodeRegistry().info?.icon
|
|
1991
|
+
});
|
|
1992
|
+
});
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
];
|
|
1956
1997
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1957
1998
|
0 && (module.exports = {
|
|
1958
1999
|
ArrayIcons,
|
|
@@ -1976,6 +2017,8 @@ function traverseRef(name, value, cb) {
|
|
|
1976
2017
|
isNewFlowRefValueSchema,
|
|
1977
2018
|
parseTypeSelectValue,
|
|
1978
2019
|
provideBatchInputEffect,
|
|
1979
|
-
provideBatchOutputsEffect
|
|
2020
|
+
provideBatchOutputsEffect,
|
|
2021
|
+
provideJsonSchemaOutputs,
|
|
2022
|
+
syncVariableTitle
|
|
1980
2023
|
});
|
|
1981
2024
|
//# sourceMappingURL=index.js.map
|