linear-react-components-ui 1.1.19-beta.7 → 1.1.20-beta.0
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/assets/styles/button.scss +1 -0
- package/lib/assets/styles/table.scss +6 -10
- package/lib/assets/styles/toolbar.scss +0 -3
- package/lib/buttons/DefaultButton.js +6 -3
- package/lib/buttons/types.d.ts +1 -0
- package/lib/dropdown/Popup.d.ts +1 -1
- package/lib/dropdown/Popup.js +38 -17
- package/lib/dropdown/types.d.ts +6 -2
- package/lib/dropdown/withDropdown.js +5 -4
- package/lib/popover/PopoverText.d.ts +3 -2
- package/lib/popover/PopoverText.js +5 -8
- package/lib/popover/PopoverTitle.d.ts +1 -0
- package/lib/popover/index.d.ts +3 -5
- package/lib/popover/index.js +20 -14
- package/lib/popover/types.d.ts +12 -1
- package/lib/table/HeaderColumn.d.ts +1 -1
- package/lib/table/HeaderColumn.js +5 -6
- package/lib/table/RowColumn.js +2 -3
- package/lib/table/types.d.ts +2 -4
- package/lib/treeview/Node.js +8 -12
- package/lib/treeview/index.js +3 -7
- package/lib/treeview/types.d.ts +0 -4
- package/package.json +2 -2
|
@@ -104,6 +104,7 @@ $shadow-button-inset-default: inset 0 0 0 1px $default-border-color, $shadow-but
|
|
|
104
104
|
opacity: 0.7;
|
|
105
105
|
border: solid 1px $font-color-disabled;
|
|
106
106
|
pointer-events: auto;
|
|
107
|
+
cursor: not-allowed;
|
|
107
108
|
}
|
|
108
109
|
&.-shadowsdisabled {
|
|
109
110
|
box-shadow: none!important;
|
|
@@ -58,16 +58,12 @@
|
|
|
58
58
|
&.-noborder {
|
|
59
59
|
border-bottom: 0;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
margin: 0;
|
|
68
|
-
}
|
|
69
|
-
span {
|
|
70
|
-
width: 100%;
|
|
61
|
+
&.menu-column {
|
|
62
|
+
width: 100px;
|
|
63
|
+
text-align: center;
|
|
64
|
+
svg {
|
|
65
|
+
margin-left: 0;
|
|
66
|
+
}
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
|
|
@@ -11,7 +11,7 @@ var _withTooltip = _interopRequireWildcard(require("../internals/withTooltip"));
|
|
|
11
11
|
var _spinner = _interopRequireDefault(require("../spinner"));
|
|
12
12
|
var _withDropdown = _interopRequireDefault(require("../dropdown/withDropdown"));
|
|
13
13
|
var _permissionValidations = require("../permissionValidations");
|
|
14
|
-
const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "errorMessage", "
|
|
14
|
+
const _excluded = ["dropdown", "onClick", "disabled", "iconName", "icon", "targetRef", "tabIndex", "isLoading", "label", "showDropdown", "getDropdownPopup", "isDropdownOpened", "showIconDropdown", "content", "style", "toggleable", "activeIconColor", "iconStyle", "visible", "customClass", "className", "size", "iconAlign", "boxShadow", "transparent", "round", "permissionAttr", "skeletonize", "errorMessage", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef", "handlerClose", "onDeniedText", "tooltip", "tooltipWidth", "tooltipPosition"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
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); }
|
|
17
17
|
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; }
|
|
@@ -54,12 +54,15 @@ const DefaultButton = _ref => {
|
|
|
54
54
|
permissionAttr,
|
|
55
55
|
skeletonize,
|
|
56
56
|
errorMessage,
|
|
57
|
-
tooltipWidth,
|
|
58
57
|
isFloatMenu,
|
|
59
58
|
dropdownAlign,
|
|
60
59
|
customClassForDropdown,
|
|
61
60
|
buttonRef,
|
|
62
|
-
|
|
61
|
+
handlerClose,
|
|
62
|
+
onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.',
|
|
63
|
+
tooltip,
|
|
64
|
+
tooltipWidth,
|
|
65
|
+
tooltipPosition
|
|
63
66
|
} = _ref,
|
|
64
67
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
68
|
const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible];
|
package/lib/buttons/types.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
41
41
|
customClassForDropdown?: string;
|
|
42
42
|
dropdownAlign?: 'left' | 'right';
|
|
43
43
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
44
|
+
handlerClose?: (cb: () => void) => void;
|
|
44
45
|
closeDropdownOnClickOutside?: boolean;
|
|
45
46
|
errorMessage?: string;
|
|
46
47
|
onDeniedText?: string;
|
package/lib/dropdown/Popup.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IPopUpProps } from './types.js';
|
|
3
3
|
|
|
4
|
-
declare const DropdownPopup: ({ id, customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, ...props }: IPopUpProps) => React.ReactPortal;
|
|
4
|
+
declare const DropdownPopup: ({ id, customClassForDropdown, align, isFloatMenu, topPosition, leftPosition, rightPosition, minWidth, targetRef, ...props }: IPopUpProps) => React.ReactPortal;
|
|
5
5
|
|
|
6
6
|
export { DropdownPopup as default };
|
package/lib/dropdown/Popup.js
CHANGED
|
@@ -7,20 +7,36 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
9
9
|
var _uuid = require("uuid");
|
|
10
|
-
const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth"];
|
|
10
|
+
const _excluded = ["id", "customClassForDropdown", "align", "isFloatMenu", "topPosition", "leftPosition", "rightPosition", "minWidth", "targetRef"];
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
13
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
14
|
-
const
|
|
14
|
+
const getDropdownStyles = _ref => {
|
|
15
15
|
let {
|
|
16
|
-
topPosition,
|
|
17
|
-
leftPosition,
|
|
18
|
-
rightPosition,
|
|
19
16
|
align,
|
|
20
17
|
isFloatMenu,
|
|
21
|
-
minWidth
|
|
18
|
+
minWidth,
|
|
19
|
+
container,
|
|
20
|
+
target
|
|
22
21
|
} = _ref;
|
|
23
|
-
|
|
22
|
+
if (!container || !target) return '';
|
|
23
|
+
const targetDimensions = target.getBoundingClientRect();
|
|
24
|
+
const rightPosition = !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined;
|
|
25
|
+
const leftPosition = targetDimensions.left;
|
|
26
|
+
let topPosition = targetDimensions.top + window.scrollY + targetDimensions.height;
|
|
27
|
+
let top = topPosition + (isFloatMenu ? 6 : 2);
|
|
28
|
+
let maxHeight = undefined;
|
|
29
|
+
let showScroll = false;
|
|
30
|
+
const isOverflowing = top + container.scrollHeight > window.innerHeight;
|
|
31
|
+
if (isOverflowing) {
|
|
32
|
+
const targetPosition = targetDimensions.top;
|
|
33
|
+
const containerHeight = container.scrollHeight;
|
|
34
|
+
showScroll = containerHeight > targetPosition;
|
|
35
|
+
maxHeight = showScroll ? targetPosition - 10 : containerHeight;
|
|
36
|
+
top = top - maxHeight - targetDimensions.height - (isFloatMenu ? 6 : 2) - 5;
|
|
37
|
+
}
|
|
38
|
+
let style = "top: ".concat(top, "px; min-width: ").concat(minWidth, "px;");
|
|
39
|
+
if (showScroll) style += "max-height: ".concat(maxHeight, "px; overflow-y: scroll;");
|
|
24
40
|
if (align === 'left') {
|
|
25
41
|
style += "left: ".concat(leftPosition, "px;");
|
|
26
42
|
} else if (align === 'right') {
|
|
@@ -28,7 +44,9 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
28
44
|
}
|
|
29
45
|
return style;
|
|
30
46
|
};
|
|
31
|
-
const
|
|
47
|
+
const {
|
|
48
|
+
body
|
|
49
|
+
} = document;
|
|
32
50
|
const DropdownPopup = _ref2 => {
|
|
33
51
|
let {
|
|
34
52
|
id,
|
|
@@ -38,20 +56,13 @@ const DropdownPopup = _ref2 => {
|
|
|
38
56
|
topPosition = 0,
|
|
39
57
|
leftPosition = 0,
|
|
40
58
|
rightPosition = 0,
|
|
41
|
-
minWidth = 0
|
|
59
|
+
minWidth = 0,
|
|
60
|
+
targetRef
|
|
42
61
|
} = _ref2,
|
|
43
62
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
44
63
|
const popup = (0, _react.useRef)(document.createElement('div'));
|
|
45
64
|
popup.current.className = "dropdown-component ".concat(customClassForDropdown);
|
|
46
65
|
popup.current.dataset.testid = 'dropdown-component';
|
|
47
|
-
popup.current.style.cssText = getCalendarDropdownStyle({
|
|
48
|
-
topPosition,
|
|
49
|
-
leftPosition,
|
|
50
|
-
rightPosition,
|
|
51
|
-
align,
|
|
52
|
-
isFloatMenu,
|
|
53
|
-
minWidth
|
|
54
|
-
});
|
|
55
66
|
if (popup && popup.current) {
|
|
56
67
|
const modalContainers = document.body.getElementsByClassName('modalcontainer');
|
|
57
68
|
const lastModalContainer = modalContainers[modalContainers.length - 1];
|
|
@@ -60,6 +71,16 @@ const DropdownPopup = _ref2 => {
|
|
|
60
71
|
(0, _react.useEffect)(() => {
|
|
61
72
|
body.appendChild(popup.current);
|
|
62
73
|
popup.current.id = id || "dropdown-component-".concat((0, _uuid.v1)());
|
|
74
|
+
popup.current.style.cssText = getDropdownStyles({
|
|
75
|
+
topPosition,
|
|
76
|
+
leftPosition,
|
|
77
|
+
rightPosition,
|
|
78
|
+
align,
|
|
79
|
+
isFloatMenu,
|
|
80
|
+
minWidth,
|
|
81
|
+
container: popup.current,
|
|
82
|
+
target: targetRef
|
|
83
|
+
});
|
|
63
84
|
return () => {
|
|
64
85
|
body.removeChild(popup.current);
|
|
65
86
|
};
|
package/lib/dropdown/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface WithDropdownProps {
|
|
|
10
10
|
closeDropdownOnClickOutside?: boolean;
|
|
11
11
|
showDropdown?: () => void;
|
|
12
12
|
isFloatMenu?: boolean;
|
|
13
|
+
handlerClose?: (cb: () => void) => void;
|
|
13
14
|
}
|
|
14
15
|
interface WrappedComponentProps extends WithDropdownProps {
|
|
15
16
|
getDropdownPopup?: (ref: Ref<HTMLElement | null>) => ReactElement;
|
|
@@ -31,14 +32,17 @@ interface IPopUpProps {
|
|
|
31
32
|
leftPosition?: number;
|
|
32
33
|
rightPosition?: number;
|
|
33
34
|
minWidth?: number;
|
|
35
|
+
targetRef?: HTMLElement;
|
|
34
36
|
}
|
|
35
|
-
interface
|
|
37
|
+
interface GetDropdownStyleParams {
|
|
36
38
|
align: 'left' | 'right';
|
|
37
39
|
minWidth: number;
|
|
38
40
|
isFloatMenu: boolean;
|
|
39
41
|
topPosition: number;
|
|
40
42
|
leftPosition: number;
|
|
41
43
|
rightPosition: number;
|
|
44
|
+
container?: HTMLDivElement;
|
|
45
|
+
target?: HTMLElement;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
export {
|
|
48
|
+
export { GetDisplayNameParams, GetDropdownStyleParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
|
|
@@ -20,6 +20,7 @@ const withDropdown = WrappedComponent => {
|
|
|
20
20
|
showDropdown,
|
|
21
21
|
dropdown,
|
|
22
22
|
closeDropdownOnClickOutside = true,
|
|
23
|
+
handlerClose,
|
|
23
24
|
customClassForDropdown,
|
|
24
25
|
children,
|
|
25
26
|
dropdownAlign = 'left',
|
|
@@ -48,11 +49,8 @@ const withDropdown = WrappedComponent => {
|
|
|
48
49
|
const getDropdown = targetRef => {
|
|
49
50
|
if (!targetRef || !opened) return null;
|
|
50
51
|
wrappedComponentRef.current = targetRef;
|
|
51
|
-
const targetDimensions = targetRef.getBoundingClientRect();
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
53
|
-
|
|
54
|
-
rightPosition: !isFloatMenu ? window.innerWidth - targetDimensions.x - targetDimensions.width - 4 : undefined,
|
|
55
|
-
leftPosition: targetDimensions.left,
|
|
53
|
+
targetRef: targetRef,
|
|
56
54
|
align: dropdownAlign,
|
|
57
55
|
customClassForDropdown: customClassForDropdown,
|
|
58
56
|
isFloatMenu: isFloatMenu
|
|
@@ -73,6 +71,9 @@ const withDropdown = WrappedComponent => {
|
|
|
73
71
|
}
|
|
74
72
|
};
|
|
75
73
|
}, []);
|
|
74
|
+
(0, _react.useEffect)(() => {
|
|
75
|
+
if (handlerClose) handlerClose(() => setOpened(false));
|
|
76
|
+
}, [handlerClose]);
|
|
76
77
|
const contextValues = {
|
|
77
78
|
handleDropdownClose: onDropdownClick
|
|
78
79
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
1
|
import { PopoverTextProps } from './types.js';
|
|
2
|
+
import 'react';
|
|
3
3
|
import '../@types/Position.js';
|
|
4
4
|
import '../@types/SizePixels.js';
|
|
5
5
|
import '../@types/Icon.js';
|
|
6
6
|
import '../icons/helper.js';
|
|
7
|
+
import '../@types/PermissionAttr.js';
|
|
7
8
|
|
|
8
|
-
declare const PopoverText:
|
|
9
|
+
declare const PopoverText: ({ children }: PopoverTextProps) => JSX.Element;
|
|
9
10
|
|
|
10
11
|
export { PopoverText as default };
|
|
@@ -4,17 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
const PopoverText = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const PopoverText = _ref => {
|
|
11
10
|
let {
|
|
12
11
|
children
|
|
13
12
|
} = _ref;
|
|
14
13
|
return /*#__PURE__*/_react.default.createElement("p", {
|
|
15
|
-
className: "text"
|
|
16
|
-
ref: ref
|
|
14
|
+
className: "text"
|
|
17
15
|
}, children);
|
|
18
|
-
}
|
|
19
|
-
PopoverText.displayName = 'PopoverText';
|
|
16
|
+
};
|
|
20
17
|
var _default = exports.default = PopoverText;
|
package/lib/popover/index.d.ts
CHANGED
|
@@ -6,10 +6,8 @@ import '../@types/Position.js';
|
|
|
6
6
|
import '../@types/SizePixels.js';
|
|
7
7
|
import '../@types/Icon.js';
|
|
8
8
|
import '../icons/helper.js';
|
|
9
|
+
import '../@types/PermissionAttr.js';
|
|
9
10
|
|
|
10
|
-
declare const
|
|
11
|
-
(props: IPopoverProps): JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
};
|
|
11
|
+
declare const Popover: ({ children, align, theme, iconName, iconSize, iconColor, customClass, customStyle, ...rest }: IPopoverProps) => JSX.Element;
|
|
14
12
|
|
|
15
|
-
export {
|
|
13
|
+
export { Popover as default };
|
package/lib/popover/index.js
CHANGED
|
@@ -21,20 +21,25 @@ var _buttons = _interopRequireDefault(require("../buttons"));
|
|
|
21
21
|
var _icons = _interopRequireDefault(require("../icons"));
|
|
22
22
|
var _PopoverText = _interopRequireDefault(require("./PopoverText"));
|
|
23
23
|
var _PopoverTitle = _interopRequireDefault(require("./PopoverTitle"));
|
|
24
|
-
var _withDropdown = _interopRequireDefault(require("../dropdown/withDropdown"));
|
|
25
24
|
require("../assets/styles/popover.scss");
|
|
25
|
+
const _excluded = ["children", "align", "theme", "iconName", "iconSize", "iconColor", "customClass", "customStyle"];
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
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); }
|
|
28
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
29
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
30
|
const Popover = _ref => {
|
|
28
31
|
let {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
children,
|
|
33
|
+
align = 'left',
|
|
34
|
+
theme = 'dark',
|
|
35
|
+
iconName,
|
|
36
|
+
iconSize = 16,
|
|
37
|
+
iconColor = '',
|
|
38
|
+
customClass = '',
|
|
39
|
+
customStyle
|
|
40
|
+
} = _ref,
|
|
41
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_buttons.default, _extends({
|
|
38
43
|
round: true,
|
|
39
44
|
dropdown: true,
|
|
40
45
|
transparent: true,
|
|
@@ -57,9 +62,10 @@ const Popover = _ref => {
|
|
|
57
62
|
onClick: e => {
|
|
58
63
|
e.preventDefault();
|
|
59
64
|
}
|
|
60
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
61
|
-
className: "".concat(
|
|
62
|
-
"data-testid": "popover-container"
|
|
65
|
+
}, rest), /*#__PURE__*/_react.default.createElement("div", {
|
|
66
|
+
className: "popovercontainer -".concat(theme, " ").concat(customClass),
|
|
67
|
+
"data-testid": "popover-container",
|
|
68
|
+
style: customStyle
|
|
63
69
|
}, children));
|
|
64
70
|
};
|
|
65
|
-
var _default = exports.default =
|
|
71
|
+
var _default = exports.default = Popover;
|
package/lib/popover/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { Position } from '../@types/Position.js';
|
|
3
3
|
import { SizePixels } from '../@types/SizePixels.js';
|
|
4
4
|
import { IconNames } from '../@types/Icon.js';
|
|
5
|
+
import { PermissionAttr } from '../@types/PermissionAttr.js';
|
|
5
6
|
import '../icons/helper.js';
|
|
6
7
|
|
|
7
8
|
interface PopoverTitleProps {
|
|
@@ -18,6 +19,16 @@ interface IPopoverProps {
|
|
|
18
19
|
theme?: 'light' | 'dark';
|
|
19
20
|
align?: Extract<Position, 'left' | 'right'>;
|
|
20
21
|
iconSize?: Extract<SizePixels, 10 | 16 | 24 | 32 | 40 | 64>;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
customStyle?: CSSProperties;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
visible?: boolean;
|
|
26
|
+
skeletonize?: boolean;
|
|
27
|
+
tooltipPosition?: Exclude<Position, 'center'>;
|
|
28
|
+
tooltipWidth?: string | number;
|
|
29
|
+
tooltip?: string;
|
|
30
|
+
handlerClose?: (cb: () => void) => void;
|
|
31
|
+
permissionAttr?: PermissionAttr | PermissionAttr[];
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
export { IPopoverProps, PopoverTextProps, PopoverTitleProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ITableHeaderProps } from './types.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
|
-
declare const HeaderColumn: (
|
|
4
|
+
declare const HeaderColumn: ({ customClass, style, children, textAlign, visible, id, rowSpan, colSpan, isMenuColumn, }: ITableHeaderProps) => JSX.Element | null;
|
|
5
5
|
|
|
6
6
|
export { HeaderColumn as default };
|
|
@@ -11,9 +11,8 @@ var _helpers = _interopRequireDefault(require("./helpers"));
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const {
|
|
14
|
+
const HeaderColumn = _ref => {
|
|
15
|
+
let {
|
|
17
16
|
customClass,
|
|
18
17
|
style,
|
|
19
18
|
children,
|
|
@@ -23,7 +22,7 @@ const HeaderColumn = props => {
|
|
|
23
22
|
rowSpan,
|
|
24
23
|
colSpan,
|
|
25
24
|
isMenuColumn = false
|
|
26
|
-
} =
|
|
25
|
+
} = _ref;
|
|
27
26
|
const {
|
|
28
27
|
skeletonize,
|
|
29
28
|
vertical,
|
|
@@ -39,13 +38,13 @@ const HeaderColumn = props => {
|
|
|
39
38
|
});
|
|
40
39
|
};
|
|
41
40
|
if (!visible) return null;
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("th",
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("th", {
|
|
43
42
|
id: id,
|
|
44
43
|
rowSpan: rowSpan,
|
|
45
44
|
colSpan: colSpan,
|
|
46
45
|
className: "headercolumn ".concat(customClass, " text-align-").concat(textAlign, " ").concat(isMenuColumn && 'menu-column'),
|
|
47
46
|
style: style
|
|
48
|
-
}
|
|
47
|
+
}, skeletonize && (skeletonInHeader || !skeletonInRows) && !vertical ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
|
|
49
48
|
height: style && style.height ? undefined : 16,
|
|
50
49
|
style: {
|
|
51
50
|
marginBottom: 0
|
package/lib/table/RowColumn.js
CHANGED
|
@@ -43,8 +43,7 @@ const RowColumn = props => {
|
|
|
43
43
|
visible = true,
|
|
44
44
|
rowSpan,
|
|
45
45
|
colSpan,
|
|
46
|
-
children
|
|
47
|
-
isMenuColumn = false
|
|
46
|
+
children
|
|
48
47
|
} = props;
|
|
49
48
|
const context = (0, _react.useContext)(_helpers.RowContext);
|
|
50
49
|
const {
|
|
@@ -71,7 +70,7 @@ const RowColumn = props => {
|
|
|
71
70
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
72
71
|
rowSpan: rowSpan,
|
|
73
72
|
colSpan: colSpan,
|
|
74
|
-
className: "rowcolumn ".concat(customClass, " text-align-").concat(textAlign, " ").concat(!context.rowBorder && ' -noborder', " ").concat(!rowSpan ? ' -norowspan' : ''
|
|
73
|
+
className: "rowcolumn ".concat(customClass, " text-align-").concat(textAlign, " ").concat(!context.rowBorder && ' -noborder', " ").concat(!rowSpan ? ' -norowspan' : ''),
|
|
75
74
|
style: style,
|
|
76
75
|
onClick: e => getColClickEvent(e, _objectSpread(_objectSpread({}, context), props)),
|
|
77
76
|
role: "presentation",
|
package/lib/table/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableHTMLAttributes, ReactNode,
|
|
1
|
+
import { TableHTMLAttributes, ReactNode, MouseEvent, CSSProperties, LegacyRef, SetStateAction } from 'react';
|
|
2
2
|
|
|
3
3
|
interface ITableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
4
4
|
children?: ReactNode;
|
|
@@ -19,7 +19,7 @@ interface ITableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
19
19
|
skeletonInHeader?: boolean;
|
|
20
20
|
skeletonHeight?: number;
|
|
21
21
|
}
|
|
22
|
-
interface ITableHeaderProps extends
|
|
22
|
+
interface ITableHeaderProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
23
23
|
children?: ReactNode;
|
|
24
24
|
customClass?: string;
|
|
25
25
|
textAlign?: string;
|
|
@@ -60,7 +60,6 @@ interface ITableRowProps extends Pick<TableHTMLAttributes<HTMLTableRowElement>,
|
|
|
60
60
|
dividerStyle?: CSSProperties;
|
|
61
61
|
rowSpan?: number;
|
|
62
62
|
colSpan?: number;
|
|
63
|
-
isMenuColumn?: boolean;
|
|
64
63
|
}
|
|
65
64
|
interface ITableContext {
|
|
66
65
|
bodyScrollable?: boolean;
|
|
@@ -80,7 +79,6 @@ interface ITableContext {
|
|
|
80
79
|
handleTableRowClick?: (e: MouseEvent, dataId?: number | string) => void;
|
|
81
80
|
handlerSetColumnsWidth?: (width: (string | number | undefined)[]) => void;
|
|
82
81
|
handlerSetColumnsCount?: (count: number) => void;
|
|
83
|
-
tableContainer?: HTMLTableElement | null;
|
|
84
82
|
}
|
|
85
83
|
interface ITableRowContext {
|
|
86
84
|
skeletonize?: boolean;
|
package/lib/treeview/Node.js
CHANGED
|
@@ -39,9 +39,7 @@ const TreeNode = props => {
|
|
|
39
39
|
children,
|
|
40
40
|
nodeMenuButtonSize = 'small',
|
|
41
41
|
selectedNodeId,
|
|
42
|
-
alwaysShowArrow = false
|
|
43
|
-
customClass = '',
|
|
44
|
-
customStyle
|
|
42
|
+
alwaysShowArrow = false
|
|
45
43
|
} = props;
|
|
46
44
|
const [node, setNode] = (0, _react.useState)(props.node);
|
|
47
45
|
const [isVisible, setIsVisible] = (0, _react.useState)(startNodesOpened && nodeHasItens(node));
|
|
@@ -67,6 +65,8 @@ const TreeNode = props => {
|
|
|
67
65
|
const checked = selectedIds && selectedIds.includes(node[valuePropName]) || required;
|
|
68
66
|
if (node !== props.node) {
|
|
69
67
|
setNode(props.node);
|
|
68
|
+
setIsVisible(startNodesOpened && nodeHasItens(node));
|
|
69
|
+
setWasOpened(startNodesOpened && nodeHasItens(node));
|
|
70
70
|
}
|
|
71
71
|
const openCloseTree = currentNode => {
|
|
72
72
|
if (!wasOpened && handlerOnNodeOpen) {
|
|
@@ -80,6 +80,7 @@ const TreeNode = props => {
|
|
|
80
80
|
let span = /*#__PURE__*/_react.default.createElement("noscript", null);
|
|
81
81
|
if (node.itens && node.itens.length > 0 || alwaysShowArrow) {
|
|
82
82
|
span = /*#__PURE__*/_react.default.createElement("span", {
|
|
83
|
+
onKeyPress: () => {},
|
|
83
84
|
tabIndex: 0,
|
|
84
85
|
role: "button",
|
|
85
86
|
className: isLoading ? 'loading' : 'opencloseicon',
|
|
@@ -87,7 +88,7 @@ const TreeNode = props => {
|
|
|
87
88
|
}, isLoading ? /*#__PURE__*/_react.default.createElement(_SpinnerLoading.default, {
|
|
88
89
|
size: "35px"
|
|
89
90
|
}) : /*#__PURE__*/_react.default.createElement(_icons.default, {
|
|
90
|
-
name: isVisible ? '
|
|
91
|
+
name: isVisible ? 'up' : 'down',
|
|
91
92
|
size: 10
|
|
92
93
|
}));
|
|
93
94
|
}
|
|
@@ -118,8 +119,8 @@ const TreeNode = props => {
|
|
|
118
119
|
validator,
|
|
119
120
|
applyBehavior
|
|
120
121
|
} = validation;
|
|
121
|
-
if (_lodash.default.isEmpty(elementBehavior) && validator && validator(node)) {
|
|
122
|
-
elementBehavior = options[applyBehavior
|
|
122
|
+
if (_lodash.default.isEmpty(elementBehavior) && validator && validator(node) && applyBehavior) {
|
|
123
|
+
elementBehavior = options[applyBehavior] || options.unvisible;
|
|
123
124
|
}
|
|
124
125
|
});
|
|
125
126
|
}
|
|
@@ -179,13 +180,8 @@ const TreeNode = props => {
|
|
|
179
180
|
customClass: "node-toolbarelements"
|
|
180
181
|
}, /*#__PURE__*/_react.default.createElement(_toolbar.ToolBarGroup, null, updatedNodeRightElements)) : null;
|
|
181
182
|
};
|
|
182
|
-
(0, _react.useEffect)(() => {
|
|
183
|
-
setIsVisible(startNodesOpened && nodeHasItens(node));
|
|
184
|
-
setWasOpened(startNodesOpened && nodeHasItens(node));
|
|
185
|
-
}, [node]);
|
|
186
183
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
187
|
-
|
|
188
|
-
className: "treeviewitem ".concat(customClass)
|
|
184
|
+
className: "treeviewitem"
|
|
189
185
|
}, getSpan(), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
186
|
className: "label",
|
|
191
187
|
style: {
|
package/lib/treeview/index.js
CHANGED
|
@@ -47,13 +47,11 @@ const TreeView = props => {
|
|
|
47
47
|
nodeToolbarElements,
|
|
48
48
|
onNodeClick,
|
|
49
49
|
selectedNodeId,
|
|
50
|
-
customClass
|
|
50
|
+
customClass,
|
|
51
51
|
children,
|
|
52
52
|
styleForContainer,
|
|
53
53
|
bordered,
|
|
54
|
-
requiredIds: propsRequiredIds = []
|
|
55
|
-
customClassForNodes = '',
|
|
56
|
-
customStyleForNodes
|
|
54
|
+
requiredIds: propsRequiredIds = []
|
|
57
55
|
} = props;
|
|
58
56
|
const [data, setData] = (0, _react.useState)(props.data);
|
|
59
57
|
const [currentSelectedIds, setCurrentSelectedIds] = (0, _react.useState)(selectedIds);
|
|
@@ -253,9 +251,7 @@ const TreeView = props => {
|
|
|
253
251
|
nodeMenuButtonSize: nodeMenuButtonSize,
|
|
254
252
|
onNodeClick: onNodeClick,
|
|
255
253
|
selectedNodeId: selectedNodeId,
|
|
256
|
-
handlerOnNodeOpen: handleOnNodeOpen
|
|
257
|
-
customClass: customClassForNodes,
|
|
258
|
-
customStyle: customStyleForNodes
|
|
254
|
+
handlerOnNodeOpen: handleOnNodeOpen
|
|
259
255
|
}, childrenIds.length > 0 && node.itens && node.itens.map(nodeitem => buildTree(nodeitem, node.id, idsWithChildren)));
|
|
260
256
|
};
|
|
261
257
|
const handleNewSelectedIds = selectedNodeIds => {
|
package/lib/treeview/types.d.ts
CHANGED
|
@@ -47,8 +47,6 @@ interface ITreeviewProps {
|
|
|
47
47
|
enableDynamicData?: boolean;
|
|
48
48
|
idsInLoading?: number[];
|
|
49
49
|
selectedNodeId?: number;
|
|
50
|
-
customClassForNodes?: string;
|
|
51
|
-
customStyleForNodes?: CSSProperties;
|
|
52
50
|
}
|
|
53
51
|
interface ITreeNodeProps {
|
|
54
52
|
node: any;
|
|
@@ -67,8 +65,6 @@ interface ITreeNodeProps {
|
|
|
67
65
|
nodeElementsValidations?: INodeElementsValidations;
|
|
68
66
|
idsInLoading?: number[];
|
|
69
67
|
selectedNodeId?: number;
|
|
70
|
-
customClass?: string;
|
|
71
|
-
customStyle?: CSSProperties;
|
|
72
68
|
}
|
|
73
69
|
interface ITreeHeaderProps {
|
|
74
70
|
title?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linear-react-components-ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.20-beta.0",
|
|
4
4
|
"description": "Linear Sistemas ReactJs Components",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.cjs",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"homepage": "",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git@
|
|
32
|
+
"url": "git@gitlab.com:linear-front/linear-react-components-ui.git"
|
|
33
33
|
},
|
|
34
34
|
"browserslist": {
|
|
35
35
|
"production": [
|