diginet-core-ui 1.3.24 → 1.3.29

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.
Files changed (153) hide show
  1. package/assets/fonts/SF-Pro-Display-Bold.otf +0 -0
  2. package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
  3. package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
  4. package/assets/images/icons/wifi.svg +3 -0
  5. package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
  6. package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
  7. package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
  8. package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
  9. package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
  10. package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
  11. package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
  12. package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
  13. package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
  14. package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
  15. package/assets/images/menu/dhr/TASK.svg +9 -0
  16. package/assets/images/menu/erp/D05.svg +8 -0
  17. package/assets/images/menu/erp/D06.svg +4 -0
  18. package/assets/images/menu/erp/D90R.svg +9 -0
  19. package/assets/images/menu/erp/DBC.svg +9 -0
  20. package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
  21. package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
  22. package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
  23. package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
  24. package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
  25. package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
  26. package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
  27. package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
  28. package/components/accordion/css.js +42 -33
  29. package/components/accordion/details.js +29 -17
  30. package/components/accordion/group.js +23 -23
  31. package/components/accordion/index.js +36 -27
  32. package/components/accordion/summary.js +10 -11
  33. package/components/alert/index.js +97 -91
  34. package/components/alert/notify.js +10 -8
  35. package/components/avatar/index.js +19 -17
  36. package/components/badge/index.js +122 -139
  37. package/components/button/icon.js +242 -334
  38. package/components/button/index.js +272 -427
  39. package/components/button/more.js +4 -5
  40. package/components/button/ripple-effect.js +4 -6
  41. package/components/card/body-card.js +4 -6
  42. package/components/card/card.js +4 -8
  43. package/components/card/index.js +4 -5
  44. package/components/chart/Pie/Sector.js +4 -5
  45. package/components/chart/Pie/Sectors.js +5 -5
  46. package/components/chart/Pie/index.js +8 -9
  47. package/components/chart/Pie-v2/Sector.js +4 -5
  48. package/components/chart/Pie-v2/Sectors.js +7 -8
  49. package/components/chart/Pie-v2/index.js +11 -16
  50. package/components/chart/bar/Bar.js +2 -3
  51. package/components/chart/bar/Labels.js +9 -11
  52. package/components/chart/bar/index.js +17 -9
  53. package/components/chart/bar-v2/Bar.js +2 -3
  54. package/components/chart/bar-v2/Labels.js +9 -11
  55. package/components/chart/bar-v2/index.js +17 -9
  56. package/components/chart/line/Labels.js +8 -10
  57. package/components/chart/line/Point.js +2 -3
  58. package/components/chart/line/index.js +17 -9
  59. package/components/chart/line-v2/Labels.js +8 -10
  60. package/components/chart/line-v2/Point.js +2 -3
  61. package/components/chart/line-v2/index.js +17 -9
  62. package/components/chip/attach.js +12 -16
  63. package/components/chip/index.js +8 -11
  64. package/components/collapse/index.js +4 -5
  65. package/components/divider/index.js +27 -14
  66. package/components/form-control/attachment/index.js +143 -87
  67. package/components/form-control/calendar/function.js +24 -23
  68. package/components/form-control/calendar/index.js +2 -4
  69. package/components/form-control/calendar/range.js +3 -4
  70. package/components/form-control/checkbox/index.js +85 -71
  71. package/components/form-control/control/index.js +4 -6
  72. package/components/form-control/date-picker/index-old.js +0 -2
  73. package/components/form-control/date-picker/index.js +39 -43
  74. package/components/form-control/date-range-picker/index.js +26 -28
  75. package/components/form-control/dropdown/index.js +173 -202
  76. package/components/form-control/dropdown-box/index.js +72 -49
  77. package/components/form-control/form-group/index.js +4 -5
  78. package/components/form-control/helper-text/index.js +4 -5
  79. package/components/form-control/input-base/index.js +28 -38
  80. package/components/form-control/label/index.js +23 -13
  81. package/components/form-control/money-input/index.js +6 -6
  82. package/components/form-control/number-input/index.js +12 -14
  83. package/components/form-control/phone-input/index.js +4 -5
  84. package/components/form-control/radio/index.js +7 -15
  85. package/components/form-control/text-input/index.js +14 -24
  86. package/components/form-control/time-picker/index.js +15 -26
  87. package/components/form-control/time-picker/swiper.js +2 -4
  88. package/components/form-control/toggle/index.js +22 -18
  89. package/components/form-view/helper-text.js +4 -5
  90. package/components/form-view/index.js +4 -5
  91. package/components/form-view/input.js +5 -7
  92. package/components/form-view/label.js +2 -6
  93. package/components/list/list-item-action.js +7 -8
  94. package/components/list/list-item-icon.js +4 -5
  95. package/components/list/list-item-text.js +4 -5
  96. package/components/list/list-item.js +4 -5
  97. package/components/list/list.js +4 -5
  98. package/components/list/sub-header.js +4 -5
  99. package/components/modal/body.js +4 -6
  100. package/components/modal/footer.js +4 -6
  101. package/components/modal/header.js +8 -14
  102. package/components/modal/index.js +4 -5
  103. package/components/modal/modal.js +6 -13
  104. package/components/others/extra/index.js +4 -8
  105. package/components/others/option-wrapper/index.js +57 -0
  106. package/components/others/scrollbar/index.js +4 -5
  107. package/components/paging/page-info.js +282 -231
  108. package/components/paging/page-selector.js +4 -7
  109. package/components/popover/index.js +6 -7
  110. package/components/popup/danger_popup.js +8 -18
  111. package/components/popup/index.js +26 -34
  112. package/components/popup/proposals_popup.js +9 -16
  113. package/components/popup/v2/danger-popup.js +4 -6
  114. package/components/popup/v2/index.js +116 -98
  115. package/components/popup/v2/info-popup.js +4 -6
  116. package/components/popup/v2/success-popup.js +4 -6
  117. package/components/popup/v2/warning-popup.js +4 -6
  118. package/components/popup/v2/yes-no-popup.js +4 -6
  119. package/components/progress/circular.js +17 -26
  120. package/components/progress/linear.js +11 -13
  121. package/components/rating/index.js +114 -233
  122. package/components/slider/slider-container.js +15 -10
  123. package/components/slider/slider-item.js +10 -12
  124. package/components/status/index.js +63 -57
  125. package/components/tab/tab-container.js +26 -24
  126. package/components/tab/tab-header.js +36 -27
  127. package/components/tab/tab-panel.js +32 -15
  128. package/components/tab/tab.js +79 -80
  129. package/components/tooltip/index.js +4 -4
  130. package/components/transfer/index.js +10 -11
  131. package/components/tree-view/css.js +2 -0
  132. package/components/tree-view/index.js +14 -13
  133. package/components/typography/index.js +6 -112
  134. package/css/styles.css +1 -1
  135. package/css/styles.css.map +1 -1
  136. package/global/index.js +2 -0
  137. package/icons/basic.js +1648 -959
  138. package/icons/effect.js +45 -103
  139. package/package.json +1 -1
  140. package/readme.md +66 -0
  141. package/styles/color-helper.js +7 -146
  142. package/styles/colors.js +6 -2
  143. package/styles/font.js +9 -0
  144. package/styles/general.js +100 -7
  145. package/styles/typography.js +25 -26
  146. package/theme/settings.js +9 -2
  147. package/theme/theme-provider.js +15 -7
  148. package/theme/with-styles.js +2 -4
  149. package/theme/with-theme.js +2 -4
  150. package/utils/isMobile.js +21 -0
  151. package/utils/renderHTML.js +4 -5
  152. package/utils/renderIcon.js +15 -11
  153. package/utils/updatePosition.js +2 -2
@@ -1,275 +1,332 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
6
- import { memo, useRef, useEffect, useMemo, forwardRef as _nonUse } from 'react';
4
+ import { memo, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
- import theme from '../../theme/settings';
10
- import { Typography } from '../';
11
- import { ArrowLeft, ArrowRight } from '../../icons';
12
- import locale from '../../locale';
7
+ import { ButtonIcon, NumberInput, Dropdown } from '../';
13
8
  import { getGlobal } from '../../global';
14
- let timer = null;
15
- const PagingInfo = /*#__PURE__*/memo(({
16
- fullWidth,
17
- size,
9
+ import { typography } from '../../styles/typography';
10
+ import { color as colors } from '../../styles/colors';
11
+ import { alignCenter, borderBox, borderRadius4px, flexRow, noMargin, noPadding, border, textCenter, outlineNone, backgroundTransparent, cursorPointer } from '../../styles/general';
12
+ import { hexToRGBA } from '../../styles/color-helper';
13
+ const {
14
+ paragraph2
15
+ } = typography;
16
+ const {
17
+ system: {
18
+ active
19
+ },
20
+ semantic: {
21
+ info
22
+ },
23
+ line: {
24
+ system,
25
+ normal
26
+ },
27
+ text: {
28
+ main
29
+ }
30
+ } = colors;
31
+
32
+ const getLastPage = (totalItems, itemsPerPage) => {
33
+ let _lastPage = 0;
34
+
35
+ if (totalItems && totalItems >= 0 && itemsPerPage && itemsPerPage > 0) {
36
+ _lastPage = Math.ceil(totalItems / itemsPerPage);
37
+ return _lastPage;
38
+ }
39
+
40
+ return _lastPage + 1;
41
+ };
42
+
43
+ let timeout = null;
44
+ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
45
+ typeShort,
18
46
  bgColor,
19
47
  style,
20
- language,
21
- currentPage,
48
+ className,
22
49
  totalItems,
23
50
  itemsPerPage,
24
- listItemsPerPage,
51
+ currentPage,
52
+ listPerPage,
25
53
  onChangePage,
26
- onChangeItemsPerPage,
27
- ...props
28
- }) => {
29
- const pageNumberRef = useRef(null);
30
- const ItemsPerPageRef = useRef(null);
31
- const totalItemRef = useRef(null);
32
- let currentPageNumber = null;
54
+ onChangePerPage
55
+ }, ref) => {
56
+ if (!ref) {
57
+ ref = useRef(null);
58
+ }
59
+
60
+ const [totalItemsState, setTotalItemsState] = useState(totalItems);
61
+ const [itemsPerPageState, setItemsPerPageState] = useState(itemsPerPage || listPerPage[0] || 10);
62
+ const [currentPageState, setCurrentPageState] = useState(currentPage);
63
+ const [listPerPageState, setListPerPageState] = useState(listPerPage);
64
+ const [disablePrevState, setDisablePrevState] = useState(true);
65
+ const [disableNextState, setDisableNextState] = useState(!(totalItems > itemsPerPage));
33
66
  const pagingInfo = css`
34
- display: ${fullWidth ? '' : 'inline-'}flex;
35
- align-items: center;
36
- font-family: ${theme.typography.fontFamily};
37
- font-size: ${size === 'small' ? '14px' : '16px'};
67
+ ${flexRow}
68
+ ${alignCenter}
69
+ ${paragraph2}
70
+ ${borderBox}
71
+ ${border(1, system)}
72
+ height: 40px;
73
+ border-left: none;
74
+ border-right: none;
75
+ padding: 4px 0;
38
76
  background-color: ${bgColor};
39
- `;
40
- const totalPage = css`
41
- display: flex;
42
- align-items: center;
43
- `;
44
- const iconPageCss = css`
45
- display: flex;
46
- cursor: pointer;
47
- `;
48
- const pageNumber = css`
49
- display: flex;
50
- margin: 0 ${size === 'small' ? 5 : 7}px;
51
- font-family: inherit;
52
- font-style: normal;
53
- font-weight: 500;
54
- font-size: inherit;
55
- color: ${theme.colors.primary};
56
- `;
57
- const currentPageNum = css`
58
- outline: none;
59
- margin-right: 5px;
60
- border-bottom: 1px solid transparent;
61
- text-align: center;
62
- min-width: 27px;
63
- border-bottom: 1px solid ${theme.colors.primary};
64
- &:focus {
65
- border-bottom-color: ${theme.colors.primary};
77
+ color: ${main};
78
+ .inputPage {
79
+ ${noMargin}
80
+ ${textCenter}
81
+ width: 1%;
82
+ min-width: 24px;
83
+ .DGN-UI-InputBase {
84
+ ${noPadding}
85
+ input {
86
+ ${paragraph2}
87
+ ${textCenter}
88
+ color: ${active};
89
+ }
90
+ }
91
+ }
92
+ .slash {
93
+ margin: 0 4px;
94
+ }
95
+ .txt-line-number {
96
+ margin-left: 16px;
97
+ }
98
+ .DGN-UI-Dropdown {
99
+ margin-bottom: 0;
100
+ margin-left: ${typeShort ? 0 : '8px'};
101
+ min-width: 56px;
102
+ .DGN-UI-Dropdown-Form {
103
+ min-height: 32px;
104
+ padding: 0 0 0 8px;
105
+ input {
106
+ ${paragraph2}
107
+ ${noPadding}
108
+ ${cursorPointer}
109
+ }
110
+ .DGN-UI-Dropdown-Icon {
111
+ margin-left: 6px;
112
+ margin-right: 6px;
113
+ }
114
+ }
115
+ }
116
+ /* .pagePer {
117
+ ${borderRadius4px}
118
+ ${borderBox}
119
+ ${paragraph2}
120
+ ${outlineNone}
121
+ ${backgroundTransparent}
122
+ ${border(1, normal)}
123
+ color: ${active};
124
+ margin-left: ${typeShort ? 0 : '8px'};
125
+ padding: 6px 6px 6px 8px;
126
+ min-width: 56px;
127
+ min-height: 32px;
128
+ width: max-content;
129
+ &:hover {
130
+ border-color: ${active};
131
+ background-color: ${hexToRGBA(active, 0.8)};
132
+ }
133
+ &:active,
134
+ &:focus {
135
+ border-color: ${info};
136
+ }
137
+ option {
138
+ ${paragraph2}
139
+ color: ${active};
140
+ background-color: white;
141
+ }
142
+ } */
143
+ .total-items {
144
+ margin-left: ${typeShort ? 0 : '16px'};
66
145
  }
67
- `;
68
- const lineNumberStyle = css`
69
- display: inline-flex;
70
- outline: none;
71
- color: ${theme.colors.input};
72
- margin: 0 16px;
73
- font-family: inherit;
74
- `;
75
- const listItemsPerPageStyle = css`
76
- height: 19px;
77
- min-width: 44px;
78
- width: max-content;
79
- font-family: inherit;
80
- font-style: normal;
81
- font-weight: 500;
82
- font-size: inherit;
83
- color: ${theme.colors.primary};
84
- background-color: inherit;
85
- border: none;
86
- outline: none;
87
146
  `;
88
147
 
89
- const onChangePageHandler = page => {
90
- const currentPageInput = pageNumberRef.current.textContent;
91
- const newPage = +currentPageInput + page;
92
- const lastPage = +pageNumberRef.current.parentNode.lastChild.textContent.replace('/ ', '');
93
- if (newPage < 1 || newPage > lastPage) return;
94
- pageNumberRef.current.textContent = newPage;
95
- currentPageNumber = newPage;
96
- !!onChangePage && onChangePage(newPage);
97
- };
148
+ const _onChangePage = (page, isInit = false) => {
149
+ const lastPage = getLastPage(totalItemsState, itemsPerPageState);
150
+ let disablePrev = false;
151
+ let disableNext = false; // If last page = 1. Disable all
98
152
 
99
- const onChangePageNumber = e => {
100
- let value = e.target.textContent;
101
- const lastPage = +pageNumberRef.current.parentNode.lastChild.textContent.replace('/ ', '');
102
- if (timer) clearTimeout(timer);
103
- timer = setTimeout(() => {
104
- if (value !== '' && !isNaN(value)) {
105
- if (value.includes('.')) {
106
- const index = value.indexOf('.');
107
-
108
- if (index !== -1) {
109
- value = value.slice(0, index);
110
- }
111
- }
153
+ if (lastPage === 1) {
154
+ disablePrev = true;
155
+ disableNext = true;
156
+ } // If current page = last page. Disable Next and Last
112
157
 
113
- if (+value < 0) {
114
- value = -value;
115
- } else if (+value === 0) {
116
- value = 1;
117
- }
118
158
 
119
- if (+value > lastPage) {
120
- value = lastPage;
121
- }
122
- } else {
123
- value = currentPage;
124
- }
159
+ if (page + 1 >= lastPage) {
160
+ disableNext = true;
161
+ } // If current page = 0. Disable Previous and First
125
162
 
126
- pageNumberRef.current.textContent = +value;
127
163
 
128
- if (currentPageNumber !== +value) {
129
- currentPageNumber = +value;
130
- !!onChangePage && onChangePage(+value);
131
- }
132
- }, [700]);
164
+ if (page === 0) {
165
+ disablePrev = true;
166
+ }
167
+
168
+ setCurrentPageState(page);
169
+ setDisablePrevState(disablePrev);
170
+ setDisableNextState(disableNext);
171
+ if (onChangePage && !isInit) onChangePage(page);
133
172
  };
134
173
 
135
- const onChangeItemsPerPageHandler = e => {
136
- const value = +e.target.value;
137
- const currentPageInput = +pageNumberRef.current.textContent;
138
- const newLastPage = Math.ceil(totalItems / value);
139
- pageNumberRef.current.parentNode.lastChild.textContent = '/ ' + newLastPage;
174
+ const _onChangePerPage = per => {
175
+ const lastPage = getLastPage(totalItemsState, per);
176
+ per = parseInt(per, 10);
177
+ let disableNext = false; // If last page = 1. Disable all
140
178
 
141
- if (currentPageInput > newLastPage) {
142
- onChangePageHandler(newLastPage - currentPageInput);
179
+ if (lastPage === 1) {
180
+ disableNext = true;
143
181
  }
144
182
 
145
- if (onChangeItemsPerPage) onChangeItemsPerPage(value, e.target);
183
+ setItemsPerPageState(per);
184
+ setCurrentPageState(0);
185
+ setDisablePrevState(true);
186
+ setDisableNextState(disableNext);
187
+ if (onChangePerPage) onChangePerPage(per);
188
+ };
189
+
190
+ const onTypePaging = (value, isInit = false) => {
191
+ clearTimeout(timeout);
192
+ const lastPage = getLastPage(totalItemsState, itemsPerPageState);
193
+ const page = !value || parseInt(value) < 0 ? 1 : parseInt(value) > lastPage ? lastPage : parseInt(value);
194
+ currentPage = page - 1;
195
+ timeout = setTimeout(() => {
196
+ _onChangePage(page - 1, isInit);
197
+ }, 500);
146
198
  };
147
199
 
148
200
  const checkKeyPress = e => {
149
- if (!/(\d)|(Arrow)|(Delete)|(Backspace)/.test(e.key)) {
201
+ if (/,/.test(e.key)) {
150
202
  e.preventDefault();
151
203
  }
152
204
  };
153
205
 
154
206
  useEffect(() => {
155
- const currentPageInput = pageNumberRef.current.textContent;
156
- const itemsPerPageInput = listItemsPerPage.some(i => +i === +itemsPerPage) ? itemsPerPage : listItemsPerPage[0];
157
- const newLastPage = Math.ceil(totalItems / itemsPerPageInput);
158
-
159
- if (currentPageInput > newLastPage) {
160
- onChangePageHandler(newLastPage - currentPageInput);
161
- }
162
-
163
- pageNumberRef.current.parentNode.lastChild.textContent = '/ ' + newLastPage;
164
- ItemsPerPageRef.current.value = itemsPerPageInput;
165
- totalItemRef.current.textContent = totalItems;
207
+ setTotalItemsState(totalItems);
208
+ }, [totalItems]);
209
+ useEffect(() => {
210
+ timeout = setTimeout(() => {
211
+ _onChangePage(0, true);
212
+ }, 500);
213
+ }, [totalItemsState, itemsPerPageState]);
214
+ useEffect(() => {
215
+ setItemsPerPageState(itemsPerPage);
166
216
  }, [itemsPerPage]);
167
217
  useEffect(() => {
168
- const currentPageInput = +pageNumberRef.current.textContent;
169
- const itemsPerPageInput = ItemsPerPageRef.current.value;
170
- const newLastPage = Math.ceil(totalItems / itemsPerPageInput);
218
+ setCurrentPageState(currentPage);
219
+ onTypePaging(currentPage + 1, true);
220
+ }, [currentPage]);
221
+ useEffect(() => {
222
+ setListPerPageState(listPerPage);
223
+ }, [listPerPage]);
224
+ useImperativeHandle(ref, () => {
225
+ const currentRef = ref.current || {};
171
226
 
172
- if (currentPageInput > newLastPage) {
173
- onChangePageHandler(newLastPage - currentPageInput);
174
- }
227
+ currentRef.onChangePage = page => _onChangePage(page);
175
228
 
176
- pageNumberRef.current.parentNode.lastChild.textContent = '/ ' + newLastPage;
177
- totalItemRef.current.textContent = totalItems;
178
- ItemsPerPageRef.current.addEventListener('change', onChangeItemsPerPageHandler);
179
- return () => {
180
- ItemsPerPageRef.current && ItemsPerPageRef.current.removeEventListener('change', onChangeItemsPerPageHandler);
181
- };
182
- }, [totalItems]);
183
- useEffect(() => {
184
- if (typeof currentPage === 'number') {
185
- const lastPage = +pageNumberRef.current.parentNode.lastChild.textContent.replace('/ ', '');
186
- const currentPageInput = pageNumberRef.current.textContent;
187
-
188
- if (currentPage > lastPage && currentPageInput) {
189
- onChangePageHandler(lastPage - +currentPageInput);
190
- } else if (currentPage < 1) {
191
- pageNumberRef.current.textContent = 1;
192
- !!onChangePage && onChangePage(1);
193
- } else {
194
- pageNumberRef.current.textContent = currentPage;
195
- }
196
- }
197
- }, [currentPage]);
198
- const TotalPageComp = useMemo(() => {
199
- return jsx("div", {
200
- css: totalPage
201
- }, jsx("div", {
202
- css: iconPageCss,
203
- onClick: () => onChangePageHandler(-1)
204
- }, jsx(ArrowLeft, {
205
- height: size === 'small' ? 20 : 24,
206
- width: size === 'small' ? 20 : 24,
207
- viewBox: true
208
- })), jsx("div", {
209
- css: pageNumber
210
- }, jsx("div", {
211
- ref: pageNumberRef,
212
- css: currentPageNum,
213
- contentEditable: true,
214
- onInput: onChangePageNumber,
215
- onKeyDown: checkKeyPress
216
- }), jsx("span", null)), jsx("div", {
217
- css: iconPageCss,
218
- onClick: () => onChangePageHandler(1)
219
- }, jsx(ArrowRight, {
220
- height: size === 'small' ? 20 : 24,
221
- width: size === 'small' ? 20 : 24,
222
- viewBox: true
223
- })));
224
- }, [size]);
225
- const LineNumber = useMemo(() => {
229
+ currentRef.onChangePerPage = per => _onChangePerPage(per);
230
+
231
+ currentRef.setTotalItems = items => setTotalItemsState(items);
232
+
233
+ return currentRef;
234
+ });
235
+ return useMemo(() => {
236
+ const lastPage = getLastPage(totalItemsState, itemsPerPageState);
237
+ let listPerPageData = [];
238
+ listPerPageState.map(item => listPerPageData = [...listPerPageData, {
239
+ name: item,
240
+ id: item
241
+ }]);
226
242
  return jsx("div", {
227
- css: lineNumberStyle
228
- }, jsx(Typography, {
229
- type: size === 'small' ? 'p2' : 'p1'
230
- }, getGlobal('lineNumber')), ": ", jsx("select", {
231
- css: listItemsPerPageStyle,
232
- defaultValue: itemsPerPage,
233
- ref: ItemsPerPageRef
234
- }, listItemsPerPage.map((list, index) => jsx("option", {
235
- key: list + index,
236
- value: list
237
- }, list))));
238
- }, [listItemsPerPage]);
239
- const TotalItemsComp = useMemo(() => {
240
- return jsx(Typography, {
241
- type: size === 'small' ? 'p2' : 'p1'
242
- }, getGlobal('total'), ": ", jsx("span", {
243
- ref: totalItemRef
244
- }));
245
- }, [size]);
246
- return jsx("div", _extends({
247
- css: pagingInfo,
248
- style: style
249
- }, props), TotalPageComp, LineNumber, TotalItemsComp);
250
- });
243
+ ref: ref,
244
+ css: pagingInfo,
245
+ style: style,
246
+ className: ['DGN-UI-PageInfo', className].join(' ').trim().replace(/\s+/g, ' ')
247
+ }, jsx(ButtonIcon, {
248
+ circular: true,
249
+ viewType: 'text',
250
+ size: 'small',
251
+ name: 'ArrowDoubleLeft',
252
+ disabled: disablePrevState,
253
+ onClick: () => _onChangePage(0)
254
+ }), jsx(ButtonIcon, {
255
+ circular: true,
256
+ viewType: 'text',
257
+ size: 'small',
258
+ name: 'ArrowLeft',
259
+ disabled: disablePrevState,
260
+ onClick: () => _onChangePage(currentPageState - 1)
261
+ }), jsx(NumberInput, {
262
+ disabledNegative: true,
263
+ className: 'inputPage',
264
+ value: currentPageState ? String(currentPageState + 1) : '1',
265
+ min: 1,
266
+ max: lastPage,
267
+ onKeyDown: checkKeyPress,
268
+ onChange: e => onTypePaging(e === null || e === void 0 ? void 0 : e.value)
269
+ }), "/", ` ${lastPage}`, jsx(ButtonIcon, {
270
+ circular: true,
271
+ viewType: 'text',
272
+ size: 'small',
273
+ name: 'ArrowRight',
274
+ disabled: disableNextState,
275
+ onClick: () => _onChangePage(currentPageState + 1)
276
+ }), jsx(ButtonIcon, {
277
+ circular: true,
278
+ viewType: 'text',
279
+ size: 'small',
280
+ name: 'ArrowDoubleRight',
281
+ disabled: disableNextState,
282
+ onClick: () => _onChangePage(lastPage - 1)
283
+ }), typeShort && jsx("span", {
284
+ className: 'slash'
285
+ }, "|"), !typeShort && jsx("span", {
286
+ className: "txt-line-number"
287
+ }, getGlobal('lineNumber')), jsx(Dropdown, {
288
+ viewType: 'outlined',
289
+ dataSource: listPerPageData,
290
+ defaultValue: itemsPerPageState,
291
+ onChange: e => _onChangePerPage(e === null || e === void 0 ? void 0 : e.value),
292
+ inputStyle: {
293
+ width: `${Math.max(...listPerPageState).toString().length}ch`
294
+ },
295
+ inputProps: {
296
+ readOnly: true
297
+ } // dropdownItemStyle={{padding: '4px 8px', minHeight: 18, color: active}}
298
+ ,
299
+ dropdownItemStyle: {
300
+ color: active
301
+ }
302
+ }), typeShort && jsx("span", {
303
+ className: 'slash'
304
+ }, "|"), jsx("span", {
305
+ className: 'total-items'
306
+ }, !typeShort ? getGlobal('total') + ':' : '', " ", totalItemsState));
307
+ }, [typeShort, bgColor, style, className, totalItemsState, itemsPerPageState, currentPageState, listPerPageState, disablePrevState, disableNextState]);
308
+ }));
251
309
  PagingInfo.defaultProps = {
252
- size: 'medium',
310
+ typeShort: false,
253
311
  bgColor: '#FFF',
254
- language: locale.get(),
255
- fullWidth: false,
256
- currentPage: 1,
312
+ style: {},
313
+ className: '',
257
314
  totalItems: 0,
258
- itemsPerPage: 10,
259
- listItemsPerPage: [10, 20, 40, 50]
315
+ currentPage: 0,
316
+ listPerPage: [10, 15, 20, 30, 50]
260
317
  };
261
318
  PagingInfo.propTypes = {
262
- /** allows maximum screen width if true */
263
- fullWidth: PropTypes.bool,
319
+ /** compact type for mobile */
320
+ typeShort: PropTypes.bool,
264
321
 
265
322
  /** background color for paging */
266
323
  bgColor: PropTypes.string,
267
324
 
268
- /** size of paging */
269
- size: PropTypes.oneOf(['small', 'medium']),
325
+ /** style inline for Paging */
326
+ style: PropTypes.object,
270
327
 
271
- /** language to display text on paging */
272
- language: PropTypes.oneOf(['vi', 'en']),
328
+ /** style inline for Paging */
329
+ className: PropTypes.string,
273
330
 
274
331
  /** current of paging */
275
332
  currentPage: PropTypes.number,
@@ -281,18 +338,12 @@ PagingInfo.propTypes = {
281
338
  itemsPerPage: PropTypes.number,
282
339
 
283
340
  /** the list to choose the number of elements to display per page */
284
- listItemsPerPage: PropTypes.array,
285
-
286
- /** style inline for Paging */
287
- style: PropTypes.object,
341
+ listPerPage: PropTypes.array,
288
342
 
289
343
  /** the function will run after change page number */
290
344
  onChangePage: PropTypes.func,
291
345
 
292
346
  /** the function will run after change quantity on per page */
293
- onChangeItemsPerPage: PropTypes.func,
294
-
295
- /** any props else */
296
- props: PropTypes.func
347
+ onChangePerPage: PropTypes.func
297
348
  };
298
349
  export default PagingInfo;
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -7,6 +5,7 @@ import React, { memo, useRef, useState, useEffect, forwardRef } from 'react';
7
5
  import PropTypes from 'prop-types';
8
6
  import { jsx, css } from '@emotion/core';
9
7
  import theme from '../../theme/settings';
8
+ import { typography } from '../../styles/typography';
10
9
  const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
11
10
  size,
12
11
  style,
@@ -25,9 +24,7 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
25
24
  const [paging, setPaging] = useState([1]);
26
25
  const PageItemNum = css`
27
26
  color: #FFF;
28
- font-family: ${theme.typography.fontFamily};
29
- font-style: normal;
30
- font-weight: bold;
27
+ ${typography.heading3};
31
28
  z-index: 1502;
32
29
  `;
33
30
  const morePaging = css`
@@ -238,13 +235,13 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
238
235
  css: PageItemNum
239
236
  }, page)))), jsx("p", null, "...")) : pageNum));
240
237
  });
241
- return jsx("div", _extends({}, props, {
238
+ return jsx("div", { ...props,
242
239
  ref: ref,
243
240
  style: {
244
241
  display: 'inline-flex',
245
242
  ...style
246
243
  }
247
- }), paging.map((pageNum, index) => jsx(RenderPageItem, {
244
+ }, paging.map((pageNum, index) => jsx(RenderPageItem, {
248
245
  key: index,
249
246
  pageNum: pageNum,
250
247
  style: pageItemStyle
@@ -1,5 +1,3 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  /** @jsxRuntime classic */
4
2
 
5
3
  /** @jsx jsx */
@@ -8,7 +6,7 @@ import { createPortal } from 'react-dom';
8
6
  import PropTypes from 'prop-types';
9
7
  import { jsx, css } from '@emotion/core';
10
8
  import { randomString } from '../../utils';
11
- import theme from '../../theme/settings';
9
+ import { typography } from "../../styles/typography";
12
10
  const timer = {};
13
11
  const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
12
  open,
@@ -55,7 +53,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
55
53
  display: block;
56
54
  position: relative;
57
55
  background-color: ${bgColor};
58
- font-family: ${theme.typography.fontFamily};
56
+ ${typography.paragraph1};
59
57
  width: 100%;
60
58
  height: 100%;
61
59
  box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
@@ -360,10 +358,11 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
360
358
  inset: 0,
361
359
  pointerEvents: fullScreen ? 'initial' : 'none'
362
360
  }
363
- }, jsx("div", _extends({
361
+ }, jsx("div", {
364
362
  css: PopoverContainer,
365
- ref: ref
366
- }, props), jsx("div", {
363
+ ref: ref,
364
+ ...props
365
+ }, jsx("div", {
367
366
  css: PopoverRoot,
368
367
  style: style
369
368
  }, arrow && jsx("span", {