@v-c/util 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Children/isFragment.js +2 -0
- package/dist/Children/toArray.js +2 -0
- package/dist/Dom/addEventListener.js +2 -0
- package/dist/Dom/canUseDom.js +2 -0
- package/dist/Dom/class.js +2 -0
- package/dist/Dom/contains.js +2 -0
- package/dist/Dom/css.js +2 -0
- package/dist/Dom/dynamicCSS.js +13 -1
- package/dist/Dom/findDOMNode.js +5 -0
- package/dist/Dom/focus.js +13 -0
- package/dist/Dom/focusBoundary.js +2 -0
- package/dist/Dom/isVisible.js +2 -0
- package/dist/Dom/scrollLocker.js +5 -3
- package/dist/Dom/shadow.js +8 -0
- package/dist/Dom/styleChecker.js +2 -0
- package/dist/Dom/support.js +4 -2
- package/dist/KeyCode.js +329 -3
- package/dist/Portal.js +5 -4
- package/dist/PortalWrapper.d.ts +1 -1
- package/dist/PortalWrapper.js +28 -15
- package/dist/RenderComponent.js +9 -7
- package/dist/classnames.js +3 -1
- package/dist/composeProps.js +3 -2
- package/dist/createRef.js +6 -2
- package/dist/debug/diff.js +3 -1
- package/dist/deprecated.js +2 -0
- package/dist/getScrollBarSize.js +2 -0
- package/dist/guid.js +2 -0
- package/dist/hooks/useControlledState.js +2 -0
- package/dist/hooks/useEvent.js +3 -2
- package/dist/hooks/useId.js +9 -0
- package/dist/hooks/useLayoutEffect.js +2 -0
- package/dist/hooks/useMemo.js +2 -0
- package/dist/hooks/useMergedState.js +2 -0
- package/dist/hooks/useMobile.js +6 -5
- package/dist/hooks/useState.js +2 -0
- package/dist/index.js +4 -4
- package/dist/isEqual.js +11 -4
- package/dist/isMobile.js +3 -2
- package/dist/isValid.js +3 -2
- package/dist/omit.js +2 -0
- package/dist/pickAttrs.js +7 -0
- package/dist/props-util/index.js +5 -3
- package/dist/raf.js +3 -2
- package/dist/setStyle.js +9 -2
- package/dist/switchScrollingEffect.js +5 -3
- package/dist/test/domHook.js +2 -0
- package/dist/type.js +4 -2
- package/dist/utils/checkSlotProp.js +2 -0
- package/dist/utils/get.js +2 -0
- package/dist/utils/omit.js +2 -0
- package/dist/utils/set.js +14 -0
- package/dist/utils/transition.js +2 -0
- package/dist/utils/watchState.js +2 -0
- package/dist/vnode.d.ts +13 -0
- package/dist/vnode.js +34 -5
- package/dist/vueuse/unref-element.js +7 -0
- package/dist/warning.js +7 -2
- package/package.json +7 -1
package/dist/KeyCode.js
CHANGED
|
@@ -1,109 +1,432 @@
|
|
|
1
|
+
//#region src/KeyCode.ts
|
|
2
|
+
/**
|
|
3
|
+
* some key-codes definition and utils from closure-library
|
|
4
|
+
* @author yiminghe@gmail.com
|
|
5
|
+
*/
|
|
1
6
|
var KeyCode = {
|
|
7
|
+
/**
|
|
8
|
+
* MAC_ENTER
|
|
9
|
+
*/
|
|
2
10
|
MAC_ENTER: 3,
|
|
11
|
+
/**
|
|
12
|
+
* BACKSPACE
|
|
13
|
+
*/
|
|
3
14
|
BACKSPACE: 8,
|
|
15
|
+
/**
|
|
16
|
+
* TAB
|
|
17
|
+
*/
|
|
4
18
|
TAB: 9,
|
|
19
|
+
/**
|
|
20
|
+
* NUMLOCK on FF/Safari Mac
|
|
21
|
+
*/
|
|
5
22
|
NUM_CENTER: 12,
|
|
23
|
+
/**
|
|
24
|
+
* ENTER
|
|
25
|
+
*/
|
|
6
26
|
ENTER: 13,
|
|
27
|
+
/**
|
|
28
|
+
* SHIFT
|
|
29
|
+
*/
|
|
7
30
|
SHIFT: 16,
|
|
31
|
+
/**
|
|
32
|
+
* CTRL
|
|
33
|
+
*/
|
|
8
34
|
CTRL: 17,
|
|
35
|
+
/**
|
|
36
|
+
* ALT
|
|
37
|
+
*/
|
|
9
38
|
ALT: 18,
|
|
39
|
+
/**
|
|
40
|
+
* PAUSE
|
|
41
|
+
*/
|
|
10
42
|
PAUSE: 19,
|
|
43
|
+
/**
|
|
44
|
+
* CAPS_LOCK
|
|
45
|
+
*/
|
|
11
46
|
CAPS_LOCK: 20,
|
|
47
|
+
/**
|
|
48
|
+
* ESC
|
|
49
|
+
*/
|
|
12
50
|
ESC: 27,
|
|
51
|
+
/**
|
|
52
|
+
* SPACE
|
|
53
|
+
*/
|
|
13
54
|
SPACE: 32,
|
|
55
|
+
/**
|
|
56
|
+
* PAGE_UP
|
|
57
|
+
*/
|
|
14
58
|
PAGE_UP: 33,
|
|
59
|
+
/**
|
|
60
|
+
* PAGE_DOWN
|
|
61
|
+
*/
|
|
15
62
|
PAGE_DOWN: 34,
|
|
63
|
+
/**
|
|
64
|
+
* END
|
|
65
|
+
*/
|
|
16
66
|
END: 35,
|
|
67
|
+
/**
|
|
68
|
+
* HOME
|
|
69
|
+
*/
|
|
17
70
|
HOME: 36,
|
|
71
|
+
/**
|
|
72
|
+
* LEFT
|
|
73
|
+
*/
|
|
18
74
|
LEFT: 37,
|
|
75
|
+
/**
|
|
76
|
+
* UP
|
|
77
|
+
*/
|
|
19
78
|
UP: 38,
|
|
79
|
+
/**
|
|
80
|
+
* RIGHT
|
|
81
|
+
*/
|
|
20
82
|
RIGHT: 39,
|
|
83
|
+
/**
|
|
84
|
+
* DOWN
|
|
85
|
+
*/
|
|
21
86
|
DOWN: 40,
|
|
87
|
+
/**
|
|
88
|
+
* PRINT_SCREEN
|
|
89
|
+
*/
|
|
22
90
|
PRINT_SCREEN: 44,
|
|
91
|
+
/**
|
|
92
|
+
* INSERT
|
|
93
|
+
*/
|
|
23
94
|
INSERT: 45,
|
|
95
|
+
/**
|
|
96
|
+
* DELETE
|
|
97
|
+
*/
|
|
24
98
|
DELETE: 46,
|
|
99
|
+
/**
|
|
100
|
+
* ZERO
|
|
101
|
+
*/
|
|
25
102
|
ZERO: 48,
|
|
103
|
+
/**
|
|
104
|
+
* ONE
|
|
105
|
+
*/
|
|
26
106
|
ONE: 49,
|
|
107
|
+
/**
|
|
108
|
+
* TWO
|
|
109
|
+
*/
|
|
27
110
|
TWO: 50,
|
|
111
|
+
/**
|
|
112
|
+
* THREE
|
|
113
|
+
*/
|
|
28
114
|
THREE: 51,
|
|
115
|
+
/**
|
|
116
|
+
* FOUR
|
|
117
|
+
*/
|
|
29
118
|
FOUR: 52,
|
|
119
|
+
/**
|
|
120
|
+
* FIVE
|
|
121
|
+
*/
|
|
30
122
|
FIVE: 53,
|
|
123
|
+
/**
|
|
124
|
+
* SIX
|
|
125
|
+
*/
|
|
31
126
|
SIX: 54,
|
|
127
|
+
/**
|
|
128
|
+
* SEVEN
|
|
129
|
+
*/
|
|
32
130
|
SEVEN: 55,
|
|
131
|
+
/**
|
|
132
|
+
* EIGHT
|
|
133
|
+
*/
|
|
33
134
|
EIGHT: 56,
|
|
135
|
+
/**
|
|
136
|
+
* NINE
|
|
137
|
+
*/
|
|
34
138
|
NINE: 57,
|
|
139
|
+
/**
|
|
140
|
+
* QUESTION_MARK
|
|
141
|
+
*/
|
|
35
142
|
QUESTION_MARK: 63,
|
|
143
|
+
/**
|
|
144
|
+
* A
|
|
145
|
+
*/
|
|
36
146
|
A: 65,
|
|
147
|
+
/**
|
|
148
|
+
* B
|
|
149
|
+
*/
|
|
37
150
|
B: 66,
|
|
151
|
+
/**
|
|
152
|
+
* C
|
|
153
|
+
*/
|
|
38
154
|
C: 67,
|
|
155
|
+
/**
|
|
156
|
+
* D
|
|
157
|
+
*/
|
|
39
158
|
D: 68,
|
|
159
|
+
/**
|
|
160
|
+
* E
|
|
161
|
+
*/
|
|
40
162
|
E: 69,
|
|
163
|
+
/**
|
|
164
|
+
* F
|
|
165
|
+
*/
|
|
41
166
|
F: 70,
|
|
167
|
+
/**
|
|
168
|
+
* G
|
|
169
|
+
*/
|
|
42
170
|
G: 71,
|
|
171
|
+
/**
|
|
172
|
+
* H
|
|
173
|
+
*/
|
|
43
174
|
H: 72,
|
|
175
|
+
/**
|
|
176
|
+
* I
|
|
177
|
+
*/
|
|
44
178
|
I: 73,
|
|
179
|
+
/**
|
|
180
|
+
* J
|
|
181
|
+
*/
|
|
45
182
|
J: 74,
|
|
183
|
+
/**
|
|
184
|
+
* K
|
|
185
|
+
*/
|
|
46
186
|
K: 75,
|
|
187
|
+
/**
|
|
188
|
+
* L
|
|
189
|
+
*/
|
|
47
190
|
L: 76,
|
|
191
|
+
/**
|
|
192
|
+
* M
|
|
193
|
+
*/
|
|
48
194
|
M: 77,
|
|
195
|
+
/**
|
|
196
|
+
* N
|
|
197
|
+
*/
|
|
49
198
|
N: 78,
|
|
199
|
+
/**
|
|
200
|
+
* O
|
|
201
|
+
*/
|
|
50
202
|
O: 79,
|
|
203
|
+
/**
|
|
204
|
+
* P
|
|
205
|
+
*/
|
|
51
206
|
P: 80,
|
|
207
|
+
/**
|
|
208
|
+
* Q
|
|
209
|
+
*/
|
|
52
210
|
Q: 81,
|
|
211
|
+
/**
|
|
212
|
+
* R
|
|
213
|
+
*/
|
|
53
214
|
R: 82,
|
|
215
|
+
/**
|
|
216
|
+
* S
|
|
217
|
+
*/
|
|
54
218
|
S: 83,
|
|
219
|
+
/**
|
|
220
|
+
* T
|
|
221
|
+
*/
|
|
55
222
|
T: 84,
|
|
223
|
+
/**
|
|
224
|
+
* U
|
|
225
|
+
*/
|
|
56
226
|
U: 85,
|
|
227
|
+
/**
|
|
228
|
+
* V
|
|
229
|
+
*/
|
|
57
230
|
V: 86,
|
|
231
|
+
/**
|
|
232
|
+
* W
|
|
233
|
+
*/
|
|
58
234
|
W: 87,
|
|
235
|
+
/**
|
|
236
|
+
* X
|
|
237
|
+
*/
|
|
59
238
|
X: 88,
|
|
239
|
+
/**
|
|
240
|
+
* Y
|
|
241
|
+
*/
|
|
60
242
|
Y: 89,
|
|
243
|
+
/**
|
|
244
|
+
* Z
|
|
245
|
+
*/
|
|
61
246
|
Z: 90,
|
|
247
|
+
/**
|
|
248
|
+
* META
|
|
249
|
+
*/
|
|
62
250
|
META: 91,
|
|
251
|
+
/**
|
|
252
|
+
* WIN_KEY_RIGHT
|
|
253
|
+
*/
|
|
63
254
|
WIN_KEY_RIGHT: 92,
|
|
255
|
+
/**
|
|
256
|
+
* CONTEXT_MENU
|
|
257
|
+
*/
|
|
64
258
|
CONTEXT_MENU: 93,
|
|
259
|
+
/**
|
|
260
|
+
* NUM_ZERO
|
|
261
|
+
*/
|
|
65
262
|
NUM_ZERO: 96,
|
|
263
|
+
/**
|
|
264
|
+
* NUM_ONE
|
|
265
|
+
*/
|
|
66
266
|
NUM_ONE: 97,
|
|
267
|
+
/**
|
|
268
|
+
* NUM_TWO
|
|
269
|
+
*/
|
|
67
270
|
NUM_TWO: 98,
|
|
271
|
+
/**
|
|
272
|
+
* NUM_THREE
|
|
273
|
+
*/
|
|
68
274
|
NUM_THREE: 99,
|
|
275
|
+
/**
|
|
276
|
+
* NUM_FOUR
|
|
277
|
+
*/
|
|
69
278
|
NUM_FOUR: 100,
|
|
279
|
+
/**
|
|
280
|
+
* NUM_FIVE
|
|
281
|
+
*/
|
|
70
282
|
NUM_FIVE: 101,
|
|
283
|
+
/**
|
|
284
|
+
* NUM_SIX
|
|
285
|
+
*/
|
|
71
286
|
NUM_SIX: 102,
|
|
287
|
+
/**
|
|
288
|
+
* NUM_SEVEN
|
|
289
|
+
*/
|
|
72
290
|
NUM_SEVEN: 103,
|
|
291
|
+
/**
|
|
292
|
+
* NUM_EIGHT
|
|
293
|
+
*/
|
|
73
294
|
NUM_EIGHT: 104,
|
|
295
|
+
/**
|
|
296
|
+
* NUM_NINE
|
|
297
|
+
*/
|
|
74
298
|
NUM_NINE: 105,
|
|
299
|
+
/**
|
|
300
|
+
* NUM_MULTIPLY
|
|
301
|
+
*/
|
|
75
302
|
NUM_MULTIPLY: 106,
|
|
303
|
+
/**
|
|
304
|
+
* NUM_PLUS
|
|
305
|
+
*/
|
|
76
306
|
NUM_PLUS: 107,
|
|
307
|
+
/**
|
|
308
|
+
* NUM_MINUS
|
|
309
|
+
*/
|
|
77
310
|
NUM_MINUS: 109,
|
|
311
|
+
/**
|
|
312
|
+
* NUM_PERIOD
|
|
313
|
+
*/
|
|
78
314
|
NUM_PERIOD: 110,
|
|
315
|
+
/**
|
|
316
|
+
* NUM_DIVISION
|
|
317
|
+
*/
|
|
79
318
|
NUM_DIVISION: 111,
|
|
319
|
+
/**
|
|
320
|
+
* F1
|
|
321
|
+
*/
|
|
80
322
|
F1: 112,
|
|
323
|
+
/**
|
|
324
|
+
* F2
|
|
325
|
+
*/
|
|
81
326
|
F2: 113,
|
|
327
|
+
/**
|
|
328
|
+
* F3
|
|
329
|
+
*/
|
|
82
330
|
F3: 114,
|
|
331
|
+
/**
|
|
332
|
+
* F4
|
|
333
|
+
*/
|
|
83
334
|
F4: 115,
|
|
335
|
+
/**
|
|
336
|
+
* F5
|
|
337
|
+
*/
|
|
84
338
|
F5: 116,
|
|
339
|
+
/**
|
|
340
|
+
* F6
|
|
341
|
+
*/
|
|
85
342
|
F6: 117,
|
|
343
|
+
/**
|
|
344
|
+
* F7
|
|
345
|
+
*/
|
|
86
346
|
F7: 118,
|
|
347
|
+
/**
|
|
348
|
+
* F8
|
|
349
|
+
*/
|
|
87
350
|
F8: 119,
|
|
351
|
+
/**
|
|
352
|
+
* F9
|
|
353
|
+
*/
|
|
88
354
|
F9: 120,
|
|
355
|
+
/**
|
|
356
|
+
* F10
|
|
357
|
+
*/
|
|
89
358
|
F10: 121,
|
|
359
|
+
/**
|
|
360
|
+
* F11
|
|
361
|
+
*/
|
|
90
362
|
F11: 122,
|
|
363
|
+
/**
|
|
364
|
+
* F12
|
|
365
|
+
*/
|
|
91
366
|
F12: 123,
|
|
367
|
+
/**
|
|
368
|
+
* NUMLOCK
|
|
369
|
+
*/
|
|
92
370
|
NUMLOCK: 144,
|
|
371
|
+
/**
|
|
372
|
+
* SEMICOLON
|
|
373
|
+
*/
|
|
93
374
|
SEMICOLON: 186,
|
|
375
|
+
/**
|
|
376
|
+
* DASH
|
|
377
|
+
*/
|
|
94
378
|
DASH: 189,
|
|
379
|
+
/**
|
|
380
|
+
* EQUALS
|
|
381
|
+
*/
|
|
95
382
|
EQUALS: 187,
|
|
383
|
+
/**
|
|
384
|
+
* COMMA
|
|
385
|
+
*/
|
|
96
386
|
COMMA: 188,
|
|
387
|
+
/**
|
|
388
|
+
* PERIOD
|
|
389
|
+
*/
|
|
97
390
|
PERIOD: 190,
|
|
391
|
+
/**
|
|
392
|
+
* SLASH
|
|
393
|
+
*/
|
|
98
394
|
SLASH: 191,
|
|
395
|
+
/**
|
|
396
|
+
* APOSTROPHE
|
|
397
|
+
*/
|
|
99
398
|
APOSTROPHE: 192,
|
|
399
|
+
/**
|
|
400
|
+
* SINGLE_QUOTE
|
|
401
|
+
*/
|
|
100
402
|
SINGLE_QUOTE: 222,
|
|
403
|
+
/**
|
|
404
|
+
* OPEN_SQUARE_BRACKET
|
|
405
|
+
*/
|
|
101
406
|
OPEN_SQUARE_BRACKET: 219,
|
|
407
|
+
/**
|
|
408
|
+
* BACKSLASH
|
|
409
|
+
*/
|
|
102
410
|
BACKSLASH: 220,
|
|
411
|
+
/**
|
|
412
|
+
* CLOSE_SQUARE_BRACKET
|
|
413
|
+
*/
|
|
103
414
|
CLOSE_SQUARE_BRACKET: 221,
|
|
415
|
+
/**
|
|
416
|
+
* WIN_KEY
|
|
417
|
+
*/
|
|
104
418
|
WIN_KEY: 224,
|
|
419
|
+
/**
|
|
420
|
+
* MAC_FF_META
|
|
421
|
+
*/
|
|
105
422
|
MAC_FF_META: 224,
|
|
423
|
+
/**
|
|
424
|
+
* WIN_IME
|
|
425
|
+
*/
|
|
106
426
|
WIN_IME: 229,
|
|
427
|
+
/**
|
|
428
|
+
* whether text and modified key is entered at the same time.
|
|
429
|
+
*/
|
|
107
430
|
isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e) {
|
|
108
431
|
const { keyCode } = e;
|
|
109
432
|
if (e.altKey && !e.ctrlKey || e.metaKey || keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) return false;
|
|
@@ -134,6 +457,9 @@ var KeyCode = {
|
|
|
134
457
|
default: return true;
|
|
135
458
|
}
|
|
136
459
|
},
|
|
460
|
+
/**
|
|
461
|
+
* whether character is entered.
|
|
462
|
+
*/
|
|
137
463
|
isCharacterKey: function isCharacterKey(keyCode) {
|
|
138
464
|
if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) return true;
|
|
139
465
|
if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) return true;
|
|
@@ -161,8 +487,7 @@ var KeyCode = {
|
|
|
161
487
|
}
|
|
162
488
|
}
|
|
163
489
|
};
|
|
164
|
-
var
|
|
165
|
-
const KeyCodeStr = {
|
|
490
|
+
var KeyCodeStr = {
|
|
166
491
|
Enter: "Enter",
|
|
167
492
|
Backspace: "Backspace",
|
|
168
493
|
Tab: "Tab",
|
|
@@ -242,4 +567,5 @@ const KeyCodeStr = {
|
|
|
242
567
|
BracketRight: "]",
|
|
243
568
|
Quote: "'"
|
|
244
569
|
};
|
|
245
|
-
|
|
570
|
+
//#endregion
|
|
571
|
+
export { KeyCodeStr, KeyCode as default };
|
package/dist/Portal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import canUseDom from "./Dom/canUseDom.js";
|
|
2
2
|
import { Teleport, createVNode, defineComponent, onBeforeUnmount, onMounted, onUnmounted, shallowRef } from "vue";
|
|
3
|
-
|
|
3
|
+
//#region src/Portal.tsx
|
|
4
|
+
var Portal = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
4
5
|
const parentRef = shallowRef();
|
|
5
6
|
const containerRef = shallowRef();
|
|
6
7
|
const initRef = shallowRef(false);
|
|
@@ -31,10 +32,10 @@ var Portal_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
31
32
|
},
|
|
32
33
|
getContainer: {
|
|
33
34
|
type: Function,
|
|
34
|
-
required: true
|
|
35
|
-
default: void 0
|
|
35
|
+
required: true
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
inheritAttrs: false
|
|
39
39
|
});
|
|
40
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Portal as default };
|
package/dist/PortalWrapper.d.ts
CHANGED
|
@@ -23,6 +23,6 @@ interface PortalWrapperEmits {
|
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
}
|
|
25
25
|
declare const PortalWrapper: import('vue').DefineSetupFnComponent<PortalWrapperProps, PortalWrapperEmits, DefaultSlotInfo, PortalWrapperProps & {
|
|
26
|
-
[x: `on${Capitalize<string>}`]: (...args: any
|
|
26
|
+
[x: `on${Capitalize<string>}`]: (...args: any) => any;
|
|
27
27
|
}, import('vue').PublicProps>;
|
|
28
28
|
export default PortalWrapper;
|
package/dist/PortalWrapper.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import canUseDom from "./Dom/canUseDom.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import Portal from "./Portal.js";
|
|
3
|
+
import setStyle from "./setStyle.js";
|
|
4
4
|
import ScrollLocker from "./Dom/scrollLocker.js";
|
|
5
|
-
import
|
|
5
|
+
import wrapperRaf from "./raf.js";
|
|
6
6
|
import { createVNode, defineComponent, onBeforeUnmount, onMounted, onUpdated, shallowRef } from "vue";
|
|
7
|
+
//#region src/PortalWrapper.tsx
|
|
7
8
|
var openCount = 0;
|
|
8
9
|
var supportDom = canUseDom();
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
9
13
|
function getOpenCount() {
|
|
10
14
|
return process.env.NODE_ENV === "test" ? openCount : 0;
|
|
11
15
|
}
|
|
@@ -19,7 +23,7 @@ function getParent(getContainer) {
|
|
|
19
23
|
}
|
|
20
24
|
return document.body;
|
|
21
25
|
}
|
|
22
|
-
var
|
|
26
|
+
var PortalWrapper = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
23
27
|
const container = shallowRef();
|
|
24
28
|
const componentRef = shallowRef();
|
|
25
29
|
const rafId = shallowRef();
|
|
@@ -29,12 +33,12 @@ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
29
33
|
};
|
|
30
34
|
const updateOpenCount = (prevProps) => {
|
|
31
35
|
const { visible: prevVisible, getContainer: prevGetContainer } = prevProps || {};
|
|
32
|
-
const { visible, getContainer
|
|
33
|
-
if (visible !== prevVisible && supportDom && getParent(getContainer
|
|
36
|
+
const { visible, getContainer } = props;
|
|
37
|
+
if (visible !== prevVisible && supportDom && getParent(getContainer) === document.body) {
|
|
34
38
|
if (visible && !prevVisible) openCount += 1;
|
|
35
39
|
else if (prevProps) openCount -= 1;
|
|
36
40
|
}
|
|
37
|
-
if (typeof getContainer
|
|
41
|
+
if (typeof getContainer === "function" && typeof prevGetContainer === "function" ? getContainer.toString() !== prevGetContainer.toString() : getContainer !== prevGetContainer) removeCurrentContainer();
|
|
38
42
|
};
|
|
39
43
|
const attachToParent = (force = false) => {
|
|
40
44
|
if (force || container.value && !container.value.parentNode) {
|
|
@@ -63,7 +67,7 @@ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
63
67
|
onMounted(() => {
|
|
64
68
|
scrollLocker.value = new ScrollLocker({ container: getParent(props.getContainer) });
|
|
65
69
|
updateOpenCount();
|
|
66
|
-
if (!attachToParent()) rafId.value =
|
|
70
|
+
if (!attachToParent()) rafId.value = wrapperRaf(() => {});
|
|
67
71
|
});
|
|
68
72
|
onUpdated(() => {
|
|
69
73
|
updateOpenCount(props);
|
|
@@ -72,21 +76,29 @@ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
72
76
|
attachToParent();
|
|
73
77
|
});
|
|
74
78
|
onBeforeUnmount(() => {
|
|
75
|
-
const { visible, getContainer
|
|
76
|
-
if (supportDom && getParent(getContainer
|
|
79
|
+
const { visible, getContainer } = props;
|
|
80
|
+
if (supportDom && getParent(getContainer) === document.body) openCount = visible && openCount ? openCount - 1 : openCount;
|
|
77
81
|
removeCurrentContainer();
|
|
78
|
-
|
|
82
|
+
wrapperRaf.cancel(rafId.value);
|
|
79
83
|
});
|
|
84
|
+
/**
|
|
85
|
+
* Enhance ./switchScrollingEffect
|
|
86
|
+
* 1. Simulate document body scroll bar with
|
|
87
|
+
* 2. Record body has overflow style and recover when all of PortalWrapper invisible
|
|
88
|
+
* 3. Disable body scroll when PortalWrapper has open
|
|
89
|
+
*
|
|
90
|
+
* @memberof PortalWrapper
|
|
91
|
+
*/
|
|
80
92
|
const switchScrollingEffect = () => {
|
|
81
93
|
if (openCount === 1 && !Object.keys(cacheOverflow).length) {
|
|
82
94
|
switchScrollingEffect();
|
|
83
|
-
cacheOverflow =
|
|
95
|
+
cacheOverflow = setStyle({
|
|
84
96
|
overflow: "hidden",
|
|
85
97
|
overflowX: "hidden",
|
|
86
98
|
overflowY: "hidden"
|
|
87
99
|
});
|
|
88
100
|
} else if (!openCount) {
|
|
89
|
-
|
|
101
|
+
setStyle(cacheOverflow);
|
|
90
102
|
cacheOverflow = {};
|
|
91
103
|
switchScrollingEffect();
|
|
92
104
|
}
|
|
@@ -100,7 +112,7 @@ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
100
112
|
switchScrollingEffect,
|
|
101
113
|
scrollLocker: scrollLocker.value
|
|
102
114
|
};
|
|
103
|
-
if (forceRender || visible || componentRef.value) portal = createVNode(
|
|
115
|
+
if (forceRender || visible || componentRef.value) portal = createVNode(Portal, {
|
|
104
116
|
"getContainer": getContainer,
|
|
105
117
|
"ref": componentRef
|
|
106
118
|
}, { default: () => [ctx?.slots?.default(childProps)] });
|
|
@@ -129,4 +141,5 @@ var PortalWrapper_default = /* @__PURE__ */ defineComponent((props, ctx) => {
|
|
|
129
141
|
default: void 0
|
|
130
142
|
}
|
|
131
143
|
} });
|
|
132
|
-
|
|
144
|
+
//#endregion
|
|
145
|
+
export { PortalWrapper as default, getOpenCount };
|
package/dist/RenderComponent.js
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { filterEmpty } from "./props-util/index.js";
|
|
2
2
|
import { createVNode, defineComponent, isVNode } from "vue";
|
|
3
|
+
//#region src/RenderComponent.ts
|
|
3
4
|
function checkIsBaseType(value) {
|
|
4
5
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return true;
|
|
5
6
|
return typeof value === "undefined" || value === null;
|
|
6
7
|
}
|
|
7
8
|
var RenderComponent_default = defineComponent((props, { attrs }) => {
|
|
8
9
|
return () => {
|
|
9
|
-
const render
|
|
10
|
-
if (render
|
|
11
|
-
const _render = render
|
|
10
|
+
const render = props.render;
|
|
11
|
+
if (render && typeof render === "function") {
|
|
12
|
+
const _render = render?.();
|
|
12
13
|
if (Array.isArray(_render)) return filterEmpty(_render).map((v) => {
|
|
13
14
|
if (isVNode(v)) return createVNode(v, { ...attrs });
|
|
14
15
|
else return v;
|
|
15
16
|
});
|
|
16
17
|
return _render;
|
|
17
|
-
} else if (Array.isArray(render
|
|
18
|
+
} else if (Array.isArray(render)) return filterEmpty(render).map((v) => {
|
|
18
19
|
if (isVNode(v)) return createVNode(v, { ...attrs });
|
|
19
20
|
return v;
|
|
20
21
|
});
|
|
21
|
-
else if (checkIsBaseType(render
|
|
22
|
-
if (isVNode(render
|
|
23
|
-
return render
|
|
22
|
+
else if (checkIsBaseType(render)) return render;
|
|
23
|
+
if (isVNode(render)) return createVNode(render, { ...attrs });
|
|
24
|
+
return render;
|
|
24
25
|
};
|
|
25
26
|
}, {
|
|
26
27
|
inheritAttrs: false,
|
|
27
28
|
name: "RenderComponent",
|
|
28
29
|
props: ["render"]
|
|
29
30
|
});
|
|
31
|
+
//#endregion
|
|
30
32
|
export { RenderComponent_default as default };
|
package/dist/classnames.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/classnames.ts
|
|
1
2
|
function toVal(mix) {
|
|
2
3
|
let str = "";
|
|
3
4
|
if (typeof mix === "string" || typeof mix === "number") str += mix;
|
|
@@ -31,5 +32,6 @@ function classNames(...args) {
|
|
|
31
32
|
}
|
|
32
33
|
return str;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
var clsx = classNames;
|
|
36
|
+
//#endregion
|
|
35
37
|
export { clsx, classNames as default };
|
package/dist/composeProps.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/composeProps.ts
|
|
1
2
|
function composeProps(originProps, patchProps, isAll) {
|
|
2
3
|
const composedProps = {
|
|
3
4
|
...originProps,
|
|
@@ -12,5 +13,5 @@ function composeProps(originProps, patchProps, isAll) {
|
|
|
12
13
|
});
|
|
13
14
|
return composedProps;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
export {
|
|
16
|
+
//#endregion
|
|
17
|
+
export { composeProps as default };
|
package/dist/createRef.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/createRef.ts
|
|
1
2
|
function createRef() {
|
|
2
3
|
const func = (node) => {
|
|
3
4
|
func.current = node;
|
|
@@ -8,6 +9,9 @@ function fillRef(ref, node) {
|
|
|
8
9
|
if (typeof ref === "function") ref(node);
|
|
9
10
|
else if (typeof ref === "object" && ref && "current" in ref) ref.current = node;
|
|
10
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Merge refs into one ref function to support ref passing.
|
|
14
|
+
*/
|
|
11
15
|
function composeRef(...refs) {
|
|
12
16
|
return (node) => {
|
|
13
17
|
refs.forEach((ref) => {
|
|
@@ -15,5 +19,5 @@ function composeRef(...refs) {
|
|
|
15
19
|
});
|
|
16
20
|
};
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
export { composeRef,
|
|
22
|
+
//#endregion
|
|
23
|
+
export { composeRef, createRef as default, fillRef };
|
package/dist/debug/diff.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/debug/diff.ts
|
|
1
2
|
function createArray() {
|
|
2
3
|
const arr = [];
|
|
3
4
|
arr.__proto__ = [];
|
|
@@ -14,7 +15,7 @@ function createArray() {
|
|
|
14
15
|
}
|
|
15
16
|
function diff(obj1, obj2, depth = 10, path = [], diffList = createArray()) {
|
|
16
17
|
if (depth <= 0) return diffList;
|
|
17
|
-
new Set([...Object.keys(obj1), ...Object.keys(obj2)]).forEach((key) => {
|
|
18
|
+
(/* @__PURE__ */ new Set([...Object.keys(obj1), ...Object.keys(obj2)])).forEach((key) => {
|
|
18
19
|
const value1 = obj1[key];
|
|
19
20
|
const value2 = obj2[key];
|
|
20
21
|
if (value1 === value2) return;
|
|
@@ -40,4 +41,5 @@ function diff(obj1, obj2, depth = 10, path = [], diffList = createArray()) {
|
|
|
40
41
|
});
|
|
41
42
|
return diffList;
|
|
42
43
|
}
|
|
44
|
+
//#endregion
|
|
43
45
|
export { diff as default };
|
package/dist/deprecated.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
//#region src/deprecated.ts
|
|
1
2
|
function deprecated(props, instead, component) {
|
|
2
3
|
if (typeof window !== "undefined" && window.console && window.console.error) window.console.error(`Warning: ${props} is deprecated at [ ${component} ], use [ ${instead} ] instead of it.`);
|
|
3
4
|
}
|
|
5
|
+
//#endregion
|
|
4
6
|
export { deprecated as default };
|