@zat-design/sisyphus-react 3.4.13-beta.7 → 3.4.13-beta.8

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.
@@ -706,7 +706,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
706
706
  }, 2000),
707
707
  style: {
708
708
  width: isView || disabled ? '100%' : 'calc(100% - 30px)'
709
- }
709
+ },
710
+ className: "ant-select-compact-item"
710
711
  }, omit(restProps, ['otherProps']))) : _jsx(_Input, _objectSpread({
711
712
  value: viewText,
712
713
  onChange: handleChangeValue,
@@ -63,12 +63,8 @@ export var ProSelect = function ProSelect(props, ref) {
63
63
  _useState2 = _slicedToArray(_useState, 2),
64
64
  viewFlag = _useState2[0],
65
65
  setViewFlag = _useState2[1];
66
- var _useState3 = useState(),
67
- _useState4 = _slicedToArray(_useState3, 2),
68
- inputEl = _useState4[0],
69
- setInputEl = _useState4[1];
70
- var refSelect1 = useRef((Math.random() * 100).toFixed(0));
71
- var _useInViewport = useInViewport(inputEl),
66
+ var refSelect1 = useRef();
67
+ var _useInViewport = useInViewport(refSelect1),
72
68
  _useInViewport2 = _slicedToArray(_useInViewport, 1),
73
69
  inViewport = _useInViewport2[0];
74
70
  selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
@@ -81,15 +77,15 @@ export var ProSelect = function ProSelect(props, ref) {
81
77
  code = fieldNames.value;
82
78
  label = fieldNames.label;
83
79
  }
84
- var _useState5 = useState(dataSource || []),
85
- _useState6 = _slicedToArray(_useState5, 2),
86
- selectList = _useState6[0],
87
- setSelectList = _useState6[1];
80
+ var _useState3 = useState(dataSource || []),
81
+ _useState4 = _slicedToArray(_useState3, 2),
82
+ selectList = _useState4[0],
83
+ setSelectList = _useState4[1];
88
84
  // 用来控制只有第一次才会设置 defaultOne 属性、🔒
89
- var _useState7 = useState(false),
90
- _useState8 = _slicedToArray(_useState7, 2),
91
- isDefaultOne = _useState8[0],
92
- setIsDefaultOne = _useState8[1];
85
+ var _useState5 = useState(false),
86
+ _useState6 = _slicedToArray(_useState5, 2),
87
+ isDefaultOne = _useState6[0],
88
+ setIsDefaultOne = _useState6[1];
93
89
  var OptionRender = optionRender;
94
90
  var defaultOnSuccessFun = function defaultOnSuccessFun(res) {
95
91
  var _res$status = res.status,
@@ -160,12 +156,6 @@ export var ProSelect = function ProSelect(props, ref) {
160
156
  setViewFlag(true);
161
157
  }
162
158
  }, [inViewport]);
163
- useEffect(function () {
164
- var el = document.getElementById(refSelect1 === null || refSelect1 === void 0 ? void 0 : refSelect1.current);
165
- if (el) {
166
- setInputEl(el);
167
- }
168
- }, []);
169
159
  // disable默认值
170
160
  if (defaultDisableValue) {
171
161
  return _jsx("span", {
@@ -310,46 +300,51 @@ export var ProSelect = function ProSelect(props, ref) {
310
300
  fieldNames: fieldNames
311
301
  });
312
302
  }
313
- return _jsx(_Select, _objectSpread(_objectSpread({
314
- id: refSelect1.current,
315
- placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProSelect = locale.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
316
- allowClear: true,
317
- showArrow: true,
318
- loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
319
- onChange: handleChange,
320
- optionLabelProp: "children" // 解决warning报错,添加默认值
321
- ,
322
- showSearch: true,
323
- filterOption: isFunction(_onSearch) ? false : function (input, option) {
324
- var _option$children, _option$children$prop;
325
- var value = isString(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
326
- return value.toLowerCase().includes(input.toLowerCase());
327
- },
328
- onSearch: function onSearch(value) {
329
- _onSearch && _onSearch(value, _objectSpread({}, fetchFunction));
330
- },
331
- getPopupContainer: function getPopupContainer(trigger) {
332
- return scrollFollowParent ? trigger.parentElement : document.body;
333
- }
334
- }, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name'])), {}, {
335
- value: transformValue(),
336
- children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
337
- return _jsx(Option, {
338
- value: item[code],
339
- record: item,
340
- disabled: !!item.disabled,
341
- children: _jsx(TooltipOption, {
342
- title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
343
- children: OptionRender ? _jsx("span", {
344
- title: OptionRender(item),
345
- children: OptionRender(item)
346
- }) : _jsx("span", {
347
- title: "".concat(item[code], "-").concat(item[label]),
348
- children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
349
- })
350
- }, item[code])
351
- }, item[code]);
352
- })
353
- }));
303
+ return _jsx("div", {
304
+ ref: refSelect1,
305
+ style: props.style,
306
+ className: props.className,
307
+ children: _jsx(_Select, _objectSpread(_objectSpread({
308
+ // id={refSelect1.current}
309
+ placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProSelect = locale.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
310
+ allowClear: true,
311
+ showArrow: true,
312
+ loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
313
+ onChange: handleChange,
314
+ optionLabelProp: "children" // 解决warning报错,添加默认值
315
+ ,
316
+ showSearch: true,
317
+ filterOption: isFunction(_onSearch) ? false : function (input, option) {
318
+ var _option$children, _option$children$prop;
319
+ var value = isString(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
320
+ return value.toLowerCase().includes(input.toLowerCase());
321
+ },
322
+ onSearch: function onSearch(value) {
323
+ _onSearch && _onSearch(value, _objectSpread({}, fetchFunction));
324
+ },
325
+ getPopupContainer: function getPopupContainer(trigger) {
326
+ return scrollFollowParent ? trigger.parentElement : document.body;
327
+ }
328
+ }, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style', 'className'])), {}, {
329
+ value: transformValue(),
330
+ children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
331
+ return _jsx(Option, {
332
+ value: item[code],
333
+ record: item,
334
+ disabled: !!item.disabled,
335
+ children: _jsx(TooltipOption, {
336
+ title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
337
+ children: OptionRender ? _jsx("span", {
338
+ title: OptionRender(item),
339
+ children: OptionRender(item)
340
+ }) : _jsx("span", {
341
+ title: "".concat(item[code], "-").concat(item[label]),
342
+ children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
343
+ })
344
+ }, item[code])
345
+ }, item[code]);
346
+ })
347
+ }))
348
+ });
354
349
  };
355
350
  export default /*#__PURE__*/forwardRef(ProSelect);
@@ -9,3 +9,8 @@
9
9
  text-overflow: ellipsis;
10
10
  word-break: keep-all;
11
11
  }
12
+ .ant-select-compact-item {
13
+ >.ant-select {
14
+ width: 100%;
15
+ }
16
+ }
@@ -703,7 +703,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
703
703
  }, 2000),
704
704
  style: {
705
705
  width: isView || disabled ? '100%' : 'calc(100% - 30px)'
706
- }
706
+ },
707
+ className: "ant-select-compact-item"
707
708
  }, (0, _lodash.omit)(restProps, ['otherProps']))) : (0, _jsxRuntime.jsx)(_antd.Input, (0, _objectSpread3.default)({
708
709
  value: viewText,
709
710
  onChange: handleChangeValue,
@@ -64,12 +64,8 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
64
64
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
65
65
  viewFlag = _useState2[0],
66
66
  setViewFlag = _useState2[1];
67
- var _useState3 = (0, _react.useState)(),
68
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
69
- inputEl = _useState4[0],
70
- setInputEl = _useState4[1];
71
- var refSelect1 = (0, _react.useRef)((Math.random() * 100).toFixed(0));
72
- var _useInViewport = (0, _ahooks.useInViewport)(inputEl),
67
+ var refSelect1 = (0, _react.useRef)();
68
+ var _useInViewport = (0, _ahooks.useInViewport)(refSelect1),
73
69
  _useInViewport2 = (0, _slicedToArray2.default)(_useInViewport, 1),
74
70
  inViewport = _useInViewport2[0];
75
71
  selectProps.showCodeName = (_selectProps$showCode = selectProps.showCodeName) !== null && _selectProps$showCode !== void 0 ? _selectProps$showCode : showCodeName;
@@ -82,15 +78,15 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
82
78
  code = fieldNames.value;
83
79
  label = fieldNames.label;
84
80
  }
85
- var _useState5 = (0, _react.useState)(dataSource || []),
86
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
87
- selectList = _useState6[0],
88
- setSelectList = _useState6[1];
81
+ var _useState3 = (0, _react.useState)(dataSource || []),
82
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
83
+ selectList = _useState4[0],
84
+ setSelectList = _useState4[1];
89
85
  // 用来控制只有第一次才会设置 defaultOne 属性、🔒
90
- var _useState7 = (0, _react.useState)(false),
91
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
92
- isDefaultOne = _useState8[0],
93
- setIsDefaultOne = _useState8[1];
86
+ var _useState5 = (0, _react.useState)(false),
87
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
88
+ isDefaultOne = _useState6[0],
89
+ setIsDefaultOne = _useState6[1];
94
90
  var OptionRender = optionRender;
95
91
  var defaultOnSuccessFun = function defaultOnSuccessFun(res) {
96
92
  var _res$status = res.status,
@@ -161,12 +157,6 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
161
157
  setViewFlag(true);
162
158
  }
163
159
  }, [inViewport]);
164
- (0, _react.useEffect)(function () {
165
- var el = document.getElementById(refSelect1 === null || refSelect1 === void 0 ? void 0 : refSelect1.current);
166
- if (el) {
167
- setInputEl(el);
168
- }
169
- }, []);
170
160
  // disable默认值
171
161
  if (defaultDisableValue) {
172
162
  return (0, _jsxRuntime.jsx)("span", {
@@ -311,46 +301,53 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
311
301
  fieldNames: fieldNames
312
302
  });
313
303
  }
314
- return (0, _jsxRuntime.jsx)(_antd.Select, (0, _objectSpread2.default)((0, _objectSpread2.default)({
315
- id: refSelect1.current,
316
- placeholder: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProSelect = _locale.default.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
317
- allowClear: true,
318
- showArrow: true,
319
- loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
320
- onChange: handleChange,
321
- optionLabelProp: "children" // 解决warning报错,添加默认值
322
- ,
323
- showSearch: true,
324
- filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
325
- var _option$children, _option$children$prop;
326
- var value = (0, _lodash.isString)(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
327
- return value.toLowerCase().includes(input.toLowerCase());
328
- },
329
- onSearch: function onSearch(value) {
330
- _onSearch && _onSearch(value, (0, _objectSpread2.default)({}, fetchFunction));
331
- },
332
- getPopupContainer: function getPopupContainer(trigger) {
333
- return scrollFollowParent ? trigger.parentElement : document.body;
334
- }
335
- }, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name'])), {}, {
336
- value: transformValue(),
337
- children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
338
- return (0, _jsxRuntime.jsx)(Option, {
339
- value: item[code],
340
- record: item,
341
- disabled: !!item.disabled,
342
- children: (0, _jsxRuntime.jsx)(TooltipOption, {
343
- title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
344
- children: OptionRender ? (0, _jsxRuntime.jsx)("span", {
345
- title: OptionRender(item),
346
- children: OptionRender(item)
347
- }) : (0, _jsxRuntime.jsx)("span", {
348
- title: "".concat(item[code], "-").concat(item[label]),
349
- children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
350
- })
351
- }, item[code])
352
- }, item[code]);
353
- })
354
- }));
304
+ return (0, _jsxRuntime.jsx)("div", {
305
+ ref: refSelect1,
306
+ style: props.style,
307
+ className: props.className,
308
+ children: (0, _jsxRuntime.jsx)(_antd.Select
309
+ // id={refSelect1.current}
310
+ , (0, _objectSpread2.default)((0, _objectSpread2.default)({
311
+ // id={refSelect1.current}
312
+ placeholder: _locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProSelect = _locale.default.ProSelect) === null || _locale$ProSelect === void 0 ? void 0 : _locale$ProSelect.select,
313
+ allowClear: true,
314
+ showArrow: true,
315
+ loading: fetchFunction === null || fetchFunction === void 0 ? void 0 : fetchFunction.loading,
316
+ onChange: handleChange,
317
+ optionLabelProp: "children" // 解决warning报错,添加默认值
318
+ ,
319
+ showSearch: true,
320
+ filterOption: (0, _lodash.isFunction)(_onSearch) ? false : function (input, option) {
321
+ var _option$children, _option$children$prop;
322
+ var value = (0, _lodash.isString)(option === null || option === void 0 ? void 0 : option.children) ? option === null || option === void 0 ? void 0 : option.children : option === null || option === void 0 ? void 0 : (_option$children = option.children) === null || _option$children === void 0 ? void 0 : (_option$children$prop = _option$children.props) === null || _option$children$prop === void 0 ? void 0 : _option$children$prop.title;
323
+ return value.toLowerCase().includes(input.toLowerCase());
324
+ },
325
+ onSearch: function onSearch(value) {
326
+ _onSearch && _onSearch(value, (0, _objectSpread2.default)({}, fetchFunction));
327
+ },
328
+ getPopupContainer: function getPopupContainer(trigger) {
329
+ return scrollFollowParent ? trigger.parentElement : document.body;
330
+ }
331
+ }, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style', 'className'])), {}, {
332
+ value: transformValue(),
333
+ children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
334
+ return (0, _jsxRuntime.jsx)(Option, {
335
+ value: item[code],
336
+ record: item,
337
+ disabled: !!item.disabled,
338
+ children: (0, _jsxRuntime.jsx)(TooltipOption, {
339
+ title: OptionRender ? OptionRender(item) : selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label],
340
+ children: OptionRender ? (0, _jsxRuntime.jsx)("span", {
341
+ title: OptionRender(item),
342
+ children: OptionRender(item)
343
+ }) : (0, _jsxRuntime.jsx)("span", {
344
+ title: "".concat(item[code], "-").concat(item[label]),
345
+ children: selectProps.showCodeName ? "".concat(item[code], "-").concat(item[label]) : item[label]
346
+ })
347
+ }, item[code])
348
+ }, item[code]);
349
+ })
350
+ }))
351
+ });
355
352
  };
356
353
  var _default = exports.default = /*#__PURE__*/(0, _react.forwardRef)(ProSelect);
@@ -9,3 +9,8 @@
9
9
  text-overflow: ellipsis;
10
10
  word-break: keep-all;
11
11
  }
12
+ .ant-select-compact-item {
13
+ >.ant-select {
14
+ width: 100%;
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.13-beta.7",
3
+ "version": "3.4.13-beta.8",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",