@kyfe/ks-query-table 0.0.21 → 0.0.22

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 (310) hide show
  1. package/.bitmap +38 -0
  2. package/.editorconfig +5 -0
  3. package/.env.dev +2 -0
  4. package/.env.gray +2 -0
  5. package/.env.prod +2 -0
  6. package/.env.stg +3 -0
  7. package/.env.uat +2 -0
  8. package/.eslintignore +1 -0
  9. package/.eslintrc.js +25 -0
  10. package/.gitmodules +4 -0
  11. package/.prettierrc +11 -0
  12. package/README.md +15 -0
  13. package/babel.config.js +10 -0
  14. package/build-apm.sh +9 -0
  15. package/build.sh +16 -0
  16. package/config/index.js +20 -0
  17. package/jsconfig.json +7 -0
  18. package/kuasheng-sdk/index.js +80 -0
  19. package/kuasheng-sdk/lib/assets.js +304 -0
  20. package/kuasheng-sdk/lib/context.js +199 -0
  21. package/kuasheng-sdk/lib/layout.js +346 -0
  22. package/kuasheng-sdk/lib/location.js +46 -0
  23. package/kuasheng-sdk/lib/media.js +342 -0
  24. package/kuasheng-sdk/lib/navigation.js +30 -0
  25. package/kuasheng-sdk/lib/request.js +76 -0
  26. package/kuasheng-sdk/lib/system.js +190 -0
  27. package/kuasheng-sdk/lib/userinfo.js +98 -0
  28. package/kuasheng-sdk/util/check.js +102 -0
  29. package/kuasheng-sdk/util/config.js +47 -0
  30. package/kuasheng-sdk/util/device.js +25 -0
  31. package/kuasheng-sdk/util/error.js +19 -0
  32. package/kuasheng-sdk/util/funtional.js +153 -0
  33. package/kuasheng-sdk/util/mixin.js +36 -0
  34. package/kuasheng-sdk/util/requestUtil.js +41 -0
  35. package/kuasheng-sdk/util/response.js +33 -0
  36. package/kuasheng-sdk/util/warn.js +35 -0
  37. package/kuasheng-ui/CHANGELOG.md +9 -0
  38. package/kuasheng-ui/components/card.vue +57 -0
  39. package/kuasheng-ui/components/ks-area-select/README.md +43 -0
  40. package/kuasheng-ui/components/ks-area-select/area-picker.vue +554 -0
  41. package/kuasheng-ui/components/ks-area-select/area-search.vue +363 -0
  42. package/kuasheng-ui/components/ks-area-select/areas-pop.vue +56 -0
  43. package/kuasheng-ui/components/ks-area-select/common.js +183 -0
  44. package/kuasheng-ui/components/ks-area-select/index.vue +355 -0
  45. package/kuasheng-ui/components/ks-area-select/mixins.js +216 -0
  46. package/kuasheng-ui/components/ks-area-single-select/README.md +50 -0
  47. package/kuasheng-ui/components/ks-area-single-select/hot-city.js +45 -0
  48. package/kuasheng-ui/components/ks-area-single-select/index.vue +324 -0
  49. package/kuasheng-ui/components/ks-calendar/index.vue +269 -0
  50. package/kuasheng-ui/components/ks-call-phone/call-tips.vue +70 -0
  51. package/kuasheng-ui/components/ks-call-phone/call.vue +178 -0
  52. package/kuasheng-ui/components/ks-call-phone/index.js +48 -0
  53. package/kuasheng-ui/components/ks-call-phone/index.vue +131 -0
  54. package/kuasheng-ui/components/ks-call-phone//345/221/274/345/217/253/347/273/204/344/273/266.md +0 -0
  55. package/kuasheng-ui/components/ks-date-picker/README.md +23 -0
  56. package/kuasheng-ui/components/ks-date-picker/date-picker-bottom.vue +123 -0
  57. package/kuasheng-ui/components/ks-date-picker/date-picker-dropdown.vue +80 -0
  58. package/kuasheng-ui/components/ks-date-picker/date-picker-right.vue +87 -0
  59. package/kuasheng-ui/components/ks-date-picker/date-picker-top.vue +88 -0
  60. package/kuasheng-ui/components/ks-date-picker/date-picker.js +15 -0
  61. package/kuasheng-ui/components/ks-date-picker/date-range-select.vue +92 -0
  62. package/kuasheng-ui/components/ks-date-picker/date-select.vue +65 -0
  63. package/kuasheng-ui/components/ks-date-picker/date-week-month.vue +131 -0
  64. package/kuasheng-ui/components/ks-date-picker/index.js +12 -0
  65. package/kuasheng-ui/components/ks-date-picker/mixin.js +92 -0
  66. package/kuasheng-ui/components/ks-date-picker/month-range-select.vue +129 -0
  67. package/kuasheng-ui/components/ks-date-picker/month-select.vue +85 -0
  68. package/kuasheng-ui/components/ks-date-picker/quarter-select.vue +94 -0
  69. package/kuasheng-ui/components/ks-date-picker/style.less +121 -0
  70. package/kuasheng-ui/components/ks-date-picker/utils.js +109 -0
  71. package/kuasheng-ui/components/ks-date-picker/week-select.vue +99 -0
  72. package/kuasheng-ui/components/ks-decrypt/index.vue +159 -0
  73. package/kuasheng-ui/components/ks-employee/README.md +78 -0
  74. package/kuasheng-ui/components/ks-employee/employee-input.vue +173 -0
  75. package/kuasheng-ui/components/ks-employee/employee-list.vue +662 -0
  76. package/kuasheng-ui/components/ks-employee/employee-popup.vue +197 -0
  77. package/kuasheng-ui/components/ks-employee/employee-search.vue +250 -0
  78. package/kuasheng-ui/components/ks-employee/employee-selected.vue +173 -0
  79. package/kuasheng-ui/components/ks-employee/index.js +17 -0
  80. package/kuasheng-ui/components/ks-employee/package-lock.json +5 -0
  81. package/kuasheng-ui/components/ks-employee/package.json +15 -0
  82. package/kuasheng-ui/components/ks-employee/yarn.lock +4 -0
  83. package/kuasheng-ui/components/ks-field-money/index.js +8 -0
  84. package/kuasheng-ui/components/ks-field-money/index.vue +212 -0
  85. package/kuasheng-ui/components/ks-field-money/package.json +11 -0
  86. package/kuasheng-ui/components/ks-field-money/utils.js +65 -0
  87. package/kuasheng-ui/components/ks-field-money//351/207/221/351/242/235/350/275/254/346/215/242/345/231/250.md +0 -0
  88. package/kuasheng-ui/components/ks-history-search/history-input.vue +131 -0
  89. package/kuasheng-ui/components/ks-history-search/history-list.vue +188 -0
  90. package/kuasheng-ui/components/ks-history-search/img/delete.png +0 -0
  91. package/kuasheng-ui/components/ks-history-search/index.js +9 -0
  92. package/kuasheng-ui/components/ks-history-search/index.vue +125 -0
  93. package/kuasheng-ui/components/ks-history-search/package-lock.json +5 -0
  94. package/kuasheng-ui/components/ks-history-search/package.json +15 -0
  95. package/kuasheng-ui/components/ks-history-search/utils.js +35 -0
  96. package/kuasheng-ui/components/ks-input-search/index.vue +106 -0
  97. package/kuasheng-ui/components/ks-list/index.vue +75 -0
  98. package/kuasheng-ui/components/ks-loading/index.js +16 -0
  99. package/kuasheng-ui/components/ks-month/index.vue +47 -0
  100. package/kuasheng-ui/components/ks-month/package.json +3 -0
  101. package/kuasheng-ui/components/ks-month/range.vue +172 -0
  102. package/kuasheng-ui/components/ks-month/single.vue +136 -0
  103. package/kuasheng-ui/components/ks-month/style.less +125 -0
  104. package/kuasheng-ui/components/ks-month/utils.js +35 -0
  105. package/kuasheng-ui/components/ks-nav/index.vue +264 -0
  106. package/kuasheng-ui/components/ks-nav-bar.js +35 -0
  107. package/kuasheng-ui/components/ks-org/ks-org-tree.vue +247 -0
  108. package/kuasheng-ui/components/ks-org/ks-popup-tree.vue +154 -0
  109. package/kuasheng-ui/components/ks-org/ks-tree-input.vue +240 -0
  110. package/kuasheng-ui/components/ks-org/ks-tree-node.vue +94 -0
  111. package/kuasheng-ui/components/ks-org/ks-tree.vue +229 -0
  112. package/kuasheng-ui/components/ks-org/utils.js +54 -0
  113. package/kuasheng-ui/components/ks-popover/index.vue +457 -0
  114. package/kuasheng-ui/components/ks-popover/mixin.js +28 -0
  115. package/kuasheng-ui/components/ks-popover/utils.js +60 -0
  116. package/kuasheng-ui/components/ks-pull-refresh/index.vue +43 -0
  117. package/kuasheng-ui/components/ks-quarter/index.vue +256 -0
  118. package/kuasheng-ui/components/ks-table/README.md +103 -0
  119. package/kuasheng-ui/components/ks-table/cell.vue +31 -0
  120. package/kuasheng-ui/components/ks-table/index.js +8 -0
  121. package/kuasheng-ui/components/ks-table/index.less +486 -0
  122. package/kuasheng-ui/components/ks-table/index.vue +1088 -0
  123. package/kuasheng-ui/components/ks-table/package.json +12 -0
  124. package/kuasheng-ui/components/ks-table/release.md +7 -0
  125. package/kuasheng-ui/components/ks-toast.js +35 -0
  126. package/kuasheng-ui/components/ks-upload/index.vue +174 -0
  127. package/kuasheng-ui/components/ks-user-access.vue +229 -0
  128. package/kuasheng-ui/components/no-data/README.md +45 -0
  129. package/kuasheng-ui/components/no-data/image.js +1 -0
  130. package/kuasheng-ui/components/no-data/index.vue +83 -0
  131. package/kuasheng-ui/components/notice-bar.vue +16 -0
  132. package/kuasheng-ui/components/steps.js +11 -0
  133. package/kuasheng-ui/components/tabs.vue +40 -0
  134. package/kuasheng-ui/index.js +239 -0
  135. package/kuasheng-ui/patch/datetime-picker/datetimePicker.md +0 -0
  136. package/kuasheng-ui/patch/datetime-picker/index.js +46 -0
  137. package/kuasheng-ui/patch/datetime-picker/utils.js +78 -0
  138. package/kuasheng-ui/patch/field/field.md +1 -0
  139. package/kuasheng-ui/patch/field/index.js +122 -0
  140. package/kuasheng-ui/patch/field/utils.js +36 -0
  141. package/kuasheng-ui/patch/form/form.md +7 -0
  142. package/kuasheng-ui/patch/form/index.js +106 -0
  143. package/kuasheng-ui/patch/index.js +12 -0
  144. package/kuasheng-ui/patch/pagination/index.js +78 -0
  145. package/kuasheng-ui/style/animation-ui.less +31 -0
  146. package/kuasheng-ui/style/font/number/font-number1.otf +0 -0
  147. package/kuasheng-ui/style/font/number/font-number2.ttf +0 -0
  148. package/kuasheng-ui/style/images/checked.svg +1 -0
  149. package/kuasheng-ui/style/images/success.svg +1 -0
  150. package/kuasheng-ui/style/index.less +6 -0
  151. package/kuasheng-ui/style/kuasheng-ui.less +207 -0
  152. package/kuasheng-ui/style/reset-vant.less +307 -0
  153. package/kuasheng-ui/style/vant-var.less +138 -0
  154. package/kuasheng-ui/utils/apis.js +17 -0
  155. package/kuasheng-ui/utils/axios-adapter.js +47 -0
  156. package/kuasheng-ui/utils/bem.js +39 -0
  157. package/kuasheng-ui/utils/bus.js +97 -0
  158. package/kuasheng-ui/utils/common.js +88 -0
  159. package/kuasheng-ui/utils/decrypt/config.js +12 -0
  160. package/kuasheng-ui/utils/decrypt/decrypt-api.js +139 -0
  161. package/kuasheng-ui/utils/decrypt/index.js +6 -0
  162. package/kuasheng-ui/utils/decrypt/mask.js +36 -0
  163. package/kuasheng-ui/utils/decrypt/virtual.js +44 -0
  164. package/kuasheng-ui/utils/directive.js +57 -0
  165. package/kuasheng-ui/utils/directive.md +23 -0
  166. package/kuasheng-ui/utils/drcheck-plugin.js +219 -0
  167. package/kuasheng-ui/utils/error-plugin.js +88 -0
  168. package/kuasheng-ui/utils/filter.js +149 -0
  169. package/kuasheng-ui/utils/http-interceptors.js +18 -0
  170. package/kuasheng-ui/utils/http.js +140 -0
  171. package/kuasheng-ui/utils/index.js +5 -0
  172. package/kuasheng-ui/utils/init-event.js +20 -0
  173. package/kuasheng-ui/utils/log.js +309 -0
  174. package/kuasheng-ui/utils/token.js +9 -0
  175. package/kuasheng-ui/utils/type.js +45 -0
  176. package/kuasheng-ui/utils/validate.js +20 -0
  177. package/kuasheng-ui/utils/watermark.js +67 -0
  178. package/kuasheng-ui/version.js +1 -0
  179. package/ky-apm/client.js +37 -0
  180. package/ky-apm/customHttp.js +38 -0
  181. package/ky-apm/index.js +68 -0
  182. package/ky-apm/plugins/performance.js +84 -0
  183. package/ky-apm/plugins/self-error.js +26 -0
  184. package/ky-apm/warn-log.js +3 -0
  185. package/package.json +81 -10
  186. package/plugin/ks-chii-webpack-html/index.js +53 -0
  187. package/plugin/ks-chii-webpack-html/package.json +16 -0
  188. package/postcss.config.js +15 -0
  189. package/public/capsule-positon.js +50 -0
  190. package/public/fonts/DingTalkJinBuTi.ttf +0 -0
  191. package/public/framework/axios@0.19.0.min.js +9 -0
  192. package/public/framework/fastclick@1.0.6.min.js +1 -0
  193. package/public/framework/iconfont/iconfont.css +91 -0
  194. package/public/framework/iconfont/iconfont.js +1 -0
  195. package/public/framework/iconfont/iconfont.json +142 -0
  196. package/public/framework/iconfont/iconfont.ttf +0 -0
  197. package/public/framework/iconfont/iconfont.woff +0 -0
  198. package/public/framework/iconfont/iconfont.woff2 +0 -0
  199. package/public/framework/vant@2.5.6.min.js +7 -0
  200. package/public/framework/vue-router@3.1.3.min.js +6 -0
  201. package/public/framework/vue@2.6.10.runtime.min.js +6 -0
  202. package/public/framework/vuex@3.1.1.min.js +6 -0
  203. package/public/index.html +260 -0
  204. package/public/ks@3.0.8.umd.min.js +1 -0
  205. package/public/ksui@4.0.27.umd.min.js +10 -0
  206. package/public/status-bar-preset.js +39 -0
  207. package/{index.js → qt-npm/index.js} +3 -3
  208. package/qt-npm/package.json +13 -0
  209. package/src/App.vue +204 -0
  210. package/src/README.md +15 -0
  211. package/src/common/README.md +94 -0
  212. package/src/common/http/axios-adapter.js +47 -0
  213. package/src/common/http/common.js +88 -0
  214. package/src/common/http/http-interceptors.js +18 -0
  215. package/src/common/http/http-lock.js +45 -0
  216. package/src/common/http/index.js +163 -0
  217. package/src/common/http/token.js +9 -0
  218. package/src/common/styles/font/AlibabaSans102Ver2-Md.ttf +0 -0
  219. package/src/common/styles/font.less +12 -0
  220. package/src/common/styles/variables.less +43 -0
  221. package/src/common/utils/index.js +1 -0
  222. package/src/common/utils/platform/README.md +1 -0
  223. package/src/common/utils/platform/android/.gitkeep +0 -0
  224. package/src/common/utils/platform/core/index.js +24 -0
  225. package/src/common/utils/platform/index.js +164 -0
  226. package/src/common/utils/platform/ios/.gitkeep +0 -0
  227. package/src/common/utils/platform/subscribe/helper.js +38 -0
  228. package/src/common/utils/platform/subscribe/index.js +204 -0
  229. package/src/common/utils/platform/subscribe/table-animation.js +75 -0
  230. package/src/config/index.js +31 -0
  231. package/src/config.js +1 -0
  232. package/src/main.js +73 -0
  233. package/src/router.js +52 -0
  234. package/src/view/home/config.js +101 -0
  235. package/src/view/home/demo1.vue +223 -0
  236. package/src/view/home/demo2.vue +124 -0
  237. package/src/view/home/demo3.vue +51 -0
  238. package/src/view/home/demo4.vue +140 -0
  239. package/src/view/home/index.vue +97 -0
  240. package/src/view/home/query-table/README.md +45 -0
  241. package/src/view/home/query-table/api/index.js +12 -0
  242. package/src/view/home/query-table/assets/horizontal-back.svg +1 -0
  243. package/src/view/home/query-table/components/pe-table/cell.js +181 -0
  244. package/src/view/home/query-table/components/pe-table/collapse.js +334 -0
  245. package/src/view/home/query-table/components/pe-table/empty.vue +48 -0
  246. package/src/view/home/query-table/components/pe-table/header.js +328 -0
  247. package/src/view/home/query-table/components/pe-table/images/abnormal.png +0 -0
  248. package/src/view/home/query-table/components/pe-table/images/empty.png +0 -0
  249. package/src/view/home/query-table/components/pe-table/images/fold.svg +1 -0
  250. package/src/view/home/query-table/components/pe-table/images/sort.svg +1 -0
  251. package/src/view/home/query-table/components/pe-table/images/sorting.svg +1 -0
  252. package/src/view/home/query-table/components/pe-table/images/unfold.svg +1 -0
  253. package/src/view/home/query-table/components/pe-table/index.vue +847 -0
  254. package/src/view/home/query-table/components/pe-table/load-more.js +46 -0
  255. package/src/view/home/query-table/components/pe-table/props/index.js +193 -0
  256. package/src/view/home/query-table/components/pe-table/row.vue +118 -0
  257. package/src/view/home/query-table/components/pe-table/scrollbar.js +424 -0
  258. package/src/view/home/query-table/components/pe-table/stretch-damping.js +112 -0
  259. package/src/view/home/query-table/components/pe-table/style/cell.less +89 -0
  260. package/src/view/home/query-table/components/pe-table/style/empty.less +48 -0
  261. package/src/view/home/query-table/components/pe-table/style/header.less +141 -0
  262. package/src/view/home/query-table/components/pe-table/style/index.less +88 -0
  263. package/src/view/home/query-table/components/pe-table/style/load-more.less +61 -0
  264. package/src/view/home/query-table/components/pe-table/style/row.less +6 -0
  265. package/src/view/home/query-table/components/pe-table/table-loading.vue +120 -0
  266. package/src/view/home/query-table/components/pe-table/table-total.vue +57 -0
  267. package/src/view/home/query-table/components/pe-table/utils/animate.js +80 -0
  268. package/src/view/home/query-table/components/pe-table/utils/columns.js +290 -0
  269. package/src/view/home/query-table/components/pe-table/utils/data.js +12 -0
  270. package/src/view/home/query-table/components/pe-table/utils/fixed.js +69 -0
  271. package/src/view/home/query-table/components/pe-table/utils/formatter.js +327 -0
  272. package/src/view/home/query-table/components/pe-table/utils/render-cells.js +424 -0
  273. package/src/view/home/query-table/components/pe-table/utils/slot.js +28 -0
  274. package/src/view/home/query-table/components/pe-table/utils/tools.js +84 -0
  275. package/src/view/home/query-table/components/pe-table/utils/touch-scroll.js +417 -0
  276. package/src/view/home/query-table/components/query-table/index.vue +497 -0
  277. package/src/view/home/query-table/components/query-table/mixins/column-mixin.js +102 -0
  278. package/src/view/home/query-table/components/query-table/mixins/column-setting.js +143 -0
  279. package/src/view/home/query-table/components/query-table/mixins/data-mixin.js +519 -0
  280. package/src/view/home/query-table/components/query-table/mixins/pagination-mixin.js +26 -0
  281. package/src/view/home/query-table/components/query-table/mixins/table-fixed.js +130 -0
  282. package/src/view/home/query-table/components/query-table/mixins/table-horizontal.js +119 -0
  283. package/src/view/home/query-table/components/table-horizontal.vue +99 -0
  284. package/src/view/home/query-table/components/table-pagination.vue +32 -0
  285. package/src/view/home/query-table/components/table-settings/assets/arrpw-up.svg +1 -0
  286. package/src/view/home/query-table/components/table-settings/assets/disabled-down.svg +1 -0
  287. package/src/view/home/query-table/components/table-settings/assets/disabled-up.svg +1 -0
  288. package/src/view/home/query-table/components/table-settings/assets/down.svg +1 -0
  289. package/src/view/home/query-table/components/table-settings/assets/up.svg +1 -0
  290. package/src/view/home/query-table/components/table-settings/index.less +294 -0
  291. package/src/view/home/query-table/components/table-settings/index.vue +260 -0
  292. package/src/view/home/query-table/components/table-settings/settings.vue +479 -0
  293. package/src/view/home/query-table/components/table-settings/test.js +626 -0
  294. package/src/view/home/query-table/components/table-settings//344/270/252/346/200/247/350/256/276/347/275/256.md +0 -0
  295. package/src/view/home/query-table/components/tooltip.js +124 -0
  296. package/src/view/home/query-table/hooks/use-cache-promise.js +27 -0
  297. package/src/view/home/query-table/hooks/use-column-config.js +190 -0
  298. package/src/view/home/query-table/hooks/use-encryption.js +0 -0
  299. package/src/view/home/query-table/hooks/use-generic-search.js +95 -0
  300. package/src/view/home/query-table/index.js +7 -0
  301. package/src/view/home/query-table/store/column-store.js +0 -0
  302. package/src/view/home/query-table/styles/table.less +24 -0
  303. package/src/view/home/query-table/utils/column.js +36 -0
  304. package/src/view/home/query-table/utils/config.js +12 -0
  305. package/src/view/home/query-table/utils/encryption.js +32 -0
  306. package/src/view/home/query-table/utils/http.js +1 -0
  307. package/src/view/home/query-table/utils/localStorage.js +35 -0
  308. package/src/view/home//351/246/226/351/241/265.md +0 -0
  309. package/src/web.js +99 -0
  310. package/vue.config.js +131 -0
@@ -0,0 +1,290 @@
1
+ /** @format */
2
+
3
+ import cloneDeep from 'lodash/cloneDeep'
4
+ import { createFixedColumnsOnLeft, updateColumnsIndexWidth } from './fixed'
5
+ const key = 'key'
6
+
7
+ function getAllChildKeys(children, acc) {
8
+ const keys = new Set()
9
+
10
+ for (const child of children) {
11
+ const childKey = child[key]
12
+ keys.add(childKey)
13
+ getAllChildKeys(child.children || [], [...acc, childKey]).forEach(
14
+ (subKey) => {
15
+ keys.add(subKey)
16
+ }
17
+ )
18
+ }
19
+
20
+ return Array.from(keys)
21
+ }
22
+
23
+ export function createVisibleFlatColumns({
24
+ columns,
25
+ rowCellRender,
26
+ headerCellRender
27
+ }) {
28
+ const stack = cloneDeep(columns)
29
+
30
+ const visibleFlatColumns = []
31
+ const collapsedMap_ = new Map()
32
+ const colsMap = {}
33
+ while (stack.length) {
34
+ const current = stack.shift()
35
+ const currentKey = current[key]
36
+ const {
37
+ children = [],
38
+ fixed,
39
+ width,
40
+ parentNodeKeys = [],
41
+ childKeys = [],
42
+ // parentNodeKey,
43
+ resizable = true,
44
+ minWidth,
45
+ ...reset
46
+ } = current
47
+ const { level = 1, collapsed = false, collapseKeys = [] } = reset
48
+ if (collapseKeys.length) {
49
+ for (const k of collapseKeys) {
50
+ collapsedMap_.set(k, collapsed)
51
+ }
52
+ }
53
+ const hasChildren = !!children.length
54
+ if (hasChildren) {
55
+ // 继承父级的fixed
56
+ const parentNodeKey = currentKey
57
+ stack.unshift(
58
+ ...children.map((child) => ({
59
+ ...child,
60
+ parentNodeKeys: [...parentNodeKeys, parentNodeKey],
61
+ fixed,
62
+ parentNodeKey,
63
+ level: level + 1,
64
+ }))
65
+ )
66
+ }
67
+ const item = {
68
+ ...current,
69
+ width: minWidth || width,
70
+ minWidth,
71
+ parentNodeKeys,
72
+ children,
73
+ level,
74
+ resizable,
75
+ childKeys: getAllChildKeys(children, childKeys),
76
+ rowCellRender: current.rowCellRender || rowCellRender,
77
+ headerCellRender: current.headerCellRender || headerCellRender
78
+ }
79
+ if (item.width) {
80
+ item.width = parseInt(item.width)
81
+ }
82
+ visibleFlatColumns.push(item)
83
+ colsMap[currentKey] = item
84
+ }
85
+ // 子级的折叠状态跟随父级的状态
86
+ collapsedMap_.forEach((value, key) => {
87
+ const { childKeys = [] } = colsMap[key] || {}
88
+ if (childKeys.length) {
89
+ childKeys.forEach((childKey) => {
90
+ if (!collapsedMap_.has(childKey)) {
91
+ collapsedMap_.set(childKey, value)
92
+ }
93
+ })
94
+ }
95
+ })
96
+ const collapsedMap = Object.fromEntries(collapsedMap_.entries())
97
+ return { visibleFlatColumns, collapsedMap }
98
+ }
99
+
100
+ export function logError(err, logConf = '') {
101
+ // eslint-disable-next-line
102
+ if (typeof console !== 'undefined') {
103
+ // eslint-disable-next-line
104
+ console.error('%c【KyeTable2】' + err, logConf)
105
+ } else {
106
+ throw err
107
+ }
108
+ }
109
+
110
+ // 列配置的显示与否根据祖先节点的状态来决定
111
+ function validateColumnShow(acc, col) {
112
+ const { parentNodeKey } = col
113
+ const parentNode = acc[parentNodeKey]
114
+ return parentNode && parentNode.show === false ? false : col.show
115
+ }
116
+
117
+ function computedColumnsWidthInChildKeys(col, columnsKeyMap, collapsedMap) {
118
+ const { width, children = [], childKeys = [] } = col || {}
119
+ if (!children.length && width) {
120
+ return width
121
+ }
122
+ return childKeys.reduce((acc, childKey) => {
123
+ const { children = [], width, show } = columnsKeyMap[childKey] || {}
124
+ // 仅计算未被折叠的宽度和
125
+ if (!children.length && !collapsedMap[childKey] && show) {
126
+ acc += width
127
+ }
128
+ return acc
129
+ }, 0)
130
+ }
131
+
132
+ function createColumnsKeyMap(visibleFlatColumns = []) {
133
+ const columnKeyMap = visibleFlatColumns.reduce((acc, col) => {
134
+ const { key } = col
135
+ const show = validateColumnShow(acc, col)
136
+ acc[key] = {
137
+ ...col,
138
+ show,
139
+ }
140
+ return acc
141
+ }, {})
142
+ return columnKeyMap
143
+ }
144
+
145
+ export function createFlatColumns (params) {
146
+ const addFixedConfInColumns =
147
+ params.columns && params.columns.length > 0 ? createFixedColumnsOnLeft({ showIndex: params.showIndex }) : []
148
+ const { visibleFlatColumns, collapsedMap } = createVisibleFlatColumns({
149
+ ...params,
150
+ columns: [...addFixedConfInColumns, ...params.columns],
151
+ })
152
+ return {
153
+ visibleFlatColumns,
154
+ collapsedMap
155
+ }
156
+ }
157
+
158
+ // 根据筛选的列和 折叠选项生成 多表格列配置
159
+ export function createColumns({visibleFlatColumns, collapsedMap = {}, rowKey, headerRowHeight, curMaxIndexVal}) {
160
+ const columnsKeyMap = createColumnsKeyMap(visibleFlatColumns)
161
+ const columnVisibleConfIter = (key) =>
162
+ columnsKeyMap[key].show !== false && !collapsedMap[key]
163
+ const fixedColumnsOnLeft = visibleFlatColumns.filter(
164
+ (column) =>
165
+ (column.fixed === 'left' || column.fixed === true) &&
166
+ columnVisibleConfIter(column.key)
167
+ )
168
+ const normalColumns = visibleFlatColumns.filter(
169
+ (column) => !column.fixed && columnVisibleConfIter(column.key)
170
+ )
171
+ if (curMaxIndexVal >= 10000) {
172
+ updateColumnsIndexWidth(fixedColumnsOnLeft, curMaxIndexVal)
173
+ }
174
+ const mainColumns = [...fixedColumnsOnLeft, ...normalColumns]
175
+ const maxLevel = creatMaxlevel(mainColumns)
176
+ // const headerTotalHeight = maxLevel * headerRowHeight
177
+
178
+ const collapseKeysMap = {}
179
+ function calculateOffsetXAndWidth(arr = [], iter) {
180
+ let offsetX = 0
181
+ return arr.map((col, index) => {
182
+ const width = computedColumnsWidthInChildKeys(
183
+ col,
184
+ columnsKeyMap,
185
+ collapsedMap
186
+ )
187
+ col.width = width
188
+ if (col.collapseKeys && col.collapseKeys.length) {
189
+ if (!collapseKeysMap[col.key]) {
190
+ collapseKeysMap[col.key] = col.collapseKeys
191
+ }
192
+ }
193
+ if (index > 0) {
194
+ const { width: preWidth, key: preKey } = mainColumns[index - 1]
195
+ offsetX += preWidth
196
+ // 如果上一次是父级,则减去父级的宽度。从父级的起始点开始
197
+ if (col.parentNodeKey === preKey) {
198
+ offsetX -= preWidth
199
+ }
200
+ }
201
+ col.offsetX = offsetX
202
+ const otherResult = iter(col, index) || {}
203
+ const levelNum =
204
+ col.level !== maxLevel && !col.children.length
205
+ ? Math.abs(col.level - maxLevel) + 1
206
+ : 1
207
+ const height = levelNum * headerRowHeight
208
+ const top = (col.level - 1) * headerRowHeight
209
+ return {
210
+ ...col,
211
+ originIndex: index,
212
+ ...otherResult,
213
+ height: height,
214
+ top,
215
+ [rowKey]: (col.fixed ? 'fixed_left_' : '') + col.key,
216
+ }
217
+ })
218
+ }
219
+ const _mainColumns = calculateOffsetXAndWidth(mainColumns, function (col) {
220
+ const { key } = col
221
+ const fixedLeftKeys = ['_index', '_selection'].indexOf(key) > -1
222
+ return {
223
+ headerCellRender: fixedLeftKeys ? null : col.headerCellRender,
224
+ rowCellRender: fixedLeftKeys ? null : col.rowCellRender,
225
+ }
226
+ })
227
+ // function setPlaceholderSign() {
228
+ // return {
229
+ // placeholderSign: false,
230
+ // }
231
+ // }
232
+ // const _fixedColumnsOnLeft = calculateOffsetXAndWidth(
233
+ // fixedColumnsOnLeft.length
234
+ // ? mainColumns.slice(0, fixedColumnsOnLeft.length)
235
+ // : [],
236
+ // setPlaceholderSign
237
+ // )
238
+ return {
239
+ columns: _mainColumns,
240
+ // fixedColumnsOnLeft: _fixedColumnsOnLeft,
241
+ maxLevel,
242
+ collapseKeysMap
243
+ }
244
+ }
245
+
246
+ export function creatMaxlevel(columns) {
247
+ const levelIter = (col) => col.level
248
+ const maxLevel = columns.length ? Math.max(...columns.map(levelIter)) : 1
249
+ return maxLevel
250
+ }
251
+
252
+ export function createRenderColumnOption({
253
+ mainColumns,
254
+ maxLevel,
255
+ headerRowHeight,
256
+ }) {
257
+ const {
258
+ tableWidth,
259
+ // renderRowColumns,
260
+ renderCellsColumns,
261
+ renderCellsColumnsWidths,
262
+ } = mainColumns.reduce(
263
+ (obj, col) => {
264
+ if (col.level === 1) {
265
+ obj.tableWidth += col.width
266
+ // obj.renderRowColumns.push(col)
267
+ }
268
+ if (!(col.children && col.children.length)) {
269
+ const levelNum =
270
+ col.level !== maxLevel ? Math.abs(col.level - maxLevel) + 1 : 1
271
+ col.headerRowHeight = levelNum * headerRowHeight
272
+ obj.renderCellsColumns.push(col)
273
+ obj.renderCellsColumnsWidths.push(col.width)
274
+ }
275
+ return obj
276
+ },
277
+ {
278
+ tableWidth: 0,
279
+ // renderRowColumns: [],
280
+ renderCellsColumns: [],
281
+ renderCellsColumnsWidths: [],
282
+ }
283
+ )
284
+ return {
285
+ tableWidth,
286
+ // renderRowColumns,
287
+ renderCellsColumns,
288
+ renderCellsColumnsWidths,
289
+ }
290
+ }
@@ -0,0 +1,12 @@
1
+ export function createTableData({ data, columns, rowKey, pageForIndex, showPage }, indexFormat) {
2
+ return (data || []).reduce((acc, rowData, index) => {
3
+ const _rowData = columns.reduce((row, col) => {
4
+ row[col.key] = rowData[col.key]
5
+ return row
6
+ }, {})
7
+ _rowData[rowKey] = rowData[rowKey] || '_inner_id' + index
8
+ _rowData['$index'] = indexFormat ? indexFormat(index + 1, _rowData, rowData) : index + 1 + (showPage ? (pageForIndex - 1) * 200 : 0)
9
+ acc.push(_rowData)
10
+ return acc
11
+ }, [])
12
+ }
@@ -0,0 +1,69 @@
1
+ const COLUMNS_INDEX = {
2
+ label: '序号',
3
+ key: '$index',
4
+ sortable: false,
5
+ // resizable: true,
6
+ width: 40,
7
+ // isInternal: true,
8
+ align: 'left',
9
+ showPopover: false,
10
+ // _internal: true,
11
+ // headerCellRender: function (h, { column }) {
12
+ // // const classes = getCustomHeaderCellAlignClass(column)
13
+ // const classes = []
14
+ // return <div class={classes}>{column.label || '#'}</div>
15
+ // },
16
+ // rowCellRender: function (h, { rowData }) {
17
+ // const index = _index
18
+ // let i = typeof index === 'number' ? index : index
19
+ // if (isNaN(i)) {
20
+ // i = ''
21
+ // }
22
+ // // const classes = getCustomRowCellAlignClass(column)
23
+ // const classes = []
24
+ // return <div class={classes}>{i}</div>
25
+ // }
26
+ }
27
+
28
+ // 生成索引和复选框的列配置
29
+ export function createFixedColumnsOnLeft({
30
+ showIndex, // 是否添加索引列
31
+ // showSelection,
32
+ // showRadio
33
+ }) {
34
+ const fixedColumnsOnLeft = []
35
+ const obj = {
36
+ level: 1,
37
+ show: true,
38
+ fixed: 'left',
39
+ // resizable: false
40
+ }
41
+ if (showIndex) {
42
+ fixedColumnsOnLeft.unshift({
43
+ ...COLUMNS_INDEX,
44
+ ...obj,
45
+ })
46
+ }
47
+ // if (showSelection) {
48
+ // fixedColumnsOnLeft.unshift({
49
+ // ...COLUMNS_SELECTION,
50
+ // ...obj
51
+ // })
52
+ // }
53
+ // if (showRadio) {
54
+ // fixedColumnsOnLeft.unshift({
55
+ // ...COLUMNS_RADIO,
56
+ // ...obj
57
+ // })
58
+ // }
59
+ return fixedColumnsOnLeft
60
+ }
61
+
62
+ export function updateColumnsIndexWidth(fixedColumnsOnLeft = [], tableDataLength) {
63
+ const showIndexColumn = fixedColumnsOnLeft.find(item => item.key === COLUMNS_INDEX.key)
64
+ let indexCol = String(tableDataLength).length * 10
65
+ const width = indexCol < COLUMNS_INDEX.width ? COLUMNS_INDEX.width : indexCol
66
+ if (showIndexColumn && width > COLUMNS_INDEX.width && width !== showIndexColumn.width) {
67
+ showIndexColumn.width = width
68
+ }
69
+ }
@@ -0,0 +1,327 @@
1
+ import dayJs from 'dayjs'
2
+ export const isEmpty = val => val === '' || val === null || val === undefined
3
+
4
+ export const date = (date, fmt = 'YYYY-MM-DD') => {
5
+ let str = date || ''
6
+ if (typeof str === 'string' && str && (str.includes('**') || str.includes('✽✽'))) {
7
+ return str
8
+ }
9
+ return str ? dayJs(str).format(fmt) : str
10
+ }
11
+
12
+ export const time = (d, fmt = 'YYYY-MM-DD HH:mm:ss') => {
13
+ return date(d, fmt)
14
+ }
15
+
16
+ export const minute = (d, fmt = 'YYYY-MM-DD HH:mm') => {
17
+ return date(d, fmt)
18
+ }
19
+
20
+ export const second = (d, fmt = 'HH:mm:ss') => {
21
+ return date(d, fmt)
22
+ }
23
+
24
+ export const month = (d, fmt = 'YYYY-MM') => {
25
+ return date(d, fmt)
26
+ }
27
+
28
+ export const money = (num, prev = '¥ ', fixed = 2) => {
29
+ if (typeof num !== 'number' && !num) {
30
+ return ''
31
+ }
32
+ if (typeof num === 'string' && (num.includes('**') || num.includes('✽✽'))) {
33
+ return num
34
+ }
35
+ prev = prev === null ? '¥ ' : prev
36
+ return `${prev}${(+num).toFixed(fixed).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
37
+ }
38
+
39
+ export const decimal = (num, precision = 2) => {
40
+ if (typeof num !== 'number' && !num) {
41
+ return ''
42
+ }
43
+ if (typeof num === 'string' && (num.includes('**') || num.includes('✽✽'))) {
44
+ return num
45
+ }
46
+ return `${(+num).toFixed(precision).replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')}`
47
+ }
48
+
49
+ export const thousands = num => {
50
+ if (typeof num !== 'number' && !num) {
51
+ return ''
52
+ }
53
+ if (typeof num === 'string' && (num.includes('**') || num.includes('✽✽'))) {
54
+ return num
55
+ }
56
+ return (+num).toLocaleString()
57
+ }
58
+
59
+ // 后端时间导出自定义类型
60
+ export const customDateTime = (d, fmt = 'YYYY-MM-DD') => {
61
+ return date(d, fmt)
62
+ }
63
+
64
+ /**
65
+ * 9级组织过滤器
66
+ * @param val 投资集团/快递事业部/京津冀大区/取派中心/北京分区/顺义区/顺义取派部/东城片区/顺义八里庄点部@顺义取派部@顺义八里庄点部
67
+ * @param dept Array:9级组织 | 1:部门 | 2:点部
68
+ * @param split 组织、部门、点部 的分隔符,默认为“@”
69
+ * @returns {string} 根据用户保存的点部配置,解析出对应的部门数据
70
+ */
71
+ export const deptFilter = (val, dept, split = '@') => {
72
+ let index = val && val.indexOf(split)
73
+ if (!index || index === -1) {
74
+ return val
75
+ }
76
+ if (Array.isArray(dept)) {
77
+ let arr = val.substring(0, index).split('/')
78
+ let len = Math.min(arr.length, dept.length)
79
+ let str = ''
80
+ for (let i = 0; i < len; i++) {
81
+ let s = arr[dept[i] - 1]
82
+ if (s) {
83
+ str = `${str}/${s}`
84
+ }
85
+ }
86
+ return str ? str.replace(/^\//, '') : val
87
+ } else if (dept === 1) {
88
+ return val.substring(index + 1, val.lastIndexOf(split))
89
+ } else if (dept === 2) {
90
+ return val.substring(val.lastIndexOf(split) + 1)
91
+ } else {
92
+ return val
93
+ }
94
+ }
95
+
96
+ // 234333.22 => 23万 4333 234.22 => 234.22 支持金额切换
97
+ export const numberSplit = (val, globalMoneyFormat = true) => {
98
+ // 防止空字符返回为0
99
+ if (val === '') return val
100
+ if (globalMoneyFormat) {
101
+ return money(val)
102
+ }
103
+ let toNumberVal = Number(val)
104
+ if (isNaN(toNumberVal)) {
105
+ return val
106
+ }
107
+ let flag = ''
108
+ if (toNumberVal < 0) {
109
+ flag = '-'
110
+ toNumberVal = Math.abs(toNumberVal)
111
+ }
112
+ if (toNumberVal >= 10000) {
113
+ // 大于等于10000的数据要去掉小数位
114
+ const numStr = Math.floor(toNumberVal) + ''
115
+ const len = numStr.length
116
+ const numArr = []
117
+ // 每4位截取一次,截取小于10000部分的数据
118
+ let itemLast = Number(numStr.substring(len - 4, len))
119
+ // 只有个位数前面要加0 等于0则去掉,不加入数组拼接
120
+ if (itemLast < 10 && itemLast > 0) {
121
+ numArr.unshift('0' + itemLast)
122
+ } else if (itemLast >= 10) {
123
+ numArr.unshift(itemLast)
124
+ }
125
+ let itemCenter = 0
126
+ let itemFirst = 0
127
+ if (len <= 8) {
128
+ // 长度小于等于8, 没有亿位,这个时候万位可以从index = 0 开始截取
129
+ itemCenter = Number(numStr.substring(0, len - 4))
130
+ } else {
131
+ // 长度大于8才有亿, 万位不能再从index = 0开始截取
132
+ itemCenter = Number(numStr.substring(len - 8, len - 4))
133
+ itemFirst = Number(numStr.substring(0, len - 8))
134
+ }
135
+ // 万位和亿位如果大于0才加入数组拼接
136
+ if (itemCenter > 0) numArr.unshift(itemCenter + '万')
137
+ if (itemFirst > 0) numArr.unshift(itemFirst + '亿')
138
+ return flag + numArr.join('')
139
+ }
140
+ return flag + toNumberVal
141
+ }
142
+
143
+ // 234333.22 => 23万4333 234.22 => 234.22 不支持金额切换
144
+ export const numberSplitInt = val => {
145
+ // 防止空字符返回为0
146
+ if (val === '') return val
147
+ let toNumberVal = Number(val)
148
+ if (isNaN(toNumberVal)) {
149
+ return val
150
+ }
151
+ let flag = ''
152
+ if (toNumberVal < 0) {
153
+ flag = '-'
154
+ toNumberVal = Math.abs(toNumberVal)
155
+ }
156
+ if (toNumberVal >= 10000) {
157
+ // 大于等于10000的数据要去掉小数位
158
+ const numStr = Math.floor(toNumberVal) + ''
159
+ const len = numStr.length
160
+ const numArr = []
161
+ // 每4位截取一次,截取小于10000部分的数据
162
+ let itemLast = Number(numStr.substring(len - 4, len))
163
+ // 只有个位数前面要加0 等于0则去掉,不加入数组拼接
164
+ if (itemLast < 10 && itemLast > 0) {
165
+ numArr.unshift('0' + itemLast)
166
+ } else if (itemLast >= 10) {
167
+ numArr.unshift(itemLast)
168
+ }
169
+ let itemCenter = 0
170
+ let itemFirst = 0
171
+ if (len <= 8) {
172
+ // 长度小于等于8, 没有亿位,这个时候万位可以从index = 0 开始截取
173
+ itemCenter = Number(numStr.substring(0, len - 4))
174
+ } else {
175
+ // 长度大于8才有亿, 万位不能再从index = 0开始截取
176
+ itemCenter = Number(numStr.substring(len - 8, len - 4))
177
+ itemFirst = Number(numStr.substring(0, len - 8))
178
+ }
179
+ // 万位和亿位如果大于0才加入数组拼接
180
+ if (itemCenter > 0) numArr.unshift(itemCenter + '万')
181
+ if (itemFirst > 0) numArr.unshift(itemFirst + '亿')
182
+ return flag + numArr.join('')
183
+ }
184
+ return flag + toNumberVal
185
+ }
186
+
187
+ // 234333.22 => 23万4333.22 234.22 => 234.22
188
+ export const numberSplitFloat = (val, decimal, globalMoneyFormat = false) => {
189
+ // 防止空字符返回为0
190
+ if (val === '') return val
191
+ if (globalMoneyFormat) {
192
+ return money(val)
193
+ }
194
+ return filterNumber(val, decimal)
195
+ }
196
+
197
+ const filterNumber = (val, decimal) => {
198
+ if (decimal < 0 || !Number.isInteger(decimal)) decimal = void 0
199
+ let toNumberVal = Number(val)
200
+ if (isNaN(toNumberVal)) {
201
+ return val
202
+ }
203
+ let flag = ''
204
+ if (toNumberVal < 0) {
205
+ flag = '-'
206
+ toNumberVal = Math.abs(toNumberVal)
207
+ }
208
+ const numStrArr = String(toNumberVal).split('.')
209
+ const numStr = numStrArr[0]
210
+ const _decimal = decimal == 0 ? '' : decimal || (numStrArr[1] && numStrArr[1].length) || ''
211
+ const decimalNum = numStrArr[1] && _decimal ? `.${numStrArr[1].substring(0, _decimal)}` : ''
212
+ if (toNumberVal >= 10000) {
213
+ const len = numStr.length
214
+ const numArr = []
215
+ // 每4位截取一次,截取小于10000部分的数据
216
+ let itemLast = Number(numStr.substring(len - 4, len))
217
+ // 只有个位数前面要加0 等于0则去掉,不加入数组拼接
218
+ if (itemLast < 10 && itemLast > 0) {
219
+ numArr.unshift('0' + itemLast)
220
+ } else if (itemLast >= 10) {
221
+ numArr.unshift(itemLast)
222
+ }
223
+ let itemCenter = 0
224
+ let itemFirst = 0
225
+ // let itemBillion = 0
226
+ // 处理万亿(兆)级别
227
+ if (len >= 13) {
228
+ const billion = 1e12 // 1万亿
229
+ let billionValue = String(numStr / billion)
230
+ const dotIndex = billionValue.indexOf('.')
231
+ if (dotIndex !== -1) {
232
+ billionValue = billionValue.slice(0, dotIndex + 5) // dotIndex + 5 保留四位小数
233
+ }
234
+ // 长度大于等于13 万亿(兆)级别
235
+ // itemBillion = Number(numStr.substring(0, len - 12)) // 万亿(兆)部分
236
+ // itemFirst = Number(numStr.substring(len - 12, len - 10)) // 亿部分
237
+ // itemCenter = Number(numStr.substring(len - 8, len - 4)) // 万部分
238
+ // return `${itemBillion}${itemFirst ? '.' + itemFirst : ''}万亿`
239
+ return `${billionValue}万亿`
240
+ } else if (len >= 9) {
241
+ // 长度大于8才有亿, 万位不能再从index = 0开始截取
242
+ itemCenter = Number(numStr.substring(len - 8, len - 4))
243
+ itemFirst = Number(numStr.substring(0, len - 8))
244
+ } else {
245
+ // 长度小于9,只有万以下的数值
246
+ itemCenter = Number(numStr.substring(0, len - 4)) // 万部分
247
+ }
248
+
249
+ if (itemCenter > 0) numArr.unshift(itemCenter + '万')
250
+ if (itemFirst > 0) numArr.unshift(itemFirst + '亿')
251
+ // if (itemBillion > 0) numArr.unshift(itemBillion + '万亿')
252
+ return flag + numArr.join('') + decimalNum
253
+ }
254
+ return flag + Math.floor(toNumberVal) + decimalNum
255
+ }
256
+
257
+ // 234333.22 => 23万4333.22 234.22 => 234.22 , null => '-'
258
+ export const formatMoneyByNumber = (val, decimal = 2) => {
259
+ // 金融板块 金额为空时 需要返回 返回‘-’, 且默认2为小数, 默认带前缀 ¥
260
+ if (isEmpty(val)) return '-'
261
+ const num = filterNumber(val, decimal)
262
+ return num.includes('*') || num.includes('✽') ? num : `¥ ${num}`
263
+ }
264
+
265
+
266
+ function getFormatter(col = {}, filter) {
267
+ if (!filter) {
268
+ return null
269
+ }
270
+ // 过滤器
271
+ if (col.filter) {
272
+ if (col.filter.type && col.filter.args) {
273
+ let func = filter[col.filter.type]
274
+ if (func) {
275
+ return (row, column, val) => func(val, ...col.filter.args)
276
+ }
277
+ } else {
278
+ // 不显示秒,minute 替换 time
279
+ // if (col.filter === 'time') {
280
+ // col.filter = 'minute'
281
+ // }
282
+ let func = filter[col.filter]
283
+ if (func) {
284
+ // 9级组织
285
+ if (col.filter === 'deptFilter') {
286
+ return (row, column, val) => func(val, column.dept)
287
+ } else {
288
+ return (row, column, val) => func(val)
289
+ }
290
+ }
291
+ }
292
+ }
293
+ return null
294
+ }
295
+
296
+ const filter = {
297
+ date,
298
+ time,
299
+ minute,
300
+ second,
301
+ month,
302
+ money,
303
+ decimal,
304
+ thousands,
305
+ customDateTime,
306
+ deptFilter,
307
+ numberSplit,
308
+ numberSplitInt,
309
+ numberSplitFloat,
310
+ formatMoneyByNumber,
311
+ }
312
+
313
+ export const tableCellFormatterResult = ({ column = {}, rowData, rowIndex, columnIndex, displayText }) => {
314
+ try {
315
+ const formatter = getFormatter(column, filter)
316
+ if (formatter) {
317
+ displayText = formatter(rowData, column, displayText)
318
+ }
319
+ if (column.formatter && typeof column.formatter === 'function') {
320
+ displayText = column.formatter(rowData, column, displayText, rowIndex, columnIndex)
321
+ }
322
+ return displayText
323
+ } catch (error) {
324
+ console.error(error)
325
+ return displayText
326
+ }
327
+ }