linear-react-components-ui 1.1.18-beta.0 → 1.1.18-beta.10
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/.eslintcache +1 -1
- package/.vscode/settings.json +0 -4
- package/lib/assets/styles/sidenav.scss +82 -39
- package/lib/inputs/mask/imaskHOC.js +203 -0
- package/lib/menus/sidenav/NavMenuItem.js +47 -15
- package/lib/menus/sidenav/popup_menu_help/index.js +85 -0
- package/lib/menus/sidenav/types.d.ts +6 -2
- package/lib/tabs/DropdownItems.js +62 -0
- package/lib/tabs/MenuItems.js +70 -0
- package/lib/treeview_old/Header.js +29 -0
- package/lib/treeview_old/Node.js +68 -0
- package/lib/treeview_old/index.js +43 -0
- package/package.json +1 -1
package/.vscode/settings.json
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
".eslintrc.js": true,
|
|
8
8
|
".gitignore": true,
|
|
9
9
|
"package-lock.json": true,
|
|
10
|
-
// ".gitlab-ci.yml": true,
|
|
11
10
|
".nvmrc": true,
|
|
12
11
|
".npmignore": true,
|
|
13
12
|
".editorconfig": true,
|
|
@@ -20,7 +19,4 @@
|
|
|
20
19
|
"editor.codeActionsOnSave": {
|
|
21
20
|
"source.fixAll.eslint": "explicit"
|
|
22
21
|
},
|
|
23
|
-
"cSpell.words": [
|
|
24
|
-
"licenca"
|
|
25
|
-
]
|
|
26
22
|
}
|
|
@@ -26,12 +26,16 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
26
26
|
pointer-events: none;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
> .expandedmenu,
|
|
30
|
+
> .collapsedmenu {
|
|
31
31
|
height: auto;
|
|
32
32
|
width: 100%;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
> .help-item {
|
|
35
|
+
border-top: 1px solid #eee;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
> .item {
|
|
35
39
|
cursor: pointer;
|
|
36
40
|
border-bottom: 1px solid #eee;
|
|
37
41
|
width: 100%;
|
|
@@ -43,7 +47,15 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
43
47
|
justify-content: center;
|
|
44
48
|
padding-left: 0px;
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
> .searchmenubutton {
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
> .helpmenubutton {
|
|
47
59
|
width: 100%;
|
|
48
60
|
height: 100%;
|
|
49
61
|
display: flex;
|
|
@@ -61,25 +73,25 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
> .item:hover {
|
|
65
77
|
background-color: #eee;
|
|
66
78
|
}
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
> .item:hover > .menuicon,
|
|
81
|
+
> .item:hover .searchmenuicon,
|
|
82
|
+
> .item:hover > .menulink > .menuicon,
|
|
83
|
+
> .item:hover > .menulink .searchmenuicon {
|
|
72
84
|
fill: rgb(114, 114, 114);
|
|
73
85
|
}
|
|
74
86
|
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
> .item:hover > .title,
|
|
88
|
+
> .item:hover > .menulink > .title {
|
|
77
89
|
color: rgb(114, 114, 114);
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
92
|
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
> .expandedmenu.customscroll,
|
|
94
|
+
> .collapsedmenu.customscroll {
|
|
83
95
|
overflow-y: auto;
|
|
84
96
|
|
|
85
97
|
&::-webkit-scrollbar {
|
|
@@ -132,7 +144,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
132
144
|
}
|
|
133
145
|
}
|
|
134
146
|
|
|
135
|
-
.sidenav-component
|
|
147
|
+
.sidenav-component > .expandedmenu {
|
|
136
148
|
animation: revealelement 0.3s;
|
|
137
149
|
-moz-animation: revealelement 0.3s;
|
|
138
150
|
background-color: #fff;
|
|
@@ -143,7 +155,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
143
155
|
-ms-flex: 0 0 70px;
|
|
144
156
|
flex: 0 0 70px;
|
|
145
157
|
|
|
146
|
-
|
|
158
|
+
> .item {
|
|
147
159
|
align-content: center;
|
|
148
160
|
background-color: #fff;
|
|
149
161
|
display: grid;
|
|
@@ -162,12 +174,12 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
162
174
|
text-decoration: none;
|
|
163
175
|
}
|
|
164
176
|
|
|
165
|
-
|
|
177
|
+
> .menuicon {
|
|
166
178
|
justify-self: center;
|
|
167
179
|
}
|
|
168
180
|
|
|
169
|
-
|
|
170
|
-
|
|
181
|
+
> .title,
|
|
182
|
+
> .menulink > .title {
|
|
171
183
|
color: #666;
|
|
172
184
|
align-self: center;
|
|
173
185
|
justify-self: left;
|
|
@@ -176,12 +188,12 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
176
188
|
}
|
|
177
189
|
}
|
|
178
190
|
|
|
179
|
-
.sidenav-component
|
|
191
|
+
.sidenav-component > .collapsedmenu {
|
|
180
192
|
display: flex;
|
|
181
193
|
flex-wrap: wrap;
|
|
182
194
|
align-content: flex-start;
|
|
183
195
|
|
|
184
|
-
|
|
196
|
+
> .item {
|
|
185
197
|
height: 50px;
|
|
186
198
|
display: grid;
|
|
187
199
|
grid-template-rows: 1fr;
|
|
@@ -192,14 +204,14 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
192
204
|
align-items: stretch;
|
|
193
205
|
}
|
|
194
206
|
|
|
195
|
-
|
|
207
|
+
> .menulink {
|
|
196
208
|
display: grid;
|
|
197
209
|
grid-template-rows: 1fr;
|
|
198
210
|
align-items: center;
|
|
199
211
|
}
|
|
200
212
|
|
|
201
|
-
|
|
202
|
-
|
|
213
|
+
> .menuicon,
|
|
214
|
+
> .menulink > .menuicon {
|
|
203
215
|
justify-self: center;
|
|
204
216
|
}
|
|
205
217
|
}
|
|
@@ -207,7 +219,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
207
219
|
&.-small {
|
|
208
220
|
width: 55px;
|
|
209
221
|
|
|
210
|
-
|
|
222
|
+
> .item {
|
|
211
223
|
height: 40px;
|
|
212
224
|
}
|
|
213
225
|
|
|
@@ -219,7 +231,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
219
231
|
&.-medium {
|
|
220
232
|
width: 55px;
|
|
221
233
|
|
|
222
|
-
|
|
234
|
+
> .item {
|
|
223
235
|
height: 50px;
|
|
224
236
|
}
|
|
225
237
|
|
|
@@ -231,7 +243,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
231
243
|
&.-large {
|
|
232
244
|
width: 75px;
|
|
233
245
|
|
|
234
|
-
|
|
246
|
+
> .item {
|
|
235
247
|
height: 60px;
|
|
236
248
|
}
|
|
237
249
|
|
|
@@ -241,8 +253,8 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
241
253
|
}
|
|
242
254
|
}
|
|
243
255
|
|
|
244
|
-
.sidenav-component
|
|
245
|
-
.sidenav-component
|
|
256
|
+
.sidenav-component > .collapsedmenu > .item > .submenu-container,
|
|
257
|
+
.sidenav-component > .expandedmenu > .item > .submenu-container {
|
|
246
258
|
animation: 0.5s ease-in 0s 1 slideLeft;
|
|
247
259
|
-moz-animation: 0.5s ease-in 0s 1 slideLeft;
|
|
248
260
|
background-color: #eee;
|
|
@@ -256,7 +268,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
256
268
|
box-shadow: 3px 1px 6px 0px rgba(50, 50, 50, 0.35);
|
|
257
269
|
z-index: 9999999;
|
|
258
270
|
|
|
259
|
-
|
|
271
|
+
> .title {
|
|
260
272
|
color: #777777;
|
|
261
273
|
font-size: 24px;
|
|
262
274
|
font-weight: bold;
|
|
@@ -275,7 +287,7 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
275
287
|
grid-template-columns: repeat(2, 1fr);
|
|
276
288
|
align-items: flex-start;
|
|
277
289
|
|
|
278
|
-
|
|
290
|
+
> .item {
|
|
279
291
|
display: grid;
|
|
280
292
|
min-height: 40px;
|
|
281
293
|
align-content: center;
|
|
@@ -288,13 +300,13 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
288
300
|
}
|
|
289
301
|
}
|
|
290
302
|
|
|
291
|
-
|
|
303
|
+
> .item:hover {
|
|
292
304
|
color: #333;
|
|
293
305
|
}
|
|
294
306
|
|
|
295
|
-
|
|
307
|
+
> .item:before {
|
|
296
308
|
position: absolute;
|
|
297
|
-
content:
|
|
309
|
+
content: "";
|
|
298
310
|
left: -15px;
|
|
299
311
|
top: 15px;
|
|
300
312
|
border-top: 5px solid transparent;
|
|
@@ -302,21 +314,24 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
302
314
|
border-left: 5px solid #808080;
|
|
303
315
|
}
|
|
304
316
|
|
|
305
|
-
|
|
317
|
+
> .item:nth-child(even) {
|
|
306
318
|
padding-left: 5px;
|
|
307
319
|
}
|
|
308
320
|
|
|
309
|
-
|
|
321
|
+
> .item > .menulink {
|
|
310
322
|
grid-template-columns: 1fr;
|
|
311
323
|
text-decoration: none;
|
|
312
324
|
}
|
|
325
|
+
|
|
313
326
|
&::-webkit-scrollbar {
|
|
314
327
|
width: 5px;
|
|
315
328
|
}
|
|
329
|
+
|
|
316
330
|
&::-webkit-scrollbar-track {
|
|
317
331
|
box-shadow: inset 0 0 5px grey;
|
|
318
332
|
border-radius: 10px;
|
|
319
333
|
}
|
|
334
|
+
|
|
320
335
|
&::-webkit-scrollbar-thumb {
|
|
321
336
|
background: rgb(151, 142, 142);
|
|
322
337
|
border-radius: 10px;
|
|
@@ -332,13 +347,41 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
332
347
|
position: absolute;
|
|
333
348
|
padding: 20px;
|
|
334
349
|
|
|
335
|
-
|
|
350
|
+
> .closebutton {
|
|
336
351
|
cursor: pointer;
|
|
337
352
|
float: right;
|
|
338
353
|
margin: -21px -33px 15px 0px;
|
|
339
354
|
}
|
|
340
355
|
}
|
|
341
356
|
|
|
357
|
+
.popup-help {
|
|
358
|
+
border: 1px solid $list-container-border;
|
|
359
|
+
|
|
360
|
+
> .list-component {
|
|
361
|
+
box-shadow: none;
|
|
362
|
+
overflow: hidden;
|
|
363
|
+
border-radius: 0px;
|
|
364
|
+
|
|
365
|
+
> .helpheader {
|
|
366
|
+
background-color: #bdbdbda6;
|
|
367
|
+
|
|
368
|
+
> .title {
|
|
369
|
+
line-height: 35px;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
> .item-container > .item > .text {
|
|
374
|
+
font-size: 12px;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.infomartion > .help-information {
|
|
379
|
+
color: rgba(0, 0, 0, 0.54);
|
|
380
|
+
font-size: 12px;
|
|
381
|
+
line-height: 16px;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
342
385
|
.nodata-container {
|
|
343
386
|
display: flex;
|
|
344
387
|
flex-direction: column;
|
|
@@ -347,18 +390,18 @@ que utilizam. Em caso de mudança, ficar atento para os refatores.
|
|
|
347
390
|
height: 100%;
|
|
348
391
|
width: 100%;
|
|
349
392
|
|
|
350
|
-
|
|
393
|
+
> .text,
|
|
351
394
|
.subtext {
|
|
352
395
|
color: #a8a8a8;
|
|
353
396
|
text-align: center;
|
|
354
397
|
}
|
|
355
398
|
|
|
356
|
-
|
|
399
|
+
> .text {
|
|
357
400
|
font-size: 26px;
|
|
358
401
|
margin-top: 20px;
|
|
359
402
|
}
|
|
360
403
|
|
|
361
|
-
|
|
404
|
+
> .subtext {
|
|
362
405
|
font-size: 15px;
|
|
363
406
|
margin-top: 5px;
|
|
364
407
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _imask = _interopRequireDefault(require("imask"));
|
|
9
|
+
var helpers = _interopRequireWildcard(require("./helpers"));
|
|
10
|
+
var _permissionValidations = require("../../permissionValidations");
|
|
11
|
+
var _format_number = require("../number/format_number");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
17
|
+
const IMaskHOC = ComposedComponent => {
|
|
18
|
+
const MaskedComponent = props => {
|
|
19
|
+
const {
|
|
20
|
+
permissionAttr,
|
|
21
|
+
skeletonize,
|
|
22
|
+
inputRef,
|
|
23
|
+
placeholderChar = '_',
|
|
24
|
+
lazy = false,
|
|
25
|
+
pattern = '',
|
|
26
|
+
radix = ' ',
|
|
27
|
+
thousandsSeparator = '',
|
|
28
|
+
mapToRadix = [],
|
|
29
|
+
scale = 2,
|
|
30
|
+
signed = false,
|
|
31
|
+
normalizeZeros = true,
|
|
32
|
+
padFractionalZeros = true,
|
|
33
|
+
mask,
|
|
34
|
+
commit = () => {},
|
|
35
|
+
parse,
|
|
36
|
+
format,
|
|
37
|
+
definitions,
|
|
38
|
+
groups,
|
|
39
|
+
min,
|
|
40
|
+
max,
|
|
41
|
+
dispatch,
|
|
42
|
+
value = '',
|
|
43
|
+
onChange,
|
|
44
|
+
isDateField = false,
|
|
45
|
+
autoCompleteMask
|
|
46
|
+
} = props;
|
|
47
|
+
const maskOptions = {
|
|
48
|
+
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
49
|
+
lazy,
|
|
50
|
+
pattern,
|
|
51
|
+
radix,
|
|
52
|
+
thousandsSeparator,
|
|
53
|
+
mapToRadix,
|
|
54
|
+
scale,
|
|
55
|
+
signed,
|
|
56
|
+
normalizeZeros,
|
|
57
|
+
padFractionalZeros,
|
|
58
|
+
mask,
|
|
59
|
+
commit,
|
|
60
|
+
parse,
|
|
61
|
+
format,
|
|
62
|
+
definitions,
|
|
63
|
+
groups,
|
|
64
|
+
min,
|
|
65
|
+
max,
|
|
66
|
+
dispatch
|
|
67
|
+
};
|
|
68
|
+
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
69
|
+
const elementRef = (0, _react.useRef)(null);
|
|
70
|
+
const maskRef = (0, _react.useRef)(null);
|
|
71
|
+
const {
|
|
72
|
+
hideContent,
|
|
73
|
+
unvisible,
|
|
74
|
+
disabled,
|
|
75
|
+
readOnly
|
|
76
|
+
} = onDenied;
|
|
77
|
+
const dontInitMask = hideContent || unvisible || skeletonize;
|
|
78
|
+
const disableCallbacks = disabled || readOnly;
|
|
79
|
+
const setValue = newValue => {
|
|
80
|
+
if (maskRef.current) {
|
|
81
|
+
if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
|
|
82
|
+
maskRef.current.value = String(newValue);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onAccept = (0, _react.useCallback)(() => {
|
|
86
|
+
if (onChange && !disableCallbacks && maskRef.current) {
|
|
87
|
+
const {
|
|
88
|
+
unmaskedValue,
|
|
89
|
+
el
|
|
90
|
+
} = maskRef.current;
|
|
91
|
+
const name = el.name || el.input && el.input.name;
|
|
92
|
+
onChange({
|
|
93
|
+
target: {
|
|
94
|
+
value: unmaskedValue,
|
|
95
|
+
name
|
|
96
|
+
}
|
|
97
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
98
|
+
}
|
|
99
|
+
}, [onChange]);
|
|
100
|
+
const onComplete = (0, _react.useCallback)(() => {
|
|
101
|
+
if (props.onComplete && !disableCallbacks && maskRef.current) {
|
|
102
|
+
const {
|
|
103
|
+
unmaskedValue,
|
|
104
|
+
el
|
|
105
|
+
} = maskRef.current;
|
|
106
|
+
const name = el.name || el.input && el.input.name;
|
|
107
|
+
props.onComplete({
|
|
108
|
+
target: {
|
|
109
|
+
value: unmaskedValue,
|
|
110
|
+
name
|
|
111
|
+
}
|
|
112
|
+
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
113
|
+
}
|
|
114
|
+
}, [props.onComplete]);
|
|
115
|
+
const autoCompleteMaskValue = (0, _react.useCallback)(eventTargetValue => {
|
|
116
|
+
if (autoCompleteMask && eventTargetValue.length && maskRef.current && elementRef.current) {
|
|
117
|
+
const sizeMask = maskRef.current.mask.toString().replace(/\D+/g, '').length;
|
|
118
|
+
if (sizeMask > eventTargetValue.length) {
|
|
119
|
+
switch (autoCompleteMask) {
|
|
120
|
+
case 'left':
|
|
121
|
+
setValue(eventTargetValue.padStart(sizeMask, '0'));
|
|
122
|
+
break;
|
|
123
|
+
case 'right':
|
|
124
|
+
setValue(eventTargetValue.padEnd(sizeMask, '0'));
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
setValue(eventTargetValue);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}, [autoCompleteMask, maskRef.current, elementRef.current]);
|
|
133
|
+
const getMask = () => {
|
|
134
|
+
const element = elementRef.current;
|
|
135
|
+
if (element) {
|
|
136
|
+
const maskCurrent = maskRef.current;
|
|
137
|
+
if (!maskCurrent) {
|
|
138
|
+
maskRef.current = (0, _imask.default)(element, maskOptions);
|
|
139
|
+
if (value && typeof value !== 'number' && value.trim() !== '' || value && typeof value === 'number') onAccept();
|
|
140
|
+
setValue(value);
|
|
141
|
+
} else {
|
|
142
|
+
maskCurrent.updateOptions(maskOptions);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const destroyMask = () => {
|
|
147
|
+
if (maskRef.current) {
|
|
148
|
+
maskRef.current.destroy();
|
|
149
|
+
maskRef.current = null;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
(0, _react.useEffect)(() => {
|
|
153
|
+
if (props.handlerSetOnDenied) props.handlerSetOnDenied(onDenied);
|
|
154
|
+
if (!props.mask || dontInitMask) return;
|
|
155
|
+
getMask();
|
|
156
|
+
}, [maskOptions]);
|
|
157
|
+
(0, _react.useEffect)(() => {
|
|
158
|
+
if (!maskRef.current) return;
|
|
159
|
+
const maskCurrent = maskRef.current;
|
|
160
|
+
maskCurrent.on('accept', onAccept);
|
|
161
|
+
maskCurrent.on('complete', onComplete);
|
|
162
|
+
|
|
163
|
+
// eslint-disable-next-line consistent-return
|
|
164
|
+
return () => {
|
|
165
|
+
maskCurrent.off('accept', onAccept);
|
|
166
|
+
maskCurrent.off('complete', onComplete);
|
|
167
|
+
};
|
|
168
|
+
}, [onAccept, onComplete]);
|
|
169
|
+
(0, _react.useEffect)(() => {
|
|
170
|
+
if (maskOptions.mask && !dontInitMask) {
|
|
171
|
+
if (maskRef.current) {
|
|
172
|
+
const formattedValue = isDateField ? value : (0, _format_number.numberToPtBR)(value) || '';
|
|
173
|
+
setValue(formattedValue);
|
|
174
|
+
} else {
|
|
175
|
+
getMask();
|
|
176
|
+
}
|
|
177
|
+
} else if (!dontInitMask) {
|
|
178
|
+
destroyMask();
|
|
179
|
+
if (value && elementRef.current) elementRef.current.value = value;
|
|
180
|
+
}
|
|
181
|
+
}, [value, isDateField]);
|
|
182
|
+
(0, _react.useEffect)(() => destroyMask, []);
|
|
183
|
+
return /*#__PURE__*/_react.default.createElement(ComposedComponent, _extends({}, helpers.extractNonMaskProps(props, maskOptions), {
|
|
184
|
+
onDeniedActions: onDenied,
|
|
185
|
+
defaultValue: value,
|
|
186
|
+
onBlur: e => {
|
|
187
|
+
autoCompleteMaskValue(e.target.value);
|
|
188
|
+
if (props.onBlur) props.onBlur(e);
|
|
189
|
+
},
|
|
190
|
+
onChange: e => setValue(e.target.value),
|
|
191
|
+
inputRef: el => {
|
|
192
|
+
elementRef.current = el;
|
|
193
|
+
if (inputRef) {
|
|
194
|
+
if (typeof inputRef === 'object') inputRef.current = el;else inputRef(el);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}));
|
|
198
|
+
};
|
|
199
|
+
const nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
|
|
200
|
+
MaskedComponent.displayName = "IMask(".concat(nestedComponentName, ")");
|
|
201
|
+
return MaskedComponent;
|
|
202
|
+
};
|
|
203
|
+
var _default = exports.default = IMaskHOC;
|
|
@@ -26,13 +26,18 @@ const NavMenuItem = props => {
|
|
|
26
26
|
maxWidth = '90%',
|
|
27
27
|
minWidth = 500,
|
|
28
28
|
columnsQtty,
|
|
29
|
-
targetRef
|
|
29
|
+
targetRef,
|
|
30
|
+
disableDefaultStyle = false,
|
|
31
|
+
showDropdownOnClick = false,
|
|
32
|
+
style,
|
|
33
|
+
customClassForDropdown
|
|
30
34
|
} = props;
|
|
31
35
|
const [showSubMenu, setShowSubMenu] = (0, _react.useState)(false);
|
|
32
36
|
const [targetDimensions, setTargetDimensions] = (0, _react.useState)({});
|
|
33
|
-
const [
|
|
37
|
+
const [isOnEndWindow, setIsOnEndWindow] = (0, _react.useState)(false);
|
|
34
38
|
const submenuContainerRef = (0, _react.useRef)(null);
|
|
35
39
|
const submenuContentRef = (0, _react.useRef)(null);
|
|
40
|
+
const menuItemRef = (0, _react.useRef)(null);
|
|
36
41
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
37
42
|
const [onDenied] = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr));
|
|
38
43
|
const {
|
|
@@ -45,38 +50,65 @@ const NavMenuItem = props => {
|
|
|
45
50
|
disabled
|
|
46
51
|
} = onDenied;
|
|
47
52
|
const onMouseEnter = e => {
|
|
53
|
+
if (showDropdownOnClick) return;
|
|
48
54
|
const windowHeight = window.innerHeight;
|
|
49
55
|
const eventTarget = e.target;
|
|
50
56
|
const position = eventTarget.getBoundingClientRect();
|
|
51
57
|
setShowSubMenu(true);
|
|
52
58
|
setTargetDimensions(position);
|
|
53
|
-
if (position.bottom >= windowHeight - 150)
|
|
59
|
+
if (position.bottom >= windowHeight - 150) setIsOnEndWindow(true);
|
|
54
60
|
};
|
|
55
|
-
const toggleSubMenu =
|
|
56
|
-
|
|
61
|
+
const toggleSubMenu = e => {
|
|
62
|
+
if (showDropdownOnClick && e) {
|
|
63
|
+
const eventTarget = e.target;
|
|
64
|
+
if (eventTarget === menuItemRef.current) {
|
|
65
|
+
const windowHeight = window.innerHeight;
|
|
66
|
+
const position = eventTarget.getBoundingClientRect();
|
|
67
|
+
setShowSubMenu(!showSubMenu);
|
|
68
|
+
setTargetDimensions(position);
|
|
69
|
+
if (position.bottom >= windowHeight - 150) setIsOnEndWindow(true);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
57
72
|
};
|
|
58
73
|
const contextValues = {
|
|
59
74
|
toggleSubMenu
|
|
60
75
|
};
|
|
76
|
+
(0, _react.useEffect)(() => {
|
|
77
|
+
if (showSubMenu && showDropdownOnClick) {
|
|
78
|
+
document.addEventListener('click', e => {
|
|
79
|
+
var _menuItemRef$current;
|
|
80
|
+
const target = e.target;
|
|
81
|
+
const insideMenu = (_menuItemRef$current = menuItemRef.current) === null || _menuItemRef$current === void 0 ? void 0 : _menuItemRef$current.contains(target);
|
|
82
|
+
if (!insideMenu) setShowSubMenu(false);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, [showSubMenu, showDropdownOnClick]);
|
|
61
86
|
(0, _react.useEffect)(() => {
|
|
62
87
|
var _submenuContainerRef$, _submenuContentRef$cu, _submenuContentRef$cu2;
|
|
63
88
|
const heigthSubmenuContainer = ((_submenuContainerRef$ = submenuContainerRef.current) === null || _submenuContainerRef$ === void 0 ? void 0 : _submenuContainerRef$.clientHeight) || 0;
|
|
64
89
|
const heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
|
|
65
|
-
const maxHeigthSubMenu =
|
|
90
|
+
const maxHeigthSubMenu = isOnEndWindow ? '100%' : (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
66
91
|
(_submenuContentRef$cu2 = submenuContentRef.current) === null || _submenuContentRef$cu2 === void 0 ? void 0 : _submenuContentRef$cu2.style.setProperty('max-height', maxHeigthSubMenu);
|
|
67
92
|
}, [showSubMenu]);
|
|
68
93
|
if (unvisible) return null;
|
|
69
94
|
return /*#__PURE__*/_react.default.createElement(_helpers.SubMenuContext.Provider, {
|
|
70
95
|
value: contextValues
|
|
71
96
|
}, /*#__PURE__*/_react.default.createElement("li", {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
style: style,
|
|
98
|
+
ref: r => {
|
|
99
|
+
menuItemRef.current = r;
|
|
100
|
+
if (targetRef) targetRef(r);
|
|
76
101
|
},
|
|
102
|
+
className: "item ".concat(url && !disabled && '-withlink', " ").concat(customClass, " ").concat(disabled && '-disabled'),
|
|
103
|
+
onMouseEnter: onMouseEnter,
|
|
77
104
|
onMouseLeave: () => {
|
|
105
|
+
if (showDropdownOnClick) return;
|
|
78
106
|
setShowSubMenu(false);
|
|
79
|
-
|
|
107
|
+
setIsOnEndWindow(false);
|
|
108
|
+
},
|
|
109
|
+
onClick: e => {
|
|
110
|
+
if (!showDropdownOnClick) return;
|
|
111
|
+
toggleSubMenu(e);
|
|
80
112
|
}
|
|
81
113
|
}, /*#__PURE__*/_react.default.createElement(_MenuLink.default, _extends({
|
|
82
114
|
disabled: disabled
|
|
@@ -91,12 +123,12 @@ const NavMenuItem = props => {
|
|
|
91
123
|
className: "title"
|
|
92
124
|
}, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
|
|
93
125
|
ref: submenuContainerRef,
|
|
94
|
-
className: "submenu-container
|
|
95
|
-
style:
|
|
126
|
+
className: "customClassForDropdown ".concat(disableDefaultStyle ? '' : 'submenu-container'),
|
|
127
|
+
style: isOnEndWindow ? {
|
|
96
128
|
marginLeft: targetDimensions.width,
|
|
97
129
|
bottom: '0',
|
|
98
|
-
|
|
99
|
-
|
|
130
|
+
position: 'fixed',
|
|
131
|
+
zIndex: disableDefaultStyle ? 999999999 : undefined
|
|
100
132
|
} : {
|
|
101
133
|
marginLeft: targetDimensions.width,
|
|
102
134
|
top: targetDimensions.top,
|