@seafile/sdoc-editor 0.3.26-1 → 0.3.26-2
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/constants/index.js +2 -1
- package/dist/basic-sdk/editor/sdoc-editor.js +1 -1
- package/dist/basic-sdk/extension/plugins/chart/chart-components/chart-type-setting/index.css +1 -1
- package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/column-setting.js +1 -1
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/common-add-tool.js +23 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/common-hooks.js +15 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/constants.js +10 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/custom-select/index.js +98 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/custom-select/option-group.js +236 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/custom-select/option.js +40 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/custom-select/select.css +135 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/date-translate.js +54 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/department-editor/department-multiple-select.js +146 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/department-editor/department-single-select.js +272 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/department-editor/index.css +209 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/department-editor/index.js +98 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/department-editor/selected-departments.js +85 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/dtable-search-input.js +127 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/collaborator-filter.js +106 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/department-multiple-select-filter.js +86 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/department-single-select-filter.js +85 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/filter-calendar.js +166 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/filter-item-utils.js +144 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/filter-item.js +679 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/filters-list.css +320 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/filters-list.js +121 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover-widgets/rate-item.js +72 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filter-popover.js +208 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/filters-popover.css +30 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/index.css +18 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/index.js +79 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/utils.js +531 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.js +76 -15
- package/dist/basic-sdk/extension/plugins/chart/chart-setting/index.js +5 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/common-utils/base-utils.js +84 -3
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/common-utils/dtable-utils.js +2 -5
- package/dist/basic-sdk/extension/plugins/chart/chart-utils/histogram-bar-utils.js +2 -3
- package/dist/basic-sdk/extension/plugins/chart/constants/special-column-types.js +7 -7
- package/dist/basic-sdk/extension/plugins/chart/helpers.js +17 -1
- package/dist/basic-sdk/extension/plugins/chart/hover-menu/index.js +0 -1
- package/dist/basic-sdk/extension/plugins/chart/model.js +1 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.js +18 -73
- package/dist/context.js +4 -0
- package/package.json +4 -2
|
@@ -14,7 +14,8 @@ export const INTERNAL_EVENT = {
|
|
|
14
14
|
UPDATE_TAG_VIEW: 'update_tag_view',
|
|
15
15
|
COMMENT_LIST_CLICK: 'comment_list_click',
|
|
16
16
|
UNSEEN_NOTIFICATIONS_COUNT: 'unseen_notifications_count',
|
|
17
|
-
CLOSE_CALLOUT_COLOR_PICKER: 'close_callout_color_picker'
|
|
17
|
+
CLOSE_CALLOUT_COLOR_PICKER: 'close_callout_color_picker',
|
|
18
|
+
OPEN_SELECT: 'open_select'
|
|
18
19
|
};
|
|
19
20
|
export const REVISION_DIFF_KEY = 'diff';
|
|
20
21
|
export const REVISION_DIFF_VALUE = '1';
|
package/dist/basic-sdk/extension/plugins/chart/chart-components/common-settings/column-setting.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
|
-
import { COLUMN_OPTIONS } from 'dtable-
|
|
2
|
+
import { COLUMN_OPTIONS } from 'dtable-utils';
|
|
3
3
|
import { withTranslation } from 'react-i18next';
|
|
4
4
|
import DtableSelect from './dtable-select-setting';
|
|
5
5
|
import DtableUtils from '../../chart-utils/common-utils/dtable-utils';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
function CommonAddTool(_ref) {
|
|
3
|
+
let {
|
|
4
|
+
callBack,
|
|
5
|
+
footerName,
|
|
6
|
+
className,
|
|
7
|
+
addIconClassName,
|
|
8
|
+
hideIcon,
|
|
9
|
+
style
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
className: "add-item-btn ".concat(className ? className : ''),
|
|
13
|
+
style: style,
|
|
14
|
+
onClick: e => {
|
|
15
|
+
callBack(e);
|
|
16
|
+
}
|
|
17
|
+
}, !hideIcon && /*#__PURE__*/React.createElement("span", {
|
|
18
|
+
className: "dtable-font dtable-icon-add-table ".concat(addIconClassName || '')
|
|
19
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: "text-truncate"
|
|
21
|
+
}, footerName));
|
|
22
|
+
}
|
|
23
|
+
export default CommonAddTool;
|
package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/common-hooks.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
function useClickOutsideEffect(ref, callback) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
const handleClickOutside = event => {
|
|
5
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
6
|
+
callback();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
document.addEventListener('click', handleClickOutside);
|
|
10
|
+
return () => {
|
|
11
|
+
document.removeEventListener('click', handleClickOutside);
|
|
12
|
+
};
|
|
13
|
+
}, [ref, callback]);
|
|
14
|
+
}
|
|
15
|
+
export { useClickOutsideEffect };
|
package/dist/basic-sdk/extension/plugins/chart/chart-components/data-filter-setting/constants.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const DEPARTMENT_SELECT_RANGE_OPTIONS = [{
|
|
2
|
+
name: 'Current_user_department',
|
|
3
|
+
type: 'current_user_department'
|
|
4
|
+
}, {
|
|
5
|
+
name: 'Current_user_department_and_sub',
|
|
6
|
+
type: 'current_user_department_and_sub'
|
|
7
|
+
}, {
|
|
8
|
+
name: 'Specific_departments',
|
|
9
|
+
type: 'specific_departments'
|
|
10
|
+
}];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import OptGroup from './option-group';
|
|
4
|
+
import EventBus from '../../../../../../utils/event-bus';
|
|
5
|
+
import { INTERNAL_EVENT } from '../../../../../../../basic-sdk/constants';
|
|
6
|
+
import './select.css';
|
|
7
|
+
class Select extends Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.onSelectToggle = event => {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
/*
|
|
13
|
+
if select is showing, click events do not need to be monitored by other click events,
|
|
14
|
+
so it can be closed when other select is clicked.
|
|
15
|
+
*/
|
|
16
|
+
if (this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
|
|
17
|
+
let eventClassName = event.target.className;
|
|
18
|
+
if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
|
|
19
|
+
// Prevent closing by pressing the spacebar in the search input
|
|
20
|
+
if (event.target.value === '') return;
|
|
21
|
+
this.setState({
|
|
22
|
+
isShowSelectOptions: !this.state.isShowSelectOptions
|
|
23
|
+
});
|
|
24
|
+
const eventBus = EventBus.getInstance();
|
|
25
|
+
eventBus.dispatch(INTERNAL_EVENT.OPEN_SELECT, !this.state.isShowSelectOptions);
|
|
26
|
+
};
|
|
27
|
+
this.onClick = event => {
|
|
28
|
+
if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!this.selector.contains(event.target)) {
|
|
32
|
+
this.closeSelect();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.closeSelect = () => {
|
|
36
|
+
this.setState({
|
|
37
|
+
isShowSelectOptions: false
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
this.getSelectedOptionTop = () => {
|
|
41
|
+
if (!this.selector) return 38;
|
|
42
|
+
const {
|
|
43
|
+
height
|
|
44
|
+
} = this.selector.getBoundingClientRect();
|
|
45
|
+
return height;
|
|
46
|
+
};
|
|
47
|
+
this.state = {
|
|
48
|
+
isShowSelectOptions: false
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
componentDidMount() {
|
|
52
|
+
document.addEventListener('click', this.onClick);
|
|
53
|
+
}
|
|
54
|
+
componentWillUnmount() {
|
|
55
|
+
document.removeEventListener('click', this.onClick);
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
let {
|
|
59
|
+
className,
|
|
60
|
+
value,
|
|
61
|
+
options,
|
|
62
|
+
placeholder,
|
|
63
|
+
searchable,
|
|
64
|
+
searchPlaceholder,
|
|
65
|
+
noOptionsPlaceholder,
|
|
66
|
+
isLocked
|
|
67
|
+
} = this.props;
|
|
68
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
ref: node => this.selector = node,
|
|
70
|
+
className: classnames('dtable-select custom-select', {
|
|
71
|
+
'focus': this.state.isShowSelectOptions
|
|
72
|
+
}, {
|
|
73
|
+
'disabled': isLocked
|
|
74
|
+
}, className),
|
|
75
|
+
onClick: this.onSelectToggle
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "selected-option"
|
|
78
|
+
}, value && value.label ? /*#__PURE__*/React.createElement("span", {
|
|
79
|
+
className: "selected-option-show"
|
|
80
|
+
}, value.label) : /*#__PURE__*/React.createElement("span", {
|
|
81
|
+
className: "select-placeholder"
|
|
82
|
+
}, placeholder), !isLocked && /*#__PURE__*/React.createElement("i", {
|
|
83
|
+
className: "dtable-font dtable-icon-drop-down"
|
|
84
|
+
})), this.state.isShowSelectOptions && /*#__PURE__*/React.createElement(OptGroup, {
|
|
85
|
+
value: value,
|
|
86
|
+
isShowSelected: this.props.isShowSelected,
|
|
87
|
+
top: this.getSelectedOptionTop(),
|
|
88
|
+
options: options,
|
|
89
|
+
onSelectOption: this.props.onSelectOption,
|
|
90
|
+
searchable: searchable,
|
|
91
|
+
searchPlaceholder: searchPlaceholder,
|
|
92
|
+
noOptionsPlaceholder: noOptionsPlaceholder,
|
|
93
|
+
closeSelect: this.closeSelect,
|
|
94
|
+
supportMultipleSelect: this.props.supportMultipleSelect
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export default Select;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { KeyCodes } from '../../../../../../../constants';
|
|
3
|
+
import Option from './option';
|
|
4
|
+
import EventBus from '../../../../../../utils/event-bus';
|
|
5
|
+
import { INTERNAL_EVENT } from '../../../../../../constants';
|
|
6
|
+
const OPTION_HEIGHT = 32;
|
|
7
|
+
class OptGroup extends Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.resetMenuStyle = () => {
|
|
11
|
+
const {
|
|
12
|
+
top,
|
|
13
|
+
height
|
|
14
|
+
} = this.optionGroupRef.getBoundingClientRect();
|
|
15
|
+
if (height + top > window.innerHeight) {
|
|
16
|
+
const borderWidth = 2;
|
|
17
|
+
this.optionGroupRef.style.top = -1 * (height + borderWidth) + 'px';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.onClick = e => {
|
|
21
|
+
if (this.props.stopClickEvent && this.optionGroupRef.contains(e.target) && !e.target.className.includes('dtable-font')) {
|
|
22
|
+
e.stopPropagation();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.onHotKey = e => {
|
|
26
|
+
const keyCode = e.keyCode;
|
|
27
|
+
if (keyCode === KeyCodes.UpArrow) {
|
|
28
|
+
this.onPressUp();
|
|
29
|
+
} else if (keyCode === KeyCodes.DownArrow) {
|
|
30
|
+
this.onPressDown();
|
|
31
|
+
} else if (keyCode === KeyCodes.Enter) {
|
|
32
|
+
this.onPressEnter();
|
|
33
|
+
} else if (keyCode === KeyCodes.Tab) {
|
|
34
|
+
this.props.closeSelect();
|
|
35
|
+
} else if (keyCode === KeyCodes.Escape) {
|
|
36
|
+
this.props.closeSelect();
|
|
37
|
+
const eventBus = EventBus.getInstance();
|
|
38
|
+
eventBus.dispatch(INTERNAL_EVENT.OPEN_SELECT, false);
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
this.onPressEnter = () => {
|
|
43
|
+
const {
|
|
44
|
+
options
|
|
45
|
+
} = this.props;
|
|
46
|
+
const {
|
|
47
|
+
activeIndex
|
|
48
|
+
} = this.state;
|
|
49
|
+
const option = options && options[activeIndex];
|
|
50
|
+
if (option) {
|
|
51
|
+
this.props.onSelectOption(option.value);
|
|
52
|
+
if (!this.props.supportMultipleSelect) {
|
|
53
|
+
this.props.closeSelect();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.onPressUp = () => {
|
|
58
|
+
if (this.state.activeIndex > 0) {
|
|
59
|
+
this.setState({
|
|
60
|
+
activeIndex: this.state.activeIndex - 1
|
|
61
|
+
}, () => {
|
|
62
|
+
this.scrollContent();
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
this.onPressDown = () => {
|
|
67
|
+
const {
|
|
68
|
+
options
|
|
69
|
+
} = this.props;
|
|
70
|
+
if (options && this.state.activeIndex < options.length - 1) {
|
|
71
|
+
this.setState({
|
|
72
|
+
activeIndex: this.state.activeIndex + 1
|
|
73
|
+
}, () => {
|
|
74
|
+
this.scrollContent();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.scrollContent = () => {
|
|
79
|
+
const {
|
|
80
|
+
offsetHeight,
|
|
81
|
+
scrollTop
|
|
82
|
+
} = this.optionGroupContentRef;
|
|
83
|
+
this.setState({
|
|
84
|
+
disableHover: true
|
|
85
|
+
});
|
|
86
|
+
this.timer = setTimeout(() => {
|
|
87
|
+
this.setState({
|
|
88
|
+
disableHover: false
|
|
89
|
+
});
|
|
90
|
+
}, 500);
|
|
91
|
+
if (this.state.activeIndex * OPTION_HEIGHT === 0) {
|
|
92
|
+
this.optionGroupContentRef.scrollTop = 0;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (this.state.activeIndex * OPTION_HEIGHT < scrollTop) {
|
|
96
|
+
this.optionGroupContentRef.scrollTop = scrollTop - OPTION_HEIGHT;
|
|
97
|
+
} else if (this.state.activeIndex * OPTION_HEIGHT > offsetHeight + scrollTop) {
|
|
98
|
+
this.optionGroupContentRef.scrollTop = scrollTop + OPTION_HEIGHT;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
this.changeIndex = index => {
|
|
102
|
+
this.setState({
|
|
103
|
+
activeIndex: index
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
this.onChangeSearch = e => {
|
|
107
|
+
let value = e.target.value;
|
|
108
|
+
if (value !== this.state.searchVal) {
|
|
109
|
+
this.setState({
|
|
110
|
+
searchVal: value,
|
|
111
|
+
activeIndex: -1
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
this.renderOptGroup = searchVal => {
|
|
116
|
+
const {
|
|
117
|
+
options,
|
|
118
|
+
searchable,
|
|
119
|
+
noOptionsPlaceholder,
|
|
120
|
+
onSelectOption
|
|
121
|
+
} = this.props;
|
|
122
|
+
let filterOptions = options || [];
|
|
123
|
+
if (searchable) {
|
|
124
|
+
let validSearchVal = searchVal.trim().toLowerCase();
|
|
125
|
+
if (validSearchVal) {
|
|
126
|
+
filterOptions = options.filter(option => {
|
|
127
|
+
const {
|
|
128
|
+
value,
|
|
129
|
+
name
|
|
130
|
+
} = option;
|
|
131
|
+
if (typeof name === 'string') {
|
|
132
|
+
return name.toLowerCase().indexOf(validSearchVal) > -1;
|
|
133
|
+
} else if (typeof value === 'object') {
|
|
134
|
+
if (value.column) {
|
|
135
|
+
return value.column.name.toLowerCase().indexOf(validSearchVal) > -1;
|
|
136
|
+
}
|
|
137
|
+
if (value.name) {
|
|
138
|
+
return value.name.toLowerCase().indexOf(validSearchVal) > -1;
|
|
139
|
+
}
|
|
140
|
+
return value.columnOption && value.columnOption.name.toLowerCase().indexOf(validSearchVal) > -1;
|
|
141
|
+
} else {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (filterOptions.length > 0) {
|
|
148
|
+
return filterOptions.map((opt, i) => {
|
|
149
|
+
let key = opt.value.column ? opt.value.column.key : i;
|
|
150
|
+
let isActive = this.state.activeIndex === i;
|
|
151
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
152
|
+
key: key,
|
|
153
|
+
index: i,
|
|
154
|
+
isActive: isActive,
|
|
155
|
+
value: opt.value,
|
|
156
|
+
onSelectOption: onSelectOption,
|
|
157
|
+
changeIndex: this.changeIndex,
|
|
158
|
+
supportMultipleSelect: this.props.supportMultipleSelect,
|
|
159
|
+
disableHover: this.state.disableHover
|
|
160
|
+
}, opt.label);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
164
|
+
className: "none-search-result"
|
|
165
|
+
}, noOptionsPlaceholder);
|
|
166
|
+
};
|
|
167
|
+
this.state = {
|
|
168
|
+
searchVal: '',
|
|
169
|
+
activeIndex: -1,
|
|
170
|
+
disableHover: false
|
|
171
|
+
};
|
|
172
|
+
this.timer = null;
|
|
173
|
+
}
|
|
174
|
+
componentDidMount() {
|
|
175
|
+
window.addEventListener('click', this.onClick, true);
|
|
176
|
+
document.addEventListener('keydown', this.onHotKey);
|
|
177
|
+
this.resetMenuStyle();
|
|
178
|
+
}
|
|
179
|
+
componentWillUnmount() {
|
|
180
|
+
window.removeEventListener('click', this.onClick, true);
|
|
181
|
+
document.removeEventListener('keydown', this.onHotKey);
|
|
182
|
+
this.timer && clearTimeout(this.timer);
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
const {
|
|
186
|
+
searchable,
|
|
187
|
+
searchPlaceholder,
|
|
188
|
+
top,
|
|
189
|
+
left,
|
|
190
|
+
minWidth,
|
|
191
|
+
value,
|
|
192
|
+
isShowSelected,
|
|
193
|
+
addOptionAble,
|
|
194
|
+
component
|
|
195
|
+
} = this.props;
|
|
196
|
+
const {
|
|
197
|
+
AddOption
|
|
198
|
+
} = component || {};
|
|
199
|
+
let {
|
|
200
|
+
searchVal
|
|
201
|
+
} = this.state;
|
|
202
|
+
let style = {
|
|
203
|
+
top: top || 0,
|
|
204
|
+
left: left || 0,
|
|
205
|
+
minHeight: 50
|
|
206
|
+
};
|
|
207
|
+
if (minWidth) {
|
|
208
|
+
style = {
|
|
209
|
+
top: top || 0,
|
|
210
|
+
left: left || 0,
|
|
211
|
+
minWidth
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: "option-group ".concat(isShowSelected ? 'pt-0' : '', " ").concat(addOptionAble ? 'create-new-option-group' : ''),
|
|
216
|
+
ref: ref => this.optionGroupRef = ref,
|
|
217
|
+
style: style
|
|
218
|
+
}, isShowSelected && /*#__PURE__*/React.createElement("div", {
|
|
219
|
+
className: "editor-list-delete mb-2",
|
|
220
|
+
onClick: e => e.stopPropagation()
|
|
221
|
+
}, value.label || ''), searchable && /*#__PURE__*/React.createElement("div", {
|
|
222
|
+
className: "option-group-search"
|
|
223
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
224
|
+
className: "form-control option-search-control",
|
|
225
|
+
type: "text",
|
|
226
|
+
placeholder: searchPlaceholder,
|
|
227
|
+
value: searchVal,
|
|
228
|
+
onChange: this.onChangeSearch,
|
|
229
|
+
autoFocus: true
|
|
230
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
231
|
+
className: "option-group-content",
|
|
232
|
+
ref: ref => this.optionGroupContentRef = ref
|
|
233
|
+
}, this.renderOptGroup(searchVal)), addOptionAble && AddOption);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
export default OptGroup;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
class Option extends Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.onClick = event => {
|
|
7
|
+
const {
|
|
8
|
+
value
|
|
9
|
+
} = this.props;
|
|
10
|
+
if (this.props.supportMultipleSelect) {
|
|
11
|
+
event.stopPropagation();
|
|
12
|
+
}
|
|
13
|
+
this.props.onSelectOption(value, event);
|
|
14
|
+
};
|
|
15
|
+
this.onMouseEnter = () => {
|
|
16
|
+
if (!this.props.disableHover) {
|
|
17
|
+
this.props.changeIndex(this.props.index);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
this.onMouseLeave = () => {
|
|
21
|
+
if (!this.props.disableHover) {
|
|
22
|
+
this.props.changeIndex(-1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const {
|
|
28
|
+
isActive
|
|
29
|
+
} = this.props;
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: classnames('option', {
|
|
32
|
+
'option-active': isActive
|
|
33
|
+
}),
|
|
34
|
+
onClick: this.onClick,
|
|
35
|
+
onMouseEnter: this.onMouseEnter,
|
|
36
|
+
onMouseLeave: this.onMouseLeave
|
|
37
|
+
}, this.props.children);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export default Option;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
.dtable-select {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.dtable-select.custom-select {
|
|
6
|
+
display: flex;
|
|
7
|
+
padding: 0 10px;
|
|
8
|
+
border-radius: 3px;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dtable-select.custom-select.focus {
|
|
14
|
+
border-color: #1991eb;
|
|
15
|
+
box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dtable-select.custom-select.focus:hover {
|
|
19
|
+
border-color: #1991eb;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dtable-select.custom-select:hover {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
border-color: rgb(179, 179, 179);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dtable-select .dtable-icon-drop-down:hover {
|
|
28
|
+
color: #000;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dtable-select.custom-select.disabled:focus,
|
|
32
|
+
.dtable-select.custom-select.focus.disabled,
|
|
33
|
+
.dtable-select.custom-select.disabled:hover {
|
|
34
|
+
border-color: rgba(0, 40, 100, 0.12) !important;
|
|
35
|
+
box-shadow: unset;
|
|
36
|
+
cursor: default;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.dtable-select .dtable-icon-drop-down {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
color: #b5b5b5 !important;
|
|
43
|
+
transform: scale(.8) translateY(2px);
|
|
44
|
+
transition: all .1s;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dtable-select .selected-option {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex: 1;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
flex-wrap: nowrap;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
background: #fff;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dtable-select .option-group {
|
|
58
|
+
position: absolute;
|
|
59
|
+
left: 0;
|
|
60
|
+
overflow-y: auto;
|
|
61
|
+
min-height: 60px;
|
|
62
|
+
max-height: 300px;
|
|
63
|
+
min-width: 100%;
|
|
64
|
+
max-width: 14rem;
|
|
65
|
+
padding: .5rem 0;
|
|
66
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
67
|
+
background: #fff;
|
|
68
|
+
border: 1px solid rgba(0, 40, 100, 0.12);
|
|
69
|
+
border-radius: 3px;
|
|
70
|
+
z-index: 10001;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.dtable-select .option-group .option-group-search {
|
|
74
|
+
width: 100%;
|
|
75
|
+
padding: 0 10px 6px 10px;
|
|
76
|
+
min-width: 170px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dtable-select .option-group-search .form-control {
|
|
80
|
+
height: 31px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.dtable-select .option-group .none-search-result {
|
|
84
|
+
height: 100px;
|
|
85
|
+
width: 100%;
|
|
86
|
+
padding: 10px;
|
|
87
|
+
opacity: .5;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dtable-select .option-group .option-group-content {
|
|
91
|
+
overflow-y: scroll;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dtable-select .option {
|
|
95
|
+
display: block;
|
|
96
|
+
width: 100%;
|
|
97
|
+
line-height: 24px;
|
|
98
|
+
padding: .25rem 10px;
|
|
99
|
+
clear: both;
|
|
100
|
+
font-weight: 400;
|
|
101
|
+
color: #212529;
|
|
102
|
+
text-align: inherit;
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
border: 0;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
text-overflow: ellipsis;
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.dtable-select .option-group-content .option.option-active {
|
|
112
|
+
background-color: #20a0ff;
|
|
113
|
+
color: #fff;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.dtable-select .option-group-content .option.option-active .dtable-font {
|
|
118
|
+
color: #fff;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.dtable-select .option:not(.option-active):hover .dtable-font {
|
|
122
|
+
color: #aaa;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.dtable-select .selected-option-show {
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
text-overflow: ellipsis;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.dtable-select .select-placeholder {
|
|
132
|
+
line-height: 1;
|
|
133
|
+
font-size: 14px;
|
|
134
|
+
color: #949494;
|
|
135
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import context from '../../../../../../context';
|
|
2
|
+
const zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
|
|
3
|
+
const zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
|
|
4
|
+
const enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
|
|
5
|
+
const frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
|
|
6
|
+
const deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
|
|
7
|
+
const esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
|
|
8
|
+
const plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
|
|
9
|
+
const csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
|
|
10
|
+
const ruRU = require('@seafile/seafile-calendar/lib/locale/ru_RU');
|
|
11
|
+
function translateCalendar() {
|
|
12
|
+
const lang = context.getSetting('lang');
|
|
13
|
+
const locale = lang ? lang : 'en';
|
|
14
|
+
let language;
|
|
15
|
+
switch (locale) {
|
|
16
|
+
case 'zh-cn':
|
|
17
|
+
language = zhCN;
|
|
18
|
+
break;
|
|
19
|
+
case 'zh-tw':
|
|
20
|
+
language = zhTW;
|
|
21
|
+
break;
|
|
22
|
+
case 'en':
|
|
23
|
+
language = enUS;
|
|
24
|
+
break;
|
|
25
|
+
case 'fr':
|
|
26
|
+
language = frFR;
|
|
27
|
+
break;
|
|
28
|
+
case 'de':
|
|
29
|
+
language = deDE;
|
|
30
|
+
break;
|
|
31
|
+
case 'es':
|
|
32
|
+
language = esES;
|
|
33
|
+
break;
|
|
34
|
+
case 'es-ar':
|
|
35
|
+
language = esES;
|
|
36
|
+
break;
|
|
37
|
+
case 'es-mx':
|
|
38
|
+
language = esES;
|
|
39
|
+
break;
|
|
40
|
+
case 'pl':
|
|
41
|
+
language = plPL;
|
|
42
|
+
break;
|
|
43
|
+
case 'cs':
|
|
44
|
+
language = csCZ;
|
|
45
|
+
break;
|
|
46
|
+
case 'ru':
|
|
47
|
+
language = ruRU;
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
language = enUS;
|
|
51
|
+
}
|
|
52
|
+
return language;
|
|
53
|
+
}
|
|
54
|
+
export { translateCalendar };
|