dtable-ui-component 5.3.10-beta1 → 5.3.10-beta3

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.
@@ -73,7 +73,7 @@ const RowExpandDialog = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
73
73
  if (readonly || !column || !column.editable || _dtableUtils.NOT_SUPPORT_EDIT_COLUMN_TYPE_MAP[column.type]) return false;
74
74
  if (column.type === _dtableUtils.CellType.IMAGE || column.type === _dtableUtils.CellType.FILE) return Boolean(uploadFile);
75
75
  return true;
76
- }, [isSaving, uploadFile]);
76
+ }, [readonly, isSaving, uploadFile]);
77
77
  const initRowData = (0, _react.useCallback)(() => {
78
78
  setLoading(true);
79
79
  setRow(defaultRow);
@@ -88,7 +88,7 @@ const RowExpandDialog = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
88
88
  isChangedRef.current = isInsertingRow && Object.keys(defaultRow).length > 0;
89
89
  setColumns(validColumns);
90
90
  setLoading(false);
91
- }, [isInsertingRow, checkEditable]);
91
+ }, [isInsertingRow, defaultColumns, defaultRow, checkEditable]);
92
92
  const toggle = (0, _react.useCallback)(() => {
93
93
  if (isSaving) return;
94
94
  onToggle();
@@ -11,6 +11,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _constants = require("../../constants");
12
12
  var _MultipleSelectEditor = _interopRequireDefault(require("../../MultipleSelectEditor"));
13
13
  var _lang = require("../../lang");
14
+ var _objectUtils = _interopRequireDefault(require("../../utils/object-utils"));
14
15
  require("./index.css");
15
16
  class RowExpandMultipleSelectEditor extends _react.default.Component {
16
17
  constructor(_props) {
@@ -49,14 +50,22 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
49
50
  this.onToggleSelect = e => {
50
51
  e.preventDefault();
51
52
  e.stopPropagation();
52
- this.props.updateTabIndex(this.props.columnIndex);
53
+ const {
54
+ updateTabIndex,
55
+ columnIndex
56
+ } = this.props;
57
+ updateTabIndex && updateTabIndex(columnIndex);
53
58
  this.toggleSingleSelect(true);
54
59
  };
55
60
  this.closeEditor = () => {
56
61
  this.toggleSingleSelect(false);
57
62
  };
58
63
  this.onFocus = () => {
59
- this.props.updateTabIndex(this.props.columnIndex);
64
+ const {
65
+ updateTabIndex,
66
+ columnIndex
67
+ } = this.props;
68
+ updateTabIndex && updateTabIndex(columnIndex);
60
69
  };
61
70
  this.onChange = option => {
62
71
  const optionKey = option[this.key];
@@ -135,7 +144,8 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
135
144
  };
136
145
  this.renderOptions = () => {
137
146
  const {
138
- isEditorFocus
147
+ isEditorFocus,
148
+ classNamePrefix
139
149
  } = this.props;
140
150
  const options = this.getMultipleSelectList();
141
151
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -144,12 +154,17 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
144
154
  onClick: this.onToggleSelect,
145
155
  ref: ref => this.multipleSelectOptionsRef = ref,
146
156
  className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor custom-select', {
147
- 'focus': isEditorFocus
157
+ 'focus': isEditorFocus,
158
+ ["".concat(classNamePrefix, "-select-editor")]: classNamePrefix
148
159
  })
149
160
  }, /*#__PURE__*/_react.default.createElement("div", {
150
- className: "dtable-ui-row-expand-select-editor-inner"
161
+ className: (0, _classnames.default)('dtable-ui-row-expand-select-editor-inner', {
162
+ ["".concat(classNamePrefix, "-select-editor-inner")]: classNamePrefix
163
+ })
151
164
  }, /*#__PURE__*/_react.default.createElement("div", null, options.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
152
- className: "dtable-ui-row-expand-select-options"
165
+ className: (0, _classnames.default)('dtable-ui-row-expand-select-options', {
166
+ ["".concat(classNamePrefix, "-select-editor-options")]: classNamePrefix
167
+ })
153
168
  }, options)), /*#__PURE__*/_react.default.createElement("i", {
154
169
  "aria-hidden": "true",
155
170
  className: "dtable-font dtable-icon-down3"
@@ -169,9 +184,10 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
169
184
  }
170
185
  UNSAFE_componentWillReceiveProps(nextProps) {
171
186
  const {
172
- value
187
+ value,
188
+ column
173
189
  } = nextProps;
174
- if (value !== this.props.value) {
190
+ if (value !== this.props.value || !_objectUtils.default.isSameObject(column, this.props.column)) {
175
191
  this.options = this.getOptions(nextProps);
176
192
  this.setState({
177
193
  value
@@ -196,7 +212,8 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
196
212
  const {
197
213
  column,
198
214
  isSupportNewOption,
199
- onAddNewOption
215
+ onAddNewOption,
216
+ classNamePrefix
200
217
  } = this.props;
201
218
  const {
202
219
  showSelectPopover,
@@ -214,6 +231,7 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
214
231
  value: value,
215
232
  valueKey: this.key,
216
233
  target: this.targetRef,
234
+ classNamePrefix: classNamePrefix,
217
235
  onCommit: this.onChange,
218
236
  isSupportNewOption: isSupportNewOption,
219
237
  onAddNewOption: onAddNewOption,
@@ -206,7 +206,8 @@ class PCSelectEditor extends _react.default.Component {
206
206
  column,
207
207
  valueKey,
208
208
  isSupportNewOption,
209
- target
209
+ target,
210
+ classNamePrefix
210
211
  } = this.props;
211
212
  const {
212
213
  searchValue,
@@ -218,7 +219,9 @@ class PCSelectEditor extends _react.default.Component {
218
219
  // maxWidth = column.width > 200 ? column.width - 62 : 200 - 62
219
220
  let maxWidth = isInModal ? 250 : (column === null || column === void 0 ? void 0 : column.width) > 200 ? column.width - 62 : 138;
220
221
  const dom = /*#__PURE__*/_react.default.createElement("div", {
221
- className: (0, _classnames.default)('dtable-ui-editor-container dtable-ui-select-editor-container', className),
222
+ className: (0, _classnames.default)('dtable-ui-editor-container dtable-ui-select-editor-container', className, {
223
+ ["".concat(classNamePrefix, "-select-editor-container")]: classNamePrefix
224
+ }),
222
225
  ref: ref => this.ref = ref
223
226
  }, /*#__PURE__*/_react.default.createElement("div", {
224
227
  className: "select-options-search"
@@ -276,7 +279,9 @@ class PCSelectEditor extends _react.default.Component {
276
279
  target: target,
277
280
  hideArrow: true,
278
281
  fade: false,
279
- className: "dtable-ui dtable-ui-row-expand-select-editor-popover"
282
+ className: (0, _classnames.default)('dtable-ui dtable-ui-row-expand-select-editor-popover', {
283
+ ["".concat(classNamePrefix, "-select-editor-popover")]: classNamePrefix
284
+ })
280
285
  }, dom));
281
286
  }
282
287
  return dom;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.10beta1",
3
+ "version": "5.3.10beta3",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",