dtable-ui-component 6.0.39-gzc33 → 6.0.39-gzc40

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,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 = 'YYYY-MM-DD';
30
+ const searchFormat = this.columnDataFormat;
30
31
  this.setState({
31
32
  value
32
33
  }, () => {
34
+ console.log(111);
33
35
  if (this.state.value) {
34
- onChange(this.state.value.format(searchFormat));
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 {
@@ -100,8 +110,9 @@ class FilterCalendar extends _react.Component {
100
110
  this.defaultCalendarValue = now.clone();
101
111
  if (value && (0, _dayjs.default)(value).isValid()) {
102
112
  let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
113
+ console.log('validValue', validValue);
103
114
  this.setState({
104
- value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
115
+ 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
116
  });
106
117
  }
107
118
  }
@@ -111,9 +122,12 @@ class FilterCalendar extends _react.Component {
111
122
  firstDayOfWeek
112
123
  } = this.props;
113
124
  const state = this.state;
125
+ const inputStr = state.value ? state.value.format(this.columnDataFormat) : '';
126
+ const displayContentValue = (0, _dateFormat.renderFilterInputFormat)(inputStr, this.columnDataFormat, (0, _dateFormat.delimate)(this.columnDataFormat));
127
+ console.log('displayContentValue', displayContentValue);
114
128
  if (isReadOnly) return /*#__PURE__*/_react.default.createElement("input", {
115
129
  className: "ant-calendar-picker-input ant-input form-control",
116
- value: state.value ? state.value.format(this.columnDataFormat) : '',
130
+ value: displayContentValue,
117
131
  disabled: true
118
132
  });
119
133
  const calendarFormat = this.getCalendarFormat();
@@ -134,7 +148,6 @@ class FilterCalendar extends _react.Component {
134
148
  style: {
135
149
  zIndex: 1001
136
150
  },
137
- dateInputPlaceholder: calendarFormat[0],
138
151
  format: calendarFormat,
139
152
  defaultValue: this.defaultCalendarValue,
140
153
  showDateInput: true,
@@ -166,7 +179,7 @@ class FilterCalendar extends _react.Component {
166
179
  tabIndex: "-1",
167
180
  readOnly: true,
168
181
  className: "ant-calendar-picker-input ant-input form-control",
169
- value: value ? value.format(this.columnDataFormat) : '',
182
+ value: displayContentValue,
170
183
  onMouseDown: this.handleMouseDown
171
184
  }), /*#__PURE__*/_react.default.createElement("div", {
172
185
  ref: this.calendarContainerRef
@@ -111,7 +111,6 @@ function renderDisplayContent(str, localeFormat, delimiter) {
111
111
  function renderFilterInputFormat(str, localeFormat, delimiter) {
112
112
  const format = String(localeFormat).toLowerCase();
113
113
  const parts = formatDateLocal(str, localeFormat);
114
- // console.log('parts', str, parts);
115
114
  if (parts.length < 3) {
116
115
  return '';
117
116
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.39-gzc33",
3
+ "version": "6.0.39-gzc40",
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-alpha79",
7
+ "@seafile/seafile-calendar": "^0.0.29-gzc31",
8
8
  "@seafile/seafile-editor": "~2.0.6",
9
9
  "classnames": "2.3.2",
10
10
  "dayjs": "1.10.7",