@nutui/nutui-react-taro 3.0.0 → 3.0.1
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 +24 -0
- package/dist/cjs/packages/actionsheet/style/style.css +12 -0
- package/dist/cjs/packages/address/style/style.css +12 -0
- package/dist/cjs/packages/calendar/style/style.css +12 -0
- package/dist/cjs/packages/cascader/style/style.css +12 -0
- package/dist/cjs/packages/configprovider/types.d.ts +1 -1
- package/dist/cjs/packages/datepicker/datepicker.js +8 -6
- package/dist/cjs/packages/datepicker/style/style.css +12 -0
- package/dist/cjs/packages/datepickerview/datepickerview.d.ts +3 -0
- package/dist/cjs/packages/datepickerview/datepickerview.js +119 -0
- package/dist/cjs/packages/datepickerview/index.d.ts +3 -0
- package/dist/cjs/packages/{subsidenavbar → datepickerview}/index.js +2 -2
- package/dist/cjs/packages/datepickerview/style/datepickerview.scss +4 -0
- package/dist/cjs/packages/datepickerview/style/index.js +1 -0
- package/dist/cjs/packages/datepickerview/style/style.css +8 -0
- package/dist/cjs/packages/datepickerview/style/style.harmony.css +8 -0
- package/dist/cjs/packages/datepickerview/types.d.ts +15 -0
- package/dist/cjs/packages/datepickerview/types.js +4 -0
- package/dist/cjs/packages/dialog/dialog.js +8 -3
- package/dist/cjs/packages/dialog/style/dialog.scss +0 -1
- package/dist/cjs/packages/dialog/style/style.css +0 -1
- package/dist/cjs/packages/dialog/style/style.harmony.css +0 -1
- package/dist/cjs/packages/drag/drag.js +33 -39
- package/dist/cjs/packages/drag/style/drag.scss +1 -0
- package/dist/cjs/packages/drag/style/style.css +1 -0
- package/dist/cjs/packages/drag/style/style.harmony.css +1 -0
- package/dist/cjs/packages/imagepreview/style/style.css +12 -0
- package/dist/cjs/packages/input/input.js +2 -1
- package/dist/cjs/packages/input/style/input.scss +6 -4
- package/dist/cjs/packages/input/style/style.css +4 -0
- package/dist/cjs/packages/input/style/style.harmony.css +8 -0
- package/dist/cjs/packages/numberkeyboard/style/style.css +12 -0
- package/dist/cjs/packages/nutui.react.build.d.ts +11 -15
- package/dist/cjs/packages/nutui.react.build.js +172 -180
- package/dist/cjs/packages/nutui.react.d.ts +16 -22
- package/dist/cjs/packages/nutui.react.js +177 -187
- package/dist/cjs/packages/nutui.react.scss.d.ts +5 -7
- package/dist/cjs/packages/nutui.react.scss.js +5 -7
- package/dist/cjs/packages/overlay/overlay.js +4 -5
- package/dist/cjs/packages/overlay/style/overlay.scss +0 -4
- package/dist/cjs/packages/picker/style/style.css +12 -0
- package/dist/cjs/packages/popover/style/style.css +12 -0
- package/dist/cjs/packages/popup/popup.js +17 -11
- package/dist/cjs/packages/popup/style/popup.scss +12 -4
- package/dist/cjs/packages/popup/style/style.css +12 -0
- package/dist/cjs/packages/popup/style/style.harmony.css +12 -0
- package/dist/cjs/packages/shortpassword/shortpassword.js +5 -7
- package/dist/cjs/packages/shortpassword/style/shortpassword.scss +10 -0
- package/dist/cjs/packages/shortpassword/style/style.css +21 -0
- package/dist/cjs/packages/shortpassword/style/style.harmony.css +9 -0
- package/dist/cjs/packages/tabbar/style/style.css +6 -0
- package/dist/cjs/packages/tabbaritem/style/style.css +6 -0
- package/dist/cjs/packages/tabbaritem/style/style.harmony.css +6 -0
- package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +6 -0
- package/dist/cjs/packages/tabs/tabs.js +6 -13
- package/dist/cjs/packages/textarea/textarea.js +1 -1
- package/dist/cjs/packages/timeselect/style/style.css +12 -0
- package/dist/cjs/packages/tour/style/style.css +12 -0
- package/dist/es/packages/actionsheet/style/style.css +12 -0
- package/dist/es/packages/address/style/style.css +12 -0
- package/dist/es/packages/calendar/style/style.css +12 -0
- package/dist/es/packages/cascader/style/style.css +12 -0
- package/dist/es/packages/configprovider/types.d.ts +1 -1
- package/dist/es/packages/datepicker/datepicker.js +8 -6
- package/dist/es/packages/datepicker/style/style.css +12 -0
- package/dist/es/packages/datepickerview/datepickerview.d.ts +3 -0
- package/dist/es/packages/datepickerview/datepickerview.js +107 -0
- package/dist/es/packages/datepickerview/index.d.ts +3 -0
- package/dist/es/packages/datepickerview/index.js +2 -0
- package/dist/es/packages/datepickerview/style/datepickerview.scss +4 -0
- package/dist/es/packages/datepickerview/style/index.js +1 -0
- package/dist/es/packages/datepickerview/style/style.css +8 -0
- package/dist/es/packages/datepickerview/style/style.harmony.css +8 -0
- package/dist/es/packages/datepickerview/types.d.ts +15 -0
- package/dist/es/packages/datepickerview/types.js +1 -0
- package/dist/es/packages/dialog/dialog.js +8 -3
- package/dist/es/packages/dialog/style/dialog.scss +0 -1
- package/dist/es/packages/dialog/style/style.css +0 -1
- package/dist/es/packages/dialog/style/style.harmony.css +0 -1
- package/dist/es/packages/drag/drag.js +33 -39
- package/dist/es/packages/drag/style/drag.scss +1 -0
- package/dist/es/packages/drag/style/style.css +1 -0
- package/dist/es/packages/drag/style/style.harmony.css +1 -0
- package/dist/es/packages/imagepreview/style/style.css +12 -0
- package/dist/es/packages/input/input.js +2 -1
- package/dist/es/packages/input/style/input.scss +6 -4
- package/dist/es/packages/input/style/style.css +4 -0
- package/dist/es/packages/input/style/style.harmony.css +8 -0
- package/dist/es/packages/numberkeyboard/style/style.css +12 -0
- package/dist/es/packages/nutui.react.build.d.ts +11 -15
- package/dist/es/packages/nutui.react.build.js +11 -15
- package/dist/es/packages/overlay/overlay.js +4 -5
- package/dist/es/packages/overlay/style/overlay.scss +0 -4
- package/dist/es/packages/picker/style/style.css +12 -0
- package/dist/es/packages/popover/style/style.css +12 -0
- package/dist/es/packages/popup/popup.js +17 -11
- package/dist/es/packages/popup/style/popup.scss +12 -4
- package/dist/es/packages/popup/style/style.css +12 -0
- package/dist/es/packages/popup/style/style.harmony.css +12 -0
- package/dist/es/packages/shortpassword/shortpassword.js +5 -7
- package/dist/es/packages/shortpassword/style/shortpassword.scss +10 -0
- package/dist/es/packages/shortpassword/style/style.css +21 -0
- package/dist/es/packages/shortpassword/style/style.harmony.css +9 -0
- package/dist/es/packages/tabbar/style/style.css +6 -0
- package/dist/es/packages/tabbaritem/style/style.css +6 -0
- package/dist/es/packages/tabbaritem/style/style.harmony.css +6 -0
- package/dist/es/packages/tabbaritem/style/tabbaritem.scss +6 -0
- package/dist/es/packages/tabs/tabs.js +6 -13
- package/dist/es/packages/textarea/textarea.js +2 -2
- package/dist/es/packages/timeselect/style/style.css +12 -0
- package/dist/es/packages/tour/style/style.css +12 -0
- package/dist/nutui.react.umd.js +1317 -1383
- package/dist/style.css +1 -1
- package/dist/style.scss +32 -34
- package/dist/styles/variables-jmapp.scss +0 -50
- package/dist/styles/variables-jrkf.scss +0 -50
- package/dist/styles/variables.scss +0 -49
- package/package.json +1 -1
- package/dist/cjs/packages/sidenavbar/context.d.ts +0 -1
- package/dist/cjs/packages/sidenavbar/context.js +0 -12
- package/dist/cjs/packages/sidenavbar/index.d.ts +0 -3
- package/dist/cjs/packages/sidenavbar/index.js +0 -12
- package/dist/cjs/packages/sidenavbar/sidenavbar.d.ts +0 -14
- package/dist/cjs/packages/sidenavbar/sidenavbar.js +0 -75
- package/dist/cjs/packages/sidenavbar/style/index.js +0 -2
- package/dist/cjs/packages/sidenavbar/style/sidenavbar.scss +0 -89
- package/dist/cjs/packages/sidenavbar/style/style.css +0 -443
- package/dist/cjs/packages/sidenavbar/style/style.harmony.css +0 -74
- package/dist/cjs/packages/sidenavbar/utils.d.ts +0 -3
- package/dist/cjs/packages/sidenavbar/utils.js +0 -23
- package/dist/cjs/packages/sidenavbaritem/index.d.ts +0 -3
- package/dist/cjs/packages/sidenavbaritem/index.js +0 -12
- package/dist/cjs/packages/sidenavbaritem/sidenavbaritem.d.ts +0 -11
- package/dist/cjs/packages/sidenavbaritem/sidenavbaritem.js +0 -34
- package/dist/cjs/packages/sidenavbaritem/style/index.js +0 -1
- package/dist/cjs/packages/sidenavbaritem/style/sidenavbaritem.scss +0 -13
- package/dist/cjs/packages/sidenavbaritem/style/style.css +0 -14
- package/dist/cjs/packages/sidenavbaritem/style/style.harmony.css +0 -14
- package/dist/cjs/packages/subsidenavbar/index.d.ts +0 -3
- package/dist/cjs/packages/subsidenavbar/style/css.js +0 -1
- package/dist/cjs/packages/subsidenavbar/style/index.js +0 -1
- package/dist/cjs/packages/subsidenavbar/style/style.css +0 -20
- package/dist/cjs/packages/subsidenavbar/style/style.harmony.css +0 -20
- package/dist/cjs/packages/subsidenavbar/style/subsidenavbar.scss +0 -26
- package/dist/cjs/packages/subsidenavbar/subsidenavbar.d.ts +0 -13
- package/dist/cjs/packages/subsidenavbar/subsidenavbar.js +0 -90
- package/dist/es/packages/sidenavbar/context.d.ts +0 -1
- package/dist/es/packages/sidenavbar/context.js +0 -2
- package/dist/es/packages/sidenavbar/index.d.ts +0 -3
- package/dist/es/packages/sidenavbar/index.js +0 -2
- package/dist/es/packages/sidenavbar/sidenavbar.d.ts +0 -38
- package/dist/es/packages/sidenavbar/sidenavbar.js +0 -63
- package/dist/es/packages/sidenavbar/style/css.js +0 -1
- package/dist/es/packages/sidenavbar/style/index.js +0 -2
- package/dist/es/packages/sidenavbar/style/sidenavbar.scss +0 -89
- package/dist/es/packages/sidenavbar/style/style.css +0 -443
- package/dist/es/packages/sidenavbar/style/style.harmony.css +0 -74
- package/dist/es/packages/sidenavbar/utils.d.ts +0 -3
- package/dist/es/packages/sidenavbar/utils.js +0 -14
- package/dist/es/packages/sidenavbaritem/index.d.ts +0 -3
- package/dist/es/packages/sidenavbaritem/index.js +0 -2
- package/dist/es/packages/sidenavbaritem/sidenavbaritem.d.ts +0 -11
- package/dist/es/packages/sidenavbaritem/sidenavbaritem.js +0 -23
- package/dist/es/packages/sidenavbaritem/style/css.js +0 -1
- package/dist/es/packages/sidenavbaritem/style/index.js +0 -1
- package/dist/es/packages/sidenavbaritem/style/sidenavbaritem.scss +0 -13
- package/dist/es/packages/sidenavbaritem/style/style.css +0 -14
- package/dist/es/packages/sidenavbaritem/style/style.harmony.css +0 -14
- package/dist/es/packages/subsidenavbar/index.d.ts +0 -3
- package/dist/es/packages/subsidenavbar/index.js +0 -2
- package/dist/es/packages/subsidenavbar/style/css.js +0 -1
- package/dist/es/packages/subsidenavbar/style/index.js +0 -1
- package/dist/es/packages/subsidenavbar/style/style.css +0 -20
- package/dist/es/packages/subsidenavbar/style/style.harmony.css +0 -20
- package/dist/es/packages/subsidenavbar/style/subsidenavbar.scss +0 -26
- package/dist/es/packages/subsidenavbar/subsidenavbar.d.ts +0 -13
- package/dist/es/packages/subsidenavbar/subsidenavbar.js +0 -79
- /package/dist/cjs/packages/{sidenavbar → datepickerview}/style/css.js +0 -0
- /package/dist/{cjs/packages/sidenavbaritem → es/packages/datepickerview}/style/css.js +0 -0
package/dist/nutui.react.umd.js
CHANGED
|
@@ -409,7 +409,7 @@
|
|
|
409
409
|
].includes(Taro.getEnv().toLowerCase());
|
|
410
410
|
};
|
|
411
411
|
var prefixCls$2 = "nut-button";
|
|
412
|
-
var defaultProps$
|
|
412
|
+
var defaultProps$1A = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
413
413
|
color: "",
|
|
414
414
|
type: "default",
|
|
415
415
|
size: "normal",
|
|
@@ -424,7 +424,7 @@
|
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
426
|
var Button = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
427
|
-
var _ref = _object_spread({}, defaultProps$
|
|
427
|
+
var _ref = _object_spread({}, defaultProps$1A, props), color = _ref.color, shape = _ref.shape, fill = _ref.fill, loading = _ref.loading, disabled = _ref.disabled, type2 = _ref.type, size = _ref.size, block = _ref.block, icon = _ref.icon, rightIcon = _ref.rightIcon, children = _ref.children, className = _ref.className, style = _ref.style, nativeType = _ref.nativeType, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
|
|
428
428
|
"color",
|
|
429
429
|
"shape",
|
|
430
430
|
"fill",
|
|
@@ -518,14 +518,14 @@
|
|
|
518
518
|
});
|
|
519
519
|
Button.displayName = "NutButton";
|
|
520
520
|
var CellGroupContext = React.createContext(null);
|
|
521
|
-
var defaultProps$
|
|
521
|
+
var defaultProps$1z = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
522
522
|
title: "",
|
|
523
523
|
description: "",
|
|
524
524
|
divider: true
|
|
525
525
|
});
|
|
526
526
|
var classPrefix$u = "nut-cell-group";
|
|
527
527
|
var CellGroup = function(props) {
|
|
528
|
-
var _ref = _object_spread({}, defaultProps$
|
|
528
|
+
var _ref = _object_spread({}, defaultProps$1z, props), children = _ref.children, className = _ref.className, title = _ref.title, description = _ref.description, divider = _ref.divider, rest = _object_without_properties(_ref, [
|
|
529
529
|
"children",
|
|
530
530
|
"className",
|
|
531
531
|
"title",
|
|
@@ -1137,7 +1137,7 @@
|
|
|
1137
1137
|
if (harmony()) return Taro.pxTransform(value2, 375);
|
|
1138
1138
|
return "".concat(value2, "px");
|
|
1139
1139
|
}
|
|
1140
|
-
var defaultProps$
|
|
1140
|
+
var defaultProps$1y = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
1141
1141
|
title: null,
|
|
1142
1142
|
description: null,
|
|
1143
1143
|
extra: null,
|
|
@@ -1151,7 +1151,7 @@
|
|
|
1151
1151
|
var classPrefix$s = "nut-cell";
|
|
1152
1152
|
var Cell = function(props) {
|
|
1153
1153
|
var ctx = React.useContext(CellGroupContext);
|
|
1154
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
1154
|
+
var _$_object_spread = _object_spread({}, defaultProps$1y, props), children = _$_object_spread.children, onClick = _$_object_spread.onClick, title = _$_object_spread.title, description = _$_object_spread.description, extra = _$_object_spread.extra, radius = _$_object_spread.radius, align = _$_object_spread.align, isLast = _$_object_spread.isLast, className = _$_object_spread.className, style = _$_object_spread.style, clickable = _$_object_spread.clickable;
|
|
1155
1155
|
var rtl = useRtl();
|
|
1156
1156
|
var handleClick = function(event) {
|
|
1157
1157
|
onClick(event);
|
|
@@ -1239,14 +1239,14 @@
|
|
|
1239
1239
|
function _sliced_to_array(arr, i2) {
|
|
1240
1240
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i2) || _unsupported_iterable_to_array(arr, i2) || _non_iterable_rest();
|
|
1241
1241
|
}
|
|
1242
|
-
var defaultProps$
|
|
1242
|
+
var defaultProps$1x = {
|
|
1243
1243
|
src: "",
|
|
1244
1244
|
error: true,
|
|
1245
1245
|
loading: true
|
|
1246
1246
|
};
|
|
1247
1247
|
var Image$1 = function(props) {
|
|
1248
1248
|
var classPrefix2 = "nut-image";
|
|
1249
|
-
var _ref = _object_spread({}, defaultProps$
|
|
1249
|
+
var _ref = _object_spread({}, defaultProps$1x, props), className = _ref.className, style = _ref.style, src = _ref.src, width2 = _ref.width, height2 = _ref.height, radius = _ref.radius, error = _ref.error, loading = _ref.loading, onLoad = _ref.onLoad, onError = _ref.onError, rest = _object_without_properties(_ref, [
|
|
1250
1250
|
"className",
|
|
1251
1251
|
"style",
|
|
1252
1252
|
"src",
|
|
@@ -3279,9 +3279,9 @@
|
|
|
3279
3279
|
visible
|
|
3280
3280
|
]);
|
|
3281
3281
|
var classes = classNames(classPrefix2, className);
|
|
3282
|
-
var styles =
|
|
3282
|
+
var styles = _object_spread({
|
|
3283
3283
|
zIndex
|
|
3284
|
-
});
|
|
3284
|
+
}, style);
|
|
3285
3285
|
var handleClick = function(e2) {
|
|
3286
3286
|
if (closeOnOverlayClick) {
|
|
3287
3287
|
onClick && onClick(e2);
|
|
@@ -3297,7 +3297,7 @@
|
|
|
3297
3297
|
onClick: handleClick
|
|
3298
3298
|
}), children);
|
|
3299
3299
|
};
|
|
3300
|
-
return /* @__PURE__ */ React.createElement(
|
|
3300
|
+
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
3301
3301
|
nodeRef,
|
|
3302
3302
|
classNames: "".concat(classPrefix2, "-slide"),
|
|
3303
3303
|
unmountOnExit: true,
|
|
@@ -3305,16 +3305,16 @@
|
|
|
3305
3305
|
in: innerVisible,
|
|
3306
3306
|
onEntered: afterShow,
|
|
3307
3307
|
onExited: afterClose
|
|
3308
|
-
}, renderOverlay())
|
|
3308
|
+
}, renderOverlay());
|
|
3309
3309
|
};
|
|
3310
3310
|
Overlay.displayName = "NutOverlay";
|
|
3311
|
-
var defaultProps$
|
|
3311
|
+
var defaultProps$1w = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
3312
3312
|
contentPosition: "center",
|
|
3313
3313
|
direction: "horizontal"
|
|
3314
3314
|
});
|
|
3315
3315
|
var classPrefix$r = "nut-divider";
|
|
3316
3316
|
var Divider = function(props) {
|
|
3317
|
-
var _ref = _object_spread({}, defaultProps$
|
|
3317
|
+
var _ref = _object_spread({}, defaultProps$1w, props), children = _ref.children, contentPosition = _ref.contentPosition, style = _ref.style, className = _ref.className, direction = _ref.direction;
|
|
3318
3318
|
_object_without_properties(_ref, [
|
|
3319
3319
|
"children",
|
|
3320
3320
|
"contentPosition",
|
|
@@ -3350,7 +3350,7 @@
|
|
|
3350
3350
|
}
|
|
3351
3351
|
};
|
|
3352
3352
|
const GridContext = React.createContext(context);
|
|
3353
|
-
var defaultProps$
|
|
3353
|
+
var defaultProps$1v = {
|
|
3354
3354
|
text: "",
|
|
3355
3355
|
columns: 4,
|
|
3356
3356
|
gap: 9,
|
|
@@ -3360,7 +3360,7 @@
|
|
|
3360
3360
|
direction: "vertical"
|
|
3361
3361
|
};
|
|
3362
3362
|
var GridItem = function(props) {
|
|
3363
|
-
var _ref = _object_spread({}, defaultProps$
|
|
3363
|
+
var _ref = _object_spread({}, defaultProps$1v, props), children = _ref.children, style = _ref.style, columns = _ref.columns, index2 = _ref.index, gap = _ref.gap, square = _ref.square, text2 = _ref.text, center = _ref.center, reverse = _ref.reverse, direction = _ref.direction, className = _ref.className, onClick = _ref.onClick;
|
|
3364
3364
|
_object_without_properties(_ref, [
|
|
3365
3365
|
"children",
|
|
3366
3366
|
"style",
|
|
@@ -3431,7 +3431,7 @@
|
|
|
3431
3431
|
}, text2))));
|
|
3432
3432
|
};
|
|
3433
3433
|
GridItem.displayName = "NutGridItem";
|
|
3434
|
-
var defaultProps$
|
|
3434
|
+
var defaultProps$1u = {
|
|
3435
3435
|
columns: 4,
|
|
3436
3436
|
gap: 9,
|
|
3437
3437
|
center: true,
|
|
@@ -3440,7 +3440,7 @@
|
|
|
3440
3440
|
direction: "vertical"
|
|
3441
3441
|
};
|
|
3442
3442
|
var Grid = function(props) {
|
|
3443
|
-
var _ref = _object_spread({}, defaultProps$
|
|
3443
|
+
var _ref = _object_spread({}, defaultProps$1u, props), children = _ref.children, columns = _ref.columns, gap = _ref.gap, center = _ref.center, square = _ref.square, reverse = _ref.reverse, direction = _ref.direction, style = _ref.style, className = _ref.className, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
|
|
3444
3444
|
"children",
|
|
3445
3445
|
"columns",
|
|
3446
3446
|
"gap",
|
|
@@ -3495,7 +3495,7 @@
|
|
|
3495
3495
|
};
|
|
3496
3496
|
Layout.displayName = "NutLayout";
|
|
3497
3497
|
var DataContext$1 = React.createContext({});
|
|
3498
|
-
var defaultProps$
|
|
3498
|
+
var defaultProps$1t = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
3499
3499
|
span: "24",
|
|
3500
3500
|
offset: "0",
|
|
3501
3501
|
gutter: "0",
|
|
@@ -3503,7 +3503,7 @@
|
|
|
3503
3503
|
isLast: false
|
|
3504
3504
|
});
|
|
3505
3505
|
var Col = function(props) {
|
|
3506
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
3506
|
+
var _$_object_spread = _object_spread({}, defaultProps$1t, props), className = _$_object_spread.className, style = _$_object_spread.style, span = _$_object_spread.span, offset = _$_object_spread.offset, children = _$_object_spread.children, isFirst = _$_object_spread.isFirst, isLast = _$_object_spread.isLast, onClick = _$_object_spread.onClick;
|
|
3507
3507
|
var _useState = _sliced_to_array(React.useState(""), 2), colName = _useState[0], setColName = _useState[1];
|
|
3508
3508
|
var _useState1 = _sliced_to_array(React.useState({}), 2), colStyle = _useState1[0], setColStyle = _useState1[1];
|
|
3509
3509
|
var gutter = React.useContext(DataContext$1).gutter;
|
|
@@ -3540,7 +3540,7 @@
|
|
|
3540
3540
|
};
|
|
3541
3541
|
Col.displayName = "NutCol";
|
|
3542
3542
|
var classPrefix$q = "nut-row";
|
|
3543
|
-
var defaultProps$
|
|
3543
|
+
var defaultProps$1s = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
3544
3544
|
type: "",
|
|
3545
3545
|
justify: "start",
|
|
3546
3546
|
align: "flex-start",
|
|
@@ -3548,7 +3548,7 @@
|
|
|
3548
3548
|
gutter: "0"
|
|
3549
3549
|
});
|
|
3550
3550
|
var Row = function(props) {
|
|
3551
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
3551
|
+
var _$_object_spread = _object_spread({}, defaultProps$1s, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, type2 = _$_object_spread.type, justify = _$_object_spread.justify, align = _$_object_spread.align, wrap = _$_object_spread.wrap, gutter = _$_object_spread.gutter, onClick = _$_object_spread.onClick;
|
|
3552
3552
|
var getClass = function(prefix, type3) {
|
|
3553
3553
|
var classType = type3 ? "nut-row-".concat(prefix, "-").concat(type3) : "";
|
|
3554
3554
|
if (prefix) return classType;
|
|
@@ -3578,12 +3578,19 @@
|
|
|
3578
3578
|
})));
|
|
3579
3579
|
};
|
|
3580
3580
|
Row.displayName = "NutRow";
|
|
3581
|
+
var classPrefix$p = "nut-safe-area";
|
|
3582
|
+
var SafeArea = function(props) {
|
|
3583
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
3584
|
+
className: classNames(classPrefix$p, "".concat(classPrefix$p, "-position-").concat(props.position))
|
|
3585
|
+
});
|
|
3586
|
+
};
|
|
3587
|
+
SafeArea.displayName = "NutSafeArea";
|
|
3581
3588
|
var prefixCls$1 = "nut-space";
|
|
3582
|
-
var defaultProps$
|
|
3589
|
+
var defaultProps$1r = {
|
|
3583
3590
|
direction: "horizontal"
|
|
3584
3591
|
};
|
|
3585
3592
|
var Space = function(props) {
|
|
3586
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
3593
|
+
var _$_object_spread = _object_spread({}, defaultProps$1r, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, wrap = _$_object_spread.wrap, align = _$_object_spread.align, direction = _$_object_spread.direction, justify = _$_object_spread.justify;
|
|
3587
3594
|
var rtl = useRtl();
|
|
3588
3595
|
var _obj;
|
|
3589
3596
|
var cls = classNames(prefixCls$1, (_obj = {}, _define_property(_obj, "".concat(prefixCls$1, "-").concat(direction), direction), _define_property(_obj, "".concat(prefixCls$1, "-").concat(direction, "-wrap"), wrap), _define_property(_obj, "".concat(prefixCls$1, "-align-").concat(align), align), _define_property(_obj, "".concat(prefixCls$1, "-justify-").concat(justify), justify), _define_property(_obj, "".concat(className), className), _obj));
|
|
@@ -3806,13 +3813,13 @@
|
|
|
3806
3813
|
return _ref.apply(this, arguments);
|
|
3807
3814
|
};
|
|
3808
3815
|
}();
|
|
3809
|
-
var defaultProps$
|
|
3816
|
+
var defaultProps$1q = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
3810
3817
|
position: "top",
|
|
3811
3818
|
zIndex: 900
|
|
3812
3819
|
});
|
|
3813
|
-
var classPrefix$
|
|
3820
|
+
var classPrefix$o = "nut-sticky";
|
|
3814
3821
|
var Sticky = function(props) {
|
|
3815
|
-
var _ref = _object_spread({}, defaultProps$
|
|
3822
|
+
var _ref = _object_spread({}, defaultProps$1q, props), position2 = _ref.position, zIndex = _ref.zIndex, threshold = _ref.threshold;
|
|
3816
3823
|
_ref.style;
|
|
3817
3824
|
var children = _ref.children, container = _ref.container, className = _ref.className, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
|
|
3818
3825
|
"position",
|
|
@@ -3969,7 +3976,7 @@
|
|
|
3969
3976
|
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
3970
3977
|
ref: rootRef,
|
|
3971
3978
|
style: rootStyle,
|
|
3972
|
-
className: classNames(classPrefix$
|
|
3979
|
+
className: classNames(classPrefix$o, className)
|
|
3973
3980
|
}, rest), /* @__PURE__ */ React.createElement(components.View, {
|
|
3974
3981
|
className: classNames("nut-sticky-box", {
|
|
3975
3982
|
"nut-sticky-fixed": fixed
|
|
@@ -3979,20 +3986,13 @@
|
|
|
3979
3986
|
}, children));
|
|
3980
3987
|
};
|
|
3981
3988
|
Sticky.displayName = "NutSticky";
|
|
3982
|
-
var classPrefix$o = "nut-safe-area";
|
|
3983
|
-
var SafeArea = function(props) {
|
|
3984
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
3985
|
-
className: classNames(classPrefix$o, "".concat(classPrefix$o, "-position-").concat(props.position))
|
|
3986
|
-
});
|
|
3987
|
-
};
|
|
3988
|
-
SafeArea.displayName = "NutSafeArea";
|
|
3989
3989
|
var getIcon = function(icon) {
|
|
3990
3990
|
return React.isValidElement(icon) ? React.cloneElement(icon, {
|
|
3991
3991
|
// @ts-ignore
|
|
3992
3992
|
className: "nut-icon"
|
|
3993
3993
|
}) : icon;
|
|
3994
3994
|
};
|
|
3995
|
-
var defaultProps$
|
|
3995
|
+
var defaultProps$1p = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
3996
3996
|
icon: null,
|
|
3997
3997
|
onClick: function(value2) {
|
|
3998
3998
|
}
|
|
@@ -4000,7 +4000,7 @@
|
|
|
4000
4000
|
var classPrefix$n = "nut-hoverbutton-item";
|
|
4001
4001
|
var isHarmony = harmony();
|
|
4002
4002
|
var HoverButtonItem = function(props) {
|
|
4003
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4003
|
+
var _$_object_spread = _object_spread({}, defaultProps$1p, props), className = _$_object_spread.className, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick, children = _$_object_spread.children;
|
|
4004
4004
|
var _useState = _sliced_to_array(React.useState(false), 2), isTouchStart = _useState[0], setTouchStart = _useState[1];
|
|
4005
4005
|
React.useMemo(function() {
|
|
4006
4006
|
return isHarmony ? {
|
|
@@ -4045,10 +4045,10 @@
|
|
|
4045
4045
|
};
|
|
4046
4046
|
HoverButtonItem.displayName = "NutHoverButtonItem";
|
|
4047
4047
|
var UI_BOTTOM_DISTANCE = 60;
|
|
4048
|
-
var defaultProps$
|
|
4048
|
+
var defaultProps$1o = _object_spread({}, ComponentDefaults);
|
|
4049
4049
|
var classPrefix$m = "nut-hoverbutton";
|
|
4050
4050
|
var HoverButton = function(props) {
|
|
4051
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4051
|
+
var _$_object_spread = _object_spread({}, defaultProps$1o, props), children = _$_object_spread.children, zIndex = _$_object_spread.zIndex, tabbarHeight = _$_object_spread.tabbarHeight, className = _$_object_spread.className, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
|
|
4052
4052
|
var rtl = useRtl();
|
|
4053
4053
|
var baseStyle = _object_spread({}, style);
|
|
4054
4054
|
if (tabbarHeight) {
|
|
@@ -4074,13 +4074,13 @@
|
|
|
4074
4074
|
};
|
|
4075
4075
|
HoverButton.displayName = "NutHoverButton";
|
|
4076
4076
|
HoverButton.Item = HoverButtonItem;
|
|
4077
|
-
var defaultProps$
|
|
4077
|
+
var defaultProps$1n = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
4078
4078
|
threshold: 200,
|
|
4079
4079
|
zIndex: 900,
|
|
4080
4080
|
duration: 1e3
|
|
4081
4081
|
});
|
|
4082
4082
|
var BackTop = function(props) {
|
|
4083
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4083
|
+
var _$_object_spread = _object_spread({}, defaultProps$1n, props), children = _$_object_spread.children, threshold = _$_object_spread.threshold, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, duration = _$_object_spread.duration, icon = _$_object_spread.icon, style = _$_object_spread.style, scrollRes = _$_object_spread.scrollRes, onClick = _$_object_spread.onClick;
|
|
4084
4084
|
var classPrefix2 = "nut-backtop";
|
|
4085
4085
|
var _useState = _sliced_to_array(React.useState(false), 2), backTop = _useState[0], setBackTop = _useState[1];
|
|
4086
4086
|
var cls = classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-show"), backTop), className);
|
|
@@ -4162,7 +4162,7 @@
|
|
|
4162
4162
|
return idRef.current;
|
|
4163
4163
|
}
|
|
4164
4164
|
var elevatorContext = /* @__PURE__ */ React.createContext({});
|
|
4165
|
-
var defaultProps$
|
|
4165
|
+
var defaultProps$1m = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
4166
4166
|
height: "200px",
|
|
4167
4167
|
floorKey: "title",
|
|
4168
4168
|
list: [],
|
|
@@ -4173,7 +4173,7 @@
|
|
|
4173
4173
|
className: "weapp-elevator"
|
|
4174
4174
|
});
|
|
4175
4175
|
var Elevator = function(props) {
|
|
4176
|
-
var _ref = _object_spread({}, defaultProps$
|
|
4176
|
+
var _ref = _object_spread({}, defaultProps$1m, props), height2 = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight;
|
|
4177
4177
|
_ref.titleHeight;
|
|
4178
4178
|
var showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
|
|
4179
4179
|
"height",
|
|
@@ -4398,7 +4398,7 @@
|
|
|
4398
4398
|
};
|
|
4399
4399
|
Elevator.displayName = "NutElevator";
|
|
4400
4400
|
Elevator.Context = elevatorContext;
|
|
4401
|
-
var defaultProps$
|
|
4401
|
+
var defaultProps$1l = _object_spread_props(_object_spread({}, defaultOverlayProps), {
|
|
4402
4402
|
activeText: "",
|
|
4403
4403
|
inactiveText: "",
|
|
4404
4404
|
type: "right",
|
|
@@ -4416,7 +4416,7 @@
|
|
|
4416
4416
|
});
|
|
4417
4417
|
var FixedNav = function(props) {
|
|
4418
4418
|
var locale = useConfig().locale;
|
|
4419
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4419
|
+
var _$_object_spread = _object_spread({}, defaultProps$1l, props), className = _$_object_spread.className, overlay = _$_object_spread.overlay, visible = _$_object_spread.visible, list = _$_object_spread.list, activeText = _$_object_spread.activeText, inactiveText = _$_object_spread.inactiveText, position2 = _$_object_spread.position, type2 = _$_object_spread.type, children = _$_object_spread.children, style = _$_object_spread.style, content2 = _$_object_spread.content, zIndex = _$_object_spread.zIndex, onChange = _$_object_spread.onChange, onSelect = _$_object_spread.onSelect;
|
|
4420
4420
|
var classPrefix2 = "nut-fixednav";
|
|
4421
4421
|
var classes = classNames(classPrefix2, {
|
|
4422
4422
|
active: visible
|
|
@@ -4461,7 +4461,7 @@
|
|
|
4461
4461
|
}, visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText))));
|
|
4462
4462
|
};
|
|
4463
4463
|
FixedNav.displayName = "NutFixedNav";
|
|
4464
|
-
var defaultProps$
|
|
4464
|
+
var defaultProps$1k = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
4465
4465
|
left: "",
|
|
4466
4466
|
right: "",
|
|
4467
4467
|
back: "",
|
|
@@ -4471,7 +4471,7 @@
|
|
|
4471
4471
|
zIndex: 10
|
|
4472
4472
|
});
|
|
4473
4473
|
var NavBar = function(props) {
|
|
4474
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4474
|
+
var _$_object_spread = _object_spread({}, defaultProps$1k, props), right2 = _$_object_spread.right, left2 = _$_object_spread.left, title = _$_object_spread.title, className = _$_object_spread.className, style = _$_object_spread.style, back = _$_object_spread.back, fixed = _$_object_spread.fixed, safeAreaInsetTop = _$_object_spread.safeAreaInsetTop, placeholder = _$_object_spread.placeholder, zIndex = _$_object_spread.zIndex, onBackClick = _$_object_spread.onBackClick;
|
|
4475
4475
|
var classPrefix2 = "nut-navbar";
|
|
4476
4476
|
var rtl = useRtl();
|
|
4477
4477
|
var children = Array.isArray(props.children) ? props.children : [
|
|
@@ -4521,208 +4521,6 @@
|
|
|
4521
4521
|
}, renderWrapper()) : renderWrapper());
|
|
4522
4522
|
};
|
|
4523
4523
|
NavBar.displayName = "NutNavBar";
|
|
4524
|
-
var defaultProps$1k = _object_spread_props(_object_spread({}, defaultOverlayProps), {
|
|
4525
|
-
position: "center",
|
|
4526
|
-
transition: "",
|
|
4527
|
-
overlayStyle: {},
|
|
4528
|
-
overlayClassName: "",
|
|
4529
|
-
closeable: false,
|
|
4530
|
-
closeIconPosition: "top-right",
|
|
4531
|
-
closeIcon: "close",
|
|
4532
|
-
destroyOnClose: false,
|
|
4533
|
-
portal: null,
|
|
4534
|
-
overlay: true,
|
|
4535
|
-
round: false,
|
|
4536
|
-
onOpen: function() {
|
|
4537
|
-
},
|
|
4538
|
-
onClose: function() {
|
|
4539
|
-
},
|
|
4540
|
-
onOverlayClick: function() {
|
|
4541
|
-
return true;
|
|
4542
|
-
},
|
|
4543
|
-
onCloseIconClick: function() {
|
|
4544
|
-
return true;
|
|
4545
|
-
}
|
|
4546
|
-
});
|
|
4547
|
-
var _zIndex = 1100;
|
|
4548
|
-
var Popup = function(props) {
|
|
4549
|
-
var _$_object_spread = _object_spread({}, defaultProps$1k, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left2 = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position2 = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick;
|
|
4550
|
-
var innerIndex = zIndex || _zIndex;
|
|
4551
|
-
var _useState = _sliced_to_array(React.useState(innerIndex), 2), index2 = _useState[0], setIndex = _useState[1];
|
|
4552
|
-
var _useState1 = _sliced_to_array(React.useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
|
|
4553
|
-
var _useState2 = _sliced_to_array(React.useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
|
|
4554
|
-
var _useState3 = _sliced_to_array(React.useState(""), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
|
|
4555
|
-
var refObject = useLockScrollTaro(innerVisible && lockScroll);
|
|
4556
|
-
var classPrefix2 = "nut-popup";
|
|
4557
|
-
var overlayStyles = _object_spread({}, overlayStyle);
|
|
4558
|
-
var popStyles = _object_spread_props(_object_spread({}, style), {
|
|
4559
|
-
zIndex: index2
|
|
4560
|
-
});
|
|
4561
|
-
var _obj;
|
|
4562
|
-
var popClassName = classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-round"), round || position2 === "bottom"), _define_property(_obj, "".concat(classPrefix2, "-").concat(position2), true), _obj), className);
|
|
4563
|
-
var open2 = function() {
|
|
4564
|
-
if (!innerVisible) {
|
|
4565
|
-
setInnerVisible(true);
|
|
4566
|
-
setIndex(++innerIndex);
|
|
4567
|
-
}
|
|
4568
|
-
if (destroyOnClose) {
|
|
4569
|
-
setShowChildren(true);
|
|
4570
|
-
}
|
|
4571
|
-
onOpen && onOpen();
|
|
4572
|
-
};
|
|
4573
|
-
var close2 = function() {
|
|
4574
|
-
if (innerVisible) {
|
|
4575
|
-
setInnerVisible(false);
|
|
4576
|
-
if (destroyOnClose) {
|
|
4577
|
-
setTimeout(function() {
|
|
4578
|
-
setShowChildren(false);
|
|
4579
|
-
}, Number(duration));
|
|
4580
|
-
}
|
|
4581
|
-
onClose && onClose();
|
|
4582
|
-
}
|
|
4583
|
-
};
|
|
4584
|
-
var handleOverlayClick = function(e2) {
|
|
4585
|
-
e2.stopPropagation();
|
|
4586
|
-
if (closeOnOverlayClick && onOverlayClick(e2)) {
|
|
4587
|
-
close2();
|
|
4588
|
-
}
|
|
4589
|
-
};
|
|
4590
|
-
var handleCloseIconClick = function(e2) {
|
|
4591
|
-
onCloseIconClick(e2) && close2();
|
|
4592
|
-
};
|
|
4593
|
-
var renderCloseIcon = function() {
|
|
4594
|
-
var closeClasses = classNames("".concat(classPrefix2, "-title-right"), "".concat(classPrefix2, "-title-right-").concat(closeIconPosition));
|
|
4595
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable && /* @__PURE__ */ React.createElement(components.View, {
|
|
4596
|
-
className: closeClasses,
|
|
4597
|
-
onClick: handleCloseIconClick
|
|
4598
|
-
}, /* @__PURE__ */ React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(g$1, null)));
|
|
4599
|
-
};
|
|
4600
|
-
var renderTitle = function() {
|
|
4601
|
-
if (left2 || title || description) {
|
|
4602
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
4603
|
-
className: "".concat(classPrefix2, "-title")
|
|
4604
|
-
}, position2 === "bottom" && /* @__PURE__ */ React.createElement(React.Fragment, null, left2 && /* @__PURE__ */ React.createElement(components.View, {
|
|
4605
|
-
className: "".concat(classPrefix2, "-title-left")
|
|
4606
|
-
}, left2), (title || description) && /* @__PURE__ */ React.createElement(components.View, {
|
|
4607
|
-
className: "".concat(classPrefix2, "-title-wrapper")
|
|
4608
|
-
}, title && /* @__PURE__ */ React.createElement(components.View, {
|
|
4609
|
-
className: "".concat(classPrefix2, "-title-title")
|
|
4610
|
-
}, title), description && /* @__PURE__ */ React.createElement(components.View, {
|
|
4611
|
-
className: "".concat(classPrefix2, "-title-description ").concat(title ? "".concat(classPrefix2, "-title-description-gap") : "")
|
|
4612
|
-
}, description))), renderCloseIcon());
|
|
4613
|
-
}
|
|
4614
|
-
if (closeable) {
|
|
4615
|
-
return renderCloseIcon();
|
|
4616
|
-
}
|
|
4617
|
-
};
|
|
4618
|
-
var renderPop = function() {
|
|
4619
|
-
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
4620
|
-
nodeRef: refObject,
|
|
4621
|
-
classNames: transitionName,
|
|
4622
|
-
mountOnEnter: true,
|
|
4623
|
-
unmountOnExit: destroyOnClose,
|
|
4624
|
-
timeout: duration,
|
|
4625
|
-
in: innerVisible,
|
|
4626
|
-
onEntered: afterShow,
|
|
4627
|
-
onExited: afterClose
|
|
4628
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
4629
|
-
ref: refObject,
|
|
4630
|
-
style: popStyles,
|
|
4631
|
-
className: popClassName,
|
|
4632
|
-
onClick,
|
|
4633
|
-
catchMove: lockScroll
|
|
4634
|
-
}, renderTitle(), showChildren ? children : null));
|
|
4635
|
-
};
|
|
4636
|
-
var renderNode = function() {
|
|
4637
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, overlay ? /* @__PURE__ */ React.createElement(Overlay, {
|
|
4638
|
-
zIndex: index2,
|
|
4639
|
-
style: overlayStyles,
|
|
4640
|
-
className: overlayClassName,
|
|
4641
|
-
visible: innerVisible,
|
|
4642
|
-
closeOnOverlayClick,
|
|
4643
|
-
lockScroll,
|
|
4644
|
-
duration,
|
|
4645
|
-
onClick: handleOverlayClick
|
|
4646
|
-
}, renderPop()) : renderPop());
|
|
4647
|
-
};
|
|
4648
|
-
React.useEffect(function() {
|
|
4649
|
-
visible ? open2() : close2();
|
|
4650
|
-
}, [
|
|
4651
|
-
visible
|
|
4652
|
-
]);
|
|
4653
|
-
React.useEffect(function() {
|
|
4654
|
-
setTransitionName(transition || "".concat(classPrefix2, "-slide-").concat(position2));
|
|
4655
|
-
}, [
|
|
4656
|
-
position2,
|
|
4657
|
-
transition
|
|
4658
|
-
]);
|
|
4659
|
-
var resolveContainer = function(getContainer) {
|
|
4660
|
-
return (typeof getContainer === "function" ? getContainer() : getContainer) || document.body;
|
|
4661
|
-
};
|
|
4662
|
-
var renderToContainer = function(getContainer, node) {
|
|
4663
|
-
if (getContainer) {
|
|
4664
|
-
var container = resolveContainer(getContainer);
|
|
4665
|
-
return /* @__PURE__ */ ReactDOM.createPortal(node, container);
|
|
4666
|
-
}
|
|
4667
|
-
return node;
|
|
4668
|
-
};
|
|
4669
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderToContainer(portal, renderNode()));
|
|
4670
|
-
};
|
|
4671
|
-
Popup.displayName = "NutPopup";
|
|
4672
|
-
var OffsetContext = React.createContext(20);
|
|
4673
|
-
var defaultProps$1j = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
4674
|
-
position: "left",
|
|
4675
|
-
width: "80%"
|
|
4676
|
-
});
|
|
4677
|
-
var SideNavBar = function(props) {
|
|
4678
|
-
React.useEffect(function() {
|
|
4679
|
-
console.warn("Warning: SideNavBar is deprecated and will be removed in future versions. Please use NewComponent SideBar instead.");
|
|
4680
|
-
}, []);
|
|
4681
|
-
var classPrefix2 = "nut-sidenavbar";
|
|
4682
|
-
var _ref = _object_spread({}, defaultProps$1j, props), title = _ref.title, visible = _ref.visible, width2 = _ref.width, position2 = _ref.position, children = _ref.children, className = _ref.className, onClose = _ref.onClose, indent = _ref.indent, rest = _object_without_properties(_ref, [
|
|
4683
|
-
"title",
|
|
4684
|
-
"visible",
|
|
4685
|
-
"width",
|
|
4686
|
-
"position",
|
|
4687
|
-
"children",
|
|
4688
|
-
"className",
|
|
4689
|
-
"onClose",
|
|
4690
|
-
"indent"
|
|
4691
|
-
]);
|
|
4692
|
-
var innerIndent = indent ? Number(indent) : 20;
|
|
4693
|
-
var _useState = _sliced_to_array(React.useState(true), 2), sidenavbarShow = _useState[0], setSidenavbarShow = _useState[1];
|
|
4694
|
-
var handleClick = function() {
|
|
4695
|
-
setSidenavbarShow(!sidenavbarShow);
|
|
4696
|
-
};
|
|
4697
|
-
return /* @__PURE__ */ React.createElement(Popup, {
|
|
4698
|
-
visible,
|
|
4699
|
-
style: {
|
|
4700
|
-
width: width2,
|
|
4701
|
-
height: "100%"
|
|
4702
|
-
},
|
|
4703
|
-
position: position2,
|
|
4704
|
-
onClose
|
|
4705
|
-
}, /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
4706
|
-
className: classNames(classPrefix2, className)
|
|
4707
|
-
}, rest), /* @__PURE__ */ React.createElement(components.View, {
|
|
4708
|
-
className: "".concat(classPrefix2, "-content")
|
|
4709
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
4710
|
-
className: "".concat(classPrefix2, "-list ").concat(sidenavbarShow ? "sidenavbar-show" : "sidenavbar-hide"),
|
|
4711
|
-
onClick: handleClick
|
|
4712
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
4713
|
-
className: "".concat(classPrefix2, "-title ").concat(classPrefix2, "-border-bt"),
|
|
4714
|
-
style: {
|
|
4715
|
-
paddingLeft: "".concat(innerIndent, "px")
|
|
4716
|
-
}
|
|
4717
|
-
}, title, /* @__PURE__ */ React.createElement("i", {
|
|
4718
|
-
className: "arrow-icon ".concat(sidenavbarShow ? "arrow-up" : "arrow-down")
|
|
4719
|
-
})), /* @__PURE__ */ React.createElement(OffsetContext.Provider, {
|
|
4720
|
-
value: innerIndent
|
|
4721
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
4722
|
-
className: "".concat(classPrefix2, "-content")
|
|
4723
|
-
}, children))))));
|
|
4724
|
-
};
|
|
4725
|
-
SideNavBar.displayName = "NutSideNavBar";
|
|
4726
4524
|
function useForceUpdate() {
|
|
4727
4525
|
var _React_useState = _sliced_to_array(React.useState(), 2), updateState = _React_useState[1];
|
|
4728
4526
|
return React.useCallback(function() {
|
|
@@ -4784,13 +4582,13 @@
|
|
|
4784
4582
|
});
|
|
4785
4583
|
return ret;
|
|
4786
4584
|
}
|
|
4787
|
-
var defaultProps$
|
|
4585
|
+
var defaultProps$1j = {
|
|
4788
4586
|
title: "",
|
|
4789
4587
|
value: "",
|
|
4790
4588
|
disabled: false
|
|
4791
4589
|
};
|
|
4792
4590
|
var SideBarItem = function(props) {
|
|
4793
|
-
var _mergeProps = mergeProps(defaultProps$
|
|
4591
|
+
var _mergeProps = mergeProps(defaultProps$1j, props), children = _mergeProps.children, className = _mergeProps.className, disabled = _mergeProps.disabled;
|
|
4794
4592
|
var classPrefix2 = "nut-sidebaritem";
|
|
4795
4593
|
var classes = classNames(classPrefix2, {
|
|
4796
4594
|
active: !disabled && props.active
|
|
@@ -4799,13 +4597,13 @@
|
|
|
4799
4597
|
className: classes
|
|
4800
4598
|
}, !disabled && children) : null;
|
|
4801
4599
|
};
|
|
4802
|
-
var defaultProps$
|
|
4600
|
+
var defaultProps$1i = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
4803
4601
|
contentDuration: 0,
|
|
4804
4602
|
sidebarDuration: 0
|
|
4805
4603
|
});
|
|
4806
4604
|
var classPrefix$l = "nut-sidebar";
|
|
4807
4605
|
var SideBar = function(props) {
|
|
4808
|
-
var _mergeProps = mergeProps(defaultProps$
|
|
4606
|
+
var _mergeProps = mergeProps(defaultProps$1i, props), contentDuration = _mergeProps.contentDuration, sidebarDuration = _mergeProps.sidebarDuration, children = _mergeProps.children, onClick = _mergeProps.onClick, onChange = _mergeProps.onChange, className = _mergeProps.className, rest = _object_without_properties(_mergeProps, [
|
|
4809
4607
|
"contentDuration",
|
|
4810
4608
|
"sidebarDuration",
|
|
4811
4609
|
"children",
|
|
@@ -4974,106 +4772,11 @@
|
|
|
4974
4772
|
};
|
|
4975
4773
|
SideBar.displayName = "NutSideBar";
|
|
4976
4774
|
SideBar.Item = SideBarItem;
|
|
4977
|
-
var SideNavBarItem = function(props) {
|
|
4978
|
-
var classPrefix2 = "nut-subsidenavbar";
|
|
4979
|
-
var title = props.title, value2 = props.value;
|
|
4980
|
-
props.children;
|
|
4981
|
-
var onClick = props.onClick, rest = _object_without_properties(props, [
|
|
4982
|
-
"title",
|
|
4983
|
-
"value",
|
|
4984
|
-
"children",
|
|
4985
|
-
"onClick"
|
|
4986
|
-
]);
|
|
4987
|
-
var clickFn = function(e2) {
|
|
4988
|
-
e2.stopPropagation();
|
|
4989
|
-
onClick && onClick({
|
|
4990
|
-
title,
|
|
4991
|
-
value: value2
|
|
4992
|
-
});
|
|
4993
|
-
};
|
|
4994
|
-
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
4995
|
-
className: "".concat(classPrefix2, "-item ").concat(classPrefix2, "-border-bt"),
|
|
4996
|
-
onClick: clickFn
|
|
4997
|
-
}, rest), title);
|
|
4998
|
-
};
|
|
4999
|
-
var defaultProps$1g = {
|
|
5000
|
-
open: true
|
|
5001
|
-
};
|
|
5002
|
-
var SubSideNavBar = function(props) {
|
|
5003
|
-
var classPrefix2 = "nut-subsidenavbar";
|
|
5004
|
-
var _ref = _object_spread({}, defaultProps$1g, props), title = _ref.title, value2 = _ref.value, children = _ref.children, onClick = _ref.onClick, open2 = _ref.open, rest = _object_without_properties(_ref, [
|
|
5005
|
-
"title",
|
|
5006
|
-
"value",
|
|
5007
|
-
"children",
|
|
5008
|
-
"onClick",
|
|
5009
|
-
"open"
|
|
5010
|
-
]);
|
|
5011
|
-
var _useState = _sliced_to_array(React.useState(open2), 2), subShow = _useState[0], setSubShow = _useState[1];
|
|
5012
|
-
var offset = React.useContext(OffsetContext);
|
|
5013
|
-
var listRef = React.useRef(null);
|
|
5014
|
-
var setListLevel = React.useCallback(function(nodeList) {
|
|
5015
|
-
var level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
5016
|
-
var titleClass = nodeList[0].className;
|
|
5017
|
-
if (titleClass.includes("".concat(classPrefix2, "-title"))) {
|
|
5018
|
-
var left2 = offset * (level + 1);
|
|
5019
|
-
nodeList[0].style.paddingLeft = "".concat(left2, "px");
|
|
5020
|
-
}
|
|
5021
|
-
var childNodes = nodeList[1] && nodeList[1].children && Array.from(nodeList[1].children).filter(function(item) {
|
|
5022
|
-
return item.nodeType !== 3 && item.nodeType !== 8;
|
|
5023
|
-
});
|
|
5024
|
-
childNodes.forEach(function(item) {
|
|
5025
|
-
var itemClass = item.className;
|
|
5026
|
-
if (itemClass.includes("".concat(classPrefix2, "-item"))) {
|
|
5027
|
-
var left3 = offset * (level + 2);
|
|
5028
|
-
item.style.paddingLeft = "".concat(left3, "px");
|
|
5029
|
-
}
|
|
5030
|
-
if (itemClass.includes("".concat(classPrefix2, "-list"))) {
|
|
5031
|
-
var level1 = item.getAttribute("level") ? Number(item.getAttribute("level")) : 1;
|
|
5032
|
-
level1 += 1;
|
|
5033
|
-
item.setAttribute("level", level1.toString());
|
|
5034
|
-
item.children && setListLevel(item.children, level1);
|
|
5035
|
-
}
|
|
5036
|
-
});
|
|
5037
|
-
}, [
|
|
5038
|
-
offset
|
|
5039
|
-
]);
|
|
5040
|
-
var clickFn = function(e2) {
|
|
5041
|
-
e2.stopPropagation();
|
|
5042
|
-
setSubShow(!subShow);
|
|
5043
|
-
var isShow = !subShow;
|
|
5044
|
-
onClick && onClick({
|
|
5045
|
-
title,
|
|
5046
|
-
value: value2,
|
|
5047
|
-
isShow
|
|
5048
|
-
});
|
|
5049
|
-
};
|
|
5050
|
-
React.useEffect(function() {
|
|
5051
|
-
var _listRef_current, _listRef_current1;
|
|
5052
|
-
var childNodes = (_listRef_current = listRef.current) === null || _listRef_current === void 0 ? void 0 : _listRef_current.children;
|
|
5053
|
-
(_listRef_current1 = listRef.current) === null || _listRef_current1 === void 0 ? void 0 : _listRef_current1.setAttribute("level", "1");
|
|
5054
|
-
childNodes && setListLevel(childNodes);
|
|
5055
|
-
}, [
|
|
5056
|
-
setListLevel
|
|
5057
|
-
]);
|
|
5058
|
-
var divClass = subShow ? "".concat(classPrefix2, "-list sidenavbar-show") : "".concat(classPrefix2, "-list sidenavbar-hide");
|
|
5059
|
-
var iconClass = subShow ? "arrow-icon arrow-down" : "arrow-icon arrow-up";
|
|
5060
|
-
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
5061
|
-
className: divClass,
|
|
5062
|
-
ref: listRef,
|
|
5063
|
-
onClick: clickFn
|
|
5064
|
-
}, rest), /* @__PURE__ */ React.createElement(components.View, {
|
|
5065
|
-
className: "".concat(classPrefix2, "-title ").concat(classPrefix2, "-border-bt")
|
|
5066
|
-
}, title, " ", /* @__PURE__ */ React.createElement("i", {
|
|
5067
|
-
className: iconClass
|
|
5068
|
-
})), /* @__PURE__ */ React.createElement(components.View, {
|
|
5069
|
-
className: "".concat(classPrefix2, "-content")
|
|
5070
|
-
}, children));
|
|
5071
|
-
};
|
|
5072
4775
|
function _type_of(obj) {
|
|
5073
4776
|
"@swc/helpers - typeof";
|
|
5074
4777
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
5075
4778
|
}
|
|
5076
|
-
var defaultProps$
|
|
4779
|
+
var defaultProps$1h = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
5077
4780
|
value: "",
|
|
5078
4781
|
dot: false,
|
|
5079
4782
|
max: 99,
|
|
@@ -5101,7 +4804,7 @@
|
|
|
5101
4804
|
};
|
|
5102
4805
|
var _this;
|
|
5103
4806
|
var rtl = useRtl();
|
|
5104
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4807
|
+
var _$_object_spread = _object_spread({}, defaultProps$1h, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right2 = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
|
|
5105
4808
|
var classPrefix2 = "nut-badge";
|
|
5106
4809
|
var isHarmony2 = harmony();
|
|
5107
4810
|
var classes = classNames(classPrefix2, className);
|
|
@@ -5154,7 +4857,7 @@
|
|
|
5154
4857
|
}
|
|
5155
4858
|
return maybeElement;
|
|
5156
4859
|
}
|
|
5157
|
-
var defaultProps$
|
|
4860
|
+
var defaultProps$1g = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
5158
4861
|
title: "",
|
|
5159
4862
|
icon: null,
|
|
5160
4863
|
value: "",
|
|
@@ -5165,7 +4868,7 @@
|
|
|
5165
4868
|
});
|
|
5166
4869
|
var TabbarItem = function(props) {
|
|
5167
4870
|
var ctx = React.useContext(TabbarContext);
|
|
5168
|
-
var _ref = _object_spread({}, defaultProps$
|
|
4871
|
+
var _ref = _object_spread({}, defaultProps$1g, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value2 = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right2 = _ref.right, index2 = _ref.index, rest = _object_without_properties(_ref, [
|
|
5169
4872
|
"className",
|
|
5170
4873
|
"style",
|
|
5171
4874
|
"title",
|
|
@@ -5210,7 +4913,7 @@
|
|
|
5210
4913
|
className: boxPrefix
|
|
5211
4914
|
}, addColorForHarmony(icon, active2 ? ctx === null || ctx === void 0 ? void 0 : ctx.activeColor : ctx === null || ctx === void 0 ? void 0 : ctx.inactiveColor))), renderTitleText()) : /* @__PURE__ */ React.createElement(Badge, badgeProps, renderTitleText()));
|
|
5212
4915
|
};
|
|
5213
|
-
var defaultProps$
|
|
4916
|
+
var defaultProps$1f = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
5214
4917
|
defaultValue: 0,
|
|
5215
4918
|
fixed: false,
|
|
5216
4919
|
inactiveColor: "",
|
|
@@ -5220,7 +4923,7 @@
|
|
|
5220
4923
|
}
|
|
5221
4924
|
});
|
|
5222
4925
|
var Tabbar = function(props) {
|
|
5223
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4926
|
+
var _$_object_spread = _object_spread({}, defaultProps$1f, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value2 = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
|
|
5224
4927
|
var classPrefix2 = "nut-tabbar";
|
|
5225
4928
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
5226
4929
|
value: value2,
|
|
@@ -5251,13 +4954,13 @@
|
|
|
5251
4954
|
};
|
|
5252
4955
|
Tabbar.displayName = "NutTabbar";
|
|
5253
4956
|
Tabbar.Item = TabbarItem;
|
|
5254
|
-
var defaultProps$
|
|
4957
|
+
var defaultProps$1e = {
|
|
5255
4958
|
title: "",
|
|
5256
4959
|
value: "",
|
|
5257
4960
|
disabled: false
|
|
5258
4961
|
};
|
|
5259
4962
|
var TabPane = function(props) {
|
|
5260
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
4963
|
+
var _$_object_spread = _object_spread({}, defaultProps$1e, props), children = _$_object_spread.children, autoHeightClassName = _$_object_spread.autoHeightClassName, className = _$_object_spread.className, disabled = _$_object_spread.disabled;
|
|
5261
4964
|
var classPrefix2 = "nut-tabpane";
|
|
5262
4965
|
var classes = classNames(classPrefix2, {
|
|
5263
4966
|
active: !disabled && props.active
|
|
@@ -5266,7 +4969,7 @@
|
|
|
5266
4969
|
className: classes
|
|
5267
4970
|
}, !disabled && children);
|
|
5268
4971
|
};
|
|
5269
|
-
var defaultProps$
|
|
4972
|
+
var defaultProps$1d = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
5270
4973
|
tabStyle: {},
|
|
5271
4974
|
activeColor: "",
|
|
5272
4975
|
direction: "horizontal",
|
|
@@ -5277,7 +4980,7 @@
|
|
|
5277
4980
|
var classPrefix$k = "nut-tabs";
|
|
5278
4981
|
var Tabs = function(props) {
|
|
5279
4982
|
var rtl = useRtl();
|
|
5280
|
-
var _ref = _object_spread({}, defaultProps$
|
|
4983
|
+
var _ref = _object_spread({}, defaultProps$1d, props), activeColor = _ref.activeColor, tabStyle = _ref.tabStyle, direction = _ref.direction, activeType = _ref.activeType, duration = _ref.duration, align = _ref.align, title = _ref.title, name2 = _ref.name, children = _ref.children, onClick = _ref.onClick, onChange = _ref.onChange, className = _ref.className, autoHeight = _ref.autoHeight, outerValue = _ref.value, outerDefaultValue = _ref.defaultValue, rest = _object_without_properties(_ref, [
|
|
5281
4984
|
"activeColor",
|
|
5282
4985
|
"tabStyle",
|
|
5283
4986
|
"direction",
|
|
@@ -5358,14 +5061,8 @@
|
|
|
5358
5061
|
var _useState = _sliced_to_array(React.useState(0), 2), scrollLeft = _useState[0], setScrollLeft = _useState[1];
|
|
5359
5062
|
var _useState1 = _sliced_to_array(React.useState(0), 2), scrollTop = _useState1[0], setScrollTop = _useState1[1];
|
|
5360
5063
|
var scrollDirection = function(to, direction2) {
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
function animate() {
|
|
5364
|
-
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5365
|
-
else setScrollTop(to);
|
|
5366
|
-
if (++count < frames2) requestAniFrame$1(animate);
|
|
5367
|
-
}
|
|
5368
|
-
animate();
|
|
5064
|
+
if (direction2 === "horizontal") setScrollLeft(to);
|
|
5065
|
+
else setScrollTop(to);
|
|
5369
5066
|
};
|
|
5370
5067
|
var scrollIntoView = function(index2) {
|
|
5371
5068
|
requestAniFrame$1(function() {
|
|
@@ -5387,13 +5084,11 @@
|
|
|
5387
5084
|
return prev + curr.width;
|
|
5388
5085
|
}, 0);
|
|
5389
5086
|
to = left2 - (navRect.width - titleRect.width) / 2;
|
|
5390
|
-
if (to < 0) return;
|
|
5391
|
-
to = rtl ? -to : to;
|
|
5392
5087
|
}
|
|
5088
|
+
scrollDirection(to, direction);
|
|
5393
5089
|
Taro.nextTick(function() {
|
|
5394
5090
|
scrollWithAnimation.current = true;
|
|
5395
5091
|
});
|
|
5396
|
-
scrollDirection(to, direction);
|
|
5397
5092
|
});
|
|
5398
5093
|
});
|
|
5399
5094
|
};
|
|
@@ -5430,6 +5125,7 @@
|
|
|
5430
5125
|
scrollY: direction === "vertical",
|
|
5431
5126
|
scrollLeft,
|
|
5432
5127
|
scrollTop,
|
|
5128
|
+
enhanced: true,
|
|
5433
5129
|
showScrollbar: false,
|
|
5434
5130
|
scrollWithAnimation: rtl && Taro.getEnv() !== "WEB" ? false : scrollWithAnimation.current,
|
|
5435
5131
|
id: "nut-tabs-titles-".concat(name2 || uuid),
|
|
@@ -5473,13 +5169,165 @@
|
|
|
5473
5169
|
if (!/* @__PURE__ */ React.isValidElement(child)) return null;
|
|
5474
5170
|
return /* @__PURE__ */ React.cloneElement(child, _object_spread_props(_object_spread({}, child.props), {
|
|
5475
5171
|
active: value2 === child.props.value,
|
|
5476
|
-
autoHeightClassName: autoHeight && String(value2) !== String(child.props.value || idx) ? "inactive" :
|
|
5172
|
+
autoHeightClassName: autoHeight && String(value2) !== String(child.props.value || idx) ? "inactive" : void 0
|
|
5477
5173
|
}));
|
|
5478
5174
|
}))));
|
|
5479
5175
|
};
|
|
5480
5176
|
Tabs.displayName = "NutTabs";
|
|
5481
5177
|
Tabs.TabPane = TabPane;
|
|
5482
|
-
var defaultProps$
|
|
5178
|
+
var defaultProps$1c = _object_spread_props(_object_spread({}, defaultOverlayProps), {
|
|
5179
|
+
position: "center",
|
|
5180
|
+
transition: "",
|
|
5181
|
+
overlayStyle: {},
|
|
5182
|
+
overlayClassName: "",
|
|
5183
|
+
closeable: false,
|
|
5184
|
+
closeIconPosition: "top-right",
|
|
5185
|
+
closeIcon: "close",
|
|
5186
|
+
destroyOnClose: false,
|
|
5187
|
+
portal: null,
|
|
5188
|
+
overlay: true,
|
|
5189
|
+
round: false,
|
|
5190
|
+
onOpen: function() {
|
|
5191
|
+
},
|
|
5192
|
+
onClose: function() {
|
|
5193
|
+
},
|
|
5194
|
+
onOverlayClick: function() {
|
|
5195
|
+
return true;
|
|
5196
|
+
},
|
|
5197
|
+
onCloseIconClick: function() {
|
|
5198
|
+
return true;
|
|
5199
|
+
}
|
|
5200
|
+
});
|
|
5201
|
+
var _zIndex = 1100;
|
|
5202
|
+
var Popup = function(props) {
|
|
5203
|
+
var _$_object_spread = _object_spread({}, defaultProps$1c, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left2 = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position2 = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick;
|
|
5204
|
+
var innerIndex = zIndex || _zIndex;
|
|
5205
|
+
var _useState = _sliced_to_array(React.useState(innerIndex), 2), index2 = _useState[0], setIndex = _useState[1];
|
|
5206
|
+
var _useState1 = _sliced_to_array(React.useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
|
|
5207
|
+
var _useState2 = _sliced_to_array(React.useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
|
|
5208
|
+
var _useState3 = _sliced_to_array(React.useState(""), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
|
|
5209
|
+
var refObject = useLockScrollTaro(innerVisible && lockScroll);
|
|
5210
|
+
var classPrefix2 = "nut-popup";
|
|
5211
|
+
var overlayStyles = _object_spread({}, overlayStyle);
|
|
5212
|
+
var contentZIndex = harmony() ? index2 + 1 : index2;
|
|
5213
|
+
var popStyles = _object_spread({
|
|
5214
|
+
zIndex: contentZIndex
|
|
5215
|
+
}, style);
|
|
5216
|
+
var _obj;
|
|
5217
|
+
var popClassName = classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-round"), round || position2 === "bottom"), _define_property(_obj, "".concat(classPrefix2, "-").concat(position2), true), _obj), className);
|
|
5218
|
+
var open2 = function() {
|
|
5219
|
+
if (!innerVisible) {
|
|
5220
|
+
setInnerVisible(true);
|
|
5221
|
+
setIndex(++innerIndex);
|
|
5222
|
+
}
|
|
5223
|
+
if (destroyOnClose) {
|
|
5224
|
+
setShowChildren(true);
|
|
5225
|
+
}
|
|
5226
|
+
onOpen && onOpen();
|
|
5227
|
+
};
|
|
5228
|
+
var close2 = function() {
|
|
5229
|
+
if (innerVisible) {
|
|
5230
|
+
setInnerVisible(false);
|
|
5231
|
+
if (destroyOnClose) {
|
|
5232
|
+
setTimeout(function() {
|
|
5233
|
+
setShowChildren(false);
|
|
5234
|
+
}, Number(duration));
|
|
5235
|
+
}
|
|
5236
|
+
onClose && onClose();
|
|
5237
|
+
}
|
|
5238
|
+
};
|
|
5239
|
+
var handleOverlayClick = function(e2) {
|
|
5240
|
+
e2.stopPropagation();
|
|
5241
|
+
if (closeOnOverlayClick && onOverlayClick(e2)) {
|
|
5242
|
+
close2();
|
|
5243
|
+
}
|
|
5244
|
+
};
|
|
5245
|
+
var handleCloseIconClick = function(e2) {
|
|
5246
|
+
onCloseIconClick(e2) && close2();
|
|
5247
|
+
};
|
|
5248
|
+
var renderCloseIcon = function() {
|
|
5249
|
+
var closeClasses = classNames("".concat(classPrefix2, "-title-right"), "".concat(classPrefix2, "-title-right-").concat(closeIconPosition));
|
|
5250
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable && /* @__PURE__ */ React.createElement(components.View, {
|
|
5251
|
+
className: closeClasses,
|
|
5252
|
+
onClick: handleCloseIconClick
|
|
5253
|
+
}, /* @__PURE__ */ React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(g$1, null)));
|
|
5254
|
+
};
|
|
5255
|
+
var renderTitle = function() {
|
|
5256
|
+
if (left2 || title || description) {
|
|
5257
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
5258
|
+
className: "".concat(classPrefix2, "-title")
|
|
5259
|
+
}, position2 === "bottom" && /* @__PURE__ */ React.createElement(React.Fragment, null, left2 && /* @__PURE__ */ React.createElement(components.View, {
|
|
5260
|
+
className: "".concat(classPrefix2, "-title-left")
|
|
5261
|
+
}, left2), (title || description) && /* @__PURE__ */ React.createElement(components.View, {
|
|
5262
|
+
className: "".concat(classPrefix2, "-title-wrapper")
|
|
5263
|
+
}, title && /* @__PURE__ */ React.createElement(components.View, {
|
|
5264
|
+
className: "".concat(classPrefix2, "-title-title")
|
|
5265
|
+
}, title), description && /* @__PURE__ */ React.createElement(components.View, {
|
|
5266
|
+
className: "".concat(classPrefix2, "-title-description ").concat(title ? "".concat(classPrefix2, "-title-description-gap") : "")
|
|
5267
|
+
}, description))), renderCloseIcon());
|
|
5268
|
+
}
|
|
5269
|
+
if (closeable) {
|
|
5270
|
+
return renderCloseIcon();
|
|
5271
|
+
}
|
|
5272
|
+
};
|
|
5273
|
+
var renderContent = function() {
|
|
5274
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(components.View, {
|
|
5275
|
+
ref: refObject,
|
|
5276
|
+
style: popStyles,
|
|
5277
|
+
className: popClassName,
|
|
5278
|
+
onClick,
|
|
5279
|
+
catchMove: lockScroll
|
|
5280
|
+
}, renderTitle(), showChildren ? children : null));
|
|
5281
|
+
};
|
|
5282
|
+
var renderPop = function() {
|
|
5283
|
+
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
5284
|
+
nodeRef: refObject,
|
|
5285
|
+
classNames: transitionName,
|
|
5286
|
+
mountOnEnter: true,
|
|
5287
|
+
unmountOnExit: destroyOnClose,
|
|
5288
|
+
timeout: duration,
|
|
5289
|
+
in: innerVisible,
|
|
5290
|
+
onEntered: afterShow,
|
|
5291
|
+
onExited: afterClose
|
|
5292
|
+
}, renderContent());
|
|
5293
|
+
};
|
|
5294
|
+
var renderNode = function() {
|
|
5295
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, overlay ? /* @__PURE__ */ React.createElement(Overlay, {
|
|
5296
|
+
zIndex: index2,
|
|
5297
|
+
style: overlayStyles,
|
|
5298
|
+
className: overlayClassName,
|
|
5299
|
+
visible: innerVisible,
|
|
5300
|
+
closeOnOverlayClick,
|
|
5301
|
+
lockScroll,
|
|
5302
|
+
duration,
|
|
5303
|
+
onClick: handleOverlayClick
|
|
5304
|
+
}) : null, renderPop());
|
|
5305
|
+
};
|
|
5306
|
+
React.useEffect(function() {
|
|
5307
|
+
visible ? open2() : close2();
|
|
5308
|
+
}, [
|
|
5309
|
+
visible
|
|
5310
|
+
]);
|
|
5311
|
+
React.useEffect(function() {
|
|
5312
|
+
setTransitionName(transition || "".concat(classPrefix2, "-slide-").concat(position2));
|
|
5313
|
+
}, [
|
|
5314
|
+
position2,
|
|
5315
|
+
transition
|
|
5316
|
+
]);
|
|
5317
|
+
var resolveContainer = function(getContainer) {
|
|
5318
|
+
return (typeof getContainer === "function" ? getContainer() : getContainer) || document.body;
|
|
5319
|
+
};
|
|
5320
|
+
var renderToContainer = function(getContainer, node) {
|
|
5321
|
+
if (getContainer) {
|
|
5322
|
+
var container = resolveContainer(getContainer);
|
|
5323
|
+
return /* @__PURE__ */ ReactDOM.createPortal(node, container);
|
|
5324
|
+
}
|
|
5325
|
+
return node;
|
|
5326
|
+
};
|
|
5327
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, renderToContainer(portal, renderNode()));
|
|
5328
|
+
};
|
|
5329
|
+
Popup.displayName = "NutPopup";
|
|
5330
|
+
var defaultProps$1b = {
|
|
5483
5331
|
type: "custom",
|
|
5484
5332
|
existList: [],
|
|
5485
5333
|
defaultIcon: null,
|
|
@@ -5488,7 +5336,7 @@
|
|
|
5488
5336
|
};
|
|
5489
5337
|
var ExistRender = function(props) {
|
|
5490
5338
|
var locale = useConfig().locale;
|
|
5491
|
-
var _ref = _object_spread({}, defaultProps$
|
|
5339
|
+
var _ref = _object_spread({}, defaultProps$1b, props);
|
|
5492
5340
|
_ref.children;
|
|
5493
5341
|
var type2 = _ref.type, existList = _ref.existList, selectIcon = _ref.selectIcon, defaultIcon = _ref.defaultIcon, custom = _ref.custom, onSelect = _ref.onSelect, onSwitch = _ref.onSwitch;
|
|
5494
5342
|
_object_without_properties(_ref, [
|
|
@@ -5716,7 +5564,7 @@
|
|
|
5716
5564
|
]);
|
|
5717
5565
|
return Tree2;
|
|
5718
5566
|
}();
|
|
5719
|
-
var defaultProps$
|
|
5567
|
+
var defaultProps$1a = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
5720
5568
|
activeColor: "",
|
|
5721
5569
|
activeIcon: "checklist",
|
|
5722
5570
|
popup: true,
|
|
@@ -5742,7 +5590,7 @@
|
|
|
5742
5590
|
});
|
|
5743
5591
|
var InternalCascader = function(props, ref) {
|
|
5744
5592
|
var locale = useConfig().locale;
|
|
5745
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
5593
|
+
var _$_object_spread = _object_spread({}, defaultProps$1a, props), className = _$_object_spread.className, style = _$_object_spread.style, activeColor = _$_object_spread.activeColor, activeIcon = _$_object_spread.activeIcon, popup = _$_object_spread.popup, _object_spread_popupProps = _$_object_spread.popupProps, popupProps = _object_spread_popupProps === void 0 ? {} : _object_spread_popupProps, visible = _$_object_spread.visible, options = _$_object_spread.options, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, optionKey = _$_object_spread.optionKey, format2 = _$_object_spread.format, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, lazy = _$_object_spread.lazy, title = _$_object_spread.title, left2 = _$_object_spread.left, onLoad = _$_object_spread.onLoad, onClose = _$_object_spread.onClose, onChange = _$_object_spread.onChange, onPathChange = _$_object_spread.onPathChange;
|
|
5746
5594
|
var _useState = _sliced_to_array(React.useState("c1"), 2), tabvalue = _useState[0], setTabvalue = _useState[1];
|
|
5747
5595
|
var _useState1 = _sliced_to_array(React.useState([]), 2), optionsData = _useState1[0], setOptionsData = _useState1[1];
|
|
5748
5596
|
var isLazy = function() {
|
|
@@ -6198,7 +6046,7 @@
|
|
|
6198
6046
|
};
|
|
6199
6047
|
var Cascader = /* @__PURE__ */ React.forwardRef(InternalCascader);
|
|
6200
6048
|
Cascader.displayName = "NutCascader";
|
|
6201
|
-
var defaultProps$
|
|
6049
|
+
var defaultProps$19 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
6202
6050
|
visible: false,
|
|
6203
6051
|
type: "custom",
|
|
6204
6052
|
options: [],
|
|
@@ -6211,7 +6059,7 @@
|
|
|
6211
6059
|
height: "200px"
|
|
6212
6060
|
});
|
|
6213
6061
|
var CustomRender = function(props) {
|
|
6214
|
-
var _ref = _object_spread({}, defaultProps$
|
|
6062
|
+
var _ref = _object_spread({}, defaultProps$19, props);
|
|
6215
6063
|
_ref.children;
|
|
6216
6064
|
var visible = _ref.visible, type2 = _ref.type;
|
|
6217
6065
|
_ref.height;
|
|
@@ -6249,7 +6097,7 @@
|
|
|
6249
6097
|
onPathChange
|
|
6250
6098
|
}, rest)));
|
|
6251
6099
|
};
|
|
6252
|
-
var defaultProps$
|
|
6100
|
+
var defaultProps$18 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
6253
6101
|
defaultValue: [],
|
|
6254
6102
|
type: "custom",
|
|
6255
6103
|
options: [],
|
|
@@ -6269,7 +6117,7 @@
|
|
|
6269
6117
|
});
|
|
6270
6118
|
var InternalAddress = function(props, ref) {
|
|
6271
6119
|
var locale = useConfig().locale;
|
|
6272
|
-
var _ref = _object_spread({}, defaultProps$
|
|
6120
|
+
var _ref = _object_spread({}, defaultProps$18, props), style = _ref.style, className = _ref.className, visible = _ref.visible, defaultVisible = _ref.defaultVisible, defaultValue = _ref.defaultValue;
|
|
6273
6121
|
_ref.children;
|
|
6274
6122
|
var type2 = _ref.type, options = _ref.options, optionKey = _ref.optionKey, format2 = _ref.format, height2 = _ref.height, title = _ref.title, existList = _ref.existList, custom = _ref.custom, selectIcon = _ref.selectIcon, defaultIcon = _ref.defaultIcon, closeIcon = _ref.closeIcon, backIcon = _ref.backIcon, onChange = _ref.onChange, onExistSelect = _ref.onExistSelect, onClose = _ref.onClose, onSwitch = _ref.onSwitch;
|
|
6275
6123
|
_object_without_properties(_ref, [
|
|
@@ -6636,7 +6484,7 @@
|
|
|
6636
6484
|
var isStartAndEnd = function(days) {
|
|
6637
6485
|
return days.length >= 2 && Utils.isEqual(days[0], days[1]);
|
|
6638
6486
|
};
|
|
6639
|
-
var defaultProps$
|
|
6487
|
+
var defaultProps$17 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
6640
6488
|
type: "single",
|
|
6641
6489
|
autoBackfill: false,
|
|
6642
6490
|
popup: true,
|
|
@@ -6669,7 +6517,7 @@
|
|
|
6669
6517
|
});
|
|
6670
6518
|
var CalendarItem = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
6671
6519
|
var locale = useConfig().locale;
|
|
6672
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
6520
|
+
var _$_object_spread = _object_spread({}, defaultProps$17, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, renderBottomButton = _$_object_spread.renderBottomButton, value2 = _$_object_spread.value, onConfirm = _$_object_spread.onConfirm, onUpdate = _$_object_spread.onUpdate, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
|
|
6673
6521
|
var weekdays = locale.calendaritem.weekdays;
|
|
6674
6522
|
var weeks = _to_consumable_array(weekdays.slice(firstDayOfWeek, 7)).concat(_to_consumable_array(weekdays.slice(0, firstDayOfWeek)));
|
|
6675
6523
|
var monthTitle = locale.calendaritem.monthTitle;
|
|
@@ -7242,7 +7090,7 @@
|
|
|
7242
7090
|
}, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
|
|
7243
7091
|
});
|
|
7244
7092
|
CalendarItem.displayName = "NutCalendarItem";
|
|
7245
|
-
var defaultProps$
|
|
7093
|
+
var defaultProps$16 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
7246
7094
|
type: "single",
|
|
7247
7095
|
autoBackfill: false,
|
|
7248
7096
|
popup: true,
|
|
@@ -7277,7 +7125,7 @@
|
|
|
7277
7125
|
});
|
|
7278
7126
|
var Calendar = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
7279
7127
|
var locale = useConfig().locale;
|
|
7280
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
7128
|
+
var _$_object_spread = _object_spread({}, defaultProps$16, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, visible = _$_object_spread.visible, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, closeIcon = _$_object_spread.closeIcon, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderBottomButton = _$_object_spread.renderBottomButton, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onClose = _$_object_spread.onClose, onConfirm = _$_object_spread.onConfirm, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
|
|
7281
7129
|
var calendarRef = React.useRef(null);
|
|
7282
7130
|
var close2 = function() {
|
|
7283
7131
|
onClose && onClose();
|
|
@@ -7452,14 +7300,14 @@
|
|
|
7452
7300
|
convertDateToDay(new Date(current.getTime() + 24 * 60 * 60 * 1e3 * (6 - count)))
|
|
7453
7301
|
];
|
|
7454
7302
|
};
|
|
7455
|
-
var defaultProps$
|
|
7303
|
+
var defaultProps$15 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
7456
7304
|
type: "single",
|
|
7457
7305
|
firstDayOfWeek: 0
|
|
7458
7306
|
});
|
|
7459
7307
|
var prefixCls = "nut-calendarcard";
|
|
7460
7308
|
var CalendarCard = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
7461
7309
|
var locale = useConfig().locale;
|
|
7462
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
7310
|
+
var _$_object_spread = _object_spread({}, defaultProps$15, props), style = _$_object_spread.style, className = _$_object_spread.className, type2 = _$_object_spread.type, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
|
|
7463
7311
|
var _useState = _sliced_to_array(React.useState(function() {
|
|
7464
7312
|
var date2 = new Date(Date.now());
|
|
7465
7313
|
var val2 = value2 || defaultValue;
|
|
@@ -7820,7 +7668,7 @@
|
|
|
7820
7668
|
});
|
|
7821
7669
|
CalendarCard.displayName = "NutCalendarCard";
|
|
7822
7670
|
var CheckboxGroupContext = React.createContext(null);
|
|
7823
|
-
var defaultProps$
|
|
7671
|
+
var defaultProps$14 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
7824
7672
|
disabled: false,
|
|
7825
7673
|
shape: "round",
|
|
7826
7674
|
labelPosition: "right",
|
|
@@ -7832,7 +7680,7 @@
|
|
|
7832
7680
|
});
|
|
7833
7681
|
var classPrefix$j = "nut-checkbox";
|
|
7834
7682
|
var Checkbox = function(props) {
|
|
7835
|
-
var children = _object_spread({}, defaultProps$
|
|
7683
|
+
var children = _object_spread({}, defaultProps$14, props).children;
|
|
7836
7684
|
var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value2 = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = _object_without_properties(props, [
|
|
7837
7685
|
"icon",
|
|
7838
7686
|
"label",
|
|
@@ -7970,7 +7818,7 @@
|
|
|
7970
7818
|
}), renderCheckboxItem());
|
|
7971
7819
|
};
|
|
7972
7820
|
Checkbox.displayName = "NutCheckBox";
|
|
7973
|
-
var defaultProps$
|
|
7821
|
+
var defaultProps$13 = {
|
|
7974
7822
|
max: void 0,
|
|
7975
7823
|
min: void 0,
|
|
7976
7824
|
list: false,
|
|
@@ -7984,7 +7832,7 @@
|
|
|
7984
7832
|
};
|
|
7985
7833
|
var classPrefix$i = "nut-checkboxgroup";
|
|
7986
7834
|
var CheckboxGroup = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
7987
|
-
var _ref = _object_spread({}, defaultProps$
|
|
7835
|
+
var _ref = _object_spread({}, defaultProps$13, props), children = _ref.children, className = _ref.className, disabled = _ref.disabled, list = _ref.list, value2 = _ref.value, defaultValue = _ref.defaultValue, max = _ref.max, min = _ref.min, labelPosition = _ref.labelPosition, direction = _ref.direction, options = _ref.options, onChange = _ref.onChange, onLimit = _ref.onLimit, rest = _object_without_properties(_ref, [
|
|
7988
7836
|
"children",
|
|
7989
7837
|
"className",
|
|
7990
7838
|
"disabled",
|
|
@@ -8304,7 +8152,7 @@
|
|
|
8304
8152
|
})));
|
|
8305
8153
|
};
|
|
8306
8154
|
var PickerRoller = /* @__PURE__ */ React.forwardRef(InternalPickerRoller);
|
|
8307
|
-
var defaultProps$
|
|
8155
|
+
var defaultProps$12 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
8308
8156
|
options: [],
|
|
8309
8157
|
defaultValue: [],
|
|
8310
8158
|
value: void 0,
|
|
@@ -8313,7 +8161,7 @@
|
|
|
8313
8161
|
}
|
|
8314
8162
|
});
|
|
8315
8163
|
var InternalPickerView = function(props, ref) {
|
|
8316
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
8164
|
+
var _$_object_spread = _object_spread({}, defaultProps$12, props), options = _$_object_spread.options, _object_spread_defaultValue = _$_object_spread.defaultValue, defaultValue = _object_spread_defaultValue === void 0 ? [] : _object_spread_defaultValue, value2 = _$_object_spread.value, duration = _$_object_spread.duration, threeDimensional = _$_object_spread.threeDimensional, renderLabel = _$_object_spread.renderLabel, className = _$_object_spread.className, style = _$_object_spread.style, onChange = _$_object_spread.onChange;
|
|
8317
8165
|
var classPrefix2 = "nut-pickerview";
|
|
8318
8166
|
var cls = classNames(classPrefix2, className);
|
|
8319
8167
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
@@ -8488,7 +8336,7 @@
|
|
|
8488
8336
|
reset
|
|
8489
8337
|
];
|
|
8490
8338
|
}
|
|
8491
|
-
var defaultProps$
|
|
8339
|
+
var defaultProps$11 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
8492
8340
|
title: "",
|
|
8493
8341
|
options: [],
|
|
8494
8342
|
value: void 0,
|
|
@@ -8497,7 +8345,7 @@
|
|
|
8497
8345
|
});
|
|
8498
8346
|
var InternalPicker$1 = function(props, ref) {
|
|
8499
8347
|
var locale = useConfig().locale;
|
|
8500
|
-
var _ref = _object_spread({}, defaultProps$
|
|
8348
|
+
var _ref = _object_spread({}, defaultProps$11, props), children = _ref.children;
|
|
8501
8349
|
_ref.visible;
|
|
8502
8350
|
var title = _ref.title, _ref_options = _ref.options, options = _ref_options === void 0 ? [] : _ref_options, closeOnOverlayClick = _ref.closeOnOverlayClick, _ref_popupProps = _ref.popupProps, popupProps = _ref_popupProps === void 0 ? {} : _ref_popupProps, _ref_defaultValue = _ref.defaultValue, defaultValue = _ref_defaultValue === void 0 ? [] : _ref_defaultValue, className = _ref.className, style = _ref.style, threeDimensional = _ref.threeDimensional, duration = _ref.duration;
|
|
8503
8351
|
_ref.onConfirm;
|
|
@@ -8855,19 +8703,19 @@
|
|
|
8855
8703
|
handleDateComparison(date1, selectedOptions, index2);
|
|
8856
8704
|
}
|
|
8857
8705
|
};
|
|
8858
|
-
var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
8859
|
-
var defaultProps
|
|
8706
|
+
var currentYear$1 = (/* @__PURE__ */ new Date()).getFullYear();
|
|
8707
|
+
var defaultProps$10 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
8860
8708
|
visible: false,
|
|
8861
8709
|
title: "",
|
|
8862
8710
|
type: "date",
|
|
8863
8711
|
showChinese: false,
|
|
8864
8712
|
threeDimensional: true,
|
|
8865
8713
|
minuteStep: 1,
|
|
8866
|
-
startDate: new Date(currentYear - 10, 0, 1),
|
|
8867
|
-
endDate: new Date(currentYear + 10, 11, 31)
|
|
8714
|
+
startDate: new Date(currentYear$1 - 10, 0, 1),
|
|
8715
|
+
endDate: new Date(currentYear$1 + 10, 11, 31)
|
|
8868
8716
|
});
|
|
8869
8717
|
var InternalPicker = function(props, ref) {
|
|
8870
|
-
var _ref = _object_spread({}, defaultProps
|
|
8718
|
+
var _ref = _object_spread({}, defaultProps$10, props), startDate = _ref.startDate, endDate = _ref.endDate, type2 = _ref.type, showChinese = _ref.showChinese, minuteStep = _ref.minuteStep;
|
|
8871
8719
|
_ref.visible;
|
|
8872
8720
|
var title = _ref.title, defaultValue = _ref.defaultValue, _ref_pickerProps = _ref.pickerProps, pickerProps = _ref_pickerProps === void 0 ? {} : _ref_pickerProps, formatter = _ref.formatter, onClose = _ref.onClose, onCancel = _ref.onCancel, onConfirm = _ref.onConfirm, filter = _ref.filter, onChange = _ref.onChange, threeDimensional = _ref.threeDimensional, className = _ref.className, style = _ref.style, children = _ref.children, rest = _object_without_properties(_ref, [
|
|
8873
8721
|
"startDate",
|
|
@@ -8900,6 +8748,8 @@
|
|
|
8900
8748
|
minute: lang.min,
|
|
8901
8749
|
seconds: lang.seconds
|
|
8902
8750
|
};
|
|
8751
|
+
var classPrefix2 = "nut-datepicker";
|
|
8752
|
+
var cls = classNames(classPrefix2, className);
|
|
8903
8753
|
var _useState = _sliced_to_array(React.useState([]), 2), pickerValue = _useState[0], setPickerValue = _useState[1];
|
|
8904
8754
|
var _useState1 = _sliced_to_array(React.useState([]), 2), pickerOptions = _useState1[0], setPickerOptions = _useState1[1];
|
|
8905
8755
|
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
@@ -8925,10 +8775,9 @@
|
|
|
8925
8775
|
return actions;
|
|
8926
8776
|
});
|
|
8927
8777
|
var handleDateComparison = function(newDate, selectedOptions, index2) {
|
|
8928
|
-
var _this;
|
|
8929
|
-
var isEqual2 = ((_this = new Date(innerDate)) === null || _this === void 0 ? void 0 : _this.getTime()) === (newDate === null || newDate === void 0 ? void 0 : newDate.getTime());
|
|
8930
8778
|
if (newDate && isDate(newDate)) {
|
|
8931
|
-
|
|
8779
|
+
var _this;
|
|
8780
|
+
if (!isEqual((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
|
|
8932
8781
|
setInnerDate(formatValue(newDate, startDate, endDate));
|
|
8933
8782
|
}
|
|
8934
8783
|
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions, [
|
|
@@ -8941,8 +8790,7 @@
|
|
|
8941
8790
|
var handleConfirmDateComparison = function(newDate) {
|
|
8942
8791
|
if (newDate && isDate(newDate)) {
|
|
8943
8792
|
var _this;
|
|
8944
|
-
|
|
8945
|
-
if (!isEqual2) {
|
|
8793
|
+
if (!isEqual((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
|
|
8946
8794
|
setSelectedDate(formatValue(newDate, startDate, endDate));
|
|
8947
8795
|
}
|
|
8948
8796
|
}
|
|
@@ -8992,7 +8840,7 @@
|
|
|
8992
8840
|
endDate
|
|
8993
8841
|
]);
|
|
8994
8842
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedDate), /* @__PURE__ */ React.createElement(components.View, _object_spread({
|
|
8995
|
-
className:
|
|
8843
|
+
className: cls,
|
|
8996
8844
|
style
|
|
8997
8845
|
}, rest), pickerOptions.length && /* @__PURE__ */ React.createElement(Picker, _object_spread_props(_object_spread({}, pickerProps), {
|
|
8998
8846
|
title,
|
|
@@ -9010,6 +8858,98 @@
|
|
|
9010
8858
|
}))));
|
|
9011
8859
|
};
|
|
9012
8860
|
var DatePicker = /* @__PURE__ */ React.forwardRef(InternalPicker);
|
|
8861
|
+
var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
8862
|
+
var defaultProps$$ = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
8863
|
+
type: "date",
|
|
8864
|
+
showChinese: false,
|
|
8865
|
+
threeDimensional: true,
|
|
8866
|
+
minuteStep: 1,
|
|
8867
|
+
startDate: new Date(currentYear - 10, 0, 1),
|
|
8868
|
+
endDate: new Date(currentYear + 10, 11, 31)
|
|
8869
|
+
});
|
|
8870
|
+
var DatePickerView = function(props) {
|
|
8871
|
+
var _$_object_spread = _object_spread({}, defaultProps$$, props), startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, type2 = _$_object_spread.type, showChinese = _$_object_spread.showChinese, minuteStep = _$_object_spread.minuteStep, defaultValue = _$_object_spread.defaultValue, formatter = _$_object_spread.formatter, filter = _$_object_spread.filter, onChange = _$_object_spread.onChange, threeDimensional = _$_object_spread.threeDimensional, className = _$_object_spread.className, style = _$_object_spread.style;
|
|
8872
|
+
var classPrefix2 = "nut-datepickerview";
|
|
8873
|
+
var cls = classNames(classPrefix2, className);
|
|
8874
|
+
var locale = useConfig().locale;
|
|
8875
|
+
var lang = locale.datepicker;
|
|
8876
|
+
var zhCNType = {
|
|
8877
|
+
day: lang.day,
|
|
8878
|
+
year: lang.year,
|
|
8879
|
+
month: lang.month,
|
|
8880
|
+
hour: lang.hour,
|
|
8881
|
+
minute: lang.min,
|
|
8882
|
+
seconds: lang.seconds
|
|
8883
|
+
};
|
|
8884
|
+
var _useState = _sliced_to_array(React.useState([]), 2), pickerValue = _useState[0], setPickerValue = _useState[1];
|
|
8885
|
+
var _useState1 = _sliced_to_array(React.useState([]), 2), pickerOptions = _useState1[0], setPickerOptions = _useState1[1];
|
|
8886
|
+
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
8887
|
+
value: props.value && formatValue(props.value, startDate, endDate),
|
|
8888
|
+
defaultValue: defaultValue && formatValue(defaultValue, startDate, endDate),
|
|
8889
|
+
finalValue: 0
|
|
8890
|
+
}), 2), selectedDate = _usePropsValue[0], setSelectedDate = _usePropsValue[1];
|
|
8891
|
+
var handleDateComparison = function(newDate, selectedOptions, index2) {
|
|
8892
|
+
if (newDate && isDate(newDate)) {
|
|
8893
|
+
var _this;
|
|
8894
|
+
if (!isEqual((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
|
|
8895
|
+
setSelectedDate(formatValue(newDate, startDate, endDate));
|
|
8896
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions, [
|
|
8897
|
+
String(newDate.getFullYear()),
|
|
8898
|
+
padZero(newDate.getMonth() + 1),
|
|
8899
|
+
padZero(newDate.getDate())
|
|
8900
|
+
], index2);
|
|
8901
|
+
}
|
|
8902
|
+
}
|
|
8903
|
+
};
|
|
8904
|
+
var handleChange = function(selectedOptions, selectedValue, index2) {
|
|
8905
|
+
handlePickerValueChange(selectedOptions, selectedValue, index2, type2, defaultValue || startDate || endDate, handleDateComparison);
|
|
8906
|
+
};
|
|
8907
|
+
var generatePickerColumns = function() {
|
|
8908
|
+
var dateRanges = generateDatePickerRanges(type2, selectedDate, startDate, endDate);
|
|
8909
|
+
var columns = dateRanges.map(function(rangeConfig, columnIndex) {
|
|
8910
|
+
var columnType = rangeConfig.type, range2 = rangeConfig.range;
|
|
8911
|
+
var selectedValue = getDatePartValue(columnType, selectedDate);
|
|
8912
|
+
var pickerColumn = generatePickerColumnWithCallback(range2[0], range2[1], selectedValue, columnType, minuteStep, function(selectedIndex, options) {
|
|
8913
|
+
var _options_selectedIndex;
|
|
8914
|
+
pickerValue[columnIndex] = (_options_selectedIndex = options[selectedIndex]) === null || _options_selectedIndex === void 0 ? void 0 : _options_selectedIndex.value;
|
|
8915
|
+
setPickerValue(_to_consumable_array(pickerValue));
|
|
8916
|
+
}, showChinese, zhCNType, formatter);
|
|
8917
|
+
if (filter === null || filter === void 0 ? void 0 : filter(columnType, pickerColumn)) {
|
|
8918
|
+
return filter(columnType, pickerColumn);
|
|
8919
|
+
}
|
|
8920
|
+
return pickerColumn;
|
|
8921
|
+
});
|
|
8922
|
+
return columns || [];
|
|
8923
|
+
};
|
|
8924
|
+
React.useEffect(function() {
|
|
8925
|
+
var _this, _this1;
|
|
8926
|
+
if (!isEqual((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), (_this1 = new Date(selectedDate)) === null || _this1 === void 0 ? void 0 : _this1.getTime())) {
|
|
8927
|
+
setSelectedDate(selectedDate);
|
|
8928
|
+
}
|
|
8929
|
+
}, [
|
|
8930
|
+
selectedDate
|
|
8931
|
+
]);
|
|
8932
|
+
React.useEffect(function() {
|
|
8933
|
+
setPickerOptions(generatePickerColumns());
|
|
8934
|
+
}, [
|
|
8935
|
+
selectedDate,
|
|
8936
|
+
startDate,
|
|
8937
|
+
endDate
|
|
8938
|
+
]);
|
|
8939
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
8940
|
+
className: cls,
|
|
8941
|
+
style
|
|
8942
|
+
}, pickerOptions.length && /* @__PURE__ */ React.createElement(PickerView, {
|
|
8943
|
+
value: pickerValue,
|
|
8944
|
+
options: pickerOptions,
|
|
8945
|
+
onChange: function(param) {
|
|
8946
|
+
var selectedOptions = param.selectedOptions, value2 = param.value, index2 = param.index;
|
|
8947
|
+
handleChange(selectedOptions, value2, index2);
|
|
8948
|
+
},
|
|
8949
|
+
threeDimensional
|
|
8950
|
+
}));
|
|
8951
|
+
};
|
|
8952
|
+
DatePickerView.displayName = "NutDatePickerView";
|
|
9013
8953
|
var Context = React.createContext({});
|
|
9014
8954
|
function _extends() {
|
|
9015
8955
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
@@ -10696,6 +10636,7 @@
|
|
|
10696
10636
|
plain: false
|
|
10697
10637
|
});
|
|
10698
10638
|
var Input = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
10639
|
+
var classPrefix2 = "nut-input";
|
|
10699
10640
|
var rtl = useRtl();
|
|
10700
10641
|
var locale = useConfig().locale;
|
|
10701
10642
|
var _ref = _object_spread({}, defaultProps$Y, props), type2 = _ref.type, name2 = _ref.name, placeholder = _ref.placeholder, align = _ref.align, disabled = _ref.disabled, readOnly = _ref.readOnly, maxLength = _ref.maxLength, clearable = _ref.clearable, clearIcon = _ref.clearIcon, formatTrigger = _ref.formatTrigger, autoFocus = _ref.autoFocus, style = _ref.style, className = _ref.className, plain = _ref.plain, onChange = _ref.onChange, onFocus = _ref.onFocus;
|
|
@@ -10752,7 +10693,6 @@
|
|
|
10752
10693
|
};
|
|
10753
10694
|
});
|
|
10754
10695
|
var inputClass = React.useCallback(function() {
|
|
10755
|
-
var classPrefix2 = "nut-input";
|
|
10756
10696
|
return [
|
|
10757
10697
|
classPrefix2,
|
|
10758
10698
|
"".concat(disabled ? "".concat(classPrefix2, "-disabled") : ""),
|
|
@@ -10830,6 +10770,7 @@
|
|
|
10830
10770
|
password: type2 === "password",
|
|
10831
10771
|
maxlength: maxLength,
|
|
10832
10772
|
placeholder: placeholder === void 0 ? locale.placeholder : placeholder,
|
|
10773
|
+
placeholderClass: "".concat(classPrefix2, "-placeholder"),
|
|
10833
10774
|
disabled: disabled || readOnly,
|
|
10834
10775
|
value: value2,
|
|
10835
10776
|
focus: autoFocus,
|
|
@@ -12651,7 +12592,7 @@
|
|
|
12651
12592
|
var locale = useConfig().locale;
|
|
12652
12593
|
var _ref = _object_spread({}, defaultProps$O, props), title = _ref.title, description = _ref.description, tips = _ref.tips, outerVisible = _ref.visible, value2 = _ref.value, error = _ref.error, hideFooter = _ref.hideFooter, length2 = _ref.length, plain = _ref.plain, style = _ref.style, className = _ref.className;
|
|
12653
12594
|
_ref.closeable;
|
|
12654
|
-
var autoFocus = _ref.autoFocus, onFocus = _ref.onFocus, onChange = _ref.onChange, onConfirm = _ref.onConfirm, onTips = _ref.onTips, onCancel = _ref.onCancel, onClose = _ref.onClose, onComplete = _ref.onComplete;
|
|
12595
|
+
var autoFocus = _ref.autoFocus, round = _ref.round, onFocus = _ref.onFocus, onChange = _ref.onChange, onConfirm = _ref.onConfirm, onTips = _ref.onTips, onCancel = _ref.onCancel, onClose = _ref.onClose, onComplete = _ref.onComplete;
|
|
12655
12596
|
_ref.onOverlayClick;
|
|
12656
12597
|
_ref.onCloseIconClick;
|
|
12657
12598
|
var rest = _object_without_properties(_ref, [
|
|
@@ -12668,6 +12609,7 @@
|
|
|
12668
12609
|
"className",
|
|
12669
12610
|
"closeable",
|
|
12670
12611
|
"autoFocus",
|
|
12612
|
+
"round",
|
|
12671
12613
|
"onFocus",
|
|
12672
12614
|
"onChange",
|
|
12673
12615
|
"onConfirm",
|
|
@@ -12727,15 +12669,12 @@
|
|
|
12727
12669
|
onConfirm && onConfirm(inputValue);
|
|
12728
12670
|
};
|
|
12729
12671
|
return /* @__PURE__ */ React.createElement(Popup, _object_spread({
|
|
12730
|
-
|
|
12731
|
-
padding: "32px 24px 28px 24px",
|
|
12732
|
-
borderRadius: "12px",
|
|
12733
|
-
textAlign: "center"
|
|
12734
|
-
},
|
|
12672
|
+
className: "".concat(classPrefix2, "-popup"),
|
|
12735
12673
|
visible,
|
|
12736
12674
|
closeable: true,
|
|
12737
12675
|
onOverlayClick: onClose,
|
|
12738
|
-
onCloseIconClick: onClose
|
|
12676
|
+
onCloseIconClick: onClose,
|
|
12677
|
+
round
|
|
12739
12678
|
}, rest), /* @__PURE__ */ React.createElement(components.View, {
|
|
12740
12679
|
className: classNames(classPrefix2, className),
|
|
12741
12680
|
style
|
|
@@ -13092,7 +13031,7 @@
|
|
|
13092
13031
|
autoHeight: autoSize,
|
|
13093
13032
|
maxlength: maxLength,
|
|
13094
13033
|
placeholder: placeholder !== void 0 ? placeholder : locale.placeholder
|
|
13095
|
-
})), showCount && /* @__PURE__ */ React.createElement(components.
|
|
13034
|
+
})), showCount && /* @__PURE__ */ React.createElement(components.View, {
|
|
13096
13035
|
className: classNames("".concat(classPrefix2, "-limit"), _define_property({}, "".concat(classPrefix2, "-limit-disabled"), disabled))
|
|
13097
13036
|
}, inputValue.length, "/", maxLength < 0 ? 0 : maxLength)));
|
|
13098
13037
|
};
|
|
@@ -14168,6 +14107,7 @@
|
|
|
14168
14107
|
}
|
|
14169
14108
|
};
|
|
14170
14109
|
var renderContent = function() {
|
|
14110
|
+
var contentZIndex = harmony() ? zIndex + 1 : zIndex;
|
|
14171
14111
|
return /* @__PURE__ */ React.createElement(CSSTransition, {
|
|
14172
14112
|
in: visible,
|
|
14173
14113
|
timeout: 300,
|
|
@@ -14176,7 +14116,9 @@
|
|
|
14176
14116
|
appear: true
|
|
14177
14117
|
}, /* @__PURE__ */ React.createElement(Content, {
|
|
14178
14118
|
className,
|
|
14179
|
-
style
|
|
14119
|
+
style: _object_spread({
|
|
14120
|
+
zIndex: contentZIndex
|
|
14121
|
+
}, style),
|
|
14180
14122
|
title,
|
|
14181
14123
|
header,
|
|
14182
14124
|
close: renderCloseIcon(),
|
|
@@ -14191,7 +14133,7 @@
|
|
|
14191
14133
|
},
|
|
14192
14134
|
ref: refObject,
|
|
14193
14135
|
catchMove: lockScroll
|
|
14194
|
-
}, overlay
|
|
14136
|
+
}, overlay && /* @__PURE__ */ React.createElement(Overlay, {
|
|
14195
14137
|
zIndex,
|
|
14196
14138
|
visible,
|
|
14197
14139
|
style: overlayStyle,
|
|
@@ -14199,7 +14141,7 @@
|
|
|
14199
14141
|
closeOnOverlayClick,
|
|
14200
14142
|
lockScroll,
|
|
14201
14143
|
onClick: onHandleClickOverlay
|
|
14202
|
-
}, renderContent())
|
|
14144
|
+
}), renderContent());
|
|
14203
14145
|
};
|
|
14204
14146
|
function open$1(selector, options) {
|
|
14205
14147
|
var path = useCustomEventsPath(selector);
|
|
@@ -14229,17 +14171,7 @@
|
|
|
14229
14171
|
className: "myDrag"
|
|
14230
14172
|
});
|
|
14231
14173
|
var Drag = function(props) {
|
|
14232
|
-
var
|
|
14233
|
-
"attract",
|
|
14234
|
-
"direction",
|
|
14235
|
-
"boundary",
|
|
14236
|
-
"onDrag",
|
|
14237
|
-
"onDragStart",
|
|
14238
|
-
"onDragEnd",
|
|
14239
|
-
"children",
|
|
14240
|
-
"className",
|
|
14241
|
-
"style"
|
|
14242
|
-
]);
|
|
14174
|
+
var _$_object_spread = _object_spread({}, defaultProps$G, props), attract = _$_object_spread.attract, direction = _$_object_spread.direction, boundary = _$_object_spread.boundary, onDrag = _$_object_spread.onDrag, onDragStart = _$_object_spread.onDragStart, onDragEnd = _$_object_spread.onDragEnd, children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style;
|
|
14243
14175
|
var classPrefix2 = "nut-drag";
|
|
14244
14176
|
var _useState = _sliced_to_array(React.useState(boundary), 2), boundaryState = _useState[0], setBoundaryState = _useState[1];
|
|
14245
14177
|
var myDrag = React.useRef(null);
|
|
@@ -14258,8 +14190,8 @@
|
|
|
14258
14190
|
var translateY = React.useRef(0);
|
|
14259
14191
|
var middleLine = React.useRef(0);
|
|
14260
14192
|
var getInfo = /* @__PURE__ */ function() {
|
|
14261
|
-
var
|
|
14262
|
-
var el,
|
|
14193
|
+
var _ref = _async_to_generator(function() {
|
|
14194
|
+
var el, top, left2, bottom, right2, _getWindowInfo, screenWidth, windowHeight, _ref2, width2, height2, dragTop, dragLeft;
|
|
14263
14195
|
return __generator(this, function(_state) {
|
|
14264
14196
|
switch (_state.label) {
|
|
14265
14197
|
case 0:
|
|
@@ -14275,17 +14207,14 @@
|
|
|
14275
14207
|
getRectByTaro(dragRef.current)
|
|
14276
14208
|
];
|
|
14277
14209
|
case 1:
|
|
14278
|
-
|
|
14279
|
-
(
|
|
14280
|
-
|
|
14281
|
-
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
});
|
|
14287
|
-
middleLine.current = screenWidth - rec.width - rec.left - (screenWidth - rec.width) / 2;
|
|
14288
|
-
}).exec();
|
|
14210
|
+
_ref2 = _state.sent(), width2 = _ref2.width, height2 = _ref2.height, dragTop = _ref2.top, dragLeft = _ref2.left;
|
|
14211
|
+
setBoundaryState({
|
|
14212
|
+
top: -dragTop + top,
|
|
14213
|
+
left: -dragLeft + left2,
|
|
14214
|
+
bottom: windowHeight - dragTop - bottom - Math.ceil(height2),
|
|
14215
|
+
right: screenWidth - dragLeft - right2 - Math.ceil(width2)
|
|
14216
|
+
});
|
|
14217
|
+
middleLine.current = screenWidth - width2 - dragLeft - (screenWidth - width2) / 2;
|
|
14289
14218
|
_state.label = 2;
|
|
14290
14219
|
case 2:
|
|
14291
14220
|
return [
|
|
@@ -14295,7 +14224,7 @@
|
|
|
14295
14224
|
});
|
|
14296
14225
|
});
|
|
14297
14226
|
return function getInfo2() {
|
|
14298
|
-
return
|
|
14227
|
+
return _ref.apply(this, arguments);
|
|
14299
14228
|
};
|
|
14300
14229
|
}();
|
|
14301
14230
|
var touchStart = function(e2) {
|
|
@@ -14339,7 +14268,7 @@
|
|
|
14339
14268
|
});
|
|
14340
14269
|
}
|
|
14341
14270
|
};
|
|
14342
|
-
var touchEnd = function(
|
|
14271
|
+
var touchEnd = function() {
|
|
14343
14272
|
onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd({
|
|
14344
14273
|
offset: [
|
|
14345
14274
|
translateX.current,
|
|
@@ -14359,27 +14288,34 @@
|
|
|
14359
14288
|
}
|
|
14360
14289
|
};
|
|
14361
14290
|
React.useEffect(function() {
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14291
|
+
if (dragRef.current) {
|
|
14292
|
+
if (web()) {
|
|
14293
|
+
timer.current = window.setTimeout(function() {
|
|
14294
|
+
getInfo();
|
|
14295
|
+
}, 300);
|
|
14296
|
+
} else {
|
|
14297
|
+
getInfo();
|
|
14298
|
+
}
|
|
14299
|
+
}
|
|
14365
14300
|
return function() {
|
|
14366
14301
|
clearTimeout(timer.current);
|
|
14367
14302
|
};
|
|
14368
|
-
}, [
|
|
14369
|
-
|
|
14303
|
+
}, [
|
|
14304
|
+
dragRef.current
|
|
14305
|
+
]);
|
|
14306
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
14370
14307
|
style,
|
|
14371
|
-
className: "".concat(classPrefix2, " ").concat(className)
|
|
14372
|
-
}, reset), {
|
|
14308
|
+
className: "".concat(classPrefix2, " ").concat(className),
|
|
14373
14309
|
ref: myDrag
|
|
14374
|
-
}
|
|
14310
|
+
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
14375
14311
|
className: "".concat(classPrefix2, "-inner"),
|
|
14376
|
-
onTouchStart: function(event) {
|
|
14377
|
-
return touchStart(event);
|
|
14378
|
-
},
|
|
14379
14312
|
ref: dragRef,
|
|
14313
|
+
catchMove: true,
|
|
14314
|
+
// @ts-ignore
|
|
14315
|
+
onTouchStart: touchStart,
|
|
14316
|
+
// @ts-ignore
|
|
14380
14317
|
onTouchMove: touchMove,
|
|
14381
14318
|
onTouchEnd: touchEnd,
|
|
14382
|
-
// eslint-disable-next-line react/no-unknown-property
|
|
14383
14319
|
style: currstyle
|
|
14384
14320
|
}, children));
|
|
14385
14321
|
};
|
|
@@ -14454,60 +14390,6 @@
|
|
|
14454
14390
|
};
|
|
14455
14391
|
Empty.displayName = "NutEmpty";
|
|
14456
14392
|
var defaultProps$E = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
14457
|
-
title: null,
|
|
14458
|
-
description: null,
|
|
14459
|
-
icon: "",
|
|
14460
|
-
status: "info",
|
|
14461
|
-
actions: []
|
|
14462
|
-
});
|
|
14463
|
-
var ResultPage = function(props) {
|
|
14464
|
-
var _$_object_spread = _object_spread({}, defaultProps$E, props), className = _$_object_spread.className, style = _$_object_spread.style, title = _$_object_spread.title, description = _$_object_spread.description, icon = _$_object_spread.icon, status = _$_object_spread.status, actions = _$_object_spread.actions, children = _$_object_spread.children;
|
|
14465
|
-
var classPrefix2 = "nut-resultpage";
|
|
14466
|
-
var cls = classNames(classPrefix2, className);
|
|
14467
|
-
var defaultStatus2 = {
|
|
14468
|
-
success: /* @__PURE__ */ React.createElement(t$1, {
|
|
14469
|
-
color: "#00D900"
|
|
14470
|
-
}),
|
|
14471
|
-
error: /* @__PURE__ */ React.createElement(N, {
|
|
14472
|
-
color: "#FF0F23"
|
|
14473
|
-
}),
|
|
14474
|
-
warning: /* @__PURE__ */ React.createElement(D, {
|
|
14475
|
-
color: "#FFBF00"
|
|
14476
|
-
}),
|
|
14477
|
-
info: /* @__PURE__ */ React.createElement(c$1, {
|
|
14478
|
-
color: "#0073FF"
|
|
14479
|
-
}),
|
|
14480
|
-
waiting: /* @__PURE__ */ React.createElement(N$2, {
|
|
14481
|
-
color: "#0073FF"
|
|
14482
|
-
})
|
|
14483
|
-
};
|
|
14484
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
14485
|
-
className: cls,
|
|
14486
|
-
style
|
|
14487
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
14488
|
-
className: "".concat(classPrefix2, "-icon")
|
|
14489
|
-
}, icon || defaultStatus2[status]), typeof title === "string" && title ? /* @__PURE__ */ React.createElement(components.View, {
|
|
14490
|
-
className: "".concat(classPrefix2, "-title")
|
|
14491
|
-
}, title) : title, typeof description === "string" && description ? /* @__PURE__ */ React.createElement(components.Text, {
|
|
14492
|
-
numberOfLines: 2,
|
|
14493
|
-
className: "".concat(classPrefix2, "-description")
|
|
14494
|
-
}, description) : description, actions.length ? /* @__PURE__ */ React.createElement(components.View, {
|
|
14495
|
-
className: "".concat(classPrefix2, "-actions")
|
|
14496
|
-
}, actions.map(function(action, index2) {
|
|
14497
|
-
action.text;
|
|
14498
|
-
var rest = _object_without_properties(action, [
|
|
14499
|
-
"text"
|
|
14500
|
-
]);
|
|
14501
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
14502
|
-
className: "".concat(classPrefix2, "-action"),
|
|
14503
|
-
key: index2
|
|
14504
|
-
}, /* @__PURE__ */ React.createElement(Button, _object_spread_props(_object_spread({}, rest), {
|
|
14505
|
-
size: "large"
|
|
14506
|
-
}), action === null || action === void 0 ? void 0 : action.text));
|
|
14507
|
-
})) : null, children);
|
|
14508
|
-
};
|
|
14509
|
-
ResultPage.displayName = "NutResultPage";
|
|
14510
|
-
var defaultProps$D = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
14511
14393
|
type: "default",
|
|
14512
14394
|
hasMore: true,
|
|
14513
14395
|
threshold: 40,
|
|
@@ -14526,7 +14408,7 @@
|
|
|
14526
14408
|
return null;
|
|
14527
14409
|
};
|
|
14528
14410
|
var locale = useConfig().locale;
|
|
14529
|
-
var _ref = _object_spread({}, defaultProps$
|
|
14411
|
+
var _ref = _object_spread({}, defaultProps$E, props), children = _ref.children, type2 = _ref.type, hasMore = _ref.hasMore, threshold = _ref.threshold, target = _ref.target, pullRefresh = _ref.pullRefresh, pullingText = _ref.pullingText, loadingText = _ref.loadingText, loadMoreText = _ref.loadMoreText, className = _ref.className, onRefresh = _ref.onRefresh, onLoadMore = _ref.onLoadMore, onScroll = _ref.onScroll, rest = _object_without_properties(_ref, [
|
|
14530
14412
|
"children",
|
|
14531
14413
|
"type",
|
|
14532
14414
|
"hasMore",
|
|
@@ -35230,7 +35112,7 @@
|
|
|
35230
35112
|
circular: g,
|
|
35231
35113
|
spinner: z
|
|
35232
35114
|
};
|
|
35233
|
-
var defaultProps$
|
|
35115
|
+
var defaultProps$D = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
35234
35116
|
// 对比一下,个人感觉还是Loading1比较好看一些,所以用它作为了默认的loading图标
|
|
35235
35117
|
type: "circular",
|
|
35236
35118
|
direction: "horizontal",
|
|
@@ -35241,7 +35123,7 @@
|
|
|
35241
35123
|
autoplay: true
|
|
35242
35124
|
};
|
|
35243
35125
|
var Loading = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
35244
|
-
var _ref = _object_spread({}, defaultProps$
|
|
35126
|
+
var _ref = _object_spread({}, defaultProps$D, props), className = _ref.className, style = _ref.style, children = _ref.children, direction = _ref.direction, icon = _ref.icon, lottieProps = _ref.lottieProps, rest = _object_without_properties(_ref, [
|
|
35245
35127
|
"className",
|
|
35246
35128
|
"style",
|
|
35247
35129
|
"children",
|
|
@@ -35282,7 +35164,7 @@
|
|
|
35282
35164
|
}, children) : null);
|
|
35283
35165
|
});
|
|
35284
35166
|
Loading.displayName = "NutLoading";
|
|
35285
|
-
var defaultProps$
|
|
35167
|
+
var defaultProps$C = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
35286
35168
|
align: "left",
|
|
35287
35169
|
direction: "horizontal",
|
|
35288
35170
|
list: [],
|
|
@@ -35302,7 +35184,7 @@
|
|
|
35302
35184
|
});
|
|
35303
35185
|
var NoticeBar = function(props) {
|
|
35304
35186
|
var rtl = useRtl();
|
|
35305
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
35187
|
+
var _$_object_spread = _object_spread({}, defaultProps$C, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style, align = _$_object_spread.align, direction = _$_object_spread.direction, list = _$_object_spread.list, duration = _$_object_spread.duration, height2 = _$_object_spread.height, content2 = _$_object_spread.content, closeable = _$_object_spread.closeable, wrap = _$_object_spread.wrap, leftIcon = _$_object_spread.leftIcon, rightIcon = _$_object_spread.rightIcon, right2 = _$_object_spread.right, delay = _$_object_spread.delay, scrollable = _$_object_spread.scrollable, speed = _$_object_spread.speed, close2 = _$_object_spread.close, click = _$_object_spread.click, onClose = _$_object_spread.onClose, onClick = _$_object_spread.onClick, onItemClick = _$_object_spread.onItemClick;
|
|
35306
35188
|
var classPrefix2 = "nut-noticebar";
|
|
35307
35189
|
var wrapRef = React.useRef(null);
|
|
35308
35190
|
var contentRef = React.useRef(null);
|
|
@@ -35716,7 +35598,7 @@
|
|
|
35716
35598
|
}) : null))) : null);
|
|
35717
35599
|
};
|
|
35718
35600
|
NoticeBar.displayName = "NutNoticeBar";
|
|
35719
|
-
var defaultProps$
|
|
35601
|
+
var defaultProps$B = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
35720
35602
|
id: "",
|
|
35721
35603
|
duration: 3e3,
|
|
35722
35604
|
type: "danger",
|
|
@@ -35729,7 +35611,7 @@
|
|
|
35729
35611
|
});
|
|
35730
35612
|
var classPrefix$c = "nut-notify";
|
|
35731
35613
|
var Notify = function(props) {
|
|
35732
|
-
var _mergeProps = mergeProps(defaultProps$
|
|
35614
|
+
var _mergeProps = mergeProps(defaultProps$B, props), id = _mergeProps.id, children = _mergeProps.children, style = _mergeProps.style, type2 = _mergeProps.type, className = _mergeProps.className, position2 = _mergeProps.position, visible = _mergeProps.visible, duration = _mergeProps.duration, onClose = _mergeProps.onClose, onClick = _mergeProps.onClick;
|
|
35733
35615
|
useCustomEvent(id, function(status) {
|
|
35734
35616
|
status ? show2() : hide2();
|
|
35735
35617
|
});
|
|
@@ -35795,7 +35677,7 @@
|
|
|
35795
35677
|
Notify.displayName = "NutNotify";
|
|
35796
35678
|
Notify.open = open;
|
|
35797
35679
|
Notify.close = close;
|
|
35798
|
-
var defaultProps$
|
|
35680
|
+
var defaultProps$A = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
35799
35681
|
list: [],
|
|
35800
35682
|
theme: "light",
|
|
35801
35683
|
location: "bottom",
|
|
@@ -35821,7 +35703,7 @@
|
|
|
35821
35703
|
var classPrefix$b = "nut-popover";
|
|
35822
35704
|
var Popover = function(props) {
|
|
35823
35705
|
var rtl = useRtl();
|
|
35824
|
-
var _ref = _object_spread({}, defaultProps$
|
|
35706
|
+
var _ref = _object_spread({}, defaultProps$A, props), children = _ref.children, list = _ref.list, theme = _ref.theme, location = _ref.location, visible = _ref.visible, offset = _ref.offset, arrowOffset = _ref.arrowOffset, targetId = _ref.targetId, overlay = _ref.overlay, closeOnOutsideClick = _ref.closeOnOutsideClick, closeOnActionClick = _ref.closeOnActionClick, className = _ref.className, showArrow = _ref.showArrow, style = _ref.style, onClick = _ref.onClick, onOpen = _ref.onOpen, onClose = _ref.onClose, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
|
|
35825
35707
|
"children",
|
|
35826
35708
|
"list",
|
|
35827
35709
|
"theme",
|
|
@@ -36170,7 +36052,7 @@
|
|
|
36170
36052
|
return setTimeout(resolve, time2);
|
|
36171
36053
|
});
|
|
36172
36054
|
};
|
|
36173
|
-
var defaultProps$
|
|
36055
|
+
var defaultProps$z = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
36174
36056
|
type: "default",
|
|
36175
36057
|
pullingText: "",
|
|
36176
36058
|
canReleaseText: "",
|
|
@@ -36191,7 +36073,7 @@
|
|
|
36191
36073
|
var classPrefix2 = "nut-pulltorefresh";
|
|
36192
36074
|
var locale = useConfig().locale;
|
|
36193
36075
|
var touch = useTouch();
|
|
36194
|
-
var props = _object_spread({}, defaultProps$
|
|
36076
|
+
var props = _object_spread({}, defaultProps$z, p, {
|
|
36195
36077
|
pullingText: p.pullingText || locale.pullToRefresh.pullingText,
|
|
36196
36078
|
canReleaseText: p.canReleaseText || locale.pullToRefresh.canReleaseText,
|
|
36197
36079
|
refreshingText: p.refreshingText || locale.pullToRefresh.refreshingText,
|
|
@@ -36338,6 +36220,60 @@
|
|
|
36338
36220
|
}, props.children));
|
|
36339
36221
|
};
|
|
36340
36222
|
PullToRefresh.displayName = "NutPullToRefresh";
|
|
36223
|
+
var defaultProps$y = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
36224
|
+
title: null,
|
|
36225
|
+
description: null,
|
|
36226
|
+
icon: "",
|
|
36227
|
+
status: "info",
|
|
36228
|
+
actions: []
|
|
36229
|
+
});
|
|
36230
|
+
var ResultPage = function(props) {
|
|
36231
|
+
var _$_object_spread = _object_spread({}, defaultProps$y, props), className = _$_object_spread.className, style = _$_object_spread.style, title = _$_object_spread.title, description = _$_object_spread.description, icon = _$_object_spread.icon, status = _$_object_spread.status, actions = _$_object_spread.actions, children = _$_object_spread.children;
|
|
36232
|
+
var classPrefix2 = "nut-resultpage";
|
|
36233
|
+
var cls = classNames(classPrefix2, className);
|
|
36234
|
+
var defaultStatus2 = {
|
|
36235
|
+
success: /* @__PURE__ */ React.createElement(t$1, {
|
|
36236
|
+
color: "#00D900"
|
|
36237
|
+
}),
|
|
36238
|
+
error: /* @__PURE__ */ React.createElement(N, {
|
|
36239
|
+
color: "#FF0F23"
|
|
36240
|
+
}),
|
|
36241
|
+
warning: /* @__PURE__ */ React.createElement(D, {
|
|
36242
|
+
color: "#FFBF00"
|
|
36243
|
+
}),
|
|
36244
|
+
info: /* @__PURE__ */ React.createElement(c$1, {
|
|
36245
|
+
color: "#0073FF"
|
|
36246
|
+
}),
|
|
36247
|
+
waiting: /* @__PURE__ */ React.createElement(N$2, {
|
|
36248
|
+
color: "#0073FF"
|
|
36249
|
+
})
|
|
36250
|
+
};
|
|
36251
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
36252
|
+
className: cls,
|
|
36253
|
+
style
|
|
36254
|
+
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
36255
|
+
className: "".concat(classPrefix2, "-icon")
|
|
36256
|
+
}, icon || defaultStatus2[status]), typeof title === "string" && title ? /* @__PURE__ */ React.createElement(components.View, {
|
|
36257
|
+
className: "".concat(classPrefix2, "-title")
|
|
36258
|
+
}, title) : title, typeof description === "string" && description ? /* @__PURE__ */ React.createElement(components.Text, {
|
|
36259
|
+
numberOfLines: 2,
|
|
36260
|
+
className: "".concat(classPrefix2, "-description")
|
|
36261
|
+
}, description) : description, actions.length ? /* @__PURE__ */ React.createElement(components.View, {
|
|
36262
|
+
className: "".concat(classPrefix2, "-actions")
|
|
36263
|
+
}, actions.map(function(action, index2) {
|
|
36264
|
+
action.text;
|
|
36265
|
+
var rest = _object_without_properties(action, [
|
|
36266
|
+
"text"
|
|
36267
|
+
]);
|
|
36268
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
36269
|
+
className: "".concat(classPrefix2, "-action"),
|
|
36270
|
+
key: index2
|
|
36271
|
+
}, /* @__PURE__ */ React.createElement(Button, _object_spread_props(_object_spread({}, rest), {
|
|
36272
|
+
size: "large"
|
|
36273
|
+
}), action === null || action === void 0 ? void 0 : action.text));
|
|
36274
|
+
})) : null, children);
|
|
36275
|
+
};
|
|
36276
|
+
ResultPage.displayName = "NutResultPage";
|
|
36341
36277
|
var AvatarContext = React.createContext({});
|
|
36342
36278
|
var defaultProps$x = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
36343
36279
|
maxContent: "",
|
|
@@ -38811,63 +38747,7 @@
|
|
|
38811
38747
|
}, pageCount)));
|
|
38812
38748
|
};
|
|
38813
38749
|
Pagination.displayName = "NutPagination";
|
|
38814
|
-
var defaultProps$f = {
|
|
38815
|
-
options: [],
|
|
38816
|
-
onChange: function(value2) {
|
|
38817
|
-
}
|
|
38818
|
-
};
|
|
38819
|
-
var Segmented = function(props) {
|
|
38820
|
-
var classPrefix2 = "nut-segmented";
|
|
38821
|
-
var itemClassPrefix = "nut-segmented-item";
|
|
38822
|
-
var mergedProps = mergeProps(defaultProps$f, props);
|
|
38823
|
-
var options = mergedProps.options;
|
|
38824
|
-
mergedProps.onChange;
|
|
38825
|
-
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
38826
|
-
value: mergedProps.value,
|
|
38827
|
-
defaultValue: mergedProps.defaultValue,
|
|
38828
|
-
finalValue: 0,
|
|
38829
|
-
onChange: mergedProps.onChange
|
|
38830
|
-
}), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
|
|
38831
|
-
var renderItems = React.useCallback(function(options2, value3) {
|
|
38832
|
-
return options2.map(function(option, index2) {
|
|
38833
|
-
var optionType = typeof option === "undefined" ? "undefined" : _type_of(option);
|
|
38834
|
-
switch (optionType) {
|
|
38835
|
-
case "object":
|
|
38836
|
-
var opt = option;
|
|
38837
|
-
var _obj;
|
|
38838
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38839
|
-
className: classNames(itemClassPrefix, (_obj = {}, _define_property(_obj, "".concat(itemClassPrefix, "-active"), opt.value === value3), _define_property(_obj, "".concat(opt.className), !!opt.className), _obj)),
|
|
38840
|
-
key: opt.value,
|
|
38841
|
-
onClick: function() {
|
|
38842
|
-
if (opt.disabled) return;
|
|
38843
|
-
setValue(option.value);
|
|
38844
|
-
}
|
|
38845
|
-
}, opt.icon ? /* @__PURE__ */ React.createElement(components.View, {
|
|
38846
|
-
className: "nut-segmented-icon"
|
|
38847
|
-
}, opt.icon) : null, opt.label);
|
|
38848
|
-
default: {
|
|
38849
|
-
if (typeof option !== "string" && typeof option !== "number") {
|
|
38850
|
-
console.warn("Unsupported option type:", optionType);
|
|
38851
|
-
}
|
|
38852
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38853
|
-
className: classNames(itemClassPrefix, _define_property({}, "".concat(itemClassPrefix, "-active"), index2 === value3)),
|
|
38854
|
-
key: option.toString(),
|
|
38855
|
-
onClick: function() {
|
|
38856
|
-
setValue(index2);
|
|
38857
|
-
}
|
|
38858
|
-
}, option);
|
|
38859
|
-
}
|
|
38860
|
-
}
|
|
38861
|
-
});
|
|
38862
|
-
}, [
|
|
38863
|
-
value2
|
|
38864
|
-
]);
|
|
38865
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38866
|
-
className: classNames(classPrefix2),
|
|
38867
|
-
style: mergedProps.style
|
|
38868
|
-
}, renderItems(options, value2));
|
|
38869
|
-
};
|
|
38870
|
-
var defaultProps$e = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
38750
|
+
var defaultProps$f = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
38871
38751
|
color: "primary",
|
|
38872
38752
|
price: 0,
|
|
38873
38753
|
symbol: "¥",
|
|
@@ -38878,7 +38758,7 @@
|
|
|
38878
38758
|
line: false
|
|
38879
38759
|
});
|
|
38880
38760
|
var Price = function(props) {
|
|
38881
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
38761
|
+
var _$_object_spread = _object_spread({}, defaultProps$f, props), color = _$_object_spread.color, price = _$_object_spread.price, symbol = _$_object_spread.symbol, digits = _$_object_spread.digits, thousands = _$_object_spread.thousands, position2 = _$_object_spread.position, size = _$_object_spread.size, line = _$_object_spread.line, className = _$_object_spread.className, style = _$_object_spread.style;
|
|
38882
38762
|
var classPrefix2 = "nut-price";
|
|
38883
38763
|
var rtl = useRtl();
|
|
38884
38764
|
var replaceSpecialChar = function(url) {
|
|
@@ -38948,6 +38828,62 @@
|
|
|
38948
38828
|
}, renderInner()));
|
|
38949
38829
|
};
|
|
38950
38830
|
Price.displayName = "NutPrice";
|
|
38831
|
+
var defaultProps$e = {
|
|
38832
|
+
options: [],
|
|
38833
|
+
onChange: function(value2) {
|
|
38834
|
+
}
|
|
38835
|
+
};
|
|
38836
|
+
var Segmented = function(props) {
|
|
38837
|
+
var classPrefix2 = "nut-segmented";
|
|
38838
|
+
var itemClassPrefix = "nut-segmented-item";
|
|
38839
|
+
var mergedProps = mergeProps(defaultProps$e, props);
|
|
38840
|
+
var options = mergedProps.options;
|
|
38841
|
+
mergedProps.onChange;
|
|
38842
|
+
var _usePropsValue = _sliced_to_array(usePropsValue({
|
|
38843
|
+
value: mergedProps.value,
|
|
38844
|
+
defaultValue: mergedProps.defaultValue,
|
|
38845
|
+
finalValue: 0,
|
|
38846
|
+
onChange: mergedProps.onChange
|
|
38847
|
+
}), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
|
|
38848
|
+
var renderItems = React.useCallback(function(options2, value3) {
|
|
38849
|
+
return options2.map(function(option, index2) {
|
|
38850
|
+
var optionType = typeof option === "undefined" ? "undefined" : _type_of(option);
|
|
38851
|
+
switch (optionType) {
|
|
38852
|
+
case "object":
|
|
38853
|
+
var opt = option;
|
|
38854
|
+
var _obj;
|
|
38855
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38856
|
+
className: classNames(itemClassPrefix, (_obj = {}, _define_property(_obj, "".concat(itemClassPrefix, "-active"), opt.value === value3), _define_property(_obj, "".concat(opt.className), !!opt.className), _obj)),
|
|
38857
|
+
key: opt.value,
|
|
38858
|
+
onClick: function() {
|
|
38859
|
+
if (opt.disabled) return;
|
|
38860
|
+
setValue(option.value);
|
|
38861
|
+
}
|
|
38862
|
+
}, opt.icon ? /* @__PURE__ */ React.createElement(components.View, {
|
|
38863
|
+
className: "nut-segmented-icon"
|
|
38864
|
+
}, opt.icon) : null, opt.label);
|
|
38865
|
+
default: {
|
|
38866
|
+
if (typeof option !== "string" && typeof option !== "number") {
|
|
38867
|
+
console.warn("Unsupported option type:", optionType);
|
|
38868
|
+
}
|
|
38869
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38870
|
+
className: classNames(itemClassPrefix, _define_property({}, "".concat(itemClassPrefix, "-active"), index2 === value3)),
|
|
38871
|
+
key: option.toString(),
|
|
38872
|
+
onClick: function() {
|
|
38873
|
+
setValue(index2);
|
|
38874
|
+
}
|
|
38875
|
+
}, option);
|
|
38876
|
+
}
|
|
38877
|
+
}
|
|
38878
|
+
});
|
|
38879
|
+
}, [
|
|
38880
|
+
value2
|
|
38881
|
+
]);
|
|
38882
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
38883
|
+
className: classNames(classPrefix2),
|
|
38884
|
+
style: mergedProps.style
|
|
38885
|
+
}, renderItems(options, value2));
|
|
38886
|
+
};
|
|
38951
38887
|
var DataContext = React.createContext({});
|
|
38952
38888
|
var defaultProps$d = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
38953
38889
|
title: "",
|
|
@@ -39757,215 +39693,839 @@
|
|
|
39757
39693
|
};
|
|
39758
39694
|
VirtualList.displayName = "NutVirtualList";
|
|
39759
39695
|
var defaultProps$6 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
39760
|
-
|
|
39761
|
-
|
|
39762
|
-
|
|
39763
|
-
|
|
39764
|
-
|
|
39765
|
-
|
|
39696
|
+
maxZoom: 3,
|
|
39697
|
+
space: 10,
|
|
39698
|
+
toolbar: [
|
|
39699
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39700
|
+
type: "danger",
|
|
39701
|
+
key: "cancel"
|
|
39702
|
+
}, "Cancel"),
|
|
39703
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39704
|
+
key: "reset"
|
|
39705
|
+
}, "Reset"),
|
|
39706
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39707
|
+
key: "rotate"
|
|
39708
|
+
}, "Rotate"),
|
|
39709
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39710
|
+
type: "success",
|
|
39711
|
+
key: "confirm"
|
|
39712
|
+
}, "Confirm")
|
|
39713
|
+
],
|
|
39714
|
+
toolbarPosition: "bottom",
|
|
39715
|
+
editText: "Edit",
|
|
39716
|
+
sizeType: [
|
|
39717
|
+
"original",
|
|
39718
|
+
"compressed"
|
|
39719
|
+
],
|
|
39720
|
+
sourceType: [
|
|
39721
|
+
"album",
|
|
39722
|
+
"camera"
|
|
39723
|
+
],
|
|
39724
|
+
shape: "square"
|
|
39766
39725
|
});
|
|
39767
|
-
var classPrefix$1 = "nut-
|
|
39768
|
-
var
|
|
39769
|
-
var
|
|
39726
|
+
var classPrefix$1 = "nut-avatar-cropper";
|
|
39727
|
+
var AvatarCropper = function(props) {
|
|
39728
|
+
var locale = useConfig().locale;
|
|
39729
|
+
defaultProps$6.toolbar = [
|
|
39730
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39731
|
+
type: "danger",
|
|
39732
|
+
key: "cancel"
|
|
39733
|
+
}, locale.cancel),
|
|
39734
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39735
|
+
key: "reset"
|
|
39736
|
+
}, locale.reset),
|
|
39737
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39738
|
+
key: "rotate"
|
|
39739
|
+
}, locale.avatarCropper.rotate),
|
|
39740
|
+
/* @__PURE__ */ React.createElement(Button, {
|
|
39741
|
+
type: "success",
|
|
39742
|
+
key: "confirm"
|
|
39743
|
+
}, locale.confirm)
|
|
39744
|
+
];
|
|
39745
|
+
defaultProps$6.editText = locale.edit;
|
|
39746
|
+
var _ref = _object_spread({}, defaultProps$6, props), children = _ref.children, toolbar = _ref.toolbar, maxZoom = _ref.maxZoom, space = _ref.space, toolbarPosition = _ref.toolbarPosition, editText = _ref.editText, sizeType = _ref.sizeType, sourceType = _ref.sourceType, shape = _ref.shape, className = _ref.className, style = _ref.style, onConfirm = _ref.onConfirm, onCancel = _ref.onCancel, rest = _object_without_properties(_ref, [
|
|
39747
|
+
"children",
|
|
39748
|
+
"toolbar",
|
|
39749
|
+
"maxZoom",
|
|
39750
|
+
"space",
|
|
39751
|
+
"toolbarPosition",
|
|
39752
|
+
"editText",
|
|
39753
|
+
"sizeType",
|
|
39754
|
+
"sourceType",
|
|
39755
|
+
"shape",
|
|
39770
39756
|
"className",
|
|
39771
|
-
"
|
|
39772
|
-
"
|
|
39773
|
-
"
|
|
39774
|
-
"duration",
|
|
39775
|
-
"rows",
|
|
39776
|
-
"gapY"
|
|
39757
|
+
"style",
|
|
39758
|
+
"onConfirm",
|
|
39759
|
+
"onCancel"
|
|
39777
39760
|
]);
|
|
39778
|
-
var
|
|
39779
|
-
var
|
|
39780
|
-
var
|
|
39781
|
-
var
|
|
39782
|
-
var
|
|
39783
|
-
var
|
|
39784
|
-
var
|
|
39785
|
-
|
|
39786
|
-
|
|
39787
|
-
|
|
39761
|
+
var cls = classNames(classPrefix$1, "taro", className, shape === "round" && "round");
|
|
39762
|
+
var toolbarPositionCls = classNames("".concat(classPrefix$1, "-popup-toolbar"), toolbarPosition);
|
|
39763
|
+
var _useState = _sliced_to_array(React.useState(false), 2), visible = _useState[0], setVisible = _useState[1];
|
|
39764
|
+
var _useState1 = _sliced_to_array(React.useState(false), 2), moving = _useState1[0], setMoving = _useState1[1];
|
|
39765
|
+
var _useState2 = _sliced_to_array(React.useState(false), 2), zooming = _useState2[0], setZooming = _useState2[1];
|
|
39766
|
+
var systemInfo = getWindowInfo();
|
|
39767
|
+
var showAlipayCanvas2D = React.useMemo(function() {
|
|
39768
|
+
return Taro.getEnv() === "ALIPAY" && parseInt(Taro.SDKVersion.replace(/\./g, "")) >= 270;
|
|
39769
|
+
}, []);
|
|
39770
|
+
var showPixelRatio = Taro.getEnv() === "WEB" || showAlipayCanvas2D;
|
|
39771
|
+
var pixelRatio = showPixelRatio ? systemInfo.pixelRatio : 1;
|
|
39772
|
+
var _useState3 = _sliced_to_array(React.useState({
|
|
39773
|
+
defScale: 1,
|
|
39774
|
+
scale: 1,
|
|
39775
|
+
angle: 0,
|
|
39776
|
+
moveX: 0,
|
|
39777
|
+
moveY: 0,
|
|
39778
|
+
displayWidth: systemInfo.windowWidth * pixelRatio,
|
|
39779
|
+
displayHeight: systemInfo.windowHeight * pixelRatio,
|
|
39780
|
+
cropperWidth: systemInfo.windowWidth * pixelRatio - space * pixelRatio * 2,
|
|
39781
|
+
cropperHeight: systemInfo.windowWidth * pixelRatio - space * pixelRatio * 2
|
|
39782
|
+
}), 2), state = _useState3[0], setState = _useState3[1];
|
|
39783
|
+
var defDrawImage = {
|
|
39784
|
+
src: "",
|
|
39785
|
+
x: 0,
|
|
39786
|
+
y: 0,
|
|
39787
|
+
width: 0,
|
|
39788
|
+
height: 0
|
|
39789
|
+
};
|
|
39790
|
+
var _useState4 = _sliced_to_array(React.useState(_object_spread({}, defDrawImage)), 2), drawImage = _useState4[0], setDrawImg = _useState4[1];
|
|
39791
|
+
var _useState5 = _sliced_to_array(React.useState({
|
|
39792
|
+
canvasId: "canvas-".concat(Date.now()),
|
|
39793
|
+
cropperCanvas: null,
|
|
39794
|
+
cropperCanvasContext: null
|
|
39795
|
+
}), 2), canvasAll = _useState5[0], setCanvasAll = _useState5[1];
|
|
39796
|
+
Taro.useReady(function() {
|
|
39797
|
+
if (showAlipayCanvas2D) {
|
|
39798
|
+
var canvasId = canvasAll.canvasId;
|
|
39799
|
+
Taro.createSelectorQuery().select("#".concat(canvasId)).node(function(param) {
|
|
39800
|
+
var canvas = param.node;
|
|
39801
|
+
canvas.width = state.displayWidth;
|
|
39802
|
+
canvas.height = state.displayHeight;
|
|
39803
|
+
setCanvasAll(_object_spread_props(_object_spread({}, canvasAll), {
|
|
39804
|
+
cropperCanvas: canvas
|
|
39805
|
+
}));
|
|
39806
|
+
}).exec();
|
|
39807
|
+
}
|
|
39808
|
+
});
|
|
39809
|
+
React.useEffect(function() {
|
|
39810
|
+
setCanvasAll(_object_spread_props(_object_spread({}, canvasAll), {
|
|
39811
|
+
cropperCanvasContext: Taro.createCanvasContext(canvasAll.canvasId)
|
|
39812
|
+
}));
|
|
39813
|
+
}, []);
|
|
39814
|
+
var touch = useTouch();
|
|
39815
|
+
var highlightStyle = React.useMemo(function() {
|
|
39816
|
+
var width2 = "".concat(state.cropperWidth / pixelRatio, "px");
|
|
39817
|
+
var height2 = width2;
|
|
39788
39818
|
return {
|
|
39789
|
-
|
|
39790
|
-
|
|
39791
|
-
|
|
39792
|
-
list.splice(list.length, 0, word);
|
|
39793
|
-
} else {
|
|
39794
|
-
list.splice(_index, 0, word);
|
|
39795
|
-
}
|
|
39796
|
-
}
|
|
39819
|
+
width: width2,
|
|
39820
|
+
height: height2,
|
|
39821
|
+
borderRadius: shape === "round" ? "50%" : ""
|
|
39797
39822
|
};
|
|
39798
|
-
}
|
|
39799
|
-
|
|
39800
|
-
|
|
39801
|
-
|
|
39802
|
-
|
|
39803
|
-
|
|
39804
|
-
|
|
39805
|
-
|
|
39806
|
-
|
|
39807
|
-
|
|
39808
|
-
|
|
39809
|
-
|
|
39810
|
-
|
|
39811
|
-
return [
|
|
39812
|
-
4,
|
|
39813
|
-
getRectByTaro(node)
|
|
39814
|
-
];
|
|
39815
|
-
case 1:
|
|
39816
|
-
refe = _state.sent();
|
|
39817
|
-
return [
|
|
39818
|
-
2,
|
|
39819
|
-
Math.ceil(type2 === "height" ? refe.height : refe.width)
|
|
39820
|
-
];
|
|
39821
|
-
case 2:
|
|
39822
|
-
return [
|
|
39823
|
-
2,
|
|
39824
|
-
0
|
|
39825
|
-
];
|
|
39826
|
-
}
|
|
39827
|
-
});
|
|
39828
|
-
});
|
|
39829
|
-
return function getNodeWidth2(node) {
|
|
39830
|
-
return _ref2.apply(this, arguments);
|
|
39823
|
+
}, [
|
|
39824
|
+
pixelRatio,
|
|
39825
|
+
state.cropperWidth
|
|
39826
|
+
]);
|
|
39827
|
+
var isAngle = React.useMemo(function() {
|
|
39828
|
+
return state.angle === 90 || state.angle === 270;
|
|
39829
|
+
}, [
|
|
39830
|
+
state.angle
|
|
39831
|
+
]);
|
|
39832
|
+
var canvasStyle = React.useMemo(function() {
|
|
39833
|
+
return {
|
|
39834
|
+
width: "".concat(state.displayWidth / pixelRatio, "px"),
|
|
39835
|
+
height: "".concat(state.displayHeight / pixelRatio, "px")
|
|
39831
39836
|
};
|
|
39832
|
-
}
|
|
39833
|
-
|
|
39834
|
-
|
|
39835
|
-
|
|
39836
|
-
|
|
39837
|
+
}, [
|
|
39838
|
+
pixelRatio,
|
|
39839
|
+
state.displayHeight,
|
|
39840
|
+
state.displayWidth
|
|
39841
|
+
]);
|
|
39842
|
+
var maxMoveX = React.useMemo(function() {
|
|
39843
|
+
var displayWidth = state.displayWidth, scale2 = state.scale, cropperWidth = state.cropperWidth;
|
|
39844
|
+
if (isAngle) {
|
|
39845
|
+
return Math.max(0, (drawImage.height * scale2 - cropperWidth) / 2);
|
|
39846
|
+
}
|
|
39847
|
+
return Math.max(0, (displayWidth * scale2 - cropperWidth) / 2);
|
|
39848
|
+
}, [
|
|
39849
|
+
drawImage.height,
|
|
39850
|
+
isAngle,
|
|
39851
|
+
state
|
|
39852
|
+
]);
|
|
39853
|
+
var maxMoveY = React.useMemo(function() {
|
|
39854
|
+
var displayWidth = state.displayWidth, scale2 = state.scale, cropperWidth = state.cropperWidth;
|
|
39855
|
+
if (isAngle) {
|
|
39856
|
+
return Math.max(0, (displayWidth * scale2 - cropperWidth) / 2);
|
|
39837
39857
|
}
|
|
39858
|
+
return Math.max(0, (drawImage.height * scale2 - cropperWidth) / 2);
|
|
39859
|
+
}, [
|
|
39860
|
+
drawImage.height,
|
|
39861
|
+
isAngle,
|
|
39862
|
+
state
|
|
39863
|
+
]);
|
|
39864
|
+
var dataURLToImage = function(dataURL) {
|
|
39865
|
+
return new Promise(function(resolve) {
|
|
39866
|
+
var img = new Image();
|
|
39867
|
+
img.onload = function() {
|
|
39868
|
+
return resolve(img);
|
|
39869
|
+
};
|
|
39870
|
+
img.src = dataURL;
|
|
39871
|
+
});
|
|
39838
39872
|
};
|
|
39839
|
-
|
|
39840
|
-
|
|
39841
|
-
var
|
|
39842
|
-
|
|
39843
|
-
return
|
|
39844
|
-
switch (_state.label) {
|
|
39845
|
-
case 0:
|
|
39846
|
-
if (!barrageBody.current) return [
|
|
39847
|
-
3,
|
|
39848
|
-
2
|
|
39849
|
-
];
|
|
39850
|
-
return [
|
|
39851
|
-
4,
|
|
39852
|
-
getNodeWidth(barrageBody.current)
|
|
39853
|
-
];
|
|
39854
|
-
case 1:
|
|
39855
|
-
barrageCWidth.current = _state.sent();
|
|
39856
|
-
(_barrageBody_current = barrageBody.current) === null || _barrageBody_current === void 0 ? void 0 : _barrageBody_current.style.setProperty("--move-distance", "-".concat(barrageCWidth.current, "px"));
|
|
39857
|
-
index2.current = 0;
|
|
39858
|
-
run();
|
|
39859
|
-
_state.label = 2;
|
|
39860
|
-
case 2:
|
|
39861
|
-
return [
|
|
39862
|
-
2
|
|
39863
|
-
];
|
|
39864
|
-
}
|
|
39865
|
-
});
|
|
39866
|
-
});
|
|
39867
|
-
return function init2() {
|
|
39868
|
-
return _ref2.apply(this, arguments);
|
|
39873
|
+
var dataURLToCanvasImage = function(canvas, dataURL) {
|
|
39874
|
+
return new Promise(function(resolve) {
|
|
39875
|
+
var img = canvas.createImage();
|
|
39876
|
+
img.onload = function() {
|
|
39877
|
+
return resolve(img);
|
|
39869
39878
|
};
|
|
39870
|
-
|
|
39871
|
-
|
|
39872
|
-
|
|
39873
|
-
|
|
39874
|
-
|
|
39875
|
-
|
|
39876
|
-
|
|
39879
|
+
img.src = dataURL;
|
|
39880
|
+
});
|
|
39881
|
+
};
|
|
39882
|
+
var canvas2dDraw = React.useCallback(function(ctx) {
|
|
39883
|
+
var src = drawImage.src, width2 = drawImage.width, height2 = drawImage.height, x2 = drawImage.x, y = drawImage.y;
|
|
39884
|
+
if (!ctx || !src) return;
|
|
39885
|
+
var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight, cropperWidth = state.cropperWidth;
|
|
39886
|
+
ctx.clearRect(0, 0, displayWidth, displayHeight);
|
|
39887
|
+
ctx.fillStyle = "#666";
|
|
39888
|
+
ctx.fillRect(0, 0, displayWidth, displayHeight);
|
|
39889
|
+
ctx.fillStyle = "#000";
|
|
39890
|
+
ctx.fillRect(space * pixelRatio, (displayHeight - cropperWidth) / 2, cropperWidth, cropperWidth);
|
|
39891
|
+
ctx.translate(displayWidth / 2 + moveX, displayHeight / 2 + moveY);
|
|
39892
|
+
ctx.rotate(Math.PI / 180 * angle);
|
|
39893
|
+
ctx.scale(scale2, scale2);
|
|
39894
|
+
ctx.drawImage(src, x2, y, width2, height2);
|
|
39877
39895
|
}, [
|
|
39878
|
-
|
|
39896
|
+
drawImage,
|
|
39897
|
+
state
|
|
39879
39898
|
]);
|
|
39880
|
-
var
|
|
39881
|
-
|
|
39882
|
-
var
|
|
39883
|
-
|
|
39884
|
-
|
|
39885
|
-
if (result > 0) {
|
|
39886
|
-
intervalCache += result;
|
|
39899
|
+
var webDraw = React.useCallback(function() {
|
|
39900
|
+
var canvasDom = document.getElementById(canvasAll.canvasId);
|
|
39901
|
+
var canvas = canvasDom;
|
|
39902
|
+
if ((canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
39903
|
+
canvas = canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.getElementsByTagName("canvas")[0];
|
|
39887
39904
|
}
|
|
39888
|
-
|
|
39889
|
-
|
|
39890
|
-
|
|
39891
|
-
|
|
39892
|
-
|
|
39893
|
-
|
|
39894
|
-
|
|
39905
|
+
if (!canvas) return;
|
|
39906
|
+
canvas.width = state.displayWidth;
|
|
39907
|
+
canvas.height = state.displayHeight;
|
|
39908
|
+
var ctx = canvas.getContext("2d");
|
|
39909
|
+
canvas2dDraw(ctx);
|
|
39910
|
+
}, [
|
|
39911
|
+
canvas2dDraw
|
|
39912
|
+
]);
|
|
39913
|
+
var alipayDraw = React.useCallback(function() {
|
|
39914
|
+
var ctx = canvasAll.cropperCanvas.getContext("2d");
|
|
39915
|
+
ctx && ctx.resetTransform();
|
|
39916
|
+
canvas2dDraw(ctx);
|
|
39917
|
+
}, [
|
|
39918
|
+
canvas2dDraw,
|
|
39919
|
+
canvasAll.cropperCanvas
|
|
39920
|
+
]);
|
|
39921
|
+
var draw = React.useCallback(function() {
|
|
39922
|
+
if (Taro.getEnv() === "WEB") {
|
|
39923
|
+
webDraw();
|
|
39924
|
+
return;
|
|
39925
|
+
}
|
|
39926
|
+
if (showAlipayCanvas2D) {
|
|
39927
|
+
alipayDraw();
|
|
39928
|
+
return;
|
|
39929
|
+
}
|
|
39930
|
+
var src = drawImage.src, width2 = drawImage.width, height2 = drawImage.height, x2 = drawImage.x, y = drawImage.y;
|
|
39931
|
+
var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight, cropperWidth = state.cropperWidth;
|
|
39932
|
+
var cropperCanvasContext = canvasAll.cropperCanvasContext;
|
|
39933
|
+
var ctx = cropperCanvasContext;
|
|
39934
|
+
if (!ctx) return;
|
|
39935
|
+
ctx.clearRect(0, 0, displayWidth, displayHeight);
|
|
39936
|
+
ctx.fillStyle = "#666";
|
|
39937
|
+
ctx.setFillStyle("#666");
|
|
39938
|
+
ctx.fillRect(0, 0, displayWidth, displayHeight);
|
|
39939
|
+
ctx.stroke();
|
|
39940
|
+
ctx.fill();
|
|
39941
|
+
ctx.fillStyle = "#000";
|
|
39942
|
+
ctx.setFillStyle("#000");
|
|
39943
|
+
ctx.fillRect(space, (displayHeight - cropperWidth) / 2, cropperWidth, cropperWidth);
|
|
39944
|
+
ctx.stroke();
|
|
39945
|
+
ctx.fill();
|
|
39946
|
+
ctx.translate(displayWidth / 2 + moveX, displayHeight / 2 + moveY);
|
|
39947
|
+
ctx.rotate(Math.PI / 180 * angle);
|
|
39948
|
+
ctx.scale(scale2, scale2);
|
|
39949
|
+
ctx.drawImage(src, x2, y, width2, height2);
|
|
39950
|
+
ctx.draw();
|
|
39951
|
+
}, [
|
|
39952
|
+
drawImage,
|
|
39953
|
+
state.scale,
|
|
39954
|
+
state.angle,
|
|
39955
|
+
state.moveX,
|
|
39956
|
+
state.moveY
|
|
39957
|
+
]);
|
|
39958
|
+
React.useEffect(function() {
|
|
39959
|
+
if (Math.abs(state.moveX) > maxMoveX) {
|
|
39960
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
39961
|
+
moveX: maxMoveX
|
|
39962
|
+
}));
|
|
39963
|
+
}
|
|
39964
|
+
if (Math.abs(state.moveY) > maxMoveY) {
|
|
39965
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
39966
|
+
moveY: maxMoveY
|
|
39967
|
+
}));
|
|
39968
|
+
}
|
|
39969
|
+
draw();
|
|
39970
|
+
}, [
|
|
39971
|
+
state,
|
|
39972
|
+
maxMoveX,
|
|
39973
|
+
maxMoveY,
|
|
39974
|
+
draw
|
|
39975
|
+
]);
|
|
39976
|
+
var setDrawImgInfo = /* @__PURE__ */ function() {
|
|
39977
|
+
var _ref2 = _async_to_generator(function(image) {
|
|
39978
|
+
var displayWidth, cropperWidth, copyDrawImg, imgWidth, imgHeight, isPortrait, rate, scale2;
|
|
39895
39979
|
return __generator(this, function(_state) {
|
|
39896
39980
|
switch (_state.label) {
|
|
39897
39981
|
case 0:
|
|
39898
|
-
|
|
39899
|
-
|
|
39900
|
-
|
|
39901
|
-
|
|
39902
|
-
|
|
39903
|
-
]);
|
|
39904
|
-
if (!el) return [
|
|
39982
|
+
displayWidth = state.displayWidth, cropperWidth = state.cropperWidth;
|
|
39983
|
+
copyDrawImg = _object_spread({}, defDrawImage);
|
|
39984
|
+
imgWidth = image.width, imgHeight = image.height;
|
|
39985
|
+
copyDrawImg.src = image.path;
|
|
39986
|
+
if (!(Taro.getEnv() === "WEB")) return [
|
|
39905
39987
|
3,
|
|
39906
39988
|
2
|
|
39907
39989
|
];
|
|
39908
39990
|
return [
|
|
39909
39991
|
4,
|
|
39910
|
-
|
|
39992
|
+
dataURLToImage(image.path)
|
|
39911
39993
|
];
|
|
39912
39994
|
case 1:
|
|
39913
|
-
|
|
39914
|
-
width2 = refe.width;
|
|
39915
|
-
height2 = refe.height;
|
|
39916
|
-
el.classList.add("move");
|
|
39917
|
-
elScrollDuration = Math.round(width2 / barrageCWidth.current * duration);
|
|
39918
|
-
times.current[currentIndex] = elScrollDuration;
|
|
39919
|
-
el.style.animationDuration = "".concat(duration + elScrollDuration, "ms");
|
|
39920
|
-
el.style.top = "".concat(currentIndex * (height2 + gapY) + 20, "px");
|
|
39921
|
-
el.style.width = "".concat(width2, "px");
|
|
39995
|
+
copyDrawImg.src = _state.sent();
|
|
39922
39996
|
_state.label = 2;
|
|
39923
39997
|
case 2:
|
|
39924
|
-
return [
|
|
39998
|
+
if (!showAlipayCanvas2D) return [
|
|
39925
39999
|
3,
|
|
39926
40000
|
4
|
|
39927
40001
|
];
|
|
39928
|
-
case 3:
|
|
39929
|
-
error = _state.sent();
|
|
39930
|
-
console.log("异常自动流转到下一个", error);
|
|
39931
|
-
barrageContainer.current.removeChild(el);
|
|
39932
40002
|
return [
|
|
39933
|
-
|
|
39934
|
-
|
|
40003
|
+
4,
|
|
40004
|
+
dataURLToCanvasImage(canvasAll.cropperCanvas, image.path)
|
|
39935
40005
|
];
|
|
40006
|
+
case 3:
|
|
40007
|
+
copyDrawImg.src = _state.sent();
|
|
40008
|
+
_state.label = 4;
|
|
39936
40009
|
case 4:
|
|
39937
|
-
|
|
39938
|
-
|
|
39939
|
-
|
|
40010
|
+
isPortrait = imgHeight > imgWidth;
|
|
40011
|
+
rate = isPortrait ? imgWidth / imgHeight : imgHeight / imgWidth;
|
|
40012
|
+
copyDrawImg.width = displayWidth;
|
|
40013
|
+
copyDrawImg.height = isPortrait ? displayWidth / rate : displayWidth * rate;
|
|
40014
|
+
copyDrawImg.x = -copyDrawImg.width / 2;
|
|
40015
|
+
copyDrawImg.y = -copyDrawImg.height / 2;
|
|
40016
|
+
setDrawImg(copyDrawImg);
|
|
40017
|
+
scale2 = cropperWidth / (isPortrait ? copyDrawImg.width : copyDrawImg.height);
|
|
40018
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40019
|
+
defScale: scale2
|
|
40020
|
+
}));
|
|
40021
|
+
resetScale(scale2);
|
|
39940
40022
|
return [
|
|
39941
40023
|
2
|
|
39942
40024
|
];
|
|
39943
40025
|
}
|
|
39944
40026
|
});
|
|
39945
40027
|
});
|
|
39946
|
-
return function
|
|
40028
|
+
return function setDrawImgInfo2(image) {
|
|
39947
40029
|
return _ref2.apply(this, arguments);
|
|
39948
40030
|
};
|
|
39949
40031
|
}();
|
|
39950
|
-
var
|
|
39951
|
-
|
|
39952
|
-
|
|
39953
|
-
|
|
39954
|
-
|
|
39955
|
-
|
|
39956
|
-
|
|
39957
|
-
|
|
39958
|
-
|
|
39959
|
-
|
|
39960
|
-
|
|
39961
|
-
|
|
39962
|
-
|
|
39963
|
-
|
|
39964
|
-
|
|
39965
|
-
|
|
39966
|
-
|
|
39967
|
-
|
|
39968
|
-
|
|
40032
|
+
var chooseImage = function() {
|
|
40033
|
+
Taro.chooseImage({
|
|
40034
|
+
count: 1,
|
|
40035
|
+
// 可以指定是原图还是压缩图,默认二者都有
|
|
40036
|
+
sizeType,
|
|
40037
|
+
sourceType,
|
|
40038
|
+
success: function(res) {
|
|
40039
|
+
var tempFiles = res.tempFiles;
|
|
40040
|
+
!!tempFiles.length && imageChange(tempFiles[0]);
|
|
40041
|
+
}
|
|
40042
|
+
});
|
|
40043
|
+
};
|
|
40044
|
+
var imageChange = /* @__PURE__ */ function() {
|
|
40045
|
+
var _ref2 = _async_to_generator(function(file) {
|
|
40046
|
+
return __generator(this, function(_state) {
|
|
40047
|
+
Taro.getImageInfo({
|
|
40048
|
+
src: file.path
|
|
40049
|
+
}).then(function(res) {
|
|
40050
|
+
setVisible(true);
|
|
40051
|
+
setDrawImgInfo(res);
|
|
40052
|
+
});
|
|
40053
|
+
return [
|
|
40054
|
+
2
|
|
40055
|
+
];
|
|
40056
|
+
});
|
|
40057
|
+
});
|
|
40058
|
+
return function imageChange2(file) {
|
|
40059
|
+
return _ref2.apply(this, arguments);
|
|
40060
|
+
};
|
|
40061
|
+
}();
|
|
40062
|
+
var resetScale = function(scale2) {
|
|
40063
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40064
|
+
moveX: 0,
|
|
40065
|
+
moveY: 0,
|
|
40066
|
+
angle: 0,
|
|
40067
|
+
scale: scale2 || state.defScale,
|
|
40068
|
+
defScale: scale2 || state.defScale
|
|
40069
|
+
}));
|
|
40070
|
+
};
|
|
40071
|
+
var setScale = function(scale2) {
|
|
40072
|
+
scale2 = clamp(scale2, 0.3, +maxZoom + 1);
|
|
40073
|
+
if (scale2 !== state.scale) {
|
|
40074
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40075
|
+
scale: scale2
|
|
40076
|
+
}));
|
|
40077
|
+
}
|
|
40078
|
+
};
|
|
40079
|
+
var getDistance = function(touches) {
|
|
40080
|
+
return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
|
|
40081
|
+
};
|
|
40082
|
+
var _useState6 = _sliced_to_array(React.useState({
|
|
40083
|
+
startMoveX: 0,
|
|
40084
|
+
startMoveY: 0,
|
|
40085
|
+
startScale: 0,
|
|
40086
|
+
startDistance: 0
|
|
40087
|
+
}), 2), startMove = _useState6[0], setStartMove = _useState6[1];
|
|
40088
|
+
var startMoveX = startMove.startMoveX, startMoveY = startMove.startMoveY, startScale = startMove.startScale, startDistance = startMove.startDistance;
|
|
40089
|
+
var onTouchStart = function(event) {
|
|
40090
|
+
var touches = event.touches;
|
|
40091
|
+
var offsetX = touch.offsetX;
|
|
40092
|
+
touch.start(event);
|
|
40093
|
+
var fingerNum = touches === null || touches === void 0 ? void 0 : touches.length;
|
|
40094
|
+
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40095
|
+
startMoveX: state.moveX,
|
|
40096
|
+
startMoveY: state.moveY
|
|
40097
|
+
}));
|
|
40098
|
+
setMoving(fingerNum === 1);
|
|
40099
|
+
setZooming(fingerNum === 2 && !offsetX.current);
|
|
40100
|
+
if (fingerNum === 2 && !offsetX.current) {
|
|
40101
|
+
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40102
|
+
startScale: state.scale,
|
|
40103
|
+
startDistance: getDistance(event.touches)
|
|
40104
|
+
}));
|
|
40105
|
+
}
|
|
40106
|
+
};
|
|
40107
|
+
var onTouchMove = function(event) {
|
|
40108
|
+
var touches = event.touches;
|
|
40109
|
+
touch.move(event);
|
|
40110
|
+
if (moving || zooming) {
|
|
40111
|
+
preventDefault$1(event, true);
|
|
40112
|
+
}
|
|
40113
|
+
if (moving) {
|
|
40114
|
+
var deltaX = touch.deltaX, deltaY = touch.deltaY;
|
|
40115
|
+
var moveX = deltaX.current * state.scale + startMoveX;
|
|
40116
|
+
var moveY = deltaY.current * state.scale + startMoveY;
|
|
40117
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40118
|
+
moveX: clamp(moveX, -maxMoveX, maxMoveX),
|
|
40119
|
+
moveY: clamp(moveY, -maxMoveY, maxMoveY)
|
|
40120
|
+
}));
|
|
40121
|
+
}
|
|
40122
|
+
if (zooming && touches.length === 2) {
|
|
40123
|
+
var distance = getDistance(touches);
|
|
40124
|
+
var scale2 = startScale * distance / startDistance;
|
|
40125
|
+
setScale(scale2);
|
|
40126
|
+
}
|
|
40127
|
+
};
|
|
40128
|
+
var onTouchEnd = function(event) {
|
|
40129
|
+
var stopPropagation = false;
|
|
40130
|
+
if (moving || zooming) {
|
|
40131
|
+
stopPropagation = !(moving && startMoveX === state.moveX && startMoveY === state.moveY);
|
|
40132
|
+
if (!event.touches.length) {
|
|
40133
|
+
if (zooming) {
|
|
40134
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40135
|
+
moveX: clamp(state.moveX, -maxMoveX, maxMoveX),
|
|
40136
|
+
moveY: clamp(state.moveY, -maxMoveY, maxMoveY)
|
|
40137
|
+
}));
|
|
40138
|
+
setZooming(false);
|
|
40139
|
+
}
|
|
40140
|
+
setMoving(false);
|
|
40141
|
+
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40142
|
+
startMoveX: 0,
|
|
40143
|
+
startMoveY: 0,
|
|
40144
|
+
startScale: state.defScale
|
|
40145
|
+
}));
|
|
40146
|
+
if (state.scale < state.defScale) {
|
|
40147
|
+
resetScale();
|
|
40148
|
+
}
|
|
40149
|
+
if (state.scale > maxZoom) {
|
|
40150
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40151
|
+
scale: +maxZoom
|
|
40152
|
+
}));
|
|
40153
|
+
}
|
|
40154
|
+
}
|
|
40155
|
+
}
|
|
40156
|
+
preventDefault$1(event, stopPropagation);
|
|
40157
|
+
touch.reset();
|
|
40158
|
+
};
|
|
40159
|
+
var reset = function() {
|
|
40160
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40161
|
+
angle: 0
|
|
40162
|
+
}));
|
|
40163
|
+
};
|
|
40164
|
+
var rotate = function() {
|
|
40165
|
+
if (state.angle === 270) {
|
|
40166
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40167
|
+
angle: 0
|
|
40168
|
+
}));
|
|
40169
|
+
return;
|
|
40170
|
+
}
|
|
40171
|
+
setState(_object_spread_props(_object_spread({}, state), {
|
|
40172
|
+
angle: state.angle + 90
|
|
40173
|
+
}));
|
|
40174
|
+
};
|
|
40175
|
+
var cancel = function() {
|
|
40176
|
+
var isEmit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
40177
|
+
setVisible(false);
|
|
40178
|
+
resetScale();
|
|
40179
|
+
isEmit && onCancel && onCancel();
|
|
40180
|
+
};
|
|
40181
|
+
var confirmWEB = function() {
|
|
40182
|
+
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40183
|
+
var canvasDom = document.getElementById(canvasAll.canvasId);
|
|
40184
|
+
var canvas = canvasDom;
|
|
40185
|
+
if ((canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
40186
|
+
canvas = canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.getElementsByTagName("canvas")[0];
|
|
40187
|
+
}
|
|
40188
|
+
var width2 = cropperWidth;
|
|
40189
|
+
var height2 = cropperWidth;
|
|
40190
|
+
var croppedCanvas = document.createElement("canvas");
|
|
40191
|
+
var croppedCtx = croppedCanvas.getContext("2d");
|
|
40192
|
+
croppedCanvas.width = width2;
|
|
40193
|
+
croppedCanvas.height = height2;
|
|
40194
|
+
canvas && croppedCtx.drawImage(canvas, space * pixelRatio, (displayHeight - cropperWidth) / 2, width2, height2, 0, 0, width2, height2);
|
|
40195
|
+
var imageDataURL = croppedCanvas.toDataURL("image/png");
|
|
40196
|
+
onConfirm && onConfirm(imageDataURL);
|
|
40197
|
+
cancel(false);
|
|
40198
|
+
};
|
|
40199
|
+
var confirmALIPAY = function() {
|
|
40200
|
+
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40201
|
+
var cropperCanvas = canvasAll.cropperCanvas;
|
|
40202
|
+
Taro.canvasToTempFilePath({
|
|
40203
|
+
canvas: cropperCanvas,
|
|
40204
|
+
x: props.space,
|
|
40205
|
+
y: (displayHeight - cropperWidth) / 2,
|
|
40206
|
+
width: cropperWidth,
|
|
40207
|
+
height: cropperWidth,
|
|
40208
|
+
destWidth: cropperWidth,
|
|
40209
|
+
destHeight: cropperWidth,
|
|
40210
|
+
success: /* @__PURE__ */ function() {
|
|
40211
|
+
var _ref2 = _async_to_generator(function(res) {
|
|
40212
|
+
var filePath;
|
|
40213
|
+
return __generator(this, function(_state) {
|
|
40214
|
+
filePath = res.tempFilePath;
|
|
40215
|
+
onConfirm && onConfirm(filePath);
|
|
40216
|
+
cancel(false);
|
|
40217
|
+
return [
|
|
40218
|
+
2
|
|
40219
|
+
];
|
|
40220
|
+
});
|
|
40221
|
+
});
|
|
40222
|
+
return function(res) {
|
|
40223
|
+
return _ref2.apply(this, arguments);
|
|
40224
|
+
};
|
|
40225
|
+
}()
|
|
40226
|
+
});
|
|
40227
|
+
};
|
|
40228
|
+
var confirm = function() {
|
|
40229
|
+
if (Taro.getEnv() === "WEB") {
|
|
40230
|
+
confirmWEB();
|
|
40231
|
+
return;
|
|
40232
|
+
}
|
|
40233
|
+
if (showAlipayCanvas2D) {
|
|
40234
|
+
confirmALIPAY();
|
|
40235
|
+
return;
|
|
40236
|
+
}
|
|
40237
|
+
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40238
|
+
var canvasId = canvasAll.canvasId;
|
|
40239
|
+
Taro.canvasToTempFilePath({
|
|
40240
|
+
canvasId,
|
|
40241
|
+
x: props.space,
|
|
40242
|
+
y: (displayHeight - cropperWidth) / 2,
|
|
40243
|
+
width: cropperWidth,
|
|
40244
|
+
height: cropperWidth,
|
|
40245
|
+
destWidth: cropperWidth * systemInfo.pixelRatio,
|
|
40246
|
+
destHeight: cropperWidth * systemInfo.pixelRatio,
|
|
40247
|
+
success: /* @__PURE__ */ function() {
|
|
40248
|
+
var _ref2 = _async_to_generator(function(res) {
|
|
40249
|
+
var filePath;
|
|
40250
|
+
return __generator(this, function(_state) {
|
|
40251
|
+
filePath = res.tempFilePath;
|
|
40252
|
+
onConfirm && onConfirm(filePath);
|
|
40253
|
+
cancel(false);
|
|
40254
|
+
return [
|
|
40255
|
+
2
|
|
40256
|
+
];
|
|
40257
|
+
});
|
|
40258
|
+
});
|
|
40259
|
+
return function(res) {
|
|
40260
|
+
return _ref2.apply(this, arguments);
|
|
40261
|
+
};
|
|
40262
|
+
}()
|
|
40263
|
+
});
|
|
40264
|
+
};
|
|
40265
|
+
var ToolBar = function() {
|
|
40266
|
+
var actions = [
|
|
40267
|
+
cancel,
|
|
40268
|
+
reset,
|
|
40269
|
+
rotate,
|
|
40270
|
+
confirm
|
|
40271
|
+
];
|
|
40272
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40273
|
+
className: "".concat(classPrefix$1, "-popup-toolbar-flex")
|
|
40274
|
+
}, actions.map(function(action, index2) {
|
|
40275
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40276
|
+
key: index2,
|
|
40277
|
+
className: "".concat(classPrefix$1, "-popup-toolbar-item"),
|
|
40278
|
+
onClick: function(_e) {
|
|
40279
|
+
return action();
|
|
40280
|
+
}
|
|
40281
|
+
}, toolbar[index2]);
|
|
40282
|
+
}));
|
|
40283
|
+
};
|
|
40284
|
+
var CropperPopup = function() {
|
|
40285
|
+
var canvasId = canvasAll.canvasId;
|
|
40286
|
+
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40287
|
+
className: "".concat(classPrefix$1, "-popup"),
|
|
40288
|
+
style: {
|
|
40289
|
+
display: visible ? "block" : "none"
|
|
40290
|
+
}
|
|
40291
|
+
}, /* @__PURE__ */ React.createElement(components.Canvas, {
|
|
40292
|
+
id: canvasId,
|
|
40293
|
+
"canvas-id": canvasId,
|
|
40294
|
+
type: showAlipayCanvas2D ? "2d" : void 0,
|
|
40295
|
+
style: canvasStyle,
|
|
40296
|
+
className: "".concat(classPrefix$1, "-popup-canvas")
|
|
40297
|
+
}), /* @__PURE__ */ React.createElement(components.View, {
|
|
40298
|
+
className: "".concat(classPrefix$1, "-popup-highlight"),
|
|
40299
|
+
onTouchStart,
|
|
40300
|
+
onTouchMove,
|
|
40301
|
+
onTouchEnd
|
|
40302
|
+
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
40303
|
+
className: "highlight",
|
|
40304
|
+
style: highlightStyle
|
|
40305
|
+
})), /* @__PURE__ */ React.createElement(components.View, {
|
|
40306
|
+
className: toolbarPositionCls
|
|
40307
|
+
}, /* @__PURE__ */ React.createElement(ToolBar, null)));
|
|
40308
|
+
};
|
|
40309
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(components.View, _object_spread_props(_object_spread({
|
|
40310
|
+
className: cls
|
|
40311
|
+
}, rest), {
|
|
40312
|
+
style
|
|
40313
|
+
}), children, /* @__PURE__ */ React.createElement(components.View, {
|
|
40314
|
+
className: "nut-avatar-cropper-edit-text",
|
|
40315
|
+
onClick: chooseImage
|
|
40316
|
+
}, editText)), CropperPopup());
|
|
40317
|
+
};
|
|
40318
|
+
AvatarCropper.displayName = "NutAvatarCropper";
|
|
40319
|
+
var defaultProps$5 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40320
|
+
list: [],
|
|
40321
|
+
interval: 500,
|
|
40322
|
+
loop: true,
|
|
40323
|
+
duration: 3e3,
|
|
40324
|
+
rows: 3,
|
|
40325
|
+
gapY: 10
|
|
40326
|
+
});
|
|
40327
|
+
var classPrefix = "nut-barrage";
|
|
40328
|
+
var InternalBarrage = function(props, ref) {
|
|
40329
|
+
var _ref = _object_spread({}, defaultProps$5, props), className = _ref.className, interval = _ref.interval, loop = _ref.loop, list = _ref.list, duration = _ref.duration, rows = _ref.rows, gapY = _ref.gapY, restProps = _object_without_properties(_ref, [
|
|
40330
|
+
"className",
|
|
40331
|
+
"interval",
|
|
40332
|
+
"loop",
|
|
40333
|
+
"list",
|
|
40334
|
+
"duration",
|
|
40335
|
+
"rows",
|
|
40336
|
+
"gapY"
|
|
40337
|
+
]);
|
|
40338
|
+
var barrageBody = React.useRef(null);
|
|
40339
|
+
var barrageContainer = React.useRef(null);
|
|
40340
|
+
var barrageCWidth = React.useRef(0);
|
|
40341
|
+
var timer = React.useRef(0);
|
|
40342
|
+
var domTimer = React.useRef(0);
|
|
40343
|
+
var index2 = React.useRef(0);
|
|
40344
|
+
var times = React.useRef([]);
|
|
40345
|
+
var historyIndex = React.useRef(-1);
|
|
40346
|
+
var classes = classNames(classPrefix, className);
|
|
40347
|
+
React.useImperativeHandle(ref, function() {
|
|
40348
|
+
return {
|
|
40349
|
+
add: function(word) {
|
|
40350
|
+
var _index = index2.current % list.length;
|
|
40351
|
+
if (!loop && index2.current === list.length) {
|
|
40352
|
+
list.splice(list.length, 0, word);
|
|
40353
|
+
} else {
|
|
40354
|
+
list.splice(_index, 0, word);
|
|
40355
|
+
}
|
|
40356
|
+
}
|
|
40357
|
+
};
|
|
40358
|
+
});
|
|
40359
|
+
var getNodeWidth = /* @__PURE__ */ function() {
|
|
40360
|
+
var _ref2 = _async_to_generator(function(node) {
|
|
40361
|
+
var type2, refe;
|
|
40362
|
+
var _arguments = arguments;
|
|
40363
|
+
return __generator(this, function(_state) {
|
|
40364
|
+
switch (_state.label) {
|
|
40365
|
+
case 0:
|
|
40366
|
+
type2 = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : "width";
|
|
40367
|
+
if (!node) return [
|
|
40368
|
+
3,
|
|
40369
|
+
2
|
|
40370
|
+
];
|
|
40371
|
+
return [
|
|
40372
|
+
4,
|
|
40373
|
+
getRectByTaro(node)
|
|
40374
|
+
];
|
|
40375
|
+
case 1:
|
|
40376
|
+
refe = _state.sent();
|
|
40377
|
+
return [
|
|
40378
|
+
2,
|
|
40379
|
+
Math.ceil(type2 === "height" ? refe.height : refe.width)
|
|
40380
|
+
];
|
|
40381
|
+
case 2:
|
|
40382
|
+
return [
|
|
40383
|
+
2,
|
|
40384
|
+
0
|
|
40385
|
+
];
|
|
40386
|
+
}
|
|
40387
|
+
});
|
|
40388
|
+
});
|
|
40389
|
+
return function getNodeWidth2(node) {
|
|
40390
|
+
return _ref2.apply(this, arguments);
|
|
40391
|
+
};
|
|
40392
|
+
}();
|
|
40393
|
+
var clearDomTimeout = function() {
|
|
40394
|
+
if (domTimer.current) {
|
|
40395
|
+
clearTimeout(domTimer.current);
|
|
40396
|
+
domTimer.current = 0;
|
|
40397
|
+
}
|
|
40398
|
+
};
|
|
40399
|
+
React.useEffect(function() {
|
|
40400
|
+
var init = /* @__PURE__ */ function() {
|
|
40401
|
+
var _ref2 = _async_to_generator(function() {
|
|
40402
|
+
var _barrageBody_current;
|
|
40403
|
+
return __generator(this, function(_state) {
|
|
40404
|
+
switch (_state.label) {
|
|
40405
|
+
case 0:
|
|
40406
|
+
if (!barrageBody.current) return [
|
|
40407
|
+
3,
|
|
40408
|
+
2
|
|
40409
|
+
];
|
|
40410
|
+
return [
|
|
40411
|
+
4,
|
|
40412
|
+
getNodeWidth(barrageBody.current)
|
|
40413
|
+
];
|
|
40414
|
+
case 1:
|
|
40415
|
+
barrageCWidth.current = _state.sent();
|
|
40416
|
+
(_barrageBody_current = barrageBody.current) === null || _barrageBody_current === void 0 ? void 0 : _barrageBody_current.style.setProperty("--move-distance", "-".concat(barrageCWidth.current, "px"));
|
|
40417
|
+
index2.current = 0;
|
|
40418
|
+
run();
|
|
40419
|
+
_state.label = 2;
|
|
40420
|
+
case 2:
|
|
40421
|
+
return [
|
|
40422
|
+
2
|
|
40423
|
+
];
|
|
40424
|
+
}
|
|
40425
|
+
});
|
|
40426
|
+
});
|
|
40427
|
+
return function init2() {
|
|
40428
|
+
return _ref2.apply(this, arguments);
|
|
40429
|
+
};
|
|
40430
|
+
}();
|
|
40431
|
+
domTimer.current = window.setTimeout(function() {
|
|
40432
|
+
init();
|
|
40433
|
+
}, 300);
|
|
40434
|
+
return function() {
|
|
40435
|
+
clearDomTimeout();
|
|
40436
|
+
};
|
|
40437
|
+
}, [
|
|
40438
|
+
list
|
|
40439
|
+
]);
|
|
40440
|
+
var run = function() {
|
|
40441
|
+
clearTimeout(timer.current);
|
|
40442
|
+
var intervalCache = interval;
|
|
40443
|
+
var _index = (loop ? index2.current % list.length : index2.current) % rows;
|
|
40444
|
+
var result = times.current[_index] - rows * interval;
|
|
40445
|
+
if (result > 0) {
|
|
40446
|
+
intervalCache += result;
|
|
40447
|
+
}
|
|
40448
|
+
timer.current = window.setTimeout(function() {
|
|
40449
|
+
play();
|
|
40450
|
+
}, intervalCache);
|
|
40451
|
+
};
|
|
40452
|
+
var setStyle = /* @__PURE__ */ function() {
|
|
40453
|
+
var _ref2 = _async_to_generator(function(el, currentIndex) {
|
|
40454
|
+
var refe, width2, height2, elScrollDuration, error;
|
|
40455
|
+
return __generator(this, function(_state) {
|
|
40456
|
+
switch (_state.label) {
|
|
40457
|
+
case 0:
|
|
40458
|
+
_state.trys.push([
|
|
40459
|
+
0,
|
|
40460
|
+
3,
|
|
40461
|
+
,
|
|
40462
|
+
4
|
|
40463
|
+
]);
|
|
40464
|
+
if (!el) return [
|
|
40465
|
+
3,
|
|
40466
|
+
2
|
|
40467
|
+
];
|
|
40468
|
+
return [
|
|
40469
|
+
4,
|
|
40470
|
+
getRectByTaro(el)
|
|
40471
|
+
];
|
|
40472
|
+
case 1:
|
|
40473
|
+
refe = _state.sent();
|
|
40474
|
+
width2 = refe.width;
|
|
40475
|
+
height2 = refe.height;
|
|
40476
|
+
el.classList.add("move");
|
|
40477
|
+
elScrollDuration = Math.round(width2 / barrageCWidth.current * duration);
|
|
40478
|
+
times.current[currentIndex] = elScrollDuration;
|
|
40479
|
+
el.style.animationDuration = "".concat(duration + elScrollDuration, "ms");
|
|
40480
|
+
el.style.top = "".concat(currentIndex * (height2 + gapY) + 20, "px");
|
|
40481
|
+
el.style.width = "".concat(width2, "px");
|
|
40482
|
+
_state.label = 2;
|
|
40483
|
+
case 2:
|
|
40484
|
+
return [
|
|
40485
|
+
3,
|
|
40486
|
+
4
|
|
40487
|
+
];
|
|
40488
|
+
case 3:
|
|
40489
|
+
error = _state.sent();
|
|
40490
|
+
console.log("异常自动流转到下一个", error);
|
|
40491
|
+
barrageContainer.current.removeChild(el);
|
|
40492
|
+
return [
|
|
40493
|
+
3,
|
|
40494
|
+
4
|
|
40495
|
+
];
|
|
40496
|
+
case 4:
|
|
40497
|
+
el.addEventListener("animationend", function() {
|
|
40498
|
+
barrageContainer.current.removeChild(el);
|
|
40499
|
+
});
|
|
40500
|
+
return [
|
|
40501
|
+
2
|
|
40502
|
+
];
|
|
40503
|
+
}
|
|
40504
|
+
});
|
|
40505
|
+
});
|
|
40506
|
+
return function setStyle2(el, currentIndex) {
|
|
40507
|
+
return _ref2.apply(this, arguments);
|
|
40508
|
+
};
|
|
40509
|
+
}();
|
|
40510
|
+
var play = function() {
|
|
40511
|
+
if (!loop && index2.current >= list.length) {
|
|
40512
|
+
return;
|
|
40513
|
+
}
|
|
40514
|
+
var _index = loop ? index2.current % list.length : index2.current;
|
|
40515
|
+
var el = document.createElement("View");
|
|
40516
|
+
var currentIndex = _index % rows;
|
|
40517
|
+
if (currentIndex <= historyIndex.current || historyIndex.current === 3 && currentIndex !== 0 || Math.abs(currentIndex - historyIndex.current) !== 1) {
|
|
40518
|
+
currentIndex = historyIndex.current + 1 >= rows ? 0 : historyIndex.current + 1;
|
|
40519
|
+
}
|
|
40520
|
+
historyIndex.current = currentIndex;
|
|
40521
|
+
el.innerHTML = list[_index];
|
|
40522
|
+
barrageContainer.current.appendChild(el);
|
|
40523
|
+
el.classList.add("barrage-item");
|
|
40524
|
+
requestAnimationFrame(function() {
|
|
40525
|
+
return setStyle(el, currentIndex);
|
|
40526
|
+
});
|
|
40527
|
+
index2.current++;
|
|
40528
|
+
run();
|
|
39969
40529
|
};
|
|
39970
40530
|
return /* @__PURE__ */ React.createElement(components.View, _object_spread({
|
|
39971
40531
|
className: classes,
|
|
@@ -39977,7 +40537,7 @@
|
|
|
39977
40537
|
};
|
|
39978
40538
|
var Barrage = /* @__PURE__ */ React.forwardRef(InternalBarrage);
|
|
39979
40539
|
Barrage.displayName = "NutBarrage";
|
|
39980
|
-
var defaultProps$
|
|
40540
|
+
var defaultProps$4 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
39981
40541
|
src: "",
|
|
39982
40542
|
title: "",
|
|
39983
40543
|
price: "",
|
|
@@ -39991,7 +40551,7 @@
|
|
|
39991
40551
|
extra: ""
|
|
39992
40552
|
});
|
|
39993
40553
|
var Card = function(props) {
|
|
39994
|
-
var _ref = _object_spread({}, defaultProps$
|
|
40554
|
+
var _ref = _object_spread({}, defaultProps$4, props), className = _ref.className, style = _ref.style, src = _ref.src, title = _ref.title, price = _ref.price, vipPrice = _ref.vipPrice, shopDescription = _ref.shopDescription, delivery = _ref.delivery, shopName = _ref.shopName, tag = _ref.tag, priceTag = _ref.priceTag, description = _ref.description, extra = _ref.extra, rest = _object_without_properties(_ref, [
|
|
39995
40555
|
"className",
|
|
39996
40556
|
"style",
|
|
39997
40557
|
"src",
|
|
@@ -40040,7 +40600,7 @@
|
|
|
40040
40600
|
}, shopName), extra)));
|
|
40041
40601
|
};
|
|
40042
40602
|
Card.displayName = "NutCard";
|
|
40043
|
-
var defaultProps$
|
|
40603
|
+
var defaultProps$3 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40044
40604
|
activeDate: "",
|
|
40045
40605
|
activeTime: [],
|
|
40046
40606
|
options: [],
|
|
@@ -40053,7 +40613,7 @@
|
|
|
40053
40613
|
}
|
|
40054
40614
|
});
|
|
40055
40615
|
var TimeDetail = function(props) {
|
|
40056
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
40616
|
+
var _$_object_spread = _object_spread({}, defaultProps$3, props), options = _$_object_spread.options, optionKey = _$_object_spread.optionKey, className = _$_object_spread.className, activeDate = _$_object_spread.activeDate, activeTime = _$_object_spread.activeTime, onSelect = _$_object_spread.onSelect;
|
|
40057
40617
|
var classPrefix2 = "nut-timedetail";
|
|
40058
40618
|
var timeList = React.useMemo(function() {
|
|
40059
40619
|
return (options === null || options === void 0 ? void 0 : options.find(function(item) {
|
|
@@ -40095,7 +40655,7 @@
|
|
|
40095
40655
|
}));
|
|
40096
40656
|
};
|
|
40097
40657
|
TimeDetail.displayName = "NutTimeDetail";
|
|
40098
|
-
var defaultProps$
|
|
40658
|
+
var defaultProps$2 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40099
40659
|
visible: false,
|
|
40100
40660
|
multiple: false,
|
|
40101
40661
|
defaultValue: [],
|
|
@@ -40108,7 +40668,7 @@
|
|
|
40108
40668
|
});
|
|
40109
40669
|
var TimeSelect = function(props) {
|
|
40110
40670
|
var locale = useConfig().locale;
|
|
40111
|
-
var _ref = _object_spread({}, defaultProps$
|
|
40671
|
+
var _ref = _object_spread({}, defaultProps$2, props), visible = _ref.visible, className = _ref.className, style = _ref.style, title = _ref.title, defaultValue = _ref.defaultValue, options = _ref.options, optionKey = _ref.optionKey, multiple = _ref.multiple, onSelect = _ref.onSelect, onDateChange = _ref.onDateChange, onTimeChange = _ref.onTimeChange, rest = _object_without_properties(_ref, [
|
|
40112
40672
|
"visible",
|
|
40113
40673
|
"className",
|
|
40114
40674
|
"style",
|
|
@@ -40219,7 +40779,7 @@
|
|
|
40219
40779
|
}))));
|
|
40220
40780
|
};
|
|
40221
40781
|
TimeSelect.displayName = "NutTimeSelect";
|
|
40222
|
-
var defaultProps$
|
|
40782
|
+
var defaultProps$1 = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40223
40783
|
value: 0,
|
|
40224
40784
|
digits: 2,
|
|
40225
40785
|
symbol: false,
|
|
@@ -40233,7 +40793,7 @@
|
|
|
40233
40793
|
dropIcon: null
|
|
40234
40794
|
});
|
|
40235
40795
|
var TrendArrow = function(props) {
|
|
40236
|
-
var _ref = _object_spread({}, defaultProps$
|
|
40796
|
+
var _ref = _object_spread({}, defaultProps$1, props), value2 = _ref.value, digits = _ref.digits, symbol = _ref.symbol, zero = _ref.zero, left2 = _ref.left, sync = _ref.sync, color = _ref.color, riseColor = _ref.riseColor, dropColor = _ref.dropColor, riseIcon = _ref.riseIcon, dropIcon = _ref.dropIcon, className = _ref.className, style = _ref.style;
|
|
40237
40797
|
_ref.children;
|
|
40238
40798
|
var rest = _object_without_properties(_ref, [
|
|
40239
40799
|
"value",
|
|
@@ -40305,7 +40865,7 @@
|
|
|
40305
40865
|
}))), left2 && renderContent(!left2));
|
|
40306
40866
|
};
|
|
40307
40867
|
TrendArrow.displayName = "NutTrendArrow";
|
|
40308
|
-
var defaultProps
|
|
40868
|
+
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40309
40869
|
content: "",
|
|
40310
40870
|
fullPage: true,
|
|
40311
40871
|
zIndex: 2e3,
|
|
@@ -40326,7 +40886,7 @@
|
|
|
40326
40886
|
});
|
|
40327
40887
|
var WaterMark = function(props) {
|
|
40328
40888
|
var locale = useConfig().locale;
|
|
40329
|
-
var _$_object_spread = _object_spread({}, defaultProps
|
|
40889
|
+
var _$_object_spread = _object_spread({}, defaultProps, props), content2 = _$_object_spread.content, fullPage = _$_object_spread.fullPage, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, gapX = _$_object_spread.gapX, gapY = _$_object_spread.gapY, startX = _$_object_spread.startX, startY = _$_object_spread.startY, width2 = _$_object_spread.width, height2 = _$_object_spread.height, image = _$_object_spread.image, imageWidth = _$_object_spread.imageWidth, imageHeight = _$_object_spread.imageHeight, rotate = _$_object_spread.rotate, color = _$_object_spread.color, fontStyle = _$_object_spread.fontStyle, fontFamily = _$_object_spread.fontFamily, fontWeight = _$_object_spread.fontWeight, fontSize = _$_object_spread.fontSize, style = _$_object_spread.style;
|
|
40330
40890
|
var _useState = _sliced_to_array(React.useState(""), 2), base64Url = _useState[0], setBase64Url = _useState[1];
|
|
40331
40891
|
var classPrefix2 = "nut-watermark";
|
|
40332
40892
|
var classes = classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-full-page"), fullPage));
|
|
@@ -40402,630 +40962,6 @@
|
|
|
40402
40962
|
});
|
|
40403
40963
|
};
|
|
40404
40964
|
WaterMark.displayName = "NutWaterMark";
|
|
40405
|
-
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
40406
|
-
maxZoom: 3,
|
|
40407
|
-
space: 10,
|
|
40408
|
-
toolbar: [
|
|
40409
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40410
|
-
type: "danger",
|
|
40411
|
-
key: "cancel"
|
|
40412
|
-
}, "Cancel"),
|
|
40413
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40414
|
-
key: "reset"
|
|
40415
|
-
}, "Reset"),
|
|
40416
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40417
|
-
key: "rotate"
|
|
40418
|
-
}, "Rotate"),
|
|
40419
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40420
|
-
type: "success",
|
|
40421
|
-
key: "confirm"
|
|
40422
|
-
}, "Confirm")
|
|
40423
|
-
],
|
|
40424
|
-
toolbarPosition: "bottom",
|
|
40425
|
-
editText: "Edit",
|
|
40426
|
-
sizeType: [
|
|
40427
|
-
"original",
|
|
40428
|
-
"compressed"
|
|
40429
|
-
],
|
|
40430
|
-
sourceType: [
|
|
40431
|
-
"album",
|
|
40432
|
-
"camera"
|
|
40433
|
-
],
|
|
40434
|
-
shape: "square"
|
|
40435
|
-
});
|
|
40436
|
-
var classPrefix = "nut-avatar-cropper";
|
|
40437
|
-
var AvatarCropper = function(props) {
|
|
40438
|
-
var locale = useConfig().locale;
|
|
40439
|
-
defaultProps.toolbar = [
|
|
40440
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40441
|
-
type: "danger",
|
|
40442
|
-
key: "cancel"
|
|
40443
|
-
}, locale.cancel),
|
|
40444
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40445
|
-
key: "reset"
|
|
40446
|
-
}, locale.reset),
|
|
40447
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40448
|
-
key: "rotate"
|
|
40449
|
-
}, locale.avatarCropper.rotate),
|
|
40450
|
-
/* @__PURE__ */ React.createElement(Button, {
|
|
40451
|
-
type: "success",
|
|
40452
|
-
key: "confirm"
|
|
40453
|
-
}, locale.confirm)
|
|
40454
|
-
];
|
|
40455
|
-
defaultProps.editText = locale.edit;
|
|
40456
|
-
var _ref = _object_spread({}, defaultProps, props), children = _ref.children, toolbar = _ref.toolbar, maxZoom = _ref.maxZoom, space = _ref.space, toolbarPosition = _ref.toolbarPosition, editText = _ref.editText, sizeType = _ref.sizeType, sourceType = _ref.sourceType, shape = _ref.shape, className = _ref.className, style = _ref.style, onConfirm = _ref.onConfirm, onCancel = _ref.onCancel, rest = _object_without_properties(_ref, [
|
|
40457
|
-
"children",
|
|
40458
|
-
"toolbar",
|
|
40459
|
-
"maxZoom",
|
|
40460
|
-
"space",
|
|
40461
|
-
"toolbarPosition",
|
|
40462
|
-
"editText",
|
|
40463
|
-
"sizeType",
|
|
40464
|
-
"sourceType",
|
|
40465
|
-
"shape",
|
|
40466
|
-
"className",
|
|
40467
|
-
"style",
|
|
40468
|
-
"onConfirm",
|
|
40469
|
-
"onCancel"
|
|
40470
|
-
]);
|
|
40471
|
-
var cls = classNames(classPrefix, "taro", className, shape === "round" && "round");
|
|
40472
|
-
var toolbarPositionCls = classNames("".concat(classPrefix, "-popup-toolbar"), toolbarPosition);
|
|
40473
|
-
var _useState = _sliced_to_array(React.useState(false), 2), visible = _useState[0], setVisible = _useState[1];
|
|
40474
|
-
var _useState1 = _sliced_to_array(React.useState(false), 2), moving = _useState1[0], setMoving = _useState1[1];
|
|
40475
|
-
var _useState2 = _sliced_to_array(React.useState(false), 2), zooming = _useState2[0], setZooming = _useState2[1];
|
|
40476
|
-
var systemInfo = getWindowInfo();
|
|
40477
|
-
var showAlipayCanvas2D = React.useMemo(function() {
|
|
40478
|
-
return Taro.getEnv() === "ALIPAY" && parseInt(Taro.SDKVersion.replace(/\./g, "")) >= 270;
|
|
40479
|
-
}, []);
|
|
40480
|
-
var showPixelRatio = Taro.getEnv() === "WEB" || showAlipayCanvas2D;
|
|
40481
|
-
var pixelRatio = showPixelRatio ? systemInfo.pixelRatio : 1;
|
|
40482
|
-
var _useState3 = _sliced_to_array(React.useState({
|
|
40483
|
-
defScale: 1,
|
|
40484
|
-
scale: 1,
|
|
40485
|
-
angle: 0,
|
|
40486
|
-
moveX: 0,
|
|
40487
|
-
moveY: 0,
|
|
40488
|
-
displayWidth: systemInfo.windowWidth * pixelRatio,
|
|
40489
|
-
displayHeight: systemInfo.windowHeight * pixelRatio,
|
|
40490
|
-
cropperWidth: systemInfo.windowWidth * pixelRatio - space * pixelRatio * 2,
|
|
40491
|
-
cropperHeight: systemInfo.windowWidth * pixelRatio - space * pixelRatio * 2
|
|
40492
|
-
}), 2), state = _useState3[0], setState = _useState3[1];
|
|
40493
|
-
var defDrawImage = {
|
|
40494
|
-
src: "",
|
|
40495
|
-
x: 0,
|
|
40496
|
-
y: 0,
|
|
40497
|
-
width: 0,
|
|
40498
|
-
height: 0
|
|
40499
|
-
};
|
|
40500
|
-
var _useState4 = _sliced_to_array(React.useState(_object_spread({}, defDrawImage)), 2), drawImage = _useState4[0], setDrawImg = _useState4[1];
|
|
40501
|
-
var _useState5 = _sliced_to_array(React.useState({
|
|
40502
|
-
canvasId: "canvas-".concat(Date.now()),
|
|
40503
|
-
cropperCanvas: null,
|
|
40504
|
-
cropperCanvasContext: null
|
|
40505
|
-
}), 2), canvasAll = _useState5[0], setCanvasAll = _useState5[1];
|
|
40506
|
-
Taro.useReady(function() {
|
|
40507
|
-
if (showAlipayCanvas2D) {
|
|
40508
|
-
var canvasId = canvasAll.canvasId;
|
|
40509
|
-
Taro.createSelectorQuery().select("#".concat(canvasId)).node(function(param) {
|
|
40510
|
-
var canvas = param.node;
|
|
40511
|
-
canvas.width = state.displayWidth;
|
|
40512
|
-
canvas.height = state.displayHeight;
|
|
40513
|
-
setCanvasAll(_object_spread_props(_object_spread({}, canvasAll), {
|
|
40514
|
-
cropperCanvas: canvas
|
|
40515
|
-
}));
|
|
40516
|
-
}).exec();
|
|
40517
|
-
}
|
|
40518
|
-
});
|
|
40519
|
-
React.useEffect(function() {
|
|
40520
|
-
setCanvasAll(_object_spread_props(_object_spread({}, canvasAll), {
|
|
40521
|
-
cropperCanvasContext: Taro.createCanvasContext(canvasAll.canvasId)
|
|
40522
|
-
}));
|
|
40523
|
-
}, []);
|
|
40524
|
-
var touch = useTouch();
|
|
40525
|
-
var highlightStyle = React.useMemo(function() {
|
|
40526
|
-
var width2 = "".concat(state.cropperWidth / pixelRatio, "px");
|
|
40527
|
-
var height2 = width2;
|
|
40528
|
-
return {
|
|
40529
|
-
width: width2,
|
|
40530
|
-
height: height2,
|
|
40531
|
-
borderRadius: shape === "round" ? "50%" : ""
|
|
40532
|
-
};
|
|
40533
|
-
}, [
|
|
40534
|
-
pixelRatio,
|
|
40535
|
-
state.cropperWidth
|
|
40536
|
-
]);
|
|
40537
|
-
var isAngle = React.useMemo(function() {
|
|
40538
|
-
return state.angle === 90 || state.angle === 270;
|
|
40539
|
-
}, [
|
|
40540
|
-
state.angle
|
|
40541
|
-
]);
|
|
40542
|
-
var canvasStyle = React.useMemo(function() {
|
|
40543
|
-
return {
|
|
40544
|
-
width: "".concat(state.displayWidth / pixelRatio, "px"),
|
|
40545
|
-
height: "".concat(state.displayHeight / pixelRatio, "px")
|
|
40546
|
-
};
|
|
40547
|
-
}, [
|
|
40548
|
-
pixelRatio,
|
|
40549
|
-
state.displayHeight,
|
|
40550
|
-
state.displayWidth
|
|
40551
|
-
]);
|
|
40552
|
-
var maxMoveX = React.useMemo(function() {
|
|
40553
|
-
var displayWidth = state.displayWidth, scale2 = state.scale, cropperWidth = state.cropperWidth;
|
|
40554
|
-
if (isAngle) {
|
|
40555
|
-
return Math.max(0, (drawImage.height * scale2 - cropperWidth) / 2);
|
|
40556
|
-
}
|
|
40557
|
-
return Math.max(0, (displayWidth * scale2 - cropperWidth) / 2);
|
|
40558
|
-
}, [
|
|
40559
|
-
drawImage.height,
|
|
40560
|
-
isAngle,
|
|
40561
|
-
state
|
|
40562
|
-
]);
|
|
40563
|
-
var maxMoveY = React.useMemo(function() {
|
|
40564
|
-
var displayWidth = state.displayWidth, scale2 = state.scale, cropperWidth = state.cropperWidth;
|
|
40565
|
-
if (isAngle) {
|
|
40566
|
-
return Math.max(0, (displayWidth * scale2 - cropperWidth) / 2);
|
|
40567
|
-
}
|
|
40568
|
-
return Math.max(0, (drawImage.height * scale2 - cropperWidth) / 2);
|
|
40569
|
-
}, [
|
|
40570
|
-
drawImage.height,
|
|
40571
|
-
isAngle,
|
|
40572
|
-
state
|
|
40573
|
-
]);
|
|
40574
|
-
var dataURLToImage = function(dataURL) {
|
|
40575
|
-
return new Promise(function(resolve) {
|
|
40576
|
-
var img = new Image();
|
|
40577
|
-
img.onload = function() {
|
|
40578
|
-
return resolve(img);
|
|
40579
|
-
};
|
|
40580
|
-
img.src = dataURL;
|
|
40581
|
-
});
|
|
40582
|
-
};
|
|
40583
|
-
var dataURLToCanvasImage = function(canvas, dataURL) {
|
|
40584
|
-
return new Promise(function(resolve) {
|
|
40585
|
-
var img = canvas.createImage();
|
|
40586
|
-
img.onload = function() {
|
|
40587
|
-
return resolve(img);
|
|
40588
|
-
};
|
|
40589
|
-
img.src = dataURL;
|
|
40590
|
-
});
|
|
40591
|
-
};
|
|
40592
|
-
var canvas2dDraw = React.useCallback(function(ctx) {
|
|
40593
|
-
var src = drawImage.src, width2 = drawImage.width, height2 = drawImage.height, x2 = drawImage.x, y = drawImage.y;
|
|
40594
|
-
if (!ctx || !src) return;
|
|
40595
|
-
var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight, cropperWidth = state.cropperWidth;
|
|
40596
|
-
ctx.clearRect(0, 0, displayWidth, displayHeight);
|
|
40597
|
-
ctx.fillStyle = "#666";
|
|
40598
|
-
ctx.fillRect(0, 0, displayWidth, displayHeight);
|
|
40599
|
-
ctx.fillStyle = "#000";
|
|
40600
|
-
ctx.fillRect(space * pixelRatio, (displayHeight - cropperWidth) / 2, cropperWidth, cropperWidth);
|
|
40601
|
-
ctx.translate(displayWidth / 2 + moveX, displayHeight / 2 + moveY);
|
|
40602
|
-
ctx.rotate(Math.PI / 180 * angle);
|
|
40603
|
-
ctx.scale(scale2, scale2);
|
|
40604
|
-
ctx.drawImage(src, x2, y, width2, height2);
|
|
40605
|
-
}, [
|
|
40606
|
-
drawImage,
|
|
40607
|
-
state
|
|
40608
|
-
]);
|
|
40609
|
-
var webDraw = React.useCallback(function() {
|
|
40610
|
-
var canvasDom = document.getElementById(canvasAll.canvasId);
|
|
40611
|
-
var canvas = canvasDom;
|
|
40612
|
-
if ((canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
40613
|
-
canvas = canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.getElementsByTagName("canvas")[0];
|
|
40614
|
-
}
|
|
40615
|
-
if (!canvas) return;
|
|
40616
|
-
canvas.width = state.displayWidth;
|
|
40617
|
-
canvas.height = state.displayHeight;
|
|
40618
|
-
var ctx = canvas.getContext("2d");
|
|
40619
|
-
canvas2dDraw(ctx);
|
|
40620
|
-
}, [
|
|
40621
|
-
canvas2dDraw
|
|
40622
|
-
]);
|
|
40623
|
-
var alipayDraw = React.useCallback(function() {
|
|
40624
|
-
var ctx = canvasAll.cropperCanvas.getContext("2d");
|
|
40625
|
-
ctx && ctx.resetTransform();
|
|
40626
|
-
canvas2dDraw(ctx);
|
|
40627
|
-
}, [
|
|
40628
|
-
canvas2dDraw,
|
|
40629
|
-
canvasAll.cropperCanvas
|
|
40630
|
-
]);
|
|
40631
|
-
var draw = React.useCallback(function() {
|
|
40632
|
-
if (Taro.getEnv() === "WEB") {
|
|
40633
|
-
webDraw();
|
|
40634
|
-
return;
|
|
40635
|
-
}
|
|
40636
|
-
if (showAlipayCanvas2D) {
|
|
40637
|
-
alipayDraw();
|
|
40638
|
-
return;
|
|
40639
|
-
}
|
|
40640
|
-
var src = drawImage.src, width2 = drawImage.width, height2 = drawImage.height, x2 = drawImage.x, y = drawImage.y;
|
|
40641
|
-
var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight, cropperWidth = state.cropperWidth;
|
|
40642
|
-
var cropperCanvasContext = canvasAll.cropperCanvasContext;
|
|
40643
|
-
var ctx = cropperCanvasContext;
|
|
40644
|
-
if (!ctx) return;
|
|
40645
|
-
ctx.clearRect(0, 0, displayWidth, displayHeight);
|
|
40646
|
-
ctx.fillStyle = "#666";
|
|
40647
|
-
ctx.setFillStyle("#666");
|
|
40648
|
-
ctx.fillRect(0, 0, displayWidth, displayHeight);
|
|
40649
|
-
ctx.stroke();
|
|
40650
|
-
ctx.fill();
|
|
40651
|
-
ctx.fillStyle = "#000";
|
|
40652
|
-
ctx.setFillStyle("#000");
|
|
40653
|
-
ctx.fillRect(space, (displayHeight - cropperWidth) / 2, cropperWidth, cropperWidth);
|
|
40654
|
-
ctx.stroke();
|
|
40655
|
-
ctx.fill();
|
|
40656
|
-
ctx.translate(displayWidth / 2 + moveX, displayHeight / 2 + moveY);
|
|
40657
|
-
ctx.rotate(Math.PI / 180 * angle);
|
|
40658
|
-
ctx.scale(scale2, scale2);
|
|
40659
|
-
ctx.drawImage(src, x2, y, width2, height2);
|
|
40660
|
-
ctx.draw();
|
|
40661
|
-
}, [
|
|
40662
|
-
drawImage,
|
|
40663
|
-
state.scale,
|
|
40664
|
-
state.angle,
|
|
40665
|
-
state.moveX,
|
|
40666
|
-
state.moveY
|
|
40667
|
-
]);
|
|
40668
|
-
React.useEffect(function() {
|
|
40669
|
-
if (Math.abs(state.moveX) > maxMoveX) {
|
|
40670
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40671
|
-
moveX: maxMoveX
|
|
40672
|
-
}));
|
|
40673
|
-
}
|
|
40674
|
-
if (Math.abs(state.moveY) > maxMoveY) {
|
|
40675
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40676
|
-
moveY: maxMoveY
|
|
40677
|
-
}));
|
|
40678
|
-
}
|
|
40679
|
-
draw();
|
|
40680
|
-
}, [
|
|
40681
|
-
state,
|
|
40682
|
-
maxMoveX,
|
|
40683
|
-
maxMoveY,
|
|
40684
|
-
draw
|
|
40685
|
-
]);
|
|
40686
|
-
var setDrawImgInfo = /* @__PURE__ */ function() {
|
|
40687
|
-
var _ref2 = _async_to_generator(function(image) {
|
|
40688
|
-
var displayWidth, cropperWidth, copyDrawImg, imgWidth, imgHeight, isPortrait, rate, scale2;
|
|
40689
|
-
return __generator(this, function(_state) {
|
|
40690
|
-
switch (_state.label) {
|
|
40691
|
-
case 0:
|
|
40692
|
-
displayWidth = state.displayWidth, cropperWidth = state.cropperWidth;
|
|
40693
|
-
copyDrawImg = _object_spread({}, defDrawImage);
|
|
40694
|
-
imgWidth = image.width, imgHeight = image.height;
|
|
40695
|
-
copyDrawImg.src = image.path;
|
|
40696
|
-
if (!(Taro.getEnv() === "WEB")) return [
|
|
40697
|
-
3,
|
|
40698
|
-
2
|
|
40699
|
-
];
|
|
40700
|
-
return [
|
|
40701
|
-
4,
|
|
40702
|
-
dataURLToImage(image.path)
|
|
40703
|
-
];
|
|
40704
|
-
case 1:
|
|
40705
|
-
copyDrawImg.src = _state.sent();
|
|
40706
|
-
_state.label = 2;
|
|
40707
|
-
case 2:
|
|
40708
|
-
if (!showAlipayCanvas2D) return [
|
|
40709
|
-
3,
|
|
40710
|
-
4
|
|
40711
|
-
];
|
|
40712
|
-
return [
|
|
40713
|
-
4,
|
|
40714
|
-
dataURLToCanvasImage(canvasAll.cropperCanvas, image.path)
|
|
40715
|
-
];
|
|
40716
|
-
case 3:
|
|
40717
|
-
copyDrawImg.src = _state.sent();
|
|
40718
|
-
_state.label = 4;
|
|
40719
|
-
case 4:
|
|
40720
|
-
isPortrait = imgHeight > imgWidth;
|
|
40721
|
-
rate = isPortrait ? imgWidth / imgHeight : imgHeight / imgWidth;
|
|
40722
|
-
copyDrawImg.width = displayWidth;
|
|
40723
|
-
copyDrawImg.height = isPortrait ? displayWidth / rate : displayWidth * rate;
|
|
40724
|
-
copyDrawImg.x = -copyDrawImg.width / 2;
|
|
40725
|
-
copyDrawImg.y = -copyDrawImg.height / 2;
|
|
40726
|
-
setDrawImg(copyDrawImg);
|
|
40727
|
-
scale2 = cropperWidth / (isPortrait ? copyDrawImg.width : copyDrawImg.height);
|
|
40728
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40729
|
-
defScale: scale2
|
|
40730
|
-
}));
|
|
40731
|
-
resetScale(scale2);
|
|
40732
|
-
return [
|
|
40733
|
-
2
|
|
40734
|
-
];
|
|
40735
|
-
}
|
|
40736
|
-
});
|
|
40737
|
-
});
|
|
40738
|
-
return function setDrawImgInfo2(image) {
|
|
40739
|
-
return _ref2.apply(this, arguments);
|
|
40740
|
-
};
|
|
40741
|
-
}();
|
|
40742
|
-
var chooseImage = function() {
|
|
40743
|
-
Taro.chooseImage({
|
|
40744
|
-
count: 1,
|
|
40745
|
-
// 可以指定是原图还是压缩图,默认二者都有
|
|
40746
|
-
sizeType,
|
|
40747
|
-
sourceType,
|
|
40748
|
-
success: function(res) {
|
|
40749
|
-
var tempFiles = res.tempFiles;
|
|
40750
|
-
!!tempFiles.length && imageChange(tempFiles[0]);
|
|
40751
|
-
}
|
|
40752
|
-
});
|
|
40753
|
-
};
|
|
40754
|
-
var imageChange = /* @__PURE__ */ function() {
|
|
40755
|
-
var _ref2 = _async_to_generator(function(file) {
|
|
40756
|
-
return __generator(this, function(_state) {
|
|
40757
|
-
Taro.getImageInfo({
|
|
40758
|
-
src: file.path
|
|
40759
|
-
}).then(function(res) {
|
|
40760
|
-
setVisible(true);
|
|
40761
|
-
setDrawImgInfo(res);
|
|
40762
|
-
});
|
|
40763
|
-
return [
|
|
40764
|
-
2
|
|
40765
|
-
];
|
|
40766
|
-
});
|
|
40767
|
-
});
|
|
40768
|
-
return function imageChange2(file) {
|
|
40769
|
-
return _ref2.apply(this, arguments);
|
|
40770
|
-
};
|
|
40771
|
-
}();
|
|
40772
|
-
var resetScale = function(scale2) {
|
|
40773
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40774
|
-
moveX: 0,
|
|
40775
|
-
moveY: 0,
|
|
40776
|
-
angle: 0,
|
|
40777
|
-
scale: scale2 || state.defScale,
|
|
40778
|
-
defScale: scale2 || state.defScale
|
|
40779
|
-
}));
|
|
40780
|
-
};
|
|
40781
|
-
var setScale = function(scale2) {
|
|
40782
|
-
scale2 = clamp(scale2, 0.3, +maxZoom + 1);
|
|
40783
|
-
if (scale2 !== state.scale) {
|
|
40784
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40785
|
-
scale: scale2
|
|
40786
|
-
}));
|
|
40787
|
-
}
|
|
40788
|
-
};
|
|
40789
|
-
var getDistance = function(touches) {
|
|
40790
|
-
return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
|
|
40791
|
-
};
|
|
40792
|
-
var _useState6 = _sliced_to_array(React.useState({
|
|
40793
|
-
startMoveX: 0,
|
|
40794
|
-
startMoveY: 0,
|
|
40795
|
-
startScale: 0,
|
|
40796
|
-
startDistance: 0
|
|
40797
|
-
}), 2), startMove = _useState6[0], setStartMove = _useState6[1];
|
|
40798
|
-
var startMoveX = startMove.startMoveX, startMoveY = startMove.startMoveY, startScale = startMove.startScale, startDistance = startMove.startDistance;
|
|
40799
|
-
var onTouchStart = function(event) {
|
|
40800
|
-
var touches = event.touches;
|
|
40801
|
-
var offsetX = touch.offsetX;
|
|
40802
|
-
touch.start(event);
|
|
40803
|
-
var fingerNum = touches === null || touches === void 0 ? void 0 : touches.length;
|
|
40804
|
-
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40805
|
-
startMoveX: state.moveX,
|
|
40806
|
-
startMoveY: state.moveY
|
|
40807
|
-
}));
|
|
40808
|
-
setMoving(fingerNum === 1);
|
|
40809
|
-
setZooming(fingerNum === 2 && !offsetX.current);
|
|
40810
|
-
if (fingerNum === 2 && !offsetX.current) {
|
|
40811
|
-
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40812
|
-
startScale: state.scale,
|
|
40813
|
-
startDistance: getDistance(event.touches)
|
|
40814
|
-
}));
|
|
40815
|
-
}
|
|
40816
|
-
};
|
|
40817
|
-
var onTouchMove = function(event) {
|
|
40818
|
-
var touches = event.touches;
|
|
40819
|
-
touch.move(event);
|
|
40820
|
-
if (moving || zooming) {
|
|
40821
|
-
preventDefault$1(event, true);
|
|
40822
|
-
}
|
|
40823
|
-
if (moving) {
|
|
40824
|
-
var deltaX = touch.deltaX, deltaY = touch.deltaY;
|
|
40825
|
-
var moveX = deltaX.current * state.scale + startMoveX;
|
|
40826
|
-
var moveY = deltaY.current * state.scale + startMoveY;
|
|
40827
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40828
|
-
moveX: clamp(moveX, -maxMoveX, maxMoveX),
|
|
40829
|
-
moveY: clamp(moveY, -maxMoveY, maxMoveY)
|
|
40830
|
-
}));
|
|
40831
|
-
}
|
|
40832
|
-
if (zooming && touches.length === 2) {
|
|
40833
|
-
var distance = getDistance(touches);
|
|
40834
|
-
var scale2 = startScale * distance / startDistance;
|
|
40835
|
-
setScale(scale2);
|
|
40836
|
-
}
|
|
40837
|
-
};
|
|
40838
|
-
var onTouchEnd = function(event) {
|
|
40839
|
-
var stopPropagation = false;
|
|
40840
|
-
if (moving || zooming) {
|
|
40841
|
-
stopPropagation = !(moving && startMoveX === state.moveX && startMoveY === state.moveY);
|
|
40842
|
-
if (!event.touches.length) {
|
|
40843
|
-
if (zooming) {
|
|
40844
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40845
|
-
moveX: clamp(state.moveX, -maxMoveX, maxMoveX),
|
|
40846
|
-
moveY: clamp(state.moveY, -maxMoveY, maxMoveY)
|
|
40847
|
-
}));
|
|
40848
|
-
setZooming(false);
|
|
40849
|
-
}
|
|
40850
|
-
setMoving(false);
|
|
40851
|
-
setStartMove(_object_spread_props(_object_spread({}, startMove), {
|
|
40852
|
-
startMoveX: 0,
|
|
40853
|
-
startMoveY: 0,
|
|
40854
|
-
startScale: state.defScale
|
|
40855
|
-
}));
|
|
40856
|
-
if (state.scale < state.defScale) {
|
|
40857
|
-
resetScale();
|
|
40858
|
-
}
|
|
40859
|
-
if (state.scale > maxZoom) {
|
|
40860
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40861
|
-
scale: +maxZoom
|
|
40862
|
-
}));
|
|
40863
|
-
}
|
|
40864
|
-
}
|
|
40865
|
-
}
|
|
40866
|
-
preventDefault$1(event, stopPropagation);
|
|
40867
|
-
touch.reset();
|
|
40868
|
-
};
|
|
40869
|
-
var reset = function() {
|
|
40870
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40871
|
-
angle: 0
|
|
40872
|
-
}));
|
|
40873
|
-
};
|
|
40874
|
-
var rotate = function() {
|
|
40875
|
-
if (state.angle === 270) {
|
|
40876
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40877
|
-
angle: 0
|
|
40878
|
-
}));
|
|
40879
|
-
return;
|
|
40880
|
-
}
|
|
40881
|
-
setState(_object_spread_props(_object_spread({}, state), {
|
|
40882
|
-
angle: state.angle + 90
|
|
40883
|
-
}));
|
|
40884
|
-
};
|
|
40885
|
-
var cancel = function() {
|
|
40886
|
-
var isEmit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
40887
|
-
setVisible(false);
|
|
40888
|
-
resetScale();
|
|
40889
|
-
isEmit && onCancel && onCancel();
|
|
40890
|
-
};
|
|
40891
|
-
var confirmWEB = function() {
|
|
40892
|
-
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40893
|
-
var canvasDom = document.getElementById(canvasAll.canvasId);
|
|
40894
|
-
var canvas = canvasDom;
|
|
40895
|
-
if ((canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.tagName) !== "CANVAS") {
|
|
40896
|
-
canvas = canvasDom === null || canvasDom === void 0 ? void 0 : canvasDom.getElementsByTagName("canvas")[0];
|
|
40897
|
-
}
|
|
40898
|
-
var width2 = cropperWidth;
|
|
40899
|
-
var height2 = cropperWidth;
|
|
40900
|
-
var croppedCanvas = document.createElement("canvas");
|
|
40901
|
-
var croppedCtx = croppedCanvas.getContext("2d");
|
|
40902
|
-
croppedCanvas.width = width2;
|
|
40903
|
-
croppedCanvas.height = height2;
|
|
40904
|
-
canvas && croppedCtx.drawImage(canvas, space * pixelRatio, (displayHeight - cropperWidth) / 2, width2, height2, 0, 0, width2, height2);
|
|
40905
|
-
var imageDataURL = croppedCanvas.toDataURL("image/png");
|
|
40906
|
-
onConfirm && onConfirm(imageDataURL);
|
|
40907
|
-
cancel(false);
|
|
40908
|
-
};
|
|
40909
|
-
var confirmALIPAY = function() {
|
|
40910
|
-
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40911
|
-
var cropperCanvas = canvasAll.cropperCanvas;
|
|
40912
|
-
Taro.canvasToTempFilePath({
|
|
40913
|
-
canvas: cropperCanvas,
|
|
40914
|
-
x: props.space,
|
|
40915
|
-
y: (displayHeight - cropperWidth) / 2,
|
|
40916
|
-
width: cropperWidth,
|
|
40917
|
-
height: cropperWidth,
|
|
40918
|
-
destWidth: cropperWidth,
|
|
40919
|
-
destHeight: cropperWidth,
|
|
40920
|
-
success: /* @__PURE__ */ function() {
|
|
40921
|
-
var _ref2 = _async_to_generator(function(res) {
|
|
40922
|
-
var filePath;
|
|
40923
|
-
return __generator(this, function(_state) {
|
|
40924
|
-
filePath = res.tempFilePath;
|
|
40925
|
-
onConfirm && onConfirm(filePath);
|
|
40926
|
-
cancel(false);
|
|
40927
|
-
return [
|
|
40928
|
-
2
|
|
40929
|
-
];
|
|
40930
|
-
});
|
|
40931
|
-
});
|
|
40932
|
-
return function(res) {
|
|
40933
|
-
return _ref2.apply(this, arguments);
|
|
40934
|
-
};
|
|
40935
|
-
}()
|
|
40936
|
-
});
|
|
40937
|
-
};
|
|
40938
|
-
var confirm = function() {
|
|
40939
|
-
if (Taro.getEnv() === "WEB") {
|
|
40940
|
-
confirmWEB();
|
|
40941
|
-
return;
|
|
40942
|
-
}
|
|
40943
|
-
if (showAlipayCanvas2D) {
|
|
40944
|
-
confirmALIPAY();
|
|
40945
|
-
return;
|
|
40946
|
-
}
|
|
40947
|
-
var cropperWidth = state.cropperWidth, displayHeight = state.displayHeight;
|
|
40948
|
-
var canvasId = canvasAll.canvasId;
|
|
40949
|
-
Taro.canvasToTempFilePath({
|
|
40950
|
-
canvasId,
|
|
40951
|
-
x: props.space,
|
|
40952
|
-
y: (displayHeight - cropperWidth) / 2,
|
|
40953
|
-
width: cropperWidth,
|
|
40954
|
-
height: cropperWidth,
|
|
40955
|
-
destWidth: cropperWidth * systemInfo.pixelRatio,
|
|
40956
|
-
destHeight: cropperWidth * systemInfo.pixelRatio,
|
|
40957
|
-
success: /* @__PURE__ */ function() {
|
|
40958
|
-
var _ref2 = _async_to_generator(function(res) {
|
|
40959
|
-
var filePath;
|
|
40960
|
-
return __generator(this, function(_state) {
|
|
40961
|
-
filePath = res.tempFilePath;
|
|
40962
|
-
onConfirm && onConfirm(filePath);
|
|
40963
|
-
cancel(false);
|
|
40964
|
-
return [
|
|
40965
|
-
2
|
|
40966
|
-
];
|
|
40967
|
-
});
|
|
40968
|
-
});
|
|
40969
|
-
return function(res) {
|
|
40970
|
-
return _ref2.apply(this, arguments);
|
|
40971
|
-
};
|
|
40972
|
-
}()
|
|
40973
|
-
});
|
|
40974
|
-
};
|
|
40975
|
-
var ToolBar = function() {
|
|
40976
|
-
var actions = [
|
|
40977
|
-
cancel,
|
|
40978
|
-
reset,
|
|
40979
|
-
rotate,
|
|
40980
|
-
confirm
|
|
40981
|
-
];
|
|
40982
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40983
|
-
className: "".concat(classPrefix, "-popup-toolbar-flex")
|
|
40984
|
-
}, actions.map(function(action, index2) {
|
|
40985
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40986
|
-
key: index2,
|
|
40987
|
-
className: "".concat(classPrefix, "-popup-toolbar-item"),
|
|
40988
|
-
onClick: function(_e) {
|
|
40989
|
-
return action();
|
|
40990
|
-
}
|
|
40991
|
-
}, toolbar[index2]);
|
|
40992
|
-
}));
|
|
40993
|
-
};
|
|
40994
|
-
var CropperPopup = function() {
|
|
40995
|
-
var canvasId = canvasAll.canvasId;
|
|
40996
|
-
return /* @__PURE__ */ React.createElement(components.View, {
|
|
40997
|
-
className: "".concat(classPrefix, "-popup"),
|
|
40998
|
-
style: {
|
|
40999
|
-
display: visible ? "block" : "none"
|
|
41000
|
-
}
|
|
41001
|
-
}, /* @__PURE__ */ React.createElement(components.Canvas, {
|
|
41002
|
-
id: canvasId,
|
|
41003
|
-
"canvas-id": canvasId,
|
|
41004
|
-
type: showAlipayCanvas2D ? "2d" : void 0,
|
|
41005
|
-
style: canvasStyle,
|
|
41006
|
-
className: "".concat(classPrefix, "-popup-canvas")
|
|
41007
|
-
}), /* @__PURE__ */ React.createElement(components.View, {
|
|
41008
|
-
className: "".concat(classPrefix, "-popup-highlight"),
|
|
41009
|
-
onTouchStart,
|
|
41010
|
-
onTouchMove,
|
|
41011
|
-
onTouchEnd
|
|
41012
|
-
}, /* @__PURE__ */ React.createElement(components.View, {
|
|
41013
|
-
className: "highlight",
|
|
41014
|
-
style: highlightStyle
|
|
41015
|
-
})), /* @__PURE__ */ React.createElement(components.View, {
|
|
41016
|
-
className: toolbarPositionCls
|
|
41017
|
-
}, /* @__PURE__ */ React.createElement(ToolBar, null)));
|
|
41018
|
-
};
|
|
41019
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(components.View, _object_spread_props(_object_spread({
|
|
41020
|
-
className: cls
|
|
41021
|
-
}, rest), {
|
|
41022
|
-
style
|
|
41023
|
-
}), children, /* @__PURE__ */ React.createElement(components.View, {
|
|
41024
|
-
className: "nut-avatar-cropper-edit-text",
|
|
41025
|
-
onClick: chooseImage
|
|
41026
|
-
}, editText)), CropperPopup());
|
|
41027
|
-
};
|
|
41028
|
-
AvatarCropper.displayName = "NutAvatarCropper";
|
|
41029
40965
|
exports.ActionSheet = ActionSheet;
|
|
41030
40966
|
exports.Address = Address;
|
|
41031
40967
|
exports.Animate = Animate;
|
|
@@ -41054,6 +40990,7 @@
|
|
|
41054
40990
|
exports.ConfigProvider = ConfigProvider;
|
|
41055
40991
|
exports.CountDown = CountDown;
|
|
41056
40992
|
exports.DatePicker = DatePicker;
|
|
40993
|
+
exports.DatePickerView = DatePickerView;
|
|
41057
40994
|
exports.Dialog = BaseDialog;
|
|
41058
40995
|
exports.Divider = Divider;
|
|
41059
40996
|
exports.Drag = Drag;
|
|
@@ -41103,15 +41040,12 @@
|
|
|
41103
41040
|
exports.ShortPassword = ShortPassword;
|
|
41104
41041
|
exports.SideBar = SideBar;
|
|
41105
41042
|
exports.SideBarItem = SideBarItem;
|
|
41106
|
-
exports.SideNavBar = SideNavBar;
|
|
41107
|
-
exports.SideNavBarItem = SideNavBarItem;
|
|
41108
41043
|
exports.Signature = Signature;
|
|
41109
41044
|
exports.Skeleton = Skeleton;
|
|
41110
41045
|
exports.Space = Space;
|
|
41111
41046
|
exports.Step = Step;
|
|
41112
41047
|
exports.Steps = Steps;
|
|
41113
41048
|
exports.Sticky = Sticky;
|
|
41114
|
-
exports.SubSideNavBar = SubSideNavBar;
|
|
41115
41049
|
exports.Swipe = Swipe;
|
|
41116
41050
|
exports.Swiper = InnerSwiper;
|
|
41117
41051
|
exports.SwiperItem = SwiperItem;
|