dtable-ui-component 0.1.82 → 0.1.84-beta1
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 +2 -2
- package/lib/DateEditor/index.js +2 -2
- package/lib/DateEditor/mb-date-editor-popover/index.js +9 -9
- package/lib/DateEditor/pc-date-editor-popover.js +3 -3
- package/lib/DtablePopover/index.js +115 -0
- package/lib/DtablePopover/utils.js +5 -0
- package/lib/DtableSelect/index.js +140 -0
- package/lib/DtableSwitch/index.js +27 -0
- package/lib/FormulaFormatter/index.js +7 -7
- package/lib/MTimeFormatter/index.js +2 -2
- package/lib/index.js +5 -1
- package/lib/utils/value-format-utils.js +2 -2
- package/package.json +5 -5
|
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import cn from 'astro-classname';
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
8
|
import './index.css';
|
|
9
9
|
|
|
10
10
|
var CTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
@@ -24,7 +24,7 @@ var CTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
24
24
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
25
|
|
|
26
26
|
_this.formatDate = function (date) {
|
|
27
|
-
return
|
|
27
|
+
return dayjs(date).format('YYYY-MM-DD HH:mm:ss');
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return _this;
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import MediaQuery from 'react-responsive';
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
8
|
import { getDateDisplayString } from '../utils/value-format-utils';
|
|
9
9
|
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
10
10
|
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
@@ -81,7 +81,7 @@ var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
81
81
|
var _this$props = this.props,
|
|
82
82
|
value = _this$props.value,
|
|
83
83
|
lang = _this$props.lang;
|
|
84
|
-
|
|
84
|
+
dayjs.locale(lang);
|
|
85
85
|
var dateFormat = this.getDateFormat();
|
|
86
86
|
this.setState({
|
|
87
87
|
isDateInit: true,
|
|
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { DatePicker } from 'antd-mobile';
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
8
|
import Calendar from '@seafile/seafile-calendar';
|
|
9
9
|
import * as SeaDatePicker from '@seafile/seafile-calendar/lib/Picker';
|
|
10
10
|
import { getLocale } from '../../lang';
|
|
@@ -35,19 +35,19 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
35
35
|
var _this$props = _this.props,
|
|
36
36
|
dateFormat = _this$props.dateFormat,
|
|
37
37
|
showHourAndMinute = _this$props.showHourAndMinute;
|
|
38
|
-
var newValue =
|
|
38
|
+
var newValue = dayjs(date);
|
|
39
39
|
|
|
40
40
|
if (showHourAndMinute) {
|
|
41
41
|
var datePickerValue = _this.state.datePickerValue;
|
|
42
42
|
var HM = datePickerValue.format('HH:mm');
|
|
43
43
|
var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
|
|
44
44
|
|
|
45
|
-
var newDate =
|
|
46
|
-
newValue =
|
|
45
|
+
var newDate = dayjs(date).format(format) + ' ' + HM;
|
|
46
|
+
newValue = dayjs(newDate);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
_this.setState({
|
|
50
|
-
datePickerValue:
|
|
50
|
+
datePickerValue: dayjs(date)
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
_this.props.onValueChanged(newValue.format(dateFormat));
|
|
@@ -59,8 +59,8 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
59
59
|
var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
|
|
60
60
|
|
|
61
61
|
var YMD = datePickerValue.format(format);
|
|
62
|
-
var newDate = YMD + ' ' +
|
|
63
|
-
var newValue =
|
|
62
|
+
var newDate = YMD + ' ' + dayjs(time).format('HH:mm');
|
|
63
|
+
var newValue = dayjs(newDate);
|
|
64
64
|
|
|
65
65
|
_this.setState({
|
|
66
66
|
datePickerValue: newValue
|
|
@@ -110,7 +110,7 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
110
110
|
var _this$props2 = _this.props,
|
|
111
111
|
dateFormat = _this$props2.dateFormat,
|
|
112
112
|
lang = _this$props2.lang;
|
|
113
|
-
var defaultValue =
|
|
113
|
+
var defaultValue = dayjs().clone();
|
|
114
114
|
return /*#__PURE__*/React.createElement(Calendar, {
|
|
115
115
|
locale: initDateEditorLanguage(lang),
|
|
116
116
|
format: dateFormat,
|
|
@@ -165,7 +165,7 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
165
165
|
|
|
166
166
|
_this.state = {
|
|
167
167
|
open: true,
|
|
168
|
-
datePickerValue: props.value ?
|
|
168
|
+
datePickerValue: props.value ? dayjs(props.value) : dayjs().clone()
|
|
169
169
|
};
|
|
170
170
|
_this.calendarContainerRef = React.createRef();
|
|
171
171
|
return _this;
|
|
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import dayjs from 'dayjs';
|
|
7
7
|
import DatePicker from '@seafile/seafile-calendar/lib/Picker';
|
|
8
8
|
import Calendar from '@seafile/seafile-calendar';
|
|
9
9
|
import { initDateEditorLanguage } from '../utils/editor-utils';
|
|
@@ -69,7 +69,7 @@ var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
69
69
|
dateFormat = _this$props.dateFormat,
|
|
70
70
|
showHourAndMinute = _this$props.showHourAndMinute,
|
|
71
71
|
lang = _this$props.lang;
|
|
72
|
-
var defaultValue =
|
|
72
|
+
var defaultValue = dayjs().clone();
|
|
73
73
|
return /*#__PURE__*/React.createElement(Calendar, {
|
|
74
74
|
locale: initDateEditorLanguage(lang),
|
|
75
75
|
style: {
|
|
@@ -87,7 +87,7 @@ var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
87
87
|
|
|
88
88
|
_this.state = {
|
|
89
89
|
open: true,
|
|
90
|
-
datePickerValue: props.value ?
|
|
90
|
+
datePickerValue: props.value ? dayjs(props.value) : null
|
|
91
91
|
};
|
|
92
92
|
_this.calendarContainerRef = React.createRef();
|
|
93
93
|
return _this;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Popover } from 'reactstrap';
|
|
7
|
+
import { getEventClassName } from './utils';
|
|
8
|
+
|
|
9
|
+
var DTablePopover = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(DTablePopover, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(DTablePopover);
|
|
13
|
+
|
|
14
|
+
function DTablePopover() {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, DTablePopover);
|
|
18
|
+
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
_this.dtablePopoverRef = null;
|
|
25
|
+
|
|
26
|
+
_this.onHistoryState = function (e) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
|
|
29
|
+
_this.props.hideDTablePopover(e);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
_this.onKeyDown = function (e) {
|
|
33
|
+
var _this$props = _this.props,
|
|
34
|
+
canHideDTablePopover = _this$props.canHideDTablePopover,
|
|
35
|
+
hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
|
|
36
|
+
|
|
37
|
+
if (e.keyCode === 27 && typeof hideDTablePopoverWithEsc === 'function') {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
hideDTablePopoverWithEsc();
|
|
40
|
+
} else if (e.keyCode === 13) {
|
|
41
|
+
// Resolve the default behavior of the enter key when entering formulas is blocked
|
|
42
|
+
if (canHideDTablePopover) return;
|
|
43
|
+
e.stopImmediatePropagation();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
_this.onMouseDown = function (e) {
|
|
48
|
+
var canHideDTablePopover = _this.props.canHideDTablePopover;
|
|
49
|
+
if (!canHideDTablePopover) return;
|
|
50
|
+
|
|
51
|
+
if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
|
|
52
|
+
_this.props.hideDTablePopover(e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
_this.onPopoverInsideClick = function (e) {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return _this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
_createClass(DTablePopover, [{
|
|
64
|
+
key: "componentDidMount",
|
|
65
|
+
value: function componentDidMount() {
|
|
66
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
67
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
68
|
+
window.addEventListener('popstate', this.onHistoryState);
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "componentWillUnmount",
|
|
72
|
+
value: function componentWillUnmount() {
|
|
73
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
74
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
75
|
+
window.removeEventListener('popstate', this.onHistoryState);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "render",
|
|
79
|
+
value: function render() {
|
|
80
|
+
var _this2 = this;
|
|
81
|
+
|
|
82
|
+
var _this$props2 = this.props,
|
|
83
|
+
target = _this$props2.target,
|
|
84
|
+
innerClassName = _this$props2.innerClassName,
|
|
85
|
+
popoverClassName = _this$props2.popoverClassName,
|
|
86
|
+
hideArrow = _this$props2.hideArrow,
|
|
87
|
+
modifiers = _this$props2.modifiers,
|
|
88
|
+
placement = _this$props2.placement;
|
|
89
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
90
|
+
placement: placement,
|
|
91
|
+
isOpen: true,
|
|
92
|
+
target: target,
|
|
93
|
+
fade: false,
|
|
94
|
+
hideArrow: hideArrow,
|
|
95
|
+
innerClassName: innerClassName,
|
|
96
|
+
className: popoverClassName,
|
|
97
|
+
modifiers: modifiers
|
|
98
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
ref: function ref(_ref) {
|
|
100
|
+
return _this2.dtablePopoverRef = _ref;
|
|
101
|
+
},
|
|
102
|
+
onClick: this.onPopoverInsideClick
|
|
103
|
+
}, this.props.children));
|
|
104
|
+
}
|
|
105
|
+
}]);
|
|
106
|
+
|
|
107
|
+
return DTablePopover;
|
|
108
|
+
}(React.Component);
|
|
109
|
+
|
|
110
|
+
DTablePopover.defaultProps = {
|
|
111
|
+
placement: 'bottom-start',
|
|
112
|
+
hideArrow: true,
|
|
113
|
+
canHideDTablePopover: true
|
|
114
|
+
};
|
|
115
|
+
export default DTablePopover;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import Select, { components } from 'react-select';
|
|
8
|
+
var MenuSelectStyle = {
|
|
9
|
+
option: function option(provided, state) {
|
|
10
|
+
var isDisabled = state.isDisabled,
|
|
11
|
+
isSelected = state.isSelected,
|
|
12
|
+
isFocused = state.isFocused;
|
|
13
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
14
|
+
cursor: isDisabled ? 'default' : 'pointer',
|
|
15
|
+
backgroundColor: isSelected ? '#20a0ff' : isFocused ? '#f5f5f5' : '#fff',
|
|
16
|
+
'.header-icon .dtable-font': {
|
|
17
|
+
color: isSelected ? '#fff' : '#aaa'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
control: function control(provided) {
|
|
22
|
+
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
23
|
+
fontSize: '14px',
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
lineHeight: '1.5'
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
menuPortal: function menuPortal(base) {
|
|
29
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
30
|
+
zIndex: 9999
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
indicatorSeparator: function indicatorSeparator() {}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
var DropdownIndicator = function DropdownIndicator(props) {
|
|
37
|
+
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: "dtable-font dtable-icon-drop-down",
|
|
39
|
+
style: {
|
|
40
|
+
fontSize: '12px'
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var MenuList = function MenuList(props) {
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
onClick: function onClick(e) {
|
|
48
|
+
return e.nativeEvent.stopImmediatePropagation();
|
|
49
|
+
},
|
|
50
|
+
onMouseDown: function onMouseDown(e) {
|
|
51
|
+
return e.nativeEvent.stopImmediatePropagation();
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var Option = function Option(props) {
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
style: props.data.style
|
|
59
|
+
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
63
|
+
_inherits(DtableSelect, _React$Component);
|
|
64
|
+
|
|
65
|
+
var _super = _createSuper(DtableSelect);
|
|
66
|
+
|
|
67
|
+
function DtableSelect() {
|
|
68
|
+
var _this;
|
|
69
|
+
|
|
70
|
+
_classCallCheck(this, DtableSelect);
|
|
71
|
+
|
|
72
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
+
args[_key] = arguments[_key];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
77
|
+
|
|
78
|
+
_this.getMenuPortalTarget = function () {
|
|
79
|
+
var menuPortalTarget = _this.props.menuPortalTarget;
|
|
80
|
+
return document.querySelector(menuPortalTarget);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return _this;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
_createClass(DtableSelect, [{
|
|
87
|
+
key: "render",
|
|
88
|
+
value: function render() {
|
|
89
|
+
var _this$props = this.props,
|
|
90
|
+
options = _this$props.options,
|
|
91
|
+
onChange = _this$props.onChange,
|
|
92
|
+
value = _this$props.value,
|
|
93
|
+
isSearchable = _this$props.isSearchable,
|
|
94
|
+
placeholder = _this$props.placeholder,
|
|
95
|
+
isMulti = _this$props.isMulti,
|
|
96
|
+
menuPosition = _this$props.menuPosition,
|
|
97
|
+
isClearable = _this$props.isClearable,
|
|
98
|
+
noOptionsMessage = _this$props.noOptionsMessage,
|
|
99
|
+
classNamePrefix = _this$props.classNamePrefix;
|
|
100
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
101
|
+
value: value,
|
|
102
|
+
onChange: onChange,
|
|
103
|
+
options: options,
|
|
104
|
+
isMulti: isMulti,
|
|
105
|
+
classNamePrefix: classNamePrefix,
|
|
106
|
+
styles: MenuSelectStyle,
|
|
107
|
+
components: {
|
|
108
|
+
Option: Option,
|
|
109
|
+
DropdownIndicator: DropdownIndicator,
|
|
110
|
+
MenuList: MenuList
|
|
111
|
+
},
|
|
112
|
+
placeholder: placeholder,
|
|
113
|
+
isSearchable: isSearchable,
|
|
114
|
+
isClearable: isClearable,
|
|
115
|
+
menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
|
|
116
|
+
,
|
|
117
|
+
menuShouldScrollIntoView: true,
|
|
118
|
+
menuPortalTarget: this.getMenuPortalTarget(),
|
|
119
|
+
captureMenuScroll: false,
|
|
120
|
+
noOptionsMessage: noOptionsMessage
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}]);
|
|
124
|
+
|
|
125
|
+
return DtableSelect;
|
|
126
|
+
}(React.Component);
|
|
127
|
+
|
|
128
|
+
DtableSelect.defaultProps = {
|
|
129
|
+
options: [],
|
|
130
|
+
value: {},
|
|
131
|
+
isSearchable: false,
|
|
132
|
+
isClearable: false,
|
|
133
|
+
placeholder: '',
|
|
134
|
+
isMulti: false,
|
|
135
|
+
menuPortalTarget: '.modal',
|
|
136
|
+
noOptionsMessage: function noOptionsMessage() {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
export default DtableSelect;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
function DtableSwitch(props) {
|
|
4
|
+
var onChange = props.onChange,
|
|
5
|
+
checked = props.checked,
|
|
6
|
+
placeholder = props.placeholder,
|
|
7
|
+
disabled = props.disabled,
|
|
8
|
+
switchClassName = props.switchClassName;
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: "dtable-switch ".concat(switchClassName || '')
|
|
11
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
12
|
+
className: "custom-switch"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
14
|
+
className: "custom-switch-input",
|
|
15
|
+
type: "checkbox",
|
|
16
|
+
checked: checked,
|
|
17
|
+
onChange: onChange,
|
|
18
|
+
name: "custom-switch-checkbox",
|
|
19
|
+
disabled: disabled
|
|
20
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: "custom-switch-description text-truncate"
|
|
22
|
+
}, placeholder), /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: "custom-switch-indicator"
|
|
24
|
+
})));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default DtableSwitch;
|
|
@@ -59,19 +59,19 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
59
59
|
|
|
60
60
|
var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
|
|
61
61
|
|
|
62
|
-
if (isArrayFormalColumn(array_type)) {
|
|
63
|
-
formatterProps.value = value;
|
|
64
|
-
return _this.createColumnFormatter(Formatter, formatterProps);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
|
|
68
|
-
|
|
69
62
|
var cellValue = value;
|
|
70
63
|
|
|
71
64
|
if (!Array.isArray(value)) {
|
|
72
65
|
cellValue = cellValueValidator(value, array_type) ? [value] : [];
|
|
73
66
|
}
|
|
74
67
|
|
|
68
|
+
if (isArrayFormalColumn(array_type)) {
|
|
69
|
+
formatterProps.value = cellValue.filter(Boolean);
|
|
70
|
+
return _this.createColumnFormatter(Formatter, formatterProps);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
|
|
74
|
+
|
|
75
75
|
var contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
|
|
76
76
|
return /*#__PURE__*/React.createElement("div", {
|
|
77
77
|
className: "dtable-ui formula-formatter multiple"
|
|
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import cn from 'astro-classname';
|
|
7
|
-
import
|
|
7
|
+
import dayjs from 'dayjs';
|
|
8
8
|
import './index.css';
|
|
9
9
|
|
|
10
10
|
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
@@ -24,7 +24,7 @@ var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
24
24
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
25
|
|
|
26
26
|
_this.formatDate = function (date) {
|
|
27
|
-
return
|
|
27
|
+
return dayjs(date).format('YYYY-MM-DD HH:mm:ss');
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return _this;
|
package/lib/index.js
CHANGED
|
@@ -41,4 +41,8 @@ export { default as SingleSelectEditor } from './SingleSelectEditor';
|
|
|
41
41
|
export { default as MultipleSelectEditor } from './MultipleSelectEditor';
|
|
42
42
|
export { default as CollaboratorEditor } from './CollaboratorEditor';
|
|
43
43
|
export { default as DateEditor } from './DateEditor';
|
|
44
|
-
export { default as LinkEditor } from './LinkEditor';
|
|
44
|
+
export { default as LinkEditor } from './LinkEditor'; // dtable custom
|
|
45
|
+
|
|
46
|
+
export { default as DTablePopover } from './DtablePopover';
|
|
47
|
+
export { default as DTableSelect } from './DtableSelect';
|
|
48
|
+
export { default as DtableSwitch } from './DtableSwitch';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
import NP from './number-precision';
|
|
4
4
|
import { CellType, NUMBER_TYPES, DEFAULT_NUMBER_FORMAT, DURATION_FORMATS_MAP, DURATION_FORMATS, DURATION_ZERO_DISPLAY, DURATION_DECIMAL_DIGITS, FORMULA_RESULT_TYPE, COLLABORATOR_COLUMN_TYPES, ARRAY_FORMAL_COLUMNS_TYPES, DEFAULT_DATE_FORMAT } from '../constants';
|
|
5
5
|
NP.enableBoundaryChecking(false);
|
|
@@ -161,7 +161,7 @@ export var getDateDisplayString = function getDateDisplayString(value, format) {
|
|
|
161
161
|
return formattedValue;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
var date =
|
|
164
|
+
var date = dayjs(value);
|
|
165
165
|
if (!date.isValid()) return value;
|
|
166
166
|
|
|
167
167
|
switch (format) {
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.84beta1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "0.0.9",
|
|
7
|
-
"@seafile/seafile-calendar": "0.0.
|
|
7
|
+
"@seafile/seafile-calendar": "^0.0.19",
|
|
8
8
|
"antd-mobile": "^2.3.3",
|
|
9
9
|
"astro-classname": "^2.1.0",
|
|
10
10
|
"bail": "1.0.5",
|
|
11
|
+
"dayjs": "^1.10.7",
|
|
11
12
|
"deepmerge": "^2.1.0",
|
|
12
13
|
"enzyme": "^3.11.0",
|
|
13
14
|
"enzyme-adapter-react-16": "^1.15.2",
|
|
@@ -15,7 +16,6 @@
|
|
|
15
16
|
"hast-util-sanitize": "^1.1.2",
|
|
16
17
|
"hast-util-to-html": "3.1.0",
|
|
17
18
|
"is-hotkey": "^0.1.6",
|
|
18
|
-
"moment": "^2.26.0",
|
|
19
19
|
"react": "16.14.0",
|
|
20
20
|
"react-app-polyfill": "^1.0.6",
|
|
21
21
|
"react-dom": "16.14.0",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"remark-rehype": "^3.0.0",
|
|
32
32
|
"remark-slug": "^5.0.0",
|
|
33
33
|
"trough": "1.0.5",
|
|
34
|
-
"
|
|
34
|
+
"vfile": "2.3.0",
|
|
35
35
|
"x-is-string": "0.1.0",
|
|
36
|
-
"
|
|
36
|
+
"xtend": "^4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"clean:esm": "rm -rf es && mkdir es",
|