dtable-ui-component 7.0.1-beta.1 → 7.0.1-beta.5
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 +38 -28
- package/lib/AsyncUserSelect/index.js +29 -18
- package/lib/DTableCustomizeSearchInput/index.css +75 -0
- package/lib/DTableCustomizeSearchInput/index.js +133 -0
- package/lib/DTableCustomizeSelect/index.css +120 -42
- package/lib/DTableCustomizeSelect/index.js +12 -6
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +7 -19
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +5 -9
- package/lib/DTableFiltersPopover/widgets/filter-item.js +15 -7
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +3 -3
- package/lib/DTableSelect/dtable-select-label.css +8 -3
- package/lib/DTableSelect/dtable-select-label.js +1 -1
- package/lib/DTableSelect/index.js +3 -3
- package/lib/DTableSelect/select-dropdown-indicator/index.css +16 -0
- package/lib/DTableSelect/select-dropdown-indicator/index.js +24 -0
- package/lib/DTableSelect/user-select.css +7 -46
- package/lib/DTableSelect/utils.js +166 -79
- package/lib/ImageEditor/images-previewer/image-preview/index.js +1 -2
- package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +2 -2
- package/lib/ImageFormatter/images-lazy-load.js +2 -2
- package/lib/ImageFormatter/index.js +2 -5
- package/lib/ImagePreviewerLightbox/index.js +1 -2
- package/lib/ImageThumbnail/index.js +1 -2
- package/lib/SelectOptionGroup/KeyCodes.js +96 -4
- package/lib/SelectOptionGroup/index.css +44 -54
- package/lib/SelectOptionGroup/index.js +35 -18
- package/lib/SelectOptionGroup/option.js +16 -4
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/down.svg +3 -0
- package/lib/index.js +3 -10
- package/lib/utils/url.js +35 -10
- package/package.json +2 -2
- package/lib/DTableCustomizeCollaboratorSelect/index.css +0 -86
- package/lib/DTableCustomizeCollaboratorSelect/index.js +0 -158
- package/lib/DTableGroupSelect/index.css +0 -96
- package/lib/DTableGroupSelect/index.js +0 -131
- package/lib/DTableGroupSelect/option.js +0 -42
- package/lib/DTableGroupSelect/select-option-group.css +0 -54
- package/lib/DTableGroupSelect/select-option-group.js +0 -227
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
.option-group {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
1
|
+
.seatable-option-group {
|
|
4
2
|
position: absolute;
|
|
5
3
|
left: 0;
|
|
6
4
|
min-height: 60px;
|
|
7
5
|
min-width: 100%;
|
|
8
6
|
max-width: 15rem;
|
|
9
|
-
padding: 0
|
|
7
|
+
padding-top: 0;
|
|
10
8
|
box-shadow: var(--bs-border-secondary-shadow);
|
|
11
9
|
background: #fff;
|
|
12
10
|
border: 1px solid var(--bs-border-secondary-color);
|
|
@@ -14,34 +12,33 @@
|
|
|
14
12
|
z-index: 10001;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
.option-group .
|
|
15
|
+
.seatable-option-group .seatable-select-search {
|
|
18
16
|
width: 100%;
|
|
19
17
|
min-width: 170px;
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.option-group-search .form-control {
|
|
24
|
-
height: 31px;
|
|
18
|
+
position: relative;
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
.option-group .none-search-result {
|
|
21
|
+
.seatable-option-group .none-search-result {
|
|
28
22
|
height: 100px;
|
|
29
23
|
width: 100%;
|
|
30
|
-
padding:
|
|
31
|
-
color:
|
|
24
|
+
padding: 8px;
|
|
25
|
+
color: var(--bs-icon-color);
|
|
32
26
|
}
|
|
33
27
|
|
|
34
|
-
.option-group .option-group-content {
|
|
35
|
-
flex: 1;
|
|
28
|
+
.seatable-option-group .seatable-option-group-content {
|
|
36
29
|
max-height: 252px;
|
|
37
30
|
overflow-y: auto;
|
|
31
|
+
padding: 8px;
|
|
38
32
|
}
|
|
39
33
|
|
|
40
|
-
.option {
|
|
41
|
-
|
|
34
|
+
.seatable-select-option {
|
|
35
|
+
position: relative;
|
|
36
|
+
display: flex;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
align-items: center;
|
|
42
39
|
width: 100%;
|
|
43
40
|
line-height: 24px;
|
|
44
|
-
padding: 0.25rem
|
|
41
|
+
padding: 0.25rem 8px;
|
|
45
42
|
clear: both;
|
|
46
43
|
font-weight: 400;
|
|
47
44
|
text-align: inherit;
|
|
@@ -50,64 +47,57 @@
|
|
|
50
47
|
overflow: hidden;
|
|
51
48
|
text-overflow: ellipsis;
|
|
52
49
|
white-space: nowrap;
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
height: 32px;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
.option.option-active {
|
|
56
|
-
background-color: #20a0ff;
|
|
57
|
-
color: #fff;
|
|
54
|
+
.seatable-select-option.seatable-select-option-active {
|
|
58
55
|
cursor: pointer;
|
|
56
|
+
background-color: var(--bs-btn-background-hover);
|
|
59
57
|
}
|
|
60
58
|
|
|
61
|
-
.option
|
|
62
|
-
|
|
63
|
-
.option.option-active .select-option-name {
|
|
64
|
-
color: #fff;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.option.option-active .header-icon .dtable-font,
|
|
68
|
-
.option.option-active .header-icon .multicolor-icon {
|
|
69
|
-
color: #fff;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.option:not(.option-active):hover .header-icon .dtable-font,
|
|
73
|
-
.option:not(.option-active):hover .header-icon .multicolor-icon {
|
|
74
|
-
color: #aaa;
|
|
59
|
+
.seatable-select-option .select-option-name .multiple-select-option {
|
|
60
|
+
margin: 0;
|
|
75
61
|
}
|
|
76
62
|
|
|
77
|
-
.
|
|
78
|
-
|
|
63
|
+
.seatable-option-group .dtable-icon-check {
|
|
64
|
+
color: var(--bs-icon-color);
|
|
79
65
|
}
|
|
80
66
|
|
|
81
|
-
.
|
|
82
|
-
|
|
67
|
+
.select-label {
|
|
68
|
+
width: 100%;
|
|
83
69
|
}
|
|
84
70
|
|
|
85
|
-
.option-group-
|
|
86
|
-
.option-group-
|
|
71
|
+
.seatable-option-group-selector-multiple-select .select-label,
|
|
72
|
+
.seatable-option-group-selector-single-select .select-option-name,
|
|
73
|
+
.seatable-option-group-selector-multiple-select .multiple-option-name,
|
|
74
|
+
.selector-group-select .group-option-name {
|
|
87
75
|
display: flex;
|
|
88
76
|
align-items: center;
|
|
89
77
|
justify-content: space-between;
|
|
78
|
+
width: 100%;
|
|
90
79
|
}
|
|
91
80
|
|
|
92
|
-
.option-group-
|
|
81
|
+
.seatable-option-group-selector-multiple-select .multiple-check-icon,
|
|
82
|
+
.selector-group-select .group-check-icon {
|
|
93
83
|
display: inline-flex;
|
|
94
|
-
width: 20px;
|
|
95
84
|
text-align: center;
|
|
85
|
+
color: var(--bs-icon-color);
|
|
96
86
|
}
|
|
97
87
|
|
|
98
|
-
.
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
.selector-group-select .multiple-check-icon .dtable-icon-check,
|
|
89
|
+
.seatable-option-group-selector-multiple-select .multiple-check-icon .dtable-icon-check,
|
|
90
|
+
.selector-group-select .group-check-icon .dtable-icon-check {
|
|
91
|
+
font-size: 14px;
|
|
101
92
|
}
|
|
102
93
|
|
|
103
|
-
.
|
|
104
|
-
.
|
|
105
|
-
|
|
106
|
-
.option-group-dtable-ui-multiple-select-selector .option.option-active {
|
|
107
|
-
background-color: #f5f5f5;
|
|
94
|
+
.selector-group-select .seatable-select-option:hover,
|
|
95
|
+
.selector-group-select .seatable-select-option.seatable-select-option-active {
|
|
96
|
+
background-color: var(--bs-btn-background-hover);
|
|
108
97
|
}
|
|
109
98
|
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
|
|
99
|
+
.select-label .header-icon {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
padding: 0 .5rem 0 0 !important;
|
|
102
|
+
margin-left: 0 !important;
|
|
113
103
|
}
|
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
12
|
+
var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
|
|
11
13
|
var _option = _interopRequireDefault(require("./option"));
|
|
12
|
-
var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
|
|
13
14
|
var _KeyCodes = _interopRequireDefault(require("./KeyCodes"));
|
|
14
|
-
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
15
15
|
require("./index.css");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
const OPTION_HEIGHT = 32;
|
|
@@ -19,21 +19,16 @@ class SelectOptionGroup extends _react.Component {
|
|
|
19
19
|
constructor(props) {
|
|
20
20
|
super(props);
|
|
21
21
|
this.resetMenuStyle = () => {
|
|
22
|
-
if (!this.optionGroupRef) return;
|
|
23
22
|
const _this$props = this.props,
|
|
24
23
|
isInModal = _this$props.isInModal,
|
|
25
24
|
position = _this$props.position;
|
|
26
25
|
const _this$optionGroupRef$ = this.optionGroupRef.getBoundingClientRect(),
|
|
27
26
|
top = _this$optionGroupRef$.top,
|
|
28
|
-
height = _this$optionGroupRef$.height
|
|
29
|
-
width = _this$optionGroupRef$.width;
|
|
27
|
+
height = _this$optionGroupRef$.height;
|
|
30
28
|
if (isInModal) {
|
|
31
29
|
if (position.y + position.height + height > window.innerHeight) {
|
|
32
30
|
this.optionGroupRef.style.top = position.y - height + 'px';
|
|
33
31
|
}
|
|
34
|
-
if (position && position.x + width > window.innerWidth) {
|
|
35
|
-
this.optionGroupRef.style.left = window.innerWidth - width - 10 + 'px';
|
|
36
|
-
}
|
|
37
32
|
this.optionGroupRef.style.opacity = 1;
|
|
38
33
|
this.searchInputRef.current && this.searchInputRef.current.inputRef.focus();
|
|
39
34
|
} else {
|
|
@@ -127,10 +122,17 @@ class SelectOptionGroup extends _react.Component {
|
|
|
127
122
|
});
|
|
128
123
|
}
|
|
129
124
|
};
|
|
125
|
+
this.clearSearch = () => {
|
|
126
|
+
this.setState({
|
|
127
|
+
searchVal: '',
|
|
128
|
+
activeIndex: -1
|
|
129
|
+
});
|
|
130
|
+
};
|
|
130
131
|
this.renderOptGroup = searchVal => {
|
|
131
132
|
let _this$props2 = this.props,
|
|
132
133
|
noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
|
|
133
|
-
onSelectOption = _this$props2.onSelectOption
|
|
134
|
+
onSelectOption = _this$props2.onSelectOption,
|
|
135
|
+
value = _this$props2.value;
|
|
134
136
|
this.filterOptions = this.props.getFilterOptions(searchVal);
|
|
135
137
|
if (this.filterOptions.length === 0) {
|
|
136
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -141,7 +143,16 @@ class SelectOptionGroup extends _react.Component {
|
|
|
141
143
|
return this.filterOptions.map((opt, i) => {
|
|
142
144
|
let key = opt.value.column ? opt.value.column.key : i;
|
|
143
145
|
let isActive = this.state.activeIndex === i;
|
|
144
|
-
|
|
146
|
+
let isSelected = false;
|
|
147
|
+
if (value) {
|
|
148
|
+
// Handle both single value and array of values
|
|
149
|
+
if (Array.isArray(value.value)) {
|
|
150
|
+
isSelected = value.value.includes(opt.value);
|
|
151
|
+
} else {
|
|
152
|
+
isSelected = opt.value === value.value || JSON.stringify(opt.value) === JSON.stringify(value.value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_option.default, {
|
|
145
156
|
index: i,
|
|
146
157
|
isActive: isActive,
|
|
147
158
|
value: opt.value,
|
|
@@ -149,8 +160,13 @@ class SelectOptionGroup extends _react.Component {
|
|
|
149
160
|
changeIndex: this.changeIndex,
|
|
150
161
|
supportMultipleSelect: this.props.supportMultipleSelect,
|
|
151
162
|
disableHover: this.state.disableHover,
|
|
152
|
-
children:
|
|
153
|
-
|
|
163
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
164
|
+
className: "select-label",
|
|
165
|
+
children: opt.label
|
|
166
|
+
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
167
|
+
className: "dtable-font dtable-icon-check seatable-check-color"
|
|
168
|
+
})]
|
|
169
|
+
}, key);
|
|
154
170
|
});
|
|
155
171
|
};
|
|
156
172
|
this.state = {
|
|
@@ -215,9 +231,8 @@ class SelectOptionGroup extends _react.Component {
|
|
|
215
231
|
ref: ref => this.clickOutsideRef = ref,
|
|
216
232
|
onClickOutside: this.props.onClickOutside,
|
|
217
233
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
218
|
-
className: (0, _classnames.default)('option-group', className ? 'option-group-' + className : '', {
|
|
219
|
-
'pt-0': isShowSelected
|
|
220
|
-
'create-new-option-group': addOptionAble
|
|
234
|
+
className: (0, _classnames.default)('seatable-option-group', className ? 'seatable-option-group-' + className : '', {
|
|
235
|
+
'pt-0': isShowSelected
|
|
221
236
|
}),
|
|
222
237
|
ref: ref => this.optionGroupRef = ref,
|
|
223
238
|
style: style,
|
|
@@ -227,16 +242,18 @@ class SelectOptionGroup extends _react.Component {
|
|
|
227
242
|
onClick: e => e.stopPropagation(),
|
|
228
243
|
children: value.label || ''
|
|
229
244
|
}), searchable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
230
|
-
className: "
|
|
231
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
245
|
+
className: "seatable-select-search",
|
|
246
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
|
|
232
247
|
className: "option-search-control",
|
|
233
248
|
placeholder: searchPlaceholder,
|
|
234
249
|
onChange: this.onChangeSearch,
|
|
250
|
+
clearValue: this.clearSearch,
|
|
235
251
|
autoFocus: true,
|
|
252
|
+
isClearable: true,
|
|
236
253
|
ref: this.searchInputRef
|
|
237
254
|
})
|
|
238
255
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
239
|
-
className: "option-group-content",
|
|
256
|
+
className: "seatable-option-group-content",
|
|
240
257
|
ref: ref => this.optionGroupContentRef = ref,
|
|
241
258
|
children: this.renderOptGroup(searchVal)
|
|
242
259
|
}), addOptionAble && AddOption]
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
12
|
class Option extends _react.Component {
|
|
11
13
|
constructor() {
|
|
12
14
|
super(...arguments);
|
|
13
|
-
this.onSelectOption =
|
|
15
|
+
this.onSelectOption = event => {
|
|
14
16
|
if (this.props.supportMultipleSelect) {
|
|
15
17
|
event.stopPropagation();
|
|
16
18
|
}
|
|
17
|
-
this.props.onSelectOption(value, event);
|
|
19
|
+
this.props.onSelectOption(this.props.value, event);
|
|
18
20
|
};
|
|
19
21
|
this.onMouseEnter = () => {
|
|
20
22
|
if (!this.props.disableHover) {
|
|
@@ -26,11 +28,21 @@ class Option extends _react.Component {
|
|
|
26
28
|
this.props.changeIndex(-1);
|
|
27
29
|
}
|
|
28
30
|
};
|
|
31
|
+
this.onKeyDown = e => {
|
|
32
|
+
if (e.key === 'Enter' || e.key === 'Space') {
|
|
33
|
+
e.target.click();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
29
36
|
}
|
|
30
37
|
render() {
|
|
31
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
className:
|
|
33
|
-
|
|
39
|
+
className: (0, _classnames.default)('seatable-select-option', {
|
|
40
|
+
'seatable-select-option-active': this.props.isActive
|
|
41
|
+
}),
|
|
42
|
+
tabIndex: "0",
|
|
43
|
+
role: "menuitem",
|
|
44
|
+
onClick: this.onSelectOption,
|
|
45
|
+
onKeyDown: this.onKeyDown,
|
|
34
46
|
onMouseEnter: this.onMouseEnter,
|
|
35
47
|
onMouseLeave: this.onMouseLeave,
|
|
36
48
|
children: this.props.children
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718937171668" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18368" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M489.6 444.8l294.4-294.4 67.2 67.2-294.4 294.4 294.4 294.4-67.2 67.2-294.4-294.4-272 272-67.2-67.2 272-272-272-272 67.2-67.2z" p-id="18369" fill="currentColor"></path></svg>
|
package/lib/index.js
CHANGED
|
@@ -118,10 +118,10 @@ Object.defineProperty(exports, "DTableCustomFooter", {
|
|
|
118
118
|
return _DTableCustomFooter.default;
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
|
-
Object.defineProperty(exports, "
|
|
121
|
+
Object.defineProperty(exports, "DTableCustomizeSearchInput", {
|
|
122
122
|
enumerable: true,
|
|
123
123
|
get: function () {
|
|
124
|
-
return
|
|
124
|
+
return _DTableCustomizeSearchInput.default;
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "DTableCustomizeSelect", {
|
|
@@ -154,12 +154,6 @@ Object.defineProperty(exports, "DTableFiltersPopover", {
|
|
|
154
154
|
return _DTableFiltersPopover.default;
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
Object.defineProperty(exports, "DTableGroupSelect", {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
get: function () {
|
|
160
|
-
return _index.default;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
157
|
Object.defineProperty(exports, "DTableIcon", {
|
|
164
158
|
enumerable: true,
|
|
165
159
|
get: function () {
|
|
@@ -718,12 +712,11 @@ var _DTableRadio = _interopRequireDefault(require("./DTableRadio"));
|
|
|
718
712
|
var _DTableCommonAddTool = _interopRequireDefault(require("./DTableCommonAddTool"));
|
|
719
713
|
var _NotificationPopover = _interopRequireDefault(require("./NotificationPopover"));
|
|
720
714
|
var _DTableSelect = _interopRequireDefault(require("./DTableSelect"));
|
|
721
|
-
var _index = _interopRequireDefault(require("./DTableGroupSelect/index"));
|
|
722
715
|
var _dtableSelectLabel = _interopRequireDefault(require("./DTableSelect/dtable-select-label"));
|
|
723
716
|
var _DTableSwitch = _interopRequireDefault(require("./DTableSwitch"));
|
|
724
717
|
var _DTableCustomizeSelect = _interopRequireDefault(require("./DTableCustomizeSelect"));
|
|
725
|
-
var _DTableCustomizeCollaboratorSelect = _interopRequireDefault(require("./DTableCustomizeCollaboratorSelect"));
|
|
726
718
|
var _DTableSearchInput = _interopRequireDefault(require("./DTableSearchInput"));
|
|
719
|
+
var _DTableCustomizeSearchInput = _interopRequireDefault(require("./DTableCustomizeSearchInput"));
|
|
727
720
|
var _DTableColorPicker = _interopRequireDefault(require("./DTableColorPicker"));
|
|
728
721
|
var _ModalPortal = _interopRequireDefault(require("./ModalPortal"));
|
|
729
722
|
var _RoleStatusEditor = _interopRequireDefault(require("./RoleStatusEditor"));
|
package/lib/utils/url.js
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalURL = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isBase64 = exports.isAIUrl = exports.imageCheck = exports.getValidFileImageUrls = exports.getFileThumbnailInfo = exports.getFileSuffix = exports.getFileName = exports.getFileIconUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = exports.checkImgExists = void 0;
|
|
7
|
-
var _dtableUtils = require("dtable-utils");
|
|
6
|
+
exports.needUseThumbnailImage = exports.isTargetUrl = exports.isInternalURL = exports.isInternalImg = exports.isDigitalSignsUrl = exports.isCustomAssetUrl = exports.isBase64 = exports.isAIUrl = exports.imageCheck = exports.getValidFileImageUrls = exports.getImageThumbnailUrl = exports.getFileThumbnailInfo = exports.getFileSuffix = exports.getFileName = exports.getFileIconUrl = exports.generateCurrentBaseImageUrl = exports.generateCurrentBaseImageThumbnailUrl = exports.checkSVGImage = exports.checkImgExists = void 0;
|
|
8
7
|
var _file = require("../constants/file");
|
|
9
8
|
const isTargetUrl = (target, url) => {
|
|
10
9
|
if (!url || typeof url !== 'string') return false;
|
|
@@ -96,6 +95,32 @@ const generateCurrentBaseImageUrl = _ref2 => {
|
|
|
96
95
|
return "".concat(validServer, "/workspace/").concat(workspaceID, "/asset/").concat(dtableUuid).concat(partUrl);
|
|
97
96
|
};
|
|
98
97
|
exports.generateCurrentBaseImageUrl = generateCurrentBaseImageUrl;
|
|
98
|
+
const getImageThumbnailUrl = function (url) {
|
|
99
|
+
let _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
100
|
+
server = _ref3.server,
|
|
101
|
+
dtableUuid = _ref3.dtableUuid,
|
|
102
|
+
workspaceID = _ref3.workspaceID,
|
|
103
|
+
_ref3$size = _ref3.size,
|
|
104
|
+
size = _ref3$size === void 0 ? 256 : _ref3$size;
|
|
105
|
+
if (!url || typeof url !== 'string') return '';
|
|
106
|
+
if (server && dtableUuid && isCustomAssetUrl(url)) {
|
|
107
|
+
const assetUuid = url.slice(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
|
|
108
|
+
return server + '/dtable/' + dtableUuid + '/custom-asset-thumbnail/' + assetUuid + '?size=' + size;
|
|
109
|
+
}
|
|
110
|
+
if (isAIUrl(url) || checkSVGImage(url) || !isInternalImg(url) || isBase64(url)) return url;
|
|
111
|
+
if (server && workspaceID && dtableUuid && isDigitalSignsUrl(url)) {
|
|
112
|
+
return generateCurrentBaseImageThumbnailUrl({
|
|
113
|
+
server,
|
|
114
|
+
workspaceID,
|
|
115
|
+
dtableUuid,
|
|
116
|
+
size,
|
|
117
|
+
partUrl: url
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
if (url.includes('/thumbnail/workspace')) return url;
|
|
121
|
+
return url.replace('/workspace', '/thumbnail/workspace') + '?size=' + size;
|
|
122
|
+
};
|
|
123
|
+
exports.getImageThumbnailUrl = getImageThumbnailUrl;
|
|
99
124
|
const getFileName = url => {
|
|
100
125
|
if (!url) return null;
|
|
101
126
|
let validUrl = url;
|
|
@@ -120,9 +145,9 @@ const imageCheck = filename => {
|
|
|
120
145
|
};
|
|
121
146
|
exports.imageCheck = imageCheck;
|
|
122
147
|
const isInternalURL = function (url) {
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
server =
|
|
148
|
+
let _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
149
|
+
_ref4$server = _ref4.server,
|
|
150
|
+
server = _ref4$server === void 0 ? '' : _ref4$server;
|
|
126
151
|
if (!url || typeof url !== 'string') return false;
|
|
127
152
|
return server && url.indexOf(server) > -1;
|
|
128
153
|
};
|
|
@@ -157,10 +182,10 @@ const getFileIconUrl = (filename, direntType) => {
|
|
|
157
182
|
};
|
|
158
183
|
exports.getFileIconUrl = getFileIconUrl;
|
|
159
184
|
const getFileThumbnailInfo = function (file) {
|
|
160
|
-
let
|
|
161
|
-
server =
|
|
162
|
-
dtableUuid =
|
|
163
|
-
workspaceID =
|
|
185
|
+
let _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
186
|
+
server = _ref5.server,
|
|
187
|
+
dtableUuid = _ref5.dtableUuid,
|
|
188
|
+
workspaceID = _ref5.workspaceID;
|
|
164
189
|
const defaultIcon = _file.FILEEXT_ICON_MAP['default'];
|
|
165
190
|
const defaultIconUrl = _file.FILEEXT_ICON_URL_MAP[defaultIcon];
|
|
166
191
|
if (!file || !file.name) return {
|
|
@@ -170,7 +195,7 @@ const getFileThumbnailInfo = function (file) {
|
|
|
170
195
|
const isImage = imageCheck(file.name);
|
|
171
196
|
if (isImage && server) return {
|
|
172
197
|
isImage,
|
|
173
|
-
fileIconUrl:
|
|
198
|
+
fileIconUrl: getImageThumbnailUrl(file.url, {
|
|
174
199
|
server,
|
|
175
200
|
dtableUuid,
|
|
176
201
|
workspaceID
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "7.0.1-beta.
|
|
3
|
+
"version": "7.0.1-beta.5",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "5.0.9",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@seafile/seafile-editor": "^3.0.34",
|
|
9
9
|
"classnames": "~2.5.*",
|
|
10
10
|
"dayjs": "1.10.7",
|
|
11
|
-
"dtable-utils": "5.0.
|
|
11
|
+
"dtable-utils": "~5.0.27",
|
|
12
12
|
"is-hotkey": "0.2.0",
|
|
13
13
|
"rc-checkbox": "3.5.0",
|
|
14
14
|
"react-color": "2.19.3",
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
.dtable-customize-collaborator-select.dtable-select {
|
|
2
|
-
position: unset;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.dtable-customize-collaborator-select .collaborator-avatar {
|
|
6
|
-
width: 16px;
|
|
7
|
-
height: 16px;
|
|
8
|
-
transform: translateY(-1px);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dtable-customize-collaborator-select .selected-option-show {
|
|
12
|
-
width: calc(100% - 20px);
|
|
13
|
-
height: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dtable-customize-collaborator-select .selected-option {
|
|
17
|
-
width: auto;
|
|
18
|
-
overflow-x: auto;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.dtable-customize-collaborator-select .dtable-icon-down3 {
|
|
22
|
-
margin-left: .5rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.dtable-customize-collaborator-select .option-collaborator {
|
|
26
|
-
display: flex;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.dtable-customize-collaborator-select .collaborator-container {
|
|
30
|
-
flex: 1 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.dtable-customize-collaborator-select .editor-list-delete .collaborator-container {
|
|
34
|
-
flex: 1 1;
|
|
35
|
-
display: inline;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.dtable-customize-collaborator-select .multiple-check-icon {
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
width: 20px;
|
|
41
|
-
text-align: center;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.dtable-customize-collaborator-select .collaborator-check-icon .dtable-icon-check-mark,
|
|
45
|
-
.dtable-customize-collaborator-select .multiple-check-icon .dtable-icon-check-mark {
|
|
46
|
-
font-size: 12px;
|
|
47
|
-
color: #798d99;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.dtable-customize-collaborator-select.dtable-select .option-active,
|
|
51
|
-
.dtable-customize-collaborator-select.dtable-select .option:hover {
|
|
52
|
-
color: #212529;
|
|
53
|
-
background-color: #f5f5f5;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.dtable-customize-collaborator-select.dtable-select .option.option-active .select-option-name {
|
|
57
|
-
color: #212529;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.collaborator-select .option-group-content .collaborator,
|
|
61
|
-
.dtable-customize-collaborator-select .option-group .option-group-content .collaborator {
|
|
62
|
-
background: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.dtable-customize-collaborator-select .collaborator-avatar-container {
|
|
66
|
-
width: 16px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.dtable-customize-collaborator-select .option-group-content .remove-container {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.dtable-customize-collaborator-select .collaborator-container {
|
|
74
|
-
display: flex;
|
|
75
|
-
justify-content: space-between;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.collaborator-container .collaborator-name {
|
|
79
|
-
margin-left: 5px;
|
|
80
|
-
max-width: 200px;
|
|
81
|
-
color: #212529;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.collaborator-select .option-group {
|
|
85
|
-
max-height: fit-content;
|
|
86
|
-
}
|