vxe-table 4.23.4 → 4.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.esm.js +32459 -33908
- package/dist/style.css +4501 -1
- package/dist/style.mini.css +1 -0
- package/es/colgroup/index.d.ts +760 -0
- package/es/colgroup/index.js +16 -13
- package/es/column/index.d.ts +760 -0
- package/es/column/index.js +16 -13
- package/es/components.d.ts +9 -0
- package/es/components.js +29 -29
- package/es/grid/index.d.ts +2824 -0
- package/es/grid/index.js +14 -9
- package/es/grid/src/emits.d.ts +2 -0
- package/es/grid/src/emits.js +18 -15
- package/es/grid/src/grid.d.ts +556 -0
- package/es/grid/src/grid.js +1695 -1758
- package/es/grid/src/props.d.ts +200 -0
- package/es/grid/src/props.js +19 -6
- package/es/{vxe-grid/style.min.css → grid/style.mini.css} +1 -1
- package/es/index.d.ts +3 -0
- package/es/index.esm.js +6 -3
- package/es/index.js +6 -0
- package/es/locale/lang/ar-EG.d.ts +908 -2
- package/es/locale/lang/ar-EG.js +906 -903
- package/es/locale/lang/de-DE.d.ts +908 -2
- package/es/locale/lang/de-DE.js +906 -903
- package/es/locale/lang/en-US.d.ts +908 -2
- package/es/locale/lang/en-US.js +906 -903
- package/es/locale/lang/es-ES.d.ts +908 -2
- package/es/locale/lang/es-ES.js +906 -903
- package/es/locale/lang/fr-FR.d.ts +908 -2
- package/es/locale/lang/fr-FR.js +906 -903
- package/es/locale/lang/hu-HU.d.ts +908 -2
- package/es/locale/lang/hu-HU.js +906 -903
- package/es/locale/lang/hy-AM.d.ts +908 -2
- package/es/locale/lang/hy-AM.js +906 -903
- package/es/locale/lang/id-ID.d.ts +908 -2
- package/es/locale/lang/id-ID.js +906 -903
- package/es/locale/lang/it-IT.d.ts +908 -2
- package/es/locale/lang/it-IT.js +906 -903
- package/es/locale/lang/ja-JP.d.ts +908 -2
- package/es/locale/lang/ja-JP.js +906 -903
- package/es/locale/lang/ko-KR.d.ts +908 -2
- package/es/locale/lang/ko-KR.js +906 -903
- package/es/locale/lang/ms-MY.d.ts +908 -2
- package/es/locale/lang/ms-MY.js +906 -903
- package/es/locale/lang/nb-NO.d.ts +908 -2
- package/es/locale/lang/nb-NO.js +906 -903
- package/es/locale/lang/pt-BR.d.ts +908 -2
- package/es/locale/lang/pt-BR.js +906 -903
- package/es/locale/lang/ru-RU.d.ts +908 -2
- package/es/locale/lang/ru-RU.js +906 -903
- package/es/locale/lang/th-TH.d.ts +908 -2
- package/es/locale/lang/th-TH.js +906 -903
- package/es/locale/lang/ug-CN.d.ts +908 -2
- package/es/locale/lang/ug-CN.js +906 -903
- package/es/locale/lang/uk-UA.d.ts +908 -2
- package/es/locale/lang/uk-UA.js +906 -903
- package/es/locale/lang/uz-UZ.d.ts +908 -2
- package/es/locale/lang/uz-UZ.js +906 -903
- package/es/locale/lang/vi-VN.d.ts +908 -2
- package/es/locale/lang/vi-VN.js +906 -903
- package/es/locale/lang/zh-CHT.d.ts +908 -2
- package/es/locale/lang/zh-CHT.js +906 -903
- package/es/locale/lang/zh-CN.d.ts +908 -2
- package/es/locale/lang/zh-CN.js +906 -903
- package/es/locale/lang/zh-HK.d.ts +908 -2
- package/es/locale/lang/zh-HK.js +910 -2
- package/es/locale/lang/zh-MO.d.ts +908 -2
- package/es/locale/lang/zh-MO.js +910 -2
- package/es/locale/lang/zh-TC.d.ts +908 -0
- package/es/locale/lang/zh-TC.js +910 -2
- package/es/locale/lang/zh-TW.d.ts +908 -2
- package/es/locale/lang/zh-TW.js +910 -2
- package/es/table/index.d.ts +2672 -0
- package/es/table/index.js +16 -11
- package/es/table/module/custom/hook.d.ts +1 -0
- package/es/table/module/custom/hook.js +462 -483
- package/es/table/module/custom/panel.d.ts +17 -0
- package/es/table/module/custom/panel.js +1482 -1559
- package/es/table/module/edit/hook.d.ts +1 -0
- package/es/table/module/edit/hook.js +1008 -1078
- package/es/table/module/export/export-panel.d.ts +27 -0
- package/es/table/module/export/export-panel.js +523 -575
- package/es/table/module/export/hook.d.ts +1 -0
- package/es/table/module/export/hook.js +1805 -1884
- package/es/table/module/export/import-panel.d.ts +27 -0
- package/es/table/module/export/import-panel.js +244 -252
- package/es/table/module/export/util.d.ts +5 -0
- package/es/table/module/export/util.js +20 -17
- package/es/table/module/filter/hook.d.ts +1 -0
- package/es/table/module/filter/hook.js +472 -487
- package/es/table/module/filter/panel.d.ts +16 -0
- package/es/table/module/filter/panel.js +251 -275
- package/es/table/module/keyboard/hook.d.ts +1 -0
- package/es/table/module/keyboard/hook.js +445 -497
- package/es/table/module/menu/hook.d.ts +1 -0
- package/es/table/module/menu/hook.js +295 -315
- package/es/table/module/menu/panel.d.ts +2 -0
- package/es/table/module/menu/panel.js +164 -183
- package/es/table/module/validator/hook.d.ts +1 -0
- package/es/table/module/validator/hook.js +522 -571
- package/es/table/render/index.d.ts +1 -0
- package/es/table/render/index.js +1402 -1362
- package/es/table/src/body.d.ts +24 -0
- package/es/table/src/body.js +850 -865
- package/es/table/src/cell.d.ts +192 -0
- package/es/table/src/cell.js +1209 -1207
- package/es/table/src/column.d.ts +263 -0
- package/es/table/src/column.js +178 -174
- package/es/table/src/columnInfo.d.ts +13 -0
- package/es/table/src/columnInfo.js +202 -196
- package/es/table/src/emits.d.ts +2 -0
- package/es/table/src/emits.js +126 -119
- package/es/table/src/footer.d.ts +45 -0
- package/es/table/src/footer.js +336 -340
- package/es/table/src/group.d.ts +178 -0
- package/es/table/src/group.js +49 -46
- package/es/table/src/header.d.ts +26 -0
- package/es/table/src/header.js +517 -519
- package/es/table/src/props.d.ts +238 -0
- package/es/table/src/props.js +331 -328
- package/es/table/src/store.d.ts +6 -0
- package/es/table/src/store.js +9 -6
- package/es/table/src/table.d.ts +539 -0
- package/es/table/src/table.js +14064 -15041
- package/es/table/src/use/cell-view.d.ts +10 -0
- package/es/table/src/use/cell-view.js +36 -33
- package/es/table/src/use/index.d.ts +1 -0
- package/es/table/src/use/index.js +1 -1
- package/es/table/src/util.d.ts +74 -0
- package/es/table/src/util.js +1038 -1026
- package/es/table/style.css +1 -1
- package/es/table/style.mini.css +1 -0
- package/es/toolbar/index.d.ts +340 -0
- package/es/toolbar/index.js +14 -9
- package/es/toolbar/src/toolbar.d.ts +75 -0
- package/es/toolbar/src/toolbar.js +605 -613
- package/es/toolbar/{style.min.css → style.mini.css} +1 -1
- package/es/ui/index.d.ts +86 -0
- package/es/ui/index.js +457 -501
- package/es/ui/src/anime.d.ts +10 -0
- package/es/ui/src/anime.js +40 -40
- package/es/ui/src/comp.d.ts +2 -0
- package/es/ui/src/comp.js +5 -2
- package/es/ui/src/dom.d.ts +80 -0
- package/es/ui/src/dom.js +377 -380
- package/es/ui/src/log.d.ts +6 -0
- package/es/ui/src/log.js +18 -13
- package/es/ui/src/utils.d.ts +23 -0
- package/es/ui/src/utils.js +57 -53
- package/es/ui/src/vn.d.ts +7 -0
- package/es/ui/src/vn.js +49 -42
- package/es/v-x-e-table/index.d.ts +3 -0
- package/es/v-x-e-table/index.js +6 -3
- package/es/vxe-colgroup/index.d.ts +3 -0
- package/es/vxe-colgroup/index.js +6 -3
- package/es/vxe-column/index.d.ts +3 -0
- package/es/vxe-column/index.js +6 -3
- package/es/vxe-grid/index.d.ts +3 -0
- package/es/vxe-grid/index.js +6 -3
- package/{lib/grid/style/style.min.css → es/vxe-grid/style.mini.css} +1 -1
- package/es/vxe-table/index.d.ts +3 -0
- package/es/vxe-table/index.js +6 -3
- package/es/vxe-table/style.css +1 -1
- package/es/vxe-table/style.mini.css +1 -0
- package/es/vxe-toolbar/index.d.ts +3 -0
- package/es/vxe-toolbar/index.js +6 -3
- package/es/vxe-toolbar/{style.min.css → style.mini.css} +1 -1
- package/es/vxe-ui/index.d.ts +3 -0
- package/es/vxe-ui/index.js +6 -3
- package/lib/colgroup/index.js +44 -18
- package/lib/colgroup/style/index.js +1 -1
- package/lib/column/index.js +44 -18
- package/lib/column/style/index.js +1 -1
- package/lib/components.js +58 -92
- package/lib/grid/index.js +42 -14
- package/lib/grid/src/emits.js +37 -6
- package/lib/grid/src/grid.js +850 -1195
- package/lib/grid/src/props.js +27 -11
- package/lib/grid/style/index.js +1 -1
- package/lib/{vxe-grid/style/style.min.css → grid/style/style.mini.css} +1 -1
- package/lib/iconfont.1792977622800.ttf +0 -0
- package/lib/iconfont.1792977622800.woff +0 -0
- package/lib/iconfont.1792977622800.woff2 +0 -0
- package/lib/index.common.js +35 -19
- package/lib/index.js +37 -0
- package/lib/index.umd.js +30586 -24322
- package/lib/index.umd.min.js +3 -1
- package/lib/locale/ar-EG.umd.js +948 -0
- package/lib/locale/de-DE.umd.js +948 -0
- package/lib/locale/en-US.umd.js +948 -0
- package/lib/locale/es-ES.umd.js +948 -0
- package/lib/locale/fr-FR.umd.js +948 -0
- package/lib/locale/hu-HU.umd.js +948 -0
- package/lib/locale/hy-AM.umd.js +948 -0
- package/lib/locale/id-ID.umd.js +948 -0
- package/lib/locale/it-IT.umd.js +948 -0
- package/lib/locale/ja-JP.umd.js +948 -0
- package/lib/locale/ko-KR.umd.js +948 -0
- package/lib/locale/lang/ar-EG.js +681 -664
- package/lib/locale/lang/ar-EG.umd.js +913 -892
- package/lib/locale/lang/de-DE.js +681 -664
- package/lib/locale/lang/de-DE.umd.js +913 -892
- package/lib/locale/lang/en-US.js +678 -661
- package/lib/locale/lang/en-US.umd.js +913 -892
- package/lib/locale/lang/es-ES.js +681 -664
- package/lib/locale/lang/es-ES.umd.js +913 -892
- package/lib/locale/lang/fr-FR.js +654 -637
- package/lib/locale/lang/fr-FR.umd.js +913 -892
- package/lib/locale/lang/hu-HU.js +681 -664
- package/lib/locale/lang/hu-HU.umd.js +913 -892
- package/lib/locale/lang/hy-AM.js +681 -664
- package/lib/locale/lang/hy-AM.umd.js +913 -892
- package/lib/locale/lang/id-ID.js +681 -664
- package/lib/locale/lang/id-ID.umd.js +913 -892
- package/lib/locale/lang/it-IT.js +661 -644
- package/lib/locale/lang/it-IT.umd.js +912 -891
- package/lib/locale/lang/ja-JP.js +710 -693
- package/lib/locale/lang/ja-JP.umd.js +913 -892
- package/lib/locale/lang/ko-KR.js +681 -664
- package/lib/locale/lang/ko-KR.umd.js +913 -892
- package/lib/locale/lang/ms-MY.js +681 -664
- package/lib/locale/lang/ms-MY.umd.js +913 -892
- package/lib/locale/lang/nb-NO.js +681 -664
- package/lib/locale/lang/nb-NO.umd.js +913 -892
- package/lib/locale/lang/pt-BR.js +681 -664
- package/lib/locale/lang/pt-BR.umd.js +913 -892
- package/lib/locale/lang/ru-RU.js +690 -673
- package/lib/locale/lang/ru-RU.umd.js +913 -892
- package/lib/locale/lang/th-TH.js +681 -664
- package/lib/locale/lang/th-TH.umd.js +913 -892
- package/lib/locale/lang/ug-CN.js +681 -664
- package/lib/locale/lang/ug-CN.umd.js +913 -892
- package/lib/locale/lang/uk-UA.js +674 -657
- package/lib/locale/lang/uk-UA.umd.js +913 -892
- package/lib/locale/lang/uz-UZ.js +583 -566
- package/lib/locale/lang/uz-UZ.umd.js +908 -887
- package/lib/locale/lang/vi-VN.js +681 -664
- package/lib/locale/lang/vi-VN.umd.js +913 -892
- package/lib/locale/lang/zh-CHT.js +681 -664
- package/lib/locale/lang/zh-CHT.umd.js +913 -892
- package/lib/locale/lang/zh-CN.js +681 -664
- package/lib/locale/lang/zh-CN.umd.js +913 -892
- package/lib/locale/lang/zh-HK.js +928 -7
- package/lib/locale/lang/zh-HK.umd.js +945 -20
- package/lib/locale/lang/zh-MO.js +928 -7
- package/lib/locale/lang/zh-MO.umd.js +945 -20
- package/lib/locale/lang/zh-TC.js +928 -7
- package/lib/locale/lang/zh-TC.umd.js +948 -0
- package/lib/locale/lang/zh-TW.js +928 -7
- package/lib/locale/lang/zh-TW.umd.js +945 -20
- package/lib/locale/ms-MY.umd.js +948 -0
- package/lib/locale/nb-NO.umd.js +948 -0
- package/lib/locale/pt-BR.umd.js +948 -0
- package/lib/locale/ru-RU.umd.js +948 -0
- package/lib/locale/th-TH.umd.js +948 -0
- package/lib/locale/ug-CN.umd.js +948 -0
- package/lib/locale/uk-UA.umd.js +948 -0
- package/lib/locale/uz-UZ.umd.js +948 -0
- package/lib/locale/vi-VN.umd.js +948 -0
- package/lib/locale/zh-CHT.umd.js +948 -0
- package/lib/locale/zh-CN.umd.js +948 -0
- package/lib/locale/zh-HK.umd.js +948 -0
- package/lib/locale/zh-MO.umd.js +948 -0
- package/lib/locale/zh-TC.umd.js +948 -0
- package/lib/locale/zh-TW.umd.js +948 -0
- package/lib/style.css +4501 -1
- package/lib/style.mini.css +1 -0
- package/lib/table/index.js +45 -17
- package/lib/table/module/custom/hook.js +132 -252
- package/lib/table/module/custom/panel.js +919 -970
- package/lib/table/module/edit/hook.js +250 -620
- package/lib/table/module/export/export-panel.js +390 -347
- package/lib/table/module/export/hook.js +745 -1179
- package/lib/table/module/export/import-panel.js +170 -136
- package/lib/table/module/export/util.js +37 -14
- package/lib/table/module/filter/hook.js +127 -227
- package/lib/table/module/filter/panel.js +177 -208
- package/lib/table/module/keyboard/hook.js +93 -172
- package/lib/table/module/menu/hook.js +86 -165
- package/lib/table/module/menu/panel.js +176 -141
- package/lib/table/module/validator/hook.js +164 -271
- package/lib/table/render/index.js +700 -1147
- package/lib/table/src/body.js +426 -559
- package/lib/table/src/cell.js +619 -987
- package/lib/table/src/column.js +55 -30
- package/lib/table/src/columnInfo.js +88 -110
- package/lib/table/src/emits.js +145 -13
- package/lib/table/src/footer.js +181 -240
- package/lib/table/src/group.js +56 -34
- package/lib/table/src/header.js +292 -367
- package/lib/table/src/props.js +27 -12
- package/lib/table/src/store.js +25 -9
- package/lib/table/src/table.js +14179 -1019
- package/lib/table/src/use/cell-view.js +47 -37
- package/lib/table/src/use/index.js +17 -15
- package/lib/table/src/util.js +236 -337
- package/lib/table/style/index.js +1 -1
- package/lib/table/style/style.css +1 -1
- package/lib/table/style/style.mini.css +1 -0
- package/lib/toolbar/index.js +42 -14
- package/lib/toolbar/src/toolbar.js +271 -379
- package/lib/toolbar/style/index.js +1 -1
- package/lib/toolbar/style/{style.min.css → style.mini.css} +1 -1
- package/lib/ui/index.js +153 -195
- package/lib/ui/src/anime.js +49 -29
- package/lib/ui/src/comp.js +23 -6
- package/lib/ui/src/dom.js +114 -147
- package/lib/ui/src/log.js +34 -18
- package/lib/ui/src/utils.js +57 -45
- package/lib/ui/src/vn.js +60 -34
- package/lib/ui/style/index.js +1 -1
- package/lib/v-x-e-table/index.js +35 -19
- package/lib/vxe-colgroup/index.js +35 -19
- package/lib/vxe-colgroup/style/index.js +1 -1
- package/lib/vxe-column/index.js +35 -19
- package/lib/vxe-column/style/index.js +1 -1
- package/lib/vxe-grid/index.js +35 -19
- package/lib/vxe-grid/style/index.js +1 -1
- package/{es/grid/style.min.css → lib/vxe-grid/style/style.mini.css} +1 -1
- package/lib/vxe-table/index.js +35 -19
- package/lib/vxe-table/style/index.js +1 -1
- package/lib/vxe-table/style/style.css +1 -1
- package/lib/vxe-table/style/style.mini.css +1 -0
- package/lib/vxe-toolbar/index.js +35 -19
- package/lib/vxe-toolbar/style/index.js +1 -1
- package/lib/vxe-toolbar/style/{style.min.css → style.mini.css} +1 -1
- package/lib/vxe-ui/index.js +35 -19
- package/lib/vxe-ui/style/index.js +1 -1
- package/package.json +8 -4
- package/packages/locale/lang/zh-HK.ts +907 -3
- package/packages/locale/lang/zh-MO.ts +907 -3
- package/packages/locale/lang/zh-TC.ts +907 -3
- package/packages/locale/lang/zh-TW.ts +907 -3
- package/packages/table/module/edit/hook.ts +2 -2
- package/packages/table/src/table.ts +64 -28
- package/packages/ui/index.ts +1 -28
- package/dist/style.min.css +0 -1
- package/es/index.css +0 -1
- package/es/index.min.css +0 -1
- package/es/style.css +0 -1
- package/es/style.min.css +0 -1
- package/es/table/style.min.css +0 -1
- package/es/vxe-table/style.min.css +0 -1
- package/es/vxe-v-x-e-table/index.js +0 -3
- package/lib/colgroup/index.min.js +0 -1
- package/lib/column/index.min.js +0 -1
- package/lib/components.min.js +0 -1
- package/lib/grid/index.min.js +0 -1
- package/lib/grid/src/emits.min.js +0 -1
- package/lib/grid/src/grid.min.js +0 -1
- package/lib/grid/src/props.min.js +0 -1
- package/lib/index.css +0 -1
- package/lib/index.min.css +0 -1
- package/lib/locale/lang/ar-EG.d.ts +0 -2
- package/lib/locale/lang/ar-EG.min.js +0 -1
- package/lib/locale/lang/de-DE.d.ts +0 -2
- package/lib/locale/lang/de-DE.min.js +0 -1
- package/lib/locale/lang/en-US.d.ts +0 -2
- package/lib/locale/lang/en-US.min.js +0 -1
- package/lib/locale/lang/es-ES.d.ts +0 -2
- package/lib/locale/lang/es-ES.min.js +0 -1
- package/lib/locale/lang/fr-FR.d.ts +0 -2
- package/lib/locale/lang/fr-FR.min.js +0 -1
- package/lib/locale/lang/hu-HU.d.ts +0 -2
- package/lib/locale/lang/hu-HU.min.js +0 -1
- package/lib/locale/lang/hy-AM.d.ts +0 -2
- package/lib/locale/lang/hy-AM.min.js +0 -1
- package/lib/locale/lang/id-ID.d.ts +0 -2
- package/lib/locale/lang/id-ID.min.js +0 -1
- package/lib/locale/lang/it-IT.d.ts +0 -2
- package/lib/locale/lang/it-IT.min.js +0 -1
- package/lib/locale/lang/ja-JP.d.ts +0 -2
- package/lib/locale/lang/ja-JP.min.js +0 -1
- package/lib/locale/lang/ko-KR.d.ts +0 -2
- package/lib/locale/lang/ko-KR.min.js +0 -1
- package/lib/locale/lang/ms-MY.d.ts +0 -2
- package/lib/locale/lang/ms-MY.min.js +0 -1
- package/lib/locale/lang/nb-NO.d.ts +0 -2
- package/lib/locale/lang/nb-NO.min.js +0 -1
- package/lib/locale/lang/pt-BR.d.ts +0 -2
- package/lib/locale/lang/pt-BR.min.js +0 -1
- package/lib/locale/lang/ru-RU.d.ts +0 -2
- package/lib/locale/lang/ru-RU.min.js +0 -1
- package/lib/locale/lang/th-TH.d.ts +0 -2
- package/lib/locale/lang/th-TH.min.js +0 -1
- package/lib/locale/lang/ug-CN.d.ts +0 -2
- package/lib/locale/lang/ug-CN.min.js +0 -1
- package/lib/locale/lang/uk-UA.d.ts +0 -2
- package/lib/locale/lang/uk-UA.min.js +0 -1
- package/lib/locale/lang/uz-UZ.d.ts +0 -2
- package/lib/locale/lang/uz-UZ.min.js +0 -1
- package/lib/locale/lang/vi-VN.d.ts +0 -2
- package/lib/locale/lang/vi-VN.min.js +0 -1
- package/lib/locale/lang/zh-CHT.d.ts +0 -2
- package/lib/locale/lang/zh-CHT.min.js +0 -1
- package/lib/locale/lang/zh-CN.d.ts +0 -2
- package/lib/locale/lang/zh-CN.min.js +0 -1
- package/lib/locale/lang/zh-HK.d.ts +0 -2
- package/lib/locale/lang/zh-HK.min.js +0 -1
- package/lib/locale/lang/zh-MO.d.ts +0 -2
- package/lib/locale/lang/zh-MO.min.js +0 -1
- package/lib/locale/lang/zh-TC.min.js +0 -1
- package/lib/locale/lang/zh-TW.d.ts +0 -2
- package/lib/locale/lang/zh-TW.min.js +0 -1
- package/lib/style.min.css +0 -1
- package/lib/table/index.min.js +0 -1
- package/lib/table/module/custom/hook.min.js +0 -1
- package/lib/table/module/custom/panel.min.js +0 -1
- package/lib/table/module/edit/hook.min.js +0 -1
- package/lib/table/module/export/export-panel.min.js +0 -1
- package/lib/table/module/export/hook.min.js +0 -1
- package/lib/table/module/export/import-panel.min.js +0 -1
- package/lib/table/module/export/util.min.js +0 -1
- package/lib/table/module/filter/hook.min.js +0 -1
- package/lib/table/module/filter/panel.min.js +0 -1
- package/lib/table/module/keyboard/hook.min.js +0 -1
- package/lib/table/module/menu/hook.min.js +0 -1
- package/lib/table/module/menu/panel.min.js +0 -1
- package/lib/table/module/validator/hook.min.js +0 -1
- package/lib/table/render/index.min.js +0 -1
- package/lib/table/src/body.min.js +0 -1
- package/lib/table/src/cell.min.js +0 -1
- package/lib/table/src/column.min.js +0 -1
- package/lib/table/src/columnInfo.min.js +0 -1
- package/lib/table/src/emits.min.js +0 -1
- package/lib/table/src/footer.min.js +0 -1
- package/lib/table/src/group.min.js +0 -1
- package/lib/table/src/header.min.js +0 -1
- package/lib/table/src/props.min.js +0 -1
- package/lib/table/src/store.min.js +0 -1
- package/lib/table/src/table.min.js +0 -1
- package/lib/table/src/use/cell-view.min.js +0 -1
- package/lib/table/src/use/index.min.js +0 -1
- package/lib/table/src/util.min.js +0 -1
- package/lib/table/style/style.min.css +0 -1
- package/lib/toolbar/index.min.js +0 -1
- package/lib/toolbar/src/toolbar.min.js +0 -1
- package/lib/ui/index.min.js +0 -1
- package/lib/ui/src/anime.min.js +0 -1
- package/lib/ui/src/comp.min.js +0 -1
- package/lib/ui/src/dom.min.js +0 -1
- package/lib/ui/src/log.min.js +0 -1
- package/lib/ui/src/utils.min.js +0 -1
- package/lib/ui/src/vn.min.js +0 -1
- package/lib/ui/style/style.min.css +0 -0
- package/lib/v-x-e-table/index.min.js +0 -1
- package/lib/v-x-e-table/style/index.js +0 -1
- package/lib/v-x-e-table/style/style.css +0 -0
- package/lib/v-x-e-table/style/style.min.css +0 -0
- package/lib/vxe-colgroup/index.min.js +0 -1
- package/lib/vxe-colgroup/style/style.min.css +0 -0
- package/lib/vxe-column/index.min.js +0 -1
- package/lib/vxe-column/style/style.min.css +0 -0
- package/lib/vxe-grid/index.min.js +0 -1
- package/lib/vxe-table/index.min.js +0 -1
- package/lib/vxe-table/style/style.min.css +0 -1
- package/lib/vxe-toolbar/index.min.js +0 -1
- package/lib/vxe-ui/index.min.js +0 -1
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/lib/vxe-v-x-e-table/index.js +0 -21
- package/lib/vxe-v-x-e-table/index.min.js +0 -1
- package/lib/vxe-v-x-e-table/style/index.js +0 -1
- package/lib/vxe-v-x-e-table/style/style.css +0 -0
- package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
- /package/{es/iconfont.1792740941484.ttf → dist/iconfont.1792977622800.ttf} +0 -0
- /package/{es/iconfont.1792740941484.woff → dist/iconfont.1792977622800.woff} +0 -0
- /package/{es/iconfont.1792740941484.woff2 → dist/iconfont.1792977622800.woff2} +0 -0
- /package/es/colgroup/{style.min.css → style.mini.css} +0 -0
- /package/es/column/{style.min.css → style.mini.css} +0 -0
- /package/{lib/iconfont.1792740941484.ttf → es/iconfont.1792977622800.ttf} +0 -0
- /package/{lib/iconfont.1792740941484.woff → es/iconfont.1792977622800.woff} +0 -0
- /package/{lib/iconfont.1792740941484.woff2 → es/iconfont.1792977622800.woff2} +0 -0
- /package/es/ui/{style.min.css → style.mini.css} +0 -0
- /package/es/{v-x-e-table/style.css → vxe-colgroup/style.mini.css} +0 -0
- /package/es/{v-x-e-table/style.min.css → vxe-column/style.mini.css} +0 -0
- /package/es/{vxe-colgroup/style.min.css → vxe-ui/style.mini.css} +0 -0
- /package/{es/vxe-column/style.min.css → lib/colgroup/style/style.mini.css} +0 -0
- /package/{es/vxe-ui/style.min.css → lib/column/style/style.mini.css} +0 -0
- /package/{es/vxe-v-x-e-table/style.css → lib/ui/style/style.mini.css} +0 -0
- /package/{es/vxe-v-x-e-table/style.min.css → lib/vxe-colgroup/style/style.mini.css} +0 -0
- /package/lib/{colgroup/style/style.min.css → vxe-column/style/style.mini.css} +0 -0
- /package/lib/{column/style/style.min.css → vxe-ui/style/style.mini.css} +0 -0
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var import_vue = require("vue");
|
|
25
|
+
var import_xe_utils = __toESM(require("xe-utils"));
|
|
26
|
+
var import_ui = require("../../../ui");
|
|
27
|
+
var import_util = require("../../src/util");
|
|
28
|
+
var import_utils = require("../../../ui/src/utils");
|
|
29
|
+
var import_dom = require("../../../ui/src/dom");
|
|
30
|
+
var import_util2 = require("./util");
|
|
31
|
+
var import_log = require("../../../ui/src/log");
|
|
32
|
+
const { warnLog, errLog } = (0, import_log.createComponentLog)("table");
|
|
33
|
+
const { getI18n, hooks, renderer } = import_ui.VxeUI;
|
|
21
34
|
let htmlCellElem;
|
|
22
|
-
const csvBOM =
|
|
23
|
-
const enterSymbol =
|
|
35
|
+
const csvBOM = "\uFEFF";
|
|
36
|
+
const enterSymbol = "\r\n";
|
|
24
37
|
function defaultFilterExportColumn(column) {
|
|
25
|
-
return !!column.field || [
|
|
38
|
+
return !!column.field || ["seq", "checkbox", "radio"].indexOf(column.type || "") === -1;
|
|
26
39
|
}
|
|
27
|
-
const getConvertColumns = columns => {
|
|
40
|
+
const getConvertColumns = (columns) => {
|
|
28
41
|
const result = [];
|
|
29
|
-
columns.forEach(column => {
|
|
42
|
+
columns.forEach((column) => {
|
|
30
43
|
if (column.childNodes && column.childNodes.length) {
|
|
31
44
|
result.push(column);
|
|
32
45
|
result.push(...getConvertColumns(column.childNodes));
|
|
@@ -36,7 +49,7 @@ const getConvertColumns = columns => {
|
|
|
36
49
|
});
|
|
37
50
|
return result;
|
|
38
51
|
};
|
|
39
|
-
const convertToRows = originColumns => {
|
|
52
|
+
const convertToRows = (originColumns) => {
|
|
40
53
|
let maxLevel = 1;
|
|
41
54
|
const traverse = (column, parent) => {
|
|
42
55
|
if (parent) {
|
|
@@ -47,7 +60,7 @@ const convertToRows = originColumns => {
|
|
|
47
60
|
}
|
|
48
61
|
if (column.childNodes && column.childNodes.length) {
|
|
49
62
|
let colSpan = 0;
|
|
50
|
-
column.childNodes.forEach(subColumn => {
|
|
63
|
+
column.childNodes.forEach((subColumn) => {
|
|
51
64
|
traverse(subColumn, column);
|
|
52
65
|
colSpan += subColumn._colSpan;
|
|
53
66
|
});
|
|
@@ -56,7 +69,7 @@ const convertToRows = originColumns => {
|
|
|
56
69
|
column._colSpan = 1;
|
|
57
70
|
}
|
|
58
71
|
};
|
|
59
|
-
originColumns.forEach(column => {
|
|
72
|
+
originColumns.forEach((column) => {
|
|
60
73
|
column._level = 1;
|
|
61
74
|
traverse(column);
|
|
62
75
|
});
|
|
@@ -65,7 +78,7 @@ const convertToRows = originColumns => {
|
|
|
65
78
|
rows.push([]);
|
|
66
79
|
}
|
|
67
80
|
const allColumns = getConvertColumns(originColumns);
|
|
68
|
-
allColumns.forEach(column => {
|
|
81
|
+
allColumns.forEach((column) => {
|
|
69
82
|
if (column.childNodes && column.childNodes.length) {
|
|
70
83
|
column._rowSpan = 1;
|
|
71
84
|
} else {
|
|
@@ -77,46 +90,38 @@ const convertToRows = originColumns => {
|
|
|
77
90
|
};
|
|
78
91
|
function toTableBorder(border) {
|
|
79
92
|
if (border === true) {
|
|
80
|
-
return
|
|
93
|
+
return "full";
|
|
81
94
|
}
|
|
82
95
|
if (border) {
|
|
83
96
|
return border;
|
|
84
97
|
}
|
|
85
|
-
return
|
|
98
|
+
return "default";
|
|
86
99
|
}
|
|
87
100
|
function getBooleanValue(cellValue) {
|
|
88
|
-
return cellValue ===
|
|
101
|
+
return cellValue === "TRUE" || cellValue === "true" || cellValue === true;
|
|
89
102
|
}
|
|
90
103
|
function getFooterData($xeTable, opts, footerTableData) {
|
|
91
104
|
const $xeGrid = $xeTable.xeGrid;
|
|
92
105
|
const $xeGantt = $xeTable.xeGantt;
|
|
93
|
-
const {
|
|
94
|
-
|
|
95
|
-
} = opts;
|
|
96
|
-
return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({
|
|
97
|
-
$table: $xeTable,
|
|
98
|
-
$grid: $xeGrid,
|
|
99
|
-
$gantt: $xeGantt,
|
|
100
|
-
items,
|
|
101
|
-
$rowIndex: index
|
|
102
|
-
})) : footerTableData;
|
|
106
|
+
const { footerFilterMethod } = opts;
|
|
107
|
+
return footerFilterMethod ? footerTableData.filter((items, index) => footerFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, items, $rowIndex: index })) : footerTableData;
|
|
103
108
|
}
|
|
104
109
|
function getCsvCellTypeLabel(column, cellValue) {
|
|
105
110
|
if (cellValue) {
|
|
106
|
-
if (column.type ===
|
|
107
|
-
return
|
|
111
|
+
if (column.type === "seq") {
|
|
112
|
+
return ` ${cellValue}`;
|
|
108
113
|
}
|
|
109
114
|
switch (column.cellType) {
|
|
110
|
-
case
|
|
115
|
+
case "string":
|
|
111
116
|
if (!isNaN(cellValue)) {
|
|
112
|
-
return
|
|
117
|
+
return ` ${cellValue}`;
|
|
113
118
|
}
|
|
114
119
|
break;
|
|
115
|
-
case
|
|
120
|
+
case "number":
|
|
116
121
|
break;
|
|
117
122
|
default:
|
|
118
123
|
if (cellValue.length >= 12 && !isNaN(cellValue)) {
|
|
119
|
-
return
|
|
124
|
+
return ` ${cellValue}`;
|
|
120
125
|
}
|
|
121
126
|
break;
|
|
122
127
|
}
|
|
@@ -127,27 +132,23 @@ function toTxtCellLabel(val) {
|
|
|
127
132
|
if (/[",\s\n]/.test(val)) {
|
|
128
133
|
return `"${val.replace(/"/g, '""')}"`;
|
|
129
134
|
}
|
|
130
|
-
return
|
|
135
|
+
return import_xe_utils.default.eqNull(val) ? "" : val;
|
|
131
136
|
}
|
|
132
137
|
function getElementsByTagName(elem, qualifiedName) {
|
|
133
138
|
return elem.getElementsByTagName(qualifiedName);
|
|
134
139
|
}
|
|
135
140
|
function getTxtCellKey(now) {
|
|
136
|
-
return `#${now}@${
|
|
141
|
+
return `#${now}@${import_xe_utils.default.uniqueId()}`;
|
|
137
142
|
}
|
|
138
143
|
function replaceTxtCell(cell, vMaps) {
|
|
139
|
-
return cell.replace(/#\d+@\d+/g, key =>
|
|
144
|
+
return cell.replace(/#\d+@\d+/g, (key) => import_xe_utils.default.hasOwnProp(vMaps, key) ? vMaps[key] : key);
|
|
140
145
|
}
|
|
141
146
|
function getTxtCellValue(val, vMaps) {
|
|
142
147
|
const rest = replaceTxtCell(val, vMaps);
|
|
143
|
-
return rest.replace(/^"+$/g, qVal => '"'.repeat(Math.ceil(qVal.length / 2)));
|
|
148
|
+
return rest.replace(/^"+$/g, (qVal) => '"'.repeat(Math.ceil(qVal.length / 2)));
|
|
144
149
|
}
|
|
145
150
|
function toExportField(tableConf, field) {
|
|
146
|
-
const {
|
|
147
|
-
fieldMaps,
|
|
148
|
-
titleMaps
|
|
149
|
-
} = tableConf;
|
|
150
|
-
// title 转 field
|
|
151
|
+
const { fieldMaps, titleMaps } = tableConf;
|
|
151
152
|
if (!fieldMaps[field]) {
|
|
152
153
|
const teCol = titleMaps[field];
|
|
153
154
|
if (teCol && teCol.field) {
|
|
@@ -163,12 +164,12 @@ function parseCsvAndTxt(tableConf, content, cellSeparator) {
|
|
|
163
164
|
if (list.length) {
|
|
164
165
|
const vMaps = {};
|
|
165
166
|
const now = Date.now();
|
|
166
|
-
list.forEach(rVal => {
|
|
167
|
+
list.forEach((rVal) => {
|
|
167
168
|
if (rVal) {
|
|
168
169
|
const item = {};
|
|
169
170
|
rVal = rVal.replace(/("")|(\n)/g, (text, dVal) => {
|
|
170
171
|
const key = getTxtCellKey(now);
|
|
171
|
-
vMaps[key] = dVal ? '"' :
|
|
172
|
+
vMaps[key] = dVal ? '"' : "\n";
|
|
172
173
|
return key;
|
|
173
174
|
}).replace(/"(.*?)"/g, (text, cVal) => {
|
|
174
175
|
const key = getTxtCellKey(now);
|
|
@@ -177,7 +178,7 @@ function parseCsvAndTxt(tableConf, content, cellSeparator) {
|
|
|
177
178
|
});
|
|
178
179
|
const cells = rVal.split(cellSeparator);
|
|
179
180
|
if (!fields.length) {
|
|
180
|
-
fields = cells.map(val => toExportField(tableConf, getTxtCellValue(val.trim(), vMaps)));
|
|
181
|
+
fields = cells.map((val) => toExportField(tableConf, getTxtCellValue(val.trim(), vMaps)));
|
|
181
182
|
} else {
|
|
182
183
|
cells.forEach((val, colIndex) => {
|
|
183
184
|
if (colIndex < fields.length) {
|
|
@@ -189,40 +190,37 @@ function parseCsvAndTxt(tableConf, content, cellSeparator) {
|
|
|
189
190
|
}
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
|
-
return {
|
|
193
|
-
fields,
|
|
194
|
-
rows
|
|
195
|
-
};
|
|
193
|
+
return { fields, rows };
|
|
196
194
|
}
|
|
197
195
|
function parseCsv(tableConf, content) {
|
|
198
|
-
return parseCsvAndTxt(tableConf, content,
|
|
196
|
+
return parseCsvAndTxt(tableConf, content, ",");
|
|
199
197
|
}
|
|
200
198
|
function parseTxt(tableConf, content) {
|
|
201
|
-
return parseCsvAndTxt(tableConf, content,
|
|
199
|
+
return parseCsvAndTxt(tableConf, content, " ");
|
|
202
200
|
}
|
|
203
201
|
function parseHTML(tableConf, content) {
|
|
204
202
|
const domParser = new DOMParser();
|
|
205
|
-
const xmlDoc = domParser.parseFromString(content,
|
|
206
|
-
const bodyNodes = getElementsByTagName(xmlDoc,
|
|
203
|
+
const xmlDoc = domParser.parseFromString(content, "text/html");
|
|
204
|
+
const bodyNodes = getElementsByTagName(xmlDoc, "body");
|
|
207
205
|
const rows = [];
|
|
208
206
|
const fields = [];
|
|
209
207
|
if (bodyNodes.length) {
|
|
210
|
-
const tableNodes = getElementsByTagName(bodyNodes[0],
|
|
208
|
+
const tableNodes = getElementsByTagName(bodyNodes[0], "table");
|
|
211
209
|
if (tableNodes.length) {
|
|
212
|
-
const theadNodes = getElementsByTagName(tableNodes[0],
|
|
210
|
+
const theadNodes = getElementsByTagName(tableNodes[0], "thead");
|
|
213
211
|
if (theadNodes.length) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
fields.push(toExportField(tableConf, cellNode.textContent ||
|
|
212
|
+
import_xe_utils.default.arrayEach(getElementsByTagName(theadNodes[0], "tr"), (rowNode) => {
|
|
213
|
+
import_xe_utils.default.arrayEach(getElementsByTagName(rowNode, "th"), (cellNode) => {
|
|
214
|
+
fields.push(toExportField(tableConf, cellNode.textContent || ""));
|
|
217
215
|
});
|
|
218
216
|
});
|
|
219
|
-
const tbodyNodes = getElementsByTagName(tableNodes[0],
|
|
217
|
+
const tbodyNodes = getElementsByTagName(tableNodes[0], "tbody");
|
|
220
218
|
if (tbodyNodes.length) {
|
|
221
|
-
|
|
219
|
+
import_xe_utils.default.arrayEach(getElementsByTagName(tbodyNodes[0], "tr"), (rowNode) => {
|
|
222
220
|
const item = {};
|
|
223
|
-
|
|
221
|
+
import_xe_utils.default.arrayEach(getElementsByTagName(rowNode, "td"), (cellNode, colIndex) => {
|
|
224
222
|
if (fields[colIndex]) {
|
|
225
|
-
item[fields[colIndex]] = cellNode.textContent ||
|
|
223
|
+
item[fields[colIndex]] = cellNode.textContent || "";
|
|
226
224
|
}
|
|
227
225
|
});
|
|
228
226
|
rows.push(item);
|
|
@@ -231,30 +229,27 @@ function parseHTML(tableConf, content) {
|
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
|
-
return {
|
|
235
|
-
fields,
|
|
236
|
-
rows
|
|
237
|
-
};
|
|
232
|
+
return { fields, rows };
|
|
238
233
|
}
|
|
239
234
|
function parseXML(tableConf, content) {
|
|
240
235
|
const domParser = new DOMParser();
|
|
241
|
-
const xmlDoc = domParser.parseFromString(content,
|
|
242
|
-
const sheetNodes = getElementsByTagName(xmlDoc,
|
|
236
|
+
const xmlDoc = domParser.parseFromString(content, "application/xml");
|
|
237
|
+
const sheetNodes = getElementsByTagName(xmlDoc, "Worksheet");
|
|
243
238
|
const rows = [];
|
|
244
239
|
const fields = [];
|
|
245
240
|
if (sheetNodes.length) {
|
|
246
|
-
const tableNodes = getElementsByTagName(sheetNodes[0],
|
|
241
|
+
const tableNodes = getElementsByTagName(sheetNodes[0], "Table");
|
|
247
242
|
if (tableNodes.length) {
|
|
248
|
-
const rowNodes = getElementsByTagName(tableNodes[0],
|
|
243
|
+
const rowNodes = getElementsByTagName(tableNodes[0], "Row");
|
|
249
244
|
if (rowNodes.length) {
|
|
250
|
-
|
|
251
|
-
fields.push(toExportField(tableConf, cellNode.textContent ||
|
|
245
|
+
import_xe_utils.default.arrayEach(getElementsByTagName(rowNodes[0], "Cell"), (cellNode) => {
|
|
246
|
+
fields.push(toExportField(tableConf, cellNode.textContent || ""));
|
|
252
247
|
});
|
|
253
|
-
|
|
248
|
+
import_xe_utils.default.arrayEach(rowNodes, (rowNode, index) => {
|
|
254
249
|
if (index) {
|
|
255
250
|
const item = {};
|
|
256
|
-
const cellNodes = getElementsByTagName(rowNode,
|
|
257
|
-
|
|
251
|
+
const cellNodes = getElementsByTagName(rowNode, "Cell");
|
|
252
|
+
import_xe_utils.default.arrayEach(cellNodes, (cellNode, colIndex) => {
|
|
258
253
|
if (fields[colIndex]) {
|
|
259
254
|
item[fields[colIndex]] = cellNode.textContent;
|
|
260
255
|
}
|
|
@@ -265,42 +260,22 @@ function parseXML(tableConf, content) {
|
|
|
265
260
|
}
|
|
266
261
|
}
|
|
267
262
|
}
|
|
268
|
-
return {
|
|
269
|
-
fields,
|
|
270
|
-
rows
|
|
271
|
-
};
|
|
263
|
+
return { fields, rows };
|
|
272
264
|
}
|
|
273
265
|
function clearColumnConvert(columns) {
|
|
274
|
-
|
|
266
|
+
import_xe_utils.default.eachTree(columns, (column) => {
|
|
275
267
|
delete column._level;
|
|
276
268
|
delete column._colSpan;
|
|
277
269
|
delete column._rowSpan;
|
|
278
270
|
delete column._children;
|
|
279
271
|
delete column.childNodes;
|
|
280
|
-
}, {
|
|
281
|
-
children: 'children'
|
|
282
|
-
});
|
|
272
|
+
}, { children: "children" });
|
|
283
273
|
}
|
|
284
|
-
const tableExportMethodKeys = [
|
|
285
|
-
hooks.add(
|
|
274
|
+
const tableExportMethodKeys = ["exportData", "importByFile", "importData", "saveFile", "readFile", "print", "getPrintHtml", "openImport", "closeImport", "openExport", "closeExport", "openPrint", "closePrint"];
|
|
275
|
+
hooks.add("tableExportModule", {
|
|
286
276
|
setupTable($xeTable) {
|
|
287
|
-
const {
|
|
288
|
-
|
|
289
|
-
reactData,
|
|
290
|
-
internalData
|
|
291
|
-
} = $xeTable;
|
|
292
|
-
const {
|
|
293
|
-
computeTreeOpts,
|
|
294
|
-
computePrintOpts,
|
|
295
|
-
computeExportOpts,
|
|
296
|
-
computeImportOpts,
|
|
297
|
-
computeSeqOpts,
|
|
298
|
-
computeRadioOpts,
|
|
299
|
-
computeCheckboxOpts,
|
|
300
|
-
computeColumnOpts,
|
|
301
|
-
computeAggregateOpts,
|
|
302
|
-
computeRendererOpts
|
|
303
|
-
} = $xeTable.getComputeMaps();
|
|
277
|
+
const { props, reactData, internalData } = $xeTable;
|
|
278
|
+
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts, computeAggregateOpts, computeRendererOpts } = $xeTable.getComputeMaps();
|
|
304
279
|
const getSeq = (cellValue, row, $rowIndex, column, $columnIndex) => {
|
|
305
280
|
const seqOpts = computeSeqOpts.value;
|
|
306
281
|
const seqMd = seqOpts.seqMethod || column.seqMethod;
|
|
@@ -322,34 +297,19 @@ hooks.add('tableExportModule', {
|
|
|
322
297
|
function getHeaderTitle(opts, column) {
|
|
323
298
|
const columnOpts = computeColumnOpts.value;
|
|
324
299
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
|
|
325
|
-
return headExportMethod ? headExportMethod({
|
|
326
|
-
column,
|
|
327
|
-
options: opts,
|
|
328
|
-
$table: $xeTable
|
|
329
|
-
}) : (opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '';
|
|
300
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : (opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || "";
|
|
330
301
|
}
|
|
331
|
-
const toBooleanValue = cellValue => {
|
|
332
|
-
return
|
|
302
|
+
const toBooleanValue = (cellValue) => {
|
|
303
|
+
return import_xe_utils.default.isBoolean(cellValue) ? cellValue ? "TRUE" : "FALSE" : cellValue;
|
|
333
304
|
};
|
|
334
|
-
const toStringValue = cellValue => {
|
|
335
|
-
return (0,
|
|
305
|
+
const toStringValue = (cellValue) => {
|
|
306
|
+
return (0, import_utils.eqEmptyValue)(cellValue) ? "" : `${cellValue}`;
|
|
336
307
|
};
|
|
337
308
|
const getBodyLabelData = (opts, columns, datas) => {
|
|
338
|
-
const {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
} = opts;
|
|
343
|
-
const {
|
|
344
|
-
treeConfig
|
|
345
|
-
} = props;
|
|
346
|
-
const {
|
|
347
|
-
isRowGroupStatus
|
|
348
|
-
} = reactData;
|
|
349
|
-
const {
|
|
350
|
-
fullColumnFieldData,
|
|
351
|
-
fullAllDataRowIdData
|
|
352
|
-
} = internalData;
|
|
309
|
+
const { isTreeAllExpanded, isRowGroupAllExpanded, mode: expMode } = opts;
|
|
310
|
+
const { treeConfig } = props;
|
|
311
|
+
const { isRowGroupStatus } = reactData;
|
|
312
|
+
const { fullColumnFieldData, fullAllDataRowIdData } = internalData;
|
|
353
313
|
const radioOpts = computeRadioOpts.value;
|
|
354
314
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
355
315
|
const treeOpts = computeTreeOpts.value;
|
|
@@ -357,50 +317,33 @@ hooks.add('tableExportModule', {
|
|
|
357
317
|
const aggregateOpts = computeAggregateOpts.value;
|
|
358
318
|
const rendererOpts = computeRendererOpts.value;
|
|
359
319
|
if (!htmlCellElem) {
|
|
360
|
-
htmlCellElem = document.createElement(
|
|
320
|
+
htmlCellElem = document.createElement("div");
|
|
361
321
|
}
|
|
362
|
-
const {
|
|
363
|
-
handleGetRowId
|
|
364
|
-
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
322
|
+
const { handleGetRowId } = (0, import_util.createHandleGetRowId)($xeTable);
|
|
365
323
|
if (isRowGroupStatus) {
|
|
366
|
-
|
|
367
|
-
const {
|
|
368
|
-
mode: aggMode,
|
|
369
|
-
showTotal,
|
|
370
|
-
totalMethod,
|
|
371
|
-
countFields,
|
|
372
|
-
contentMethod,
|
|
373
|
-
formatValuesMethod,
|
|
374
|
-
mapChildrenField
|
|
375
|
-
} = aggregateOpts;
|
|
324
|
+
const { mode: aggMode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
376
325
|
const rest = [];
|
|
377
326
|
const expandMaps = {};
|
|
378
327
|
const useMaps = {};
|
|
379
|
-
|
|
328
|
+
import_xe_utils.default.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
380
329
|
const row = item._row || item;
|
|
381
330
|
const rowid = handleGetRowId(row);
|
|
382
331
|
if (useMaps[rowid]) {
|
|
383
332
|
return;
|
|
384
333
|
}
|
|
385
334
|
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
386
|
-
const pRowid = parentRow ? handleGetRowId(parentRow) :
|
|
335
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : "";
|
|
387
336
|
if (isRowGroupAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isRowExpandByRow(parentRow)) {
|
|
388
337
|
const hasRowChild = mapChildrenField && row[mapChildrenField] && row[mapChildrenField].length;
|
|
389
|
-
const
|
|
338
|
+
const item2 = {
|
|
390
339
|
_row: row,
|
|
391
340
|
_level: nodes.length - 1,
|
|
392
341
|
_hasChild: hasRowChild,
|
|
393
342
|
_expand: hasRowChild && $xeTable.isRowExpandByRow(row)
|
|
394
343
|
};
|
|
395
344
|
columns.forEach((column, $columnIndex) => {
|
|
396
|
-
const {
|
|
397
|
-
|
|
398
|
-
editRender,
|
|
399
|
-
cellRender,
|
|
400
|
-
aggFunc,
|
|
401
|
-
rowGroupNode
|
|
402
|
-
} = column;
|
|
403
|
-
let cellValue = '';
|
|
345
|
+
const { field, editRender, cellRender, aggFunc, rowGroupNode } = column;
|
|
346
|
+
let cellValue = "";
|
|
404
347
|
const renderOpts = editRender || cellRender;
|
|
405
348
|
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
406
349
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
@@ -413,144 +356,124 @@ hooks.add('tableExportModule', {
|
|
|
413
356
|
bodyExportMethod = columnOpts.exportMethod;
|
|
414
357
|
}
|
|
415
358
|
if (bodyExportMethod) {
|
|
416
|
-
cellValue = bodyExportMethod({
|
|
417
|
-
$table: $xeTable,
|
|
418
|
-
row,
|
|
419
|
-
column,
|
|
420
|
-
options: opts
|
|
421
|
-
});
|
|
359
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
422
360
|
} else {
|
|
423
361
|
switch (column.type) {
|
|
424
|
-
case
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
362
|
+
case "seq": {
|
|
363
|
+
const seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
|
|
364
|
+
cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
case "checkbox": {
|
|
368
|
+
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
369
|
+
item2._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
370
|
+
item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
case "radio": {
|
|
374
|
+
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
375
|
+
item2._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
376
|
+
item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
default: {
|
|
380
|
+
if (field && row.isAggregate) {
|
|
381
|
+
const aggRow = row;
|
|
382
|
+
const aggData = aggRow.aggData;
|
|
383
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
384
|
+
const groupField = aggRow.groupField;
|
|
385
|
+
const groupContent = aggRow.groupContent;
|
|
386
|
+
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
387
|
+
const childCount = aggRow.childCount;
|
|
388
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
389
|
+
const ctParams = {
|
|
445
390
|
$table: $xeTable,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
391
|
+
groupField,
|
|
392
|
+
groupColumn: colRest ? colRest.column : null,
|
|
393
|
+
column,
|
|
394
|
+
groupValue: groupContent,
|
|
395
|
+
childList,
|
|
396
|
+
childCount,
|
|
397
|
+
aggValue: null,
|
|
398
|
+
/**
|
|
399
|
+
* 已废弃
|
|
400
|
+
* @deprecated
|
|
401
|
+
*/
|
|
402
|
+
children: childList,
|
|
403
|
+
/**
|
|
404
|
+
* 已废弃
|
|
405
|
+
* @deprecated
|
|
406
|
+
*/
|
|
407
|
+
totalValue: childCount
|
|
408
|
+
};
|
|
409
|
+
if (aggMode === "column" ? field === aggRow.groupField : rowGroupNode) {
|
|
410
|
+
cellValue = groupContent;
|
|
411
|
+
if (contentMethod) {
|
|
412
|
+
cellValue = `${contentMethod(ctParams)}`;
|
|
413
|
+
}
|
|
414
|
+
if (showTotal) {
|
|
415
|
+
cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
416
|
+
}
|
|
417
|
+
} else if ($xeTable.getPivotTableAggregateCellAggValue) {
|
|
418
|
+
const aggParams = {
|
|
462
419
|
$table: $xeTable,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
column,
|
|
466
|
-
groupValue: groupContent,
|
|
467
|
-
childList,
|
|
468
|
-
childCount,
|
|
469
|
-
aggValue: null,
|
|
470
|
-
/**
|
|
471
|
-
* 已废弃
|
|
472
|
-
* @deprecated
|
|
473
|
-
*/
|
|
474
|
-
children: childList,
|
|
475
|
-
/**
|
|
476
|
-
* 已废弃
|
|
477
|
-
* @deprecated
|
|
478
|
-
*/
|
|
479
|
-
totalValue: childCount
|
|
420
|
+
row,
|
|
421
|
+
column
|
|
480
422
|
};
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
488
|
-
}
|
|
489
|
-
} else if ($xeTable.getPivotTableAggregateCellAggValue) {
|
|
490
|
-
const aggParams = {
|
|
491
|
-
$table: $xeTable,
|
|
492
|
-
row,
|
|
493
|
-
column
|
|
494
|
-
};
|
|
495
|
-
cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams);
|
|
496
|
-
} else if (aggFunc === true || countFields && countFields.includes(field)) {
|
|
497
|
-
cellValue = currAggData ? currAggData.value : childCount;
|
|
498
|
-
ctParams.aggValue = cellValue;
|
|
499
|
-
if (formatValuesMethod) {
|
|
500
|
-
cellValue = formatValuesMethod(ctParams);
|
|
501
|
-
}
|
|
423
|
+
cellValue = $xeTable.getPivotTableAggregateCellAggValue(aggParams);
|
|
424
|
+
} else if (aggFunc === true || countFields && countFields.includes(field)) {
|
|
425
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
426
|
+
ctParams.aggValue = cellValue;
|
|
427
|
+
if (formatValuesMethod) {
|
|
428
|
+
cellValue = formatValuesMethod(ctParams);
|
|
502
429
|
}
|
|
503
|
-
}
|
|
504
|
-
|
|
430
|
+
}
|
|
431
|
+
} else if (opts.original) {
|
|
432
|
+
cellValue = (0, import_util.getCellValue)(row, column);
|
|
433
|
+
} else {
|
|
434
|
+
cellValue = $xeTable.getCellLabel(row, column);
|
|
435
|
+
if (column.type === "html") {
|
|
436
|
+
htmlCellElem.innerHTML = cellValue;
|
|
437
|
+
cellValue = htmlCellElem.innerText.trim();
|
|
505
438
|
} else {
|
|
506
|
-
|
|
507
|
-
if (
|
|
508
|
-
|
|
509
|
-
cellValue = htmlCellElem.innerText.trim();
|
|
510
|
-
} else {
|
|
511
|
-
const cell = $xeTable.getCellElement(row, column);
|
|
512
|
-
if (cell && !(0, _dom.hasClass)(cell, 'is--progress')) {
|
|
513
|
-
cellValue = cell.innerText.trim();
|
|
514
|
-
}
|
|
439
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
440
|
+
if (cell && !(0, import_dom.hasClass)(cell, "is--progress")) {
|
|
441
|
+
cellValue = cell.innerText.trim();
|
|
515
442
|
}
|
|
516
443
|
}
|
|
517
|
-
break;
|
|
518
444
|
}
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
519
447
|
}
|
|
520
448
|
}
|
|
521
|
-
|
|
449
|
+
item2[column.id] = toStringValue(cellValue);
|
|
522
450
|
});
|
|
523
451
|
useMaps[rowid] = true;
|
|
524
452
|
if (pRowid) {
|
|
525
453
|
expandMaps[pRowid] = true;
|
|
526
454
|
}
|
|
527
|
-
rest.push(Object.assign(
|
|
455
|
+
rest.push(Object.assign(item2, row));
|
|
528
456
|
}
|
|
529
|
-
}, {
|
|
530
|
-
children: mapChildrenField
|
|
531
|
-
});
|
|
457
|
+
}, { children: mapChildrenField });
|
|
532
458
|
return rest;
|
|
533
459
|
}
|
|
534
460
|
if (treeConfig) {
|
|
535
|
-
|
|
536
|
-
const {
|
|
537
|
-
seqMode
|
|
538
|
-
} = treeOpts;
|
|
461
|
+
const { seqMode } = treeOpts;
|
|
539
462
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
540
463
|
const rest = [];
|
|
541
464
|
const expandMaps = {};
|
|
542
465
|
const useMaps = {};
|
|
543
|
-
|
|
466
|
+
import_xe_utils.default.eachTree(datas, (item, $rowIndex, items, path, parentItem, nodes) => {
|
|
544
467
|
const row = item._row || item;
|
|
545
468
|
const rowid = handleGetRowId(row);
|
|
546
469
|
if (useMaps[rowid]) {
|
|
547
470
|
return;
|
|
548
471
|
}
|
|
549
472
|
const parentRow = parentItem && parentItem._row ? parentItem._row : parentItem;
|
|
550
|
-
const pRowid = parentRow ? handleGetRowId(parentRow) :
|
|
473
|
+
const pRowid = parentRow ? handleGetRowId(parentRow) : "";
|
|
551
474
|
if (isTreeAllExpanded || !parentRow || expandMaps[pRowid] && $xeTable.isTreeExpandByRow(parentRow)) {
|
|
552
475
|
const hasRowChild = row[childrenField] && row[childrenField].length;
|
|
553
|
-
const
|
|
476
|
+
const item2 = {
|
|
554
477
|
_row: row,
|
|
555
478
|
_level: nodes.length - 1,
|
|
556
479
|
_hasChild: hasRowChild,
|
|
@@ -558,7 +481,7 @@ hooks.add('tableExportModule', {
|
|
|
558
481
|
};
|
|
559
482
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
560
483
|
columns.forEach((column, $columnIndex) => {
|
|
561
|
-
let cellValue =
|
|
484
|
+
let cellValue = "";
|
|
562
485
|
const renderOpts = column.editRender || column.cellRender;
|
|
563
486
|
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
564
487
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
@@ -571,67 +494,53 @@ hooks.add('tableExportModule', {
|
|
|
571
494
|
bodyExportMethod = columnOpts.exportMethod;
|
|
572
495
|
}
|
|
573
496
|
if (bodyExportMethod) {
|
|
574
|
-
cellValue = bodyExportMethod({
|
|
575
|
-
$table: $xeTable,
|
|
576
|
-
row,
|
|
577
|
-
column,
|
|
578
|
-
options: opts
|
|
579
|
-
});
|
|
497
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
580
498
|
} else {
|
|
581
499
|
switch (column.type) {
|
|
582
|
-
case
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
seqVal = rowRest ? rowRest._index + 1 : -1;
|
|
587
|
-
}
|
|
588
|
-
cellValue = expMode === 'all' ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
589
|
-
break;
|
|
500
|
+
case "seq": {
|
|
501
|
+
let seqVal = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : ".").join("");
|
|
502
|
+
if (seqMode === "increasing") {
|
|
503
|
+
seqVal = rowRest ? rowRest._index + 1 : -1;
|
|
590
504
|
}
|
|
591
|
-
|
|
505
|
+
cellValue = expMode === "all" ? seqVal : getSeq(seqVal, row, $rowIndex, column, $columnIndex);
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
case "checkbox":
|
|
592
509
|
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
$table: $xeTable,
|
|
596
|
-
row
|
|
597
|
-
});
|
|
510
|
+
item2._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
511
|
+
item2._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
598
512
|
break;
|
|
599
|
-
case
|
|
513
|
+
case "radio":
|
|
600
514
|
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
$table: $xeTable,
|
|
604
|
-
row
|
|
605
|
-
});
|
|
515
|
+
item2._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
516
|
+
item2._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
606
517
|
break;
|
|
607
518
|
default:
|
|
608
519
|
if (opts.original) {
|
|
609
|
-
cellValue = (0,
|
|
520
|
+
cellValue = (0, import_util.getCellValue)(row, column);
|
|
610
521
|
} else {
|
|
611
522
|
cellValue = $xeTable.getCellLabel(row, column);
|
|
612
|
-
if (column.type ===
|
|
523
|
+
if (column.type === "html") {
|
|
613
524
|
htmlCellElem.innerHTML = cellValue;
|
|
614
525
|
cellValue = htmlCellElem.innerText.trim();
|
|
615
526
|
} else {
|
|
616
527
|
const cell = $xeTable.getCellElement(row, column);
|
|
617
|
-
if (cell && !(0,
|
|
528
|
+
if (cell && !(0, import_dom.hasClass)(cell, "is--progress")) {
|
|
618
529
|
cellValue = cell.innerText.trim();
|
|
619
530
|
}
|
|
620
531
|
}
|
|
621
532
|
}
|
|
622
533
|
}
|
|
623
534
|
}
|
|
624
|
-
|
|
535
|
+
item2[column.id] = toStringValue(cellValue);
|
|
625
536
|
});
|
|
626
537
|
useMaps[rowid] = true;
|
|
627
538
|
if (pRowid) {
|
|
628
539
|
expandMaps[pRowid] = true;
|
|
629
540
|
}
|
|
630
|
-
rest.push(Object.assign(
|
|
541
|
+
rest.push(Object.assign(item2, row));
|
|
631
542
|
}
|
|
632
|
-
}, {
|
|
633
|
-
children: childrenField
|
|
634
|
-
});
|
|
543
|
+
}, { children: childrenField });
|
|
635
544
|
return rest;
|
|
636
545
|
}
|
|
637
546
|
return datas.map((row, $rowIndex) => {
|
|
@@ -639,7 +548,7 @@ hooks.add('tableExportModule', {
|
|
|
639
548
|
_row: row
|
|
640
549
|
};
|
|
641
550
|
columns.forEach((column, $columnIndex) => {
|
|
642
|
-
let cellValue =
|
|
551
|
+
let cellValue = "";
|
|
643
552
|
const renderOpts = column.editRender || column.cellRender;
|
|
644
553
|
let bodyExportMethod = column.exportMethod || columnOpts.exportMethod;
|
|
645
554
|
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
|
@@ -649,47 +558,35 @@ hooks.add('tableExportModule', {
|
|
|
649
558
|
}
|
|
650
559
|
}
|
|
651
560
|
if (bodyExportMethod) {
|
|
652
|
-
cellValue = bodyExportMethod({
|
|
653
|
-
$table: $xeTable,
|
|
654
|
-
row,
|
|
655
|
-
column,
|
|
656
|
-
options: opts
|
|
657
|
-
});
|
|
561
|
+
cellValue = bodyExportMethod({ $table: $xeTable, row, column, options: opts });
|
|
658
562
|
} else {
|
|
659
563
|
switch (column.type) {
|
|
660
|
-
case
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
case 'checkbox':
|
|
564
|
+
case "seq": {
|
|
565
|
+
const seqValue = $rowIndex + 1;
|
|
566
|
+
cellValue = expMode === "all" ? seqValue : getSeq(seqValue, row, $rowIndex, column, $columnIndex);
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
case "checkbox":
|
|
667
570
|
cellValue = toBooleanValue($xeTable.isCheckedByCheckboxRow(row));
|
|
668
|
-
item._checkboxLabel = checkboxOpts.labelField ?
|
|
669
|
-
item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({
|
|
670
|
-
$table: $xeTable,
|
|
671
|
-
row
|
|
672
|
-
});
|
|
571
|
+
item._checkboxLabel = checkboxOpts.labelField ? import_xe_utils.default.get(row, checkboxOpts.labelField) : "";
|
|
572
|
+
item._checkboxDisabled = checkboxOpts.checkMethod && !checkboxOpts.checkMethod({ $table: $xeTable, row });
|
|
673
573
|
break;
|
|
674
|
-
case
|
|
574
|
+
case "radio":
|
|
675
575
|
cellValue = toBooleanValue($xeTable.isCheckedByRadioRow(row));
|
|
676
|
-
item._radioLabel = radioOpts.labelField ?
|
|
677
|
-
item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({
|
|
678
|
-
$table: $xeTable,
|
|
679
|
-
row
|
|
680
|
-
});
|
|
576
|
+
item._radioLabel = radioOpts.labelField ? import_xe_utils.default.get(row, radioOpts.labelField) : "";
|
|
577
|
+
item._radioDisabled = radioOpts.checkMethod && !radioOpts.checkMethod({ $table: $xeTable, row });
|
|
681
578
|
break;
|
|
682
579
|
default:
|
|
683
580
|
if (opts.original) {
|
|
684
|
-
cellValue = (0,
|
|
581
|
+
cellValue = (0, import_util.getCellValue)(row, column);
|
|
685
582
|
} else {
|
|
686
583
|
cellValue = $xeTable.getCellLabel(row, column);
|
|
687
|
-
if (column.type ===
|
|
584
|
+
if (column.type === "html") {
|
|
688
585
|
htmlCellElem.innerHTML = cellValue;
|
|
689
586
|
cellValue = htmlCellElem.innerText.trim();
|
|
690
587
|
} else {
|
|
691
588
|
const cell = $xeTable.getCellElement(row, column);
|
|
692
|
-
if (cell && !(0,
|
|
589
|
+
if (cell && !(0, import_dom.hasClass)(cell, "is--progress")) {
|
|
693
590
|
cellValue = cell.innerText.trim();
|
|
694
591
|
}
|
|
695
592
|
}
|
|
@@ -701,22 +598,13 @@ hooks.add('tableExportModule', {
|
|
|
701
598
|
return item;
|
|
702
599
|
});
|
|
703
600
|
};
|
|
704
|
-
const getExportData = opts => {
|
|
601
|
+
const getExportData = (opts) => {
|
|
705
602
|
const $xeGrid = $xeTable.xeGrid;
|
|
706
603
|
const $xeGantt = $xeTable.xeGantt;
|
|
707
|
-
const {
|
|
708
|
-
columns,
|
|
709
|
-
dataFilterMethod
|
|
710
|
-
} = opts;
|
|
604
|
+
const { columns, dataFilterMethod } = opts;
|
|
711
605
|
let datas = opts.data;
|
|
712
606
|
if (dataFilterMethod) {
|
|
713
|
-
datas = datas.filter((row, index) => dataFilterMethod({
|
|
714
|
-
$table: $xeTable,
|
|
715
|
-
$grid: $xeGrid,
|
|
716
|
-
$gantt: $xeGantt,
|
|
717
|
-
row,
|
|
718
|
-
$rowIndex: index
|
|
719
|
-
}));
|
|
607
|
+
datas = datas.filter((row, index) => dataFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, row, $rowIndex: index }));
|
|
720
608
|
}
|
|
721
609
|
return getBodyLabelData(opts, columns, datas);
|
|
722
610
|
};
|
|
@@ -736,490 +624,422 @@ hooks.add('tableExportModule', {
|
|
|
736
624
|
}
|
|
737
625
|
if (footLabelMethod) {
|
|
738
626
|
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
739
|
-
return footLabelMethod({
|
|
740
|
-
$table: $xeTable,
|
|
741
|
-
items: row,
|
|
742
|
-
itemIndex: _columnIndex,
|
|
743
|
-
row,
|
|
744
|
-
_columnIndex,
|
|
745
|
-
column,
|
|
746
|
-
options: opts
|
|
747
|
-
});
|
|
627
|
+
return footLabelMethod({ $table: $xeTable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts });
|
|
748
628
|
}
|
|
749
629
|
const cellValue = $xeTable.getFooterCellLabel(row, column);
|
|
750
630
|
return cellValue;
|
|
751
631
|
};
|
|
752
|
-
const toCsv = ($
|
|
632
|
+
const toCsv = ($xeTable2, opts, columns, datas) => {
|
|
753
633
|
let content = csvBOM;
|
|
754
634
|
if (opts.isHeader) {
|
|
755
|
-
content += columns.map(column => toTxtCellLabel(getHeaderTitle(opts, column))).join(
|
|
635
|
+
content += columns.map((column) => toTxtCellLabel(getHeaderTitle(opts, column))).join(",") + enterSymbol;
|
|
756
636
|
}
|
|
757
|
-
datas.forEach(row => {
|
|
758
|
-
content += columns.map(column => toTxtCellLabel(getCsvCellTypeLabel(column, row[column.id]))).join(
|
|
637
|
+
datas.forEach((row) => {
|
|
638
|
+
content += columns.map((column) => toTxtCellLabel(getCsvCellTypeLabel(column, row[column.id]))).join(",") + enterSymbol;
|
|
759
639
|
});
|
|
760
640
|
if (opts.isFooter) {
|
|
761
|
-
const {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
footers.forEach(row => {
|
|
766
|
-
content += columns.map(column => toTxtCellLabel(getFooterCellValue(opts, row, column))).join(',') + enterSymbol;
|
|
641
|
+
const { footerTableData } = reactData;
|
|
642
|
+
const footers = getFooterData($xeTable2, opts, footerTableData);
|
|
643
|
+
footers.forEach((row) => {
|
|
644
|
+
content += columns.map((column) => toTxtCellLabel(getFooterCellValue(opts, row, column))).join(",") + enterSymbol;
|
|
767
645
|
});
|
|
768
646
|
}
|
|
769
647
|
return content;
|
|
770
648
|
};
|
|
771
|
-
const toTxt = ($
|
|
772
|
-
let content =
|
|
649
|
+
const toTxt = ($xeTable2, opts, columns, datas) => {
|
|
650
|
+
let content = "";
|
|
773
651
|
if (opts.isHeader) {
|
|
774
|
-
content += columns.map(column => toTxtCellLabel(getHeaderTitle(opts, column))).join(
|
|
652
|
+
content += columns.map((column) => toTxtCellLabel(getHeaderTitle(opts, column))).join(" ") + enterSymbol;
|
|
775
653
|
}
|
|
776
|
-
datas.forEach(row => {
|
|
777
|
-
content += columns.map(column => toTxtCellLabel(row[column.id])).join(
|
|
654
|
+
datas.forEach((row) => {
|
|
655
|
+
content += columns.map((column) => toTxtCellLabel(row[column.id])).join(" ") + enterSymbol;
|
|
778
656
|
});
|
|
779
657
|
if (opts.isFooter) {
|
|
780
|
-
const {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
footers.forEach(row => {
|
|
785
|
-
content += columns.map(column => toTxtCellLabel(getFooterCellValue(opts, row, column))).join('\t') + enterSymbol;
|
|
658
|
+
const { footerTableData } = reactData;
|
|
659
|
+
const footers = getFooterData($xeTable2, opts, footerTableData);
|
|
660
|
+
footers.forEach((row) => {
|
|
661
|
+
content += columns.map((column) => toTxtCellLabel(getFooterCellValue(opts, row, column))).join(" ") + enterSymbol;
|
|
786
662
|
});
|
|
787
663
|
}
|
|
788
664
|
return content;
|
|
789
665
|
};
|
|
790
666
|
const hasEllipsis = (column, property, allColumnOverflow) => {
|
|
791
667
|
const columnOverflow = column[property];
|
|
792
|
-
const headOverflow =
|
|
793
|
-
const showEllipsis = headOverflow ===
|
|
794
|
-
const showTitle = headOverflow ===
|
|
795
|
-
const showTooltip = headOverflow === true || headOverflow ===
|
|
668
|
+
const headOverflow = import_xe_utils.default.isUndefined(columnOverflow) || import_xe_utils.default.isNull(columnOverflow) ? allColumnOverflow : columnOverflow;
|
|
669
|
+
const showEllipsis = headOverflow === "ellipsis";
|
|
670
|
+
const showTitle = headOverflow === "title";
|
|
671
|
+
const showTooltip = headOverflow === true || headOverflow === "tooltip";
|
|
796
672
|
let isEllipsis = showTitle || showTooltip || showEllipsis;
|
|
797
|
-
|
|
798
|
-
const {
|
|
799
|
-
scrollXLoad,
|
|
800
|
-
scrollYLoad
|
|
801
|
-
} = reactData;
|
|
673
|
+
const { scrollXLoad, scrollYLoad } = reactData;
|
|
802
674
|
if ((scrollXLoad || scrollYLoad) && !isEllipsis) {
|
|
803
675
|
isEllipsis = true;
|
|
804
676
|
}
|
|
805
677
|
return isEllipsis;
|
|
806
678
|
};
|
|
807
|
-
const getCustomColKey = conf => {
|
|
808
|
-
return `${conf.field ||
|
|
679
|
+
const getCustomColKey = (conf) => {
|
|
680
|
+
return `${conf.field || ""}:${conf.type || ""}`;
|
|
809
681
|
};
|
|
810
682
|
const toHtml = (opts, columns, datas) => {
|
|
811
|
-
const {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
treeConfig,
|
|
815
|
-
headerAlign: allHeaderAlign,
|
|
816
|
-
align: allAlign,
|
|
817
|
-
footerAlign: allFooterAlign,
|
|
818
|
-
showOverflow: allColumnOverflow,
|
|
819
|
-
showHeaderOverflow: allColumnHeaderOverflow
|
|
820
|
-
} = props;
|
|
821
|
-
const {
|
|
822
|
-
isAllSelected,
|
|
823
|
-
isIndeterminate
|
|
824
|
-
} = reactData;
|
|
825
|
-
const {
|
|
826
|
-
mergeBodyCellMaps,
|
|
827
|
-
mergeFooterCellMaps
|
|
828
|
-
} = internalData;
|
|
683
|
+
const { id, border, treeConfig, headerAlign: allHeaderAlign, align: allAlign, footerAlign: allFooterAlign, showOverflow: allColumnOverflow, showHeaderOverflow: allColumnHeaderOverflow } = props;
|
|
684
|
+
const { isAllSelected, isIndeterminate } = reactData;
|
|
685
|
+
const { mergeBodyCellMaps, mergeFooterCellMaps } = internalData;
|
|
829
686
|
const treeOpts = computeTreeOpts.value;
|
|
830
|
-
const {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
isHeader,
|
|
834
|
-
isFooter,
|
|
835
|
-
isColgroup,
|
|
836
|
-
isMerge,
|
|
837
|
-
colgroups,
|
|
838
|
-
_columnConfs,
|
|
839
|
-
original
|
|
840
|
-
} = opts;
|
|
841
|
-
const isAutoWidth = widthMode === 'auto';
|
|
842
|
-
const isScaleWidth = widthMode === 'scale';
|
|
687
|
+
const { print: isPrint, widthMode, isHeader, isFooter, isColgroup, isMerge, colgroups, _columnConfs, original } = opts;
|
|
688
|
+
const isAutoWidth = widthMode === "auto";
|
|
689
|
+
const isScaleWidth = widthMode === "scale";
|
|
843
690
|
const isDefaultWidth = !isAutoWidth && !isScaleWidth;
|
|
844
691
|
const customWidthMaps = {};
|
|
845
692
|
if (_columnConfs) {
|
|
846
|
-
_columnConfs.forEach(conf => {
|
|
847
|
-
if (!(0,
|
|
693
|
+
_columnConfs.forEach((conf) => {
|
|
694
|
+
if (!(0, import_util.isColumnInfo)(conf)) {
|
|
848
695
|
if ((conf.field || conf.type) && conf.width) {
|
|
849
696
|
customWidthMaps[getCustomColKey(conf)] = conf.width;
|
|
850
697
|
}
|
|
851
698
|
}
|
|
852
699
|
});
|
|
853
700
|
}
|
|
854
|
-
// 计算宽度
|
|
855
701
|
const colWidthMaps = {};
|
|
856
702
|
const printWidthMaps = {};
|
|
857
703
|
if (isPrint) {
|
|
858
704
|
let tableWidth = 0;
|
|
859
|
-
columns.forEach(column => {
|
|
705
|
+
columns.forEach((column) => {
|
|
860
706
|
tableWidth += column.renderWidth;
|
|
861
707
|
});
|
|
862
708
|
if (colgroups) {
|
|
863
|
-
colgroups.forEach(cols => {
|
|
864
|
-
cols.forEach(column => {
|
|
709
|
+
colgroups.forEach((cols) => {
|
|
710
|
+
cols.forEach((column) => {
|
|
865
711
|
if (!column.childNodes || !column.childNodes.length) {
|
|
866
712
|
return;
|
|
867
713
|
}
|
|
868
714
|
let childWidth = 0;
|
|
869
715
|
let countChild = 0;
|
|
870
|
-
|
|
716
|
+
import_xe_utils.default.eachTree([column], (item) => {
|
|
871
717
|
if (!item.childNodes || !column.childNodes.length) {
|
|
872
718
|
countChild++;
|
|
873
719
|
}
|
|
874
720
|
const ptWidth = printWidthMaps[item.id];
|
|
875
721
|
childWidth += ptWidth || 0;
|
|
876
|
-
}, {
|
|
877
|
-
children: 'childNodes'
|
|
878
|
-
});
|
|
722
|
+
}, { children: "childNodes" });
|
|
879
723
|
const colWidth = childWidth - countChild;
|
|
880
724
|
colWidthMaps[column.id] = colWidth;
|
|
881
|
-
printWidthMaps[column.id] =
|
|
725
|
+
printWidthMaps[column.id] = import_xe_utils.default.floor(colWidth / tableWidth * 180, 2);
|
|
882
726
|
});
|
|
883
727
|
});
|
|
884
728
|
}
|
|
885
|
-
columns.forEach(column => {
|
|
729
|
+
columns.forEach((column) => {
|
|
886
730
|
const colWidth = column.renderWidth;
|
|
887
731
|
if (column.width) {
|
|
888
732
|
colWidthMaps[column.id] = colWidth;
|
|
889
733
|
}
|
|
890
|
-
printWidthMaps[column.id] =
|
|
734
|
+
printWidthMaps[column.id] = import_xe_utils.default.floor(colWidth / tableWidth * 180, 2);
|
|
891
735
|
});
|
|
892
736
|
}
|
|
893
|
-
const getHeaderWidthStyle = column => {
|
|
737
|
+
const getHeaderWidthStyle = (column) => {
|
|
894
738
|
const cmColKey = getCustomColKey(column);
|
|
895
739
|
const cmWidthMaps = customWidthMaps[cmColKey];
|
|
896
740
|
if (cmWidthMaps) {
|
|
897
|
-
return
|
|
741
|
+
return "width:" + (0, import_dom.toCssUnit)(cmWidthMaps);
|
|
898
742
|
}
|
|
899
743
|
if (isAutoWidth) {
|
|
900
|
-
return
|
|
744
|
+
return "";
|
|
901
745
|
}
|
|
902
746
|
if (isScaleWidth) {
|
|
903
|
-
return printWidthMaps[column.id] ?
|
|
747
|
+
return printWidthMaps[column.id] ? "width:" + printWidthMaps[column.id] + "mm" : "";
|
|
904
748
|
}
|
|
905
|
-
return colWidthMaps[column.id] ?
|
|
749
|
+
return colWidthMaps[column.id] ? "width:" + (0, import_dom.toCssUnit)(colWidthMaps[column.id]) : "";
|
|
906
750
|
};
|
|
907
|
-
const getCellWidthStyle = column => {
|
|
751
|
+
const getCellWidthStyle = (column) => {
|
|
908
752
|
const cmColKey = getCustomColKey(column);
|
|
909
753
|
const cmWidthMaps = customWidthMaps[cmColKey];
|
|
910
754
|
if (cmWidthMaps) {
|
|
911
|
-
return
|
|
755
|
+
return "width:" + (0, import_dom.toCssUnit)(cmWidthMaps);
|
|
912
756
|
}
|
|
913
757
|
if (isAutoWidth || isDefaultWidth) {
|
|
914
|
-
return
|
|
758
|
+
return "";
|
|
915
759
|
}
|
|
916
760
|
if (isScaleWidth) {
|
|
917
|
-
return printWidthMaps[column.id] ?
|
|
761
|
+
return printWidthMaps[column.id] ? "width:" + printWidthMaps[column.id] + "mm" : "";
|
|
918
762
|
}
|
|
919
|
-
return colWidthMaps[column.id] ?
|
|
763
|
+
return colWidthMaps[column.id] ? "width:" + (0, import_dom.toCssUnit)(colWidthMaps[column.id]) : "";
|
|
920
764
|
};
|
|
921
|
-
const allCls =
|
|
922
|
-
const clss = [
|
|
923
|
-
|
|
765
|
+
const allCls = "check-all";
|
|
766
|
+
const clss = [
|
|
767
|
+
"vxe-table",
|
|
768
|
+
`border--${toTableBorder(border)}`,
|
|
769
|
+
isPrint ? "is--print" : "",
|
|
770
|
+
isAutoWidth ? "is--auto-width" : "",
|
|
771
|
+
isScaleWidth ? "is--scale-width" : "",
|
|
772
|
+
isDefaultWidth ? "is--default-width" : "",
|
|
773
|
+
isHeader ? "is--header" : ""
|
|
774
|
+
].filter((cls) => cls);
|
|
775
|
+
const tables = [
|
|
776
|
+
`<table class="${clss.join(" ")}" border="0" cellspacing="0" cellpadding="0">`,
|
|
777
|
+
`<colgroup>${columns.map((column) => `<col style="${getHeaderWidthStyle(column)}">`).join("")}</colgroup>`
|
|
778
|
+
];
|
|
924
779
|
if (isHeader) {
|
|
925
|
-
tables.push(
|
|
780
|
+
tables.push("<thead>");
|
|
926
781
|
if (isColgroup && !original) {
|
|
927
|
-
colgroups.forEach(cols => {
|
|
928
|
-
tables.push(
|
|
782
|
+
colgroups.forEach((cols) => {
|
|
783
|
+
tables.push(
|
|
784
|
+
`<tr>${cols.map((column) => {
|
|
785
|
+
const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
|
|
786
|
+
const classNames = hasEllipsis(column, "showHeaderOverflow", allColumnHeaderOverflow) ? ["col--ellipsis"] : [];
|
|
787
|
+
const cellTitle = getHeaderTitle(opts, column);
|
|
788
|
+
if (headAlign) {
|
|
789
|
+
classNames.push(`col--${headAlign}`);
|
|
790
|
+
}
|
|
791
|
+
if (column.type === "checkbox") {
|
|
792
|
+
return `<th class="${classNames.join(" ")}" colspan="${column._colSpan}" rowspan="${column._rowSpan}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" class="${allCls}" ${isAllSelected ? "checked" : ""}><span>${cellTitle}</span></div></th>`;
|
|
793
|
+
}
|
|
794
|
+
return `<th class="${classNames.join(" ")}" colspan="${column._colSpan}" rowspan="${column._rowSpan}" title="${cellTitle}"><div style="${getCellWidthStyle(column)}"><span>${(0, import_utils.formatText)(cellTitle, true)}</span></div></th>`;
|
|
795
|
+
}).join("")}</tr>`
|
|
796
|
+
);
|
|
797
|
+
});
|
|
798
|
+
} else {
|
|
799
|
+
tables.push(
|
|
800
|
+
`<tr>${columns.map((column) => {
|
|
929
801
|
const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
|
|
930
|
-
const classNames = hasEllipsis(column,
|
|
802
|
+
const classNames = hasEllipsis(column, "showHeaderOverflow", allColumnHeaderOverflow) ? ["col--ellipsis"] : [];
|
|
931
803
|
const cellTitle = getHeaderTitle(opts, column);
|
|
932
804
|
if (headAlign) {
|
|
933
805
|
classNames.push(`col--${headAlign}`);
|
|
934
806
|
}
|
|
935
|
-
if (column.type ===
|
|
936
|
-
return `<th class="${classNames.join(
|
|
807
|
+
if (column.type === "checkbox") {
|
|
808
|
+
return `<th class="${classNames.join(" ")}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" class="${allCls}" ${isAllSelected ? "checked" : ""}><span>${cellTitle}</span></div></th>`;
|
|
937
809
|
}
|
|
938
|
-
return `<th class="${classNames.join(
|
|
939
|
-
}).join(
|
|
940
|
-
|
|
941
|
-
} else {
|
|
942
|
-
tables.push(`<tr>${columns.map(column => {
|
|
943
|
-
const headAlign = column.headerAlign || column.align || allHeaderAlign || allAlign;
|
|
944
|
-
const classNames = hasEllipsis(column, 'showHeaderOverflow', allColumnHeaderOverflow) ? ['col--ellipsis'] : [];
|
|
945
|
-
const cellTitle = getHeaderTitle(opts, column);
|
|
946
|
-
if (headAlign) {
|
|
947
|
-
classNames.push(`col--${headAlign}`);
|
|
948
|
-
}
|
|
949
|
-
if (column.type === 'checkbox') {
|
|
950
|
-
return `<th class="${classNames.join(' ')}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" class="${allCls}" ${isAllSelected ? 'checked' : ''}><span>${cellTitle}</span></div></th>`;
|
|
951
|
-
}
|
|
952
|
-
return `<th class="${classNames.join(' ')}" title="${cellTitle}"><div style="${getCellWidthStyle(column)}"><span>${(0, _utils.formatText)(cellTitle, true)}</span></div></th>`;
|
|
953
|
-
}).join('')}</tr>`);
|
|
810
|
+
return `<th class="${classNames.join(" ")}" title="${cellTitle}"><div style="${getCellWidthStyle(column)}"><span>${(0, import_utils.formatText)(cellTitle, true)}</span></div></th>`;
|
|
811
|
+
}).join("")}</tr>`
|
|
812
|
+
);
|
|
954
813
|
}
|
|
955
|
-
tables.push(
|
|
814
|
+
tables.push("</thead>");
|
|
956
815
|
}
|
|
957
816
|
if (datas.length) {
|
|
958
|
-
tables.push(
|
|
817
|
+
tables.push("<tbody>");
|
|
959
818
|
if (treeConfig) {
|
|
960
|
-
datas.forEach(item => {
|
|
961
|
-
tables.push(
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
if (column.treeNode) {
|
|
970
|
-
let treeIcon = '';
|
|
971
|
-
if (item._hasChild) {
|
|
972
|
-
treeIcon = `<i class="${item._expand ? 'vxe-table--tree-fold-icon' : 'vxe-table--tree-unfold-icon'}"></i>`;
|
|
819
|
+
datas.forEach((item) => {
|
|
820
|
+
tables.push(
|
|
821
|
+
"<tr>" + columns.map((column) => {
|
|
822
|
+
const colid = column.id;
|
|
823
|
+
const cellAlign = column.align || allAlign;
|
|
824
|
+
const classNames = hasEllipsis(column, "showOverflow", allColumnOverflow) ? ["col--ellipsis"] : [];
|
|
825
|
+
const cellValue = item[colid];
|
|
826
|
+
if (cellAlign) {
|
|
827
|
+
classNames.push(`col--${cellAlign}`);
|
|
973
828
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
829
|
+
if (column.treeNode) {
|
|
830
|
+
let treeIcon = "";
|
|
831
|
+
if (item._hasChild) {
|
|
832
|
+
treeIcon = `<i class="${item._expand ? "vxe-table--tree-fold-icon" : "vxe-table--tree-unfold-icon"}"></i>`;
|
|
833
|
+
}
|
|
834
|
+
classNames.push("vxe-table--tree-node");
|
|
835
|
+
if (column.type === "radio") {
|
|
836
|
+
return `<td class="${classNames.join(" ")}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="radio" name="radio_${id}" ${item._radioDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._radioLabel}</span></div></div></div></td>`;
|
|
837
|
+
} else if (column.type === "checkbox") {
|
|
838
|
+
return `<td class="${classNames.join(" ")}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell"><input type="checkbox" ${item._checkboxDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._checkboxLabel}</span></div></div></div></td>`;
|
|
839
|
+
}
|
|
840
|
+
return `<td class="${classNames.join(" ")}" title="${cellValue}"><div style="${getCellWidthStyle(column)}"><div class="vxe-table--tree-node-wrapper" style="padding-left: ${item._level * treeOpts.indent}px"><div class="vxe-table--tree-icon-wrapper">${treeIcon}</div><div class="vxe-table--tree-cell">${cellValue}</div></div></div></td>`;
|
|
979
841
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
return `<td class="${classNames.join(
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
}).join('') + '</tr>');
|
|
842
|
+
if (column.type === "radio") {
|
|
843
|
+
return `<td class="${classNames.join(" ")}"><div style="${getCellWidthStyle(column)}"><input type="radio" name="radio_${id}" ${item._radioDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._radioLabel}</span></div></td>`;
|
|
844
|
+
} else if (column.type === "checkbox") {
|
|
845
|
+
return `<td class="${classNames.join(" ")}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" ${item._checkboxDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._checkboxLabel}</span></div></td>`;
|
|
846
|
+
}
|
|
847
|
+
return `<td class="${classNames.join(" ")}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${(0, import_utils.formatText)(cellValue, true)}</div></td>`;
|
|
848
|
+
}).join("") + "</tr>"
|
|
849
|
+
);
|
|
989
850
|
});
|
|
990
851
|
} else {
|
|
991
|
-
datas.forEach(item => {
|
|
992
|
-
tables.push(
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
rowspan,
|
|
1005
|
-
colspan
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
colSpan = colspan;
|
|
852
|
+
datas.forEach((item) => {
|
|
853
|
+
tables.push(
|
|
854
|
+
"<tr>" + columns.map((column) => {
|
|
855
|
+
const cellAlign = column.align || allAlign;
|
|
856
|
+
const classNames = hasEllipsis(column, "showOverflow", allColumnOverflow) ? ["col--ellipsis"] : [];
|
|
857
|
+
const cellValue = item[column.id];
|
|
858
|
+
let rowSpan = 1;
|
|
859
|
+
let colSpan = 1;
|
|
860
|
+
if (isMerge) {
|
|
861
|
+
const _rowIndex = $xeTable.getVTRowIndex(item._row);
|
|
862
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
863
|
+
const spanRest = mergeBodyCellMaps[`${_rowIndex}:${_columnIndex}`];
|
|
864
|
+
if (spanRest) {
|
|
865
|
+
const { rowspan, colspan } = spanRest;
|
|
866
|
+
if (!rowspan || !colspan) {
|
|
867
|
+
return "";
|
|
868
|
+
}
|
|
869
|
+
if (rowspan > 1) {
|
|
870
|
+
rowSpan = rowspan;
|
|
871
|
+
}
|
|
872
|
+
if (colspan > 1) {
|
|
873
|
+
colSpan = colspan;
|
|
874
|
+
}
|
|
1015
875
|
}
|
|
1016
876
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
877
|
+
if (cellAlign) {
|
|
878
|
+
classNames.push(`col--${cellAlign}`);
|
|
879
|
+
}
|
|
880
|
+
if (column.type === "radio") {
|
|
881
|
+
return `<td class="${classNames.join(" ")}" rowspan="${rowSpan}" colspan="${colSpan}"><div style="${getCellWidthStyle(column)}"><input type="radio" name="radio_${id}" ${item._radioDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._radioLabel}</span></div></td>`;
|
|
882
|
+
} else if (column.type === "checkbox") {
|
|
883
|
+
return `<td class="${classNames.join(" ")}" rowspan="${rowSpan}" colspan="${colSpan}"><div style="${getCellWidthStyle(column)}"><input type="checkbox" ${item._checkboxDisabled ? "disabled " : ""}${getBooleanValue(cellValue) ? "checked" : ""}><span>${item._checkboxLabel}</span></div></td>`;
|
|
884
|
+
}
|
|
885
|
+
return `<td class="${classNames.join(" ")}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${(0, import_utils.formatText)(cellValue, true)}</div></td>`;
|
|
886
|
+
}).join("") + "</tr>"
|
|
887
|
+
);
|
|
1028
888
|
});
|
|
1029
889
|
}
|
|
1030
|
-
tables.push(
|
|
890
|
+
tables.push("</tbody>");
|
|
1031
891
|
}
|
|
1032
892
|
if (isFooter) {
|
|
1033
|
-
const {
|
|
1034
|
-
footerTableData
|
|
1035
|
-
} = reactData;
|
|
893
|
+
const { footerTableData } = reactData;
|
|
1036
894
|
const footers = getFooterData($xeTable, opts, footerTableData);
|
|
1037
895
|
if (footers.length) {
|
|
1038
|
-
tables.push(
|
|
896
|
+
tables.push("<tfoot>");
|
|
1039
897
|
footers.forEach((row, rIndex) => {
|
|
1040
|
-
tables.push(
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
rowspan,
|
|
1053
|
-
colspan
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
colSpan = colspan;
|
|
898
|
+
tables.push(
|
|
899
|
+
`<tr>${columns.map((column) => {
|
|
900
|
+
const footAlign = column.footerAlign || column.align || allFooterAlign || allAlign;
|
|
901
|
+
const classNames = hasEllipsis(column, "showOverflow", allColumnOverflow) ? ["col--ellipsis"] : [];
|
|
902
|
+
const cellValue = getFooterCellValue(opts, row, column);
|
|
903
|
+
let rowSpan = 1;
|
|
904
|
+
let colSpan = 1;
|
|
905
|
+
if (isMerge) {
|
|
906
|
+
const _rowIndex = rIndex;
|
|
907
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
908
|
+
const spanRest = mergeFooterCellMaps[`${_rowIndex}:${_columnIndex}`];
|
|
909
|
+
if (spanRest) {
|
|
910
|
+
const { rowspan, colspan } = spanRest;
|
|
911
|
+
if (!rowspan || !colspan) {
|
|
912
|
+
return "";
|
|
913
|
+
}
|
|
914
|
+
if (rowspan > 1) {
|
|
915
|
+
rowSpan = rowspan;
|
|
916
|
+
}
|
|
917
|
+
if (colspan > 1) {
|
|
918
|
+
colSpan = colspan;
|
|
919
|
+
}
|
|
1063
920
|
}
|
|
1064
921
|
}
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
922
|
+
if (footAlign) {
|
|
923
|
+
classNames.push(`col--${footAlign}`);
|
|
924
|
+
}
|
|
925
|
+
return `<td class="${classNames.join(" ")}" rowspan="${rowSpan}" colspan="${colSpan}" title="${cellValue}"><div style="${getCellWidthStyle(column)}">${(0, import_utils.formatText)(cellValue, true)}</div></td>`;
|
|
926
|
+
}).join("")}</tr>`
|
|
927
|
+
);
|
|
1071
928
|
});
|
|
1072
|
-
tables.push(
|
|
929
|
+
tables.push("</tfoot>");
|
|
1073
930
|
}
|
|
1074
931
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
tables.
|
|
1078
|
-
return isPrint ? tables.join('') : (0, _util2.createHtmlPage)(opts, tables.join(''));
|
|
932
|
+
const script = !isAllSelected && isIndeterminate ? `<script>(function(){var a=document.querySelector(".${allCls}");if(a){a.indeterminate=true}})()</script>` : "";
|
|
933
|
+
tables.push("</table>", script);
|
|
934
|
+
return isPrint ? tables.join("") : (0, import_util2.createHtmlPage)(opts, tables.join(""));
|
|
1079
935
|
};
|
|
1080
936
|
const toXML = (opts, columns, datas) => {
|
|
1081
|
-
let xml = [
|
|
937
|
+
let xml = [
|
|
938
|
+
'<?xml version="1.0"?>',
|
|
939
|
+
'<?mso-application progid="Excel.Sheet"?>',
|
|
940
|
+
'<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">',
|
|
941
|
+
'<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">',
|
|
942
|
+
"<Version>16.00</Version>",
|
|
943
|
+
"</DocumentProperties>",
|
|
944
|
+
'<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">',
|
|
945
|
+
"<WindowHeight>7920</WindowHeight>",
|
|
946
|
+
"<WindowWidth>21570</WindowWidth>",
|
|
947
|
+
"<WindowTopX>32767</WindowTopX>",
|
|
948
|
+
"<WindowTopY>32767</WindowTopY>",
|
|
949
|
+
"<ProtectStructure>False</ProtectStructure>",
|
|
950
|
+
"<ProtectWindows>False</ProtectWindows>",
|
|
951
|
+
"</ExcelWorkbook>",
|
|
952
|
+
`<Worksheet ss:Name="${opts.sheetName}">`,
|
|
953
|
+
"<Table>",
|
|
954
|
+
columns.map((column) => `<Column ss:Width="${column.renderWidth}"/>`).join("")
|
|
955
|
+
].join("");
|
|
1082
956
|
if (opts.isHeader) {
|
|
1083
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle(opts, column)}</Data></Cell>`).join(
|
|
957
|
+
xml += `<Row>${columns.map((column) => `<Cell><Data ss:Type="String">${getHeaderTitle(opts, column)}</Data></Cell>`).join("")}</Row>`;
|
|
1084
958
|
}
|
|
1085
|
-
datas.forEach(row => {
|
|
1086
|
-
xml +=
|
|
959
|
+
datas.forEach((row) => {
|
|
960
|
+
xml += "<Row>" + columns.map((column) => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join("") + "</Row>";
|
|
1087
961
|
});
|
|
1088
962
|
if (opts.isFooter) {
|
|
1089
|
-
const {
|
|
1090
|
-
footerTableData
|
|
1091
|
-
} = reactData;
|
|
963
|
+
const { footerTableData } = reactData;
|
|
1092
964
|
const footers = getFooterData($xeTable, opts, footerTableData);
|
|
1093
|
-
footers.forEach(row => {
|
|
1094
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue(opts, row, column)}</Data></Cell>`).join(
|
|
965
|
+
footers.forEach((row) => {
|
|
966
|
+
xml += `<Row>${columns.map((column) => `<Cell><Data ss:Type="String">${getFooterCellValue(opts, row, column)}</Data></Cell>`).join("")}</Row>`;
|
|
1095
967
|
});
|
|
1096
968
|
}
|
|
1097
969
|
return `${xml}</Table></Worksheet></Workbook>`;
|
|
1098
970
|
};
|
|
1099
|
-
const getContent = ($
|
|
971
|
+
const getContent = ($xeTable2, opts, columns, datas) => {
|
|
1100
972
|
if (columns.length) {
|
|
1101
973
|
switch (opts.type) {
|
|
1102
|
-
case
|
|
1103
|
-
return toCsv($
|
|
1104
|
-
case
|
|
1105
|
-
return toTxt($
|
|
1106
|
-
case
|
|
974
|
+
case "csv":
|
|
975
|
+
return toCsv($xeTable2, opts, columns, datas);
|
|
976
|
+
case "txt":
|
|
977
|
+
return toTxt($xeTable2, opts, columns, datas);
|
|
978
|
+
case "html":
|
|
1107
979
|
return toHtml(opts, columns, datas);
|
|
1108
|
-
case
|
|
980
|
+
case "xml":
|
|
1109
981
|
return toXML(opts, columns, datas);
|
|
1110
982
|
}
|
|
1111
983
|
}
|
|
1112
|
-
return
|
|
984
|
+
return "";
|
|
1113
985
|
};
|
|
1114
986
|
const downloadFile = (opts, content) => {
|
|
1115
|
-
const {
|
|
1116
|
-
filename,
|
|
1117
|
-
type,
|
|
1118
|
-
download
|
|
1119
|
-
} = opts;
|
|
987
|
+
const { filename, type, download } = opts;
|
|
1120
988
|
if (!download) {
|
|
1121
|
-
const blob = (0,
|
|
1122
|
-
return Promise.resolve({
|
|
1123
|
-
type,
|
|
1124
|
-
content,
|
|
1125
|
-
blob
|
|
1126
|
-
});
|
|
989
|
+
const blob = (0, import_util2.getExportBlobByContent)(content, opts);
|
|
990
|
+
return Promise.resolve({ type, content, blob });
|
|
1127
991
|
}
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1130
|
-
filename,
|
|
1131
|
-
type,
|
|
1132
|
-
content
|
|
1133
|
-
}).then(() => {
|
|
992
|
+
if (import_ui.VxeUI.saveFile) {
|
|
993
|
+
import_ui.VxeUI.saveFile({ filename, type, content }).then(() => {
|
|
1134
994
|
if (opts.message !== false) {
|
|
1135
|
-
if (
|
|
1136
|
-
|
|
1137
|
-
content: getI18n('vxe.table.expSuccess'),
|
|
1138
|
-
status: 'success'
|
|
1139
|
-
});
|
|
995
|
+
if (import_ui.VxeUI.modal) {
|
|
996
|
+
import_ui.VxeUI.modal.message({ content: getI18n("vxe.table.expSuccess"), status: "success" });
|
|
1140
997
|
}
|
|
1141
998
|
}
|
|
1142
999
|
});
|
|
1143
1000
|
}
|
|
1144
1001
|
};
|
|
1145
|
-
const handleExport = opts => {
|
|
1002
|
+
const handleExport = (opts) => {
|
|
1146
1003
|
const $xeGrid = $xeTable.xeGrid;
|
|
1147
1004
|
const $xeGantt = $xeTable.xeGantt;
|
|
1148
|
-
const {
|
|
1149
|
-
|
|
1150
|
-
columns,
|
|
1151
|
-
colgroups,
|
|
1152
|
-
exportMethod,
|
|
1153
|
-
afterExportMethod
|
|
1154
|
-
} = opts;
|
|
1155
|
-
return new Promise(resolve => {
|
|
1005
|
+
const { remote, columns, colgroups, exportMethod, afterExportMethod } = opts;
|
|
1006
|
+
return new Promise((resolve) => {
|
|
1156
1007
|
if (remote) {
|
|
1157
|
-
const params = {
|
|
1158
|
-
options: opts,
|
|
1159
|
-
$table: $xeTable,
|
|
1160
|
-
$grid: $xeGrid,
|
|
1161
|
-
$gantt: $xeGantt
|
|
1162
|
-
};
|
|
1008
|
+
const params = { options: opts, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt };
|
|
1163
1009
|
resolve(exportMethod ? exportMethod(params) : params);
|
|
1164
1010
|
} else {
|
|
1165
1011
|
const datas = getExportData(opts);
|
|
1166
|
-
resolve(
|
|
1167
|
-
options: opts,
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}, () => {
|
|
1172
|
-
return downloadFile(opts, getContent($xeTable, opts, columns, datas));
|
|
1173
|
-
}));
|
|
1012
|
+
resolve(
|
|
1013
|
+
$xeTable.preventEvent(null, "event.export", { options: opts, columns, colgroups, datas }, () => {
|
|
1014
|
+
return downloadFile(opts, getContent($xeTable, opts, columns, datas));
|
|
1015
|
+
})
|
|
1016
|
+
);
|
|
1174
1017
|
}
|
|
1175
|
-
}).then(params => {
|
|
1018
|
+
}).then((params) => {
|
|
1176
1019
|
clearColumnConvert(columns);
|
|
1177
1020
|
if (!opts.print) {
|
|
1178
1021
|
if (afterExportMethod) {
|
|
1179
|
-
afterExportMethod({
|
|
1180
|
-
status: true,
|
|
1181
|
-
options: opts,
|
|
1182
|
-
$table: $xeTable,
|
|
1183
|
-
$grid: $xeGrid,
|
|
1184
|
-
$gantt: $xeGantt
|
|
1185
|
-
});
|
|
1022
|
+
afterExportMethod({ status: true, options: opts, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
1186
1023
|
}
|
|
1187
1024
|
}
|
|
1188
|
-
return Object.assign({
|
|
1189
|
-
status: true
|
|
1190
|
-
}, params);
|
|
1025
|
+
return Object.assign({ status: true }, params);
|
|
1191
1026
|
}).catch(() => {
|
|
1192
1027
|
clearColumnConvert(columns);
|
|
1193
1028
|
if (!opts.print) {
|
|
1194
1029
|
if (afterExportMethod) {
|
|
1195
|
-
afterExportMethod({
|
|
1196
|
-
status: false,
|
|
1197
|
-
options: opts,
|
|
1198
|
-
$table: $xeTable,
|
|
1199
|
-
$grid: $xeGrid,
|
|
1200
|
-
$gantt: $xeGantt
|
|
1201
|
-
});
|
|
1030
|
+
afterExportMethod({ status: false, options: opts, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
1202
1031
|
}
|
|
1203
1032
|
}
|
|
1204
|
-
const params = {
|
|
1205
|
-
status: false
|
|
1206
|
-
};
|
|
1033
|
+
const params = { status: false };
|
|
1207
1034
|
return Promise.reject(params);
|
|
1208
1035
|
});
|
|
1209
1036
|
};
|
|
1210
1037
|
const handleImport = (content, opts) => {
|
|
1211
|
-
const {
|
|
1212
|
-
|
|
1213
|
-
_importResolve,
|
|
1214
|
-
_importReject
|
|
1215
|
-
} = internalData;
|
|
1216
|
-
let rest = {
|
|
1217
|
-
fields: [],
|
|
1218
|
-
rows: []
|
|
1219
|
-
};
|
|
1038
|
+
const { tableFullColumn, _importResolve, _importReject } = internalData;
|
|
1039
|
+
let rest = { fields: [], rows: [] };
|
|
1220
1040
|
const tableFieldMaps = {};
|
|
1221
1041
|
const tableTitleMaps = {};
|
|
1222
|
-
tableFullColumn.forEach(column => {
|
|
1042
|
+
tableFullColumn.forEach((column) => {
|
|
1223
1043
|
const field = column.field;
|
|
1224
1044
|
const title = $xeTable.getHeaderCellLabel(column);
|
|
1225
1045
|
if (field) {
|
|
@@ -1234,98 +1054,71 @@ hooks.add('tableExportModule', {
|
|
|
1234
1054
|
titleMaps: tableTitleMaps
|
|
1235
1055
|
};
|
|
1236
1056
|
switch (opts.type) {
|
|
1237
|
-
case
|
|
1057
|
+
case "csv":
|
|
1238
1058
|
rest = parseCsv(tableConf, content);
|
|
1239
1059
|
break;
|
|
1240
|
-
case
|
|
1060
|
+
case "txt":
|
|
1241
1061
|
rest = parseTxt(tableConf, content);
|
|
1242
1062
|
break;
|
|
1243
|
-
case
|
|
1063
|
+
case "html":
|
|
1244
1064
|
rest = parseHTML(tableConf, content);
|
|
1245
1065
|
break;
|
|
1246
|
-
case
|
|
1066
|
+
case "xml":
|
|
1247
1067
|
rest = parseXML(tableConf, content);
|
|
1248
1068
|
break;
|
|
1249
1069
|
}
|
|
1250
|
-
const {
|
|
1251
|
-
|
|
1252
|
-
rows
|
|
1253
|
-
} = rest;
|
|
1254
|
-
const status = fields.some(field => tableFieldMaps[field] || tableTitleMaps[field]);
|
|
1070
|
+
const { fields, rows } = rest;
|
|
1071
|
+
const status = fields.some((field) => tableFieldMaps[field] || tableTitleMaps[field]);
|
|
1255
1072
|
if (status) {
|
|
1256
|
-
$xeTable.createData(rows).then(data => {
|
|
1073
|
+
$xeTable.createData(rows).then((data) => {
|
|
1257
1074
|
let loadRest;
|
|
1258
|
-
if (opts.mode ===
|
|
1075
|
+
if (opts.mode === "insert" || opts.mode === "insertBottom") {
|
|
1259
1076
|
loadRest = $xeTable.insertAt(data, -1);
|
|
1260
|
-
} else if (opts.mode ===
|
|
1077
|
+
} else if (opts.mode === "insertTop") {
|
|
1261
1078
|
loadRest = $xeTable.insert(data);
|
|
1262
1079
|
} else {
|
|
1263
1080
|
loadRest = $xeTable.reloadData(data);
|
|
1264
1081
|
}
|
|
1265
1082
|
if (opts.message !== false) {
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1268
|
-
content: getI18n('vxe.table.impSuccess', [rows.length]),
|
|
1269
|
-
status: 'success'
|
|
1270
|
-
});
|
|
1083
|
+
if (import_ui.VxeUI.modal) {
|
|
1084
|
+
import_ui.VxeUI.modal.message({ content: getI18n("vxe.table.impSuccess", [rows.length]), status: "success" });
|
|
1271
1085
|
}
|
|
1272
1086
|
}
|
|
1273
1087
|
return loadRest.then(() => {
|
|
1274
1088
|
if (_importResolve) {
|
|
1275
|
-
_importResolve({
|
|
1276
|
-
status: true
|
|
1277
|
-
});
|
|
1089
|
+
_importResolve({ status: true });
|
|
1278
1090
|
}
|
|
1279
1091
|
});
|
|
1280
1092
|
});
|
|
1281
1093
|
} else if (opts.message !== false) {
|
|
1282
|
-
if (
|
|
1283
|
-
|
|
1284
|
-
content: getI18n('vxe.error.impFields'),
|
|
1285
|
-
status: 'error'
|
|
1286
|
-
});
|
|
1094
|
+
if (import_ui.VxeUI.modal) {
|
|
1095
|
+
import_ui.VxeUI.modal.message({ content: getI18n("vxe.error.impFields"), status: "error" });
|
|
1287
1096
|
}
|
|
1288
1097
|
if (_importReject) {
|
|
1289
|
-
_importReject({
|
|
1290
|
-
status: false,
|
|
1291
|
-
msg: 'field mismatching'
|
|
1292
|
-
});
|
|
1098
|
+
_importReject({ status: false, msg: "field mismatching" });
|
|
1293
1099
|
}
|
|
1294
1100
|
}
|
|
1295
1101
|
};
|
|
1296
1102
|
const handleFileImport = (file, opts) => {
|
|
1297
|
-
const {
|
|
1298
|
-
|
|
1299
|
-
afterImportMethod
|
|
1300
|
-
} = opts;
|
|
1301
|
-
const {
|
|
1302
|
-
type,
|
|
1303
|
-
filename
|
|
1304
|
-
} = (0, _utils.parseFile)(file);
|
|
1103
|
+
const { importMethod, afterImportMethod } = opts;
|
|
1104
|
+
const { type, filename } = (0, import_utils.parseFile)(file);
|
|
1305
1105
|
const importOpts = computeImportOpts.value;
|
|
1306
|
-
|
|
1307
|
-
if (!importMethod && !_xeUtils.default.includes(_xeUtils.default.keys(importOpts._typeMaps), type)) {
|
|
1106
|
+
if (!importMethod && !import_xe_utils.default.includes(import_xe_utils.default.keys(importOpts._typeMaps), type)) {
|
|
1308
1107
|
if (opts.message !== false) {
|
|
1309
|
-
if (
|
|
1310
|
-
|
|
1311
|
-
content: getI18n('vxe.error.notType', [type]),
|
|
1312
|
-
status: 'error'
|
|
1313
|
-
});
|
|
1108
|
+
if (import_ui.VxeUI.modal) {
|
|
1109
|
+
import_ui.VxeUI.modal.message({ content: getI18n("vxe.error.notType", [type]), status: "error" });
|
|
1314
1110
|
}
|
|
1315
1111
|
}
|
|
1316
|
-
const params = {
|
|
1317
|
-
status: false,
|
|
1318
|
-
msg: 'type error'
|
|
1319
|
-
};
|
|
1112
|
+
const params = { status: false, msg: "type error" };
|
|
1320
1113
|
return Promise.reject(params);
|
|
1321
1114
|
}
|
|
1322
1115
|
const rest = new Promise((resolve, reject) => {
|
|
1323
|
-
const _importResolve = params => {
|
|
1116
|
+
const _importResolve = (params) => {
|
|
1324
1117
|
resolve(params);
|
|
1325
1118
|
internalData._importResolve = null;
|
|
1326
1119
|
internalData._importReject = null;
|
|
1327
1120
|
};
|
|
1328
|
-
const _importReject = params => {
|
|
1121
|
+
const _importReject = (params) => {
|
|
1329
1122
|
reject(params);
|
|
1330
1123
|
internalData._importResolve = null;
|
|
1331
1124
|
internalData._importReject = null;
|
|
@@ -1333,88 +1126,52 @@ hooks.add('tableExportModule', {
|
|
|
1333
1126
|
internalData._importResolve = _importResolve;
|
|
1334
1127
|
internalData._importReject = _importReject;
|
|
1335
1128
|
if (window.FileReader) {
|
|
1336
|
-
const options = Object.assign({
|
|
1337
|
-
mode: 'insertTop'
|
|
1338
|
-
}, opts, {
|
|
1339
|
-
type,
|
|
1340
|
-
filename
|
|
1341
|
-
});
|
|
1129
|
+
const options = Object.assign({ mode: "insertTop" }, opts, { type, filename });
|
|
1342
1130
|
if (options.remote) {
|
|
1343
1131
|
if (importMethod) {
|
|
1344
|
-
Promise.resolve(importMethod({
|
|
1345
|
-
|
|
1346
|
-
options,
|
|
1347
|
-
$table: $xeTable
|
|
1348
|
-
})).then(() => {
|
|
1349
|
-
_importResolve({
|
|
1350
|
-
status: true
|
|
1351
|
-
});
|
|
1132
|
+
Promise.resolve(importMethod({ file, options, $table: $xeTable })).then(() => {
|
|
1133
|
+
_importResolve({ status: true });
|
|
1352
1134
|
}).catch(() => {
|
|
1353
|
-
_importResolve({
|
|
1354
|
-
status: true
|
|
1355
|
-
});
|
|
1135
|
+
_importResolve({ status: true });
|
|
1356
1136
|
});
|
|
1357
1137
|
} else {
|
|
1358
|
-
_importResolve({
|
|
1359
|
-
status: true
|
|
1360
|
-
});
|
|
1138
|
+
_importResolve({ status: true });
|
|
1361
1139
|
}
|
|
1362
1140
|
} else {
|
|
1363
|
-
const {
|
|
1364
|
-
|
|
1365
|
-
} = internalData;
|
|
1366
|
-
$xeTable.preventEvent(null, 'event.import', {
|
|
1367
|
-
file,
|
|
1368
|
-
options,
|
|
1369
|
-
columns: tableFullColumn
|
|
1370
|
-
}, () => {
|
|
1141
|
+
const { tableFullColumn } = internalData;
|
|
1142
|
+
$xeTable.preventEvent(null, "event.import", { file, options, columns: tableFullColumn }, () => {
|
|
1371
1143
|
const reader = new FileReader();
|
|
1372
1144
|
reader.onerror = () => {
|
|
1373
|
-
errLog(
|
|
1374
|
-
_importReject({
|
|
1375
|
-
status: false,
|
|
1376
|
-
msg: 'reading file error'
|
|
1377
|
-
});
|
|
1145
|
+
errLog("vxe.error.notType", [type]);
|
|
1146
|
+
_importReject({ status: false, msg: "reading file error" });
|
|
1378
1147
|
};
|
|
1379
|
-
reader.onload = e => {
|
|
1148
|
+
reader.onload = (e) => {
|
|
1380
1149
|
handleImport(e.target.result, options);
|
|
1381
1150
|
};
|
|
1382
|
-
reader.readAsText(file, options.encoding ||
|
|
1151
|
+
reader.readAsText(file, options.encoding || "UTF-8");
|
|
1383
1152
|
});
|
|
1384
1153
|
}
|
|
1385
1154
|
} else {
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
_importResolve({
|
|
1389
|
-
status: false,
|
|
1390
|
-
msg: 'unsupported browser'
|
|
1391
|
-
});
|
|
1155
|
+
errLog("vxe.error.notExp");
|
|
1156
|
+
_importResolve({ status: false, msg: "unsupported browser" });
|
|
1392
1157
|
}
|
|
1393
1158
|
});
|
|
1394
1159
|
return rest.then(() => {
|
|
1395
1160
|
if (afterImportMethod) {
|
|
1396
|
-
afterImportMethod({
|
|
1397
|
-
status: true,
|
|
1398
|
-
options: opts,
|
|
1399
|
-
$table: $xeTable
|
|
1400
|
-
});
|
|
1161
|
+
afterImportMethod({ status: true, options: opts, $table: $xeTable });
|
|
1401
1162
|
}
|
|
1402
|
-
}).catch(e => {
|
|
1163
|
+
}).catch((e) => {
|
|
1403
1164
|
if (afterImportMethod) {
|
|
1404
|
-
afterImportMethod({
|
|
1405
|
-
status: false,
|
|
1406
|
-
options: opts,
|
|
1407
|
-
$table: $xeTable
|
|
1408
|
-
});
|
|
1165
|
+
afterImportMethod({ status: false, options: opts, $table: $xeTable });
|
|
1409
1166
|
}
|
|
1410
1167
|
return Promise.reject(e);
|
|
1411
1168
|
});
|
|
1412
1169
|
};
|
|
1413
1170
|
const handleFilterColumns = (exportOpts, column, columns) => {
|
|
1414
|
-
return columns.some(item => {
|
|
1415
|
-
if ((0,
|
|
1171
|
+
return columns.some((item) => {
|
|
1172
|
+
if ((0, import_util.isColumnInfo)(item)) {
|
|
1416
1173
|
return column.id === item.id;
|
|
1417
|
-
} else if (
|
|
1174
|
+
} else if (import_xe_utils.default.isString(item)) {
|
|
1418
1175
|
return column.field === item;
|
|
1419
1176
|
} else {
|
|
1420
1177
|
const colid = item.id || item.colId;
|
|
@@ -1434,9 +1191,7 @@ hooks.add('tableExportModule', {
|
|
|
1434
1191
|
});
|
|
1435
1192
|
};
|
|
1436
1193
|
const handleFilterFields = (exportOpts, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps) => {
|
|
1437
|
-
const {
|
|
1438
|
-
field
|
|
1439
|
-
} = column;
|
|
1194
|
+
const { field } = column;
|
|
1440
1195
|
if (excludeFdMaps[field]) {
|
|
1441
1196
|
return false;
|
|
1442
1197
|
}
|
|
@@ -1455,24 +1210,9 @@ hooks.add('tableExportModule', {
|
|
|
1455
1210
|
const $xeGrid = $xeTable.xeGrid;
|
|
1456
1211
|
const $xeGantt = $xeTable.xeGantt;
|
|
1457
1212
|
const $xeGGWrapper = $xeGrid || $xeGantt;
|
|
1458
|
-
const {
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
showFooter
|
|
1462
|
-
} = props;
|
|
1463
|
-
const {
|
|
1464
|
-
initStore,
|
|
1465
|
-
isGroup,
|
|
1466
|
-
rowGroupList,
|
|
1467
|
-
footerTableData,
|
|
1468
|
-
exportStore,
|
|
1469
|
-
exportParams
|
|
1470
|
-
} = reactData;
|
|
1471
|
-
const {
|
|
1472
|
-
collectColumn,
|
|
1473
|
-
mergeBodyList,
|
|
1474
|
-
mergeFooterList
|
|
1475
|
-
} = internalData;
|
|
1213
|
+
const { treeConfig, showHeader, showFooter } = props;
|
|
1214
|
+
const { initStore, isGroup, rowGroupList, footerTableData, exportStore, exportParams } = reactData;
|
|
1215
|
+
const { collectColumn, mergeBodyList, mergeFooterList } = internalData;
|
|
1476
1216
|
const exportOpts = computeExportOpts.value;
|
|
1477
1217
|
const printOpts = computePrintOpts.value;
|
|
1478
1218
|
const hasTree = !!treeConfig;
|
|
@@ -1489,32 +1229,25 @@ hooks.add('tableExportModule', {
|
|
|
1489
1229
|
isColgroup: isGroup,
|
|
1490
1230
|
isMerge: hasMerge,
|
|
1491
1231
|
useStyle: true,
|
|
1492
|
-
current:
|
|
1493
|
-
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? [
|
|
1232
|
+
current: "current",
|
|
1233
|
+
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"])
|
|
1494
1234
|
}, options);
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
|
|
1235
|
+
if (import_xe_utils.default.isBoolean(defOpts.isAllExpand)) {
|
|
1236
|
+
warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
|
|
1498
1237
|
defOpts.isTreeAllExpanded = defOpts.isAllExpand;
|
|
1499
1238
|
}
|
|
1500
|
-
const types = isPrint ? [] : defOpts.types ||
|
|
1239
|
+
const types = isPrint ? [] : defOpts.types || import_xe_utils.default.keys(exportOpts._typeMaps);
|
|
1501
1240
|
const modes = defOpts.modes || [];
|
|
1502
1241
|
const checkMethod = (isPrint ? printOpts : exportOpts).checkMethod;
|
|
1503
1242
|
const exportColumns = collectColumn.slice(0);
|
|
1504
|
-
const {
|
|
1505
|
-
|
|
1506
|
-
excludeFields,
|
|
1507
|
-
includeFields,
|
|
1508
|
-
extraFields
|
|
1509
|
-
} = defOpts;
|
|
1510
|
-
// 处理类型
|
|
1511
|
-
const typeList = types.map(value => {
|
|
1243
|
+
const { columns, excludeFields, includeFields, extraFields } = defOpts;
|
|
1244
|
+
const typeList = types.map((value) => {
|
|
1512
1245
|
return {
|
|
1513
1246
|
value,
|
|
1514
1247
|
label: getI18n(`vxe.export.types.${value}`)
|
|
1515
1248
|
};
|
|
1516
1249
|
});
|
|
1517
|
-
const modeList = modes.map(item => {
|
|
1250
|
+
const modeList = modes.map((item) => {
|
|
1518
1251
|
if (item && item.value) {
|
|
1519
1252
|
return {
|
|
1520
1253
|
value: item.value,
|
|
@@ -1528,25 +1261,23 @@ hooks.add('tableExportModule', {
|
|
|
1528
1261
|
});
|
|
1529
1262
|
const excludeFdMaps = {};
|
|
1530
1263
|
if (excludeFields && excludeFields.length) {
|
|
1531
|
-
excludeFields.forEach(field => {
|
|
1264
|
+
excludeFields.forEach((field) => {
|
|
1532
1265
|
excludeFdMaps[field] = 1;
|
|
1533
1266
|
});
|
|
1534
1267
|
}
|
|
1535
1268
|
const includeFdMaps = {};
|
|
1536
1269
|
if (includeFields && includeFields.length) {
|
|
1537
|
-
includeFields.forEach(field => {
|
|
1270
|
+
includeFields.forEach((field) => {
|
|
1538
1271
|
includeFdMaps[field] = 1;
|
|
1539
1272
|
});
|
|
1540
1273
|
}
|
|
1541
1274
|
const extraFdMaps = {};
|
|
1542
1275
|
if (extraFields) {
|
|
1543
|
-
extraFields.forEach(field => {
|
|
1276
|
+
extraFields.forEach((field) => {
|
|
1544
1277
|
extraFdMaps[field] = 1;
|
|
1545
1278
|
});
|
|
1546
1279
|
}
|
|
1547
|
-
|
|
1548
|
-
// 优先级 columns > excludeFields > (includeFields || extraFields)
|
|
1549
|
-
_xeUtils.default.eachTree(exportColumns, (column, index, items, path, parentColumn) => {
|
|
1280
|
+
import_xe_utils.default.eachTree(exportColumns, (column, index, items, path, parentColumn) => {
|
|
1550
1281
|
const isColGroup = column.children && column.children.length > 0;
|
|
1551
1282
|
let isChecked = false;
|
|
1552
1283
|
const isExtraChecked = extraFdMaps[column.field];
|
|
@@ -1563,12 +1294,8 @@ hooks.add('tableExportModule', {
|
|
|
1563
1294
|
}
|
|
1564
1295
|
column.checked = isChecked;
|
|
1565
1296
|
column.halfChecked = false;
|
|
1566
|
-
column.disabled = parentColumn && parentColumn.disabled || (checkMethod ? !checkMethod({
|
|
1567
|
-
$table: $xeTable,
|
|
1568
|
-
column
|
|
1569
|
-
}) : false);
|
|
1297
|
+
column.disabled = parentColumn && parentColumn.disabled || (checkMethod ? !checkMethod({ $table: $xeTable, column }) : false);
|
|
1570
1298
|
});
|
|
1571
|
-
// 更新条件
|
|
1572
1299
|
exportStore.columns = exportColumns;
|
|
1573
1300
|
exportStore.typeList = typeList;
|
|
1574
1301
|
exportStore.modeList = modeList;
|
|
@@ -1579,18 +1306,12 @@ hooks.add('tableExportModule', {
|
|
|
1579
1306
|
exportStore.isPrint = !!isPrint;
|
|
1580
1307
|
exportStore.hasColgroup = isGroup;
|
|
1581
1308
|
exportStore.visible = true;
|
|
1582
|
-
// 默认参数
|
|
1583
1309
|
Object.assign(exportParams, {
|
|
1584
|
-
mode: selectRecords.length ?
|
|
1310
|
+
mode: selectRecords.length ? "selected" : "current"
|
|
1585
1311
|
}, defOpts);
|
|
1586
|
-
const {
|
|
1587
|
-
filename,
|
|
1588
|
-
sheetName,
|
|
1589
|
-
mode,
|
|
1590
|
-
type
|
|
1591
|
-
} = exportParams;
|
|
1312
|
+
const { filename, sheetName, mode, type } = exportParams;
|
|
1592
1313
|
if (filename) {
|
|
1593
|
-
if (
|
|
1314
|
+
if (import_xe_utils.default.isFunction(filename)) {
|
|
1594
1315
|
exportParams.filename = filename({
|
|
1595
1316
|
options: defOpts,
|
|
1596
1317
|
$table: $xeTable,
|
|
@@ -1602,7 +1323,7 @@ hooks.add('tableExportModule', {
|
|
|
1602
1323
|
}
|
|
1603
1324
|
}
|
|
1604
1325
|
if (sheetName) {
|
|
1605
|
-
if (
|
|
1326
|
+
if (import_xe_utils.default.isFunction(sheetName)) {
|
|
1606
1327
|
exportParams.sheetName = sheetName({
|
|
1607
1328
|
options: defOpts,
|
|
1608
1329
|
$table: $xeTable,
|
|
@@ -1613,21 +1334,21 @@ hooks.add('tableExportModule', {
|
|
|
1613
1334
|
exportParams.sheetName = `${sheetName}`;
|
|
1614
1335
|
}
|
|
1615
1336
|
}
|
|
1616
|
-
if (!modeList.some(item => item.value === mode)) {
|
|
1617
|
-
exportParams.mode = modeList.length ? modeList[0].value :
|
|
1337
|
+
if (!modeList.some((item) => item.value === mode)) {
|
|
1338
|
+
exportParams.mode = modeList.length ? modeList[0].value : "";
|
|
1618
1339
|
}
|
|
1619
|
-
if (!typeList.some(item => item.value === type)) {
|
|
1620
|
-
exportParams.type = typeList.length ? typeList[0].value :
|
|
1340
|
+
if (!typeList.some((item) => item.value === type)) {
|
|
1341
|
+
exportParams.type = typeList.length ? typeList[0].value : "";
|
|
1621
1342
|
}
|
|
1622
1343
|
if (!exportParams.widthMode) {
|
|
1623
|
-
exportParams.widthMode =
|
|
1344
|
+
exportParams.widthMode = "";
|
|
1624
1345
|
}
|
|
1625
1346
|
initStore.export = true;
|
|
1626
|
-
return (0,
|
|
1347
|
+
return (0, import_vue.nextTick)();
|
|
1627
1348
|
};
|
|
1628
1349
|
const handleCloseExport = () => {
|
|
1629
|
-
if (
|
|
1630
|
-
return
|
|
1350
|
+
if (import_ui.VxeUI.modal) {
|
|
1351
|
+
return import_ui.VxeUI.modal.close("VXE_EXPORT_MODAL");
|
|
1631
1352
|
}
|
|
1632
1353
|
return Promise.resolve();
|
|
1633
1354
|
};
|
|
@@ -1642,22 +1363,9 @@ hooks.add('tableExportModule', {
|
|
|
1642
1363
|
const $xeGrid = $xeTable.xeGrid;
|
|
1643
1364
|
const $xeGantt = $xeTable.xeGantt;
|
|
1644
1365
|
const $xeGGWrapper = $xeGrid || $xeGantt;
|
|
1645
|
-
const {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
showFooter
|
|
1649
|
-
} = props;
|
|
1650
|
-
const {
|
|
1651
|
-
isGroup
|
|
1652
|
-
} = reactData;
|
|
1653
|
-
const {
|
|
1654
|
-
tableFullColumn,
|
|
1655
|
-
afterFullData,
|
|
1656
|
-
afterTreeFullData,
|
|
1657
|
-
collectColumn,
|
|
1658
|
-
mergeBodyList,
|
|
1659
|
-
mergeFooterList
|
|
1660
|
-
} = internalData;
|
|
1366
|
+
const { treeConfig, showHeader, showFooter } = props;
|
|
1367
|
+
const { isGroup } = reactData;
|
|
1368
|
+
const { tableFullColumn, afterFullData, afterTreeFullData, collectColumn, mergeBodyList, mergeFooterList } = internalData;
|
|
1661
1369
|
const exportOpts = computeExportOpts.value;
|
|
1662
1370
|
const treeOpts = computeTreeOpts.value;
|
|
1663
1371
|
const proxyOpts = $xeGGWrapper ? $xeGGWrapper.getComputeMaps().computeProxyOpts.value : {};
|
|
@@ -1670,10 +1378,10 @@ hooks.add('tableExportModule', {
|
|
|
1670
1378
|
isColgroup: isGroup,
|
|
1671
1379
|
isMerge: hasMerge,
|
|
1672
1380
|
useStyle: true,
|
|
1673
|
-
current:
|
|
1674
|
-
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? [
|
|
1381
|
+
current: "current",
|
|
1382
|
+
modes: (proxyOpts.ajax && proxyOpts.ajax.queryAll ? ["all"] : []).concat(["current", "selected", "empty"]),
|
|
1675
1383
|
download: true,
|
|
1676
|
-
type:
|
|
1384
|
+
type: "csv"
|
|
1677
1385
|
// filename: '',
|
|
1678
1386
|
// sheetName: '',
|
|
1679
1387
|
// original: false,
|
|
@@ -1688,43 +1396,31 @@ hooks.add('tableExportModule', {
|
|
|
1688
1396
|
// beforeExportMethod: null,
|
|
1689
1397
|
// afterExportMethod: null
|
|
1690
1398
|
}, exportOpts, options);
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
warnLog('vxe.error.delProp', ['isAllExpand', 'isTreeAllExpanded']);
|
|
1399
|
+
if (import_xe_utils.default.isBoolean(opts.isAllExpand)) {
|
|
1400
|
+
warnLog("vxe.error.delProp", ["isAllExpand", "isTreeAllExpanded"]);
|
|
1694
1401
|
opts.isTreeAllExpanded = opts.isAllExpand;
|
|
1695
1402
|
}
|
|
1696
|
-
let {
|
|
1697
|
-
filename,
|
|
1698
|
-
sheetName,
|
|
1699
|
-
type,
|
|
1700
|
-
mode,
|
|
1701
|
-
columns,
|
|
1702
|
-
columnFilterMethod,
|
|
1703
|
-
beforeExportMethod,
|
|
1704
|
-
includeFields,
|
|
1705
|
-
excludeFields,
|
|
1706
|
-
extraFields
|
|
1707
|
-
} = opts;
|
|
1403
|
+
let { filename, sheetName, type, mode, columns, columnFilterMethod, beforeExportMethod, includeFields, excludeFields, extraFields } = opts;
|
|
1708
1404
|
let groups = [];
|
|
1709
1405
|
const selectRecords = $xeTable.getCheckboxRecords();
|
|
1710
1406
|
if (!mode) {
|
|
1711
|
-
mode = selectRecords.length ?
|
|
1407
|
+
mode = selectRecords.length ? "selected" : "current";
|
|
1712
1408
|
}
|
|
1713
1409
|
const excludeFdMaps = {};
|
|
1714
1410
|
if (excludeFields && excludeFields.length) {
|
|
1715
|
-
excludeFields.forEach(field => {
|
|
1411
|
+
excludeFields.forEach((field) => {
|
|
1716
1412
|
excludeFdMaps[field] = 1;
|
|
1717
1413
|
});
|
|
1718
1414
|
}
|
|
1719
1415
|
const includeFdMaps = {};
|
|
1720
1416
|
if (includeFields && includeFields.length) {
|
|
1721
|
-
includeFields.forEach(field => {
|
|
1417
|
+
includeFields.forEach((field) => {
|
|
1722
1418
|
includeFdMaps[field] = 1;
|
|
1723
1419
|
});
|
|
1724
1420
|
}
|
|
1725
1421
|
const extraFdMaps = {};
|
|
1726
1422
|
if (extraFields) {
|
|
1727
|
-
extraFields.forEach(field => {
|
|
1423
|
+
extraFields.forEach((field) => {
|
|
1728
1424
|
extraFdMaps[field] = 1;
|
|
1729
1425
|
});
|
|
1730
1426
|
}
|
|
@@ -1732,22 +1428,13 @@ hooks.add('tableExportModule', {
|
|
|
1732
1428
|
let customCols = [];
|
|
1733
1429
|
const _columns = opts._columns;
|
|
1734
1430
|
if (_columns) {
|
|
1735
|
-
// 内部导出使用 _columns -> _children 为自定义子集
|
|
1736
1431
|
isCustomCol = true;
|
|
1737
|
-
customCols =
|
|
1738
|
-
children: '_children',
|
|
1739
|
-
mapChildren: 'childNodes',
|
|
1740
|
-
original: true
|
|
1741
|
-
});
|
|
1432
|
+
customCols = import_xe_utils.default.searchTree(_columns, () => true, { children: "_children", mapChildren: "childNodes", original: true });
|
|
1742
1433
|
} else if (columns) {
|
|
1743
1434
|
isCustomCol = true;
|
|
1744
|
-
customCols =
|
|
1745
|
-
children: 'children',
|
|
1746
|
-
mapChildren: 'childNodes',
|
|
1747
|
-
original: true
|
|
1748
|
-
});
|
|
1435
|
+
customCols = import_xe_utils.default.searchTree(columns, () => true, { children: "children", mapChildren: "childNodes", original: true });
|
|
1749
1436
|
} else {
|
|
1750
|
-
customCols =
|
|
1437
|
+
customCols = import_xe_utils.default.searchTree(collectColumn, (column) => {
|
|
1751
1438
|
const isColGroup = column.children && column.children.length > 0;
|
|
1752
1439
|
let isChecked = false;
|
|
1753
1440
|
const isExtraChecked = extraFdMaps[column.field];
|
|
@@ -1763,91 +1450,64 @@ hooks.add('tableExportModule', {
|
|
|
1763
1450
|
}
|
|
1764
1451
|
}
|
|
1765
1452
|
return isChecked;
|
|
1766
|
-
}, {
|
|
1767
|
-
children: 'children',
|
|
1768
|
-
mapChildren: 'childNodes',
|
|
1769
|
-
original: true
|
|
1770
|
-
});
|
|
1453
|
+
}, { children: "children", mapChildren: "childNodes", original: true });
|
|
1771
1454
|
}
|
|
1772
|
-
const handleOptions = Object.assign({}, opts, {
|
|
1773
|
-
filename: '',
|
|
1774
|
-
sheetName: '',
|
|
1775
|
-
_columnConfs: columns
|
|
1776
|
-
});
|
|
1777
|
-
// 如果设置源数据,则默认导出设置了字段的列
|
|
1455
|
+
const handleOptions = Object.assign({}, opts, { filename: "", sheetName: "", _columnConfs: columns });
|
|
1778
1456
|
if (!isCustomCol && !columnFilterMethod) {
|
|
1779
|
-
columnFilterMethod = ({
|
|
1780
|
-
column
|
|
1781
|
-
}) => handleFilterFields(handleOptions, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps);
|
|
1457
|
+
columnFilterMethod = ({ column }) => handleFilterFields(handleOptions, column, includeFields, includeFdMaps, excludeFdMaps, extraFdMaps);
|
|
1782
1458
|
handleOptions.columnFilterMethod = columnFilterMethod;
|
|
1783
1459
|
}
|
|
1784
1460
|
if (customCols) {
|
|
1785
1461
|
handleOptions._isCustomColumn = true;
|
|
1786
|
-
groups =
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
if (
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1462
|
+
groups = import_xe_utils.default.searchTree(
|
|
1463
|
+
import_xe_utils.default.mapTree(customCols, (item) => {
|
|
1464
|
+
let targetColumn;
|
|
1465
|
+
if (item) {
|
|
1466
|
+
if ((0, import_util.isColumnInfo)(item)) {
|
|
1467
|
+
targetColumn = item;
|
|
1468
|
+
} else if (import_xe_utils.default.isString(item)) {
|
|
1469
|
+
targetColumn = $xeTable.getColumnByField(item);
|
|
1470
|
+
} else {
|
|
1471
|
+
const colid = item.id || item.colId;
|
|
1472
|
+
const type2 = item.type;
|
|
1473
|
+
const field = item.field;
|
|
1474
|
+
if (colid) {
|
|
1475
|
+
targetColumn = $xeTable.getColumnById(colid);
|
|
1476
|
+
} else if (field && type2) {
|
|
1477
|
+
targetColumn = tableFullColumn.find((column) => column.field === field && column.type === type2);
|
|
1478
|
+
} else if (field) {
|
|
1479
|
+
targetColumn = $xeTable.getColumnByField(field);
|
|
1480
|
+
} else if (type2) {
|
|
1481
|
+
targetColumn = tableFullColumn.find((column) => column.type === type2);
|
|
1482
|
+
}
|
|
1805
1483
|
}
|
|
1484
|
+
return targetColumn || {};
|
|
1806
1485
|
}
|
|
1807
|
-
|
|
1486
|
+
}, {
|
|
1487
|
+
children: "childNodes",
|
|
1488
|
+
mapChildren: "_children"
|
|
1489
|
+
}),
|
|
1490
|
+
(column, index) => (0, import_util.isColumnInfo)(column) && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })),
|
|
1491
|
+
{
|
|
1492
|
+
children: "_children",
|
|
1493
|
+
mapChildren: "childNodes",
|
|
1494
|
+
original: true
|
|
1808
1495
|
}
|
|
1809
|
-
|
|
1810
|
-
children: 'childNodes',
|
|
1811
|
-
mapChildren: '_children'
|
|
1812
|
-
}), (column, index) => (0, _util.isColumnInfo)(column) && (!columnFilterMethod || columnFilterMethod({
|
|
1813
|
-
$table: $xeTable,
|
|
1814
|
-
$grid: $xeGrid,
|
|
1815
|
-
$gantt: $xeGantt,
|
|
1816
|
-
column: column,
|
|
1817
|
-
$columnIndex: index
|
|
1818
|
-
})), {
|
|
1819
|
-
children: '_children',
|
|
1820
|
-
mapChildren: 'childNodes',
|
|
1821
|
-
original: true
|
|
1822
|
-
});
|
|
1496
|
+
);
|
|
1823
1497
|
} else {
|
|
1824
|
-
groups =
|
|
1825
|
-
$table: $xeTable,
|
|
1826
|
-
$grid: $xeGrid,
|
|
1827
|
-
$gantt: $xeGantt,
|
|
1828
|
-
column,
|
|
1829
|
-
$columnIndex: index
|
|
1830
|
-
})), {
|
|
1831
|
-
children: 'children',
|
|
1832
|
-
mapChildren: 'childNodes',
|
|
1833
|
-
original: true
|
|
1834
|
-
});
|
|
1498
|
+
groups = import_xe_utils.default.searchTree(isGroup ? collectColumn : tableFullColumn, (column, index) => column.visible && (!columnFilterMethod || columnFilterMethod({ $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt, column, $columnIndex: index })), { children: "children", mapChildren: "childNodes", original: true });
|
|
1835
1499
|
}
|
|
1836
|
-
// 获取所有列
|
|
1837
1500
|
const cols = [];
|
|
1838
|
-
|
|
1501
|
+
import_xe_utils.default.eachTree(groups, (column) => {
|
|
1839
1502
|
const isColGroup = column.children && column.children.length;
|
|
1840
1503
|
if (!isColGroup) {
|
|
1841
1504
|
cols.push(column);
|
|
1842
1505
|
}
|
|
1843
|
-
}, {
|
|
1844
|
-
children: 'childNodes'
|
|
1845
|
-
});
|
|
1846
|
-
// 构建分组层级
|
|
1506
|
+
}, { children: "childNodes" });
|
|
1847
1507
|
handleOptions.columns = cols;
|
|
1848
1508
|
handleOptions.colgroups = convertToRows(groups);
|
|
1849
1509
|
if (filename) {
|
|
1850
|
-
if (
|
|
1510
|
+
if (import_xe_utils.default.isFunction(filename)) {
|
|
1851
1511
|
handleOptions.filename = filename({
|
|
1852
1512
|
options: opts,
|
|
1853
1513
|
$table: $xeTable,
|
|
@@ -1859,10 +1519,10 @@ hooks.add('tableExportModule', {
|
|
|
1859
1519
|
}
|
|
1860
1520
|
}
|
|
1861
1521
|
if (!handleOptions.filename) {
|
|
1862
|
-
handleOptions.filename = getI18n(handleOptions.original ?
|
|
1522
|
+
handleOptions.filename = getI18n(handleOptions.original ? "vxe.table.expOriginFilename" : "vxe.table.expFilename", [import_xe_utils.default.toDateString(Date.now(), "yyyyMMddHHmmss")]);
|
|
1863
1523
|
}
|
|
1864
1524
|
if (sheetName) {
|
|
1865
|
-
if (
|
|
1525
|
+
if (import_xe_utils.default.isFunction(sheetName)) {
|
|
1866
1526
|
handleOptions.sheetName = sheetName({
|
|
1867
1527
|
options: opts,
|
|
1868
1528
|
$table: $xeTable,
|
|
@@ -1874,77 +1534,55 @@ hooks.add('tableExportModule', {
|
|
|
1874
1534
|
}
|
|
1875
1535
|
}
|
|
1876
1536
|
if (!handleOptions.sheetName) {
|
|
1877
|
-
handleOptions.sheetName = document.title ||
|
|
1537
|
+
handleOptions.sheetName = document.title || "";
|
|
1878
1538
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
warnLog('vxe.error.reqPlugin', [4, 'plugin-export-xlsx']);
|
|
1539
|
+
if (!handleOptions.exportMethod && !import_xe_utils.default.includes(import_xe_utils.default.keys(exportOpts._typeMaps), type)) {
|
|
1540
|
+
errLog("vxe.error.notType", [type]);
|
|
1541
|
+
if (["xlsx", "pdf"].includes(type)) {
|
|
1542
|
+
warnLog("vxe.error.reqPlugin", [4, "plugin-export-xlsx"]);
|
|
1884
1543
|
}
|
|
1885
|
-
const params = {
|
|
1886
|
-
status: false,
|
|
1887
|
-
msg: 'type error'
|
|
1888
|
-
};
|
|
1544
|
+
const params = { status: false, msg: "type error" };
|
|
1889
1545
|
return Promise.reject(params);
|
|
1890
1546
|
}
|
|
1891
1547
|
if (!handleOptions.print) {
|
|
1892
1548
|
if (beforeExportMethod) {
|
|
1893
|
-
const beRest = beforeExportMethod({
|
|
1894
|
-
|
|
1895
|
-
$table: $xeTable,
|
|
1896
|
-
$grid: $xeGrid,
|
|
1897
|
-
$gantt: $xeGantt
|
|
1898
|
-
});
|
|
1899
|
-
if (_xeUtils.default.isBoolean(beRest)) {
|
|
1549
|
+
const beRest = beforeExportMethod({ options: handleOptions, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
1550
|
+
if (import_xe_utils.default.isBoolean(beRest)) {
|
|
1900
1551
|
if (!beRest) {
|
|
1901
|
-
const params = {
|
|
1902
|
-
status: false,
|
|
1903
|
-
msg: 'before prevent'
|
|
1904
|
-
};
|
|
1552
|
+
const params = { status: false, msg: "before prevent" };
|
|
1905
1553
|
return Promise.reject(params);
|
|
1906
1554
|
}
|
|
1907
1555
|
} else {
|
|
1908
|
-
warnLog(
|
|
1556
|
+
warnLog("vxe.error.returnErr", ["beforeExportMethod", "boolean", beRest]);
|
|
1909
1557
|
}
|
|
1910
1558
|
}
|
|
1911
1559
|
}
|
|
1912
1560
|
if (!handleOptions.data) {
|
|
1913
1561
|
handleOptions.data = [];
|
|
1914
|
-
if (mode ===
|
|
1915
|
-
if ([
|
|
1916
|
-
handleOptions.data =
|
|
1917
|
-
data: '_row'
|
|
1918
|
-
}));
|
|
1562
|
+
if (mode === "selected") {
|
|
1563
|
+
if (["html", "pdf"].indexOf(type) > -1 && treeConfig) {
|
|
1564
|
+
handleOptions.data = import_xe_utils.default.searchTree($xeTable.getTableData().fullData, (item) => $xeTable.findRowIndexOf(selectRecords, item) > -1, Object.assign({}, treeOpts, { data: "_row" }));
|
|
1919
1565
|
} else {
|
|
1920
1566
|
handleOptions.data = selectRecords;
|
|
1921
1567
|
}
|
|
1922
|
-
} else if (mode ===
|
|
1568
|
+
} else if (mode === "all") {
|
|
1923
1569
|
if (!$xeGGWrapper) {
|
|
1924
|
-
errLog(
|
|
1570
|
+
errLog("vxe.error.errProp", ["all", "mode=current,selected"]);
|
|
1925
1571
|
}
|
|
1926
1572
|
if ($xeGGWrapper && !handleOptions.remote) {
|
|
1927
1573
|
const gridReactData = $xeGGWrapper.reactData;
|
|
1928
|
-
const {
|
|
1929
|
-
|
|
1930
|
-
} =
|
|
1931
|
-
const
|
|
1932
|
-
const {
|
|
1933
|
-
sortData
|
|
1934
|
-
} = gridReactData;
|
|
1935
|
-
const {
|
|
1936
|
-
beforeQueryAll: oldBeforeQueryAll,
|
|
1937
|
-
afterQueryAll: oldAfterQueryAll,
|
|
1938
|
-
ajax = {}
|
|
1939
|
-
} = proxyOpts;
|
|
1940
|
-
const resConfigs = proxyOpts.response || proxyOpts.props || {};
|
|
1574
|
+
const { computeProxyOpts } = $xeGGWrapper.getComputeMaps();
|
|
1575
|
+
const proxyOpts2 = computeProxyOpts.value;
|
|
1576
|
+
const { sortData } = gridReactData;
|
|
1577
|
+
const { beforeQueryAll: oldBeforeQueryAll, afterQueryAll: oldAfterQueryAll, ajax = {} } = proxyOpts2;
|
|
1578
|
+
const resConfigs = proxyOpts2.response || proxyOpts2.props || {};
|
|
1941
1579
|
const beforeQueryAllMethod = ajax.beforeQueryAll;
|
|
1942
1580
|
const queryAllMethod = ajax.queryAll;
|
|
1943
1581
|
const afterQueryAllMethod = ajax.afterQueryAll;
|
|
1944
1582
|
const queryAllSuccessMethod = ajax.queryAllSuccess;
|
|
1945
1583
|
const queryAllErrorMethod = ajax.queryAllError;
|
|
1946
1584
|
if (!queryAllMethod) {
|
|
1947
|
-
errLog(
|
|
1585
|
+
errLog("vxe.error.notFunc", ["proxy-config.ajax.queryAll"]);
|
|
1948
1586
|
}
|
|
1949
1587
|
if (queryAllMethod) {
|
|
1950
1588
|
const params = {
|
|
@@ -1958,60 +1596,43 @@ hooks.add('tableExportModule', {
|
|
|
1958
1596
|
options: handleOptions
|
|
1959
1597
|
};
|
|
1960
1598
|
const handleQueryAll = () => {
|
|
1961
|
-
return Promise.resolve((oldBeforeQueryAll || queryAllMethod)(params)).then(rest => {
|
|
1599
|
+
return Promise.resolve((oldBeforeQueryAll || queryAllMethod)(params)).then((rest) => {
|
|
1962
1600
|
if (afterQueryAllMethod) {
|
|
1963
|
-
afterQueryAllMethod(
|
|
1964
|
-
response: rest,
|
|
1965
|
-
status: 'success'
|
|
1966
|
-
}));
|
|
1601
|
+
afterQueryAllMethod({ ...params, response: rest, status: "success" });
|
|
1967
1602
|
} else {
|
|
1968
1603
|
const listProp = resConfigs.list;
|
|
1969
1604
|
let tdData = [];
|
|
1970
1605
|
if (listProp) {
|
|
1971
|
-
if (
|
|
1972
|
-
tdData = listProp({
|
|
1973
|
-
data: rest,
|
|
1974
|
-
$table: $xeTable,
|
|
1975
|
-
$grid: $xeGrid,
|
|
1976
|
-
$gantt: $xeGantt
|
|
1977
|
-
});
|
|
1606
|
+
if (import_xe_utils.default.isFunction(listProp)) {
|
|
1607
|
+
tdData = listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
1978
1608
|
} else {
|
|
1979
|
-
tdData =
|
|
1609
|
+
tdData = import_xe_utils.default.isArray(rest) ? rest : import_xe_utils.default.get(rest, listProp);
|
|
1980
1610
|
}
|
|
1981
1611
|
} else {
|
|
1982
|
-
if (
|
|
1612
|
+
if (import_xe_utils.default.isArray(rest)) {
|
|
1983
1613
|
tdData = rest;
|
|
1984
1614
|
}
|
|
1985
1615
|
}
|
|
1986
1616
|
handleOptions.data = tdData;
|
|
1987
1617
|
if (oldAfterQueryAll) {
|
|
1988
|
-
oldAfterQueryAll(
|
|
1989
|
-
response: rest
|
|
1990
|
-
}));
|
|
1618
|
+
oldAfterQueryAll({ ...params, response: rest });
|
|
1991
1619
|
}
|
|
1992
1620
|
}
|
|
1993
1621
|
if (queryAllSuccessMethod) {
|
|
1994
|
-
queryAllSuccessMethod(
|
|
1995
|
-
response: rest
|
|
1996
|
-
}));
|
|
1622
|
+
queryAllSuccessMethod({ ...params, response: rest });
|
|
1997
1623
|
}
|
|
1998
1624
|
return handleExport(handleOptions);
|
|
1999
|
-
}).catch(rest => {
|
|
1625
|
+
}).catch((rest) => {
|
|
2000
1626
|
if (afterQueryAllMethod) {
|
|
2001
|
-
afterQueryAllMethod(
|
|
2002
|
-
response: rest,
|
|
2003
|
-
status: 'error'
|
|
2004
|
-
}));
|
|
1627
|
+
afterQueryAllMethod({ ...params, response: rest, status: "error" });
|
|
2005
1628
|
}
|
|
2006
1629
|
if (queryAllErrorMethod) {
|
|
2007
|
-
queryAllErrorMethod(
|
|
2008
|
-
response: rest
|
|
2009
|
-
}));
|
|
1630
|
+
queryAllErrorMethod({ ...params, response: rest });
|
|
2010
1631
|
}
|
|
2011
1632
|
});
|
|
2012
1633
|
};
|
|
2013
1634
|
if (beforeQueryAllMethod) {
|
|
2014
|
-
return Promise.resolve(beforeQueryAllMethod(params)).then(status => {
|
|
1635
|
+
return Promise.resolve(beforeQueryAllMethod(params)).then((status) => {
|
|
2015
1636
|
if (status !== false) {
|
|
2016
1637
|
return handleQueryAll();
|
|
2017
1638
|
}
|
|
@@ -2021,7 +1642,7 @@ hooks.add('tableExportModule', {
|
|
|
2021
1642
|
}
|
|
2022
1643
|
}
|
|
2023
1644
|
}
|
|
2024
|
-
if (mode ===
|
|
1645
|
+
if (mode === "current") {
|
|
2025
1646
|
handleOptions.data = treeConfig ? afterTreeFullData : afterFullData;
|
|
2026
1647
|
}
|
|
2027
1648
|
} else {
|
|
@@ -2031,24 +1652,16 @@ hooks.add('tableExportModule', {
|
|
|
2031
1652
|
},
|
|
2032
1653
|
importByFile(file, options) {
|
|
2033
1654
|
const opts = Object.assign({}, options);
|
|
2034
|
-
const {
|
|
2035
|
-
beforeImportMethod
|
|
2036
|
-
} = opts;
|
|
1655
|
+
const { beforeImportMethod } = opts;
|
|
2037
1656
|
if (beforeImportMethod) {
|
|
2038
|
-
const biRest = beforeImportMethod({
|
|
2039
|
-
|
|
2040
|
-
$table: $xeTable
|
|
2041
|
-
});
|
|
2042
|
-
if (_xeUtils.default.isBoolean(biRest)) {
|
|
1657
|
+
const biRest = beforeImportMethod({ options: opts, $table: $xeTable });
|
|
1658
|
+
if (import_xe_utils.default.isBoolean(biRest)) {
|
|
2043
1659
|
if (!biRest) {
|
|
2044
|
-
const params = {
|
|
2045
|
-
status: false,
|
|
2046
|
-
mas: 'before prevent'
|
|
2047
|
-
};
|
|
1660
|
+
const params = { status: false, mas: "before prevent" };
|
|
2048
1661
|
return Promise.reject(params);
|
|
2049
1662
|
}
|
|
2050
1663
|
} else {
|
|
2051
|
-
warnLog(
|
|
1664
|
+
warnLog("vxe.error.returnErr", ["beforeImportMethod", "boolean", biRest]);
|
|
2052
1665
|
}
|
|
2053
1666
|
}
|
|
2054
1667
|
return handleFileImport(file, opts);
|
|
@@ -2056,52 +1669,37 @@ hooks.add('tableExportModule', {
|
|
|
2056
1669
|
importData(options) {
|
|
2057
1670
|
const importOpts = computeImportOpts.value;
|
|
2058
1671
|
const opts = Object.assign({
|
|
2059
|
-
types:
|
|
1672
|
+
types: import_xe_utils.default.keys(importOpts._typeMaps)
|
|
2060
1673
|
// beforeImportMethod: null,
|
|
2061
1674
|
// afterImportMethod: null
|
|
2062
1675
|
}, importOpts, options);
|
|
2063
|
-
const {
|
|
2064
|
-
beforeImportMethod,
|
|
2065
|
-
afterImportMethod
|
|
2066
|
-
} = opts;
|
|
1676
|
+
const { beforeImportMethod, afterImportMethod } = opts;
|
|
2067
1677
|
if (beforeImportMethod) {
|
|
2068
|
-
const biRest = beforeImportMethod({
|
|
2069
|
-
|
|
2070
|
-
$table: $xeTable
|
|
2071
|
-
});
|
|
2072
|
-
if (_xeUtils.default.isBoolean(biRest)) {
|
|
1678
|
+
const biRest = beforeImportMethod({ options: opts, $table: $xeTable });
|
|
1679
|
+
if (import_xe_utils.default.isBoolean(biRest)) {
|
|
2073
1680
|
if (!biRest) {
|
|
2074
|
-
const params = {
|
|
2075
|
-
status: false,
|
|
2076
|
-
mas: 'before prevent'
|
|
2077
|
-
};
|
|
1681
|
+
const params = { status: false, mas: "before prevent" };
|
|
2078
1682
|
return Promise.reject(params);
|
|
2079
1683
|
}
|
|
2080
1684
|
} else {
|
|
2081
|
-
warnLog(
|
|
1685
|
+
warnLog("vxe.error.returnErr", ["beforeImportMethod", "boolean", biRest]);
|
|
2082
1686
|
}
|
|
2083
1687
|
}
|
|
2084
|
-
return
|
|
1688
|
+
return import_ui.VxeUI.readFile(opts).catch((e) => {
|
|
2085
1689
|
if (afterImportMethod) {
|
|
2086
|
-
afterImportMethod({
|
|
2087
|
-
status: false,
|
|
2088
|
-
options: opts,
|
|
2089
|
-
$table: $xeTable
|
|
2090
|
-
});
|
|
1690
|
+
afterImportMethod({ status: false, options: opts, $table: $xeTable });
|
|
2091
1691
|
}
|
|
2092
1692
|
return Promise.reject(e);
|
|
2093
|
-
}).then(params => {
|
|
2094
|
-
const {
|
|
2095
|
-
file
|
|
2096
|
-
} = params;
|
|
1693
|
+
}).then((params) => {
|
|
1694
|
+
const { file } = params;
|
|
2097
1695
|
return handleFileImport(file, opts);
|
|
2098
1696
|
});
|
|
2099
1697
|
},
|
|
2100
1698
|
saveFile(options) {
|
|
2101
|
-
return
|
|
1699
|
+
return import_ui.VxeUI.saveFile(options);
|
|
2102
1700
|
},
|
|
2103
1701
|
readFile(options) {
|
|
2104
|
-
return
|
|
1702
|
+
return import_ui.VxeUI.readFile(options);
|
|
2105
1703
|
},
|
|
2106
1704
|
print(options) {
|
|
2107
1705
|
const $xeGrid = $xeTable.xeGrid;
|
|
@@ -2111,17 +1709,15 @@ hooks.add('tableExportModule', {
|
|
|
2111
1709
|
original: false
|
|
2112
1710
|
// beforePrintMethod
|
|
2113
1711
|
}, printOpts, options, {
|
|
2114
|
-
type:
|
|
1712
|
+
type: "html",
|
|
2115
1713
|
download: false,
|
|
2116
1714
|
remote: false,
|
|
2117
1715
|
print: true
|
|
2118
1716
|
});
|
|
2119
|
-
const {
|
|
2120
|
-
|
|
2121
|
-
} = opts;
|
|
2122
|
-
let printTitle = '';
|
|
1717
|
+
const { sheetName } = opts;
|
|
1718
|
+
let printTitle = "";
|
|
2123
1719
|
if (sheetName) {
|
|
2124
|
-
if (
|
|
1720
|
+
if (import_xe_utils.default.isFunction(sheetName)) {
|
|
2125
1721
|
printTitle = sheetName({
|
|
2126
1722
|
options: opts,
|
|
2127
1723
|
$table: $xeTable,
|
|
@@ -2133,66 +1729,20 @@ hooks.add('tableExportModule', {
|
|
|
2133
1729
|
}
|
|
2134
1730
|
}
|
|
2135
1731
|
if (!printTitle) {
|
|
2136
|
-
printTitle = document.title ||
|
|
1732
|
+
printTitle = document.title || "";
|
|
2137
1733
|
}
|
|
2138
1734
|
const beforePrintMethod = opts.beforePrintMethod;
|
|
2139
1735
|
const printMethod = opts.printMethod;
|
|
2140
1736
|
const tableHtml = opts.html || opts.content;
|
|
2141
1737
|
return new Promise((resolve, reject) => {
|
|
2142
|
-
if (
|
|
1738
|
+
if (import_ui.VxeUI.print) {
|
|
2143
1739
|
if (tableHtml) {
|
|
2144
|
-
resolve(
|
|
2145
|
-
|
|
2146
|
-
html: tableHtml,
|
|
2147
|
-
customStyle: opts.style,
|
|
2148
|
-
beforeMethod: beforePrintMethod ? ({
|
|
2149
|
-
html
|
|
2150
|
-
}) => {
|
|
2151
|
-
return beforePrintMethod({
|
|
2152
|
-
html,
|
|
2153
|
-
content: html,
|
|
2154
|
-
options: opts,
|
|
2155
|
-
$table: $xeTable,
|
|
2156
|
-
$grid: $xeGrid,
|
|
2157
|
-
$gantt: $xeGantt
|
|
2158
|
-
});
|
|
2159
|
-
} : undefined,
|
|
2160
|
-
beforePrintMethod: beforePrintMethod ? ({
|
|
2161
|
-
html
|
|
2162
|
-
}) => {
|
|
2163
|
-
return beforePrintMethod({
|
|
2164
|
-
html,
|
|
2165
|
-
content: html,
|
|
2166
|
-
options: opts,
|
|
2167
|
-
$table: $xeTable,
|
|
2168
|
-
$grid: $xeGrid,
|
|
2169
|
-
$gantt: $xeGantt
|
|
2170
|
-
});
|
|
2171
|
-
} : undefined,
|
|
2172
|
-
printMethod: printMethod ? ({
|
|
2173
|
-
html
|
|
2174
|
-
}) => {
|
|
2175
|
-
return printMethod({
|
|
2176
|
-
html,
|
|
2177
|
-
content: html,
|
|
2178
|
-
options: opts,
|
|
2179
|
-
$table: $xeTable,
|
|
2180
|
-
$grid: $xeGrid,
|
|
2181
|
-
$gantt: $xeGantt
|
|
2182
|
-
});
|
|
2183
|
-
} : undefined
|
|
2184
|
-
}));
|
|
2185
|
-
} else {
|
|
2186
|
-
resolve(exportMethods.exportData(opts).then(({
|
|
2187
|
-
content
|
|
2188
|
-
}) => {
|
|
2189
|
-
return _ui.VxeUI.print({
|
|
1740
|
+
resolve(
|
|
1741
|
+
import_ui.VxeUI.print({
|
|
2190
1742
|
title: printTitle,
|
|
2191
|
-
html:
|
|
1743
|
+
html: tableHtml,
|
|
2192
1744
|
customStyle: opts.style,
|
|
2193
|
-
beforeMethod: beforePrintMethod ? ({
|
|
2194
|
-
html
|
|
2195
|
-
}) => {
|
|
1745
|
+
beforeMethod: beforePrintMethod ? ({ html }) => {
|
|
2196
1746
|
return beforePrintMethod({
|
|
2197
1747
|
html,
|
|
2198
1748
|
content: html,
|
|
@@ -2201,10 +1751,8 @@ hooks.add('tableExportModule', {
|
|
|
2201
1751
|
$grid: $xeGrid,
|
|
2202
1752
|
$gantt: $xeGantt
|
|
2203
1753
|
});
|
|
2204
|
-
} :
|
|
2205
|
-
beforePrintMethod: beforePrintMethod ? ({
|
|
2206
|
-
html
|
|
2207
|
-
}) => {
|
|
1754
|
+
} : void 0,
|
|
1755
|
+
beforePrintMethod: beforePrintMethod ? ({ html }) => {
|
|
2208
1756
|
return beforePrintMethod({
|
|
2209
1757
|
html,
|
|
2210
1758
|
content: html,
|
|
@@ -2213,10 +1761,8 @@ hooks.add('tableExportModule', {
|
|
|
2213
1761
|
$grid: $xeGrid,
|
|
2214
1762
|
$gantt: $xeGantt
|
|
2215
1763
|
});
|
|
2216
|
-
} :
|
|
2217
|
-
printMethod: printMethod ? ({
|
|
2218
|
-
html
|
|
2219
|
-
}) => {
|
|
1764
|
+
} : void 0,
|
|
1765
|
+
printMethod: printMethod ? ({ html }) => {
|
|
2220
1766
|
return printMethod({
|
|
2221
1767
|
html,
|
|
2222
1768
|
content: html,
|
|
@@ -2225,16 +1771,53 @@ hooks.add('tableExportModule', {
|
|
|
2225
1771
|
$grid: $xeGrid,
|
|
2226
1772
|
$gantt: $xeGantt
|
|
2227
1773
|
});
|
|
2228
|
-
} :
|
|
2229
|
-
})
|
|
2230
|
-
|
|
1774
|
+
} : void 0
|
|
1775
|
+
})
|
|
1776
|
+
);
|
|
1777
|
+
} else {
|
|
1778
|
+
resolve(
|
|
1779
|
+
exportMethods.exportData(opts).then(({ content }) => {
|
|
1780
|
+
return import_ui.VxeUI.print({
|
|
1781
|
+
title: printTitle,
|
|
1782
|
+
html: content,
|
|
1783
|
+
customStyle: opts.style,
|
|
1784
|
+
beforeMethod: beforePrintMethod ? ({ html }) => {
|
|
1785
|
+
return beforePrintMethod({
|
|
1786
|
+
html,
|
|
1787
|
+
content: html,
|
|
1788
|
+
options: opts,
|
|
1789
|
+
$table: $xeTable,
|
|
1790
|
+
$grid: $xeGrid,
|
|
1791
|
+
$gantt: $xeGantt
|
|
1792
|
+
});
|
|
1793
|
+
} : void 0,
|
|
1794
|
+
beforePrintMethod: beforePrintMethod ? ({ html }) => {
|
|
1795
|
+
return beforePrintMethod({
|
|
1796
|
+
html,
|
|
1797
|
+
content: html,
|
|
1798
|
+
options: opts,
|
|
1799
|
+
$table: $xeTable,
|
|
1800
|
+
$grid: $xeGrid,
|
|
1801
|
+
$gantt: $xeGantt
|
|
1802
|
+
});
|
|
1803
|
+
} : void 0,
|
|
1804
|
+
printMethod: printMethod ? ({ html }) => {
|
|
1805
|
+
return printMethod({
|
|
1806
|
+
html,
|
|
1807
|
+
content: html,
|
|
1808
|
+
options: opts,
|
|
1809
|
+
$table: $xeTable,
|
|
1810
|
+
$grid: $xeGrid,
|
|
1811
|
+
$gantt: $xeGantt
|
|
1812
|
+
});
|
|
1813
|
+
} : void 0
|
|
1814
|
+
});
|
|
1815
|
+
})
|
|
1816
|
+
);
|
|
2231
1817
|
}
|
|
2232
1818
|
} else {
|
|
2233
|
-
errLog(
|
|
2234
|
-
const e = {
|
|
2235
|
-
status: false,
|
|
2236
|
-
msg: 'print not exist'
|
|
2237
|
-
};
|
|
1819
|
+
errLog("vxe.error.reqComp", ["vxe-print"]);
|
|
1820
|
+
const e = { status: false, msg: "print not exist" };
|
|
2238
1821
|
reject(e);
|
|
2239
1822
|
}
|
|
2240
1823
|
});
|
|
@@ -2245,67 +1828,54 @@ hooks.add('tableExportModule', {
|
|
|
2245
1828
|
original: false
|
|
2246
1829
|
// beforePrintMethod
|
|
2247
1830
|
}, printOpts, options, {
|
|
2248
|
-
type:
|
|
1831
|
+
type: "html",
|
|
2249
1832
|
download: false,
|
|
2250
1833
|
remote: false,
|
|
2251
1834
|
print: true
|
|
2252
1835
|
});
|
|
2253
|
-
return $xeTable.exportData(opts).then(({
|
|
2254
|
-
content
|
|
2255
|
-
}) => {
|
|
1836
|
+
return $xeTable.exportData(opts).then(({ content }) => {
|
|
2256
1837
|
return {
|
|
2257
1838
|
html: content
|
|
2258
1839
|
};
|
|
2259
1840
|
});
|
|
2260
1841
|
},
|
|
2261
1842
|
closeImport() {
|
|
2262
|
-
if (
|
|
2263
|
-
return
|
|
1843
|
+
if (import_ui.VxeUI.modal) {
|
|
1844
|
+
return import_ui.VxeUI.modal.close("VXE_IMPORT_MODAL");
|
|
2264
1845
|
}
|
|
2265
1846
|
return Promise.resolve();
|
|
2266
1847
|
},
|
|
2267
1848
|
openImport(options) {
|
|
2268
|
-
const {
|
|
2269
|
-
|
|
2270
|
-
importConfig
|
|
2271
|
-
} = props;
|
|
2272
|
-
const {
|
|
2273
|
-
initStore,
|
|
2274
|
-
importStore,
|
|
2275
|
-
importParams
|
|
2276
|
-
} = reactData;
|
|
1849
|
+
const { treeConfig, importConfig } = props;
|
|
1850
|
+
const { initStore, importStore, importParams } = reactData;
|
|
2277
1851
|
const importOpts = computeImportOpts.value;
|
|
2278
1852
|
const defOpts = Object.assign({
|
|
2279
|
-
mode:
|
|
1853
|
+
mode: "insertTop",
|
|
2280
1854
|
message: true,
|
|
2281
|
-
types:
|
|
2282
|
-
modes: [
|
|
1855
|
+
types: import_xe_utils.default.keys(importOpts._typeMaps),
|
|
1856
|
+
modes: ["insertTop", "covering"]
|
|
2283
1857
|
}, importOpts, options);
|
|
2284
1858
|
const types = defOpts.types || [];
|
|
2285
1859
|
const modes = defOpts.modes || [];
|
|
2286
1860
|
const isTree = !!treeConfig;
|
|
2287
1861
|
if (isTree) {
|
|
2288
1862
|
if (defOpts.message) {
|
|
2289
|
-
if (
|
|
2290
|
-
|
|
2291
|
-
content: getI18n('vxe.error.treeNotImp'),
|
|
2292
|
-
status: 'error'
|
|
2293
|
-
});
|
|
1863
|
+
if (import_ui.VxeUI.modal) {
|
|
1864
|
+
import_ui.VxeUI.modal.message({ content: getI18n("vxe.error.treeNotImp"), status: "error" });
|
|
2294
1865
|
}
|
|
2295
1866
|
}
|
|
2296
1867
|
return;
|
|
2297
1868
|
}
|
|
2298
|
-
if (!(0,
|
|
2299
|
-
errLog(
|
|
1869
|
+
if (!(0, import_utils.hasEnableConf)(importConfig, importOpts)) {
|
|
1870
|
+
errLog("vxe.error.reqProp", ["import-config"]);
|
|
2300
1871
|
}
|
|
2301
|
-
|
|
2302
|
-
const typeList = types.map(value => {
|
|
1872
|
+
const typeList = types.map((value) => {
|
|
2303
1873
|
return {
|
|
2304
1874
|
value,
|
|
2305
1875
|
label: getI18n(`vxe.export.types.${value}`)
|
|
2306
1876
|
};
|
|
2307
1877
|
});
|
|
2308
|
-
const modeList = modes.map(item => {
|
|
1878
|
+
const modeList = modes.map((item) => {
|
|
2309
1879
|
if (item && item.value) {
|
|
2310
1880
|
return {
|
|
2311
1881
|
value: item.value,
|
|
@@ -2319,44 +1889,40 @@ hooks.add('tableExportModule', {
|
|
|
2319
1889
|
});
|
|
2320
1890
|
Object.assign(importStore, {
|
|
2321
1891
|
file: null,
|
|
2322
|
-
type:
|
|
2323
|
-
filename:
|
|
1892
|
+
type: "",
|
|
1893
|
+
filename: "",
|
|
2324
1894
|
modeList,
|
|
2325
1895
|
typeList,
|
|
2326
1896
|
visible: true
|
|
2327
1897
|
});
|
|
2328
1898
|
Object.assign(importParams, defOpts);
|
|
2329
|
-
if (!modeList.some(item => item.value === importParams.mode)) {
|
|
1899
|
+
if (!modeList.some((item) => item.value === importParams.mode)) {
|
|
2330
1900
|
importParams.mode = modeList[0].value;
|
|
2331
1901
|
}
|
|
2332
1902
|
initStore.import = true;
|
|
2333
1903
|
},
|
|
2334
1904
|
closeExport: handleCloseExport,
|
|
2335
1905
|
openExport(options) {
|
|
2336
|
-
const {
|
|
2337
|
-
exportConfig
|
|
2338
|
-
} = props;
|
|
1906
|
+
const { exportConfig } = props;
|
|
2339
1907
|
const exportOpts = computeExportOpts.value;
|
|
2340
1908
|
const defOpts = Object.assign({
|
|
2341
1909
|
message: true,
|
|
2342
|
-
types:
|
|
1910
|
+
types: import_xe_utils.default.keys(exportOpts._typeMaps)
|
|
2343
1911
|
}, exportOpts, options);
|
|
2344
|
-
if (!(0,
|
|
2345
|
-
errLog(
|
|
1912
|
+
if (!(0, import_utils.hasEnableConf)(exportConfig, exportOpts)) {
|
|
1913
|
+
errLog("vxe.error.reqProp", ["export-config"]);
|
|
2346
1914
|
}
|
|
2347
1915
|
return handleExportAndPrint(defOpts);
|
|
2348
1916
|
},
|
|
2349
1917
|
closePrint: handleCloseExport,
|
|
2350
1918
|
openPrint(options) {
|
|
2351
|
-
const {
|
|
2352
|
-
printConfig
|
|
2353
|
-
} = props;
|
|
1919
|
+
const { printConfig } = props;
|
|
2354
1920
|
const printOpts = computePrintOpts.value;
|
|
2355
1921
|
const defOpts = Object.assign({
|
|
2356
1922
|
message: true
|
|
2357
1923
|
}, printOpts, options);
|
|
2358
|
-
if (!(0,
|
|
2359
|
-
errLog(
|
|
1924
|
+
if (!(0, import_utils.hasEnableConf)(printConfig, printOpts)) {
|
|
1925
|
+
errLog("vxe.error.reqProp", ["print-config"]);
|
|
2360
1926
|
}
|
|
2361
1927
|
return handleExportAndPrint(defOpts, true);
|
|
2362
1928
|
}
|
|
@@ -2369,4 +1935,4 @@ hooks.add('tableExportModule', {
|
|
|
2369
1935
|
setupGantt($xeGantt) {
|
|
2370
1936
|
return $xeGantt.extendTableMethods(tableExportMethodKeys);
|
|
2371
1937
|
}
|
|
2372
|
-
});
|
|
1938
|
+
});
|