dtable-ui-component 4.3.9 → 4.3.10-alpha2
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/lib/CTimeFormatter/index.js +1 -1
- package/lib/DateEditor/index.js +3 -0
- package/lib/DateEditor/pc-date-editor-popover.js +1 -0
- package/lib/MTimeFormatter/index.js +1 -1
- package/lib/common/ClickOutside.js +1 -1
- package/lib/lang/index.js +2 -0
- package/lib/toaster/alert.js +28 -107
- package/lib/toaster/index.css +116 -0
- package/lib/toaster/toast.js +2 -40
- package/lib/toaster/toastManager.js +2 -12
- package/lib/toaster/toaster.js +1 -0
- package/package.json +2 -3
|
@@ -15,7 +15,7 @@ class CTimeFormatter extends React.Component {
|
|
|
15
15
|
containerClassName
|
|
16
16
|
} = this.props;
|
|
17
17
|
let classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
18
|
-
if (date
|
|
18
|
+
if (date) {
|
|
19
19
|
date = this.formatDate(date);
|
|
20
20
|
}
|
|
21
21
|
return /*#__PURE__*/React.createElement("div", {
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import dayjs from 'dayjs';
|
|
|
4
4
|
import { getDateDisplayString } from 'dtable-utils';
|
|
5
5
|
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
6
6
|
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
7
|
+
import 'dayjs/locale/zh-cn';
|
|
8
|
+
import 'dayjs/locale/en-gb';
|
|
7
9
|
import './index.css';
|
|
8
10
|
class DateEditor extends React.Component {
|
|
9
11
|
constructor(props) {
|
|
@@ -84,6 +86,7 @@ class DateEditor extends React.Component {
|
|
|
84
86
|
lang,
|
|
85
87
|
column
|
|
86
88
|
} = this.props;
|
|
89
|
+
console.log('date editor 98', lang);
|
|
87
90
|
let {
|
|
88
91
|
newValue,
|
|
89
92
|
isPopoverShow,
|
|
@@ -50,6 +50,7 @@ class PCDateEditorPopover extends React.Component {
|
|
|
50
50
|
lang
|
|
51
51
|
} = this.props;
|
|
52
52
|
let defaultValue = dayjs().clone();
|
|
53
|
+
console.log('pc date editor', 67, getLocale('Please_input'));
|
|
53
54
|
return /*#__PURE__*/React.createElement(Calendar, {
|
|
54
55
|
locale: initDateEditorLanguage(lang),
|
|
55
56
|
style: {
|
|
@@ -15,7 +15,7 @@ class MTimeFormatter extends React.Component {
|
|
|
15
15
|
containerClassName
|
|
16
16
|
} = this.props;
|
|
17
17
|
let classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
18
|
-
if (date
|
|
18
|
+
if (date) {
|
|
19
19
|
date = this.formatDate(date);
|
|
20
20
|
}
|
|
21
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,7 +8,7 @@ export default class ClickOutside extends React.Component {
|
|
|
8
8
|
this.isClickedInside = false;
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
this.props.onClickOutside(e);
|
|
11
|
+
this.props.onClickOutside && this.props.onClickOutside(e);
|
|
12
12
|
};
|
|
13
13
|
this.handleMouseDown = () => {
|
|
14
14
|
this.isClickedInside = true;
|
package/lib/lang/index.js
CHANGED
|
@@ -14,11 +14,13 @@ export function setLocale(args) {
|
|
|
14
14
|
let lang = typeof args === 'string' ? args : LANGUAGE;
|
|
15
15
|
LANGUAGE_MAP = langData[lang] || langData[LANGUAGE];
|
|
16
16
|
}
|
|
17
|
+
console.log(22, LANGUAGE_MAP);
|
|
17
18
|
export function getLocale(key, def) {
|
|
18
19
|
if (!key) return def;
|
|
19
20
|
if (!LANGUAGE_MAP[key]) {
|
|
20
21
|
return def || key;
|
|
21
22
|
}
|
|
23
|
+
console.log(LANGUAGE_MAP[key]);
|
|
22
24
|
return LANGUAGE_MAP[key];
|
|
23
25
|
}
|
|
24
26
|
export function substitute(str, obj) {
|
package/lib/toaster/alert.js
CHANGED
|
@@ -1,122 +1,43 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { css } from 'glamor';
|
|
3
2
|
class Alert extends React.PureComponent {
|
|
4
|
-
|
|
5
|
-
super(props);
|
|
6
|
-
this.containerStyle = css({
|
|
7
|
-
borderRadius: '3px',
|
|
8
|
-
backgroundColor: '#fff',
|
|
9
|
-
padding: '10px 16px',
|
|
10
|
-
display: 'flex',
|
|
11
|
-
boxSizing: 'border-box',
|
|
12
|
-
boxShadow: 'rgba(67, 90, 111, 0.3) 0px 0px 1px, rgba(67, 90, 111, 0.47) 0px 8px 10px -4px',
|
|
13
|
-
justifyContent: 'space-between',
|
|
14
|
-
flexDirection: 'row'
|
|
15
|
-
});
|
|
16
|
-
this.containerBorderSuccess = css({
|
|
17
|
-
borderLeft: '3px solid rgb(71, 184, 129)'
|
|
18
|
-
});
|
|
19
|
-
this.containerBorderWarn = css({
|
|
20
|
-
borderLeft: '3px solid rgb(217, 130, 43)'
|
|
21
|
-
});
|
|
22
|
-
this.containerBorderDanger = css({
|
|
23
|
-
borderLeft: '3px solid rgb(236, 76, 71)'
|
|
24
|
-
});
|
|
25
|
-
this.containerBorderNotify = css({
|
|
26
|
-
borderLeft: '3px solid rgb(16, 112, 202)'
|
|
27
|
-
});
|
|
28
|
-
this.toastTextTitle = css({
|
|
29
|
-
fontWeight: '600',
|
|
30
|
-
fontSize: '14px',
|
|
31
|
-
color: '#435a6f',
|
|
32
|
-
margin: '0'
|
|
33
|
-
});
|
|
34
|
-
this.toastTextChild = css({
|
|
35
|
-
fontSize: '14px',
|
|
36
|
-
color: '#999',
|
|
37
|
-
margin: '0'
|
|
38
|
-
});
|
|
39
|
-
this.toastClose = css({
|
|
40
|
-
marginLeft: '15px',
|
|
41
|
-
height: '24px',
|
|
42
|
-
width: '24px',
|
|
43
|
-
lineHeight: '22px',
|
|
44
|
-
fontWeight: '700',
|
|
45
|
-
textAlign: 'center',
|
|
46
|
-
fontSize: '20px',
|
|
47
|
-
color: '#000',
|
|
48
|
-
cursor: 'pointer',
|
|
49
|
-
opacity: '0.5',
|
|
50
|
-
':hover': {
|
|
51
|
-
opacity: 1
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.toastIcon = css({
|
|
55
|
-
marginRight: '10px',
|
|
56
|
-
width: '14px',
|
|
57
|
-
height: '20px',
|
|
58
|
-
lineHeight: '20px'
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
getContainerStyle(intent) {
|
|
3
|
+
getIconClass(intent) {
|
|
62
4
|
switch (intent) {
|
|
63
5
|
case 'success':
|
|
64
|
-
return
|
|
65
|
-
borderStyle: this.containerBorderSuccess,
|
|
66
|
-
iconColor: css({
|
|
67
|
-
color: 'rgb(71, 184, 129)'
|
|
68
|
-
}),
|
|
69
|
-
iconClass: 'dtable-font dtable-icon-check-circle'
|
|
70
|
-
};
|
|
6
|
+
return 'dtable-font dtable-icon-check-circle';
|
|
71
7
|
case 'warning':
|
|
72
|
-
return
|
|
73
|
-
borderStyle: this.containerBorderWarn,
|
|
74
|
-
iconColor: css({
|
|
75
|
-
color: 'rgb(217, 130, 43)'
|
|
76
|
-
}),
|
|
77
|
-
iconClass: 'dtable-font dtable-icon-exclamation-triangle'
|
|
78
|
-
};
|
|
8
|
+
return 'dtable-font dtable-icon-exclamation-triangle';
|
|
79
9
|
case 'none':
|
|
80
|
-
return
|
|
81
|
-
borderStyle: this.containerBorderNotify,
|
|
82
|
-
iconColor: css({
|
|
83
|
-
color: 'rgb(16, 112, 202)'
|
|
84
|
-
}),
|
|
85
|
-
iconClass: 'dtable-font dtable-icon-exclamation-circle'
|
|
86
|
-
};
|
|
10
|
+
return 'dtable-font dtable-icon-exclamation-circle';
|
|
87
11
|
case 'danger':
|
|
88
|
-
return
|
|
89
|
-
borderStyle: this.containerBorderDanger,
|
|
90
|
-
iconColor: css({
|
|
91
|
-
color: 'rgb(236, 76, 71)'
|
|
92
|
-
}),
|
|
93
|
-
iconClass: 'dtable-font dtable-icon-exclamation-circle'
|
|
94
|
-
};
|
|
12
|
+
return 'dtable-font dtable-icon-exclamation-circle';
|
|
95
13
|
default:
|
|
96
|
-
return
|
|
97
|
-
borderStyle: this.containerBorderSuccess,
|
|
98
|
-
iconColor: css({
|
|
99
|
-
color: 'rgb(71, 184, 129)'
|
|
100
|
-
}),
|
|
101
|
-
iconClass: 'dtable-font dtable-icon-check-circle'
|
|
102
|
-
};
|
|
14
|
+
return 'dtable-font dtable-icon-check-circle';
|
|
103
15
|
}
|
|
104
16
|
}
|
|
105
17
|
render() {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
18
|
+
const {
|
|
19
|
+
intent,
|
|
20
|
+
title,
|
|
21
|
+
children,
|
|
22
|
+
isRemovable,
|
|
23
|
+
onRemove
|
|
24
|
+
} = this.props;
|
|
25
|
+
const iconClass = this.getIconClass(intent);
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "dtable-toast-alert-container ".concat(intent || 'success')
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "toast-alert-icon"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
31
|
+
className: iconClass
|
|
32
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "toast-text-container"
|
|
113
34
|
}, /*#__PURE__*/React.createElement("p", {
|
|
114
|
-
className:
|
|
115
|
-
},
|
|
116
|
-
className:
|
|
117
|
-
},
|
|
118
|
-
onClick:
|
|
119
|
-
className:
|
|
35
|
+
className: "toast-text-title"
|
|
36
|
+
}, title), children ? /*#__PURE__*/React.createElement("p", {
|
|
37
|
+
className: "toast-text-child"
|
|
38
|
+
}, children) : null), isRemovable && /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
onClick: onRemove,
|
|
40
|
+
className: "toast-close"
|
|
120
41
|
}, /*#__PURE__*/React.createElement("span", null, "\xD7")));
|
|
121
42
|
}
|
|
122
43
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.dtable-toast-manager {
|
|
2
|
+
position: fixed;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
max-width: 560px;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
z-index: 999999;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dtable-toast-container {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: center;
|
|
15
|
+
height: 0;
|
|
16
|
+
transition: all 240ms cubic-bezier(0.0, 0.0, 0.2, 1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes openAnimation {
|
|
20
|
+
from {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
transform: translateY(-120%);
|
|
23
|
+
}
|
|
24
|
+
to {
|
|
25
|
+
transform: translateY(0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes closeAnimation {
|
|
30
|
+
from {
|
|
31
|
+
transform: scale(1);
|
|
32
|
+
opacity: 1;
|
|
33
|
+
}
|
|
34
|
+
to {
|
|
35
|
+
transform: scale(0.9);
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dtable-toast-container.entering,
|
|
41
|
+
.dtable-toast-container.entered {
|
|
42
|
+
animation: openAnimation 240ms cubic-bezier(0.175, 0.885, 0.320, 1.175) both;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dtable-toast-container.exiting {
|
|
46
|
+
animation: closeAnimation 120ms cubic-bezier(0.4, 0.0, 1, 1) both;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dtable-toast-alert-container {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
border-radius: 3px;
|
|
56
|
+
box-shadow: rgba(67, 90, 111, 0.3) 0px 0px 1px, rgba(67, 90, 111, 0.47) 0px 8px 10px -4px;
|
|
57
|
+
padding: 10px 16px;
|
|
58
|
+
background-color: #fff;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dtable-toast-alert-container.success {
|
|
62
|
+
border-left: 3px solid rgb(71, 184, 129);
|
|
63
|
+
color: rgb(71, 184, 129);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dtable-toast-alert-container.warning {
|
|
67
|
+
border-left: 3px solid rgb(217, 130, 43);
|
|
68
|
+
color: rgb(217, 130, 43);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.dtable-toast-alert-container.none {
|
|
72
|
+
border-left: 3px solid rgb(16, 112, 202);
|
|
73
|
+
color: rgb(16, 112, 202);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dtable-toast-alert-container.danger {
|
|
77
|
+
border-left: 3px solid rgb(236, 76, 71);
|
|
78
|
+
color: rgb(236, 76, 71);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dtable-toast-alert-container .toast-alert-icon {
|
|
82
|
+
margin-right: 10px;
|
|
83
|
+
width: 14px;
|
|
84
|
+
height: 20px;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.dtable-toast-alert-container .toast-text-title {
|
|
89
|
+
margin: 0;
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
font-size: 14px;
|
|
92
|
+
color: #435a6f;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dtable-toast-alert-container .toast-text-child {
|
|
96
|
+
font-size: 14px;
|
|
97
|
+
color: #999;
|
|
98
|
+
margin: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.dtable-toast-alert-container .toast-close {
|
|
102
|
+
text-align: center;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
height: 24px;
|
|
105
|
+
width: 24px;
|
|
106
|
+
margin-left: 15px;
|
|
107
|
+
line-height: 22px;
|
|
108
|
+
font-weight: 700;
|
|
109
|
+
font-size: 20px;
|
|
110
|
+
color: #000;
|
|
111
|
+
opacity: 0.5;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.dtable-toast-alert-container .toast-close:hover {
|
|
115
|
+
opacity: 1;
|
|
116
|
+
}
|
package/lib/toaster/toast.js
CHANGED
|
@@ -1,45 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { css } from 'glamor';
|
|
3
2
|
import Transition from 'react-transition-group/Transition';
|
|
4
3
|
import Alert from './alert';
|
|
5
|
-
const animationEasing = {
|
|
6
|
-
deceleration: 'cubic-bezier(0.0, 0.0, 0.2, 1)',
|
|
7
|
-
acceleration: 'cubic-bezier(0.4, 0.0, 1, 1)',
|
|
8
|
-
spring: 'cubic-bezier(0.175, 0.885, 0.320, 1.175)'
|
|
9
|
-
};
|
|
10
4
|
const ANIMATION_DURATION = 240;
|
|
11
|
-
const openAnimation = css.keyframes('openAnimation', {
|
|
12
|
-
from: {
|
|
13
|
-
opacity: 0,
|
|
14
|
-
transform: 'translateY(-120%)'
|
|
15
|
-
},
|
|
16
|
-
to: {
|
|
17
|
-
transform: 'translateY(0)'
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const closeAnimation = css.keyframes('closeAnimation', {
|
|
21
|
-
from: {
|
|
22
|
-
transform: 'scale(1)',
|
|
23
|
-
opacity: 1
|
|
24
|
-
},
|
|
25
|
-
to: {
|
|
26
|
-
transform: 'scale(0.9)',
|
|
27
|
-
opacity: 0
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
const animationStyles = css({
|
|
31
|
-
display: 'flex',
|
|
32
|
-
flexDirection: 'column',
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
height: 0,
|
|
35
|
-
transition: "all ".concat(ANIMATION_DURATION, "ms ").concat(animationEasing.deceleration),
|
|
36
|
-
'&[data-state="entering"], &[data-state="entered"]': {
|
|
37
|
-
animation: "".concat(openAnimation, " ").concat(ANIMATION_DURATION, "ms ").concat(animationEasing.spring, " both")
|
|
38
|
-
},
|
|
39
|
-
'&[data-state="exiting"]': {
|
|
40
|
-
animation: "".concat(closeAnimation, " 120ms ").concat(animationEasing.acceleration, " both")
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
5
|
export default class Toast extends React.PureComponent {
|
|
44
6
|
constructor() {
|
|
45
7
|
super(...arguments);
|
|
@@ -109,7 +71,7 @@ export default class Toast extends React.PureComponent {
|
|
|
109
71
|
onExited: this.props.onRemove
|
|
110
72
|
}, state => /*#__PURE__*/React.createElement("div", {
|
|
111
73
|
"data-state": state,
|
|
112
|
-
className:
|
|
74
|
+
className: "dtable-toast-container ".concat(state),
|
|
113
75
|
onMouseEnter: this.handleMouseEnter,
|
|
114
76
|
onMouseLeave: this.handleMouseLeave,
|
|
115
77
|
style: {
|
|
@@ -126,7 +88,7 @@ export default class Toast extends React.PureComponent {
|
|
|
126
88
|
intent: this.props.intent,
|
|
127
89
|
title: this.props.title,
|
|
128
90
|
children: this.props.children || '',
|
|
129
|
-
|
|
91
|
+
isRemovable: this.props.hasCloseButton,
|
|
130
92
|
onRemove: event => this.close(event)
|
|
131
93
|
}))));
|
|
132
94
|
}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { css } from 'glamor';
|
|
3
2
|
import Toast from './toast';
|
|
4
|
-
const wrapperClass = css({
|
|
5
|
-
maxWidth: 560,
|
|
6
|
-
margin: '0 auto',
|
|
7
|
-
top: 0,
|
|
8
|
-
left: 0,
|
|
9
|
-
right: 0,
|
|
10
|
-
position: 'fixed',
|
|
11
|
-
zIndex: 999999
|
|
12
|
-
});
|
|
13
3
|
const hasCustomId = settings => Object.hasOwnProperty.call(settings, 'id');
|
|
14
4
|
export default class ToastManager extends React.PureComponent {
|
|
15
5
|
constructor(props, context) {
|
|
@@ -93,8 +83,8 @@ export default class ToastManager extends React.PureComponent {
|
|
|
93
83
|
};
|
|
94
84
|
}
|
|
95
85
|
render() {
|
|
96
|
-
return /*#__PURE__*/React.createElement("
|
|
97
|
-
className:
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: "dtable-toast-manager"
|
|
98
88
|
}, this.state.toasts.map(_ref => {
|
|
99
89
|
let {
|
|
100
90
|
id,
|
package/lib/toaster/toaster.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.10-alpha2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "2.0.5",
|
|
7
7
|
"@seafile/seafile-calendar": "0.0.24",
|
|
8
|
-
"@seafile/seafile-editor": "0.3.
|
|
8
|
+
"@seafile/seafile-editor": "0.3.146",
|
|
9
9
|
"antd-mobile": "2.3.1",
|
|
10
10
|
"bail": "1.0.5",
|
|
11
11
|
"classnames": "^2.3.2",
|
|
12
12
|
"dayjs": "1.10.7",
|
|
13
13
|
"deepmerge": "^2.1.0",
|
|
14
14
|
"dtable-utils": "~4.3.5",
|
|
15
|
-
"glamor": "^2.20.40",
|
|
16
15
|
"hast-util-sanitize": "^1.1.2",
|
|
17
16
|
"hast-util-to-html": "3.1.0",
|
|
18
17
|
"is-hotkey": "0.2.0",
|