linear-react-components-ui 1.1.20-beta.8 → 1.1.20-rc.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/alerts/BaseAlert.js +1 -1
- package/lib/alerts/Message.js +1 -1
- package/lib/assets/styles/effects.scss +0 -2
- package/lib/assets/styles/input.scss +2 -2
- package/lib/assets/styles/popover.scss +3 -0
- package/lib/assets/styles/select.scss +2 -1
- package/lib/assets/styles/treetable.scss +2 -2
- package/lib/assets/styles/treeview.scss +24 -8
- package/lib/assets/styles/wizard.scss +127 -0
- package/lib/avatar/index.js +9 -8
- package/lib/badge/index.js +4 -4
- package/lib/buttons/DangerButton.js +1 -1
- package/lib/buttons/DefaultButton.js +24 -4
- package/lib/buttons/InfoButton.js +1 -1
- package/lib/buttons/PrimaryButton.js +1 -1
- package/lib/buttons/SuccessButton.js +1 -1
- package/lib/buttons/WarningButton.js +1 -1
- package/lib/buttons/button_container/index.js +1 -1
- package/lib/buttons/split_button/index.js +1 -1
- package/lib/calendar/base/Day.js +1 -1
- package/lib/calendar/base/Month.js +1 -1
- package/lib/calendar/base/helpers.js +2 -2
- package/lib/calendar/base/index.js +1 -1
- package/lib/checkbox/index.js +46 -19
- package/lib/checkbox/types.d.ts +4 -0
- package/lib/dialog/Alert.js +6 -2
- package/lib/dialog/Custom.js +4 -2
- package/lib/dialog/Error.js +6 -2
- package/lib/dialog/Information.js +6 -2
- package/lib/dialog/Question.js +23 -5
- package/lib/dialog/Warning.js +6 -2
- package/lib/dialog/base/Content.d.ts +1 -1
- package/lib/dialog/base/Content.js +3 -2
- package/lib/dialog/base/Header.js +2 -2
- package/lib/dialog/base/index.js +12 -9
- package/lib/dialog/form/index.js +8 -3
- package/lib/dialog/types.d.ts +44 -4
- package/lib/dialog/wizard/index.d.ts +13 -0
- package/lib/dialog/wizard/index.js +78 -0
- package/lib/dialog/wizard/progressbar.d.ts +13 -0
- package/lib/dialog/wizard/progressbar.js +36 -0
- package/lib/dialog/wizard/step.d.ts +9 -0
- package/lib/dialog/wizard/step.js +22 -0
- package/lib/dialog/wizard/useWizard.d.ts +9 -0
- package/lib/dialog/wizard/useWizard.js +48 -0
- package/lib/drawer/Drawer.js +3 -3
- package/lib/drawer/Header.js +1 -1
- package/lib/dropdown/Popup.js +6 -6
- package/lib/dropdown/helper.js +1 -1
- package/lib/dropdown/withDropdown.js +2 -2
- package/lib/fieldset/index.js +7 -7
- package/lib/form/FieldArray.js +1 -1
- package/lib/form/FieldNumber.js +7 -10
- package/lib/form/FieldPeriod.js +2 -2
- package/lib/form/index.js +20 -15
- package/lib/form/types.d.ts +14 -1
- package/lib/gridlayout/GridCol.js +5 -5
- package/lib/gridlayout/GridRow.js +4 -1
- package/lib/hint/index.js +7 -1
- package/lib/icons/helper.d.ts +20 -0
- package/lib/icons/helper.js +20 -0
- package/lib/icons/index.js +24 -27
- package/lib/inputs/base/InputTextBase.js +39 -15
- package/lib/inputs/base/Label.js +1 -1
- package/lib/inputs/base/helpers.js +7 -3
- package/lib/inputs/base/types.d.ts +3 -0
- package/lib/inputs/color/types.d.ts +5 -0
- package/lib/inputs/date/helpers.js +4 -1
- package/lib/inputs/date/index.js +9 -15
- package/lib/inputs/date/types.d.ts +4 -0
- package/lib/inputs/errorMessage/index.js +1 -1
- package/lib/inputs/file/DefaultFile.js +5 -6
- package/lib/inputs/file/DragDropFile.js +17 -18
- package/lib/inputs/file/File.js +3 -4
- package/lib/inputs/file/types.d.ts +3 -0
- package/lib/inputs/mask/BaseMask.js +4 -1
- package/lib/inputs/mask/helpers.d.ts +4 -0
- package/lib/inputs/mask/types.d.ts +4 -0
- package/lib/inputs/multiSelect/Dropdown.js +9 -10
- package/lib/inputs/multiSelect/helper.js +1 -2
- package/lib/inputs/multiSelect/index.js +7 -9
- package/lib/inputs/multiSelect/types.d.ts +4 -0
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Decimal.d.ts +1 -1
- package/lib/inputs/number/index.d.ts +1 -1
- package/lib/inputs/number/index.js +8 -4
- package/lib/inputs/number/types.d.ts +14 -2
- package/lib/inputs/period/PeriodList.js +1 -1
- package/lib/inputs/period/helper.js +3 -1
- package/lib/inputs/period/index.js +40 -18
- package/lib/inputs/period/types.d.ts +3 -0
- package/lib/inputs/search/index.js +1 -1
- package/lib/inputs/select/Dropdown.js +1 -1
- package/lib/inputs/select/helper.js +10 -13
- package/lib/inputs/select/multiple/Selecteds.js +1 -1
- package/lib/inputs/select/multiple/index.js +22 -18
- package/lib/inputs/select/simple/index.js +15 -20
- package/lib/inputs/select/types.d.ts +7 -0
- package/lib/inputs/textarea/index.js +1 -1
- package/lib/internals/withTooltip.js +9 -9
- package/lib/labelMessages/index.js +4 -3
- package/lib/labels/DefaultLabel.js +4 -1
- package/lib/labels/label_container/index.js +1 -1
- package/lib/list/Header.d.ts +1 -0
- package/lib/list/Header.js +1 -1
- package/lib/list/Item.d.ts +6 -2
- package/lib/list/Item.js +36 -14
- package/lib/list/helpers.d.ts +1 -0
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +3 -2
- package/lib/list/types.d.ts +8 -1
- package/lib/menus/float/MenuItem.js +2 -2
- package/lib/menus/float/SubMenuContainer.js +1 -1
- package/lib/menus/float/index.js +1 -1
- package/lib/menus/sidenav/ExpandMenu.js +1 -1
- package/lib/menus/sidenav/NavMenuGroup.js +1 -1
- package/lib/menus/sidenav/NavMenuItem.js +27 -25
- package/lib/menus/sidenav/NavSubMenuItem.js +1 -1
- package/lib/menus/sidenav/helpers.js +1 -1
- package/lib/menus/sidenav/index.js +39 -31
- package/lib/menus/sidenav/types.d.ts +1 -0
- package/lib/panel/Content.js +5 -7
- package/lib/panel/Default.js +2 -2
- package/lib/panel/Header.js +3 -3
- package/lib/permissionValidations.js +1 -1
- package/lib/popover/index.js +4 -6
- package/lib/popover/types.d.ts +2 -1
- package/lib/progress/Bar.js +6 -6
- package/lib/radio/index.d.ts +1 -1
- package/lib/radio/index.js +36 -5
- package/lib/radio/types.d.ts +8 -1
- package/lib/shortcuts/index.js +1 -1
- package/lib/skeleton/SkeletonContainer.js +2 -1
- package/lib/skeleton/index.js +4 -1
- package/lib/spinner/index.js +2 -2
- package/lib/split/Split.js +1 -1
- package/lib/split/SplitSide.js +3 -3
- package/lib/table/Body.js +3 -3
- package/lib/table/Header.js +8 -11
- package/lib/table/HeaderColumn.js +7 -7
- package/lib/table/Row.js +3 -3
- package/lib/table/RowColumn.js +1 -1
- package/lib/table/index.js +6 -1
- package/lib/table/types.d.ts +0 -2
- package/lib/tabs/DropdownTabs.js +1 -1
- package/lib/tabs/Menu.js +1 -1
- package/lib/tabs/MenuTabs.js +2 -2
- package/lib/tabs/Panel.js +5 -7
- package/lib/tabs/context.js +3 -6
- package/lib/textContent/index.d.ts +18 -4
- package/lib/textContent/index.js +18 -6
- package/lib/toolbar/ButtonBar.js +1 -1
- package/lib/toolbar/index.js +1 -1
- package/lib/tooltip/index.js +7 -7
- package/lib/treetable/Body.js +1 -1
- package/lib/treetable/Header.js +2 -2
- package/lib/treetable/Row.d.ts +1 -1
- package/lib/treetable/Row.js +50 -25
- package/lib/treetable/helpers.d.ts +1 -1
- package/lib/treetable/index.d.ts +2 -2
- package/lib/treeview/Header.js +1 -1
- package/lib/treeview/Node.js +5 -5
- package/lib/treeview/index.js +4 -4
- package/lib/{types.d-73cece43.d.ts → types.d-b477e076.d.ts} +1 -0
- package/lib/uitour/index.js +6 -8
- package/package.json +2 -2
- package/lib/checkbox/Label.d.ts +0 -11
- package/lib/checkbox/Label.js +0 -31
- package/lib/inputs/mask/imaskHOC.js +0 -203
- package/lib/menus/sidenav/popup_menu_help/index.js +0 -85
- package/lib/tabs/DropdownItems.js +0 -62
- package/lib/tabs/MenuItems.js +0 -70
- package/lib/treeview_old/Header.js +0 -29
- package/lib/treeview_old/Node.js +0 -68
- package/lib/treeview_old/index.js +0 -43
|
@@ -33,7 +33,7 @@ const MultiSelectField = props => {
|
|
|
33
33
|
gridLayout,
|
|
34
34
|
dropdownAlignButton = 'left'
|
|
35
35
|
} = props;
|
|
36
|
-
const componentId =
|
|
36
|
+
const componentId = `multiSelect-component${uuid.v1()}`;
|
|
37
37
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
38
38
|
const [selecteds, setSelecteds] = (0, _react.useState)();
|
|
39
39
|
const [inputValue, setInputValue] = (0, _react.useState)('');
|
|
@@ -68,8 +68,8 @@ const MultiSelectField = props => {
|
|
|
68
68
|
};
|
|
69
69
|
const onMouseMove = event => {
|
|
70
70
|
const target = event.target;
|
|
71
|
-
if (
|
|
72
|
-
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target
|
|
71
|
+
if (target?.className === '') return;
|
|
72
|
+
const newInsideComponent = ['item', 'menubutton', 'filterinput', 'filtercontainer', 'label'].includes(target?.className);
|
|
73
73
|
setInsideComponent(newInsideComponent);
|
|
74
74
|
};
|
|
75
75
|
const onBlurComponent = e => {
|
|
@@ -109,11 +109,10 @@ const MultiSelectField = props => {
|
|
|
109
109
|
if (selectWrapper.current) setDropdownWidth(selectWrapper.current.clientWidth);
|
|
110
110
|
};
|
|
111
111
|
const onClickOutSide = event => {
|
|
112
|
-
var _componentRef$current;
|
|
113
112
|
const {
|
|
114
113
|
target
|
|
115
114
|
} = event;
|
|
116
|
-
if (target !== componentRef.current && !
|
|
115
|
+
if (target !== componentRef.current && !componentRef.current?.contains(target)) {
|
|
117
116
|
setOpened(false);
|
|
118
117
|
setDataCombo(dataSource);
|
|
119
118
|
setInputValue('');
|
|
@@ -139,8 +138,7 @@ const MultiSelectField = props => {
|
|
|
139
138
|
};
|
|
140
139
|
(0, _react.useEffect)(() => {
|
|
141
140
|
if (gridLayout) {
|
|
142
|
-
|
|
143
|
-
const currentGridEl = (_selectWrapper$curren = selectWrapper.current) === null || _selectWrapper$curren === void 0 ? void 0 : _selectWrapper$curren.parentElement;
|
|
141
|
+
const currentGridEl = selectWrapper.current?.parentElement;
|
|
144
142
|
if (currentGridEl) setElementStyles(window.getComputedStyle(currentGridEl));
|
|
145
143
|
}
|
|
146
144
|
window.addEventListener('resize', onScreenResize);
|
|
@@ -154,10 +152,10 @@ const MultiSelectField = props => {
|
|
|
154
152
|
}, []);
|
|
155
153
|
(0, _react.useEffect)(() => {
|
|
156
154
|
if (dataSource && dataSource.length > 0) {
|
|
157
|
-
const newSelecteds = dataSource.filter(item => value
|
|
155
|
+
const newSelecteds = dataSource.filter(item => value?.includes(item[idKey]));
|
|
158
156
|
setSelecteds(newSelecteds);
|
|
159
157
|
}
|
|
160
|
-
}, [value
|
|
158
|
+
}, [value?.length, dataSource?.length]);
|
|
161
159
|
(0, _react.useEffect)(() => {
|
|
162
160
|
if (dataSource && dataCombo && !_lodash.default.isEqual(dataSource, dataCombo)) {
|
|
163
161
|
const newDataCombo = (0, _helper.default)(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -56,6 +56,10 @@ interface IMultiSelectProps {
|
|
|
56
56
|
disabled?: boolean;
|
|
57
57
|
dropdownAlignButton?: 'left' | 'right';
|
|
58
58
|
label?: string;
|
|
59
|
+
hint?: string | string[];
|
|
60
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
61
|
+
themePopover?: 'light' | 'dark';
|
|
62
|
+
popoverAlign?: 'right' | 'left';
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
export { DescriptionKey, GetFilteredParams, IActionButtonsProps, IDropdownMultiSelectProps, IMultiSelectProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IBaseNumberProps } from './types.js';
|
|
2
|
+
import '../../@types/PermissionAttr.js';
|
|
2
3
|
import '../base/types.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import '../../@types/Align.js';
|
|
5
6
|
import '../../@types/Period.js';
|
|
6
|
-
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ICurrencyProps } from './types.js';
|
|
2
|
+
import '../../@types/PermissionAttr.js';
|
|
2
3
|
import '../base/types.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import '../../@types/Align.js';
|
|
5
6
|
import '../../@types/Period.js';
|
|
6
|
-
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IBaseNumberProps } from './types.js';
|
|
2
|
+
import '../../@types/PermissionAttr.js';
|
|
2
3
|
import '../base/types.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import '../../@types/Align.js';
|
|
5
6
|
import '../../@types/Period.js';
|
|
6
|
-
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../types.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { default as CurrencyField } from './Currency.js';
|
|
2
2
|
export { default as DecimalField } from './Decimal.js';
|
|
3
3
|
import { INumberFieldProps } from './types.js';
|
|
4
|
+
import '../../@types/PermissionAttr.js';
|
|
4
5
|
import '../base/types.js';
|
|
5
6
|
import 'react';
|
|
6
7
|
import '../../@types/Align.js';
|
|
7
8
|
import '../../@types/Period.js';
|
|
8
|
-
import '../../@types/PermissionAttr.js';
|
|
9
9
|
import '../../internals/types.js';
|
|
10
10
|
import '../../@types/Position.js';
|
|
11
11
|
import '../types.js';
|
|
@@ -28,10 +28,12 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
28
28
|
const NumberField = props => {
|
|
29
29
|
const {
|
|
30
30
|
textAlign = 'left',
|
|
31
|
-
min,
|
|
32
|
-
max,
|
|
33
31
|
value = '',
|
|
34
|
-
|
|
32
|
+
themePopover = 'light',
|
|
33
|
+
popoverAlign = 'left',
|
|
34
|
+
removeZeroLeft = true,
|
|
35
|
+
min,
|
|
36
|
+
max
|
|
35
37
|
} = props;
|
|
36
38
|
const [numberValue, setNumberValue] = (0, _react.useState)();
|
|
37
39
|
const onChange = event => {
|
|
@@ -48,11 +50,13 @@ const NumberField = props => {
|
|
|
48
50
|
if (props.onChange) props.onChange(event);
|
|
49
51
|
};
|
|
50
52
|
(0, _react.useEffect)(() => {
|
|
51
|
-
setNumberValue(value
|
|
53
|
+
setNumberValue(value?.toString() ?? '');
|
|
52
54
|
}, [value]);
|
|
53
55
|
return /*#__PURE__*/_react.default.createElement(_InputTextBase.default, _extends({}, props, {
|
|
54
56
|
value: numberValue,
|
|
55
57
|
textAlign: textAlign,
|
|
58
|
+
themePopover: themePopover,
|
|
59
|
+
popoverAlign: popoverAlign,
|
|
56
60
|
onChange: onChange,
|
|
57
61
|
type: "number"
|
|
58
62
|
}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { PermissionAttr } from '../../@types/PermissionAttr.js';
|
|
1
2
|
import { CustomInputEvent } from '../base/types.js';
|
|
2
3
|
import { IMaskHOCProps } from '../types.js';
|
|
4
|
+
import { TextAlign } from '../../@types/Align.js';
|
|
3
5
|
import 'react';
|
|
4
|
-
import '../../@types/Align.js';
|
|
5
6
|
import '../../@types/Period.js';
|
|
6
|
-
import '../../@types/PermissionAttr.js';
|
|
7
7
|
import '../../internals/types.js';
|
|
8
8
|
import '../../@types/Position.js';
|
|
9
9
|
import '../../@types/DataCombo.js';
|
|
@@ -12,8 +12,16 @@ import '../../@types/Icon.js';
|
|
|
12
12
|
import '../../icons/helper.js';
|
|
13
13
|
|
|
14
14
|
interface INumberFieldProps extends IMaskHOCProps {
|
|
15
|
+
value?: string;
|
|
16
|
+
permissionAttr?: PermissionAttr;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
hint?: string | string[];
|
|
19
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
20
|
+
themePopover?: 'light' | 'dark';
|
|
21
|
+
popoverAlign?: 'right' | 'left';
|
|
15
22
|
onChange?: (e?: CustomInputEvent) => void;
|
|
16
23
|
removeZeroLeft?: boolean;
|
|
24
|
+
textAlign?: TextAlign;
|
|
17
25
|
}
|
|
18
26
|
interface IBaseNumberProps extends IMaskHOCProps {
|
|
19
27
|
returnFormattedValueOnBlur?: boolean;
|
|
@@ -22,6 +30,10 @@ interface IBaseNumberProps extends IMaskHOCProps {
|
|
|
22
30
|
interface ICurrencyProps extends IMaskHOCProps {
|
|
23
31
|
currencySymbol?: string;
|
|
24
32
|
displayCurrencySymbol?: boolean;
|
|
33
|
+
hint?: string | string[];
|
|
34
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
35
|
+
themePopover?: 'light' | 'dark';
|
|
36
|
+
popoverAlign?: 'right' | 'left';
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
export { IBaseNumberProps, ICurrencyProps, INumberFieldProps };
|
|
@@ -42,7 +42,7 @@ const PeriodList = _ref => {
|
|
|
42
42
|
role: "button",
|
|
43
43
|
tabIndex: -1,
|
|
44
44
|
onKeyDown: () => {},
|
|
45
|
-
key:
|
|
45
|
+
key: `item-${item.id}`,
|
|
46
46
|
className: (0, _helper.getDropdownItemCssClass)(itemSelected),
|
|
47
47
|
onClick: () => {
|
|
48
48
|
const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
|
|
@@ -12,7 +12,9 @@ const getCalendarDropdownStyle = _ref => {
|
|
|
12
12
|
leftPosition,
|
|
13
13
|
width
|
|
14
14
|
} = _ref;
|
|
15
|
-
return
|
|
15
|
+
return `top: ${topPosition}px;
|
|
16
|
+
left: ${leftPosition}px;
|
|
17
|
+
width:${width}px`;
|
|
16
18
|
};
|
|
17
19
|
var _default = exports.default = getCalendarDropdownStyle;
|
|
18
20
|
const getDropdownItemCssClass = function () {
|
|
@@ -17,6 +17,8 @@ var _hint = _interopRequireDefault(require("../../hint"));
|
|
|
17
17
|
var helperBase = _interopRequireWildcard(require("../base/helpers"));
|
|
18
18
|
require("../../assets/styles/periodpicker.scss");
|
|
19
19
|
var _errorMessage = require("../errorMessage");
|
|
20
|
+
var _textContent = _interopRequireDefault(require("../../textContent"));
|
|
21
|
+
var _popover = _interopRequireDefault(require("../../popover"));
|
|
20
22
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
23
|
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); }
|
|
22
24
|
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; }
|
|
@@ -36,7 +38,10 @@ const PeriodPicker = props => {
|
|
|
36
38
|
width: '350px',
|
|
37
39
|
height: '350px'
|
|
38
40
|
},
|
|
39
|
-
hint
|
|
41
|
+
hint,
|
|
42
|
+
hintPosition = 'below',
|
|
43
|
+
themePopover = 'light',
|
|
44
|
+
popoverAlign = 'left'
|
|
40
45
|
} = props;
|
|
41
46
|
const [valueInitial, setValueInitial] = (0, _react.useState)(props.value && (0, _moment.default)(props.value.initial, 'DD/MM/YYYY'));
|
|
42
47
|
const [valueFinal, setValueFinal] = (0, _react.useState)(props.value && (0, _moment.default)(props.value.final, 'DD/MM/YYYY'));
|
|
@@ -55,8 +60,7 @@ const PeriodPicker = props => {
|
|
|
55
60
|
const dropdownPeriodContainer = (0, _react.useRef)(null);
|
|
56
61
|
const inputFinalRef = (0, _react.useRef)(null);
|
|
57
62
|
const onScreenResize = () => {
|
|
58
|
-
|
|
59
|
-
const inputDimensionsAux = inputContainerRef === null || inputContainerRef === void 0 ? void 0 : (_inputContainerRef$cu = inputContainerRef.current) === null || _inputContainerRef$cu === void 0 ? void 0 : _inputContainerRef$cu.getBoundingClientRect();
|
|
63
|
+
const inputDimensionsAux = inputContainerRef?.current?.getBoundingClientRect();
|
|
60
64
|
setInputDimensions(inputDimensionsAux);
|
|
61
65
|
};
|
|
62
66
|
const onClickOutside = event => {
|
|
@@ -159,12 +163,11 @@ const PeriodPicker = props => {
|
|
|
159
163
|
}
|
|
160
164
|
};
|
|
161
165
|
const setValue = function (event, value) {
|
|
162
|
-
var _inputInitialRef$curr, _inputFinalRef$curren;
|
|
163
166
|
let shouldOpenDropdown = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
164
167
|
const valueDateName = event ? event.target.name : '';
|
|
165
168
|
const dateObj = (0, _moment.default)(value, 'DD/MM/YYYY');
|
|
166
|
-
if (showCalendarValueInitial)
|
|
167
|
-
if (showCalendarValueFinal)
|
|
169
|
+
if (showCalendarValueInitial) inputInitialRef.current?.focus();
|
|
170
|
+
if (showCalendarValueFinal) inputFinalRef.current?.focus();
|
|
168
171
|
if (valueDateName === 'valueFinal' && valueInitial && dateObj.isBefore(valueInitial)) {
|
|
169
172
|
setValueInitial(dateObj);
|
|
170
173
|
setValueFinal(valueInitial);
|
|
@@ -193,8 +196,7 @@ const PeriodPicker = props => {
|
|
|
193
196
|
});
|
|
194
197
|
}
|
|
195
198
|
if (valueDateName === 'valueInitial' && !valueFinal && shouldOpenDropdown) {
|
|
196
|
-
|
|
197
|
-
(_inputFinalRef$curren2 = inputFinalRef.current) === null || _inputFinalRef$curren2 === void 0 ? void 0 : _inputFinalRef$curren2.focus();
|
|
199
|
+
inputFinalRef.current?.focus();
|
|
198
200
|
setTimeout(() => setShowCalendarValueFinal(true), 100);
|
|
199
201
|
}
|
|
200
202
|
if (shouldCloseOnSelect) {
|
|
@@ -217,8 +219,7 @@ const PeriodPicker = props => {
|
|
|
217
219
|
name: "calendar"
|
|
218
220
|
}),
|
|
219
221
|
onClick: () => {
|
|
220
|
-
|
|
221
|
-
(_inputInitialRef$curr2 = inputInitialRef.current) === null || _inputInitialRef$curr2 === void 0 ? void 0 : _inputInitialRef$curr2.focus();
|
|
222
|
+
inputInitialRef.current?.focus();
|
|
222
223
|
openCalendar('valueInitial');
|
|
223
224
|
},
|
|
224
225
|
customClass: "calendar-button",
|
|
@@ -269,8 +270,7 @@ const PeriodPicker = props => {
|
|
|
269
270
|
});
|
|
270
271
|
const setPeriodDates = (selected, dates) => {
|
|
271
272
|
if (selected === 'custom') {
|
|
272
|
-
|
|
273
|
-
(_inputInitialRef$curr3 = inputInitialRef.current) === null || _inputInitialRef$curr3 === void 0 ? void 0 : _inputInitialRef$curr3.focus();
|
|
273
|
+
inputInitialRef.current?.focus();
|
|
274
274
|
setValuePeriodSelection(selected);
|
|
275
275
|
setShowPeriodSelection(false);
|
|
276
276
|
return;
|
|
@@ -343,15 +343,37 @@ const PeriodPicker = props => {
|
|
|
343
343
|
className: "input-base-component"
|
|
344
344
|
}, props.label && /*#__PURE__*/_react.default.createElement("div", {
|
|
345
345
|
className: "labelcontainer"
|
|
346
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
347
|
-
|
|
346
|
+
}, /*#__PURE__*/_react.default.createElement(_textContent.default, {
|
|
347
|
+
required: props.required,
|
|
348
|
+
className: props.customClassForLabel,
|
|
349
|
+
labelUppercase: props.labelUppercase
|
|
350
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
351
|
+
className: "text-content",
|
|
352
|
+
style: {
|
|
353
|
+
display: 'flex'
|
|
354
|
+
}
|
|
355
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
356
|
+
className: `label ${props.customClassForLabel} ${props.labelUppercase && ' -uppercase'}`,
|
|
357
|
+
style: {
|
|
358
|
+
alignSelf: 'center'
|
|
359
|
+
}
|
|
348
360
|
}, props.label, props.required && /*#__PURE__*/_react.default.createElement("span", {
|
|
349
361
|
className: "-requiredlabel"
|
|
350
|
-
}, "*")
|
|
351
|
-
|
|
362
|
+
}, "*"), !!hint && hintPosition === 'onLabelRight' && /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
363
|
+
theme: themePopover,
|
|
364
|
+
align: popoverAlign,
|
|
365
|
+
iconColor: "#03bde2",
|
|
366
|
+
customClass: "-hint",
|
|
367
|
+
style: {
|
|
368
|
+
margin: '0px 5px',
|
|
369
|
+
height: 'auto',
|
|
370
|
+
width: 20
|
|
371
|
+
}
|
|
372
|
+
}, hint))), /*#__PURE__*/_react.default.createElement(_textContent.default, null)), /*#__PURE__*/_react.default.createElement("div", {
|
|
373
|
+
className: `periodpicker-component ${helperBase.getInputWrapperClass(_objectSpread(_objectSpread({}, props), {}, {
|
|
352
374
|
value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
|
|
353
375
|
disabled: shouldDisable()
|
|
354
|
-
}))
|
|
376
|
+
}))}`,
|
|
355
377
|
ref: inputContainerRef
|
|
356
378
|
}, /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
|
|
357
379
|
permissionAttr: props.permissionAttr,
|
|
@@ -391,7 +413,7 @@ const PeriodPicker = props => {
|
|
|
391
413
|
handlerSetOnDenied: denied => setOnDenied(denied),
|
|
392
414
|
required: props.required
|
|
393
415
|
}), getButtonOpen(), getButtonSelectPeriod()), showCalendarValueInitial && getWrapperComponentCalendarValueInitial(), showCalendarValueFinal && getWrapperComponentCalendarValueFinal(), showPeriodSelection && getWrapperComponentPeriodSelection(), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
394
|
-
visible: !!hint,
|
|
416
|
+
visible: !!hint && hintPosition === 'below',
|
|
395
417
|
customClass: "hint",
|
|
396
418
|
description: hint
|
|
397
419
|
}), /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
|
|
@@ -59,8 +59,11 @@ interface IPeriodPickerProps {
|
|
|
59
59
|
errorMessages?: string[];
|
|
60
60
|
name?: string;
|
|
61
61
|
hint?: string;
|
|
62
|
+
hintPosition?: 'below' | 'onLabelRight';
|
|
62
63
|
onBlur?: (e: CustomInputEvent) => void;
|
|
63
64
|
onFocus?: (e: CustomInputEvent) => void;
|
|
65
|
+
themePopover?: 'light' | 'dark';
|
|
66
|
+
popoverAlign?: 'right' | 'left';
|
|
64
67
|
}
|
|
65
68
|
interface IPeriodListProps {
|
|
66
69
|
handleOnSelect: (value: DateTypes | 'custom', date: Moment[] | null) => void;
|
|
@@ -49,7 +49,7 @@ const SearchField = props => {
|
|
|
49
49
|
};
|
|
50
50
|
const shouldDisable = () => props.disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
|
|
51
51
|
const shouldBeReadOnly = () => props.readOnly || onDenied && onDenied.readOnly;
|
|
52
|
-
const hideContent = onDenied
|
|
52
|
+
const hideContent = onDenied?.hideContent;
|
|
53
53
|
const buttonProps = () => {
|
|
54
54
|
const disableCallbacks = shouldBeReadOnly() || shouldDisable() || hideContent;
|
|
55
55
|
let propsButton = {
|
|
@@ -80,7 +80,7 @@ const Dropdown = props => {
|
|
|
80
80
|
const disabled = currents && currents.length > 0 ? currents.some(s => s[idKey] === item[idKey]) : false;
|
|
81
81
|
const itemSelected = Boolean(selected && selected[idKey] === item[idKey]);
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
83
|
-
key:
|
|
83
|
+
key: `dropdowmIten ${item[idKey]}}`,
|
|
84
84
|
className: helper.getDropdownItemCssClass(itemSelected, disabled, striped)
|
|
85
85
|
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
86
86
|
className: "menubutton",
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.returnDropdownDynamicStyles = exports.getFilteredSimpleDataCombo = exports.getFilteredMultipleDataCombo = exports.getDropdownItemCssClass = exports.contentClass = void 0;
|
|
7
|
-
const contentClass = props =>
|
|
7
|
+
const contentClass = props => `content ${props.showClearButton ? '' : 'noclear'}`;
|
|
8
8
|
exports.contentClass = contentClass;
|
|
9
9
|
const getDropdownItemCssClass = (selected, disabled, striped) => {
|
|
10
10
|
let className = 'item';
|
|
@@ -21,12 +21,10 @@ const getFilteredSimpleDataCombo = _ref => {
|
|
|
21
21
|
inputText
|
|
22
22
|
} = _ref;
|
|
23
23
|
return dataSource && dataSource.filter(item => {
|
|
24
|
-
var _descriptionKey;
|
|
25
24
|
if (typeof descriptionKey === 'string') {
|
|
26
|
-
|
|
27
|
-
return ((_item$descriptionKey = item[descriptionKey]) === null || _item$descriptionKey === void 0 ? void 0 : _item$descriptionKey.toLowerCase().indexOf(inputText === null || inputText === void 0 ? void 0 : inputText.toString().toLowerCase())) > -1;
|
|
25
|
+
return item[descriptionKey]?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1;
|
|
28
26
|
}
|
|
29
|
-
return
|
|
27
|
+
return descriptionKey(item)?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1;
|
|
30
28
|
});
|
|
31
29
|
};
|
|
32
30
|
exports.getFilteredSimpleDataCombo = getFilteredSimpleDataCombo;
|
|
@@ -38,11 +36,10 @@ const getFilteredMultipleDataCombo = _ref2 => {
|
|
|
38
36
|
currents
|
|
39
37
|
} = _ref2;
|
|
40
38
|
return dataSource.filter(item => {
|
|
41
|
-
var _descriptionKey2;
|
|
42
39
|
if (typeof descriptionKey === 'string') {
|
|
43
|
-
return item[descriptionKey].toLowerCase().indexOf(inputText
|
|
40
|
+
return item[descriptionKey].toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
44
41
|
}
|
|
45
|
-
return
|
|
42
|
+
return descriptionKey(item)?.toLowerCase().indexOf(inputText?.toString().toLowerCase()) > -1 && !currents.includes(item);
|
|
46
43
|
});
|
|
47
44
|
};
|
|
48
45
|
exports.getFilteredMultipleDataCombo = getFilteredMultipleDataCombo;
|
|
@@ -54,7 +51,7 @@ const returnDropdownPosition = function (_ref3) {
|
|
|
54
51
|
} = _ref3;
|
|
55
52
|
let aboveDropdown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
56
53
|
const DEFAULT_MARGIN_BOTTOM = 10;
|
|
57
|
-
if (aboveDropdown && dropdownRef
|
|
54
|
+
if (aboveDropdown && dropdownRef?.current && dropdownRects?.height) {
|
|
58
55
|
return selectFieldRects.top + window.scrollY - (dropdownRef.current && dropdownRects.height) - DEFAULT_MARGIN_BOTTOM;
|
|
59
56
|
}
|
|
60
57
|
return selectFieldRects.top + window.scrollY + selectFieldRects.height;
|
|
@@ -65,10 +62,10 @@ const returnDropdownDynamicStyles = _ref4 => {
|
|
|
65
62
|
dropdownMaxHeight,
|
|
66
63
|
dropdownRef
|
|
67
64
|
} = _ref4;
|
|
68
|
-
const selectFieldRects = selectFieldRef
|
|
69
|
-
const dropdownRects = dropdownRef
|
|
70
|
-
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects
|
|
71
|
-
const selectFieldRectsTop = selectFieldRects ? selectFieldRects
|
|
65
|
+
const selectFieldRects = selectFieldRef?.current ? selectFieldRef.current.getBoundingClientRect() : undefined;
|
|
66
|
+
const dropdownRects = dropdownRef?.current ? dropdownRef.current.getBoundingClientRect() : undefined;
|
|
67
|
+
const selectFieldRectsBottom = selectFieldRects ? selectFieldRects?.bottom : 0;
|
|
68
|
+
const selectFieldRectsTop = selectFieldRects ? selectFieldRects?.top : 0;
|
|
72
69
|
const dropdownBottomDistance = window.innerHeight - selectFieldRectsBottom;
|
|
73
70
|
const bottomOffset = 30;
|
|
74
71
|
let maxDropdownBottomDistance = 200;
|
|
@@ -15,7 +15,7 @@ const Selecteds = _ref => {
|
|
|
15
15
|
} = _ref;
|
|
16
16
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currents.map(selected => /*#__PURE__*/_react.default.createElement("div", {
|
|
17
17
|
className: "selecteditem",
|
|
18
|
-
key:
|
|
18
|
+
key: `selected-${selected[idKey]}`
|
|
19
19
|
}, typeof descriptionKey === 'string' ? selected[descriptionKey] : descriptionKey(selected), /*#__PURE__*/_react.default.createElement("button", {
|
|
20
20
|
className: "close",
|
|
21
21
|
tabIndex: -1,
|
|
@@ -13,6 +13,7 @@ var _Selecteds = _interopRequireDefault(require("./Selecteds"));
|
|
|
13
13
|
var constants = _interopRequireWildcard(require("../../../internals/constants"));
|
|
14
14
|
var _InputTextBase = _interopRequireDefault(require("../../base/InputTextBase"));
|
|
15
15
|
var _helper = require("../helper");
|
|
16
|
+
var _hint = _interopRequireDefault(require("../../../hint"));
|
|
16
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
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); }
|
|
18
19
|
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; }
|
|
@@ -25,7 +26,10 @@ const MultipleSelect = props => {
|
|
|
25
26
|
value = [],
|
|
26
27
|
remoteSearch = false,
|
|
27
28
|
descriptionKey,
|
|
28
|
-
showClearButton
|
|
29
|
+
showClearButton,
|
|
30
|
+
rightElements = [],
|
|
31
|
+
hint,
|
|
32
|
+
hintPosition = 'below'
|
|
29
33
|
} = props;
|
|
30
34
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
31
35
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -36,7 +40,7 @@ const MultipleSelect = props => {
|
|
|
36
40
|
const [insideComponent, setInsideComponent] = (0, _react.useState)(false);
|
|
37
41
|
const [onDenied, setOnDeniedSelect] = (0, _react.useState)();
|
|
38
42
|
const [valueFromProps, setValueFromProps] = (0, _react.useState)([]);
|
|
39
|
-
const componentId =
|
|
43
|
+
const componentId = `select-component${uuid.v1()}`;
|
|
40
44
|
const componentRef = (0, _react.useRef)(null);
|
|
41
45
|
const dropdownRef = (0, _react.useRef)(null);
|
|
42
46
|
const selectWrapper = (0, _react.useRef)();
|
|
@@ -56,11 +60,10 @@ const MultipleSelect = props => {
|
|
|
56
60
|
}
|
|
57
61
|
};
|
|
58
62
|
const onMouseMove = event => {
|
|
59
|
-
var _dropdownRef$current, _dropdownRef$current$;
|
|
60
63
|
const target = event.target;
|
|
61
|
-
const idDropdown =
|
|
64
|
+
const idDropdown = dropdownRef.current?.parentElement?.id || '';
|
|
62
65
|
const dropdownElement = document.getElementById(idDropdown);
|
|
63
|
-
const keepDropdownOpen = Boolean(dropdownElement
|
|
66
|
+
const keepDropdownOpen = Boolean(dropdownElement?.contains(target));
|
|
64
67
|
setInsideComponent(keepDropdownOpen);
|
|
65
68
|
};
|
|
66
69
|
const onClearClick = () => {
|
|
@@ -97,7 +100,6 @@ const MultipleSelect = props => {
|
|
|
97
100
|
setDropdownWidth(dropdownWidthFocus);
|
|
98
101
|
};
|
|
99
102
|
const onSelect = select => {
|
|
100
|
-
var _dropdownRef$current2;
|
|
101
103
|
if (select === null) return;
|
|
102
104
|
const currentsSelect = [...currents, select];
|
|
103
105
|
setCurrents(currentsSelect);
|
|
@@ -105,17 +107,16 @@ const MultipleSelect = props => {
|
|
|
105
107
|
setInputValue([]);
|
|
106
108
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
107
109
|
if (props.onSelect) setSelected(props.onSelect(currentsSelect.map(i => i[idKey])));
|
|
108
|
-
|
|
110
|
+
dropdownRef.current?.focus();
|
|
109
111
|
};
|
|
110
112
|
const onUnselect = id => {
|
|
111
113
|
if (currents) {
|
|
112
|
-
var _dropdownRef$current3;
|
|
113
114
|
const result = currents.filter(item => item[idKey] !== id);
|
|
114
115
|
setCurrents(result);
|
|
115
116
|
if (inputTextRef && inputTextRef.current) inputTextRef.current.focus();
|
|
116
117
|
setOpened(false);
|
|
117
118
|
if (props.onSelect) setSelected(props.onSelect(result.map(i => i[idKey])));
|
|
118
|
-
|
|
119
|
+
dropdownRef.current?.focus();
|
|
119
120
|
}
|
|
120
121
|
};
|
|
121
122
|
const onOpenClose = () => {
|
|
@@ -132,11 +133,9 @@ const MultipleSelect = props => {
|
|
|
132
133
|
const onInputKeyDown = e => {
|
|
133
134
|
if (e.keyCode) {
|
|
134
135
|
if (e.keyCode === constants.keyCodes.ENTER && selected && opened) {
|
|
135
|
-
|
|
136
|
-
(_e$preventDefault = e.preventDefault) === null || _e$preventDefault === void 0 ? void 0 : _e$preventDefault.call(e);
|
|
136
|
+
e.preventDefault?.();
|
|
137
137
|
if (!currents.some(current => current[idKey] === selected[idKey])) {
|
|
138
|
-
|
|
139
|
-
(_e$preventDefault2 = e.preventDefault) === null || _e$preventDefault2 === void 0 ? void 0 : _e$preventDefault2.call(e);
|
|
138
|
+
e.preventDefault?.();
|
|
140
139
|
onSelect(selected);
|
|
141
140
|
}
|
|
142
141
|
} else if ([constants.keyCodes.ARROW_UP, constants.keyCodes.ARROW_DOWN].includes(e.keyCode)) {
|
|
@@ -182,7 +181,7 @@ const MultipleSelect = props => {
|
|
|
182
181
|
}, []);
|
|
183
182
|
(0, _react.useEffect)(() => {
|
|
184
183
|
if (props.gridLayout) {
|
|
185
|
-
const gridEl = document.querySelector(
|
|
184
|
+
const gridEl = document.querySelector(`#${componentId}>.-withinput.grid-container`);
|
|
186
185
|
if (gridElRef.current !== gridEl && gridEl) gridElRef.current = gridEl;
|
|
187
186
|
}
|
|
188
187
|
}, []);
|
|
@@ -234,13 +233,14 @@ const MultipleSelect = props => {
|
|
|
234
233
|
},
|
|
235
234
|
onClick: onFocus,
|
|
236
235
|
onKeyDown: onInputKeyDown,
|
|
237
|
-
customClassForWrapper:
|
|
236
|
+
customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'}`,
|
|
238
237
|
customClassForInputContent: "multiselect",
|
|
239
238
|
inputBaseRef: r => {
|
|
240
239
|
selectWrapper.current = r;
|
|
241
240
|
},
|
|
242
241
|
handlerSetOnDenied: setOnDenied,
|
|
243
|
-
rightElements: /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
242
|
+
rightElements: [...rightElements, /*#__PURE__*/_react.default.createElement(_ActionButtons.default, {
|
|
243
|
+
key: "action-buttons-multiselect",
|
|
244
244
|
showClearButton: showClearButton,
|
|
245
245
|
disabled: shouldDisable() || shouldBeReadOnly(),
|
|
246
246
|
dropDownOpened: opened,
|
|
@@ -249,7 +249,7 @@ const MultipleSelect = props => {
|
|
|
249
249
|
return onClearClick();
|
|
250
250
|
},
|
|
251
251
|
handlerOpenClose: onOpenClose
|
|
252
|
-
})
|
|
252
|
+
})]
|
|
253
253
|
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, props, {
|
|
254
254
|
currents: currents,
|
|
255
255
|
handlerOnUnselect: onUnselect
|
|
@@ -267,6 +267,10 @@ const MultipleSelect = props => {
|
|
|
267
267
|
dataCombo: dataCombo,
|
|
268
268
|
currents: currents,
|
|
269
269
|
dropdownWidth: dropdownWidth || 0
|
|
270
|
-
}))
|
|
270
|
+
})), /*#__PURE__*/_react.default.createElement(_hint.default, {
|
|
271
|
+
visible: !!hint && hintPosition === 'below',
|
|
272
|
+
customClass: "hint",
|
|
273
|
+
description: hint
|
|
274
|
+
}));
|
|
271
275
|
};
|
|
272
276
|
var _default = exports.default = MultipleSelect;
|