@whitesev/pops 2.3.5 → 2.3.7
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 +474 -431
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +474 -431
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +474 -431
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +474 -431
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +474 -431
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +474 -431
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/PopsCore.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.system.js
CHANGED
|
@@ -185,9 +185,19 @@ System.register('pops', [], (function (exports) {
|
|
|
185
185
|
window: window,
|
|
186
186
|
globalThis: globalThis,
|
|
187
187
|
self: self,
|
|
188
|
+
setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
189
|
+
setInterval: globalThis.setInterval.bind(globalThis),
|
|
190
|
+
clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
191
|
+
clearInterval: globalThis.clearInterval.bind(globalThis),
|
|
188
192
|
};
|
|
189
193
|
const PopsCoreEnv = Object.assign({}, PopsCoreDefaultEnv);
|
|
190
194
|
const PopsCore = {
|
|
195
|
+
init(option) {
|
|
196
|
+
if (!option) {
|
|
197
|
+
option = Object.assign({}, PopsCoreDefaultEnv);
|
|
198
|
+
}
|
|
199
|
+
Object.assign(PopsCoreEnv, option);
|
|
200
|
+
},
|
|
191
201
|
get document() {
|
|
192
202
|
return PopsCoreEnv.document;
|
|
193
203
|
},
|
|
@@ -200,6 +210,18 @@ System.register('pops', [], (function (exports) {
|
|
|
200
210
|
get self() {
|
|
201
211
|
return PopsCoreEnv.self;
|
|
202
212
|
},
|
|
213
|
+
get setTimeout() {
|
|
214
|
+
return PopsCoreEnv.setTimeout;
|
|
215
|
+
},
|
|
216
|
+
get setInterval() {
|
|
217
|
+
return PopsCoreEnv.setInterval;
|
|
218
|
+
},
|
|
219
|
+
get clearTimeout() {
|
|
220
|
+
return PopsCoreEnv.clearTimeout;
|
|
221
|
+
},
|
|
222
|
+
get clearInterval() {
|
|
223
|
+
return PopsCoreEnv.clearInterval;
|
|
224
|
+
},
|
|
203
225
|
};
|
|
204
226
|
const OriginPrototype = {
|
|
205
227
|
Object: {
|
|
@@ -718,7 +740,7 @@ System.register('pops', [], (function (exports) {
|
|
|
718
740
|
return setTimeout$1(callback, timeout);
|
|
719
741
|
}
|
|
720
742
|
catch (error) {
|
|
721
|
-
return
|
|
743
|
+
return PopsCore.setTimeout(callback, timeout);
|
|
722
744
|
}
|
|
723
745
|
}
|
|
724
746
|
/**
|
|
@@ -733,7 +755,7 @@ System.register('pops', [], (function (exports) {
|
|
|
733
755
|
catch (error) {
|
|
734
756
|
}
|
|
735
757
|
finally {
|
|
736
|
-
|
|
758
|
+
PopsCore.clearTimeout(timeId);
|
|
737
759
|
}
|
|
738
760
|
}
|
|
739
761
|
/**
|
|
@@ -744,7 +766,7 @@ System.register('pops', [], (function (exports) {
|
|
|
744
766
|
return setInterval$1(callback, timeout);
|
|
745
767
|
}
|
|
746
768
|
catch (error) {
|
|
747
|
-
return
|
|
769
|
+
return PopsCore.setInterval(callback, timeout);
|
|
748
770
|
}
|
|
749
771
|
}
|
|
750
772
|
/**
|
|
@@ -759,7 +781,7 @@ System.register('pops', [], (function (exports) {
|
|
|
759
781
|
catch (error) {
|
|
760
782
|
}
|
|
761
783
|
finally {
|
|
762
|
-
|
|
784
|
+
PopsCore.clearInterval(timeId);
|
|
763
785
|
}
|
|
764
786
|
}
|
|
765
787
|
}
|
|
@@ -1135,6 +1157,7 @@ System.register('pops', [], (function (exports) {
|
|
|
1135
1157
|
* })
|
|
1136
1158
|
*/
|
|
1137
1159
|
ready(callback) {
|
|
1160
|
+
const that = this;
|
|
1138
1161
|
if (typeof callback !== "function") {
|
|
1139
1162
|
return;
|
|
1140
1163
|
}
|
|
@@ -1180,7 +1203,7 @@ System.register('pops', [], (function (exports) {
|
|
|
1180
1203
|
function addDomReadyListener() {
|
|
1181
1204
|
for (let index = 0; index < targetList.length; index++) {
|
|
1182
1205
|
let item = targetList[index];
|
|
1183
|
-
item.target
|
|
1206
|
+
that.on(item.target, item.eventType, item.callback);
|
|
1184
1207
|
}
|
|
1185
1208
|
}
|
|
1186
1209
|
/**
|
|
@@ -1189,7 +1212,7 @@ System.register('pops', [], (function (exports) {
|
|
|
1189
1212
|
function removeDomReadyListener() {
|
|
1190
1213
|
for (let index = 0; index < targetList.length; index++) {
|
|
1191
1214
|
let item = targetList[index];
|
|
1192
|
-
item.target
|
|
1215
|
+
that.off(item.target, item.eventType, item.callback);
|
|
1193
1216
|
}
|
|
1194
1217
|
}
|
|
1195
1218
|
if (checkDOMReadyState()) {
|
|
@@ -1471,9 +1494,7 @@ System.register('pops', [], (function (exports) {
|
|
|
1471
1494
|
eventNameList = [eventNameList];
|
|
1472
1495
|
}
|
|
1473
1496
|
eventNameList.forEach((eventName) => {
|
|
1474
|
-
|
|
1475
|
-
capture: Boolean(capture),
|
|
1476
|
-
});
|
|
1497
|
+
this.on(element, eventName, stopEvent, { capture: Boolean(capture) });
|
|
1477
1498
|
});
|
|
1478
1499
|
}
|
|
1479
1500
|
}
|
|
@@ -5122,57 +5143,101 @@ System.register('pops', [], (function (exports) {
|
|
|
5122
5143
|
if ($mask != null) {
|
|
5123
5144
|
$anim.after($mask);
|
|
5124
5145
|
}
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
if (
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
if (fileName.toLowerCase().endsWith("." + keyName)) {
|
|
5160
|
-
fileType = keyName;
|
|
5161
|
-
fileIcon = Folder_ICON[keyName];
|
|
5162
|
-
break;
|
|
5163
|
-
}
|
|
5146
|
+
class PopsFolder {
|
|
5147
|
+
init() {
|
|
5148
|
+
config.folder.sort();
|
|
5149
|
+
this.initFolderView(config.folder);
|
|
5150
|
+
/* 将数据存到全部文件的属性_config_中 */
|
|
5151
|
+
let allFilesElement = folderFileListBreadcrumbPrimaryElement.querySelector(".pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child");
|
|
5152
|
+
Reflect.set(allFilesElement, "_config_", config.folder);
|
|
5153
|
+
/* 设置点击顶部的全部文件事件 */
|
|
5154
|
+
popsDOMUtils.on(allFilesElement, "click", (event) => {
|
|
5155
|
+
this.setBreadcrumbClickEvent(event, true, config.folder);
|
|
5156
|
+
});
|
|
5157
|
+
// 文件名的点击排序
|
|
5158
|
+
popsDOMUtils.on(folderListSortFileNameElement.closest("th"), "click", (event) => {
|
|
5159
|
+
this.arrowToSortFolderInfoView(folderListSortFileNameElement, event, "fileName");
|
|
5160
|
+
}, {
|
|
5161
|
+
capture: true,
|
|
5162
|
+
});
|
|
5163
|
+
// 修改事件的点击排序
|
|
5164
|
+
popsDOMUtils.on(folderListSortLatestTimeElement.closest("th"), "click", (event) => {
|
|
5165
|
+
this.arrowToSortFolderInfoView(folderListSortLatestTimeElement, event, "latestTime");
|
|
5166
|
+
}, {
|
|
5167
|
+
capture: true,
|
|
5168
|
+
});
|
|
5169
|
+
// 文件大小的点击排序
|
|
5170
|
+
popsDOMUtils.on(folderListSortFileSizeElement.closest("th"), "click", (event) => {
|
|
5171
|
+
this.arrowToSortFolderInfoView(folderListSortFileSizeElement, event, "fileSize");
|
|
5172
|
+
}, {
|
|
5173
|
+
capture: true,
|
|
5174
|
+
});
|
|
5175
|
+
/* 设置默认触发的arrow */
|
|
5176
|
+
if (config.sort.name === "fileName") {
|
|
5177
|
+
popsDOMUtils.trigger(folderListSortFileNameElement, "click", {
|
|
5178
|
+
notChangeSortRule: true,
|
|
5179
|
+
});
|
|
5164
5180
|
}
|
|
5165
|
-
if (
|
|
5166
|
-
|
|
5167
|
-
|
|
5181
|
+
else if (config.sort.name === "latestTime") {
|
|
5182
|
+
popsDOMUtils.trigger(folderListSortLatestTimeElement, "click", {
|
|
5183
|
+
notChangeSortRule: true,
|
|
5184
|
+
});
|
|
5185
|
+
}
|
|
5186
|
+
else if (config.sort.name === "fileSize") {
|
|
5187
|
+
popsDOMUtils.trigger(folderListSortFileSizeElement, "click", {
|
|
5188
|
+
notChangeSortRule: true,
|
|
5189
|
+
});
|
|
5168
5190
|
}
|
|
5169
5191
|
}
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5192
|
+
/**
|
|
5193
|
+
* 创建文件夹元素
|
|
5194
|
+
* @param fileName 文件名
|
|
5195
|
+
* @param latestTime 修改时间
|
|
5196
|
+
* @param [fileSize="-"] 文件大小
|
|
5197
|
+
* @param isFolder 是否是文件夹
|
|
5198
|
+
*/
|
|
5199
|
+
createFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
|
|
5200
|
+
let origin_fileName = fileName;
|
|
5201
|
+
let origin_latestTime = latestTime;
|
|
5202
|
+
let origin_fileSize = fileSize;
|
|
5203
|
+
let folderElement = popsDOMUtils.createElement("tr");
|
|
5204
|
+
let fileNameElement = popsDOMUtils.createElement("td");
|
|
5205
|
+
let fileTimeElement = popsDOMUtils.createElement("td");
|
|
5206
|
+
let fileFormatSize = popsDOMUtils.createElement("td");
|
|
5207
|
+
let fileType = "";
|
|
5208
|
+
let fileIcon = Folder_ICON.folder;
|
|
5209
|
+
if (isFolder) {
|
|
5210
|
+
/* 文件夹 */
|
|
5211
|
+
latestTime = "";
|
|
5212
|
+
fileSize = "";
|
|
5213
|
+
}
|
|
5214
|
+
else {
|
|
5215
|
+
/* 文件 */
|
|
5216
|
+
fileIcon = "";
|
|
5217
|
+
if (typeof latestTime === "number") {
|
|
5218
|
+
latestTime = popsUtils.formatTime(latestTime);
|
|
5219
|
+
}
|
|
5220
|
+
if (typeof fileSize === "number") {
|
|
5221
|
+
fileSize = popsUtils.formatByteToSize(fileSize);
|
|
5222
|
+
}
|
|
5223
|
+
for (let keyName in Folder_ICON) {
|
|
5224
|
+
if (fileName.toLowerCase().endsWith("." + keyName)) {
|
|
5225
|
+
fileType = keyName;
|
|
5226
|
+
fileIcon = Folder_ICON[keyName];
|
|
5227
|
+
break;
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
if (!Boolean(fileIcon)) {
|
|
5231
|
+
fileType = "Null";
|
|
5232
|
+
fileIcon = Folder_ICON.Null;
|
|
5233
|
+
}
|
|
5234
|
+
}
|
|
5235
|
+
folderElement.className = "pops-folder-list-table__body-row";
|
|
5236
|
+
fileNameElement.className = "pops-folder-list-table__body-td";
|
|
5237
|
+
fileTimeElement.className = "pops-folder-list-table__body-td";
|
|
5238
|
+
fileFormatSize.className = "pops-folder-list-table__body-td";
|
|
5239
|
+
PopsSafeUtils.setSafeHTML(fileNameElement,
|
|
5240
|
+
/*html*/ `
|
|
5176
5241
|
<div class="pops-folder-list-file-name cursor-p">
|
|
5177
5242
|
<div>
|
|
5178
5243
|
<img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
|
|
@@ -5182,80 +5247,84 @@ System.register('pops', [], (function (exports) {
|
|
|
5182
5247
|
</div>
|
|
5183
5248
|
</div>
|
|
5184
5249
|
`);
|
|
5185
|
-
|
|
5186
|
-
|
|
5250
|
+
PopsSafeUtils.setSafeHTML(fileTimeElement,
|
|
5251
|
+
/*html*/ `
|
|
5187
5252
|
<div class="pops-folder-list__time">
|
|
5188
5253
|
<span>${latestTime}</span>
|
|
5189
5254
|
</div>
|
|
5190
5255
|
`);
|
|
5191
|
-
|
|
5192
|
-
|
|
5256
|
+
PopsSafeUtils.setSafeHTML(fileFormatSize,
|
|
5257
|
+
/*html*/ `
|
|
5193
5258
|
<div class="pops-folder-list-format-size">
|
|
5194
5259
|
<span>${fileSize}</span>
|
|
5195
5260
|
</div>
|
|
5196
5261
|
`);
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
}
|
|
5218
|
-
/**
|
|
5219
|
-
* 创建移动端文件夹元素
|
|
5220
|
-
*/
|
|
5221
|
-
function createMobileFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
|
|
5222
|
-
let origin_fileName = fileName;
|
|
5223
|
-
let origin_latestTime = latestTime;
|
|
5224
|
-
let origin_fileSize = fileSize;
|
|
5225
|
-
let folderELement = popsDOMUtils.createElement("tr");
|
|
5226
|
-
let fileNameElement = popsDOMUtils.createElement("td");
|
|
5227
|
-
let fileType = "";
|
|
5228
|
-
let fileIcon = Folder_ICON.folder;
|
|
5229
|
-
if (isFolder) {
|
|
5230
|
-
/* 文件夹 */
|
|
5231
|
-
latestTime = "";
|
|
5232
|
-
fileSize = "";
|
|
5262
|
+
/* 存储原来的值 */
|
|
5263
|
+
let __value__ = {
|
|
5264
|
+
fileName: origin_fileName,
|
|
5265
|
+
latestTime: origin_latestTime,
|
|
5266
|
+
fileSize: origin_fileSize,
|
|
5267
|
+
isFolder: isFolder,
|
|
5268
|
+
};
|
|
5269
|
+
Reflect.set(fileNameElement, "__value__", __value__);
|
|
5270
|
+
Reflect.set(fileTimeElement, "__value__", __value__);
|
|
5271
|
+
Reflect.set(fileFormatSize, "__value__", __value__);
|
|
5272
|
+
Reflect.set(folderElement, "__value__", __value__);
|
|
5273
|
+
folderElement.appendChild(fileNameElement);
|
|
5274
|
+
folderElement.appendChild(fileTimeElement);
|
|
5275
|
+
folderElement.appendChild(fileFormatSize);
|
|
5276
|
+
return {
|
|
5277
|
+
folderElement,
|
|
5278
|
+
fileNameElement,
|
|
5279
|
+
fileTimeElement,
|
|
5280
|
+
fileFormatSize,
|
|
5281
|
+
};
|
|
5233
5282
|
}
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5283
|
+
/**
|
|
5284
|
+
* 创建移动端文件夹元素
|
|
5285
|
+
* @param fileName 文件名
|
|
5286
|
+
* @param latestTime 创建时间
|
|
5287
|
+
* @param [fileSize="-"] 文件大小
|
|
5288
|
+
* @param isFolder 是否是文件夹
|
|
5289
|
+
*/
|
|
5290
|
+
createFolderRowElementByMobile(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
|
|
5291
|
+
let origin_fileName = fileName;
|
|
5292
|
+
let origin_latestTime = latestTime;
|
|
5293
|
+
let origin_fileSize = fileSize;
|
|
5294
|
+
let folderElement = popsDOMUtils.createElement("tr");
|
|
5295
|
+
let fileNameElement = popsDOMUtils.createElement("td");
|
|
5296
|
+
let fileType = "";
|
|
5297
|
+
let fileIcon = Folder_ICON.folder;
|
|
5298
|
+
if (isFolder) {
|
|
5299
|
+
/* 文件夹 */
|
|
5300
|
+
latestTime = "";
|
|
5301
|
+
fileSize = "";
|
|
5249
5302
|
}
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
fileIcon =
|
|
5303
|
+
else {
|
|
5304
|
+
/* 文件 */
|
|
5305
|
+
fileIcon = "";
|
|
5306
|
+
if (typeof latestTime === "number") {
|
|
5307
|
+
latestTime = popsUtils.formatTime(latestTime);
|
|
5308
|
+
}
|
|
5309
|
+
if (typeof fileSize === "number") {
|
|
5310
|
+
fileSize = popsUtils.formatByteToSize(fileSize);
|
|
5311
|
+
}
|
|
5312
|
+
for (let keyName in Folder_ICON) {
|
|
5313
|
+
if (fileName.toLowerCase().endsWith("." + keyName)) {
|
|
5314
|
+
fileType = keyName;
|
|
5315
|
+
fileIcon = Folder_ICON[keyName];
|
|
5316
|
+
break;
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
if (!Boolean(fileIcon)) {
|
|
5320
|
+
fileType = "Null";
|
|
5321
|
+
fileIcon = Folder_ICON.Null;
|
|
5322
|
+
}
|
|
5253
5323
|
}
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
/*html*/ `
|
|
5324
|
+
folderElement.className = "pops-folder-list-table__body-row";
|
|
5325
|
+
fileNameElement.className = "pops-folder-list-table__body-td";
|
|
5326
|
+
PopsSafeUtils.setSafeHTML(fileNameElement,
|
|
5327
|
+
/*html*/ `
|
|
5259
5328
|
<div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
|
|
5260
5329
|
<img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
|
|
5261
5330
|
<div>
|
|
@@ -5264,139 +5333,138 @@ System.register('pops', [], (function (exports) {
|
|
|
5264
5333
|
</div>
|
|
5265
5334
|
</div>
|
|
5266
5335
|
`);
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5336
|
+
/* 存储原来的值 */
|
|
5337
|
+
let __value__ = {
|
|
5338
|
+
fileName: origin_fileName,
|
|
5339
|
+
latestTime: origin_latestTime,
|
|
5340
|
+
fileSize: origin_fileSize,
|
|
5341
|
+
isFolder: isFolder,
|
|
5342
|
+
};
|
|
5343
|
+
Reflect.set(fileNameElement, "__value__", __value__);
|
|
5344
|
+
Reflect.set(folderElement, "__value__", __value__);
|
|
5345
|
+
folderElement.appendChild(fileNameElement);
|
|
5346
|
+
return {
|
|
5347
|
+
folderElement,
|
|
5348
|
+
fileNameElement,
|
|
5349
|
+
};
|
|
5350
|
+
}
|
|
5351
|
+
/**
|
|
5352
|
+
* 清空文件夹信息页面
|
|
5353
|
+
*/
|
|
5354
|
+
clearFolderInfoView() {
|
|
5355
|
+
PopsSafeUtils.setSafeHTML(folderListBodyElement, "");
|
|
5356
|
+
}
|
|
5357
|
+
/**
|
|
5358
|
+
* 创建顶部导航的箭头图标
|
|
5359
|
+
*/
|
|
5360
|
+
createHeaderArrowIcon() {
|
|
5361
|
+
let $arrowIcon = popsDOMUtils.createElement("div", {
|
|
5362
|
+
className: "iconArrow",
|
|
5363
|
+
});
|
|
5364
|
+
return $arrowIcon;
|
|
5365
|
+
}
|
|
5366
|
+
/**
|
|
5367
|
+
* 添加顶部导航元素
|
|
5368
|
+
* @param folderName 文件夹名
|
|
5369
|
+
* @param folderDataConfig 文件夹配置
|
|
5370
|
+
*/
|
|
5371
|
+
createBreadcrumb(folderName, folderDataConfig) {
|
|
5372
|
+
let $breadcrumb = popsDOMUtils.createElement("span", {
|
|
5373
|
+
className: "pops-folder-file-list-breadcrumb-allFiles cursor-p",
|
|
5374
|
+
innerHTML: `<a>${folderName}</a>`,
|
|
5375
|
+
_config_: folderDataConfig,
|
|
5376
|
+
}, {
|
|
5377
|
+
title: folderName,
|
|
5378
|
+
});
|
|
5379
|
+
return $breadcrumb;
|
|
5380
|
+
}
|
|
5381
|
+
/**
|
|
5382
|
+
* 顶部导航的点击事件
|
|
5383
|
+
* @param clickEvent
|
|
5384
|
+
* @param isTop 是否是全部文件按钮
|
|
5385
|
+
* @param dataConfigList 配置
|
|
5386
|
+
*/
|
|
5387
|
+
setBreadcrumbClickEvent(clickEvent, isTop, dataConfigList) {
|
|
5388
|
+
this.clearFolderInfoView();
|
|
5389
|
+
/* 获取当前的导航元素 */
|
|
5390
|
+
let $click = clickEvent.target;
|
|
5391
|
+
let currentBreadcrumb = $click.closest("span.pops-folder-file-list-breadcrumb-allFiles");
|
|
5392
|
+
if (currentBreadcrumb) {
|
|
5393
|
+
while (currentBreadcrumb.nextElementSibling) {
|
|
5394
|
+
currentBreadcrumb.nextElementSibling.remove();
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
else {
|
|
5398
|
+
console.error("获取导航按钮失败");
|
|
5326
5399
|
}
|
|
5400
|
+
let loadingMask = PopsLoading.init({
|
|
5401
|
+
parent: $content,
|
|
5402
|
+
content: {
|
|
5403
|
+
text: "获取文件列表中...",
|
|
5404
|
+
},
|
|
5405
|
+
mask: {
|
|
5406
|
+
enable: true,
|
|
5407
|
+
clickEvent: {
|
|
5408
|
+
toClose: false,
|
|
5409
|
+
toHide: false,
|
|
5410
|
+
},
|
|
5411
|
+
},
|
|
5412
|
+
addIndexCSS: false,
|
|
5413
|
+
});
|
|
5414
|
+
this.initFolderView(dataConfigList);
|
|
5415
|
+
loadingMask.close();
|
|
5327
5416
|
}
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5417
|
+
/**
|
|
5418
|
+
* 文件夹的点击事件 - 进入文件夹
|
|
5419
|
+
*
|
|
5420
|
+
* 先情况页面元素
|
|
5421
|
+
* @param clickEvent
|
|
5422
|
+
* @param dataConfig
|
|
5423
|
+
*/
|
|
5424
|
+
async enterFolder(clickEvent, dataConfig) {
|
|
5425
|
+
this.clearFolderInfoView();
|
|
5426
|
+
let loadingMask = PopsLoading.init({
|
|
5427
|
+
parent: $content,
|
|
5428
|
+
content: {
|
|
5429
|
+
text: "获取文件列表中...",
|
|
5341
5430
|
},
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
loadingMask.close();
|
|
5347
|
-
}
|
|
5348
|
-
/**
|
|
5349
|
-
* 刷新文件列表界面信息
|
|
5350
|
-
* @param event
|
|
5351
|
-
* @param folderDataConfig
|
|
5352
|
-
*/
|
|
5353
|
-
async function refreshFolderInfoClickEvent(event, folderDataConfig) {
|
|
5354
|
-
clearFolderRow();
|
|
5355
|
-
let loadingMask = PopsLoading.init({
|
|
5356
|
-
parent: $content,
|
|
5357
|
-
content: {
|
|
5358
|
-
text: "获取文件列表中...",
|
|
5359
|
-
},
|
|
5360
|
-
mask: {
|
|
5361
|
-
enable: true,
|
|
5362
|
-
},
|
|
5363
|
-
addIndexCSS: false,
|
|
5364
|
-
});
|
|
5365
|
-
if (typeof folderDataConfig.clickEvent === "function") {
|
|
5366
|
-
let childConfig = await folderDataConfig.clickEvent(event, folderDataConfig);
|
|
5367
|
-
/* 添加顶部导航的箭头 */
|
|
5368
|
-
folderFileListBreadcrumbPrimaryElement.appendChild(createHeaderArrowIcon());
|
|
5369
|
-
/* 添加顶部导航的链接文字 */
|
|
5370
|
-
let breadcrumbAllFilesElement = createHeaderFileLinkNavgiation(folderDataConfig.fileName, childConfig);
|
|
5371
|
-
folderFileListBreadcrumbPrimaryElement.appendChild(breadcrumbAllFilesElement);
|
|
5372
|
-
/* 设置顶部导航点击事件 */
|
|
5373
|
-
popsDOMUtils.on(breadcrumbAllFilesElement, "click", function (event) {
|
|
5374
|
-
breadcrumbAllFilesElementClickEvent(event, false, childConfig);
|
|
5431
|
+
mask: {
|
|
5432
|
+
enable: true,
|
|
5433
|
+
},
|
|
5434
|
+
addIndexCSS: false,
|
|
5375
5435
|
});
|
|
5376
|
-
|
|
5436
|
+
if (typeof dataConfig.clickEvent === "function") {
|
|
5437
|
+
let childConfig = await dataConfig.clickEvent(clickEvent, dataConfig);
|
|
5438
|
+
/* 添加顶部导航的箭头 */
|
|
5439
|
+
folderFileListBreadcrumbPrimaryElement.appendChild(this.createHeaderArrowIcon());
|
|
5440
|
+
/* 添加顶部导航的链接文字 */
|
|
5441
|
+
let breadcrumbAllFilesElement = this.createBreadcrumb(dataConfig.fileName, childConfig);
|
|
5442
|
+
folderFileListBreadcrumbPrimaryElement.appendChild(breadcrumbAllFilesElement);
|
|
5443
|
+
/* 设置顶部导航点击事件 */
|
|
5444
|
+
popsDOMUtils.on(breadcrumbAllFilesElement, "click", (event) => {
|
|
5445
|
+
this.setBreadcrumbClickEvent(event, false, childConfig);
|
|
5446
|
+
});
|
|
5447
|
+
this.initFolderView(childConfig);
|
|
5448
|
+
}
|
|
5449
|
+
loadingMask.close();
|
|
5377
5450
|
}
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
event?.stopPropagation();
|
|
5389
|
-
event?.stopImmediatePropagation();
|
|
5390
|
-
let linkElement = targetElement.querySelector("a");
|
|
5391
|
-
if (typeof _config_.clickEvent === "function") {
|
|
5392
|
-
let downloadInfo = await _config_.clickEvent(event, _config_);
|
|
5451
|
+
/**
|
|
5452
|
+
* 文件的点击事件 - 下载文件
|
|
5453
|
+
* @param $target
|
|
5454
|
+
* @param dataConfig
|
|
5455
|
+
*/
|
|
5456
|
+
async downloadFile(clickEvent, $row, dataConfig) {
|
|
5457
|
+
popsDOMUtils.preventEvent(clickEvent);
|
|
5458
|
+
let $link = $row.querySelector("a");
|
|
5459
|
+
if (typeof dataConfig.clickEvent === "function") {
|
|
5460
|
+
let downloadInfo = await dataConfig.clickEvent(clickEvent, dataConfig);
|
|
5393
5461
|
if (downloadInfo != null &&
|
|
5394
5462
|
typeof downloadInfo === "object" &&
|
|
5395
5463
|
!Array.isArray(downloadInfo) &&
|
|
5396
5464
|
typeof downloadInfo.url === "string" &&
|
|
5397
5465
|
downloadInfo.url.trim() !== "") {
|
|
5398
|
-
|
|
5399
|
-
|
|
5466
|
+
$link.setAttribute("href", downloadInfo.url);
|
|
5467
|
+
$link.setAttribute("target", "_blank");
|
|
5400
5468
|
if (downloadInfo.autoDownload) {
|
|
5401
5469
|
if (downloadInfo.mode == null || downloadInfo.mode === "") {
|
|
5402
5470
|
/* 未设置mode的话默认为aBlank */
|
|
@@ -5440,215 +5508,190 @@ System.register('pops', [], (function (exports) {
|
|
|
5440
5508
|
}
|
|
5441
5509
|
}
|
|
5442
5510
|
}
|
|
5443
|
-
}
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5511
|
+
}
|
|
5512
|
+
/**
|
|
5513
|
+
* 对配置进行排序
|
|
5514
|
+
* @param folderDataConfigList
|
|
5515
|
+
* @param sortName 比较的属性,默认fileName
|
|
5516
|
+
* @param isDesc 是否降序,默认false(升序)
|
|
5517
|
+
*/
|
|
5518
|
+
sortFolderConfig(folderDataConfigList, sortName = "fileName", isDesc = false) {
|
|
5519
|
+
if (sortName === "fileName") {
|
|
5520
|
+
// 如果是以文件名排序,文件夹优先放前面
|
|
5521
|
+
let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
|
|
5522
|
+
return value.isFolder;
|
|
5523
|
+
});
|
|
5524
|
+
let onlyFileDataConfigList = folderDataConfigList.filter((value) => {
|
|
5525
|
+
return !value.isFolder;
|
|
5526
|
+
});
|
|
5527
|
+
// 文件夹排序
|
|
5528
|
+
onlyFolderDataConfigList.sort((leftConfig, rightConfig) => {
|
|
5529
|
+
let beforeVal = leftConfig[sortName].toString();
|
|
5530
|
+
let afterVal = rightConfig[sortName].toString();
|
|
5531
|
+
let compareVal = beforeVal.localeCompare(afterVal);
|
|
5532
|
+
if (isDesc) {
|
|
5533
|
+
/* 降序 */
|
|
5534
|
+
if (compareVal > 0) {
|
|
5535
|
+
compareVal = -1;
|
|
5536
|
+
}
|
|
5537
|
+
else if (compareVal < 0) {
|
|
5538
|
+
compareVal = 1;
|
|
5539
|
+
}
|
|
5469
5540
|
}
|
|
5470
|
-
|
|
5471
|
-
|
|
5541
|
+
return compareVal;
|
|
5542
|
+
});
|
|
5543
|
+
// 文件名排序
|
|
5544
|
+
onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
|
|
5545
|
+
let beforeVal = leftConfig[sortName].toString();
|
|
5546
|
+
let afterVal = rightConfig[sortName].toString();
|
|
5547
|
+
let compareVal = beforeVal.localeCompare(afterVal);
|
|
5548
|
+
if (isDesc) {
|
|
5549
|
+
/* 降序 */
|
|
5550
|
+
if (compareVal > 0) {
|
|
5551
|
+
compareVal = -1;
|
|
5552
|
+
}
|
|
5553
|
+
else if (compareVal < 0) {
|
|
5554
|
+
compareVal = 1;
|
|
5555
|
+
}
|
|
5472
5556
|
}
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
});
|
|
5476
|
-
// 文件名排序
|
|
5477
|
-
onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
|
|
5478
|
-
let beforeVal = leftConfig[sortName].toString();
|
|
5479
|
-
let afterVal = rightConfig[sortName].toString();
|
|
5480
|
-
let compareVal = beforeVal.localeCompare(afterVal);
|
|
5557
|
+
return compareVal;
|
|
5558
|
+
});
|
|
5481
5559
|
if (isDesc) {
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
}
|
|
5560
|
+
// 降序,文件夹在下面
|
|
5561
|
+
return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
|
|
5562
|
+
}
|
|
5563
|
+
else {
|
|
5564
|
+
// 升序,文件夹在上面
|
|
5565
|
+
return [...onlyFolderDataConfigList, ...onlyFileDataConfigList];
|
|
5489
5566
|
}
|
|
5490
|
-
return compareVal;
|
|
5491
|
-
});
|
|
5492
|
-
if (isDesc) {
|
|
5493
|
-
// 降序,文件夹在下面
|
|
5494
|
-
return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
|
|
5495
5567
|
}
|
|
5496
5568
|
else {
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
let afterVal = afterConfig[sortName];
|
|
5505
|
-
if (sortName === "fileSize") {
|
|
5506
|
-
/* 文件大小,进行Float转换 */
|
|
5507
|
-
beforeVal = parseFloat(beforeVal.toString());
|
|
5508
|
-
afterVal = parseFloat(afterVal.toString());
|
|
5509
|
-
}
|
|
5510
|
-
else if (sortName === "latestTime") {
|
|
5511
|
-
/* 文件时间 */
|
|
5512
|
-
beforeVal = new Date(beforeVal).getTime();
|
|
5513
|
-
afterVal = new Date(afterVal).getTime();
|
|
5514
|
-
}
|
|
5515
|
-
if (beforeVal > afterVal) {
|
|
5516
|
-
if (isDesc) {
|
|
5517
|
-
/* 降序 */
|
|
5518
|
-
return -1;
|
|
5569
|
+
folderDataConfigList.sort((beforeConfig, afterConfig) => {
|
|
5570
|
+
let beforeVal = beforeConfig[sortName];
|
|
5571
|
+
let afterVal = afterConfig[sortName];
|
|
5572
|
+
if (sortName === "fileSize") {
|
|
5573
|
+
/* 文件大小,进行Float转换 */
|
|
5574
|
+
beforeVal = parseFloat(beforeVal.toString());
|
|
5575
|
+
afterVal = parseFloat(afterVal.toString());
|
|
5519
5576
|
}
|
|
5520
|
-
else {
|
|
5521
|
-
|
|
5577
|
+
else if (sortName === "latestTime") {
|
|
5578
|
+
/* 文件时间 */
|
|
5579
|
+
beforeVal = new Date(beforeVal).getTime();
|
|
5580
|
+
afterVal = new Date(afterVal).getTime();
|
|
5522
5581
|
}
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5582
|
+
if (beforeVal > afterVal) {
|
|
5583
|
+
if (isDesc) {
|
|
5584
|
+
/* 降序 */
|
|
5585
|
+
return -1;
|
|
5586
|
+
}
|
|
5587
|
+
else {
|
|
5588
|
+
return 1;
|
|
5589
|
+
}
|
|
5590
|
+
}
|
|
5591
|
+
else if (beforeVal < afterVal) {
|
|
5592
|
+
if (isDesc) {
|
|
5593
|
+
/* 降序 */
|
|
5594
|
+
return 1;
|
|
5595
|
+
}
|
|
5596
|
+
else {
|
|
5597
|
+
return -1;
|
|
5598
|
+
}
|
|
5528
5599
|
}
|
|
5529
5600
|
else {
|
|
5530
|
-
return
|
|
5601
|
+
return 0;
|
|
5531
5602
|
}
|
|
5603
|
+
});
|
|
5604
|
+
return folderDataConfigList;
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* 添加文件夹/文件行元素
|
|
5609
|
+
* @param dataConfig 配置
|
|
5610
|
+
*/
|
|
5611
|
+
initFolderView(dataConfig) {
|
|
5612
|
+
// 先对文件夹、文件进行排序
|
|
5613
|
+
this.sortFolderConfig(dataConfig, config.sort.name, config.sort.isDesc);
|
|
5614
|
+
dataConfig.forEach((item) => {
|
|
5615
|
+
if (item.isFolder) {
|
|
5616
|
+
let { folderElement, fileNameElement } = popsUtils.isPhone()
|
|
5617
|
+
? this.createFolderRowElementByMobile(item.fileName, "", "", true)
|
|
5618
|
+
: this.createFolderRowElement(item.fileName, "", "", true);
|
|
5619
|
+
// 文件夹 - 点击事件
|
|
5620
|
+
popsDOMUtils.on(fileNameElement, "click", (event) => {
|
|
5621
|
+
// 进入文件夹
|
|
5622
|
+
this.enterFolder(event, item);
|
|
5623
|
+
});
|
|
5624
|
+
folderListBodyElement.appendChild(folderElement);
|
|
5532
5625
|
}
|
|
5533
5626
|
else {
|
|
5534
|
-
|
|
5627
|
+
let { folderElement, fileNameElement } = popsUtils.isPhone()
|
|
5628
|
+
? this.createFolderRowElementByMobile(item.fileName, item.latestTime, item.fileSize, false)
|
|
5629
|
+
: this.createFolderRowElement(item.fileName, item.latestTime, item.fileSize, false);
|
|
5630
|
+
// 文件 - 点击事件
|
|
5631
|
+
popsDOMUtils.on(fileNameElement, "click", (event) => {
|
|
5632
|
+
// 下载文件
|
|
5633
|
+
this.downloadFile(event, fileNameElement, item);
|
|
5634
|
+
});
|
|
5635
|
+
folderListBodyElement.appendChild(folderElement);
|
|
5535
5636
|
}
|
|
5536
5637
|
});
|
|
5537
|
-
return folderDataConfigList;
|
|
5538
5638
|
}
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5639
|
+
/**
|
|
5640
|
+
* 移除所有箭头的被访问状态
|
|
5641
|
+
*/
|
|
5642
|
+
removeArrowActiveStatus() {
|
|
5643
|
+
[
|
|
5644
|
+
...Array.from(folderListSortFileNameElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5645
|
+
...Array.from(folderListSortLatestTimeElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5646
|
+
...Array.from(folderListSortFileSizeElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5647
|
+
].forEach((ele) => ele.classList.remove("pops-folder-icon-active"));
|
|
5648
|
+
}
|
|
5649
|
+
/**
|
|
5650
|
+
* 修改导航箭头的状态
|
|
5651
|
+
*/
|
|
5652
|
+
changeArrowActive(arrowUp, arrowDown, isDesc) {
|
|
5653
|
+
this.removeArrowActiveStatus();
|
|
5654
|
+
if (isDesc) {
|
|
5655
|
+
arrowDown.classList.add("pops-folder-icon-active");
|
|
5555
5656
|
}
|
|
5556
5657
|
else {
|
|
5557
|
-
|
|
5558
|
-
? createMobileFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false)
|
|
5559
|
-
: createFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false);
|
|
5560
|
-
setFileClickEvent(fileNameElement, item);
|
|
5561
|
-
folderListBodyElement.appendChild(folderELement);
|
|
5658
|
+
arrowUp.classList.add("pops-folder-icon-active");
|
|
5562
5659
|
}
|
|
5563
|
-
});
|
|
5564
|
-
}
|
|
5565
|
-
addFolderElement(config.folder);
|
|
5566
|
-
/* 将数据存到全部文件的属性_config_中 */
|
|
5567
|
-
let allFilesElement = folderFileListBreadcrumbPrimaryElement.querySelector(".pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child");
|
|
5568
|
-
allFilesElement._config_ = config.folder;
|
|
5569
|
-
/* 设置点击顶部的全部文件事件 */
|
|
5570
|
-
popsDOMUtils.on(allFilesElement, "click", (event) => {
|
|
5571
|
-
breadcrumbAllFilesElementClickEvent(event, true, config.folder);
|
|
5572
|
-
});
|
|
5573
|
-
/* 移除所有的当前排序的arrow */
|
|
5574
|
-
function removeAllArrowActive() {
|
|
5575
|
-
[
|
|
5576
|
-
...Array.from(folderListSortFileNameElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5577
|
-
...Array.from(folderListSortLatestTimeElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5578
|
-
...Array.from(folderListSortFileSizeElement.querySelectorAll(".pops-folder-icon-active")),
|
|
5579
|
-
].forEach((ele) => ele.classList.remove("pops-folder-icon-active"));
|
|
5580
|
-
}
|
|
5581
|
-
/* 设置当前的排序的arrow */
|
|
5582
|
-
function changeArrowActive(arrowUp, arrowDown, isDesc) {
|
|
5583
|
-
removeAllArrowActive();
|
|
5584
|
-
if (isDesc) {
|
|
5585
|
-
arrowDown.classList.add("pops-folder-icon-active");
|
|
5586
5660
|
}
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5661
|
+
/**
|
|
5662
|
+
* 排序按钮的点击事件
|
|
5663
|
+
* @param target
|
|
5664
|
+
* @param event
|
|
5665
|
+
* @param sortName
|
|
5666
|
+
*/
|
|
5667
|
+
arrowToSortFolderInfoView(target, event, sortName) {
|
|
5668
|
+
const notChangeSortRule = Reflect.get(event, "notChangeSortRule");
|
|
5669
|
+
if (!notChangeSortRule) {
|
|
5670
|
+
config.sort.name = sortName;
|
|
5671
|
+
config.sort.isDesc = !config.sort.isDesc;
|
|
5672
|
+
}
|
|
5673
|
+
let arrowUp = target.querySelector(".pops-folder-icon-arrow-up");
|
|
5674
|
+
let arrowDown = target.querySelector(".pops-folder-icon-arrow-down");
|
|
5675
|
+
this.changeArrowActive(arrowUp, arrowDown, config.sort.isDesc);
|
|
5676
|
+
if (typeof config.sort.callback === "function" &&
|
|
5677
|
+
config.sort.callback(target, event, config.sort.name, config.sort.isDesc)) {
|
|
5678
|
+
return;
|
|
5679
|
+
}
|
|
5680
|
+
let childrenList = [];
|
|
5681
|
+
Array.from(folderListBodyElement.children).forEach((trElement) => {
|
|
5682
|
+
let __value__ = Reflect.get(trElement, "__value__");
|
|
5683
|
+
Reflect.set(__value__, "target", trElement);
|
|
5684
|
+
childrenList.push(__value__);
|
|
5685
|
+
});
|
|
5686
|
+
let sortedConfigList = this.sortFolderConfig(childrenList, config.sort.name, config.sort.isDesc);
|
|
5687
|
+
sortedConfigList.forEach((item) => {
|
|
5688
|
+
folderListBodyElement.appendChild(item.target);
|
|
5689
|
+
});
|
|
5608
5690
|
}
|
|
5609
|
-
let childrenList = [];
|
|
5610
|
-
Array.from(folderListBodyElement.children).forEach((trElement) => {
|
|
5611
|
-
let __value__ = trElement["__value__"];
|
|
5612
|
-
__value__["target"] = trElement;
|
|
5613
|
-
childrenList.push(__value__);
|
|
5614
|
-
});
|
|
5615
|
-
let sortedConfigList = sortFolderConfig(childrenList, config.sort.name, config.sort.isDesc);
|
|
5616
|
-
sortedConfigList.forEach((item) => {
|
|
5617
|
-
folderListBodyElement.appendChild(item.target);
|
|
5618
|
-
});
|
|
5619
|
-
}
|
|
5620
|
-
/* 设置当前排序的图标按钮 */
|
|
5621
|
-
popsDOMUtils.on(folderListSortFileNameElement.closest("th"), "click", function (event) {
|
|
5622
|
-
arrowSortClickEvent(folderListSortFileNameElement, event, "fileName");
|
|
5623
|
-
}, {
|
|
5624
|
-
capture: true,
|
|
5625
|
-
});
|
|
5626
|
-
popsDOMUtils.on(folderListSortLatestTimeElement.closest("th"), "click", void 0, function (event) {
|
|
5627
|
-
arrowSortClickEvent(folderListSortLatestTimeElement, event, "latestTime");
|
|
5628
|
-
}, {
|
|
5629
|
-
capture: true,
|
|
5630
|
-
});
|
|
5631
|
-
popsDOMUtils.on(folderListSortFileSizeElement.closest("th"), "click", void 0, function (event) {
|
|
5632
|
-
arrowSortClickEvent(folderListSortFileSizeElement, event, "fileSize");
|
|
5633
|
-
}, {
|
|
5634
|
-
capture: true,
|
|
5635
|
-
});
|
|
5636
|
-
/* 设置默认触发的arrow */
|
|
5637
|
-
if (config.sort.name === "fileName") {
|
|
5638
|
-
popsDOMUtils.trigger(folderListSortFileNameElement, "click", {
|
|
5639
|
-
notChangeSortRule: true,
|
|
5640
|
-
});
|
|
5641
|
-
}
|
|
5642
|
-
else if (config.sort.name === "latestTime") {
|
|
5643
|
-
popsDOMUtils.trigger(folderListSortLatestTimeElement, "click", {
|
|
5644
|
-
notChangeSortRule: true,
|
|
5645
|
-
});
|
|
5646
|
-
}
|
|
5647
|
-
else if (config.sort.name === "fileSize") {
|
|
5648
|
-
popsDOMUtils.trigger(folderListSortFileSizeElement, "click", {
|
|
5649
|
-
notChangeSortRule: true,
|
|
5650
|
-
});
|
|
5651
5691
|
}
|
|
5692
|
+
const popsFolder = new PopsFolder();
|
|
5693
|
+
popsFolder.init();
|
|
5694
|
+
Reflect.set($pops, "data-pops-folder", popsFolder);
|
|
5652
5695
|
/* 拖拽 */
|
|
5653
5696
|
if (config.drag) {
|
|
5654
5697
|
PopsInstanceUtils.drag($pops, {
|
|
@@ -11605,7 +11648,7 @@ System.register('pops', [], (function (exports) {
|
|
|
11605
11648
|
/** 配置 */
|
|
11606
11649
|
config = {
|
|
11607
11650
|
/** 版本号 */
|
|
11608
|
-
version: "2025.8.
|
|
11651
|
+
version: "2025.8.30",
|
|
11609
11652
|
cssText: PopsCSS,
|
|
11610
11653
|
/** icon图标的svg代码 */
|
|
11611
11654
|
iconSVG: PopsIcon.$data,
|