linear-react-components-ui 1.1.21-beta.3 → 1.1.21-beta.5
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/calendar.scss +64 -30
- package/lib/assets/styles/datepicker.scss +26 -6
- package/lib/assets/styles/periodpicker.scss +60 -20
- package/lib/assets/styles/sidenav.scss +1 -1
- package/lib/assets/styles/tabs.scss +48 -18
- package/lib/buttons/DefaultButton.js +6 -3
- package/lib/buttons/types.d.ts +1 -0
- package/lib/calendar/DangerCalendar.d.ts +1 -0
- package/lib/calendar/InfoCalendar.d.ts +1 -0
- package/lib/calendar/PrimaryCalendar.d.ts +1 -0
- package/lib/calendar/SuccessCalendar.d.ts +1 -0
- package/lib/calendar/WarningCalendar.d.ts +1 -0
- package/lib/calendar/base/Day.d.ts +1 -0
- package/lib/calendar/base/Day.js +6 -2
- package/lib/calendar/base/Month.d.ts +2 -1
- package/lib/calendar/base/Month.js +2 -0
- package/lib/calendar/base/Week.d.ts +1 -0
- package/lib/calendar/base/index.d.ts +1 -0
- package/lib/calendar/base/index.js +61 -13
- package/lib/calendar/index.d.ts +1 -0
- package/lib/calendar/types.d.ts +5 -0
- package/lib/dialog/base/Content.js +5 -4
- package/lib/dialog/base/Header.js +0 -1
- package/lib/dialog/base/index.js +26 -3
- package/lib/drawer/Drawer.js +1 -1
- package/lib/dropdown/Popup.d.ts +2 -2
- package/lib/dropdown/Popup.js +38 -17
- package/lib/dropdown/types.d.ts +7 -3
- package/lib/dropdown/withDropdown.js +5 -4
- package/lib/form/Field.js +11 -2
- package/lib/form/FieldArray.js +11 -2
- package/lib/form/FieldNumber.js +10 -1
- package/lib/form/FieldPeriod.js +15 -12
- package/lib/form/index.d.ts +1 -1
- package/lib/form/index.js +30 -5
- package/lib/form/types.d.ts +13 -1
- package/lib/form/withFieldHOC.js +4 -2
- package/lib/inputs/base/InputTextBase.js +9 -2
- package/lib/inputs/base/types.d.ts +2 -0
- package/lib/inputs/date/Dialog.js +5 -4
- package/lib/inputs/date/Dropdown.js +13 -7
- package/lib/inputs/date/helpers.d.ts +31 -11
- package/lib/inputs/date/helpers.js +32 -15
- package/lib/inputs/date/index.js +142 -102
- package/lib/inputs/date/types.d.ts +8 -6
- package/lib/inputs/mask/BaseMask.d.ts +1 -1
- package/lib/inputs/mask/BaseMask.js +6 -4
- package/lib/inputs/mask/helpers.d.ts +6 -53
- package/lib/inputs/mask/helpers.js +15 -35
- package/lib/inputs/mask/types.d.ts +1 -0
- package/lib/inputs/number/BaseNumber.d.ts +1 -1
- package/lib/inputs/number/BaseNumber.js +9 -2
- package/lib/inputs/number/Currency.d.ts +1 -1
- package/lib/inputs/number/Currency.js +11 -4
- package/lib/inputs/period/Dialog.d.ts +1 -1
- package/lib/inputs/period/Dialog.js +5 -3
- package/lib/inputs/period/Dropdown.js +16 -8
- package/lib/inputs/period/PeriodList.js +3 -12
- package/lib/inputs/period/index.js +210 -74
- package/lib/inputs/period/types.d.ts +10 -8
- package/lib/inputs/select/ActionButtons.js +3 -2
- package/lib/inputs/select/Dropdown.js +4 -2
- package/lib/inputs/select/multiple/index.js +10 -4
- package/lib/inputs/select/simple/index.js +10 -4
- package/lib/inputs/select/types.d.ts +4 -0
- package/lib/inputs/types.d.ts +1 -0
- package/lib/popover/PopoverText.d.ts +1 -0
- package/lib/popover/PopoverTitle.d.ts +1 -0
- package/lib/popover/index.d.ts +3 -5
- package/lib/popover/index.js +21 -15
- package/lib/popover/types.d.ts +11 -0
- package/lib/tabs/DropdownTabs.js +21 -7
- package/lib/tabs/Menu.d.ts +1 -1
- package/lib/tabs/Menu.js +4 -2
- package/lib/tabs/MenuTabs.js +16 -5
- package/lib/tabs/context.d.ts +1 -1
- package/lib/tabs/context.js +6 -4
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +13 -6
- package/lib/tabs/types.d.ts +8 -1
- package/lib/toolbar/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -37,7 +37,8 @@ const Dropdown = props => {
|
|
|
37
37
|
searchOnDropdown,
|
|
38
38
|
handleOnKeydown,
|
|
39
39
|
searchNotFoundText,
|
|
40
|
-
idKey
|
|
40
|
+
idKey,
|
|
41
|
+
selectFieldRef
|
|
41
42
|
} = props;
|
|
42
43
|
const [dropdownDynamicStyles, setDropdownDynamicStyles] = (0, _react.useState)(helper.returnDropdownDynamicStyles(_objectSpread({}, props)));
|
|
43
44
|
(0, _react.useEffect)(() => {
|
|
@@ -48,7 +49,8 @@ const Dropdown = props => {
|
|
|
48
49
|
return /*#__PURE__*/_react.default.createElement(_Popup.default, {
|
|
49
50
|
align: "left",
|
|
50
51
|
leftPosition: dropdownDynamicStyles.left,
|
|
51
|
-
topPosition: dropdownDynamicStyles.top
|
|
52
|
+
topPosition: dropdownDynamicStyles.top,
|
|
53
|
+
targetRef: selectFieldRef?.current
|
|
52
54
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
53
55
|
className: "select-dropdown",
|
|
54
56
|
ref: dropdownRef,
|
|
@@ -29,7 +29,11 @@ const MultipleSelect = props => {
|
|
|
29
29
|
showClearButton,
|
|
30
30
|
rightElements = [],
|
|
31
31
|
hint,
|
|
32
|
-
hintPosition = 'below'
|
|
32
|
+
hintPosition = 'below',
|
|
33
|
+
customClassForLabel,
|
|
34
|
+
customClassForWrapper,
|
|
35
|
+
customClassForInputContent,
|
|
36
|
+
customClassForSideButtons
|
|
33
37
|
} = props;
|
|
34
38
|
const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
|
|
35
39
|
const [currents, setCurrents] = (0, _react.useState)([]);
|
|
@@ -233,8 +237,9 @@ const MultipleSelect = props => {
|
|
|
233
237
|
},
|
|
234
238
|
onClick: onFocus,
|
|
235
239
|
onKeyDown: onInputKeyDown,
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
customClassForLabel: customClassForLabel,
|
|
241
|
+
customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'} ${customClassForWrapper}`,
|
|
242
|
+
customClassForInputContent: `multiselect ${customClassForInputContent}`,
|
|
238
243
|
inputBaseRef: r => {
|
|
239
244
|
selectWrapper.current = r;
|
|
240
245
|
},
|
|
@@ -248,7 +253,8 @@ const MultipleSelect = props => {
|
|
|
248
253
|
if (shouldDisable()) return null;
|
|
249
254
|
return onClearClick();
|
|
250
255
|
},
|
|
251
|
-
handlerOpenClose: onOpenClose
|
|
256
|
+
handlerOpenClose: onOpenClose,
|
|
257
|
+
customClassForSideButtons: customClassForSideButtons
|
|
252
258
|
})]
|
|
253
259
|
}), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, props, {
|
|
254
260
|
currents: currents,
|
|
@@ -35,7 +35,11 @@ const SimpleSelect = props => {
|
|
|
35
35
|
allOptions = undefined,
|
|
36
36
|
showClearButton = false,
|
|
37
37
|
searchNotFoundText,
|
|
38
|
-
rightElements = []
|
|
38
|
+
rightElements = [],
|
|
39
|
+
customClassForWrapper,
|
|
40
|
+
customClassForInputContent,
|
|
41
|
+
customClassForLabel,
|
|
42
|
+
customClassForSideButtons
|
|
39
43
|
} = props;
|
|
40
44
|
const descriptionKeyIsString = typeof descriptionKey === 'string';
|
|
41
45
|
const dataSourceWithAllOptions = allOptions ? [{
|
|
@@ -262,8 +266,9 @@ const SimpleSelect = props => {
|
|
|
262
266
|
},
|
|
263
267
|
onClick: onFocus,
|
|
264
268
|
onKeyDown: onInputKeyDown,
|
|
265
|
-
|
|
266
|
-
|
|
269
|
+
customClassForLabel: customClassForLabel,
|
|
270
|
+
customClassForWrapper: `selectwrapper ${(undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'} ${customClassForWrapper}`,
|
|
271
|
+
customClassForInputContent: `multiselect ${customClassForInputContent}`,
|
|
267
272
|
inputBaseRef: r => {
|
|
268
273
|
selectWrapper.current = r;
|
|
269
274
|
},
|
|
@@ -277,7 +282,8 @@ const SimpleSelect = props => {
|
|
|
277
282
|
if (shouldDisable()) return null;
|
|
278
283
|
return onClearClick();
|
|
279
284
|
},
|
|
280
|
-
handlerOpenClose: onOpenClose
|
|
285
|
+
handlerOpenClose: onOpenClose,
|
|
286
|
+
customClassForSideButtons: customClassForSideButtons
|
|
281
287
|
})]
|
|
282
288
|
})), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
|
|
283
289
|
opened: opened,
|
|
@@ -50,6 +50,10 @@ interface ISimpleSelectProps {
|
|
|
50
50
|
onFocus?: () => void;
|
|
51
51
|
allOptions?: AllOptions;
|
|
52
52
|
inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
|
|
53
|
+
customClassForWrapper?: string;
|
|
54
|
+
customClassForInputContent?: string;
|
|
55
|
+
customClassForLabel?: string;
|
|
56
|
+
customClassForSideButtons?: string;
|
|
53
57
|
rightElements?: JSX.Element[];
|
|
54
58
|
hintPosition?: 'below' | 'onLabelRight';
|
|
55
59
|
themePopover?: 'light' | 'dark';
|
package/lib/inputs/types.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ interface IActionButtonsSelectProps {
|
|
|
137
137
|
dropDownOpened: boolean;
|
|
138
138
|
showClearButton?: boolean;
|
|
139
139
|
disabled?: boolean;
|
|
140
|
+
customClassForSideButtons?: string;
|
|
140
141
|
}
|
|
141
142
|
interface IButtonsProps {
|
|
142
143
|
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
@@ -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
|
|
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, style, customStyle, ...rest }: IPopoverProps) => JSX.Element;
|
|
14
12
|
|
|
15
|
-
export {
|
|
13
|
+
export { Popover as default };
|
package/lib/popover/index.js
CHANGED
|
@@ -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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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:
|
|
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 =
|
|
69
|
+
var _default = exports.default = Popover;
|
package/lib/popover/types.d.ts
CHANGED
|
@@ -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
|
|
package/lib/tabs/DropdownTabs.js
CHANGED
|
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _buttons = _interopRequireDefault(require("../buttons"));
|
|
9
10
|
var _list = _interopRequireWildcard(require("../list"));
|
|
10
11
|
var _useTabs = require("./useTabs");
|
|
11
|
-
var
|
|
12
|
+
var _2 = require("..");
|
|
12
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -26,16 +27,25 @@ const DropdownTab = _ref => {
|
|
|
26
27
|
} = _ref;
|
|
27
28
|
const {
|
|
28
29
|
selectTab,
|
|
29
|
-
removeTab
|
|
30
|
+
removeTab,
|
|
31
|
+
selectedTabId
|
|
30
32
|
} = (0, _useTabs.useTabs)();
|
|
31
33
|
return /*#__PURE__*/_react.default.createElement(_list.ListItem, {
|
|
32
|
-
key: id
|
|
34
|
+
key: id,
|
|
35
|
+
onClick: () => selectTab(id)
|
|
33
36
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
34
37
|
className: "menuitem"
|
|
35
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
38
|
+
}, selectedTabId === id ? /*#__PURE__*/_react.default.createElement(_2.Icon, {
|
|
39
|
+
name: "checkmark",
|
|
40
|
+
color: "#A10D0D"
|
|
41
|
+
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
style: {
|
|
43
|
+
width: 16,
|
|
44
|
+
height: 16
|
|
45
|
+
}
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
36
47
|
className: "btn menubutton",
|
|
37
48
|
boxShadow: false,
|
|
38
|
-
onClick: () => selectTab(id),
|
|
39
49
|
iconAlign: iconAlign,
|
|
40
50
|
iconName: iconName,
|
|
41
51
|
icon: icon,
|
|
@@ -53,16 +63,20 @@ const DropdownTabs = _ref2 => {
|
|
|
53
63
|
tabs = [],
|
|
54
64
|
tabMenuSize = 'medium'
|
|
55
65
|
} = _ref2;
|
|
66
|
+
const {
|
|
67
|
+
selectedTabId
|
|
68
|
+
} = (0, _useTabs.useTabs)();
|
|
69
|
+
const hasSelectedTab = tabs.some(tab => tab.id === selectedTabId);
|
|
56
70
|
const hasTabs = tabs.length > 0;
|
|
57
71
|
const uniqueTabs = _lodash.default.uniqBy(tabs, 'id');
|
|
58
|
-
if (
|
|
72
|
+
if (!hasTabs) return null;
|
|
59
73
|
return /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
60
74
|
dropdown: true,
|
|
61
75
|
dropdownAlign: "right",
|
|
62
76
|
transparent: true,
|
|
63
77
|
boxShadow: false,
|
|
64
78
|
size: "large",
|
|
65
|
-
customClass: `dropdownbutton ${hasTabs ? 'show' : ''}`
|
|
79
|
+
customClass: `dropdownbutton ${hasTabs ? 'show' : ''} ${hasSelectedTab ? 'has-selected' : ''}`
|
|
66
80
|
}, /*#__PURE__*/_react.default.createElement(_list.default, {
|
|
67
81
|
customClass: "dropdown-hide-tabs"
|
|
68
82
|
}, uniqueTabs.map(tab => /*#__PURE__*/_react.default.createElement(DropdownTab, _extends({
|
package/lib/tabs/Menu.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ import '../@types/PermissionAttr.js';
|
|
|
6
6
|
import '../@types/Icon.js';
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
|
-
declare const Menu: ({ toolbar, customClassForToolBar, tabWidth, ...props }: MenuProps) => JSX.Element;
|
|
9
|
+
declare const Menu: ({ toolbar, customClassForToolBar, tabWidth, tabsWithError, ...props }: MenuProps) => JSX.Element;
|
|
10
10
|
|
|
11
11
|
export { Menu as default };
|
package/lib/tabs/Menu.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _MenuTabs = _interopRequireDefault(require("./MenuTabs"));
|
|
9
9
|
var _DropdownTabs = _interopRequireDefault(require("./DropdownTabs"));
|
|
10
10
|
var _useTabs = require("./useTabs");
|
|
11
|
-
const _excluded = ["toolbar", "customClassForToolBar", "tabWidth"];
|
|
11
|
+
const _excluded = ["toolbar", "customClassForToolBar", "tabWidth", "tabsWithError"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
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
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; }
|
|
@@ -16,7 +16,8 @@ const Menu = _ref => {
|
|
|
16
16
|
let {
|
|
17
17
|
toolbar,
|
|
18
18
|
customClassForToolBar = '',
|
|
19
|
-
tabWidth = 'auto'
|
|
19
|
+
tabWidth = 'auto',
|
|
20
|
+
tabsWithError
|
|
20
21
|
} = _ref,
|
|
21
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
23
|
const {
|
|
@@ -27,6 +28,7 @@ const Menu = _ref => {
|
|
|
27
28
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
28
29
|
className: "menucontainer"
|
|
29
30
|
}, /*#__PURE__*/_react.default.createElement(_MenuTabs.default, {
|
|
31
|
+
tabsWithError: tabsWithError,
|
|
30
32
|
tabs: menuTabs,
|
|
31
33
|
tabWidth: tabWidth,
|
|
32
34
|
tabMenuSize: props.tabMenuSize,
|
package/lib/tabs/MenuTabs.js
CHANGED
|
@@ -28,7 +28,8 @@ const MenuTab = _ref => {
|
|
|
28
28
|
tooltip,
|
|
29
29
|
tooltipPosition,
|
|
30
30
|
tooltipWidth,
|
|
31
|
-
closeable
|
|
31
|
+
closeable,
|
|
32
|
+
tabsWithError
|
|
32
33
|
} = _ref;
|
|
33
34
|
const {
|
|
34
35
|
selectedTabId,
|
|
@@ -37,12 +38,17 @@ const MenuTab = _ref => {
|
|
|
37
38
|
tabsCount
|
|
38
39
|
} = (0, _useTabs.useTabs)();
|
|
39
40
|
const onDenied = (0, _permissionValidations.actionsOnPermissionDenied)(helpers.onDeniedOptions, permissionAttr);
|
|
41
|
+
const withErrorInContent = tabsWithError?.includes(id);
|
|
40
42
|
return onDenied.unvisible ? null : /*#__PURE__*/_react.default.createElement("li", {
|
|
41
43
|
key: id,
|
|
42
44
|
style: {
|
|
43
45
|
width: tabWidth
|
|
44
46
|
},
|
|
45
|
-
className: `
|
|
47
|
+
className: `
|
|
48
|
+
menuitem
|
|
49
|
+
${selectedTabId === id && 'selected'}
|
|
50
|
+
${withErrorInContent && 'witherrorcontent'}
|
|
51
|
+
`
|
|
46
52
|
}, /*#__PURE__*/_react.default.createElement(_buttons.default, {
|
|
47
53
|
className: "btn menubutton",
|
|
48
54
|
boxShadow: false,
|
|
@@ -67,9 +73,13 @@ const MenuTabs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
67
73
|
tabWidth = 'auto',
|
|
68
74
|
tabMenuSize = 'medium',
|
|
69
75
|
tabMenuAlign = 'left',
|
|
70
|
-
firstTabIdent = false
|
|
76
|
+
firstTabIdent = false,
|
|
77
|
+
tabsWithError
|
|
71
78
|
} = _ref2;
|
|
72
|
-
const
|
|
79
|
+
const {
|
|
80
|
+
keepPanelsInOrder
|
|
81
|
+
} = (0, _useTabs.useTabs)();
|
|
82
|
+
const uniqueTabs = keepPanelsInOrder ? _lodash.default.sortBy(_lodash.default.uniqBy(tabs, 'id'), tabPanel => keepPanelsInOrder.indexOf(tabPanel.id)) : _lodash.default.uniqBy(tabs, 'id');
|
|
73
83
|
return /*#__PURE__*/_react.default.createElement("ul", {
|
|
74
84
|
className: `menu ${firstTabIdent && '-firsttabident'}`,
|
|
75
85
|
style: helpers.menuStyles(tabMenuAlign),
|
|
@@ -77,7 +87,8 @@ const MenuTabs = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
77
87
|
}, uniqueTabs.map(tab => /*#__PURE__*/_react.default.createElement(MenuTab, _extends({
|
|
78
88
|
key: tab.id,
|
|
79
89
|
tabMenuSize: tabMenuSize,
|
|
80
|
-
tabWidth: tabWidth
|
|
90
|
+
tabWidth: tabWidth,
|
|
91
|
+
tabsWithError: tabsWithError
|
|
81
92
|
}, tab))));
|
|
82
93
|
});
|
|
83
94
|
MenuTabs.displayName = 'MenuTabs';
|
package/lib/tabs/context.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import '../@types/Icon.js';
|
|
|
7
7
|
import '../icons/helper.js';
|
|
8
8
|
|
|
9
9
|
declare const TabsContext: React__default.Context<TabsContextType>;
|
|
10
|
-
declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, firstTabIdent, }: TabsProviderProps): JSX.Element;
|
|
10
|
+
declare function TabsProvider({ children, tabs: tabsProp, container, selectedTab, onTabChange, onTabClose, tabsWidth: tabsWidthProp, firstTabIdent, keepPanelsInOrder, keepTabOriginalPosition, }: TabsProviderProps): JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { TabsContext, TabsProvider };
|
package/lib/tabs/context.js
CHANGED
|
@@ -21,7 +21,9 @@ function TabsProvider(_ref) {
|
|
|
21
21
|
onTabChange,
|
|
22
22
|
onTabClose,
|
|
23
23
|
tabsWidth: tabsWidthProp,
|
|
24
|
-
firstTabIdent = false
|
|
24
|
+
firstTabIdent = false,
|
|
25
|
+
keepPanelsInOrder,
|
|
26
|
+
keepTabOriginalPosition = true
|
|
25
27
|
} = _ref;
|
|
26
28
|
const [selectedTabId, setSelectedTabId] = _react.default.useState(selectedTab);
|
|
27
29
|
const [containerWidth, setContainerWidth] = (0, _react.useState)(() => {
|
|
@@ -61,7 +63,7 @@ function TabsProvider(_ref) {
|
|
|
61
63
|
}
|
|
62
64
|
}, [setTabs, menuTabs, tabs, dropdownTabs]);
|
|
63
65
|
const selectTab = (0, _react.useCallback)(tabId => {
|
|
64
|
-
updateTabs(tabId);
|
|
66
|
+
if (!keepTabOriginalPosition) updateTabs(tabId);
|
|
65
67
|
setSelectedTabId(tabId);
|
|
66
68
|
if (onTabChange) {
|
|
67
69
|
onTabChange(tabId);
|
|
@@ -117,11 +119,11 @@ function TabsProvider(_ref) {
|
|
|
117
119
|
dropdownTabs,
|
|
118
120
|
containerWidth,
|
|
119
121
|
tabsCount,
|
|
120
|
-
updateTabs,
|
|
121
122
|
selectTab,
|
|
122
123
|
selectedTabId,
|
|
123
124
|
removeTab,
|
|
124
|
-
menuRef
|
|
125
|
+
menuRef,
|
|
126
|
+
keepPanelsInOrder
|
|
125
127
|
}
|
|
126
128
|
}, children);
|
|
127
129
|
}
|
package/lib/tabs/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ import '../@types/PermissionAttr.js';
|
|
|
7
7
|
import '../@types/Icon.js';
|
|
8
8
|
import '../icons/helper.js';
|
|
9
9
|
|
|
10
|
-
declare const Tabs: ({ toolbar, toolBarRef, children, firstTabIdent, handlerTabClick, handlerCloseTab, style, tabMenuSize, tabMenuAlign, tabMenuPosition, customClassForToolBar, tabsWidth, ...props }: ITabsPros) => JSX.Element;
|
|
10
|
+
declare const Tabs: ({ toolbar, toolBarRef, children, firstTabIdent, handlerTabClick, handlerCloseTab, style, tabMenuSize, tabMenuAlign, tabMenuPosition, customClassForToolBar, tabsWidth, tabsWithError, keepPanelsInOrder, ...props }: ITabsPros) => JSX.Element;
|
|
11
11
|
|
|
12
12
|
export { Tabs as default };
|
package/lib/tabs/index.js
CHANGED
|
@@ -16,7 +16,8 @@ var _Panel = _interopRequireDefault(require("./Panel"));
|
|
|
16
16
|
var _tabHelpers = require("./tabHelpers");
|
|
17
17
|
require("../assets/styles/tabs.scss");
|
|
18
18
|
var _context = require("./context");
|
|
19
|
-
|
|
19
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
20
|
+
const _excluded = ["toolbar", "toolBarRef", "children", "firstTabIdent", "handlerTabClick", "handlerCloseTab", "style", "tabMenuSize", "tabMenuAlign", "tabMenuPosition", "customClassForToolBar", "tabsWidth", "tabsWithError", "keepPanelsInOrder"];
|
|
20
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
22
|
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
23
|
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,12 +37,17 @@ const Tabs = _ref => {
|
|
|
36
37
|
tabMenuAlign = 'left',
|
|
37
38
|
tabMenuPosition = 'top',
|
|
38
39
|
customClassForToolBar = '',
|
|
39
|
-
tabsWidth = 'auto'
|
|
40
|
+
tabsWidth = 'auto',
|
|
41
|
+
tabsWithError,
|
|
42
|
+
keepPanelsInOrder
|
|
40
43
|
} = _ref,
|
|
41
44
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
45
|
const containerRef = (0, _react.useRef)(null);
|
|
46
|
+
const childrensTabPanels = _react.default.Children.toArray(children).filter(childComp => /*#__PURE__*/_react.default.isValidElement(childComp) && !!childComp.props.id);
|
|
47
|
+
const childrensInOrder = keepPanelsInOrder ? _lodash.default.sortBy(childrensTabPanels, tabPanel => keepPanelsInOrder.indexOf(tabPanel.props.id)) : children;
|
|
43
48
|
const content = (0, _react.useMemo)(() => {
|
|
44
49
|
const menu = /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
50
|
+
tabsWithError: tabsWithError,
|
|
45
51
|
toolbar: toolbar,
|
|
46
52
|
tabWidth: tabsWidth,
|
|
47
53
|
customClassForToolBar: customClassForToolBar,
|
|
@@ -50,17 +56,18 @@ const Tabs = _ref => {
|
|
|
50
56
|
firstTabIdent: firstTabIdent
|
|
51
57
|
});
|
|
52
58
|
if (tabMenuPosition === 'top' || tabMenuPosition === 'left') {
|
|
53
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, menu,
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, menu, childrensInOrder);
|
|
54
60
|
}
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null,
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, childrensInOrder, menu);
|
|
56
62
|
}, [children, tabMenuPosition]);
|
|
57
63
|
return /*#__PURE__*/_react.default.createElement(_context.TabsProvider, _extends({
|
|
58
|
-
tabs:
|
|
64
|
+
tabs: childrensInOrder,
|
|
59
65
|
container: containerRef,
|
|
60
66
|
onTabChange: handlerTabClick,
|
|
61
67
|
onTabClose: handlerCloseTab,
|
|
62
68
|
tabsWidth: tabsWidth,
|
|
63
|
-
firstTabIdent: firstTabIdent
|
|
69
|
+
firstTabIdent: firstTabIdent,
|
|
70
|
+
keepPanelsInOrder: keepPanelsInOrder
|
|
64
71
|
}, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
65
72
|
ref: containerRef,
|
|
66
73
|
className: (0, _tabHelpers.tabsClass)(tabMenuPosition),
|
package/lib/tabs/types.d.ts
CHANGED
|
@@ -11,11 +11,11 @@ type TabsContextType = {
|
|
|
11
11
|
dropdownTabs: TabProps[];
|
|
12
12
|
selectedTabId: string | number | null;
|
|
13
13
|
selectTab: (tabId: string | number) => void;
|
|
14
|
-
updateTabs: (tabId: string | number) => void;
|
|
15
14
|
removeTab: (tabId: string | number) => void;
|
|
16
15
|
containerWidth: number;
|
|
17
16
|
tabsCount: number;
|
|
18
17
|
menuRef: RefObject<HTMLUListElement>;
|
|
18
|
+
keepPanelsInOrder?: Array<string | number>;
|
|
19
19
|
};
|
|
20
20
|
interface TabsProviderProps {
|
|
21
21
|
children: React.ReactNode;
|
|
@@ -26,6 +26,8 @@ interface TabsProviderProps {
|
|
|
26
26
|
onTabChange?: (tabId: string | number) => void;
|
|
27
27
|
onTabClose?: (tabId: string) => void;
|
|
28
28
|
firstTabIdent?: boolean;
|
|
29
|
+
keepPanelsInOrder?: Array<string | number>;
|
|
30
|
+
keepTabOriginalPosition?: boolean;
|
|
29
31
|
}
|
|
30
32
|
interface ITabsPros {
|
|
31
33
|
style?: CSSProperties;
|
|
@@ -41,6 +43,9 @@ interface ITabsPros {
|
|
|
41
43
|
handlerCloseTab?: (id?: string, idx?: string) => void;
|
|
42
44
|
customClassForToolBar?: string;
|
|
43
45
|
tabsWidth?: string | number;
|
|
46
|
+
tabsWithError?: Array<string | number>;
|
|
47
|
+
keepPanelsInOrder?: Array<string | number>;
|
|
48
|
+
keepTabOriginalPosition?: boolean;
|
|
44
49
|
}
|
|
45
50
|
interface TabProps {
|
|
46
51
|
id: string | number;
|
|
@@ -58,6 +63,7 @@ interface TabProps {
|
|
|
58
63
|
tooltipWidth?: string | number;
|
|
59
64
|
closeable?: boolean;
|
|
60
65
|
tabsLength?: number;
|
|
66
|
+
tabsWithError?: Array<string | number>;
|
|
61
67
|
}
|
|
62
68
|
interface MenuProps {
|
|
63
69
|
toolbar?: ReactElement;
|
|
@@ -71,6 +77,7 @@ interface MenuProps {
|
|
|
71
77
|
tabMenuSize?: Size;
|
|
72
78
|
handlerClick?: (id?: string) => void;
|
|
73
79
|
handlerRemovePanel?: (id?: string, idx?: number, bool?: boolean) => void;
|
|
80
|
+
tabsWithError?: Array<string | number>;
|
|
74
81
|
}
|
|
75
82
|
interface DropdownProps extends MenuProps {
|
|
76
83
|
}
|
package/lib/toolbar/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, CSSProperties, ReactElement } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties, ReactElement, MutableRefObject } from 'react';
|
|
2
2
|
import { ButtonTypes } from '../@types/ButtonTypes.js';
|
|
3
3
|
import { Position } from '../@types/Position.js';
|
|
4
4
|
import { Size } from '../@types/Size.js';
|
|
@@ -28,6 +28,7 @@ interface IButtonBarProps {
|
|
|
28
28
|
boxShadow?: boolean;
|
|
29
29
|
id?: string;
|
|
30
30
|
onNodeElementClick?: (node: NodeItem) => void;
|
|
31
|
+
buttonRef?: MutableRefObject<HTMLButtonElement | null> | ((ref: HTMLButtonElement | null) => void);
|
|
31
32
|
}
|
|
32
33
|
interface ILabelBarProps {
|
|
33
34
|
iconName?: IconNames;
|