@gingkoo/pandora-metabase 1.0.104 → 1.0.105
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/cjs/components/dialog/expression/date-format-picker.d.ts +14 -0
- package/lib/cjs/components/dialog/expression/date-format-picker.js +218 -0
- package/lib/cjs/components/dialog/expression/date-format.d.ts +5 -0
- package/lib/cjs/components/dialog/expression/date-format.js +26 -0
- package/lib/cjs/components/dialog/expression/index.js +57 -65
- package/lib/cjs/store/types.d.ts +2 -0
- package/lib/es/components/dialog/expression/date-format-picker.d.ts +14 -0
- package/lib/es/components/dialog/expression/date-format-picker.js +211 -0
- package/lib/es/components/dialog/expression/date-format.d.ts +5 -0
- package/lib/es/components/dialog/expression/date-format.js +20 -0
- package/lib/es/components/dialog/expression/index.js +58 -66
- package/lib/es/store/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DateRangeFormatPickerProps {
|
|
3
|
+
value?: string[];
|
|
4
|
+
format?: string;
|
|
5
|
+
onChange?: (val: string[], format?: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DateRangeFormatPicker: React.FC<DateRangeFormatPickerProps>;
|
|
8
|
+
interface DateFormatPickerProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
format?: string;
|
|
11
|
+
onChange?: (val: string, format?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const DateFormatPicker: React.FC<DateFormatPickerProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DateRangeFormatPicker = exports.DateFormatPicker = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _pandora = require("@gingkoo/pandora");
|
|
12
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
13
|
+
var RangePicker = _pandora.DatePicker.RangePicker,
|
|
14
|
+
YearPicker = _pandora.DatePicker.YearPicker,
|
|
15
|
+
MonthPicker = _pandora.DatePicker.MonthPicker;
|
|
16
|
+
var DATE_FORMAT_OPTIONS = [{
|
|
17
|
+
value: 'YYYY',
|
|
18
|
+
label: 'YYYY'
|
|
19
|
+
}, {
|
|
20
|
+
value: 'YYYY-MM',
|
|
21
|
+
label: 'YYYY-MM'
|
|
22
|
+
}, {
|
|
23
|
+
value: 'YYYY-MM-DD',
|
|
24
|
+
label: 'YYYY-MM-DD'
|
|
25
|
+
}, {
|
|
26
|
+
value: 'YYYY-MM-DD HH:mm',
|
|
27
|
+
label: 'YYYY-MM-DD HH:mm'
|
|
28
|
+
}, {
|
|
29
|
+
value: 'YYYY/MM',
|
|
30
|
+
label: 'YYYY/MM'
|
|
31
|
+
}, {
|
|
32
|
+
value: 'YYYY/MM/DD',
|
|
33
|
+
label: 'YYYY/MM/DD'
|
|
34
|
+
}, {
|
|
35
|
+
value: 'YYYY/MM/DD HH:mm',
|
|
36
|
+
label: 'YYYY/MM/DD HH:mm'
|
|
37
|
+
}];
|
|
38
|
+
var DEFAULT_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
39
|
+
var DateRangeFormatPicker = exports.DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
|
|
40
|
+
var value = _ref.value,
|
|
41
|
+
format = _ref.format,
|
|
42
|
+
onChange = _ref.onChange;
|
|
43
|
+
var _useState = (0, _react.useState)(format || DEFAULT_FORMAT),
|
|
44
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
45
|
+
currentFormat = _useState2[0],
|
|
46
|
+
setCurrentFormat = _useState2[1];
|
|
47
|
+
(0, _react.useEffect)(function () {
|
|
48
|
+
if (format) {
|
|
49
|
+
setCurrentFormat(format);
|
|
50
|
+
}
|
|
51
|
+
}, [format]);
|
|
52
|
+
var showTime = currentFormat.includes('HH:mm');
|
|
53
|
+
// 根据格式确定 RangePicker 的 mode
|
|
54
|
+
var getRangePickerMode = function getRangePickerMode() {
|
|
55
|
+
if (currentFormat === 'YYYY') return 'year';
|
|
56
|
+
if (currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM') return 'month';
|
|
57
|
+
return 'date';
|
|
58
|
+
};
|
|
59
|
+
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
60
|
+
// 切换格式时,用新格式重新格式化当前值
|
|
61
|
+
if (value && value.length > 0) {
|
|
62
|
+
var formattedValues = value.map(function (v) {
|
|
63
|
+
if (!v) return '';
|
|
64
|
+
var parsed = (0, _dayjs["default"])(v);
|
|
65
|
+
if (!parsed.isValid()) return '';
|
|
66
|
+
return parsed.format(newFormat);
|
|
67
|
+
});
|
|
68
|
+
// 只调用 onChange,传递新格式化的值和新格式
|
|
69
|
+
onChange === null || onChange === void 0 || onChange(formattedValues, newFormat);
|
|
70
|
+
}
|
|
71
|
+
setCurrentFormat(newFormat);
|
|
72
|
+
};
|
|
73
|
+
// 将字符串数组转为 dayjs 对象数组,供 RangePicker 使用
|
|
74
|
+
var rangeValue = (value === null || value === void 0 ? void 0 : value.map(function (v) {
|
|
75
|
+
if (!v) return null;
|
|
76
|
+
// 尝试用当前格式解析,失败则用 dayjs 默认解析
|
|
77
|
+
var parsed = (0, _dayjs["default"])(v, currentFormat, true);
|
|
78
|
+
if (parsed.isValid()) return parsed;
|
|
79
|
+
// 尝试不用严格模式解析
|
|
80
|
+
var looseParsed = (0, _dayjs["default"])(v, currentFormat);
|
|
81
|
+
if (looseParsed.isValid()) return looseParsed;
|
|
82
|
+
// 最后尝试不指定格式
|
|
83
|
+
var anyParsed = (0, _dayjs["default"])(v);
|
|
84
|
+
return anyParsed.isValid() ? anyParsed : null;
|
|
85
|
+
})) || undefined;
|
|
86
|
+
var handleRangeChange = function handleRangeChange(date, dateString) {
|
|
87
|
+
// 确保日期值按 currentFormat 格式化
|
|
88
|
+
var formattedValues = (date === null || date === void 0 ? void 0 : date.map(function (d) {
|
|
89
|
+
if (!d || !(0, _dayjs["default"])(d).isValid()) return '';
|
|
90
|
+
return (0, _dayjs["default"])(d).format(currentFormat);
|
|
91
|
+
})) || dateString;
|
|
92
|
+
onChange === null || onChange === void 0 || onChange(formattedValues, currentFormat);
|
|
93
|
+
};
|
|
94
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
95
|
+
style: {
|
|
96
|
+
display: 'flex',
|
|
97
|
+
gap: 4
|
|
98
|
+
},
|
|
99
|
+
children: [(0, _jsxRuntime.jsx)(_pandora.Select, {
|
|
100
|
+
style: {
|
|
101
|
+
width: 120
|
|
102
|
+
},
|
|
103
|
+
value: currentFormat,
|
|
104
|
+
onChange: handleFormatChange,
|
|
105
|
+
children: DATE_FORMAT_OPTIONS.map(function (option) {
|
|
106
|
+
return (0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
107
|
+
value: option.value,
|
|
108
|
+
children: option.label
|
|
109
|
+
}, option.value);
|
|
110
|
+
})
|
|
111
|
+
}), (0, _jsxRuntime.jsx)(RangePicker, {
|
|
112
|
+
value: rangeValue,
|
|
113
|
+
onChange: handleRangeChange,
|
|
114
|
+
style: {
|
|
115
|
+
flex: 1
|
|
116
|
+
},
|
|
117
|
+
format: currentFormat,
|
|
118
|
+
showTime: showTime,
|
|
119
|
+
mode: getRangePickerMode()
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var DateFormatPicker = exports.DateFormatPicker = function DateFormatPicker(_ref2) {
|
|
124
|
+
var value = _ref2.value,
|
|
125
|
+
format = _ref2.format,
|
|
126
|
+
onChange = _ref2.onChange;
|
|
127
|
+
var _useState3 = (0, _react.useState)(format || DEFAULT_FORMAT),
|
|
128
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
129
|
+
currentFormat = _useState4[0],
|
|
130
|
+
setCurrentFormat = _useState4[1];
|
|
131
|
+
(0, _react.useEffect)(function () {
|
|
132
|
+
if (format) {
|
|
133
|
+
setCurrentFormat(format);
|
|
134
|
+
}
|
|
135
|
+
}, [format]);
|
|
136
|
+
var showTime = currentFormat.includes('HH:mm');
|
|
137
|
+
var isYearOnly = currentFormat === 'YYYY';
|
|
138
|
+
var isMonthOnly = currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM';
|
|
139
|
+
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
140
|
+
// 切换格式时,用新格式重新格式化当前值
|
|
141
|
+
if (value) {
|
|
142
|
+
var parsed = (0, _dayjs["default"])(value);
|
|
143
|
+
if (parsed.isValid()) {
|
|
144
|
+
onChange === null || onChange === void 0 || onChange(parsed.format(newFormat), newFormat);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
setCurrentFormat(newFormat);
|
|
148
|
+
};
|
|
149
|
+
// 将字符串转为 dayjs 对象,使用宽松解析
|
|
150
|
+
var dateValue = function () {
|
|
151
|
+
if (!value) return undefined;
|
|
152
|
+
var parsed = (0, _dayjs["default"])(value, currentFormat, true);
|
|
153
|
+
if (parsed.isValid()) return parsed;
|
|
154
|
+
var looseParsed = (0, _dayjs["default"])(value, currentFormat);
|
|
155
|
+
if (looseParsed.isValid()) return looseParsed;
|
|
156
|
+
var anyParsed = (0, _dayjs["default"])(value);
|
|
157
|
+
return anyParsed.isValid() ? anyParsed : undefined;
|
|
158
|
+
}();
|
|
159
|
+
var handleDateChange = function handleDateChange(dateString) {
|
|
160
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
161
|
+
};
|
|
162
|
+
var handleYearChange = function handleYearChange(dateString) {
|
|
163
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
164
|
+
};
|
|
165
|
+
var handleMonthChange = function handleMonthChange(dateString) {
|
|
166
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
167
|
+
};
|
|
168
|
+
// 根据格式渲染不同的选择器
|
|
169
|
+
var renderPicker = function renderPicker() {
|
|
170
|
+
if (isYearOnly) {
|
|
171
|
+
return (0, _jsxRuntime.jsx)(YearPicker, {
|
|
172
|
+
value: dateValue,
|
|
173
|
+
onChange: handleYearChange,
|
|
174
|
+
style: {
|
|
175
|
+
flex: 1
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (isMonthOnly) {
|
|
180
|
+
return (0, _jsxRuntime.jsx)(MonthPicker, {
|
|
181
|
+
value: dateValue,
|
|
182
|
+
onChange: handleMonthChange,
|
|
183
|
+
style: {
|
|
184
|
+
flex: 1
|
|
185
|
+
},
|
|
186
|
+
format: currentFormat
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return (0, _jsxRuntime.jsx)(_pandora.DatePicker, {
|
|
190
|
+
value: dateValue,
|
|
191
|
+
onChange: handleDateChange,
|
|
192
|
+
style: {
|
|
193
|
+
flex: 1
|
|
194
|
+
},
|
|
195
|
+
format: currentFormat,
|
|
196
|
+
showTime: showTime
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
return (0, _jsxRuntime.jsxs)("div", {
|
|
200
|
+
style: {
|
|
201
|
+
display: 'flex',
|
|
202
|
+
gap: 4
|
|
203
|
+
},
|
|
204
|
+
children: [(0, _jsxRuntime.jsx)(_pandora.Select, {
|
|
205
|
+
style: {
|
|
206
|
+
width: 120
|
|
207
|
+
},
|
|
208
|
+
value: currentFormat,
|
|
209
|
+
onChange: handleFormatChange,
|
|
210
|
+
children: DATE_FORMAT_OPTIONS.map(function (option) {
|
|
211
|
+
return (0, _jsxRuntime.jsx)(_pandora.Select.Option, {
|
|
212
|
+
value: option.value,
|
|
213
|
+
children: option.label
|
|
214
|
+
}, option.value);
|
|
215
|
+
})
|
|
216
|
+
}), renderPicker()]
|
|
217
|
+
});
|
|
218
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_DATE_FORMAT = exports.DATE_FORMAT_OPTIONS = void 0;
|
|
7
|
+
var DATE_FORMAT_OPTIONS = exports.DATE_FORMAT_OPTIONS = [{
|
|
8
|
+
value: 'YYYY-MM',
|
|
9
|
+
label: 'YYYY-MM'
|
|
10
|
+
}, {
|
|
11
|
+
value: 'YYYY-MM-DD',
|
|
12
|
+
label: 'YYYY-MM-DD'
|
|
13
|
+
}, {
|
|
14
|
+
value: 'YYYY-MM-DD HH:mm',
|
|
15
|
+
label: 'YYYY-MM-DD HH:mm'
|
|
16
|
+
}, {
|
|
17
|
+
value: 'YYYY/MM',
|
|
18
|
+
label: 'YYYY/MM'
|
|
19
|
+
}, {
|
|
20
|
+
value: 'YYYY/MM/DD',
|
|
21
|
+
label: 'YYYY/MM/DD'
|
|
22
|
+
}, {
|
|
23
|
+
value: 'YYYY/MM/DD HH:mm',
|
|
24
|
+
label: 'YYYY/MM/DD HH:mm'
|
|
25
|
+
}];
|
|
26
|
+
var DEFAULT_DATE_FORMAT = exports.DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
@@ -27,12 +27,12 @@ var _useProvider = require("../../../hooks/use-provider");
|
|
|
27
27
|
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
28
28
|
var _utils = require("../formula-list/utils");
|
|
29
29
|
var _itemName = _interopRequireDefault(require("../../modules/components/item-name"));
|
|
30
|
+
var _dateFormatPicker = require("./date-format-picker");
|
|
30
31
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
31
32
|
/**
|
|
32
33
|
* 关联模块 选择表字段
|
|
33
34
|
*/
|
|
34
35
|
|
|
35
|
-
var RangePicker = _pandora.DatePicker.RangePicker;
|
|
36
36
|
var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
37
37
|
var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
38
38
|
var DATE_LIST = [
|
|
@@ -395,23 +395,21 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
397
|
if (type === _enum.SQL_GROUP_TYPE.DATE) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
onChange: function onChange(val) {
|
|
408
|
-
// @ts-ignore
|
|
409
|
-
val && setRhsVal([{
|
|
398
|
+
var _rhsVal$, _rhsVal$2;
|
|
399
|
+
var dateVal = ((_rhsVal$ = rhsVal[0]) === null || _rhsVal$ === void 0 ? void 0 : _rhsVal$.type) === _types.AtomsTypeEnum.INPUT_STRING_LIST ? rhsVal[0].val : undefined;
|
|
400
|
+
var dateFormat = ((_rhsVal$2 = rhsVal[0]) === null || _rhsVal$2 === void 0 ? void 0 : _rhsVal$2.type) === _types.AtomsTypeEnum.INPUT_STRING_LIST ? rhsVal[0].format : undefined;
|
|
401
|
+
return (0, _jsxRuntime.jsx)(_dateFormatPicker.DateRangeFormatPicker, {
|
|
402
|
+
value: dateVal,
|
|
403
|
+
format: dateFormat,
|
|
404
|
+
onChange: function onChange(val, format) {
|
|
405
|
+
if (val) {
|
|
406
|
+
setRhsVal([{
|
|
410
407
|
type: _types.AtomsTypeEnum.INPUT_STRING_LIST,
|
|
411
|
-
val:
|
|
408
|
+
val: val,
|
|
409
|
+
format: format
|
|
412
410
|
}]);
|
|
413
411
|
}
|
|
414
|
-
}
|
|
412
|
+
}
|
|
415
413
|
});
|
|
416
414
|
}
|
|
417
415
|
} else if (conditionText === '当前') {
|
|
@@ -496,58 +494,50 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
496
494
|
})]
|
|
497
495
|
});
|
|
498
496
|
} else if (~['早于', '晚于', '在'].indexOf(conditionText)) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
} else {
|
|
519
|
-
setRhsVal([{
|
|
520
|
-
val: '',
|
|
521
|
-
type: _types.AtomsTypeEnum.INPUT_STRING
|
|
522
|
-
}]);
|
|
523
|
-
// setVal([]);
|
|
524
|
-
}
|
|
497
|
+
var _rhsVal$3, _rhsVal$4;
|
|
498
|
+
var _dateVal = ((_rhsVal$3 = rhsVal[0]) === null || _rhsVal$3 === void 0 ? void 0 : _rhsVal$3.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
|
|
499
|
+
var _dateFormat = ((_rhsVal$4 = rhsVal[0]) === null || _rhsVal$4 === void 0 ? void 0 : _rhsVal$4.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
|
|
500
|
+
return (0, _jsxRuntime.jsx)(_dateFormatPicker.DateFormatPicker, {
|
|
501
|
+
value: _dateVal,
|
|
502
|
+
format: _dateFormat,
|
|
503
|
+
onChange: function onChange(val, format) {
|
|
504
|
+
if (val) {
|
|
505
|
+
setRhsVal([{
|
|
506
|
+
type: _types.AtomsTypeEnum.INPUT_STRING,
|
|
507
|
+
val: val,
|
|
508
|
+
format: format
|
|
509
|
+
}]);
|
|
510
|
+
} else {
|
|
511
|
+
setRhsVal([{
|
|
512
|
+
val: '',
|
|
513
|
+
type: _types.AtomsTypeEnum.INPUT_STRING,
|
|
514
|
+
format: format
|
|
515
|
+
}]);
|
|
525
516
|
}
|
|
526
|
-
}
|
|
517
|
+
}
|
|
527
518
|
});
|
|
528
519
|
} else if (~['等于'].indexOf(conditionText) && type === _enum.SQL_GROUP_TYPE.DATE) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
}
|
|
520
|
+
var _rhsVal$5, _rhsVal$6;
|
|
521
|
+
var _dateVal2 = ((_rhsVal$5 = rhsVal[0]) === null || _rhsVal$5 === void 0 ? void 0 : _rhsVal$5.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
|
|
522
|
+
var _dateFormat2 = ((_rhsVal$6 = rhsVal[0]) === null || _rhsVal$6 === void 0 ? void 0 : _rhsVal$6.type) === _types.AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
|
|
523
|
+
return (0, _jsxRuntime.jsx)(_dateFormatPicker.DateFormatPicker, {
|
|
524
|
+
value: _dateVal2,
|
|
525
|
+
format: _dateFormat2,
|
|
526
|
+
onChange: function onChange(val, format) {
|
|
527
|
+
if (val) {
|
|
528
|
+
setRhsVal([{
|
|
529
|
+
type: _types.AtomsTypeEnum.INPUT_STRING,
|
|
530
|
+
val: val,
|
|
531
|
+
format: format
|
|
532
|
+
}]);
|
|
533
|
+
} else {
|
|
534
|
+
setRhsVal([{
|
|
535
|
+
val: '',
|
|
536
|
+
type: _types.AtomsTypeEnum.INPUT_STRING,
|
|
537
|
+
format: format
|
|
538
|
+
}]);
|
|
549
539
|
}
|
|
550
|
-
}
|
|
540
|
+
}
|
|
551
541
|
});
|
|
552
542
|
} else if (~['In', 'Not In'].indexOf(conditionText)) {
|
|
553
543
|
var options = firstVal ? firstVal.split(',') : [];
|
|
@@ -930,7 +920,8 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
930
920
|
} else if (~['介于之间'].indexOf(_condition)) {
|
|
931
921
|
setRhsVal([{
|
|
932
922
|
val: ['', ''],
|
|
933
|
-
type: _types.AtomsTypeEnum.INPUT_STRING_LIST
|
|
923
|
+
type: _types.AtomsTypeEnum.INPUT_STRING_LIST,
|
|
924
|
+
format: 'YYYY-MM-DD HH:mm'
|
|
934
925
|
}]);
|
|
935
926
|
} else if (~['当前'].indexOf(_condition)) {
|
|
936
927
|
setRhsVal([{
|
|
@@ -940,7 +931,8 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
940
931
|
} else if (~['早于', '晚于', '在'].indexOf(_condition)) {
|
|
941
932
|
setRhsVal([{
|
|
942
933
|
val: (0, _dayjs["default"])().format('YYYY-MM-DD HH:mm'),
|
|
943
|
-
type: _types.AtomsTypeEnum.INPUT_STRING
|
|
934
|
+
type: _types.AtomsTypeEnum.INPUT_STRING,
|
|
935
|
+
format: 'YYYY-MM-DD HH:mm'
|
|
944
936
|
}]);
|
|
945
937
|
} else {
|
|
946
938
|
setRhsVal([{
|
package/lib/cjs/store/types.d.ts
CHANGED
|
@@ -107,10 +107,12 @@ export interface AtomsField {
|
|
|
107
107
|
export interface AtomsInputString {
|
|
108
108
|
val: string;
|
|
109
109
|
type: AtomsTypeEnum.INPUT_STRING;
|
|
110
|
+
format?: string;
|
|
110
111
|
}
|
|
111
112
|
export interface AtomsInputStringList {
|
|
112
113
|
val: string[];
|
|
113
114
|
type: AtomsTypeEnum.INPUT_STRING_LIST;
|
|
115
|
+
format?: string;
|
|
114
116
|
}
|
|
115
117
|
export interface AtomsInputNumberList {
|
|
116
118
|
val: number[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DateRangeFormatPickerProps {
|
|
3
|
+
value?: string[];
|
|
4
|
+
format?: string;
|
|
5
|
+
onChange?: (val: string[], format?: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DateRangeFormatPicker: React.FC<DateRangeFormatPickerProps>;
|
|
8
|
+
interface DateFormatPickerProps {
|
|
9
|
+
value?: string;
|
|
10
|
+
format?: string;
|
|
11
|
+
onChange?: (val: string, format?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const DateFormatPicker: React.FC<DateFormatPickerProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { DatePicker, Select } from '@gingkoo/pandora';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
var RangePicker = DatePicker.RangePicker,
|
|
7
|
+
YearPicker = DatePicker.YearPicker,
|
|
8
|
+
MonthPicker = DatePicker.MonthPicker;
|
|
9
|
+
var DATE_FORMAT_OPTIONS = [{
|
|
10
|
+
value: 'YYYY',
|
|
11
|
+
label: 'YYYY'
|
|
12
|
+
}, {
|
|
13
|
+
value: 'YYYY-MM',
|
|
14
|
+
label: 'YYYY-MM'
|
|
15
|
+
}, {
|
|
16
|
+
value: 'YYYY-MM-DD',
|
|
17
|
+
label: 'YYYY-MM-DD'
|
|
18
|
+
}, {
|
|
19
|
+
value: 'YYYY-MM-DD HH:mm',
|
|
20
|
+
label: 'YYYY-MM-DD HH:mm'
|
|
21
|
+
}, {
|
|
22
|
+
value: 'YYYY/MM',
|
|
23
|
+
label: 'YYYY/MM'
|
|
24
|
+
}, {
|
|
25
|
+
value: 'YYYY/MM/DD',
|
|
26
|
+
label: 'YYYY/MM/DD'
|
|
27
|
+
}, {
|
|
28
|
+
value: 'YYYY/MM/DD HH:mm',
|
|
29
|
+
label: 'YYYY/MM/DD HH:mm'
|
|
30
|
+
}];
|
|
31
|
+
var DEFAULT_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
32
|
+
export var DateRangeFormatPicker = function DateRangeFormatPicker(_ref) {
|
|
33
|
+
var value = _ref.value,
|
|
34
|
+
format = _ref.format,
|
|
35
|
+
onChange = _ref.onChange;
|
|
36
|
+
var _useState = useState(format || DEFAULT_FORMAT),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
currentFormat = _useState2[0],
|
|
39
|
+
setCurrentFormat = _useState2[1];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
if (format) {
|
|
42
|
+
setCurrentFormat(format);
|
|
43
|
+
}
|
|
44
|
+
}, [format]);
|
|
45
|
+
var showTime = currentFormat.includes('HH:mm');
|
|
46
|
+
// 根据格式确定 RangePicker 的 mode
|
|
47
|
+
var getRangePickerMode = function getRangePickerMode() {
|
|
48
|
+
if (currentFormat === 'YYYY') return 'year';
|
|
49
|
+
if (currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM') return 'month';
|
|
50
|
+
return 'date';
|
|
51
|
+
};
|
|
52
|
+
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
53
|
+
// 切换格式时,用新格式重新格式化当前值
|
|
54
|
+
if (value && value.length > 0) {
|
|
55
|
+
var formattedValues = value.map(function (v) {
|
|
56
|
+
if (!v) return '';
|
|
57
|
+
var parsed = dayjs(v);
|
|
58
|
+
if (!parsed.isValid()) return '';
|
|
59
|
+
return parsed.format(newFormat);
|
|
60
|
+
});
|
|
61
|
+
// 只调用 onChange,传递新格式化的值和新格式
|
|
62
|
+
onChange === null || onChange === void 0 || onChange(formattedValues, newFormat);
|
|
63
|
+
}
|
|
64
|
+
setCurrentFormat(newFormat);
|
|
65
|
+
};
|
|
66
|
+
// 将字符串数组转为 dayjs 对象数组,供 RangePicker 使用
|
|
67
|
+
var rangeValue = (value === null || value === void 0 ? void 0 : value.map(function (v) {
|
|
68
|
+
if (!v) return null;
|
|
69
|
+
// 尝试用当前格式解析,失败则用 dayjs 默认解析
|
|
70
|
+
var parsed = dayjs(v, currentFormat, true);
|
|
71
|
+
if (parsed.isValid()) return parsed;
|
|
72
|
+
// 尝试不用严格模式解析
|
|
73
|
+
var looseParsed = dayjs(v, currentFormat);
|
|
74
|
+
if (looseParsed.isValid()) return looseParsed;
|
|
75
|
+
// 最后尝试不指定格式
|
|
76
|
+
var anyParsed = dayjs(v);
|
|
77
|
+
return anyParsed.isValid() ? anyParsed : null;
|
|
78
|
+
})) || undefined;
|
|
79
|
+
var handleRangeChange = function handleRangeChange(date, dateString) {
|
|
80
|
+
// 确保日期值按 currentFormat 格式化
|
|
81
|
+
var formattedValues = (date === null || date === void 0 ? void 0 : date.map(function (d) {
|
|
82
|
+
if (!d || !dayjs(d).isValid()) return '';
|
|
83
|
+
return dayjs(d).format(currentFormat);
|
|
84
|
+
})) || dateString;
|
|
85
|
+
onChange === null || onChange === void 0 || onChange(formattedValues, currentFormat);
|
|
86
|
+
};
|
|
87
|
+
return _jsxs("div", {
|
|
88
|
+
style: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
gap: 4
|
|
91
|
+
},
|
|
92
|
+
children: [_jsx(Select, {
|
|
93
|
+
style: {
|
|
94
|
+
width: 120
|
|
95
|
+
},
|
|
96
|
+
value: currentFormat,
|
|
97
|
+
onChange: handleFormatChange,
|
|
98
|
+
children: DATE_FORMAT_OPTIONS.map(function (option) {
|
|
99
|
+
return _jsx(Select.Option, {
|
|
100
|
+
value: option.value,
|
|
101
|
+
children: option.label
|
|
102
|
+
}, option.value);
|
|
103
|
+
})
|
|
104
|
+
}), _jsx(RangePicker, {
|
|
105
|
+
value: rangeValue,
|
|
106
|
+
onChange: handleRangeChange,
|
|
107
|
+
style: {
|
|
108
|
+
flex: 1
|
|
109
|
+
},
|
|
110
|
+
format: currentFormat,
|
|
111
|
+
showTime: showTime,
|
|
112
|
+
mode: getRangePickerMode()
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
export var DateFormatPicker = function DateFormatPicker(_ref2) {
|
|
117
|
+
var value = _ref2.value,
|
|
118
|
+
format = _ref2.format,
|
|
119
|
+
onChange = _ref2.onChange;
|
|
120
|
+
var _useState3 = useState(format || DEFAULT_FORMAT),
|
|
121
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
122
|
+
currentFormat = _useState4[0],
|
|
123
|
+
setCurrentFormat = _useState4[1];
|
|
124
|
+
useEffect(function () {
|
|
125
|
+
if (format) {
|
|
126
|
+
setCurrentFormat(format);
|
|
127
|
+
}
|
|
128
|
+
}, [format]);
|
|
129
|
+
var showTime = currentFormat.includes('HH:mm');
|
|
130
|
+
var isYearOnly = currentFormat === 'YYYY';
|
|
131
|
+
var isMonthOnly = currentFormat === 'YYYY-MM' || currentFormat === 'YYYY/MM';
|
|
132
|
+
var handleFormatChange = function handleFormatChange(newFormat) {
|
|
133
|
+
// 切换格式时,用新格式重新格式化当前值
|
|
134
|
+
if (value) {
|
|
135
|
+
var parsed = dayjs(value);
|
|
136
|
+
if (parsed.isValid()) {
|
|
137
|
+
onChange === null || onChange === void 0 || onChange(parsed.format(newFormat), newFormat);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
setCurrentFormat(newFormat);
|
|
141
|
+
};
|
|
142
|
+
// 将字符串转为 dayjs 对象,使用宽松解析
|
|
143
|
+
var dateValue = function () {
|
|
144
|
+
if (!value) return undefined;
|
|
145
|
+
var parsed = dayjs(value, currentFormat, true);
|
|
146
|
+
if (parsed.isValid()) return parsed;
|
|
147
|
+
var looseParsed = dayjs(value, currentFormat);
|
|
148
|
+
if (looseParsed.isValid()) return looseParsed;
|
|
149
|
+
var anyParsed = dayjs(value);
|
|
150
|
+
return anyParsed.isValid() ? anyParsed : undefined;
|
|
151
|
+
}();
|
|
152
|
+
var handleDateChange = function handleDateChange(dateString) {
|
|
153
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
154
|
+
};
|
|
155
|
+
var handleYearChange = function handleYearChange(dateString) {
|
|
156
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
157
|
+
};
|
|
158
|
+
var handleMonthChange = function handleMonthChange(dateString) {
|
|
159
|
+
onChange === null || onChange === void 0 || onChange(dateString, currentFormat);
|
|
160
|
+
};
|
|
161
|
+
// 根据格式渲染不同的选择器
|
|
162
|
+
var renderPicker = function renderPicker() {
|
|
163
|
+
if (isYearOnly) {
|
|
164
|
+
return _jsx(YearPicker, {
|
|
165
|
+
value: dateValue,
|
|
166
|
+
onChange: handleYearChange,
|
|
167
|
+
style: {
|
|
168
|
+
flex: 1
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (isMonthOnly) {
|
|
173
|
+
return _jsx(MonthPicker, {
|
|
174
|
+
value: dateValue,
|
|
175
|
+
onChange: handleMonthChange,
|
|
176
|
+
style: {
|
|
177
|
+
flex: 1
|
|
178
|
+
},
|
|
179
|
+
format: currentFormat
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return _jsx(DatePicker, {
|
|
183
|
+
value: dateValue,
|
|
184
|
+
onChange: handleDateChange,
|
|
185
|
+
style: {
|
|
186
|
+
flex: 1
|
|
187
|
+
},
|
|
188
|
+
format: currentFormat,
|
|
189
|
+
showTime: showTime
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
return _jsxs("div", {
|
|
193
|
+
style: {
|
|
194
|
+
display: 'flex',
|
|
195
|
+
gap: 4
|
|
196
|
+
},
|
|
197
|
+
children: [_jsx(Select, {
|
|
198
|
+
style: {
|
|
199
|
+
width: 120
|
|
200
|
+
},
|
|
201
|
+
value: currentFormat,
|
|
202
|
+
onChange: handleFormatChange,
|
|
203
|
+
children: DATE_FORMAT_OPTIONS.map(function (option) {
|
|
204
|
+
return _jsx(Select.Option, {
|
|
205
|
+
value: option.value,
|
|
206
|
+
children: option.label
|
|
207
|
+
}, option.value);
|
|
208
|
+
})
|
|
209
|
+
}), renderPicker()]
|
|
210
|
+
});
|
|
211
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var DATE_FORMAT_OPTIONS = [{
|
|
2
|
+
value: 'YYYY-MM',
|
|
3
|
+
label: 'YYYY-MM'
|
|
4
|
+
}, {
|
|
5
|
+
value: 'YYYY-MM-DD',
|
|
6
|
+
label: 'YYYY-MM-DD'
|
|
7
|
+
}, {
|
|
8
|
+
value: 'YYYY-MM-DD HH:mm',
|
|
9
|
+
label: 'YYYY-MM-DD HH:mm'
|
|
10
|
+
}, {
|
|
11
|
+
value: 'YYYY/MM',
|
|
12
|
+
label: 'YYYY/MM'
|
|
13
|
+
}, {
|
|
14
|
+
value: 'YYYY/MM/DD',
|
|
15
|
+
label: 'YYYY/MM/DD'
|
|
16
|
+
}, {
|
|
17
|
+
value: 'YYYY/MM/DD HH:mm',
|
|
18
|
+
label: 'YYYY/MM/DD HH:mm'
|
|
19
|
+
}];
|
|
20
|
+
export var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm';
|
|
@@ -8,7 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import './index.less';
|
|
9
9
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
10
10
|
import { Repeat, Function } from '@gingkoo/pandora-icons';
|
|
11
|
-
import { Button, Tooltip, Input, Select, InputNumber, Dropdown
|
|
11
|
+
import { Button, Tooltip, Input, Select, InputNumber, Dropdown } from '@gingkoo/pandora';
|
|
12
12
|
import cx from 'classnames';
|
|
13
13
|
import { ChevronODown } from '@gingkoo/pandora-icons';
|
|
14
14
|
import moment from 'dayjs';
|
|
@@ -23,7 +23,7 @@ import { useStore } from '../../../hooks/use-provider';
|
|
|
23
23
|
import cloneDeep from 'lodash/cloneDeep';
|
|
24
24
|
import { getConstantLabel } from '../formula-list/utils';
|
|
25
25
|
import ItemName from '../../modules/components/item-name';
|
|
26
|
-
|
|
26
|
+
import { DateFormatPicker, DateRangeFormatPicker } from './date-format-picker';
|
|
27
27
|
var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
28
28
|
var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
|
|
29
29
|
var DATE_LIST = [
|
|
@@ -386,23 +386,21 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
388
|
if (type === SQL_GROUP_TYPE.DATE) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
onChange: function onChange(val) {
|
|
399
|
-
// @ts-ignore
|
|
400
|
-
val && setRhsVal([{
|
|
389
|
+
var _rhsVal$, _rhsVal$2;
|
|
390
|
+
var dateVal = ((_rhsVal$ = rhsVal[0]) === null || _rhsVal$ === void 0 ? void 0 : _rhsVal$.type) === AtomsTypeEnum.INPUT_STRING_LIST ? rhsVal[0].val : undefined;
|
|
391
|
+
var dateFormat = ((_rhsVal$2 = rhsVal[0]) === null || _rhsVal$2 === void 0 ? void 0 : _rhsVal$2.type) === AtomsTypeEnum.INPUT_STRING_LIST ? rhsVal[0].format : undefined;
|
|
392
|
+
return _jsx(DateRangeFormatPicker, {
|
|
393
|
+
value: dateVal,
|
|
394
|
+
format: dateFormat,
|
|
395
|
+
onChange: function onChange(val, format) {
|
|
396
|
+
if (val) {
|
|
397
|
+
setRhsVal([{
|
|
401
398
|
type: AtomsTypeEnum.INPUT_STRING_LIST,
|
|
402
|
-
val:
|
|
399
|
+
val: val,
|
|
400
|
+
format: format
|
|
403
401
|
}]);
|
|
404
402
|
}
|
|
405
|
-
}
|
|
403
|
+
}
|
|
406
404
|
});
|
|
407
405
|
}
|
|
408
406
|
} else if (conditionText === '当前') {
|
|
@@ -487,58 +485,50 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
487
485
|
})]
|
|
488
486
|
});
|
|
489
487
|
} else if (~['早于', '晚于', '在'].indexOf(conditionText)) {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
} else {
|
|
510
|
-
setRhsVal([{
|
|
511
|
-
val: '',
|
|
512
|
-
type: AtomsTypeEnum.INPUT_STRING
|
|
513
|
-
}]);
|
|
514
|
-
// setVal([]);
|
|
515
|
-
}
|
|
488
|
+
var _rhsVal$3, _rhsVal$4;
|
|
489
|
+
var _dateVal = ((_rhsVal$3 = rhsVal[0]) === null || _rhsVal$3 === void 0 ? void 0 : _rhsVal$3.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
|
|
490
|
+
var _dateFormat = ((_rhsVal$4 = rhsVal[0]) === null || _rhsVal$4 === void 0 ? void 0 : _rhsVal$4.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
|
|
491
|
+
return _jsx(DateFormatPicker, {
|
|
492
|
+
value: _dateVal,
|
|
493
|
+
format: _dateFormat,
|
|
494
|
+
onChange: function onChange(val, format) {
|
|
495
|
+
if (val) {
|
|
496
|
+
setRhsVal([{
|
|
497
|
+
type: AtomsTypeEnum.INPUT_STRING,
|
|
498
|
+
val: val,
|
|
499
|
+
format: format
|
|
500
|
+
}]);
|
|
501
|
+
} else {
|
|
502
|
+
setRhsVal([{
|
|
503
|
+
val: '',
|
|
504
|
+
type: AtomsTypeEnum.INPUT_STRING,
|
|
505
|
+
format: format
|
|
506
|
+
}]);
|
|
516
507
|
}
|
|
517
|
-
}
|
|
508
|
+
}
|
|
518
509
|
});
|
|
519
510
|
} else if (~['等于'].indexOf(conditionText) && type === SQL_GROUP_TYPE.DATE) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
511
|
+
var _rhsVal$5, _rhsVal$6;
|
|
512
|
+
var _dateVal2 = ((_rhsVal$5 = rhsVal[0]) === null || _rhsVal$5 === void 0 ? void 0 : _rhsVal$5.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].val : undefined;
|
|
513
|
+
var _dateFormat2 = ((_rhsVal$6 = rhsVal[0]) === null || _rhsVal$6 === void 0 ? void 0 : _rhsVal$6.type) === AtomsTypeEnum.INPUT_STRING ? rhsVal[0].format : undefined;
|
|
514
|
+
return _jsx(DateFormatPicker, {
|
|
515
|
+
value: _dateVal2,
|
|
516
|
+
format: _dateFormat2,
|
|
517
|
+
onChange: function onChange(val, format) {
|
|
518
|
+
if (val) {
|
|
519
|
+
setRhsVal([{
|
|
520
|
+
type: AtomsTypeEnum.INPUT_STRING,
|
|
521
|
+
val: val,
|
|
522
|
+
format: format
|
|
523
|
+
}]);
|
|
524
|
+
} else {
|
|
525
|
+
setRhsVal([{
|
|
526
|
+
val: '',
|
|
527
|
+
type: AtomsTypeEnum.INPUT_STRING,
|
|
528
|
+
format: format
|
|
529
|
+
}]);
|
|
540
530
|
}
|
|
541
|
-
}
|
|
531
|
+
}
|
|
542
532
|
});
|
|
543
533
|
} else if (~['In', 'Not In'].indexOf(conditionText)) {
|
|
544
534
|
var options = firstVal ? firstVal.split(',') : [];
|
|
@@ -921,7 +911,8 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
921
911
|
} else if (~['介于之间'].indexOf(_condition)) {
|
|
922
912
|
setRhsVal([{
|
|
923
913
|
val: ['', ''],
|
|
924
|
-
type: AtomsTypeEnum.INPUT_STRING_LIST
|
|
914
|
+
type: AtomsTypeEnum.INPUT_STRING_LIST,
|
|
915
|
+
format: 'YYYY-MM-DD HH:mm'
|
|
925
916
|
}]);
|
|
926
917
|
} else if (~['当前'].indexOf(_condition)) {
|
|
927
918
|
setRhsVal([{
|
|
@@ -931,7 +922,8 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
|
|
|
931
922
|
} else if (~['早于', '晚于', '在'].indexOf(_condition)) {
|
|
932
923
|
setRhsVal([{
|
|
933
924
|
val: moment().format('YYYY-MM-DD HH:mm'),
|
|
934
|
-
type: AtomsTypeEnum.INPUT_STRING
|
|
925
|
+
type: AtomsTypeEnum.INPUT_STRING,
|
|
926
|
+
format: 'YYYY-MM-DD HH:mm'
|
|
935
927
|
}]);
|
|
936
928
|
} else {
|
|
937
929
|
setRhsVal([{
|
package/lib/es/store/types.d.ts
CHANGED
|
@@ -107,10 +107,12 @@ export interface AtomsField {
|
|
|
107
107
|
export interface AtomsInputString {
|
|
108
108
|
val: string;
|
|
109
109
|
type: AtomsTypeEnum.INPUT_STRING;
|
|
110
|
+
format?: string;
|
|
110
111
|
}
|
|
111
112
|
export interface AtomsInputStringList {
|
|
112
113
|
val: string[];
|
|
113
114
|
type: AtomsTypeEnum.INPUT_STRING_LIST;
|
|
115
|
+
format?: string;
|
|
114
116
|
}
|
|
115
117
|
export interface AtomsInputNumberList {
|
|
116
118
|
val: number[];
|