@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.system.js
CHANGED
|
@@ -5353,10 +5353,13 @@ System.register('pops', [], (function (exports) {
|
|
|
5353
5353
|
</div>`);
|
|
5354
5354
|
// 存储原来的值
|
|
5355
5355
|
Reflect.set($fileName, "__value__", folderData);
|
|
5356
|
-
Reflect.set($folder, "
|
|
5356
|
+
Reflect.set($folder, "__value__", folderData);
|
|
5357
5357
|
$folder.appendChild($fileName);
|
|
5358
5358
|
return {
|
|
5359
5359
|
folderElement: $folder,
|
|
5360
|
+
/**
|
|
5361
|
+
* 超链接标签的容器
|
|
5362
|
+
*/
|
|
5360
5363
|
fileNameElement: $fileName,
|
|
5361
5364
|
};
|
|
5362
5365
|
}
|
|
@@ -5445,8 +5448,17 @@ System.register('pops', [], (function (exports) {
|
|
|
5445
5448
|
},
|
|
5446
5449
|
addIndexCSS: false,
|
|
5447
5450
|
});
|
|
5451
|
+
let childConfig;
|
|
5448
5452
|
if (typeof dataConfig.clickEvent === "function") {
|
|
5449
|
-
const
|
|
5453
|
+
const result = await dataConfig.clickEvent(clickEvent, dataConfig);
|
|
5454
|
+
if (Array.isArray(result)) {
|
|
5455
|
+
childConfig = result;
|
|
5456
|
+
}
|
|
5457
|
+
}
|
|
5458
|
+
else if (Array.isArray(dataConfig.clickEvent)) {
|
|
5459
|
+
childConfig = dataConfig.clickEvent;
|
|
5460
|
+
}
|
|
5461
|
+
if (childConfig) {
|
|
5450
5462
|
// 添加顶部导航的箭头
|
|
5451
5463
|
folderFileListBreadcrumbPrimaryElement.appendChild(this.createHeaderArrowIcon());
|
|
5452
5464
|
// 添加顶部导航的链接文字
|
|
@@ -5460,50 +5472,65 @@ System.register('pops', [], (function (exports) {
|
|
|
5460
5472
|
}
|
|
5461
5473
|
loadingMask.close();
|
|
5462
5474
|
}
|
|
5475
|
+
/**
|
|
5476
|
+
* 更新文件的显示的链接信息
|
|
5477
|
+
*
|
|
5478
|
+
* 这里主要用于鼠标中键或者右键触发,左键触发方式会根据mode进行处理
|
|
5479
|
+
* @returns 更新的文件的下载链接
|
|
5480
|
+
*/
|
|
5481
|
+
updateFileLink($row, downloadInfo) {
|
|
5482
|
+
const downloadUrl = typeof downloadInfo?.url === "string" ? downloadInfo.url.trim() : "";
|
|
5483
|
+
if (downloadUrl !== "" && downloadUrl !== "null" && downloadUrl !== "undefined") {
|
|
5484
|
+
const $link = $row.querySelector("a");
|
|
5485
|
+
$link.setAttribute("href", downloadUrl);
|
|
5486
|
+
return downloadUrl;
|
|
5487
|
+
}
|
|
5488
|
+
}
|
|
5463
5489
|
/**
|
|
5464
5490
|
* 文件的点击事件 - 下载文件
|
|
5465
|
-
* @param
|
|
5491
|
+
* @param evt 点击事件
|
|
5492
|
+
* @param $row 列表项
|
|
5466
5493
|
* @param dataConfig
|
|
5467
5494
|
*/
|
|
5468
|
-
async
|
|
5469
|
-
|
|
5470
|
-
const $link = $row.querySelector("a");
|
|
5495
|
+
async onFileClick(evt, $row, dataConfig) {
|
|
5496
|
+
let downloadInfo;
|
|
5471
5497
|
if (typeof dataConfig.clickEvent === "function") {
|
|
5472
|
-
const
|
|
5473
|
-
if (
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5498
|
+
const result = await dataConfig.clickEvent(evt, dataConfig);
|
|
5499
|
+
if (typeof result === "object" && result != null && !Array.isArray(result)) {
|
|
5500
|
+
downloadInfo = result;
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
5503
|
+
else if (typeof dataConfig.clickEvent === "object" &&
|
|
5504
|
+
dataConfig.clickEvent != null &&
|
|
5505
|
+
!Array.isArray(dataConfig.clickEvent)) {
|
|
5506
|
+
downloadInfo = dataConfig.clickEvent;
|
|
5507
|
+
}
|
|
5508
|
+
if (downloadInfo) {
|
|
5509
|
+
const downloadUrl = this.updateFileLink($row, downloadInfo);
|
|
5510
|
+
if (downloadUrl) {
|
|
5511
|
+
if (typeof downloadInfo.mode === "string") {
|
|
5485
5512
|
if (downloadInfo.mode === "a" || downloadInfo.mode === "aBlank") {
|
|
5486
5513
|
// a标签下载
|
|
5487
5514
|
const $anchor = popsDOMUtils.createElement("a");
|
|
5488
5515
|
if (downloadInfo.mode === "aBlank") {
|
|
5489
5516
|
$anchor.setAttribute("target", "_blank");
|
|
5490
5517
|
}
|
|
5491
|
-
$anchor.href =
|
|
5518
|
+
$anchor.href = downloadUrl;
|
|
5492
5519
|
$anchor.click();
|
|
5493
5520
|
}
|
|
5494
5521
|
else if (downloadInfo.mode === "open" || downloadInfo.mode === "openBlank") {
|
|
5495
5522
|
// window.open下载
|
|
5496
5523
|
if (downloadInfo.mode === "openBlank") {
|
|
5497
|
-
globalThis.open(
|
|
5524
|
+
globalThis.open(downloadUrl, "_blank");
|
|
5498
5525
|
}
|
|
5499
5526
|
else {
|
|
5500
|
-
globalThis.open(
|
|
5527
|
+
globalThis.open(downloadUrl);
|
|
5501
5528
|
}
|
|
5502
5529
|
}
|
|
5503
5530
|
else if (downloadInfo.mode === "iframe") {
|
|
5504
5531
|
// iframe下载
|
|
5505
5532
|
const $downloadIframe = popsDOMUtils.createElement("iframe");
|
|
5506
|
-
$downloadIframe.src =
|
|
5533
|
+
$downloadIframe.src = downloadUrl;
|
|
5507
5534
|
$downloadIframe.onload = function () {
|
|
5508
5535
|
popsUtils.setTimeout(() => {
|
|
5509
5536
|
$downloadIframe.remove();
|
|
@@ -5685,8 +5712,14 @@ System.register('pops', [], (function (exports) {
|
|
|
5685
5712
|
// 文件 - 点击事件
|
|
5686
5713
|
popsDOMUtils.on(fileNameElement, "click", (event) => {
|
|
5687
5714
|
// 下载文件
|
|
5688
|
-
|
|
5715
|
+
popsDOMUtils.preventEvent(event);
|
|
5716
|
+
this.onFileClick(event, fileNameElement, item);
|
|
5689
5717
|
});
|
|
5718
|
+
// 如果clickEvent不是函数,那么现在就可以进行配置
|
|
5719
|
+
if (typeof item.clickEvent === "object" && item.clickEvent !== null && !Array.isArray(item.clickEvent)) {
|
|
5720
|
+
// {} 单文件配置
|
|
5721
|
+
this.updateFileLink(fileNameElement, item.clickEvent);
|
|
5722
|
+
}
|
|
5690
5723
|
folderListBodyElement.appendChild(folderElement);
|
|
5691
5724
|
}
|
|
5692
5725
|
});
|
|
@@ -13371,7 +13404,7 @@ System.register('pops', [], (function (exports) {
|
|
|
13371
13404
|
},
|
|
13372
13405
|
};
|
|
13373
13406
|
|
|
13374
|
-
const version = "3.3.
|
|
13407
|
+
const version = "3.3.4";
|
|
13375
13408
|
|
|
13376
13409
|
class Pops {
|
|
13377
13410
|
/** 配置 */
|