argous 1.2.221 → 1.2.223

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.
@@ -59,8 +59,9 @@ export function createDocument({ idUnidade, cdUnidade, idDocPai, path, dsKeyWord
59
59
  dsSubCategoria: any;
60
60
  snSensivel: any;
61
61
  }): Promise<any>;
62
- export function getFileFromLink({ URL: link }?: {
62
+ export function getFileFromLink({ URL: link, token }?: {
63
63
  URL?: string | undefined;
64
+ token?: string | undefined;
64
65
  }): Promise<string>;
65
66
  export function getLink(idDocumento: any, nrRevisao: any, timeout: any): Promise<any>;
66
67
  export function scanDocument(idDocumento: any, nrRevisao: any): Promise<any>;
package/dist/api/index.js CHANGED
@@ -766,21 +766,21 @@ var createDocument = function (_a) {
766
766
  };
767
767
  exports.createDocument = createDocument;
768
768
  var getFileFromLink = function (_a) {
769
- var _b = _a === void 0 ? {} : _a, _c = _b.URL, link = _c === void 0 ? '' : _c;
769
+ var _b = _a === void 0 ? {} : _a, _c = _b.URL, link = _c === void 0 ? '' : _c, _d = _b.token, token = _d === void 0 ? '' : _d;
770
770
  return __awaiter(void 0, void 0, void 0, function () {
771
771
  var file;
772
- return __generator(this, function (_d) {
773
- switch (_d.label) {
772
+ return __generator(this, function (_e) {
773
+ switch (_e.label) {
774
774
  case 0:
775
775
  if (!link)
776
776
  return [2 /*return*/, ''];
777
777
  return [4 /*yield*/, fetch(link, {
778
778
  method: 'post',
779
- headers: exports.headers()
779
+ headers: exports.headers(token)
780
780
  })];
781
- case 1: return [4 /*yield*/, (_d.sent()).blob()];
781
+ case 1: return [4 /*yield*/, (_e.sent()).blob()];
782
782
  case 2:
783
- file = _d.sent();
783
+ file = _e.sent();
784
784
  return [2 /*return*/, URL.createObjectURL(file)];
785
785
  }
786
786
  });
@@ -143,7 +143,15 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
143
143
  *
144
144
  * @returns {void} Sem retorno
145
145
  */
146
- setExternalCtrlPgn?: (value: Object) => void
146
+ setExternalCtrlPgn?: (value: Object) => void,
147
+ /**
148
+ * Program code (pgCode) que será utilizado junto ao método
149
+ */
150
+ code?: string,
151
+ /**
152
+ * Token que será utilizado junto ao método
153
+ */
154
+ token?: string
147
155
  }
148
156
 
149
157
  declare function ArgousComplexTable(props: ArgousComplexTableProps): JSX.Element
@@ -165,13 +165,13 @@ 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, _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;
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, _z = _a.code, code = _z === void 0 ? '' : _z, _0 = _a.token, token = _0 === void 0 ? '' : _0;
169
169
  var classes = useStyles();
170
- var _z = react_1.useReducer(reducer, initialState(defaultRowsPerPage)), state = _z[0], dispatch = _z[1];
170
+ var _1 = react_1.useReducer(reducer, initialState(defaultRowsPerPage)), state = _1[0], dispatch = _1[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 _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];
173
+ var _2 = react_1.useState(dados /*.map(linha => isArray(linha) ? linha : Object.values(linha))*/ || []), lista = _2[0], setLista = _2[1];
174
+ var _3 = react_1.useState({ qtRegs: defaultRowsPerPage, pgAtl: 1 }), ctrlPgn = _3[0], setCtrlPgn = _3[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 () {
@@ -213,7 +213,7 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
213
213
  acao: retornaAcao(ctrlPgn.pgAtl, page + 1),
214
214
  tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
215
215
  indOrdem: orderBy >= 0 ? orderBy : undefined
216
- } }, methodPrms), handleMethodError)];
216
+ } }, methodPrms), code, handleMethodError, token)];
217
217
  case 1:
218
218
  res = _c.sent();
219
219
  onMethodResponse && onMethodResponse(res);
@@ -225,7 +225,7 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
225
225
  return [2 /*return*/];
226
226
  }
227
227
  });
228
- }); }, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList]);
228
+ }); }, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList, code, token]);
229
229
  react_1.useEffect(function () {
230
230
  buscaMetodo();
231
231
  }, [buscaMetodo]);
@@ -279,7 +279,7 @@ var ArgousComplexTable = react_1.forwardRef(function (_a, ref) {
279
279
  setSelected: function (s) { return dispatch({ type: 'setSelected', value: lodash_1.isFunction(s) ? s(selected, dadosMostrados) : s }); },
280
280
  setLoading: function (value) { return dispatch({ type: 'setLoading', value: value }); }
281
281
  }); });
282
- var _2 = react_1.useState(true), bounced = _2[0], setBounced = _2[1];
282
+ var _4 = react_1.useState(true), bounced = _4[0], setBounced = _4[1];
283
283
  var getFullCtrlPgn = function (internal) {
284
284
  var ctrl = internal ? ctrlPgn : externalCtrlPgn;
285
285
  return __assign({ acao: retornaAcao(ctrl.pgAtl, page + 1), tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined, indOrdem: orderBy >= 0 ? orderBy : undefined }, ctrl);
package/lib/api/index.js CHANGED
@@ -405,11 +405,11 @@ export const createDocument = async ({
405
405
  })).json();
406
406
  };
407
407
 
408
- export const getFileFromLink = async ({ URL: link = '' } = {}) => {
408
+ export const getFileFromLink = async ({ URL: link = '', token = '' } = {}) => {
409
409
  if (!link) return '';
410
410
  const file = await (await fetch(link, {
411
411
  method: 'post',
412
- headers: headers()
412
+ headers: headers(token)
413
413
  })).blob();
414
414
  return URL.createObjectURL(file);
415
415
  };
@@ -143,7 +143,15 @@ export interface ArgousComplexTableProps extends ArgousComplexTableBodyProps, Ar
143
143
  *
144
144
  * @returns {void} Sem retorno
145
145
  */
146
- setExternalCtrlPgn?: (value: Object) => void
146
+ setExternalCtrlPgn?: (value: Object) => void,
147
+ /**
148
+ * Program code (pgCode) que será utilizado junto ao método
149
+ */
150
+ code?: string,
151
+ /**
152
+ * Token que será utilizado junto ao método
153
+ */
154
+ token?: string
147
155
  }
148
156
 
149
157
  declare function ArgousComplexTable(props: ArgousComplexTableProps): JSX.Element
@@ -176,7 +176,9 @@ const ArgousComplexTable = forwardRef(({
176
176
  tableProps,
177
177
  toolbarProps,
178
178
  externalCtrlPgn,
179
- setExternalCtrlPgn
179
+ setExternalCtrlPgn,
180
+ code = '',
181
+ token = ''
180
182
  }, ref) => {
181
183
  const classes = useStyles();
182
184
  const [state, dispatch] = useReducer(reducer, initialState(defaultRowsPerPage));
@@ -222,15 +224,15 @@ const ArgousComplexTable = forwardRef(({
222
224
  tpOrdem: orderBy >= 0 ? (order === 'asc' ? 'A' : 'D') : undefined,
223
225
  indOrdem: orderBy >= 0 ? orderBy : undefined
224
226
  }, ...methodPrms
225
- }, handleMethodError);
226
- onMethodResponse && onMethodResponse(res);
227
+ }, code, handleMethodError, token);
228
+ onMethodResponse && onMethodResponse(res);
227
229
  if (res.status) {
228
230
  setCtrlPgn({ ...res.ctrlPgn, recordCount: (res.ctrlPgn?.qtPaginas * res.ctrlPgn?.qtRegs) });
229
231
  setLista(res[methodResultList] || []);
230
232
  }
231
233
  dispatch({ type: 'setLoading', value: false });
232
234
  // eslint-disable-next-line react-hooks/exhaustive-deps
233
- }, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList]);
235
+ }, [method, allowMethodRequest, qtRegs, pgAtl, retornaAcao, ctrlPgn.pgAtl, page, orderBy, order, methodPrms, handleMethodError, methodResultList, code, token]);
234
236
 
235
237
  useEffect(() => {
236
238
  buscaMetodo();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.221",
3
+ "version": "1.2.223",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",