@nutui/nutui-react 3.0.8 → 3.0.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -14
- package/dist/cjs/hooks/index.d.ts +12 -0
- package/dist/cjs/hooks/index.js +17 -0
- package/dist/cjs/hooks/index.taro.js +19 -0
- package/dist/cjs/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
- package/dist/cjs/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
- package/dist/cjs/hooks/use-memo.d.ts +1 -1
- package/dist/cjs/hooks/use-memo.js +1 -1
- package/dist/cjs/hooks/use-refs.d.ts +1 -1
- package/dist/cjs/hooks/use-refs.js +1 -1
- package/dist/cjs/hooks/use-uuid.d.ts +1 -1
- package/dist/cjs/hooks/use-uuid.js +1 -1
- package/dist/cjs/hooks/use-watch.d.ts +2 -2
- package/dist/cjs/hooks/use-watch.js +2 -3
- package/dist/cjs/packages/avatarcropper/avatarcropper.js +2 -2
- package/dist/cjs/packages/configprovider/configprovider.js +4 -4
- package/dist/cjs/packages/noticebar/noticebar.js +4 -4
- package/dist/cjs/packages/nutui.react.build.d.ts +2 -0
- package/dist/cjs/packages/nutui.react.build.js +2 -0
- package/dist/cjs/packages/nutui.react.d.ts +2 -0
- package/dist/cjs/packages/nutui.react.js +2 -0
- package/dist/cjs/packages/picker/picker.js +2 -2
- package/dist/cjs/packages/popover/popover.js +2 -2
- package/dist/cjs/packages/range/range.js +3 -3
- package/dist/cjs/packages/rate/rate.js +4 -4
- package/dist/cjs/packages/sticky/sticky.js +9 -9
- package/dist/cjs/packages/swipe/swipe.js +2 -2
- package/dist/cjs/packages/tour/tour.js +2 -2
- package/dist/cjs/utils/clamp.d.ts +1 -0
- package/dist/cjs/utils/clamp.js +13 -0
- package/dist/cjs/utils/index.d.ts +28 -6
- package/dist/cjs/utils/index.js +29 -54
- package/dist/cjs/utils/index.taro.js +39 -0
- package/dist/cjs/utils/interceptor.js +2 -2
- package/dist/cjs/utils/is-function.d.ts +1 -0
- package/dist/cjs/utils/is-function.js +14 -0
- package/dist/cjs/utils/is-object.d.ts +1 -0
- package/dist/cjs/utils/is-object.js +14 -0
- package/dist/cjs/utils/is-promise.d.ts +1 -0
- package/dist/cjs/utils/is-promise.js +15 -0
- package/dist/cjs/utils/lru.d.ts +1 -1
- package/dist/cjs/utils/lru.js +1 -1
- package/dist/cjs/utils/merge.d.ts +0 -1
- package/dist/cjs/utils/merge.js +0 -4
- package/dist/cjs/utils/prevent-default.d.ts +1 -0
- package/dist/cjs/utils/prevent-default.js +18 -0
- package/dist/cjs/utils/raf.d.ts +0 -1
- package/dist/cjs/utils/raf.js +3 -6
- package/dist/{es/utils → cjs/utils/taro}/add-color-for-harmony.d.ts +1 -2
- package/dist/cjs/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +5 -11
- package/dist/cjs/utils/taro/get-rect-by-id.d.ts +1 -0
- package/dist/cjs/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +3 -3
- package/dist/cjs/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
- package/dist/cjs/utils/{get-rect-by-taro.js → taro/get-rect.js} +9 -10
- package/dist/cjs/utils/taro/px-transform.d.ts +1 -0
- package/dist/cjs/utils/{px-transform.js → taro/px-transform.js} +3 -3
- package/dist/cjs/utils/upper-case-first.d.ts +1 -0
- package/dist/cjs/utils/upper-case-first.js +17 -0
- package/dist/es/hooks/index.d.ts +12 -0
- package/dist/es/hooks/index.js +12 -0
- package/dist/es/hooks/index.taro.js +14 -0
- package/dist/es/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
- package/dist/es/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
- package/dist/es/hooks/use-memo.d.ts +1 -1
- package/dist/es/hooks/use-memo.js +1 -1
- package/dist/es/hooks/use-refs.d.ts +1 -1
- package/dist/es/hooks/use-refs.js +1 -1
- package/dist/es/hooks/use-uuid.d.ts +1 -1
- package/dist/es/hooks/use-uuid.js +1 -1
- package/dist/es/hooks/use-watch.d.ts +2 -2
- package/dist/es/hooks/use-watch.js +1 -2
- package/dist/es/packages/avatarcropper/avatarcropper.js +1 -1
- package/dist/es/packages/configprovider/configprovider.js +2 -2
- package/dist/es/packages/noticebar/noticebar.js +1 -1
- package/dist/es/packages/nutui.react.build.d.ts +2 -0
- package/dist/es/packages/nutui.react.build.js +2 -0
- package/dist/es/packages/picker/picker.js +1 -1
- package/dist/es/packages/popover/popover.js +1 -1
- package/dist/es/packages/range/range.js +1 -1
- package/dist/es/packages/rate/rate.js +2 -2
- package/dist/es/packages/sticky/sticky.js +2 -2
- package/dist/es/packages/swipe/swipe.js +1 -1
- package/dist/es/packages/tour/tour.js +1 -1
- package/dist/es/utils/clamp.d.ts +1 -0
- package/dist/es/utils/clamp.js +3 -0
- package/dist/es/utils/index.d.ts +28 -6
- package/dist/es/utils/index.js +28 -29
- package/dist/es/utils/index.taro.js +34 -0
- package/dist/es/utils/interceptor.js +1 -1
- package/dist/es/utils/is-function.d.ts +1 -0
- package/dist/es/utils/is-function.js +4 -0
- package/dist/es/utils/is-object.d.ts +1 -0
- package/dist/es/utils/is-object.js +4 -0
- package/dist/es/utils/is-promise.d.ts +1 -0
- package/dist/es/utils/is-promise.js +5 -0
- package/dist/es/utils/lru.d.ts +1 -1
- package/dist/es/utils/lru.js +1 -2
- package/dist/es/utils/merge.d.ts +0 -1
- package/dist/es/utils/merge.js +0 -1
- package/dist/es/utils/prevent-default.d.ts +1 -0
- package/dist/es/utils/prevent-default.js +8 -0
- package/dist/es/utils/raf.d.ts +0 -1
- package/dist/es/utils/raf.js +1 -1
- package/dist/{cjs/utils → es/utils/taro}/add-color-for-harmony.d.ts +1 -2
- package/dist/es/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +2 -3
- package/dist/es/utils/taro/get-rect-by-id.d.ts +1 -0
- package/dist/es/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +1 -1
- package/dist/es/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
- package/dist/es/utils/{get-rect-by-taro.js → taro/get-rect.js} +4 -4
- package/dist/es/utils/taro/px-transform.d.ts +1 -0
- package/dist/es/utils/{px-transform.js → taro/px-transform.js} +2 -2
- package/dist/es/utils/upper-case-first.d.ts +1 -0
- package/dist/es/utils/upper-case-first.js +7 -0
- package/dist/nutui.react.umd.js +961 -724
- package/dist/style.css +1 -1
- package/dist/style.scss +45 -45
- package/package.json +1 -1
- package/dist/cjs/hooks/use-taro-rect.d.ts +0 -1
- package/dist/cjs/utils/px-transform.d.ts +0 -1
- package/dist/es/hooks/use-taro-rect.d.ts +0 -1
- package/dist/es/utils/px-transform.d.ts +0 -1
- /package/dist/cjs/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
- /package/dist/cjs/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
- /package/dist/cjs/utils/{test/event.d.ts → event-mocker.d.ts} +0 -0
- /package/dist/cjs/utils/{test/event.js → event-mocker.js} +0 -0
- /package/dist/cjs/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
- /package/dist/cjs/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
- /package/dist/cjs/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
- /package/dist/cjs/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
- /package/dist/cjs/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
- /package/dist/cjs/utils/{platform-taro.js → taro/platform.js} +0 -0
- /package/dist/es/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
- /package/dist/es/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
- /package/dist/es/utils/{test/event.d.ts → event-mocker.d.ts} +0 -0
- /package/dist/es/utils/{test/event.js → event-mocker.js} +0 -0
- /package/dist/es/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
- /package/dist/es/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
- /package/dist/es/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
- /package/dist/es/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
- /package/dist/es/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
- /package/dist/es/utils/{platform-taro.js → taro/platform.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
var _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./taro/add-color-for-harmony"), exports);
|
|
7
|
+
_export_star._(require("./bound"), exports);
|
|
8
|
+
_export_star._(require("./camel-case"), exports);
|
|
9
|
+
_export_star._(require("./can-use-dom"), exports);
|
|
10
|
+
_export_star._(require("./clamp"), exports);
|
|
11
|
+
_export_star._(require("./date"), exports);
|
|
12
|
+
_export_star._(require("./taro/get-rect"), exports);
|
|
13
|
+
_export_star._(require("./taro/get-rect-by-id"), exports);
|
|
14
|
+
_export_star._(require("./get-rect"), exports);
|
|
15
|
+
_export_star._(require("./get-scroll-parent"), exports);
|
|
16
|
+
_export_star._(require("./taro/get-system-info"), exports);
|
|
17
|
+
_export_star._(require("./interceptor"), exports);
|
|
18
|
+
_export_star._(require("./is-date"), exports);
|
|
19
|
+
_export_star._(require("./is-empty"), exports);
|
|
20
|
+
_export_star._(require("./is-forward-ref-component"), exports);
|
|
21
|
+
_export_star._(require("./is-function"), exports);
|
|
22
|
+
_export_star._(require("./is-object"), exports);
|
|
23
|
+
_export_star._(require("./is-promise"), exports);
|
|
24
|
+
_export_star._(require("./lru"), exports);
|
|
25
|
+
_export_star._(require("./merge"), exports);
|
|
26
|
+
_export_star._(require("./merge-props"), exports);
|
|
27
|
+
_export_star._(require("./pad-zero"), exports);
|
|
28
|
+
_export_star._(require("./taro/platform"), exports);
|
|
29
|
+
_export_star._(require("./prevent-default"), exports);
|
|
30
|
+
_export_star._(require("./px-check"), exports);
|
|
31
|
+
_export_star._(require("./taro/px-transform"), exports);
|
|
32
|
+
_export_star._(require("./raf"), exports);
|
|
33
|
+
_export_star._(require("./render"), exports);
|
|
34
|
+
_export_star._(require("./rubberband"), exports);
|
|
35
|
+
_export_star._(require("./sleep"), exports);
|
|
36
|
+
_export_star._(require("./supports-passive"), exports);
|
|
37
|
+
_export_star._(require("./to-array"), exports);
|
|
38
|
+
_export_star._(require("./typings"), exports);
|
|
39
|
+
_export_star._(require("./upper-case-first"), exports);
|
|
@@ -8,13 +8,13 @@ Object.defineProperty(exports, "funcInterceptor", {
|
|
|
8
8
|
return funcInterceptor;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
11
|
+
var _ispromise = require("./is-promise");
|
|
12
12
|
var funcInterceptor = function funcInterceptor(interceptor, param) {
|
|
13
13
|
var _param_args = param.args, args = _param_args === void 0 ? [] : _param_args, done = param.done, canceled = param.canceled;
|
|
14
14
|
if (interceptor) {
|
|
15
15
|
// eslint-disable-next-line prefer-spread
|
|
16
16
|
var returnVal = interceptor.apply(null, args);
|
|
17
|
-
if ((0,
|
|
17
|
+
if ((0, _ispromise.isPromise)(returnVal)) {
|
|
18
18
|
returnVal.then(function(value) {
|
|
19
19
|
if (value) {
|
|
20
20
|
done(value);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isFunction: (val: unknown) => val is Function;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "isFunction", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function() {
|
|
9
|
+
return isFunction;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var isFunction = function isFunction(val) {
|
|
13
|
+
return typeof val === 'function';
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isObject", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isObject;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _type_of = require("@swc/helpers/_/_type_of");
|
|
12
|
+
var isObject = function isObject(val) {
|
|
13
|
+
return val !== null && (typeof val === "undefined" ? "undefined" : (0, _type_of._)(val)) === 'object';
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "isPromise", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return isPromise;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _isobject = require("./is-object");
|
|
12
|
+
var _isfunction = require("./is-function");
|
|
13
|
+
var isPromise = function isPromise(val) {
|
|
14
|
+
return (0, _isobject.isObject)(val) && (0, _isfunction.isFunction)(val.then) && (0, _isfunction.isFunction)(val.catch);
|
|
15
|
+
};
|
package/dist/cjs/utils/lru.d.ts
CHANGED
package/dist/cjs/utils/lru.js
CHANGED
package/dist/cjs/utils/merge.js
CHANGED
|
@@ -12,9 +12,6 @@ _export(exports, {
|
|
|
12
12
|
clone: function() {
|
|
13
13
|
return clone;
|
|
14
14
|
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
},
|
|
18
15
|
isPlainObject: function() {
|
|
19
16
|
return isPlainObject;
|
|
20
17
|
},
|
|
@@ -30,7 +27,6 @@ _export(exports, {
|
|
|
30
27
|
});
|
|
31
28
|
var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
|
|
32
29
|
var _type_of = require("@swc/helpers/_/_type_of");
|
|
33
|
-
var _default = main;
|
|
34
30
|
function main() {
|
|
35
31
|
for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
|
|
36
32
|
items[_key] = arguments[_key];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function preventDefault(event: React.TouchEvent<HTMLElement> | TouchEvent, isStopPropagation?: boolean): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "preventDefault", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return preventDefault;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function preventDefault(event, isStopPropagation) {
|
|
12
|
+
if (typeof event.cancelable !== 'boolean' || event.cancelable) {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
}
|
|
15
|
+
if (isStopPropagation) {
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/cjs/utils/raf.d.ts
CHANGED
package/dist/cjs/utils/raf.js
CHANGED
|
@@ -14,15 +14,12 @@ _export(exports, {
|
|
|
14
14
|
},
|
|
15
15
|
default: function() {
|
|
16
16
|
return _default;
|
|
17
|
-
},
|
|
18
|
-
inBrowser: function() {
|
|
19
|
-
return inBrowser;
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
|
-
var
|
|
19
|
+
var _getrect = require("./get-rect");
|
|
23
20
|
// 防频
|
|
24
21
|
function requestAniFrame() {
|
|
25
|
-
if (inBrowser) {
|
|
22
|
+
if (_getrect.inBrowser) {
|
|
26
23
|
var _window = window;
|
|
27
24
|
return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
|
|
28
25
|
_window.setTimeout(callback, 1000 / 60);
|
|
@@ -33,7 +30,7 @@ function requestAniFrame() {
|
|
|
33
30
|
};
|
|
34
31
|
}
|
|
35
32
|
function cancelRaf(id) {
|
|
36
|
-
if (inBrowser) {
|
|
33
|
+
if (_getrect.inBrowser) {
|
|
37
34
|
var _window = window;
|
|
38
35
|
(_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
|
|
39
36
|
} else {
|
|
@@ -5,5 +5,4 @@ import React, { ReactNode } from 'react';
|
|
|
5
5
|
* @param color - 要添加的颜色值(如:'#ff0000')
|
|
6
6
|
* @returns 处理后的 React 节点
|
|
7
7
|
*/
|
|
8
|
-
declare function addColorForHarmony(maybeElement: ReactNode, color?: string): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
|
|
9
|
-
export default addColorForHarmony;
|
|
8
|
+
export declare function addColorForHarmony(maybeElement: ReactNode, color?: string): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
|
|
@@ -2,26 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "addColorForHarmony", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
|
-
return
|
|
8
|
+
return addColorForHarmony;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
12
12
|
var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* @param maybeElement - 要处理的 React 节点
|
|
17
|
-
* @param color - 要添加的颜色值(如:'#ff0000')
|
|
18
|
-
* @returns 处理后的 React 节点
|
|
19
|
-
*/ function addColorForHarmony(maybeElement, color) {
|
|
20
|
-
if (/*#__PURE__*/ _react.default.isValidElement(maybeElement) && (0, _platformtaro.harmony)()) {
|
|
13
|
+
var _platform = require("./platform");
|
|
14
|
+
function addColorForHarmony(maybeElement, color) {
|
|
15
|
+
if (/*#__PURE__*/ _react.default.isValidElement(maybeElement) && (0, _platform.harmony)()) {
|
|
21
16
|
return /*#__PURE__*/ _react.default.cloneElement(maybeElement, {
|
|
22
17
|
color: color
|
|
23
18
|
});
|
|
24
19
|
}
|
|
25
20
|
return maybeElement;
|
|
26
21
|
}
|
|
27
|
-
var _default = addColorForHarmony;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRectById: (id: string) => Promise<unknown>;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "getRectById", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
|
-
return
|
|
8
|
+
return getRectById;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
var _taro = /*#__PURE__*/ _interop_require_wildcard._(require("@tarojs/taro"));
|
|
13
|
-
var
|
|
13
|
+
var getRectById = function getRectById(id) {
|
|
14
14
|
return new Promise(function(resolve, reject) {
|
|
15
15
|
if (_taro.default.getEnv() === _taro.default.ENV_TYPE.WEB) {
|
|
16
16
|
var t = document ? document.querySelector("#".concat(id)) : '';
|
|
@@ -9,4 +9,4 @@ export interface Rect {
|
|
|
9
9
|
height: number;
|
|
10
10
|
}
|
|
11
11
|
export declare function makeRect(width: number, height: number): Rect;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const getRectInMultiPlatform: (element: any, harmonyId?: string) => Promise<Rect>;
|
|
@@ -9,21 +9,20 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
return
|
|
12
|
+
getRectInMultiPlatform: function() {
|
|
13
|
+
return getRectInMultiPlatform;
|
|
14
14
|
},
|
|
15
15
|
makeRect: function() {
|
|
16
16
|
return makeRect;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
19
|
var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
|
|
21
20
|
var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
|
|
22
21
|
var _ts_generator = require("@swc/helpers/_/_ts_generator");
|
|
23
22
|
var _taro = require("@tarojs/taro");
|
|
24
|
-
var _lru =
|
|
25
|
-
var
|
|
26
|
-
var lru = new _lru.
|
|
23
|
+
var _lru = require("../lru");
|
|
24
|
+
var _getrect = require("../get-rect");
|
|
25
|
+
var lru = new _lru.MiniLru(10);
|
|
27
26
|
function makeRect(width, height) {
|
|
28
27
|
return {
|
|
29
28
|
top: 0,
|
|
@@ -34,17 +33,17 @@ function makeRect(width, height) {
|
|
|
34
33
|
height: height
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
|
-
var
|
|
36
|
+
var getRectInMultiPlatform = /*#__PURE__*/ function() {
|
|
38
37
|
var _ref = (0, _async_to_generator._)(function(element) {
|
|
39
38
|
var harmonyId;
|
|
40
39
|
var _arguments = arguments;
|
|
41
40
|
return (0, _ts_generator._)(this, function(_state) {
|
|
42
41
|
harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
|
|
43
42
|
if (element) {
|
|
44
|
-
if (
|
|
43
|
+
if (_getrect.inBrowser) {
|
|
45
44
|
return [
|
|
46
45
|
2,
|
|
47
|
-
Promise.resolve((0,
|
|
46
|
+
Promise.resolve((0, _getrect.getRect)(element))
|
|
48
47
|
];
|
|
49
48
|
}
|
|
50
49
|
// 小程序下的逻辑
|
|
@@ -71,7 +70,7 @@ var getRectByTaro = /*#__PURE__*/ function() {
|
|
|
71
70
|
];
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
|
-
return function
|
|
73
|
+
return function getRectInMultiPlatform(element) {
|
|
75
74
|
return _ref.apply(this, arguments);
|
|
76
75
|
};
|
|
77
76
|
}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function pxTransform(value: number, radix?: number): any;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "pxTransform", {
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: function() {
|
|
8
8
|
return pxTransform;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
var _taro = require("@tarojs/taro");
|
|
12
|
-
var
|
|
12
|
+
var _platform = require("./platform");
|
|
13
13
|
function pxTransform(value, radix) {
|
|
14
14
|
// @ts-ignore
|
|
15
|
-
if ((0,
|
|
15
|
+
if ((0, _platform.harmony)()) return (0, _taro.pxTransform)(value, radix || 375);
|
|
16
16
|
return "".concat(value, "px");
|
|
17
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const upperCaseFirst: (str: string) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "upperCaseFirst", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return upperCaseFirst;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var upperCaseFirst = function upperCaseFirst(str) {
|
|
12
|
+
str = str.toLowerCase();
|
|
13
|
+
str = str.replace(/\b\w+\b/g, function(word) {
|
|
14
|
+
return word.substring(0, 1).toUpperCase() + word.substring(1);
|
|
15
|
+
});
|
|
16
|
+
return str;
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './use-click-away';
|
|
2
|
+
export * from './use-force-update';
|
|
3
|
+
export * from './use-isomprphic-layout-effect';
|
|
4
|
+
export * from './use-lock-scroll';
|
|
5
|
+
export * from './use-memo';
|
|
6
|
+
export * from './use-pagination';
|
|
7
|
+
export * from './use-props-value';
|
|
8
|
+
export * from './use-ref-state';
|
|
9
|
+
export * from './use-refs';
|
|
10
|
+
export * from './use-touch';
|
|
11
|
+
export * from './use-uuid';
|
|
12
|
+
export * from './use-watch';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./use-click-away";
|
|
2
|
+
export * from "./use-force-update";
|
|
3
|
+
export * from "./use-isomprphic-layout-effect";
|
|
4
|
+
export * from "./use-lock-scroll";
|
|
5
|
+
export * from "./use-memo";
|
|
6
|
+
export * from "./use-pagination";
|
|
7
|
+
export * from "./use-props-value";
|
|
8
|
+
export * from "./use-ref-state";
|
|
9
|
+
export * from "./use-refs";
|
|
10
|
+
export * from "./use-touch";
|
|
11
|
+
export * from "./use-uuid";
|
|
12
|
+
export * from "./use-watch";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./use-click-away";
|
|
2
|
+
export * from "./taro/use-custom-event";
|
|
3
|
+
export * from "./use-force-update";
|
|
4
|
+
export * from "./use-isomprphic-layout-effect";
|
|
5
|
+
export * from "./taro/use-lock-scoll";
|
|
6
|
+
export * from "./use-lock-scroll";
|
|
7
|
+
export * from "./use-memo";
|
|
8
|
+
export * from "./use-pagination";
|
|
9
|
+
export * from "./use-props-value";
|
|
10
|
+
export * from "./use-ref-state";
|
|
11
|
+
export * from "./use-refs";
|
|
12
|
+
export * from "./use-touch";
|
|
13
|
+
export * from "./use-uuid";
|
|
14
|
+
export * from "./use-watch";
|
|
@@ -2,7 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import isEqual from "react-fast-compare";
|
|
4
4
|
import { Events, getCurrentInstance } from "@tarojs/taro";
|
|
5
|
-
import { useForceUpdate } from "
|
|
5
|
+
import { useForceUpdate } from "../use-force-update";
|
|
6
6
|
export var customEvents = new Events();
|
|
7
7
|
export function useCustomEventsPath(selector) {
|
|
8
8
|
var _getCurrentInstance_router;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
2
|
import { getEnv } from "@tarojs/taro";
|
|
3
|
-
import { useLockScroll } from "
|
|
3
|
+
import { useLockScroll } from "../use-lock-scroll";
|
|
4
4
|
export var useLockScrollTaro = function(shouldLock) {
|
|
5
5
|
var refObject = useRef(null);
|
|
6
6
|
if (getEnv() === 'WEB') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function useMemo<Value, Condition = any[]>(getValue: () => Value, condition: Condition, shouldUpdate: (prev: Condition, next: Condition) => boolean): Value | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export
|
|
2
|
+
export function useMemo(getValue, condition, shouldUpdate) {
|
|
3
3
|
var cacheRef = React.useRef({});
|
|
4
4
|
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
5
5
|
cacheRef.current.value = getValue();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function useRefs(): any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function useUuid(): string;
|
|
@@ -2,5 +2,5 @@ type Callback<T> = (prev: T | undefined) => void;
|
|
|
2
2
|
type Config = {
|
|
3
3
|
immediate: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare function useWatch<T>(dep: T, callback: Callback<T>, config?: Config): () => void;
|
|
6
|
-
export
|
|
5
|
+
export declare function useWatch<T>(dep: T, callback: Callback<T>, config?: Config): () => void;
|
|
6
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
|
-
function useWatch(dep, callback) {
|
|
2
|
+
export function useWatch(dep, callback) {
|
|
3
3
|
var config = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
4
4
|
immediate: false
|
|
5
5
|
};
|
|
@@ -29,4 +29,3 @@ function useWatch(dep, callback) {
|
|
|
29
29
|
stop.current = true;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export default useWatch;
|
|
@@ -10,7 +10,7 @@ import Button from "../button";
|
|
|
10
10
|
import { ComponentDefaults } from "../../utils/typings";
|
|
11
11
|
import { useTouch } from "../../hooks/use-touch";
|
|
12
12
|
import { clamp, preventDefault } from "../../utils";
|
|
13
|
-
import { getRect } from "../../
|
|
13
|
+
import { getRect } from "../../utils/get-rect";
|
|
14
14
|
import { useConfig } from "../configprovider";
|
|
15
15
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
16
16
|
maxZoom: 3,
|
|
@@ -5,9 +5,9 @@ import React, { createContext, useContext } from "react";
|
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import kebabCase from "lodash.kebabcase";
|
|
7
7
|
import isEqual from "react-fast-compare";
|
|
8
|
-
import useMemo from "../../hooks/use-memo";
|
|
8
|
+
import { useMemo } from "../../hooks/use-memo";
|
|
9
9
|
import zhCN from "../../locales/zh-CN";
|
|
10
|
-
import { inBrowser } from "../../utils
|
|
10
|
+
import { inBrowser } from "../../utils";
|
|
11
11
|
var classPrefix = 'nut-configprovider';
|
|
12
12
|
export var defaultConfigRef = {
|
|
13
13
|
current: {
|
|
@@ -5,7 +5,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
5
5
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Close, Notice } from "@nutui/icons-react";
|
|
7
7
|
import classNames from "classnames";
|
|
8
|
-
import { getRect } from "../../
|
|
8
|
+
import { getRect } from "../../utils/get-rect";
|
|
9
9
|
import { ComponentDefaults } from "../../utils/typings";
|
|
10
10
|
import { useRtl } from "../configprovider";
|
|
11
11
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
@@ -207,4 +207,6 @@ export * from "./trendarrow";
|
|
|
207
207
|
import WaterMark from "./watermark";
|
|
208
208
|
export * from "./watermark";
|
|
209
209
|
export * from "../types";
|
|
210
|
+
export * from "../utils";
|
|
211
|
+
export * from "../hooks";
|
|
210
212
|
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Divider, Grid, GridItem, Layout, Col, Row, SafeArea, Space, Sticky, BackTop, Elevator, FixedNav, HoverButton, HoverButtonItem, NavBar, SideBar, SideBarItem, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, CalendarCard, Cascader, Checkbox, CheckboxGroup, DatePicker, DatePickerView, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, PickerView, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty, InfiniteLoading, Loading, NoticeBar, Notify, Popover, Popup, PullToRefresh, ResultPage, Skeleton, Swipe, Toast, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, CircleProgress, Collapse, CollapseItem, CountDown, Ellipsis, ImagePreview, Indicator, Lottie, Pagination, Price, Progress, Segmented, Step, Steps, Swiper, SwiperItem, Table, Tag, Tour, Video, VirtualList, AvatarCropper, Barrage, Card, TimeDetail, TimeSelect, TrendArrow, WaterMark };
|
|
@@ -207,4 +207,6 @@ export * from "./trendarrow";
|
|
|
207
207
|
import WaterMark from "./watermark";
|
|
208
208
|
export * from "./watermark";
|
|
209
209
|
export * from "../types";
|
|
210
|
+
export * from "../utils";
|
|
211
|
+
export * from "../hooks";
|
|
210
212
|
export { Button, Cell, CellGroup, ConfigProvider, Image, Overlay, Divider, Grid, GridItem, Layout, Col, Row, SafeArea, Space, Sticky, BackTop, Elevator, FixedNav, HoverButton, HoverButtonItem, NavBar, SideBar, SideBarItem, Tabbar, TabbarItem, TabPane, Tabs, Address, Calendar, CalendarItem, CalendarCard, Cascader, Checkbox, CheckboxGroup, DatePicker, DatePickerView, Form, FormItem, Input, InputNumber, Menu, MenuItem, NumberKeyboard, Picker, PickerView, Radio, RadioGroup, Range, Rate, SearchBar, ShortPassword, Signature, Switch, TextArea, Uploader, ActionSheet, Badge, Dialog, Drag, Empty, InfiniteLoading, Loading, NoticeBar, Notify, Popover, Popup, PullToRefresh, ResultPage, Skeleton, Swipe, Toast, Animate, AnimatingNumbers, Audio, Avatar, AvatarGroup, CircleProgress, Collapse, CollapseItem, CountDown, Ellipsis, ImagePreview, Indicator, Lottie, Pagination, Price, Progress, Segmented, Step, Steps, Swiper, SwiperItem, Table, Tag, Tour, Video, VirtualList, AvatarCropper, Barrage, Card, TimeDetail, TimeSelect, TrendArrow, WaterMark };
|
|
@@ -9,7 +9,7 @@ import isEqual from "react-fast-compare";
|
|
|
9
9
|
import PickerView from "../pickerview/index";
|
|
10
10
|
import Popup from "../popup/index";
|
|
11
11
|
import SafeArea from "../safearea/index";
|
|
12
|
-
import useRefs from "../../hooks/use-refs";
|
|
12
|
+
import { useRefs } from "../../hooks/use-refs";
|
|
13
13
|
import { useConfig } from "../configprovider";
|
|
14
14
|
import { usePropsValue } from "../../hooks/use-props-value";
|
|
15
15
|
import { ComponentDefaults } from "../../utils/typings";
|
|
@@ -8,7 +8,7 @@ import classNames from "classnames";
|
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
import { ArrowRadius } from "@nutui/icons-react";
|
|
10
10
|
import Popup from "../popup/index";
|
|
11
|
-
import { getRect } from "../../
|
|
11
|
+
import { getRect } from "../../utils/get-rect";
|
|
12
12
|
import { ComponentDefaults } from "../../utils/typings";
|
|
13
13
|
import useClickAway from "../../hooks/use-click-away";
|
|
14
14
|
import { canUseDom } from "../../utils/can-use-dom";
|
|
@@ -5,7 +5,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import classNames from "classnames";
|
|
7
7
|
import { useTouch } from "../../hooks/use-touch";
|
|
8
|
-
import { getRect } from "../../
|
|
8
|
+
import { getRect } from "../../utils/get-rect";
|
|
9
9
|
import { ComponentDefaults } from "../../utils/typings";
|
|
10
10
|
import { usePropsValue } from "../../hooks/use-props-value";
|
|
11
11
|
import { useRtl } from "../configprovider";
|
|
@@ -7,8 +7,8 @@ import classNames from "classnames";
|
|
|
7
7
|
import { StarFill } from "@nutui/icons-react";
|
|
8
8
|
import { ComponentDefaults } from "../../utils/typings";
|
|
9
9
|
import { usePropsValue } from "../../hooks/use-props-value";
|
|
10
|
-
import { getRect } from "../../
|
|
11
|
-
import useRefs from "../../hooks/use-refs";
|
|
10
|
+
import { getRect } from "../../utils/get-rect";
|
|
11
|
+
import { useRefs } from "../../hooks/use-refs";
|
|
12
12
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
13
13
|
size: 'normal',
|
|
14
14
|
showScore: false,
|
|
@@ -6,8 +6,8 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
|
6
6
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import classNames from "classnames";
|
|
8
8
|
import { getScrollParent } from "../../utils/get-scroll-parent";
|
|
9
|
-
import { getRect } from "../../
|
|
10
|
-
import useWatch from "../../hooks/use-watch";
|
|
9
|
+
import { getRect } from "../../utils/get-rect";
|
|
10
|
+
import { useWatch } from "../../hooks/use-watch";
|
|
11
11
|
import { ComponentDefaults } from "../../utils/typings";
|
|
12
12
|
var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
13
13
|
position: 'top',
|