dtable-ui-component 7.0.0-ahn.1 → 7.0.0-iam.4
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/lib/AsyncUserSelect/index.css +18 -36
- package/lib/AsyncUserSelect/index.js +18 -29
- package/lib/DTableCustomizeCollaboratorSelect/index.css +86 -0
- package/lib/DTableCustomizeCollaboratorSelect/index.js +158 -0
- package/lib/DTableCustomizeSelect/index.css +42 -120
- package/lib/DTableCustomizeSelect/index.js +4 -9
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +19 -7
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +9 -5
- package/lib/DTableFiltersPopover/widgets/filter-item.js +7 -15
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +3 -3
- package/lib/DTableGroupSelect/index.css +96 -0
- package/lib/DTableGroupSelect/index.js +131 -0
- package/lib/DTableGroupSelect/option.js +42 -0
- package/lib/DTableGroupSelect/select-option-group.css +54 -0
- package/lib/DTableGroupSelect/select-option-group.js +227 -0
- package/lib/DTableSelect/dtable-select-label.css +4 -4
- package/lib/DTableSelect/dtable-select-label.js +1 -1
- package/lib/DTableSelect/index.js +3 -3
- package/lib/DTableSelect/user-select.css +46 -7
- package/lib/DTableSelect/utils.js +79 -165
- package/lib/ImagePreviewerLightbox/index.js +10 -5
- package/lib/SelectOptionGroup/KeyCodes.js +4 -96
- package/lib/SelectOptionGroup/index.css +52 -74
- package/lib/SelectOptionGroup/index.js +26 -35
- package/lib/SelectOptionGroup/option.js +4 -16
- package/lib/index.js +10 -3
- package/package.json +1 -1
- package/lib/DTableCustomizeSearchInput/index.css +0 -81
- package/lib/DTableCustomizeSearchInput/index.js +0 -136
- package/lib/DTableSelect/select-dropdown-indicator/index.css +0 -16
- package/lib/DTableSelect/select-dropdown-indicator/index.js +0 -24
- package/lib/assets/icons/close.svg +0 -1
- package/lib/assets/icons/down.svg +0 -3
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
|
|
12
|
+
var _option = _interopRequireDefault(require("./option"));
|
|
13
|
+
var _KeyCodes = _interopRequireDefault(require("../SelectOptionGroup/KeyCodes"));
|
|
14
|
+
require("./select-option-group.css");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const OPTION_HEIGHT = 32;
|
|
17
|
+
class SelectOptionGroup extends _react.Component {
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.handleDocumentClick = e => {
|
|
21
|
+
this.props.onClickOutside(e);
|
|
22
|
+
};
|
|
23
|
+
this.resetMenuStyle = () => {
|
|
24
|
+
const _this$props = this.props,
|
|
25
|
+
isInModal = _this$props.isInModal,
|
|
26
|
+
position = _this$props.position;
|
|
27
|
+
const _this$optionGroupRef$ = this.optionGroupRef.getBoundingClientRect(),
|
|
28
|
+
top = _this$optionGroupRef$.top,
|
|
29
|
+
height = _this$optionGroupRef$.height;
|
|
30
|
+
if (isInModal) {
|
|
31
|
+
if (position.y + position.height + height > window.innerHeight) {
|
|
32
|
+
this.optionGroupRef.style.top = position.y - height + 'px';
|
|
33
|
+
}
|
|
34
|
+
this.optionGroupRef.style.opacity = 1;
|
|
35
|
+
this.searchInputRef.current && this.searchInputRef.current.inputRef.focus();
|
|
36
|
+
} else {
|
|
37
|
+
if (height + top > window.innerHeight) {
|
|
38
|
+
const borderWidth = 2;
|
|
39
|
+
this.optionGroupRef.style.top = -1 * (height + borderWidth) + 'px';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.onHotKey = event => {
|
|
44
|
+
const keyCode = event.keyCode;
|
|
45
|
+
if (keyCode === _KeyCodes.default.UpArrow) {
|
|
46
|
+
this.onPressUp();
|
|
47
|
+
} else if (keyCode === _KeyCodes.default.DownArrow) {
|
|
48
|
+
this.onPressDown();
|
|
49
|
+
} else if (keyCode === _KeyCodes.default.Enter) {
|
|
50
|
+
let option = this.filterOptions && this.filterOptions[this.state.activeIndex];
|
|
51
|
+
if (option) {
|
|
52
|
+
this.props.onSelectOption(option);
|
|
53
|
+
}
|
|
54
|
+
} else if (keyCode === _KeyCodes.default.Tab || keyCode === _KeyCodes.default.Escape) {
|
|
55
|
+
this.props.closeSelect();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.onPressUp = () => {
|
|
59
|
+
if (this.state.activeIndex > 0) {
|
|
60
|
+
this.setState({
|
|
61
|
+
activeIndex: this.state.activeIndex - 1
|
|
62
|
+
}, () => {
|
|
63
|
+
this.scrollContent();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
this.onPressDown = () => {
|
|
68
|
+
if (this.filterOptions && this.state.activeIndex < this.filterOptions.length - 1) {
|
|
69
|
+
this.setState({
|
|
70
|
+
activeIndex: this.state.activeIndex + 1
|
|
71
|
+
}, () => {
|
|
72
|
+
this.scrollContent();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
this.onMouseDown = e => {
|
|
77
|
+
const isInModal = this.props.isInModal;
|
|
78
|
+
// prevent event propagation when click option or search input
|
|
79
|
+
if (isInModal) {
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
this.scrollContent = () => {
|
|
85
|
+
const _this$optionGroupCont = this.optionGroupContentRef,
|
|
86
|
+
offsetHeight = _this$optionGroupCont.offsetHeight,
|
|
87
|
+
scrollTop = _this$optionGroupCont.scrollTop;
|
|
88
|
+
this.setState({
|
|
89
|
+
disableHover: true
|
|
90
|
+
});
|
|
91
|
+
this.timer = setTimeout(() => {
|
|
92
|
+
this.setState({
|
|
93
|
+
disableHover: false
|
|
94
|
+
});
|
|
95
|
+
}, 500);
|
|
96
|
+
if (this.state.activeIndex * OPTION_HEIGHT === 0) {
|
|
97
|
+
this.optionGroupContentRef.scrollTop = 0;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (this.state.activeIndex * OPTION_HEIGHT < scrollTop) {
|
|
101
|
+
this.optionGroupContentRef.scrollTop = scrollTop - OPTION_HEIGHT;
|
|
102
|
+
} else if (this.state.activeIndex * OPTION_HEIGHT > offsetHeight + scrollTop) {
|
|
103
|
+
this.optionGroupContentRef.scrollTop = scrollTop + OPTION_HEIGHT;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
this.changeIndex = index => {
|
|
107
|
+
this.setState({
|
|
108
|
+
activeIndex: index
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
this.onChangeSearch = searchVal => {
|
|
112
|
+
this.setState({
|
|
113
|
+
searchVal: searchVal || '',
|
|
114
|
+
activeIndex: -1
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
this.clearValue = () => {
|
|
118
|
+
this.setState({
|
|
119
|
+
searchVal: '',
|
|
120
|
+
activeIndex: -1
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this.renderOptGroup = searchVal => {
|
|
124
|
+
let _this$props2 = this.props,
|
|
125
|
+
noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
|
|
126
|
+
onSelectOption = _this$props2.onSelectOption,
|
|
127
|
+
selectedOptions = _this$props2.selectedOptions;
|
|
128
|
+
this.filterOptions = this.props.getFilterOptions(searchVal);
|
|
129
|
+
if (this.filterOptions.length === 0) {
|
|
130
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
131
|
+
className: "none-search-result",
|
|
132
|
+
children: noOptionsPlaceholder
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return this.filterOptions.map((option, index) => {
|
|
136
|
+
const isSelected = selectedOptions.some(item => item.id === option.id);
|
|
137
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_option.default, {
|
|
138
|
+
index: index,
|
|
139
|
+
isActive: this.state.activeIndex === index,
|
|
140
|
+
option: option,
|
|
141
|
+
onSelectOption: onSelectOption,
|
|
142
|
+
changeIndex: this.changeIndex,
|
|
143
|
+
disableHover: this.state.disableHover,
|
|
144
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
145
|
+
className: "option-label text-truncate",
|
|
146
|
+
title: option.label,
|
|
147
|
+
children: option.label
|
|
148
|
+
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
149
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
150
|
+
})]
|
|
151
|
+
}, "".concat(option.id, "-").concat(index));
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
this.state = {
|
|
155
|
+
searchVal: '',
|
|
156
|
+
activeIndex: -1,
|
|
157
|
+
disableHover: false
|
|
158
|
+
};
|
|
159
|
+
this.filterOptions = null;
|
|
160
|
+
this.timer = null;
|
|
161
|
+
this.searchInputRef = /*#__PURE__*/_react.default.createRef();
|
|
162
|
+
}
|
|
163
|
+
componentDidMount() {
|
|
164
|
+
window.addEventListener('keydown', this.onHotKey);
|
|
165
|
+
document.addEventListener('mousedown', this.handleDocumentClick);
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
this.resetMenuStyle();
|
|
168
|
+
}, 1);
|
|
169
|
+
}
|
|
170
|
+
componentWillUnmount() {
|
|
171
|
+
this.filterOptions = null;
|
|
172
|
+
this.timer && clearTimeout(this.timer);
|
|
173
|
+
window.removeEventListener('keydown', this.onHotKey);
|
|
174
|
+
document.removeEventListener('mousedown', this.handleDocumentClick);
|
|
175
|
+
}
|
|
176
|
+
render() {
|
|
177
|
+
const _this$props3 = this.props,
|
|
178
|
+
searchPlaceholder = _this$props3.searchPlaceholder,
|
|
179
|
+
top = _this$props3.top,
|
|
180
|
+
left = _this$props3.left,
|
|
181
|
+
minWidth = _this$props3.minWidth,
|
|
182
|
+
isInModal = _this$props3.isInModal,
|
|
183
|
+
position = _this$props3.position,
|
|
184
|
+
className = _this$props3.className;
|
|
185
|
+
let searchVal = this.state.searchVal;
|
|
186
|
+
let style = {
|
|
187
|
+
top: top || 0,
|
|
188
|
+
left: left || 0
|
|
189
|
+
};
|
|
190
|
+
if (minWidth) {
|
|
191
|
+
style = {
|
|
192
|
+
top: top || 0,
|
|
193
|
+
left: left || 0,
|
|
194
|
+
minWidth
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
if (isInModal) {
|
|
198
|
+
style = {
|
|
199
|
+
position: 'fixed',
|
|
200
|
+
left: position.x,
|
|
201
|
+
top: position.y + position.height,
|
|
202
|
+
minWidth: position.width,
|
|
203
|
+
opacity: 0
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
207
|
+
className: (0, _classnames.default)('option-group group-selector', className ? 'option-group-' + className : ''),
|
|
208
|
+
ref: ref => this.optionGroupRef = ref,
|
|
209
|
+
style: style,
|
|
210
|
+
onMouseDown: this.onMouseDown,
|
|
211
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
212
|
+
className: "option-group-search position-relative",
|
|
213
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableSearchInput.default, {
|
|
214
|
+
className: "option-search-control",
|
|
215
|
+
placeholder: searchPlaceholder,
|
|
216
|
+
onChange: this.onChangeSearch,
|
|
217
|
+
ref: this.searchInputRef
|
|
218
|
+
})
|
|
219
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
220
|
+
className: "option-group-content",
|
|
221
|
+
ref: ref => this.optionGroupContentRef = ref,
|
|
222
|
+
children: this.renderOptGroup(searchVal)
|
|
223
|
+
})]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
var _default = exports.default = SelectOptionGroup;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
.dtable-select-check-icon {
|
|
2
|
-
width:
|
|
3
|
-
height:
|
|
2
|
+
width: 20px;
|
|
3
|
+
height: 20px;
|
|
4
4
|
text-align: center;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.dtable-select-check-icon .dtable-font {
|
|
8
|
-
font-size:
|
|
9
|
-
color:
|
|
8
|
+
font-size: 12px;
|
|
9
|
+
color: #798d99;
|
|
10
10
|
}
|
|
@@ -22,7 +22,7 @@ function DTableSelectLabel(_ref) {
|
|
|
22
22
|
}), isSelect && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
23
23
|
className: "dtable-select-check-icon",
|
|
24
24
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
25
|
-
className: "dtable-font dtable-icon-check"
|
|
25
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
26
26
|
})
|
|
27
27
|
})]
|
|
28
28
|
});
|
|
@@ -39,11 +39,10 @@ class DTableSelect extends _react.default.Component {
|
|
|
39
39
|
MenuList: _utils.MenuList,
|
|
40
40
|
ClearIndicator: _utils.ClearIndicator
|
|
41
41
|
}, userComponents);
|
|
42
|
-
const processedOptions = (0, _utils.processOptionsWithClear)(options, isClearable);
|
|
43
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
44
43
|
value: value,
|
|
45
|
-
onChange:
|
|
46
|
-
options:
|
|
44
|
+
onChange: onChange,
|
|
45
|
+
options: options,
|
|
47
46
|
isMulti: isMulti,
|
|
48
47
|
className: className,
|
|
49
48
|
classNamePrefix: classNamePrefix,
|
|
@@ -51,6 +50,7 @@ class DTableSelect extends _react.default.Component {
|
|
|
51
50
|
components: mergedComponents,
|
|
52
51
|
placeholder: placeholder,
|
|
53
52
|
isSearchable: isSearchable,
|
|
53
|
+
isClearable: isClearable,
|
|
54
54
|
menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
|
|
55
55
|
,
|
|
56
56
|
menuShouldScrollIntoView: true,
|
|
@@ -1,12 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
.user-select .select-module-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.
|
|
7
|
-
|
|
6
|
+
.user-select .select-module.select-module-avatar {
|
|
7
|
+
height: 24px;
|
|
8
|
+
width: 24px;
|
|
9
|
+
border-radius: 50%;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
.
|
|
11
|
-
color:
|
|
12
|
+
.user-select .select-module.select-module-name {
|
|
13
|
+
color: #212529;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.user-select .true__value-container .select-module-container {
|
|
18
|
+
display: block;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.user-select .true__value-container .select-module.select-module-avatar {
|
|
22
|
+
height: 16px;
|
|
23
|
+
width: 16px;
|
|
24
|
+
border-radius: 50%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.user-select .true__value-container .true__multi-value__label {
|
|
28
|
+
padding: 0px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.user-select .true__value-container .true__multi-value__label .select-module.select-module-avatar {
|
|
32
|
+
transform: translateY(-2px);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.user-select .true__value-container .select-module.select-module-name {
|
|
36
|
+
font-size: 13px;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
flex: 1 1;
|
|
41
|
+
line-height: 20px;
|
|
42
|
+
margin-left: 5px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.user-select .true__control.true__control--is-focused,
|
|
46
|
+
.user-select .true__control.true__control--is-focused:hover {
|
|
47
|
+
background-color: #ffffff;
|
|
48
|
+
border-color: #1991eb;
|
|
49
|
+
outline: 0;
|
|
50
|
+
box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
|
|
12
51
|
}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.UserSelectStyle = exports.Option = exports.MenuSelectStyle = exports.MenuList = exports.DropdownIndicator = exports.ClearIndicator = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -12,156 +12,116 @@ var _reactSelect = require("react-select");
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
const _excluded = ["innerProps"]; // DtableSelect is based on seatable-ui.css, so use the following content to override the default react-select style
|
|
14
14
|
const DEFAULT_CONTROL_STYLE = {
|
|
15
|
-
|
|
16
|
-
padding: '0 4px 0 8px',
|
|
17
|
-
border: '1px solid var(--bs-border-color) !important',
|
|
18
|
-
boxShadow: 'none',
|
|
19
|
-
backgroundColor: 'var(--bs-popover-bg)',
|
|
20
|
-
borderRadius: '4px',
|
|
21
|
-
outline: '0'
|
|
22
|
-
};
|
|
23
|
-
const DISABLED_CONTROL_STYLE = {
|
|
24
|
-
fontSize: '14px',
|
|
25
|
-
padding: '0 4px 0 8px',
|
|
26
|
-
border: '1px solid rgba(0, 40, 100, 0.12)',
|
|
27
|
-
boxShadow: 'none',
|
|
28
|
-
backgroundColor: 'var(--bs-bg-color)',
|
|
29
|
-
borderRadius: '4px',
|
|
30
|
-
outline: '0',
|
|
31
|
-
cursor: 'default',
|
|
32
|
-
opacity: 0.65
|
|
15
|
+
border: '1px solid rgba(0, 40, 100, 0.12) !important'
|
|
33
16
|
};
|
|
34
17
|
const FOCUS_CONTROL_STYLE = {
|
|
35
18
|
fontSize: '14px',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
borderRadius: '4px',
|
|
41
|
-
outline: '0'
|
|
42
|
-
};
|
|
43
|
-
const HEADER_ICON_STYLE = {
|
|
44
|
-
padding: '0 0.5rem !important'
|
|
19
|
+
backgroundColor: '#ffffff',
|
|
20
|
+
borderColor: '#1991eb',
|
|
21
|
+
outline: '0',
|
|
22
|
+
boxShadow: '0 0 0 2px rgba(70, 127, 207, 0.25)'
|
|
45
23
|
};
|
|
24
|
+
const noneCallback = () => ({
|
|
25
|
+
display: 'none'
|
|
26
|
+
});
|
|
46
27
|
const controlCallback = (provided, state) => {
|
|
47
28
|
const isDisabled = state.isDisabled,
|
|
48
29
|
isFocused = state.isFocused;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
if (isDisabled) {
|
|
56
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), DISABLED_CONTROL_STYLE), {}, {
|
|
57
|
-
':active': {
|
|
58
|
-
border: '1px solid var(--bs-bg-border-color)'
|
|
59
|
-
}
|
|
60
|
-
}, headerIconStyle);
|
|
61
|
-
}
|
|
62
|
-
if (isFocused) {
|
|
63
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE), headerIconStyle);
|
|
30
|
+
if (isFocused && !isDisabled) {
|
|
31
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE), {}, {
|
|
32
|
+
'&:hover': (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE)
|
|
33
|
+
});
|
|
64
34
|
}
|
|
65
35
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
66
36
|
fontSize: '14px',
|
|
67
37
|
lineHeight: '1.5',
|
|
68
38
|
cursor: 'pointer'
|
|
69
|
-
}, DEFAULT_CONTROL_STYLE),
|
|
39
|
+
}, DEFAULT_CONTROL_STYLE), {}, {
|
|
40
|
+
'&:hover': (0, _objectSpread2.default)({}, DEFAULT_CONTROL_STYLE)
|
|
41
|
+
});
|
|
70
42
|
};
|
|
71
|
-
const
|
|
72
|
-
menu: base => {
|
|
73
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, base), {}, {
|
|
74
|
-
padding: '8px',
|
|
75
|
-
backgroundColor: 'var(--bs-popover-bg)',
|
|
76
|
-
border: '1px solid var(--bs-border-secondary-color)',
|
|
77
|
-
borderRadius: '4px',
|
|
78
|
-
boxShadow: 'var(--bs-border-secondary-shadow)',
|
|
79
|
-
marginTop: '4px',
|
|
80
|
-
marginBottom: 0
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
menuList: provided => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
84
|
-
padding: 0
|
|
85
|
-
}),
|
|
43
|
+
const UserSelectStyle = exports.UserSelectStyle = {
|
|
86
44
|
option: (provided, state) => {
|
|
87
|
-
const isDisabled = state.isDisabled
|
|
45
|
+
const isDisabled = state.isDisabled,
|
|
46
|
+
isFocused = state.isFocused;
|
|
88
47
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
89
|
-
color: 'var(--bs-body-color)',
|
|
90
|
-
borderRadius: '4px',
|
|
91
|
-
minHeight: '32px',
|
|
92
|
-
padding: '8px',
|
|
93
48
|
cursor: isDisabled ? 'default' : 'pointer',
|
|
94
|
-
backgroundColor: '
|
|
95
|
-
overflow: 'hidden',
|
|
96
|
-
whiteSpace: 'nowrap',
|
|
97
|
-
textOverflow: 'ellipsis',
|
|
98
|
-
':hover': {
|
|
99
|
-
backgroundColor: 'rgba(0, 0, 0, 0.04)'
|
|
100
|
-
},
|
|
101
|
-
'.header-icon': HEADER_ICON_STYLE
|
|
49
|
+
backgroundColor: isFocused ? '#f5f5f5' : '#fff'
|
|
102
50
|
});
|
|
103
51
|
},
|
|
104
52
|
control: controlCallback,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
borderColor: 'var(--bs-border-secondary-color)'
|
|
110
|
-
}),
|
|
111
|
-
singleValue: provided => {
|
|
53
|
+
indicatorSeparator: noneCallback,
|
|
54
|
+
dropdownIndicator: noneCallback,
|
|
55
|
+
clearIndicator: noneCallback,
|
|
56
|
+
multiValue: provided => {
|
|
112
57
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
113
|
-
|
|
58
|
+
display: 'inline-flex',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
background: '#eaeaea',
|
|
61
|
+
borderRadius: '10px',
|
|
62
|
+
margin: '0 10px 0 0',
|
|
63
|
+
padding: '0 0 0 2px'
|
|
114
64
|
});
|
|
115
65
|
},
|
|
116
|
-
|
|
66
|
+
multiValueLabel: provided => {
|
|
117
67
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
118
|
-
|
|
68
|
+
padding: '0px'
|
|
119
69
|
});
|
|
120
70
|
},
|
|
121
|
-
multiValueRemove:
|
|
122
|
-
'.dtable-font': {
|
|
123
|
-
color: 'var(--bs-icon-color)'
|
|
124
|
-
},
|
|
125
|
-
'.dtable-font:hover': {
|
|
126
|
-
backgroundColor: 'transparent',
|
|
127
|
-
color: 'var(--bs-icon-color)'
|
|
128
|
-
}
|
|
129
|
-
}),
|
|
130
|
-
input: styles => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, styles), {}, {
|
|
131
|
-
color: 'var(--bs-body-color)'
|
|
132
|
-
}),
|
|
133
|
-
placeholder: (provided, state) => {
|
|
134
|
-
const isDisabled = state.isDisabled;
|
|
71
|
+
multiValueRemove: provided => {
|
|
135
72
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
136
|
-
color: '
|
|
137
|
-
|
|
73
|
+
color: '#666',
|
|
74
|
+
':hover': {
|
|
75
|
+
backgroundColor: 'transparent',
|
|
76
|
+
color: '#555555'
|
|
77
|
+
}
|
|
138
78
|
});
|
|
139
79
|
},
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
'display': 'none'
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
dropdownIndicator: (provided, state) => {
|
|
146
|
-
const isDisabled = state.isDisabled;
|
|
80
|
+
singleValue: provided => {
|
|
147
81
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
148
|
-
|
|
149
|
-
'
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
82
|
+
display: 'inline-flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
background: '#eaeaea',
|
|
85
|
+
borderRadius: '10px',
|
|
86
|
+
margin: '0',
|
|
87
|
+
padding: '0 2px',
|
|
88
|
+
width: 'fit-content'
|
|
153
89
|
});
|
|
154
90
|
}
|
|
155
91
|
};
|
|
92
|
+
const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
93
|
+
option: (provided, state) => {
|
|
94
|
+
const isDisabled = state.isDisabled,
|
|
95
|
+
isFocused = state.isFocused;
|
|
96
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
97
|
+
fontSize: '13px',
|
|
98
|
+
color: '#212529',
|
|
99
|
+
cursor: isDisabled ? 'default' : 'pointer',
|
|
100
|
+
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
101
|
+
':active': {
|
|
102
|
+
backgroundColor: '#f5f5f5'
|
|
103
|
+
},
|
|
104
|
+
'.header-icon .dtable-font': {
|
|
105
|
+
color: '#aaa'
|
|
106
|
+
},
|
|
107
|
+
'.header-icon .multicolor-icon': {
|
|
108
|
+
color: '#aaa'
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
control: controlCallback,
|
|
113
|
+
menuPortal: base => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, base), {}, {
|
|
114
|
+
zIndex: 9999
|
|
115
|
+
}),
|
|
116
|
+
indicatorSeparator: noneCallback
|
|
117
|
+
};
|
|
156
118
|
const DropdownIndicator = props => {
|
|
157
119
|
return _reactSelect.components.DropdownIndicator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.DropdownIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
158
120
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
159
121
|
className: "dtable-font dtable-icon-down3",
|
|
160
122
|
style: {
|
|
161
123
|
fontSize: '12px',
|
|
162
|
-
marginLeft: '-2px'
|
|
163
|
-
color: 'var(--bs-icon-color)',
|
|
164
|
-
paddingRight: 0
|
|
124
|
+
marginLeft: '-2px'
|
|
165
125
|
}
|
|
166
126
|
})
|
|
167
127
|
}));
|
|
@@ -182,8 +142,7 @@ const ClearIndicator = _ref => {
|
|
|
182
142
|
className: "dtable-font dtable-icon-fork-number",
|
|
183
143
|
style: {
|
|
184
144
|
fontSize: '12px',
|
|
185
|
-
marginRight: '-2px'
|
|
186
|
-
color: 'var(--bs-icon-color)'
|
|
145
|
+
marginRight: '-2px'
|
|
187
146
|
}
|
|
188
147
|
})
|
|
189
148
|
}));
|
|
@@ -198,54 +157,9 @@ const MenuList = props => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
|
198
157
|
});
|
|
199
158
|
exports.MenuList = MenuList;
|
|
200
159
|
const Option = props => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
style: {
|
|
206
|
-
display: 'flex',
|
|
207
|
-
alignItems: 'center',
|
|
208
|
-
justifyContent: 'space-between',
|
|
209
|
-
width: '100%',
|
|
210
|
-
whiteSpace: 'pre-line'
|
|
211
|
-
},
|
|
212
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
213
|
-
children: label
|
|
214
|
-
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
215
|
-
className: "dtable-font dtable-icon-check",
|
|
216
|
-
style: {
|
|
217
|
-
fontSize: '14px',
|
|
218
|
-
color: 'var(--bs-icon-color)',
|
|
219
|
-
paddingLeft: '16px'
|
|
220
|
-
}
|
|
221
|
-
})]
|
|
222
|
-
})
|
|
223
|
-
}));
|
|
224
|
-
};
|
|
225
|
-
exports.Option = Option;
|
|
226
|
-
const processOptionsWithClear = (options, isClearable) => {
|
|
227
|
-
if (isClearable && options && options.length > 0) {
|
|
228
|
-
return [{
|
|
229
|
-
label: '--',
|
|
230
|
-
value: '__clear__'
|
|
231
|
-
}, ...options];
|
|
232
|
-
}
|
|
233
|
-
return options;
|
|
234
|
-
};
|
|
235
|
-
exports.processOptionsWithClear = processOptionsWithClear;
|
|
236
|
-
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback) => {
|
|
237
|
-
if (selectedOption && selectedOption.value === '__clear__') {
|
|
238
|
-
onChangeCallback(null, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, actionMeta), {}, {
|
|
239
|
-
action: 'clear'
|
|
240
|
-
}));
|
|
241
|
-
} else {
|
|
242
|
-
onChangeCallback(selectedOption, actionMeta);
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
exports.handleSelectChange = handleSelectChange;
|
|
246
|
-
const createHandleChange = onChange => {
|
|
247
|
-
return (selectedOption, actionMeta) => {
|
|
248
|
-
handleSelectChange(selectedOption, actionMeta, onChange);
|
|
249
|
-
};
|
|
160
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
161
|
+
style: props.data.style,
|
|
162
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.Option, (0, _objectSpread2.default)({}, props))
|
|
163
|
+
});
|
|
250
164
|
};
|
|
251
|
-
exports.
|
|
165
|
+
exports.Option = Option;
|
|
@@ -15,6 +15,7 @@ require("@seafile/react-image-lightbox/style.css");
|
|
|
15
15
|
require("./index.css");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function ImagePreviewerLightbox(props) {
|
|
18
|
+
var _imageSrcList, _imageSrcList2;
|
|
18
19
|
const imageItems = props.imageItems,
|
|
19
20
|
imageIndex = props.imageIndex,
|
|
20
21
|
readOnly = props.readOnly,
|
|
@@ -24,7 +25,11 @@ function ImagePreviewerLightbox(props) {
|
|
|
24
25
|
dtableUuid = props.dtableUuid,
|
|
25
26
|
deleteImage = props.deleteImage,
|
|
26
27
|
downloadImage = props.downloadImage,
|
|
27
|
-
onRotateImage = props.onRotateImage
|
|
28
|
+
onRotateImage = props.onRotateImage,
|
|
29
|
+
_props$isShowPreLine = props.isShowPreLine,
|
|
30
|
+
isShowPreLine = _props$isShowPreLine === void 0 ? true : _props$isShowPreLine,
|
|
31
|
+
_props$isShowNextLine = props.isShowNextLine,
|
|
32
|
+
isShowNextLine = _props$isShowNextLine === void 0 ? true : _props$isShowNextLine;
|
|
28
33
|
const imageSrcList = imageItems.map(src => {
|
|
29
34
|
let name = '';
|
|
30
35
|
try {
|
|
@@ -102,16 +107,16 @@ function ImagePreviewerLightbox(props) {
|
|
|
102
107
|
wrapperClassName: (0, _classnames.default)('dtable-ui-component', className),
|
|
103
108
|
imageTitle: imageTitleDOM,
|
|
104
109
|
mainSrc: mainSrc,
|
|
105
|
-
nextSrc: imageSrcList[(currentImageIndex + 1) % imagesLength] ?
|
|
106
|
-
prevSrc: imageSrcList[(currentImageIndex + imagesLength - 1) % imagesLength]
|
|
110
|
+
nextSrc: ((_imageSrcList = imageSrcList[(currentImageIndex + 1) % imagesLength]) === null || _imageSrcList === void 0 ? void 0 : _imageSrcList.thumbnail) || '',
|
|
111
|
+
prevSrc: ((_imageSrcList2 = imageSrcList[(currentImageIndex + imagesLength - 1) % imagesLength]) === null || _imageSrcList2 === void 0 ? void 0 : _imageSrcList2.thumbnail) || '',
|
|
107
112
|
imagePadding: 70,
|
|
108
113
|
viewOriginalImageLabel: (0, _lang.getLocale)('View_original_image'),
|
|
109
114
|
enableRotate: canRotateImage,
|
|
110
115
|
onCloseRequest: props.closeImagePopup,
|
|
111
116
|
onMovePrevRequest: props.moveToPrevImage,
|
|
112
117
|
onMoveNextRequest: props.moveToNextImage,
|
|
113
|
-
onClickMoveUp: moveToPrevRowImage,
|
|
114
|
-
onClickMoveDown: moveToNextRowImage,
|
|
118
|
+
onClickMoveUp: isShowPreLine && moveToPrevRowImage,
|
|
119
|
+
onClickMoveDown: isShowNextLine && moveToNextRowImage,
|
|
115
120
|
onViewOriginal: props.onViewOriginal,
|
|
116
121
|
onRotateImage: canRotateImage ? deg => {
|
|
117
122
|
onRotateImage(currentImageIndex, deg);
|