@tarojs/components-advanced 3.6.2 → 3.6.4
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/LICENSE +21 -0
- package/dist/_virtual/_commonjsHelpers.js +35 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/arrayLikeToArray.js +7 -0
- package/dist/_virtual/arrayLikeToArray.js.map +1 -0
- package/dist/_virtual/arrayLikeToArray2.js +4 -0
- package/dist/_virtual/arrayLikeToArray2.js.map +1 -0
- package/dist/_virtual/arrayWithoutHoles.js +7 -0
- package/dist/_virtual/arrayWithoutHoles.js.map +1 -0
- package/dist/_virtual/arrayWithoutHoles2.js +4 -0
- package/dist/_virtual/arrayWithoutHoles2.js.map +1 -0
- package/dist/_virtual/assertThisInitialized.js +7 -0
- package/dist/_virtual/assertThisInitialized.js.map +1 -0
- package/dist/_virtual/assertThisInitialized2.js +4 -0
- package/dist/_virtual/assertThisInitialized2.js.map +1 -0
- package/dist/_virtual/classCallCheck.js +4 -0
- package/dist/_virtual/classCallCheck.js.map +1 -0
- package/dist/_virtual/createClass.js +4 -0
- package/dist/_virtual/createClass.js.map +1 -0
- package/dist/_virtual/createSuper.js +4 -0
- package/dist/_virtual/createSuper.js.map +1 -0
- package/dist/_virtual/defineProperty.js +4 -0
- package/dist/_virtual/defineProperty.js.map +1 -0
- package/dist/_virtual/defineProperty2.js +7 -0
- package/dist/_virtual/defineProperty2.js.map +1 -0
- package/dist/_virtual/getPrototypeOf.js +7 -0
- package/dist/_virtual/getPrototypeOf.js.map +1 -0
- package/dist/_virtual/getPrototypeOf2.js +4 -0
- package/dist/_virtual/getPrototypeOf2.js.map +1 -0
- package/dist/_virtual/index.esm.js +7 -0
- package/dist/_virtual/index.esm.js.map +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/inherits.js +4 -0
- package/dist/_virtual/inherits.js.map +1 -0
- package/dist/_virtual/isNativeReflectConstruct.js +7 -0
- package/dist/_virtual/isNativeReflectConstruct.js.map +1 -0
- package/dist/_virtual/isNativeReflectConstruct2.js +4 -0
- package/dist/_virtual/isNativeReflectConstruct2.js.map +1 -0
- package/dist/_virtual/iterableToArray.js +7 -0
- package/dist/_virtual/iterableToArray.js.map +1 -0
- package/dist/_virtual/iterableToArray2.js +4 -0
- package/dist/_virtual/iterableToArray2.js.map +1 -0
- package/dist/_virtual/nonIterableSpread.js +7 -0
- package/dist/_virtual/nonIterableSpread.js.map +1 -0
- package/dist/_virtual/nonIterableSpread2.js +4 -0
- package/dist/_virtual/nonIterableSpread2.js.map +1 -0
- package/dist/_virtual/objectSpread2.js +4 -0
- package/dist/_virtual/objectSpread2.js.map +1 -0
- package/dist/_virtual/possibleConstructorReturn.js +7 -0
- package/dist/_virtual/possibleConstructorReturn.js.map +1 -0
- package/dist/_virtual/possibleConstructorReturn2.js +4 -0
- package/dist/_virtual/possibleConstructorReturn2.js.map +1 -0
- package/dist/_virtual/runtime.esm.js +7 -0
- package/dist/_virtual/runtime.esm.js.map +1 -0
- package/dist/_virtual/setPrototypeOf.js +7 -0
- package/dist/_virtual/setPrototypeOf.js.map +1 -0
- package/dist/_virtual/setPrototypeOf2.js +4 -0
- package/dist/_virtual/setPrototypeOf2.js.map +1 -0
- package/dist/_virtual/toConsumableArray.js +4 -0
- package/dist/_virtual/toConsumableArray.js.map +1 -0
- package/dist/_virtual/typeof.js +4 -0
- package/dist/_virtual/typeof.js.map +1 -0
- package/dist/_virtual/typeof2.js +7 -0
- package/dist/_virtual/typeof2.js.map +1 -0
- package/dist/_virtual/unsupportedIterableToArray.js +7 -0
- package/dist/_virtual/unsupportedIterableToArray.js.map +1 -0
- package/dist/_virtual/unsupportedIterableToArray2.js +4 -0
- package/dist/_virtual/unsupportedIterableToArray2.js.map +1 -0
- package/dist/components/virtual-list/index.d.ts +29 -0
- package/dist/components/virtual-list/index.js.map +1 -1
- package/dist/components/virtual-list/react/index.js +1 -1
- package/dist/components/virtual-list/react/list.js +3 -5
- package/dist/components/virtual-list/react/list.js.map +1 -1
- package/dist/components/virtual-list/utils.js +4 -3
- package/dist/components/virtual-list/utils.js.map +1 -1
- package/dist/components/virtual-list/vue/list.js +8 -6
- package/dist/components/virtual-list/vue/list.js.map +1 -1
- package/dist/components/virtual-list/vue/render.js +1 -1
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +21 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +20 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/assertThisInitialized.js +19 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/assertThisInitialized.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/classCallCheck.js +17 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/classCallCheck.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createClass.js +30 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createClass.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createSuper.js +43 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createSuper.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/defineProperty.js +26 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/defineProperty.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/getPrototypeOf.js +18 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/getPrototypeOf.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/inherits.js +34 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/inherits.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +24 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/iterableToArray.js +15 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/iterableToArray.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/nonIterableSpread.js +15 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/nonIterableSpread.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/objectSpread2.js +42 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/objectSpread2.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +31 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/setPrototypeOf.js +19 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/setPrototypeOf.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/toConsumableArray.js +35 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/toConsumableArray.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/typeof.js +21 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/typeof.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +25 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +1 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js +221 -0
- package/dist/node_modules/.pnpm/registry.npmjs.org_tslib@1.14.1/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/packages/taro/index.js +23 -0
- package/dist/packages/taro/index.js.map +1 -0
- package/dist/packages/taro-api/dist/index.esm.js +861 -0
- package/dist/packages/taro-api/dist/index.esm.js.map +1 -0
- package/dist/packages/taro-runtime/dist/runtime.esm.js +4107 -0
- package/dist/packages/taro-runtime/dist/runtime.esm.js.map +1 -0
- package/dist/utils/timer.js +4 -4
- package/dist/utils/timer.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
import _typeof from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/typeof.js';
|
|
2
|
+
import { Current, getCurrentInstance, options, nextTick, eventCenter } from '../../taro-runtime/dist/runtime.esm.js';
|
|
3
|
+
import '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/toConsumableArray.js';
|
|
4
|
+
import _inherits from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/inherits.js';
|
|
5
|
+
import _createSuper from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createSuper.js';
|
|
6
|
+
import _classCallCheck from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/classCallCheck.js';
|
|
7
|
+
import _createClass from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/createClass.js';
|
|
8
|
+
import _objectSpread from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/objectSpread2.js';
|
|
9
|
+
import _defineProperty from '../../../node_modules/.pnpm/registry.npmjs.org_@babel_runtime@7.18.3/node_modules/@babel/runtime/helpers/defineProperty.js';
|
|
10
|
+
import { Events as Events$1 } from '@tarojs/shared';
|
|
11
|
+
|
|
12
|
+
function isFunction$1(x) {
|
|
13
|
+
return typeof x === 'function';
|
|
14
|
+
}
|
|
15
|
+
function isUndefined(x) {
|
|
16
|
+
return typeof x === 'undefined';
|
|
17
|
+
}
|
|
18
|
+
function isObject(x) {
|
|
19
|
+
return x && _typeof(x) === 'object';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var isBadObj = function isBadObj(x) {
|
|
23
|
+
return !isObject(x);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function throwTypeError(s) {
|
|
27
|
+
throw new TypeError(s);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!isFunction$1(Object.assign)) {
|
|
31
|
+
// Must be writable: true, enumerable: false, configurable: true
|
|
32
|
+
Object.assign = function (target) {
|
|
33
|
+
// .length of function is 2
|
|
34
|
+
if (target == null) {
|
|
35
|
+
// TypeError if undefined or null
|
|
36
|
+
throwTypeError('Cannot convert undefined or null to object');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var to = Object(target);
|
|
40
|
+
|
|
41
|
+
for (var index = 1; index < arguments.length; index++) {
|
|
42
|
+
var nextSource = arguments[index];
|
|
43
|
+
|
|
44
|
+
if (nextSource != null) {
|
|
45
|
+
// Skip over if undefined or null
|
|
46
|
+
for (var nextKey in nextSource) {
|
|
47
|
+
// Avoid bugs when hasOwnProperty is shadowed
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
|
49
|
+
to[nextKey] = nextSource[nextKey];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return to;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!isFunction$1(Object.defineProperties)) {
|
|
60
|
+
Object.defineProperties = function (obj, properties) {
|
|
61
|
+
function convertToDescriptor(desc) {
|
|
62
|
+
function hasProperty(obj, prop) {
|
|
63
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (isBadObj(desc)) {
|
|
67
|
+
throwTypeError('bad desc');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
var d = {};
|
|
71
|
+
if (hasProperty(desc, 'enumerable')) d.enumerable = !!desc.enumerable;
|
|
72
|
+
|
|
73
|
+
if (hasProperty(desc, 'configurable')) {
|
|
74
|
+
d.configurable = !!desc.configurable;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (hasProperty(desc, 'value')) d.value = desc.value;
|
|
78
|
+
if (hasProperty(desc, 'writable')) d.writable = !!desc.writable;
|
|
79
|
+
|
|
80
|
+
if (hasProperty(desc, 'get')) {
|
|
81
|
+
var g = desc.get;
|
|
82
|
+
|
|
83
|
+
if (!isFunction$1(g) && !isUndefined(g)) {
|
|
84
|
+
throwTypeError('bad get');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
d.get = g;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (hasProperty(desc, 'set')) {
|
|
91
|
+
var s = desc.set;
|
|
92
|
+
|
|
93
|
+
if (!isFunction$1(s) && !isUndefined(s)) {
|
|
94
|
+
throwTypeError('bad set');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
d.set = s;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (('get' in d || 'set' in d) && ('value' in d || 'writable' in d)) {
|
|
101
|
+
throwTypeError('identity-confused descriptor');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return d;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (isBadObj(obj)) throwTypeError('bad obj');
|
|
108
|
+
properties = Object(properties);
|
|
109
|
+
var keys = Object.keys(properties);
|
|
110
|
+
var descs = [];
|
|
111
|
+
|
|
112
|
+
for (var i = 0; i < keys.length; i++) {
|
|
113
|
+
descs.push([keys[i], convertToDescriptor(properties[keys[i]])]);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (var _i = 0; _i < descs.length; _i++) {
|
|
117
|
+
Object.defineProperty(obj, descs[_i][0], descs[_i][1]);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return obj;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var DEFAULT_EMPTY_ARRAY = '[]';
|
|
125
|
+
var NO_DEFAULT_VALUE = '';
|
|
126
|
+
var DEFAULT_TRUE = '!0';
|
|
127
|
+
var DEFAULT_FALSE = '!1';
|
|
128
|
+
var touchEvents = {
|
|
129
|
+
bindTouchStart: NO_DEFAULT_VALUE,
|
|
130
|
+
bindTouchMove: NO_DEFAULT_VALUE,
|
|
131
|
+
bindTouchEnd: NO_DEFAULT_VALUE,
|
|
132
|
+
bindTouchCancel: NO_DEFAULT_VALUE,
|
|
133
|
+
bindLongTap: NO_DEFAULT_VALUE
|
|
134
|
+
};
|
|
135
|
+
var animation = {
|
|
136
|
+
animation: NO_DEFAULT_VALUE,
|
|
137
|
+
bindAnimationStart: NO_DEFAULT_VALUE,
|
|
138
|
+
bindAnimationIteration: NO_DEFAULT_VALUE,
|
|
139
|
+
bindAnimationEnd: NO_DEFAULT_VALUE,
|
|
140
|
+
bindTransitionEnd: NO_DEFAULT_VALUE
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
function singleQuote(s) {
|
|
144
|
+
return "'".concat(s, "'");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
Object.assign(Object.assign({
|
|
148
|
+
'hover-class': singleQuote('none'),
|
|
149
|
+
'hover-stop-propagation': DEFAULT_FALSE,
|
|
150
|
+
'hover-start-time': '50',
|
|
151
|
+
'hover-stay-time': '400'
|
|
152
|
+
}, touchEvents), animation);
|
|
153
|
+
Object.assign({
|
|
154
|
+
longitude: NO_DEFAULT_VALUE,
|
|
155
|
+
latitude: NO_DEFAULT_VALUE,
|
|
156
|
+
scale: '16',
|
|
157
|
+
markers: DEFAULT_EMPTY_ARRAY,
|
|
158
|
+
covers: NO_DEFAULT_VALUE,
|
|
159
|
+
polyline: DEFAULT_EMPTY_ARRAY,
|
|
160
|
+
circles: DEFAULT_EMPTY_ARRAY,
|
|
161
|
+
controls: DEFAULT_EMPTY_ARRAY,
|
|
162
|
+
'include-points': DEFAULT_EMPTY_ARRAY,
|
|
163
|
+
'show-location': NO_DEFAULT_VALUE,
|
|
164
|
+
'layer-style': '1',
|
|
165
|
+
bindMarkerTap: NO_DEFAULT_VALUE,
|
|
166
|
+
bindControlTap: NO_DEFAULT_VALUE,
|
|
167
|
+
bindCalloutTap: NO_DEFAULT_VALUE,
|
|
168
|
+
bindUpdated: NO_DEFAULT_VALUE
|
|
169
|
+
}, touchEvents);
|
|
170
|
+
Object.assign({
|
|
171
|
+
size: singleQuote('default'),
|
|
172
|
+
type: NO_DEFAULT_VALUE,
|
|
173
|
+
plain: DEFAULT_FALSE,
|
|
174
|
+
disabled: NO_DEFAULT_VALUE,
|
|
175
|
+
loading: DEFAULT_FALSE,
|
|
176
|
+
'form-type': NO_DEFAULT_VALUE,
|
|
177
|
+
'open-type': NO_DEFAULT_VALUE,
|
|
178
|
+
'hover-class': singleQuote('button-hover'),
|
|
179
|
+
'hover-stop-propagation': DEFAULT_FALSE,
|
|
180
|
+
'hover-start-time': '20',
|
|
181
|
+
'hover-stay-time': '70',
|
|
182
|
+
name: NO_DEFAULT_VALUE
|
|
183
|
+
}, touchEvents);
|
|
184
|
+
Object.assign({
|
|
185
|
+
'scroll-top': DEFAULT_FALSE
|
|
186
|
+
}, touchEvents);
|
|
187
|
+
Object.assign(Object.assign({
|
|
188
|
+
direction: 'none',
|
|
189
|
+
inertia: DEFAULT_FALSE,
|
|
190
|
+
'out-of-bounds': DEFAULT_FALSE,
|
|
191
|
+
x: NO_DEFAULT_VALUE,
|
|
192
|
+
y: NO_DEFAULT_VALUE,
|
|
193
|
+
damping: '20',
|
|
194
|
+
friction: '2',
|
|
195
|
+
disabled: NO_DEFAULT_VALUE,
|
|
196
|
+
scale: DEFAULT_FALSE,
|
|
197
|
+
'scale-min': '0.5',
|
|
198
|
+
'scale-max': '10',
|
|
199
|
+
'scale-value': '1',
|
|
200
|
+
bindChange: NO_DEFAULT_VALUE,
|
|
201
|
+
bindScale: NO_DEFAULT_VALUE,
|
|
202
|
+
bindHTouchMove: NO_DEFAULT_VALUE,
|
|
203
|
+
bindVTouchMove: NO_DEFAULT_VALUE,
|
|
204
|
+
width: singleQuote('10px'),
|
|
205
|
+
height: singleQuote('10px')
|
|
206
|
+
}, touchEvents), animation);
|
|
207
|
+
Object.assign(Object.assign({
|
|
208
|
+
'scroll-x': DEFAULT_FALSE,
|
|
209
|
+
'scroll-y': DEFAULT_FALSE,
|
|
210
|
+
'upper-threshold': '50',
|
|
211
|
+
'lower-threshold': '50',
|
|
212
|
+
'scroll-top': NO_DEFAULT_VALUE,
|
|
213
|
+
'scroll-left': NO_DEFAULT_VALUE,
|
|
214
|
+
'scroll-into-view': NO_DEFAULT_VALUE,
|
|
215
|
+
'scroll-with-animation': DEFAULT_FALSE,
|
|
216
|
+
'enable-back-to-top': DEFAULT_FALSE,
|
|
217
|
+
bindScrollToUpper: NO_DEFAULT_VALUE,
|
|
218
|
+
bindScrollToLower: NO_DEFAULT_VALUE,
|
|
219
|
+
bindScroll: NO_DEFAULT_VALUE
|
|
220
|
+
}, touchEvents), animation);
|
|
221
|
+
Object.assign({
|
|
222
|
+
'indicator-dots': DEFAULT_FALSE,
|
|
223
|
+
'indicator-color': singleQuote('rgba(0, 0, 0, .3)'),
|
|
224
|
+
'indicator-active-color': singleQuote('#000000'),
|
|
225
|
+
autoplay: DEFAULT_FALSE,
|
|
226
|
+
current: '0',
|
|
227
|
+
interval: '5000',
|
|
228
|
+
duration: '500',
|
|
229
|
+
circular: DEFAULT_FALSE,
|
|
230
|
+
vertical: DEFAULT_FALSE,
|
|
231
|
+
'previous-margin': singleQuote('0px'),
|
|
232
|
+
'next-margin': singleQuote('0px'),
|
|
233
|
+
'display-multiple-items': '1',
|
|
234
|
+
bindChange: NO_DEFAULT_VALUE,
|
|
235
|
+
bindTransition: NO_DEFAULT_VALUE,
|
|
236
|
+
bindAnimationFinish: NO_DEFAULT_VALUE
|
|
237
|
+
}, touchEvents);
|
|
238
|
+
Object.assign({
|
|
239
|
+
src: NO_DEFAULT_VALUE,
|
|
240
|
+
mode: singleQuote('scaleToFill'),
|
|
241
|
+
'lazy-load': DEFAULT_FALSE,
|
|
242
|
+
bindError: NO_DEFAULT_VALUE,
|
|
243
|
+
bindLoad: NO_DEFAULT_VALUE
|
|
244
|
+
}, touchEvents);
|
|
245
|
+
Object.assign({
|
|
246
|
+
src: NO_DEFAULT_VALUE,
|
|
247
|
+
autoplay: DEFAULT_FALSE,
|
|
248
|
+
muted: DEFAULT_FALSE,
|
|
249
|
+
orientation: singleQuote('vertical'),
|
|
250
|
+
'object-fit': singleQuote('contain'),
|
|
251
|
+
'background-mute': DEFAULT_FALSE,
|
|
252
|
+
'min-cache': '1',
|
|
253
|
+
'max-cache': '3',
|
|
254
|
+
bindStateChange: NO_DEFAULT_VALUE,
|
|
255
|
+
bindFullScreenChange: NO_DEFAULT_VALUE,
|
|
256
|
+
bindNetStatus: NO_DEFAULT_VALUE
|
|
257
|
+
}, animation);
|
|
258
|
+
Object.assign({
|
|
259
|
+
src: NO_DEFAULT_VALUE,
|
|
260
|
+
duration: NO_DEFAULT_VALUE,
|
|
261
|
+
controls: DEFAULT_TRUE,
|
|
262
|
+
'danmu-list': NO_DEFAULT_VALUE,
|
|
263
|
+
'danmu-btn': NO_DEFAULT_VALUE,
|
|
264
|
+
'enable-danmu': NO_DEFAULT_VALUE,
|
|
265
|
+
autoplay: DEFAULT_FALSE,
|
|
266
|
+
loop: DEFAULT_FALSE,
|
|
267
|
+
muted: DEFAULT_FALSE,
|
|
268
|
+
'initial-time': '0',
|
|
269
|
+
'page-gesture': DEFAULT_FALSE,
|
|
270
|
+
direction: NO_DEFAULT_VALUE,
|
|
271
|
+
'show-progress': DEFAULT_TRUE,
|
|
272
|
+
'show-fullscreen-btn': DEFAULT_TRUE,
|
|
273
|
+
'show-play-btn': DEFAULT_TRUE,
|
|
274
|
+
'show-center-play-btn': DEFAULT_TRUE,
|
|
275
|
+
'enable-progress-gesture': DEFAULT_TRUE,
|
|
276
|
+
'object-fit': singleQuote('contain'),
|
|
277
|
+
poster: NO_DEFAULT_VALUE,
|
|
278
|
+
'show-mute-btn': DEFAULT_FALSE,
|
|
279
|
+
bindPlay: NO_DEFAULT_VALUE,
|
|
280
|
+
bindPause: NO_DEFAULT_VALUE,
|
|
281
|
+
bindEnded: NO_DEFAULT_VALUE,
|
|
282
|
+
bindTimeUpdate: NO_DEFAULT_VALUE,
|
|
283
|
+
bindFullScreenChange: NO_DEFAULT_VALUE,
|
|
284
|
+
bindWaiting: NO_DEFAULT_VALUE,
|
|
285
|
+
bindError: NO_DEFAULT_VALUE
|
|
286
|
+
}, animation);
|
|
287
|
+
Object.assign({
|
|
288
|
+
'canvas-id': NO_DEFAULT_VALUE,
|
|
289
|
+
'disable-scroll': DEFAULT_FALSE,
|
|
290
|
+
bindError: NO_DEFAULT_VALUE
|
|
291
|
+
}, touchEvents);
|
|
292
|
+
var PLATFORM_TYPE;
|
|
293
|
+
|
|
294
|
+
(function (PLATFORM_TYPE) {
|
|
295
|
+
PLATFORM_TYPE["MINI"] = "mini";
|
|
296
|
+
PLATFORM_TYPE["WEB"] = "web";
|
|
297
|
+
PLATFORM_TYPE["RN"] = "rn";
|
|
298
|
+
PLATFORM_TYPE["HARMONY"] = "harmony";
|
|
299
|
+
PLATFORM_TYPE["QUICK"] = "quickapp";
|
|
300
|
+
})(PLATFORM_TYPE || (PLATFORM_TYPE = {}));
|
|
301
|
+
|
|
302
|
+
({
|
|
303
|
+
h5: {
|
|
304
|
+
type: PLATFORM_TYPE.WEB
|
|
305
|
+
},
|
|
306
|
+
harmony: {
|
|
307
|
+
type: PLATFORM_TYPE.HARMONY
|
|
308
|
+
},
|
|
309
|
+
mini: {
|
|
310
|
+
type: PLATFORM_TYPE.MINI
|
|
311
|
+
},
|
|
312
|
+
rn: {
|
|
313
|
+
type: PLATFORM_TYPE.RN
|
|
314
|
+
},
|
|
315
|
+
quickapp: {
|
|
316
|
+
type: PLATFORM_TYPE.QUICK
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
var Events = /*#__PURE__*/function () {
|
|
321
|
+
function Events(opts) {
|
|
322
|
+
_classCallCheck(this, Events);
|
|
323
|
+
|
|
324
|
+
var _a;
|
|
325
|
+
|
|
326
|
+
this.callbacks = (_a = opts === null || opts === void 0 ? void 0 : opts.callbacks) !== null && _a !== void 0 ? _a : {};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
_createClass(Events, [{
|
|
330
|
+
key: "on",
|
|
331
|
+
value: function on(eventName, callback, context) {
|
|
332
|
+
var event, node, tail, list;
|
|
333
|
+
|
|
334
|
+
if (!callback) {
|
|
335
|
+
return this;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
eventName = eventName.split(Events.eventSplitter);
|
|
339
|
+
this.callbacks || (this.callbacks = {});
|
|
340
|
+
var calls = this.callbacks;
|
|
341
|
+
|
|
342
|
+
while (event = eventName.shift()) {
|
|
343
|
+
list = calls[event];
|
|
344
|
+
node = list ? list.tail : {};
|
|
345
|
+
node.next = tail = {};
|
|
346
|
+
node.context = context;
|
|
347
|
+
node.callback = callback;
|
|
348
|
+
calls[event] = {
|
|
349
|
+
tail: tail,
|
|
350
|
+
next: list ? list.next : node
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return this;
|
|
355
|
+
}
|
|
356
|
+
}, {
|
|
357
|
+
key: "once",
|
|
358
|
+
value: function once(events, callback, context) {
|
|
359
|
+
var _this = this;
|
|
360
|
+
|
|
361
|
+
var wrapper = function wrapper() {
|
|
362
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
363
|
+
args[_key] = arguments[_key];
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
callback.apply(_this, args);
|
|
367
|
+
|
|
368
|
+
_this.off(events, wrapper, context);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
this.on(events, wrapper, context);
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
}, {
|
|
375
|
+
key: "off",
|
|
376
|
+
value: function off(events, callback, context) {
|
|
377
|
+
var event, calls, node, tail, cb, ctx;
|
|
378
|
+
|
|
379
|
+
if (!(calls = this.callbacks)) {
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (!(events || callback || context)) {
|
|
384
|
+
delete this.callbacks;
|
|
385
|
+
return this;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
events = events ? events.split(Events.eventSplitter) : Object.keys(calls);
|
|
389
|
+
|
|
390
|
+
while (event = events.shift()) {
|
|
391
|
+
node = calls[event];
|
|
392
|
+
delete calls[event];
|
|
393
|
+
|
|
394
|
+
if (!node || !(callback || context)) {
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
tail = node.tail;
|
|
399
|
+
|
|
400
|
+
while ((node = node.next) !== tail) {
|
|
401
|
+
cb = node.callback;
|
|
402
|
+
ctx = node.context;
|
|
403
|
+
|
|
404
|
+
if (callback && cb !== callback || context && ctx !== context) {
|
|
405
|
+
this.on(event, cb, ctx);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return this;
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
key: "trigger",
|
|
414
|
+
value: function trigger(events) {
|
|
415
|
+
var event, node, calls, tail;
|
|
416
|
+
|
|
417
|
+
if (!(calls = this.callbacks)) {
|
|
418
|
+
return this;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
events = events.split(Events.eventSplitter);
|
|
422
|
+
var rest = [].slice.call(arguments, 1);
|
|
423
|
+
|
|
424
|
+
while (event = events.shift()) {
|
|
425
|
+
if (node = calls[event]) {
|
|
426
|
+
tail = node.tail;
|
|
427
|
+
|
|
428
|
+
while ((node = node.next) !== tail) {
|
|
429
|
+
node.callback.apply(node.context || this, rest);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return this;
|
|
435
|
+
}
|
|
436
|
+
}]);
|
|
437
|
+
|
|
438
|
+
return Events;
|
|
439
|
+
}();
|
|
440
|
+
|
|
441
|
+
Events.eventSplitter = ','; // Note: Harmony ACE API 8 开发板不支持使用正则 split 字符串 /\s+/
|
|
442
|
+
|
|
443
|
+
function isFunction(o) {
|
|
444
|
+
return typeof o === 'function';
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
var isWebPlatform = function isWebPlatform() {
|
|
448
|
+
return process.env.TARO_ENV === 'h5' || process.env.TARO_PLATFORM === 'web';
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
var HOOK_TYPE;
|
|
452
|
+
|
|
453
|
+
(function (HOOK_TYPE) {
|
|
454
|
+
HOOK_TYPE[HOOK_TYPE["SINGLE"] = 0] = "SINGLE";
|
|
455
|
+
HOOK_TYPE[HOOK_TYPE["MULTI"] = 1] = "MULTI";
|
|
456
|
+
HOOK_TYPE[HOOK_TYPE["WATERFALL"] = 2] = "WATERFALL";
|
|
457
|
+
})(HOOK_TYPE || (HOOK_TYPE = {}));
|
|
458
|
+
|
|
459
|
+
var defaultMiniLifecycle = {
|
|
460
|
+
app: ['onLaunch', 'onShow', 'onHide'],
|
|
461
|
+
page: ['onLoad', 'onUnload', 'onReady', 'onShow', 'onHide', ['onPullDownRefresh', 'onReachBottom', 'onPageScroll', 'onResize', 'onTabItemTap', 'onTitleClick', 'onOptionMenuClick', 'onPopMenuClick', 'onPullIntercept', 'onAddToFavorites'], ['onShareAppMessage', 'onShareTimeline']],
|
|
462
|
+
component: ['attached', 'detached']
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
function TaroHook(type, initial) {
|
|
466
|
+
return {
|
|
467
|
+
type: type,
|
|
468
|
+
initial: initial || null
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
var TaroHooks = /*#__PURE__*/function (_Events) {
|
|
473
|
+
_inherits(TaroHooks, _Events);
|
|
474
|
+
|
|
475
|
+
var _super = _createSuper(TaroHooks);
|
|
476
|
+
|
|
477
|
+
function TaroHooks(hooks, opts) {
|
|
478
|
+
var _this2;
|
|
479
|
+
|
|
480
|
+
_classCallCheck(this, TaroHooks);
|
|
481
|
+
|
|
482
|
+
_this2 = _super.call(this, opts);
|
|
483
|
+
_this2.hooks = hooks;
|
|
484
|
+
|
|
485
|
+
for (var hookName in hooks) {
|
|
486
|
+
var initial = hooks[hookName].initial;
|
|
487
|
+
|
|
488
|
+
if (isFunction(initial)) {
|
|
489
|
+
_this2.on(hookName, initial);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
return _this2;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
_createClass(TaroHooks, [{
|
|
497
|
+
key: "tapOneOrMany",
|
|
498
|
+
value: function tapOneOrMany(hookName, callback) {
|
|
499
|
+
var _this3 = this;
|
|
500
|
+
|
|
501
|
+
var list = isFunction(callback) ? [callback] : callback;
|
|
502
|
+
list.forEach(function (cb) {
|
|
503
|
+
return _this3.on(hookName, cb);
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}, {
|
|
507
|
+
key: "tap",
|
|
508
|
+
value: function tap(hookName, callback) {
|
|
509
|
+
var hooks = this.hooks;
|
|
510
|
+
var _hooks$hookName = hooks[hookName],
|
|
511
|
+
type = _hooks$hookName.type,
|
|
512
|
+
initial = _hooks$hookName.initial;
|
|
513
|
+
|
|
514
|
+
if (type === HOOK_TYPE.SINGLE) {
|
|
515
|
+
this.off(hookName);
|
|
516
|
+
this.on(hookName, isFunction(callback) ? callback : callback[callback.length - 1]);
|
|
517
|
+
} else {
|
|
518
|
+
initial && this.off(hookName, initial);
|
|
519
|
+
this.tapOneOrMany(hookName, callback);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}, {
|
|
523
|
+
key: "call",
|
|
524
|
+
value: function call(hookName) {
|
|
525
|
+
var _a;
|
|
526
|
+
|
|
527
|
+
var hook = this.hooks[hookName];
|
|
528
|
+
if (!hook) return;
|
|
529
|
+
var type = hook.type;
|
|
530
|
+
var calls = this.callbacks;
|
|
531
|
+
if (!calls) return;
|
|
532
|
+
var list = calls[hookName];
|
|
533
|
+
|
|
534
|
+
if (list) {
|
|
535
|
+
var tail = list.tail;
|
|
536
|
+
var node = list.next;
|
|
537
|
+
|
|
538
|
+
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
539
|
+
rest[_key2 - 1] = arguments[_key2];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
var args = rest;
|
|
543
|
+
var res;
|
|
544
|
+
|
|
545
|
+
while (node !== tail) {
|
|
546
|
+
res = (_a = node.callback) === null || _a === void 0 ? void 0 : _a.apply(node.context || this, args);
|
|
547
|
+
|
|
548
|
+
if (type === HOOK_TYPE.WATERFALL) {
|
|
549
|
+
var params = [res];
|
|
550
|
+
args = params;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
node = node.next;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return res;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
}, {
|
|
560
|
+
key: "isExist",
|
|
561
|
+
value: function isExist(hookName) {
|
|
562
|
+
var _a;
|
|
563
|
+
|
|
564
|
+
return Boolean((_a = this.callbacks) === null || _a === void 0 ? void 0 : _a[hookName]);
|
|
565
|
+
}
|
|
566
|
+
}]);
|
|
567
|
+
|
|
568
|
+
return TaroHooks;
|
|
569
|
+
}(Events);
|
|
570
|
+
|
|
571
|
+
new TaroHooks({
|
|
572
|
+
getMiniLifecycle: TaroHook(HOOK_TYPE.SINGLE, function (defaultConfig) {
|
|
573
|
+
return defaultConfig;
|
|
574
|
+
}),
|
|
575
|
+
getMiniLifecycleImpl: TaroHook(HOOK_TYPE.SINGLE, function () {
|
|
576
|
+
return this.call('getMiniLifecycle', defaultMiniLifecycle);
|
|
577
|
+
}),
|
|
578
|
+
getLifecycle: TaroHook(HOOK_TYPE.SINGLE, function (instance, lifecycle) {
|
|
579
|
+
return instance[lifecycle];
|
|
580
|
+
}),
|
|
581
|
+
getPathIndex: TaroHook(HOOK_TYPE.SINGLE, function (indexOfNode) {
|
|
582
|
+
return "[".concat(indexOfNode, "]");
|
|
583
|
+
}),
|
|
584
|
+
getEventCenter: TaroHook(HOOK_TYPE.SINGLE, function (Events) {
|
|
585
|
+
return new Events();
|
|
586
|
+
}),
|
|
587
|
+
isBubbleEvents: TaroHook(HOOK_TYPE.SINGLE, function (eventName) {
|
|
588
|
+
/**
|
|
589
|
+
* 支持冒泡的事件, 除 支付宝小程序外,其余的可冒泡事件都和微信保持一致
|
|
590
|
+
* 详见 见 https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxml/event.html
|
|
591
|
+
*/
|
|
592
|
+
var BUBBLE_EVENTS = new Set(['touchstart', 'touchmove', 'touchcancel', 'touchend', 'touchforcechange', 'tap', 'longpress', 'longtap', 'transitionend', 'animationstart', 'animationiteration', 'animationend']);
|
|
593
|
+
return BUBBLE_EVENTS.has(eventName);
|
|
594
|
+
}),
|
|
595
|
+
getSpecialNodes: TaroHook(HOOK_TYPE.SINGLE, function () {
|
|
596
|
+
return ['view', 'text', 'image'];
|
|
597
|
+
}),
|
|
598
|
+
onRemoveAttribute: TaroHook(HOOK_TYPE.SINGLE),
|
|
599
|
+
batchedEventUpdates: TaroHook(HOOK_TYPE.SINGLE),
|
|
600
|
+
mergePageInstance: TaroHook(HOOK_TYPE.SINGLE),
|
|
601
|
+
modifyPageObject: TaroHook(HOOK_TYPE.SINGLE),
|
|
602
|
+
createPullDownComponent: TaroHook(HOOK_TYPE.SINGLE),
|
|
603
|
+
getDOMNode: TaroHook(HOOK_TYPE.SINGLE),
|
|
604
|
+
modifyHydrateData: TaroHook(HOOK_TYPE.SINGLE),
|
|
605
|
+
modifySetAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
606
|
+
modifyRmAttrPayload: TaroHook(HOOK_TYPE.SINGLE),
|
|
607
|
+
onAddEvent: TaroHook(HOOK_TYPE.SINGLE),
|
|
608
|
+
modifyMpEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
609
|
+
modifyMpEventImpl: TaroHook(HOOK_TYPE.SINGLE, function (e) {
|
|
610
|
+
try {
|
|
611
|
+
// 有些小程序的事件对象的某些属性只读
|
|
612
|
+
this.call('modifyMpEvent', e);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
console.warn('[Taro modifyMpEvent hook Error]: ' + (error === null || error === void 0 ? void 0 : error.message));
|
|
615
|
+
}
|
|
616
|
+
}),
|
|
617
|
+
modifyTaroEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
618
|
+
modifyDispatchEvent: TaroHook(HOOK_TYPE.MULTI),
|
|
619
|
+
initNativeApi: TaroHook(HOOK_TYPE.MULTI),
|
|
620
|
+
patchElement: TaroHook(HOOK_TYPE.MULTI)
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
new Date().getTime().toString();
|
|
624
|
+
|
|
625
|
+
var ENV_TYPE = {
|
|
626
|
+
WEAPP: 'WEAPP',
|
|
627
|
+
SWAN: 'SWAN',
|
|
628
|
+
ALIPAY: 'ALIPAY',
|
|
629
|
+
TT: 'TT',
|
|
630
|
+
QQ: 'QQ',
|
|
631
|
+
JD: 'JD',
|
|
632
|
+
WEB: 'WEB',
|
|
633
|
+
RN: 'RN',
|
|
634
|
+
HARMONY: 'HARMONY',
|
|
635
|
+
QUICKAPP: 'QUICKAPP'
|
|
636
|
+
};
|
|
637
|
+
var isWeb = isWebPlatform();
|
|
638
|
+
function getEnv() {
|
|
639
|
+
if (process.env.TARO_ENV === 'weapp') {
|
|
640
|
+
return ENV_TYPE.WEAPP;
|
|
641
|
+
} else if (process.env.TARO_ENV === 'alipay') {
|
|
642
|
+
return ENV_TYPE.ALIPAY;
|
|
643
|
+
} else if (process.env.TARO_ENV === 'swan') {
|
|
644
|
+
return ENV_TYPE.SWAN;
|
|
645
|
+
} else if (process.env.TARO_ENV === 'tt') {
|
|
646
|
+
return ENV_TYPE.TT;
|
|
647
|
+
} else if (process.env.TARO_ENV === 'jd') {
|
|
648
|
+
return ENV_TYPE.JD;
|
|
649
|
+
} else if (process.env.TARO_ENV === 'qq') {
|
|
650
|
+
return ENV_TYPE.QQ;
|
|
651
|
+
} else if (isWeb) {
|
|
652
|
+
return ENV_TYPE.WEB;
|
|
653
|
+
} else if (process.env.TARO_ENV === 'rn') {
|
|
654
|
+
return ENV_TYPE.RN;
|
|
655
|
+
} else if (process.env.TARO_ENV === 'harmony') {
|
|
656
|
+
return ENV_TYPE.HARMONY;
|
|
657
|
+
} else if (process.env.TARO_ENV === 'quickapp') {
|
|
658
|
+
return ENV_TYPE.QUICKAPP;
|
|
659
|
+
} else {
|
|
660
|
+
return process.env.TARO_ENV || 'Unknown';
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var Chain = /*#__PURE__*/function () {
|
|
665
|
+
function Chain(requestParams, interceptors, index) {
|
|
666
|
+
_classCallCheck(this, Chain);
|
|
667
|
+
|
|
668
|
+
this.index = index || 0;
|
|
669
|
+
this.requestParams = requestParams;
|
|
670
|
+
this.interceptors = interceptors || [];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
_createClass(Chain, [{
|
|
674
|
+
key: "proceed",
|
|
675
|
+
value: function proceed(requestParams) {
|
|
676
|
+
this.requestParams = requestParams;
|
|
677
|
+
|
|
678
|
+
if (this.index >= this.interceptors.length) {
|
|
679
|
+
throw new Error('chain 参数错误, 请勿直接修改 request.chain');
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
var nextInterceptor = this._getNextInterceptor();
|
|
683
|
+
|
|
684
|
+
var nextChain = this._getNextChain();
|
|
685
|
+
|
|
686
|
+
var p = nextInterceptor(nextChain);
|
|
687
|
+
var res = p.catch(function (err) {
|
|
688
|
+
return Promise.reject(err);
|
|
689
|
+
});
|
|
690
|
+
Object.keys(p).forEach(function (k) {
|
|
691
|
+
return isFunction$1(p[k]) && (res[k] = p[k]);
|
|
692
|
+
});
|
|
693
|
+
return res;
|
|
694
|
+
}
|
|
695
|
+
}, {
|
|
696
|
+
key: "_getNextInterceptor",
|
|
697
|
+
value: function _getNextInterceptor() {
|
|
698
|
+
return this.interceptors[this.index];
|
|
699
|
+
}
|
|
700
|
+
}, {
|
|
701
|
+
key: "_getNextChain",
|
|
702
|
+
value: function _getNextChain() {
|
|
703
|
+
return new Chain(this.requestParams, this.interceptors, this.index + 1);
|
|
704
|
+
}
|
|
705
|
+
}]);
|
|
706
|
+
|
|
707
|
+
return Chain;
|
|
708
|
+
}();
|
|
709
|
+
|
|
710
|
+
var Link = /*#__PURE__*/function () {
|
|
711
|
+
function Link(interceptor) {
|
|
712
|
+
_classCallCheck(this, Link);
|
|
713
|
+
|
|
714
|
+
this.taroInterceptor = interceptor;
|
|
715
|
+
this.chain = new Chain();
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
_createClass(Link, [{
|
|
719
|
+
key: "request",
|
|
720
|
+
value: function request(requestParams) {
|
|
721
|
+
var chain = this.chain;
|
|
722
|
+
var taroInterceptor = this.taroInterceptor;
|
|
723
|
+
chain.interceptors = chain.interceptors.filter(function (interceptor) {
|
|
724
|
+
return interceptor !== taroInterceptor;
|
|
725
|
+
}).concat(taroInterceptor);
|
|
726
|
+
return chain.proceed(_objectSpread({}, requestParams));
|
|
727
|
+
}
|
|
728
|
+
}, {
|
|
729
|
+
key: "addInterceptor",
|
|
730
|
+
value: function addInterceptor(interceptor) {
|
|
731
|
+
this.chain.interceptors.push(interceptor);
|
|
732
|
+
}
|
|
733
|
+
}, {
|
|
734
|
+
key: "cleanInterceptors",
|
|
735
|
+
value: function cleanInterceptors() {
|
|
736
|
+
this.chain = new Chain();
|
|
737
|
+
}
|
|
738
|
+
}]);
|
|
739
|
+
|
|
740
|
+
return Link;
|
|
741
|
+
}();
|
|
742
|
+
|
|
743
|
+
function timeoutInterceptor(chain) {
|
|
744
|
+
var requestParams = chain.requestParams;
|
|
745
|
+
var p;
|
|
746
|
+
var res = new Promise(function (resolve, reject) {
|
|
747
|
+
var timeout = setTimeout(function () {
|
|
748
|
+
timeout = null;
|
|
749
|
+
reject(new Error('网络链接超时,请稍后再试!'));
|
|
750
|
+
}, requestParams && requestParams.timeout || 60000);
|
|
751
|
+
p = chain.proceed(requestParams);
|
|
752
|
+
p.then(function (res) {
|
|
753
|
+
if (!timeout) return;
|
|
754
|
+
clearTimeout(timeout);
|
|
755
|
+
resolve(res);
|
|
756
|
+
}).catch(function (err) {
|
|
757
|
+
timeout && clearTimeout(timeout);
|
|
758
|
+
reject(err);
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
if (!isUndefined(p) && isFunction$1(p.abort)) res.abort = p.abort;
|
|
762
|
+
return res;
|
|
763
|
+
}
|
|
764
|
+
function logInterceptor(chain) {
|
|
765
|
+
var requestParams = chain.requestParams;
|
|
766
|
+
var method = requestParams.method,
|
|
767
|
+
data = requestParams.data,
|
|
768
|
+
url = requestParams.url;
|
|
769
|
+
|
|
770
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
771
|
+
// eslint-disable-next-line no-console
|
|
772
|
+
console.log("http ".concat(method || 'GET', " --> ").concat(url, " data: "), data);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
var p = chain.proceed(requestParams);
|
|
776
|
+
var res = p.then(function (res) {
|
|
777
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
778
|
+
// eslint-disable-next-line no-console
|
|
779
|
+
console.log("http <-- ".concat(url, " result:"), res);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return res;
|
|
783
|
+
});
|
|
784
|
+
if (isFunction$1(p.abort)) res.abort = p.abort;
|
|
785
|
+
return res;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
var interceptors = /*#__PURE__*/Object.freeze({
|
|
789
|
+
__proto__: null,
|
|
790
|
+
timeoutInterceptor: timeoutInterceptor,
|
|
791
|
+
logInterceptor: logInterceptor
|
|
792
|
+
});
|
|
793
|
+
|
|
794
|
+
function Behavior(options) {
|
|
795
|
+
return options;
|
|
796
|
+
}
|
|
797
|
+
function getPreload(current) {
|
|
798
|
+
return function (key, val) {
|
|
799
|
+
current.preloadData = isObject(key) ? key : _defineProperty({}, key, val);
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
var defaultDesignWidth = 750;
|
|
803
|
+
var defaultDesignRatio = {
|
|
804
|
+
640: 2.34 / 2,
|
|
805
|
+
750: 1,
|
|
806
|
+
828: 1.81 / 2
|
|
807
|
+
};
|
|
808
|
+
var defaultBaseFontSize = 20;
|
|
809
|
+
function getInitPxTransform(taro) {
|
|
810
|
+
return function (config) {
|
|
811
|
+
var _config$designWidth = config.designWidth,
|
|
812
|
+
designWidth = _config$designWidth === void 0 ? defaultDesignWidth : _config$designWidth,
|
|
813
|
+
_config$deviceRatio = config.deviceRatio,
|
|
814
|
+
deviceRatio = _config$deviceRatio === void 0 ? defaultDesignRatio : _config$deviceRatio,
|
|
815
|
+
_config$baseFontSize = config.baseFontSize,
|
|
816
|
+
baseFontSize = _config$baseFontSize === void 0 ? defaultBaseFontSize : _config$baseFontSize;
|
|
817
|
+
taro.config = taro.config || {};
|
|
818
|
+
taro.config.designWidth = designWidth;
|
|
819
|
+
taro.config.deviceRatio = deviceRatio;
|
|
820
|
+
taro.config.baseFontSize = baseFontSize;
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
function getPxTransform(taro) {
|
|
824
|
+
return function (size) {
|
|
825
|
+
var config = taro.config || {};
|
|
826
|
+
var deviceRatio = config.deviceRatio || defaultDesignRatio;
|
|
827
|
+
|
|
828
|
+
var designWidth = function () {
|
|
829
|
+
var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
830
|
+
return isFunction$1(config.designWidth) ? config.designWidth(input) : config.designWidth || defaultDesignWidth;
|
|
831
|
+
}(size);
|
|
832
|
+
|
|
833
|
+
if (!(designWidth in deviceRatio)) {
|
|
834
|
+
throw new Error("deviceRatio \u914D\u7F6E\u4E2D\u4E0D\u5B58\u5728 ".concat(designWidth, " \u7684\u8BBE\u7F6E\uFF01"));
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
return parseInt(size, 10) * deviceRatio[designWidth] + 'rpx';
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/* eslint-disable camelcase */
|
|
842
|
+
var Taro = {
|
|
843
|
+
Behavior: Behavior,
|
|
844
|
+
getEnv: getEnv,
|
|
845
|
+
ENV_TYPE: ENV_TYPE,
|
|
846
|
+
Link: Link,
|
|
847
|
+
interceptors: interceptors,
|
|
848
|
+
Current: Current,
|
|
849
|
+
getCurrentInstance: getCurrentInstance,
|
|
850
|
+
options: options,
|
|
851
|
+
nextTick: nextTick,
|
|
852
|
+
eventCenter: eventCenter,
|
|
853
|
+
Events: Events$1,
|
|
854
|
+
getInitPxTransform: getInitPxTransform
|
|
855
|
+
};
|
|
856
|
+
Taro.initPxTransform = getInitPxTransform(Taro);
|
|
857
|
+
Taro.preload = getPreload(Current);
|
|
858
|
+
Taro.pxTransform = getPxTransform(Taro);
|
|
859
|
+
|
|
860
|
+
export { Taro as default };
|
|
861
|
+
//# sourceMappingURL=index.esm.js.map
|