argous 1.2.177 → 1.2.179
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/components/ArgousComplexTable/ArgousComplexTable.d.ts +22 -2
- package/dist/components/ArgousComplexTable/ArgousComplexTable.js +53 -15
- package/lib/components/ArgousComplexTable/ArgousComplexTable.d.ts +22 -2
- package/lib/components/ArgousComplexTable/ArgousComplexTable.js +100 -42
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
31
31
|
*/
|
|
32
32
|
footerProps?: object,
|
|
33
33
|
/**
|
|
34
|
-
* Array de dados fornecido
|
|
34
|
+
* Array de dados fornecido para a tabela
|
|
35
35
|
*/
|
|
36
36
|
dados?: Array<Array<any> | Object>,
|
|
37
37
|
/**
|
|
@@ -88,6 +88,14 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
88
88
|
* @returns {void} Sem retorno
|
|
89
89
|
*/
|
|
90
90
|
onMethodResponse?: (response: Object) => void,
|
|
91
|
+
/**
|
|
92
|
+
* Boolean que define se o erro do método será tratado automaticamente na ServerAction
|
|
93
|
+
*/
|
|
94
|
+
handleMethodError?: boolean,
|
|
95
|
+
/**
|
|
96
|
+
* Boolean que permite solicitar o método
|
|
97
|
+
*/
|
|
98
|
+
allowMethodRequest?: boolean,
|
|
91
99
|
/**
|
|
92
100
|
* @deprecated
|
|
93
101
|
*
|
|
@@ -123,7 +131,19 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
123
131
|
/**
|
|
124
132
|
* Props repassados ao componente toolbar
|
|
125
133
|
*/
|
|
126
|
-
toolbarProps?: any
|
|
134
|
+
toolbarProps?: any,
|
|
135
|
+
/**
|
|
136
|
+
* Objeto de controle da paginação/ordenação que será fornecido à tabela e ao método externo
|
|
137
|
+
*/
|
|
138
|
+
externalCtrlPgn?: object,
|
|
139
|
+
/**
|
|
140
|
+
* Função que é chamada para setar o externalCtrlPgn sempre que os controles de paginação/ordenação mudarem
|
|
141
|
+
*
|
|
142
|
+
* @param value - Objeto com parâmetros da paginação/ordenação para ser enviado ao método
|
|
143
|
+
*
|
|
144
|
+
* @returns {void} Sem retorno
|
|
145
|
+
*/
|
|
146
|
+
setExternalCtrlPgn?: (value: Object) => void
|
|
127
147
|
}
|
|
128
148
|
|
|
129
149
|
declare function ArgousComplexTable(props: ArgousComplexTableProps): JSX.Element
|
|
@@ -165,20 +165,22 @@ var initialState = function (defaultRowsPerPage) { return ({
|
|
|
165
165
|
loading: false
|
|
166
166
|
}); };
|
|
167
167
|
var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
168
|
-
var _b = _a.ToolbarComponent, ToolbarComponent = _b === void 0 ? __1.ArgousComplexTableToolbar : _b, _c = _a.HeadComponent, HeadComponent = _c === void 0 ? __1.ArgousComplexTableHead : _c, _d = _a.BodyComponent, BodyComponent = _d === void 0 ? __1.ArgousComplexTableBody : _d, _e = _a.PaginationComponent, PaginationComponent = _e === void 0 ? __1.ArgousComplexPagination : _e, _f = _a.FooterComponent, FooterComponent = _f === void 0 ? undefined : _f, footerProps = _a.footerProps, dados = _a.dados, _g = _a.head, head = _g === void 0 ? [] : _g, _h = _a.line, line = _h === void 0 ? function (i) { return i; } : _h, actions = _a.actions, title = _a.title, _j = _a.defaultRowsPerPage, defaultRowsPerPage = _j === void 0 ? 10 : _j, _k = _a.rowsPerPageOptions, rowsPerPageOptions = _k === void 0 ? [10, 25, 50] : _k, checkEnabled = _a.enableCheck, disableCheckIf = _a.disableCheckIf, showCount = _a.showCount, lineStyle = _a.lineStyle, _l = _a.lineClass, lineClass = _l === void 0 ? function () { return undefined; } : _l, onClick = _a.onClick, onDoubleClick = _a.onDoubleClick, _m = _a.children, children = _m === void 0 ? undefined : _m, style = _a.style, className = _a.className, columnStyles = _a.columnStyles, headerColumnStyles = _a.headerColumnStyles, columnOptions = _a.columnOptions, disableFilter = _a.disableFilter, _o = _a.filterLabel, filterLabel = _o === void 0 ? 'Filtro' : _o, _p = _a.indexToSelect, indexToSelect = _p === void 0 ? 0 : _p, _q = _a.disableSorting, disableSorting = _q === void 0 ? [] : _q, _r = _a.size, size = _r === void 0 ? 'small' : _r, onOpen = _a.onOpen, lineTitle = _a.lineTitle, onClose = _a.onClose, method = _a.method, methodPrms = _a.methodPrms, _s = _a.methodResultList, methodResultList = _s === void 0 ? 'lista' : _s, onMethodResponse = _a.onMethodResponse, field = _a.field, fixedToolbar = _a.fixedToolbar, onSelect = _a.onSelect, customKey = _a.customKey,
|
|
168
|
+
var _b = _a.ToolbarComponent, ToolbarComponent = _b === void 0 ? __1.ArgousComplexTableToolbar : _b, _c = _a.HeadComponent, HeadComponent = _c === void 0 ? __1.ArgousComplexTableHead : _c, _d = _a.BodyComponent, BodyComponent = _d === void 0 ? __1.ArgousComplexTableBody : _d, _e = _a.PaginationComponent, PaginationComponent = _e === void 0 ? __1.ArgousComplexPagination : _e, _f = _a.FooterComponent, FooterComponent = _f === void 0 ? undefined : _f, footerProps = _a.footerProps, dados = _a.dados, _g = _a.head, head = _g === void 0 ? [] : _g, _h = _a.line, line = _h === void 0 ? function (i) { return i; } : _h, actions = _a.actions, title = _a.title, _j = _a.defaultRowsPerPage, defaultRowsPerPage = _j === void 0 ? 10 : _j, _k = _a.rowsPerPageOptions, rowsPerPageOptions = _k === void 0 ? [10, 25, 50] : _k, checkEnabled = _a.enableCheck, disableCheckIf = _a.disableCheckIf, showCount = _a.showCount, lineStyle = _a.lineStyle, _l = _a.lineClass, lineClass = _l === void 0 ? function () { return undefined; } : _l, onClick = _a.onClick, onDoubleClick = _a.onDoubleClick, _m = _a.children, children = _m === void 0 ? undefined : _m, style = _a.style, className = _a.className, columnStyles = _a.columnStyles, headerColumnStyles = _a.headerColumnStyles, columnOptions = _a.columnOptions, disableFilter = _a.disableFilter, _o = _a.filterLabel, filterLabel = _o === void 0 ? 'Filtro' : _o, _p = _a.indexToSelect, indexToSelect = _p === void 0 ? 0 : _p, _q = _a.disableSorting, disableSorting = _q === void 0 ? [] : _q, _r = _a.size, size = _r === void 0 ? 'small' : _r, onOpen = _a.onOpen, lineTitle = _a.lineTitle, onClose = _a.onClose, method = _a.method, methodPrms = _a.methodPrms, _s = _a.methodResultList, methodResultList = _s === void 0 ? 'lista' : _s, onMethodResponse = _a.onMethodResponse, _t = _a.handleMethodError, handleMethodError = _t === void 0 ? true : _t, _u = _a.allowMethodRequest, allowMethodRequest = _u === void 0 ? true : _u, field = _a.field, fixedToolbar = _a.fixedToolbar, onSelect = _a.onSelect, customKey = _a.customKey, _v = _a.columnProps, columnProps = _v === void 0 ? function () { return ''; } : _v, _w = _a.rowProps, rowProps = _w === void 0 ? function () { return ''; } : _w, _x = _a.savedState, savedState = _x === void 0 ? {} : _x, containerProps = _a.containerProps, _y = _a.onClickAway, onClickAway = _y === void 0 ? function () { return undefined; } : _y, enableCheckIfSelected = _a.enableCheckIfSelected, enableDrag = _a.enableDrag, onDrop = _a.onDrop, tableProps = _a.tableProps, toolbarProps = _a.toolbarProps, externalCtrlPgn = _a.externalCtrlPgn, setExternalCtrlPgn = _a.setExternalCtrlPgn;
|
|
169
169
|
var classes = useStyles();
|
|
170
|
-
var
|
|
170
|
+
var _z = react_1.useReducer(reducer, initialState(defaultRowsPerPage)), state = _z[0], dispatch = _z[1];
|
|
171
171
|
var memoState = react_1.useMemo(function () { return (__assign(__assign({}, state), { dispatch: dispatch })); }, [state, dispatch]);
|
|
172
172
|
var selected = memoState.selected, page = memoState.page, rowsPerPage = memoState.rowsPerPage, order = memoState.order, orderBy = memoState.orderBy, filter = memoState.filter, open = memoState.open;
|
|
173
|
-
var
|
|
174
|
-
var
|
|
173
|
+
var _0 = react_1.useState(dados /*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []), lista = _0[0], setLista = _0[1];
|
|
174
|
+
var _1 = react_1.useState({ qtRegs: defaultRowsPerPage, pgAtl: 1 }), ctrlPgn = _1[0], setCtrlPgn = _1[1];
|
|
175
175
|
var qtRegs = ctrlPgn.qtRegs, pgAtl = ctrlPgn.pgAtl, ordCols = ctrlPgn.ordCols;
|
|
176
176
|
var enableCheck = checkEnabled || (enableCheckIfSelected && !!selected.length);
|
|
177
177
|
react_1.useEffect(function () {
|
|
178
178
|
dispatch({ type: 'mount', value: savedState.current });
|
|
179
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
180
|
}, []);
|
|
180
181
|
react_1.useEffect(function () {
|
|
181
182
|
return function () { return savedState.current = state; };
|
|
183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
184
|
}, [state]);
|
|
183
185
|
react_1.useEffect(function () {
|
|
184
186
|
if (lodash_1.isArray(dados))
|
|
@@ -203,7 +205,7 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
|
203
205
|
return __generator(this, function (_g) {
|
|
204
206
|
switch (_g.label) {
|
|
205
207
|
case 0:
|
|
206
|
-
if (!method)
|
|
208
|
+
if (!method || !allowMethodRequest)
|
|
207
209
|
return [2 /*return*/];
|
|
208
210
|
dispatch({ type: 'setLoading', value: true });
|
|
209
211
|
return [4 /*yield*/, api_1.serverAction(method, __assign({ ctrlPgn: {
|
|
@@ -211,19 +213,19 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
|
211
213
|
acao: retornaAcao(ctrlPgn.pgAtl, page + 1),
|
|
212
214
|
tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
|
|
213
215
|
indOrdem: orderBy >= 0 ? orderBy : undefined
|
|
214
|
-
} }, methodPrms),
|
|
216
|
+
} }, methodPrms), handleMethodError)];
|
|
215
217
|
case 1:
|
|
216
218
|
res = _g.sent();
|
|
217
219
|
onMethodResponse && onMethodResponse(res);
|
|
218
220
|
if (res.status) {
|
|
219
|
-
setCtrlPgn(__assign(__assign({}, res.ctrlPgn), { recordCount: ((_a = res.ctrlPgn) === null || _a === void 0 ? void 0 : _a.recordCount) || ((_b = res[methodResultList]) === null || _b === void 0 ? void 0 : _b.length) < ((_c = res.ctrlPgn) === null || _c === void 0 ? void 0 : _c.qtRegs) ? (_d = res[methodResultList]) === null || _d === void 0 ? void 0 : _d.length : ((_e = res.ctrlPgn) === null || _e === void 0 ? void 0 : _e.qtPaginas) * ((_f = res.ctrlPgn) === null || _f === void 0 ? void 0 : _f.qtRegs) }));
|
|
221
|
+
setCtrlPgn(__assign(__assign({}, res.ctrlPgn), { recordCount: ((((_a = res.ctrlPgn) === null || _a === void 0 ? void 0 : _a.recordCount) || ((_b = res[methodResultList]) === null || _b === void 0 ? void 0 : _b.length)) < ((_c = res.ctrlPgn) === null || _c === void 0 ? void 0 : _c.qtRegs)) ? (_d = res[methodResultList]) === null || _d === void 0 ? void 0 : _d.length : ((_e = res.ctrlPgn) === null || _e === void 0 ? void 0 : _e.qtPaginas) * ((_f = res.ctrlPgn) === null || _f === void 0 ? void 0 : _f.qtRegs) }));
|
|
220
222
|
setLista(res[methodResultList] || []);
|
|
221
223
|
}
|
|
222
224
|
dispatch({ type: 'setLoading', value: false });
|
|
223
225
|
return [2 /*return*/];
|
|
224
226
|
}
|
|
225
227
|
});
|
|
226
|
-
}); }, [method, qtRegs, pgAtl,
|
|
228
|
+
}); }, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList]);
|
|
227
229
|
react_1.useEffect(function () {
|
|
228
230
|
buscaMetodo();
|
|
229
231
|
}, [buscaMetodo]);
|
|
@@ -233,15 +235,16 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
|
233
235
|
setLista(fielValue || []);
|
|
234
236
|
}, [field, lista, fielValue]);
|
|
235
237
|
react_1.useEffect(function () {
|
|
236
|
-
if (method || field)
|
|
238
|
+
if (method || field || externalCtrlPgn)
|
|
237
239
|
return;
|
|
238
240
|
if (lodash_1.isArray(lista) && lista.length > 0 && page === Math.ceil(method ? ctrlPgn.recordCount : lista.length / parseInt(rowsPerPage, 10)))
|
|
239
241
|
dispatch({ type: 'decremmentPage' });
|
|
240
|
-
}, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field]);
|
|
242
|
+
}, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field, externalCtrlPgn]);
|
|
241
243
|
react_1.useEffect(function () { return dispatch({ type: 'setSelected', value: [] }); }, [lista]);
|
|
242
244
|
react_1.useEffect(function () {
|
|
243
245
|
if (onSelect)
|
|
244
246
|
onSelect(selected);
|
|
247
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
245
248
|
}, [selected]);
|
|
246
249
|
var dadosNaoCortados = react_1.useMemo(function () {
|
|
247
250
|
if (method)
|
|
@@ -253,10 +256,10 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
|
253
256
|
}, [lista, filter, order, orderBy, method, line]);
|
|
254
257
|
var cortaDados = react_1.useCallback(function (dados) { return dados === null || dados === void 0 ? void 0 : dados.slice(defaultRowsPerPage === 0 ? (undefined) : page * rowsPerPage, defaultRowsPerPage === 0 ? (undefined) : page * rowsPerPage + rowsPerPage); }, [page, rowsPerPage, defaultRowsPerPage]);
|
|
255
258
|
var dadosMostrados = react_1.useMemo(function () {
|
|
256
|
-
if (method)
|
|
259
|
+
if (method || externalCtrlPgn)
|
|
257
260
|
return lista || [];
|
|
258
261
|
return cortaDados(dadosNaoCortados) || [];
|
|
259
|
-
}, [method, lista, dadosNaoCortados, cortaDados]);
|
|
262
|
+
}, [method, externalCtrlPgn, lista, dadosNaoCortados, cortaDados]);
|
|
260
263
|
var handleOpenClose = react_1.useCallback(function (index) {
|
|
261
264
|
if (index === open || (!index && index !== 0)) {
|
|
262
265
|
dispatch({ type: 'setOpen', value: undefined });
|
|
@@ -276,25 +279,56 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
|
|
|
276
279
|
setSelected: function (s) { return dispatch({ type: 'setSelected', value: lodash_1.isFunction(s) ? s(selected, dadosMostrados) : s }); },
|
|
277
280
|
setLoading: function (value) { return dispatch({ type: 'setLoading', value: value }); }
|
|
278
281
|
}); });
|
|
282
|
+
//________________EXTERNAL_CTRL_PGN____________________________________________________________________________
|
|
283
|
+
var _2 = react_1.useState(true), bounced = _2[0], setBounced = _2[1];
|
|
284
|
+
var getFullCtrlPgn = function (internal) {
|
|
285
|
+
var ctrl = internal ? ctrlPgn : externalCtrlPgn;
|
|
286
|
+
return __assign({ acao: retornaAcao(ctrl.pgAtl, page + 1), tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined, indOrdem: orderBy >= 0 ? orderBy : undefined }, ctrl);
|
|
287
|
+
};
|
|
288
|
+
react_1.useEffect(function () {
|
|
289
|
+
if (!method && setExternalCtrlPgn) {
|
|
290
|
+
var fullCtrlPgn = __assign(__assign({}, ctrlPgn), { acao: retornaAcao(ctrlPgn.pgAtl, page + 1), tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined, indOrdem: orderBy >= 0 ? orderBy : undefined });
|
|
291
|
+
var fullExternalCtrlPgn = getFullCtrlPgn();
|
|
292
|
+
if (!bounced && !lodash_1.isEqual(fullCtrlPgn, fullExternalCtrlPgn))
|
|
293
|
+
setExternalCtrlPgn(fullCtrlPgn);
|
|
294
|
+
else if (bounced)
|
|
295
|
+
setBounced(false);
|
|
296
|
+
}
|
|
297
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
298
|
+
}, [ctrlPgn, order, orderBy, page]);
|
|
299
|
+
react_1.useEffect(function () {
|
|
300
|
+
var _a;
|
|
301
|
+
if (!method && externalCtrlPgn && ((_a = Object.keys(externalCtrlPgn)) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
302
|
+
var fullCtrlPgn = getFullCtrlPgn(true);
|
|
303
|
+
var fullExternalCtrlPgn = getFullCtrlPgn();
|
|
304
|
+
if (!lodash_1.isEqual(fullExternalCtrlPgn, fullCtrlPgn)) {
|
|
305
|
+
setCtrlPgn(__assign(__assign({}, fullExternalCtrlPgn), { recordCount: (((externalCtrlPgn === null || externalCtrlPgn === void 0 ? void 0 : externalCtrlPgn.recordCount) || (dados === null || dados === void 0 ? void 0 : dados.length)) < (externalCtrlPgn === null || externalCtrlPgn === void 0 ? void 0 : externalCtrlPgn.qtRegs)) ? dados === null || dados === void 0 ? void 0 : dados.length : (externalCtrlPgn === null || externalCtrlPgn === void 0 ? void 0 : externalCtrlPgn.qtPaginas) * (externalCtrlPgn === null || externalCtrlPgn === void 0 ? void 0 : externalCtrlPgn.qtRegs) }));
|
|
306
|
+
setBounced(true);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
310
|
+
}, [externalCtrlPgn]);
|
|
311
|
+
//_____________________________________________________________________________________________________________
|
|
279
312
|
return (react_1.default.createElement(exports.TableContext.Provider, { value: __assign(__assign({}, memoState), { dadosMostrados: dadosMostrados, lista: lista, indexToSelect: indexToSelect, method: method }) },
|
|
280
313
|
react_1.default.createElement(core_1.ClickAwayListener, { onClickAway: onClickAway },
|
|
281
314
|
react_1.default.createElement(core_1.TableContainer, __assign({ component: core_1.Paper, variant: 'outlined', style: style }, containerProps, { className: clsx_1.default(classes.root, className) }),
|
|
282
315
|
react_1.default.createElement(ToolbarComponent, __assign({ numSelected: selected.length, disableFilter: disableFilter || !!method }, __assign({ actions: actions, title: title, selected: selected, filter: filter, filterLabel: filterLabel, lista: lista, indexToSelect: indexToSelect, fixedToolbar: fixedToolbar }, toolbarProps))),
|
|
283
316
|
react_1.default.createElement(core_1.Table, __assign({}, __assign(__assign({}, tableProps), { size: size })),
|
|
284
|
-
react_1.default.createElement(HeadComponent, __assign({ size: method ? ctrlPgn.recordCount : dadosNaoCortados.length, numSelected: selected.length, rowCount: (rowsPerPage > (method ? ctrlPgn.recordCount : dadosNaoCortados.length)) ? method ? ctrlPgn.recordCount : dadosNaoCortados.length : rowsPerPage || dadosNaoCortados.length }, { head: head, order: order, orderBy: orderBy, enableCheck: enableCheck, headerColumnStyles: headerColumnStyles, disableSorting: disableSorting, ordCols: ordCols, method: method, cortaDados: cortaDados, disableCheckIf: disableCheckIf, line: line, enableDrag: enableDrag })),
|
|
317
|
+
react_1.default.createElement(HeadComponent, __assign({ size: (method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length, numSelected: selected.length, rowCount: (rowsPerPage > ((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length)) ? ((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length) : (rowsPerPage || dadosNaoCortados.length) }, { head: head, order: order, orderBy: orderBy, enableCheck: enableCheck, headerColumnStyles: headerColumnStyles, disableSorting: disableSorting, ordCols: ordCols, method: method, cortaDados: cortaDados, disableCheckIf: disableCheckIf, line: line, enableDrag: enableDrag })),
|
|
285
318
|
react_1.default.createElement(BodyComponent, __assign({}, {
|
|
286
319
|
children: children, line: line, lineStyle: lineStyle, lineTitle: lineTitle, handleOpenClose: handleOpenClose, lineClass: lineClass, enableDrag: enableDrag,
|
|
287
320
|
enableCheck: enableCheck, columnStyles: columnStyles, head: head, columnOptions: columnOptions, columnProps: columnProps, rowProps: rowProps, onDrop: onDrop,
|
|
288
321
|
onClick: onClick, onDoubleClick: onDoubleClick, indexToSelect: indexToSelect, open: open, dadosMostrados: dadosMostrados, customKey: customKey, disableCheckIf: disableCheckIf
|
|
289
322
|
})),
|
|
290
323
|
FooterComponent && react_1.default.createElement(FooterComponent, __assign({}, footerProps))),
|
|
291
|
-
rowsPerPageOptions !== 0 && Math.ceil(method ? ctrlPgn.recordCount : dadosNaoCortados.length / parseInt(rowsPerPageOptions[0], 10)) > 1 && (react_1.default.createElement(PaginationComponent, __assign({ count: method ? ctrlPgn.recordCount : dadosNaoCortados.length, onChangePage: function (_, value) {
|
|
324
|
+
rowsPerPageOptions !== 0 && Math.ceil((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length / parseInt(rowsPerPageOptions[0], 10)) > 1 && (react_1.default.createElement(PaginationComponent, __assign({ count: (method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length, onChangePage: function (_, value) {
|
|
292
325
|
dispatch({ type: 'setPage', value: value });
|
|
293
326
|
setCtrlPgn(__assign(__assign({}, ctrlPgn), { pgAtl: value + 1 }));
|
|
294
327
|
}, onChangeRowsPerPage: function (e) {
|
|
295
328
|
dispatch({ type: 'setRowsPerPage', value: parseInt(e.target.value, 10) });
|
|
296
329
|
dispatch({ type: 'setPage', value: 0 });
|
|
297
330
|
setCtrlPgn(__assign(__assign({}, ctrlPgn), { pgAtl: 1, qtRegs: parseInt(e.target.value, 10) }));
|
|
331
|
+
setExternalCtrlPgn && setExternalCtrlPgn(__assign(__assign({}, externalCtrlPgn), { pgAtl: 1, qtRegs: parseInt(e.target.value, 10) }));
|
|
298
332
|
} }, { showCount: showCount, page: page, rowsPerPageOptions: rowsPerPageOptions, rowsPerPage: rowsPerPage })))))));
|
|
299
333
|
});
|
|
300
334
|
ArgousComplexTable.propTypes = {
|
|
@@ -328,6 +362,10 @@ ArgousComplexTable.propTypes = {
|
|
|
328
362
|
methodPrms: prop_types_1.default.object,
|
|
329
363
|
field: prop_types_1.default.string,
|
|
330
364
|
fixedToolbar: prop_types_1.default.bool,
|
|
331
|
-
onSelect: prop_types_1.default.func
|
|
365
|
+
onSelect: prop_types_1.default.func,
|
|
366
|
+
handleMethodError: prop_types_1.default.bool,
|
|
367
|
+
allowMethodRequest: prop_types_1.default.bool,
|
|
368
|
+
externalCtrlPgn: prop_types_1.default.object,
|
|
369
|
+
setExternalCtrlPgn: prop_types_1.default.func
|
|
332
370
|
};
|
|
333
371
|
exports.default = react_1.memo(ArgousComplexTable, lodash_1.isEqual);
|
|
@@ -31,7 +31,7 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
31
31
|
*/
|
|
32
32
|
footerProps?: object,
|
|
33
33
|
/**
|
|
34
|
-
* Array de dados fornecido
|
|
34
|
+
* Array de dados fornecido para a tabela
|
|
35
35
|
*/
|
|
36
36
|
dados?: Array<Array<any> | Object>,
|
|
37
37
|
/**
|
|
@@ -88,6 +88,14 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
88
88
|
* @returns {void} Sem retorno
|
|
89
89
|
*/
|
|
90
90
|
onMethodResponse?: (response: Object) => void,
|
|
91
|
+
/**
|
|
92
|
+
* Boolean que define se o erro do método será tratado automaticamente na ServerAction
|
|
93
|
+
*/
|
|
94
|
+
handleMethodError?: boolean,
|
|
95
|
+
/**
|
|
96
|
+
* Boolean que permite solicitar o método
|
|
97
|
+
*/
|
|
98
|
+
allowMethodRequest?: boolean,
|
|
91
99
|
/**
|
|
92
100
|
* @deprecated
|
|
93
101
|
*
|
|
@@ -123,7 +131,19 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
|
|
|
123
131
|
/**
|
|
124
132
|
* Props repassados ao componente toolbar
|
|
125
133
|
*/
|
|
126
|
-
toolbarProps?: any
|
|
134
|
+
toolbarProps?: any,
|
|
135
|
+
/**
|
|
136
|
+
* Objeto de controle da paginação/ordenação que será fornecido à tabela e ao método externo
|
|
137
|
+
*/
|
|
138
|
+
externalCtrlPgn?: object,
|
|
139
|
+
/**
|
|
140
|
+
* Função que é chamada para setar o externalCtrlPgn sempre que os controles de paginação/ordenação mudarem
|
|
141
|
+
*
|
|
142
|
+
* @param value - Objeto com parâmetros da paginação/ordenação para ser enviado ao método
|
|
143
|
+
*
|
|
144
|
+
* @returns {void} Sem retorno
|
|
145
|
+
*/
|
|
146
|
+
setExternalCtrlPgn?: (value: Object) => void
|
|
127
147
|
}
|
|
128
148
|
|
|
129
149
|
declare function ArgousComplexTable(props: ArgousComplexTableProps): JSX.Element
|
|
@@ -18,9 +18,9 @@ const useStyles = makeStyles({
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
export const TableContext = createContext();
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
const ehData = valor => {
|
|
25
25
|
const retorno = (format) => moment(valor, format).format('YYYYMMDDHHmmss');
|
|
26
26
|
if (/[0-9]{2}\/[0-9]{2}\/[0-9]{4}/.test(valor)) return retorno('DD/MM/YYYY');
|
|
@@ -29,7 +29,7 @@ const ehData = valor => {
|
|
|
29
29
|
if (/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(.\d)*/.test(valor)) return retorno('YYYY-MM-DD HH:mm:ss');
|
|
30
30
|
return valor;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
function descendingComparator(a, b, orderBy) {
|
|
34
34
|
const aO = ehData(a[orderBy]);
|
|
35
35
|
const bO = ehData(b[orderBy]);
|
|
@@ -37,13 +37,13 @@ function descendingComparator(a, b, orderBy) {
|
|
|
37
37
|
if (bO > aO) return 1;
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
function getComparator(order, orderBy) {
|
|
42
42
|
return order === 'desc'
|
|
43
43
|
? (a, b) => descendingComparator(a, b, orderBy)
|
|
44
44
|
: (a, b) => -descendingComparator(a, b, orderBy);
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
function stableSort(array, comparator, line) {
|
|
48
48
|
const stabilizedThis = array.map((el, index) => [el, line(el), index]);
|
|
49
49
|
stabilizedThis.sort((a, b) => {
|
|
@@ -53,7 +53,7 @@ function stableSort(array, comparator, line) {
|
|
|
53
53
|
});
|
|
54
54
|
return stabilizedThis.map((el) => el[0]);
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
const reducer = (state, action) => {
|
|
58
58
|
switch (action.type) {
|
|
59
59
|
case 'setSelected':
|
|
@@ -108,7 +108,7 @@ const reducer = (state, action) => {
|
|
|
108
108
|
return state;
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
const initialState = (defaultRowsPerPage) => ({
|
|
113
113
|
selected: [],
|
|
114
114
|
page: 0,
|
|
@@ -119,7 +119,7 @@ const initialState = (defaultRowsPerPage) => ({
|
|
|
119
119
|
open: undefined,
|
|
120
120
|
loading: false
|
|
121
121
|
});
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
const ArgousComplexTable = forwardRef(({
|
|
124
124
|
ToolbarComponent = ArgousComplexTableToolbar,
|
|
125
125
|
HeadComponent = ArgousComplexTableHead,
|
|
@@ -159,6 +159,8 @@ const ArgousComplexTable = forwardRef(({
|
|
|
159
159
|
methodPrms,
|
|
160
160
|
methodResultList = 'lista',
|
|
161
161
|
onMethodResponse,
|
|
162
|
+
handleMethodError = true,
|
|
163
|
+
allowMethodRequest = true,
|
|
162
164
|
field,
|
|
163
165
|
fixedToolbar,
|
|
164
166
|
onSelect,
|
|
@@ -172,31 +174,35 @@ const ArgousComplexTable = forwardRef(({
|
|
|
172
174
|
enableDrag,
|
|
173
175
|
onDrop,
|
|
174
176
|
tableProps,
|
|
175
|
-
toolbarProps
|
|
177
|
+
toolbarProps,
|
|
178
|
+
externalCtrlPgn,
|
|
179
|
+
setExternalCtrlPgn
|
|
176
180
|
}, ref) => {
|
|
177
181
|
const classes = useStyles();
|
|
178
182
|
const [state, dispatch] = useReducer(reducer, initialState(defaultRowsPerPage));
|
|
179
183
|
const memoState = useMemo(() => ({ ...state, dispatch }), [state, dispatch]);
|
|
180
184
|
const { selected, page, rowsPerPage, order, orderBy, filter, open } = memoState;
|
|
181
|
-
|
|
185
|
+
|
|
182
186
|
const [lista, setLista] = useState(dados/*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []);
|
|
183
187
|
const [ctrlPgn, setCtrlPgn] = useState({ qtRegs: defaultRowsPerPage, pgAtl: 1 });
|
|
184
188
|
const { qtRegs, pgAtl, ordCols } = ctrlPgn;
|
|
185
|
-
|
|
189
|
+
|
|
186
190
|
const enableCheck = checkEnabled || (enableCheckIfSelected && !!selected.length);
|
|
187
|
-
|
|
191
|
+
|
|
188
192
|
useEffect(() => {
|
|
189
193
|
dispatch({ type: 'mount', value: savedState.current });
|
|
194
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
190
195
|
}, []);
|
|
191
|
-
|
|
196
|
+
|
|
192
197
|
useEffect(() => {
|
|
193
198
|
return () => savedState.current = state;
|
|
199
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
194
200
|
}, [state]);
|
|
195
|
-
|
|
201
|
+
|
|
196
202
|
useEffect(() => {
|
|
197
203
|
if (isArray(dados)) setLista(dados/*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []);
|
|
198
204
|
}, [dados]);
|
|
199
|
-
|
|
205
|
+
|
|
200
206
|
const retornaAcao = useCallback((pgAtl, page) => {
|
|
201
207
|
if (page === pgAtl) return undefined;
|
|
202
208
|
else if (page === pgAtl + 1) return 'N';
|
|
@@ -205,9 +211,9 @@ const ArgousComplexTable = forwardRef(({
|
|
|
205
211
|
else if (page === 0) return 'F';
|
|
206
212
|
return `S=${page}`;
|
|
207
213
|
}, [ctrlPgn.recordCount]);
|
|
208
|
-
|
|
214
|
+
|
|
209
215
|
const buscaMetodo = useCallback(async () => {
|
|
210
|
-
if (!method) return;
|
|
216
|
+
if (!method || !allowMethodRequest) return;
|
|
211
217
|
dispatch({ type: 'setLoading', value: true });
|
|
212
218
|
const res = await serverAction(method, {
|
|
213
219
|
ctrlPgn: {
|
|
@@ -216,52 +222,54 @@ const ArgousComplexTable = forwardRef(({
|
|
|
216
222
|
tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
|
|
217
223
|
indOrdem: orderBy >= 0 ? orderBy : undefined
|
|
218
224
|
}, ...methodPrms
|
|
219
|
-
},
|
|
225
|
+
}, handleMethodError);
|
|
220
226
|
onMethodResponse && onMethodResponse(res);
|
|
221
227
|
if (res.status) {
|
|
222
|
-
setCtrlPgn({ ...res.ctrlPgn, recordCount: res.ctrlPgn?.recordCount || res[methodResultList]?.length < res.ctrlPgn?.qtRegs ? res[methodResultList]?.length : res.ctrlPgn?.qtPaginas * res.ctrlPgn?.qtRegs });
|
|
228
|
+
setCtrlPgn({ ...res.ctrlPgn, recordCount: ((res.ctrlPgn?.recordCount || res[methodResultList]?.length) < res.ctrlPgn?.qtRegs) ? res[methodResultList]?.length : res.ctrlPgn?.qtPaginas * res.ctrlPgn?.qtRegs });
|
|
223
229
|
setLista(res[methodResultList] || []);
|
|
224
230
|
}
|
|
225
231
|
dispatch({ type: 'setLoading', value: false });
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
233
|
+
}, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList]);
|
|
234
|
+
|
|
228
235
|
useEffect(() => {
|
|
229
236
|
buscaMetodo();
|
|
230
237
|
}, [buscaMetodo]);
|
|
231
|
-
|
|
232
|
-
const fielValue = useMemo(() => /*isArray(getField(field, 'value')) ? */getField(field, 'value')/*?.map(item => isArray(item) ? item : Object.values(item)) : []*/, [field]);
|
|
233
238
|
|
|
239
|
+
const fielValue = useMemo(() => /*isArray(getField(field, 'value')) ? */getField(field, 'value')/*?.map(item => isArray(item) ? item : Object.values(item)) : []*/, [field]);
|
|
240
|
+
|
|
234
241
|
useEffect(() => {
|
|
235
242
|
if (field && !isEqual(lista, fielValue)) setLista(fielValue || []);
|
|
236
243
|
}, [field, lista, fielValue]);
|
|
237
|
-
|
|
244
|
+
|
|
238
245
|
useEffect(() => {
|
|
239
|
-
if (method || field) return;
|
|
246
|
+
if (method || field || externalCtrlPgn) return;
|
|
240
247
|
if (isArray(lista) && lista.length > 0 && page === Math.ceil(method ? ctrlPgn.recordCount : lista.length / parseInt(rowsPerPage, 10))) dispatch({ type: 'decremmentPage' });
|
|
241
|
-
}, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field]);
|
|
242
|
-
|
|
243
|
-
useEffect(() => dispatch({ type: 'setSelected', value: [] }), [lista]);
|
|
248
|
+
}, [page, method, lista.length, rowsPerPage, ctrlPgn.recordCount, lista, field, externalCtrlPgn]);
|
|
244
249
|
|
|
250
|
+
useEffect(() => dispatch({ type: 'setSelected', value: [] }), [lista]);
|
|
251
|
+
|
|
245
252
|
useEffect(() => {
|
|
246
253
|
if (onSelect) onSelect(selected);
|
|
254
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
247
255
|
}, [selected]);
|
|
248
|
-
|
|
256
|
+
|
|
249
257
|
const dadosNaoCortados = useMemo(() => {
|
|
250
258
|
if (method) return lista || [];
|
|
251
259
|
if (isArray(lista) && lista.length > 0) return stableSort(lista, getComparator(order, orderBy), line)
|
|
252
260
|
.filter(linha => isArray(line(linha)) ? line(linha).filter(item => filter ? new RegExp(`.*${filter}.*`, 'gi').test(item?.toString()) : true).length > 0 : true) || [];
|
|
253
261
|
return [];
|
|
254
262
|
}, [lista, filter, order, orderBy, method, line]);
|
|
255
|
-
|
|
263
|
+
|
|
256
264
|
const cortaDados = useCallback((dados) => dados
|
|
257
265
|
?.slice(defaultRowsPerPage === 0 ? (undefined) : page * rowsPerPage, defaultRowsPerPage === 0 ? (undefined) : page * rowsPerPage + rowsPerPage),
|
|
258
266
|
[page, rowsPerPage, defaultRowsPerPage]);
|
|
259
|
-
|
|
267
|
+
|
|
260
268
|
const dadosMostrados = useMemo(() => {
|
|
261
|
-
if (method) return lista || [];
|
|
269
|
+
if (method || externalCtrlPgn) return lista || [];
|
|
262
270
|
return cortaDados(dadosNaoCortados) || [];
|
|
263
|
-
}, [method, lista, dadosNaoCortados, cortaDados]);
|
|
264
|
-
|
|
271
|
+
}, [method, externalCtrlPgn, lista, dadosNaoCortados, cortaDados]);
|
|
272
|
+
|
|
265
273
|
const handleOpenClose = useCallback((index) => {
|
|
266
274
|
if (index === open || (!index && index !== 0)) {
|
|
267
275
|
dispatch({ type: 'setOpen', value: undefined });
|
|
@@ -271,7 +279,7 @@ const ArgousComplexTable = forwardRef(({
|
|
|
271
279
|
if (onOpen) onOpen({ linhaOriginal: dadosMostrados[index], linhaFormatada: line(dadosMostrados[index]) });
|
|
272
280
|
}
|
|
273
281
|
}, [open, onClose, onOpen, dadosMostrados, dispatch, line]);
|
|
274
|
-
|
|
282
|
+
|
|
275
283
|
useImperativeHandle(ref, () => ({
|
|
276
284
|
setOpen: index => handleOpenClose(index),
|
|
277
285
|
getOpen: dadosMostrados[open],
|
|
@@ -280,6 +288,51 @@ const ArgousComplexTable = forwardRef(({
|
|
|
280
288
|
setLoading: value => dispatch({ type: 'setLoading', value })
|
|
281
289
|
}));
|
|
282
290
|
|
|
291
|
+
|
|
292
|
+
//________________EXTERNAL_CTRL_PGN____________________________________________________________________________
|
|
293
|
+
|
|
294
|
+
const [bounced, setBounced] = useState(true);
|
|
295
|
+
|
|
296
|
+
const getFullCtrlPgn = (internal) => {
|
|
297
|
+
const ctrl = internal ? ctrlPgn : externalCtrlPgn;
|
|
298
|
+
return {
|
|
299
|
+
acao: retornaAcao(ctrl.pgAtl, page + 1),
|
|
300
|
+
tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
|
|
301
|
+
indOrdem: orderBy >= 0 ? orderBy : undefined,
|
|
302
|
+
...ctrl
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
useEffect(() => {
|
|
307
|
+
if (!method && setExternalCtrlPgn) {
|
|
308
|
+
const fullCtrlPgn = {
|
|
309
|
+
...ctrlPgn,
|
|
310
|
+
acao: retornaAcao(ctrlPgn.pgAtl, page + 1),
|
|
311
|
+
tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
|
|
312
|
+
indOrdem: orderBy >= 0 ? orderBy : undefined
|
|
313
|
+
};
|
|
314
|
+
const fullExternalCtrlPgn = getFullCtrlPgn();
|
|
315
|
+
if (!bounced && !isEqual(fullCtrlPgn, fullExternalCtrlPgn)) setExternalCtrlPgn(fullCtrlPgn);
|
|
316
|
+
else if (bounced) setBounced(false);
|
|
317
|
+
}
|
|
318
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
319
|
+
}, [ctrlPgn, order, orderBy, page]);
|
|
320
|
+
|
|
321
|
+
useEffect(() => {
|
|
322
|
+
if (!method && externalCtrlPgn && Object.keys(externalCtrlPgn)?.length) {
|
|
323
|
+
const fullCtrlPgn = getFullCtrlPgn(true);
|
|
324
|
+
const fullExternalCtrlPgn = getFullCtrlPgn();
|
|
325
|
+
if (!isEqual(fullExternalCtrlPgn, fullCtrlPgn)) {
|
|
326
|
+
setCtrlPgn({ ...fullExternalCtrlPgn, recordCount: ((externalCtrlPgn?.recordCount || dados?.length) < externalCtrlPgn?.qtRegs) ? dados?.length : externalCtrlPgn?.qtPaginas * externalCtrlPgn?.qtRegs });
|
|
327
|
+
setBounced(true);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
331
|
+
}, [externalCtrlPgn]);
|
|
332
|
+
|
|
333
|
+
//_____________________________________________________________________________________________________________
|
|
334
|
+
|
|
335
|
+
|
|
283
336
|
return (
|
|
284
337
|
<TableContext.Provider value={{ ...memoState, dadosMostrados, lista, indexToSelect, method }}>
|
|
285
338
|
<ClickAwayListener onClickAway={onClickAway}>
|
|
@@ -290,9 +343,9 @@ const ArgousComplexTable = forwardRef(({
|
|
|
290
343
|
{...{ actions, title, selected, filter, filterLabel, lista, indexToSelect, fixedToolbar, ...toolbarProps }} />
|
|
291
344
|
<Table {...{ ...tableProps, size }}>
|
|
292
345
|
<HeadComponent
|
|
293
|
-
size={method ? ctrlPgn.recordCount : dadosNaoCortados.length}
|
|
346
|
+
size={(method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length}
|
|
294
347
|
numSelected={selected.length}
|
|
295
|
-
rowCount={(rowsPerPage > (method ? ctrlPgn.recordCount : dadosNaoCortados.length)) ? method ? ctrlPgn.recordCount : dadosNaoCortados.length : rowsPerPage || dadosNaoCortados.length}
|
|
348
|
+
rowCount={(rowsPerPage > ((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length)) ? ((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length) : (rowsPerPage || dadosNaoCortados.length)}
|
|
296
349
|
{...{ head, order, orderBy, enableCheck, headerColumnStyles, disableSorting, ordCols, method, cortaDados, disableCheckIf, line, enableDrag }}
|
|
297
350
|
/>
|
|
298
351
|
<BodyComponent
|
|
@@ -303,9 +356,9 @@ const ArgousComplexTable = forwardRef(({
|
|
|
303
356
|
}}/>
|
|
304
357
|
{FooterComponent && <FooterComponent {...footerProps}/>}
|
|
305
358
|
</Table>
|
|
306
|
-
{rowsPerPageOptions !== 0 && Math.ceil(method ? ctrlPgn.recordCount : dadosNaoCortados.length / parseInt(rowsPerPageOptions[0], 10)) > 1 && (
|
|
359
|
+
{rowsPerPageOptions !== 0 && Math.ceil((method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length / parseInt(rowsPerPageOptions[0], 10)) > 1 && (
|
|
307
360
|
<PaginationComponent
|
|
308
|
-
count={method ? ctrlPgn.recordCount : dadosNaoCortados.length}
|
|
361
|
+
count={(method || externalCtrlPgn) ? ctrlPgn.recordCount : dadosNaoCortados.length}
|
|
309
362
|
onChangePage={(_, value) => {
|
|
310
363
|
dispatch({ type: 'setPage', value });
|
|
311
364
|
setCtrlPgn({ ...ctrlPgn, pgAtl: value + 1 });
|
|
@@ -314,6 +367,7 @@ const ArgousComplexTable = forwardRef(({
|
|
|
314
367
|
dispatch({ type: 'setRowsPerPage', value: parseInt(e.target.value, 10) });
|
|
315
368
|
dispatch({ type: 'setPage', value: 0 });
|
|
316
369
|
setCtrlPgn({ ...ctrlPgn, pgAtl: 1, qtRegs: parseInt(e.target.value, 10) });
|
|
370
|
+
setExternalCtrlPgn && setExternalCtrlPgn({ ...externalCtrlPgn, pgAtl: 1, qtRegs: parseInt(e.target.value, 10) });
|
|
317
371
|
}}
|
|
318
372
|
{...{ showCount, page, rowsPerPageOptions, rowsPerPage }} />
|
|
319
373
|
)}
|
|
@@ -322,7 +376,7 @@ const ArgousComplexTable = forwardRef(({
|
|
|
322
376
|
</TableContext.Provider>
|
|
323
377
|
);
|
|
324
378
|
});
|
|
325
|
-
|
|
379
|
+
|
|
326
380
|
ArgousComplexTable.propTypes = {
|
|
327
381
|
dados: PropTypes.array,
|
|
328
382
|
head: PropTypes.array,
|
|
@@ -354,7 +408,11 @@ ArgousComplexTable.propTypes = {
|
|
|
354
408
|
methodPrms: PropTypes.object,
|
|
355
409
|
field: PropTypes.string,
|
|
356
410
|
fixedToolbar: PropTypes.bool,
|
|
357
|
-
onSelect: PropTypes.func
|
|
411
|
+
onSelect: PropTypes.func,
|
|
412
|
+
handleMethodError: PropTypes.bool,
|
|
413
|
+
allowMethodRequest: PropTypes.bool,
|
|
414
|
+
externalCtrlPgn: PropTypes.object,
|
|
415
|
+
setExternalCtrlPgn: PropTypes.func
|
|
358
416
|
};
|
|
359
|
-
|
|
417
|
+
|
|
360
418
|
export default memo(ArgousComplexTable, isEqual);
|