assui 3.1.67 → 3.1.69

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.
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { SelectProps } from 'antd/lib/select';
3
+ declare const Option: import("rc-select/lib/Option").OptionFC;
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'> {
7
+ value?: T;
8
+ onChange?: (val: T, opt: SelectProps['options']) => void;
9
+ }
10
+ declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ValueType> & React.RefAttributes<unknown>>;
11
+ export default ComplexValSelect;
@@ -0,0 +1,90 @@
1
+ var __assign = this && this.__assign || function () {
2
+ __assign = Object.assign || function (t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) {
6
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
7
+ }
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __read = this && this.__read || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o),
17
+ r,
18
+ ar = [],
19
+ e;
20
+ try {
21
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
22
+ ar.push(r.value);
23
+ }
24
+ } catch (error) {
25
+ e = {
26
+ error: error
27
+ };
28
+ } finally {
29
+ try {
30
+ if (r && !r.done && (m = i["return"])) m.call(i);
31
+ } finally {
32
+ if (e) throw e.error;
33
+ }
34
+ }
35
+ return ar;
36
+ };
37
+ import * as React from 'react';
38
+ import omit from 'lodash/omit';
39
+ import find from 'lodash/find';
40
+ import some from 'lodash/some';
41
+ import isArray from 'lodash/isArray';
42
+ import isObject from 'lodash/isObject';
43
+ import Select from "antd/es/select";
44
+ import useControllableValue from "ahooks/es/useControllableValue";
45
+ var Option = Select.Option;
46
+ export { Option };
47
+ var ComplexValSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
48
+ var _a = __read(useControllableValue(props), 2),
49
+ value = _a[0],
50
+ setValue = _a[1];
51
+ var options = props.options,
52
+ onChange = props.onChange,
53
+ onSelect = props.onSelect;
54
+ var selectRef = React.useRef(null);
55
+ React.useImperativeHandle(ref, function () {
56
+ return selectRef.current;
57
+ });
58
+ // 判断是否需要将optionValue转为JSON字符串
59
+ var isReferenceTypeVal = some(options, function (item) {
60
+ return isArray(item.value) || isObject(item.value);
61
+ });
62
+ var finalOptions = isReferenceTypeVal ? options === null || options === void 0 ? void 0 : options.map(function (item) {
63
+ return __assign(__assign({}, item), {
64
+ value: JSON.stringify(item.value)
65
+ });
66
+ }) : options;
67
+ var handleChange = function handleChange(val) {
68
+ var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
69
+ setValue(nextVal);
70
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
71
+ };
72
+ var handleSelect = function handleSelect(val) {
73
+ var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
74
+ var selectOption = find(finalOptions, {
75
+ value: val
76
+ });
77
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, {
78
+ label: selectOption.label,
79
+ value: nextVal
80
+ });
81
+ };
82
+ return /*#__PURE__*/React.createElement(Select, __assign({
83
+ ref: selectRef,
84
+ value: isReferenceTypeVal ? JSON.stringify(value) : value,
85
+ options: finalOptions,
86
+ onChange: handleChange,
87
+ onSelect: handleSelect
88
+ }, omit(props, ['value', 'onChange', 'options', 'onSelect'])));
89
+ });
90
+ export default ComplexValSelect;
@@ -0,0 +1 @@
1
+ import 'antd/lib/select/style';
@@ -0,0 +1 @@
1
+ import "antd/es/select/style";
@@ -37,7 +37,7 @@ var __read = this && this.__read || function (o, n) {
37
37
  import isNil from 'lodash/isNil';
38
38
  import isEmpty from 'lodash/isEmpty';
39
39
  import classNames from 'classnames';
40
- import Select from "antd/es/select";
40
+ import ComplexValSelect from '../complex-val-select';
41
41
  import React, { useEffect, useState } from 'react';
42
42
  import useControllableValue from "ahooks/es/useControllableValue";
43
43
  import ConditionInput from '../condition-input';
@@ -170,7 +170,7 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
170
170
  }
171
171
  }))) : /*#__PURE__*/React.createElement("div", {
172
172
  className: "condition-select-select-input"
173
- }, /*#__PURE__*/React.createElement(Select, __assign({}, conditionSelectProps, {
173
+ }, /*#__PURE__*/React.createElement(ComplexValSelect, __assign({}, conditionSelectProps, {
174
174
  onChange: onTypeSelectChange,
175
175
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
176
176
  options: subSelectOptions,
@@ -186,7 +186,7 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
186
186
  'condition-two-select-selecter': !isInput,
187
187
  'condition-only-selecter': !isShowInput
188
188
  })
189
- }, /*#__PURE__*/React.createElement(Select, __assign({}, selectProps, {
189
+ }, /*#__PURE__*/React.createElement(ComplexValSelect, __assign({}, selectProps, {
190
190
  onChange: onSelectChange,
191
191
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
192
192
  options: optionsList,
package/es/index.d.ts CHANGED
@@ -82,3 +82,5 @@ export type { LabelConditionSelectInputProps } from './label-condition-select-in
82
82
  export { default as LabelConditionSelectInput } from './label-condition-select-input';
83
83
  export type { MultipartUploadProps } from './multipart-upload';
84
84
  export { default as MultipartUpload } from './multipart-upload';
85
+ export type { ComplexValSelectProps } from './complex-val-select';
86
+ export { default as ComplexValSelect } from './complex-val-select';
package/es/index.js CHANGED
@@ -41,4 +41,5 @@ export { default as BeautifulDnd } from './beautiful-dnd';
41
41
  export { default as Resizable } from './resizable';
42
42
  export { default as Flex } from './flex';
43
43
  export { default as LabelConditionSelectInput } from './label-condition-select-input';
44
- export { default as MultipartUpload } from './multipart-upload';
44
+ export { default as MultipartUpload } from './multipart-upload';
45
+ export { default as ComplexValSelect } from './complex-val-select';
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { SelectProps } from 'antd/lib/select';
3
+ import type { ComplexValSelectProps } from '../complex-val-select';
3
4
  declare const Option: import("rc-select/lib/Option").OptionFC;
4
5
  export { Option };
5
- export interface LabelSelectProps extends SelectProps {
6
+ export interface LabelSelectProps extends ComplexValSelectProps<any> {
6
7
  label?: React.ReactNode;
7
8
  onBlur?: (value: SelectProps['value']) => void;
8
9
  }
@@ -37,6 +37,7 @@ var __read = this && this.__read || function (o, n) {
37
37
  import React from 'react';
38
38
  import useControllableValue from "ahooks/es/useControllableValue";
39
39
  import Select from "antd/es/select";
40
+ import ComplexValSelect from '../complex-val-select';
40
41
  import isArray from 'lodash/isArray';
41
42
  import isUndefined from 'lodash/isUndefined';
42
43
  import isNull from 'lodash/isNull';
@@ -82,7 +83,7 @@ var LabelSelect = function LabelSelect(props, ref) {
82
83
  'label-select': true,
83
84
  'label-select-label-scale': open || !isArray(value) && !isUndefined(value) && !isNull(value) || isArray(value) && value.length
84
85
  }, className)
85
- }, /*#__PURE__*/React.createElement(Select, __assign({
86
+ }, /*#__PURE__*/React.createElement(ComplexValSelect, __assign({
86
87
  maxTagCount: 3,
87
88
  showSearch: false
88
89
  }, omit(props, ['open', 'onChange', 'className', 'label', 'setOpen', 'isFocus']), {
@@ -103,6 +104,5 @@ var LabelSelect = function LabelSelect(props, ref) {
103
104
  onClick: handleLabelClick
104
105
  }, label));
105
106
  };
106
- // export default LabelSelect;
107
107
  var ForwardRefLabelSelect = /*#__PURE__*/React.forwardRef(LabelSelect);
108
108
  export default ForwardRefLabelSelect;
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import type { SelectProps } from 'antd/lib/select';
3
+ declare const Option: import("rc-select/lib/Option").OptionFC;
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'> {
7
+ value?: T;
8
+ onChange?: (val: T, opt: SelectProps['options']) => void;
9
+ }
10
+ declare const ComplexValSelect: React.ForwardRefExoticComponent<ComplexValSelectProps<ValueType> & React.RefAttributes<unknown>>;
11
+ export default ComplexValSelect;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) {
8
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+ }
11
+ return t;
12
+ };
13
+ return __assign.apply(this, arguments);
14
+ };
15
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = {
20
+ enumerable: true,
21
+ get: function get() {
22
+ return m[k];
23
+ }
24
+ };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ } : function (o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ });
31
+ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
32
+ Object.defineProperty(o, "default", {
33
+ enumerable: true,
34
+ value: v
35
+ });
36
+ } : function (o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = this && this.__importStar || function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k in mod) {
43
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
44
+ }
45
+ __setModuleDefault(result, mod);
46
+ return result;
47
+ };
48
+ var __read = this && this.__read || function (o, n) {
49
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
50
+ if (!m) return o;
51
+ var i = m.call(o),
52
+ r,
53
+ ar = [],
54
+ e;
55
+ try {
56
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
57
+ ar.push(r.value);
58
+ }
59
+ } catch (error) {
60
+ e = {
61
+ error: error
62
+ };
63
+ } finally {
64
+ try {
65
+ if (r && !r.done && (m = i["return"])) m.call(i);
66
+ } finally {
67
+ if (e) throw e.error;
68
+ }
69
+ }
70
+ return ar;
71
+ };
72
+ var __importDefault = this && this.__importDefault || function (mod) {
73
+ return mod && mod.__esModule ? mod : {
74
+ "default": mod
75
+ };
76
+ };
77
+ Object.defineProperty(exports, "__esModule", {
78
+ value: true
79
+ });
80
+ exports.Option = void 0;
81
+ var React = __importStar(require("react"));
82
+ var omit_1 = __importDefault(require("lodash/omit"));
83
+ var find_1 = __importDefault(require("lodash/find"));
84
+ var some_1 = __importDefault(require("lodash/some"));
85
+ var isArray_1 = __importDefault(require("lodash/isArray"));
86
+ var isObject_1 = __importDefault(require("lodash/isObject"));
87
+ var select_1 = __importDefault(require("antd/lib/select"));
88
+ var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
89
+ var Option = select_1["default"].Option;
90
+ exports.Option = Option;
91
+ var ComplexValSelect = React.forwardRef(function (props, ref) {
92
+ var _a = __read((0, useControllableValue_1["default"])(props), 2),
93
+ value = _a[0],
94
+ setValue = _a[1];
95
+ var options = props.options,
96
+ onChange = props.onChange,
97
+ onSelect = props.onSelect;
98
+ var selectRef = React.useRef(null);
99
+ React.useImperativeHandle(ref, function () {
100
+ return selectRef.current;
101
+ });
102
+ // 判断是否需要将optionValue转为JSON字符串
103
+ var isReferenceTypeVal = (0, some_1["default"])(options, function (item) {
104
+ return (0, isArray_1["default"])(item.value) || (0, isObject_1["default"])(item.value);
105
+ });
106
+ var finalOptions = isReferenceTypeVal ? options === null || options === void 0 ? void 0 : options.map(function (item) {
107
+ return __assign(__assign({}, item), {
108
+ value: JSON.stringify(item.value)
109
+ });
110
+ }) : options;
111
+ var handleChange = function handleChange(val) {
112
+ var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
113
+ setValue(nextVal);
114
+ onChange === null || onChange === void 0 ? void 0 : onChange(nextVal, options);
115
+ };
116
+ var handleSelect = function handleSelect(val) {
117
+ var nextVal = isReferenceTypeVal ? JSON.parse(val) : val;
118
+ var selectOption = (0, find_1["default"])(finalOptions, {
119
+ value: val
120
+ });
121
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextVal, {
122
+ label: selectOption.label,
123
+ value: nextVal
124
+ });
125
+ };
126
+ return React.createElement(select_1["default"], __assign({
127
+ ref: selectRef,
128
+ value: isReferenceTypeVal ? JSON.stringify(value) : value,
129
+ options: finalOptions,
130
+ onChange: handleChange,
131
+ onSelect: handleSelect
132
+ }, (0, omit_1["default"])(props, ['value', 'onChange', 'options', 'onSelect'])));
133
+ });
134
+ exports["default"] = ComplexValSelect;
@@ -0,0 +1 @@
1
+ import 'antd/lib/select/style';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ require("antd/lib/select/style");
@@ -81,7 +81,7 @@ exports.EntryTypeEnum = exports.InputTypeEnum = void 0;
81
81
  var isNil_1 = __importDefault(require("lodash/isNil"));
82
82
  var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
83
83
  var classnames_1 = __importDefault(require("classnames"));
84
- var select_1 = __importDefault(require("antd/lib/select"));
84
+ var complex_val_select_1 = __importDefault(require("../complex-val-select"));
85
85
  var react_1 = __importStar(require("react"));
86
86
  var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
87
87
  var condition_input_1 = __importDefault(require("../condition-input"));
@@ -214,7 +214,7 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
214
214
  }
215
215
  }))) : react_1["default"].createElement("div", {
216
216
  className: "condition-select-select-input"
217
- }, react_1["default"].createElement(select_1["default"], __assign({}, conditionSelectProps, {
217
+ }, react_1["default"].createElement(complex_val_select_1["default"], __assign({}, conditionSelectProps, {
218
218
  onChange: onTypeSelectChange,
219
219
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.inputValue,
220
220
  options: subSelectOptions,
@@ -230,7 +230,7 @@ var ConditionSelectInput = function ConditionSelectInput(props) {
230
230
  'condition-two-select-selecter': !isInput,
231
231
  'condition-only-selecter': !isShowInput
232
232
  })
233
- }, react_1["default"].createElement(select_1["default"], __assign({}, selectProps, {
233
+ }, react_1["default"].createElement(complex_val_select_1["default"], __assign({}, selectProps, {
234
234
  onChange: onSelectChange,
235
235
  value: selectInputValue === null || selectInputValue === void 0 ? void 0 : selectInputValue.selectValue,
236
236
  options: optionsList,
package/lib/index.d.ts CHANGED
@@ -82,3 +82,5 @@ export type { LabelConditionSelectInputProps } from './label-condition-select-in
82
82
  export { default as LabelConditionSelectInput } from './label-condition-select-input';
83
83
  export type { MultipartUploadProps } from './multipart-upload';
84
84
  export { default as MultipartUpload } from './multipart-upload';
85
+ export type { ComplexValSelectProps } from './complex-val-select';
86
+ export { default as ComplexValSelect } from './complex-val-select';
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
8
8
  Object.defineProperty(exports, "__esModule", {
9
9
  value: true
10
10
  });
11
- exports.MultipartUpload = exports.LabelConditionSelectInput = exports.Flex = exports.Resizable = exports.BeautifulDnd = exports.RichTextEditor = exports.LabelCustomizeRangePicker = exports.TableCol = exports.LabelTreeSelect = exports.LabelConditionInput = exports.LabelNumberInput = exports.LabelAutoComplete = exports.LabelDatePicker = exports.LabelRangePicker = exports.JsonEditor = exports.AreaText = exports.LabelTextArea = exports.ASelect = exports.LabelSelect = exports.ColorSelect = exports.LabelInput = exports.TextInput = exports.TextArea = exports.SplitPane = exports.sortableHoc = exports.SingleImgUpload = exports.RcTransitionGroup = exports.RcQRcode = exports.RcEcharts = exports.StepNumberInput = exports.LabelRangeNumber = exports.NumberInput = exports.RcMotion = exports.KeepTab = exports.ImgCrop = exports.HighlightWords = exports.HighlightTextarea = exports.CopyToClipboard = exports.NumberFormatInput = exports.ConfigProvider = exports.ConditionSelectInput = exports.ConditionInput = exports.ButtonModal = exports.ButtonDrawer = void 0;
11
+ exports.ComplexValSelect = exports.MultipartUpload = exports.LabelConditionSelectInput = exports.Flex = exports.Resizable = exports.BeautifulDnd = exports.RichTextEditor = exports.LabelCustomizeRangePicker = exports.TableCol = exports.LabelTreeSelect = exports.LabelConditionInput = exports.LabelNumberInput = exports.LabelAutoComplete = exports.LabelDatePicker = exports.LabelRangePicker = exports.JsonEditor = exports.AreaText = exports.LabelTextArea = exports.ASelect = exports.LabelSelect = exports.ColorSelect = exports.LabelInput = exports.TextInput = exports.TextArea = exports.SplitPane = exports.sortableHoc = exports.SingleImgUpload = exports.RcTransitionGroup = exports.RcQRcode = exports.RcEcharts = exports.StepNumberInput = exports.LabelRangeNumber = exports.NumberInput = exports.RcMotion = exports.KeepTab = exports.ImgCrop = exports.HighlightWords = exports.HighlightTextarea = exports.CopyToClipboard = exports.NumberFormatInput = exports.ConfigProvider = exports.ConditionSelectInput = exports.ConditionInput = exports.ButtonModal = exports.ButtonDrawer = void 0;
12
12
  var button_drawer_1 = require("./button-drawer");
13
13
  Object.defineProperty(exports, "ButtonDrawer", {
14
14
  enumerable: true,
@@ -316,4 +316,11 @@ Object.defineProperty(exports, "MultipartUpload", {
316
316
  get: function get() {
317
317
  return __importDefault(multipart_upload_1)["default"];
318
318
  }
319
+ });
320
+ var complex_val_select_1 = require("./complex-val-select");
321
+ Object.defineProperty(exports, "ComplexValSelect", {
322
+ enumerable: true,
323
+ get: function get() {
324
+ return __importDefault(complex_val_select_1)["default"];
325
+ }
319
326
  });
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { SelectProps } from 'antd/lib/select';
3
+ import type { ComplexValSelectProps } from '../complex-val-select';
3
4
  declare const Option: import("rc-select/lib/Option").OptionFC;
4
5
  export { Option };
5
- export interface LabelSelectProps extends SelectProps {
6
+ export interface LabelSelectProps extends ComplexValSelectProps<any> {
6
7
  label?: React.ReactNode;
7
8
  onBlur?: (value: SelectProps['value']) => void;
8
9
  }
@@ -48,6 +48,7 @@ exports.Option = void 0;
48
48
  var react_1 = __importDefault(require("react"));
49
49
  var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
50
50
  var select_1 = __importDefault(require("antd/lib/select"));
51
+ var complex_val_select_1 = __importDefault(require("../complex-val-select"));
51
52
  var isArray_1 = __importDefault(require("lodash/isArray"));
52
53
  var isUndefined_1 = __importDefault(require("lodash/isUndefined"));
53
54
  var isNull_1 = __importDefault(require("lodash/isNull"));
@@ -93,7 +94,7 @@ var LabelSelect = function LabelSelect(props, ref) {
93
94
  'label-select': true,
94
95
  'label-select-label-scale': open || !(0, isArray_1["default"])(value) && !(0, isUndefined_1["default"])(value) && !(0, isNull_1["default"])(value) || (0, isArray_1["default"])(value) && value.length
95
96
  }, className)
96
- }, react_1["default"].createElement(select_1["default"], __assign({
97
+ }, react_1["default"].createElement(complex_val_select_1["default"], __assign({
97
98
  maxTagCount: 3,
98
99
  showSearch: false
99
100
  }, (0, omit_1["default"])(props, ['open', 'onChange', 'className', 'label', 'setOpen', 'isFocus']), {
@@ -114,6 +115,5 @@ var LabelSelect = function LabelSelect(props, ref) {
114
115
  onClick: handleLabelClick
115
116
  }, label));
116
117
  };
117
- // export default LabelSelect;
118
118
  var ForwardRefLabelSelect = react_1["default"].forwardRef(LabelSelect);
119
119
  exports["default"] = ForwardRefLabelSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "3.1.67",
3
+ "version": "3.1.69",
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": "021c35adaba09ce2abe3c75e7637f2cd20591a39"
83
+ "gitHead": "7093234ad09208aa396990803c7dcc52514eeda8"
84
84
  }