dtable-ui-component 6.0.110-ast.1 → 6.0.110-ast.11
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/DTableCustomizeSelect/index.css +10 -0
- package/lib/DTableCustomizeSelect/select-option-group/index.css +7 -1
- package/lib/DTableSelect/index.js +10 -5
- package/lib/DTableSelect/select-dropdown-indicator/index.css +4 -0
- package/lib/DTableSelect/select-dropdown-indicator/index.js +6 -2
- package/lib/DTableSelect/select-style.js +0 -5
- package/package.json +1 -1
- package/lib/DTableSelect/utils.js +0 -244
|
@@ -91,6 +91,10 @@
|
|
|
91
91
|
margin-right: 8px;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
.seatable-customize-select .disabled .select-placeholder {
|
|
95
|
+
opacity: 0.65;
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
.seatable-customize-select .selected-option-show {
|
|
95
99
|
height: 20px;
|
|
96
100
|
line-height: 20px;
|
|
@@ -106,3 +110,9 @@
|
|
|
106
110
|
cursor: default;
|
|
107
111
|
font-size: 14px;
|
|
108
112
|
}
|
|
113
|
+
|
|
114
|
+
.seatable-customize-select .header-icon {
|
|
115
|
+
display: inline-block;
|
|
116
|
+
padding: 0 .5rem 0 0!important;
|
|
117
|
+
margin-left: 0 !important;
|
|
118
|
+
}
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
.seatable-option-group .none-search-result {
|
|
49
49
|
height: 100px;
|
|
50
50
|
width: 100%;
|
|
51
|
-
padding:
|
|
51
|
+
padding: 8px;
|
|
52
52
|
color: var(--bs-body-secondary-color);
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -120,3 +120,9 @@
|
|
|
120
120
|
.seatable-option-group-selector-multiple-select .seatable-select-option.seatable-select-option-active {
|
|
121
121
|
background-color: #f5f5f5;
|
|
122
122
|
}
|
|
123
|
+
|
|
124
|
+
.select-label .header-icon {
|
|
125
|
+
display: inline-block;
|
|
126
|
+
padding: 0 .5rem 0 0!important;
|
|
127
|
+
margin-left: 0 !important;
|
|
128
|
+
}
|
|
@@ -17,7 +17,9 @@ const _excluded = ["innerProps"],
|
|
|
17
17
|
_excluded2 = ["children"];
|
|
18
18
|
const DropdownIndicator = props => {
|
|
19
19
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.DropdownIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
20
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectDropdownIndicator.default, {
|
|
20
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectDropdownIndicator.default, {
|
|
21
|
+
isDisabled: props.isDisabled
|
|
22
|
+
})
|
|
21
23
|
}));
|
|
22
24
|
};
|
|
23
25
|
const ClearIndicator = _ref => {
|
|
@@ -139,6 +141,7 @@ class DTableSelect extends _react.default.Component {
|
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
const optionsWithCheck = options.map(option => (0, _objectSpread2.default)({}, option));
|
|
144
|
+
// menuIsOpen={true} support display forever
|
|
142
145
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
143
146
|
value: value,
|
|
144
147
|
isDisabled: isDisabled,
|
|
@@ -149,6 +152,7 @@ class DTableSelect extends _react.default.Component {
|
|
|
149
152
|
className: className,
|
|
150
153
|
classNamePrefix: classNamePrefix,
|
|
151
154
|
styles: _selectStyle.MenuSelectStyle,
|
|
155
|
+
menuIsOpen: true,
|
|
152
156
|
components: {
|
|
153
157
|
Option,
|
|
154
158
|
DropdownIndicator,
|
|
@@ -173,7 +177,7 @@ class DTableSelect extends _react.default.Component {
|
|
|
173
177
|
let {
|
|
174
178
|
context
|
|
175
179
|
} = _ref3;
|
|
176
|
-
const isSelected = value && value.value === option.value;
|
|
180
|
+
const isSelected = value && (value.value === option.value || JSON.stringify(option.value) === JSON.stringify(value.value));
|
|
177
181
|
if (context === 'menu') {
|
|
178
182
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
179
183
|
className: "d-flex align-items-center justify-content-between",
|
|
@@ -181,10 +185,11 @@ class DTableSelect extends _react.default.Component {
|
|
|
181
185
|
className: "select-option-label",
|
|
182
186
|
children: option.label
|
|
183
187
|
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
184
|
-
className: "dtable-font dtable-icon-check seatable-check-color",
|
|
188
|
+
className: "dtable-font dtable-icon-check seatable-check-color d-flex align-items-center justify-content-center",
|
|
185
189
|
style: {
|
|
186
|
-
width: '
|
|
187
|
-
height: '
|
|
190
|
+
width: '14px',
|
|
191
|
+
height: '14px',
|
|
192
|
+
color: 'var(--bs-icon-secondary-color)'
|
|
188
193
|
}
|
|
189
194
|
})]
|
|
190
195
|
});
|
|
@@ -9,13 +9,17 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _DTableIcon = _interopRequireDefault(require("../../DTableIcon"));
|
|
10
10
|
require("./index.css");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
const SelectDropdownIndicator =
|
|
12
|
+
const SelectDropdownIndicator = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
isDisabled
|
|
15
|
+
} = _ref;
|
|
13
16
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
14
17
|
className: "select-dropdown-indicator d-flex align-items-center",
|
|
15
18
|
"aria-hidden": "true",
|
|
16
19
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
17
20
|
symbol: "down",
|
|
18
|
-
color: "var(--bs-icon-color)"
|
|
21
|
+
color: "var(--bs-icon-color)",
|
|
22
|
+
className: isDisabled ? 'dis-multicolor-icon-down' : ''
|
|
19
23
|
})
|
|
20
24
|
});
|
|
21
25
|
};
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.MenuSelectStyle = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
9
|
-
// Seahub select is based on seafile-ui.css, so use the following content to override the default react-select style
|
|
10
9
|
const DEFAULT_CONTROL_STYLE = {
|
|
11
10
|
fontSize: '14px',
|
|
12
11
|
padding: '0 1rem 0 .5rem',
|
|
@@ -63,10 +62,6 @@ const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
|
63
62
|
marginBottom: 0
|
|
64
63
|
});
|
|
65
64
|
},
|
|
66
|
-
// .react-select__menu-list)
|
|
67
|
-
menuList: provided => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
68
|
-
paddingRight: '8px'
|
|
69
|
-
}),
|
|
70
65
|
option: (provided, state) => {
|
|
71
66
|
const {
|
|
72
67
|
isDisabled,
|
package/package.json
CHANGED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.processOptionsWithClear = exports.handleSelectChange = exports.createHandleChange = exports.UserSelectStyle = exports.Option = exports.MenuSelectStyle = exports.MenuList = exports.DropdownIndicator = exports.ClearIndicator = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
var _reactSelect = require("react-select");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
const _excluded = ["innerProps"]; // DtableSelect is based on seatable-ui.css, so use the following content to override the default react-select style
|
|
14
|
-
const DEFAULT_CONTROL_STYLE = {
|
|
15
|
-
border: '1px solid rgba(0, 40, 100, 0.12) !important'
|
|
16
|
-
};
|
|
17
|
-
const FOCUS_CONTROL_STYLE = {
|
|
18
|
-
fontSize: '14px',
|
|
19
|
-
backgroundColor: '#ffffff',
|
|
20
|
-
borderColor: '#1991eb',
|
|
21
|
-
outline: '0',
|
|
22
|
-
boxShadow: '0 0 0 2px rgba(70, 127, 207, 0.25)'
|
|
23
|
-
};
|
|
24
|
-
const noneCallback = () => ({
|
|
25
|
-
display: 'none'
|
|
26
|
-
});
|
|
27
|
-
const controlCallback = (provided, state) => {
|
|
28
|
-
const {
|
|
29
|
-
isDisabled,
|
|
30
|
-
isFocused
|
|
31
|
-
} = state;
|
|
32
|
-
if (isFocused && !isDisabled) {
|
|
33
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE), {}, {
|
|
34
|
-
'&:hover': (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), FOCUS_CONTROL_STYLE)
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
38
|
-
fontSize: '14px',
|
|
39
|
-
lineHeight: '1.5',
|
|
40
|
-
cursor: 'pointer'
|
|
41
|
-
}, DEFAULT_CONTROL_STYLE), {}, {
|
|
42
|
-
'&:hover': (0, _objectSpread2.default)({}, DEFAULT_CONTROL_STYLE)
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const UserSelectStyle = exports.UserSelectStyle = {
|
|
46
|
-
option: (provided, state) => {
|
|
47
|
-
const {
|
|
48
|
-
isDisabled,
|
|
49
|
-
isFocused
|
|
50
|
-
} = state;
|
|
51
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
52
|
-
cursor: isDisabled ? 'default' : 'pointer',
|
|
53
|
-
backgroundColor: isFocused ? '#f5f5f5' : '#fff'
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
control: controlCallback,
|
|
57
|
-
indicatorSeparator: noneCallback,
|
|
58
|
-
dropdownIndicator: noneCallback,
|
|
59
|
-
clearIndicator: noneCallback,
|
|
60
|
-
multiValue: provided => {
|
|
61
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
62
|
-
display: 'inline-flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
background: '#eaeaea',
|
|
65
|
-
borderRadius: '10px',
|
|
66
|
-
margin: '0 10px 0 0',
|
|
67
|
-
padding: '0 0 0 2px'
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
multiValueLabel: provided => {
|
|
71
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
72
|
-
padding: '0px'
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
multiValueRemove: provided => {
|
|
76
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
77
|
-
color: '#666',
|
|
78
|
-
':hover': {
|
|
79
|
-
backgroundColor: 'transparent',
|
|
80
|
-
color: '#555555'
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
singleValue: provided => {
|
|
85
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
86
|
-
display: 'inline-flex',
|
|
87
|
-
alignItems: 'center',
|
|
88
|
-
background: '#eaeaea',
|
|
89
|
-
borderRadius: '10px',
|
|
90
|
-
margin: '0',
|
|
91
|
-
padding: '0 2px',
|
|
92
|
-
width: 'fit-content'
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const MenuSelectStyle = exports.MenuSelectStyle = {
|
|
97
|
-
option: (provided, state) => {
|
|
98
|
-
const {
|
|
99
|
-
isDisabled,
|
|
100
|
-
isFocused
|
|
101
|
-
} = state;
|
|
102
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
103
|
-
padding: '8px',
|
|
104
|
-
fontSize: '14px',
|
|
105
|
-
color: '#212529',
|
|
106
|
-
cursor: isDisabled ? 'default' : 'pointer',
|
|
107
|
-
backgroundColor: isFocused ? '#f5f5f5' : '#fff',
|
|
108
|
-
borderRadius: '4px',
|
|
109
|
-
':active': {
|
|
110
|
-
backgroundColor: '#f5f5f5'
|
|
111
|
-
},
|
|
112
|
-
'.header-icon .dtable-font': {
|
|
113
|
-
color: '#999'
|
|
114
|
-
},
|
|
115
|
-
'.header-icon .multicolor-icon': {
|
|
116
|
-
color: '#999'
|
|
117
|
-
},
|
|
118
|
-
'.seatable-ui-select-tip': {
|
|
119
|
-
fontSize: '12px',
|
|
120
|
-
color: '#666666'
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
control: controlCallback,
|
|
125
|
-
menuPortal: base => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, base), {}, {
|
|
126
|
-
zIndex: 9999
|
|
127
|
-
}),
|
|
128
|
-
indicatorSeparator: noneCallback,
|
|
129
|
-
menuList: provided => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
130
|
-
padding: '8px'
|
|
131
|
-
}),
|
|
132
|
-
valueContainer: (provided, state) => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
133
|
-
padding: '2px 8px 2px 16px'
|
|
134
|
-
}),
|
|
135
|
-
dropdownIndicator: (provided, state) => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, provided), {}, {
|
|
136
|
-
padding: 0
|
|
137
|
-
})
|
|
138
|
-
};
|
|
139
|
-
const DropdownIndicator = props => {
|
|
140
|
-
return _reactSelect.components.DropdownIndicator && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.DropdownIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
141
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
142
|
-
className: "dtable-font dtable-icon-down3",
|
|
143
|
-
style: {
|
|
144
|
-
fontSize: '12px',
|
|
145
|
-
marginLeft: '-2px',
|
|
146
|
-
color: '#666666',
|
|
147
|
-
paddingRight: '16px'
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
}));
|
|
151
|
-
};
|
|
152
|
-
exports.DropdownIndicator = DropdownIndicator;
|
|
153
|
-
const ClearIndicator = _ref => {
|
|
154
|
-
let {
|
|
155
|
-
innerProps
|
|
156
|
-
} = _ref,
|
|
157
|
-
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
158
|
-
const onMouseDown = e => {
|
|
159
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
160
|
-
innerProps.onMouseDown(e);
|
|
161
|
-
};
|
|
162
|
-
props.innerProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, innerProps), {}, {
|
|
163
|
-
onMouseDown
|
|
164
|
-
});
|
|
165
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.ClearIndicator, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
166
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
167
|
-
className: "dtable-font dtable-icon-fork-number",
|
|
168
|
-
style: {
|
|
169
|
-
fontSize: '12px',
|
|
170
|
-
marginRight: '-2px'
|
|
171
|
-
}
|
|
172
|
-
})
|
|
173
|
-
}));
|
|
174
|
-
};
|
|
175
|
-
exports.ClearIndicator = ClearIndicator;
|
|
176
|
-
const MenuList = props => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
177
|
-
onClick: e => e.nativeEvent.stopImmediatePropagation(),
|
|
178
|
-
onMouseDown: e => e.nativeEvent.stopImmediatePropagation(),
|
|
179
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.MenuList, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
180
|
-
children: props.children
|
|
181
|
-
}))
|
|
182
|
-
});
|
|
183
|
-
exports.MenuList = MenuList;
|
|
184
|
-
const Option = props => {
|
|
185
|
-
const {
|
|
186
|
-
isSelected,
|
|
187
|
-
label
|
|
188
|
-
} = props;
|
|
189
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.components.Option, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
190
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
191
|
-
style: {
|
|
192
|
-
display: 'flex',
|
|
193
|
-
alignItems: 'center',
|
|
194
|
-
justifyContent: 'space-between',
|
|
195
|
-
width: '100%'
|
|
196
|
-
},
|
|
197
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
198
|
-
children: label
|
|
199
|
-
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
200
|
-
className: "dtable-font dtable-icon-check",
|
|
201
|
-
style: {
|
|
202
|
-
fontSize: '14px',
|
|
203
|
-
color: '#666666',
|
|
204
|
-
paddingLeft: '16px'
|
|
205
|
-
}
|
|
206
|
-
})]
|
|
207
|
-
})
|
|
208
|
-
}));
|
|
209
|
-
};
|
|
210
|
-
exports.Option = Option;
|
|
211
|
-
const processOptionsWithClear = (options, isClearable) => {
|
|
212
|
-
if (isClearable && options && options.length > 0) {
|
|
213
|
-
return [{
|
|
214
|
-
label: '--',
|
|
215
|
-
value: '__clear__'
|
|
216
|
-
}, ...options];
|
|
217
|
-
}
|
|
218
|
-
return options;
|
|
219
|
-
};
|
|
220
|
-
exports.processOptionsWithClear = processOptionsWithClear;
|
|
221
|
-
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => {
|
|
222
|
-
if (isMulti && Array.isArray(selectedOption)) {
|
|
223
|
-
const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__');
|
|
224
|
-
if (hasClear) {
|
|
225
|
-
onChangeCallback([], (0, _objectSpread2.default)((0, _objectSpread2.default)({}, actionMeta), {}, {
|
|
226
|
-
action: 'clear'
|
|
227
|
-
}));
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
} else if (selectedOption && selectedOption.value === '__clear__') {
|
|
231
|
-
onChangeCallback(null, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, actionMeta), {}, {
|
|
232
|
-
action: 'clear'
|
|
233
|
-
}));
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
onChangeCallback(selectedOption, actionMeta);
|
|
237
|
-
};
|
|
238
|
-
exports.handleSelectChange = handleSelectChange;
|
|
239
|
-
const createHandleChange = (onChange, isMulti) => {
|
|
240
|
-
return (selectedOption, actionMeta) => {
|
|
241
|
-
handleSelectChange(selectedOption, actionMeta, onChange, isMulti);
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
exports.createHandleChange = createHandleChange;
|