dtable-ui-component 5.3.1-beta → 5.3.1
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/index.css +20 -3
- package/lib/CheckboxEditor/index.js +35 -98
- package/lib/CheckboxFormatter/index.js +9 -6
- package/lib/CollaboratorEditor/index.css +35 -12
- package/lib/CollaboratorEditor/index.js +212 -18
- package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.js +29 -26
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +97 -0
- package/lib/CollaboratorItem/index.css +1 -1
- package/lib/CollaboratorItem/index.js +2 -6
- package/lib/DTableFiltersPopover/utils/index.js +7 -1
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +2 -2
- package/lib/DTableSelect/index.js +1 -3
- package/lib/DateEditor/index.js +51 -14
- package/lib/DateEditor/pc-date-editor-popover.js +12 -145
- package/lib/Department-editor/department-single-select.js +1 -1
- package/lib/Department-editor/index.js +4 -3
- package/lib/DepartmentSingleSelectFormatter/index.js +1 -2
- package/lib/FileEditor/index.js +11 -244
- package/lib/FileEditor/pc-files-addition/index.js +1 -0
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/FileEditor/pc-files-preview/index.js +1 -0
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/FileItemFormatter/assets/file/192/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/192/word.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/excel.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/file.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/music.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pdf.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/pic.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/ppt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/txt.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/video.png +0 -0
- package/lib/FileItemFormatter/assets/file/24/word.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-192.png +0 -0
- package/lib/FileItemFormatter/assets/folder/folder-24.png +0 -0
- package/lib/FileItemFormatter/index.js +20 -19
- package/lib/FileItemFormatter/utils.js +99 -0
- package/lib/FileUploader/index.js +14 -268
- package/lib/FormulaFormatter/index.js +1 -2
- package/lib/FormulaFormatter/utils.js +31 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.js +1 -1
- package/lib/MultipleSelectEditor/index.css +9 -0
- package/lib/MultipleSelectEditor/index.js +177 -16
- package/lib/NumberEditor/index.js +77 -64
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.css +1 -1
- package/lib/{RowExpandFormatter/RowExpandEmailFormatter → RowExpandEmailFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/index.js +1 -3
- package/lib/{RowExpandFormatter/RowExpandFileFormatter → RowExpandFileFormatter}/row-expand-file-item-formatter.js +11 -10
- package/lib/RowExpandFormatter/index.css +0 -26
- package/lib/RowExpandFormatter/index.js +100 -84
- package/lib/{RowExpandFormatter/RowExpandFormulaFormatter → RowExpandFormulaFormatter}/index.js +10 -11
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.css +6 -6
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/index.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandImageFormatter → RowExpandImageFormatter}/row-expand-image-item-formatter.js +3 -3
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/collaborator-item-formatter.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.js +5 -5
- package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/utils.js +1 -1
- package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.css +1 -1
- package/lib/RowExpandUrlFormatter/index.css +1 -0
- package/lib/{RowExpandFormatter/RowExpandUrlFormatter → RowExpandUrlFormatter}/index.js +3 -4
- package/lib/SingleSelectEditor/index.css +14 -0
- package/lib/SingleSelectEditor/index.js +156 -16
- package/lib/TextEditor/index.js +42 -113
- package/lib/constants/index.js +2 -34
- package/lib/css/cell-editor.css +2 -18
- package/lib/index.js +46 -74
- package/lib/lang/index.js +14 -16
- package/lib/locals/de.js +103 -0
- package/lib/locals/en.js +104 -0
- package/lib/locals/es.js +103 -0
- package/lib/locals/fr.js +103 -0
- package/lib/locals/pt.js +103 -0
- package/lib/locals/ru.js +103 -0
- package/lib/locals/zh-CN.js +104 -0
- package/lib/select-editor/index.js +6 -6
- package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.js +3 -3
- package/lib/select-editor/pc-select-editor-popover/index.css +71 -0
- package/lib/select-editor/pc-select-editor-popover/index.js +122 -0
- package/lib/utils/editor-utils.js +6 -1
- package/lib/utils/url.js +8 -119
- package/lib/utils/utils.js +2 -89
- package/package.json +2 -3
- package/lib/CollaboratorEditor/pc-collaborator-editor/index.js +0 -257
- package/lib/DeleteTip/index.js +0 -50
- package/lib/DigitalSignEditor/constants.js +0 -7
- package/lib/DigitalSignEditor/index.css +0 -69
- package/lib/DigitalSignEditor/index.js +0 -182
- package/lib/DigitalSignEditor/service.js +0 -38
- package/lib/DigitalSignEditor/signature-board/index.css +0 -35
- package/lib/DigitalSignEditor/signature-board/index.js +0 -135
- package/lib/DigitalSignEditor/signature-board/signature-tool.js +0 -396
- package/lib/DigitalSignEditor/utils.js +0 -29
- package/lib/DurationEditor/index.js +0 -111
- package/lib/EmailEditor/index.js +0 -59
- package/lib/FileEditor/addition-previewer/index.css +0 -1
- package/lib/FileEditor/addition-previewer/index.js +0 -52
- package/lib/FileEditor/addition-previewer/local-file-addition/index.css +0 -1
- package/lib/FileEditor/addition-previewer/local-file-addition/index.js +0 -252
- package/lib/FileEditor/constants.js +0 -7
- package/lib/FileEditor/files-previewer/file-previewer/dropdown-menu.js +0 -74
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.css +0 -5
- package/lib/FileEditor/files-previewer/file-previewer/file-name-editor/index.js +0 -77
- package/lib/FileEditor/files-previewer/file-previewer/index.css +0 -88
- package/lib/FileEditor/files-previewer/file-previewer/index.js +0 -167
- package/lib/FileEditor/files-previewer/index.css +0 -56
- package/lib/FileEditor/files-previewer/index.js +0 -277
- package/lib/FileEditor/index.css +0 -6
- package/lib/FileEditor/utils.js +0 -22
- package/lib/FileUploader/index.css +0 -9
- package/lib/GeolocationEditor/country-editor.js +0 -319
- package/lib/GeolocationEditor/index.css +0 -641
- package/lib/GeolocationEditor/index.js +0 -241
- package/lib/GeolocationEditor/location-editor.js +0 -368
- package/lib/GeolocationEditor/map-editor/index.js +0 -456
- package/lib/GeolocationEditor/map-editor/large-editor/index.css +0 -137
- package/lib/GeolocationEditor/map-editor/large-editor/index.js +0 -461
- package/lib/GeolocationEditor/map-editor-utils.js +0 -153
- package/lib/GeolocationEditor/map-selection-editor/index.js +0 -455
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.css +0 -1
- package/lib/GeolocationEditor/map-selection-editor/large-editor/index.js +0 -447
- package/lib/GeolocationEditor/parse-geolocation.js +0 -282
- package/lib/GeolocationEditor/province-city-editor.js +0 -292
- package/lib/GeolocationEditor/province-editor.js +0 -226
- package/lib/GeolocationEditor/selector-header-item.js +0 -28
- package/lib/GeolocationEditor/selector-list.js +0 -33
- package/lib/GeolocationEditor/with-ref.js +0 -27
- package/lib/ImageEditor/addition-previewer/image-link/index.css +0 -45
- package/lib/ImageEditor/addition-previewer/image-link/index.js +0 -73
- package/lib/ImageEditor/addition-previewer/index.css +0 -106
- package/lib/ImageEditor/addition-previewer/index.js +0 -63
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.css +0 -125
- package/lib/ImageEditor/addition-previewer/local-image-addition/index.js +0 -254
- package/lib/ImageEditor/constants.js +0 -7
- package/lib/ImageEditor/images-previewer/image-preview/index.css +0 -59
- package/lib/ImageEditor/images-previewer/image-preview/index.js +0 -155
- package/lib/ImageEditor/images-previewer/index.css +0 -18
- package/lib/ImageEditor/images-previewer/index.js +0 -140
- package/lib/ImageEditor/index.css +0 -24
- package/lib/ImageEditor/index.js +0 -194
- package/lib/ImageThumbnail/index.css +0 -20
- package/lib/ImageThumbnail/index.js +0 -136
- package/lib/RowExpandDialog/body/index.css +0 -21
- package/lib/RowExpandDialog/body/index.js +0 -279
- package/lib/RowExpandDialog/column-content/index.css +0 -43
- package/lib/RowExpandDialog/column-content/index.js +0 -50
- package/lib/RowExpandDialog/constants.js +0 -114
- package/lib/RowExpandDialog/header/index.css +0 -31
- package/lib/RowExpandDialog/header/index.js +0 -33
- package/lib/RowExpandDialog/index.css +0 -24
- package/lib/RowExpandDialog/index.js +0 -268
- package/lib/RowExpandDialog/utils.js +0 -83
- package/lib/RowExpandEditor/RowExpandAddBtn/index.css +0 -22
- package/lib/RowExpandEditor/RowExpandAddBtn/index.js +0 -24
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.css +0 -18
- package/lib/RowExpandEditor/RowExpandCheckboxEditor/index.js +0 -43
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.css +0 -5
- package/lib/RowExpandEditor/RowExpandCollaboratorEditor/index.js +0 -232
- package/lib/RowExpandEditor/RowExpandDateEditor/index.js +0 -130
- package/lib/RowExpandEditor/RowExpandDepartmentEditor/index.js +0 -129
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandDigitalSignEditor/index.js +0 -208
- package/lib/RowExpandEditor/RowExpandDurationEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.css +0 -2
- package/lib/RowExpandEditor/RowExpandEmailEditor/index.js +0 -125
- package/lib/RowExpandEditor/RowExpandFileEditor/index.css +0 -1
- package/lib/RowExpandEditor/RowExpandFileEditor/index.js +0 -146
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.css +0 -17
- package/lib/RowExpandEditor/RowExpandGeolocationEditor/index.js +0 -165
- package/lib/RowExpandEditor/RowExpandImageEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandImageEditor/index.js +0 -170
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.css +0 -6
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +0 -124
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.css +0 -44
- package/lib/RowExpandEditor/RowExpandMultipleSelectEditor/index.js +0 -224
- package/lib/RowExpandEditor/RowExpandNumberEditor/index.js +0 -105
- package/lib/RowExpandEditor/RowExpandRateEditor/index.css +0 -13
- package/lib/RowExpandEditor/RowExpandRateEditor/index.js +0 -152
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.css +0 -58
- package/lib/RowExpandEditor/RowExpandSingleSelectorEditor/index.js +0 -192
- package/lib/RowExpandEditor/RowExpandTextEditor/index.css +0 -4
- package/lib/RowExpandEditor/RowExpandTextEditor/index.js +0 -127
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.css +0 -31
- package/lib/RowExpandEditor/RowExpandUrlEditor/index.js +0 -130
- package/lib/RowExpandEditor/constants.js +0 -44
- package/lib/RowExpandEditor/index.css +0 -0
- package/lib/RowExpandEditor/index.js +0 -32
- package/lib/RowExpandFormatter/RowExpandDepartmentFormatter/index.js +0 -27
- package/lib/RowExpandFormatter/RowExpandUrlFormatter/index.css +0 -1
- package/lib/RowExpandFormatter/constants.js +0 -60
- package/lib/UploadProgress/index.js +0 -38
- package/lib/UrlEditor/index.js +0 -62
- package/lib/common/editor-base.js +0 -53
- package/lib/constants/file.js +0 -96
- package/lib/constants/key-codes.js +0 -109
- package/lib/hooks/index.js +0 -16
- package/lib/locales/de.json +0 -163
- package/lib/locales/en.json +0 -163
- package/lib/locales/es.json +0 -163
- package/lib/locales/fr.json +0 -163
- package/lib/locales/pt.json +0 -163
- package/lib/locales/ru.json +0 -163
- package/lib/locales/zh-CN.json +0 -163
- package/lib/select-editor/pc-select-editor/index.css +0 -85
- package/lib/select-editor/pc-select-editor/index.js +0 -290
- package/lib/utils/cell-comparer.js +0 -35
- package/lib/utils/cell.js +0 -55
- package/lib/utils/column-utils.js +0 -25
- package/lib/utils/get-event-transfer.js +0 -75
- package/lib/utils/object-utils.js +0 -61
- /package/lib/CollaboratorEditor/{mb-collaborator-editor → mb-collaborator-editor-popover}/index.css +0 -0
- /package/lib/CollaboratorEditor/{pc-collaborator-editor → pc-collaborator-editor-popover}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/index.css +0 -0
- /package/lib/{RowExpandFormatter/RowExpandLinkFormatter → RowExpandLinkFormatter}/value-display-utils.js +0 -0
- /package/lib/{RowExpandFormatter/RowExpandRateFormatter → RowExpandRateFormatter}/index.js +0 -0
- /package/lib/select-editor/{mb-select-editor → mb-select-editor-popover}/index.css +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _dtableUtils = require("dtable-utils");
|
|
10
|
-
var _utils = require("../../utils/utils");
|
|
11
|
-
var _columnUtils = require("../../utils/column-utils");
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
var _DateEditor = _interopRequireDefault(require("../../DateEditor"));
|
|
14
|
-
class RowExpandDateEditor extends _react.default.Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
this.onKeyDown = e => {
|
|
18
|
-
if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.isShowEditor) {
|
|
19
|
-
if ((0, _utils.getEventClassName)(e).includes('rc-calendar')) return;
|
|
20
|
-
this.setState({
|
|
21
|
-
isShowEditor: true
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
this.hideCalendar = () => {
|
|
26
|
-
this.setState({
|
|
27
|
-
isShowEditor: false
|
|
28
|
-
}, () => {
|
|
29
|
-
this.dateContainerRef && this.dateContainerRef.focus();
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
this.onFocus = () => {
|
|
33
|
-
this.props.updateTabIndex(this.props.columnIndex);
|
|
34
|
-
};
|
|
35
|
-
this.toggleEditor = () => {
|
|
36
|
-
this.props.updateTabIndex(this.props.columnIndex);
|
|
37
|
-
this.setState({
|
|
38
|
-
isShowEditor: !this.state.isShowEditor
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
this.onCommit = value => {
|
|
42
|
-
this.props.onCommit(value);
|
|
43
|
-
this.setState({
|
|
44
|
-
value
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
this.onClear = () => {
|
|
48
|
-
this.setState({
|
|
49
|
-
value: null
|
|
50
|
-
});
|
|
51
|
-
this.props.onCommit(null);
|
|
52
|
-
};
|
|
53
|
-
this.state = {
|
|
54
|
-
isShowEditor: false,
|
|
55
|
-
value: null
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
const {
|
|
60
|
-
column,
|
|
61
|
-
row,
|
|
62
|
-
valueKey
|
|
63
|
-
} = this.props;
|
|
64
|
-
this.setState({
|
|
65
|
-
value: row[column[valueKey]]
|
|
66
|
-
});
|
|
67
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
68
|
-
}
|
|
69
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
70
|
-
const {
|
|
71
|
-
column,
|
|
72
|
-
row,
|
|
73
|
-
valueKey
|
|
74
|
-
} = nextProps;
|
|
75
|
-
if (row._id !== this.props.row._id) {
|
|
76
|
-
this.setState({
|
|
77
|
-
value: row[column[valueKey]],
|
|
78
|
-
isShowEditor: false
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
componentDidUpdate(prevProps, prevState) {
|
|
83
|
-
if (this.state.isShowEditor !== prevState.isShowEditor) {
|
|
84
|
-
if (this.state.isShowEditor === true && this.props.onEditorOpen) {
|
|
85
|
-
this.props.onEditorOpen();
|
|
86
|
-
}
|
|
87
|
-
if (this.state.isShowEditor === false && this.props.onEditorClose) {
|
|
88
|
-
this.props.onEditorClose();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
componentWillUnmount() {
|
|
93
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
94
|
-
}
|
|
95
|
-
render() {
|
|
96
|
-
let {
|
|
97
|
-
column,
|
|
98
|
-
isInModal,
|
|
99
|
-
isEditorFocus,
|
|
100
|
-
lang
|
|
101
|
-
} = this.props;
|
|
102
|
-
let {
|
|
103
|
-
value,
|
|
104
|
-
isShowEditor
|
|
105
|
-
} = this.state;
|
|
106
|
-
const format = (0, _columnUtils.getDateColumnFormat)(column);
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
-
ref: ref => this.dateSelectRef = ref
|
|
109
|
-
}, isShowEditor ? /*#__PURE__*/_react.default.createElement(_DateEditor.default, {
|
|
110
|
-
isInModal: isInModal,
|
|
111
|
-
value: value,
|
|
112
|
-
lang: lang,
|
|
113
|
-
column: column,
|
|
114
|
-
onCommit: this.onCommit,
|
|
115
|
-
hideCalendar: this.hideCalendar
|
|
116
|
-
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
117
|
-
tabIndex: 0,
|
|
118
|
-
onFocus: this.onFocus,
|
|
119
|
-
onClick: this.toggleEditor,
|
|
120
|
-
ref: ref => this.dateContainerRef = ref,
|
|
121
|
-
className: "form-control",
|
|
122
|
-
style: isEditorFocus ? Object.assign({
|
|
123
|
-
width: 320
|
|
124
|
-
}, _constants.ROW_EXPAND_FOCUS_STYLE) : {
|
|
125
|
-
width: 320
|
|
126
|
-
}
|
|
127
|
-
}, value ? (0, _dtableUtils.getDateDisplayString)(value, format) : ''));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
var _default = exports.default = RowExpandDateEditor;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _hooks = require("../../hooks");
|
|
12
|
-
var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
|
|
13
|
-
var _constants = require("../../constants");
|
|
14
|
-
var _lang = require("../../lang");
|
|
15
|
-
var _departmentSingleSelect = _interopRequireDefault(require("../../Department-editor/department-single-select"));
|
|
16
|
-
var _constants2 = require("../../Department-editor/constants");
|
|
17
|
-
function RowExpandDepartmentEditor(props) {
|
|
18
|
-
const {
|
|
19
|
-
row,
|
|
20
|
-
column,
|
|
21
|
-
valueKey,
|
|
22
|
-
departments,
|
|
23
|
-
userDepartmentIdsMap,
|
|
24
|
-
isEditorFocus,
|
|
25
|
-
columnIndex
|
|
26
|
-
} = props;
|
|
27
|
-
const [value, setValue] = (0, _react.useState)(row[column[valueKey]] || '');
|
|
28
|
-
const [showEditor, setShowEditor] = (0, _react.useState)(false);
|
|
29
|
-
const departmentSelectContainer = (0, _react.useRef)(null);
|
|
30
|
-
const departmentSelectContent = (0, _react.useRef)(null);
|
|
31
|
-
(0, _hooks.useClickOutside)({
|
|
32
|
-
currDOM: departmentSelectContainer.current,
|
|
33
|
-
onClickOutside: hideDropDownMenu
|
|
34
|
-
}, [isEditorFocus, value]);
|
|
35
|
-
(0, _react.useEffect)(() => {
|
|
36
|
-
document.addEventListener('keydown', onKeyDown);
|
|
37
|
-
return () => {
|
|
38
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
39
|
-
};
|
|
40
|
-
// eslint-disable-next-line
|
|
41
|
-
}, [isEditorFocus]);
|
|
42
|
-
(0, _react.useEffect)(() => {
|
|
43
|
-
setValue(row[column[valueKey]] || '');
|
|
44
|
-
setShowEditor(false);
|
|
45
|
-
// eslint-disable-next-line
|
|
46
|
-
}, [row]);
|
|
47
|
-
function hideDropDownMenu(event) {
|
|
48
|
-
if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
|
|
49
|
-
toggleDepartmentSelect(false);
|
|
50
|
-
}
|
|
51
|
-
function onKeyDown(e) {
|
|
52
|
-
if (e.keyCode === _constants.KeyCodes.Enter && props.isEditorFocus && !showEditor) {
|
|
53
|
-
setShowEditor(true);
|
|
54
|
-
} else if (e.keyCode === _constants.KeyCodes.Escape) {
|
|
55
|
-
e.stopPropagation();
|
|
56
|
-
setShowEditor(false);
|
|
57
|
-
departmentSelectContent.current.focus();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function toggleDepartmentSelect(value) {
|
|
61
|
-
setShowEditor(value);
|
|
62
|
-
}
|
|
63
|
-
function onToggleSelect(e) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
e.stopPropagation();
|
|
66
|
-
props.updateTabIndex(columnIndex);
|
|
67
|
-
toggleDepartmentSelect(true);
|
|
68
|
-
}
|
|
69
|
-
function onFocus() {
|
|
70
|
-
props.updateTabIndex(columnIndex);
|
|
71
|
-
}
|
|
72
|
-
function onCommit(newValue) {
|
|
73
|
-
toggleDepartmentSelect(false);
|
|
74
|
-
if (newValue === value) return;
|
|
75
|
-
setValue(newValue);
|
|
76
|
-
props.onCommit(newValue);
|
|
77
|
-
}
|
|
78
|
-
function renderUserDepartmentOptions(onSelect) {
|
|
79
|
-
if (Array.isArray(departments) && departments.length > 0) return [];
|
|
80
|
-
return _constants2.DEPARTMENT_SELECT_RANGE_OPTIONS.slice(0, 2).map((option, index) => {
|
|
81
|
-
const {
|
|
82
|
-
type,
|
|
83
|
-
name
|
|
84
|
-
} = option;
|
|
85
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
-
className: "department-item",
|
|
87
|
-
key: index,
|
|
88
|
-
onClick: event => onSelect(event, type)
|
|
89
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
-
className: "department-item-left-content d-flex align-items-center"
|
|
91
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
92
|
-
className: "text-truncate department-name"
|
|
93
|
-
}, (0, _lang.getLocale)(name)), value === type && /*#__PURE__*/_react.default.createElement("span", {
|
|
94
|
-
className: "department-check-icon"
|
|
95
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
96
|
-
className: "dtable-font dtable-icon-check-mark"
|
|
97
|
-
}))));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
-
className: "position-relative w-100",
|
|
102
|
-
ref: departmentSelectContainer
|
|
103
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
-
tabIndex: 0,
|
|
105
|
-
onFocus: onFocus,
|
|
106
|
-
onClick: onToggleSelect,
|
|
107
|
-
ref: departmentSelectContent,
|
|
108
|
-
className: (0, _classnames.default)('dtable-ui-row-expand-select-editor', 'custom-select', {
|
|
109
|
-
'focus': isEditorFocus
|
|
110
|
-
})
|
|
111
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
-
className: "dtable-ui-row-expand-select-editor-inner"
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectFormatter.default, {
|
|
114
|
-
value: value,
|
|
115
|
-
departments: departments
|
|
116
|
-
})), /*#__PURE__*/_react.default.createElement("i", {
|
|
117
|
-
"aria-hidden": "true",
|
|
118
|
-
className: "dtable-font dtable-icon-down3"
|
|
119
|
-
}))), showEditor && /*#__PURE__*/_react.default.createElement(_departmentSingleSelect.default, {
|
|
120
|
-
enableSelectRange: false,
|
|
121
|
-
column: column,
|
|
122
|
-
value: value,
|
|
123
|
-
onCommit: onCommit,
|
|
124
|
-
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
125
|
-
departments: departments,
|
|
126
|
-
renderUserDepartmentOptions: renderUserDepartmentOptions
|
|
127
|
-
}));
|
|
128
|
-
}
|
|
129
|
-
var _default = exports.default = RowExpandDepartmentEditor;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
@import url('../RowExpandImageEditor/index.css');
|
|
2
|
-
|
|
3
|
-
.dtable-ui-row-expand-digital-sign-container .dtable-ui-image-thumbnail {
|
|
4
|
-
max-width: 200px;
|
|
5
|
-
width: 200px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.dtable-ui-row-expand-digital-sign-container .dtable-ui-image-thumbnail img {
|
|
9
|
-
max-width: 192px;
|
|
10
|
-
width: 192px;
|
|
11
|
-
height: 96px;
|
|
12
|
-
max-height: 96px;
|
|
13
|
-
}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
|
|
10
|
-
var _ImageThumbnail = _interopRequireDefault(require("../../ImageThumbnail"));
|
|
11
|
-
var _utils = _interopRequireDefault(require("../../DigitalSignEditor/utils"));
|
|
12
|
-
var _constants = require("../../constants");
|
|
13
|
-
var _RowExpandAddBtn = _interopRequireDefault(require("../RowExpandAddBtn"));
|
|
14
|
-
var _DigitalSignEditor = _interopRequireDefault(require("../../DigitalSignEditor"));
|
|
15
|
-
var _lang = require("../../lang");
|
|
16
|
-
var _url = require("../../utils/url");
|
|
17
|
-
require("./index.css");
|
|
18
|
-
class RowExpandDigitalSignEditor extends _react.default.Component {
|
|
19
|
-
constructor(props) {
|
|
20
|
-
super(props);
|
|
21
|
-
this.onKeyDown = e => {
|
|
22
|
-
if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.isShowEditor) {
|
|
23
|
-
this.setState({
|
|
24
|
-
isShowEditor: true
|
|
25
|
-
});
|
|
26
|
-
} else if (e.keyCode === _constants.KeyCodes.Esc && this.state.isShowEditor) {
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
this.setState({
|
|
29
|
-
isShowEditor: false
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
this.onFocus = () => {
|
|
34
|
-
if (this.props.updateTabIndex) {
|
|
35
|
-
this.props.updateTabIndex(this.props.columnIndex);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
this.hideEditor = event => {
|
|
39
|
-
if (!this.state.isShowEditor || !this.editorContainer || !event || this.editorContainer.contains(event.target)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
this.setState({
|
|
43
|
-
isShowEditor: false
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
this.toggleEditor = () => {
|
|
47
|
-
if (this.props.updateTabIndex) {
|
|
48
|
-
this.props.updateTabIndex(this.props.columnIndex);
|
|
49
|
-
}
|
|
50
|
-
if (this.props.readOnly) return;
|
|
51
|
-
this.setState({
|
|
52
|
-
isShowEditor: !this.state.isShowEditor
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
this.onCommit = value => {
|
|
56
|
-
this.setState({
|
|
57
|
-
updated: value,
|
|
58
|
-
isShowEditor: !this.state.isShowEditor
|
|
59
|
-
});
|
|
60
|
-
this.props.onCommit(value);
|
|
61
|
-
};
|
|
62
|
-
this.getValue = () => {
|
|
63
|
-
const {
|
|
64
|
-
column,
|
|
65
|
-
row,
|
|
66
|
-
valueKey
|
|
67
|
-
} = this.props;
|
|
68
|
-
const {
|
|
69
|
-
updated
|
|
70
|
-
} = this.state;
|
|
71
|
-
return updated ? updated : row[column[valueKey]];
|
|
72
|
-
};
|
|
73
|
-
this.deleteImage = () => {
|
|
74
|
-
const {
|
|
75
|
-
column,
|
|
76
|
-
onCommit
|
|
77
|
-
} = this.props;
|
|
78
|
-
const updated = {
|
|
79
|
-
[column.key]: null
|
|
80
|
-
};
|
|
81
|
-
onCommit(updated, column);
|
|
82
|
-
this.setState({
|
|
83
|
-
updated: null
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
this.getSignImages = () => {
|
|
87
|
-
const {
|
|
88
|
-
config
|
|
89
|
-
} = this.props;
|
|
90
|
-
const value = this.getValue();
|
|
91
|
-
const signImageUrl = (0, _url.generateCurrentBaseImageUrl)({
|
|
92
|
-
...config,
|
|
93
|
-
partUrl: _utils.default.getSignImageUrl(value)
|
|
94
|
-
});
|
|
95
|
-
return [signImageUrl].filter(Boolean);
|
|
96
|
-
};
|
|
97
|
-
this.setLargeImageIndex = index => {
|
|
98
|
-
this.setState({
|
|
99
|
-
largeImageIndex: index
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
this.moveToNextImage = () => {};
|
|
103
|
-
this.moveToPrevImage = () => {};
|
|
104
|
-
this.hideLargeImage = () => {
|
|
105
|
-
this.setLargeImageIndex(-1);
|
|
106
|
-
};
|
|
107
|
-
this.renderSignature = signImages => {
|
|
108
|
-
const {
|
|
109
|
-
column
|
|
110
|
-
} = this.props;
|
|
111
|
-
const {
|
|
112
|
-
key
|
|
113
|
-
} = column;
|
|
114
|
-
return signImages.map((src, index) => {
|
|
115
|
-
return /*#__PURE__*/_react.default.createElement(_ImageThumbnail.default, {
|
|
116
|
-
key: "sing-image-".concat(key, "-").concat(index),
|
|
117
|
-
index: index,
|
|
118
|
-
src: src,
|
|
119
|
-
column: column,
|
|
120
|
-
onClick: this.setLargeImageIndex,
|
|
121
|
-
deleteImage: this.deleteImage,
|
|
122
|
-
disableImageTooltip: true
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
this.state = {
|
|
127
|
-
isShowEditor: false,
|
|
128
|
-
updated: null,
|
|
129
|
-
largeImageIndex: -1
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
componentDidMount() {
|
|
133
|
-
document.addEventListener('mousedown', this.hideEditor);
|
|
134
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
135
|
-
}
|
|
136
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
137
|
-
const {
|
|
138
|
-
column,
|
|
139
|
-
row,
|
|
140
|
-
valueKey
|
|
141
|
-
} = nextProps;
|
|
142
|
-
if (row._id !== this.props.row._id) {
|
|
143
|
-
this.setState({
|
|
144
|
-
updated: row[column[valueKey]] || [],
|
|
145
|
-
isShowEditor: false,
|
|
146
|
-
largeImageIndex: -1
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
componentDidUpdate(prevProps, prevState) {
|
|
151
|
-
if (this.state.isShowEditor !== prevState.isShowEditor) {
|
|
152
|
-
if (this.state.isShowEditor === true && this.props.onEditorOpen) {
|
|
153
|
-
this.props.onEditorOpen();
|
|
154
|
-
}
|
|
155
|
-
if (this.state.isShowEditor === false && this.props.onEditorClose) {
|
|
156
|
-
this.props.onEditorClose();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
componentWillUnmount() {
|
|
161
|
-
document.removeEventListener('mousedown', this.hideEditor);
|
|
162
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
163
|
-
}
|
|
164
|
-
render() {
|
|
165
|
-
const {
|
|
166
|
-
config,
|
|
167
|
-
column,
|
|
168
|
-
isEditorFocus
|
|
169
|
-
} = this.props;
|
|
170
|
-
const {
|
|
171
|
-
isShowEditor,
|
|
172
|
-
largeImageIndex
|
|
173
|
-
} = this.state;
|
|
174
|
-
const signImages = this.getSignImages();
|
|
175
|
-
const signImageExisted = Array.isArray(signImages) && signImages.length > 0;
|
|
176
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
177
|
-
className: "position-relative mt-2",
|
|
178
|
-
ref: ref => this.editorContainer = ref
|
|
179
|
-
}, !signImageExisted && /*#__PURE__*/_react.default.createElement(_RowExpandAddBtn.default, {
|
|
180
|
-
onClick: this.toggleEditor,
|
|
181
|
-
onFocus: this.onFocus,
|
|
182
|
-
isFocus: isEditorFocus,
|
|
183
|
-
text: (0, _lang.getLocale)('Edit_signature')
|
|
184
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
185
|
-
className: "dtable-ui-row-expand-image-container dtable-ui-row-expand-digital-sign-container"
|
|
186
|
-
}, this.renderSignature(signImages)), isShowEditor && /*#__PURE__*/_react.default.createElement(_DigitalSignEditor.default, {
|
|
187
|
-
isInModal: true,
|
|
188
|
-
config: config,
|
|
189
|
-
value: this.getValue(),
|
|
190
|
-
column: column,
|
|
191
|
-
onCommitCancel: this.toggleEditor,
|
|
192
|
-
onCommit: this.onCommit,
|
|
193
|
-
uploadFile: this.props.uploadFile
|
|
194
|
-
}), largeImageIndex > -1 && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
|
|
195
|
-
imageItems: signImages,
|
|
196
|
-
imageIndex: largeImageIndex,
|
|
197
|
-
wrapperClassName: 'digital-sign-image',
|
|
198
|
-
closeImagePopup: this.hideLargeImage,
|
|
199
|
-
moveToPrevImage: this.moveToPrevImage,
|
|
200
|
-
moveToNextImage: this.moveToNextImage,
|
|
201
|
-
deleteImage: index => {
|
|
202
|
-
this.deleteImage(index);
|
|
203
|
-
this.hideLargeImage();
|
|
204
|
-
}
|
|
205
|
-
}));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
var _default = exports.default = RowExpandDigitalSignEditor;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _dtableUtils = require("dtable-utils");
|
|
11
|
-
var _constants = require("../../constants");
|
|
12
|
-
var _DurationEditor = _interopRequireDefault(require("../../DurationEditor"));
|
|
13
|
-
class RowExpandDurationEditor extends _react.default.Component {
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(props);
|
|
16
|
-
this.onKeyDown = e => {
|
|
17
|
-
if (e.keyCode === _constants.KeyCodes.Enter && this.props.isEditorFocus && !this.state.showCollaboratorSelect) {
|
|
18
|
-
this.setState({
|
|
19
|
-
isShowEditor: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
this.toggleEditor = () => {
|
|
24
|
-
this.props.updateTabIndex(this.props.columnIndex);
|
|
25
|
-
this.setState({
|
|
26
|
-
isShowEditor: !this.state.isShowEditor
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
this.onCommit = value => {
|
|
30
|
-
this.props.onCommit(value);
|
|
31
|
-
this.setState({
|
|
32
|
-
value,
|
|
33
|
-
isShowEditor: false
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
let {
|
|
37
|
-
row,
|
|
38
|
-
column,
|
|
39
|
-
valueKey
|
|
40
|
-
} = props;
|
|
41
|
-
this.state = {
|
|
42
|
-
isShowEditor: false,
|
|
43
|
-
value: row[column[valueKey]]
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
componentDidMount() {
|
|
47
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
48
|
-
}
|
|
49
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
50
|
-
const {
|
|
51
|
-
column,
|
|
52
|
-
row,
|
|
53
|
-
valueKey
|
|
54
|
-
} = nextProps;
|
|
55
|
-
if (row._id !== this.props.row._id) {
|
|
56
|
-
this.setState({
|
|
57
|
-
value: row[column[valueKey]],
|
|
58
|
-
isShowEditor: false
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
if (nextProps.isEditorFocus !== this.props.isEditorFocus) {
|
|
62
|
-
let activeInput = document.activeElement;
|
|
63
|
-
if (nextProps.isEditorFocus === false && activeInput) {
|
|
64
|
-
activeInput.blur();
|
|
65
|
-
}
|
|
66
|
-
this.setState({
|
|
67
|
-
isShowEditor: nextProps.isEditorFocus
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
componentWillUnmount() {
|
|
72
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
73
|
-
}
|
|
74
|
-
render() {
|
|
75
|
-
let {
|
|
76
|
-
column,
|
|
77
|
-
isEditorFocus,
|
|
78
|
-
isInModal
|
|
79
|
-
} = this.props;
|
|
80
|
-
let {
|
|
81
|
-
value,
|
|
82
|
-
isShowEditor
|
|
83
|
-
} = this.state;
|
|
84
|
-
let style = {
|
|
85
|
-
width: 320
|
|
86
|
-
};
|
|
87
|
-
if (isEditorFocus) {
|
|
88
|
-
style = Object.assign({}, style, _constants.ROW_EXPAND_FOCUS_STYLE);
|
|
89
|
-
}
|
|
90
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, isShowEditor ? /*#__PURE__*/_react.default.createElement(_DurationEditor.default, {
|
|
91
|
-
isInModal: isInModal,
|
|
92
|
-
column: column,
|
|
93
|
-
value: value,
|
|
94
|
-
toggleEditor: this.toggleEditor,
|
|
95
|
-
onCommit: this.onCommit
|
|
96
|
-
}) : /*#__PURE__*/_react.default.createElement("div", {
|
|
97
|
-
tabIndex: 0,
|
|
98
|
-
onFocus: this.toggleEditor,
|
|
99
|
-
onClick: this.toggleEditor,
|
|
100
|
-
className: "form-control",
|
|
101
|
-
style: style
|
|
102
|
-
}, (0, _dtableUtils.getDurationDisplayString)(value, column.data)));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
var _default = exports.default = RowExpandDurationEditor;
|