dtable-ui-component 5.3.1-beta1 → 6.0.0
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/LongTextFormatter/index.js +4 -7
- package/lib/MultipleSelectEditor/index.css +9 -0
- package/lib/MultipleSelectEditor/index.js +177 -16
- package/lib/NumberEditor/index.js +77 -64
- package/lib/RoleStatusEditor/index.js +5 -4
- 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/toaster/toaster.js +4 -3
- 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 +13 -14
- 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 -272
- 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
|
@@ -4,11 +4,28 @@
|
|
|
4
4
|
height: 24px;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.dtable-ui-checkbox-editor .
|
|
7
|
+
.dtable-ui-checkbox-editor .raw-checkbox {
|
|
8
|
+
position: absolute;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dtable-ui-checkbox-editor .shown-checkbox {
|
|
15
|
+
height: 100%;
|
|
16
|
+
border: 2px solid #e0e0e0;
|
|
17
|
+
border-radius: 3px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dtable-ui-checkbox-editor .raw-checkbox:focus + .shown-checkbox {
|
|
21
|
+
border-color: #3b88fd;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dtable-ui-checkbox-editor .shown-checkbox .dtable-icon-check-mark {
|
|
8
25
|
display: flex;
|
|
9
26
|
align-items: center;
|
|
10
27
|
justify-content: center;
|
|
11
|
-
font-size:
|
|
12
|
-
font-weight: 600;
|
|
28
|
+
font-size: 14px;
|
|
13
29
|
color: #20c933;
|
|
30
|
+
font-weight: 500;
|
|
14
31
|
}
|
|
@@ -1,127 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
var _react =
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _utils = require("../utils/utils");
|
|
12
|
-
var _constants = require("../constants");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
9
|
require("./index.css");
|
|
14
|
-
class CheckboxEditor extends _react.Component {
|
|
10
|
+
class CheckboxEditor extends _react.default.Component {
|
|
15
11
|
constructor(props) {
|
|
16
12
|
super(props);
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
this.onCommit = () => {
|
|
14
|
+
let updated = {};
|
|
15
|
+
let {
|
|
16
|
+
column
|
|
21
17
|
} = this.props;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value: !this.state.value
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
this.getValue = () => {
|
|
29
|
-
const {
|
|
30
|
-
value
|
|
31
|
-
} = this.state;
|
|
32
|
-
return value;
|
|
18
|
+
updated[column.name] = this.state.value;
|
|
19
|
+
this.props.onCommit(updated);
|
|
33
20
|
};
|
|
34
|
-
this.
|
|
35
|
-
if (
|
|
21
|
+
this.onChange = event => {
|
|
22
|
+
if (this.props.isReadOnly) {
|
|
36
23
|
return;
|
|
37
24
|
}
|
|
38
25
|
this.setState({
|
|
39
|
-
value
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
this.onChangeCheckboxValue = event => {
|
|
43
|
-
if (event) {
|
|
44
|
-
event.stopPropagation();
|
|
45
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
46
|
-
event.persist();
|
|
47
|
-
}
|
|
48
|
-
const {
|
|
49
|
-
value
|
|
50
|
-
} = this.state;
|
|
51
|
-
const newValue = !value;
|
|
52
|
-
this.setState({
|
|
53
|
-
value: newValue
|
|
26
|
+
value: !this.state.value
|
|
54
27
|
}, () => {
|
|
55
|
-
|
|
56
|
-
this.props.onCommit(event);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
this.renderIcon = (symbol, color) => {
|
|
61
|
-
const className = (0, _classnames.default)('dtable-ui-checkbox-check-mark', {
|
|
62
|
-
'dtable-ui-checkbox-check-svg': !(symbol !== null && symbol !== void 0 && symbol.startsWith('dtable-icon'))
|
|
63
|
-
});
|
|
64
|
-
if (symbol.startsWith('dtable-icon')) {
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
66
|
-
className: "dtable-font ".concat(symbol, " ").concat(className || ''),
|
|
67
|
-
style: {
|
|
68
|
-
color
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return /*#__PURE__*/_react.default.createElement("span", {
|
|
73
|
-
className: "dtable-font dtable-icon-".concat(symbol, " ").concat(className || ''),
|
|
74
|
-
style: {
|
|
75
|
-
color
|
|
76
|
-
}
|
|
28
|
+
this.onCommit();
|
|
77
29
|
});
|
|
78
30
|
};
|
|
79
31
|
this.state = {
|
|
80
|
-
value: props.value
|
|
32
|
+
value: props.value ? props.value : false
|
|
81
33
|
};
|
|
82
34
|
}
|
|
83
|
-
componentDidMount() {
|
|
84
|
-
document.addEventListener('keydown', this.onKeyDown);
|
|
85
|
-
}
|
|
86
|
-
componentWillUnmount() {
|
|
87
|
-
document.removeEventListener('keydown', this.onKeyDown);
|
|
88
|
-
}
|
|
89
|
-
componentDidUpdate(prevProps) {
|
|
90
|
-
const {
|
|
91
|
-
value
|
|
92
|
-
} = this.props;
|
|
93
|
-
if (value !== prevProps.value) {
|
|
94
|
-
this.setState({
|
|
95
|
-
value
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
35
|
render() {
|
|
100
|
-
var _column$data;
|
|
101
|
-
const {
|
|
102
|
-
className,
|
|
103
|
-
style,
|
|
104
|
-
column
|
|
105
|
-
} = this.props;
|
|
106
36
|
const {
|
|
107
37
|
value
|
|
108
38
|
} = this.state;
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
onTouchStart: this.onChangeCheckboxValue
|
|
115
|
-
})
|
|
39
|
+
const {
|
|
40
|
+
isReadOnly
|
|
41
|
+
} = this.props;
|
|
42
|
+
let style = {
|
|
43
|
+
cursor: isReadOnly ? 'default' : 'pointer'
|
|
116
44
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
className:
|
|
123
|
-
|
|
124
|
-
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
+
className: "dtable-ui-checkbox-editor",
|
|
47
|
+
style: style
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
49
|
+
type: "checkbox",
|
|
50
|
+
className: "raw-checkbox",
|
|
51
|
+
checked: value,
|
|
52
|
+
onChange: this.onChange
|
|
53
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
54
|
+
className: "shown-checkbox"
|
|
55
|
+
}, value && /*#__PURE__*/_react.default.createElement("span", {
|
|
56
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
57
|
+
})));
|
|
125
58
|
}
|
|
126
59
|
}
|
|
60
|
+
CheckboxEditor.defaultProps = {
|
|
61
|
+
isReadOnly: false,
|
|
62
|
+
value: false
|
|
63
|
+
};
|
|
127
64
|
var _default = exports.default = CheckboxEditor;
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
require("./index.css");
|
|
11
|
-
const
|
|
11
|
+
const DAFAULT_CHECKBOX_MARK_STYLE = {
|
|
12
12
|
type: 'check',
|
|
13
13
|
color: '#1DDD1D'
|
|
14
14
|
};
|
|
@@ -20,7 +20,7 @@ class CheckboxFormatter extends _react.default.PureComponent {
|
|
|
20
20
|
checkboxStyle
|
|
21
21
|
} = this.props;
|
|
22
22
|
if (!checkboxStyle || !('type' in checkboxStyle && 'color' in checkboxStyle)) {
|
|
23
|
-
checkboxStyle =
|
|
23
|
+
checkboxStyle = DAFAULT_CHECKBOX_MARK_STYLE;
|
|
24
24
|
}
|
|
25
25
|
const currentValue = !!value;
|
|
26
26
|
let classname = (0, _classnames.default)('dtable-ui cell-formatter-container checkbox-formatter d-flex align-items-center justify-content-center', containerClassName);
|
|
@@ -32,12 +32,15 @@ class CheckboxFormatter extends _react.default.PureComponent {
|
|
|
32
32
|
style: {
|
|
33
33
|
color: checkboxStyle.color
|
|
34
34
|
}
|
|
35
|
-
}) : /*#__PURE__*/_react.default.createElement("
|
|
36
|
-
className: "dtable-font dtable--icon-".concat(checkboxStyle.type, " checkbox-checked-mark"),
|
|
35
|
+
}) : /*#__PURE__*/_react.default.createElement("svg", {
|
|
37
36
|
style: {
|
|
38
|
-
|
|
37
|
+
width: '16px',
|
|
38
|
+
height: '16px',
|
|
39
|
+
fill: checkboxStyle.color
|
|
39
40
|
}
|
|
40
|
-
}
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("use", {
|
|
42
|
+
xlinkHref: "#".concat(checkboxStyle.type)
|
|
43
|
+
})));
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
CheckboxFormatter.defaultProps = {
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
.dtable-ui-collaborator-editor
|
|
1
|
+
.dtable-ui-collaborator-editor {
|
|
2
2
|
position: relative;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.dtable-ui-collaborator-editor-
|
|
5
|
+
.dtable-ui-collaborator-editor-popover .collaborator-search-container {
|
|
6
6
|
padding: 10px 10px 0 10px;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.dtable-ui-collaborator-editor-
|
|
9
|
+
.dtable-ui-collaborator-editor-popover .collaborator-search-container input {
|
|
10
10
|
height: 28px;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.dtable-ui-collaborator-editor-
|
|
13
|
+
.dtable-ui-collaborator-editor-popover .collaborator-list-container {
|
|
14
14
|
min-height: 160px;
|
|
15
15
|
max-height: 200px;
|
|
16
16
|
margin: 10px 0;
|
|
17
17
|
overflow: auto;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
.dtable-ui-collaborator-editor-popover .collaborator-list-container .no-search-result {
|
|
21
|
+
color: #666666;
|
|
22
|
+
padding-left: 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dtable-ui-collaborator-editor-popover .collaborator-list-container .collaborator-item-container {
|
|
20
26
|
display: flex;
|
|
21
27
|
align-items: center;
|
|
22
28
|
justify-content: space-between;
|
|
@@ -26,22 +32,39 @@
|
|
|
26
32
|
cursor: pointer;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
.dtable-ui-collaborator-editor-
|
|
30
|
-
|
|
31
|
-
background: #f5f5f5;
|
|
32
|
-
cursor: pointer;
|
|
35
|
+
.dtable-ui-collaborator-editor-popover .collaborator-list-container .collaborator-item-container:hover {
|
|
36
|
+
background-color: #f5f5f5;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
.dtable-ui-collaborator-editor-
|
|
39
|
+
.dtable-ui-collaborator-editor-popover .dtable-ui.collaborator-item {
|
|
36
40
|
background: none;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
.dtable-ui-collaborator-editor-
|
|
43
|
+
.dtable-ui-collaborator-editor-popover .collaborator-checked {
|
|
40
44
|
width: 20px;
|
|
41
45
|
text-align: center;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
.dtable-ui-collaborator-editor-
|
|
48
|
+
.dtable-ui-collaborator-editor-popover .collaborator-checked .dtable-font {
|
|
45
49
|
font-size: 12px;
|
|
46
50
|
color: #798d99;
|
|
47
51
|
}
|
|
52
|
+
|
|
53
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn {
|
|
54
|
+
min-height: 40px;
|
|
55
|
+
padding: 0.375rem 0.75rem;
|
|
56
|
+
border: 1px solid rgba(0, 40, 100, 0.12);
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
transition: border-color .15s ease-in-out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container {
|
|
62
|
+
min-height: 26px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container .collaborator-item {
|
|
69
|
+
margin: 2px 10px 2px 0;
|
|
70
|
+
}
|
|
@@ -1,29 +1,223 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _reactResponsive = _interopRequireDefault(require("react-responsive"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
11
|
+
var _lang = require("../lang");
|
|
12
|
+
var _modalPortal = _interopRequireDefault(require("../common/modal-portal"));
|
|
13
|
+
var _CollaboratorItem = _interopRequireDefault(require("../CollaboratorItem"));
|
|
14
|
+
var _EditEditorButton = _interopRequireDefault(require("../EditEditorButton"));
|
|
15
|
+
var _pcCollaboratorEditorPopover = _interopRequireDefault(require("./pc-collaborator-editor-popover"));
|
|
16
|
+
var _mbCollaboratorEditorPopover = _interopRequireDefault(require("./mb-collaborator-editor-popover"));
|
|
12
17
|
require("./index.css");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
class CollaboratorEditor extends _react.default.Component {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props);
|
|
21
|
+
this.onMouseDown = e => {
|
|
22
|
+
if (this.state.isPopoverShow && this.editorPopoverRef) {
|
|
23
|
+
if (this.editorPopoverRef === e.target || this.editorPopoverRef.contains(e.target)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
28
|
+
this.onClosePopover();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.getFormattedCollaborators = () => {
|
|
32
|
+
let {
|
|
33
|
+
newValue
|
|
34
|
+
} = this.state;
|
|
35
|
+
if (Array.isArray(newValue) && newValue.length > 0) {
|
|
36
|
+
const {
|
|
37
|
+
collaborators
|
|
38
|
+
} = this.props;
|
|
39
|
+
return newValue.map(collaboratorEmail => {
|
|
40
|
+
return collaborators.find(collaborator => collaborator.email === collaboratorEmail);
|
|
41
|
+
}).filter(collaborator => !!collaborator);
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
};
|
|
45
|
+
this.togglePopover = event => {
|
|
46
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
if (this.props.isReadOnly) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let isPopoverShow = !this.state.isPopoverShow;
|
|
52
|
+
if (isPopoverShow) {
|
|
53
|
+
let popoverPosition = this.caculatePopoverPosition();
|
|
54
|
+
this.setState({
|
|
55
|
+
isPopoverShow,
|
|
56
|
+
popoverPosition
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
this.setState({
|
|
60
|
+
isPopoverShow
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.onCommit = newValue => {
|
|
65
|
+
let updated = {};
|
|
66
|
+
let {
|
|
67
|
+
column
|
|
68
|
+
} = this.props;
|
|
69
|
+
updated[column.name] = newValue;
|
|
70
|
+
this.props.onCommit(updated);
|
|
71
|
+
};
|
|
72
|
+
this.onCollaboratorItemToggle = collaborator => {
|
|
73
|
+
let newValue = this.state.newValue.slice();
|
|
74
|
+
let collaboratorIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
|
|
75
|
+
if (collaboratorIndex !== -1) {
|
|
76
|
+
newValue.splice(collaboratorIndex, 1);
|
|
77
|
+
} else {
|
|
78
|
+
newValue.push(collaborator.email);
|
|
79
|
+
}
|
|
80
|
+
this.setState({
|
|
81
|
+
newValue
|
|
82
|
+
}, () => {
|
|
83
|
+
this.onCommit(newValue);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
this.onDeleteCollaborator = collaborator => {
|
|
87
|
+
let newValue = this.state.newValue.slice();
|
|
88
|
+
let optionIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
|
|
89
|
+
if (optionIndex > -1) {
|
|
90
|
+
newValue.splice(optionIndex, 1);
|
|
91
|
+
this.setState({
|
|
92
|
+
newValue
|
|
93
|
+
}, () => {
|
|
94
|
+
this.onCommit(newValue);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
this.caculatePopoverPosition = () => {
|
|
99
|
+
if (this.props.isInModel) {
|
|
100
|
+
const {
|
|
101
|
+
top,
|
|
102
|
+
left
|
|
103
|
+
} = this.editor.getBoundingClientRect();
|
|
104
|
+
return {
|
|
105
|
+
top: top + 40,
|
|
106
|
+
left,
|
|
107
|
+
zIndex: 1051
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const POPOVER_MAX_HEIGHT = 200;
|
|
111
|
+
let innerHeight = window.innerHeight;
|
|
112
|
+
let {
|
|
113
|
+
top,
|
|
114
|
+
height
|
|
115
|
+
} = this.editor.getClientRects()[0];
|
|
116
|
+
let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
|
|
117
|
+
let position = {
|
|
118
|
+
top: height + 1,
|
|
119
|
+
left: 0
|
|
120
|
+
};
|
|
121
|
+
if (!isBelow) {
|
|
122
|
+
let bottom = height + 1;
|
|
123
|
+
position = {
|
|
124
|
+
bottom: bottom,
|
|
125
|
+
left: 0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return position;
|
|
129
|
+
};
|
|
130
|
+
this.onClosePopover = () => {
|
|
131
|
+
this.setState({
|
|
132
|
+
isPopoverShow: false
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
this.onClickContainer = e => {
|
|
136
|
+
e.stopPropagation();
|
|
137
|
+
if (!this.props.isShowEditButton && !this.state.isPopoverShow) {
|
|
138
|
+
this.setState({
|
|
139
|
+
isPopoverShow: true,
|
|
140
|
+
popoverPosition: this.caculatePopoverPosition()
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
this.setEditorContainerRef = editorContainer => {
|
|
145
|
+
this.editorContainer = editorContainer;
|
|
146
|
+
};
|
|
147
|
+
this.setEditorRef = editor => {
|
|
148
|
+
this.editor = editor;
|
|
149
|
+
};
|
|
150
|
+
this.setPopoverRef = ref => {
|
|
151
|
+
this.editorPopoverRef = ref;
|
|
152
|
+
};
|
|
153
|
+
this.state = {
|
|
154
|
+
newValue: Array.isArray(props.value) ? props.value : [],
|
|
155
|
+
isPopoverShow: false,
|
|
156
|
+
popoverPosition: {}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
componentDidMount() {
|
|
160
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
161
|
+
}
|
|
162
|
+
componentWillUnmount() {
|
|
163
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
let {
|
|
167
|
+
collaborators,
|
|
168
|
+
isReadOnly,
|
|
169
|
+
isShowEditButton
|
|
170
|
+
} = this.props;
|
|
171
|
+
let {
|
|
172
|
+
isPopoverShow,
|
|
173
|
+
popoverPosition
|
|
174
|
+
} = this.state;
|
|
175
|
+
let selectedCollaborators = this.getFormattedCollaborators();
|
|
176
|
+
let enableDeleteCollaborator = !isReadOnly;
|
|
177
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
178
|
+
ref: this.setEditorContainerRef,
|
|
179
|
+
className: "dtable-ui-collaborator-editor"
|
|
180
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
181
|
+
ref: this.setEditorRef,
|
|
182
|
+
className: "dtable-ui-collaborator-editor-container ".concat(isShowEditButton ? '' : 'dtable-ui-collaborator-editor-container-no-btn'),
|
|
183
|
+
onClick: this.onClickContainer
|
|
184
|
+
}, isShowEditButton && /*#__PURE__*/_react.default.createElement(_EditEditorButton.default, {
|
|
185
|
+
text: (0, _lang.getLocale)('Add_a_collaborator'),
|
|
186
|
+
onClick: this.togglePopover
|
|
187
|
+
}), selectedCollaborators.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
188
|
+
className: "collaborators-container ".concat(isShowEditButton ? 'mt-2' : '')
|
|
189
|
+
}, selectedCollaborators.map(collaborator => {
|
|
190
|
+
return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
|
|
191
|
+
key: collaborator.email,
|
|
192
|
+
collaborator: collaborator,
|
|
193
|
+
enableDeleteCollaborator: enableDeleteCollaborator,
|
|
194
|
+
onDeleteCollaborator: this.onDeleteCollaborator
|
|
195
|
+
});
|
|
196
|
+
}))), isPopoverShow && /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
197
|
+
query: '(min-width: 768px)'
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement(_modalPortal.default, null, /*#__PURE__*/_react.default.createElement(_pcCollaboratorEditorPopover.default, {
|
|
199
|
+
popoverPosition: popoverPosition,
|
|
200
|
+
isReadOnly: this.props.isReadOnly,
|
|
201
|
+
selectedCollaborators: selectedCollaborators,
|
|
202
|
+
collaborators: collaborators,
|
|
203
|
+
onCollaboratorItemToggle: this.onCollaboratorItemToggle,
|
|
204
|
+
setPopoverRef: this.setPopoverRef
|
|
205
|
+
}))), /*#__PURE__*/_react.default.createElement(_reactResponsive.default, {
|
|
206
|
+
query: '(max-width: 767.8px)'
|
|
207
|
+
}, /*#__PURE__*/_react.default.createElement(_mbCollaboratorEditorPopover.default, {
|
|
208
|
+
isReadOnly: this.props.isReadOnly,
|
|
209
|
+
value: this.state.newValue,
|
|
210
|
+
column: this.props.column,
|
|
211
|
+
collaborators: this.props.collaborators,
|
|
212
|
+
onCollaboratorItemToggle: this.onCollaboratorItemToggle,
|
|
213
|
+
onClosePopover: this.onClosePopover
|
|
214
|
+
}))));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
CollaboratorEditor.defaultProps = {
|
|
218
|
+
isShowEditButton: true,
|
|
219
|
+
isReadOnly: false,
|
|
220
|
+
value: [],
|
|
221
|
+
isInModel: false
|
|
28
222
|
};
|
|
29
223
|
var _default = exports.default = CollaboratorEditor;
|