dtable-ui-component 5.3.10-beta3 → 5.3.10-beta5

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.
@@ -145,7 +145,8 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
145
145
  this.renderOptions = () => {
146
146
  const {
147
147
  isEditorFocus,
148
- classNamePrefix
148
+ classNamePrefix,
149
+ placeholder
149
150
  } = this.props;
150
151
  const options = this.getMultipleSelectList();
151
152
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -161,11 +162,15 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
161
162
  className: (0, _classnames.default)('dtable-ui-row-expand-select-editor-inner', {
162
163
  ["".concat(classNamePrefix, "-select-editor-inner")]: classNamePrefix
163
164
  })
164
- }, /*#__PURE__*/_react.default.createElement("div", null, options.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
165
+ }, /*#__PURE__*/_react.default.createElement("div", {
166
+ className: (0, _classnames.default)('', {
167
+ ["".concat(classNamePrefix, "-select-editor-inner-container")]: classNamePrefix
168
+ })
169
+ }, options.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
165
170
  className: (0, _classnames.default)('dtable-ui-row-expand-select-options', {
166
171
  ["".concat(classNamePrefix, "-select-editor-options")]: classNamePrefix
167
172
  })
168
- }, options)), /*#__PURE__*/_react.default.createElement("i", {
173
+ }, options), options.length === 0 && placeholder && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder)), /*#__PURE__*/_react.default.createElement("i", {
169
174
  "aria-hidden": "true",
170
175
  className: "dtable-font dtable-icon-down3"
171
176
  })));
@@ -11,6 +11,7 @@ var _constants = require("../../constants");
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
12
  var _SingleSelectEditor = _interopRequireDefault(require("../../SingleSelectEditor"));
13
13
  var _lang = require("../../lang");
14
+ var _objectUtils = _interopRequireDefault(require("../../utils/object-utils"));
14
15
  require("./index.css");
15
16
  class RowExpandSingleSelectEditor extends _react.default.Component {
16
17
  constructor(_props) {
@@ -63,7 +64,7 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
63
64
  };
64
65
  this.hideDropDownMenu = event => {
65
66
  if (!event.target) return;
66
- if (!this.singleSelectContainer.contains(event.target) && this.state.showSelectPopover) {
67
+ if (!this.ref.contains(event.target) && this.state.showSelectPopover) {
67
68
  const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
68
69
  if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
69
70
  this.toggleSingleSelect(false);
@@ -90,7 +91,9 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
90
91
  };
91
92
  this.renderOption = () => {
92
93
  const {
93
- isEditorFocus
94
+ isEditorFocus,
95
+ classNamePrefix,
96
+ placeholder
94
97
  } = this.props;
95
98
  const {
96
99
  value
@@ -109,15 +112,22 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
109
112
  onClick: this.onToggleSelect,
110
113
  ref: ref => this.selectRef = ref,
111
114
  className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor custom-select', {
112
- 'focus': isEditorFocus
115
+ 'focus': isEditorFocus,
116
+ ["".concat(classNamePrefix, "-select-editor")]: classNamePrefix
113
117
  })
114
118
  }, /*#__PURE__*/_react.default.createElement("div", {
115
- className: "dtable-ui-row-expand-select-editor-inner"
116
- }, /*#__PURE__*/_react.default.createElement("div", null, value && /*#__PURE__*/_react.default.createElement("div", {
119
+ className: (0, _classnames.default)('dtable-ui-row-expand-select-editor-inner', {
120
+ ["".concat(classNamePrefix, "-select-editor-inner")]: classNamePrefix
121
+ })
122
+ }, /*#__PURE__*/_react.default.createElement("div", {
123
+ className: (0, _classnames.default)('', {
124
+ ["".concat(classNamePrefix, "-select-editor-inner-container")]: classNamePrefix
125
+ })
126
+ }, value && /*#__PURE__*/_react.default.createElement("div", {
117
127
  className: "dtable-ui-select-option",
118
128
  style: optionStyle,
119
129
  title: optionName
120
- }, optionName)), /*#__PURE__*/_react.default.createElement("i", {
130
+ }, optionName), !value && placeholder && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder)), /*#__PURE__*/_react.default.createElement("i", {
121
131
  "aria-hidden": "true",
122
132
  className: "dtable-font dtable-icon-down3"
123
133
  })));
@@ -137,9 +147,10 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
137
147
  }
138
148
  UNSAFE_componentWillReceiveProps(nextProps) {
139
149
  const {
140
- value
150
+ value,
151
+ column
141
152
  } = nextProps;
142
- if (value !== this.props.value) {
153
+ if (value !== this.props.value || !_objectUtils.default.isSameObject(column, this.props.column)) {
143
154
  this.options = this.getOptions(nextProps);
144
155
  this.setState({
145
156
  value,
@@ -165,7 +176,8 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
165
176
  const {
166
177
  isSupportNewOption,
167
178
  onAddNewOption,
168
- column
179
+ column,
180
+ classNamePrefix
169
181
  } = this.props;
170
182
  const {
171
183
  showSelectPopover,
@@ -173,7 +185,7 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
173
185
  } = this.state;
174
186
  return /*#__PURE__*/_react.default.createElement("div", {
175
187
  className: "position-relative w-100",
176
- ref: ref => this.singleSelectContainer = ref
188
+ ref: ref => this.ref = ref
177
189
  }, this.renderOption(), /*#__PURE__*/_react.default.createElement("span", {
178
190
  ref: ref => this.targetRef = ref
179
191
  }), showSelectPopover && /*#__PURE__*/_react.default.createElement(_SingleSelectEditor.default, {
@@ -183,6 +195,7 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
183
195
  value: value,
184
196
  valueKey: this.key,
185
197
  target: this.targetRef,
198
+ classNamePrefix: classNamePrefix,
186
199
  onCommit: this.onChange,
187
200
  isSupportNewOption: isSupportNewOption,
188
201
  onAddNewOption: onAddNewOption,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.10beta3",
3
+ "version": "5.3.10beta5",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",