assui 3.1.69 → 3.1.70

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.
@@ -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 ValueType = string | number | any[] | Record<string, any> | null | undefined;
6
- export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange'> {
5
+ export declare type ComplexValSelectValueType = string | number | any[] | Record<string, any> | null | undefined;
6
+ export interface ComplexValSelectOptionType extends BaseOptionType {
7
+ label: React.ReactNode;
8
+ value?: ComplexValSelectValueType;
9
+ children?: Omit<ComplexValSelectOptionType, 'children'>[];
10
+ }
11
+ export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange' | 'options'> {
7
12
  value?: T;
8
- onChange?: (val: T, opt: SelectProps['options']) => void;
13
+ onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
14
+ options?: ComplexValSelectOptionType[];
9
15
  }
10
- declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ValueType> & React.RefAttributes<unknown>>;
16
+ declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
11
17
  export default ComplexValSelect;
@@ -65,23 +65,20 @@ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
65
65
  });
66
66
  }) : options;
67
67
  var handleChange = function handleChange(val) {
68
- var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
68
+ var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
69
69
  setValue(nextVal);
70
70
  onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
71
71
  };
72
72
  var handleSelect = function handleSelect(val) {
73
- var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
73
+ var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
74
74
  var selectOption = find(finalOptions, {
75
75
  value: val
76
76
  });
77
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, {
78
- label: selectOption.label,
79
- value: nextVal
80
- });
77
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, selectOption);
81
78
  };
82
79
  return /*#__PURE__*/React.createElement(Select, __assign({
83
80
  ref: selectRef,
84
- value: isReferenceTypeVal ? JSON.stringify(value) : value,
81
+ value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
85
82
  options: finalOptions,
86
83
  onChange: handleChange,
87
84
  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: number;
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?: number | string | null;
21
+ selectValue?: ComplexValSelectValueType;
21
22
  inputValue?: SelectProps['value'] | ConditionInputProps['value'];
22
- finalSelectValue?: SelectProps['value'] | ConditionInputProps['value'][];
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?: SelectProps;
31
+ selectProps?: ComplexValSelectProps<any>;
31
32
  /** 联动inputProps */
32
33
  conditionInputProps?: ConditionInputProps;
33
34
  /** 联动selectProps */
34
- conditionSelectProps?: SelectProps;
35
+ conditionSelectProps?: ComplexValSelectProps<any>;
35
36
  /** onChange */
36
37
  onChange?: (value: ValueType) => void;
37
38
  /** onBlur */
@@ -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 ValueType = string | number | any[] | Record<string, any> | null | undefined;
6
- export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange'> {
5
+ export declare type ComplexValSelectValueType = string | number | any[] | Record<string, any> | null | undefined;
6
+ export interface ComplexValSelectOptionType extends BaseOptionType {
7
+ label: React.ReactNode;
8
+ value?: ComplexValSelectValueType;
9
+ children?: Omit<ComplexValSelectOptionType, 'children'>[];
10
+ }
11
+ export interface ComplexValSelectProps<T> extends Omit<SelectProps, 'value' | 'onChange' | 'options'> {
7
12
  value?: T;
8
- onChange?: (val: T, opt: SelectProps['options']) => void;
13
+ onChange?: (val: T, opt?: ComplexValSelectOptionType[]) => void;
14
+ options?: ComplexValSelectOptionType[];
9
15
  }
10
- declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ValueType> & React.RefAttributes<unknown>>;
16
+ declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ComplexValSelectValueType> & React.RefAttributes<unknown>>;
11
17
  export default ComplexValSelect;
@@ -109,23 +109,20 @@ var ComplexValSelect = React.forwardRef(function (props, ref) {
109
109
  });
110
110
  }) : options;
111
111
  var handleChange = function handleChange(val) {
112
- var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
112
+ var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
113
113
  setValue(nextVal);
114
114
  onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
115
115
  };
116
116
  var handleSelect = function handleSelect(val) {
117
- var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
117
+ var nextVal = val && isReferenceTypeVal ? JSON.parse(val) : val;
118
118
  var selectOption = (0, find_1["default"])(finalOptions, {
119
119
  value: val
120
120
  });
121
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, {
122
- label: selectOption.label,
123
- value: nextVal
124
- });
121
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, selectOption);
125
122
  };
126
123
  return React.createElement(select_1["default"], __assign({
127
124
  ref: selectRef,
128
- value: isReferenceTypeVal ? JSON.stringify(value) : value,
125
+ value: value && isReferenceTypeVal ? JSON.stringify(value) : value,
129
126
  options: finalOptions,
130
127
  onChange: handleChange,
131
128
  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: number;
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?: number | string | null;
21
+ selectValue?: ComplexValSelectValueType;
21
22
  inputValue?: SelectProps['value'] | ConditionInputProps['value'];
22
- finalSelectValue?: SelectProps['value'] | ConditionInputProps['value'][];
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?: SelectProps;
31
+ selectProps?: ComplexValSelectProps<any>;
31
32
  /** 联动inputProps */
32
33
  conditionInputProps?: ConditionInputProps;
33
34
  /** 联动selectProps */
34
- conditionSelectProps?: SelectProps;
35
+ conditionSelectProps?: ComplexValSelectProps<any>;
35
36
  /** onChange */
36
37
  onChange?: (value: ValueType) => void;
37
38
  /** onBlur */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "3.1.69",
3
+ "version": "3.1.70",
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": "7093234ad09208aa396990803c7dcc52514eeda8"
83
+ "gitHead": "760171432a518656cf071adf933e1a64541b94bc"
84
84
  }