diginet-core-ui 1.3.92 → 1.3.93
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/components/form-control/calendar/function.js +64 -62
- package/components/form-control/checkbox/index.js +60 -62
- package/components/form-control/date-range-picker/index.js +20 -49
- package/components/form-control/dropdown/index.js +24 -22
- package/components/modal/body.js +15 -31
- package/components/modal/footer.js +15 -13
- package/components/modal/header.js +36 -38
- package/components/modal/modal.js +21 -29
- package/package.json +1 -1
- package/readme.md +6 -0
|
@@ -61,77 +61,79 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
|
|
|
61
61
|
padding: 0;
|
|
62
62
|
table-layout: fixed;
|
|
63
63
|
.${unique.table.data} {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
&:nth-of-type(7n) {
|
|
73
|
-
${textColor('danger8')};
|
|
74
|
-
}
|
|
75
|
-
&.next_month,
|
|
76
|
-
&.previous_month,
|
|
77
|
-
&.${unique.day.limit} {
|
|
78
|
-
opacity: 0.25;
|
|
79
|
-
}
|
|
80
|
-
&.${unique.day.limit} {
|
|
81
|
-
${pointerEventsNone};
|
|
82
|
-
${cursorDefault};
|
|
83
|
-
}
|
|
84
|
-
&:hover {
|
|
85
|
-
span.${unique.day.day} {
|
|
86
|
-
${bgColor('fill.hover')};
|
|
64
|
+
&:not(.empty) {
|
|
65
|
+
${cursorPointer};
|
|
66
|
+
${positionRelative};
|
|
67
|
+
${textCenter};
|
|
68
|
+
${userSelectNone};
|
|
69
|
+
${textColor('text.main')};
|
|
70
|
+
&:nth-of-type(7n - 1) {
|
|
71
|
+
${textColor('info8')};
|
|
87
72
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
&:nth-of-type(7n) {
|
|
74
|
+
${textColor('danger8')};
|
|
75
|
+
}
|
|
76
|
+
&.next_month,
|
|
77
|
+
&.previous_month,
|
|
78
|
+
&.${unique.day.limit} {
|
|
79
|
+
opacity: 0.25;
|
|
80
|
+
}
|
|
81
|
+
&.${unique.day.limit} {
|
|
82
|
+
${pointerEventsNone};
|
|
83
|
+
${cursorDefault};
|
|
84
|
+
}
|
|
85
|
+
&:hover {
|
|
91
86
|
span.${unique.day.day} {
|
|
92
|
-
${bgColor('fill.
|
|
87
|
+
${bgColor('fill.hover')};
|
|
93
88
|
}
|
|
94
89
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
${onClickActive && css`
|
|
91
|
+
&:active {
|
|
92
|
+
span.${unique.day.day} {
|
|
93
|
+
${bgColor('fill.pressed')};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`}
|
|
97
|
+
&.${unique.day.active} {
|
|
98
|
+
span.${unique.day.day} {
|
|
99
|
+
${bgColor('fill.focus')};
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
&.${unique.day.today} {
|
|
103
|
+
span {
|
|
104
|
+
${boxBorder};
|
|
105
|
+
${border(1, 'system.active')};
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
&.${unique.day.between} {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
&::before {
|
|
111
|
+
${bgColor('fill.hover')};
|
|
112
|
+
}
|
|
111
113
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
&.${unique.day.from} {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
&::before {
|
|
117
|
+
${bgColor('fill.hover')};
|
|
118
|
+
border-bottom-left-radius: 12px;
|
|
119
|
+
border-top-left-radius: 12px;
|
|
120
|
+
left: calc((100% - 24px) / 2);
|
|
121
|
+
}
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
&.${unique.day.to} {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
&::before {
|
|
126
|
+
${bgColor('fill.hover')};
|
|
127
|
+
border-bottom-right-radius: 12px;
|
|
128
|
+
border-top-right-radius: 12px;
|
|
129
|
+
right: calc((100% - 24px) / 2);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
::before {
|
|
133
|
+
${positionAbsolute};
|
|
134
|
+
${inset('1px -2px')};
|
|
135
|
+
content: '';
|
|
129
136
|
}
|
|
130
|
-
}
|
|
131
|
-
::before {
|
|
132
|
-
${positionAbsolute};
|
|
133
|
-
${inset('1px -2px')};
|
|
134
|
-
content: '';
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
.${unique.table.header} {
|
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { forwardRef, memo, useEffect, useRef, useState, useImperativeHandle, Fragment } from 'react';
|
|
6
4
|
import { Typography } from "../..";
|
|
7
|
-
import
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef, Fragment, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
|
+
import { bgColor, border, borderColor, borderRadius, boxBorder, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, flexRow, itemsCenter, itemsStart, left, mg, mgb, parseMinWidthHeight, parseWidth, parseWidthHeight, positionAbsolute, positionRelative, scale, textColor, top } from "../../../styles/general";
|
|
8
|
+
import { useTheme } from "../../../theme";
|
|
8
9
|
import { classNames, randomString, refType as ref } from "../../../utils";
|
|
9
|
-
import { useTheme, useColor as colors } from "../../../theme";
|
|
10
10
|
const {
|
|
11
11
|
colors: {
|
|
12
12
|
system: {
|
|
13
|
-
|
|
14
|
-
white,
|
|
15
|
-
disabled: systemDisabled
|
|
13
|
+
white: systemWhite
|
|
16
14
|
},
|
|
17
15
|
fill: {
|
|
18
|
-
hover:
|
|
19
|
-
pressed:
|
|
20
|
-
},
|
|
21
|
-
formal2: clFormal2,
|
|
22
|
-
semantic: {
|
|
23
|
-
danger: clDanger
|
|
16
|
+
hover: fillHover,
|
|
17
|
+
pressed: fillPressed
|
|
24
18
|
}
|
|
25
19
|
},
|
|
26
20
|
spacing
|
|
27
21
|
} = useTheme();
|
|
28
|
-
const padding =
|
|
22
|
+
const padding = 0.75;
|
|
29
23
|
const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
30
24
|
action = {},
|
|
31
25
|
checked,
|
|
@@ -50,9 +44,8 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
50
44
|
width,
|
|
51
45
|
...props
|
|
52
46
|
}, reference) => {
|
|
53
|
-
if (!
|
|
54
|
-
|
|
55
|
-
}
|
|
47
|
+
if (!reference) reference = useRef(null);
|
|
48
|
+
if (!inputRef) inputRef = useRef(null);
|
|
56
49
|
const ref = useRef(null);
|
|
57
50
|
if (typeof width === 'number') width += 'px';
|
|
58
51
|
const [checkedState, setCheckedState] = useState(checked || defaultChecked);
|
|
@@ -62,9 +55,8 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
62
55
|
allowSymbol: false
|
|
63
56
|
}));
|
|
64
57
|
}
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const _CheckBoxInputCSS = CheckBoxInputCSS(_CheckBoxSquareCSS.name, clMain);
|
|
58
|
+
const _CheckBoxSquareCSS = CheckBoxSquareCSS(width, color);
|
|
59
|
+
const _CheckBoxInputCSS = CheckBoxInputCSS(_CheckBoxSquareCSS.name, color);
|
|
68
60
|
const handleChange = event => {
|
|
69
61
|
stopPropagation && event.stopPropagation();
|
|
70
62
|
if (readOnly || inputProps.readOnly || disabled || inputProps.disabled) return;
|
|
@@ -112,7 +104,10 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
112
104
|
className: classNames('DGN-UI-Checkbox', className),
|
|
113
105
|
ref: ref,
|
|
114
106
|
...props,
|
|
115
|
-
onClick:
|
|
107
|
+
onClick: () => {
|
|
108
|
+
var _inputRef$current$cli, _inputRef$current;
|
|
109
|
+
return (_inputRef$current$cli = (_inputRef$current = inputRef.current).click) === null || _inputRef$current$cli === void 0 ? void 0 : _inputRef$current$cli.call(_inputRef$current);
|
|
110
|
+
}
|
|
116
111
|
}, jsx("div", {
|
|
117
112
|
css: CheckBoxRootCSS,
|
|
118
113
|
className: classNames('DGN-UI-Checkbox-Root', disabled && 'disabled', readOnly && 'read-only')
|
|
@@ -135,130 +130,133 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
135
130
|
}, jsx("span", {
|
|
136
131
|
className: classNames(determinate ? 'determinate' : 'indeterminate', readOnly && 'read-only', disabled && 'disabled'),
|
|
137
132
|
css: _CheckBoxSquareCSS
|
|
138
|
-
}),
|
|
133
|
+
}), children || label ? jsx(Typography, {
|
|
139
134
|
type: 'p1',
|
|
140
135
|
style: {
|
|
141
136
|
marginLeft: spacing(1)
|
|
142
137
|
},
|
|
143
|
-
color: disabled ?
|
|
138
|
+
color: disabled ? 'system.disabled' : '',
|
|
144
139
|
...labelProps
|
|
145
|
-
}, jsx(Fragment, null, children || label, required
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}, "*"))))));
|
|
140
|
+
}, jsx(Fragment, null, children || label, required ? jsx("span", {
|
|
141
|
+
css: textColor(disabled ? 'system.disabled' : 'semantic.danger')
|
|
142
|
+
}, "*") : null)) : null)));
|
|
150
143
|
}));
|
|
151
|
-
const CheckBoxSquareCSS = (width,
|
|
144
|
+
const CheckBoxSquareCSS = (width, color) => css`
|
|
145
|
+
${displayFlex};
|
|
152
146
|
${flexRow};
|
|
153
147
|
${positionRelative};
|
|
154
148
|
${cursorPointer};
|
|
155
149
|
${boxBorder};
|
|
156
|
-
${parseWidthHeight(width
|
|
157
|
-
${border(2, rest)};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
margin: ${padding}px;
|
|
150
|
+
${parseWidthHeight(width)};
|
|
151
|
+
${border(2, 'system.rest')};
|
|
152
|
+
${parseMinWidthHeight(width)};
|
|
153
|
+
${bgColor('white')};
|
|
154
|
+
${borderRadius(2)};
|
|
155
|
+
${mg([padding])};
|
|
163
156
|
&.determinate {
|
|
164
157
|
&::after {
|
|
165
158
|
${displayBlock};
|
|
166
159
|
${positionAbsolute};
|
|
167
160
|
${parseWidthHeight(12.6, 7)};
|
|
161
|
+
${left('50%')};
|
|
162
|
+
${top('43%')};
|
|
168
163
|
content: '';
|
|
169
|
-
left: 50%;
|
|
170
|
-
top: 43%;
|
|
171
164
|
transform: translate(-50%, -50%) scale(0) rotate(45deg);
|
|
172
165
|
transition: transform 0.3s;
|
|
173
166
|
}
|
|
174
167
|
}
|
|
175
168
|
&.indeterminate {
|
|
176
169
|
&::after {
|
|
170
|
+
${displayFlex};
|
|
177
171
|
${flexRow};
|
|
178
172
|
${positionAbsolute};
|
|
179
173
|
${parseWidthHeight(10, 2)};
|
|
174
|
+
${bgColor('white')};
|
|
175
|
+
${left(2)};
|
|
176
|
+
${top(6)};
|
|
177
|
+
${scale(0)};
|
|
180
178
|
content: '';
|
|
181
|
-
background-color: white;
|
|
182
|
-
left: 2px;
|
|
183
|
-
top: 6px;
|
|
184
179
|
transition: transform 0.3s;
|
|
185
|
-
transform: scale(0);
|
|
186
180
|
}
|
|
187
181
|
}
|
|
188
182
|
&:not(.disabled):not(.read-only) {
|
|
189
183
|
&:hover {
|
|
190
|
-
box-shadow: 0 0 0 3px ${
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
box-shadow: 0 0 0 3px ${fillHover};
|
|
185
|
+
${bgColor('fill.hover')};
|
|
186
|
+
${borderColor(color)};
|
|
193
187
|
}
|
|
194
188
|
&:focus,
|
|
195
189
|
&:active {
|
|
196
|
-
box-shadow: 0 0 0 3px ${
|
|
197
|
-
|
|
190
|
+
box-shadow: 0 0 0 3px ${fillPressed};
|
|
191
|
+
${bgColor('fill.pressed')};
|
|
198
192
|
}
|
|
199
193
|
}
|
|
200
194
|
&:not(disabled):focus {
|
|
201
|
-
box-shadow: 0 0 0 3px ${
|
|
202
|
-
|
|
195
|
+
box-shadow: 0 0 0 3px ${fillPressed};
|
|
196
|
+
${bgColor('fill.pressed')};
|
|
203
197
|
}
|
|
204
198
|
&.disabled,
|
|
205
199
|
&.read-only {
|
|
206
|
-
${
|
|
200
|
+
${cursorNotAllowed};
|
|
207
201
|
}
|
|
208
202
|
`;
|
|
209
|
-
const CheckBoxInputCSS = (CheckBoxSquareCSSName,
|
|
203
|
+
const CheckBoxInputCSS = (CheckBoxSquareCSSName, color) => css`
|
|
210
204
|
&:checked + label > span.css-${CheckBoxSquareCSSName} {
|
|
211
205
|
&.determinate {
|
|
212
206
|
&::after {
|
|
213
207
|
transform: translate(-50%, -66%) scale(1) rotate(-45deg);
|
|
214
|
-
background: linear-gradient(${
|
|
215
|
-
linear-gradient(${
|
|
208
|
+
background: linear-gradient(${systemWhite}, ${systemWhite}) left bottom/2px 100%,
|
|
209
|
+
linear-gradient(${systemWhite}, ${systemWhite}) left bottom/100% 2px;
|
|
216
210
|
background-repeat: no-repeat;
|
|
217
211
|
}
|
|
218
212
|
}
|
|
219
213
|
&.indeterminate {
|
|
220
214
|
&::after {
|
|
221
|
-
|
|
215
|
+
${scale(1)};
|
|
222
216
|
}
|
|
223
217
|
}
|
|
224
218
|
}
|
|
225
219
|
&:checked:not(:disabled) + label > span.css-${CheckBoxSquareCSSName} {
|
|
226
|
-
|
|
227
|
-
|
|
220
|
+
${bgColor(color)};
|
|
221
|
+
${borderColor(color)};
|
|
228
222
|
}
|
|
229
223
|
&:checked:disabled {
|
|
230
224
|
& + label > span.css-${CheckBoxSquareCSSName} {
|
|
231
225
|
&:not(.indeterminate) {
|
|
232
|
-
|
|
226
|
+
${bgColor('system.disabled')};
|
|
233
227
|
}
|
|
234
228
|
&.indeterminate {
|
|
235
|
-
|
|
236
|
-
|
|
229
|
+
${bgColor('formal2')};
|
|
230
|
+
${borderColor('formal2')};
|
|
237
231
|
}
|
|
238
232
|
}
|
|
239
233
|
}
|
|
240
234
|
&:disabled {
|
|
241
235
|
& + label > span.css-${CheckBoxSquareCSSName} {
|
|
242
|
-
|
|
236
|
+
${borderColor('system.disabled')};
|
|
243
237
|
}
|
|
244
238
|
}
|
|
245
239
|
`;
|
|
246
240
|
const CheckBoxLabelCSS = css`
|
|
241
|
+
${displayFlex};
|
|
247
242
|
${flexRow};
|
|
248
243
|
${positionRelative};
|
|
249
244
|
${itemsCenter};
|
|
250
245
|
${boxBorder};
|
|
251
|
-
margin-bottom: 0 !important;
|
|
252
246
|
`;
|
|
253
247
|
const CheckBoxRootCSS = css`
|
|
248
|
+
${displayFlex};
|
|
254
249
|
${flexRow};
|
|
255
250
|
${itemsStart};
|
|
256
251
|
${boxBorder};
|
|
252
|
+
& > label {
|
|
253
|
+
${mgb(0)};
|
|
254
|
+
}
|
|
257
255
|
`;
|
|
258
256
|
const CheckboxContainerCSS = css`
|
|
259
257
|
${displayBlock};
|
|
260
258
|
${positionRelative};
|
|
261
|
-
|
|
259
|
+
${parseWidth('fit-content')};
|
|
262
260
|
`;
|
|
263
261
|
Checkbox.defaultProps = {
|
|
264
262
|
className: '',
|
|
@@ -7,17 +7,12 @@ import locale from "../../../locale";
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
9
|
import { render } from 'react-dom';
|
|
10
|
-
import {
|
|
10
|
+
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexCol, flexRow, justifyEnd, left, mg, parseHeight, parseMaxWidth, parseMinWidth, parseWidthHeight, pd, pointerEventsNone, positionFixed, textCenter, top, userSelectNone, whiteSpaceNoWrap } from "../../../styles/general";
|
|
11
11
|
import { useTheme } from "../../../theme";
|
|
12
12
|
import { capitalizeSentenceCase, classNames, date as moment, isEqual, randomString, updatePosition } from "../../../utils";
|
|
13
13
|
import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from "../calendar/function";
|
|
14
14
|
import ControlComp from "../control";
|
|
15
15
|
const {
|
|
16
|
-
colors: {
|
|
17
|
-
system: {
|
|
18
|
-
white: systemWhite
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
16
|
boxShadows: {
|
|
22
17
|
large: boxShadowsLarge
|
|
23
18
|
},
|
|
@@ -260,7 +255,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
260
255
|
tableData.push(jsx("td", {
|
|
261
256
|
key: `previous_month-${prevDate - i + 1}`,
|
|
262
257
|
"data-time": day - 1,
|
|
263
|
-
className: classNames(unique.table.data, 'previous_month', isBetween(day - 1))
|
|
258
|
+
className: classNames(unique.table.data, 'previous_month', isBetween(day - 1), 'empty')
|
|
264
259
|
}, jsx("span", {
|
|
265
260
|
className: unique.day.day
|
|
266
261
|
})));
|
|
@@ -300,7 +295,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
300
295
|
tableData.push(jsx("td", {
|
|
301
296
|
key: `next_month-${i + 1}`,
|
|
302
297
|
"data-time": i < 6 - weekDateLast && day + 1,
|
|
303
|
-
className: classNames(unique.table.data, 'next_month', i < 6 - weekDateLast && isBetween(day + 1))
|
|
298
|
+
className: classNames(unique.table.data, 'next_month', i < 6 - weekDateLast && isBetween(day + 1), 'empty')
|
|
304
299
|
}, jsx("span", {
|
|
305
300
|
className: unique.day.day
|
|
306
301
|
})));
|
|
@@ -811,32 +806,11 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
811
806
|
if (ipRef.current.value !== '') {
|
|
812
807
|
update(values.current);
|
|
813
808
|
}
|
|
814
|
-
// if (disabled) {
|
|
815
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
816
|
-
// closePicker();
|
|
817
|
-
// } else if (!readOnly) {
|
|
818
|
-
// ipRef.current.addEventListener('focus', onInputFocus);
|
|
819
|
-
// } else {
|
|
820
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
821
|
-
// closePicker();
|
|
822
|
-
// }
|
|
823
|
-
|
|
824
809
|
if (isEnable) {
|
|
825
|
-
// iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
826
810
|
closePicker();
|
|
827
811
|
}
|
|
828
812
|
return () => {
|
|
829
813
|
if (!iconRef.current || !ipRef.current) return;
|
|
830
|
-
// if (disabled) {
|
|
831
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
832
|
-
// } else if (!readOnly) {
|
|
833
|
-
// ipRef.current.removeEventListener('focus', onInputFocus);
|
|
834
|
-
// } else {
|
|
835
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
836
|
-
// }
|
|
837
|
-
// if (isEnable) {
|
|
838
|
-
// iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
839
|
-
// }
|
|
840
814
|
closePicker();
|
|
841
815
|
};
|
|
842
816
|
}, [actionIconAt, clearAble, controls, disabled, displayFormat, max, min, pressESCToClose, readOnly, startFromZero, unitCount, viewType]);
|
|
@@ -861,7 +835,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
861
835
|
onClick: triggerFocus,
|
|
862
836
|
className: `${unique.icon} ${unique.icon}-accept`,
|
|
863
837
|
viewBox: true,
|
|
864
|
-
name: '
|
|
838
|
+
name: 'Calendar'
|
|
865
839
|
}), jsx(ButtonIcon, {
|
|
866
840
|
viewType: 'ghost',
|
|
867
841
|
onClick: onClear,
|
|
@@ -911,7 +885,7 @@ const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
911
885
|
className: unique.tooltip,
|
|
912
886
|
ref: tooltipRef
|
|
913
887
|
}, jsx(Typography, {
|
|
914
|
-
color:
|
|
888
|
+
color: 'system.white',
|
|
915
889
|
type: 'p2'
|
|
916
890
|
}));
|
|
917
891
|
const pickerComp = jsx("div", {
|
|
@@ -1021,13 +995,6 @@ const buttonProps = {
|
|
|
1021
995
|
}
|
|
1022
996
|
};
|
|
1023
997
|
const IconAreaCSS = css`
|
|
1024
|
-
${flexRow};
|
|
1025
|
-
${itemsCenter};
|
|
1026
|
-
${parseWidth(24)};
|
|
1027
|
-
color: inherit;
|
|
1028
|
-
& span {
|
|
1029
|
-
padding: 0;
|
|
1030
|
-
}
|
|
1031
998
|
.${unique.icon} {
|
|
1032
999
|
${displayNone};
|
|
1033
1000
|
${cursorPointer};
|
|
@@ -1041,9 +1008,10 @@ const IconAreaCSS = css`
|
|
|
1041
1008
|
}
|
|
1042
1009
|
`;
|
|
1043
1010
|
const ControlContainerCSS = css`
|
|
1011
|
+
${displayFlex};
|
|
1044
1012
|
${flexRow};
|
|
1045
1013
|
${justifyEnd};
|
|
1046
|
-
|
|
1014
|
+
${mg([0, 4, 4])};
|
|
1047
1015
|
`;
|
|
1048
1016
|
const pickerCSS = {
|
|
1049
1017
|
backGr: `
|
|
@@ -1052,11 +1020,13 @@ const pickerCSS = {
|
|
|
1052
1020
|
position: fixed;
|
|
1053
1021
|
z-index: ${zIndexCORE(1)};`,
|
|
1054
1022
|
container: css`
|
|
1023
|
+
${displayFlex};
|
|
1055
1024
|
${flexCol};
|
|
1056
1025
|
${borderRadius4px};
|
|
1057
|
-
|
|
1026
|
+
${bgColor('system.white')};
|
|
1058
1027
|
box-shadow: ${boxShadowsLarge};
|
|
1059
1028
|
.${unique.wrapper} {
|
|
1029
|
+
${displayFlex};
|
|
1060
1030
|
${flexRow};
|
|
1061
1031
|
${parseMinWidth(633)};
|
|
1062
1032
|
}
|
|
@@ -1069,8 +1039,8 @@ const pickerCSS = {
|
|
|
1069
1039
|
${whiteSpaceNoWrap};
|
|
1070
1040
|
${parseHeight(18)};
|
|
1071
1041
|
${parseMinWidth(65)};
|
|
1072
|
-
|
|
1073
|
-
|
|
1042
|
+
${bgColor('rgba(21, 26, 48, 0.9)')};
|
|
1043
|
+
${pd([0.75, 1.5])};
|
|
1074
1044
|
transition: left 0.05s ease-in, top 0.05s ease-in;
|
|
1075
1045
|
vertical-align: middle;
|
|
1076
1046
|
visibility: hidden;
|
|
@@ -1080,7 +1050,8 @@ const pickerCSS = {
|
|
|
1080
1050
|
@media only screen and (max-width: 599px) {
|
|
1081
1051
|
${parseMaxWidth(400)};
|
|
1082
1052
|
.${unique.wrapper} {
|
|
1083
|
-
|
|
1053
|
+
${displayFlex};
|
|
1054
|
+
${flexCol};
|
|
1084
1055
|
${parseMinWidth(260)};
|
|
1085
1056
|
}
|
|
1086
1057
|
.${unique.divider} {
|
|
@@ -1096,8 +1067,8 @@ const pickerCSS = {
|
|
|
1096
1067
|
${parseWidthHeight(width, 'max-content')};
|
|
1097
1068
|
${parseMinWidth(window.innerWidth <= 633 ? 300 : 633)};
|
|
1098
1069
|
${parseMaxWidth(805)};
|
|
1099
|
-
|
|
1100
|
-
|
|
1070
|
+
${top(position.top)};
|
|
1071
|
+
${left(position.left)};
|
|
1101
1072
|
opacity: 0;
|
|
1102
1073
|
transform: scale(0);
|
|
1103
1074
|
transform-origin: ${position.transformOrigin};
|
|
@@ -1138,8 +1109,6 @@ DateRangePicker.propTypes = {
|
|
|
1138
1109
|
clearAble: PropTypes.bool,
|
|
1139
1110
|
/** If `true`, the calendar will have a footer controls. */
|
|
1140
1111
|
controls: PropTypes.bool,
|
|
1141
|
-
/** The count unit when select. */
|
|
1142
|
-
unitCount: PropTypes.oneOf(['day', 'night']),
|
|
1143
1112
|
/** Default value of the component. */
|
|
1144
1113
|
defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string)]),
|
|
1145
1114
|
/** If `true`, the component is disabled. */
|
|
@@ -1158,10 +1127,10 @@ DateRangePicker.propTypes = {
|
|
|
1158
1127
|
label: PropTypes.string,
|
|
1159
1128
|
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) of label. */
|
|
1160
1129
|
labelProps: PropTypes.object,
|
|
1161
|
-
/** Min value of date picker. */
|
|
1162
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1163
1130
|
/** Max value of date picker. */
|
|
1164
1131
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1132
|
+
/** Min value of date picker. */
|
|
1133
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
1165
1134
|
/** Callback fired when the value is changed. */
|
|
1166
1135
|
onChange: PropTypes.func,
|
|
1167
1136
|
/** The short hint displayed in the input before the user enters a value. */
|
|
@@ -1182,6 +1151,8 @@ DateRangePicker.propTypes = {
|
|
|
1182
1151
|
style: PropTypes.object,
|
|
1183
1152
|
/** Text align of the input. */
|
|
1184
1153
|
textAlign: PropTypes.oneOf(['center', 'end', 'start']),
|
|
1154
|
+
/** The count unit when select. */
|
|
1155
|
+
unitCount: PropTypes.oneOf(['day', 'night']),
|
|
1185
1156
|
/** The value of the input element, required for a controlled component. String must be [Date string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date): YYYY/MM/DD, MM/DD/YYYY,...*/
|
|
1186
1157
|
value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
|
|
1187
1158
|
/** The variant to use. */
|
|
@@ -16,9 +16,6 @@ const {
|
|
|
16
16
|
},
|
|
17
17
|
fill: {
|
|
18
18
|
'scrollbar-tabbar': fillScrollbar
|
|
19
|
-
},
|
|
20
|
-
text: {
|
|
21
|
-
sub: textSub
|
|
22
19
|
}
|
|
23
20
|
},
|
|
24
21
|
typography: {
|
|
@@ -44,6 +41,7 @@ const convertData = (dt, valueExpr) => {
|
|
|
44
41
|
return valueTemp;
|
|
45
42
|
};
|
|
46
43
|
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
44
|
+
action = {},
|
|
47
45
|
allowSearch,
|
|
48
46
|
children,
|
|
49
47
|
className,
|
|
@@ -106,7 +104,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
106
104
|
const lastSearchRef = useRef(null);
|
|
107
105
|
const timeout = useRef(null);
|
|
108
106
|
const loadMoreTimer = useRef(null);
|
|
109
|
-
const
|
|
107
|
+
const dataChosen = useRef([]);
|
|
110
108
|
const [unique] = useState(randomString(6, {
|
|
111
109
|
allowNumber: false,
|
|
112
110
|
allowSymbol: false
|
|
@@ -123,7 +121,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
123
121
|
const [valueMulti, setValueMulti] = useState(valueTemp);
|
|
124
122
|
const _isMobile = isMobile.any();
|
|
125
123
|
const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
|
|
126
|
-
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, disabled, readOnly);
|
|
124
|
+
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, disabled, readOnly, multilineSelectedItem);
|
|
127
125
|
const _IconCSS = IconCSS(viewType);
|
|
128
126
|
const _DropdownFormCSS = DropdownFormCSS(viewType, multiple, disabled, placeholder, _DropdownInputCSS.name);
|
|
129
127
|
const _DropdownListCSS = DropdownListCSS(loading);
|
|
@@ -373,7 +371,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
373
371
|
}, displayText), jsx(Typography, {
|
|
374
372
|
className: 'DGN-UI-Dropdown-SubText',
|
|
375
373
|
type: 'p3',
|
|
376
|
-
color:
|
|
374
|
+
color: 'text.sub'
|
|
377
375
|
}, typeof subText === 'function' ? subText({
|
|
378
376
|
data,
|
|
379
377
|
index
|
|
@@ -399,7 +397,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
399
397
|
// onChangeValue(displayText, value, icon, data, index);
|
|
400
398
|
// }}
|
|
401
399
|
,
|
|
402
|
-
|
|
400
|
+
onKeyDown: e => {
|
|
403
401
|
if (itemDisabled) return;
|
|
404
402
|
if (e.key === 'Enter') e.currentTarget.firstChild.click();
|
|
405
403
|
// if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
@@ -423,7 +421,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
423
421
|
if (itemDisabled) return;
|
|
424
422
|
onChangeValue(displayText, value, icon, data, index);
|
|
425
423
|
},
|
|
426
|
-
|
|
424
|
+
onKeyDown: e => {
|
|
427
425
|
if (itemDisabled) return;
|
|
428
426
|
if (e.key === 'Enter') onChangeValue(displayText, value, icon, data, index);
|
|
429
427
|
},
|
|
@@ -511,7 +509,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
511
509
|
}, displayText), jsx(Typography, {
|
|
512
510
|
className: 'DGN-UI-Dropdown-SubText',
|
|
513
511
|
type: 'p3',
|
|
514
|
-
color:
|
|
512
|
+
color: 'text.sub'
|
|
515
513
|
}, typeof subText === 'function' ? subText({
|
|
516
514
|
data,
|
|
517
515
|
index: i
|
|
@@ -629,7 +627,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
629
627
|
const onChangeInput = e => {
|
|
630
628
|
if (searchRef.current) lastSearchRef.current = searchRef.current.value;
|
|
631
629
|
const dataFilter = getData();
|
|
632
|
-
|
|
630
|
+
dataChosen.current = [...dataFilter].filter(i => [...valueMulti].includes(i === null || i === void 0 ? void 0 : i[valueExpr]));
|
|
633
631
|
if (onInput) {
|
|
634
632
|
isSearch[unique] = true;
|
|
635
633
|
// const valueInput = e.target.value;
|
|
@@ -908,23 +906,25 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
908
906
|
};
|
|
909
907
|
const setSingleValueHandler = (data, keyArr) => {
|
|
910
908
|
const text = keyArr ? renderData(data, keyArr) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr] || data[valueExpr] || data;
|
|
909
|
+
const renderContent = content => jsx(Typography, {
|
|
910
|
+
type: 'p1',
|
|
911
|
+
lineClamp: multilineSelectedItem ? undefined : 1,
|
|
912
|
+
hoverTooltip: !_isMobile
|
|
913
|
+
}, content);
|
|
911
914
|
if (typeof renderSelectedItem === 'function') {
|
|
912
915
|
inputRef.current.innerHTML = '';
|
|
913
|
-
const item = renderSelectedItem({
|
|
916
|
+
const item = renderContent(renderSelectedItem({
|
|
914
917
|
data
|
|
915
|
-
});
|
|
918
|
+
}));
|
|
916
919
|
const el = document.createElement('div');
|
|
917
920
|
el.style.display = 'flex';
|
|
918
921
|
el.style.minHeight = '24px';
|
|
922
|
+
if (!multilineSelectedItem) el.style.maxHeight = '24px';
|
|
919
923
|
ReactDOM.render(item, inputRef.current.appendChild(el));
|
|
920
924
|
} else if (iconExpr && iconExpr !== 'none') {
|
|
921
925
|
inputRef.current.innerHTML = '';
|
|
922
926
|
const icon = getIconFromData(data);
|
|
923
|
-
const valueWithIcon = jsx(Fragment, null, icon && icon,
|
|
924
|
-
type: 'p1',
|
|
925
|
-
lineClamp: multilineSelectedItem ? undefined : 1,
|
|
926
|
-
hoverTooltip: !_isMobile
|
|
927
|
-
}, text));
|
|
927
|
+
const valueWithIcon = jsx(Fragment, null, icon && icon, renderContent(text));
|
|
928
928
|
const el = document.createElement('div');
|
|
929
929
|
el.style.cssText = 'display: flex; align-items: center; min-height:24px;';
|
|
930
930
|
ReactDOM.render(valueWithIcon, inputRef.current.appendChild(el));
|
|
@@ -936,6 +936,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
936
936
|
useImperativeHandle(reference, () => {
|
|
937
937
|
const currentRef = ref.current || {};
|
|
938
938
|
const _instance = {
|
|
939
|
+
...action,
|
|
939
940
|
closeDropdown: () => {
|
|
940
941
|
closeDropdown();
|
|
941
942
|
},
|
|
@@ -1103,9 +1104,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1103
1104
|
const getData = () => {
|
|
1104
1105
|
let dataFilter = JSON.parse(JSON.stringify(dataSource));
|
|
1105
1106
|
if (Array.isArray(valueObjectDefault)) {
|
|
1106
|
-
dataFilter = [...dataFilter, ...
|
|
1107
|
+
dataFilter = [...dataFilter, ...dataChosen.current, ...valueObjectDefault];
|
|
1107
1108
|
} else if (typeof valueObjectDefault === 'object') {
|
|
1108
|
-
dataFilter = [...dataFilter, ...
|
|
1109
|
+
dataFilter = [...dataFilter, ...dataChosen.current, {
|
|
1109
1110
|
...valueObjectDefault
|
|
1110
1111
|
}];
|
|
1111
1112
|
}
|
|
@@ -1237,7 +1238,7 @@ const InputCSS = (multiple, renderSelectedItem) => css`
|
|
|
1237
1238
|
${positionRelative};
|
|
1238
1239
|
${parseWidth(!multiple && renderSelectedItem ? 'calc(100% - 34px)' : '100%')};
|
|
1239
1240
|
`;
|
|
1240
|
-
const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) => css`
|
|
1241
|
+
const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly, multilineSelectedItem) => css`
|
|
1241
1242
|
${displayFlex};
|
|
1242
1243
|
${itemsCenter};
|
|
1243
1244
|
${outlineNone};
|
|
@@ -1256,9 +1257,10 @@ const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly) =
|
|
|
1256
1257
|
${flexWrap};
|
|
1257
1258
|
${overflowHidden};
|
|
1258
1259
|
${breakWord};
|
|
1259
|
-
${!multiple && `
|
|
1260
|
-
${parseMinHeight(24)};
|
|
1260
|
+
${!multiple && css`
|
|
1261
|
+
${parseMinHeight(24)};
|
|
1261
1262
|
${parseMaxWidth('100%')};
|
|
1263
|
+
${!multilineSelectedItem && parseMaxHeight(24)};
|
|
1262
1264
|
`};
|
|
1263
1265
|
&::after {
|
|
1264
1266
|
${displayFlex};
|
package/components/modal/body.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
+
import { boxBorder, displayBlock, displayNone, order, overflowAuto, parseWidthHeight, positionRelative } from "../../styles/general";
|
|
7
7
|
import { classNames } from "../../utils";
|
|
8
|
-
import theme from "../../theme/settings";
|
|
9
8
|
import { responsivePaddingCSS } from "./header";
|
|
10
|
-
const {
|
|
11
|
-
colors: {
|
|
12
|
-
fill: {
|
|
13
|
-
'scrollbar-rest': scrollbarRest,
|
|
14
|
-
'scrollbar-active': scrollbarActive
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
} = theme;
|
|
18
9
|
const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
10
|
action = {},
|
|
20
11
|
children,
|
|
@@ -22,6 +13,7 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
22
13
|
id,
|
|
23
14
|
style
|
|
24
15
|
}, reference) => {
|
|
16
|
+
if (!reference) reference = useRef(null);
|
|
25
17
|
const ref = useRef(null);
|
|
26
18
|
useImperativeHandle(reference, () => {
|
|
27
19
|
const currentRef = ref.current || {};
|
|
@@ -33,13 +25,15 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
25
|
currentRef.instance = _instance;
|
|
34
26
|
return currentRef;
|
|
35
27
|
});
|
|
36
|
-
return useMemo(() =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
return useMemo(() => {
|
|
29
|
+
return jsx("div", {
|
|
30
|
+
css: ModalBodyCSS,
|
|
31
|
+
ref: ref,
|
|
32
|
+
id: id,
|
|
33
|
+
className: classNames('DGN-UI-Modal-Body', className),
|
|
34
|
+
style: style
|
|
35
|
+
}, children);
|
|
36
|
+
}, [children, className, id, style]);
|
|
43
37
|
}));
|
|
44
38
|
const ModalBodyCSS = css`
|
|
45
39
|
${displayBlock};
|
|
@@ -47,19 +41,9 @@ const ModalBodyCSS = css`
|
|
|
47
41
|
${boxBorder};
|
|
48
42
|
${overflowAuto};
|
|
49
43
|
${parseWidthHeight('100%', 'auto')};
|
|
50
|
-
order
|
|
44
|
+
${order(2)};
|
|
51
45
|
&::-webkit-scrollbar {
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
&::-webkit-scrollbar-thumb {
|
|
55
|
-
${border(8, 'transparent')};
|
|
56
|
-
border-radius: 10px;
|
|
57
|
-
mix-blend-mode: normal;
|
|
58
|
-
background-color: ${scrollbarRest};
|
|
59
|
-
background-clip: content-box;
|
|
60
|
-
:hover {
|
|
61
|
-
background-color: ${scrollbarActive};
|
|
62
|
-
}
|
|
46
|
+
${displayNone};
|
|
63
47
|
}
|
|
64
48
|
${responsivePaddingCSS};
|
|
65
49
|
`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
+
import { boxBorder, flexRow, itemsCenter, justifyEnd, order, parseWidth, positionRelative } from "../../styles/general";
|
|
7
7
|
import { classNames } from "../../utils";
|
|
8
8
|
import { responsivePaddingCSS } from "./header";
|
|
9
9
|
const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -14,6 +14,7 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
14
14
|
id,
|
|
15
15
|
style
|
|
16
16
|
}, reference) => {
|
|
17
|
+
if (!reference) reference = useRef(null);
|
|
17
18
|
const ref = useRef(null);
|
|
18
19
|
const _ModalFooterCSS = ModalFooterCSS(boxShadow);
|
|
19
20
|
useImperativeHandle(reference, () => {
|
|
@@ -26,13 +27,15 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
26
27
|
currentRef.instance = _instance;
|
|
27
28
|
return currentRef;
|
|
28
29
|
});
|
|
29
|
-
return useMemo(() =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
return useMemo(() => {
|
|
31
|
+
return jsx("div", {
|
|
32
|
+
css: _ModalFooterCSS,
|
|
33
|
+
ref: ref,
|
|
34
|
+
id: id,
|
|
35
|
+
className: classNames('DGN-UI-Modal-Footer', className),
|
|
36
|
+
style: style
|
|
37
|
+
}, children);
|
|
38
|
+
}, [boxShadow, children, className, id, style]);
|
|
36
39
|
}));
|
|
37
40
|
const ModalFooterCSS = boxShadow => css`
|
|
38
41
|
${flexRow};
|
|
@@ -40,11 +43,10 @@ const ModalFooterCSS = boxShadow => css`
|
|
|
40
43
|
${itemsCenter};
|
|
41
44
|
${justifyEnd};
|
|
42
45
|
${boxBorder};
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
${parseWidth('100%')};
|
|
47
|
+
${order(3)};
|
|
45
48
|
border-radius: 0px 0px 4px 4px;
|
|
46
49
|
box-shadow: ${boxShadow};
|
|
47
|
-
order: 3;
|
|
48
50
|
${responsivePaddingCSS};
|
|
49
51
|
`;
|
|
50
52
|
ModalFooter.defaultProps = {
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon, Typography } from "./..";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { itemsCenter, boxBorder, flexRow, justifyBetween, parseWidthHeight, positionRelative } from "../../styles/general";
|
|
6
|
+
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
|
+
import { bgColor, boxBorder, cursorMove, flexRow, itemsCenter, justifyBetween, order, parseWidthHeight, positionRelative } from "../../styles/general";
|
|
8
|
+
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, handleBreakpoints } from "../../utils";
|
|
10
|
-
import
|
|
10
|
+
import ModalContext from "./context";
|
|
11
11
|
const {
|
|
12
|
-
colors: {
|
|
13
|
-
fill: {
|
|
14
|
-
headerbar
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
12
|
boxShadows: {
|
|
18
13
|
small: smallBoxShadow
|
|
19
14
|
},
|
|
20
15
|
spacing
|
|
21
|
-
} =
|
|
16
|
+
} = useTheme();
|
|
22
17
|
export const responsivePaddingCSS = handleBreakpoints({
|
|
23
18
|
xs: 4,
|
|
24
19
|
md: 6
|
|
@@ -34,6 +29,7 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
34
29
|
style,
|
|
35
30
|
title
|
|
36
31
|
}, reference) => {
|
|
32
|
+
if (!reference) reference = useRef(null);
|
|
37
33
|
const modal = useContext(ModalContext);
|
|
38
34
|
const ref = useRef(null);
|
|
39
35
|
const _ModalHeaderCSS = ModalHeaderCSS(modal);
|
|
@@ -47,29 +43,31 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
47
43
|
currentRef.instance = _instance;
|
|
48
44
|
return currentRef;
|
|
49
45
|
});
|
|
50
|
-
return useMemo(() =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
return useMemo(() => {
|
|
47
|
+
return jsx("div", {
|
|
48
|
+
css: _ModalHeaderCSS,
|
|
49
|
+
ref: ref,
|
|
50
|
+
id: id,
|
|
51
|
+
className: classNames('DGN-UI-Modal-Header', className),
|
|
52
|
+
style: style,
|
|
53
|
+
onMouseDown: modal.onMoveModal
|
|
54
|
+
}, jsx(Typography, {
|
|
55
|
+
type: 'h3',
|
|
56
|
+
style: {
|
|
57
|
+
whiteSpace: 'nowrap',
|
|
58
|
+
overflow: 'hidden',
|
|
59
|
+
textOverflow: 'ellipsis',
|
|
60
|
+
width: '100%'
|
|
61
|
+
}
|
|
62
|
+
}, children ? children : title), showClose ? jsx(ButtonIcon, {
|
|
63
|
+
viewType: 'ghost',
|
|
64
|
+
name: 'Close',
|
|
65
|
+
style: {
|
|
66
|
+
marginLeft: spacing(4)
|
|
67
|
+
},
|
|
68
|
+
onClick: modal.close
|
|
69
|
+
}) : null);
|
|
70
|
+
}, [children, className, id, showClose, style, title]);
|
|
73
71
|
}));
|
|
74
72
|
const ModalHeaderCSS = modal => css`
|
|
75
73
|
${flexRow};
|
|
@@ -78,11 +76,11 @@ const ModalHeaderCSS = modal => css`
|
|
|
78
76
|
${itemsCenter};
|
|
79
77
|
${boxBorder};
|
|
80
78
|
${parseWidthHeight('100%', 56)};
|
|
81
|
-
|
|
79
|
+
${bgColor('fill.headerbar')}
|
|
80
|
+
${modal.onMoveModal && cursorMove};
|
|
81
|
+
${order(1)};
|
|
82
82
|
border-radius: 4px 4px 0px 0px;
|
|
83
83
|
box-shadow: ${smallBoxShadow};
|
|
84
|
-
cursor: ${modal.onMoveModal ? 'move' : 'inherit'};
|
|
85
|
-
order: 1;
|
|
86
84
|
${responsivePaddingCSS};
|
|
87
85
|
`;
|
|
88
86
|
ModalHeader.defaultProps = {
|
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import ModalContext from "./context";
|
|
5
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { createPortal } from 'react-dom';
|
|
9
7
|
import { animations } from "../../styles/animation";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import { classNames } from "../../utils";
|
|
8
|
+
import { bgColor, borderRadius4px, boxBorder, cursorMove, flexCol, flexRow, justifyCenter, left, parseMaxWidthHeight, parseMinWidth, parseWidthHeight, pdt, positionAbsolute, positionRelative, top } from "../../styles/general";
|
|
9
|
+
import { useTheme } from "../../theme";
|
|
10
|
+
import { classNames, useDelayUnmount } from "../../utils";
|
|
11
|
+
import ModalContext from "./context";
|
|
13
12
|
const {
|
|
14
|
-
colors: {
|
|
15
|
-
system: {
|
|
16
|
-
white
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
13
|
typography: {
|
|
20
14
|
paragraph1
|
|
21
15
|
},
|
|
22
|
-
spacing,
|
|
23
16
|
zIndex: zIndexCORE
|
|
24
|
-
} =
|
|
17
|
+
} = useTheme();
|
|
25
18
|
const fadeInDown = animations.fadeInDown;
|
|
26
19
|
const fadeOutUp = animations.fadeOutUp;
|
|
27
20
|
const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -42,6 +35,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
42
35
|
width,
|
|
43
36
|
zIndex
|
|
44
37
|
}, reference) => {
|
|
38
|
+
if (!reference) reference = useRef(null);
|
|
45
39
|
const ref = useRef(null);
|
|
46
40
|
const overflow = useRef(null);
|
|
47
41
|
const modalBoxRef = useRef(null);
|
|
@@ -190,19 +184,19 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
190
184
|
return /*#__PURE__*/createPortal(node, document.body);
|
|
191
185
|
}
|
|
192
186
|
return null;
|
|
193
|
-
}, [children, className, dragAnyWhere, id, moveable, moveOutScreen, onClose, style, openState, showModal]);
|
|
187
|
+
}, [alignment, autoFocus, children, className, darkTheme, dragAnyWhere, id, moveable, moveOutScreen, onClose, open, pressESCToClose, style, width, zIndex, openState, showModal]);
|
|
194
188
|
}));
|
|
195
189
|
const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
|
|
196
190
|
${flexRow};
|
|
197
|
-
${
|
|
191
|
+
${positionAbsolute}
|
|
198
192
|
${justifyCenter};
|
|
199
|
-
${parseWidthHeight('100%'
|
|
193
|
+
${parseWidthHeight('100%')};
|
|
194
|
+
${pdt(alignment === 'top' ? [3] : 0)};
|
|
195
|
+
${bgColor(darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent')};
|
|
196
|
+
${top(0)};
|
|
197
|
+
${left(0)};
|
|
200
198
|
z-index: ${zIndex};
|
|
201
199
|
align-items: ${alignment === 'top' ? 'inherit' : 'center'};
|
|
202
|
-
padding-top: ${alignment === 'top' ? spacing([3]) : 0};
|
|
203
|
-
background-color: ${darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent'};
|
|
204
|
-
top: 0;
|
|
205
|
-
left: 0;
|
|
206
200
|
`;
|
|
207
201
|
const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
|
|
208
202
|
${paragraph1};
|
|
@@ -210,13 +204,11 @@ const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
|
|
|
210
204
|
${positionRelative};
|
|
211
205
|
${borderRadius4px}
|
|
212
206
|
${boxBorder};
|
|
213
|
-
${
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
min-width: 150px;
|
|
219
|
-
max-width: 90%;
|
|
207
|
+
${parseWidthHeight(width, 'max-content')};
|
|
208
|
+
${parseMaxWidthHeight('90%', 'calc(100% - 12px)')};
|
|
209
|
+
${parseMinWidth(150)};
|
|
210
|
+
${moveable && dragAnyWhere && cursorMove};
|
|
211
|
+
${bgColor('system.white')};
|
|
220
212
|
margin: 0 auto;
|
|
221
213
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
222
214
|
-webkit-box-orient: vertical;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,12 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.93
|
|
42
|
+
- \[Changed\]: Dropdown – Apply multilineSelectedItem to renderSelectedItem
|
|
43
|
+
- \[Fixed\]: Checkbox – Fix bug still uncheck when not set state
|
|
44
|
+
- \[Fixed\]: Modal – Fix footer height
|
|
45
|
+
- \[Fixed\]: DateRangePicker – Fix UI hover, focus empty days between selected range
|
|
46
|
+
|
|
41
47
|
## 1.3.92
|
|
42
48
|
- \[Fixed\]: Dropdown – Fix override css selected item Typography
|
|
43
49
|
- \[Fixed\]: Attachment – Fix crash when remove attached item
|