@nutui/nutui-react 2.0.0-beta.3 → 2.0.1-beta.0
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/CHANGELOG.md +17 -0
- package/dist/esm/Card/style/style.css +1 -1
- package/dist/esm/CircleProgress.js +1 -1
- package/dist/esm/DatePicker.js +31 -25
- package/dist/esm/Ellipsis/style/style.css +1 -1
- package/dist/esm/Form.js +1 -1
- package/dist/esm/InputNumber.js +6 -6
- package/dist/esm/SearchBar/style/style.css +1 -1
- package/dist/esm/SearchBar.js +2 -2
- package/dist/esm/Tag/style/style.css +1 -1
- package/dist/esm/Uploader.js +1 -0
- package/dist/esm/formitem2.js +2 -1
- package/dist/esm/tabs2.js +2 -8
- package/dist/esm/types/src/packages/animatingnumbers/animatingnumbers.d.ts +1 -3
- package/dist/esm/types/src/packages/animatingnumbers/animatingnumbers.taro.d.ts +1 -3
- package/dist/esm/types/src/packages/circleprogress/circleprogress.d.ts +1 -1
- package/dist/esm/types/src/packages/circleprogress/circleprogress.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +2 -2
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/nutui.react.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +1 -1
- package/dist/esm/types/src/packages/tag/tag.d.ts +1 -1
- package/dist/esm/types/src/packages/tag/tag.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/uploader/upload.d.ts +6 -6
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +2 -2
- package/dist/esm/use-props-value.js +21 -8
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +66 -50
- package/dist/nutui.react.umd.js +66 -50
- package/dist/packages/searchbar/searchbar.scss +2 -0
- package/dist/packages/tag/tag.scss +5 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/theme-dark.scss +1 -0
- package/dist/styles/theme-default.scss +1 -0
- package/dist/styles/variables.scss +6 -6
- package/dist/types/packages/animatingnumbers/animatingnumbers.d.ts +1 -3
- package/dist/types/packages/circleprogress/circleprogress.d.ts +1 -1
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/datepicker/datepicker.d.ts +2 -2
- package/dist/types/packages/tag/tag.d.ts +1 -1
- package/dist/types/packages/uploader/upload.d.ts +6 -6
- package/package.json +2 -3
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.
|
|
12
|
+
* @nutui/nutui-react v2.0.1 Wed Jul 05 2023 14:14:34 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -11400,6 +11400,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11400
11400
|
const iconClass = open ? "arrow-icon arrow-down" : "arrow-icon arrow-up";
|
|
11401
11401
|
return /* @__PURE__ */ React.createElement("div", { className: divClass, ref: listRef, onClick: clickFn, ...rest }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title ${classPrefix2}-border-bt` }, title, " ", /* @__PURE__ */ React.createElement("i", { className: iconClass })), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__content` }, children));
|
|
11402
11402
|
};
|
|
11403
|
+
function useForceUpdate() {
|
|
11404
|
+
const [, updateState] = React.useState();
|
|
11405
|
+
return React.useCallback(() => updateState({}), []);
|
|
11406
|
+
}
|
|
11403
11407
|
function usePropsValue({
|
|
11404
11408
|
value,
|
|
11405
11409
|
defaultValue,
|
|
@@ -11407,17 +11411,24 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11407
11411
|
onChange = (value2) => {
|
|
11408
11412
|
}
|
|
11409
11413
|
}) {
|
|
11410
|
-
const
|
|
11411
|
-
|
|
11412
|
-
);
|
|
11413
|
-
const handleUncontrolledChange = (val) => {
|
|
11414
|
-
setUncontrolled(val);
|
|
11415
|
-
onChange == null ? void 0 : onChange(val);
|
|
11416
|
-
};
|
|
11414
|
+
const forceUpdate = useForceUpdate();
|
|
11415
|
+
const dfValue = defaultValue !== void 0 ? defaultValue : finalValue;
|
|
11416
|
+
const stateRef = React.useRef(value !== void 0 ? value : dfValue);
|
|
11417
11417
|
if (value !== void 0) {
|
|
11418
|
-
|
|
11418
|
+
stateRef.current = value;
|
|
11419
11419
|
}
|
|
11420
|
-
|
|
11420
|
+
const setState = React.useCallback(
|
|
11421
|
+
(v) => {
|
|
11422
|
+
const prevState = stateRef.current;
|
|
11423
|
+
stateRef.current = v;
|
|
11424
|
+
if (prevState !== stateRef.current) {
|
|
11425
|
+
forceUpdate();
|
|
11426
|
+
}
|
|
11427
|
+
onChange == null ? void 0 : onChange(v);
|
|
11428
|
+
},
|
|
11429
|
+
[value, onChange]
|
|
11430
|
+
);
|
|
11431
|
+
return [stateRef.current, setState];
|
|
11421
11432
|
}
|
|
11422
11433
|
const defaultProps$17 = {
|
|
11423
11434
|
...ComponentDefaults,
|
|
@@ -11614,10 +11625,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11614
11625
|
};
|
|
11615
11626
|
}
|
|
11616
11627
|
const requestAniFrame$1 = requestAniFrame();
|
|
11617
|
-
function useForceUpdate() {
|
|
11618
|
-
const [, updateState] = React.useState();
|
|
11619
|
-
return React.useCallback(() => updateState({}), []);
|
|
11620
|
-
}
|
|
11621
11628
|
const defaultProps$13 = {
|
|
11622
11629
|
...ComponentDefaults,
|
|
11623
11630
|
tabStyle: {},
|
|
@@ -14304,12 +14311,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14304
14311
|
}
|
|
14305
14312
|
let timestmp = Math.max(cvalue.getTime(), startDate.getTime());
|
|
14306
14313
|
timestmp = Math.min(timestmp, endDate.getTime());
|
|
14307
|
-
return
|
|
14314
|
+
return timestmp;
|
|
14308
14315
|
};
|
|
14309
14316
|
const [currentDate, setCurrentDate] = usePropsValue({
|
|
14310
14317
|
value: props.value && formatValue(props.value),
|
|
14311
14318
|
defaultValue: formatValue(props.defaultValue || null),
|
|
14312
|
-
finalValue:
|
|
14319
|
+
finalValue: 0,
|
|
14313
14320
|
onChange: (val) => {
|
|
14314
14321
|
}
|
|
14315
14322
|
});
|
|
@@ -14352,7 +14359,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14352
14359
|
};
|
|
14353
14360
|
};
|
|
14354
14361
|
const ranges = () => {
|
|
14355
|
-
const curDate = currentDate;
|
|
14362
|
+
const curDate = new Date(currentDate);
|
|
14356
14363
|
if (!curDate)
|
|
14357
14364
|
return [];
|
|
14358
14365
|
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
|
|
@@ -14409,19 +14416,21 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14409
14416
|
return result;
|
|
14410
14417
|
};
|
|
14411
14418
|
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
14419
|
+
var _a2;
|
|
14420
|
+
const rangeType = type2.toLocaleLowerCase();
|
|
14412
14421
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
14413
|
-
|
|
14422
|
+
rangeType
|
|
14414
14423
|
)) {
|
|
14415
14424
|
const formatDate = [];
|
|
14416
14425
|
selectedValue.forEach((item) => {
|
|
14417
14426
|
formatDate.push(item);
|
|
14418
14427
|
});
|
|
14419
|
-
if (
|
|
14428
|
+
if (rangeType === "month-day" && formatDate.length < 3) {
|
|
14420
14429
|
formatDate.unshift(
|
|
14421
14430
|
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
14422
14431
|
);
|
|
14423
14432
|
}
|
|
14424
|
-
if (
|
|
14433
|
+
if (rangeType === "year-month" && formatDate.length < 3) {
|
|
14425
14434
|
formatDate.push(
|
|
14426
14435
|
new Date(defaultValue || startDate || endDate).getDate()
|
|
14427
14436
|
);
|
|
@@ -14433,9 +14442,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14433
14442
|
getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
|
|
14434
14443
|
);
|
|
14435
14444
|
let date2 = null;
|
|
14436
|
-
if (
|
|
14445
|
+
if (rangeType === "date" || rangeType === "month-day" || rangeType === "year-month") {
|
|
14437
14446
|
date2 = new Date(year, month, day);
|
|
14438
|
-
} else if (
|
|
14447
|
+
} else if (rangeType === "datetime") {
|
|
14439
14448
|
date2 = new Date(
|
|
14440
14449
|
year,
|
|
14441
14450
|
month,
|
|
@@ -14443,10 +14452,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14443
14452
|
Number(formatDate[3]),
|
|
14444
14453
|
Number(formatDate[4])
|
|
14445
14454
|
);
|
|
14446
|
-
} else if (
|
|
14455
|
+
} else if (rangeType === "datehour") {
|
|
14447
14456
|
date2 = new Date(year, month, day, Number(formatDate[3]));
|
|
14448
14457
|
}
|
|
14449
|
-
const isEqual2 = (currentDate == null ? void 0 :
|
|
14458
|
+
const isEqual2 = ((_a2 = new Date(currentDate)) == null ? void 0 : _a2.getTime()) === (date2 == null ? void 0 : date2.getTime());
|
|
14450
14459
|
date2 && isDate(date2) && !isEqual2 && setCurrentDate(formatValue(date2));
|
|
14451
14460
|
}
|
|
14452
14461
|
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
@@ -14496,23 +14505,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14496
14505
|
return arr;
|
|
14497
14506
|
};
|
|
14498
14507
|
const getDateIndex = (type22) => {
|
|
14508
|
+
const date2 = new Date(currentDate);
|
|
14499
14509
|
if (!currentDate)
|
|
14500
14510
|
return 0;
|
|
14501
|
-
let d = 0;
|
|
14502
14511
|
if (type22 === "year") {
|
|
14503
|
-
|
|
14504
|
-
}
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
}
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14512
|
+
return date2.getFullYear();
|
|
14513
|
+
}
|
|
14514
|
+
if (type22 === "month") {
|
|
14515
|
+
return date2.getMonth() + 1;
|
|
14516
|
+
}
|
|
14517
|
+
if (type22 === "day") {
|
|
14518
|
+
return date2.getDate();
|
|
14519
|
+
}
|
|
14520
|
+
if (type22 === "hour") {
|
|
14521
|
+
return date2.getHours();
|
|
14522
|
+
}
|
|
14523
|
+
if (type22 === "minute") {
|
|
14524
|
+
return date2.getMinutes();
|
|
14525
|
+
}
|
|
14526
|
+
if (type22 === "seconds") {
|
|
14527
|
+
return date2.getSeconds();
|
|
14528
|
+
}
|
|
14529
|
+
return 0;
|
|
14516
14530
|
};
|
|
14517
14531
|
const columns = () => {
|
|
14518
14532
|
const val = ranges().map((res, columnIndex) => {
|
|
@@ -14530,7 +14544,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14530
14544
|
if (currentDate) {
|
|
14531
14545
|
setOptions(columns());
|
|
14532
14546
|
}
|
|
14533
|
-
}, []);
|
|
14547
|
+
}, [currentDate]);
|
|
14534
14548
|
return /* @__PURE__ */ React.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React.createElement(
|
|
14535
14549
|
Picker$1,
|
|
14536
14550
|
{
|
|
@@ -15619,7 +15633,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15619
15633
|
__publicField(this, "registerField", (field) => {
|
|
15620
15634
|
this.fieldEntities.push(field);
|
|
15621
15635
|
return () => {
|
|
15622
|
-
this.fieldEntities = this.fieldEntities.filter((item) => item
|
|
15636
|
+
this.fieldEntities = this.fieldEntities.filter((item) => item !== field);
|
|
15623
15637
|
if (this.store) {
|
|
15624
15638
|
delete this.store[field.props.name];
|
|
15625
15639
|
}
|
|
@@ -15777,9 +15791,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15777
15791
|
if ((_a2 = children == null ? void 0 : children.props) == null ? void 0 : _a2.defaultValue) {
|
|
15778
15792
|
console.warn("通过 initialValue 设置初始值");
|
|
15779
15793
|
}
|
|
15794
|
+
const fieldValue = getFieldValue(name);
|
|
15780
15795
|
const controlled = {
|
|
15781
15796
|
...children.props,
|
|
15782
|
-
[this.props.valuePropName || "value"]:
|
|
15797
|
+
[this.props.valuePropName || "value"]: fieldValue !== void 0 ? fieldValue : this.props.initialValue,
|
|
15783
15798
|
[this.props.trigger || "onChange"]: (...args) => {
|
|
15784
15799
|
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
15785
15800
|
if (originOnChange) {
|
|
@@ -16219,14 +16234,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16219
16234
|
};
|
|
16220
16235
|
const addAllow = (value2 = _checked) => {
|
|
16221
16236
|
if (formatter) {
|
|
16222
|
-
const numValue = String(value2).replace(/[^0-9
|
|
16237
|
+
const numValue = String(value2).replace(/[^0-9|.]/gi, "");
|
|
16223
16238
|
return Number(numValue) < Number(max) && !disabled;
|
|
16224
16239
|
}
|
|
16225
16240
|
return Number(value2) < Number(max) && !disabled;
|
|
16226
16241
|
};
|
|
16227
16242
|
const reduceAllow = (value2 = _checked) => {
|
|
16228
16243
|
if (formatter) {
|
|
16229
|
-
const numValue = String(value2).replace(/[^0-9
|
|
16244
|
+
const numValue = String(value2).replace(/[^0-9|.]/gi, "");
|
|
16230
16245
|
return Number(numValue) > Number(min) && !disabled;
|
|
16231
16246
|
}
|
|
16232
16247
|
return Number(value2) > Number(min) && !disabled;
|
|
@@ -16257,7 +16272,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16257
16272
|
onMinus && onMinus(e);
|
|
16258
16273
|
if (reduceAllow()) {
|
|
16259
16274
|
if (formatter) {
|
|
16260
|
-
const numValue = String(_checked).replace(/[^0-9
|
|
16275
|
+
const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
|
|
16261
16276
|
const outputValue = Number(numValue) - Number(step);
|
|
16262
16277
|
inputRef.current = formatter(outputValue);
|
|
16263
16278
|
emitChange(outputValue, e);
|
|
@@ -16273,7 +16288,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16273
16288
|
onPlus && onPlus(e);
|
|
16274
16289
|
if (addAllow()) {
|
|
16275
16290
|
if (formatter) {
|
|
16276
|
-
const numValue = String(_checked).replace(/[^0-9
|
|
16291
|
+
const numValue = String(_checked).replace(/[^0-9|.]/gi, "");
|
|
16277
16292
|
const outputValue = Number(numValue) + Number(step);
|
|
16278
16293
|
inputRef.current = formatter(outputValue);
|
|
16279
16294
|
emitChange(outputValue, e);
|
|
@@ -16299,7 +16314,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16299
16314
|
const changeFormatValue = (e) => {
|
|
16300
16315
|
const input = e.target.value;
|
|
16301
16316
|
const numReg = new RegExp("^[0-9]*$");
|
|
16302
|
-
const numValue = input.replace(/[^0-9
|
|
16317
|
+
const numValue = input.replace(/[^0-9|.]/gi, "");
|
|
16303
16318
|
if (formatter) {
|
|
16304
16319
|
if (!numReg.test(input[0]) && numValue) {
|
|
16305
16320
|
setChecked(formatter(numValue));
|
|
@@ -16318,7 +16333,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16318
16333
|
const burFormatValue = (e) => {
|
|
16319
16334
|
const input = e.target.value;
|
|
16320
16335
|
const numReg = new RegExp("^[0-9]*$");
|
|
16321
|
-
const numValue = input.replace(/[^0-9
|
|
16336
|
+
const numValue = input.replace(/[^0-9|.]/gi, "");
|
|
16322
16337
|
if (formatter) {
|
|
16323
16338
|
if (formatter(numValue) === input) {
|
|
16324
16339
|
emitChange(numValue, e);
|
|
@@ -17573,7 +17588,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17573
17588
|
disabled,
|
|
17574
17589
|
readOnly,
|
|
17575
17590
|
maxLength,
|
|
17576
|
-
|
|
17591
|
+
onKeyDown: onKeydown,
|
|
17577
17592
|
onChange: (e) => change(e),
|
|
17578
17593
|
onFocus: (e) => focus(e),
|
|
17579
17594
|
onBlur: (e) => blur(e),
|
|
@@ -17622,7 +17637,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17622
17637
|
onClear && onClear(event);
|
|
17623
17638
|
forceFocus();
|
|
17624
17639
|
};
|
|
17625
|
-
const
|
|
17640
|
+
const onKeydown = (e) => {
|
|
17626
17641
|
if (e.key === "Enter") {
|
|
17627
17642
|
const event = e.nativeEvent;
|
|
17628
17643
|
if (typeof event.cancelable !== "boolean" || event.cancelable) {
|
|
@@ -18362,6 +18377,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18362
18377
|
try {
|
|
18363
18378
|
uploadOption.sourceFile = fileItem.formData.get(name);
|
|
18364
18379
|
} catch (error) {
|
|
18380
|
+
console.warn(error);
|
|
18365
18381
|
}
|
|
18366
18382
|
uploadOption.onStart = (option) => {
|
|
18367
18383
|
clearUploadQueue(index);
|
|
@@ -21368,7 +21384,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21368
21384
|
(a2, b) => parseFloat(a2) - parseFloat(b)
|
|
21369
21385
|
);
|
|
21370
21386
|
const stopArr = [];
|
|
21371
|
-
colorArr.
|
|
21387
|
+
colorArr.forEach((item) => {
|
|
21372
21388
|
const obj = {
|
|
21373
21389
|
key: "",
|
|
21374
21390
|
value: ""
|