@seafile/seafile-editor 0.3.113 → 0.3.114
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/assets/css/topbar.css +6 -0
- package/dist/components/error-boundary.js +35 -0
- package/dist/components/menu/index.js +4 -0
- package/dist/components/menu/item.js +60 -0
- package/dist/components/menu/menu.js +49 -0
- package/dist/components/menu/style.css +41 -0
- package/dist/components/select/_option.js +56 -0
- package/dist/components/select/field-setting.js +125 -0
- package/dist/components/select/index.js +136 -0
- package/dist/components/select/style.css +152 -0
- package/dist/components/svg-icons/check-mark-icon.js +16 -0
- package/dist/components/svg-icons/column-icon.js +19 -0
- package/dist/components/svg-icons/text-icon.js +33 -0
- package/dist/components/toolbar/toolbar.js +38 -24
- package/dist/components/toolbar/widgets/button-item.js +6 -2
- package/dist/constants/cell-types.js +28 -0
- package/dist/constants/column.js +6 -0
- package/dist/editor/controller/inline-element-controller.js +20 -1
- package/dist/editor/controller/shortcut-controller.js +30 -9
- package/dist/editor/controller/void-element-controller.js +1 -1
- package/dist/editor/editor-builder.js +8 -0
- package/dist/editor/editor-component/column.js +124 -0
- package/dist/editor/editor-utils/common-editor-utils.js +19 -1
- package/dist/editor/editor-utils/inline-element-utils/index.js +19 -0
- package/dist/editor/element-model/column.js +22 -0
- package/dist/editor/index.js +2 -1
- package/dist/editor/seatable-editor.js +232 -0
- package/dist/index.js +4 -2
- package/dist/utils/render-slate.js +5 -0
- package/dist/utils/utils.js +32 -0
- package/dist/viewer/seatable-viewer.js +74 -0
- package/package.json +3 -2
- package/public/locales/en/seafile-editor.json +3 -1
- package/dist/components/table-button.js +0 -155
- package/dist/components/topbar-component/editor-toolbar.js +0 -545
- package/dist/components/topbar-component/file-info.js +0 -65
|
@@ -0,0 +1,35 @@
|
|
|
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, { Children } from 'react';
|
|
6
|
+
|
|
7
|
+
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inherits(ErrorBoundary, _React$Component);
|
|
9
|
+
|
|
10
|
+
var _super = _createSuper(ErrorBoundary);
|
|
11
|
+
|
|
12
|
+
function ErrorBoundary() {
|
|
13
|
+
_classCallCheck(this, ErrorBoundary);
|
|
14
|
+
|
|
15
|
+
return _super.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
_createClass(ErrorBoundary, [{
|
|
19
|
+
key: "componentDidCatch",
|
|
20
|
+
value: function componentDidCatch(error) {
|
|
21
|
+
console.error(error);
|
|
22
|
+
this.forceUpdate();
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
key: "render",
|
|
26
|
+
value: function render() {
|
|
27
|
+
var children = this.props.children;
|
|
28
|
+
return children;
|
|
29
|
+
}
|
|
30
|
+
}]);
|
|
31
|
+
|
|
32
|
+
return ErrorBoundary;
|
|
33
|
+
}(React.Component);
|
|
34
|
+
|
|
35
|
+
export default ErrorBoundary;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 from 'react';
|
|
6
|
+
import CheckMarkIcon from '../svg-icons/check-mark-icon';
|
|
7
|
+
import './style.css';
|
|
8
|
+
|
|
9
|
+
var MenuItem = /*#__PURE__*/function (_React$Component) {
|
|
10
|
+
_inherits(MenuItem, _React$Component);
|
|
11
|
+
|
|
12
|
+
var _super = _createSuper(MenuItem);
|
|
13
|
+
|
|
14
|
+
function MenuItem() {
|
|
15
|
+
var _this;
|
|
16
|
+
|
|
17
|
+
_classCallCheck(this, MenuItem);
|
|
18
|
+
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
+
|
|
25
|
+
_this.onClick = function (e) {
|
|
26
|
+
_this.props.onClick(e);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_createClass(MenuItem, [{
|
|
33
|
+
key: "render",
|
|
34
|
+
value: function render() {
|
|
35
|
+
var _this$props = this.props,
|
|
36
|
+
children = _this$props.children,
|
|
37
|
+
itemClass = _this$props.itemClass,
|
|
38
|
+
iconClass = _this$props.iconClass,
|
|
39
|
+
isChecked = _this$props.isChecked;
|
|
40
|
+
var containerClass = "seafile-menu-item ".concat(itemClass || '');
|
|
41
|
+
var itemIconClass = "item-icon ".concat(iconClass || '');
|
|
42
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
className: containerClass,
|
|
44
|
+
onClick: this.onClick
|
|
45
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
46
|
+
className: itemIconClass
|
|
47
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
className: "item-name"
|
|
49
|
+
}, children), isChecked && /*#__PURE__*/React.createElement(CheckMarkIcon, {
|
|
50
|
+
className: "checked-icon",
|
|
51
|
+
width: 13,
|
|
52
|
+
color: "#aaa"
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
}]);
|
|
56
|
+
|
|
57
|
+
return MenuItem;
|
|
58
|
+
}(React.Component);
|
|
59
|
+
|
|
60
|
+
export default MenuItem;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 from 'react';
|
|
6
|
+
|
|
7
|
+
var Menu = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inherits(Menu, _React$Component);
|
|
9
|
+
|
|
10
|
+
var _super = _createSuper(Menu);
|
|
11
|
+
|
|
12
|
+
function Menu() {
|
|
13
|
+
var _this;
|
|
14
|
+
|
|
15
|
+
_classCallCheck(this, Menu);
|
|
16
|
+
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
+
|
|
23
|
+
_this.getStyle = function () {
|
|
24
|
+
var position = _this.props.position;
|
|
25
|
+
var width = position.width;
|
|
26
|
+
return {
|
|
27
|
+
marginLeft: width - 10,
|
|
28
|
+
marginTop: '30px'
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return _this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_createClass(Menu, [{
|
|
36
|
+
key: "render",
|
|
37
|
+
value: function render() {
|
|
38
|
+
var style = this.getStyle();
|
|
39
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
40
|
+
className: "seafile-menu-container",
|
|
41
|
+
style: style
|
|
42
|
+
}, this.props.children);
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
|
|
46
|
+
return Menu;
|
|
47
|
+
}(React.Component);
|
|
48
|
+
|
|
49
|
+
export default Menu;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.seafile-menu-container {
|
|
2
|
+
position: fixed;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 150px;
|
|
6
|
+
padding: 8px 0;
|
|
7
|
+
min-width: 80px;
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
overflow-x: hidden;
|
|
10
|
+
border: 1px solid #e5e5e5;
|
|
11
|
+
box-shadow: 0 4px 10px #eee;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
background: #fff;
|
|
14
|
+
z-index: 1080;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.seafile-menu-container .seafile-menu-item {
|
|
18
|
+
height: 32px;
|
|
19
|
+
line-height: 32px;
|
|
20
|
+
display: flex;
|
|
21
|
+
padding: 0 10px;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.seafile-menu-container .seafile-menu-item:hover {
|
|
27
|
+
background-color: #DEEBFF;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.seafile-menu-container .seafile-menu-item .item-icon {
|
|
31
|
+
margin-right: 5px;
|
|
32
|
+
color: #aaa;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.seafile-menu-container .seafile-menu-item .checked-icon {
|
|
36
|
+
position: absolute;
|
|
37
|
+
right: 10px;
|
|
38
|
+
height: 32px;
|
|
39
|
+
line-height: 32px;
|
|
40
|
+
color: #aaa;
|
|
41
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 from 'react';
|
|
6
|
+
|
|
7
|
+
var Option = /*#__PURE__*/function (_React$Component) {
|
|
8
|
+
_inherits(Option, _React$Component);
|
|
9
|
+
|
|
10
|
+
var _super = _createSuper(Option);
|
|
11
|
+
|
|
12
|
+
function Option() {
|
|
13
|
+
var _this;
|
|
14
|
+
|
|
15
|
+
_classCallCheck(this, Option);
|
|
16
|
+
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
+
|
|
23
|
+
_this.onClick = function (event) {
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
26
|
+
var option = _this.props.option;
|
|
27
|
+
|
|
28
|
+
_this.props.onOptionChanged(option);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_createClass(Option, [{
|
|
35
|
+
key: "render",
|
|
36
|
+
value: function render() {
|
|
37
|
+
var _this$props = this.props,
|
|
38
|
+
option = _this$props.option,
|
|
39
|
+
isActive = _this$props.isActive,
|
|
40
|
+
optionClass = _this$props.optionClass;
|
|
41
|
+
var className = "option-item ".concat(optionClass || '', " ").concat(isActive ? 'active' : '');
|
|
42
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
className: className,
|
|
44
|
+
onClick: this.onClick
|
|
45
|
+
}, option.iconClass && /*#__PURE__*/React.createElement("span", {
|
|
46
|
+
className: "item-icon ".concat(option.iconClass)
|
|
47
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
48
|
+
className: "label"
|
|
49
|
+
}, option.label));
|
|
50
|
+
}
|
|
51
|
+
}]);
|
|
52
|
+
|
|
53
|
+
return Option;
|
|
54
|
+
}(React.Component);
|
|
55
|
+
|
|
56
|
+
export default Option;
|
|
@@ -0,0 +1,125 @@
|
|
|
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 Menu from '../menu';
|
|
8
|
+
import { withTranslation } from 'react-i18next';
|
|
9
|
+
import TextIcon from '../svg-icons/text-icon';
|
|
10
|
+
|
|
11
|
+
var FieldSetting = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(FieldSetting, _React$Component);
|
|
13
|
+
|
|
14
|
+
var _super = _createSuper(FieldSetting);
|
|
15
|
+
|
|
16
|
+
function FieldSetting(props) {
|
|
17
|
+
var _this;
|
|
18
|
+
|
|
19
|
+
_classCallCheck(this, FieldSetting);
|
|
20
|
+
|
|
21
|
+
_this = _super.call(this, props);
|
|
22
|
+
|
|
23
|
+
_this.onMouseEnter = function () {
|
|
24
|
+
if (!_this.props.option) return;
|
|
25
|
+
var container = _this.settingRef;
|
|
26
|
+
|
|
27
|
+
var _container$getBoundin = container.getBoundingClientRect(),
|
|
28
|
+
height = _container$getBoundin.height,
|
|
29
|
+
width = _container$getBoundin.width;
|
|
30
|
+
|
|
31
|
+
var position = {
|
|
32
|
+
height: height,
|
|
33
|
+
width: width
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
_this.setState({
|
|
37
|
+
isShowMenu: true,
|
|
38
|
+
position: position
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
_this.onMouseLeave = function () {
|
|
43
|
+
_this.setState({
|
|
44
|
+
isShowMenu: false
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
_this.onBoldClick = function () {
|
|
49
|
+
var option = _this.props.option;
|
|
50
|
+
|
|
51
|
+
var newOption = _objectSpread(_objectSpread({}, option), {}, {
|
|
52
|
+
bold: !option.bold
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
_this.props.onUpdateOption(newOption);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
_this.onItalicClick = function () {
|
|
59
|
+
var option = _this.props.option;
|
|
60
|
+
|
|
61
|
+
var newOption = _objectSpread(_objectSpread({}, option), {}, {
|
|
62
|
+
italic: !option.italic
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
_this.props.onUpdateOption(newOption);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
_this.setSettingRef = function (ref) {
|
|
69
|
+
_this.settingRef = ref;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
_this.state = {
|
|
73
|
+
isShowMenu: false,
|
|
74
|
+
position: {
|
|
75
|
+
top: 0,
|
|
76
|
+
left: 0
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_createClass(FieldSetting, [{
|
|
83
|
+
key: "render",
|
|
84
|
+
value: function render() {
|
|
85
|
+
var _this$props = this.props,
|
|
86
|
+
option = _this$props.option,
|
|
87
|
+
t = _this$props.t;
|
|
88
|
+
var isDisable = !option;
|
|
89
|
+
|
|
90
|
+
var _ref = option || {},
|
|
91
|
+
isBold = _ref.bold,
|
|
92
|
+
isItalic = _ref.italic;
|
|
93
|
+
|
|
94
|
+
var className = "option-item ".concat(isDisable ? 'disable' : '', " field-setting");
|
|
95
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
ref: this.setSettingRef,
|
|
97
|
+
className: className,
|
|
98
|
+
onMouseEnter: this.onMouseEnter,
|
|
99
|
+
onMouseLeave: this.onMouseLeave
|
|
100
|
+
}, /*#__PURE__*/React.createElement(TextIcon, {
|
|
101
|
+
width: "14"
|
|
102
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
103
|
+
className: "label"
|
|
104
|
+
}, t('Field_style_adjustment')), /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: "icon-container"
|
|
106
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
107
|
+
className: "iconfont icon-caret-up op-icon"
|
|
108
|
+
})), this.state.isShowMenu && /*#__PURE__*/React.createElement(Menu, {
|
|
109
|
+
position: this.state.position
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
111
|
+
iconClass: 'iconfont icon-bold',
|
|
112
|
+
isChecked: isBold,
|
|
113
|
+
onClick: this.onBoldClick
|
|
114
|
+
}, t('bold')), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
115
|
+
iconClass: 'iconfont icon-italic',
|
|
116
|
+
isChecked: isItalic,
|
|
117
|
+
onClick: this.onItalicClick
|
|
118
|
+
}, t('italic'))));
|
|
119
|
+
}
|
|
120
|
+
}]);
|
|
121
|
+
|
|
122
|
+
return FieldSetting;
|
|
123
|
+
}(React.Component);
|
|
124
|
+
|
|
125
|
+
export default withTranslation('seafile-editor')(FieldSetting);
|
|
@@ -0,0 +1,136 @@
|
|
|
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 from 'react';
|
|
6
|
+
import Option from './_option';
|
|
7
|
+
import FieldSetting from './field-setting';
|
|
8
|
+
import './style.css';
|
|
9
|
+
|
|
10
|
+
var Select = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(Select, _React$Component);
|
|
12
|
+
|
|
13
|
+
var _super = _createSuper(Select);
|
|
14
|
+
|
|
15
|
+
function Select(props) {
|
|
16
|
+
var _this;
|
|
17
|
+
|
|
18
|
+
_classCallCheck(this, Select);
|
|
19
|
+
|
|
20
|
+
_this = _super.call(this, props);
|
|
21
|
+
|
|
22
|
+
_this.componentDidMount = function () {
|
|
23
|
+
document.addEventListener('click', _this.handleSelector);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
_this.componentWillUnmount = function () {
|
|
27
|
+
document.removeEventListener('click', _this.handleSelector);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
_this.handleSelector = function (event) {
|
|
31
|
+
if (_this.selector && !_this.selector.contains(event.target)) {
|
|
32
|
+
_this.setState({
|
|
33
|
+
isShowSelector: false
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
_this.getCurrentOption = function () {
|
|
39
|
+
var _this$props = _this.props,
|
|
40
|
+
value = _this$props.value,
|
|
41
|
+
options = _this$props.options;
|
|
42
|
+
var currentOption = value && options.find(function (option) {
|
|
43
|
+
return option.value === value.value;
|
|
44
|
+
});
|
|
45
|
+
return currentOption;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
_this.onSelectToggle = function (event) {
|
|
49
|
+
_this.setState({
|
|
50
|
+
isShowSelector: !_this.state.isShowSelector
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
_this.onChange = function (option) {
|
|
55
|
+
_this.setState({
|
|
56
|
+
isShowSelector: false,
|
|
57
|
+
currentOption: option
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
_this.props.onChange(option);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_this.onUpdateOption = function (option) {
|
|
64
|
+
_this.setState({
|
|
65
|
+
currentOption: option
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
_this.props.onChange(option);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
_this.setSelectorRef = function (ref) {
|
|
72
|
+
_this.selector = ref;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
_this.state = {
|
|
76
|
+
isShowSelector: false,
|
|
77
|
+
currentOption: _this.getCurrentOption()
|
|
78
|
+
};
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_createClass(Select, [{
|
|
83
|
+
key: "render",
|
|
84
|
+
value: function render() {
|
|
85
|
+
var _this2 = this;
|
|
86
|
+
|
|
87
|
+
var _this$props2 = this.props,
|
|
88
|
+
selectClass = _this$props2.selectClass,
|
|
89
|
+
optionClass = _this$props2.optionClass,
|
|
90
|
+
isSelected = _this$props2.isSelected,
|
|
91
|
+
options = _this$props2.options,
|
|
92
|
+
placeholder = _this$props2.placeholder;
|
|
93
|
+
var _this$state = this.state,
|
|
94
|
+
currentOption = _this$state.currentOption,
|
|
95
|
+
isShowSelector = _this$state.isShowSelector;
|
|
96
|
+
var isActive = isShowSelector || isSelected;
|
|
97
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
98
|
+
ref: this.setSelectorRef,
|
|
99
|
+
className: "select-container ".concat(selectClass || '')
|
|
100
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
className: "control-container ".concat(isActive ? 'active' : ''),
|
|
102
|
+
onClick: this.onSelectToggle
|
|
103
|
+
}, !currentOption && /*#__PURE__*/React.createElement("span", {
|
|
104
|
+
className: "label placeholder"
|
|
105
|
+
}, placeholder), currentOption && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
106
|
+
className: "control-icon ".concat(currentOption.iconClass)
|
|
107
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
108
|
+
className: "control-label"
|
|
109
|
+
}, currentOption.label)), /*#__PURE__*/React.createElement("span", {
|
|
110
|
+
className: "operation"
|
|
111
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
112
|
+
className: "iconfont ".concat(isShowSelector ? 'icon-caret-up' : 'icon-drop-down', " arrow")
|
|
113
|
+
}))), isShowSelector && /*#__PURE__*/React.createElement("span", {
|
|
114
|
+
className: "value-container"
|
|
115
|
+
}, /*#__PURE__*/React.createElement(FieldSetting, {
|
|
116
|
+
option: currentOption,
|
|
117
|
+
onUpdateOption: this.onUpdateOption
|
|
118
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
119
|
+
className: "option-item-divider"
|
|
120
|
+
}), options.map(function (option) {
|
|
121
|
+
var isActive = option.value === (currentOption && currentOption.value);
|
|
122
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
123
|
+
key: option.value,
|
|
124
|
+
optionClass: optionClass,
|
|
125
|
+
isActive: isActive,
|
|
126
|
+
option: option,
|
|
127
|
+
onOptionChanged: _this2.onChange
|
|
128
|
+
});
|
|
129
|
+
})));
|
|
130
|
+
}
|
|
131
|
+
}]);
|
|
132
|
+
|
|
133
|
+
return Select;
|
|
134
|
+
}(React.Component);
|
|
135
|
+
|
|
136
|
+
export default Select;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
.select-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
margin: 0 5px;
|
|
5
|
+
font-weight: normal;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.select-container .control-container {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
border: 1px solid #ccc;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
padding: 0 10px;
|
|
15
|
+
height: 24px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
line-height: 1.5;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.select-container .control-container.active,
|
|
23
|
+
.select-container .control-container:hover {
|
|
24
|
+
border: 1px solid #3C88FD;
|
|
25
|
+
box-shadow: 0 0 0 2px rgb(70 127 207 / 25%);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.select-container .control-container .placeholder {
|
|
29
|
+
color: #BFBFBF;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.select-container .control-container .control-icon {
|
|
33
|
+
font-size: 13px;
|
|
34
|
+
color: rgb(170, 170, 170);
|
|
35
|
+
cursor: default;
|
|
36
|
+
margin-right: 5px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.select-container .control-container .operation {
|
|
40
|
+
margin-left: 8px;
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.select-container .control-container .arrow {
|
|
47
|
+
color: #949494;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
transform: scale(.8);
|
|
51
|
+
transition: all .1s;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.select-container .control-container .arrow:hover {
|
|
55
|
+
color: #666;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.select-container .value-container {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 0;
|
|
61
|
+
display: flex;
|
|
62
|
+
min-width: 80px;
|
|
63
|
+
max-height: 150px;
|
|
64
|
+
overflow-x: hidden;
|
|
65
|
+
overflow-y: auto;
|
|
66
|
+
margin-top: 4px;
|
|
67
|
+
padding: 8px 0;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
border: 1px solid #e5e5e5;
|
|
70
|
+
box-shadow: 0 4px 10px #eee;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
background: #fff;
|
|
73
|
+
z-index: 10;
|
|
74
|
+
scrollbar-width: none;
|
|
75
|
+
-ms-overflow-style: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.select-container .value-container::-webkit-scrollbar {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.select-container .value-container .option-item {
|
|
83
|
+
flex-shrink: 0;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
min-width: 80px;
|
|
87
|
+
height: 32px;
|
|
88
|
+
padding: 0 12px;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
overflow-wrap: normal;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.select-container .value-container .option-item:hover {
|
|
95
|
+
background-color: #DEEBFF;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.select-container .value-container .option-item.active {
|
|
99
|
+
background-color: #39A0FF;
|
|
100
|
+
color: #fff;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.select-container .value-container .option-item.disable {
|
|
104
|
+
color: #aaa;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.select-container .value-container .option-item .item-icon {
|
|
108
|
+
font-size: 14px;
|
|
109
|
+
color: rgb(170, 170, 170);
|
|
110
|
+
cursor: default;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.select-container .value-container .option-item.active .item-icon {
|
|
114
|
+
color: #fff;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.select-container .value-container .option-item .label {
|
|
118
|
+
margin-left: 5px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.option-item.field-setting {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: space-between;
|
|
125
|
+
position: relative;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.option-item.field-setting .icon-container {
|
|
129
|
+
width: 32px;
|
|
130
|
+
height: 32px;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.option-item.field-setting .op-icon {
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
transform: rotate(90deg);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.option-item.field-setting:not(.disable) .op-icon {
|
|
142
|
+
color: #949494;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.option-item.field-setting:not(.disable) .op-icon:hover {
|
|
146
|
+
color: #666;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.value-container .option-item-divider {
|
|
150
|
+
margin-top: 8px;
|
|
151
|
+
border-top: 1px solid #EFEFEF;
|
|
152
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
var CheckMarkIcon = function CheckMarkIcon(props) {
|
|
4
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
5
|
+
className: "icon",
|
|
6
|
+
viewBox: "0 0 1024 1024",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
9
|
+
d: "M390.4 870.4c-41.6 0-86.4-16-112-48l-256-268.8c-35.2-32-25.6-89.6 16-121.6 35.2-25.6 86.4-25.6 118.4 9.6L387.2 688l480-499.2c35.2-32 92.8-32 128 9.6 35.2 32 35.2 83.2 9.6 115.2L499.2 819.2c-25.6 35.2-67.2 51.2-108.8 51.2z",
|
|
10
|
+
style: {
|
|
11
|
+
fill: props.color
|
|
12
|
+
}
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default CheckMarkIcon;
|