@qoretechnologies/reqore 0.34.12 → 0.35.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/__tests__/collection.test.tsx +2 -2
- package/__tests__/helpers/table.test.tsx +47 -0
- package/__tests__/pagination.test.tsx +35 -4
- package/__tests__/table.test.tsx +158 -123
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +7 -4
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +2 -1
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +5 -11
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +4 -3
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +4 -1
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +4 -1
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Dropdown/list.js +10 -5
- package/dist/components/Dropdown/list.js.map +1 -1
- package/dist/components/Input/index.js +4 -4
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Paging/index.d.ts +4 -1
- package/dist/components/Paging/index.d.ts.map +1 -1
- package/dist/components/Paging/index.js +8 -6
- package/dist/components/Paging/index.js.map +1 -1
- package/dist/components/Panel/index.d.ts +4 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Table/cell.d.ts +12 -0
- package/dist/components/Table/cell.d.ts.map +1 -0
- package/dist/components/Table/cell.js +89 -0
- package/dist/components/Table/cell.js.map +1 -0
- package/dist/components/Table/header.d.ts +15 -2
- package/dist/components/Table/header.d.ts.map +1 -1
- package/dist/components/Table/header.js +31 -14
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.d.ts +8 -6
- package/dist/components/Table/headerCell.d.ts.map +1 -1
- package/dist/components/Table/headerCell.js +60 -51
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +39 -1
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +145 -1
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +39 -25
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +139 -52
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +9 -4
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +30 -54
- package/dist/components/Table/row.js.map +1 -1
- package/dist/hooks/useQueryWithDelay.d.ts +8 -0
- package/dist/hooks/useQueryWithDelay.d.ts.map +1 -0
- package/dist/hooks/useQueryWithDelay.js +25 -0
- package/dist/hooks/useQueryWithDelay.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +6 -1
- package/src/components/Collection/index.tsx +9 -15
- package/src/components/ControlGroup/index.tsx +10 -5
- package/src/components/Dropdown/index.tsx +9 -0
- package/src/components/Dropdown/list.tsx +18 -6
- package/src/components/Input/index.tsx +3 -3
- package/src/components/Paging/index.tsx +35 -13
- package/src/components/Panel/index.tsx +3 -1
- package/src/components/Table/cell.tsx +117 -0
- package/src/components/Table/header.tsx +102 -45
- package/src/components/Table/headerCell.tsx +123 -80
- package/src/components/Table/helpers.ts +206 -1
- package/src/components/Table/index.tsx +288 -90
- package/src/components/Table/row.tsx +47 -125
- package/src/hooks/useQueryWithDelay.ts +30 -0
- package/src/index.tsx +3 -0
- package/src/mock/tableData.ts +40 -20
- package/src/stories/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/stories/Button/Button.stories.tsx +1 -1
- package/src/stories/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/stories/Collection/Collection.stories.tsx +19 -1
- package/src/stories/Columns/Columns.stories.tsx +1 -1
- package/src/stories/Comment/Comment.stories.tsx +1 -1
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +1 -1
- package/src/stories/Drawer/Drawer.stories.tsx +5 -5
- package/src/stories/Dropdown/Dropdown.stories.tsx +11 -1
- package/src/stories/Header/Header.stories.tsx +1 -1
- package/src/stories/Icon/Icon.stories.tsx +1 -1
- package/src/stories/Input/Input.stories.tsx +1 -1
- package/src/stories/Menu/Menu.stories.tsx +1 -1
- package/src/stories/Message/Message.stories.tsx +1 -1
- package/src/stories/Modal/Modal.stories.tsx +1 -1
- package/src/stories/MultiSelect/MultiSelect.stories.tsx +1 -1
- package/src/stories/Navbar/Navbar.stories.tsx +1 -1
- package/src/stories/Notifications/Interactive.stories.tsx +1 -1
- package/src/stories/Notifications/Notification.stories.tsx +1 -1
- package/src/stories/Notifications/Notifications.stories.tsx +1 -1
- package/src/stories/Paging/Paging.stories.tsx +6 -2
- package/src/stories/Panel/Panel.stories.tsx +5 -5
- package/src/stories/Paragraph/Paragraph.stories.tsx +1 -1
- package/src/stories/Popover/Popover.stories.tsx +2 -2
- package/src/stories/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/src/stories/Sidebar/Sidebar.stories.tsx +2 -2
- package/src/stories/Spacer/Spacer.stories.tsx +1 -1
- package/src/stories/Spinner/Spinner.stories.tsx +1 -1
- package/src/stories/Table/Table.stories.tsx +277 -78
- package/src/stories/Tabs/Tabs.stories.tsx +1 -1
- package/src/stories/Tag/Tag.stories.tsx +1 -1
- package/src/stories/TextArea/TextArea.stories.tsx +2 -2
- package/src/stories/Tree/Tree.stories.tsx +2 -2
- package/src/stories/utils/args.ts +1 -1
- package/tests.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
12
12
|
}));
|
|
13
13
|
exports.__esModule = true;
|
|
14
14
|
exports.ReqoreVerticalSpacer = exports.ReqoreSpacer = exports.ReqoreHorizontalSpacer = exports.ReqoreSidebar = exports.ReqoreRadioGroup = exports.ReqorePopover = exports.ReqoreParagraph = exports.ReqoreP = exports.ReqorePanel = exports.ReqorePagination = exports.ReqoreNotification = exports.ReqoreNotificationsWrapper = exports.ReqoreNavbarItem = exports.ReqoreNavbarGroup = exports.ReqoreNavbarDivider = exports.ReqoreHeader = exports.ReqoreFooter = exports.ReqoreMultiSelect = exports.ReqoreModal = exports.ReqoreMessage = exports.ReqoreMenuItem = exports.ReqoreMenuDivider = exports.ReqoreMenu = exports.ReqoreLayoutContent = exports.ReqoreInput = exports.ReqoreIcon = exports.ReqoreHeading = exports.ReqoreH6 = exports.ReqoreH5 = exports.ReqoreH4 = exports.ReqoreH3 = exports.ReqoreH2 = exports.ReqoreH1 = exports.ReqoreTextEffect = exports.ReqoreEffect = exports.ReqoreDropdownItem = exports.ReqoreDropdownDivider = exports.ReqoreDropdown = exports.ReqoreDrawer = exports.ReqoreControlGroup = exports.ReqoreContent = exports.ReqoreCommentFeed = exports.ReqoreComment = exports.ReqoreColumn = exports.ReqoreColumns = exports.ReqoreCollection = exports.ReqoreCheckbox = exports.ReqoreButton = exports.ReqoreBreadcrumbsItem = exports.ReqoreBreadcrumbs = void 0;
|
|
15
|
-
exports.useReqoreTheme = exports.useReqoreProperty = exports.useReqore = exports.useReqorePaging = exports.useLatestZIndex = exports.ReqoreThemeContext = exports.ReqoreContext = exports.ReqoreUIProvider = exports.ReqoreNotifications = exports.ReqorePaginationContainer = exports.ReqoreIntents = exports.ReqoreSizes = exports.ReqoreColors = exports.ReqoreTree = exports.ReqoreTimeAgo = exports.ReqoreTextarea = exports.ReqoreTagGroup = exports.ReqoreTag = exports.ReqoreTabsList = exports.ReqoreTabsListItem = exports.ReqoreTabsContent = exports.ReqoreTabs = exports.ReqoreTable = exports.ReqoreSpinner = void 0;
|
|
15
|
+
exports.useReqoreTheme = exports.useReqoreProperty = exports.useReqore = exports.useReqorePaging = exports.useLatestZIndex = exports.ReqoreThemeContext = exports.ReqoreContext = exports.ReqoreUIProvider = exports.ReqoreNotifications = exports.ReqorePaginationContainer = exports.ReqoreIntents = exports.ReqoreSizes = exports.ReqoreColors = exports.ReqoreTree = exports.ReqoreTimeAgo = exports.ReqoreTextarea = exports.ReqoreTagGroup = exports.ReqoreTag = exports.ReqoreTabsList = exports.ReqoreTabsListItem = exports.ReqoreTabsContent = exports.ReqoreTabs = exports.ReqoreTableRow = exports.ReqoreTableHeaderCell = exports.ReqoreTableBodyCell = exports.ReqoreTable = exports.ReqoreSpinner = void 0;
|
|
16
16
|
var Breadcrumbs_1 = require("./components/Breadcrumbs");
|
|
17
17
|
__createBinding(exports, Breadcrumbs_1, "default", "ReqoreBreadcrumbs");
|
|
18
18
|
var item_1 = require("./components/Breadcrumbs/item");
|
|
@@ -105,6 +105,12 @@ var Spinner_1 = require("./components/Spinner");
|
|
|
105
105
|
__createBinding(exports, Spinner_1, "ReqoreSpinner");
|
|
106
106
|
var Table_1 = require("./components/Table");
|
|
107
107
|
__createBinding(exports, Table_1, "default", "ReqoreTable");
|
|
108
|
+
var cell_1 = require("./components/Table/cell");
|
|
109
|
+
__createBinding(exports, cell_1, "ReqoreTableBodyCell");
|
|
110
|
+
var headerCell_1 = require("./components/Table/headerCell");
|
|
111
|
+
__createBinding(exports, headerCell_1, "ReqoreTableHeaderCell");
|
|
112
|
+
var row_1 = require("./components/Table/row");
|
|
113
|
+
__createBinding(exports, row_1, "default", "ReqoreTableRow");
|
|
108
114
|
var Tabs_1 = require("./components/Tabs");
|
|
109
115
|
__createBinding(exports, Tabs_1, "default", "ReqoreTabs");
|
|
110
116
|
var content_2 = require("./components/Tabs/content");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[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;AAClC,wCAAwD;AAA/C,wDAAoB;AAC7B,gDAAmE;AAA1D,+DAAyB;AAClC,kDAAkE;AAAzD,kEAAyB;AAClC,gDAAgE;AAAvD,gEAAwB;AACjC,0CAA+C;AAAtC,+CAAU;AACnB,6CAA4D;AAAnD,6DAAsB;AAC/B,2CAAgD;AAAvC,iDAAW;AACpB,2CAAkD;AAAzC,mDAAa;AACtB,8CAAgE;AAAvD,gEAAyB;AAClC,8DAA6E;AAApE,6EAA8B;AACvC,sDAAsE;AAA7D,sEAA2B;AACpC,yDAAmE;AAA1D,sEAAwB;AACjC,uDAAuE;AAA9D,0EAA6B;AACtC,2DAAqE;AAA5D,0EAA0B;AACnC,+CAAoD;AAA3C,yDAAe;AACxB,+CAA8C;AAArC,mDAAS;AAClB,6DAA6D;AAApD,kEAAiB;AAC1B,6CAAkD;AAAzC,uDAAc"}
|
package/package.json
CHANGED
|
@@ -77,6 +77,8 @@ export interface IReqoreButtonProps
|
|
|
77
77
|
descriptionEffect?: IReqoreEffect;
|
|
78
78
|
label?: React.HTMLAttributes<HTMLButtonElement>['children'];
|
|
79
79
|
as?: string | React.ElementType;
|
|
80
|
+
grow?: 1 | 2 | 3 | 4;
|
|
81
|
+
rounded?: boolean;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
@@ -94,6 +96,7 @@ const getButtonMainColor = (theme: IReqoreTheme, color?: TReqoreHexColor) => {
|
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
export const StyledAnimatedTextWrapper = styled.span`
|
|
99
|
+
min-width: 5px;
|
|
97
100
|
overflow: hidden;
|
|
98
101
|
position: relative;
|
|
99
102
|
text-align: ${({ textAlign }) => textAlign};
|
|
@@ -180,9 +183,11 @@ export const StyledButton = styled(StyledEffect)<IReqoreButtonStyle>`
|
|
|
180
183
|
: null}
|
|
181
184
|
|
|
182
185
|
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto')};
|
|
186
|
+
flex-grow: ${({ grow }) => grow};
|
|
183
187
|
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
184
188
|
|
|
185
|
-
border-radius: ${({ size }) =>
|
|
189
|
+
border-radius: ${({ size, rounded }) =>
|
|
190
|
+
rounded === false ? undefined : RADIUS_FROM_SIZE[size]}px;
|
|
186
191
|
|
|
187
192
|
background-color: ${({ minimal, color }) => {
|
|
188
193
|
if (minimal) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { size } from 'lodash';
|
|
2
2
|
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useUpdateEffect } from 'react-use';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { useReqoreProperty } from '../..';
|
|
6
6
|
import { TReqorePaginationType } from '../../constants/paging';
|
|
7
7
|
import { PADDING_FROM_SIZE } from '../../constants/sizes';
|
|
8
8
|
import { ReqorePaginationContainer } from '../../containers/Paging';
|
|
9
|
+
import { useQueryWithDelay } from '../../hooks/useQueryWithDelay';
|
|
9
10
|
import { IReqoreIconName } from '../../types/icons';
|
|
10
11
|
import { IReqoreColumnsProps, StyledColumns } from '../Columns';
|
|
11
12
|
import ReqoreControlGroup from '../ControlGroup';
|
|
@@ -29,6 +30,7 @@ export interface IReqoreCollectionProps extends IReqorePanelProps, IReqoreColumn
|
|
|
29
30
|
fill?: boolean;
|
|
30
31
|
maxItemHeight?: number;
|
|
31
32
|
filterable?: boolean;
|
|
33
|
+
defaultQuery?: string;
|
|
32
34
|
sortable?: boolean;
|
|
33
35
|
showAs?: 'list' | 'grid';
|
|
34
36
|
showSelectedFirst?: boolean;
|
|
@@ -84,6 +86,7 @@ export const ReqoreCollection = ({
|
|
|
84
86
|
flat = true,
|
|
85
87
|
minimal,
|
|
86
88
|
transparent = true,
|
|
89
|
+
defaultQuery,
|
|
87
90
|
onQueryChange,
|
|
88
91
|
contentRenderer = (children, _items, searchInput) => (
|
|
89
92
|
<>
|
|
@@ -111,27 +114,18 @@ export const ReqoreCollection = ({
|
|
|
111
114
|
}: IReqoreCollectionProps) => {
|
|
112
115
|
const [_showAs, setShowAs] = useState<'list' | 'grid'>(showAs);
|
|
113
116
|
const [sort, setSort] = useState<'asc' | 'desc'>('asc');
|
|
114
|
-
const [query, setQuery] = useState<string>('');
|
|
115
|
-
const [preQuery, setPreQuery] = useState<string>('');
|
|
116
117
|
const [contentRef, setContentRef] = useState<HTMLDivElement>(undefined);
|
|
117
118
|
const isMobile = useReqoreProperty('isMobile');
|
|
119
|
+
const { query, setQuery, preQuery, setPreQuery } = useQueryWithDelay(
|
|
120
|
+
defaultQuery,
|
|
121
|
+
searchDelay,
|
|
122
|
+
onQueryChange
|
|
123
|
+
);
|
|
118
124
|
|
|
119
125
|
useUpdateEffect(() => {
|
|
120
126
|
setShowAs(showAs);
|
|
121
127
|
}, [showAs]);
|
|
122
128
|
|
|
123
|
-
useUpdateEffect(() => {
|
|
124
|
-
onQueryChange?.(query);
|
|
125
|
-
}, [query]);
|
|
126
|
-
|
|
127
|
-
useDebounce(
|
|
128
|
-
() => {
|
|
129
|
-
setQuery(preQuery);
|
|
130
|
-
},
|
|
131
|
-
searchDelay,
|
|
132
|
-
[preQuery]
|
|
133
|
-
);
|
|
134
|
-
|
|
135
129
|
const sortedItems: IReqoreCollectionItemProps[] = useMemo(() => {
|
|
136
130
|
if (!sortable) {
|
|
137
131
|
return items;
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
IWithReqoreMinimal,
|
|
14
14
|
IWithReqoreSize,
|
|
15
15
|
} from '../../types/global';
|
|
16
|
+
import { StyledEffect } from '../Effect';
|
|
16
17
|
import { StyledHeader } from '../Header';
|
|
17
18
|
import { StyledParagraph } from '../Paragraph';
|
|
18
19
|
|
|
@@ -56,7 +57,7 @@ export interface IReqoreControlGroupStyle extends IReqoreControlGroupProps {
|
|
|
56
57
|
theme: IReqoreTheme;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export const StyledReqoreControlGroup = styled
|
|
60
|
+
export const StyledReqoreControlGroup = styled(StyledEffect)<IReqoreControlGroupStyle>`
|
|
60
61
|
display: flex;
|
|
61
62
|
flex: ${({ fluid, fixed }) => (fixed ? '0 0 auto' : fluid ? undefined : '0 0 auto')};
|
|
62
63
|
width: ${({ fluid, fixed }) => (fluid && !fixed ? '100%' : undefined)};
|
|
@@ -356,10 +357,14 @@ const ReqoreControlGroup = memo(
|
|
|
356
357
|
newProps = {
|
|
357
358
|
...newProps,
|
|
358
359
|
style: {
|
|
359
|
-
borderTopLeftRadius:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
borderTopLeftRadius:
|
|
361
|
+
child.props?.rounded === false ? undefined : getBorderTopLeftRadius(index),
|
|
362
|
+
borderBottomLeftRadius:
|
|
363
|
+
child.props?.rounded === false ? undefined : getBorderBottomLeftRadius(index),
|
|
364
|
+
borderTopRightRadius:
|
|
365
|
+
child.props?.rounded === false ? undefined : getBorderTopRightRadius(index),
|
|
366
|
+
borderBottomRightRadius:
|
|
367
|
+
child.props?.rounded === false ? undefined : getBorderBottomRightRadius(index),
|
|
363
368
|
...(child.props?.style || {}),
|
|
364
369
|
},
|
|
365
370
|
isChild: true,
|
|
@@ -20,6 +20,9 @@ export interface IReqoreDropdownProps extends Partial<Omit<IPopoverOptions, 'ope
|
|
|
20
20
|
listStyle?: React.CSSProperties;
|
|
21
21
|
component?: any;
|
|
22
22
|
filterable?: boolean;
|
|
23
|
+
onFilterChange?: (query: string) => void;
|
|
24
|
+
filter?: string | number;
|
|
25
|
+
filterPlaceholder?: string;
|
|
23
26
|
label?: any;
|
|
24
27
|
children?: any;
|
|
25
28
|
listWidth?: string;
|
|
@@ -58,6 +61,9 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
58
61
|
handler,
|
|
59
62
|
placement,
|
|
60
63
|
filterable,
|
|
64
|
+
onFilterChange,
|
|
65
|
+
filterPlaceholder,
|
|
66
|
+
filter,
|
|
61
67
|
icon,
|
|
62
68
|
rightIcon,
|
|
63
69
|
caretPosition = 'left',
|
|
@@ -110,6 +116,9 @@ function ReqoreDropdown<T extends unknown = IReqoreButtonProps>({
|
|
|
110
116
|
inputProps={inputProps}
|
|
111
117
|
scrollToSelected={scrollToSelected}
|
|
112
118
|
paging={paging}
|
|
119
|
+
onFilterChange={onFilterChange}
|
|
120
|
+
filterPlaceholder={filterPlaceholder}
|
|
121
|
+
filter={filter}
|
|
113
122
|
/>
|
|
114
123
|
) : undefined;
|
|
115
124
|
}, [items]);
|
|
@@ -28,7 +28,12 @@ export interface IReqoreDropdownListProps extends IReqoreComponent {
|
|
|
28
28
|
listStyle?: React.CSSProperties;
|
|
29
29
|
width?: string;
|
|
30
30
|
height?: string;
|
|
31
|
+
|
|
31
32
|
filterable?: boolean;
|
|
33
|
+
onFilterChange?: (query: string) => void;
|
|
34
|
+
filter?: string | number;
|
|
35
|
+
filterPlaceholder?: string;
|
|
36
|
+
|
|
32
37
|
onItemSelect?: TDropdownItemOnClick;
|
|
33
38
|
inputProps?: IReqoreInputProps;
|
|
34
39
|
scrollToSelected?: boolean;
|
|
@@ -48,9 +53,12 @@ const ReqoreDropdownList = memo(
|
|
|
48
53
|
inputProps,
|
|
49
54
|
scrollToSelected,
|
|
50
55
|
paging,
|
|
56
|
+
onFilterChange,
|
|
57
|
+
filterPlaceholder,
|
|
58
|
+
filter,
|
|
51
59
|
}: IReqoreDropdownListProps) => {
|
|
52
60
|
const [_items, setItems] = useState<TReqoreDropdownItems>(items);
|
|
53
|
-
const [query, setQuery] = useState<string>('');
|
|
61
|
+
const [query, setQuery] = useState<string | number>(onFilterChange ? '' : filter || '');
|
|
54
62
|
const [menuRef, setMenuRef] = useState<HTMLDivElement>(undefined);
|
|
55
63
|
|
|
56
64
|
useEffect(() => {
|
|
@@ -73,12 +81,16 @@ const ReqoreDropdownList = memo(
|
|
|
73
81
|
return false;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
|
-
return text.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1;
|
|
84
|
+
return text.toString().toLowerCase().indexOf(query.toString().toLowerCase()) !== -1;
|
|
77
85
|
});
|
|
78
86
|
}, [items, query, _items]);
|
|
79
87
|
|
|
80
88
|
const handleQueryChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
81
|
-
|
|
89
|
+
if (onFilterChange) {
|
|
90
|
+
onFilterChange(event.target.value);
|
|
91
|
+
} else {
|
|
92
|
+
setQuery(event.target.value);
|
|
93
|
+
}
|
|
82
94
|
};
|
|
83
95
|
|
|
84
96
|
const handleItemClick = (item: IReqoreDropdownItem): void => {
|
|
@@ -96,11 +108,11 @@ const ReqoreDropdownList = memo(
|
|
|
96
108
|
{filterable && (
|
|
97
109
|
<>
|
|
98
110
|
<ReqoreInput
|
|
99
|
-
value={query}
|
|
111
|
+
value={onFilterChange ? filter : query}
|
|
100
112
|
icon='SearchLine'
|
|
101
113
|
onChange={handleQueryChange}
|
|
102
|
-
placeholder={`Search ${size(_items)} items...`}
|
|
103
|
-
onClearClick={() => setQuery('')}
|
|
114
|
+
placeholder={filterPlaceholder || `Search ${size(_items)} items...`}
|
|
115
|
+
onClearClick={() => (onFilterChange ? onFilterChange('') : setQuery(''))}
|
|
104
116
|
{...inputProps}
|
|
105
117
|
/>
|
|
106
118
|
<ReqoreVerticalSpacer height={PADDING_FROM_SIZE.normal} />
|
|
@@ -73,7 +73,7 @@ export const StyledInputWrapper = styled.div<IReqoreInputStyle>`
|
|
|
73
73
|
position: relative;
|
|
74
74
|
overflow: hidden;
|
|
75
75
|
border-radius: ${({ minimal, rounded, _size }) =>
|
|
76
|
-
minimal ||
|
|
76
|
+
minimal || rounded === false ? 0 : RADIUS_FROM_SIZE[_size]}px;
|
|
77
77
|
`;
|
|
78
78
|
|
|
79
79
|
const StyledIconWrapper = styled.div<IReqoreInputStyle>`
|
|
@@ -109,7 +109,7 @@ export const StyledInput = styled(StyledEffect)<IReqoreInputStyle>`
|
|
|
109
109
|
font-size: ${({ _size }) => TEXT_FROM_SIZE[_size]}px;
|
|
110
110
|
transition: all 0.2s ease-out;
|
|
111
111
|
border-radius: ${({ minimal, rounded, _size }) =>
|
|
112
|
-
minimal ||
|
|
112
|
+
minimal || rounded === false ? 0 : RADIUS_FROM_SIZE[_size]}px;
|
|
113
113
|
border: ${({ minimal, theme, flat }) =>
|
|
114
114
|
!minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.2)}` : 0};
|
|
115
115
|
border-bottom: ${({ minimal, theme, flat }) =>
|
|
@@ -175,7 +175,7 @@ const ReqoreInput = forwardRef<HTMLDivElement, IReqoreInputProps>(
|
|
|
175
175
|
iconColor,
|
|
176
176
|
rightIconColor,
|
|
177
177
|
flat,
|
|
178
|
-
rounded
|
|
178
|
+
rounded,
|
|
179
179
|
minimal,
|
|
180
180
|
children,
|
|
181
181
|
readOnly,
|
|
@@ -16,14 +16,17 @@ export interface IReqorePaginationComponentProps
|
|
|
16
16
|
listPageButtonProps?: IReqoreDropdownProps;
|
|
17
17
|
controlPageButtonProps?: IReqoreButtonProps;
|
|
18
18
|
loadMoreButtonProps?: IReqoreButtonProps;
|
|
19
|
+
loadAllButtonProps?: IReqoreButtonProps;
|
|
19
20
|
firstPageLabel?: string;
|
|
20
21
|
lastPageLabel?: string;
|
|
21
22
|
nextPageLabel?: string;
|
|
22
23
|
previousPageLabel?: string;
|
|
23
24
|
pageLabel?: string;
|
|
24
25
|
loadMoreLabel?: string;
|
|
26
|
+
loadAllLabel?: string;
|
|
25
27
|
showPages?: boolean;
|
|
26
28
|
showControls?: boolean;
|
|
29
|
+
showLoadAllButton?: boolean;
|
|
27
30
|
showPagesAs?: 'buttons' | 'list';
|
|
28
31
|
showLabels?: boolean;
|
|
29
32
|
scrollOnLoadMore?: boolean;
|
|
@@ -66,15 +69,18 @@ function Pagination<T>({
|
|
|
66
69
|
listPageButtonProps = {},
|
|
67
70
|
controlPageButtonProps = {},
|
|
68
71
|
loadMoreButtonProps = {},
|
|
72
|
+
loadAllButtonProps = {},
|
|
69
73
|
firstPageLabel = 'First',
|
|
70
74
|
lastPageLabel = 'Last',
|
|
71
75
|
nextPageLabel = 'Next',
|
|
72
76
|
previousPageLabel = 'Back',
|
|
73
77
|
pageLabel = 'Page',
|
|
74
78
|
loadMoreLabel = 'Load more',
|
|
79
|
+
loadAllLabel = 'Load all',
|
|
75
80
|
showLabels,
|
|
76
81
|
showPages = true,
|
|
77
82
|
showControls = true,
|
|
83
|
+
showLoadAllButton = true,
|
|
78
84
|
scrollOnLoadMore,
|
|
79
85
|
autoLoadMore,
|
|
80
86
|
itemsPerPage,
|
|
@@ -191,19 +197,35 @@ function Pagination<T>({
|
|
|
191
197
|
{infinite && !isLastPage ? (
|
|
192
198
|
<ReqoreControlGroup vertical>
|
|
193
199
|
<div className='reqore-auto-scroll-target' ref={setScrollTargetRef} />
|
|
194
|
-
<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
<ReqoreControlGroup stack>
|
|
201
|
+
<ReqoreButton
|
|
202
|
+
icon='ArrowDropDownLine'
|
|
203
|
+
badge={itemsPerPage}
|
|
204
|
+
iconsAlign='center'
|
|
205
|
+
{...loadMoreButtonProps}
|
|
206
|
+
onClick={next}
|
|
207
|
+
ref={setLoadMoreRef}
|
|
208
|
+
style={{
|
|
209
|
+
scrollMarginTop: '200px',
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
{showLabels && loadMoreLabel}
|
|
213
|
+
</ReqoreButton>
|
|
214
|
+
{showLoadAllButton && (
|
|
215
|
+
<ReqoreButton
|
|
216
|
+
icon='ArrowDropDownLine'
|
|
217
|
+
badge={itemsLeft}
|
|
218
|
+
iconsAlign='center'
|
|
219
|
+
{...loadAllButtonProps}
|
|
220
|
+
onClick={last}
|
|
221
|
+
style={{
|
|
222
|
+
scrollMarginTop: '200px',
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{showLabels && loadAllLabel}
|
|
226
|
+
</ReqoreButton>
|
|
227
|
+
)}
|
|
228
|
+
</ReqoreControlGroup>
|
|
207
229
|
</ReqoreControlGroup>
|
|
208
230
|
) : null}
|
|
209
231
|
{!infinite ? (
|
|
@@ -47,11 +47,13 @@ import { ReqoreHeading, StyledHeader } from '../Header';
|
|
|
47
47
|
import ReqoreIcon, { IReqoreIconProps, StyledIconWrapper } from '../Icon';
|
|
48
48
|
import { ReqorePanelNonResponsiveActions } from './NonResponsiveActions';
|
|
49
49
|
|
|
50
|
+
export interface IReqorePanelSubAction extends Omit<IReqoreDropdownItem, 'value'> {}
|
|
50
51
|
export interface IReqorePanelAction extends IReqoreButtonProps, IWithReqoreTooltip, IReqoreIntent {
|
|
51
52
|
label?: string | number;
|
|
52
53
|
onClick?: () => void;
|
|
53
54
|
group?: IReqorePanelAction[];
|
|
54
|
-
actions?:
|
|
55
|
+
actions?: IReqorePanelSubAction[];
|
|
56
|
+
multiSelect?: boolean;
|
|
55
57
|
// Custom react element
|
|
56
58
|
as?: React.ElementType;
|
|
57
59
|
props?: { [key: string | number]: any } | undefined;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { lighten, rgba } from 'polished';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { IReqoreTableColumn } from '.';
|
|
4
|
+
import { TEXT_FROM_SIZE } from '../../constants/sizes';
|
|
5
|
+
import { changeLightness, getReadableColorFrom } from '../../helpers/colors';
|
|
6
|
+
import { alignToFlexAlign } from '../../helpers/utils';
|
|
7
|
+
import { TReqoreColor } from '../Effect';
|
|
8
|
+
import { IReqoreTableCellStyle } from './row';
|
|
9
|
+
|
|
10
|
+
export interface IReqoreCustomTableBodyCellProps extends IReqoreTableBodyCellProps {}
|
|
11
|
+
export interface IReqoreCustomTableBodyCell extends React.FC<IReqoreCustomTableBodyCellProps> {}
|
|
12
|
+
export interface IReqoreTableBodyCellProps
|
|
13
|
+
extends Partial<IReqoreTableColumn>,
|
|
14
|
+
React.HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StyledTableCell = styled.div<IReqoreTableCellStyle>`
|
|
19
|
+
${({ width, grow }) =>
|
|
20
|
+
css`
|
|
21
|
+
width: ${width}px;
|
|
22
|
+
flex-grow: ${grow || (width ? undefined : 1)};
|
|
23
|
+
`}
|
|
24
|
+
|
|
25
|
+
${({
|
|
26
|
+
theme,
|
|
27
|
+
align,
|
|
28
|
+
interactive,
|
|
29
|
+
interactiveCell,
|
|
30
|
+
intent,
|
|
31
|
+
size,
|
|
32
|
+
flat,
|
|
33
|
+
striped,
|
|
34
|
+
even,
|
|
35
|
+
selected,
|
|
36
|
+
selectedIntent,
|
|
37
|
+
disabled,
|
|
38
|
+
hovered,
|
|
39
|
+
}: IReqoreTableCellStyle) => {
|
|
40
|
+
const getBackgroundColor = (): TReqoreColor => {
|
|
41
|
+
let color = theme.main;
|
|
42
|
+
let opacity = 0;
|
|
43
|
+
// Is there any intent
|
|
44
|
+
if (intent || (selected && selectedIntent)) {
|
|
45
|
+
color = theme.intents[intent || selectedIntent];
|
|
46
|
+
opacity += 0.02;
|
|
47
|
+
}
|
|
48
|
+
// Is the table striped and this row odd
|
|
49
|
+
if (striped && !even) {
|
|
50
|
+
opacity += 0.05;
|
|
51
|
+
}
|
|
52
|
+
// Is this row selected
|
|
53
|
+
if (selected) {
|
|
54
|
+
opacity += 0.02;
|
|
55
|
+
}
|
|
56
|
+
// Is this row hovered
|
|
57
|
+
if (hovered) {
|
|
58
|
+
opacity += 0.08;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Set the color as transparent if opacity is 0
|
|
62
|
+
if (opacity === 0) {
|
|
63
|
+
return 'transparent';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return changeLightness(color, opacity);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const backgroundColor = getBackgroundColor();
|
|
70
|
+
|
|
71
|
+
return css`
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: ${align ? alignToFlexAlign(align) : 'flex-start'};
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
border-bottom: ${!flat ? '1px solid ' : undefined};
|
|
77
|
+
|
|
78
|
+
height: 100%;
|
|
79
|
+
padding: 0 10px;
|
|
80
|
+
font-size: ${TEXT_FROM_SIZE[size]}px;
|
|
81
|
+
background-color: ${backgroundColor === 'transparent'
|
|
82
|
+
? 'transparent'
|
|
83
|
+
: rgba(getBackgroundColor(), 0.8)};
|
|
84
|
+
color: ${getReadableColorFrom(
|
|
85
|
+
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
86
|
+
!hovered
|
|
87
|
+
)};
|
|
88
|
+
border-color: ${changeLightness(
|
|
89
|
+
backgroundColor === 'transparent' ? theme.main : backgroundColor,
|
|
90
|
+
0.1
|
|
91
|
+
)};
|
|
92
|
+
transition: background-color 0.2s ease-out;
|
|
93
|
+
opacity: ${disabled ? 0.2 : 1};
|
|
94
|
+
pointer-events: ${disabled ? 'none' : undefined};
|
|
95
|
+
cursor: ${interactive || interactiveCell ? 'pointer' : 'default'};
|
|
96
|
+
|
|
97
|
+
${interactiveCell &&
|
|
98
|
+
css`
|
|
99
|
+
&:hover {
|
|
100
|
+
background-color: ${lighten(0.2, getBackgroundColor())};
|
|
101
|
+
}
|
|
102
|
+
`}
|
|
103
|
+
|
|
104
|
+
p.reqore-table-text {
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
white-space: nowrap;
|
|
107
|
+
text-overflow: ellipsis;
|
|
108
|
+
margin: 0;
|
|
109
|
+
padding: 0;
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
}}
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
export const ReqoreTableBodyCell = (props: IReqoreTableBodyCellProps) => {
|
|
116
|
+
return <StyledTableCell {...props} />;
|
|
117
|
+
};
|