directual-web-components-v2 3.11.324 → 3.11.326
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 +126 -62
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +126 -62
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -23108,21 +23108,74 @@ function FpsTable(_ref) {
|
|
|
23108
23108
|
const pageSize = currentData.pageSize || 0;
|
|
23109
23109
|
const totalPages = currentData.totalPages || 0;
|
|
23110
23110
|
const currentPage = currentData.pageNumber || 0;
|
|
23111
|
-
|
|
23111
|
+
const comp_ID = _$1__default.get(currentData, "params.comp_ID") || id;
|
|
23112
|
+
const getPageFromUrl = () => {
|
|
23113
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
23114
|
+
const savedPage = urlParams.get("page_" + comp_ID);
|
|
23115
|
+
return savedPage ? Number(savedPage) : 0;
|
|
23116
|
+
};
|
|
23117
|
+
const updatePageInUrl = newPage => {
|
|
23118
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
23119
|
+
if (newPage > 0) {
|
|
23120
|
+
urlParams.set("page_" + comp_ID, newPage);
|
|
23121
|
+
} else {
|
|
23122
|
+
urlParams.delete("page_" + comp_ID);
|
|
23123
|
+
}
|
|
23124
|
+
window.history.replaceState({}, '', window.location.pathname + "?" + urlParams.toString());
|
|
23125
|
+
};
|
|
23126
|
+
const [page, setPageState] = React.useState(getPageFromUrl);
|
|
23127
|
+
const [dql, setDQL] = React.useState('');
|
|
23128
|
+
const [sort, setSort] = React.useState({});
|
|
23129
|
+
const [pageLoading, setPageLoading] = React.useState(false);
|
|
23130
|
+
const [dataInfo, setDataInfo] = React.useState({});
|
|
23131
|
+
const isFirstRender = React.useRef(true);
|
|
23132
|
+
function callEndpointGET(endpoint, params, finish) {
|
|
23133
|
+
console.log('===> calling endpoint GET /' + endpoint);
|
|
23134
|
+
const httpParams = _$1__default.get(currentData, "params.httpParams") || _$1__default.get(currentData, "httpParams") || {};
|
|
23135
|
+
const requestParams = _extends({}, httpParams, params);
|
|
23136
|
+
callEndpoint && callEndpoint(endpoint, "GET", undefined, requestParams, (result, content, json, data) => {
|
|
23137
|
+
if (result == "ok") {
|
|
23138
|
+
finish && finish(content, data);
|
|
23139
|
+
} else {
|
|
23140
|
+
finish && finish([]);
|
|
23141
|
+
}
|
|
23142
|
+
});
|
|
23143
|
+
}
|
|
23144
|
+
function refresh(dqlParam, sortParam) {
|
|
23145
|
+
if (currentData && currentData.sl) {
|
|
23146
|
+
setPageLoading(true);
|
|
23147
|
+
const sortString = sortParam && sortParam.field ? sortParam.field + ":" + (sortParam.direction || 'asc') : '';
|
|
23148
|
+
callEndpointGET(currentData.sl, {
|
|
23149
|
+
pageSize: currentData.pageSize || 10,
|
|
23150
|
+
page: page,
|
|
23151
|
+
dql: dqlParam,
|
|
23152
|
+
sort: sortString
|
|
23153
|
+
}, (result, responseData) => {
|
|
23154
|
+
const newDataInfo = _$1__default.get(responseData, "result.data", {});
|
|
23155
|
+
if (newDataInfo && newDataInfo.content) delete newDataInfo.content;
|
|
23156
|
+
setDataInfo(newDataInfo);
|
|
23157
|
+
setCardsData(result);
|
|
23158
|
+
setPageLoading(false);
|
|
23159
|
+
setLoading(false);
|
|
23160
|
+
});
|
|
23161
|
+
}
|
|
23162
|
+
}
|
|
23163
|
+
function performFiltering(dqlParam, sortParam) {
|
|
23112
23164
|
clearTimeout(cx);
|
|
23113
23165
|
console.log('=== F I L T E R I N G ! ===');
|
|
23114
|
-
console.log(
|
|
23115
|
-
setCurrentDQL(dql);
|
|
23116
|
-
setCurrentSort(sort);
|
|
23166
|
+
console.log(dqlParam);
|
|
23117
23167
|
console.log('=== S O R T I N G ! ===');
|
|
23118
|
-
console.log(
|
|
23119
|
-
|
|
23120
|
-
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
|
|
23124
|
-
|
|
23125
|
-
}
|
|
23168
|
+
console.log(sortParam);
|
|
23169
|
+
setDQL(dqlParam);
|
|
23170
|
+
setSort(sortParam);
|
|
23171
|
+
setCurrentDQL(dqlParam);
|
|
23172
|
+
setCurrentSort(sortParam);
|
|
23173
|
+
if (page == 0) {
|
|
23174
|
+
refresh(dqlParam, sortParam);
|
|
23175
|
+
} else {
|
|
23176
|
+
setPageState(0);
|
|
23177
|
+
updatePageInUrl(0);
|
|
23178
|
+
}
|
|
23126
23179
|
}
|
|
23127
23180
|
React.useEffect(() => {
|
|
23128
23181
|
setLoading(false);
|
|
@@ -23170,7 +23223,6 @@ function FpsTable(_ref) {
|
|
|
23170
23223
|
clearTimeout(cx);
|
|
23171
23224
|
if (value) {
|
|
23172
23225
|
setSearchValue(value);
|
|
23173
|
-
!currentDQL && !page && removeUrlParam(id + '_page');
|
|
23174
23226
|
const fieldsDQL = currentData.headers && currentData.headers.map(i => i.sysName);
|
|
23175
23227
|
const requestDQL = fieldsDQL.map(i => "'" + i + "'" + ' like ' + "'" + value + "'").join(' OR ');
|
|
23176
23228
|
setCurrentDQL(requestDQL);
|
|
@@ -23182,8 +23234,6 @@ function FpsTable(_ref) {
|
|
|
23182
23234
|
} else {
|
|
23183
23235
|
setSearchValue('');
|
|
23184
23236
|
setCurrentDQL('');
|
|
23185
|
-
removeUrlParam(id + '_dql');
|
|
23186
|
-
removeUrlParam(id + '_page');
|
|
23187
23237
|
sendMsg({
|
|
23188
23238
|
dql: ''
|
|
23189
23239
|
}, null, {
|
|
@@ -23191,43 +23241,13 @@ function FpsTable(_ref) {
|
|
|
23191
23241
|
});
|
|
23192
23242
|
}
|
|
23193
23243
|
}
|
|
23194
|
-
const refresh = skipLoading => {
|
|
23195
|
-
console.log("refresh");
|
|
23196
|
-
console.log(skipLoading);
|
|
23197
|
-
!skipLoading && setLoading(true);
|
|
23198
|
-
!skipLoading && setCurrentDQL('');
|
|
23199
|
-
!skipLoading && setCurrentSort({});
|
|
23200
|
-
!skipLoading && setSearchValue('');
|
|
23201
|
-
onEvent({
|
|
23202
|
-
dql: '',
|
|
23203
|
-
page: currentPage,
|
|
23204
|
-
_id: id
|
|
23205
|
-
});
|
|
23206
|
-
!skipLoading && removeUrlParam(id + '_dql');
|
|
23207
|
-
};
|
|
23208
23244
|
const [lazyLoadingHandler, setLazyLoadingHandler] = React.useState(false);
|
|
23209
|
-
function setPage(
|
|
23245
|
+
function setPage(newPage) {
|
|
23210
23246
|
if (_$1__default.get(currentData, "params.lazyLoading")) {
|
|
23211
23247
|
setLazyLoadingHandler(true);
|
|
23212
23248
|
}
|
|
23213
|
-
|
|
23214
|
-
|
|
23215
|
-
sort: currentSort,
|
|
23216
|
-
_id: id
|
|
23217
|
-
}, {
|
|
23218
|
-
page: page
|
|
23219
|
-
}, {
|
|
23220
|
-
reqParam1: "true"
|
|
23221
|
-
});
|
|
23222
|
-
page !== 0 ? addUrlParam({
|
|
23223
|
-
key: id + '_page',
|
|
23224
|
-
value: page
|
|
23225
|
-
}) : removeUrlParam(id + '_page');
|
|
23226
|
-
if (prom && prom.finally) {
|
|
23227
|
-
prom.finally(() => {
|
|
23228
|
-
setLoading(false);
|
|
23229
|
-
});
|
|
23230
|
-
}
|
|
23249
|
+
setPageState(newPage);
|
|
23250
|
+
updatePageInUrl(newPage);
|
|
23231
23251
|
}
|
|
23232
23252
|
const submit = model => {
|
|
23233
23253
|
const saveModel = _extends({}, model);
|
|
@@ -23414,6 +23434,42 @@ function FpsTable(_ref) {
|
|
|
23414
23434
|
});
|
|
23415
23435
|
}
|
|
23416
23436
|
}, [showObject]);
|
|
23437
|
+
React.useEffect(() => {
|
|
23438
|
+
if (isFirstRender.current) {
|
|
23439
|
+
isFirstRender.current = false;
|
|
23440
|
+
return;
|
|
23441
|
+
}
|
|
23442
|
+
console.log("page => " + page);
|
|
23443
|
+
refresh(dql, sort);
|
|
23444
|
+
}, [page]);
|
|
23445
|
+
React.useEffect(() => {
|
|
23446
|
+
const hasFiltersInUrl = () => {
|
|
23447
|
+
if (!comp_ID || typeof window === 'undefined') return false;
|
|
23448
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
23449
|
+
return urlParams.has("filters_" + comp_ID) || urlParams.has("sort_" + comp_ID);
|
|
23450
|
+
};
|
|
23451
|
+
if (hasFiltersInUrl()) {
|
|
23452
|
+
console.log("Filters found in URL, skipping initial load - TableTitle will handle it");
|
|
23453
|
+
return;
|
|
23454
|
+
}
|
|
23455
|
+
const urlPage = getPageFromUrl() || 0;
|
|
23456
|
+
if (currentData && currentData.sl) {
|
|
23457
|
+
console.log("Loading initial page from URL: " + urlPage);
|
|
23458
|
+
setPageLoading(true);
|
|
23459
|
+
callEndpointGET(currentData.sl, {
|
|
23460
|
+
pageSize: currentData.pageSize || 10,
|
|
23461
|
+
page: urlPage,
|
|
23462
|
+
dql: '',
|
|
23463
|
+
sort: ''
|
|
23464
|
+
}, (result, responseData) => {
|
|
23465
|
+
const newDataInfo = _$1__default.get(responseData, "result.data", {});
|
|
23466
|
+
if (newDataInfo && newDataInfo.content) delete newDataInfo.content;
|
|
23467
|
+
setDataInfo(newDataInfo);
|
|
23468
|
+
setCardsData(result);
|
|
23469
|
+
setPageLoading(false);
|
|
23470
|
+
});
|
|
23471
|
+
}
|
|
23472
|
+
}, []);
|
|
23417
23473
|
const params = (currentData || {}).params || {};
|
|
23418
23474
|
const {
|
|
23419
23475
|
hideExpandTD,
|
|
@@ -23430,10 +23486,10 @@ function FpsTable(_ref) {
|
|
|
23430
23486
|
const interval = setInterval(() => {
|
|
23431
23487
|
count++;
|
|
23432
23488
|
console.log('autoRefresh rerender № ' + count);
|
|
23433
|
-
refresh(
|
|
23489
|
+
refresh(dql, sort);
|
|
23434
23490
|
}, autoRefreshPeriod);
|
|
23435
23491
|
return () => clearInterval(interval);
|
|
23436
|
-
}, []);
|
|
23492
|
+
}, [dql, sort]);
|
|
23437
23493
|
if (!currentData || currentData == {} || !currentData.params) {
|
|
23438
23494
|
return /*#__PURE__*/React__default.createElement("div", null);
|
|
23439
23495
|
}
|
|
@@ -23459,7 +23515,7 @@ function FpsTable(_ref) {
|
|
|
23459
23515
|
lang: lang,
|
|
23460
23516
|
auth: auth,
|
|
23461
23517
|
firstCard: true,
|
|
23462
|
-
refresh: refresh,
|
|
23518
|
+
refresh: () => refresh(dql, sort),
|
|
23463
23519
|
checkActionCond: (cond, obj) => checkActionCond(edenrichConds(cond, obj)),
|
|
23464
23520
|
shareble: true,
|
|
23465
23521
|
executeAction: submitAction,
|
|
@@ -23521,7 +23577,9 @@ function FpsTable(_ref) {
|
|
|
23521
23577
|
loading: loading,
|
|
23522
23578
|
dict: dict,
|
|
23523
23579
|
lang: lang,
|
|
23524
|
-
onFilter: () => {}
|
|
23580
|
+
onFilter: () => {},
|
|
23581
|
+
urlKey: comp_ID,
|
|
23582
|
+
headers: currentData.headers
|
|
23525
23583
|
}), /*#__PURE__*/React__default.createElement(Table, {
|
|
23526
23584
|
currentBP: currentBP,
|
|
23527
23585
|
data: currentData,
|
|
@@ -23571,13 +23629,13 @@ function FpsTable(_ref) {
|
|
|
23571
23629
|
className: styles$n.pagination
|
|
23572
23630
|
}, /*#__PURE__*/React__default.createElement(Paging, {
|
|
23573
23631
|
setPage: setPage,
|
|
23574
|
-
pageSize: pageSize,
|
|
23632
|
+
pageSize: _$1__default.get(dataInfo, 'pageable.pageSize', pageSize),
|
|
23575
23633
|
dict: dict,
|
|
23576
23634
|
lang: lang,
|
|
23577
|
-
totalPages:
|
|
23578
|
-
currentPage:
|
|
23635
|
+
totalPages: Math.max(1, Math.ceil(_$1__default.get(dataInfo, 'total', 0) / _$1__default.get(dataInfo, 'pageable.pageSize', pageSize))),
|
|
23636
|
+
currentPage: _$1__default.get(dataInfo, 'pageable.page', page),
|
|
23579
23637
|
setLoading: setLoading,
|
|
23580
|
-
loading: loading
|
|
23638
|
+
loading: pageLoading || loading
|
|
23581
23639
|
})));
|
|
23582
23640
|
}
|
|
23583
23641
|
FpsTable.propTypes = {
|
|
@@ -26330,6 +26388,12 @@ function Comments(props) {
|
|
|
26330
26388
|
}
|
|
26331
26389
|
});
|
|
26332
26390
|
}
|
|
26391
|
+
function updateCommentText(commentId, newText) {
|
|
26392
|
+
const textField = _$1__default.get(data, "params._textField");
|
|
26393
|
+
setComments(prevComments => prevComments.map(comment => comment.id === commentId ? _extends({}, comment, {
|
|
26394
|
+
[textField]: newText
|
|
26395
|
+
}) : comment));
|
|
26396
|
+
}
|
|
26333
26397
|
const allowAttachment = _$1__default.includes(data.writeFields, _$1__default.get(data, "params._fileField"));
|
|
26334
26398
|
const allowSend = _$1__default.includes(data.writeFields, _$1__default.get(data, "params._textField"));
|
|
26335
26399
|
const allowEdit = _$1__default.get(data, "params.general.allowEdit");
|
|
@@ -26351,6 +26415,7 @@ function Comments(props) {
|
|
|
26351
26415
|
className: styles$N.commentsList
|
|
26352
26416
|
}, comments.filter(comment => !_$1__default.get(comment, _$1__default.get(data, "params._replyField")) || _$1__default.get(comment, _$1__default.get(data, "params._replyField")) == 'root').map(comment => /*#__PURE__*/React__default.createElement(Comment, _extends({}, props, {
|
|
26353
26417
|
sendComment: sendComment,
|
|
26418
|
+
updateCommentText: updateCommentText,
|
|
26354
26419
|
lang: lang,
|
|
26355
26420
|
allowSend: allowSend,
|
|
26356
26421
|
allowEdit: allowEdit,
|
|
@@ -26371,7 +26436,8 @@ function Comment(props) {
|
|
|
26371
26436
|
parent,
|
|
26372
26437
|
allowSend,
|
|
26373
26438
|
allowEdit,
|
|
26374
|
-
sendComment
|
|
26439
|
+
sendComment,
|
|
26440
|
+
updateCommentText
|
|
26375
26441
|
} = props;
|
|
26376
26442
|
const [addReply, setAddReply] = React.useState(false);
|
|
26377
26443
|
const [isEditing, setIsEditing] = React.useState(false);
|
|
@@ -26433,14 +26499,13 @@ function Comment(props) {
|
|
|
26433
26499
|
const saveEdit = () => {
|
|
26434
26500
|
if (!comment.id) return;
|
|
26435
26501
|
setLocalLoading(true);
|
|
26502
|
+
updateCommentText(comment.id, editText);
|
|
26503
|
+
setIsEditing(false);
|
|
26436
26504
|
let payload = {
|
|
26437
26505
|
id: comment.id
|
|
26438
26506
|
};
|
|
26439
26507
|
_$1__default.set(payload, _$1__default.get(data, "params._textField"), editText);
|
|
26440
|
-
sendComment(payload, () =>
|
|
26441
|
-
setLocalLoading(false);
|
|
26442
|
-
setIsEditing(false);
|
|
26443
|
-
}, true);
|
|
26508
|
+
sendComment(payload, () => setLocalLoading(false), true);
|
|
26444
26509
|
};
|
|
26445
26510
|
const cancelEdit = () => {
|
|
26446
26511
|
setEditText(commentText);
|
|
@@ -26491,7 +26556,6 @@ function Comment(props) {
|
|
|
26491
26556
|
gap: '8px'
|
|
26492
26557
|
}
|
|
26493
26558
|
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
26494
|
-
loading: localLoading,
|
|
26495
26559
|
onClick: saveEdit,
|
|
26496
26560
|
small: true,
|
|
26497
26561
|
height: 32,
|