@delon/abc 15.2.0 → 16.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/auto-focus/auto-focus.directive.d.ts +1 -1
  2. package/avatar-list/avatar-list-item.component.d.ts +1 -1
  3. package/avatar-list/avatar-list.component.d.ts +1 -1
  4. package/count-down/count-down.component.d.ts +1 -1
  5. package/date-picker/range.directive.d.ts +1 -1
  6. package/down-file/down-file.directive.d.ts +1 -1
  7. package/ellipsis/ellipsis.component.d.ts +1 -1
  8. package/error-collect/error-collect.component.d.ts +1 -1
  9. package/esm2022/auto-focus/auto-focus.directive.mjs +51 -0
  10. package/esm2022/auto-focus/auto-focus.module.mjs +18 -0
  11. package/esm2022/avatar-list/avatar-list-item.component.mjs +27 -0
  12. package/esm2022/avatar-list/avatar-list.component.mjs +89 -0
  13. package/esm2022/avatar-list/avatar-list.module.mjs +23 -0
  14. package/esm2022/count-down/count-down.component.mjs +46 -0
  15. package/esm2022/count-down/count-down.module.mjs +21 -0
  16. package/esm2022/date-picker/date-picker.module.mjs +23 -0
  17. package/esm2022/date-picker/range-shortcut.component.mjs +41 -0
  18. package/esm2022/date-picker/range.directive.mjs +174 -0
  19. package/esm2022/down-file/down-file.directive.mjs +115 -0
  20. package/esm2022/down-file/down-file.module.mjs +21 -0
  21. package/esm2022/ellipsis/ellipsis.component.mjs +233 -0
  22. package/esm2022/ellipsis/ellipsis.module.mjs +22 -0
  23. package/esm2022/error-collect/error-collect.component.mjs +122 -0
  24. package/esm2022/error-collect/error-collect.module.mjs +21 -0
  25. package/esm2022/exception/exception.component.mjs +109 -0
  26. package/esm2022/exception/exception.module.mjs +24 -0
  27. package/esm2022/footer-toolbar/footer-toolbar.component.mjs +45 -0
  28. package/esm2022/footer-toolbar/footer-toolbar.module.mjs +22 -0
  29. package/esm2022/full-content/full-content-toggle.directive.mjs +25 -0
  30. package/esm2022/full-content/full-content.component.mjs +140 -0
  31. package/esm2022/full-content/full-content.module.mjs +21 -0
  32. package/esm2022/full-content/full-content.service.mjs +23 -0
  33. package/esm2022/global-footer/global-footer-item.component.mjs +31 -0
  34. package/esm2022/global-footer/global-footer.component.mjs +73 -0
  35. package/esm2022/global-footer/global-footer.module.mjs +22 -0
  36. package/esm2022/hotkey/hotkey.directive.mjs +37 -0
  37. package/esm2022/hotkey/hotkey.module.mjs +18 -0
  38. package/esm2022/let/let.directive.mjs +38 -0
  39. package/esm2022/let/let.module.mjs +18 -0
  40. package/esm2022/loading/loading.component.mjs +27 -0
  41. package/esm2022/loading/loading.module.mjs +24 -0
  42. package/esm2022/loading/loading.service.mjs +91 -0
  43. package/esm2022/lodop/lodop.module.mjs +13 -0
  44. package/esm2022/lodop/lodop.service.mjs +223 -0
  45. package/esm2022/media/media.component.mjs +118 -0
  46. package/esm2022/media/media.module.mjs +20 -0
  47. package/esm2022/media/media.service.mjs +47 -0
  48. package/esm2022/notice-icon/notice-icon-tab.component.mjs +35 -0
  49. package/esm2022/notice-icon/notice-icon.component.mjs +90 -0
  50. package/esm2022/notice-icon/notice-icon.module.mjs +59 -0
  51. package/esm2022/observers/observer-size.mjs +119 -0
  52. package/esm2022/onboarding/onboarding.component.mjs +135 -0
  53. package/esm2022/onboarding/onboarding.module.mjs +27 -0
  54. package/esm2022/onboarding/onboarding.service.mjs +186 -0
  55. package/esm2022/page-header/page-header.component.mjs +247 -0
  56. package/esm2022/page-header/page-header.module.mjs +25 -0
  57. package/esm2022/pdf/pdf.component.mjs +474 -0
  58. package/esm2022/pdf/pdf.module.mjs +21 -0
  59. package/esm2022/qr/qr.component.mjs +137 -0
  60. package/esm2022/qr/qr.module.mjs +20 -0
  61. package/esm2022/quick-menu/quick-menu.component.mjs +90 -0
  62. package/esm2022/quick-menu/quick-menu.module.mjs +22 -0
  63. package/esm2022/result/result.component.mjs +61 -0
  64. package/esm2022/result/result.module.mjs +22 -0
  65. package/esm2022/reuse-tab/reuse-tab-context-menu.component.mjs +77 -0
  66. package/esm2022/reuse-tab/reuse-tab-context.component.mjs +34 -0
  67. package/esm2022/reuse-tab/reuse-tab-context.directive.mjs +36 -0
  68. package/esm2022/reuse-tab/reuse-tab-context.service.mjs +56 -0
  69. package/esm2022/reuse-tab/reuse-tab.component.mjs +368 -0
  70. package/esm2022/reuse-tab/reuse-tab.module.mjs +50 -0
  71. package/esm2022/reuse-tab/reuse-tab.service.mjs +559 -0
  72. package/esm2022/se/se-container.component.mjs +174 -0
  73. package/esm2022/se/se.component.mjs +235 -0
  74. package/esm2022/se/se.module.mjs +24 -0
  75. package/esm2022/sg/sg-container.component.mjs +53 -0
  76. package/esm2022/sg/sg.component.mjs +68 -0
  77. package/esm2022/sg/sg.module.mjs +21 -0
  78. package/esm2022/st/st-column-source.mjs +493 -0
  79. package/esm2022/st/st-data-source.mjs +480 -0
  80. package/esm2022/st/st-export.mjs +90 -0
  81. package/{esm2020 → esm2022}/st/st-filter.component.mjs +8 -7
  82. package/esm2022/st/st-row.directive.mjs +47 -0
  83. package/esm2022/st/st-widget-host.directive.mjs +32 -0
  84. package/esm2022/st/st-widget.mjs +27 -0
  85. package/esm2022/st/st.component.mjs +1004 -0
  86. package/esm2022/st/st.module.mjs +97 -0
  87. package/esm2022/sv/sv-container.component.mjs +127 -0
  88. package/esm2022/sv/sv-value.component.mjs +45 -0
  89. package/esm2022/sv/sv.component.mjs +120 -0
  90. package/esm2022/sv/sv.module.mjs +26 -0
  91. package/esm2022/tag-select/tag-select.component.mjs +64 -0
  92. package/esm2022/tag-select/tag-select.module.mjs +22 -0
  93. package/esm2022/xlsx/xlsx.directive.mjs +28 -0
  94. package/esm2022/xlsx/xlsx.module.mjs +20 -0
  95. package/esm2022/xlsx/xlsx.service.mjs +129 -0
  96. package/esm2022/zip/zip.module.mjs +16 -0
  97. package/esm2022/zip/zip.service.mjs +117 -0
  98. package/exception/exception.component.d.ts +1 -1
  99. package/{fesm2015 → fesm2022}/auto-focus.mjs +7 -7
  100. package/{fesm2015 → fesm2022}/auto-focus.mjs.map +1 -1
  101. package/{fesm2020 → fesm2022}/avatar-list.mjs +10 -10
  102. package/fesm2022/avatar-list.mjs.map +1 -0
  103. package/{fesm2020 → fesm2022}/chart-observer-size.mjs +10 -10
  104. package/fesm2022/chart-observer-size.mjs.map +1 -0
  105. package/{fesm2020 → fesm2022}/count-down.mjs +7 -7
  106. package/fesm2022/count-down.mjs.map +1 -0
  107. package/{fesm2020 → fesm2022}/date-picker.mjs +14 -13
  108. package/fesm2022/date-picker.mjs.map +1 -0
  109. package/{fesm2020 → fesm2022}/down-file.mjs +8 -8
  110. package/fesm2022/down-file.mjs.map +1 -0
  111. package/{fesm2020 → fesm2022}/ellipsis.mjs +7 -7
  112. package/fesm2022/ellipsis.mjs.map +1 -0
  113. package/{fesm2020 → fesm2022}/error-collect.mjs +9 -9
  114. package/fesm2022/error-collect.mjs.map +1 -0
  115. package/{fesm2020 → fesm2022}/exception.mjs +7 -7
  116. package/fesm2022/exception.mjs.map +1 -0
  117. package/{fesm2020 → fesm2022}/footer-toolbar.mjs +7 -7
  118. package/fesm2022/footer-toolbar.mjs.map +1 -0
  119. package/{fesm2020 → fesm2022}/full-content.mjs +13 -13
  120. package/fesm2022/full-content.mjs.map +1 -0
  121. package/{fesm2020 → fesm2022}/global-footer.mjs +10 -10
  122. package/fesm2022/global-footer.mjs.map +1 -0
  123. package/{fesm2020 → fesm2022}/hotkey.mjs +7 -7
  124. package/{fesm2015 → fesm2022}/hotkey.mjs.map +1 -1
  125. package/{fesm2020 → fesm2022}/let.mjs +9 -8
  126. package/fesm2022/let.mjs.map +1 -0
  127. package/{fesm2020 → fesm2022}/loading.mjs +10 -11
  128. package/fesm2022/loading.mjs.map +1 -0
  129. package/{fesm2020 → fesm2022}/lodop.mjs +7 -7
  130. package/{fesm2020 → fesm2022}/lodop.mjs.map +1 -1
  131. package/{fesm2020 → fesm2022}/media.mjs +10 -10
  132. package/fesm2022/media.mjs.map +1 -0
  133. package/fesm2022/notice-icon.mjs +180 -0
  134. package/fesm2022/notice-icon.mjs.map +1 -0
  135. package/{fesm2020 → fesm2022}/onboarding.mjs +10 -11
  136. package/{fesm2020 → fesm2022}/onboarding.mjs.map +1 -1
  137. package/{fesm2020 → fesm2022}/page-header.mjs +7 -7
  138. package/{fesm2015 → fesm2022}/page-header.mjs.map +1 -1
  139. package/{fesm2020 → fesm2022}/pdf.mjs +9 -10
  140. package/fesm2022/pdf.mjs.map +1 -0
  141. package/{fesm2015 → fesm2022}/qr.mjs +7 -7
  142. package/{fesm2020 → fesm2022}/qr.mjs.map +1 -1
  143. package/{fesm2020 → fesm2022}/quick-menu.mjs +7 -7
  144. package/fesm2022/quick-menu.mjs.map +1 -0
  145. package/{fesm2020 → fesm2022}/result.mjs +7 -7
  146. package/{fesm2020 → fesm2022}/result.mjs.map +1 -1
  147. package/{fesm2020 → fesm2022}/reuse-tab.mjs +31 -31
  148. package/{fesm2015 → fesm2022}/reuse-tab.mjs.map +1 -1
  149. package/{fesm2020 → fesm2022}/se.mjs +15 -15
  150. package/fesm2022/se.mjs.map +1 -0
  151. package/{fesm2020 → fesm2022}/sg.mjs +10 -10
  152. package/fesm2022/sg.mjs.map +1 -0
  153. package/{fesm2020 → fesm2022}/st.mjs +72 -72
  154. package/fesm2022/st.mjs.map +1 -0
  155. package/{fesm2020 → fesm2022}/sv.mjs +20 -20
  156. package/fesm2022/sv.mjs.map +1 -0
  157. package/{fesm2020 → fesm2022}/tag-select.mjs +7 -7
  158. package/fesm2022/tag-select.mjs.map +1 -0
  159. package/{fesm2020 → fesm2022}/xlsx.mjs +10 -10
  160. package/fesm2022/xlsx.mjs.map +1 -0
  161. package/{fesm2020 → fesm2022}/zip.mjs +7 -7
  162. package/{fesm2015 → fesm2022}/zip.mjs.map +1 -1
  163. package/footer-toolbar/footer-toolbar.component.d.ts +1 -1
  164. package/full-content/full-content.component.d.ts +1 -1
  165. package/global-footer/global-footer-item.component.d.ts +1 -1
  166. package/global-footer/global-footer.component.d.ts +1 -1
  167. package/hotkey/hotkey.directive.d.ts +1 -1
  168. package/let/let.directive.d.ts +1 -1
  169. package/loading/style/index.less +1 -4
  170. package/media/media.component.d.ts +1 -1
  171. package/notice-icon/notice-icon-tab.component.d.ts +1 -1
  172. package/notice-icon/notice-icon.component.d.ts +1 -1
  173. package/onboarding/style/index.less +1 -4
  174. package/package.json +105 -175
  175. package/page-header/page-header.component.d.ts +1 -1
  176. package/pdf/pdf.component.d.ts +1 -1
  177. package/qr/qr.component.d.ts +1 -1
  178. package/quick-menu/quick-menu.component.d.ts +1 -1
  179. package/result/result.component.d.ts +1 -1
  180. package/reuse-tab/reuse-tab-context-menu.component.d.ts +1 -1
  181. package/reuse-tab/reuse-tab-context.component.d.ts +1 -1
  182. package/reuse-tab/reuse-tab-context.directive.d.ts +1 -1
  183. package/reuse-tab/reuse-tab.component.d.ts +1 -1
  184. package/se/se-container.component.d.ts +1 -1
  185. package/se/se.component.d.ts +1 -1
  186. package/sg/sg-container.component.d.ts +1 -1
  187. package/sg/sg.component.d.ts +1 -1
  188. package/st/st-filter.component.d.ts +1 -1
  189. package/st/st-row.directive.d.ts +1 -1
  190. package/st/st-widget-host.directive.d.ts +1 -1
  191. package/st/st.component.d.ts +9 -5
  192. package/st/style/index.less +6 -2
  193. package/sv/sv-container.component.d.ts +1 -1
  194. package/sv/sv-value.component.d.ts +1 -1
  195. package/sv/sv.component.d.ts +1 -1
  196. package/tag-select/tag-select.component.d.ts +1 -1
  197. package/xlsx/xlsx.directive.d.ts +1 -1
  198. package/esm2020/auto-focus/auto-focus.directive.mjs +0 -50
  199. package/esm2020/auto-focus/auto-focus.module.mjs +0 -17
  200. package/esm2020/avatar-list/avatar-list-item.component.mjs +0 -26
  201. package/esm2020/avatar-list/avatar-list.component.mjs +0 -88
  202. package/esm2020/avatar-list/avatar-list.module.mjs +0 -22
  203. package/esm2020/count-down/count-down.component.mjs +0 -45
  204. package/esm2020/count-down/count-down.module.mjs +0 -20
  205. package/esm2020/date-picker/date-picker.module.mjs +0 -22
  206. package/esm2020/date-picker/range-shortcut.component.mjs +0 -40
  207. package/esm2020/date-picker/range.directive.mjs +0 -172
  208. package/esm2020/down-file/down-file.directive.mjs +0 -114
  209. package/esm2020/down-file/down-file.module.mjs +0 -20
  210. package/esm2020/ellipsis/ellipsis.component.mjs +0 -232
  211. package/esm2020/ellipsis/ellipsis.module.mjs +0 -21
  212. package/esm2020/error-collect/error-collect.component.mjs +0 -121
  213. package/esm2020/error-collect/error-collect.module.mjs +0 -20
  214. package/esm2020/exception/exception.component.mjs +0 -108
  215. package/esm2020/exception/exception.module.mjs +0 -23
  216. package/esm2020/footer-toolbar/footer-toolbar.component.mjs +0 -44
  217. package/esm2020/footer-toolbar/footer-toolbar.module.mjs +0 -21
  218. package/esm2020/full-content/full-content-toggle.directive.mjs +0 -24
  219. package/esm2020/full-content/full-content.component.mjs +0 -139
  220. package/esm2020/full-content/full-content.module.mjs +0 -20
  221. package/esm2020/full-content/full-content.service.mjs +0 -22
  222. package/esm2020/global-footer/global-footer-item.component.mjs +0 -30
  223. package/esm2020/global-footer/global-footer.component.mjs +0 -72
  224. package/esm2020/global-footer/global-footer.module.mjs +0 -21
  225. package/esm2020/hotkey/hotkey.directive.mjs +0 -36
  226. package/esm2020/hotkey/hotkey.module.mjs +0 -17
  227. package/esm2020/let/let.directive.mjs +0 -36
  228. package/esm2020/let/let.module.mjs +0 -17
  229. package/esm2020/loading/loading.component.mjs +0 -26
  230. package/esm2020/loading/loading.module.mjs +0 -24
  231. package/esm2020/loading/loading.service.mjs +0 -90
  232. package/esm2020/lodop/lodop.module.mjs +0 -12
  233. package/esm2020/lodop/lodop.service.mjs +0 -222
  234. package/esm2020/media/media.component.mjs +0 -117
  235. package/esm2020/media/media.module.mjs +0 -19
  236. package/esm2020/media/media.service.mjs +0 -46
  237. package/esm2020/notice-icon/notice-icon-tab.component.mjs +0 -34
  238. package/esm2020/notice-icon/notice-icon.component.mjs +0 -89
  239. package/esm2020/notice-icon/notice-icon.module.mjs +0 -58
  240. package/esm2020/observers/observer-size.mjs +0 -116
  241. package/esm2020/onboarding/onboarding.component.mjs +0 -134
  242. package/esm2020/onboarding/onboarding.module.mjs +0 -27
  243. package/esm2020/onboarding/onboarding.service.mjs +0 -185
  244. package/esm2020/page-header/page-header.component.mjs +0 -246
  245. package/esm2020/page-header/page-header.module.mjs +0 -24
  246. package/esm2020/pdf/pdf.component.mjs +0 -474
  247. package/esm2020/pdf/pdf.module.mjs +0 -20
  248. package/esm2020/qr/qr.component.mjs +0 -136
  249. package/esm2020/qr/qr.module.mjs +0 -19
  250. package/esm2020/quick-menu/quick-menu.component.mjs +0 -89
  251. package/esm2020/quick-menu/quick-menu.module.mjs +0 -21
  252. package/esm2020/result/result.component.mjs +0 -60
  253. package/esm2020/result/result.module.mjs +0 -21
  254. package/esm2020/reuse-tab/reuse-tab-context-menu.component.mjs +0 -76
  255. package/esm2020/reuse-tab/reuse-tab-context.component.mjs +0 -33
  256. package/esm2020/reuse-tab/reuse-tab-context.directive.mjs +0 -35
  257. package/esm2020/reuse-tab/reuse-tab-context.service.mjs +0 -55
  258. package/esm2020/reuse-tab/reuse-tab.component.mjs +0 -367
  259. package/esm2020/reuse-tab/reuse-tab.module.mjs +0 -49
  260. package/esm2020/reuse-tab/reuse-tab.service.mjs +0 -558
  261. package/esm2020/se/se-container.component.mjs +0 -172
  262. package/esm2020/se/se.component.mjs +0 -234
  263. package/esm2020/se/se.module.mjs +0 -23
  264. package/esm2020/sg/sg-container.component.mjs +0 -52
  265. package/esm2020/sg/sg.component.mjs +0 -67
  266. package/esm2020/sg/sg.module.mjs +0 -20
  267. package/esm2020/st/st-column-source.mjs +0 -492
  268. package/esm2020/st/st-data-source.mjs +0 -479
  269. package/esm2020/st/st-export.mjs +0 -89
  270. package/esm2020/st/st-row.directive.mjs +0 -45
  271. package/esm2020/st/st-widget-host.directive.mjs +0 -31
  272. package/esm2020/st/st-widget.mjs +0 -26
  273. package/esm2020/st/st.component.mjs +0 -1002
  274. package/esm2020/st/st.module.mjs +0 -96
  275. package/esm2020/sv/sv-container.component.mjs +0 -125
  276. package/esm2020/sv/sv-value.component.mjs +0 -44
  277. package/esm2020/sv/sv.component.mjs +0 -119
  278. package/esm2020/sv/sv.module.mjs +0 -25
  279. package/esm2020/tag-select/tag-select.component.mjs +0 -63
  280. package/esm2020/tag-select/tag-select.module.mjs +0 -21
  281. package/esm2020/xlsx/xlsx.directive.mjs +0 -27
  282. package/esm2020/xlsx/xlsx.module.mjs +0 -19
  283. package/esm2020/xlsx/xlsx.service.mjs +0 -128
  284. package/esm2020/zip/zip.module.mjs +0 -15
  285. package/esm2020/zip/zip.service.mjs +0 -116
  286. package/fesm2015/avatar-list.mjs +0 -139
  287. package/fesm2015/avatar-list.mjs.map +0 -1
  288. package/fesm2015/chart-observer-size.mjs +0 -124
  289. package/fesm2015/chart-observer-size.mjs.map +0 -1
  290. package/fesm2015/count-down.mjs +0 -69
  291. package/fesm2015/count-down.mjs.map +0 -1
  292. package/fesm2015/date-picker.mjs +0 -236
  293. package/fesm2015/date-picker.mjs.map +0 -1
  294. package/fesm2015/down-file.mjs +0 -141
  295. package/fesm2015/down-file.mjs.map +0 -1
  296. package/fesm2015/ellipsis.mjs +0 -258
  297. package/fesm2015/ellipsis.mjs.map +0 -1
  298. package/fesm2015/error-collect.mjs +0 -147
  299. package/fesm2015/error-collect.mjs.map +0 -1
  300. package/fesm2015/exception.mjs +0 -138
  301. package/fesm2015/exception.mjs.map +0 -1
  302. package/fesm2015/footer-toolbar.mjs +0 -70
  303. package/fesm2015/footer-toolbar.mjs.map +0 -1
  304. package/fesm2015/full-content.mjs +0 -202
  305. package/fesm2015/full-content.mjs.map +0 -1
  306. package/fesm2015/global-footer.mjs +0 -126
  307. package/fesm2015/global-footer.mjs.map +0 -1
  308. package/fesm2015/hotkey.mjs +0 -57
  309. package/fesm2015/let.mjs +0 -59
  310. package/fesm2015/let.mjs.map +0 -1
  311. package/fesm2015/loading.mjs +0 -142
  312. package/fesm2015/loading.mjs.map +0 -1
  313. package/fesm2015/lodop.mjs +0 -232
  314. package/fesm2015/lodop.mjs.map +0 -1
  315. package/fesm2015/media.mjs +0 -180
  316. package/fesm2015/media.mjs.map +0 -1
  317. package/fesm2015/notice-icon.mjs +0 -180
  318. package/fesm2015/notice-icon.mjs.map +0 -1
  319. package/fesm2015/onboarding.mjs +0 -336
  320. package/fesm2015/onboarding.mjs.map +0 -1
  321. package/fesm2015/page-header.mjs +0 -276
  322. package/fesm2015/pdf.mjs +0 -517
  323. package/fesm2015/pdf.mjs.map +0 -1
  324. package/fesm2015/qr.mjs.map +0 -1
  325. package/fesm2015/quick-menu.mjs +0 -114
  326. package/fesm2015/quick-menu.mjs.map +0 -1
  327. package/fesm2015/result.mjs +0 -88
  328. package/fesm2015/result.mjs.map +0 -1
  329. package/fesm2015/reuse-tab.mjs +0 -1217
  330. package/fesm2015/se.mjs +0 -444
  331. package/fesm2015/se.mjs.map +0 -1
  332. package/fesm2015/sg.mjs +0 -139
  333. package/fesm2015/sg.mjs.map +0 -1
  334. package/fesm2015/st.mjs +0 -2526
  335. package/fesm2015/st.mjs.map +0 -1
  336. package/fesm2015/sv.mjs +0 -308
  337. package/fesm2015/sv.mjs.map +0 -1
  338. package/fesm2015/tag-select.mjs +0 -91
  339. package/fesm2015/tag-select.mjs.map +0 -1
  340. package/fesm2015/xlsx.mjs +0 -172
  341. package/fesm2015/xlsx.mjs.map +0 -1
  342. package/fesm2015/zip.mjs +0 -136
  343. package/fesm2020/abc.mjs +0 -7
  344. package/fesm2020/abc.mjs.map +0 -1
  345. package/fesm2020/auto-focus.mjs +0 -71
  346. package/fesm2020/auto-focus.mjs.map +0 -1
  347. package/fesm2020/avatar-list.mjs.map +0 -1
  348. package/fesm2020/chart-observer-size.mjs.map +0 -1
  349. package/fesm2020/count-down.mjs.map +0 -1
  350. package/fesm2020/date-picker.mjs.map +0 -1
  351. package/fesm2020/down-file.mjs.map +0 -1
  352. package/fesm2020/ellipsis.mjs.map +0 -1
  353. package/fesm2020/error-collect.mjs.map +0 -1
  354. package/fesm2020/exception.mjs.map +0 -1
  355. package/fesm2020/footer-toolbar.mjs.map +0 -1
  356. package/fesm2020/full-content.mjs.map +0 -1
  357. package/fesm2020/global-footer.mjs.map +0 -1
  358. package/fesm2020/hotkey.mjs.map +0 -1
  359. package/fesm2020/let.mjs.map +0 -1
  360. package/fesm2020/loading.mjs.map +0 -1
  361. package/fesm2020/media.mjs.map +0 -1
  362. package/fesm2020/notice-icon.mjs +0 -180
  363. package/fesm2020/notice-icon.mjs.map +0 -1
  364. package/fesm2020/page-header.mjs.map +0 -1
  365. package/fesm2020/pdf.mjs.map +0 -1
  366. package/fesm2020/qr.mjs +0 -171
  367. package/fesm2020/quick-menu.mjs.map +0 -1
  368. package/fesm2020/reuse-tab.mjs.map +0 -1
  369. package/fesm2020/se.mjs.map +0 -1
  370. package/fesm2020/sg.mjs.map +0 -1
  371. package/fesm2020/st.mjs.map +0 -1
  372. package/fesm2020/sv.mjs.map +0 -1
  373. package/fesm2020/tag-select.mjs.map +0 -1
  374. package/fesm2020/xlsx.mjs.map +0 -1
  375. package/fesm2020/zip.mjs.map +0 -1
  376. /package/{esm2020 → esm2022}/abc.mjs +0 -0
  377. /package/{esm2020 → esm2022}/auto-focus/auto-focus.mjs +0 -0
  378. /package/{esm2020 → esm2022}/auto-focus/index.mjs +0 -0
  379. /package/{esm2020 → esm2022}/avatar-list/avatar-list.mjs +0 -0
  380. /package/{esm2020 → esm2022}/avatar-list/public_api.mjs +0 -0
  381. /package/{esm2020 → esm2022}/count-down/count-down.mjs +0 -0
  382. /package/{esm2020 → esm2022}/count-down/public_api.mjs +0 -0
  383. /package/{esm2020 → esm2022}/date-picker/date-picker.mjs +0 -0
  384. /package/{esm2020 → esm2022}/date-picker/public_api.mjs +0 -0
  385. /package/{esm2020 → esm2022}/down-file/down-file.mjs +0 -0
  386. /package/{esm2020 → esm2022}/down-file/public_api.mjs +0 -0
  387. /package/{esm2020 → esm2022}/ellipsis/ellipsis.mjs +0 -0
  388. /package/{esm2020 → esm2022}/ellipsis/public_api.mjs +0 -0
  389. /package/{esm2020 → esm2022}/error-collect/error-collect.mjs +0 -0
  390. /package/{esm2020 → esm2022}/error-collect/public_api.mjs +0 -0
  391. /package/{esm2020 → esm2022}/exception/exception.mjs +0 -0
  392. /package/{esm2020 → esm2022}/exception/public_api.mjs +0 -0
  393. /package/{esm2020 → esm2022}/footer-toolbar/footer-toolbar.mjs +0 -0
  394. /package/{esm2020 → esm2022}/footer-toolbar/public_api.mjs +0 -0
  395. /package/{esm2020 → esm2022}/full-content/full-content.mjs +0 -0
  396. /package/{esm2020 → esm2022}/full-content/public_api.mjs +0 -0
  397. /package/{esm2020 → esm2022}/global-footer/global-footer.mjs +0 -0
  398. /package/{esm2020 → esm2022}/global-footer/global-footer.types.mjs +0 -0
  399. /package/{esm2020 → esm2022}/global-footer/public_api.mjs +0 -0
  400. /package/{esm2020 → esm2022}/hotkey/hotkey.mjs +0 -0
  401. /package/{esm2020 → esm2022}/hotkey/public_api.mjs +0 -0
  402. /package/{esm2020 → esm2022}/let/index.mjs +0 -0
  403. /package/{esm2020 → esm2022}/let/let.mjs +0 -0
  404. /package/{esm2020 → esm2022}/loading/loading.mjs +0 -0
  405. /package/{esm2020 → esm2022}/loading/loading.types.mjs +0 -0
  406. /package/{esm2020 → esm2022}/loading/public_api.mjs +0 -0
  407. /package/{esm2020 → esm2022}/lodop/lodop.mjs +0 -0
  408. /package/{esm2020 → esm2022}/lodop/lodop.types.mjs +0 -0
  409. /package/{esm2020 → esm2022}/lodop/public_api.mjs +0 -0
  410. /package/{esm2020 → esm2022}/media/media.mjs +0 -0
  411. /package/{esm2020 → esm2022}/media/public_api.mjs +0 -0
  412. /package/{esm2020 → esm2022}/notice-icon/notice-icon.mjs +0 -0
  413. /package/{esm2020 → esm2022}/notice-icon/notice-icon.types.mjs +0 -0
  414. /package/{esm2020 → esm2022}/notice-icon/public_api.mjs +0 -0
  415. /package/{esm2020 → esm2022}/observers/chart-observer-size.mjs +0 -0
  416. /package/{esm2020 → esm2022}/observers/public-api.mjs +0 -0
  417. /package/{esm2020 → esm2022}/onboarding/onboarding.mjs +0 -0
  418. /package/{esm2020 → esm2022}/onboarding/onboarding.types.mjs +0 -0
  419. /package/{esm2020 → esm2022}/onboarding/public_api.mjs +0 -0
  420. /package/{esm2020 → esm2022}/page-header/page-header.mjs +0 -0
  421. /package/{esm2020 → esm2022}/page-header/public_api.mjs +0 -0
  422. /package/{esm2020 → esm2022}/pdf/pdf.config.mjs +0 -0
  423. /package/{esm2020 → esm2022}/pdf/pdf.mjs +0 -0
  424. /package/{esm2020 → esm2022}/pdf/pdf.types.mjs +0 -0
  425. /package/{esm2020 → esm2022}/pdf/public_api.mjs +0 -0
  426. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  427. /package/{esm2020 → esm2022}/qr/public_api.mjs +0 -0
  428. /package/{esm2020 → esm2022}/qr/qr.config.mjs +0 -0
  429. /package/{esm2020 → esm2022}/qr/qr.mjs +0 -0
  430. /package/{esm2020 → esm2022}/qr/qr.types.mjs +0 -0
  431. /package/{esm2020 → esm2022}/quick-menu/public_api.mjs +0 -0
  432. /package/{esm2020 → esm2022}/quick-menu/quick-menu.mjs +0 -0
  433. /package/{esm2020 → esm2022}/result/public_api.mjs +0 -0
  434. /package/{esm2020 → esm2022}/result/result.mjs +0 -0
  435. /package/{esm2020 → esm2022}/reuse-tab/lifecycle_hooks.mjs +0 -0
  436. /package/{esm2020 → esm2022}/reuse-tab/public_api.mjs +0 -0
  437. /package/{esm2020 → esm2022}/reuse-tab/reuse-tab.interfaces.mjs +0 -0
  438. /package/{esm2020 → esm2022}/reuse-tab/reuse-tab.mjs +0 -0
  439. /package/{esm2020 → esm2022}/reuse-tab/reuse-tab.state.mjs +0 -0
  440. /package/{esm2020 → esm2022}/reuse-tab/reuse-tab.strategy.mjs +0 -0
  441. /package/{esm2020 → esm2022}/se/public_api.mjs +0 -0
  442. /package/{esm2020 → esm2022}/se/se.mjs +0 -0
  443. /package/{esm2020 → esm2022}/se/se.types.mjs +0 -0
  444. /package/{esm2020 → esm2022}/sg/public_api.mjs +0 -0
  445. /package/{esm2020 → esm2022}/sg/sg.mjs +0 -0
  446. /package/{esm2020 → esm2022}/st/public_api.mjs +0 -0
  447. /package/{esm2020 → esm2022}/st/st.config.mjs +0 -0
  448. /package/{esm2020 → esm2022}/st/st.interfaces.mjs +0 -0
  449. /package/{esm2020 → esm2022}/st/st.mjs +0 -0
  450. /package/{esm2020 → esm2022}/st/st.types.mjs +0 -0
  451. /package/{esm2020 → esm2022}/sv/public_api.mjs +0 -0
  452. /package/{esm2020 → esm2022}/sv/sv.mjs +0 -0
  453. /package/{esm2020 → esm2022}/tag-select/public_api.mjs +0 -0
  454. /package/{esm2020 → esm2022}/tag-select/tag-select.mjs +0 -0
  455. /package/{esm2020 → esm2022}/xlsx/public_api.mjs +0 -0
  456. /package/{esm2020 → esm2022}/xlsx/xlsx.mjs +0 -0
  457. /package/{esm2020 → esm2022}/xlsx/xlsx.types.mjs +0 -0
  458. /package/{esm2020 → esm2022}/zip/public_api.mjs +0 -0
  459. /package/{esm2020 → esm2022}/zip/zip.mjs +0 -0
  460. /package/{esm2020 → esm2022}/zip/zip.types.mjs +0 -0
  461. /package/{fesm2015 → fesm2022}/abc.mjs +0 -0
  462. /package/{fesm2015 → fesm2022}/abc.mjs.map +0 -0
@@ -1,1217 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, Injectable, Directive, InjectionToken, Optional, Inject, ViewChild, NgModule } from '@angular/core';
3
- import * as i1 from '@delon/theme';
4
- import { ALAIN_I18N_TOKEN, DelonLocaleModule } from '@delon/theme';
5
- import * as i5 from '@angular/common';
6
- import { DOCUMENT, CommonModule } from '@angular/common';
7
- import * as i3 from 'ng-zorro-antd/menu';
8
- import { NzMenuModule } from 'ng-zorro-antd/menu';
9
- import { Subject, Subscription, BehaviorSubject, timer, of, filter, takeUntil, debounceTime } from 'rxjs';
10
- import * as i1$1 from '@angular/cdk/overlay';
11
- import { ConnectionPositionPair, OverlayModule } from '@angular/cdk/overlay';
12
- import { ComponentPortal } from '@angular/cdk/portal';
13
- import { __decorate } from 'tslib';
14
- import { InputBoolean, InputNumber } from '@delon/util/decorator';
15
- import * as i2 from '@angular/router';
16
- import { ActivatedRoute, Router, ROUTER_CONFIGURATION, NavigationStart, NavigationEnd, RouterModule } from '@angular/router';
17
- import { ScrollService } from '@delon/util/browser';
18
- import * as i3$1 from '@angular/cdk/platform';
19
- import * as i4 from '@angular/cdk/bidi';
20
- import * as i6 from 'ng-zorro-antd/tabs';
21
- import { NzTabsModule } from 'ng-zorro-antd/tabs';
22
- import * as i7 from 'ng-zorro-antd/icon';
23
- import { NzIconModule } from 'ng-zorro-antd/icon';
24
-
25
- class ReuseTabContextMenuComponent {
26
- set i18n(value) {
27
- this._i18n = Object.assign(Object.assign({}, this.i18nSrv.getData('reuseTab')), value);
28
- }
29
- get i18n() {
30
- return this._i18n;
31
- }
32
- get includeNonCloseable() {
33
- return this.event.ctrlKey;
34
- }
35
- constructor(i18nSrv) {
36
- this.i18nSrv = i18nSrv;
37
- this.close = new EventEmitter();
38
- }
39
- notify(type) {
40
- this.close.next({
41
- type,
42
- item: this.item,
43
- includeNonCloseable: this.includeNonCloseable
44
- });
45
- }
46
- ngOnInit() {
47
- if (this.includeNonCloseable)
48
- this.item.closable = true;
49
- }
50
- click(e, type, custom) {
51
- e.preventDefault();
52
- e.stopPropagation();
53
- if (type === 'close' && !this.item.closable)
54
- return;
55
- if (type === 'closeRight' && this.item.last)
56
- return;
57
- if (custom) {
58
- if (this.isDisabled(custom))
59
- return;
60
- custom.fn(this.item, custom);
61
- }
62
- this.notify(type);
63
- }
64
- isDisabled(custom) {
65
- return custom.disabled ? custom.disabled(this.item) : false;
66
- }
67
- closeMenu(event) {
68
- if (event.type === 'click' && event.button === 2)
69
- return;
70
- this.notify(null);
71
- }
72
- }
73
- ReuseTabContextMenuComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextMenuComponent, deps: [{ token: i1.DelonLocaleService }], target: i0.ɵɵFactoryTarget.Component });
74
- ReuseTabContextMenuComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ReuseTabContextMenuComponent, selector: "reuse-tab-context-menu", inputs: { i18n: "i18n", item: "item", event: "event", customContextMenu: "customContextMenu" }, outputs: { close: "close" }, host: { listeners: { "document:click": "closeMenu($event)", "document:contextmenu": "closeMenu($event)" } }, ngImport: i0, template: "<ul nz-menu>\n <li\n *ngIf=\"item.active\"\n nz-menu-item\n (click)=\"click($event, 'refresh')\"\n data-type=\"refresh\"\n [innerHTML]=\"i18n.refresh\"\n ></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'close')\"\n data-type=\"close\"\n [nzDisabled]=\"!item.closable\"\n [innerHTML]=\"i18n.close\"\n ></li>\n <li nz-menu-item (click)=\"click($event, 'closeOther')\" data-type=\"closeOther\" [innerHTML]=\"i18n.closeOther\"></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'closeRight')\"\n data-type=\"closeRight\"\n [nzDisabled]=\"item.last\"\n [innerHTML]=\"i18n.closeRight\"\n ></li>\n <ng-container *ngIf=\"customContextMenu!.length > 0\">\n <li nz-menu-divider></li>\n <li\n *ngFor=\"let i of customContextMenu\"\n nz-menu-item\n [attr.data-type]=\"i.id\"\n [nzDisabled]=\"isDisabled(i)\"\n (click)=\"click($event, 'custom', i)\"\n [innerHTML]=\"i.title\"\n ></li>\n </ng-container>\n</ul>\n", dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "directive", type: i3.NzMenuItemDirective, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "directive", type: i3.NzMenuDividerDirective, selector: "[nz-menu-divider]", exportAs: ["nzMenuDivider"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
75
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextMenuComponent, decorators: [{
76
- type: Component,
77
- args: [{ selector: 'reuse-tab-context-menu', host: {
78
- '(document:click)': 'closeMenu($event)',
79
- '(document:contextmenu)': 'closeMenu($event)'
80
- }, preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ul nz-menu>\n <li\n *ngIf=\"item.active\"\n nz-menu-item\n (click)=\"click($event, 'refresh')\"\n data-type=\"refresh\"\n [innerHTML]=\"i18n.refresh\"\n ></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'close')\"\n data-type=\"close\"\n [nzDisabled]=\"!item.closable\"\n [innerHTML]=\"i18n.close\"\n ></li>\n <li nz-menu-item (click)=\"click($event, 'closeOther')\" data-type=\"closeOther\" [innerHTML]=\"i18n.closeOther\"></li>\n <li\n nz-menu-item\n (click)=\"click($event, 'closeRight')\"\n data-type=\"closeRight\"\n [nzDisabled]=\"item.last\"\n [innerHTML]=\"i18n.closeRight\"\n ></li>\n <ng-container *ngIf=\"customContextMenu!.length > 0\">\n <li nz-menu-divider></li>\n <li\n *ngFor=\"let i of customContextMenu\"\n nz-menu-item\n [attr.data-type]=\"i.id\"\n [nzDisabled]=\"isDisabled(i)\"\n (click)=\"click($event, 'custom', i)\"\n [innerHTML]=\"i.title\"\n ></li>\n </ng-container>\n</ul>\n" }]
81
- }], ctorParameters: function () { return [{ type: i1.DelonLocaleService }]; }, propDecorators: { i18n: [{
82
- type: Input
83
- }], item: [{
84
- type: Input
85
- }], event: [{
86
- type: Input
87
- }], customContextMenu: [{
88
- type: Input
89
- }], close: [{
90
- type: Output
91
- }] } });
92
-
93
- class ReuseTabContextService {
94
- constructor(overlay) {
95
- this.overlay = overlay;
96
- this.ref = null;
97
- this.show = new Subject();
98
- this.close = new Subject();
99
- }
100
- remove() {
101
- if (!this.ref)
102
- return;
103
- this.ref.detach();
104
- this.ref.dispose();
105
- this.ref = null;
106
- }
107
- open(context) {
108
- this.remove();
109
- const { event, item, customContextMenu } = context;
110
- const { x, y } = event;
111
- const positions = [
112
- new ConnectionPositionPair({ originX: 'start', originY: 'bottom' }, { overlayX: 'start', overlayY: 'top' }),
113
- new ConnectionPositionPair({ originX: 'start', originY: 'top' }, { overlayX: 'start', overlayY: 'bottom' })
114
- ];
115
- const positionStrategy = this.overlay.position().flexibleConnectedTo({ x, y }).withPositions(positions);
116
- this.ref = this.overlay.create({
117
- positionStrategy,
118
- panelClass: 'reuse-tab__cm',
119
- scrollStrategy: this.overlay.scrollStrategies.close()
120
- });
121
- const comp = this.ref.attach(new ComponentPortal(ReuseTabContextMenuComponent));
122
- const instance = comp.instance;
123
- instance.i18n = this.i18n;
124
- instance.item = Object.assign({}, item);
125
- instance.customContextMenu = customContextMenu;
126
- instance.event = event;
127
- const sub$ = new Subscription();
128
- sub$.add(instance.close.subscribe((res) => {
129
- this.close.next(res);
130
- this.remove();
131
- }));
132
- comp.onDestroy(() => sub$.unsubscribe());
133
- }
134
- }
135
- ReuseTabContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextService, deps: [{ token: i1$1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
136
- ReuseTabContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextService });
137
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextService, decorators: [{
138
- type: Injectable
139
- }], ctorParameters: function () { return [{ type: i1$1.Overlay }]; } });
140
-
141
- class ReuseTabContextComponent {
142
- set i18n(value) {
143
- this.srv.i18n = value;
144
- }
145
- constructor(srv) {
146
- this.srv = srv;
147
- this.sub$ = new Subscription();
148
- this.change = new EventEmitter();
149
- this.sub$.add(srv.show.subscribe(context => this.srv.open(context)));
150
- this.sub$.add(srv.close.subscribe(res => this.change.emit(res)));
151
- }
152
- ngOnDestroy() {
153
- this.sub$.unsubscribe();
154
- }
155
- }
156
- ReuseTabContextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextComponent, deps: [{ token: ReuseTabContextService }], target: i0.ɵɵFactoryTarget.Component });
157
- ReuseTabContextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ReuseTabContextComponent, selector: "reuse-tab-context", inputs: { i18n: "i18n" }, outputs: { change: "change" }, ngImport: i0, template: ``, isInline: true });
158
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextComponent, decorators: [{
159
- type: Component,
160
- args: [{
161
- selector: 'reuse-tab-context',
162
- template: ``
163
- }]
164
- }], ctorParameters: function () { return [{ type: ReuseTabContextService }]; }, propDecorators: { i18n: [{
165
- type: Input
166
- }], change: [{
167
- type: Output
168
- }] } });
169
-
170
- class ReuseTabContextDirective {
171
- constructor(srv) {
172
- this.srv = srv;
173
- }
174
- _onContextMenu(event) {
175
- this.srv.show.next({
176
- event,
177
- item: this.item,
178
- customContextMenu: this.customContextMenu
179
- });
180
- event.preventDefault();
181
- event.stopPropagation();
182
- }
183
- }
184
- ReuseTabContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextDirective, deps: [{ token: ReuseTabContextService }], target: i0.ɵɵFactoryTarget.Directive });
185
- ReuseTabContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: ReuseTabContextDirective, selector: "[reuse-tab-context-menu]", inputs: { item: ["reuse-tab-context-menu", "item"], customContextMenu: "customContextMenu" }, host: { listeners: { "contextmenu": "_onContextMenu($event)" } }, exportAs: ["reuseTabContextMenu"], ngImport: i0 });
186
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabContextDirective, decorators: [{
187
- type: Directive,
188
- args: [{
189
- selector: '[reuse-tab-context-menu]',
190
- exportAs: 'reuseTabContextMenu',
191
- host: {
192
- '(contextmenu)': '_onContextMenu($event)'
193
- }
194
- }]
195
- }], ctorParameters: function () { return [{ type: ReuseTabContextService }]; }, propDecorators: { item: [{
196
- type: Input,
197
- args: ['reuse-tab-context-menu']
198
- }], customContextMenu: [{
199
- type: Input
200
- }] } });
201
-
202
- /**
203
- * 复用匹配模式
204
- */
205
- var ReuseTabMatchMode;
206
- (function (ReuseTabMatchMode) {
207
- /**
208
- * (推荐)按菜单 `Menu` 配置
209
- *
210
- * 可复用:
211
- * - `{ text:'Dashboard' }`
212
- * - `{ text:'Dashboard', reuse: true }`
213
- *
214
- * 不可复用:
215
- * - `{ text:'Dashboard', reuse: false }`
216
- */
217
- ReuseTabMatchMode[ReuseTabMatchMode["Menu"] = 0] = "Menu";
218
- /**
219
- * 按菜单 `Menu` 强制配置
220
- *
221
- * 可复用:
222
- * - `{ text:'Dashboard', reuse: true }`
223
- *
224
- * 不可复用:
225
- * - `{ text:'Dashboard' }`
226
- * - `{ text:'Dashboard', reuse: false }`
227
- */
228
- ReuseTabMatchMode[ReuseTabMatchMode["MenuForce"] = 1] = "MenuForce";
229
- /**
230
- * 对所有路由有效,可以配合 `excludes` 过滤无须复用路由
231
- */
232
- ReuseTabMatchMode[ReuseTabMatchMode["URL"] = 2] = "URL";
233
- })(ReuseTabMatchMode || (ReuseTabMatchMode = {}));
234
-
235
- const REUSE_TAB_STORAGE_KEY = new InjectionToken('REUSE_TAB_STORAGE_KEY');
236
- const REUSE_TAB_STORAGE_STATE = new InjectionToken('REUSE_TAB_STORAGE_STATE');
237
- class ReuseTabLocalStorageState {
238
- get(key) {
239
- return JSON.parse(localStorage.getItem(key) || '[]') || [];
240
- }
241
- update(key, value) {
242
- localStorage.setItem(key, JSON.stringify(value));
243
- return true;
244
- }
245
- remove(key) {
246
- localStorage.removeItem(key);
247
- }
248
- }
249
-
250
- class ReuseTabService {
251
- get snapshot() {
252
- return this.injector.get(ActivatedRoute).snapshot;
253
- }
254
- // #region public
255
- /**
256
- * Get init status
257
- *
258
- * 是否已经初始化完成
259
- */
260
- get inited() {
261
- return this._inited;
262
- }
263
- /**
264
- * Current routing address
265
- *
266
- * 当前路由地址
267
- */
268
- get curUrl() {
269
- return this.getUrl(this.snapshot);
270
- }
271
- /**
272
- * 允许最多复用多少个页面,取值范围 `2-100`,值发生变更时会强制关闭且忽略可关闭条件
273
- */
274
- set max(value) {
275
- this._max = Math.min(Math.max(value, 2), 100);
276
- for (let i = this._cached.length; i > this._max; i--) {
277
- this._cached.pop();
278
- }
279
- }
280
- set keepingScroll(value) {
281
- this._keepingScroll = value;
282
- this.initScroll();
283
- }
284
- get keepingScroll() {
285
- return this._keepingScroll;
286
- }
287
- /** 获取已缓存的路由 */
288
- get items() {
289
- return this._cached;
290
- }
291
- /** 获取当前缓存的路由总数 */
292
- get count() {
293
- return this._cached.length;
294
- }
295
- /** 订阅缓存变更通知 */
296
- get change() {
297
- return this._cachedChange.asObservable(); // .pipe(filter(w => w !== null));
298
- }
299
- /** 自定义当前标题 */
300
- set title(value) {
301
- const url = this.curUrl;
302
- if (typeof value === 'string')
303
- value = { text: value };
304
- this._titleCached[url] = value;
305
- this.di('update current tag title: ', value);
306
- this._cachedChange.next({
307
- active: 'title',
308
- url,
309
- title: value,
310
- list: this._cached
311
- });
312
- }
313
- /** 获取指定路径缓存所在位置,`-1` 表示无缓存 */
314
- index(url) {
315
- return this._cached.findIndex(w => w.url === url);
316
- }
317
- /** 获取指定路径缓存是否存在 */
318
- exists(url) {
319
- return this.index(url) !== -1;
320
- }
321
- /** 获取指定路径缓存 */
322
- get(url) {
323
- return url ? this._cached.find(w => w.url === url) || null : null;
324
- }
325
- remove(url, includeNonCloseable) {
326
- const idx = typeof url === 'string' ? this.index(url) : url;
327
- const item = idx !== -1 ? this._cached[idx] : null;
328
- if (!item || (!includeNonCloseable && !item.closable))
329
- return false;
330
- this.destroy(item._handle);
331
- this._cached.splice(idx, 1);
332
- delete this._titleCached[url];
333
- return true;
334
- }
335
- /**
336
- * 根据URL移除标签
337
- *
338
- * @param [includeNonCloseable=false] 是否强制包含不可关闭
339
- */
340
- close(url, includeNonCloseable = false) {
341
- this.removeUrlBuffer = url;
342
- this.remove(url, includeNonCloseable);
343
- this._cachedChange.next({ active: 'close', url, list: this._cached });
344
- this.di('close tag', url);
345
- return true;
346
- }
347
- /**
348
- * 清除右边
349
- *
350
- * @param [includeNonCloseable=false] 是否强制包含不可关闭
351
- */
352
- closeRight(url, includeNonCloseable = false) {
353
- const start = this.index(url);
354
- for (let i = this.count - 1; i > start; i--) {
355
- this.remove(i, includeNonCloseable);
356
- }
357
- this.removeUrlBuffer = null;
358
- this._cachedChange.next({ active: 'closeRight', url, list: this._cached });
359
- this.di('close right tages', url);
360
- return true;
361
- }
362
- /**
363
- * 清除所有缓存
364
- *
365
- * @param [includeNonCloseable=false] 是否强制包含不可关闭
366
- */
367
- clear(includeNonCloseable = false) {
368
- this._cached.forEach(w => {
369
- if (!includeNonCloseable && w.closable)
370
- this.destroy(w._handle);
371
- });
372
- this._cached = this._cached.filter(w => !includeNonCloseable && !w.closable);
373
- this.removeUrlBuffer = null;
374
- this._cachedChange.next({ active: 'clear', list: this._cached });
375
- this.di('clear all catch');
376
- }
377
- /**
378
- * 移动缓存数据
379
- *
380
- * @param url 要移动的URL地址
381
- * @param position 新位置,下标从 `0` 开始
382
- *
383
- * @example
384
- * ```
385
- * // source
386
- * [ '/a/1', '/a/2', '/a/3', '/a/4', '/a/5' ]
387
- * move('/a/1', 2);
388
- * // output
389
- * [ '/a/2', '/a/3', '/a/1', '/a/4', '/a/5' ]
390
- * move('/a/1', -1);
391
- * // output
392
- * [ '/a/2', '/a/3', '/a/4', '/a/5', '/a/1' ]
393
- * ```
394
- */
395
- move(url, position) {
396
- const start = this._cached.findIndex(w => w.url === url);
397
- if (start === -1)
398
- return;
399
- const data = this._cached.slice();
400
- data.splice(position < 0 ? data.length + position : position, 0, data.splice(start, 1)[0]);
401
- this._cached = data;
402
- this._cachedChange.next({
403
- active: 'move',
404
- url,
405
- position,
406
- list: this._cached
407
- });
408
- }
409
- /**
410
- * 强制关闭当前路由(包含不可关闭状态),并重新导航至 `newUrl` 路由
411
- */
412
- replace(newUrl) {
413
- const url = this.curUrl;
414
- if (this.exists(url)) {
415
- this.close(url, true);
416
- }
417
- else {
418
- this.removeUrlBuffer = url;
419
- }
420
- this.injector.get(Router).navigateByUrl(newUrl);
421
- }
422
- /**
423
- * 获取标题,顺序如下:
424
- *
425
- * 1. 组件内使用 `ReuseTabService.title = 'new title'` 重新指定文本
426
- * 2. 路由配置中 data 属性中包含 titleI18n > title
427
- * 3. 菜单数据中 text 属性
428
- *
429
- * @param url 指定URL
430
- * @param route 指定路由快照
431
- */
432
- getTitle(url, route) {
433
- if (this._titleCached[url]) {
434
- return this._titleCached[url];
435
- }
436
- if (route && route.data && (route.data.titleI18n || route.data.title)) {
437
- return {
438
- text: route.data.title,
439
- i18n: route.data.titleI18n
440
- };
441
- }
442
- const menu = this.getMenu(url);
443
- return menu ? { text: menu.text, i18n: menu.i18n } : { text: url };
444
- }
445
- /**
446
- * 清除标题缓存
447
- */
448
- clearTitleCached() {
449
- this._titleCached = {};
450
- }
451
- /** 自定义当前 `closable` 状态 */
452
- set closable(value) {
453
- const url = this.curUrl;
454
- this._closableCached[url] = value;
455
- this.di('update current tag closable: ', value);
456
- this._cachedChange.next({
457
- active: 'closable',
458
- closable: value,
459
- list: this._cached
460
- });
461
- }
462
- /**
463
- * 获取 `closable` 状态,顺序如下:
464
- *
465
- * 1. 组件内使用 `ReuseTabService.closable = true` 重新指定 `closable` 状态
466
- * 2. 路由配置中 data 属性中包含 `reuseClosable`
467
- * 3. 菜单数据中 `reuseClosable` 属性
468
- *
469
- * @param url 指定URL
470
- * @param route 指定路由快照
471
- */
472
- getClosable(url, route) {
473
- if (typeof this._closableCached[url] !== 'undefined')
474
- return this._closableCached[url];
475
- if (route && route.data && typeof route.data.reuseClosable === 'boolean')
476
- return route.data.reuseClosable;
477
- const menu = this.mode !== ReuseTabMatchMode.URL ? this.getMenu(url) : null;
478
- if (menu && typeof menu.reuseClosable === 'boolean')
479
- return menu.reuseClosable;
480
- return true;
481
- }
482
- /**
483
- * 清空 `closable` 缓存
484
- */
485
- clearClosableCached() {
486
- this._closableCached = {};
487
- }
488
- getTruthRoute(route) {
489
- let next = route;
490
- while (next.firstChild)
491
- next = next.firstChild;
492
- return next;
493
- }
494
- /**
495
- * 根据快照获取URL地址
496
- */
497
- getUrl(route) {
498
- let next = this.getTruthRoute(route);
499
- const segments = [];
500
- while (next) {
501
- segments.push(next.url.join('/'));
502
- next = next.parent;
503
- }
504
- const url = `/${segments
505
- .filter(i => i)
506
- .reverse()
507
- .join('/')}`;
508
- return url;
509
- }
510
- /**
511
- * 检查快照是否允许被复用
512
- */
513
- can(route) {
514
- const url = this.getUrl(route);
515
- if (url === this.removeUrlBuffer)
516
- return false;
517
- if (route.data && typeof route.data.reuse === 'boolean')
518
- return route.data.reuse;
519
- if (this.mode !== ReuseTabMatchMode.URL) {
520
- const menu = this.getMenu(url);
521
- if (!menu)
522
- return false;
523
- if (this.mode === ReuseTabMatchMode.Menu) {
524
- if (menu.reuse === false)
525
- return false;
526
- }
527
- else {
528
- if (!menu.reuse || menu.reuse !== true)
529
- return false;
530
- }
531
- return true;
532
- }
533
- return !this.isExclude(url);
534
- }
535
- isExclude(url) {
536
- return this.excludes.findIndex(r => r.test(url)) !== -1;
537
- }
538
- /**
539
- * 刷新,触发一个 refresh 类型事件
540
- */
541
- refresh(data) {
542
- this._cachedChange.next({ active: 'refresh', data });
543
- }
544
- // #endregion
545
- // #region privates
546
- destroy(_handle) {
547
- if (_handle && _handle.componentRef && _handle.componentRef.destroy)
548
- _handle.componentRef.destroy();
549
- }
550
- di(...args) {
551
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
552
- if (!this.debug)
553
- return;
554
- console.warn(...args);
555
- }
556
- }
557
- // #endregion
558
- constructor(injector, menuService, stateKey, stateSrv) {
559
- this.injector = injector;
560
- this.menuService = menuService;
561
- this.stateKey = stateKey;
562
- this.stateSrv = stateSrv;
563
- this._inited = false;
564
- this._max = 10;
565
- this._keepingScroll = false;
566
- this._cachedChange = new BehaviorSubject(null);
567
- this._cached = [];
568
- this._titleCached = {};
569
- this._closableCached = {};
570
- this.removeUrlBuffer = null;
571
- this.positionBuffer = {};
572
- this.debug = false;
573
- this.routeParamMatchMode = 'strict';
574
- this.mode = ReuseTabMatchMode.Menu;
575
- /** 排除规则,限 `mode=URL` */
576
- this.excludes = [];
577
- this.storageState = false;
578
- }
579
- init() {
580
- this.initScroll();
581
- this._inited = true;
582
- this.loadState();
583
- }
584
- loadState() {
585
- if (!this.storageState)
586
- return;
587
- this._cached = this.stateSrv.get(this.stateKey).map(v => ({
588
- title: { text: v.title },
589
- url: v.url,
590
- position: v.position
591
- }));
592
- this._cachedChange.next({ active: 'loadState' });
593
- }
594
- getMenu(url) {
595
- const menus = this.menuService.getPathByUrl(url);
596
- if (!menus || menus.length === 0)
597
- return null;
598
- return menus.pop();
599
- }
600
- runHook(method, comp, type = 'init') {
601
- var _a;
602
- if (typeof comp === 'number') {
603
- const item = this._cached[comp];
604
- comp = (_a = item._handle) === null || _a === void 0 ? void 0 : _a.componentRef;
605
- }
606
- if (comp == null || !comp.instance) {
607
- return;
608
- }
609
- const compThis = comp.instance;
610
- const fn = compThis[method];
611
- if (typeof fn !== 'function') {
612
- return;
613
- }
614
- if (method === '_onReuseInit') {
615
- fn.call(compThis, type);
616
- }
617
- else {
618
- fn.call(compThis);
619
- }
620
- }
621
- hasInValidRoute(route) {
622
- return !route.routeConfig || !!route.routeConfig.loadChildren || !!route.routeConfig.children;
623
- }
624
- /**
625
- * 决定是否允许路由复用,若 `true` 会触发 `store`
626
- */
627
- shouldDetach(route) {
628
- if (this.hasInValidRoute(route))
629
- return false;
630
- this.di('#shouldDetach', this.can(route), this.getUrl(route));
631
- return this.can(route);
632
- }
633
- /**
634
- * 存储
635
- */
636
- store(_snapshot, _handle) {
637
- var _a;
638
- const url = this.getUrl(_snapshot);
639
- const idx = this.index(url);
640
- const isAdd = idx === -1;
641
- const item = {
642
- title: this.getTitle(url, _snapshot),
643
- closable: this.getClosable(url, _snapshot),
644
- position: this.getKeepingScroll(url, _snapshot) ? this.positionBuffer[url] : null,
645
- url,
646
- _snapshot,
647
- _handle
648
- };
649
- if (isAdd) {
650
- if (this.count >= this._max) {
651
- // Get the oldest closable location
652
- const closeIdx = this._cached.findIndex(w => w.closable);
653
- if (closeIdx !== -1)
654
- this.remove(closeIdx, false);
655
- }
656
- this._cached.push(item);
657
- }
658
- else {
659
- // Current handler is null when activate routes
660
- // For better reliability, we need to wait for the component to be attached before call _onReuseInit
661
- const cahcedComponentRef = (_a = this._cached[idx]._handle) === null || _a === void 0 ? void 0 : _a.componentRef;
662
- if (_handle == null && cahcedComponentRef != null) {
663
- timer(100).subscribe(() => this.runHook('_onReuseInit', cahcedComponentRef));
664
- }
665
- this._cached[idx] = item;
666
- }
667
- this.removeUrlBuffer = null;
668
- this.di('#store', isAdd ? '[new]' : '[override]', url);
669
- if (_handle && _handle.componentRef) {
670
- this.runHook('_onReuseDestroy', _handle.componentRef);
671
- }
672
- if (!isAdd) {
673
- this._cachedChange.next({ active: 'override', item, list: this._cached });
674
- }
675
- }
676
- /**
677
- * 决定是否允许应用缓存数据
678
- */
679
- shouldAttach(route) {
680
- if (this.hasInValidRoute(route))
681
- return false;
682
- const url = this.getUrl(route);
683
- const data = this.get(url);
684
- const ret = !!(data && data._handle);
685
- this.di('#shouldAttach', ret, url);
686
- if (!ret) {
687
- this._cachedChange.next({ active: 'add', url, list: this._cached });
688
- }
689
- return ret;
690
- }
691
- /**
692
- * 提取复用数据
693
- */
694
- retrieve(route) {
695
- if (this.hasInValidRoute(route))
696
- return null;
697
- const url = this.getUrl(route);
698
- const data = this.get(url);
699
- const ret = (data && data._handle) || null;
700
- this.di('#retrieve', url, ret);
701
- return ret;
702
- }
703
- /**
704
- * 决定是否应该进行复用路由处理
705
- */
706
- shouldReuseRoute(future, curr) {
707
- let ret = future.routeConfig === curr.routeConfig;
708
- if (!ret)
709
- return false;
710
- const path = ((future.routeConfig && future.routeConfig.path) || '');
711
- if (path.length > 0 && ~path.indexOf(':')) {
712
- if (this.routeParamMatchMode === 'strict') {
713
- ret = this.getUrl(future) === this.getUrl(curr);
714
- }
715
- else {
716
- ret = path === ((curr.routeConfig && curr.routeConfig.path) || '');
717
- }
718
- }
719
- this.di('=====================');
720
- this.di('#shouldReuseRoute', ret, `${this.getUrl(curr)}=>${this.getUrl(future)}`, future, curr);
721
- return ret;
722
- }
723
- // #region scroll
724
- /**
725
- * 获取 `keepingScroll` 状态,顺序如下:
726
- *
727
- * 1. 路由配置中 data 属性中包含 `keepingScroll`
728
- * 2. 菜单数据中 `keepingScroll` 属性
729
- * 3. 组件 `keepingScroll` 值
730
- */
731
- getKeepingScroll(url, route) {
732
- if (route && route.data && typeof route.data.keepingScroll === 'boolean')
733
- return route.data.keepingScroll;
734
- const menu = this.mode !== ReuseTabMatchMode.URL ? this.getMenu(url) : null;
735
- if (menu && typeof menu.keepingScroll === 'boolean')
736
- return menu.keepingScroll;
737
- return this.keepingScroll;
738
- }
739
- get isDisabledInRouter() {
740
- const routerConfig = this.injector.get(ROUTER_CONFIGURATION, {});
741
- return routerConfig.scrollPositionRestoration === 'disabled';
742
- }
743
- get ss() {
744
- return this.injector.get(ScrollService);
745
- }
746
- initScroll() {
747
- if (this._router$) {
748
- this._router$.unsubscribe();
749
- }
750
- this._router$ = this.injector.get(Router).events.subscribe(e => {
751
- if (e instanceof NavigationStart) {
752
- const url = this.curUrl;
753
- if (this.getKeepingScroll(url, this.getTruthRoute(this.snapshot))) {
754
- this.positionBuffer[url] = this.ss.getScrollPosition(this.keepingScrollContainer);
755
- }
756
- else {
757
- delete this.positionBuffer[url];
758
- }
759
- }
760
- else if (e instanceof NavigationEnd) {
761
- const url = this.curUrl;
762
- const item = this.get(url);
763
- if (item && item.position && this.getKeepingScroll(url, this.getTruthRoute(this.snapshot))) {
764
- if (this.isDisabledInRouter) {
765
- this.ss.scrollToPosition(this.keepingScrollContainer, item.position);
766
- }
767
- else {
768
- setTimeout(() => this.ss.scrollToPosition(this.keepingScrollContainer, item.position), 1);
769
- }
770
- }
771
- }
772
- });
773
- }
774
- // #endregion
775
- ngOnDestroy() {
776
- const { _cachedChange, _router$ } = this;
777
- this.clear();
778
- this._cached = [];
779
- _cachedChange.complete();
780
- if (_router$) {
781
- _router$.unsubscribe();
782
- }
783
- }
784
- }
785
- ReuseTabService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabService, deps: [{ token: i0.Injector }, { token: i1.MenuService }, { token: REUSE_TAB_STORAGE_KEY, optional: true }, { token: REUSE_TAB_STORAGE_STATE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
786
- ReuseTabService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabService, providedIn: 'root' });
787
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabService, decorators: [{
788
- type: Injectable,
789
- args: [{ providedIn: 'root' }]
790
- }], ctorParameters: function () {
791
- return [{ type: i0.Injector }, { type: i1.MenuService }, { type: undefined, decorators: [{
792
- type: Optional
793
- }, {
794
- type: Inject,
795
- args: [REUSE_TAB_STORAGE_KEY]
796
- }] }, { type: undefined, decorators: [{
797
- type: Optional
798
- }, {
799
- type: Inject,
800
- args: [REUSE_TAB_STORAGE_STATE]
801
- }] }];
802
- } });
803
-
804
- class ReuseTabComponent {
805
- set keepingScrollContainer(value) {
806
- this._keepingScrollContainer = typeof value === 'string' ? this.doc.querySelector(value) : value;
807
- }
808
- // #endregion
809
- constructor(srv, cdr, router, route, i18nSrv, doc, platform, directionality, stateKey, stateSrv) {
810
- this.srv = srv;
811
- this.cdr = cdr;
812
- this.router = router;
813
- this.route = route;
814
- this.i18nSrv = i18nSrv;
815
- this.doc = doc;
816
- this.platform = platform;
817
- this.directionality = directionality;
818
- this.stateKey = stateKey;
819
- this.stateSrv = stateSrv;
820
- this.destroy$ = new Subject();
821
- this.list = [];
822
- this.pos = 0;
823
- this.dir = 'ltr';
824
- // #region fields
825
- this.mode = ReuseTabMatchMode.Menu;
826
- this.debug = false;
827
- this.allowClose = true;
828
- this.keepingScroll = false;
829
- this.storageState = false;
830
- this.customContextMenu = [];
831
- this.tabBarStyle = null;
832
- this.tabType = 'line';
833
- this.routeParamMatchMode = 'strict';
834
- this.disabled = false;
835
- this.change = new EventEmitter();
836
- this.close = new EventEmitter();
837
- }
838
- genTit(title) {
839
- return title.i18n && this.i18nSrv ? this.i18nSrv.fanyi(title.i18n) : title.text;
840
- }
841
- get curUrl() {
842
- return this.srv.getUrl(this.route.snapshot);
843
- }
844
- genCurItem() {
845
- const url = this.curUrl;
846
- const snapshotTrue = this.srv.getTruthRoute(this.route.snapshot);
847
- return {
848
- url,
849
- title: this.genTit(this.srv.getTitle(url, snapshotTrue)),
850
- closable: this.allowClose && this.srv.count > 0 && this.srv.getClosable(url, snapshotTrue),
851
- active: false,
852
- last: false,
853
- index: 0
854
- };
855
- }
856
- genList(notify) {
857
- const ls = this.srv.items.map((item, index) => ({
858
- url: item.url,
859
- title: this.genTit(item.title),
860
- closable: this.allowClose && item.closable && this.srv.count > 0,
861
- position: item.position,
862
- index,
863
- active: false,
864
- last: false
865
- }));
866
- // debugger;
867
- const url = this.curUrl;
868
- let addCurrent = ls.findIndex(w => w.url === url) === -1;
869
- if (notify && notify.active === 'close' && notify.url === url) {
870
- addCurrent = false;
871
- let toPos = 0;
872
- const curItem = this.list.find(w => w.url === url);
873
- if (curItem.index === ls.length) {
874
- // When closed is last
875
- toPos = ls.length - 1;
876
- }
877
- else if (curItem.index < ls.length) {
878
- // Should be actived next tab when closed is middle
879
- toPos = Math.max(0, curItem.index);
880
- }
881
- this.router.navigateByUrl(ls[toPos].url);
882
- }
883
- if (addCurrent) {
884
- ls.splice(this.pos + 1, 0, this.genCurItem());
885
- }
886
- ls.forEach((item, index) => (item.index = index));
887
- if (ls.length === 1) {
888
- ls[0].closable = false;
889
- }
890
- this.list = ls;
891
- this.cdr.detectChanges();
892
- this.updatePos();
893
- }
894
- updateTitle(res) {
895
- const item = this.list.find(w => w.url === res.url);
896
- if (!item)
897
- return;
898
- item.title = this.genTit(res.title);
899
- this.cdr.detectChanges();
900
- }
901
- refresh(item) {
902
- this.srv.runHook('_onReuseInit', this.pos === item.index ? this.srv.componentRef : item.index, 'refresh');
903
- }
904
- saveState() {
905
- if (!this.srv.inited || !this.storageState)
906
- return;
907
- this.stateSrv.update(this.stateKey, this.list);
908
- }
909
- // #region UI
910
- contextMenuChange(res) {
911
- let fn = null;
912
- switch (res.type) {
913
- case 'refresh':
914
- this.refresh(res.item);
915
- break;
916
- case 'close':
917
- this._close(null, res.item.index, res.includeNonCloseable);
918
- break;
919
- case 'closeRight':
920
- fn = () => {
921
- this.srv.closeRight(res.item.url, res.includeNonCloseable);
922
- this.close.emit(null);
923
- };
924
- break;
925
- case 'closeOther':
926
- fn = () => {
927
- this.srv.clear(res.includeNonCloseable);
928
- this.close.emit(null);
929
- };
930
- break;
931
- }
932
- if (!fn) {
933
- return;
934
- }
935
- if (!res.item.active && res.item.index <= this.list.find(w => w.active).index) {
936
- this._to(res.item.index, fn);
937
- }
938
- else {
939
- fn();
940
- }
941
- }
942
- _to(index, cb) {
943
- index = Math.max(0, Math.min(index, this.list.length - 1));
944
- const item = this.list[index];
945
- this.router.navigateByUrl(item.url).then(res => {
946
- if (!res)
947
- return;
948
- this.item = item;
949
- this.change.emit(item);
950
- if (cb) {
951
- cb();
952
- }
953
- });
954
- }
955
- _close(e, idx, includeNonCloseable) {
956
- if (e != null) {
957
- e.preventDefault();
958
- e.stopPropagation();
959
- }
960
- const item = this.list[idx];
961
- (this.canClose ? this.canClose({ item, includeNonCloseable }) : of(true)).pipe(filter(v => v)).subscribe(() => {
962
- this.srv.close(item.url, includeNonCloseable);
963
- this.close.emit(item);
964
- this.cdr.detectChanges();
965
- });
966
- return false;
967
- }
968
- /**
969
- * 设置激活路由的实例,在 `src/app/layout/basic/basic.component.ts` 修改:
970
- *
971
- * @example
972
- * <reuse-tab #reuseTab></reuse-tab>
973
- * <router-outlet (activate)="reuseTab.activate($event)" (attach)="reuseTab.activate($event)"></router-outlet>
974
- */
975
- activate(instance) {
976
- this.srv.componentRef = { instance };
977
- }
978
- updatePos() {
979
- const url = this.srv.getUrl(this.route.snapshot);
980
- const ls = this.list.filter(w => w.url === url || !this.srv.isExclude(w.url));
981
- if (ls.length === 0) {
982
- return;
983
- }
984
- const last = ls[ls.length - 1];
985
- const item = ls.find(w => w.url === url);
986
- last.last = true;
987
- const pos = item == null ? last.index : item.index;
988
- ls.forEach((i, idx) => (i.active = pos === idx));
989
- this.pos = pos;
990
- // TODO: 目前无法知道为什么 `pos` 无法通过 `nzSelectedIndex` 生效,因此强制使用组件实例的方式来修改,这种方式是安全的
991
- // https://github.com/ng-alain/ng-alain/issues/1736
992
- this.tabset.nzSelectedIndex = pos;
993
- this.list = ls;
994
- this.cdr.detectChanges();
995
- this.saveState();
996
- }
997
- // #endregion
998
- ngOnInit() {
999
- var _a;
1000
- this.dir = this.directionality.value;
1001
- (_a = this.directionality.change) === null || _a === void 0 ? void 0 : _a.pipe(takeUntil(this.destroy$)).subscribe((direction) => {
1002
- this.dir = direction;
1003
- this.cdr.detectChanges();
1004
- });
1005
- if (!this.platform.isBrowser) {
1006
- return;
1007
- }
1008
- this.srv.change.pipe(takeUntil(this.destroy$)).subscribe(res => {
1009
- var _a;
1010
- switch (res === null || res === void 0 ? void 0 : res.active) {
1011
- case 'title':
1012
- this.updateTitle(res);
1013
- return;
1014
- case 'override':
1015
- if (((_a = res === null || res === void 0 ? void 0 : res.list) === null || _a === void 0 ? void 0 : _a.length) === this.list.length) {
1016
- this.updatePos();
1017
- return;
1018
- }
1019
- break;
1020
- }
1021
- this.genList(res);
1022
- });
1023
- this.i18nSrv.change
1024
- .pipe(filter(() => this.srv.inited), takeUntil(this.destroy$), debounceTime(100))
1025
- .subscribe(() => this.genList({ active: 'title' }));
1026
- this.srv.init();
1027
- }
1028
- ngOnChanges(changes) {
1029
- if (!this.platform.isBrowser) {
1030
- return;
1031
- }
1032
- if (changes.max)
1033
- this.srv.max = this.max;
1034
- if (changes.excludes)
1035
- this.srv.excludes = this.excludes;
1036
- if (changes.mode)
1037
- this.srv.mode = this.mode;
1038
- if (changes.routeParamMatchMode)
1039
- this.srv.routeParamMatchMode = this.routeParamMatchMode;
1040
- if (changes.keepingScroll) {
1041
- this.srv.keepingScroll = this.keepingScroll;
1042
- this.srv.keepingScrollContainer = this._keepingScrollContainer;
1043
- }
1044
- if (changes.storageState)
1045
- this.srv.storageState = this.storageState;
1046
- this.srv.debug = this.debug;
1047
- this.cdr.detectChanges();
1048
- }
1049
- ngOnDestroy() {
1050
- const { destroy$ } = this;
1051
- destroy$.next();
1052
- destroy$.complete();
1053
- }
1054
- }
1055
- ReuseTabComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabComponent, deps: [{ token: ReuseTabService }, { token: i0.ChangeDetectorRef }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: ALAIN_I18N_TOKEN, optional: true }, { token: DOCUMENT }, { token: i3$1.Platform }, { token: i4.Directionality, optional: true }, { token: REUSE_TAB_STORAGE_KEY, optional: true }, { token: REUSE_TAB_STORAGE_STATE, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1056
- ReuseTabComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ReuseTabComponent, selector: "reuse-tab, [reuse-tab]", inputs: { mode: "mode", i18n: "i18n", debug: "debug", max: "max", tabMaxWidth: "tabMaxWidth", excludes: "excludes", allowClose: "allowClose", keepingScroll: "keepingScroll", storageState: "storageState", keepingScrollContainer: "keepingScrollContainer", customContextMenu: "customContextMenu", tabBarExtraContent: "tabBarExtraContent", tabBarGutter: "tabBarGutter", tabBarStyle: "tabBarStyle", tabType: "tabType", routeParamMatchMode: "routeParamMatchMode", disabled: "disabled", titleRender: "titleRender", canClose: "canClose" }, outputs: { change: "change", close: "close" }, host: { properties: { "class.reuse-tab": "true", "class.reuse-tab__line": "tabType === 'line'", "class.reuse-tab__card": "tabType === 'card'", "class.reuse-tab__disabled": "disabled", "class.reuse-tab-rtl": "dir === 'rtl'" } }, providers: [ReuseTabContextService], viewQueries: [{ propertyName: "tabset", first: true, predicate: ["tabset"], descendants: true }], exportAs: ["reuseTab"], usesOnChanges: true, ngImport: i0, template: "<nz-tabset\n #tabset\n [nzSelectedIndex]=\"pos\"\n [nzAnimated]=\"false\"\n [nzType]=\"tabType\"\n [nzTabBarExtraContent]=\"tabBarExtraContent\"\n [nzTabBarGutter]=\"tabBarGutter\"\n [nzTabBarStyle]=\"tabBarStyle\"\n>\n <nz-tab *ngFor=\"let i of list; let index = index\" [nzTitle]=\"titleTemplate\" (nzClick)=\"_to(index)\">\n <ng-template #titleTemplate>\n <div\n [reuse-tab-context-menu]=\"i\"\n [customContextMenu]=\"customContextMenu\"\n class=\"reuse-tab__name\"\n [attr.title]=\"i.title\"\n >\n <span [class.reuse-tab__name-width]=\"tabMaxWidth\" [style.max-width.px]=\"tabMaxWidth\">\n <ng-container\n *ngIf=\"titleRender; else defaultTitle\"\n [ngTemplateOutlet]=\"titleRender\"\n [ngTemplateOutletContext]=\"{ $implicit: i }\"\n ></ng-container>\n <ng-template #defaultTitle>{{ i.title }}</ng-template>\n </span>\n </div>\n <i *ngIf=\"i.closable\" nz-icon nzType=\"close\" class=\"reuse-tab__op\" (click)=\"_close($event, index, false)\"></i>\n </ng-template>\n </nz-tab>\n</nz-tabset>\n<reuse-tab-context [i18n]=\"i18n\" (change)=\"contextMenuChange($event)\"></reuse-tab-context>\n", dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i6.NzTabSetComponent, selector: "nz-tabset", inputs: ["nzSelectedIndex", "nzTabPosition", "nzTabBarExtraContent", "nzCanDeactivate", "nzAddIcon", "nzTabBarStyle", "nzType", "nzSize", "nzAnimated", "nzTabBarGutter", "nzHideAdd", "nzCentered", "nzHideAll", "nzLinkRouter", "nzLinkExact"], outputs: ["nzSelectChange", "nzSelectedIndexChange", "nzTabListScroll", "nzClose", "nzAdd"], exportAs: ["nzTabset"] }, { kind: "component", type: i6.NzTabComponent, selector: "nz-tab", inputs: ["nzTitle", "nzClosable", "nzCloseIcon", "nzDisabled", "nzForceRender"], outputs: ["nzSelect", "nzDeselect", "nzClick", "nzContextmenu"], exportAs: ["nzTab"] }, { kind: "directive", type: i7.NzIconDirective, selector: "[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "component", type: ReuseTabContextComponent, selector: "reuse-tab-context", inputs: ["i18n"], outputs: ["change"] }, { kind: "directive", type: ReuseTabContextDirective, selector: "[reuse-tab-context-menu]", inputs: ["reuse-tab-context-menu", "customContextMenu"], exportAs: ["reuseTabContextMenu"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1057
- __decorate([
1058
- InputBoolean()
1059
- ], ReuseTabComponent.prototype, "debug", void 0);
1060
- __decorate([
1061
- InputNumber()
1062
- ], ReuseTabComponent.prototype, "max", void 0);
1063
- __decorate([
1064
- InputNumber()
1065
- ], ReuseTabComponent.prototype, "tabMaxWidth", void 0);
1066
- __decorate([
1067
- InputBoolean()
1068
- ], ReuseTabComponent.prototype, "allowClose", void 0);
1069
- __decorate([
1070
- InputBoolean()
1071
- ], ReuseTabComponent.prototype, "keepingScroll", void 0);
1072
- __decorate([
1073
- InputBoolean()
1074
- ], ReuseTabComponent.prototype, "storageState", void 0);
1075
- __decorate([
1076
- InputBoolean()
1077
- ], ReuseTabComponent.prototype, "disabled", void 0);
1078
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabComponent, decorators: [{
1079
- type: Component,
1080
- args: [{ selector: 'reuse-tab, [reuse-tab]', exportAs: 'reuseTab', host: {
1081
- '[class.reuse-tab]': 'true',
1082
- '[class.reuse-tab__line]': `tabType === 'line'`,
1083
- '[class.reuse-tab__card]': `tabType === 'card'`,
1084
- '[class.reuse-tab__disabled]': `disabled`,
1085
- '[class.reuse-tab-rtl]': `dir === 'rtl'`
1086
- }, providers: [ReuseTabContextService], preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<nz-tabset\n #tabset\n [nzSelectedIndex]=\"pos\"\n [nzAnimated]=\"false\"\n [nzType]=\"tabType\"\n [nzTabBarExtraContent]=\"tabBarExtraContent\"\n [nzTabBarGutter]=\"tabBarGutter\"\n [nzTabBarStyle]=\"tabBarStyle\"\n>\n <nz-tab *ngFor=\"let i of list; let index = index\" [nzTitle]=\"titleTemplate\" (nzClick)=\"_to(index)\">\n <ng-template #titleTemplate>\n <div\n [reuse-tab-context-menu]=\"i\"\n [customContextMenu]=\"customContextMenu\"\n class=\"reuse-tab__name\"\n [attr.title]=\"i.title\"\n >\n <span [class.reuse-tab__name-width]=\"tabMaxWidth\" [style.max-width.px]=\"tabMaxWidth\">\n <ng-container\n *ngIf=\"titleRender; else defaultTitle\"\n [ngTemplateOutlet]=\"titleRender\"\n [ngTemplateOutletContext]=\"{ $implicit: i }\"\n ></ng-container>\n <ng-template #defaultTitle>{{ i.title }}</ng-template>\n </span>\n </div>\n <i *ngIf=\"i.closable\" nz-icon nzType=\"close\" class=\"reuse-tab__op\" (click)=\"_close($event, index, false)\"></i>\n </ng-template>\n </nz-tab>\n</nz-tabset>\n<reuse-tab-context [i18n]=\"i18n\" (change)=\"contextMenuChange($event)\"></reuse-tab-context>\n" }]
1087
- }], ctorParameters: function () {
1088
- return [{ type: ReuseTabService }, { type: i0.ChangeDetectorRef }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: undefined, decorators: [{
1089
- type: Optional
1090
- }, {
1091
- type: Inject,
1092
- args: [ALAIN_I18N_TOKEN]
1093
- }] }, { type: undefined, decorators: [{
1094
- type: Inject,
1095
- args: [DOCUMENT]
1096
- }] }, { type: i3$1.Platform }, { type: i4.Directionality, decorators: [{
1097
- type: Optional
1098
- }] }, { type: undefined, decorators: [{
1099
- type: Optional
1100
- }, {
1101
- type: Inject,
1102
- args: [REUSE_TAB_STORAGE_KEY]
1103
- }] }, { type: undefined, decorators: [{
1104
- type: Optional
1105
- }, {
1106
- type: Inject,
1107
- args: [REUSE_TAB_STORAGE_STATE]
1108
- }] }];
1109
- }, propDecorators: { tabset: [{
1110
- type: ViewChild,
1111
- args: ['tabset']
1112
- }], mode: [{
1113
- type: Input
1114
- }], i18n: [{
1115
- type: Input
1116
- }], debug: [{
1117
- type: Input
1118
- }], max: [{
1119
- type: Input
1120
- }], tabMaxWidth: [{
1121
- type: Input
1122
- }], excludes: [{
1123
- type: Input
1124
- }], allowClose: [{
1125
- type: Input
1126
- }], keepingScroll: [{
1127
- type: Input
1128
- }], storageState: [{
1129
- type: Input
1130
- }], keepingScrollContainer: [{
1131
- type: Input
1132
- }], customContextMenu: [{
1133
- type: Input
1134
- }], tabBarExtraContent: [{
1135
- type: Input
1136
- }], tabBarGutter: [{
1137
- type: Input
1138
- }], tabBarStyle: [{
1139
- type: Input
1140
- }], tabType: [{
1141
- type: Input
1142
- }], routeParamMatchMode: [{
1143
- type: Input
1144
- }], disabled: [{
1145
- type: Input
1146
- }], titleRender: [{
1147
- type: Input
1148
- }], canClose: [{
1149
- type: Input
1150
- }], change: [{
1151
- type: Output
1152
- }], close: [{
1153
- type: Output
1154
- }] } });
1155
-
1156
- class ReuseTabStrategy {
1157
- constructor(srv) {
1158
- this.srv = srv;
1159
- }
1160
- shouldDetach(route) {
1161
- return this.srv.shouldDetach(route);
1162
- }
1163
- store(route, handle) {
1164
- this.srv.store(route, handle);
1165
- }
1166
- shouldAttach(route) {
1167
- return this.srv.shouldAttach(route);
1168
- }
1169
- retrieve(route) {
1170
- return this.srv.retrieve(route);
1171
- }
1172
- shouldReuseRoute(future, curr) {
1173
- return this.srv.shouldReuseRoute(future, curr);
1174
- }
1175
- }
1176
-
1177
- const COMPONENTS = [ReuseTabComponent];
1178
- const NOEXPORTS = [ReuseTabContextMenuComponent, ReuseTabContextComponent, ReuseTabContextDirective];
1179
- class ReuseTabModule {
1180
- }
1181
- ReuseTabModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1182
- ReuseTabModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabModule, declarations: [ReuseTabComponent, ReuseTabContextMenuComponent, ReuseTabContextComponent, ReuseTabContextDirective], imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule], exports: [ReuseTabComponent] });
1183
- ReuseTabModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabModule, providers: [
1184
- {
1185
- provide: REUSE_TAB_STORAGE_KEY,
1186
- useValue: '_reuse-tab-state'
1187
- },
1188
- {
1189
- provide: REUSE_TAB_STORAGE_STATE,
1190
- useFactory: () => new ReuseTabLocalStorageState()
1191
- }
1192
- ], imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule] });
1193
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ReuseTabModule, decorators: [{
1194
- type: NgModule,
1195
- args: [{
1196
- imports: [CommonModule, RouterModule, DelonLocaleModule, NzMenuModule, NzTabsModule, NzIconModule, OverlayModule],
1197
- declarations: [...COMPONENTS, ...NOEXPORTS],
1198
- providers: [
1199
- {
1200
- provide: REUSE_TAB_STORAGE_KEY,
1201
- useValue: '_reuse-tab-state'
1202
- },
1203
- {
1204
- provide: REUSE_TAB_STORAGE_STATE,
1205
- useFactory: () => new ReuseTabLocalStorageState()
1206
- }
1207
- ],
1208
- exports: COMPONENTS
1209
- }]
1210
- }] });
1211
-
1212
- /**
1213
- * Generated bundle index. Do not edit.
1214
- */
1215
-
1216
- export { REUSE_TAB_STORAGE_KEY, REUSE_TAB_STORAGE_STATE, ReuseTabComponent, ReuseTabContextComponent, ReuseTabContextDirective, ReuseTabContextMenuComponent, ReuseTabContextService, ReuseTabLocalStorageState, ReuseTabMatchMode, ReuseTabModule, ReuseTabService, ReuseTabStrategy };
1217
- //# sourceMappingURL=reuse-tab.mjs.map