dtable-ui-component 6.0.38 → 6.0.39-al63
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/DTableFiltersPopover/widgets/filter-calendar.js +24 -7
- package/lib/DateEditor/mb-editor/index.js +3 -2
- package/lib/DateEditor/pc-editor.js +2 -1
- package/lib/DateFormatter/index.js +2 -2
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +3 -0
- package/lib/InputItem/custom-input.js +3 -1
- package/lib/utils/dateFormat.js +238 -0
- package/package.json +2 -2
|
@@ -14,6 +14,7 @@ var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar
|
|
|
14
14
|
var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
|
|
15
15
|
var _lang = require("../../lang");
|
|
16
16
|
var _columnUtils = require("../../utils/column-utils");
|
|
17
|
+
var _dateFormat = require("../../utils/dateFormat.js");
|
|
17
18
|
require("@seafile/seafile-calendar/assets/index.css");
|
|
18
19
|
let now = (0, _dayjs.default)();
|
|
19
20
|
class FilterCalendar extends _react.Component {
|
|
@@ -26,12 +27,18 @@ class FilterCalendar extends _react.Component {
|
|
|
26
27
|
const {
|
|
27
28
|
onChange
|
|
28
29
|
} = this.props;
|
|
29
|
-
const searchFormat =
|
|
30
|
+
const searchFormat = this.columnDataFormat;
|
|
30
31
|
this.setState({
|
|
31
32
|
value
|
|
32
33
|
}, () => {
|
|
33
34
|
if (this.state.value) {
|
|
34
|
-
|
|
35
|
+
console.log('value', this.state.value);
|
|
36
|
+
const filterStr = this.state.value.format(this.getCalendarFormat()[0]);
|
|
37
|
+
if (typeof filterStr === 'string') {
|
|
38
|
+
const changeVal = (0, _dateFormat.filterChangeValue)(filterStr, searchFormat);
|
|
39
|
+
console.log('changeVal', changeVal);
|
|
40
|
+
onChange(changeVal);
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
});
|
|
37
44
|
};
|
|
@@ -85,6 +92,9 @@ class FilterCalendar extends _react.Component {
|
|
|
85
92
|
this.columnDataFormat = DataFormat.split(' ')[0];
|
|
86
93
|
this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
|
|
87
94
|
this.defaultCalendarValue = null;
|
|
95
|
+
this.formatDay = this.props.value ? (0, _dateFormat.getDay)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
96
|
+
this.formatMonth = this.props.value ? (0, _dateFormat.getMonth)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
97
|
+
this.formatYear = this.props.value ? (0, _dateFormat.getYear)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
88
98
|
}
|
|
89
99
|
componentDidMount() {
|
|
90
100
|
const {
|
|
@@ -92,6 +102,9 @@ class FilterCalendar extends _react.Component {
|
|
|
92
102
|
lang
|
|
93
103
|
} = this.props;
|
|
94
104
|
const iszhcn = lang === 'zh-cn';
|
|
105
|
+
console.log('formatDay', this.formatDay);
|
|
106
|
+
console.log('formatMonth', this.formatMonth);
|
|
107
|
+
console.log('formatYear', this.formatYear);
|
|
95
108
|
if (iszhcn) {
|
|
96
109
|
now = now.locale('zh-cn');
|
|
97
110
|
} else {
|
|
@@ -101,7 +114,7 @@ class FilterCalendar extends _react.Component {
|
|
|
101
114
|
if (value && (0, _dayjs.default)(value).isValid()) {
|
|
102
115
|
let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
|
|
103
116
|
this.setState({
|
|
104
|
-
value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
|
|
117
|
+
value: iszhcn ? (0, _dayjs.default)(validValue).year(this.formatYear).month(this.formatMonth).date(this.formatDay).locale('zh-cn') : (0, _dayjs.default)(validValue).year(this.formatYear).month(this.formatMonth).date(this.formatDay).locale('en-gb')
|
|
105
118
|
});
|
|
106
119
|
}
|
|
107
120
|
}
|
|
@@ -111,12 +124,16 @@ class FilterCalendar extends _react.Component {
|
|
|
111
124
|
firstDayOfWeek
|
|
112
125
|
} = this.props;
|
|
113
126
|
const state = this.state;
|
|
127
|
+
const calendarFormat = this.getCalendarFormat();
|
|
128
|
+
const inputStr = state.value ? state.value.format(this.columnDataFormat) : '';
|
|
129
|
+
const displayContentValue = (0, _dateFormat.renderFilterInputFormat)(inputStr, calendarFormat[0], (0, _dateFormat.delimate)(calendarFormat[0]));
|
|
114
130
|
if (isReadOnly) return /*#__PURE__*/_react.default.createElement("input", {
|
|
115
131
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
116
|
-
value:
|
|
132
|
+
value: displayContentValue,
|
|
117
133
|
disabled: true
|
|
118
134
|
});
|
|
119
|
-
const
|
|
135
|
+
const calendarFormat1 = ['YYYY-MM-DD'];
|
|
136
|
+
console.log('calendarFormat', calendarFormat, displayContentValue);
|
|
120
137
|
const clearStyle = {
|
|
121
138
|
position: 'absolute',
|
|
122
139
|
top: '15px',
|
|
@@ -134,7 +151,7 @@ class FilterCalendar extends _react.Component {
|
|
|
134
151
|
style: {
|
|
135
152
|
zIndex: 1001
|
|
136
153
|
},
|
|
137
|
-
format:
|
|
154
|
+
format: calendarFormat1,
|
|
138
155
|
defaultValue: this.defaultCalendarValue,
|
|
139
156
|
showDateInput: true,
|
|
140
157
|
focusablePanel: false,
|
|
@@ -165,7 +182,7 @@ class FilterCalendar extends _react.Component {
|
|
|
165
182
|
tabIndex: "-1",
|
|
166
183
|
readOnly: true,
|
|
167
184
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
168
|
-
value:
|
|
185
|
+
value: displayContentValue,
|
|
169
186
|
onMouseDown: this.handleMouseDown
|
|
170
187
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
171
188
|
ref: this.calendarContainerRef
|
|
@@ -76,10 +76,11 @@ class MBDateEditor extends _react.default.PureComponent {
|
|
|
76
76
|
const {
|
|
77
77
|
time
|
|
78
78
|
} = this.state;
|
|
79
|
+
const calanderFormat = Array.of(this.format);
|
|
79
80
|
const calendar = /*#__PURE__*/_react.default.createElement(_seafileCalendar.default, {
|
|
80
81
|
className: (0, _classnames.default)('dtable-rc-calendar', className),
|
|
81
82
|
locale: (0, _editorUtils.initDateEditorLanguage)(lang),
|
|
82
|
-
format:
|
|
83
|
+
format: calanderFormat,
|
|
83
84
|
defaultValue: this.defaultCalendarValue,
|
|
84
85
|
showDateInput: false,
|
|
85
86
|
focusablePanel: false,
|
|
@@ -189,7 +190,7 @@ class MBDateEditor extends _react.default.PureComponent {
|
|
|
189
190
|
onChange: this.handleDateChange
|
|
190
191
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
191
192
|
className: "date-input-day"
|
|
192
|
-
},
|
|
193
|
+
}, 'gzc'))), showHourAndMinute && /*#__PURE__*/_react.default.createElement("div", {
|
|
193
194
|
className: "date-input",
|
|
194
195
|
style: {
|
|
195
196
|
width: '50%'
|
|
@@ -143,13 +143,14 @@ class PCDateEditor extends _react.default.Component {
|
|
|
143
143
|
} = this.props;
|
|
144
144
|
let defaultValue = (0, _dayjs.default)().clone();
|
|
145
145
|
const defaultTime = this.getDefaultTime();
|
|
146
|
+
const calanderFormat = Array.isArray(dateFormat) ? dateFormat : Array.of(dateFormat);
|
|
146
147
|
return /*#__PURE__*/_react.default.createElement(_seafileCalendar.default, {
|
|
147
148
|
className: (0, _classnames.default)('dtable-rc-calendar', className),
|
|
148
149
|
locale: (0, _editorUtils.initDateEditorLanguage)(lang),
|
|
149
150
|
style: {
|
|
150
151
|
zIndex: 1001
|
|
151
152
|
},
|
|
152
|
-
format:
|
|
153
|
+
format: calanderFormat,
|
|
153
154
|
defaultValue: defaultValue,
|
|
154
155
|
showHourAndMinute: showHourAndMinute,
|
|
155
156
|
defaultMinutesTime: defaultTime,
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
10
|
+
var _dateFormat = require("../utils/dateFormat.js");
|
|
11
11
|
require("./index.css");
|
|
12
12
|
class DateFormatter extends _react.default.Component {
|
|
13
13
|
render() {
|
|
@@ -18,7 +18,7 @@ class DateFormatter extends _react.default.Component {
|
|
|
18
18
|
} = this.props;
|
|
19
19
|
let classname = (0, _classnames.default)('dtable-ui cell-formatter-container date-formatter', containerClassName);
|
|
20
20
|
if (date !== '') {
|
|
21
|
-
date = (0,
|
|
21
|
+
date = (0, _dateFormat.renderDisplayContent)(date, format, (0, _dateFormat.delimate)(format));
|
|
22
22
|
}
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
24
24
|
title: date,
|
|
@@ -262,7 +262,9 @@ class NumberInput extends React.Component {
|
|
|
262
262
|
getContainer: () => this.getContainer()
|
|
263
263
|
}, this.getComponent());
|
|
264
264
|
} else {
|
|
265
|
-
|
|
265
|
+
const container = this.getContainer();
|
|
266
|
+
const root = ReactDOM.createRoot(container);
|
|
267
|
+
root.render(this.getComponent());
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
270
|
renderPortal() {
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.currentYear = exports.currentTime = exports.DATE_FORMATS = void 0;
|
|
8
|
+
exports.delimate = delimate;
|
|
9
|
+
exports.filterChangeValue = filterChangeValue;
|
|
10
|
+
exports.formatDateLocal = formatDateLocal;
|
|
11
|
+
exports.fullValidYear = fullValidYear;
|
|
12
|
+
exports.getDay = getDay;
|
|
13
|
+
exports.getMonth = getMonth;
|
|
14
|
+
exports.getYear = getYear;
|
|
15
|
+
exports.renderDisplayContent = renderDisplayContent;
|
|
16
|
+
exports.renderFilterInputFormat = renderFilterInputFormat;
|
|
17
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
18
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
|
19
|
+
_dayjs.default.extend(_utc.default);
|
|
20
|
+
const currentTime = exports.currentTime = (0, _dayjs.default)().format('HH:mm');
|
|
21
|
+
const currentYear = exports.currentYear = (0, _dayjs.default)().year();
|
|
22
|
+
const DATE_FORMATS = exports.DATE_FORMATS = {
|
|
23
|
+
ISO: 'yyyy-mm-dd',
|
|
24
|
+
ISOAndTime: 'yyyy-mm-dd hh:mm',
|
|
25
|
+
US: 'm/d/yyyy',
|
|
26
|
+
USAndTime: 'm/d/yyyy hh:mm',
|
|
27
|
+
European: 'dd/mm/yyyy',
|
|
28
|
+
EuropeanAndTime: 'dd/mm/yyyy hh:mm',
|
|
29
|
+
Germany_Russia_etc: 'dd.mm.yyyy',
|
|
30
|
+
Germany_Russia_etcAndTime: 'dd.mm.yyyy hh:mm'
|
|
31
|
+
};
|
|
32
|
+
function fullValidYear(yearStr) {
|
|
33
|
+
const year = yearStr;
|
|
34
|
+
if (!year || isNaN(year)) return currentYear;
|
|
35
|
+
if (year.length === 2) {
|
|
36
|
+
if (Number(year) >= 0 && Number(year) < 69) {
|
|
37
|
+
return year ? "20".concat(year) : currentYear;
|
|
38
|
+
} else if (Number(year) >= 69 && Number(year) < 100) {
|
|
39
|
+
return year ? "19".concat(year) : currentYear;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (year.length === 4) {
|
|
43
|
+
return year;
|
|
44
|
+
}
|
|
45
|
+
return year ? year.padStart(4, '0') : currentYear;
|
|
46
|
+
}
|
|
47
|
+
function formatDateLocal(formatStr, localeFormat) {
|
|
48
|
+
const str = formatStr || '';
|
|
49
|
+
const format = String(localeFormat).toLowerCase();
|
|
50
|
+
let cleanStr;
|
|
51
|
+
switch (format) {
|
|
52
|
+
case DATE_FORMATS.ISO:
|
|
53
|
+
case DATE_FORMATS.ISOAndTime:
|
|
54
|
+
cleanStr = str.replace(/[^0-9]+/g, '-');
|
|
55
|
+
return cleanStr.split('-').filter(Boolean).map(String);
|
|
56
|
+
case DATE_FORMATS.US:
|
|
57
|
+
case DATE_FORMATS.USAndTime:
|
|
58
|
+
case DATE_FORMATS.European:
|
|
59
|
+
case DATE_FORMATS.EuropeanAndTime:
|
|
60
|
+
cleanStr = str.replace(/[^0-9]+/g, '/');
|
|
61
|
+
return cleanStr.split('/').filter(Boolean).map(String);
|
|
62
|
+
case DATE_FORMATS.Germany_Russia_etc:
|
|
63
|
+
case DATE_FORMATS.Germany_Russia_etcAndTime:
|
|
64
|
+
cleanStr = str.replace(/[^0-9]+/g, '.');
|
|
65
|
+
return cleanStr.split('.').filter(Boolean).map(String);
|
|
66
|
+
default:
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function delimate(localeFormat) {
|
|
71
|
+
const formatPrefix = String(localeFormat).toLowerCase();
|
|
72
|
+
let delimiter;
|
|
73
|
+
if (formatPrefix === DATE_FORMATS.Germany_Russia_etc || formatPrefix === DATE_FORMATS.Germany_Russia_etcAndTime) {
|
|
74
|
+
delimiter = '.';
|
|
75
|
+
} else if (formatPrefix === DATE_FORMATS.ISO || formatPrefix === DATE_FORMATS.ISOAndTime) {
|
|
76
|
+
delimiter = '-';
|
|
77
|
+
} else {
|
|
78
|
+
delimiter = '/';
|
|
79
|
+
}
|
|
80
|
+
return delimiter;
|
|
81
|
+
}
|
|
82
|
+
function renderDisplayContent(str, localeFormat, delimiter) {
|
|
83
|
+
const format = String(localeFormat).toLowerCase();
|
|
84
|
+
const parts = formatDateLocal(str, localeFormat);
|
|
85
|
+
if (parts.length < 3) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
let day = parts[2];
|
|
89
|
+
let month = parts[1];
|
|
90
|
+
let year = String(fullValidYear(parts[0])).padStart(4, '0');
|
|
91
|
+
let time = "".concat(parts[3], ":").concat(parts[4]) || currentTime;
|
|
92
|
+
if (format === DATE_FORMATS.ISO) {
|
|
93
|
+
return "".concat(year).concat(delimiter).concat(month).concat(delimiter).concat(day);
|
|
94
|
+
}
|
|
95
|
+
if (format === DATE_FORMATS.ISOAndTime) {
|
|
96
|
+
return "".concat(year).concat(delimiter).concat(month).concat(delimiter).concat(day, " ").concat(time);
|
|
97
|
+
}
|
|
98
|
+
if (format === DATE_FORMATS.US) {
|
|
99
|
+
return "".concat(Number(month)).concat(delimiter).concat(Number(day)).concat(delimiter).concat(year);
|
|
100
|
+
}
|
|
101
|
+
if (format === DATE_FORMATS.USAndTime) {
|
|
102
|
+
return "".concat(Number(month)).concat(delimiter).concat(Number(day)).concat(delimiter).concat(year, " ").concat(time);
|
|
103
|
+
}
|
|
104
|
+
if (format === DATE_FORMATS.European || format === DATE_FORMATS.Germany_Russia_etc) {
|
|
105
|
+
return "".concat(Number(day)).concat(delimiter).concat(Number(month)).concat(delimiter).concat(year);
|
|
106
|
+
}
|
|
107
|
+
if (format === DATE_FORMATS.EuropeanAndTime || format === DATE_FORMATS.Germany_Russia_etcAndTime) {
|
|
108
|
+
return "".concat(Number(day)).concat(delimiter).concat(Number(month)).concat(delimiter).concat(year, " ").concat(time);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function renderFilterInputFormat(str, localeFormat, delimiter) {
|
|
112
|
+
const format = String(localeFormat).toLowerCase();
|
|
113
|
+
const parts = formatDateLocal(str, localeFormat);
|
|
114
|
+
// console.log('parts', str, parts);
|
|
115
|
+
if (parts.length < 3) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
let day;
|
|
119
|
+
let month;
|
|
120
|
+
let year;
|
|
121
|
+
let time = "".concat(parts[3], ":").concat(parts[4]) || currentTime;
|
|
122
|
+
if (format === DATE_FORMATS.ISO) {
|
|
123
|
+
day = parts[2];
|
|
124
|
+
month = parts[1];
|
|
125
|
+
year = String(fullValidYear(parts[0])).padStart(4, '0');
|
|
126
|
+
return "".concat(year).concat(delimiter).concat(month).concat(delimiter).concat(day);
|
|
127
|
+
}
|
|
128
|
+
if (format === DATE_FORMATS.ISOAndTime) {
|
|
129
|
+
day = parts[2];
|
|
130
|
+
month = parts[1];
|
|
131
|
+
year = String(fullValidYear(parts[0])).padStart(4, '0');
|
|
132
|
+
return "".concat(year).concat(delimiter).concat(month).concat(delimiter).concat(day, " ").concat(time);
|
|
133
|
+
}
|
|
134
|
+
if (format === DATE_FORMATS.US) {
|
|
135
|
+
day = parts[1];
|
|
136
|
+
month = parts[0];
|
|
137
|
+
year = String(fullValidYear(parts[2])).padStart(4, '0');
|
|
138
|
+
return "".concat(Number(month)).concat(delimiter).concat(Number(day)).concat(delimiter).concat(year);
|
|
139
|
+
}
|
|
140
|
+
if (format === DATE_FORMATS.USAndTime) {
|
|
141
|
+
day = parts[1];
|
|
142
|
+
month = parts[0];
|
|
143
|
+
year = String(fullValidYear(parts[2])).padStart(4, '0');
|
|
144
|
+
return "".concat(Number(month)).concat(delimiter).concat(Number(day)).concat(delimiter).concat(year, " ").concat(time);
|
|
145
|
+
}
|
|
146
|
+
if (format === DATE_FORMATS.European || format === DATE_FORMATS.Germany_Russia_etc) {
|
|
147
|
+
day = parts[0];
|
|
148
|
+
month = parts[1];
|
|
149
|
+
year = String(fullValidYear(parts[2])).padStart(4, '0');
|
|
150
|
+
return "".concat(Number(day)).concat(delimiter).concat(Number(month)).concat(delimiter).concat(year);
|
|
151
|
+
}
|
|
152
|
+
if (format === DATE_FORMATS.EuropeanAndTime || format === DATE_FORMATS.Germany_Russia_etcAndTime) {
|
|
153
|
+
day = parts[0];
|
|
154
|
+
month = parts[1];
|
|
155
|
+
year = String(fullValidYear(parts[2])).padStart(4, '0');
|
|
156
|
+
return "".concat(Number(day)).concat(delimiter).concat(Number(month)).concat(delimiter).concat(year, " ").concat(time);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function filterChangeValue(str, localeFormat) {
|
|
160
|
+
const format = String(localeFormat).toLowerCase();
|
|
161
|
+
const parts = formatDateLocal(str, format);
|
|
162
|
+
if (parts.length < 3) {
|
|
163
|
+
return '';
|
|
164
|
+
}
|
|
165
|
+
let day;
|
|
166
|
+
let month;
|
|
167
|
+
let year;
|
|
168
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
169
|
+
day = parts[2];
|
|
170
|
+
month = parts[1];
|
|
171
|
+
year = fullValidYear(parts[0]);
|
|
172
|
+
}
|
|
173
|
+
if (format === DATE_FORMATS.US || format === DATE_FORMATS.USAndTime) {
|
|
174
|
+
day = parts[1];
|
|
175
|
+
month = parts[0];
|
|
176
|
+
year = fullValidYear(parts[2]);
|
|
177
|
+
}
|
|
178
|
+
if (format === DATE_FORMATS.European || format === DATE_FORMATS.Germany_Russia_etc || format === DATE_FORMATS.EuropeanAndTime || format === DATE_FORMATS.Germany_Russia_etcAndTime) {
|
|
179
|
+
day = parts[0];
|
|
180
|
+
month = parts[1];
|
|
181
|
+
year = fullValidYear(parts[2]);
|
|
182
|
+
}
|
|
183
|
+
return "".concat(String(year).padStart(4, '0'), "-").concat(String(month).padStart(2, '0'), "-").concat(String(day).padStart(2, '0'));
|
|
184
|
+
}
|
|
185
|
+
function getDay(str, localeFormat, mode) {
|
|
186
|
+
const format = String(localeFormat).toLowerCase();
|
|
187
|
+
const parts = formatDateLocal(str, format);
|
|
188
|
+
if (parts.length < 3) {
|
|
189
|
+
return '';
|
|
190
|
+
}
|
|
191
|
+
if (!mode) {
|
|
192
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
193
|
+
return String(parts[2]).padStart(2, '0');
|
|
194
|
+
}
|
|
195
|
+
return String(Number(parts[2]));
|
|
196
|
+
}
|
|
197
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
198
|
+
return String(parts[2]).padStart(2, '0');
|
|
199
|
+
}
|
|
200
|
+
if (format === DATE_FORMATS.US || format === DATE_FORMATS.USAndTime) {
|
|
201
|
+
return String(Number(parts[1]));
|
|
202
|
+
}
|
|
203
|
+
return String(Number(parts[0]));
|
|
204
|
+
}
|
|
205
|
+
function getMonth(str, localeFormat, mode) {
|
|
206
|
+
const format = String(localeFormat).toLowerCase();
|
|
207
|
+
const parts = formatDateLocal(str, format);
|
|
208
|
+
if (parts.length < 3) {
|
|
209
|
+
return '';
|
|
210
|
+
}
|
|
211
|
+
if (!mode) {
|
|
212
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
213
|
+
return String(Number(parts[1]) - 1).padStart(2, '0');
|
|
214
|
+
}
|
|
215
|
+
return String(Number(parts[1]) - 1);
|
|
216
|
+
}
|
|
217
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
218
|
+
return String(Number(parts[1]) - 1).padStart(2, '0');
|
|
219
|
+
}
|
|
220
|
+
if (format === DATE_FORMATS.US || format === DATE_FORMATS.USAndTime) {
|
|
221
|
+
return String(Number(parts[0]) - 1);
|
|
222
|
+
}
|
|
223
|
+
return String(Number(parts[1]) - 1);
|
|
224
|
+
}
|
|
225
|
+
function getYear(str, localeFormat, mode) {
|
|
226
|
+
const format = String(localeFormat).toLowerCase();
|
|
227
|
+
const parts = formatDateLocal(str, format);
|
|
228
|
+
if (parts.length < 3) {
|
|
229
|
+
return '';
|
|
230
|
+
}
|
|
231
|
+
if (!mode) {
|
|
232
|
+
return String(fullValidYear(parts[0])).padStart(4, '0');
|
|
233
|
+
}
|
|
234
|
+
if (format === DATE_FORMATS.ISO || format === DATE_FORMATS.ISOAndTime) {
|
|
235
|
+
return String(fullValidYear(parts[0])).padStart(4, '0');
|
|
236
|
+
}
|
|
237
|
+
return String(fullValidYear(parts[2])).padStart(4, '0');
|
|
238
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.39-al63",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "4.0.2",
|
|
7
|
-
"@seafile/seafile-calendar": "0.0.29",
|
|
7
|
+
"@seafile/seafile-calendar": "^0.0.29-alpha79",
|
|
8
8
|
"@seafile/seafile-editor": "~2.0.6",
|
|
9
9
|
"classnames": "2.3.2",
|
|
10
10
|
"dayjs": "1.10.7",
|