pops

纯JavaScript编写的弹窗,内置方法confirm、alert、prompt、loading、iframe、isPhone、tooltip、folder、panel、rightClickMenu。

当前为 2024-06-18 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/456485/1396237/pops.js

  1. (function (global, factory) {
  2. /**
  3. * 不使用define
  4. * typeof define === "function" && define.amd
  5. * define(factory)
  6. */
  7. if (typeof exports === "object" && typeof module !== "undefined") {
  8. /* 适用于NodeJs或typeScript */
  9. module.exports = factory();
  10. } else {
  11. // @ts-ignore
  12. global = typeof globalThis !== "undefined" ? globalThis : global || self;
  13. /* 适用于浏览器中,且this对象是window,如果this是其它,那么会在其它对象下注册(不可用)对象 */
  14. // @ts-ignore
  15. global.pops = factory(global.pops);
  16. }
  17. // @ts-ignore
  18. })(typeof window !== "undefined" ? window : this, function (AnotherPops) {
  19. "use strict";
  20.  
  21. const OriginPrototype = {
  22. Object: {
  23. defineProperty: Object.defineProperty,
  24. },
  25. };
  26.  
  27. /** 工具类 */
  28. const PopsUtils = {
  29. /** .on绑定的事件 @type {unique symbol} */
  30. SymbolEvents: Symbol(
  31. "events_" +
  32. (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
  33. ),
  34. // @ts-ignore
  35. assignJSON(target, source) {
  36. /* JSON数据存在即替换 */
  37. if (source == null) {
  38. return target;
  39. }
  40. for (var target_key in target) {
  41. if (typeof source[target_key] !== "undefined") {
  42. if (
  43. typeof source[target_key] === "object" &&
  44. !(source[target_key] instanceof Node)
  45. ) {
  46. target[target_key] = this.assignJSON(
  47. target[target_key],
  48. source[target_key]
  49. );
  50. } else {
  51. target[target_key] = source[target_key];
  52. }
  53. }
  54. }
  55. return target;
  56. },
  57. /**
  58. * 字符串转HTMLElement
  59. * @param {string} elementString
  60. * @returns {HTMLElement}
  61. */
  62. parseTextToDOM(elementString) {
  63. /* 去除前后的换行和空格 */
  64. elementString = elementString
  65. .replace(/^[\n|\s]*/g, "")
  66. .replace(/[\n|\s]*$/g, "");
  67. // @ts-ignore
  68. let targetElement = PopsDOMUtils.createElement("div", {
  69. innerHTML: elementString,
  70. });
  71. // @ts-ignore
  72. return targetElement.firstChild;
  73. },
  74. /**
  75. * 生成随机GUID
  76. * @returns {string}
  77. */
  78. getRandomGUID() {
  79. function randomId() {
  80. return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
  81. }
  82. return `${randomId()}${randomId()}-${randomId()}-${randomId()}-${randomId()}-${randomId()}${randomId()}${randomId()}`;
  83. },
  84. /**
  85. * 判断元素/页面中是否包含该元素
  86. * @param {HTMLElement} target (可选)
  87. * @param {HTMLElement[]|HTMLElement} sourceList
  88. */
  89. // @ts-ignore
  90. contains(target, sourceList) {
  91. if (arguments.length === 1) {
  92. return this.contains(
  93. document.body || document.documentElement,
  94. arguments[0]
  95. );
  96. }
  97. // @ts-ignore
  98. if (typeof sourceList[Symbol.iterator] === "function") {
  99. let flag = true;
  100. // @ts-ignore
  101. for (const sourceNode of sourceList) {
  102. if (!target.contains(sourceNode)) {
  103. flag = false;
  104. break;
  105. }
  106. }
  107. return flag;
  108. } else {
  109. // @ts-ignore
  110. return this.contains(target, [sourceList]);
  111. }
  112. },
  113. /**
  114. * 元素后追加元素
  115. * @param {HTMLElement} target (可选)
  116. * @param {HTMLElement[]|HTMLElement} sourceList
  117. */
  118. appendChild(target, sourceList) {
  119. if (arguments.length === 1) {
  120. this.appendChild(
  121. document.body || document.documentElement,
  122. arguments[0]
  123. );
  124. return;
  125. }
  126. // @ts-ignore
  127. if (typeof sourceList[Symbol.iterator] === "function") {
  128. // @ts-ignore
  129. sourceList.forEach((item) => {
  130. this.appendChild(target, item);
  131. });
  132. return;
  133. }
  134.  
  135. // @ts-ignore
  136. target.appendChild(sourceList);
  137. },
  138. /**
  139. * 删除配置中对应的对象
  140. * @param {any[]} targets
  141. * @param {string} guid
  142. * @param {boolean} removeAll 是否全部删除
  143. * @returns
  144. */
  145. configRemove(targets, guid, removeAll = false) {
  146. /**
  147. *
  148. * @param {PopsLayerCommonConfig} item
  149. */
  150. function removeItem(item) {
  151. item?.animElement?.remove();
  152. item?.popsElement?.remove();
  153. item?.maskElement?.remove();
  154. item?.$shadowContainer?.remove();
  155. }
  156. targets.forEach((target) => {
  157. target.forEach(
  158. /**
  159. * @param {PopsLayerCommonConfig} item
  160. * @param {number} index
  161. */
  162. (item, index) => {
  163. if (removeAll || item["guid"] === guid) {
  164. if (
  165. pops.config.animation.hasOwnProperty(
  166. // @ts-ignore
  167. item.animElement.getAttribute("anim")
  168. )
  169. ) {
  170. item.animElement.style.width = "100%";
  171. item.animElement.style.height = "100%";
  172. // @ts-ignore
  173. item.animElement.style["animation-name"] =
  174. item.animElement.getAttribute("anim") + "-reverse";
  175. if (
  176. pops.config.animation.hasOwnProperty(
  177. // @ts-ignore
  178. item.animElement.style["animation-name"]
  179. )
  180. ) {
  181. PopsDOMUtils.on(
  182. item.animElement,
  183. // @ts-ignore
  184. PopsDOMUtils.getAnimationEndNameList(),
  185. void 0,
  186. function () {
  187. removeItem(item);
  188. },
  189. {
  190. capture: true,
  191. }
  192. );
  193. } else {
  194. removeItem(item);
  195. }
  196. } else {
  197. removeItem(item);
  198. }
  199. target.splice(index, 1);
  200. }
  201. }
  202. );
  203. });
  204.  
  205. return targets;
  206. },
  207. /**
  208. * 隐藏
  209. * @param {"alert"|"confirm"|"prompt"|"loading"|"iframe"|"drawer"} popsType
  210. * @param {any[]} source
  211. * @param {string} guid
  212. * @param {PopsAlertDetails|PopsDrawerDetails|PopsPromptDetails|PopsConfirmDetails|PopsIframeDetails|PopsLoadingDetails|PopsPanelDetails|PopsFolderDetails} config
  213. * @param {HTMLElement} animElement
  214. * @param {HTMLElement} maskElement
  215. */
  216. hide(popsType, source, guid, config, animElement, maskElement) {
  217. let popsElement = animElement.querySelector(".pops[type-value]");
  218. if (popsType === "drawer") {
  219. setTimeout(() => {
  220. maskElement.style.setProperty("display", "none");
  221. // @ts-ignore
  222. if (["top", "bottom"].includes(config.direction)) {
  223. // @ts-ignore
  224. popsElement.style.setProperty("height", 0);
  225. // @ts-ignore
  226. } else if (["left", "right"].includes(config.direction)) {
  227. // @ts-ignore
  228. popsElement.style.setProperty("width", 0);
  229. } else {
  230. // @ts-ignore
  231. console.error("未知direction:", config.direction);
  232. }
  233. // @ts-ignore
  234. }, config.closeDelay);
  235. } else {
  236. source.forEach((item) => {
  237. if (item.guid === guid) {
  238. /* 存在动画 */
  239. item.animElement.style.width = "100%";
  240. item.animElement.style.height = "100%";
  241. item.animElement.style["animation-name"] =
  242. item.animElement.getAttribute("anim") + "-reverse";
  243. if (
  244. pops.config.animation.hasOwnProperty(
  245. item.animElement.style["animation-name"]
  246. )
  247. ) {
  248. function animationendCallBack() {
  249. item.animElement.style.display = "none";
  250. if (item.maskElement) {
  251. item.maskElement.style.display = "none";
  252. }
  253. PopsDOMUtils.off(
  254. item.animElement,
  255. // @ts-ignore
  256. PopsDOMUtils.getAnimationEndNameList(),
  257. void 0,
  258. animationendCallBack,
  259. {
  260. capture: true,
  261. }
  262. );
  263. }
  264. PopsDOMUtils.on(
  265. item.animElement,
  266. // @ts-ignore
  267. PopsDOMUtils.getAnimationEndNameList(),
  268. void 0,
  269. animationendCallBack,
  270. {
  271. capture: true,
  272. }
  273. );
  274. } else {
  275. item.animElement.style.display = "none";
  276. if (item.maskElement) {
  277. item.maskElement.style.display = "none";
  278. }
  279. }
  280.  
  281. return;
  282. }
  283. });
  284. }
  285. },
  286. /**
  287. * 显示
  288. * @param {"alert"|"confirm"|"prompt"|"loading"|"iframe"|"drawer"} popsType
  289. * @param {any[]} source
  290. * @param {string} guid
  291. * @param {PopsAlertDetails|PopsDrawerDetails|PopsPromptDetails|PopsConfirmDetails|PopsIframeDetails|PopsLoadingDetails|PopsPanelDetails|PopsFolderDetails} config
  292. * @param {HTMLElement} animElement
  293. * @param {HTMLElement} maskElement
  294. */
  295. show(popsType, source, guid, config, animElement, maskElement) {
  296. let popsElement = animElement.querySelector(".pops[type-value]");
  297. if (popsType === "drawer") {
  298. setTimeout(() => {
  299. maskElement.style.setProperty("display", "");
  300. // @ts-ignore
  301. if (["top", "bottom"].includes(config.direction)) {
  302. // @ts-ignore
  303. popsElement.style.setProperty("height", config.size);
  304. // @ts-ignore
  305. } else if (["left", "right"].includes(config.direction)) {
  306. // @ts-ignore
  307. popsElement.style.setProperty("width", config.size);
  308. } else {
  309. // @ts-ignore
  310. console.error("未知direction:", config.direction);
  311. }
  312. // @ts-ignore
  313. }, config.openDelay);
  314. } else {
  315. source.forEach((item) => {
  316. if (item.guid === guid) {
  317. item.animElement.style.width = "";
  318. item.animElement.style.height = "";
  319. item.animElement.style["animation-name"] = item.animElement
  320. .getAttribute("anim")
  321. .replace("-reverse", "");
  322. if (
  323. pops.config.animation.hasOwnProperty(
  324. item.animElement.style["animation-name"]
  325. )
  326. ) {
  327. item.animElement.style.display = "";
  328. if (item.maskElement) {
  329. item.maskElement.style.display = "";
  330. }
  331. function animationendCallBack() {
  332. PopsDOMUtils.off(
  333. item.animElement,
  334. // @ts-ignore
  335. PopsDOMUtils.getAnimationEndNameList(),
  336. void 0,
  337. animationendCallBack,
  338. {
  339. capture: true,
  340. }
  341. );
  342. }
  343. PopsDOMUtils.on(
  344. item.animElement,
  345. // @ts-ignore
  346. PopsDOMUtils.getAnimationEndNameList(),
  347. void 0,
  348. animationendCallBack,
  349. {
  350. capture: true,
  351. }
  352. );
  353. } else {
  354. item.animElement.style.display = "";
  355. if (item.maskElement) {
  356. item.maskElement.style.display = "";
  357. }
  358. }
  359. }
  360. return;
  361. });
  362. }
  363. },
  364. /**
  365. * 关闭
  366. * @param {string} popsType
  367. * @param {any} source
  368. * @param {string} guid
  369. * @param {PopsAlertDetails|PopsDrawerDetails|PopsPromptDetails|PopsConfirmDetails|PopsIframeDetails|PopsLoadingDetails|PopsPanelDetails|PopsFolderDetails} config
  370. * @param {HTMLElement} animElement
  371. */
  372. close(popsType, source, guid, config, animElement) {
  373. let popsElement = animElement.querySelector(".pops[type-value]");
  374. /**
  375. * 动画结束事件
  376. */
  377. function transitionendEvent() {
  378. /**
  379. *
  380. * @param {TransitionEvent} event
  381. */
  382. function closeCallBack(event) {
  383. if (event.propertyName !== "transform") {
  384. return;
  385. }
  386. // @ts-ignore
  387. PopsDOMUtils.off(
  388. popsElement,
  389. PopsDOMUtils.getTransitionEndNameList(),
  390. void 0,
  391. closeCallBack
  392. );
  393. PopsUtils.configRemove([source], guid);
  394. }
  395. /* 监听过渡结束 */
  396. // @ts-ignore
  397. PopsDOMUtils.on(
  398. popsElement,
  399. PopsDOMUtils.getTransitionEndNameList(),
  400. void 0,
  401. closeCallBack
  402. );
  403. // @ts-ignore
  404. let popsTransForm = getComputedStyle(popsElement).transform;
  405. if (popsTransForm !== "none") {
  406. PopsDOMUtils.trigger(
  407. // @ts-ignore
  408. popsElement,
  409. PopsDOMUtils.getTransitionEndNameList(),
  410. void 0,
  411. true
  412. );
  413. return;
  414. }
  415. // @ts-ignore
  416. if (["top"].includes(config.direction)) {
  417. // @ts-ignore
  418. popsElement.style.setProperty("transform", "translateY(-100%)");
  419. // @ts-ignore
  420. } else if (["bottom"].includes(config.direction)) {
  421. // @ts-ignore
  422. popsElement.style.setProperty("transform", "translateY(100%)");
  423. // @ts-ignore
  424. } else if (["left"].includes(config.direction)) {
  425. // @ts-ignore
  426. popsElement.style.setProperty("transform", "translateX(-100%)");
  427. // @ts-ignore
  428. } else if (["right"].includes(config.direction)) {
  429. // @ts-ignore
  430. popsElement.style.setProperty("transform", "translateX(100%)");
  431. } else {
  432. // @ts-ignore
  433. console.error("未知direction:", config.direction);
  434. }
  435. }
  436.  
  437. if (popsType === "drawer") {
  438. setTimeout(() => {
  439. transitionendEvent();
  440. // @ts-ignore
  441. }, config.closeDelay);
  442. } else {
  443. PopsUtils.configRemove([source], guid);
  444. }
  445. },
  446. /**
  447. * 获取所有弹窗中的最大的z-index
  448. * @param {number} defaultValue
  449. */
  450. getPopsMaxZIndex(defaultValue) {
  451. let maxZIndex = 0;
  452. // @ts-ignore
  453. let maxZIndexElement = null;
  454.  
  455. Object.keys(pops.config.layer).forEach((item) => {
  456. // @ts-ignore
  457. pops.config.layer[item].forEach(
  458. /**
  459. * @param {PopsLayerCommonConfig} item2
  460. */
  461. (item2) => {
  462. let itemZIndex = parseInt(
  463. getComputedStyle(item2["animElement"]).zIndex
  464. );
  465. maxZIndexElement =
  466. // @ts-ignore
  467. itemZIndex > maxZIndex ? item2["animElement"] : maxZIndexElement;
  468. maxZIndex = itemZIndex > maxZIndex ? itemZIndex : maxZIndex;
  469. }
  470. );
  471. });
  472. maxZIndex = maxZIndex === 0 ? defaultValue : maxZIndex;
  473. return { zIndex: maxZIndex, animElement: maxZIndexElement };
  474. },
  475. /**
  476. * 获取CSS Rule
  477. * @param {StyleSheet} sheet
  478. * @returns
  479. */
  480. getKeyFrames(sheet) {
  481. let result = {};
  482. // @ts-ignore
  483. Object.keys(sheet.cssRules).forEach((key) => {
  484. if (
  485. // @ts-ignore
  486. sheet.cssRules[key].type === 7 &&
  487. // @ts-ignore
  488. sheet.cssRules[key].name.startsWith("pops-anim-")
  489. ) {
  490. // @ts-ignore
  491. result[sheet.cssRules[key].name] = sheet.cssRules[key];
  492. }
  493. });
  494. return result;
  495. },
  496. /**
  497. * 拖拽元素
  498. * 说明:
  499. * + 元素的position为absolute或者fixed
  500. * + 会为元素的
  501. * @param {HTMLElement} moveElement
  502. * @param {{
  503. * dragElement: HTMLElement,
  504. * limit: boolean,
  505. * extraDistance: number,
  506. * container: Element|Window,
  507. * moveCallBack?: (moveElement: HTMLElement,left: number,top: number) => void,
  508. * endCallBack?: (moveElement: HTMLElement,left: number,top: number) => void,
  509. * preventEvent?: (event: TouchEvent|PointerEvent) => boolean;
  510. * }} options
  511. */
  512. // @ts-ignore
  513. drag(moveElement, options = {}) {
  514. options = Object.assign(
  515. {
  516. limit: true,
  517. extraDistance: 3,
  518. container: globalThis,
  519. },
  520. options
  521. );
  522. let isMove = false;
  523. /* 点击元素,left偏移 */
  524. let clickElementLeftOffset = 0;
  525. /* 点击元素,top偏移 */
  526. let clickElementTopOffset = 0;
  527. let AnyTouch = PopsUtils.AnyTouch();
  528. // @ts-ignore
  529. let anyTouchElement = new AnyTouch(options.dragElement, {
  530. // @ts-ignore
  531. preventEvent(event) {
  532. if (typeof options.preventEvent === "function") {
  533. return options.preventEvent(event);
  534. } else {
  535. return false;
  536. }
  537. },
  538. });
  539. // @ts-ignore
  540. PopsDOMUtils.css(options.dragElement, {
  541. cursor: "move",
  542. });
  543. /**
  544. * 获取移动元素的transform偏移
  545. */
  546. // @ts-ignore
  547. function getTransform(element) {
  548. let transform_left = 0;
  549. let transform_top = 0;
  550. let elementTransform = globalThis.getComputedStyle(element).transform;
  551. if (
  552. elementTransform !== "none" &&
  553. elementTransform != null &&
  554. elementTransform !== ""
  555. ) {
  556. // @ts-ignore
  557. let elementTransformSplit = elementTransform
  558. .match(/\((.+)\)/)[1]
  559. .split(",");
  560. transform_left = Math.abs(parseInt(elementTransformSplit[4]));
  561. transform_top = Math.abs(parseInt(elementTransformSplit[5]));
  562. }
  563. return {
  564. transformLeft: transform_left,
  565. transformTop: transform_top,
  566. };
  567. }
  568. /**
  569. * 修改移动的元素的style
  570. */
  571. // @ts-ignore
  572. function changeMoveElementStyle(element) {
  573. let old_transitionDuration = element.style.transitionDuration;
  574. if (globalThis.getComputedStyle(element).transitionDuration !== "0s") {
  575. element.style.transitionDuration = "0s";
  576. }
  577. return () => {
  578. element.style.transitionDuration = old_transitionDuration;
  579. };
  580. }
  581. /**
  582. * 获取容器的高度、宽度,一般是window为容器
  583. */
  584. // @ts-ignore
  585. function getContainerWidthOrHeight(container) {
  586. container = container ?? globalThis;
  587. return {
  588. width: PopsDOMUtils.width(container),
  589. height: PopsDOMUtils.height(container),
  590. };
  591. }
  592. /**
  593. * 获取容器的最小left、top偏移
  594. */
  595. // @ts-ignore
  596. function getContainerTopOrLeft(container) {
  597. container = container ?? globalThis;
  598. if (PopsUtils.isWin(container)) {
  599. return {
  600. left: 0,
  601. top: 0,
  602. };
  603. } else {
  604. let rect = container.getBoundingClientRect();
  605. return {
  606. left: rect.left,
  607. top: rect.top,
  608. };
  609. }
  610. }
  611. let transformInfo = getTransform(moveElement);
  612. let transformLeft = transformInfo.transformLeft;
  613. let transformTop = transformInfo.transformTop;
  614. // @ts-ignore
  615. let resumeMoveElementStyle = null;
  616. // @ts-ignore
  617. anyTouchElement.on("pan", function (event) {
  618. if (!isMove) {
  619. isMove = true;
  620. let rect = options.dragElement.getBoundingClientRect();
  621. clickElementLeftOffset = event.x - rect.left;
  622. clickElementTopOffset = event.y - rect.top;
  623. transformInfo = getTransform(moveElement);
  624. transformLeft = transformInfo.transformLeft;
  625. transformTop = transformInfo.transformTop;
  626. //if (event.nativeEvent.offsetX) {
  627. // clickElementLeftOffset = parseInt(event.nativeEvent.offsetX);
  628. //} else {
  629. // clickElementLeftOffset = parseInt(event.getOffset().x);
  630. //}
  631. //if (event.nativeEvent.offsetY) {
  632. // clickElementTopOffset = parseInt(event.nativeEvent.offsetY);
  633. //} else {
  634. // clickElementTopOffset = parseInt(event.getOffset().y);
  635. //}
  636. resumeMoveElementStyle = changeMoveElementStyle(moveElement);
  637. }
  638.  
  639. /** 当前移动的left偏移 */
  640. let currentMoveLeftOffset =
  641. event.x - clickElementLeftOffset + transformLeft;
  642. /** 当前移动的top偏移 */
  643. let currentMoveTopOffset =
  644. event.y - clickElementTopOffset + transformTop;
  645. /* 拖拽移动 */
  646. if (event.phase === "move") {
  647. if (options.limit) {
  648. /* 限制在容器内移动 */
  649. /* left偏移最大值 */
  650. let maxLeftOffset =
  651. getContainerWidthOrHeight(options.container).width -
  652. PopsDOMUtils.width(moveElement) +
  653. transformLeft;
  654. let { left: minLeftOffset, top: minTopOffset } =
  655. getContainerTopOrLeft(options.container);
  656. /* top偏移的最大值 */
  657. let maxTopOffset =
  658. getContainerWidthOrHeight(options.container).height -
  659. PopsDOMUtils.height(moveElement) +
  660. transformTop;
  661. if (currentMoveLeftOffset > maxLeftOffset) {
  662. /* 不允许超过容器的最大宽度 */
  663. currentMoveLeftOffset = maxLeftOffset;
  664. }
  665. if (currentMoveTopOffset > maxTopOffset) {
  666. /* 不允许超过容器的最大高度 */
  667. currentMoveTopOffset = maxTopOffset;
  668. }
  669. if (
  670. currentMoveLeftOffset - options.extraDistance * 2 <
  671. minLeftOffset + transformLeft
  672. ) {
  673. /* 不允许left偏移小于容器最小值 */
  674. currentMoveLeftOffset = minLeftOffset + transformLeft;
  675. /* 最左边 +额外距离 */
  676. currentMoveLeftOffset += options.extraDistance;
  677. } else {
  678. /* 最右边 -额外距离 */
  679. currentMoveLeftOffset -= options.extraDistance;
  680. }
  681. if (
  682. currentMoveTopOffset - options.extraDistance * 2 <
  683. minTopOffset + transformTop
  684. ) {
  685. /* 不允许top偏移小于容器最小值 */
  686. currentMoveTopOffset = minTopOffset + transformTop;
  687. /* 最上面 +额外距离 */
  688. currentMoveTopOffset += options.extraDistance;
  689. } else {
  690. /* 最下面 -额外距离 */
  691. currentMoveTopOffset -= options.extraDistance;
  692. }
  693. }
  694. if (typeof options.moveCallBack === "function") {
  695. options.moveCallBack(
  696. moveElement,
  697. currentMoveLeftOffset,
  698. currentMoveTopOffset
  699. );
  700. }
  701. // @ts-ignore
  702. PopsDOMUtils.css(moveElement, {
  703. left: currentMoveLeftOffset + "px",
  704. top: currentMoveTopOffset + "px",
  705. });
  706. }
  707.  
  708. /* 停止拖拽 */
  709. if (event.phase === "end") {
  710. isMove = false;
  711. // @ts-ignore
  712. if (typeof resumeMoveElementStyle === "function") {
  713. // @ts-ignore
  714. resumeMoveElementStyle();
  715. resumeMoveElementStyle = null;
  716. }
  717. if (typeof options.endCallBack === "function") {
  718. options.endCallBack(
  719. moveElement,
  720. currentMoveLeftOffset,
  721. currentMoveTopOffset
  722. );
  723. }
  724. }
  725. });
  726. /* 因为会覆盖上面的点击事件,主动触发一下 */
  727. // @ts-ignore
  728. anyTouchElement.on(["click", "tap"], function (event) {
  729. // @ts-ignore
  730. event.changedPoints.forEach((item) => {
  731. // @ts-ignore
  732. PopsDOMUtils.trigger(item.target, "click", void 0, transformLeft);
  733. });
  734. });
  735. },
  736. /**
  737. * AnyTouch
  738. * + https://fastly.jsdelivr.net/npm/any-touch@2.2.0/dist/any-touch.umd.min.js
  739. * + https://github.com/any86/any-touch/blob/master/README.CN.md
  740. */
  741. AnyTouch() {
  742. let anyTouch = null;
  743. // @ts-ignore
  744. // @ts-ignore
  745. (function (global, factory) {
  746. anyTouch = factory();
  747. })(this, function () {
  748. "use strict";
  749.  
  750. /*! *****************************************************************************
  751. Copyright (c) Microsoft Corporation.
  752. Permission to use, copy, modify, and/or distribute this software for any
  753. purpose with or without fee is hereby granted.
  754. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  755. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  756. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  757. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  758. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  759. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  760. PERFORMANCE OF THIS SOFTWARE.
  761. ***************************************************************************** */
  762. /* global Reflect, Promise */
  763.  
  764. // @ts-ignore
  765. var extendStatics = function (d, b) {
  766. extendStatics =
  767. Object.setPrototypeOf ||
  768. ({ __proto__: [] } instanceof Array &&
  769. function (d, b) {
  770. d.__proto__ = b;
  771. }) ||
  772. function (d, b) {
  773. for (var p in b)
  774. if (Object.hasOwnProperty.call(b, p)) d[p] = b[p];
  775. };
  776. return extendStatics(d, b);
  777. };
  778.  
  779. // @ts-ignore
  780. function __extends(d, b) {
  781. if (typeof b !== "function" && b !== null)
  782. throw new TypeError(
  783. "Class extends value " +
  784. String(b) +
  785. " is not a constructor or null"
  786. );
  787. extendStatics(d, b);
  788. function __() {
  789. this.constructor = d;
  790. }
  791. d.prototype =
  792. b === null
  793. ? Object.create(b)
  794. : ((__.prototype = b.prototype), new __());
  795. }
  796.  
  797. // @ts-ignore
  798. var __assign = function () {
  799. __assign =
  800. Object.assign ||
  801. function __assign(t) {
  802. for (var s, i = 1, n = arguments.length; i < n; i++) {
  803. s = arguments[i];
  804. for (var p in s)
  805. if (Object.hasOwnProperty.call(s, p)) t[p] = s[p];
  806. }
  807. return t;
  808. };
  809. // @ts-ignore
  810. return __assign.apply(this, arguments);
  811. };
  812.  
  813. // @ts-ignore
  814. function __values(o) {
  815. var s = typeof Symbol === "function" && Symbol.iterator,
  816. m = s && o[s],
  817. i = 0;
  818. if (m) return m.call(o);
  819. if (o && typeof o.length === "number")
  820. return {
  821. next: function () {
  822. if (o && i >= o.length) o = void 0;
  823. return { value: o && o[i++], done: !o };
  824. },
  825. };
  826. throw new TypeError(
  827. s ? "Object is not iterable." : "Symbol.iterator is not defined."
  828. );
  829. }
  830.  
  831. var AnyEvent = (function () {
  832. function AnyEvent() {
  833. this.__map = {};
  834. }
  835. // @ts-ignore
  836. AnyEvent.prototype.beforeEach = function (interceptor) {
  837. this.__interceptor = interceptor;
  838. };
  839. // @ts-ignore
  840. AnyEvent.prototype.on = function (typeOrTypes, listener) {
  841. var e_1, _a;
  842. var types = Array.isArray(typeOrTypes)
  843. ? typeOrTypes
  844. : [typeOrTypes];
  845. try {
  846. for (
  847. var types_1 = __values(types), types_1_1 = types_1.next();
  848. !types_1_1.done;
  849. types_1_1 = types_1.next()
  850. ) {
  851. var type = types_1_1.value;
  852. // @ts-ignore
  853. this.__map[type] = this.__map[type] || [];
  854. // @ts-ignore
  855. var listeners = this.__map[type];
  856. if (listeners) {
  857. listeners.push(listener);
  858. }
  859. }
  860. } catch (e_1_1) {
  861. e_1 = { error: e_1_1 };
  862. } finally {
  863. try {
  864. if (types_1_1 && !types_1_1.done && (_a = types_1.return))
  865. _a.call(types_1);
  866. } finally {
  867. if (e_1) throw e_1.error;
  868. }
  869. }
  870. return this;
  871. };
  872. // @ts-ignore
  873. AnyEvent.prototype.emit = function (type, payload, callback) {
  874. var _this = this;
  875. if (void 0 !== this.__interceptor) {
  876. this.__interceptor(type, function () {
  877. _this.__emit(type, payload);
  878. callback && callback();
  879. });
  880. } else {
  881. this.__emit(type, payload);
  882. callback && callback();
  883. }
  884. };
  885. // @ts-ignore
  886. AnyEvent.prototype.__emit = function (type, event) {
  887. var e_2, _a;
  888. // @ts-ignore
  889. var listeners = this.__map[type];
  890. if (
  891. Array.isArray(listeners) &&
  892. (listeners === null || listeners === void 0
  893. ? void 0
  894. : listeners.length)
  895. ) {
  896. try {
  897. for (
  898. var listeners_1 = __values(listeners),
  899. listeners_1_1 = listeners_1.next();
  900. !listeners_1_1.done;
  901. listeners_1_1 = listeners_1.next()
  902. ) {
  903. var listener = listeners_1_1.value;
  904. listener(event, type);
  905. }
  906. } catch (e_2_1) {
  907. e_2 = { error: e_2_1 };
  908. } finally {
  909. try {
  910. if (
  911. listeners_1_1 &&
  912. !listeners_1_1.done &&
  913. (_a = listeners_1.return)
  914. )
  915. _a.call(listeners_1);
  916. } finally {
  917. if (e_2) throw e_2.error;
  918. }
  919. }
  920. }
  921. this.event = event;
  922. };
  923. // @ts-ignore
  924. AnyEvent.prototype.off = function (type, listener) {
  925. // @ts-ignore
  926. var listeners = this.__map[type];
  927. if (void 0 !== listeners) {
  928. if (void 0 === listener) {
  929. // @ts-ignore
  930. delete this.__map[type];
  931. } else {
  932. // @ts-ignore
  933. var index = listeners.findIndex(function (cb) {
  934. return cb === listener;
  935. });
  936. listeners.splice(index, 1);
  937. }
  938. }
  939. };
  940. AnyEvent.prototype.destroy = function () {
  941. this.__map = {};
  942. };
  943. return AnyEvent;
  944. })();
  945.  
  946. var TOUCH_START = "touchstart";
  947. var TOUCH_MOVE = "touchmove";
  948. var TOUCH_END = "touchend";
  949. var TOUCH_CANCEL = "touchcancel";
  950. var MOUSE_UP = "mouseup";
  951. var MOUSE_MOVE = "mousemove";
  952. var MOUSE_DOWN = "mousedown";
  953. var TYPE_START$1 = "start";
  954. var TYPE_MOVE$1 = "move";
  955. var TYPE_END$1 = "end";
  956. // @ts-ignore
  957. function isFunction(input) {
  958. return "[object Function]" === Object.prototype.toString.call(input);
  959. }
  960.  
  961. var CLIENT_X = "clientX";
  962. var CLIENT_Y = "clientY";
  963. var COMPUTE_INTERVAL = 16;
  964. var TYPE_START = "start";
  965. var TYPE_MOVE = "move";
  966. var TYPE_CANCEL = "cancel";
  967. var TYPE_END = "end";
  968. var DIRECTION_LEFT = "left";
  969. var DIRECTION_RIGHT = "right";
  970. var DIRECTION_UP = "up";
  971. var DIRECTION_DOWN = "down";
  972.  
  973. var _a;
  974. var STATUS_CODE_AND_NAME_MAP =
  975. ((_a = {}),
  976. // @ts-ignore
  977. (_a[4] = TYPE_START),
  978. // @ts-ignore
  979. (_a[5] = TYPE_MOVE),
  980. // @ts-ignore
  981. (_a[1] = TYPE_END),
  982. // @ts-ignore
  983. (_a[3] = TYPE_CANCEL),
  984. _a);
  985. // @ts-ignore
  986. function getStatusName(code) {
  987. // @ts-ignore
  988. return STATUS_CODE_AND_NAME_MAP[code];
  989. }
  990. // @ts-ignore
  991. function flow(isVaild, lastStatus, phase) {
  992. var _a, _b, _c, _d, _e, _f, _g;
  993. var STATE_MAP = {
  994. 1:
  995. ((_a = {}),
  996. // @ts-ignore
  997. (_a[0] = ((_b = {}), (_b[TYPE_MOVE] = 4), _b)),
  998. // @ts-ignore
  999. (_a[4] =
  1000. ((_c = {}),
  1001. // @ts-ignore
  1002. (_c[TYPE_MOVE] = 5),
  1003. // @ts-ignore
  1004. (_c[TYPE_END] = 1),
  1005. // @ts-ignore
  1006. (_c[TYPE_CANCEL] = 3),
  1007. _c)),
  1008. // @ts-ignore
  1009. (_a[5] =
  1010. ((_d = {}),
  1011. // @ts-ignore
  1012. (_d[TYPE_MOVE] = 5),
  1013. // @ts-ignore
  1014. (_d[TYPE_END] = 1),
  1015. // @ts-ignore
  1016. (_d[TYPE_CANCEL] = 3),
  1017. _d)),
  1018. _a),
  1019. 0:
  1020. ((_e = {}),
  1021. // @ts-ignore
  1022. (_e[4] =
  1023. ((_f = {}),
  1024. // @ts-ignore
  1025. (_f[TYPE_MOVE] = 2),
  1026. // @ts-ignore
  1027. (_f[TYPE_END] = 1),
  1028. // @ts-ignore
  1029. (_f[TYPE_CANCEL] = 3),
  1030. _f)),
  1031. // @ts-ignore
  1032. (_e[5] =
  1033. ((_g = {}),
  1034. // @ts-ignore
  1035. (_g[TYPE_START] = 2),
  1036. // @ts-ignore
  1037. (_g[TYPE_MOVE] = 2),
  1038. // @ts-ignore
  1039. (_g[TYPE_END] = 1),
  1040. // @ts-ignore
  1041. (_g[TYPE_CANCEL] = 3),
  1042. _g)),
  1043. _e),
  1044. };
  1045. // @ts-ignore
  1046. var map = STATE_MAP[Number(isVaild)][lastStatus];
  1047. return (void 0 !== map && map[phase]) || 0;
  1048. }
  1049. // @ts-ignore
  1050. function resetState(context) {
  1051. if ([1, 3, 2].includes(context.state)) {
  1052. context.state = 0;
  1053. }
  1054. }
  1055. // @ts-ignore
  1056. function isMoveOrEndOrCancel(state) {
  1057. return [5, 1, 3].includes(state);
  1058. }
  1059. // @ts-ignore
  1060. function isDisabled(context) {
  1061. if (context.disabled) {
  1062. context.state = 0;
  1063. return true;
  1064. }
  1065. }
  1066.  
  1067. // @ts-ignore
  1068. function createPluginContext(defaultOptions, options) {
  1069. return __assign(__assign(__assign({}, defaultOptions), options), {
  1070. state: 0,
  1071. disabled: false,
  1072. });
  1073. }
  1074.  
  1075. // @ts-ignore
  1076. function round2(n) {
  1077. return Math.round(n * 100) / 100;
  1078. }
  1079.  
  1080. function inputCreator() {
  1081. var id = 0;
  1082. var prevInput;
  1083. // @ts-ignore
  1084. var activeInput;
  1085. // @ts-ignore
  1086. var startInput;
  1087. // @ts-ignore
  1088. var startMultiInput;
  1089. // @ts-ignore
  1090. return function (basicsInput) {
  1091. // @ts-ignore
  1092. prevInput = activeInput;
  1093. if (void 0 !== basicsInput) {
  1094. id = Number.MAX_SAFE_INTEGER > id ? ++id : 1;
  1095. var pureInput = extendInput(basicsInput, id);
  1096. activeInput = pureInput;
  1097. var isStart = pureInput.isStart,
  1098. pointLength = pureInput.pointLength;
  1099. if (isStart) {
  1100. startInput = pureInput;
  1101. prevInput = void 0;
  1102. if (1 < pointLength) {
  1103. startMultiInput = pureInput;
  1104. } else {
  1105. startMultiInput = void 0;
  1106. }
  1107. }
  1108. return __assign(__assign({}, pureInput), {
  1109. prevInput: prevInput,
  1110. // @ts-ignore
  1111. startMultiInput: startMultiInput,
  1112. // @ts-ignore
  1113. startInput: startInput,
  1114. });
  1115. }
  1116. };
  1117. }
  1118. // @ts-ignore
  1119. function getCenter(points) {
  1120. var length = points.length;
  1121. if (0 < length) {
  1122. if (1 === length) {
  1123. var _a = points[0],
  1124. clientX = _a.clientX,
  1125. clientY = _a.clientY;
  1126. return { x: Math.round(clientX), y: Math.round(clientY) };
  1127. }
  1128. var countPoint = points.reduce(
  1129. // @ts-ignore
  1130. function (countPoint, point) {
  1131. countPoint.x += point[CLIENT_X];
  1132. countPoint.y += point[CLIENT_Y];
  1133. return countPoint;
  1134. },
  1135. { x: 0, y: 0 }
  1136. );
  1137. return {
  1138. x: Math.round(countPoint.x / length),
  1139. y: Math.round(countPoint.y / length),
  1140. };
  1141. }
  1142. }
  1143. // @ts-ignore
  1144. function extendInput(basicsInput, id) {
  1145. var phase = basicsInput.phase,
  1146. points = basicsInput.points,
  1147. changedPoints = basicsInput.changedPoints,
  1148. nativeEvent = basicsInput.nativeEvent;
  1149. var pointLength = points.length;
  1150. var isStart = TYPE_START === phase;
  1151. var isEnd =
  1152. (TYPE_END === phase && 0 === pointLength) || TYPE_CANCEL === phase;
  1153. var timestamp = Date.now();
  1154. var _a = getCenter(points) || getCenter(changedPoints),
  1155. // @ts-ignore
  1156. x = _a.x,
  1157. // @ts-ignore
  1158. y = _a.y;
  1159. var currentTarget = nativeEvent.currentTarget;
  1160. return Object.assign(basicsInput, {
  1161. id: id,
  1162. x: x,
  1163. y: y,
  1164. timestamp: timestamp,
  1165. isStart: isStart,
  1166. isEnd: isEnd,
  1167. pointLength: pointLength,
  1168. currentTarget: currentTarget,
  1169. // @ts-ignore
  1170. getOffset: function (el) {
  1171. if (el === void 0) {
  1172. el = currentTarget;
  1173. }
  1174. var rect = el.getBoundingClientRect();
  1175. return {
  1176. x: x - Math.round(rect.left),
  1177. y: y - Math.round(rect.top),
  1178. };
  1179. },
  1180. });
  1181. }
  1182.  
  1183. function mouse() {
  1184. // @ts-ignore
  1185. var prevPoints;
  1186. var isPressed = false;
  1187. // @ts-ignore
  1188. var _target = null;
  1189. var createInput = inputCreator();
  1190. // @ts-ignore
  1191. return function (event) {
  1192. var clientX = event.clientX,
  1193. clientY = event.clientY,
  1194. type = event.type,
  1195. button = event.button,
  1196. target = event.target;
  1197. var points = [
  1198. { clientX: clientX, clientY: clientY, target: target },
  1199. ];
  1200. var phase;
  1201. if (MOUSE_DOWN === type && 0 === button) {
  1202. _target = target;
  1203. isPressed = true;
  1204. phase = TYPE_START$1;
  1205. } else if (isPressed) {
  1206. if (MOUSE_MOVE === type) {
  1207. phase = TYPE_MOVE$1;
  1208. } else if (MOUSE_UP === type) {
  1209. points = [];
  1210. phase = TYPE_END$1;
  1211. isPressed = false;
  1212. }
  1213. } else {
  1214. return;
  1215. }
  1216. // @ts-ignore
  1217. var changedPoints = prevPoints || [
  1218. { clientX: clientX, clientY: clientY, target: target },
  1219. ];
  1220. prevPoints = [
  1221. { clientX: clientX, clientY: clientY, target: target },
  1222. ];
  1223. if (void 0 !== phase) {
  1224. return createInput({
  1225. phase: phase,
  1226. changedPoints: changedPoints,
  1227. points: points,
  1228. // @ts-ignore
  1229. target: _target,
  1230. // @ts-ignore
  1231. targets: [_target],
  1232. nativeEvent: event,
  1233. });
  1234. }
  1235. };
  1236. }
  1237.  
  1238. // @ts-ignore
  1239. function touch(el) {
  1240. var createInput = inputCreator();
  1241. // @ts-ignore
  1242. return function (event) {
  1243. // @ts-ignore
  1244. var targets = [];
  1245. // @ts-ignore
  1246. var points = [];
  1247. Array.from(event.touches).forEach(function (_a) {
  1248. var clientX = _a.clientX,
  1249. clientY = _a.clientY,
  1250. target = _a.target;
  1251. if (el === null || el === void 0 ? void 0 : el.contains(target)) {
  1252. targets.push(target);
  1253. points.push({
  1254. clientX: clientX,
  1255. clientY: clientY,
  1256. target: target,
  1257. });
  1258. }
  1259. });
  1260. var changedPoints = Array.from(event.changedTouches).map(function (
  1261. _a
  1262. ) {
  1263. var clientX = _a.clientX,
  1264. clientY = _a.clientY,
  1265. target = _a.target;
  1266. return { clientX: clientX, clientY: clientY, target: target };
  1267. });
  1268. return createInput({
  1269. phase: event.type.replace("touch", ""),
  1270. changedPoints: changedPoints,
  1271. // @ts-ignore
  1272. points: points,
  1273. nativeEvent: event,
  1274. target: event.target,
  1275. // @ts-ignore
  1276. targets: targets,
  1277. });
  1278. };
  1279. }
  1280.  
  1281. // @ts-ignore
  1282. function dispatchDomEvent(typeName, el, payload, eventInit) {
  1283. var data = {};
  1284. for (var key in payload) {
  1285. if (!["target", "currentTarget", "type"].includes(key)) {
  1286. // @ts-ignore
  1287. data[key] = payload[key];
  1288. }
  1289. }
  1290. // @ts-ignore
  1291. var event;
  1292. if (document.createEvent) {
  1293. event = document.createEvent("HTMLEvents");
  1294. event.initEvent(
  1295. typeName,
  1296. eventInit === null || eventInit === void 0
  1297. ? void 0
  1298. : eventInit.bubbles,
  1299. eventInit === null || eventInit === void 0
  1300. ? void 0
  1301. : eventInit.cancelable
  1302. );
  1303. } else {
  1304. event = new Event(typeName, eventInit);
  1305. }
  1306. Object.assign(event, data, {
  1307. match: function () {
  1308. return (
  1309. payload.targets &&
  1310. 0 < payload.targets.length &&
  1311. // @ts-ignore
  1312. payload.targets.every(function (target) {
  1313. // @ts-ignore
  1314. return event.currentTarget.contains(target);
  1315. })
  1316. );
  1317. },
  1318. });
  1319. return el.dispatchEvent(event);
  1320. }
  1321.  
  1322. // @ts-ignore
  1323. function canPreventDefault(event, options) {
  1324. var preventDefault = options.preventDefault;
  1325. if (isFunction(preventDefault)) {
  1326. return preventDefault(event);
  1327. } else {
  1328. return !!preventDefault;
  1329. }
  1330. }
  1331.  
  1332. var ELEMENT_TYPES = [
  1333. TOUCH_START,
  1334. TOUCH_MOVE,
  1335. TOUCH_END,
  1336. TOUCH_CANCEL,
  1337. MOUSE_DOWN,
  1338. ];
  1339. var WINDOW_TYPES = [MOUSE_MOVE, MOUSE_UP];
  1340. // @ts-ignore
  1341. function bindElement(el, catchEvent, options) {
  1342. ELEMENT_TYPES.forEach(function (type) {
  1343. el.addEventListener(type, catchEvent, options);
  1344. });
  1345. WINDOW_TYPES.forEach(function (type) {
  1346. window.addEventListener(type, catchEvent, options);
  1347. });
  1348. return function () {
  1349. ELEMENT_TYPES.forEach(function (types) {
  1350. el.removeEventListener(types, catchEvent);
  1351. });
  1352. WINDOW_TYPES.forEach(function (type) {
  1353. window.removeEventListener(type, catchEvent);
  1354. });
  1355. };
  1356. }
  1357.  
  1358. var TYPE_COMPUTED = "computed";
  1359. var DEFAULT_OPTIONS$6 = {
  1360. domEvents: { bubbles: true, cancelable: true },
  1361. // @ts-ignore
  1362. preventDefault: function (event) {
  1363. if (event.target && "tagName" in event.target) {
  1364. var tagName = event.target.tagName;
  1365. return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(tagName);
  1366. }
  1367. return false;
  1368. },
  1369. };
  1370. var TYPE_UNBIND = "u";
  1371. var TYPE_INPUT = "input";
  1372. var TYPE_AT_AFTER = "at:after";
  1373. var default_1$1 = (function (_super) {
  1374. __extends(default_1, _super);
  1375. // @ts-ignore
  1376. function default_1(el, options) {
  1377. var _a;
  1378. // @ts-ignore
  1379. var _this = _super.call(this) || this;
  1380. // @ts-ignore
  1381. _this.v = "2.1.3";
  1382. // @ts-ignore
  1383. _this.__computeFunctionList = [];
  1384. // @ts-ignore
  1385. _this.__computeFunctionCreatorList = [];
  1386. // @ts-ignore
  1387. _this.__pluginContexts = [];
  1388. _this.__isIgnoreMouse = false;
  1389. // @ts-ignore
  1390. _this.el = el;
  1391. _this.c = {};
  1392. _this.__options = __assign(
  1393. __assign({}, DEFAULT_OPTIONS$6),
  1394. options
  1395. );
  1396. // @ts-ignore
  1397. var createInputFromTouch = touch(_this.el);
  1398. var createInputFromMouse = mouse();
  1399. // @ts-ignore
  1400. _this.__inputCreatorMap =
  1401. ((_a = {}),
  1402. // @ts-ignore
  1403. (_a[TOUCH_START] = createInputFromTouch),
  1404. // @ts-ignore
  1405. (_a[TOUCH_MOVE] = createInputFromTouch),
  1406. // @ts-ignore
  1407. (_a[TOUCH_END] = createInputFromTouch),
  1408. // @ts-ignore
  1409. (_a[TOUCH_CANCEL] = createInputFromTouch),
  1410. // @ts-ignore
  1411. (_a[MOUSE_DOWN] = createInputFromMouse),
  1412. // @ts-ignore
  1413. (_a[MOUSE_MOVE] = createInputFromMouse),
  1414. // @ts-ignore
  1415. (_a[MOUSE_UP] = createInputFromMouse),
  1416. _a);
  1417. // @ts-ignore
  1418. _this.on(TYPE_AT_AFTER, function (payload) {
  1419. var target = payload.target,
  1420. __type = payload.__type;
  1421. var domEvents = _this.__options.domEvents;
  1422. // @ts-ignore
  1423. if (!!domEvents && void 0 !== _this.el && !!target) {
  1424. dispatchDomEvent(__type, target, payload, domEvents);
  1425. dispatchDomEvent(TYPE_AT_AFTER, target, payload, domEvents);
  1426. }
  1427. });
  1428. if (void 0 !== el) {
  1429. el.style.webkitTapHighlightColor = "rgba(0,0,0,0)";
  1430. var supportsPassive_1 = false;
  1431. try {
  1432. var opts = {};
  1433. OriginPrototype.Object.defineProperty(opts, "passive", {
  1434. get: function () {
  1435. supportsPassive_1 = true;
  1436. },
  1437. });
  1438. window.addEventListener(
  1439. "_",
  1440. function () {
  1441. return void 0;
  1442. },
  1443. opts
  1444. );
  1445. } catch (_b) {}
  1446. // @ts-ignore
  1447. _this.on(
  1448. TYPE_UNBIND,
  1449. bindElement(
  1450. el,
  1451. _this.catchEvent.bind(_this),
  1452. false === _this.__options.preventDefault && supportsPassive_1
  1453. ? { passive: true }
  1454. : { passive: false }
  1455. )
  1456. );
  1457. }
  1458. return _this;
  1459. }
  1460. // @ts-ignore
  1461. default_1.prototype.use = function (plugin, pluginOptions) {
  1462. // @ts-ignore
  1463. this.__pluginContexts.push(plugin(this, pluginOptions));
  1464. };
  1465. // @ts-ignore
  1466. default_1.prototype.catchEvent = function (event) {
  1467. // @ts-ignore
  1468. var input = this.__inputCreatorMap[event.type](event);
  1469. if (void 0 !== input) {
  1470. var stopPropagation = function () {
  1471. return event.stopPropagation();
  1472. };
  1473. var stopImmediatePropagation = function () {
  1474. return event.stopImmediatePropagation();
  1475. };
  1476. var preventDefault = function () {
  1477. return event.preventDefault();
  1478. };
  1479. if (canPreventDefault(event, this.__options)) {
  1480. preventDefault();
  1481. } else {
  1482. if ("touchstart" === event.type) {
  1483. this.__isIgnoreMouse = true;
  1484. } else if ("touchmove" === event.type) {
  1485. this.__isIgnoreMouse = false;
  1486. }
  1487. if (this.__isIgnoreMouse && event.type.startsWith("mouse")) {
  1488. if ("mouseup" === event.type) {
  1489. this.__isIgnoreMouse = false;
  1490. }
  1491. return;
  1492. }
  1493. }
  1494. // @ts-ignore
  1495. this.emit(TYPE_INPUT, input);
  1496. this.emit2("at:".concat(input.phase), input, {});
  1497. var computed_1 = {};
  1498. // @ts-ignore
  1499. this.__computeFunctionList.forEach(function (compute) {
  1500. var result = compute(input, computed_1);
  1501. if (void 0 !== result) {
  1502. for (var key in result) {
  1503. // @ts-ignore
  1504. computed_1[key] = result[key];
  1505. }
  1506. }
  1507. });
  1508. // @ts-ignore
  1509. this.emit(
  1510. TYPE_COMPUTED,
  1511. __assign(__assign(__assign({}, input), computed_1), {
  1512. stopPropagation: stopPropagation,
  1513. stopImmediatePropagation: stopImmediatePropagation,
  1514. preventDefault: preventDefault,
  1515. })
  1516. );
  1517. }
  1518. };
  1519. default_1.prototype.compute = function (
  1520. // @ts-ignore
  1521. computeFunctionCreatorList,
  1522. // @ts-ignore
  1523. callback
  1524. ) {
  1525. var e_1, _a;
  1526. try {
  1527. for (
  1528. var computeFunctionCreatorList_1 = __values(
  1529. computeFunctionCreatorList
  1530. ),
  1531. computeFunctionCreatorList_1_1 =
  1532. computeFunctionCreatorList_1.next();
  1533. !computeFunctionCreatorList_1_1.done;
  1534. computeFunctionCreatorList_1_1 =
  1535. computeFunctionCreatorList_1.next()
  1536. ) {
  1537. var computeFunctionCreator =
  1538. computeFunctionCreatorList_1_1.value;
  1539. if (
  1540. // @ts-ignore
  1541. !this.__computeFunctionCreatorList.includes(
  1542. computeFunctionCreator
  1543. )
  1544. ) {
  1545. // @ts-ignore
  1546. this.__computeFunctionCreatorList.push(
  1547. computeFunctionCreator
  1548. );
  1549. // @ts-ignore
  1550. this.__computeFunctionList.push(computeFunctionCreator());
  1551. }
  1552. }
  1553. } catch (e_1_1) {
  1554. e_1 = { error: e_1_1 };
  1555. } finally {
  1556. try {
  1557. if (
  1558. computeFunctionCreatorList_1_1 &&
  1559. !computeFunctionCreatorList_1_1.done &&
  1560. (_a = computeFunctionCreatorList_1.return)
  1561. )
  1562. _a.call(computeFunctionCreatorList_1);
  1563. } finally {
  1564. if (e_1) throw e_1.error;
  1565. }
  1566. }
  1567. // @ts-ignore
  1568. this.on(TYPE_COMPUTED, callback);
  1569. };
  1570. // @ts-ignore
  1571. default_1.prototype.beforeEach = function (interceptor) {
  1572. var _this = this;
  1573. // @ts-ignore
  1574. _super.prototype.beforeEach.call(this, function (type, next) {
  1575. var _a;
  1576. if ((_a = _this.c) === null || _a === void 0 ? void 0 : _a.name) {
  1577. interceptor(type, next);
  1578. } else {
  1579. next();
  1580. }
  1581. });
  1582. };
  1583. // @ts-ignore
  1584. default_1.prototype.get = function (name) {
  1585. // @ts-ignore
  1586. return this.__pluginContexts.find(function (pluginContext) {
  1587. return name === pluginContext.name;
  1588. });
  1589. };
  1590. // @ts-ignore
  1591. default_1.prototype.set = function (newOptions) {
  1592. this.__options = __assign(__assign({}, this.__options), newOptions);
  1593. };
  1594. // @ts-ignore
  1595. default_1.prototype.emit2 = function (type, payload, pluginContext) {
  1596. var _this = this;
  1597. this.c = pluginContext;
  1598. // @ts-ignore
  1599. this.emit(
  1600. type,
  1601. __assign(__assign({}, payload), { type: type }),
  1602. function () {
  1603. // @ts-ignore
  1604. _this.emit(
  1605. TYPE_AT_AFTER,
  1606. __assign(__assign({}, payload), { name: type, __type: type })
  1607. );
  1608. }
  1609. );
  1610. };
  1611. default_1.prototype.destroy = function () {
  1612. // @ts-ignore
  1613. this.emit(TYPE_UNBIND);
  1614. _super.prototype.destroy.call(this);
  1615. };
  1616. return default_1;
  1617. })(AnyEvent);
  1618.  
  1619. // @ts-ignore
  1620. var getVLength = function (v) {
  1621. return Math.sqrt(v.x * v.x + v.y * v.y);
  1622. };
  1623.  
  1624. // @ts-ignore
  1625. var getDotProduct = function (v1, v2) {
  1626. return v1.x * v2.x + v1.y * v2.y;
  1627. };
  1628.  
  1629. // @ts-ignore
  1630. var getRadian = function (v1, v2) {
  1631. var mr = getVLength(v1) * getVLength(v2);
  1632. if (mr === 0) return 0;
  1633. var r = getDotProduct(v1, v2) / mr;
  1634. if (r > 1) r = 1;
  1635. return Math.acos(r);
  1636. };
  1637.  
  1638. // @ts-ignore
  1639. var getCross = function (v1, v2) {
  1640. return v1.x * v2.y - v2.x * v1.y;
  1641. };
  1642.  
  1643. // @ts-ignore
  1644. var radianToAngle = function (radian) {
  1645. return (radian / Math.PI) * 180;
  1646. };
  1647.  
  1648. // @ts-ignore
  1649. var getAngle = function (v1, v2) {
  1650. var angle = getRadian(v1, v2);
  1651. if (getCross(v1, v2) > 0) {
  1652. angle *= -1;
  1653. }
  1654. return radianToAngle(angle);
  1655. };
  1656.  
  1657. // @ts-ignore
  1658. var getDirection = function (x, y) {
  1659. if (0 === x && 0 === y) {
  1660. return;
  1661. }
  1662. if (Math.abs(x) >= Math.abs(y)) {
  1663. return 0 < x ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1664. } else {
  1665. return 0 < y ? DIRECTION_DOWN : DIRECTION_UP;
  1666. }
  1667. };
  1668.  
  1669. function ComputeAngle() {
  1670. var angle = 0;
  1671. var deltaAngle = 0;
  1672. // @ts-ignore
  1673. // @ts-ignore
  1674. return function (input, computed) {
  1675. var prevVecotr = computed.prevVecotr,
  1676. startVecotr = computed.startVecotr,
  1677. activeVecotr = computed.activeVecotr;
  1678. if (activeVecotr) {
  1679. deltaAngle = Math.round(getAngle(activeVecotr, prevVecotr));
  1680. angle = Math.round(getAngle(activeVecotr, startVecotr));
  1681. }
  1682. return { angle: angle, deltaAngle: deltaAngle };
  1683. };
  1684. }
  1685.  
  1686. function ComputeDeltaXY() {
  1687. // @ts-ignore
  1688. return function (input) {
  1689. var prevInput = input.prevInput;
  1690. var deltaX = 0;
  1691. var deltaY = 0;
  1692. var deltaXYAngle = 0;
  1693. if (void 0 !== prevInput) {
  1694. deltaX = input.x - prevInput.x;
  1695. deltaY = input.y - prevInput.y;
  1696. if (0 !== deltaX || 0 !== deltaY) {
  1697. var deltaXY = Math.sqrt(
  1698. Math.pow(deltaX, 2) + Math.pow(deltaY, 2)
  1699. );
  1700. deltaXYAngle = Math.round(
  1701. radianToAngle(Math.acos(Math.abs(deltaX) / deltaXY))
  1702. );
  1703. }
  1704. }
  1705. return {
  1706. deltaX: deltaX,
  1707. deltaY: deltaY,
  1708. deltaXYAngle: deltaXYAngle,
  1709. };
  1710. };
  1711. }
  1712.  
  1713. function ComputeDistance() {
  1714. var displacementX = 0;
  1715. var displacementY = 0;
  1716. var distanceX = 0;
  1717. var distanceY = 0;
  1718. var distance = 0;
  1719. // @ts-ignore
  1720. var overallDirection;
  1721. // @ts-ignore
  1722. return function (input) {
  1723. var phase = input.phase,
  1724. startInput = input.startInput;
  1725. if (TYPE_START === phase) {
  1726. displacementX = 0;
  1727. displacementY = 0;
  1728. distanceX = 0;
  1729. distanceY = 0;
  1730. distance = 0;
  1731. } else if (TYPE_MOVE === phase) {
  1732. displacementX = Math.round(
  1733. input.points[0][CLIENT_X] - startInput.points[0][CLIENT_X]
  1734. );
  1735. displacementY = Math.round(
  1736. input.points[0][CLIENT_Y] - startInput.points[0][CLIENT_Y]
  1737. );
  1738. distanceX = Math.abs(displacementX);
  1739. distanceY = Math.abs(displacementY);
  1740. distance = Math.round(getVLength({ x: distanceX, y: distanceY }));
  1741. overallDirection = getDirection(displacementX, displacementY);
  1742. }
  1743. return {
  1744. displacementX: displacementX,
  1745. displacementY: displacementY,
  1746. distanceX: distanceX,
  1747. distanceY: distanceY,
  1748. distance: distance,
  1749. // @ts-ignore
  1750. overallDirection: overallDirection,
  1751. };
  1752. };
  1753. }
  1754.  
  1755. function ComputeScale() {
  1756. var scale = 1;
  1757. // @ts-ignore
  1758. // @ts-ignore
  1759. return function (input, computed) {
  1760. var deltaScale = 1;
  1761. var prevVecotr = computed.prevVecotr,
  1762. startVecotr = computed.startVecotr,
  1763. activeVecotr = computed.activeVecotr;
  1764. if (activeVecotr) {
  1765. deltaScale = round2(
  1766. getVLength(activeVecotr) / getVLength(prevVecotr)
  1767. );
  1768. scale = round2(
  1769. getVLength(activeVecotr) / getVLength(startVecotr)
  1770. );
  1771. }
  1772. return { scale: scale, deltaScale: deltaScale };
  1773. };
  1774. }
  1775.  
  1776. function ComputeVAndDir() {
  1777. var velocityX = 0;
  1778. var velocityY = 0;
  1779. var speedX = 0;
  1780. var speedY = 0;
  1781. // @ts-ignore
  1782. var direction;
  1783. // @ts-ignore
  1784. var lastValidInput;
  1785. // @ts-ignore
  1786. return function (input) {
  1787. if (void 0 !== input) {
  1788. // @ts-ignore
  1789. lastValidInput = lastValidInput || input.startInput;
  1790. var deltaTime = input.timestamp - lastValidInput.timestamp;
  1791. if (COMPUTE_INTERVAL < deltaTime) {
  1792. var deltaX = input.x - lastValidInput.x;
  1793. var deltaY = input.y - lastValidInput.y;
  1794. speedX = Math.round((deltaX / deltaTime) * 100) / 100;
  1795. speedY = Math.round((deltaY / deltaTime) * 100) / 100;
  1796. velocityX = Math.abs(speedX);
  1797. velocityY = Math.abs(speedY);
  1798. direction = getDirection(deltaX, deltaY);
  1799. lastValidInput = input;
  1800. }
  1801. }
  1802. return {
  1803. velocityX: velocityX,
  1804. velocityY: velocityY,
  1805. speedX: speedX,
  1806. speedY: speedY,
  1807. // @ts-ignore
  1808. direction: direction,
  1809. };
  1810. };
  1811. }
  1812.  
  1813. function ComputeMaxLength() {
  1814. var maxPointLength = 0;
  1815. // @ts-ignore
  1816. return function (input) {
  1817. var phase = input.phase;
  1818. if (TYPE_START === phase) {
  1819. maxPointLength = input.pointLength;
  1820. }
  1821. return { maxPointLength: maxPointLength };
  1822. };
  1823. }
  1824.  
  1825. // @ts-ignore
  1826. function computeVector(input) {
  1827. return {
  1828. x: input.points[1][CLIENT_X] - input.points[0][CLIENT_X],
  1829. y: input.points[1][CLIENT_Y] - input.points[0][CLIENT_Y],
  1830. };
  1831. }
  1832. function ComputeVectorForMutli() {
  1833. // @ts-ignore
  1834. var startVecotr;
  1835. // @ts-ignore
  1836. var prevVecotr;
  1837. var activeVecotr;
  1838. // @ts-ignore
  1839. return function (input) {
  1840. var prevInput = input.prevInput,
  1841. startMultiInput = input.startMultiInput;
  1842. if (
  1843. void 0 !== startMultiInput &&
  1844. void 0 !== prevInput &&
  1845. input.id !== startMultiInput.id &&
  1846. 1 < prevInput.pointLength &&
  1847. 1 < input.pointLength
  1848. ) {
  1849. startVecotr = computeVector(startMultiInput);
  1850. prevVecotr = computeVector(prevInput);
  1851. activeVecotr = computeVector(input);
  1852. } else {
  1853. activeVecotr = void 0;
  1854. }
  1855. return {
  1856. // @ts-ignore
  1857. startVecotr: startVecotr,
  1858. // @ts-ignore
  1859. prevVecotr: prevVecotr,
  1860. activeVecotr: activeVecotr,
  1861. };
  1862. };
  1863. }
  1864.  
  1865. var DEFAULT_OPTIONS$5 = {
  1866. name: "tap",
  1867. pointLength: 1,
  1868. tapTimes: 1,
  1869. waitNextTapTime: 300,
  1870. maxDistance: 2,
  1871. maxDistanceFromPrevTap: 9,
  1872. maxPressTime: 250,
  1873. };
  1874. // @ts-ignore
  1875. function tap(at, options) {
  1876. var context = createPluginContext(DEFAULT_OPTIONS$5, options);
  1877. var tapCount = 0;
  1878. // @ts-ignore
  1879. var prevTapPoint;
  1880. // @ts-ignore
  1881. var prevTapTime;
  1882. // @ts-ignore
  1883. var countDownToFailTimer;
  1884. function reset() {
  1885. tapCount = 0;
  1886. prevTapPoint = void 0;
  1887. prevTapTime = void 0;
  1888. }
  1889. function countDownToFail() {
  1890. countDownToFailTimer = setTimeout(function () {
  1891. context.state = 2;
  1892. reset();
  1893. }, context.waitNextTapTime);
  1894. }
  1895. // @ts-ignore
  1896. function isValidDistanceFromPrevTap(center, options) {
  1897. // @ts-ignore
  1898. if (void 0 !== prevTapPoint) {
  1899. var distanceFromPreviousTap = getVLength({
  1900. // @ts-ignore
  1901. x: center.x - prevTapPoint.x,
  1902. // @ts-ignore
  1903. y: center.y - prevTapPoint.y,
  1904. });
  1905. prevTapPoint = center;
  1906. return options.maxDistanceFromPrevTap >= distanceFromPreviousTap;
  1907. } else {
  1908. prevTapPoint = center;
  1909. return true;
  1910. }
  1911. }
  1912. // @ts-ignore
  1913. function isValidInterval(waitNextTapTime) {
  1914. var now = performance.now();
  1915. // @ts-ignore
  1916. if (void 0 === prevTapTime) {
  1917. prevTapTime = now;
  1918. return true;
  1919. } else {
  1920. // @ts-ignore
  1921. var interval = now - prevTapTime;
  1922. prevTapTime = now;
  1923. return interval < waitNextTapTime;
  1924. }
  1925. }
  1926. // @ts-ignore
  1927. at.compute([ComputeDistance, ComputeMaxLength], function (computed) {
  1928. if (isDisabled(context)) return;
  1929. var phase = computed.phase,
  1930. x = computed.x,
  1931. y = computed.y;
  1932. if (TYPE_END !== phase) return;
  1933. context.state = 0;
  1934. if (test()) {
  1935. // @ts-ignore
  1936. clearTimeout(countDownToFailTimer);
  1937. if (
  1938. isValidDistanceFromPrevTap({ x: x, y: y }, context) &&
  1939. isValidInterval(context.waitNextTapTime)
  1940. ) {
  1941. tapCount++;
  1942. } else {
  1943. tapCount = 1;
  1944. }
  1945. if (0 === tapCount % context.tapTimes) {
  1946. context.state = 1;
  1947. at.emit2(context.name, computed, context);
  1948. reset();
  1949. } else {
  1950. countDownToFail();
  1951. }
  1952. } else {
  1953. reset();
  1954. context.state = 2;
  1955. }
  1956. function test() {
  1957. var startInput = computed.startInput,
  1958. pointLength = computed.pointLength,
  1959. timestamp = computed.timestamp;
  1960. var deltaTime = timestamp - startInput.timestamp;
  1961. var distance = computed.distance,
  1962. maxPointLength = computed.maxPointLength;
  1963. return (
  1964. maxPointLength === context.pointLength &&
  1965. 0 === pointLength &&
  1966. context.maxDistance >= distance &&
  1967. context.maxPressTime > deltaTime
  1968. );
  1969. }
  1970. });
  1971. return context;
  1972. }
  1973.  
  1974. var DEFAULT_OPTIONS$4 = { name: "pan", threshold: 10, pointLength: 1 };
  1975. // @ts-ignore
  1976. function pan(at, options) {
  1977. var context = createPluginContext(DEFAULT_OPTIONS$4, options);
  1978. at.compute(
  1979. [ComputeVAndDir, ComputeDistance, ComputeDeltaXY],
  1980. // @ts-ignore
  1981. function (computed) {
  1982. resetState(context);
  1983. if (isDisabled(context)) return;
  1984. var isValid = test();
  1985. context.state = flow(isValid, context.state, computed.phase);
  1986. if (isValid || isMoveOrEndOrCancel(context.state)) {
  1987. var name_1 = context.name;
  1988. at.emit2(name_1, computed, context);
  1989. at.emit2(
  1990. name_1 + getStatusName(context.state),
  1991. computed,
  1992. context
  1993. );
  1994. if (
  1995. ![TYPE_END, TYPE_CANCEL].includes(computed.phase) &&
  1996. computed.direction
  1997. ) {
  1998. at.emit2(name_1 + computed.direction, computed, context);
  1999. }
  2000. }
  2001. function test() {
  2002. var pointLength = computed.pointLength,
  2003. distance = computed.distance;
  2004. return (
  2005. context.pointLength === pointLength &&
  2006. context.threshold <= distance
  2007. );
  2008. }
  2009. }
  2010. );
  2011. return context;
  2012. }
  2013.  
  2014. var DEFAULT_OPTIONS$3 = {
  2015. name: "swipe",
  2016. threshold: 10,
  2017. velocity: 0.3,
  2018. pointLength: 1,
  2019. };
  2020. // @ts-ignore
  2021. function swipe(at, options) {
  2022. var context = createPluginContext(DEFAULT_OPTIONS$3, options);
  2023. at.compute(
  2024. [ComputeDistance, ComputeVAndDir, ComputeMaxLength],
  2025. // @ts-ignore
  2026. function (computed) {
  2027. context.state = 0;
  2028. if (context.disabled) return;
  2029. if (test()) {
  2030. var name_1 = context.name;
  2031. context.state = 1;
  2032. at.emit2(name_1, computed, context);
  2033. at.emit2(name_1 + computed.direction, computed, context);
  2034. }
  2035. function test() {
  2036. if (TYPE_END !== computed.phase) return false;
  2037. var velocityX = computed.velocityX,
  2038. velocityY = computed.velocityY,
  2039. distance = computed.distance,
  2040. maxPointLength = computed.maxPointLength;
  2041. return (
  2042. maxPointLength === context.pointLength &&
  2043. 0 === computed.points.length &&
  2044. context.threshold < distance &&
  2045. context.velocity < Math.max(velocityX, velocityY)
  2046. );
  2047. }
  2048. }
  2049. );
  2050. return context;
  2051. }
  2052.  
  2053. var DEFAULT_OPTIONS$2 = {
  2054. name: "press",
  2055. pointLength: 1,
  2056. maxDistance: 9,
  2057. minPressTime: 251,
  2058. };
  2059. // @ts-ignore
  2060. function press(at, options) {
  2061. var context = createPluginContext(DEFAULT_OPTIONS$2, options);
  2062. var timeoutId = 0;
  2063. // @ts-ignore
  2064. at.compute([ComputeDistance], function (computed) {
  2065. if (isDisabled(context)) return;
  2066. var phase = computed.phase,
  2067. startInput = computed.startInput,
  2068. pointLength = computed.pointLength;
  2069. if (TYPE_START === phase && context.pointLength === pointLength) {
  2070. resetState(context);
  2071. clearTimeout(timeoutId);
  2072. timeoutId = setTimeout(function () {
  2073. context.state = 1;
  2074. at.emit2(context.name, computed, context);
  2075. }, context.minPressTime);
  2076. } else if (TYPE_END === phase && 1 === context.state) {
  2077. at.emit2(
  2078. "".concat(context.name).concat(DIRECTION_UP),
  2079. computed,
  2080. context
  2081. );
  2082. } else if (1 !== context.state) {
  2083. var deltaTime = computed.timestamp - startInput.timestamp;
  2084. if (
  2085. !test() ||
  2086. (context.minPressTime > deltaTime &&
  2087. [TYPE_END, TYPE_CANCEL].includes(phase))
  2088. ) {
  2089. clearTimeout(timeoutId);
  2090. context.state = 2;
  2091. }
  2092. }
  2093. function test() {
  2094. var distance = computed.distance;
  2095. return distance && context.maxDistance > distance;
  2096. }
  2097. });
  2098. return context;
  2099. }
  2100.  
  2101. var DEFAULT_OPTIONS$1 = {
  2102. name: "pinch",
  2103. threshold: 0,
  2104. pointLength: 2,
  2105. };
  2106. // @ts-ignore
  2107. function pinch(at, options) {
  2108. var context = createPluginContext(DEFAULT_OPTIONS$1, options);
  2109. at.compute(
  2110. [ComputeVectorForMutli, ComputeScale],
  2111. // @ts-ignore
  2112. function (computed) {
  2113. resetState(context);
  2114. if (isDisabled(context)) return;
  2115. var isValid = test();
  2116. context.state = flow(isValid, context.state, computed.phase);
  2117. var name = context.name;
  2118. if (isValid || isMoveOrEndOrCancel(context.state)) {
  2119. at.emit2(name, computed, context);
  2120. var deltaScale = computed.deltaScale;
  2121. if (1 !== deltaScale) {
  2122. at.emit2(
  2123. name + (1 < deltaScale ? "in" : "out"),
  2124. computed,
  2125. context
  2126. );
  2127. }
  2128. }
  2129. var stateName = getStatusName(context.state);
  2130. if (stateName) {
  2131. at.emit2(name + stateName, computed, context);
  2132. }
  2133. function test() {
  2134. var pointLength = computed.pointLength,
  2135. scale = computed.scale;
  2136. computed.deltaScale;
  2137. computed.phase;
  2138. return (
  2139. context.pointLength === pointLength &&
  2140. context.threshold < Math.abs(scale - 1)
  2141. );
  2142. }
  2143. }
  2144. );
  2145. return context;
  2146. }
  2147.  
  2148. var DEFAULT_OPTIONS = {
  2149. name: "rotate",
  2150. threshold: 0,
  2151. pointLength: 2,
  2152. };
  2153. // @ts-ignore
  2154. function rotate(at, options) {
  2155. var context = createPluginContext(DEFAULT_OPTIONS, options);
  2156. at.compute(
  2157. [ComputeVectorForMutli, ComputeAngle],
  2158. // @ts-ignore
  2159. function (computed) {
  2160. if (isDisabled(context)) return;
  2161. resetState(context);
  2162. var isValid = test();
  2163. context.state = flow(isValid, context.state, computed.phase);
  2164. var name = context.name;
  2165. if (isValid || isMoveOrEndOrCancel(context.state)) {
  2166. at.emit2(name, computed, context);
  2167. }
  2168. var stateName = getStatusName(context.state);
  2169. if (stateName) {
  2170. at.emit2(name + stateName, computed, context);
  2171. }
  2172. function test() {
  2173. var pointLength = computed.pointLength,
  2174. angle = computed.angle;
  2175. return (
  2176. context.pointLength === pointLength &&
  2177. context.threshold < Math.abs(angle)
  2178. );
  2179. }
  2180. }
  2181. );
  2182. return context;
  2183. }
  2184.  
  2185. // @ts-ignore
  2186. function doubletap(at) {
  2187. at.use(tap, { name: "doubletap", tapTimes: 2 });
  2188. var doubleTapContext = at.get("doubletap");
  2189. // @ts-ignore
  2190. var timeID;
  2191. // @ts-ignore
  2192. at.beforeEach(function (type, next) {
  2193. if ("tap" === type) {
  2194. // @ts-ignore
  2195. clearTimeout(timeID);
  2196. timeID = setTimeout(function () {
  2197. if ([0, 2].includes(doubleTapContext.state)) {
  2198. next();
  2199. }
  2200. }, 300);
  2201. } else {
  2202. next();
  2203. }
  2204. });
  2205. return doubleTapContext;
  2206. }
  2207.  
  2208. var default_1 = (function (_super) {
  2209. __extends(default_1, _super);
  2210. // @ts-ignore
  2211. function default_1(el, options) {
  2212. // @ts-ignore
  2213. var _this = _super.call(this, el, options) || this;
  2214. _this.use(tap);
  2215. _this.use(pan);
  2216. _this.use(swipe);
  2217. _this.use(press);
  2218. _this.use(pinch);
  2219. _this.use(rotate);
  2220. return _this;
  2221. }
  2222. default_1.STATE_POSSIBLE = 0;
  2223. default_1.STATE_START = 4;
  2224. default_1.STATE_MOVE = 5;
  2225. default_1.STATE_END = 1;
  2226. default_1.STATE_CANCELLED = 3;
  2227. default_1.STATE_FAILED = 2;
  2228. default_1.STATE_RECOGNIZED = 1;
  2229. default_1.tap = tap;
  2230. default_1.pan = pan;
  2231. default_1.swipe = swipe;
  2232. default_1.press = press;
  2233. default_1.rotate = rotate;
  2234. default_1.pinch = pinch;
  2235. default_1.doubletap = doubletap;
  2236. return default_1;
  2237. })(default_1$1);
  2238.  
  2239. return default_1;
  2240. });
  2241. //# sourceMappingURL=any-touch.umd.js.map
  2242. return anyTouch;
  2243. },
  2244. /**
  2245. * 排序数组
  2246. * @param {(value: any)=>any} getBeforeValueFun
  2247. * @param {(value: any)=>any} getAfterValueFun
  2248. * @param {boolean} sortByDesc 排序是否降序,默认降序
  2249. * @returns
  2250. */
  2251. sortElementListByProperty(
  2252. getBeforeValueFun,
  2253. getAfterValueFun,
  2254. sortByDesc = true
  2255. ) {
  2256. if (typeof sortByDesc !== "boolean") {
  2257. throw "参数 sortByDesc 必须为boolean类型";
  2258. }
  2259. if (getBeforeValueFun == null || getAfterValueFun == null) {
  2260. throw "获取前面的值或后面的值的方法不能为空";
  2261. }
  2262. // @ts-ignore
  2263. return function (after_obj, before_obj) {
  2264. var beforeValue = getBeforeValueFun(before_obj); /* 前 */
  2265. var afterValue = getAfterValueFun(after_obj); /* 后 */
  2266. if (sortByDesc) {
  2267. if (afterValue > beforeValue) {
  2268. return -1;
  2269. } else if (afterValue < beforeValue) {
  2270. return 1;
  2271. } else {
  2272. return 0;
  2273. }
  2274. } else {
  2275. if (afterValue < beforeValue) {
  2276. return -1;
  2277. } else if (afterValue > beforeValue) {
  2278. return 1;
  2279. } else {
  2280. return 0;
  2281. }
  2282. }
  2283. };
  2284. },
  2285. /**
  2286. * 获取格式化后的时间
  2287. * @param {string|number} [text= new Date()] 需要格式化的字符串或者时间戳
  2288. * @param {string} [formatType = "yyyy-MM-dd HH:mm:ss"] 格式化成的显示类型
  2289. * + yyyy 年
  2290. * + MM 月
  2291. * + dd 天
  2292. * + HH 时 (24小时制)
  2293. * + hh 时 (12小时制)
  2294. * + mm 分
  2295. * + ss 秒
  2296. * @returns {string} 返回格式化后的时间
  2297. * @example
  2298. * Utils.formatTime("2022-08-21 23:59:00","HH:mm:ss");
  2299. * > '23:59:00'
  2300. * @example
  2301. * Utils.formatTime(1899187424988,"HH:mm:ss");
  2302. * > '15:10:13'
  2303. * @example
  2304. * Utils.formatTime()
  2305. * > '2023-1-1 00:00:00'
  2306. **/
  2307. formatTime: function (
  2308. // @ts-ignore
  2309. text = new Date(),
  2310. formatType = "yyyy-MM-dd HH:mm:ss"
  2311. ) {
  2312. let time = text == null ? new Date() : new Date(text);
  2313. /**
  2314. * 校验时间补0
  2315. * @param {number} timeNum
  2316. * @returns
  2317. */
  2318. function checkTime(timeNum) {
  2319. if (timeNum < 10) return "0" + timeNum;
  2320. return timeNum;
  2321. }
  2322.  
  2323. /**
  2324. * 时间制修改 24小时制转12小时制
  2325. * @param {number} hourNum 小时
  2326. * @returns
  2327. */
  2328. function timeSystemChange(hourNum) {
  2329. return hourNum > 12 ? hourNum - 12 : hourNum;
  2330. }
  2331.  
  2332. let timeRegexp = {
  2333. yyyy: time.getFullYear(),
  2334. /* 年 */
  2335. MM: checkTime(time.getMonth() + 1),
  2336. /* 月 */
  2337. dd: checkTime(time.getDate()),
  2338. /* 日 */
  2339. HH: checkTime(time.getHours()),
  2340. /* 时 (24小时制) */
  2341. hh: checkTime(timeSystemChange(time.getHours())),
  2342. /* 时 (12小时制) */
  2343. mm: checkTime(time.getMinutes()),
  2344. /* 分 */
  2345. ss: checkTime(time.getSeconds()),
  2346. /* 秒 */
  2347. };
  2348. Object.keys(timeRegexp).forEach(function (key) {
  2349. let replaecRegexp = new RegExp(key, "g");
  2350. // @ts-ignore
  2351. formatType = formatType.replace(replaecRegexp, timeRegexp[key]);
  2352. });
  2353. return formatType;
  2354. },
  2355. /**
  2356. * 格式化byte为KB、MB、GB、TB、PB、EB、ZB、YB、BB、NB、DB
  2357. * @param {number|string} byteSize 字节
  2358. * @param {boolean} [addType=true]
  2359. * + true (默认) 添加单位
  2360. * + false 不添加单位
  2361. * @returns {string|number}
  2362. * + {string} 当addType为true时,且保留小数点末尾2位
  2363. * + {number} 当addType为false时,且保留小数点末尾2位
  2364. * @example
  2365. * Utils.formatByteToSize("812304");
  2366. * > '793.27KB'
  2367. * @example
  2368. * Utils.formatByteToSize("812304",false);
  2369. * > 793.27
  2370. **/
  2371. formatByteToSize: function (byteSize, addType = true) {
  2372. // @ts-ignore
  2373. byteSize = parseInt(byteSize);
  2374. if (isNaN(byteSize)) {
  2375. throw new Error("Utils.formatByteToSize 参数 byteSize 格式不正确");
  2376. }
  2377. let result = 0;
  2378. let resultType = "KB";
  2379. let sizeData = {};
  2380. sizeData.B = 1;
  2381. sizeData.KB = 1024;
  2382. sizeData.MB = sizeData.KB * sizeData.KB;
  2383. sizeData.GB = sizeData.MB * sizeData.KB;
  2384. sizeData.TB = sizeData.GB * sizeData.KB;
  2385. sizeData.PB = sizeData.TB * sizeData.KB;
  2386. sizeData.EB = sizeData.PB * sizeData.KB;
  2387. sizeData.ZB = sizeData.EB * sizeData.KB;
  2388. sizeData.YB = sizeData.ZB * sizeData.KB;
  2389. sizeData.BB = sizeData.YB * sizeData.KB;
  2390. sizeData.NB = sizeData.BB * sizeData.KB;
  2391. sizeData.DB = sizeData.NB * sizeData.KB;
  2392. for (let key in sizeData) {
  2393. // @ts-ignore
  2394. result = byteSize / sizeData[key];
  2395. resultType = key;
  2396. if (sizeData.KB >= result) {
  2397. break;
  2398. }
  2399. }
  2400. // @ts-ignore
  2401. result = result.toFixed(2);
  2402. // @ts-ignore
  2403. result = addType ? result + resultType.toString() : parseFloat(result);
  2404. return result;
  2405. },
  2406. /**
  2407. * 判断元素是否已显示或已连接
  2408. * @param {HTMLElement} element
  2409. * @returns {boolean}
  2410. */
  2411. isShow(element) {
  2412. return Boolean(element.getClientRects().length);
  2413. },
  2414. /**
  2415. * 用于显示元素并获取它的高度宽度等其它属性
  2416. * @param {HTMLElement} element
  2417. * @returns {{recovery: ()=>void}} - 恢复
  2418. */
  2419. showElement(element) {
  2420. let oldStyleAttribute = element.getAttribute("style");
  2421. element.setAttribute(
  2422. "style",
  2423. "visibility: !important;display:block !important;"
  2424. );
  2425. return {
  2426. recovery() {
  2427. if (oldStyleAttribute) {
  2428. element.setAttribute("style", oldStyleAttribute);
  2429. } else {
  2430. element.removeAttribute("style");
  2431. }
  2432. },
  2433. };
  2434. },
  2435. /**
  2436. * 获取元素上的Float格式的属性px
  2437. * @param {HTMLElement|CSSStyleDeclaration} element
  2438. * @param {string} styleName style名
  2439. * @return {number}
  2440. */
  2441. getStyleValue(element, styleName) {
  2442. let view = null;
  2443. let styles = null;
  2444. if (element instanceof CSSStyleDeclaration) {
  2445. /* 直接就获取了style属性 */
  2446. styles = element;
  2447. } else {
  2448. view = element.ownerDocument.defaultView;
  2449. if (!view || !view.opener) {
  2450. view = window;
  2451. }
  2452. styles = view.getComputedStyle(element);
  2453. }
  2454. // @ts-ignore
  2455. let value = parseFloat(styles[styleName]);
  2456. if (isNaN(value)) {
  2457. return 0;
  2458. } else {
  2459. return value;
  2460. }
  2461. },
  2462. /**
  2463. * 判断是否是window,例如window、self、globalThis
  2464. * @param {any} target
  2465. * @returns {boolean}
  2466. */
  2467. isWin(target) {
  2468. // @ts-ignore
  2469. if (!typeof target === "object") {
  2470. return false;
  2471. }
  2472. if (target instanceof Node) {
  2473. return false;
  2474. }
  2475. if (target === globalThis) {
  2476. return true;
  2477. }
  2478. if (target === window) {
  2479. return true;
  2480. }
  2481. if (target === self) {
  2482. return true;
  2483. }
  2484. if (target?.Math?.toString() !== "[object Math]") {
  2485. return false;
  2486. }
  2487. return true;
  2488. },
  2489. /**
  2490. * 阻止默认事件触发
  2491. * @param {Event} event
  2492. */
  2493. preventEvent(event) {
  2494. /* 阻止事件的默认行为发生。例如,当点击一个链接时,浏览器会默认打开链接的URL */
  2495. event?.preventDefault();
  2496. /* 停止事件的传播,阻止它继续向更上层的元素冒泡,事件将不会再传播给其他的元素 */
  2497. event?.stopPropagation();
  2498. /* 阻止事件传播,并且还能阻止元素上的其他事件处理程序被触发 */
  2499. event?.stopImmediatePropagation();
  2500. },
  2501. };
  2502.  
  2503. /**
  2504. * 浮点数工具类
  2505. */
  2506. const MathFloatUtils = {
  2507. /**
  2508. * 判断数字是否是浮点数
  2509. * @param {number} num
  2510. * @returns
  2511. */
  2512. isFloat(num) {
  2513. return Number(num) === num && num % 1 !== 0;
  2514. },
  2515. /**
  2516. * 浮点数加法
  2517. * @param {number} number1
  2518. * @param {number} number2
  2519. */
  2520. add(number1, number2) {
  2521. let number1length, number2length, powValue;
  2522. try {
  2523. number1length = number1.toString().split(".")[1].length;
  2524. } catch (error) {
  2525. number1length = 0;
  2526. }
  2527. try {
  2528. number2length = number2.toString().split(".")[1].length;
  2529. } catch (error) {
  2530. number2length = 0;
  2531. }
  2532. powValue = Math.pow(10, Math.max(number1length, number2length));
  2533. return Math.round(number1 * powValue + number2 * powValue) / powValue;
  2534. },
  2535. /**
  2536. * 减法
  2537. * @param {number} number1
  2538. * @param {number} number2
  2539. * @returns
  2540. */
  2541. sub(number1, number2) {
  2542. let number1length, number2length, powValue;
  2543. try {
  2544. number1length = number1.toString().split(".")[1].length;
  2545. } catch (error) {
  2546. number1length = 0;
  2547. }
  2548. try {
  2549. number2length = number2.toString().split(".")[1].length;
  2550. } catch (error) {
  2551. number2length = 0;
  2552. }
  2553. powValue = Math.pow(10, Math.max(number1length, number2length));
  2554. let fixedValue =
  2555. number1length >= number2length ? number1length : number2length;
  2556. return (
  2557. Math.round(number1 * powValue - number2 * powValue) / powValue
  2558. ).toFixed(fixedValue);
  2559. },
  2560. /**
  2561. * 除法
  2562. * @param {number} number1
  2563. * @param {number} number2
  2564. */
  2565. division(number1, number2) {
  2566. let number1length,
  2567. number2length,
  2568. number1ReplaceValue,
  2569. number2ReplaceValue;
  2570. try {
  2571. number1length = number1.toString().split(".")[1].length;
  2572. } catch (error) {
  2573. number1length = 0;
  2574. }
  2575. try {
  2576. number2length = number2.toString().split(".")[1].length;
  2577. } catch (error) {
  2578. number2length = 0;
  2579. }
  2580. number1ReplaceValue = Number(number1.toString().replace(".", ""));
  2581. number2ReplaceValue = Number(number2.toString().replace(".", ""));
  2582. return (
  2583. (number1ReplaceValue / number2ReplaceValue) *
  2584. Math.pow(10, number2length - number1length)
  2585. );
  2586. },
  2587. };
  2588.  
  2589. /** 元素工具类 */
  2590. const PopsDOMUtils = {
  2591. /**
  2592. * 获取animationend的在各个浏览器的兼容名
  2593. */
  2594. getAnimationEndNameList() {
  2595. return [
  2596. "webkitAnimationEnd",
  2597. "mozAnimationEnd",
  2598. "MSAnimationEnd",
  2599. "oanimationend",
  2600. "animationend",
  2601. ];
  2602. },
  2603. /**
  2604. * 获取 transitionend 的在各个浏览器的兼容名
  2605. */
  2606. getTransitionEndNameList() {
  2607. return [
  2608. "webkitTransitionEnd",
  2609. "mozTransitionEnd",
  2610. "MSTransitionEnd",
  2611. "otransitionend",
  2612. "transitionend",
  2613. ];
  2614. },
  2615. /**
  2616. * 绑定事件
  2617. * @param {HTMLElement|string|NodeList|HTMLElement[]|Window} element 需要绑定的元素|元素数组|window
  2618. * @param {import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType|import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType[]} eventType 需要监听的事件
  2619. * @param {string|undefined|null} selector 子元素选择器
  2620. * @param {((event: Event)=>void)|undefined} callback 绑定事件触发的回调函数
  2621. * @param {boolean|AddEventListenerOptions|undefined} option
  2622. * + capture 表示事件是否在捕获阶段触发。默认为false,即在冒泡阶段触发
  2623. * + once 表示事件是否只触发一次。默认为false
  2624. * + passive 表示事件监听器是否不会调用preventDefault()。默认为false
  2625. */
  2626. on(element, eventType, selector, callback, option) {
  2627. /**
  2628. * 获取option配置
  2629. * @param {any[]} args
  2630. * @param {number} startIndex
  2631. * @param {AddEventListenerOptions} option
  2632. * @returns {AddEventListenerOptions}
  2633. */
  2634. function getOption(args, startIndex, option) {
  2635. if (typeof args[startIndex] === "boolean") {
  2636. option.capture = args[startIndex];
  2637. if (typeof args[startIndex + 1] === "boolean") {
  2638. option.once = args[startIndex + 1];
  2639. }
  2640. if (typeof args[startIndex + 2] === "boolean") {
  2641. option.passive = args[startIndex + 2];
  2642. }
  2643. } else if (
  2644. typeof args[startIndex] === "object" &&
  2645. ("capture" in args[startIndex] ||
  2646. "once" in args[startIndex] ||
  2647. "passive" in args[startIndex])
  2648. ) {
  2649. option.capture = args[startIndex].capture;
  2650. option.once = args[startIndex].once;
  2651. option.passive = args[startIndex].passive;
  2652. }
  2653. return option;
  2654. }
  2655.  
  2656. let args = arguments;
  2657. if (typeof element === "string") {
  2658. element = document.querySelectorAll(element);
  2659. }
  2660. if (element == void 0) {
  2661. return;
  2662. }
  2663. /**
  2664. * @type {HTMLElement[]}
  2665. */
  2666. let elementList = [];
  2667. if (element instanceof NodeList || Array.isArray(element)) {
  2668. // @ts-ignore
  2669. elementList = [...element];
  2670. } else {
  2671. // @ts-ignore
  2672. elementList.push(element);
  2673. }
  2674. /**
  2675. * @type {string[]}
  2676. */
  2677. let eventTypeList = [];
  2678. if (Array.isArray(eventType)) {
  2679. eventTypeList = eventTypeList.concat(eventType);
  2680. } else if (typeof eventType === "string") {
  2681. eventTypeList = eventTypeList.concat(eventType.split(" "));
  2682. }
  2683. /**
  2684. * @type {?string}
  2685. */
  2686. // @ts-ignore
  2687. let _selector_ = selector;
  2688. /**
  2689. * @type {(event:Event)=>{}}
  2690. */
  2691. // @ts-ignore
  2692. let _callback_ = callback;
  2693. /**
  2694. * @type {AddEventListenerOptions}
  2695. */
  2696. let _option_ = {
  2697. capture: false,
  2698. once: false,
  2699. passive: false,
  2700. };
  2701. if (typeof selector === "function") {
  2702. /* 这是为没有selector的情况 */
  2703. // @ts-ignore
  2704. _selector_ = void 0;
  2705. _callback_ = selector;
  2706. // @ts-ignore
  2707. _option_ = getOption(args, 3, _option_);
  2708. } else {
  2709. /* 这是存在selector的情况 */
  2710. // @ts-ignore
  2711. _option_ = getOption(args, 4, _option_);
  2712. }
  2713. /**
  2714. * 如果是once,那么删除该监听和元素上的事件和监听
  2715. */
  2716. function checkOptionOnceToRemoveEventListener() {
  2717. if (_option_.once) {
  2718. PopsDOMUtils.off(element, eventType, selector, callback, option);
  2719. }
  2720. }
  2721. elementList.forEach((elementItem) => {
  2722. // @ts-ignore
  2723. let ownCallBack = function (event) {
  2724. let target = event.target;
  2725. if (_selector_) {
  2726. /* 存在自定义子元素选择器 */
  2727. let totalParent = PopsUtils.isWin(elementItem)
  2728. ? document.documentElement
  2729. : elementItem;
  2730. if (target.matches(_selector_)) {
  2731. /* 当前目标可以被selector所匹配到 */
  2732. _callback_.call(target, event);
  2733. checkOptionOnceToRemoveEventListener();
  2734. return;
  2735. } else if (
  2736. target.closest(_selector_) &&
  2737. totalParent.contains(target.closest(_selector_))
  2738. ) {
  2739. /* 在上层与主元素之间寻找可以被selector所匹配到的 */
  2740. let closestElement = target.closest(_selector_);
  2741. /* event的target值不能直接修改 */
  2742. OriginPrototype.Object.defineProperty(event, "target", {
  2743. get() {
  2744. return closestElement;
  2745. },
  2746. });
  2747. _callback_.call(closestElement, event);
  2748. checkOptionOnceToRemoveEventListener();
  2749. return;
  2750. }
  2751. } else {
  2752. _callback_.call(elementItem, event);
  2753. checkOptionOnceToRemoveEventListener();
  2754. }
  2755. };
  2756.  
  2757. /* 遍历事件名设置元素事件 */
  2758. eventTypeList.forEach((eventName) => {
  2759. elementItem.addEventListener(eventName, ownCallBack, _option_);
  2760.  
  2761. // @ts-ignore
  2762. if (_callback_ && _callback_.delegate) {
  2763. // @ts-ignore
  2764. elementItem.setAttribute("data-delegate", _selector_);
  2765. }
  2766. /* 获取对象上的事件 */
  2767. // @ts-ignore
  2768. let elementEvents = elementItem[PopsUtils.SymbolEvents] || {};
  2769. /* 初始化对象上的xx事件 */
  2770. elementEvents[eventName] = elementEvents[eventName] || [];
  2771. elementEvents[eventName].push({
  2772. selector: _selector_,
  2773. option: _option_,
  2774. callback: ownCallBack,
  2775. originCallBack: _callback_,
  2776. });
  2777. /* 覆盖事件 */
  2778. // @ts-ignore
  2779. elementItem[PopsUtils.SymbolEvents] = elementEvents;
  2780. });
  2781. });
  2782. },
  2783. /**
  2784. * 取消绑定事件
  2785. * @param {HTMLElement|string|NodeList|HTMLElement[]|Window} element 需要取消绑定的元素|元素数组
  2786. * @param {import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType|import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType[]|string} eventType 需要取消监听的事件
  2787. * @param {string|undefined|null} selector 子元素选择器
  2788. * @param {((event: Event)=>void)|undefined} callback 通过DOMUtils.on绑定的事件函数
  2789. * @param {EventListenerOptions|boolean|undefined} option
  2790. * + capture 如果在添加事件监听器时指定了useCapture为true,则在移除事件监听器时也必须指定为true
  2791. */
  2792. // @ts-ignore
  2793. off(element, eventType, selector, callback, option) {
  2794. /**
  2795. * 获取option配置
  2796. * @param {any[]} args
  2797. * @param {number} startIndex
  2798. * @param {EventListenerOptions} option
  2799. * @returns {EventListenerOptions}
  2800. */
  2801. function getOption(args, startIndex, option) {
  2802. if (typeof args[startIndex] === "boolean") {
  2803. option.capture = args[startIndex];
  2804. } else if (
  2805. typeof args[startIndex] === "object" &&
  2806. "capture" in args[startIndex]
  2807. ) {
  2808. option.capture = args[startIndex].capture;
  2809. }
  2810. return option;
  2811. }
  2812.  
  2813. let args = arguments;
  2814. if (typeof element === "string") {
  2815. element = document.querySelectorAll(element);
  2816. }
  2817. if (element == void 0) {
  2818. return;
  2819. }
  2820. /**
  2821. * @type {HTMLElement[]}
  2822. */
  2823. let elementList = [];
  2824. if (element instanceof NodeList || Array.isArray(element)) {
  2825. // @ts-ignore
  2826. elementList = [...element];
  2827. } else {
  2828. // @ts-ignore
  2829. elementList.push(element);
  2830. }
  2831. /**
  2832. * @type {string[]}
  2833. */
  2834. let eventTypeList = [];
  2835. if (Array.isArray(eventType)) {
  2836. eventTypeList = eventTypeList.concat(eventType);
  2837. } else if (typeof eventType === "string") {
  2838. eventTypeList = eventTypeList.concat(eventType.split(" "));
  2839. }
  2840. /**
  2841. * @type {?string}
  2842. */
  2843. // @ts-ignore
  2844. let _selector_ = selector;
  2845. /**
  2846. * @type {(event:Event)=>{}}
  2847. */
  2848. // @ts-ignore
  2849. let _callback_ = callback;
  2850.  
  2851. /**
  2852. * @type {EventListenerOptions}
  2853. */
  2854. let _option_ = {
  2855. capture: false,
  2856. };
  2857. if (typeof selector === "function") {
  2858. /* 这是为没有selector的情况 */
  2859. // @ts-ignore
  2860. _selector_ = void 0;
  2861. _callback_ = selector;
  2862. // @ts-ignore
  2863. _option_ = getOption(args, 3, _option_);
  2864. } else {
  2865. // @ts-ignore
  2866. _option_ = getOption(args, 4, _option_);
  2867. }
  2868. elementList.forEach((elementItem) => {
  2869. /* 获取对象上的事件 */
  2870. // @ts-ignore
  2871. let elementEvents = elementItem[PopsUtils.SymbolEvents] || {};
  2872. eventTypeList.forEach((eventName) => {
  2873. /**
  2874. * @type {import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtilsEventListenerOptionsAttribute[]}
  2875. */
  2876. let handlers = elementEvents[eventName] || [];
  2877. // @ts-ignore
  2878. if (typeof filter === "function") {
  2879. // @ts-ignore
  2880. handlers = handlers.filter(filter);
  2881. }
  2882. for (let index = 0; index < handlers.length; index++) {
  2883. let handler = handlers[index];
  2884. let flag = !1;
  2885. if (!_selector_ || handler.selector === _selector_) {
  2886. /* selector不为空,进行selector判断 */
  2887. flag = !0;
  2888. }
  2889. if (
  2890. !_callback_ ||
  2891. // @ts-ignore
  2892. handler.callback === _callback_ ||
  2893. // @ts-ignore
  2894. handler.originCallBack === _callback_
  2895. ) {
  2896. /* callback不为空,进行callback判断 */
  2897. flag = !0;
  2898. }
  2899.  
  2900. if (flag) {
  2901. elementItem.removeEventListener(
  2902. eventName,
  2903. handler.callback,
  2904. _option_
  2905. );
  2906. handlers.splice(index--, 1);
  2907. }
  2908. }
  2909. if (handlers.length === 0) {
  2910. /* 如果没有任意的handler,那么删除该属性 */
  2911. // @ts-ignore
  2912. delete elementEvents[eventType];
  2913. }
  2914. });
  2915. // @ts-ignore
  2916. elementItem[PopsUtils.SymbolEvents] = elementEvents;
  2917. });
  2918. },
  2919. /**
  2920. * 主动触发事件
  2921. * @param {HTMLElement|string|NodeList|HTMLElement[]|Window} element 需要触发的元素|元素数组|window
  2922. * @param {import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType|import("./../DOMUtils/dist/src/DOMUtilsEvent").DOMUtils_EventType[]} eventType 需要触发的事件
  2923. * @param {object|undefined} details 赋予触发的Event的额外属性
  2924. * @param {boolean} [useDispatchToTriggerEvent=true] 是否使用dispatchEvent来触发事件,默认true
  2925. */
  2926. trigger(element, eventType, details, useDispatchToTriggerEvent = true) {
  2927. if (typeof element === "string") {
  2928. // @ts-ignore
  2929. element = document.querySelector(element);
  2930. }
  2931. if (element == void 0) {
  2932. return;
  2933. }
  2934. let elementList = [];
  2935. if (element instanceof NodeList || Array.isArray(element)) {
  2936. elementList = [...element];
  2937. } else {
  2938. elementList = [element];
  2939. }
  2940. // @ts-ignore
  2941. let eventTypeList = [];
  2942. if (Array.isArray(eventType)) {
  2943. eventTypeList = eventType;
  2944. } else if (typeof eventType === "string") {
  2945. eventTypeList = eventType.split(" ");
  2946. }
  2947. elementList.forEach((elementItem) => {
  2948. /* 获取对象上的事件 */
  2949. // @ts-ignore
  2950. let events = elementItem[PopsUtils.SymbolEvents] || {};
  2951. // @ts-ignore
  2952. eventTypeList.forEach((_eventType_) => {
  2953. let event = new Event(_eventType_);
  2954. if (details) {
  2955. Object.keys(details).forEach((keyName) => {
  2956. // @ts-ignore
  2957. event[keyName] = details[keyName];
  2958. });
  2959. }
  2960. if (useDispatchToTriggerEvent == false && _eventType_ in events) {
  2961. // @ts-ignore
  2962. events[_eventType_].forEach((eventsItem) => {
  2963. eventsItem.callback(event);
  2964. });
  2965. } else {
  2966. // @ts-ignore
  2967. elementItem.dispatchEvent(event);
  2968. }
  2969. });
  2970. });
  2971. },
  2972. /**
  2973. * 实现jQuery中的$().offset();
  2974. * @param {HTMLElement} element
  2975. * @returns
  2976. */
  2977. offset(element) {
  2978. let rect = element.getBoundingClientRect();
  2979. let win = element.ownerDocument.defaultView;
  2980. return {
  2981. // @ts-ignore
  2982. top: parseFloat(rect.top + win.pageYOffset),
  2983. // @ts-ignore
  2984. bottom: parseFloat(rect.bottom + win + pageYOffset),
  2985. // @ts-ignore
  2986. left: parseFloat(rect.left + win.pageXOffset),
  2987. // @ts-ignore
  2988. right: parseFloat(rect.right + win.pageXOffset),
  2989. width: rect.width,
  2990. height: rect.height,
  2991. };
  2992. },
  2993. /**
  2994. * 获取元素的宽度
  2995. * @param {HTMLElement} element - 要获取宽度的元素
  2996. * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
  2997. * @returns {number} - 元素的宽度,单位为像素
  2998. */
  2999. width(element, isShow = false) {
  3000. if (PopsUtils.isWin(element)) {
  3001. return window.document.documentElement.clientWidth;
  3002. }
  3003. if (typeof element === "string") {
  3004. // @ts-ignore
  3005. element = document.querySelector(element);
  3006. }
  3007. if (element == void 0) {
  3008. // @ts-ignore
  3009. return;
  3010. }
  3011. if (element.nodeType === 9) {
  3012. /* 文档节点 */
  3013. return Math.max(
  3014. // @ts-ignore
  3015. element.body.scrollWidth,
  3016. // @ts-ignore
  3017. element.documentElement.scrollWidth,
  3018. // @ts-ignore
  3019. element.body.offsetWidth,
  3020. // @ts-ignore
  3021. element.documentElement.offsetWidth,
  3022. // @ts-ignore
  3023. element.documentElement.clientWidth
  3024. );
  3025. }
  3026. if (isShow || PopsUtils.isShow(element)) {
  3027. /* 已显示 */
  3028. /* 不从style中获取对应的宽度,因为可能使用了class定义了width !important */
  3029.  
  3030. /* 如果element.style.width为空 则从css里面获取是否定义了width信息如果定义了 则读取css里面定义的宽度width */
  3031. // @ts-ignore
  3032. if (parseFloat(PopsUtils.getStyleValue(element, "width")) > 0) {
  3033. // @ts-ignore
  3034. return parseFloat(PopsUtils.getStyleValue(element, "width"));
  3035. }
  3036.  
  3037. /* 如果从css里获取到的值不是大于0 可能是auto 则通过offsetWidth来进行计算 */
  3038. if (element.offsetWidth > 0) {
  3039. let borderLeftWidth = PopsUtils.getStyleValue(
  3040. element,
  3041. "borderLeftWidth"
  3042. );
  3043. let borderRightWidth = PopsUtils.getStyleValue(
  3044. element,
  3045. "borderRightWidth"
  3046. );
  3047. let paddingLeft = PopsUtils.getStyleValue(element, "paddingLeft");
  3048. let paddingRight = PopsUtils.getStyleValue(element, "paddingRight");
  3049. let backHeight =
  3050. // @ts-ignore
  3051. parseFloat(element.offsetWidth) -
  3052. // @ts-ignore
  3053. parseFloat(borderLeftWidth) -
  3054. // @ts-ignore
  3055. parseFloat(borderRightWidth) -
  3056. // @ts-ignore
  3057. parseFloat(paddingLeft) -
  3058. // @ts-ignore
  3059. parseFloat(paddingRight);
  3060. // @ts-ignore
  3061. return parseFloat(backHeight);
  3062. }
  3063. return 0;
  3064. } else {
  3065. /* 未显示 */
  3066. let { recovery } = PopsUtils.showElement(element);
  3067. let width = PopsDOMUtils.width(element, true);
  3068. recovery();
  3069. return width;
  3070. }
  3071. },
  3072. /**
  3073. * 获取元素的高度
  3074. * @param {HTMLElement} element - 要获取高度的元素
  3075. * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
  3076. * @returns {number} - 元素的高度,单位为像素
  3077. */
  3078. height(element, isShow = false) {
  3079. if (PopsUtils.isWin(element)) {
  3080. return window.document.documentElement.clientHeight;
  3081. }
  3082. if (typeof element === "string") {
  3083. // @ts-ignore
  3084. element = document.querySelector(element);
  3085. }
  3086. if (element == void 0) {
  3087. // @ts-ignore
  3088. return;
  3089. }
  3090. if (element.nodeType === 9) {
  3091. /* 文档节点 */
  3092. return Math.max(
  3093. // @ts-ignore
  3094. element.body.scrollHeight,
  3095. // @ts-ignore
  3096. element.documentElement.scrollHeight,
  3097. // @ts-ignore
  3098. element.body.offsetHeight,
  3099. // @ts-ignore
  3100. element.documentElement.offsetHeight,
  3101. // @ts-ignore
  3102. element.documentElement.clientHeight
  3103. );
  3104. }
  3105. if (isShow || PopsUtils.isShow(element)) {
  3106. /* 已显示 */
  3107. /* 从style中获取对应的高度,因为可能使用了class定义了width !important */
  3108. /* 如果element.style.height为空 则从css里面获取是否定义了height信息如果定义了 则读取css里面定义的高度height */
  3109. // @ts-ignore
  3110. if (parseFloat(PopsUtils.getStyleValue(element, "height")) > 0) {
  3111. // @ts-ignore
  3112. return parseFloat(PopsUtils.getStyleValue(element, "height"));
  3113. }
  3114.  
  3115. /* 如果从css里获取到的值不是大于0 可能是auto 则通过offsetHeight来进行计算 */
  3116. if (element.offsetHeight > 0) {
  3117. let borderTopWidth = PopsUtils.getStyleValue(
  3118. element,
  3119. "borderTopWidth"
  3120. );
  3121. let borderBottomWidth = PopsUtils.getStyleValue(
  3122. element,
  3123. "borderBottomWidth"
  3124. );
  3125. let paddingTop = PopsUtils.getStyleValue(element, "paddingTop");
  3126. let paddingBottom = PopsUtils.getStyleValue(element, "paddingBottom");
  3127. let backHeight =
  3128. // @ts-ignore
  3129. parseFloat(element.offsetHeight) -
  3130. // @ts-ignore
  3131. parseFloat(borderTopWidth) -
  3132. // @ts-ignore
  3133. parseFloat(borderBottomWidth) -
  3134. // @ts-ignore
  3135. parseFloat(paddingTop) -
  3136. // @ts-ignore
  3137. parseFloat(paddingBottom);
  3138. // @ts-ignore
  3139. return parseFloat(backHeight);
  3140. }
  3141. return 0;
  3142. } else {
  3143. /* 未显示 */
  3144. let { recovery } = PopsUtils.showElement(element);
  3145. let height = PopsDOMUtils.height(element, true);
  3146. recovery();
  3147. return height;
  3148. }
  3149. },
  3150. /**
  3151. * 获取元素的外部宽度(包括边框和外边距)
  3152. * @param {HTMLElement} element - 要获取外部宽度的元素
  3153. * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
  3154. * @returns {number} - 元素的外部宽度,单位为像素
  3155. */
  3156. outerWidth(element, isShow = false) {
  3157. if (PopsUtils.isWin(element)) {
  3158. return window.innerWidth;
  3159. }
  3160. if (typeof element === "string") {
  3161. // @ts-ignore
  3162. element = document.querySelector(element);
  3163. }
  3164. if (element == void 0) {
  3165. // @ts-ignore
  3166. return;
  3167. }
  3168. if (isShow || PopsUtils.isShow(element)) {
  3169. let style = getComputedStyle(element, null);
  3170. let marginLeft = PopsUtils.getStyleValue(style, "marginLeft");
  3171. let marginRight = PopsUtils.getStyleValue(style, "marginRight");
  3172. return element.offsetWidth + marginLeft + marginRight;
  3173. } else {
  3174. let { recovery } = PopsUtils.showElement(element);
  3175. let outerWidth = PopsDOMUtils.outerWidth(element, true);
  3176. recovery();
  3177. return outerWidth;
  3178. }
  3179. },
  3180. /**
  3181. * 获取元素的外部高度(包括边框和外边距)
  3182. * @param {HTMLElement} element - 要获取外部高度的元素
  3183. * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
  3184. * @returns {number} - 元素的外部高度,单位为像素
  3185. */
  3186. outerHeight(element, isShow = false) {
  3187. if (PopsUtils.isWin(element)) {
  3188. return window.innerHeight;
  3189. }
  3190. if (typeof element === "string") {
  3191. // @ts-ignore
  3192. element = document.querySelector(element);
  3193. }
  3194. if (element == void 0) {
  3195. // @ts-ignore
  3196. return;
  3197. }
  3198. if (isShow || PopsUtils.isShow(element)) {
  3199. let style = getComputedStyle(element, null);
  3200. let marginTop = PopsUtils.getStyleValue(style, "marginTop");
  3201. let marginBottom = PopsUtils.getStyleValue(style, "marginBottom");
  3202. return element.offsetHeight + marginTop + marginBottom;
  3203. } else {
  3204. let { recovery } = PopsUtils.showElement(element);
  3205. let outerHeight = PopsDOMUtils.outerHeight(element, true);
  3206. recovery();
  3207. return outerHeight;
  3208. }
  3209. },
  3210. /**
  3211. * 添加className
  3212. * @param {HTMLElement} element 目标元素
  3213. * @param {string} className className属性
  3214. */
  3215. addClassName(element, className) {
  3216. if (typeof className !== "string") {
  3217. return;
  3218. }
  3219. if (className.trim() === "") {
  3220. return;
  3221. }
  3222. element.classList.add(className);
  3223. },
  3224. /**
  3225. * 删除className
  3226. * @param {HTMLElement} element 目标元素
  3227. * @param {string} className className属性
  3228. */
  3229. removeClassName(element, className) {
  3230. if (typeof className !== "string") {
  3231. return;
  3232. }
  3233. if (className.trim() === "") {
  3234. return;
  3235. }
  3236. element.classList.remove(className);
  3237. },
  3238. /**
  3239. * 判断元素是否包含某个className
  3240. * @param {HTMLElement} element 目标元素
  3241. * @param {string} className className属性
  3242. */
  3243. containsClassName(element, className) {
  3244. if (typeof className !== "string") {
  3245. return;
  3246. }
  3247. if (className.trim() === "") {
  3248. return;
  3249. }
  3250. return element.classList.contains(className);
  3251. },
  3252. /**
  3253. * 获取或设置元素的样式属性值
  3254. * @param {HTMLElement|string} element 目标元素
  3255. * @param {CSSStyleDeclaration|string} property 样式属性名或包含多个属性名和属性值的对象
  3256. * @param {any} [value] 样式属性值(可选)
  3257. * @returns 如果传入了value,则返回undefined;否则返回样式属性值
  3258. **/
  3259. css(element, property, value) {
  3260. /**
  3261. * 把纯数字没有px的加上
  3262. */
  3263. // @ts-ignore
  3264. function handlePixe(propertyName, propertyValue) {
  3265. let allowAddPixe = [
  3266. "width",
  3267. "height",
  3268. "top",
  3269. "left",
  3270. "right",
  3271. "bottom",
  3272. "font-size",
  3273. ];
  3274. if (typeof propertyValue === "number") {
  3275. propertyValue = propertyValue.toString();
  3276. }
  3277. if (
  3278. typeof propertyValue === "string" &&
  3279. allowAddPixe.includes(propertyName) &&
  3280. propertyValue.match(/[0-9]$/gi)
  3281. ) {
  3282. propertyValue = propertyValue + "px";
  3283. }
  3284. return propertyValue;
  3285. }
  3286. if (typeof element === "string") {
  3287. // @ts-ignore
  3288. element = document.querySelector(element);
  3289. }
  3290. if (element == void 0) {
  3291. // @ts-ignore
  3292. return;
  3293. }
  3294. if (typeof property === "string") {
  3295. if (value === void 0) {
  3296. // @ts-ignore
  3297. return getComputedStyle(element).getPropertyValue(property);
  3298. } else {
  3299. if (value === "string" && value.includes("!important")) {
  3300. // @ts-ignore
  3301. element.style.setProperty(property, value, "important");
  3302. } else {
  3303. value = handlePixe(property, value);
  3304. // @ts-ignore
  3305. element.style.setProperty(property, value);
  3306. }
  3307. }
  3308. } else if (typeof property === "object") {
  3309. for (let prop in property) {
  3310. if (
  3311. typeof property[prop] === "string" &&
  3312. property[prop].includes("!important")
  3313. ) {
  3314. // @ts-ignore
  3315. element.style.setProperty(prop, property[prop], "important");
  3316. } else {
  3317. property[prop] = handlePixe(prop, property[prop]);
  3318. // @ts-ignore
  3319. element.style.setProperty(prop, property[prop]);
  3320. }
  3321. }
  3322. }
  3323. },
  3324. /**
  3325. * 创建元素
  3326. * @param {keyof HTMLElementTagNameMap} tagName 元素类型
  3327. * @param {HTMLElement|undefined} property 元素属性,对已有元素上的属性或者自定义的属性赋值
  3328. * @param {object|undefined} attributes 元素自定义属性,通过setAttribute赋值
  3329. * @returns {HTMLElement}
  3330. */
  3331. createElement(tagName, property, attributes) {
  3332. let tempElement = document.createElement(tagName);
  3333. if (typeof property === "string") {
  3334. tempElement.innerHTML = property;
  3335. return tempElement;
  3336. }
  3337. if (property == void 0) {
  3338. // @ts-ignore
  3339. property = {};
  3340. }
  3341. if (attributes == void 0) {
  3342. attributes = {};
  3343. }
  3344. // @ts-ignore
  3345. Object.keys(property).forEach((key) => {
  3346. // @ts-ignore
  3347. let value = property[key];
  3348. // @ts-ignore
  3349. tempElement[key] = value;
  3350. });
  3351. Object.keys(attributes).forEach((key) => {
  3352. // @ts-ignore
  3353. let value = attributes[key];
  3354. if (typeof value === "object") {
  3355. /* object转字符串 */
  3356. value = JSON.stringify(value);
  3357. } else if (typeof value === "function") {
  3358. /* function转字符串 */
  3359. value = value.toString();
  3360. }
  3361. tempElement.setAttribute(key, value);
  3362. });
  3363. return tempElement;
  3364. },
  3365. };
  3366.  
  3367. /** 弹窗 */
  3368. const pops = {};
  3369.  
  3370. /** 配置 */
  3371. pops.config = {
  3372. /** 版本号 */
  3373. version: "2024.6.18",
  3374. cssText: {
  3375. /** 主CSS */
  3376. index: `@charset "utf-8";
  3377. * {
  3378. -webkit-box-sizing: border-box;
  3379. box-sizing: border-box;
  3380. margin: 0;
  3381. padding: 0;
  3382. -webkit-tap-highlight-color: transparent;
  3383. /* 代替::-webkit-scrollbar */
  3384. scrollbar-width: thin;
  3385. }
  3386. .pops{
  3387. --pops-bg-opacity: 1;
  3388. --pops-bd-opacity: 1;
  3389. --pops-font-size: 16px;
  3390. }
  3391. .pops-mask{
  3392. --pops-mask-bg-opacity: 0.4;
  3393. }
  3394. .pops {
  3395. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  3396. border-radius: 4px;
  3397. border: 1px solid rgb(235, 238, 245, var(--pops-bd-opacity));
  3398. font-size: var(--pops-font-size);
  3399. box-shadow: 0 0 12px rgba(0,0,0,.12);
  3400. box-sizing: border-box;
  3401. overflow: hidden;
  3402. transition: all .35s
  3403. }
  3404. .pops-anim{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;}
  3405. .pops-anim[anim=""]{top:unset;right:unset;bottom:unset;left:unset;width:unset;height:unset;transition:none;}
  3406. /* 底部图标动画和样式 */
  3407. .pops i.pops-bottom-icon[is-loading="true"]{animation: rotating 2s linear infinite;}
  3408. .pops i.pops-bottom-icon{height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:inherit;font-size:inherit}
  3409. /* 遮罩层样式 */
  3410. .pops-mask{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;border:0;border-radius:0;background-color:rgba(0,0,0,var(--pops-mask-bg-opacity));box-shadow:none;transition:none;}
  3411. .pops-header-controls button.pops-header-control[type][data-header]{
  3412. float: right;
  3413. margin: 0 0;
  3414. outline: 0;
  3415. border: 0;
  3416. border-color: rgb(136, 136, 136, var(--pops-bd-opacity));
  3417. background-color: transparent;
  3418. color: #888;
  3419. cursor: pointer;
  3420. }
  3421. .pops-header-controls button.pops-header-control[type=max],
  3422. .pops-header-controls button.pops-header-control[type=mise],
  3423. .pops-header-controls button.pops-header-control[type=min]{position:relative;float:right;margin:0 2px;outline:0!important;border:0;border-color:rgb(136, 136, 136, var(--pops-bd-opacity));background-color:transparent;color:rgb(136, 136, 136);cursor:pointer;transition:all .3s ease-in-out;}
  3424. button.pops-header-control i{color:rgb(144, 147, 153);font-size:inherit;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor}
  3425. button.pops-header-control svg{height:1.25em;width:1.25em}
  3426. button.pops-header-control{right:15px;padding:0;border:none;outline:0;background:0 0;cursor:pointer;position:unset;line-height:1.15;}
  3427. button.pops-header-control i:hover{color:rgb(64, 158, 255)}
  3428. .pops-header-controls[data-margin] button.pops-header-control{margin:0 6px}
  3429. .pops[type-value] .pops-header-controls{display: flex;}
  3430. `,
  3431. /** 九宫格位置CSS */
  3432. ninePalaceGridPosition: `
  3433. .pops[position=top_left]{position:fixed;top:0;left:0;}
  3434. .pops[position=top]{position:fixed;top:0;left:50%;transform:translateX(-50%);}
  3435. .pops[position=top_right]{position:fixed;top:0;right:0;}
  3436. .pops[position=center_left]{position:fixed;top:50%;left:0;transform:translateY(-50%);}
  3437. .pops[position=center]{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);}
  3438. .pops[position=center_right]{position:fixed;top:50%;right:0;transform:translateY(-50%);}
  3439. .pops[position=bottom_left]{position:fixed;bottom:0;left:0;}
  3440. .pops[position=bottom]{position:fixed;bottom:0;left:50%;transform:translate(-50%,0);}
  3441. .pops[position=bottom_right]{position:fixed;right:0;bottom:0;}
  3442. `,
  3443. /** 滚动条CSS */
  3444. scrollbar: `
  3445. /* firefox上暂不支持::-webkit-scrollbar */
  3446. .pops ::-webkit-scrollbar{
  3447. width:6px;
  3448. height:0;
  3449. }
  3450.  
  3451. .pops ::-webkit-scrollbar-track{
  3452. width:0;
  3453. }
  3454. .pops ::-webkit-scrollbar-thumb:hover{
  3455. background: rgb(178, 178, 178, var(--pops-bg-opacity));
  3456. }
  3457. .pops ::-webkit-scrollbar-thumb{
  3458. min-height: 28px;
  3459. border-radius: 2em;
  3460. background: rgb(204, 204, 204, var(--pops-bg-opacity));
  3461. background-clip: padding-box;
  3462. }
  3463. `,
  3464. /** 按钮CSS */
  3465. button: `
  3466. .pops {
  3467. --button-font-size: 14px;
  3468. --button-height: 32px;
  3469. --button-color: rgb(51, 51, 51);
  3470. --button-bd-color: rgb(220, 223, 230, var(--pops-bd-opacity));
  3471. --button-bg-color: rgb(220, 223, 230, var(--pops-bg-opacity));
  3472. --button-margin-top: 0px;
  3473. --button-margin-bottom: 0px;
  3474. --button-margin-left: 5px;
  3475. --button-margin-right: 5px;
  3476. --button-padding-top: 6px;
  3477. --button-padding-bottom: 6px;
  3478. --button-padding-left: 12px;
  3479. --button-padding-right: 12px;
  3480. --button-radius: 4px;
  3481. --container-title-height: 55px;
  3482. --container-bottom-btn-height: 55px;
  3483. }
  3484. .pops[data-bottom-btn="false"]{
  3485. --container-bottom-btn-height: 0px;
  3486. }
  3487. .pops button {
  3488. white-space: nowrap;
  3489. float: right;
  3490. display: inline-block;
  3491. margin: var(--button-margin-top) var(--button-margin-right) var(--button-margin-bottom) var(--button-margin-left);
  3492. padding: var(--button-padding-top) var(--button-padding-right) var(--button-padding-bottom) var(--button-padding-left);
  3493. outline: 0;
  3494. }
  3495. .pops button {
  3496. border-radius: var(--button-radius);
  3497. box-shadow: none;
  3498. font-weight: 400;
  3499. font-size: var(--button-font-size);
  3500. cursor: pointer;
  3501. transition: all .3s ease-in-out;
  3502. }
  3503. .pops button {
  3504. display: flex;
  3505. align-items: center;
  3506. height: var(--button-height);
  3507. line-height: 1;
  3508. box-sizing: border-box;
  3509. user-select: none;
  3510. -webkit-user-select: none;
  3511. -moz-user-select: none;
  3512. -ms-user-select: none;
  3513. border: 1px solid var(--button-bd-color);
  3514. }
  3515. .pops button {
  3516. color: var(--button-color);
  3517. border-color: var(--button-bd-color);
  3518. background-color: var(--button-bg-color);
  3519. }
  3520. .pops button:active{
  3521. color: var(--button-color);
  3522. border-color: var(--button-bd-color);
  3523. background-color: var(--button-bg-color);
  3524. outline: 0;
  3525. }
  3526. .pops button:hover{
  3527. color: var(--button-color);
  3528. border-color: var(--button-bd-color);
  3529. background-color: var(--button-bg-color);
  3530. }
  3531. .pops button:focus-visible{
  3532. color: var(--button-color);
  3533. border-color: var(--button-bd-color);
  3534. background-color: var(--button-bg-color);
  3535. }
  3536. .pops button:disabled {
  3537. cursor: not-allowed;
  3538. color: var(--button-color);
  3539. border-color: var(--button-bd-color);
  3540. background-color: var(--button-bg-color);
  3541. }
  3542. .pops button.pops-button-large {
  3543. --button-height: 32px;
  3544. --button-padding-top: 12px;
  3545. --button-padding-bottom: 12px;
  3546. --button-padding-left: 19px;
  3547. --button-padding-right: 19px;
  3548. --button-font-size: 14px;
  3549. --button-border-radius: 4px;
  3550. }
  3551. .pops button.pops-button-small {
  3552. --button-height: 24px;
  3553. --button-padding-top: 5px;
  3554. --button-padding-bottom: 5px;
  3555. --button-padding-left: 11px;
  3556. --button-padding-right: 11px;
  3557. --button-font-size: 12px;
  3558. --button-border-radius: 4px;
  3559. }
  3560. .pops-panel-button-no-icon .pops-panel-button_inner i{
  3561. display: none;
  3562. }
  3563. .pops-panel-button-right-icon{
  3564. }
  3565. .pops-panel-button-right-icon .pops-panel-button_inner{
  3566. flex-direction: row-reverse;
  3567. }
  3568. .pops-panel-button-right-icon .pops-panel-button_inner i{
  3569. }
  3570. .pops-panel-button .pops-panel-button_inner i:has(svg),
  3571. .pops-panel-button-right-icon .pops-panel-button-text{
  3572. margin-right: 6px;
  3573. }
  3574. .pops button[type=default]{--button-color:#333333;--button-bd-color:#dcdfe6;--button-bg-color:#ffffff;}
  3575. .pops button[type=default]:active{--button-color:#409eff;--button-bd-color:#409eff;--button-bg-color:#ecf5ff;}
  3576. .pops button[type=default]:hover{--button-color:#409eff;--button-bd-color:#c6e2ff;--button-bg-color:#ecf5ff;}
  3577. .pops button[type=default]:focus-visible{outline:2px solid #a0cfff;outline-offset:1px;}
  3578. .pops button[type=default]:disabled{--button-color:#a8abb2;--button-bd-color:#fff;--button-bg-color:#e4e7ed;}
  3579. .pops button[type=primary]{--button-color:#ffffff;--button-bd-color:#409eff;--button-bg-color:#409eff;}
  3580. .pops button[type=primary]:active{--button-color:#ffffff;--button-bd-color:#337ecc;--button-bg-color:#337ecc;}
  3581. .pops button[type=primary]:hover{--button-color:#ffffff;--button-bd-color:#79bbff;--button-bg-color:#79bbff;}
  3582. .pops button[type=primary]:focus-visible{outline:2px solid #a0cfff;outline-offset:1px;}
  3583. .pops button[type=primary]:disabled{--button-color:#ffffff;--button-bd-color:#a0cfff;--button-bg-color:#a0cfff;}
  3584. .pops button[type=success]{--button-color:#ffffff;--button-bd-color:#4cae4c;--button-bg-color:#5cb85c;}
  3585. .pops button[type=success]:active{--button-color:#ffffff;--button-bd-color:#529b2e;--button-bg-color:#529b2e;}
  3586. .pops button[type=success]:hover{--button-color:#ffffff;--button-bd-color:#95d475;--button-bg-color:#95d475;}
  3587. .pops button[type=success]:focus-visible{outline:2px solid #b3e19d;outline-offset:1px;}
  3588. .pops button[type=success]:disabled{--button-color:#ffffff;--button-bd-color:#b3e19d;--button-bg-color:#b3e19d;}
  3589. .pops button[type=info]{--button-color:#ffffff;--button-bd-color:#909399;--button-bg-color:#909399;}
  3590. .pops button[type=info]:active{--button-color:#ffffff;--button-bd-color:#73767a;--button-bg-color:#73767a;}
  3591. .pops button[type=info]:hover{--button-color:#ffffff;--button-bd-color:#b1b3b8;--button-bg-color:#b1b3b8;}
  3592. .pops button[type=info]:focus-visible{outline:2px solid #c8c9cc;outline-offset:1px;}
  3593. .pops button[type=info]:disabled{--button-color:#ffffff;--button-bd-color:#c8c9cc;--button-bg-color:#c8c9cc;}
  3594. .pops button[type=warning]{--button-color:#ffffff;--button-bd-color:#e6a23c;--button-bg-color:#e6a23c;}
  3595. .pops button[type=warning]:active{--button-color:#ffffff;--button-bd-color:#b88230;--button-bg-color:#b88230;}
  3596. .pops button[type=warning]:hover{--button-color:#ffffff;--button-bd-color:#eebe77;--button-bg-color:#eebe77;}
  3597. .pops button[type=warning]:focus-visible{outline:2px solid #f3d19e;outline-offset:1px;}
  3598. .pops button[type=warning]:disabled{--button-color:#ffffff;--button-bd-color:#f3d19e;--button-bg-color:#f3d19e;}
  3599. .pops button[type=danger]{--button-color:#ffffff;--button-bd-color:#f56c6c;--button-bg-color:#f56c6c;}
  3600. .pops button[type=danger]:active{--button-color:#ffffff;--button-bd-color:#c45656;--button-bg-color:#c45656;}
  3601. .pops button[type=danger]:hover{--button-color:#ffffff;--button-bd-color:#f89898;--button-bg-color:#f89898;}
  3602. .pops button[type=danger]:focus-visible{outline:2px solid #fab6b6;outline-offset:1px;}
  3603. .pops button[type=danger]:disabled{--button-color:#ffffff;--button-bd-color:#fab6b6;--button-bg-color:#fab6b6;}
  3604. .pops button[type=xiaomi-primary]{--button-color:#ffffff;--button-bd-color:#ff5c00;--button-bg-color:#ff5c00;}
  3605. .pops button[type=xiaomi-primary]:active{--button-color:#ffffff;--button-bd-color:#da4f00;--button-bg-color:#da4f00;}
  3606. .pops button[type=xiaomi-primary]:hover{--button-color:#ffffff;--button-bd-color:#ff7e29;--button-bg-color:#ff7e29;}
  3607. .pops button[type=xiaomi-primary]:focus-visible{outline:2px solid #fab6b6;outline-offset:1px;}
  3608. .pops button[type=xiaomi-primary]:disabled{--button-color:#ffffff;--button-bd-color:#fad5b6;--button-bg-color:#fad5b6;}
  3609. `,
  3610. /** 通用的CSS */
  3611. common: `
  3612. .pops-flex-items-center{display: flex;align-items: center;}
  3613. .pops-flex-y-center{display: flex;justify-content: space-between;}
  3614. .pops-flex-x-center{display: flex;align-content: center;}
  3615. .pops-hide {display: none;}
  3616. .pops-hide-important {display: none !important;}
  3617. .pops-no-border{border: 0;}
  3618. .pops-no-border-important{border: 0;}
  3619. `,
  3620. /** 动画 */
  3621. anim: `
  3622. @keyframes rotating{0%{transform:rotate(0)}
  3623. to{transform:rotate(360deg)}
  3624. }
  3625. @keyframes iframeLoadingChange_85{0%{background:linear-gradient(to right,#4995dd,#fff,rgb(202 224 246));}
  3626. 20%{background:linear-gradient(to right,#4995dd,#ead0d0,rgb(123 185 246));}
  3627. 40%{background:linear-gradient(to right,#4995dd,#f4b7b7,rgb(112 178 244));}
  3628. 60%{background:linear-gradient(to right,#4995dd,#ec9393,rgb(80 163 246));}
  3629. 80%{background:linear-gradient(to right,#4995dd,#e87f7f,rgb(25 139 253));}
  3630. 100%{background:linear-gradient(to right,#4995dd,#ee2c2c,rgb(0 124 247));}
  3631. from{width:75%;}
  3632. to{width:100%;}
  3633. }
  3634. @keyframes iframeLoadingChange{0%{background:linear-gradient(to right,#4995dd,#fff,rgb(202 224 246));}
  3635. 20%{background:linear-gradient(to right,#4995dd,#ead0d0,rgb(123 185 246));}
  3636. 40%{background:linear-gradient(to right,#4995dd,#f4b7b7,rgb(112 178 244));}
  3637. 60%{background:linear-gradient(to right,#4995dd,#ec9393,rgb(80 163 246));}
  3638. 80%{background:linear-gradient(to right,#4995dd,#e87f7f,rgb(25 139 253));}
  3639. 100%{background:linear-gradient(to right,#4995dd,#ee2c2c,rgb(0 124 247));}
  3640. from{width:0;}
  3641. to{width:75%;}
  3642. }
  3643. @keyframes pops-anim-wait-rotate{form{transform:rotate(0);}
  3644. to{transform:rotate(360deg);}
  3645. }
  3646. @keyframes pops-anim-spread{0%{opacity:0;transform:scaleX(0);}
  3647. 100%{opacity:1;transform:scaleX(1);}
  3648. }
  3649. @keyframes pops-anim-shake{0%,100%{transform:translateX(0);}
  3650. 10%,30%,50%,70%,90%{transform:translateX(-10px);}
  3651. 20%,40%,60%,80%{transform:translateX(10px);}
  3652. }
  3653. @keyframes pops-anim-rolling-left{0%{opacity:0;transform:translateX(-100%) rotate(-120deg);}
  3654. 100%{opacity:1;transform:translateX(0) rotate(0);}
  3655. }
  3656. @keyframes pops-anim-rolling-right{0%{opacity:0;transform:translateX(100%) rotate(120deg);}
  3657. 100%{opacity:1;transform:translateX(0) rotate(0);}
  3658. }
  3659. @keyframes pops-anim-slide-top{0%{opacity:0;transform:translateY(-200%);}
  3660. 100%{opacity:1;transform:translateY(0);}
  3661. }
  3662. @keyframes pops-anim-slide-bottom{0%{opacity:0;transform:translateY(200%);}
  3663. 100%{opacity:1;transform:translateY(0);}
  3664. }
  3665. @keyframes pops-anim-slide-left{0%{opacity:0;transform:translateX(-200%);}
  3666. 100%{opacity:1;transform:translateX(0);}
  3667. }
  3668. @keyframes pops-anim-slide-right{0%{transform:translateX(200%);}
  3669. 100%{opacity:1;transform:translateX(0);}
  3670. }
  3671. @keyframes pops-anim-fadein{0%{opacity:0;}
  3672. 100%{opacity:1;}
  3673. }
  3674. @keyframes pops-anim-fadein-zoom{0%{opacity:0;transform:scale(.5);}
  3675. 100%{opacity:1;transform:scale(1);}
  3676. }
  3677. @keyframes pops-anim-fadein-alert{0%{transform:scale(.5);}
  3678. 45%{transform:scale(1.05);}
  3679. 80%{transform:scale(.95);}
  3680. 100%{transform:scale(1);}
  3681. }
  3682. @keyframes pops-anim-don{0%{opacity:0;transform:matrix3d(.7,0,0,0,0,.7,0,0,0,0,1,0,0,0,0,1);}
  3683. 2.08333%{transform:matrix3d(.75266,0,0,0,0,.76342,0,0,0,0,1,0,0,0,0,1);}
  3684. 4.16667%{transform:matrix3d(.81071,0,0,0,0,.84545,0,0,0,0,1,0,0,0,0,1);}
  3685. 6.25%{transform:matrix3d(.86808,0,0,0,0,.9286,0,0,0,0,1,0,0,0,0,1);}
  3686. 8.33333%{transform:matrix3d(.92038,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3687. 10.4167%{transform:matrix3d(.96482,0,0,0,0,1.05202,0,0,0,0,1,0,0,0,0,1);}
  3688. 12.5%{transform:matrix3d(1,0,0,0,0,1.08204,0,0,0,0,1,0,0,0,0,1);}
  3689. 14.5833%{transform:matrix3d(1.02563,0,0,0,0,1.09149,0,0,0,0,1,0,0,0,0,1);}
  3690. 16.6667%{transform:matrix3d(1.04227,0,0,0,0,1.08453,0,0,0,0,1,0,0,0,0,1);}
  3691. 18.75%{transform:matrix3d(1.05102,0,0,0,0,1.06666,0,0,0,0,1,0,0,0,0,1);}
  3692. 20.8333%{transform:matrix3d(1.05334,0,0,0,0,1.04355,0,0,0,0,1,0,0,0,0,1);}
  3693. 22.9167%{transform:matrix3d(1.05078,0,0,0,0,1.02012,0,0,0,0,1,0,0,0,0,1);}
  3694. 25%{transform:matrix3d(1.04487,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3695. 27.0833%{transform:matrix3d(1.03699,0,0,0,0,.98534,0,0,0,0,1,0,0,0,0,1);}
  3696. 29.1667%{transform:matrix3d(1.02831,0,0,0,0,.97688,0,0,0,0,1,0,0,0,0,1);}
  3697. 31.25%{transform:matrix3d(1.01973,0,0,0,0,.97422,0,0,0,0,1,0,0,0,0,1);}
  3698. 33.3333%{transform:matrix3d(1.01191,0,0,0,0,.97618,0,0,0,0,1,0,0,0,0,1);}
  3699. 35.4167%{transform:matrix3d(1.00526,0,0,0,0,.98122,0,0,0,0,1,0,0,0,0,1);}
  3700. 37.5%{transform:matrix3d(1,0,0,0,0,.98773,0,0,0,0,1,0,0,0,0,1);}
  3701. 39.5833%{transform:matrix3d(.99617,0,0,0,0,.99433,0,0,0,0,1,0,0,0,0,1);}
  3702. 41.6667%{transform:matrix3d(.99368,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3703. 43.75%{transform:matrix3d(.99237,0,0,0,0,1.00413,0,0,0,0,1,0,0,0,0,1);}
  3704. 45.8333%{transform:matrix3d(.99202,0,0,0,0,1.00651,0,0,0,0,1,0,0,0,0,1);}
  3705. 47.9167%{transform:matrix3d(.99241,0,0,0,0,1.00726,0,0,0,0,1,0,0,0,0,1);}
  3706. 50%{opacity:1;transform:matrix3d(.99329,0,0,0,0,1.00671,0,0,0,0,1,0,0,0,0,1);}
  3707. 52.0833%{transform:matrix3d(.99447,0,0,0,0,1.00529,0,0,0,0,1,0,0,0,0,1);}
  3708. 54.1667%{transform:matrix3d(.99577,0,0,0,0,1.00346,0,0,0,0,1,0,0,0,0,1);}
  3709. 56.25%{transform:matrix3d(.99705,0,0,0,0,1.0016,0,0,0,0,1,0,0,0,0,1);}
  3710. 58.3333%{transform:matrix3d(.99822,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3711. 60.4167%{transform:matrix3d(.99921,0,0,0,0,.99884,0,0,0,0,1,0,0,0,0,1);}
  3712. 62.5%{transform:matrix3d(1,0,0,0,0,.99816,0,0,0,0,1,0,0,0,0,1);}
  3713. 64.5833%{transform:matrix3d(1.00057,0,0,0,0,.99795,0,0,0,0,1,0,0,0,0,1);}
  3714. 66.6667%{transform:matrix3d(1.00095,0,0,0,0,.99811,0,0,0,0,1,0,0,0,0,1);}
  3715. 68.75%{transform:matrix3d(1.00114,0,0,0,0,.99851,0,0,0,0,1,0,0,0,0,1);}
  3716. 70.8333%{transform:matrix3d(1.00119,0,0,0,0,.99903,0,0,0,0,1,0,0,0,0,1);}
  3717. 72.9167%{transform:matrix3d(1.00114,0,0,0,0,.99955,0,0,0,0,1,0,0,0,0,1);}
  3718. 75%{transform:matrix3d(1.001,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3719. 77.0833%{transform:matrix3d(1.00083,0,0,0,0,1.00033,0,0,0,0,1,0,0,0,0,1);}
  3720. 79.1667%{transform:matrix3d(1.00063,0,0,0,0,1.00052,0,0,0,0,1,0,0,0,0,1);}
  3721. 81.25%{transform:matrix3d(1.00044,0,0,0,0,1.00058,0,0,0,0,1,0,0,0,0,1);}
  3722. 83.3333%{transform:matrix3d(1.00027,0,0,0,0,1.00053,0,0,0,0,1,0,0,0,0,1);}
  3723. 85.4167%{transform:matrix3d(1.00012,0,0,0,0,1.00042,0,0,0,0,1,0,0,0,0,1);}
  3724. 87.5%{transform:matrix3d(1,0,0,0,0,1.00027,0,0,0,0,1,0,0,0,0,1);}
  3725. 89.5833%{transform:matrix3d(.99991,0,0,0,0,1.00013,0,0,0,0,1,0,0,0,0,1);}
  3726. 91.6667%{transform:matrix3d(.99986,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3727. 93.75%{transform:matrix3d(.99983,0,0,0,0,.99991,0,0,0,0,1,0,0,0,0,1);}
  3728. 95.8333%{transform:matrix3d(.99982,0,0,0,0,.99985,0,0,0,0,1,0,0,0,0,1);}
  3729. 97.9167%{transform:matrix3d(.99983,0,0,0,0,.99984,0,0,0,0,1,0,0,0,0,1);}
  3730. 100%{opacity:1;transform:matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3731. }
  3732. @keyframes pops-anim-roll{0%{transform:perspective(1000px) rotate3d(1,0,0,90deg);}
  3733. 100%{transform:perspective(1000px) rotate3d(1,0,0,0deg);}
  3734. }
  3735. @keyframes pops-anim-sandra{0%{opacity:0;transform:scale3d(1.1,1.1,1);}
  3736. 100%{opacity:1;transform:scale3d(1,1,1);}
  3737. }
  3738. @keyframes pops-anim-gather{0%{opacity:0;transform:scale(5,0);}
  3739. 100%{opacity:1;transform:scale(1,1);}
  3740. }
  3741. @keyframes pops-anim-spread-reverse{0%{opacity:1;transform:scaleX(1);}
  3742. 100%{opacity:0;transform:scaleX(0);}
  3743. }
  3744. @keyframes pops-anim-shake-reverse{0%,100%{transform:translateX(10px);}
  3745. 10%,30%,50%,70%,90%{transform:translateX(-10px);}
  3746. 20%,40%,60%,80%{transform:translateX(0);}
  3747. }
  3748. @keyframes pops-anim-rolling-left-reverse{0%{opacity:1;transform:translateX(0) rotate(0);}
  3749. 100%{opacity:0;transform:translateX(-100%) rotate(-120deg);}
  3750. }
  3751. @keyframes pops-anim-rolling-right-reverse{0%{opacity:1;transform:translateX(0) rotate(0);}
  3752. 100%{opacity:0;transform:translateX(100%) rotate(120deg);}
  3753. }
  3754. @keyframes pops-anim-slide-top-reverse{0%{opacity:1;transform:translateY(0);}
  3755. 100%{opacity:0;transform:translateY(-200%);}
  3756. }
  3757. @keyframes pops-anim-slide-bottom-reverse{0%{opacity:1;transform:translateY(0);}
  3758. 100%{opacity:0;transform:translateY(200%);}
  3759. }
  3760. @keyframes pops-anim-slide-left-reverse{0%{opacity:1;transform:translateX(0);}
  3761. 100%{opacity:0;transform:translateX(-200%);}
  3762. }
  3763. @keyframes pops-anim-slide-right-reverse{0%{opacity:1;transform:translateX(0);}
  3764. 100%{transform:translateX(200%);}
  3765. }
  3766. @keyframes pops-anim-fadein-reverse{0%{opacity:1;}
  3767. 100%{opacity:0;}
  3768. }
  3769. @keyframes pops-anim-fadein-zoom-reverse{0%{opacity:1;transform:scale(1);}
  3770. 100%{opacity:0;transform:scale(.5);}
  3771. }
  3772. @keyframes pops-anim-fadein-alert-reverse{0%{transform:scale(1);}
  3773. 45%{transform:scale(.95);}
  3774. 80%{transform:scale(1.05);}
  3775. 100%{transform:scale(.5);}
  3776. }
  3777. @keyframes pops-anim-don-reverse{100%{opacity:0;transform:matrix3d(.7,0,0,0,0,.7,0,0,0,0,1,0,0,0,0,1);}
  3778. 97.9167%{transform:matrix3d(.75266,0,0,0,0,.76342,0,0,0,0,1,0,0,0,0,1);}
  3779. 95.8333%{transform:matrix3d(.81071,0,0,0,0,.84545,0,0,0,0,1,0,0,0,0,1);}
  3780. 93.75%{transform:matrix3d(.86808,0,0,0,0,.9286,0,0,0,0,1,0,0,0,0,1);}
  3781. 91.6667%{transform:matrix3d(.92038,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3782. 89.5833%{transform:matrix3d(.96482,0,0,0,0,1.05202,0,0,0,0,1,0,0,0,0,1);}
  3783. 87.5%{transform:matrix3d(1,0,0,0,0,1.08204,0,0,0,0,1,0,0,0,0,1);}
  3784. 85.4167%{transform:matrix3d(1.02563,0,0,0,0,1.09149,0,0,0,0,1,0,0,0,0,1);}
  3785. 83.3333%{transform:matrix3d(1.04227,0,0,0,0,1.08453,0,0,0,0,1,0,0,0,0,1);}
  3786. 81.25%{transform:matrix3d(1.05102,0,0,0,0,1.06666,0,0,0,0,1,0,0,0,0,1);}
  3787. 79.1667%{transform:matrix3d(1.05334,0,0,0,0,1.04355,0,0,0,0,1,0,0,0,0,1);}
  3788. 77.0833%{transform:matrix3d(1.05078,0,0,0,0,1.02012,0,0,0,0,1,0,0,0,0,1);}
  3789. 75%{transform:matrix3d(1.04487,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3790. 72.9167%{transform:matrix3d(1.03699,0,0,0,0,.98534,0,0,0,0,1,0,0,0,0,1);}
  3791. 70.8333%{transform:matrix3d(1.02831,0,0,0,0,.97688,0,0,0,0,1,0,0,0,0,1);}
  3792. 68.75%{transform:matrix3d(1.01973,0,0,0,0,.97422,0,0,0,0,1,0,0,0,0,1);}
  3793. 66.6667%{transform:matrix3d(1.01191,0,0,0,0,.97618,0,0,0,0,1,0,0,0,0,1);}
  3794. 64.5833%{transform:matrix3d(1.00526,0,0,0,0,.98122,0,0,0,0,1,0,0,0,0,1);}
  3795. 62.5%{transform:matrix3d(1,0,0,0,0,.98773,0,0,0,0,1,0,0,0,0,1);}
  3796. 60.4167%{transform:matrix3d(.99617,0,0,0,0,.99433,0,0,0,0,1,0,0,0,0,1);}
  3797. 58.3333%{transform:matrix3d(.99368,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3798. 56.25%{transform:matrix3d(.99237,0,0,0,0,1.00413,0,0,0,0,1,0,0,0,0,1);}
  3799. 54.1667%{transform:matrix3d(.99202,0,0,0,0,1.00651,0,0,0,0,1,0,0,0,0,1);}
  3800. 52.0833%{transform:matrix3d(.99241,0,0,0,0,1.00726,0,0,0,0,1,0,0,0,0,1);}
  3801. 50%{opacity:1;transform:matrix3d(.99329,0,0,0,0,1.00671,0,0,0,0,1,0,0,0,0,1);}
  3802. 47.9167%{transform:matrix3d(.99447,0,0,0,0,1.00529,0,0,0,0,1,0,0,0,0,1);}
  3803. 45.8333%{transform:matrix3d(.99577,0,0,0,0,1.00346,0,0,0,0,1,0,0,0,0,1);}
  3804. 43.75%{transform:matrix3d(.99705,0,0,0,0,1.0016,0,0,0,0,1,0,0,0,0,1);}
  3805. 41.6667%{transform:matrix3d(.99822,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3806. 39.5833%{transform:matrix3d(.99921,0,0,0,0,.99884,0,0,0,0,1,0,0,0,0,1);}
  3807. 37.5%{transform:matrix3d(1,0,0,0,0,.99816,0,0,0,0,1,0,0,0,0,1);}
  3808. 35.4167%{transform:matrix3d(1.00057,0,0,0,0,.99795,0,0,0,0,1,0,0,0,0,1);}
  3809. 33.3333%{transform:matrix3d(1.00095,0,0,0,0,.99811,0,0,0,0,1,0,0,0,0,1);}
  3810. 31.25%{transform:matrix3d(1.00114,0,0,0,0,.99851,0,0,0,0,1,0,0,0,0,1);}
  3811. 29.1667%{transform:matrix3d(1.00119,0,0,0,0,.99903,0,0,0,0,1,0,0,0,0,1);}
  3812. 27.0833%{transform:matrix3d(1.00114,0,0,0,0,.99955,0,0,0,0,1,0,0,0,0,1);}
  3813. 25%{transform:matrix3d(1.001,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3814. 22.9167%{transform:matrix3d(1.00083,0,0,0,0,1.00033,0,0,0,0,1,0,0,0,0,1);}
  3815. 20.8333%{transform:matrix3d(1.00063,0,0,0,0,1.00052,0,0,0,0,1,0,0,0,0,1);}
  3816. 18.75%{transform:matrix3d(1.00044,0,0,0,0,1.00058,0,0,0,0,1,0,0,0,0,1);}
  3817. 16.6667%{transform:matrix3d(1.00027,0,0,0,0,1.00053,0,0,0,0,1,0,0,0,0,1);}
  3818. 14.5833%{transform:matrix3d(1.00012,0,0,0,0,1.00042,0,0,0,0,1,0,0,0,0,1);}
  3819. 12.5%{transform:matrix3d(1,0,0,0,0,1.00027,0,0,0,0,1,0,0,0,0,1);}
  3820. 10.4167%{transform:matrix3d(.99991,0,0,0,0,1.00013,0,0,0,0,1,0,0,0,0,1);}
  3821. 8.33333%{transform:matrix3d(.99986,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);}
  3822. 6.25%{transform:matrix3d(.99983,0,0,0,0,.99991,0,0,0,0,1,0,0,0,0,1);}
  3823. 4.16667%{transform:matrix3d(.99982,0,0,0,0,.99985,0,0,0,0,1,0,0,0,0,1);}
  3824. 2.08333%{transform:matrix3d(.99983,0,0,0,0,.99984,0,0,0,0,1,0,0,0,0,1);}
  3825. 0%{opacity:1;transform:matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0type=close,1);}
  3826. }
  3827. @keyframes pops-anim-roll-reverse{0%{transform:perspective(1000px) rotate3d(1,0,0,0deg);}
  3828. 100%{transform:perspective(1000px) rotate3d(1,0,0,90deg);}
  3829. }
  3830. @keyframes pops-anim-sandra-reverse{0%{opacity:1;transform:scale3d(1,1,1);}
  3831. 100%{opacity:0;transform:scale3d(1.1,1.1,1);}
  3832. }
  3833. @keyframes pops-anim-gather-reverse{0%{opacity:0;transform:scale(5,0);}
  3834. 100%{opacity:0;transform:scale(5,0);}
  3835. }
  3836. @-webkit-keyframes pops-motion-fadeInTop{0%{opacity:0;-webkit-transform:translateY(-30px);transform:translateY(-30px);}
  3837. 100%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);}
  3838. }
  3839. @keyframes pops-motion-fadeInTop{0%{opacity:0;transform:translateY(-30px);-ms-transform:translateY(-30px);}
  3840. 100%{opacity:1;transform:translateX(0);-ms-transform:translateX(0);}
  3841. }
  3842. @-webkit-keyframes pops-motion-fadeOutTop{0%{opacity:10;-webkit-transform:translateY(0);transform:translateY(0);}
  3843. 100%{opacity:0;-webkit-transform:translateY(-30px);transform:translateY(-30px);}
  3844. }
  3845. @keyframes pops-motion-fadeOutTop{0%{opacity:1;transform:translateY(0);-ms-transform:translateY(0);}
  3846. 100%{opacity:0;transform:translateY(-30px);-ms-transform:translateY(-30px);}
  3847. }
  3848. @-webkit-keyframes pops-motion-fadeInBottom{0%{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px);}
  3849. 100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);}
  3850. }
  3851. @keyframes pops-motion-fadeInBottom{0%{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px);-ms-transform:translateY(20px);}
  3852. 100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-transform:translateY(0);}
  3853. }
  3854. @-webkit-keyframes pops-motion-fadeOutBottom{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);}
  3855. 100%{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px);}
  3856. }
  3857. @keyframes pops-motion-fadeOutBottom{0%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0);-ms-transform:translateY(0);}
  3858. 100%{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px);-ms-transform:translateY(20px);}
  3859. }
  3860. @-webkit-keyframes pops-motion-fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-20px);transform:translateX(-20px);}
  3861. 100%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);}
  3862. }
  3863. @keyframes pops-motion-fadeInLeft{0%{opacity:0;-webkit-transform:translateX(-30px);transform:translateX(-30px);-ms-transform:translateX(-30px);}
  3864. 100%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);-ms-transform:translateX(0);}
  3865. }
  3866. @-webkit-keyframes pops-motion-fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);}
  3867. 100%{opacity:0;-webkit-transform:translateX(-30px);transform:translateX(-30px);}
  3868. }
  3869. @keyframes pops-motion-fadeOutLeft{0%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);-ms-transform:translateX(0);}
  3870. 100%{opacity:0;-webkit-transform:translateX(-20px);transform:translateX(-20px);-ms-transform:translateX(-20px);}
  3871. }
  3872. @-webkit-keyframes pops-motion-fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px);}
  3873. 100%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);}
  3874. }
  3875. @keyframes pops-motion-fadeInRight{0%{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px);-ms-transform:translateX(20px);}
  3876. 100%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);-ms-transform:translateX(0);}
  3877. }
  3878. @-webkit-keyframes pops-motion-fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);}
  3879. 100%{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px);}
  3880. }
  3881. @keyframes pops-motion-fadeOutRight{0%{opacity:1;-webkit-transform:translateX(0);transform:translateX(0);-ms-transform:translateX(0);}
  3882. 100%{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px);-ms-transform:translateX(20px);}
  3883. }
  3884.  
  3885.  
  3886. /* 动画 */
  3887. .pops-anim[anim=pops-anim-spread]{animation:pops-anim-spread .3s;}
  3888. .pops-anim[anim=pops-anim-shake]{animation:pops-anim-shake .3s;}
  3889. .pops-anim[anim=pops-anim-rolling-left]{animation:pops-anim-rolling-left .3s;}
  3890. .pops-anim[anim=pops-anim-rolling-right]{animation:pops-anim-rolling-right .3s;}
  3891. .pops-anim[anim=pops-anim-slide-top]{animation:pops-anim-slide-top .3s;}
  3892. .pops-anim[anim=pops-anim-slide-bottom]{animation:pops-anim-slide-bottom .3s;}
  3893. .pops-anim[anim=pops-anim-slide-left]{animation:pops-anim-slide-left .3s;}
  3894. .pops-anim[anim=pops-anim-slide-right]{animation:pops-anim-slide-right .3s;}
  3895. .pops-anim[anim=pops-anim-fadein]{animation:pops-anim-fadein .3s;}
  3896. .pops-anim[anim=pops-anim-fadein-zoom]{animation:pops-anim-fadein-zoom .3s;}
  3897. .pops-anim[anim=pops-anim-fadein-alert]{animation:pops-anim-fadein-alert .3s;}
  3898. .pops-anim[anim=pops-anim-don]{animation:pops-anim-don .3s;}
  3899. .pops-anim[anim=pops-anim-roll]{animation:pops-anim-roll .3s;}
  3900. .pops-anim[anim=pops-anim-sandra]{animation:pops-anim-sandra .3s;}
  3901. .pops-anim[anim=pops-anim-gather]{animation:pops-anim-gather .3s;}
  3902. .pops-anim[anim=pops-anim-spread-reverse]{animation:pops-anim-spread-reverse .3s;}
  3903. .pops-anim[anim=pops-anim-shake-reverse]{animation:pops-anim-shake-reverse .3s;}
  3904. .pops-anim[anim=pops-anim-rolling-left-reverse]{animation:pops-anim-rolling-left-reverse .3s;}
  3905. .pops-anim[anim=pops-anim-rolling-right-reverse]{animation:pops-anim-rolling-right-reverse .3s;}
  3906. .pops-anim[anim=pops-anim-slide-top-reverse]{animation:pops-anim-slide-top-reverse .3s;}
  3907. .pops-anim[anim=pops-anim-slide-bottom-reverse]{animation:pops-anim-slide-bottom-reverse .3s;}
  3908. .pops-anim[anim=pops-anim-slide-left-reverse]{animation:pops-anim-slide-left-reverse .3s;}
  3909. .pops-anim[anim=pops-anim-slide-right-reverse]{animation:pops-anim-slide-right-reverse .3s;}
  3910. .pops-anim[anim=pops-anim-fadein-reverse]{animation:pops-anim-fadein-reverse .3s;}
  3911. .pops-anim[anim=pops-anim-fadein-zoom-reverse]{animation:pops-anim-fadein-zoom-reverse .3s;}
  3912. .pops-anim[anim=pops-anim-fadein-alert-reverse]{animation:pops-anim-fadein-alert-reverse .3s;}
  3913. .pops-anim[anim=pops-anim-don-reverse]{animation:pops-anim-don-reverse .3s;}
  3914. .pops-anim[anim=pops-anim-roll-reverse]{animation:pops-anim-roll-reverse .3s;}
  3915. .pops-anim[anim=pops-anim-sandra-reverse]{animation:pops-anim-sandra-reverse .3s;}
  3916. .pops-anim[anim=pops-anim-gather-reverse]{animation:pops-anim-gather-reverse .3s;}
  3917. `,
  3918. alertCSS: `
  3919. .pops[type-value] .pops-alert-title{display: flex;align-items: center;justify-content: space-between;}
  3920. .pops[type-value=alert] .pops-alert-title{width:100%;height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  3921. .pops[type-value=alert] .pops-alert-title p[pops]{width:100%;overflow:hidden;color:rgb(51, 51, 51);text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  3922. .pops[type-value=alert] .pops-alert-content p[pops]{padding:5px 10px;color:rgb(51, 51, 51);text-indent:15px;}
  3923. .pops[type-value=alert] .pops-alert-content{
  3924. width:100%;
  3925. height: calc(100% - var(--container-title-height) - var(--container-bottom-btn-height));
  3926. overflow: auto;
  3927. word-break:break-word;
  3928. }
  3929. .pops[type-value=alert] .pops-alert-btn{position:absolute;bottom:0;display:flex;padding:10px 10px 10px 10px;width:100%;height:var(--container-bottom-btn-height);border-top:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));text-align:right;line-height:var(--container-bottom-btn-height);align-items:center;}
  3930.  
  3931. `,
  3932. confirmCSS: `
  3933. .pops[type-value] .pops-confirm-title{display: flex;align-items: center;justify-content: space-between;}
  3934. .pops[type-value=confirm] .pops-confirm-title{width:100%;height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  3935. .pops[type-value=confirm] .pops-confirm-title p[pops]{width:100%;overflow:hidden;color:rgb(51, 51, 51);text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  3936. .pops[type-value=confirm] .pops-confirm-content p[pops]{padding:5px 10px;color:rgb(51, 51, 51);text-indent:15px;}
  3937. .pops[type-value=confirm] .pops-confirm-content{
  3938. width:100%;
  3939. height: calc(100% - var(--container-title-height) - var(--container-bottom-btn-height));
  3940. overflow: auto;
  3941. word-break:break-word;
  3942. }
  3943. .pops[type-value=confirm] .pops-confirm-btn{position:absolute;bottom:0;display:flex;padding:10px 10px 10px 10px;width:100%;height:var(--container-bottom-btn-height);border-top:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));text-align:right;line-height:var(--container-bottom-btn-height);align-items:center;}
  3944. `,
  3945. promptCSS: `
  3946. .pops[type-value] .pops-prompt-title{display: flex;align-items: center;justify-content: space-between;}
  3947. .pops[type-value=prompt] .pops-prompt-title{width:100%;height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  3948. .pops[type-value=prompt] .pops-prompt-title p[pops]{width:100%;overflow:hidden;color:rgb(51, 51, 51);text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  3949. .pops[type-value=prompt] .pops-prompt-content p[pops]{padding:5px 10px;color:rgb(51, 51, 51);text-indent:15px;}
  3950. .pops[type-value=prompt] .pops-prompt-content{
  3951. width:100%;
  3952. height: calc(100% - var(--container-title-height) - var(--container-bottom-btn-height));
  3953. overflow: auto;
  3954. word-break:break-word;
  3955. }
  3956. .pops[type-value=prompt] .pops-prompt-btn{position:absolute;bottom:0;display:flex;padding:10px 10px 10px 10px;width:100%;height:var(--container-bottom-btn-height);border-top:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));text-align:right;line-height:var(--container-bottom-btn-height);align-items:center;}
  3957. .pops[type-value=prompt] input[pops]{padding:5px 10px;}
  3958. .pops[type-value=prompt] textarea[pops]{padding:5px 10px;resize:none;}
  3959. .pops[type-value=prompt] input[pops],.pops[type-value=prompt] textarea[pops]{width:100%;height:100%;outline:0;border:0;color:rgb(51, 51, 51);}
  3960.  
  3961. `,
  3962. loadingCSS: `
  3963. .pops[type-value=loading] {
  3964. position: absolute;
  3965. top: 272.5px;
  3966. top: 50%;
  3967. left: 26px;
  3968. left: 50%;
  3969. display: flex;
  3970. overflow: hidden;
  3971. padding: 10px 15px;
  3972. max-width: 100%;
  3973. max-height: 100%;
  3974. min-width: 0;
  3975. min-height: 0;
  3976. border: 1px solid rgba(0,0,0,.2);
  3977. border-radius: 5px;
  3978. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  3979. box-shadow: 0 0 5px rgb(0 0 0 / 50%);
  3980. vertical-align: middle;
  3981. transition: all .35s;
  3982. transform: translate(-50%,-50%);
  3983. user-select: none;
  3984. -webkit-user-select: none;
  3985. -moz-user-select: none;
  3986. -ms-user-select: none;
  3987. flex-direction: column;
  3988. align-items: center;
  3989. justify-content: center;
  3990. align-content: center;
  3991. }
  3992. .pops[type-value=loading]:before{float:left;display:inline-block;width:2em;height:2em;border:.3em solid rgba(100,149,237,.1);border-top:.3em solid rgb(100, 149, 237, var(--pops-bd-opacity));border-radius:50%;content:" ";vertical-align:middle;font-size:inherit;animation:pops-anim-wait-rotate 1.2s linear infinite;}
  3993. .pops[type-value=loading] .pops-loading-content{position:static;top:0;bottom:0;float:left;overflow:hidden;width:auto;font-size:inherit;line-height:2em;}
  3994. .pops[type-value=loading] .pops-loading-content p[pops] {
  3995. display: inline-block;
  3996. padding: 5px 0px;
  3997. color: rgb(51, 51, 51);
  3998. text-indent: 15px;
  3999. font-size: inherit;
  4000. text-align: center;
  4001. }
  4002. `,
  4003. iframeCSS: `
  4004. .pops[type-value=iframe]{
  4005. --container-title-height: 55px;
  4006. }
  4007. .pops[type-value] .pops-iframe-title{display: flex;align-items: center;justify-content: space-between;}
  4008. .pops[type-value=iframe] .pops-iframe-title{width:calc(100% - 0px);height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  4009. .pops[type-value=iframe] .pops-iframe-title p[pops]{width:100%;overflow:hidden;color:rgb(51, 51, 51);text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  4010. .pops[type-value=iframe] .pops-iframe-content p[pops]{padding:5px 10px;color:#333;text-indent:15px;}
  4011. .pops[type-value=iframe] .pops-iframe-content{
  4012. width:100%;
  4013. height: calc(100% - var(--container-title-height));
  4014. overflow: hidden;
  4015. word-break:break-word;
  4016. }
  4017. .pops-loading{position:absolute;top:40px;right:0;bottom:0;left:0;z-index:5;background-color:rgb(255, 255, 255, var(--pops-bg-opacity));}
  4018. .pops-loading:before{position:absolute;top:50%;left:50%;z-index:3;display:block;margin:-20px 0 0 -20px;padding:20px;border:4px solid rgb(221, 221, 221, var(--pops-bd-opacity));border-radius:50%;content:"";border-top-color:transparent;animation:pops-anim-wait-rotate 1.2s linear infinite;}
  4019. .pops[type-value=iframe].pops[type-module=min]{top:unset!important;bottom:0;max-width:200px;max-height:53px;transform:none;}
  4020. .pops[type-value=iframe].pops[type-module=min] .pops-header-control[type=min]{display:none;}
  4021. .pops[type-value=iframe].pops[type-module=max]{top:unset!important;left:unset!important;width:100%!important;height:100%!important;transform:none;}
  4022. .pops[type-value=iframe] iframe[pops]{width:calc(100% - 4px);height:calc(100% - 4px);border:0;}
  4023. .pops-iframe-content-global-loading{position:absolute;top:0;left:0;z-index:999999;width:0;height:4px;background:linear-gradient(to right,#4995dd,#fff,rgb(202 224 246));animation:iframeLoadingChange 2s forwards;}
  4024. `,
  4025. drawerCSS: `
  4026. .pops[type-value=drawer] {
  4027. position: fixed;
  4028. box-sizing: border-box;
  4029. display: flex;
  4030. flex-direction: column;
  4031. box-shadow: 0px 16px 48px 16px rgba(0, 0, 0, .08), 0px 12px 32px rgba(0, 0, 0, .12), 0px 8px 16px -8px rgba(0, 0, 0, .16);
  4032. overflow: hidden;
  4033. transition: all .3s;
  4034. }
  4035. .pops[type-value] .pops-drawer-title{display: flex;align-items: center;justify-content: space-between;}
  4036. .pops[type-value=drawer][direction=top]{width: 100%;left: 0;right: 0;top: 0;}
  4037. .pops[type-value=drawer][direction=bottom]{width: 100%;left: 0;right: 0;bottom: 0;}
  4038. .pops[type-value=drawer][direction=left]{height: 100%;top: 0;bottom: 0;left: 0;}
  4039. .pops[type-value=drawer][direction=right]{height: 100%;top: 0;bottom: 0;right: 0;}
  4040. .pops-drawer-content{height: 100%;}
  4041. .pops[type-value="drawer"] .pops-drawer-btn{padding-top: 10px;padding-bottom: 10px;}
  4042. `,
  4043. folderCSS: `
  4044. .pops[type-value] .pops-folder-title{display: flex;align-items: center;justify-content: space-between;}
  4045. .pops[type-value=folder] .pops-folder-title{width:100%;height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  4046. .pops[type-value=folder] .pops-folder-title p[pops]{width:100%;overflow:hidden;color:rgb(51, 51, 51);text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  4047. .pops[type-value=folder] .pops-folder-content p[pops]{padding:5px 10px;color:rgb(51, 51, 51);text-indent:15px;}
  4048. .pops[type-value=folder] .pops-folder-content{
  4049. width:100%;
  4050. height: calc(100% - var(--container-title-height) - var(--container-bottom-btn-height));
  4051. overflow: auto;
  4052. word-break:break-word;
  4053. }
  4054. .pops[type-value=folder] .pops-folder-btn{position:absolute;bottom:0;display:flex;padding:10px 10px 10px 10px;width:100%;height:var(--container-bottom-btn-height);border-top:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));text-align:right;line-height:var(--container-bottom-btn-height);align-items:center;}
  4055. .pops-folder-list .cursor-p{cursor:pointer}
  4056. .pops-folder-list a{background:0 0;text-decoration:none;-webkit-tap-highlight-color:transparent;color:#05082c}
  4057. table.pops-folder-list-table__body,table.pops-folder-list-table__header{width:100%;table-layout:fixed;border-collapse:collapse;border-spacing:0;padding:0 20px}
  4058. table.pops-folder-list-table__body,table.pops-folder-list-table__header{height:100%;background:0 0;overflow:hidden;display:-webkit-box;display:-ms-flexbox;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal}
  4059. table.pops-folder-list-table__body{height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
  4060. .pops-folder-list table tr{line-height:1}
  4061. .pops-folder-list-table__header-row{height:50px;line-height:50px;color:rgb(129, 137, 153);text-align:left;font-size:12px}
  4062. .pops-folder-list-table__header-row{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
  4063. .pops-folder-list-table__body-row{height:50px;line-height:50px;color:#03081a;font-size:12px}
  4064. .pops-folder-list-table__body-row:hover{background:rgb(245, 246, 247, var(--pops-bg-opacity))}
  4065. .pops-folder-list table th{border:0;border-bottom:1px solid rgb(247, 248, 250, var(--pops-bg-opacity))}
  4066. .pops-folder-list table td{border:0;border-bottom:1px solid rgb(247, 248, 250, var(--pops-bg-opacity));position:relative}
  4067. .pops-folder-list .list-name-text{display:inline-block;padding-left:12px;line-height:40px;max-width:176px}
  4068. .pops-folder-list-file-name > div{display:flex;align-items:center;}
  4069. .pops-mobile-folder-list-file-name{display:flex;align-items:center}
  4070. .pops-mobile-folder-list-file-name>div {
  4071. display: flex;
  4072. flex-wrap: wrap;
  4073. justify-content: flex-start;
  4074. align-items: flex-start;
  4075. padding: 6px 0px;
  4076. flex-direction: column;
  4077. }
  4078. .pops-mobile-folder-list-file-name img.pops-folder-list-file-icon{width:45px;height:45px}
  4079. .pops-mobile-folder-list-file-name a.pops-folder-list-file-name-title-text {
  4080. padding-left: unset;
  4081. max-width: 250px;
  4082. overflow-x: hidden;
  4083. font-weight: 400;
  4084. line-height: unset;
  4085. margin-bottom: 4px;
  4086. white-space: normal;
  4087. text-overflow: unset;
  4088. }
  4089. /* 修改滚动 */
  4090. .pops-folder-content{overflow: hidden !important}
  4091. .pops-folder-content .pops-folder-list{height: 100%}
  4092. .pops-folder-content .pops-folder-list-table__body-div{height: 100%;padding-bottom: 85px}
  4093. .pops-mobile-folder-content .pops-folder-list-table__body-div{height: 100%;padding-bottom: 40px}
  4094. .pops-folder-content table.pops-folder-list-table__body{overflow: auto}
  4095. .pops-mobile-folder-content .pops-folder-list-table__header-div{display: none}
  4096. .pops-folder-list-file-name-title-text:hover{text-decoration:none;color:rgb(6, 167, 255)}
  4097. .pops-folder-list .text-ellip{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  4098. .pops-folder-list .content{color:rgb(129, 137, 153);position:relative;width:100%;text-align:left}
  4099. .pops-folder-list .inline-block-v-middle{display:inline-block;vertical-align:middle}
  4100. .pops-folder-list .flex-a-i-center{display: flex;align-items: center;}
  4101. .pops-folder-list .u-file-icon{display:inline-block;vertical-align:middle}
  4102. .pops-folder-list .u-file-icon--list{width:32px;height:32px}
  4103. .pops-folder-list .pops-folder-list-file-icon{line-height:1;position:relative;vertical-align:middle}
  4104. .pops-folder-list .pops-folder-file-list-breadcrumb-primary {
  4105. display: -webkit-box;
  4106. display: -webkit-flex;
  4107. display: -ms-flexbox;
  4108. display: flex;
  4109. -webkit-box-align: center;
  4110. -webkit-align-items: center;
  4111. -ms-flex-align: center;
  4112. align-items: center;
  4113. -webkit-box-orient: horizontal;
  4114. -webkit-box-direction: normal;
  4115. -webkit-flex-direction: row;
  4116. -ms-flex-direction: row;
  4117. flex-direction: row;
  4118. min-height: 17px;
  4119. flex-wrap: wrap;
  4120. }
  4121. .pops-folder-list .pops-folder-list-table__sort {
  4122. display: inline-flex;
  4123. margin-left: 4px;
  4124. flex-direction: column;
  4125. }
  4126. .pops-folder-list .pops-folder-icon-arrow{
  4127. width: 10px;
  4128. height: 10px;
  4129. fill: rgb(212, 215, 222);
  4130. }
  4131. .pops-folder-list .pops-folder-icon-active{
  4132. fill: rgb(6, 167, 255);
  4133. }
  4134. .pops-folder-list .pops-folder-file-list-breadcrumb {
  4135. padding: 4px 20px;
  4136. -webkit-box-sizing: border-box;
  4137. box-sizing: border-box;
  4138. display: -webkit-box;
  4139. display: -webkit-flex;
  4140. display: -ms-flexbox;
  4141. display: flex;
  4142. -webkit-box-align: center;
  4143. -webkit-align-items: center;
  4144. -ms-flex-align: center;
  4145. align-items: center;
  4146. -webkit-box-orient: horizontal;
  4147. -webkit-box-direction: normal;
  4148. -webkit-flex-direction: row;
  4149. -ms-flex-direction: row;
  4150. flex-direction: row;
  4151. -webkit-box-pack: start;
  4152. -webkit-justify-content: start;
  4153. -ms-flex-pack: start;
  4154. justify-content: flex-start;
  4155. min-height: 35px;
  4156. }
  4157. .pops-folder-list .pops-folder-file-list-breadcrumb-allFiles{font-size:12px;color:#333;line-height:20px;font-weight:700;display:inline-block;max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}
  4158. .pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:last-child a{color:rgb(153, 153, 153)}
  4159. .pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child a{font-size:14px;color:rgb(18, 22, 26)}
  4160. .pops-folder-list .pops-folder-file-list-breadcrumb .iconArrow{width:16px;height:16px}
  4161. .pops-folder-list .iconArrow{
  4162. background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAASCAMAAABYd88+AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABFUExURUdwTOLi4uLi4t7e3uPj49/f397e3t3d3f///97e3vDw8N3d3d7e3t3d3d3d3ejo6N/f397e3t7e3t3d3d/f393d3d3d3RK+NoEAAAAWdFJOUwAnM4YPU/iQA+UIeMDaHhY41i7zX7UebpjFAAAAUElEQVQI15XOORaAIAwE0LATXHCd+x9VfCiksXCq+UUWou8oZ1vXHrt7YVBiYkW4gdMKYFIC4CSATWCNHWPuM6HuHkr1x3N0ZrBu/9gl0b9c3+kF7C7hS1YAAAAASUVORK5CYII=) 55% 50%/6px 9px no-repeat;
  4163. }
  4164.  
  4165.  
  4166. `,
  4167. panelCSS: `
  4168. .pops[type-value=panel]{
  4169. --el-disabled-text-color: #a8abb2;
  4170. --el-disabled-bg-color: #f5f7fa;
  4171. --el-disabled-border-color: #e4e7ed;
  4172. --aside-bg-color: #f2f2f2;
  4173. }
  4174. .pops[type-value] .pops-panel-title{display: flex;align-items: center;justify-content: space-between;}
  4175. .pops[type-value=panel] .pops-panel-title{width:100%;height:var(--container-title-height);border-bottom:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  4176. .pops[type-value=panel] .pops-panel-title p[pops]{width:100%;overflow:hidden;color:#333;text-indent:15px;text-overflow:ellipsis;white-space:nowrap;font-weight:500;line-height:var(--container-title-height);}
  4177. .pops[type-value=panel] .pops-panel-content{
  4178. width:100%;
  4179. height: calc(100% - var(--container-title-height) - var(--container-bottom-btn-height));
  4180. overflow: auto;
  4181. word-break:break-word;
  4182. }
  4183. .pops[type-value=panel] .pops-panel-btn{position:absolute;bottom:0;display:flex;padding:10px 10px 10px 10px;width:100%;height:var(--container-bottom-btn-height);border-top:1px solid rgb(229, 229, 229, var(--pops-bd-opacity));text-align:right;line-height:var(--container-bottom-btn-height);align-items:center;}
  4184. /* ↓panel的CSS↓ */
  4185. aside.pops-panel-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;max-width:200px;height:100%;background:var(--aside-bg-color);border-right:1px solid var(--aside-bg-color);font-size:0.9em;}
  4186. .pops-panel-content{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0;bottom:0!important}
  4187. section.pops-panel-container{width:100%;padding:10px;overflow:hidden}
  4188. section.pops-panel-container .pops-panel-container-header-ul{border-bottom: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));}
  4189. section.pops-panel-container .pops-panel-container-header-ul li{display: flex;justify-content: flex-start !important;text-align:left;}
  4190. section.pops-panel-container > ul:last-child{overflow: auto;height: calc(100% - 45px);}
  4191. aside.pops-panel-aside ul li{margin:6px 8px;border-radius:4px;padding:6px 10px;cursor:default;display:flex;align-items:center;justify-content:flex-start}
  4192. aside.pops-panel-aside .pops-is-visited,aside.pops-panel-aside ul li:hover{color:rgb(64, 158, 255);background:rgba(64,158,255 ,.1)}
  4193. section.pops-panel-container>ul li{display:flex;justify-content:space-between;align-items:center;margin:10px 20px}
  4194. section.pops-panel-container li.pops-panel-forms-container-item{display:block;margin-top:20px}
  4195. section.pops-panel-container .pops-panel-forms-container-item ul{border-radius:6px;background:var(--aside-bg-color);margin:10px}
  4196. section.pops-panel-container .pops-panel-forms-container-item ul li {
  4197. display: flex;
  4198. justify-content: space-between;
  4199. align-items: center;
  4200. margin: 0 10px;
  4201. padding: 10px 0;
  4202. border-bottom: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));
  4203. text-align: left;
  4204. }
  4205. section.pops-panel-container .pops-panel-forms-container-item ul li:last-child{border:0}
  4206. section.pops-panel-container .pops-panel-forms-container-item>div{margin:10px;margin-left:20px;font-size:0.9em;text-align:left;}
  4207. /* 主文字 */
  4208. section.pops-panel-container .pops-panel-forms-container-item .pops-panel-item-left-text .pops-panel-item-left-main-text {
  4209. /* line-height: 2; */
  4210. }
  4211. /* 描述文字 */
  4212. section.pops-panel-container .pops-panel-forms-container-item .pops-panel-item-left-text .pops-panel-item-left-desc-text{
  4213. /* line-height: 1; */
  4214. margin-top: 6px;
  4215. font-size: 0.8em;
  4216. color: rgb(108, 108, 108);
  4217. }
  4218. /* 兼容移动端CSS */
  4219. .pops[type-value="panel"].pops-panel-is-mobile{
  4220. width: 92dvw;
  4221. }
  4222. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container{
  4223. padding: 10px 0px;
  4224. }
  4225. .pops[type-value="panel"].pops-panel-is-mobile .pops-panel-content aside.pops-panel-aside{
  4226. width: 20%;
  4227. }
  4228. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container .pops-panel-forms-container-item>div{
  4229. margin: 5px 10px;
  4230. text-align: left;
  4231. }
  4232. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container .pops-panel-forms-container-item ul{
  4233. margin: 0px !important;
  4234. }
  4235. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container>ul li{
  4236. margin: 5px 5px!important;
  4237. padding: 5px 5px !important;
  4238. }
  4239. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container >ul > li div:nth-child(2){
  4240. max-width: 55%;
  4241. margin-left: 6px;
  4242. text-align: right;
  4243. }
  4244. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container .pops-panel-select select{
  4245. min-width: 88px !important;
  4246. width: -webkit-fill-available;
  4247. width: -moz-available;
  4248. }
  4249. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container .pops-panel-container-header-ul li{
  4250. font-size: 16px;
  4251. }
  4252. .pops[type-value="panel"].pops-panel-is-mobile .pops-panel-title p[pops],
  4253. .pops[type-value="panel"].pops-panel-is-mobile section.pops-panel-container>ul li,
  4254. .pops[type-value="panel"].pops-panel-is-mobile aside.pops-panel-aside ul li{
  4255. font-size: 14px;
  4256. }
  4257. /* switch的CSS */
  4258. .pops-panel-switch {
  4259. display: inline-flex;
  4260. flex-direction: row-reverse;
  4261. align-items: center;
  4262. position: relative;
  4263. font-size: 14px;
  4264. line-height: 20px;
  4265. height: 32px;
  4266. vertical-align: middle
  4267. }
  4268. .pops-panel-switch input.pops-panel-switch__input {
  4269. position: absolute;
  4270. width: 0;
  4271. height: 0;
  4272. opacity: 0;
  4273. margin: 0
  4274. }
  4275. .pops-panel-switch:has(input.pops-panel-switch__input:disabled),
  4276. .pops-panel-switch[data-disabled],
  4277. .pops-panel-switch[data-disabled] .pops-panel-switch__core,
  4278. .pops-panel-switch input.pops-panel-switch__input:disabled + .pops-panel-switch__core{
  4279. cursor: not-allowed;
  4280. opacity: .6;
  4281. }
  4282. .pops-panel-switch span.pops-panel-switch__core {
  4283. display: inline-flex;
  4284. position: relative;
  4285. align-items: center;
  4286. min-width: 40px;
  4287. height: 20px;
  4288. border: 1px solid rgb(220, 223, 230, var(--pops-bd-opacity));
  4289. outline: 0;
  4290. border-radius: 10px;
  4291. box-sizing: border-box;
  4292. background: rgb(220, 223, 230, var(--pops-bg-opacity));
  4293. cursor: pointer;
  4294. transition: border-color .3s,background-color .3s
  4295. }
  4296. .pops-panel-switch .pops-panel-switch__action {
  4297. position: absolute;
  4298. left: 1px;
  4299. border-radius: 100%;
  4300. transition: all .3s;
  4301. width: 16px;
  4302. height: 16px;
  4303. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4304. display: flex;
  4305. justify-content: center;
  4306. align-items: center;
  4307. color: rgb(220, 223, 230)
  4308. }
  4309. .pops-panel-switch.pops-panel-switch-is-checked span.pops-panel-switch__core{border-color:rgb(64, 158, 255, var(--pops-bd-opacity));background-color:rgb(64, 158, 255, var(--pops-bg-opacity))}
  4310. .pops-panel-switch.pops-panel-switch-is-checked .pops-panel-switch__action{left:calc(100% - 17px);color:rgb(64, 158, 255)}
  4311. /* switch的CSS */
  4312. /* slider旧的CSS */
  4313. section.pops-panel-container .pops-panel-slider:has(>input[type=range]){overflow:hidden;height:25px;line-height:25px;display:flex;align-items:center}
  4314. section.pops-panel-container .pops-panel-slider input[type=range] {
  4315. height: 6px;
  4316. background: rgb(228, 231, 237, var(--pops-bg-opacity));
  4317. outline: 0;
  4318. -webkit-appearance: none;
  4319. appearance: none;
  4320. width: 100%;
  4321. }
  4322. section.pops-panel-container .pops-panel-slider input[type=range]::-webkit-slider-thumb{
  4323. width: 20px;
  4324. height: 20px;
  4325. border-radius: 50%;
  4326. border: 1px solid rgb(64, 158, 255, var(--pops-bd-opacity));
  4327. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4328. box-shadow: 0 0 2px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2);
  4329. cursor: pointer;
  4330. -webkit-appearance: none;
  4331. appearance: none;
  4332. border-image: linear-gradient(#409eff,#409eff) 0 fill/9 25 9 0/0 0 0 100vw;
  4333. }
  4334. section.pops-panel-container .pops-panel-slider input[type=range]::-moz-range-thumb {
  4335. width: 20px;
  4336. height: 20px;
  4337. border-radius: 50%;
  4338. border: 1px solid rgb(64, 159, 255, var(--pops-bd-opacity));
  4339. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4340. box-shadow: 0 0 2px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2);
  4341. cursor: pointer;
  4342. -webkit-appearance: none;
  4343. appearance: none;
  4344. }
  4345. section.pops-panel-container .pops-panel-slider input[type=range]::-moz-range-progress{
  4346. height: 6px;
  4347. border-image: linear-gradient(#409eff,#409eff) 0 fill/9 25 9 0/0 0 0 100vw;
  4348. }
  4349. /* slider旧的CSS */
  4350. /* slider的CSS */
  4351. .pops-slider {
  4352. --pops-slider-color-white: #ffffff;
  4353. --pops-slider-color-primary: #409eff;
  4354. --pops-slider-color-info: #909399;
  4355. --pops-slider-text-color-placeholder: #a8abb2;
  4356. --pops-slider-border-color-light: #e4e7ed;
  4357. --pops-slider-border-radius-circle: 100%;
  4358. --pops-slider-transition-duration-fast: 0.2s;
  4359. --pops-slider-main-bg-color: var(--pops-slider-color-primary);
  4360. --pops-slider-runway-bg-color: var(--pops-slider-border-color-light);
  4361. --pops-slider-stop-bg-color: var(--pops-slider-color-white);
  4362. --pops-slider-disabled-color: var(--pops-slider-text-color-placeholder);
  4363. --pops-slider-border-radius: 3px;
  4364. --pops-slider-height: 6px;
  4365. --pops-slider-button-size: 20px;
  4366. --pops-slider-button-wrapper-size: 36px;
  4367. --pops-slider-button-wrapper-offset: -15px;
  4368. }
  4369. .pops-slider {
  4370. width: 100%;
  4371. height: 32px;
  4372. display: flex;
  4373. align-items: center;
  4374. }
  4375. .pops-slider-width{
  4376. flex: 0 0 52%;
  4377. margin-left: 10px;
  4378. }
  4379. .pops-slider__runway {
  4380. flex: 1;
  4381. height: var(--pops-slider-height);
  4382. background-color: var(--pops-slider-runway-bg-color);
  4383. border-radius: var(--pops-slider-border-radius);
  4384. position: relative;
  4385. cursor: pointer;
  4386. }
  4387. .pops-slider__runway.show-input {
  4388. margin-right: 30px;
  4389. width: auto;
  4390. }
  4391. .pops-slider__runway.pops-slider-is-disabled {
  4392. cursor: default;
  4393. }
  4394. .pops-slider__runway.pops-slider-is-disabled .pops-slider__bar {
  4395. background-color: var(--pops-slider-disabled-color);
  4396. }
  4397. .pops-slider__runway.pops-slider-is-disabled .pops-slider__button {
  4398. border-color: var(--pops-slider-disabled-color);
  4399. }
  4400. .pops-slider__runway.pops-slider-is-disabled
  4401. .pops-slider__button:hover,
  4402. .pops-slider__runway.pops-slider-is-disabled
  4403. .pops-slider__button.hover,
  4404. .pops-slider__runway.pops-slider-is-disabled
  4405. .pops-slider__button.dragging {
  4406. cursor: not-allowed;
  4407. }
  4408. .pops-slider__runway.pops-slider-is-disabled .pops-slider__button:hover,
  4409. .pops-slider__runway.pops-slider-is-disabled .pops-slider__button.hover,
  4410. .pops-slider__runway.pops-slider-is-disabled
  4411. .pops-slider__button.dragging {
  4412. transform: scale(1);
  4413. }
  4414. .pops-slider__runway.pops-slider-is-disabled .pops-slider__button:hover,
  4415. .pops-slider__runway.pops-slider-is-disabled .pops-slider__button.hover,
  4416. .pops-slider__runway.pops-slider-is-disabled
  4417. .pops-slider__button.dragging {
  4418. cursor: not-allowed;
  4419. }
  4420. .pops-slider__input {
  4421. flex-shrink: 0;
  4422. width: 130px;
  4423. }
  4424. .pops-slider__bar {
  4425. height: var(--pops-slider-height);
  4426. background-color: var(--pops-slider-main-bg-color);
  4427. border-top-left-radius: var(--pops-slider-border-radius);
  4428. border-bottom-left-radius: var(--pops-slider-border-radius);
  4429. position: absolute;
  4430. }
  4431. .pops-slider__button-wrapper {
  4432. height: var(--pops-slider-button-wrapper-size);
  4433. width: var(--pops-slider-button-wrapper-size);
  4434. position: absolute;
  4435. z-index: 1;
  4436. top: var(--pops-slider-button-wrapper-offset);
  4437. transform: translate(-50%);
  4438. background-color: transparent;
  4439. text-align: center;
  4440. user-select: none;
  4441. line-height: normal;
  4442. outline: none;
  4443. }
  4444. .pops-slider__button-wrapper:after {
  4445. display: inline-block;
  4446. content: "";
  4447. height: 100%;
  4448. vertical-align: middle;
  4449. }
  4450. .pops-slider__button:hover,
  4451. .pops-slider__button.hover {
  4452. cursor: grab;
  4453. }
  4454. .pops-slider__button {
  4455. display: inline-block;
  4456. width: var(--pops-slider-button-size);
  4457. height: var(--pops-slider-button-size);
  4458. vertical-align: middle;
  4459. border: solid 2px var(--pops-slider-main-bg-color);
  4460. background-color: var(--pops-slider-color-white);
  4461. border-radius: 50%;
  4462. box-sizing: border-box;
  4463. transition: var(--pops-slider-transition-duration-fast);
  4464. user-select: none;
  4465. }
  4466. .pops-slider__button:hover,
  4467. .pops-slider__button.hover,
  4468. .pops-slider__button.dragging {
  4469. transform: scale(1.2);
  4470. }
  4471. .pops-slider__button:hover,
  4472. .pops-slider__button.hover {
  4473. cursor: grab;
  4474. }
  4475. .pops-slider__button.dragging {
  4476. cursor: grabbing;
  4477. }
  4478. .pops-slider__stop {
  4479. position: absolute;
  4480. height: var(--pops-slider-height);
  4481. width: var(--pops-slider-height);
  4482. border-radius: var(--pops-slider-border-radius-circle);
  4483. background-color: var(--pops-slider-stop-bg-color);
  4484. transform: translate(-50%);
  4485. }
  4486. .pops-slider__marks {
  4487. top: 0;
  4488. left: 12px;
  4489. width: 18px;
  4490. height: 100%;
  4491. }
  4492. .pops-slider__marks-text {
  4493. position: absolute;
  4494. transform: translate(-50%);
  4495. font-size: 14px;
  4496. color: var(--pops-slider-color-info);
  4497. margin-top: 15px;
  4498. white-space: pre;
  4499. }
  4500. .pops-slider.is-vertical {
  4501. position: relative;
  4502. display: inline-flex;
  4503. width: auto;
  4504. height: 100%;
  4505. flex: 0;
  4506. }
  4507. .pops-slider.is-vertical .pops-slider__runway {
  4508. width: var(--pops-slider-height);
  4509. height: 100%;
  4510. margin: 0 16px;
  4511. }
  4512. .pops-slider.is-vertical .pops-slider__bar {
  4513. width: var(--pops-slider-height);
  4514. height: auto;
  4515. border-radius: 0 0 3px 3px;
  4516. }
  4517. .pops-slider.is-vertical .pops-slider__button-wrapper {
  4518. top: auto;
  4519. left: var(--pops-slider-button-wrapper-offset);
  4520. transform: translateY(50%);
  4521. }
  4522. .pops-slider.is-vertical .pops-slider__stop {
  4523. transform: translateY(50%);
  4524. }
  4525. .pops-slider.is-vertical .pops-slider__marks-text {
  4526. margin-top: 0;
  4527. left: 15px;
  4528. transform: translateY(50%);
  4529. }
  4530. .pops-slider--large {
  4531. height: 40px;
  4532. }
  4533. .pops-slider--small {
  4534. height: 24px;
  4535. }
  4536. /* slider的CSS */
  4537. /* input的CSS */
  4538. .pops-panel-input{display:flex;align-items:center;border:1px solid #dcdfe6;border-radius:4px;background-color:#ffffff}
  4539. .pops-panel-input:hover{box-shadow:0 0 0 1px #c0c4cc inset}
  4540. .pops-panel-input:has(input:focus){outline:0;border:1px solid #409eff;border-radius:4px;box-shadow:none}
  4541. .pops-panel-input input {
  4542. display: inline-flex;
  4543. justify-content: center;
  4544. align-items: center;
  4545. line-height: 1;
  4546. height: 32px;
  4547. white-space: nowrap;
  4548. cursor: text;
  4549. text-align: center;
  4550. box-sizing: border-box;
  4551. outline: 0;
  4552. transition: .1s;
  4553. font-weight: 500;
  4554. user-select: none;
  4555. vertical-align: middle;
  4556. -webkit-appearance: none;
  4557. appearance: none;
  4558. background-color: transparent;
  4559. border: 0;
  4560. padding: 8px 8px;
  4561. font-size: 14px;
  4562. text-align: start;
  4563. width: 100%;
  4564. flex: 1;
  4565. }
  4566. .pops-panel-input span.pops-panel-input__suffix {
  4567. display: inline-flex;
  4568. white-space: nowrap;
  4569. flex-shrink: 0;
  4570. flex-wrap: nowrap;
  4571. height: 100%;
  4572. text-align: center;
  4573. color: #a8abb2;
  4574. transition: all .3s;
  4575. pointer-events: none;
  4576. margin: 0 8px;
  4577. }
  4578. .pops-panel-input span.pops-panel-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}
  4579. .pops-panel-input .pops-panel-icon{cursor:pointer}
  4580. .pops-panel-input .pops-panel-icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all .3s}
  4581. .pops-panel-input .pops-panel-icon svg{height:1em;width:1em}
  4582. .pops-input-disabled{
  4583. background-color: var(--el-disabled-bg-color);
  4584. box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
  4585. }
  4586. .pops-panel-input.pops-input-disabled{
  4587. border: none;
  4588. }
  4589. .pops-panel-input.pops-input-disabled:hover{
  4590. box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
  4591. }
  4592. .pops-panel-input input:disabled,
  4593. .pops-panel-input input:disabled + .pops-panel-input__suffix{
  4594. user-select: none;
  4595. -webkit-user-select: none;
  4596. -moz-user-select: none;
  4597. -ms-user-select: none;
  4598. color: var(--el-disabled-text-color);
  4599. -webkit-text-fill-color: var(--el-disabled-text-color);
  4600. cursor: not-allowed;
  4601. }
  4602. .pops-panel-input input:disabled + .pops-panel-input__suffix{
  4603. display: none;
  4604. }
  4605. /* input的CSS */
  4606. /* textarea的CSS */
  4607. .pops-panel-textarea textarea {
  4608. width: 100%;
  4609. vertical-align: bottom;
  4610. position: relative;
  4611. display: block;
  4612. resize: none;
  4613. padding: 5px 11px;
  4614. line-height: 1;
  4615. box-sizing: border-box;
  4616. font-size: inherit;
  4617. font-family: inherit;
  4618. background-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4619. background-image: none;
  4620. -webkit-appearance: none;
  4621. appearance: none;
  4622. box-shadow: 0 0 0 1px #dcdfe6 inset;
  4623. border-radius: 0;
  4624. transition: box-shadow .2s cubic-bezier(.645, .045, .355, 1);
  4625. border: none;
  4626. }
  4627. .pops-panel-textarea textarea:hover{box-shadow:0 0 0 1px #c0c4cc inset}
  4628. .pops-panel-textarea-disable .pops-panel-textarea textarea:hover{box-shadow:none}
  4629. .pops-panel-textarea textarea:focus{outline:0;box-shadow:0 0 0 1px #409eff inset}
  4630. /* textarea的CSS */
  4631. /* select的CSS */
  4632. .pops-panel-select select {
  4633. height: 32px;
  4634. line-height: 32px;
  4635. min-width: 200px;
  4636. border: 1px solid rgb(184, 184, 184, var(--pops-bd-opacity));
  4637. border-radius: 5px;
  4638. text-align: center;
  4639. outline: 0;
  4640. background: rgb(255, 255, 255, var(--pops-bg-opacity));
  4641. box-shadow: none;
  4642. }
  4643. .pops-panel-select select:hover{box-shadow:0 0 0 1px #c0c4cc inset}
  4644. .pops-panel-select-disable .pops-panel-select select:hover{box-shadow:none}
  4645. .pops-panel-select select:focus{border:1px solid rgb(64, 158, 255, var(--pops-bd-opacity));box-shadow:none}
  4646. /* select的CSS */
  4647. `,
  4648. tooltipCSS: `
  4649. .pops-tip {
  4650. --tooltip-color: #4e4e4e;
  4651. --tooltip-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4652. --tooltip-bd-radius: 2px;
  4653. --tooltip-font-size: 14px;
  4654. --tooltip-padding-top: 13px;
  4655. --tooltip-padding-right: 13px;
  4656. --tooltip-padding-bottom: 13px;
  4657. --tooltip-padding-left: 13px;
  4658. --tooltip-arrow--after-color: rgb(78, 78, 78);
  4659. --tooltip-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
  4660. --tooltip-arrow--after-width: 12px;
  4661. --tooltip-arrow--after-height: 12px;
  4662. position: absolute;
  4663. padding: var(--tooltip-padding-top) var(--tooltip-padding-right) var(--tooltip-padding-bottom) var(--tooltip-padding-left);
  4664. max-width: 400px;
  4665. max-height: 300px;
  4666. border-radius: var(--tooltip-bd-radius);
  4667. background-color: var(--tooltip-bg-color);
  4668. box-shadow: 0 1.5px 4px rgba(0,0,0,.24),0 1.5px 6px rgba(0,0,0,.12);
  4669. color: var(--tooltip-color);
  4670. font-size: var(--tooltip-font-size);
  4671. }
  4672. /* github的样式 */
  4673. .pops-tip.github-tooltip{
  4674. --tooltip-bg-opacity: 1;
  4675. --tooltip-color: rgb(255, 255, 255);
  4676. --tooltip-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));
  4677. --tooltip-bd-radius: 6px;
  4678. --tooltip-padding-top: 6px;
  4679. --tooltip-padding-right: 8px;
  4680. --tooltip-padding-bottom: 6px;
  4681. --tooltip-padding-left: 8px;
  4682. --tooltip-arrow--after-color: rgb(255, 255, 255);
  4683. --tooltip-arrow--after-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));
  4684. --tooltip-arrow--after-width: 8px;
  4685. --tooltip-arrow--after-height: 8px;
  4686. }
  4687. .pops-tip .pops-tip-arrow {
  4688. position: absolute;
  4689. top: 100%;
  4690. left: 50%;
  4691. overflow: hidden;
  4692. width: 100%;
  4693. height: 12.5px;
  4694. transform: translateX(-50%);
  4695. }
  4696. .pops-tip .pops-tip-arrow::after {
  4697. position: absolute;
  4698. top: 0;
  4699. left: 50%;
  4700. width: var(--tooltip-arrow--after-width);
  4701. height: var(--tooltip-arrow--after-height);
  4702. background: var(--tooltip-arrow--after-bg-color);
  4703. color: var(--tooltip-arrow--after-color);
  4704. box-shadow: 0 1px 7px rgba(0,0,0,.24),0 1px 7px rgba(0,0,0,.12);
  4705. content: "";
  4706. transform: translateX(-50%) translateY(-50%) rotate(45deg);
  4707. }
  4708. .pops-tip .pops-tip-arrow[data-position=bottom] {
  4709. position: absolute;
  4710. top: 100%;
  4711. left: 50%;
  4712. overflow: hidden;
  4713. width: 100%;
  4714. height: 12.5px;
  4715. transform: translateX(-50%);
  4716. }
  4717. .pops-tip .pops-tip-arrow[data-position=bottom]:after {
  4718. position: absolute;
  4719. top: 0;
  4720. left: 50%;
  4721. width: var(--tooltip-arrow--after-width);
  4722. height: var(--tooltip-arrow--after-height);
  4723. background: var(--tooltip-arrow--after-bg-color);
  4724. box-shadow: 0 1px 7px rgba(0,0,0,.24),0 1px 7px rgba(0,0,0,.12);
  4725. content: "";
  4726. transform: translateX(-50%) translateY(-50%) rotate(45deg);
  4727. }
  4728. .pops-tip .pops-tip-arrow[data-position=left] {
  4729. top: 50%;
  4730. left: -12.5px;
  4731. width: 12.5px;
  4732. height: 50px;
  4733. transform: translateY(-50%);
  4734. }
  4735. .pops-tip .pops-tip-arrow[data-position=left]:after {
  4736. position: absolute;
  4737. top: 50%;
  4738. left: 100%;
  4739. content: "";
  4740. }
  4741. .pops-tip .pops-tip-arrow[data-position=right] {
  4742. top: 50%;
  4743. right: -12.5px;
  4744. left: auto;
  4745. width: 12.5px;
  4746. height: 50px;
  4747. transform: translateY(-50%);
  4748. }
  4749. .pops-tip .pops-tip-arrow[data-position=right]:after {
  4750. position: absolute;
  4751. top: 50%;
  4752. left: 0;
  4753. content: "";
  4754. }
  4755. .pops-tip .pops-tip-arrow[data-position=top] {
  4756. top: -12.5px;
  4757. left: 50%;
  4758. transform: translateX(-50%);
  4759. }
  4760. .pops-tip .pops-tip-arrow[data-position=top]:after {
  4761. position: absolute;
  4762. top: 100%;
  4763. left: 50%;
  4764. content: "";
  4765. }
  4766. .pops-tip[data-motion]{-webkit-animation-duration:.25s;animation-duration:.25s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;}
  4767. .pops-tip[data-motion=fadeOutRight]{-webkit-animation-name:pops-motion-fadeOutRight;animation-name:pops-motion-fadeOutRight;}
  4768. .pops-tip[data-motion=fadeInTop]{-webkit-animation-name:pops-motion-fadeInTop;animation-name:pops-motion-fadeInTop;animation-timing-function:cubic-bezier(.49,.49,.13,1.3);}
  4769. .pops-tip[data-motion=fadeOutTop]{-webkit-animation-name:pops-motion-fadeOutTop;animation-name:pops-motion-fadeOutTop;animation-timing-function:cubic-bezier(.32,.37,.06,.87);}
  4770. .pops-tip[data-motion=fadeInBottom]{-webkit-animation-name:pops-motion-fadeInBottom;animation-name:pops-motion-fadeInBottom;}
  4771. .pops-tip[data-motion=fadeOutBottom]{-webkit-animation-name:pops-motion-fadeOutBottom;animation-name:pops-motion-fadeOutBottom;}
  4772. .pops-tip[data-motion=fadeInLeft]{-webkit-animation-name:pops-motion-fadeInLeft;animation-name:pops-motion-fadeInLeft;}
  4773. .pops-tip[data-motion=fadeOutLeft]{-webkit-animation-name:pops-motion-fadeOutLeft;animation-name:pops-motion-fadeOutLeft;}
  4774. .pops-tip[data-motion=fadeInRight]{-webkit-animation-name:pops-motion-fadeInRight;animation-name:pops-motion-fadeInRight;}
  4775. `,
  4776. },
  4777. /** icon图标的svg代码 */
  4778. iconSVG: {
  4779. min: `
  4780. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4781. <path fill="currentColor" d="M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"></path>
  4782. </svg>`,
  4783. mise: `
  4784. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4785. <path
  4786. fill="currentColor"
  4787. d="M885.333333 85.333333H330.410667a53.333333 53.333333 0 0 0-53.333334 53.333334v106.666666H138.666667A53.333333 53.333333 0 0 0 85.333333 298.666667v586.666666a53.333333 53.333333 0 0 0 53.333334 53.333334H725.333333a53.333333 53.333333 0 0 0 53.333334-53.333334V746.154667h106.666666c29.44 0 53.333333-23.893333 53.333334-53.333334V138.666667A53.333333 53.333333 0 0 0 885.333333 85.333333zM725.333333 692.821333v192.512H138.666667V298.666667H725.333333v394.154666z m157.866667 0H778.666667V298.666667a53.333333 53.333333 0 0 0-53.333334-53.333334H330.410667v-106.666666h554.922666l-2.133333 554.154666z"></path>
  4788. </svg>`,
  4789. max: `
  4790. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4791. <path
  4792. fill="currentColor"
  4793. d="m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64v-.064z"></path>
  4794. </svg>`,
  4795. close: `
  4796. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4797. <path
  4798. fill="currentColor"
  4799. d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path>
  4800. </svg>`,
  4801. edit: `
  4802. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4803. <path
  4804. fill="currentColor"
  4805. d="M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"></path>
  4806. <path
  4807. fill="currentColor"
  4808. d="m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"></path>
  4809. </svg>`,
  4810. share: `
  4811. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4812. <path
  4813. fill="currentColor"
  4814. d="m679.872 348.8-301.76 188.608a127.808 127.808 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"></path>
  4815. </svg>`,
  4816. delete: `
  4817. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4818. <path
  4819. fill="currentColor"
  4820. d="M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"></path>
  4821. </svg>
  4822. `,
  4823. search: `
  4824. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4825. <path
  4826. fill="currentColor"
  4827. d="m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704z"></path>
  4828. </svg>`,
  4829. upload: `
  4830. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4831. <path
  4832. fill="currentColor"
  4833. d="M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64zm384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248L544 253.696z"></path>
  4834. </svg>`,
  4835. loading: `
  4836. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4837. <path
  4838. fill="currentColor"
  4839. d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"></path>
  4840. </svg>`,
  4841. next: `
  4842. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4843. <path
  4844. fill="currentColor"
  4845. d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>
  4846. </svg>`,
  4847. prev: `
  4848. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4849. <path
  4850. fill="currentColor"
  4851. d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>
  4852. </svg>`,
  4853. eleme: `
  4854. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4855. <path
  4856. fill="currentColor"
  4857. d="M300.032 188.8c174.72-113.28 408-63.36 522.24 109.44 5.76 10.56 11.52 20.16 17.28 30.72v.96a22.4 22.4 0 0 1-7.68 26.88l-352.32 228.48c-9.6 6.72-22.08 3.84-28.8-5.76l-18.24-27.84a54.336 54.336 0 0 1 16.32-74.88l225.6-146.88c9.6-6.72 12.48-19.2 5.76-28.8-.96-1.92-1.92-3.84-3.84-4.8a267.84 267.84 0 0 0-315.84-17.28c-123.84 81.6-159.36 247.68-78.72 371.52a268.096 268.096 0 0 0 370.56 78.72 54.336 54.336 0 0 1 74.88 16.32l17.28 26.88c5.76 9.6 3.84 21.12-4.8 27.84-8.64 7.68-18.24 14.4-28.8 21.12a377.92 377.92 0 0 1-522.24-110.4c-113.28-174.72-63.36-408 111.36-522.24zm526.08 305.28a22.336 22.336 0 0 1 28.8 5.76l23.04 35.52a63.232 63.232 0 0 1-18.24 87.36l-35.52 23.04c-9.6 6.72-22.08 3.84-28.8-5.76l-46.08-71.04c-6.72-9.6-3.84-22.08 5.76-28.8l71.04-46.08z"></path>
  4858. </svg>`,
  4859. elemePlus: `
  4860. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4861. <path
  4862. d="M839.7 734.7c0 33.3-17.9 41-17.9 41S519.7 949.8 499.2 960c-10.2 5.1-20.5 5.1-30.7 0 0 0-314.9-184.3-325.1-192-5.1-5.1-10.2-12.8-12.8-20.5V368.6c0-17.9 20.5-28.2 20.5-28.2L466 158.6c12.8-5.1 25.6-5.1 38.4 0 0 0 279 161.3 309.8 179.2 17.9 7.7 28.2 25.6 25.6 46.1-.1-5-.1 317.5-.1 350.8zM714.2 371.2c-64-35.8-217.6-125.4-217.6-125.4-7.7-5.1-20.5-5.1-30.7 0L217.6 389.1s-17.9 10.2-17.9 23v297c0 5.1 5.1 12.8 7.7 17.9 7.7 5.1 256 148.5 256 148.5 7.7 5.1 17.9 5.1 25.6 0 15.4-7.7 250.9-145.9 250.9-145.9s12.8-5.1 12.8-30.7v-74.2l-276.5 169v-64c0-17.9 7.7-30.7 20.5-46.1L745 535c5.1-7.7 10.2-20.5 10.2-30.7v-66.6l-279 169v-69.1c0-15.4 5.1-30.7 17.9-38.4l220.1-128zM919 135.7c0-5.1-5.1-7.7-7.7-7.7h-58.9V66.6c0-5.1-5.1-5.1-10.2-5.1l-30.7 5.1c-5.1 0-5.1 2.6-5.1 5.1V128h-56.3c-5.1 0-5.1 5.1-7.7 5.1v38.4h69.1v64c0 5.1 5.1 5.1 10.2 5.1l30.7-5.1c5.1 0 5.1-2.6 5.1-5.1v-56.3h64l-2.5-38.4z"
  4863. fill="currentColor"></path>
  4864. </svg>`,
  4865. chromeFilled: `
  4866. <svg
  4867. xmlns="http://www.w3.org/2000/svg"
  4868. viewBox="0 0 1024 1024"
  4869. xml:space="preserve">
  4870. <path
  4871. d="M938.67 512.01c0-44.59-6.82-87.6-19.54-128H682.67a212.372 212.372 0 0 1 42.67 128c.06 38.71-10.45 76.7-30.42 109.87l-182.91 316.8c235.65-.01 426.66-191.02 426.66-426.67z"
  4872. fill="currentColor"></path>
  4873. <path
  4874. d="M576.79 401.63a127.92 127.92 0 0 0-63.56-17.6c-22.36-.22-44.39 5.43-63.89 16.38s-35.79 26.82-47.25 46.02a128.005 128.005 0 0 0-2.16 127.44l1.24 2.13a127.906 127.906 0 0 0 46.36 46.61 127.907 127.907 0 0 0 63.38 17.44c22.29.2 44.24-5.43 63.68-16.33a127.94 127.94 0 0 0 47.16-45.79v-.01l1.11-1.92a127.984 127.984 0 0 0 .29-127.46 127.957 127.957 0 0 0-46.36-46.91z"
  4875. fill="currentColor"></path>
  4876. <path
  4877. d="M394.45 333.96A213.336 213.336 0 0 1 512 298.67h369.58A426.503 426.503 0 0 0 512 85.34a425.598 425.598 0 0 0-171.74 35.98 425.644 425.644 0 0 0-142.62 102.22l118.14 204.63a213.397 213.397 0 0 1 78.67-94.21zM512.01 938.68H512zM414.76 701.95a213.284 213.284 0 0 1-89.54-86.81L142.48 298.6c-36.35 62.81-57.13 135.68-57.13 213.42 0 203.81 142.93 374.22 333.95 416.55h.04l118.19-204.71a213.315 213.315 0 0 1-122.77-21.91z"
  4878. fill="currentColor"></path>
  4879. </svg>`,
  4880. cpu: `
  4881. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4882. <path
  4883. fill="currentColor"
  4884. d="M320 256a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h384a64 64 0 0 0 64-64V320a64 64 0 0 0-64-64H320zm0-64h384a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128H320a128 128 0 0 1-128-128V320a128 128 0 0 1 128-128z"></path>
  4885. <path
  4886. fill="currentColor"
  4887. d="M512 64a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm160 0a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm-320 0a32 32 0 0 1 32 32v128h-64V96a32 32 0 0 1 32-32zm160 896a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zm160 0a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zm-320 0a32 32 0 0 1-32-32V800h64v128a32 32 0 0 1-32 32zM64 512a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm0-160a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm0 320a32 32 0 0 1 32-32h128v64H96a32 32 0 0 1-32-32zm896-160a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32zm0-160a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32zm0 320a32 32 0 0 1-32 32H800v-64h128a32 32 0 0 1 32 32z"></path>
  4888. </svg>`,
  4889. videoPlay: `
  4890. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4891. <path
  4892. fill="currentColor"
  4893. d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768zm-48-247.616L668.608 512 464 375.616v272.768zm10.624-342.656 249.472 166.336a48 48 0 0 1 0 79.872L474.624 718.272A48 48 0 0 1 400 678.336V345.6a48 48 0 0 1 74.624-39.936z"></path>
  4894. </svg>`,
  4895. videoPause: `
  4896. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4897. <path
  4898. fill="currentColor"
  4899. d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768zm-96-544q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32zm192 0q32 0 32 32v256q0 32-32 32t-32-32V384q0-32 32-32z"></path>
  4900. </svg>`,
  4901. headset: `
  4902. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4903. <path
  4904. fill="currentColor"
  4905. d="M896 529.152V512a384 384 0 1 0-768 0v17.152A128 128 0 0 1 320 640v128a128 128 0 1 1-256 0V512a448 448 0 1 1 896 0v256a128 128 0 1 1-256 0V640a128 128 0 0 1 192-110.848zM896 640a64 64 0 0 0-128 0v128a64 64 0 0 0 128 0V640zm-768 0v128a64 64 0 0 0 128 0V640a64 64 0 1 0-128 0z"></path>
  4906. </svg>`,
  4907. monitor: `
  4908. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4909. <path
  4910. fill="currentColor"
  4911. d="M544 768v128h192a32 32 0 1 1 0 64H288a32 32 0 1 1 0-64h192V768H192A128 128 0 0 1 64 640V256a128 128 0 0 1 128-128h640a128 128 0 0 1 128 128v384a128 128 0 0 1-128 128H544zM192 192a64 64 0 0 0-64 64v384a64 64 0 0 0 64 64h640a64 64 0 0 0 64-64V256a64 64 0 0 0-64-64H192z"></path>
  4912. </svg>`,
  4913. documentCopy: `
  4914. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4915. <path
  4916. fill="currentColor"
  4917. d="M128 320v576h576V320H128zm-32-64h640a32 32 0 0 1 32 32v640a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V288a32 32 0 0 1 32-32zM960 96v704a32 32 0 0 1-32 32h-96v-64h64V128H384v64h-64V96a32 32 0 0 1 32-32h576a32 32 0 0 1 32 32zM256 672h320v64H256v-64zm0-192h320v64H256v-64z"></path>
  4918. </svg>`,
  4919. picture: `
  4920. <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  4921. <path
  4922. fill="currentColor"
  4923. d="M160 160v704h704V160H160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32z"></path>
  4924. <path
  4925. fill="currentColor"
  4926. d="M384 288q64 0 64 64t-64 64q-64 0-64-64t64-64zM185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952L185.408 876.992z"></path>
  4927. </svg>`,
  4928. circleClose: `
  4929. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
  4930. <path
  4931. fill="currentColor"
  4932. d="m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"></path>
  4933. <path
  4934. fill="currentColor"
  4935. d="M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"></path>
  4936. </svg>`,
  4937. view: `
  4938. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
  4939. <path
  4940. fill="currentColor"
  4941. d="M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"></path>
  4942. </svg>`,
  4943. hide: `
  4944. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">
  4945. <path
  4946. fill="currentColor"
  4947. d="M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"></path>
  4948. <path
  4949. fill="currentColor"
  4950. d="M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"></path>
  4951. </svg>`,
  4952. keyboard: `
  4953. <svg viewBox="0 0 1123 1024" xmlns="http://www.w3.org/2000/svg">
  4954. <path
  4955. d="M1014.122186 1024H109.753483A109.753483 109.753483 0 0 1 0 914.246517V392.917471a109.753483 109.753483 0 0 1 109.753483-109.753484h904.368703a109.753483 109.753483 0 0 1 109.753484 109.753484v521.329046a109.753483 109.753483 0 0 1-109.753484 109.753483zM109.753483 370.966774a21.950697 21.950697 0 0 0-21.950696 21.950697v521.329046a21.950697 21.950697 0 0 0 21.950696 21.950696h904.368703a21.950697 21.950697 0 0 0 21.950697-21.950696V392.917471a21.950697 21.950697 0 0 0-21.950697-21.950697z"></path>
  4956. <path
  4957. d="M687.056806 891.198285H307.309753a43.901393 43.901393 0 0 1 0-87.802787h379.747053a43.901393 43.901393 0 0 1 0 87.802787zM175.605573 803.395498a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM432.428725 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM690.349411 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM947.172562 414.868167a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM175.605573 546.572347a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM304.017149 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM432.428725 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM690.349411 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 546.572347a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM818.760986 803.395498a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM175.605573 678.276527a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394zM304.017149 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM432.428725 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM561.937835 678.276527a43.901393 43.901393 0 1 0 43.901393 43.901394 43.901393 43.901393 0 0 0-43.901393-43.901394zM948.270096 803.395498a43.901393 43.901393 0 1 0 43.901394 43.901394 43.901393 43.901393 0 0 0-43.901394-43.901394z"></path>
  4958. <path
  4959. d="M881.320472 766.079314H689.251876a43.901393 43.901393 0 0 1 0-87.802787h192.068596a21.950697 21.950697 0 0 0 21.950696-21.950696v-65.85209a43.901393 43.901393 0 0 1 87.802787 0v65.85209a109.753483 109.753483 0 0 1-109.753483 109.753483zM305.114684 502.670954H175.605573a43.901393 43.901393 0 0 1 0-87.802787h129.509111a43.901393 43.901393 0 0 1 0 87.802787zM563.03537 365.4791a43.901393 43.901393 0 0 1-43.901394-43.901394v-105.363344A109.753483 109.753483 0 0 1 628.88746 106.460879h61.461951a21.950697 21.950697 0 0 0 21.950696-21.950697V43.901393a43.901393 43.901393 0 0 1 87.802787 0v40.608789a109.753483 109.753483 0 0 1-109.753483 109.753484h-61.461951a21.950697 21.950697 0 0 0-21.950697 21.950696v105.363344a43.901393 43.901393 0 0 1-43.901393 43.901394z"></path>
  4960. </svg>`,
  4961. },
  4962. /**
  4963. * 动画名
  4964. * @type {string[]}
  4965. */
  4966. animation: [],
  4967. /**
  4968. * 是否已初始化
  4969. */
  4970. isInit: false,
  4971. /**
  4972. * 存储已创建的元素
  4973. */
  4974. layer: {
  4975. /**
  4976. * 存储已创建的pops.alert
  4977. * @type { PopsLayerCommonConfig[] }
  4978. */
  4979. alert: [],
  4980. /**
  4981. * 存储已创建的pops.confirm
  4982. * @type { PopsLayerCommonConfig[] }
  4983. */
  4984. confirm: [],
  4985. /**
  4986. * 存储已创建的pops.prompt
  4987. * @type { PopsLayerCommonConfig[] }
  4988. */
  4989. prompt: [],
  4990. /**
  4991. * 存储已创建的pops.loading
  4992. * @type { PopsLayerCommonConfig[] }
  4993. */
  4994. loading: [],
  4995. /**
  4996. * 存储已创建的pops.iframe
  4997. * @type { PopsLayerConfig[] }
  4998. */
  4999. iframe: [],
  5000. /**
  5001. * 存储已创建的pops.tooltip
  5002. * @type { PopsLayerCommonConfig[] }
  5003. */
  5004. tooltip: [],
  5005. /**
  5006. * 存储已创建的pops.drawer
  5007. * @type { PopsLayerCommonConfig[] }
  5008. */
  5009. drawer: [],
  5010. /**
  5011. * 存储已创建的pops.folder
  5012. * @type { PopsLayerCommonConfig[] }
  5013. */
  5014. folder: [],
  5015. /**
  5016. * 存储已创建的pops.panel
  5017. * @type { PopsLayerCommonConfig[] }
  5018. */
  5019. panel: [],
  5020. },
  5021. forbiddenScroll: {
  5022. // @ts-ignore
  5023. event(event) {
  5024. event.preventDefault();
  5025. return false;
  5026. },
  5027. },
  5028. Utils: PopsUtils,
  5029. DOMUtils: PopsDOMUtils,
  5030. };
  5031.  
  5032. /**
  5033. * 释放原有的pops控制权
  5034. * @example
  5035. * let pops = window.pops.noConflict()
  5036. */
  5037. pops.noConflict = function () {
  5038. // @ts-ignore
  5039. if (window.pops) {
  5040. // @ts-ignore
  5041. delete window.pops;
  5042. }
  5043. if (AnotherPops) {
  5044. // @ts-ignore
  5045. window.pops = AnotherPops;
  5046. }
  5047. return pops;
  5048. };
  5049.  
  5050. /**
  5051. * 初始化CSS、动画
  5052. */
  5053. pops.init = function () {
  5054. if (!this.config.isInit) {
  5055. /* 处理获取当前所有的动画名 */
  5056. this.config.isInit = true;
  5057. let animationStyle = document.createElement("style");
  5058. animationStyle.innerHTML = this.config.cssText.anim;
  5059. (document.head || document.body || document.documentElement).appendChild(
  5060. animationStyle
  5061. );
  5062. // @ts-ignore
  5063. this.config.animation = PopsUtils.getKeyFrames(animationStyle.sheet);
  5064. setTimeout(() => {
  5065. animationStyle.remove();
  5066. }, 50);
  5067. }
  5068. };
  5069.  
  5070. /**
  5071. * 通过navigator.userAgent判断是否是手机访问
  5072. * @param {string} userAgent
  5073. * @returns {boolean}
  5074. */
  5075. pops.isPhone = function (userAgent = navigator.userAgent) {
  5076. return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
  5077. };
  5078.  
  5079. const PopsHandler = {
  5080. /**
  5081. * 创建shadow
  5082. */
  5083. handlerShadow() {
  5084. let $shadowContainer = document.createElement("div");
  5085. $shadowContainer.className = "pops-shadow-container";
  5086. let $shadowRoot = $shadowContainer.attachShadow({ mode: "open" });
  5087. return {
  5088. $shadowContainer,
  5089. $shadowRoot,
  5090. };
  5091. },
  5092. /**
  5093. * 处理初始化
  5094. * @param {ShadowRoot} $shadowRoot
  5095. * @param {string[]|string} cssText
  5096. */
  5097. handleInit($shadowRoot, cssText) {
  5098. pops.init();
  5099. if (!arguments.length) {
  5100. return;
  5101. }
  5102. if (Array.isArray(cssText)) {
  5103. cssText.forEach((text) => {
  5104. this.handleInit($shadowRoot, text);
  5105. });
  5106. } else {
  5107. let cssStyle = document.createElement("style");
  5108. cssStyle.setAttribute("type", "text/css");
  5109. cssStyle.innerHTML = cssText;
  5110. $shadowRoot.appendChild(cssStyle);
  5111. }
  5112. },
  5113. /**
  5114. * 处理遮罩层
  5115. * @param {?{
  5116. * type: "alert"|"confirm"|"prompt"|"loading"|"iframe"|"drawer"|"folder"|"panel",
  5117. * guid: string,
  5118. * config: PopsAlertDetails,
  5119. * animElement: HTMLElement,
  5120. * maskHTML: string,
  5121. * }} details
  5122. * @returns { {
  5123. * maskElement: HTMLDivElement
  5124. * } }
  5125. */
  5126. // @ts-ignore
  5127. handleMask(details = {}) {
  5128. let result = {
  5129. // @ts-ignore
  5130. maskElement: PopsUtils.parseTextToDOM(details.maskHTML),
  5131. };
  5132. let isMaskClick = false;
  5133. /**
  5134. * 点击其它区域的事件
  5135. * @param {Event} event
  5136. * @returns
  5137. */
  5138. function clickEvent(event) {
  5139. event?.preventDefault();
  5140. event?.stopPropagation();
  5141. event?.stopImmediatePropagation();
  5142. // @ts-ignore
  5143. let targetLayer = pops.config.layer[details.type];
  5144. function originalRun() {
  5145. // @ts-ignore
  5146. if (details.config.mask.clickEvent.toClose) {
  5147. /* 关闭 */
  5148. PopsUtils.close(
  5149. // @ts-ignore
  5150. details.type,
  5151. targetLayer,
  5152. // @ts-ignore
  5153. details.guid,
  5154. // @ts-ignore
  5155. details.config,
  5156. // @ts-ignore
  5157. details.animElement
  5158. );
  5159. // @ts-ignore
  5160. } else if (details.config.mask.clickEvent.toHide) {
  5161. /* 隐藏 */
  5162. PopsUtils.hide(
  5163. // @ts-ignore
  5164. details.type,
  5165. targetLayer,
  5166. // @ts-ignore
  5167. details.guid,
  5168. // @ts-ignore
  5169. details.config,
  5170. // @ts-ignore
  5171. details.animElement,
  5172. result.maskElement
  5173. );
  5174. }
  5175. }
  5176. // @ts-ignore
  5177. if (details.config.mask.clickCallBack) {
  5178. // @ts-ignore
  5179. details.config.mask.clickCallBack(originalRun);
  5180. } else {
  5181. originalRun();
  5182. }
  5183. return false;
  5184. }
  5185. // @ts-ignore
  5186. function isAnimElement(element) {
  5187. return Boolean(
  5188. element?.localName?.toLowerCase() === "div" &&
  5189. element.className &&
  5190. element.className === "pops-anim" &&
  5191. element.hasAttribute("anim")
  5192. );
  5193. }
  5194. if (
  5195. // @ts-ignore
  5196. details.config.mask.clickEvent.toClose ||
  5197. // @ts-ignore
  5198. details.config.mask.clickEvent.toHide
  5199. ) {
  5200. /* 判断按下的元素是否是pops-anim */
  5201. // @ts-ignore
  5202. PopsDOMUtils.on(
  5203. // @ts-ignore
  5204. details.animElement,
  5205. ["touchstart", "mousedown"],
  5206. void 0,
  5207. function (event) {
  5208. isMaskClick = isAnimElement(event.composedPath()[0]);
  5209. }
  5210. );
  5211. /* 如果有动画层,在动画层上监听点击事件 */
  5212. // @ts-ignore
  5213. PopsDOMUtils.on(details.animElement, "click", void 0, function (event) {
  5214. if (isAnimElement(event.composedPath()[0]) && isMaskClick) {
  5215. return clickEvent(event);
  5216. }
  5217. });
  5218. /* 在遮罩层监听点击事件 */
  5219. /* 如果有动画层,那么该点击事件触发不了 */
  5220. // @ts-ignore
  5221. PopsDOMUtils.on(result.maskElement, "click", void 0, (event) => {
  5222. isMaskClick = true;
  5223. clickEvent(event);
  5224. });
  5225. }
  5226. // @ts-ignore
  5227. return result;
  5228. },
  5229. /**
  5230. * 处理获取元素
  5231. * @param {HTMLDivElement} animElement
  5232. * @param {"alert"|"confirm"|"prompt"|"loading"|"iframe"|"drawer"|"folder"|"panel"} type
  5233. */
  5234. handleQueryElement(animElement, type) {
  5235. return {
  5236. /**
  5237. * 主元素
  5238. * @type {?HTMLElement}
  5239. */
  5240. popsElement: animElement.querySelector(".pops[type-value"),
  5241. /**
  5242. * 确认按钮
  5243. * @type {?HTMLElement}
  5244. */
  5245. btnOkElement: animElement.querySelector(`.pops-${type}-btn-ok`),
  5246. /**
  5247. * 取消按钮
  5248. * @type {?HTMLElement}
  5249. */
  5250. btnCancelElement: animElement.querySelector(`.pops-${type}-btn-cancel`),
  5251. /**
  5252. * 其它按钮
  5253. * @type {?HTMLElement}
  5254. */
  5255. btnOtherElement: animElement.querySelector(`.pops-${type}-btn-other`),
  5256. /**
  5257. * 标题元素
  5258. * @type {?HTMLElement}
  5259. */
  5260. titleElement: animElement.querySelector(`.pops-${type}-title`),
  5261. /**
  5262. * 输入框元素
  5263. * @type {?HTMLTextAreaElement|HTMLInputElement}
  5264. */
  5265. inputElement: animElement.querySelector(
  5266. `.pops-${type}-content textarea[pops]`
  5267. )
  5268. ? animElement.querySelector(`.pops-${type}-content textarea[pops]`)
  5269. : animElement.querySelector(`.pops-${type}-content input[pops]`),
  5270. /**
  5271. * 顶部按钮控制层元素
  5272. * @type {?HTMLElement}
  5273. */
  5274. headerControlsElement: animElement.querySelector(
  5275. ".pops-header-controls"
  5276. ),
  5277. /**
  5278. * iframe元素
  5279. * @type {?HTMLIFrameElement}
  5280. */
  5281. iframeElement: animElement.querySelector("iframe[pops]"),
  5282. /**
  5283. * 加载中元素
  5284. * @type {?HTMLElement}
  5285. */
  5286. loadingElement: animElement.querySelector(".pops-loading"),
  5287. /**
  5288. * 内容元素
  5289. * @type {?HTMLElement}
  5290. */
  5291. contentElement: animElement.querySelector(`.pops-${type}-content`),
  5292. /**
  5293. * 内容侧边栏容器元素
  5294. * @type {?HTMLElement}
  5295. */
  5296. contentAsideElement: animElement.querySelector(
  5297. `.pops-${type}-content aside.pops-${type}-aside`
  5298. ),
  5299. /**
  5300. * 内容主要区域容器元素
  5301. * @type {?HTMLElement}
  5302. */
  5303. contentSectionContainerElement: animElement.querySelector(
  5304. `.pops-${type}-content section.pops-${type}-container`
  5305. ),
  5306. /**
  5307. * 内容加载中元素
  5308. * @type {?HTMLElement}
  5309. */
  5310. contentLoadingElement: animElement.querySelector(
  5311. `.pops-${type}-content-global-loading`
  5312. ),
  5313. /**
  5314. * 顶部缩小按钮
  5315. * @type {?HTMLElement}
  5316. */
  5317. headerMinBtnElement: animElement.querySelector(
  5318. ".pops-header-control[type='min']"
  5319. ),
  5320. /**
  5321. * 顶部放大按钮
  5322. * @type {?HTMLElement}
  5323. */
  5324. headerMaxBtnElement: animElement.querySelector(
  5325. ".pops-header-control[type='max']"
  5326. ),
  5327. /**
  5328. * 顶部恢复原样按钮
  5329. * @type {?HTMLElement}
  5330. */
  5331. headerMiseBtnElement: animElement.querySelector(
  5332. ".pops-header-control[type='mise']"
  5333. ),
  5334. /**
  5335. * 顶部关闭按钮
  5336. * @type {?HTMLElement}
  5337. */
  5338. headerCloseBtnElement: animElement.querySelector(
  5339. ".pops-header-control[type='close']"
  5340. ),
  5341. /**
  5342. * 文件夹列表元素
  5343. * @type {?HTMLElement}
  5344. */
  5345. folderListElement: animElement.querySelector(".pops-folder-list"),
  5346. /**
  5347. * 文件夹列表顶部元素
  5348. * @type {?HTMLElement}
  5349. */
  5350. folderListHeaderElement: animElement.querySelector(
  5351. ".pops-folder-list .pops-folder-list-table__header-div"
  5352. ),
  5353. /**
  5354. * 文件夹列表行元素
  5355. * @type {?HTMLTableRowElement}
  5356. */
  5357. folderListHeaderRowElement: animElement.querySelector(
  5358. ".pops-folder-list .pops-folder-list-table__header-div .pops-folder-list-table__header-row"
  5359. ),
  5360. /**
  5361. * 文件夹列表tbody元素
  5362. * @type {?HTMLTableElement}
  5363. */
  5364. folderListBodyElement: animElement.querySelector(
  5365. ".pops-folder-list .pops-folder-list-table__body-div tbody"
  5366. ),
  5367. /**
  5368. * 文件夹列表primary元素
  5369. * @type {?HTMLElement}
  5370. */
  5371. folderFileListBreadcrumbPrimaryElement: animElement.querySelector(
  5372. ".pops-folder-list .pops-folder-file-list-breadcrumb-primary"
  5373. ),
  5374. /**
  5375. * 文件夹排序按钮-文件名
  5376. */
  5377. folderListSortFileNameElement: animElement.querySelector(
  5378. '.pops-folder-list-table__sort[data-sort="fileName"]'
  5379. ),
  5380. /**
  5381. * 文件夹排序按钮-修改时间
  5382. */
  5383. folderListSortLatestTimeElement: animElement.querySelector(
  5384. '.pops-folder-list-table__sort[data-sort="latestTime"]'
  5385. ),
  5386. /**
  5387. * 文件夹排序按钮-文件大小
  5388. */
  5389. folderListSortFileSizeElement: animElement.querySelector(
  5390. '.pops-folder-list-table__sort[data-sort="fileSize"]'
  5391. ),
  5392. };
  5393. },
  5394. /**
  5395. * 获取事件配置
  5396. * @param {string} guid
  5397. * @param {HTMLDivElement} $shadowContainer
  5398. * @param {ShadowRoot} $shadowRoot
  5399. * @param {"alert"|"confirm"|"prompt"|"loading"|"iframe"|"drawer"|"folder"|"panel"} mode 当前弹窗类型
  5400. * @param {HTMLDivElement} animElement 动画层
  5401. * @param {HTMLDivElement} popsElement 主元素
  5402. * @param {HTMLDivElement} maskElement 遮罩层
  5403. * @param {object} config 当前配置
  5404. */
  5405. handleEventDetails(
  5406. guid,
  5407. $shadowContainer,
  5408. $shadowRoot,
  5409. mode,
  5410. animElement,
  5411. popsElement,
  5412. maskElement,
  5413. config
  5414. ) {
  5415. return {
  5416. $shadowContainer: $shadowContainer,
  5417. $shadowRoot: $shadowRoot,
  5418. element: animElement,
  5419. animElement: animElement,
  5420. popsElement: popsElement,
  5421. maskElement: maskElement,
  5422. type: "",
  5423. mode: mode,
  5424. guid: guid,
  5425. close() {
  5426. PopsUtils.close(
  5427. mode,
  5428. pops.config.layer[mode],
  5429. guid,
  5430. // @ts-ignore
  5431. config,
  5432. animElement
  5433. );
  5434. },
  5435. hide() {
  5436. PopsUtils.hide(
  5437. // @ts-ignore
  5438. mode,
  5439. pops.config.layer[mode],
  5440. guid,
  5441. config,
  5442. animElement,
  5443. maskElement
  5444. );
  5445. },
  5446. show() {
  5447. PopsUtils.show(
  5448. // @ts-ignore
  5449. mode,
  5450. pops.config.layer[mode],
  5451. guid,
  5452. config,
  5453. animElement,
  5454. maskElement
  5455. );
  5456. },
  5457. };
  5458. },
  5459. /**
  5460. * 处理返回的配置,针对popsHandler.handleEventDetails
  5461. * @returns { {
  5462. * $shadowContainer: HTMLDivElement,
  5463. * $shadowRoot: ShadowRoot,
  5464. * animElement: HTMLElement,
  5465. * popsElement: HTMLElement,
  5466. * maskElement: HTMLElement,
  5467. * close: ()=> void,
  5468. * hide: ()=> void,
  5469. * show: ()=> void,
  5470. * } }
  5471. */
  5472. // @ts-ignore
  5473. handleResultDetails(details) {
  5474. let _details_ = Object.assign({}, details);
  5475. delete _details_["type"];
  5476. delete _details_["function"];
  5477. delete _details_["type"];
  5478. return _details_;
  5479. },
  5480. /**
  5481. * 处理点击事件
  5482. * @param {HTMLElement} btnElement 按钮元素
  5483. * @param {"ok"|"close"|"cancel"|"other"} type 触发事件类型
  5484. * @param {object} event 事件配置,由popsHandler.handleEventDetails创建的
  5485. * @param {(event:(PointerEvent|MouseEvent) & {
  5486. * type: "cancel" | "close" | "ok" | "other",
  5487. * })=>{}} callback 点击回调
  5488. */
  5489. handleClickEvent(btnElement, type, event, callback) {
  5490. PopsDOMUtils.on(
  5491. btnElement,
  5492. "click",
  5493. void 0,
  5494. function () {
  5495. let _event_ = {
  5496. type: type,
  5497. };
  5498. _event_ = Object.assign(event, _event_);
  5499. // @ts-ignore
  5500. callback(_event_);
  5501. },
  5502. {
  5503. capture: true,
  5504. }
  5505. );
  5506. },
  5507. /**
  5508. * 全局监听键盘事件
  5509. * @param {string|number} keyName 键名|键值
  5510. * @param {?string[]} otherKeyList 组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
  5511. * @param {(event:Event)=> void} callback 回调函数
  5512. */
  5513. handleKeyboardEvent(keyName, otherKeyList = [], callback) {
  5514. // @ts-ignore
  5515. let keyboardEvent = function (event) {
  5516. let _keyName = event.code || event.key;
  5517. let _keyValue = event.charCode || event.keyCode || event.which;
  5518. // @ts-ignore
  5519. if (otherKeyList.includes("ctrl") && !event.ctrlKey) {
  5520. return;
  5521. }
  5522. // @ts-ignore
  5523. if (otherKeyList.includes("alt") && !event.altKey) {
  5524. return;
  5525. }
  5526. // @ts-ignore
  5527. if (otherKeyList.includes("meta") && !event.metaKey) {
  5528. return;
  5529. }
  5530. // @ts-ignore
  5531. if (otherKeyList.includes("shift") && !event.shiftKey) {
  5532. return;
  5533. }
  5534. if (typeof keyName === "string" && keyName === _keyName) {
  5535. callback && callback(event);
  5536. } else if (typeof keyName === "number" && keyName === _keyValue) {
  5537. callback && callback(event);
  5538. }
  5539. };
  5540. // @ts-ignore
  5541. PopsDOMUtils.on(globalThis, "keydown", void 0, keyboardEvent, {
  5542. capture: true,
  5543. });
  5544. return {
  5545. removeKeyboardEvent() {
  5546. // @ts-ignore
  5547. PopsDOMUtils.off(globalThis, "keydown", void 0, keyboardEvent, {
  5548. capture: true,
  5549. });
  5550. },
  5551. };
  5552. },
  5553. /**
  5554. * 处理prompt的点击事件
  5555. * @param {HTMLInputElement} inputElement 输入框
  5556. * @param {HTMLElement} btnElement 按钮元素
  5557. * @param {"ok"|"close"} type 触发事件类型
  5558. * @param {object} event 事件配置,由popsHandler.handleEventDetails创建的
  5559. * @param {(event: (MouseEvent |PointerEvent) & {
  5560. * type: any,
  5561. * text: string,
  5562. * })=>void} callback 点击回调
  5563. */
  5564. handlePromptClickEvent(inputElement, btnElement, type, event, callback) {
  5565. PopsDOMUtils.on(
  5566. btnElement,
  5567. "click",
  5568. void 0,
  5569. function () {
  5570. let _event_ = {
  5571. type: type,
  5572. text: inputElement.value,
  5573. };
  5574. _event_ = Object.assign(event, _event_);
  5575. // @ts-ignore
  5576. callback(_event_);
  5577. },
  5578. {
  5579. capture: true,
  5580. }
  5581. );
  5582. },
  5583. /**
  5584. * 处理config.only
  5585. * @param {"alert"|"confirm"|"prompt"|"loading"|"tooltip"|"iframe"|"drawer"|"folder"|"rightClickMenu"} type 当前弹窗类型
  5586. * @param {object} config 配置
  5587. * @returns {object}
  5588. */
  5589. handleOnly(type, config) {
  5590. // @ts-ignore
  5591. if (config.only) {
  5592. if (
  5593. type === "loading" ||
  5594. type === "tooltip" ||
  5595. type === "rightClickMenu"
  5596. ) {
  5597. // @ts-ignore
  5598. PopsUtils.configRemove([pops.config.layer[type]], "", true);
  5599. } else {
  5600. PopsUtils.configRemove(
  5601. [
  5602. pops.config.layer.alert,
  5603. pops.config.layer.confirm,
  5604. pops.config.layer.prompt,
  5605. pops.config.layer.iframe,
  5606. pops.config.layer.drawer,
  5607. pops.config.layer.folder,
  5608. pops.config.layer.panel,
  5609. ],
  5610. "",
  5611. true
  5612. );
  5613. }
  5614. } else {
  5615. // @ts-ignore
  5616. config.zIndex = PopsUtils.getPopsMaxZIndex(config.zIndex)["zIndex"] * 2;
  5617. }
  5618. return config;
  5619. },
  5620. /**
  5621. * 处理把已创建的元素保存到内部环境中
  5622. * @param {"alert"|"confirm"|"prompt"|"loading"|"tooltip"|"iframe"|"drawer"|"folder"|"panel"} type 当前弹窗类型
  5623. * @param {PopsLayerCommonConfig} value
  5624. */
  5625. handlePush(type, value) {
  5626. pops.config.layer[type].push(value);
  5627. },
  5628. };
  5629.  
  5630. const PopsElementHandler = {
  5631. /**
  5632. * 获取遮罩层HTML
  5633. * @param {string} guid
  5634. * @param {number} zIndex z-index
  5635. * @param {string} [style=""] style
  5636. * @returns {string}
  5637. */
  5638. getMaskHTML(guid, zIndex, style = "") {
  5639. zIndex = zIndex - 100;
  5640. return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
  5641. },
  5642. /**
  5643. * 获取动画层HTML
  5644. * @param {string} guid
  5645. * @param {"alert"|"confirm"|"iframe"|"loading"|"prompt"|"drawer"|"folder"|"panel"} type
  5646. * @param {object} config
  5647. * @param {string} html
  5648. * @param {string} bottomBtnHTML
  5649. */
  5650. getAnimHTML(guid, type, config, html = "", bottomBtnHTML = "") {
  5651. let popsAnimStyle = "";
  5652. let popsStyle = "";
  5653. // @ts-ignore
  5654. let popsPosition = config.position || "";
  5655. // @ts-ignore
  5656. if (config.zIndex != null) {
  5657. // @ts-ignore
  5658. popsAnimStyle += `z-index: ${config.zIndex};`;
  5659. // @ts-ignore
  5660. popsStyle += `z-index: ${config.zIndex};`;
  5661. }
  5662. // @ts-ignore
  5663. if (config.width != null) {
  5664. // @ts-ignore
  5665. popsStyle += `width: ${config.width};`;
  5666. }
  5667. // @ts-ignore
  5668. if (config.height != null) {
  5669. // @ts-ignore
  5670. popsStyle += `height: ${config.height};`;
  5671. }
  5672. /* 是否存在底部按钮 */
  5673. let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
  5674. return `<div
  5675. class="pops-anim"
  5676. anim="${
  5677. // @ts-ignore
  5678. config.animation || ""
  5679. }"
  5680. style="${popsAnimStyle};"
  5681. data-guid="${guid}">
  5682. ${
  5683. // @ts-ignore
  5684. config.style != null
  5685. ? // @ts-ignore
  5686. `<style tyle="text/css">${config.style}</style>`
  5687. : ""
  5688. }
  5689. <div
  5690. class="pops ${
  5691. // @ts-ignore
  5692. config.class || ""
  5693. }"
  5694. data-bottom-btn="${hasBottomBtn}"
  5695. type-value="${type}"
  5696. style="${popsStyle}"
  5697. position="${popsPosition}"
  5698. data-guid="${guid}">
  5699. ${html}
  5700. </div>
  5701. </div>`;
  5702. },
  5703. /**
  5704. * 获取顶部按钮层HTML
  5705. * @param {"alert"|"confirm"|"iframe"|"prompt"|"drawer"|"folder"|"panel"} type
  5706. * @param {PopsIframeDetails} config
  5707. * @returns {string}
  5708. */
  5709. getHeaderBtnHTML(type, config) {
  5710. if (!config.btn) {
  5711. return "";
  5712. }
  5713. // @ts-ignore
  5714. if (type !== "iframe" && !config.btn?.close?.enable) {
  5715. return "";
  5716. }
  5717. let resultHTML = "";
  5718. // @ts-ignore
  5719. // @ts-ignore
  5720. let btnStyle = "";
  5721. let closeHTML = "";
  5722. if (type === "iframe" && config.topRightButton?.trim() !== "") {
  5723. /* iframe的 */
  5724. let topRightButtonHTML = "";
  5725. config.topRightButton.split("|").forEach((item) => {
  5726. item = item.toLowerCase();
  5727. topRightButtonHTML += `
  5728. <button class="pops-header-control" type="${item}">
  5729. <i class="pops-icon">${
  5730. // @ts-ignore
  5731. pops.config.iconSVG[item]
  5732. }</i>
  5733. </button>`;
  5734. });
  5735. resultHTML = `
  5736. <div class="pops-header-controls" data-margin>
  5737. ${topRightButtonHTML}
  5738. </div>`;
  5739. } else {
  5740. // @ts-ignore
  5741. if (config.btn?.close?.enable) {
  5742. closeHTML = `
  5743. <div class="pops-header-controls">
  5744. <button class="pops-header-control" type="close" data-header>
  5745. <i class="pops-icon">${pops.config.iconSVG["close"]}</i>
  5746. </button>
  5747. </div>`;
  5748. }
  5749. resultHTML = closeHTML;
  5750. }
  5751.  
  5752. return resultHTML;
  5753. },
  5754. /**
  5755. * 获取底部按钮层HTML
  5756. * @param {"alert"|"confirm"|"prompt"|"drawer"|"folder"} type
  5757. * @param {Required<PopsConfirmDetails>|Required<PopsAlertDetails>|Required<PopsPromptDetails>|Required<PopsDrawerDetails>} config
  5758. * @returns {string}
  5759. */
  5760. getBottomBtnHTML(type, config) {
  5761. if (!config.btn) {
  5762. return "";
  5763. }
  5764. if (
  5765. !(
  5766. config.btn?.ok?.enable ||
  5767. // @ts-ignore
  5768. config.btn?.cancel?.enable ||
  5769. // @ts-ignore
  5770. config.btn?.other?.enable
  5771. )
  5772. ) {
  5773. return "";
  5774. }
  5775. let btnStyle = "";
  5776. let resultHTML = "";
  5777. let okHTML = "";
  5778. let cancelHTML = "";
  5779. let ohterHTML = "";
  5780.  
  5781. if (config.btn.position) {
  5782. btnStyle += `justify-content: ${config.btn.position};`;
  5783. }
  5784. // @ts-ignore
  5785. if (config.btn.reverse) {
  5786. btnStyle += "flex-direction: row-reverse;";
  5787. }
  5788. if (config.btn?.ok?.enable) {
  5789. /* 处理确定按钮的尺寸问题 */
  5790. let okButtonSizeClassName = "";
  5791. if (config.btn.ok.size === "large") {
  5792. okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
  5793. } else if (config.btn.ok.size === "small") {
  5794. okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
  5795. }
  5796. let okIconHTML = "";
  5797. // @ts-ignore
  5798. if (config.btn.ok.icon !== "") {
  5799. okIconHTML = `
  5800. <i class="pops-bottom-icon" is-loading="${
  5801. config.btn.ok.iconIsLoading
  5802. }">
  5803. ${
  5804. // @ts-ignore
  5805. config.btn.ok.icon in pops.config.iconSVG
  5806. ? // @ts-ignore
  5807. pops.config.iconSVG[config.btn.ok.icon]
  5808. : config.btn.ok.icon
  5809. }
  5810. </i>`;
  5811. }
  5812. okHTML = `
  5813. <button
  5814. class="pops-${type}-btn-ok ${okButtonSizeClassName}"
  5815. type="${config.btn.ok.type}"
  5816. data-icon="${config.btn.ok.icon}"
  5817. data-rightIcon="${config.btn.ok.rightIcon}"
  5818. >
  5819. ${okIconHTML}
  5820. <span>${config.btn.ok.text}</span>
  5821. </button>`;
  5822. }
  5823. // @ts-ignore
  5824. if (config.btn?.cancel?.enable) {
  5825. /* 处理取消按钮的尺寸问题 */
  5826. let cancelButtonSizeClassName = "";
  5827. // @ts-ignore
  5828. if (config.btn.cancel.size === "large") {
  5829. // @ts-ignore
  5830. cancelButtonSizeClassName = "pops-button-" + config.btn.cancel.size;
  5831. // @ts-ignore
  5832. } else if (config.btn.cancel.size === "small") {
  5833. // @ts-ignore
  5834. cancelButtonSizeClassName = "pops-button-" + config.btn.cancel.size;
  5835. }
  5836. let cancelIconHTML = "";
  5837. // @ts-ignore
  5838. if (config.btn.cancel.icon !== "") {
  5839. cancelIconHTML = `
  5840. <i class="pops-bottom-icon" is-loading="${
  5841. // @ts-ignore
  5842. config.btn.cancel.iconIsLoading
  5843. }">
  5844. ${
  5845. // @ts-ignore
  5846. config.btn.cancel.icon in pops.config.iconSVG
  5847. ? // @ts-ignore
  5848. pops.config.iconSVG[config.btn.cancel.icon]
  5849. : // @ts-ignore
  5850. config.btn.cancel.icon
  5851. }
  5852. </i>`;
  5853. }
  5854. cancelHTML = `
  5855. <button
  5856. class="pops-${type}-btn-cancel ${cancelButtonSizeClassName}"
  5857. type="${
  5858. // @ts-ignore
  5859. config.btn.cancel.type
  5860. }"
  5861. data-icon="${
  5862. // @ts-ignore
  5863. config.btn.cancel.icon
  5864. }"
  5865. data-rightIcon="${
  5866. // @ts-ignore
  5867. config.btn.cancel.rightIcon
  5868. }"
  5869. >
  5870. ${cancelIconHTML}
  5871. <span>${
  5872. // @ts-ignore
  5873. config.btn.cancel.text
  5874. }</span>
  5875. </button>`;
  5876. }
  5877. // @ts-ignore
  5878. if (config.btn?.other?.enable) {
  5879. /* 处理其它按钮的尺寸问题 */
  5880. let otherButtonSizeClassName = "";
  5881. // @ts-ignore
  5882. if (config.btn.other.size === "large") {
  5883. // @ts-ignore
  5884. otherButtonSizeClassName = "pops-button-" + config.btn.other.size;
  5885. // @ts-ignore
  5886. } else if (config.btn.other.size === "small") {
  5887. // @ts-ignore
  5888. otherButtonSizeClassName = "pops-button-" + config.btn.other.size;
  5889. }
  5890. let otherIconHTML = "";
  5891. // @ts-ignore
  5892. if (config.btn.other.icon !== "") {
  5893. otherIconHTML = `
  5894. <i class="pops-bottom-icon" is-loading="${
  5895. // @ts-ignore
  5896. config.btn.other.iconIsLoading
  5897. }">
  5898. ${
  5899. // @ts-ignore
  5900. config.btn.other.icon in pops.config.iconSVG
  5901. ? // @ts-ignore
  5902. pops.config.iconSVG[config.btn.other.icon]
  5903. : // @ts-ignore
  5904. config.btn.other.icon
  5905. }
  5906. </i>`;
  5907. }
  5908. ohterHTML = `
  5909. <button
  5910. class="pops-${type}-btn-other ${otherButtonSizeClassName}"
  5911. type="${
  5912. // @ts-ignore
  5913. config.btn.other.type
  5914. }"
  5915. data-icon="${
  5916. // @ts-ignore
  5917. config.btn.other.icon
  5918. }"
  5919. data-rightIcon="${
  5920. // @ts-ignore
  5921. config.btn.other.rightIcon
  5922. }"
  5923. >
  5924. ${otherIconHTML}
  5925. <span>${
  5926. // @ts-ignore
  5927. config.btn.other.text
  5928. }</span>
  5929. </button>`;
  5930. }
  5931. // @ts-ignore
  5932. if (config.btn.merge) {
  5933. resultHTML = `
  5934. <div class="pops-${type}-btn" style="${btnStyle}">
  5935. ${ohterHTML}
  5936. <div
  5937. class="pops-${type}-btn-merge"
  5938. style="display: flex;
  5939. flex-direction: ${
  5940. // @ts-ignore
  5941. config.btn.mergeReverse ? "row-reverse" : "row"
  5942. };
  5943. ">
  5944. ${okHTML}
  5945. ${cancelHTML}
  5946. </div>
  5947. </div>
  5948. `;
  5949. } else {
  5950. resultHTML = `
  5951. <div class="pops-${type}-btn" style="${btnStyle}">
  5952. ${okHTML}
  5953. ${cancelHTML}
  5954. ${ohterHTML}
  5955. </div>
  5956. `;
  5957. }
  5958. return resultHTML;
  5959. },
  5960. /**
  5961. * 获取标题style
  5962. * @param {"alert"|"confirm"|"prompt"|"drawer"|"folder"|"panel"} type
  5963. * @param {PopsAlertDetails|PopsConfirmDetails|PopsPromptDetails|PopsDrawerDetails} config
  5964. */
  5965. // @ts-ignore
  5966. // @ts-ignore
  5967. getHeaderStyle(type, config) {
  5968. return {
  5969. // @ts-ignore
  5970. headerStyle: config?.title?.html ? config?.title?.style || "" : "",
  5971. // @ts-ignore
  5972. headerPStyle: config?.title?.html ? "" : config?.title?.style || "",
  5973. };
  5974. },
  5975. /**
  5976. * 获取内容style
  5977. * @param {"alert"|"confirm"|"prompt"|"drawer"} type
  5978. * @param {PopsAlertDetails|PopsConfirmDetails|PopsPromptDetails|PopsDrawerDetails} config
  5979. */
  5980. // @ts-ignore
  5981. // @ts-ignore
  5982. getContentStyle(type, config) {
  5983. return {
  5984. // @ts-ignore
  5985. contentStyle: config?.content?.html ? config?.content?.style || "" : "",
  5986. // @ts-ignore
  5987. contentPStyle: config?.content?.html
  5988. ? ""
  5989. : config?.content?.style || "",
  5990. };
  5991. },
  5992. /**
  5993. * 将html转换成元素
  5994. * @param {string} html
  5995. * @returns {HTMLElement}
  5996. */
  5997. parseElement(html) {
  5998. return PopsUtils.parseTextToDOM(html);
  5999. },
  6000. };
  6001.  
  6002. /**
  6003. * 普通信息框
  6004. * @param { PopsAlertDetails } details 配置
  6005. */
  6006. pops.alert = function (details) {
  6007. // @ts-ignore
  6008. // @ts-ignore
  6009. let that = this;
  6010. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  6011. PopsHandler.handleInit($shadowRoot, [
  6012. pops.config.cssText.index,
  6013. pops.config.cssText.ninePalaceGridPosition,
  6014. pops.config.cssText.scrollbar,
  6015. pops.config.cssText.button,
  6016. pops.config.cssText.anim,
  6017. pops.config.cssText.common,
  6018. pops.config.cssText.alertCSS,
  6019. ]);
  6020. /**
  6021. * @type {Required<PopsAlertDetails>}
  6022. */
  6023. let config = {
  6024. title: {
  6025. text: "默认标题",
  6026. position: "left",
  6027. html: false,
  6028. style: "",
  6029. },
  6030. content: {
  6031. text: "默认内容",
  6032. html: false,
  6033. style: "",
  6034. },
  6035. btn: {
  6036. position: "flex-end",
  6037. ok: {
  6038. // @ts-ignore
  6039. size: "",
  6040. enable: true,
  6041. // @ts-ignore
  6042. icon: "",
  6043. rightIcon: false,
  6044. iconIsLoading: false,
  6045. text: "确定",
  6046. type: "primary",
  6047. callback: function (event) {
  6048. event.close();
  6049. },
  6050. },
  6051. close: {
  6052. enable: true,
  6053. callback: function (event) {
  6054. event.close();
  6055. },
  6056. },
  6057. },
  6058. class: "",
  6059. only: false,
  6060. width: "350px",
  6061. height: "200px",
  6062. position: "center",
  6063. animation: "pops-anim-fadein-zoom",
  6064. zIndex: 10000,
  6065. mask: {
  6066. enable: false,
  6067. clickEvent: {
  6068. toClose: false,
  6069. toHide: false,
  6070. },
  6071. // @ts-ignore
  6072. clickCallBack: null,
  6073. },
  6074. drag: false,
  6075. dragLimit: true,
  6076. dragExtraDistance: 3,
  6077. dragMoveCallBack() {},
  6078. dragEndCallBack() {},
  6079. forbiddenScroll: false,
  6080. // @ts-ignore
  6081. style: void 0,
  6082. beforeAppendToPageCallBack() {},
  6083. };
  6084. config = PopsUtils.assignJSON(config, details);
  6085. let guid = PopsUtils.getRandomGUID();
  6086. const PopsType = "alert";
  6087. // @ts-ignore
  6088. config = PopsHandler.handleOnly(PopsType, config);
  6089.  
  6090. // @ts-ignore
  6091. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  6092. // @ts-ignore
  6093. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  6094. let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
  6095. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  6096. PopsType,
  6097. config
  6098. );
  6099. let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(
  6100. PopsType,
  6101. config
  6102. );
  6103. let animHTML = PopsElementHandler.getAnimHTML(
  6104. guid,
  6105. PopsType,
  6106. config,
  6107. `
  6108. <div
  6109. class="pops-alert-title"
  6110. style="text-align: ${config.title.position};
  6111. ${headerStyle}">
  6112. ${
  6113. config.title.html
  6114. ? config.title.text
  6115. : `<p pops style="${headerPStyle}">${config.title.text}</p>`
  6116. }
  6117. ${headerBtnHTML}
  6118. </div>
  6119. <div class="pops-alert-content" style="${contentStyle}">
  6120. ${
  6121. config.content.html
  6122. ? config.content.text
  6123. : `<p pops style="${contentPStyle}">${config.content.text}</p>`
  6124. }
  6125. </div>
  6126. ${bottomBtnHTML}`,
  6127. bottomBtnHTML
  6128. );
  6129. /**
  6130. * 弹窗的主元素,包括动画层
  6131. */
  6132. let animElement = PopsElementHandler.parseElement(animHTML);
  6133.  
  6134. let {
  6135. popsElement,
  6136. headerCloseBtnElement: btnCloseElement,
  6137. btnOkElement,
  6138. titleElement,
  6139. // @ts-ignore
  6140. } = PopsHandler.handleQueryElement(animElement, PopsType);
  6141. /**
  6142. * 遮罩层元素
  6143. * @type {?HTMLDivElement}
  6144. */
  6145. let maskElement = null;
  6146. /**
  6147. * 已创建的元素列表
  6148. * @type {HTMLElement[]}
  6149. */
  6150. let elementList = [animElement];
  6151.  
  6152. /* 遮罩层元素 */
  6153. // @ts-ignore
  6154. if (config.mask.enable) {
  6155. let _handleMask_ = PopsHandler.handleMask({
  6156. type: PopsType,
  6157. guid: guid,
  6158. config: config,
  6159. animElement: animElement,
  6160. maskHTML: maskHTML,
  6161. });
  6162. maskElement = _handleMask_.maskElement;
  6163. elementList.push(maskElement);
  6164. }
  6165. /* 处理返回的配置 */
  6166. let eventDetails = PopsHandler.handleEventDetails(
  6167. guid,
  6168. $shadowContainer,
  6169. $shadowRoot,
  6170. PopsType,
  6171. // @ts-ignore
  6172. animElement,
  6173. popsElement,
  6174. maskElement,
  6175. config
  6176. );
  6177. /* 为顶部右边的关闭按钮添加点击事件 */
  6178. PopsHandler.handleClickEvent(
  6179. // @ts-ignore
  6180. btnCloseElement,
  6181. "close",
  6182. eventDetails,
  6183. // @ts-ignore
  6184. config.btn.close.callback
  6185. );
  6186. /* 为底部ok按钮添加点击事件 */
  6187. PopsHandler.handleClickEvent(
  6188. // @ts-ignore
  6189. btnOkElement,
  6190. "ok",
  6191. eventDetails,
  6192. // @ts-ignore
  6193. config.btn.ok.callback
  6194. );
  6195.  
  6196. /* 创建到页面中 */
  6197. // @ts-ignore
  6198. PopsUtils.appendChild($shadowRoot, elementList);
  6199. if (typeof config.beforeAppendToPageCallBack === "function") {
  6200. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  6201. }
  6202. // @ts-ignore
  6203. PopsUtils.appendChild($shadowContainer);
  6204. if (maskElement != null) {
  6205. animElement.after(maskElement);
  6206. }
  6207. /* 保存 */
  6208. PopsHandler.handlePush(PopsType, {
  6209. guid: guid,
  6210. // @ts-ignore
  6211. animElement: animElement,
  6212. // @ts-ignore
  6213. popsElement: popsElement,
  6214. // @ts-ignore
  6215. maskElement: maskElement,
  6216. $shadowContainer: $shadowContainer,
  6217. $shadowRoot: $shadowRoot,
  6218. });
  6219. /* 拖拽 */
  6220. if (config.drag) {
  6221. // @ts-ignore
  6222. PopsUtils.drag(popsElement, {
  6223. dragElement: titleElement,
  6224. limit: config.dragLimit,
  6225. extraDistance: config.dragExtraDistance,
  6226. moveCallBack: config.dragMoveCallBack,
  6227. endCallBack: config.dragEndCallBack,
  6228. });
  6229. }
  6230.  
  6231. return PopsHandler.handleResultDetails(eventDetails);
  6232. };
  6233.  
  6234. /**
  6235. * 询问框
  6236. * @param {PopsConfirmDetails} details
  6237. */
  6238. pops.confirm = function (details) {
  6239. // @ts-ignore
  6240. // @ts-ignore
  6241. let that = this;
  6242. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  6243. PopsHandler.handleInit($shadowRoot, [
  6244. pops.config.cssText.index,
  6245. pops.config.cssText.ninePalaceGridPosition,
  6246. pops.config.cssText.scrollbar,
  6247. pops.config.cssText.button,
  6248. pops.config.cssText.anim,
  6249. pops.config.cssText.common,
  6250. pops.config.cssText.confirmCSS,
  6251. ]);
  6252. /**
  6253. * @type {Required<PopsConfirmDetails>}
  6254. */
  6255. let config = {
  6256. title: {
  6257. text: "默认标题",
  6258. position: "left",
  6259. html: false,
  6260. style: "",
  6261. },
  6262. content: {
  6263. text: "默认内容",
  6264. html: false,
  6265. style: "",
  6266. },
  6267. btn: {
  6268. merge: false,
  6269. mergeReverse: false,
  6270. reverse: false,
  6271. position: "flex-end",
  6272. ok: {
  6273. enable: true,
  6274. // @ts-ignore
  6275. size: "",
  6276. // @ts-ignore
  6277. icon: "",
  6278. rightIcon: false,
  6279. iconIsLoading: false,
  6280. text: "确定",
  6281. type: "primary",
  6282. callback(event) {
  6283. event.close();
  6284. },
  6285. },
  6286. cancel: {
  6287. enable: true,
  6288. // @ts-ignore
  6289. size: "",
  6290. // @ts-ignore
  6291. icon: "",
  6292. rightIcon: false,
  6293. iconIsLoading: false,
  6294. text: "关闭",
  6295. type: "default",
  6296. callback(event) {
  6297. event.close();
  6298. },
  6299. },
  6300. other: {
  6301. enable: false,
  6302. // @ts-ignore
  6303. size: "",
  6304. // @ts-ignore
  6305. icon: "",
  6306. rightIcon: false,
  6307. iconIsLoading: false,
  6308. text: "其它按钮",
  6309. type: "default",
  6310. callback(event) {
  6311. event.close();
  6312. },
  6313. },
  6314. close: {
  6315. enable: true,
  6316. callback(event) {
  6317. event.close();
  6318. },
  6319. },
  6320. },
  6321. class: "",
  6322. only: false,
  6323. width: "350px",
  6324. height: "200px",
  6325. position: "center",
  6326. animation: "pops-anim-fadein-zoom",
  6327. zIndex: 10000,
  6328. mask: {
  6329. enable: false,
  6330. clickEvent: {
  6331. toClose: false,
  6332. toHide: false,
  6333. },
  6334. // @ts-ignore
  6335. clickCallBack: null,
  6336. },
  6337. drag: false,
  6338. dragLimit: true,
  6339. dragExtraDistance: 3,
  6340. dragMoveCallBack() {},
  6341. dragEndCallBack() {},
  6342. forbiddenScroll: false,
  6343. // @ts-ignore
  6344. style: void 0,
  6345. beforeAppendToPageCallBack() {},
  6346. };
  6347. config = PopsUtils.assignJSON(config, details);
  6348. let guid = PopsUtils.getRandomGUID();
  6349. const PopsType = "confirm";
  6350. // @ts-ignore
  6351. config = PopsHandler.handleOnly(PopsType, config);
  6352. // @ts-ignore
  6353. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  6354. // @ts-ignore
  6355. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  6356. let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
  6357. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  6358. PopsType,
  6359. config
  6360. );
  6361. let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(
  6362. PopsType,
  6363. config
  6364. );
  6365. let animHTML = PopsElementHandler.getAnimHTML(
  6366. guid,
  6367. PopsType,
  6368. config,
  6369. `
  6370. <div class="pops-confirm-title" style="text-align: ${
  6371. config.title.position
  6372. };${headerStyle}">
  6373. ${
  6374. config.title.html
  6375. ? config.title.text
  6376. : `<p pops style="${headerPStyle}">${config.title.text}</p>`
  6377. }
  6378. ${headerBtnHTML}
  6379. </div>
  6380. <div class="pops-confirm-content" style="${contentStyle}">
  6381. ${
  6382. config.content.html
  6383. ? config.content.text
  6384. : `<p pops style="${contentPStyle}">${config.content.text}</p>`
  6385. }
  6386. </div>
  6387. ${bottomBtnHTML}
  6388. `,
  6389. bottomBtnHTML
  6390. );
  6391. /**
  6392. * 弹窗的主元素,包括动画层
  6393. */
  6394. let animElement = PopsElementHandler.parseElement(animHTML);
  6395. let {
  6396. popsElement,
  6397. titleElement,
  6398. headerCloseBtnElement: btnCloseElement,
  6399. btnOkElement,
  6400. btnCancelElement,
  6401. btnOtherElement,
  6402. // @ts-ignore
  6403. } = PopsHandler.handleQueryElement(animElement, PopsType);
  6404. /**
  6405. * 遮罩层元素
  6406. * @type {?HTMLDivElement}
  6407. */
  6408. let maskElement = null;
  6409. /**
  6410. * 已创建的元素列表
  6411. * @type {HTMLElement[]}
  6412. */
  6413. let elementList = [animElement];
  6414. // @ts-ignore
  6415. if (config.mask.enable) {
  6416. let _handleMask_ = PopsHandler.handleMask({
  6417. type: PopsType,
  6418. guid: guid,
  6419. config: config,
  6420. animElement: animElement,
  6421. maskHTML: maskHTML,
  6422. });
  6423. maskElement = _handleMask_.maskElement;
  6424. elementList.push(maskElement);
  6425. }
  6426. let eventDetails = PopsHandler.handleEventDetails(
  6427. guid,
  6428. $shadowContainer,
  6429. $shadowRoot,
  6430. PopsType,
  6431. // @ts-ignore
  6432. animElement,
  6433. popsElement,
  6434. maskElement,
  6435. config
  6436. );
  6437. PopsHandler.handleClickEvent(
  6438. // @ts-ignore
  6439. btnCloseElement,
  6440. "close",
  6441. eventDetails,
  6442. // @ts-ignore
  6443. config.btn.close.callback
  6444. );
  6445. PopsHandler.handleClickEvent(
  6446. // @ts-ignore
  6447. btnOkElement,
  6448. "ok",
  6449. eventDetails,
  6450. // @ts-ignore
  6451. config.btn.ok.callback
  6452. );
  6453. PopsHandler.handleClickEvent(
  6454. // @ts-ignore
  6455. btnCancelElement,
  6456. "cancel",
  6457. eventDetails,
  6458. // @ts-ignore
  6459. config.btn.cancel.callback
  6460. );
  6461. PopsHandler.handleClickEvent(
  6462. // @ts-ignore
  6463. btnOtherElement,
  6464. "other",
  6465. eventDetails,
  6466. // @ts-ignore
  6467. config.btn.other.callback
  6468. );
  6469.  
  6470. /* 创建到页面中 */
  6471. // @ts-ignore
  6472. PopsUtils.appendChild($shadowRoot, elementList);
  6473. if (typeof config.beforeAppendToPageCallBack === "function") {
  6474. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  6475. }
  6476. // @ts-ignore
  6477. PopsUtils.appendChild($shadowContainer);
  6478. if (maskElement != null) {
  6479. animElement.after(maskElement);
  6480. }
  6481. PopsHandler.handlePush(PopsType, {
  6482. guid: guid,
  6483. // @ts-ignore
  6484. animElement: animElement,
  6485. // @ts-ignore
  6486. popsElement: popsElement,
  6487. // @ts-ignore
  6488. maskElement: maskElement,
  6489. $shadowContainer: $shadowContainer,
  6490. $shadowRoot: $shadowRoot,
  6491. });
  6492. /* 拖拽 */
  6493. if (config.drag) {
  6494. 0;
  6495. // @ts-ignore
  6496. PopsUtils.drag(popsElement, {
  6497. dragElement: titleElement,
  6498. limit: config.dragLimit,
  6499. extraDistance: config.dragExtraDistance,
  6500. moveCallBack: config.dragMoveCallBack,
  6501. endCallBack: config.dragEndCallBack,
  6502. });
  6503. }
  6504. return PopsHandler.handleResultDetails(eventDetails);
  6505. };
  6506.  
  6507. /**
  6508. * 输入框
  6509. * @param {PopsPromptDetails} details
  6510. */
  6511. pops.prompt = function (details) {
  6512. // @ts-ignore
  6513. // @ts-ignore
  6514. let that = this;
  6515. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  6516. PopsHandler.handleInit($shadowRoot, [
  6517. pops.config.cssText.index,
  6518. pops.config.cssText.ninePalaceGridPosition,
  6519. pops.config.cssText.scrollbar,
  6520. pops.config.cssText.button,
  6521. pops.config.cssText.anim,
  6522. pops.config.cssText.common,
  6523. pops.config.cssText.promptCSS,
  6524. ]);
  6525. /**
  6526. * @type {Required<PopsPromptDetails>}
  6527. */
  6528. let config = {
  6529. title: {
  6530. text: "默认标题",
  6531. position: "left",
  6532. html: false,
  6533. style: "",
  6534. },
  6535. content: {
  6536. text: "",
  6537. password: false,
  6538. row: false,
  6539. focus: true,
  6540. placeholder: "默认提示",
  6541. style: "",
  6542. },
  6543. btn: {
  6544. merge: false,
  6545. mergeReverse: false,
  6546. reverse: false,
  6547. position: "flex-end",
  6548. ok: {
  6549. enable: true,
  6550. // @ts-ignore
  6551. size: "",
  6552. // @ts-ignore
  6553. icon: "",
  6554. rightIcon: false,
  6555. iconIsLoading: false,
  6556. text: "确定",
  6557. type: "success",
  6558. callback(event) {
  6559. console.log(event);
  6560. event.close();
  6561. },
  6562. },
  6563. cancel: {
  6564. enable: true,
  6565. // @ts-ignore
  6566. size: "",
  6567. // @ts-ignore
  6568. icon: "",
  6569. rightIcon: false,
  6570. iconIsLoading: false,
  6571. text: "关闭",
  6572. type: "default",
  6573. callback(event) {
  6574. console.log(event);
  6575. event.close();
  6576. },
  6577. },
  6578. other: {
  6579. enable: false,
  6580. // @ts-ignore
  6581. size: "",
  6582. // @ts-ignore
  6583. icon: "",
  6584. rightIcon: false,
  6585. iconIsLoading: false,
  6586. text: "其它按钮",
  6587. type: "default",
  6588. callback(event) {
  6589. console.log(event);
  6590. event.close();
  6591. },
  6592. },
  6593. close: {
  6594. enable: true,
  6595. callback(event) {
  6596. console.log(event);
  6597. event.close();
  6598. },
  6599. },
  6600. },
  6601. class: "",
  6602. only: false,
  6603. width: "350px",
  6604. height: "200px",
  6605. position: "center",
  6606. animation: "pops-anim-fadein-zoom",
  6607. zIndex: 10000,
  6608. mask: {
  6609. enable: false,
  6610. clickEvent: {
  6611. toClose: false,
  6612. toHide: false,
  6613. },
  6614. // @ts-ignore
  6615. clickCallBack: null,
  6616. },
  6617. drag: false,
  6618. dragLimit: true,
  6619. dragExtraDistance: 3,
  6620. dragMoveCallBack() {},
  6621. dragEndCallBack() {},
  6622. forbiddenScroll: false,
  6623. // @ts-ignore
  6624. style: void 0,
  6625. beforeAppendToPageCallBack() {},
  6626. };
  6627. config = PopsUtils.assignJSON(config, details);
  6628. let guid = PopsUtils.getRandomGUID();
  6629. const PopsType = "prompt";
  6630. // @ts-ignore
  6631. config = PopsHandler.handleOnly(PopsType, config);
  6632. // @ts-ignore
  6633. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  6634. // @ts-ignore
  6635. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  6636. let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
  6637. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  6638. PopsType,
  6639. config
  6640. );
  6641. let { contentPStyle } = PopsElementHandler.getContentStyle(
  6642. PopsType,
  6643. config
  6644. );
  6645. let animHTML = PopsElementHandler.getAnimHTML(
  6646. guid,
  6647. PopsType,
  6648. config,
  6649. `
  6650. <div class="pops-prompt-title" style="text-align: ${
  6651. config.title.position
  6652. };${headerStyle}">
  6653. ${
  6654. config.title.html
  6655. ? config.title.text
  6656. : `<p pops style="${headerPStyle}">${config.title.text}</p>`
  6657. }
  6658. ${headerBtnHTML}
  6659. </div>
  6660. <div class="pops-prompt-content" style="${contentPStyle}">
  6661. ${
  6662. config.content.row
  6663. ? '<textarea pops="" placeholder="' +
  6664. config.content.placeholder +
  6665. '"></textarea>'
  6666. : '<input pops="" placeholder="' +
  6667. config.content.placeholder +
  6668. '" type="' +
  6669. (config.content.password ? "password" : "text") +
  6670. '">'
  6671. }
  6672. </div>
  6673. ${bottomBtnHTML}
  6674. `,
  6675. bottomBtnHTML
  6676. );
  6677. /**
  6678. * 弹窗的主元素,包括动画层
  6679. * @type {HTMLDivElement}
  6680. */
  6681. // @ts-ignore
  6682. let animElement = PopsElementHandler.parseElement(animHTML);
  6683.  
  6684. let {
  6685. popsElement,
  6686. inputElement,
  6687. headerCloseBtnElement: btnCloseElement,
  6688. btnOkElement,
  6689. btnCancelElement,
  6690. btnOtherElement,
  6691. titleElement,
  6692. } = PopsHandler.handleQueryElement(animElement, PopsType);
  6693. /**
  6694. * 遮罩层元素
  6695. * @type {?HTMLDivElement}
  6696. */
  6697. let maskElement = null;
  6698.  
  6699. /**
  6700. * 已创建的元素列表
  6701. * @type {HTMLElement[]}
  6702. */
  6703. let elementList = [animElement];
  6704. // @ts-ignore
  6705. if (config.mask.enable) {
  6706. let _handleMask_ = PopsHandler.handleMask({
  6707. type: PopsType,
  6708. guid: guid,
  6709. config: config,
  6710. animElement: animElement,
  6711. maskHTML: maskHTML,
  6712. });
  6713. maskElement = _handleMask_.maskElement;
  6714. elementList.push(maskElement);
  6715. }
  6716. let eventDetails = PopsHandler.handleEventDetails(
  6717. guid,
  6718. $shadowContainer,
  6719. $shadowRoot,
  6720. PopsType,
  6721. animElement,
  6722. // @ts-ignore
  6723. popsElement,
  6724. maskElement,
  6725. config
  6726. );
  6727. /* 输入框赋值初始值 */
  6728. // @ts-ignore
  6729. inputElement.value = config.content.text;
  6730. PopsHandler.handlePromptClickEvent(
  6731. // @ts-ignore
  6732. inputElement,
  6733. btnCloseElement,
  6734. "close",
  6735. eventDetails,
  6736. // @ts-ignore
  6737. config.btn.close.callback
  6738. );
  6739.  
  6740. PopsHandler.handlePromptClickEvent(
  6741. // @ts-ignore
  6742. inputElement,
  6743. btnOkElement,
  6744. "ok",
  6745. eventDetails,
  6746. // @ts-ignore
  6747. config.btn.ok.callback
  6748. );
  6749. PopsHandler.handlePromptClickEvent(
  6750. // @ts-ignore
  6751. inputElement,
  6752. btnCancelElement,
  6753. "cancel",
  6754. eventDetails,
  6755. // @ts-ignore
  6756. config.btn.cancel.callback
  6757. );
  6758.  
  6759. PopsHandler.handlePromptClickEvent(
  6760. // @ts-ignore
  6761. inputElement,
  6762. btnOtherElement,
  6763. "other",
  6764. eventDetails,
  6765. // @ts-ignore
  6766. config.btn.other.callback
  6767. );
  6768. /* 创建到页面中 */
  6769. // @ts-ignore
  6770. PopsUtils.appendChild($shadowRoot, elementList);
  6771. if (typeof config.beforeAppendToPageCallBack === "function") {
  6772. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  6773. }
  6774. // @ts-ignore
  6775. PopsUtils.appendChild($shadowContainer);
  6776. if (maskElement != null) {
  6777. animElement.after(maskElement);
  6778. }
  6779. PopsHandler.handlePush(PopsType, {
  6780. guid: guid,
  6781. animElement: animElement,
  6782. // @ts-ignore
  6783. popsElement: popsElement,
  6784. // @ts-ignore
  6785. maskElement: maskElement,
  6786. $shadowContainer: $shadowContainer,
  6787. $shadowRoot: $shadowRoot,
  6788. });
  6789. /* 拖拽 */
  6790. if (config.drag) {
  6791. // @ts-ignore
  6792. PopsUtils.drag(popsElement, {
  6793. dragElement: titleElement,
  6794. limit: config.dragLimit,
  6795. extraDistance: config.dragExtraDistance,
  6796. moveCallBack: config.dragMoveCallBack,
  6797. endCallBack: config.dragEndCallBack,
  6798. });
  6799. }
  6800. /* 设置自动获取焦点 */
  6801. if (config.content.focus) {
  6802. inputElement?.focus();
  6803. }
  6804.  
  6805. return PopsHandler.handleResultDetails(eventDetails);
  6806. };
  6807.  
  6808. /**
  6809. * 加载层
  6810. * @param {PopsLoadingDetails} details
  6811. */
  6812. pops.loading = function (details) {
  6813. // @ts-ignore
  6814. // @ts-ignore
  6815. let that = this;
  6816. // @ts-ignore
  6817. PopsHandler.handleInit();
  6818. /**
  6819. * @type {Required<PopsLoadingDetails>}
  6820. */
  6821. let config = {
  6822. parent: document.body,
  6823. content: {
  6824. text: "加载中...",
  6825. icon: "loading",
  6826. style: "",
  6827. },
  6828. class: "",
  6829. only: false,
  6830. zIndex: 10000,
  6831. mask: {
  6832. enable: false,
  6833. clickEvent: {
  6834. toClose: false,
  6835. toHide: false,
  6836. },
  6837. // @ts-ignore
  6838. clickCallBack: null,
  6839. },
  6840. animation: "pops-anim-fadein-zoom",
  6841. forbiddenScroll: false,
  6842. // @ts-ignore
  6843. style: void 0,
  6844. addIndexCSS: true,
  6845. };
  6846. config = PopsUtils.assignJSON(config, details);
  6847. let guid = PopsUtils.getRandomGUID();
  6848. const PopsType = "loading";
  6849. // @ts-ignore
  6850. config = PopsHandler.handleOnly(PopsType, config);
  6851. // @ts-ignore
  6852. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  6853. // @ts-ignore
  6854. let { contentPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
  6855. let animHTML = PopsElementHandler.getAnimHTML(
  6856. guid,
  6857. PopsType,
  6858. config,
  6859. `
  6860. <div class="pops-loading-content">
  6861. ${
  6862. config.addIndexCSS
  6863. ? `
  6864. <style type="text/css" data-model-name="index">${pops.config.cssText.index}</style>
  6865. <style type="text/css" data-model-name="anim">${pops.config.cssText.anim}</style>
  6866. <style type="text/css" data-model-name="common">${pops.config.cssText.common}</style>
  6867. `
  6868. : ""
  6869. }
  6870. <style type="text/css" data-model-name="loadingCSS">${
  6871. pops.config.cssText.loadingCSS
  6872. }</style>
  6873. ${
  6874. config.style != null
  6875. ? `<style type="text/css">${config.style}</style>`
  6876. : ""
  6877. }
  6878. <p pops style="${contentPStyle}">${config.content.text}</p>
  6879. </div>
  6880. `,
  6881. ""
  6882. );
  6883.  
  6884. /**
  6885. * 弹窗的主元素,包括动画层
  6886. * @type {HTMLDivElement}
  6887. */
  6888. // @ts-ignore
  6889. let animElement = PopsElementHandler.parseElement(animHTML);
  6890.  
  6891. let { popsElement } = PopsHandler.handleQueryElement(animElement, PopsType);
  6892. /**
  6893. * 遮罩层元素
  6894. * @type {?HTMLDivElement}
  6895. */
  6896. let maskElement = null;
  6897. /**
  6898. * 已创建的元素列表
  6899. * @type {HTMLElement[]}
  6900. */
  6901. let elementList = [animElement];
  6902. // @ts-ignore
  6903. if (config.mask.enable) {
  6904. let _handleMask_ = PopsHandler.handleMask({
  6905. type: PopsType,
  6906. guid: guid,
  6907. // @ts-ignore
  6908. config: config,
  6909. animElement: animElement,
  6910. maskHTML: maskHTML,
  6911. });
  6912. maskElement = _handleMask_.maskElement;
  6913. elementList.push(maskElement);
  6914. }
  6915. let eventDetails = PopsHandler.handleEventDetails(
  6916. guid,
  6917. // @ts-ignore
  6918. void 0,
  6919. void 0,
  6920. PopsType,
  6921. animElement,
  6922. popsElement,
  6923. maskElement,
  6924. config
  6925. );
  6926. PopsUtils.appendChild(config.parent, elementList);
  6927. if (maskElement != null) {
  6928. animElement.after(maskElement);
  6929. }
  6930. PopsHandler.handlePush(PopsType, {
  6931. guid: guid,
  6932. animElement: animElement,
  6933. // @ts-ignore
  6934. popsElement: popsElement,
  6935. // @ts-ignore
  6936. maskElement: maskElement,
  6937. });
  6938.  
  6939. return PopsHandler.handleResultDetails(eventDetails);
  6940. };
  6941.  
  6942. /**
  6943. * iframe层
  6944. * @param {PopsIframeDetails} details
  6945. */
  6946. pops.iframe = function (details) {
  6947. let that = this;
  6948. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  6949. PopsHandler.handleInit($shadowRoot, [
  6950. pops.config.cssText.index,
  6951. pops.config.cssText.ninePalaceGridPosition,
  6952. pops.config.cssText.scrollbar,
  6953. pops.config.cssText.anim,
  6954. pops.config.cssText.common,
  6955. pops.config.cssText.iframeCSS,
  6956. ]);
  6957. /**
  6958. * @type {Required<PopsIframeDetails>}
  6959. */
  6960. let config = {
  6961. title: {
  6962. position: "center",
  6963. text: "",
  6964. html: false,
  6965. style: "",
  6966. },
  6967. loading: {
  6968. enable: true,
  6969. icon: true,
  6970. text: "",
  6971. // @ts-ignore
  6972. style: "",
  6973. },
  6974. class: "",
  6975. url: window.location.href,
  6976. only: false,
  6977. zIndex: 10000,
  6978. mask: {
  6979. enable: false,
  6980. clickEvent: {
  6981. toClose: false,
  6982. toHide: false,
  6983. },
  6984. // @ts-ignore
  6985. clickCallBack: null,
  6986. },
  6987. animation: "pops-anim-fadein-zoom",
  6988. position: "center",
  6989. drag: false,
  6990. dragLimit: true,
  6991. dragExtraDistance: 3,
  6992. dragMoveCallBack() {},
  6993. dragEndCallBack() {},
  6994. width: "300px",
  6995. height: "250px",
  6996. topRightButton: "min|max|mise|close",
  6997. sandbox: false,
  6998. forbiddenScroll: false,
  6999. loadEndCallBack() {},
  7000. btn: {
  7001. min: {
  7002. callback() {},
  7003. },
  7004. max: {
  7005. callback() {},
  7006. },
  7007. mise: {
  7008. callback() {},
  7009. },
  7010. close: {
  7011. callback() {},
  7012. },
  7013. },
  7014. // @ts-ignore
  7015. style: void 0,
  7016. beforeAppendToPageCallBack() {},
  7017. };
  7018. config = PopsUtils.assignJSON(config, details);
  7019. if (config.url == null) {
  7020. throw "config.url不能为空";
  7021. }
  7022. let guid = PopsUtils.getRandomGUID();
  7023. const PopsType = "iframe";
  7024. // @ts-ignore
  7025. config = PopsHandler.handleOnly(PopsType, config);
  7026. let maskExtraStyle =
  7027. // @ts-ignore
  7028. config.animation != null && config.animation != ""
  7029. ? "position:absolute;"
  7030. : "";
  7031. let maskHTML = PopsElementHandler.getMaskHTML(
  7032. guid,
  7033. // @ts-ignore
  7034. config.zIndex,
  7035. maskExtraStyle
  7036. );
  7037. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  7038. let iframeLoadingHTML = '<div class="pops-loading"></div>';
  7039. let titleText =
  7040. // @ts-ignore
  7041. config.title.text.trim() !== "" ? config.title.text : config.url;
  7042. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  7043. // @ts-ignore
  7044. PopsType,
  7045. config
  7046. );
  7047. let animHTML = PopsElementHandler.getAnimHTML(
  7048. guid,
  7049. PopsType,
  7050. config,
  7051. `
  7052. <div
  7053. class="pops-iframe-title"
  7054. style="text-align: ${config.title.position};${headerStyle}"
  7055. >
  7056. ${
  7057. config.title.html
  7058. ? titleText
  7059. : `<p pops style="${headerPStyle}">${titleText}</p>`
  7060. }
  7061. ${headerBtnHTML}
  7062. </div>
  7063. <div class="pops-iframe-content">
  7064. <div class="pops-iframe-content-global-loading"></div>
  7065. <iframe
  7066. src="${config.url}"
  7067. pops
  7068. ${
  7069. config.sandbox
  7070. ? "sandbox='allow-forms allow-same-origin allow-scripts'"
  7071. : ""
  7072. }>
  7073. </iframe>
  7074. </div>
  7075. ${config.loading.enable ? iframeLoadingHTML : ""}
  7076. `,
  7077. ""
  7078. );
  7079. /**
  7080. * 弹窗的主元素,包括动画层
  7081. * @type {HTMLDivElement}
  7082. */
  7083. // @ts-ignore
  7084. let animElement = PopsElementHandler.parseElement(animHTML);
  7085. let {
  7086. popsElement,
  7087. headerCloseBtnElement,
  7088. headerControlsElement,
  7089. titleElement,
  7090. iframeElement,
  7091. loadingElement,
  7092. contentLoadingElement,
  7093. headerMinBtnElement,
  7094. headerMaxBtnElement,
  7095. headerMiseBtnElement,
  7096. } = PopsHandler.handleQueryElement(animElement, PopsType);
  7097. /**
  7098. * 遮罩层元素
  7099. * @type {?HTMLDivElement}
  7100. */
  7101. let maskElement = null;
  7102. /**
  7103. * 已创建的元素列表
  7104. * @type {HTMLElement[]}
  7105. */
  7106. let elementList = [animElement];
  7107. // @ts-ignore
  7108. if (config.mask.enable) {
  7109. let _handleMask_ = PopsHandler.handleMask({
  7110. type: PopsType,
  7111. guid: guid,
  7112. // @ts-ignore
  7113. config: config,
  7114. animElement: animElement,
  7115. maskHTML: maskHTML,
  7116. });
  7117. maskElement = _handleMask_.maskElement;
  7118. elementList.push(maskElement);
  7119. }
  7120.  
  7121. let eventDetails = PopsHandler.handleEventDetails(
  7122. guid,
  7123. $shadowContainer,
  7124. $shadowRoot,
  7125. PopsType,
  7126. animElement,
  7127. // @ts-ignore
  7128. popsElement,
  7129. maskElement,
  7130. config
  7131. );
  7132. // @ts-ignore
  7133. eventDetails["iframeElement"] = iframeElement;
  7134. // @ts-ignore
  7135. PopsDOMUtils.on(
  7136. animElement,
  7137. PopsDOMUtils.getAnimationEndNameList(),
  7138. void 0,
  7139. function () {
  7140. /* 动画加载完毕 */
  7141. animElement.style.width = "0%";
  7142. animElement.style.height = "0%";
  7143. }
  7144. );
  7145.  
  7146. // @ts-ignore
  7147. PopsDOMUtils.on(iframeElement, "load", void 0, function () {
  7148. /* iframe加载中... */
  7149. loadingElement?.remove();
  7150. // @ts-ignore
  7151. contentLoadingElement.style.animation =
  7152. "iframeLoadingChange_85 0.3s forwards";
  7153. // @ts-ignore
  7154. PopsDOMUtils.on(
  7155. contentLoadingElement,
  7156. PopsDOMUtils.getAnimationEndNameList(),
  7157. void 0,
  7158. function () {
  7159. /* 动画加载完毕就移除 */
  7160. // @ts-ignore
  7161. contentLoadingElement.remove();
  7162. }
  7163. );
  7164. // @ts-ignore
  7165. if (config.title.text.trim() === "" && iframeElement.contentDocument) {
  7166. /* 同域名下的才可以获取网页标题 */
  7167. // @ts-ignore
  7168. titleElement.querySelector("p").innerText =
  7169. // @ts-ignore
  7170. iframeElement.contentDocument.title;
  7171. }
  7172. // @ts-ignore
  7173. config.loadEndCallBack(eventDetails);
  7174. });
  7175. /* 创建到页面中 */
  7176. // @ts-ignore
  7177. PopsUtils.appendChild($shadowRoot, elementList);
  7178. if (typeof config.beforeAppendToPageCallBack === "function") {
  7179. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  7180. }
  7181. // @ts-ignore
  7182. PopsUtils.appendChild($shadowContainer);
  7183. if (maskElement != null) {
  7184. animElement.after(maskElement);
  7185. }
  7186. /* 拖拽 */
  7187. if (config.drag) {
  7188. // @ts-ignore
  7189. PopsUtils.drag(popsElement, {
  7190. dragElement: titleElement,
  7191. limit: config.dragLimit,
  7192. extraDistance: config.dragExtraDistance,
  7193. moveCallBack: config.dragMoveCallBack,
  7194. endCallBack: config.dragEndCallBack,
  7195. });
  7196. }
  7197. let normalLeft = "";
  7198. /* 最小化按钮点击事件 */
  7199.  
  7200. PopsDOMUtils.on(
  7201. // @ts-ignore
  7202. headerMinBtnElement,
  7203. "click",
  7204. void 0,
  7205. (event) => {
  7206. /**
  7207. * 所有最小化的iframe数组
  7208. * @type { HTMLElement[] }
  7209. */
  7210. let allMinElementList = [];
  7211.  
  7212. pops.config.layer.iframe.forEach((item) => {
  7213. if (
  7214. item.animElement != animElement &&
  7215. item.popsElement.getAttribute("type-module") === "min"
  7216. ) {
  7217. allMinElementList.push(item.popsElement);
  7218. }
  7219. });
  7220. let maxLeftValue = allMinElementList.length
  7221. ? allMinElementList.length * 205
  7222. : 0;
  7223. // @ts-ignore
  7224. popsElement.style.transitionDuration = "";
  7225. // @ts-ignore
  7226. normalLeft = popsElement.style.left;
  7227. // @ts-ignore
  7228. popsElement.style.left = maxLeftValue + "px";
  7229. // @ts-ignore
  7230. popsElement.setAttribute("type-module", "min");
  7231. // @ts-ignore
  7232. animElement
  7233. .querySelector(".pops-header-controls")
  7234. .setAttribute("type", "max");
  7235. // @ts-ignore
  7236. config.btn.min.callback(event);
  7237. },
  7238. {
  7239. capture: true,
  7240. }
  7241. );
  7242. /* 最大化按钮点击事件 */
  7243. PopsDOMUtils.on(
  7244. // @ts-ignore
  7245. headerMaxBtnElement,
  7246. "click",
  7247. void 0,
  7248. (event) => {
  7249. // @ts-ignore
  7250. popsElement.style.transitionDuration = "";
  7251. // @ts-ignore
  7252. normalLeft = popsElement.style.left;
  7253. // @ts-ignore
  7254. popsElement.removeAttribute("type-module");
  7255. // @ts-ignore
  7256. popsElement.setAttribute("type-module", "max");
  7257. // @ts-ignore
  7258. headerControlsElement.setAttribute("type", "max");
  7259. // @ts-ignore
  7260. headerMaxBtnElement.style.setProperty("display", "none");
  7261. // @ts-ignore
  7262. headerMiseBtnElement.style.setProperty("display", "");
  7263. // @ts-ignore
  7264. config.btn.max.callback(event);
  7265. },
  7266. {
  7267. capture: true,
  7268. }
  7269. );
  7270. /* 先隐藏窗口化按钮 */
  7271. headerMiseBtnElement?.style?.setProperty("display", "none");
  7272. /* 窗口化按钮点击事件 */
  7273. PopsDOMUtils.on(
  7274. // @ts-ignore
  7275. headerMiseBtnElement,
  7276. "click",
  7277. void 0,
  7278. (event) => {
  7279. // @ts-ignore
  7280. popsElement.style.transitionDuration = "";
  7281. // @ts-ignore
  7282. popsElement.style.left = normalLeft;
  7283. // @ts-ignore
  7284. headerControlsElement.removeAttribute("type");
  7285. // @ts-ignore
  7286. popsElement.removeAttribute("type-module");
  7287. /**
  7288. * 所有最小化的iframe数组
  7289. * @type { HTMLElement[] }
  7290. */
  7291. let allMinElementList = [];
  7292. pops.config.layer.iframe.forEach((item) => {
  7293. if (
  7294. item.animElement != animElement &&
  7295. // @ts-ignore
  7296. popsElement.getAttribute("type-module") === "min"
  7297. ) {
  7298. allMinElementList.push(item.popsElement);
  7299. }
  7300. });
  7301. allMinElementList.sort(
  7302. PopsUtils.sortElementListByProperty(
  7303. (obj) => {
  7304. return parseInt(getComputedStyle(obj).left);
  7305. },
  7306. (obj) => {
  7307. return parseInt(getComputedStyle(obj).left);
  7308. },
  7309. false
  7310. )
  7311. );
  7312. allMinElementList.forEach((item, index) => {
  7313. item.style.left = index * 205 + "px";
  7314. });
  7315. // @ts-ignore
  7316. headerMiseBtnElement.style.setProperty("display", "none");
  7317. // @ts-ignore
  7318. headerMaxBtnElement.style.setProperty("display", "");
  7319. // @ts-ignore
  7320. config.btn.mise.callback(event);
  7321. },
  7322. {
  7323. capture: true,
  7324. }
  7325. );
  7326. /* 关闭按钮点击事件 */
  7327. PopsDOMUtils.on(
  7328. // @ts-ignore
  7329. headerCloseBtnElement,
  7330. "click",
  7331. void 0,
  7332. (event) => {
  7333. PopsUtils.configRemove([that.config.layer.iframe], guid, false);
  7334. setTimeout(() => {
  7335. // @ts-ignore
  7336. let allIsMinElementList = [];
  7337. pops.config.layer.iframe.forEach((item) => {
  7338. if (
  7339. item.animElement != animElement &&
  7340. // @ts-ignore
  7341. popsElement.getAttribute("type-module") === "min"
  7342. ) {
  7343. allIsMinElementList.push(item.popsElement);
  7344. }
  7345. });
  7346. // @ts-ignore
  7347. allIsMinElementList.sort(
  7348. PopsUtils.sortElementListByProperty(
  7349. (obj) => {
  7350. return parseInt(getComputedStyle(obj).left);
  7351. },
  7352. (obj) => {
  7353. return parseInt(getComputedStyle(obj).left);
  7354. },
  7355. false
  7356. )
  7357. );
  7358. // @ts-ignore
  7359. allIsMinElementList.forEach((item, index) => {
  7360. item.style.left = index * 205 + "px";
  7361. });
  7362. }, 1000 * 0.3);
  7363. // @ts-ignore
  7364. config.btn.close.callback(event);
  7365. },
  7366. {
  7367. capture: true,
  7368. }
  7369. );
  7370.  
  7371. PopsHandler.handlePush(PopsType, {
  7372. guid: guid,
  7373. animElement: animElement,
  7374. // @ts-ignore
  7375. popsElement: popsElement,
  7376. // @ts-ignore
  7377. maskElement: maskElement,
  7378. $shadowContainer: $shadowContainer,
  7379. $shadowRoot: $shadowRoot,
  7380. });
  7381.  
  7382. let result = PopsHandler.handleResultDetails(eventDetails);
  7383. return result;
  7384. };
  7385.  
  7386. /**
  7387. * 提示框
  7388. * @param {PopsToolTipDetails} details
  7389. */
  7390. pops.tooltip = function (details) {
  7391. // @ts-ignore
  7392. // @ts-ignore
  7393. let that = this;
  7394. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  7395. PopsHandler.handleInit($shadowRoot, [
  7396. pops.config.cssText.index,
  7397. pops.config.cssText.anim,
  7398. pops.config.cssText.common,
  7399. pops.config.cssText.tooltipCSS,
  7400. ]);
  7401. /**
  7402. * @type {Required<PopsToolTipDetails>}
  7403. */
  7404. let config = {
  7405. // @ts-ignore
  7406. target: null,
  7407. content: "默认文字",
  7408. // @ts-ignore
  7409. position: "top",
  7410. className: "",
  7411. alwaysShow: false,
  7412. triggerShowEventName: "mouseenter touchstart",
  7413. triggerCloseEventName: "mouseleave touchend",
  7414. zIndex: 10000,
  7415. only: false,
  7416. eventOption: {
  7417. passive: false,
  7418. capture: true,
  7419. once: false,
  7420. },
  7421. showBeforeCallBack() {},
  7422. showAfterCallBack() {},
  7423. closeBeforeCallBack() {},
  7424. closeAfterCallBack() {},
  7425. arrowDistance: 12.5,
  7426. otherDistance: 0,
  7427. // @ts-ignore
  7428. style: void 0,
  7429. beforeAppendToPageCallBack() {},
  7430. };
  7431. config = PopsUtils.assignJSON(config, details);
  7432. if (!(config.target instanceof HTMLElement)) {
  7433. throw "config.target 必须是HTMLElement类型";
  7434. }
  7435. let guid = PopsUtils.getRandomGUID();
  7436. const PopsType = "tooltip";
  7437. // @ts-ignore
  7438. config = PopsHandler.handleOnly(PopsType, config);
  7439. function getContent() {
  7440. return typeof config.content === "function"
  7441. ? // @ts-ignore
  7442. config.content()
  7443. : config.content;
  7444. }
  7445. /**
  7446. * 获取悬浮提示的元素信息
  7447. */
  7448. function getToolTipElementInfo() {
  7449. let _toolTipHTML_ = `<div class="pops-tip"></div>`;
  7450. let _toolTipElement_ = PopsUtils.parseTextToDOM(_toolTipHTML_);
  7451. if (
  7452. typeof config.className === "string" &&
  7453. config.className.trim() !== ""
  7454. ) {
  7455. PopsDOMUtils.addClassName(_toolTipElement_, config.className);
  7456. }
  7457. _toolTipElement_.setAttribute("data-guid", guid);
  7458. // @ts-ignore
  7459. _toolTipElement_.style.zIndex = config.zIndex;
  7460. _toolTipElement_.innerHTML = `
  7461. <div style="text-align: center;">${getContent()}</div>
  7462. `;
  7463. /* 箭头元素 */
  7464. let _toolTipArrowHTML_ = '<div class="pops-tip-arrow"></div>';
  7465. let _toolTipArrowNode_ = PopsUtils.parseTextToDOM(_toolTipArrowHTML_);
  7466. _toolTipElement_.appendChild(_toolTipArrowNode_);
  7467. if (config.style != null) {
  7468. /* 添加自定义style */
  7469. let cssNode = document.createElement("style");
  7470. cssNode.setAttribute("type", "text/css");
  7471. cssNode.innerHTML = config.style;
  7472. _toolTipElement_.appendChild(cssNode);
  7473. }
  7474. return {
  7475. toolTipElement: _toolTipElement_,
  7476. toolTipArrowElement: _toolTipArrowNode_,
  7477. toolTipHTML: _toolTipHTML_,
  7478. toolTipArrowHTML: _toolTipArrowHTML_,
  7479. };
  7480. }
  7481. // @ts-ignore
  7482. config.position = config.position.toLowerCase();
  7483. let { toolTipElement } = getToolTipElementInfo();
  7484.  
  7485. /**
  7486. * 设置 提示框的位置
  7487. * @param {object} positionDetails
  7488. */
  7489. function setToolTipPosition(positionDetails) {
  7490. // @ts-ignore
  7491. let positionDetail = positionDetails[config.position.toUpperCase()];
  7492. if (positionDetail) {
  7493. toolTipElement.style.left = positionDetail.left + "px";
  7494. toolTipElement.style.top = positionDetail.top + "px";
  7495. toolTipElement.setAttribute("data-motion", positionDetail.motion);
  7496. // @ts-ignore
  7497. toolTipElement
  7498. .querySelector(".pops-tip-arrow")
  7499. .setAttribute("data-position", positionDetail.arrow);
  7500. } else {
  7501. console.error("不存在该位置", config.position);
  7502. }
  7503. }
  7504.  
  7505. /**
  7506. * 获取 提示框的位置
  7507. * @param {HTMLElement} targetElement 目标元素
  7508. * @param {number} arrowDistance 箭头和目标元素的距离
  7509. * @param {number} otherDistance 其它位置的偏移
  7510. */
  7511. function getToolTipPosition(targetElement, arrowDistance, otherDistance) {
  7512. let targetElement_width = PopsDOMUtils.offset(targetElement).width;
  7513. let targetElement_height = PopsDOMUtils.offset(targetElement).height;
  7514. let targetElement_top = PopsDOMUtils.offset(targetElement).top;
  7515. // @ts-ignore
  7516. // @ts-ignore
  7517. let targetElement_bottom = PopsDOMUtils.offset(targetElement).bottom;
  7518. let targetElement_left = PopsDOMUtils.offset(targetElement).left;
  7519. // @ts-ignore
  7520. // @ts-ignore
  7521. let targetElement_right = PopsDOMUtils.offset(targetElement).right;
  7522.  
  7523. let toolTipElement_width = PopsDOMUtils.outerWidth(toolTipElement);
  7524. let toolTipElement_height = PopsDOMUtils.outerHeight(toolTipElement);
  7525. /* 目标元素的x轴的中间位置 */
  7526. let targetElement_X_center_pos =
  7527. targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
  7528. /* 目标元素的Y轴的中间位置 */
  7529. let targetElement_Y_center_pos =
  7530. targetElement_top +
  7531. targetElement_height / 2 -
  7532. toolTipElement_height / 2;
  7533. return {
  7534. TOP: {
  7535. left: targetElement_X_center_pos - otherDistance,
  7536. top: targetElement_top - toolTipElement_height - arrowDistance,
  7537. arrow: "bottom",
  7538. motion: "fadeInTop",
  7539. },
  7540. RIGHT: {
  7541. left: targetElement_left + targetElement_width + arrowDistance,
  7542. top: targetElement_Y_center_pos + otherDistance,
  7543. arrow: "left",
  7544. motion: "fadeInRight",
  7545. },
  7546. BOTTOM: {
  7547. left: targetElement_X_center_pos - otherDistance,
  7548. top: targetElement_top + targetElement_height + arrowDistance,
  7549. arrow: "top",
  7550. motion: "fadeInBottom",
  7551. },
  7552. LEFT: {
  7553. left: targetElement_left - toolTipElement_width - arrowDistance,
  7554. top: targetElement_Y_center_pos + otherDistance,
  7555. arrow: "right",
  7556. motion: "fadeInLeft",
  7557. },
  7558. };
  7559. }
  7560. /**
  7561. * 显示提示框
  7562. */
  7563. function showToolTipNode() {
  7564. if (typeof config.showBeforeCallBack === "function") {
  7565. let result = config.showBeforeCallBack();
  7566. if (typeof result === "boolean" && !result) {
  7567. return;
  7568. }
  7569. }
  7570. // @ts-ignore
  7571. if (!PopsUtils.contains($shadowRoot, toolTipElement)) {
  7572. // @ts-ignore
  7573. PopsUtils.appendChild($shadowRoot, toolTipElement);
  7574. }
  7575. // @ts-ignore
  7576. if (!PopsUtils.contains($shadowContainer)) {
  7577. if (typeof config.beforeAppendToPageCallBack === "function") {
  7578. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  7579. }
  7580. // @ts-ignore
  7581. PopsUtils.appendChild($shadowContainer);
  7582. }
  7583. setToolTipPosition(
  7584. getToolTipPosition(
  7585. config.target,
  7586. config.arrowDistance,
  7587. config.otherDistance
  7588. )
  7589. );
  7590. if (typeof config.showAfterCallBack === "function") {
  7591. config.showAfterCallBack(toolTipElement);
  7592. }
  7593. }
  7594. /**
  7595. * 关闭提示框
  7596. */
  7597. function closeToolTipNode() {
  7598. if (typeof config.closeBeforeCallBack === "function") {
  7599. let result = config.closeBeforeCallBack(toolTipElement);
  7600. if (typeof result === "boolean" && !result) {
  7601. return;
  7602. }
  7603. }
  7604. toolTipElement.setAttribute(
  7605. "data-motion",
  7606. // @ts-ignore
  7607. toolTipElement.getAttribute("data-motion").replace("fadeIn", "fadeOut")
  7608. );
  7609. if (typeof config.closeAfterCallBack === "function") {
  7610. config.closeAfterCallBack(toolTipElement);
  7611. }
  7612. }
  7613. /**
  7614. * 绑定 显示事件
  7615. */
  7616. function onShowEvent() {
  7617. PopsDOMUtils.on(
  7618. config.target,
  7619. // @ts-ignore
  7620. config.triggerShowEventName,
  7621. null,
  7622. showToolTipNode,
  7623. config.eventOption
  7624. );
  7625. }
  7626. /**
  7627. * 绑定 关闭事件
  7628. */
  7629. function onCloseEvent() {
  7630. PopsDOMUtils.on(
  7631. config.target,
  7632. // @ts-ignore
  7633. config.triggerCloseEventName,
  7634. null,
  7635. closeToolTipNode,
  7636. config.eventOption
  7637. );
  7638. }
  7639. /**
  7640. * 取消绑定 显示事件
  7641. */
  7642. function offShowEvent() {
  7643. PopsDOMUtils.off(
  7644. config.target,
  7645. // @ts-ignore
  7646. null,
  7647. config.triggerShowEventName,
  7648. showToolTipNode,
  7649. {
  7650. capture: true,
  7651. }
  7652. );
  7653. }
  7654. /**
  7655. * 取消绑定 关闭事件
  7656. */
  7657. function offCloseEvent() {
  7658. PopsDOMUtils.off(
  7659. config.target,
  7660. // @ts-ignore
  7661. null,
  7662. config.triggerCloseEventName,
  7663. closeToolTipNode,
  7664. {
  7665. capture: true,
  7666. }
  7667. );
  7668. }
  7669.  
  7670. /**
  7671. * 即使存在动画属性,但是当前设置的动画Out结束后移除元素
  7672. */
  7673. function endEvent() {
  7674. // @ts-ignore
  7675. if (toolTipElement.getAttribute("data-motion").includes("In")) {
  7676. return;
  7677. }
  7678. toolTipElement.remove();
  7679. }
  7680. if (config.alwaysShow) {
  7681. /* 总是显示 */
  7682. showToolTipNode();
  7683. return {
  7684. guid: guid,
  7685. config: config,
  7686. toolTipNode: toolTipElement,
  7687. show: showToolTipNode,
  7688. close() {
  7689. PopsDOMUtils.on(
  7690. toolTipElement,
  7691. // @ts-ignore
  7692. PopsDOMUtils.getAnimationEndNameList(),
  7693. null,
  7694. endEvent,
  7695. config.eventOption
  7696. );
  7697. closeToolTipNode();
  7698. },
  7699. off: null,
  7700. on: null,
  7701. };
  7702. } else {
  7703. /* 事件触发才显示 */
  7704.  
  7705. /**
  7706. * 进入动画
  7707. */
  7708. PopsDOMUtils.on(
  7709. toolTipElement,
  7710. // @ts-ignore
  7711. "mouseenter touchstart",
  7712. void 0,
  7713. function () {
  7714. // @ts-ignore
  7715. if (parseInt(getComputedStyle(this)) > 0.5) {
  7716. // @ts-ignore
  7717. this.style.animationPlayState = "paused";
  7718. }
  7719. },
  7720. config.eventOption
  7721. );
  7722. /**
  7723. * 退出动画
  7724. */
  7725. PopsDOMUtils.on(
  7726. toolTipElement,
  7727. // @ts-ignore
  7728. "mouseleave touchend",
  7729. void 0,
  7730. function () {
  7731. // @ts-ignore
  7732. this.style.animationPlayState = "running";
  7733. },
  7734. config.eventOption
  7735. );
  7736. PopsDOMUtils.on(
  7737. toolTipElement,
  7738. // @ts-ignore
  7739. PopsDOMUtils.getAnimationEndNameList(),
  7740. null,
  7741. endEvent,
  7742. config.eventOption
  7743. );
  7744.  
  7745. onShowEvent();
  7746. onCloseEvent();
  7747. return {
  7748. guid: guid,
  7749. $shadowContainer: $shadowContainer,
  7750. $shadowRoot: $shadowRoot,
  7751. config: config,
  7752. toolTipNode: toolTipElement,
  7753. show: showToolTipNode,
  7754. close: closeToolTipNode,
  7755. off() {
  7756. offShowEvent();
  7757. offCloseEvent();
  7758. },
  7759. on() {
  7760. onShowEvent();
  7761. onCloseEvent();
  7762. },
  7763. };
  7764. }
  7765. };
  7766.  
  7767. /**
  7768. * 抽屉
  7769. * @param {PopsDrawerDetails} details
  7770. */
  7771. pops.drawer = function (details) {
  7772. // @ts-ignore
  7773. // @ts-ignore
  7774. let that = this;
  7775. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  7776. PopsHandler.handleInit($shadowRoot, [
  7777. pops.config.cssText.index,
  7778. pops.config.cssText.ninePalaceGridPosition,
  7779. pops.config.cssText.scrollbar,
  7780. pops.config.cssText.button,
  7781. pops.config.cssText.anim,
  7782. pops.config.cssText.common,
  7783. pops.config.cssText.drawerCSS,
  7784. ]);
  7785. /**
  7786. * @type {Required<PopsDrawerDetails>}
  7787. */
  7788. let config = {
  7789. title: {
  7790. enable: true,
  7791. // @ts-ignore
  7792. position: "center",
  7793. text: "默认标题",
  7794. html: false,
  7795. style: "height: 60px;line-height: 60px;",
  7796. },
  7797. content: {
  7798. text: "默认内容",
  7799. html: false,
  7800. style: "overflow: auto;padding: 0px 10px;",
  7801. },
  7802. btn: {
  7803. position: "flex-end",
  7804. ok: {
  7805. enable: true,
  7806. // @ts-ignore
  7807. size: "",
  7808. // @ts-ignore
  7809. icon: "",
  7810. rightIcon: false,
  7811. iconIsLoading: false,
  7812. text: "确定",
  7813. type: "primary",
  7814. callback(event) {
  7815. event.close();
  7816. },
  7817. },
  7818. cancel: {
  7819. enable: true,
  7820. // @ts-ignore
  7821. size: "",
  7822. // @ts-ignore
  7823. icon: "",
  7824. rightIcon: false,
  7825. iconIsLoading: false,
  7826. text: "关闭",
  7827. type: "default",
  7828. callback(event) {
  7829. event.close();
  7830. },
  7831. },
  7832. other: {
  7833. enable: false,
  7834. // @ts-ignore
  7835. size: "",
  7836. // @ts-ignore
  7837. icon: "",
  7838. rightIcon: false,
  7839. iconIsLoading: false,
  7840. text: "其它按钮",
  7841. type: "default",
  7842. callback(event) {
  7843. event.close();
  7844. },
  7845. },
  7846. close: {
  7847. enable: true,
  7848. callback(event) {
  7849. event.close();
  7850. },
  7851. },
  7852. },
  7853. mask: {
  7854. enable: true,
  7855. clickEvent: {
  7856. toClose: true,
  7857. toHide: false,
  7858. },
  7859. // @ts-ignore
  7860. clickCallBack: null,
  7861. },
  7862. class: "",
  7863. zIndex: 10000,
  7864. only: false,
  7865. direction: "right",
  7866. size: "30%",
  7867. lockScroll: false,
  7868. closeOnPressEscape: true,
  7869. openDelay: 0,
  7870. closeDelay: 0,
  7871. borderRadius: 0,
  7872. // @ts-ignore
  7873. style: void 0,
  7874. beforeAppendToPageCallBack() {},
  7875. };
  7876. config = PopsUtils.assignJSON(config, details);
  7877. let guid = PopsUtils.getRandomGUID();
  7878. const PopsType = "drawer";
  7879. // @ts-ignore
  7880. config = PopsHandler.handleOnly(PopsType, config);
  7881. // @ts-ignore
  7882. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  7883. // @ts-ignore
  7884. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  7885. let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
  7886. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  7887. PopsType,
  7888. config
  7889. );
  7890. let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(
  7891. PopsType,
  7892. config
  7893. );
  7894. let animHTML = PopsElementHandler.getAnimHTML(
  7895. guid,
  7896. PopsType,
  7897. config,
  7898. `
  7899. ${
  7900. config.title.enable
  7901. ? `
  7902. <div class="pops-${PopsType}-title" style="${headerStyle}">
  7903. ${
  7904. // @ts-ignore
  7905. config.title.html
  7906. ? // @ts-ignore
  7907. config.title.text
  7908. : `<p
  7909. pops
  7910. style="
  7911. width: 100%;
  7912. text-align: ${
  7913. // @ts-ignore
  7914. config.title.position
  7915. };
  7916. ${headerPStyle}">${
  7917. // @ts-ignore
  7918. config.title.text
  7919. }</p>`
  7920. }
  7921. ${headerBtnHTML}
  7922. </div>
  7923. `
  7924. : ""
  7925. }
  7926. <div class="pops-${PopsType}-content" style="${contentStyle}">
  7927. ${
  7928. config.content.html
  7929. ? config.content.text
  7930. : `<p pops style="${contentPStyle}">${config.content.text}</p>`
  7931. }
  7932. </div>
  7933.  
  7934. ${bottomBtnHTML}
  7935. `,
  7936. bottomBtnHTML
  7937. );
  7938. /**
  7939. * 弹窗的主元素,包括动画层
  7940. */
  7941. let animElement = PopsElementHandler.parseElement(animHTML);
  7942. let {
  7943. popsElement,
  7944. headerCloseBtnElement,
  7945. btnCancelElement,
  7946. btnOkElement,
  7947. btnOtherElement,
  7948. // @ts-ignore
  7949. } = PopsHandler.handleQueryElement(animElement, PopsType);
  7950. /**
  7951. * 遮罩层元素
  7952. * @type {?HTMLDivElement}
  7953. */
  7954. let maskElement = null;
  7955. /**
  7956. * 已创建的元素列表
  7957. * @type {HTMLElement[]}
  7958. */
  7959. let elementList = [animElement];
  7960. // @ts-ignore
  7961. if (config.mask.enable) {
  7962. let _handleMask_ = PopsHandler.handleMask({
  7963. type: PopsType,
  7964. guid: guid,
  7965. // @ts-ignore
  7966. config: config,
  7967. animElement: animElement,
  7968. maskHTML: maskHTML,
  7969. });
  7970. maskElement = _handleMask_.maskElement;
  7971. elementList.push(maskElement);
  7972. }
  7973. let eventDetails = PopsHandler.handleEventDetails(
  7974. guid,
  7975. $shadowContainer,
  7976. $shadowRoot,
  7977. PopsType,
  7978. // @ts-ignore
  7979. animElement,
  7980. popsElement,
  7981. maskElement,
  7982. config
  7983. );
  7984. /* 处理方向 */
  7985. // @ts-ignore
  7986. popsElement.setAttribute("direction", config.direction);
  7987.  
  7988. /* 处理border-radius */
  7989. /* 处理动画前的宽高 */
  7990. if (config.direction === "top") {
  7991. // @ts-ignore
  7992. popsElement.style.setProperty("height", 0);
  7993. // @ts-ignore
  7994. popsElement.style.setProperty(
  7995. "border-radius",
  7996. `0px 0px ${config.borderRadius}px ${config.borderRadius}px`
  7997. );
  7998. } else if (config.direction === "bottom") {
  7999. // @ts-ignore
  8000. popsElement.style.setProperty("height", 0);
  8001. // @ts-ignore
  8002. popsElement.style.setProperty(
  8003. "border-radius",
  8004. `${config.borderRadius}px ${config.borderRadius}px 0px 0px`
  8005. );
  8006. } else if (config.direction === "left") {
  8007. // @ts-ignore
  8008. popsElement.style.setProperty("width", 0);
  8009. // @ts-ignore
  8010. popsElement.style.setProperty(
  8011. "border-radius",
  8012. `0px ${config.borderRadius}px 0px ${config.borderRadius}px`
  8013. );
  8014. } else if (config.direction === "right") {
  8015. // @ts-ignore
  8016. popsElement.style.setProperty("width", 0);
  8017. // @ts-ignore
  8018. popsElement.style.setProperty(
  8019. "border-radius",
  8020. `${config.borderRadius}px 0px ${config.borderRadius}px 0px`
  8021. );
  8022. }
  8023.  
  8024. /* 按下Esc键触发关闭 */
  8025. if (config.closeOnPressEscape) {
  8026. PopsHandler.handleKeyboardEvent("Escape", [], function () {
  8027. eventDetails.close();
  8028. });
  8029. }
  8030. /* 待处理的点击事件列表 */
  8031. let needHandleClickEventList = [
  8032. { close: headerCloseBtnElement },
  8033. { cancel: btnCancelElement },
  8034. { ok: btnOkElement },
  8035. { other: btnOtherElement },
  8036. ];
  8037. needHandleClickEventList.forEach((item) => {
  8038. let btnName = Object.keys(item)[0];
  8039. PopsHandler.handleClickEvent(
  8040. // @ts-ignore
  8041. item[btnName],
  8042. // @ts-ignore
  8043. btnName,
  8044. eventDetails,
  8045. function (_eventDetails_) {
  8046. // @ts-ignore
  8047. if (typeof config.btn[btnName].callback === "function") {
  8048. // @ts-ignore
  8049. config.btn[btnName].callback(_eventDetails_);
  8050. }
  8051. }
  8052. );
  8053. });
  8054.  
  8055. /* 先隐藏,然后根据config.openDelay来显示 */
  8056. elementList.forEach((element) => {
  8057. element.style.setProperty("display", "none");
  8058. if (["top"].includes(config.direction)) {
  8059. // @ts-ignore
  8060. popsElement.style.setProperty("height", config.size);
  8061. // @ts-ignore
  8062. popsElement.style.setProperty("transform", "translateY(-100%)");
  8063. } else if (["bottom"].includes(config.direction)) {
  8064. // @ts-ignore
  8065. popsElement.style.setProperty("height", config.size);
  8066. // @ts-ignore
  8067. popsElement.style.setProperty("transform", "translateY(100%)");
  8068. } else if (["left"].includes(config.direction)) {
  8069. // @ts-ignore
  8070. popsElement.style.setProperty("width", config.size);
  8071. // @ts-ignore
  8072. popsElement.style.setProperty("transform", "translateX(-100%)");
  8073. } else if (["right"].includes(config.direction)) {
  8074. // @ts-ignore
  8075. popsElement.style.setProperty("width", config.size);
  8076. // @ts-ignore
  8077. popsElement.style.setProperty("transform", "translateX(100%)");
  8078. }
  8079. element.style.setProperty("display", "");
  8080. });
  8081. /* 创建到页面中 */
  8082. // @ts-ignore
  8083. PopsUtils.appendChild($shadowRoot, elementList);
  8084. if (typeof config.beforeAppendToPageCallBack === "function") {
  8085. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  8086. }
  8087. // @ts-ignore
  8088. PopsUtils.appendChild($shadowContainer);
  8089. setTimeout(() => {
  8090. setTimeout(() => {
  8091. // @ts-ignore
  8092. popsElement.style.setProperty("transform", "");
  8093. }, config.openDelay);
  8094. }, 50);
  8095.  
  8096. if (maskElement != null) {
  8097. animElement.after(maskElement);
  8098. }
  8099.  
  8100. PopsHandler.handlePush(PopsType, {
  8101. guid: guid,
  8102. // @ts-ignore
  8103. animElement: animElement,
  8104. // @ts-ignore
  8105. popsElement: popsElement,
  8106. // @ts-ignore
  8107. maskElement: maskElement,
  8108. $shadowContainer: $shadowContainer,
  8109. $shadowRoot: $shadowRoot,
  8110. });
  8111. return PopsHandler.handleResultDetails(eventDetails);
  8112. };
  8113.  
  8114. /**
  8115. * 文件夹
  8116. * @param {PopsFolderDetails} details
  8117. */
  8118. pops.folder = function (details) {
  8119. // @ts-ignore
  8120. // @ts-ignore
  8121. let that = this;
  8122. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  8123. PopsHandler.handleInit($shadowRoot, [
  8124. pops.config.cssText.index,
  8125. pops.config.cssText.ninePalaceGridPosition,
  8126. pops.config.cssText.scrollbar,
  8127. pops.config.cssText.button,
  8128. pops.config.cssText.anim,
  8129. pops.config.cssText.common,
  8130. pops.config.cssText.folderCSS,
  8131. ]);
  8132. /**
  8133. * @type {Required<PopsFolderDetails>}
  8134. */
  8135. let config = {
  8136. title: {
  8137. text: "pops.Folder",
  8138. position: "center",
  8139. html: false,
  8140. style: "",
  8141. },
  8142. sort: {
  8143. name: "latestTime",
  8144. isDesc: false,
  8145. // @ts-ignore
  8146. callback() {},
  8147. },
  8148. folder: [
  8149. {
  8150. fileName: "测试文件夹",
  8151. fileSize: 0,
  8152. fileType: "",
  8153. createTime: 0,
  8154. latestTime: 0,
  8155. isFolder: true,
  8156. index: 0,
  8157. // @ts-ignore
  8158. clickEvent() {
  8159. return [
  8160. {
  8161. fileName: "内部-测试文件.zip",
  8162. fileSize: 1025000,
  8163. fileType: "zip",
  8164. createTime: 1702038410440,
  8165. latestTime: 1702039602126,
  8166. isFolder: false,
  8167. index: 1,
  8168. clickEvent() {
  8169. console.log("下载文件:", this.fileName);
  8170. return "https://update.gf.qytechs.cn/scripts/456485/pops.js";
  8171. },
  8172. },
  8173. ];
  8174. },
  8175. },
  8176. {
  8177. fileName: "测试文件.apk",
  8178. fileSize: 30125682,
  8179. fileType: "apk",
  8180. createTime: 1702036410440,
  8181. latestTime: 1702039410440,
  8182. isFolder: false,
  8183. index: 1,
  8184. // @ts-ignore
  8185. clickEvent() {
  8186. console.log("下载文件:", this.fileName);
  8187. return "https://update.gf.qytechs.cn/scripts/456485/pops.js";
  8188. },
  8189. },
  8190. ],
  8191. btn: {
  8192. merge: false,
  8193. mergeReverse: false,
  8194. reverse: false,
  8195. position: "flex-end",
  8196. ok: {
  8197. enable: true,
  8198. // @ts-ignore
  8199. size: "",
  8200. // @ts-ignore
  8201. icon: "",
  8202. rightIcon: false,
  8203. iconIsLoading: false,
  8204. text: "确定",
  8205. type: "primary",
  8206. callback(event) {
  8207. event.close();
  8208. },
  8209. },
  8210. cancel: {
  8211. enable: true,
  8212. // @ts-ignore
  8213. size: "",
  8214. // @ts-ignore
  8215. icon: "",
  8216. rightIcon: false,
  8217. iconIsLoading: false,
  8218. text: "关闭",
  8219. type: "default",
  8220. callback(event) {
  8221. event.close();
  8222. },
  8223. },
  8224. other: {
  8225. enable: false,
  8226. // @ts-ignore
  8227. size: "",
  8228. // @ts-ignore
  8229. icon: "",
  8230. rightIcon: false,
  8231. iconIsLoading: false,
  8232. text: "其它按钮",
  8233. type: "default",
  8234. callback(event) {
  8235. event.close();
  8236. },
  8237. },
  8238. close: {
  8239. enable: true,
  8240. callback(event) {
  8241. event.close();
  8242. },
  8243. },
  8244. },
  8245. class: "",
  8246. only: false,
  8247. width: "500px",
  8248. height: "400px",
  8249. position: "center",
  8250. animation: "pops-anim-fadein-zoom",
  8251. zIndex: 10000,
  8252. mask: {
  8253. enable: false,
  8254. clickEvent: {
  8255. toClose: false,
  8256. toHide: false,
  8257. },
  8258. // @ts-ignore
  8259. clickCallBack: null,
  8260. },
  8261. drag: false,
  8262. dragLimit: true,
  8263. dragExtraDistance: 3,
  8264. dragMoveCallBack() {},
  8265. dragEndCallBack() {},
  8266. forbiddenScroll: false,
  8267. // @ts-ignore
  8268. style: void 0,
  8269. beforeAppendToPageCallBack() {},
  8270. };
  8271. /**
  8272. * 图标
  8273. */
  8274. const Folder_ICON = {
  8275. folder:
  8276. "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABRUExURUxpcf++Hv/ZU//OPv/DL/+9Gv/BI/+4Bf+4Ef/XcP/LOP/TSf/RRP/WTv/JM/+3Ef+9Ff/bhf+5BP/DJf+yDv/imv/kqv/bXP/w0v/fd//calQXUgwAAAAKdFJOUwB///8d3L9enl8sr20gAAACN0lEQVRYw+2Y65abIBRGE1EzVbyNSW18/wctHA6XYw4q9Ee7Vt2AgOHbcVyTOMztdnFxcXFMWf7gKHN190VRKDpFC0iNqB5ZvqpXzJRxHoF7hrAa9/hK9j2oYIA2QA/UqXeyNg5QDBrshhHbUH8xxO+uT7sOJ/tU5a4wh0eK8KmKHTxd28Bfo16pqphep5l6I+R/p8xr668kVghVceH8M5EZYnGhnBKRceGqmaZXPPw2xbO+1xU+8axwe8NfzkIV7xVZdF0AVhi+rWdxIfgmwloE6CkrDCPwJbYUeFgK61icxFcNKyxIxE+WgnllQ0y4+HffzZ8WZtJlCDtz+CzqaaFaVGiWBNEOZZ15zihsT2CFnXk4QStsLohTU3FC+Af8I8JWV1fa1jy8u+hnOUy2vnd5SkeGrJBfHZwDbxe87pfxQvejmMZZYxxdYSoyVyixSvtXFLJ7hWq5xCRNSTozczzHCj8T54kI5d8QCtvZAodDIa7DgRkJaII2hBfaJC7EOE7D076XuIoVBu8oN3kpBLVt4YXBVaUSFSbS5Akb00znSoPn9KCJCN0am7SnGhganC4kKhR2MV0vvEn4M7bFhM3GIZqtgfiPr9BdSAYnrnCX3rQeB/2xsKcHouiBBhpO+phQL9CdjmKqsRkXpkMz57dmfTY1v3k8is26zvN2A6yIbKVqm/tMjFBMp5jpxrWKbsB1dJw/AsC3Lt/YEaK7x1t5r7aLj3ned/fRj1TK3H9wXFxc/F/8BgM0jBZ4nc19AAAAAElFTkSuQmCC",
  8277. zip: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAFQUExURUxpcYHaOWDM+pryU4TbPXLU/XHT/X3Y/nrZpIffP/+gI4La/+9QTvhycXjQL4fbQvBUUoXaQHrSMf+cJPl2dfBXVf+KMDu99IveRv+ZJf+NLv+PLIncRPdvbV7L+VnJ+P/u5HDS/P+DD1PG93fV/U3D9kTB9WfP+2vR/GLN+nvSM86bL33UNf/69f/+/XzTNP+vVf/iyf/06sOCRsGhYP2Jh/t8e4TVPX3QNat7jnzCMfxfXXrUMP/UqJPoTX/cM/aDLOVjKP/jw/9yC/98HP+GLP/Ec2C63f+iQ4TjNvOiasmpZLuTpfaQgfjEu4HGOPKGeHDC4s2YXU+02/Ozn/B0J+1oYHvSNGnM9P/r291KSNGeZIHGObeOn5zzVM6PHkS978mNUt+EO/GadPOgbZzyVJvyVNG6g66AksCer4LGOc7Mp/eWh/SZVu6adP6VKOSF/TkAAAAKdFJOUwDf39+Af5/9MKAONWYwAAADB0lEQVRYw+3Y+U/TYBjAcUDYIahlA3bCimM3Y64MERWdeExFOhDoxkTnDuTm///R9+jx9MjbtcT4S78sIVnCh+c9mjDGxry8vLz+TwGffxp2/Ql0vYJbJuXzE76AvTc1rc9//gx0vqxg+XwON+XY8+8+BO22NayQKxQKSzZiwMj5D/TgQZtORjASe9U+QKHQfplAilEuhfIxQT/g6P4bwEZbGS1FS08wQR1GzpOCYfSFX7XGEtDSJPaEQCPH2cagwmEwpdfSmQwbXIEaOlAMhsNkRvQ9jEANy9CYoA7Dt6PdqIVBtUY6rdOy2SwbVLEcvR5G8DCjWkSzA3VPAbkcJlCHZbORCBPUY+h+pKzArKZF7MAcvLf4PDUwRsDfikU1O9DwFKDzPKzFYjGMkW8yGIExQbpO9SlAB0BANQxGDDFBdbS0ctdMYMQReHn5Te0n6aIPwf7WBWoLdsEEN57PoR6RFnGSVIdgfV6J47gZHPdqVBBzG6IobutCb+w5B+dkcE5Ys0iQZJBzPOENAsvG1oQ910u+EcplvroDqvLlsrDveEJlyXvox8Xbz6BbEf2KfdcTIlA4On4KOj4SNJBzAQpmUHAxobrkE4E3gyf7YECHE1qAPAWd7+EiAXleHMI/RYYiz5/c41AQaO4+YNXKq7oHpe2dqqmd7XnXhyJJg8Hd8CtoeDcYSDPuwflOp/NOF3qjwzm42Oc/SN/ler3eer8O6q+b6jHBszfRaDSZTD7BzaI2m6UEqPTyxWqrUiwWQ6HQY9zrt1+Y4B8ZTDLASoV4o4G/EJiMat7s5un9QDKhDBLSPGGl4mTJeA+T8pLphFeleCIeTyTwK04mJJvofg9PS3GQMqGjPdSfsjVYdA82jSA6lJa7CWdNEy6QCVedLPnMYg8XQHTJFecTwottAJ3dwwcWSzaBrRY8lHEmGJQvtjbhlQWomzDI/vAIn5TRlmzzkXnSvIcfQWZw0u4D86Rhyc3uB1CXgOCUbT206uA4PJRm9z2oKz/LFBwPjvAvAi8vL69/0l8fxm2XCv5p+gAAAABJRU5ErkJggg==",
  8278. mp4: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABXUExURUxpcZKU/5eZ/4SG/5CS/5eb/6Sm/4WG/5uc/6eq/4uM/4iJ/6Ci/5ye/6eo/6Ol/46P/5mb/5eY/5GS//39/5SV//X1/6Ol/+3u/+Li/3Z498/Q/7u8/zCK/WcAAAAKdFJOUwB7Pf+fHN2gn59fp7PNAAACSElEQVRYw+3Ya3OjIBQG4FqamnDzTkT9/79zOQdUzG0PJjP7YX2DeAR5EtKZTu3X15EjR46Q851dnuY7nTtd9Kv8nlK9X60/Kl60/qh4wjUFNjx8XSznIlHMClgICadC+2PWYShFvFwpSRAvBSl0MYDyVpB7xfOyLXmVrl2h99cQPw49VTzLV7lGNVF8DW5CExNAeSaCSsHdyi9SUPi2Ds2h/KY4K+epbZANpYoKmRHBGy6qbt7qnAzKaZzU86SDtje91Z8Ddd+2renHIh6sEsFKVS64stKmhRg7rRi2yrM0MEoAW2Osrh4kFaxnEPd9/SiI+94N1jW0qu5icN13Xfl7iCBqPlsQ9y3nObyJCNYr2G9Bt28VzRPBroYWQGNMiy+Dlel116WBP24BrOlcGgC9NaNWdjjV4T0/NHAJgnF6O/Fo/l2wt6Nm4i2w6OOMExtYmQ42Tdd00BxoV85O9TCI0k26hDckgc2acgXtKIeB8WabvaCFL89xZfMuKG1vgZsa2O2dRwbdUng1vBut48bK7dZ9ezgOrC/diQSWUdg0jrhb4a3bJIOCVYrDD6N8HCLol0PP2QC7fexxTgN5yctF4Mxz8wE953gDdHQwSiDQmK9Lr3IamJCcAObPl4u9oBAL4EohRESGC+FrGoiOX+E/lYD4y3kg0CRQJOSfggwbFksZZhg2GKOAGQscrFrE+RrachaC8hfsN7uLCJ24myE9BuQb52HmGcqO3fPtc2jXB3RiTuNy+hPpKcv/mmzHfzOOHDny/+YPi6+BG+WQsHsAAAAASUVORK5CYII=",
  8279. apk: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABXUExURUxpcXnGVmm8P2q8QHzIV4bNYXXDTWu8P3nFUYfNY26/RIPLXoDJWobNYXHASH3HVnXDTXnFUfT/7onPZej/2/v/+Ov+4cDypVmtLqvjjt38y57afsvyti89dh4AAAAKdFJOUwAQ3/8n3Xugn58KiJgCAAACeElEQVRYw+2Y2ZajIBBAuxuTtIhsKgTx/79zisUlaZ0pPPM048WwBa6FkpyYj4+Li4sLNNW9PqQq133W3e+4lSqr24GpPWms08S23ZhCmnvatsxYtZE4/a229BQZ78nxk27TXWKsWwwFRhA2ITXz3FBp1maxsc6OLF1Usb6cocBYNynAnKcs55tm22CNdYPl9vmXhUhj3bA8PpaMLdUNqc1qZIQggRRUi42lPIvmEzDMZazZBiHYOy9dd4TwezPXj1Pzqgxd7dpVlwnVNAzjS0SiM4N2a893mVC6MF2BsvO+64QQzTgMfadKhSIdQvFJD9p3duyNMf3khB0G44gSLCWcUKxwBhEZM2S0Af/E5TqgVKiI18MrRnKV3mRnhNy/+QbdbQIsF3oTFmr0vGJY8sjUGaGCBEcPht65UIDK2+C3UuUhaKFKSUmngen5tCE07Z+kh7bxMp9RKZRQLYg+CgmZQqk94SaUli8jyoTSx/lmsrHUvR1TqU4KuY3zddKtFVjzOSEd9S7G8UJhDEBKAp+4Hg7Itpg+C6WSKKEMgE8Se4CnaYAsEAbo8wDC5yGFQndAd1II13AfR08JOYlfg3BTTCzD3UktRwqFHJLk/DjCcBE5Wgi6BLH7xtHHuxKG4IRACJKTdhr3sISmM0r+QAgffIaS1u3uwlnIC4WckP1tuPhKhRDjHquvdMlrSdcmncvQgRLCDEpTtr6SNjX5klGkEM+/IyTxmF/bKlkLghbGrZE2SPLFFs1dZLuXMMJ71m1m0vkMdOmI71KC+QVbkQJQjyoPvA+zYnig/8L6vpDPUhUyxgfuSSr9ifH4I/cT/2ZcXFz8v/wC1sx9JR+88xQAAAAASUVORK5CYII=",
  8280. gif: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcf+ubP+eUP+iWP+xcP+nX/+lXf+SO/uPSv+dUP6kX/+XRP+VQP+SO/+jWf+oYf+hVf///f+mXf+tav+ubf+rZ/+eUP+wcP+pZP/s3P+aSf/z6P/48v/UsvqFOf+6hP/jzf/Hmv/cwS4F5mYAAAALdFJOUwDdez2foByg/p/2onNSOQAAAh5JREFUWMPtmNuSoyAQQGeMUaZUxBveRfP/H7lc1VRJptF92Kr1INqtcKqNSSrk6+vm5uYGzMPzrTzcdYFff+I7cPV91/VfNZr6ykNb6WwMypW6tOBk9EoALka/KMtCTCr05OKi0S9AwI02YXXW+KwqMVluMqw4SimjtUGNzwoK0HgobC4Yn42iat6DanfKnPZdhCAersK0KcfXWOtYbPtrTeNBhGnapCt1n2VZX6cWnjDhjjETjNeFudrhWQpfeS7PqJ5vI0DCXJLKPVmkcMH5MQ5CBaGvIRtehIhkGVp2VmgqwgixhSEkciYeDz4jxDkWyD1F0zQhKrJZ3zzG+jKPQMLNJiAd6ogImHw1+1UngQh/8DHqefMS9/ycFhJVIC+ROAvJnrodRn7ARBfIS+TJirOwEp88JsTGx0skF4Tyfd3nZCtQ+c8KG3OXW4FZ1lJHIeUQ1dVXQzY0vMDBbLJEKjsFCxX1oOmHPe02wlHYDsewk0LWW5jPCfPZJuyZm7BTbWmtzHoMTNgpcPuBUg+CCSkfSTv2wTdXskKoUFGMdhhyqlASTcjOlLgLu3iyk0QOwjDqePsFfgeiA4VqykefCUK40KZ457wwuiaMBZFokc7EQTUTiigGCWMH/m1hAhR624TETFSh7Em8Np5DfsE+EgdAy4BQD473M9+SNYPcMV/fImh9CLiWCkKYL4SvSAMv/BXvxL8ZNzc3/y9/ADVfok94AIhIAAAAAElFTkSuQmCC",
  8281. txt: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABIUExURUxpcTOL+DSL+DqO+Veb/mKl/kmX+zWL+U6a+2ao/0aW+0CS+kyZ/GCk/mWn/1yi/lef/VGc/Pr9/+jz/2+s+46//b3a/4O3/AJIojgAAAAKdFJOUwDf//8d3U+en52O09RGAAACF0lEQVRYw+2Y63ajIBCAW8ZqHC5KrZv3f9MFhpuJTQfrjz1n/SDIbT4npw2pfXu7uLi4YNOP39O367rRvOKja/V9GHOqcTTmVGNnzLlGl6A2WvvWxGsqJo9ajKMuGP0dDcbxSWTShKlGfOOoebCNRTidYxynDXrb1dUU0ziGEF3ZdHHoza14xocMXzJyhLdpmme/e6ag2XeobqYCnBRvs98fm32meId56nnCErk+czfVhlub0CyfOyzaHhTa9XOX9aDQqnU/w7uyjULrcC3i+ocI4iUOVkQ7+8IVeptXWgUgMXD3xjv1UYCyCa6QUAiC0E64fMUBYBTOrUJnROmBryCEMEAsCbYKrSIkCSXS0LYLla8U6K4KSYi+H5ZsWmcJY1ohmpos3OLWmoSF9JajX9m8ckyIRfjIrzM8KERfq5J/yridZwrDx0HF6suOMF24QoXJGijCR/gZboB/TZgDYyd9lqU8mqGPlGQMJR8OfiDjZNjDEQ5S0hlDZ4ushWkqwxSWJCgezOKYIMsw7Ri4wi0g3HfBKuF55bBQTNod1WcKw9kv6yShTQgUQA6A6IsjAEmFJ4RXOF24W+gBcIUxAaiapChi/zolw5rfC+GYUKTqG1G11Vxo2Bn6AJLk8NiPC6JBKOjXLv0ZEruwN2AJe8GCnKzHgEGw4STonm/fub535rNUx8xx4D+RdsPP9Af+m3FxcfH/8hcLt2QJ3T9wuwAAAABJRU5ErkJggg==",
  8282. exe: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAB4UExURUxpcVq2/kOv/0uw/163/1Cz/0+x/zGp/zad+0Ku/165/Tms/zWq/zKp/1i1/1W1/1K0/0Wv/0Cu/06y//7//0qx/1q2/1y3/1+3/j6p/vf7/y+o/9zu/+r2/yqM9xCa/4LK/8De/3ay/p7P/n3B/rLW/12n+xyf/0XRgzgAAAALdFJOUwDdez2eoByg/Z+vFPUOhAAAAoZJREFUWMPtmOt2mzAMgNuEBDquhhgwgWwMQt//DSfJ3BJIJ3P6a+MLviDkDxE4OaVvbzs7OztsjgfrJUdz3flH/hXvZ1Pfe55/q9HK8iyDluOW4xz3cHcYzIxnMqSZNi3BuJHxALIsTXHLsB+nuOlzmRktbUl71RIKGhitNA3gMxEM3TgxM1rog2UB0vcoopAezIxWwIRrPM0XhX17jJgZT+ETwWwSPBzgGRfCL7C4wojSI91FEfVDJBo2hPNLcYqeCKmFs71pcuAJw0cbkCRREq1wMq4wQVnQNkAbJtuESYKWiAbUtXVVENU9p1iiT4NzrjChRQnNmqK4DBSNDuoj0NjCkbScdGgsUzlXmgplWl4eKcpkZjQVSnHv6yuqapjdhZycLKGUkI+bFK22VOW9ae79xRe5NkInWcIPSOxR5IC7292ArqYqi1qNCfKDIxyzRV7pp8W53RxstX56oMRNQqEaEpTdzVGAc+tKCjRqNLIuWYpBWOsCwScAMOoSaxIKdoWCkEI4dYm06JNkbClQO32KFAZCIWLnN9GBUOoSOwq0TjzkGAnxGhFHxU8B/RUYC2PlEGpcrobIxgpjpYmfI1OAJ4zjWOCaWN+UBTUdxyyeMB5wq8sqlTummAn9V0Jvs7BYpfS3CstqlQ1CRdnX9tcqraFQwcNB98T7/LnKp0cJ+PywhG7s9vjXVXxXp0DHE7qT0lXuK+gIR2g/ydSjV01zZSR8Xdoc26jCbxN6rut5HuZTR/s0eH03xVlCz4B/Q3hYWefDxxua7/s6CAPnL9ijv8DzX8F6DbB9Npwrhvdb5wq5V4bPYb5Lne3lrwKcYDG1+W+k54P9Vw4b/puxs7Pz//IHkvGjBU3hWj4AAAAASUVORK5CYII=",
  8283. qm: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA2UExURUxpcdbc4MzO1dTZ3dTZ3s/T2c/T083Q1tXb4NDX287R19HV2+zv8PX29/3+/uPn6b3CzcTI0ZN/xtQAAAAKdFJOUwD////dexCfoCcDaycKAAACJElEQVRYw+2Y4XaDIAyFF2gnEizy/i87SJCCa13i9m9eLAQlHxfsOdZ+fFy6dOmSWPPdvdM063GfDo500yLnG8CfEh3AnxLnQ5bVE+810XYAu4dqiK7m2wH8C4+OKbahcsSfVnQeHTSLjLLNsW0boCE6u5nYbNrNFwe1a6VEVzM3hrUjic5Qc/uUOnyqslsHhosyoutYe/Zek9rhT5oVQNzl4qv4Lgbi92QsIY5UJwRiPUoO5gpiFmDDtsbpHCIXCMsjawnAE2AzjEIgki2kFMRIOEJGLDjEOpPM4UQZvOIiaLxMBKxnGSoEjgqPTmF38QQQHoOgu2RlQDcC4wiMv3XowwgMfrg86YDl+5dvCR/lnjyWJUQ4DczfPxaRngpwDhiZ9UpwCrgcCFRATyUeAaNXOfQFGN7jwkI3O48SAb2n6cNChY7abJ1cW08SLrnIUvZGCT2yVLQKL3aYZcKhvMIhD03xiBeTHugPiNHqgWaFGN6UCKtRA31a6UkSC4BrDsrTZU3KPSzzm7QafjjFWtcJIK3J6IA8PBNJaatrf914xsiBI3KnZGiAkTrcllMcmJfiLREDeXbDKYbrSqDQdD3xXa5J1HLsa98/O164h93Kvke7Uzrguy3spASafwK8a4CSX7BzGZj6rLSL66c0oleVyfRJyYyInipacX6hvzVbae8ymX4G6bvUPA0rTa+WTv5kb1L8J8b0o+4n/s24dOnS/9UX8vFAaEzio+4AAAAASUVORK5CYII=",
  8284. php: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcTbUrDrbszvetTXYrDnasjXQqTPIojfTrDvftTTMpjPKpDnZsTPIozXOqDjXrzHGoTbRqjfUre7/++T++Pf//SfCmxm3j1fXt7Hx4UvNrNL78XHfw8T26o3o0eeFKfsAAAAKdFJOUwA9//8c3Xign5/8SMcgAAADDklEQVRYw+2Y65qjIAyGp9ppRxBERcTj/V/mJsHTtN3dMNt/66dAEsjbgE/7jPPxcerUqVNsXW7Zb3WJx12z9E/6vMbyPtP0rcQsTd9KvKbpe4k3SkneR8wWVrL0yb8SM2QkQYGZYEsITnckMUteKX2KsImvgS/EJT4B86XtXhwx2xD5kp3nCwVHaHTnbOJXsuWv2Utd+WOJ+RcLmJOSpREw30T01U7yCx9Y0H0g+W6YIZRsYRxvfODGK/KiQHtqGjsePwU/MmMCi+84GArfgEZ0izBHHecQvzAFQaGyMBTFDDzbV2iuYWhcYBEgB1Ww42Yw1fdoDHDR3I00JhaAs1ndOCCUUS2lzLa2HgNj3TT1OIKLxIruiAorFPQz1GU9muEIx+CHeRxYQFwaUih/dmCVeISTMx1EBl9t4gKD/FAjz6AJoHp2znV1U0/+Z0A/1XXdOaex1hrYvRBtT8H8J8AcUyflBO64A3sQZSmJaOdIYInXDAzbtxIdPVCxYJoWnjQ86hhgCXkgKsoYNEsPkHo0OGN6/KAZglg5E4gSdIRTT/CRqhXEhmJt1+uwKgYYTmvqwdahWr3zXDxQOyDCF2NKwEHK7IhnkdeqMhqIRD9Za6cKjhC/cnCE/cIzOgqo6SrFQhz1DP0gZElG4C1rmEAQVKiR2A1dLzos1AmtyQWepjUgFlBvAqLyvYONWjhC9HuvWiTrCOB9X66la9vWjMCzHurSBlwndTRQaIFVQJPGGUFHqJBD7r4BLbhbFmsGkiUeYbdsFPxwhTV3ToVrfQKToZlxGqbRoRlmwhTNsYFbCsg4P3rY6pNgngWUa4IMjZ6MO0TlNssDEoS6BaLgl1qtrkTRiEt4wJAm9pKUXIuSa30xFUqp5IPEY0CqEOIB1Yo8cNSjFRZxgUrReuzRRlfto5ShgVjALU+9lDyabCBXHOBtW20eLBOaMSaM4HL+gr1gmtlBmG82NjrrHFys14A7MgizGQepbQpuzo7xBfw74lnrNPdd6no3LN35b6TX2/2vuv3gvxmnTp36f/ULf0R1znQ7804AAAAASUVORK5CYII=",
  8285. pdf: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABUUExURUxpcf9zfP9ldv98gP92fP9+gf9we/9md/9yfP9/gv9/gf93fv90ff9od/9ref9ve/9ldv/x8f/q6v/8/PlYaP/g4f6lq/63vP2Ejv6Um/7Iy//S1LO+3cAAAAAKdFJOUwA93/8c3Xugn58XiwqYAAACVklEQVRYw+2Y23KjMAxAmzolxXc7tYHw//+5kmxI2tBWMDx0ZjkhMr6dkWoeSl5eDg4ODticmvZbTut151b+xNt5re9Nyl2NrZS7Gs9S7mts5M7GVu5sJKH4KhDbjS1shu2CKA36yj2ZaZ5vbGdNbT9zH+MaW8GFaeQLmcYF4XAbu37J2HKFiparyReu12ta+oOKEztDVXwKP+mKdKV3H8a7ZkWGqmxWihIEoVLT+FyA4tTc4g68VI39LHyGI3yva0WVKl1KzroOimkOvu8rhJNWmY6Eg17IcL0QcFRzkGovofZYc/C7ZahNBuHNbs+wpHKPrscH2yqt4YIBbGlOc4WPYK8rp/w4WhexhPoJem6SeJ7YKMRTDteQdxN2odDvIXRwpRBSjhD6rUJXL/xoPUBynRohjkL0Geh1nWILYblzk/cWQhx0DymGFDFCvqSDFSyhc64YCzKisBvDA1HqsoAvLBmil44khk/EXNesEhIiF1eMMaVaMWa8UahyimRLacy98xmdwM3ZTcKhbE+pG9xHIY+QaOf9JmFGW4hpIJU31npsMZgtJZMP60MJ2GDIGl/cbo3QAs5aUeqNqfe2DtVgax86bCFQE0wZ6lvSERzhpW6hE0np5r198sysEBqL5wm+D/sDlxUZep+73MMJ7CQs5/mLjys0pqSIj4uh8mdM7dTIE8KmCZLXW1MnHma5Qj4sofnrwmZhn3+I0Ph5gvMf7Am2ELjX0z21ZKozJUDDeg24eDaciuH99pXre2W+S52ZOV74b6Tn5vIrzYZfMw4ODv5f/gEm33Cvx+zPHgAAAABJRU5ErkJggg==",
  8286. Null: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA2UExURUxpcdbc4MzO1dTZ3dTZ3s/T2c/T083Q1tXb4NDX287R19HV2+zv8PX29/3+/uPn6b3CzcTI0ZN/xtQAAAAKdFJOUwD////dexCfoCcDaycKAAACJElEQVRYw+2Y4XaDIAyFF2gnEizy/i87SJCCa13i9m9eLAQlHxfsOdZ+fFy6dOmSWPPdvdM063GfDo500yLnG8CfEh3AnxLnQ5bVE+810XYAu4dqiK7m2wH8C4+OKbahcsSfVnQeHTSLjLLNsW0boCE6u5nYbNrNFwe1a6VEVzM3hrUjic5Qc/uUOnyqslsHhosyoutYe/Zek9rhT5oVQNzl4qv4Lgbi92QsIY5UJwRiPUoO5gpiFmDDtsbpHCIXCMsjawnAE2AzjEIgki2kFMRIOEJGLDjEOpPM4UQZvOIiaLxMBKxnGSoEjgqPTmF38QQQHoOgu2RlQDcC4wiMv3XowwgMfrg86YDl+5dvCR/lnjyWJUQ4DczfPxaRngpwDhiZ9UpwCrgcCFRATyUeAaNXOfQFGN7jwkI3O48SAb2n6cNChY7abJ1cW08SLrnIUvZGCT2yVLQKL3aYZcKhvMIhD03xiBeTHugPiNHqgWaFGN6UCKtRA31a6UkSC4BrDsrTZU3KPSzzm7QafjjFWtcJIK3J6IA8PBNJaatrf914xsiBI3KnZGiAkTrcllMcmJfiLREDeXbDKYbrSqDQdD3xXa5J1HLsa98/O164h93Kvke7Uzrguy3spASafwK8a4CSX7BzGZj6rLSL66c0oleVyfRJyYyInipacX6hvzVbae8ymX4G6bvUPA0rTa+WTv5kb1L8J8b0o+4n/s24dOnS/9UX8vFAaEzio+4AAAAASUVORK5CYII=",
  8287. ipa: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABUUExURUxpcUOv/zar/1K0/1Cz/0+x/1q2/jGp/0Ku/163/zGp/1a1/zus/1q2/02y/0ew/0Gu//f8/164/+/4/+f1/9fu/yek/73j/6TY/xad/43O/3nG/21bnhoAAAAKdFJOUwB7//+gJ92gn59E+c9oAAACbUlEQVRYw+2Y27aqIBRAd5iVsLiICKT//5+Hi5hmdcD2wxnjOIPF4jZdPXX5+Tk4ODjIpj41b6l3+Br5iUupsr5I+avGVB99GvcaayqpI4ioz2MWJnGl0HiiNCpfIuNeibFZ6OQ6ysdqgbGhWeQbvZDQGMjCQOYlUmZsCHFXSIoTNEWvjXu5xjNZQVOgC3Hkskv4ict+YfXa2GQJq4r4lkI1z+UoSUhj9w+p84QrSEqGvpeLaeC0QzhBTdca8bx63i+0bavGvULmG1sNUrXKIu7SxU6ZcLoV7jM2qN5ixKJwkrJMIVtRxWG0g9Z8teQpEKZbZLB2kAzf9WiNsXL9uOIKiVVd23bKDLZ3icss+UpovMWTxlYZUii8hZPcvRgfZs+MkYKFPR/YLUfI3VkP41RtfL3Ugk/brmcKw3F3YdwU2A0a0q7nnC0MmI1QUeBLbkVC4YTzKzZViS+EYLpnFOd7hOK9UO4QCi6CUsCgNkYreNp2TeQJEzCqFyWKJdlC7hvwPji6h1d1hkSVr7O0QoGNCjqlQvdDp/phT4WTcOyjxvuS+hshCKM2GATlQogd9FTign7UMD0NMoUw4S4gbZ+MvdUo7PltgDxhOu3QyARj7/Gj4RoWFFXoC0GaGacydhhsSEgoML2FYiEAvovRjuzuAPdBxe8YSiu8wpPRox0hWfvyhWgOgLHWGDnc6JLZFbJrltDfjneQv4fiEJdR3ExZlhB9BFazXxCif0aIF/ExxmQKOE94SofxQxrTqWMHig3lfIOt8Qb0dpr1U+WKs8l5xw7I9UHmb6n6+qv1xT8xrn/ltOffjIODg/+WP3HMcIG4JOLbAAAAAElFTkSuQmCC",
  8288. doc: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABIUExURUxpcTSL+DmO+VSd/k6Y/Vmg/kOT+jSL+UeW+1uh/1ig/k6a/T6R+l2i/0SU+0mX/Oz1//n8/y6G99fp/3ex/J7I/77b/4u9/gFOo+kAAAAKdFJOUwD///8n3Xugn58WcbRuAAACn0lEQVRYw+2Ya3ekIAyGCzozHQFRUPz//3RzQaSXbYPtOfthfccoCcljEM9pZ15eLl26dEms/v78q/oTvKf7SrdWZH9z7leJT+d+ldhTzQCfooH9oUw0Ee8D1qPyZXBsOxDdFuJzkKiBKAM2EIVAObEGdtlqv0SkRAB2XTfgQSMao5M/FKHpmxDYvdHO2G9S69YE/FD+5i5szxMdfq1eBDSYasiMYY8DJkcPuwuAr12uxNO2LgaHGWCM29Yhe3g7yZpfTa41xq/THJ3BNunUGZ8gMnAAs15FQBbUjHGe57W4IDfN87T44suAXUZ6WwFZCwDnZSx+S4cA1AeQnwEBp2X054DjAVxiXPclzyeAno4d6I2DwbT5/Rky0IuBnnjeH8AVrrC7PgPtniED+l0Z6D1txTwn7w8gp5wEJuLh+1KA/jRwWv2GFGwymR8CFQEH7DMmRG0ZOLYCucAyEFFx0REvWwGOcuAIgnw4qwgrRdCUVNhgMEFgQiBO4yEGkqyielB0IahEw5mBWSeBcQ1KB7fjfw5MXlmrw5rdRf8QGJegrbVqTNltBtrRVsC4agU+tLjECkhJIiA0A+koBqYBGsSI4kUD0I6cJAVSOjw12ljcEcJDi0PKQBKkSDvkfAJGeAU138PSy5iBvIYmIO1rTAu8MiUwJogYVVIkwMcBVAb+jFKDOQCL3lZ3BOyjCQhLROkKSBHVDNRQSqb28gyliOIImQioK0ExC2E5oqp5GZBrbVX3PmJ3p7nD7/TPgEpXD0oVU8XN00oGpEqsUQc5UxWb2k0EVG/F2Ix4LwnwXld+AtF1WPIfbK8aJPqq8pDzJCsG4YICV4S9NByUUFwt/C7VP7AgUBGcw0cmTQZhf/wjxuNb3c/8mnHp0qX/Vn8A5AVWOPvxckoAAAAASUVORK5CYII=",
  8289. xls: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcYXMX2m8Pmm8P3zJWYbNYXvGVGu9QHrGU4jOZITMX4fOY4HKW3fET3LBSm+/RnrGU37IV2u9QWm7P22+Q+r94PP/7dv2zfv/+GGyNlmsLsfrtaTZiLPhm5TQdN9r514AAAAKdFJOUwB/e98c3T2gn5+4KvYSAAACu0lEQVRYw+2Y63qjIBCGmzRtqhwV1Arq/V/mDgMeYtLtkM2/9ROBGWZe0aB96NvboUOHDpH1eSp+1Gc+7lKwv+njksv7YOylxIKxlxIvjL2WeGIvJhYlY1BYiRU0ZahZcqYjh1ggJCqmL8bcCVejE4tyL/awSybeA38QlXgL5PsuzyYWMYmvhfNECS3nWDCGRiw4T0lr2bjwLCOSnyjAL56hz2wg2yNuHadM4NA0vpyNCs6pa7ot8osIrGI6a76/Wx96FVZ8Asc3OmIAEVghDw7WQX47Qq8KNo+212ihjwSsFsmxjcQo1oHZdpNYIzKBVnokDmiVvgV1Q/88UPQCic0EhvZN5Cn9DDAmyb5Kt1lV8Is3TTc4k3iaDNRah/DQaOngwYWJMZgg8MYeblhrHIOWDFxl3QREmKMeuq4bVS8TLooIrDZE44bw7FpvpnGYeYvyZ6iF6cdAbCbn3J6XCxSR6JDYTb2RuzEaUKQMEbLgkH2a45A8cw0tDXgjAMve+kTc6wmgECOsPhGJ7BXA8D43ggdi05X/DsTvQ8Nc6fFN4c8AJRyhBOEXsPXKwAJHYnimOChzZihThmRxUVe9hAWORB8vJCOXBJSAk1E8vMiN186KhTjKTQAFeMVwgVn43HzpDFgKliMShwQTdOCsMgC6CXkr0as1IhMoPHxhht4kgnXKw1+9wa4R1yygMnoYJ9cvM6qdHMfB1PnAhDAufGHU5gpgoiP6FA2oIFBFGUi30UQIOmqFXaXIwK2supW1N5584C8iAu+mdW+kmga04caCQpqdLWXTwDwaeiSgzRAVWGNZzrVb12tTk4E1CKuUbdGyyZWGoijAc30nu1xhrzNl8/0o0dSPRdoGXGuTVMezNvVibioQ5Y5hf/u+JPygefiduJe6XA1JV/qO9HK+/qrzE//NOHTo0P+rP7x4jQVHYv00AAAAAElFTkSuQmCC",
  8290. ppt: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAByUExURUxpcf+ubP+iWP+SO/+nX/+lXfyPQv+SO/+dUP+xcP+ua/+VQP+jWf+XRP+cS/+eT/+UPf+ZSP+gVP+qZf+saP+SOv+mXv+wcP+ta/+ubf+oYv/79//x5f/m0vmEO//MpP/Sr/+9i//Zu/7Dl/ufY/2zfqeIp1YAAAALdFJOUwDdPXugHPygn596VuVMqAAAAl1JREFUWMPtmOtyqjAQgNuqUBQSEi9cDHJR3v8Vzy5JJHi03dAz0x+HD3LZTfIZ6tCZ+Pa2sLCwQOZjG73kw1+3ibKveN/4+t6z7J8a7f6Kp7bC27gp7mTFC7yM28nS/OfGKC9y0OSIafJi6A1FJ3IPY5SToBuj/JAfDkMxNSzHzpDN9e1jXB+IUI1/CfemjJGfcb0HDvbe23rvZGxMM673dCKqsJwsK+916SYQyn+KdemQVec7qmqy8oGtr7A5T6kfhGsP4QlLd/7aSBKeRuJueFSNUmi8nspxfJ6wuWn6Gv+gleM7neYI1fViucIeVTtLGOv5slMg5FITXGCLqo6dCTRhfIoRqLVQ2lA0Sqkujk0MGZLQrEZAqKwQ4ChspDOBIvyMR2QzEUr4plXNnQmfnkI+FbYQVf0coTRlFGZt22KgOm78UlKFckQL4VuulaHqA2dczhFWICwro6uuAfuJkDXVIJSNfvu69jLZIFnIXWHLZXKrkf52Cbi/kHOORmg4q2FbLePMvnwJw5HhA3GcU4UWK+QiQATjD/gKhRW+4idCePCZQjaihQK7nLnYyFeYjMKnPjZnh90TIfMSCsG0QrDk2lVdD5EQOoE9HDYTBE2IizRJ33RNkYgJzOkTdzgKg6zNggeh8BSGxqWF8HYEj5bkXtGEiUsa7IYWDM8IvYXf8GvCHZLglZgIG33ZLvZ2JOHOg98Vpvc2HQOHNKUJV6kHK8rh+8m64ysh6RgQpsdjaq7hhmK6OmeGIU95YjjfBkciAfEstQlpvpB+It2swm9Zzfg1Y2Fh4f/lD1FNqKcd3wCLAAAAAElFTkSuQmCC",
  8291. png: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcf+ubP+eUP+iWP+xcP+nX/+lXf+SO/uPSv+dUP6kX/+XRP+VQP+SO/+jWf+oYf+hVf///f+mXf+tav+ubf+rZ/+eUP+wcP+pZP/s3P+aSf/z6P/48v/UsvqFOf+6hP/jzf/Hmv/cwS4F5mYAAAALdFJOUwDdez2foByg/p/2onNSOQAAAh5JREFUWMPtmNuSoyAQQGeMUaZUxBveRfP/H7lc1VRJptF92Kr1INqtcKqNSSrk6+vm5uYGzMPzrTzcdYFff+I7cPV91/VfNZr6ykNb6WwMypW6tOBk9EoALka/KMtCTCr05OKi0S9AwI02YXXW+KwqMVluMqw4SimjtUGNzwoK0HgobC4Yn42iat6DanfKnPZdhCAersK0KcfXWOtYbPtrTeNBhGnapCt1n2VZX6cWnjDhjjETjNeFudrhWQpfeS7PqJ5vI0DCXJLKPVmkcMH5MQ5CBaGvIRtehIhkGVp2VmgqwgixhSEkciYeDz4jxDkWyD1F0zQhKrJZ3zzG+jKPQMLNJiAd6ogImHw1+1UngQh/8DHqefMS9/ycFhJVIC+ROAvJnrodRn7ARBfIS+TJirOwEp88JsTGx0skF4Tyfd3nZCtQ+c8KG3OXW4FZ1lJHIeUQ1dVXQzY0vMDBbLJEKjsFCxX1oOmHPe02wlHYDsewk0LWW5jPCfPZJuyZm7BTbWmtzHoMTNgpcPuBUg+CCSkfSTv2wTdXskKoUFGMdhhyqlASTcjOlLgLu3iyk0QOwjDqePsFfgeiA4VqykefCUK40KZ457wwuiaMBZFokc7EQTUTiigGCWMH/m1hAhR624TETFSh7Em8Np5DfsE+EgdAy4BQD473M9+SNYPcMV/fImh9CLiWCkKYL4SvSAMv/BXvxL8ZNzc3/y9/ADVfok94AIhIAAAAAElFTkSuQmCC",
  8292. html: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcTbUrDrbszvetTXYrDnasjXQqTPIojfTrDvftTTMpjPKpDnZsTPIozXOqDjXrzHGoTbRqjfUre7/++T++Pf//SfCmxm3j1fXt7Hx4UvNrNL78XHfw8T26o3o0eeFKfsAAAAKdFJOUwA9//8c3Xign5/8SMcgAAADDklEQVRYw+2Y65qjIAyGp9ppRxBERcTj/V/mJsHTtN3dMNt/66dAEsjbgE/7jPPxcerUqVNsXW7Zb3WJx12z9E/6vMbyPtP0rcQsTd9KvKbpe4k3SkneR8wWVrL0yb8SM2QkQYGZYEsITnckMUteKX2KsImvgS/EJT4B86XtXhwx2xD5kp3nCwVHaHTnbOJXsuWv2Utd+WOJ+RcLmJOSpREw30T01U7yCx9Y0H0g+W6YIZRsYRxvfODGK/KiQHtqGjsePwU/MmMCi+84GArfgEZ0izBHHecQvzAFQaGyMBTFDDzbV2iuYWhcYBEgB1Ww42Yw1fdoDHDR3I00JhaAs1ndOCCUUS2lzLa2HgNj3TT1OIKLxIruiAorFPQz1GU9muEIx+CHeRxYQFwaUih/dmCVeISTMx1EBl9t4gKD/FAjz6AJoHp2znV1U0/+Z0A/1XXdOaex1hrYvRBtT8H8J8AcUyflBO64A3sQZSmJaOdIYInXDAzbtxIdPVCxYJoWnjQ86hhgCXkgKsoYNEsPkHo0OGN6/KAZglg5E4gSdIRTT/CRqhXEhmJt1+uwKgYYTmvqwdahWr3zXDxQOyDCF2NKwEHK7IhnkdeqMhqIRD9Za6cKjhC/cnCE/cIzOgqo6SrFQhz1DP0gZElG4C1rmEAQVKiR2A1dLzos1AmtyQWepjUgFlBvAqLyvYONWjhC9HuvWiTrCOB9X66la9vWjMCzHurSBlwndTRQaIFVQJPGGUFHqJBD7r4BLbhbFmsGkiUeYbdsFPxwhTV3ToVrfQKToZlxGqbRoRlmwhTNsYFbCsg4P3rY6pNgngWUa4IMjZ6MO0TlNssDEoS6BaLgl1qtrkTRiEt4wJAm9pKUXIuSa30xFUqp5IPEY0CqEOIB1Yo8cNSjFRZxgUrReuzRRlfto5ShgVjALU+9lDyabCBXHOBtW20eLBOaMSaM4HL+gr1gmtlBmG82NjrrHFys14A7MgizGQepbQpuzo7xBfw74lnrNPdd6no3LN35b6TX2/2vuv3gvxmnTp36f/ULf0R1znQ7804AAAAASUVORK5CYII=",
  8293. js: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABpUExURUxpcUOv/0uw/zar/0+x/0Gj/Fq2/jOp/0ew/123/zKp/1S0/zqs/1Gz/123/02y/1i2/kWv/0mx/0Ct/1y1/vb7/1i2//7//zel+zOe+e32/9zt/5nN/ieV9oDG/avZ/83m/77h/2S6/HhIljsAAAAKdFJOUwB7Pf8c+92gn59dd850AAAC8klEQVRYw+3Yi3KjIBQG4CbGpgaMNyQIiJf3f8g9B8Rqp9mCszO7M5u/Kgj6iRrb2Le3V1555ZXgnE/Z05zjuUt2/13eL7He+/0+457zlpk/i1jRjo/ZCQC2Hx6LH+MF92EOhIJt9LtviRJPFsMgY0vPr2aUmDmFlY5i68q2ZBFiVpYcf3jpwjnDFoZ15mZsChczRKxkC86Xlc+4erCY+T34TvENnPuxh4rZdiR8M0BeLlfCwcFiRqxGcOJYJxB3AEJ4STiuEuzhYWJGvqYkz5IdA58FDnQ+AOb5bOY8/948BYAfFoEJZ6gWWraK5S5kaffLkHP+yPepxsejHep9I1nKj3iwThWAOi3y7xIIbnYuPOiHCH0Fzm6jIBC2LZZ9IJUHi2JpsYsocJeqW8Fv8g+AtQcrEOuDYF3Xbl8oNmBtJiXlONxtb23nILDepfEgmdr2AdVWGduBxz0Cpp1qARTVAFwrJSwVX3vjwapZwEI+HnLSelKtNHFgZYNYBROCLYB3BLu+F2YYWGW7YItgsK58PJjjpTRCdL0QYu2NGOFXMJ3wGqrBFEI0fwIUbJT2Jkv96R0AGw/SjuhR2Q+OjgWbBqHakAZCEZRaNKLrajPgMOUM/bBFEw5CcngqNJQilwAaATTckG6GS9kOjU8QaLekGh2dixnPWDHBBk0o3GRzEBRGoQgBTw6dgAdPDXda2D8INBqE09Mo2siRdWKQ9smDRw/GSw+MsOv0KG3UxPoOnmV7i/GzqLsVvAaPkMJTxvQ0juOgU/AoHGBSSqpxgseFokgDwSsFjuIt7fsUvlqmPXo0gWduNsbMokcPN4FFGOgCJ927oOcPsa65xIA0ARIjbsnSkMDvBZHQo+AC7ISdFgwmid8xwfqmZjtcxdWDwGQNXebniQR/zl8Eb3Za8rV2s/MtEDwlN4hdLFkbkm2LXQn5Bnu+hQbIoNeAa7B4CzljeL9NQ7008F3qEjjGa/gb6eV0/TGnA//NeOWVV/7f/AJAsosfySCrjgAAAABJRU5ErkJggg==",
  8294. css: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABaUExURUxpcXvGVGm8P3zGVXzJWYbNYXbDTWu8QHnFUofNZITMX3zHVXTCS22+Q3jEUIHKW4jOZGq9QHDAR////mi6PvP97pbRd/v++tXwx+b33afbjV2vMrznpsnquGjfsnAAAAAKdFJOUwA936wc3Xign58XA1ZcAAACuUlEQVRYw+2Y2XbjIAyGm540qc1qAl7j93/NkQTEdJsKtxdzzvg3iSVAH8JRFufp6dChQ4fYOl2aL3Wqx50b+ze9nGt5L9b+KrGx9leJZ4ppv2C11KqIlxTUUnib6akn2TXEBigY3RKtJdncgRb1VBCb9o0Ikq0Hvob4Dvil2EQukE18CzSfmlXEJoaaTDCtMYmFZ2Oo0SCP2BiTgrZWdNGjjUjTsIEP2TvIRrsv7KRTJbDtpwCaKEkb7b4EXhjA1zJgHG63YYiQfhrQG8vxVz5QECMAYRrv5Oj7OAEx9MUEJlCkJhA49cJLjJZe9BMChcnju4DjsihtBEgtC1wCAAph4sEDik0EVJpsYGqVgVk1QJOBMjkgHYFGxGbErgzl5uufZPgZUBJQ7wbqeYC6ewcc5t1AM0PdDfcMBI5coRCn2USPD9QUYMcAvGmW6FC8lj0uEcYWHc0F6igxwwW8DasjJ/ZJhynewpzmaDYQAbhh3LEuRHuGrHWaVJOh1PcplNmgMOsw3p2szRCB3vf4oq7ybYLD2HuvdwC18wvUIZRNAaSyWbyrBErasZaKCttFj9agwu6kTBeFCZQQgA2qJAJpAVQEYoeMs1hAuSkCNz8Ciwk7gMOofgi8FvHx83DrUONtV4auBIbZJldYKsPe1QJdIjpn4TtkCGHUDnvGEPCzwbo0DBOunC3jRJJ0ag30VrPo2onex6tym3jAjHPOt+sEWuMS0bY+DspaIEotvp/n2SDDeQFmr5a9GZL8QurQ7qLtdwEfQcqDusJWJY8LVBClElahMj06xRALqB5y6jtVAtU/Duw+I3TpGQ9oHOAF5r6TSo8PHYrzC/bUcQVI1m3AFSd7FpKzY7i/fQaaj0Sf0dsCNOLpeGbeS52vnY/K52R3yeji6cq/Iz1frt/qsuPfjEOHDv2/+gP0toi4gXoofgAAAABJRU5ErkJggg==",
  8295. epub: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcXXDTXvGVGm8P33HVnzJWYbNYWm7PYjOZXPBSmu8QG6/RXPBSoHKW4TMX37IV3nFUYbNYonOZOv+4fX/7/z/+1utMK3gkuL412O1OFOpJ7ripNf4xXK6TKHWhX88Tv4AAAAKdFJOUwB7Pd+gHN2gn59lNj8pAAACeklEQVRYw+3Y2XaqMBQG4GK10gxCgDII8v6P2T0kMhR7dujl4QcMCcm3Ni7tkr69HTly5Ig4pyR9mVM8d0mL3/JxifU+Xkhup5jyQudmkpuNuEjx4ii0fHlWUIt7lJiwsZVpOEZMnSQRYnpzsGH8WmyphxdcGJaL6U0WsSgFxeIStOtTGy2eeZGddmu9gq21tNMcmXi21i+adtsMQ8MdOm5M2lQMrtKUVVU2GxdO+8Cm/IJsickukL1N8SwEM9wzS2cZeVXlRT9uuZGBmfey7OmVfU9Nk3HoKhwiMFuEvaaum4XoEw8G736ve7rr8W8gfF64PqXqrsX3sv8TSF4Lns5zPWKF7ZjvAHPcYZt5jFft2Bm+RpsYpCBRVegpxqEz1p3BSzQHDhFI2JPg+3162LGjYy4CRKKt8AuM9c086BRDC+8kJwI0AxDVsPYMeNAZIsBPD/ZYYfsAIh/beX34l6c30aDOeyxrKHyB8/rKPtPxYP3AGksQDbxrw8J71FGggS033T2IpstHu/Du+OHBaZ+yClei6+7wVf7pQWSgMQYPTWJZloPt6g48N0CnJY9n5EYEhsn5JN40jJBXes+TQjBkEp33qD7ttXhwLi69kFhwJm568eAkbnpScL5IPcXJ09EVatq4CSJ5ylvabyKQpkKoEC/Cb5vg8bjhCTJQMxeCd62KQqG3jhA0k0ivCr973gvXTAz4I6qr6436ZOBVb4lqi9P6KgSV5vXzVz8YXvlEDoZlrE2KmholrVC9iN4Yk4AJLdW0XqvQeO454HXJL9iTiojoMeAq9yR3DM+371LvXfgsdRHWeJU/kV6S6z+T7PhvxpEjR/7ffAMGOojXQYbbiwAAAABJRU5ErkJggg==",
  8296. psd: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABdUExURUxpcUOv/0uw/zer/123/0+x/1q2/jOp/zSm+Uew/zKp/zys/1O0/1e1/0Ku/0+z/1q2/0mx//7//164/vf8/9vw/+r2/yie86HX/sno/7Dd/5TR/W6//H/H/Eyv911ykpAAAAAKdFJOUwB7Pf+fHN2g/p8jQekrAAACx0lEQVRYw+2Y7WKrIAyG12JXJn4xEQG193+ZJwnYOdedE7r9O74qBQyPARNb+/Jy6NChQ2ydT8W3OufjLkX/N71ecnmvff+rxC/+dT8jXnB8162sLhK7T/As4glgHR1xT0Vs0iW6PGKxYXxo35FBJGC9B37p4BOLdXhd42e9QdaxXecRi5opLpEN5BITsKL9oao8YkGoqkpIrJAIRY2azuFR8IB31bvPXQuY5zzgA8hOJwbwbTWevY3yof+GV3Hm/NZG29ab9yhjrOsq6E57C2Ub9zcWMEoP7x8yvqPOalOicoANAu0AsuCqce0j5QJNmPt+cQMQ7fwzoI7AaURNdueizgRq3CJQKiXl6GH2Xn/QyIAN1BqsdQS6BmvSAXDQO6ERF6hX4BSrAYGNnp3HqJw1eYhlDlCRh1TtcA2DmixFJkTl3ct8IE65whC3S49YSzG0PAt8H1wIAaPGeFxI46cJmiY8DYS0M4YyZZawkGaGIJpDmJs8YANbAqZk9ouUOPFwgyAapWySEQvYRBHQrI+bUSoKb+unVkoVTXTDA9LFCWiG4JxbejnKppG0mHiTa4JpKHM9TKk3Iq+RcvKDoRvUJptngBJFU1RyvM3BU14/AxQEVI1aByNxHG/OYtb8ALiqcq5SAlYTgW0+UO2BkHjWzbqZTPRQsYEwS4Xzi0BFY2Gb4R5jFGEawlMNjOAcDxgFgWzspO6S0xC/tYwNcJsQp9Q1B7h4COgNEHLOD9YO3kUeigO8rgB5629SbYljvSzLfBtH8QxQYJBsgfhdEKP8zssCAlEKsQViD4V5arGBQgmBKEGVeNBwkZpCxS4hWECRoWyg+m3gb3lYRvPyXpapsjlRZnlYpm2tf7pEmcqSBzyVDyUe9nJ+wZ73gx+jolivAdeSLc6M4f1WcnmS+S51Yfp45b+RXk7Xf+r0xL8Zhw4d+n/1B13vfAhtdKi2AAAAAElFTkSuQmCC",
  8297. dwg: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABaUExURUxpcXvGVIbNYXvHVHzJWYbNYXbDTWu9QHrGU4jOZHLBSW+/RYDJWmy+QoXMYHzHVYjOZHfET2m7P4LLXf3/+/T+7u3+5MXrsaXbiVyuMZjUeNb2xOP81bPjmuZ7vy0AAAAKdFJOUwA9z1wc33ign591Bg7OAAACdUlEQVRYw+2Yi3KjIBRAm51UI4gKxMei+f/f3PsQNU3SXtzOdGfWo0W4wBGFau3b28HBwYGYU1a85JSuOxfNZ/w6p/rem895TzQWTfOtxjP1qWCDtJoLK1WyMcM+VUUu1pJ3ls6nSDEW1UpTvSLBWFRf0iQZXwn93jFuhd7fK/2SJhgL9Hh0ecp5P4tn3xzwYmPhX0En2SL7nXkirEIPNA/xspAIL9Cw9CUmsV85dG3bBcjNgSUjeVJcykeG9nrtAmX9/MNJtk9Yk7B5cqbLvymsdwjr2LOmBIVtU3OMQ9xGJIQOQHSFGzBegR5zoV4Qj7DeQiumbVGIx26gEXICpAvr4bqlHe5r04WWhB1BQvsdwo5uX4/GvxCGgejBMv4mJpwZjoY0IY7C9nSZNB+jI1DY8tXfsJGVCi3Rt8tUjBoDelrn5mbBJxVi29qqG60XXDLtqFjYXudQd1N8VqEQUUNPTNA/jhCyE0cHRUNMEiq+cbiwV2E3cFTvGKHjqQ34bB0Jespy1NlkIQwR0aG7I2iOJwmVje1BG6atbwpQxbUqZYRq3ej9NIJ1GjGHwk21SKgiFndL7xQU0jvFLlWERJhHE3ehuQnTNI2WZmOxUQuhcDsK44xzJCx5vdyRJFzRYQShf6xQ+U8J9VOh3inU4NMAaTULccWUmopUrRQ3kAkfqQJgn1TsFBpaO+77hHp+xOwXmo9DhNVoOLipMlKh0dibd8waLq7HWDBGJDQJ/IgwM3zHIm5JlpQ33CV/wZ6wj1t7UT4KaLY5R4noMyB3EXN32BRiRHLF8H2rnRAt/JY65zJfLv8iPWf5l2Q7/ptxcHDw//IHYWiLelDcDu8AAAAASUVORK5CYII=",
  8298. };
  8299. /* 办公几件套 */
  8300. // @ts-ignore
  8301. Folder_ICON.docx = Folder_ICON.doc;
  8302. // @ts-ignore
  8303. Folder_ICON.rtf = Folder_ICON.doc;
  8304. // @ts-ignore
  8305. Folder_ICON.xlsx = Folder_ICON.xls;
  8306. // @ts-ignore
  8307. Folder_ICON.pptx = Folder_ICON.ppt;
  8308.  
  8309. // @ts-ignore
  8310. Folder_ICON.dmg = Folder_ICON.ipa;
  8311.  
  8312. // @ts-ignore
  8313. Folder_ICON.json = Folder_ICON.js;
  8314.  
  8315. /* 压缩包 */
  8316. let zipIconList = [
  8317. "rar",
  8318. "7z",
  8319. "arj",
  8320. "bz2",
  8321. "cab",
  8322. "iso",
  8323. "jar",
  8324. "lz",
  8325. "lzh",
  8326. "tar",
  8327. "uue",
  8328. "xz",
  8329. "z",
  8330. "zipx",
  8331. "zst",
  8332. "001",
  8333. ];
  8334.  
  8335. /* 图片 */
  8336. let imageIconList = ["jpg", "jpeg", "ico", "webp"];
  8337.  
  8338. /* 代码语言 */
  8339. let codeLanguageIconList = [
  8340. "htm",
  8341. "py",
  8342. "vue",
  8343. "bat",
  8344. "sh",
  8345. "vbs",
  8346. "java",
  8347. "kt",
  8348. ];
  8349.  
  8350. /* Android安装包 */
  8351. let androidIconList = ["apk", "apkm", "xapk"];
  8352.  
  8353. zipIconList.forEach((keyName) => {
  8354. // @ts-ignore
  8355. Folder_ICON[keyName] = Folder_ICON.zip;
  8356. });
  8357. imageIconList.forEach((keyName) => {
  8358. // @ts-ignore
  8359. Folder_ICON[keyName] = Folder_ICON.png;
  8360. });
  8361. codeLanguageIconList.forEach((keyName) => {
  8362. // @ts-ignore
  8363. Folder_ICON[keyName] = Folder_ICON.html;
  8364. });
  8365. androidIconList.forEach((keyName) => {
  8366. // @ts-ignore
  8367. Folder_ICON[keyName] = Folder_ICON.apk;
  8368. });
  8369.  
  8370. config = PopsUtils.assignJSON(config, details);
  8371. if (details?.folder) {
  8372. config.folder = details.folder;
  8373. }
  8374. let guid = PopsUtils.getRandomGUID();
  8375. const PopsType = "folder";
  8376. // @ts-ignore
  8377. config = PopsHandler.handleOnly(PopsType, config);
  8378. // @ts-ignore
  8379. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  8380. // @ts-ignore
  8381. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  8382. // @ts-ignore
  8383. let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
  8384. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  8385. PopsType,
  8386. // @ts-ignore
  8387. config
  8388. );
  8389. let animHTML = PopsElementHandler.getAnimHTML(
  8390. guid,
  8391. PopsType,
  8392. config,
  8393. `
  8394. <div class="pops-folder-title" style="text-align: ${
  8395. config.title.position
  8396. };${headerStyle}">
  8397. ${
  8398. config.title.html
  8399. ? config.title.text
  8400. : `<p pops style="${headerPStyle}">${config.title.text}</p>`
  8401. }
  8402. ${headerBtnHTML}
  8403. </div>
  8404. <div class="pops-folder-content ${
  8405. pops.isPhone() ? "pops-mobile-folder-content" : ""
  8406. }">
  8407. <div class="pops-folder-list">
  8408. <div class="pops-folder-file-list-breadcrumb">
  8409. <div class="pops-folder-file-list-breadcrumb-primary">
  8410. <span class="pops-folder-file-list-breadcrumb-allFiles cursor-p" title="全部文件">
  8411. <a>全部文件</a>
  8412. </span>
  8413. </div>
  8414. </div>
  8415. <div class="pops-folder-list-table__header-div">
  8416. <table class="pops-folder-list-table__header">
  8417. <colgroup>
  8418. <!-- <col width="8%"> --!>
  8419. <col width="52%">
  8420. <col width="24%">
  8421. <col width="16%">
  8422. </colgroup>
  8423. <thead>
  8424. <tr class="pops-folder-list-table__header-row">
  8425. <th class="pops-folder-list-table__header-th cursor-p">
  8426. <div class="text-ellip content flex-a-i-center">
  8427. <span>文件名</span>
  8428. <div class="pops-folder-list-table__sort" data-sort="fileName">
  8429. <div class="pops-folder-icon-arrow">
  8430. <svg
  8431. viewBox="0 0 1024 1024"
  8432. xmlns="http://www.w3.org/2000/svg">
  8433. <path
  8434. d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
  8435. class="pops-folder-icon-arrow-up"></path>
  8436. <path
  8437. d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
  8438. class="pops-folder-icon-arrow-down"></path>
  8439. </svg>
  8440. </div>
  8441. </div>
  8442. </div>
  8443. </th>
  8444. <th class="pops-folder-list-table__header-th cursor-p">
  8445. <div class="text-ellip content flex-a-i-center">
  8446. <span>修改时间</span>
  8447. <div class="pops-folder-list-table__sort" data-sort="latestTime">
  8448. <div class="pops-folder-icon-arrow">
  8449. <svg
  8450. viewBox="0 0 1024 1024"
  8451. xmlns="http://www.w3.org/2000/svg">
  8452. <path
  8453. d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
  8454. class="pops-folder-icon-arrow-up"></path>
  8455. <path
  8456. d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
  8457. class="pops-folder-icon-arrow-down"></path>
  8458. </svg>
  8459. </div>
  8460. </div>
  8461. </div>
  8462. </th>
  8463. <th class="pops-folder-list-table__header-th cursor-p">
  8464. <div class="text-ellip content flex-a-i-center">
  8465. <span>大小</span>
  8466. <div class="pops-folder-list-table__sort" data-sort="fileSize">
  8467. <div class="pops-folder-icon-arrow">
  8468. <svg
  8469. viewBox="0 0 1024 1024"
  8470. xmlns="http://www.w3.org/2000/svg">
  8471. <path
  8472. d="M509.624392 5.882457 57.127707 458.379143 962.121078 458.379143Z"
  8473. class="pops-folder-icon-arrow-up"></path>
  8474. <path
  8475. d="M509.624392 1024 962.121078 571.503314 57.127707 571.503314Z"
  8476. class="pops-folder-icon-arrow-down"></path>
  8477. </svg>
  8478. </div>
  8479. </div>
  8480. </div>
  8481. </th>
  8482. </tr>
  8483. </thead>
  8484. </table>
  8485. </div>
  8486. <div class="pops-folder-list-table__body-div">
  8487. <table class="pops-folder-list-table__body">
  8488. <colgroup>
  8489. <!-- <col width="8%"> --!>
  8490. ${
  8491. pops.isPhone()
  8492. ? `<col width="100%">`
  8493. : `
  8494. <col width="52%">
  8495. <col width="24%">
  8496. <col width="16%">`
  8497. }
  8498. </colgroup>
  8499. <tbody>
  8500. </tbody>
  8501. </table>
  8502. </div>
  8503. </div>
  8504. </div>
  8505. ${bottomBtnHTML}
  8506. `,
  8507. bottomBtnHTML
  8508. );
  8509. /**
  8510. * 弹窗的主元素,包括动画层
  8511. */
  8512. let animElement = PopsElementHandler.parseElement(animHTML);
  8513. let {
  8514. popsElement,
  8515. titleElement,
  8516. contentElement,
  8517. // @ts-ignore
  8518. // @ts-ignore
  8519. folderListElement,
  8520. // @ts-ignore
  8521. // @ts-ignore
  8522. folderListHeaderElement,
  8523. // @ts-ignore
  8524. // @ts-ignore
  8525. folderListHeaderRowElement,
  8526. folderListBodyElement,
  8527. folderFileListBreadcrumbPrimaryElement,
  8528. headerCloseBtnElement: btnCloseElement,
  8529. btnOkElement,
  8530. btnCancelElement,
  8531. btnOtherElement,
  8532. folderListSortFileNameElement,
  8533. folderListSortLatestTimeElement,
  8534. folderListSortFileSizeElement,
  8535. // @ts-ignore
  8536. } = PopsHandler.handleQueryElement(animElement, PopsType);
  8537. /**
  8538. * 遮罩层元素
  8539. * @type {?HTMLDivElement}
  8540. */
  8541. let maskElement = null;
  8542. /**
  8543. * 已创建的元素列表
  8544. * @type {HTMLElement[]}
  8545. */
  8546. let elementList = [animElement];
  8547. // @ts-ignore
  8548. if (config.mask.enable) {
  8549. let _handleMask_ = PopsHandler.handleMask({
  8550. type: PopsType,
  8551. guid: guid,
  8552. // @ts-ignore
  8553. config: config,
  8554. animElement: animElement,
  8555. maskHTML: maskHTML,
  8556. });
  8557. maskElement = _handleMask_.maskElement;
  8558. elementList.push(maskElement);
  8559. }
  8560. /* 事件 */
  8561. let eventDetails = PopsHandler.handleEventDetails(
  8562. guid,
  8563. $shadowContainer,
  8564. $shadowRoot,
  8565. PopsType,
  8566. // @ts-ignore
  8567. animElement,
  8568. popsElement,
  8569. maskElement,
  8570. config
  8571. );
  8572. PopsHandler.handleClickEvent(
  8573. // @ts-ignore
  8574. btnCloseElement,
  8575. "close",
  8576. eventDetails,
  8577. // @ts-ignore
  8578. config.btn.close.callback
  8579. );
  8580. PopsHandler.handleClickEvent(
  8581. // @ts-ignore
  8582. btnOkElement,
  8583. "ok",
  8584. eventDetails,
  8585. // @ts-ignore
  8586. config.btn.ok.callback
  8587. );
  8588. PopsHandler.handleClickEvent(
  8589. // @ts-ignore
  8590. btnCancelElement,
  8591. "cancel",
  8592. eventDetails,
  8593. // @ts-ignore
  8594. config.btn.cancel.callback
  8595. );
  8596. PopsHandler.handleClickEvent(
  8597. // @ts-ignore
  8598. btnOtherElement,
  8599. "other",
  8600. eventDetails,
  8601. // @ts-ignore
  8602. config.btn.other.callback
  8603. );
  8604. /* 创建到页面中 */
  8605. // @ts-ignore
  8606. PopsUtils.appendChild($shadowRoot, elementList);
  8607. if (typeof config.beforeAppendToPageCallBack === "function") {
  8608. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  8609. }
  8610. // @ts-ignore
  8611. PopsUtils.appendChild($shadowContainer);
  8612. if (maskElement != null) {
  8613. animElement.after(maskElement);
  8614. }
  8615. /* 添加文件信息 */
  8616. config.folder.sort();
  8617. /**
  8618. * 创建文件夹元素
  8619. * @param {string} fileName
  8620. * @param {string} [fileSize="-"]
  8621. * @param {string} [latestTime="-"]
  8622. */
  8623. function createFolderRowElement(
  8624. fileName,
  8625. latestTime = "-",
  8626. fileSize = "-"
  8627. ) {
  8628. let origin_fileName = fileName;
  8629. let origin_latestTime = latestTime;
  8630. let origin_fileSize = fileSize;
  8631. // @ts-ignore
  8632. let folderELement = PopsDOMUtils.createElement("tr");
  8633. // @ts-ignore
  8634. let fileNameElement = PopsDOMUtils.createElement("td");
  8635. // @ts-ignore
  8636. let fileTimeElement = PopsDOMUtils.createElement("td");
  8637. // @ts-ignore
  8638. let fileFormatSize = PopsDOMUtils.createElement("td");
  8639. let fileType = "";
  8640. let fileIcon = Folder_ICON.folder;
  8641. if (arguments.length === 1) {
  8642. /* 文件夹 */
  8643. latestTime = "";
  8644. fileSize = "";
  8645. } else {
  8646. /* 文件 */
  8647. fileIcon = "";
  8648. if (typeof latestTime === "number") {
  8649. latestTime = PopsUtils.formatTime(latestTime);
  8650. }
  8651. if (typeof fileSize === "number") {
  8652. // @ts-ignore
  8653. fileSize = PopsUtils.formatByteToSize(fileSize);
  8654. }
  8655. for (let keyName in Folder_ICON) {
  8656. if (fileName.toLowerCase().endsWith("." + keyName)) {
  8657. fileType = keyName;
  8658. // @ts-ignore
  8659. fileIcon = Folder_ICON[keyName];
  8660. break;
  8661. }
  8662. }
  8663. if (!Boolean(fileIcon)) {
  8664. fileType = "Null";
  8665. fileIcon = Folder_ICON.Null;
  8666. }
  8667. }
  8668. folderELement.className = "pops-folder-list-table__body-row";
  8669. fileNameElement.className = "pops-folder-list-table__body-td";
  8670. fileTimeElement.className = "pops-folder-list-table__body-td";
  8671. fileFormatSize.className = "pops-folder-list-table__body-td";
  8672. fileNameElement.innerHTML = `
  8673. <div class="pops-folder-list-file-name cursor-p">
  8674. <div>
  8675. <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
  8676. <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
  8677. ${fileName}
  8678. </a>
  8679. </div>
  8680. </div>
  8681. `;
  8682. fileTimeElement.innerHTML = `
  8683. <div class="pops-folder-list__time">
  8684. <span>${latestTime}</span>
  8685. </div>
  8686. `;
  8687. fileFormatSize.innerHTML = `
  8688. <div class="pops-folder-list-format-size">
  8689. <span>${fileSize}</span>
  8690. </div>
  8691. `;
  8692. /* 存储原来的值 */
  8693. let __value__ = {
  8694. fileName: origin_fileName,
  8695. latestTime: origin_latestTime,
  8696. fileSize: origin_fileSize,
  8697. };
  8698. // @ts-ignore
  8699. fileNameElement["__value__"] = __value__;
  8700. // @ts-ignore
  8701. fileTimeElement["__value__"] = __value__;
  8702. // @ts-ignore
  8703. fileFormatSize["__value__"] = __value__;
  8704. // @ts-ignore
  8705. folderELement["__value__"] = __value__;
  8706. folderELement.appendChild(fileNameElement);
  8707. folderELement.appendChild(fileTimeElement);
  8708. folderELement.appendChild(fileFormatSize);
  8709. return {
  8710. folderELement,
  8711. fileNameElement,
  8712. fileTimeElement,
  8713. fileFormatSize,
  8714. };
  8715. }
  8716. /**
  8717. * 创建移动端文件夹元素
  8718. * @param {string} fileName
  8719. */
  8720. function createMobileFolderRowElement(
  8721. fileName,
  8722. latestTime = "-",
  8723. fileSize = "-"
  8724. ) {
  8725. let origin_fileName = fileName;
  8726. let origin_latestTime = latestTime;
  8727. let origin_fileSize = fileSize;
  8728. // @ts-ignore
  8729. let folderELement = PopsDOMUtils.createElement("tr");
  8730. // @ts-ignore
  8731. let fileNameElement = PopsDOMUtils.createElement("td");
  8732. let fileType = "";
  8733. let fileIcon = Folder_ICON.folder;
  8734. if (arguments.length === 1) {
  8735. /* 文件夹 */
  8736. latestTime = "";
  8737. fileSize = "";
  8738. } else {
  8739. /* 文件 */
  8740. fileIcon = "";
  8741. if (typeof latestTime === "number") {
  8742. latestTime = PopsUtils.formatTime(latestTime);
  8743. }
  8744. if (typeof fileSize === "number") {
  8745. // @ts-ignore
  8746. fileSize = PopsUtils.formatByteToSize(fileSize);
  8747. }
  8748. for (let keyName in Folder_ICON) {
  8749. if (fileName.toLowerCase().endsWith("." + keyName)) {
  8750. fileType = keyName;
  8751. // @ts-ignore
  8752. fileIcon = Folder_ICON[keyName];
  8753. break;
  8754. }
  8755. }
  8756. if (!Boolean(fileIcon)) {
  8757. fileType = "Null";
  8758. fileIcon = Folder_ICON.Null;
  8759. }
  8760. }
  8761. folderELement.className = "pops-folder-list-table__body-row";
  8762. fileNameElement.className = "pops-folder-list-table__body-td";
  8763. fileNameElement.innerHTML = `
  8764. <div class="pops-folder-list-file-name pops-mobile-folder-list-file-name cursor-p">
  8765. <img src="${fileIcon}" alt="${fileType}" class="pops-folder-list-file-icon u-file-icon u-file-icon--list">
  8766. <div>
  8767. <a title="${fileName}" class="pops-folder-list-file-name-title-text inline-block-v-middle text-ellip list-name-text">
  8768. ${fileName}
  8769. </a>
  8770. <span>${latestTime} ${fileSize}</span>
  8771. </div>
  8772. </div>
  8773. `;
  8774. /* 存储原来的值 */
  8775. let __value__ = {
  8776. fileName: origin_fileName,
  8777. latestTime: origin_latestTime,
  8778. fileSize: origin_fileSize,
  8779. };
  8780. // @ts-ignore
  8781. fileNameElement["__value__"] = __value__;
  8782. // @ts-ignore
  8783. folderELement["__value__"] = __value__;
  8784. folderELement.appendChild(fileNameElement);
  8785. return {
  8786. folderELement,
  8787. fileNameElement,
  8788. };
  8789. }
  8790. /**
  8791. * 清空每行的元素
  8792. */
  8793. function clearFolerRow() {
  8794. // @ts-ignore
  8795. folderListBodyElement.innerHTML = "";
  8796. }
  8797. function getArrowIconElement() {
  8798. // @ts-ignore
  8799. let iconArrowElement = PopsDOMUtils.createElement("div", {
  8800. className: "iconArrow",
  8801. });
  8802. return iconArrowElement;
  8803. }
  8804. /**
  8805. * 添加顶部导航
  8806. * @param {string} name
  8807. * @param {PopsFolderDataConfig} _config_
  8808. * @returns
  8809. */
  8810. function getBreadcrumbAllFilesElement(name, _config_) {
  8811. let spanElement = PopsDOMUtils.createElement(
  8812. "span",
  8813. {
  8814. className: "pops-folder-file-list-breadcrumb-allFiles cursor-p",
  8815. innerHTML: `<a>${name}</a>`,
  8816. // @ts-ignore
  8817. _config_: _config_,
  8818. },
  8819. {
  8820. title: "name",
  8821. }
  8822. );
  8823. return spanElement;
  8824. }
  8825. /**
  8826. * 顶部导航的点击事件
  8827. * @param {Event} event
  8828. * @param {boolean} isTop 是否是全部文件按钮
  8829. * @param {PopsFolderDataConfig} _config_ 配置
  8830. */
  8831. // @ts-ignore
  8832. // @ts-ignore
  8833. function breadcrumbAllFilesElementClickEvent(event, isTop, _config_) {
  8834. clearFolerRow();
  8835. /* 获取当前的导航元素 */
  8836. // @ts-ignore
  8837. let currentBreadcrumb = event.target.closest(
  8838. "span.pops-folder-file-list-breadcrumb-allFiles"
  8839. );
  8840. if (currentBreadcrumb) {
  8841. while (currentBreadcrumb.nextElementSibling) {
  8842. currentBreadcrumb.nextElementSibling.remove();
  8843. }
  8844. } else {
  8845. console.error("获取导航按钮失败");
  8846. }
  8847. let loadingMask = pops.loading({
  8848. // @ts-ignore
  8849. parent: contentElement,
  8850. // @ts-ignore
  8851. content: {
  8852. text: "获取文件列表中...",
  8853. },
  8854. mask: {
  8855. enable: true,
  8856. clickEvent: {
  8857. toClose: false,
  8858. toHide: false,
  8859. },
  8860. },
  8861. addIndexCSS: false,
  8862. });
  8863. // @ts-ignore
  8864. addFolderElement(_config_);
  8865. loadingMask.close();
  8866. }
  8867. /**
  8868. * 刷新文件列表界面信息
  8869. * @param {Event} event
  8870. * @param {PopsFolderDataConfig} _config_
  8871. */
  8872. async function refreshFolderInfoClickEvent(event, _config_) {
  8873. clearFolerRow();
  8874. let loadingMask = pops.loading({
  8875. // @ts-ignore
  8876. parent: contentElement,
  8877. // @ts-ignore
  8878. content: {
  8879. text: "获取文件列表中...",
  8880. },
  8881. // @ts-ignore
  8882. mask: {
  8883. enable: true,
  8884. },
  8885. addIndexCSS: false,
  8886. });
  8887. if (typeof _config_.clickEvent === "function") {
  8888. // @ts-ignore
  8889. let childConfig = await _config_.clickEvent(event, _config_);
  8890. /* 添加顶部导航的箭头 */
  8891. // @ts-ignore
  8892. folderFileListBreadcrumbPrimaryElement.appendChild(
  8893. getArrowIconElement()
  8894. );
  8895. /* 获取顶部导航 */
  8896. let breadcrumbAllFilesElement = getBreadcrumbAllFilesElement(
  8897. _config_["fileName"],
  8898. // @ts-ignore
  8899. childConfig
  8900. );
  8901. // @ts-ignore
  8902. folderFileListBreadcrumbPrimaryElement.appendChild(
  8903. breadcrumbAllFilesElement
  8904. );
  8905. /* 设置顶部导航点击事件 */
  8906. // @ts-ignore
  8907. PopsDOMUtils.on(
  8908. breadcrumbAllFilesElement,
  8909. "click",
  8910. void 0,
  8911. function (event) {
  8912. // @ts-ignore
  8913. breadcrumbAllFilesElementClickEvent(event, false, childConfig);
  8914. }
  8915. );
  8916. // @ts-ignore
  8917. addFolderElement(childConfig);
  8918. }
  8919. loadingMask.close();
  8920. }
  8921. /**
  8922. * 设置文件点击事件
  8923. * @param {HTMLElement} targetElement
  8924. * @param {PopsFolderDataConfig} _config_
  8925. */
  8926. function setFileClickEvent(targetElement, _config_) {
  8927. // @ts-ignore
  8928. PopsDOMUtils.on(targetElement, "click", void 0, async function (event) {
  8929. event?.preventDefault();
  8930. event?.stopPropagation();
  8931. event?.stopImmediatePropagation();
  8932. let linkElement = targetElement.querySelector("a");
  8933. if (typeof _config_.clickEvent === "function") {
  8934. // @ts-ignore
  8935. let downloadInfo = await _config_.clickEvent(event, _config_);
  8936. if (
  8937. typeof downloadInfo === "object" &&
  8938. // @ts-ignore
  8939. typeof downloadInfo.url === "string" &&
  8940. // @ts-ignore
  8941. downloadInfo.url.trim() !== ""
  8942. ) {
  8943. // @ts-ignore
  8944. linkElement.setAttribute("href", downloadInfo.url);
  8945. // @ts-ignore
  8946. linkElement.setAttribute("target", "_blank");
  8947. // @ts-ignore
  8948. if (downloadInfo.autoDownload) {
  8949. // @ts-ignore
  8950. if (downloadInfo.mode == null || downloadInfo.mode === "") {
  8951. /* 未设置mode的话默认为aBlank */
  8952. // @ts-ignore
  8953. downloadInfo.mode = "aBlank";
  8954. }
  8955. // @ts-ignore
  8956. if (downloadInfo.mode === "a" || downloadInfo.mode === "aBlank") {
  8957. /* a标签下载 */
  8958. let downloadLinkElement = document.createElement("a");
  8959. // @ts-ignore
  8960. if (downloadInfo.mode === "aBlank") {
  8961. downloadLinkElement.setAttribute("target", "_blank");
  8962. }
  8963. // @ts-ignore
  8964. downloadLinkElement.href = downloadInfo.url;
  8965. downloadLinkElement.click();
  8966. } else if (
  8967. // @ts-ignore
  8968. downloadInfo.mode === "open" ||
  8969. // @ts-ignore
  8970. downloadInfo.mode === "openBlank"
  8971. ) {
  8972. /* window.open下载 */
  8973. // @ts-ignore
  8974. if (downloadInfo.mode === "openBlank") {
  8975. // @ts-ignore
  8976. globalThis.open(downloadInfo.url, "_blank");
  8977. } else {
  8978. // @ts-ignore
  8979. globalThis.open(downloadInfo.url);
  8980. }
  8981. // @ts-ignore
  8982. } else if (downloadInfo.mode === "iframe") {
  8983. /* iframe下载 */
  8984. let downloadIframeLinkElement =
  8985. document.createElement("iframe");
  8986. // @ts-ignore
  8987. downloadIframeLinkElement.src = downloadInfo.url;
  8988. downloadIframeLinkElement.onload = function () {
  8989. setTimeout(() => {
  8990. downloadIframeLinkElement.remove();
  8991. }, 1000);
  8992. };
  8993. $shadowRoot.appendChild(downloadIframeLinkElement);
  8994. setTimeout(() => {
  8995. downloadIframeLinkElement.remove();
  8996. }, 3 * 60 * 1000);
  8997. } else {
  8998. console.error("未知的下载模式", downloadInfo);
  8999. }
  9000. }
  9001. }
  9002. }
  9003. });
  9004. }
  9005. /**
  9006. * 对配置进行排序
  9007. * @param {PopsFolderDataConfig[]} _config_
  9008. * @param {"fileName"|"fileSize"|"latestTime"} sortName 比较的属性,默认fileName
  9009. * @param {boolean} isDesc 是否降序,默认false(升序)
  9010. */
  9011. function sortFolderConfig(_config_, sortName = "fileName", isDesc = false) {
  9012. _config_.sort((a, b) => {
  9013. let beforeVal = a[sortName];
  9014. let afterVal = b[sortName];
  9015. if (sortName === "fileName") {
  9016. /* 文件名,进行字符串转换 */
  9017. beforeVal = beforeVal.toString();
  9018. afterVal = afterVal.toString();
  9019. } else if (sortName === "fileSize") {
  9020. /* 文件大小,进行Float转换 */
  9021. // @ts-ignore
  9022. beforeVal = parseFloat(beforeVal);
  9023. // @ts-ignore
  9024. afterVal = parseFloat(afterVal);
  9025. } else if (sortName === "latestTime") {
  9026. /* 文件时间 */
  9027. beforeVal = new Date(beforeVal).getTime();
  9028. afterVal = new Date(afterVal).getTime();
  9029. }
  9030. if (typeof beforeVal === "string" && typeof afterVal === "string") {
  9031. let compareVal = beforeVal.localeCompare(afterVal);
  9032. if (isDesc) {
  9033. /* 降序 */
  9034. if (compareVal > 0) {
  9035. compareVal = -1;
  9036. } else if (compareVal < 0) {
  9037. compareVal = 1;
  9038. }
  9039. }
  9040. return compareVal;
  9041. } else {
  9042. if (beforeVal > afterVal) {
  9043. if (isDesc) {
  9044. /* 降序 */
  9045. return -1;
  9046. } else {
  9047. return 1;
  9048. }
  9049. } else if (beforeVal < afterVal) {
  9050. if (isDesc) {
  9051. /* 降序 */
  9052. return 1;
  9053. } else {
  9054. return -1;
  9055. }
  9056. } else {
  9057. return 0;
  9058. }
  9059. }
  9060. });
  9061. return _config_;
  9062. }
  9063. /**
  9064. * 添加元素
  9065. * @param {PopsFolderDataConfig[]} _config_
  9066. */
  9067. function addFolderElement(_config_) {
  9068. sortFolderConfig(_config_, config.sort.name, config.sort.isDesc);
  9069. _config_.forEach((item) => {
  9070. if (item["isFolder"]) {
  9071. let { folderELement, fileNameElement } = pops.isPhone()
  9072. ? createMobileFolderRowElement(item["fileName"])
  9073. : createFolderRowElement(item["fileName"]);
  9074. // @ts-ignore
  9075. PopsDOMUtils.on(fileNameElement, "click", void 0, function (event) {
  9076. refreshFolderInfoClickEvent(event, item);
  9077. });
  9078. // @ts-ignore
  9079. folderListBodyElement.appendChild(folderELement);
  9080. } else {
  9081. let { folderELement, fileNameElement } = pops.isPhone()
  9082. ? createMobileFolderRowElement(
  9083. item["fileName"],
  9084. // @ts-ignore
  9085. item["latestTime"],
  9086. item["fileSize"]
  9087. )
  9088. : createFolderRowElement(
  9089. item["fileName"],
  9090. // @ts-ignore
  9091. item["latestTime"],
  9092. item["fileSize"]
  9093. );
  9094. setFileClickEvent(fileNameElement, item);
  9095. // @ts-ignore
  9096. folderListBodyElement.appendChild(folderELement);
  9097. }
  9098. });
  9099. }
  9100. addFolderElement(config.folder);
  9101. /* 将数据存到全部文件的属性_config_中 */
  9102. // @ts-ignore
  9103. let allFilesElement = folderFileListBreadcrumbPrimaryElement.querySelector(
  9104. ".pops-folder-list .pops-folder-file-list-breadcrumb-allFiles:first-child"
  9105. );
  9106. // @ts-ignore
  9107. allFilesElement._config_ = config.folder;
  9108. /* 设置点击顶部的全部文件事件 */
  9109. // @ts-ignore
  9110. PopsDOMUtils.on(allFilesElement, "click", void 0, function (event) {
  9111. // @ts-ignore
  9112. breadcrumbAllFilesElementClickEvent(event, true, config.folder);
  9113. });
  9114.  
  9115. /* 移除所有的当前排序的arrow */
  9116. function removeAllArrowActive() {
  9117. [
  9118. // @ts-ignore
  9119. ...folderListSortFileNameElement.querySelectorAll(
  9120. ".pops-folder-icon-active"
  9121. ),
  9122. // @ts-ignore
  9123. ...folderListSortLatestTimeElement.querySelectorAll(
  9124. ".pops-folder-icon-active"
  9125. ),
  9126. // @ts-ignore
  9127. ...folderListSortFileSizeElement.querySelectorAll(
  9128. ".pops-folder-icon-active"
  9129. ),
  9130. ].forEach((ele) => ele.classList.remove("pops-folder-icon-active"));
  9131. }
  9132. /* 设置当前的排序的arrow */
  9133. // @ts-ignore
  9134. function changeArrowActive(arrowUp, arrowDown, isDesc) {
  9135. removeAllArrowActive();
  9136. if (isDesc) {
  9137. arrowDown.classList.add("pops-folder-icon-active");
  9138. } else {
  9139. arrowUp.classList.add("pops-folder-icon-active");
  9140. }
  9141. }
  9142. /**
  9143. * 排序按钮的点击事件
  9144. * @param {PointerEvent} target
  9145. * @param {HTMLElement} event
  9146. * @param {string} sortName
  9147. * @returns
  9148. */
  9149. function arrowSortClickEvent(target, event, sortName) {
  9150. // @ts-ignore
  9151. if (!event["notChangeSortRule"]) {
  9152. // @ts-ignore
  9153. config.sort.name = sortName;
  9154. config.sort.isDesc = !config.sort.isDesc;
  9155. }
  9156. // @ts-ignore
  9157. let arrowUp = target.querySelector(".pops-folder-icon-arrow-up");
  9158. // @ts-ignore
  9159. let arrowDown = target.querySelector(".pops-folder-icon-arrow-down");
  9160. changeArrowActive(arrowUp, arrowDown, config.sort.isDesc);
  9161. if (
  9162. typeof config.sort.callback === "function" &&
  9163. config.sort.callback(
  9164. // @ts-ignore
  9165. target,
  9166. event,
  9167. config.sort.name,
  9168. config.sort.isDesc
  9169. )
  9170. ) {
  9171. return;
  9172. }
  9173. // @ts-ignore
  9174. let childrenList = [];
  9175. // @ts-ignore
  9176. Array.from(folderListBodyElement.children).forEach((trElement) => {
  9177. // @ts-ignore
  9178. let __value__ = trElement["__value__"];
  9179. __value__["target"] = trElement;
  9180. childrenList.push(__value__);
  9181. });
  9182. let sortedConfigList = sortFolderConfig(
  9183. // @ts-ignore
  9184. childrenList,
  9185. config.sort.name,
  9186. config.sort.isDesc
  9187. );
  9188. sortedConfigList.forEach((item) => {
  9189. // @ts-ignore
  9190. folderListBodyElement.appendChild(item.target);
  9191. });
  9192. }
  9193. /* 设置当前排序的图标按钮 */
  9194. PopsDOMUtils.on(
  9195. // @ts-ignore
  9196. folderListSortFileNameElement.closest("th"),
  9197. "click",
  9198. void 0,
  9199. function (event) {
  9200. // @ts-ignore
  9201. arrowSortClickEvent(folderListSortFileNameElement, event, "fileName");
  9202. },
  9203. {
  9204. capture: true,
  9205. }
  9206. );
  9207. PopsDOMUtils.on(
  9208. // @ts-ignore
  9209. folderListSortLatestTimeElement.closest("th"),
  9210. "click",
  9211. void 0,
  9212. function (event) {
  9213. arrowSortClickEvent(
  9214. // @ts-ignore
  9215. folderListSortLatestTimeElement,
  9216. event,
  9217. "latestTime"
  9218. );
  9219. },
  9220. {
  9221. capture: true,
  9222. }
  9223. );
  9224. PopsDOMUtils.on(
  9225. // @ts-ignore
  9226. folderListSortFileSizeElement.closest("th"),
  9227. "click",
  9228. void 0,
  9229. function (event) {
  9230. // @ts-ignore
  9231. arrowSortClickEvent(folderListSortFileSizeElement, event, "fileSize");
  9232. },
  9233. {
  9234. capture: true,
  9235. }
  9236. );
  9237. /* 设置默认触发的arrow */
  9238. if (config.sort.name === "fileName") {
  9239. // @ts-ignore
  9240. PopsDOMUtils.trigger(folderListSortFileNameElement, "click", {
  9241. notChangeSortRule: true,
  9242. });
  9243. } else if (config.sort.name === "latestTime") {
  9244. // @ts-ignore
  9245. PopsDOMUtils.trigger(folderListSortLatestTimeElement, "click", {
  9246. notChangeSortRule: true,
  9247. });
  9248. } else if (config.sort.name === "fileSize") {
  9249. // @ts-ignore
  9250. PopsDOMUtils.trigger(folderListSortFileSizeElement, "click", {
  9251. notChangeSortRule: true,
  9252. });
  9253. }
  9254. /* 拖拽 */
  9255. if (config.drag) {
  9256. // @ts-ignore
  9257. PopsUtils.drag(popsElement, {
  9258. dragElement: titleElement,
  9259. limit: config.dragLimit,
  9260. extraDistance: config.dragExtraDistance,
  9261. moveCallBack: config.dragMoveCallBack,
  9262. endCallBack: config.dragEndCallBack,
  9263. });
  9264. }
  9265. PopsHandler.handlePush(PopsType, {
  9266. guid: guid,
  9267. // @ts-ignore
  9268. animElement: animElement,
  9269. // @ts-ignore
  9270. popsElement: popsElement,
  9271. // @ts-ignore
  9272. maskElement: maskElement,
  9273. $shadowContainer: $shadowContainer,
  9274. $shadowRoot: $shadowRoot,
  9275. });
  9276. return PopsHandler.handleResultDetails(eventDetails);
  9277. };
  9278.  
  9279. /**
  9280. * 配置面板
  9281. * @param { PopsPanelDetails } details 配置
  9282. */
  9283. pops.panel = function (details) {
  9284. // @ts-ignore
  9285. // @ts-ignore
  9286. let that = this;
  9287. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  9288. PopsHandler.handleInit($shadowRoot, [
  9289. pops.config.cssText.index,
  9290. pops.config.cssText.ninePalaceGridPosition,
  9291. pops.config.cssText.scrollbar,
  9292. pops.config.cssText.button,
  9293. pops.config.cssText.anim,
  9294. pops.config.cssText.common,
  9295. pops.config.cssText.panelCSS,
  9296. ]);
  9297. /**
  9298. * @type {Required<PopsPanelDetails>}
  9299. */
  9300. let config = {
  9301. title: {
  9302. text: "默认标题",
  9303. position: "center",
  9304. html: false,
  9305. style: "",
  9306. },
  9307. content: [
  9308. {
  9309. id: "whitesev-panel-config-1",
  9310. title: "菜单配置1",
  9311. headerTitle: "菜单配置1",
  9312. isDefault: true,
  9313. attributes: [
  9314. {
  9315. "data-test": "test",
  9316. "data-test-2": "test2",
  9317. },
  9318. ],
  9319. forms: [
  9320. {
  9321. className: "forms-1",
  9322. text: "区域设置",
  9323. type: "forms",
  9324. attributes: [],
  9325. forms: [
  9326. {
  9327. className: "panel-switch",
  9328. text: "switch",
  9329. type: "switch",
  9330. attributes: [],
  9331. getValue() {
  9332. return true;
  9333. },
  9334. // @ts-ignore
  9335. // @ts-ignore
  9336. callback(event, value) {
  9337. console.log("按钮开启状态:", value);
  9338. },
  9339. },
  9340. // @ts-ignore
  9341. {
  9342. className: "panel-slider",
  9343. text: "slider",
  9344. type: "slider",
  9345. attributes: [],
  9346. getValue() {
  9347. return 50;
  9348. },
  9349. // @ts-ignore
  9350. // @ts-ignore
  9351. callback(event, value) {
  9352. console.log("滑块当前数值:", value);
  9353. },
  9354. min: 1,
  9355. max: 100,
  9356. },
  9357. {
  9358. className: "panel-button",
  9359. text: "button",
  9360. type: "button",
  9361. attributes: [],
  9362. buttonIcon: "eleme",
  9363. buttonIconIsLoading: true,
  9364. buttonType: "warning",
  9365. buttonText: "warning按钮",
  9366. callback(event) {
  9367. console.log("点击按钮", event);
  9368. },
  9369. },
  9370. {
  9371. className: "panel-button",
  9372. text: "button",
  9373. type: "button",
  9374. attributes: [],
  9375. buttonIcon: "chromeFilled",
  9376. buttonIconIsLoading: true,
  9377. buttonType: "danger",
  9378. buttonText: "danger按钮",
  9379. callback(event) {
  9380. console.log("点击按钮", event);
  9381. },
  9382. },
  9383. {
  9384. className: "panel-button",
  9385. text: "button",
  9386. type: "button",
  9387. attributes: [],
  9388. buttonIcon: "upload",
  9389. buttonIconIsLoading: false,
  9390. buttonType: "info",
  9391. buttonText: "info按钮",
  9392. callback(event) {
  9393. console.log("点击按钮", event);
  9394. },
  9395. },
  9396. ],
  9397. },
  9398. ],
  9399. },
  9400. {
  9401. id: "whitesev-panel-config-2",
  9402. title: "菜单配置2",
  9403. headerTitle: "菜单配置2",
  9404. isDefault: false,
  9405. attributes: [
  9406. {
  9407. "data-value": "value",
  9408. "data-value-2": "value2",
  9409. },
  9410. ],
  9411. forms: [
  9412. {
  9413. className: "panel-input",
  9414. text: "input",
  9415. type: "input",
  9416. attributes: [],
  9417. // @ts-ignore
  9418. getValue() {
  9419. return 50;
  9420. },
  9421. // @ts-ignore
  9422. // @ts-ignore
  9423. callback(event, value) {
  9424. console.log("输入框内容改变:", value);
  9425. },
  9426. placeholder: "请输入内容",
  9427. },
  9428. {
  9429. className: "panel-input-password",
  9430. text: "input-password",
  9431. type: "input",
  9432. attributes: [],
  9433. getValue() {
  9434. return "123456";
  9435. },
  9436. // @ts-ignore
  9437. // @ts-ignore
  9438. callback(event, value) {
  9439. console.log("密码输入框内容改变:", value);
  9440. },
  9441. isPassword: true,
  9442. placeholder: "请输入密码",
  9443. },
  9444. {
  9445. className: "panel-textarea",
  9446. text: "textarea",
  9447. type: "textarea",
  9448. attributes: [],
  9449. // @ts-ignore
  9450. getValue() {
  9451. return 50;
  9452. },
  9453. // @ts-ignore
  9454. // @ts-ignore
  9455. callback(event, value) {
  9456. console.log("textarea输入框内容改变:", value);
  9457. },
  9458. placeholder: "请输入内容",
  9459. },
  9460. {
  9461. className: "panel-select",
  9462. text: "select",
  9463. type: "select",
  9464. attributes: [],
  9465. getValue() {
  9466. return 50;
  9467. },
  9468. // @ts-ignore
  9469. // @ts-ignore
  9470. callback(event, isSelectedValue, isSelectedText) {
  9471. console.log(
  9472. `select当前选项:${isSelectedValue},当前选项文本:${isSelectedText}`
  9473. );
  9474. },
  9475. data: [
  9476. {
  9477. value: "all",
  9478. text: "所有",
  9479. },
  9480. {
  9481. value: "text",
  9482. text: "文本",
  9483. // @ts-ignore
  9484. selected: true,
  9485. },
  9486. {
  9487. value: "html",
  9488. text: "超文本",
  9489. },
  9490. ],
  9491. },
  9492. ],
  9493. },
  9494. ],
  9495. btn: {
  9496. close: {
  9497. enable: true,
  9498. callback(event) {
  9499. event.close();
  9500. },
  9501. },
  9502. },
  9503. mask: {
  9504. enable: false,
  9505. clickEvent: {
  9506. toClose: false,
  9507. toHide: false,
  9508. },
  9509. // @ts-ignore
  9510. clickCallBack: null,
  9511. },
  9512. class: "",
  9513. mobileClassName: "pops-panel-is-mobile",
  9514. isMobile: false,
  9515. only: false,
  9516. width: "700px",
  9517. height: "500px",
  9518. position: "center",
  9519. animation: "pops-anim-fadein-zoom",
  9520. zIndex: 10000,
  9521. drag: false,
  9522. dragLimit: true,
  9523. dragExtraDistance: 3,
  9524. dragMoveCallBack() {},
  9525. dragEndCallBack() {},
  9526. forbiddenScroll: false,
  9527. // @ts-ignore
  9528. style: void 0,
  9529. beforeAppendToPageCallBack() {},
  9530. };
  9531. config = PopsUtils.assignJSON(config, details);
  9532. if (details && Array.isArray(details.content)) {
  9533. config.content = details.content;
  9534. }
  9535. let guid = PopsUtils.getRandomGUID();
  9536. const PopsType = "panel";
  9537. // @ts-ignore
  9538. config = PopsHandler.handleOnly(PopsType, config);
  9539. // @ts-ignore
  9540. let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
  9541. // @ts-ignore
  9542. let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
  9543. let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
  9544. PopsType,
  9545. // @ts-ignore
  9546. config
  9547. );
  9548.  
  9549. let animHTML = PopsElementHandler.getAnimHTML(
  9550. guid,
  9551. PopsType,
  9552. config,
  9553. `
  9554. <div
  9555. class="pops-${PopsType}-title"
  9556. style="text-align: ${config.title.position};
  9557. ${headerStyle}">
  9558. ${
  9559. config.title.html
  9560. ? config.title.text
  9561. : `<p pops style="${headerPStyle}">${config.title.text}</p>`
  9562. }
  9563. ${headerBtnHTML}
  9564. </div>
  9565. <div class="pops-${PopsType}-content">
  9566. <aside class="pops-${PopsType}-aside">
  9567. <ul></ul>
  9568. </aside>
  9569. <section class="pops-${PopsType}-container">
  9570. <ul class="pops-panel-container-header-ul"></ul>
  9571. <ul></ul>
  9572. </section>
  9573. </div>
  9574. `,
  9575. ""
  9576. );
  9577. /**
  9578. * 弹窗的主元素,包括动画层
  9579. */
  9580. let animElement = PopsElementHandler.parseElement(animHTML);
  9581. /* 结构元素 */
  9582. let {
  9583. popsElement,
  9584. headerCloseBtnElement: btnCloseElement,
  9585. titleElement,
  9586. // @ts-ignore
  9587. // @ts-ignore
  9588. contentElement,
  9589. contentAsideElement,
  9590. contentSectionContainerElement,
  9591. // @ts-ignore
  9592. } = PopsHandler.handleQueryElement(animElement, PopsType);
  9593. if (config.isMobile || pops.isPhone()) {
  9594. // @ts-ignore
  9595. PopsDOMUtils.addClassName(popsElement, config.mobileClassName);
  9596. }
  9597. /**
  9598. * 遮罩层元素
  9599. * @type {?HTMLDivElement}
  9600. */
  9601. let maskElement = null;
  9602. /**
  9603. * 已创建的元素列表
  9604. * @type {HTMLElement[]}
  9605. */
  9606. let elementList = [animElement];
  9607.  
  9608. /* 遮罩层元素 */
  9609. // @ts-ignore
  9610. if (config.mask.enable) {
  9611. let _handleMask_ = PopsHandler.handleMask({
  9612. type: PopsType,
  9613. guid: guid,
  9614. // @ts-ignore
  9615. config: config,
  9616. animElement: animElement,
  9617. maskHTML: maskHTML,
  9618. });
  9619. maskElement = _handleMask_.maskElement;
  9620. elementList.push(maskElement);
  9621. }
  9622.  
  9623. /* 处理返回的配置 */
  9624. let eventDetails = PopsHandler.handleEventDetails(
  9625. guid,
  9626. $shadowContainer,
  9627. $shadowRoot,
  9628. PopsType,
  9629. // @ts-ignore
  9630. animElement,
  9631. popsElement,
  9632. maskElement,
  9633. config
  9634. );
  9635. /* 为顶部右边的关闭按钮添加点击事件 */
  9636. PopsHandler.handleClickEvent(
  9637. // @ts-ignore
  9638. btnCloseElement,
  9639. "close",
  9640. eventDetails,
  9641. // @ts-ignore
  9642. config.btn.close.callback
  9643. );
  9644.  
  9645. /* 创建到页面中 */
  9646. // @ts-ignore
  9647. PopsUtils.appendChild($shadowRoot, elementList);
  9648. if (typeof config.beforeAppendToPageCallBack === "function") {
  9649. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  9650. }
  9651. // @ts-ignore
  9652. PopsUtils.appendChild($shadowContainer);
  9653. /* 追加遮罩层元素 */
  9654. if (maskElement != null) {
  9655. animElement.after(maskElement);
  9656. }
  9657.  
  9658. /**
  9659. * 处理内部配置
  9660. */
  9661. const HandleContetDetails = {
  9662. /**
  9663. * @type {HTMLUListElement}
  9664. */
  9665. // @ts-ignore
  9666. asideULElement: null,
  9667. /**
  9668. * @type {HTMLUListElement}
  9669. */
  9670. // @ts-ignore
  9671. sectionContainerHeaderULElement: null,
  9672. /**
  9673. * @type {HTMLUListElement}
  9674. */
  9675. // @ts-ignore
  9676. sectionContainerULElement: null,
  9677. init() {
  9678. // @ts-ignore
  9679. this.asideULElement = contentAsideElement.querySelector("ul");
  9680. this.sectionContainerHeaderULElement =
  9681. // @ts-ignore
  9682. contentSectionContainerElement.querySelectorAll("ul")[0];
  9683. this.sectionContainerULElement =
  9684. // @ts-ignore
  9685. contentSectionContainerElement.querySelectorAll("ul")[1];
  9686. /**
  9687. * 默认点击的左侧容器
  9688. * @type {HTMLLIElement}
  9689. */
  9690. // @ts-ignore
  9691. let asideDefaultItemElement = null;
  9692. let isScrollToDefaultView = false;
  9693. config.content.forEach((asideItem) => {
  9694. let asideLiElement = this.getAsideItem(asideItem);
  9695. this.setAsideItemClickEvent(asideLiElement, asideItem);
  9696. this.asideULElement.appendChild(asideLiElement);
  9697. if (asideDefaultItemElement == null) {
  9698. let flag = false;
  9699. if (typeof asideItem.isDefault === "function") {
  9700. flag = Boolean(asideItem.isDefault());
  9701. } else {
  9702. flag = Boolean(asideItem.isDefault);
  9703. }
  9704. if (flag) {
  9705. asideDefaultItemElement = asideLiElement;
  9706. isScrollToDefaultView = Boolean(asideItem.scrollToDefaultView);
  9707. }
  9708. }
  9709. });
  9710.  
  9711. /* 点击左侧列表 */
  9712. if (
  9713. asideDefaultItemElement == null &&
  9714. this.asideULElement.children.length
  9715. ) {
  9716. /* 默认第一个 */
  9717. // @ts-ignore
  9718. asideDefaultItemElement = this.asideULElement.children[0];
  9719. }
  9720. if (asideDefaultItemElement) {
  9721. /* 点击选择的那一项 */
  9722. asideDefaultItemElement.click();
  9723. if (isScrollToDefaultView) {
  9724. asideDefaultItemElement?.scrollIntoView();
  9725. }
  9726. } else {
  9727. console.error("左侧容器没有项");
  9728. }
  9729. },
  9730. /**
  9731. * 清空container容器的元素
  9732. */
  9733. clearContainer() {
  9734. this.sectionContainerHeaderULElement.innerHTML = "";
  9735. this.sectionContainerULElement.innerHTML = "";
  9736. },
  9737. /**
  9738. * 清空左侧容器已访问记录
  9739. */
  9740. clearAsideItemIsVisited() {
  9741. // @ts-ignore
  9742. contentAsideElement
  9743. .querySelectorAll(".pops-is-visited")
  9744. .forEach((element) => {
  9745. // @ts-ignore
  9746. PopsDOMUtils.removeClassName(element, "pops-is-visited");
  9747. });
  9748. },
  9749. /**
  9750. * 设置左侧容器已访问记录
  9751. * @param {HTMLElement} element
  9752. */
  9753. setAsideItemIsVisited(element) {
  9754. PopsDOMUtils.addClassName(element, "pops-is-visited");
  9755. },
  9756. /**
  9757. * 为元素添加自定义属性
  9758. * @param {HTMLElement} element
  9759. * @param {object | object[]} attributes
  9760. */
  9761. addElementAttributes(element, attributes) {
  9762. if (attributes == null) {
  9763. return;
  9764. }
  9765. if (Array.isArray(attributes)) {
  9766. attributes.forEach((attrObject) => {
  9767. this.addElementAttributes(element, attrObject);
  9768. });
  9769. } else {
  9770. Object.keys(attributes).forEach((attributeName) => {
  9771. // @ts-ignore
  9772. element.setAttribute(attributeName, attributes[attributeName]);
  9773. });
  9774. }
  9775. },
  9776. /**
  9777. * 为元素设置(自定义)属性
  9778. * @param {HTMLElement} element
  9779. * @param {?HTMLElement} props
  9780. */
  9781. setElementProps(element, props) {
  9782. if (props == null) {
  9783. return;
  9784. }
  9785. Object.keys(props).forEach((propName) => {
  9786. // @ts-ignore
  9787. element[propName] = props[propName];
  9788. });
  9789. },
  9790. /**
  9791. * 获取左侧容器元素<li>
  9792. * @param { PopsPanelContentConfig } asideConfig
  9793. * @returns
  9794. */
  9795. getAsideItem(asideConfig) {
  9796. let liElement = document.createElement("li");
  9797. liElement.id = asideConfig.id;
  9798. // @ts-ignore
  9799. liElement.__forms__ = asideConfig.forms;
  9800. liElement.innerHTML = asideConfig.title;
  9801. // @ts-ignore
  9802. this.addElementAttributes(liElement, asideConfig.attributes);
  9803. // @ts-ignore
  9804. this.setElementProps(liElement, asideConfig.props);
  9805. return liElement;
  9806. },
  9807. /**
  9808. * 获取中间容器的元素<li>
  9809. * type ==> switch
  9810. * @param {PopsPanelSwitchDetails} formConfig
  9811. * @returns
  9812. */
  9813. getSectionContainerItem_switch(formConfig) {
  9814. // @ts-ignore
  9815. // @ts-ignore
  9816. function setSwitchChecked(
  9817. // @ts-ignore
  9818. switchElement,
  9819. // @ts-ignore
  9820. switchInputElement,
  9821. checked = false
  9822. ) {
  9823. switchInputElement.checked = Boolean(checked);
  9824. if (checked) {
  9825. PopsDOMUtils.addClassName(
  9826. switchElement,
  9827. "pops-panel-switch-is-checked"
  9828. );
  9829. } else {
  9830. PopsDOMUtils.removeClassName(
  9831. switchElement,
  9832. "pops-panel-switch-is-checked"
  9833. );
  9834. }
  9835. }
  9836. let liElement = document.createElement("li");
  9837. // @ts-ignore
  9838. liElement.__formConfig__ = formConfig;
  9839. if (formConfig.className) {
  9840. liElement.className = formConfig.className;
  9841. }
  9842. // @ts-ignore
  9843. this.addElementAttributes(liElement, formConfig.attributes);
  9844. // @ts-ignore
  9845. this.setElementProps(liElement, formConfig.props);
  9846. /* 左边底部的描述的文字 */
  9847. let leftDescriptionText = "";
  9848. if (Boolean(formConfig.description)) {
  9849. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  9850. }
  9851. liElement.innerHTML = `
  9852. <div class="pops-panel-item-left-text">
  9853. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  9854. ${leftDescriptionText}
  9855. </div>
  9856. <div class="pops-panel-switch">
  9857. <input class="pops-panel-switch__input" type="checkbox">
  9858. <span class="pops-panel-switch__core">
  9859. <div class="pops-panel-switch__action">
  9860. </div>
  9861. </span>
  9862. </div>
  9863. `;
  9864. const PopsPanelSwitch = {
  9865. [Symbol.toStringTag]: "PopsPanelSwitch",
  9866. $data: {
  9867. value: Boolean(formConfig.getValue()),
  9868. },
  9869. $ele: {
  9870. /**
  9871. * @type {HTMLDivElement}
  9872. */
  9873. // @ts-ignore
  9874. switch: liElement.querySelector(".pops-panel-switch"),
  9875. /**
  9876. * @type {HTMLInputElement}
  9877. */
  9878. // @ts-ignore
  9879. input: liElement.querySelector(".pops-panel-switch__input"),
  9880. /**
  9881. * @type {HTMLSpanElement}
  9882. */
  9883. // @ts-ignore
  9884. core: liElement.querySelector(".pops-panel-switch__core"),
  9885. },
  9886. init() {
  9887. this.setStatus(this.$data.value);
  9888. if (formConfig.disabled) {
  9889. this.disable();
  9890. }
  9891. this.setClickEvent();
  9892. },
  9893. setClickEvent() {
  9894. let that = this;
  9895. // @ts-ignore
  9896. PopsDOMUtils.on(this.$ele.core, "click", void 0, function (event) {
  9897. if (
  9898. that.$ele.input.disabled ||
  9899. that.$ele.switch.hasAttribute("data-disabled")
  9900. ) {
  9901. return;
  9902. }
  9903. that.$data.value = that.getStatus();
  9904. that.setStatus(that.$data.value);
  9905. if (typeof formConfig.callback === "function") {
  9906. // @ts-ignore
  9907. formConfig.callback(event, that.$data.value);
  9908. }
  9909. });
  9910. },
  9911. /**
  9912. * 设置状态
  9913. */
  9914. setStatus(isChecked = false) {
  9915. isChecked = Boolean(isChecked);
  9916. this.$ele.input.checked = isChecked;
  9917. if (isChecked) {
  9918. PopsDOMUtils.addClassName(
  9919. this.$ele.switch,
  9920. "pops-panel-switch-is-checked"
  9921. );
  9922. } else {
  9923. PopsDOMUtils.removeClassName(
  9924. this.$ele.switch,
  9925. "pops-panel-switch-is-checked"
  9926. );
  9927. }
  9928. },
  9929. /**
  9930. * 根据className来获取逆反值
  9931. */
  9932. getStatus() {
  9933. let checkedValue = false;
  9934. if (
  9935. !PopsDOMUtils.containsClassName(
  9936. this.$ele.switch,
  9937. "pops-panel-switch-is-checked"
  9938. )
  9939. ) {
  9940. checkedValue = true;
  9941. }
  9942. return checkedValue;
  9943. },
  9944. /**
  9945. * 禁用复选框
  9946. */
  9947. disable() {
  9948. this.$ele.input.disabled = true;
  9949. // @ts-ignore
  9950. this.$ele.switch.setAttribute("data-disabled", true);
  9951. },
  9952. /**
  9953. * 启用复选框
  9954. */
  9955. notDisable() {
  9956. this.$ele.input.disabled = false;
  9957. this.$ele.switch.removeAttribute("data-disabled");
  9958. },
  9959. };
  9960.  
  9961. PopsPanelSwitch.init();
  9962. // @ts-ignore
  9963. liElement["data-switch"] = PopsPanelSwitch;
  9964. return liElement;
  9965. },
  9966. /**
  9967. * 获取中间容器的元素<li>
  9968. * type ==> slider
  9969. * @param {PopsPanelSliderDetails} formConfig
  9970. * @returns
  9971. */
  9972. getSectionContainerItem_slider(formConfig) {
  9973. let liElement = document.createElement("li");
  9974. // @ts-ignore
  9975. liElement.__formConfig__ = formConfig;
  9976. if (formConfig.className) {
  9977. liElement.className = formConfig.className;
  9978. }
  9979. // @ts-ignore
  9980. this.addElementAttributes(liElement, formConfig.attributes);
  9981. // @ts-ignore
  9982. this.setElementProps(liElement, formConfig.props);
  9983. /* 左边底部的描述的文字 */
  9984. let leftDescriptionText = "";
  9985. if (Boolean(formConfig.description)) {
  9986. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  9987. }
  9988. liElement.innerHTML = `
  9989. <div class="pops-panel-item-left-text">
  9990. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  9991. ${leftDescriptionText}
  9992. </div>
  9993. <div class="pops-panel-slider">
  9994. <input type="range" min="${formConfig.min}" max="${formConfig.max}">
  9995. </div>
  9996. `;
  9997. /**
  9998. * @type {HTMLInputElement}
  9999. */
  10000. // @ts-ignore
  10001. let rangeInputElement = liElement.querySelector(
  10002. ".pops-panel-slider input[type=range]"
  10003. );
  10004. if (formConfig.step) {
  10005. // @ts-ignore
  10006. rangeInputElement.setAttribute("step", formConfig.step);
  10007. }
  10008. // @ts-ignore
  10009. rangeInputElement.value = formConfig.getValue();
  10010. /**
  10011. * 获取提示的内容
  10012. * @param {number} value
  10013. * @returns {string}
  10014. */
  10015. let getToolTipContent = function (value) {
  10016. if (typeof formConfig.getToolTipContent === "function") {
  10017. return formConfig.getToolTipContent(value);
  10018. } else {
  10019. // @ts-ignore
  10020. return value;
  10021. }
  10022. };
  10023. let tooltip = pops.tooltip({
  10024. // @ts-ignore
  10025. target: rangeInputElement.parentElement,
  10026. // @ts-ignore
  10027. content: getToolTipContent(rangeInputElement.value),
  10028. zIndex: 1000000,
  10029. className: "github-tooltip",
  10030. // @ts-ignore
  10031. triggerShowEventCallBack(toolTipNode) {
  10032. toolTipNode.querySelector("div").innerText = getToolTipContent(
  10033. // @ts-ignore
  10034. rangeInputElement.value
  10035. );
  10036. },
  10037. alwaysShow: false,
  10038. only: false,
  10039. // @ts-ignore
  10040. position: "top",
  10041. arrowDistance: 10,
  10042. });
  10043. // @ts-ignore
  10044. PopsDOMUtils.on(
  10045. rangeInputElement,
  10046. ["input", "propertychange"],
  10047. void 0,
  10048. function (event) {
  10049. // @ts-ignore
  10050. tooltip.toolTipNode.querySelector("div").innerText =
  10051. // @ts-ignore
  10052. getToolTipContent(rangeInputElement.value);
  10053. if (typeof formConfig.callback === "function") {
  10054. // @ts-ignore
  10055. formConfig.callback(event, event.target.value);
  10056. }
  10057. }
  10058. );
  10059. return liElement;
  10060. },
  10061. /**
  10062. * 获取中间容器的元素<li>
  10063. * type ==> slider
  10064. * @param {PopsPanelSliderDetails} formConfig
  10065. * @returns
  10066. */
  10067. getSectionContainerItem_slider_new(formConfig) {
  10068. let liElement = document.createElement("li");
  10069. // @ts-ignore
  10070. liElement.__formConfig__ = formConfig;
  10071. if (formConfig.className) {
  10072. liElement.className = formConfig.className;
  10073. }
  10074. // @ts-ignore
  10075. this.addElementAttributes(liElement, formConfig.attributes);
  10076. // @ts-ignore
  10077. this.setElementProps(liElement, formConfig.props);
  10078. /* 左边底部的描述的文字 */
  10079. let leftDescriptionText = "";
  10080. if (Boolean(formConfig.description)) {
  10081. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  10082. }
  10083. liElement.innerHTML = `
  10084. <div class="pops-panel-item-left-text" style="flex: 1;">
  10085. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  10086. ${leftDescriptionText}
  10087. </div>
  10088. <div class="pops-slider pops-slider-width">
  10089. <div class="pops-slider__runway">
  10090. <div class="pops-slider__bar" style="width: 0%; left: 0%"></div>
  10091. <div
  10092. class="pops-slider__button-wrapper"
  10093. style="left: 0%">
  10094. <div class="pops-slider__button"></div>
  10095. </div>
  10096. </div>
  10097. </div>
  10098. `;
  10099. const PopsPanelSlider = {
  10100. [Symbol.toStringTag]: "PopsPanelSlider",
  10101. /**
  10102. * 值
  10103. */
  10104. value: formConfig.getValue(),
  10105. /**
  10106. * 最小值
  10107. */
  10108. min: formConfig.min,
  10109. /**
  10110. * 最大值
  10111. */
  10112. max: formConfig.max,
  10113. /**
  10114. * 间隔
  10115. */
  10116. step: formConfig.step || 1,
  10117. $data: {
  10118. /**
  10119. * 是否正在移动
  10120. */
  10121. isMove: false,
  10122. /**
  10123. * 是否已初始化已拖拽的距离
  10124. */
  10125. isInitDragPosition: false,
  10126. /**
  10127. * 是否正在检测是否停止拖拽
  10128. */
  10129. isCheckingStopDragMove: false,
  10130. /**
  10131. * 总宽度(px)
  10132. */
  10133. totalWidth: 0,
  10134. /**
  10135. * 每一块的间隔(px)
  10136. */
  10137. stepPx: 0,
  10138. /**
  10139. * 已拖拽的距离(px)
  10140. */
  10141. dragWidth: 0,
  10142. /**
  10143. * 已拖拽的百分比
  10144. */
  10145. dragPercent: 0,
  10146. /**
  10147. * 每一次块的信息
  10148. * 例如:当最小值是2,最大值是10,step为2
  10149. * 那么生成[2,4,6,8,10] 共计5个
  10150. * 又获取到当前滑块总长度是200px
  10151. * 那么生成映射
  10152. * 2 => 0px~40px
  10153. * 4 => 40px~80px
  10154. * 6 => 80px~120px
  10155. * 8 => 120px~160px
  10156. * 10 => 160px~200px
  10157. * @type {Map<number,{
  10158. * value: number,
  10159. * px: number,
  10160. * pxLeft: number,
  10161. * pxRight: number,
  10162. * percent: number,
  10163. * }>}
  10164. */
  10165. stepBlockMap: new Map(),
  10166. },
  10167. $ele: {
  10168. slider: liElement.querySelector(".pops-slider"),
  10169. runAway: liElement.querySelector(".pops-slider__runway"),
  10170. bar: liElement.querySelector(".pops-slider__bar"),
  10171. buttonWrapper: liElement.querySelector(
  10172. ".pops-slider__button-wrapper"
  10173. ),
  10174. button: liElement.querySelector(".pops-slider__button"),
  10175. /**
  10176. * @type {{
  10177. * guid: string,
  10178. * $shadowContainer: HTMLDivElement,
  10179. * $shadowRoot: ShadowRoot,
  10180. * config: PopsToolTipDetails,
  10181. * toolTipNode: HTMLDivElement,
  10182. * show: ()=>void,
  10183. * close: ()=>void,
  10184. * off: ()=>void,
  10185. * on: ()=>void,
  10186. * }}
  10187. */
  10188. // @ts-ignore
  10189. tooltip: null,
  10190. },
  10191. $interval: {
  10192. isCheck: false,
  10193. },
  10194. $tooltip: null,
  10195. init() {
  10196. this.initEleData();
  10197. this.setToolTipEvent();
  10198. this.setPanEvent();
  10199. this.setRunAwayClickEvent();
  10200. this.intervalInit();
  10201. if (formConfig.disabled) {
  10202. this.disableDrag();
  10203. }
  10204. },
  10205. /**
  10206. * 10s内循环获取slider的宽度等信息
  10207. * 获取到了就可以初始化left的值
  10208. * @param {number} [checkStepTime=200] 每次检测的间隔时间
  10209. * @param {number} [maxTime=10000] 最大的检测时间
  10210. */
  10211. intervalInit(checkStepTime = 200, maxTime = 10000) {
  10212. if (this.$interval.isCheck) {
  10213. return;
  10214. }
  10215. this.$interval.isCheck = true;
  10216. let isSuccess = false;
  10217. let oldTotalWidth = this.$data.totalWidth;
  10218. // @ts-ignore
  10219. let timer = null;
  10220. let interval = setInterval(() => {
  10221. if (isSuccess) {
  10222. this.$interval.isCheck = false;
  10223. // @ts-ignore
  10224. clearTimeout(timer);
  10225. clearInterval(interval);
  10226. } else {
  10227. this.initTotalWidth();
  10228. if (this.$data.totalWidth !== 0) {
  10229. isSuccess = true;
  10230. if (this.$data.totalWidth !== oldTotalWidth) {
  10231. /* slider的总宽度改变了 */
  10232. if (MathFloatUtils.isFloat(this.step)) {
  10233. this.initFloatStepMap();
  10234. } else {
  10235. this.initStepMap();
  10236. }
  10237. this.initSliderPosition();
  10238. }
  10239. }
  10240. }
  10241. }, checkStepTime);
  10242. /* 最长检测时间是10s */
  10243. timer = setTimeout(() => {
  10244. clearInterval(interval);
  10245. }, maxTime);
  10246. },
  10247. /**
  10248. * 把数据添加到元素上
  10249. */
  10250. initEleData() {
  10251. // @ts-ignore
  10252. this.$ele.slider.setAttribute("data-min", this.min);
  10253. // @ts-ignore
  10254. this.$ele.slider.setAttribute("data-max", this.max);
  10255. // @ts-ignore
  10256. this.$ele.slider.setAttribute("data-value", this.value);
  10257. // @ts-ignore
  10258. this.$ele.slider.setAttribute("data-step", this.step);
  10259. // @ts-ignore
  10260. this.$ele.slider["data-min"] = this.min;
  10261. // @ts-ignore
  10262. this.$ele.slider["data-max"] = this.max;
  10263. // @ts-ignore
  10264. this.$ele.slider["data-value"] = this.value;
  10265. // @ts-ignore
  10266. this.$ele.slider["data-step"] = this.step;
  10267. },
  10268. /**
  10269. * 初始化滑块的总长度的数据(px)
  10270. */
  10271. initTotalWidth() {
  10272. // @ts-ignore
  10273. this.$data.totalWidth = PopsDOMUtils.width(this.$ele.runAway);
  10274. },
  10275. /**
  10276. * 初始化每一个块的具体数据信息
  10277. */
  10278. initStepMap() {
  10279. let index = 0;
  10280. // 计算出份数
  10281. let blockNums = (this.max - this.min) / this.step;
  10282. // 计算出每一份占据的px
  10283. this.$data.stepPx = this.$data.totalWidth / blockNums;
  10284. let widthPx = 0;
  10285. for (
  10286. let stepValue = this.min;
  10287. stepValue <= this.max;
  10288. stepValue += this.step
  10289. ) {
  10290. let value = this.formatValue(stepValue);
  10291. let info = {};
  10292. if (value === this.min) {
  10293. /* 起始 */
  10294. info = {
  10295. value: value,
  10296. px: 0,
  10297. pxLeft: 0,
  10298. pxRight: this.$data.stepPx / 2,
  10299. percent: 0,
  10300. };
  10301. } else {
  10302. info = {
  10303. value: value,
  10304. px: widthPx,
  10305. pxLeft: widthPx - this.$data.stepPx / 2,
  10306. pxRight: widthPx + this.$data.stepPx / 2,
  10307. percent: widthPx / this.$data.totalWidth,
  10308. };
  10309. //if (value === this.max) {
  10310. // info["pxLeft"] = this.$data.stepBlockMap.get(
  10311. // index - 1
  10312. // ).pxRight;
  10313. // info["pxRight"] = this.$data.totalWidth;
  10314. //}
  10315. }
  10316. // @ts-ignore
  10317. this.$data.stepBlockMap.set(index, info);
  10318. index++;
  10319. widthPx += this.$data.stepPx;
  10320. }
  10321. },
  10322. /**
  10323. * 初始化每一个块的具体数据信息(浮点)
  10324. */
  10325. initFloatStepMap() {
  10326. let index = 0;
  10327. // 计算出份数
  10328. let blockNums = (this.max - this.min) / this.step;
  10329. // 计算出每一份占据的px
  10330. this.$data.stepPx = this.$data.totalWidth / blockNums;
  10331. let widthPx = 0;
  10332. for (
  10333. let stepValue = this.min;
  10334. stepValue <= this.max;
  10335. stepValue = MathFloatUtils.add(stepValue, this.step)
  10336. ) {
  10337. let value = this.formatValue(stepValue);
  10338. let info = {};
  10339. if (value === this.min) {
  10340. /* 起始 */
  10341. info = {
  10342. value: value,
  10343. px: 0,
  10344. pxLeft: 0,
  10345. pxRight: this.$data.stepPx / 2,
  10346. percent: 0,
  10347. };
  10348. } else {
  10349. info = {
  10350. value: value,
  10351. px: widthPx,
  10352. pxLeft: widthPx - this.$data.stepPx / 2,
  10353. pxRight: widthPx + this.$data.stepPx / 2,
  10354. percent: widthPx / this.$data.totalWidth,
  10355. };
  10356. //if (value === this.max) {
  10357. // info["pxLeft"] = this.$data.stepBlockMap.get(
  10358. // index - 1
  10359. // ).pxRight;
  10360. // info["pxRight"] = this.$data.totalWidth;
  10361. //}
  10362. }
  10363. // @ts-ignore
  10364. this.$data.stepBlockMap.set(index, info);
  10365. index++;
  10366. widthPx += this.$data.stepPx;
  10367. }
  10368. },
  10369. /**
  10370. * 初始化slider的默认起始left的百分比值
  10371. */
  10372. initSliderPosition() {
  10373. /* 设置起始默认style的left值 */
  10374. let percent = 0;
  10375. for (const [
  10376. // @ts-ignore
  10377. // @ts-ignore
  10378. index,
  10379. stepBlockInfo,
  10380. ] of this.$data.stepBlockMap.entries()) {
  10381. /* 判断值是否和区域内的值相等 */
  10382. if (stepBlockInfo.value == this.value) {
  10383. percent = stepBlockInfo.percent;
  10384. this.$data.dragWidth = stepBlockInfo.px;
  10385. break;
  10386. }
  10387. }
  10388. percent = this.formatValue(percent * 100);
  10389. this.setSliderPosition(percent);
  10390. },
  10391. /**
  10392. * 判断数字是否是浮点数
  10393. * @param {number} num
  10394. * @returns
  10395. */
  10396. isFloat(num) {
  10397. return Number(num) === num && num % 1 !== 0;
  10398. },
  10399. /**
  10400. * 值改变的回调
  10401. * @param {any} event
  10402. * @param {number} value
  10403. */
  10404. valueChangeCallBack(event, value) {
  10405. if (typeof formConfig.callback === "function") {
  10406. formConfig.callback(event, value);
  10407. }
  10408. },
  10409. /**
  10410. * 根据拖拽距离获取滑块应该在的区间和值
  10411. */
  10412. // @ts-ignore
  10413. getDragInfo(dragX) {
  10414. let result = this.$data.stepBlockMap.get(0);
  10415. for (const [
  10416. // @ts-ignore
  10417. // @ts-ignore
  10418. index,
  10419. stepBlockInfo,
  10420. ] of this.$data.stepBlockMap.entries()) {
  10421. if (
  10422. stepBlockInfo.pxLeft <= dragX &&
  10423. dragX < stepBlockInfo.pxRight
  10424. ) {
  10425. result = stepBlockInfo;
  10426. break;
  10427. }
  10428. }
  10429. return result;
  10430. },
  10431. /**
  10432. * 获取滑块的当前脱拖拽占据的百分比
  10433. * @param {number} dragWidth
  10434. */
  10435. getSliderPositonPercent(dragWidth) {
  10436. return dragWidth / this.$data.totalWidth;
  10437. },
  10438. /**
  10439. * 根据step格式化value
  10440. * @param {number} num
  10441. */
  10442. formatValue(num) {
  10443. if (MathFloatUtils.isFloat(this.step)) {
  10444. num = parseFloat(num.toFixed(2));
  10445. } else {
  10446. // @ts-ignore
  10447. num = parseInt(num);
  10448. }
  10449. return num;
  10450. },
  10451. /**
  10452. * 设置滑块的位置偏移(left)
  10453. * @param {number} percent 百分比
  10454. */
  10455. setSliderPosition(percent) {
  10456. // @ts-ignore
  10457. if (parseInt(percent) === 1) {
  10458. percent = 1;
  10459. }
  10460. if (percent > 1) {
  10461. percent = percent / 100;
  10462. }
  10463. /* 滑块按钮的偏移 */
  10464. // @ts-ignore
  10465. this.$ele.buttonWrapper.style.left = `${percent * 100}%`;
  10466. /* 滑块进度的宽度 */
  10467. // @ts-ignore
  10468. this.$ele.bar.style.width = `${percent * 100}%`;
  10469. },
  10470. /**
  10471. * 禁止拖拽
  10472. */
  10473. disableDrag() {
  10474. // @ts-ignore
  10475. this.$ele.runAway.classList.add("pops-slider-is-disabled");
  10476. },
  10477. /**
  10478. * 允许拖拽
  10479. */
  10480. allowDrag() {
  10481. // @ts-ignore
  10482. this.$ele.runAway.classList.remove("pops-slider-is-disabled");
  10483. },
  10484. /**
  10485. * 判断当前滑块是否被禁用
  10486. */
  10487. isDisabledDrag() {
  10488. // @ts-ignore
  10489. return this.$ele.runAway.classList.contains(
  10490. "pops-slider-is-disabled"
  10491. );
  10492. },
  10493. /**
  10494. * 设置进度条点击定位的事件
  10495. */
  10496. setRunAwayClickEvent() {
  10497. PopsDOMUtils.on(
  10498. // @ts-ignore
  10499. this.$ele.runAway,
  10500. "click",
  10501. void 0,
  10502. /**
  10503. *
  10504. * @param {PointerEvent} event
  10505. */
  10506. (event) => {
  10507. if (
  10508. event.target !== this.$ele.runAway &&
  10509. event.target !== this.$ele.bar
  10510. ) {
  10511. return;
  10512. }
  10513. // @ts-ignore
  10514. let clickX = parseFloat(event.offsetX);
  10515. this.dragStartCallBack();
  10516. this.dragMoveCallBack(event, clickX, this.value);
  10517. this.dragEndCallBack(clickX);
  10518. },
  10519. {
  10520. capture: false,
  10521. }
  10522. );
  10523. },
  10524. /**
  10525. * 拖拽开始的回调,如果返回false,禁止拖拽
  10526. */
  10527. dragStartCallBack() {
  10528. if (!this.$data.isMove) {
  10529. if (this.isDisabledDrag()) {
  10530. return false;
  10531. }
  10532. this.$data.isMove = true;
  10533. }
  10534. return true;
  10535. },
  10536. /**
  10537. * 拖拽中的回调
  10538. * @param {MouseEvent|TouchEvent} event 事件
  10539. * @param {number} dragX 当前拖拽的距离
  10540. * @param {number} oldValue 旧的值
  10541. */
  10542. dragMoveCallBack(event, dragX, oldValue) {
  10543. let dragPercent = 0;
  10544. if (dragX <= 0) {
  10545. dragPercent = 0;
  10546. this.value = this.min;
  10547. } else if (dragX >= this.$data.totalWidth) {
  10548. dragPercent = 1;
  10549. this.value = this.max;
  10550. } else {
  10551. const dragInfo = this.getDragInfo(dragX);
  10552. // @ts-ignore
  10553. dragPercent = dragInfo.percent;
  10554. // @ts-ignore
  10555. this.value = this.formatValue(dragInfo.value);
  10556. }
  10557. this.$data.dragPercent = dragPercent;
  10558. this.setSliderPosition(this.$data.dragPercent);
  10559. this.showToolTip();
  10560. if (oldValue !== this.value) {
  10561. this.valueChangeCallBack(event, this.value);
  10562. }
  10563. },
  10564. /**
  10565. * 拖拽结束的回调
  10566. */
  10567. // @ts-ignore
  10568. dragEndCallBack(dragX) {
  10569. this.$data.isMove = false;
  10570. if (dragX <= 0) {
  10571. this.$data.dragWidth = 0;
  10572. } else if (dragX >= this.$data.totalWidth) {
  10573. this.$data.dragWidth = this.$data.totalWidth;
  10574. } else {
  10575. this.$data.dragWidth = dragX;
  10576. }
  10577. this.closeToolTip();
  10578. },
  10579. /**
  10580. * 设置点击拖拽事件
  10581. */
  10582. setPanEvent() {
  10583. const AnyTouch = PopsUtils.AnyTouch();
  10584. // @ts-ignore
  10585. this.$tooltip = new AnyTouch(this.$ele.button, {
  10586. preventEvent() {
  10587. return false;
  10588. },
  10589. });
  10590. /**
  10591. * 当前的拖拽的距离px
  10592. * @type {number}
  10593. */
  10594. let currentDragX = 0;
  10595. /* 监听拖拽 */
  10596. // @ts-ignore
  10597. this.$tooltip.on("at:move", (event) => {
  10598. if (!this.dragStartCallBack()) {
  10599. return;
  10600. }
  10601. let oldValue = this.value;
  10602. // @ts-ignore
  10603. const runAwayRect = this.$ele.runAway.getBoundingClientRect();
  10604. let displacementX =
  10605. event.x - (runAwayRect.left + globalThis.screenX);
  10606. if (displacementX <= 0) {
  10607. displacementX = 0;
  10608. } else if (displacementX >= runAwayRect.width) {
  10609. displacementX = runAwayRect.width;
  10610. }
  10611. currentDragX = displacementX;
  10612. /* 拖拽移动 */
  10613. this.dragMoveCallBack(event, currentDragX, oldValue);
  10614. });
  10615. /* 监听触点离开,处理某些情况下,拖拽松开,但是未触发pan事件,可以通过设置这个来关闭tooltip */
  10616. // @ts-ignore
  10617. // @ts-ignore
  10618. this.$tooltip.on("at:end", (event) => {
  10619. this.dragEndCallBack(currentDragX);
  10620. });
  10621. },
  10622. /**
  10623. * 显示悬浮的
  10624. */
  10625. showToolTip() {
  10626. this.$ele.tooltip.show();
  10627. },
  10628. /**
  10629. * 关闭悬浮的
  10630. */
  10631. closeToolTip() {
  10632. this.$ele.tooltip.close();
  10633. },
  10634. /**
  10635. * 检测在1000ms内,是否停止了拖拽
  10636. */
  10637. checkStopDragMove() {
  10638. if (this.$data.isCheckingStopDragMove) {
  10639. return;
  10640. }
  10641. this.$data.isCheckingStopDragMove = true;
  10642. let interval = setInterval(() => {
  10643. if (!this.$data.isMove) {
  10644. this.$data.isCheckingStopDragMove = false;
  10645. this.closeToolTip();
  10646. clearInterval(interval);
  10647. }
  10648. }, 200);
  10649. setTimeout(() => {
  10650. this.$data.isCheckingStopDragMove = false;
  10651. clearInterval(interval);
  10652. }, 2000);
  10653. },
  10654. /**
  10655. * 设置拖拽按钮的悬浮事件
  10656. */
  10657. setToolTipEvent() {
  10658. /**
  10659. * 获取提示的内容
  10660. */
  10661. function getToolTipContent() {
  10662. if (typeof formConfig.getToolTipContent === "function") {
  10663. return formConfig.getToolTipContent(PopsPanelSlider.value);
  10664. } else {
  10665. return PopsPanelSlider.value;
  10666. }
  10667. }
  10668. // @ts-ignore
  10669. let tooltipContent = null;
  10670. // @ts-ignore
  10671. this.$ele.tooltip = pops.tooltip({
  10672. // @ts-ignore
  10673. target: this.$ele.button,
  10674. // @ts-ignore
  10675. content: getToolTipContent,
  10676. zIndex: 1000000,
  10677. className: "github-tooltip",
  10678. only: false,
  10679. eventOption: {
  10680. capture: true,
  10681. passive: true,
  10682. },
  10683. showBeforeCallBack: () => {
  10684. this.intervalInit();
  10685. },
  10686. // @ts-ignore
  10687. // @ts-ignore
  10688. showAfterCallBack: (toolTipNode) => {
  10689. // @ts-ignore
  10690. tooltipContent.innerText = getToolTipContent();
  10691. },
  10692. closeBeforeCallBack: () => {
  10693. if (this.$data.isMove) {
  10694. this.checkStopDragMove();
  10695. return false;
  10696. }
  10697. },
  10698. alwaysShow: false,
  10699. // @ts-ignore
  10700. only: false,
  10701. // @ts-ignore
  10702. position: "top",
  10703. arrowDistance: 10,
  10704. });
  10705. tooltipContent = this.$ele.tooltip.toolTipNode.querySelector("div");
  10706. },
  10707. };
  10708. PopsPanelSlider.init();
  10709. // @ts-ignore
  10710. liElement["data-slider"] = PopsPanelSlider;
  10711. return liElement;
  10712. },
  10713. /**
  10714. * 获取中间容器的元素<li>
  10715. * type ==> input
  10716. * @param {PopsPanelInputDetails} formConfig
  10717. * @returns
  10718. */
  10719. getSectionContainerItem_input(formConfig) {
  10720. let liElement = document.createElement("li");
  10721. // @ts-ignore
  10722. liElement.__formConfig__ = formConfig;
  10723. if (formConfig.className) {
  10724. liElement.className = formConfig.className;
  10725. }
  10726. // @ts-ignore
  10727. this.addElementAttributes(liElement, formConfig.attributes);
  10728. // @ts-ignore
  10729. this.setElementProps(liElement, formConfig.props);
  10730. let inputType = "text";
  10731. if (formConfig.isPassword) {
  10732. inputType = "password";
  10733. } else if (formConfig.isNumber) {
  10734. inputType = "number";
  10735. }
  10736. /* 左边底部的描述的文字 */
  10737. let leftDescriptionText = "";
  10738. if (Boolean(formConfig.description)) {
  10739. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  10740. }
  10741. liElement.innerHTML = `
  10742. <div class="pops-panel-item-left-text">
  10743. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  10744. ${leftDescriptionText}
  10745. </div>
  10746. <div class="pops-panel-input">
  10747. <input type="${inputType}" placeholder="${formConfig.placeholder}">
  10748. </div>
  10749. `;
  10750. const PopsPanelInput = {
  10751. [Symbol.toStringTag]: "PopsPanelInput",
  10752. $ele: {
  10753. /**
  10754. * @type {HTMLDivElement}
  10755. */
  10756. // @ts-ignore
  10757. panelInput: liElement.querySelector(".pops-panel-input"),
  10758. /**
  10759. * @type {HTMLInputElement}
  10760. */
  10761. // @ts-ignore
  10762. input: liElement.querySelector("input"),
  10763. inputSpanIcon: document.createElement("span"),
  10764. /**
  10765. * @type {HTMLSpanElement}
  10766. */
  10767. // @ts-ignore
  10768. inputSpanIconInner: null,
  10769. /**
  10770. * @type {HTMLElement}
  10771. */
  10772. // @ts-ignore
  10773. icon: null,
  10774. },
  10775. $data: {
  10776. value: formConfig.getValue(),
  10777. isView: false,
  10778. },
  10779. init() {
  10780. this.initEle();
  10781. this.setInputValue(this.$data.value);
  10782. /* 如果是密码框,放进图标 */
  10783. if (formConfig.isPassword) {
  10784. this.setCircleIcon(pops.config.iconSVG.view);
  10785. this.setCircleIconClickEvent();
  10786. } else {
  10787. /* 先判断预设值是否为空,不为空添加清空图标按钮 */
  10788. if (this.$ele.input.value != "") {
  10789. this.setCircleIcon(pops.config.iconSVG.circleClose);
  10790. this.setCircleIconClickEvent();
  10791. }
  10792. }
  10793.  
  10794. this.setInputChangeEvent();
  10795. if (formConfig.disabled) {
  10796. this.disable();
  10797. }
  10798. if (typeof formConfig.handlerCallBack === "function") {
  10799. // @ts-ignore
  10800. formConfig.handlerCallBack(liElement, this.$ele.input);
  10801. }
  10802. },
  10803. /**
  10804. * 初始化$ele的配置
  10805. */
  10806. initEle() {
  10807. // @ts-ignore
  10808. this.$ele.input.parentElement.insertBefore(
  10809. this.$ele.inputSpanIcon,
  10810. this.$ele.input.nextSibling
  10811. );
  10812. this.$ele.inputSpanIcon.className = "pops-panel-input__suffix";
  10813. this.$ele.inputSpanIcon.innerHTML = `
  10814. <span class="pops-panel-input__suffix-inner">
  10815. <i class="pops-panel-icon"></i>
  10816. </span>
  10817. `;
  10818. // @ts-ignore
  10819. this.$ele.inputSpanIconInner =
  10820. this.$ele.inputSpanIcon.querySelector(
  10821. ".pops-panel-input__suffix-inner"
  10822. );
  10823. // @ts-ignore
  10824. this.$ele.icon =
  10825. this.$ele.inputSpanIcon.querySelector(".pops-panel-icon");
  10826. },
  10827. /**
  10828. * 禁用
  10829. */
  10830. disable() {
  10831. this.$ele.input.disabled = true;
  10832. this.$ele.panelInput.classList.add("pops-input-disabled");
  10833. },
  10834. /**
  10835. * 取消禁用
  10836. */
  10837. notDisable() {
  10838. this.$ele.input.disabled = false;
  10839. this.$ele.panelInput.classList.remove("pops-input-disabled");
  10840. },
  10841. /**
  10842. * 判断是否已被禁用
  10843. */
  10844. isDisabled() {
  10845. return this.$ele.input.disabled;
  10846. },
  10847. /**
  10848. * 设置输入框内容
  10849. * @param {string} [value=""] 值
  10850. */
  10851. setInputValue(value = "") {
  10852. this.$ele.input.value = value;
  10853. },
  10854. /**
  10855. * 设置input元素的type
  10856. * @param {string} [typeValue="text"] type值
  10857. */
  10858. setInputType(typeValue = "text") {
  10859. this.$ele.input.setAttribute("type", typeValue);
  10860. },
  10861. /**
  10862. * 删除图标按钮
  10863. */
  10864. removeCircleIcon() {
  10865. this.$ele.icon.innerHTML = "";
  10866. },
  10867. /**
  10868. * 添加清空图标按钮
  10869. * @param {string} [svgHTML=pops.config.iconSVG.circleClose] svg图标,默认为清空的图标
  10870. */
  10871. setCircleIcon(svgHTML = pops.config.iconSVG.circleClose) {
  10872. this.$ele.icon.innerHTML = svgHTML;
  10873. },
  10874. /**
  10875. * 添加图标按钮的点击事件
  10876. */
  10877. setCircleIconClickEvent() {
  10878. // @ts-ignore
  10879. PopsDOMUtils.on(this.$ele.icon, "click", void 0, () => {
  10880. if (this.isDisabled()) {
  10881. return;
  10882. }
  10883. /* 删除图标 */
  10884. this.removeCircleIcon();
  10885. if (formConfig.isPassword) {
  10886. /* 密码输入框 */
  10887. if (this.$data.isView) {
  10888. /* 当前可见 => 点击改变为隐藏 */
  10889. this.$data.isView = false;
  10890. /* 显示输入框内容,且更换图标为隐藏图标 */
  10891. this.setInputType("text");
  10892. this.setCircleIcon(pops.config.iconSVG.hide);
  10893. } else {
  10894. /* 当前不可见 => 点击改变为显示 */
  10895. this.$data.isView = true;
  10896. /* 隐藏输入框内容,且更换图标为显示图标 */
  10897. this.setInputType("password");
  10898. this.setCircleIcon(pops.config.iconSVG.view);
  10899. }
  10900. } else {
  10901. /* 普通输入框 */
  10902. /* 清空内容 */
  10903. this.setInputValue("");
  10904. /* 获取焦点 */
  10905. this.$ele.input.focus();
  10906. /* 触发内容改变事件 */
  10907. this.$ele.input.dispatchEvent(new Event("input"));
  10908. }
  10909. });
  10910. },
  10911. /**
  10912. * 监听输入框内容改变
  10913. */
  10914. setInputChangeEvent() {
  10915. // @ts-ignore
  10916. PopsDOMUtils.on(
  10917. this.$ele.input,
  10918. ["input", "propertychange"],
  10919. void 0,
  10920. (event) => {
  10921. this.$data.value = this.$ele.input.value;
  10922. if (!formConfig.isPassword) {
  10923. /* 不是密码框 */
  10924. if (
  10925. this.$ele.input.value !== "" &&
  10926. this.$ele.icon.innerHTML === ""
  10927. ) {
  10928. /* 不为空,显示清空图标 */
  10929. this.setCircleIcon(pops.config.iconSVG.circleClose);
  10930. this.setCircleIconClickEvent();
  10931. } else if (this.$ele.input.value === "") {
  10932. this.removeCircleIcon();
  10933. }
  10934. }
  10935. if (typeof formConfig.callback === "function") {
  10936. if (formConfig.isNumber) {
  10937. formConfig.callback(
  10938. // @ts-ignore
  10939. event,
  10940. this.$ele.input.value,
  10941. this.$ele.input.valueAsNumber
  10942. );
  10943. } else {
  10944. // @ts-ignore
  10945. formConfig.callback(event, this.$ele.input.value);
  10946. }
  10947. }
  10948. }
  10949. );
  10950. },
  10951. };
  10952. PopsPanelInput.init();
  10953. // @ts-ignore
  10954. liElement["data-input"] = PopsPanelInput;
  10955. return liElement;
  10956. },
  10957. /**
  10958. * 获取中间容器的元素<li>
  10959. * type ==> textarea
  10960. * @param {PopsPanelTextAreaDetails} formConfig
  10961. * @returns
  10962. */
  10963. getSectionContainerItem_textarea(formConfig) {
  10964. let liElement = document.createElement("li");
  10965. // @ts-ignore
  10966. liElement.__formConfig__ = formConfig;
  10967. if (formConfig.className) {
  10968. liElement.className = formConfig.className;
  10969. }
  10970. // @ts-ignore
  10971. this.addElementAttributes(liElement, formConfig.attributes);
  10972. // @ts-ignore
  10973. this.setElementProps(liElement, formConfig.props);
  10974.  
  10975. /* 左边底部的描述的文字 */
  10976. let leftDescriptionText = "";
  10977. if (Boolean(formConfig.description)) {
  10978. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  10979. }
  10980. liElement.innerHTML = `
  10981. <div class="pops-panel-item-left-text">
  10982. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  10983. ${leftDescriptionText}
  10984. </div>
  10985. <div class="pops-panel-textarea">
  10986. <textarea placeholder="${formConfig.placeholder ?? ""}">
  10987. </textarea>
  10988. </div>
  10989. `;
  10990.  
  10991. const PopsPanelTextArea = {
  10992. [Symbol.toStringTag]: "PopsPanelTextArea",
  10993. $ele: {
  10994. /**
  10995. * @type {HTMLDivElement}
  10996. */
  10997. // @ts-ignore
  10998. panelTextarea: liElement.querySelector(".pops-panel-textarea"),
  10999. /**
  11000. * @type {HTMLTextAreaElement}
  11001. */
  11002. // @ts-ignore
  11003. textarea: liElement.querySelector(".pops-panel-textarea textarea"),
  11004. },
  11005. $data: {
  11006. value: formConfig.getValue(),
  11007. },
  11008. init() {
  11009. this.setValue(this.$data.value);
  11010. this.setChangeEvent();
  11011. if (formConfig.disabled) {
  11012. this.disable();
  11013. }
  11014. },
  11015. disable() {
  11016. // @ts-ignore
  11017. this.$ele.textarea.setAttribute("disabled", true);
  11018. this.$ele.panelTextarea.classList.add(
  11019. "pops-panel-textarea-disable"
  11020. );
  11021. },
  11022. notDisable() {
  11023. // @ts-ignore
  11024. this.$ele.textarea.removeAttribute("disabled", true);
  11025. this.$ele.panelTextarea.classList.remove(
  11026. "pops-panel-textarea-disable"
  11027. );
  11028. },
  11029. isDisabled() {
  11030. return (
  11031. this.$ele.textarea.hasAttribute("disabled") ||
  11032. // @ts-ignore
  11033. this.$ele.panelTextarea.classList.hasAttribute(
  11034. "pops-panel-textarea-disable"
  11035. )
  11036. );
  11037. },
  11038. // @ts-ignore
  11039. setValue(value) {
  11040. this.$ele.textarea.value = value;
  11041. },
  11042. /**
  11043. * 监听选择内容改变
  11044. */
  11045. setChangeEvent() {
  11046. // @ts-ignore
  11047. PopsDOMUtils.on(
  11048. this.$ele.textarea,
  11049. ["input", "propertychange"],
  11050. void 0,
  11051. (event) => {
  11052. // @ts-ignore
  11053. this.$data.value = event.target.value;
  11054. if (typeof formConfig.callback === "function") {
  11055. // @ts-ignore
  11056. formConfig.callback(event, event.target.value);
  11057. }
  11058. }
  11059. );
  11060. },
  11061. };
  11062.  
  11063. PopsPanelTextArea.init();
  11064. // @ts-ignore
  11065. liElement["data-textarea"] = PopsPanelTextArea;
  11066.  
  11067. return liElement;
  11068. },
  11069. /**
  11070. * 获取中间容器的元素<li>
  11071. * type ==> select
  11072. * @param {PopsPanelSelectDetails<any>} formConfig
  11073. * @returns
  11074. */
  11075. getSectionContainerItem_select(formConfig) {
  11076. let liElement = document.createElement("li");
  11077. // @ts-ignore
  11078. liElement.__formConfig__ = formConfig;
  11079. if (formConfig.className) {
  11080. liElement.className = formConfig.className;
  11081. }
  11082. // @ts-ignore
  11083. this.addElementAttributes(liElement, formConfig.attributes);
  11084. // @ts-ignore
  11085. this.setElementProps(liElement, formConfig.props);
  11086. /* 左边底部的描述的文字 */
  11087. let leftDescriptionText = "";
  11088. if (Boolean(formConfig.description)) {
  11089. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  11090. }
  11091. liElement.innerHTML = `
  11092. <div class="pops-panel-item-left-text">
  11093. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  11094. ${leftDescriptionText}
  11095. </div>
  11096. <div class="pops-panel-select">
  11097. <select>
  11098.  
  11099. </select>
  11100. </div>
  11101. `;
  11102.  
  11103. const PopsPanelSelect = {
  11104. [Symbol.toStringTag]: "PopsPanelSelect",
  11105. $ele: {
  11106. /**
  11107. * @type {HTMLDivElement}
  11108. */
  11109. // @ts-ignore
  11110. panelSelect: liElement.querySelector(".pops-panel-select"),
  11111. /**
  11112. * @type {HTMLSelectElement}
  11113. */
  11114. // @ts-ignore
  11115. select: liElement.querySelector(".pops-panel-select select"),
  11116. },
  11117. $data: {
  11118. defaultValue: formConfig.getValue(),
  11119. },
  11120. init() {
  11121. this.initOption();
  11122. this.setChangeEvent();
  11123. this.setClickEvent();
  11124. if (formConfig.disabled) {
  11125. this.disable();
  11126. }
  11127. },
  11128. disable() {
  11129. // @ts-ignore
  11130. this.$ele.select.setAttribute("disabled", true);
  11131. this.$ele.panelSelect.classList.add("pops-panel-select-disable");
  11132. },
  11133. notDisable() {
  11134. // @ts-ignore
  11135. this.$ele.select.removeAttribute("disabled", true);
  11136. this.$ele.panelSelect.classList.remove("pops-panel-select-disable");
  11137. },
  11138. isDisabled() {
  11139. return (
  11140. this.$ele.select.hasAttribute("disabled") ||
  11141. // @ts-ignore
  11142. this.$ele.panelSelect.classList.hasAttribute(
  11143. "pops-panel-select-disable"
  11144. )
  11145. );
  11146. },
  11147. initOption() {
  11148. formConfig.data.forEach((dataItem) => {
  11149. let optionElement = document.createElement("option");
  11150. // @ts-ignore
  11151. optionElement.__value__ = dataItem.value;
  11152. // @ts-ignore
  11153. optionElement.__disable__ = dataItem.disable;
  11154. if (dataItem.value === this.$data.defaultValue) {
  11155. // @ts-ignore
  11156. optionElement.setAttribute("selected", true);
  11157. }
  11158. optionElement.innerText = dataItem.text;
  11159. this.$ele.select.appendChild(optionElement);
  11160. });
  11161. },
  11162. setSelectOptionsDisableStatus() {
  11163. if (this.$ele.select.options && this.$ele.select.options.length) {
  11164. Array.from(this.$ele.select.options).forEach((optionItem) => {
  11165. this.setOptionDisableStatus(optionItem);
  11166. });
  11167. }
  11168. },
  11169. // @ts-ignore
  11170. setOptionDisableStatus(optionElement) {
  11171. if (typeof optionElement.__disable__ === "function") {
  11172. let disableStatus = optionElement.__disable__(
  11173. optionElement.__value__
  11174. );
  11175. if (disableStatus) {
  11176. optionElement.setAttribute("disabled", true);
  11177. } else {
  11178. optionElement.removeAttribute("disabled");
  11179. }
  11180. }
  11181. },
  11182. /**
  11183. * 监听选择内容改变
  11184. */
  11185. setChangeEvent() {
  11186. // @ts-ignore
  11187. PopsDOMUtils.on(this.$ele.select, "change", void 0, (event) => {
  11188. this.setSelectOptionsDisableStatus();
  11189. if (typeof formConfig.callback === "function") {
  11190. /**
  11191. * @type {HTMLOptionElement}
  11192. */
  11193. let isSelectedElement =
  11194. // @ts-ignore
  11195. event.target[event.target.selectedIndex];
  11196. // @ts-ignore
  11197. let isSelectedValue = isSelectedElement.__value__;
  11198. let isSelectedText =
  11199. isSelectedElement.innerText || isSelectedElement.textContent;
  11200. // @ts-ignore
  11201. formConfig.callback(event, isSelectedValue, isSelectedText);
  11202. }
  11203. });
  11204. },
  11205. /**
  11206. * 监听点击事件
  11207. */
  11208. setClickEvent() {
  11209. // @ts-ignore
  11210. PopsDOMUtils.on(this.$ele.select, "click", void 0, (event) => {
  11211. this.setSelectOptionsDisableStatus();
  11212. if (typeof formConfig.clickCallBack === "function") {
  11213. // @ts-ignore
  11214. formConfig.clickCallBack(event, this.$ele.select);
  11215. }
  11216. });
  11217. },
  11218. };
  11219.  
  11220. PopsPanelSelect.init();
  11221. // @ts-ignore
  11222. liElement["data-select"] = PopsPanelSelect;
  11223. return liElement;
  11224. },
  11225. /**
  11226. * 获取中间容器的元素<li>
  11227. * type ==> button
  11228. * @param {PopsPanelButtonDetails} formConfig
  11229. * @returns
  11230. */
  11231. getSectionContainerItem_button(formConfig) {
  11232. let liElement = document.createElement("li");
  11233. // @ts-ignore
  11234. liElement.__formConfig__ = formConfig;
  11235. if (formConfig.className) {
  11236. liElement.className = formConfig.className;
  11237. }
  11238. // @ts-ignore
  11239. this.addElementAttributes(liElement, formConfig.attributes);
  11240. // @ts-ignore
  11241. this.setElementProps(liElement, formConfig.props);
  11242.  
  11243. /* 左边底部的描述的文字 */
  11244. let leftDescriptionText = "";
  11245. if (Boolean(formConfig.description)) {
  11246. leftDescriptionText = `<p class="pops-panel-item-left-desc-text">${formConfig.description}</p>`;
  11247. }
  11248. liElement.innerHTML = `
  11249. <div class="pops-panel-item-left-text">
  11250. <p class="pops-panel-item-left-main-text">${formConfig.text}</p>
  11251. ${leftDescriptionText}
  11252. </div>
  11253. <div class="pops-panel-button">
  11254. <button class="pops-panel-button_inner">
  11255. <i class="pops-bottom-icon"></i>
  11256. <span class="pops-panel-button-text"></span>
  11257. </button>
  11258. </div>
  11259. `;
  11260.  
  11261. const PopsPanelButton = {
  11262. [Symbol.toStringTag]: "PopsPanelButton",
  11263. $ele: {
  11264. panelButton: liElement.querySelector(".pops-panel-button"),
  11265. button: liElement.querySelector(
  11266. ".pops-panel-button .pops-panel-button_inner"
  11267. ),
  11268. icon: liElement.querySelector(
  11269. ".pops-panel-button .pops-bottom-icon"
  11270. ),
  11271. spanText: liElement.querySelector(
  11272. ".pops-panel-button .pops-panel-button-text"
  11273. ),
  11274. },
  11275. $data: {},
  11276. init() {
  11277. // @ts-ignore
  11278. this.$ele.panelButton.appendChild(this.$ele.button);
  11279. this.initButton();
  11280. this.setClickEvent();
  11281. },
  11282. initButton() {
  11283. if (
  11284. typeof formConfig.buttonIcon === "string" &&
  11285. formConfig.buttonIcon.trim() !== ""
  11286. ) {
  11287. /* 存在icon图标且不为空 */
  11288. if (formConfig.buttonIcon in pops.config.iconSVG) {
  11289. this.setIconSVG(pops.config.iconSVG[formConfig.buttonIcon]);
  11290. } else {
  11291. this.setIconSVG(formConfig.buttonIcon);
  11292. }
  11293. this.showIcon();
  11294. } else {
  11295. this.hideIcon();
  11296. }
  11297. /* 按钮文字 */
  11298. let buttonText = formConfig.buttonText;
  11299. if (typeof formConfig.buttonText === "function") {
  11300. buttonText = formConfig.buttonText();
  11301. }
  11302. this.setButtonType(formConfig.buttonType);
  11303. if (formConfig.buttonIsRightIcon) {
  11304. this.setIconRight();
  11305. } else {
  11306. this.setIconLeft();
  11307. }
  11308. if (formConfig.disable) {
  11309. this.disable();
  11310. }
  11311. // @ts-ignore
  11312. this.setButtonText(buttonText);
  11313. // @ts-ignore
  11314. this.setIconLoadingStatus(formConfig.buttonIconIsLoading);
  11315. },
  11316. disable() {
  11317. // @ts-ignore
  11318. this.$ele.button.setAttribute("disabled", "true");
  11319. },
  11320. notDisable() {
  11321. // @ts-ignore
  11322. this.$ele.button.removeAttribute("disabled");
  11323. },
  11324. /**
  11325. * 隐藏icon图标
  11326. */
  11327. hideIcon() {
  11328. // @ts-ignore
  11329. this.$ele.panelButton.classList.add("pops-panel-button-no-icon");
  11330. },
  11331. /**
  11332. * 显示icon图标
  11333. */
  11334. showIcon() {
  11335. // @ts-ignore
  11336. this.$ele.panelButton.classList.remove("pops-panel-button-no-icon");
  11337. },
  11338. /**
  11339. * 设置icon图标的svg
  11340. */
  11341. // @ts-ignore
  11342. setIconSVG(svgHTML) {
  11343. // @ts-ignore
  11344. this.$ele.icon.innerHTML = svgHTML;
  11345. },
  11346. /**
  11347. * 设置icon图标是否旋转
  11348. * @param {boolean} status
  11349. */
  11350. setIconLoadingStatus(status) {
  11351. // @ts-ignore
  11352. this.$ele.icon.setAttribute("is-loading", Boolean(status));
  11353. },
  11354. /**
  11355. * 设置属性上是否存在icon图标
  11356. */
  11357. // @ts-ignore
  11358. setHasIcon(value) {
  11359. // @ts-ignore
  11360. this.$ele.button.setAttribute("data-icon", Boolean(value));
  11361. },
  11362. /**
  11363. * 设置按钮类型
  11364. * @param {string} typeValue
  11365. */
  11366. setButtonType(typeValue) {
  11367. // @ts-ignore
  11368. this.$ele.button.setAttribute("type", typeValue);
  11369. },
  11370. /**
  11371. * 添加按钮的图标在右边
  11372. */
  11373. setIconRight() {
  11374. // @ts-ignore
  11375. this.$ele.button.classList.add("pops-panel-button-right-icon");
  11376. },
  11377. /**
  11378. * (默认)添加按钮的图标在左边
  11379. */
  11380. setIconLeft() {
  11381. // @ts-ignore
  11382. this.$ele.button.classList.remove("pops-panel-button-right-icon");
  11383. },
  11384. /**
  11385. * 设置按钮文本
  11386. * @param {string} text
  11387. */
  11388. setButtonText(text) {
  11389. // @ts-ignore
  11390. this.$ele.spanText.innerHTML = text;
  11391. },
  11392. setClickEvent() {
  11393. // @ts-ignore
  11394. PopsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
  11395. if (typeof formConfig.callback === "function") {
  11396. // @ts-ignore
  11397. formConfig.callback(event);
  11398. }
  11399. });
  11400. },
  11401. };
  11402. PopsPanelButton.init();
  11403. // @ts-ignore
  11404. liElement["data-button"] = PopsPanelButton;
  11405. return liElement;
  11406. },
  11407. /**
  11408. * 获取中间容器的元素<li>
  11409. * type ===> own
  11410. * @param {PopsPanelOwnDetails} formConfig
  11411. * @returns
  11412. */
  11413. getSectionContainerItem_own(formConfig) {
  11414. let liElement = document.createElement("li");
  11415. // @ts-ignore
  11416. liElement.__formConfig__ = formConfig;
  11417. if (formConfig.className) {
  11418. liElement.className = formConfig.className;
  11419. }
  11420. liElement = formConfig.getLiElementCallBack(liElement);
  11421. return liElement;
  11422. },
  11423. /**
  11424. * 获取中间容器的元素<li>
  11425. * @param {PopsPanelFormsTotalDetails} formConfig
  11426. * @returns
  11427. */
  11428. getSectionContainerItem(formConfig) {
  11429. if (formConfig["type"] === "switch") {
  11430. return this.getSectionContainerItem_switch(formConfig);
  11431. } else if (formConfig["type"] === "slider") {
  11432. return this.getSectionContainerItem_slider_new(formConfig);
  11433. } else if (formConfig["type"] === "input") {
  11434. return this.getSectionContainerItem_input(formConfig);
  11435. } else if (formConfig["type"] === "textarea") {
  11436. return this.getSectionContainerItem_textarea(formConfig);
  11437. } else if (formConfig["type"] === "select") {
  11438. return this.getSectionContainerItem_select(formConfig);
  11439. } else if (formConfig["type"] === "button") {
  11440. return this.getSectionContainerItem_button(formConfig);
  11441. } else if (formConfig["type"] === "own") {
  11442. return this.getSectionContainerItem_own(formConfig);
  11443. } else {
  11444. console.error("尚未实现的type类型", formConfig);
  11445. }
  11446. },
  11447.  
  11448. /**
  11449. * 为左侧容器元素添加点击事件
  11450. * @param {HTMLElement} asideLiElement 左侧的容器<li>元素
  11451. * @param {PopsPanelContentConfig} asideConfig 配置
  11452. */
  11453. setAsideItemClickEvent(asideLiElement, asideConfig) {
  11454. let that = this;
  11455. /**
  11456. *
  11457. * @param {PopsPanelFormsTotalDetails} formConfig
  11458. * @param {PopsPanelRightAsideContainerOptions} containerOptions
  11459. */
  11460. function uListContainerAddItem(formConfig, containerOptions) {
  11461. let itemLiElement = that.getSectionContainerItem(formConfig);
  11462. if (itemLiElement) {
  11463. containerOptions["ulElement"].appendChild(itemLiElement);
  11464. }
  11465. if (typeof formConfig.afterAddToUListCallBack === "function") {
  11466. formConfig.afterAddToUListCallBack(formConfig, containerOptions);
  11467. }
  11468. }
  11469. // @ts-ignore
  11470. PopsDOMUtils.on(asideLiElement, "click", void 0, function (event) {
  11471. that.clearContainer();
  11472. that.clearAsideItemIsVisited();
  11473. that.setAsideItemIsVisited(asideLiElement);
  11474. /* 顶部标题栏,存在就设置 */
  11475. let headerTitleText = asideConfig.headerTitle || asideConfig.title;
  11476. if (
  11477. typeof headerTitleText === "string" &&
  11478. headerTitleText.trim() !== ""
  11479. ) {
  11480. let containerHeaderTitleLIElement = document.createElement("li");
  11481. // @ts-ignore
  11482. containerHeaderTitleLIElement.__asideConfig__ = asideConfig;
  11483. containerHeaderTitleLIElement.innerHTML = headerTitleText;
  11484. that.sectionContainerHeaderULElement.appendChild(
  11485. containerHeaderTitleLIElement
  11486. );
  11487. }
  11488.  
  11489. /**
  11490. * @type {PopsPanelContentConfig[]}
  11491. */
  11492. // @ts-ignore
  11493. let __forms__ = asideLiElement.__forms__;
  11494. __forms__.forEach((formConfig) => {
  11495. // @ts-ignore
  11496. if (formConfig["type"] === "forms") {
  11497. let childForms = formConfig["forms"];
  11498. /* 父<li>元素 */
  11499. let formContainerListElement = document.createElement("li");
  11500. /* 子<ul>元素 */
  11501. let formContainerULElement = document.createElement("ul");
  11502. formContainerListElement.className =
  11503. "pops-panel-forms-container-item";
  11504. /* 区域头部的文字 */
  11505. // @ts-ignore
  11506. let formHeaderDivElement = PopsDOMUtils.createElement("div", {
  11507. className: "pops-panel-forms-container-item-header-text",
  11508. });
  11509. // @ts-ignore
  11510. formHeaderDivElement.innerHTML = formConfig["text"];
  11511. /* 加进容器内 */
  11512. formContainerListElement.appendChild(formHeaderDivElement);
  11513. // @ts-ignore
  11514. if (formConfig.className) {
  11515. PopsDOMUtils.addClassName(
  11516. formContainerListElement,
  11517. // @ts-ignore
  11518. formConfig.className
  11519. );
  11520. }
  11521. that.addElementAttributes(
  11522. formContainerListElement,
  11523. // @ts-ignore
  11524. formConfig.attributes
  11525. );
  11526. // @ts-ignore
  11527. that.setElementProps(formContainerListElement, formConfig.props);
  11528. childForms.forEach((childFormConfig) => {
  11529. // @ts-ignore
  11530. uListContainerAddItem(childFormConfig, {
  11531. ulElement: formContainerULElement,
  11532. sectionContainerULElement: that.sectionContainerULElement,
  11533. formContainerListElement: formContainerListElement,
  11534. formHeaderDivElement: formHeaderDivElement,
  11535. });
  11536. });
  11537. formContainerListElement.appendChild(formContainerULElement);
  11538. that.sectionContainerULElement.appendChild(
  11539. formContainerListElement
  11540. );
  11541. } else {
  11542. /* 如果成功创建,加入到中间容器中 */
  11543. // @ts-ignore
  11544. uListContainerAddItem(formConfig, {
  11545. ulElement: that.sectionContainerULElement,
  11546. });
  11547. }
  11548. });
  11549.  
  11550. let autoAdaptionContentHeight =
  11551. asideConfig.autoAdaptionContentHeight ?? true;
  11552. if (autoAdaptionContentHeight) {
  11553. /* 根据标题的高度来自适应内容高度,默认开启 */
  11554. /* 中间容器的偏移量,看设置的section.pops-panel-container的padding,默认0 */
  11555. let contentContainerOffset =
  11556. // @ts-ignore
  11557. asideConfig.contentContainerOffset ?? 0;
  11558. /* 获取标题的<ul>元素的高度 */
  11559. let sectionContainerHeaderULElementHeight = PopsDOMUtils.height(
  11560. that.sectionContainerHeaderULElement
  11561. );
  11562. that.sectionContainerULElement.style.setProperty(
  11563. "height",
  11564. `calc( 100% - ${
  11565. sectionContainerHeaderULElementHeight + contentContainerOffset
  11566. }px )`
  11567. );
  11568. }
  11569.  
  11570. if (typeof asideConfig.callback === "function") {
  11571. /* 执行回调 */
  11572. asideConfig.callback(
  11573. // @ts-ignore
  11574. event,
  11575. that.sectionContainerHeaderULElement,
  11576. that.sectionContainerULElement
  11577. );
  11578. }
  11579. });
  11580. },
  11581. };
  11582.  
  11583. HandleContetDetails.init();
  11584.  
  11585. PopsHandler.handlePush(PopsType, {
  11586. guid: guid,
  11587. // @ts-ignore
  11588. animElement: animElement,
  11589. // @ts-ignore
  11590. popsElement: popsElement,
  11591. // @ts-ignore
  11592. maskElement: maskElement,
  11593. $shadowContainer: $shadowContainer,
  11594. $shadowRoot: $shadowRoot,
  11595. });
  11596. /* 拖拽 */
  11597. if (config.drag) {
  11598. // @ts-ignore
  11599. PopsUtils.drag(popsElement, {
  11600. dragElement: titleElement,
  11601. limit: config.dragLimit,
  11602. extraDistance: config.dragExtraDistance,
  11603. moveCallBack: config.dragMoveCallBack,
  11604. endCallBack: config.dragEndCallBack,
  11605. });
  11606. }
  11607. return PopsHandler.handleResultDetails(eventDetails);
  11608. };
  11609.  
  11610. /**
  11611. * 右键菜单
  11612. * @param { PopsRightClickMenuDetails } details 配置
  11613. */
  11614. // @ts-ignore
  11615. pops.rightClickMenu = function (details = {}) {
  11616. // @ts-ignore
  11617. // @ts-ignore
  11618. let that = this;
  11619. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  11620. PopsHandler.handleInit($shadowRoot, [
  11621. pops.config.cssText.index,
  11622. pops.config.cssText.anim,
  11623. pops.config.cssText.common,
  11624. ]);
  11625. /**
  11626. * @type {Required<PopsRightClickMenuDetails>}
  11627. */
  11628. let config = {
  11629. target: document.documentElement,
  11630. // @ts-ignore
  11631. targetSelector: void 0,
  11632. data: [
  11633. {
  11634. // @ts-ignore
  11635. icon: pops.config.iconSVG.search,
  11636. iconIsLoading: false,
  11637. text: "搜索",
  11638. // @ts-ignore
  11639. callback(clickEvent, contextMenuEvent, liElement) {
  11640. console.log("点击:" + this.text, [
  11641. clickEvent,
  11642. contextMenuEvent,
  11643. liElement,
  11644. ]);
  11645. },
  11646. },
  11647. {
  11648. // @ts-ignore
  11649. icon: pops.config.iconSVG.documentCopy,
  11650. iconIsLoading: false,
  11651. text: "复制",
  11652. // @ts-ignore
  11653. callback(clickEvent, contextMenuEvent, liElement) {
  11654. console.log("点击:" + this.text, [
  11655. clickEvent,
  11656. contextMenuEvent,
  11657. liElement,
  11658. ]);
  11659. },
  11660. },
  11661. {
  11662. // @ts-ignore
  11663. icon: pops.config.iconSVG.delete,
  11664. text: "删除",
  11665. iconIsLoading: false,
  11666. // @ts-ignore
  11667. callback(clickEvent, contextMenuEvent, liElement) {
  11668. console.log("点击:" + this.text, [
  11669. clickEvent,
  11670. contextMenuEvent,
  11671. liElement,
  11672. ]);
  11673. },
  11674. },
  11675. {
  11676. // @ts-ignore
  11677. icon: pops.config.iconSVG.loading,
  11678. iconIsLoading: true,
  11679. text: "加载",
  11680. callback(clickEvent, contextMenuEvent, liElement) {
  11681. console.log("点击:" + this.text, [
  11682. clickEvent,
  11683. contextMenuEvent,
  11684. liElement,
  11685. ]);
  11686. return false;
  11687. },
  11688. },
  11689. {
  11690. // @ts-ignore
  11691. icon: pops.config.iconSVG.elemePlus,
  11692. iconIsLoading: true,
  11693. text: "饿了么",
  11694. callback(clickEvent, contextMenuEvent, liElement) {
  11695. console.log("点击:" + this.text, [
  11696. clickEvent,
  11697. contextMenuEvent,
  11698. liElement,
  11699. ]);
  11700. return false;
  11701. },
  11702. item: [
  11703. {
  11704. // @ts-ignore
  11705. icon: "",
  11706. iconIsLoading: false,
  11707. text: "处理文件",
  11708. // @ts-ignore
  11709. callback(clickEvent, contextMenuEvent, liElement) {
  11710. console.log("点击:" + this.text, [
  11711. clickEvent,
  11712. contextMenuEvent,
  11713. liElement,
  11714. ]);
  11715. },
  11716. },
  11717. {
  11718. // @ts-ignore
  11719. icon: "",
  11720. iconIsLoading: false,
  11721. text: "其它处理",
  11722. // @ts-ignore
  11723. callback(clickEvent, contextMenuEvent, liElement) {
  11724. console.log("点击:" + this.text, [
  11725. clickEvent,
  11726. contextMenuEvent,
  11727. liElement,
  11728. ]);
  11729. },
  11730. item: [
  11731. {
  11732. // @ts-ignore
  11733. icon: pops.config.iconSVG.view,
  11734. iconIsLoading: false,
  11735. text: "查看",
  11736. // @ts-ignore
  11737. callback(clickEvent, contextMenuEvent, liElement) {
  11738. console.log("点击:" + this.text, [
  11739. clickEvent,
  11740. contextMenuEvent,
  11741. liElement,
  11742. ]);
  11743. },
  11744. },
  11745. ],
  11746. },
  11747. ],
  11748. },
  11749. ],
  11750. className: "",
  11751. isAnimation: true,
  11752. only: false,
  11753. zIndex: 10000,
  11754. preventDefault: true,
  11755. // @ts-ignore
  11756. style: void 0,
  11757. beforeAppendToPageCallBack() {},
  11758. };
  11759. config = PopsUtils.assignJSON(config, details);
  11760. if (config.target == null) {
  11761. throw "config.target 不能为空";
  11762. }
  11763. if (details.data) {
  11764. config.data = details.data;
  11765. }
  11766. let guid = PopsUtils.getRandomGUID();
  11767. const PopsType = "rightClickMenu";
  11768. // @ts-ignore
  11769. config = PopsHandler.handleOnly(PopsType, config);
  11770.  
  11771. if (config.style != null) {
  11772. let cssNode = document.createElement("style");
  11773. cssNode.setAttribute("type", "text/css");
  11774. cssNode.innerHTML = config.style;
  11775. $shadowRoot.appendChild(cssNode);
  11776. }
  11777.  
  11778. const PopsContextMenu = {
  11779. /**
  11780. * 根元素
  11781. * @type {?HTMLElement}
  11782. */
  11783. rootElement: null,
  11784. /**
  11785. * 全局点击检测
  11786. * @param {TouchEvent|PointerEvent} event
  11787. */
  11788. windowCheckClickEvent(event) {
  11789. if (!PopsContextMenu.rootElement) {
  11790. return;
  11791. }
  11792. // @ts-ignore
  11793. if (event.target.closest(`.pops-${PopsType}`)) {
  11794. return;
  11795. }
  11796. if (
  11797. // @ts-ignore
  11798. event.target.className &&
  11799. // @ts-ignore
  11800. event.target.className === "pops-shadow-container" &&
  11801. // @ts-ignore
  11802. event.target.shadowRoot != null
  11803. ) {
  11804. return;
  11805. }
  11806. PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
  11807. },
  11808. /**
  11809. * target为shadowRoot或shadowRoot内的全局点击检测
  11810. * @param {TouchEvent|PointerEvent} event
  11811. */
  11812. shadowRootCheckClickEvent(event) {
  11813. if (!PopsContextMenu.rootElement) {
  11814. return;
  11815. }
  11816. // @ts-ignore
  11817. if (event.target.closest(`.pops-${PopsType}`)) {
  11818. return;
  11819. }
  11820. PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
  11821. },
  11822. /**
  11823. * 添加全局点击检测事件
  11824. */
  11825. addWindowCheckClickListener() {
  11826. PopsDOMUtils.on(
  11827. // @ts-ignore
  11828. globalThis,
  11829. "click touchstart",
  11830. void 0,
  11831. PopsContextMenu.windowCheckClickEvent,
  11832. {
  11833. capture: true,
  11834. }
  11835. );
  11836. // @ts-ignore
  11837. const $shadowRoot = config.target.getRootNode();
  11838. if ($shadowRoot instanceof ShadowRoot) {
  11839. PopsDOMUtils.on(
  11840. // @ts-ignore
  11841. $shadowRoot,
  11842. "click touchstart",
  11843. void 0,
  11844. PopsContextMenu.shadowRootCheckClickEvent,
  11845. {
  11846. capture: true,
  11847. }
  11848. );
  11849. }
  11850. },
  11851. /**
  11852. * 移除全局点击检测事件
  11853. */
  11854. removeWindowCheckClickListener() {
  11855. PopsDOMUtils.off(
  11856. // @ts-ignore
  11857. globalThis,
  11858. "click touchstart",
  11859. void 0,
  11860. PopsContextMenu.windowCheckClickEvent,
  11861. {
  11862. capture: true,
  11863. }
  11864. );
  11865. // @ts-ignore
  11866. const $shadowRoot = config.target.getRootNode();
  11867. if ($shadowRoot instanceof ShadowRoot) {
  11868. PopsDOMUtils.off(
  11869. // @ts-ignore
  11870. $shadowRoot,
  11871. "click touchstart",
  11872. void 0,
  11873. PopsContextMenu.windowCheckClickEvent,
  11874. {
  11875. capture: true,
  11876. }
  11877. );
  11878. }
  11879. },
  11880. /**
  11881. * contextmenu事件
  11882. * @param {PointerEvent} event
  11883. */
  11884. contextMenuEvent(event) {
  11885. if (config.preventDefault) {
  11886. PopsUtils.preventEvent(event);
  11887. }
  11888. if (PopsContextMenu.rootElement) {
  11889. PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
  11890. }
  11891. PopsContextMenu.rootElement = PopsContextMenu.showMenu(
  11892. event,
  11893. config.data
  11894. );
  11895. },
  11896. /**
  11897. * 添加contextmenu事件
  11898. * @param {HTMLElement|globalThis|Window} target 目标
  11899. * @param {?string} selector 子元素选择器
  11900. */
  11901. addContextMenuEvent(target, selector) {
  11902. // @ts-ignore
  11903. PopsDOMUtils.on(
  11904. target,
  11905. "contextmenu",
  11906. selector,
  11907. PopsContextMenu.contextMenuEvent
  11908. );
  11909. },
  11910. /**
  11911. * 移除contextmenu事件
  11912. * @param {HTMLElement|globalThis|Window} target 目标
  11913. */
  11914. removeContextMenuEvent(target) {
  11915. // @ts-ignore
  11916. PopsDOMUtils.off(
  11917. target,
  11918. "contextmenu",
  11919. // @ts-ignore
  11920. string,
  11921. PopsContextMenu.contextMenuEvent
  11922. );
  11923. },
  11924. /**
  11925. * 自动判断是否存在动画,存在动画就执行关闭动画并删除
  11926. * @param {HTMLElement} element
  11927. */
  11928. animationCloseMenu(element) {
  11929. /**
  11930. * 动画结束触发的事件
  11931. */
  11932. // @ts-ignore
  11933. // @ts-ignore
  11934. function transitionEndEvent(event) {
  11935. PopsDOMUtils.off(
  11936. element,
  11937. // @ts-ignore
  11938. PopsDOMUtils.getTransitionEndNameList(),
  11939. void 0,
  11940. transitionEndEvent,
  11941. {
  11942. capture: true,
  11943. }
  11944. );
  11945. element.remove();
  11946. }
  11947. if (element.classList.contains(`pops-${PopsType}-anim-show`)) {
  11948. /* 有动画 */
  11949. PopsDOMUtils.on(
  11950. element,
  11951. // @ts-ignore
  11952. PopsDOMUtils.getTransitionEndNameList(),
  11953. void 0,
  11954. transitionEndEvent,
  11955. {
  11956. capture: true,
  11957. }
  11958. );
  11959. element.classList.remove(`pops-${PopsType}-anim-show`);
  11960. } else {
  11961. /* 无动画 */
  11962. element.remove();
  11963. }
  11964. },
  11965. /**
  11966. * 关闭所有菜单
  11967. * @param {HTMLElement} rootElement
  11968. */
  11969. closeAllMenu(rootElement) {
  11970. // @ts-ignore
  11971. if (rootElement?.__menuData__?.root) {
  11972. // @ts-ignore
  11973. rootElement = rootElement?.__menuData__?.root;
  11974. }
  11975. /**
  11976. * @type {HTMLElement[]}
  11977. */
  11978. // @ts-ignore
  11979. let childMenuList = rootElement.__menuData__.child;
  11980. childMenuList.forEach((childMenuElement) => {
  11981. this.animationCloseMenu(childMenuElement);
  11982. });
  11983. this.animationCloseMenu(rootElement);
  11984. PopsContextMenu.rootElement = null;
  11985. },
  11986. /**
  11987. * 获取菜单容器
  11988. * @param {number} zIndex z-index值
  11989. * @param {boolean} isChildren 是否是rightClickMenu的某一项的子菜单
  11990. */
  11991. getMenuContainerElement(zIndex, isChildren) {
  11992. let menuElement = PopsUtils.parseTextToDOM(`
  11993. <div class="pops-${PopsType}" ${isChildren ? 'is-children="true"' : ""}>
  11994. <style type="text/css" data-from="pops-${PopsType}">
  11995. .pops-${PopsType} *{
  11996. -webkit-box-sizing: border-box;
  11997. box-sizing: border-box;
  11998. margin: 0;
  11999. padding: 0;
  12000. -webkit-tap-highlight-color: transparent;
  12001. scrollbar-width: thin;
  12002. }
  12003. .pops-${PopsType}{
  12004. position: fixed;
  12005. z-index: ${zIndex};
  12006. text-align: center;
  12007. border-radius: 3px;
  12008. font-size: 16px;
  12009. font-weight: 500;
  12010. background: #fff;
  12011. box-shadow: 0px 1px 6px 1px #cacaca;
  12012. }
  12013. .pops-${PopsType}-anim-grid{
  12014. display: grid;
  12015. transition: 0.3s;
  12016. grid-template-rows: 0fr;
  12017. }
  12018. .pops-${PopsType}-anim-show{
  12019. grid-template-rows: 1fr;
  12020. }
  12021. .pops-${PopsType}-is-visited{
  12022. background: #dfdfdf;
  12023. }
  12024. i.pops-${PopsType}-icon {
  12025. height: 1em;
  12026. width: 1em;
  12027. line-height: 1em;
  12028. display: inline-flex;
  12029. justify-content: center;
  12030. align-items: center;
  12031. position: relative;
  12032. fill: currentColor;
  12033. color: inherit;
  12034. font-size: inherit;
  12035. margin-right: 6px;
  12036. }
  12037. i.pops-${PopsType}-icon[is-loading="true"]{
  12038. animation: rotating 2s linear infinite;
  12039. }
  12040. .pops-${PopsType} li:hover{background:#dfdfdf;cursor:pointer}
  12041. .pops-${PopsType} ul{
  12042. margin: 0;
  12043. padding: 0;
  12044. display: flex;
  12045. flex-direction: column;
  12046. align-items: flex-start;
  12047. justify-content: center;
  12048. overflow: hidden;
  12049. }
  12050. .pops-${PopsType} ul li {
  12051. padding: 5px 10px;
  12052. margin: 2.5px 5px;
  12053. border-radius: 3px;
  12054. display: flex;
  12055. width: -webkit-fill-available;
  12056. width: -moz-available;
  12057. text-align: left;
  12058. user-select: none;
  12059. -webkit-user-select: none;
  12060. -moz-user-select: none;
  12061. -ms-user-select: none;
  12062. align-items: center;
  12063. }
  12064. .pops-${PopsType} ul li:first-child{
  12065. margin-top: 5px;
  12066. }
  12067. .pops-${PopsType} ul li:last-child{
  12068. margin-bottom: 5px;
  12069. }
  12070. </style>
  12071. <ul></ul>
  12072. </div>
  12073. `);
  12074. /* 添加动画 */
  12075. if (config.isAnimation) {
  12076. PopsDOMUtils.addClassName(menuElement, `pops-${PopsType}-anim-grid`);
  12077. }
  12078. return menuElement;
  12079. },
  12080. /**
  12081. * 获取left、top偏移
  12082. * @param {HTMLElement} menuElement 菜单元素
  12083. * @param {number} x
  12084. * @param {number} y
  12085. */
  12086. getOffset(menuElement, x, y) {
  12087. /* left最大偏移 */
  12088. let maxLeftOffset =
  12089. // @ts-ignore
  12090. PopsDOMUtils.width(globalThis) - PopsDOMUtils.width(menuElement) - 1;
  12091. /* top最大偏移 */
  12092. let maxTopOffset =
  12093. // @ts-ignore
  12094. PopsDOMUtils.height(globalThis) -
  12095. PopsDOMUtils.height(menuElement) -
  12096. 8;
  12097.  
  12098. let currentLeftOffset = x;
  12099. let currentTopOffset = y;
  12100. /* 不允许超出left最大值 */
  12101. currentLeftOffset = currentLeftOffset < 0 ? 0 : currentLeftOffset;
  12102. currentLeftOffset =
  12103. currentLeftOffset < maxLeftOffset ? currentLeftOffset : maxLeftOffset;
  12104. /* 不允许超出top最大值 */
  12105. currentTopOffset = currentTopOffset < 0 ? 0 : currentTopOffset;
  12106. currentTopOffset =
  12107. currentTopOffset < maxTopOffset ? currentTopOffset : maxTopOffset;
  12108. return {
  12109. left: currentLeftOffset,
  12110. top: currentTopOffset,
  12111. };
  12112. },
  12113. /**
  12114. * 显示菜单
  12115. * @param {PointerEvent} menuEvent 触发的事件
  12116. * @param {PopsRightClickMenuDataDetails[]} _config_
  12117. */
  12118. showMenu(menuEvent, _config_) {
  12119. // @ts-ignore
  12120. let menuElement = this.getMenuContainerElement(config.zIndex, false);
  12121. // @ts-ignore
  12122. menuElement.__menuData__ = {
  12123. child: [],
  12124. };
  12125. PopsContextMenu.addMenuLiELement(
  12126. menuEvent,
  12127. menuElement,
  12128. // @ts-ignore
  12129. menuElement,
  12130. _config_
  12131. );
  12132. /* 先隐藏 */
  12133. // @ts-ignore
  12134. PopsDOMUtils.css(menuElement, {
  12135. display: "none",
  12136. });
  12137. // @ts-ignore
  12138. PopsUtils.appendChild($shadowRoot, menuElement);
  12139. /* 添加到页面 */
  12140. if (!document.contains($shadowContainer)) {
  12141. if (typeof config.beforeAppendToPageCallBack === "function") {
  12142. config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
  12143. }
  12144. // @ts-ignore
  12145. PopsUtils.appendChild($shadowContainer);
  12146. }
  12147. let { left: menuLeftOffset, top: menuTopOffset } = this.getOffset(
  12148. menuElement,
  12149. menuEvent.clientX,
  12150. menuEvent.clientY
  12151. );
  12152. PopsDOMUtils.css(menuElement, {
  12153. // @ts-ignore
  12154. left: menuLeftOffset,
  12155. // @ts-ignore
  12156. top: menuTopOffset,
  12157. display: "",
  12158. });
  12159. /* 过渡动画 */
  12160. if (config.isAnimation) {
  12161. PopsDOMUtils.addClassName(menuElement, `pops-${PopsType}-anim-show`);
  12162. }
  12163. return menuElement;
  12164. },
  12165. /**
  12166. * 显示子菜单
  12167. * @param {Event} menuEvent 事件
  12168. * @param {{
  12169. * clientX: number,
  12170. * clientY: number
  12171. * }} posInfo 位置信息
  12172. * @param {PopsRightClickMenuDataDetails[]} _config_
  12173. * @param {?HTMLDivElement} rootElement 根菜单元素
  12174. * @param {?HTMLLIElement} targetLiElement 父li项元素
  12175. */
  12176. showClildMenu(
  12177. menuEvent,
  12178. posInfo,
  12179. _config_,
  12180. rootElement,
  12181. targetLiElement
  12182. ) {
  12183. // @ts-ignore
  12184. let menuElement = this.getMenuContainerElement(config.zIndex, true);
  12185. // @ts-ignore
  12186. menuElement.__menuData__ = {
  12187. parent: targetLiElement,
  12188. root: rootElement,
  12189. };
  12190. // @ts-ignore
  12191. rootElement.__menuData__.child.push(menuElement);
  12192. PopsContextMenu.addMenuLiELement(
  12193. // @ts-ignore
  12194. menuEvent,
  12195. rootElement,
  12196. menuElement,
  12197. _config_
  12198. );
  12199. /* 先隐藏 */
  12200. // @ts-ignore
  12201. PopsDOMUtils.css(menuElement, {
  12202. display: "none",
  12203. });
  12204. /* 添加到页面 */
  12205. // @ts-ignore
  12206. PopsUtils.appendChild($shadowRoot, menuElement);
  12207. let { left: menuLeftOffset, top: menuTopOffset } = this.getOffset(
  12208. menuElement,
  12209. posInfo.clientX,
  12210. posInfo.clientY
  12211. );
  12212. PopsDOMUtils.css(menuElement, {
  12213. // @ts-ignore
  12214. left: menuLeftOffset,
  12215. // @ts-ignore
  12216. top: menuTopOffset,
  12217. display: "",
  12218. });
  12219. /* 过渡动画 */
  12220. if (config.isAnimation) {
  12221. PopsDOMUtils.addClassName(menuElement, `pops-${PopsType}-anim-show`);
  12222. }
  12223. return menuElement;
  12224. },
  12225. /**
  12226. * 获取菜单项的元素
  12227. * @param {PointerEvent} menuEvent 事件
  12228. * @param {HTMLElement} rootElement 根元素
  12229. * @param {HTMLDivElement} menuElement 菜单元素
  12230. * @param {PopsRightClickMenuDataDetails[]} _config_ 配置
  12231. */
  12232. addMenuLiELement(menuEvent, rootElement, menuElement, _config_) {
  12233. let menuEventTarget = menuEvent.target;
  12234. let menuULElement = menuElement.querySelector("ul");
  12235. _config_.forEach((item) => {
  12236. /**
  12237. * @type {HTMLLIElement}
  12238. */
  12239. // @ts-ignore
  12240. let menuLiElement = PopsUtils.parseTextToDOM(`
  12241. <li></li>
  12242. `);
  12243. /* 判断有无图标,有就添加进去 */
  12244. if (typeof item.icon === "string" && item.icon.trim() !== "") {
  12245. let iconSVGHTML = pops.config.iconSVG[item.icon] ?? item.icon;
  12246. let iconElement = PopsUtils.parseTextToDOM(
  12247. `<i class="pops-${PopsType}-icon" is-loading="${item.iconIsLoading}">${iconSVGHTML}</i>`
  12248. );
  12249. menuLiElement.appendChild(iconElement);
  12250. }
  12251. /* 插入文字 */
  12252. menuLiElement.insertAdjacentHTML(
  12253. "beforeend",
  12254. `<span>${item.text}</span>`
  12255. );
  12256. /* 如果存在子数据,显示 */
  12257. if (item.item && Array.isArray(item.item)) {
  12258. PopsDOMUtils.addClassName(menuLiElement, `pops-${PopsType}-item`);
  12259. }
  12260. /* 鼠标|触摸 移入事件 */
  12261. function liElementHoverEvent() {
  12262. // @ts-ignore
  12263. Array.from(menuULElement.children).forEach((liElement) => {
  12264. PopsDOMUtils.removeClassName(
  12265. // @ts-ignore
  12266. liElement,
  12267. `pops-${PopsType}-is-visited`
  12268. );
  12269. // @ts-ignore
  12270. if (!liElement.__menuData__) {
  12271. return;
  12272. }
  12273. // @ts-ignore
  12274. function removeElement(element) {
  12275. // @ts-ignore
  12276. element.querySelectorAll("ul li").forEach((ele) => {
  12277. if (ele?.__menuData__?.child) {
  12278. removeElement(ele.__menuData__.child);
  12279. }
  12280. });
  12281. element.remove();
  12282. }
  12283. /* 遍历根元素的上的__menuData__.child,判断 */
  12284. // @ts-ignore
  12285. removeElement(liElement.__menuData__.child);
  12286. });
  12287. /* 清理根元素上的children不存在于页面中的元素 */
  12288. for (
  12289. let index = 0;
  12290. // @ts-ignore
  12291. index < rootElement.__menuData__.child.length;
  12292. index++
  12293. ) {
  12294. // @ts-ignore
  12295. let element = rootElement.__menuData__.child[index];
  12296. if (!$shadowRoot.contains(element)) {
  12297. // @ts-ignore
  12298. rootElement.__menuData__.child.splice(index, 1);
  12299. index--;
  12300. }
  12301. }
  12302. PopsDOMUtils.addClassName(
  12303. menuLiElement,
  12304. `pops-${PopsType}-is-visited`
  12305. );
  12306. if (!item.item) {
  12307. return;
  12308. }
  12309. let rect = menuLiElement.getBoundingClientRect();
  12310. let childMenu = PopsContextMenu.showClildMenu(
  12311. menuEvent,
  12312. {
  12313. clientX: rect.left + PopsDOMUtils.outerWidth(menuLiElement),
  12314. clientY: rect.top,
  12315. },
  12316. item.item,
  12317. // @ts-ignore
  12318. rootElement,
  12319. menuLiElement
  12320. );
  12321. // @ts-ignore
  12322. menuLiElement.__menuData__ = {
  12323. child: childMenu,
  12324. };
  12325. }
  12326. /**
  12327. * 点击事件
  12328. * @param {PointerEvent} clickEvent
  12329. * @returns
  12330. */
  12331. async function liElementClickEvent(clickEvent) {
  12332. if (typeof item.callback === "function") {
  12333. OriginPrototype.Object.defineProperty(menuEvent, "target", {
  12334. get() {
  12335. return menuEventTarget;
  12336. },
  12337. });
  12338. let callbackResult = await item.callback(
  12339. clickEvent,
  12340. menuEvent,
  12341. menuLiElement
  12342. );
  12343. if (
  12344. typeof callbackResult === "boolean" &&
  12345. callbackResult == false
  12346. ) {
  12347. return;
  12348. }
  12349. }
  12350. /* 取消绑定的鼠标/触摸事件,防止关闭的时候再次触发 */
  12351. // @ts-ignore
  12352. Array.from(menuULElement.children).forEach((liEle) => {
  12353. // @ts-ignore
  12354. PopsDOMUtils.off(liEle, "mouseenter touchstart");
  12355. });
  12356. PopsContextMenu.closeAllMenu(rootElement);
  12357. }
  12358. // @ts-ignore
  12359. PopsDOMUtils.on(
  12360. menuLiElement,
  12361. "mouseenter touchstart",
  12362. void 0,
  12363. liElementHoverEvent
  12364. );
  12365. /* 项-点击事件 */
  12366. // @ts-ignore
  12367. PopsDOMUtils.on(menuLiElement, "click", void 0, liElementClickEvent);
  12368.  
  12369. // @ts-ignore
  12370. menuULElement.appendChild(menuLiElement);
  12371. });
  12372. },
  12373. };
  12374.  
  12375. PopsContextMenu.addContextMenuEvent(
  12376. config.target,
  12377. config.targetSelector,
  12378. // @ts-ignore
  12379. config.preventDefault
  12380. );
  12381. PopsContextMenu.addWindowCheckClickListener();
  12382.  
  12383. return {
  12384. guid: guid,
  12385. config: config,
  12386. removeWindowCheckClickListener:
  12387. PopsContextMenu.removeWindowCheckClickListener,
  12388. addWindowCheckClickListener: PopsContextMenu.addWindowCheckClickListener,
  12389. removeContextMenuEvent: PopsContextMenu.removeContextMenuEvent,
  12390. addContextMenuEvent: PopsContextMenu.addContextMenuEvent,
  12391. };
  12392. };
  12393.  
  12394. /**
  12395. * 搜索建议悬浮窗
  12396. * @param {PopsSearchSuggestionDetails} details
  12397. */
  12398. pops.searchSuggestion = function (details) {
  12399. const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow();
  12400. PopsHandler.handleInit($shadowRoot, [
  12401. pops.config.cssText.index,
  12402. pops.config.cssText.anim,
  12403. pops.config.cssText.common,
  12404. ]);
  12405. /** @type {Required<PopsSearchSuggestionDetails>} */
  12406. let config = {
  12407. // @ts-ignore
  12408. target: null,
  12409. // @ts-ignore
  12410. inputTarget: null,
  12411. selfDocument: document,
  12412. data: [
  12413. {
  12414. value: "数据1",
  12415. text: "数据1-html",
  12416. },
  12417. {
  12418. value: "数据2",
  12419. text: "数据2-html",
  12420. },
  12421. ],
  12422. deleteIcon: {
  12423. enable: true,
  12424. callback(event, liElement, data) {
  12425. console.log("删除当前项", [event, liElement, data]);
  12426. liElement.remove();
  12427. },
  12428. },
  12429. className: "",
  12430. isAbsolute: true,
  12431. isAnimation: true,
  12432. width: "250px",
  12433. maxHeight: "300px",
  12434. followTargetWidth: true,
  12435. topDistance: 0,
  12436. zIndex: 10000,
  12437. searchingTip: "正在搜索中...",
  12438. toSearhNotResultHTML: '<li data-none="true">暂无其它数据</li>',
  12439. getItemHTML(item) {
  12440. return item.text ?? item;
  12441. },
  12442. async getData(value) {
  12443. console.log("当前输入框的值是:", value);
  12444. return [];
  12445. },
  12446. itemClickCallBack(event, liElement, data) {
  12447. console.log("item项的点击回调", [event, liElement, data]);
  12448. // @ts-ignore
  12449. this.inputTarget.value = data.value;
  12450. },
  12451. // @ts-ignore
  12452. style: void 0,
  12453. };
  12454. config = PopsUtils.assignJSON(config, details);
  12455. if (config.target == null) {
  12456. throw new TypeError("config.target 不能为空");
  12457. }
  12458. /* 做下兼容处理 */
  12459. if (config.inputTarget == null) {
  12460. // @ts-ignore
  12461. config.inputTarget = config.target;
  12462. }
  12463. if (details.data) {
  12464. config.data = details.data;
  12465. }
  12466. const guid = PopsUtils.getRandomGUID();
  12467. const PopsType = "searchSuggestion";
  12468.  
  12469. if (config.style != null) {
  12470. let cssNode = document.createElement("style");
  12471. cssNode.setAttribute("type", "text/css");
  12472. cssNode.innerHTML = config.style;
  12473. $shadowRoot.appendChild(cssNode);
  12474. }
  12475.  
  12476. const SearchSuggestion = {
  12477. /**
  12478. * 当前的环境,可以是document,可以是shadowroot,默认是document
  12479. */
  12480. selfDocument: config.selfDocument,
  12481. /**
  12482. * 根元素
  12483. * @type {HTMLElement}
  12484. */
  12485. // @ts-ignore
  12486. root: null,
  12487. /**
  12488. * ul元素
  12489. * @type {HTMLUListElement}
  12490. */
  12491. // @ts-ignore
  12492. hintULElement: null,
  12493. /**
  12494. * 初始化
  12495. */
  12496. init(parentElement = document.body || document.documentElement) {
  12497. this.root = this.getSearchSelectElement();
  12498. // @ts-ignore
  12499. this.hintULElement = this.root.querySelector("ul");
  12500. this.update(config.data);
  12501. this.changeHintULElementWidth();
  12502. this.changeHintULElementPosition();
  12503.  
  12504. this.hide();
  12505. if (config.isAnimation) {
  12506. this.root.classList.add(`pops-${PopsType}-animation`);
  12507. }
  12508. $shadowRoot.appendChild(this.root);
  12509. parentElement.appendChild($shadowContainer);
  12510. },
  12511. /**
  12512. * 获取显示出搜索建议框的html
  12513. */
  12514. getSearchSelectElement() {
  12515. let element = PopsDOMUtils.createElement(
  12516. "div",
  12517. // @ts-ignore
  12518. {
  12519. className: `pops pops-${PopsType}-search-suggestion`,
  12520. innerHTML: `
  12521. <style>
  12522. .pops-${PopsType}-animation{
  12523. -moz-animation: searchSelectFalIn 0.5s 1 linear;
  12524. -webkit-animation: searchSelectFalIn 0.5s 1 linear;
  12525. -o-animation: searchSelectFalIn 0.5s 1 linear;
  12526. -ms-animation: searchSelectFalIn 0.5s 1 linear;
  12527. }
  12528. .pops-${PopsType}-search-suggestion{
  12529. position: ${config.isAbsolute ? "absolute" : "fixed"};
  12530. z-index: ${config.zIndex};
  12531. top: 0;
  12532. bottom: 0;
  12533. left: 0;
  12534. right: 0;
  12535. height: 0;
  12536. border: initial;
  12537. overflow: initial;
  12538. }
  12539. ul.pops-${PopsType}-search-suggestion-hint{
  12540. width: 0;
  12541. left: 0;
  12542. max-height: ${config.maxHeight};
  12543. overflow-x: hidden;
  12544. overflow-y: auto;
  12545. padding: 5px 0;
  12546. background-color: #fff;
  12547. box-sizing: border-box;
  12548. border-radius: 4px;
  12549. box-shadow: 0 1px 6px rgb(0 0 0 / 20%);
  12550. position: absolute;
  12551. }
  12552. ul.pops-${PopsType}-search-suggestion-hint li{
  12553. padding: 7px;
  12554. margin: 0;
  12555. clear: both;
  12556. color: #515a6e;
  12557. font-size: 14px;
  12558. list-style: none;
  12559. cursor: pointer;
  12560. transition: background .2s ease-in-out;
  12561. overflow: hidden;
  12562. text-overflow: ellipsis;
  12563. }
  12564. ul.pops-${PopsType}-search-suggestion-hint li[data-none]{
  12565. text-align: center;
  12566. font-size: 12px;
  12567. color: #8e8e8e;
  12568. }
  12569. ul.pops-${PopsType}-search-suggestion-hint li:hover{
  12570. background-color: rgba(0, 0, 0, .1);
  12571. }
  12572. </style>
  12573. <ul class="pops-${PopsType}-search-suggestion-hint">
  12574. ${config.toSearhNotResultHTML}
  12575. </ul>
  12576. `,
  12577. },
  12578. {
  12579. "data-guid": guid,
  12580. "type-value": PopsType,
  12581. }
  12582. );
  12583. if (config.className !== "" && config.className != null) {
  12584. PopsDOMUtils.addClassName(element, config.className);
  12585. }
  12586. return element;
  12587. },
  12588. /**
  12589. * 获取显示出搜索建议框的每一项的html
  12590. * @param {PopsSearchSuggestionData} item 当前项的值
  12591. * @param {number} index 当前项的下标
  12592. */
  12593. getSearchItemLiElement(item, index) {
  12594. // @ts-ignore
  12595. return PopsDOMUtils.createElement("li", {
  12596. className: `pops-${PopsType}-search-suggestion-hint-item pops-flex-items-center pops-flex-y-center`,
  12597. "data-index": index,
  12598. "data-value": this.getItemDataValue(item),
  12599. innerHTML: `
  12600. ${config.getItemHTML(item)}
  12601. ${
  12602. // @ts-ignore
  12603. config.deleteIcon.enable ? this.getDeleteIconHTML() : ""
  12604. }
  12605. `,
  12606. });
  12607. },
  12608. /**
  12609. * 获取data-value值
  12610. * @param {PopsSearchSuggestionData} item
  12611. */
  12612. getItemDataValue(item) {
  12613. return item;
  12614. },
  12615. /**
  12616. * 设置搜索建议框每一项的点击事件
  12617. * @param {HTMLLIElement} liElement
  12618. */
  12619. setSearchItemClickEvent(liElement) {
  12620. PopsDOMUtils.on(
  12621. liElement,
  12622. "click",
  12623. void 0,
  12624. (event) => {
  12625. PopsUtils.preventEvent(event);
  12626. // @ts-ignore
  12627. if (event.target.closest(`.pops-${PopsType}-delete-icon`)) {
  12628. /* 点击的是删除按钮 */
  12629. // @ts-ignore
  12630. config.deleteIcon.callback(
  12631. // @ts-ignore
  12632. event,
  12633. liElement,
  12634. // @ts-ignore
  12635. liElement["data-value"]
  12636. );
  12637. if (!this.hintULElement.children.length) {
  12638. /* 全删完了 */
  12639. this.clear();
  12640. }
  12641. } else {
  12642. /* 点击项主体 */
  12643. config.itemClickCallBack(
  12644. // @ts-ignore
  12645. event,
  12646. liElement,
  12647. // @ts-ignore
  12648. liElement["data-value"]
  12649. );
  12650. }
  12651. },
  12652. {
  12653. capture: true,
  12654. }
  12655. );
  12656. },
  12657. /**
  12658. * 监听输入框内容改变
  12659. */
  12660. setInputChangeEvent() {
  12661. /* 是input输入框 */
  12662. /* 禁用输入框自动提示 */
  12663. // @ts-ignore
  12664. config.inputTarget.setAttribute("autocomplete", "off");
  12665. /* 内容改变事件 */
  12666. PopsDOMUtils.on(
  12667. // @ts-ignore
  12668. config.inputTarget,
  12669. "input",
  12670. void 0,
  12671. async (event) => {
  12672. // @ts-ignore
  12673. let getListResult = await config.getData(event.target.value);
  12674. this.update(getListResult);
  12675. },
  12676. {
  12677. capture: true,
  12678. }
  12679. );
  12680. },
  12681. /**
  12682. * 移除输入框内容改变的监听
  12683. */
  12684. removeInputChangeEvent() {
  12685. // @ts-ignore
  12686. PopsDOMUtils.off(config.inputTarget, "input", void 0, void 0, {
  12687. capture: true,
  12688. });
  12689. },
  12690. /**
  12691. * 显示搜索建议框的事件
  12692. */
  12693. showEvent() {
  12694. SearchSuggestion.changeHintULElementPosition();
  12695. SearchSuggestion.changeHintULElementWidth();
  12696. SearchSuggestion.show();
  12697. },
  12698. /**
  12699. * 设置显示搜索建议框的事件
  12700. */
  12701. setShowEvent() {
  12702. /* 焦点|点击事件*/
  12703. PopsDOMUtils.on(
  12704. // @ts-ignore
  12705. [config.target, config.inputTarget],
  12706. ["focus", "click"],
  12707. void 0,
  12708. this.showEvent,
  12709. {
  12710. capture: true,
  12711. }
  12712. );
  12713. },
  12714. /**
  12715. * 移除显示搜索建议框的事件
  12716. */
  12717. removeShowEvent() {
  12718. /* 焦点|点击事件*/
  12719. PopsDOMUtils.off(
  12720. // @ts-ignore
  12721. [config.target, config.inputTarget],
  12722. ["focus", "click"],
  12723. void 0,
  12724. this.showEvent,
  12725. {
  12726. capture: true,
  12727. }
  12728. );
  12729. },
  12730. /**
  12731. * 隐藏搜索建议框的事件
  12732. * @param {PointerEvent|MouseEvent} event
  12733. */
  12734. hideEvent(event) {
  12735. if (event.target instanceof Node) {
  12736. if ($shadowContainer.contains(event.target)) {
  12737. /* 点击在shadow上的 */
  12738. return;
  12739. }
  12740. if (config.target.contains(event.target)) {
  12741. /* 点击在目标元素内 */
  12742. return;
  12743. }
  12744. // @ts-ignore
  12745. if (config.inputTarget.contains(event.target)) {
  12746. /* 点击在目标input内 */
  12747. return;
  12748. }
  12749. SearchSuggestion.hide();
  12750. }
  12751. },
  12752. /**
  12753. * 设置隐藏搜索建议框的事件
  12754. */
  12755. setHideEvent() {
  12756. /* 全局点击事件 */
  12757. /* 全局触摸屏点击事件 */
  12758. PopsDOMUtils.on(
  12759. // @ts-ignore
  12760. SearchSuggestion.selfDocument,
  12761. ["click", "touchstart"],
  12762. void 0,
  12763. this.hideEvent,
  12764. {
  12765. capture: true,
  12766. }
  12767. );
  12768. },
  12769. /**
  12770. * 移除隐藏搜索建议框的事件
  12771. */
  12772. removeHideEvent() {
  12773. PopsDOMUtils.off(
  12774. // @ts-ignore
  12775. SearchSuggestion.selfDocument,
  12776. ["click", "touchstart"],
  12777. void 0,
  12778. this.hideEvent,
  12779. {
  12780. capture: true,
  12781. }
  12782. );
  12783. },
  12784. /**
  12785. * 设置所有监听
  12786. */
  12787. setAllEvent() {
  12788. this.setInputChangeEvent();
  12789. this.setHideEvent();
  12790. this.setShowEvent();
  12791. },
  12792. /**
  12793. * 移除所有监听
  12794. */
  12795. removeAllEvent() {
  12796. this.removeInputChangeEvent();
  12797. this.removeHideEvent();
  12798. this.removeShowEvent();
  12799. },
  12800. /**
  12801. * 获取删除按钮的html
  12802. */
  12803. getDeleteIconHTML(size = 16, fill = "#bababa") {
  12804. return `
  12805. <svg class="pops-${PopsType}-delete-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="${fill}">
  12806. <path d="M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z"></path>
  12807. <path d="M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z"></path>
  12808. </svg>
  12809. `;
  12810. },
  12811. /**
  12812. * 设置当前正在搜索中的提示
  12813. */
  12814. setPromptsInSearch() {
  12815. // @ts-ignore
  12816. let isSearchingElement = PopsDOMUtils.createElement("li", {
  12817. className: `pops-${PopsType}-search-suggestion-hint-searching-item`,
  12818. innerHTML: config.searchingTip,
  12819. });
  12820. SearchSuggestion.hintULElement.appendChild(isSearchingElement);
  12821. },
  12822. /**
  12823. * 移除正在搜索中的提示
  12824. */
  12825. removePromptsInSearch() {
  12826. SearchSuggestion.hintULElement
  12827. .querySelector(
  12828. `li.pops-${PopsType}-search-suggestion-hint-searching-item`
  12829. )
  12830. ?.remove();
  12831. },
  12832. /**
  12833. * 清空所有的搜索结果
  12834. */
  12835. clearAllSearchItemLi() {
  12836. SearchSuggestion.hintULElement.innerHTML = "";
  12837. },
  12838. /**
  12839. * 修改搜索建议框的位置(top、left)
  12840. * 因为目标元素可能是动态隐藏的
  12841. */
  12842. changeHintULElementPosition(
  12843. target = config.target ?? config.inputTarget
  12844. ) {
  12845. let targetRect = config.isAbsolute
  12846. ? PopsDOMUtils.offset(target)
  12847. : target.getBoundingClientRect();
  12848.  
  12849. SearchSuggestion.hintULElement.style.top =
  12850. // @ts-ignore
  12851. targetRect.height + targetRect.top + config.topDistance + "px";
  12852. SearchSuggestion.hintULElement.style.left = targetRect.left + "px";
  12853. },
  12854. /**
  12855. * 修改搜索建议框的width
  12856. * 因为目标元素可能是动态隐藏的
  12857. */
  12858. changeHintULElementWidth(target = config.target ?? config.inputTarget) {
  12859. let targetRect = target.getBoundingClientRect();
  12860. if (config.followTargetWidth) {
  12861. SearchSuggestion.hintULElement.style.width = targetRect.width + "px";
  12862. } else {
  12863. // @ts-ignore
  12864. SearchSuggestion.hintULElement.style.width = config.width;
  12865. }
  12866. },
  12867. /**
  12868. * 更新页面显示的搜索结果
  12869. * @param {PopsSearchSuggestionData[]} data
  12870. */
  12871. update(data = []) {
  12872. if (!Array.isArray(data)) {
  12873. throw new TypeError("传入的数据不是数组");
  12874. }
  12875. config.data = data;
  12876. /* 清空已有的搜索结果 */
  12877. if (config.data.length) {
  12878. this.clearAllSearchItemLi();
  12879. /* 添加进ul中 */
  12880. config.data.forEach((item, index) => {
  12881. let itemElement = this.getSearchItemLiElement(item, index);
  12882. // @ts-ignore
  12883. this.setSearchItemClickEvent(itemElement);
  12884. this.hintULElement.appendChild(itemElement);
  12885. });
  12886. } else {
  12887. /* 清空 */
  12888. this.clear();
  12889. }
  12890. },
  12891. /**
  12892. * 清空当前的搜索结果并显示无结果
  12893. */
  12894. clear() {
  12895. this.clearAllSearchItemLi();
  12896. this.hintULElement.appendChild(
  12897. // @ts-ignore
  12898. PopsUtils.parseTextToDOM(config.toSearhNotResultHTML)
  12899. );
  12900. },
  12901. /**
  12902. * 隐藏搜索建议框
  12903. */
  12904. hide() {
  12905. this.root.style.display = "none";
  12906. },
  12907. /**
  12908. * 显示搜索建议框
  12909. */
  12910. show() {
  12911. this.root.style.display = "";
  12912. },
  12913. };
  12914. return SearchSuggestion;
  12915. };
  12916. return pops;
  12917. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址