@10yun/cv-mobile-ui 0.5.55 → 0.5.57

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 (351) hide show
  1. package/{ui-sdks → other}/qiun-data-charts/js_sdk/u-charts/config-ucharts.js +605 -605
  2. package/{ui-sdks → other}/qiun-data-charts/package.json +2 -1
  3. package/other/qiun-data-charts_2.5.0-20230101_example/App.vue +20 -0
  4. package/other/qiun-data-charts_2.5.0-20230101_example/common/uni-icons.css +542 -0
  5. package/other/qiun-data-charts_2.5.0-20230101_example/common/uni.css +246 -0
  6. package/other/qiun-data-charts_2.5.0-20230101_example/components/qiun-title-bar/qiun-title-bar.vue +51 -0
  7. package/other/qiun-data-charts_2.5.0-20230101_example/components/test-charts/test-charts.vue +48 -0
  8. package/other/qiun-data-charts_2.5.0-20230101_example/main.js +13 -0
  9. package/other/qiun-data-charts_2.5.0-20230101_example/manifest.json +75 -0
  10. package/other/qiun-data-charts_2.5.0-20230101_example/mockdata/demodata.json +448 -0
  11. package/other/qiun-data-charts_2.5.0-20230101_example/mockdata/mapdata.json +1 -0
  12. package/other/qiun-data-charts_2.5.0-20230101_example/pages/canvas/canvas.vue +142 -0
  13. package/other/qiun-data-charts_2.5.0-20230101_example/pages/echarts/echarts.vue +228 -0
  14. package/other/qiun-data-charts_2.5.0-20230101_example/pages/format-e/format-e.vue +113 -0
  15. package/other/qiun-data-charts_2.5.0-20230101_example/pages/format-u/format-u.vue +110 -0
  16. package/other/qiun-data-charts_2.5.0-20230101_example/pages/index/index.vue +58 -0
  17. package/other/qiun-data-charts_2.5.0-20230101_example/pages/layout/layout.vue +174 -0
  18. package/other/qiun-data-charts_2.5.0-20230101_example/pages/other/other.vue +233 -0
  19. package/other/qiun-data-charts_2.5.0-20230101_example/pages/tab/tab.vue +115 -0
  20. package/other/qiun-data-charts_2.5.0-20230101_example/pages/ucharts/ucharts.vue +339 -0
  21. package/other/qiun-data-charts_2.5.0-20230101_example/pages/unicloud/unicloud.vue +117 -0
  22. package/other/qiun-data-charts_2.5.0-20230101_example/pages/updata/updata.vue +212 -0
  23. package/other/qiun-data-charts_2.5.0-20230101_example/pages.json +79 -0
  24. package/other/qiun-data-charts_2.5.0-20230101_example/static/logo.png +0 -0
  25. package/other/qiun-data-charts_2.5.0-20230101_example/uni.scss +76 -0
  26. package/other/qiun-data-charts_2.5.0-20230101_example/uniCloud-aliyun/database/db_init.json +455 -0
  27. package/other/qiun-data-charts_2.5.0-20230101_example/uniCloud-aliyun/database/qiun-charts-demo.schema.json +76 -0
  28. package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate0.vue +2 -1
  29. package/other/{u-parse-2019 → u-parse}/libs/html2json.js +2 -2
  30. package/other/{uParse → u-parse}/libs/wxDiscode.js +1 -1
  31. package/other/u-parse/readme.md +102 -0
  32. package/other/{u-parse-2019 → u-parse}/u-parse.vue +1 -6
  33. package/other/u-parse2026/libs/html2json.js +2 -2
  34. package/other/u-parse2026/libs/wxDiscode.js +1 -1
  35. package/other/u-parse2026/u-parse.css +1 -0
  36. package/other/u-parse2026/u-parse.vue +1 -3
  37. package/other/uParse2/components/wxParseAudio.vue +1 -0
  38. package/other/{uParse → uParse2}/components/wxParseImg.vue +4 -4
  39. package/other/{uParse → uParse2}/components/wxParseTable.vue +15 -6
  40. package/other/{uParse → uParse2}/components/wxParseTemplate0.vue +7 -6
  41. package/other/{uParse → uParse2}/components/wxParseTemplate1.vue +10 -0
  42. package/other/{uParse → uParse2}/libs/html2json.js +2 -2
  43. package/other/{u-parse-2019 → uParse2}/libs/wxDiscode.js +1 -1
  44. package/other/{uParse/wxParse.css → uParse2/u-parse.css} +4 -4
  45. package/other/{uParse/wxParse.vue → uParse2/u-parse.vue} +18 -11
  46. package/other/uParse2/u-parse2.css +264 -0
  47. package/package.json +1 -1
  48. package/ui-cv/components/cv-dialog-share/cv-dialog-share.vue +7 -7
  49. package/ui-cv/components/cv-geo-local/cv-geo-local.vue +1 -1
  50. package/ui-cv/components/cv-icons/cv-icons.vue +18 -62
  51. package/ui-cv/components/cv-icons/iconfont/font-default-icons.js +127 -131
  52. package/ui-cv/components/cv-input-password/cv-input-password.vue +1 -1
  53. package/ui-cv/components/cv-mask-svg/cv-mask-svg.vue +1 -1
  54. package/ui-cv/components/cv-mask-svg/mixins.js +16 -12
  55. package/ui-cv/components/cv-upload-image/cv-upload-image.vue +4 -4
  56. package/ui-fireui/components/u-share-model/u-share-model.vue +1 -1
  57. package/ui-fireui/components/u-uploadsamll/u-uploadsamll.vue +1 -1
  58. package/uview-plus/components/u-dropdown-list/u-dropdown-list.vue +1 -2
  59. package/uview-plus/components/u-form/form.js +13 -12
  60. package/uview-plus/components/u-image/u-image-wu.vue +25 -1
  61. package/uview-plus/components/u-parse/README.md +192 -0
  62. package/uview-plus/components/u-parse/changelog.md +163 -0
  63. package/uview-plus/components/u-parse/node/node.vue +37 -3
  64. package/{uni-ui/lib/uni-breadcrumb → uview-plus/components/u-parse}/package.json +24 -29
  65. package/uview-plus/components/u-parse/parser.js +8 -3
  66. package/uview-plus/components/u-parse/static/app-plus/up-parse/js/handler.js +1 -0
  67. package/uview-plus/components/u-parse/static/app-plus/up-parse/local-2.5.2.html +29 -0
  68. package/uview-plus/components/u-parse/u-parse.vue +29 -1
  69. package/other/lime-painter2/README2.md +0 -576
  70. package/other/lime-painter2/changelog.md +0 -225
  71. package/other/lime-painter2/package.json +0 -93
  72. package/other/lime-painter2/readme.md +0 -758
  73. package/other/lime-painter2/test.md +0 -45
  74. package/other/qiun-data-charts/qiun-data-charts.vue +0 -1618
  75. package/other/u-parse-2019/readme.md +0 -99
  76. package/other/uParse/components/style.css +0 -1
  77. package/other/uParse/components/wxParseAudio.vue +0 -1
  78. package/other/xt-parse/changelog.md +0 -41
  79. package/other/xt-parse/node/node.vue +0 -752
  80. package/other/xt-parse/package.json +0 -129
  81. package/other/xt-parse/parser.js +0 -1461
  82. package/other/xt-parse/props.js +0 -49
  83. package/other/xt-parse/readme.md +0 -145
  84. package/other/xt-parse/static/app-plus/u-parse/js/handler.js +0 -1
  85. package/other/xt-parse/u-parse.vue +0 -510
  86. package/plugins/luch-request/adapters/index.js +0 -131
  87. package/plugins/luch-request/core/InterceptorManager.js +0 -50
  88. package/plugins/luch-request/core/Request.js +0 -199
  89. package/plugins/luch-request/core/buildFullPath.js +0 -20
  90. package/plugins/luch-request/core/defaults.js +0 -32
  91. package/plugins/luch-request/core/dispatchRequest.js +0 -5
  92. package/plugins/luch-request/core/mergeConfig.js +0 -125
  93. package/plugins/luch-request/core/settle.js +0 -16
  94. package/plugins/luch-request/helpers/buildURL.js +0 -71
  95. package/plugins/luch-request/helpers/combineURLs.js +0 -12
  96. package/plugins/luch-request/helpers/isAbsoluteURL.js +0 -14
  97. package/plugins/luch-request/index.d.ts +0 -197
  98. package/plugins/luch-request/index.js +0 -2
  99. package/plugins/luch-request/readme.md +0 -3
  100. package/plugins/luch-request/utils/clone.js +0 -260
  101. package/plugins/luch-request/utils.js +0 -131
  102. package/ui-cv/components/cv-cell-row/cv-cell-row.vue +0 -220
  103. package/ui-cv/components/cv-icons/iconfont/font-action-icons.js +0 -73
  104. package/ui-cv/components/cv-icons/iconfont/font-action.css +0 -7
  105. package/ui-cv/components/cv-icons/iconfont/font-action.js +0 -5
  106. package/ui-cv/components/cv-icons/iconfont/font-arrow-icons.js +0 -47
  107. package/ui-cv/components/cv-icons/iconfont/font-arrow.css +0 -6
  108. package/ui-cv/components/cv-icons/iconfont/font-arrow.js +0 -5
  109. package/ui-cv/components/cv-icons/iconfont/font-base-icons.js +0 -92
  110. package/ui-cv/components/cv-icons/iconfont/font-base.css +0 -6
  111. package/ui-cv/components/cv-icons/iconfont/font-base.js +0 -5
  112. package/ui-cv/components/cv-icons/iconfont/font-mall-icons.js +0 -35
  113. package/ui-cv/components/cv-icons/iconfont/font-mall.css +0 -7
  114. package/ui-cv/components/cv-icons/iconfont/font-mall.js +0 -5
  115. package/ui-cv/components/cv-icons/iconfont/font-media-icons.js +0 -45
  116. package/ui-cv/components/cv-icons/iconfont/font-media.css +0 -7
  117. package/ui-cv/components/cv-icons/iconfont/font-media.js +0 -5
  118. package/ui-cv/components/cv-icons/iconfont/font-order-icons.js +0 -34
  119. package/ui-cv/components/cv-icons/iconfont/font-order.css +0 -6
  120. package/ui-cv/components/cv-icons/iconfont/font-order.js +0 -5
  121. package/ui-cv/components/cv-icons/iconfont/font-people-icons.js +0 -49
  122. package/ui-cv/components/cv-icons/iconfont/font-people.css +0 -7
  123. package/ui-cv/components/cv-icons/iconfont/font-people.js +0 -5
  124. package/ui-cv/components/cv-icons/iconfont/font-status-icons.js +0 -34
  125. package/ui-cv/components/cv-icons/iconfont/font-status.css +0 -6
  126. package/ui-cv/components/cv-icons/iconfont/font-status.js +0 -5
  127. package/ui-cv/components/cv-icons/iconfont/font-wallet-icons.js +0 -17
  128. package/ui-cv/components/cv-icons/iconfont/font-wallet.css +0 -6
  129. package/ui-cv/components/cv-icons/iconfont/font-wallet.js +0 -5
  130. package/ui-cv/components/cv-icons/icons/default-icons.js +0 -132
  131. package/ui-cv/components/cv-icons/icons/icons-action.js +0 -72
  132. package/ui-cv/components/cv-icons/icons/icons-arrow.js +0 -46
  133. package/ui-cv/components/cv-icons/icons/icons-base.js +0 -89
  134. package/ui-cv/components/cv-icons/icons/icons-mall.js +0 -34
  135. package/ui-cv/components/cv-icons/icons/icons-media.js +0 -44
  136. package/ui-cv/components/cv-icons/icons/icons-order.js +0 -33
  137. package/ui-cv/components/cv-icons/icons/icons-people.js +0 -46
  138. package/ui-cv/components/cv-icons/icons/icons-status.js +0 -32
  139. package/ui-cv/components/cv-icons/icons/icons-wallet.js +0 -15
  140. package/ui-sdks/sdk-app-update/img/logo.png +0 -0
  141. package/ui-sdks/sdk-app-update/img/update_bg.png +0 -0
  142. package/ui-sdks/sdk-app-update/img/update_bg_top.png +0 -0
  143. package/ui-sdks/sdk-app-update/sdk-app-update.vue +0 -396
  144. package/ui-sdks/sdk-app-update/xxxx +0 -62
  145. package/ui-sdks/sdk-privacy-policy/sdk-privacy-policy.vue +0 -113
  146. package/ui-sdks/sdk-u-charts/config-echarts.js +0 -420
  147. package/ui-sdks/sdk-u-charts/config-ucharts.js +0 -630
  148. package/ui-sdks/sdk-u-charts/u-charts.js +0 -7398
  149. package/ui-sdks/sdk-u-charts/u-charts.min.js +0 -1
  150. package/ui-sdks/sdk-webview-main/WebViewMain.vue +0 -1
  151. package/ui-sdks/sdk-webview-main/main.js +0 -0
  152. package/ui-sdks/sdk-webview-main/mixin.js +0 -0
  153. package/uni-ui/lib/uni-badge/changelog.md +0 -33
  154. package/uni-ui/lib/uni-badge/package.json +0 -107
  155. package/uni-ui/lib/uni-badge/readme.md +0 -8
  156. package/uni-ui/lib/uni-breadcrumb/changelog.md +0 -6
  157. package/uni-ui/lib/uni-breadcrumb/readme.md +0 -66
  158. package/uni-ui/lib/uni-calendar/changelog.md +0 -30
  159. package/uni-ui/lib/uni-calendar/package.json +0 -105
  160. package/uni-ui/lib/uni-calendar/readme.md +0 -103
  161. package/uni-ui/lib/uni-card/changelog.md +0 -26
  162. package/uni-ui/lib/uni-card/package.json +0 -107
  163. package/uni-ui/lib/uni-card/readme.md +0 -10
  164. package/uni-ui/lib/uni-collapse/changelog.md +0 -48
  165. package/uni-ui/lib/uni-collapse/package.json +0 -106
  166. package/uni-ui/lib/uni-collapse/readme.md +0 -11
  167. package/uni-ui/lib/uni-combox/changelog.md +0 -17
  168. package/uni-ui/lib/uni-combox/package.json +0 -107
  169. package/uni-ui/lib/uni-combox/readme.md +0 -10
  170. package/uni-ui/lib/uni-countdown/changelog.md +0 -30
  171. package/uni-ui/lib/uni-countdown/package.json +0 -105
  172. package/uni-ui/lib/uni-countdown/readme.md +0 -9
  173. package/uni-ui/lib/uni-data-checkbox/changelog.md +0 -51
  174. package/uni-ui/lib/uni-data-checkbox/package.json +0 -107
  175. package/uni-ui/lib/uni-data-checkbox/readme.md +0 -17
  176. package/uni-ui/lib/uni-data-picker/changelog.md +0 -81
  177. package/uni-ui/lib/uni-data-picker/package.json +0 -109
  178. package/uni-ui/lib/uni-data-picker/readme.md +0 -21
  179. package/uni-ui/lib/uni-data-select/changelog.md +0 -51
  180. package/uni-ui/lib/uni-data-select/package.json +0 -106
  181. package/uni-ui/lib/uni-data-select/readme.md +0 -7
  182. package/uni-ui/lib/uni-dateformat/changelog.md +0 -10
  183. package/uni-ui/lib/uni-dateformat/package.json +0 -107
  184. package/uni-ui/lib/uni-dateformat/readme.md +0 -10
  185. package/uni-ui/lib/uni-datetime-picker/changelog.md +0 -177
  186. package/uni-ui/lib/uni-datetime-picker/package.json +0 -107
  187. package/uni-ui/lib/uni-datetime-picker/readme.md +0 -20
  188. package/uni-ui/lib/uni-drawer/changelog.md +0 -13
  189. package/uni-ui/lib/uni-drawer/package.json +0 -106
  190. package/uni-ui/lib/uni-drawer/readme.md +0 -9
  191. package/uni-ui/lib/uni-easyinput/changelog.md +0 -121
  192. package/uni-ui/lib/uni-easyinput/package.json +0 -107
  193. package/uni-ui/lib/uni-easyinput/readme.md +0 -10
  194. package/uni-ui/lib/uni-fab/changelog.md +0 -25
  195. package/uni-ui/lib/uni-fab/package.json +0 -107
  196. package/uni-ui/lib/uni-fab/readme.md +0 -8
  197. package/uni-ui/lib/uni-fav/changelog.md +0 -19
  198. package/uni-ui/lib/uni-fav/package.json +0 -106
  199. package/uni-ui/lib/uni-fav/readme.md +0 -9
  200. package/uni-ui/lib/uni-file-picker/changelog.md +0 -91
  201. package/uni-ui/lib/uni-file-picker/package.json +0 -105
  202. package/uni-ui/lib/uni-file-picker/readme.md +0 -10
  203. package/uni-ui/lib/uni-forms/changelog.md +0 -100
  204. package/uni-ui/lib/uni-forms/package.json +0 -107
  205. package/uni-ui/lib/uni-forms/readme.md +0 -22
  206. package/uni-ui/lib/uni-goods-nav/changelog.md +0 -18
  207. package/uni-ui/lib/uni-goods-nav/package.json +0 -105
  208. package/uni-ui/lib/uni-goods-nav/readme.md +0 -9
  209. package/uni-ui/lib/uni-grid/changelog.md +0 -13
  210. package/uni-ui/lib/uni-grid/package.json +0 -106
  211. package/uni-ui/lib/uni-grid/readme.md +0 -10
  212. package/uni-ui/lib/uni-group/changelog.md +0 -16
  213. package/uni-ui/lib/uni-group/package.json +0 -106
  214. package/uni-ui/lib/uni-group/readme.md +0 -8
  215. package/uni-ui/lib/uni-icons/changelog.md +0 -44
  216. package/uni-ui/lib/uni-icons/package.json +0 -111
  217. package/uni-ui/lib/uni-icons/readme.md +0 -7
  218. package/uni-ui/lib/uni-indexed-list/changelog.md +0 -19
  219. package/uni-ui/lib/uni-indexed-list/package.json +0 -107
  220. package/uni-ui/lib/uni-indexed-list/readme.md +0 -10
  221. package/uni-ui/lib/uni-link/changelog.md +0 -17
  222. package/uni-ui/lib/uni-link/package.json +0 -106
  223. package/uni-ui/lib/uni-link/readme.md +0 -10
  224. package/uni-ui/lib/uni-list/changelog.md +0 -52
  225. package/uni-ui/lib/uni-list/package.json +0 -108
  226. package/uni-ui/lib/uni-list/readme.md +0 -44
  227. package/uni-ui/lib/uni-load-more/changelog.md +0 -27
  228. package/uni-ui/lib/uni-load-more/package.json +0 -105
  229. package/uni-ui/lib/uni-load-more/readme.md +0 -12
  230. package/uni-ui/lib/uni-nav-bar/changelog.md +0 -64
  231. package/uni-ui/lib/uni-nav-bar/package.json +0 -106
  232. package/uni-ui/lib/uni-nav-bar/readme.md +0 -13
  233. package/uni-ui/lib/uni-notice-bar/changelog.md +0 -22
  234. package/uni-ui/lib/uni-notice-bar/package.json +0 -107
  235. package/uni-ui/lib/uni-notice-bar/readme.md +0 -11
  236. package/uni-ui/lib/uni-number-box/changelog.md +0 -39
  237. package/uni-ui/lib/uni-number-box/package.json +0 -104
  238. package/uni-ui/lib/uni-number-box/readme.md +0 -11
  239. package/uni-ui/lib/uni-pagination/changelog.md +0 -27
  240. package/uni-ui/lib/uni-pagination/package.json +0 -106
  241. package/uni-ui/lib/uni-pagination/readme.md +0 -10
  242. package/uni-ui/lib/uni-popup/changelog.md +0 -102
  243. package/uni-ui/lib/uni-popup/package.json +0 -107
  244. package/uni-ui/lib/uni-popup/readme.md +0 -15
  245. package/uni-ui/lib/uni-rate/changelog.md +0 -27
  246. package/uni-ui/lib/uni-rate/package.json +0 -106
  247. package/uni-ui/lib/uni-rate/readme.md +0 -11
  248. package/uni-ui/lib/uni-row/changelog.md +0 -10
  249. package/uni-ui/lib/uni-row/package.json +0 -106
  250. package/uni-ui/lib/uni-row/readme.md +0 -9
  251. package/uni-ui/lib/uni-scss/changelog.md +0 -8
  252. package/uni-ui/lib/uni-scss/package.json +0 -99
  253. package/uni-ui/lib/uni-scss/readme.md +0 -3
  254. package/uni-ui/lib/uni-search-bar/changelog.md +0 -47
  255. package/uni-ui/lib/uni-search-bar/package.json +0 -106
  256. package/uni-ui/lib/uni-search-bar/readme.md +0 -12
  257. package/uni-ui/lib/uni-section/changelog.md +0 -2
  258. package/uni-ui/lib/uni-section/package.json +0 -104
  259. package/uni-ui/lib/uni-section/readme.md +0 -7
  260. package/uni-ui/lib/uni-segmented-control/changelog.md +0 -15
  261. package/uni-ui/lib/uni-segmented-control/package.json +0 -106
  262. package/uni-ui/lib/uni-segmented-control/readme.md +0 -11
  263. package/uni-ui/lib/uni-steps/changelog.md +0 -18
  264. package/uni-ui/lib/uni-steps/package.json +0 -106
  265. package/uni-ui/lib/uni-steps/readme.md +0 -11
  266. package/uni-ui/lib/uni-swipe-action/changelog.md +0 -60
  267. package/uni-ui/lib/uni-swipe-action/package.json +0 -113
  268. package/uni-ui/lib/uni-swipe-action/readme.md +0 -10
  269. package/uni-ui/lib/uni-swiper-dot/changelog.md +0 -12
  270. package/uni-ui/lib/uni-swiper-dot/package.json +0 -106
  271. package/uni-ui/lib/uni-swiper-dot/readme.md +0 -10
  272. package/uni-ui/lib/uni-table/changelog.md +0 -35
  273. package/uni-ui/lib/uni-table/package.json +0 -106
  274. package/uni-ui/lib/uni-table/readme.md +0 -11
  275. package/uni-ui/lib/uni-tag/changelog.md +0 -25
  276. package/uni-ui/lib/uni-tag/package.json +0 -106
  277. package/uni-ui/lib/uni-tag/readme.md +0 -11
  278. package/uni-ui/lib/uni-title/changelog.md +0 -10
  279. package/uni-ui/lib/uni-title/package.json +0 -107
  280. package/uni-ui/lib/uni-title/readme.md +0 -12
  281. package/uni-ui/lib/uni-tooltip/changelog.md +0 -16
  282. package/uni-ui/lib/uni-tooltip/package.json +0 -104
  283. package/uni-ui/lib/uni-tooltip/readme.md +0 -7
  284. package/uni-ui/lib/uni-transition/changelog.md +0 -31
  285. package/uni-ui/lib/uni-transition/package.json +0 -112
  286. package/uni-ui/lib/uni-transition/readme.md +0 -10
  287. package/uni-ui/lib/uni-ui/changelog.md +0 -639
  288. package/uni-ui/lib/uni-ui/package.json +0 -148
  289. package/uni-ui/lib/uni-ui/readme.md +0 -247
  290. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/canvas.js +0 -0
  291. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/draw.js +0 -0
  292. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/draw2.js +0 -0
  293. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/gradient.js +0 -0
  294. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/index.vue +0 -0
  295. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/index2.vue +0 -0
  296. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/layout.js +0 -0
  297. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/qrcode.js +0 -0
  298. /package/other/{lime-painter2/components/lime-painter → lime-painter/components/lime-painter2}/utils.js +0 -0
  299. /package/{ui-sdks → other}/qiun-data-charts/changelog.md +0 -0
  300. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue +0 -0
  301. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-error/qiun-error.vue +0 -0
  302. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/loading1.vue +0 -0
  303. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/loading2.vue +0 -0
  304. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/loading3.vue +0 -0
  305. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/loading4.vue +0 -0
  306. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/loading5.vue +0 -0
  307. /package/{ui-sdks → other}/qiun-data-charts/components/qiun-loading/qiun-loading.vue +0 -0
  308. /package/{ui-sdks → other}/qiun-data-charts/js_sdk/u-charts/config-echarts.js +0 -0
  309. /package/{ui-sdks → other}/qiun-data-charts/js_sdk/u-charts/readme.md +0 -0
  310. /package/{ui-sdks → other}/qiun-data-charts/js_sdk/u-charts/u-charts.js +0 -0
  311. /package/{ui-sdks → other}/qiun-data-charts/js_sdk/u-charts/u-charts.min.js +0 -0
  312. /package/{ui-sdks/sdk-u-charts → other/qiun-data-charts/js_sdk2}/app-echarts.min.js +0 -0
  313. /package/{ui-sdks/sdk-u-charts → other/qiun-data-charts/js_sdk2}/h5-echarts.min.js +0 -0
  314. /package/{ui-sdks → other}/qiun-data-charts/license.md +0 -0
  315. /package/{ui-sdks → other}/qiun-data-charts/readme.md +0 -0
  316. /package/{ui-sdks → other}/qiun-data-charts/static/app-plus/echarts.min.js +0 -0
  317. /package/{ui-sdks → other}/qiun-data-charts/static/h5/echarts.min.js +0 -0
  318. /package/{ui-sdks → other}/tui-clipboard/tui-clipboard.js +0 -0
  319. /package/other/{u-parse-2019 → u-parse}/components/wxParseAudio.vue +0 -0
  320. /package/other/{u-parse-2019 → u-parse}/components/wxParseImg.vue +0 -0
  321. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate1.vue +0 -0
  322. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate10.vue +0 -0
  323. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate11.vue +0 -0
  324. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate2.vue +0 -0
  325. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate3.vue +0 -0
  326. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate4.vue +0 -0
  327. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate5.vue +0 -0
  328. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate6.vue +0 -0
  329. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate7.vue +0 -0
  330. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate8.vue +0 -0
  331. /package/other/{u-parse-2019 → u-parse}/components/wxParseTemplate9.vue +0 -0
  332. /package/other/{u-parse-2019 → u-parse}/components/wxParseVideo.vue +0 -0
  333. /package/other/{u-parse-2019 → u-parse}/libs/htmlparser.js +0 -0
  334. /package/other/{u-parse-2019 → u-parse}/u-parse.css +0 -0
  335. /package/other/{uParse → uParse2}/components/wxParseTemplate10.vue +0 -0
  336. /package/other/{uParse → uParse2}/components/wxParseTemplate11.vue +0 -0
  337. /package/other/{uParse → uParse2}/components/wxParseTemplate2.vue +0 -0
  338. /package/other/{uParse → uParse2}/components/wxParseTemplate3.vue +0 -0
  339. /package/other/{uParse → uParse2}/components/wxParseTemplate4.vue +0 -0
  340. /package/other/{uParse → uParse2}/components/wxParseTemplate5.vue +0 -0
  341. /package/other/{uParse → uParse2}/components/wxParseTemplate6.vue +0 -0
  342. /package/other/{uParse → uParse2}/components/wxParseTemplate7.vue +0 -0
  343. /package/other/{uParse → uParse2}/components/wxParseTemplate8.vue +0 -0
  344. /package/other/{uParse → uParse2}/components/wxParseTemplate9.vue +0 -0
  345. /package/other/{uParse → uParse2}/components/wxParseVideo.vue +0 -0
  346. /package/other/{uParse → uParse2}/editor.css +0 -0
  347. /package/other/{uParse → uParse2}/libs/htmlparser.js +0 -0
  348. /package/{other/xt-parse/static/app-plus/u-parse → uview-plus/components/u-parse/static/app-plus/up-parse}/js/handler2.js +0 -0
  349. /package/{other/xt-parse/static/app-plus/u-parse → uview-plus/components/u-parse/static/app-plus/up-parse}/js/uni.webview.min.js +0 -0
  350. /package/{other/xt-parse/static/app-plus/u-parse → uview-plus/components/u-parse/static/app-plus/up-parse}/js/uni.webview.min2.js +0 -0
  351. /package/{other/xt-parse/static/app-plus/u-parse → uview-plus/components/u-parse/static/app-plus/up-parse}/local.html +0 -0
@@ -1,1461 +0,0 @@
1
- /**
2
- * @fileoverview html 解析器
3
- */
4
-
5
- // 配置
6
- const config = {
7
- // 信任的标签(保持标签名不变)
8
- trustTags: makeMap(
9
- 'a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'
10
- ),
11
-
12
- // 块级标签(转为 div,其他的非信任标签转为 span)
13
- blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
14
-
15
- // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3
16
- // 行内标签
17
- inlineTags: makeMap('abbr,b,big,code,del,em,i,ins,label,q,small,span,strong,sub,sup'),
18
- // #endif
19
-
20
- // 要移除的标签
21
- ignoreTags: makeMap(
22
- 'area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr'
23
- ),
24
-
25
- // 自闭合的标签
26
- voidTags: makeMap(
27
- 'area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'
28
- ),
29
-
30
- // html 实体
31
- entities: {
32
- lt: '<',
33
- gt: '>',
34
- quot: '"',
35
- apos: "'",
36
- ensp: '\u2002',
37
- emsp: '\u2003',
38
- nbsp: '\xA0',
39
- semi: ';',
40
- ndash: '–',
41
- mdash: '—',
42
- middot: '·',
43
- lsquo: '‘',
44
- rsquo: '’',
45
- ldquo: '“',
46
- rdquo: '”',
47
- bull: '•',
48
- hellip: '…',
49
- larr: '←',
50
- uarr: '↑',
51
- rarr: '→',
52
- darr: '↓'
53
- },
54
-
55
- // 默认的标签样式
56
- tagStyle: {
57
- // #ifndef APP-PLUS-NVUE
58
- address: 'font-style:italic',
59
- big: 'display:inline;font-size:1.2em',
60
- caption: 'display:table-caption;text-align:center',
61
- center: 'text-align:center',
62
- cite: 'font-style:italic',
63
- dd: 'margin-left:40px',
64
- mark: 'background-color:yellow',
65
- pre: 'font-family:monospace;white-space:pre',
66
- s: 'text-decoration:line-through',
67
- small: 'display:inline;font-size:0.8em',
68
- strike: 'text-decoration:line-through',
69
- u: 'text-decoration:underline'
70
- // #endif
71
- },
72
-
73
- // svg 大小写对照表
74
- svgDict: {
75
- animatetransform: 'animateTransform',
76
- lineargradient: 'linearGradient',
77
- viewbox: 'viewBox',
78
- attributename: 'attributeName',
79
- repeatcount: 'repeatCount',
80
- repeatdur: 'repeatDur',
81
- foreignobject: 'foreignObject'
82
- }
83
- };
84
- const tagSelector = {};
85
- let windowWidth, system;
86
- // #ifdef MP-WEIXIN
87
- if (uni.canIUse('getWindowInfo')) {
88
- windowWidth = uni.getWindowInfo().windowWidth;
89
- system = uni.getDeviceInfo().system;
90
- } else {
91
- const systemInfo = uni.getSystemInfoSync();
92
- windowWidth = systemInfo.windowWidth;
93
- // #ifdef MP-WEIXIN
94
- system = systemInfo.system;
95
- }
96
- // #endif
97
- // #ifndef MP-WEIXIN
98
- const systemInfo = uni.getSystemInfoSync();
99
- windowWidth = systemInfo.windowWidth;
100
- // #endif
101
- const blankChar = makeMap(' ,\r,\n,\t,\f');
102
- let idIndex = 0;
103
-
104
- // #ifdef H5 || APP-PLUS
105
- config.ignoreTags.iframe = undefined;
106
- config.trustTags.iframe = true;
107
- config.ignoreTags.embed = undefined;
108
- config.trustTags.embed = true;
109
- // #endif
110
- // #ifdef APP-PLUS-NVUE
111
- config.ignoreTags.source = undefined;
112
- config.ignoreTags.style = undefined;
113
- // #endif
114
-
115
- /**
116
- * @description 创建 map
117
- * @param {String} str 逗号分隔
118
- */
119
- function makeMap(str) {
120
- const map = Object.create(null);
121
- const list = str.split(',');
122
- for (let i = list.length; i--; ) {
123
- map[list[i]] = true;
124
- }
125
- return map;
126
- }
127
-
128
- /**
129
- * @description 解码 html 实体
130
- * @param {String} str 要解码的字符串
131
- * @param {Boolean} amp 要不要解码 &amp;
132
- * @returns {String} 解码后的字符串
133
- */
134
- function decodeEntity(str, amp) {
135
- let i = str.indexOf('&');
136
- while (i !== -1) {
137
- const j = str.indexOf(';', i + 3);
138
- let code;
139
- if (j === -1) break;
140
- if (str[i + 1] === '#') {
141
- // &#123; 形式的实体
142
- code = parseInt((str[i + 2] === 'x' ? '0' : '') + str.substring(i + 2, j));
143
- if (!isNaN(code)) {
144
- str = str.substr(0, i) + String.fromCharCode(code) + str.substr(j + 1);
145
- }
146
- } else {
147
- // &nbsp; 形式的实体
148
- code = str.substring(i + 1, j);
149
- if (config.entities[code] || (code === 'amp' && amp)) {
150
- str = str.substr(0, i) + (config.entities[code] || '&') + str.substr(j + 1);
151
- }
152
- }
153
- i = str.indexOf('&', i + 1);
154
- }
155
- return str;
156
- }
157
-
158
- /**
159
- * @description 合并多个块级标签,加快长内容渲染
160
- * @param {Array} nodes 要合并的标签数组
161
- */
162
- function mergeNodes(nodes) {
163
- let i = nodes.length - 1;
164
- for (let j = i; j >= -1; j--) {
165
- if (
166
- j === -1 ||
167
- nodes[j].c ||
168
- !nodes[j].name ||
169
- (nodes[j].name !== 'div' && nodes[j].name !== 'p' && nodes[j].name[0] !== 'h') ||
170
- (nodes[j].attrs.style || '').includes('inline')
171
- ) {
172
- if (i - j >= 5) {
173
- nodes.splice(j + 1, i - j, {
174
- name: 'div',
175
- attrs: {},
176
- children: nodes.slice(j + 1, i + 1)
177
- });
178
- }
179
- i = j - 1;
180
- }
181
- }
182
- }
183
-
184
- /**
185
- * @description html 解析器
186
- * @param {Object} vm 组件实例
187
- */
188
- function Parser(vm) {
189
- this.options = vm || {};
190
- this.tagStyle = Object.assign({}, config.tagStyle, this.options.tagStyle);
191
- this.imgList = vm.imgList || [];
192
- this.imgList._unloadimgs = 0;
193
- this.plugins = vm.plugins || [];
194
- this.attrs = Object.create(null);
195
- this.stack = [];
196
- this.nodes = [];
197
- this.pre = (this.options.containerStyle || '').includes('white-space') && this.options.containerStyle.includes('pre') ? 2 : 0;
198
- }
199
-
200
- /**
201
- * @description 执行解析
202
- * @param {String} content 要解析的文本
203
- */
204
- Parser.prototype.parse = function (content) {
205
- // 插件处理
206
- for (let i = this.plugins.length; i--; ) {
207
- if (this.plugins[i].onUpdate) {
208
- content = this.plugins[i].onUpdate(content, config) || content;
209
- }
210
- }
211
-
212
- new Lexer(this).parse(content);
213
- // 出栈未闭合的标签
214
- while (this.stack.length) {
215
- this.popNode();
216
- }
217
- if (this.nodes.length > 50) {
218
- mergeNodes(this.nodes);
219
- }
220
- return this.nodes;
221
- };
222
-
223
- /**
224
- * @description 将标签暴露出来(不被 rich-text 包含)
225
- */
226
- Parser.prototype.expose = function () {
227
- // #ifndef APP-PLUS-NVUE
228
- for (let i = this.stack.length; i--; ) {
229
- const item = this.stack[i];
230
- if (item.c || item.name === 'a' || item.name === 'video' || item.name === 'audio') return;
231
- item.c = 1;
232
- }
233
- // #endif
234
- };
235
-
236
- /**
237
- * @description 处理插件
238
- * @param {Object} node 要处理的标签
239
- * @returns {Boolean} 是否要移除此标签
240
- */
241
- Parser.prototype.hook = function (node) {
242
- for (let i = this.plugins.length; i--; ) {
243
- if (this.plugins[i].onParse && this.plugins[i].onParse(node, this) === false) {
244
- return false;
245
- }
246
- }
247
- return true;
248
- };
249
-
250
- /**
251
- * @description 将链接拼接上主域名
252
- * @param {String} url 需要拼接的链接
253
- * @returns {String} 拼接后的链接
254
- */
255
- Parser.prototype.getUrl = function (url) {
256
- const domain = this.options.domain;
257
- if (url[0] === '/') {
258
- if (url[1] === '/') {
259
- // // 开头的补充协议名
260
- url = (domain ? domain.split('://')[0] : 'http') + ':' + url;
261
- } else if (domain) {
262
- // 否则补充整个域名
263
- url = domain + url;
264
- } /* #ifdef APP-PLUS */ else {
265
- url = plus.io.convertLocalFileSystemURL(url);
266
- } /* #endif */
267
- } else if (!url.includes('data:') && !url.includes('://')) {
268
- if (domain) {
269
- url = domain + '/' + url;
270
- } /* #ifdef APP-PLUS */ else {
271
- url = plus.io.convertLocalFileSystemURL(url);
272
- } /* #endif */
273
- }
274
- return url;
275
- };
276
-
277
- /**
278
- * @description 解析样式表
279
- * @param {Object} node 标签
280
- * @returns {Object}
281
- */
282
- Parser.prototype.parseStyle = function (node) {
283
- const attrs = node.attrs;
284
- const list = (this.tagStyle[node.name] || '').split(';').concat((attrs.style || '').split(';'));
285
- const styleObj = {};
286
- let tmp = '';
287
-
288
- if (attrs.id && !this.xml) {
289
- // 暴露锚点
290
- if (this.options.useAnchor) {
291
- this.expose();
292
- } else if (node.name !== 'img' && node.name !== 'a' && node.name !== 'video' && node.name !== 'audio') {
293
- attrs.id = undefined;
294
- }
295
- }
296
-
297
- // 转换 width 和 height 属性
298
- if (attrs.width) {
299
- styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px');
300
- attrs.width = undefined;
301
- }
302
- if (attrs.height) {
303
- styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px');
304
- attrs.height = undefined;
305
- }
306
-
307
- for (let i = 0, len = list.length; i < len; i++) {
308
- const info = list[i].split(':');
309
- if (info.length < 2) continue;
310
- const key = info.shift().trim().toLowerCase();
311
- let value = info.join(':').trim();
312
- if ((value[0] === '-' && value.lastIndexOf('-') > 0) || value.includes('safe')) {
313
- // 兼容性的 css 不压缩
314
- tmp += `;${key}:${value}`;
315
- } else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import')) {
316
- // 重复的样式进行覆盖
317
- if (value.includes('url')) {
318
- // 填充链接
319
- let j = value.indexOf('(') + 1;
320
- if (j) {
321
- while (value[j] === '"' || value[j] === "'" || blankChar[value[j]]) {
322
- j++;
323
- }
324
- value = value.substr(0, j) + this.getUrl(value.substr(j));
325
- }
326
- } else if (value.includes('rpx')) {
327
- // 转换 rpx(rich-text 内部不支持 rpx)
328
- value = value.replace(/[0-9.]+\s*rpx/g, ($) => (parseFloat($) * windowWidth) / 750 + 'px');
329
- }
330
- styleObj[key] = value;
331
- }
332
- }
333
-
334
- node.attrs.style = tmp;
335
- return styleObj;
336
- };
337
-
338
- /**
339
- * @description 解析到标签名
340
- * @param {String} name 标签名
341
- * @private
342
- */
343
- Parser.prototype.onTagName = function (name) {
344
- this.tagName = this.xml ? name : name.toLowerCase();
345
- if (this.tagName === 'svg') {
346
- this.xml = (this.xml || 0) + 1; // svg 标签内大小写敏感
347
- config.ignoreTags.style = undefined; // svg 标签内 style 可用
348
- }
349
- };
350
-
351
- /**
352
- * @description 解析到属性名
353
- * @param {String} name 属性名
354
- * @private
355
- */
356
- Parser.prototype.onAttrName = function (name) {
357
- name = this.xml ? name : name.toLowerCase();
358
- // #ifdef (VUE3 && (H5 || APP-PLUS)) || APP-PLUS-NVUE
359
- if (name.includes('?') || name.includes(';')) {
360
- this.attrName = undefined;
361
- return;
362
- }
363
- // #endif
364
- if (name.substr(0, 5) === 'data-') {
365
- if (name === 'data-src' && !this.attrs.src) {
366
- // data-src 自动转为 src
367
- this.attrName = 'src';
368
- } else if (this.tagName === 'img' || this.tagName === 'a') {
369
- // a 和 img 标签保留 data- 的属性,可以在 imgtap 和 linktap 事件中使用
370
- this.attrName = name;
371
- } else {
372
- // 剩余的移除以减小大小
373
- this.attrName = undefined;
374
- }
375
- } else {
376
- this.attrName = name;
377
- this.attrs[name] = 'T'; // boolean 型属性缺省设置
378
- }
379
- };
380
-
381
- /**
382
- * @description 解析到属性值
383
- * @param {String} val 属性值
384
- * @private
385
- */
386
- Parser.prototype.onAttrVal = function (val) {
387
- const name = this.attrName || '';
388
- if (name === 'style' || name === 'href') {
389
- // 部分属性进行实体解码
390
- this.attrs[name] = decodeEntity(val, true);
391
- } else if (name.includes('src')) {
392
- // 拼接主域名
393
- this.attrs[name] = this.getUrl(decodeEntity(val, true));
394
- } else if (name) {
395
- this.attrs[name] = val;
396
- }
397
- };
398
-
399
- /**
400
- * @description 解析到标签开始
401
- * @param {Boolean} selfClose 是否有自闭合标识 />
402
- * @private
403
- */
404
- Parser.prototype.onOpenTag = function (selfClose) {
405
- // 拼装 node
406
- const node = Object.create(null);
407
- node.name = this.tagName;
408
- node.attrs = this.attrs;
409
- // 避免因为自动 diff 使得 type 被设置为 null 导致部分内容不显示
410
- if (this.options.nodes.length) {
411
- node.type = 'node';
412
- }
413
- this.attrs = Object.create(null);
414
-
415
- const attrs = node.attrs;
416
- const parent = this.stack[this.stack.length - 1];
417
- const siblings = parent ? parent.children : this.nodes;
418
- const close = this.xml ? selfClose : config.voidTags[node.name];
419
-
420
- // 替换标签名选择器
421
- if (tagSelector[node.name]) {
422
- attrs.class = tagSelector[node.name] + (attrs.class ? ' ' + attrs.class : '');
423
- }
424
-
425
- // 转换 embed 标签
426
- if (node.name === 'embed') {
427
- // #ifndef H5 || APP-PLUS
428
- const src = attrs.src || '';
429
- // 按照后缀名和 type 将 embed 转为 video 或 audio
430
- if (src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8') || (attrs.type || '').includes('video')) {
431
- node.name = 'video';
432
- } else if (
433
- src.includes('.mp3') ||
434
- src.includes('.wav') ||
435
- src.includes('.aac') ||
436
- src.includes('.m4a') ||
437
- (attrs.type || '').includes('audio')
438
- ) {
439
- node.name = 'audio';
440
- }
441
- if (attrs.autostart) {
442
- attrs.autoplay = 'T';
443
- }
444
- attrs.controls = 'T';
445
- // #endif
446
- // #ifdef H5 || APP-PLUS
447
- this.expose();
448
- // #endif
449
- }
450
-
451
- // #ifndef APP-PLUS-NVUE
452
- // 处理音视频
453
- if (node.name === 'video' || node.name === 'audio') {
454
- // 设置 id 以便获取 context
455
- if (node.name === 'video' && !attrs.id) {
456
- attrs.id = 'v' + idIndex++;
457
- }
458
- // 没有设置 controls 也没有设置 autoplay 的自动设置 controls
459
- if (!attrs.controls && !attrs.autoplay) {
460
- attrs.controls = 'T';
461
- }
462
- // 用数组存储所有可用的 source
463
- node.src = [];
464
- if (attrs.src) {
465
- node.src.push(attrs.src);
466
- attrs.src = undefined;
467
- }
468
- this.expose();
469
- }
470
- // #endif
471
-
472
- // 处理自闭合标签
473
- if (close) {
474
- if (!this.hook(node) || config.ignoreTags[node.name]) {
475
- // 通过 base 标签设置主域名
476
- if (node.name === 'base' && !this.options.domain) {
477
- this.options.domain = attrs.href;
478
- } /* #ifndef APP-PLUS-NVUE */ else if (
479
- node.name === 'source' &&
480
- parent &&
481
- (parent.name === 'video' || parent.name === 'audio') &&
482
- attrs.src
483
- ) {
484
- // 设置 source 标签(仅父节点为 video 或 audio 时有效)
485
- parent.src.push(attrs.src);
486
- } /* #endif */
487
- return;
488
- }
489
-
490
- // 解析 style
491
- const styleObj = this.parseStyle(node);
492
-
493
- // 处理图片
494
- if (node.name === 'img') {
495
- if (attrs.src) {
496
- // 标记 webp
497
- if (attrs.src.includes('webp')) {
498
- node.webp = 'T';
499
- }
500
- // data url 图片如果没有设置 original-src 默认为不可预览的小图片
501
- if (attrs.src.includes('data:') && this.options.previewImg !== 'all' && !attrs['original-src']) {
502
- attrs.ignore = 'T';
503
- }
504
- if (!attrs.ignore || node.webp || attrs.src.includes('cloud://')) {
505
- for (let i = this.stack.length; i--; ) {
506
- const item = this.stack[i];
507
- if (item.name === 'a') {
508
- node.a = item.attrs;
509
- }
510
- if (item.name === 'table' && !node.webp && !attrs.src.includes('cloud://')) {
511
- if (!styleObj.display || styleObj.display.includes('inline')) {
512
- node.t = 'inline-block';
513
- } else {
514
- node.t = styleObj.display;
515
- }
516
- styleObj.display = undefined;
517
- }
518
- // #ifndef H5 || APP-PLUS
519
- const style = item.attrs.style || '';
520
- if (
521
- style.includes('flex:') &&
522
- !style.includes('flex:0') &&
523
- !style.includes('flex: 0') &&
524
- (!styleObj.width || parseInt(styleObj.width) > 100)
525
- ) {
526
- styleObj.width = '100% !important';
527
- styleObj.height = '';
528
- for (let j = i + 1; j < this.stack.length; j++) {
529
- this.stack[j].attrs.style = (this.stack[j].attrs.style || '').replace('inline-', '');
530
- }
531
- } else if (style.includes('flex') && styleObj.width === '100%') {
532
- for (let j = i + 1; j < this.stack.length; j++) {
533
- const style = this.stack[j].attrs.style || '';
534
- if (!style.includes(';width') && !style.includes(' width') && style.indexOf('width') !== 0) {
535
- styleObj.width = '';
536
- break;
537
- }
538
- }
539
- } else if (style.includes('inline-block')) {
540
- if (styleObj.width && styleObj.width[styleObj.width.length - 1] === '%') {
541
- item.attrs.style += ';max-width:' + styleObj.width;
542
- styleObj.width = '';
543
- } else {
544
- item.attrs.style += ';max-width:100%';
545
- }
546
- }
547
- // #endif
548
- item.c = 1;
549
- }
550
- attrs.i = this.imgList.length.toString();
551
- let src = attrs['original-src'] || attrs.src;
552
- // #ifndef H5 || MP-ALIPAY || APP-PLUS || MP-360
553
- if (this.imgList.includes(src)) {
554
- // 如果有重复的链接则对域名进行随机大小写变换避免预览时错位
555
- let i = src.indexOf('://');
556
- if (i !== -1) {
557
- i += 3;
558
- let newSrc = src.substr(0, i);
559
- for (; i < src.length; i++) {
560
- if (src[i] === '/') break;
561
- newSrc += Math.random() > 0.5 ? src[i].toUpperCase() : src[i];
562
- }
563
- newSrc += src.substr(i);
564
- src = newSrc;
565
- }
566
- }
567
- // #endif
568
- this.imgList.push(src);
569
- if (!node.t) {
570
- this.imgList._unloadimgs += 1;
571
- }
572
- // #ifdef H5 || APP-PLUS
573
- if (this.options.lazyLoad) {
574
- attrs['data-src'] = attrs.src;
575
- attrs.src = undefined;
576
- }
577
- // #endif
578
- }
579
- }
580
- if (styleObj.display === 'inline') {
581
- styleObj.display = '';
582
- }
583
- // #ifndef APP-PLUS-NVUE
584
- if (attrs.ignore) {
585
- styleObj['max-width'] = styleObj['max-width'] || '100%';
586
- attrs.style += ';-webkit-touch-callout:none';
587
- }
588
- // #endif
589
- // 设置的宽度超出屏幕,为避免变形,高度转为自动
590
- if (parseInt(styleObj.width) > windowWidth) {
591
- styleObj.height = undefined;
592
- }
593
- // 记录是否设置了宽高
594
- if (!isNaN(parseInt(styleObj.width))) {
595
- node.w = 'T';
596
- }
597
- if (
598
- !isNaN(parseInt(styleObj.height)) &&
599
- (!styleObj.height.includes('%') || (parent && (parent.attrs.style || '').includes('height')))
600
- ) {
601
- node.h = 'T';
602
- }
603
- if (node.w && node.h && styleObj['object-fit']) {
604
- if (styleObj['object-fit'] === 'contain') {
605
- node.m = 'aspectFit';
606
- } else if (styleObj['object-fit'] === 'cover') {
607
- node.m = 'aspectFill';
608
- }
609
- }
610
- } else if (node.name === 'svg') {
611
- siblings.push(node);
612
- this.stack.push(node);
613
- this.popNode();
614
- return;
615
- }
616
- for (const key in styleObj) {
617
- if (styleObj[key]) {
618
- attrs.style += `;${key}:${styleObj[key].replace(' !important', '')}`;
619
- }
620
- }
621
- attrs.style = attrs.style.substr(1) || undefined;
622
- // #ifdef (MP-WEIXIN || MP-QQ) && VUE3
623
- if (!attrs.style) {
624
- delete attrs.style;
625
- }
626
- // #endif
627
- } else {
628
- if ((node.name === 'pre' || ((attrs.style || '').includes('white-space') && attrs.style.includes('pre'))) && this.pre !== 2) {
629
- this.pre = node.pre = 1;
630
- }
631
- node.children = [];
632
- this.stack.push(node);
633
- }
634
-
635
- // 加入节点树
636
- siblings.push(node);
637
- };
638
-
639
- /**
640
- * @description 解析到标签结束
641
- * @param {String} name 标签名
642
- * @private
643
- */
644
- Parser.prototype.onCloseTag = function (name) {
645
- // 依次出栈到匹配为止
646
- name = this.xml ? name : name.toLowerCase();
647
- let i;
648
- for (i = this.stack.length; i--; ) {
649
- if (this.stack[i].name === name) break;
650
- }
651
- if (i !== -1) {
652
- while (this.stack.length > i) {
653
- this.popNode();
654
- }
655
- } else if (name === 'p' || name === 'br') {
656
- const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
657
- siblings.push({
658
- name,
659
- attrs: {
660
- class: tagSelector[name] || '',
661
- style: this.tagStyle[name] || ''
662
- }
663
- });
664
- }
665
- };
666
-
667
- /**
668
- * @description 处理标签出栈
669
- * @private
670
- */
671
- Parser.prototype.popNode = function () {
672
- const node = this.stack.pop();
673
- let attrs = node.attrs;
674
- const children = node.children;
675
- const parent = this.stack[this.stack.length - 1];
676
- const siblings = parent ? parent.children : this.nodes;
677
-
678
- if (!this.hook(node) || config.ignoreTags[node.name]) {
679
- // 获取标题
680
- if (node.name === 'title' && children.length && children[0].type === 'text' && this.options.setTitle) {
681
- uni.setNavigationBarTitle({
682
- title: children[0].text
683
- });
684
- }
685
- siblings.pop();
686
- return;
687
- }
688
-
689
- if (node.pre && this.pre !== 2) {
690
- // 是否合并空白符标识
691
- this.pre = node.pre = undefined;
692
- for (let i = this.stack.length; i--; ) {
693
- if (this.stack[i].pre) {
694
- this.pre = 1;
695
- }
696
- }
697
- }
698
-
699
- const styleObj = {};
700
-
701
- // 转换 svg
702
- if (node.name === 'svg') {
703
- if (this.xml > 1) {
704
- // 多层 svg 嵌套
705
- this.xml--;
706
- return;
707
- }
708
- // #ifdef APP-PLUS-NVUE
709
- (function traversal(node) {
710
- if (node.name) {
711
- // 调整 svg 的大小写
712
- node.name = config.svgDict[node.name] || node.name;
713
- for (const item in node.attrs) {
714
- if (config.svgDict[item]) {
715
- node.attrs[config.svgDict[item]] = node.attrs[item];
716
- node.attrs[item] = undefined;
717
- }
718
- }
719
- for (let i = 0; i < (node.children || []).length; i++) {
720
- traversal(node.children[i]);
721
- }
722
- }
723
- })(node);
724
- // #endif
725
- // #ifndef APP-PLUS-NVUE
726
- let src = '';
727
- const style = attrs.style;
728
- attrs.style = '';
729
- attrs.xmlns = 'http://www.w3.org/2000/svg';
730
- (function traversal(node) {
731
- if (node.type === 'text') {
732
- src += node.text;
733
- return;
734
- }
735
- const name = config.svgDict[node.name] || node.name;
736
- if (name === 'foreignObject') {
737
- for (const child of node.children || []) {
738
- if (child.attrs && !child.attrs.xmlns) {
739
- child.attrs.xmlns = 'http://www.w3.org/1999/xhtml';
740
- break;
741
- }
742
- }
743
- }
744
- src += '<' + name;
745
- for (const item in node.attrs) {
746
- const val = node.attrs[item];
747
- if (val) {
748
- src += ` ${config.svgDict[item] || item}="${val.replace(/"/g, '')}"`;
749
- }
750
- }
751
- if (!node.children) {
752
- src += '/>';
753
- } else {
754
- src += '>';
755
- for (let i = 0; i < node.children.length; i++) {
756
- traversal(node.children[i]);
757
- }
758
- src += '</' + name + '>';
759
- }
760
- })(node);
761
- node.name = 'img';
762
- node.attrs = {
763
- src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
764
- style,
765
- ignore: 'T'
766
- };
767
- node.children = undefined;
768
- // #endif
769
- this.xml = false;
770
- config.ignoreTags.style = true;
771
- return;
772
- }
773
-
774
- // #ifndef APP-PLUS-NVUE
775
- // 转换 align 属性
776
- if (attrs.align) {
777
- if (node.name === 'table') {
778
- if (attrs.align === 'center') {
779
- styleObj['margin-inline-start'] = styleObj['margin-inline-end'] = 'auto';
780
- } else {
781
- styleObj.float = attrs.align;
782
- }
783
- } else {
784
- styleObj['text-align'] = attrs.align;
785
- }
786
- attrs.align = undefined;
787
- }
788
-
789
- // 转换 dir 属性
790
- if (attrs.dir) {
791
- styleObj.direction = attrs.dir;
792
- attrs.dir = undefined;
793
- }
794
-
795
- // 转换 font 标签的属性
796
- if (node.name === 'font') {
797
- if (attrs.color) {
798
- styleObj.color = attrs.color;
799
- attrs.color = undefined;
800
- }
801
- if (attrs.face) {
802
- styleObj['font-family'] = attrs.face;
803
- attrs.face = undefined;
804
- }
805
- if (attrs.size) {
806
- let size = parseInt(attrs.size);
807
- if (!isNaN(size)) {
808
- if (size < 1) {
809
- size = 1;
810
- } else if (size > 7) {
811
- size = 7;
812
- }
813
- styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1];
814
- }
815
- attrs.size = undefined;
816
- }
817
- }
818
- // #endif
819
-
820
- // 一些编辑器的自带 class
821
- if ((attrs.class || '').includes('align-center')) {
822
- styleObj['text-align'] = 'center';
823
- }
824
-
825
- Object.assign(styleObj, this.parseStyle(node));
826
-
827
- if (node.name !== 'table' && parseInt(styleObj.width) > windowWidth) {
828
- styleObj['max-width'] = '100%';
829
- styleObj['box-sizing'] = 'border-box';
830
- }
831
-
832
- // #ifndef APP-PLUS-NVUE
833
- if (config.blockTags[node.name]) {
834
- node.name = 'div';
835
- } else if (!config.trustTags[node.name] && !this.xml) {
836
- // 未知标签转为 span,避免无法显示
837
- node.name = 'span';
838
- }
839
-
840
- if (
841
- node.name === 'a' ||
842
- node.name === 'ad' ||
843
- // #ifdef H5 || APP-PLUS
844
- node.name === 'iframe' // eslint-disable-line
845
- // #endif
846
- ) {
847
- this.expose();
848
- } else if (node.name === 'video') {
849
- if ((styleObj.height || '').includes('auto')) {
850
- styleObj.height = undefined;
851
- }
852
- /* #ifdef APP-PLUS */
853
- let str = '<video style="width:100%;height:100%"';
854
- for (const item in attrs) {
855
- if (attrs[item]) {
856
- str += ' ' + item + '="' + attrs[item] + '"';
857
- }
858
- }
859
- if (this.options.pauseVideo) {
860
- str +=
861
- " onplay=\"this.dispatchEvent(new CustomEvent('vplay',{bubbles:!0}));for(var e=document.getElementsByTagName('video'),t=0;t<e.length;t++)e[t]!=this&&e[t].pause()\"";
862
- }
863
- str += '>';
864
- for (let i = 0; i < node.src.length; i++) {
865
- str += '<source src="' + node.src[i] + '">';
866
- }
867
- str += '</video>';
868
- node.html = str;
869
- /* #endif */
870
- } else if ((node.name === 'ul' || node.name === 'ol') && node.c) {
871
- // 列表处理
872
- const types = {
873
- a: 'lower-alpha',
874
- A: 'upper-alpha',
875
- i: 'lower-roman',
876
- I: 'upper-roman'
877
- };
878
- if (types[attrs.type]) {
879
- attrs.style += ';list-style-type:' + types[attrs.type];
880
- attrs.type = undefined;
881
- }
882
- for (let i = children.length; i--; ) {
883
- if (children[i].name === 'li') {
884
- children[i].c = 1;
885
- }
886
- }
887
- } else if (node.name === 'table') {
888
- // 表格处理
889
- // cellpadding、cellspacing、border 这几个常用表格属性需要通过转换实现
890
- let padding = parseFloat(attrs.cellpadding);
891
- let spacing = parseFloat(attrs.cellspacing);
892
- const border = parseFloat(attrs.border);
893
- const bordercolor = styleObj['border-color'];
894
- const borderstyle = styleObj['border-style'];
895
- if (node.c) {
896
- // padding 和 spacing 默认 2
897
- if (isNaN(padding)) {
898
- padding = 2;
899
- }
900
- if (isNaN(spacing)) {
901
- spacing = 2;
902
- }
903
- }
904
- if (border) {
905
- attrs.style += `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}`;
906
- }
907
- if (node.flag && node.c) {
908
- // 有 colspan 或 rowspan 且含有链接的表格通过 grid 布局实现
909
- styleObj.display = 'grid';
910
- if (styleObj['border-collapse'] === 'collapse') {
911
- styleObj['border-collapse'] = undefined;
912
- spacing = 0;
913
- }
914
- if (spacing) {
915
- styleObj['grid-gap'] = spacing + 'px';
916
- styleObj.padding = spacing + 'px';
917
- } else if (border) {
918
- // 无间隔的情况下避免边框重叠
919
- attrs.style += ';border-left:0;border-top:0';
920
- }
921
-
922
- const width = []; // 表格的列宽
923
- const trList = []; // tr 列表
924
- const cells = []; // 保存新的单元格
925
- const map = {}; // 被合并单元格占用的格子
926
-
927
- (function traversal(nodes) {
928
- for (let i = 0; i < nodes.length; i++) {
929
- if (nodes[i].name === 'tr') {
930
- trList.push(nodes[i]);
931
- } else if (nodes[i].name === 'colgroup') {
932
- let colI = 1;
933
- for (const col of nodes[i].children || []) {
934
- if (col.name === 'col') {
935
- const style = col.attrs.style || '';
936
- const start = style.indexOf('width') ? style.indexOf(';width') : 0;
937
- // 提取出宽度
938
- if (start !== -1) {
939
- let end = style.indexOf(';', start + 6);
940
- if (end === -1) {
941
- end = style.length;
942
- }
943
- width[colI] = style.substring(start ? start + 7 : 6, end);
944
- }
945
- colI += 1;
946
- }
947
- }
948
- } else {
949
- traversal(nodes[i].children || []);
950
- }
951
- }
952
- })(children);
953
-
954
- for (let row = 1; row <= trList.length; row++) {
955
- let col = 1;
956
- for (let j = 0; j < trList[row - 1].children.length; j++) {
957
- const td = trList[row - 1].children[j];
958
- if (td.name === 'td' || td.name === 'th') {
959
- // 这个格子被上面的单元格占用,则列号++
960
- while (map[row + '.' + col]) {
961
- col++;
962
- }
963
- let style = td.attrs.style || '';
964
- let start = style.indexOf('width') ? style.indexOf(';width') : 0;
965
- // 提取出 td 的宽度
966
- if (start !== -1) {
967
- let end = style.indexOf(';', start + 6);
968
- if (end === -1) {
969
- end = style.length;
970
- }
971
- if (!td.attrs.colspan) {
972
- width[col] = style.substring(start ? start + 7 : 6, end);
973
- }
974
- style = style.substr(0, start) + style.substr(end);
975
- }
976
- // 设置竖直对齐
977
- style += ';display:flex';
978
- start = style.indexOf('vertical-align');
979
- if (start !== -1) {
980
- const val = style.substr(start + 15, 10);
981
- if (val.includes('middle')) {
982
- style += ';align-items:center';
983
- } else if (val.includes('bottom')) {
984
- style += ';align-items:flex-end';
985
- }
986
- } else {
987
- style += ';align-items:center';
988
- }
989
- // 设置水平对齐
990
- start = style.indexOf('text-align');
991
- if (start !== -1) {
992
- const val = style.substr(start + 11, 10);
993
- if (val.includes('center')) {
994
- style += ';justify-content: center';
995
- } else if (val.includes('right')) {
996
- style += ';justify-content: right';
997
- }
998
- }
999
- style =
1000
- (border
1001
- ? `;border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'}` +
1002
- (spacing ? '' : ';border-right:0;border-bottom:0')
1003
- : '') +
1004
- (padding ? `;padding:${padding}px` : '') +
1005
- ';' +
1006
- style;
1007
- // 处理列合并
1008
- if (td.attrs.colspan) {
1009
- style += `;grid-column-start:${col};grid-column-end:${col + parseInt(td.attrs.colspan)}`;
1010
- if (!td.attrs.rowspan) {
1011
- style += `;grid-row-start:${row};grid-row-end:${row + 1}`;
1012
- }
1013
- col += parseInt(td.attrs.colspan) - 1;
1014
- }
1015
- // 处理行合并
1016
- if (td.attrs.rowspan) {
1017
- style += `;grid-row-start:${row};grid-row-end:${row + parseInt(td.attrs.rowspan)}`;
1018
- if (!td.attrs.colspan) {
1019
- style += `;grid-column-start:${col};grid-column-end:${col + 1}`;
1020
- }
1021
- // 记录下方单元格被占用
1022
- for (let rowspan = 1; rowspan < td.attrs.rowspan; rowspan++) {
1023
- for (let colspan = 0; colspan < (td.attrs.colspan || 1); colspan++) {
1024
- map[row + rowspan + '.' + (col - colspan)] = 1;
1025
- }
1026
- }
1027
- }
1028
- if (style) {
1029
- td.attrs.style = style;
1030
- }
1031
- cells.push(td);
1032
- col++;
1033
- }
1034
- }
1035
- if (row === 1) {
1036
- let temp = '';
1037
- for (let i = 1; i < col; i++) {
1038
- temp += (width[i] ? width[i] : 'auto') + ' ';
1039
- }
1040
- styleObj['grid-template-columns'] = temp;
1041
- }
1042
- }
1043
- node.children = cells;
1044
- } else {
1045
- // 没有使用合并单元格的表格通过 table 布局实现
1046
- if (node.c) {
1047
- styleObj.display = 'table';
1048
- }
1049
- if (!isNaN(spacing)) {
1050
- styleObj['border-spacing'] = spacing + 'px';
1051
- }
1052
- if (border || padding) {
1053
- // 遍历
1054
- (function traversal(nodes) {
1055
- for (let i = 0; i < nodes.length; i++) {
1056
- const td = nodes[i];
1057
- if (td.name === 'th' || td.name === 'td') {
1058
- if (border) {
1059
- td.attrs.style = `border:${border}px ${borderstyle || 'solid'} ${bordercolor || 'gray'};${td.attrs.style || ''}`;
1060
- }
1061
- if (padding) {
1062
- td.attrs.style = `padding:${padding}px;${td.attrs.style || ''}`;
1063
- }
1064
- } else if (td.children) {
1065
- traversal(td.children);
1066
- }
1067
- }
1068
- })(children);
1069
- }
1070
- }
1071
- // 给表格添加一个单独的横向滚动层
1072
- if (this.options.scrollTable && !(attrs.style || '').includes('inline')) {
1073
- const table = Object.assign({}, node);
1074
- node.name = 'div';
1075
- node.attrs = {
1076
- style: 'overflow:auto'
1077
- };
1078
- node.children = [table];
1079
- attrs = table.attrs;
1080
- }
1081
- } else if ((node.name === 'tbody' || node.name === 'tr') && node.flag && node.c) {
1082
- node.flag = undefined;
1083
- (function traversal(nodes) {
1084
- for (let i = 0; i < nodes.length; i++) {
1085
- if (nodes[i].name === 'td') {
1086
- // 颜色样式设置给单元格避免丢失
1087
- for (const style of ['color', 'background', 'background-color']) {
1088
- if (styleObj[style]) {
1089
- nodes[i].attrs.style = style + ':' + styleObj[style] + ';' + (nodes[i].attrs.style || '');
1090
- }
1091
- }
1092
- } else {
1093
- traversal(nodes[i].children || []);
1094
- }
1095
- }
1096
- })(children);
1097
- } else if ((node.name === 'td' || node.name === 'th') && (attrs.colspan || attrs.rowspan)) {
1098
- for (let i = this.stack.length; i--; ) {
1099
- if (this.stack[i].name === 'table' || this.stack[i].name === 'tbody' || this.stack[i].name === 'tr') {
1100
- this.stack[i].flag = 1; // 指示含有合并单元格
1101
- // break;
1102
- }
1103
- }
1104
- } else if (node.name === 'ruby') {
1105
- // 转换 ruby
1106
- node.name = 'span';
1107
- for (let i = 0; i < children.length - 1; i++) {
1108
- if (children[i].type === 'text' && children[i + 1].name === 'rt') {
1109
- children[i] = {
1110
- name: 'div',
1111
- attrs: {
1112
- style: 'display:inline-block;text-align:center'
1113
- },
1114
- children: [
1115
- {
1116
- name: 'div',
1117
- attrs: {
1118
- style: 'font-size:50%;' + (children[i + 1].attrs.style || '')
1119
- },
1120
- children: children[i + 1].children
1121
- },
1122
- children[i]
1123
- ]
1124
- };
1125
- children.splice(i + 1, 1);
1126
- }
1127
- }
1128
- } else if (node.c) {
1129
- (function traversal(node) {
1130
- node.c = 2;
1131
- for (let i = node.children.length; i--; ) {
1132
- const child = node.children[i];
1133
- // #ifdef (MP-WEIXIN || MP-QQ || APP-PLUS || MP-360) && VUE3
1134
- if (
1135
- child.name &&
1136
- (config.inlineTags[child.name] || ((child.attrs.style || '').includes('inline') && child.children)) &&
1137
- !child.c
1138
- ) {
1139
- traversal(child);
1140
- }
1141
- // #endif
1142
- if (!child.c || child.name === 'table') {
1143
- node.c = 1;
1144
- }
1145
- }
1146
- })(node);
1147
- }
1148
-
1149
- if ((styleObj.display || '').includes('flex') && !node.c) {
1150
- for (let i = children.length; i--; ) {
1151
- const item = children[i];
1152
- if (item.f) {
1153
- item.attrs.style = (item.attrs.style || '') + item.f;
1154
- item.f = undefined;
1155
- }
1156
- }
1157
- }
1158
- // flex 布局时部分样式需要提取到 rich-text 外层
1159
- const flex =
1160
- parent &&
1161
- ((parent.attrs.style || '').includes('flex') || (parent.attrs.style || '').includes('grid')) &&
1162
- // #ifdef MP-WEIXIN
1163
- // 检查基础库版本 virtualHost 是否可用
1164
- !(node.c && wx.getNFCAdapter) && // eslint-disable-line
1165
- // #endif
1166
- // #ifndef MP-WEIXIN || MP-QQ || MP-BAIDU || MP-TOUTIAO
1167
- !node.c; // eslint-disable-line
1168
- // #endif
1169
- if (flex) {
1170
- node.f = ';max-width:100%';
1171
- }
1172
-
1173
- if (children.length >= 50 && node.c && !(styleObj.display || '').includes('flex')) {
1174
- mergeNodes(children);
1175
- }
1176
- // #endif
1177
-
1178
- for (const key in styleObj) {
1179
- if (styleObj[key]) {
1180
- const val = `;${key}:${styleObj[key].replace(' !important', '')}`;
1181
- /* #ifndef APP-PLUS-NVUE */
1182
- if (
1183
- flex &&
1184
- ((key.includes('flex') && key !== 'flex-direction') ||
1185
- key === 'align-self' ||
1186
- key.includes('grid') ||
1187
- styleObj[key][0] === '-' ||
1188
- (key.includes('width') && val.includes('%')))
1189
- ) {
1190
- node.f += val;
1191
- if (key === 'width') {
1192
- attrs.style += ';width:100%';
1193
- }
1194
- } else /* #endif */ {
1195
- attrs.style += val;
1196
- }
1197
- }
1198
- }
1199
- attrs.style = attrs.style.substr(1) || undefined;
1200
- // #ifdef (MP-WEIXIN || MP-QQ) && VUE3
1201
- for (const key in attrs) {
1202
- if (!attrs[key]) {
1203
- delete attrs[key];
1204
- }
1205
- }
1206
- // #endif
1207
- };
1208
-
1209
- /**
1210
- * @description 解析到文本
1211
- * @param {String} text 文本内容
1212
- */
1213
- Parser.prototype.onText = function (text) {
1214
- if (!this.pre) {
1215
- // 合并空白符
1216
- let trim = '';
1217
- let flag;
1218
- for (let i = 0, len = text.length; i < len; i++) {
1219
- if (!blankChar[text[i]]) {
1220
- trim += text[i];
1221
- } else {
1222
- if (trim[trim.length - 1] !== ' ') {
1223
- trim += ' ';
1224
- }
1225
- if (text[i] === '\n' && !flag) {
1226
- flag = true;
1227
- }
1228
- }
1229
- }
1230
- // 去除含有换行符的空串
1231
- if (trim === ' ') {
1232
- if (flag) return;
1233
- // #ifdef VUE3
1234
- else {
1235
- const parent = this.stack[this.stack.length - 1];
1236
- if (parent && parent.name[0] === 't') return;
1237
- }
1238
- // #endif
1239
- }
1240
- text = trim;
1241
- }
1242
- const node = Object.create(null);
1243
- node.type = 'text';
1244
- // #ifdef (MP-BAIDU || MP-ALIPAY || MP-TOUTIAO) && VUE3
1245
- node.attrs = {};
1246
- // #endif
1247
- node.text = decodeEntity(text);
1248
- if (this.hook(node)) {
1249
- // #ifdef MP-WEIXIN
1250
- if (this.options.selectable === 'force' && system.includes('iOS') && !uni.canIUse('rich-text.user-select')) {
1251
- this.expose();
1252
- }
1253
- // #endif
1254
- const siblings = this.stack.length ? this.stack[this.stack.length - 1].children : this.nodes;
1255
- siblings.push(node);
1256
- }
1257
- };
1258
-
1259
- /**
1260
- * @description html 词法分析器
1261
- * @param {Object} handler 高层处理器
1262
- */
1263
- function Lexer(handler) {
1264
- this.handler = handler;
1265
- }
1266
-
1267
- /**
1268
- * @description 执行解析
1269
- * @param {String} content 要解析的文本
1270
- */
1271
- Lexer.prototype.parse = function (content) {
1272
- this.content = content || '';
1273
- this.i = 0; // 标记解析位置
1274
- this.start = 0; // 标记一个单词的开始位置
1275
- this.state = this.text; // 当前状态
1276
- for (let len = this.content.length; this.i !== -1 && this.i < len; ) {
1277
- this.state();
1278
- }
1279
- };
1280
-
1281
- /**
1282
- * @description 检查标签是否闭合
1283
- * @param {String} method 如果闭合要进行的操作
1284
- * @returns {Boolean} 是否闭合
1285
- * @private
1286
- */
1287
- Lexer.prototype.checkClose = function (method) {
1288
- const selfClose = this.content[this.i] === '/';
1289
- if (this.content[this.i] === '>' || (selfClose && this.content[this.i + 1] === '>')) {
1290
- if (method) {
1291
- this.handler[method](this.content.substring(this.start, this.i));
1292
- }
1293
- this.i += selfClose ? 2 : 1;
1294
- this.start = this.i;
1295
- this.handler.onOpenTag(selfClose);
1296
- if (this.handler.tagName === 'script') {
1297
- this.i = this.content.indexOf('</', this.i);
1298
- if (this.i !== -1) {
1299
- this.i += 2;
1300
- this.start = this.i;
1301
- }
1302
- this.state = this.endTag;
1303
- } else {
1304
- this.state = this.text;
1305
- }
1306
- return true;
1307
- }
1308
- return false;
1309
- };
1310
-
1311
- /**
1312
- * @description 文本状态
1313
- * @private
1314
- */
1315
- Lexer.prototype.text = function () {
1316
- this.i = this.content.indexOf('<', this.i); // 查找最近的标签
1317
- if (this.i === -1) {
1318
- // 没有标签了
1319
- if (this.start < this.content.length) {
1320
- this.handler.onText(this.content.substring(this.start, this.content.length));
1321
- }
1322
- return;
1323
- }
1324
- const c = this.content[this.i + 1];
1325
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
1326
- // 标签开头
1327
- if (this.start !== this.i) {
1328
- this.handler.onText(this.content.substring(this.start, this.i));
1329
- }
1330
- this.start = ++this.i;
1331
- this.state = this.tagName;
1332
- } else if (c === '/' || c === '!' || c === '?') {
1333
- if (this.start !== this.i) {
1334
- this.handler.onText(this.content.substring(this.start, this.i));
1335
- }
1336
- const next = this.content[this.i + 2];
1337
- if (c === '/' && ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z'))) {
1338
- // 标签结尾
1339
- this.i += 2;
1340
- this.start = this.i;
1341
- this.state = this.endTag;
1342
- return;
1343
- }
1344
- // 处理注释
1345
- let end = '-->';
1346
- if (c !== '!' || this.content[this.i + 2] !== '-' || this.content[this.i + 3] !== '-') {
1347
- end = '>';
1348
- }
1349
- this.i = this.content.indexOf(end, this.i);
1350
- if (this.i !== -1) {
1351
- this.i += end.length;
1352
- this.start = this.i;
1353
- }
1354
- } else {
1355
- this.i++;
1356
- }
1357
- };
1358
-
1359
- /**
1360
- * @description 标签名状态
1361
- * @private
1362
- */
1363
- Lexer.prototype.tagName = function () {
1364
- if (blankChar[this.content[this.i]]) {
1365
- // 解析到标签名
1366
- this.handler.onTagName(this.content.substring(this.start, this.i));
1367
- while (blankChar[this.content[++this.i]]);
1368
- if (this.i < this.content.length && !this.checkClose()) {
1369
- this.start = this.i;
1370
- this.state = this.attrName;
1371
- }
1372
- } else if (!this.checkClose('onTagName')) {
1373
- this.i++;
1374
- }
1375
- };
1376
-
1377
- /**
1378
- * @description 属性名状态
1379
- * @private
1380
- */
1381
- Lexer.prototype.attrName = function () {
1382
- let c = this.content[this.i];
1383
- if (blankChar[c] || c === '=') {
1384
- // 解析到属性名
1385
- this.handler.onAttrName(this.content.substring(this.start, this.i));
1386
- let needVal = c === '=';
1387
- const len = this.content.length;
1388
- while (++this.i < len) {
1389
- c = this.content[this.i];
1390
- if (!blankChar[c]) {
1391
- if (this.checkClose()) return;
1392
- if (needVal) {
1393
- // 等号后遇到第一个非空字符
1394
- this.start = this.i;
1395
- this.state = this.attrVal;
1396
- return;
1397
- }
1398
- if (this.content[this.i] === '=') {
1399
- needVal = true;
1400
- } else {
1401
- this.start = this.i;
1402
- this.state = this.attrName;
1403
- return;
1404
- }
1405
- }
1406
- }
1407
- } else if (!this.checkClose('onAttrName')) {
1408
- this.i++;
1409
- }
1410
- };
1411
-
1412
- /**
1413
- * @description 属性值状态
1414
- * @private
1415
- */
1416
- Lexer.prototype.attrVal = function () {
1417
- const c = this.content[this.i];
1418
- const len = this.content.length;
1419
- if (c === '"' || c === "'") {
1420
- // 有冒号的属性
1421
- this.start = ++this.i;
1422
- this.i = this.content.indexOf(c, this.i);
1423
- if (this.i === -1) return;
1424
- this.handler.onAttrVal(this.content.substring(this.start, this.i));
1425
- } else {
1426
- // 没有冒号的属性
1427
- for (; this.i < len; this.i++) {
1428
- if (blankChar[this.content[this.i]]) {
1429
- this.handler.onAttrVal(this.content.substring(this.start, this.i));
1430
- break;
1431
- } else if (this.checkClose('onAttrVal')) return;
1432
- }
1433
- }
1434
- while (blankChar[this.content[++this.i]]);
1435
- if (this.i < len && !this.checkClose()) {
1436
- this.start = this.i;
1437
- this.state = this.attrName;
1438
- }
1439
- };
1440
-
1441
- /**
1442
- * @description 结束标签状态
1443
- * @returns {String} 结束的标签名
1444
- * @private
1445
- */
1446
- Lexer.prototype.endTag = function () {
1447
- const c = this.content[this.i];
1448
- if (blankChar[c] || c === '>' || c === '/') {
1449
- this.handler.onCloseTag(this.content.substring(this.start, this.i));
1450
- if (c !== '>') {
1451
- this.i = this.content.indexOf('>', this.i);
1452
- if (this.i === -1) return;
1453
- }
1454
- this.start = ++this.i;
1455
- this.state = this.text;
1456
- } else {
1457
- this.i++;
1458
- }
1459
- };
1460
-
1461
- export default Parser;