dtable-ui-component 6.0.110-pzy.2 → 6.0.110-sam.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.
@@ -107,7 +107,7 @@ class FilterItemUtils {
107
107
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
108
108
  className: "single-select-check-icon",
109
109
  children: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) === option.id && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
110
- className: "option-edit dtable-font dtable-icon-check-mark"
110
+ className: "option-edit dtable-font dtable-icon-check"
111
111
  })
112
112
  })]
113
113
  })
@@ -132,7 +132,7 @@ class FilterItemUtils {
132
132
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
133
133
  className: "multiple-check-icon",
134
134
  children: filterTerm.indexOf(option.id) > -1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
135
- className: "option-edit dtable-font dtable-icon-check-mark"
135
+ className: "option-edit dtable-font dtable-icon-check"
136
136
  })
137
137
  })]
138
138
  })
@@ -49,7 +49,7 @@ class CollaboratorFilter extends _react.Component {
49
49
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
50
  className: "collaborator-check-icon",
51
51
  children: isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
52
- className: "option-edit dtable-font dtable-icon-check-mark"
52
+ className: "option-edit dtable-font dtable-icon-check"
53
53
  })
54
54
  })]
55
55
  })
@@ -412,20 +412,20 @@
412
412
 
413
413
  .filter-header-icon {
414
414
  display: inline-block;
415
- padding: 0 0.3125rem;
415
+ padding-right: 0.5rem;
416
416
  margin-left: -0.3125rem;
417
417
  }
418
418
 
419
419
  .filter-header-icon .dtable-font,
420
420
  .filter-header-icon .multicolor-icon {
421
421
  font-size: 14px;
422
- color: #aaa;
422
+ color: #999;
423
423
  cursor: default;
424
424
  }
425
425
 
426
426
  .option.option-active .filter-header-icon .dtable-font,
427
427
  .option.option-active .filter-header-icon .multicolor-icon {
428
- color: #fff;
428
+ color: #999;
429
429
  }
430
430
 
431
431
  .dtable-ui-filters-list .single-select-option,
@@ -108,7 +108,7 @@
108
108
  border: none;
109
109
  border-bottom: 1px solid rgb(0 40 100 / 12%) !important;
110
110
  border-radius: 4px 4px 0 0;
111
- padding: .375rem .5rem !important;
111
+ padding: .375rem 1rem !important;
112
112
  height: 32px;
113
113
  }
114
114
 
@@ -118,21 +118,8 @@
118
118
  box-shadow: none !important;
119
119
  }
120
120
 
121
- .seatable-group-select .option-group-content .dtable-icon-check {
121
+ .option-group-content .dtable-icon-check {
122
122
  color: #666666;
123
123
  font-size: 14px;
124
- }
125
-
126
- .seatable-group-select .clear-search-text {
127
- position: absolute;
128
- display: inline-block;
129
- height: 12px;
130
- width: 12px;
131
- line-height: 12px;
132
- top: 4px;
133
- right: 22px;
134
- }
135
-
136
- .seatable-group-select .seatable-icon-btn:not(.disabled):hover {
137
- background-color:#FFFFFF;
124
+ margin-left: 16px;
138
125
  }
@@ -16,10 +16,10 @@
16
16
  padding: 0.25rem 8px;
17
17
  }
18
18
 
19
- .group-selector .option .dtable-icon-check-mark {
20
- font-size: 12px;
19
+ .group-selector .option .dtable-icon-check{
20
+ font-size: 14px;
21
21
  color: #666666;
22
- height: 12px !important;
22
+ height: 14px !important;
23
23
  display: flex;
24
24
  align-items: center;
25
25
  justify-content: center;
@@ -154,7 +154,7 @@ class SelectOptionGroup extends _react.Component {
154
154
  title: option.label,
155
155
  children: option.label
156
156
  }), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
157
- className: "dtable-font dtable-icon-check-mark"
157
+ className: "dtable-font dtable-icon-check"
158
158
  })]
159
159
  }, `${option.id}-${index}`);
160
160
  });
@@ -220,7 +220,7 @@ class SelectOptionGroup extends _react.Component {
220
220
  style: style,
221
221
  onMouseDown: this.onMouseDown,
222
222
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
223
- className: "position-relative mb-1",
223
+ className: "position-relative",
224
224
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableSearchInput.default, {
225
225
  className: "option-search-control",
226
226
  placeholder: searchPlaceholder,
@@ -230,14 +230,12 @@ class SelectOptionGroup extends _react.Component {
230
230
  clearValue: this.clearValue,
231
231
  components: {
232
232
  ClearIndicator: props => {
233
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
234
- className: "clear-search-text",
235
- onClick: props.clearValue,
236
- title: (0, _lang.getLocale)('Clear_search_text'),
237
- "aria-label": (0, _lang.getLocale)('Clear_search_text'),
238
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
239
- icon: "x"
240
- })
233
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
234
+ className: (0, _classnames.default)('select-search-text-clear input-icon-addon seatable-icon dtable-font dtable-icon-x'),
235
+ onClick: e => {
236
+ e.stopPropagation();
237
+ props.clearValue();
238
+ }
241
239
  });
242
240
  }
243
241
  }
@@ -33,9 +33,10 @@ class DTableSelect extends _react.default.Component {
33
33
  const processedOptions = (0, _utils.processOptionsWithClear)(options, isClearable);
34
34
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
35
35
  value: value,
36
- onChange: (0, _utils.createHandleChange)(onChange),
36
+ onChange: (0, _utils.createHandleChange)(onChange, isMulti),
37
37
  options: processedOptions,
38
38
  isMulti: isMulti,
39
+ isClearable: false,
39
40
  className: className,
40
41
  classNamePrefix: classNamePrefix,
41
42
  styles: style || _utils.MenuSelectStyle,
@@ -239,20 +239,29 @@ const processOptionsWithClear = (options, isClearable) => {
239
239
  return options;
240
240
  };
241
241
  exports.processOptionsWithClear = processOptionsWithClear;
242
- const handleSelectChange = (selectedOption, actionMeta, onChangeCallback) => {
243
- if (selectedOption && selectedOption.value === '__clear__') {
242
+ const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => {
243
+ if (isMulti && Array.isArray(selectedOption)) {
244
+ const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__');
245
+ if (hasClear) {
246
+ onChangeCallback([], {
247
+ ...actionMeta,
248
+ action: 'clear'
249
+ });
250
+ return;
251
+ }
252
+ } else if (selectedOption && selectedOption.value === '__clear__') {
244
253
  onChangeCallback(null, {
245
254
  ...actionMeta,
246
255
  action: 'clear'
247
256
  });
248
- } else {
249
- onChangeCallback(selectedOption, actionMeta);
257
+ return;
250
258
  }
259
+ onChangeCallback(selectedOption, actionMeta);
251
260
  };
252
261
  exports.handleSelectChange = handleSelectChange;
253
- const createHandleChange = onChange => {
262
+ const createHandleChange = (onChange, isMulti) => {
254
263
  return (selectedOption, actionMeta) => {
255
- handleSelectChange(selectedOption, actionMeta, onChange);
264
+ handleSelectChange(selectedOption, actionMeta, onChange, isMulti);
256
265
  };
257
266
  };
258
267
  exports.createHandleChange = createHandleChange;
@@ -6,7 +6,7 @@
6
6
  min-height: 60px;
7
7
  min-width: 100%;
8
8
  max-width: 15rem;
9
- padding-top: 0.25rem;
9
+ padding-top: 0;
10
10
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
11
11
  background: #fff;
12
12
  border: 1px solid rgba(0, 40, 100, 0.12);
@@ -17,11 +17,18 @@
17
17
  .option-group .option-group-search {
18
18
  width: 100%;
19
19
  min-width: 170px;
20
- padding: 0 0 8px 0 !important;
20
+ }
21
+
22
+ .option-group .option-group-content .label-space {
23
+ display: flex;
24
+ justify-content: space-between;
25
+ align-items: center;
26
+ width: 100%;
21
27
  }
22
28
 
23
29
  .option-group-search .form-control {
24
30
  height: 32px;
31
+ border-radius: 4px;
25
32
  }
26
33
 
27
34
  .option-group .none-search-result {
@@ -34,6 +41,7 @@
34
41
  flex: 1;
35
42
  max-height: 252px;
36
43
  overflow-y: auto;
44
+ padding: 8px;
37
45
  }
38
46
 
39
47
  .option-group .option-group-top {
@@ -44,7 +52,7 @@
44
52
  display: block;
45
53
  width: 100%;
46
54
  line-height: 24px;
47
- padding: 0.25rem 10px;
55
+ padding: 0.25rem 8px;
48
56
  clear: both;
49
57
  font-weight: 400;
50
58
  text-align: inherit;
@@ -53,30 +61,40 @@
53
61
  overflow: hidden;
54
62
  text-overflow: ellipsis;
55
63
  white-space: nowrap;
64
+ border-radius: 4px;
56
65
  }
57
66
 
58
- .option.option-active {
59
- background-color: #f5f5f5;
60
- color: #212529;
61
- cursor: pointer;
67
+ .option-group .option-group-search .form-control {
68
+ border: none;
69
+ border-bottom: 1px solid rgb(0 40 100 / 12%) !important;
70
+ border-radius: 4px 4px 0 0;
71
+ padding: .375rem 1rem !important;
72
+ height: 32px;
62
73
  }
63
74
 
64
- .option:hover .header-icon .dtable-font,
65
- .option:hover .header-icon .multicolor-icon,
66
- .option.option-active .select-option-name {
67
- color: #fff;
75
+ .option-group .option-group-search .form-control:focus {
76
+ border-color: transparent !important;
77
+ border-bottom: 1px solid rgb(0 40 100 / 12%) !important;
78
+ box-shadow: none !important;
68
79
  }
69
80
 
70
- .option.option-active .header-icon .dtable-font,
71
- .option.option-active .header-icon .multicolor-icon {
72
- color: #fff;
81
+
82
+ .option-group-content .label-check-icon {
83
+ margin-left: 16px;
84
+ }
85
+
86
+ .option-group-content .dtable-icon-check {
87
+ font-size: 14px !important;
88
+ color: #666666;
73
89
  }
74
90
 
75
- .option:not(.option-active):hover .header-icon .dtable-font,
76
- .option:not(.option-active):hover .header-icon .multicolor-icon {
77
- color: #aaa;
91
+ .option.option-active {
92
+ background-color: #f5f5f5;
93
+ color: #212529;
94
+ cursor: pointer;
78
95
  }
79
96
 
97
+
80
98
  .option .select-option-name .multiple-select-option {
81
99
  margin: 0;
82
100
  }
@@ -132,10 +132,17 @@ class SelectOptionGroup extends _react.Component {
132
132
  });
133
133
  }
134
134
  };
135
+ this.isEqual = (obj1, obj2) => {
136
+ if (obj1 === obj2) return true;
137
+ if (!obj1 || !obj2) return false;
138
+ return JSON.stringify(obj1) === JSON.stringify(obj2);
139
+ };
135
140
  this.renderOptGroup = searchVal => {
136
141
  let {
137
142
  noOptionsPlaceholder,
138
- onSelectOption
143
+ onSelectOption,
144
+ value,
145
+ supportMultipleSelect
139
146
  } = this.props;
140
147
  this.filterOptions = this.props.getFilterOptions(searchVal);
141
148
  if (this.filterOptions.length === 0) {
@@ -147,6 +154,7 @@ class SelectOptionGroup extends _react.Component {
147
154
  return this.filterOptions.map((opt, i) => {
148
155
  let key = opt.value.column ? opt.value.column.key : i;
149
156
  let isActive = this.state.activeIndex === i;
157
+ let isSelected = value && typeof value === 'object' && !supportMultipleSelect ? this.isEqual(value.value, opt.value) : Array.isArray(value.value) ? value.value.includes(opt.value.column_key) : false;
150
158
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_option.default, {
151
159
  index: i,
152
160
  isActive: isActive,
@@ -155,10 +163,26 @@ class SelectOptionGroup extends _react.Component {
155
163
  changeIndex: this.changeIndex,
156
164
  supportMultipleSelect: this.props.supportMultipleSelect,
157
165
  disableHover: this.state.disableHover,
158
- children: opt.label
166
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
167
+ className: "label-space",
168
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
169
+ children: [" ", opt.label]
170
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
171
+ className: "label-check-icon",
172
+ children: [" ", isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
173
+ className: "dtable-font dtable-icon-check"
174
+ })]
175
+ })]
176
+ })
159
177
  }, `${key}-${i}`);
160
178
  });
161
179
  };
180
+ this.clearValue = () => {
181
+ this.setState({
182
+ searchVal: '',
183
+ activeIndex: -1
184
+ });
185
+ };
162
186
  this.state = {
163
187
  searchVal: '',
164
188
  activeIndex: -1,
@@ -243,7 +267,17 @@ class SelectOptionGroup extends _react.Component {
243
267
  placeholder: searchPlaceholder,
244
268
  onChange: this.onChangeSearch,
245
269
  autoFocus: true,
246
- ref: this.searchInputRef
270
+ ref: this.searchInputRef,
271
+ clearValue: this.clearValue,
272
+ isClearable: true,
273
+ components: {
274
+ ClearIndicator: props => {
275
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
276
+ className: (0, _classnames.default)('select-search-text-clear input-icon-addon seatable-icon dtable-font dtable-icon-x'),
277
+ onClick: props.clearValue
278
+ });
279
+ }
280
+ }
247
281
  })
248
282
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
249
283
  className: `option-group-content ${!searchable && !supportMultipleSelect ? 'option-group-top' : ''}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "6.0.110-pzy.2",
3
+ "version": "6.0.110-sam.11",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "^5.0.4",