funda-ui 4.3.355 → 4.3.721
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/DynamicFields/index.d.ts +1 -0
- package/DynamicFields/index.js +23 -3
- package/EventCalendar/index.css +150 -106
- package/EventCalendar/index.d.ts +11 -2
- package/EventCalendar/index.js +835 -151
- package/EventCalendarTimeline/index.css +293 -251
- package/EventCalendarTimeline/index.d.ts +18 -9
- package/EventCalendarTimeline/index.js +1077 -505
- package/MultipleCheckboxes/index.d.ts +1 -0
- package/MultipleCheckboxes/index.js +17 -7
- package/MultipleSelect/index.d.ts +4 -0
- package/MultipleSelect/index.js +54 -8
- package/NativeSelect/index.js +1 -0
- package/Radio/index.d.ts +2 -1
- package/Radio/index.js +54 -24
- package/Select/index.js +115 -42
- package/Table/index.js +27 -3
- package/lib/cjs/DynamicFields/index.d.ts +1 -0
- package/lib/cjs/DynamicFields/index.js +23 -3
- package/lib/cjs/EventCalendar/index.d.ts +11 -2
- package/lib/cjs/EventCalendar/index.js +835 -151
- package/lib/cjs/EventCalendarTimeline/index.d.ts +18 -9
- package/lib/cjs/EventCalendarTimeline/index.js +1077 -505
- package/lib/cjs/MultipleCheckboxes/index.d.ts +1 -0
- package/lib/cjs/MultipleCheckboxes/index.js +17 -7
- package/lib/cjs/MultipleSelect/index.d.ts +4 -0
- package/lib/cjs/MultipleSelect/index.js +54 -8
- package/lib/cjs/NativeSelect/index.js +1 -0
- package/lib/cjs/Radio/index.d.ts +2 -1
- package/lib/cjs/Radio/index.js +54 -24
- package/lib/cjs/Select/index.js +115 -42
- package/lib/cjs/Table/index.js +27 -3
- package/lib/css/EventCalendar/index.css +150 -106
- package/lib/css/EventCalendarTimeline/index.css +293 -251
- package/lib/esm/DynamicFields/index.tsx +28 -3
- package/lib/esm/EventCalendar/index.scss +172 -104
- package/lib/esm/EventCalendar/index.tsx +272 -139
- package/lib/esm/EventCalendarTimeline/index.scss +275 -213
- package/lib/esm/EventCalendarTimeline/index.tsx +706 -708
- package/lib/esm/MultipleCheckboxes/index.tsx +18 -5
- package/lib/esm/MultipleSelect/ItemList.tsx +1 -0
- package/lib/esm/MultipleSelect/index.tsx +103 -52
- package/lib/esm/NativeSelect/index.tsx +2 -0
- package/lib/esm/Radio/index.tsx +68 -27
- package/lib/esm/Select/index.tsx +236 -65
- package/lib/esm/Table/Table.tsx +1 -0
- package/lib/esm/Table/TableCell.tsx +6 -0
- package/lib/esm/Table/table-utils/ToggleSelection.tsx +17 -2
- package/package.json +1 -1
package/lib/esm/Select/index.tsx
CHANGED
|
@@ -49,8 +49,6 @@ import {
|
|
|
49
49
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
52
|
export type SelectOptionChangeFnType = (arg1: any, arg2: any, arg3: any) => void;
|
|
55
53
|
|
|
56
54
|
export interface MultiSelectDataConfig {
|
|
@@ -215,8 +213,8 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
215
213
|
|
|
216
214
|
|
|
217
215
|
const DEPTH = depth || 1055; // the default value same as bootstrap
|
|
218
|
-
const
|
|
219
|
-
const LIVE_SEARCH_DISABLED =
|
|
216
|
+
const MANUAL_REQ = typeof fetchTrigger !== 'undefined' && fetchTrigger === true ? true : false; // Manual requests
|
|
217
|
+
const LIVE_SEARCH_DISABLED = !MANUAL_REQ && typeof window !== 'undefined' && typeof (window as any)['funda-ui__Select-disable-livesearch'] !== 'undefined' ? true : false; // Globally disable real-time search functionality (only valid for non-dynamic requests)
|
|
220
218
|
|
|
221
219
|
|
|
222
220
|
const FIRST_REQUEST_AUTO = typeof firstRequestAutoExec === 'undefined' ? true : firstRequestAutoExec;
|
|
@@ -312,6 +310,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
312
310
|
|
|
313
311
|
if (MULTI_SEL_VALID) popwinPosHide();
|
|
314
312
|
},
|
|
313
|
+
open: () => {
|
|
314
|
+
activate();
|
|
315
|
+
},
|
|
316
|
+
|
|
315
317
|
}),
|
|
316
318
|
[popupRef],
|
|
317
319
|
);
|
|
@@ -321,7 +323,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
321
323
|
() => ({
|
|
322
324
|
active: () => {
|
|
323
325
|
handleShowList();
|
|
326
|
+
selectInputRef.current.select();
|
|
324
327
|
},
|
|
328
|
+
|
|
325
329
|
focus: () => {
|
|
326
330
|
selectInputRef.current.select();
|
|
327
331
|
},
|
|
@@ -409,7 +413,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
409
413
|
//performance
|
|
410
414
|
const handleChangeFetchSafe = useDebounce((val: any) => {
|
|
411
415
|
|
|
412
|
-
|
|
413
416
|
let _orginalData: OptionConfig[] = [];
|
|
414
417
|
const update = (inputData: any) => {
|
|
415
418
|
const filterRes = () => {
|
|
@@ -528,7 +531,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
528
531
|
let filterRes: any = [];
|
|
529
532
|
|
|
530
533
|
|
|
531
|
-
if (
|
|
534
|
+
if (MANUAL_REQ) {
|
|
532
535
|
|
|
533
536
|
// If a manual action is used to trigger the request
|
|
534
537
|
if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof fetchTriggerForDefaultData?.values[0] !== 'undefined') {
|
|
@@ -1126,7 +1129,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1126
1129
|
if (!MULTI_SEL_VALID) popwinPosHide();
|
|
1127
1130
|
|
|
1128
1131
|
|
|
1129
|
-
if (
|
|
1132
|
+
if (MANUAL_REQ) {
|
|
1130
1133
|
// clean data
|
|
1131
1134
|
setOptionsData([]);
|
|
1132
1135
|
} else {
|
|
@@ -1168,6 +1171,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1168
1171
|
setIsOpen(true);
|
|
1169
1172
|
|
|
1170
1173
|
|
|
1174
|
+
|
|
1171
1175
|
// pop win initalization
|
|
1172
1176
|
setTimeout(() => {
|
|
1173
1177
|
popwinPosInit();
|
|
@@ -1184,7 +1188,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1184
1188
|
|
|
1185
1189
|
|
|
1186
1190
|
|
|
1187
|
-
if (
|
|
1191
|
+
if (MANUAL_REQ) {
|
|
1188
1192
|
// clean data
|
|
1189
1193
|
setOptionsData([]);
|
|
1190
1194
|
} else {
|
|
@@ -1193,6 +1197,11 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1193
1197
|
}
|
|
1194
1198
|
|
|
1195
1199
|
|
|
1200
|
+
// When you select multiple times, it automatically focuses on the search input box
|
|
1201
|
+
if (MULTI_SEL_VALID) {
|
|
1202
|
+
selectInputRef.current.select();
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1196
1205
|
// update temporary value
|
|
1197
1206
|
setControlTempValue('');
|
|
1198
1207
|
|
|
@@ -1206,6 +1215,12 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1206
1215
|
|
|
1207
1216
|
|
|
1208
1217
|
}
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
function fixFocusStatus() {
|
|
1221
|
+
// When selecting multiple times, in order to avoid losing
|
|
1222
|
+
if (MULTI_SEL_VALID) handleFocus(selectInputRef.current);
|
|
1223
|
+
}
|
|
1209
1224
|
|
|
1210
1225
|
async function handleSelect(el: any, dataInput: any = false, valueArr: any[] = [], labelArr: any[] = []) {
|
|
1211
1226
|
|
|
@@ -1220,24 +1235,34 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1220
1235
|
const incominggetOptionsData = valueInputRef.current.dataset.options;
|
|
1221
1236
|
|
|
1222
1237
|
|
|
1223
|
-
// cancel
|
|
1224
|
-
if (!(MULTI_SEL_VALID)) {
|
|
1225
|
-
cancel();
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
//remove focus style
|
|
1229
|
-
if (!(MULTI_SEL_VALID)) {
|
|
1230
|
-
rootRef.current?.classList.remove('focus');
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
1238
|
// get options
|
|
1234
1239
|
const options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.hide):not(.no-match)'));
|
|
1235
1240
|
|
|
1236
1241
|
|
|
1237
1242
|
// current control of some option
|
|
1238
|
-
const curBtn = options.filter((node: HTMLElement) => node.dataset.itemdata == JSON.stringify(curItem))[0];
|
|
1243
|
+
const curBtn: any = options.filter((node: HTMLElement) => node.dataset.itemdata == JSON.stringify(curItem))[0];
|
|
1239
1244
|
|
|
1240
1245
|
|
|
1246
|
+
// Determine whether there is a callback
|
|
1247
|
+
const noCallback = typeof curItem.callback === 'undefined';
|
|
1248
|
+
|
|
1249
|
+
// ==========================================================================
|
|
1250
|
+
// Whether to cancel or not
|
|
1251
|
+
// ==========================================================================
|
|
1252
|
+
if (noCallback) {
|
|
1253
|
+
// cancel
|
|
1254
|
+
if (!MULTI_SEL_VALID) {
|
|
1255
|
+
cancel();
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
//remove focus style
|
|
1259
|
+
if (!MULTI_SEL_VALID) {
|
|
1260
|
+
rootRef.current?.classList.remove('focus');
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1241
1266
|
// update value * label
|
|
1242
1267
|
if (dataInput) {
|
|
1243
1268
|
|
|
@@ -1255,15 +1280,23 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1255
1280
|
_data.callback?.();
|
|
1256
1281
|
|
|
1257
1282
|
|
|
1258
|
-
|
|
1259
1283
|
// ++++++++++++++++++++
|
|
1260
1284
|
// Single selection
|
|
1261
1285
|
// ++++++++++++++++++++
|
|
1262
1286
|
// clear all active classes of options
|
|
1263
1287
|
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1288
|
+
if (noCallback) {
|
|
1289
|
+
options.forEach((node: any) => {
|
|
1290
|
+
node.classList.remove('active');
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// If there is a callback, delete the activated style
|
|
1295
|
+
if (!noCallback) {
|
|
1296
|
+
setTimeout(() => {
|
|
1297
|
+
curBtn.classList.remove('active', 'disabled');
|
|
1298
|
+
}, 0);
|
|
1299
|
+
}
|
|
1267
1300
|
|
|
1268
1301
|
|
|
1269
1302
|
|
|
@@ -1277,6 +1310,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1277
1310
|
valueInputRef.current.dataset.value = _value;
|
|
1278
1311
|
}
|
|
1279
1312
|
|
|
1313
|
+
|
|
1280
1314
|
|
|
1281
1315
|
// ++++++++++++++++++++
|
|
1282
1316
|
// Multiple selection
|
|
@@ -1347,16 +1381,19 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1347
1381
|
|
|
1348
1382
|
|
|
1349
1383
|
// active current option
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1384
|
+
if (noCallback) {
|
|
1385
|
+
setTimeout(() => {
|
|
1386
|
+
$el.classList.add('active');
|
|
1387
|
+
}, 0);
|
|
1388
|
+
|
|
1389
|
+
}
|
|
1353
1390
|
|
|
1354
1391
|
|
|
1355
1392
|
|
|
1356
1393
|
}
|
|
1357
1394
|
|
|
1358
1395
|
//
|
|
1359
|
-
if (typeof (onChange) === 'function') {
|
|
1396
|
+
if (noCallback && typeof (onChange) === 'function') {
|
|
1360
1397
|
|
|
1361
1398
|
onChange?.(
|
|
1362
1399
|
selectInputRef.current,
|
|
@@ -1388,17 +1425,29 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1388
1425
|
// ++++++++++++++++++++
|
|
1389
1426
|
curItem.callback?.();
|
|
1390
1427
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
1428
|
// ++++++++++++++++++++
|
|
1394
1429
|
// Single selection
|
|
1395
1430
|
// ++++++++++++++++++++
|
|
1396
1431
|
|
|
1397
1432
|
// clear all active classes of options
|
|
1398
1433
|
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1434
|
+
if (noCallback) {
|
|
1435
|
+
options.forEach((node: any) => {
|
|
1436
|
+
node.classList.remove('active');
|
|
1437
|
+
});
|
|
1438
|
+
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
// If there is a callback, delete the activated style
|
|
1444
|
+
if (!noCallback) {
|
|
1445
|
+
setTimeout(() => {
|
|
1446
|
+
curBtn.classList.remove('active', 'disabled');
|
|
1447
|
+
}, 0);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
|
|
1402
1451
|
|
|
1403
1452
|
//
|
|
1404
1453
|
setControlValue(_value);
|
|
@@ -1410,7 +1459,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1410
1459
|
}
|
|
1411
1460
|
|
|
1412
1461
|
|
|
1413
|
-
|
|
1414
1462
|
// ++++++++++++++++++++
|
|
1415
1463
|
// Multiple selection
|
|
1416
1464
|
// ++++++++++++++++++++
|
|
@@ -1483,15 +1531,18 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1483
1531
|
adjustMultiControlContainerHeight();
|
|
1484
1532
|
|
|
1485
1533
|
// active current option
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1534
|
+
if (noCallback) {
|
|
1535
|
+
setTimeout(() => {
|
|
1536
|
+
$el.classList.add('active');
|
|
1537
|
+
}, 0);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1489
1540
|
|
|
1490
1541
|
|
|
1491
1542
|
}
|
|
1492
1543
|
|
|
1493
1544
|
//
|
|
1494
|
-
if (typeof (onChange) === 'function') {
|
|
1545
|
+
if (noCallback && typeof (onChange) === 'function') {
|
|
1495
1546
|
|
|
1496
1547
|
onChange?.(
|
|
1497
1548
|
selectInputRef.current,
|
|
@@ -1505,6 +1556,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1505
1556
|
}
|
|
1506
1557
|
}
|
|
1507
1558
|
|
|
1559
|
+
// Fixed an out-of-focus issue
|
|
1560
|
+
fixFocusStatus();
|
|
1561
|
+
|
|
1508
1562
|
}
|
|
1509
1563
|
|
|
1510
1564
|
|
|
@@ -1613,6 +1667,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1613
1667
|
multipleSelectionCallback(_values, _labels)
|
|
1614
1668
|
);
|
|
1615
1669
|
|
|
1670
|
+
// Fixed an out-of-focus issue
|
|
1671
|
+
fixFocusStatus();
|
|
1672
|
+
|
|
1616
1673
|
|
|
1617
1674
|
}
|
|
1618
1675
|
|
|
@@ -1626,12 +1683,6 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1626
1683
|
const emptyValue: Record<string, string> = { label: '', value: '', queryString: '' };
|
|
1627
1684
|
handleSelect(null, JSON.stringify(emptyValue), [], []);
|
|
1628
1685
|
|
|
1629
|
-
onChange?.(
|
|
1630
|
-
selectInputRef.current,
|
|
1631
|
-
valueInputRef.current,
|
|
1632
|
-
emptyValue
|
|
1633
|
-
);
|
|
1634
|
-
|
|
1635
1686
|
// update temporary value
|
|
1636
1687
|
setControlTempValue(null);
|
|
1637
1688
|
|
|
@@ -1720,7 +1771,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1720
1771
|
|
|
1721
1772
|
async function handleFirstFetch(inputVal: any = null) {
|
|
1722
1773
|
const _oparams: any[] = fetchFuncMethodParams || [];
|
|
1723
|
-
const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (
|
|
1774
|
+
const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_STRING' ? item : (MANUAL_REQ ? '------' : ''));
|
|
1724
1775
|
const res = await fetchData((_params).join(','), finalRes(inputVal), inputVal);
|
|
1725
1776
|
|
|
1726
1777
|
return res;
|
|
@@ -1750,6 +1801,9 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1750
1801
|
//
|
|
1751
1802
|
handleChangeFetchSafe(val);
|
|
1752
1803
|
|
|
1804
|
+
// Fixed an out-of-focus issue
|
|
1805
|
+
fixFocusStatus();
|
|
1806
|
+
|
|
1753
1807
|
|
|
1754
1808
|
}
|
|
1755
1809
|
|
|
@@ -1761,8 +1815,10 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1761
1815
|
// update temporary value
|
|
1762
1816
|
setControlTempValue('');
|
|
1763
1817
|
|
|
1818
|
+
|
|
1764
1819
|
//
|
|
1765
|
-
onFocus?.(
|
|
1820
|
+
onFocus?.(selectInputRef.current);
|
|
1821
|
+
|
|
1766
1822
|
}
|
|
1767
1823
|
|
|
1768
1824
|
function handleBlur(event: any) {
|
|
@@ -1783,7 +1839,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1783
1839
|
|
|
1784
1840
|
|
|
1785
1841
|
setTimeout(() => {
|
|
1786
|
-
onBlur?.(
|
|
1842
|
+
onBlur?.(selectInputRef.current);
|
|
1787
1843
|
}, 300);
|
|
1788
1844
|
}
|
|
1789
1845
|
|
|
@@ -1920,6 +1976,19 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1920
1976
|
|
|
1921
1977
|
}
|
|
1922
1978
|
|
|
1979
|
+
function handleDocOut(e: any) {
|
|
1980
|
+
|
|
1981
|
+
if (e.target.closest('.custom-select__options-wrapper') === null && e.target.closest('.custom-select__wrapper') === null) {
|
|
1982
|
+
// cancel
|
|
1983
|
+
cancel();
|
|
1984
|
+
if (MULTI_SEL_VALID) popwinPosHide();
|
|
1985
|
+
|
|
1986
|
+
//
|
|
1987
|
+
handleBlur(null);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
|
|
1923
1992
|
useEffect(() => {
|
|
1924
1993
|
|
|
1925
1994
|
|
|
@@ -1970,6 +2039,20 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
1970
2039
|
}, []);
|
|
1971
2040
|
|
|
1972
2041
|
|
|
2042
|
+
|
|
2043
|
+
// Fixed an out-of-focus issue
|
|
2044
|
+
//--------------
|
|
2045
|
+
// !!! TIPS:
|
|
2046
|
+
// Fixed: When `fixFocusStatus()` is triggered, the above judgment will be invalidated, and this judgment will be used
|
|
2047
|
+
// Fixed: The pop-up window is not closed due to the mixing of business components
|
|
2048
|
+
useEffect(() => {
|
|
2049
|
+
document.addEventListener('pointerdown', handleDocOut);
|
|
2050
|
+
return () => {
|
|
2051
|
+
document.removeEventListener('pointerdown', handleDocOut);
|
|
2052
|
+
};
|
|
2053
|
+
}, [orginalData]); // Avoid the issue that `setOptionsData(orginalData)` sets the original value to empty on the first entry
|
|
2054
|
+
|
|
2055
|
+
|
|
1973
2056
|
return (
|
|
1974
2057
|
<>
|
|
1975
2058
|
|
|
@@ -2031,7 +2114,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2031
2114
|
required={required || null}
|
|
2032
2115
|
readOnly={INPUT_READONLY}
|
|
2033
2116
|
value={controlTempValue || controlTempValue === '' ? controlTempValue : (MULTI_SEL_VALID ? (VALUE_BY_BRACKETS ? convertArrToValByBrackets(formatIndentVal(controlArr.labels, INDENT_LAST_PLACEHOLDER).map((v: any) => stripHTML(v))) : formatIndentVal(controlArr.labels, INDENT_LAST_PLACEHOLDER).map((v: any) => stripHTML(v)).join(',')) : stripHTML(controlLabel as never))} // do not use `defaultValue`
|
|
2034
|
-
|
|
2117
|
+
|
|
2035
2118
|
style={{
|
|
2036
2119
|
cursor: 'pointer',
|
|
2037
2120
|
color: 'transparent',
|
|
@@ -2124,7 +2207,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2124
2207
|
{
|
|
2125
2208
|
'reverse': isOpen
|
|
2126
2209
|
}
|
|
2127
|
-
)} style={{display:
|
|
2210
|
+
)} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
|
|
2128
2211
|
{controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
|
|
2129
2212
|
<g stroke="none" strokeWidth="1" fill="none">
|
|
2130
2213
|
<g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
|
|
@@ -2143,7 +2226,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2143
2226
|
|
|
2144
2227
|
|
|
2145
2228
|
{/* SEARCH BUTTON */}
|
|
2146
|
-
{
|
|
2229
|
+
{MANUAL_REQ ? <>
|
|
2147
2230
|
<span className="custom-select-multi__control-searchbtn">
|
|
2148
2231
|
<button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
|
|
2149
2232
|
handleFetch().then((response: any) => {
|
|
@@ -2186,25 +2269,113 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2186
2269
|
{typeof multiSelectSelectedItemOnlyStatus !== 'undefined' ? <>
|
|
2187
2270
|
|
|
2188
2271
|
<li className="custom-select-multi__list-item-statusstring" >
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
{
|
|
2272
|
+
|
|
2273
|
+
|
|
2274
|
+
{MANUAL_REQ ? <>
|
|
2275
|
+
{/* ===================== Manual requests ===================== */}
|
|
2276
|
+
{
|
|
2277
|
+
typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
|
|
2278
|
+
controlArr.labels.length > 0
|
|
2279
|
+
?
|
|
2280
|
+
multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2281
|
+
:
|
|
2282
|
+
null
|
|
2283
|
+
}
|
|
2284
|
+
{
|
|
2285
|
+
typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
|
|
2286
|
+
controlArr.labels.length === 0
|
|
2287
|
+
?
|
|
2288
|
+
multiSelectSelectedItemOnlyStatus.noneLabel
|
|
2289
|
+
:
|
|
2290
|
+
null
|
|
2291
|
+
}
|
|
2192
2292
|
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2293
|
+
{/*-- DEFAULT VALUE ---*/}
|
|
2294
|
+
{
|
|
2295
|
+
typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
|
|
2296
|
+
controlArr.labels.length > 0
|
|
2297
|
+
?
|
|
2298
|
+
MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2299
|
+
:
|
|
2300
|
+
null
|
|
2301
|
+
}
|
|
2302
|
+
{
|
|
2303
|
+
typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
|
|
2304
|
+
controlArr.labels.length === 0
|
|
2305
|
+
?
|
|
2306
|
+
MULTI_SEL_SELECTED_STATUS.noneLabel
|
|
2307
|
+
:
|
|
2308
|
+
null
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
{/* ===================== /Manual requests ===================== */}
|
|
2312
|
+
|
|
2313
|
+
</> : <>
|
|
2314
|
+
{/* ===================== Auto requests ===================== */}
|
|
2315
|
+
|
|
2316
|
+
{
|
|
2317
|
+
typeof multiSelectSelectedItemOnlyStatus.itemsLabel === 'string' &&
|
|
2318
|
+
controlArr.labels.length > 0 &&
|
|
2319
|
+
controlArr.labels.length < optionsData.length
|
|
2320
|
+
?
|
|
2321
|
+
multiSelectSelectedItemOnlyStatus.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2322
|
+
:
|
|
2323
|
+
null
|
|
2324
|
+
}
|
|
2325
|
+
{
|
|
2326
|
+
typeof multiSelectSelectedItemOnlyStatus.noneLabel === 'string' &&
|
|
2327
|
+
controlArr.labels.length === 0
|
|
2328
|
+
?
|
|
2329
|
+
multiSelectSelectedItemOnlyStatus.noneLabel
|
|
2330
|
+
:
|
|
2331
|
+
null
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
{/* all */}
|
|
2335
|
+
{controlArr.labels.length > 0 ? <>
|
|
2336
|
+
{
|
|
2337
|
+
typeof multiSelectSelectedItemOnlyStatus.allItemsLabel === 'string' &&
|
|
2338
|
+
controlArr.labels.length === optionsData.length
|
|
2339
|
+
?
|
|
2340
|
+
multiSelectSelectedItemOnlyStatus.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2341
|
+
:
|
|
2342
|
+
null
|
|
2343
|
+
}
|
|
2344
|
+
</>: null}
|
|
2197
2345
|
|
|
2198
2346
|
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2347
|
+
{/*-- DEFAULT VALUE ---*/}
|
|
2348
|
+
{
|
|
2349
|
+
typeof multiSelectSelectedItemOnlyStatus.itemsLabel !== 'string' &&
|
|
2350
|
+
controlArr.labels.length > 0
|
|
2351
|
+
?
|
|
2352
|
+
MULTI_SEL_SELECTED_STATUS.itemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2353
|
+
:
|
|
2354
|
+
null
|
|
2355
|
+
}
|
|
2356
|
+
{
|
|
2357
|
+
typeof multiSelectSelectedItemOnlyStatus.noneLabel !== 'string' &&
|
|
2358
|
+
controlArr.labels.length === 0
|
|
2359
|
+
?
|
|
2360
|
+
MULTI_SEL_SELECTED_STATUS.noneLabel
|
|
2361
|
+
:
|
|
2362
|
+
null
|
|
2363
|
+
}
|
|
2202
2364
|
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2365
|
+
{/* all */}
|
|
2366
|
+
{controlArr.labels.length > 0 ? <>
|
|
2367
|
+
{
|
|
2368
|
+
typeof multiSelectSelectedItemOnlyStatus.allItemsLabel !== 'string' &&
|
|
2369
|
+
controlArr.labels.length === optionsData.length
|
|
2370
|
+
?
|
|
2371
|
+
MULTI_SEL_SELECTED_STATUS.allItemsLabel.replace('{num}', `${controlArr.labels.length}`)
|
|
2372
|
+
:
|
|
2373
|
+
null
|
|
2374
|
+
}
|
|
2375
|
+
</>: null}
|
|
2376
|
+
{/* ===================== /Auto requests ===================== */}
|
|
2207
2377
|
|
|
2378
|
+
</>}
|
|
2208
2379
|
|
|
2209
2380
|
</li>
|
|
2210
2381
|
</> : <>
|
|
@@ -2303,7 +2474,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2303
2474
|
{
|
|
2304
2475
|
'reverse': isOpen
|
|
2305
2476
|
}
|
|
2306
|
-
)} style={{display:
|
|
2477
|
+
)} style={{display: MANUAL_REQ ? 'none' : 'inline-block' }}>
|
|
2307
2478
|
{controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
|
|
2308
2479
|
<g stroke="none" strokeWidth="1" fill="none">
|
|
2309
2480
|
<g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
|
|
@@ -2320,7 +2491,7 @@ const Select = forwardRef((props: SelectProps, externalRef: any) => {
|
|
|
2320
2491
|
|
|
2321
2492
|
|
|
2322
2493
|
{/* SEARCH BUTTON */}
|
|
2323
|
-
{
|
|
2494
|
+
{MANUAL_REQ ? <>
|
|
2324
2495
|
<span className="custom-select-multi__control-searchbtn">
|
|
2325
2496
|
<button tabIndex={-1} type="button" className="btn border-end-0 rounded-pill" onClick={(e: React.MouseEvent) => {
|
|
2326
2497
|
handleFetch().then((response: any) => {
|
package/lib/esm/Table/Table.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import useComId from 'funda-utils/dist/cjs/useComId';
|
|
|
5
5
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
import { TableProvider } from './TableContext';
|
|
9
10
|
import useTableResponsive from './table-utils/hooks/useTableResponsive';
|
|
10
11
|
import useTableDraggable from './table-utils/hooks/useTableDraggable';
|
|
@@ -3,6 +3,7 @@ import React, { forwardRef, useContext } from 'react';
|
|
|
3
3
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
import { TableContext } from './TableContext';
|
|
7
8
|
|
|
8
9
|
import { cellMark, removeCellFocusClassName } from './table-utils/func';
|
|
@@ -10,9 +11,11 @@ import useTableKeyPress from './table-utils/hooks/useTableKeyPress';
|
|
|
10
11
|
|
|
11
12
|
export interface TableCellProps extends React.HTMLAttributes<HTMLTableCellElement> {
|
|
12
13
|
active?: boolean;
|
|
14
|
+
nowrap?: boolean;
|
|
13
15
|
activeClassName?: string;
|
|
14
16
|
className?: string;
|
|
15
17
|
colSpan?: number;
|
|
18
|
+
style?: React.CSSProperties;
|
|
16
19
|
scope?: `col` | `row` | `colgroup` | `rowgroup`;
|
|
17
20
|
onClick?: (e: any) => void;
|
|
18
21
|
onKeyDown?: (e: any) => void;
|
|
@@ -22,9 +25,11 @@ const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>((
|
|
|
22
25
|
{
|
|
23
26
|
children,
|
|
24
27
|
active,
|
|
28
|
+
nowrap,
|
|
25
29
|
activeClassName,
|
|
26
30
|
className: myClassName,
|
|
27
31
|
colSpan,
|
|
32
|
+
style,
|
|
28
33
|
scope,
|
|
29
34
|
onClick,
|
|
30
35
|
onKeyDown,
|
|
@@ -68,6 +73,7 @@ const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>((
|
|
|
68
73
|
|
|
69
74
|
<CellComponent
|
|
70
75
|
{...attributes}
|
|
76
|
+
style={typeof nowrap === 'undefined' ? style : { whiteSpace: clsWrite(nowrap, 'normal', 'nowrap'), ...style }}
|
|
71
77
|
ref={(node) => {
|
|
72
78
|
if (typeof externalRef === 'function') {
|
|
73
79
|
externalRef(node);
|
|
@@ -56,11 +56,26 @@ const ToggleSelection = forwardRef((props: ToggleSelectionProps, ref: any) => {
|
|
|
56
56
|
setSelectAll: (value: boolean) => {
|
|
57
57
|
setAllChecked(value);
|
|
58
58
|
},
|
|
59
|
+
set: (check: boolean) => {
|
|
60
|
+
const s = String(resolvedRef.current?.dataset.row);
|
|
61
|
+
setSelectedItems((prev: any) => {
|
|
62
|
+
const _data = new Set(prev);
|
|
63
|
+
|
|
64
|
+
if (check) {
|
|
65
|
+
_data.add(s);
|
|
66
|
+
} else {
|
|
67
|
+
_data.delete(s);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return _data;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
},
|
|
59
74
|
control: () => {
|
|
60
75
|
return resolvedRef.current;
|
|
61
76
|
}
|
|
62
77
|
}),
|
|
63
|
-
[contentRef, resolvedRef],
|
|
78
|
+
[contentRef, resolvedRef, selectedItems],
|
|
64
79
|
);
|
|
65
80
|
|
|
66
81
|
|
|
@@ -113,7 +128,7 @@ const ToggleSelection = forwardRef((props: ToggleSelectionProps, ref: any) => {
|
|
|
113
128
|
let filteredData: any[] = [];
|
|
114
129
|
if (!isNaN(row) && Array.isArray(originData)) {
|
|
115
130
|
|
|
116
|
-
const newSelectedItems = new Set(
|
|
131
|
+
const newSelectedItems = new Set();
|
|
117
132
|
newSelectedItems.add(_val as never);
|
|
118
133
|
setSelectedItems(newSelectedItems);
|
|
119
134
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "4.3.
|
|
5
|
+
"version": "4.3.721",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|