@processmaker/screen-builder 3.8.15-patch.a.1 → 3.8.15-patch.c

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.
@@ -1,76 +0,0 @@
1
- /**
2
- * VariablesToSubmitFilter Mixin
3
- *
4
- * Filters form data before submission based on button configuration.
5
- * Protects against invalid data (null/undefined/false) and preserves system variables.
6
- */
7
-
8
- export default {
9
- methods: {
10
- /**
11
- * Filters data for submission based on variablesToSubmit configuration
12
- * @param {Object} data - Form data to filter
13
- * @param {Object} buttonInfo - Button configuration with optional variablesToSubmit array
14
- * @returns {Object} Filtered data (always returns a valid object)
15
- */
16
- filterDataForSubmission(data, buttonInfo) {
17
- // Normalize invalid data to empty object
18
- const safeData = this.isValidObject(data) ? data : {};
19
-
20
- // No filtering: return all data (backward compatibility)
21
- if (!this.shouldFilterVariables(buttonInfo)) {
22
- return safeData;
23
- }
24
-
25
- // Apply filtering
26
- const variablesToSubmit = buttonInfo.variablesToSubmit;
27
- const filteredData = {};
28
-
29
- // Add requested variables
30
- variablesToSubmit.forEach(variableName => {
31
- if (variableName in safeData) {
32
- filteredData[variableName] = safeData[variableName];
33
- }
34
- });
35
-
36
- // Always preserve system variables (starting with _)
37
- Object.keys(safeData).forEach(key => {
38
- if (key.startsWith('_')) {
39
- filteredData[key] = safeData[key];
40
- }
41
- });
42
-
43
- return filteredData;
44
- },
45
-
46
- /**
47
- * Checks if data is a valid plain object
48
- * @param {*} data - Data to validate
49
- * @returns {boolean} True if valid object, false otherwise
50
- */
51
- isValidObject(data) {
52
- return (
53
- data !== null &&
54
- data !== undefined &&
55
- data !== false &&
56
- typeof data === 'object' &&
57
- !Array.isArray(data)
58
- );
59
- },
60
-
61
- /**
62
- * Checks if filtering should be applied
63
- * @param {Object} buttonInfo - Button configuration
64
- * @returns {boolean} True if filtering enabled, false otherwise
65
- */
66
- shouldFilterVariables(buttonInfo) {
67
- return (
68
- buttonInfo &&
69
- buttonInfo.variablesToSubmit &&
70
- Array.isArray(buttonInfo.variablesToSubmit) &&
71
- buttonInfo.variablesToSubmit.length > 0
72
- );
73
- }
74
- }
75
- };
76
-