creo-flow-extensions-base 1.1.0-dev.2 → 1.1.0-dev.4
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/lib/createExtension/index.js +18 -7
- package/lib/fields/checkbox/index.d.ts +1 -0
- package/lib/fields/code/index.d.ts +1 -0
- package/lib/fields/collapsibleFieldsList/index.d.ts +19 -0
- package/lib/fields/collapsibleFieldsList/index.js +16 -0
- package/lib/fields/dynamicFieldsList/index.d.ts +19 -0
- package/lib/fields/dynamicFieldsList/index.js +16 -0
- package/lib/fields/enum/index.d.ts +4 -1
- package/lib/fields/enum/index.js +3 -0
- package/lib/fields/fieldsGroup/index.d.ts +22 -0
- package/lib/fields/fieldsGroup/index.js +16 -0
- package/lib/fields/input/index.d.ts +1 -0
- package/lib/fields/select/index.d.ts +1 -0
- package/lib/nodes/index.d.ts +4 -1
- package/package.json +1 -1
|
@@ -123,13 +123,7 @@ const getFullNode = async (event, extension) => {
|
|
|
123
123
|
nodeName: event.nodeTitle
|
|
124
124
|
});
|
|
125
125
|
}
|
|
126
|
-
const fullFields = await
|
|
127
|
-
const isSelect = field.type === enum_2.FieldTypes.SELECT;
|
|
128
|
-
if (!isSelect)
|
|
129
|
-
return field;
|
|
130
|
-
const options = field?.getOptions ? await field.getOptions(methodProps) : [];
|
|
131
|
-
return { ...field, options };
|
|
132
|
-
}));
|
|
126
|
+
const fullFields = await resolveFields(method.fields, methodProps);
|
|
133
127
|
return {
|
|
134
128
|
statusCode: 200,
|
|
135
129
|
body: JSON.stringify({ ...method, fields: fullFields }),
|
|
@@ -151,3 +145,20 @@ const getFullNode = async (event, extension) => {
|
|
|
151
145
|
};
|
|
152
146
|
}
|
|
153
147
|
};
|
|
148
|
+
async function resolveFields(fields, methodProps) {
|
|
149
|
+
return await Promise.all(fields.map(async (field) => {
|
|
150
|
+
const isSelect = field.type === enum_2.FieldTypes.SELECT;
|
|
151
|
+
const hasNestedFields = Array.isArray(field.fields);
|
|
152
|
+
const options = isSelect && field.getOptions
|
|
153
|
+
? await field.getOptions(methodProps)
|
|
154
|
+
: undefined;
|
|
155
|
+
const resolvedNestedFields = hasNestedFields
|
|
156
|
+
? await resolveFields(field.fields, methodProps)
|
|
157
|
+
: undefined;
|
|
158
|
+
return {
|
|
159
|
+
...field,
|
|
160
|
+
...(options !== undefined ? { options } : {}),
|
|
161
|
+
...(resolvedNestedFields ? { fields: resolvedNestedFields } : {}),
|
|
162
|
+
};
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FieldTypes } from "../enum";
|
|
2
|
+
import { Field } from "../../nodes";
|
|
3
|
+
export interface ICollapsibleFieldsList {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type: FieldTypes.COLLAPSIBLE_FIELDS_LIST;
|
|
9
|
+
fields: Field[];
|
|
10
|
+
}
|
|
11
|
+
interface IProps {
|
|
12
|
+
label?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
placeholder?: '';
|
|
15
|
+
description?: '';
|
|
16
|
+
fields: Field[];
|
|
17
|
+
}
|
|
18
|
+
export declare const createCollapsibleFieldsList: (codeField: IProps) => ICollapsibleFieldsList;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCollapsibleFieldsList = void 0;
|
|
4
|
+
const enum_1 = require("../enum");
|
|
5
|
+
const createCollapsibleFieldsList = (codeField) => {
|
|
6
|
+
const { name, label = '', fields = [], description = '', placeholder = '', } = codeField;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
label,
|
|
10
|
+
type: enum_1.FieldTypes.COLLAPSIBLE_FIELDS_LIST,
|
|
11
|
+
fields,
|
|
12
|
+
description,
|
|
13
|
+
placeholder,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.createCollapsibleFieldsList = createCollapsibleFieldsList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FieldTypes } from "../enum";
|
|
2
|
+
import { Field } from "../../nodes";
|
|
3
|
+
export interface IDynamicFieldsList {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
type: FieldTypes.DYNAMIC_FIELDS_LIST;
|
|
9
|
+
fields: Field[];
|
|
10
|
+
}
|
|
11
|
+
interface IProps {
|
|
12
|
+
label?: string;
|
|
13
|
+
name: string;
|
|
14
|
+
placeholder?: '';
|
|
15
|
+
description?: '';
|
|
16
|
+
fields: Field[];
|
|
17
|
+
}
|
|
18
|
+
export declare const createDynamicFieldsList: (codeField: IProps) => IDynamicFieldsList;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDynamicFieldsList = void 0;
|
|
4
|
+
const enum_1 = require("../enum");
|
|
5
|
+
const createDynamicFieldsList = (codeField) => {
|
|
6
|
+
const { name, label = '', fields = [], description = '', placeholder = '', } = codeField;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
label,
|
|
10
|
+
type: enum_1.FieldTypes.DYNAMIC_FIELDS_LIST,
|
|
11
|
+
fields,
|
|
12
|
+
description,
|
|
13
|
+
placeholder,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.createDynamicFieldsList = createDynamicFieldsList;
|
|
@@ -2,5 +2,8 @@ export declare enum FieldTypes {
|
|
|
2
2
|
CHECKBOX = "checkbox",
|
|
3
3
|
CODE = "code",
|
|
4
4
|
INPUT = "input",
|
|
5
|
-
SELECT = "select"
|
|
5
|
+
SELECT = "select",
|
|
6
|
+
DYNAMIC_FIELDS_LIST = "dynamicFieldsList",
|
|
7
|
+
FIELDS_GROUP = "fieldsListGroup",
|
|
8
|
+
COLLAPSIBLE_FIELDS_LIST = "collapsibleFieldsList"
|
|
6
9
|
}
|
package/lib/fields/enum/index.js
CHANGED
|
@@ -7,5 +7,8 @@ var FieldTypes;
|
|
|
7
7
|
FieldTypes["CODE"] = "code";
|
|
8
8
|
FieldTypes["INPUT"] = "input";
|
|
9
9
|
FieldTypes["SELECT"] = "select";
|
|
10
|
+
FieldTypes["DYNAMIC_FIELDS_LIST"] = "dynamicFieldsList";
|
|
11
|
+
FieldTypes["FIELDS_GROUP"] = "fieldsListGroup";
|
|
12
|
+
FieldTypes["COLLAPSIBLE_FIELDS_LIST"] = "collapsibleFieldsList";
|
|
10
13
|
})(FieldTypes || (exports.FieldTypes = FieldTypes = {}));
|
|
11
14
|
;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldTypes } from "../enum";
|
|
2
|
+
import { Field } from "../../nodes";
|
|
3
|
+
type ISizedField = Field & {
|
|
4
|
+
size: number | string;
|
|
5
|
+
};
|
|
6
|
+
export interface IFieldsGroup {
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
type: FieldTypes.FIELDS_GROUP;
|
|
12
|
+
fields: ISizedField[];
|
|
13
|
+
}
|
|
14
|
+
interface IProps {
|
|
15
|
+
label?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
placeholder?: '';
|
|
18
|
+
description?: '';
|
|
19
|
+
fields: ISizedField[];
|
|
20
|
+
}
|
|
21
|
+
export declare const createFieldsGroup: (codeField: IProps) => IFieldsGroup;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFieldsGroup = void 0;
|
|
4
|
+
const enum_1 = require("../enum");
|
|
5
|
+
const createFieldsGroup = (codeField) => {
|
|
6
|
+
const { name, label = '', fields = [], description = '', placeholder = '', } = codeField;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
label,
|
|
10
|
+
type: enum_1.FieldTypes.FIELDS_GROUP,
|
|
11
|
+
fields,
|
|
12
|
+
description,
|
|
13
|
+
placeholder,
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.createFieldsGroup = createFieldsGroup;
|
package/lib/nodes/index.d.ts
CHANGED
|
@@ -3,7 +3,10 @@ import { IInputField } from '../fields/input';
|
|
|
3
3
|
import { ISelectField } from '../fields/select';
|
|
4
4
|
import { ICodeField } from '../fields/code';
|
|
5
5
|
import { NodeContext } from "../executionContext";
|
|
6
|
-
|
|
6
|
+
import { ICollapsibleFieldsList } from "../fields/collapsibleFieldsList";
|
|
7
|
+
import { IDynamicFieldsList } from "../fields/dynamicFieldsList";
|
|
8
|
+
import { IFieldsGroup } from "../fields/fieldsGroup";
|
|
9
|
+
export type Field = IInputField | ISelectField | ICheckboxField | ICodeField | ICollapsibleFieldsList | IDynamicFieldsList | IFieldsGroup;
|
|
7
10
|
export interface IFuncProps {
|
|
8
11
|
args: any;
|
|
9
12
|
context: object;
|