dtable-ui-component 6.0.29-beta7 → 6.0.29-beta9
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.
- package/lib/CheckboxEditor/mb-editor.js +1 -3
- package/lib/CheckboxEditor/pc-editor.js +1 -1
- package/lib/DepartmentSingleSelectEditor/pc-editor/department-single-select.js +1 -1
- package/lib/DepartmentSingleSelectEditor/pc-editor/index.css +2 -0
- package/lib/RowExpandEditor/checkbox-editor/mb-editor/index.js +3 -6
- package/lib/RowExpandEditor/checkbox-editor/pc-editor.js +7 -10
- package/lib/RowExpandEditor/department-editor/mb-editor.js +7 -7
- package/lib/RowExpandEditor/department-editor/pc-editor.js +37 -39
- package/package.json +1 -1
|
@@ -40,9 +40,7 @@ class MBCheckboxEditor extends _react.Component {
|
|
|
40
40
|
this.setState({
|
|
41
41
|
value: newValue
|
|
42
42
|
}, () => {
|
|
43
|
-
|
|
44
|
-
this.props.onCommit(event);
|
|
45
|
-
}
|
|
43
|
+
this.props.onCommit && this.props.onCommit(newValue);
|
|
46
44
|
});
|
|
47
45
|
};
|
|
48
46
|
this.renderIcon = (symbol, color) => {
|
|
@@ -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: "
|
|
205
|
+
className: "none-search-result pl-4 pr-4"
|
|
206
206
|
}, (0, _lang.getLocale)('No_departments_available'));
|
|
207
207
|
};
|
|
208
208
|
this.renderMenuContent = () => {
|
|
@@ -12,10 +12,8 @@ require("./index.css");
|
|
|
12
12
|
class RowExpandMBCheckboxEditor extends _react.default.Component {
|
|
13
13
|
constructor(props) {
|
|
14
14
|
super(props);
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
const newValue = this.editor.getValue();
|
|
18
|
-
this.props.onCommit(newValue);
|
|
15
|
+
this.onCommit = newValue => {
|
|
16
|
+
this.props.onCommit && this.props.onCommit(newValue);
|
|
19
17
|
};
|
|
20
18
|
this.editor = null;
|
|
21
19
|
}
|
|
@@ -28,11 +26,10 @@ class RowExpandMBCheckboxEditor extends _react.default.Component {
|
|
|
28
26
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
29
27
|
className: (0, _classnames.default)('dtable-ui-mobile-row-expand-checkbox-editor-container', className)
|
|
30
28
|
}, /*#__PURE__*/_react.default.createElement(_CheckboxEditor.default, {
|
|
31
|
-
ref: ref => this.editor = ref,
|
|
32
29
|
className: "dtable-ui-row-expand-checkbox-editor mt-0",
|
|
33
30
|
column: column,
|
|
34
31
|
value: value,
|
|
35
|
-
onCommit: this.
|
|
32
|
+
onCommit: this.onCommit
|
|
36
33
|
}));
|
|
37
34
|
}
|
|
38
35
|
}
|
|
@@ -11,16 +11,14 @@ var _constants = require("../../constants");
|
|
|
11
11
|
class RowExpandPCCheckboxEditor extends _react.default.Component {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
|
-
this.
|
|
14
|
+
this.onCommit = newValue => {
|
|
15
15
|
const {
|
|
16
|
-
columnIndex
|
|
16
|
+
columnIndex,
|
|
17
|
+
updateTabIndex,
|
|
18
|
+
onCommit
|
|
17
19
|
} = this.props;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.props.updateTabIndex(columnIndex);
|
|
21
|
-
}
|
|
22
|
-
const newValue = this.editor.getValue();
|
|
23
|
-
this.props.onCommit(newValue);
|
|
20
|
+
updateTabIndex && updateTabIndex(columnIndex);
|
|
21
|
+
onCommit && onCommit(newValue);
|
|
24
22
|
};
|
|
25
23
|
}
|
|
26
24
|
render() {
|
|
@@ -30,12 +28,11 @@ class RowExpandPCCheckboxEditor extends _react.default.Component {
|
|
|
30
28
|
value
|
|
31
29
|
} = this.props;
|
|
32
30
|
return /*#__PURE__*/_react.default.createElement(_CheckboxEditor.default, {
|
|
33
|
-
ref: ref => this.editor = ref,
|
|
34
31
|
className: "dtable-ui-row-expand-checkbox-editor mt-2",
|
|
35
32
|
column: column,
|
|
36
33
|
value: value,
|
|
37
34
|
style: isEditorFocus ? _constants.ROW_EXPAND_FOCUS_STYLE : {},
|
|
38
|
-
onCommit: this.
|
|
35
|
+
onCommit: this.onCommit
|
|
39
36
|
});
|
|
40
37
|
}
|
|
41
38
|
}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
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;
|