dtable-ui-component 6.0.110-apt.5 → 6.0.110-gla.9

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.
@@ -83,6 +83,11 @@ class SelectOptionGroup extends _react.Component {
83
83
  });
84
84
  }
85
85
  };
86
+ this.isEqual = (obj1, obj2) => {
87
+ if (obj1 === obj2) return true;
88
+ if (!obj1 || !obj2) return false;
89
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
90
+ };
86
91
  this.onMouseDown = e => {
87
92
  const {
88
93
  isInModal
@@ -134,11 +139,17 @@ class SelectOptionGroup extends _react.Component {
134
139
  });
135
140
  }
136
141
  };
142
+ this.isEqual = (obj1, obj2) => {
143
+ if (obj1 === obj2) return true;
144
+ if (!obj1 || !obj2) return false;
145
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
146
+ };
137
147
  this.renderOptGroup = searchVal => {
138
148
  let {
139
149
  noOptionsPlaceholder,
140
150
  onSelectOption,
141
- value
151
+ value,
152
+ supportMultipleSelect
142
153
  } = this.props;
143
154
  this.filterOptions = this.props.getFilterOptions(searchVal);
144
155
  if (this.filterOptions.length === 0) {
@@ -150,7 +161,7 @@ class SelectOptionGroup extends _react.Component {
150
161
  return this.filterOptions.map((opt, i) => {
151
162
  let key = opt.value.column ? opt.value.column.key : i;
152
163
  let isActive = this.state.activeIndex === i;
153
- let isSelected = value && (typeof value === 'object' && value.value.column.key === opt.value.column.key || typeof value === 'string' && value === opt.value);
164
+ let isSelected = value && typeof value === 'object' && !supportMultipleSelect ? this.isEqual(value.value, opt.value) : Array.isArray(value.value) ? value.value.includes(opt.value.column_key) : false;
154
165
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_option.default, {
155
166
  index: i,
156
167
  isActive: isActive,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.110-apt.5",
3
+ "version": "6.0.110-gla.9",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^5.0.4",