datasync-dynamic-form 1.0.26 → 1.0.27
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.
|
@@ -70,48 +70,6 @@ class DsDynamicForm extends _react.Component {
|
|
|
70
70
|
this.clearForm();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
clearForm_OBSOLETE = () => {
|
|
74
|
-
console.log("27:ClearForm");
|
|
75
|
-
/** Duplicate props.form */
|
|
76
|
-
let clearObject2 = JSON.parse(JSON.stringify(this.props.form));
|
|
77
|
-
|
|
78
|
-
/** set data_tier with (props.foreign_keys + props.data_tier) */
|
|
79
|
-
if (this.props.data_blob) {
|
|
80
|
-
//Set internal data_tier component property
|
|
81
|
-
//OBSOLETE this.data_tier = this.props.data_blob.data_tier
|
|
82
|
-
if (globals.parameters.debugging) console.log("01:this.props.data_blob ->", this.props.data_blob);
|
|
83
|
-
clearObject2.data_tier = this.props.data_blob.data_tier;
|
|
84
|
-
} else {
|
|
85
|
-
if (globals.parameters.debugging) console.log("01:this.props.data_blob.data_tier unDefined");
|
|
86
|
-
clearObject2.data_tier = {}; //Set empty data_tier
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Override data with foreign keys wne props.foreign_key is available */
|
|
90
|
-
if (this.props.foreign_keys) {
|
|
91
|
-
clearObject2.data_tier = Object.assign(clearObject2.data_tier, this.props.foreign_keys); //Dead code to be checked !!!
|
|
92
|
-
this.local_data_blob.data_tier = Object.assign(clearObject2.data_tier, this.props.foreign_keys); //Dead code to be checked !!!
|
|
93
|
-
}
|
|
94
|
-
if (globals.parameters.debugging) {
|
|
95
|
-
console.log("01:----- clearForm -----");
|
|
96
|
-
console.log("01:clearForm::this.props.form->", this.props.form);
|
|
97
|
-
console.log("01:clearForm::clearObject2 mixed with data_tier ->", clearObject2);
|
|
98
|
-
console.log("01:clearForm::internal this.data_blob ->", this.local_data_blob);
|
|
99
|
-
}
|
|
100
|
-
this.setState({
|
|
101
|
-
fieldError: [],
|
|
102
|
-
form: {},
|
|
103
|
-
captcha1: (0, _datasyncCommonLibrary.Randomize)(0, 5),
|
|
104
|
-
captcha2: (0, _datasyncCommonLibrary.Randomize)(0, 5)
|
|
105
|
-
},
|
|
106
|
-
//Clear forced
|
|
107
|
-
() => {
|
|
108
|
-
if (globals.parameters.debugging) console.log("09/07:DynamicForm3Tiers2 state cleansed 2:", this.state);
|
|
109
|
-
this.setState({
|
|
110
|
-
fieldError: [],
|
|
111
|
-
form: clearObject2
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
73
|
|
|
116
74
|
/**
|
|
117
75
|
* Prototype : clearForm
|
|
@@ -143,6 +101,9 @@ class DsDynamicForm extends _react.Component {
|
|
|
143
101
|
data_tier: {}
|
|
144
102
|
};
|
|
145
103
|
//this.local_data_blob.data_tier = Object.assign({}, duplicate_data_tier);
|
|
104
|
+
|
|
105
|
+
//Ensure props.foreign_keys is a json object - PMAB on 2025-04-10
|
|
106
|
+
if (this.props.foreign_keys && typeof this.props.foreign_keys !== "object") throw new Error("foreign_keys must be a json object !");
|
|
146
107
|
this.local_data_blob.data_tier = Object.assign(this.props.foreign_keys ? this.props.foreign_keys : {}, duplicate_data_tier);
|
|
147
108
|
console.log("28:this.local_data_blob.data_tier ->", this.local_data_blob.data_tier);
|
|
148
109
|
console.log("28:this.props.data_blob.data_tier ->", this.props.data_blob && this.props.data_blob.data_tier ? this.props.data_blob.data_tier : "props data_blob not set");
|