@whitesev/pops 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +364 -357
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +364 -357
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +364 -357
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +364 -357
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +364 -357
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +364 -357
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +17 -17
- package/dist/types/src/PopsInst.d.ts +8 -0
- package/dist/types/src/components/panel/index.d.ts +2 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
- package/dist/types/src/handler/PopsHandler.d.ts +6 -6
- package/dist/types/src/types/button.d.ts +2 -2
- package/dist/types/src/types/components.d.ts +5 -5
- package/dist/types/src/types/event.d.ts +3 -3
- package/dist/types/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/dist/types/src/types/main.d.ts +36 -58
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +10 -10
- package/package.json +1 -1
- package/src/Pops.ts +2 -2
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/index.ts +16 -16
- package/src/components/confirm/index.ts +16 -15
- package/src/components/drawer/index.ts +16 -15
- package/src/components/folder/index.ts +141 -152
- package/src/components/iframe/index.ts +16 -15
- package/src/components/panel/index.ts +19 -18
- package/src/components/prompt/index.ts +15 -14
- package/src/components/rightClickMenu/index.ts +19 -18
- package/src/components/searchSuggestion/index.ts +21 -20
- package/src/components/tooltip/index.ts +3 -2
- package/src/css/scrollbar.css +9 -5
- package/src/handler/PopsElementHandler.ts +18 -18
- package/src/handler/PopsHandler.ts +38 -32
- package/src/types/button.d.ts +2 -2
- package/src/types/components.d.ts +5 -5
- package/src/types/event.d.ts +3 -3
- package/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/src/types/main.d.ts +36 -58
- package/src/utils/PopsInstanceUtils.ts +84 -81
- package/dist/types/src/PopsLayer.d.ts +0 -5
- package/src/PopsLayer.ts +0 -18
|
@@ -6,12 +6,12 @@ import type { PopsIframeDetails } from "../components/iframe/types";
|
|
|
6
6
|
import type { PopsLoadingDetails } from "../components/loading/types";
|
|
7
7
|
import type { PopsPanelDetails } from "../components/panel/types";
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/types/index";
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
9
|
+
import type { PopsInstCommonConfig } from "../types/inst";
|
|
10
|
+
import type { PopsInstStoreType } from "../types/main";
|
|
11
11
|
import { popsDOMUtils } from "./PopsDOMUtils";
|
|
12
12
|
import { popsUtils } from "./PopsUtils";
|
|
13
13
|
import { PopsCore } from "../PopsCore";
|
|
14
|
-
import {
|
|
14
|
+
import { PopsInstData } from "../PopsInst";
|
|
15
15
|
import { PopsAnimation } from "../PopsAnimation";
|
|
16
16
|
|
|
17
17
|
export const PopsInstanceUtils = {
|
|
@@ -121,18 +121,18 @@ export const PopsInstanceUtils = {
|
|
|
121
121
|
function isVisibleNode($css: CSSStyleDeclaration): boolean {
|
|
122
122
|
return $css.position !== "static" && $css.display !== "none";
|
|
123
123
|
}
|
|
124
|
-
Object.keys(
|
|
125
|
-
let
|
|
126
|
-
for (let index = 0; index <
|
|
127
|
-
const
|
|
128
|
-
let nodeStyle = window.getComputedStyle(
|
|
124
|
+
Object.keys(PopsInstData).forEach((instKeyName) => {
|
|
125
|
+
let instData = PopsInstData[instKeyName as PopsInstStoreType];
|
|
126
|
+
for (let index = 0; index < instData.length; index++) {
|
|
127
|
+
const inst = instData[index];
|
|
128
|
+
let nodeStyle = window.getComputedStyle(inst.animElement);
|
|
129
129
|
/* 不对position为static和display为none的元素进行获取它们的z-index */
|
|
130
130
|
if (isVisibleNode(nodeStyle)) {
|
|
131
131
|
let nodeZIndex = parseInt(nodeStyle.zIndex);
|
|
132
132
|
if (!isNaN(nodeZIndex)) {
|
|
133
133
|
if (nodeZIndex > zIndex) {
|
|
134
134
|
zIndex = nodeZIndex;
|
|
135
|
-
maxZIndexNode =
|
|
135
|
+
maxZIndexNode = inst.animElement;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}
|
|
@@ -158,85 +158,85 @@ export const PopsInstanceUtils = {
|
|
|
158
158
|
},
|
|
159
159
|
/**
|
|
160
160
|
* 删除配置中对应的对象
|
|
161
|
-
* @param
|
|
161
|
+
* @param instConfigList 配置实例列表
|
|
162
162
|
* @param guid 唯一标识
|
|
163
163
|
* @param isAll 是否全部删除
|
|
164
164
|
*/
|
|
165
165
|
removeInstance(
|
|
166
|
-
|
|
166
|
+
instConfigList: PopsInstCommonConfig[][],
|
|
167
167
|
guid: string,
|
|
168
168
|
isAll = false
|
|
169
169
|
) {
|
|
170
170
|
/**
|
|
171
171
|
* 移除元素实例
|
|
172
|
-
* @param
|
|
172
|
+
* @param instCommonConfig
|
|
173
173
|
*/
|
|
174
|
-
function removeItem(
|
|
175
|
-
if (typeof
|
|
174
|
+
function removeItem(instCommonConfig: PopsInstCommonConfig) {
|
|
175
|
+
if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
|
|
176
176
|
// 调用移除签的回调
|
|
177
|
-
|
|
177
|
+
instCommonConfig.beforeRemoveCallBack(instCommonConfig);
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
instCommonConfig?.animElement?.remove();
|
|
180
|
+
instCommonConfig?.popsElement?.remove();
|
|
181
|
+
instCommonConfig?.maskElement?.remove();
|
|
182
|
+
instCommonConfig?.$shadowContainer?.remove();
|
|
183
183
|
}
|
|
184
|
-
// [
|
|
185
|
-
|
|
186
|
-
//
|
|
187
|
-
|
|
184
|
+
// [ inst[], inst[],...]
|
|
185
|
+
instConfigList.forEach((instConfigList) => {
|
|
186
|
+
// inst[]
|
|
187
|
+
instConfigList.forEach((instConfigItem, index) => {
|
|
188
188
|
// 移除全部或者guid相同
|
|
189
|
-
if (isAll ||
|
|
189
|
+
if (isAll || instConfigItem["guid"] === guid) {
|
|
190
190
|
// 判断是否有动画
|
|
191
|
-
let animName =
|
|
191
|
+
let animName = instConfigItem.animElement.getAttribute(
|
|
192
192
|
"anim"
|
|
193
193
|
) as string;
|
|
194
194
|
if (PopsAnimation.hasAnim(animName)) {
|
|
195
195
|
let reverseAnimName = animName + "-reverse";
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
(
|
|
196
|
+
instConfigItem.animElement.style.width = "100%";
|
|
197
|
+
instConfigItem.animElement.style.height = "100%";
|
|
198
|
+
(instConfigItem.animElement.style as any)["animation-name"] =
|
|
199
199
|
reverseAnimName;
|
|
200
200
|
if (
|
|
201
201
|
PopsAnimation.hasAnim(
|
|
202
|
-
(
|
|
202
|
+
(instConfigItem.animElement.style as any)["animation-name"]
|
|
203
203
|
)
|
|
204
204
|
) {
|
|
205
205
|
popsDOMUtils.on(
|
|
206
|
-
|
|
206
|
+
instConfigItem.animElement,
|
|
207
207
|
popsDOMUtils.getAnimationEndNameList(),
|
|
208
208
|
function () {
|
|
209
|
-
removeItem(
|
|
209
|
+
removeItem(instConfigItem);
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
capture: true,
|
|
213
213
|
}
|
|
214
214
|
);
|
|
215
215
|
} else {
|
|
216
|
-
removeItem(
|
|
216
|
+
removeItem(instConfigItem);
|
|
217
217
|
}
|
|
218
218
|
} else {
|
|
219
|
-
removeItem(
|
|
219
|
+
removeItem(instConfigItem);
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
instConfigList.splice(index, 1);
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
return
|
|
226
|
+
return instConfigList;
|
|
227
227
|
},
|
|
228
228
|
/**
|
|
229
229
|
* 隐藏
|
|
230
230
|
* @param popsType
|
|
231
|
-
* @param
|
|
231
|
+
* @param instConfigList
|
|
232
232
|
* @param guid
|
|
233
233
|
* @param config
|
|
234
234
|
* @param animElement
|
|
235
235
|
* @param maskElement
|
|
236
236
|
*/
|
|
237
237
|
hide(
|
|
238
|
-
popsType:
|
|
239
|
-
|
|
238
|
+
popsType: PopsInstStoreType,
|
|
239
|
+
instConfigList: PopsInstCommonConfig[],
|
|
240
240
|
guid: string,
|
|
241
241
|
config:
|
|
242
242
|
| PopsAlertDetails
|
|
@@ -267,31 +267,33 @@ export const PopsInstanceUtils = {
|
|
|
267
267
|
resolve();
|
|
268
268
|
}, drawerConfig.closeDelay);
|
|
269
269
|
} else {
|
|
270
|
-
let
|
|
271
|
-
(
|
|
270
|
+
let fintInst = instConfigList.find(
|
|
271
|
+
(instConfigItem) => instConfigItem.guid === guid
|
|
272
272
|
);
|
|
273
|
-
if (
|
|
273
|
+
if (fintInst) {
|
|
274
274
|
/* 存在动画 */
|
|
275
|
-
let
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
275
|
+
let instConfigItem = fintInst;
|
|
276
|
+
instConfigItem.animElement.style.width = "100%";
|
|
277
|
+
instConfigItem.animElement.style.height = "100%";
|
|
278
|
+
// @ts-ignore
|
|
279
|
+
instConfigItem.animElement.style["animation-name"] =
|
|
280
|
+
instConfigItem.animElement.getAttribute("anim") + "-reverse";
|
|
280
281
|
if (
|
|
281
282
|
PopsAnimation.hasAnim(
|
|
282
|
-
|
|
283
|
+
// @ts-ignore
|
|
284
|
+
instConfigItem.animElement.style["animation-name"]
|
|
283
285
|
)
|
|
284
286
|
) {
|
|
285
287
|
/**
|
|
286
288
|
* 动画结束的回调
|
|
287
289
|
*/
|
|
288
290
|
function animationendCallBack() {
|
|
289
|
-
|
|
290
|
-
if (
|
|
291
|
-
|
|
291
|
+
instConfigItem.animElement.style.display = "none";
|
|
292
|
+
if (instConfigItem.maskElement) {
|
|
293
|
+
instConfigItem.maskElement.style.display = "none";
|
|
292
294
|
}
|
|
293
295
|
popsDOMUtils.off(
|
|
294
|
-
|
|
296
|
+
instConfigItem.animElement,
|
|
295
297
|
popsDOMUtils.getAnimationEndNameList(),
|
|
296
298
|
animationendCallBack,
|
|
297
299
|
{
|
|
@@ -301,7 +303,7 @@ export const PopsInstanceUtils = {
|
|
|
301
303
|
resolve();
|
|
302
304
|
}
|
|
303
305
|
popsDOMUtils.on(
|
|
304
|
-
|
|
306
|
+
instConfigItem.animElement,
|
|
305
307
|
popsDOMUtils.getAnimationEndNameList(),
|
|
306
308
|
animationendCallBack,
|
|
307
309
|
{
|
|
@@ -309,9 +311,9 @@ export const PopsInstanceUtils = {
|
|
|
309
311
|
}
|
|
310
312
|
);
|
|
311
313
|
} else {
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
|
|
314
|
+
instConfigItem.animElement.style.display = "none";
|
|
315
|
+
if (instConfigItem.maskElement) {
|
|
316
|
+
instConfigItem.maskElement.style.display = "none";
|
|
315
317
|
}
|
|
316
318
|
|
|
317
319
|
resolve();
|
|
@@ -323,15 +325,15 @@ export const PopsInstanceUtils = {
|
|
|
323
325
|
/**
|
|
324
326
|
* 显示
|
|
325
327
|
* @param popsType
|
|
326
|
-
* @param
|
|
328
|
+
* @param instConfigList
|
|
327
329
|
* @param guid
|
|
328
330
|
* @param config
|
|
329
331
|
* @param animElement
|
|
330
332
|
* @param maskElement
|
|
331
333
|
*/
|
|
332
334
|
show(
|
|
333
|
-
popsType:
|
|
334
|
-
|
|
335
|
+
popsType: PopsInstStoreType,
|
|
336
|
+
instConfigList: PopsInstCommonConfig[],
|
|
335
337
|
guid: string,
|
|
336
338
|
config:
|
|
337
339
|
| PopsAlertDetails
|
|
@@ -364,20 +366,21 @@ export const PopsInstanceUtils = {
|
|
|
364
366
|
resolve();
|
|
365
367
|
}, drawerConfig.openDelay ?? 0);
|
|
366
368
|
} else {
|
|
367
|
-
let
|
|
368
|
-
(
|
|
369
|
+
let fintInst = instConfigList.find(
|
|
370
|
+
(instConfigItem) => instConfigItem.guid === guid
|
|
369
371
|
);
|
|
370
|
-
if (
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
if (fintInst) {
|
|
373
|
+
let instConfigItem = fintInst;
|
|
374
|
+
instConfigItem.animElement.style.width = "";
|
|
375
|
+
instConfigItem.animElement.style.height = "";
|
|
376
|
+
// @ts-ignore
|
|
377
|
+
instConfigItem.animElement.style["animation-name"] = instConfigItem
|
|
378
|
+
.animElement!.getAttribute("anim")!
|
|
379
|
+
.replace("-reverse", "");
|
|
378
380
|
if (
|
|
379
381
|
PopsAnimation.hasAnim(
|
|
380
|
-
|
|
382
|
+
// @ts-ignore
|
|
383
|
+
instConfigItem.animElement.style["animation-name"]
|
|
381
384
|
)
|
|
382
385
|
) {
|
|
383
386
|
/**
|
|
@@ -385,7 +388,7 @@ export const PopsInstanceUtils = {
|
|
|
385
388
|
*/
|
|
386
389
|
function animationendCallBack() {
|
|
387
390
|
popsDOMUtils.off(
|
|
388
|
-
|
|
391
|
+
instConfigItem.animElement,
|
|
389
392
|
popsDOMUtils.getAnimationEndNameList(),
|
|
390
393
|
animationendCallBack,
|
|
391
394
|
{
|
|
@@ -394,12 +397,12 @@ export const PopsInstanceUtils = {
|
|
|
394
397
|
);
|
|
395
398
|
resolve();
|
|
396
399
|
}
|
|
397
|
-
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
+
instConfigItem.animElement.style.display = "";
|
|
401
|
+
if (instConfigItem.maskElement) {
|
|
402
|
+
instConfigItem.maskElement.style.display = "";
|
|
400
403
|
}
|
|
401
404
|
popsDOMUtils.on(
|
|
402
|
-
|
|
405
|
+
instConfigItem.animElement,
|
|
403
406
|
popsDOMUtils.getAnimationEndNameList(),
|
|
404
407
|
animationendCallBack,
|
|
405
408
|
{
|
|
@@ -407,9 +410,9 @@ export const PopsInstanceUtils = {
|
|
|
407
410
|
}
|
|
408
411
|
);
|
|
409
412
|
} else {
|
|
410
|
-
|
|
411
|
-
if (
|
|
412
|
-
|
|
413
|
+
instConfigItem.animElement.style.display = "";
|
|
414
|
+
if (instConfigItem.maskElement) {
|
|
415
|
+
instConfigItem.maskElement.style.display = "";
|
|
413
416
|
}
|
|
414
417
|
resolve();
|
|
415
418
|
}
|
|
@@ -420,14 +423,14 @@ export const PopsInstanceUtils = {
|
|
|
420
423
|
/**
|
|
421
424
|
* 关闭
|
|
422
425
|
* @param popsType
|
|
423
|
-
* @param
|
|
426
|
+
* @param instConfigList
|
|
424
427
|
* @param guid
|
|
425
428
|
* @param config
|
|
426
429
|
* @param animElement
|
|
427
430
|
*/
|
|
428
431
|
close(
|
|
429
432
|
popsType: string,
|
|
430
|
-
|
|
433
|
+
instConfigList: PopsInstCommonConfig[],
|
|
431
434
|
guid: string,
|
|
432
435
|
config:
|
|
433
436
|
| PopsAlertDetails
|
|
@@ -461,7 +464,7 @@ export const PopsInstanceUtils = {
|
|
|
461
464
|
void 0,
|
|
462
465
|
closeCallBack
|
|
463
466
|
);
|
|
464
|
-
PopsInstanceUtils.removeInstance([
|
|
467
|
+
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
465
468
|
resolve();
|
|
466
469
|
}
|
|
467
470
|
/* 监听过渡结束 */
|
|
@@ -498,7 +501,7 @@ export const PopsInstanceUtils = {
|
|
|
498
501
|
transitionendEvent();
|
|
499
502
|
}, drawerConfig.closeDelay);
|
|
500
503
|
} else {
|
|
501
|
-
PopsInstanceUtils.removeInstance([
|
|
504
|
+
PopsInstanceUtils.removeInstance([instConfigList], guid);
|
|
502
505
|
resolve();
|
|
503
506
|
}
|
|
504
507
|
});
|
package/src/PopsLayer.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { PopsLayerCommonConfig } from "./types/layer";
|
|
2
|
-
import type { PopsLayerMode } from "./types/main";
|
|
3
|
-
|
|
4
|
-
export const PopsLayerData: {
|
|
5
|
-
[key in PopsLayerMode]: PopsLayerCommonConfig[];
|
|
6
|
-
} = {
|
|
7
|
-
alert: [],
|
|
8
|
-
confirm: [],
|
|
9
|
-
drawer: [],
|
|
10
|
-
folder: [],
|
|
11
|
-
iframe: [],
|
|
12
|
-
loading: [],
|
|
13
|
-
panel: [],
|
|
14
|
-
prompt: [],
|
|
15
|
-
rightClickMenu: [],
|
|
16
|
-
// 没有 searchSuggestion
|
|
17
|
-
tooltip: [],
|
|
18
|
-
};
|