@tarojs/components-advanced 3.6.0-beta.1 → 3.6.0-beta.2
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/dist/components/virtual-list/index.js +1 -1
- package/dist/components/virtual-list/list-set.js +1 -2
- package/dist/components/virtual-list/preset.d.ts +1 -0
- package/dist/components/virtual-list/react/index.js +4 -0
- package/dist/components/virtual-list/react/list.js +1 -2
- package/dist/components/virtual-list/react/validate.js +3 -4
- package/dist/components/virtual-list/vue/list.js +8 -9
- package/dist/components/virtual-list/vue/render.js +1 -2
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +4 -4
- package/dist/utils/constants.d.ts +0 -4
- package/dist/utils/constants.js +0 -4
|
@@ -98,6 +98,6 @@
|
|
|
98
98
|
* @see https://taro-docs.jd.com/docs/virtual-list
|
|
99
99
|
*/
|
|
100
100
|
|
|
101
|
-
var VirtualList = process.env.FRAMEWORK
|
|
101
|
+
var VirtualList = process.env.FRAMEWORK === 'vue' || process.env.FRAMEWORK === 'vue3' ? require('./vue').default : require('./react').default;
|
|
102
102
|
export { VirtualList };
|
|
103
103
|
export default VirtualList;
|
|
@@ -4,7 +4,6 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import { isFunction } from '@tarojs/shared';
|
|
7
|
-
import { IS_PROD } from '../../utils/constants';
|
|
8
7
|
import { isHorizontalFunc } from './utils';
|
|
9
8
|
var ListSet = /*#__PURE__*/function () {
|
|
10
9
|
function ListSet(props, refresh) {
|
|
@@ -62,7 +61,7 @@ var ListSet = /*#__PURE__*/function () {
|
|
|
62
61
|
width = _this$props.width;
|
|
63
62
|
var isHorizontal = isHorizontalFunc(this.props);
|
|
64
63
|
var size = isHorizontal ? width : height;
|
|
65
|
-
if (
|
|
64
|
+
if (process.env.NODE_ENV !== 'production' && typeof size !== 'number') {
|
|
66
65
|
console.warn("In mode ".concat(isHorizontal ? 'horizontal, width' : 'vertical, height', " parameter should be a number, but got ").concat(_typeof(size), "."));
|
|
67
66
|
}
|
|
68
67
|
return size;
|
|
@@ -3,6 +3,7 @@ import ListSet from './list-set';
|
|
|
3
3
|
import { defaultItemKey } from './utils';
|
|
4
4
|
import type { VirtualListProps } from './';
|
|
5
5
|
export interface IProps extends Partial<VirtualListProps> {
|
|
6
|
+
children?: VirtualListProps['item'];
|
|
6
7
|
direction?: 'ltr' | 'rtl' | 'horizontal' | 'vertical';
|
|
7
8
|
itemKey?: typeof defaultItemKey;
|
|
8
9
|
itemTagName?: string;
|
|
@@ -45,6 +45,10 @@ var VirtualList = React.forwardRef(function VirtualList(props, ref) {
|
|
|
45
45
|
_ref2$overscanCount = _ref2.overscanCount,
|
|
46
46
|
overscanCount = _ref2$overscanCount === void 0 ? 1 : _ref2$overscanCount,
|
|
47
47
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
48
|
+
if ('children' in rest) {
|
|
49
|
+
console.warn('Taro(VirtualList): children props have been deprecated. ' + 'Please use the item props instead.');
|
|
50
|
+
rest.item = rest.children;
|
|
51
|
+
}
|
|
48
52
|
if (rest.item instanceof Array) {
|
|
49
53
|
console.warn('Taro(VirtualList): item should not be an array');
|
|
50
54
|
rest.item = rest.item[0];
|
|
@@ -11,7 +11,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
11
11
|
var _excluded = ["className", "direction", "height", "innerRef", "item", "itemCount", "itemData", "itemKey", "layout", "style", "useIsScrolling", "width", "renderTop", "renderBottom"];
|
|
12
12
|
import memoizeOne from 'memoize-one';
|
|
13
13
|
import React from 'react';
|
|
14
|
-
import { IS_PREACT } from '../../../utils/constants';
|
|
15
14
|
import { convertNumber2PX } from '../../../utils/convert';
|
|
16
15
|
import { omit } from '../../../utils/lodash';
|
|
17
16
|
import { cancelTimeout, requestTimeout } from '../../../utils/timer';
|
|
@@ -30,7 +29,7 @@ var List = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30
29
|
_defineProperty(_assertThisInitialized(_this), "itemList", void 0);
|
|
31
30
|
_defineProperty(_assertThisInitialized(_this), "preset", void 0);
|
|
32
31
|
_defineProperty(_assertThisInitialized(_this), "refresh", function () {
|
|
33
|
-
if (
|
|
32
|
+
if (process.env.FRAMEWORK === 'preact') {
|
|
34
33
|
_this.forceUpdate();
|
|
35
34
|
} else {
|
|
36
35
|
_this.setState(function (_ref) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
-
import { IS_PROD } from '../../../utils/constants';
|
|
3
2
|
var devWarningsDirection = null;
|
|
4
3
|
var devWarningsTagName = null;
|
|
5
|
-
if (
|
|
4
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6
5
|
if (typeof window !== 'undefined' && typeof window.WeakSet !== 'undefined') {
|
|
7
6
|
devWarningsDirection = /* #__PURE__ */
|
|
8
7
|
new WeakSet();
|
|
@@ -21,12 +20,12 @@ export var validateListProps = function validateListProps(_ref, _ref2) {
|
|
|
21
20
|
width = _ref.width,
|
|
22
21
|
itemSize = _ref.itemSize;
|
|
23
22
|
var instance = _ref2.instance;
|
|
24
|
-
if (
|
|
23
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
25
24
|
if (!['number', 'function'].includes(_typeof(itemSize))) {
|
|
26
25
|
throw Error('An invalid "itemSize" prop has been specified. ' + 'Value should be a number or function. ' + "\"".concat(itemSize === null ? 'null' : _typeof(itemSize), "\" was specified."));
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
if (
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
29
|
if (innerTagName != null || outerTagName != null || itemTagName != null) {
|
|
31
30
|
if (devWarningsTagName && !devWarningsTagName.has(instance)) {
|
|
32
31
|
devWarningsTagName.add(instance);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import memoizeOne from 'memoize-one';
|
|
4
|
-
import { IS_VUE3, IS_WEB } from '../../../utils/constants';
|
|
5
4
|
import { convertNumber2PX } from '../../../utils/convert';
|
|
6
5
|
import { omit } from '../../../utils/lodash';
|
|
7
6
|
import { cancelTimeout, requestTimeout } from '../../../utils/timer';
|
|
@@ -46,7 +45,7 @@ export default {
|
|
|
46
45
|
},
|
|
47
46
|
innerElementType: {
|
|
48
47
|
type: String,
|
|
49
|
-
default:
|
|
48
|
+
default: process.env.TARO_ENV === 'h5' ? 'taro-view-core' : 'view'
|
|
50
49
|
},
|
|
51
50
|
direction: {
|
|
52
51
|
type: String,
|
|
@@ -73,15 +72,15 @@ export default {
|
|
|
73
72
|
itemKey: String,
|
|
74
73
|
itemTagName: {
|
|
75
74
|
type: String,
|
|
76
|
-
default:
|
|
75
|
+
default: process.env.TARO_ENV === 'h5' ? 'taro-view-core' : 'view'
|
|
77
76
|
},
|
|
78
77
|
innerTagName: {
|
|
79
78
|
type: String,
|
|
80
|
-
default:
|
|
79
|
+
default: process.env.TARO_ENV === 'h5' ? 'taro-view-core' : 'view'
|
|
81
80
|
},
|
|
82
81
|
outerTagName: {
|
|
83
82
|
type: String,
|
|
84
|
-
default:
|
|
83
|
+
default: process.env.TARO_ENV === 'h5' ? 'taro-scroll-view-core' : 'scroll-view'
|
|
85
84
|
},
|
|
86
85
|
itemElementType: String,
|
|
87
86
|
outerElementType: String,
|
|
@@ -456,7 +455,7 @@ export default {
|
|
|
456
455
|
if (this.preset.isRelative) {
|
|
457
456
|
var _this$$slots$top, _this$$slots, _this$$slots$bottom, _this$$slots2;
|
|
458
457
|
var pre = convertNumber2PX(this.itemList.getOffsetSize(startIndex));
|
|
459
|
-
return _render(this.preset.outerTagName, outerElementProps, [
|
|
458
|
+
return _render(this.preset.outerTagName, outerElementProps, [process.env.FRAMEWORK === 'vue3' ? (_this$$slots$top = (_this$$slots = this.$slots).top) === null || _this$$slots$top === void 0 ? void 0 : _this$$slots$top.call(_this$$slots) : this.$slots.top, _render(this.preset.itemTagName, {
|
|
460
459
|
key: "".concat(id, "-pre"),
|
|
461
460
|
id: "".concat(id, "-pre"),
|
|
462
461
|
style: {
|
|
@@ -471,10 +470,10 @@ export default {
|
|
|
471
470
|
pointerEvents: isScrolling ? 'none' : 'auto',
|
|
472
471
|
position: 'relative'
|
|
473
472
|
}
|
|
474
|
-
}, items),
|
|
473
|
+
}, items), process.env.FRAMEWORK === 'vue3' ? (_this$$slots$bottom = (_this$$slots2 = this.$slots).bottom) === null || _this$$slots$bottom === void 0 ? void 0 : _this$$slots$bottom.call(_this$$slots2) : this.$slots.bottom]);
|
|
475
474
|
} else {
|
|
476
475
|
var _this$$slots$top2, _this$$slots3, _this$$slots$bottom2, _this$$slots4;
|
|
477
|
-
return _render(this.preset.outerTagName, outerElementProps, [
|
|
476
|
+
return _render(this.preset.outerTagName, outerElementProps, [process.env.FRAMEWORK === 'vue3' ? (_this$$slots$top2 = (_this$$slots3 = this.$slots).top) === null || _this$$slots$top2 === void 0 ? void 0 : _this$$slots$top2.call(_this$$slots3) : this.$slots.top, _render(this.preset.innerTagName, {
|
|
478
477
|
ref: innerRef,
|
|
479
478
|
key: "".concat(id, "-inner"),
|
|
480
479
|
id: "".concat(id, "-inner"),
|
|
@@ -484,7 +483,7 @@ export default {
|
|
|
484
483
|
position: 'relative',
|
|
485
484
|
width: !isHorizontal ? '100%' : estimatedTotalSize
|
|
486
485
|
}
|
|
487
|
-
}, items),
|
|
486
|
+
}, items), process.env.FRAMEWORK === 'vue3' ? (_this$$slots$bottom2 = (_this$$slots4 = this.$slots).bottom) === null || _this$$slots$bottom2 === void 0 ? void 0 : _this$$slots$bottom2.call(_this$$slots4) : this.$slots.bottom]);
|
|
488
487
|
}
|
|
489
488
|
}
|
|
490
489
|
};
|
|
@@ -2,7 +2,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["attrs", "on", "props", "slots"];
|
|
4
4
|
import { h } from 'vue';
|
|
5
|
-
import { IS_VUE3 } from '../../../utils/constants';
|
|
6
5
|
export default function (componentName, options, children) {
|
|
7
6
|
var _options$attrs = options.attrs,
|
|
8
7
|
attrs = _options$attrs === void 0 ? {} : _options$attrs,
|
|
@@ -13,7 +12,7 @@ export default function (componentName, options, children) {
|
|
|
13
12
|
_options$slots = options.slots,
|
|
14
13
|
slots = _options$slots === void 0 ? {} : _options$slots,
|
|
15
14
|
el = _objectWithoutProperties(options, _excluded);
|
|
16
|
-
if (
|
|
15
|
+
if (process.env.FRAMEWORK === 'vue3') {
|
|
17
16
|
// Events
|
|
18
17
|
Object.keys(on).forEach(function (key) {
|
|
19
18
|
var name = "on".concat(key.charAt(0).toUpperCase()).concat(key.slice(1));
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components-advanced",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"memoize-one": "^6.0.0",
|
|
16
16
|
"postcss": "^8.4.18",
|
|
17
|
-
"@tarojs/components": "3.6.0-beta.
|
|
18
|
-
"@tarojs/shared": "3.6.0-beta.
|
|
17
|
+
"@tarojs/components": "3.6.0-beta.2",
|
|
18
|
+
"@tarojs/shared": "3.6.0-beta.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/cli": "^7.14.5",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-dom": "^18.2.0",
|
|
27
27
|
"typescript": "^4.7.4",
|
|
28
28
|
"vue": "^3.0.0",
|
|
29
|
-
"babel-preset-taro": "3.6.0-beta.
|
|
29
|
+
"babel-preset-taro": "3.6.0-beta.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": ">=17"
|
package/dist/utils/constants.js
DELETED