shineout 3.9.11-beta.3 → 3.9.11-beta.5
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/cjs/index.js +1 -1
- package/dist/shineout.js +37 -8
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/shineout.min.js.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +5 -5
package/cjs/index.js
CHANGED
|
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
522
522
|
// 此文件由脚本自动生成,请勿直接修改。
|
|
523
523
|
// This file was generated automatically by a script. Please do not modify it directly.
|
|
524
524
|
var _default = exports.default = {
|
|
525
|
-
version: '3.9.11-beta.
|
|
525
|
+
version: '3.9.11-beta.5'
|
|
526
526
|
};
|
package/dist/shineout.js
CHANGED
|
@@ -12402,7 +12402,7 @@ var handleStyle = function handleStyle(style) {
|
|
|
12402
12402
|
};
|
|
12403
12403
|
/* harmony default export */ var jss_style_handleStyle = (handleStyle);
|
|
12404
12404
|
;// CONCATENATED MODULE: ../shineout-style/src/version.ts
|
|
12405
|
-
/* harmony default export */ var version = ('3.9.11-beta.
|
|
12405
|
+
/* harmony default export */ var version = ('3.9.11-beta.5');
|
|
12406
12406
|
;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
|
|
12407
12407
|
|
|
12408
12408
|
|
|
@@ -56204,7 +56204,8 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56204
56204
|
step = _props$step === void 0 ? 1 : _props$step,
|
|
56205
56205
|
cancelBlurChange = props.cancelBlurChange,
|
|
56206
56206
|
disabled = props.disabled,
|
|
56207
|
-
coin = props.coin
|
|
56207
|
+
coin = props.coin,
|
|
56208
|
+
defaultValue = props.defaultValue;
|
|
56208
56209
|
var getStringValue = function getStringValue(value) {
|
|
56209
56210
|
if (value === undefined) return value;
|
|
56210
56211
|
if (typeof value === 'number') {
|
|
@@ -56217,8 +56218,10 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56217
56218
|
_React$useState2 = slicedToArray_default()(_React$useState, 2),
|
|
56218
56219
|
inernalInputValue = _React$useState2[0],
|
|
56219
56220
|
setInternalInputValue = _React$useState2[1];
|
|
56221
|
+
var focusedRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(false);
|
|
56220
56222
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
56221
|
-
|
|
56223
|
+
// 聚焦编辑期间不同步外部值,避免 form 回填 defaultValue 覆盖用户输入
|
|
56224
|
+
if (props.value !== inernalInputValue && !focusedRef.current) {
|
|
56222
56225
|
setInternalInputValue(getStringValue(props.value));
|
|
56223
56226
|
}
|
|
56224
56227
|
}, [props.value]);
|
|
@@ -56245,8 +56248,10 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56245
56248
|
if (val.endsWith('.') || val.includes('.') && val.endsWith('0')) return;
|
|
56246
56249
|
var num = parseFloat(val);
|
|
56247
56250
|
if (val === '') {
|
|
56248
|
-
//
|
|
56249
|
-
|
|
56251
|
+
// 聚焦编辑期间清空发送 null 而非 undefined
|
|
56252
|
+
// 因为 form 层的 defaultValue 回填仅检查 value === undefined
|
|
56253
|
+
// 发送 null 可以让 form 数据跟随更新,同时避免触发回填
|
|
56254
|
+
onChange === null || onChange === void 0 || onChange(focusedRef.current ? null : allowNull ? null : undefined);
|
|
56250
56255
|
return;
|
|
56251
56256
|
}
|
|
56252
56257
|
if (isNaN(num)) return;
|
|
@@ -56257,9 +56262,27 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56257
56262
|
;
|
|
56258
56263
|
});
|
|
56259
56264
|
var onNumberBlur = use_persist_fn(function (e) {
|
|
56265
|
+
focusedRef.current = false;
|
|
56260
56266
|
var target = e.target;
|
|
56261
56267
|
var newValue = target.value;
|
|
56262
56268
|
|
|
56269
|
+
// 输入为空且有 defaultValue 时,失焦恢复为 defaultValue
|
|
56270
|
+
if (newValue === '' && defaultValue != null) {
|
|
56271
|
+
var _num = typeof defaultValue === 'number' ? defaultValue : parseFloat(String(defaultValue));
|
|
56272
|
+
if (isNaN(_num)) _num = 0;
|
|
56273
|
+
if (typeof digits === 'number') {
|
|
56274
|
+
_num = parseFloat(_num.toFixed(digits));
|
|
56275
|
+
}
|
|
56276
|
+
_num = commonFormat(_num);
|
|
56277
|
+
setInternalInputValue(getStringValue(_num));
|
|
56278
|
+
if (_num !== value) {
|
|
56279
|
+
target.value = String(_num);
|
|
56280
|
+
if (!cancelBlurChange) onInnerChange(_num);
|
|
56281
|
+
}
|
|
56282
|
+
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
56283
|
+
return;
|
|
56284
|
+
}
|
|
56285
|
+
|
|
56263
56286
|
// 没有输入值
|
|
56264
56287
|
if (newValue === '' && value === undefined) {
|
|
56265
56288
|
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
@@ -56290,6 +56313,11 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56290
56313
|
}
|
|
56291
56314
|
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
56292
56315
|
});
|
|
56316
|
+
var onNumberFocus = use_persist_fn(function (e) {
|
|
56317
|
+
var _props$onFocus;
|
|
56318
|
+
focusedRef.current = true;
|
|
56319
|
+
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, e);
|
|
56320
|
+
});
|
|
56293
56321
|
var onNumberChange = use_persist_fn(function (value) {
|
|
56294
56322
|
var result = value;
|
|
56295
56323
|
onInnerChange(result);
|
|
@@ -56326,7 +56354,7 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
56326
56354
|
coin: coin,
|
|
56327
56355
|
onChange: onNumberChange,
|
|
56328
56356
|
onBlur: onNumberBlur,
|
|
56329
|
-
onFocus:
|
|
56357
|
+
onFocus: onNumberFocus,
|
|
56330
56358
|
cancelBlurChange: true
|
|
56331
56359
|
})), {}, {
|
|
56332
56360
|
onPlus: handlePlus,
|
|
@@ -56377,7 +56405,8 @@ var InputNumber = function InputNumber(props) {
|
|
|
56377
56405
|
var _useInputNumber = use_input_number(objectSpread2_default()({
|
|
56378
56406
|
value: commonProps.value,
|
|
56379
56407
|
onChange: commonProps.onChange,
|
|
56380
|
-
disabled: !!commonProps.disabled
|
|
56408
|
+
disabled: !!commonProps.disabled,
|
|
56409
|
+
defaultValue: props.defaultValue
|
|
56381
56410
|
}, numberFormatParams)),
|
|
56382
56411
|
onMinus = _useInputNumber.onMinus,
|
|
56383
56412
|
onPlus = _useInputNumber.onPlus,
|
|
@@ -75510,7 +75539,7 @@ var upload_interface = __webpack_require__(8821);
|
|
|
75510
75539
|
|
|
75511
75540
|
|
|
75512
75541
|
/* harmony default export */ var src_0 = ({
|
|
75513
|
-
version: '3.9.11-beta.
|
|
75542
|
+
version: '3.9.11-beta.5'
|
|
75514
75543
|
});
|
|
75515
75544
|
}();
|
|
75516
75545
|
/******/ return __webpack_exports__;
|