@arco-design/mobile-react 2.26.0 → 2.27.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 +18 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/form/form-item.js +4 -2
- package/cjs/icon/IconHeart/index.js +1 -1
- package/cjs/icon/IconKeyboard/index.d.ts +7 -0
- package/cjs/icon/IconKeyboard/index.js +48 -0
- package/cjs/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/cjs/icon/IconKeyboardDelete/index.js +44 -0
- package/cjs/icon/IconMinus/index.js +1 -1
- package/cjs/icon/IconMore/index.js +1 -1
- package/cjs/icon/IconNotice/index.js +1 -1
- package/cjs/icon/IconNoticeOff/index.js +1 -1
- package/cjs/icon/IconPlay/index.js +1 -1
- package/cjs/icon/IconSetting/index.js +2 -2
- package/cjs/icon/IconSound/index.js +1 -1
- package/cjs/icon/IconStar/index.js +1 -1
- package/cjs/icon/IconStarFill/index.js +1 -1
- package/cjs/icon/IconTriDown/index.js +1 -1
- package/cjs/icon/IconTriUp/index.js +1 -1
- package/cjs/icon/IconUpload/index.js +1 -1
- package/cjs/icon/IconWarnCircle/index.js +1 -1
- package/cjs/icon/IconWarnCircleFill/index.js +1 -1
- package/cjs/icon/index.d.ts +2 -0
- package/cjs/icon/index.js +12 -2
- package/cjs/image-picker/style/css/index.d.ts +1 -0
- package/cjs/image-picker/style/css/index.js +2 -0
- package/cjs/image-picker/style/index.d.ts +1 -0
- package/cjs/image-picker/style/index.js +2 -0
- package/cjs/index-bar/context.d.ts +3 -0
- package/cjs/index-bar/context.js +15 -0
- package/cjs/index-bar/demo/style/css/mobile.css +23 -0
- package/cjs/index-bar/demo/style/mobile.less +26 -0
- package/cjs/index-bar/group.d.ts +3 -0
- package/cjs/index-bar/group.js +101 -0
- package/cjs/index-bar/index.d.ts +15 -0
- package/cjs/index-bar/index.js +276 -0
- package/cjs/index-bar/side-bar.d.ts +3 -0
- package/cjs/index-bar/side-bar.js +102 -0
- package/cjs/index-bar/style/css/index.css +164 -0
- package/cjs/index-bar/style/css/index.d.ts +3 -0
- package/cjs/index-bar/style/css/index.js +7 -0
- package/cjs/index-bar/style/index.d.ts +3 -0
- package/cjs/index-bar/style/index.js +7 -0
- package/cjs/index-bar/style/index.less +122 -0
- package/cjs/index-bar/type.d.ts +195 -0
- package/cjs/index-bar/type.js +3 -0
- package/cjs/index-bar/utils.d.ts +6 -0
- package/cjs/index-bar/utils.js +68 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +9 -1
- package/cjs/keyboard/demo/style/css/mobile.css +4 -0
- package/cjs/keyboard/demo/style/mobile.less +8 -0
- package/cjs/keyboard/index.d.ts +13 -0
- package/cjs/keyboard/index.js +270 -0
- package/cjs/keyboard/style/css/index.css +93 -0
- package/cjs/keyboard/style/css/index.d.ts +3 -0
- package/cjs/keyboard/style/css/index.js +7 -0
- package/cjs/keyboard/style/index.d.ts +3 -0
- package/cjs/keyboard/style/index.js +7 -0
- package/cjs/keyboard/style/index.less +80 -0
- package/cjs/keyboard/type.d.ts +102 -0
- package/cjs/keyboard/type.js +3 -0
- package/cjs/picker/index.js +3 -39
- package/cjs/picker/type.d.ts +1 -1
- package/cjs/picker-view/components/cascader.d.ts +2 -3
- package/cjs/picker-view/components/cascader.js +8 -6
- package/cjs/picker-view/components/multi-picker.d.ts +2 -3
- package/cjs/picker-view/components/multi-picker.js +31 -35
- package/cjs/picker-view/components/picker-cell.d.ts +1 -1
- package/cjs/picker-view/components/picker-cell.js +5 -7
- package/cjs/picker-view/index.d.ts +1 -1
- package/cjs/picker-view/index.js +9 -20
- package/cjs/picker-view/type.d.ts +2 -2
- package/cjs/slider/hooks/useSliderEvents.js +20 -20
- package/cjs/sticky/index.js +2 -2
- package/cjs/style.d.ts +2 -0
- package/cjs/style.js +4 -0
- package/dist/index.js +1793 -483
- package/dist/index.min.js +4 -4
- package/dist/style.css +215 -1
- package/dist/style.min.css +1 -1
- package/esm/form/form-item.js +4 -2
- package/esm/icon/IconHeart/index.js +1 -1
- package/esm/icon/IconKeyboard/index.d.ts +7 -0
- package/esm/icon/IconKeyboard/index.js +37 -0
- package/esm/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/esm/icon/IconKeyboardDelete/index.js +33 -0
- package/esm/icon/IconMinus/index.js +1 -1
- package/esm/icon/IconMore/index.js +1 -1
- package/esm/icon/IconNotice/index.js +1 -1
- package/esm/icon/IconNoticeOff/index.js +1 -1
- package/esm/icon/IconPlay/index.js +1 -1
- package/esm/icon/IconSetting/index.js +2 -2
- package/esm/icon/IconSound/index.js +1 -1
- package/esm/icon/IconStar/index.js +1 -1
- package/esm/icon/IconStarFill/index.js +1 -1
- package/esm/icon/IconTriDown/index.js +1 -1
- package/esm/icon/IconTriUp/index.js +1 -1
- package/esm/icon/IconUpload/index.js +1 -1
- package/esm/icon/IconWarnCircle/index.js +1 -1
- package/esm/icon/IconWarnCircleFill/index.js +1 -1
- package/esm/icon/index.d.ts +2 -0
- package/esm/icon/index.js +2 -0
- package/esm/image-picker/style/css/index.d.ts +1 -0
- package/esm/image-picker/style/css/index.js +1 -0
- package/esm/image-picker/style/index.d.ts +1 -0
- package/esm/image-picker/style/index.js +1 -0
- package/esm/index-bar/context.d.ts +3 -0
- package/esm/index-bar/context.js +8 -0
- package/esm/index-bar/demo/style/css/mobile.css +23 -0
- package/esm/index-bar/demo/style/mobile.less +26 -0
- package/esm/index-bar/group.d.ts +3 -0
- package/esm/index-bar/group.js +83 -0
- package/esm/index-bar/index.d.ts +15 -0
- package/esm/index-bar/index.js +254 -0
- package/esm/index-bar/side-bar.d.ts +3 -0
- package/esm/index-bar/side-bar.js +90 -0
- package/esm/index-bar/style/css/index.css +164 -0
- package/esm/index-bar/style/css/index.d.ts +3 -0
- package/esm/index-bar/style/css/index.js +3 -0
- package/esm/index-bar/style/index.d.ts +3 -0
- package/esm/index-bar/style/index.js +3 -0
- package/esm/index-bar/style/index.less +122 -0
- package/esm/index-bar/type.d.ts +195 -0
- package/esm/index-bar/type.js +1 -0
- package/esm/index-bar/utils.d.ts +6 -0
- package/esm/index-bar/utils.js +53 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/keyboard/demo/style/css/mobile.css +4 -0
- package/esm/keyboard/demo/style/mobile.less +8 -0
- package/esm/keyboard/index.d.ts +13 -0
- package/esm/keyboard/index.js +243 -0
- package/esm/keyboard/style/css/index.css +93 -0
- package/esm/keyboard/style/css/index.d.ts +3 -0
- package/esm/keyboard/style/css/index.js +3 -0
- package/esm/keyboard/style/index.d.ts +3 -0
- package/esm/keyboard/style/index.js +3 -0
- package/esm/keyboard/style/index.less +80 -0
- package/esm/keyboard/type.d.ts +102 -0
- package/esm/keyboard/type.js +1 -0
- package/esm/picker/index.js +3 -40
- package/esm/picker/type.d.ts +1 -1
- package/esm/picker-view/components/cascader.d.ts +2 -3
- package/esm/picker-view/components/cascader.js +8 -6
- package/esm/picker-view/components/multi-picker.d.ts +2 -3
- package/esm/picker-view/components/multi-picker.js +31 -34
- package/esm/picker-view/components/picker-cell.d.ts +1 -1
- package/esm/picker-view/components/picker-cell.js +5 -7
- package/esm/picker-view/index.d.ts +1 -1
- package/esm/picker-view/index.js +10 -21
- package/esm/picker-view/type.d.ts +2 -2
- package/esm/slider/hooks/useSliderEvents.js +20 -20
- package/esm/sticky/index.js +2 -2
- package/esm/style.d.ts +2 -0
- package/esm/style.js +2 -0
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +43 -0
- package/tokens/app/arcodesign/default/index.d.ts +43 -0
- package/tokens/app/arcodesign/default/index.js +43 -0
- package/tokens/app/arcodesign/default/index.json +516 -0
- package/tokens/app/arcodesign/default/index.less +43 -0
- package/umd/form/form-item.js +4 -2
- package/umd/icon/IconHeart/index.js +1 -1
- package/umd/icon/IconKeyboard/index.d.ts +7 -0
- package/umd/icon/IconKeyboard/index.js +56 -0
- package/umd/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/umd/icon/IconKeyboardDelete/index.js +52 -0
- package/umd/icon/IconMinus/index.js +1 -1
- package/umd/icon/IconMore/index.js +1 -1
- package/umd/icon/IconNotice/index.js +1 -1
- package/umd/icon/IconNoticeOff/index.js +1 -1
- package/umd/icon/IconPlay/index.js +1 -1
- package/umd/icon/IconSetting/index.js +2 -2
- package/umd/icon/IconSound/index.js +1 -1
- package/umd/icon/IconStar/index.js +1 -1
- package/umd/icon/IconStarFill/index.js +1 -1
- package/umd/icon/IconTriDown/index.js +1 -1
- package/umd/icon/IconTriUp/index.js +1 -1
- package/umd/icon/IconUpload/index.js +1 -1
- package/umd/icon/IconWarnCircle/index.js +1 -1
- package/umd/icon/IconWarnCircleFill/index.js +1 -1
- package/umd/icon/index.d.ts +2 -0
- package/umd/icon/index.js +12 -6
- package/umd/image-picker/style/css/index.d.ts +1 -0
- package/umd/image-picker/style/css/index.js +4 -4
- package/umd/image-picker/style/index.d.ts +1 -0
- package/umd/image-picker/style/index.js +4 -4
- package/umd/index-bar/context.d.ts +3 -0
- package/umd/index-bar/context.js +26 -0
- package/umd/index-bar/demo/style/css/mobile.css +23 -0
- package/umd/index-bar/demo/style/mobile.less +26 -0
- package/umd/index-bar/group.d.ts +3 -0
- package/umd/index-bar/group.js +107 -0
- package/umd/index-bar/index.d.ts +15 -0
- package/umd/index-bar/index.js +274 -0
- package/umd/index-bar/side-bar.d.ts +3 -0
- package/umd/index-bar/side-bar.js +113 -0
- package/umd/index-bar/style/css/index.css +164 -0
- package/umd/index-bar/style/css/index.d.ts +3 -0
- package/umd/index-bar/style/css/index.js +15 -0
- package/umd/index-bar/style/index.d.ts +3 -0
- package/umd/index-bar/style/index.js +15 -0
- package/umd/index-bar/style/index.less +122 -0
- package/umd/index-bar/type.d.ts +195 -0
- package/umd/index-bar/type.js +17 -0
- package/umd/index-bar/utils.d.ts +6 -0
- package/umd/index-bar/utils.js +78 -0
- package/umd/index.d.ts +2 -0
- package/umd/index.js +9 -5
- package/umd/keyboard/demo/style/css/mobile.css +4 -0
- package/umd/keyboard/demo/style/mobile.less +8 -0
- package/umd/keyboard/index.d.ts +13 -0
- package/umd/keyboard/index.js +271 -0
- package/umd/keyboard/style/css/index.css +93 -0
- package/umd/keyboard/style/css/index.d.ts +3 -0
- package/umd/keyboard/style/css/index.js +15 -0
- package/umd/keyboard/style/index.d.ts +3 -0
- package/umd/keyboard/style/index.js +15 -0
- package/umd/keyboard/style/index.less +80 -0
- package/umd/keyboard/type.d.ts +102 -0
- package/umd/keyboard/type.js +17 -0
- package/umd/picker/index.js +3 -39
- package/umd/picker/type.d.ts +1 -1
- package/umd/picker-view/components/cascader.d.ts +2 -3
- package/umd/picker-view/components/cascader.js +8 -6
- package/umd/picker-view/components/multi-picker.d.ts +2 -3
- package/umd/picker-view/components/multi-picker.js +31 -35
- package/umd/picker-view/components/picker-cell.d.ts +1 -1
- package/umd/picker-view/components/picker-cell.js +5 -7
- package/umd/picker-view/index.d.ts +1 -1
- package/umd/picker-view/index.js +9 -20
- package/umd/picker-view/type.d.ts +2 -2
- package/umd/slider/hooks/useSliderEvents.js +20 -20
- package/umd/sticky/index.js +2 -2
- package/umd/style.d.ts +2 -0
- package/umd/style.js +4 -4
package/dist/index.js
CHANGED
@@ -110,34 +110,34 @@
|
|
110
110
|
return r;
|
111
111
|
}
|
112
112
|
|
113
|
-
var opt = Object.prototype.toString;
|
114
|
-
function isArray(obj) {
|
115
|
-
return opt.call(obj) === '[object Array]';
|
113
|
+
var opt$1 = Object.prototype.toString;
|
114
|
+
function isArray$1(obj) {
|
115
|
+
return opt$1.call(obj) === '[object Array]';
|
116
116
|
}
|
117
|
-
function isObject$
|
118
|
-
return opt.call(obj) === '[object Object]';
|
117
|
+
function isObject$3(obj) {
|
118
|
+
return opt$1.call(obj) === '[object Object]';
|
119
119
|
}
|
120
120
|
function isString(obj) {
|
121
|
-
return opt.call(obj) === '[object String]';
|
121
|
+
return opt$1.call(obj) === '[object String]';
|
122
122
|
}
|
123
123
|
function isOneOf(value, validList) {
|
124
124
|
return validList.indexOf(value) !== -1;
|
125
125
|
}
|
126
|
-
function isEmptyValue(obj) {
|
126
|
+
function isEmptyValue$1(obj) {
|
127
127
|
return obj === undefined || obj === null || obj === '';
|
128
128
|
}
|
129
|
-
function isFunction(obj) {
|
129
|
+
function isFunction$1(obj) {
|
130
130
|
return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
|
131
131
|
}
|
132
|
-
function isEmptyArray(obj) {
|
133
|
-
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
132
|
+
function isEmptyArray$1(obj) {
|
133
|
+
return isArray$1(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
134
134
|
}
|
135
|
-
var isDeepEqual = function isDeepEqual(obj, sub) {
|
135
|
+
var isDeepEqual$1 = function isDeepEqual(obj, sub) {
|
136
136
|
if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
|
137
137
|
return obj === sub;
|
138
138
|
}
|
139
139
|
|
140
|
-
if (isFunction(obj) && isFunction(sub)) {
|
140
|
+
if (isFunction$1(obj) && isFunction$1(sub)) {
|
141
141
|
return obj === sub || obj.toString() === sub.toString();
|
142
142
|
}
|
143
143
|
|
@@ -171,9 +171,9 @@
|
|
171
171
|
|
172
172
|
if (isString(v)) {
|
173
173
|
classNames.push(v);
|
174
|
-
} else if (isArray(v)) {
|
174
|
+
} else if (isArray$1(v)) {
|
175
175
|
classNames = classNames.concat(v);
|
176
|
-
} else if (isObject$
|
176
|
+
} else if (isObject$3(v)) {
|
177
177
|
Object.keys(v).forEach(function (k) {
|
178
178
|
if (v[k]) {
|
179
179
|
classNames.push(k);
|
@@ -197,113 +197,113 @@
|
|
197
197
|
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
198
198
|
*/
|
199
199
|
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
200
|
-
var NEWTON_ITERATIONS = 4;
|
201
|
-
var NEWTON_MIN_SLOPE = 0.001;
|
202
|
-
var SUBDIVISION_PRECISION = 0.0000001;
|
203
|
-
var SUBDIVISION_MAX_ITERATIONS = 10;
|
204
|
-
var kSplineTableSize = 11;
|
205
|
-
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
206
|
-
var float32ArraySupported = typeof Float32Array === 'function';
|
207
|
-
|
208
|
-
function A(aA1, aA2) {
|
200
|
+
var NEWTON_ITERATIONS$1 = 4;
|
201
|
+
var NEWTON_MIN_SLOPE$1 = 0.001;
|
202
|
+
var SUBDIVISION_PRECISION$1 = 0.0000001;
|
203
|
+
var SUBDIVISION_MAX_ITERATIONS$1 = 10;
|
204
|
+
var kSplineTableSize$1 = 11;
|
205
|
+
var kSampleStepSize$1 = 1.0 / (kSplineTableSize$1 - 1.0);
|
206
|
+
var float32ArraySupported$1 = typeof Float32Array === 'function';
|
207
|
+
|
208
|
+
function A$1(aA1, aA2) {
|
209
209
|
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
210
210
|
}
|
211
211
|
|
212
|
-
function B(aA1, aA2) {
|
212
|
+
function B$1(aA1, aA2) {
|
213
213
|
return 3.0 * aA2 - 6.0 * aA1;
|
214
214
|
}
|
215
215
|
|
216
|
-
function C(aA1) {
|
216
|
+
function C$1(aA1) {
|
217
217
|
return 3.0 * aA1;
|
218
218
|
} // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
219
219
|
|
220
220
|
|
221
|
-
function calcBezier(aT, aA1, aA2) {
|
222
|
-
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
221
|
+
function calcBezier$1(aT, aA1, aA2) {
|
222
|
+
return ((A$1(aA1, aA2) * aT + B$1(aA1, aA2)) * aT + C$1(aA1)) * aT;
|
223
223
|
} // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
224
224
|
|
225
225
|
|
226
|
-
function getSlope(aT, aA1, aA2) {
|
227
|
-
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
226
|
+
function getSlope$1(aT, aA1, aA2) {
|
227
|
+
return 3.0 * A$1(aA1, aA2) * aT * aT + 2.0 * B$1(aA1, aA2) * aT + C$1(aA1);
|
228
228
|
}
|
229
229
|
|
230
|
-
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
230
|
+
function binarySubdivide$1(aX, aA, aB, mX1, mX2) {
|
231
231
|
var currentX, currentT;
|
232
232
|
var i = 0;
|
233
233
|
|
234
234
|
do {
|
235
235
|
currentT = aA + (aB - aA) / 2.0;
|
236
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
236
|
+
currentX = calcBezier$1(currentT, mX1, mX2) - aX;
|
237
237
|
|
238
238
|
if (currentX > 0.0) {
|
239
239
|
aB = currentT;
|
240
240
|
} else {
|
241
241
|
aA = currentT;
|
242
242
|
}
|
243
|
-
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
243
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION$1 && ++i < SUBDIVISION_MAX_ITERATIONS$1);
|
244
244
|
|
245
245
|
return currentT;
|
246
246
|
}
|
247
247
|
|
248
|
-
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
249
|
-
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
250
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
248
|
+
function newtonRaphsonIterate$1(aX, aGuessT, mX1, mX2) {
|
249
|
+
for (var i = 0; i < NEWTON_ITERATIONS$1; ++i) {
|
250
|
+
var currentSlope = getSlope$1(aGuessT, mX1, mX2);
|
251
251
|
|
252
252
|
if (currentSlope === 0.0) {
|
253
253
|
return aGuessT;
|
254
254
|
}
|
255
255
|
|
256
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
256
|
+
var currentX = calcBezier$1(aGuessT, mX1, mX2) - aX;
|
257
257
|
aGuessT -= currentX / currentSlope;
|
258
258
|
}
|
259
259
|
|
260
260
|
return aGuessT;
|
261
261
|
}
|
262
262
|
|
263
|
-
function LinearEasing(x) {
|
263
|
+
function LinearEasing$1(x) {
|
264
264
|
return x;
|
265
265
|
}
|
266
266
|
|
267
|
-
function bezier(mX1, mY1, mX2, mY2) {
|
267
|
+
function bezier$1(mX1, mY1, mX2, mY2) {
|
268
268
|
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
269
269
|
throw new Error('bezier x values must be in [0, 1] range');
|
270
270
|
}
|
271
271
|
|
272
272
|
if (mX1 === mY1 && mX2 === mY2) {
|
273
|
-
return LinearEasing;
|
273
|
+
return LinearEasing$1;
|
274
274
|
} // Precompute samples table
|
275
275
|
|
276
276
|
|
277
|
-
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
277
|
+
var sampleValues = float32ArraySupported$1 ? new Float32Array(kSplineTableSize$1) : new Array(kSplineTableSize$1);
|
278
278
|
|
279
|
-
for (var i = 0; i < kSplineTableSize; ++i) {
|
280
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
279
|
+
for (var i = 0; i < kSplineTableSize$1; ++i) {
|
280
|
+
sampleValues[i] = calcBezier$1(i * kSampleStepSize$1, mX1, mX2);
|
281
281
|
}
|
282
282
|
|
283
283
|
function getTForX(aX) {
|
284
284
|
var intervalStart = 0.0;
|
285
285
|
var currentSample = 1;
|
286
|
-
var lastSample = kSplineTableSize - 1;
|
286
|
+
var lastSample = kSplineTableSize$1 - 1;
|
287
287
|
|
288
288
|
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
289
|
-
intervalStart += kSampleStepSize;
|
289
|
+
intervalStart += kSampleStepSize$1;
|
290
290
|
}
|
291
291
|
|
292
292
|
--currentSample; // Interpolate to provide an initial guess for t
|
293
293
|
|
294
294
|
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
295
|
-
var guessForT = intervalStart + dist * kSampleStepSize;
|
296
|
-
var initialSlope = getSlope(guessForT, mX1, mX2);
|
295
|
+
var guessForT = intervalStart + dist * kSampleStepSize$1;
|
296
|
+
var initialSlope = getSlope$1(guessForT, mX1, mX2);
|
297
297
|
|
298
|
-
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
299
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
298
|
+
if (initialSlope >= NEWTON_MIN_SLOPE$1) {
|
299
|
+
return newtonRaphsonIterate$1(aX, guessForT, mX1, mX2);
|
300
300
|
}
|
301
301
|
|
302
302
|
if (initialSlope === 0.0) {
|
303
303
|
return guessForT;
|
304
304
|
}
|
305
305
|
|
306
|
-
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
306
|
+
return binarySubdivide$1(aX, intervalStart, intervalStart + kSampleStepSize$1, mX1, mX2);
|
307
307
|
}
|
308
308
|
|
309
309
|
return function BezierEasing(x) {
|
@@ -312,7 +312,7 @@
|
|
312
312
|
return x;
|
313
313
|
}
|
314
314
|
|
315
|
-
return calcBezier(getTForX(x), mY1, mY2);
|
315
|
+
return calcBezier$1(getTForX(x), mY1, mY2);
|
316
316
|
};
|
317
317
|
}
|
318
318
|
|
@@ -386,20 +386,20 @@
|
|
386
386
|
|
387
387
|
return false;
|
388
388
|
};
|
389
|
-
function execRAF(fn) {
|
389
|
+
function execRAF$1(fn) {
|
390
390
|
try {
|
391
391
|
return requestAnimationFrame(fn);
|
392
392
|
} catch (e) {
|
393
393
|
return setTimeout(fn, 17);
|
394
394
|
}
|
395
395
|
}
|
396
|
-
function scrollWithAnimation(initTop, target, scrollTo, duration, bezier
|
396
|
+
function scrollWithAnimation$1(initTop, target, scrollTo, duration, bezier, type) {
|
397
397
|
if (duration === void 0) {
|
398
398
|
duration = 300;
|
399
399
|
}
|
400
400
|
|
401
|
-
if (bezier
|
402
|
-
bezier
|
401
|
+
if (bezier === void 0) {
|
402
|
+
bezier = [0.34, 0.69, 0.1, 1];
|
403
403
|
}
|
404
404
|
|
405
405
|
if (type === void 0) {
|
@@ -415,13 +415,13 @@
|
|
415
415
|
if (p > 1) {
|
416
416
|
scrollTo(targetTop);
|
417
417
|
} else {
|
418
|
-
var newTop = initTop + (targetTop - initTop) * bezier.apply(void 0, bezier
|
418
|
+
var newTop = initTop + (targetTop - initTop) * bezier$1.apply(void 0, bezier)(p);
|
419
419
|
scrollTo(newTop);
|
420
|
-
execRAF(fn);
|
420
|
+
execRAF$1(fn);
|
421
421
|
}
|
422
422
|
};
|
423
423
|
|
424
|
-
execRAF(fn);
|
424
|
+
execRAF$1(fn);
|
425
425
|
}
|
426
426
|
/**
|
427
427
|
* 返回节点的 document 对象属性
|
@@ -943,7 +943,7 @@
|
|
943
943
|
}
|
944
944
|
}
|
945
945
|
|
946
|
-
var defaultMessageTemplate$
|
946
|
+
var defaultMessageTemplate$2 = '%s 不是 %s 类型';
|
947
947
|
var localeConfig = {
|
948
948
|
locale: 'zh-CN',
|
949
949
|
LoadMore: {
|
@@ -997,16 +997,19 @@
|
|
997
997
|
minusButtonName: '减少',
|
998
998
|
addButtonName: '增加'
|
999
999
|
},
|
1000
|
+
Keyboard: {
|
1001
|
+
confirm: '完成'
|
1002
|
+
},
|
1000
1003
|
Form: {
|
1001
1004
|
required: '%s 为必填项',
|
1002
1005
|
type: {
|
1003
|
-
email: defaultMessageTemplate$
|
1004
|
-
url: defaultMessageTemplate$
|
1005
|
-
string: defaultMessageTemplate$
|
1006
|
-
number: defaultMessageTemplate$
|
1007
|
-
array: defaultMessageTemplate$
|
1008
|
-
object: defaultMessageTemplate$
|
1009
|
-
boolean: defaultMessageTemplate$
|
1006
|
+
email: defaultMessageTemplate$2,
|
1007
|
+
url: defaultMessageTemplate$2,
|
1008
|
+
string: defaultMessageTemplate$2,
|
1009
|
+
number: defaultMessageTemplate$2,
|
1010
|
+
array: defaultMessageTemplate$2,
|
1011
|
+
object: defaultMessageTemplate$2,
|
1012
|
+
boolean: defaultMessageTemplate$2
|
1010
1013
|
},
|
1011
1014
|
number: {
|
1012
1015
|
min: '`%s` 小于 `%s`',
|
@@ -1155,7 +1158,7 @@
|
|
1155
1158
|
return DateWithUTC;
|
1156
1159
|
}();
|
1157
1160
|
|
1158
|
-
var ValidatorType;
|
1161
|
+
var ValidatorType$1;
|
1159
1162
|
|
1160
1163
|
(function (ValidatorType) {
|
1161
1164
|
ValidatorType["Number"] = "number";
|
@@ -1164,7 +1167,7 @@
|
|
1164
1167
|
ValidatorType["Boolean"] = "boolean";
|
1165
1168
|
ValidatorType["Object"] = "object";
|
1166
1169
|
ValidatorType["Custom"] = "custom";
|
1167
|
-
})(ValidatorType || (ValidatorType = {}));
|
1170
|
+
})(ValidatorType$1 || (ValidatorType$1 = {}));
|
1168
1171
|
|
1169
1172
|
var __assign$1 = undefined && undefined.__assign || function () {
|
1170
1173
|
__assign$1 = Object.assign || function (t) {
|
@@ -1181,17 +1184,17 @@
|
|
1181
1184
|
|
1182
1185
|
return __assign$1.apply(this, arguments);
|
1183
1186
|
};
|
1184
|
-
var defaultMessageTemplate = '%s is not a %s type';
|
1185
|
-
var messageTemplate = {
|
1187
|
+
var defaultMessageTemplate$1 = '%s is not a %s type';
|
1188
|
+
var messageTemplate$1 = {
|
1186
1189
|
required: '%s is required',
|
1187
1190
|
type: {
|
1188
|
-
email: defaultMessageTemplate,
|
1189
|
-
url: defaultMessageTemplate,
|
1190
|
-
string: defaultMessageTemplate,
|
1191
|
-
number: defaultMessageTemplate,
|
1192
|
-
array: defaultMessageTemplate,
|
1193
|
-
object: defaultMessageTemplate,
|
1194
|
-
boolean: defaultMessageTemplate
|
1191
|
+
email: defaultMessageTemplate$1,
|
1192
|
+
url: defaultMessageTemplate$1,
|
1193
|
+
string: defaultMessageTemplate$1,
|
1194
|
+
number: defaultMessageTemplate$1,
|
1195
|
+
array: defaultMessageTemplate$1,
|
1196
|
+
object: defaultMessageTemplate$1,
|
1197
|
+
boolean: defaultMessageTemplate$1
|
1195
1198
|
},
|
1196
1199
|
number: {
|
1197
1200
|
min: '`%s` is not greater than `%s`',
|
@@ -1225,9 +1228,9 @@
|
|
1225
1228
|
equal: '%s is not equal to `%s`'
|
1226
1229
|
}
|
1227
1230
|
};
|
1228
|
-
var getMsgTemplate = function getMsgTemplate(templates, temName, values) {
|
1231
|
+
var getMsgTemplate$1 = function getMsgTemplate(templates, temName, values) {
|
1229
1232
|
var temNameArr = temName.split('.');
|
1230
|
-
var theTemplate = defaultMessageTemplate;
|
1233
|
+
var theTemplate = defaultMessageTemplate$1;
|
1231
1234
|
|
1232
1235
|
if (temNameArr[0] in templates) {
|
1233
1236
|
var firstTemplate = templates[temNameArr[0]];
|
@@ -1244,14 +1247,14 @@
|
|
1244
1247
|
return cur < values.length ? values[cur++] : curVal;
|
1245
1248
|
});
|
1246
1249
|
};
|
1247
|
-
var mergeMsgTemplate = function mergeMsgTemplate(originMT, newMT) {
|
1250
|
+
var mergeMsgTemplate$1 = function mergeMsgTemplate(originMT, newMT) {
|
1248
1251
|
var targetMT = originMT;
|
1249
1252
|
|
1250
1253
|
if (newMT) {
|
1251
1254
|
Object.keys(originMT).forEach(function (key) {
|
1252
1255
|
var originValue = originMT[key];
|
1253
1256
|
var curValue = newMT === null || newMT === void 0 ? void 0 : newMT[key];
|
1254
|
-
targetMT[key] = isObject$
|
1257
|
+
targetMT[key] = isObject$3(originValue) ? __assign$1(__assign$1({}, originValue), curValue) : curValue || originValue;
|
1255
1258
|
});
|
1256
1259
|
}
|
1257
1260
|
|
@@ -1297,7 +1300,7 @@
|
|
1297
1300
|
return t;
|
1298
1301
|
}; // eslint-disable-next-line max-classes-per-file
|
1299
1302
|
|
1300
|
-
var BaseValidator =
|
1303
|
+
var BaseValidator$1 =
|
1301
1304
|
/** @class */
|
1302
1305
|
function () {
|
1303
1306
|
function BaseValidator(value, rule, options) {
|
@@ -1308,7 +1311,7 @@
|
|
1308
1311
|
rest = __rest(rule, ["message"]);
|
1309
1312
|
|
1310
1313
|
this.message = message || '';
|
1311
|
-
this.type = rule.type || ValidatorType.String;
|
1314
|
+
this.type = rule.type || ValidatorType$1.String;
|
1312
1315
|
this.error = {
|
1313
1316
|
value: value,
|
1314
1317
|
message: [],
|
@@ -1317,13 +1320,13 @@
|
|
1317
1320
|
this.field = options.field || '';
|
1318
1321
|
this.rule = rest;
|
1319
1322
|
this.validateRules = [];
|
1320
|
-
this.curValidMsgTemplate = mergeMsgTemplate(messageTemplate, options.validateMessage);
|
1323
|
+
this.curValidMsgTemplate = mergeMsgTemplate$1(messageTemplate$1, options.validateMessage);
|
1321
1324
|
}
|
1322
1325
|
|
1323
1326
|
BaseValidator.prototype.isRequired = function () {
|
1324
1327
|
// 优先级最高
|
1325
|
-
if (isEmptyValue(this.value) || isEmptyArray(this.value)) {
|
1326
|
-
this.error.message = [this.message || getMsgTemplate(this.curValidMsgTemplate, 'required', [this.field])];
|
1328
|
+
if (isEmptyValue$1(this.value) || isEmptyArray$1(this.value)) {
|
1329
|
+
this.error.message = [this.message || getMsgTemplate$1(this.curValidMsgTemplate, 'required', [this.field])];
|
1327
1330
|
this.error.errorTypes = ['required'];
|
1328
1331
|
return false;
|
1329
1332
|
}
|
@@ -1347,7 +1350,7 @@
|
|
1347
1350
|
values = _a.values;
|
1348
1351
|
|
1349
1352
|
if (isError) {
|
1350
|
-
var theMessage = this.message || getMsgTemplate(this.curValidMsgTemplate, errTemplate, values);
|
1353
|
+
var theMessage = this.message || getMsgTemplate$1(this.curValidMsgTemplate, errTemplate, values);
|
1351
1354
|
this.error.errorTypes.push(errTemplate);
|
1352
1355
|
(_b = this.error.message) === null || _b === void 0 ? void 0 : _b.push(theMessage);
|
1353
1356
|
return theMessage;
|
@@ -1376,42 +1379,42 @@
|
|
1376
1379
|
}
|
1377
1380
|
|
1378
1381
|
NumberValidator.prototype.min = function (num) {
|
1379
|
-
this.dealError(!isEmptyValue(this.value) && this.value < num, {
|
1382
|
+
this.dealError(!isEmptyValue$1(this.value) && this.value < num, {
|
1380
1383
|
errTemplate: 'number.min',
|
1381
1384
|
values: [this.field, "" + num]
|
1382
1385
|
});
|
1383
1386
|
};
|
1384
1387
|
|
1385
1388
|
NumberValidator.prototype.max = function (num) {
|
1386
|
-
this.dealError(!isEmptyValue(this.value) && this.value > num, {
|
1389
|
+
this.dealError(!isEmptyValue$1(this.value) && this.value > num, {
|
1387
1390
|
errTemplate: 'number.max',
|
1388
1391
|
values: [this.field, "" + num]
|
1389
1392
|
});
|
1390
1393
|
};
|
1391
1394
|
|
1392
1395
|
NumberValidator.prototype.equal = function (num) {
|
1393
|
-
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
1396
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value !== num, {
|
1394
1397
|
errTemplate: 'number.equal',
|
1395
1398
|
values: [this.field, "" + num]
|
1396
1399
|
});
|
1397
1400
|
};
|
1398
1401
|
|
1399
1402
|
NumberValidator.prototype.positive = function () {
|
1400
|
-
return this.dealError(!isEmptyValue(this.value) && this.value < 0, {
|
1403
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value < 0, {
|
1401
1404
|
errTemplate: 'number.positive',
|
1402
1405
|
values: [this.field]
|
1403
1406
|
});
|
1404
1407
|
};
|
1405
1408
|
|
1406
1409
|
NumberValidator.prototype.negative = function () {
|
1407
|
-
return this.dealError(!isEmptyValue(this.value) && this.value > 0, {
|
1410
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value > 0, {
|
1408
1411
|
errTemplate: 'number.negative',
|
1409
1412
|
values: [this.field]
|
1410
1413
|
});
|
1411
1414
|
};
|
1412
1415
|
|
1413
1416
|
return NumberValidator;
|
1414
|
-
}(BaseValidator);
|
1417
|
+
}(BaseValidator$1);
|
1415
1418
|
|
1416
1419
|
var StringValidator =
|
1417
1420
|
/** @class */
|
@@ -1426,21 +1429,21 @@
|
|
1426
1429
|
}
|
1427
1430
|
|
1428
1431
|
StringValidator.prototype.min = function (num) {
|
1429
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
1432
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value.length < num, {
|
1430
1433
|
errTemplate: 'string.min',
|
1431
1434
|
values: [this.field, "" + num]
|
1432
1435
|
});
|
1433
1436
|
};
|
1434
1437
|
|
1435
1438
|
StringValidator.prototype.max = function (num) {
|
1436
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
1439
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value.length > num, {
|
1437
1440
|
errTemplate: 'string.max',
|
1438
1441
|
values: [this.field, "" + num]
|
1439
1442
|
});
|
1440
1443
|
};
|
1441
1444
|
|
1442
1445
|
StringValidator.prototype.len = function (num) {
|
1443
|
-
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
1446
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value !== num, {
|
1444
1447
|
errTemplate: 'string.equal',
|
1445
1448
|
values: [this.field, "" + num]
|
1446
1449
|
});
|
@@ -1448,7 +1451,7 @@
|
|
1448
1451
|
|
1449
1452
|
StringValidator.prototype.match = function (regStr) {
|
1450
1453
|
var reg = new RegExp(regStr);
|
1451
|
-
return this.dealError(!isEmptyValue(this.value) && !reg.test(this.value), {
|
1454
|
+
return this.dealError(!isEmptyValue$1(this.value) && !reg.test(this.value), {
|
1452
1455
|
errTemplate: 'string.match',
|
1453
1456
|
values: [this.field, regStr]
|
1454
1457
|
});
|
@@ -1456,7 +1459,7 @@
|
|
1456
1459
|
|
1457
1460
|
StringValidator.prototype.uppercase = function (isValue) {
|
1458
1461
|
var isUppercase = (this.value || '').toLocaleUpperCase() === this.value;
|
1459
|
-
return this.dealError(!isEmptyValue(this.value) && isUppercase !== isValue, {
|
1462
|
+
return this.dealError(!isEmptyValue$1(this.value) && isUppercase !== isValue, {
|
1460
1463
|
errTemplate: 'string.uppercase',
|
1461
1464
|
values: [this.field]
|
1462
1465
|
});
|
@@ -1464,21 +1467,21 @@
|
|
1464
1467
|
|
1465
1468
|
StringValidator.prototype.lowercase = function (isValue) {
|
1466
1469
|
var isLowercase = (this.value || '').toLocaleLowerCase() === this.value;
|
1467
|
-
return this.dealError(!isEmptyValue(this.value) && isLowercase !== isValue, {
|
1470
|
+
return this.dealError(!isEmptyValue$1(this.value) && isLowercase !== isValue, {
|
1468
1471
|
errTemplate: 'string.lowercase',
|
1469
1472
|
values: [this.field]
|
1470
1473
|
});
|
1471
1474
|
};
|
1472
1475
|
|
1473
1476
|
StringValidator.prototype.whitespace = function () {
|
1474
|
-
return this.dealError(!isEmptyValue(this.value) && isEmptyValue(this.value.trim()), {
|
1477
|
+
return this.dealError(!isEmptyValue$1(this.value) && isEmptyValue$1(this.value.trim()), {
|
1475
1478
|
errTemplate: 'string.whitespace',
|
1476
1479
|
values: [this.field]
|
1477
1480
|
});
|
1478
1481
|
};
|
1479
1482
|
|
1480
1483
|
return StringValidator;
|
1481
|
-
}(BaseValidator);
|
1484
|
+
}(BaseValidator$1);
|
1482
1485
|
|
1483
1486
|
var ArrayValidator =
|
1484
1487
|
/** @class */
|
@@ -1493,21 +1496,21 @@
|
|
1493
1496
|
}
|
1494
1497
|
|
1495
1498
|
ArrayValidator.prototype.min = function (num) {
|
1496
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
1499
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value.length < num, {
|
1497
1500
|
errTemplate: 'array.min',
|
1498
1501
|
values: [this.field, "" + num]
|
1499
1502
|
});
|
1500
1503
|
};
|
1501
1504
|
|
1502
1505
|
ArrayValidator.prototype.max = function (num) {
|
1503
|
-
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
1506
|
+
return this.dealError(!isEmptyValue$1(this.value) && this.value.length > num, {
|
1504
1507
|
errTemplate: 'array.max',
|
1505
1508
|
values: [this.field, "" + num]
|
1506
1509
|
});
|
1507
1510
|
};
|
1508
1511
|
|
1509
1512
|
ArrayValidator.prototype.deepEqual = function (sub) {
|
1510
|
-
return this.dealError(!isDeepEqual(this.value, sub), {
|
1513
|
+
return this.dealError(!isDeepEqual$1(this.value, sub), {
|
1511
1514
|
errTemplate: 'array.equal',
|
1512
1515
|
values: [this.field, "" + JSON.stringify(sub)]
|
1513
1516
|
});
|
@@ -1525,7 +1528,7 @@
|
|
1525
1528
|
};
|
1526
1529
|
|
1527
1530
|
return ArrayValidator;
|
1528
|
-
}(BaseValidator);
|
1531
|
+
}(BaseValidator$1);
|
1529
1532
|
|
1530
1533
|
var ObjectValidator =
|
1531
1534
|
/** @class */
|
@@ -1540,15 +1543,15 @@
|
|
1540
1543
|
}
|
1541
1544
|
|
1542
1545
|
ObjectValidator.prototype.deepEqual = function (sub) {
|
1543
|
-
return this.dealError(!isDeepEqual(this.value, sub), {
|
1546
|
+
return this.dealError(!isDeepEqual$1(this.value, sub), {
|
1544
1547
|
errTemplate: 'object.deepEqual',
|
1545
1548
|
values: [this.field, "" + JSON.stringify(sub)]
|
1546
1549
|
});
|
1547
1550
|
};
|
1548
1551
|
|
1549
1552
|
ObjectValidator.prototype.hasKeys = function (keys) {
|
1550
|
-
var allKeys = isEmptyValue(this.value) ? [] : Object.keys(this.value);
|
1551
|
-
return this.dealError(!isEmptyValue(this.value) && keys.some(function (theKey) {
|
1553
|
+
var allKeys = isEmptyValue$1(this.value) ? [] : Object.keys(this.value);
|
1554
|
+
return this.dealError(!isEmptyValue$1(this.value) && keys.some(function (theKey) {
|
1552
1555
|
return !allKeys.includes(theKey);
|
1553
1556
|
}), {
|
1554
1557
|
errTemplate: 'object.hasKeys',
|
@@ -1557,7 +1560,7 @@
|
|
1557
1560
|
};
|
1558
1561
|
|
1559
1562
|
return ObjectValidator;
|
1560
|
-
}(BaseValidator);
|
1563
|
+
}(BaseValidator$1);
|
1561
1564
|
|
1562
1565
|
var CustomValidator =
|
1563
1566
|
/** @class */
|
@@ -1595,7 +1598,7 @@
|
|
1595
1598
|
};
|
1596
1599
|
|
1597
1600
|
return CustomValidator;
|
1598
|
-
}(BaseValidator);
|
1601
|
+
}(BaseValidator$1);
|
1599
1602
|
|
1600
1603
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
1601
1604
|
|
@@ -2920,7 +2923,7 @@
|
|
2920
2923
|
Object.keys(this.rules).forEach(function (key) {
|
2921
2924
|
var spPromiseGroup = [];
|
2922
2925
|
|
2923
|
-
if (isArray(_this.rules[key])) {
|
2926
|
+
if (isArray$1(_this.rules[key])) {
|
2924
2927
|
for (var i = 0; i < _this.rules[key].length; i++) {
|
2925
2928
|
var rule = _this.rules[key][i];
|
2926
2929
|
|
@@ -2969,9 +2972,13 @@
|
|
2969
2972
|
var level = 0;
|
2970
2973
|
|
2971
2974
|
do {
|
2972
|
-
var foundItem = children.
|
2975
|
+
var foundItem = children.find(function (item) {
|
2973
2976
|
return filterFn(item, level);
|
2974
|
-
})
|
2977
|
+
});
|
2978
|
+
|
2979
|
+
if (!foundItem && options.fallbackChildIndex !== undefined) {
|
2980
|
+
foundItem = children[options.fallbackChildIndex];
|
2981
|
+
}
|
2975
2982
|
|
2976
2983
|
if (!foundItem) {
|
2977
2984
|
break;
|
@@ -3522,7 +3529,7 @@
|
|
3522
3529
|
|
3523
3530
|
var latestPercentage = React.useRef(percentage);
|
3524
3531
|
React.useEffect(function () {
|
3525
|
-
mountedTransition ? scrollWithAnimation(0, percentage, function (progress) {
|
3532
|
+
mountedTransition ? scrollWithAnimation$1(0, percentage, function (progress) {
|
3526
3533
|
var targetProgress = progress / percentage * latestPercentage.current;
|
3527
3534
|
setCurrentPercentage(Math.floor(targetProgress));
|
3528
3535
|
}, duration, mountedBezier) : setCurrentPercentage(percentage);
|
@@ -3587,7 +3594,7 @@
|
|
3587
3594
|
|
3588
3595
|
var _a;
|
3589
3596
|
|
3590
|
-
function isObject$
|
3597
|
+
function isObject$2(obj) {
|
3591
3598
|
return Object.prototype.toString.call(obj) === '[object Object]';
|
3592
3599
|
}
|
3593
3600
|
|
@@ -3599,7 +3606,7 @@
|
|
3599
3606
|
var updateUsingClientEntryPoint = function updateUsingClientEntryPoint(skipWarning) {
|
3600
3607
|
// https://github.com/facebook/react/blob/17806594cc28284fe195f918e8d77de3516848ec/packages/react-dom/npm/client.js#L10
|
3601
3608
|
// Avoid console warning
|
3602
|
-
if (isObject$
|
3609
|
+
if (isObject$2(CopyReactDOM[__SECRET_INTERNALS__])) {
|
3603
3610
|
CopyReactDOM[__SECRET_INTERNALS__].usingClientEntryPoint = skipWarning;
|
3604
3611
|
}
|
3605
3612
|
};
|
@@ -5409,7 +5416,7 @@
|
|
5409
5416
|
* @name_en ActionSheet
|
5410
5417
|
*/
|
5411
5418
|
|
5412
|
-
var index$
|
5419
|
+
var index$o = componentWrapper(ActionSheet, methodsGenerator$5(ActionSheetWithGlobalContext));
|
5413
5420
|
|
5414
5421
|
/**
|
5415
5422
|
* 增强版的 img 标签,提供多种图片填充模式,支持图片加载中提示、加载失败提示。
|
@@ -5939,7 +5946,7 @@
|
|
5939
5946
|
* @name_en Avatar
|
5940
5947
|
*/
|
5941
5948
|
|
5942
|
-
var index$
|
5949
|
+
var index$n = componentWrapper(Avatar, {
|
5943
5950
|
Group: Group$4
|
5944
5951
|
});
|
5945
5952
|
|
@@ -7171,7 +7178,7 @@
|
|
7171
7178
|
* @name_en Cell
|
7172
7179
|
*/
|
7173
7180
|
|
7174
|
-
var index$
|
7181
|
+
var index$m = componentWrapper(Cell, {
|
7175
7182
|
Group: Group$3
|
7176
7183
|
});
|
7177
7184
|
|
@@ -8146,7 +8153,7 @@
|
|
8146
8153
|
* @name_en Collapse
|
8147
8154
|
*/
|
8148
8155
|
|
8149
|
-
var index$
|
8156
|
+
var index$l = componentWrapper(Collapse, {
|
8150
8157
|
Group: Group$1
|
8151
8158
|
});
|
8152
8159
|
|
@@ -8528,59 +8535,56 @@
|
|
8528
8535
|
function MultiPicker(props) {
|
8529
8536
|
var prefixCls = props.prefixCls,
|
8530
8537
|
onValueChange = props.onValueChange,
|
8531
|
-
onPickerChange = props.onPickerChange,
|
8532
8538
|
children = props.children,
|
8533
8539
|
itemHeight = props.itemHeight,
|
8534
8540
|
selectedValue = props.selectedValue,
|
8535
8541
|
data = props.data;
|
8536
8542
|
|
8537
|
-
function
|
8538
|
-
|
8539
|
-
|
8540
|
-
|
8541
|
-
|
8542
|
-
|
8543
|
-
return
|
8544
|
-
return item && item[0] && item[0].value;
|
8545
|
-
});
|
8546
|
-
}
|
8547
|
-
|
8548
|
-
if (!children) {
|
8549
|
-
return [];
|
8550
|
-
}
|
8551
|
-
|
8552
|
-
return React__default["default"].Children.map(children, function (child) {
|
8553
|
-
var childrenArray = React__default["default"].Children.toArray(child.children || child.props.children);
|
8554
|
-
return childrenArray && childrenArray[0] && childrenArray[0].props.value;
|
8543
|
+
function getCurrentData() {
|
8544
|
+
return (data || []).map(function (item, itemIndex) {
|
8545
|
+
var curSelected = selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue[itemIndex];
|
8546
|
+
var cur = curSelected ? (item || []).find(function (i) {
|
8547
|
+
return i.value === curSelected;
|
8548
|
+
}) : undefined;
|
8549
|
+
return cur || (item === null || item === void 0 ? void 0 : item[0]);
|
8555
8550
|
});
|
8556
8551
|
}
|
8557
8552
|
|
8558
|
-
function onChange(
|
8559
|
-
var
|
8553
|
+
function onChange(_a) {
|
8554
|
+
var index = _a.index,
|
8555
|
+
value = _a.value,
|
8556
|
+
changedData = _a.changedData,
|
8557
|
+
callback = _a.callback;
|
8558
|
+
var newData = getCurrentData().concat();
|
8559
|
+
newData[index] = changedData;
|
8560
|
+
var newValue = newData.map(function (d) {
|
8561
|
+
return d === null || d === void 0 ? void 0 : d.value;
|
8562
|
+
});
|
8560
8563
|
newValue[index] = value;
|
8561
8564
|
|
8562
8565
|
if (callback) {
|
8563
|
-
callback(newValue, index);
|
8566
|
+
callback(newValue, index, newData);
|
8564
8567
|
}
|
8565
8568
|
}
|
8566
8569
|
|
8567
|
-
function _onValueChange(value, index) {
|
8568
|
-
onChange(
|
8569
|
-
|
8570
|
-
|
8571
|
-
|
8572
|
-
|
8570
|
+
function _onValueChange(value, index, changedData) {
|
8571
|
+
onChange({
|
8572
|
+
index: index,
|
8573
|
+
value: value,
|
8574
|
+
callback: onValueChange,
|
8575
|
+
changedData: changedData
|
8576
|
+
});
|
8573
8577
|
}
|
8574
8578
|
|
8575
8579
|
function renderChild() {
|
8576
|
-
var
|
8580
|
+
var curData = getCurrentData();
|
8581
|
+
var value = curData.map(function (d) {
|
8582
|
+
return d === null || d === void 0 ? void 0 : d.value;
|
8583
|
+
});
|
8577
8584
|
return React__default["default"].Children.map(children, function (col, index) {
|
8578
8585
|
return /*#__PURE__*/React__default["default"].cloneElement(col, {
|
8579
|
-
|
8580
|
-
return
|
8581
|
-
},
|
8582
|
-
onValueChange: function onValueChange(val) {
|
8583
|
-
return _onValueChange(val, index);
|
8586
|
+
onValueChange: function onValueChange(val, changedData) {
|
8587
|
+
return _onValueChange(val, index, changedData);
|
8584
8588
|
},
|
8585
8589
|
selectedValue: value[index]
|
8586
8590
|
});
|
@@ -8663,17 +8667,15 @@
|
|
8663
8667
|
// index有改变时再抛出
|
8664
8668
|
// @en Throws again when index changes
|
8665
8669
|
if (currentIndex !== nowItemIndex) {
|
8666
|
-
setCurrentIndex(nowItemIndex);
|
8667
|
-
var
|
8670
|
+
setCurrentIndex(Math.max(nowItemIndex, 0));
|
8671
|
+
var newData = data[nowItemIndex];
|
8672
|
+
var newValue = newData === null || newData === void 0 ? void 0 : newData.value;
|
8668
8673
|
|
8669
8674
|
if (newValue !== currentValue) {
|
8670
|
-
// if (!('selectedValue' in props)) {
|
8671
|
-
// setCurrentValue(newValue);
|
8672
|
-
// }
|
8673
8675
|
setCurrentValue(newValue);
|
8674
8676
|
|
8675
8677
|
if (onValueChange) {
|
8676
|
-
onValueChange(newValue);
|
8678
|
+
onValueChange(newValue, newData);
|
8677
8679
|
}
|
8678
8680
|
}
|
8679
8681
|
}
|
@@ -8918,7 +8920,7 @@
|
|
8918
8920
|
var curIndex = data.findIndex(function (item) {
|
8919
8921
|
return item.value === selectedValue;
|
8920
8922
|
});
|
8921
|
-
setCurrentIndex(curIndex);
|
8923
|
+
setCurrentIndex(Math.max(curIndex, 0));
|
8922
8924
|
|
8923
8925
|
if (curIndex >= 0) {
|
8924
8926
|
_scrollToIndexWithChange(curIndex);
|
@@ -8970,7 +8972,6 @@
|
|
8970
8972
|
wrapperHeight = props.wrapperHeight,
|
8971
8973
|
rows = props.rows,
|
8972
8974
|
hideEmptyCols = props.hideEmptyCols,
|
8973
|
-
onPickerChange = props.onPickerChange,
|
8974
8975
|
onValueChange = props.onValueChange,
|
8975
8976
|
_a = props.selectedValue,
|
8976
8977
|
selectedValue = _a === void 0 ? [] : _a,
|
@@ -8995,7 +8996,7 @@
|
|
8995
8996
|
});
|
8996
8997
|
}
|
8997
8998
|
|
8998
|
-
function _onValueChange(value, index) {
|
8999
|
+
function _onValueChange(value, index, newData) {
|
8999
9000
|
var children = arrayTreeFilter(data, function (item, level) {
|
9000
9001
|
return level <= index && item.value === value[level];
|
9001
9002
|
});
|
@@ -9005,15 +9006,19 @@
|
|
9005
9006
|
for (i = index + 1; i < cols && child && child.children; i++) {
|
9006
9007
|
child = child.children[0];
|
9007
9008
|
value[i] = child.value;
|
9009
|
+
newData[i] = child;
|
9008
9010
|
}
|
9009
9011
|
|
9010
9012
|
value.length = i;
|
9011
|
-
|
9013
|
+
newData.length = i;
|
9014
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(value, index, newData);
|
9012
9015
|
}
|
9013
9016
|
|
9014
9017
|
function _formatData() {
|
9015
9018
|
var childrenTree = arrayTreeFilter(data, function (item, level) {
|
9016
|
-
return item.value === selectedValue[level];
|
9019
|
+
return item.value === (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue[level]);
|
9020
|
+
}, {
|
9021
|
+
fallbackChildIndex: 0
|
9017
9022
|
}).map(function (item) {
|
9018
9023
|
return item.children;
|
9019
9024
|
});
|
@@ -9038,8 +9043,7 @@
|
|
9038
9043
|
data: formatData,
|
9039
9044
|
selectedValue: selectedValue,
|
9040
9045
|
itemHeight: itemHeight,
|
9041
|
-
onValueChange: _onValueChange
|
9042
|
-
onPickerChange: onPickerChange
|
9046
|
+
onValueChange: _onValueChange
|
9043
9047
|
}, formatData.map(function (item, index) {
|
9044
9048
|
return /*#__PURE__*/React__default["default"].createElement(PickerCell, {
|
9045
9049
|
key: index + "_picker_cell_cascader",
|
@@ -9097,7 +9101,7 @@
|
|
9097
9101
|
var wrapperRef = React.useRef(null);
|
9098
9102
|
var domRef = React.useRef(null);
|
9099
9103
|
var barRef = React.useRef(null);
|
9100
|
-
var scrollValueRef =
|
9104
|
+
var scrollValueRef = useLatestRef(scrollValue);
|
9101
9105
|
var pickerCellsRef = React.useRef([]);
|
9102
9106
|
var cascaderRef = React.useRef(null);
|
9103
9107
|
var innerData = React.useMemo(function () {
|
@@ -9130,20 +9134,19 @@
|
|
9130
9134
|
|
9131
9135
|
return newData;
|
9132
9136
|
}, [data]);
|
9133
|
-
React.useEffect(function () {
|
9134
|
-
scrollValueRef.current = scrollValue;
|
9135
|
-
}, [scrollValue]);
|
9136
9137
|
|
9137
9138
|
var getAllColumnValues = function getAllColumnValues() {
|
9138
|
-
return scrollValueRef.current;
|
9139
|
+
return scrollValueRef.current || [];
|
9139
9140
|
};
|
9140
9141
|
|
9141
9142
|
function getColumnValue(index) {
|
9143
|
+
var _a;
|
9144
|
+
|
9142
9145
|
if (index === void 0) {
|
9143
9146
|
index = 0;
|
9144
9147
|
}
|
9145
9148
|
|
9146
|
-
return scrollValueRef.current[index];
|
9149
|
+
return (_a = scrollValueRef.current) === null || _a === void 0 ? void 0 : _a[index];
|
9147
9150
|
}
|
9148
9151
|
|
9149
9152
|
function getCellMovingStatus() {
|
@@ -9179,25 +9182,17 @@
|
|
9179
9182
|
};
|
9180
9183
|
});
|
9181
9184
|
|
9182
|
-
function
|
9183
|
-
setScrollValue(val);
|
9184
|
-
|
9185
|
-
if (onPickerChange) {
|
9186
|
-
onPickerChange(val, index);
|
9187
|
-
}
|
9188
|
-
}
|
9189
|
-
|
9190
|
-
function _onValueChange(val, index) {
|
9185
|
+
function _onValueChange(val, index, newData) {
|
9191
9186
|
setScrollValue(val);
|
9192
9187
|
|
9193
9188
|
if (onPickerChange) {
|
9194
|
-
onPickerChange(val, index);
|
9189
|
+
onPickerChange(val, index, newData);
|
9195
9190
|
}
|
9196
9191
|
}
|
9197
9192
|
|
9198
9193
|
React.useEffect(function () {
|
9199
9194
|
setScrollValue(value);
|
9200
|
-
}, [value
|
9195
|
+
}, [value]);
|
9201
9196
|
var updateWrapperHeight = React.useCallback(function () {
|
9202
9197
|
if (wrapperRef && wrapperRef.current) {
|
9203
9198
|
setWrapperHeight(wrapperRef.current.offsetHeight);
|
@@ -9242,7 +9237,6 @@
|
|
9242
9237
|
data: data,
|
9243
9238
|
selectedValue: scrollValue,
|
9244
9239
|
onValueChange: _onValueChange,
|
9245
|
-
onPickerChange: _onPickerChange,
|
9246
9240
|
clickable: clickable,
|
9247
9241
|
itemHeight: itemHeight,
|
9248
9242
|
wrapperHeight: wrapperHeight,
|
@@ -9256,8 +9250,7 @@
|
|
9256
9250
|
data: innerData,
|
9257
9251
|
itemHeight: itemHeight,
|
9258
9252
|
selectedValue: scrollValue,
|
9259
|
-
onValueChange: _onValueChange
|
9260
|
-
onPickerChange: _onPickerChange
|
9253
|
+
onValueChange: _onValueChange
|
9261
9254
|
}, innerData.map(function (item, index) {
|
9262
9255
|
return /*#__PURE__*/React__default["default"].createElement(PickerCell, {
|
9263
9256
|
key: index + "_picker_cell_normal",
|
@@ -9299,42 +9292,6 @@
|
|
9299
9292
|
|
9300
9293
|
var PickerView$1 = componentWrapper(PickerView, 'PickerView');
|
9301
9294
|
|
9302
|
-
var getInitialValue = function getInitialValue(value, data, cascade) {
|
9303
|
-
var _a;
|
9304
|
-
|
9305
|
-
if (value && value.length) {
|
9306
|
-
return value;
|
9307
|
-
}
|
9308
|
-
|
9309
|
-
var computedValue = [];
|
9310
|
-
|
9311
|
-
if (!cascade) {
|
9312
|
-
if (!(data[0] instanceof Array)) {
|
9313
|
-
return ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.value) ? [data[0].value] : [];
|
9314
|
-
}
|
9315
|
-
|
9316
|
-
data.map(function (column) {
|
9317
|
-
computedValue.push(typeof column[0] === 'object' ? column[0].value : column[0]);
|
9318
|
-
});
|
9319
|
-
} else {
|
9320
|
-
var cascadePickerData = data;
|
9321
|
-
|
9322
|
-
if (!cascadePickerData || !cascadePickerData.length) {
|
9323
|
-
return computedValue;
|
9324
|
-
}
|
9325
|
-
|
9326
|
-
computedValue.push(cascadePickerData[0].value);
|
9327
|
-
var traverse = cascadePickerData[0].children;
|
9328
|
-
|
9329
|
-
while (traverse) {
|
9330
|
-
computedValue.push(traverse[0].value);
|
9331
|
-
traverse = traverse[0].children;
|
9332
|
-
}
|
9333
|
-
}
|
9334
|
-
|
9335
|
-
return computedValue;
|
9336
|
-
};
|
9337
|
-
|
9338
9295
|
var Picker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
9339
9296
|
var className = props.className,
|
9340
9297
|
itemStyle = props.itemStyle,
|
@@ -9372,7 +9329,7 @@
|
|
9372
9329
|
gestureOutOfControl = _l === void 0 ? true : _l,
|
9373
9330
|
otherProps = __rest$1(props, ["className", "itemStyle", "cascade", "cols", "rows", "data", "okText", "dismissText", "disabled", "clickable", "hideEmptyCols", "title", "visible", "value", "needBottomOffset", "onDismiss", "onOk", "onChange", "maskClosable", "onHide", "onPickerChange", "touchToStop", "gestureOutOfControl"]);
|
9374
9331
|
|
9375
|
-
var _m = React.useState(
|
9332
|
+
var _m = React.useState(value),
|
9376
9333
|
scrollValue = _m[0],
|
9377
9334
|
setScrollValue = _m[1];
|
9378
9335
|
|
@@ -9426,7 +9383,7 @@
|
|
9426
9383
|
nextTick(function () {
|
9427
9384
|
var _a;
|
9428
9385
|
|
9429
|
-
var val = ((_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.getAllColumnValues()) || scrollValue;
|
9386
|
+
var val = ((_a = pickerViewRef.current) === null || _a === void 0 ? void 0 : _a.getAllColumnValues()) || scrollValue || [];
|
9430
9387
|
|
9431
9388
|
if (onOk) {
|
9432
9389
|
onOk(val);
|
@@ -9489,7 +9446,7 @@
|
|
9489
9446
|
cols: cols,
|
9490
9447
|
rows: rows,
|
9491
9448
|
disabled: disabled,
|
9492
|
-
value:
|
9449
|
+
value: value,
|
9493
9450
|
onPickerChange: onPickerChange,
|
9494
9451
|
itemStyle: itemStyle,
|
9495
9452
|
clickable: clickable,
|
@@ -9865,7 +9822,7 @@
|
|
9865
9822
|
* @displayName DatePicker
|
9866
9823
|
*/
|
9867
9824
|
|
9868
|
-
var index$
|
9825
|
+
var index$k = componentWrapper(DatePicker, 'DatePicker');
|
9869
9826
|
|
9870
9827
|
/**
|
9871
9828
|
* 划分内容的装饰线
|
@@ -10104,7 +10061,7 @@
|
|
10104
10061
|
* @name_en Dialog
|
10105
10062
|
*/
|
10106
10063
|
|
10107
|
-
var index$
|
10064
|
+
var index$j = componentWrapper(Dialog, methodsGenerator$4(DialogWithGlobalContext));
|
10108
10065
|
|
10109
10066
|
function IconCheck(props) {
|
10110
10067
|
var _a = props.className,
|
@@ -10561,7 +10518,7 @@
|
|
10561
10518
|
* */
|
10562
10519
|
|
10563
10520
|
function isCascadeArray(options) {
|
10564
|
-
return typeof options[0] === 'object' && !isArray(options[0]);
|
10521
|
+
return typeof options[0] === 'object' && !isArray$1(options[0]);
|
10565
10522
|
}
|
10566
10523
|
/**
|
10567
10524
|
* 格式化传入的数组
|
@@ -10675,7 +10632,7 @@
|
|
10675
10632
|
fill: useCurrentColor ? 'currentColor' : '#000',
|
10676
10633
|
viewBox: "0 0 1024 1024",
|
10677
10634
|
xmlns: "http://www.w3.org/2000/svg"
|
10678
|
-
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null
|
10635
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null), /*#__PURE__*/React__default["default"].createElement("path", {
|
10679
10636
|
d: "M195.456 341.333h633.088a21.333 21.333 0 0116.235 35.158L528.256 748.885a21.333 21.333 0 01-32.512 0L179.221 376.491a21.333 21.333 0 0116.235-35.158z"
|
10680
10637
|
}));
|
10681
10638
|
});
|
@@ -11875,7 +11832,7 @@
|
|
11875
11832
|
};
|
11876
11833
|
});
|
11877
11834
|
|
11878
|
-
var index$
|
11835
|
+
var index$i = (function () {
|
11879
11836
|
// Export existing implementation if available.
|
11880
11837
|
if (typeof global$1.ResizeObserver !== 'undefined') {
|
11881
11838
|
return global$1.ResizeObserver;
|
@@ -12106,7 +12063,7 @@
|
|
12106
12063
|
React.useEffect(function () {
|
12107
12064
|
if (domRef.current && reflowOnResize) {
|
12108
12065
|
if (!observerRef.current && ellipsis) {
|
12109
|
-
observerRef.current = new index$
|
12066
|
+
observerRef.current = new index$i(reflow);
|
12110
12067
|
observerRef.current.observe(domRef.current);
|
12111
12068
|
}
|
12112
12069
|
}
|
@@ -12631,7 +12588,8 @@
|
|
12631
12588
|
|
12632
12589
|
var _c = _this.props,
|
12633
12590
|
children = _c.children,
|
12634
|
-
|
12591
|
+
_d = _c.trigger,
|
12592
|
+
trigger = _d === void 0 ? 'onChange' : _d;
|
12635
12593
|
|
12636
12594
|
if (trigger && ((_a = children.props) === null || _a === void 0 ? void 0 : _a[trigger])) {
|
12637
12595
|
(_b = children.props) === null || _b === void 0 ? void 0 : _b[trigger].apply(_b, __spreadArrays$1([_, value], args));
|
@@ -12651,7 +12609,8 @@
|
|
12651
12609
|
|
12652
12610
|
var _c = _this.props,
|
12653
12611
|
children = _c.children,
|
12654
|
-
|
12612
|
+
_d = _c.trigger,
|
12613
|
+
trigger = _d === void 0 ? 'onChange' : _d;
|
12655
12614
|
|
12656
12615
|
if (trigger && ((_a = children.props) === null || _a === void 0 ? void 0 : _a[trigger])) {
|
12657
12616
|
(_b = children.props) === null || _b === void 0 ? void 0 : _b[trigger].apply(_b, __spreadArrays$1([value], args));
|
@@ -12924,7 +12883,7 @@
|
|
12924
12883
|
|
12925
12884
|
var fieldDisabled = disabled || propsDisabled;
|
12926
12885
|
var fieldRules = (rest === null || rest === void 0 ? void 0 : rest.required) ? __spreadArrays$1([{
|
12927
|
-
type: ValidatorType.String,
|
12886
|
+
type: ValidatorType$1.String,
|
12928
12887
|
required: true
|
12929
12888
|
}], rules || []) : rules;
|
12930
12889
|
var isRequired = isFieldRequired(rules) || (rest === null || rest === void 0 ? void 0 : rest.required);
|
@@ -13031,7 +12990,7 @@
|
|
13031
12990
|
* @name_en Form
|
13032
12991
|
*/
|
13033
12992
|
|
13034
|
-
var index$
|
12993
|
+
var index$h = componentWrapper(Form, {
|
13035
12994
|
Item: Item$1
|
13036
12995
|
});
|
13037
12996
|
|
@@ -13404,7 +13363,7 @@
|
|
13404
13363
|
* @displayName Input
|
13405
13364
|
*/
|
13406
13365
|
|
13407
|
-
var index$
|
13366
|
+
var index$g = componentWrapper(Input, 'Input');
|
13408
13367
|
|
13409
13368
|
var Textarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
13410
13369
|
var id = props.id,
|
@@ -13551,7 +13510,7 @@
|
|
13551
13510
|
* @displayName Textarea
|
13552
13511
|
*/
|
13553
13512
|
|
13554
|
-
var index$
|
13513
|
+
var index$f = componentWrapper(Textarea, 'Textarea');
|
13555
13514
|
|
13556
13515
|
var RadioGroupContext = /*#__PURE__*/React__default["default"].createContext({
|
13557
13516
|
isGroup: false,
|
@@ -13669,7 +13628,7 @@
|
|
13669
13628
|
* @displayName Radio
|
13670
13629
|
*/
|
13671
13630
|
|
13672
|
-
var index$
|
13631
|
+
var index$e = componentWrapper(Radio, 'Radio', {
|
13673
13632
|
Group: Group
|
13674
13633
|
});
|
13675
13634
|
|
@@ -13691,7 +13650,7 @@
|
|
13691
13650
|
fill: useCurrentColor ? 'currentColor' : '#000',
|
13692
13651
|
viewBox: "0 0 1024 1024",
|
13693
13652
|
xmlns: "http://www.w3.org/2000/svg"
|
13694
|
-
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null
|
13653
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null), /*#__PURE__*/React__default["default"].createElement("path", {
|
13695
13654
|
d: "M497.371 826.514L270.63 936.23c-18.286 7.314-40.229 0-47.543-18.286-3.657-3.657-7.315-10.972-3.657-18.286l25.6-248.686c0-10.971-3.658-18.285-7.315-29.257L69.486 435.2c-14.629-14.629-10.972-36.571 3.657-51.2 3.657-3.657 10.971-7.314 14.628-7.314l245.029-51.2c10.971-3.657 18.286-7.315 21.943-18.286l128-219.429C490.057 73.143 512 65.83 530.286 76.8c3.657 3.657 10.971 7.314 14.628 14.629l128 219.428c3.657 7.314 14.629 14.629 21.943 18.286l245.029 51.2c18.285 3.657 32.914 21.943 25.6 43.886 0 7.314-3.657 10.971-7.315 14.628L789.943 621.714c-7.314 7.315-10.972 18.286-7.314 29.257l25.6 248.686c3.657 18.286-10.972 36.572-32.915 40.229-7.314 0-14.628 0-18.285-3.657L530.286 826.514c-10.972-7.314-25.6-7.314-32.915 0z"
|
13696
13655
|
}));
|
13697
13656
|
});
|
@@ -13897,7 +13856,7 @@
|
|
13897
13856
|
* @displayName Rate
|
13898
13857
|
*/
|
13899
13858
|
|
13900
|
-
var index$
|
13859
|
+
var index$d = componentWrapper(Rate, 'Rate');
|
13901
13860
|
|
13902
13861
|
var useSliderIcon = function useSliderIcon(_a) {
|
13903
13862
|
var valueGroup = _a.valueGroup;
|
@@ -14254,30 +14213,30 @@
|
|
14254
14213
|
return function (realTimeValue) {
|
14255
14214
|
setValueGroup(realTimeValue);
|
14256
14215
|
};
|
14257
|
-
}
|
14258
|
-
var index_1 = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
14216
|
+
}
|
14259
14217
|
|
14260
|
-
|
14261
|
-
setValueGroup(function (passValueGroup) {
|
14262
|
-
if (typeof passValueGroup === 'number') {
|
14263
|
-
return [passValueGroup, realTimeValue];
|
14264
|
-
}
|
14218
|
+
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
14265
14219
|
|
14266
|
-
|
14220
|
+
var handleValue = function handleValue(realTimeValue) {
|
14221
|
+
setValueGroup(function (passValueGroup) {
|
14222
|
+
if (typeof passValueGroup === 'number') {
|
14223
|
+
return [passValueGroup, realTimeValue];
|
14224
|
+
}
|
14267
14225
|
|
14268
|
-
|
14269
|
-
return newValueGroup;
|
14270
|
-
});
|
14271
|
-
};
|
14226
|
+
var newValueGroup = __spreadArrays$1(passValueGroup);
|
14272
14227
|
|
14273
|
-
|
14274
|
-
|
14275
|
-
|
14276
|
-
|
14277
|
-
}
|
14228
|
+
newValueGroup[index] = realTimeValue;
|
14229
|
+
return newValueGroup;
|
14230
|
+
});
|
14231
|
+
};
|
14278
14232
|
|
14279
|
-
|
14233
|
+
if (isTouching) {
|
14234
|
+
setCommonIsTouching(index);
|
14235
|
+
handleValue(start);
|
14236
|
+
setIsTouching(IsTouchingStatus.Moving);
|
14280
14237
|
}
|
14238
|
+
|
14239
|
+
return handleValue;
|
14281
14240
|
}, [touchStartPosition, getValueFromPosition]);
|
14282
14241
|
React.useEffect(function () {
|
14283
14242
|
var _a;
|
@@ -14663,7 +14622,7 @@
|
|
14663
14622
|
* @displayName Slider
|
14664
14623
|
*/
|
14665
14624
|
|
14666
|
-
var index$
|
14625
|
+
var index$c = componentWrapper(SliderWrapper, 'Slider');
|
14667
14626
|
|
14668
14627
|
/**
|
14669
14628
|
* 宫格可以在水平方向上把页面分隔成等宽度的区块,用于展示内容或进行页面导航。
|
@@ -14938,7 +14897,7 @@
|
|
14938
14897
|
throw new TypeError(FUNC_ERROR_TEXT);
|
14939
14898
|
}
|
14940
14899
|
wait = toNumber(wait) || 0;
|
14941
|
-
if (isObject(options)) {
|
14900
|
+
if (isObject$1(options)) {
|
14942
14901
|
leading = !!options.leading;
|
14943
14902
|
maxing = 'maxWait' in options;
|
14944
14903
|
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
@@ -15095,7 +15054,7 @@
|
|
15095
15054
|
if (typeof func != 'function') {
|
15096
15055
|
throw new TypeError(FUNC_ERROR_TEXT);
|
15097
15056
|
}
|
15098
|
-
if (isObject(options)) {
|
15057
|
+
if (isObject$1(options)) {
|
15099
15058
|
leading = 'leading' in options ? !!options.leading : leading;
|
15100
15059
|
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
15101
15060
|
}
|
@@ -15131,7 +15090,7 @@
|
|
15131
15090
|
* _.isObject(null);
|
15132
15091
|
* // => false
|
15133
15092
|
*/
|
15134
|
-
function isObject(value) {
|
15093
|
+
function isObject$1(value) {
|
15135
15094
|
var type = typeof value;
|
15136
15095
|
return !!value && (type == 'object' || type == 'function');
|
15137
15096
|
}
|
@@ -15216,9 +15175,9 @@
|
|
15216
15175
|
if (isSymbol(value)) {
|
15217
15176
|
return NAN;
|
15218
15177
|
}
|
15219
|
-
if (isObject(value)) {
|
15178
|
+
if (isObject$1(value)) {
|
15220
15179
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
15221
|
-
value = isObject(other) ? (other + '') : other;
|
15180
|
+
value = isObject$1(other) ? (other + '') : other;
|
15222
15181
|
}
|
15223
15182
|
if (typeof value != 'string') {
|
15224
15183
|
return value === 0 ? value : +value;
|
@@ -16856,7 +16815,7 @@
|
|
16856
16815
|
fill: useCurrentColor ? 'currentColor' : '#000',
|
16857
16816
|
viewBox: "0 0 1024 1024",
|
16858
16817
|
xmlns: "http://www.w3.org/2000/svg"
|
16859
|
-
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null
|
16818
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("defs", null), /*#__PURE__*/React__default["default"].createElement("path", {
|
16860
16819
|
d: "M115.2 467.2h819.2c6.4 0 6.4 6.4 6.4 6.4V544c0 6.4-6.4 6.4-6.4 6.4H96c-6.4 0-6.4-6.4-6.4-6.4v-64c0-6.4 6.4-6.4 6.4-6.4 6.4-6.4 6.4-6.4 19.2-6.4z"
|
16861
16820
|
}));
|
16862
16821
|
});
|
@@ -16981,7 +16940,7 @@
|
|
16981
16940
|
}, other), /*#__PURE__*/React__default["default"].createElement("path", {
|
16982
16941
|
d: "M12 24C5.4 24 0 18.6 0 12S5.4 0 12 0s12 5.4 12 12-5.4 12-12 12zm0-22.5C6.2 1.5 1.5 6.2 1.5 12S6.2 22.5 12 22.5 22.5 17.8 22.5 12 17.8 1.5 12 1.5z"
|
16983
16942
|
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
16984
|
-
d: "M11.8 15.2h.3c.4 0 .7-.3.7-.7V7.2c0-.4-.3-.7-.7-.7h-.3c-.4 0-.7.3-.7.7v7.3c0 .4.3.7.7.
|
16943
|
+
d: "M11.8 15.2h.3c.4 0 .7-.3.7-.7V7.2c0-.4-.3-.7-.7-.7h-.3c-.4 0-.7.3-.7.7v7.3c0 .4.3.7.7.7zM12.2 16.5h-.3c-.4 0-.7.3-.7.7v.3c0 .4.3.7.7.7h.3c.4 0 .7-.3.7-.7v-.3c0-.4-.3-.7-.7-.7z"
|
16985
16944
|
}));
|
16986
16945
|
});
|
16987
16946
|
}
|
@@ -17068,6 +17027,68 @@
|
|
17068
17027
|
});
|
17069
17028
|
}
|
17070
17029
|
|
17030
|
+
function IconKeyboard(props) {
|
17031
|
+
var _a = props.className,
|
17032
|
+
className = _a === void 0 ? '' : _a,
|
17033
|
+
_b = props.useCurrentColor,
|
17034
|
+
useCurrentColor = _b === void 0 ? true : _b,
|
17035
|
+
style = props.style,
|
17036
|
+
other = __rest$1(props, ["className", "useCurrentColor", "style"]);
|
17037
|
+
|
17038
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
17039
|
+
var prefixCls = _a.prefixCls;
|
17040
|
+
return /*#__PURE__*/React__default["default"].createElement("svg", __assign$2({
|
17041
|
+
className: prefixCls + "-icon " + prefixCls + "-icon-keyboard " + className,
|
17042
|
+
width: "1em",
|
17043
|
+
height: "1em",
|
17044
|
+
style: style,
|
17045
|
+
version: "1.1",
|
17046
|
+
xmlns: "http://www.w3.org/2000/svg",
|
17047
|
+
x: "0",
|
17048
|
+
y: "0",
|
17049
|
+
viewBox: "0 0 26 26",
|
17050
|
+
xmlSpace: "preserve"
|
17051
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("path", {
|
17052
|
+
d: "M15.9 21.7l-2.5 2.5c-.2.2-.5.2-.7 0l-2.5-2.5c-.3-.3-.1-.9.4-.9h5C16 20.9 16.2 21.4 15.9 21.7zM23.1 19.5H2.9c-1.1 0-2-.9-2-2V4.8c0-1.1.9-2 2-2h20.1c1.1 0 2 .9 2 2v12.7C25.1 18.6 24.2 19.5 23.1 19.5zM2.9 4.8L2.9 4.8v12.7h20.1V4.8H2.9z",
|
17053
|
+
fill: useCurrentColor ? 'currentColor' : '#1d2129'
|
17054
|
+
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
17055
|
+
d: "M10.6,6.6H8.2V9h2.4V6.6z M4.5,6.6H7V9H4.5V6.6z M8.8,10.2H6.4v2.4h2.4V10.2z M16,10.2h-2.4v2.4H16V10.2z M10,10.2h2.4v2.4H10V10.2z M19.6,10.2h-2.4v2.4h2.4V10.2z M11.8,6.6h2.4V9h-2.4V6.6z M17.8,6.6h-2.4V9h2.4V6.6z M19,6.6h2.4V9H19\tV6.6z M17.8,13.8H8.2v1.8h9.7V13.8z",
|
17056
|
+
fillRule: "evenodd",
|
17057
|
+
clipRule: "evenodd",
|
17058
|
+
fill: useCurrentColor ? 'currentColor' : '#1d2129'
|
17059
|
+
}));
|
17060
|
+
});
|
17061
|
+
}
|
17062
|
+
|
17063
|
+
function IconKeyboardDelete(props) {
|
17064
|
+
var _a = props.className,
|
17065
|
+
className = _a === void 0 ? '' : _a,
|
17066
|
+
_b = props.useCurrentColor,
|
17067
|
+
useCurrentColor = _b === void 0 ? true : _b,
|
17068
|
+
style = props.style,
|
17069
|
+
other = __rest$1(props, ["className", "useCurrentColor", "style"]);
|
17070
|
+
|
17071
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
17072
|
+
var prefixCls = _a.prefixCls;
|
17073
|
+
return /*#__PURE__*/React__default["default"].createElement("svg", __assign$2({
|
17074
|
+
className: prefixCls + "-icon " + prefixCls + "-icon-keyboard-delete " + className,
|
17075
|
+
width: "1em",
|
17076
|
+
height: "1em",
|
17077
|
+
style: style,
|
17078
|
+
xmlns: "http://www.w3.org/2000/svg",
|
17079
|
+
viewBox: "0 0 26 26"
|
17080
|
+
}, other), /*#__PURE__*/React__default["default"].createElement("path", {
|
17081
|
+
d: "M23.1,21.4H8.3c-0.6,0-1.2-0.3-1.6-0.8l-4.9-6.4c-0.5-0.7-0.5-1.7,0-2.4l4.9-6.4c0.4-0.5,1-0.8,1.6-0.8h14.8\tc1.1,0,2,0.9,2,2v12.7C25.1,20.5,24.2,21.4,23.1,21.4z M8.3,6.6L3.4,13l4.9,6.4h14.8V6.6H8.3z",
|
17082
|
+
fill: useCurrentColor ? 'currentColor' : '#1d2129'
|
17083
|
+
}), /*#__PURE__*/React__default["default"].createElement("path", {
|
17084
|
+
d: "M11.3,9.4c0.4-0.4,1-0.4,1.3,0l2.5,2.5l2.5-2.5c0.4-0.4,1-0.4,1.3,0c0.4,0.4,0.4,1,0,1.3l-2.5,2.5l2.3,2.3\tc0.4,0.4,0.4,1,0,1.3c-0.4,0.4-1,0.4-1.3,0l-2.3-2.3L12.7,17c-0.4,0.4-1,0.4-1.3,0c-0.4-0.4-0.4-1,0-1.3l2.4-2.4l-2.5-2.5\tC10.9,10.4,10.9,9.8,11.3,9.4z",
|
17085
|
+
fillRule: "evenodd",
|
17086
|
+
clipRule: "evenodd",
|
17087
|
+
fill: useCurrentColor ? 'currentColor' : '#1d2129'
|
17088
|
+
}));
|
17089
|
+
});
|
17090
|
+
}
|
17091
|
+
|
17071
17092
|
function AddIcon() {
|
17072
17093
|
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
17073
17094
|
width: "30",
|
@@ -17379,7 +17400,7 @@
|
|
17379
17400
|
* @displayName ImagePicker
|
17380
17401
|
*/
|
17381
17402
|
|
17382
|
-
var index$
|
17403
|
+
var index$b = componentWrapper(ImagePicker, 'ImagePicker');
|
17383
17404
|
|
17384
17405
|
/*!
|
17385
17406
|
* @arco-design/transformable v1.0.1
|
@@ -20575,15 +20596,1492 @@
|
|
20575
20596
|
* @name_en ImagePreview
|
20576
20597
|
*/
|
20577
20598
|
|
20578
|
-
var index$
|
20599
|
+
var index$a = componentWrapper(ImagePreview, methodsGenerator$3(ImagePreviewWithGlobalContext));
|
20600
|
+
|
20601
|
+
var opt = Object.prototype.toString;
|
20602
|
+
function isArray(obj) {
|
20603
|
+
return opt.call(obj) === '[object Array]';
|
20604
|
+
}
|
20605
|
+
function isObject(obj) {
|
20606
|
+
return opt.call(obj) === '[object Object]';
|
20607
|
+
}
|
20608
|
+
function isEmptyValue(obj) {
|
20609
|
+
return obj === undefined || obj === null || obj === '';
|
20610
|
+
}
|
20611
|
+
function isFunction(obj) {
|
20612
|
+
return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
|
20613
|
+
}
|
20614
|
+
function isEmptyArray(obj) {
|
20615
|
+
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
20616
|
+
}
|
20617
|
+
var isDeepEqual = function isDeepEqual(obj, sub) {
|
20618
|
+
if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
|
20619
|
+
return obj === sub;
|
20620
|
+
}
|
20621
|
+
|
20622
|
+
if (isFunction(obj) && isFunction(sub)) {
|
20623
|
+
return obj === sub || obj.toString() === sub.toString();
|
20624
|
+
}
|
20625
|
+
|
20626
|
+
if (Object.keys(obj).length !== Object.keys(sub).length) {
|
20627
|
+
return false;
|
20628
|
+
}
|
20629
|
+
|
20630
|
+
for (var key in obj) {
|
20631
|
+
if (!isDeepEqual(obj[key], sub[key])) return false;
|
20632
|
+
}
|
20633
|
+
|
20634
|
+
return true;
|
20635
|
+
};
|
20579
20636
|
|
20580
20637
|
/**
|
20581
|
-
*
|
20582
|
-
*
|
20583
|
-
*
|
20584
|
-
|
20585
|
-
|
20586
|
-
|
20638
|
+
* https://github.com/gre/bezier-easing
|
20639
|
+
* BezierEasing - use bezier curve for transition easing function
|
20640
|
+
* by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
20641
|
+
*/
|
20642
|
+
// These values are established by empiricism with tests (tradeoff: performance VS precision)
|
20643
|
+
var NEWTON_ITERATIONS = 4;
|
20644
|
+
var NEWTON_MIN_SLOPE = 0.001;
|
20645
|
+
var SUBDIVISION_PRECISION = 0.0000001;
|
20646
|
+
var SUBDIVISION_MAX_ITERATIONS = 10;
|
20647
|
+
var kSplineTableSize = 11;
|
20648
|
+
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
20649
|
+
var float32ArraySupported = typeof Float32Array === 'function';
|
20650
|
+
|
20651
|
+
function A(aA1, aA2) {
|
20652
|
+
return 1.0 - 3.0 * aA2 + 3.0 * aA1;
|
20653
|
+
}
|
20654
|
+
|
20655
|
+
function B(aA1, aA2) {
|
20656
|
+
return 3.0 * aA2 - 6.0 * aA1;
|
20657
|
+
}
|
20658
|
+
|
20659
|
+
function C(aA1) {
|
20660
|
+
return 3.0 * aA1;
|
20661
|
+
} // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
20662
|
+
|
20663
|
+
|
20664
|
+
function calcBezier(aT, aA1, aA2) {
|
20665
|
+
return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;
|
20666
|
+
} // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
20667
|
+
|
20668
|
+
|
20669
|
+
function getSlope(aT, aA1, aA2) {
|
20670
|
+
return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
20671
|
+
}
|
20672
|
+
|
20673
|
+
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
20674
|
+
var currentX, currentT;
|
20675
|
+
var i = 0;
|
20676
|
+
|
20677
|
+
do {
|
20678
|
+
currentT = aA + (aB - aA) / 2.0;
|
20679
|
+
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
20680
|
+
|
20681
|
+
if (currentX > 0.0) {
|
20682
|
+
aB = currentT;
|
20683
|
+
} else {
|
20684
|
+
aA = currentT;
|
20685
|
+
}
|
20686
|
+
} while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
20687
|
+
|
20688
|
+
return currentT;
|
20689
|
+
}
|
20690
|
+
|
20691
|
+
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
20692
|
+
for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
20693
|
+
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
20694
|
+
|
20695
|
+
if (currentSlope === 0.0) {
|
20696
|
+
return aGuessT;
|
20697
|
+
}
|
20698
|
+
|
20699
|
+
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
20700
|
+
aGuessT -= currentX / currentSlope;
|
20701
|
+
}
|
20702
|
+
|
20703
|
+
return aGuessT;
|
20704
|
+
}
|
20705
|
+
|
20706
|
+
function LinearEasing(x) {
|
20707
|
+
return x;
|
20708
|
+
}
|
20709
|
+
|
20710
|
+
function bezier(mX1, mY1, mX2, mY2) {
|
20711
|
+
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
20712
|
+
throw new Error('bezier x values must be in [0, 1] range');
|
20713
|
+
}
|
20714
|
+
|
20715
|
+
if (mX1 === mY1 && mX2 === mY2) {
|
20716
|
+
return LinearEasing;
|
20717
|
+
} // Precompute samples table
|
20718
|
+
|
20719
|
+
|
20720
|
+
var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
20721
|
+
|
20722
|
+
for (var i = 0; i < kSplineTableSize; ++i) {
|
20723
|
+
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
20724
|
+
}
|
20725
|
+
|
20726
|
+
function getTForX(aX) {
|
20727
|
+
var intervalStart = 0.0;
|
20728
|
+
var currentSample = 1;
|
20729
|
+
var lastSample = kSplineTableSize - 1;
|
20730
|
+
|
20731
|
+
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
20732
|
+
intervalStart += kSampleStepSize;
|
20733
|
+
}
|
20734
|
+
|
20735
|
+
--currentSample; // Interpolate to provide an initial guess for t
|
20736
|
+
|
20737
|
+
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
20738
|
+
var guessForT = intervalStart + dist * kSampleStepSize;
|
20739
|
+
var initialSlope = getSlope(guessForT, mX1, mX2);
|
20740
|
+
|
20741
|
+
if (initialSlope >= NEWTON_MIN_SLOPE) {
|
20742
|
+
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
20743
|
+
}
|
20744
|
+
|
20745
|
+
if (initialSlope === 0.0) {
|
20746
|
+
return guessForT;
|
20747
|
+
}
|
20748
|
+
|
20749
|
+
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
20750
|
+
}
|
20751
|
+
|
20752
|
+
return function BezierEasing(x) {
|
20753
|
+
// Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
20754
|
+
if (x === 0 || x === 1) {
|
20755
|
+
return x;
|
20756
|
+
}
|
20757
|
+
|
20758
|
+
return calcBezier(getTForX(x), mY1, mY2);
|
20759
|
+
};
|
20760
|
+
}
|
20761
|
+
|
20762
|
+
function execRAF(fn) {
|
20763
|
+
try {
|
20764
|
+
return requestAnimationFrame(fn);
|
20765
|
+
} catch (e) {
|
20766
|
+
return setTimeout(fn, 17);
|
20767
|
+
}
|
20768
|
+
}
|
20769
|
+
function scrollWithAnimation(initTop, target, scrollTo, duration, bezier$1, type) {
|
20770
|
+
if (duration === void 0) {
|
20771
|
+
duration = 300;
|
20772
|
+
}
|
20773
|
+
|
20774
|
+
if (bezier$1 === void 0) {
|
20775
|
+
bezier$1 = [0.34, 0.69, 0.1, 1];
|
20776
|
+
}
|
20777
|
+
|
20778
|
+
if (type === void 0) {
|
20779
|
+
type = 'to';
|
20780
|
+
}
|
20781
|
+
|
20782
|
+
var targetTop = Math.max(0, type === 'by' ? initTop + target : target);
|
20783
|
+
var start = Date.now();
|
20784
|
+
|
20785
|
+
var fn = function fn() {
|
20786
|
+
var p = (Date.now() - start) / duration;
|
20787
|
+
|
20788
|
+
if (p > 1) {
|
20789
|
+
scrollTo(targetTop);
|
20790
|
+
} else {
|
20791
|
+
var newTop = initTop + (targetTop - initTop) * bezier.apply(void 0, bezier$1)(p);
|
20792
|
+
scrollTo(newTop);
|
20793
|
+
execRAF(fn);
|
20794
|
+
}
|
20795
|
+
};
|
20796
|
+
|
20797
|
+
execRAF(fn);
|
20798
|
+
}
|
20799
|
+
|
20800
|
+
var ValidatorType;
|
20801
|
+
|
20802
|
+
(function (ValidatorType) {
|
20803
|
+
ValidatorType["Number"] = "number";
|
20804
|
+
ValidatorType["String"] = "string";
|
20805
|
+
ValidatorType["Array"] = "array";
|
20806
|
+
ValidatorType["Boolean"] = "boolean";
|
20807
|
+
ValidatorType["Object"] = "object";
|
20808
|
+
ValidatorType["Custom"] = "custom";
|
20809
|
+
})(ValidatorType || (ValidatorType = {}));
|
20810
|
+
|
20811
|
+
var defaultMessageTemplate = '%s is not a %s type';
|
20812
|
+
var messageTemplate = {
|
20813
|
+
required: '%s is required',
|
20814
|
+
type: {
|
20815
|
+
email: defaultMessageTemplate,
|
20816
|
+
url: defaultMessageTemplate,
|
20817
|
+
string: defaultMessageTemplate,
|
20818
|
+
number: defaultMessageTemplate,
|
20819
|
+
array: defaultMessageTemplate,
|
20820
|
+
object: defaultMessageTemplate,
|
20821
|
+
boolean: defaultMessageTemplate
|
20822
|
+
},
|
20823
|
+
number: {
|
20824
|
+
min: '`%s` is not greater than `%s`',
|
20825
|
+
max: '`%s` is not less than `%s`',
|
20826
|
+
equal: '`%s` is not equal to `%s`',
|
20827
|
+
range: '`%s` is not in range `%s ~ %s`',
|
20828
|
+
positive: '`%s` is not a positive number',
|
20829
|
+
negative: '`%s` is not a negative number'
|
20830
|
+
},
|
20831
|
+
string: {
|
20832
|
+
max: '%s cannot be longer than %s characters',
|
20833
|
+
min: '%s must be at least %s characters',
|
20834
|
+
len: '%s must be exactly %s characters',
|
20835
|
+
match: '`%s` does not match the pattern %s',
|
20836
|
+
uppercase: '%s must be all uppercased',
|
20837
|
+
lowercase: '%s must be all lowercased',
|
20838
|
+
whitespace: '%s cannot be string of whitespace'
|
20839
|
+
},
|
20840
|
+
array: {
|
20841
|
+
max: '%s cannot be greater than %s in length',
|
20842
|
+
min: '%s cannot be less than %s in length',
|
20843
|
+
len: '%s must be exactly %s in length',
|
20844
|
+
includes: '%s is not includes %s',
|
20845
|
+
deepEqual: '%s is not deep equal with%s'
|
20846
|
+
},
|
20847
|
+
object: {
|
20848
|
+
deepEqual: '%s is not deep equal with %s',
|
20849
|
+
hasKeys: '%s does not contain required fields %s'
|
20850
|
+
},
|
20851
|
+
boolean: {
|
20852
|
+
equal: '%s is not equal to `%s`'
|
20853
|
+
}
|
20854
|
+
};
|
20855
|
+
var getMsgTemplate = function getMsgTemplate(templates, temName, values) {
|
20856
|
+
var temNameArr = temName.split('.');
|
20857
|
+
var theTemplate = defaultMessageTemplate;
|
20858
|
+
|
20859
|
+
if (temNameArr[0] in templates) {
|
20860
|
+
var firstTemplate = templates[temNameArr[0]];
|
20861
|
+
|
20862
|
+
if (Object.prototype.toString.call(firstTemplate).toLowerCase() === '[object object]' && temNameArr.length > 1 && temNameArr[1] in templates[temNameArr[0]]) {
|
20863
|
+
theTemplate = firstTemplate[temNameArr[1]];
|
20864
|
+
} else {
|
20865
|
+
theTemplate = firstTemplate;
|
20866
|
+
}
|
20867
|
+
}
|
20868
|
+
|
20869
|
+
var cur = 0;
|
20870
|
+
return theTemplate.replace(/%s/g, function (curVal) {
|
20871
|
+
return cur < values.length ? values[cur++] : curVal;
|
20872
|
+
});
|
20873
|
+
};
|
20874
|
+
var mergeMsgTemplate = function mergeMsgTemplate(originMT, newMT) {
|
20875
|
+
var targetMT = originMT;
|
20876
|
+
|
20877
|
+
if (newMT) {
|
20878
|
+
Object.keys(originMT).forEach(function (key) {
|
20879
|
+
var originValue = originMT[key];
|
20880
|
+
var curValue = newMT === null || newMT === void 0 ? void 0 : newMT[key];
|
20881
|
+
targetMT[key] = isObject(originValue) ? __assign$2(__assign$2({}, originValue), curValue) : curValue || originValue;
|
20882
|
+
});
|
20883
|
+
}
|
20884
|
+
|
20885
|
+
return targetMT;
|
20886
|
+
};
|
20887
|
+
|
20888
|
+
var BaseValidator =
|
20889
|
+
/** @class */
|
20890
|
+
function () {
|
20891
|
+
function BaseValidator(value, rule, options) {
|
20892
|
+
this.value = value;
|
20893
|
+
|
20894
|
+
var _a = rule.message,
|
20895
|
+
message = _a === void 0 ? '' : _a,
|
20896
|
+
rest = __rest$1(rule, ["message"]);
|
20897
|
+
|
20898
|
+
this.message = message || '';
|
20899
|
+
this.type = rule.type || ValidatorType.String;
|
20900
|
+
this.error = {
|
20901
|
+
value: value,
|
20902
|
+
message: [],
|
20903
|
+
errorTypes: []
|
20904
|
+
};
|
20905
|
+
this.field = options.field || '';
|
20906
|
+
this.rule = rest;
|
20907
|
+
this.validateRules = [];
|
20908
|
+
this.curValidMsgTemplate = mergeMsgTemplate(messageTemplate, options.validateMessage);
|
20909
|
+
}
|
20910
|
+
|
20911
|
+
BaseValidator.prototype.isRequired = function () {
|
20912
|
+
// 优先级最高
|
20913
|
+
if (isEmptyValue(this.value) || isEmptyArray(this.value)) {
|
20914
|
+
this.error.message = [this.message || getMsgTemplate(this.curValidMsgTemplate, 'required', [this.field])];
|
20915
|
+
this.error.errorTypes = ['required'];
|
20916
|
+
return false;
|
20917
|
+
}
|
20918
|
+
|
20919
|
+
return true;
|
20920
|
+
};
|
20921
|
+
|
20922
|
+
BaseValidator.prototype.addError = function (errorType, message) {
|
20923
|
+
var _a;
|
20924
|
+
|
20925
|
+
if (message) {
|
20926
|
+
this.error.errorTypes.push(errorType);
|
20927
|
+
(_a = this.error.message) === null || _a === void 0 ? void 0 : _a.push(message);
|
20928
|
+
}
|
20929
|
+
};
|
20930
|
+
|
20931
|
+
BaseValidator.prototype.dealError = function (isError, _a) {
|
20932
|
+
var _b;
|
20933
|
+
|
20934
|
+
var errTemplate = _a.errTemplate,
|
20935
|
+
values = _a.values;
|
20936
|
+
|
20937
|
+
if (isError) {
|
20938
|
+
var theMessage = this.message || getMsgTemplate(this.curValidMsgTemplate, errTemplate, values);
|
20939
|
+
this.error.errorTypes.push(errTemplate);
|
20940
|
+
(_b = this.error.message) === null || _b === void 0 ? void 0 : _b.push(theMessage);
|
20941
|
+
return theMessage;
|
20942
|
+
}
|
20943
|
+
|
20944
|
+
return '';
|
20945
|
+
};
|
20946
|
+
|
20947
|
+
BaseValidator.prototype.getErrors = function () {
|
20948
|
+
return this.error;
|
20949
|
+
};
|
20950
|
+
|
20951
|
+
return BaseValidator;
|
20952
|
+
}();
|
20953
|
+
|
20954
|
+
/** @class */
|
20955
|
+
(function (_super) {
|
20956
|
+
__extends$1(NumberValidator, _super);
|
20957
|
+
|
20958
|
+
function NumberValidator(value, rules, options) {
|
20959
|
+
var _this = _super.call(this, value, rules, options) || this;
|
20960
|
+
|
20961
|
+
_this.validateRules = ['min', 'max', 'equal', 'positive', 'negative'];
|
20962
|
+
return _this;
|
20963
|
+
}
|
20964
|
+
|
20965
|
+
NumberValidator.prototype.min = function (num) {
|
20966
|
+
this.dealError(!isEmptyValue(this.value) && this.value < num, {
|
20967
|
+
errTemplate: 'number.min',
|
20968
|
+
values: [this.field, "" + num]
|
20969
|
+
});
|
20970
|
+
};
|
20971
|
+
|
20972
|
+
NumberValidator.prototype.max = function (num) {
|
20973
|
+
this.dealError(!isEmptyValue(this.value) && this.value > num, {
|
20974
|
+
errTemplate: 'number.max',
|
20975
|
+
values: [this.field, "" + num]
|
20976
|
+
});
|
20977
|
+
};
|
20978
|
+
|
20979
|
+
NumberValidator.prototype.equal = function (num) {
|
20980
|
+
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
20981
|
+
errTemplate: 'number.equal',
|
20982
|
+
values: [this.field, "" + num]
|
20983
|
+
});
|
20984
|
+
};
|
20985
|
+
|
20986
|
+
NumberValidator.prototype.positive = function () {
|
20987
|
+
return this.dealError(!isEmptyValue(this.value) && this.value < 0, {
|
20988
|
+
errTemplate: 'number.positive',
|
20989
|
+
values: [this.field]
|
20990
|
+
});
|
20991
|
+
};
|
20992
|
+
|
20993
|
+
NumberValidator.prototype.negative = function () {
|
20994
|
+
return this.dealError(!isEmptyValue(this.value) && this.value > 0, {
|
20995
|
+
errTemplate: 'number.negative',
|
20996
|
+
values: [this.field]
|
20997
|
+
});
|
20998
|
+
};
|
20999
|
+
|
21000
|
+
return NumberValidator;
|
21001
|
+
})(BaseValidator);
|
21002
|
+
|
21003
|
+
/** @class */
|
21004
|
+
(function (_super) {
|
21005
|
+
__extends$1(StringValidator, _super);
|
21006
|
+
|
21007
|
+
function StringValidator(value, rules, options) {
|
21008
|
+
var _this = _super.call(this, value, rules, options) || this;
|
21009
|
+
|
21010
|
+
_this.validateRules = ['min', 'max', 'len', 'match', 'uppercase', 'lowercase', 'whitespace'];
|
21011
|
+
return _this;
|
21012
|
+
}
|
21013
|
+
|
21014
|
+
StringValidator.prototype.min = function (num) {
|
21015
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
21016
|
+
errTemplate: 'string.min',
|
21017
|
+
values: [this.field, "" + num]
|
21018
|
+
});
|
21019
|
+
};
|
21020
|
+
|
21021
|
+
StringValidator.prototype.max = function (num) {
|
21022
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
21023
|
+
errTemplate: 'string.max',
|
21024
|
+
values: [this.field, "" + num]
|
21025
|
+
});
|
21026
|
+
};
|
21027
|
+
|
21028
|
+
StringValidator.prototype.len = function (num) {
|
21029
|
+
return this.dealError(!isEmptyValue(this.value) && this.value !== num, {
|
21030
|
+
errTemplate: 'string.equal',
|
21031
|
+
values: [this.field, "" + num]
|
21032
|
+
});
|
21033
|
+
};
|
21034
|
+
|
21035
|
+
StringValidator.prototype.match = function (regStr) {
|
21036
|
+
var reg = new RegExp(regStr);
|
21037
|
+
return this.dealError(!isEmptyValue(this.value) && !reg.test(this.value), {
|
21038
|
+
errTemplate: 'string.match',
|
21039
|
+
values: [this.field, regStr]
|
21040
|
+
});
|
21041
|
+
};
|
21042
|
+
|
21043
|
+
StringValidator.prototype.uppercase = function (isValue) {
|
21044
|
+
var isUppercase = (this.value || '').toLocaleUpperCase() === this.value;
|
21045
|
+
return this.dealError(!isEmptyValue(this.value) && isUppercase !== isValue, {
|
21046
|
+
errTemplate: 'string.uppercase',
|
21047
|
+
values: [this.field]
|
21048
|
+
});
|
21049
|
+
};
|
21050
|
+
|
21051
|
+
StringValidator.prototype.lowercase = function (isValue) {
|
21052
|
+
var isLowercase = (this.value || '').toLocaleLowerCase() === this.value;
|
21053
|
+
return this.dealError(!isEmptyValue(this.value) && isLowercase !== isValue, {
|
21054
|
+
errTemplate: 'string.lowercase',
|
21055
|
+
values: [this.field]
|
21056
|
+
});
|
21057
|
+
};
|
21058
|
+
|
21059
|
+
StringValidator.prototype.whitespace = function () {
|
21060
|
+
return this.dealError(!isEmptyValue(this.value) && isEmptyValue(this.value.trim()), {
|
21061
|
+
errTemplate: 'string.whitespace',
|
21062
|
+
values: [this.field]
|
21063
|
+
});
|
21064
|
+
};
|
21065
|
+
|
21066
|
+
return StringValidator;
|
21067
|
+
})(BaseValidator);
|
21068
|
+
|
21069
|
+
/** @class */
|
21070
|
+
(function (_super) {
|
21071
|
+
__extends$1(ArrayValidator, _super);
|
21072
|
+
|
21073
|
+
function ArrayValidator(value, rules, options) {
|
21074
|
+
var _this = _super.call(this, value, rules, options) || this;
|
21075
|
+
|
21076
|
+
_this.validateRules = ['min', 'max', 'deepEqual', 'includes'];
|
21077
|
+
return _this;
|
21078
|
+
}
|
21079
|
+
|
21080
|
+
ArrayValidator.prototype.min = function (num) {
|
21081
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length < num, {
|
21082
|
+
errTemplate: 'array.min',
|
21083
|
+
values: [this.field, "" + num]
|
21084
|
+
});
|
21085
|
+
};
|
21086
|
+
|
21087
|
+
ArrayValidator.prototype.max = function (num) {
|
21088
|
+
return this.dealError(!isEmptyValue(this.value) && this.value.length > num, {
|
21089
|
+
errTemplate: 'array.max',
|
21090
|
+
values: [this.field, "" + num]
|
21091
|
+
});
|
21092
|
+
};
|
21093
|
+
|
21094
|
+
ArrayValidator.prototype.deepEqual = function (sub) {
|
21095
|
+
return this.dealError(!isDeepEqual(this.value, sub), {
|
21096
|
+
errTemplate: 'array.equal',
|
21097
|
+
values: [this.field, "" + JSON.stringify(sub)]
|
21098
|
+
});
|
21099
|
+
};
|
21100
|
+
|
21101
|
+
ArrayValidator.prototype.includes = function (sub) {
|
21102
|
+
var _this = this;
|
21103
|
+
|
21104
|
+
return this.dealError(sub.some(function (el) {
|
21105
|
+
return !_this.value.includes(el);
|
21106
|
+
}), {
|
21107
|
+
errTemplate: 'array.includes',
|
21108
|
+
values: [this.field, "" + JSON.stringify(sub)]
|
21109
|
+
});
|
21110
|
+
};
|
21111
|
+
|
21112
|
+
return ArrayValidator;
|
21113
|
+
})(BaseValidator);
|
21114
|
+
|
21115
|
+
/** @class */
|
21116
|
+
(function (_super) {
|
21117
|
+
__extends$1(ObjectValidator, _super);
|
21118
|
+
|
21119
|
+
function ObjectValidator(value, rules, options) {
|
21120
|
+
var _this = _super.call(this, value, rules, options) || this;
|
21121
|
+
|
21122
|
+
_this.validateRules = ['deepEqual', 'hasKeys'];
|
21123
|
+
return _this;
|
21124
|
+
}
|
21125
|
+
|
21126
|
+
ObjectValidator.prototype.deepEqual = function (sub) {
|
21127
|
+
return this.dealError(!isDeepEqual(this.value, sub), {
|
21128
|
+
errTemplate: 'object.deepEqual',
|
21129
|
+
values: [this.field, "" + JSON.stringify(sub)]
|
21130
|
+
});
|
21131
|
+
};
|
21132
|
+
|
21133
|
+
ObjectValidator.prototype.hasKeys = function (keys) {
|
21134
|
+
var allKeys = isEmptyValue(this.value) ? [] : Object.keys(this.value);
|
21135
|
+
return this.dealError(!isEmptyValue(this.value) && keys.some(function (theKey) {
|
21136
|
+
return !allKeys.includes(theKey);
|
21137
|
+
}), {
|
21138
|
+
errTemplate: 'object.hasKeys',
|
21139
|
+
values: [this.field, "" + JSON.stringify(keys)]
|
21140
|
+
});
|
21141
|
+
};
|
21142
|
+
|
21143
|
+
return ObjectValidator;
|
21144
|
+
})(BaseValidator);
|
21145
|
+
|
21146
|
+
/** @class */
|
21147
|
+
(function (_super) {
|
21148
|
+
__extends$1(CustomValidator, _super);
|
21149
|
+
|
21150
|
+
function CustomValidator(value, rules, options) {
|
21151
|
+
return _super.call(this, value, rules, options) || this;
|
21152
|
+
}
|
21153
|
+
|
21154
|
+
CustomValidator.prototype.validator = function (validatorTool) {
|
21155
|
+
var _this = this;
|
21156
|
+
|
21157
|
+
if (validatorTool) {
|
21158
|
+
return new Promise(function (resolve) {
|
21159
|
+
var ret = validatorTool(_this.value, function (message) {
|
21160
|
+
if (message === void 0) {
|
21161
|
+
message = '';
|
21162
|
+
}
|
21163
|
+
|
21164
|
+
return _this.addError('custom', message || '');
|
21165
|
+
});
|
21166
|
+
|
21167
|
+
if (ret && (ret === null || ret === void 0 ? void 0 : ret.then)) {
|
21168
|
+
ret.then(function () {
|
21169
|
+
return resolve(_this.getErrors());
|
21170
|
+
});
|
21171
|
+
} else {
|
21172
|
+
resolve(_this.getErrors());
|
21173
|
+
}
|
21174
|
+
});
|
21175
|
+
}
|
21176
|
+
|
21177
|
+
return null;
|
21178
|
+
};
|
21179
|
+
|
21180
|
+
return CustomValidator;
|
21181
|
+
})(BaseValidator);
|
21182
|
+
|
21183
|
+
var IndexBarContext = /*#__PURE__*/React.createContext({
|
21184
|
+
sticky: true,
|
21185
|
+
getScrollContainer: function getScrollContainer() {
|
21186
|
+
return null;
|
21187
|
+
},
|
21188
|
+
updateRef: function updateRef() {}
|
21189
|
+
});
|
21190
|
+
|
21191
|
+
/**
|
21192
|
+
* 粘性布局组件,元素相对于窗口或指定容器的吸顶效果。
|
21193
|
+
* @en Sticky layout component, The sticky-to-top effect of the element relative to the window or specified container
|
21194
|
+
* @type 布局
|
21195
|
+
* @type_en Layout
|
21196
|
+
* @name 粘性布局
|
21197
|
+
* @name_en Sticky
|
21198
|
+
*/
|
21199
|
+
|
21200
|
+
var Sticky = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21201
|
+
var _a = props.position,
|
21202
|
+
position = _a === void 0 ? 'top' : _a,
|
21203
|
+
_b = props.topOffset,
|
21204
|
+
topOffset = _b === void 0 ? 0 : _b,
|
21205
|
+
_c = props.bottomOffset,
|
21206
|
+
bottomOffset = _c === void 0 ? 0 : _c,
|
21207
|
+
_d = props.followOffset,
|
21208
|
+
followOffset = _d === void 0 ? 0 : _d,
|
21209
|
+
children = props.children,
|
21210
|
+
className = props.className,
|
21211
|
+
style = props.style,
|
21212
|
+
_e = props.zIndex,
|
21213
|
+
zIndex = _e === void 0 ? 100 : _e,
|
21214
|
+
_f = props.portalWhenSticky,
|
21215
|
+
portalWhenSticky = _f === void 0 ? false : _f,
|
21216
|
+
_g = props.stickyStyle,
|
21217
|
+
stickyStyle = _g === void 0 ? 'fixed' : _g,
|
21218
|
+
userSetStickyCssStyle = props.stickyCssStyle,
|
21219
|
+
getPortalContainer = props.getPortalContainer,
|
21220
|
+
getContainer = props.getContainer,
|
21221
|
+
getScrollContainer = props.getScrollContainer,
|
21222
|
+
onStickyStateChange = props.onStickyStateChange,
|
21223
|
+
onTopChange = props.onTopChange;
|
21224
|
+
|
21225
|
+
var _h = useRefState(false),
|
21226
|
+
isSticky = _h[0],
|
21227
|
+
isStickyRef = _h[1],
|
21228
|
+
setIsSticky = _h[2];
|
21229
|
+
|
21230
|
+
var _j = useRefState(false),
|
21231
|
+
wasSticky = _j[0],
|
21232
|
+
wasStickyRef = _j[1],
|
21233
|
+
setWasSticky = _j[2];
|
21234
|
+
|
21235
|
+
var _k = React.useState({}),
|
21236
|
+
stickyStateStyle = _k[0],
|
21237
|
+
setStickyStateStyle = _k[1];
|
21238
|
+
|
21239
|
+
var contentRef = React.useRef(null);
|
21240
|
+
var placeholderRef = React.useRef(null);
|
21241
|
+
var contentCalculateHeightRef = React.useRef(0);
|
21242
|
+
var containerRef = React.useRef(null);
|
21243
|
+
var scrollContainerRef = React.useRef(null);
|
21244
|
+
var framePendingRef = React.useRef(false);
|
21245
|
+
var containerEventHandler = React.useCallback(function (_a) {
|
21246
|
+
var followTop = _a.followTop,
|
21247
|
+
followBottom = _a.followBottom;
|
21248
|
+
|
21249
|
+
if (!contentRef.current) {
|
21250
|
+
return;
|
21251
|
+
}
|
21252
|
+
|
21253
|
+
var needTop = position === 'top' || position === 'both';
|
21254
|
+
var needBottom = position === 'bottom' || position === 'both';
|
21255
|
+
var placeholderClientRect = placeholderRef.current.getBoundingClientRect();
|
21256
|
+
var contentClientRect = contentRef.current.getBoundingClientRect();
|
21257
|
+
var calculatedHeight = contentClientRect.height;
|
21258
|
+
contentCalculateHeightRef.current = contentClientRect.height;
|
21259
|
+
var containerRect = getScrollContainerRect(scrollContainerRef.current).containerRect;
|
21260
|
+
var containerTop = containerRect.top,
|
21261
|
+
containerBottom = containerRect.bottom,
|
21262
|
+
containerHeight = containerRect.height;
|
21263
|
+
var disFromTop = Math.round(placeholderClientRect.top - containerTop);
|
21264
|
+
var disFromBottom = Math.round(placeholderClientRect.top + calculatedHeight - containerBottom);
|
21265
|
+
var topFollowDifference = followBottom - followOffset - calculatedHeight - topOffset - containerTop;
|
21266
|
+
var bottomFollowDifference = containerHeight - followTop - followOffset - calculatedHeight - bottomOffset;
|
21267
|
+
setWasSticky(Boolean(isStickyRef.current));
|
21268
|
+
var isTopSticky = needTop ? disFromTop <= topOffset && followBottom > containerTop + followOffset : false;
|
21269
|
+
var isBottomSticky = needBottom ? disFromBottom >= -bottomOffset && followTop < containerBottom - followOffset : false;
|
21270
|
+
var newStickyState = isTopSticky || isBottomSticky;
|
21271
|
+
var cssTop = (stickyStyle === 'absolute' ? 0 : containerTop) + topOffset;
|
21272
|
+
var cssBottom = (stickyStyle === 'absolute' ? 0 : window.innerHeight - containerBottom) + bottomOffset;
|
21273
|
+
var stickyCssStyle = {};
|
21274
|
+
|
21275
|
+
if (newStickyState) {
|
21276
|
+
stickyCssStyle = __assign$2(__assign$2(__assign$2(__assign$2({
|
21277
|
+
transform: 'translateZ(0)',
|
21278
|
+
WebkitTransform: 'translateZ(0)',
|
21279
|
+
position: stickyStyle === 'absolute' ? 'absolute' : 'fixed',
|
21280
|
+
zIndex: zIndex
|
21281
|
+
}, isTopSticky ? {
|
21282
|
+
top: topFollowDifference > 0 ? cssTop : cssTop + topFollowDifference
|
21283
|
+
} : {}), isBottomSticky ? {
|
21284
|
+
bottom: bottomFollowDifference > 0 ? cssBottom : cssBottom + bottomFollowDifference
|
21285
|
+
} : {}), {
|
21286
|
+
left: placeholderClientRect.left,
|
21287
|
+
width: placeholderClientRect.width
|
21288
|
+
}), userSetStickyCssStyle || {});
|
21289
|
+
}
|
21290
|
+
|
21291
|
+
onTopChange === null || onTopChange === void 0 ? void 0 : onTopChange(Math.max(0, contentClientRect.top - containerTop - topOffset));
|
21292
|
+
setIsSticky(newStickyState);
|
21293
|
+
setStickyStateStyle(stickyCssStyle);
|
21294
|
+
|
21295
|
+
if (newStickyState !== wasStickyRef.current) {
|
21296
|
+
onStickyStateChange && onStickyStateChange({
|
21297
|
+
isTopSticky: isTopSticky,
|
21298
|
+
isBottomSticky: isBottomSticky,
|
21299
|
+
isSticky: newStickyState,
|
21300
|
+
wasSticky: wasStickyRef.current
|
21301
|
+
});
|
21302
|
+
}
|
21303
|
+
}, [position, topOffset, bottomOffset, followOffset, zIndex, stickyStyle, onStickyStateChange, onTopChange, userSetStickyCssStyle]);
|
21304
|
+
var recalculatePosition = React.useCallback(function () {
|
21305
|
+
if (framePendingRef.current) {
|
21306
|
+
return;
|
21307
|
+
}
|
21308
|
+
|
21309
|
+
execRAF$1(function () {
|
21310
|
+
framePendingRef.current = false;
|
21311
|
+
|
21312
|
+
if (containerRef.current) {
|
21313
|
+
var _a = containerRef.current.getBoundingClientRect(),
|
21314
|
+
top_1 = _a.top,
|
21315
|
+
bottom = _a.bottom;
|
21316
|
+
|
21317
|
+
containerEventHandler({
|
21318
|
+
followTop: top_1,
|
21319
|
+
followBottom: bottom
|
21320
|
+
});
|
21321
|
+
}
|
21322
|
+
});
|
21323
|
+
framePendingRef.current = true;
|
21324
|
+
}, [containerEventHandler]);
|
21325
|
+
React.useEffect(function () {
|
21326
|
+
var containerEle = getActualContainer(getContainer);
|
21327
|
+
containerRef.current = containerEle || document.body;
|
21328
|
+
var eventTarget = getScrollContainer ? getActualContainer(getScrollContainer) : window;
|
21329
|
+
if (!eventTarget) return;
|
21330
|
+
scrollContainerRef.current = eventTarget;
|
21331
|
+
|
21332
|
+
var attachEventListeners = function attachEventListeners(target) {
|
21333
|
+
target.addEventListener('scroll', recalculatePosition);
|
21334
|
+
};
|
21335
|
+
|
21336
|
+
var removeEventListeners = function removeEventListeners(target) {
|
21337
|
+
target.removeEventListener('scroll', recalculatePosition);
|
21338
|
+
};
|
21339
|
+
|
21340
|
+
attachEventListeners(eventTarget);
|
21341
|
+
recalculatePosition();
|
21342
|
+
return function () {
|
21343
|
+
removeEventListeners(eventTarget);
|
21344
|
+
};
|
21345
|
+
}, [getContainer, getScrollContainer, recalculatePosition]);
|
21346
|
+
React.useEffect(function () {
|
21347
|
+
if (placeholderRef.current) {
|
21348
|
+
// 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
21349
|
+
// @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
|
21350
|
+
placeholderRef.current.style.height = (isStickyRef.current ? contentCalculateHeightRef.current : 0) + "px";
|
21351
|
+
}
|
21352
|
+
}, [isSticky, wasSticky]);
|
21353
|
+
React.useImperativeHandle(ref, function () {
|
21354
|
+
return {
|
21355
|
+
dom: contentRef.current,
|
21356
|
+
recalculatePosition: recalculatePosition
|
21357
|
+
};
|
21358
|
+
}, [recalculatePosition]);
|
21359
|
+
var computedStyle = React.useMemo(function () {
|
21360
|
+
return __assign$2(__assign$2({}, style || {}), stickyStateStyle);
|
21361
|
+
}, [stickyStateStyle, style]);
|
21362
|
+
|
21363
|
+
function renderSticky(prefixCls) {
|
21364
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21365
|
+
className: cls(prefixCls + "-sticky", className),
|
21366
|
+
ref: contentRef,
|
21367
|
+
style: computedStyle
|
21368
|
+
}, children);
|
21369
|
+
}
|
21370
|
+
|
21371
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
21372
|
+
var prefixCls = _a.prefixCls;
|
21373
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
21374
|
+
ref: placeholderRef
|
21375
|
+
}), portalWhenSticky && isSticky ? /*#__PURE__*/React__default["default"].createElement(Portal, {
|
21376
|
+
getContainer: getPortalContainer
|
21377
|
+
}, renderSticky(prefixCls)) : renderSticky(prefixCls));
|
21378
|
+
});
|
21379
|
+
});
|
21380
|
+
|
21381
|
+
var IndexBarGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21382
|
+
var groupIndex = props.index,
|
21383
|
+
list = props.list,
|
21384
|
+
className = props.className,
|
21385
|
+
style = props.style,
|
21386
|
+
children = props.children,
|
21387
|
+
listKey = props.listKey,
|
21388
|
+
onGroupItemClick = props.onGroupItemClick,
|
21389
|
+
renderGroupItem = props.renderGroupItem,
|
21390
|
+
renderStickyItem = props.renderStickyItem;
|
21391
|
+
var prefixCls = React.useContext(GlobalContext).prefixCls; // 有可能是IndexBar.Group的写法,因此sticky从context中获得
|
21392
|
+
|
21393
|
+
var _a = React.useContext(IndexBarContext),
|
21394
|
+
sticky = _a.sticky,
|
21395
|
+
getScrollContainer = _a.getScrollContainer,
|
21396
|
+
activeIndex = _a.activeIndex,
|
21397
|
+
updateRef = _a.updateRef;
|
21398
|
+
|
21399
|
+
var domRef = React.useRef(null);
|
21400
|
+
React.useImperativeHandle(ref, function () {
|
21401
|
+
return {
|
21402
|
+
dom: domRef.current
|
21403
|
+
};
|
21404
|
+
}); // 用户自定义列表元素vnode的key
|
21405
|
+
|
21406
|
+
var formatGetListKey = function formatGetListKey(data, index) {
|
21407
|
+
var _a;
|
21408
|
+
|
21409
|
+
return (_a = listKey === null || listKey === void 0 ? void 0 : listKey(data, index)) !== null && _a !== void 0 ? _a : index;
|
21410
|
+
};
|
21411
|
+
|
21412
|
+
var renderChildren = function renderChildren() {
|
21413
|
+
var _a;
|
21414
|
+
|
21415
|
+
return (_a = children !== null && children !== void 0 ? children : list === null || list === void 0 ? void 0 : list.map(function (data, index) {
|
21416
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21417
|
+
className: prefixCls + "-index-bar-group-item",
|
21418
|
+
key: formatGetListKey(data, index),
|
21419
|
+
onClick: function onClick() {
|
21420
|
+
return onGroupItemClick === null || onGroupItemClick === void 0 ? void 0 : onGroupItemClick(groupIndex, data, index);
|
21421
|
+
}
|
21422
|
+
}, renderGroupItem ? renderGroupItem(groupIndex, data, index) : data.content);
|
21423
|
+
})) !== null && _a !== void 0 ? _a : null;
|
21424
|
+
};
|
21425
|
+
|
21426
|
+
var renderIndexTitle = function renderIndexTitle() {
|
21427
|
+
var _a;
|
21428
|
+
|
21429
|
+
if (renderStickyItem) {
|
21430
|
+
return renderStickyItem(groupIndex);
|
21431
|
+
}
|
21432
|
+
|
21433
|
+
var titleDom = /*#__PURE__*/React__default["default"].createElement("div", {
|
21434
|
+
className: cls(prefixCls + "-index-bar-group-title", (_a = {}, _a[prefixCls + "-index-bar-group-active"] = activeIndex === groupIndex, _a))
|
21435
|
+
}, groupIndex);
|
21436
|
+
var groupDom = domRef.current;
|
21437
|
+
return sticky ? /*#__PURE__*/React__default["default"].createElement(Sticky, {
|
21438
|
+
getContainer: function getContainer() {
|
21439
|
+
return groupDom;
|
21440
|
+
},
|
21441
|
+
stickyStyle: "absolute",
|
21442
|
+
getScrollContainer: getScrollContainer,
|
21443
|
+
ref: function ref(stickyRef) {
|
21444
|
+
return stickyRef && updateRef(groupIndex, stickyRef);
|
21445
|
+
}
|
21446
|
+
}, titleDom) : titleDom;
|
21447
|
+
};
|
21448
|
+
|
21449
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21450
|
+
className: cls(prefixCls + "-index-bar-group", className),
|
21451
|
+
style: style,
|
21452
|
+
"data-index": groupIndex,
|
21453
|
+
ref: domRef
|
21454
|
+
}, renderIndexTitle(), renderChildren());
|
21455
|
+
});
|
21456
|
+
|
21457
|
+
function IndexBarSideBar(props) {
|
21458
|
+
var _a;
|
21459
|
+
|
21460
|
+
var indexes = props.indexes,
|
21461
|
+
prefixCls = props.prefixCls,
|
21462
|
+
onTouching = props.onTouching,
|
21463
|
+
onClick = props.onClick,
|
21464
|
+
activeIndex = props.activeIndex,
|
21465
|
+
tipType = props.tipType,
|
21466
|
+
renderSideBar = props.renderSideBar,
|
21467
|
+
_b = props.renderSideBarItem,
|
21468
|
+
renderSideBarItem = _b === void 0 ? function (index) {
|
21469
|
+
return index;
|
21470
|
+
} : _b,
|
21471
|
+
propsRenderTip = props.renderTip;
|
21472
|
+
|
21473
|
+
var _c = React.useState(false),
|
21474
|
+
isTouching = _c[0],
|
21475
|
+
originSetIsTouching = _c[1];
|
21476
|
+
|
21477
|
+
var setIsTouching = function setIsTouching(touching) {
|
21478
|
+
originSetIsTouching(touching);
|
21479
|
+
onTouching(touching);
|
21480
|
+
};
|
21481
|
+
|
21482
|
+
var handleTouchingStart = function handleTouchingStart() {
|
21483
|
+
return setIsTouching(true);
|
21484
|
+
};
|
21485
|
+
|
21486
|
+
var handleTouchingStop = function handleTouchingStop() {
|
21487
|
+
return setIsTouching(false);
|
21488
|
+
};
|
21489
|
+
|
21490
|
+
var handleTouchMove = function handleTouchMove(e) {
|
21491
|
+
var _a, _b;
|
21492
|
+
|
21493
|
+
if (!isTouching || !((_a = e.touches) === null || _a === void 0 ? void 0 : _a.length)) {
|
21494
|
+
return;
|
21495
|
+
}
|
21496
|
+
|
21497
|
+
var _c = e.touches[0],
|
21498
|
+
clientX = _c.clientX,
|
21499
|
+
clientY = _c.clientY;
|
21500
|
+
var target = document.elementFromPoint(clientX, clientY);
|
21501
|
+
|
21502
|
+
if (target && ((_b = target.dataset) === null || _b === void 0 ? void 0 : _b.index)) {
|
21503
|
+
onClick(target.dataset.index);
|
21504
|
+
}
|
21505
|
+
};
|
21506
|
+
|
21507
|
+
var renderSideBarTip = function renderSideBarTip(index, type) {
|
21508
|
+
if (propsRenderTip) {
|
21509
|
+
return propsRenderTip(index);
|
21510
|
+
}
|
21511
|
+
|
21512
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21513
|
+
className: prefixCls + "-index-bar-sidebar-" + type
|
21514
|
+
}, index);
|
21515
|
+
};
|
21516
|
+
|
21517
|
+
var node = /*#__PURE__*/React__default["default"].createElement("div", {
|
21518
|
+
className: cls(prefixCls + "-index-bar-sidebar", (_a = {}, _a[prefixCls + "-index-bar-sidebar-touching"] = isTouching, _a)),
|
21519
|
+
onTouchStart: function onTouchStart() {
|
21520
|
+
return handleTouchingStart();
|
21521
|
+
},
|
21522
|
+
onTouchEnd: function onTouchEnd() {
|
21523
|
+
return handleTouchingStop();
|
21524
|
+
},
|
21525
|
+
onTouchCancel: function onTouchCancel() {
|
21526
|
+
return handleTouchingStop();
|
21527
|
+
},
|
21528
|
+
onTouchMove: handleTouchMove
|
21529
|
+
}, tipType === 'toast' && isTouching && activeIndex && renderSideBarTip(activeIndex, 'toast'), indexes.map(function (index) {
|
21530
|
+
var _a;
|
21531
|
+
|
21532
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21533
|
+
className: cls(prefixCls + "-index-bar-sidebar-item", (_a = {}, _a[prefixCls + "-index-bar-sidebar-active"] = activeIndex === index, _a)),
|
21534
|
+
key: index,
|
21535
|
+
onTouchStart: function onTouchStart() {
|
21536
|
+
return onClick(index);
|
21537
|
+
},
|
21538
|
+
"data-index": index
|
21539
|
+
}, tipType === 'sweat' && isTouching && activeIndex === index && renderSideBarTip(index, 'sweat'), /*#__PURE__*/React__default["default"].createElement("div", {
|
21540
|
+
className: prefixCls + "-index-bar-sidebar-item-wrapper"
|
21541
|
+
}, renderSideBarItem(index)));
|
21542
|
+
}));
|
21543
|
+
return renderSideBar ? renderSideBar(node) : node;
|
21544
|
+
}
|
21545
|
+
|
21546
|
+
function filterValidIndexBarChild(children) {
|
21547
|
+
var validChildren = [];
|
21548
|
+
React.Children.forEach(children, function (child) {
|
21549
|
+
if (! /*#__PURE__*/React.isValidElement(child) || child.type !== IndexBarGroup) {
|
21550
|
+
console.warn('<IndexBar /> only accept <IndexBar.Group /> as the children');
|
21551
|
+
return;
|
21552
|
+
}
|
21553
|
+
|
21554
|
+
validChildren.push(child);
|
21555
|
+
});
|
21556
|
+
return validChildren;
|
21557
|
+
} // index有可能是number或者string,但是绑在data-index的attr上后
|
21558
|
+
// 通过滑动事件得到的都是string,需要处理下
|
21559
|
+
|
21560
|
+
function getFormatIndex(index, activeIndex) {
|
21561
|
+
var activeIndexType = typeof activeIndex;
|
21562
|
+
var indexType = typeof index;
|
21563
|
+
|
21564
|
+
if (indexType === activeIndexType) {
|
21565
|
+
return index;
|
21566
|
+
}
|
21567
|
+
|
21568
|
+
if (activeIndexType === 'number') {
|
21569
|
+
return Number(index);
|
21570
|
+
}
|
21571
|
+
|
21572
|
+
return index.toString();
|
21573
|
+
}
|
21574
|
+
function isValidIndex(index) {
|
21575
|
+
return typeof index === 'number' || typeof index === 'string';
|
21576
|
+
}
|
21577
|
+
function getGroupDomFromIndex(containerDom, activeIndex) {
|
21578
|
+
var targetDom = null;
|
21579
|
+
var containerChildren = containerDom.children;
|
21580
|
+
|
21581
|
+
for (var i = 0; i < containerChildren.length; i++) {
|
21582
|
+
var dom = containerChildren[i];
|
21583
|
+
var dataset = dom === null || dom === void 0 ? void 0 : dom.dataset;
|
21584
|
+
|
21585
|
+
if (dataset && dataset.index) {
|
21586
|
+
var formatIndex = getFormatIndex(dataset.index, activeIndex);
|
21587
|
+
|
21588
|
+
if (formatIndex === activeIndex) {
|
21589
|
+
targetDom = dom;
|
21590
|
+
break;
|
21591
|
+
}
|
21592
|
+
}
|
21593
|
+
}
|
21594
|
+
|
21595
|
+
return targetDom;
|
21596
|
+
}
|
21597
|
+
|
21598
|
+
var IndexBar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21599
|
+
var _a = props.className,
|
21600
|
+
className = _a === void 0 ? '' : _a,
|
21601
|
+
style = props.style,
|
21602
|
+
children = props.children,
|
21603
|
+
_b = props.sticky,
|
21604
|
+
sticky = _b === void 0 ? true : _b,
|
21605
|
+
_c = props.groups,
|
21606
|
+
groups = _c === void 0 ? [] : _c,
|
21607
|
+
_d = props.tipType,
|
21608
|
+
tipType = _d === void 0 ? 'toast' : _d,
|
21609
|
+
defaultIndex = props.defaultIndex,
|
21610
|
+
scrollBezier = props.scrollBezier,
|
21611
|
+
_e = props.scrollDuration,
|
21612
|
+
scrollDuration = _e === void 0 ? 0 : _e,
|
21613
|
+
_f = props.disableSidebar,
|
21614
|
+
disableSidebar = _f === void 0 ? false : _f,
|
21615
|
+
onChange = props.onChange,
|
21616
|
+
onGroupItemClick = props.onGroupItemClick,
|
21617
|
+
renderSideBar = props.renderSideBar,
|
21618
|
+
renderSideBarItem = props.renderSideBarItem,
|
21619
|
+
renderTip = props.renderTip,
|
21620
|
+
renderStickyItem = props.renderStickyItem,
|
21621
|
+
renderGroupItem = props.renderGroupItem; // 最外层dom元素的ref
|
21622
|
+
|
21623
|
+
var domRef = React.useRef(null); // 所有group的容器dom,domRef的内容就是contanerRef和sidebar的内容
|
21624
|
+
|
21625
|
+
var containerRef = React.useRef(null); // 过滤掉jsx写法中,奇怪的child
|
21626
|
+
|
21627
|
+
var formatChildren = filterValidIndexBarChild(children); // 所有的索引内容,优先从props.groups中获取,再从formatChildren中获取
|
21628
|
+
|
21629
|
+
var indexes = React.useMemo(function () {
|
21630
|
+
if (groups.length) {
|
21631
|
+
return groups.map(function (group) {
|
21632
|
+
return group.index;
|
21633
|
+
});
|
21634
|
+
}
|
21635
|
+
|
21636
|
+
return formatChildren.map(function (child) {
|
21637
|
+
return child.props.index;
|
21638
|
+
});
|
21639
|
+
}, [children, groups]);
|
21640
|
+
var groupRefs = React.useRef({}); // 当前激活的Index
|
21641
|
+
|
21642
|
+
var _g = React.useState(function () {
|
21643
|
+
return defaultIndex !== null && defaultIndex !== void 0 ? defaultIndex : indexes === null || indexes === void 0 ? void 0 : indexes[0];
|
21644
|
+
}),
|
21645
|
+
activeIndex = _g[0],
|
21646
|
+
setActiveIndex = _g[1]; // 给IndexBarGroup用的上下文,主要是为了兼容jsx的写法
|
21647
|
+
|
21648
|
+
|
21649
|
+
var contextValue = React.useMemo(function () {
|
21650
|
+
return {
|
21651
|
+
sticky: sticky,
|
21652
|
+
getScrollContainer: function getScrollContainer() {
|
21653
|
+
return containerRef.current;
|
21654
|
+
},
|
21655
|
+
activeIndex: activeIndex,
|
21656
|
+
updateRef: function updateRef(groupIndex, stickyRef) {
|
21657
|
+
groupRefs.current[groupIndex] = stickyRef;
|
21658
|
+
}
|
21659
|
+
};
|
21660
|
+
}, [sticky, activeIndex]); // 用户是否正在触碰sidebar, 如果为true的话,禁用handleScroll的处理
|
21661
|
+
|
21662
|
+
var isScrollHandlerDisabledRef = React.useRef(false);
|
21663
|
+
|
21664
|
+
var handleChangeActiveIndex = function handleChangeActiveIndex(index, type) {
|
21665
|
+
setActiveIndex(function (oldActiveIndex) {
|
21666
|
+
var newActiveIndex = getFormatIndex(index, oldActiveIndex); // 和上一次激活的acitveIndex不同,再触发onChange事件
|
21667
|
+
|
21668
|
+
if (newActiveIndex !== oldActiveIndex) {
|
21669
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newActiveIndex, type);
|
21670
|
+
}
|
21671
|
+
|
21672
|
+
return newActiveIndex;
|
21673
|
+
});
|
21674
|
+
}; // 要滚动到哪个指定的index
|
21675
|
+
|
21676
|
+
|
21677
|
+
var handleScrollIntoIndex = function handleScrollIntoIndex(params) {
|
21678
|
+
var index = params.index,
|
21679
|
+
type = params.type,
|
21680
|
+
_a = params.rightNow,
|
21681
|
+
rightNow = _a === void 0 ? false : _a; // 不传index默认走第一个index
|
21682
|
+
|
21683
|
+
var formatIndex = index !== null && index !== void 0 ? index : indexes === null || indexes === void 0 ? void 0 : indexes[0];
|
21684
|
+
var containerDom = containerRef.current;
|
21685
|
+
|
21686
|
+
if (!isValidIndex(index) || !containerDom) {
|
21687
|
+
return;
|
21688
|
+
} // 寻找Index对应的groupDom
|
21689
|
+
|
21690
|
+
|
21691
|
+
var groupDom = getGroupDomFromIndex(containerDom, formatIndex);
|
21692
|
+
|
21693
|
+
if (groupDom) {
|
21694
|
+
handleChangeActiveIndex(formatIndex, type);
|
21695
|
+
var duration = rightNow ? 0 : scrollDuration;
|
21696
|
+
var targetScrollTop = groupDom.offsetTop; // 将屏幕滚动到groupDom
|
21697
|
+
// 手动触发需要禁用handleScroll事件
|
21698
|
+
|
21699
|
+
if (type === 'manual') {
|
21700
|
+
isScrollHandlerDisabledRef.current = true;
|
21701
|
+
setTimeout(function () {
|
21702
|
+
isScrollHandlerDisabledRef.current = false;
|
21703
|
+
}, duration);
|
21704
|
+
}
|
21705
|
+
|
21706
|
+
if (duration > 0) {
|
21707
|
+
scrollWithAnimation(containerDom.scrollTop, targetScrollTop, function (top) {
|
21708
|
+
return containerDom.scrollTop = top;
|
21709
|
+
}, duration, scrollBezier);
|
21710
|
+
} else {
|
21711
|
+
containerDom.scrollTop = targetScrollTop;
|
21712
|
+
}
|
21713
|
+
}
|
21714
|
+
};
|
21715
|
+
|
21716
|
+
React.useImperativeHandle(ref, function () {
|
21717
|
+
return {
|
21718
|
+
dom: domRef.current,
|
21719
|
+
scrollToIndex: function scrollToIndex(index, rightNow) {
|
21720
|
+
if (isValidIndex(index)) {
|
21721
|
+
handleScrollIntoIndex({
|
21722
|
+
index: index,
|
21723
|
+
rightNow: rightNow,
|
21724
|
+
type: 'manual'
|
21725
|
+
});
|
21726
|
+
}
|
21727
|
+
},
|
21728
|
+
recalculatePosition: function recalculatePosition(targetIndex) {
|
21729
|
+
var formatIndex = targetIndex !== null && targetIndex !== void 0 ? targetIndex : activeIndex;
|
21730
|
+
|
21731
|
+
if (formatIndex) {
|
21732
|
+
var targetStickyRef = groupRefs.current[formatIndex];
|
21733
|
+
|
21734
|
+
if (targetStickyRef && targetStickyRef.recalculatePosition) {
|
21735
|
+
targetStickyRef.recalculatePosition();
|
21736
|
+
}
|
21737
|
+
}
|
21738
|
+
}
|
21739
|
+
};
|
21740
|
+
});
|
21741
|
+
|
21742
|
+
var renderChildren = function renderChildren() {
|
21743
|
+
if (formatChildren.length) {
|
21744
|
+
return formatChildren;
|
21745
|
+
}
|
21746
|
+
|
21747
|
+
return groups === null || groups === void 0 ? void 0 : groups.map(function (group) {
|
21748
|
+
return /*#__PURE__*/React__default["default"].createElement(IndexBarGroup, {
|
21749
|
+
index: group.index,
|
21750
|
+
key: group.index,
|
21751
|
+
list: group.list,
|
21752
|
+
onGroupItemClick: onGroupItemClick,
|
21753
|
+
renderGroupItem: renderGroupItem,
|
21754
|
+
renderStickyItem: renderStickyItem
|
21755
|
+
});
|
21756
|
+
});
|
21757
|
+
};
|
21758
|
+
|
21759
|
+
React.useEffect(function () {
|
21760
|
+
var _a;
|
21761
|
+
|
21762
|
+
var handleScroll = lodash_throttle(function () {
|
21763
|
+
// 用户正在触碰sidebar和手动触发scroll时禁用滚动事件的处理
|
21764
|
+
if (!containerRef.current || isScrollHandlerDisabledRef.current) {
|
21765
|
+
return;
|
21766
|
+
} // 根据滚动的距离,获取处于屏幕最顶部的group是哪个
|
21767
|
+
|
21768
|
+
|
21769
|
+
var scrollTop = containerRef.current.scrollTop;
|
21770
|
+
|
21771
|
+
for (var i = 0; i < containerRef.current.children.length; i++) {
|
21772
|
+
var child = containerRef.current.children[i];
|
21773
|
+
|
21774
|
+
if (!child || !child.dataset || typeof child.dataset.index === 'undefined') {
|
21775
|
+
continue;
|
21776
|
+
}
|
21777
|
+
|
21778
|
+
if (child.offsetTop + child.clientHeight >= scrollTop) {
|
21779
|
+
handleChangeActiveIndex(child.dataset.index, 'swipe');
|
21780
|
+
break;
|
21781
|
+
}
|
21782
|
+
}
|
21783
|
+
}, 100); // 页面挂载时,如果是传入了defaultIndex,则滚动到对应位置
|
21784
|
+
|
21785
|
+
if (activeIndex) {
|
21786
|
+
handleScrollIntoIndex({
|
21787
|
+
index: activeIndex,
|
21788
|
+
rightNow: true,
|
21789
|
+
type: 'manual'
|
21790
|
+
});
|
21791
|
+
}
|
21792
|
+
|
21793
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', handleScroll);
|
21794
|
+
return function () {
|
21795
|
+
var _a;
|
21796
|
+
|
21797
|
+
(_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', handleScroll);
|
21798
|
+
};
|
21799
|
+
}, []);
|
21800
|
+
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
21801
|
+
var prefixCls = _a.prefixCls;
|
21802
|
+
return /*#__PURE__*/React__default["default"].createElement(IndexBarContext.Provider, {
|
21803
|
+
value: contextValue
|
21804
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
21805
|
+
className: cls(prefixCls + "-index-bar", className),
|
21806
|
+
style: style,
|
21807
|
+
ref: domRef
|
21808
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
21809
|
+
className: prefixCls + "-index-bar-container",
|
21810
|
+
ref: containerRef
|
21811
|
+
}, renderChildren()), !disableSidebar && /*#__PURE__*/React__default["default"].createElement(IndexBarSideBar, {
|
21812
|
+
tipType: tipType,
|
21813
|
+
activeIndex: activeIndex,
|
21814
|
+
prefixCls: prefixCls,
|
21815
|
+
indexes: indexes,
|
21816
|
+
onTouching: function onTouching(isTouching) {
|
21817
|
+
return isScrollHandlerDisabledRef.current = isTouching;
|
21818
|
+
},
|
21819
|
+
onClick: function onClick(newIndex) {
|
21820
|
+
return handleScrollIntoIndex({
|
21821
|
+
index: newIndex,
|
21822
|
+
type: 'sidebar'
|
21823
|
+
});
|
21824
|
+
},
|
21825
|
+
renderSideBar: renderSideBar,
|
21826
|
+
renderSideBarItem: renderSideBarItem,
|
21827
|
+
renderTip: renderTip
|
21828
|
+
})));
|
21829
|
+
});
|
21830
|
+
});
|
21831
|
+
/**
|
21832
|
+
* 索引栏组件
|
21833
|
+
* @en IndexBar component
|
21834
|
+
* @type 导航
|
21835
|
+
* @type_en Navigation
|
21836
|
+
* @name 索引栏
|
21837
|
+
* @name_en SearchBar
|
21838
|
+
*/
|
21839
|
+
|
21840
|
+
var index$9 = componentWrapper(IndexBar, {
|
21841
|
+
Group: IndexBarGroup
|
21842
|
+
});
|
21843
|
+
|
21844
|
+
// @en let keyboard random
|
21845
|
+
|
21846
|
+
var makeArrayRandom = function makeArrayRandom(targetArray) {
|
21847
|
+
var randomFn = function randomFn() {
|
21848
|
+
return Math.random() - 0.5;
|
21849
|
+
};
|
21850
|
+
|
21851
|
+
return targetArray.sort(randomFn);
|
21852
|
+
};
|
21853
|
+
|
21854
|
+
var splitArray = function splitArray(target) {
|
21855
|
+
return target.reduce(function (acc, cur) {
|
21856
|
+
if (!acc[acc.length - 1] || acc[acc.length - 1].length >= 3) {
|
21857
|
+
acc.push([]);
|
21858
|
+
}
|
21859
|
+
|
21860
|
+
acc[acc.length - 1].push(cur);
|
21861
|
+
return acc;
|
21862
|
+
}, []);
|
21863
|
+
}; // 纯数字类字符
|
21864
|
+
// @en Pure numeric characters
|
21865
|
+
|
21866
|
+
|
21867
|
+
var contentArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
21868
|
+
/**
|
21869
|
+
* 数字键盘组件
|
21870
|
+
* @en Keyboard component
|
21871
|
+
* @type 数据录入
|
21872
|
+
* @type_en Data Entry
|
21873
|
+
* @name 数字键盘
|
21874
|
+
* @name_en Keyboard
|
21875
|
+
*/
|
21876
|
+
|
21877
|
+
var Keyboard = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
21878
|
+
var normalKeyClass = props.normalKeyClass,
|
21879
|
+
normalKeyStyle = props.normalKeyStyle,
|
21880
|
+
_a = props.className,
|
21881
|
+
className = _a === void 0 ? '' : _a,
|
21882
|
+
style = props.style,
|
21883
|
+
_b = props.type,
|
21884
|
+
type = _b === void 0 ? 'number' : _b,
|
21885
|
+
_c = props.randomOrder,
|
21886
|
+
randomOrder = _c === void 0 ? false : _c,
|
21887
|
+
title = props.title,
|
21888
|
+
rightColumns = props.rightColumns,
|
21889
|
+
confirmClosable = props.confirmClosable,
|
21890
|
+
confirmButton = props.confirmButton,
|
21891
|
+
deleteButton = props.deleteButton,
|
21892
|
+
keyboardButton = props.keyboardButton,
|
21893
|
+
close = props.close,
|
21894
|
+
onConfirm = props.onConfirm,
|
21895
|
+
onDelete = props.onDelete,
|
21896
|
+
onChange = props.onChange,
|
21897
|
+
resetProps = __rest$1(props, ["normalKeyClass", "normalKeyStyle", "className", "style", "type", "randomOrder", "title", "rightColumns", "confirmClosable", "confirmButton", "deleteButton", "keyboardButton", "close", "onConfirm", "onDelete", "onChange"]);
|
21898
|
+
|
21899
|
+
var popupRef = React.useRef(null);
|
21900
|
+
var keyboardRef = React.useRef(null);
|
21901
|
+
|
21902
|
+
var _d = React.useContext(GlobalContext),
|
21903
|
+
prefixCls = _d.prefixCls,
|
21904
|
+
_e = _d.locale,
|
21905
|
+
locale = _e === void 0 ? defaultLocale : _e;
|
21906
|
+
|
21907
|
+
var prefix = prefixCls + "-keyboard"; // 3x4键盘的按键内容
|
21908
|
+
// @en 3x4 Keyboard button content
|
21909
|
+
|
21910
|
+
var displayData = React.useMemo(function () {
|
21911
|
+
var numberArr = randomOrder ? makeArrayRandom(contentArray) : contentArray;
|
21912
|
+
var lastNum = numberArr.slice(-1)[0];
|
21913
|
+
var finalData = splitArray(numberArr.slice(0, -1));
|
21914
|
+
|
21915
|
+
switch (type) {
|
21916
|
+
case 'confirm':
|
21917
|
+
finalData.push([lastNum, '.']);
|
21918
|
+
break;
|
21919
|
+
|
21920
|
+
case 'tool':
|
21921
|
+
finalData.push(['.', lastNum, {
|
21922
|
+
type: 'delete'
|
21923
|
+
}]);
|
21924
|
+
break;
|
21925
|
+
|
21926
|
+
case 'number':
|
21927
|
+
default:
|
21928
|
+
finalData.push([{
|
21929
|
+
type: 'keyboard'
|
21930
|
+
}, lastNum, {
|
21931
|
+
type: 'delete'
|
21932
|
+
}]);
|
21933
|
+
break;
|
21934
|
+
}
|
21935
|
+
|
21936
|
+
return finalData;
|
21937
|
+
}, [type]); // 右边一列
|
21938
|
+
// @en Right column
|
21939
|
+
|
21940
|
+
var rightColumn = React.useMemo(function () {
|
21941
|
+
switch (type) {
|
21942
|
+
case 'number':
|
21943
|
+
return [];
|
21944
|
+
|
21945
|
+
case 'confirm':
|
21946
|
+
{
|
21947
|
+
return [{
|
21948
|
+
type: 'delete'
|
21949
|
+
}];
|
21950
|
+
}
|
21951
|
+
|
21952
|
+
case 'tool':
|
21953
|
+
return ['+', '-', '×', '÷'];
|
21954
|
+
|
21955
|
+
default:
|
21956
|
+
return [];
|
21957
|
+
}
|
21958
|
+
}, [type]); // 确认按钮需要在type为confirm时展示
|
21959
|
+
// @en Display then confirm button when type is confirm
|
21960
|
+
|
21961
|
+
var getConfirmButton = React.useCallback(function () {
|
21962
|
+
if (type !== 'confirm') {
|
21963
|
+
return null;
|
21964
|
+
}
|
21965
|
+
|
21966
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
21967
|
+
onClick: function onClick() {
|
21968
|
+
confirmClosable && close();
|
21969
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
21970
|
+
},
|
21971
|
+
className: cls(prefix + "-key", prefix + "-key-confirm")
|
21972
|
+
}, confirmButton || locale.Keyboard.confirm);
|
21973
|
+
}, [type]); // 点击空白处关闭键盘
|
21974
|
+
// @en Close keyboard when clicked the blank space
|
21975
|
+
|
21976
|
+
React.useEffect(function () {
|
21977
|
+
var handlerDocumentClick = function handlerDocumentClick(e) {
|
21978
|
+
if (!keyboardRef.current) {
|
21979
|
+
return;
|
21980
|
+
}
|
21981
|
+
|
21982
|
+
if (!keyboardRef.current.contains(e.target) && e.target !== keyboardRef.current) {
|
21983
|
+
close();
|
21984
|
+
}
|
21985
|
+
};
|
21986
|
+
|
21987
|
+
document.addEventListener('click', handlerDocumentClick);
|
21988
|
+
return function () {
|
21989
|
+
document.removeEventListener('click', handlerDocumentClick);
|
21990
|
+
};
|
21991
|
+
}, []);
|
21992
|
+
React.useImperativeHandle(ref, function () {
|
21993
|
+
return __assign$2({
|
21994
|
+
keyboard: keyboardRef.current
|
21995
|
+
}, popupRef.current);
|
21996
|
+
});
|
21997
|
+
|
21998
|
+
var handleButtonClick = function handleButtonClick(ele) {
|
21999
|
+
switch (ele.type) {
|
22000
|
+
case 'delete':
|
22001
|
+
onDelete === null || onDelete === void 0 ? void 0 : onDelete();
|
22002
|
+
break;
|
22003
|
+
|
22004
|
+
case 'keyboard':
|
22005
|
+
close();
|
22006
|
+
break;
|
22007
|
+
|
22008
|
+
default:
|
22009
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(ele.value);
|
22010
|
+
}
|
22011
|
+
};
|
22012
|
+
|
22013
|
+
var renderButtonContent = function renderButtonContent(ele) {
|
22014
|
+
switch (ele.type) {
|
22015
|
+
case 'delete':
|
22016
|
+
return deleteButton || /*#__PURE__*/React__default["default"].createElement(IconKeyboardDelete, null);
|
22017
|
+
|
22018
|
+
case 'keyboard':
|
22019
|
+
return keyboardButton || /*#__PURE__*/React__default["default"].createElement(IconKeyboard, null);
|
22020
|
+
|
22021
|
+
default:
|
22022
|
+
return ele.content;
|
22023
|
+
}
|
22024
|
+
};
|
22025
|
+
|
22026
|
+
var renderButton = function renderButton(data, key, extraClass) {
|
22027
|
+
var ele = typeof data === 'string' || typeof data === 'number' ? {
|
22028
|
+
type: 'content',
|
22029
|
+
content: data,
|
22030
|
+
value: data
|
22031
|
+
} : data;
|
22032
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
22033
|
+
onClick: function onClick() {
|
22034
|
+
return handleButtonClick(ele);
|
22035
|
+
},
|
22036
|
+
className: cls(prefix + "-key", normalKeyClass, extraClass),
|
22037
|
+
key: key,
|
22038
|
+
style: normalKeyStyle
|
22039
|
+
}, renderButtonContent(ele));
|
22040
|
+
};
|
22041
|
+
|
22042
|
+
var renderKeyboardRightColumns = function renderKeyboardRightColumns() {
|
22043
|
+
if (rightColumns) {
|
22044
|
+
return rightColumns;
|
22045
|
+
}
|
22046
|
+
|
22047
|
+
return rightColumn.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
|
22048
|
+
className: prefix + "-col"
|
22049
|
+
}, rightColumn.map(function (item, index) {
|
22050
|
+
return renderButton(item, String(index));
|
22051
|
+
}), getConfirmButton()) : null;
|
22052
|
+
};
|
22053
|
+
|
22054
|
+
return /*#__PURE__*/React__default["default"].createElement(Popup$1, __assign$2({
|
22055
|
+
ref: popupRef,
|
22056
|
+
maskClass: prefix + "-popup",
|
22057
|
+
close: close
|
22058
|
+
}, resetProps), /*#__PURE__*/React__default["default"].createElement("div", {
|
22059
|
+
className: cls(prefix, "" + className),
|
22060
|
+
style: style,
|
22061
|
+
ref: keyboardRef
|
22062
|
+
}, title, /*#__PURE__*/React__default["default"].createElement("div", {
|
22063
|
+
className: prefix + "-wrapper"
|
22064
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
22065
|
+
className: prefix + "-key-wrapper"
|
22066
|
+
}, displayData.map(function (item, index) {
|
22067
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
22068
|
+
className: prefix + "-row",
|
22069
|
+
key: index
|
22070
|
+
}, item.map(function (e, idx) {
|
22071
|
+
var _a;
|
22072
|
+
|
22073
|
+
return renderButton(e, String(idx), (_a = {}, _a[prefix + "-key-special"] = type === 'confirm' && index === displayData.length - 1 && idx === 0, _a));
|
22074
|
+
}));
|
22075
|
+
})), renderKeyboardRightColumns())));
|
22076
|
+
});
|
22077
|
+
|
22078
|
+
/**
|
22079
|
+
* 上拉加载组件,支持`scroll`和`click`两种触发加载方式,支持滚动监听。支持受控与不受控两种形式。<br>如果引入组件后发现仅触发了初始的`getData`,请确认是否在`getData`方法内没有调用`callback`移除 loading 状态,且未设置`blockWhenLoading`属性为 false。
|
22080
|
+
* @en Pull-up loading component, supports `scroll` and `click` two trigger loading methods, supports scroll monitoring. Both controlled and uncontrolled forms are supported. <br>If only the initial `getData` is triggered after the component is introduced, please make sure that the `callback` is not called in the `getData` method to remove the loading state, and the `blockWhenLoading` property is not set to false.
|
22081
|
+
* @type 反馈
|
22082
|
+
* @type_en Feedback
|
22083
|
+
* @name 加载更多
|
22084
|
+
* @name_en LoadMore
|
20587
22085
|
*/
|
20588
22086
|
|
20589
22087
|
var LoadMore = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
@@ -21877,10 +23375,10 @@
|
|
21877
23375
|
setDirectionState = _k[2];
|
21878
23376
|
|
21879
23377
|
var getOffset = React.useCallback(function (dir) {
|
21880
|
-
return getDefaultValue(isObject$
|
23378
|
+
return getDefaultValue(isObject$3(edgeOffset) ? edgeOffset[dir] : edgeOffset, defaultEdgeOffset[dir]);
|
21881
23379
|
}, [edgeOffset]);
|
21882
23380
|
var getAutoDirection = React.useCallback(function (dir) {
|
21883
|
-
return getDefaultValue(isObject$
|
23381
|
+
return getDefaultValue(isObject$3(useAutoDirection) ? useAutoDirection[dir] : useAutoDirection, defaultAutoDirection);
|
21884
23382
|
}, [useAutoDirection]);
|
21885
23383
|
React.useEffect(function () {
|
21886
23384
|
setDirectionState(direction);
|
@@ -22322,7 +23820,7 @@
|
|
22322
23820
|
var closeTimer = React.useRef(0);
|
22323
23821
|
/** 垂直方向自适应 */
|
22324
23822
|
|
22325
|
-
var autoVerticalDirection = getDefaultValue(isObject$
|
23823
|
+
var autoVerticalDirection = getDefaultValue(isObject$3(useAutoDirection) ? useAutoDirection.vertical : useAutoDirection, defaultAutoDirection);
|
22326
23824
|
|
22327
23825
|
var popoverDisappear = function popoverDisappear() {
|
22328
23826
|
onVisibleChange(false);
|
@@ -24584,196 +26082,6 @@
|
|
24584
26082
|
Step: Step
|
24585
26083
|
});
|
24586
26084
|
|
24587
|
-
/**
|
24588
|
-
* 粘性布局组件,元素相对于窗口或指定容器的吸顶效果。
|
24589
|
-
* @en Sticky layout component, The sticky-to-top effect of the element relative to the window or specified container
|
24590
|
-
* @type 布局
|
24591
|
-
* @type_en Layout
|
24592
|
-
* @name 粘性布局
|
24593
|
-
* @name_en Sticky
|
24594
|
-
*/
|
24595
|
-
|
24596
|
-
var Sticky = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
24597
|
-
var _a = props.position,
|
24598
|
-
position = _a === void 0 ? 'top' : _a,
|
24599
|
-
_b = props.topOffset,
|
24600
|
-
topOffset = _b === void 0 ? 0 : _b,
|
24601
|
-
_c = props.bottomOffset,
|
24602
|
-
bottomOffset = _c === void 0 ? 0 : _c,
|
24603
|
-
_d = props.followOffset,
|
24604
|
-
followOffset = _d === void 0 ? 0 : _d,
|
24605
|
-
children = props.children,
|
24606
|
-
className = props.className,
|
24607
|
-
style = props.style,
|
24608
|
-
_e = props.zIndex,
|
24609
|
-
zIndex = _e === void 0 ? 100 : _e,
|
24610
|
-
_f = props.portalWhenSticky,
|
24611
|
-
portalWhenSticky = _f === void 0 ? false : _f,
|
24612
|
-
_g = props.stickyStyle,
|
24613
|
-
stickyStyle = _g === void 0 ? 'fixed' : _g,
|
24614
|
-
userSetStickyCssStyle = props.stickyCssStyle,
|
24615
|
-
getPortalContainer = props.getPortalContainer,
|
24616
|
-
getContainer = props.getContainer,
|
24617
|
-
getScrollContainer = props.getScrollContainer,
|
24618
|
-
onStickyStateChange = props.onStickyStateChange,
|
24619
|
-
onTopChange = props.onTopChange;
|
24620
|
-
|
24621
|
-
var _h = useRefState(false),
|
24622
|
-
isSticky = _h[0],
|
24623
|
-
isStickyRef = _h[1],
|
24624
|
-
setIsSticky = _h[2];
|
24625
|
-
|
24626
|
-
var _j = useRefState(false),
|
24627
|
-
wasSticky = _j[0],
|
24628
|
-
wasStickyRef = _j[1],
|
24629
|
-
setWasSticky = _j[2];
|
24630
|
-
|
24631
|
-
var _k = React.useState({}),
|
24632
|
-
stickyStateStyle = _k[0],
|
24633
|
-
setStickyStateStyle = _k[1];
|
24634
|
-
|
24635
|
-
var contentRef = React.useRef(null);
|
24636
|
-
var placeholderRef = React.useRef(null);
|
24637
|
-
var contentCalculateHeightRef = React.useRef(0);
|
24638
|
-
var containerRef = React.useRef(null);
|
24639
|
-
var scrollContainerRef = React.useRef(null);
|
24640
|
-
var framePendingRef = React.useRef(false);
|
24641
|
-
var containerEventHandler = React.useCallback(function (_a) {
|
24642
|
-
var followTop = _a.followTop,
|
24643
|
-
followBottom = _a.followBottom;
|
24644
|
-
|
24645
|
-
if (!contentRef.current) {
|
24646
|
-
return;
|
24647
|
-
}
|
24648
|
-
|
24649
|
-
var needTop = position === 'top' || position === 'both';
|
24650
|
-
var needBottom = position === 'bottom' || position === 'both';
|
24651
|
-
var placeholderClientRect = placeholderRef.current.getBoundingClientRect();
|
24652
|
-
var contentClientRect = contentRef.current.getBoundingClientRect();
|
24653
|
-
var calculatedHeight = contentClientRect.height;
|
24654
|
-
contentCalculateHeightRef.current = contentClientRect.height;
|
24655
|
-
var containerRect = getScrollContainerRect(scrollContainerRef.current).containerRect;
|
24656
|
-
var containerTop = containerRect.top,
|
24657
|
-
containerBottom = containerRect.bottom,
|
24658
|
-
containerHeight = containerRect.height;
|
24659
|
-
var disFromTop = placeholderClientRect.top - containerTop;
|
24660
|
-
var disFromBottom = placeholderClientRect.top + calculatedHeight - containerBottom;
|
24661
|
-
var topFollowDifference = followBottom - followOffset - calculatedHeight - topOffset - containerTop;
|
24662
|
-
var bottomFollowDifference = containerHeight - followTop - followOffset - calculatedHeight - bottomOffset;
|
24663
|
-
setWasSticky(Boolean(isStickyRef.current));
|
24664
|
-
var isTopSticky = needTop ? disFromTop <= topOffset && followBottom > containerTop + followOffset : false;
|
24665
|
-
var isBottomSticky = needBottom ? disFromBottom >= -bottomOffset && followTop < containerBottom - followOffset : false;
|
24666
|
-
var newStickyState = isTopSticky || isBottomSticky;
|
24667
|
-
var cssTop = (stickyStyle === 'absolute' ? 0 : containerTop) + topOffset;
|
24668
|
-
var cssBottom = (stickyStyle === 'absolute' ? 0 : window.innerHeight - containerBottom) + bottomOffset;
|
24669
|
-
var stickyCssStyle = {};
|
24670
|
-
|
24671
|
-
if (newStickyState) {
|
24672
|
-
stickyCssStyle = __assign$2(__assign$2(__assign$2(__assign$2({
|
24673
|
-
transform: 'translateZ(0)',
|
24674
|
-
WebkitTransform: 'translateZ(0)',
|
24675
|
-
position: stickyStyle === 'absolute' ? 'absolute' : 'fixed',
|
24676
|
-
zIndex: zIndex
|
24677
|
-
}, isTopSticky ? {
|
24678
|
-
top: topFollowDifference > 0 ? cssTop : cssTop + topFollowDifference
|
24679
|
-
} : {}), isBottomSticky ? {
|
24680
|
-
bottom: bottomFollowDifference > 0 ? cssBottom : cssBottom + bottomFollowDifference
|
24681
|
-
} : {}), {
|
24682
|
-
left: placeholderClientRect.left,
|
24683
|
-
width: placeholderClientRect.width
|
24684
|
-
}), userSetStickyCssStyle || {});
|
24685
|
-
}
|
24686
|
-
|
24687
|
-
onTopChange === null || onTopChange === void 0 ? void 0 : onTopChange(Math.max(0, contentClientRect.top - containerTop - topOffset));
|
24688
|
-
setIsSticky(newStickyState);
|
24689
|
-
setStickyStateStyle(stickyCssStyle);
|
24690
|
-
|
24691
|
-
if (newStickyState !== wasStickyRef.current) {
|
24692
|
-
onStickyStateChange && onStickyStateChange({
|
24693
|
-
isTopSticky: isTopSticky,
|
24694
|
-
isBottomSticky: isBottomSticky,
|
24695
|
-
isSticky: newStickyState,
|
24696
|
-
wasSticky: wasStickyRef.current
|
24697
|
-
});
|
24698
|
-
}
|
24699
|
-
}, [position, topOffset, bottomOffset, followOffset, zIndex, stickyStyle, onStickyStateChange, onTopChange, userSetStickyCssStyle]);
|
24700
|
-
var recalculatePosition = React.useCallback(function () {
|
24701
|
-
if (framePendingRef.current) {
|
24702
|
-
return;
|
24703
|
-
}
|
24704
|
-
|
24705
|
-
execRAF(function () {
|
24706
|
-
framePendingRef.current = false;
|
24707
|
-
|
24708
|
-
if (containerRef.current) {
|
24709
|
-
var _a = containerRef.current.getBoundingClientRect(),
|
24710
|
-
top_1 = _a.top,
|
24711
|
-
bottom = _a.bottom;
|
24712
|
-
|
24713
|
-
containerEventHandler({
|
24714
|
-
followTop: top_1,
|
24715
|
-
followBottom: bottom
|
24716
|
-
});
|
24717
|
-
}
|
24718
|
-
});
|
24719
|
-
framePendingRef.current = true;
|
24720
|
-
}, [containerEventHandler]);
|
24721
|
-
React.useEffect(function () {
|
24722
|
-
var containerEle = getActualContainer(getContainer);
|
24723
|
-
containerRef.current = containerEle || document.body;
|
24724
|
-
var eventTarget = getScrollContainer ? getActualContainer(getScrollContainer) : window;
|
24725
|
-
if (!eventTarget) return;
|
24726
|
-
scrollContainerRef.current = eventTarget;
|
24727
|
-
|
24728
|
-
var attachEventListeners = function attachEventListeners(target) {
|
24729
|
-
target.addEventListener('scroll', recalculatePosition);
|
24730
|
-
};
|
24731
|
-
|
24732
|
-
var removeEventListeners = function removeEventListeners(target) {
|
24733
|
-
target.removeEventListener('scroll', recalculatePosition);
|
24734
|
-
};
|
24735
|
-
|
24736
|
-
attachEventListeners(eventTarget);
|
24737
|
-
recalculatePosition();
|
24738
|
-
return function () {
|
24739
|
-
removeEventListeners(eventTarget);
|
24740
|
-
};
|
24741
|
-
}, [getContainer, getScrollContainer, recalculatePosition]);
|
24742
|
-
React.useEffect(function () {
|
24743
|
-
if (placeholderRef.current) {
|
24744
|
-
// 当元素吸顶时,默认有一个占位的元素占住该元素的位置,避免布局产生抖动
|
24745
|
-
// @en When an element is sticky to the top, a placeholder element occupies the element's position by default to avoid jitter in the layout
|
24746
|
-
placeholderRef.current.style.height = (isStickyRef.current ? contentCalculateHeightRef.current : 0) + "px";
|
24747
|
-
}
|
24748
|
-
}, [isSticky, wasSticky]);
|
24749
|
-
React.useImperativeHandle(ref, function () {
|
24750
|
-
return {
|
24751
|
-
dom: contentRef.current,
|
24752
|
-
recalculatePosition: recalculatePosition
|
24753
|
-
};
|
24754
|
-
}, [recalculatePosition]);
|
24755
|
-
var computedStyle = React.useMemo(function () {
|
24756
|
-
return __assign$2(__assign$2({}, style || {}), stickyStateStyle);
|
24757
|
-
}, [stickyStateStyle, style]);
|
24758
|
-
|
24759
|
-
function renderSticky(prefixCls) {
|
24760
|
-
return /*#__PURE__*/React__default["default"].createElement("div", {
|
24761
|
-
className: cls(prefixCls + "-sticky", className),
|
24762
|
-
ref: contentRef,
|
24763
|
-
style: computedStyle
|
24764
|
-
}, children);
|
24765
|
-
}
|
24766
|
-
|
24767
|
-
return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, function (_a) {
|
24768
|
-
var prefixCls = _a.prefixCls;
|
24769
|
-
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
24770
|
-
ref: placeholderRef
|
24771
|
-
}), portalWhenSticky && isSticky ? /*#__PURE__*/React__default["default"].createElement(Portal, {
|
24772
|
-
getContainer: getPortalContainer
|
24773
|
-
}, renderSticky(prefixCls)) : renderSticky(prefixCls));
|
24774
|
-
});
|
24775
|
-
});
|
24776
|
-
|
24777
26085
|
function renderAction(_a) {
|
24778
26086
|
var action = _a.action,
|
24779
26087
|
prefixCls = _a.prefixCls,
|
@@ -26119,7 +27427,7 @@
|
|
26119
27427
|
}
|
26120
27428
|
|
26121
27429
|
if (needRafScroll) {
|
26122
|
-
scrollWithAnimation(isVertical ? domRef.current.scrollLeft : domRef.current.scrollTop, position, function (top) {
|
27430
|
+
scrollWithAnimation$1(isVertical ? domRef.current.scrollLeft : domRef.current.scrollTop, position, function (top) {
|
26123
27431
|
if (domRef.current) {
|
26124
27432
|
if (isVertical) {
|
26125
27433
|
domRef.current.scrollLeft = top;
|
@@ -26439,7 +27747,7 @@
|
|
26439
27747
|
clearTimeout(timerRef.current);
|
26440
27748
|
autoScrollingRef.current = true;
|
26441
27749
|
var duration = rightNow ? 0 : transitionDuration || 0;
|
26442
|
-
scrollWithAnimation(scrollTop, scrollTop + normalizedTopDis, function (top) {
|
27750
|
+
scrollWithAnimation$1(scrollTop, scrollTop + normalizedTopDis, function (top) {
|
26443
27751
|
if (isGlobal) {
|
26444
27752
|
document.documentElement[scrollAttr] = top;
|
26445
27753
|
document.body[scrollAttr] = top;
|
@@ -27489,29 +28797,31 @@
|
|
27489
28797
|
|
27490
28798
|
var index = componentWrapper(Toast, methodsGenerator(ToastWithGlobalContext));
|
27491
28799
|
|
27492
|
-
exports.ActionSheet = index$
|
27493
|
-
exports.Avatar = index$
|
28800
|
+
exports.ActionSheet = index$o;
|
28801
|
+
exports.Avatar = index$n;
|
27494
28802
|
exports.Badge = Badge;
|
27495
28803
|
exports.Button = Button;
|
27496
28804
|
exports.Carousel = Carousel;
|
27497
|
-
exports.Cell = index$
|
28805
|
+
exports.Cell = index$m;
|
27498
28806
|
exports.Checkbox = Checkbox;
|
27499
28807
|
exports.CircleProgress = CircleProgress;
|
27500
|
-
exports.Collapse = index$
|
28808
|
+
exports.Collapse = index$l;
|
27501
28809
|
exports.ContextProvider = ContextProvider;
|
27502
28810
|
exports.CountDown = CountDown;
|
27503
|
-
exports.DatePicker = index$
|
27504
|
-
exports.Dialog = index$
|
28811
|
+
exports.DatePicker = index$k;
|
28812
|
+
exports.Dialog = index$j;
|
27505
28813
|
exports.Divider = Divider;
|
27506
28814
|
exports.Dropdown = Dropdown$1;
|
27507
28815
|
exports.DropdownMenu = DropdownMenu;
|
27508
28816
|
exports.Ellipsis = Ellipsis;
|
27509
|
-
exports.Form = index$
|
28817
|
+
exports.Form = index$h;
|
27510
28818
|
exports.Grid = Grid;
|
27511
28819
|
exports.Image = BaseImage;
|
27512
|
-
exports.ImagePicker = index$
|
27513
|
-
exports.ImagePreview = index$
|
27514
|
-
exports.
|
28820
|
+
exports.ImagePicker = index$b;
|
28821
|
+
exports.ImagePreview = index$a;
|
28822
|
+
exports.IndexBar = index$9;
|
28823
|
+
exports.Input = index$g;
|
28824
|
+
exports.Keyboard = Keyboard;
|
27515
28825
|
exports.LoadMore = LoadMore;
|
27516
28826
|
exports.Loading = Loading;
|
27517
28827
|
exports.Masking = Masking$1;
|
@@ -27527,11 +28837,11 @@
|
|
27527
28837
|
exports.Portal = Portal;
|
27528
28838
|
exports.Progress = Progress;
|
27529
28839
|
exports.PullRefresh = PullRefresh;
|
27530
|
-
exports.Radio = index$
|
27531
|
-
exports.Rate = index$
|
28840
|
+
exports.Radio = index$e;
|
28841
|
+
exports.Rate = index$d;
|
27532
28842
|
exports.SearchBar = SearchBar;
|
27533
28843
|
exports.ShowMonitor = ShowMonitor;
|
27534
|
-
exports.Slider = index$
|
28844
|
+
exports.Slider = index$c;
|
27535
28845
|
exports.Stepper = index$5;
|
27536
28846
|
exports.Steps = index$4;
|
27537
28847
|
exports.Sticky = Sticky;
|
@@ -27541,7 +28851,7 @@
|
|
27541
28851
|
exports.TabBar = index$2;
|
27542
28852
|
exports.Tabs = Tabs;
|
27543
28853
|
exports.Tag = index$1;
|
27544
|
-
exports.Textarea = index$
|
28854
|
+
exports.Textarea = index$f;
|
27545
28855
|
exports.Toast = index;
|
27546
28856
|
exports.Transition = Transition;
|
27547
28857
|
|