diginet-core-ui 1.3.90 → 1.3.91
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/avatar/index.js +56 -135
- package/components/button/icon.js +21 -21
- package/components/form-control/calendar/function.js +87 -141
- package/components/form-control/date-picker/index.js +28 -62
- package/components/form-control/date-range-picker/index.js +1 -1
- package/components/form-control/number-input/index2.js +18 -18
- package/components/form-control/radio/index.js +5 -5
- package/components/form-control/toggle/index.js +4 -4
- package/components/grid/index.js +3 -1
- package/components/image/index.js +13 -15
- package/components/index.js +1 -1
- package/components/others/option-wrapper/index.js +3 -1
- package/components/popup/v2/index.js +43 -38
- package/components/rating/index.js +8 -8
- package/components/tab/tab-container.js +2 -2
- package/components/tab/tab-header.js +2 -2
- package/components/tab/tab-panel.js +2 -2
- package/components/tab/tab.js +2 -2
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +103 -107
- package/components/typography/index.js +4 -6
- package/global/index.js +2 -2
- package/package.json +1 -1
- package/readme.md +10 -0
- package/styles/general.js +5 -2
- package/styles/sx/index.js +23 -0
- package/styles/utils.js +15 -15
- package/utils/index.js +1 -0
- package/utils/intersectionObserver.js +3 -2
- package/components/popup/proposals_popup.js +0 -321
- package/components/tree-view/css.js +0 -107
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
5
|
-
import { render } from 'react-dom';
|
|
6
4
|
import { Button, ButtonIcon, Typography } from "../..";
|
|
7
5
|
import { getGlobal } from "../../../global";
|
|
8
6
|
import locale from "../../../locale";
|
|
9
|
-
import
|
|
7
|
+
import { render } from 'react-dom';
|
|
8
|
+
import { bgColor, border, borderRadius, boxBorder, cursorDefault, cursorPointer, displayFlex, flexCol, flexRow, inset, itemsCenter, justifyBetween, mg, parseHeight, parseMaxWidth, parseMinWidth, parseWidth, pointerEventsNone, positionAbsolute, positionRelative, textCenter, textColor, userSelectNone } from "../../../styles/general";
|
|
9
|
+
import { useTheme } from "../../../theme";
|
|
10
10
|
import { date as moment } from "../../../utils";
|
|
11
|
-
import { useColor as colors } from "../../../theme";
|
|
12
|
-
import { typography } from "../../../styles/typography";
|
|
13
|
-
import { itemsCenter, border, boxBorder, borderRadius4px, cursorPointer, flexCol, flexRow, displayInlineFlex, justifyBetween, pointerEventsNone, positionAbsolute, positionRelative, textCenter, userSelectNone } from "../../../styles/general";
|
|
14
11
|
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
active,
|
|
20
|
-
white
|
|
21
|
-
},
|
|
22
|
-
fill: {
|
|
23
|
-
hover: fillHover,
|
|
24
|
-
focus: fillFocus,
|
|
25
|
-
pressed: fillPressed
|
|
26
|
-
},
|
|
27
|
-
text: {
|
|
28
|
-
main,
|
|
29
|
-
normal_label
|
|
30
|
-
},
|
|
31
|
-
danger8,
|
|
32
|
-
info8
|
|
33
|
-
} = colors;
|
|
12
|
+
boxShadows: {
|
|
13
|
+
large: boxShadowsLarge
|
|
14
|
+
}
|
|
15
|
+
} = useTheme();
|
|
34
16
|
|
|
35
17
|
/**
|
|
36
18
|
* START STYLE
|
|
@@ -43,81 +25,52 @@ const {
|
|
|
43
25
|
* @returns
|
|
44
26
|
*/
|
|
45
27
|
const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) => css`
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
28
|
+
${displayFlex};
|
|
29
|
+
${flexCol};
|
|
30
|
+
${boxBorder};
|
|
31
|
+
${borderRadius('0px 0px 4px 4px')};
|
|
32
|
+
${bgColor('system.white')};
|
|
33
|
+
${parseWidth('100%')};
|
|
34
|
+
${parseMinWidth(260)};
|
|
35
|
+
${parseMaxWidth(400)};
|
|
36
|
+
box-shadow: ${boxShadow ? boxShadowsLarge : 'none'};
|
|
54
37
|
.${unique.navigator.navigator} {
|
|
55
|
-
${
|
|
56
|
-
${
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
width: calc(100% - 28px);
|
|
38
|
+
${displayFlex};
|
|
39
|
+
${flexRow};
|
|
40
|
+
${justifyBetween};
|
|
41
|
+
${itemsCenter};
|
|
42
|
+
${parseMaxWidth(400)};
|
|
43
|
+
${mg([4, 4, 0])};
|
|
62
44
|
.${unique.navigator.around} {
|
|
63
|
-
${
|
|
64
|
-
${
|
|
65
|
-
height : 28px;
|
|
66
|
-
width: 64px;
|
|
45
|
+
${displayFlex};
|
|
46
|
+
${flexRow};
|
|
67
47
|
}
|
|
68
48
|
.${unique.navigator.center} {
|
|
69
|
-
${
|
|
70
|
-
${itemsCenter}
|
|
71
|
-
${textCenter}
|
|
72
|
-
${userSelectNone}
|
|
73
|
-
height : 28px;
|
|
74
|
-
margin: 0 4px;
|
|
75
|
-
min-width: 150px;
|
|
76
|
-
width: 100%;
|
|
77
|
-
button {
|
|
78
|
-
height: 28px;
|
|
79
|
-
}
|
|
80
|
-
.DGN-UI-Typography {
|
|
81
|
-
min-width: 150px;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
.${unique.icon} {
|
|
86
|
-
height: 28px;
|
|
87
|
-
margin: 0 2px;
|
|
88
|
-
width: 28px;
|
|
89
|
-
svg,
|
|
90
|
-
path,
|
|
91
|
-
g {
|
|
92
|
-
${pointerEventsNone}
|
|
49
|
+
${parseWidth('100%')};
|
|
93
50
|
}
|
|
94
51
|
}
|
|
95
52
|
.${unique.table.container} {
|
|
96
|
-
${
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
width: 100%;
|
|
53
|
+
${displayFlex};
|
|
54
|
+
${flexRow};
|
|
55
|
+
${mg([2, 0])};
|
|
100
56
|
}
|
|
101
57
|
.${unique.table.table} {
|
|
58
|
+
${mg([0, 4])};
|
|
59
|
+
${parseWidth('calc(100% - 32px)')};
|
|
102
60
|
border-collapse: separate;
|
|
103
|
-
margin: 0 16px;
|
|
104
61
|
padding: 0;
|
|
105
62
|
table-layout: fixed;
|
|
106
|
-
width: calc(100% - 32px);
|
|
107
63
|
.${unique.table.data} {
|
|
108
|
-
${cursorPointer}
|
|
109
|
-
${positionRelative}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
height: 24px;
|
|
114
|
-
min-width: 24px;
|
|
115
|
-
padding: 1px;
|
|
64
|
+
${cursorPointer};
|
|
65
|
+
${positionRelative};
|
|
66
|
+
${textCenter};
|
|
67
|
+
${userSelectNone};
|
|
68
|
+
${textColor('text.main')};
|
|
116
69
|
&:nth-of-type(7n - 1) {
|
|
117
|
-
|
|
70
|
+
${textColor('info8')};
|
|
118
71
|
}
|
|
119
72
|
&:nth-of-type(7n) {
|
|
120
|
-
|
|
73
|
+
${textColor('danger8')};
|
|
121
74
|
}
|
|
122
75
|
&.next_month,
|
|
123
76
|
&.previous_month,
|
|
@@ -125,45 +78,42 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
|
|
|
125
78
|
opacity: 0.25;
|
|
126
79
|
}
|
|
127
80
|
&.${unique.day.limit} {
|
|
128
|
-
${pointerEventsNone}
|
|
129
|
-
|
|
81
|
+
${pointerEventsNone};
|
|
82
|
+
${cursorDefault};
|
|
130
83
|
}
|
|
131
84
|
&:hover {
|
|
132
85
|
span.${unique.day.day} {
|
|
133
|
-
|
|
86
|
+
${bgColor('fill.hover')};
|
|
134
87
|
}
|
|
135
88
|
}
|
|
136
|
-
${onClickActive
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
89
|
+
${onClickActive && css`
|
|
90
|
+
&:active {
|
|
91
|
+
span.${unique.day.day} {
|
|
92
|
+
${bgColor('fill.pressed')};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
141
96
|
&.${unique.day.active} {
|
|
142
97
|
span.${unique.day.day} {
|
|
143
|
-
${
|
|
144
|
-
background-color: ${fillFocus};
|
|
98
|
+
${bgColor('fill.focus')};
|
|
145
99
|
}
|
|
146
100
|
}
|
|
147
101
|
&.${unique.day.today} {
|
|
148
102
|
span {
|
|
149
|
-
${
|
|
150
|
-
${
|
|
151
|
-
${border(1, active)}
|
|
152
|
-
/* text-decoration-line : underline;
|
|
153
|
-
text-decoration-thickness: 2px;
|
|
154
|
-
text-underline-offset : 1px */
|
|
103
|
+
${boxBorder};
|
|
104
|
+
${border(1, 'system.active')};
|
|
155
105
|
}
|
|
156
106
|
}
|
|
157
107
|
&.${unique.day.between} {
|
|
158
108
|
opacity: 1;
|
|
159
109
|
&::before {
|
|
160
|
-
|
|
110
|
+
${bgColor('fill.hover')};
|
|
161
111
|
}
|
|
162
112
|
}
|
|
163
113
|
&.${unique.day.from} {
|
|
164
114
|
opacity: 1;
|
|
165
115
|
&::before {
|
|
166
|
-
|
|
116
|
+
${bgColor('fill.hover')};
|
|
167
117
|
border-bottom-left-radius: 12px;
|
|
168
118
|
border-top-left-radius: 12px;
|
|
169
119
|
left: calc((100% - 24px) / 2);
|
|
@@ -172,31 +122,28 @@ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) =>
|
|
|
172
122
|
&.${unique.day.to} {
|
|
173
123
|
opacity: 1;
|
|
174
124
|
&::before {
|
|
175
|
-
|
|
125
|
+
${bgColor('fill.hover')};
|
|
176
126
|
border-bottom-right-radius: 12px;
|
|
177
127
|
border-top-right-radius: 12px;
|
|
178
128
|
right: calc((100% - 24px) / 2);
|
|
179
129
|
}
|
|
180
130
|
}
|
|
181
131
|
::before {
|
|
182
|
-
${positionAbsolute}
|
|
183
|
-
inset
|
|
132
|
+
${positionAbsolute};
|
|
133
|
+
${inset('1px -2px')};
|
|
184
134
|
content: '';
|
|
185
135
|
}
|
|
186
136
|
}
|
|
187
137
|
.${unique.table.header} {
|
|
188
|
-
${userSelectNone}
|
|
189
|
-
${textCenter}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
min-width: 24px;
|
|
193
|
-
padding: 0;
|
|
194
|
-
padding-bottom: 6px;
|
|
138
|
+
${userSelectNone};
|
|
139
|
+
${textCenter};
|
|
140
|
+
${parseHeight(24)};
|
|
141
|
+
${textColor('text.normal_label')};
|
|
195
142
|
&:nth-of-type(6) {
|
|
196
|
-
|
|
143
|
+
${textColor('info8')};
|
|
197
144
|
}
|
|
198
145
|
&:nth-of-type(7) {
|
|
199
|
-
|
|
146
|
+
${textColor('danger8')};
|
|
200
147
|
}
|
|
201
148
|
}
|
|
202
149
|
}
|
|
@@ -280,10 +227,8 @@ const buttonIconProps = className => {
|
|
|
280
227
|
return {
|
|
281
228
|
className,
|
|
282
229
|
circular: true,
|
|
283
|
-
height: 28,
|
|
284
|
-
viewBox: true,
|
|
285
230
|
viewType: 'text',
|
|
286
|
-
|
|
231
|
+
size: 'small'
|
|
287
232
|
};
|
|
288
233
|
};
|
|
289
234
|
/**
|
|
@@ -296,10 +241,9 @@ const buttonTextProps = fn => {
|
|
|
296
241
|
return {
|
|
297
242
|
onClick: fn,
|
|
298
243
|
color: 'primary',
|
|
244
|
+
size: 'small',
|
|
299
245
|
style: {
|
|
300
246
|
borderRadius: 20,
|
|
301
|
-
margin: 0,
|
|
302
|
-
padding: '2px 4px',
|
|
303
247
|
textTransform: 'initial',
|
|
304
248
|
width: '100%'
|
|
305
249
|
}
|
|
@@ -380,10 +324,10 @@ const isBetween = (day, from, to, className) => {
|
|
|
380
324
|
return '';
|
|
381
325
|
};
|
|
382
326
|
const isBeforeLimit = (min, time) => {
|
|
383
|
-
return min && isValidDate(min) && moment(time).diff(new Date(min).setHours(0, 0, 0, 0)) < 0;
|
|
327
|
+
return min && isValidDate(min) && moment(new Date(time).setHours(0, 0, 0, 0)).diff(new Date(min).setHours(0, 0, 0, 0)) < 0;
|
|
384
328
|
};
|
|
385
329
|
const isAfterLimit = (max, time) => {
|
|
386
|
-
return max && isValidDate(max) && moment(time).diff(new Date(max).setHours(0, 0, 0, 0)) > 0;
|
|
330
|
+
return max && isValidDate(max) && moment(new Date(time).setHours(0, 0, 0, 0)).diff(new Date(max).setHours(0, 0, 0, 0)) > 0;
|
|
387
331
|
};
|
|
388
332
|
/**
|
|
389
333
|
*
|
|
@@ -611,28 +555,30 @@ const onUpdateNavigator = (time, refs, min, max) => {
|
|
|
611
555
|
(_refs$doubleRight$cur = refs.doubleRight.current) === null || _refs$doubleRight$cur === void 0 ? void 0 : (_refs$doubleRight$cur2 = _refs$doubleRight$cur.instance) === null || _refs$doubleRight$cur2 === void 0 ? void 0 : _refs$doubleRight$cur2.option('disabled', false);
|
|
612
556
|
(_refs$left$current = refs.left.current) === null || _refs$left$current === void 0 ? void 0 : (_refs$left$current$in = _refs$left$current.instance) === null || _refs$left$current$in === void 0 ? void 0 : _refs$left$current$in.option('disabled', false);
|
|
613
557
|
(_refs$right$current = refs.right.current) === null || _refs$right$current === void 0 ? void 0 : (_refs$right$current$i = _refs$right$current.instance) === null || _refs$right$current$i === void 0 ? void 0 : _refs$right$current$i.option('disabled', false);
|
|
614
|
-
|
|
615
|
-
if (
|
|
616
|
-
|
|
617
|
-
|
|
558
|
+
setTimeout(() => {
|
|
559
|
+
if (min && isValidDate(min)) {
|
|
560
|
+
if (moment(time).diff(firstDayOfMin) < 365) {
|
|
561
|
+
var _refs$doubleLeft$curr3, _refs$doubleLeft$curr4;
|
|
562
|
+
(_refs$doubleLeft$curr3 = refs.doubleLeft.current) === null || _refs$doubleLeft$curr3 === void 0 ? void 0 : (_refs$doubleLeft$curr4 = _refs$doubleLeft$curr3.instance) === null || _refs$doubleLeft$curr4 === void 0 ? void 0 : _refs$doubleLeft$curr4.option('disabled', true);
|
|
563
|
+
}
|
|
564
|
+
if (moment(time).diff(firstDayOfMin) <= 28 && moment(time).diff(firstDayOfMin, 'months') > 1 || moment(time).diff(firstDayOfMin, 'months') < 1) {
|
|
565
|
+
var _refs$doubleLeft$curr5, _refs$doubleLeft$curr6, _refs$left$current2, _refs$left$current2$i;
|
|
566
|
+
(_refs$doubleLeft$curr5 = refs.doubleLeft.current) === null || _refs$doubleLeft$curr5 === void 0 ? void 0 : (_refs$doubleLeft$curr6 = _refs$doubleLeft$curr5.instance) === null || _refs$doubleLeft$curr6 === void 0 ? void 0 : _refs$doubleLeft$curr6.option('disabled', true);
|
|
567
|
+
(_refs$left$current2 = refs.left.current) === null || _refs$left$current2 === void 0 ? void 0 : (_refs$left$current2$i = _refs$left$current2.instance) === null || _refs$left$current2$i === void 0 ? void 0 : _refs$left$current2$i.option('disabled', true);
|
|
568
|
+
}
|
|
618
569
|
}
|
|
619
|
-
if (
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
570
|
+
if (max && isValidDate(max)) {
|
|
571
|
+
if (moment(time).diff(firstDayOfMax) > -334) {
|
|
572
|
+
var _refs$doubleRight$cur3, _refs$doubleRight$cur4;
|
|
573
|
+
(_refs$doubleRight$cur3 = refs.doubleRight.current) === null || _refs$doubleRight$cur3 === void 0 ? void 0 : (_refs$doubleRight$cur4 = _refs$doubleRight$cur3.instance) === null || _refs$doubleRight$cur4 === void 0 ? void 0 : _refs$doubleRight$cur4.option('disabled', true);
|
|
574
|
+
}
|
|
575
|
+
if (moment(time).diff(firstDayOfMax) > -1) {
|
|
576
|
+
var _refs$doubleRight$cur5, _refs$doubleRight$cur6, _refs$right$current2, _refs$right$current2$;
|
|
577
|
+
(_refs$doubleRight$cur5 = refs.doubleRight.current) === null || _refs$doubleRight$cur5 === void 0 ? void 0 : (_refs$doubleRight$cur6 = _refs$doubleRight$cur5.instance) === null || _refs$doubleRight$cur6 === void 0 ? void 0 : _refs$doubleRight$cur6.option('disabled', true);
|
|
578
|
+
(_refs$right$current2 = refs.right.current) === null || _refs$right$current2 === void 0 ? void 0 : (_refs$right$current2$ = _refs$right$current2.instance) === null || _refs$right$current2$ === void 0 ? void 0 : _refs$right$current2$.option('disabled', true);
|
|
579
|
+
}
|
|
623
580
|
}
|
|
624
|
-
}
|
|
625
|
-
if (max && isValidDate(max)) {
|
|
626
|
-
if (moment(time).diff(firstDayOfMax) > -334) {
|
|
627
|
-
var _refs$doubleRight$cur3, _refs$doubleRight$cur4;
|
|
628
|
-
(_refs$doubleRight$cur3 = refs.doubleRight.current) === null || _refs$doubleRight$cur3 === void 0 ? void 0 : (_refs$doubleRight$cur4 = _refs$doubleRight$cur3.instance) === null || _refs$doubleRight$cur4 === void 0 ? void 0 : _refs$doubleRight$cur4.option('disabled', true);
|
|
629
|
-
}
|
|
630
|
-
if (moment(time).diff(firstDayOfMax) > -1) {
|
|
631
|
-
var _refs$doubleRight$cur5, _refs$doubleRight$cur6, _refs$right$current2, _refs$right$current2$;
|
|
632
|
-
(_refs$doubleRight$cur5 = refs.doubleRight.current) === null || _refs$doubleRight$cur5 === void 0 ? void 0 : (_refs$doubleRight$cur6 = _refs$doubleRight$cur5.instance) === null || _refs$doubleRight$cur6 === void 0 ? void 0 : _refs$doubleRight$cur6.option('disabled', true);
|
|
633
|
-
(_refs$right$current2 = refs.right.current) === null || _refs$right$current2 === void 0 ? void 0 : (_refs$right$current2$ = _refs$right$current2.instance) === null || _refs$right$current2$ === void 0 ? void 0 : _refs$right$current2$.option('disabled', true);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
581
|
+
});
|
|
636
582
|
};
|
|
637
583
|
/**
|
|
638
584
|
*
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
|
|
4
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { Button, ButtonIcon, HelperText, InputBase, Label, Tooltip } from "../..";
|
|
5
|
+
import { getGlobal } from "../../../global";
|
|
6
|
+
import locale from "../../../locale";
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
9
|
import { render } from 'react-dom';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { bgColor, borderRadius4px, cursorPointer, displayBlock, displayFlex, displayNone, flexRow, itemsCenter, justifyEnd, left, mg, parseMaxWidth, parseMinWidth, parseWidthHeight, positionFixed, scale, top, z } from "../../../styles/general";
|
|
11
|
+
import { useTheme } from "../../../theme";
|
|
12
|
+
import { capitalizeSentenceCase, date as moment, randomString, updatePosition } from "../../../utils";
|
|
10
13
|
import CalendarComp from "../calendar";
|
|
11
|
-
import ControlComp from "../control";
|
|
12
|
-
import { ButtonIcon, HelperText, InputBase, Label } from "../../index";
|
|
13
|
-
import Button from "../../button";
|
|
14
|
-
import Tooltip from "../../tooltip";
|
|
15
14
|
import { isValidDate } from "../calendar/function";
|
|
16
|
-
import
|
|
17
|
-
import theme from "../../../theme/settings";
|
|
15
|
+
import ControlComp from "../control";
|
|
18
16
|
const {
|
|
19
|
-
colors: {
|
|
20
|
-
system: {
|
|
21
|
-
white
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
spacing,
|
|
25
17
|
zIndex: zIndexCORE
|
|
26
|
-
} =
|
|
18
|
+
} = useTheme();
|
|
27
19
|
const confirmText = getGlobal(['confirm']);
|
|
28
20
|
const cancelText = getGlobal(['cancel']);
|
|
29
21
|
const formatValue = (value, format, utc = false) => {
|
|
30
22
|
return moment(value).format(format, utc);
|
|
31
23
|
};
|
|
32
24
|
const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
25
|
+
action = {},
|
|
33
26
|
actionIconAt,
|
|
34
27
|
clearAble,
|
|
35
28
|
controls,
|
|
@@ -153,16 +146,6 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
153
146
|
}
|
|
154
147
|
return PickerCSS.picker(style, left + 400 > innerWidth ? innerWidth - 400 : left, width).styles;
|
|
155
148
|
};
|
|
156
|
-
// const createPortal = () => {
|
|
157
|
-
// let portal = document.getElementById(unique.portal);
|
|
158
|
-
// if (!portal) {
|
|
159
|
-
// portal = document.createElement('div');
|
|
160
|
-
// portal.id = unique.portal;
|
|
161
|
-
// document.body.appendChild(portal);
|
|
162
|
-
// }
|
|
163
|
-
// portal.style.cssText = pickerCSS.portal;
|
|
164
|
-
// return portal;
|
|
165
|
-
// };
|
|
166
149
|
const createBackground = () => {
|
|
167
150
|
let background = document.getElementById(unique.backGr);
|
|
168
151
|
if (!background) {
|
|
@@ -256,26 +239,6 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
256
239
|
// iconRef.current && onSwap(true);
|
|
257
240
|
ipRef.current && ipRef.current.blur();
|
|
258
241
|
};
|
|
259
|
-
// const updatePicker = () => {
|
|
260
|
-
// const portal = document.body.querySelector(`#${unique.portal}`);
|
|
261
|
-
// if (!portal) return;
|
|
262
|
-
// const backGr = portal.querySelector(`#${unique.backGr}`);
|
|
263
|
-
// if (!backGr) return;
|
|
264
|
-
// const node = portal.querySelector(`#${unique.picker}`);
|
|
265
|
-
// if (!node || !node.firstChild) return;
|
|
266
|
-
// unmountComponentAtNode(node);
|
|
267
|
-
// render(
|
|
268
|
-
// <CalendarComp
|
|
269
|
-
// ref={calRef}
|
|
270
|
-
// actions={footerMemo}
|
|
271
|
-
// defaultValue={displayValue.current}
|
|
272
|
-
// value={focusedValue.current}
|
|
273
|
-
// max={max}
|
|
274
|
-
// min={min}
|
|
275
|
-
// displayAnotherMonth={displayAnotherMonth}
|
|
276
|
-
// onClick={onCalendarClick}
|
|
277
|
-
// />, node);
|
|
278
|
-
// };
|
|
279
242
|
const onSwap = open => {
|
|
280
243
|
const t = iconRef.current.childNodes[+open];
|
|
281
244
|
if (open) {
|
|
@@ -448,6 +411,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
448
411
|
useImperativeHandle(reference, () => {
|
|
449
412
|
const currentRef = ref.current || {};
|
|
450
413
|
const _instance = {
|
|
414
|
+
...action,
|
|
451
415
|
get: () => {
|
|
452
416
|
return ref.current;
|
|
453
417
|
},
|
|
@@ -479,11 +443,11 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
479
443
|
error: isError,
|
|
480
444
|
ref: ref,
|
|
481
445
|
style: style
|
|
482
|
-
},
|
|
446
|
+
}, label ? jsx(Label, {
|
|
483
447
|
disabled: disabled,
|
|
484
448
|
required: required,
|
|
485
449
|
...labelProps
|
|
486
|
-
}, label), jsx(Tooltip, {
|
|
450
|
+
}, label) : null, jsx(Tooltip, {
|
|
487
451
|
title: (ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current = ipRef.current) === null || _ipRef$current === void 0 ? void 0 : _ipRef$current.clientWidth) < 200 ? ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current2 = ipRef.current) === null || _ipRef$current2 === void 0 ? void 0 : _ipRef$current2.value : ''
|
|
488
452
|
}, jsx(InputBase, {
|
|
489
453
|
inputProps: {
|
|
@@ -502,7 +466,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
502
466
|
endIcon: endIcon,
|
|
503
467
|
onKeyDown: e => e.preventDefault(),
|
|
504
468
|
readOnly: true
|
|
505
|
-
})), isError
|
|
469
|
+
})), isError ? jsx(HelperText, {
|
|
506
470
|
...errorProps,
|
|
507
471
|
style: {
|
|
508
472
|
minHeight: 16,
|
|
@@ -510,7 +474,7 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
510
474
|
top: '100%'
|
|
511
475
|
},
|
|
512
476
|
disabled: disabled
|
|
513
|
-
}, error));
|
|
477
|
+
}, error) : null);
|
|
514
478
|
}));
|
|
515
479
|
const hiddenStyle = {
|
|
516
480
|
opacity: 0,
|
|
@@ -522,6 +486,7 @@ const activeStyle = {
|
|
|
522
486
|
display: 'block'
|
|
523
487
|
};
|
|
524
488
|
const IconAreaCSS = unique => css`
|
|
489
|
+
${displayFlex};
|
|
525
490
|
${flexRow};
|
|
526
491
|
${itemsCenter};
|
|
527
492
|
color: inherit;
|
|
@@ -538,27 +503,28 @@ const IconAreaCSS = unique => css`
|
|
|
538
503
|
}
|
|
539
504
|
`;
|
|
540
505
|
const ControlContainerCSS = css`
|
|
506
|
+
${displayFlex};
|
|
541
507
|
${flexRow};
|
|
542
508
|
${justifyEnd};
|
|
543
|
-
|
|
509
|
+
${mg([0, 4, 4])};
|
|
544
510
|
`;
|
|
545
511
|
const PickerCSS = {
|
|
546
512
|
backGr: `background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: ${zIndexCORE(1)};`,
|
|
547
|
-
picker: (position,
|
|
513
|
+
picker: (position, positionLeft, width) => css`
|
|
548
514
|
${positionFixed};
|
|
549
515
|
${borderRadius4px};
|
|
550
|
-
${
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
516
|
+
${bgColor('system.white')};
|
|
517
|
+
${parseWidthHeight(width, 'max-content')};
|
|
518
|
+
${parseMinWidth(window.innerWidth <= 599 ? 280 : 314)};
|
|
519
|
+
${parseMaxWidth(400)};
|
|
520
|
+
${scale(0)};
|
|
521
|
+
${left(positionLeft)};
|
|
522
|
+
${top(position.top)};
|
|
555
523
|
transform-origin: ${position.transformOrigin};
|
|
556
|
-
max-width: 400px;
|
|
557
|
-
min-width: ${window.innerWidth <= 599 ? 280 : 314}px;
|
|
558
524
|
opacity: 0;
|
|
559
525
|
transform: scale(0);
|
|
560
526
|
transition: opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
561
|
-
|
|
527
|
+
${z(2)};
|
|
562
528
|
`,
|
|
563
529
|
active: {
|
|
564
530
|
opacity: 1,
|
|
@@ -576,12 +542,12 @@ DatePicker.defaultProps = {
|
|
|
576
542
|
controls: false,
|
|
577
543
|
disabled: false,
|
|
578
544
|
displayAnotherMonth: true,
|
|
579
|
-
displayFormat: '
|
|
545
|
+
displayFormat: locale.get() === 'vi' ? 'DD/MM/YYYY' : 'MM/DD/YYYY',
|
|
580
546
|
pressESCToClose: true,
|
|
581
547
|
readOnly: false,
|
|
582
548
|
required: false,
|
|
583
|
-
textAlign: 'start',
|
|
584
549
|
returnFormat: 'YYYY-MM-DD',
|
|
550
|
+
textAlign: 'start',
|
|
585
551
|
viewType: 'underlined'
|
|
586
552
|
};
|
|
587
553
|
DatePicker.propTypes = {
|
|
@@ -1182,7 +1182,7 @@ DateRangePicker.propTypes = {
|
|
|
1182
1182
|
style: PropTypes.object,
|
|
1183
1183
|
/** Text align of the input. */
|
|
1184
1184
|
textAlign: PropTypes.oneOf(['center', 'end', 'start']),
|
|
1185
|
-
/** The value of the input element, required for a controlled component.
|
|
1185
|
+
/** 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
1186
|
value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
|
|
1187
1187
|
/** The variant to use. */
|
|
1188
1188
|
viewType: PropTypes.oneOf(['outlined', 'underlined'])
|
|
@@ -77,13 +77,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
77
77
|
}
|
|
78
78
|
if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Convert number to format money
|
|
82
|
-
* @param vl {number} - value
|
|
83
|
-
* @type {function}
|
|
84
|
-
* @return {string}
|
|
85
|
-
* @example 1200300.123 => 1,200,300.123
|
|
86
|
-
* @example 1200300,123 => 1.200.300,123
|
|
80
|
+
/**
|
|
81
|
+
* Convert number to format money
|
|
82
|
+
* @param vl {number} - value
|
|
83
|
+
* @type {function}
|
|
84
|
+
* @return {string}
|
|
85
|
+
* @example 1200300.123 => 1,200,300.123
|
|
86
|
+
* @example 1200300,123 => 1.200.300,123
|
|
87
87
|
*/
|
|
88
88
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
89
89
|
var _number, _number2, _number$, _number3;
|
|
@@ -114,13 +114,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
114
114
|
return number;
|
|
115
115
|
}, [decimalSymbol, max, value]);
|
|
116
116
|
|
|
117
|
-
/**
|
|
118
|
-
* Convert money to format number
|
|
119
|
-
* @param vl {string} - value
|
|
120
|
-
* @type {function}
|
|
121
|
-
* @return {number}
|
|
122
|
-
* @example 1,200,300.123 => 1200300.123
|
|
123
|
-
* @example 1.200.300,123 => 1200300.123
|
|
117
|
+
/**
|
|
118
|
+
* Convert money to format number
|
|
119
|
+
* @param vl {string} - value
|
|
120
|
+
* @type {function}
|
|
121
|
+
* @return {number}
|
|
122
|
+
* @example 1,200,300.123 => 1200300.123
|
|
123
|
+
* @example 1.200.300,123 => 1200300.123
|
|
124
124
|
*/
|
|
125
125
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
126
126
|
var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
|
|
@@ -414,10 +414,10 @@ NumberInput.propTypes = {
|
|
|
414
414
|
style: PropTypes.object,
|
|
415
415
|
/** Thousand separator character. */
|
|
416
416
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
417
|
-
/** Validation value, argument can:<br/>
|
|
418
|
-
* * string: the validation rule. Example required.<br/>
|
|
419
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
420
|
-
* * array: the validation rule list, insist object/string
|
|
417
|
+
/** Validation value, argument can:<br/>
|
|
418
|
+
* * string: the validation rule. Example required.<br/>
|
|
419
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
420
|
+
* * array: the validation rule list, insist object/string
|
|
421
421
|
*/
|
|
422
422
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
423
423
|
/** The value of the input element, required for a controlled component. */
|
|
@@ -191,11 +191,11 @@ Radio.propTypes = {
|
|
|
191
191
|
className: PropTypes.string,
|
|
192
192
|
/** Props for input. */
|
|
193
193
|
inputProps: PropTypes.object,
|
|
194
|
-
/** Callback fired when the state is changed.
|
|
195
|
-
*
|
|
196
|
-
* @param {object} event The event source of the callback.
|
|
197
|
-
* You can pull out the new value by accessing `event.target.value` (string).
|
|
198
|
-
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
194
|
+
/** Callback fired when the state is changed.
|
|
195
|
+
*
|
|
196
|
+
* @param {object} event The event source of the callback.
|
|
197
|
+
* You can pull out the new value by accessing `event.target.value` (string).
|
|
198
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
199
199
|
* */
|
|
200
200
|
onChange: PropTypes.func,
|
|
201
201
|
/** Prevent all event if true. */
|
|
@@ -226,10 +226,10 @@ Toggle.propTypes = {
|
|
|
226
226
|
lineClamp: PropTypes.number,
|
|
227
227
|
/** Shows tooltip containing Label on hover */
|
|
228
228
|
hoverTooltip: PropTypes.bool,
|
|
229
|
-
/** * Callback fired when the state is changed.
|
|
230
|
-
*
|
|
231
|
-
* @param {object} event The event source of the callback.
|
|
232
|
-
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
229
|
+
/** * Callback fired when the state is changed.
|
|
230
|
+
*
|
|
231
|
+
* @param {object} event The event source of the callback.
|
|
232
|
+
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
|
233
233
|
*/
|
|
234
234
|
onChange: PropTypes.func,
|
|
235
235
|
/** If `true`, the label will indicate that the checkbox is required. */
|
package/components/grid/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
6
|
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
7
|
import { boxBorder } from "../../styles/general";
|
|
@@ -232,4 +233,5 @@ Grid.propTypes = {
|
|
|
232
233
|
/** If `true`, it sets `min-width: 0` on the item. Refer to the limitations section of the documentation to better understand the use case. */
|
|
233
234
|
zeroMinWidth: PropTypes.bool
|
|
234
235
|
};
|
|
235
|
-
export
|
|
236
|
+
export { Grid };
|
|
237
|
+
export default OptionWrapper(Grid);
|