@capillarytech/blaze-ui 0.1.6-alpha.61 → 0.1.6-alpha.62
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.
|
@@ -151,7 +151,7 @@ const CapUnifiedSelect = ({
|
|
|
151
151
|
showSearch = true,
|
|
152
152
|
searchBasedOn = 'label',
|
|
153
153
|
onConfirm,
|
|
154
|
-
|
|
154
|
+
clearText,
|
|
155
155
|
noResultCustomText = 'No results found',
|
|
156
156
|
noResultCustomIcon = 'warning',
|
|
157
157
|
...rest
|
|
@@ -220,11 +220,12 @@ const CapUnifiedSelect = ({
|
|
|
220
220
|
onConfirm?.(tempValue);
|
|
221
221
|
}, [onChange, onConfirm, tempValue]);
|
|
222
222
|
|
|
223
|
-
const
|
|
224
|
-
setTempValue(
|
|
223
|
+
const handleClearAll = useCallback(() => {
|
|
224
|
+
setTempValue([]);
|
|
225
|
+
onChange?.([]);
|
|
225
226
|
setDropdownOpen(false);
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
}, [onChange]);
|
|
228
|
+
|
|
228
229
|
|
|
229
230
|
const handleDropdownVisibilityChange = useCallback((open) => {
|
|
230
231
|
if (!open && !customPopupRender) {
|
|
@@ -332,9 +333,9 @@ const CapUnifiedSelect = ({
|
|
|
332
333
|
type="text"
|
|
333
334
|
className="cap-unified-select-cancel-button"
|
|
334
335
|
size="small"
|
|
335
|
-
onClick={
|
|
336
|
+
onClick={handleClearAll}
|
|
336
337
|
>
|
|
337
|
-
|
|
338
|
+
Clear all
|
|
338
339
|
</Button>
|
|
339
340
|
<CapLabel className="cap-unified-select-selected-count">
|
|
340
341
|
{selectedLeafCount} selected
|
|
@@ -342,6 +343,12 @@ const CapUnifiedSelect = ({
|
|
|
342
343
|
</div>
|
|
343
344
|
</div>
|
|
344
345
|
)}
|
|
346
|
+
|
|
347
|
+
{(type === 'select' || type === 'treeSelect') && (
|
|
348
|
+
<CapRow className="cap-unified-select-tree-clear-container">
|
|
349
|
+
<CapLabel className="cap-unified-select-tree-clear-label" onClick={handleClearAll}>{clearText}</CapLabel>
|
|
350
|
+
</CapRow>
|
|
351
|
+
)}
|
|
345
352
|
</div>
|
|
346
353
|
);
|
|
347
354
|
},
|
|
@@ -358,7 +365,7 @@ const CapUnifiedSelect = ({
|
|
|
358
365
|
type,
|
|
359
366
|
tempValue,
|
|
360
367
|
handleConfirm,
|
|
361
|
-
|
|
368
|
+
handleClearAll,
|
|
362
369
|
popoverClassName,
|
|
363
370
|
className,
|
|
364
371
|
selectedLeafCount,
|
|
@@ -430,12 +437,12 @@ CapUnifiedSelect.propTypes = {
|
|
|
430
437
|
showSearch: PropTypes.bool,
|
|
431
438
|
searchBasedOn: PropTypes.oneOf(['label', 'value', 'key']),
|
|
432
439
|
onConfirm: PropTypes.func,
|
|
433
|
-
onCancel: PropTypes.func,
|
|
434
440
|
isError: PropTypes.bool,
|
|
435
441
|
errorMessage: PropTypes.string,
|
|
436
442
|
popupClassName: PropTypes.string,
|
|
437
443
|
showUpload: PropTypes.bool,
|
|
438
444
|
onUpload: PropTypes.func,
|
|
445
|
+
clearText: PropTypes.string,
|
|
439
446
|
};
|
|
440
447
|
|
|
441
448
|
CapUnifiedSelect.defaultProps = {
|
|
@@ -444,6 +451,7 @@ CapUnifiedSelect.defaultProps = {
|
|
|
444
451
|
searchBasedOn: 'label',
|
|
445
452
|
noResultCustomText: 'No results found',
|
|
446
453
|
noResultCustomIcon: 'warning',
|
|
454
|
+
clearText: 'Clear',
|
|
447
455
|
options: [],
|
|
448
456
|
allowClear: false,
|
|
449
457
|
customPopupRender: true,
|
|
@@ -278,17 +278,15 @@ export const selectStyles = css`
|
|
|
278
278
|
display: flex;
|
|
279
279
|
padding-left: 8px;
|
|
280
280
|
align-items: center;
|
|
281
|
-
width: 100%; /* so it can push the label */
|
|
282
|
-
button {
|
|
283
|
-
height: 32px;
|
|
284
|
-
width: 94px;
|
|
285
|
-
}
|
|
286
281
|
.cap-unified-select-confirm-button {
|
|
287
282
|
background-color: #6ebd6e;
|
|
283
|
+
height: 32px;
|
|
284
|
+
width: 94px;
|
|
288
285
|
}
|
|
289
286
|
.cap-unified-select-cancel-button {
|
|
290
287
|
border: transparent;
|
|
291
288
|
box-shadow: none;
|
|
289
|
+
width: 80px;
|
|
292
290
|
}
|
|
293
291
|
}
|
|
294
292
|
.cap-unified-select-selected-count {
|
|
@@ -324,6 +322,22 @@ export const selectStyles = css`
|
|
|
324
322
|
box-shadow: none !important;
|
|
325
323
|
}
|
|
326
324
|
}
|
|
325
|
+
.cap-unified-select-tree-clear-container{
|
|
326
|
+
display: flex;
|
|
327
|
+
justify-content: center;
|
|
328
|
+
align-items: center;
|
|
329
|
+
height: 40px;
|
|
330
|
+
border-top: 1px solid #EBECF0;
|
|
331
|
+
cursor: pointer;
|
|
332
|
+
color: #091E42;
|
|
333
|
+
&:hover{
|
|
334
|
+
background-color: #EBECF0;
|
|
335
|
+
}
|
|
336
|
+
.cap-unified-select-tree-clear-label{
|
|
337
|
+
font-size: 14px;
|
|
338
|
+
font-weight: 400;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
327
341
|
}
|
|
328
342
|
|
|
329
343
|
&.custom-popup-container {
|
package/package.json
CHANGED