@rsmax/web 1.3.11 → 1.3.13
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 +8 -0
- package/assets/normalize.css +39 -140
- package/cjs/KeepAlive.d.ts +10 -0
- package/cjs/KeepAlive.js +96 -0
- package/cjs/PullToRefresh.d.ts +2 -2
- package/cjs/PullToRefresh.js +2 -2
- package/cjs/TabBar.d.ts +2 -4
- package/cjs/TabBar.js +8 -12
- package/cjs/api.js +11 -7
- package/cjs/bootstrap.d.ts +1 -1
- package/cjs/bootstrap.js +1 -6
- package/cjs/bootstrapMpa.js +3 -3
- package/cjs/createApp.d.ts +2 -3
- package/cjs/createApp.js +42 -24
- package/cjs/createAppConfig.js +3 -2
- package/cjs/createPageConfig.d.ts +1 -1
- package/cjs/createPageConfig.js +8 -6
- package/cjs/hooks/useQuery.js +2 -2
- package/cjs/types/config.d.ts +1 -1
- package/esm/KeepAlive.d.ts +10 -0
- package/esm/KeepAlive.js +68 -0
- package/esm/PullToRefresh.d.ts +2 -2
- package/esm/PullToRefresh.js +2 -2
- package/esm/TabBar.d.ts +2 -4
- package/esm/TabBar.js +9 -13
- package/esm/api.js +11 -7
- package/esm/bootstrap.d.ts +1 -1
- package/esm/bootstrap.js +1 -6
- package/esm/bootstrapMpa.js +3 -3
- package/esm/createApp.d.ts +2 -3
- package/esm/createApp.js +43 -25
- package/esm/createAppConfig.js +3 -2
- package/esm/createPageConfig.d.ts +1 -1
- package/esm/createPageConfig.js +8 -6
- package/esm/hooks/useQuery.js +2 -2
- package/esm/types/config.d.ts +1 -1
- package/package.json +19 -17
- package/vitest.config.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.13](https://github.com/remaxjs/remax/compare/v1.3.12...v1.3.13) (2025-06-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rsmax/web
|
|
9
|
+
|
|
10
|
+
## [1.3.12](https://github.com/remaxjs/remax/compare/v1.3.11...v1.3.12) (2025-06-08)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rsmax/web
|
|
13
|
+
|
|
6
14
|
## [1.3.11](https://github.com/remaxjs/remax/compare/v1.3.8...v1.3.11) (2025-06-04)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @rsmax/web
|
package/assets/normalize.css
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
/*! normalize.css
|
|
1
|
+
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
|
2
2
|
|
|
3
3
|
/* Document
|
|
4
4
|
========================================================================== */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 1. Correct the line height in all browsers.
|
|
8
|
-
* 2. Prevent adjustments of font size after orientation changes in
|
|
9
|
-
* IE on Windows Phone and in iOS.
|
|
8
|
+
* 2. Prevent adjustments of font size after orientation changes in iOS.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
html {
|
|
13
12
|
line-height: 1.15; /* 1 */
|
|
14
|
-
-ms-text-size-adjust: 100%; /* 2 */
|
|
15
13
|
-webkit-text-size-adjust: 100%; /* 2 */
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -19,7 +17,7 @@ html {
|
|
|
19
17
|
========================================================================== */
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
|
-
* Remove the margin in all browsers
|
|
20
|
+
* Remove the margin in all browsers.
|
|
23
21
|
*/
|
|
24
22
|
|
|
25
23
|
body {
|
|
@@ -27,15 +25,10 @@ body {
|
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
28
|
+
* Render the `main` element consistently in IE.
|
|
31
29
|
*/
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
aside,
|
|
35
|
-
footer,
|
|
36
|
-
header,
|
|
37
|
-
nav,
|
|
38
|
-
section {
|
|
31
|
+
main {
|
|
39
32
|
display: block;
|
|
40
33
|
}
|
|
41
34
|
|
|
@@ -52,26 +45,6 @@ h1 {
|
|
|
52
45
|
/* Grouping content
|
|
53
46
|
========================================================================== */
|
|
54
47
|
|
|
55
|
-
/**
|
|
56
|
-
* Add the correct display in IE 9-.
|
|
57
|
-
* 1. Add the correct display in IE.
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
figcaption,
|
|
61
|
-
figure,
|
|
62
|
-
main {
|
|
63
|
-
/* 1 */
|
|
64
|
-
display: block;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Add the correct margin in IE 8.
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
figure {
|
|
72
|
-
margin: 1em 40px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
48
|
/**
|
|
76
49
|
* 1. Add the correct box sizing in Firefox.
|
|
77
50
|
* 2. Show the overflow in Edge and IE.
|
|
@@ -97,17 +70,15 @@ pre {
|
|
|
97
70
|
========================================================================== */
|
|
98
71
|
|
|
99
72
|
/**
|
|
100
|
-
*
|
|
101
|
-
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
|
73
|
+
* Remove the gray background on active links in IE 10.
|
|
102
74
|
*/
|
|
103
75
|
|
|
104
76
|
a {
|
|
105
|
-
background-color: transparent;
|
|
106
|
-
-webkit-text-decoration-skip: objects; /* 2 */
|
|
77
|
+
background-color: transparent;
|
|
107
78
|
}
|
|
108
79
|
|
|
109
80
|
/**
|
|
110
|
-
* 1. Remove the bottom border in Chrome 57-
|
|
81
|
+
* 1. Remove the bottom border in Chrome 57-
|
|
111
82
|
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
|
112
83
|
*/
|
|
113
84
|
|
|
@@ -117,15 +88,6 @@ abbr[title] {
|
|
|
117
88
|
text-decoration: underline dotted; /* 2 */
|
|
118
89
|
}
|
|
119
90
|
|
|
120
|
-
/**
|
|
121
|
-
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
|
122
|
-
*/
|
|
123
|
-
|
|
124
|
-
b,
|
|
125
|
-
strong {
|
|
126
|
-
font-weight: inherit;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
91
|
/**
|
|
130
92
|
* Add the correct font weight in Chrome, Edge, and Safari.
|
|
131
93
|
*/
|
|
@@ -147,23 +109,6 @@ samp {
|
|
|
147
109
|
font-size: 1em; /* 2 */
|
|
148
110
|
}
|
|
149
111
|
|
|
150
|
-
/**
|
|
151
|
-
* Add the correct font style in Android 4.3-.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
dfn {
|
|
155
|
-
font-style: italic;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Add the correct background and color in IE 9-.
|
|
160
|
-
*/
|
|
161
|
-
|
|
162
|
-
mark {
|
|
163
|
-
background-color: #ff0;
|
|
164
|
-
color: #000;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
112
|
/**
|
|
168
113
|
* Add the correct font size in all browsers.
|
|
169
114
|
*/
|
|
@@ -197,44 +142,18 @@ sup {
|
|
|
197
142
|
========================================================================== */
|
|
198
143
|
|
|
199
144
|
/**
|
|
200
|
-
*
|
|
201
|
-
*/
|
|
202
|
-
|
|
203
|
-
audio,
|
|
204
|
-
video {
|
|
205
|
-
display: inline-block;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* Add the correct display in iOS 4-7.
|
|
210
|
-
*/
|
|
211
|
-
|
|
212
|
-
audio:not([controls]) {
|
|
213
|
-
display: none;
|
|
214
|
-
height: 0;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Remove the border on images inside links in IE 10-.
|
|
145
|
+
* Remove the border on images inside links in IE 10.
|
|
219
146
|
*/
|
|
220
147
|
|
|
221
148
|
img {
|
|
222
149
|
border-style: none;
|
|
223
150
|
}
|
|
224
151
|
|
|
225
|
-
/**
|
|
226
|
-
* Hide the overflow in IE.
|
|
227
|
-
*/
|
|
228
|
-
|
|
229
|
-
svg:not(:root) {
|
|
230
|
-
overflow: hidden;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
152
|
/* Forms
|
|
234
153
|
========================================================================== */
|
|
235
154
|
|
|
236
155
|
/**
|
|
237
|
-
* 1. Change the font styles in all browsers
|
|
156
|
+
* 1. Change the font styles in all browsers.
|
|
238
157
|
* 2. Remove the margin in Firefox and Safari.
|
|
239
158
|
*/
|
|
240
159
|
|
|
@@ -243,7 +162,7 @@ input,
|
|
|
243
162
|
optgroup,
|
|
244
163
|
select,
|
|
245
164
|
textarea {
|
|
246
|
-
font-family:
|
|
165
|
+
font-family: inherit; /* 1 */
|
|
247
166
|
font-size: 100%; /* 1 */
|
|
248
167
|
line-height: 1.15; /* 1 */
|
|
249
168
|
margin: 0; /* 2 */
|
|
@@ -255,8 +174,7 @@ textarea {
|
|
|
255
174
|
*/
|
|
256
175
|
|
|
257
176
|
button,
|
|
258
|
-
input {
|
|
259
|
-
/* 1 */
|
|
177
|
+
input { /* 1 */
|
|
260
178
|
overflow: visible;
|
|
261
179
|
}
|
|
262
180
|
|
|
@@ -266,22 +184,19 @@ input {
|
|
|
266
184
|
*/
|
|
267
185
|
|
|
268
186
|
button,
|
|
269
|
-
select {
|
|
270
|
-
/* 1 */
|
|
187
|
+
select { /* 1 */
|
|
271
188
|
text-transform: none;
|
|
272
189
|
}
|
|
273
190
|
|
|
274
191
|
/**
|
|
275
|
-
*
|
|
276
|
-
* controls in Android 4.
|
|
277
|
-
* 2. Correct the inability to style clickable types in iOS and Safari.
|
|
192
|
+
* Correct the inability to style clickable types in iOS and Safari.
|
|
278
193
|
*/
|
|
279
194
|
|
|
280
195
|
button,
|
|
281
|
-
|
|
196
|
+
[type="button"],
|
|
282
197
|
[type="reset"],
|
|
283
198
|
[type="submit"] {
|
|
284
|
-
-webkit-appearance: button;
|
|
199
|
+
-webkit-appearance: button;
|
|
285
200
|
}
|
|
286
201
|
|
|
287
202
|
/**
|
|
@@ -289,9 +204,9 @@ html [type="button"], /* 1 */
|
|
|
289
204
|
*/
|
|
290
205
|
|
|
291
206
|
button::-moz-focus-inner,
|
|
292
|
-
[type=
|
|
293
|
-
[type=
|
|
294
|
-
[type=
|
|
207
|
+
[type="button"]::-moz-focus-inner,
|
|
208
|
+
[type="reset"]::-moz-focus-inner,
|
|
209
|
+
[type="submit"]::-moz-focus-inner {
|
|
295
210
|
border-style: none;
|
|
296
211
|
padding: 0;
|
|
297
212
|
}
|
|
@@ -301,9 +216,9 @@ button::-moz-focus-inner,
|
|
|
301
216
|
*/
|
|
302
217
|
|
|
303
218
|
button:-moz-focusring,
|
|
304
|
-
[type=
|
|
305
|
-
[type=
|
|
306
|
-
[type=
|
|
219
|
+
[type="button"]:-moz-focusring,
|
|
220
|
+
[type="reset"]:-moz-focusring,
|
|
221
|
+
[type="submit"]:-moz-focusring {
|
|
307
222
|
outline: 1px dotted ButtonText;
|
|
308
223
|
}
|
|
309
224
|
|
|
@@ -332,17 +247,15 @@ legend {
|
|
|
332
247
|
}
|
|
333
248
|
|
|
334
249
|
/**
|
|
335
|
-
*
|
|
336
|
-
* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
|
250
|
+
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
|
337
251
|
*/
|
|
338
252
|
|
|
339
253
|
progress {
|
|
340
|
-
|
|
341
|
-
vertical-align: baseline; /* 2 */
|
|
254
|
+
vertical-align: baseline;
|
|
342
255
|
}
|
|
343
256
|
|
|
344
257
|
/**
|
|
345
|
-
* Remove the default vertical scrollbar in IE
|
|
258
|
+
* Remove the default vertical scrollbar in IE 10+.
|
|
346
259
|
*/
|
|
347
260
|
|
|
348
261
|
textarea {
|
|
@@ -350,12 +263,12 @@ textarea {
|
|
|
350
263
|
}
|
|
351
264
|
|
|
352
265
|
/**
|
|
353
|
-
* 1. Add the correct box sizing in IE 10
|
|
354
|
-
* 2. Remove the padding in IE 10
|
|
266
|
+
* 1. Add the correct box sizing in IE 10.
|
|
267
|
+
* 2. Remove the padding in IE 10.
|
|
355
268
|
*/
|
|
356
269
|
|
|
357
|
-
[type=
|
|
358
|
-
[type=
|
|
270
|
+
[type="checkbox"],
|
|
271
|
+
[type="radio"] {
|
|
359
272
|
box-sizing: border-box; /* 1 */
|
|
360
273
|
padding: 0; /* 2 */
|
|
361
274
|
}
|
|
@@ -364,8 +277,8 @@ textarea {
|
|
|
364
277
|
* Correct the cursor style of increment and decrement buttons in Chrome.
|
|
365
278
|
*/
|
|
366
279
|
|
|
367
|
-
[type=
|
|
368
|
-
[type=
|
|
280
|
+
[type="number"]::-webkit-inner-spin-button,
|
|
281
|
+
[type="number"]::-webkit-outer-spin-button {
|
|
369
282
|
height: auto;
|
|
370
283
|
}
|
|
371
284
|
|
|
@@ -374,17 +287,16 @@ textarea {
|
|
|
374
287
|
* 2. Correct the outline style in Safari.
|
|
375
288
|
*/
|
|
376
289
|
|
|
377
|
-
[type=
|
|
290
|
+
[type="search"] {
|
|
378
291
|
-webkit-appearance: textfield; /* 1 */
|
|
379
292
|
outline-offset: -2px; /* 2 */
|
|
380
293
|
}
|
|
381
294
|
|
|
382
295
|
/**
|
|
383
|
-
* Remove the inner padding
|
|
296
|
+
* Remove the inner padding in Chrome and Safari on macOS.
|
|
384
297
|
*/
|
|
385
298
|
|
|
386
|
-
[type=
|
|
387
|
-
[type='search']::-webkit-search-decoration {
|
|
299
|
+
[type="search"]::-webkit-search-decoration {
|
|
388
300
|
-webkit-appearance: none;
|
|
389
301
|
}
|
|
390
302
|
|
|
@@ -402,12 +314,10 @@ textarea {
|
|
|
402
314
|
========================================================================== */
|
|
403
315
|
|
|
404
316
|
/*
|
|
405
|
-
* Add the correct display in IE
|
|
406
|
-
* 1. Add the correct display in Edge, IE, and Firefox.
|
|
317
|
+
* Add the correct display in Edge, IE 10+, and Firefox.
|
|
407
318
|
*/
|
|
408
319
|
|
|
409
|
-
details
|
|
410
|
-
menu {
|
|
320
|
+
details {
|
|
411
321
|
display: block;
|
|
412
322
|
}
|
|
413
323
|
|
|
@@ -419,30 +329,19 @@ summary {
|
|
|
419
329
|
display: list-item;
|
|
420
330
|
}
|
|
421
331
|
|
|
422
|
-
/*
|
|
332
|
+
/* Misc
|
|
423
333
|
========================================================================== */
|
|
424
334
|
|
|
425
335
|
/**
|
|
426
|
-
* Add the correct display in IE
|
|
427
|
-
*/
|
|
428
|
-
|
|
429
|
-
canvas {
|
|
430
|
-
display: inline-block;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Add the correct display in IE.
|
|
336
|
+
* Add the correct display in IE 10+.
|
|
435
337
|
*/
|
|
436
338
|
|
|
437
339
|
template {
|
|
438
340
|
display: none;
|
|
439
341
|
}
|
|
440
342
|
|
|
441
|
-
/* Hidden
|
|
442
|
-
========================================================================== */
|
|
443
|
-
|
|
444
343
|
/**
|
|
445
|
-
* Add the correct display in IE 10
|
|
344
|
+
* Add the correct display in IE 10.
|
|
446
345
|
*/
|
|
447
346
|
|
|
448
347
|
[hidden] {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const KeepAliveProvider: React.FC<{
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}>;
|
|
5
|
+
interface KeepAliveProps {
|
|
6
|
+
cacheKey: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const KeepAlive: React.FC<KeepAliveProps>;
|
|
10
|
+
export {};
|
package/cjs/KeepAlive.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.KeepAlive = exports.KeepAliveProvider = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
29
|
+
const KeepAliveContext = (0, react_1.createContext)(null);
|
|
30
|
+
const KeepAliveProvider = ({ children }) => {
|
|
31
|
+
const [cache, setCache] = (0, react_1.useState)(new Map());
|
|
32
|
+
return (react_1.default.createElement(KeepAliveContext.Provider, { value: { cache, setCache } },
|
|
33
|
+
children,
|
|
34
|
+
Array.from(cache.entries()).map(([key, item]) => (react_1.default.createElement("div", { key: key, style: {
|
|
35
|
+
display: item.status === 'active' ? 'block' : 'none',
|
|
36
|
+
height: '100%',
|
|
37
|
+
width: '100%',
|
|
38
|
+
} }, item.component)))));
|
|
39
|
+
};
|
|
40
|
+
exports.KeepAliveProvider = KeepAliveProvider;
|
|
41
|
+
const KeepAlive = ({ cacheKey, children }) => {
|
|
42
|
+
const context = (0, react_1.useContext)(KeepAliveContext);
|
|
43
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
44
|
+
const componentRef = (0, react_1.useRef)(children);
|
|
45
|
+
if (!context) {
|
|
46
|
+
throw new Error('KeepAlive must be used within KeepAliveProvider');
|
|
47
|
+
}
|
|
48
|
+
const { cache, setCache } = context;
|
|
49
|
+
react_1.default.useEffect(() => {
|
|
50
|
+
// 更新组件引用
|
|
51
|
+
componentRef.current = children;
|
|
52
|
+
setCache(prev => {
|
|
53
|
+
const next = new Map(prev);
|
|
54
|
+
if (next.has(cacheKey)) {
|
|
55
|
+
next.set(cacheKey, Object.assign(Object.assign({}, next.get(cacheKey)), { component: children }));
|
|
56
|
+
}
|
|
57
|
+
return next;
|
|
58
|
+
});
|
|
59
|
+
}, [children]);
|
|
60
|
+
react_1.default.useEffect(() => {
|
|
61
|
+
// 初始化缓存
|
|
62
|
+
if (!cache.has(cacheKey)) {
|
|
63
|
+
setCache(prev => {
|
|
64
|
+
const next = new Map(prev);
|
|
65
|
+
next.set(cacheKey, {
|
|
66
|
+
component: componentRef.current,
|
|
67
|
+
status: 'active',
|
|
68
|
+
});
|
|
69
|
+
return next;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// 更新状态
|
|
73
|
+
setCache(prev => {
|
|
74
|
+
const next = new Map(prev);
|
|
75
|
+
prev.forEach((value, key) => {
|
|
76
|
+
next.set(key, Object.assign(Object.assign({}, value), { status: key === cacheKey ? 'active' : 'inactive' }));
|
|
77
|
+
});
|
|
78
|
+
return next;
|
|
79
|
+
});
|
|
80
|
+
// 清理函数
|
|
81
|
+
return () => {
|
|
82
|
+
// 这里我们不会在路由变化时删除缓存
|
|
83
|
+
// 只是将状态设置为 inactive
|
|
84
|
+
setCache(prev => {
|
|
85
|
+
const next = new Map(prev);
|
|
86
|
+
if (next.has(cacheKey)) {
|
|
87
|
+
next.set(cacheKey, Object.assign(Object.assign({}, next.get(cacheKey)), { status: 'inactive' }));
|
|
88
|
+
}
|
|
89
|
+
return next;
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
}, [cacheKey, location.pathname]);
|
|
93
|
+
// 不直接渲染children,因为所有缓存的组件都在Provider中渲染
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
exports.KeepAlive = KeepAlive;
|
package/cjs/PullToRefresh.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const RsmaxPullToRefresh: React.FC<any>;
|
|
3
|
+
export default RsmaxPullToRefresh;
|
package/cjs/PullToRefresh.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const rmc_pull_to_refresh_1 = __importDefault(require("rmc-pull-to-refresh"));
|
|
8
8
|
const LoadingIcon_1 = __importDefault(require("./LoadingIcon"));
|
|
9
|
-
const
|
|
9
|
+
const RsmaxPullToRefresh = props => {
|
|
10
10
|
return (react_1.default.createElement(rmc_pull_to_refresh_1.default, Object.assign({}, props, { getScrollContainer: () => {
|
|
11
11
|
document.body;
|
|
12
12
|
}, indicator: {
|
|
@@ -16,4 +16,4 @@ const RemaxPullToRefresh = props => {
|
|
|
16
16
|
finish: react_1.default.createElement(LoadingIcon_1.default, null),
|
|
17
17
|
} })));
|
|
18
18
|
};
|
|
19
|
-
exports.default =
|
|
19
|
+
exports.default = RsmaxPullToRefresh;
|
package/cjs/TabBar.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function TabBar({ config, history }: {
|
|
2
|
+
import type { TabBarConfig } from './types';
|
|
3
|
+
export declare function TabBar({ config }: {
|
|
5
4
|
config: TabBarConfig;
|
|
6
|
-
history: History;
|
|
7
5
|
}): React.JSX.Element;
|
package/cjs/TabBar.js
CHANGED
|
@@ -6,18 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TabBar = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const react_router_dom_1 = require("react-router-dom");
|
|
9
|
-
function TabBar({ config
|
|
9
|
+
function TabBar({ config }) {
|
|
10
10
|
var _a;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return history.listen(() => {
|
|
15
|
-
setCurrentPath(history.location.pathname);
|
|
16
|
-
});
|
|
17
|
-
}, []);
|
|
11
|
+
const location = (0, react_router_dom_1.useLocation)();
|
|
12
|
+
const currentPath = location.pathname;
|
|
13
|
+
react_1.default.useEffect(() => { }, [currentPath]);
|
|
18
14
|
const isActive = (url) => {
|
|
19
15
|
if (!url.startsWith('/')) {
|
|
20
|
-
url =
|
|
16
|
+
url = `/${url}`;
|
|
21
17
|
}
|
|
22
18
|
return currentPath === url;
|
|
23
19
|
};
|
|
@@ -29,9 +25,9 @@ function TabBarItem({ config, isActive, item }) {
|
|
|
29
25
|
const icon = isActive ? item.activeImage || item.image : item.image;
|
|
30
26
|
const textColor = (_a = config.textColor) !== null && _a !== void 0 ? _a : '#333';
|
|
31
27
|
const selectedColor = (_b = config.selectedColor) !== null && _b !== void 0 ? _b : '#108ee9';
|
|
32
|
-
return (react_1.default.createElement(react_router_dom_1.Link, { to: `/${item.url}`, className:
|
|
33
|
-
react_1.default.createElement("div", { className:
|
|
34
|
-
react_1.default.createElement("div", { className:
|
|
28
|
+
return (react_1.default.createElement(react_router_dom_1.Link, { to: item.url.startsWith('/') ? item.url : `/${item.url}`, className: 'rsmax-tab-item' },
|
|
29
|
+
react_1.default.createElement("div", { className: 'rsmax-tab-item-image', style: { backgroundImage: `url(${icon})` } }),
|
|
30
|
+
react_1.default.createElement("div", { className: 'rsmax-tab-item-title', style: {
|
|
35
31
|
color: isActive ? selectedColor : textColor,
|
|
36
32
|
} }, item.title)));
|
|
37
33
|
}
|
package/cjs/api.js
CHANGED
|
@@ -3,20 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.switchTab = exports.reLaunch = exports.redirectTo = exports.navigateBack = exports.navigateTo = void 0;
|
|
4
4
|
const framework_shared_1 = require("@rsmax/framework-shared");
|
|
5
5
|
function navigateTo(params) {
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const navigate = framework_shared_1.RuntimeOptions.get('navigate');
|
|
7
|
+
navigate(params.url, {
|
|
8
|
+
replace: true,
|
|
9
|
+
});
|
|
8
10
|
return Promise.resolve();
|
|
9
11
|
}
|
|
10
12
|
exports.navigateTo = navigateTo;
|
|
11
13
|
function navigateBack(params) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
+
const navigate = framework_shared_1.RuntimeOptions.get('navigate');
|
|
15
|
+
navigate(-((params === null || params === void 0 ? void 0 : params.delta) || 1));
|
|
14
16
|
return Promise.resolve();
|
|
15
17
|
}
|
|
16
18
|
exports.navigateBack = navigateBack;
|
|
17
19
|
function redirectTo(params) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
+
const navigate = framework_shared_1.RuntimeOptions.get('navigate');
|
|
21
|
+
navigate(params.url, {
|
|
22
|
+
replace: true,
|
|
23
|
+
});
|
|
20
24
|
return Promise.resolve();
|
|
21
25
|
}
|
|
22
26
|
exports.redirectTo = redirectTo;
|
|
@@ -25,6 +29,6 @@ function reLaunch(params) {
|
|
|
25
29
|
}
|
|
26
30
|
exports.reLaunch = reLaunch;
|
|
27
31
|
function switchTab(params) {
|
|
28
|
-
navigateTo(params);
|
|
32
|
+
navigateTo(params).then();
|
|
29
33
|
}
|
|
30
34
|
exports.switchTab = switchTab;
|
package/cjs/bootstrap.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BootstrapOptions } from './types';
|
|
1
|
+
import type { BootstrapOptions } from './types';
|
|
2
2
|
export default function bootstrap(options: BootstrapOptions): void;
|
package/cjs/bootstrap.js
CHANGED
|
@@ -5,18 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const client_1 = require("react-dom/client");
|
|
7
7
|
const umi_hd_1 = __importDefault(require("umi-hd"));
|
|
8
|
-
const history_1 = require("history");
|
|
9
|
-
const framework_shared_1 = require("@rsmax/framework-shared");
|
|
10
8
|
const createApp_1 = __importDefault(require("./createApp"));
|
|
11
9
|
function bootstrap(options) {
|
|
12
10
|
(0, umi_hd_1.default)();
|
|
13
|
-
const { appConfig } = options;
|
|
14
|
-
const history = !appConfig.router || appConfig.router.type !== 'browser' ? (0, history_1.createHashHistory)() : (0, history_1.createBrowserHistory)();
|
|
15
|
-
framework_shared_1.RuntimeOptions.apply({ history, mpa: false });
|
|
16
11
|
const container = document.getElementById('rsmax-app');
|
|
17
12
|
if (!container)
|
|
18
13
|
throw new Error('Failed to find the root element');
|
|
19
14
|
const root = (0, client_1.createRoot)(container);
|
|
20
|
-
root.render((0, createApp_1.default)(options
|
|
15
|
+
root.render((0, createApp_1.default)(options));
|
|
21
16
|
}
|
|
22
17
|
exports.default = bootstrap;
|
package/cjs/bootstrapMpa.js
CHANGED
|
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const framework_shared_1 = require("@rsmax/framework-shared");
|
|
6
7
|
const react_1 = __importDefault(require("react"));
|
|
7
8
|
const client_1 = require("react-dom/client");
|
|
8
9
|
const umi_hd_1 = __importDefault(require("umi-hd"));
|
|
9
10
|
const createAppConfig_1 = __importDefault(require("./createAppConfig"));
|
|
10
|
-
const framework_shared_1 = require("@rsmax/framework-shared");
|
|
11
11
|
const createPageConfig_1 = __importDefault(require("./createPageConfig"));
|
|
12
12
|
const noop = () => {
|
|
13
13
|
// ignore
|
|
@@ -46,11 +46,11 @@ function bootstrap(options) {
|
|
|
46
46
|
if (url.startsWith('/'))
|
|
47
47
|
publicPath = location.pathname.replace(`/${page.route}.html`, '');
|
|
48
48
|
const arr = url.split('?');
|
|
49
|
-
arr[0] = arr[0]
|
|
49
|
+
arr[0] = `${arr[0]}.html`;
|
|
50
50
|
return publicPath + arr.join('?');
|
|
51
51
|
},
|
|
52
52
|
};
|
|
53
|
-
framework_shared_1.RuntimeOptions.apply({ pluginDriver,
|
|
53
|
+
framework_shared_1.RuntimeOptions.apply({ pluginDriver, mpa: true });
|
|
54
54
|
const App = createApp(options);
|
|
55
55
|
const container = document.getElementById('rsmax-app');
|
|
56
56
|
if (!container)
|
package/cjs/createApp.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export default function createApp(options: BootstrapOptions, history: History): React.JSX.Element;
|
|
2
|
+
import type { BootstrapOptions } from './types';
|
|
3
|
+
export default function createApp(options: BootstrapOptions): React.JSX.Element;
|