@nutui/nutui-react-taro 1.4.2 → 1.4.3
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 +12 -0
- package/dist/esm/ActionSheet.js +4 -4
- package/dist/esm/Address.js +4 -4
- package/dist/esm/Audio.js +4 -4
- package/dist/esm/Badge.js +2 -2
- package/dist/esm/Barrage.js +2 -2
- package/dist/esm/Calendar.js +5 -5
- package/dist/esm/CalendarItem.js +2 -2
- package/dist/esm/Cascader.js +4 -4
- package/dist/esm/CircleProgress.js +2 -2
- package/dist/esm/DatePicker.js +5 -5
- package/dist/esm/Dialog.js +2 -2
- package/dist/esm/Drag.js +2 -2
- package/dist/esm/FixedNav.js +3 -3
- package/dist/esm/ImagePreview.js +4 -4
- package/dist/esm/InputNumber.js +2 -2
- package/dist/esm/MenuItem.js +3 -3
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/Notify.js +2 -2
- package/dist/esm/NumberKeyboard.js +4 -4
- package/dist/esm/Overlay.js +2 -2
- package/dist/esm/Picker.js +4 -4
- package/dist/esm/Popover.js +3 -3
- package/dist/esm/Popup.js +3 -3
- package/dist/esm/Range.js +3 -3
- package/dist/esm/ShortPassword.js +4 -4
- package/dist/esm/SideNavBar.js +4 -4
- package/dist/esm/Signature.js +2 -2
- package/dist/esm/TimeSelect.js +4 -4
- package/dist/esm/Toast.js +2 -2
- package/dist/esm/WaterMark.js +2 -2
- package/dist/esm/{actionsheet.taro-360d8d34.js → actionsheet.taro-a58d3d12.js} +1 -1
- package/dist/esm/{address.taro-c03b8b16.js → address.taro-1e2aea24.js} +22 -24
- package/dist/esm/{audio.taro-20890c93.js → audio.taro-fddcdfc0.js} +1 -1
- package/dist/esm/{badge.taro-9f72d846.js → badge.taro-fe9171ec.js} +1 -1
- package/dist/esm/{barrage.taro-d86c367a.js → barrage.taro-0e157b5e.js} +25 -23
- package/dist/esm/{calendar.taro-93b14945.js → calendar.taro-72974415.js} +2 -2
- package/dist/esm/{calendaritem.taro-85a8c4fc.js → calendaritem.taro-84e889eb.js} +19 -17
- package/dist/esm/{cascader.taro-459f7d45.js → cascader.taro-d8cb1c3e.js} +245 -235
- package/dist/esm/{circleprogress.taro-3c89a157.js → circleprogress.taro-47db537c.js} +2 -13
- package/dist/esm/{datepicker.taro-7de67b85.js → datepicker.taro-7199f521.js} +1 -1
- package/dist/esm/{dialog.taro-cf9e3087.js → dialog.taro-f54cfbf0.js} +1 -1
- package/dist/esm/{drag.taro-0717c783.js → drag.taro-82b6b27a.js} +4 -8
- package/dist/esm/ellipsis.taro-c0de6ff4.js +84 -76
- package/dist/esm/{fixednav.taro-005765f4.js → fixednav.taro-9e759320.js} +1 -1
- package/dist/esm/{imagepreview.taro-68e776f5.js → imagepreview.taro-3400ea03.js} +1 -1
- package/dist/esm/{inputnumber.taro-0a01f6e1.js → inputnumber.taro-dc39b853.js} +1 -0
- package/dist/esm/{menuitem.taro-2f8e69a4.js → menuitem.taro-216e9f7d.js} +17 -15
- package/dist/esm/{noticebar.taro-43c18dc9.js → noticebar.taro-94002898.js} +35 -33
- package/dist/esm/{notify.taro-d9c48fae.js → notify.taro-308e5892.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-9635ecc9.js → numberkeyboard.taro-5e8f0ddf.js} +1 -1
- package/dist/esm/nutui-react.es.js +30 -30
- package/dist/esm/{overlay.taro-be45fed5.js → overlay.taro-98367bc1.js} +1 -1
- package/dist/esm/{picker.taro-9b7263ca.js → picker.taro-3b5cc054.js} +14 -12
- package/dist/esm/{popover.taro-7e5dff8c.js → popover.taro-46d813e8.js} +18 -16
- package/dist/esm/{popup.taro-33d0bbc8.js → popup.taro-cb777e09.js} +1 -1
- package/dist/esm/pulltorefresh.taro-f26a20dd.js +81 -75
- package/dist/esm/{range.taro-4cbe2469.js → range.taro-c41e9b90.js} +72 -68
- package/dist/esm/{shortpassword.taro-4bd513ae.js → shortpassword.taro-3a3bf412.js} +1 -1
- package/dist/esm/{sidenavbar.taro-3b1f1218.js → sidenavbar.taro-06026f31.js} +1 -1
- package/dist/esm/{signature.taro-504357dc.js → signature.taro-17648cac.js} +79 -39
- package/dist/esm/swipe.taro-83bc248f.js +37 -35
- package/dist/esm/swiper.taro-852f6615.js +28 -26
- package/dist/esm/{timeselect.taro-000060af.js → timeselect.taro-fc7ec6ee.js} +1 -1
- package/dist/esm/{toast.taro-86862dff.js → toast.taro-0804b6b4.js} +1 -1
- package/dist/esm/useClientRect-bf69d7b3.js +12 -10
- package/dist/esm/{watermark.taro-d1f38563.js → watermark.taro-323d1cf3.js} +53 -41
- 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/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 +160 -111
- package/dist/nutui.react.umd.js +159 -110
- package/dist/packages/drag/drag.scss +1 -0
- package/dist/packages/inputnumber/inputnumber.scss +4 -1
- package/dist/packages/signature/signature.scss +10 -3
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/variables.scss +1 -1
- package/package.json +1 -1
package/dist/nutui.react.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react-taro v1.4.
|
|
2
|
+
* @nutui/nutui-react-taro v1.4.3-beta.0 Wed Jan 11 2023 14:52:52 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2023 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -509,7 +509,7 @@
|
|
|
509
509
|
if (closeOnClickOverlay) {
|
|
510
510
|
props.onClick && props.onClick(e2);
|
|
511
511
|
renderRef.current = false;
|
|
512
|
-
const id = setTimeout(() => {
|
|
512
|
+
const id = window.setTimeout(() => {
|
|
513
513
|
setShow(!visible);
|
|
514
514
|
}, duration * 1e3 * 0.8);
|
|
515
515
|
intervalRef.current = id;
|
|
@@ -6795,7 +6795,7 @@
|
|
|
6795
6795
|
showError: true,
|
|
6796
6796
|
showLoading: true
|
|
6797
6797
|
};
|
|
6798
|
-
const Image = (props) => {
|
|
6798
|
+
const Image$1 = (props) => {
|
|
6799
6799
|
useConfig$1();
|
|
6800
6800
|
const {
|
|
6801
6801
|
children,
|
|
@@ -6874,8 +6874,8 @@
|
|
|
6874
6874
|
name: "image-error"
|
|
6875
6875
|
})) : null);
|
|
6876
6876
|
};
|
|
6877
|
-
Image.defaultProps = defaultProps$1p;
|
|
6878
|
-
Image.displayName = "NutImage";
|
|
6877
|
+
Image$1.defaultProps = defaultProps$1p;
|
|
6878
|
+
Image$1.displayName = "NutImage";
|
|
6879
6879
|
const defaultProps$1o = {};
|
|
6880
6880
|
const Layout = (props) => {
|
|
6881
6881
|
({ ...defaultProps$1o, ...props });
|
|
@@ -8797,7 +8797,7 @@
|
|
|
8797
8797
|
const show = () => {
|
|
8798
8798
|
clearTimer();
|
|
8799
8799
|
if (duration) {
|
|
8800
|
-
timer = setTimeout(() => {
|
|
8800
|
+
timer = window.setTimeout(() => {
|
|
8801
8801
|
hide();
|
|
8802
8802
|
}, duration * 1e3);
|
|
8803
8803
|
}
|
|
@@ -9596,7 +9596,7 @@
|
|
|
9596
9596
|
if (type2 === "end") {
|
|
9597
9597
|
monthsPanel.current.style.webkitTransition = `transform ${time}ms cubic-bezier(0.19, 1, 0.22, 1)`;
|
|
9598
9598
|
clearTimeout(state.timer);
|
|
9599
|
-
state.timer = setTimeout(() => {
|
|
9599
|
+
state.timer = window.setTimeout(() => {
|
|
9600
9600
|
loadScroll();
|
|
9601
9601
|
}, time);
|
|
9602
9602
|
} else {
|
|
@@ -11000,6 +11000,7 @@
|
|
|
11000
11000
|
name: "minus",
|
|
11001
11001
|
onClick: reduceNumber
|
|
11002
11002
|
}), /* @__PURE__ */ React__default["default"].createElement("input", {
|
|
11003
|
+
className: "nut-number-input",
|
|
11003
11004
|
type: "number",
|
|
11004
11005
|
min,
|
|
11005
11006
|
max,
|
|
@@ -13847,7 +13848,6 @@
|
|
|
13847
13848
|
transformCache.current = { x: translateX.current, y: translateY.current };
|
|
13848
13849
|
};
|
|
13849
13850
|
const touchMove = (e2) => {
|
|
13850
|
-
e2.preventDefault();
|
|
13851
13851
|
if (e2.touches.length === 1 && dragRef.current) {
|
|
13852
13852
|
const touch = e2.touches[0];
|
|
13853
13853
|
const x = touch.clientX - axisCache.current.x;
|
|
@@ -13880,11 +13880,9 @@
|
|
|
13880
13880
|
}
|
|
13881
13881
|
};
|
|
13882
13882
|
React.useEffect(() => {
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
}, 200);
|
|
13887
|
-
});
|
|
13883
|
+
timer.current = window.setTimeout(() => {
|
|
13884
|
+
getInfo();
|
|
13885
|
+
}, 300);
|
|
13888
13886
|
return () => {
|
|
13889
13887
|
clearTimeout(timer.current);
|
|
13890
13888
|
};
|
|
@@ -14067,7 +14065,7 @@
|
|
|
14067
14065
|
}),
|
|
14068
14066
|
disabled: okBtnDisabled,
|
|
14069
14067
|
onClick: (e2) => handleOk(e2)
|
|
14070
|
-
}, okText));
|
|
14068
|
+
}, okText || locale.confirm));
|
|
14071
14069
|
return footerContent;
|
|
14072
14070
|
};
|
|
14073
14071
|
return /* @__PURE__ */ React__default["default"].createElement(DialogWrapper, {
|
|
@@ -14302,7 +14300,7 @@
|
|
|
14302
14300
|
const show = () => {
|
|
14303
14301
|
clearTimer();
|
|
14304
14302
|
if (duration) {
|
|
14305
|
-
timer = setTimeout(() => {
|
|
14303
|
+
timer = window.setTimeout(() => {
|
|
14306
14304
|
hide();
|
|
14307
14305
|
}, duration);
|
|
14308
14306
|
}
|
|
@@ -19305,7 +19303,6 @@
|
|
|
19305
19303
|
const b2 = cn("circleprogress");
|
|
19306
19304
|
const classes = classNames(className, b2(""));
|
|
19307
19305
|
const refRandomId = Math.random().toString(36).slice(-8);
|
|
19308
|
-
let lastTime = 0;
|
|
19309
19306
|
const styles = {
|
|
19310
19307
|
height: `${Number(radius) * 2}px`,
|
|
19311
19308
|
width: `${Number(radius) * 2}px`,
|
|
@@ -19323,24 +19320,14 @@
|
|
|
19323
19320
|
const rate = progress2 * (endRate - startRate) + startRate;
|
|
19324
19321
|
setOldValue(Math.min(Math.max(+rate, 0), 100));
|
|
19325
19322
|
if (endRate > startRate ? rate < endRate : rate > endRate) {
|
|
19326
|
-
rafId =
|
|
19323
|
+
rafId = window.requestAnimationFrame(animate);
|
|
19327
19324
|
}
|
|
19328
19325
|
};
|
|
19329
19326
|
if (rafId) {
|
|
19330
19327
|
cancelAnimationFrame2(rafId);
|
|
19331
19328
|
}
|
|
19332
|
-
rafId =
|
|
19329
|
+
rafId = window.requestAnimationFrame(animate);
|
|
19333
19330
|
}, [progress]);
|
|
19334
|
-
const requestAnimationFrame2 = function(callback) {
|
|
19335
|
-
const currTime = new Date().getTime();
|
|
19336
|
-
const timeToCall = Math.max(0, 16.7 - (currTime - lastTime));
|
|
19337
|
-
lastTime = currTime + timeToCall;
|
|
19338
|
-
const id = setTimeout(function() {
|
|
19339
|
-
callback();
|
|
19340
|
-
}, timeToCall);
|
|
19341
|
-
lastTime = currTime + timeToCall;
|
|
19342
|
-
return id;
|
|
19343
|
-
};
|
|
19344
19331
|
const cancelAnimationFrame2 = function(id) {
|
|
19345
19332
|
clearTimeout(id);
|
|
19346
19333
|
};
|
|
@@ -19557,7 +19544,10 @@
|
|
|
19557
19544
|
const startRollEasy = () => {
|
|
19558
19545
|
showhorseLamp();
|
|
19559
19546
|
const time = height / speed / 4 < 1 ? Number((height / speed / 4).toFixed(1)) * 1e3 : ~~(height / speed / 4) * 1e3;
|
|
19560
|
-
const timerCurr = setInterval(
|
|
19547
|
+
const timerCurr = window.setInterval(
|
|
19548
|
+
showhorseLamp,
|
|
19549
|
+
time + Number(standTime)
|
|
19550
|
+
);
|
|
19561
19551
|
SetTimer(timerCurr);
|
|
19562
19552
|
};
|
|
19563
19553
|
const showhorseLamp = () => {
|
|
@@ -19570,7 +19560,7 @@
|
|
|
19570
19560
|
}, time);
|
|
19571
19561
|
};
|
|
19572
19562
|
const startRoll = () => {
|
|
19573
|
-
const timerCurr = setInterval(() => {
|
|
19563
|
+
const timerCurr = window.setInterval(() => {
|
|
19574
19564
|
const chunk = 100;
|
|
19575
19565
|
for (let i = 0; i < chunk; i++) {
|
|
19576
19566
|
scroll(i, !(i < chunk - 1));
|
|
@@ -20590,7 +20580,7 @@
|
|
|
20590
20580
|
style2.top = `${Number(top) || parseFloat(top) || 0}px`;
|
|
20591
20581
|
style2.right = `${Number(right) || parseFloat(right) || 0}px`;
|
|
20592
20582
|
style2.zIndex = zIndex;
|
|
20593
|
-
style2.
|
|
20583
|
+
style2.background = color;
|
|
20594
20584
|
return style2;
|
|
20595
20585
|
};
|
|
20596
20586
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -22611,55 +22601,67 @@
|
|
|
22611
22601
|
}, []);
|
|
22612
22602
|
const init = () => {
|
|
22613
22603
|
let ratio = 1;
|
|
22614
|
-
Taro__default["default"].getSystemInfo({
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
}
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
ctx2.
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22604
|
+
Taro__default["default"].getSystemInfo().then((res) => {
|
|
22605
|
+
ratio = res.pixelRatio;
|
|
22606
|
+
const canvasWidth = `${(gapX + width) * ratio}px`;
|
|
22607
|
+
const canvasHeight = `${(gapY + height) * ratio}px`;
|
|
22608
|
+
const markWidth = width * ratio;
|
|
22609
|
+
const markHeight = height * ratio;
|
|
22610
|
+
let ctx2;
|
|
22611
|
+
let canvas;
|
|
22612
|
+
if ({}.TARO_ENV === "h5") {
|
|
22613
|
+
canvas = document.createElement("canvas");
|
|
22614
|
+
ctx2 = canvas.getContext("2d");
|
|
22615
|
+
canvas.setAttribute("width", canvasWidth);
|
|
22616
|
+
canvas.setAttribute("height", canvasHeight);
|
|
22617
|
+
} else {
|
|
22618
|
+
canvas = Taro__default["default"].createOffscreenCanvas({
|
|
22619
|
+
type: "2d",
|
|
22620
|
+
width: Number(canvasWidth),
|
|
22621
|
+
height: Number(canvasHeight)
|
|
22622
|
+
});
|
|
22623
|
+
ctx2 = canvas.getContext("2d");
|
|
22624
|
+
}
|
|
22625
|
+
if (ctx2) {
|
|
22626
|
+
if (image) {
|
|
22627
|
+
ctx2.translate(markWidth / 2, markHeight / 2);
|
|
22628
|
+
ctx2.rotate(Math.PI / 180 * Number(rotate));
|
|
22629
|
+
let img;
|
|
22630
|
+
if ({}.TARO_ENV === "h5") {
|
|
22631
|
+
img = new Image();
|
|
22632
|
+
} else {
|
|
22633
|
+
img = canvas.createImage();
|
|
22634
|
+
}
|
|
22635
|
+
img.crossOrigin = "anonymous";
|
|
22636
|
+
img.referrerPolicy = "no-referrer";
|
|
22637
|
+
img.src = image;
|
|
22638
|
+
img.onload = () => {
|
|
22639
|
+
ctx2.drawImage(
|
|
22640
|
+
img,
|
|
22641
|
+
-imageWidth * ratio / 2,
|
|
22642
|
+
-imageHeight * ratio / 2,
|
|
22643
|
+
imageWidth * ratio,
|
|
22644
|
+
imageHeight * ratio
|
|
22645
|
+
);
|
|
22646
|
+
ctx2.restore();
|
|
22647
|
+
setBase64Url(canvas.toDataURL());
|
|
22648
|
+
};
|
|
22649
|
+
} else if (content) {
|
|
22650
|
+
ctx2.textBaseline = "middle";
|
|
22651
|
+
ctx2.textAlign = "center";
|
|
22652
|
+
ctx2.translate(markWidth / 2, markHeight / 2);
|
|
22653
|
+
ctx2.rotate(Math.PI / 180 * Number(rotate));
|
|
22654
|
+
const markSize = Number(fontSize) * ratio;
|
|
22655
|
+
ctx2.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
|
|
22656
|
+
ctx2.fillStyle = fontColor;
|
|
22657
|
+
ctx2.fillText(content, 0, 0);
|
|
22645
22658
|
ctx2.restore();
|
|
22646
22659
|
setBase64Url(canvas.toDataURL());
|
|
22647
|
-
}
|
|
22648
|
-
} else
|
|
22649
|
-
|
|
22650
|
-
ctx2.textAlign = "center";
|
|
22651
|
-
ctx2.translate(markWidth / 2, markHeight / 2);
|
|
22652
|
-
ctx2.rotate(Math.PI / 180 * Number(rotate));
|
|
22653
|
-
const markSize = Number(fontSize) * ratio;
|
|
22654
|
-
ctx2.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
|
|
22655
|
-
ctx2.fillStyle = fontColor;
|
|
22656
|
-
ctx2.fillText(content, 0, 0);
|
|
22657
|
-
ctx2.restore();
|
|
22658
|
-
setBase64Url(canvas.toDataURL());
|
|
22660
|
+
}
|
|
22661
|
+
} else {
|
|
22662
|
+
throw new Error(locale.watermark.errorCanvasTips);
|
|
22659
22663
|
}
|
|
22660
|
-
}
|
|
22661
|
-
throw new Error(locale.watermark.errorCanvasTips);
|
|
22662
|
-
}
|
|
22664
|
+
});
|
|
22663
22665
|
};
|
|
22664
22666
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
22665
22667
|
className: cls,
|
|
@@ -23560,7 +23562,7 @@
|
|
|
23560
23562
|
}, [barrageList]);
|
|
23561
23563
|
const run = () => {
|
|
23562
23564
|
clearInterval(timer.current);
|
|
23563
|
-
timer.current = setInterval(() => {
|
|
23565
|
+
timer.current = window.setInterval(() => {
|
|
23564
23566
|
play();
|
|
23565
23567
|
run();
|
|
23566
23568
|
}, frequency);
|
|
@@ -23597,7 +23599,7 @@
|
|
|
23597
23599
|
Barrage.defaultProps = defaultProps$5;
|
|
23598
23600
|
Barrage.displayName = "NutBarrage";
|
|
23599
23601
|
const defaultProps$4 = {
|
|
23600
|
-
canvasId: "
|
|
23602
|
+
canvasId: "spcanvas",
|
|
23601
23603
|
type: "png",
|
|
23602
23604
|
lineWidth: 2,
|
|
23603
23605
|
strokeStyle: "#000",
|
|
@@ -23622,13 +23624,13 @@
|
|
|
23622
23624
|
...props
|
|
23623
23625
|
};
|
|
23624
23626
|
const b2 = cn("signature");
|
|
23625
|
-
React.useRef(null);
|
|
23627
|
+
const canvasRef = React.useRef(null);
|
|
23626
23628
|
const wrapRef = React.useRef(null);
|
|
23627
23629
|
const [canvasHeight, setCanvasHeight] = React.useState(0);
|
|
23628
23630
|
const [canvasWidth, setCanvasWidth] = React.useState(0);
|
|
23629
23631
|
const ctx2 = React.useRef(null);
|
|
23632
|
+
const [disalbeScroll] = React.useState("true");
|
|
23630
23633
|
const startEventHandler = (event) => {
|
|
23631
|
-
event.preventDefault();
|
|
23632
23634
|
if (ctx2.current) {
|
|
23633
23635
|
ctx2.current.beginPath();
|
|
23634
23636
|
ctx2.current.lineWidth = lineWidth;
|
|
@@ -23636,14 +23638,23 @@
|
|
|
23636
23638
|
}
|
|
23637
23639
|
};
|
|
23638
23640
|
const moveEventHandler = (event) => {
|
|
23639
|
-
event.preventDefault();
|
|
23640
23641
|
if (ctx2.current) {
|
|
23641
|
-
|
|
23642
|
-
|
|
23642
|
+
const evt = event.changedTouches[0];
|
|
23643
|
+
let mouseX = evt.x || evt.clientX;
|
|
23644
|
+
let mouseY = evt.y || evt.clientY;
|
|
23645
|
+
if (Taro__default["default"].getEnv() === "WEB" && canvasRef.current) {
|
|
23646
|
+
const coverPos = canvasRef.current.getBoundingClientRect();
|
|
23647
|
+
mouseX = evt.clientX - coverPos.left;
|
|
23648
|
+
mouseY = evt.clientY - coverPos.top;
|
|
23649
|
+
}
|
|
23650
|
+
Taro__default["default"].nextTick(() => {
|
|
23651
|
+
var _a, _b;
|
|
23652
|
+
(_a = ctx2.current) == null ? void 0 : _a.lineTo(mouseX, mouseY);
|
|
23653
|
+
(_b = ctx2.current) == null ? void 0 : _b.stroke();
|
|
23654
|
+
});
|
|
23643
23655
|
}
|
|
23644
23656
|
};
|
|
23645
23657
|
const endEventHandler = (event) => {
|
|
23646
|
-
event.preventDefault();
|
|
23647
23658
|
};
|
|
23648
23659
|
const handleClearBtn = () => {
|
|
23649
23660
|
if (ctx2.current) {
|
|
@@ -23664,6 +23675,7 @@
|
|
|
23664
23675
|
Taro__default["default"].canvasToTempFilePath({
|
|
23665
23676
|
canvas: res[0].node,
|
|
23666
23677
|
fileType: props.type,
|
|
23678
|
+
canvasId: `${canvasId}`,
|
|
23667
23679
|
success: (res2) => {
|
|
23668
23680
|
handleClearBtn();
|
|
23669
23681
|
confirm && confirm(res2.tempFilePath);
|
|
@@ -23675,44 +23687,81 @@
|
|
|
23675
23687
|
});
|
|
23676
23688
|
});
|
|
23677
23689
|
};
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23690
|
+
const canvasSetting = (canvasDom, width, height) => {
|
|
23691
|
+
const canvas = canvasDom;
|
|
23692
|
+
canvas.current = canvas;
|
|
23693
|
+
ctx2.current = canvas.getContext("2d");
|
|
23694
|
+
setCanvasWidth(width);
|
|
23695
|
+
setCanvasHeight(height);
|
|
23696
|
+
canvas.width = width;
|
|
23697
|
+
canvas.height = height;
|
|
23698
|
+
if (ctx2.current) {
|
|
23699
|
+
ctx2.current.clearRect(0, 0, width, height);
|
|
23700
|
+
ctx2.current.beginPath();
|
|
23701
|
+
ctx2.current.lineWidth = lineWidth;
|
|
23702
|
+
ctx2.current.strokeStyle = strokeStyle;
|
|
23703
|
+
}
|
|
23704
|
+
};
|
|
23681
23705
|
const initCanvas = () => {
|
|
23682
|
-
Taro__default["default"].
|
|
23683
|
-
{
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
|
|
23696
|
-
|
|
23697
|
-
|
|
23706
|
+
Taro__default["default"].nextTick(() => {
|
|
23707
|
+
setTimeout(() => {
|
|
23708
|
+
if (Taro__default["default"].getEnv() === "WEAPP" || Taro__default["default"].getEnv() === "JD") {
|
|
23709
|
+
Taro__default["default"].createSelectorQuery().select(`#${canvasId}`).fields(
|
|
23710
|
+
{
|
|
23711
|
+
node: true,
|
|
23712
|
+
size: true
|
|
23713
|
+
},
|
|
23714
|
+
(res) => {
|
|
23715
|
+
const { node, width, height } = res;
|
|
23716
|
+
canvasSetting(node, width, height);
|
|
23717
|
+
}
|
|
23718
|
+
).exec();
|
|
23719
|
+
} else {
|
|
23720
|
+
const canvasDom = document.getElementById(
|
|
23721
|
+
`${canvasId}`
|
|
23722
|
+
);
|
|
23723
|
+
let canvas = canvasDom;
|
|
23724
|
+
if ((canvasDom == null ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
23725
|
+
canvas = canvasDom == null ? void 0 : canvasDom.getElementsByTagName(
|
|
23726
|
+
"canvas"
|
|
23727
|
+
)[0];
|
|
23728
|
+
}
|
|
23729
|
+
canvasSetting(
|
|
23730
|
+
canvas,
|
|
23731
|
+
canvasDom == null ? void 0 : canvasDom.offsetWidth,
|
|
23732
|
+
canvasDom == null ? void 0 : canvasDom.offsetHeight
|
|
23733
|
+
);
|
|
23698
23734
|
}
|
|
23699
|
-
}
|
|
23700
|
-
)
|
|
23735
|
+
}, 1e3);
|
|
23736
|
+
});
|
|
23701
23737
|
};
|
|
23738
|
+
React.useEffect(() => {
|
|
23739
|
+
initCanvas();
|
|
23740
|
+
}, []);
|
|
23702
23741
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
23703
23742
|
className: `${b2()} ${className}`,
|
|
23704
23743
|
...rest
|
|
23705
23744
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
23706
|
-
className: `${b2("inner")}`,
|
|
23745
|
+
className: `${b2("inner")} spcanvas_WEAPP`,
|
|
23707
23746
|
ref: wrapRef
|
|
23708
|
-
}, /* @__PURE__ */ React__default["default"].createElement("canvas", {
|
|
23747
|
+
}, Taro__default["default"].getEnv() === "WEAPP" || Taro__default["default"].getEnv() === "JD" ? /* @__PURE__ */ React__default["default"].createElement("canvas", {
|
|
23709
23748
|
id: canvasId,
|
|
23749
|
+
ref: canvasRef,
|
|
23710
23750
|
canvasId,
|
|
23711
|
-
|
|
23751
|
+
disalbeScroll: true,
|
|
23712
23752
|
type: "2d",
|
|
23713
23753
|
onTouchStart: startEventHandler,
|
|
23714
23754
|
onTouchMove: moveEventHandler,
|
|
23715
23755
|
onTouchEnd: endEventHandler
|
|
23756
|
+
}) : /* @__PURE__ */ React__default["default"].createElement("canvas", {
|
|
23757
|
+
id: canvasId,
|
|
23758
|
+
ref: canvasRef,
|
|
23759
|
+
"canvas-id": canvasId,
|
|
23760
|
+
"disalbe-scroll": disalbeScroll,
|
|
23761
|
+
onTouchStart: startEventHandler,
|
|
23762
|
+
onTouchMove: moveEventHandler,
|
|
23763
|
+
onTouchEnd: endEventHandler,
|
|
23764
|
+
onTouchCancel: endEventHandler
|
|
23716
23765
|
})), /* @__PURE__ */ React__default["default"].createElement(Button, {
|
|
23717
23766
|
className: `${b2("btn")}`,
|
|
23718
23767
|
type: "default",
|
|
@@ -24037,7 +24086,7 @@
|
|
|
24037
24086
|
exports2.Grid = Grid;
|
|
24038
24087
|
exports2.GridItem = GridItem;
|
|
24039
24088
|
exports2.Icon = Icon$1;
|
|
24040
|
-
exports2.Image = Image;
|
|
24089
|
+
exports2.Image = Image$1;
|
|
24041
24090
|
exports2.ImagePreview = ImagePreview;
|
|
24042
24091
|
exports2.Indicator = Indicator;
|
|
24043
24092
|
exports2.Infiniteloading = Infiniteloading;
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
input,
|
|
44
|
+
.nut-number-input,
|
|
44
45
|
&__text--readonly {
|
|
45
46
|
width: $inputnumber-input-width;
|
|
46
47
|
height: 100%;
|
|
@@ -53,7 +54,9 @@
|
|
|
53
54
|
border-radius: $inputnumber-input-border-radius;
|
|
54
55
|
}
|
|
55
56
|
input::-webkit-outer-spin-button,
|
|
56
|
-
input::-webkit-inner-spin-button
|
|
57
|
+
input::-webkit-inner-spin-button,
|
|
58
|
+
.nut-number-input::-webkit-outer-spin-button,
|
|
59
|
+
.nut-number-input::-webkit-inner-spin-button {
|
|
57
60
|
appearance: none;
|
|
58
61
|
}
|
|
59
62
|
}
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
.nut-theme-dark {
|
|
2
2
|
.nut-signature {
|
|
3
3
|
&__inner {
|
|
4
|
-
|
|
4
|
+
Canvas {
|
|
5
5
|
background-color: $dark3;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
.demo-tips {
|
|
10
|
-
background-color: $dark3;
|
|
11
10
|
color: $dark1;
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
.nut-signature {
|
|
14
|
+
.spcanvas_WEAPP {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
Canvas {
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
15
21
|
&__inner {
|
|
16
|
-
|
|
22
|
+
Canvas {
|
|
17
23
|
background-color: #fff;
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
height: $signature-height;
|
|
20
27
|
margin-bottom: $signature-margin-bottom;
|
|
21
28
|
border: $signature-border-width solid $signature-border-color;
|