directual-web-components-v2 3.11.334 → 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 +160 -15
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +160 -15
- 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;
|
|
@@ -22637,6 +22684,98 @@ function NewMainMenuItem(_ref2) {
|
|
|
22637
22684
|
|
|
22638
22685
|
var styles$C = {"showhide":"_2kNHQ"};
|
|
22639
22686
|
|
|
22687
|
+
function template$1(input, rowData, auth) {
|
|
22688
|
+
if (!input) return "";
|
|
22689
|
+
if (!input.includes('{{')) return input;
|
|
22690
|
+
const webUser = auth ? _extends({}, auth, {
|
|
22691
|
+
id: auth.user
|
|
22692
|
+
}) : {};
|
|
22693
|
+
const regex = /\{\{([^}]+)\}\}/g;
|
|
22694
|
+
return input.replace(regex, (match, fieldPath) => {
|
|
22695
|
+
const trimmedPath = fieldPath.trim();
|
|
22696
|
+
if (trimmedPath.startsWith('WebUser.')) {
|
|
22697
|
+
const authField = trimmedPath.substring('WebUser.'.length);
|
|
22698
|
+
const value = _$1__default.get(webUser, authField);
|
|
22699
|
+
if (value === null || value === undefined) return "";
|
|
22700
|
+
if (typeof value === 'boolean') return JSON.stringify(value);
|
|
22701
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
22702
|
+
return String(value);
|
|
22703
|
+
}
|
|
22704
|
+
let value = _$1__default.get(rowData, trimmedPath);
|
|
22705
|
+
if (value && typeof value === 'object' && value.id !== undefined) {
|
|
22706
|
+
value = value.id;
|
|
22707
|
+
}
|
|
22708
|
+
if (value === null || value === undefined) return "";
|
|
22709
|
+
if (typeof value === 'boolean') return JSON.stringify(value);
|
|
22710
|
+
if (typeof value === 'object') return JSON.stringify(value);
|
|
22711
|
+
return String(value);
|
|
22712
|
+
});
|
|
22713
|
+
}
|
|
22714
|
+
function checkCondition(condition, rowData, auth) {
|
|
22715
|
+
let field = template$1("{{" + condition._conditionalView_field + "}}", rowData, auth);
|
|
22716
|
+
let value = template$1(condition._conditionalView_value, rowData, auth);
|
|
22717
|
+
if (condition._conditionalView_operator === "==") {
|
|
22718
|
+
if (typeof field === 'boolean') field = JSON.stringify(field);
|
|
22719
|
+
return !_$1__default.isEqual(field, value);
|
|
22720
|
+
}
|
|
22721
|
+
if (condition._conditionalView_operator === "!==") {
|
|
22722
|
+
if (typeof field === 'boolean') field = JSON.stringify(field);
|
|
22723
|
+
return _$1__default.isEqual(field, value);
|
|
22724
|
+
}
|
|
22725
|
+
if (condition._conditionalView_operator === "contains") {
|
|
22726
|
+
const valueArr = value ? value.split(",") : [];
|
|
22727
|
+
const fieldArr = field ? field.split(",") : [];
|
|
22728
|
+
const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
|
|
22729
|
+
return !hasIntersection;
|
|
22730
|
+
}
|
|
22731
|
+
if (condition._conditionalView_operator === "notContains") {
|
|
22732
|
+
const valueArr = value ? value.split(",") : [];
|
|
22733
|
+
const fieldArr = field ? field.split(",") : [];
|
|
22734
|
+
const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
|
|
22735
|
+
return hasIntersection;
|
|
22736
|
+
}
|
|
22737
|
+
if (condition._conditionalView_operator === "in") {
|
|
22738
|
+
const valueArr = value ? value.split(",") : [];
|
|
22739
|
+
const fieldArr = field ? field.split(",") : [];
|
|
22740
|
+
const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
|
|
22741
|
+
return !hasIntersection;
|
|
22742
|
+
}
|
|
22743
|
+
if (condition._conditionalView_operator === "notIn") {
|
|
22744
|
+
const valueArr = value ? value.split(",") : [];
|
|
22745
|
+
const fieldArr = field ? field.split(",") : [];
|
|
22746
|
+
const hasIntersection = fieldArr.length > 0 && valueArr.length > 0 && _$1__default.intersection(valueArr, fieldArr).length > 0;
|
|
22747
|
+
return hasIntersection;
|
|
22748
|
+
}
|
|
22749
|
+
if (condition._conditionalView_operator === "isNull") {
|
|
22750
|
+
return !_$1__default.isEmpty(field);
|
|
22751
|
+
}
|
|
22752
|
+
if (condition._conditionalView_operator === "isNotNull") {
|
|
22753
|
+
return _$1__default.isEmpty(field);
|
|
22754
|
+
}
|
|
22755
|
+
return false;
|
|
22756
|
+
}
|
|
22757
|
+
function evaluateRowConditions(conditionLibrary, rowData, auth) {
|
|
22758
|
+
if (!conditionLibrary || !Array.isArray(conditionLibrary)) return "";
|
|
22759
|
+
const appliedClasses = [];
|
|
22760
|
+
conditionLibrary.forEach(condItem => {
|
|
22761
|
+
if (!condItem._conditionalView || !condItem.title) return;
|
|
22762
|
+
const conditions = _$1__default.get(condItem, "_conditions") || [];
|
|
22763
|
+
const andOr = _$1__default.get(condItem, "_action_conditionals_and_or") || "AND";
|
|
22764
|
+
if (conditions.length === 0) return;
|
|
22765
|
+
let shouldApplyClass = false;
|
|
22766
|
+
if (andOr === "OR") {
|
|
22767
|
+
shouldApplyClass = !conditions.every(cond => checkCondition(cond, rowData, auth));
|
|
22768
|
+
} else {
|
|
22769
|
+
shouldApplyClass = !conditions.some(cond => checkCondition(cond, rowData, auth));
|
|
22770
|
+
}
|
|
22771
|
+
if (shouldApplyClass) {
|
|
22772
|
+
const className = condItem.title.startsWith('.') ? condItem.title.substring(1) : condItem.title;
|
|
22773
|
+
appliedClasses.push(className);
|
|
22774
|
+
}
|
|
22775
|
+
});
|
|
22776
|
+
return appliedClasses.join(' ');
|
|
22777
|
+
}
|
|
22778
|
+
|
|
22640
22779
|
function sanitizedHTML(inputHTML) {
|
|
22641
22780
|
return DOMPurify.sanitize(inputHTML, {
|
|
22642
22781
|
USE_PROFILES: {
|
|
@@ -22926,6 +23065,7 @@ const defaultColumn = {
|
|
|
22926
23065
|
};
|
|
22927
23066
|
function ReactTable(_ref2) {
|
|
22928
23067
|
let {
|
|
23068
|
+
auth,
|
|
22929
23069
|
columns,
|
|
22930
23070
|
params,
|
|
22931
23071
|
hideExpandTD,
|
|
@@ -22937,7 +23077,8 @@ function ReactTable(_ref2) {
|
|
|
22937
23077
|
skipPageReset,
|
|
22938
23078
|
getLinkName,
|
|
22939
23079
|
onExpand,
|
|
22940
|
-
getExpandHref
|
|
23080
|
+
getExpandHref,
|
|
23081
|
+
conditionLibrary
|
|
22941
23082
|
} = _ref2;
|
|
22942
23083
|
const {
|
|
22943
23084
|
getTableProps,
|
|
@@ -22982,9 +23123,11 @@ function ReactTable(_ref2) {
|
|
|
22982
23123
|
const isColorRow = row.cells.filter(cell => _$1__default.get(tableParams, "[" + cell.column.id + "].include") && _$1__default.get(tableParams, "[" + cell.column.id + "].colorRow")) ? row.cells.filter(cell => _$1__default.get(tableParams, "[" + cell.column.id + "].include") && _$1__default.get(tableParams, "[" + cell.column.id + "].colorRow"))[0] : null;
|
|
22983
23124
|
let colorRow = isColorRow ? isColorRow.row.values[isColorRow.column.id] ? isColorRow.row.values[isColorRow.column.id] : 'default' : 'default';
|
|
22984
23125
|
colorRow = colorRow == 'default' ? colorRow : colorRow[0] == '#' || colorRow[0] == 'r' ? colorRow : '#' + colorRow;
|
|
23126
|
+
const conditionalClasses = evaluateRowConditions(conditionLibrary, row.original, auth);
|
|
22985
23127
|
const key = _$1__default.get(row, 'original.id') || row.id;
|
|
22986
23128
|
return /*#__PURE__*/React__default.createElement("tr", _extends({
|
|
22987
23129
|
key: key,
|
|
23130
|
+
className: conditionalClasses,
|
|
22988
23131
|
onDoubleClick: () => onExpand(row.original),
|
|
22989
23132
|
style: colorRow == 'default' ? {} : {
|
|
22990
23133
|
backgroundColor: colorRow,
|
|
@@ -23167,6 +23310,7 @@ function Table(_ref3) {
|
|
|
23167
23310
|
}, /*#__PURE__*/React__default.createElement(Loader, null, " ", _$1__default.get(dict[lang], 'loading') || "Loading..."))), /*#__PURE__*/React__default.createElement("div", {
|
|
23168
23311
|
className: loading ? styles$n.backGroundBlur : ''
|
|
23169
23312
|
}, /*#__PURE__*/React__default.createElement(ReactTable, {
|
|
23313
|
+
auth: auth,
|
|
23170
23314
|
columns: columns,
|
|
23171
23315
|
data: tableData,
|
|
23172
23316
|
params: params,
|
|
@@ -23178,7 +23322,8 @@ function Table(_ref3) {
|
|
|
23178
23322
|
skipPageReset: skipPageReset,
|
|
23179
23323
|
onExpand: onExpand,
|
|
23180
23324
|
getExpandHref: getExpandHref,
|
|
23181
|
-
tableParams: tableParams.fieldParams
|
|
23325
|
+
tableParams: tableParams.fieldParams,
|
|
23326
|
+
conditionLibrary: _$1__default.get(data, "params._condition_library", [])
|
|
23182
23327
|
})));
|
|
23183
23328
|
}
|
|
23184
23329
|
|
|
@@ -23769,6 +23914,7 @@ function FpsTable(_ref) {
|
|
|
23769
23914
|
urlKey: comp_ID,
|
|
23770
23915
|
headers: currentData.headers
|
|
23771
23916
|
}), /*#__PURE__*/React__default.createElement(Table, {
|
|
23917
|
+
auth: auth,
|
|
23772
23918
|
currentBP: currentBP,
|
|
23773
23919
|
data: currentData,
|
|
23774
23920
|
cardsData: cardsData,
|
|
@@ -23801,7 +23947,6 @@ function FpsTable(_ref) {
|
|
|
23801
23947
|
}
|
|
23802
23948
|
return undefined;
|
|
23803
23949
|
},
|
|
23804
|
-
auth: auth,
|
|
23805
23950
|
submitAction: submitAction,
|
|
23806
23951
|
id: id,
|
|
23807
23952
|
loading: loading,
|