dtable-ui-component 5.3.1-beta1 → 5.3.1-beta2

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.
Files changed (48) hide show
  1. package/lib/Comment/body/comment.js +190 -0
  2. package/lib/Comment/body/index.css +95 -0
  3. package/lib/Comment/body/index.js +32 -0
  4. package/lib/Comment/footer/btns/index.css +40 -0
  5. package/lib/Comment/footer/btns/index.js +113 -0
  6. package/lib/Comment/footer/index.css +157 -0
  7. package/lib/Comment/footer/index.js +170 -0
  8. package/lib/Comment/footer/input/index.css +52 -0
  9. package/lib/Comment/footer/input/index.js +448 -0
  10. package/lib/Comment/footer/input/participant/index.css +0 -0
  11. package/lib/Comment/footer/input/participant/index.js +53 -0
  12. package/lib/Comment/footer/participants/index.css +22 -0
  13. package/lib/Comment/footer/participants/index.js +68 -0
  14. package/lib/Comment/footer/participants/participant/index.css +5 -0
  15. package/lib/Comment/footer/participants/participant/index.js +32 -0
  16. package/lib/Comment/footer/participants/participant-select/index.css +104 -0
  17. package/lib/Comment/footer/participants/participant-select/index.js +182 -0
  18. package/lib/Comment/index.css +19 -0
  19. package/lib/Comment/index.js +305 -0
  20. package/lib/Comment/model.js +25 -0
  21. package/lib/Comment/utils/common.js +62 -0
  22. package/lib/Comment/utils/index.js +27 -0
  23. package/lib/Comment/utils/utilities.js +176 -0
  24. package/lib/DigitalSignEditor/index.js +1 -1
  25. package/lib/FileEditor/index.js +16 -2
  26. package/lib/RowExpandDialog/body/index.js +43 -60
  27. package/lib/RowExpandDialog/column-content/index.css +1 -0
  28. package/lib/RowExpandDialog/header/index.css +3 -3
  29. package/lib/RowExpandDialog/header/index.js +33 -11
  30. package/lib/RowExpandDialog/index.js +35 -55
  31. package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +1 -2
  32. package/lib/RowExpandFormatter/RowExpandLinkFormatter/index.js +1 -1
  33. package/lib/RowExpandFormatter/index.css +1 -1
  34. package/lib/RowExpandFormatter/index.js +3 -4
  35. package/lib/lang/index.js +3 -2
  36. package/lib/locales/de.json +5 -1
  37. package/lib/locales/en.json +5 -1
  38. package/lib/locales/es.json +5 -1
  39. package/lib/locales/fr.json +5 -1
  40. package/lib/locales/pt.json +5 -1
  41. package/lib/locales/ru.json +5 -1
  42. package/lib/locales/zh-CN.json +5 -1
  43. package/lib/utils/hotkey.js +37 -0
  44. package/lib/utils/utils.js +58 -2
  45. package/package.json +1 -1
  46. package/lib/RowExpandDialog/constants.js +0 -114
  47. package/lib/RowExpandDialog/utils.js +0 -83
  48. package/lib/RowExpandFormatter/RowExpandLinkFormatter/utils.js +0 -71
@@ -0,0 +1,53 @@
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
+ class Participant extends _react.default.Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.onSelect = event => {
13
+ event.stopPropagation();
14
+ event.preventDefault();
15
+ this.props.onSelect();
16
+ };
17
+ }
18
+ UNSAFE_componentWillReceiveProps(nextProps) {
19
+ if (nextProps.showParticipantActiveIndex === this.props.participantIndex && nextProps.showParticipantActiveIndex !== this.props.showParticipantActiveIndex) {
20
+ let offsetHeight = this.participantItem.offsetHeight;
21
+ let offsetTop = this.participantItem.offsetTop;
22
+ if (nextProps.showParticipantActiveIndex > this.props.showParticipantActiveIndex) {
23
+ this.props.setScrollTop(offsetTop, offsetHeight, 'down');
24
+ } else {
25
+ this.props.setScrollTop(offsetTop, offsetHeight, 'up');
26
+ }
27
+ }
28
+ }
29
+ render() {
30
+ const {
31
+ participant,
32
+ index,
33
+ activeIndex
34
+ } = this.props;
35
+ const active = index === activeIndex;
36
+ return /*#__PURE__*/_react.default.createElement("div", {
37
+ className: "comment-participant-item ".concat(active ? 'active' : ''),
38
+ ref: ref => this.participantItem = ref,
39
+ onClick: this.onSelect
40
+ }, /*#__PURE__*/_react.default.createElement("div", {
41
+ className: "comment-participant-container"
42
+ }, /*#__PURE__*/_react.default.createElement("div", {
43
+ className: "comment-participant text-truncate"
44
+ }, /*#__PURE__*/_react.default.createElement("img", {
45
+ className: "comment-dtable-ui-participant-avatar ml-2",
46
+ alt: participant.name,
47
+ src: participant.avatar_url
48
+ }), /*#__PURE__*/_react.default.createElement("span", {
49
+ className: "comment-participant-name"
50
+ }, participant.name))));
51
+ }
52
+ }
53
+ var _default = exports.default = Participant;
@@ -0,0 +1,22 @@
1
+ .dtable-ui-comments-participants {
2
+ min-height: 28px;
3
+ }
4
+
5
+ .dtable-ui-comments-participants .dtable-ui-participants-add {
6
+ position: absolute;
7
+ cursor: pointer;
8
+ bottom: -3px;
9
+ }
10
+
11
+ .dtable-ui-comments-participants .dtable-ui-participants-add i {
12
+ background-color: #fff;
13
+ font-size: 16px;
14
+ color: #FF8000;
15
+ border: 2px solid #fff;
16
+ border-radius: 50%;
17
+ }
18
+
19
+ .dtable-ui-comments-participants .dtable-ui-participant-avatar,
20
+ .dtable-ui-comments-participants .dtable-ui-participants-add {
21
+ margin-right: -0.5rem;
22
+ }
@@ -0,0 +1,68 @@
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 _reactstrap = require("reactstrap");
10
+ var _participant = _interopRequireDefault(require("./participant"));
11
+ var _participantSelect = _interopRequireDefault(require("./participant-select"));
12
+ var _lang = require("../../../lang");
13
+ require("./index.css");
14
+ class Participants extends _react.default.Component {
15
+ constructor(props) {
16
+ super(props);
17
+ this.closeParticipantSelect = () => {
18
+ this.setState({
19
+ showParticipantSelect: false
20
+ });
21
+ };
22
+ this.toggleParticipantSelect = () => {
23
+ this.setState({
24
+ showParticipantSelect: !this.state.showParticipantSelect
25
+ });
26
+ };
27
+ this.state = {
28
+ showParticipantSelect: false
29
+ };
30
+ }
31
+ render() {
32
+ const {
33
+ canUpdate,
34
+ participants,
35
+ collaborators
36
+ } = this.props;
37
+ return /*#__PURE__*/_react.default.createElement("div", {
38
+ className: "dtable-ui-comments-participants mb-2 position-relative",
39
+ ref: ref => this.ref = ref
40
+ }, participants.map(participant => {
41
+ return /*#__PURE__*/_react.default.createElement(_participant.default, {
42
+ participant: participant,
43
+ key: participant.email
44
+ });
45
+ }), canUpdate && /*#__PURE__*/_react.default.createElement("span", {
46
+ className: "dtable-ui-participants-add",
47
+ onClick: this.toggleParticipantSelect,
48
+ ref: ref => this.addIcon = ref
49
+ }, /*#__PURE__*/_react.default.createElement("i", {
50
+ "aria-hidden": "true",
51
+ className: "dtable-font dtable-icon-add"
52
+ })), this.addIcon && /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
53
+ delay: {
54
+ show: 0,
55
+ hide: 0
56
+ },
57
+ target: this.addIcon,
58
+ placement: "bottom"
59
+ }, (0, _lang.getLocale)('Add_participants')), this.ref && this.state.showParticipantSelect && /*#__PURE__*/_react.default.createElement(_participantSelect.default, {
60
+ target: this.ref,
61
+ participants: participants,
62
+ collaborators: collaborators,
63
+ onChange: this.props.onChange,
64
+ onClose: this.closeParticipantSelect
65
+ }));
66
+ }
67
+ }
68
+ var _default = exports.default = Participants;
@@ -0,0 +1,5 @@
1
+ .dtable-ui-comments-participants .dtable-ui-participant-avatar .avatar {
2
+ width: 28px;
3
+ height: 28px;
4
+ border: 2px solid #fff;
5
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactstrap = require("reactstrap");
10
+ require("./index.css");
11
+ const Participant = _ref => {
12
+ let {
13
+ participant
14
+ } = _ref;
15
+ const ref = (0, _react.useRef)(null);
16
+ return /*#__PURE__*/_react.default.createElement("span", {
17
+ className: "dtable-ui-participant-avatar"
18
+ }, /*#__PURE__*/_react.default.createElement("img", {
19
+ src: participant.avatar_url,
20
+ className: "avatar",
21
+ ref: ref,
22
+ alt: "avatar"
23
+ }), ref.current && /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
24
+ delay: {
25
+ show: 0,
26
+ hide: 0
27
+ },
28
+ target: ref,
29
+ placement: "bottom"
30
+ }, participant.name));
31
+ };
32
+ var _default = exports.default = Participant;
@@ -0,0 +1,104 @@
1
+ .dtable-ui-participants-editor {
2
+ min-height: 160px;
3
+ width: 280px;
4
+ left: -140px;
5
+ }
6
+
7
+ /* header */
8
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-header {
9
+ background-color: #f6f6f6;
10
+ padding: 5px 10px 3px;
11
+ border-bottom: 1px solid #dde2ea;
12
+ border-radius: 3px 3px 0 0;
13
+ min-height: 34px;
14
+ }
15
+
16
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-header .dtable-ui-participant {
17
+ display: inline-flex;
18
+ height: 20px;
19
+ margin-right: 10px;
20
+ padding: 0 8px 0 2px;
21
+ font-size: 13px;
22
+ border-radius: 10px;
23
+ background: #eaeaea;
24
+ }
25
+
26
+ /* search */
27
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-search {
28
+ padding: 10px;
29
+ }
30
+
31
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-search input {
32
+ height: 28px;
33
+ }
34
+
35
+
36
+ /* container */
37
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container {
38
+ max-height: 200px;
39
+ padding: 0 0 10px;
40
+ overflow: auto;
41
+ }
42
+
43
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-item {
44
+ display: flex;
45
+ align-items: center;
46
+ padding: 0 8px 0 0;
47
+ }
48
+
49
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-item:hover {
50
+ background: none;
51
+ }
52
+
53
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-container {
54
+ display: flex;
55
+ align-items: center;
56
+ width: 100%;
57
+ height: 30px;
58
+ border-radius: 2px;
59
+ font-size: 14px;
60
+ }
61
+
62
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-container:hover {
63
+ background: #f5f5f5;
64
+ cursor: pointer;
65
+ }
66
+
67
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant {
68
+ flex: 1;
69
+ display: flex;
70
+ align-items: center;
71
+ max-width: calc(100% - 20px);
72
+ }
73
+
74
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-avatar {
75
+ width: 16px;
76
+ height: 16px;
77
+ line-height: 16px;
78
+ margin-left: 10px;
79
+ }
80
+
81
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-name {
82
+ margin-left: 4px;
83
+ flex: 1;
84
+ color: #16181b;
85
+ }
86
+
87
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-check-icon {
88
+ width: 20px;
89
+ text-align: center;
90
+ }
91
+
92
+ .dtable-ui-participants-editor .dtable-ui-participants-editor-participants-container .dtable-ui-participant-check-icon .dtable-font {
93
+ font-size: 12px;
94
+ color: #798d99;
95
+ }
96
+
97
+ /* none */
98
+ .dtable-ui-participants-editor .none-search-result {
99
+ width: 100%;
100
+ padding: 10px;
101
+ font-size: 14px;
102
+ opacity: 0.5;
103
+ display: inline-block;
104
+ }
@@ -0,0 +1,182 @@
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 _reactstrap = require("reactstrap");
11
+ var _dtableUtils = require("dtable-utils");
12
+ var _lang = require("../../../../lang");
13
+ var _CollaboratorItem = _interopRequireDefault(require("../../../../CollaboratorItem"));
14
+ require("./index.css");
15
+ class ParticipantSelect extends _react.Component {
16
+ constructor(props) {
17
+ super(props);
18
+ this.registerHandlers = () => {
19
+ document.addEventListener('mousedown', this.handleOutsideClick);
20
+ };
21
+ this.unregisterHandlers = () => {
22
+ document.removeEventListener('mousedown', this.handleOutsideClick);
23
+ };
24
+ this.handleOutsideClick = e => {
25
+ if (!this.participantsRef.contains(e.target)) {
26
+ this.unregisterHandlers();
27
+ if (e.target.className === 'dtable-ui-participants-add' || e.target.parentNode.className === 'dtable-ui-participants-add') {
28
+ return;
29
+ }
30
+ this.props.onClose();
31
+ }
32
+ };
33
+ this.getFilteredParticipants = () => {
34
+ let {
35
+ collaborators
36
+ } = window.app.state;
37
+ let {
38
+ searchVal
39
+ } = this.state;
40
+ return (0, _dtableUtils.searchCollaborators)(collaborators, searchVal);
41
+ };
42
+ this.removeParticipant = participant => {
43
+ let {
44
+ participants
45
+ } = this.state;
46
+ let updatedValue = participants.slice(0);
47
+ let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
48
+ updatedValue.splice(participant_index, 1);
49
+ this.props.onChange(updatedValue);
50
+ this.setState({
51
+ participants: updatedValue
52
+ });
53
+ };
54
+ this.onChangeSearch = event => {
55
+ let {
56
+ searchVal
57
+ } = this.state;
58
+ if (searchVal === event.target.value) {
59
+ return;
60
+ }
61
+ searchVal = event.target.value;
62
+ this.setState({
63
+ searchVal
64
+ });
65
+ };
66
+ this.onSelectParticipant = participant => {
67
+ let {
68
+ participants
69
+ } = this.state;
70
+ participants = participants.slice(0);
71
+ let participant_index = participants.findIndex(participantItem => participantItem.email === participant.email);
72
+ if (participant_index > -1) {
73
+ participants.splice(participant_index, 1);
74
+ } else {
75
+ participants.push(participant);
76
+ }
77
+ this.props.onChange(participants);
78
+ this.setState({
79
+ participants
80
+ });
81
+ };
82
+ this.renderMenuContent = () => {
83
+ let {
84
+ participants
85
+ } = this.state;
86
+ let filteredParticipants = this.getFilteredParticipants();
87
+ if (filteredParticipants.length > 0) {
88
+ return filteredParticipants.map(participant => {
89
+ let selectedIndex = participants.findIndex(item => item.email === participant.email);
90
+ return /*#__PURE__*/_react.default.createElement("div", {
91
+ key: participant.email,
92
+ className: "dropdown-item dtable-ui-participant-item",
93
+ onClick: this.onSelectParticipant.bind(this, participant)
94
+ }, /*#__PURE__*/_react.default.createElement("div", {
95
+ className: "dtable-ui-participant-container"
96
+ }, /*#__PURE__*/_react.default.createElement("div", {
97
+ className: "dtable-ui-participant"
98
+ }, /*#__PURE__*/_react.default.createElement("img", {
99
+ className: "dtable-ui-participant-avatar",
100
+ alt: participant.name,
101
+ src: participant.avatar_url
102
+ }), /*#__PURE__*/_react.default.createElement("span", {
103
+ className: "dtable-ui-participant-name text-truncate"
104
+ }, participant.name)), /*#__PURE__*/_react.default.createElement("div", {
105
+ className: "dtable-ui-participant-check-icon"
106
+ }, selectedIndex > -1 && /*#__PURE__*/_react.default.createElement("i", {
107
+ "aria-hidden": "true",
108
+ className: "dtable-font dtable-icon-check-mark"
109
+ }))));
110
+ });
111
+ } else {
112
+ return /*#__PURE__*/_react.default.createElement("span", {
113
+ className: "none-search-result"
114
+ }, (0, _lang.getLocale)('No_collaborators_available'));
115
+ }
116
+ };
117
+ this.state = {
118
+ participants: props.participants || [],
119
+ searchVal: ''
120
+ };
121
+ }
122
+ componentDidMount() {
123
+ let collaboratorListHeight = this.participantsRef.offsetHeight;
124
+ this.participantsRef.style.top = "".concat(-collaboratorListHeight + 10, "px");
125
+ this.registerHandlers();
126
+ }
127
+ componentDidUpdate() {
128
+ let collaboratorListHeight = this.participantsRef.offsetHeight;
129
+ this.participantsRef.style.top = "".concat(-collaboratorListHeight + 10, "px");
130
+ }
131
+ componentWillUnmount() {
132
+ this.unregisterHandlers();
133
+ }
134
+ renderParticipantList() {
135
+ const {
136
+ collaborators
137
+ } = this.props;
138
+ const selectedParticipants = collaborators.filter(item => {
139
+ return this.state.participants.find(participant => participant.email === item.email);
140
+ });
141
+ if (selectedParticipants.length === 0) return null;
142
+ return /*#__PURE__*/_react.default.createElement("div", {
143
+ className: "dtable-ui-participants-editor-header"
144
+ }, selectedParticipants.map(participant => {
145
+ return /*#__PURE__*/_react.default.createElement(_CollaboratorItem.default, {
146
+ key: participant.email,
147
+ collaborator: participant,
148
+ className: "dtable-ui-participant",
149
+ enableDeleteCollaborator: true,
150
+ onDeleteCollaborator: this.removeParticipant
151
+ });
152
+ }));
153
+ }
154
+ render() {
155
+ const {
156
+ target
157
+ } = this.props;
158
+ return /*#__PURE__*/_react.default.createElement("div", {
159
+ ref: ref => this.outerRef = ref
160
+ }, /*#__PURE__*/_react.default.createElement(_reactstrap.Popover, {
161
+ placement: "top",
162
+ isOpen: true,
163
+ target: target,
164
+ fade: false,
165
+ hideArrow: true
166
+ }, /*#__PURE__*/_react.default.createElement("div", {
167
+ className: "dropdown-menu dtable-ui-participants-editor show m-0 p-0",
168
+ ref: ref => this.participantsRef = ref
169
+ }, this.renderParticipantList(), /*#__PURE__*/_react.default.createElement("div", {
170
+ className: "dtable-ui-participants-editor-search"
171
+ }, /*#__PURE__*/_react.default.createElement("input", {
172
+ className: "form-control",
173
+ type: "text",
174
+ placeholder: (0, _lang.getLocale)('Search_collaborator'),
175
+ value: this.state.searchVal,
176
+ onChange: this.onChangeSearch
177
+ })), /*#__PURE__*/_react.default.createElement("div", {
178
+ className: "dtable-ui-participants-editor-participants-container"
179
+ }, this.renderMenuContent()))));
180
+ }
181
+ }
182
+ var _default = exports.default = ParticipantSelect;
@@ -0,0 +1,19 @@
1
+ .dtable-ui-comments {
2
+ border-left: 1px solid #e6e6dd;
3
+ display: flex;
4
+ flex-direction: column;
5
+ flex: 1 1 auto;
6
+ overflow: auto;
7
+ border-left: 0;
8
+ }
9
+
10
+ .dtable-ui-comments .dtable-ui-comments-body {
11
+ flex: 1;
12
+ overflow-y: auto;
13
+ padding: 1rem 0.75rem;
14
+ }
15
+
16
+ .dtable-ui-participant-avatar {
17
+ border-radius: 50%;
18
+ vertical-align: middle;
19
+ }