dtable-ui-component 0.1.57 → 0.1.58

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.
@@ -26,17 +26,16 @@ var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
26
26
  var _this$props = _this.props,
27
27
  value = _this$props.value,
28
28
  options = _this$props.options;
29
- return value.map(function (item) {
30
- var option = options.find(function (option) {
31
- return option.id === item || option.name === item;
29
+ if (!Array.isArray(value) || !Array.isArray(options)) return [];
30
+ var selectedOptions = options.filter(function (option) {
31
+ return value.includes(option.id);
32
+ });
33
+ if (selectedOptions.length === 0) return [];
34
+ return selectedOptions.map(function (option) {
35
+ return /*#__PURE__*/React.createElement(SelectItem, {
36
+ key: "multiple-".concat(option.id),
37
+ option: option
32
38
  });
33
-
34
- if (option) {
35
- return /*#__PURE__*/React.createElement(SelectItem, {
36
- key: item,
37
- option: option
38
- });
39
- }
40
39
  });
41
40
  };
42
41
 
@@ -43,8 +43,7 @@ var propTypes = {
43
43
  value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.object, _propTypes.default.bool]),
44
44
  column: _propTypes.default.Object,
45
45
  containerClassName: _propTypes.default.string,
46
- collaborators: _propTypes.default.array,
47
- tables: _propTypes.default.array
46
+ collaborators: _propTypes.default.array
48
47
  };
49
48
 
50
49
  var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
@@ -41,17 +41,16 @@ var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
41
41
  var _this$props = _this.props,
42
42
  value = _this$props.value,
43
43
  options = _this$props.options;
44
- return value.map(function (item) {
45
- var option = options.find(function (option) {
46
- return option.id === item || option.name === item;
44
+ if (!Array.isArray(value) || !Array.isArray(options)) return [];
45
+ var selectedOptions = options.filter(function (option) {
46
+ return value.includes(option.id);
47
+ });
48
+ if (selectedOptions.length === 0) return [];
49
+ return selectedOptions.map(function (option) {
50
+ return /*#__PURE__*/_react.default.createElement(_selectItem.default, {
51
+ key: "multiple-" + option.id,
52
+ option: option
47
53
  });
48
-
49
- if (option) {
50
- return /*#__PURE__*/_react.default.createElement(_selectItem.default, {
51
- key: item,
52
- option: option
53
- });
54
- }
55
54
  });
56
55
  });
57
56
  return _this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "main": "./es/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/seafile-calendar": "0.0.15",
@@ -63,7 +63,6 @@
63
63
  "@babel/plugin-proposal-export-namespace-from": "^7.8.3",
64
64
  "@babel/plugin-proposal-object-rest-spread": "^7.9.5",
65
65
  "@babel/plugin-transform-runtime": "^7.10.1",
66
- "@babel/runtime": "^7.14.0",
67
66
  "@babel/polyfill": "^7.10.1",
68
67
  "@babel/preset-env": "^7.9.5",
69
68
  "@storybook/addon-actions": "^5.3.14",