@jetbrains/ring-ui 4.1.0-beta.3 → 4.1.1
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/CHANGELOG.md +13 -0
- package/README.md +17 -15
- package/babel.config.js +3 -2
- package/components/alert/alert.js +9 -3
- package/components/alert/alert.test.js +21 -48
- package/components/alert/container.css +1 -1
- package/components/alert/container.test.js +3 -13
- package/components/alert-service/alert-service.examples.css +18 -0
- package/components/alert-service/alert-service.examples.js +21 -0
- package/components/alert-service/alert-service.js +10 -3
- package/components/analytics/analytics__fus-plugin.js +3 -3
- package/components/analytics/analytics__ga-plugin.js +2 -2
- package/components/auth/auth.test.js +14 -7
- package/components/auth/auth__core.js +64 -33
- package/components/auth-dialog/auth-dialog.css +2 -3
- package/components/auth-dialog/auth-dialog.js +4 -1
- package/components/auth-dialog/auth-dialog.test.js +3 -19
- package/components/avatar/avatar.css +4 -1
- package/components/avatar/avatar.examples.js +3 -2
- package/components/avatar/avatar.js +34 -6
- package/components/avatar/avatar.test.js +20 -17
- package/components/avatar/fallback-avatar.js +136 -0
- package/components/avatar-editor-ng/avatar-editor-ng.css +2 -2
- package/components/avatar-editor-ng/avatar-editor-ng.js +2 -1
- package/components/avatar-editor-ng/{avatar-editor-ng.html → avatar-editor-ng__template.js} +2 -2
- package/components/badge/badge.test.js +13 -20
- package/components/button/button.css +2 -2
- package/components/button/button.js +4 -1
- package/components/button/button.test.js +32 -33
- package/components/button-group/button-group.js +1 -1
- package/components/button-group/caption.js +1 -1
- package/components/button-ng/button-ng.js +1 -1
- package/components/button-set-ng/button-set-ng.js +3 -1
- package/components/checkbox/checkbox.css +1 -1
- package/components/code/code.js +2 -5
- package/components/confirm/confirm.js +1 -0
- package/components/confirm-service/confirm-service.js +5 -5
- package/components/content-layout/content-layout.css +1 -1
- package/components/data-list/data-list.css +1 -1
- package/components/date-picker/date-input.js +5 -4
- package/components/date-picker/date-picker.css +34 -22
- package/components/date-picker/date-picker.js +16 -14
- package/components/date-picker/date-popup.js +22 -7
- package/components/date-picker/month-names.js +8 -5
- package/components/date-picker/month.js +6 -2
- package/components/date-picker/weekdays.js +10 -2
- package/components/dialog/dialog.examples.js +3 -1
- package/components/dialog/dialog.js +10 -5
- package/components/dialog/dialog.test.js +1 -1
- package/components/dialog/dialog__body-scroll-preventer.js +51 -31
- package/components/dialog-ng/dialog-ng.js +10 -10
- package/components/dialog-ng/{dialog-ng.html → dialog-ng__template.js} +2 -2
- package/components/dropdown/dropdown.examples.js +36 -1
- package/components/dropdown/dropdown.test.js +2 -2
- package/components/dropdown-menu/dropdown-menu.examples.js +47 -0
- package/components/dropdown-menu/dropdown-menu.js +117 -0
- package/components/dropdown-menu/dropdown-menu.test.js +76 -0
- package/components/error-bubble/error-bubble-legacy.css +1 -1
- package/components/error-bubble/error-bubble.css +1 -1
- package/components/error-bubble/error-bubble.examples.js +1 -1
- package/components/error-page/error-page.css +2 -2
- package/components/footer-ng/footer-ng.js +13 -3
- package/components/form/form.css +2 -2
- package/components/form-ng/form-ng.js +3 -1
- package/components/global/global.css +1 -1
- package/components/global/theme.js +1 -1
- package/components/global/variables.css +8 -1
- package/components/grid/grid.css +10 -9
- package/components/header/header.css +1 -1
- package/components/header/header.examples.js +7 -8
- package/components/header/profile.js +10 -11
- package/components/http/http.js +1 -1
- package/components/icon/icon.css +5 -4
- package/components/input/input-legacy.css +7 -7
- package/components/island/header.js +2 -2
- package/components/island/island.css +8 -3
- package/components/island-legacy/island-legacy.css +3 -1
- package/components/list/list.js +6 -1
- package/components/list/list__custom.js +9 -3
- package/components/list/list__item.js +8 -2
- package/components/list/list__link.js +2 -1
- package/components/loader-inline/loader-inline.css +1 -1
- package/components/loader-screen/loader-screen.css +1 -1
- package/components/message/message.css +1 -1
- package/components/message/message.examples.js +8 -7
- package/components/pager/pager.js +5 -3
- package/components/permissions/permissions.js +1 -1
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.test.js +15 -13
- package/components/progress-bar/progress-bar.css +1 -1
- package/components/progress-bar/progress-bar.examples.js +3 -3
- package/components/progress-bar/progress-bar.js +5 -2
- package/components/progress-bar/progress-bar.test.js +12 -13
- package/components/progress-bar-ng/progress-bar-ng.examples.js +3 -3
- package/components/query-assist/query-assist.css +13 -3
- package/components/query-assist/query-assist.examples.js +3 -4
- package/components/query-assist/query-assist.js +56 -12
- package/components/query-assist/query-assist.test.js +37 -5
- package/components/save-field-ng/save-field-ng.css +0 -3
- package/components/save-field-ng/save-field-ng.js +3 -1
- package/components/save-field-ng/{save-field-ng.html → save-field-ng__template.js} +2 -2
- package/components/select/select.css +12 -7
- package/components/select/select.examples.js +13 -0
- package/components/select/select.js +30 -43
- package/components/select/select.test.js +4 -5
- package/components/select/select__popup.js +1 -0
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.css +1 -1
- package/components/shortcuts-hint-ng/shortcuts-hint-ng.js +1 -1
- package/components/shortcuts-hint-ng/{shortcuts-hint-ng.html → shortcuts-hint-ng__template.js} +2 -2
- package/components/sidebar/sidebar.css +1 -0
- package/components/sidebar-ng/sidebar-ng.js +6 -2
- package/components/sidebar-ng/{sidebar-ng__button.html → sidebar-ng__button-template.js} +2 -2
- package/components/sidebar-ng/{sidebar-ng.html → sidebar-ng__template.js} +2 -2
- package/components/table/header.js +9 -1
- package/components/table/row.js +2 -1
- package/components/table/table.css +2 -1
- package/components/table-legacy/table-legacy.css +2 -2
- package/components/table-legacy/table-legacy__toolbar.css +2 -2
- package/components/table-legacy-ng/table-legacy-ng.js +38 -5
- package/components/table-legacy-ng/table-legacy-ng__pager.js +7 -1
- package/components/tabs/collapsible-tab.js +2 -2
- package/components/tabs/collapsible-tabs.js +5 -9
- package/components/tabs/tab-link.js +4 -2
- package/components/tabs/tabs.css +32 -5
- package/components/tabs-ng/tabs-ng.js +4 -2
- package/components/tabs-ng/{tabs-ng.html → tabs-ng__template.js} +6 -2
- package/components/tag/tag.css +5 -2
- package/components/tag/tag.examples.js +3 -0
- package/components/tag/tag.js +19 -16
- package/components/tags-input/tag-input.examples.js +1 -1
- package/components/tags-input/tags-input.js +5 -2
- package/components/template-ng/template-ng.js +1 -1
- package/components/tooltip/tooltip.js +7 -2
- package/components/user-agreement/user-agreement.css +1 -5
- package/components/user-agreement/user-agreement.examples.js +7 -6
- package/components/user-agreement/user-agreement.js +11 -3
- package/package.json +85 -83
- package/webpack.config.js +14 -10
- package/components/button-set-ng/button-set-ng.html +0 -1
- package/components/footer-ng/footer-ng.html +0 -13
- package/components/form-ng/form-ng__error-bubble.html +0 -3
- package/components/table-legacy-ng/table-legacy-ng.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__column.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__header.html +0 -4
- package/components/table-legacy-ng/table-legacy-ng__pager.html +0 -7
- package/components/table-legacy-ng/table-legacy-ng__row.html +0 -12
- package/components/table-legacy-ng/table-legacy-ng__title.html +0 -9
- package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -123
- package/dist/_helpers/background-flow.js +0 -232
- package/dist/_helpers/badge.js +0 -3
- package/dist/_helpers/button.js +0 -145
- package/dist/_helpers/clickableLink.js +0 -65
- package/dist/_helpers/data-tests.js +0 -15
- package/dist/_helpers/disable-hover-hoc.js +0 -407
- package/dist/_helpers/dom.js +0 -101
- package/dist/_helpers/get-uid.js +0 -15
- package/dist/_helpers/linear-function.js +0 -17
- package/dist/_helpers/list.js +0 -1327
- package/dist/_helpers/logo.js +0 -36
- package/dist/_helpers/memoize.js +0 -17
- package/dist/_helpers/popup.js +0 -691
- package/dist/_helpers/popup.target.js +0 -27
- package/dist/_helpers/rerender-hoc.js +0 -49
- package/dist/_helpers/schedule-raf.js +0 -31
- package/dist/_helpers/sniffer.js +0 -6
- package/dist/_helpers/theme.js +0 -40
- package/dist/_helpers/url.js +0 -125
- package/dist/alert-service.js +0 -149
- package/dist/alert.js +0 -284
- package/dist/analytics.js +0 -116
- package/dist/auth-dialog-service.js +0 -56
- package/dist/auth-dialog.js +0 -122
- package/dist/auth.js +0 -1744
- package/dist/avatar.js +0 -152
- package/dist/badge.js +0 -52
- package/dist/button-group.js +0 -48
- package/dist/button-set.js +0 -27
- package/dist/button-toolbar.js +0 -30
- package/dist/button.js +0 -12
- package/dist/caret.js +0 -262
- package/dist/checkbox.js +0 -108
- package/dist/confirm-service.js +0 -102
- package/dist/confirm.js +0 -113
- package/dist/content-layout.js +0 -184
- package/dist/contenteditable.js +0 -81
- package/dist/data-list.js +0 -466
- package/dist/date-picker.js +0 -1398
- package/dist/dialog.js +0 -223
- package/dist/dropdown.js +0 -250
- package/dist/error-bubble.js +0 -56
- package/dist/error-message.js +0 -53
- package/dist/footer.js +0 -124
- package/dist/grid.js +0 -148
- package/dist/group.js +0 -34
- package/dist/header.js +0 -658
- package/dist/heading.js +0 -76
- package/dist/http.js +0 -207
- package/dist/hub-source.js +0 -130
- package/dist/icon.js +0 -211
- package/dist/input.js +0 -228
- package/dist/island.js +0 -314
- package/dist/link.js +0 -117
- package/dist/list.js +0 -29
- package/dist/loader-inline.js +0 -165
- package/dist/loader-screen.js +0 -45
- package/dist/loader.js +0 -338
- package/dist/login-dialog.js +0 -173
- package/dist/logo.js +0 -8
- package/dist/message.js +0 -226
- package/dist/old-browsers-message.js +0 -129
- package/dist/pager.js +0 -325
- package/dist/panel.js +0 -34
- package/dist/permissions.js +0 -466
- package/dist/popup-menu.js +0 -93
- package/dist/popup.js +0 -16
- package/dist/progress-bar.js +0 -111
- package/dist/proxy-attrs.js +0 -19
- package/dist/query-assist.js +0 -1081
- package/dist/radio.js +0 -112
- package/dist/select.js +0 -1920
- package/dist/selection.js +0 -213
- package/dist/shortcuts.js +0 -307
- package/dist/storage.js +0 -373
- package/dist/style.css +0 -1
- package/dist/tab-trap.js +0 -174
- package/dist/table.js +0 -903
- package/dist/tabs.js +0 -721
- package/dist/tag.js +0 -187
- package/dist/tags-input.js +0 -440
- package/dist/tags-list.js +0 -91
- package/dist/text.js +0 -38
- package/dist/toggle.js +0 -80
- package/dist/tooltip.js +0 -202
- package/dist/user-card.js +0 -218
package/dist/pager.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import { b as _defineProperty, a as _extends } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import chevronLeftIcon from '@jetbrains/icons/chevron-left';
|
|
6
|
-
import chevronRightIcon from '@jetbrains/icons/chevron-right';
|
|
7
|
-
import { B as Button } from './_helpers/button.js';
|
|
8
|
-
import ButtonGroup from './button-group.js';
|
|
9
|
-
import ButtonToolbar from './button-toolbar.js';
|
|
10
|
-
import Select from './select.js';
|
|
11
|
-
import { m as memoize } from './_helpers/memoize.js';
|
|
12
|
-
import Link from './link.js';
|
|
13
|
-
import Icon from './icon.js';
|
|
14
|
-
import 'focus-visible';
|
|
15
|
-
import '@jetbrains/icons/chevron-10px';
|
|
16
|
-
import './_helpers/theme.js';
|
|
17
|
-
import './_helpers/clickableLink.js';
|
|
18
|
-
import '@jetbrains/icons/close';
|
|
19
|
-
import 'deep-equal';
|
|
20
|
-
import './dropdown.js';
|
|
21
|
-
import './_helpers/data-tests.js';
|
|
22
|
-
import 'util-deprecate';
|
|
23
|
-
import './avatar.js';
|
|
24
|
-
import './_helpers/url.js';
|
|
25
|
-
import './_helpers/dom.js';
|
|
26
|
-
import './_helpers/popup.js';
|
|
27
|
-
import 'react-dom';
|
|
28
|
-
import './_helpers/get-uid.js';
|
|
29
|
-
import './_helpers/schedule-raf.js';
|
|
30
|
-
import './shortcuts.js';
|
|
31
|
-
import 'combokeys';
|
|
32
|
-
import './_helpers/sniffer.js';
|
|
33
|
-
import 'sniffr';
|
|
34
|
-
import './tab-trap.js';
|
|
35
|
-
import './_helpers/popup.target.js';
|
|
36
|
-
import './_helpers/list.js';
|
|
37
|
-
import 'react-virtualized/dist/es/List';
|
|
38
|
-
import 'react-virtualized/dist/es/AutoSizer';
|
|
39
|
-
import 'react-virtualized/dist/es/WindowScroller';
|
|
40
|
-
import 'react-virtualized/dist/es/CellMeasurer';
|
|
41
|
-
import 'memoize-one';
|
|
42
|
-
import './checkbox.js';
|
|
43
|
-
import '@jetbrains/icons/checkmark';
|
|
44
|
-
import '@jetbrains/icons/remove-10px';
|
|
45
|
-
import './input.js';
|
|
46
|
-
import './_helpers/rerender-hoc.js';
|
|
47
|
-
import '@jetbrains/icons/search';
|
|
48
|
-
import './loader-inline.js';
|
|
49
|
-
import 'conic-gradient';
|
|
50
|
-
import './tags-list.js';
|
|
51
|
-
import './tag.js';
|
|
52
|
-
import './caret.js';
|
|
53
|
-
import './text.js';
|
|
54
|
-
|
|
55
|
-
var modules_1a5f0d42 = {"unit":"8px","pager":"pager_pager__4d141e8d","links":"pager_links__4d141e8d","link":"pager_link__4d141e8d","linkDisabled":"pager_linkDisabled__4d141e8d"};
|
|
56
|
-
|
|
57
|
-
class Pager extends PureComponent {
|
|
58
|
-
constructor(...args) {
|
|
59
|
-
super(...args);
|
|
60
|
-
|
|
61
|
-
_defineProperty(this, "handlePageSizeChange", item => {
|
|
62
|
-
this.props.onPageSizeChange(item.key);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
_defineProperty(this, "handlePrevClick", () => {
|
|
66
|
-
const {
|
|
67
|
-
currentPage
|
|
68
|
-
} = this.props;
|
|
69
|
-
|
|
70
|
-
if (currentPage !== 1) {
|
|
71
|
-
const prevPage = currentPage - 1;
|
|
72
|
-
this.props.onPageChange(prevPage);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
_defineProperty(this, "handleNextClick", () => {
|
|
77
|
-
const {
|
|
78
|
-
currentPage,
|
|
79
|
-
onLoadPage
|
|
80
|
-
} = this.props;
|
|
81
|
-
const nextPage = currentPage + 1;
|
|
82
|
-
const total = this.getTotal();
|
|
83
|
-
|
|
84
|
-
if (currentPage !== total) {
|
|
85
|
-
this.props.onPageChange(nextPage);
|
|
86
|
-
} else if (this.props.openTotal) {
|
|
87
|
-
onLoadPage(nextPage);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
_defineProperty(this, "handlePageChange", memoize(i => event => {
|
|
92
|
-
this.props.onPageChange(i, event);
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
_defineProperty(this, "handleLoadMore", memoize(i => () => {
|
|
96
|
-
this.props.onLoadPage(i);
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
getSelectOptions() {
|
|
101
|
-
const {
|
|
102
|
-
pageSize,
|
|
103
|
-
pageSizes
|
|
104
|
-
} = this.props;
|
|
105
|
-
const data = pageSizes.map(size => ({
|
|
106
|
-
key: size,
|
|
107
|
-
label: `${size} ${this.props.translations.perPage}`
|
|
108
|
-
}));
|
|
109
|
-
const selected = data.find(it => it.key === pageSize);
|
|
110
|
-
return {
|
|
111
|
-
selected,
|
|
112
|
-
data
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
getTotal() {
|
|
117
|
-
const {
|
|
118
|
-
total,
|
|
119
|
-
pageSize
|
|
120
|
-
} = this.props;
|
|
121
|
-
return Math.ceil(total / pageSize);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
getButton(page, content, key, active) {
|
|
125
|
-
return /*#__PURE__*/React.createElement(Button, _extends({
|
|
126
|
-
href: this.generateHref(page),
|
|
127
|
-
key: key,
|
|
128
|
-
active: active,
|
|
129
|
-
disabled: this.props.loader && !active,
|
|
130
|
-
loader: this.props.loader && active
|
|
131
|
-
}, this.getClickProps(this.handlePageChange(page))), content);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
getClickProps(onClick) {
|
|
135
|
-
const {
|
|
136
|
-
hrefFunc,
|
|
137
|
-
onPageChange
|
|
138
|
-
} = this.props;
|
|
139
|
-
|
|
140
|
-
if (!onPageChange) {
|
|
141
|
-
return {};
|
|
142
|
-
} else if (hrefFunc) {
|
|
143
|
-
return {
|
|
144
|
-
onPlainLeftClick: onClick
|
|
145
|
-
};
|
|
146
|
-
} else {
|
|
147
|
-
return {
|
|
148
|
-
onClick
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
getPageSizeSelector() {
|
|
154
|
-
const selectOptions = this.getSelectOptions();
|
|
155
|
-
return !this.props.disablePageSizeSelector && /*#__PURE__*/React.createElement("div", {
|
|
156
|
-
"data-test": "ring-pager-page-size-selector",
|
|
157
|
-
style: {
|
|
158
|
-
float: 'right'
|
|
159
|
-
}
|
|
160
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
161
|
-
data: selectOptions.data,
|
|
162
|
-
selected: selectOptions.selected,
|
|
163
|
-
onSelect: this.handlePageSizeChange,
|
|
164
|
-
type: Select.Type.INLINE,
|
|
165
|
-
disabled: this.props.loader
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
getPagerLinks() {
|
|
170
|
-
const prevLinkAvailable = this.props.currentPage !== 1;
|
|
171
|
-
const nextLinkAvailable = this.props.openTotal || this.props.currentPage !== this.getTotal();
|
|
172
|
-
const nextIcon = /*#__PURE__*/React.createElement(Icon, {
|
|
173
|
-
glyph: chevronRightIcon,
|
|
174
|
-
key: "icon"
|
|
175
|
-
});
|
|
176
|
-
const prevIcon = /*#__PURE__*/React.createElement(Icon, {
|
|
177
|
-
glyph: chevronLeftIcon,
|
|
178
|
-
key: "icon"
|
|
179
|
-
});
|
|
180
|
-
const prevText = this.props.translations.previousPage;
|
|
181
|
-
const nextText = this.props.translations.nextPage;
|
|
182
|
-
|
|
183
|
-
const nextLinkContent = WrapText => [/*#__PURE__*/React.createElement("span", {
|
|
184
|
-
key: "text"
|
|
185
|
-
}, /*#__PURE__*/React.createElement(WrapText, null, nextText)), nextIcon];
|
|
186
|
-
|
|
187
|
-
const prevLinkContent = WrapText => [prevIcon, /*#__PURE__*/React.createElement("span", {
|
|
188
|
-
key: "text"
|
|
189
|
-
}, /*#__PURE__*/React.createElement(WrapText, null, prevText))];
|
|
190
|
-
|
|
191
|
-
const prevLinkHref = this.generateHref(this.props.currentPage - 1);
|
|
192
|
-
const nextLinkHref = this.generateHref(this.props.currentPage + 1);
|
|
193
|
-
const disabledLinkClasses = classNames({
|
|
194
|
-
[modules_1a5f0d42.link]: true,
|
|
195
|
-
[modules_1a5f0d42.linkDisabled]: true
|
|
196
|
-
});
|
|
197
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
198
|
-
className: modules_1a5f0d42.links
|
|
199
|
-
}, prevLinkAvailable && !this.props.loader ? /*#__PURE__*/React.createElement(Link, _extends({
|
|
200
|
-
href: prevLinkHref,
|
|
201
|
-
className: modules_1a5f0d42.link
|
|
202
|
-
}, this.getClickProps(this.handlePrevClick)), prevLinkContent) : /*#__PURE__*/React.createElement("span", {
|
|
203
|
-
className: disabledLinkClasses
|
|
204
|
-
}, prevIcon, /*#__PURE__*/React.createElement("span", {
|
|
205
|
-
key: "text"
|
|
206
|
-
}, prevText)), nextLinkAvailable && !this.props.loader ? /*#__PURE__*/React.createElement(Link, _extends({
|
|
207
|
-
href: nextLinkHref,
|
|
208
|
-
className: modules_1a5f0d42.link
|
|
209
|
-
}, this.getClickProps(this.handleNextClick)), nextLinkContent) : /*#__PURE__*/React.createElement("span", {
|
|
210
|
-
className: disabledLinkClasses
|
|
211
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
212
|
-
key: "text"
|
|
213
|
-
}, nextText), nextIcon));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
generateHref(page) {
|
|
217
|
-
if (this.props.hrefFunc === undefined) {
|
|
218
|
-
return undefined;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const pageSize = this.props.disablePageSizeSelector ? undefined : this.props.pageSize;
|
|
222
|
-
return this.props.hrefFunc(page, pageSize);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
getPagerContent() {
|
|
226
|
-
const {
|
|
227
|
-
currentPage,
|
|
228
|
-
visiblePagesLimit
|
|
229
|
-
} = this.props;
|
|
230
|
-
const totalPages = this.getTotal();
|
|
231
|
-
|
|
232
|
-
if (totalPages < 2 && !this.props.openTotal) {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let start = 1;
|
|
237
|
-
let end = totalPages; // eslint-disable-next-line no-magic-numbers
|
|
238
|
-
|
|
239
|
-
if (totalPages >= visiblePagesLimit + 6) {
|
|
240
|
-
const leftHalfFrameSize = Math.ceil(visiblePagesLimit / 2) - 1;
|
|
241
|
-
const rightHalfFrameSize = visiblePagesLimit - leftHalfFrameSize - 1;
|
|
242
|
-
start = currentPage - leftHalfFrameSize;
|
|
243
|
-
end = currentPage + rightHalfFrameSize;
|
|
244
|
-
|
|
245
|
-
if (start < 1) {
|
|
246
|
-
const tail = 1 - start;
|
|
247
|
-
start += tail;
|
|
248
|
-
end += tail;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (end > totalPages) {
|
|
252
|
-
const tail = end - totalPages;
|
|
253
|
-
start -= tail;
|
|
254
|
-
end -= tail;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (start < 1) {
|
|
258
|
-
start += 1 - start;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const buttons = [];
|
|
263
|
-
|
|
264
|
-
for (let i = start; i <= end; i++) {
|
|
265
|
-
buttons.push(this.getButton(i, i, i, i === currentPage));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const lastPageButtonAvailable = end < totalPages && !this.props.openTotal || this.props.openTotal && this.props.canLoadLastPageWithOpenTotal;
|
|
269
|
-
return /*#__PURE__*/React.createElement("div", null, this.getPagerLinks(), /*#__PURE__*/React.createElement(ButtonToolbar, null, start > 1 && /*#__PURE__*/React.createElement(ButtonGroup, null, this.getButton(1, this.props.translations.firstPage)), /*#__PURE__*/React.createElement(ButtonGroup, null, start > 1 && this.getButton(start - 1, '...'), buttons, end < totalPages && this.getButton(end + 1, '...'), end === totalPages && this.props.openTotal && /*#__PURE__*/React.createElement(Button, _extends({
|
|
270
|
-
href: this.generateHref(end + 1),
|
|
271
|
-
disabled: this.props.loader
|
|
272
|
-
}, this.getClickProps(this.handleLoadMore(end + 1))), '...')), lastPageButtonAvailable && /*#__PURE__*/React.createElement(ButtonGroup, null, this.getButton(this.props.openTotal ? -1 : totalPages, this.props.translations.lastPage))), this.getPageSizeSelector());
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
render() {
|
|
276
|
-
const classes = classNames(modules_1a5f0d42.pager, this.props.className);
|
|
277
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
278
|
-
"data-test": "ring-pager",
|
|
279
|
-
className: classes
|
|
280
|
-
}, this.props.total > 1 ? this.getPagerContent() : this.getPageSizeSelector());
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
_defineProperty(Pager, "propTypes", {
|
|
286
|
-
total: PropTypes.number.isRequired,
|
|
287
|
-
currentPage: PropTypes.number,
|
|
288
|
-
pageSize: PropTypes.number,
|
|
289
|
-
pageSizes: PropTypes.arrayOf(PropTypes.number),
|
|
290
|
-
visiblePagesLimit: PropTypes.number,
|
|
291
|
-
disablePageSizeSelector: PropTypes.bool,
|
|
292
|
-
openTotal: PropTypes.bool,
|
|
293
|
-
canLoadLastPageWithOpenTotal: PropTypes.bool,
|
|
294
|
-
onPageChange: PropTypes.func,
|
|
295
|
-
onPageSizeChange: PropTypes.func,
|
|
296
|
-
onLoadPage: PropTypes.func,
|
|
297
|
-
className: PropTypes.string,
|
|
298
|
-
translations: PropTypes.object,
|
|
299
|
-
loader: PropTypes.bool,
|
|
300
|
-
hrefFunc: PropTypes.func //function which generates href for all pager's buttons based on pager state passed as a function parameter, either this function or onPageChange should be provided
|
|
301
|
-
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
_defineProperty(Pager, "defaultProps", {
|
|
305
|
-
currentPage: 1,
|
|
306
|
-
pageSize: 50,
|
|
307
|
-
// eslint-disable-next-line no-magic-numbers
|
|
308
|
-
pageSizes: [20, 50, 100],
|
|
309
|
-
visiblePagesLimit: 7,
|
|
310
|
-
disablePageSizeSelector: false,
|
|
311
|
-
openTotal: false,
|
|
312
|
-
canLoadLastPageWithOpenTotal: false,
|
|
313
|
-
translations: {
|
|
314
|
-
perPage: 'per page',
|
|
315
|
-
firstPage: 'First page',
|
|
316
|
-
lastPage: 'Last page',
|
|
317
|
-
nextPage: 'Next page',
|
|
318
|
-
previousPage: 'Previous'
|
|
319
|
-
},
|
|
320
|
-
loader: false,
|
|
321
|
-
onPageSizeChange: () => {},
|
|
322
|
-
onLoadPage: () => {}
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
export default Pager;
|
package/dist/panel.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties, a as _extends, b as _defineProperty } from './_helpers/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
|
|
6
|
-
var modules_cf670408 = {"unit":"8px","panel":"panel_panel__559bc5c3 dialog_panel__16e57f84"};
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @name Panel
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
class Panel extends PureComponent {
|
|
13
|
-
render() {
|
|
14
|
-
const _this$props = this.props,
|
|
15
|
-
{
|
|
16
|
-
className,
|
|
17
|
-
children
|
|
18
|
-
} = _this$props,
|
|
19
|
-
props = _objectWithoutProperties(_this$props, ["className", "children"]);
|
|
20
|
-
|
|
21
|
-
const classes = classNames(modules_cf670408.panel, className);
|
|
22
|
-
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
23
|
-
className: classes
|
|
24
|
-
}), children);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_defineProperty(Panel, "propTypes", {
|
|
30
|
-
className: PropTypes.string,
|
|
31
|
-
children: PropTypes.node
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export default Panel;
|