linear-react-components-ui 1.0.12-beta.8 → 1.0.12
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/lib/@types/PointerEvents.d.ts +1 -1
- package/lib/assets/styles/icon.scss +8 -0
- package/lib/assets/styles/multiSelect.scss +28 -13
- package/lib/assets/styles/select.scss +34 -12
- package/lib/assets/styles/sidenav.scss +108 -43
- package/lib/buttons/button_container/index.js +1 -0
- package/lib/dialog/Custom.js +1 -1
- package/lib/dialog/form/index.js +8 -4
- package/lib/dialog/types.d.ts +2 -2
- package/lib/form/FieldNumber.js +7 -2
- package/lib/form/types.d.ts +2 -0
- package/lib/icons/helper.d.ts +12 -0
- package/lib/icons/helper.js +12 -0
- package/lib/icons/index.d.ts +6 -2
- package/lib/icons/index.js +44 -23
- package/lib/icons/types.d.ts +6 -0
- package/lib/inputs/base/InputTextBase.js +0 -4
- package/lib/inputs/base/types.d.ts +1 -2
- package/lib/inputs/mask/imaskHOC.js +24 -1
- package/lib/inputs/mask/types.d.ts +1 -0
- package/lib/inputs/select/multiple/index.js +17 -24
- package/lib/inputs/select/simple/index.js +0 -4
- package/lib/inputs/types.d.ts +2 -2
- package/lib/menus/sidenav/NavMenuItem.js +13 -1
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +3 -1
- package/lib/table/types.d.ts +1 -0
- package/lib/toolbar/types.d.ts +1 -1
- package/package.json +1 -1
package/lib/dialog/form/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.FormDialogContext = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
9
10
|
var _base = _interopRequireDefault(require("../base"));
|
|
10
11
|
var _Header = _interopRequireDefault(require("../base/Header"));
|
|
11
12
|
var _index = require("../../buttons/index");
|
|
@@ -67,16 +68,19 @@ var ModalForm = function ModalForm(props) {
|
|
|
67
68
|
handlerClose: props.handlerClose
|
|
68
69
|
}, props))), /*#__PURE__*/_react.default.createElement(_Content.default, {
|
|
69
70
|
styleForContent: _objectSpread(_objectSpread({}, props.styleForContent), overlayStyle)
|
|
70
|
-
}, content || children), getSpinner(), showFooter && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
|
|
71
|
+
}, content || children), getSpinner(), showFooter && props.buttons && props.buttons.length > 0 && /*#__PURE__*/_react.default.createElement(_Footer.default, null, /*#__PURE__*/_react.default.createElement(_index.ButtonContainer, _extends({}, props, {
|
|
71
72
|
style: _objectSpread({}, overlayStyle)
|
|
72
|
-
}),
|
|
73
|
+
}), props.buttons.map(function (button) {
|
|
73
74
|
if (context && context.securityBeforeUnload && button && button.type && button.type.name === 'CancelButton') {
|
|
74
75
|
return /*#__PURE__*/_react.default.cloneElement(button, {
|
|
76
|
+
key: "button-".concat(_uuid.default.v1()),
|
|
75
77
|
onClick: props.handlerClose
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
|
-
return /*#__PURE__*/_react.default.cloneElement(button
|
|
79
|
-
|
|
80
|
+
return /*#__PURE__*/_react.default.cloneElement(button, {
|
|
81
|
+
key: "button-".concat(_uuid.default.v1())
|
|
82
|
+
});
|
|
83
|
+
})))));
|
|
80
84
|
};
|
|
81
85
|
var _default = (0, _withFormSecurity.default)(ModalForm);
|
|
82
86
|
exports.default = _default;
|
package/lib/dialog/types.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ interface IBaseProps {
|
|
|
31
31
|
}
|
|
32
32
|
interface IFormProps {
|
|
33
33
|
children: ReactNode | ReactNode[];
|
|
34
|
-
buttons
|
|
34
|
+
buttons?: JSX.Element[];
|
|
35
35
|
styleForContent?: CSSProperties;
|
|
36
36
|
title?: string;
|
|
37
37
|
width?: string;
|
|
@@ -61,7 +61,7 @@ interface IQuestionProps {
|
|
|
61
61
|
}
|
|
62
62
|
interface ICustomProps {
|
|
63
63
|
icon: ReactElement;
|
|
64
|
-
buttons
|
|
64
|
+
buttons?: JSX.Element[];
|
|
65
65
|
title?: string;
|
|
66
66
|
text?: string;
|
|
67
67
|
height?: string;
|
package/lib/form/FieldNumber.js
CHANGED
|
@@ -32,16 +32,21 @@ var getEventProps = function getEventProps(_ref) {
|
|
|
32
32
|
_onKeyDown = _ref.onKeyDown,
|
|
33
33
|
handlerFieldValidade = _ref.handlerFieldValidade,
|
|
34
34
|
handlerFieldChange = _ref.handlerFieldChange,
|
|
35
|
-
handleShowValidateMessages = _ref.handleShowValidateMessages
|
|
35
|
+
handleShowValidateMessages = _ref.handleShowValidateMessages,
|
|
36
|
+
_onChange = _ref.onChange;
|
|
36
37
|
return {
|
|
37
38
|
onBlur: function onBlur(e) {
|
|
38
|
-
if (handlerFieldChange) handlerFieldChange(e);
|
|
39
39
|
if (validators && handlerFieldValidade) handlerFieldValidade(name, e.target.value, validators);
|
|
40
40
|
if (_onBlur) _onBlur(e);
|
|
41
41
|
handleShowValidateMessages(true);
|
|
42
42
|
},
|
|
43
|
+
onChange: function onChange(e) {
|
|
44
|
+
if (handlerFieldChange) handlerFieldChange(e);
|
|
45
|
+
if (_onChange) _onChange(e);
|
|
46
|
+
},
|
|
43
47
|
onKeyDown: function onKeyDown(e) {
|
|
44
48
|
if ([constants.keyCodes.ENTER].includes(e.keyCode)) {
|
|
49
|
+
handlerFieldChange === null || handlerFieldChange === void 0 ? void 0 : handlerFieldChange(e);
|
|
45
50
|
if (validators) handlerFieldValidade === null || handlerFieldValidade === void 0 ? void 0 : handlerFieldValidade(name, e.target.value, validators);
|
|
46
51
|
if (_onKeyDown) _onKeyDown(e);
|
|
47
52
|
handleShowValidateMessages(true);
|
package/lib/form/types.d.ts
CHANGED
package/lib/icons/helper.d.ts
CHANGED
|
@@ -591,6 +591,18 @@ declare const _default: {
|
|
|
591
591
|
viewbox: string;
|
|
592
592
|
paths: string[];
|
|
593
593
|
};
|
|
594
|
+
lamp8: {
|
|
595
|
+
viewbox: string;
|
|
596
|
+
paths: string[];
|
|
597
|
+
};
|
|
598
|
+
videoCamFill: {
|
|
599
|
+
viewbox: string;
|
|
600
|
+
paths: string[];
|
|
601
|
+
};
|
|
602
|
+
videoCamOutline: {
|
|
603
|
+
viewbox: string;
|
|
604
|
+
paths: string[];
|
|
605
|
+
};
|
|
594
606
|
};
|
|
595
607
|
|
|
596
608
|
export { _default as default };
|
package/lib/icons/helper.js
CHANGED
|
@@ -596,6 +596,18 @@ var _default = {
|
|
|
596
596
|
download: {
|
|
597
597
|
viewbox: '0 0 16 16',
|
|
598
598
|
paths: ['M12.5 6h-3.5v-4h-2v4h-3.5l4.5 4zM11.611 8.322l-0.525 0.462c1.746 0.35 2.914 0.987 2.914 1.716 0 1.105-2.686 2-6 2s-6-0.895-6-2c0-0.728 1.168-1.366 2.914-1.716l-0.525-0.462c-2.604 0.495-4.389 1.508-4.389 2.678 0 1.657 3.582 3 8 3s8-1.343 8-3c0-1.17-1.785-2.183-4.389-2.678z']
|
|
599
|
+
},
|
|
600
|
+
lamp8: {
|
|
601
|
+
viewbox: '0 0 16 16',
|
|
602
|
+
paths: ['M8 1c1.070 0 2.076 0.417 2.833 1.175 0.754 0.755 1.169 1.758 1.167 2.824-0.002 1.23-0.485 1.888-0.996 2.585-0.47 0.64-1.002 1.365-1.004 2.414-0.001 0.51-0.176 0.647-0.355 0.744-0.318 0.172-0.871 0.259-1.645 0.259-1.189 0-1.645-0.208-1.819-0.382-0.045-0.045-0.182-0.182-0.181-0.616 0.003-1.053-0.533-1.78-1.005-2.422-0.512-0.696-0.996-1.353-0.995-2.579 0.002-1.070 0.418-2.075 1.173-2.83s1.759-1.171 2.827-1.171zM8 0c-2.761 0-4.996 2.239-5 5s2.004 3.343 2 5 1.343 2 3 2c1.657 0 2.996-0.343 3-2s1.996-2.239 2-5-2.239-5-5-5v0z', 'M8 13c-1.234 0-2.259-0.274-2.463-1.516-0.024 0.168-0.037 0.34-0.037 0.516 0 1.657 1.119 2 2.5 2s2.5-0.343 2.5-2c0-0.176-0.013-0.348-0.037-0.516-0.204 1.241-1.229 1.516-2.463 1.516z', 'M8 15c-0.987 0-1.807-0.274-1.97-1.516-0.019 0.168-0.030 0.34-0.030 0.516 0 1.657 0.895 2 2 2s2-0.343 2-2c0-0.176-0.010-0.348-0.030-0.516-0.163 1.241-0.983 1.516-1.97 1.516z']
|
|
603
|
+
},
|
|
604
|
+
videoCamFill: {
|
|
605
|
+
viewbox: '0 0 16 16',
|
|
606
|
+
paths: ['M15.294 4.004c-0.165 0-0.335 0.058-0.491 0.168l-2.803 1.978v-1.651c0-0.825-0.675-1.5-1.5-1.5h-9c-0.825 0-1.5 0.675-1.5 1.5v7c0 0.825 0.675 1.5 1.5 1.5h9c0.825 0 1.5-0.675 1.5-1.5v-1.65l2.803 1.978c0.156 0.11 0.326 0.168 0.491 0.168 0 0 0 0 0 0 0.22 0 0.421-0.101 0.551-0.278 0.101-0.137 0.154-0.313 0.154-0.51v-6.415c-0-0.518-0.355-0.788-0.706-0.788zM4 11v-6l5 3-5 3z']
|
|
607
|
+
},
|
|
608
|
+
videoCamOutline: {
|
|
609
|
+
viewbox: '0 0 16 16',
|
|
610
|
+
paths: ['M15.294 4.004c-0.165 0-0.335 0.058-0.491 0.168l-2.803 1.978v-1.651c0-0.825-0.675-1.5-1.5-1.5h-9c-0.825 0-1.5 0.675-1.5 1.5v7c0 0.825 0.675 1.5 1.5 1.5h9c0.825 0 1.5-0.675 1.5-1.5v-1.65l2.803 1.978c0.156 0.11 0.326 0.168 0.491 0.168 0 0 0 0 0 0 0.22 0 0.421-0.101 0.551-0.278 0.101-0.137 0.154-0.313 0.154-0.51v-6.415c-0-0.518-0.355-0.788-0.706-0.788zM15 10.743l-2.469-1.743h-1.531v2.5c0 0.271-0.229 0.5-0.5 0.5h-9c-0.271 0-0.5-0.229-0.5-0.5v-7c0-0.271 0.229-0.5 0.5-0.5h9c0.271 0 0.5 0.229 0.5 0.5v2.5h1.531l2.469-1.743v5.486z', 'M4 5l5 3-5 3z']
|
|
599
611
|
}
|
|
600
612
|
};
|
|
601
613
|
exports.default = _default;
|
package/lib/icons/index.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ import '../@types/PointerEvents.js';
|
|
|
4
4
|
import '../@types/SizePixels.js';
|
|
5
5
|
import '../@types/Icon.js';
|
|
6
6
|
import './helper.js';
|
|
7
|
+
import '../@types/Position.js';
|
|
7
8
|
|
|
8
|
-
declare const
|
|
9
|
+
declare const _default: {
|
|
10
|
+
(props: IIconProps): JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
9
13
|
|
|
10
|
-
export {
|
|
14
|
+
export { _default as default };
|
package/lib/icons/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _helper = _interopRequireDefault(require("./helper"));
|
|
10
|
+
var _withTooltip = _interopRequireDefault(require("../internals/withTooltip"));
|
|
9
11
|
require("../assets/styles/icon.scss");
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
15
|
var listIcon = _helper.default;
|
|
12
16
|
var disabledIconColor = 'rgb(193, 193, 193)';
|
|
13
17
|
var Icon = function Icon(_ref) {
|
|
14
|
-
var _getPaths;
|
|
15
18
|
var name = _ref.name,
|
|
16
19
|
_onClick = _ref.onClick,
|
|
17
20
|
svgStruct = _ref.svgStruct,
|
|
@@ -25,34 +28,52 @@ var Icon = function Icon(_ref) {
|
|
|
25
28
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
26
29
|
_ref$customClass = _ref.customClass,
|
|
27
30
|
customClass = _ref$customClass === void 0 ? '' : _ref$customClass,
|
|
31
|
+
_ref$customClassForCo = _ref.customClassForContainer,
|
|
32
|
+
customClassForContainer = _ref$customClassForCo === void 0 ? '' : _ref$customClassForCo,
|
|
28
33
|
_ref$color = _ref.color,
|
|
29
34
|
color = _ref$color === void 0 ? '#676464' : _ref$color,
|
|
30
35
|
_ref$pointerEvents = _ref.pointerEvents,
|
|
31
|
-
pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents
|
|
36
|
+
pointerEvents = _ref$pointerEvents === void 0 ? 'none' : _ref$pointerEvents,
|
|
37
|
+
targetRef = _ref.targetRef,
|
|
38
|
+
tooltip = _ref.tooltip;
|
|
39
|
+
var refSvg = (0, _react.useRef)(null);
|
|
32
40
|
var getPaths = function getPaths() {
|
|
33
41
|
return name ? listIcon[name].paths : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.paths;
|
|
34
42
|
};
|
|
43
|
+
var getSvg = function getSvg() {
|
|
44
|
+
var _getPaths;
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
46
|
+
"data-testid": "icon",
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
if (_onClick && !disabled) _onClick();
|
|
49
|
+
},
|
|
50
|
+
ref: function ref(r) {
|
|
51
|
+
refSvg.current = r;
|
|
52
|
+
},
|
|
53
|
+
width: "".concat(size, "px"),
|
|
54
|
+
height: "".concat(size, "px"),
|
|
55
|
+
fill: disabled ? disabledIconColor : color,
|
|
56
|
+
viewBox: name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox,
|
|
57
|
+
className: "icon-component ".concat(customClass),
|
|
58
|
+
pointerEvents: pointerEvents,
|
|
59
|
+
style: style
|
|
60
|
+
}, (_getPaths = getPaths()) === null || _getPaths === void 0 ? void 0 : _getPaths.map(function (value) {
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("path", {
|
|
62
|
+
"data-testid": "icon-path",
|
|
63
|
+
d: value,
|
|
64
|
+
key: value
|
|
65
|
+
});
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
35
68
|
if (!name && !svgStruct) throw new Error('One of the "name" and "svgStruct" props must be filled');
|
|
36
69
|
if (!visible) return null;
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
fill: disabled ? disabledIconColor : color,
|
|
45
|
-
viewBox: name ? listIcon[name].viewbox : svgStruct === null || svgStruct === void 0 ? void 0 : svgStruct.viewbox,
|
|
46
|
-
className: "icon-component ".concat(customClass),
|
|
47
|
-
pointerEvents: pointerEvents,
|
|
48
|
-
style: style
|
|
49
|
-
}, (_getPaths = getPaths()) === null || _getPaths === void 0 ? void 0 : _getPaths.map(function (value) {
|
|
50
|
-
return /*#__PURE__*/_react.default.createElement("path", {
|
|
51
|
-
"data-testid": "icon-path",
|
|
52
|
-
d: value,
|
|
53
|
-
key: value
|
|
54
|
-
});
|
|
55
|
-
}));
|
|
70
|
+
if (!tooltip) return getSvg();
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: "icon-component-container ".concat(customClassForContainer),
|
|
73
|
+
ref: function ref(r) {
|
|
74
|
+
if (targetRef && r) targetRef(r);
|
|
75
|
+
}
|
|
76
|
+
}, getSvg());
|
|
56
77
|
};
|
|
57
|
-
var _default = Icon;
|
|
78
|
+
var _default = (0, _withTooltip.default)(Icon);
|
|
58
79
|
exports.default = _default;
|
package/lib/icons/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { PointerEvents } from '../@types/PointerEvents.js';
|
|
3
3
|
import { SizePixels } from '../@types/SizePixels.js';
|
|
4
4
|
import { IconNames } from '../@types/Icon.js';
|
|
5
|
+
import { Position } from '../@types/Position.js';
|
|
5
6
|
import './helper.js';
|
|
6
7
|
|
|
7
8
|
type ListIconType = {
|
|
@@ -14,6 +15,7 @@ interface IIconProps {
|
|
|
14
15
|
size?: SizePixels;
|
|
15
16
|
color?: string;
|
|
16
17
|
customClass?: string;
|
|
18
|
+
customClassForContainer?: string;
|
|
17
19
|
style?: CSSProperties;
|
|
18
20
|
visible?: boolean;
|
|
19
21
|
disabled?: boolean;
|
|
@@ -25,6 +27,10 @@ interface IIconProps {
|
|
|
25
27
|
paths: Array<string>;
|
|
26
28
|
};
|
|
27
29
|
onClick?: () => void;
|
|
30
|
+
tooltipPosition?: Exclude<Position, 'center'>;
|
|
31
|
+
tooltipWidth?: string | number;
|
|
32
|
+
tooltip?: string;
|
|
33
|
+
targetRef?: (ref: HTMLDivElement) => void;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
export { IIconProps, ListIconType };
|
|
@@ -71,7 +71,6 @@ var InputTextBase = function InputTextBase(props) {
|
|
|
71
71
|
_onDragOver = props.onDragOver,
|
|
72
72
|
_onDrop = props.onDrop,
|
|
73
73
|
_onDragLeave = props.onDragLeave,
|
|
74
|
-
_onClick = props.onClick,
|
|
75
74
|
readOnlyClass = props.readOnlyClass;
|
|
76
75
|
var propsInput;
|
|
77
76
|
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
|
|
@@ -149,9 +148,6 @@ var InputTextBase = function InputTextBase(props) {
|
|
|
149
148
|
},
|
|
150
149
|
onDragLeave: function onDragLeave(e) {
|
|
151
150
|
if (_onDragLeave) _onDragLeave(e);
|
|
152
|
-
},
|
|
153
|
-
onClick: function onClick(e) {
|
|
154
|
-
if (_onClick) _onClick(e);
|
|
155
151
|
}
|
|
156
152
|
});
|
|
157
153
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { KeyboardEvent, DragEvent, MutableRefObject, RefObject, CSSProperties } from 'react';
|
|
2
2
|
import { TextAlign } from '../../@types/Align.js';
|
|
3
3
|
import { Period } from '../../@types/Period.js';
|
|
4
4
|
import { PermissionAttr, OnDenied } from '../../@types/PermissionAttr.js';
|
|
@@ -33,7 +33,6 @@ interface IBaseProps {
|
|
|
33
33
|
maxLength?: number;
|
|
34
34
|
name?: string;
|
|
35
35
|
required?: boolean;
|
|
36
|
-
onClick?: (event: MouseEvent) => void;
|
|
37
36
|
onBlur?: (e: CustomInputEvent) => void;
|
|
38
37
|
onFocus?: (e: CustomInputEvent) => void;
|
|
39
38
|
onReset?: (e: CustomInputEvent) => void;
|
|
@@ -60,7 +60,8 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
60
60
|
value = _props$value === void 0 ? '' : _props$value,
|
|
61
61
|
onChange = props.onChange,
|
|
62
62
|
_props$isDateField = props.isDateField,
|
|
63
|
-
isDateField = _props$isDateField === void 0 ? false : _props$isDateField
|
|
63
|
+
isDateField = _props$isDateField === void 0 ? false : _props$isDateField,
|
|
64
|
+
autoCompleteMask = props.autoCompleteMask;
|
|
64
65
|
var maskOptions = {
|
|
65
66
|
placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
|
|
66
67
|
lazy: lazy,
|
|
@@ -127,6 +128,24 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
127
128
|
}, props.unmask ? unmaskedValue : maskRef.current.value);
|
|
128
129
|
}
|
|
129
130
|
}, [props.onComplete]);
|
|
131
|
+
var autoCompleteMaskValue = (0, _react.useCallback)(function (eventTargetValue) {
|
|
132
|
+
if (autoCompleteMask && eventTargetValue.length && maskRef.current && elementRef.current) {
|
|
133
|
+
var sizeMask = maskRef.current.mask.toString().replace(/\D+/g, '').length;
|
|
134
|
+
if (sizeMask > eventTargetValue.length) {
|
|
135
|
+
switch (autoCompleteMask) {
|
|
136
|
+
case 'left':
|
|
137
|
+
setValue(eventTargetValue.padStart(sizeMask, '0'));
|
|
138
|
+
break;
|
|
139
|
+
case 'right':
|
|
140
|
+
setValue(eventTargetValue.padEnd(sizeMask, '0'));
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
setValue(eventTargetValue);
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, [autoCompleteMask, maskRef.current, elementRef.current]);
|
|
130
149
|
var getMask = function getMask() {
|
|
131
150
|
var element = elementRef.current;
|
|
132
151
|
if (element) {
|
|
@@ -182,6 +201,10 @@ var IMaskHOC = function IMaskHOC(ComposedComponent) {
|
|
|
182
201
|
return /*#__PURE__*/_react.default.createElement(ComposedComponent, _extends({}, helpers.extractNonMaskProps(props, maskOptions), {
|
|
183
202
|
onDeniedActions: onDenied,
|
|
184
203
|
defaultValue: value,
|
|
204
|
+
onBlur: function onBlur(e) {
|
|
205
|
+
autoCompleteMaskValue(e.target.value);
|
|
206
|
+
if (props.onBlur) props.onBlur(e);
|
|
207
|
+
},
|
|
185
208
|
onChange: function onChange(e) {
|
|
186
209
|
return setValue(e.target.value);
|
|
187
210
|
},
|
|
@@ -80,20 +80,20 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
80
80
|
var selectWrapper = (0, _react.useRef)();
|
|
81
81
|
var gridElRef = (0, _react.useRef)();
|
|
82
82
|
var descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
83
|
-
var insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label', 'actionbutton'];
|
|
84
83
|
var onScreenResize = function onScreenResize() {
|
|
85
84
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
86
85
|
};
|
|
87
86
|
var onClickOutside = function onClickOutside(event) {
|
|
88
87
|
var target = event.target;
|
|
89
|
-
if (
|
|
88
|
+
if (target !== selectWrapper.current && selectWrapper.current && !selectWrapper.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
|
|
90
89
|
setOpened(false);
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
var onMouseMove = function onMouseMove(event) {
|
|
94
93
|
var target = event.target;
|
|
95
94
|
if (target.className === '') return;
|
|
96
|
-
|
|
95
|
+
var insideComponents = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target.className);
|
|
96
|
+
setInsideComponent(insideComponents);
|
|
97
97
|
};
|
|
98
98
|
var onClearClick = function onClearClick() {
|
|
99
99
|
setSelected(undefined);
|
|
@@ -123,26 +123,19 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
123
123
|
setInputValue([filteredValue]);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
var _onFocus = function onFocus() {
|
|
127
|
-
var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : dropdownWidth;
|
|
128
|
-
setOpened(true);
|
|
129
|
-
setDropdownWidth(dropdownWidthFocus);
|
|
130
|
-
};
|
|
131
126
|
var onSelect = function onSelect(select) {
|
|
132
|
-
var _dropdownRef$current;
|
|
133
127
|
if (select === null) return;
|
|
134
128
|
var currentsSelect = [].concat(_toConsumableArray(currents), [select]);
|
|
135
129
|
setCurrents(currentsSelect);
|
|
136
130
|
setDataCombo(dataSource);
|
|
137
131
|
setInputValue([]);
|
|
132
|
+
setOpened(false);
|
|
138
133
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(function (i) {
|
|
139
134
|
return i[idKey];
|
|
140
135
|
})));
|
|
141
|
-
(_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.focus();
|
|
142
136
|
};
|
|
143
137
|
var onUnselect = function onUnselect(id) {
|
|
144
138
|
if (currents) {
|
|
145
|
-
var _dropdownRef$current2;
|
|
146
139
|
var result = currents.filter(function (item) {
|
|
147
140
|
return item[idKey] !== id;
|
|
148
141
|
});
|
|
@@ -150,13 +143,17 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
150
143
|
if (props.onSelect) setSelected(props.onSelect(result.map(function (i) {
|
|
151
144
|
return i[idKey];
|
|
152
145
|
})));
|
|
153
|
-
(_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.focus();
|
|
154
146
|
}
|
|
155
147
|
};
|
|
156
148
|
var onOpenClose = function onOpenClose() {
|
|
157
149
|
setOpened(!opened);
|
|
158
150
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
159
151
|
};
|
|
152
|
+
var _onFocus = function onFocus() {
|
|
153
|
+
var dropdownWidthFocus = selectWrapper.current ? selectWrapper.current.clientWidth : dropdownWidth;
|
|
154
|
+
setOpened(true);
|
|
155
|
+
setDropdownWidth(dropdownWidthFocus);
|
|
156
|
+
};
|
|
160
157
|
var _onBlur = function onBlur(e) {
|
|
161
158
|
if (props.onBlur) props.onBlur(e);
|
|
162
159
|
if (!insideComponent) setOpened(false);
|
|
@@ -167,20 +164,20 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
167
164
|
if (!currents.includes(selected)) onSelect(selected);
|
|
168
165
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
169
166
|
if (!opened) setOpened(true);
|
|
170
|
-
var index =
|
|
167
|
+
var index = dataSource ? dataSource.findIndex(function (d) {
|
|
171
168
|
return d === selected;
|
|
172
169
|
}) : 0;
|
|
173
170
|
if (e.keyCode === constants.keyCodes.ARROW_DOWN) {
|
|
174
|
-
index =
|
|
171
|
+
index = dataSource && index === dataSource.length - 1 ? 0 : index + 1;
|
|
175
172
|
} else {
|
|
176
|
-
index =
|
|
173
|
+
index = dataSource && index === 0 ? dataSource.length - 1 : index - 1;
|
|
177
174
|
}
|
|
178
|
-
if (
|
|
179
|
-
if (descriptionKeyIsString &&
|
|
180
|
-
setInputValue(
|
|
181
|
-
} else if (!descriptionKeyIsString) setInputValue([descriptionKey(
|
|
175
|
+
if (dataSource && dataSource.length) {
|
|
176
|
+
if (descriptionKeyIsString && dataSource[index][descriptionKey]) {
|
|
177
|
+
setInputValue(dataSource[index][descriptionKey]);
|
|
178
|
+
} else if (!descriptionKeyIsString) setInputValue([descriptionKey(dataSource[index])]);
|
|
182
179
|
}
|
|
183
|
-
if (
|
|
180
|
+
if (dataSource) setSelected(dataSource[index]);
|
|
184
181
|
} else if (e.keyCode === constants.keyCodes.BACKSPACE) {
|
|
185
182
|
if (inputValue.length === 0) {
|
|
186
183
|
var currentsKeyDown = _lodash.default.dropRight(currents);
|
|
@@ -189,8 +186,6 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
189
186
|
return i[idKey];
|
|
190
187
|
}));
|
|
191
188
|
}
|
|
192
|
-
} else if (e.keyCode === constants.keyCodes.TAB) {
|
|
193
|
-
setOpened(false);
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
191
|
};
|
|
@@ -257,8 +252,6 @@ var MultipleSelect = function MultipleSelect(props) {
|
|
|
257
252
|
onChange: function onChange(e) {
|
|
258
253
|
if (e) onFilter(e.target.value);
|
|
259
254
|
},
|
|
260
|
-
onClick: _onFocus,
|
|
261
|
-
inputRef: dropdownRef,
|
|
262
255
|
onKeyDown: onInputKeyDown,
|
|
263
256
|
customClassForWrapper: "selectwrapper ".concat((props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'),
|
|
264
257
|
customClassForInputContent: "multiselect",
|
|
@@ -154,13 +154,11 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
var onSelect = function onSelect(selectedDropdown) {
|
|
157
|
-
var _dropdownRef$current2;
|
|
158
157
|
if (selectedDropdown === undefined) return;
|
|
159
158
|
setOpened(false);
|
|
160
159
|
setSelected(selectedDropdown);
|
|
161
160
|
if (descriptionKeyIsString) setInputText(selectedDropdown[descriptionKey]);else setInputText(descriptionKey(selectedDropdown));
|
|
162
161
|
onChange(selectedDropdown);
|
|
163
|
-
(_dropdownRef$current2 = dropdownRef.current) === null || _dropdownRef$current2 === void 0 ? void 0 : _dropdownRef$current2.focus();
|
|
164
162
|
};
|
|
165
163
|
var onOpenClose = function onOpenClose() {
|
|
166
164
|
setOpened(!opened);
|
|
@@ -283,8 +281,6 @@ var SimpleSelect = function SimpleSelect(props) {
|
|
|
283
281
|
onChange: function onChange(e) {
|
|
284
282
|
if (e) onFilter(e.target.value);
|
|
285
283
|
},
|
|
286
|
-
onClick: onFocus,
|
|
287
|
-
inputRef: dropdownRef,
|
|
288
284
|
onKeyDown: onInputKeyDown,
|
|
289
285
|
customClassForWrapper: "selectwrapper ".concat((undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'),
|
|
290
286
|
customClassForInputContent: "multiselect",
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ interface ISearchProps extends IBaseProps {
|
|
|
19
19
|
resetButton?: boolean;
|
|
20
20
|
onReset?: (event?: CustomInputEvent) => void;
|
|
21
21
|
onChange?: (event?: CustomInputEvent) => void;
|
|
22
|
-
onClick?: (event: MouseEvent<
|
|
22
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
23
23
|
textAlign?: TextAlign;
|
|
24
24
|
disabled?: boolean;
|
|
25
25
|
readOnly?: boolean;
|
|
@@ -99,6 +99,7 @@ interface IMaskHOCProps {
|
|
|
99
99
|
skeletonize?: boolean;
|
|
100
100
|
mask?: string | NumberConstructor;
|
|
101
101
|
isDateField?: boolean;
|
|
102
|
+
autoCompleteMask?: 'left' | 'right';
|
|
102
103
|
}
|
|
103
104
|
interface IDropdownSelectProps {
|
|
104
105
|
idKey: string;
|
|
@@ -110,7 +111,6 @@ interface IDropdownSelectProps {
|
|
|
110
111
|
handleOnKeydown: (e: CustomInputEvent | KeyboardEvent) => void;
|
|
111
112
|
handleOnBlur: (item: DataCombo) => void;
|
|
112
113
|
handleOnFocus: () => void;
|
|
113
|
-
handlerSelecionadoAgora?: (bool: boolean) => void;
|
|
114
114
|
opened: boolean;
|
|
115
115
|
dropdownRef: MutableRefObject<HTMLDivElement | null>;
|
|
116
116
|
dataCombo: DataCombo[];
|
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _withTooltip = _interopRequireDefault(require("../../internals/withTooltip"));
|
|
9
10
|
var _icons = _interopRequireDefault(require("../../icons"));
|
|
10
11
|
var _MenuLink = _interopRequireDefault(require("./MenuLink"));
|
|
11
12
|
var _helpers = require("./helpers");
|
|
12
13
|
var _permissionValidations = require("../../permissionValidations");
|
|
13
|
-
var _withTooltip = _interopRequireDefault(require("../../internals/withTooltip"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -44,6 +44,8 @@ var NavMenuItem = function NavMenuItem(props) {
|
|
|
44
44
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
45
|
targetDimensions = _useState4[0],
|
|
46
46
|
setTargetDimensions = _useState4[1];
|
|
47
|
+
var submenuContainerRef = (0, _react.useRef)(null);
|
|
48
|
+
var submenuContentRef = (0, _react.useRef)(null);
|
|
47
49
|
var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
|
48
50
|
var _useState5 = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr)),
|
|
49
51
|
_useState6 = _slicedToArray(_useState5, 1),
|
|
@@ -65,6 +67,13 @@ var NavMenuItem = function NavMenuItem(props) {
|
|
|
65
67
|
var contextValues = {
|
|
66
68
|
toggleSubMenu: toggleSubMenu
|
|
67
69
|
};
|
|
70
|
+
(0, _react.useEffect)(function () {
|
|
71
|
+
var _submenuContainerRef$, _submenuContentRef$cu, _submenuContentRef$cu2;
|
|
72
|
+
var heigthSubmenuContainer = ((_submenuContainerRef$ = submenuContainerRef.current) === null || _submenuContainerRef$ === void 0 ? void 0 : _submenuContainerRef$.clientHeight) || 0;
|
|
73
|
+
var heigthSubmenuContent = ((_submenuContentRef$cu = submenuContentRef.current) === null || _submenuContentRef$cu === void 0 ? void 0 : _submenuContentRef$cu.clientHeight) || 0;
|
|
74
|
+
var maxHeigthSubMenu = (window.innerHeight - targetDimensions.top - (heigthSubmenuContainer - heigthSubmenuContent) - 1).toString().concat('px') || '0px';
|
|
75
|
+
(_submenuContentRef$cu2 = submenuContentRef.current) === null || _submenuContentRef$cu2 === void 0 ? void 0 : _submenuContentRef$cu2.style.setProperty('max-height', maxHeigthSubMenu);
|
|
76
|
+
}, [showSubMenu]);
|
|
68
77
|
if (unvisible) return null;
|
|
69
78
|
return /*#__PURE__*/_react.default.createElement(_helpers.SubMenuContext.Provider, {
|
|
70
79
|
value: contextValues
|
|
@@ -84,10 +93,12 @@ var NavMenuItem = function NavMenuItem(props) {
|
|
|
84
93
|
}), /*#__PURE__*/_react.default.createElement(_react.Fragment, null, iconName && /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
85
94
|
name: iconName,
|
|
86
95
|
size: menuSize === 'small' && 16 || menuSize === 'medium' && 24 || menuSize === 'large' && 32 || 16,
|
|
96
|
+
customClassForContainer: "menuicon-container",
|
|
87
97
|
customClass: "menuicon"
|
|
88
98
|
}), isExpanded && /*#__PURE__*/_react.default.createElement("span", {
|
|
89
99
|
className: "title"
|
|
90
100
|
}, title), !childrenIsSubMenu && children)), showSubMenu && children && childrenIsSubMenu && !disabled && !openSearchMenuPopup && /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
ref: submenuContainerRef,
|
|
91
102
|
className: "submenu-container",
|
|
92
103
|
style: {
|
|
93
104
|
marginLeft: targetDimensions.width,
|
|
@@ -98,6 +109,7 @@ var NavMenuItem = function NavMenuItem(props) {
|
|
|
98
109
|
}, /*#__PURE__*/_react.default.createElement("h1", {
|
|
99
110
|
className: "title"
|
|
100
111
|
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
+
ref: submenuContentRef,
|
|
101
113
|
className: "submenu",
|
|
102
114
|
style: {
|
|
103
115
|
gridTemplateColumns: "repeat(".concat(columnsQtty, ", 1fr)")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ITableHeaderProps } from './types.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
|
-
declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, }: ITableHeaderProps) => JSX.Element | null;
|
|
4
|
+
declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, }: ITableHeaderProps) => JSX.Element | null;
|
|
5
5
|
|
|
6
6
|
export { HeaderColumn as default };
|
|
@@ -17,7 +17,8 @@ var HeaderColumn = function HeaderColumn(_ref) {
|
|
|
17
17
|
children = _ref.children,
|
|
18
18
|
textAlign = _ref.textAlign,
|
|
19
19
|
_ref$visible = _ref.visible,
|
|
20
|
-
visible = _ref$visible === void 0 ? true : _ref$visible
|
|
20
|
+
visible = _ref$visible === void 0 ? true : _ref$visible,
|
|
21
|
+
id = _ref.id;
|
|
21
22
|
var _useContext = (0, _react.useContext)(_helpers.default),
|
|
22
23
|
skeletonize = _useContext.skeletonize,
|
|
23
24
|
vertical = _useContext.vertical,
|
|
@@ -26,6 +27,7 @@ var HeaderColumn = function HeaderColumn(_ref) {
|
|
|
26
27
|
skeletonInRows = _useContext$skeletonI === void 0 ? 10 : _useContext$skeletonI;
|
|
27
28
|
if (!visible) return null;
|
|
28
29
|
return /*#__PURE__*/_react.default.createElement("th", {
|
|
30
|
+
id: id,
|
|
29
31
|
className: "headercolumn ".concat(customClass, " text-align-").concat(textAlign),
|
|
30
32
|
style: style
|
|
31
33
|
}, skeletonize && (skeletonInHeader || !skeletonInRows) && !vertical ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
|
package/lib/table/types.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ interface ITableHeaderProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
24
24
|
customClass?: string;
|
|
25
25
|
textAlign?: string;
|
|
26
26
|
visible?: boolean;
|
|
27
|
+
id?: string;
|
|
27
28
|
}
|
|
28
29
|
interface ITableBodyProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
29
30
|
children?: ReactNode;
|
package/lib/toolbar/types.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ interface IButtonBarProps {
|
|
|
22
22
|
onClick?: () => void;
|
|
23
23
|
customClass?: string;
|
|
24
24
|
transparent?: boolean;
|
|
25
|
-
size?:
|
|
25
|
+
size?: Size;
|
|
26
26
|
iconAlign?: Exclude<Position, 'top' | 'bottom'>;
|
|
27
27
|
validationKey?: string;
|
|
28
28
|
boxShadow?: boolean;
|