dtable-ui-component 0.1.75 → 0.1.79
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/README.md +20 -2
- package/lib/AutoNumberFormatter/index.css +1 -0
- package/{es/components/cell-formatter/auto-number-formatter.js → lib/AutoNumberFormatter/index.js} +1 -0
- package/lib/ButtonFormatter/index.css +13 -0
- package/{es/components/cell-formatter/button-formatter.js → lib/ButtonFormatter/index.js} +1 -0
- package/lib/CTimeFormatter/index.css +1 -0
- package/{es/components/cell-formatter/ctime-formatter.js → lib/CTimeFormatter/index.js} +1 -0
- package/lib/CheckboxEditor/index.js +104 -0
- package/lib/CheckboxFormatter/index.css +1 -0
- package/{es/components/cell-formatter/checkbox-formatter.js → lib/CheckboxFormatter/index.js} +1 -0
- package/lib/CollaboratorEditor/index.css +48 -0
- package/lib/CollaboratorEditor/index.js +237 -0
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.css +86 -0
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +178 -0
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.css +1 -0
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +110 -0
- package/lib/CollaboratorFormatter/index.css +1 -0
- package/{es/components/cell-formatter/collaborator-formatter.js → lib/CollaboratorFormatter/index.js} +3 -2
- package/lib/CollaboratorItem/index.css +49 -0
- package/{es/components/common/collaborator-item.js → lib/CollaboratorItem/index.js} +1 -0
- package/lib/CreatorFormatter/index.css +1 -0
- package/{es/components/cell-formatter/creator-formatter.js → lib/CreatorFormatter/index.js} +3 -2
- package/lib/DateEditor/index.css +4 -0
- package/lib/DateEditor/index.js +152 -0
- package/{es/css → lib/DateEditor/mb-date-editor-popover}/custom-rc-calendar.css +0 -0
- package/lib/DateEditor/mb-date-editor-popover/index.css +45 -0
- package/lib/DateEditor/mb-date-editor-popover/index.js +245 -0
- package/lib/DateEditor/pc-date-editor-popover.js +142 -0
- package/lib/DateFormatter/index.css +1 -0
- package/{es/components/cell-formatter/date-formatter.js → lib/DateFormatter/index.js} +2 -1
- package/lib/DtableSelect/index.js +140 -0
- package/lib/DurationFormatter/index.css +1 -0
- package/{es/components/cell-formatter/duration-formatter.js → lib/DurationFormatter/index.js} +2 -1
- package/{es/components/common/edit-editor-button.js → lib/EditEditorButton/index.js} +0 -0
- package/lib/EmailFormatter/index.css +5 -0
- package/{es/components/cell-formatter/email-formatter.js → lib/EmailFormatter/index.js} +1 -0
- package/lib/FileEditor/index.js +46 -0
- package/lib/FileEditor/pc-files-addition/index.js +0 -0
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -0
- package/lib/FileEditor/pc-files-preview/index.js +0 -0
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -0
- package/lib/FileFormatter/index.css +29 -0
- package/{es/components/cell-formatter/file-formatter.js → lib/FileFormatter/index.js} +2 -1
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/excel.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/file.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/music.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pdf.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/pic.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/ppt.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/txt.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/video.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/192/word.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/excel.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/file.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/music.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pdf.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/pic.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/ppt.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/txt.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/video.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/file/24/word.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-192.png +0 -0
- package/{es/assets/images → lib/FileItemFormatter/assets}/folder/folder-24.png +0 -0
- package/{es/components/cell-formatter/widgets/file-item-formatter.js → lib/FileItemFormatter/index.js} +2 -2
- package/lib/FileItemFormatter/utils.js +72 -0
- package/{es/components/file-uploader → lib/FileUploader}/index.js +0 -0
- package/{es/utils → lib/FormulaFormatter}/cell-value-validator.js +1 -2
- package/lib/FormulaFormatter/index.css +19 -0
- package/{es/components/cell-formatter/formula-formatter.js → lib/FormulaFormatter/index.js} +7 -8
- package/{es/utils/column-utils.js → lib/FormulaFormatter/utils.js} +5 -1
- package/lib/GeolocationFormatter/index.css +1 -0
- package/{es/components/cell-formatter/geolocation-formatter.js → lib/GeolocationFormatter/index.js} +2 -1
- package/lib/HtmlLongTextFormatter/index.css +63 -0
- package/{es/components/cell-formatter/widgets/long-text-formatter/html-long-text-formatter.js → lib/HtmlLongTextFormatter/index.js} +5 -2
- package/{es/utils → lib/HtmlLongTextFormatter}/markdown2html.js +2 -2
- package/{es/utils → lib/HtmlLongTextFormatter}/unified/index.js +8 -5
- package/{es/utils → lib/HtmlLongTextFormatter}/vfile/core.js +4 -2
- package/{es/utils → lib/HtmlLongTextFormatter}/vfile/index.js +4 -3
- package/{es/components/common → lib/ImageFormatter}/images-lazy-load.js +2 -2
- package/lib/ImageFormatter/index.css +34 -0
- package/{es/components/cell-formatter/image-formatter.js → lib/ImageFormatter/index.js} +4 -3
- package/lib/ImageFormatter/utils.js +7 -0
- package/{es/css/image-previewer-ligntbox.css → lib/ImagePreviewerLightbox/index.css} +0 -0
- package/{es/components/cell-formatter/widgets/image-previewer-lightbox.js → lib/ImagePreviewerLightbox/index.js} +3 -3
- package/lib/ImagePreviewerLightbox/utils.js +8 -0
- package/lib/LastModifierFormatter/index.css +1 -0
- package/{es/components/cell-formatter/last-modifier-formatter.js → lib/LastModifierFormatter/index.js} +5 -4
- package/lib/LinkEditor/index.css +9 -0
- package/lib/LinkEditor/index.js +304 -0
- package/{es/components/common → lib/LinkEditor}/link-editor-option.js +0 -0
- package/lib/LinkEditor/mb-link-editor-popover/index.css +85 -0
- package/lib/LinkEditor/mb-link-editor-popover/index.js +171 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.css +63 -0
- package/lib/LinkEditor/pc-link-editor-popover/index.js +115 -0
- package/lib/LinkFormatter/index.css +27 -0
- package/{es/components/cell-formatter/link-formatter.js → lib/LinkFormatter/index.js} +2 -2
- package/{es/css/loading.css → lib/Loading/index.css} +0 -0
- package/{es/components/loading.js → lib/Loading/index.js} +1 -1
- package/{es/components/cell-formatter/long-text-formatter.js → lib/LongTextFormatter/index.js} +4 -6
- package/{es/components/common/mobile/mb-editor-header.js → lib/MBEditorHeader/index.js} +0 -0
- package/lib/MTimeFormatter/index.css +1 -0
- package/{es/components/cell-formatter/mtime-formatter.js → lib/MTimeFormatter/index.js} +1 -0
- package/{es/components/common/modal-portal.js → lib/ModalPortal/index.js} +0 -0
- package/lib/MultipleSelectEditor/index.css +9 -0
- package/lib/MultipleSelectEditor/index.js +236 -0
- package/lib/MultipleSelectFormatter/index.css +1 -0
- package/{es/components/cell-formatter/multiple-select-formatter.js → lib/MultipleSelectFormatter/index.js} +2 -1
- package/lib/NumberEditor/index.js +154 -0
- package/lib/NumberFormatter/index.css +1 -0
- package/{es/components/cell-formatter/number-formatter.js → lib/NumberFormatter/index.js} +2 -1
- package/lib/RateFormatter/index.css +1 -0
- package/{es/components/cell-formatter/rate-formatter.js → lib/RateFormatter/index.js} +1 -0
- package/{es/components/common/select-item.js → lib/SelectItem/index.js} +0 -0
- package/lib/SimpleLongTextFormatter/index.css +63 -0
- package/{es/components/cell-formatter/widgets/long-text-formatter/simple-long-text-formatter.js → lib/SimpleLongTextFormatter/index.js} +5 -2
- package/{es/utils → lib/SimpleLongTextFormatter}/normalize-long-text-value.js +3 -3
- package/lib/SingleSelectEditor/index.css +9 -0
- package/lib/SingleSelectEditor/index.js +201 -0
- package/lib/SingleSelectFormatter/index.css +1 -0
- package/{es/components/cell-formatter/single-select-formatter.js → lib/SingleSelectFormatter/index.js} +2 -1
- package/lib/TextEditor/index.js +122 -0
- package/lib/TextFormatter/index.css +1 -0
- package/{es/components/cell-formatter/text-formatter.js → lib/TextFormatter/index.js} +1 -0
- package/lib/UrlFormatter/index.css +5 -0
- package/{es/components/cell-formatter/url-formatter.js → lib/UrlFormatter/index.js} +1 -0
- package/{es → lib}/assets/images/avatar/default_avatar.png +0 -0
- package/{es/components/cell-factory/cell-formatter-factory.js → lib/cellFormatterFactory/index.js} +3 -3
- package/{es → lib}/constants/cell-types.js +0 -0
- package/lib/constants/index.js +49 -0
- package/lib/css/cell-editor.css +6 -0
- package/lib/css/cell-formatter.css +4 -0
- package/lib/css/mb-cell-editor.css +55 -0
- package/lib/formatterConfig/index.js +31 -0
- package/lib/index.js +45 -0
- package/{es → lib}/lang/index.js +0 -0
- package/{es → lib}/locals/de.js +0 -0
- package/{es → lib}/locals/en.js +0 -0
- package/{es → lib}/locals/fr.js +0 -0
- package/{es → lib}/locals/zh-CN.js +0 -0
- package/lib/select-editor/index.js +4 -0
- package/lib/select-editor/mb-select-editor-popover/index.css +127 -0
- package/lib/select-editor/mb-select-editor-popover/index.js +231 -0
- package/lib/select-editor/pc-select-editor-popover/index.css +72 -0
- package/lib/select-editor/pc-select-editor-popover/index.js +144 -0
- package/{es/components/common → lib/select-editor}/select-editor-option.js +0 -0
- package/{es/components/toast → lib/toaster}/alert.js +0 -0
- package/{es/components/toast → lib/toaster}/index.js +0 -0
- package/{es/components/toast → lib/toaster}/toast.js +0 -0
- package/{es/components/toast → lib/toaster}/toastManager.js +0 -0
- package/{es/components/toast → lib/toaster}/toaster.js +0 -0
- package/lib/utils/editor-utils.js +71 -0
- package/{es → lib}/utils/number-precision.js +1 -0
- package/lib/utils/utils.js +25 -0
- package/{es → lib}/utils/value-format-utils.js +7 -10
- package/package.json +9 -8
- package/es/app.css +0 -20
- package/es/app.js +0 -91
- package/es/components/cell-formatter/formatter-config.js +0 -31
- package/es/components/cell-formatter/index.js +0 -27
- package/es/constants/index.js +0 -48
- package/es/css/cell-editor.css +0 -614
- package/es/css/cell-formatter.css +0 -247
- package/es/index.js +0 -6
- package/es/utils/utils.js +0 -116
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { getLocale } from '../../lang';
|
|
8
|
+
import MBEditorHeader from '../../MBEditorHeader';
|
|
9
|
+
import './index.css';
|
|
10
|
+
|
|
11
|
+
var MBCollaboratorEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(MBCollaboratorEditorPopover, _React$Component);
|
|
13
|
+
|
|
14
|
+
var _super = _createSuper(MBCollaboratorEditorPopover);
|
|
15
|
+
|
|
16
|
+
function MBCollaboratorEditorPopover(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, MBCollaboratorEditorPopover);
|
|
20
|
+
|
|
21
|
+
_this = _super.call(this, props);
|
|
22
|
+
|
|
23
|
+
_this.handleHistaryBack = function (e) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
|
|
26
|
+
_this.props.onClosePopover();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
_this.onContainerClick = function (event) {
|
|
30
|
+
if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
_this.onChangeSearch = function (event) {
|
|
38
|
+
var searchVal = _this.state.searchVal;
|
|
39
|
+
|
|
40
|
+
if (searchVal === event.target.value) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
searchVal = event.target.value;
|
|
45
|
+
|
|
46
|
+
_this.setState({
|
|
47
|
+
searchVal: searchVal
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
_this.getSelectedCollaborators = function () {
|
|
52
|
+
var _this$props = _this.props,
|
|
53
|
+
value = _this$props.value,
|
|
54
|
+
collaborators = _this$props.collaborators;
|
|
55
|
+
|
|
56
|
+
if (!Array.isArray(value)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return collaborators.filter(function (collaborator) {
|
|
61
|
+
return value.indexOf(collaborator.email) > -1;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
_this.getFilteredCollaborators = function () {
|
|
66
|
+
var collaborators = _this.props.collaborators;
|
|
67
|
+
var searchVal = _this.state.searchVal;
|
|
68
|
+
return searchVal ? collaborators.filter(function (item) {
|
|
69
|
+
return item.name.indexOf(searchVal) > -1;
|
|
70
|
+
}) : collaborators;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
_this.onSelectCollaborator = function (collaborator) {
|
|
74
|
+
_this.props.onCollaboratorItemToggle(collaborator);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
_this.onRemoveCollaborator = function (collaborator) {
|
|
78
|
+
_this.props.onCollaboratorItemToggle(collaborator);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
_this.renderFilteredCollaborators = function (collaborators) {
|
|
82
|
+
var value = _this.props.value;
|
|
83
|
+
return collaborators.map(function (collaborator, index) {
|
|
84
|
+
var isSelect = value.some(function (item) {
|
|
85
|
+
return item === collaborator.email;
|
|
86
|
+
});
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: "mb-collaborator-option-item",
|
|
89
|
+
key: index,
|
|
90
|
+
onMouseDown: _this.onSelectCollaborator.bind(_assertThisInitialized(_this), collaborator)
|
|
91
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
92
|
+
className: "mb-collaborator-info"
|
|
93
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
className: "collaborator-avatar"
|
|
95
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
96
|
+
src: collaborator.avatar_url,
|
|
97
|
+
width: "24",
|
|
98
|
+
height: "24",
|
|
99
|
+
alt: "avatar"
|
|
100
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
className: "collaborator-name"
|
|
102
|
+
}, collaborator.name)), isSelect && /*#__PURE__*/React.createElement("i", {
|
|
103
|
+
className: "mb-collaborator-checked dtable-font dtable-icon-check-mark"
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
_this.setEditorPopover = function (editorPopover) {
|
|
109
|
+
_this.editorPopover = editorPopover;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
_this.state = {
|
|
113
|
+
searchVal: ''
|
|
114
|
+
};
|
|
115
|
+
return _this;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
_createClass(MBCollaboratorEditorPopover, [{
|
|
119
|
+
key: "componentDidMount",
|
|
120
|
+
value: function componentDidMount() {
|
|
121
|
+
history.pushState(null, null, '#'); // eslint-disable-line
|
|
122
|
+
|
|
123
|
+
window.addEventListener('popstate', this.handleHistaryBack, false);
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "componentWillUnmount",
|
|
127
|
+
value: function componentWillUnmount() {
|
|
128
|
+
window.removeEventListener('popstate', this.handleHistaryBack, false);
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "render",
|
|
132
|
+
value: function render() {
|
|
133
|
+
var column = this.props.column;
|
|
134
|
+
var searchVal = this.state.searchVal;
|
|
135
|
+
var filteredCollaborators = this.getFilteredCollaborators();
|
|
136
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
ref: this.setEditorPopover,
|
|
138
|
+
className: "dtable-ui-mb-editor-popover mb-collaborator-editor-popover",
|
|
139
|
+
onClick: this.onContainerClick
|
|
140
|
+
}, /*#__PURE__*/React.createElement(MBEditorHeader, {
|
|
141
|
+
title: column.name,
|
|
142
|
+
leftContent: /*#__PURE__*/React.createElement("i", {
|
|
143
|
+
className: "dtable-font dtable-icon-return"
|
|
144
|
+
}),
|
|
145
|
+
rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
|
|
146
|
+
onLeftClick: this.props.onClosePopover,
|
|
147
|
+
onRightClick: this.props.onClosePopover
|
|
148
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: "dtable-ui-mb-editor-body dtable-ui-mb-collaborator-editor-body"
|
|
150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
151
|
+
className: "mb-search-collaborator-items"
|
|
152
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
153
|
+
className: "form-control",
|
|
154
|
+
type: "text",
|
|
155
|
+
placeholder: getLocale('Find_a_collaborator'),
|
|
156
|
+
value: searchVal,
|
|
157
|
+
onChange: this.onChangeSearch,
|
|
158
|
+
onClick: this.onInputClick
|
|
159
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
className: "mb-collaborators-container"
|
|
161
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
className: "title"
|
|
163
|
+
}, getLocale('Choose_a_collaborator')), /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: "content"
|
|
165
|
+
}, filteredCollaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
166
|
+
className: "search-result-none"
|
|
167
|
+
}, getLocale('No_collaborators_avaliable')), filteredCollaborators.length > 0 && this.renderFilteredCollaborators(filteredCollaborators)))));
|
|
168
|
+
}
|
|
169
|
+
}]);
|
|
170
|
+
|
|
171
|
+
return MBCollaboratorEditorPopover;
|
|
172
|
+
}(React.Component);
|
|
173
|
+
|
|
174
|
+
MBCollaboratorEditorPopover.defaultProps = {
|
|
175
|
+
isReadOnly: false,
|
|
176
|
+
value: []
|
|
177
|
+
};
|
|
178
|
+
export default MBCollaboratorEditorPopover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../../css/cell-editor.css');
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { getLocale } from '../../lang';
|
|
8
|
+
import CollaboratorItem from '../../CollaboratorItem';
|
|
9
|
+
import './index.css';
|
|
10
|
+
|
|
11
|
+
var PCCollaboratorEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(PCCollaboratorEditorPopover, _React$Component);
|
|
13
|
+
|
|
14
|
+
var _super = _createSuper(PCCollaboratorEditorPopover);
|
|
15
|
+
|
|
16
|
+
function PCCollaboratorEditorPopover(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, PCCollaboratorEditorPopover);
|
|
20
|
+
|
|
21
|
+
_this = _super.call(this, props);
|
|
22
|
+
|
|
23
|
+
_this.onValueChanged = function (event) {
|
|
24
|
+
var value = event.target.value;
|
|
25
|
+
|
|
26
|
+
_this.setState({
|
|
27
|
+
searchValue: value
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
_this.onInputClick = function (event) {
|
|
32
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
_this.onCollaboratorItemToggle = function (item) {
|
|
37
|
+
_this.props.onCollaboratorItemToggle(item);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
_this.getFilterCollaborator = function () {
|
|
41
|
+
var collaborators = _this.props.collaborators;
|
|
42
|
+
|
|
43
|
+
var filter = _this.state.searchValue.toLowerCase();
|
|
44
|
+
|
|
45
|
+
if (!filter) {
|
|
46
|
+
return collaborators;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return collaborators.filter(function (collaborator) {
|
|
50
|
+
return collaborator.name.toString().toLowerCase().indexOf(filter) > -1;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
_this.state = {
|
|
55
|
+
searchValue: ''
|
|
56
|
+
};
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
_createClass(PCCollaboratorEditorPopover, [{
|
|
61
|
+
key: "render",
|
|
62
|
+
value: function render() {
|
|
63
|
+
var _this2 = this;
|
|
64
|
+
|
|
65
|
+
var searchValue = this.state.searchValue;
|
|
66
|
+
var _this$props = this.props,
|
|
67
|
+
selectedCollaborators = _this$props.selectedCollaborators,
|
|
68
|
+
popoverPosition = _this$props.popoverPosition;
|
|
69
|
+
var collaborators = this.getFilterCollaborator();
|
|
70
|
+
var popoverStyle = Object.assign({}, _objectSpread({}, popoverPosition), {
|
|
71
|
+
position: 'absolute'
|
|
72
|
+
});
|
|
73
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "dtable-ui-editor-popover dtable-ui-collaborator-editor-popover",
|
|
75
|
+
style: popoverStyle
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "collaborator-search-container"
|
|
78
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
79
|
+
className: "form-control",
|
|
80
|
+
value: searchValue,
|
|
81
|
+
onChange: this.onValueChanged,
|
|
82
|
+
onClick: this.onInputClick,
|
|
83
|
+
placeholder: getLocale('Find_a_collaborator')
|
|
84
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
85
|
+
className: "collaborator-list-container"
|
|
86
|
+
}, collaborators.length > 0 && collaborators.map(function (collaborator, index) {
|
|
87
|
+
var isSelect = selectedCollaborators.some(function (selectedCollaborator) {
|
|
88
|
+
return selectedCollaborator.email === collaborator.email;
|
|
89
|
+
});
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
key: index,
|
|
92
|
+
className: "collaborator-item-container",
|
|
93
|
+
onClick: _this2.onCollaboratorItemToggle.bind(_this2, collaborator)
|
|
94
|
+
}, /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
95
|
+
collaborator: collaborator
|
|
96
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "collaborator-checked"
|
|
98
|
+
}, isSelect && /*#__PURE__*/React.createElement("i", {
|
|
99
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
100
|
+
})));
|
|
101
|
+
}), collaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "search-option-null"
|
|
103
|
+
}, getLocale('No_collaborators_available'))));
|
|
104
|
+
}
|
|
105
|
+
}]);
|
|
106
|
+
|
|
107
|
+
return PCCollaboratorEditorPopover;
|
|
108
|
+
}(React.Component);
|
|
109
|
+
|
|
110
|
+
export default PCCollaboratorEditorPopover;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -4,8 +4,9 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import cn from 'astro-classname';
|
|
7
|
-
import CollaboratorItem from '../
|
|
8
|
-
import DefaultAvatar from '
|
|
7
|
+
import CollaboratorItem from '../CollaboratorItem';
|
|
8
|
+
import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
|
|
9
|
+
import './index.css';
|
|
9
10
|
|
|
10
11
|
// there will be there conditions
|
|
11
12
|
// 1 value is not exist, typeof value is array, but it's length is 0
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.dtable-ui.collaborator-item {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
margin-right: 10px;
|
|
5
|
+
padding: 0 8px 0 2px;
|
|
6
|
+
height: 20px;
|
|
7
|
+
font-size: 13px;
|
|
8
|
+
border-radius: 10px;
|
|
9
|
+
background: #eaeaea;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dtable-ui.collaborator-item .collaborator-avatar,
|
|
13
|
+
.dtable-ui.collaborator-item .collaborator-name,
|
|
14
|
+
.dtable-ui.collaborator-item .collaborator-remove {
|
|
15
|
+
height: 20px;
|
|
16
|
+
line-height: 20px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui.collaborator-item .collaborator-avatar {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
margin: 0 4px 0 2px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dtable-ui.collaborator-item .collaborator-avatar img {
|
|
27
|
+
width: 16px;
|
|
28
|
+
height: 16px;
|
|
29
|
+
border-radius: 50%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dtable-ui.collaborator-item .collaborator-remove {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
width: 14px;
|
|
35
|
+
margin: 0 -2px 0 2px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dtable-ui.collaborator-item .collaborator-remove .dtable-font {
|
|
39
|
+
display: inline-block;
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
color: #909090;
|
|
42
|
+
transform: scale(.8);
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dtable-ui.collaborator-item .collaborator-remove .dtable-font:hover {
|
|
47
|
+
color: #666666;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import './index.css';
|
|
6
7
|
|
|
7
8
|
var CollaboratorItem = /*#__PURE__*/function (_React$Component) {
|
|
8
9
|
_inherits(CollaboratorItem, _React$Component);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
@@ -4,8 +4,9 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import cn from 'astro-classname';
|
|
7
|
-
import CollaboratorItem from '../
|
|
8
|
-
import DefaultAvatar from '
|
|
7
|
+
import CollaboratorItem from '../CollaboratorItem';
|
|
8
|
+
import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
|
|
9
|
+
import './index.css';
|
|
9
10
|
|
|
10
11
|
// there will be there conditions
|
|
11
12
|
// 1 value is not exist, typeof value is array, but it's length is 0
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React, { Fragment } from 'react';
|
|
6
|
+
import MediaQuery from 'react-responsive';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import { getDateDisplayString } from '../utils/value-format-utils';
|
|
9
|
+
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
10
|
+
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
11
|
+
import './index.css';
|
|
12
|
+
|
|
13
|
+
var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
14
|
+
_inherits(DateEditor, _React$Component);
|
|
15
|
+
|
|
16
|
+
var _super = _createSuper(DateEditor);
|
|
17
|
+
|
|
18
|
+
function DateEditor(props) {
|
|
19
|
+
var _this;
|
|
20
|
+
|
|
21
|
+
_classCallCheck(this, DateEditor);
|
|
22
|
+
|
|
23
|
+
_this = _super.call(this, props);
|
|
24
|
+
|
|
25
|
+
_this.getDateFormat = function () {
|
|
26
|
+
var column = _this.props.column;
|
|
27
|
+
var defaultDateFormat = 'YYYY-MM-DD';
|
|
28
|
+
var dateFormat = column.data && column.data.format;
|
|
29
|
+
return dateFormat || defaultDateFormat;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
_this.onDateEditorToggle = function () {
|
|
33
|
+
var isReadOnly = _this.props.isReadOnly;
|
|
34
|
+
|
|
35
|
+
if (isReadOnly) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_this.setState({
|
|
40
|
+
isPopoverShow: !_this.state.isPopoverShow
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
_this.onValueChanged = function (value) {
|
|
45
|
+
if (value !== _this.state.newValue) {
|
|
46
|
+
_this.setState({
|
|
47
|
+
newValue: value
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
_this.onCommit(value);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
_this.onCommit = function (newValue) {
|
|
55
|
+
var updated = {};
|
|
56
|
+
var column = _this.props.column;
|
|
57
|
+
updated[column.key] = newValue;
|
|
58
|
+
|
|
59
|
+
_this.props.onCommit(updated);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
_this.onClosePopover = function () {
|
|
63
|
+
_this.setState({
|
|
64
|
+
isPopoverShow: false
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
_this.state = {
|
|
69
|
+
isDateInit: false,
|
|
70
|
+
newValue: '',
|
|
71
|
+
isPopoverShow: false,
|
|
72
|
+
showHourAndMinute: false,
|
|
73
|
+
defaultCalendarValue: null
|
|
74
|
+
};
|
|
75
|
+
return _this;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_createClass(DateEditor, [{
|
|
79
|
+
key: "componentDidMount",
|
|
80
|
+
value: function componentDidMount() {
|
|
81
|
+
var _this$props = this.props,
|
|
82
|
+
value = _this$props.value,
|
|
83
|
+
lang = _this$props.lang;
|
|
84
|
+
moment.locale(lang);
|
|
85
|
+
var dateFormat = this.getDateFormat();
|
|
86
|
+
this.setState({
|
|
87
|
+
isDateInit: true,
|
|
88
|
+
newValue: value,
|
|
89
|
+
dateFormat: dateFormat,
|
|
90
|
+
showHourAndMinute: dateFormat.indexOf('HH:mm') > -1
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "render",
|
|
95
|
+
value: function render() {
|
|
96
|
+
if (!this.state.isDateInit) {
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "cell-editor date-editor"
|
|
99
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
100
|
+
className: "date-editor-container"
|
|
101
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "control-form"
|
|
103
|
+
})));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var _this$props2 = this.props,
|
|
107
|
+
lang = _this$props2.lang,
|
|
108
|
+
column = _this$props2.column;
|
|
109
|
+
var _this$state = this.state,
|
|
110
|
+
newValue = _this$state.newValue,
|
|
111
|
+
isPopoverShow = _this$state.isPopoverShow,
|
|
112
|
+
dateFormat = _this$state.dateFormat,
|
|
113
|
+
showHourAndMinute = _this$state.showHourAndMinute;
|
|
114
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: "cell-editor dtable-ui-date-editor"
|
|
116
|
+
}, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
|
|
117
|
+
className: "dtable-ui-date-editor-container"
|
|
118
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: "form-control",
|
|
120
|
+
onClick: this.onDateEditorToggle
|
|
121
|
+
}, getDateDisplayString(newValue, dateFormat))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
|
|
122
|
+
query: '(min-width: 768px)'
|
|
123
|
+
}, /*#__PURE__*/React.createElement(PCDateEditorPopover, {
|
|
124
|
+
lang: lang,
|
|
125
|
+
value: newValue,
|
|
126
|
+
dateFormat: dateFormat,
|
|
127
|
+
showHourAndMinute: showHourAndMinute,
|
|
128
|
+
onValueChanged: this.onValueChanged
|
|
129
|
+
})), /*#__PURE__*/React.createElement(MediaQuery, {
|
|
130
|
+
query: '(max-width: 767.8px)'
|
|
131
|
+
}, /*#__PURE__*/React.createElement(MBDateEditorPopover, {
|
|
132
|
+
isReadOnly: this.props.isReadOnly,
|
|
133
|
+
lang: lang,
|
|
134
|
+
value: newValue,
|
|
135
|
+
dateFormat: dateFormat,
|
|
136
|
+
showHourAndMinute: showHourAndMinute,
|
|
137
|
+
column: column,
|
|
138
|
+
onValueChanged: this.onValueChanged,
|
|
139
|
+
onClosePopover: this.onClosePopover
|
|
140
|
+
}))));
|
|
141
|
+
}
|
|
142
|
+
}]);
|
|
143
|
+
|
|
144
|
+
return DateEditor;
|
|
145
|
+
}(React.Component);
|
|
146
|
+
|
|
147
|
+
DateEditor.defaultProps = {
|
|
148
|
+
isReadOnly: false,
|
|
149
|
+
value: '',
|
|
150
|
+
lang: 'en'
|
|
151
|
+
};
|
|
152
|
+
export default DateEditor;
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@import url('./custom-rc-calendar.css');
|
|
2
|
+
@import url('../../css/mb-cell-editor.css');
|
|
3
|
+
|
|
4
|
+
@media screen and (max-width: 767.8px) {
|
|
5
|
+
.dtable-ui-mb-date-editor-body .mb-date-editor-input {
|
|
6
|
+
display: flex;
|
|
7
|
+
border-top: 1px solid #e9e9e9;
|
|
8
|
+
border-bottom: 1px solid #e9e9e9;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dtable-ui-mb-date-editor-body .mb-date-editor-input .date-input {
|
|
12
|
+
flex: 1;
|
|
13
|
+
background-color: #fff;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.dtable-ui-mb-date-editor-body .mb-date-editor-input .date-input .date-input-day {
|
|
17
|
+
background-color: #f5f5f5;
|
|
18
|
+
border: 1px solid #e9e9e9;
|
|
19
|
+
margin: 10px;
|
|
20
|
+
padding: 3px 5px;
|
|
21
|
+
border-radius: 3px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.dtable-ui-mb-date-editor-body .dtable-ui.mb-date-editor-picker {
|
|
25
|
+
display: block;
|
|
26
|
+
position: relative;
|
|
27
|
+
margin-top: 20px;
|
|
28
|
+
line-height: 1.5;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dtable-ui-mb-date-editor-body .mb-date-editor-clear {
|
|
33
|
+
padding: 10px 0;
|
|
34
|
+
margin-top: 20px;
|
|
35
|
+
border-bottom: 1px solid #e9e9e9;
|
|
36
|
+
border-top: 1px solid #e9e9e9;
|
|
37
|
+
text-align: center;
|
|
38
|
+
color: #d27053;
|
|
39
|
+
background-color: #fff;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dtable-ui .am-picker-popup-header .am-picker-popup-item {
|
|
43
|
+
color: #E5A252;
|
|
44
|
+
}
|
|
45
|
+
}
|