funda-ui 4.7.202 → 4.7.222
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/Date/index.js +20 -12
- package/README.md +205 -0
- package/Select/index.d.ts +20 -9
- package/Select/index.js +408 -345
- package/Table/index.js +69 -16
- package/Utils/time.d.ts +2 -0
- package/Utils/time.js +25 -20
- package/lib/cjs/Date/index.js +20 -12
- package/lib/cjs/Select/index.d.ts +20 -9
- package/lib/cjs/Select/index.js +408 -345
- package/lib/cjs/Table/index.js +69 -16
- package/lib/cjs/Utils/time.d.ts +2 -0
- package/lib/cjs/Utils/time.js +25 -20
- package/lib/esm/Date/index.tsx +24 -10
- package/lib/esm/Select/index.tsx +45 -18
- package/lib/esm/Table/Table.tsx +37 -2
- package/lib/esm/Table/TableCell.tsx +2 -2
- package/lib/esm/Table/utils/func.ts +2 -2
- package/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +28 -6
- package/lib/esm/Utils/libs/time.ts +24 -22
- package/package.json +1 -1
package/Table/index.js
CHANGED
|
@@ -654,8 +654,8 @@ function tableElemScrolledInit(root, w) {
|
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
function cellMark(
|
|
658
|
-
return "cell-".concat(
|
|
657
|
+
function cellMark(row, col) {
|
|
658
|
+
return "cell-".concat(row, "-").concat(col);
|
|
659
659
|
}
|
|
660
660
|
function removeCellFocusClassName(root) {
|
|
661
661
|
if (root) {
|
|
@@ -1027,7 +1027,7 @@ function useTableDraggable(_ref, deps) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
/* harmony default export */ const hooks_useTableDraggable = (useTableDraggable);
|
|
1029
1029
|
;// CONCATENATED MODULE: ./src/Table.tsx
|
|
1030
|
-
var _excluded = ["children", "wrapperClassName", "tableClassName", "bordered", "colGroup", "cellAutoWidth", "colSortable", "onColSort", "rowDraggable", "onRowDrag", "responsive", "enhancedResponsive", "enhancedResponsiveWithScrollBar", "data", "filterFields", "filterControlClassName", "filterControlPlaceholder", "filterLabel", "onChangeFilter", "dataSelected", "rowSelectable", "onChangeRowSelect", "keyboardFocusable", "onCellKeyPressed"];
|
|
1030
|
+
var _excluded = ["contentRef", "children", "wrapperClassName", "tableClassName", "bordered", "colGroup", "cellAutoWidth", "colSortable", "onColSort", "rowDraggable", "onRowDrag", "responsive", "enhancedResponsive", "enhancedResponsiveWithScrollBar", "data", "filterFields", "filterControlClassName", "filterControlPlaceholder", "filterLabel", "onChangeFilter", "dataSelected", "rowSelectable", "onChangeRowSelect", "keyboardFocusable", "onCellKeyPressed", "onCellPressEnter"];
|
|
1031
1031
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1032
1032
|
function Table_slicedToArray(arr, i) { return Table_arrayWithHoles(arr) || Table_iterableToArrayLimit(arr, i) || Table_unsupportedIterableToArray(arr, i) || Table_nonIterableRest(); }
|
|
1033
1033
|
function Table_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -1043,8 +1043,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
1043
1043
|
|
|
1044
1044
|
|
|
1045
1045
|
|
|
1046
|
+
|
|
1046
1047
|
var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (_ref, externalRef) {
|
|
1047
|
-
var
|
|
1048
|
+
var contentRef = _ref.contentRef,
|
|
1049
|
+
children = _ref.children,
|
|
1048
1050
|
wrapperClassName = _ref.wrapperClassName,
|
|
1049
1051
|
tableClassName = _ref.tableClassName,
|
|
1050
1052
|
bordered = _ref.bordered,
|
|
@@ -1068,6 +1070,7 @@ var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_a
|
|
|
1068
1070
|
onChangeRowSelect = _ref.onChangeRowSelect,
|
|
1069
1071
|
keyboardFocusable = _ref.keyboardFocusable,
|
|
1070
1072
|
onCellKeyPressed = _ref.onCellKeyPressed,
|
|
1073
|
+
onCellPressEnter = _ref.onCellPressEnter,
|
|
1071
1074
|
attributes = _objectWithoutProperties(_ref, _excluded);
|
|
1072
1075
|
var uniqueID = useComId_default()();
|
|
1073
1076
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
@@ -1139,6 +1142,32 @@ var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_a
|
|
|
1139
1142
|
setSelectedItems(newSelectedItems);
|
|
1140
1143
|
}
|
|
1141
1144
|
}, [data, dataSelected]);
|
|
1145
|
+
|
|
1146
|
+
// Synchronous execution, which blocks rendering
|
|
1147
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
|
|
1148
|
+
if (rootRef.current) {
|
|
1149
|
+
// Initialize custom props of table elements
|
|
1150
|
+
initRowColProps(rootRef.current);
|
|
1151
|
+
}
|
|
1152
|
+
}, [data]); // Re-run when data changes
|
|
1153
|
+
|
|
1154
|
+
// exposes the following methods
|
|
1155
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(contentRef, function () {
|
|
1156
|
+
return {
|
|
1157
|
+
setFocusableCell: function setFocusableCell(row, col) {
|
|
1158
|
+
var _rootRef$current;
|
|
1159
|
+
setFocusableCellId(cellMark(row, col));
|
|
1160
|
+
|
|
1161
|
+
// Find and focus the cell element
|
|
1162
|
+
var cellElement = (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.querySelector(".".concat(cellMark(row, col)));
|
|
1163
|
+
if (cellElement) {
|
|
1164
|
+
removeCellFocusClassName(rootRef.current);
|
|
1165
|
+
cellElement.focus(); // !!!Required
|
|
1166
|
+
cellElement.classList.add('cell-focus');
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
}, [rootRef]);
|
|
1142
1171
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TableProvider, {
|
|
1143
1172
|
value: {
|
|
1144
1173
|
originData: data,
|
|
@@ -1170,7 +1199,8 @@ var Table = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_a
|
|
|
1170
1199
|
refNode: refNode,
|
|
1171
1200
|
focusableCellId: focusableCellId,
|
|
1172
1201
|
setFocusableCellId: setFocusableCellId,
|
|
1173
|
-
onCellKeyPressed: onCellKeyPressed
|
|
1202
|
+
onCellKeyPressed: onCellKeyPressed,
|
|
1203
|
+
onCellPressEnter: onCellPressEnter
|
|
1174
1204
|
}
|
|
1175
1205
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({}, attributes, {
|
|
1176
1206
|
id: uniqueID,
|
|
@@ -1252,7 +1282,8 @@ const App = () => {
|
|
|
1252
1282
|
refNode,
|
|
1253
1283
|
focusableCellId,
|
|
1254
1284
|
setFocusableCellId,
|
|
1255
|
-
onCellKeyPressed
|
|
1285
|
+
onCellKeyPressed,
|
|
1286
|
+
onCellPressEnter,
|
|
1256
1287
|
}, [rootRef]);
|
|
1257
1288
|
|
|
1258
1289
|
|
|
@@ -1278,20 +1309,32 @@ var useTableKeyPress = function useTableKeyPress(_ref, deps) {
|
|
|
1278
1309
|
focusableCellId = _ref.focusableCellId,
|
|
1279
1310
|
setFocusableCellId = _ref.setFocusableCellId,
|
|
1280
1311
|
onCellKeyPressed = _ref.onCellKeyPressed,
|
|
1312
|
+
onCellPressEnter = _ref.onCellPressEnter,
|
|
1281
1313
|
onKeyDown = _ref.onKeyDown;
|
|
1282
1314
|
var handleKeyPressed = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)( /*#__PURE__*/function () {
|
|
1283
1315
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
1284
|
-
var key, oldCellSignal, _row, _col, move;
|
|
1316
|
+
var key, currentCell, row, col, nextCellSignal, oldCellSignal, _row, _col, move, _nextCellSignal;
|
|
1285
1317
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1286
1318
|
while (1) switch (_context.prev = _context.next) {
|
|
1287
1319
|
case 0:
|
|
1320
|
+
key = event.code;
|
|
1321
|
+
if (!((key === 'Enter' || key === 'NumpadEnter') && !enabled)) {
|
|
1322
|
+
_context.next = 8;
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1325
|
+
currentCell = event.target;
|
|
1326
|
+
row = Number(currentCell.getAttribute('data-table-row'));
|
|
1327
|
+
col = Number(currentCell.getAttribute('data-table-col'));
|
|
1328
|
+
nextCellSignal = cellMark(row, col);
|
|
1329
|
+
onCellPressEnter === null || onCellPressEnter === void 0 ? void 0 : onCellPressEnter(nextCellSignal, refNode.current.get(nextCellSignal), event);
|
|
1330
|
+
return _context.abrupt("return");
|
|
1331
|
+
case 8:
|
|
1288
1332
|
if (!(!Array.isArray(data) || rootDataInfo === null || spyElement === null || typeof enabled === 'undefined' || enabled === false)) {
|
|
1289
|
-
_context.next =
|
|
1333
|
+
_context.next = 10;
|
|
1290
1334
|
break;
|
|
1291
1335
|
}
|
|
1292
1336
|
return _context.abrupt("return");
|
|
1293
|
-
case
|
|
1294
|
-
key = event.code;
|
|
1337
|
+
case 10:
|
|
1295
1338
|
oldCellSignal = focusableCellId === null || focusableCellId === void 0 ? void 0 : focusableCellId.replace('cell-', '').split('-');
|
|
1296
1339
|
_row = Number(oldCellSignal[0]);
|
|
1297
1340
|
_col = Number(oldCellSignal[1]);
|
|
@@ -1299,15 +1342,19 @@ var useTableKeyPress = function useTableKeyPress(_ref, deps) {
|
|
|
1299
1342
|
var _spyElement$querySele;
|
|
1300
1343
|
switch (key) {
|
|
1301
1344
|
case 'ArrowLeft':
|
|
1345
|
+
case 'Numpad4':
|
|
1302
1346
|
_col = _col - 1 < 0 ? 0 : _col - 1;
|
|
1303
1347
|
break;
|
|
1304
1348
|
case 'ArrowRight':
|
|
1349
|
+
case 'Numpad6':
|
|
1305
1350
|
_col = _col + 1 > data.length - 1 ? data.length - 1 : _col + 1;
|
|
1306
1351
|
break;
|
|
1307
1352
|
case 'ArrowUp':
|
|
1353
|
+
case 'Numpad8':
|
|
1308
1354
|
_row = _row - 1 < 0 ? 0 : _row - 1;
|
|
1309
1355
|
break;
|
|
1310
1356
|
case 'ArrowDown':
|
|
1357
|
+
case 'Numpad2':
|
|
1311
1358
|
_row = _row + 1 > rootDataInfo.totalRow - 1 ? rootDataInfo.totalRow - 1 : _row + 1;
|
|
1312
1359
|
break;
|
|
1313
1360
|
}
|
|
@@ -1324,19 +1371,23 @@ var useTableKeyPress = function useTableKeyPress(_ref, deps) {
|
|
|
1324
1371
|
onCellKeyPressed === null || onCellKeyPressed === void 0 ? void 0 : onCellKeyPressed(nextCellSignal, refNode.current.get(nextCellSignal), event);
|
|
1325
1372
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
1326
1373
|
};
|
|
1327
|
-
if (key === 'ArrowLeft') {
|
|
1374
|
+
if (key === 'ArrowLeft' || key === 'Numpad4') {
|
|
1328
1375
|
move('ArrowLeft');
|
|
1329
1376
|
}
|
|
1330
|
-
if (key === 'ArrowRight') {
|
|
1377
|
+
if (key === 'ArrowRight' || key === 'Numpad6') {
|
|
1331
1378
|
move('ArrowRight');
|
|
1332
1379
|
}
|
|
1333
|
-
if (key === 'ArrowUp') {
|
|
1380
|
+
if (key === 'ArrowUp' || key === 'Numpad8') {
|
|
1334
1381
|
move('ArrowUp');
|
|
1335
1382
|
}
|
|
1336
|
-
if (key === 'ArrowDown') {
|
|
1383
|
+
if (key === 'ArrowDown' || key === 'Numpad2') {
|
|
1337
1384
|
move('ArrowDown');
|
|
1338
1385
|
}
|
|
1339
|
-
|
|
1386
|
+
if (key === 'Enter' || key === 'NumpadEnter') {
|
|
1387
|
+
_nextCellSignal = cellMark(_row, _col);
|
|
1388
|
+
onCellPressEnter === null || onCellPressEnter === void 0 ? void 0 : onCellPressEnter(_nextCellSignal, refNode.current.get(_nextCellSignal), event);
|
|
1389
|
+
}
|
|
1390
|
+
case 19:
|
|
1340
1391
|
case "end":
|
|
1341
1392
|
return _context.stop();
|
|
1342
1393
|
}
|
|
@@ -1402,7 +1453,8 @@ var TableCell = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_rea
|
|
|
1402
1453
|
focusableCellId = _useContext.focusableCellId,
|
|
1403
1454
|
setFocusableCellId = _useContext.setFocusableCellId,
|
|
1404
1455
|
keyboardFocusable = _useContext.keyboardFocusable,
|
|
1405
|
-
onCellKeyPressed = _useContext.onCellKeyPressed
|
|
1456
|
+
onCellKeyPressed = _useContext.onCellKeyPressed,
|
|
1457
|
+
onCellPressEnter = _useContext.onCellPressEnter;
|
|
1406
1458
|
var CellComponent = scope ? 'th' : 'td';
|
|
1407
1459
|
|
|
1408
1460
|
// key press initialization
|
|
@@ -1416,6 +1468,7 @@ var TableCell = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_rea
|
|
|
1416
1468
|
focusableCellId: focusableCellId,
|
|
1417
1469
|
setFocusableCellId: setFocusableCellId,
|
|
1418
1470
|
onCellKeyPressed: onCellKeyPressed,
|
|
1471
|
+
onCellPressEnter: onCellPressEnter,
|
|
1419
1472
|
onKeyDown: onKeyDown
|
|
1420
1473
|
}, [rootRef]),
|
|
1421
1474
|
handleKeyPressed = _useTableKeyPress.handleKeyPressed;
|
package/Utils/time.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
console.log(getTimeslots("10:00", "14:00", 60, true)); //['10:00 - 11:00', '11:00 - 12:00', '12:00 - 13:00', '13:00 - 14:00']
|
|
11
11
|
console.log(getTimeslots("10:00", "14:00", 60)); // ['10:00', '11:00', '12:00', '13:00']
|
|
12
|
+
console.log(getTimeslots("08:00:00", "08:02:00", 0.4)); // ['08:00:00', '08:00:24', '08:00:48', '08:01:12', '08:01:36', '08:02:00']
|
|
13
|
+
|
|
12
14
|
*/
|
|
13
15
|
declare function getTimeslots(startTime: string, endTime: string, timeInterval: number, formatRange?: boolean): string[];
|
|
14
16
|
/**
|
package/Utils/time.js
CHANGED
|
@@ -62,49 +62,54 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
62
62
|
|
|
63
63
|
console.log(getTimeslots("10:00", "14:00", 60, true)); //['10:00 - 11:00', '11:00 - 12:00', '12:00 - 13:00', '13:00 - 14:00']
|
|
64
64
|
console.log(getTimeslots("10:00", "14:00", 60)); // ['10:00', '11:00', '12:00', '13:00']
|
|
65
|
+
console.log(getTimeslots("08:00:00", "08:02:00", 0.4)); // ['08:00:00', '08:00:24', '08:00:48', '08:01:12', '08:01:36', '08:02:00']
|
|
66
|
+
|
|
65
67
|
*/
|
|
66
68
|
|
|
67
69
|
function getTimeslots(startTime, endTime, timeInterval) {
|
|
68
70
|
var formatRange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
71
|
+
// Parse time string to seconds
|
|
69
72
|
var parseTime = function parseTime(s) {
|
|
70
|
-
var c = s.split(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var convertHours = function convertHours(mins) {
|
|
74
|
-
var hour = Math.floor(mins / 60);
|
|
75
|
-
mins = Math.trunc(mins % 60);
|
|
76
|
-
var converted = pad(hour, 2) + ':' + pad(mins, 2);
|
|
77
|
-
return converted;
|
|
73
|
+
var c = s.split(":").map(Number);
|
|
74
|
+
// Support HH:mm or HH:mm:ss
|
|
75
|
+
return c[0] * 3600 + c[1] * 60 + (c[2] || 0);
|
|
78
76
|
};
|
|
77
|
+
|
|
78
|
+
// Pad with zeros
|
|
79
79
|
var pad = function pad(str, max) {
|
|
80
80
|
str = str.toString();
|
|
81
81
|
return str.length < max ? pad("0" + str, max) : str;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
// Convert seconds to HH:mm:ss
|
|
85
|
+
var convertTime = function convertTime(secs) {
|
|
86
|
+
var hour = Math.floor(secs / 3600);
|
|
87
|
+
var min = Math.floor(secs % 3600 / 60);
|
|
88
|
+
var sec = secs % 60;
|
|
89
|
+
return pad(hour, 2) + ":" + pad(min, 2) + ":" + pad(sec, 2);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Calculate time slots
|
|
85
93
|
var calculateTimeSlot = function calculateTimeSlot(_startTime, _endTime, _timeInterval) {
|
|
86
94
|
var timeSlots = [];
|
|
87
|
-
// Round start and end times to next 30 min interval
|
|
88
|
-
_startTime = Math.ceil(_startTime / 30) * 30;
|
|
89
|
-
_endTime = Math.ceil(_endTime / 30) * 30;
|
|
90
|
-
|
|
91
|
-
// Start and end of interval in the loop
|
|
92
95
|
var currentTime = _startTime;
|
|
93
|
-
while (currentTime
|
|
96
|
+
while (currentTime <= _endTime) {
|
|
94
97
|
if (formatRange) {
|
|
95
|
-
var t =
|
|
98
|
+
var t = convertTime(currentTime) + ' - ' + convertTime(Math.min(currentTime + _timeInterval, _endTime));
|
|
96
99
|
timeSlots.push(t);
|
|
97
100
|
} else {
|
|
98
|
-
timeSlots.push(
|
|
101
|
+
timeSlots.push(convertTime(currentTime));
|
|
99
102
|
}
|
|
100
103
|
currentTime += _timeInterval;
|
|
101
104
|
}
|
|
102
105
|
return timeSlots;
|
|
103
106
|
};
|
|
104
|
-
var inputEndTime = parseTime(endTime);
|
|
105
107
|
var inputStartTime = parseTime(startTime);
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
+
var inputEndTime = parseTime(endTime);
|
|
109
|
+
// If timeInterval is not an integer, treat as minutes with decimals, convert to seconds
|
|
110
|
+
var isDecimal = !Number.isInteger(timeInterval);
|
|
111
|
+
var intervalInSeconds = isDecimal ? Math.round(timeInterval * 60) : timeInterval * 60;
|
|
112
|
+
return calculateTimeSlot(inputStartTime, inputEndTime, intervalInSeconds);
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
/**
|
package/lib/cjs/Date/index.js
CHANGED
|
@@ -5424,9 +5424,14 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5424
5424
|
|
|
5425
5425
|
e.target.select();
|
|
5426
5426
|
resetDefauleValueExist();
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5427
|
+
|
|
5428
|
+
// If there is no valid default value in the input field,
|
|
5429
|
+
// onChange should be triggered only after the resetDefauleValueExist() function is processed
|
|
5430
|
+
if (!dateDefaultValueExist) {
|
|
5431
|
+
var _date = "".concat(splitVals[0], "-").concat(splitVals[1], "-").concat(splitVals[2]);
|
|
5432
|
+
var _full = "".concat(_date, " ").concat(splitVals[3], ":").concat(splitVals[4], ":").concat(splitVals[5]);
|
|
5433
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full), (0,cjs_date.isValidDate)(_full), getAllSplittingInputs());
|
|
5434
|
+
}
|
|
5430
5435
|
}
|
|
5431
5436
|
function handleKeyPressed(_x2) {
|
|
5432
5437
|
return _handleKeyPressed.apply(this, arguments);
|
|
@@ -5461,17 +5466,19 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5461
5466
|
}
|
|
5462
5467
|
function _handleKeyPressedForSplitInputs() {
|
|
5463
5468
|
_handleKeyPressedForSplitInputs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
5464
|
-
var key, btnMark, move;
|
|
5469
|
+
var key, btnMark, isLeftArrow, isRightArrow, move;
|
|
5465
5470
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5466
5471
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5467
5472
|
case 0:
|
|
5468
5473
|
key = event.code;
|
|
5469
|
-
btnMark = event.target.dataset.mark;
|
|
5470
|
-
|
|
5474
|
+
btnMark = event.target.dataset.mark; // Check for both regular arrow keys and numpad arrow keys
|
|
5475
|
+
isLeftArrow = key === 'ArrowLeft' || key === 'Numpad4';
|
|
5476
|
+
isRightArrow = key === 'ArrowRight' || key === 'Numpad6';
|
|
5477
|
+
move = function move(direction) {
|
|
5471
5478
|
var currentIndex = splitInputsIds.findIndex(function (s) {
|
|
5472
5479
|
return s === btnMark;
|
|
5473
5480
|
});
|
|
5474
|
-
var nextIndex =
|
|
5481
|
+
var nextIndex = direction === 'left' ? currentIndex === 0 ? splitInputsIds.length - 1 : currentIndex - 1 : currentIndex === splitInputsIds.length - 1 ? 0 : currentIndex + 1;
|
|
5475
5482
|
var nextOption = splitInputsIds.at(nextIndex);
|
|
5476
5483
|
if (nextOption) {
|
|
5477
5484
|
setTimeout(function () {
|
|
@@ -5481,13 +5488,13 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5481
5488
|
setFocusableSplitInputId(nextOption);
|
|
5482
5489
|
}
|
|
5483
5490
|
};
|
|
5484
|
-
if (
|
|
5485
|
-
move('
|
|
5491
|
+
if (isLeftArrow) {
|
|
5492
|
+
move('left');
|
|
5486
5493
|
}
|
|
5487
|
-
if (
|
|
5488
|
-
move('
|
|
5494
|
+
if (isRightArrow) {
|
|
5495
|
+
move('right');
|
|
5489
5496
|
}
|
|
5490
|
-
case
|
|
5497
|
+
case 7:
|
|
5491
5498
|
case "end":
|
|
5492
5499
|
return _context2.stop();
|
|
5493
5500
|
}
|
|
@@ -5500,6 +5507,7 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5500
5507
|
_onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, '', false, getAllSplittingInputs());
|
|
5501
5508
|
}
|
|
5502
5509
|
function resetDefauleValueExist() {
|
|
5510
|
+
// Does the current input box have a "valid default value"?
|
|
5503
5511
|
if (!dateDefaultValueExist) setDateDefaultValueExist(true);
|
|
5504
5512
|
}
|
|
5505
5513
|
function resetPopupBlurStatus() {
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface MultiSelectValue {
|
|
3
|
+
items: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}[];
|
|
7
|
+
labels: string[];
|
|
8
|
+
values: string[];
|
|
9
|
+
labelsOfString: string;
|
|
10
|
+
valuesOfString: string;
|
|
11
|
+
}
|
|
12
|
+
export declare type SelectOptionChangeFnType = (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, element: HTMLElement, value: OptionConfig | MultiSelectValue) => void | Promise<void>;
|
|
3
13
|
export interface MultiSelectControlValConfig {
|
|
4
14
|
values: string[];
|
|
5
15
|
labels: string[];
|
|
@@ -12,7 +22,8 @@ export interface OptionConfig {
|
|
|
12
22
|
listItemLabel?: string;
|
|
13
23
|
value: string | number | boolean;
|
|
14
24
|
queryString: string | number;
|
|
15
|
-
callback?: () => void
|
|
25
|
+
callback?: () => void | Promise<void>;
|
|
26
|
+
[key: string]: string | number | boolean | any[] | (() => void | Promise<void>) | undefined;
|
|
16
27
|
}
|
|
17
28
|
export interface MultiSelectConfig {
|
|
18
29
|
valid: boolean;
|
|
@@ -82,14 +93,14 @@ export declare type SelectProps = {
|
|
|
82
93
|
fetchFuncAsync?: any;
|
|
83
94
|
fetchFuncMethod?: string;
|
|
84
95
|
fetchFuncMethodParams?: any[];
|
|
85
|
-
fetchCallback?: (data:
|
|
86
|
-
onFetch?: (
|
|
87
|
-
onLoad?: (
|
|
88
|
-
onSelect?: (data:
|
|
96
|
+
fetchCallback?: (data: OptionConfig[]) => OptionConfig[];
|
|
97
|
+
onFetch?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, element: HTMLElement, value: string, data: OptionConfig[], incomingData: string | null | undefined) => void;
|
|
98
|
+
onLoad?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, element: HTMLElement, value: string | null | undefined) => void;
|
|
99
|
+
onSelect?: (data: OptionConfig) => void | Promise<void>;
|
|
89
100
|
onChange?: SelectOptionChangeFnType | null;
|
|
90
|
-
onBlur?: (
|
|
91
|
-
onFocus?: (
|
|
92
|
-
onKeyPressed?: (
|
|
101
|
+
onBlur?: (event: React.FocusEvent<HTMLElement>) => void;
|
|
102
|
+
onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
|
|
103
|
+
onKeyPressed?: (event: React.KeyboardEvent<HTMLElement>, element: HTMLElement, value: string) => void;
|
|
93
104
|
};
|
|
94
105
|
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<unknown>>;
|
|
95
106
|
export default Select;
|