dtable-ui-component 6.0.39-alpha43 → 6.0.39-alpha95

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.
@@ -19,7 +19,7 @@ var _constants = require("../constants");
19
19
  var _lang = require("../lang");
20
20
  require("./index.css");
21
21
  /**
22
- * filter = {
22
+ * filter222 = {
23
23
  * column_key: '',
24
24
  * filter_predicate: '',
25
25
  * filter_term: '',
@@ -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,16 @@ 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
  }, () => {
33
34
  if (this.state.value) {
34
- onChange(this.state.value.format(searchFormat));
35
+ const filterStr = this.state.value.format(this.getCalendarFormat()[0]);
36
+ if (typeof filterStr === 'string') {
37
+ const changeVal = (0, _dateFormat.filterChangeValue)(filterStr, searchFormat);
38
+ onChange(changeVal);
39
+ }
35
40
  }
36
41
  });
37
42
  };
@@ -85,6 +90,9 @@ class FilterCalendar extends _react.Component {
85
90
  this.columnDataFormat = DataFormat.split(' ')[0];
86
91
  this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
87
92
  this.defaultCalendarValue = null;
93
+ this.formatDay = this.props.value ? (0, _dateFormat.getDay)(this.props.value, this.getCalendarFormat()[0]) : null;
94
+ this.formatMonth = this.props.value ? (0, _dateFormat.getMonth)(this.props.value, this.getCalendarFormat()[0]) : null;
95
+ this.formatYear = this.props.value ? (0, _dateFormat.getYear)(this.props.value, this.getCalendarFormat()[0]) : null;
88
96
  }
89
97
  componentDidMount() {
90
98
  const {
@@ -92,6 +100,7 @@ class FilterCalendar extends _react.Component {
92
100
  lang
93
101
  } = this.props;
94
102
  const iszhcn = lang === 'zh-cn';
103
+ console.log('12222222');
95
104
  if (iszhcn) {
96
105
  now = now.locale('zh-cn');
97
106
  } else {
@@ -101,7 +110,7 @@ class FilterCalendar extends _react.Component {
101
110
  if (value && (0, _dayjs.default)(value).isValid()) {
102
111
  let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
103
112
  this.setState({
104
- value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
113
+ 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
114
  });
106
115
  }
107
116
  }
@@ -111,12 +120,16 @@ class FilterCalendar extends _react.Component {
111
120
  firstDayOfWeek
112
121
  } = this.props;
113
122
  const state = this.state;
123
+ const inputStr = state.value ? state.value.format(this.columnDataFormat) : '';
124
+ const displayContentValue = (0, _dateFormat.renderFilterInputFormat)(inputStr, this.columnDataFormat, (0, _dateFormat.delimate)(this.columnDataFormat));
114
125
  if (isReadOnly) return /*#__PURE__*/_react.default.createElement("input", {
115
126
  className: "ant-calendar-picker-input ant-input form-control",
116
- value: state.value ? state.value.format(this.columnDataFormat) : '',
127
+ value: displayContentValue,
117
128
  disabled: true
118
129
  });
119
130
  const calendarFormat = this.getCalendarFormat();
131
+ const calendarFormat1 = ['YYYY-MM-DD'];
132
+ console.log('calendarFormat', calendarFormat);
120
133
  const clearStyle = {
121
134
  position: 'absolute',
122
135
  top: '15px',
@@ -134,7 +147,7 @@ class FilterCalendar extends _react.Component {
134
147
  style: {
135
148
  zIndex: 1001
136
149
  },
137
- format: calendarFormat,
150
+ format: calendarFormat1,
138
151
  defaultValue: this.defaultCalendarValue,
139
152
  showDateInput: true,
140
153
  focusablePanel: false,
@@ -165,7 +178,7 @@ class FilterCalendar extends _react.Component {
165
178
  tabIndex: "-1",
166
179
  readOnly: true,
167
180
  className: "ant-calendar-picker-input ant-input form-control",
168
- value: value ? value.format(this.columnDataFormat) : '',
181
+ value: displayContentValue,
169
182
  onMouseDown: this.handleMouseDown
170
183
  }), /*#__PURE__*/_react.default.createElement("div", {
171
184
  ref: this.calendarContainerRef
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.currentYear = exports.currentTime = exports.DATE_FORMATS = void 0;
8
8
  exports.delimate = delimate;
9
+ exports.filterChangeValue = filterChangeValue;
9
10
  exports.formatDateLocal = formatDateLocal;
10
11
  exports.fullValidYear = fullValidYear;
11
12
  exports.getDay = getDay;
@@ -155,6 +156,32 @@ function renderFilterInputFormat(str, localeFormat, delimiter) {
155
156
  return "".concat(Number(day)).concat(delimiter).concat(Number(month)).concat(delimiter).concat(year, " ").concat(time);
156
157
  }
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
+ }
158
185
  function getDay(str, localeFormat, mode) {
159
186
  const format = String(localeFormat).toLowerCase();
160
187
  const parts = formatDateLocal(str, format);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.39-alpha43",
3
+ "version": "6.0.39-alpha95",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "4.0.2",