@bit-sun/business-component 4.0.13-alpha.27 → 4.0.13-alpha.29

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/dist/index.esm.js CHANGED
@@ -3215,7 +3215,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3215
3215
  title = _this$props3.title,
3216
3216
  notValid = _this$props3.notValid,
3217
3217
  notExcelImport = _this$props3.notExcelImport,
3218
- excelImportConfig = _this$props3.excelImportConfig;
3218
+ excelImportConfig = _this$props3.excelImportConfig,
3219
+ getTemplate = _this$props3.getTemplate;
3219
3220
  var _ref5 = excelImportConfig || {},
3220
3221
  size = _ref5.size,
3221
3222
  accept = _ref5.accept,
@@ -3283,7 +3284,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3283
3284
  style: {
3284
3285
  color: 'red'
3285
3286
  }
3286
- }, "\uFF08\u9F20\u6807\u79FB\u5165\u611F\u53F9\u53F7\u56FE\u6807\u67E5\u770B\u5BFC\u5165\u4F7F\u7528\u8BF4\u660E\uFF09")), /*#__PURE__*/React$1.createElement(Space, null, !notExcelImport && ( /*#__PURE__*/React$1.createElement(Upload, _objectSpread2({}, uploadProps), /*#__PURE__*/React$1.createElement(Button, null, "\u5BFC\u5165"))), /*#__PURE__*/React$1.createElement(Dropdown, {
3287
+ }, "\uFF08\u9F20\u6807\u79FB\u5165\u611F\u53F9\u53F7\u56FE\u6807\u67E5\u770B\u5BFC\u5165\u4F7F\u7528\u8BF4\u660E\uFF09")), /*#__PURE__*/React$1.createElement(Space, null, !notExcelImport && ( /*#__PURE__*/React$1.createElement(React$1.Fragment, null, getTemplate && ( /*#__PURE__*/React$1.createElement(Button, {
3288
+ ghost: true,
3289
+ type: "primary",
3290
+ onClick: getTemplate
3291
+ }, "\u4E0B\u8F7D\u6A21\u677F")), /*#__PURE__*/React$1.createElement(Upload, _objectSpread2({}, uploadProps), /*#__PURE__*/React$1.createElement(Button, null, "\u5BFC\u5165")))), /*#__PURE__*/React$1.createElement(Dropdown, {
3287
3292
  trigger: ['click'],
3288
3293
  overlay: this.menuList,
3289
3294
  placement: "bottomRight"
@@ -7408,6 +7413,7 @@ var AddSelect = function AddSelect(props) {
7408
7413
  clearTitle = props.clearTitle;
7409
7414
  var _ref = requestConfig || {},
7410
7415
  url = _ref.url,
7416
+ sourceKey = _ref.sourceKey,
7411
7417
  otherParams = _ref.otherParams,
7412
7418
  isMap = _ref.isMap,
7413
7419
  _ref$mappingValueFiel = _ref.mappingValueField,
@@ -8000,7 +8006,7 @@ var AddSelect = function AddSelect(props) {
8000
8006
  };
8001
8007
  });
8002
8008
  } else {
8003
- var keys = res.list ? 'list' : 'items';
8009
+ var keys = sourceKey ? sourceKey : res.list ? 'list' : 'items';
8004
8010
  source = res ? res[keys] ? res[keys].map(function (item) {
8005
8011
  var _item$packingUnitList, _item$packingUnitList2;
8006
8012
  return _objectSpread2(_objectSpread2({}, item), {}, {
package/dist/index.js CHANGED
@@ -3238,7 +3238,8 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3238
3238
  title = _this$props3.title,
3239
3239
  notValid = _this$props3.notValid,
3240
3240
  notExcelImport = _this$props3.notExcelImport,
3241
- excelImportConfig = _this$props3.excelImportConfig;
3241
+ excelImportConfig = _this$props3.excelImportConfig,
3242
+ getTemplate = _this$props3.getTemplate;
3242
3243
  var _ref5 = excelImportConfig || {},
3243
3244
  size = _ref5.size,
3244
3245
  accept = _ref5.accept,
@@ -3306,7 +3307,11 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
3306
3307
  style: {
3307
3308
  color: 'red'
3308
3309
  }
3309
- }, "\uFF08\u9F20\u6807\u79FB\u5165\u611F\u53F9\u53F7\u56FE\u6807\u67E5\u770B\u5BFC\u5165\u4F7F\u7528\u8BF4\u660E\uFF09")), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, !notExcelImport && ( /*#__PURE__*/React__default['default'].createElement(antd.Upload, _objectSpread2({}, uploadProps), /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u5BFC\u5165"))), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
3310
+ }, "\uFF08\u9F20\u6807\u79FB\u5165\u611F\u53F9\u53F7\u56FE\u6807\u67E5\u770B\u5BFC\u5165\u4F7F\u7528\u8BF4\u660E\uFF09")), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, !notExcelImport && ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, getTemplate && ( /*#__PURE__*/React__default['default'].createElement(antd.Button, {
3311
+ ghost: true,
3312
+ type: "primary",
3313
+ onClick: getTemplate
3314
+ }, "\u4E0B\u8F7D\u6A21\u677F")), /*#__PURE__*/React__default['default'].createElement(antd.Upload, _objectSpread2({}, uploadProps), /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u5BFC\u5165")))), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
3310
3315
  trigger: ['click'],
3311
3316
  overlay: this.menuList,
3312
3317
  placement: "bottomRight"
@@ -7431,6 +7436,7 @@ var AddSelect = function AddSelect(props) {
7431
7436
  clearTitle = props.clearTitle;
7432
7437
  var _ref = requestConfig || {},
7433
7438
  url = _ref.url,
7439
+ sourceKey = _ref.sourceKey,
7434
7440
  otherParams = _ref.otherParams,
7435
7441
  isMap = _ref.isMap,
7436
7442
  _ref$mappingValueFiel = _ref.mappingValueField,
@@ -8023,7 +8029,7 @@ var AddSelect = function AddSelect(props) {
8023
8029
  };
8024
8030
  });
8025
8031
  } else {
8026
- var keys = res.list ? 'list' : 'items';
8032
+ var keys = sourceKey ? sourceKey : res.list ? 'list' : 'items';
8027
8033
  source = res ? res[keys] ? res[keys].map(function (item) {
8028
8034
  var _item$packingUnitList, _item$packingUnitList2;
8029
8035
  return _objectSpread2(_objectSpread2({}, item), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.13-alpha.27",
3
+ "version": "4.0.13-alpha.29",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -89,7 +89,7 @@ const AddSelect = (props: any) => {
89
89
  isAllowRepeatedSelect = false,
90
90
  clearTitle
91
91
  } = props;
92
- const { url, otherParams, isMap, mappingValueField = 'code' } = requestConfig || {};
92
+ const { url, sourceKey, otherParams, isMap, mappingValueField = 'code' } = requestConfig || {};
93
93
  const realButtonProps = {type: "primary", ...buttonProps};
94
94
  const selectRowKey = isAllowRepeatedSelect ? 'uuid' : mappingValueField
95
95
 
@@ -537,7 +537,7 @@ const AddSelect = (props: any) => {
537
537
  };
538
538
  });
539
539
  } else {
540
- const keys = res.list ? 'list' : 'items';
540
+ const keys = sourceKey ? sourceKey :res.list ? 'list' : 'items';
541
541
  source = res
542
542
  ? res[keys]
543
543
  ? res[keys].map((item: any) => {
@@ -653,7 +653,7 @@ class DataValidation extends React.Component {
653
653
 
654
654
  render() {
655
655
  const { errorListCheck } = this.state;
656
- const { title, notValid, notExcelImport, excelImportConfig } = this.props;
656
+ const { title, notValid, notExcelImport, excelImportConfig, getTemplate } = this.props;
657
657
  const { size, accept, suffixRule } = excelImportConfig || {}
658
658
 
659
659
  let totalSummary = this.getCount();
@@ -745,9 +745,16 @@ class DataValidation extends React.Component {
745
745
  </Space>
746
746
  <Space>
747
747
  {!notExcelImport && (
748
- <Upload {...uploadProps}>
749
- <Button>导入</Button>
750
- </Upload>
748
+ <>
749
+ {
750
+ getTemplate && (
751
+ <Button ghost type="primary" onClick={getTemplate}>下载模板</Button>
752
+ )
753
+ }
754
+ <Upload {...uploadProps}>
755
+ <Button>导入</Button>
756
+ </Upload>
757
+ </>
751
758
  )}
752
759
  <Dropdown
753
760
  trigger={['click']}