dtable-ui-component 6.0.39-alphaG21 → 6.0.39-gzc33
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.
|
@@ -14,7 +14,6 @@ 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");
|
|
18
17
|
require("@seafile/seafile-calendar/assets/index.css");
|
|
19
18
|
let now = (0, _dayjs.default)();
|
|
20
19
|
class FilterCalendar extends _react.Component {
|
|
@@ -27,18 +26,12 @@ class FilterCalendar extends _react.Component {
|
|
|
27
26
|
const {
|
|
28
27
|
onChange
|
|
29
28
|
} = this.props;
|
|
30
|
-
const searchFormat =
|
|
29
|
+
const searchFormat = 'YYYY-MM-DD';
|
|
31
30
|
this.setState({
|
|
32
31
|
value
|
|
33
32
|
}, () => {
|
|
34
33
|
if (this.state.value) {
|
|
35
|
-
|
|
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
|
-
}
|
|
34
|
+
onChange(this.state.value.format(searchFormat));
|
|
42
35
|
}
|
|
43
36
|
});
|
|
44
37
|
};
|
|
@@ -92,9 +85,6 @@ class FilterCalendar extends _react.Component {
|
|
|
92
85
|
this.columnDataFormat = DataFormat.split(' ')[0];
|
|
93
86
|
this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
|
|
94
87
|
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;
|
|
98
88
|
}
|
|
99
89
|
componentDidMount() {
|
|
100
90
|
const {
|
|
@@ -102,9 +92,6 @@ class FilterCalendar extends _react.Component {
|
|
|
102
92
|
lang
|
|
103
93
|
} = this.props;
|
|
104
94
|
const iszhcn = lang === 'zh-cn';
|
|
105
|
-
console.log('formatDay', this.formatDay);
|
|
106
|
-
console.log('formatMonth', this.formatMonth);
|
|
107
|
-
console.log('formatYear', this.formatYear);
|
|
108
95
|
if (iszhcn) {
|
|
109
96
|
now = now.locale('zh-cn');
|
|
110
97
|
} else {
|
|
@@ -114,7 +101,7 @@ class FilterCalendar extends _react.Component {
|
|
|
114
101
|
if (value && (0, _dayjs.default)(value).isValid()) {
|
|
115
102
|
let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
|
|
116
103
|
this.setState({
|
|
117
|
-
value: iszhcn ? (0, _dayjs.default)(validValue).
|
|
104
|
+
value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
|
|
118
105
|
});
|
|
119
106
|
}
|
|
120
107
|
}
|
|
@@ -124,16 +111,12 @@ class FilterCalendar extends _react.Component {
|
|
|
124
111
|
firstDayOfWeek
|
|
125
112
|
} = this.props;
|
|
126
113
|
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]));
|
|
130
114
|
if (isReadOnly) return /*#__PURE__*/_react.default.createElement("input", {
|
|
131
115
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
132
|
-
value:
|
|
116
|
+
value: state.value ? state.value.format(this.columnDataFormat) : '',
|
|
133
117
|
disabled: true
|
|
134
118
|
});
|
|
135
|
-
const
|
|
136
|
-
console.log('calendarFormat', calendarFormat, displayContentValue);
|
|
119
|
+
const calendarFormat = this.getCalendarFormat();
|
|
137
120
|
const clearStyle = {
|
|
138
121
|
position: 'absolute',
|
|
139
122
|
top: '15px',
|
|
@@ -151,7 +134,8 @@ class FilterCalendar extends _react.Component {
|
|
|
151
134
|
style: {
|
|
152
135
|
zIndex: 1001
|
|
153
136
|
},
|
|
154
|
-
|
|
137
|
+
dateInputPlaceholder: calendarFormat[0],
|
|
138
|
+
format: calendarFormat,
|
|
155
139
|
defaultValue: this.defaultCalendarValue,
|
|
156
140
|
showDateInput: true,
|
|
157
141
|
focusablePanel: false,
|
|
@@ -182,7 +166,7 @@ class FilterCalendar extends _react.Component {
|
|
|
182
166
|
tabIndex: "-1",
|
|
183
167
|
readOnly: true,
|
|
184
168
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
185
|
-
value:
|
|
169
|
+
value: value ? value.format(this.columnDataFormat) : '',
|
|
186
170
|
onMouseDown: this.handleMouseDown
|
|
187
171
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
188
172
|
ref: this.calendarContainerRef
|