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.
- package/assets/fonts/SF-Pro-Display-Bold.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
- package/assets/images/icons/wifi.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
- package/assets/images/menu/dhr/TASK.svg +9 -0
- package/assets/images/menu/erp/D05.svg +8 -0
- package/assets/images/menu/erp/D06.svg +4 -0
- package/assets/images/menu/erp/D90R.svg +9 -0
- package/assets/images/menu/erp/DBC.svg +9 -0
- package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
- package/components/accordion/css.js +42 -33
- package/components/accordion/details.js +29 -17
- package/components/accordion/group.js +23 -23
- package/components/accordion/index.js +36 -27
- package/components/accordion/summary.js +10 -11
- package/components/alert/index.js +97 -91
- package/components/alert/notify.js +10 -8
- package/components/avatar/index.js +19 -17
- package/components/badge/index.js +122 -139
- package/components/button/icon.js +242 -334
- package/components/button/index.js +272 -427
- package/components/button/more.js +4 -5
- package/components/button/ripple-effect.js +4 -6
- package/components/card/body-card.js +4 -6
- package/components/card/card.js +4 -8
- package/components/card/index.js +4 -5
- package/components/chart/Pie/Sector.js +4 -5
- package/components/chart/Pie/Sectors.js +5 -5
- package/components/chart/Pie/index.js +8 -9
- package/components/chart/Pie-v2/Sector.js +4 -5
- package/components/chart/Pie-v2/Sectors.js +7 -8
- package/components/chart/Pie-v2/index.js +11 -16
- package/components/chart/bar/Bar.js +2 -3
- package/components/chart/bar/Labels.js +9 -11
- package/components/chart/bar/index.js +17 -9
- package/components/chart/bar-v2/Bar.js +2 -3
- package/components/chart/bar-v2/Labels.js +9 -11
- package/components/chart/bar-v2/index.js +17 -9
- package/components/chart/line/Labels.js +8 -10
- package/components/chart/line/Point.js +2 -3
- package/components/chart/line/index.js +17 -9
- package/components/chart/line-v2/Labels.js +8 -10
- package/components/chart/line-v2/Point.js +2 -3
- package/components/chart/line-v2/index.js +17 -9
- package/components/chip/attach.js +12 -16
- package/components/chip/index.js +8 -11
- package/components/collapse/index.js +4 -5
- package/components/divider/index.js +27 -14
- package/components/form-control/attachment/index.js +143 -87
- package/components/form-control/calendar/function.js +24 -23
- package/components/form-control/calendar/index.js +2 -4
- package/components/form-control/calendar/range.js +3 -4
- package/components/form-control/checkbox/index.js +85 -71
- package/components/form-control/control/index.js +4 -6
- package/components/form-control/date-picker/index-old.js +0 -2
- package/components/form-control/date-picker/index.js +39 -43
- package/components/form-control/date-range-picker/index.js +26 -28
- package/components/form-control/dropdown/index.js +173 -202
- package/components/form-control/dropdown-box/index.js +72 -49
- package/components/form-control/form-group/index.js +4 -5
- package/components/form-control/helper-text/index.js +4 -5
- package/components/form-control/input-base/index.js +28 -38
- package/components/form-control/label/index.js +23 -13
- package/components/form-control/money-input/index.js +6 -6
- package/components/form-control/number-input/index.js +12 -14
- package/components/form-control/phone-input/index.js +4 -5
- package/components/form-control/radio/index.js +7 -15
- package/components/form-control/text-input/index.js +14 -24
- package/components/form-control/time-picker/index.js +15 -26
- package/components/form-control/time-picker/swiper.js +2 -4
- package/components/form-control/toggle/index.js +22 -18
- package/components/form-view/helper-text.js +4 -5
- package/components/form-view/index.js +4 -5
- package/components/form-view/input.js +5 -7
- package/components/form-view/label.js +2 -6
- package/components/list/list-item-action.js +7 -8
- package/components/list/list-item-icon.js +4 -5
- package/components/list/list-item-text.js +4 -5
- package/components/list/list-item.js +4 -5
- package/components/list/list.js +4 -5
- package/components/list/sub-header.js +4 -5
- package/components/modal/body.js +4 -6
- package/components/modal/footer.js +4 -6
- package/components/modal/header.js +8 -14
- package/components/modal/index.js +4 -5
- package/components/modal/modal.js +6 -13
- package/components/others/extra/index.js +4 -8
- package/components/others/option-wrapper/index.js +57 -0
- package/components/others/scrollbar/index.js +4 -5
- package/components/paging/page-info.js +282 -231
- package/components/paging/page-selector.js +4 -7
- package/components/popover/index.js +6 -7
- package/components/popup/danger_popup.js +8 -18
- package/components/popup/index.js +26 -34
- package/components/popup/proposals_popup.js +9 -16
- package/components/popup/v2/danger-popup.js +4 -6
- package/components/popup/v2/index.js +116 -98
- package/components/popup/v2/info-popup.js +4 -6
- package/components/popup/v2/success-popup.js +4 -6
- package/components/popup/v2/warning-popup.js +4 -6
- package/components/popup/v2/yes-no-popup.js +4 -6
- package/components/progress/circular.js +17 -26
- package/components/progress/linear.js +11 -13
- package/components/rating/index.js +114 -233
- package/components/slider/slider-container.js +15 -10
- package/components/slider/slider-item.js +10 -12
- package/components/status/index.js +63 -57
- package/components/tab/tab-container.js +26 -24
- package/components/tab/tab-header.js +36 -27
- package/components/tab/tab-panel.js +32 -15
- package/components/tab/tab.js +79 -80
- package/components/tooltip/index.js +4 -4
- package/components/transfer/index.js +10 -11
- package/components/tree-view/css.js +2 -0
- package/components/tree-view/index.js +14 -13
- package/components/typography/index.js +6 -112
- package/css/styles.css +1 -1
- package/css/styles.css.map +1 -1
- package/global/index.js +2 -0
- package/icons/basic.js +1648 -959
- package/icons/effect.js +45 -103
- package/package.json +1 -1
- package/readme.md +66 -0
- package/styles/color-helper.js +7 -146
- package/styles/colors.js +6 -2
- package/styles/font.js +9 -0
- package/styles/general.js +100 -7
- package/styles/typography.js +25 -26
- package/theme/settings.js +9 -2
- package/theme/theme-provider.js +15 -7
- package/theme/with-styles.js +2 -4
- package/theme/with-theme.js +2 -4
- package/utils/isMobile.js +21 -0
- package/utils/renderHTML.js +4 -5
- package/utils/renderIcon.js +15 -11
- package/utils/updatePosition.js +2 -2
|
@@ -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,24 +5,50 @@ import { Fragment, memo, useState, useEffect, useMemo, useRef, useImperativeHand
|
|
|
7
5
|
import ReactDOM from 'react-dom';
|
|
8
6
|
import PropTypes from 'prop-types';
|
|
9
7
|
import { jsx, css } from '@emotion/core';
|
|
10
|
-
import
|
|
11
|
-
import { InputBase, Chip, CircularProgress, Checkbox, TreeView, HelperText, Label } from '../../';
|
|
8
|
+
import { Account } from '../../../icons';
|
|
9
|
+
import { InputBase, Chip, CircularProgress, Checkbox, TreeView, HelperText, Label, ButtonIcon } from '../../';
|
|
12
10
|
import { mapParent, randomString, updatePosition } from '../../../utils';
|
|
13
11
|
import { getGlobal } from '../../../global';
|
|
14
|
-
import {
|
|
12
|
+
import { color as colors } from '../../../styles/colors';
|
|
13
|
+
import { typography } from '../../../styles/typography';
|
|
14
|
+
import { alignCenter, backgroundTransparent, borderBox, borderRadius4px, cursorPointer, displayBlock, flexRow, flexWrap, inlineFlex, justifyCenter, justifyStart, outlineNone, overflowHidden, pointerEventsNone, positionAbsolute, positionRelative, userSelectNone } from '../../../styles/general';
|
|
15
|
+
import isMobile from '../../../utils/isMobile';
|
|
16
|
+
const {
|
|
17
|
+
paragraph1,
|
|
18
|
+
paragraph3
|
|
19
|
+
} = typography;
|
|
15
20
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
system: {
|
|
22
|
+
active,
|
|
23
|
+
disabled: systemDisabled,
|
|
24
|
+
rest
|
|
25
|
+
},
|
|
26
|
+
semantic: {
|
|
27
|
+
danger
|
|
28
|
+
},
|
|
29
|
+
fill: {
|
|
30
|
+
hover,
|
|
31
|
+
'scrollbar-tabbar': scrollbar
|
|
32
|
+
},
|
|
33
|
+
line: {
|
|
34
|
+
focus
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
main,
|
|
38
|
+
sub
|
|
20
39
|
}
|
|
21
|
-
} =
|
|
40
|
+
} = colors;
|
|
22
41
|
const timing = {},
|
|
23
42
|
currentValue = {},
|
|
24
43
|
currentObjectDefault = {},
|
|
25
44
|
isSearch = {},
|
|
26
45
|
allValue = {};
|
|
27
46
|
const separatorPattern = /\{\w+\}/g;
|
|
47
|
+
|
|
48
|
+
const checkHasValue = value => {
|
|
49
|
+
return Array.isArray(value) ? value.length > 0 : value === 0 || !!value;
|
|
50
|
+
};
|
|
51
|
+
|
|
28
52
|
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
29
53
|
viewType,
|
|
30
54
|
itemMode,
|
|
@@ -73,6 +97,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
73
97
|
errorStyle,
|
|
74
98
|
refs,
|
|
75
99
|
children,
|
|
100
|
+
dropdownItemStyle,
|
|
76
101
|
...props
|
|
77
102
|
}, ref) => {
|
|
78
103
|
const dropdownRef = useRef(null);
|
|
@@ -87,23 +112,29 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
87
112
|
boxRef = useRef(null),
|
|
88
113
|
searchRef = useRef(null),
|
|
89
114
|
timeout = useRef(null);
|
|
115
|
+
const [openState, setOpenState] = useState(false);
|
|
116
|
+
const [errorState, setErrorState] = useState(error && !valueProp && valueProp !== 0);
|
|
117
|
+
const [showClear, setShowClear] = useState(false);
|
|
118
|
+
|
|
119
|
+
const _isMobile = isMobile.any();
|
|
90
120
|
/* Start styled */
|
|
91
121
|
|
|
122
|
+
|
|
92
123
|
const forInput = css`
|
|
93
|
-
|
|
124
|
+
${flexRow}
|
|
94
125
|
flex: 1 1 auto;
|
|
95
126
|
${!multiple && renderSelectedItem ? `width: calc(100% - 34px${clearAble ? ' - 18px' : ''})` : ''}
|
|
96
127
|
`;
|
|
97
128
|
const DropdownIcon = css`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
129
|
+
${inlineFlex}
|
|
130
|
+
${alignCenter}
|
|
131
|
+
${positionRelative}
|
|
132
|
+
${overflowHidden}
|
|
101
133
|
height: inherit;
|
|
102
134
|
margin-right: 8px;
|
|
103
135
|
height: 32px;
|
|
104
136
|
width: 32px;
|
|
105
137
|
border-radius: 16px;
|
|
106
|
-
overflow: hidden;
|
|
107
138
|
img {
|
|
108
139
|
height: 32px;
|
|
109
140
|
width: 32px;
|
|
@@ -111,49 +142,45 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
111
142
|
}
|
|
112
143
|
`;
|
|
113
144
|
const DropdownInput = css`
|
|
114
|
-
|
|
115
|
-
|
|
145
|
+
${flexRow}
|
|
146
|
+
${alignCenter}
|
|
147
|
+
${outlineNone}
|
|
148
|
+
${backgroundTransparent}
|
|
149
|
+
${paragraph1};
|
|
116
150
|
width: 100%;
|
|
117
151
|
border: none;
|
|
118
|
-
|
|
119
|
-
color: ${colors.input};
|
|
120
|
-
background-color: transparent;
|
|
152
|
+
color: ${main};
|
|
121
153
|
padding-top: 0;
|
|
122
154
|
padding-bottom: ${viewType !== 'outlined' ? 0 : 'inherit'};
|
|
123
155
|
padding-left: ${viewType !== 'outlined' ? 0 : '16px'};
|
|
124
|
-
font-family: ${fontFamily};
|
|
125
|
-
font-style: normal;
|
|
126
|
-
font-weight: 500;
|
|
127
|
-
font-size: 16px;
|
|
128
|
-
line-height: ${multiple ? 30 : 24}px;
|
|
129
156
|
min-height: ${multiple ? 30 : 24}px;
|
|
130
157
|
&.dgn-dropdown-multiple {
|
|
131
|
-
|
|
158
|
+
${flexWrap}
|
|
159
|
+
${overflowHidden}
|
|
132
160
|
/* max-height: max-content; */
|
|
133
161
|
word-break: break-word;
|
|
134
|
-
overflow: hidden;
|
|
135
162
|
${!multiple ? 'min-height: 24px; max-width: 100%; white-space: nowrap;' : ''}
|
|
136
163
|
&::after {
|
|
164
|
+
${flexRow}
|
|
165
|
+
${positionAbsolute}
|
|
166
|
+
${alignCenter}
|
|
167
|
+
${justifyCenter}
|
|
137
168
|
content: '${placeholder}';
|
|
138
|
-
|
|
139
|
-
position: absolute;
|
|
140
|
-
align-items: center;
|
|
141
|
-
justify-content: center;
|
|
142
|
-
color: ${colors.placeholder};
|
|
169
|
+
color: ${sub};
|
|
143
170
|
}
|
|
144
171
|
&:not(:empty)::after {
|
|
145
172
|
visibility: hidden;
|
|
146
173
|
}
|
|
147
174
|
}
|
|
148
175
|
&:focus {
|
|
149
|
-
|
|
176
|
+
${backgroundTransparent}
|
|
150
177
|
}
|
|
151
178
|
.dropdown-item {
|
|
152
179
|
&:not(:last-child) {
|
|
153
180
|
margin-right: 5px;
|
|
154
181
|
}
|
|
155
182
|
svg {
|
|
156
|
-
|
|
183
|
+
${borderBox}
|
|
157
184
|
padding: ${itemMultipleSize === 'medium' ? 2 : 1}px;
|
|
158
185
|
}
|
|
159
186
|
}
|
|
@@ -172,43 +199,43 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
172
199
|
}
|
|
173
200
|
`;
|
|
174
201
|
const forIcon = css`
|
|
175
|
-
|
|
202
|
+
${flexRow}
|
|
203
|
+
${alignCenter}
|
|
176
204
|
margin-left: 8px;
|
|
177
205
|
margin-right: ${viewType !== 'outlined' ? 2 : 16}px;
|
|
178
206
|
color: inherit;
|
|
179
|
-
align-items: center;
|
|
180
207
|
.icon-close {
|
|
181
|
-
display: none;
|
|
208
|
+
display: ${showClear ? 'flex' : 'none'};
|
|
182
209
|
margin-right: 4px;
|
|
183
210
|
}
|
|
184
211
|
.dgn-dropdown-loading {
|
|
185
|
-
display: none;
|
|
212
|
+
display: ${loading ? 'flex' : 'none'};
|
|
186
213
|
}
|
|
187
214
|
`;
|
|
188
215
|
const DropdownForm = viewType !== 'outlined' ? css`
|
|
189
|
-
|
|
216
|
+
${flexRow}
|
|
217
|
+
${alignCenter}
|
|
218
|
+
${positionRelative}
|
|
219
|
+
${borderBox}
|
|
190
220
|
flex: 1 1 auto;
|
|
191
|
-
align-items: center;
|
|
192
|
-
position: relative;
|
|
193
221
|
padding-bottom: ${multiple ? 1 : 4}px;
|
|
194
222
|
padding-top: ${multiple ? 1 : 4}px;
|
|
195
|
-
box-sizing: border-box;
|
|
196
223
|
&:not(:focus-within):hover {
|
|
197
224
|
&::before {
|
|
198
|
-
border-bottom-color: ${
|
|
225
|
+
border-bottom-color: ${active};
|
|
199
226
|
}
|
|
200
227
|
.css-${DropdownInput.name} {
|
|
201
|
-
color: ${
|
|
228
|
+
color: ${active};
|
|
202
229
|
}
|
|
203
230
|
}
|
|
204
231
|
&:focus-within {
|
|
205
|
-
border-bottom-color: ${
|
|
232
|
+
border-bottom-color: ${focus};
|
|
206
233
|
&::after {
|
|
207
234
|
border-bottom-color: inherit;
|
|
208
235
|
transform: scaleX(1);
|
|
209
236
|
}
|
|
210
237
|
.css-${DropdownInput.name} {
|
|
211
|
-
color: ${
|
|
238
|
+
color: ${active};
|
|
212
239
|
}
|
|
213
240
|
}
|
|
214
241
|
&.dropdown-showing {
|
|
@@ -217,19 +244,19 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
217
244
|
}
|
|
218
245
|
}
|
|
219
246
|
&::placeholder {
|
|
220
|
-
color: ${
|
|
247
|
+
color: ${sub};
|
|
221
248
|
}
|
|
222
249
|
&::before {
|
|
250
|
+
${positionAbsolute}
|
|
223
251
|
content: '';
|
|
224
|
-
position: absolute;
|
|
225
252
|
left: 0;
|
|
226
253
|
right: 0;
|
|
227
254
|
bottom: 0;
|
|
228
|
-
border-bottom: 1px solid ${
|
|
255
|
+
border-bottom: 1px solid ${rest};
|
|
229
256
|
}
|
|
230
257
|
&::after {
|
|
258
|
+
${positionAbsolute}
|
|
231
259
|
content: '';
|
|
232
|
-
position: absolute;
|
|
233
260
|
left: 0px;
|
|
234
261
|
right: 0px;
|
|
235
262
|
bottom: -1px;
|
|
@@ -239,26 +266,23 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
239
266
|
transition: all 0.2s ease;
|
|
240
267
|
}
|
|
241
268
|
` : css`
|
|
242
|
-
|
|
269
|
+
${flexRow}
|
|
270
|
+
${alignCenter}
|
|
271
|
+
${positionRelative}
|
|
272
|
+
${borderRadius4px}
|
|
273
|
+
${borderBox}
|
|
243
274
|
flex: 1 1 auto;
|
|
244
|
-
|
|
245
|
-
position: relative;
|
|
246
|
-
border: 1px solid ${colors.border};
|
|
247
|
-
border-radius: 4px;
|
|
275
|
+
border: 1px solid ${rest};
|
|
248
276
|
min-height: 40px;
|
|
249
|
-
box-sizing: border-box;
|
|
250
277
|
&:not(:focus-within):hover {
|
|
251
|
-
background-color: ${
|
|
252
|
-
border-color: ${
|
|
278
|
+
background-color: ${hover};
|
|
279
|
+
border-color: ${active};
|
|
253
280
|
input {
|
|
254
|
-
background-color: ${
|
|
281
|
+
background-color: ${hover};
|
|
255
282
|
}
|
|
256
283
|
}
|
|
257
284
|
&:focus-within {
|
|
258
|
-
border-color: ${
|
|
259
|
-
&::after {
|
|
260
|
-
border-color: inherit;
|
|
261
|
-
}
|
|
285
|
+
border-color: ${focus};
|
|
262
286
|
}
|
|
263
287
|
&.dropdown-showing {
|
|
264
288
|
.icon-dropdown {
|
|
@@ -266,28 +290,28 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
266
290
|
}
|
|
267
291
|
}
|
|
268
292
|
&::placeholder {
|
|
269
|
-
color: ${
|
|
293
|
+
color: ${sub};
|
|
270
294
|
}
|
|
271
295
|
&::after {
|
|
296
|
+
${positionAbsolute}
|
|
297
|
+
${pointerEventsNone}
|
|
272
298
|
content: '';
|
|
273
|
-
position: absolute;
|
|
274
299
|
left: -2px;
|
|
275
300
|
right: -2px;
|
|
276
301
|
top: -2px;
|
|
277
302
|
bottom: -2px;
|
|
278
303
|
border: 2px solid transparent;
|
|
279
304
|
border-radius: 4px;
|
|
280
|
-
pointer-events: none;
|
|
281
305
|
}
|
|
282
306
|
`;
|
|
283
307
|
const DropdownBox = css`
|
|
284
|
-
|
|
285
|
-
|
|
308
|
+
${displayBlock}
|
|
309
|
+
${positionRelative}
|
|
310
|
+
${borderBox}
|
|
286
311
|
width: 100%;
|
|
287
312
|
max-height: 280px;
|
|
288
|
-
overflow:
|
|
313
|
+
overflow: auto;
|
|
289
314
|
background-color: #FFF;
|
|
290
|
-
box-sizing: border-box;
|
|
291
315
|
border-radius: 4px;
|
|
292
316
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
293
317
|
z-index: 9001;
|
|
@@ -300,7 +324,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
300
324
|
border-radius: 24px;
|
|
301
325
|
border: 8px solid transparent;
|
|
302
326
|
mix-blend-mode: normal;
|
|
303
|
-
background-color: ${
|
|
327
|
+
background-color: ${scrollbar} !important;
|
|
304
328
|
background-clip: content-box;
|
|
305
329
|
}
|
|
306
330
|
.DGN-UI-TreeView {
|
|
@@ -308,18 +332,18 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
308
332
|
}
|
|
309
333
|
`;
|
|
310
334
|
const DropdownItem = css`
|
|
311
|
-
|
|
312
|
-
|
|
335
|
+
${flexRow}
|
|
336
|
+
${positionRelative}
|
|
337
|
+
${alignCenter}
|
|
338
|
+
${justifyStart}
|
|
339
|
+
${borderBox}
|
|
340
|
+
${cursorPointer}
|
|
341
|
+
${userSelectNone}
|
|
313
342
|
min-height: 40px;
|
|
314
343
|
width: 100%;
|
|
315
344
|
background-color: #FFF;
|
|
316
|
-
align-items: center;
|
|
317
|
-
justify-content: flex-start;
|
|
318
345
|
padding: 8px ${multiple && selectBox ? 0 : '16px'};
|
|
319
|
-
color: ${
|
|
320
|
-
box-sizing: border-box;
|
|
321
|
-
user-select: none;
|
|
322
|
-
cursor: pointer;
|
|
346
|
+
color: ${main};
|
|
323
347
|
&.no-data {
|
|
324
348
|
font-style: italic;
|
|
325
349
|
justify-content: center;
|
|
@@ -327,79 +351,67 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
327
351
|
}
|
|
328
352
|
&:not(.no-data):hover,
|
|
329
353
|
&:not(.no-data):focus {
|
|
330
|
-
background-color: ${
|
|
331
|
-
color: ${
|
|
354
|
+
background-color: ${hover};
|
|
355
|
+
color: ${active};
|
|
332
356
|
outline: none;
|
|
333
357
|
}
|
|
334
358
|
`;
|
|
335
359
|
const DropdownText = css`
|
|
336
|
-
|
|
337
|
-
font-style: normal;
|
|
338
|
-
font-weight: 500;
|
|
339
|
-
font-size: ${fontSize};
|
|
340
|
-
line-height: 20px;
|
|
360
|
+
${paragraph1};
|
|
341
361
|
color: inherit;
|
|
342
362
|
.DGN-UI-Dropdown-PrimaryText {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
line-height: 18px;
|
|
363
|
+
${paragraph1};
|
|
364
|
+
${displayBlock}
|
|
346
365
|
}
|
|
347
366
|
.DGN-UI-Dropdown-SubText {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
font-family: ${fontFamily};
|
|
352
|
-
color: ${colors.secondary};
|
|
367
|
+
${paragraph3};
|
|
368
|
+
${displayBlock}
|
|
369
|
+
color: ${sub};
|
|
353
370
|
}
|
|
354
371
|
`;
|
|
355
372
|
const DropdownRoot = css`
|
|
356
|
-
|
|
357
|
-
|
|
373
|
+
${displayBlock}
|
|
374
|
+
${positionRelative}
|
|
358
375
|
margin-bottom: 20px;
|
|
359
376
|
min-width: 150px;
|
|
360
377
|
height: max-content;
|
|
361
378
|
&.error {
|
|
362
379
|
.css-${DropdownForm.name} {
|
|
363
|
-
border-color: ${
|
|
380
|
+
border-color: ${danger};
|
|
364
381
|
path {
|
|
365
|
-
fill: ${
|
|
382
|
+
fill: ${danger};
|
|
366
383
|
}
|
|
367
384
|
&::before {
|
|
368
|
-
border-color: ${
|
|
385
|
+
border-color: ${danger};
|
|
369
386
|
}
|
|
370
387
|
}
|
|
371
388
|
}
|
|
372
389
|
&.dgn-dropdown-loading,
|
|
373
390
|
&.disabled {
|
|
374
|
-
|
|
375
|
-
|
|
391
|
+
${pointerEventsNone}
|
|
392
|
+
${userSelectNone}
|
|
376
393
|
.css-${DropdownInput.name} {
|
|
377
|
-
//color: ${
|
|
394
|
+
//color: ${systemDisabled} !important;
|
|
378
395
|
}
|
|
379
396
|
.css-${DropdownForm.name} {
|
|
380
|
-
border-color: ${
|
|
397
|
+
border-color: ${systemDisabled};
|
|
381
398
|
.css-${forIcon.name} {
|
|
382
399
|
path {
|
|
383
400
|
fill: transparent;
|
|
384
401
|
}
|
|
385
402
|
}
|
|
386
403
|
&::before {
|
|
387
|
-
border-color: ${
|
|
404
|
+
border-color: ${systemDisabled};
|
|
388
405
|
}
|
|
389
406
|
}
|
|
390
407
|
}
|
|
391
408
|
&.readOnly {
|
|
392
|
-
pointer-events: none;
|
|
393
|
-
user-select: none;
|
|
394
409
|
.css-${forIcon.name} {
|
|
395
|
-
|
|
396
|
-
.icon-close {
|
|
397
|
-
display: none !important;
|
|
398
|
-
}
|
|
410
|
+
${pointerEventsNone}
|
|
399
411
|
}
|
|
400
412
|
.css-${DropdownInput.name} {
|
|
401
413
|
.dropdown-item {
|
|
402
|
-
|
|
414
|
+
${pointerEventsNone}
|
|
403
415
|
}
|
|
404
416
|
}
|
|
405
417
|
}
|
|
@@ -455,7 +467,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
455
467
|
sel.addRange(range);
|
|
456
468
|
}
|
|
457
469
|
|
|
458
|
-
|
|
470
|
+
setOpenState(true);
|
|
459
471
|
setTimeout(() => {
|
|
460
472
|
showDropdown();
|
|
461
473
|
setTimeout(() => {
|
|
@@ -515,7 +527,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
515
527
|
const el = document.createElement('div');
|
|
516
528
|
const elBox = document.createElement('div');
|
|
517
529
|
const elLoading = document.createElement('div');
|
|
518
|
-
|
|
530
|
+
let _cssText = `position: fixed; top: ${positionTop}px; left: ${left}px; width: ${width}px; background-color: #FFF; opacity: 0; transition: opacity 0.3s; z-index: 9001;`;
|
|
531
|
+
if (_isMobile && allowSearch) _cssText += `bottom: 0px; top: auto; display: flex; flex-direction: column-reverse; height: max-content`;
|
|
532
|
+
el.style.cssText = _cssText;
|
|
519
533
|
elLoading.style.cssText = `display: none; justify-content: center; align-items: center;position: absolute; top: 0; width: 100%; height: 100%; background-color: rgba(255, 255, 255, 0.6); border-radius: 4px; opacity: 0; transition: opacity 0.3s; z-index: 9002;`;
|
|
520
534
|
el.className = `DGN-UI-Portal DGN-Dropdown-${unique}`;
|
|
521
535
|
elBox.className = `DGN-Dropdown-Box`;
|
|
@@ -628,7 +642,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
628
642
|
node.remove();
|
|
629
643
|
boxRef.current = null;
|
|
630
644
|
}, 300);
|
|
631
|
-
|
|
645
|
+
setOpenState(false);
|
|
632
646
|
document.removeEventListener('click', onClickOutsideOfInput);
|
|
633
647
|
window.removeEventListener('resize', customizeWidthDropdown);
|
|
634
648
|
document.removeEventListener('wheel', onWheelHandler);
|
|
@@ -745,11 +759,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
745
759
|
items.push(jsx("div", {
|
|
746
760
|
key: index,
|
|
747
761
|
css: !itemDisabled ? DropdownItem : [Disabled, DropdownItem],
|
|
762
|
+
className: 'DGN-UI-Dropdown-Item',
|
|
748
763
|
onClick: () => onChangeValue(displayText, value, icon, data, index),
|
|
749
764
|
onKeyPress: e => {
|
|
750
765
|
if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
751
766
|
},
|
|
752
|
-
tabIndex: -1
|
|
767
|
+
tabIndex: -1,
|
|
768
|
+
style: dropdownItemStyle
|
|
753
769
|
}, icon && jsx("div", {
|
|
754
770
|
css: DropdownIcon
|
|
755
771
|
}, icon), jsx("div", {
|
|
@@ -963,6 +979,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
963
979
|
};
|
|
964
980
|
|
|
965
981
|
const customizeWidthDropdown = () => {
|
|
982
|
+
if (boxRef.current && _isMobile) boxRef.current.style.maxHeight = `${Math.min(280, window.innerHeight) - (allowSearch ? 40 : 0)}px`;
|
|
983
|
+
|
|
966
984
|
if (!dropdownRef.current) {
|
|
967
985
|
window.removeEventListener('resize', customizeWidthDropdown);
|
|
968
986
|
return;
|
|
@@ -987,7 +1005,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
987
1005
|
return;
|
|
988
1006
|
}
|
|
989
1007
|
|
|
990
|
-
updatePosition(formRef.current, node, closeDropdown);
|
|
1008
|
+
_isMobile ? updatePosition(formRef.current, node, null) : updatePosition(formRef.current, node, closeDropdown);
|
|
991
1009
|
};
|
|
992
1010
|
|
|
993
1011
|
const onLoadMoreHandler = e => {
|
|
@@ -1060,6 +1078,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1060
1078
|
if (itemMode === 'treeview') {
|
|
1061
1079
|
if (valueProp === undefined) {
|
|
1062
1080
|
setValueIntoInput(value);
|
|
1081
|
+
setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
|
|
1063
1082
|
}
|
|
1064
1083
|
|
|
1065
1084
|
!!onChange && onChange({
|
|
@@ -1129,12 +1148,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1129
1148
|
|
|
1130
1149
|
if (isChanged) {
|
|
1131
1150
|
if (valueProp === undefined) {
|
|
1132
|
-
if (clearAble) {
|
|
1133
|
-
iconRef.current.querySelector('.icon-close').style.display = 'flex';
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
1151
|
allValue[unique].push(value);
|
|
1137
1152
|
setValueIntoInput(value);
|
|
1153
|
+
setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
|
|
1138
1154
|
}
|
|
1139
1155
|
|
|
1140
1156
|
!!onChange && onChange({
|
|
@@ -1181,6 +1197,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1181
1197
|
};
|
|
1182
1198
|
|
|
1183
1199
|
const onClear = e => {
|
|
1200
|
+
if (disabled || readOnly || loading) return;
|
|
1184
1201
|
currentValue[unique] = multiple ? [] : '';
|
|
1185
1202
|
|
|
1186
1203
|
if (inputRef.current.tagName.toLowerCase() === 'div') {
|
|
@@ -1196,11 +1213,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1196
1213
|
|
|
1197
1214
|
e && e.target && e.target.blur();
|
|
1198
1215
|
updatePositionDropdown();
|
|
1199
|
-
|
|
1200
|
-
if (clearAble) {
|
|
1201
|
-
iconRef.current.querySelector('.icon-close').style.display = null;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
1216
|
!!onChange && onChange({
|
|
1205
1217
|
value: currentValue[unique]
|
|
1206
1218
|
});
|
|
@@ -1264,10 +1276,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1264
1276
|
}
|
|
1265
1277
|
}
|
|
1266
1278
|
});
|
|
1267
|
-
|
|
1268
|
-
if (clearAble && iconRef.current && iconRef.current.querySelector('.icon-close')) {
|
|
1269
|
-
iconRef.current.querySelector('.icon-close').style.display = valueArr.length ? 'flex' : null;
|
|
1270
|
-
}
|
|
1271
1279
|
} else {
|
|
1272
1280
|
currentValue[unique] = source;
|
|
1273
1281
|
|
|
@@ -1290,10 +1298,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1290
1298
|
if (!isSearch[unique]) {
|
|
1291
1299
|
inputRef.current.value = '';
|
|
1292
1300
|
}
|
|
1293
|
-
|
|
1294
|
-
if (clearAble && iconRef.current && iconRef.current.querySelector('.icon-close')) {
|
|
1295
|
-
iconRef.current.querySelector('.icon-close').style.display = null;
|
|
1296
|
-
}
|
|
1297
1301
|
}
|
|
1298
1302
|
};
|
|
1299
1303
|
|
|
@@ -1353,10 +1357,6 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1353
1357
|
const text = keyArr ? renderData(data, keyArr) : data[keyExpr || displayExpr] || data;
|
|
1354
1358
|
inputRef.current.value = text;
|
|
1355
1359
|
}
|
|
1356
|
-
|
|
1357
|
-
if (clearAble) {
|
|
1358
|
-
iconRef.current.querySelector('.icon-close').style.display = 'flex';
|
|
1359
|
-
}
|
|
1360
1360
|
};
|
|
1361
1361
|
|
|
1362
1362
|
useImperativeHandle(ref, () => ({
|
|
@@ -1370,6 +1370,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1370
1370
|
setPreviousValue,
|
|
1371
1371
|
DOM: dropdownRef.current
|
|
1372
1372
|
}));
|
|
1373
|
+
useEffect(() => {
|
|
1374
|
+
setShowClear(clearAble && checkHasValue(valueProp) && !disabled && !readOnly && !loading);
|
|
1375
|
+
}, [clearAble, valueProp, disabled, readOnly, loading]);
|
|
1373
1376
|
useEffect(() => {
|
|
1374
1377
|
currentObjectDefault[unique] = onLoadMore && valueObjectDefault ? Array.isArray(valueObjectDefault) ? [...valueObjectDefault] : [valueObjectDefault] : [];
|
|
1375
1378
|
return () => {
|
|
@@ -1382,6 +1385,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1382
1385
|
|
|
1383
1386
|
if (defaultValue !== undefined && JSON.stringify(defaultValue) !== '[]') {
|
|
1384
1387
|
setValueIntoInput(defaultValue);
|
|
1388
|
+
setShowClear(clearAble && checkHasValue(defaultValue) && !disabled && !readOnly && !loading);
|
|
1385
1389
|
}
|
|
1386
1390
|
|
|
1387
1391
|
return () => {
|
|
@@ -1411,22 +1415,12 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1411
1415
|
}, [valueProp]);
|
|
1412
1416
|
useEffect(() => {
|
|
1413
1417
|
if (loading) {
|
|
1414
|
-
iconRef.current.querySelector('.dgn-dropdown-loading').style.display = 'flex';
|
|
1415
|
-
|
|
1416
|
-
if (clearAble) {
|
|
1417
|
-
iconRef.current.querySelector('.icon-close').style.display = null;
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
iconRef.current.querySelector('.icon-dropdown').style.display = 'none';
|
|
1421
|
-
dropdownRef.current.classList.add('dgn-dropdown-loading');
|
|
1422
|
-
|
|
1423
1418
|
if (boxRef.current) {
|
|
1424
1419
|
var _boxRef$current$paren, _boxRef$current$paren2;
|
|
1425
1420
|
|
|
1426
1421
|
const loadingNode = (_boxRef$current$paren = boxRef.current.parentNode) === null || _boxRef$current$paren === void 0 ? void 0 : (_boxRef$current$paren2 = _boxRef$current$paren.parentNode) === null || _boxRef$current$paren2 === void 0 ? void 0 : _boxRef$current$paren2.querySelector('.DGN-Dropdown-Loading');
|
|
1427
1422
|
|
|
1428
1423
|
if (loadingNode) {
|
|
1429
|
-
// boxRef.current.style.overflow = 'hidden';
|
|
1430
1424
|
loadingNode.style.display = 'flex';
|
|
1431
1425
|
setTimeout(() => {
|
|
1432
1426
|
loadingNode.style.opacity = 1;
|
|
@@ -1436,21 +1430,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1436
1430
|
|
|
1437
1431
|
return () => {
|
|
1438
1432
|
if (iconRef.current && dropdownRef.current) {
|
|
1439
|
-
iconRef.current.querySelector('.dgn-dropdown-loading').style.display = null;
|
|
1440
|
-
iconRef.current.querySelector('.icon-dropdown').style.display = null;
|
|
1441
|
-
|
|
1442
|
-
if (clearAble && currentValue[unique] && typeof currentValue[unique] === 'string') {
|
|
1443
|
-
iconRef.current.querySelector('.icon-close').style.display = 'flex';
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
dropdownRef.current.classList.remove('dgn-dropdown-loading');
|
|
1447
|
-
|
|
1448
1433
|
if (boxRef.current) {
|
|
1449
|
-
// const loadingNode = boxRef.current.parentNode?.parentNode?.querySelector('.DGN-Dropdown-Loading');
|
|
1450
1434
|
const loadingNode = document.querySelector('.DGN-Dropdown-Loading');
|
|
1451
1435
|
|
|
1452
1436
|
if (loadingNode) {
|
|
1453
|
-
// boxRef.current.style.overflow = null;
|
|
1454
1437
|
loadingNode.style.opacity = 0;
|
|
1455
1438
|
setTimeout(() => {
|
|
1456
1439
|
loadingNode.style.display = 'none';
|
|
@@ -1462,14 +1445,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1462
1445
|
}
|
|
1463
1446
|
}, [loading]);
|
|
1464
1447
|
useEffect(() => {
|
|
1465
|
-
|
|
1466
|
-
dropdownRef.current.classList.add('error');
|
|
1467
|
-
return () => {
|
|
1468
|
-
if (dropdownRef.current) {
|
|
1469
|
-
dropdownRef.current.classList.remove('error');
|
|
1470
|
-
}
|
|
1471
|
-
};
|
|
1472
|
-
}
|
|
1448
|
+
setErrorState(error && (!valueProp && valueProp !== 0 || (valueProp === null || valueProp === void 0 ? void 0 : valueProp.length) === 0));
|
|
1473
1449
|
}, [error, valueProp]);
|
|
1474
1450
|
useEffect(() => {
|
|
1475
1451
|
if (valueProp !== undefined && (!boxRef.current || children || JSON.stringify(valueProp) !== JSON.stringify(currentValue[unique]))) {
|
|
@@ -1479,17 +1455,11 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1479
1455
|
useEffect(() => {
|
|
1480
1456
|
inputRef.current.readOnly = readOnly || inputProps.readOnly;
|
|
1481
1457
|
|
|
1482
|
-
if (disabled) {
|
|
1483
|
-
dropdownRef.current.classList.add('disabled');
|
|
1484
|
-
iconRef.current.querySelector('.icon-dropdown').style.pointerEvents = 'none';
|
|
1485
|
-
} else if (!readOnly) {
|
|
1458
|
+
if (!readOnly && !disabled) {
|
|
1486
1459
|
inputRef.current.addEventListener('click', onClickInput);
|
|
1487
1460
|
inputRef.current.addEventListener('input', onChangeInput);
|
|
1488
1461
|
!!onLoadMore && boxRef.current && boxRef.current.addEventListener('scroll', onLoadMoreHandler);
|
|
1489
1462
|
} else {
|
|
1490
|
-
dropdownRef.current.classList.add('readOnly');
|
|
1491
|
-
iconRef.current.querySelector('.icon-dropdown').style.pointerEvents = 'none';
|
|
1492
|
-
|
|
1493
1463
|
if (multiple) {
|
|
1494
1464
|
inputRef.current.contentEditable = false;
|
|
1495
1465
|
}
|
|
@@ -1504,16 +1474,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1504
1474
|
return () => {
|
|
1505
1475
|
if (!dropdownRef.current || !inputRef.current || !iconRef.current) return;
|
|
1506
1476
|
|
|
1507
|
-
if (disabled) {
|
|
1508
|
-
dropdownRef.current.classList.remove('disabled');
|
|
1509
|
-
iconRef.current.querySelector('.icon-dropdown').style.pointerEvents = null;
|
|
1510
|
-
} else if (!readOnly) {
|
|
1477
|
+
if (!readOnly && !disabled) {
|
|
1511
1478
|
inputRef.current.removeEventListener('click', onClickInput);
|
|
1512
1479
|
inputRef.current.removeEventListener('input', onChangeInput);
|
|
1513
1480
|
} else {
|
|
1514
|
-
dropdownRef.current.classList.remove('readOnly');
|
|
1515
|
-
iconRef.current.querySelector('.icon-dropdown').style.pointerEvents = null;
|
|
1516
|
-
|
|
1517
1481
|
if (multiple) {
|
|
1518
1482
|
inputRef.current.contentEditable = true;
|
|
1519
1483
|
}
|
|
@@ -1579,18 +1543,19 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1579
1543
|
|
|
1580
1544
|
/* Start component */
|
|
1581
1545
|
|
|
1582
|
-
const labelComp = useMemo(() => label ? jsx(Label,
|
|
1546
|
+
const labelComp = useMemo(() => label ? jsx(Label, {
|
|
1583
1547
|
required: required,
|
|
1584
|
-
disabled: disabled
|
|
1585
|
-
|
|
1548
|
+
disabled: disabled,
|
|
1549
|
+
...labelProps
|
|
1550
|
+
}, label) : null, [label, required, disabled]);
|
|
1586
1551
|
const inputComp = useMemo(() => jsx("div", {
|
|
1587
1552
|
css: DropdownForm,
|
|
1588
1553
|
ref: formRef,
|
|
1589
|
-
className: 'DGN-UI-Dropdown-Form',
|
|
1554
|
+
className: ['DGN-UI-Dropdown-Form', openState && 'dropdown-showing'].join(' ').trim().replace(/\s+/g, ' '),
|
|
1590
1555
|
style: formStyle
|
|
1591
1556
|
}, jsx("div", {
|
|
1592
1557
|
css: forInput
|
|
1593
|
-
}, multiple ? jsx("div",
|
|
1558
|
+
}, multiple ? jsx("div", { ...inputProps,
|
|
1594
1559
|
style: {
|
|
1595
1560
|
cursor: 'text',
|
|
1596
1561
|
...inputStyle
|
|
@@ -1603,7 +1568,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1603
1568
|
e.preventDefault();
|
|
1604
1569
|
return false;
|
|
1605
1570
|
}
|
|
1606
|
-
})
|
|
1571
|
+
}) : renderSelectedItem || iconExpr && iconExpr !== 'none' ? jsx("div", { ...inputProps,
|
|
1607
1572
|
contentEditable: true,
|
|
1608
1573
|
style: inputStyle,
|
|
1609
1574
|
ref: inputRef,
|
|
@@ -1616,35 +1581,37 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1616
1581
|
return false;
|
|
1617
1582
|
}
|
|
1618
1583
|
}
|
|
1619
|
-
})
|
|
1584
|
+
}) : jsx("input", { ...inputProps,
|
|
1620
1585
|
style: inputStyle,
|
|
1621
1586
|
ref: inputRef,
|
|
1622
1587
|
css: DropdownInput,
|
|
1623
1588
|
type: "text",
|
|
1624
1589
|
placeholder: placeholder
|
|
1625
|
-
}))
|
|
1590
|
+
})), jsx("div", {
|
|
1626
1591
|
ref: iconRef,
|
|
1627
|
-
css: forIcon
|
|
1592
|
+
css: forIcon,
|
|
1593
|
+
className: 'DGN-UI-Dropdown-Icon'
|
|
1628
1594
|
}, jsx("span", {
|
|
1629
1595
|
className: 'dgn-dropdown-loading'
|
|
1630
1596
|
}, jsx(CircularProgress, {
|
|
1631
1597
|
width: 24,
|
|
1632
1598
|
strokeWidth: 2
|
|
1633
|
-
})),
|
|
1599
|
+
})), jsx(ButtonIcon, {
|
|
1600
|
+
viewType: 'ghost',
|
|
1634
1601
|
name: 'Close',
|
|
1635
|
-
width: 12,
|
|
1636
1602
|
className: 'icon-close',
|
|
1637
1603
|
onClick: onClear
|
|
1638
|
-
}), jsx(
|
|
1604
|
+
}), !loading && jsx(ButtonIcon, {
|
|
1605
|
+
viewType: 'ghost',
|
|
1639
1606
|
name: 'ArrowDown',
|
|
1640
1607
|
className: 'icon-dropdown',
|
|
1641
1608
|
onClick: triggerInput,
|
|
1642
1609
|
style: {
|
|
1643
|
-
transition: 'transform 0.5s'
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
}))), [viewType, inputProps, inputStyle, multiple, clearAble, onChange]);
|
|
1647
|
-
const errorComp = useMemo(() =>
|
|
1610
|
+
transition: 'transform 0.5s'
|
|
1611
|
+
},
|
|
1612
|
+
disabled: disabled || readOnly
|
|
1613
|
+
}))), [viewType, inputProps, inputStyle, multiple, clearAble, onChange, disabled, readOnly, loading, openState, showClear]);
|
|
1614
|
+
const errorComp = useMemo(() => errorState && jsx(HelperText, {
|
|
1648
1615
|
disabled: disabled,
|
|
1649
1616
|
style: {
|
|
1650
1617
|
minHeight: '16px',
|
|
@@ -1652,15 +1619,16 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1652
1619
|
top: '100%',
|
|
1653
1620
|
...errorStyle
|
|
1654
1621
|
}
|
|
1655
|
-
}, error), [error, valueProp, disabled]);
|
|
1622
|
+
}, error), [error, valueProp, disabled, errorState]);
|
|
1656
1623
|
/* End component */
|
|
1657
1624
|
|
|
1658
|
-
return jsx("div",
|
|
1625
|
+
return jsx("div", {
|
|
1659
1626
|
ref: dropdownRef,
|
|
1660
1627
|
css: DropdownRoot,
|
|
1661
|
-
className: ['DGN-UI-Dropdown', className].join(' ').trim(),
|
|
1662
|
-
style: style
|
|
1663
|
-
|
|
1628
|
+
className: ['DGN-UI-Dropdown', className, errorState && 'error', loading && 'dgn-dropdown-loading', disabled ? 'disabled' : readOnly && 'readOnly'].join(' ').trim().replace(/\s+/g, ' '),
|
|
1629
|
+
style: style,
|
|
1630
|
+
...props
|
|
1631
|
+
}, labelComp, inputComp, errorComp);
|
|
1664
1632
|
}));
|
|
1665
1633
|
Dropdown.defaultProps = {
|
|
1666
1634
|
viewType: 'underlined',
|
|
@@ -1825,6 +1793,9 @@ Dropdown.propTypes = {
|
|
|
1825
1793
|
/** style inline of error in Dropdown component */
|
|
1826
1794
|
errorStyle: PropTypes.object,
|
|
1827
1795
|
|
|
1796
|
+
/** style inline of dropdown items in Dropdown component */
|
|
1797
|
+
dropdownItemStyle: PropTypes.object,
|
|
1798
|
+
|
|
1828
1799
|
/** The array of elements that appear in the dropdown */
|
|
1829
1800
|
dataSource: PropTypes.array,
|
|
1830
1801
|
|