funda-ui 3.8.325 → 3.8.425

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.d.ts CHANGED
@@ -16,6 +16,7 @@ declare type DateProps = {
16
16
  truncateSeconds?: boolean;
17
17
  valueUseSlash?: boolean;
18
18
  value?: string;
19
+ clickInitValue?: string;
19
20
  min?: string;
20
21
  max?: string;
21
22
  placeholder?: string;
package/Date/index.js CHANGED
@@ -1654,7 +1654,7 @@ var zh_CN_default = /*#__PURE__*/__webpack_require__.n(zh_CN);
1654
1654
  // EXTERNAL MODULE: ./src/utils/performance.js
1655
1655
  var performance = __webpack_require__(342);
1656
1656
  ;// CONCATENATED MODULE: ./src/index.tsx
1657
- var _excluded = ["popupRef", "triggerClassName", "popupClassName", "wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "delimiter", "offset", "exceededSidePosOffset", "localization", "type", "onlyTime", "truncateSeconds", "valueUseSlash", "disabled", "required", "readOnly", "value", "min", "max", "placeholder", "label", "units", "name", "alt", "id", "iconLeft", "iconRight", "autoComplete", "style", "tabIndex", "onLoad", "onChange", "onBlur", "onFocus", "onOpenPopup", "onClosePopup", "onChangeDate", "onChangeMonth", "onChangeYear", "onChangeToday", "onChangeHours", "onChangeMinutes", "onChangeSeconds", "langHoursTitle", "langMinutesTitle", "langSecondsTitle", "langWeek", "langWeekFull", "langMonths", "langMonthsFull", "langToday"];
1657
+ var _excluded = ["popupRef", "triggerClassName", "popupClassName", "wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "delimiter", "offset", "exceededSidePosOffset", "localization", "type", "onlyTime", "truncateSeconds", "valueUseSlash", "disabled", "required", "readOnly", "value", "clickInitValue", "min", "max", "placeholder", "label", "units", "name", "alt", "id", "iconLeft", "iconRight", "autoComplete", "style", "tabIndex", "onLoad", "onChange", "onBlur", "onFocus", "onOpenPopup", "onClosePopup", "onChangeDate", "onChangeMonth", "onChangeYear", "onChangeToday", "onChangeHours", "onChangeMinutes", "onChangeSeconds", "langHoursTitle", "langMinutesTitle", "langSecondsTitle", "langWeek", "langWeekFull", "langMonths", "langMonthsFull", "langToday"];
1658
1658
  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); }
1659
1659
  function src_slicedToArray(arr, i) { return src_arrayWithHoles(arr) || src_iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || src_nonIterableRest(); }
1660
1660
  function src_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."); }
@@ -1694,6 +1694,7 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
1694
1694
  required = props.required,
1695
1695
  readOnly = props.readOnly,
1696
1696
  value = props.value,
1697
+ clickInitValue = props.clickInitValue,
1697
1698
  min = props.min,
1698
1699
  max = props.max,
1699
1700
  placeholder = props.placeholder,
@@ -1793,26 +1794,30 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
1793
1794
  _useState2 = src_slicedToArray(_useState, 2),
1794
1795
  dateDefaultValueExist = _useState2[0],
1795
1796
  setDateDefaultValueExist = _useState2[1];
1796
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['0000', '00', '00', '00', '00', '00']),
1797
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1797
1798
  _useState4 = src_slicedToArray(_useState3, 2),
1798
- splitVals = _useState4[0],
1799
- setSplitVals = _useState4[1];
1800
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
1799
+ initSplitClickEvOk = _useState4[0],
1800
+ setInitSplitClickEvOk = _useState4[1];
1801
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['0000', '00', '00', '00', '00', '00']),
1801
1802
  _useState6 = src_slicedToArray(_useState5, 2),
1802
- changedVal = _useState6[0],
1803
- setChangedVal = _useState6[1];
1804
- var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1803
+ splitVals = _useState6[0],
1804
+ setSplitVals = _useState6[1];
1805
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
1805
1806
  _useState8 = src_slicedToArray(_useState7, 2),
1806
- isShow = _useState8[0],
1807
- setIsShow = _useState8[1];
1808
- var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1807
+ changedVal = _useState8[0],
1808
+ setChangedVal = _useState8[1];
1809
+ var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1809
1810
  _useState10 = src_slicedToArray(_useState9, 2),
1810
- dateVal = _useState10[0],
1811
- setDateVal = _useState10[1];
1812
- var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['00', '00', '00']),
1811
+ isShow = _useState10[0],
1812
+ setIsShow = _useState10[1];
1813
+ var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1813
1814
  _useState12 = src_slicedToArray(_useState11, 2),
1814
- timeVal = _useState12[0],
1815
- setTimeVal = _useState12[1];
1815
+ dateVal = _useState12[0],
1816
+ setDateVal = _useState12[1];
1817
+ var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['00', '00', '00']),
1818
+ _useState14 = src_slicedToArray(_useState13, 2),
1819
+ timeVal = _useState14[0],
1820
+ setTimeVal = _useState14[1];
1816
1821
  var hoursArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
1817
1822
  var msArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'];
1818
1823
 
@@ -2016,10 +2021,32 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2016
2021
 
2017
2022
  e.target.select();
2018
2023
  resetDefauleValueExist();
2019
- if (!dateDefaultValueExist) {
2020
- var _full = "".concat(splitVals[0], "-").concat(splitVals[1], "-").concat(splitVals[2], " ").concat(splitVals[3], ":").concat(splitVals[4], ":").concat(splitVals[5]);
2021
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full), isValidDate(_full));
2022
- setChangedVal(_full);
2024
+
2025
+ // update default value when splitting control clicked
2026
+ var noTargetVal = typeof clickInitValue === 'undefined' || clickInitValue === null || clickInitValue === 'null' || clickInitValue === '';
2027
+ var _targetVal = noTargetVal ? getNow() : clickInitValue;
2028
+ if (noTargetVal) {
2029
+ if (!dateDefaultValueExist) {
2030
+ var _initValue = initValue(_targetVal),
2031
+ _initValue2 = src_slicedToArray(_initValue, 2),
2032
+ a = _initValue2[0],
2033
+ b = _initValue2[1];
2034
+ var _full = getFullTimeData(b).res;
2035
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full), isValidDate(_full));
2036
+ setChangedVal(_full);
2037
+ }
2038
+ } else {
2039
+ if (!initSplitClickEvOk) {
2040
+ var _initValue3 = initValue(_targetVal),
2041
+ _initValue4 = src_slicedToArray(_initValue3, 2),
2042
+ _a = _initValue4[0],
2043
+ _b = _initValue4[1];
2044
+ var _full2 = getFullTimeData(_b).res;
2045
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full2), isValidDate(_full2));
2046
+
2047
+ //
2048
+ setInitSplitClickEvOk(true);
2049
+ }
2023
2050
  }
2024
2051
  }
2025
2052
  function clearAll() {
@@ -2163,14 +2190,12 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2163
2190
  }
2164
2191
  return res;
2165
2192
  }
2166
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2167
- // update default value
2168
- //--------------
2169
- if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
2170
- setDateDefaultValueExist(false);
2171
-
2172
- //
2173
- var _getFullTimeData = getFullTimeData(getNow()),
2193
+ function initValue(v) {
2194
+ var _dVal = onlyTime ? "".concat(getFullTimeData(getNow()).date, " ").concat(v) : v;
2195
+ var _res = valueResConverter(_dVal);
2196
+ setChangedVal(_res);
2197
+ if (isValidDate(_dVal)) {
2198
+ var _getFullTimeData = getFullTimeData(_dVal),
2174
2199
  date = _getFullTimeData.date,
2175
2200
  year = _getFullTimeData.year,
2176
2201
  month = _getFullTimeData.month,
@@ -2178,43 +2203,24 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2178
2203
  hours = _getFullTimeData.hours,
2179
2204
  minutes = _getFullTimeData.minutes,
2180
2205
  seconds = _getFullTimeData.seconds;
2181
- if (!currentMaxDateDisabled && !currentMinDateDisabled) {
2182
- setDateVal(date);
2183
- setTimeVal([hours, minutes, seconds]);
2184
- setSplitVals([year, month, day, hours, minutes, seconds]);
2185
- } else {
2186
- if (currentMaxDateDisabled) {
2187
- setDateVal(MAX.date);
2188
- setTimeVal([MAX.hours, MAX.minutes, MAX.seconds]);
2189
- setSplitVals([MAX.year, MAX.month, MAX.day, MAX.hours, MAX.minutes, MAX.seconds]);
2190
- }
2191
- if (currentMinDateDisabled) {
2192
- setDateVal(MIN.date);
2193
- setTimeVal([MIN.hours, MIN.minutes, MIN.seconds]);
2194
- setSplitVals([MIN.year, MIN.month, MIN.day, MIN.hours, MIN.minutes, MIN.seconds]);
2195
- }
2196
- }
2206
+ setDateVal(date);
2207
+ setTimeVal([hours, minutes, seconds]);
2208
+ setSplitVals([year, month, day, hours, minutes, seconds]);
2209
+ }
2210
+ return [_res, _dVal];
2211
+ }
2212
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2213
+ // update default value
2214
+ //--------------
2215
+ if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
2216
+ setDateDefaultValueExist(false);
2197
2217
  } else {
2198
2218
  setDateDefaultValueExist(true);
2199
-
2200
- //
2201
- var _dVal = onlyTime ? "".concat(getFullTimeData(getNow()).date, " ").concat(value) : value;
2202
- var _res = valueResConverter(_dVal);
2203
- setChangedVal(_res);
2204
- if (isValidDate(_dVal)) {
2205
- var _getFullTimeData2 = getFullTimeData(_dVal),
2206
- _date2 = _getFullTimeData2.date,
2207
- _year = _getFullTimeData2.year,
2208
- _month = _getFullTimeData2.month,
2209
- _day = _getFullTimeData2.day,
2210
- _hours = _getFullTimeData2.hours,
2211
- _minutes = _getFullTimeData2.minutes,
2212
- _seconds = _getFullTimeData2.seconds;
2213
- setDateVal(_date2);
2214
- setTimeVal([_hours, _minutes, _seconds]);
2215
- setSplitVals([_year, _month, _day, _hours, _minutes, _seconds]);
2216
- }
2217
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(_res, getFullTimeData(_dVal));
2219
+ var _initValue5 = initValue(value),
2220
+ _initValue6 = src_slicedToArray(_initValue5, 2),
2221
+ a = _initValue6[0],
2222
+ b = _initValue6[1];
2223
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(a, getFullTimeData(b));
2218
2224
  }
2219
2225
 
2220
2226
  //--------------
@@ -16,6 +16,7 @@ declare type DateProps = {
16
16
  truncateSeconds?: boolean;
17
17
  valueUseSlash?: boolean;
18
18
  value?: string;
19
+ clickInitValue?: string;
19
20
  min?: string;
20
21
  max?: string;
21
22
  placeholder?: string;
@@ -1654,7 +1654,7 @@ var zh_CN_default = /*#__PURE__*/__webpack_require__.n(zh_CN);
1654
1654
  // EXTERNAL MODULE: ./src/utils/performance.js
1655
1655
  var performance = __webpack_require__(342);
1656
1656
  ;// CONCATENATED MODULE: ./src/index.tsx
1657
- var _excluded = ["popupRef", "triggerClassName", "popupClassName", "wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "delimiter", "offset", "exceededSidePosOffset", "localization", "type", "onlyTime", "truncateSeconds", "valueUseSlash", "disabled", "required", "readOnly", "value", "min", "max", "placeholder", "label", "units", "name", "alt", "id", "iconLeft", "iconRight", "autoComplete", "style", "tabIndex", "onLoad", "onChange", "onBlur", "onFocus", "onOpenPopup", "onClosePopup", "onChangeDate", "onChangeMonth", "onChangeYear", "onChangeToday", "onChangeHours", "onChangeMinutes", "onChangeSeconds", "langHoursTitle", "langMinutesTitle", "langSecondsTitle", "langWeek", "langWeekFull", "langMonths", "langMonthsFull", "langToday"];
1657
+ var _excluded = ["popupRef", "triggerClassName", "popupClassName", "wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "delimiter", "offset", "exceededSidePosOffset", "localization", "type", "onlyTime", "truncateSeconds", "valueUseSlash", "disabled", "required", "readOnly", "value", "clickInitValue", "min", "max", "placeholder", "label", "units", "name", "alt", "id", "iconLeft", "iconRight", "autoComplete", "style", "tabIndex", "onLoad", "onChange", "onBlur", "onFocus", "onOpenPopup", "onClosePopup", "onChangeDate", "onChangeMonth", "onChangeYear", "onChangeToday", "onChangeHours", "onChangeMinutes", "onChangeSeconds", "langHoursTitle", "langMinutesTitle", "langSecondsTitle", "langWeek", "langWeekFull", "langMonths", "langMonthsFull", "langToday"];
1658
1658
  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); }
1659
1659
  function src_slicedToArray(arr, i) { return src_arrayWithHoles(arr) || src_iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || src_nonIterableRest(); }
1660
1660
  function src_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."); }
@@ -1694,6 +1694,7 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
1694
1694
  required = props.required,
1695
1695
  readOnly = props.readOnly,
1696
1696
  value = props.value,
1697
+ clickInitValue = props.clickInitValue,
1697
1698
  min = props.min,
1698
1699
  max = props.max,
1699
1700
  placeholder = props.placeholder,
@@ -1793,26 +1794,30 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
1793
1794
  _useState2 = src_slicedToArray(_useState, 2),
1794
1795
  dateDefaultValueExist = _useState2[0],
1795
1796
  setDateDefaultValueExist = _useState2[1];
1796
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['0000', '00', '00', '00', '00', '00']),
1797
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1797
1798
  _useState4 = src_slicedToArray(_useState3, 2),
1798
- splitVals = _useState4[0],
1799
- setSplitVals = _useState4[1];
1800
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
1799
+ initSplitClickEvOk = _useState4[0],
1800
+ setInitSplitClickEvOk = _useState4[1];
1801
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['0000', '00', '00', '00', '00', '00']),
1801
1802
  _useState6 = src_slicedToArray(_useState5, 2),
1802
- changedVal = _useState6[0],
1803
- setChangedVal = _useState6[1];
1804
- var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1803
+ splitVals = _useState6[0],
1804
+ setSplitVals = _useState6[1];
1805
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
1805
1806
  _useState8 = src_slicedToArray(_useState7, 2),
1806
- isShow = _useState8[0],
1807
- setIsShow = _useState8[1];
1808
- var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1807
+ changedVal = _useState8[0],
1808
+ setChangedVal = _useState8[1];
1809
+ var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1809
1810
  _useState10 = src_slicedToArray(_useState9, 2),
1810
- dateVal = _useState10[0],
1811
- setDateVal = _useState10[1];
1812
- var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['00', '00', '00']),
1811
+ isShow = _useState10[0],
1812
+ setIsShow = _useState10[1];
1813
+ var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
1813
1814
  _useState12 = src_slicedToArray(_useState11, 2),
1814
- timeVal = _useState12[0],
1815
- setTimeVal = _useState12[1];
1815
+ dateVal = _useState12[0],
1816
+ setDateVal = _useState12[1];
1817
+ var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(['00', '00', '00']),
1818
+ _useState14 = src_slicedToArray(_useState13, 2),
1819
+ timeVal = _useState14[0],
1820
+ setTimeVal = _useState14[1];
1816
1821
  var hoursArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'];
1817
1822
  var msArr = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59'];
1818
1823
 
@@ -2016,10 +2021,32 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2016
2021
 
2017
2022
  e.target.select();
2018
2023
  resetDefauleValueExist();
2019
- if (!dateDefaultValueExist) {
2020
- var _full = "".concat(splitVals[0], "-").concat(splitVals[1], "-").concat(splitVals[2], " ").concat(splitVals[3], ":").concat(splitVals[4], ":").concat(splitVals[5]);
2021
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full), isValidDate(_full));
2022
- setChangedVal(_full);
2024
+
2025
+ // update default value when splitting control clicked
2026
+ var noTargetVal = typeof clickInitValue === 'undefined' || clickInitValue === null || clickInitValue === 'null' || clickInitValue === '';
2027
+ var _targetVal = noTargetVal ? getNow() : clickInitValue;
2028
+ if (noTargetVal) {
2029
+ if (!dateDefaultValueExist) {
2030
+ var _initValue = initValue(_targetVal),
2031
+ _initValue2 = src_slicedToArray(_initValue, 2),
2032
+ a = _initValue2[0],
2033
+ b = _initValue2[1];
2034
+ var _full = getFullTimeData(b).res;
2035
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full), isValidDate(_full));
2036
+ setChangedVal(_full);
2037
+ }
2038
+ } else {
2039
+ if (!initSplitClickEvOk) {
2040
+ var _initValue3 = initValue(_targetVal),
2041
+ _initValue4 = src_slicedToArray(_initValue3, 2),
2042
+ _a = _initValue4[0],
2043
+ _b = _initValue4[1];
2044
+ var _full2 = getFullTimeData(_b).res;
2045
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, valueResConverter(_full2), isValidDate(_full2));
2046
+
2047
+ //
2048
+ setInitSplitClickEvOk(true);
2049
+ }
2023
2050
  }
2024
2051
  }
2025
2052
  function clearAll() {
@@ -2163,14 +2190,12 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2163
2190
  }
2164
2191
  return res;
2165
2192
  }
2166
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2167
- // update default value
2168
- //--------------
2169
- if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
2170
- setDateDefaultValueExist(false);
2171
-
2172
- //
2173
- var _getFullTimeData = getFullTimeData(getNow()),
2193
+ function initValue(v) {
2194
+ var _dVal = onlyTime ? "".concat(getFullTimeData(getNow()).date, " ").concat(v) : v;
2195
+ var _res = valueResConverter(_dVal);
2196
+ setChangedVal(_res);
2197
+ if (isValidDate(_dVal)) {
2198
+ var _getFullTimeData = getFullTimeData(_dVal),
2174
2199
  date = _getFullTimeData.date,
2175
2200
  year = _getFullTimeData.year,
2176
2201
  month = _getFullTimeData.month,
@@ -2178,43 +2203,24 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
2178
2203
  hours = _getFullTimeData.hours,
2179
2204
  minutes = _getFullTimeData.minutes,
2180
2205
  seconds = _getFullTimeData.seconds;
2181
- if (!currentMaxDateDisabled && !currentMinDateDisabled) {
2182
- setDateVal(date);
2183
- setTimeVal([hours, minutes, seconds]);
2184
- setSplitVals([year, month, day, hours, minutes, seconds]);
2185
- } else {
2186
- if (currentMaxDateDisabled) {
2187
- setDateVal(MAX.date);
2188
- setTimeVal([MAX.hours, MAX.minutes, MAX.seconds]);
2189
- setSplitVals([MAX.year, MAX.month, MAX.day, MAX.hours, MAX.minutes, MAX.seconds]);
2190
- }
2191
- if (currentMinDateDisabled) {
2192
- setDateVal(MIN.date);
2193
- setTimeVal([MIN.hours, MIN.minutes, MIN.seconds]);
2194
- setSplitVals([MIN.year, MIN.month, MIN.day, MIN.hours, MIN.minutes, MIN.seconds]);
2195
- }
2196
- }
2206
+ setDateVal(date);
2207
+ setTimeVal([hours, minutes, seconds]);
2208
+ setSplitVals([year, month, day, hours, minutes, seconds]);
2209
+ }
2210
+ return [_res, _dVal];
2211
+ }
2212
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
2213
+ // update default value
2214
+ //--------------
2215
+ if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
2216
+ setDateDefaultValueExist(false);
2197
2217
  } else {
2198
2218
  setDateDefaultValueExist(true);
2199
-
2200
- //
2201
- var _dVal = onlyTime ? "".concat(getFullTimeData(getNow()).date, " ").concat(value) : value;
2202
- var _res = valueResConverter(_dVal);
2203
- setChangedVal(_res);
2204
- if (isValidDate(_dVal)) {
2205
- var _getFullTimeData2 = getFullTimeData(_dVal),
2206
- _date2 = _getFullTimeData2.date,
2207
- _year = _getFullTimeData2.year,
2208
- _month = _getFullTimeData2.month,
2209
- _day = _getFullTimeData2.day,
2210
- _hours = _getFullTimeData2.hours,
2211
- _minutes = _getFullTimeData2.minutes,
2212
- _seconds = _getFullTimeData2.seconds;
2213
- setDateVal(_date2);
2214
- setTimeVal([_hours, _minutes, _seconds]);
2215
- setSplitVals([_year, _month, _day, _hours, _minutes, _seconds]);
2216
- }
2217
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(_res, getFullTimeData(_dVal));
2219
+ var _initValue5 = initValue(value),
2220
+ _initValue6 = src_slicedToArray(_initValue5, 2),
2221
+ a = _initValue6[0],
2222
+ b = _initValue6[1];
2223
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(a, getFullTimeData(b));
2218
2224
  }
2219
2225
 
2220
2226
  //--------------
@@ -3,6 +3,7 @@ import React, { useId, useState, useRef, useEffect, forwardRef, ChangeEvent, use
3
3
  import Input from 'funda-input';
4
4
  import RootPortal from 'funda-root-portal';
5
5
 
6
+
6
7
  import Calendar from './Calendar';
7
8
 
8
9
 
@@ -33,6 +34,7 @@ type DateProps = {
33
34
  truncateSeconds?: boolean;
34
35
  valueUseSlash?: boolean;
35
36
  value?: string;
37
+ clickInitValue?: string;
36
38
  min?: string;
37
39
  max?: string;
38
40
  placeholder?: string;
@@ -102,6 +104,7 @@ const Date = forwardRef((props: DateProps, ref: any) => {
102
104
  required,
103
105
  readOnly,
104
106
  value,
107
+ clickInitValue,
105
108
  min,
106
109
  max,
107
110
  placeholder,
@@ -220,6 +223,7 @@ const Date = forwardRef((props: DateProps, ref: any) => {
220
223
  const partedInputSeconds = useRef<HTMLInputElement>(null);
221
224
 
222
225
  const [dateDefaultValueExist, setDateDefaultValueExist] = useState<boolean>(false);
226
+ const [initSplitClickEvOk, setInitSplitClickEvOk] = useState<boolean>(false);
223
227
  const [splitVals, setSplitVals] = useState<any[]>(['0000','00','00','00','00','00']);
224
228
  const [changedVal, setChangedVal] = useState<string>(value || '');
225
229
  const [isShow, setIsShow] = useState<boolean>(false);
@@ -476,14 +480,36 @@ const Date = forwardRef((props: DateProps, ref: any) => {
476
480
  e.stopPropagation(); // Avoid triggering other inputs
477
481
 
478
482
  e.target.select();
479
-
483
+
480
484
  resetDefauleValueExist();
481
485
 
482
- if (!dateDefaultValueExist) {
483
- const _full = `${splitVals[0]}-${splitVals[1]}-${splitVals[2]} ${splitVals[3]}:${splitVals[4]}:${splitVals[5]}`;
484
- onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full));
485
- setChangedVal(_full);
486
+ // update default value when splitting control clicked
487
+ const noTargetVal = typeof clickInitValue === 'undefined' || clickInitValue === null || clickInitValue === 'null' || clickInitValue === '';
488
+ const _targetVal: any = noTargetVal ? getNow() : clickInitValue;
489
+
490
+ if (noTargetVal) {
491
+ if (!dateDefaultValueExist) {
492
+ const [a, b] = initValue(_targetVal);
493
+ const _full = getFullTimeData(b).res;
494
+ onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full));
495
+ setChangedVal(_full);
496
+ }
497
+
498
+ } else {
499
+
500
+ if (!initSplitClickEvOk) {
501
+ const [a, b] = initValue(_targetVal);
502
+ const _full = getFullTimeData(b).res;
503
+ onChange?.(inputRef.current, valueResConverter(_full), isValidDate(_full));
504
+
505
+ //
506
+ setInitSplitClickEvOk(true);
507
+ }
508
+
509
+
486
510
  }
511
+
512
+
487
513
  }
488
514
 
489
515
 
@@ -677,15 +703,13 @@ const Date = forwardRef((props: DateProps, ref: any) => {
677
703
  return res;
678
704
  }
679
705
 
706
+ function initValue(v: any) {
707
+ const _dVal: any = onlyTime ? `${getFullTimeData(getNow()).date} ${v}` : v;
708
+ const _res = valueResConverter(_dVal);
680
709
 
681
- useEffect(() => {
682
-
683
- // update default value
684
- //--------------
685
- if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
686
- setDateDefaultValueExist(false);
687
-
688
- //
710
+ setChangedVal(_res);
711
+
712
+ if (isValidDate(_dVal)) {
689
713
  const {
690
714
  date,
691
715
  year,
@@ -694,63 +718,30 @@ const Date = forwardRef((props: DateProps, ref: any) => {
694
718
  hours,
695
719
  minutes,
696
720
  seconds
697
- } = getFullTimeData(getNow());
698
-
699
- if (!currentMaxDateDisabled && !currentMinDateDisabled) {
700
- setDateVal(date);
701
- setTimeVal([hours, minutes, seconds]);
702
- setSplitVals([year, month, day, hours, minutes, seconds]);
703
- } else {
704
-
705
- if (currentMaxDateDisabled) {
706
- setDateVal(MAX.date);
707
- setTimeVal([MAX.hours, MAX.minutes, MAX.seconds]);
708
- setSplitVals([MAX.year, MAX.month, MAX.day, MAX.hours, MAX.minutes, MAX.seconds]);
709
- }
710
- if (currentMinDateDisabled) {
711
- setDateVal(MIN.date);
712
- setTimeVal([MIN.hours, MIN.minutes, MIN.seconds]);
713
- setSplitVals([MIN.year, MIN.month, MIN.day, MIN.hours, MIN.minutes, MIN.seconds]);
714
- }
721
+ } = getFullTimeData(_dVal);
715
722
 
716
723
 
724
+ setDateVal(date);
725
+ setTimeVal([hours, minutes, seconds]);
726
+ setSplitVals([year, month, day, hours, minutes, seconds]);
727
+ }
717
728
 
718
- }
719
-
720
-
729
+ return [_res, _dVal]
721
730
 
722
-
731
+ }
732
+
723
733
 
734
+ useEffect(() => {
724
735
 
725
736
 
737
+ // update default value
738
+ //--------------
739
+ if (typeof value === 'undefined' || value === null || value === 'null' || value === '') {
740
+ setDateDefaultValueExist(false);
726
741
  } else {
727
742
  setDateDefaultValueExist(true);
728
-
729
- //
730
- const _dVal: any = onlyTime ? `${getFullTimeData(getNow()).date} ${value}` : value;
731
- const _res = valueResConverter(_dVal);
732
-
733
- setChangedVal(_res);
734
-
735
- if (isValidDate(_dVal)) {
736
- const {
737
- date,
738
- year,
739
- month,
740
- day,
741
- hours,
742
- minutes,
743
- seconds
744
- } = getFullTimeData(_dVal);
745
-
746
-
747
- setDateVal(date);
748
- setTimeVal([hours, minutes, seconds]);
749
- setSplitVals([year, month, day, hours, minutes, seconds]);
750
- }
751
-
752
- onLoad?.(_res, getFullTimeData(_dVal));
753
-
743
+ const [a, b] = initValue(value);
744
+ onLoad?.(a, getFullTimeData(b));
754
745
  }
755
746
 
756
747
 
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": "3.8.325",
5
+ "version": "3.8.425",
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",