@processmaker/screen-builder 3.8.7 → 3.8.9
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/assets/worker-6b397baf.js.map +1 -0
- package/dist/vue-form-builder.css +1 -1
- package/dist/vue-form-builder.es.js +6216 -5724
- package/dist/vue-form-builder.es.js.map +1 -1
- package/dist/vue-form-builder.umd.js +38 -38
- package/dist/vue-form-builder.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/components/accordions.js +1 -1
- package/src/components/editor/dynamic-panel-editor.vue +377 -0
- package/src/components/editor/index.js +1 -0
- package/src/components/index.js +7 -1
- package/src/components/inspector/dynamic-panel.vue +73 -0
- package/src/components/inspector/index.js +1 -0
- package/src/components/renderer/case-progress-bar.vue +205 -0
- package/src/components/renderer/form-button.vue +57 -15
- package/src/components/renderer/form-dynamic-panel.vue +68 -0
- package/src/components/renderer/index.js +2 -0
- package/src/components/renderer/link-button.vue +10 -3
- package/src/components/vue-form-builder.vue +5 -2
- package/src/form-builder-controls.js +72 -3
- package/src/form-control-common-properties.js +66 -43
- package/src/mixins/extensions/FormDynamicPanel.js +71 -0
- package/src/workers/worker.js +66 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
configRef: null,
|
|
4
|
+
loopContext: null
|
|
5
|
+
},
|
|
6
|
+
data() {
|
|
7
|
+
return {
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
methods: {
|
|
11
|
+
loadFormDynamicPanelProperties({ properties, element }) {
|
|
12
|
+
const variableName = element.config.settings.varname;
|
|
13
|
+
const index = element.config.settings.indexName;
|
|
14
|
+
|
|
15
|
+
// Add itemData to the properties of FormDynamicPanel
|
|
16
|
+
properties[':itemData'] = `${variableName} && ${variableName}[${index}]`;
|
|
17
|
+
|
|
18
|
+
// Add emptyStateMessage property if configured
|
|
19
|
+
if (element.config.settings.emptyStateMessage) {
|
|
20
|
+
properties[':emptyStateMessage'] = this.byRef(element.config.settings.emptyStateMessage);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Add validationData for Mustache processing
|
|
24
|
+
properties[':validationData'] = 'getValidationData()';
|
|
25
|
+
|
|
26
|
+
this.registerVariable(element.config.settings.varname, element);
|
|
27
|
+
},
|
|
28
|
+
loadFormDynamicPanelItems({ element, node, definition }) {
|
|
29
|
+
const nested = {
|
|
30
|
+
config: [
|
|
31
|
+
{
|
|
32
|
+
items: element.items,
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
watchers: [],
|
|
36
|
+
isMobile: false
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const variableName = element.config.settings.varname;
|
|
41
|
+
const index = element.config.settings.indexName;
|
|
42
|
+
|
|
43
|
+
// Add nested component inside dynamic panel
|
|
44
|
+
const child = this.createComponent("ScreenRenderer", {
|
|
45
|
+
":definition": this.byRef(nested),
|
|
46
|
+
":value": `${variableName} && ${variableName}[${index}]`,
|
|
47
|
+
":loop-context": `'${variableName} && ${variableName}[${index}]'`,
|
|
48
|
+
":_parent": "getValidationData()",
|
|
49
|
+
":components": this.byRef(this.components),
|
|
50
|
+
":config-ref": this.byRef(this.configRef || definition.config),
|
|
51
|
+
"@submit": "submitForm"
|
|
52
|
+
});
|
|
53
|
+
node.appendChild(child);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
mounted() {
|
|
57
|
+
// Convert the FormDynamicPanel to a div
|
|
58
|
+
this.extensions.push({
|
|
59
|
+
onloadproperties(params) {
|
|
60
|
+
if (params.element.container && params.componentName === "FormDynamicPanel") {
|
|
61
|
+
this.loadFormDynamicPanelProperties(params);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
onloaditems(params) {
|
|
65
|
+
if (params.element.container && params.componentName === "FormDynamicPanel") {
|
|
66
|
+
this.loadFormDynamicPanelItems(params);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// worker.js
|
|
2
|
+
import { parse } from 'flatted';
|
|
3
|
+
|
|
4
|
+
self.onmessage = async function (e) {
|
|
5
|
+
const { fn, dataRefs } = e.data;
|
|
6
|
+
const { data, scope, parent } = parse(dataRefs);
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
// Validate inputs
|
|
10
|
+
if (!fn || typeof fn !== 'string') {
|
|
11
|
+
throw new Error('Function code must be a string');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Check if the code is asynchronous
|
|
15
|
+
const isAsync = detectAsyncCode(fn);
|
|
16
|
+
|
|
17
|
+
// If the code contains await, wrap it in an async function
|
|
18
|
+
const functionBody = isAsync
|
|
19
|
+
? `return (async () => { ${fn} })();`
|
|
20
|
+
: fn;
|
|
21
|
+
|
|
22
|
+
// Use Function constructor with explicit parameter and body
|
|
23
|
+
// eslint-disable-next-line no-new-func
|
|
24
|
+
const userFunc = new Function('data', 'parent', functionBody);
|
|
25
|
+
const result = isAsync ? await userFunc.apply(scope, [data, parent]) : userFunc.apply(scope, [data, parent]);
|
|
26
|
+
|
|
27
|
+
self.postMessage({ result });
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.error('❌ Error executing handler:', error);
|
|
30
|
+
|
|
31
|
+
self.postMessage({
|
|
32
|
+
error: error.message || error.toString(),
|
|
33
|
+
stack: error.stack
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function detectAsyncCode(code) {
|
|
39
|
+
// Remove comments and strings to avoid false positives
|
|
40
|
+
const cleanCode = code
|
|
41
|
+
.replace(/\/\*[\s\S]*?\*\//g, '') // Remove block comments
|
|
42
|
+
.replace(/\/\/.*$/gm, '') // Remove line comments
|
|
43
|
+
.replace(/"[^"]*"/g, '""') // Replace string content
|
|
44
|
+
.replace(/'[^']*'/g, "''") // Replace string content
|
|
45
|
+
.replace(/`[^`]*`/g, '``'); // Replace template literals
|
|
46
|
+
|
|
47
|
+
// Check for async patterns
|
|
48
|
+
const asyncPatterns = [
|
|
49
|
+
/\bawait\b/, // await keyword
|
|
50
|
+
/\bPromise\b/, // Promise constructor
|
|
51
|
+
/\bfetch\b/, // fetch API
|
|
52
|
+
/\bsetTimeout\b/, // setTimeout
|
|
53
|
+
/\bsetInterval\b/, // setInterval
|
|
54
|
+
/\brequestAnimationFrame\b/, // requestAnimationFrame
|
|
55
|
+
/\brequestIdleCallback\b/, // requestIdleCallback
|
|
56
|
+
/\bnew\s+Promise/, // new Promise
|
|
57
|
+
/\b\.then\s*\(/, // .then() method
|
|
58
|
+
/\b\.catch\s*\(/, // .catch() method
|
|
59
|
+
/\b\.finally\s*\(/, // .finally() method
|
|
60
|
+
/\bPromise\./, // Promise static methods
|
|
61
|
+
/\basync\b/, // async keyword (in case it's used)
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
// Check if any async pattern is found
|
|
65
|
+
return asyncPatterns.some((pattern) => pattern.test(cleanCode));
|
|
66
|
+
}
|