@seafile/sdoc-editor 1.0.32 → 1.0.34
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/dist/basic-sdk/assets/css/dropdown-menu.css +5 -0
- package/dist/basic-sdk/extension/commons/color-menu/index.css +1 -1
- package/dist/basic-sdk/extension/commons/menu/menu.css +0 -1
- package/dist/basic-sdk/extension/plugins/callout/plugin.js +7 -4
- package/dist/basic-sdk/extension/plugins/seatable-column/menu/column-list-menu.css +1 -1
- package/dist/basic-sdk/extension/plugins/seatable-column/render-elem.js +4 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/collaborator-wrapper.js +101 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/index.js +15 -12
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/link-formatter/index.css +41 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/link-formatter/index.js +275 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/link-formatter/utils.js +73 -0
- package/dist/basic-sdk/extension/plugins/seatable-tables/menu/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/index.css +6 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/record-item.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +29 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/style.css +0 -162
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +1 -1
- package/dist/constants/index.js +3 -1
- package/package.json +1 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/creator-formatter.js +0 -124
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import isHotkey from 'is-hotkey';
|
|
2
2
|
import { Editor, Node, Range, Transforms } from '@seafile/slate';
|
|
3
|
-
import { PARAGRAPH, INSERT_POSITION, CODE_BLOCK, CALL_OUT } from '../../constants';
|
|
3
|
+
import { PARAGRAPH, INSERT_POSITION, CODE_BLOCK, CALL_OUT, ORDERED_LIST, UNORDERED_LIST } from '../../constants';
|
|
4
4
|
import { getSelectedNodeEntryByType, isSelectionAtBlockStart } from '../../core';
|
|
5
5
|
import { deleteCalloutIcon, getCalloutEntry, isCalloutContentEmpty, unwrapCallout } from './helper';
|
|
6
6
|
import { insertElement } from '../../toolbar/side-toolbar/helpers';
|
|
@@ -56,9 +56,12 @@ const withCallout = editor => {
|
|
|
56
56
|
if (parentNodeEntry && parentNodeEntry[0].type === CALL_OUT) {
|
|
57
57
|
if (!Node.string(paragraphEntry[0]).length) {
|
|
58
58
|
insertFragment(data);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
if ([ORDERED_LIST, UNORDERED_LIST].includes(data[0].type)) {
|
|
60
|
+
Transforms.removeNodes(newEditor, {
|
|
61
|
+
at: paragraphEntry[1]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -30,10 +30,11 @@ const Column = _ref => {
|
|
|
30
30
|
setIsClicked(false);
|
|
31
31
|
}
|
|
32
32
|
}, [isSelected, isReadOnly]);
|
|
33
|
-
const style = _objectSpread(
|
|
33
|
+
const style = _objectSpread({
|
|
34
|
+
margin: '0 10px',
|
|
35
|
+
border: '1px solid transparent'
|
|
36
|
+
}, isClicked && {
|
|
34
37
|
border: '1px solid red'
|
|
35
|
-
}), {}, {
|
|
36
|
-
margin: '0 10px'
|
|
37
38
|
});
|
|
38
39
|
return /*#__PURE__*/React.createElement("span", Object.assign({}, attributes, {
|
|
39
40
|
style: style
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
|
|
2
|
+
import _CollaboratorFormatter from "dtable-ui-component/lib/CollaboratorFormatter";
|
|
3
|
+
import _Loading from "dtable-ui-component/lib/Loading";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import EventBus from '../../../../utils/event-bus';
|
|
7
|
+
import { EXTERNAL_EVENT } from '../../../../../constants';
|
|
8
|
+
function withCollaborators(Component) {
|
|
9
|
+
return class Wrapper extends React.Component {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
super(props);
|
|
12
|
+
_defineProperty(this, "getFormattedCellValue", () => {
|
|
13
|
+
const {
|
|
14
|
+
value
|
|
15
|
+
} = this.props;
|
|
16
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const isSingleValue = value && !Array.isArray(value);
|
|
20
|
+
const formattedCellValue = isSingleValue ? [value] : value;
|
|
21
|
+
return formattedCellValue;
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(this, "onCollaboratorsChanged", emailUserMap => {
|
|
24
|
+
const {
|
|
25
|
+
isLoading
|
|
26
|
+
} = this.state;
|
|
27
|
+
if (!isLoading) return;
|
|
28
|
+
const cellValue = this.getFormattedCellValue();
|
|
29
|
+
if (!cellValue) {
|
|
30
|
+
this.setState({
|
|
31
|
+
isLoading: false,
|
|
32
|
+
collaborators: []
|
|
33
|
+
});
|
|
34
|
+
// this.unsubscribeUsersChanged();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const collaborators = cellValue.map(email => emailUserMap[email]).filter(Boolean);
|
|
38
|
+
if (collaborators.length === cellValue.length) {
|
|
39
|
+
this.setState({
|
|
40
|
+
isLoading: false,
|
|
41
|
+
collaborators: collaborators
|
|
42
|
+
});
|
|
43
|
+
// this.unsubscribeUsersChanged();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// nothing todo
|
|
48
|
+
});
|
|
49
|
+
this.state = {
|
|
50
|
+
isLoading: true,
|
|
51
|
+
collaborators: []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
async componentDidMount() {
|
|
55
|
+
// TODO: Cheating, non-compliant operations
|
|
56
|
+
const {
|
|
57
|
+
collaboratorManager
|
|
58
|
+
} = window.seafile || window.seafileConfig;
|
|
59
|
+
const cellValue = this.getFormattedCellValue();
|
|
60
|
+
if (!cellValue) {
|
|
61
|
+
this.setState({
|
|
62
|
+
isLoading: false,
|
|
63
|
+
collaborators: []
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const emailUserMap = await collaboratorManager.getEmailUserMap(cellValue);
|
|
68
|
+
if (emailUserMap) {
|
|
69
|
+
const collaborators = cellValue.map(email => emailUserMap[email]);
|
|
70
|
+
this.setState({
|
|
71
|
+
isLoading: false,
|
|
72
|
+
collaborators: collaborators
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const eventBus = EventBus.getInstance();
|
|
77
|
+
this.unsubscribeUsersChanged = eventBus.subscribe(EXTERNAL_EVENT.COLLABORATORS_UPDATED, this.onCollaboratorsChanged);
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const {
|
|
81
|
+
isLoading,
|
|
82
|
+
collaborators
|
|
83
|
+
} = this.state;
|
|
84
|
+
if (isLoading) {
|
|
85
|
+
return /*#__PURE__*/React.createElement(_Loading, null);
|
|
86
|
+
}
|
|
87
|
+
const {
|
|
88
|
+
value,
|
|
89
|
+
containerClassName
|
|
90
|
+
} = this.props;
|
|
91
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
92
|
+
collaborators: collaborators,
|
|
93
|
+
value: value,
|
|
94
|
+
containerClassName: containerClassName
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const CustomCollaboratorFormatter = withCollaborators(_CollaboratorFormatter);
|
|
100
|
+
const CustomCreatorFormatter = withCollaborators(_CreatorFormatter);
|
|
101
|
+
export { CustomCollaboratorFormatter, CustomCreatorFormatter };
|
|
@@ -6,7 +6,6 @@ import _EmailFormatter from "dtable-ui-component/lib/EmailFormatter";
|
|
|
6
6
|
import _UrlFormatter from "dtable-ui-component/lib/UrlFormatter";
|
|
7
7
|
import _AutoNumberFormatter from "dtable-ui-component/lib/AutoNumberFormatter";
|
|
8
8
|
import _FormulaFormatter from "dtable-ui-component/lib/FormulaFormatter";
|
|
9
|
-
import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
|
|
10
9
|
import _MTimeFormatter from "dtable-ui-component/lib/MTimeFormatter";
|
|
11
10
|
import _CTimeFormatter from "dtable-ui-component/lib/CTimeFormatter";
|
|
12
11
|
import _CheckboxFormatter from "dtable-ui-component/lib/CheckboxFormatter";
|
|
@@ -18,12 +17,13 @@ import _GeolocationFormatter from "dtable-ui-component/lib/GeolocationFormatter"
|
|
|
18
17
|
import _FileFormatter from "dtable-ui-component/lib/FileFormatter";
|
|
19
18
|
import _ImageFormatter from "dtable-ui-component/lib/ImageFormatter";
|
|
20
19
|
import _SimpleLongTextFormatter from "dtable-ui-component/lib/SimpleLongTextFormatter";
|
|
21
|
-
import _CollaboratorFormatter from "dtable-ui-component/lib/CollaboratorFormatter";
|
|
22
20
|
import _TextFormatter from "dtable-ui-component/lib/TextFormatter";
|
|
23
21
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
24
22
|
import React, { Fragment } from 'react';
|
|
25
23
|
import { CellType, SELECT_OPTION_COLORS } from 'dtable-utils';
|
|
26
24
|
import { withTranslation } from 'react-i18next';
|
|
25
|
+
import { CustomCollaboratorFormatter, CustomCreatorFormatter } from './collaborator-wrapper';
|
|
26
|
+
import LinkFormatter from './link-formatter';
|
|
27
27
|
class CellFormatter extends React.Component {
|
|
28
28
|
constructor() {
|
|
29
29
|
super(...arguments);
|
|
@@ -64,13 +64,11 @@ class CellFormatter extends React.Component {
|
|
|
64
64
|
}
|
|
65
65
|
case CellType.COLLABORATOR:
|
|
66
66
|
{
|
|
67
|
-
// TODO
|
|
68
67
|
if (!Array.isArray(cellValue) || cellValue.length === 0) return this.renderEmptyFormatter();
|
|
69
68
|
cellValue = cellValue.filter(item => item);
|
|
70
69
|
if (cellValue.length === 0) return this.renderEmptyFormatter();
|
|
71
|
-
return /*#__PURE__*/React.createElement(
|
|
70
|
+
return /*#__PURE__*/React.createElement(CustomCollaboratorFormatter, {
|
|
72
71
|
value: cellValue,
|
|
73
|
-
collaborators: collaborators,
|
|
74
72
|
containerClassName: containerClassName
|
|
75
73
|
});
|
|
76
74
|
}
|
|
@@ -173,12 +171,10 @@ class CellFormatter extends React.Component {
|
|
|
173
171
|
case CellType.CREATOR:
|
|
174
172
|
case CellType.LAST_MODIFIER:
|
|
175
173
|
{
|
|
176
|
-
|
|
177
|
-
return /*#__PURE__*/React.createElement(
|
|
174
|
+
if (cellValue.length === 0) return this.renderEmptyFormatter();
|
|
175
|
+
return /*#__PURE__*/React.createElement(CustomCreatorFormatter, {
|
|
178
176
|
value: cellValue,
|
|
179
|
-
|
|
180
|
-
containerClassName: containerClassName,
|
|
181
|
-
renderEmptyFormatter: this.renderEmptyFormatter
|
|
177
|
+
containerClassName: containerClassName
|
|
182
178
|
});
|
|
183
179
|
}
|
|
184
180
|
case CellType.FORMULA:
|
|
@@ -194,8 +190,15 @@ class CellFormatter extends React.Component {
|
|
|
194
190
|
}
|
|
195
191
|
case CellType.LINK:
|
|
196
192
|
{
|
|
197
|
-
|
|
198
|
-
return
|
|
193
|
+
if (!Array.isArray(cellValue) || cellValue.length === 0) return this.renderEmptyFormatter();
|
|
194
|
+
return /*#__PURE__*/React.createElement(LinkFormatter, {
|
|
195
|
+
value: cellValue,
|
|
196
|
+
column: column,
|
|
197
|
+
collaborators: collaborators,
|
|
198
|
+
containerClassName: containerClassName,
|
|
199
|
+
renderEmptyFormatter: this.renderEmptyFormatter,
|
|
200
|
+
t: this.props.t
|
|
201
|
+
});
|
|
199
202
|
}
|
|
200
203
|
case CellType.AUTO_NUMBER:
|
|
201
204
|
{
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* link */
|
|
2
|
+
.seatable-view-body-column-cell .document-link-formatter {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
flex-wrap: nowrap;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.seatable-view-body-column-cell .document-link-formatter .document-link-item {
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
height: 20px;
|
|
14
|
+
margin-right: 4px;
|
|
15
|
+
padding: 0 6px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
background: #eceff4;
|
|
19
|
+
border-radius: 3px;
|
|
20
|
+
align-items: center;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
line-height: 20px;
|
|
26
|
+
width: fit-content;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.seatable-view-body-column-cell .document-link-formatter .document-checkbox-item {
|
|
30
|
+
width: fit-content;
|
|
31
|
+
margin-right: 10px;
|
|
32
|
+
line-height: 36px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.seatable-view-body-column-cell .document-link-formatter .document-long-text-item {
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
margin-right: 10px;
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import _DepartmentSingleSelectFormatter from "dtable-ui-component/lib/DepartmentSingleSelectFormatter";
|
|
2
|
+
import _LongTextFormatter from "dtable-ui-component/lib/LongTextFormatter";
|
|
3
|
+
import _CheckboxFormatter from "dtable-ui-component/lib/CheckboxFormatter";
|
|
4
|
+
import _MultipleSelectFormatter from "dtable-ui-component/lib/MultipleSelectFormatter";
|
|
5
|
+
import _MTimeFormatter from "dtable-ui-component/lib/MTimeFormatter";
|
|
6
|
+
import _CTimeFormatter from "dtable-ui-component/lib/CTimeFormatter";
|
|
7
|
+
import _DateFormatter from "dtable-ui-component/lib/DateFormatter";
|
|
8
|
+
import _NumberFormatter from "dtable-ui-component/lib/NumberFormatter";
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { CellType, FORMULA_RESULT_TYPE, getDurationDisplayString, getGeolocationDisplayString, getMultipleOptionName } from 'dtable-utils';
|
|
11
|
+
import { CustomCreatorFormatter } from '../collaborator-wrapper';
|
|
12
|
+
import { getCellDisplayValue, getFormulaArrayValue, isArrayFormalColumn } from './utils';
|
|
13
|
+
function LinkFormatter(props) {
|
|
14
|
+
const {
|
|
15
|
+
column,
|
|
16
|
+
value,
|
|
17
|
+
containerClassName,
|
|
18
|
+
collaborators
|
|
19
|
+
} = props;
|
|
20
|
+
const {
|
|
21
|
+
data
|
|
22
|
+
} = column;
|
|
23
|
+
if (!Array.isArray(value) || value.length === 0) return props.renderEmptyFormatter();
|
|
24
|
+
let {
|
|
25
|
+
display_column: displayColumn
|
|
26
|
+
} = data || {};
|
|
27
|
+
if (!displayColumn) return props.renderEmptyFormatter();
|
|
28
|
+
const {
|
|
29
|
+
type: displayColumnType,
|
|
30
|
+
data: displayColumnData
|
|
31
|
+
} = displayColumn;
|
|
32
|
+
const cellValue = getFormulaArrayValue(value, !isArrayFormalColumn(displayColumnType));
|
|
33
|
+
if (!Array.isArray(cellValue) || cellValue.length === 0) return props.renderEmptyFormatter();
|
|
34
|
+
switch (displayColumnType) {
|
|
35
|
+
case CellType.TEXT:
|
|
36
|
+
case CellType.AUTO_NUMBER:
|
|
37
|
+
case CellType.EMAIL:
|
|
38
|
+
case CellType.URL:
|
|
39
|
+
{
|
|
40
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: containerClassName
|
|
42
|
+
}, cellValue.map((value, index) => {
|
|
43
|
+
if (!value) return null;
|
|
44
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
46
|
+
className: "document-link-item"
|
|
47
|
+
}, value);
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
case CellType.NUMBER:
|
|
51
|
+
{
|
|
52
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: containerClassName
|
|
54
|
+
}, cellValue.map((value, index) => {
|
|
55
|
+
if (!value && value !== 0) return null;
|
|
56
|
+
return /*#__PURE__*/React.createElement(_NumberFormatter, {
|
|
57
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
58
|
+
containerClassName: "document-link-item",
|
|
59
|
+
data: displayColumnData || {},
|
|
60
|
+
value: value
|
|
61
|
+
});
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
case CellType.DATE:
|
|
65
|
+
{
|
|
66
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: containerClassName
|
|
68
|
+
}, cellValue.map((value, index) => {
|
|
69
|
+
if (!value || typeof value !== 'string') return null;
|
|
70
|
+
const {
|
|
71
|
+
format
|
|
72
|
+
} = displayColumnData || {};
|
|
73
|
+
return /*#__PURE__*/React.createElement(_DateFormatter, {
|
|
74
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
75
|
+
value: value,
|
|
76
|
+
format: format,
|
|
77
|
+
containerClassName: "document-link-item"
|
|
78
|
+
});
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
case CellType.CTIME:
|
|
82
|
+
{
|
|
83
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: containerClassName
|
|
85
|
+
}, cellValue.map((value, index) => {
|
|
86
|
+
if (!value) return null;
|
|
87
|
+
return /*#__PURE__*/React.createElement(_CTimeFormatter, {
|
|
88
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
89
|
+
value: value,
|
|
90
|
+
containerClassName: "document-link-item"
|
|
91
|
+
});
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
case CellType.MTIME:
|
|
95
|
+
{
|
|
96
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: containerClassName
|
|
98
|
+
}, cellValue.map((value, index) => {
|
|
99
|
+
if (!value) return null;
|
|
100
|
+
return /*#__PURE__*/React.createElement(_MTimeFormatter, {
|
|
101
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
102
|
+
value: value,
|
|
103
|
+
containerClassName: "document-link-item"
|
|
104
|
+
});
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
case CellType.DURATION:
|
|
108
|
+
{
|
|
109
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: containerClassName
|
|
111
|
+
}, cellValue.map((value, index) => {
|
|
112
|
+
if (!value) return null;
|
|
113
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
115
|
+
className: "document-link-item"
|
|
116
|
+
}, getDurationDisplayString(value, displayColumnData));
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
case CellType.CREATOR:
|
|
120
|
+
case CellType.LAST_MODIFIER:
|
|
121
|
+
{
|
|
122
|
+
return /*#__PURE__*/React.createElement(CustomCreatorFormatter, {
|
|
123
|
+
value: cellValue
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
case CellType.SINGLE_SELECT:
|
|
127
|
+
{
|
|
128
|
+
if (!cellValue || cellValue.length === 0) {
|
|
129
|
+
return props.renderEmptyFormatter();
|
|
130
|
+
}
|
|
131
|
+
const options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
|
|
132
|
+
return /*#__PURE__*/React.createElement(_MultipleSelectFormatter, {
|
|
133
|
+
value: cellValue,
|
|
134
|
+
options: options || [],
|
|
135
|
+
containerClassName: "dtable-dataset-".concat(displayColumnType, "-formatter")
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
case CellType.MULTIPLE_SELECT:
|
|
139
|
+
{
|
|
140
|
+
if (!cellValue || cellValue.length === 0) {
|
|
141
|
+
return props.renderEmptyFormatter();
|
|
142
|
+
}
|
|
143
|
+
const options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
|
|
144
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: containerClassName
|
|
146
|
+
}, cellValue.map((value, index) => {
|
|
147
|
+
if (!value) return null;
|
|
148
|
+
const valueDisplayString = Array.isArray(value) ? getMultipleOptionName(options, value) : getMultipleOptionName(options, [value]);
|
|
149
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
151
|
+
className: "document-link-item"
|
|
152
|
+
}, valueDisplayString);
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
case CellType.COLLABORATOR:
|
|
156
|
+
{
|
|
157
|
+
if (!cellValue || cellValue.length === 0) {
|
|
158
|
+
return props.renderEmptyFormatter();
|
|
159
|
+
}
|
|
160
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
161
|
+
className: containerClassName
|
|
162
|
+
}, cellValue.map((value, index) => {
|
|
163
|
+
if (!value) return null;
|
|
164
|
+
const valueDisplayString = Array.isArray(value) ? getCellDisplayValue({
|
|
165
|
+
[displayColumn.key]: value
|
|
166
|
+
}, displayColumn, collaborators) : getCellDisplayValue({
|
|
167
|
+
[displayColumn.key]: [value]
|
|
168
|
+
}, displayColumn, collaborators);
|
|
169
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
170
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
171
|
+
className: "document-link-item"
|
|
172
|
+
}, valueDisplayString);
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
case CellType.CHECKBOX:
|
|
176
|
+
{
|
|
177
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: containerClassName
|
|
179
|
+
}, cellValue.map((value, index) => {
|
|
180
|
+
return /*#__PURE__*/React.createElement(_CheckboxFormatter, {
|
|
181
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
182
|
+
value: Boolean(value),
|
|
183
|
+
containerClassName: "document-".concat(displayColumnType, "-item")
|
|
184
|
+
});
|
|
185
|
+
}));
|
|
186
|
+
}
|
|
187
|
+
case CellType.GEOLOCATION:
|
|
188
|
+
{
|
|
189
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: containerClassName
|
|
191
|
+
}, cellValue.map((value, index) => {
|
|
192
|
+
if (!value) return null;
|
|
193
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
194
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
195
|
+
className: "document-link-item"
|
|
196
|
+
}, getGeolocationDisplayString(value, displayColumnData, {
|
|
197
|
+
hyphen: ' '
|
|
198
|
+
}));
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
case CellType.LONG_TEXT:
|
|
202
|
+
{
|
|
203
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
204
|
+
className: containerClassName
|
|
205
|
+
}, cellValue.map((value, index) => {
|
|
206
|
+
if (!value) return null;
|
|
207
|
+
return /*#__PURE__*/React.createElement(_LongTextFormatter, {
|
|
208
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
209
|
+
value: value,
|
|
210
|
+
containerClassName: "document-".concat(displayColumnType, "-item")
|
|
211
|
+
});
|
|
212
|
+
}));
|
|
213
|
+
}
|
|
214
|
+
case CellType.FORMULA:
|
|
215
|
+
case CellType.LINK_FORMULA:
|
|
216
|
+
{
|
|
217
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
218
|
+
className: containerClassName
|
|
219
|
+
}, cellValue.map((value, index) => {
|
|
220
|
+
if (!value) return null;
|
|
221
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
223
|
+
className: "document-link-item"
|
|
224
|
+
}, getCellDisplayValue({
|
|
225
|
+
[displayColumn.key]: value
|
|
226
|
+
}, displayColumn, collaborators));
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
case FORMULA_RESULT_TYPE.BOOL:
|
|
230
|
+
{
|
|
231
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
232
|
+
className: containerClassName
|
|
233
|
+
}, cellValue.map((value, index) => {
|
|
234
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
235
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
236
|
+
className: "document-link-item"
|
|
237
|
+
}, value + '');
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
case FORMULA_RESULT_TYPE.STRING:
|
|
241
|
+
{
|
|
242
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
className: containerClassName
|
|
244
|
+
}, cellValue.map((value, index) => {
|
|
245
|
+
if (!value) return null;
|
|
246
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
247
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
248
|
+
className: "document-link-item"
|
|
249
|
+
}, value);
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
case CellType.DEPARTMENT_SINGLE_SELECT:
|
|
253
|
+
{
|
|
254
|
+
const {
|
|
255
|
+
userId,
|
|
256
|
+
departments = []
|
|
257
|
+
} = window.seafile || window.seafileConfig;
|
|
258
|
+
if (!userId) return null;
|
|
259
|
+
return cellValue.map((item, index) => {
|
|
260
|
+
return /*#__PURE__*/React.createElement(_DepartmentSingleSelectFormatter, {
|
|
261
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
262
|
+
tip: props.t('Deleted_department'),
|
|
263
|
+
value: item,
|
|
264
|
+
departments: departments,
|
|
265
|
+
containerClassName: containerClassName
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
default:
|
|
270
|
+
{
|
|
271
|
+
return props.renderEmptyFormatter();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
export default LinkFormatter;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { CellType, getCellValueDisplayString } from 'dtable-utils';
|
|
2
|
+
export const isValidCellValue = value => {
|
|
3
|
+
if (value === undefined) return false;
|
|
4
|
+
if (value === null) return false;
|
|
5
|
+
if (value === '') return false;
|
|
6
|
+
if (JSON.stringify(value) === '{}') return false;
|
|
7
|
+
if (JSON.stringify(value) === '[]') return false;
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
export const getCellDisplayValue = (record, column, collaborators) => {
|
|
11
|
+
const {
|
|
12
|
+
type,
|
|
13
|
+
data,
|
|
14
|
+
key
|
|
15
|
+
} = column;
|
|
16
|
+
return getCellValueDisplayString(record, type, key, {
|
|
17
|
+
data,
|
|
18
|
+
collaborators,
|
|
19
|
+
geolocationHyphen: ' '
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export const getTwoDimensionArrayValue = value => {
|
|
23
|
+
if (!Array.isArray(value)) return [];
|
|
24
|
+
return value.map(item => {
|
|
25
|
+
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
29
|
+
const {
|
|
30
|
+
display_value
|
|
31
|
+
} = item;
|
|
32
|
+
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
33
|
+
return display_value.map(i => {
|
|
34
|
+
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
35
|
+
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
36
|
+
const {
|
|
37
|
+
display_value
|
|
38
|
+
} = i;
|
|
39
|
+
return display_value;
|
|
40
|
+
}
|
|
41
|
+
return i;
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const getFormulaArrayValue = function (value) {
|
|
46
|
+
let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
47
|
+
if (!Array.isArray(value)) return [];
|
|
48
|
+
if (!isFlat) return getTwoDimensionArrayValue(value);
|
|
49
|
+
return value.map(item => {
|
|
50
|
+
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
51
|
+
return item;
|
|
52
|
+
}
|
|
53
|
+
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
54
|
+
const {
|
|
55
|
+
display_value
|
|
56
|
+
} = item;
|
|
57
|
+
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
58
|
+
return display_value.map(i => {
|
|
59
|
+
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
60
|
+
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
61
|
+
const {
|
|
62
|
+
display_value
|
|
63
|
+
} = i;
|
|
64
|
+
return display_value;
|
|
65
|
+
}
|
|
66
|
+
return i;
|
|
67
|
+
});
|
|
68
|
+
}).flat().filter(item => isValidCellValue(item));
|
|
69
|
+
};
|
|
70
|
+
export function isArrayFormalColumn(columnType) {
|
|
71
|
+
const multipleValueTypes = [CellType.IMAGE, CellType.FILE, CellType.MULTIPLE_SELECT, CellType.COLLABORATOR];
|
|
72
|
+
return multipleValueTypes.includes(columnType);
|
|
73
|
+
}
|
|
@@ -31,7 +31,7 @@ const SeaTableTableMenu = _ref => {
|
|
|
31
31
|
hideArrow: true,
|
|
32
32
|
fade: false
|
|
33
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: "sdoc-dropdown-menu-container",
|
|
34
|
+
className: "sdoc-dropdown-menu-container sdoc-seatable-selected-table-list-wrapper",
|
|
35
35
|
style: {
|
|
36
36
|
bottom: computedBottom
|
|
37
37
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.seatable-view-container {
|
|
2
2
|
width: 100%;
|
|
3
3
|
overflow: auto;
|
|
4
|
-
border:
|
|
4
|
+
border: 2px solid transparent;
|
|
5
5
|
position: relative;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -42,3 +42,8 @@
|
|
|
42
42
|
.seatable-view-records.no_alternate_color tr:nth-child(2n+1) {
|
|
43
43
|
background-color: #fff;
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
.seatable-view-body-column-cell .collaborator-item .collaborator-avatar img {
|
|
47
|
+
min-width: 16px;
|
|
48
|
+
min-height: 16px;
|
|
49
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CellType } from 'dtable-utils';
|
|
3
3
|
import { getColumnWidth } from '../../seatable-column/helpers';
|
|
4
4
|
import Formatter from '../formatter';
|
|
5
5
|
export default function RecordItem(_ref) {
|
|
@@ -18,7 +18,7 @@ export default function RecordItem(_ref) {
|
|
|
18
18
|
}, index), columns.map(column => {
|
|
19
19
|
const width = getColumnWidth(column);
|
|
20
20
|
let cellValue = record[column.key];
|
|
21
|
-
if (
|
|
21
|
+
if ([CellType.LINK, CellType.LINK_FORMULA, CellType.FORMULA].includes(column.type)) {
|
|
22
22
|
cellValue = formulaRow[column.key];
|
|
23
23
|
}
|
|
24
24
|
return /*#__PURE__*/React.createElement("td", {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { useReadOnly, useSelected } from '@seafile/slate-react';
|
|
5
|
-
import { getFilteredRowsWithoutFormulaCalculation, sortTableRows } from 'dtable-utils';
|
|
6
|
+
import { CellType, getFilteredRowsWithoutFormulaCalculation, sortTableRows } from 'dtable-utils';
|
|
6
7
|
import Loading from '../../../../../components/loading';
|
|
7
8
|
import RecordHeader from './record-header';
|
|
8
9
|
import RecordList from './record-list';
|
|
@@ -118,6 +119,33 @@ function SeaTableTable(_ref) {
|
|
|
118
119
|
} = element;
|
|
119
120
|
validColumns = table.columns.filter(item => shown_column_keys.includes(item.key));
|
|
120
121
|
}
|
|
122
|
+
// formatted columns
|
|
123
|
+
validColumns = validColumns.map(column => {
|
|
124
|
+
const {
|
|
125
|
+
type
|
|
126
|
+
} = column;
|
|
127
|
+
if (type === CellType.LINK) {
|
|
128
|
+
const {
|
|
129
|
+
data
|
|
130
|
+
} = column;
|
|
131
|
+
const {
|
|
132
|
+
display_column_key,
|
|
133
|
+
array_type,
|
|
134
|
+
array_data
|
|
135
|
+
} = data;
|
|
136
|
+
const display_column = {
|
|
137
|
+
key: display_column_key || '0000',
|
|
138
|
+
type: array_type || CellType.TEXT,
|
|
139
|
+
data: array_data || null
|
|
140
|
+
};
|
|
141
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
|
142
|
+
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
143
|
+
display_column
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return column;
|
|
148
|
+
});
|
|
121
149
|
setColumns(validColumns);
|
|
122
150
|
setIsLoading(false);
|
|
123
151
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -108,7 +108,7 @@ export default function TableSettings(_ref) {
|
|
|
108
108
|
columns: columns,
|
|
109
109
|
filterConjunction: settings.filter_conjunction || 'And',
|
|
110
110
|
filters: settings.filters || [],
|
|
111
|
-
collaborators:
|
|
111
|
+
collaborators: editor.collaborators,
|
|
112
112
|
onFiltersChange: onFiltersChange,
|
|
113
113
|
isNeedSubmit: true
|
|
114
114
|
}), /*#__PURE__*/React.createElement(SortSetter, {
|
|
@@ -1,165 +1,3 @@
|
|
|
1
|
-
.menu-group .sdoc-color-menu.menu-show {
|
|
2
|
-
background: #e5e5e5;
|
|
3
|
-
border-radius: 2px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.menu-group .sdoc-color-menu .last-used-color-container {
|
|
7
|
-
height: 100%;
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.menu-group .sdoc-color-menu .last-used-color-container.disabled {
|
|
15
|
-
padding-right: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.menu-group .sdoc-color-menu .sdoc-color-toggle {
|
|
19
|
-
height: 100%;
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.menu-group .sdoc-color-menu .sdoc-color-toggle:hover,
|
|
26
|
-
.menu-group .sdoc-color-menu .last-used-color-container:not(.disabled):hover {
|
|
27
|
-
background-color: #E5E5E5;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.menu-group .sdoc-color-menu.disabled .sdoc-color-toggle {
|
|
31
|
-
display: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.sdoc-color-menu .sdoc-color-icon {
|
|
35
|
-
height: 12px;
|
|
36
|
-
width: 12px;
|
|
37
|
-
transform: scale(.85);
|
|
38
|
-
line-height: 12px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.sdoc-color-menu .last-used-color {
|
|
42
|
-
width: 14px;
|
|
43
|
-
height: 3px;
|
|
44
|
-
border-radius: 1px;
|
|
45
|
-
margin-top: 1px;
|
|
46
|
-
border: 1px solid rgba(0, 0, 0, .08);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.sdoc-color-menu-popover .popover {
|
|
50
|
-
left: -24px !important;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.sdoc-color-menu-popover .sdoc-color-dropdown-menu {
|
|
54
|
-
width: 251px;
|
|
55
|
-
padding: 0 0 12px 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.sdoc-color-menu-popover .sdoc-color-no-color-container {
|
|
59
|
-
width: 100%;
|
|
60
|
-
height: 24px;
|
|
61
|
-
margin-bottom: 5px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.sdoc-color-menu-popover .sdoc-color-no-color-content {
|
|
65
|
-
height: 100%;
|
|
66
|
-
width: 100%;
|
|
67
|
-
text-align: center;
|
|
68
|
-
border: 1px solid rgba(0, 0, 0, .12);
|
|
69
|
-
border-radius: 2px;
|
|
70
|
-
font-size: 12px;
|
|
71
|
-
line-height: 22px;
|
|
72
|
-
cursor: pointer;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.sdoc-color-menu-popover .sdoc-color-default-colors-container {
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-wrap: wrap;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.sdoc-color-menu-popover .sdoc-color-item {
|
|
81
|
-
position: relative;
|
|
82
|
-
height: 20px;
|
|
83
|
-
width: 20px;
|
|
84
|
-
margin-right: 3px;
|
|
85
|
-
margin-bottom: 3px;
|
|
86
|
-
border: 0.5px solid rgba(0, 0, 0, .08);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.sdoc-color-menu-popover .sdoc-color-item:not(.selected):hover::before {
|
|
90
|
-
content: '';
|
|
91
|
-
position: absolute;
|
|
92
|
-
width: calc(100% + 5px);
|
|
93
|
-
height: calc((100% + 5px));
|
|
94
|
-
top: -2.5px;
|
|
95
|
-
left: -2.5px;
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
border: 1px solid rgba(0, 0, 0, .24);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.sdoc-color-menu-popover .sdoc-color-item.selected::after {
|
|
101
|
-
content: '';
|
|
102
|
-
position: absolute;
|
|
103
|
-
width: calc(100% + 5px);
|
|
104
|
-
height: calc((100% + 5px));
|
|
105
|
-
top: -2.5px;
|
|
106
|
-
left: -2.5px;
|
|
107
|
-
pointer-events: none;
|
|
108
|
-
border: 1px solid rgba(0, 0, 0, .88);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.sdoc-color-menu-popover .sdoc-color-item:hover {
|
|
112
|
-
cursor: pointer;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.sdoc-color-menu-popover .sdoc-color-item:nth-child(10n) {
|
|
116
|
-
margin-right: 0px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.sdoc-color-menu-popover .sdoc-color-sub-title {
|
|
120
|
-
font-size: 11px;
|
|
121
|
-
line-height: 16px;
|
|
122
|
-
margin: 7px 0;
|
|
123
|
-
color: rgba(0, 0, 0, 0.4);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.sdoc-color-menu-popover .sdoc-colors-divider {
|
|
127
|
-
width: 100%;
|
|
128
|
-
height: 1px;
|
|
129
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
130
|
-
margin: 0px 0 8px 0;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.sdoc-color-menu-popover .sdoc-more-colors {
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
justify-content: space-between;
|
|
137
|
-
height: 30px;
|
|
138
|
-
font-size: 12px;
|
|
139
|
-
padding: 0 12px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.sdoc-color-menu-popover .sdoc-more-colors .sdocfont {
|
|
143
|
-
font-size: 12px;
|
|
144
|
-
transform: scale(.6);
|
|
145
|
-
color: #888;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.sdoc-color-menu-popover .sdoc-more-colors.show-pick {
|
|
149
|
-
cursor: pointer;
|
|
150
|
-
background-color: rgba(51, 77, 102, .06);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.sdoc-more-colors-popover .popover {
|
|
154
|
-
left: 10px !important;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/* commission */
|
|
158
|
-
.menu-group #button-sdoc-highlight-color .sdoc-color-icon {
|
|
159
|
-
position: relative;
|
|
160
|
-
left: 1px;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
1
|
.sdoc-table-cell-bg-colors-popover .popover {
|
|
164
2
|
margin-left: 30px;
|
|
165
3
|
}
|
|
@@ -67,7 +67,7 @@ const InsertToolbar = _ref => {
|
|
|
67
67
|
className: "sdocfont sdoc-insert mr-1"
|
|
68
68
|
}), /*#__PURE__*/React.createElement("span", {
|
|
69
69
|
className: "text-truncate"
|
|
70
|
-
}, t('Insert'))),
|
|
70
|
+
}, t('Insert'))), /*#__PURE__*/React.createElement("div", {
|
|
71
71
|
className: "sdoc-menu-with-dropdown-triangle"
|
|
72
72
|
}, /*#__PURE__*/React.createElement("span", {
|
|
73
73
|
className: caretIconClass
|
package/dist/constants/index.js
CHANGED
|
@@ -21,7 +21,9 @@ export const EXTERNAL_EVENT = {
|
|
|
21
21
|
CREATE_SDOC_FILE: 'create_sdoc_file',
|
|
22
22
|
CREATE_WIKI_PAGE: 'create_wiki_page',
|
|
23
23
|
// wiki
|
|
24
|
-
INSERT_LINK: 'insert_link'
|
|
24
|
+
INSERT_LINK: 'insert_link',
|
|
25
|
+
// document
|
|
26
|
+
COLLABORATORS_UPDATED: 'collaborators_updated'
|
|
25
27
|
};
|
|
26
28
|
export const TIP_TYPE = {
|
|
27
29
|
DELETE_NO_CHANGES_REVISION: 'delete_no_changes_revision',
|
package/package.json
CHANGED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import context from '@/context';
|
|
5
|
-
import { isValidEmail } from '@/utils/common-utils';
|
|
6
|
-
class DtableCreatorFormatter extends Component {
|
|
7
|
-
constructor(_props) {
|
|
8
|
-
super(_props);
|
|
9
|
-
_defineProperty(this, "calculateCollaboratorData", props => {
|
|
10
|
-
const {
|
|
11
|
-
value
|
|
12
|
-
} = props;
|
|
13
|
-
this.getCollaborator(value);
|
|
14
|
-
});
|
|
15
|
-
_defineProperty(this, "getCollaborator", value => {
|
|
16
|
-
if (!value) {
|
|
17
|
-
this.setState({
|
|
18
|
-
isDataLoaded: true,
|
|
19
|
-
collaborator: null
|
|
20
|
-
});
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
this.setState({
|
|
24
|
-
isDataLoaded: false,
|
|
25
|
-
collaborator: null
|
|
26
|
-
});
|
|
27
|
-
const {
|
|
28
|
-
collaborators
|
|
29
|
-
} = this.props;
|
|
30
|
-
let collaborator = Array.isArray(collaborators) && collaborators.find(c => c && c.username === value);
|
|
31
|
-
if (collaborator) {
|
|
32
|
-
this.setState({
|
|
33
|
-
isDataLoaded: true,
|
|
34
|
-
collaborator: collaborator
|
|
35
|
-
});
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const mediaUrl = context.getSetting('mediaUrl');
|
|
39
|
-
const defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
|
|
40
|
-
if (value === 'anonymous') {
|
|
41
|
-
collaborator = {
|
|
42
|
-
name: 'anonymous',
|
|
43
|
-
avatar_url: defaultAvatarUrl
|
|
44
|
-
};
|
|
45
|
-
this.setState({
|
|
46
|
-
isDataLoaded: true,
|
|
47
|
-
collaborator
|
|
48
|
-
});
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
let dtableCollaborators = window.app.collaboratorsCache;
|
|
52
|
-
collaborator = dtableCollaborators[value];
|
|
53
|
-
if (collaborator) {
|
|
54
|
-
this.setState({
|
|
55
|
-
isDataLoaded: true,
|
|
56
|
-
collaborator
|
|
57
|
-
});
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (!isValidEmail(value)) {
|
|
61
|
-
collaborator = {
|
|
62
|
-
name: value,
|
|
63
|
-
avatar_url: defaultAvatarUrl
|
|
64
|
-
};
|
|
65
|
-
dtableCollaborators[value] = collaborator;
|
|
66
|
-
this.setState({
|
|
67
|
-
isDataLoaded: true,
|
|
68
|
-
collaborator: collaborator
|
|
69
|
-
});
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
context.getUserCommonInfo(value).then(res => {
|
|
73
|
-
collaborator = res.data;
|
|
74
|
-
dtableCollaborators[value] = collaborator;
|
|
75
|
-
this.setState({
|
|
76
|
-
isDataLoaded: true,
|
|
77
|
-
collaborator: collaborator
|
|
78
|
-
});
|
|
79
|
-
}).catch(() => {
|
|
80
|
-
let mediaUrl = context.getSetting('mediaUrl');
|
|
81
|
-
let defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
|
|
82
|
-
collaborator = {
|
|
83
|
-
name: value,
|
|
84
|
-
avatar_url: defaultAvatarUrl
|
|
85
|
-
};
|
|
86
|
-
dtableCollaborators[value] = collaborator;
|
|
87
|
-
this.setState({
|
|
88
|
-
isDataLoaded: true,
|
|
89
|
-
collaborator: collaborator
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
this.state = {
|
|
94
|
-
isDataLoaded: false,
|
|
95
|
-
collaborator: null
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
componentDidMount() {
|
|
99
|
-
this.calculateCollaboratorData(this.props);
|
|
100
|
-
}
|
|
101
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
102
|
-
this.calculateCollaboratorData(nextProps);
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
const {
|
|
106
|
-
isDataLoaded,
|
|
107
|
-
collaborator
|
|
108
|
-
} = this.state;
|
|
109
|
-
const {
|
|
110
|
-
value,
|
|
111
|
-
containerClassName
|
|
112
|
-
} = this.props;
|
|
113
|
-
if (!value || !collaborator) return this.props.renderEmptyFormatter();
|
|
114
|
-
if (isDataLoaded) {
|
|
115
|
-
return /*#__PURE__*/React.createElement(_CreatorFormatter, {
|
|
116
|
-
collaborators: [collaborator],
|
|
117
|
-
value: value,
|
|
118
|
-
containerClassName: containerClassName
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return this.props.renderEmptyFormatter();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export default DtableCreatorFormatter;
|