linear-react-components-ui 1.1.20-beta.41 → 1.1.20-beta.43

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.
@@ -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;
@@ -135,12 +135,10 @@
135
135
  @keyframes revealelement {
136
136
  0% {
137
137
  color: transparent;
138
- height: 0%;
139
138
  opacity: 0.0;
140
139
  }
141
140
  50% {
142
141
  color: inherit;
143
- height: auto;
144
142
  opacity: 0.3;
145
143
  }
146
144
  100% {
@@ -78,13 +78,13 @@ table {
78
78
  display: flex;
79
79
  flex-direction: row;
80
80
  align-items: center;
81
+ justify-content: space-between;
81
82
  }
82
83
 
83
84
  span.container-toolbar-buttons {
84
- width: 100%;
85
+ width: auto;
85
86
  height: auto;
86
87
  margin-left: 4px;
87
- margin-right: 16px;
88
88
  }
89
89
 
90
90
  .row-toolbar {
@@ -1,6 +1,6 @@
1
1
  @import "./colors.scss";
2
2
  @import "./effects.scss";
3
- .treeview-component {
3
+ .treeview-component {
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  > .treeviewcontainer {
@@ -52,17 +52,17 @@
52
52
  align-items: center;
53
53
  min-height: 25px;
54
54
  color: $font-color-soft;
55
- >.node-menu {
55
+ > .node-menu {
56
56
  animation: revealelement 0.3s forwards ease-in-out;
57
57
  margin-left: 10px;
58
58
  }
59
- >.node-rightelements {
59
+ > .node-rightelements {
60
60
  animation: revealelement 0.3s forwards ease-in-out;
61
61
  display: flex;
62
62
  justify-content: flex-start;
63
63
  align-items: center;
64
64
  }
65
- >.node-toolbarelements {
65
+ > .node-toolbarelements {
66
66
  animation: revealelement 0.3s forwards ease-in-out;
67
67
  width: auto;
68
68
  height: 100%;
@@ -82,15 +82,31 @@
82
82
  }
83
83
  }
84
84
 
85
- .nodelist > .treeviewitem > .label > .node-rightelements > .element,
86
- .treeview-component > .treeviewcontainer > .treeviewitem > .label > .node-rightelements > .element {
85
+ .nodelist > .treeviewitem > .label > .node-rightelements > .element,
86
+ .treeview-component
87
+ > .treeviewcontainer
88
+ > .treeviewitem
89
+ > .label
90
+ > .node-rightelements
91
+ > .element {
87
92
  margin-left: 10px;
88
93
  display: flex;
89
94
  align-items: center;
90
95
  height: 100%;
91
96
  }
92
97
 
93
- .nodelist > .treeviewitem > .label > .node-toolbarelements > .toolbar-group > .buttonbar,
94
- .treeview-component > .treeviewcontainer > .treeviewitem > .label > .node-toolbarelements > .toolbar-group > .buttonbar {
98
+ .nodelist
99
+ > .treeviewitem
100
+ > .label
101
+ > .node-toolbarelements
102
+ > .toolbar-group
103
+ > .buttonbar,
104
+ .treeview-component
105
+ > .treeviewcontainer
106
+ > .treeviewitem
107
+ > .label
108
+ > .node-toolbarelements
109
+ > .toolbar-group
110
+ > .buttonbar {
95
111
  border: none;
96
112
  }
@@ -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", "tooltipWidth", "isFloatMenu", "dropdownAlign", "customClassForDropdown", "buttonRef", "onDeniedText"];
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(e) { return e && e.__esModule ? e : { default: e }; }
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
- onDeniedText = 'Permissão Negada! Consulte o Administrador do sistema.'
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];
@@ -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;
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
13
  const Alert = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: "Confirmar"
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
13
  const Error = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: "Confirmar"
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -11,10 +11,14 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
13
  const Information = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
19
  key: "confirm-buttom",
16
- onClick: props.onConfirmClick,
17
- label: "Confirmar"
20
+ onClick: onConfirmClick,
21
+ label: confirmLabel
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
20
24
  buttons: buttons,
@@ -18,7 +18,9 @@ const Question = props => {
18
18
  closeOnEsc = false,
19
19
  isWaiting,
20
20
  onConfirmClick,
21
- onUnconfirmClick
21
+ onUnconfirmClick,
22
+ confirmLabel = 'Sim',
23
+ declineLabel = 'Não'
22
24
  } = props;
23
25
  const idUnconfirm = 'botao-unconfirm-click';
24
26
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.DangerButton, {
@@ -26,13 +28,13 @@ const Question = props => {
26
28
  disabled: isWaiting,
27
29
  onClick: onConfirmClick,
28
30
  isLoading: isWaiting,
29
- label: "Sim"
31
+ label: confirmLabel
30
32
  }), /*#__PURE__*/_react.default.createElement(_buttons.default, {
31
33
  id: idUnconfirm,
32
34
  key: "no-buttom",
33
35
  disabled: isWaiting,
34
36
  onClick: onUnconfirmClick,
35
- label: "N\xE3o"
37
+ label: declineLabel
36
38
  })];
37
39
  (0, _react.useLayoutEffect)(() => {
38
40
  const lastElementActive = document.activeElement;
@@ -11,9 +11,13 @@ var _icons = _interopRequireDefault(require("../../lib/icons"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
13
  const Warning = props => {
14
+ const {
15
+ onConfirmClick,
16
+ confirmLabel = 'Confirmar'
17
+ } = props;
14
18
  const buttons = [/*#__PURE__*/_react.default.createElement(_buttons.PrimaryButton, {
15
- onClick: props.onConfirmClick,
16
- label: "Confirmar",
19
+ onClick: onConfirmClick,
20
+ label: confirmLabel,
17
21
  key: 1
18
22
  })];
19
23
  return /*#__PURE__*/_react.default.createElement(_Custom.default, _extends({}, props, {
@@ -48,6 +48,7 @@ interface ICommonDialogProps {
48
48
  onConfirmClick?: () => void;
49
49
  text?: string;
50
50
  title?: string;
51
+ confirmLabel?: string;
51
52
  }
52
53
  interface IQuestionProps {
53
54
  onUnconfirmClick: () => void;
@@ -58,6 +59,8 @@ interface IQuestionProps {
58
59
  title?: string;
59
60
  zIndex?: number | string;
60
61
  closeOnEsc?: boolean;
62
+ confirmLabel?: string;
63
+ declineLabel?: string;
61
64
  }
62
65
  interface ICustomProps {
63
66
  icon: ReactElement;
@@ -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 };
@@ -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(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
13
13
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
14
- const getCalendarDropdownStyle = _ref => {
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
- let style = `top: ${topPosition + (isFloatMenu ? 6 : 2)}px; min-width: ${minWidth}px;`;
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: ${top}px; min-width: ${minWidth}px;`;
39
+ if (showScroll) style += `max-height: ${maxHeight}px; overflow-y: scroll;`;
24
40
  if (align === 'left') {
25
41
  style += `left: ${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 body = document.getElementsByTagName('body')[0];
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 ${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-${(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
  };
@@ -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 GetCalendarDropdownStyleParams {
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 { GetCalendarDropdownStyleParams, GetDisplayNameParams, IPopUpProps, WithDropdownContextProps, WithDropdownProps, WrappedComponentProps };
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
- topPosition: targetDimensions.top + window.scrollY + targetDimensions.height,
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
  };
@@ -72,7 +72,8 @@ const InputTextBase = props => {
72
72
  readOnlyClass,
73
73
  autoComplete = 'on',
74
74
  themePopover = 'light',
75
- popoverAlign = 'left'
75
+ popoverAlign = 'left',
76
+ tabIndex
76
77
  } = props;
77
78
  let propsInput;
78
79
  const options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
@@ -86,7 +87,11 @@ const InputTextBase = props => {
86
87
  (0, _react.useEffect)(() => {
87
88
  if (handlerSetOnDenied) handlerSetOnDenied(onDenied);
88
89
  }, []);
89
- const applyTabIndex = () => readOnly ? -1 : 0;
90
+ const applyTabIndex = () => {
91
+ if (readOnly) return -1;
92
+ if (tabIndex) return tabIndex;
93
+ return 0;
94
+ };
90
95
  const shouldDisable = () => disabled || onDenied.disabled;
91
96
  const shouldBeReadOnly = () => readOnly || onDenied.readOnly;
92
97
  const inputProps = () => {
@@ -95,6 +95,7 @@ interface IBaseProps {
95
95
  autoComplete?: 'on' | 'off';
96
96
  themePopover?: 'light' | 'dark';
97
97
  popoverAlign?: 'right' | 'left';
98
+ tabIndex?: number;
98
99
  }
99
100
 
100
101
  export { CustomInputEvent, IBaseProps, InputLabelProps };
@@ -37,13 +37,13 @@ declare const getMaskOptions: ({ isDateField, placeholderChar, min, max, lazy, p
37
37
  required?: boolean | undefined;
38
38
  returnFormattedValueOnBlur?: boolean | undefined;
39
39
  returnFormattedValueOnKeyDown?: boolean | undefined;
40
- autoCompleteMask?: "left" | "right" | undefined;
40
+ autoCompleteMask?: "right" | "left" | undefined;
41
41
  definitions?: any;
42
42
  mask?: any;
43
43
  hint?: string | string[] | undefined;
44
44
  hintPosition?: "below" | "onLabelRight" | undefined;
45
45
  themePopover?: "dark" | "light" | undefined;
46
- popoverAlign?: "left" | "right" | undefined;
46
+ popoverAlign?: "right" | "left" | undefined;
47
47
  placeholderChar: string;
48
48
  min: any;
49
49
  max: any;
@@ -12,6 +12,6 @@ import '../../drawer/types.js';
12
12
  import '../../@types/Icon.js';
13
13
  import '../../icons/helper.js';
14
14
 
15
- declare const BaseNumber: (props: IBaseNumberProps) => JSX.Element;
15
+ declare const BaseNumber: ({ value, ...props }: IBaseNumberProps) => JSX.Element;
16
16
 
17
17
  export { BaseNumber as default };
@@ -7,8 +7,11 @@ exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _BaseMask = _interopRequireDefault(require("../mask/BaseMask"));
9
9
  var _format_number = require("./format_number");
10
+ const _excluded = ["value"];
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
14
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
12
15
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
16
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
17
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -54,13 +57,17 @@ const getEventProps = props => {
54
57
  }
55
58
  };
56
59
  };
57
- const BaseNumber = props => {
60
+ const BaseNumber = _ref => {
61
+ let {
62
+ value
63
+ } = _ref,
64
+ props = _objectWithoutProperties(_ref, _excluded);
58
65
  const eventProps = _objectSpread(_objectSpread({}, props), {}, {
59
66
  returnFormattedValueOnBlur: true,
60
67
  returnFormattedValueOnKeyDown: true
61
68
  });
62
69
  return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({
63
- value: (0, _format_number.numberToPtBR)(props.value),
70
+ value: (0, _format_number.numberToPtBR)(value ?? 0),
64
71
  thousandsSeparator: ".",
65
72
  radix: ",",
66
73
  mask: Number,
@@ -12,6 +12,6 @@ import '../../drawer/types.js';
12
12
  import '../../@types/Icon.js';
13
13
  import '../../icons/helper.js';
14
14
 
15
- declare const CurrencyField: (props: ICurrencyProps) => JSX.Element;
15
+ declare const CurrencyField: ({ displayCurrencySymbol, ...props }: ICurrencyProps) => JSX.Element;
16
16
 
17
17
  export { CurrencyField as default };
@@ -6,17 +6,24 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _BaseNumber = _interopRequireDefault(require("./BaseNumber"));
9
+ const _excluded = ["displayCurrencySymbol"];
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
11
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
- const CurrencyField = props => {
12
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
13
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
14
+ const CurrencyField = _ref => {
15
+ let {
16
+ displayCurrencySymbol
17
+ } = _ref,
18
+ props = _objectWithoutProperties(_ref, _excluded);
12
19
  const {
13
20
  currencySymbol = 'R$'
14
21
  } = props;
15
- const leftElements = props.displayCurrencySymbol ? /*#__PURE__*/_react.default.createElement("span", {
22
+ const leftElements = displayCurrencySymbol ? /*#__PURE__*/_react.default.createElement("span", {
16
23
  className: "currency-symbol"
17
24
  }, currencySymbol) : [];
18
- return /*#__PURE__*/_react.default.createElement(_BaseNumber.default, _extends({}, props, {
25
+ return /*#__PURE__*/_react.default.createElement(_BaseNumber.default, _extends({
19
26
  leftElements: leftElements
20
- }));
27
+ }, props));
21
28
  };
22
29
  var _default = exports.default = CurrencyField;
@@ -4,6 +4,7 @@ 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
9
  declare const PopoverText: React__default.ForwardRefExoticComponent<PopoverTextProps & React__default.RefAttributes<HTMLParagraphElement>>;
9
10
 
@@ -4,6 +4,7 @@ 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
9
  declare const PopoverTitle: ({ children }: PopoverTitleProps) => JSX.Element;
9
10
 
@@ -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 _default: {
11
- (props: IPopoverProps): JSX.Element;
12
- displayName: string;
13
- };
11
+ declare const Popover: ({ children, align, theme, iconName, iconSize, iconColor, customClass, style, customStyle, ...rest }: IPopoverProps) => JSX.Element;
14
12
 
15
- export { _default as default };
13
+ export { Popover as default };
@@ -21,21 +21,26 @@ 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", "style", "customStyle"];
26
26
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
27
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
28
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
29
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
27
30
  const Popover = _ref => {
28
31
  let {
29
- children,
30
- align = 'left',
31
- theme = 'dark',
32
- iconName,
33
- iconSize = 16,
34
- iconColor = '',
35
- customClass = '',
36
- style
37
- } = _ref;
38
- return /*#__PURE__*/_react.default.createElement(_buttons.default, {
32
+ children,
33
+ align = 'left',
34
+ theme = 'dark',
35
+ iconName,
36
+ iconSize = 16,
37
+ iconColor = '',
38
+ customClass = '',
39
+ style,
40
+ customStyle
41
+ } = _ref,
42
+ rest = _objectWithoutProperties(_ref, _excluded);
43
+ return /*#__PURE__*/_react.default.createElement(_buttons.default, _extends({
39
44
  round: true,
40
45
  dropdown: true,
41
46
  transparent: true,
@@ -55,9 +60,10 @@ const Popover = _ref => {
55
60
  onClick: e => {
56
61
  e.preventDefault();
57
62
  }
58
- }, /*#__PURE__*/_react.default.createElement("div", {
59
- className: `${customClass} popovercontainer -${theme}`,
60
- "data-testid": "popover-container"
63
+ }, rest), /*#__PURE__*/_react.default.createElement("div", {
64
+ className: `popovercontainer -${theme} ${customClass}`,
65
+ "data-testid": "popover-container",
66
+ style: customStyle
61
67
  }, children));
62
68
  };
63
- var _default = exports.default = (0, _withDropdown.default)(Popover);
69
+ var _default = exports.default = Popover;
@@ -2,6 +2,7 @@ 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
  style?: CSSProperties;
22
33
  }
23
34
 
@@ -1,4 +1,4 @@
1
- import { I as ITreeTableRow } from '../types.d-73cece43.js';
1
+ import { I as ITreeTableRow } from '../types.d-b477e076.js';
2
2
  import 'react';
3
3
  import '../table/types.js';
4
4
 
@@ -37,7 +37,8 @@ const TreeRow = props => {
37
37
  leftToolbarElements,
38
38
  rightToolbarElements,
39
39
  styleForRightToolbar,
40
- toolbarElementsValidations
40
+ toolbarElementsValidations,
41
+ openNodeId
41
42
  } = (0, _react.useContext)(_helpers.TreeTableContext);
42
43
  const {
43
44
  rowId,
@@ -49,16 +50,17 @@ const TreeRow = props => {
49
50
  const [isLoadingChildrens, setIsLoadingChildrens] = (0, _react.useState)(false);
50
51
  const [showToolbarElements, setShowToolbarElements] = (0, _react.useState)(false);
51
52
  const [firstRenderingOfChildrens, setFirstRenderingOfChildrens] = (0, _react.useState)(false);
53
+ const divContainerRef = (0, _react.useRef)(null);
52
54
  const searchChildrensAndInsertState = () => {
53
55
  const dataChildrens = (0, _helpers.searchChildrensPerRow)(data, parentPropName, rowId, rowLevel);
54
56
  setChildrens(dataChildrens);
55
57
  setIsLoadingChildrens(false);
56
58
  };
57
- const handlerShowChildrens = async () => {
58
- if (!firstRenderingOfChildrens && !open && onClickGetChildrens) {
59
+ const handlerShowChildrens = () => {
60
+ if (!firstRenderingOfChildrens && !open) {
59
61
  setOpen(true);
60
62
  setIsLoadingChildrens(true);
61
- await onClickGetChildrens(rowId).then(() => {}).catch(() => {}).finally(() => {
63
+ if (onClickGetChildrens?.(rowId) && typeof onClickGetChildrens(rowId).finally === 'function') onClickGetChildrens(rowId).then(() => {}).catch(() => {}).finally(() => {
62
64
  searchChildrensAndInsertState();
63
65
  });
64
66
  setFirstRenderingOfChildrens(true);
@@ -121,23 +123,45 @@ const TreeRow = props => {
121
123
  }
122
124
  return newElementsWithNewProps;
123
125
  };
126
+ const handleOnMouseEnter = () => {
127
+ setShowToolbarElements(true);
128
+ };
129
+ const handlerMouseInsideDivContainer = event => {
130
+ const elementoAtual = document.elementFromPoint(event.clientX, event.clientY);
131
+ if (divContainerRef.current && !divContainerRef.current.contains(elementoAtual)) {
132
+ setShowToolbarElements(false);
133
+ }
134
+ };
124
135
  (0, _react.useEffect)(() => {
125
136
  searchChildrensAndInsertState();
126
137
  }, [data]);
127
138
  (0, _react.useEffect)(() => {
128
139
  setIsLoadingChildrens(false);
129
140
  }, [childrens]);
141
+ (0, _react.useEffect)(() => {
142
+ if (showToolbarElements) {
143
+ window.addEventListener('mousemove', handlerMouseInsideDivContainer);
144
+ } else {
145
+ window.removeEventListener('mousemove', handlerMouseInsideDivContainer);
146
+ }
147
+ return () => {
148
+ window.removeEventListener('mousemove', handlerMouseInsideDivContainer);
149
+ };
150
+ }, [showToolbarElements]);
151
+ (0, _react.useEffect)(() => {
152
+ if (openNodeId === Number(dataRow.id)) setOpen(true);
153
+ }, [openNodeId]);
130
154
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_table.TRow, _extends({}, props, {
131
155
  dataId: rowId,
132
- customClass: "tree-row-element",
133
- onMouseEnter: () => leftToolbarElements ? setShowToolbarElements(true) : null,
134
- onMouseLeave: () => setShowToolbarElements(false)
156
+ customClass: "tree-row-element"
135
157
  }), /*#__PURE__*/_react.default.createElement(_table.Td, {
136
158
  ignoreTableColClick: true,
137
159
  key: `td-${dataColumns[0].name}-${(0, _uuid.v1)()}`,
138
160
  style: dataColumns[0].style
139
161
  }, /*#__PURE__*/_react.default.createElement("div", {
140
- className: "column-container"
162
+ ref: divContainerRef,
163
+ className: "column-container",
164
+ onMouseEnter: handleOnMouseEnter
141
165
  }, /*#__PURE__*/_react.default.createElement("span", {
142
166
  className: `column-more-childrens ${rowLevel && 'line-path-decoration'}`,
143
167
  style: {
@@ -151,12 +175,11 @@ const TreeRow = props => {
151
175
  name: open ? 'down' : 'arrow_right',
152
176
  size: 10
153
177
  })), /*#__PURE__*/_react.default.createElement("span", {
154
- tabIndex: 0,
178
+ tabIndex: -1,
155
179
  role: "button",
156
- onKeyPress: undefined,
157
180
  className: "value-button",
158
181
  onClick: () => onClickFirstColumn ? onClickFirstColumn(rowId) : {}
159
- }, dataRow[dataColumns[0].name])), /*#__PURE__*/_react.default.createElement("span", {
182
+ }, dataRow[dataColumns[0].name]), /*#__PURE__*/_react.default.createElement("span", {
160
183
  className: "container-toolbar-buttons"
161
184
  }, /*#__PURE__*/_react.default.createElement(_toolbar.default, {
162
185
  size: "small",
@@ -167,7 +190,12 @@ const TreeRow = props => {
167
190
  float: 'left',
168
191
  height: 'fit-content'
169
192
  }, styleForLeftToolbar)
170
- }, showToolbarElements && leftToolbarElements && buildToolbarElements(leftToolbarElements)), /*#__PURE__*/_react.default.createElement(_toolbar.ToolBarGroup, {
193
+ }, showToolbarElements && leftToolbarElements && buildToolbarElements(leftToolbarElements))))), /*#__PURE__*/_react.default.createElement("span", {
194
+ className: "container-toolbar-info"
195
+ }, /*#__PURE__*/_react.default.createElement(_toolbar.default, {
196
+ size: "small",
197
+ customClass: "row-toolbar"
198
+ }, /*#__PURE__*/_react.default.createElement(_toolbar.ToolBarGroup, {
171
199
  key: `right-toolbar-${(0, _uuid.v1)()}`,
172
200
  style: _objectSpread({
173
201
  float: 'right',
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { a as ITreeTableProps } from '../types.d-73cece43.js';
2
+ import { a as ITreeTableProps } from '../types.d-b477e076.js';
3
3
  import '../table/types.js';
4
4
 
5
5
  declare const TreeTableContext: React.Context<ITreeTableProps>;
@@ -1,5 +1,5 @@
1
- import { a as ITreeTableProps } from '../types.d-73cece43.js';
2
- export { b as IRowElementsValidations, R as RowItem } from '../types.d-73cece43.js';
1
+ import { a as ITreeTableProps } from '../types.d-b477e076.js';
2
+ export { b as IRowElementsValidations, R as RowItem } from '../types.d-b477e076.js';
3
3
  import 'react';
4
4
  import '../table/types.js';
5
5
 
@@ -34,6 +34,7 @@ interface ITreeTableProps extends ITableProps {
34
34
  onClickFirstColumn?: (id?: string | number) => void;
35
35
  styleForRightToolbar?: CSSProperties;
36
36
  styleForLeftToolbar?: CSSProperties;
37
+ openNodeId?: number;
37
38
  }
38
39
 
39
40
  interface ITreeTableRow extends ITableRowProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-react-components-ui",
3
- "version": "1.1.20-beta.41",
3
+ "version": "1.1.20-beta.43",
4
4
  "description": "Linear Sistemas ReactJs Components",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.cjs",
@@ -18,7 +18,7 @@
18
18
  "publish:npm": "npm run lib && npm publish",
19
19
  "publish:npm:beta": "npm run lib && npm publish --tag beta",
20
20
  "publish:npm:rc": "npm run lib && npm publish --tag rc",
21
- "prepare": "husky install",
21
+ "prepare": "husky",
22
22
  "test": "jest --env=jsdom",
23
23
  "test:watch": "jest --watchAll --env=jsdom",
24
24
  "test:coverage": "jest --coverage --colors --env=jsdom"