argous 1.2.155 → 1.2.158

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.
@@ -148,6 +148,9 @@ var useStyles = core_1.makeStyles(function (theme) { return ({
148
148
  background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.08)'
149
149
  }
150
150
  },
151
+ hoverListItem: {
152
+ background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.08)'
153
+ },
151
154
  listItemText: {
152
155
  margin: 0,
153
156
  width: '100%',
@@ -178,7 +181,7 @@ var useStyles = core_1.makeStyles(function (theme) { return ({
178
181
  }
179
182
  },
180
183
  popper: {
181
- zIndex: 1301,
184
+ zIndex: 1300,
182
185
  width: function (_a) {
183
186
  var widthListBox = _a.widthListBox;
184
187
  return widthListBox ? "" + widthListBox + (testWidth(widthListBox.toString()) ? 'px' : '') + " !important" : '';
@@ -206,7 +209,7 @@ exports.CustomTooltip = core_1.withStyles(function (theme) { return ({
206
209
  var ListboxFavorites = react_1.forwardRef(function (props, ref) {
207
210
  var classes = useStyles();
208
211
  var children = props.children, favoritePage = props.favoritePage, dados = props.dados, setDados = props.setDados, group = props.group, groupHeaderColor = props.groupHeaderColor, groupTitleColor = props.groupTitleColor;
209
- var pageNumber = dados.pageNumber, favoritosLength = dados.favoritosLength, direction = dados.direction, slide = dados.slide;
212
+ var pageNumber = dados.pageNumber, favoritosLength = dados.favoritosLength, direction = dados.direction, slide = dados.slide, cursor = dados.cursor;
210
213
  function retornaInicio() {
211
214
  switch (pageNumber) {
212
215
  case 1:
@@ -234,16 +237,15 @@ var ListboxFavorites = react_1.forwardRef(function (props, ref) {
234
237
  return section.props.children[1].props.children.slice(retornaInicio(), retornaFim());
235
238
  return section.props.children[1].props.children;
236
239
  }
237
- function retornaEstrutura(sectionIndex, item) {
240
+ function retornaEstrutura(sectionIndex, item, itemIndex) {
241
+ var _a;
242
+ var content = react_1.default.createElement(exports.CustomTooltip, { title: item.props.children, arrow: true, enterDelay: '1000', enterNextDelay: '1000', placement: 'top-end', TransitionComponent: core_1.Fade, TransitionProps: { timeout: { enter: 100, exit: 500 } } },
243
+ react_1.default.createElement(core_1.ListItem, __assign({}, item.props, { id: 'listItem', key: item.key, className: clsx_1.default(classes.listItem, (_a = {}, _a[classes.hoverListItem] = (cursor === null || cursor === void 0 ? void 0 : cursor.index) === itemIndex ? itemIndex : sectionIndex && (cursor === null || cursor === void 0 ? void 0 : cursor.page) === pageNumber, _a)) }),
244
+ react_1.default.createElement(core_1.ListItemText, { primary: item.props.children, className: classes.listItemText })));
238
245
  if (sectionIndex === 0 && favoritePage && favoritosLength > 7) {
239
- return (react_1.default.createElement(core_1.Slide, { in: slide, direction: direction },
240
- react_1.default.createElement(exports.CustomTooltip, { title: item.props.children, arrow: true, enterDelay: '1000', enterNextDelay: '1000', placement: 'top-end', TransitionComponent: core_1.Fade, TransitionProps: { timeout: { enter: 100, exit: 500 } } },
241
- react_1.default.createElement(core_1.ListItem, __assign({}, item.props, { key: item.key, className: classes.listItem }),
242
- react_1.default.createElement(core_1.ListItemText, { primary: item.props.children, className: classes.listItemText })))));
246
+ return react_1.default.createElement(core_1.Slide, { in: slide, direction: direction }, content);
243
247
  }
244
- return (react_1.default.createElement(exports.CustomTooltip, { title: item.props.children, arrow: true, enterDelay: '1000', enterNextDelay: '1000', placement: 'top-end', TransitionComponent: core_1.Fade, TransitionProps: { timeout: { enter: 100, exit: 500 } } },
245
- react_1.default.createElement(core_1.ListItem, __assign({}, item.props, { key: item.key, className: classes.listItem }),
246
- react_1.default.createElement(core_1.ListItemText, { primary: item.props.children, className: classes.listItemText }))));
248
+ return content;
247
249
  }
248
250
  function buttonClick(evento, value) {
249
251
  evento.preventDefault();
@@ -288,24 +290,26 @@ var ListboxFavorites = react_1.forwardRef(function (props, ref) {
288
290
  react_1.default.createElement(react_1.default.Fragment, null,
289
291
  react_1.default.createElement("div", { className: classes.areaButton },
290
292
  react_1.default.createElement("div", { onClick: function (e) { return buttonClick(e, 3); }, className: clsx_1.default((_c = {}, _c[classes.buttonActive] = pageNumber === 3, _c), classes.button) }, "3")))))),
291
- retornaArray(sectionIndex, section).map(function (item, itemIndex) { return retornaEstrutura(sectionIndex, item); }))
293
+ retornaArray(sectionIndex, section).map(function (item, itemIndex) { return retornaEstrutura(sectionIndex, item, itemIndex); }))
292
294
  : retornaEstrutura(sectionIndex, section)));
293
295
  }));
294
296
  });
295
297
  var AutoCompleteFavorites = function (_a) {
296
- var action = _a.action, busca = _a.busca, resposta = _a.resposta, autoSearch = _a.autoSearch, label = _a.label, value = _a.value, pgCode = _a.pgCode, favoritePage = _a.favoritePage, group = _a.group, groupName = _a.groupName, groupHeaderColor = _a.groupHeaderColor, groupTitleColor = _a.groupTitleColor, loadingColor = _a.loadingColor, widthListBox = _a.widthListBox, filterFunction = _a.filterFunction, getOptionLabel = _a.getOptionLabel, _b = _a.onChange, onChange = _b === void 0 ? function (e) { return e; } : _b, _c = _a.textFieldProps, textFieldProps = _c === void 0 ? {} : _c, searchParams = _a.searchParams, props = __rest(_a, ["action", "busca", "resposta", "autoSearch", "label", "value", "pgCode", "favoritePage", "group", "groupName", "groupHeaderColor", "groupTitleColor", "loadingColor", "widthListBox", "filterFunction", "getOptionLabel", "onChange", "textFieldProps", "searchParams"]);
298
+ var _b;
299
+ var action = _a.action, busca = _a.busca, resposta = _a.resposta, autoSearch = _a.autoSearch, label = _a.label, value = _a.value, pgCode = _a.pgCode, favoritePage = _a.favoritePage, group = _a.group, groupName = _a.groupName, groupHeaderColor = _a.groupHeaderColor, groupTitleColor = _a.groupTitleColor, loadingColor = _a.loadingColor, widthListBox = _a.widthListBox, filterFunction = _a.filterFunction, getOptionLabel = _a.getOptionLabel, _c = _a.onChange, onChange = _c === void 0 ? function (e) { return e; } : _c, _d = _a.textFieldProps, textFieldProps = _d === void 0 ? {} : _d, searchParams = _a.searchParams, props = __rest(_a, ["action", "busca", "resposta", "autoSearch", "label", "value", "pgCode", "favoritePage", "group", "groupName", "groupHeaderColor", "groupTitleColor", "loadingColor", "widthListBox", "filterFunction", "getOptionLabel", "onChange", "textFieldProps", "searchParams"]);
297
300
  var classes = useStyles({ widthListBox: widthListBox });
298
- var _d = react_1.useState({
301
+ var _e = react_1.useState({
299
302
  lista: [],
300
303
  slide: true,
304
+ cursor: { index: '', page: '' },
301
305
  direction: '',
302
306
  favoritosLength: '',
303
- pageNumber: favoritePage ? 1 : '',
304
- }), dados = _d[0], setDados = _d[1];
305
- var _e = react_1.useState(false), loading = _e[0], setLoading = _e[1];
306
- var _f = react_1.useState(''), inputValue = _f[0], setInputValue = _f[1];
307
+ pageNumber: favoritePage ? 1 : undefined,
308
+ }), dados = _e[0], setDados = _e[1];
309
+ var _f = react_1.useState(false), loading = _f[0], setLoading = _f[1];
310
+ var _g = react_1.useState(''), inputValue = _g[0], setInputValue = _g[1];
307
311
  var interval = react_1.useRef(null);
308
- var _g = react_1.useState(1), seconds = _g[0], setSeconds = _g[1];
312
+ var _h = react_1.useState(1), seconds = _h[0], setSeconds = _h[1];
309
313
  var startCounter = function () { return interval.current = setInterval(function () { return setSeconds(1); }, 1000); };
310
314
  var stopCounter = function () {
311
315
  clearInterval(interval.current);
@@ -365,7 +369,48 @@ var AutoCompleteFavorites = function (_a) {
365
369
  react_1.useEffect(function () { return autoSearch && seconds === 1 && buscar(); }, [autoSearch, seconds, buscar]);
366
370
  // eslint-disable-next-line react-hooks/exhaustive-deps
367
371
  react_1.useEffect(function () { return lodash_1.isString(value) && buscar(value); }, []);
368
- return (react_1.default.createElement(lab_1.Autocomplete, __assign({}, props, { value: value, onChange: onChange }, { autoComplete: true, autoHighlight: true, openText: 'Abrir', clearText: 'Limpar', filterSelectedOptions: true, onInputChange: function (e) { var _a; return setInput(((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value) || ''); }, getOptionSelected: function (o, v) { return o[0] === v; }, getOptionLabel: getOptionLabel && (function (option) { return getOptionLabel(option, dados === null || dados === void 0 ? void 0 : dados.lista); }), noOptionsText: inputValue.length < 2 ? 'Digite para pesquisar' : 'Não Encontrado', options: lodash_1.isObject(value) ? dados === null || dados === void 0 ? void 0 : dados.lista.filter(function (v) { return filterFunction ? filterFunction(v, value) : true || v[0] !== value[0]; }) : dados === null || dados === void 0 ? void 0 : dados.lista, renderInput: function (params) { return (react_1.default.createElement(core_1.TextField, __assign({ margin: 'dense', variant: 'outlined', label: label }, params, textFieldProps, { onKeyUp: function (e) { return ((e.key === 'Enter' || e.key === 'Tab') && !loading) && buscar(); }, inputProps: __assign(__assign({}, params.inputProps), { onKeyDown: function (e) { return (e.key === 'Enter' || e.key === 'Tab') && e.stopPropagation(); } }), InputProps: __assign(__assign(__assign({}, textFieldProps.InputProps), params.InputProps), { endAdornment: (react_1.default.createElement(react_1.default.Fragment, null,
372
+ react_1.useEffect(function () { var _a, _b; return (value === null || value === void 0 ? void 0 : value[3]) !== ((_b = (_a = dados.cursor) === null || _a === void 0 ? void 0 : _a.linha) === null || _b === void 0 ? void 0 : _b[3]) && setDados(function (v) { return (__assign(__assign({}, v), { cursor: { index: '', page: '' } })); }); }, [value, (_b = dados.cursor) === null || _b === void 0 ? void 0 : _b.linha]);
373
+ var keyUp = function (e) {
374
+ e.preventDefault();
375
+ e.stopPropagation();
376
+ ((e.key === 'Enter' || e.key === 'Tab') && !loading) && buscar();
377
+ (e.key === 'ArrowDown' || e.key === 'ArrowUp') && selectListboxItem(e.key);
378
+ };
379
+ var keyDown = function (e) { return (e.key === 'Enter' || e.key === 'Tab') && e.stopPropagation(); };
380
+ function selectListboxItem(key) {
381
+ var _a;
382
+ var directionIndex = key === 'ArrowDown' ? 1 : key === 'ArrowUp' ? -1 : 0;
383
+ var itens = document.querySelectorAll('#listItem');
384
+ var array = Array.from(itens);
385
+ var el = '';
386
+ var indexCapture = 0;
387
+ if (!value)
388
+ el = array === null || array === void 0 ? void 0 : array[0];
389
+ else {
390
+ array.forEach(function (v, i) {
391
+ var elInnerText = v.innerText;
392
+ var endIndexCode = elInnerText.indexOf('-') - 1;
393
+ var code = elInnerText.substring(0, endIndexCode);
394
+ if (code === value[3]) {
395
+ var nextIndex = i + directionIndex;
396
+ if (nextIndex < array.length)
397
+ indexCapture = nextIndex > -1 ? nextIndex : i;
398
+ else
399
+ indexCapture = i;
400
+ }
401
+ });
402
+ el = array[indexCapture];
403
+ }
404
+ var elInnerText = el.innerText;
405
+ var endIndexCode = elInnerText.indexOf('-') - 1;
406
+ var code = elInnerText.substring(0, endIndexCode);
407
+ var linha = (_a = dados.lista.map(function (v) { return v[3] === code && v; }).filter(function (v) { return v && v; })) === null || _a === void 0 ? void 0 : _a[0];
408
+ setDados(function (v) { return (__assign(__assign({}, v), { cursor: { index: indexCapture, page: v.pageNumber, linha: linha } })); });
409
+ if (linha !== value)
410
+ invokeOnChange('', linha);
411
+ }
412
+ var invokeOnChange = onChange;
413
+ return (react_1.default.createElement(lab_1.Autocomplete, __assign({}, props, { value: value }, { onChange: invokeOnChange, autoComplete: true, autoHighlight: true, openText: 'Abrir', clearText: 'Limpar', filterSelectedOptions: true, onInputChange: function (e) { var _a; return setInput(((_a = e === null || e === void 0 ? void 0 : e.target) === null || _a === void 0 ? void 0 : _a.value) || ''); }, getOptionSelected: function (o, v) { return o[0] === v; }, getOptionLabel: getOptionLabel && (function (option) { return getOptionLabel(option, dados === null || dados === void 0 ? void 0 : dados.lista); }), noOptionsText: inputValue.length < 2 ? 'Digite para pesquisar' : 'Não Encontrado', options: lodash_1.isObject(value) ? dados === null || dados === void 0 ? void 0 : dados.lista.filter(function (v) { return filterFunction ? filterFunction(v, value) : true || v[0] !== value[0]; }) : dados === null || dados === void 0 ? void 0 : dados.lista, renderInput: function (params) { return (react_1.default.createElement(core_1.TextField, __assign({ margin: 'dense', variant: 'outlined', label: label }, params, textFieldProps, { onKeyUp: function (e) { return keyUp(e); }, inputProps: __assign(__assign({}, params.inputProps), { onKeyDown: function (e) { return keyDown(e); } }), InputProps: __assign(__assign(__assign({}, textFieldProps.InputProps), params.InputProps), { endAdornment: (react_1.default.createElement(react_1.default.Fragment, null,
369
414
  params.InputProps.endAdornment,
370
415
  react_1.default.createElement(core_1.Fade, { in: loading },
371
416
  react_1.default.createElement(core_1.CircularProgress, { disableShrink: true, color: loadingColor || 'inherit', size: 20 })),
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
13
32
  var __rest = (this && this.__rest) || function (s, e) {
14
33
  var t = {};
15
34
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -27,7 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
46
  Object.defineProperty(exports, "__esModule", { value: true });
28
47
  var core_1 = require("@material-ui/core");
29
48
  var clsx_1 = __importDefault(require("clsx"));
30
- var react_1 = __importDefault(require("react"));
49
+ var react_1 = __importStar(require("react"));
31
50
  var lib_1 = require("react-icons/lib");
32
51
  var md_1 = require("react-icons/md");
33
52
  var ColorlibConnector = core_1.withStyles(function (theme) { return ({
@@ -66,18 +85,32 @@ var ColorlibStepIcon = core_1.withStyles(function (theme) { return ({
66
85
  justifyContent: 'center',
67
86
  alignItems: 'center',
68
87
  fontSize: 24,
69
- backgroundColor: '#ccc',
88
+ backgroundColor: theme.palette.type === 'light' ? '#ccc' : '#838383',
70
89
  transition: 'all 400ms ease 100ms'
71
90
  },
91
+ initial: theme.palette.type === 'light' ? {
92
+ backgroundColor: function (_a) {
93
+ var ambienteTeste = _a.ambienteTeste;
94
+ return ambienteTeste ? '#ffc7a2' : '#9acbb8';
95
+ }
96
+ } : {
97
+ backgroundColor: function (_a) {
98
+ var ambienteTeste = _a.ambienteTeste;
99
+ return ambienteTeste ? '#8b6751' : '#507265';
100
+ }
101
+ },
72
102
  active: {
73
- backgroundColor: theme.palette.primary.main,
103
+ backgroundColor: function (_a) {
104
+ var ambienteTeste = _a.ambienteTeste;
105
+ return ambienteTeste ? '#f5781e !important' : '#00995D !important';
106
+ },
74
107
  boxShadow: theme.shadows[5],
75
108
  },
76
109
  completed: {
77
- backgroundColor: theme.palette.secondary.main,
110
+ backgroundColor: '#2979ff !important',
78
111
  },
79
112
  error: {
80
- backgroundColor: theme.palette.error.main,
113
+ backgroundColor: '#f44336 !important',
81
114
  },
82
115
  icon: {
83
116
  '& path': {
@@ -86,8 +119,9 @@ var ColorlibStepIcon = core_1.withStyles(function (theme) { return ({
86
119
  }
87
120
  }); })(function (_a) {
88
121
  var _b;
89
- var active = _a.active, completed = _a.completed, icon = _a.icon, classes = _a.classes, error = _a.error;
122
+ var initial = _a.initial, active = _a.active, completed = _a.completed, icon = _a.icon, classes = _a.classes, error = _a.error;
90
123
  return (react_1.default.createElement("div", { className: clsx_1.default(classes.root, (_b = {},
124
+ _b[classes.initial] = initial,
91
125
  _b[classes.active] = active,
92
126
  _b[classes.completed] = completed,
93
127
  _b[classes.error] = error,
@@ -131,9 +165,12 @@ var stepperStyles = function (theme) {
131
165
  });
132
166
  };
133
167
  var Stepper = function (_a) {
134
- var children = _a.children, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.steps, steps = _c === void 0 ? [] : _c, _d = _a.onClick, onClick = _d === void 0 ? function (index) { return function (event) { return void (index, event); }; } : _d, _e = _a.onNext, onNext = _e === void 0 ? function (event) { return void (event); } : _e, _f = _a.onPrevious, onPrevious = _f === void 0 ? function (event) { return void (event); } : _f, _g = _a.onFinish, onFinish = _g === void 0 ? function (event) { return void (event); } : _g, maxStepProps = _a.maxStep, _h = _a.activeStep, activeStep = _h === void 0 ? 0 : _h, _j = _a.errors, errors = _j === void 0 ? [] : _j, _k = _a.component, Component = _k === void 0 ? 'div' : _k, _l = _a.backLabel, backLabel = _l === void 0 ? 'Voltar' : _l, _m = _a.nextLabel, nextLabel = _m === void 0 ? 'Avançar' : _m, _o = _a.finishLabel, finishLabel = _o === void 0 ? 'Finalizar' : _o, _p = _a.disableFinish, disableFinish = _p === void 0 ? false : _p, _q = _a.disableNext, disableNext = _q === void 0 ? false : _q, _r = _a.disablePrevious, disablePrevious = _r === void 0 ? false : _r, props = __rest(_a, ["children", "classes", "steps", "onClick", "onNext", "onPrevious", "onFinish", "maxStep", "activeStep", "errors", "component", "backLabel", "nextLabel", "finishLabel", "disableFinish", "disableNext", "disablePrevious"]);
168
+ var children = _a.children, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.steps, steps = _c === void 0 ? [] : _c, _d = _a.onClick, onClick = _d === void 0 ? function (index) { return function (event) { return void (index, event); }; } : _d, _e = _a.onNext, onNext = _e === void 0 ? function (event) { return void (event); } : _e, _f = _a.onPrevious, onPrevious = _f === void 0 ? function (event) { return void (event); } : _f, _g = _a.onFinish, onFinish = _g === void 0 ? function (event) { return void (event); } : _g, maxStepProps = _a.maxStep, _h = _a.activeStep, activeStep = _h === void 0 ? 0 : _h, _j = _a.errors, errors = _j === void 0 ? [] : _j, _k = _a.component, Component = _k === void 0 ? 'div' : _k, _l = _a.backLabel, backLabel = _l === void 0 ? 'Voltar' : _l, _m = _a.nextLabel, nextLabel = _m === void 0 ? 'Avançar' : _m, _o = _a.finishLabel, finishLabel = _o === void 0 ? 'Finalizar' : _o, _p = _a.disableFinish, disableFinish = _p === void 0 ? false : _p, _q = _a.disableNext, disableNext = _q === void 0 ? false : _q, _r = _a.disablePrevious, disablePrevious = _r === void 0 ? false : _r, _s = _a.showProgress, showProgress = _s === void 0 ? false : _s, props = __rest(_a, ["children", "classes", "steps", "onClick", "onNext", "onPrevious", "onFinish", "maxStep", "activeStep", "errors", "component", "backLabel", "nextLabel", "finishLabel", "disableFinish", "disableNext", "disablePrevious", "showProgress"]);
135
169
  var maxSteps = steps.length;
136
170
  var maxStep = maxStepProps || steps.length - 1;
171
+ var _t = react_1.useState(-1), initialStep = _t[0], setInitialStep = _t[1];
172
+ react_1.useEffect(function () { return (activeStep > initialStep && showProgress) && setInitialStep(activeStep); }, [activeStep, initialStep, showProgress]);
173
+ var ambienteTeste = JSON.parse(window.localStorage.getItem('ambienteTeste'));
137
174
  var theme = core_1.useTheme();
138
175
  var mobile = core_1.useMediaQuery(theme.breakpoints.down(Math.max(maxSteps * 100, theme.breakpoints.values.sm)));
139
176
  return react_1.default.createElement(Component, __assign({}, props),
@@ -146,7 +183,7 @@ var Stepper = function (_a) {
146
183
  var icon = _a[0], label = _a[1], description = _a[2];
147
184
  return (react_1.default.createElement(core_1.Step, { key: label },
148
185
  react_1.default.createElement(core_1.StepButton, { disabled: i > maxStep, onClick: onClick(i), optional: react_1.default.createElement(core_1.Typography, { variant: 'caption', className: clsx_1.default(classes.caption, (_b = {}, _b[classes.selectedCaption] = activeStep >= i, _b)) }, description) },
149
- react_1.default.createElement(core_1.StepLabel, { StepIconProps: { icon: icon, error: errors[i] }, disabled: i > maxStep, error: errors[i], StepIconComponent: ColorlibStepIcon }, label))));
186
+ react_1.default.createElement(core_1.StepLabel, { disabled: i > maxStep, error: errors[i], StepIconComponent: ColorlibStepIcon, StepIconProps: { icon: icon, error: errors[i], initial: initialStep >= i, ambienteTeste: ambienteTeste } }, label))));
150
187
  }))),
151
188
  react_1.default.createElement(core_1.Box, { padding: mobile ? 0 : 4, pt: 1, pb: 0 }, children),
152
189
  mobile ? (react_1.default.createElement(core_1.MobileStepper, { steps: maxSteps, position: 'bottom', variant: 'dots', activeStep: activeStep, backButton: react_1.default.createElement(core_1.Button, { startIcon: react_1.default.createElement(md_1.MdChevronLeft, null), onClick: onPrevious, disabled: activeStep === 0 }, backLabel), nextButton: react_1.default.createElement(core_1.Button, { variant: 'contained', color: 'primary', endIcon: activeStep === maxSteps - 1 ? react_1.default.createElement(md_1.MdCheck, null) : react_1.default.createElement(md_1.MdChevronRight, null), onClick: activeStep === steps.length - 1 ? onFinish : onNext }, activeStep === steps.length - 1 ? finishLabel : nextLabel) })) : (react_1.default.createElement(core_1.DialogActions, null,
@@ -66,6 +66,9 @@ const useStyles = makeStyles((theme) => ({
66
66
  background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.08)'
67
67
  }
68
68
  },
69
+ hoverListItem: {
70
+ background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.08)'
71
+ },
69
72
  listItemText: {
70
73
  margin: 0,
71
74
  width: '100%',
@@ -96,7 +99,7 @@ const useStyles = makeStyles((theme) => ({
96
99
  }
97
100
  },
98
101
  popper: {
99
- zIndex: 1301,
102
+ zIndex: 1300,
100
103
  width: ({ widthListBox }) => widthListBox ? `${widthListBox}${testWidth(widthListBox.toString()) ? 'px' : ''} !important` : '',
101
104
  }
102
105
  }));
@@ -126,7 +129,7 @@ const ListboxFavorites = forwardRef((props, ref) => {
126
129
 
127
130
  const classes = useStyles();
128
131
  const { children, favoritePage, dados, setDados, group, groupHeaderColor, groupTitleColor } = props;
129
- const { pageNumber, favoritosLength, direction, slide } = dados;
132
+ const { pageNumber, favoritosLength, direction, slide, cursor } = dados;
130
133
 
131
134
  function retornaInicio() {
132
135
  switch (pageNumber) {
@@ -157,24 +160,17 @@ const ListboxFavorites = forwardRef((props, ref) => {
157
160
  return section.props.children[1].props.children;
158
161
  }
159
162
 
160
- function retornaEstrutura(sectionIndex, item) {
163
+ function retornaEstrutura(sectionIndex, item, itemIndex) {
164
+ const content = <CustomTooltip title={item.props.children} arrow enterDelay='1000' enterNextDelay='1000' placement='top-end' TransitionComponent={Fade} TransitionProps={{ timeout: { enter: 100, exit: 500 } }}>
165
+ <ListItem {...item.props} id='listItem' key={item.key} className={clsx(classes.listItem, { [classes.hoverListItem]: cursor?.index === itemIndex ? itemIndex : sectionIndex && cursor?.page === pageNumber })}>
166
+ <ListItemText primary={item.props.children} className={classes.listItemText} />
167
+ </ListItem>
168
+ </CustomTooltip>;
161
169
  if (sectionIndex === 0 && favoritePage && favoritosLength > 7) {
162
- return (
163
- <Slide in={slide} direction={direction}>
164
- <CustomTooltip title={item.props.children} arrow enterDelay='1000' enterNextDelay='1000' placement='top-end' TransitionComponent={Fade} TransitionProps={{ timeout: { enter: 100, exit: 500 } }}>
165
- <ListItem {...item.props} key={item.key} className={classes.listItem}>
166
- <ListItemText primary={item.props.children} className={classes.listItemText} />
167
- </ListItem>
168
- </CustomTooltip>
169
- </Slide>
170
- );
171
- } return (
172
- <CustomTooltip title={item.props.children} arrow enterDelay='1000' enterNextDelay='1000' placement='top-end' TransitionComponent={Fade} TransitionProps={{ timeout: { enter: 100, exit: 500 } }}>
173
- <ListItem {...item.props} key={item.key} className={classes.listItem}>
174
- <ListItemText primary={item.props.children} className={classes.listItemText} />
175
- </ListItem>
176
- </CustomTooltip>
177
- );
170
+ return <Slide in={slide} direction={direction}>
171
+ {content}
172
+ </Slide>;
173
+ } return content;
178
174
  }
179
175
 
180
176
  function buttonClick(evento, value) {
@@ -219,16 +215,16 @@ const ListboxFavorites = forwardRef((props, ref) => {
219
215
  <div onClick={e => buttonClick(e, 2)} className={clsx({ [classes.buttonActive]: pageNumber === 2 }, classes.button)}>2</div>
220
216
  </div>
221
217
  {favoritosLength > 14 &&
222
- <React.Fragment>
223
- <div className={classes.areaButton}>
224
- <div onClick={e => buttonClick(e, 3)} className={clsx({ [classes.buttonActive]: pageNumber === 3 }, classes.button)}>3</div>
225
- </div>
226
- </React.Fragment>
218
+ <React.Fragment>
219
+ <div className={classes.areaButton}>
220
+ <div onClick={e => buttonClick(e, 3)} className={clsx({ [classes.buttonActive]: pageNumber === 3 }, classes.button)}>3</div>
221
+ </div>
222
+ </React.Fragment>
227
223
  }
228
224
  </div>
229
225
  </Fade>
230
226
  </ListSubheader>
231
- {retornaArray(sectionIndex, section).map((item, itemIndex) => retornaEstrutura(sectionIndex, item))}
227
+ {retornaArray(sectionIndex, section).map((item, itemIndex) => retornaEstrutura(sectionIndex, item, itemIndex))}
232
228
  </React.Fragment>
233
229
  : retornaEstrutura(sectionIndex, section)
234
230
  }
@@ -243,9 +239,10 @@ const AutoCompleteFavorites = ({ action, busca, resposta, autoSearch, label, val
243
239
  const [dados, setDados] = useState({
244
240
  lista: [],
245
241
  slide: true,
242
+ cursor: { index: '', page: '' },
246
243
  direction: '',
247
244
  favoritosLength: '',
248
- pageNumber: favoritePage ? 1 : '',
245
+ pageNumber: favoritePage ? 1 : undefined,
249
246
  });
250
247
  const [loading, setLoading] = useState(false);
251
248
  const [inputValue, setInputValue] = useState('');
@@ -291,10 +288,52 @@ const AutoCompleteFavorites = ({ action, busca, resposta, autoSearch, label, val
291
288
  // eslint-disable-next-line react-hooks/exhaustive-deps
292
289
  useEffect(() => isString(value) && buscar(value), []);
293
290
 
291
+ useEffect(() => value?.[3] !== dados.cursor?.linha?.[3] && setDados(v => ({ ...v, cursor: { index: '', page: '' } })), [value, dados.cursor?.linha]);
292
+
293
+ const keyUp = e => {
294
+ e.preventDefault();
295
+ e.stopPropagation();
296
+ ((e.key === 'Enter' || e.key === 'Tab') && !loading) && buscar();
297
+ (e.key === 'ArrowDown' || e.key === 'ArrowUp') && selectListboxItem(e.key);
298
+ };
299
+
300
+ const keyDown = e => (e.key === 'Enter' || e.key === 'Tab') && e.stopPropagation();
301
+
302
+ function selectListboxItem(key) {
303
+ const directionIndex = key === 'ArrowDown' ? 1 : key === 'ArrowUp' ? -1 : 0;
304
+ const itens = document.querySelectorAll('#listItem');
305
+ const array = Array.from(itens);
306
+ let el = '';
307
+ let indexCapture = 0;
308
+ if (!value) el = array?.[0];
309
+ else {
310
+ array.forEach((v, i) => {
311
+ const elInnerText = v.innerText;
312
+ const endIndexCode = elInnerText.indexOf('-') - 1;
313
+ const code = elInnerText.substring(0, endIndexCode);
314
+ if (code === value[3]) {
315
+ const nextIndex = i + directionIndex;
316
+ if (nextIndex < array.length) indexCapture = nextIndex > -1 ? nextIndex : i;
317
+ else indexCapture = i;
318
+ }
319
+ });
320
+ el = array[indexCapture];
321
+ }
322
+ const elInnerText = el.innerText;
323
+ const endIndexCode = elInnerText.indexOf('-') - 1;
324
+ const code = elInnerText.substring(0, endIndexCode);
325
+ const linha = dados.lista.map(v => v[3] === code && v).filter(v => v && v)?.[0];
326
+ setDados(v => ({ ...v, cursor: { index: indexCapture, page: v.pageNumber, linha: linha } }));
327
+ if (linha !== value) invokeOnChange('', linha);
328
+ }
329
+
330
+ const invokeOnChange = onChange;
331
+
294
332
  return (
295
333
  <Autocomplete
296
334
  {...props}
297
- {...{ value, onChange }}
335
+ {...{ value }}
336
+ onChange={invokeOnChange}
298
337
  autoComplete
299
338
  autoHighlight
300
339
  openText='Abrir'
@@ -312,10 +351,10 @@ const AutoCompleteFavorites = ({ action, busca, resposta, autoSearch, label, val
312
351
  label={label}
313
352
  {...params}
314
353
  {...textFieldProps}
315
- onKeyUp={e => ((e.key === 'Enter' || e.key === 'Tab') && !loading) && buscar()}
354
+ onKeyUp={e => keyUp(e)}
316
355
  inputProps={{
317
356
  ...params.inputProps,
318
- onKeyDown: e => (e.key === 'Enter' || e.key === 'Tab') && e.stopPropagation()
357
+ onKeyDown: e => keyDown(e)
319
358
  }}
320
359
  InputProps={{
321
360
  ...textFieldProps.InputProps,
@@ -1,6 +1,6 @@
1
1
  import { Box, Button, DialogActions, Divider, ListItem, ListItemIcon, ListItemText, MobileStepper, Paper, Step, StepButton, StepConnector, StepLabel, Stepper as MuiStepper, Typography, useMediaQuery, useTheme, withStyles } from '@material-ui/core';
2
2
  import clsx from 'clsx';
3
- import React from 'react';
3
+ import React, { useEffect, useState } from 'react';
4
4
  import { IconContext } from 'react-icons/lib';
5
5
  import { MdCheck, MdChevronLeft, MdChevronRight } from 'react-icons/md';
6
6
 
@@ -41,27 +41,33 @@ const ColorlibStepIcon = withStyles(theme => ({
41
41
  justifyContent: 'center',
42
42
  alignItems: 'center',
43
43
  fontSize: 24,
44
- backgroundColor: '#ccc',
44
+ backgroundColor: theme.palette.type === 'light' ? '#ccc' : '#838383',
45
45
  transition: 'all 400ms ease 100ms'
46
46
  },
47
+ initial: theme.palette.type === 'light' ? {
48
+ backgroundColor: ({ ambienteTeste }) => ambienteTeste ? '#ffc7a2' : '#9acbb8'
49
+ } : {
50
+ backgroundColor: ({ ambienteTeste }) => ambienteTeste ? '#8b6751' : '#507265'
51
+ },
47
52
  active: {
48
- backgroundColor: theme.palette.primary.main,
53
+ backgroundColor: ({ ambienteTeste }) => ambienteTeste ? '#f5781e !important' : '#00995D !important',
49
54
  boxShadow: theme.shadows[5],
50
55
  },
51
56
  completed: {
52
- backgroundColor: theme.palette.secondary.main,
57
+ backgroundColor: '#2979ff !important',
53
58
  },
54
59
  error: {
55
- backgroundColor: theme.palette.error.main,
60
+ backgroundColor: '#f44336 !important',
56
61
  },
57
62
  icon: {
58
63
  '& path': {
59
64
  stroke: '#FFF'
60
65
  }
61
66
  }
62
- }))(({ active, completed, icon, classes, error }) => (
67
+ }))(({ initial, active, completed, icon, classes, error }) => (
63
68
  <div
64
69
  className={clsx(classes.root, {
70
+ [classes.initial]: initial,
65
71
  [classes.active]: active,
66
72
  [classes.completed]: completed,
67
73
  [classes.error]: error,
@@ -125,10 +131,16 @@ const Stepper = ({
125
131
  disableFinish = false,
126
132
  disableNext = false,
127
133
  disablePrevious = false,
134
+ showProgress = false,
128
135
  ...props
129
136
  }) => {
130
137
  const maxSteps = steps.length;
131
138
  const maxStep = maxStepProps || steps.length - 1;
139
+
140
+ const [initialStep, setInitialStep] = useState(-1);
141
+ useEffect(() => (activeStep > initialStep && showProgress) && setInitialStep(activeStep), [activeStep, initialStep, showProgress]);
142
+
143
+ const ambienteTeste = JSON.parse(window.localStorage.getItem('ambienteTeste'));
132
144
 
133
145
  const theme = useTheme();
134
146
  const mobile = useMediaQuery(theme.breakpoints.down(Math.max(maxSteps * 100, theme.breakpoints.values.sm)));
@@ -157,10 +169,11 @@ const Stepper = ({
157
169
  {description}
158
170
  </Typography>}>
159
171
  <StepLabel
160
- StepIconProps={{ icon, error: errors[i] }}
161
172
  disabled={i > maxStep}
162
173
  error={errors[i]}
163
- StepIconComponent={ColorlibStepIcon}>
174
+ StepIconComponent={ColorlibStepIcon}
175
+ StepIconProps={{ icon, error: errors[i], initial: initialStep >= i, ambienteTeste }}
176
+ >
164
177
  {label}
165
178
  </StepLabel>
166
179
  </StepButton>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.155",
3
+ "version": "1.2.158",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",