assui 3.1.69 → 3.1.71
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/es/color-select/index.js +2 -2
- package/es/complex-val-select/index.d.ts +11 -5
- package/es/complex-val-select/index.js +29 -13
- package/es/condition-select-input/index.d.ts +6 -5
- package/es/label-customize-range-picker/defaultRadioList.js +17 -17
- package/es/label-customize-range-picker/index.js +2 -2
- package/es/messages/index.d.ts +7 -5
- package/es/messages/index.js +5 -0
- package/lib/color-select/index.js +2 -2
- package/lib/complex-val-select/index.d.ts +11 -5
- package/lib/complex-val-select/index.js +29 -13
- package/lib/condition-select-input/index.d.ts +6 -5
- package/lib/label-customize-range-picker/defaultRadioList.js +50 -17
- package/lib/label-customize-range-picker/index.js +2 -2
- package/lib/messages/index.d.ts +7 -5
- package/lib/messages/index.js +6 -0
- package/package.json +2 -2
package/es/color-select/index.js
CHANGED
|
@@ -41,7 +41,7 @@ import classNames from 'classnames';
|
|
|
41
41
|
import useControllableValue from "ahooks/es/useControllableValue";
|
|
42
42
|
import ChevronRightOutlined from "a-icons/es/ChevronRightOutlined";
|
|
43
43
|
import LocaleContext from '../config-provider/context';
|
|
44
|
-
import formatMessage from '../messages';
|
|
44
|
+
import formatMessage, { langTypeEnum } from '../messages';
|
|
45
45
|
var ColorSelect = function ColorSelect(props) {
|
|
46
46
|
var className = props.className,
|
|
47
47
|
classNameWrap = props.classNameWrap,
|
|
@@ -69,7 +69,7 @@ var ColorSelect = function ColorSelect(props) {
|
|
|
69
69
|
} : undefined
|
|
70
70
|
}) : /*#__PURE__*/React.createElement("span", {
|
|
71
71
|
className: "color-select-placeholder"
|
|
72
|
-
}, formatMessage(messages,
|
|
72
|
+
}, formatMessage(messages, langTypeEnum.global, 'placeholder')), /*#__PURE__*/React.createElement("div", {
|
|
73
73
|
className: "color-select-arrow"
|
|
74
74
|
}, /*#__PURE__*/React.createElement(ChevronRightOutlined, {
|
|
75
75
|
rotate: 90
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { SelectProps } from 'antd/lib/select';
|
|
2
|
+
import type { BaseOptionType, SelectProps } from 'antd/lib/select';
|
|
3
3
|
declare const Option: import("rc-select/lib/Option").OptionFC;
|
|
4
4
|
export { Option };
|
|
5
|
-
export declare type
|
|
6
|
-
export interface
|
|
5
|
+
export declare type ComplexValSelectValueType = string | number | any[] | Record<string, any> | null | undefined;
|
|
6
|
+
export interface ComplexValSelectOptionType extends Omit<BaseOptionType, 'value' | 'children' | 'options'> {
|
|
7
|
+
value?: ComplexValSelectValueType;
|
|
8
|
+
children?: ComplexValSelectOptionType[];
|
|
9
|
+
options?: Omit<ComplexValSelectOptionType, 'children' | 'options'>[];
|
|
10
|
+
}
|
|
11
|
+
export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange' | 'options'> {
|
|
7
12
|
value?: T;
|
|
8
|
-
onChange?: (val: T, opt
|
|
13
|
+
onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
|
|
14
|
+
options?: ComplexValSelectOptionType[];
|
|
9
15
|
}
|
|
10
|
-
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<
|
|
16
|
+
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
|
|
11
17
|
export default ComplexValSelect;
|
|
@@ -44,6 +44,21 @@ import Select from "antd/es/select";
|
|
|
44
44
|
import useControllableValue from "ahooks/es/useControllableValue";
|
|
45
45
|
var Option = Select.Option;
|
|
46
46
|
export { Option };
|
|
47
|
+
var formatOptions = function formatOptions(dateSource) {
|
|
48
|
+
if (dateSource) {
|
|
49
|
+
var options = dateSource.map(function (item) {
|
|
50
|
+
var otherProps = item.options ? {
|
|
51
|
+
options: formatOptions(item.options)
|
|
52
|
+
} : {};
|
|
53
|
+
return __assign(__assign(__assign({}, item), {
|
|
54
|
+
label: item.label,
|
|
55
|
+
value: item.value ? JSON.stringify(item.value) : undefined
|
|
56
|
+
}), otherProps);
|
|
57
|
+
});
|
|
58
|
+
return options;
|
|
59
|
+
}
|
|
60
|
+
return dateSource;
|
|
61
|
+
};
|
|
47
62
|
var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
48
63
|
var _a = __read(useControllableValue(props), 2),
|
|
49
64
|
value = _a[0],
|
|
@@ -57,31 +72,32 @@ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
57
72
|
});
|
|
58
73
|
// 判断是否需要将optionValue转为JSON字符串
|
|
59
74
|
var isReferenceTypeVal = some(options, function (item) {
|
|
60
|
-
|
|
75
|
+
if (item.value) {
|
|
76
|
+
return isArray(item.value) || isObject(item.value);
|
|
77
|
+
}
|
|
78
|
+
if (item.options) {
|
|
79
|
+
return some(item.options, function (i) {
|
|
80
|
+
return isArray(i.value) || isObject(i.value);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
61
84
|
});
|
|
62
|
-
var finalOptions = isReferenceTypeVal ? options
|
|
63
|
-
return __assign(__assign({}, item), {
|
|
64
|
-
value: JSON.stringify(item.value)
|
|
65
|
-
});
|
|
66
|
-
}) : options;
|
|
85
|
+
var finalOptions = isReferenceTypeVal ? formatOptions(options) : options;
|
|
67
86
|
var handleChange = function handleChange(val) {
|
|
68
|
-
var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
|
|
87
|
+
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
69
88
|
setValue(nextVal);
|
|
70
89
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
|
|
71
90
|
};
|
|
72
91
|
var handleSelect = function handleSelect(val) {
|
|
73
|
-
var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
|
|
92
|
+
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
74
93
|
var selectOption = find(finalOptions, {
|
|
75
94
|
value: val
|
|
76
95
|
});
|
|
77
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal,
|
|
78
|
-
label: selectOption.label,
|
|
79
|
-
value: nextVal
|
|
80
|
-
});
|
|
96
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, selectOption);
|
|
81
97
|
};
|
|
82
98
|
return /*#__PURE__*/React.createElement(Select, __assign({
|
|
83
99
|
ref: selectRef,
|
|
84
|
-
value: isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
100
|
+
value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
85
101
|
options: finalOptions,
|
|
86
102
|
onChange: handleChange,
|
|
87
103
|
onSelect: handleSelect
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComplexValSelectProps, ComplexValSelectValueType } from '../complex-val-select';
|
|
1
2
|
import type { SelectProps } from 'antd/lib/select';
|
|
2
3
|
import type { ConditionInputProps } from '../condition-input';
|
|
3
4
|
export declare enum InputTypeEnum {
|
|
@@ -10,16 +11,16 @@ export declare enum EntryTypeEnum {
|
|
|
10
11
|
}
|
|
11
12
|
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
12
13
|
declare type SelectOptionsType = {
|
|
13
|
-
value:
|
|
14
|
+
value: ComplexValSelectValueType;
|
|
14
15
|
label: string;
|
|
15
16
|
};
|
|
16
17
|
export interface MainSelectOptionsType extends SelectOptionsType {
|
|
17
18
|
children?: SelectOptionsType[];
|
|
18
19
|
}
|
|
19
20
|
export interface ValueType {
|
|
20
|
-
selectValue?:
|
|
21
|
+
selectValue?: ComplexValSelectValueType;
|
|
21
22
|
inputValue?: SelectProps['value'] | ConditionInputProps['value'];
|
|
22
|
-
finalSelectValue?:
|
|
23
|
+
finalSelectValue?: ComplexValSelectProps<any>['value'] | ConditionInputProps['value'][];
|
|
23
24
|
changedEntryType?: ChangedEntryType;
|
|
24
25
|
}
|
|
25
26
|
export interface ConditionSelectInputProps {
|
|
@@ -27,11 +28,11 @@ export interface ConditionSelectInputProps {
|
|
|
27
28
|
/** 不需要展示联动输入框的字段值 */
|
|
28
29
|
hiddenInputKeys?: ValueType['selectValue'][];
|
|
29
30
|
/** selectProps */
|
|
30
|
-
selectProps?:
|
|
31
|
+
selectProps?: ComplexValSelectProps<any>;
|
|
31
32
|
/** 联动inputProps */
|
|
32
33
|
conditionInputProps?: ConditionInputProps;
|
|
33
34
|
/** 联动selectProps */
|
|
34
|
-
conditionSelectProps?:
|
|
35
|
+
conditionSelectProps?: ComplexValSelectProps<any>;
|
|
35
36
|
/** onChange */
|
|
36
37
|
onChange?: (value: ValueType) => void;
|
|
37
38
|
/** onBlur */
|
|
@@ -33,7 +33,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
33
33
|
};
|
|
34
34
|
import { isNumber } from 'lodash';
|
|
35
35
|
import dateUtils from "aa-utils/es/dateUtils";
|
|
36
|
-
import formatMessage from '../messages';
|
|
36
|
+
import formatMessage, { langTypeEnum } from '../messages';
|
|
37
37
|
export var dateTypeEnum;
|
|
38
38
|
(function (dateTypeEnum) {
|
|
39
39
|
dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
|
|
@@ -63,68 +63,68 @@ var getDefaultRadioList = function getDefaultRadioList(_a) {
|
|
|
63
63
|
var now = isNumber(timeOffset) ? dateUtils.getToday(timeOffset) : dateUtils.getToday();
|
|
64
64
|
var allRadio = displayAllOption ? [{
|
|
65
65
|
key: dateTypeEnum.ALL,
|
|
66
|
-
text: formatMessage(messages,
|
|
66
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'all'),
|
|
67
67
|
value: [startTimeOfAllOption || dateUtils.parseDate('2022/09/01'), now.endOf('day')]
|
|
68
68
|
}] : [];
|
|
69
69
|
var defaultRadioList = __spreadArray([{
|
|
70
70
|
key: dateTypeEnum.TODAY,
|
|
71
|
-
text: formatMessage(messages,
|
|
71
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'toDay'),
|
|
72
72
|
value: [now.clone().startOf('day'), now.clone().endOf('day')]
|
|
73
73
|
}, {
|
|
74
74
|
key: dateTypeEnum.YESTERDAY,
|
|
75
|
-
text: formatMessage(messages,
|
|
75
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'yesterDay'),
|
|
76
76
|
value: [now.clone().subtract(1, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')]
|
|
77
77
|
}, {
|
|
78
78
|
key: dateTypeEnum.WEEK,
|
|
79
|
-
text: formatMessage(messages,
|
|
79
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'week'),
|
|
80
80
|
value: [now.clone().startOf('week'), naturalDate ? now.clone().endOf('week') : now.clone().endOf('day')]
|
|
81
81
|
}, {
|
|
82
82
|
key: dateTypeEnum.LAST_WEEK,
|
|
83
|
-
text: formatMessage(messages,
|
|
83
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'lastWeek'),
|
|
84
84
|
value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
|
|
85
85
|
}, {
|
|
86
86
|
key: dateTypeEnum.MONTH,
|
|
87
|
-
text: formatMessage(messages,
|
|
87
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'month'),
|
|
88
88
|
value: [now.clone().startOf('month'), naturalDate ? now.clone().endOf('month') : now.clone().endOf('day')]
|
|
89
89
|
}, {
|
|
90
90
|
key: dateTypeEnum.LAST_MONTH,
|
|
91
|
-
text: formatMessage(messages,
|
|
91
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'lastMonth'),
|
|
92
92
|
value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
|
|
93
93
|
}, {
|
|
94
94
|
key: dateTypeEnum.QUARTER,
|
|
95
|
-
text: formatMessage(messages,
|
|
95
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'quarter'),
|
|
96
96
|
value: [now.clone().startOf('quarter'), naturalDate ? now.clone().endOf('quarter') : now.clone().endOf('day')]
|
|
97
97
|
}, {
|
|
98
98
|
key: dateTypeEnum.LAST_QUARTER,
|
|
99
|
-
text: formatMessage(messages,
|
|
99
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'lastQuarter'),
|
|
100
100
|
value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
|
|
101
101
|
}, {
|
|
102
102
|
key: dateTypeEnum.YEAR,
|
|
103
|
-
text: formatMessage(messages,
|
|
103
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'year'),
|
|
104
104
|
value: [now.clone().startOf('year'), naturalDate ? now.clone().endOf('year') : now.endOf('day')]
|
|
105
105
|
}, {
|
|
106
106
|
key: dateTypeEnum.BEFORE_7_DAY,
|
|
107
|
-
text: formatMessage(messages,
|
|
107
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last7days'),
|
|
108
108
|
value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
|
|
109
109
|
}, {
|
|
110
110
|
key: dateTypeEnum.BEFORE_14_DAY,
|
|
111
|
-
text: formatMessage(messages,
|
|
111
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last14days'),
|
|
112
112
|
value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
|
|
113
113
|
}, {
|
|
114
114
|
key: dateTypeEnum.BEFORE_30_DAY,
|
|
115
|
-
text: formatMessage(messages,
|
|
115
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last30days'),
|
|
116
116
|
value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
|
|
117
117
|
}, {
|
|
118
118
|
key: dateTypeEnum.BEFORE_90_DAY,
|
|
119
|
-
text: formatMessage(messages,
|
|
119
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last90days'),
|
|
120
120
|
value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
|
|
121
121
|
}, {
|
|
122
122
|
key: dateTypeEnum.BEFORE_180_DAY,
|
|
123
|
-
text: formatMessage(messages,
|
|
123
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last180days'),
|
|
124
124
|
value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
|
|
125
125
|
}, {
|
|
126
126
|
key: dateTypeEnum.BEFORE_365_DAY,
|
|
127
|
-
text: formatMessage(messages,
|
|
127
|
+
text: formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'last365days'),
|
|
128
128
|
value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
|
|
129
129
|
}], __read(allRadio), false);
|
|
130
130
|
return defaultRadioList;
|
|
@@ -53,7 +53,7 @@ import omit from 'lodash/omit';
|
|
|
53
53
|
import getDefaultRadioList from './defaultRadioList';
|
|
54
54
|
import LabelRangePicker from '../label-range-picker';
|
|
55
55
|
import LocaleContext from '../config-provider/context';
|
|
56
|
-
import formatMessage from '../messages';
|
|
56
|
+
import formatMessage, { langTypeEnum } from '../messages';
|
|
57
57
|
import { formatMaxScope, getDateDiffScope, ONE_DAY_MILLISECOND, getTimeDiffOfShowTime } from './utils';
|
|
58
58
|
var RangePicker = DatePicker.RangePicker;
|
|
59
59
|
var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
@@ -218,7 +218,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
218
218
|
onChange: onDiyTimeChange
|
|
219
219
|
}), /*#__PURE__*/React.createElement("span", {
|
|
220
220
|
className: "customize-select-text"
|
|
221
|
-
}, formatMessage(messages,
|
|
221
|
+
}, formatMessage(messages, langTypeEnum.labelCustomizeRangePicker, 'customTime')))), isVisiblePanel ? /*#__PURE__*/React.createElement("div", {
|
|
222
222
|
className: "panel"
|
|
223
223
|
}, panel) : /*#__PURE__*/React.createElement("div", {
|
|
224
224
|
className: "pick-box"
|
package/es/messages/index.d.ts
CHANGED
|
@@ -20,10 +20,12 @@ export declare type LabelCustomizeRangePickerType = {
|
|
|
20
20
|
export declare type Global = {
|
|
21
21
|
placeholder: string;
|
|
22
22
|
};
|
|
23
|
-
export declare
|
|
23
|
+
export declare enum langTypeEnum {
|
|
24
|
+
labelCustomizeRangePicker = "labelCustomizeRangePicker",
|
|
25
|
+
global = "global"
|
|
26
|
+
}
|
|
24
27
|
export declare type LangType = {
|
|
25
|
-
labelCustomizeRangePicker: LabelCustomizeRangePickerType;
|
|
26
|
-
global: Global;
|
|
28
|
+
[langTypeEnum.labelCustomizeRangePicker]: LabelCustomizeRangePickerType;
|
|
29
|
+
[langTypeEnum.global]: Global;
|
|
27
30
|
};
|
|
28
|
-
export
|
|
29
|
-
export default function formatMessage(message: LangType, displayName: DisplayNameType, key: keyof All): any;
|
|
31
|
+
export default function formatMessage<T extends LangType, K extends keyof T>(message: Record<K, T[K]>, displayName: K, key: keyof T[K]): Record<K, T[K]>[K][keyof T[K]];
|
package/es/messages/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export var langTypeEnum;
|
|
2
|
+
(function (langTypeEnum) {
|
|
3
|
+
langTypeEnum["labelCustomizeRangePicker"] = "labelCustomizeRangePicker";
|
|
4
|
+
langTypeEnum["global"] = "global";
|
|
5
|
+
})(langTypeEnum || (langTypeEnum = {}));
|
|
1
6
|
export default function formatMessage(message, displayName, key) {
|
|
2
7
|
return message[displayName][key];
|
|
3
8
|
}
|
|
@@ -84,7 +84,7 @@ var classnames_1 = __importDefault(require("classnames"));
|
|
|
84
84
|
var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
|
|
85
85
|
var ChevronRightOutlined_1 = __importDefault(require("a-icons/lib/ChevronRightOutlined"));
|
|
86
86
|
var context_1 = __importDefault(require("../config-provider/context"));
|
|
87
|
-
var messages_1 =
|
|
87
|
+
var messages_1 = __importStar(require("../messages"));
|
|
88
88
|
var ColorSelect = function ColorSelect(props) {
|
|
89
89
|
var className = props.className,
|
|
90
90
|
classNameWrap = props.classNameWrap,
|
|
@@ -112,7 +112,7 @@ var ColorSelect = function ColorSelect(props) {
|
|
|
112
112
|
} : undefined
|
|
113
113
|
}) : react_1["default"].createElement("span", {
|
|
114
114
|
className: "color-select-placeholder"
|
|
115
|
-
}, (0, messages_1["default"])(messages,
|
|
115
|
+
}, (0, messages_1["default"])(messages, messages_1.langTypeEnum.global, 'placeholder')), react_1["default"].createElement("div", {
|
|
116
116
|
className: "color-select-arrow"
|
|
117
117
|
}, react_1["default"].createElement(ChevronRightOutlined_1["default"], {
|
|
118
118
|
rotate: 90
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { SelectProps } from 'antd/lib/select';
|
|
2
|
+
import type { BaseOptionType, SelectProps } from 'antd/lib/select';
|
|
3
3
|
declare const Option: import("rc-select/lib/Option").OptionFC;
|
|
4
4
|
export { Option };
|
|
5
|
-
export declare type
|
|
6
|
-
export interface
|
|
5
|
+
export declare type ComplexValSelectValueType = string | number | any[] | Record<string, any> | null | undefined;
|
|
6
|
+
export interface ComplexValSelectOptionType extends Omit<BaseOptionType, 'value' | 'children' | 'options'> {
|
|
7
|
+
value?: ComplexValSelectValueType;
|
|
8
|
+
children?: ComplexValSelectOptionType[];
|
|
9
|
+
options?: Omit<ComplexValSelectOptionType, 'children' | 'options'>[];
|
|
10
|
+
}
|
|
11
|
+
export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange' | 'options'> {
|
|
7
12
|
value?: T;
|
|
8
|
-
onChange?: (val: T, opt
|
|
13
|
+
onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
|
|
14
|
+
options?: ComplexValSelectOptionType[];
|
|
9
15
|
}
|
|
10
|
-
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<
|
|
16
|
+
declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
|
|
11
17
|
export default ComplexValSelect;
|
|
@@ -88,6 +88,21 @@ var select_1 = __importDefault(require("antd/lib/select"));
|
|
|
88
88
|
var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
|
|
89
89
|
var Option = select_1["default"].Option;
|
|
90
90
|
exports.Option = Option;
|
|
91
|
+
var formatOptions = function formatOptions(dateSource) {
|
|
92
|
+
if (dateSource) {
|
|
93
|
+
var options = dateSource.map(function (item) {
|
|
94
|
+
var otherProps = item.options ? {
|
|
95
|
+
options: formatOptions(item.options)
|
|
96
|
+
} : {};
|
|
97
|
+
return __assign(__assign(__assign({}, item), {
|
|
98
|
+
label: item.label,
|
|
99
|
+
value: item.value ? JSON.stringify(item.value) : undefined
|
|
100
|
+
}), otherProps);
|
|
101
|
+
});
|
|
102
|
+
return options;
|
|
103
|
+
}
|
|
104
|
+
return dateSource;
|
|
105
|
+
};
|
|
91
106
|
var ComplexValSelect = React.forwardRef(function (props, ref) {
|
|
92
107
|
var _a = __read((0, useControllableValue_1["default"])(props), 2),
|
|
93
108
|
value = _a[0],
|
|
@@ -101,31 +116,32 @@ var ComplexValSelect = React.forwardRef(function (props, ref) {
|
|
|
101
116
|
});
|
|
102
117
|
// 判断是否需要将optionValue转为JSON字符串
|
|
103
118
|
var isReferenceTypeVal = (0, some_1["default"])(options, function (item) {
|
|
104
|
-
|
|
119
|
+
if (item.value) {
|
|
120
|
+
return (0, isArray_1["default"])(item.value) || (0, isObject_1["default"])(item.value);
|
|
121
|
+
}
|
|
122
|
+
if (item.options) {
|
|
123
|
+
return (0, some_1["default"])(item.options, function (i) {
|
|
124
|
+
return (0, isArray_1["default"])(i.value) || (0, isObject_1["default"])(i.value);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
105
128
|
});
|
|
106
|
-
var finalOptions = isReferenceTypeVal ? options
|
|
107
|
-
return __assign(__assign({}, item), {
|
|
108
|
-
value: JSON.stringify(item.value)
|
|
109
|
-
});
|
|
110
|
-
}) : options;
|
|
129
|
+
var finalOptions = isReferenceTypeVal ? formatOptions(options) : options;
|
|
111
130
|
var handleChange = function handleChange(val) {
|
|
112
|
-
var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
|
|
131
|
+
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
113
132
|
setValue(nextVal);
|
|
114
133
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
|
|
115
134
|
};
|
|
116
135
|
var handleSelect = function handleSelect(val) {
|
|
117
|
-
var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
|
|
136
|
+
var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
|
|
118
137
|
var selectOption = (0, find_1["default"])(finalOptions, {
|
|
119
138
|
value: val
|
|
120
139
|
});
|
|
121
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal,
|
|
122
|
-
label: selectOption.label,
|
|
123
|
-
value: nextVal
|
|
124
|
-
});
|
|
140
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, selectOption);
|
|
125
141
|
};
|
|
126
142
|
return React.createElement(select_1["default"], __assign({
|
|
127
143
|
ref: selectRef,
|
|
128
|
-
value: isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
144
|
+
value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
|
|
129
145
|
options: finalOptions,
|
|
130
146
|
onChange: handleChange,
|
|
131
147
|
onSelect: handleSelect
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComplexValSelectProps, ComplexValSelectValueType } from '../complex-val-select';
|
|
1
2
|
import type { SelectProps } from 'antd/lib/select';
|
|
2
3
|
import type { ConditionInputProps } from '../condition-input';
|
|
3
4
|
export declare enum InputTypeEnum {
|
|
@@ -10,16 +11,16 @@ export declare enum EntryTypeEnum {
|
|
|
10
11
|
}
|
|
11
12
|
export declare type ChangedEntryType = typeof EntryTypeEnum[keyof typeof EntryTypeEnum];
|
|
12
13
|
declare type SelectOptionsType = {
|
|
13
|
-
value:
|
|
14
|
+
value: ComplexValSelectValueType;
|
|
14
15
|
label: string;
|
|
15
16
|
};
|
|
16
17
|
export interface MainSelectOptionsType extends SelectOptionsType {
|
|
17
18
|
children?: SelectOptionsType[];
|
|
18
19
|
}
|
|
19
20
|
export interface ValueType {
|
|
20
|
-
selectValue?:
|
|
21
|
+
selectValue?: ComplexValSelectValueType;
|
|
21
22
|
inputValue?: SelectProps['value'] | ConditionInputProps['value'];
|
|
22
|
-
finalSelectValue?:
|
|
23
|
+
finalSelectValue?: ComplexValSelectProps<any>['value'] | ConditionInputProps['value'][];
|
|
23
24
|
changedEntryType?: ChangedEntryType;
|
|
24
25
|
}
|
|
25
26
|
export interface ConditionSelectInputProps {
|
|
@@ -27,11 +28,11 @@ export interface ConditionSelectInputProps {
|
|
|
27
28
|
/** 不需要展示联动输入框的字段值 */
|
|
28
29
|
hiddenInputKeys?: ValueType['selectValue'][];
|
|
29
30
|
/** selectProps */
|
|
30
|
-
selectProps?:
|
|
31
|
+
selectProps?: ComplexValSelectProps<any>;
|
|
31
32
|
/** 联动inputProps */
|
|
32
33
|
conditionInputProps?: ConditionInputProps;
|
|
33
34
|
/** 联动selectProps */
|
|
34
|
-
conditionSelectProps?:
|
|
35
|
+
conditionSelectProps?: ComplexValSelectProps<any>;
|
|
35
36
|
/** onChange */
|
|
36
37
|
onChange?: (value: ValueType) => void;
|
|
37
38
|
/** onBlur */
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
value: v
|
|
23
|
+
});
|
|
24
|
+
} : function (o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) {
|
|
31
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
32
|
+
}
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
3
36
|
var __read = this && this.__read || function (o, n) {
|
|
4
37
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
38
|
if (!m) return o;
|
|
@@ -44,7 +77,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
44
77
|
exports.dateTypeEnum = void 0;
|
|
45
78
|
var lodash_1 = require("lodash");
|
|
46
79
|
var dateUtils_1 = __importDefault(require("aa-utils/lib/dateUtils"));
|
|
47
|
-
var messages_1 =
|
|
80
|
+
var messages_1 = __importStar(require("../messages"));
|
|
48
81
|
var dateTypeEnum;
|
|
49
82
|
(function (dateTypeEnum) {
|
|
50
83
|
dateTypeEnum[dateTypeEnum["TODAY"] = 1] = "TODAY";
|
|
@@ -74,68 +107,68 @@ var getDefaultRadioList = function getDefaultRadioList(_a) {
|
|
|
74
107
|
var now = (0, lodash_1.isNumber)(timeOffset) ? dateUtils_1["default"].getToday(timeOffset) : dateUtils_1["default"].getToday();
|
|
75
108
|
var allRadio = displayAllOption ? [{
|
|
76
109
|
key: dateTypeEnum.ALL,
|
|
77
|
-
text: (0, messages_1["default"])(messages,
|
|
110
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'all'),
|
|
78
111
|
value: [startTimeOfAllOption || dateUtils_1["default"].parseDate('2022/09/01'), now.endOf('day')]
|
|
79
112
|
}] : [];
|
|
80
113
|
var defaultRadioList = __spreadArray([{
|
|
81
114
|
key: dateTypeEnum.TODAY,
|
|
82
|
-
text: (0, messages_1["default"])(messages,
|
|
115
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'toDay'),
|
|
83
116
|
value: [now.clone().startOf('day'), now.clone().endOf('day')]
|
|
84
117
|
}, {
|
|
85
118
|
key: dateTypeEnum.YESTERDAY,
|
|
86
|
-
text: (0, messages_1["default"])(messages,
|
|
119
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'yesterDay'),
|
|
87
120
|
value: [now.clone().subtract(1, 'day').startOf('day'), now.clone().subtract(1, 'day').endOf('day')]
|
|
88
121
|
}, {
|
|
89
122
|
key: dateTypeEnum.WEEK,
|
|
90
|
-
text: (0, messages_1["default"])(messages,
|
|
123
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'week'),
|
|
91
124
|
value: [now.clone().startOf('week'), naturalDate ? now.clone().endOf('week') : now.clone().endOf('day')]
|
|
92
125
|
}, {
|
|
93
126
|
key: dateTypeEnum.LAST_WEEK,
|
|
94
|
-
text: (0, messages_1["default"])(messages,
|
|
127
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'lastWeek'),
|
|
95
128
|
value: [now.clone().subtract(1, 'week').startOf('week'), now.clone().subtract(1, 'week').endOf('week')]
|
|
96
129
|
}, {
|
|
97
130
|
key: dateTypeEnum.MONTH,
|
|
98
|
-
text: (0, messages_1["default"])(messages,
|
|
131
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'month'),
|
|
99
132
|
value: [now.clone().startOf('month'), naturalDate ? now.clone().endOf('month') : now.clone().endOf('day')]
|
|
100
133
|
}, {
|
|
101
134
|
key: dateTypeEnum.LAST_MONTH,
|
|
102
|
-
text: (0, messages_1["default"])(messages,
|
|
135
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'lastMonth'),
|
|
103
136
|
value: [now.clone().subtract(1, 'month').startOf('month'), now.clone().subtract(1, 'month').endOf('month')]
|
|
104
137
|
}, {
|
|
105
138
|
key: dateTypeEnum.QUARTER,
|
|
106
|
-
text: (0, messages_1["default"])(messages,
|
|
139
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'quarter'),
|
|
107
140
|
value: [now.clone().startOf('quarter'), naturalDate ? now.clone().endOf('quarter') : now.clone().endOf('day')]
|
|
108
141
|
}, {
|
|
109
142
|
key: dateTypeEnum.LAST_QUARTER,
|
|
110
|
-
text: (0, messages_1["default"])(messages,
|
|
143
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'lastQuarter'),
|
|
111
144
|
value: [now.clone().subtract(1, 'quarter').startOf('quarter'), now.clone().subtract(1, 'quarter').endOf('quarter')]
|
|
112
145
|
}, {
|
|
113
146
|
key: dateTypeEnum.YEAR,
|
|
114
|
-
text: (0, messages_1["default"])(messages,
|
|
147
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'year'),
|
|
115
148
|
value: [now.clone().startOf('year'), naturalDate ? now.clone().endOf('year') : now.endOf('day')]
|
|
116
149
|
}, {
|
|
117
150
|
key: dateTypeEnum.BEFORE_7_DAY,
|
|
118
|
-
text: (0, messages_1["default"])(messages,
|
|
151
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last7days'),
|
|
119
152
|
value: [now.clone().subtract(6, 'day').startOf('day'), now.endOf('day')]
|
|
120
153
|
}, {
|
|
121
154
|
key: dateTypeEnum.BEFORE_14_DAY,
|
|
122
|
-
text: (0, messages_1["default"])(messages,
|
|
155
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last14days'),
|
|
123
156
|
value: [now.clone().subtract(13, 'day').startOf('day'), now.endOf('day')]
|
|
124
157
|
}, {
|
|
125
158
|
key: dateTypeEnum.BEFORE_30_DAY,
|
|
126
|
-
text: (0, messages_1["default"])(messages,
|
|
159
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last30days'),
|
|
127
160
|
value: [now.clone().subtract(29, 'day').startOf('day'), now.endOf('day')]
|
|
128
161
|
}, {
|
|
129
162
|
key: dateTypeEnum.BEFORE_90_DAY,
|
|
130
|
-
text: (0, messages_1["default"])(messages,
|
|
163
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last90days'),
|
|
131
164
|
value: [now.clone().subtract(89, 'day').startOf('day'), now.endOf('day')]
|
|
132
165
|
}, {
|
|
133
166
|
key: dateTypeEnum.BEFORE_180_DAY,
|
|
134
|
-
text: (0, messages_1["default"])(messages,
|
|
167
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last180days'),
|
|
135
168
|
value: [now.clone().subtract(179, 'day').startOf('day'), now.endOf('day')]
|
|
136
169
|
}, {
|
|
137
170
|
key: dateTypeEnum.BEFORE_365_DAY,
|
|
138
|
-
text: (0, messages_1["default"])(messages,
|
|
171
|
+
text: (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'last365days'),
|
|
139
172
|
value: [now.clone().subtract(364, 'day').startOf('day'), now.endOf('day')]
|
|
140
173
|
}], __read(allRadio), false);
|
|
141
174
|
return defaultRadioList;
|
|
@@ -96,7 +96,7 @@ var omit_1 = __importDefault(require("lodash/omit"));
|
|
|
96
96
|
var defaultRadioList_1 = __importDefault(require("./defaultRadioList"));
|
|
97
97
|
var label_range_picker_1 = __importDefault(require("../label-range-picker"));
|
|
98
98
|
var context_1 = __importDefault(require("../config-provider/context"));
|
|
99
|
-
var messages_1 =
|
|
99
|
+
var messages_1 = __importStar(require("../messages"));
|
|
100
100
|
var utils_1 = require("./utils");
|
|
101
101
|
var RangePicker = date_picker_1["default"].RangePicker;
|
|
102
102
|
var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
@@ -261,7 +261,7 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
261
261
|
onChange: onDiyTimeChange
|
|
262
262
|
}), react_1["default"].createElement("span", {
|
|
263
263
|
className: "customize-select-text"
|
|
264
|
-
}, (0, messages_1["default"])(messages,
|
|
264
|
+
}, (0, messages_1["default"])(messages, messages_1.langTypeEnum.labelCustomizeRangePicker, 'customTime')))), isVisiblePanel ? react_1["default"].createElement("div", {
|
|
265
265
|
className: "panel"
|
|
266
266
|
}, panel) : react_1["default"].createElement("div", {
|
|
267
267
|
className: "pick-box"
|
package/lib/messages/index.d.ts
CHANGED
|
@@ -20,10 +20,12 @@ export declare type LabelCustomizeRangePickerType = {
|
|
|
20
20
|
export declare type Global = {
|
|
21
21
|
placeholder: string;
|
|
22
22
|
};
|
|
23
|
-
export declare
|
|
23
|
+
export declare enum langTypeEnum {
|
|
24
|
+
labelCustomizeRangePicker = "labelCustomizeRangePicker",
|
|
25
|
+
global = "global"
|
|
26
|
+
}
|
|
24
27
|
export declare type LangType = {
|
|
25
|
-
labelCustomizeRangePicker: LabelCustomizeRangePickerType;
|
|
26
|
-
global: Global;
|
|
28
|
+
[langTypeEnum.labelCustomizeRangePicker]: LabelCustomizeRangePickerType;
|
|
29
|
+
[langTypeEnum.global]: Global;
|
|
27
30
|
};
|
|
28
|
-
export
|
|
29
|
-
export default function formatMessage(message: LangType, displayName: DisplayNameType, key: keyof All): any;
|
|
31
|
+
export default function formatMessage<T extends LangType, K extends keyof T>(message: Record<K, T[K]>, displayName: K, key: keyof T[K]): Record<K, T[K]>[K][keyof T[K]];
|
package/lib/messages/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.langTypeEnum = void 0;
|
|
7
|
+
var langTypeEnum;
|
|
8
|
+
(function (langTypeEnum) {
|
|
9
|
+
langTypeEnum["labelCustomizeRangePicker"] = "labelCustomizeRangePicker";
|
|
10
|
+
langTypeEnum["global"] = "global";
|
|
11
|
+
})(langTypeEnum = exports.langTypeEnum || (exports.langTypeEnum = {}));
|
|
6
12
|
function formatMessage(message, displayName, key) {
|
|
7
13
|
return message[displayName][key];
|
|
8
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.71",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"node": ">=10.0.0"
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "fc3a7c7f61f1fd586dfb7d28e0bf6b83f2f73610"
|
|
84
84
|
}
|