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,20 +1,17 @@
|
|
|
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, useMemo, useEffect, useState, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
4
|
+
import { memo, useMemo, useEffect, useState, useRef, forwardRef, useImperativeHandle, Fragment } from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import ReactDOM from 'react-dom';
|
|
9
7
|
import { jsx, css } from '@emotion/core';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { ModalSample, Popup, Popover, List, ListItem,
|
|
13
|
-
import
|
|
8
|
+
import { color as colors } from '../../../styles/colors';
|
|
9
|
+
import { typography } from '../../../styles/typography';
|
|
10
|
+
import { ModalSample, Popup, Popover, List, ListItem, ListItemText, Slider, SliderItem, ScrollBar, LinearProgress, ButtonIcon } from '../../';
|
|
11
|
+
import { Pdf, Word, Sheet, Presentation, Compressed, Image, Another, Info, View, Download, Delete, Attachment as AttachmentIcon } from '../../../icons';
|
|
14
12
|
import { date as moment, getFileType } from '../../../utils';
|
|
15
13
|
import { getGlobal } from '../../../global';
|
|
16
14
|
import { useTheme, makeStyles } from '../../../theme';
|
|
17
|
-
import { Fragment } from 'react';
|
|
18
15
|
const theme = useTheme();
|
|
19
16
|
const useStyles = makeStyles({
|
|
20
17
|
listItem: {
|
|
@@ -46,12 +43,6 @@ const useStyles = makeStyles({
|
|
|
46
43
|
});
|
|
47
44
|
const classes = useStyles();
|
|
48
45
|
const icons = {
|
|
49
|
-
detail: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
50
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M6.5 4C5.12167 4 4 5.11457 4 6.48418C4 7.85379 5.12167 8.96835 6.5 8.96835C7.87833 8.96835 9 7.85379 9 6.48418C9 5.11457 7.87833 4 6.5 4ZM12.3333 4C10.955 4 9.83333 5.11457 9.83333 6.48418C9.83333 7.85379 10.955 8.96835 12.3333 8.96835C13.7117 8.96835 14.8333 7.85379 14.8333 6.48418C14.8333 5.11457 13.7117 4 12.3333 4ZM20.6667 6.48418C20.6667 7.85379 19.545 8.96835 18.1667 8.96835C16.7883 8.96835 15.6667 7.85379 15.6667 6.48418C15.6667 5.11457 16.7883 4 18.1667 4C19.545 4 20.6667 5.11457 20.6667 6.48418ZM6.5 9.79641C5.12167 9.79641 4 10.911 4 12.2806C4 13.6502 5.12167 14.7648 6.5 14.7648C7.87833 14.7648 9 13.6502 9 12.2806C9 10.911 7.87833 9.79641 6.5 9.79641ZM9.83333 12.2806C9.83333 10.911 10.955 9.79641 12.3333 9.79641C13.7117 9.79641 14.8333 10.911 14.8333 12.2806C14.8333 13.6502 13.7117 14.7648 12.3333 14.7648C10.955 14.7648 9.83333 13.6502 9.83333 12.2806ZM18.1667 9.79641C16.7883 9.79641 15.6667 10.911 15.6667 12.2806C15.6667 13.6502 16.7883 14.7648 18.1667 14.7648C19.545 14.7648 20.6667 13.6502 20.6667 12.2806C20.6667 10.911 19.545 9.79641 18.1667 9.79641ZM4 18.077C4 16.7074 5.12167 15.5928 6.5 15.5928C7.87833 15.5928 9 16.7074 9 18.077C9 19.4466 7.87833 20.5612 6.5 20.5612C5.12167 20.5612 4 19.4466 4 18.077ZM12.3333 15.5928C10.955 15.5928 9.83333 16.7074 9.83333 18.077C9.83333 19.4466 10.955 20.5612 12.3333 20.5612C13.7117 20.5612 14.8333 19.4466 14.8333 18.077C14.8333 16.7074 13.7117 15.5928 12.3333 15.5928ZM15.6667 18.077C15.6667 16.7074 16.7883 15.5928 18.1667 15.5928C19.545 15.5928 20.6667 16.7074 20.6667 18.077C20.6667 19.4466 19.545 20.5612 18.1667 20.5612C16.7883 20.5612 15.6667 19.4466 15.6667 18.077Z" fill="currentColor"/>
|
|
51
|
-
</svg>`,
|
|
52
|
-
icon: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
53
|
-
<path fillRule="evenodd" clipRule="evenodd" d="M3 7C3 6.448 3.448 6 4 6C4.552 6 5 6.448 5 7C5 7.552 4.552 8 4 8C3.448 8 3 7.552 3 7ZM3 12C3 11.448 3.448 11 4 11C4.552 11 5 11.448 5 12C5 12.552 4.552 13 4 13C3.448 13 3 12.552 3 12ZM4 16C3.448 16 3 16.448 3 17C3 17.552 3.448 18 4 18C4.552 18 5 17.552 5 17C5 16.448 4.552 16 4 16ZM7.9355 11H20.0645C20.5795 11 21.0005 11.421 21.0005 11.936V12.064C21.0005 12.579 20.5795 13 20.0645 13H7.9355C7.4205 13 7.0005 12.579 7.0005 12.064V11.936C7.0005 11.421 7.4205 11 7.9355 11ZM20.0645 16H7.9355C7.4205 16 7.0005 16.421 7.0005 16.936V17.064C7.0005 17.579 7.4205 18 7.9355 18H20.0645C20.5795 18 21.0005 17.579 21.0005 17.064V16.936C21.0005 16.421 20.5795 16 20.0645 16ZM7.9355 6H20.0645C20.5795 6 21.0005 6.421 21.0005 6.936V7.064C21.0005 7.579 20.5795 8 20.0645 8H7.9355C7.4205 8 7.0005 7.579 7.0005 7.064V6.936C7.0005 6.421 7.4205 6 7.9355 6Z" fill="currentColor"/>
|
|
54
|
-
</svg>`,
|
|
55
46
|
pdf: jsx(Pdf, {
|
|
56
47
|
width: '100%',
|
|
57
48
|
height: '100%'
|
|
@@ -91,6 +82,37 @@ let existClickOutOfItem = false;
|
|
|
91
82
|
let maxSize = Infinity;
|
|
92
83
|
let divideSize = null;
|
|
93
84
|
const errorDefault = getGlobal('errorDefault');
|
|
85
|
+
const {
|
|
86
|
+
heading5,
|
|
87
|
+
paragraph1,
|
|
88
|
+
paragraph2,
|
|
89
|
+
paragraph3
|
|
90
|
+
} = typography;
|
|
91
|
+
const {
|
|
92
|
+
system: {
|
|
93
|
+
active,
|
|
94
|
+
rest,
|
|
95
|
+
white,
|
|
96
|
+
dark
|
|
97
|
+
},
|
|
98
|
+
semantic: {
|
|
99
|
+
success,
|
|
100
|
+
danger,
|
|
101
|
+
info
|
|
102
|
+
},
|
|
103
|
+
fill: {
|
|
104
|
+
hover: fillHover,
|
|
105
|
+
pressed,
|
|
106
|
+
focus
|
|
107
|
+
},
|
|
108
|
+
line: {
|
|
109
|
+
normal,
|
|
110
|
+
hover: lineHover
|
|
111
|
+
},
|
|
112
|
+
text: {
|
|
113
|
+
sub
|
|
114
|
+
}
|
|
115
|
+
} = colors;
|
|
94
116
|
const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
95
117
|
viewType,
|
|
96
118
|
label,
|
|
@@ -112,6 +134,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
112
134
|
unitSize,
|
|
113
135
|
accept,
|
|
114
136
|
uploadErrorInfo,
|
|
137
|
+
domain,
|
|
138
|
+
isStripDomain,
|
|
115
139
|
style,
|
|
116
140
|
inputStyle,
|
|
117
141
|
inputProps,
|
|
@@ -126,9 +150,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
126
150
|
const [open, setOpen] = useState(false);
|
|
127
151
|
const [popup, setPopup] = useState(false);
|
|
128
152
|
const [popover, setPopover] = useState(false);
|
|
153
|
+
const [viewTypeState, setViewTypeState] = useState(viewType);
|
|
129
154
|
const attachTextRef = useRef(null);
|
|
130
155
|
const attachmentHandleIconRef = useRef(null);
|
|
131
|
-
const viewAttachTypeRef = useRef(null);
|
|
132
156
|
const sortIconRef = useRef(null);
|
|
133
157
|
const attachmentImageIconRef = useRef(null);
|
|
134
158
|
const attachmentInputRef = useRef(null);
|
|
@@ -140,22 +164,22 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
140
164
|
const ViewAttachType = css`
|
|
141
165
|
cursor: pointer;
|
|
142
166
|
height: 24px;
|
|
143
|
-
color: ${
|
|
167
|
+
color: ${rest};
|
|
144
168
|
&:hover {
|
|
145
|
-
color: ${
|
|
169
|
+
color: ${active};
|
|
146
170
|
}
|
|
147
171
|
`;
|
|
148
172
|
const attachmentHandleIcon = css`
|
|
149
173
|
display: none;
|
|
150
174
|
height: 24px;
|
|
151
175
|
margin-right: 10px;
|
|
152
|
-
border-right: 1px solid ${
|
|
176
|
+
border-right: 1px solid ${normal};
|
|
153
177
|
span {
|
|
154
178
|
margin-right: 10px;
|
|
155
|
-
color: ${
|
|
179
|
+
color: ${rest};
|
|
156
180
|
cursor: pointer;
|
|
157
181
|
&:hover {
|
|
158
|
-
color: ${
|
|
182
|
+
color: ${active};
|
|
159
183
|
}
|
|
160
184
|
}
|
|
161
185
|
`;
|
|
@@ -179,16 +203,15 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
179
203
|
align-items: center;
|
|
180
204
|
margin: 0;
|
|
181
205
|
&+p.attachment-error {
|
|
182
|
-
color: ${
|
|
183
|
-
font-family: ${fontFamily};
|
|
184
|
-
font-weight: 600;
|
|
206
|
+
color: ${danger};
|
|
185
207
|
}
|
|
186
208
|
span {
|
|
187
209
|
display: none;
|
|
188
|
-
color: ${
|
|
210
|
+
color: ${danger};
|
|
189
211
|
margin: 10px;
|
|
190
212
|
cursor: help;
|
|
191
213
|
opacity: 0;
|
|
214
|
+
${paragraph1};
|
|
192
215
|
span {
|
|
193
216
|
display: block;
|
|
194
217
|
position: absolute;
|
|
@@ -200,7 +223,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
200
223
|
height: max-content;
|
|
201
224
|
max-height: 72px;
|
|
202
225
|
overflow: auto;
|
|
203
|
-
border: 1px solid ${
|
|
226
|
+
border: 1px solid ${danger};
|
|
204
227
|
border-radius: 4px;
|
|
205
228
|
padding: 5px 8px;
|
|
206
229
|
transition: transform 0.3s linear 0.3s;
|
|
@@ -213,7 +236,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
213
236
|
&::-webkit-scrollbar-thumb{
|
|
214
237
|
border-radius: 10px;
|
|
215
238
|
mix-blend-mode: normal;
|
|
216
|
-
background-color: ${
|
|
239
|
+
background-color: ${danger} !important;
|
|
217
240
|
background-clip: content-box;
|
|
218
241
|
}
|
|
219
242
|
ul {
|
|
@@ -232,10 +255,9 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
232
255
|
}
|
|
233
256
|
`;
|
|
234
257
|
const AttachmentText = css`
|
|
235
|
-
|
|
236
|
-
${typography.heading5};
|
|
258
|
+
${heading5};
|
|
237
259
|
text-transform: uppercase;
|
|
238
|
-
color: ${
|
|
260
|
+
color: ${sub};
|
|
239
261
|
user-select: none;
|
|
240
262
|
`;
|
|
241
263
|
const AttachmentHeaderIcon = css`
|
|
@@ -276,20 +298,19 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
276
298
|
width: 24px;
|
|
277
299
|
height: 24px;
|
|
278
300
|
svg {
|
|
279
|
-
color: ${
|
|
301
|
+
color: ${rest};
|
|
280
302
|
}
|
|
281
303
|
&:hover {
|
|
282
|
-
border-color: ${
|
|
304
|
+
border-color: ${lineHover};
|
|
283
305
|
svg {
|
|
284
|
-
color: ${
|
|
306
|
+
color: ${active};
|
|
285
307
|
}
|
|
286
308
|
}
|
|
287
309
|
`;
|
|
288
310
|
const AttachmentImageText = css`
|
|
289
311
|
display: none;
|
|
290
|
-
|
|
291
|
-
${
|
|
292
|
-
color: ${color.system.rest};
|
|
312
|
+
${paragraph3};
|
|
313
|
+
color: ${rest};
|
|
293
314
|
user-select: none;
|
|
294
315
|
`;
|
|
295
316
|
const AttachmentImage = css`
|
|
@@ -312,15 +333,15 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
312
333
|
width: 64px;
|
|
313
334
|
height: 64px;
|
|
314
335
|
margin: 0 auto 8px auto;
|
|
315
|
-
border: 1px dashed ${
|
|
336
|
+
border: 1px dashed ${normal};
|
|
316
337
|
border-radius: 50%;
|
|
317
338
|
svg {
|
|
318
339
|
width: 40px;
|
|
319
340
|
height: 40px;
|
|
320
341
|
}
|
|
321
342
|
&:hover {
|
|
322
|
-
border-color: ${
|
|
323
|
-
background-color: ${
|
|
343
|
+
border-color: ${lineHover};
|
|
344
|
+
background-color: ${fillHover};
|
|
324
345
|
}
|
|
325
346
|
}
|
|
326
347
|
}
|
|
@@ -352,13 +373,12 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
352
373
|
width: 4px;
|
|
353
374
|
height: 4px;
|
|
354
375
|
border-radius: 50%;
|
|
355
|
-
background: ${
|
|
376
|
+
background: ${success};
|
|
356
377
|
}
|
|
357
378
|
`;
|
|
358
379
|
const AttachedItemInfoName = css`
|
|
359
|
-
|
|
360
|
-
${
|
|
361
|
-
color: ${color.system.dark};
|
|
380
|
+
${paragraph1};
|
|
381
|
+
color: ${dark};
|
|
362
382
|
margin-left: 12px;
|
|
363
383
|
padding-top: 1px;
|
|
364
384
|
cursor: pointer;
|
|
@@ -373,9 +393,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
373
393
|
/* max-width: 50%; */
|
|
374
394
|
height: 100%;
|
|
375
395
|
align-items: center;
|
|
376
|
-
|
|
377
|
-
${
|
|
378
|
-
color: ${color.text.sub};
|
|
396
|
+
${paragraph2};
|
|
397
|
+
color: ${sub};
|
|
379
398
|
cursor: pointer;
|
|
380
399
|
user-select: none;
|
|
381
400
|
.detail-info {
|
|
@@ -499,7 +518,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
499
518
|
}
|
|
500
519
|
}
|
|
501
520
|
.css-${AttachedItemInfoName.name} {
|
|
502
|
-
${
|
|
521
|
+
${paragraph3};
|
|
503
522
|
margin: 0 8px;
|
|
504
523
|
display: -webkit-box;
|
|
505
524
|
word-break: break-word;
|
|
@@ -513,8 +532,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
513
532
|
.css-${AttachedItemOwner.name} {
|
|
514
533
|
position: inherit;
|
|
515
534
|
height: auto;
|
|
516
|
-
|
|
517
|
-
line-height: 14px;
|
|
535
|
+
${paragraph3};
|
|
518
536
|
.detail-info {
|
|
519
537
|
display: none;
|
|
520
538
|
}
|
|
@@ -534,7 +552,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
534
552
|
}
|
|
535
553
|
`;
|
|
536
554
|
const AttachmentRoot = css`
|
|
537
|
-
border: 1px solid ${
|
|
555
|
+
border: 1px solid ${normal};
|
|
538
556
|
display: block;
|
|
539
557
|
position: relative;
|
|
540
558
|
flex-wrap: wrap;
|
|
@@ -542,7 +560,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
542
560
|
flex-direction: column;
|
|
543
561
|
padding-bottom: 20px;
|
|
544
562
|
justify-content: start;
|
|
545
|
-
background-color: ${
|
|
563
|
+
background-color: ${white};
|
|
546
564
|
border-radius: 4px;
|
|
547
565
|
&:hover:not(.disabled) {
|
|
548
566
|
.css-${AttachmentImageIcon.name} {
|
|
@@ -553,22 +571,22 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
553
571
|
&:not(.disabled) {
|
|
554
572
|
.css-${AttachedItem.name} {
|
|
555
573
|
&:hover {
|
|
556
|
-
background-color: ${
|
|
574
|
+
background-color: ${fillHover};
|
|
557
575
|
.css-${AttachedLinear.name} {
|
|
558
|
-
background-color: ${
|
|
576
|
+
background-color: ${fillHover};
|
|
559
577
|
}
|
|
560
578
|
}
|
|
561
579
|
&:active {
|
|
562
|
-
background-color: ${
|
|
580
|
+
background-color: ${pressed};
|
|
563
581
|
.css-${AttachedLinear.name} {
|
|
564
|
-
background-color: ${
|
|
582
|
+
background-color: ${pressed};
|
|
565
583
|
}
|
|
566
584
|
}
|
|
567
585
|
&.chosen {
|
|
568
|
-
background-color: ${
|
|
586
|
+
background-color: ${focus};
|
|
569
587
|
.css-${AttachedItemInfo.name},
|
|
570
588
|
.css-${AttachedItemOwner.name} {
|
|
571
|
-
background-color: ${
|
|
589
|
+
background-color: ${focus};
|
|
572
590
|
}
|
|
573
591
|
}
|
|
574
592
|
}
|
|
@@ -662,15 +680,13 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
662
680
|
};
|
|
663
681
|
|
|
664
682
|
const onChangeViewAttachType = (e, viewAttachType2) => {
|
|
665
|
-
const type = viewAttachType2 ||
|
|
683
|
+
const type = viewAttachType2 || viewTypeState;
|
|
666
684
|
|
|
667
685
|
if (type === 'detail') {
|
|
668
|
-
|
|
669
|
-
viewAttachTypeRef.current.innerHTML = icons['icon'];
|
|
686
|
+
setViewTypeState('icon');
|
|
670
687
|
attachedRef.current.classList.add('icon-view');
|
|
671
688
|
} else {
|
|
672
|
-
|
|
673
|
-
viewAttachTypeRef.current.innerHTML = icons['detail'];
|
|
689
|
+
setViewTypeState('detail');
|
|
674
690
|
attachedRef.current.classList.remove('icon-view');
|
|
675
691
|
}
|
|
676
692
|
};
|
|
@@ -709,7 +725,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
709
725
|
errorInfoIcon.style.opacity = 1;
|
|
710
726
|
errorInfoIcon.style.display = 'flex';
|
|
711
727
|
} else if (errorInfoIcon.style.color === 'rgb(0, 149, 255)') {
|
|
712
|
-
errorInfoIcon.style.color =
|
|
728
|
+
errorInfoIcon.style.color = danger;
|
|
713
729
|
}
|
|
714
730
|
|
|
715
731
|
if (onUploadError) {
|
|
@@ -724,7 +740,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
724
740
|
attachTextRef.current.parentNode.querySelector('ul').insertAdjacentElement('afterBegin', el);
|
|
725
741
|
});
|
|
726
742
|
} else if (errorInfoIcon.style.opacity === '1') {
|
|
727
|
-
errorInfoIcon.style.color =
|
|
743
|
+
errorInfoIcon.style.color = info;
|
|
728
744
|
}
|
|
729
745
|
};
|
|
730
746
|
|
|
@@ -784,6 +800,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
784
800
|
}
|
|
785
801
|
|
|
786
802
|
insertAttached(files);
|
|
803
|
+
stripDomain();
|
|
787
804
|
if (onChange) onChange({
|
|
788
805
|
element: e.target,
|
|
789
806
|
attached,
|
|
@@ -1024,12 +1041,15 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1024
1041
|
|
|
1025
1042
|
const onDownloadMultiple = () => {
|
|
1026
1043
|
const index = chosenItems[0];
|
|
1044
|
+
let file = null;
|
|
1027
1045
|
|
|
1028
1046
|
if (index < oldAttached.length) {
|
|
1029
|
-
|
|
1047
|
+
file = mountDomain(oldAttached[index]);
|
|
1048
|
+
onDownload(file.URL, file.FileName);
|
|
1030
1049
|
} else {
|
|
1031
1050
|
const files = allNewAttached.getAll('files');
|
|
1032
|
-
|
|
1051
|
+
file = mountDomain(files[index - oldAttached.length]);
|
|
1052
|
+
onDownload(file.URL, file.name);
|
|
1033
1053
|
}
|
|
1034
1054
|
};
|
|
1035
1055
|
|
|
@@ -1055,6 +1075,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1055
1075
|
afterChangeFile(attached.length);
|
|
1056
1076
|
}
|
|
1057
1077
|
|
|
1078
|
+
stripDomain();
|
|
1058
1079
|
if (onChange) onChange({
|
|
1059
1080
|
element: nodeList,
|
|
1060
1081
|
attached,
|
|
@@ -1420,6 +1441,36 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1420
1441
|
webkitRelativePath: fileInfo.webkitRelativePath
|
|
1421
1442
|
});
|
|
1422
1443
|
|
|
1444
|
+
const mountDomain = item => {
|
|
1445
|
+
if (!item) return item;
|
|
1446
|
+
|
|
1447
|
+
if (!/\/$/.test(domain)) {
|
|
1448
|
+
domain = domain + '/';
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
if (item !== null && item !== void 0 && item.URL) {
|
|
1452
|
+
item.URL = item.URL.indexOf('http') < 0 ? domain + item.URL : item.URL;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
return item;
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
const stripDomain = () => {
|
|
1459
|
+
if (isStripDomain && domain) {
|
|
1460
|
+
const re = new RegExp(domain + '/?');
|
|
1461
|
+
attached.forEach(item => {
|
|
1462
|
+
var _item$URL;
|
|
1463
|
+
|
|
1464
|
+
item.URL = (item === null || item === void 0 ? void 0 : (_item$URL = item.URL) === null || _item$URL === void 0 ? void 0 : _item$URL.replace(re, '')) || '';
|
|
1465
|
+
});
|
|
1466
|
+
oldAttached.forEach(item => {
|
|
1467
|
+
var _item$URL2;
|
|
1468
|
+
|
|
1469
|
+
item.URL = (item === null || item === void 0 ? void 0 : (_item$URL2 = item.URL) === null || _item$URL2 === void 0 ? void 0 : _item$URL2.replace(re, '')) || '';
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1423
1474
|
useEffect(() => {
|
|
1424
1475
|
if (refs) refs(ref);
|
|
1425
1476
|
|
|
@@ -1436,8 +1487,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1436
1487
|
let el = null;
|
|
1437
1488
|
|
|
1438
1489
|
if (error) {
|
|
1439
|
-
attachTextRef.current.style.color =
|
|
1440
|
-
ref.current.style.borderColor = errorStyle && errorStyle.borderColor ||
|
|
1490
|
+
attachTextRef.current.style.color = danger;
|
|
1491
|
+
ref.current.style.borderColor = errorStyle && errorStyle.borderColor || danger;
|
|
1441
1492
|
el = document.createElement('p');
|
|
1442
1493
|
el.classList.add('attachment-error');
|
|
1443
1494
|
Object.assign(el.style, errorStyle);
|
|
@@ -1457,7 +1508,6 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1457
1508
|
};
|
|
1458
1509
|
}, [required, error]);
|
|
1459
1510
|
useEffect(() => {
|
|
1460
|
-
// viewAttachTypeRef.current.innerHTML = icons[viewType];
|
|
1461
1511
|
onChangeViewAttachType(null, viewType === 'icon' ? 'detail' : 'icon');
|
|
1462
1512
|
}, [viewType]);
|
|
1463
1513
|
useEffect(() => {
|
|
@@ -1501,15 +1551,16 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1501
1551
|
const length = data.length;
|
|
1502
1552
|
|
|
1503
1553
|
for (let i = 0; i < length; i++) {
|
|
1504
|
-
const
|
|
1554
|
+
const item = domain ? mountDomain(data[i]) : data[i];
|
|
1555
|
+
const newAttach = getItemHTMLFromData(item, i);
|
|
1505
1556
|
|
|
1506
|
-
if (Object.prototype.toString.call(
|
|
1507
|
-
allNewAttached.append('files',
|
|
1557
|
+
if (Object.prototype.toString.call(item) === '[object File]') {
|
|
1558
|
+
allNewAttached.append('files', item);
|
|
1508
1559
|
} else {
|
|
1509
|
-
oldAttached.push(
|
|
1560
|
+
oldAttached.push(item);
|
|
1510
1561
|
}
|
|
1511
1562
|
|
|
1512
|
-
attached.push(
|
|
1563
|
+
attached.push(item);
|
|
1513
1564
|
const newElement = document.createElement('div');
|
|
1514
1565
|
newElement.className = 'attachment-row';
|
|
1515
1566
|
ReactDOM.render(newAttach, attachedRef.current.appendChild(newElement));
|
|
@@ -1654,32 +1705,30 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1654
1705
|
color: 'currentColor'
|
|
1655
1706
|
})), jsx("span", {
|
|
1656
1707
|
css: AttachmentImageText
|
|
1657
|
-
}, hintText || '
|
|
1708
|
+
}, hintText || getGlobal('dropFileHere'))))), allowSort && jsx(ButtonIcon, {
|
|
1709
|
+
viewType: 'ghost',
|
|
1658
1710
|
name: 'Sort',
|
|
1659
1711
|
ref: sortIconRef,
|
|
1660
|
-
viewBox: true,
|
|
1661
1712
|
style: {
|
|
1662
|
-
padding: 0,
|
|
1663
1713
|
marginRight: 8,
|
|
1664
1714
|
display: 'none'
|
|
1665
1715
|
},
|
|
1666
1716
|
onClick: onShowSortPopover
|
|
1667
|
-
}), jsx(
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
onClick: onChangeViewAttachType
|
|
1671
|
-
|
|
1672
|
-
}))), [allowSort, readOnly]);
|
|
1717
|
+
}), jsx(ButtonIcon, {
|
|
1718
|
+
viewType: 'ghost',
|
|
1719
|
+
name: viewTypeState === 'detail' ? 'IconView' : 'ListView',
|
|
1720
|
+
onClick: onChangeViewAttachType
|
|
1721
|
+
}))), [allowSort, readOnly, viewTypeState]);
|
|
1673
1722
|
const AttachmentInputView = useMemo(() => jsx("div", {
|
|
1674
1723
|
css: AttachmentInput
|
|
1675
|
-
}, jsx("input",
|
|
1724
|
+
}, jsx("input", { ...inputProps,
|
|
1676
1725
|
type: "file",
|
|
1677
1726
|
ref: attachmentInputRef,
|
|
1678
1727
|
title: "",
|
|
1679
1728
|
style: inputStyle,
|
|
1680
1729
|
onDrop: onDropInput,
|
|
1681
1730
|
onDragLeave: onDropInput
|
|
1682
|
-
}))
|
|
1731
|
+
})), [inputStyle]);
|
|
1683
1732
|
const AttachedView = useMemo(() => jsx(ScrollBar, {
|
|
1684
1733
|
style: {
|
|
1685
1734
|
marginRight: 5,
|
|
@@ -1746,7 +1795,7 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1746
1795
|
const ModalView = useMemo(() => {
|
|
1747
1796
|
if (!chosenItems.length) return setOpen(false);
|
|
1748
1797
|
const index = chosenItems[0];
|
|
1749
|
-
const data = attached[index]; // let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
|
|
1798
|
+
const data = mountDomain(attached[index]); // let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
|
|
1750
1799
|
|
|
1751
1800
|
return jsx(ModalSample, {
|
|
1752
1801
|
open: open,
|
|
@@ -1758,19 +1807,20 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1758
1807
|
}, [open]); // End view
|
|
1759
1808
|
|
|
1760
1809
|
useImperativeHandle(reference, () => {
|
|
1810
|
+
stripDomain();
|
|
1761
1811
|
ref.current.oldAttached = oldAttached;
|
|
1762
1812
|
ref.current.allNewAttached = allNewAttached;
|
|
1763
1813
|
ref.current.attached = attached;
|
|
1764
1814
|
ref.current.clear = clearAllAttached;
|
|
1765
1815
|
return ref.current;
|
|
1766
1816
|
});
|
|
1767
|
-
return jsx("div",
|
|
1817
|
+
return jsx("div", { ...props,
|
|
1768
1818
|
css: AttachmentRoot,
|
|
1769
1819
|
className: ('DGN-UI-Attachment ' + className).trim(),
|
|
1770
1820
|
style: style,
|
|
1771
1821
|
ref: ref,
|
|
1772
1822
|
onDragEnter: onDragFileStart
|
|
1773
|
-
}
|
|
1823
|
+
}, AttachHeaderView, AttachmentInputView, AttachedView, PopoverView, PopupView, ModalView);
|
|
1774
1824
|
}));
|
|
1775
1825
|
Attachment.defaultProps = {
|
|
1776
1826
|
deleteNotifyText: getGlobal('deleteNotifyText'),
|
|
@@ -1821,6 +1871,12 @@ Attachment.propTypes = {
|
|
|
1821
1871
|
/** attach label to display in the upper left corner of attachment box */
|
|
1822
1872
|
label: PropTypes.string,
|
|
1823
1873
|
|
|
1874
|
+
/** domain of attachments*/
|
|
1875
|
+
domain: PropTypes.string,
|
|
1876
|
+
|
|
1877
|
+
/** strip domain of attachments if it's true */
|
|
1878
|
+
isStripDomain: PropTypes.bool,
|
|
1879
|
+
|
|
1824
1880
|
/** class of Attachment component */
|
|
1825
1881
|
className: PropTypes.string,
|
|
1826
1882
|
|