dtable-ui-component 0.1.81 → 0.1.83
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/MTimeFormatter/index.js +2 -2
- package/lib/RateFormatter/index.js +4 -2
- package/lib/index.js +1 -0
- 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;
|
|
@@ -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;
|
|
@@ -31,7 +31,9 @@ var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
31
31
|
_ref$rate_max_number = _ref.rate_max_number,
|
|
32
32
|
rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
|
|
33
33
|
_ref$rate_style_color = _ref.rate_style_color,
|
|
34
|
-
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color
|
|
34
|
+
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color,
|
|
35
|
+
_ref$rate_style_type = _ref.rate_style_type,
|
|
36
|
+
rate_style_type = _ref$rate_style_type === void 0 ? 'dtable-icon-rate' : _ref$rate_style_type;
|
|
35
37
|
|
|
36
38
|
var validValue = Math.min(rate_max_number, value);
|
|
37
39
|
var rateList = [];
|
|
@@ -39,7 +41,7 @@ var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
39
41
|
for (var i = 0; i < validValue; i++) {
|
|
40
42
|
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
41
43
|
key: "dtable-ui-component-rate-".concat(i),
|
|
42
|
-
className: "dtable-font
|
|
44
|
+
className: "dtable-font ".concat(rate_style_type),
|
|
43
45
|
style: {
|
|
44
46
|
color: rate_style_color || '#e5e5e5'
|
|
45
47
|
}
|
package/lib/index.js
CHANGED
|
@@ -12,6 +12,7 @@ export { default as LongTextFormatter } from './LongTextFormatter';
|
|
|
12
12
|
export { default as TextFormatter } from './TextFormatter';
|
|
13
13
|
export { default as SingleSelectFormatter } from './SingleSelectFormatter';
|
|
14
14
|
export { default as MultipleSelectFormatter } from './MultipleSelectFormatter';
|
|
15
|
+
export { default as SelectItem } from './SelectItem';
|
|
15
16
|
export { default as FileFormatter } from './FileFormatter';
|
|
16
17
|
export { default as LinkFormatter } from './LinkFormatter';
|
|
17
18
|
export { default as CollaboratorFormatter } from './CollaboratorFormatter';
|
|
@@ -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.83",
|
|
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.18",
|
|
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",
|