@whitesev/pops 3.3.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +58 -25
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +58 -25
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +58 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +58 -25
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +58 -25
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +58 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/components/folder/types/index.d.ts +15 -14
- package/package.json +1 -1
- package/src/components/folder/index.ts +58 -33
- package/src/components/folder/types/index.ts +26 -20
package/dist/index.iife.js
CHANGED
|
@@ -5351,10 +5351,13 @@ var pops = (function () {
|
|
|
5351
5351
|
</div>`);
|
|
5352
5352
|
// 存储原来的值
|
|
5353
5353
|
Reflect.set($fileName, "__value__", folderData);
|
|
5354
|
-
Reflect.set($folder, "
|
|
5354
|
+
Reflect.set($folder, "__value__", folderData);
|
|
5355
5355
|
$folder.appendChild($fileName);
|
|
5356
5356
|
return {
|
|
5357
5357
|
folderElement: $folder,
|
|
5358
|
+
/**
|
|
5359
|
+
* 超链接标签的容器
|
|
5360
|
+
*/
|
|
5358
5361
|
fileNameElement: $fileName,
|
|
5359
5362
|
};
|
|
5360
5363
|
}
|
|
@@ -5443,8 +5446,17 @@ var pops = (function () {
|
|
|
5443
5446
|
},
|
|
5444
5447
|
addIndexCSS: false,
|
|
5445
5448
|
});
|
|
5449
|
+
let childConfig;
|
|
5446
5450
|
if (typeof dataConfig.clickEvent === "function") {
|
|
5447
|
-
const
|
|
5451
|
+
const result = await dataConfig.clickEvent(clickEvent, dataConfig);
|
|
5452
|
+
if (Array.isArray(result)) {
|
|
5453
|
+
childConfig = result;
|
|
5454
|
+
}
|
|
5455
|
+
}
|
|
5456
|
+
else if (Array.isArray(dataConfig.clickEvent)) {
|
|
5457
|
+
childConfig = dataConfig.clickEvent;
|
|
5458
|
+
}
|
|
5459
|
+
if (childConfig) {
|
|
5448
5460
|
// 添加顶部导航的箭头
|
|
5449
5461
|
folderFileListBreadcrumbPrimaryElement.appendChild(this.createHeaderArrowIcon());
|
|
5450
5462
|
// 添加顶部导航的链接文字
|
|
@@ -5458,50 +5470,65 @@ var pops = (function () {
|
|
|
5458
5470
|
}
|
|
5459
5471
|
loadingMask.close();
|
|
5460
5472
|
}
|
|
5473
|
+
/**
|
|
5474
|
+
* 更新文件的显示的链接信息
|
|
5475
|
+
*
|
|
5476
|
+
* 这里主要用于鼠标中键或者右键触发,左键触发方式会根据mode进行处理
|
|
5477
|
+
* @returns 更新的文件的下载链接
|
|
5478
|
+
*/
|
|
5479
|
+
updateFileLink($row, downloadInfo) {
|
|
5480
|
+
const downloadUrl = typeof downloadInfo?.url === "string" ? downloadInfo.url.trim() : "";
|
|
5481
|
+
if (downloadUrl !== "" && downloadUrl !== "null" && downloadUrl !== "undefined") {
|
|
5482
|
+
const $link = $row.querySelector("a");
|
|
5483
|
+
$link.setAttribute("href", downloadUrl);
|
|
5484
|
+
return downloadUrl;
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5461
5487
|
/**
|
|
5462
5488
|
* 文件的点击事件 - 下载文件
|
|
5463
|
-
* @param
|
|
5489
|
+
* @param evt 点击事件
|
|
5490
|
+
* @param $row 列表项
|
|
5464
5491
|
* @param dataConfig
|
|
5465
5492
|
*/
|
|
5466
|
-
async
|
|
5467
|
-
|
|
5468
|
-
const $link = $row.querySelector("a");
|
|
5493
|
+
async onFileClick(evt, $row, dataConfig) {
|
|
5494
|
+
let downloadInfo;
|
|
5469
5495
|
if (typeof dataConfig.clickEvent === "function") {
|
|
5470
|
-
const
|
|
5471
|
-
if (
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5496
|
+
const result = await dataConfig.clickEvent(evt, dataConfig);
|
|
5497
|
+
if (typeof result === "object" && result != null && !Array.isArray(result)) {
|
|
5498
|
+
downloadInfo = result;
|
|
5499
|
+
}
|
|
5500
|
+
}
|
|
5501
|
+
else if (typeof dataConfig.clickEvent === "object" &&
|
|
5502
|
+
dataConfig.clickEvent != null &&
|
|
5503
|
+
!Array.isArray(dataConfig.clickEvent)) {
|
|
5504
|
+
downloadInfo = dataConfig.clickEvent;
|
|
5505
|
+
}
|
|
5506
|
+
if (downloadInfo) {
|
|
5507
|
+
const downloadUrl = this.updateFileLink($row, downloadInfo);
|
|
5508
|
+
if (downloadUrl) {
|
|
5509
|
+
if (typeof downloadInfo.mode === "string") {
|
|
5483
5510
|
if (downloadInfo.mode === "a" || downloadInfo.mode === "aBlank") {
|
|
5484
5511
|
// a标签下载
|
|
5485
5512
|
const $anchor = popsDOMUtils.createElement("a");
|
|
5486
5513
|
if (downloadInfo.mode === "aBlank") {
|
|
5487
5514
|
$anchor.setAttribute("target", "_blank");
|
|
5488
5515
|
}
|
|
5489
|
-
$anchor.href =
|
|
5516
|
+
$anchor.href = downloadUrl;
|
|
5490
5517
|
$anchor.click();
|
|
5491
5518
|
}
|
|
5492
5519
|
else if (downloadInfo.mode === "open" || downloadInfo.mode === "openBlank") {
|
|
5493
5520
|
// window.open下载
|
|
5494
5521
|
if (downloadInfo.mode === "openBlank") {
|
|
5495
|
-
globalThis.open(
|
|
5522
|
+
globalThis.open(downloadUrl, "_blank");
|
|
5496
5523
|
}
|
|
5497
5524
|
else {
|
|
5498
|
-
globalThis.open(
|
|
5525
|
+
globalThis.open(downloadUrl);
|
|
5499
5526
|
}
|
|
5500
5527
|
}
|
|
5501
5528
|
else if (downloadInfo.mode === "iframe") {
|
|
5502
5529
|
// iframe下载
|
|
5503
5530
|
const $downloadIframe = popsDOMUtils.createElement("iframe");
|
|
5504
|
-
$downloadIframe.src =
|
|
5531
|
+
$downloadIframe.src = downloadUrl;
|
|
5505
5532
|
$downloadIframe.onload = function () {
|
|
5506
5533
|
popsUtils.setTimeout(() => {
|
|
5507
5534
|
$downloadIframe.remove();
|
|
@@ -5683,8 +5710,14 @@ var pops = (function () {
|
|
|
5683
5710
|
// 文件 - 点击事件
|
|
5684
5711
|
popsDOMUtils.on(fileNameElement, "click", (event) => {
|
|
5685
5712
|
// 下载文件
|
|
5686
|
-
|
|
5713
|
+
popsDOMUtils.preventEvent(event);
|
|
5714
|
+
this.onFileClick(event, fileNameElement, item);
|
|
5687
5715
|
});
|
|
5716
|
+
// 如果clickEvent不是函数,那么现在就可以进行配置
|
|
5717
|
+
if (typeof item.clickEvent === "object" && item.clickEvent !== null && !Array.isArray(item.clickEvent)) {
|
|
5718
|
+
// {} 单文件配置
|
|
5719
|
+
this.updateFileLink(fileNameElement, item.clickEvent);
|
|
5720
|
+
}
|
|
5688
5721
|
folderListBodyElement.appendChild(folderElement);
|
|
5689
5722
|
}
|
|
5690
5723
|
});
|
|
@@ -13369,7 +13402,7 @@ var pops = (function () {
|
|
|
13369
13402
|
},
|
|
13370
13403
|
};
|
|
13371
13404
|
|
|
13372
|
-
const version = "3.3.
|
|
13405
|
+
const version = "3.3.4";
|
|
13373
13406
|
|
|
13374
13407
|
class Pops {
|
|
13375
13408
|
/** 配置 */
|