directual-web-components-v2 3.11.335 → 3.11.336
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/index.js +59 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +59 -12
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19497,6 +19497,11 @@ function ElementAction(props) {
|
|
|
19497
19497
|
if (action.actionSubmit) {
|
|
19498
19498
|
console.log("onSubmit");
|
|
19499
19499
|
onSubmit(res => {
|
|
19500
|
+
if (res === false) {
|
|
19501
|
+
setLoading(false);
|
|
19502
|
+
finish && finish(false);
|
|
19503
|
+
return;
|
|
19504
|
+
}
|
|
19500
19505
|
console.log("finish onSubmit", res);
|
|
19501
19506
|
console.log("payload => " + action.endpoint);
|
|
19502
19507
|
console.log(payload);
|
|
@@ -19669,6 +19674,11 @@ function ElementText(props) {
|
|
|
19669
19674
|
if (action.actionSubmit) {
|
|
19670
19675
|
console.log("onSubmit");
|
|
19671
19676
|
onSubmit(res => {
|
|
19677
|
+
if (res === false) {
|
|
19678
|
+
setLoading(false);
|
|
19679
|
+
finish && finish(false);
|
|
19680
|
+
return;
|
|
19681
|
+
}
|
|
19672
19682
|
console.log("finish onSubmit", res);
|
|
19673
19683
|
console.log("payload => " + action.endpoint);
|
|
19674
19684
|
console.log(payload);
|
|
@@ -19961,6 +19971,7 @@ function FpsForm2(props) {
|
|
|
19961
19971
|
const isSocketUpdateRef = React.useRef(false);
|
|
19962
19972
|
const restoredStepRef = React.useRef(null);
|
|
19963
19973
|
const isAutoSubmittingRef = React.useRef(false);
|
|
19974
|
+
const initialObjectIdRef = React.useRef(edditingOn ? _$1__default.get(data, "data[0].id") : null);
|
|
19964
19975
|
function usePrevious(value) {
|
|
19965
19976
|
const ref = React.useRef();
|
|
19966
19977
|
React.useEffect(() => {
|
|
@@ -20025,7 +20036,9 @@ function FpsForm2(props) {
|
|
|
20025
20036
|
return newModel;
|
|
20026
20037
|
}
|
|
20027
20038
|
React.useEffect(() => {
|
|
20028
|
-
|
|
20039
|
+
const _incomingId = _$1__default.get(data, "data[0].id");
|
|
20040
|
+
if (initialObjectIdRef.current && _incomingId && initialObjectIdRef.current !== _incomingId) {
|
|
20041
|
+
console.warn('[SOCKET GUARD] Отклонён апдейт для чужого объекта:', _incomingId, '(наш:', initialObjectIdRef.current + ')');
|
|
20029
20042
|
return;
|
|
20030
20043
|
}
|
|
20031
20044
|
const timestampToISO = timestamp => {
|
|
@@ -20055,7 +20068,7 @@ function FpsForm2(props) {
|
|
|
20055
20068
|
}, {});
|
|
20056
20069
|
const newExtendedModel = _extends({}, gatherDefaults(), _$1__default.get(data, "data[0]"), convertedDates, convertedBools);
|
|
20057
20070
|
setExtendedModel(newExtendedModel);
|
|
20058
|
-
let saveSate = _extends({},
|
|
20071
|
+
let saveSate = _extends({}, stateRef.current);
|
|
20059
20072
|
const newModel = _extends({}, flatternModel(_extends({}, gatherDefaults(), _$1__default.get(data, "data[0]"), convertedDates, convertedBools)));
|
|
20060
20073
|
if (!_$1__default.isEqual(newModel, model)) {
|
|
20061
20074
|
submitDebouncedRef.current.cancel();
|
|
@@ -20448,6 +20461,9 @@ function FpsForm2(props) {
|
|
|
20448
20461
|
if (autoSubmit) {
|
|
20449
20462
|
console.log('[AUTOSUBMIT LOG] Устанавливаем state перед отправкой:', JSON.parse(JSON.stringify(localState)));
|
|
20450
20463
|
}
|
|
20464
|
+
if (localModel.id && initialObjectIdRef.current && localModel.id !== initialObjectIdRef.current) {
|
|
20465
|
+
console.error('[SUBMIT ID MISMATCH] id в модели:', localModel.id, '!= initialObjectId:', initialObjectIdRef.current, '— возможна подмена объекта!', JSON.parse(JSON.stringify(localModel)));
|
|
20466
|
+
}
|
|
20451
20467
|
setState(_extends({}, localState));
|
|
20452
20468
|
setLoading(true);
|
|
20453
20469
|
const endpoint = _$1__default.get(data, "sl");
|
|
@@ -20509,7 +20525,7 @@ function FpsForm2(props) {
|
|
|
20509
20525
|
}, stateUpdate));
|
|
20510
20526
|
}
|
|
20511
20527
|
if (submitKeepModel && !resetModel) {
|
|
20512
|
-
modelUpdate = _extends({},
|
|
20528
|
+
modelUpdate = _extends({}, currentModel, modelToSend, modelUpdate);
|
|
20513
20529
|
} else if (resetModel) {
|
|
20514
20530
|
modelUpdate = {};
|
|
20515
20531
|
extendedModelUpdate = {};
|
|
@@ -21077,6 +21093,10 @@ function FpsForm2(props) {
|
|
|
21077
21093
|
currentStep: currentStep,
|
|
21078
21094
|
refreshOptions: refreshOptions,
|
|
21079
21095
|
model: model,
|
|
21096
|
+
modelRef: modelRef,
|
|
21097
|
+
extendedModelRef: extendedModelRef,
|
|
21098
|
+
stateRef: stateRef,
|
|
21099
|
+
edditingOn: edditingOn,
|
|
21080
21100
|
checkHidden: checkHidden,
|
|
21081
21101
|
dict: dict,
|
|
21082
21102
|
extendedModel: extendedModel,
|
|
@@ -21146,6 +21166,10 @@ function FpsForm2(props) {
|
|
|
21146
21166
|
refreshOptions: refreshOptions,
|
|
21147
21167
|
currentStep: currentStep,
|
|
21148
21168
|
model: model,
|
|
21169
|
+
modelRef: modelRef,
|
|
21170
|
+
extendedModelRef: extendedModelRef,
|
|
21171
|
+
stateRef: stateRef,
|
|
21172
|
+
edditingOn: edditingOn,
|
|
21149
21173
|
userDebug: userDebug,
|
|
21150
21174
|
setOriginalModel: setOriginalModel,
|
|
21151
21175
|
originalExtendedModel: originalExtendedModel,
|
|
@@ -21187,6 +21211,10 @@ function RenderStep(props) {
|
|
|
21187
21211
|
editModelAL,
|
|
21188
21212
|
originalModel,
|
|
21189
21213
|
model,
|
|
21214
|
+
modelRef,
|
|
21215
|
+
extendedModelRef,
|
|
21216
|
+
stateRef,
|
|
21217
|
+
edditingOn,
|
|
21190
21218
|
checkHidden,
|
|
21191
21219
|
userDebug,
|
|
21192
21220
|
dict,
|
|
@@ -21217,21 +21245,40 @@ function RenderStep(props) {
|
|
|
21217
21245
|
if (ignoreResponse) return;
|
|
21218
21246
|
try {
|
|
21219
21247
|
const response = JSON.parse(content);
|
|
21248
|
+
const currentModel = modelRef && modelRef.current || model;
|
|
21249
|
+
const currentExtendedModel = extendedModelRef && extendedModelRef.current || extendedModel;
|
|
21250
|
+
const currentState = stateRef && stateRef.current || state;
|
|
21220
21251
|
if (!_$1.isEmpty(_$1__default.get(response, "state"))) {
|
|
21221
21252
|
const stateUpdate = _$1__default.get(response, "state");
|
|
21222
|
-
setState(_extends({},
|
|
21253
|
+
setState(_extends({}, currentState, stateUpdate));
|
|
21223
21254
|
}
|
|
21224
21255
|
if (!_$1.isEmpty(_$1__default.get(response, "object"))) {
|
|
21225
|
-
|
|
21226
|
-
|
|
21227
|
-
|
|
21228
|
-
|
|
21256
|
+
let modelUpdate = _$1__default.get(response, "object");
|
|
21257
|
+
if (edditingOn && currentModel.id) {
|
|
21258
|
+
if (modelUpdate.id && modelUpdate.id !== currentModel.id) {
|
|
21259
|
+
console.warn('[callEndpointPOST] Отклонена попытка подмены id модели:', currentModel.id, '->', modelUpdate.id);
|
|
21260
|
+
}
|
|
21261
|
+
modelUpdate = _extends({}, modelUpdate, {
|
|
21262
|
+
id: currentModel.id
|
|
21263
|
+
});
|
|
21264
|
+
}
|
|
21265
|
+
setModel(_extends({}, currentModel, modelUpdate));
|
|
21266
|
+
setOriginalModel(_extends({}, currentModel, modelUpdate));
|
|
21267
|
+
setOriginalExtendedModel(_extends({}, currentExtendedModel, modelUpdate));
|
|
21229
21268
|
}
|
|
21230
21269
|
if (!_$1.isEmpty(_$1__default.get(response, "model"))) {
|
|
21231
|
-
|
|
21232
|
-
|
|
21233
|
-
|
|
21234
|
-
|
|
21270
|
+
let modelUpdate = _$1__default.get(response, "model");
|
|
21271
|
+
if (edditingOn && currentModel.id) {
|
|
21272
|
+
if (modelUpdate.id && modelUpdate.id !== currentModel.id) {
|
|
21273
|
+
console.warn('[callEndpointPOST] Отклонена попытка подмены id модели:', currentModel.id, '->', modelUpdate.id);
|
|
21274
|
+
}
|
|
21275
|
+
modelUpdate = _extends({}, modelUpdate, {
|
|
21276
|
+
id: currentModel.id
|
|
21277
|
+
});
|
|
21278
|
+
}
|
|
21279
|
+
setModel(_extends({}, currentModel, modelUpdate));
|
|
21280
|
+
setOriginalModel(_extends({}, currentModel, modelUpdate));
|
|
21281
|
+
setOriginalExtendedModel(_extends({}, currentExtendedModel, modelUpdate));
|
|
21235
21282
|
}
|
|
21236
21283
|
if (!_$1.isEmpty(_$1__default.get(response, "redirect")) && !_$1.isEmpty(_$1__default.get(response, "redirect.target"))) {
|
|
21237
21284
|
let delay = 0;
|