ztxkui 4.2.18-46 → 4.2.18-48

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/Demo.js CHANGED
@@ -33,9 +33,9 @@ function Demo() {
33
33
  var timeoutId = setTimeout(function () {
34
34
  console.log('获取数据');
35
35
  setList(new Array(50).fill(1).map(function (item, index) {
36
- if (index === 3) {
37
- return null;
38
- }
36
+ // if (index === 3) {
37
+ // return null;
38
+ // }
39
39
  return {
40
40
  id: index,
41
41
  name: '你好' + index,
@@ -71,13 +71,15 @@ function Demo() {
71
71
  setValue1(value);
72
72
  } })),
73
73
  React.createElement("div", null,
74
- React.createElement(EnhanceSelect, { style: selectStyle, list: list, mode: "multiple", isHandAddItem: true, value: value2, showAll: true, onChange: function (value) {
74
+ React.createElement(EnhanceSelect, { style: selectStyle, list: list, mode: "multiple", isHandAddItem: true, value: value2, joinKey: "test1", showAll: true, onChange: function (value, option, fullData) {
75
75
  console.log(value, typeof value);
76
+ console.log(option);
76
77
  setValue2(value);
77
78
  } })),
78
79
  React.createElement("div", null,
79
- React.createElement(EnhanceSelect, { style: selectStyle, list: list, isHandAddItem: true, value: value1, onChange: function (value) {
80
+ React.createElement(EnhanceSelect, { style: selectStyle, list: list, isHandAddItem: true, value: value1, onChange: function (value, option, fullData) {
80
81
  console.log(value, typeof value);
82
+ console.log(option);
81
83
  setValue1(value);
82
84
  } })),
83
85
  React.createElement("div", null,
@@ -849,9 +849,9 @@ function EnhanceSelect(_a) {
849
849
  if (currentList && Array.isArray(currentList)) {
850
850
  var key_1 = dataKey;
851
851
  // 支持多选模式
852
- var currentData = void 0;
852
+ var currentData_1;
853
853
  if (Array.isArray(value)) {
854
- currentData = value.map(function (valueItem) {
854
+ currentData_1 = value.map(function (valueItem) {
855
855
  return currentList.find(function (item) {
856
856
  var _a, _b;
857
857
  if (!item) {
@@ -865,13 +865,13 @@ function EnhanceSelect(_a) {
865
865
  }
866
866
  });
867
867
  });
868
- currentData = currentData === null || currentData === void 0 ? void 0 : currentData.filter(function (item) { return item; });
868
+ currentData_1 = currentData_1 === null || currentData_1 === void 0 ? void 0 : currentData_1.filter(function (item) { return item; });
869
869
  if (remoteSearch) {
870
- setMultipleList(currentData);
870
+ setMultipleList(currentData_1);
871
871
  }
872
872
  }
873
873
  else {
874
- currentData = currentList.find(function (item) {
874
+ currentData_1 = currentList.find(function (item) {
875
875
  var _a, _b;
876
876
  if (!item) {
877
877
  return false;
@@ -896,25 +896,39 @@ function EnhanceSelect(_a) {
896
896
  }
897
897
  else {
898
898
  // 否则 最后一个不是全部,那就去掉全部
899
- __value = currentData.map(function (item) { return item[key_1]; });
899
+ __value = currentData_1.map(function (item) { return item[key_1]; });
900
900
  }
901
901
  }
902
- else if (!Array.isArray(__value) && __value != null && currentData) {
903
- __value = currentData[key_1];
902
+ else if (!Array.isArray(__value) && __value != null && currentData_1) {
903
+ __value = currentData_1[key_1];
904
904
  }
905
905
  }
906
906
  else {
907
- if (currentData) {
907
+ if (currentData_1) {
908
908
  if (Array.isArray(__value) && __value.length > 0) {
909
- __value = currentData.map(function (item) { return item[key_1]; });
909
+ __value = currentData_1.map(function (item) { return item[key_1]; });
910
910
  }
911
911
  else if (!Array.isArray(__value) && __value != null) {
912
- __value = currentData[key_1];
912
+ __value = currentData_1[key_1];
913
913
  }
914
914
  }
915
915
  }
916
- var newOption = __assign(__assign({}, option), { title: (currentData === null || currentData === void 0 ? void 0 : currentData[titleKey]) ? currentData === null || currentData === void 0 ? void 0 : currentData[titleKey] : option.title });
917
- onChange && onChange(__value, newOption, currentData);
916
+ if (!Array.isArray(currentData_1)) {
917
+ var newOption = __assign(__assign({}, option), { title: !Array.isArray(currentData_1) && (currentData_1 === null || currentData_1 === void 0 ? void 0 : currentData_1[titleKey])
918
+ ? currentData_1 === null || currentData_1 === void 0 ? void 0 : currentData_1[titleKey]
919
+ : option.title });
920
+ onChange && onChange(__value, newOption, currentData_1);
921
+ }
922
+ else {
923
+ var newOption = option === null || option === void 0 ? void 0 : option.map(function (item, index) {
924
+ var currentItem = currentData_1 === null || currentData_1 === void 0 ? void 0 : currentData_1[index];
925
+ if (currentItem === null || currentItem === void 0 ? void 0 : currentItem[titleKey]) {
926
+ return __assign(__assign({}, item), { title: currentItem ? currentItem === null || currentItem === void 0 ? void 0 : currentItem[titleKey] : option.title });
927
+ }
928
+ return item;
929
+ });
930
+ onChange && onChange(__value, newOption, currentData_1);
931
+ }
918
932
  }
919
933
  else {
920
934
  onChange && onChange(value, option);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "4.2.18-46",
3
+ "version": "4.2.18-48",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",