@bit-sun/business-component 2.1.16 → 2.1.18

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.
@@ -10,6 +10,7 @@ declare class SortableTable extends React.Component {
10
10
  onSearchSort: boolean;
11
11
  isDefaultValue: boolean;
12
12
  defaultValue: never[];
13
+ bsTableCode: string;
13
14
  };
14
15
  patchUserColumnConfig: (config: any) => void;
15
16
  getConfigFromlocalstorage: () => any;
package/dist/index.esm.js CHANGED
@@ -13156,6 +13156,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
13156
13156
 
13157
13157
  var props = {
13158
13158
  buttonText: parProps.buttonText || '新增',
13159
+ buttonProps: parProps.buttonProps || {},
13159
13160
  value: value,
13160
13161
  // labelInValue: true, // 非必填 默认为false
13161
13162
  requestConfig: _objectSpread2({
@@ -16119,10 +16120,14 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16119
16120
  searchDataSource: false,
16120
16121
  onSearchSort: false,
16121
16122
  isDefaultValue: false,
16122
- defaultValue: []
16123
+ defaultValue: [],
16124
+ bsTableCode: '' //设置table 列的标识
16125
+
16123
16126
  };
16124
16127
 
16125
16128
  _this.patchUserColumnConfig = function (config) {
16129
+ var that = _assertThisInitialized(_this);
16130
+
16126
16131
  var configvalue = config ? config.map(function (item) {
16127
16132
  return {
16128
16133
  key: item.key,
@@ -16136,7 +16141,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16136
16141
  url: '/user/appConfig/saveUserOrder',
16137
16142
  method: 'POST',
16138
16143
  data: {
16139
- code: window.location.hash,
16144
+ code: that.state.bsTableCode,
16140
16145
  detail: configvalue ? JSON.stringify(configvalue) : ''
16141
16146
  }
16142
16147
  }).then(function (res) {
@@ -16154,7 +16159,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16154
16159
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16155
16160
  var configArray = JSON.parse(config);
16156
16161
  var configSetting = configArray.filter(function (item) {
16157
- return item.code === window.location.hash;
16162
+ return item.code === _this.state.bsTableCode;
16158
16163
  });
16159
16164
 
16160
16165
  if (configSetting.length && configSetting[0].detail) {
@@ -16166,18 +16171,20 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16166
16171
 
16167
16172
  _this.patchConfigToLocalstorage = function (configvalue) {
16168
16173
  var setShowColumns = _this.props.setShowColumns;
16169
- var sortDataSource = _this.state.sortDataSource;
16174
+ var _this$state = _this.state,
16175
+ sortDataSource = _this$state.sortDataSource,
16176
+ bsTableCode = _this$state.bsTableCode;
16170
16177
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16171
16178
  var configArray = JSON.parse(config);
16172
16179
  var currentSetting = configArray.filter(function (item) {
16173
- return item.code === window.location.hash;
16180
+ return item.code === bsTableCode;
16174
16181
  });
16175
16182
 
16176
16183
  if (currentSetting.length) {
16177
16184
  currentSetting[0].detail = JSON.stringify(configvalue);
16178
16185
  } else {
16179
16186
  configArray.push({
16180
- "code": window.location.hash,
16187
+ "code": bsTableCode,
16181
16188
  "detail": JSON.stringify(configvalue)
16182
16189
  });
16183
16190
  }
@@ -16435,10 +16442,10 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16435
16442
  };
16436
16443
 
16437
16444
  _this.handleOk = function (e) {
16438
- var _this$state = _this.state,
16439
- sortDataSource = _this$state.sortDataSource,
16440
- isDefaultValue = _this$state.isDefaultValue,
16441
- defaultValue = _this$state.defaultValue;
16445
+ var _this$state2 = _this.state,
16446
+ sortDataSource = _this$state2.sortDataSource,
16447
+ isDefaultValue = _this$state2.isDefaultValue,
16448
+ defaultValue = _this$state2.defaultValue;
16442
16449
 
16443
16450
  if (!sortDataSource.length) {
16444
16451
  message.warning('至少选择一列!');
@@ -16461,9 +16468,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16461
16468
  };
16462
16469
 
16463
16470
  _this.handleTableHeadHidden = function (title) {
16464
- var _this$state2 = _this.state,
16465
- sortDataSource = _this$state2.sortDataSource,
16466
- dataSource = _this$state2.dataSource;
16471
+ var _this$state3 = _this.state,
16472
+ sortDataSource = _this$state3.sortDataSource,
16473
+ dataSource = _this$state3.dataSource;
16467
16474
 
16468
16475
  _this.setState({
16469
16476
  sortDataSource: sortDataSource.filter(function (item) {
@@ -16531,9 +16538,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16531
16538
  };
16532
16539
 
16533
16540
  _this.onChange = function (e, title) {
16534
- var _this$state3 = _this.state,
16535
- sortDataSource = _this$state3.sortDataSource,
16536
- dataSource = _this$state3.dataSource;
16541
+ var _this$state4 = _this.state,
16542
+ sortDataSource = _this$state4.sortDataSource,
16543
+ dataSource = _this$state4.dataSource;
16537
16544
 
16538
16545
  if (!e.target.checked) {
16539
16546
  _this.setState({
@@ -16612,7 +16619,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16612
16619
  value: function componentDidMount() {
16613
16620
  var _this$props2 = this.props,
16614
16621
  datasource = _this$props2.datasource,
16615
- showColumn = _this$props2.showColumn;
16622
+ showColumn = _this$props2.showColumn,
16623
+ bsTableCode = _this$props2.bsTableCode;
16616
16624
  var config = this.getConfigFromlocalstorage();
16617
16625
  this.setState({
16618
16626
  dataSource: datasource.map(function (item) {
@@ -16656,7 +16664,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16656
16664
  return innerKey && innerKey === itemKey;
16657
16665
  })[0]) === null || _showColumn$filter$ === void 0 ? void 0 : _showColumn$filter$.width) || item.width
16658
16666
  });
16659
- })
16667
+ }),
16668
+ bsTableCode: bsTableCode
16660
16669
  });
16661
16670
  }
16662
16671
  }, {
@@ -16664,12 +16673,12 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16664
16673
  value: function render() {
16665
16674
  var _this2 = this;
16666
16675
 
16667
- var _this$state4 = this.state,
16668
- dataSource = _this$state4.dataSource,
16669
- searchDataSource = _this$state4.searchDataSource,
16670
- sortDataSource = _this$state4.sortDataSource,
16671
- visible = _this$state4.visible,
16672
- onSearchSort = _this$state4.onSearchSort;
16676
+ var _this$state5 = this.state,
16677
+ dataSource = _this$state5.dataSource,
16678
+ searchDataSource = _this$state5.searchDataSource,
16679
+ sortDataSource = _this$state5.sortDataSource,
16680
+ visible = _this$state5.visible,
16681
+ onSearchSort = _this$state5.onSearchSort;
16673
16682
  var seatchDataSource = dataSource.filter(function (item) {
16674
16683
  var _item$title;
16675
16684
 
@@ -16902,14 +16911,17 @@ var index$5 = (function (props) {
16902
16911
  setShowColumns = _useState12[1];
16903
16912
 
16904
16913
  var _props$isPage = props.isPage,
16905
- pagination = props.pagination;
16914
+ pagination = props.pagination,
16915
+ tableCode = props.tableCode;
16906
16916
 
16907
16917
  var _useState13 = useState('100vh'),
16908
16918
  _useState14 = _slicedToArray(_useState13, 2),
16909
16919
  height = _useState14[0],
16910
16920
  setHeight = _useState14[1];
16911
16921
 
16912
- var sortTableRef = useRef(null); // 获取table高度
16922
+ var sortTableRef = useRef(null);
16923
+ var bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
16924
+ // 获取table高度
16913
16925
 
16914
16926
  var getTableHeight = function getTableHeight() {
16915
16927
  var _document$querySelect, _document$querySelect2, _document$querySelect3;
@@ -16935,7 +16947,7 @@ var index$5 = (function (props) {
16935
16947
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16936
16948
  var configArray = JSON.parse(config);
16937
16949
  var configSetting = configArray.filter(function (item) {
16938
- return item.code === window.location.hash;
16950
+ return item.code === bsTableCode;
16939
16951
  });
16940
16952
 
16941
16953
  if (configSetting.length && configSetting[0].detail) {
@@ -17229,7 +17241,8 @@ var index$5 = (function (props) {
17229
17241
  ref: sortTableRef,
17230
17242
  setShowColumns: setShowColumns,
17231
17243
  showColumn: showColumn,
17232
- datasource: (value === null || value === void 0 ? void 0 : value.columns) || []
17244
+ datasource: (value === null || value === void 0 ? void 0 : value.columns) || [],
17245
+ bsTableCode: bsTableCode
17233
17246
  }))))
17234
17247
  }
17235
17248
  }, {
package/dist/index.js CHANGED
@@ -13170,6 +13170,7 @@ var AddSkuSelect = function AddSkuSelect(parProps) {
13170
13170
 
13171
13171
  var props = {
13172
13172
  buttonText: parProps.buttonText || '新增',
13173
+ buttonProps: parProps.buttonProps || {},
13173
13174
  value: value,
13174
13175
  // labelInValue: true, // 非必填 默认为false
13175
13176
  requestConfig: _objectSpread2({
@@ -16133,10 +16134,14 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16133
16134
  searchDataSource: false,
16134
16135
  onSearchSort: false,
16135
16136
  isDefaultValue: false,
16136
- defaultValue: []
16137
+ defaultValue: [],
16138
+ bsTableCode: '' //设置table 列的标识
16139
+
16137
16140
  };
16138
16141
 
16139
16142
  _this.patchUserColumnConfig = function (config) {
16143
+ var that = _assertThisInitialized(_this);
16144
+
16140
16145
  var configvalue = config ? config.map(function (item) {
16141
16146
  return {
16142
16147
  key: item.key,
@@ -16150,7 +16155,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16150
16155
  url: '/user/appConfig/saveUserOrder',
16151
16156
  method: 'POST',
16152
16157
  data: {
16153
- code: window.location.hash,
16158
+ code: that.state.bsTableCode,
16154
16159
  detail: configvalue ? JSON.stringify(configvalue) : ''
16155
16160
  }
16156
16161
  }).then(function (res) {
@@ -16168,7 +16173,7 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16168
16173
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16169
16174
  var configArray = JSON.parse(config);
16170
16175
  var configSetting = configArray.filter(function (item) {
16171
- return item.code === window.location.hash;
16176
+ return item.code === _this.state.bsTableCode;
16172
16177
  });
16173
16178
 
16174
16179
  if (configSetting.length && configSetting[0].detail) {
@@ -16180,18 +16185,20 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16180
16185
 
16181
16186
  _this.patchConfigToLocalstorage = function (configvalue) {
16182
16187
  var setShowColumns = _this.props.setShowColumns;
16183
- var sortDataSource = _this.state.sortDataSource;
16188
+ var _this$state = _this.state,
16189
+ sortDataSource = _this$state.sortDataSource,
16190
+ bsTableCode = _this$state.bsTableCode;
16184
16191
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16185
16192
  var configArray = JSON.parse(config);
16186
16193
  var currentSetting = configArray.filter(function (item) {
16187
- return item.code === window.location.hash;
16194
+ return item.code === bsTableCode;
16188
16195
  });
16189
16196
 
16190
16197
  if (currentSetting.length) {
16191
16198
  currentSetting[0].detail = JSON.stringify(configvalue);
16192
16199
  } else {
16193
16200
  configArray.push({
16194
- "code": window.location.hash,
16201
+ "code": bsTableCode,
16195
16202
  "detail": JSON.stringify(configvalue)
16196
16203
  });
16197
16204
  }
@@ -16449,10 +16456,10 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16449
16456
  };
16450
16457
 
16451
16458
  _this.handleOk = function (e) {
16452
- var _this$state = _this.state,
16453
- sortDataSource = _this$state.sortDataSource,
16454
- isDefaultValue = _this$state.isDefaultValue,
16455
- defaultValue = _this$state.defaultValue;
16459
+ var _this$state2 = _this.state,
16460
+ sortDataSource = _this$state2.sortDataSource,
16461
+ isDefaultValue = _this$state2.isDefaultValue,
16462
+ defaultValue = _this$state2.defaultValue;
16456
16463
 
16457
16464
  if (!sortDataSource.length) {
16458
16465
  antd.message.warning('至少选择一列!');
@@ -16475,9 +16482,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16475
16482
  };
16476
16483
 
16477
16484
  _this.handleTableHeadHidden = function (title) {
16478
- var _this$state2 = _this.state,
16479
- sortDataSource = _this$state2.sortDataSource,
16480
- dataSource = _this$state2.dataSource;
16485
+ var _this$state3 = _this.state,
16486
+ sortDataSource = _this$state3.sortDataSource,
16487
+ dataSource = _this$state3.dataSource;
16481
16488
 
16482
16489
  _this.setState({
16483
16490
  sortDataSource: sortDataSource.filter(function (item) {
@@ -16545,9 +16552,9 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16545
16552
  };
16546
16553
 
16547
16554
  _this.onChange = function (e, title) {
16548
- var _this$state3 = _this.state,
16549
- sortDataSource = _this$state3.sortDataSource,
16550
- dataSource = _this$state3.dataSource;
16555
+ var _this$state4 = _this.state,
16556
+ sortDataSource = _this$state4.sortDataSource,
16557
+ dataSource = _this$state4.dataSource;
16551
16558
 
16552
16559
  if (!e.target.checked) {
16553
16560
  _this.setState({
@@ -16626,7 +16633,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16626
16633
  value: function componentDidMount() {
16627
16634
  var _this$props2 = this.props,
16628
16635
  datasource = _this$props2.datasource,
16629
- showColumn = _this$props2.showColumn;
16636
+ showColumn = _this$props2.showColumn,
16637
+ bsTableCode = _this$props2.bsTableCode;
16630
16638
  var config = this.getConfigFromlocalstorage();
16631
16639
  this.setState({
16632
16640
  dataSource: datasource.map(function (item) {
@@ -16670,7 +16678,8 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16670
16678
  return innerKey && innerKey === itemKey;
16671
16679
  })[0]) === null || _showColumn$filter$ === void 0 ? void 0 : _showColumn$filter$.width) || item.width
16672
16680
  });
16673
- })
16681
+ }),
16682
+ bsTableCode: bsTableCode
16674
16683
  });
16675
16684
  }
16676
16685
  }, {
@@ -16678,12 +16687,12 @@ var SortableTable$1 = /*#__PURE__*/function (_React$Component) {
16678
16687
  value: function render() {
16679
16688
  var _this2 = this;
16680
16689
 
16681
- var _this$state4 = this.state,
16682
- dataSource = _this$state4.dataSource,
16683
- searchDataSource = _this$state4.searchDataSource,
16684
- sortDataSource = _this$state4.sortDataSource,
16685
- visible = _this$state4.visible,
16686
- onSearchSort = _this$state4.onSearchSort;
16690
+ var _this$state5 = this.state,
16691
+ dataSource = _this$state5.dataSource,
16692
+ searchDataSource = _this$state5.searchDataSource,
16693
+ sortDataSource = _this$state5.sortDataSource,
16694
+ visible = _this$state5.visible,
16695
+ onSearchSort = _this$state5.onSearchSort;
16687
16696
  var seatchDataSource = dataSource.filter(function (item) {
16688
16697
  var _item$title;
16689
16698
 
@@ -16916,14 +16925,17 @@ var index$5 = (function (props) {
16916
16925
  setShowColumns = _useState12[1];
16917
16926
 
16918
16927
  var _props$isPage = props.isPage,
16919
- pagination = props.pagination;
16928
+ pagination = props.pagination,
16929
+ tableCode = props.tableCode;
16920
16930
 
16921
16931
  var _useState13 = React.useState('100vh'),
16922
16932
  _useState14 = _slicedToArray(_useState13, 2),
16923
16933
  height = _useState14[0],
16924
16934
  setHeight = _useState14[1];
16925
16935
 
16926
- var sortTableRef = React.useRef(null); // 获取table高度
16936
+ var sortTableRef = React.useRef(null);
16937
+ var bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
16938
+ // 获取table高度
16927
16939
 
16928
16940
  var getTableHeight = function getTableHeight() {
16929
16941
  var _document$querySelect, _document$querySelect2, _document$querySelect3;
@@ -16949,7 +16961,7 @@ var index$5 = (function (props) {
16949
16961
  var config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
16950
16962
  var configArray = JSON.parse(config);
16951
16963
  var configSetting = configArray.filter(function (item) {
16952
- return item.code === window.location.hash;
16964
+ return item.code === bsTableCode;
16953
16965
  });
16954
16966
 
16955
16967
  if (configSetting.length && configSetting[0].detail) {
@@ -17243,7 +17255,8 @@ var index$5 = (function (props) {
17243
17255
  ref: sortTableRef,
17244
17256
  setShowColumns: setShowColumns,
17245
17257
  showColumn: showColumn,
17246
- datasource: (value === null || value === void 0 ? void 0 : value.columns) || []
17258
+ datasource: (value === null || value === void 0 ? void 0 : value.columns) || [],
17259
+ bsTableCode: bsTableCode
17247
17260
  }))))
17248
17261
  }
17249
17262
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.1.16",
3
+ "version": "2.1.18",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -18,6 +18,7 @@ export const AddSkuSelect = (parProps: any) => {
18
18
  const [value, setValue] = useState(selectProps?.mode ? [] : null);
19
19
  const props = {
20
20
  buttonText: parProps.buttonText || '新增',
21
+ buttonProps: parProps.buttonProps || {},
21
22
  value,
22
23
  // labelInValue: true, // 非必填 默认为false
23
24
  requestConfig: {
@@ -59,11 +59,12 @@ export default (props: any) => {
59
59
  const [value, setValue]: any = useState(props);
60
60
  const [showColumn, setShowColumns] = useState([]);
61
61
 
62
- const { isPage = true, pagination } = props;
62
+ const { isPage = true, pagination, tableCode } = props;
63
63
 
64
64
  const [height, setHeight]: any = useState('100vh');
65
65
  const sortTableRef = useRef(null);
66
-
66
+
67
+ const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
67
68
  // 获取table高度
68
69
  const getTableHeight = () => {
69
70
  const cancelHeight = window.top == window ? 303 : 223;
@@ -101,7 +102,7 @@ export default (props: any) => {
101
102
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
102
103
  let configArray = JSON.parse(config);
103
104
  let configSetting = configArray.filter(
104
- (item) => item.code === window.location.hash,
105
+ (item) => item.code === bsTableCode,
105
106
  );
106
107
 
107
108
  if (configSetting.length && configSetting[0].detail) {
@@ -371,6 +372,7 @@ export default (props: any) => {
371
372
  setShowColumns={setShowColumns}
372
373
  showColumn={showColumn}
373
374
  datasource={value?.columns || []}
375
+ bsTableCode={bsTableCode}
374
376
  />
375
377
  </span>
376
378
  </Tooltip>
@@ -42,9 +42,11 @@ class SortableTable extends React.Component {
42
42
  onSearchSort: false,
43
43
  isDefaultValue: false,
44
44
  defaultValue: [],
45
+ bsTableCode: '', //设置table 列的标识
45
46
  };
46
47
 
47
48
  patchUserColumnConfig = (config) => {
49
+ let that = this;
48
50
  let configvalue = config
49
51
  ? config.map((item) => ({
50
52
  key: item.key,
@@ -58,7 +60,7 @@ class SortableTable extends React.Component {
58
60
  url: '/user/appConfig/saveUserOrder',
59
61
  method: 'POST',
60
62
  data: {
61
- code: window.location.hash,
63
+ code: that.state.bsTableCode,
62
64
  detail: configvalue ? JSON.stringify(configvalue) : '',
63
65
  },
64
66
  }).then((res:any) => {
@@ -74,7 +76,7 @@ class SortableTable extends React.Component {
74
76
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
75
77
  let configArray = JSON.parse(config);
76
78
  let configSetting = configArray.filter(
77
- (item) => item.code === window.location.hash,
79
+ (item) => item.code === this.state.bsTableCode,
78
80
  );
79
81
 
80
82
  if (configSetting.length && configSetting[0].detail) {
@@ -85,15 +87,15 @@ class SortableTable extends React.Component {
85
87
 
86
88
  patchConfigToLocalstorage = (configvalue) => {
87
89
  const { setShowColumns } = this.props;
88
- const { sortDataSource } = this.state;
90
+ const { sortDataSource, bsTableCode } = this.state;
89
91
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]'
90
92
  let configArray = JSON.parse(config)
91
- let currentSetting = configArray.filter(item => item.code === window.location.hash)
93
+ let currentSetting = configArray.filter(item => item.code === bsTableCode)
92
94
  if (currentSetting.length) {
93
95
  currentSetting[0].detail = JSON.stringify(configvalue)
94
96
  } else {
95
97
  configArray.push({
96
- "code": window.location.hash,
98
+ "code": bsTableCode,
97
99
  "detail": JSON.stringify(configvalue)
98
100
  })
99
101
  }
@@ -147,7 +149,7 @@ class SortableTable extends React.Component {
147
149
  };
148
150
 
149
151
  componentDidMount() {
150
- const { datasource, showColumn }: any =
152
+ const { datasource, showColumn, bsTableCode }: any =
151
153
  this.props;
152
154
  let config = this.getConfigFromlocalstorage();
153
155
 
@@ -196,6 +198,7 @@ class SortableTable extends React.Component {
196
198
  }
197
199
  )[0]?.width || item.width,
198
200
  })),
201
+ bsTableCode
199
202
  });
200
203
  }
201
204