dtable-ui-component 6.0.29-beta6 → 6.0.29-beta8

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.
@@ -202,7 +202,7 @@ class DepartmentSingleSelect extends _react.Component {
202
202
  };
203
203
  this.renderEmptyTip = () => {
204
204
  return /*#__PURE__*/_react.default.createElement("span", {
205
- className: "dtable-ui-editor-no-search-result"
205
+ className: "none-search-result pl-4 pr-4"
206
206
  }, (0, _lang.getLocale)('No_departments_available'));
207
207
  };
208
208
  this.renderMenuContent = () => {
@@ -22,6 +22,8 @@
22
22
  font-size: 14px;
23
23
  display: inline-block;
24
24
  color: #666666;
25
+ padding: 10px;
26
+ overflow: auto;
25
27
  }
26
28
 
27
29
  .dtable-ui.department-editor-list .department-item-left-content {
@@ -12,7 +12,7 @@ var _addBtn = _interopRequireDefault(require("../add-btn"));
12
12
  var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
13
13
  var _DepartmentSingleSelectEditor = _interopRequireDefault(require("../../DepartmentSingleSelectEditor"));
14
14
  var _lang = require("../../lang");
15
- function RowExpandMBDepartmentEditor(_ref) {
15
+ const RowExpandMBDepartmentEditor = _ref => {
16
16
  let {
17
17
  row,
18
18
  column,
@@ -23,11 +23,6 @@ function RowExpandMBDepartmentEditor(_ref) {
23
23
  } = _ref;
24
24
  const [value, setValue] = (0, _react.useState)(row[column[valueKey]] || '');
25
25
  const [showEditor, setShowEditor] = (0, _react.useState)(false);
26
- (0, _react.useEffect)(() => {
27
- setValue(row[column[valueKey]] || '');
28
- setShowEditor(false);
29
- // eslint-disable-next-line
30
- }, [row]);
31
26
  const openEditor = (0, _react.useCallback)(() => {
32
27
  setShowEditor(true);
33
28
  }, []);
@@ -39,6 +34,11 @@ function RowExpandMBDepartmentEditor(_ref) {
39
34
  setValue(newValue);
40
35
  onCommit && onCommit(newValue);
41
36
  }, [value, onCommit]);
37
+ (0, _react.useEffect)(() => {
38
+ setValue(row[column[valueKey]] || '');
39
+ setShowEditor(false);
40
+ // eslint-disable-next-line
41
+ }, [row, column]);
42
42
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
43
43
  className: "dtable-ui dtable-ui-mobile-row-expand-options-editor position-relative",
44
44
  onClick: openEditor
@@ -61,5 +61,5 @@ function RowExpandMBDepartmentEditor(_ref) {
61
61
  departments: departments,
62
62
  onClose: closeEditor
63
63
  }));
64
- }
64
+ };
65
65
  var _default = exports.default = RowExpandMBDepartmentEditor;
@@ -11,62 +11,60 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
12
12
  var _constants = require("../../constants");
13
13
  var _DepartmentSingleSelectEditor = _interopRequireDefault(require("../../DepartmentSingleSelectEditor"));
14
- function RowExpandPCDepartmentEditor(props) {
15
- const {
14
+ const RowExpandPCDepartmentEditor = _ref => {
15
+ let {
16
16
  row,
17
17
  column,
18
18
  valueKey,
19
19
  departments,
20
20
  userDepartmentIdsMap,
21
21
  isEditorFocus,
22
- columnIndex
23
- } = props;
22
+ columnIndex,
23
+ onCommit,
24
+ updateTabIndex
25
+ } = _ref;
24
26
  const [value, setValue] = (0, _react.useState)(row[column[valueKey]] || '');
25
27
  const [showEditor, setShowEditor] = (0, _react.useState)(false);
26
28
  const departmentSelectContainer = (0, _react.useRef)(null);
27
29
  const departmentSelectContent = (0, _react.useRef)(null);
30
+ const onKeyDown = (0, _react.useCallback)(event => {
31
+ if (event.keyCode === _constants.KeyCodes.Enter && isEditorFocus && !showEditor) {
32
+ setShowEditor(true);
33
+ } else if (event.keyCode === _constants.KeyCodes.Escape && showEditor) {
34
+ event.stopPropagation();
35
+ setShowEditor(false);
36
+ departmentSelectContent.current.focus();
37
+ }
38
+ }, [isEditorFocus, showEditor]);
39
+ const onToggleSelect = (0, _react.useCallback)(event => {
40
+ event.preventDefault();
41
+ event.stopPropagation();
42
+ updateTabIndex(columnIndex);
43
+ setShowEditor(true);
44
+ }, [columnIndex, updateTabIndex]);
45
+ const onFocus = (0, _react.useCallback)(() => {
46
+ updateTabIndex(columnIndex);
47
+ }, [columnIndex, updateTabIndex]);
48
+ const handleCommit = (0, _react.useCallback)(newValue => {
49
+ setShowEditor(false);
50
+ if (newValue === value) return;
51
+ setValue(newValue);
52
+ onCommit(newValue);
53
+ }, [value, onCommit]);
54
+ const closeEditor = (0, _react.useCallback)(() => {
55
+ setShowEditor(false);
56
+ }, []);
28
57
  (0, _react.useEffect)(() => {
29
58
  document.addEventListener('keydown', onKeyDown);
30
59
  return () => {
31
60
  document.removeEventListener('keydown', onKeyDown);
32
61
  };
33
- // eslint-disable-next-line
34
- }, [isEditorFocus, showEditor]);
62
+ }, [onKeyDown]);
35
63
  (0, _react.useEffect)(() => {
36
64
  setValue(row[column[valueKey]] || '');
37
65
  setShowEditor(false);
38
66
  // eslint-disable-next-line
39
- }, [row]);
40
- function onKeyDown(e) {
41
- if (e.keyCode === _constants.KeyCodes.Enter && props.isEditorFocus && !showEditor) {
42
- setShowEditor(true);
43
- } else if (e.keyCode === _constants.KeyCodes.Escape && showEditor) {
44
- e.stopPropagation();
45
- setShowEditor(false);
46
- departmentSelectContent.current.focus();
47
- }
48
- }
49
- function toggleDepartmentSelect(value) {
50
- setShowEditor(value);
51
- }
52
- function onToggleSelect(e) {
53
- e.preventDefault();
54
- e.stopPropagation();
55
- props.updateTabIndex(columnIndex);
56
- toggleDepartmentSelect(true);
57
- }
58
- function onFocus() {
59
- props.updateTabIndex(columnIndex);
60
- }
61
- function onCommit(newValue) {
62
- toggleDepartmentSelect(false);
63
- if (newValue === value) return;
64
- setValue(newValue);
65
- props.onCommit(newValue);
66
- }
67
- function closeEditor() {
68
- toggleDepartmentSelect(false);
69
- }
67
+ }, [row, column]);
70
68
  return /*#__PURE__*/_react.default.createElement("div", {
71
69
  className: "position-relative w-100",
72
70
  ref: departmentSelectContainer
@@ -92,10 +90,10 @@ function RowExpandPCDepartmentEditor(props) {
92
90
  target: departmentSelectContent.current,
93
91
  column: column,
94
92
  value: value,
95
- onCommit: onCommit,
93
+ onCommit: handleCommit,
96
94
  userDepartmentIdsMap: userDepartmentIdsMap,
97
95
  departments: departments,
98
96
  toggleDepartmentSelect: closeEditor
99
97
  }));
100
- }
98
+ };
101
99
  var _default = exports.default = RowExpandPCDepartmentEditor;
@@ -0,0 +1,3 @@
1
+ .dtable-ui-mobile-row-expand-full-screen-page .dtable-ui-mobile-row-expand-body .dtable-ui-mobile-row-expand-item:first-child .dtable-ui-mobile-row-expand-item-title {
2
+ border-top: 0;
3
+ }
@@ -156,7 +156,7 @@ const RowExpandView = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
156
156
  }
157
157
  }), [row, columns]);
158
158
  return /*#__PURE__*/_react.default.createElement(_MobileFullScreenPage.default, {
159
- className: (0, _classnames.default)('seatable-row-expand-full-screen-page', className),
159
+ className: (0, _classnames.default)('dtable-ui-mobile-row-expand-full-screen-page', className),
160
160
  zIndex: zIndex || 100,
161
161
  historyCallback: historyCallback
162
162
  }, /*#__PURE__*/_react.default.createElement(Header, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.29-beta6",
3
+ "version": "6.0.29-beta8",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "4.0.2",