vxe-table 4.23.5 → 4.23.7
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 +32456 -33938
- 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/style.css +4501 -1
- package/es/style.mini.css +1 -0
- 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 +14061 -15071
- 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.1792979665397.ttf +0 -0
- package/lib/iconfont.1792979665397.woff +0 -0
- package/lib/iconfont.1792979665397.woff2 +0 -0
- package/lib/index.common.js +35 -19
- package/lib/index.js +37 -0
- package/lib/index.umd.js +30584 -24324
- 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 +248 -618
- 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 -1023
- 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/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.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.1792838769925.ttf → dist/iconfont.1792979665397.ttf} +0 -0
- /package/{es/iconfont.1792838769925.woff → dist/iconfont.1792979665397.woff} +0 -0
- /package/{es/iconfont.1792838769925.woff2 → dist/iconfont.1792979665397.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.1792838769925.ttf → es/iconfont.1792979665397.ttf} +0 -0
- /package/{lib/iconfont.1792838769925.woff → es/iconfont.1792979665397.woff} +0 -0
- /package/{lib/iconfont.1792838769925.woff2 → es/iconfont.1792979665397.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
package/es/table/src/cell.js
CHANGED
|
@@ -1,1266 +1,1268 @@
|
|
|
1
|
-
import { h } from
|
|
2
|
-
import XEUtils from
|
|
3
|
-
import { VxeUI } from
|
|
4
|
-
import { getFuncText, isEnableConf, formatText, eqEmptyValue } from
|
|
5
|
-
import { updateCellTitle } from
|
|
6
|
-
import { createColumn, getRowid } from
|
|
7
|
-
import { getSlotVNs } from
|
|
1
|
+
import { h } from "vue";
|
|
2
|
+
import XEUtils from "xe-utils";
|
|
3
|
+
import { VxeUI } from "../../ui";
|
|
4
|
+
import { getFuncText, isEnableConf, formatText, eqEmptyValue } from "../../ui/src/utils";
|
|
5
|
+
import { updateCellTitle } from "../../ui/src/dom";
|
|
6
|
+
import { createColumn, getRowid } from "./util";
|
|
7
|
+
import { getSlotVNs } from "../../ui/src/vn";
|
|
8
8
|
const { getConfig, getI18n, getIcon, renderer, renderEmptyElement } = VxeUI;
|
|
9
9
|
function renderTitlePrefixIcon(params) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const { $table, column } = params;
|
|
11
|
+
const titlePrefix = column.titlePrefix || column.titleHelp;
|
|
12
|
+
if (titlePrefix) {
|
|
13
|
+
return h("span", {
|
|
14
|
+
class: ["vxe-cell-title-prefix-icon", titlePrefix.iconStatus ? `theme--${titlePrefix.iconStatus}` : ""],
|
|
15
|
+
onMouseenter(evnt) {
|
|
16
|
+
$table.triggerHeaderTitleEvent(evnt, titlePrefix, params);
|
|
17
|
+
},
|
|
18
|
+
onMouseleave(evnt) {
|
|
19
|
+
$table.handleTargetLeaveEvent(evnt);
|
|
20
|
+
}
|
|
21
|
+
}, [
|
|
22
|
+
h("i", {
|
|
23
|
+
class: titlePrefix.icon || getIcon().TABLE_TITLE_PREFIX
|
|
24
|
+
})
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
return renderEmptyElement($table);
|
|
28
28
|
}
|
|
29
29
|
function renderTitleSuffixIcon(params) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
const { $table, column } = params;
|
|
31
|
+
const titleSuffix = column.titleSuffix;
|
|
32
|
+
if (titleSuffix) {
|
|
33
|
+
return h("span", {
|
|
34
|
+
class: ["vxe-cell-title-suffix-icon", titleSuffix.iconStatus ? `theme--${titleSuffix.iconStatus}` : ""],
|
|
35
|
+
onMouseenter(evnt) {
|
|
36
|
+
$table.triggerHeaderTitleEvent(evnt, titleSuffix, params);
|
|
37
|
+
},
|
|
38
|
+
onMouseleave(evnt) {
|
|
39
|
+
$table.handleTargetLeaveEvent(evnt);
|
|
40
|
+
}
|
|
41
|
+
}, [
|
|
42
|
+
h("i", {
|
|
43
|
+
class: titleSuffix.icon || getIcon().TABLE_TITLE_SUFFIX
|
|
44
|
+
})
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
return renderEmptyElement($table);
|
|
48
48
|
}
|
|
49
49
|
function renderCellDragIcon(params) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
50
|
+
const { $table, column } = params;
|
|
51
|
+
const { context } = $table;
|
|
52
|
+
const tableSlots = context.slots;
|
|
53
|
+
const tableProps = $table.props;
|
|
54
|
+
const { slots } = column;
|
|
55
|
+
const { dragConfig } = tableProps;
|
|
56
|
+
const { computeRowDragOpts } = $table.getComputeMaps();
|
|
57
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
58
|
+
const { icon, trigger, disabledMethod } = rowDragOpts;
|
|
59
|
+
const rDisabledMethod = disabledMethod || (dragConfig ? dragConfig.rowDisabledMethod : null);
|
|
60
|
+
const isDisabled = rDisabledMethod && rDisabledMethod(params);
|
|
61
|
+
const rowDragIconSlot = (slots ? slots.rowDragIcon || slots["row-drag-icon"] : null) || tableSlots.rowDragIcon || tableSlots["row-drag-icon"];
|
|
62
|
+
const ons = {};
|
|
63
|
+
if (trigger !== "cell") {
|
|
64
|
+
ons.onMousedown = (evnt) => {
|
|
65
|
+
if (!isDisabled) {
|
|
66
|
+
$table.handleCellDragMousedownEvent(evnt, params);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
ons.onMouseup = $table.handleCellDragMouseupEvent;
|
|
70
|
+
}
|
|
71
|
+
return h("span", {
|
|
72
|
+
key: "dg",
|
|
73
|
+
class: ["vxe-cell--drag-handle", {
|
|
74
|
+
"is--disabled": isDisabled
|
|
75
|
+
}],
|
|
76
|
+
...ons
|
|
77
|
+
}, rowDragIconSlot ? $table.callSlot(rowDragIconSlot, params) : [
|
|
78
|
+
h("i", {
|
|
79
|
+
class: icon || (dragConfig ? dragConfig.rowIcon : "") || getIcon().TABLE_DRAG_ROW
|
|
80
|
+
})
|
|
81
|
+
]);
|
|
80
82
|
}
|
|
81
83
|
function renderCellBaseVNs(params, content) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
84
|
+
const { $table, column, level } = params;
|
|
85
|
+
const { dragSort } = column;
|
|
86
|
+
const tableProps = $table.props;
|
|
87
|
+
const { treeConfig, dragConfig } = tableProps;
|
|
88
|
+
const { computeRowOpts, computeRowDragOpts, computeTreeOpts } = $table.getComputeMaps();
|
|
89
|
+
const rowOpts = computeRowOpts.value;
|
|
90
|
+
const rowDragOpts = computeRowDragOpts.value;
|
|
91
|
+
const treeOpts = computeTreeOpts.value;
|
|
92
|
+
const { showIcon, isPeerDrag, isCrossDrag, visibleMethod } = rowDragOpts;
|
|
93
|
+
const rVisibleMethod = visibleMethod || (dragConfig ? dragConfig.rowVisibleMethod : null);
|
|
94
|
+
const vns = [];
|
|
95
|
+
if (dragSort && rowOpts.drag && ((showIcon || (dragConfig ? dragConfig.showRowIcon : false)) && (!rVisibleMethod || rVisibleMethod(params)))) {
|
|
96
|
+
if (treeConfig) {
|
|
97
|
+
if (treeOpts.transform && (isPeerDrag || isCrossDrag || !level)) {
|
|
98
|
+
vns.push(
|
|
99
|
+
renderCellDragIcon(params)
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
vns.push(
|
|
104
|
+
renderCellDragIcon(params)
|
|
105
|
+
);
|
|
102
106
|
}
|
|
103
|
-
|
|
107
|
+
}
|
|
108
|
+
return vns.concat(XEUtils.isArray(content) ? content : [content]);
|
|
104
109
|
}
|
|
105
110
|
function renderHeaderCellDragIcon(params) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
111
|
+
const { $table, column } = params;
|
|
112
|
+
const { context } = $table;
|
|
113
|
+
const tableSlots = context.slots;
|
|
114
|
+
const { slots } = column;
|
|
115
|
+
const { computeColumnOpts, computeColumnDragOpts } = $table.getComputeMaps();
|
|
116
|
+
const columnOpts = computeColumnOpts.value;
|
|
117
|
+
const columnDragOpts = computeColumnDragOpts.value;
|
|
118
|
+
const { showIcon, icon, trigger, isPeerDrag, isCrossDrag, visibleMethod, disabledMethod } = columnDragOpts;
|
|
119
|
+
if (columnOpts.drag && showIcon && (!visibleMethod || visibleMethod(params))) {
|
|
120
|
+
if (!column.fixed && (isPeerDrag || isCrossDrag || !column.parentId)) {
|
|
121
|
+
const isDisabled = disabledMethod && disabledMethod(params);
|
|
122
|
+
const columnDragIconSlot = (slots ? slots.columnDragIcon || slots["column-drag-icon"] : null) || tableSlots.columnDragIcon || tableSlots["column-drag-icon"];
|
|
123
|
+
const ons = {};
|
|
124
|
+
if (trigger !== "cell") {
|
|
125
|
+
ons.onMousedown = (evnt) => {
|
|
126
|
+
if (!isDisabled) {
|
|
127
|
+
$table.handleHeaderCellDragMousedownEvent(evnt, params);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
ons.onMouseup = $table.handleHeaderCellDragMouseupEvent;
|
|
131
|
+
}
|
|
132
|
+
return h("span", {
|
|
133
|
+
key: "dg",
|
|
134
|
+
class: ["vxe-cell--drag-handle", {
|
|
135
|
+
"is--disabled": isDisabled
|
|
136
|
+
}],
|
|
137
|
+
...ons
|
|
138
|
+
}, columnDragIconSlot ? $table.callSlot(columnDragIconSlot, params) : [
|
|
139
|
+
h("i", {
|
|
140
|
+
class: icon || getIcon().TABLE_DRAG_COLUMN
|
|
141
|
+
})
|
|
142
|
+
]);
|
|
137
143
|
}
|
|
138
|
-
|
|
144
|
+
}
|
|
145
|
+
return renderEmptyElement($table);
|
|
139
146
|
}
|
|
140
147
|
function renderHeaderCellBaseVNs(params, content) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
+
const vns = [
|
|
149
|
+
renderTitlePrefixIcon(params),
|
|
150
|
+
renderHeaderCellDragIcon(params),
|
|
151
|
+
...XEUtils.isArray(content) ? content : [content],
|
|
152
|
+
renderTitleSuffixIcon(params)
|
|
153
|
+
];
|
|
154
|
+
return vns;
|
|
148
155
|
}
|
|
149
156
|
function getRenderDefaultColumnTitle(column, content) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
if (column.type === "html" && XEUtils.isString(content)) {
|
|
158
|
+
return h("span", {
|
|
159
|
+
key: "ch",
|
|
160
|
+
innerHTML: content
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return h("span", {
|
|
164
|
+
key: "ct"
|
|
165
|
+
}, getSlotVNs(content));
|
|
159
166
|
}
|
|
160
167
|
function renderTitleContent(params, content) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
168
|
+
const { $table, column } = params;
|
|
169
|
+
const tableProps = $table.props;
|
|
170
|
+
const tableReactData = $table.reactData;
|
|
171
|
+
const { computeHeaderTooltipOpts } = $table.getComputeMaps();
|
|
172
|
+
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
173
|
+
const { isRowGroupStatus } = tableReactData;
|
|
174
|
+
const { showHeaderOverflow, slots } = column;
|
|
175
|
+
const titleSlot = slots ? slots.title : null;
|
|
176
|
+
const headerTooltipOpts = computeHeaderTooltipOpts.value;
|
|
177
|
+
const showAllTip = headerTooltipOpts.showAll;
|
|
178
|
+
const headOverflow = XEUtils.eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
179
|
+
const showTitle = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === "title";
|
|
180
|
+
const showTooltip = (headOverflow === true ? headerTooltipOpts.mode : headOverflow) === "tooltip";
|
|
181
|
+
const ons = {};
|
|
182
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
183
|
+
ons.onMouseenter = (evnt) => {
|
|
184
|
+
if (tableReactData.isDragResize) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (showTitle) {
|
|
188
|
+
updateCellTitle(evnt.currentTarget, column);
|
|
189
|
+
} else if (showTooltip || showAllTip) {
|
|
190
|
+
$table.triggerHeaderTooltipEvent(evnt, params);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
if (showTooltip || showAllTip) {
|
|
195
|
+
ons.onMouseleave = (evnt) => {
|
|
196
|
+
if (tableReactData.isDragResize) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (showTooltip || showAllTip) {
|
|
200
|
+
$table.handleTargetLeaveEvent(evnt);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const titleVN = getRenderDefaultColumnTitle(column, content);
|
|
205
|
+
return [
|
|
206
|
+
h("span", {
|
|
207
|
+
class: "vxe-cell--title",
|
|
208
|
+
...ons
|
|
209
|
+
}, isRowGroupStatus && column.aggFunc && $table.getPivotTableAggregateRenderColTitles ? $table.getPivotTableAggregateRenderColTitles(column, titleVN) : titleSlot ? $table.callSlot(titleSlot, params) : [
|
|
210
|
+
titleVN
|
|
211
|
+
])
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
function getFooterContent(params) {
|
|
215
|
+
const { $table, column, row } = params;
|
|
216
|
+
const tableProps = $table.props;
|
|
217
|
+
const { editConfig } = tableProps;
|
|
218
|
+
const { slots, editRender, cellRender } = column;
|
|
219
|
+
const footerSlot = slots ? slots.footer : null;
|
|
220
|
+
if (footerSlot) {
|
|
221
|
+
return $table.callSlot(footerSlot, params);
|
|
222
|
+
}
|
|
223
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
224
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
225
|
+
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
226
|
+
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
227
|
+
const itemValue = $table.getFooterCellLabel(row, column);
|
|
228
|
+
if (renderOpts) {
|
|
229
|
+
const { computeRendererOpts } = $table.getComputeMaps();
|
|
230
|
+
const rendererOpts = computeRendererOpts.value;
|
|
231
|
+
const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null;
|
|
232
|
+
if (compConf) {
|
|
233
|
+
const rtFooter = compConf.renderTableFooter || compConf.renderFooter;
|
|
234
|
+
if (rtFooter) {
|
|
235
|
+
const footParams = Object.assign(params, {
|
|
236
|
+
cellValue: itemValue,
|
|
237
|
+
itemValue
|
|
238
|
+
});
|
|
239
|
+
return getSlotVNs(rtFooter(renderOpts, footParams));
|
|
240
|
+
}
|
|
187
241
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
242
|
+
}
|
|
243
|
+
return [
|
|
244
|
+
h("span", {
|
|
245
|
+
class: "vxe-cell--label"
|
|
246
|
+
}, formatText(itemValue, 1))
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
function getDefaultCellLabel(params) {
|
|
250
|
+
const { $table, row, column } = params;
|
|
251
|
+
return formatText($table.getCellLabel(row, column), 1);
|
|
252
|
+
}
|
|
253
|
+
function renderCellHandle(params) {
|
|
254
|
+
const { column, row, $table } = params;
|
|
255
|
+
const tableProps = $table.props;
|
|
256
|
+
const tableReactData = $table.reactData;
|
|
257
|
+
const { isRowGroupStatus } = tableReactData;
|
|
258
|
+
const { editConfig } = tableProps;
|
|
259
|
+
const { type, treeNode, rowGroupNode, editRender } = column;
|
|
260
|
+
const { computeEditOpts, computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
261
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
262
|
+
const { mode } = aggregateOpts;
|
|
263
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
264
|
+
const editOpts = computeEditOpts.value;
|
|
265
|
+
const isDeepCell = treeNode || isRowGroupStatus && (mode === "column" ? column.field === row.groupField : rowGroupNode);
|
|
266
|
+
switch (type) {
|
|
267
|
+
case "seq":
|
|
268
|
+
return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params);
|
|
269
|
+
case "radio":
|
|
270
|
+
return isDeepCell ? Cell.renderDeepRadioCell(params) : Cell.renderRadioCell(params);
|
|
271
|
+
case "checkbox":
|
|
272
|
+
return checkboxOpts.checkField ? isDeepCell ? Cell.renderDeepSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params) : isDeepCell ? Cell.renderDeepSelectionCell(params) : Cell.renderCheckboxCell(params);
|
|
273
|
+
case "expand":
|
|
274
|
+
return Cell.renderExpandCell(params);
|
|
275
|
+
case "html":
|
|
276
|
+
return isDeepCell ? Cell.renderDeepHTMLCell(params) : Cell.renderHTMLCell(params);
|
|
277
|
+
}
|
|
278
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
279
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
280
|
+
if (editRenderOpts) {
|
|
281
|
+
return editOpts.mode === "cell" ? isDeepCell ? Cell.renderDeepCellEdit(params) : Cell.renderCellEdit(params) : isDeepCell ? Cell.renderDeepRowEdit(params) : Cell.renderRowEdit(params);
|
|
282
|
+
}
|
|
283
|
+
return isDeepCell ? Cell.renderDeepCell(params) : Cell.renderDefaultCell(params);
|
|
284
|
+
}
|
|
285
|
+
function renderHeaderHandle(params) {
|
|
286
|
+
const { column, $table } = params;
|
|
287
|
+
const tableProps = $table.props;
|
|
288
|
+
const { editConfig } = tableProps;
|
|
289
|
+
const { type, filters, sortable, editRender, slots } = column;
|
|
290
|
+
if (getConfig().tableHeadeSlotToTitleSlot !== "obsolete") {
|
|
291
|
+
const headerSlot = slots ? slots.header : null;
|
|
292
|
+
if (headerSlot) {
|
|
293
|
+
return renderTitleContent(params, $table.callSlot(headerSlot, params));
|
|
197
294
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
295
|
+
}
|
|
296
|
+
switch (type) {
|
|
297
|
+
case "seq":
|
|
298
|
+
return Cell.renderSeqHeader(params);
|
|
299
|
+
case "radio":
|
|
300
|
+
return Cell.renderRadioHeader(params);
|
|
301
|
+
case "checkbox":
|
|
302
|
+
return Cell.renderCheckboxHeader(params);
|
|
303
|
+
case "html":
|
|
304
|
+
if (filters && sortable) {
|
|
305
|
+
return Cell.renderSortAndFilterHeader(params);
|
|
306
|
+
} else if (sortable) {
|
|
307
|
+
return Cell.renderSortHeader(params);
|
|
308
|
+
} else if (filters) {
|
|
309
|
+
return Cell.renderFilterHeader(params);
|
|
310
|
+
}
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
314
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
315
|
+
if (editRenderOpts) {
|
|
316
|
+
return Cell.renderEditHeader(params);
|
|
317
|
+
} else if (filters && sortable) {
|
|
318
|
+
return Cell.renderSortAndFilterHeader(params);
|
|
319
|
+
} else if (sortable) {
|
|
320
|
+
return Cell.renderSortHeader(params);
|
|
321
|
+
} else if (filters) {
|
|
322
|
+
return Cell.renderFilterHeader(params);
|
|
323
|
+
}
|
|
324
|
+
return Cell.renderDefaultHeader(params);
|
|
208
325
|
}
|
|
209
|
-
function
|
|
210
|
-
|
|
326
|
+
function renderFooterHandle(params) {
|
|
327
|
+
return Cell.renderDefaultFooter(params);
|
|
328
|
+
}
|
|
329
|
+
const Cell = {
|
|
330
|
+
createColumn($xeTable, columnOpts) {
|
|
331
|
+
const { type } = columnOpts;
|
|
332
|
+
const renConfs = {
|
|
333
|
+
renderHeader: renderHeaderHandle,
|
|
334
|
+
renderCell: renderCellHandle,
|
|
335
|
+
renderFooter: renderFooterHandle
|
|
336
|
+
};
|
|
337
|
+
if (type === "expand") {
|
|
338
|
+
renConfs.renderData = Cell.renderExpandData;
|
|
339
|
+
}
|
|
340
|
+
return createColumn($xeTable, columnOpts, renConfs);
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* 列头标题
|
|
344
|
+
*/
|
|
345
|
+
renderHeaderTitle(params) {
|
|
346
|
+
const { $table, column } = params;
|
|
211
347
|
const tableProps = $table.props;
|
|
212
348
|
const { editConfig } = tableProps;
|
|
213
349
|
const { slots, editRender, cellRender } = column;
|
|
214
|
-
const footerSlot = slots ? slots.footer : null;
|
|
215
|
-
if (footerSlot) {
|
|
216
|
-
return $table.callSlot(footerSlot, params);
|
|
217
|
-
}
|
|
218
350
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
219
351
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
220
352
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
221
353
|
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
222
|
-
|
|
354
|
+
if (getConfig().tableHeadeSlotToTitleSlot === "obsolete") {
|
|
355
|
+
const headerSlot = slots ? slots.header : null;
|
|
356
|
+
if (headerSlot) {
|
|
357
|
+
return renderTitleContent(params, $table.callSlot(headerSlot, params));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
223
360
|
if (renderOpts) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
cellValue: itemValue,
|
|
232
|
-
itemValue
|
|
233
|
-
});
|
|
234
|
-
return getSlotVNs(rtFooter(renderOpts, footParams));
|
|
235
|
-
}
|
|
361
|
+
const { computeRendererOpts } = $table.getComputeMaps();
|
|
362
|
+
const rendererOpts = computeRendererOpts.value;
|
|
363
|
+
const compConf = renderOpts.name ? rendererOpts[renderOpts.name] || renderer.get(renderOpts.name) : null;
|
|
364
|
+
if (compConf) {
|
|
365
|
+
const rtHeader = compConf.renderTableHeader || compConf.renderHeader;
|
|
366
|
+
if (rtHeader) {
|
|
367
|
+
return renderTitleContent(params, getSlotVNs(rtHeader(renderOpts, params)));
|
|
236
368
|
}
|
|
369
|
+
}
|
|
237
370
|
}
|
|
238
|
-
return
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
function getDefaultCellLabel(params) {
|
|
371
|
+
return renderTitleContent(params, $table.getHeaderCellLabel(column));
|
|
372
|
+
},
|
|
373
|
+
renderDefaultHeader(params) {
|
|
374
|
+
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params));
|
|
375
|
+
},
|
|
376
|
+
renderDefaultCell(params) {
|
|
245
377
|
const { $table, row, column } = params;
|
|
246
|
-
return formatText($table.getCellLabel(row, column), 1);
|
|
247
|
-
}
|
|
248
|
-
function renderCellHandle(params) {
|
|
249
|
-
const { column, row, $table } = params;
|
|
250
378
|
const tableProps = $table.props;
|
|
251
379
|
const tableReactData = $table.reactData;
|
|
380
|
+
const tableInternalData = $table.internalData;
|
|
252
381
|
const { isRowGroupStatus } = tableReactData;
|
|
253
382
|
const { editConfig } = tableProps;
|
|
254
|
-
const {
|
|
255
|
-
const { computeEditOpts, computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
256
|
-
const aggregateOpts = computeAggregateOpts.value;
|
|
257
|
-
const { mode } = aggregateOpts;
|
|
258
|
-
const checkboxOpts = computeCheckboxOpts.value;
|
|
259
|
-
const editOpts = computeEditOpts.value;
|
|
260
|
-
const isDeepCell = treeNode || (isRowGroupStatus && (mode === 'column' ? column.field === row.groupField : rowGroupNode));
|
|
261
|
-
switch (type) {
|
|
262
|
-
case 'seq':
|
|
263
|
-
return isDeepCell ? Cell.renderDeepIndexCell(params) : Cell.renderSeqCell(params);
|
|
264
|
-
case 'radio':
|
|
265
|
-
return isDeepCell ? Cell.renderDeepRadioCell(params) : Cell.renderRadioCell(params);
|
|
266
|
-
case 'checkbox':
|
|
267
|
-
return checkboxOpts.checkField ? (isDeepCell ? Cell.renderDeepSelectionCellByProp(params) : Cell.renderCheckboxCellByProp(params)) : (isDeepCell ? Cell.renderDeepSelectionCell(params) : Cell.renderCheckboxCell(params));
|
|
268
|
-
case 'expand':
|
|
269
|
-
return Cell.renderExpandCell(params);
|
|
270
|
-
case 'html':
|
|
271
|
-
return isDeepCell ? Cell.renderDeepHTMLCell(params) : Cell.renderHTMLCell(params);
|
|
272
|
-
}
|
|
383
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
273
384
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
274
385
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
386
|
+
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
387
|
+
const defaultSlot = slots ? slots.default : null;
|
|
388
|
+
const gcSlot = slots ? slots.groupContent || slots["group-content"] : null;
|
|
389
|
+
const gvSlot = slots ? slots.groupValues || slots["group-values"] : null;
|
|
390
|
+
let cellValue = "";
|
|
391
|
+
if (isRowGroupStatus && field && row.isAggregate) {
|
|
392
|
+
const aggRow = row;
|
|
393
|
+
const { fullColumnFieldData } = tableInternalData;
|
|
394
|
+
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
395
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
396
|
+
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
397
|
+
const aggData = aggRow.aggData;
|
|
398
|
+
const currAggData = aggData ? aggData[field] : null;
|
|
399
|
+
const groupField = aggRow.groupField;
|
|
400
|
+
const groupContent = aggRow.groupContent;
|
|
401
|
+
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
402
|
+
const childCount = aggRow.childCount;
|
|
403
|
+
const colRest = fullColumnFieldData[groupField] || {};
|
|
404
|
+
const ctParams = {
|
|
405
|
+
$table,
|
|
406
|
+
groupField,
|
|
407
|
+
groupColumn: colRest ? colRest.column : null,
|
|
408
|
+
column,
|
|
409
|
+
groupValue: groupContent,
|
|
410
|
+
childList,
|
|
411
|
+
childCount,
|
|
412
|
+
aggValue: null,
|
|
413
|
+
/**
|
|
414
|
+
* 已废弃
|
|
415
|
+
* @deprecated
|
|
416
|
+
*/
|
|
417
|
+
children: childList,
|
|
418
|
+
/**
|
|
419
|
+
* 已废弃
|
|
420
|
+
* @deprecated
|
|
421
|
+
*/
|
|
422
|
+
totalValue: childCount
|
|
423
|
+
};
|
|
424
|
+
if (mode === "column" ? field === aggRow.groupField : rowGroupNode) {
|
|
425
|
+
cellValue = groupContent;
|
|
426
|
+
if (contentMethod) {
|
|
427
|
+
cellValue = `${contentMethod(ctParams)}`;
|
|
290
428
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
case 'seq':
|
|
294
|
-
return Cell.renderSeqHeader(params);
|
|
295
|
-
case 'radio':
|
|
296
|
-
return Cell.renderRadioHeader(params);
|
|
297
|
-
case 'checkbox':
|
|
298
|
-
return Cell.renderCheckboxHeader(params);
|
|
299
|
-
case 'html':
|
|
300
|
-
if (filters && sortable) {
|
|
301
|
-
return Cell.renderSortAndFilterHeader(params);
|
|
302
|
-
}
|
|
303
|
-
else if (sortable) {
|
|
304
|
-
return Cell.renderSortHeader(params);
|
|
305
|
-
}
|
|
306
|
-
else if (filters) {
|
|
307
|
-
return Cell.renderFilterHeader(params);
|
|
308
|
-
}
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
312
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
313
|
-
if (editRenderOpts) {
|
|
314
|
-
return Cell.renderEditHeader(params);
|
|
315
|
-
}
|
|
316
|
-
else if (filters && sortable) {
|
|
317
|
-
return Cell.renderSortAndFilterHeader(params);
|
|
318
|
-
}
|
|
319
|
-
else if (sortable) {
|
|
320
|
-
return Cell.renderSortHeader(params);
|
|
321
|
-
}
|
|
322
|
-
else if (filters) {
|
|
323
|
-
return Cell.renderFilterHeader(params);
|
|
324
|
-
}
|
|
325
|
-
return Cell.renderDefaultHeader(params);
|
|
326
|
-
}
|
|
327
|
-
function renderFooterHandle(params) {
|
|
328
|
-
return Cell.renderDefaultFooter(params);
|
|
329
|
-
}
|
|
330
|
-
export const Cell = {
|
|
331
|
-
createColumn($xeTable, columnOpts) {
|
|
332
|
-
const { type } = columnOpts;
|
|
333
|
-
const renConfs = {
|
|
334
|
-
renderHeader: renderHeaderHandle,
|
|
335
|
-
renderCell: renderCellHandle,
|
|
336
|
-
renderFooter: renderFooterHandle
|
|
337
|
-
};
|
|
338
|
-
if (type === 'expand') {
|
|
339
|
-
renConfs.renderData = Cell.renderExpandData;
|
|
429
|
+
if (showTotal) {
|
|
430
|
+
cellValue = getI18n("vxe.table.rowGroupContentTotal", [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
340
431
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* 列头标题
|
|
345
|
-
*/
|
|
346
|
-
renderHeaderTitle(params) {
|
|
347
|
-
const { $table, column } = params;
|
|
348
|
-
const tableProps = $table.props;
|
|
349
|
-
const { editConfig } = tableProps;
|
|
350
|
-
const { slots, editRender, cellRender } = column;
|
|
351
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
352
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
353
|
-
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
354
|
-
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
355
|
-
// 兼容已废弃方式
|
|
356
|
-
if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
|
|
357
|
-
const headerSlot = slots ? slots.header : null;
|
|
358
|
-
if (headerSlot) {
|
|
359
|
-
return renderTitleContent(params, $table.callSlot(headerSlot, params));
|
|
360
|
-
}
|
|
432
|
+
if (gcSlot) {
|
|
433
|
+
return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)));
|
|
361
434
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const rtHeader = compConf.renderTableHeader || compConf.renderHeader;
|
|
368
|
-
if (rtHeader) {
|
|
369
|
-
return renderTitleContent(params, getSlotVNs(rtHeader(renderOpts, params)));
|
|
370
|
-
}
|
|
371
|
-
}
|
|
435
|
+
} else if ($table.getPivotTableAggregateCellAggValue) {
|
|
436
|
+
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
437
|
+
ctParams.aggValue = cellValue;
|
|
438
|
+
if (gvSlot) {
|
|
439
|
+
return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)));
|
|
372
440
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
renderDefaultCell(params) {
|
|
379
|
-
const { $table, row, column } = params;
|
|
380
|
-
const tableProps = $table.props;
|
|
381
|
-
const tableReactData = $table.reactData;
|
|
382
|
-
const tableInternalData = $table.internalData;
|
|
383
|
-
const { isRowGroupStatus } = tableReactData;
|
|
384
|
-
const { editConfig } = tableProps;
|
|
385
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
386
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
387
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
388
|
-
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
389
|
-
const defaultSlot = slots ? slots.default : null;
|
|
390
|
-
const gcSlot = slots ? (slots.groupContent || slots['group-content']) : null;
|
|
391
|
-
const gvSlot = slots ? (slots.groupValues || slots['group-values']) : null;
|
|
392
|
-
let cellValue = '';
|
|
393
|
-
if (isRowGroupStatus && field && row.isAggregate) {
|
|
394
|
-
const aggRow = row;
|
|
395
|
-
const { fullColumnFieldData } = tableInternalData;
|
|
396
|
-
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
397
|
-
const aggregateOpts = computeAggregateOpts.value;
|
|
398
|
-
const { mode, showTotal, totalMethod, countFields, contentMethod, formatValuesMethod, mapChildrenField } = aggregateOpts;
|
|
399
|
-
const aggData = aggRow.aggData;
|
|
400
|
-
const currAggData = aggData ? aggData[field] : null;
|
|
401
|
-
const groupField = aggRow.groupField;
|
|
402
|
-
const groupContent = aggRow.groupContent;
|
|
403
|
-
const childList = mapChildrenField ? (aggRow[mapChildrenField] || []) : [];
|
|
404
|
-
const childCount = aggRow.childCount;
|
|
405
|
-
const colRest = fullColumnFieldData[groupField] || {};
|
|
406
|
-
const ctParams = {
|
|
407
|
-
$table,
|
|
408
|
-
groupField,
|
|
409
|
-
groupColumn: (colRest ? colRest.column : null),
|
|
410
|
-
column,
|
|
411
|
-
groupValue: groupContent,
|
|
412
|
-
childList,
|
|
413
|
-
childCount,
|
|
414
|
-
aggValue: null,
|
|
415
|
-
/**
|
|
416
|
-
* 已废弃
|
|
417
|
-
* @deprecated
|
|
418
|
-
*/
|
|
419
|
-
children: childList,
|
|
420
|
-
/**
|
|
421
|
-
* 已废弃
|
|
422
|
-
* @deprecated
|
|
423
|
-
*/
|
|
424
|
-
totalValue: childCount
|
|
425
|
-
};
|
|
426
|
-
if (mode === 'column' ? field === aggRow.groupField : rowGroupNode) {
|
|
427
|
-
cellValue = groupContent;
|
|
428
|
-
if (contentMethod) {
|
|
429
|
-
cellValue = `${contentMethod(ctParams)}`;
|
|
430
|
-
}
|
|
431
|
-
if (showTotal) {
|
|
432
|
-
cellValue = getI18n('vxe.table.rowGroupContentTotal', [cellValue, totalMethod ? totalMethod(ctParams) : childCount, childCount]);
|
|
433
|
-
}
|
|
434
|
-
if (gcSlot) {
|
|
435
|
-
return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)));
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
else if ($table.getPivotTableAggregateCellAggValue) {
|
|
439
|
-
cellValue = $table.getPivotTableAggregateCellAggValue(params);
|
|
440
|
-
ctParams.aggValue = cellValue;
|
|
441
|
-
if (gvSlot) {
|
|
442
|
-
return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)));
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
else if (aggFunc === true || (countFields && countFields.includes(field))) {
|
|
446
|
-
cellValue = currAggData ? currAggData.value : childCount;
|
|
447
|
-
ctParams.aggValue = cellValue;
|
|
448
|
-
if (formatValuesMethod) {
|
|
449
|
-
cellValue = formatValuesMethod(ctParams);
|
|
450
|
-
}
|
|
451
|
-
if (gvSlot) {
|
|
452
|
-
return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)));
|
|
453
|
-
}
|
|
454
|
-
}
|
|
441
|
+
} else if (aggFunc === true || countFields && countFields.includes(field)) {
|
|
442
|
+
cellValue = currAggData ? currAggData.value : childCount;
|
|
443
|
+
ctParams.aggValue = cellValue;
|
|
444
|
+
if (formatValuesMethod) {
|
|
445
|
+
cellValue = formatValuesMethod(ctParams);
|
|
455
446
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
459
|
-
}
|
|
460
|
-
const { computeRendererOpts } = $table.getComputeMaps();
|
|
461
|
-
const rendererOpts = computeRendererOpts.value;
|
|
462
|
-
// 如果是编辑模式-查看:slot default > formatter > cellRender.renderTableDefault > editRender.renderTableCell > editRender.renderTableDefault > cellRender.tableCellFormatter > editRender.tableCellFormatter > field
|
|
463
|
-
// 如果是查看表格:slot default > formatter > cellRender.renderTableDefault > cellRender.tableCellFormatter > field
|
|
464
|
-
const cellCompConf = cellRenderOpts && cellRenderOpts.name ? (rendererOpts[cellRenderOpts.name] || renderer.get(cellRenderOpts.name)) : null;
|
|
465
|
-
if (cellRenderOpts) {
|
|
466
|
-
const cellDefaultRenderFn = cellCompConf ? (cellCompConf.renderTableDefault || cellCompConf.renderDefault) : null;
|
|
467
|
-
if (cellDefaultRenderFn && cellRenderOpts) {
|
|
468
|
-
return renderCellBaseVNs(params, getSlotVNs(cellDefaultRenderFn(cellRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))));
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (editRenderOpts) {
|
|
472
|
-
const editCompConf = editRenderOpts && editRenderOpts.name ? (rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name)) : null;
|
|
473
|
-
const editCellRenderFn = editCompConf
|
|
474
|
-
? ((editCompConf.renderTableCell || editCompConf.renderCell) ||
|
|
475
|
-
(editCompConf.renderTableDefault || editCompConf.renderDefault))
|
|
476
|
-
: null;
|
|
477
|
-
if (editCellRenderFn) {
|
|
478
|
-
return renderCellBaseVNs(params, getSlotVNs(editCellRenderFn(editRenderOpts, Object.assign({ $type: editRenderOpts ? 'edit' : 'cell' }, params))));
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
// 如果是编辑模式-查看:cellRender.tableCellFormatter > editRender.tableCellFormatter > field
|
|
482
|
-
// 如果是查看表格:cellRender.tableCellFormatter > field
|
|
483
|
-
cellValue = $table.getCellLabel(row, column);
|
|
447
|
+
if (gvSlot) {
|
|
448
|
+
return renderCellBaseVNs(params, $table.callSlot(gvSlot, Object.assign({ groupField, groupContent, childList, childCount }, params, ctParams)));
|
|
484
449
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
]);
|
|
498
|
-
},
|
|
499
|
-
renderDeepCell(params) {
|
|
500
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderDefaultCell(params));
|
|
501
|
-
},
|
|
502
|
-
renderDefaultFooter(params) {
|
|
503
|
-
return getFooterContent(params);
|
|
504
|
-
},
|
|
505
|
-
/**
|
|
506
|
-
* 行分组
|
|
507
|
-
*/
|
|
508
|
-
renderRowGroupBtn(params, cellVNodes) {
|
|
509
|
-
const { $table } = params;
|
|
510
|
-
const tableReactData = $table.reactData;
|
|
511
|
-
const tableInternalData = $table.internalData;
|
|
512
|
-
const { row, level } = params;
|
|
513
|
-
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
514
|
-
const { rowGroupExpandedFlag } = tableReactData;
|
|
515
|
-
const { rowGroupExpandedMaps } = tableInternalData;
|
|
516
|
-
const aggregateOpts = computeAggregateOpts.value;
|
|
517
|
-
const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts;
|
|
518
|
-
const rowid = getRowid($table, row);
|
|
519
|
-
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
|
|
520
|
-
return h('div', {
|
|
521
|
-
class: ['vxe-row-group--tree-node', {
|
|
522
|
-
'is--expanded': isExpand
|
|
523
|
-
}],
|
|
524
|
-
style: mode !== 'column' && padding && indent
|
|
525
|
-
? {
|
|
526
|
-
paddingLeft: `${level * indent}px`
|
|
527
|
-
}
|
|
528
|
-
: undefined
|
|
529
|
-
}, [
|
|
530
|
-
showIcon && row.isAggregate
|
|
531
|
-
? h('span', {
|
|
532
|
-
class: 'vxe-row-group--node-btn',
|
|
533
|
-
onClick(evnt) {
|
|
534
|
-
$table.triggerRowGroupExpandEvent(evnt, params);
|
|
535
|
-
}
|
|
536
|
-
}, [
|
|
537
|
-
h('i', {
|
|
538
|
-
class: isExpand ? (iconOpen || getIcon().TABLE_ROW_GROUP_OPEN) : (iconClose || getIcon().TABLE_ROW_GROUP_CLOSE)
|
|
539
|
-
})
|
|
540
|
-
])
|
|
541
|
-
: renderEmptyElement($table),
|
|
542
|
-
h('div', {
|
|
543
|
-
class: 'vxe-row-group-cell'
|
|
544
|
-
}, cellVNodes)
|
|
545
|
-
]);
|
|
546
|
-
},
|
|
547
|
-
/**
|
|
548
|
-
* 树
|
|
549
|
-
*/
|
|
550
|
-
renderTreeNodeBtn(params, cellVNodes) {
|
|
551
|
-
const { $table, isHidden } = params;
|
|
552
|
-
const tableReactData = $table.reactData;
|
|
553
|
-
const tableInternalData = $table.internalData;
|
|
554
|
-
const { row, column, level } = params;
|
|
555
|
-
const { slots } = column;
|
|
556
|
-
const iconSlot = slots ? slots.icon : null;
|
|
557
|
-
if (iconSlot) {
|
|
558
|
-
return $table.callSlot(iconSlot, params);
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
if (defaultSlot) {
|
|
453
|
+
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
454
|
+
}
|
|
455
|
+
const { computeRendererOpts } = $table.getComputeMaps();
|
|
456
|
+
const rendererOpts = computeRendererOpts.value;
|
|
457
|
+
const cellCompConf = cellRenderOpts && cellRenderOpts.name ? rendererOpts[cellRenderOpts.name] || renderer.get(cellRenderOpts.name) : null;
|
|
458
|
+
if (cellRenderOpts) {
|
|
459
|
+
const cellDefaultRenderFn = cellCompConf ? cellCompConf.renderTableDefault || cellCompConf.renderDefault : null;
|
|
460
|
+
if (cellDefaultRenderFn && cellRenderOpts) {
|
|
461
|
+
return renderCellBaseVNs(params, getSlotVNs(cellDefaultRenderFn(cellRenderOpts, Object.assign({ $type: editRenderOpts ? "edit" : "cell" }, params))));
|
|
559
462
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
const
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
567
|
-
const rowChilds = row[childrenField];
|
|
568
|
-
const hasChild = rowChilds && rowChilds.length;
|
|
569
|
-
let hasLazyChilds = false;
|
|
570
|
-
let isActive = false;
|
|
571
|
-
let isLazyLoading = false;
|
|
572
|
-
let isLazyLoaded = false;
|
|
573
|
-
const ons = {};
|
|
574
|
-
if (!isHidden) {
|
|
575
|
-
const rowid = getRowid($table, row);
|
|
576
|
-
isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
|
|
577
|
-
if (lazy) {
|
|
578
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
579
|
-
isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
|
|
580
|
-
hasLazyChilds = row[hasChildField];
|
|
581
|
-
isLazyLoaded = !!rest.treeLoaded;
|
|
582
|
-
}
|
|
463
|
+
}
|
|
464
|
+
if (editRenderOpts) {
|
|
465
|
+
const editCompConf = editRenderOpts && editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null;
|
|
466
|
+
const editCellRenderFn = editCompConf ? editCompConf.renderTableCell || editCompConf.renderCell || (editCompConf.renderTableDefault || editCompConf.renderDefault) : null;
|
|
467
|
+
if (editCellRenderFn) {
|
|
468
|
+
return renderCellBaseVNs(params, getSlotVNs(editCellRenderFn(editRenderOpts, Object.assign({ $type: editRenderOpts ? "edit" : "cell" }, params))));
|
|
583
469
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
470
|
+
}
|
|
471
|
+
cellValue = $table.getCellLabel(row, column);
|
|
472
|
+
}
|
|
473
|
+
const cellPlaceholder = editRenderOpts ? editRenderOpts.placeholder : "";
|
|
474
|
+
return renderCellBaseVNs(params, [
|
|
475
|
+
h(
|
|
476
|
+
"span",
|
|
477
|
+
{
|
|
478
|
+
class: "vxe-cell--label"
|
|
479
|
+
},
|
|
480
|
+
[
|
|
481
|
+
// 如果设置占位符
|
|
482
|
+
editRenderOpts && eqEmptyValue(cellValue) ? h("span", {
|
|
483
|
+
class: "vxe-cell--placeholder"
|
|
484
|
+
}, formatText(getFuncText(cellPlaceholder), 1)) : h("span", formatText(cellValue, 1))
|
|
485
|
+
]
|
|
486
|
+
)
|
|
487
|
+
]);
|
|
488
|
+
},
|
|
489
|
+
renderDeepCell(params) {
|
|
490
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderDefaultCell(params));
|
|
491
|
+
},
|
|
492
|
+
renderDefaultFooter(params) {
|
|
493
|
+
return getFooterContent(params);
|
|
494
|
+
},
|
|
495
|
+
/**
|
|
496
|
+
* 行分组
|
|
497
|
+
*/
|
|
498
|
+
renderRowGroupBtn(params, cellVNodes) {
|
|
499
|
+
const { $table } = params;
|
|
500
|
+
const tableReactData = $table.reactData;
|
|
501
|
+
const tableInternalData = $table.internalData;
|
|
502
|
+
const { row, level } = params;
|
|
503
|
+
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
504
|
+
const { rowGroupExpandedFlag } = tableReactData;
|
|
505
|
+
const { rowGroupExpandedMaps } = tableInternalData;
|
|
506
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
507
|
+
const { mode, padding, indent, showIcon, iconOpen, iconClose } = aggregateOpts;
|
|
508
|
+
const rowid = getRowid($table, row);
|
|
509
|
+
const isExpand = !!rowGroupExpandedFlag && !!rowGroupExpandedMaps[rowid];
|
|
510
|
+
return h("div", {
|
|
511
|
+
class: ["vxe-row-group--tree-node", {
|
|
512
|
+
"is--expanded": isExpand
|
|
513
|
+
}],
|
|
514
|
+
style: mode !== "column" && padding && indent ? {
|
|
515
|
+
paddingLeft: `${level * indent}px`
|
|
516
|
+
} : void 0
|
|
517
|
+
}, [
|
|
518
|
+
showIcon && row.isAggregate ? h("span", {
|
|
519
|
+
class: "vxe-row-group--node-btn",
|
|
520
|
+
onClick(evnt) {
|
|
521
|
+
$table.triggerRowGroupExpandEvent(evnt, params);
|
|
588
522
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
523
|
+
}, [
|
|
524
|
+
h("i", {
|
|
525
|
+
class: isExpand ? iconOpen || getIcon().TABLE_ROW_GROUP_OPEN : iconClose || getIcon().TABLE_ROW_GROUP_CLOSE
|
|
526
|
+
})
|
|
527
|
+
]) : renderEmptyElement($table),
|
|
528
|
+
h("div", {
|
|
529
|
+
class: "vxe-row-group-cell"
|
|
530
|
+
}, cellVNodes)
|
|
531
|
+
]);
|
|
532
|
+
},
|
|
533
|
+
/**
|
|
534
|
+
* 树
|
|
535
|
+
*/
|
|
536
|
+
renderTreeNodeBtn(params, cellVNodes) {
|
|
537
|
+
const { $table, isHidden } = params;
|
|
538
|
+
const tableReactData = $table.reactData;
|
|
539
|
+
const tableInternalData = $table.internalData;
|
|
540
|
+
const { row, column, level } = params;
|
|
541
|
+
const { slots } = column;
|
|
542
|
+
const iconSlot = slots ? slots.icon : null;
|
|
543
|
+
if (iconSlot) {
|
|
544
|
+
return $table.callSlot(iconSlot, params);
|
|
545
|
+
}
|
|
546
|
+
const { computeTreeOpts } = $table.getComputeMaps();
|
|
547
|
+
const { treeExpandedFlag } = tableReactData;
|
|
548
|
+
const { fullAllDataRowIdData, treeExpandedMaps, treeExpandLazyLoadedMaps } = tableInternalData;
|
|
549
|
+
const treeOpts = computeTreeOpts.value;
|
|
550
|
+
const { padding, indent, lazy, trigger, visibleMethod, iconLoaded, showIcon, iconOpen, iconClose } = treeOpts;
|
|
551
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
552
|
+
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
553
|
+
const rowChilds = row[childrenField];
|
|
554
|
+
const hasChild = rowChilds && rowChilds.length;
|
|
555
|
+
let hasLazyChilds = false;
|
|
556
|
+
let isActive = false;
|
|
557
|
+
let isLazyLoading = false;
|
|
558
|
+
let isLazyLoaded = false;
|
|
559
|
+
const ons = {};
|
|
560
|
+
if (!isHidden) {
|
|
561
|
+
const rowid = getRowid($table, row);
|
|
562
|
+
isActive = !!treeExpandedFlag && !!treeExpandedMaps[rowid];
|
|
563
|
+
if (lazy) {
|
|
564
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
565
|
+
isLazyLoading = !!treeExpandLazyLoadedMaps[rowid];
|
|
566
|
+
hasLazyChilds = row[hasChildField];
|
|
567
|
+
isLazyLoaded = !!rest.treeLoaded;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (!trigger || trigger === "default") {
|
|
571
|
+
ons.onClick = (evnt) => {
|
|
572
|
+
$table.triggerTreeExpandEvent(evnt, params);
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
return h("div", {
|
|
576
|
+
class: ["vxe-cell--tree-node", {
|
|
577
|
+
"is--active": isActive
|
|
578
|
+
}],
|
|
579
|
+
style: padding && indent ? {
|
|
580
|
+
paddingLeft: `${level * indent}px`
|
|
581
|
+
} : void 0
|
|
582
|
+
}, [
|
|
583
|
+
showIcon && (lazy ? isLazyLoaded ? hasChild : hasChild || hasLazyChilds : hasChild) && (!visibleMethod || visibleMethod(params)) ? [
|
|
584
|
+
h("div", {
|
|
585
|
+
class: "vxe-cell--tree-btn",
|
|
586
|
+
...ons
|
|
598
587
|
}, [
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const { mode } = aggregateOpts;
|
|
626
|
-
if (mode === 'column') {
|
|
627
|
-
if (row.groupField && column.field === row.groupField) {
|
|
628
|
-
return [Cell.renderRowGroupBtn(params, cellVNodes)];
|
|
629
|
-
}
|
|
630
|
-
return cellVNodes;
|
|
631
|
-
}
|
|
632
|
-
else if (rowGroupNode) {
|
|
633
|
-
return [Cell.renderRowGroupBtn(params, cellVNodes)];
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return [Cell.renderTreeNodeBtn(params, cellVNodes)];
|
|
637
|
-
},
|
|
638
|
-
/**
|
|
639
|
-
* 序号
|
|
640
|
-
*/
|
|
641
|
-
renderSeqHeader(params) {
|
|
642
|
-
const { $table, column } = params;
|
|
643
|
-
// 兼容已废弃方式
|
|
644
|
-
if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
|
|
645
|
-
const { slots } = column;
|
|
646
|
-
const headerSlot = slots ? slots.header : null;
|
|
647
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
|
|
648
|
-
}
|
|
649
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, $table.getHeaderCellLabel(column)));
|
|
650
|
-
},
|
|
651
|
-
renderSeqCell(params) {
|
|
652
|
-
const { $table, column } = params;
|
|
653
|
-
const tableProps = $table.props;
|
|
654
|
-
const { treeConfig } = tableProps;
|
|
655
|
-
const { computeSeqOpts } = $table.getComputeMaps();
|
|
656
|
-
const seqOpts = computeSeqOpts.value;
|
|
657
|
-
const { slots } = column;
|
|
658
|
-
const defaultSlot = slots ? slots.default : null;
|
|
659
|
-
if (defaultSlot) {
|
|
660
|
-
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
661
|
-
}
|
|
662
|
-
const { seq } = params;
|
|
663
|
-
const seqMd = seqOpts.seqMethod;
|
|
664
|
-
return renderCellBaseVNs(params, [
|
|
665
|
-
h('span', `${formatText(seqMd ? seqMd(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)
|
|
666
|
-
]);
|
|
667
|
-
},
|
|
668
|
-
renderDeepIndexCell(params) {
|
|
669
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderSeqCell(params));
|
|
670
|
-
},
|
|
671
|
-
/**
|
|
672
|
-
* 单选
|
|
673
|
-
*/
|
|
674
|
-
renderRadioHeader(params) {
|
|
675
|
-
const { $table, column } = params;
|
|
676
|
-
const { slots } = column;
|
|
677
|
-
const titleSlot = slots ? slots.title : null;
|
|
678
|
-
// 兼容已废弃方式
|
|
679
|
-
if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
|
|
680
|
-
const headerSlot = slots ? slots.header : null;
|
|
681
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot
|
|
682
|
-
? $table.callSlot(headerSlot, params)
|
|
683
|
-
: [
|
|
684
|
-
h('span', {
|
|
685
|
-
class: 'vxe-radio--label'
|
|
686
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
687
|
-
]));
|
|
688
|
-
}
|
|
689
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, [
|
|
690
|
-
h('span', {
|
|
691
|
-
class: 'vxe-radio--label'
|
|
692
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
693
|
-
]));
|
|
694
|
-
},
|
|
695
|
-
renderRadioCell(params) {
|
|
696
|
-
const { $table, column, isHidden } = params;
|
|
697
|
-
const tableReactData = $table.reactData;
|
|
698
|
-
const { computeRadioOpts } = $table.getComputeMaps();
|
|
699
|
-
const { selectRadioRow } = tableReactData;
|
|
700
|
-
const radioOpts = computeRadioOpts.value;
|
|
701
|
-
const { slots } = column;
|
|
702
|
-
const { labelField, checkMethod, visibleMethod } = radioOpts;
|
|
703
|
-
const { row } = params;
|
|
704
|
-
const defaultSlot = slots ? slots.default : null;
|
|
705
|
-
const radioSlot = slots ? slots.radio : null;
|
|
706
|
-
const isChecked = $table.eqRow(row, selectRadioRow);
|
|
707
|
-
const isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
708
|
-
let isDisabled = !!checkMethod;
|
|
709
|
-
let ons;
|
|
710
|
-
if (!isHidden) {
|
|
711
|
-
ons = {
|
|
712
|
-
onClick(evnt) {
|
|
713
|
-
if (!isDisabled && isVisible) {
|
|
714
|
-
$table.triggerRadioRowEvent(evnt, params);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
if (checkMethod) {
|
|
719
|
-
isDisabled = !checkMethod({ $table, row });
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
const radioParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible });
|
|
723
|
-
if (radioSlot) {
|
|
724
|
-
return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams));
|
|
725
|
-
}
|
|
726
|
-
const radioVNs = [];
|
|
727
|
-
if (isVisible) {
|
|
728
|
-
radioVNs.push(h('span', {
|
|
729
|
-
class: ['vxe-radio--icon', isChecked ? getIcon().TABLE_RADIO_CHECKED : (isDisabled ? getIcon().TABLE_RADIO_DISABLED_UNCHECKED : getIcon().TABLE_RADIO_UNCHECKED)]
|
|
730
|
-
}));
|
|
731
|
-
}
|
|
732
|
-
if (defaultSlot || labelField) {
|
|
733
|
-
radioVNs.push(h('span', {
|
|
734
|
-
class: 'vxe-radio--label'
|
|
735
|
-
}, defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField)));
|
|
736
|
-
}
|
|
737
|
-
return renderCellBaseVNs(params, [
|
|
738
|
-
h('span', Object.assign({ class: ['vxe-cell--radio', {
|
|
739
|
-
'is--checked': isChecked,
|
|
740
|
-
'is--disabled': isDisabled
|
|
741
|
-
}] }, ons), radioVNs)
|
|
742
|
-
]);
|
|
743
|
-
},
|
|
744
|
-
renderDeepRadioCell(params) {
|
|
745
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderRadioCell(params));
|
|
746
|
-
},
|
|
747
|
-
/**
|
|
748
|
-
* 多选
|
|
749
|
-
*/
|
|
750
|
-
renderCheckboxHeader(params) {
|
|
751
|
-
const { $table, column, isHidden } = params;
|
|
752
|
-
const tableReactData = $table.reactData;
|
|
753
|
-
const { computeIsAllCheckboxDisabled, computeCheckboxOpts } = $table.getComputeMaps();
|
|
754
|
-
const { isAllSelected: isAllCheckboxSelected, isIndeterminate: isAllCheckboxIndeterminate } = tableReactData;
|
|
755
|
-
const isAllCheckboxDisabled = computeIsAllCheckboxDisabled.value;
|
|
756
|
-
const { slots } = column;
|
|
757
|
-
const titleSlot = slots ? slots.title : null;
|
|
758
|
-
const checkboxOpts = computeCheckboxOpts.value;
|
|
759
|
-
const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
|
|
760
|
-
const colTitle = $table.getHeaderCellLabel(column);
|
|
761
|
-
const ons = {};
|
|
762
|
-
if (!isHidden) {
|
|
763
|
-
ons.onClick = (evnt) => {
|
|
764
|
-
if (!isAllCheckboxDisabled) {
|
|
765
|
-
$table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected);
|
|
766
|
-
}
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
const checkboxParams = Object.assign(Object.assign({}, params), { checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate });
|
|
770
|
-
// 兼容已废弃方式
|
|
771
|
-
if (getConfig().tableHeadeSlotToTitleSlot === 'obsolete') {
|
|
772
|
-
const headerSlot = slots ? slots.header : null;
|
|
773
|
-
if (headerSlot) {
|
|
774
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)));
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
if (checkStrictly ? !showHeader : showHeader === false) {
|
|
778
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
|
|
779
|
-
h('span', {
|
|
780
|
-
class: 'vxe-checkbox--label'
|
|
781
|
-
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
782
|
-
]));
|
|
783
|
-
}
|
|
784
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
|
|
785
|
-
h('span', Object.assign({ class: ['vxe-cell--checkbox', {
|
|
786
|
-
'is--checked': isAllCheckboxSelected,
|
|
787
|
-
'is--disabled': isAllCheckboxDisabled,
|
|
788
|
-
'is--indeterminate': isAllCheckboxIndeterminate
|
|
789
|
-
}], title: XEUtils.eqNull(headerTitle) ? getI18n('vxe.table.allTitle') : `${headerTitle || ''}` }, ons), [
|
|
790
|
-
h('span', {
|
|
791
|
-
class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : (isAllCheckboxDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED))]
|
|
792
|
-
})
|
|
793
|
-
].concat(titleSlot || colTitle
|
|
794
|
-
? [
|
|
795
|
-
h('span', {
|
|
796
|
-
class: 'vxe-checkbox--label'
|
|
797
|
-
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
798
|
-
]
|
|
799
|
-
: []))
|
|
800
|
-
]));
|
|
801
|
-
},
|
|
802
|
-
renderCheckboxCell(params) {
|
|
803
|
-
const { $table, row, column, isHidden } = params;
|
|
804
|
-
const tableProps = $table.props;
|
|
805
|
-
const tableReactData = $table.reactData;
|
|
806
|
-
const tableInternalData = $table.internalData;
|
|
807
|
-
const { treeConfig } = tableProps;
|
|
808
|
-
const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
|
|
809
|
-
const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData;
|
|
810
|
-
const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
811
|
-
const aggregateOpts = computeAggregateOpts.value;
|
|
812
|
-
const { mapChildrenField } = aggregateOpts;
|
|
813
|
-
const checkboxOpts = computeCheckboxOpts.value;
|
|
814
|
-
const { labelField, checkMethod, visibleMethod } = checkboxOpts;
|
|
815
|
-
const { slots } = column;
|
|
816
|
-
const defaultSlot = slots ? slots.default : null;
|
|
817
|
-
const checkboxSlot = slots ? slots.checkbox : null;
|
|
818
|
-
let indeterminate = false;
|
|
819
|
-
let isChecked = false;
|
|
820
|
-
let isVisible = true;
|
|
821
|
-
let isDisabled = false;
|
|
822
|
-
const ons = {};
|
|
823
|
-
if (!isHidden) {
|
|
824
|
-
const rowid = getRowid($table, row);
|
|
825
|
-
isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
|
|
826
|
-
if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
|
|
827
|
-
const childList = row[mapChildrenField || ''];
|
|
828
|
-
if (!childList || !childList.length || childList.every(item => !checkMethod({ $table, row: item }))) {
|
|
829
|
-
isDisabled = true;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
else {
|
|
833
|
-
isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
834
|
-
isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
|
|
835
|
-
}
|
|
836
|
-
if (treeConfig || isRowGroupStatus) {
|
|
837
|
-
indeterminate = !!treeIndeterminateRowMaps[rowid];
|
|
838
|
-
}
|
|
839
|
-
ons.onClick = (evnt) => {
|
|
840
|
-
if (!isDisabled && isVisible) {
|
|
841
|
-
$table.triggerCheckRowEvent(evnt, params, !isChecked);
|
|
842
|
-
}
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
|
|
846
|
-
if (checkboxSlot) {
|
|
847
|
-
return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
|
|
848
|
-
}
|
|
849
|
-
const checkVNs = [];
|
|
850
|
-
if (isVisible) {
|
|
851
|
-
checkVNs.push(h('span', {
|
|
852
|
-
class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : (isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED))]
|
|
853
|
-
}));
|
|
854
|
-
}
|
|
855
|
-
if (defaultSlot || labelField) {
|
|
856
|
-
checkVNs.push(h('span', {
|
|
857
|
-
class: 'vxe-checkbox--label'
|
|
858
|
-
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
|
|
859
|
-
}
|
|
860
|
-
return renderCellBaseVNs(params, [
|
|
861
|
-
h('span', Object.assign({ class: ['vxe-cell--checkbox', {
|
|
862
|
-
'is--checked': isChecked,
|
|
863
|
-
'is--disabled': isDisabled,
|
|
864
|
-
'is--indeterminate': indeterminate,
|
|
865
|
-
'is--hidden': !isVisible
|
|
866
|
-
}] }, ons), checkVNs)
|
|
867
|
-
]);
|
|
868
|
-
},
|
|
869
|
-
renderDeepSelectionCell(params) {
|
|
870
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCell(params));
|
|
871
|
-
},
|
|
872
|
-
renderCheckboxCellByProp(params) {
|
|
873
|
-
const { $table, row, column, isHidden } = params;
|
|
874
|
-
const tableProps = $table.props;
|
|
875
|
-
const tableReactData = $table.reactData;
|
|
876
|
-
const tableInternalData = $table.internalData;
|
|
877
|
-
const { treeConfig } = tableProps;
|
|
878
|
-
const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
|
|
879
|
-
const { treeIndeterminateRowMaps } = tableInternalData;
|
|
880
|
-
const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
881
|
-
const aggregateOpts = computeAggregateOpts.value;
|
|
882
|
-
const { mapChildrenField } = aggregateOpts;
|
|
883
|
-
const checkboxOpts = computeCheckboxOpts.value;
|
|
884
|
-
const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts;
|
|
885
|
-
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
886
|
-
const { slots } = column;
|
|
887
|
-
const defaultSlot = slots ? slots.default : null;
|
|
888
|
-
const checkboxSlot = slots ? slots.checkbox : null;
|
|
889
|
-
let indeterminate = false;
|
|
890
|
-
let isChecked = false;
|
|
891
|
-
let isVisible = true;
|
|
892
|
-
let isDisabled = false;
|
|
893
|
-
const ons = {};
|
|
894
|
-
if (!isHidden) {
|
|
895
|
-
const rowid = getRowid($table, row);
|
|
896
|
-
isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField);
|
|
897
|
-
if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
|
|
898
|
-
const childList = row[mapChildrenField || ''];
|
|
899
|
-
if (!childList || !childList.length || childList.every(item => !checkMethod({ $table, row: item }))) {
|
|
900
|
-
isDisabled = true;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
else {
|
|
904
|
-
isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
905
|
-
isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
|
|
906
|
-
}
|
|
907
|
-
if (treeConfig || isRowGroupStatus) {
|
|
908
|
-
indeterminate = !!treeIndeterminateRowMaps[rowid];
|
|
909
|
-
}
|
|
910
|
-
ons.onClick = (evnt) => {
|
|
911
|
-
if (!isDisabled && isVisible) {
|
|
912
|
-
$table.triggerCheckRowEvent(evnt, params, !isChecked);
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
const checkboxParams = Object.assign(Object.assign({}, params), { checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate });
|
|
917
|
-
if (checkboxSlot) {
|
|
918
|
-
return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
|
|
919
|
-
}
|
|
920
|
-
const checkVNs = [];
|
|
921
|
-
if (isVisible) {
|
|
922
|
-
checkVNs.push(h('span', {
|
|
923
|
-
class: ['vxe-checkbox--icon', indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : (isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED))]
|
|
924
|
-
}));
|
|
925
|
-
if (defaultSlot || labelField) {
|
|
926
|
-
checkVNs.push(h('span', {
|
|
927
|
-
class: 'vxe-checkbox--label'
|
|
928
|
-
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField)));
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
return renderCellBaseVNs(params, [
|
|
932
|
-
h('span', Object.assign({ class: ['vxe-cell--checkbox', {
|
|
933
|
-
'is--checked': isChecked,
|
|
934
|
-
'is--disabled': isDisabled,
|
|
935
|
-
'is--indeterminate': indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
|
|
936
|
-
'is--hidden': !isVisible
|
|
937
|
-
}] }, ons), checkVNs)
|
|
938
|
-
]);
|
|
939
|
-
},
|
|
940
|
-
renderDeepSelectionCellByProp(params) {
|
|
941
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCellByProp(params));
|
|
942
|
-
},
|
|
943
|
-
/**
|
|
944
|
-
* 展开行
|
|
945
|
-
*/
|
|
946
|
-
renderExpandCell(params) {
|
|
947
|
-
const { $table, isHidden, row, column } = params;
|
|
948
|
-
const tableReactData = $table.reactData;
|
|
949
|
-
const tableInternalData = $table.internalData;
|
|
950
|
-
const { isRowGroupStatus } = tableReactData;
|
|
951
|
-
const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData;
|
|
952
|
-
const { computeExpandOpts } = $table.getComputeMaps();
|
|
953
|
-
const expandOpts = computeExpandOpts.value;
|
|
954
|
-
const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts;
|
|
955
|
-
const { slots } = column;
|
|
956
|
-
const defaultSlot = slots ? slots.default : null;
|
|
957
|
-
const iconSlot = slots ? slots.icon : null;
|
|
958
|
-
let isActive = false;
|
|
959
|
-
let isLazyLoading = false;
|
|
960
|
-
if (isRowGroupStatus && row.isAggregate) {
|
|
961
|
-
return renderCellBaseVNs(params, []);
|
|
962
|
-
}
|
|
963
|
-
if (iconSlot) {
|
|
964
|
-
return renderCellBaseVNs(params, $table.callSlot(iconSlot, params));
|
|
965
|
-
}
|
|
966
|
-
if (!isHidden) {
|
|
967
|
-
const rowid = getRowid($table, row);
|
|
968
|
-
isActive = !!rowExpandedMaps[rowid];
|
|
969
|
-
if (lazy) {
|
|
970
|
-
isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
return renderCellBaseVNs(params, [
|
|
974
|
-
showIcon && (!visibleMethod || visibleMethod(params))
|
|
975
|
-
? h('div', {
|
|
976
|
-
class: ['vxe-table--expanded', {
|
|
977
|
-
'is--active': isActive
|
|
978
|
-
}]
|
|
979
|
-
}, [
|
|
980
|
-
h('span', {
|
|
981
|
-
class: 'vxe-table--expand-btn',
|
|
982
|
-
onMousedown(evnt) {
|
|
983
|
-
evnt.stopPropagation();
|
|
984
|
-
},
|
|
985
|
-
onClick(evnt) {
|
|
986
|
-
$table.triggerRowExpandEvent(evnt, params);
|
|
987
|
-
}
|
|
988
|
-
}, [
|
|
989
|
-
h('i', {
|
|
990
|
-
class: isLazyLoading ? (iconLoaded || getIcon().TABLE_EXPAND_LOADED) : (isActive ? (iconOpen || getIcon().TABLE_EXPAND_OPEN) : (iconClose || getIcon().TABLE_EXPAND_CLOSE))
|
|
991
|
-
})
|
|
992
|
-
])
|
|
993
|
-
])
|
|
994
|
-
: renderEmptyElement($table),
|
|
995
|
-
defaultSlot || labelField
|
|
996
|
-
? h('div', {
|
|
997
|
-
class: 'vxe-table--expand-label'
|
|
998
|
-
}, defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField))
|
|
999
|
-
: renderEmptyElement($table)
|
|
1000
|
-
]);
|
|
1001
|
-
},
|
|
1002
|
-
renderExpandData(params) {
|
|
1003
|
-
const { $table, column } = params;
|
|
1004
|
-
const { slots, contentRender } = column;
|
|
1005
|
-
const contentSlot = slots ? slots.content : null;
|
|
1006
|
-
if (contentSlot) {
|
|
1007
|
-
return $table.callSlot(contentSlot, params);
|
|
1008
|
-
}
|
|
1009
|
-
if (contentRender) {
|
|
1010
|
-
const { computeRendererOpts } = $table.getComputeMaps();
|
|
1011
|
-
const rendererOpts = computeRendererOpts.value;
|
|
1012
|
-
const compConf = contentRender.name ? (rendererOpts[contentRender.name] || renderer.get(contentRender.name)) : null;
|
|
1013
|
-
if (compConf) {
|
|
1014
|
-
const rtExpand = compConf.renderTableExpand || compConf.renderExpand;
|
|
1015
|
-
if (rtExpand) {
|
|
1016
|
-
return getSlotVNs(rtExpand(contentRender, params));
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
588
|
+
h("i", {
|
|
589
|
+
class: isLazyLoading ? iconLoaded || getIcon().TABLE_TREE_LOADED : isActive ? iconOpen || getIcon().TABLE_TREE_OPEN : iconClose || getIcon().TABLE_TREE_CLOSE
|
|
590
|
+
})
|
|
591
|
+
])
|
|
592
|
+
] : null,
|
|
593
|
+
h("div", {
|
|
594
|
+
class: "vxe-tree-cell"
|
|
595
|
+
}, cellVNodes)
|
|
596
|
+
]);
|
|
597
|
+
},
|
|
598
|
+
/**
|
|
599
|
+
* 层级节点。
|
|
600
|
+
* 行分组、树结构
|
|
601
|
+
*/
|
|
602
|
+
renderDeepNodeBtn(params, cellVNodes) {
|
|
603
|
+
const { $table, row, column } = params;
|
|
604
|
+
const { rowGroupNode } = column;
|
|
605
|
+
const tableReactData = $table.reactData;
|
|
606
|
+
const { rowGroupList } = tableReactData;
|
|
607
|
+
if (rowGroupList.length) {
|
|
608
|
+
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
609
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
610
|
+
const { mode } = aggregateOpts;
|
|
611
|
+
if (mode === "column") {
|
|
612
|
+
if (row.groupField && column.field === row.groupField) {
|
|
613
|
+
return [Cell.renderRowGroupBtn(params, cellVNodes)];
|
|
1019
614
|
}
|
|
1020
|
-
return
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
615
|
+
return cellVNodes;
|
|
616
|
+
} else if (rowGroupNode) {
|
|
617
|
+
return [Cell.renderRowGroupBtn(params, cellVNodes)];
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return [Cell.renderTreeNodeBtn(params, cellVNodes)];
|
|
621
|
+
},
|
|
622
|
+
/**
|
|
623
|
+
* 序号
|
|
624
|
+
*/
|
|
625
|
+
renderSeqHeader(params) {
|
|
626
|
+
const { $table, column } = params;
|
|
627
|
+
if (getConfig().tableHeadeSlotToTitleSlot === "obsolete") {
|
|
628
|
+
const { slots } = column;
|
|
629
|
+
const headerSlot = slots ? slots.header : null;
|
|
630
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
|
|
631
|
+
}
|
|
632
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, $table.getHeaderCellLabel(column)));
|
|
633
|
+
},
|
|
634
|
+
renderSeqCell(params) {
|
|
635
|
+
const { $table, column } = params;
|
|
636
|
+
const tableProps = $table.props;
|
|
637
|
+
const { treeConfig } = tableProps;
|
|
638
|
+
const { computeSeqOpts } = $table.getComputeMaps();
|
|
639
|
+
const seqOpts = computeSeqOpts.value;
|
|
640
|
+
const { slots } = column;
|
|
641
|
+
const defaultSlot = slots ? slots.default : null;
|
|
642
|
+
if (defaultSlot) {
|
|
643
|
+
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
644
|
+
}
|
|
645
|
+
const { seq } = params;
|
|
646
|
+
const seqMd = seqOpts.seqMethod;
|
|
647
|
+
return renderCellBaseVNs(params, [
|
|
648
|
+
h("span", `${formatText(seqMd ? seqMd(params) : treeConfig ? seq : (seqOpts.startIndex || 0) + seq, 1)}`)
|
|
649
|
+
]);
|
|
650
|
+
},
|
|
651
|
+
renderDeepIndexCell(params) {
|
|
652
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderSeqCell(params));
|
|
653
|
+
},
|
|
654
|
+
/**
|
|
655
|
+
* 单选
|
|
656
|
+
*/
|
|
657
|
+
renderRadioHeader(params) {
|
|
658
|
+
const { $table, column } = params;
|
|
659
|
+
const { slots } = column;
|
|
660
|
+
const titleSlot = slots ? slots.title : null;
|
|
661
|
+
if (getConfig().tableHeadeSlotToTitleSlot === "obsolete") {
|
|
662
|
+
const headerSlot = slots ? slots.header : null;
|
|
663
|
+
return renderHeaderCellBaseVNs(
|
|
664
|
+
params,
|
|
665
|
+
renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : [
|
|
666
|
+
h("span", {
|
|
667
|
+
class: "vxe-radio--label"
|
|
668
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
669
|
+
])
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
return renderHeaderCellBaseVNs(
|
|
673
|
+
params,
|
|
674
|
+
renderTitleContent(params, [
|
|
675
|
+
h("span", {
|
|
676
|
+
class: "vxe-radio--label"
|
|
677
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
678
|
+
])
|
|
679
|
+
);
|
|
680
|
+
},
|
|
681
|
+
renderRadioCell(params) {
|
|
682
|
+
const { $table, column, isHidden } = params;
|
|
683
|
+
const tableReactData = $table.reactData;
|
|
684
|
+
const { computeRadioOpts } = $table.getComputeMaps();
|
|
685
|
+
const { selectRadioRow } = tableReactData;
|
|
686
|
+
const radioOpts = computeRadioOpts.value;
|
|
687
|
+
const { slots } = column;
|
|
688
|
+
const { labelField, checkMethod, visibleMethod } = radioOpts;
|
|
689
|
+
const { row } = params;
|
|
690
|
+
const defaultSlot = slots ? slots.default : null;
|
|
691
|
+
const radioSlot = slots ? slots.radio : null;
|
|
692
|
+
const isChecked = $table.eqRow(row, selectRadioRow);
|
|
693
|
+
const isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
694
|
+
let isDisabled = !!checkMethod;
|
|
695
|
+
let ons;
|
|
696
|
+
if (!isHidden) {
|
|
697
|
+
ons = {
|
|
698
|
+
onClick(evnt) {
|
|
699
|
+
if (!isDisabled && isVisible) {
|
|
700
|
+
$table.triggerRadioRowEvent(evnt, params);
|
|
701
|
+
}
|
|
1031
702
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
$table.triggerSortEvent(evnt, column, 'desc');
|
|
1089
|
-
}
|
|
1090
|
-
: undefined
|
|
1091
|
-
})
|
|
1092
|
-
])
|
|
1093
|
-
];
|
|
703
|
+
};
|
|
704
|
+
if (checkMethod) {
|
|
705
|
+
isDisabled = !checkMethod({ $table, row });
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible };
|
|
709
|
+
if (radioSlot) {
|
|
710
|
+
return renderCellBaseVNs(params, $table.callSlot(radioSlot, radioParams));
|
|
711
|
+
}
|
|
712
|
+
const radioVNs = [];
|
|
713
|
+
if (isVisible) {
|
|
714
|
+
radioVNs.push(
|
|
715
|
+
h("span", {
|
|
716
|
+
class: ["vxe-radio--icon", isChecked ? getIcon().TABLE_RADIO_CHECKED : isDisabled ? getIcon().TABLE_RADIO_DISABLED_UNCHECKED : getIcon().TABLE_RADIO_UNCHECKED]
|
|
717
|
+
})
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
if (defaultSlot || labelField) {
|
|
721
|
+
radioVNs.push(
|
|
722
|
+
h("span", {
|
|
723
|
+
class: "vxe-radio--label"
|
|
724
|
+
}, defaultSlot ? $table.callSlot(defaultSlot, radioParams) : XEUtils.get(row, labelField))
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
return renderCellBaseVNs(params, [
|
|
728
|
+
h("span", {
|
|
729
|
+
class: ["vxe-cell--radio", {
|
|
730
|
+
"is--checked": isChecked,
|
|
731
|
+
"is--disabled": isDisabled
|
|
732
|
+
}],
|
|
733
|
+
...ons
|
|
734
|
+
}, radioVNs)
|
|
735
|
+
]);
|
|
736
|
+
},
|
|
737
|
+
renderDeepRadioCell(params) {
|
|
738
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderRadioCell(params));
|
|
739
|
+
},
|
|
740
|
+
/**
|
|
741
|
+
* 多选
|
|
742
|
+
*/
|
|
743
|
+
renderCheckboxHeader(params) {
|
|
744
|
+
const { $table, column, isHidden } = params;
|
|
745
|
+
const tableReactData = $table.reactData;
|
|
746
|
+
const { computeIsAllCheckboxDisabled, computeCheckboxOpts } = $table.getComputeMaps();
|
|
747
|
+
const { isAllSelected: isAllCheckboxSelected, isIndeterminate: isAllCheckboxIndeterminate } = tableReactData;
|
|
748
|
+
const isAllCheckboxDisabled = computeIsAllCheckboxDisabled.value;
|
|
749
|
+
const { slots } = column;
|
|
750
|
+
const titleSlot = slots ? slots.title : null;
|
|
751
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
752
|
+
const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
|
|
753
|
+
const colTitle = $table.getHeaderCellLabel(column);
|
|
754
|
+
const ons = {};
|
|
755
|
+
if (!isHidden) {
|
|
756
|
+
ons.onClick = (evnt) => {
|
|
757
|
+
if (!isAllCheckboxDisabled) {
|
|
758
|
+
$table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected);
|
|
1094
759
|
}
|
|
1095
|
-
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return renderHeaderCellBaseVNs(params,
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
const checkboxParams = { ...params, checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate };
|
|
763
|
+
if (getConfig().tableHeadeSlotToTitleSlot === "obsolete") {
|
|
764
|
+
const headerSlot = slots ? slots.header : null;
|
|
765
|
+
if (headerSlot) {
|
|
766
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
if (checkStrictly ? !showHeader : showHeader === false) {
|
|
770
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
|
|
771
|
+
h("span", {
|
|
772
|
+
class: "vxe-checkbox--label"
|
|
773
|
+
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
774
|
+
]));
|
|
775
|
+
}
|
|
776
|
+
return renderHeaderCellBaseVNs(
|
|
777
|
+
params,
|
|
778
|
+
renderTitleContent(checkboxParams, [
|
|
779
|
+
h("span", {
|
|
780
|
+
class: ["vxe-cell--checkbox", {
|
|
781
|
+
"is--checked": isAllCheckboxSelected,
|
|
782
|
+
"is--disabled": isAllCheckboxDisabled,
|
|
783
|
+
"is--indeterminate": isAllCheckboxIndeterminate
|
|
784
|
+
}],
|
|
785
|
+
title: XEUtils.eqNull(headerTitle) ? getI18n("vxe.table.allTitle") : `${headerTitle || ""}`,
|
|
786
|
+
...ons
|
|
787
|
+
}, [
|
|
788
|
+
h("span", {
|
|
789
|
+
class: ["vxe-checkbox--icon", isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : isAllCheckboxDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
|
|
790
|
+
})
|
|
791
|
+
].concat(titleSlot || colTitle ? [
|
|
792
|
+
h("span", {
|
|
793
|
+
class: "vxe-checkbox--label"
|
|
794
|
+
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
795
|
+
] : []))
|
|
796
|
+
])
|
|
797
|
+
);
|
|
798
|
+
},
|
|
799
|
+
renderCheckboxCell(params) {
|
|
800
|
+
const { $table, row, column, isHidden } = params;
|
|
801
|
+
const tableProps = $table.props;
|
|
802
|
+
const tableReactData = $table.reactData;
|
|
803
|
+
const tableInternalData = $table.internalData;
|
|
804
|
+
const { treeConfig } = tableProps;
|
|
805
|
+
const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
|
|
806
|
+
const { selectCheckboxMaps, treeIndeterminateRowMaps } = tableInternalData;
|
|
807
|
+
const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
808
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
809
|
+
const { mapChildrenField } = aggregateOpts;
|
|
810
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
811
|
+
const { labelField, checkMethod, visibleMethod } = checkboxOpts;
|
|
812
|
+
const { slots } = column;
|
|
813
|
+
const defaultSlot = slots ? slots.default : null;
|
|
814
|
+
const checkboxSlot = slots ? slots.checkbox : null;
|
|
815
|
+
let indeterminate = false;
|
|
816
|
+
let isChecked = false;
|
|
817
|
+
let isVisible = true;
|
|
818
|
+
let isDisabled = false;
|
|
819
|
+
const ons = {};
|
|
820
|
+
if (!isHidden) {
|
|
821
|
+
const rowid = getRowid($table, row);
|
|
822
|
+
isChecked = !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
|
|
823
|
+
if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
|
|
824
|
+
const childList = row[mapChildrenField || ""];
|
|
825
|
+
if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
|
|
826
|
+
isDisabled = true;
|
|
1128
827
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
const editOpts = computeEditOpts.value;
|
|
1140
|
-
const { sortable, filters, editRender } = column;
|
|
1141
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1142
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1143
|
-
let isRequired = false;
|
|
1144
|
-
if (editRules) {
|
|
1145
|
-
const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field);
|
|
1146
|
-
if (columnRules) {
|
|
1147
|
-
isRequired = columnRules.some((rule) => rule.required);
|
|
1148
|
-
}
|
|
828
|
+
} else {
|
|
829
|
+
isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
830
|
+
isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
|
|
831
|
+
}
|
|
832
|
+
if (treeConfig || isRowGroupStatus) {
|
|
833
|
+
indeterminate = !!treeIndeterminateRowMaps[rowid];
|
|
834
|
+
}
|
|
835
|
+
ons.onClick = (evnt) => {
|
|
836
|
+
if (!isDisabled && isVisible) {
|
|
837
|
+
$table.triggerCheckRowEvent(evnt, params, !isChecked);
|
|
1149
838
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate };
|
|
842
|
+
if (checkboxSlot) {
|
|
843
|
+
return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
|
|
844
|
+
}
|
|
845
|
+
const checkVNs = [];
|
|
846
|
+
if (isVisible) {
|
|
847
|
+
checkVNs.push(
|
|
848
|
+
h("span", {
|
|
849
|
+
class: ["vxe-checkbox--icon", indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
|
|
850
|
+
})
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
if (defaultSlot || labelField) {
|
|
854
|
+
checkVNs.push(
|
|
855
|
+
h("span", {
|
|
856
|
+
class: "vxe-checkbox--label"
|
|
857
|
+
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField))
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
return renderCellBaseVNs(params, [
|
|
861
|
+
h("span", {
|
|
862
|
+
class: ["vxe-cell--checkbox", {
|
|
863
|
+
"is--checked": isChecked,
|
|
864
|
+
"is--disabled": isDisabled,
|
|
865
|
+
"is--indeterminate": indeterminate,
|
|
866
|
+
"is--hidden": !isVisible
|
|
867
|
+
}],
|
|
868
|
+
...ons
|
|
869
|
+
}, checkVNs)
|
|
870
|
+
]);
|
|
871
|
+
},
|
|
872
|
+
renderDeepSelectionCell(params) {
|
|
873
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCell(params));
|
|
874
|
+
},
|
|
875
|
+
renderCheckboxCellByProp(params) {
|
|
876
|
+
const { $table, row, column, isHidden } = params;
|
|
877
|
+
const tableProps = $table.props;
|
|
878
|
+
const tableReactData = $table.reactData;
|
|
879
|
+
const tableInternalData = $table.internalData;
|
|
880
|
+
const { treeConfig } = tableProps;
|
|
881
|
+
const { updateCheckboxFlag, isRowGroupStatus } = tableReactData;
|
|
882
|
+
const { treeIndeterminateRowMaps } = tableInternalData;
|
|
883
|
+
const { computeCheckboxOpts, computeAggregateOpts } = $table.getComputeMaps();
|
|
884
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
885
|
+
const { mapChildrenField } = aggregateOpts;
|
|
886
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
887
|
+
const { labelField, checkField, checkMethod, visibleMethod } = checkboxOpts;
|
|
888
|
+
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
889
|
+
const { slots } = column;
|
|
890
|
+
const defaultSlot = slots ? slots.default : null;
|
|
891
|
+
const checkboxSlot = slots ? slots.checkbox : null;
|
|
892
|
+
let indeterminate = false;
|
|
893
|
+
let isChecked = false;
|
|
894
|
+
let isVisible = true;
|
|
895
|
+
let isDisabled = false;
|
|
896
|
+
const ons = {};
|
|
897
|
+
if (!isHidden) {
|
|
898
|
+
const rowid = getRowid($table, row);
|
|
899
|
+
isChecked = !!updateCheckboxFlag && XEUtils.get(row, checkField);
|
|
900
|
+
if (checkMethod && isRowGroupStatus && $table.isAggregateRecord(row)) {
|
|
901
|
+
const childList = row[mapChildrenField || ""];
|
|
902
|
+
if (!childList || !childList.length || childList.every((item) => !checkMethod({ $table, row: item }))) {
|
|
903
|
+
isDisabled = true;
|
|
1173
904
|
}
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
const { editStore } = tableReactData;
|
|
1185
|
-
const { actived } = editStore;
|
|
1186
|
-
const { editRender } = column;
|
|
1187
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1188
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1189
|
-
return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row));
|
|
1190
|
-
},
|
|
1191
|
-
renderDeepRowEdit(params) {
|
|
1192
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderRowEdit(params));
|
|
1193
|
-
},
|
|
1194
|
-
// 单元格编辑模式
|
|
1195
|
-
renderCellEdit(params) {
|
|
1196
|
-
const { $table, column } = params;
|
|
1197
|
-
const tableProps = $table.props;
|
|
1198
|
-
const { editConfig } = tableProps;
|
|
1199
|
-
const tableReactData = $table.reactData;
|
|
1200
|
-
const { editStore } = tableReactData;
|
|
1201
|
-
const { actived } = editStore;
|
|
1202
|
-
const { editRender } = column;
|
|
1203
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1204
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1205
|
-
return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row && actived.column === params.column));
|
|
1206
|
-
},
|
|
1207
|
-
renderDeepCellEdit(params) {
|
|
1208
|
-
return Cell.renderDeepNodeBtn(params, Cell.renderCellEdit(params));
|
|
1209
|
-
},
|
|
1210
|
-
runRenderer(params, isEdit) {
|
|
1211
|
-
const { $table, row, column } = params;
|
|
1212
|
-
const tableProps = $table.props;
|
|
1213
|
-
const { editConfig } = tableProps;
|
|
1214
|
-
const tableReactData = $table.reactData;
|
|
1215
|
-
const { isRowGroupStatus } = tableReactData;
|
|
1216
|
-
const { slots, field, editRender, formatter } = column;
|
|
1217
|
-
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1218
|
-
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1219
|
-
const defaultSlot = slots ? slots.default : null;
|
|
1220
|
-
const gcSlot = slots ? (slots.groupContent || slots['group-content']) : null;
|
|
1221
|
-
const editSlot = slots ? slots.edit : null;
|
|
1222
|
-
const cellParams = Object.assign({ $type: '', isEdit }, params);
|
|
1223
|
-
if (isEdit && editRenderOpts) {
|
|
1224
|
-
cellParams.$type = 'edit';
|
|
1225
|
-
if (editSlot) {
|
|
1226
|
-
return $table.callSlot(editSlot, cellParams);
|
|
1227
|
-
}
|
|
1228
|
-
const { computeRendererOpts } = $table.getComputeMaps();
|
|
1229
|
-
const rendererOpts = computeRendererOpts.value;
|
|
1230
|
-
const compConf = editRenderOpts.name ? (rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name)) : null;
|
|
1231
|
-
const rtEdit = compConf ? (compConf.renderTableEdit || compConf.renderEdit) : null;
|
|
1232
|
-
if (rtEdit) {
|
|
1233
|
-
return getSlotVNs(rtEdit(editRenderOpts, cellParams));
|
|
1234
|
-
}
|
|
1235
|
-
return [];
|
|
905
|
+
} else {
|
|
906
|
+
isVisible = !visibleMethod || visibleMethod({ $table, row });
|
|
907
|
+
isDisabled = checkMethod ? !checkMethod({ $table, row }) : !!checkMethod;
|
|
908
|
+
}
|
|
909
|
+
if (treeConfig || isRowGroupStatus) {
|
|
910
|
+
indeterminate = !!treeIndeterminateRowMaps[rowid];
|
|
911
|
+
}
|
|
912
|
+
ons.onClick = (evnt) => {
|
|
913
|
+
if (!isDisabled && isVisible) {
|
|
914
|
+
$table.triggerCheckRowEvent(evnt, params, !isChecked);
|
|
1236
915
|
}
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate };
|
|
919
|
+
if (checkboxSlot) {
|
|
920
|
+
return renderCellBaseVNs(params, $table.callSlot(checkboxSlot, checkboxParams));
|
|
921
|
+
}
|
|
922
|
+
const checkVNs = [];
|
|
923
|
+
if (isVisible) {
|
|
924
|
+
checkVNs.push(
|
|
925
|
+
h("span", {
|
|
926
|
+
class: ["vxe-checkbox--icon", indeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : isChecked ? getIcon().TABLE_CHECKBOX_CHECKED : isDisabled ? getIcon().TABLE_CHECKBOX_DISABLED_UNCHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED]
|
|
927
|
+
})
|
|
928
|
+
);
|
|
929
|
+
if (defaultSlot || labelField) {
|
|
930
|
+
checkVNs.push(
|
|
931
|
+
h("span", {
|
|
932
|
+
class: "vxe-checkbox--label"
|
|
933
|
+
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams) : XEUtils.get(row, labelField))
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return renderCellBaseVNs(params, [
|
|
938
|
+
h("span", {
|
|
939
|
+
class: ["vxe-cell--checkbox", {
|
|
940
|
+
"is--checked": isChecked,
|
|
941
|
+
"is--disabled": isDisabled,
|
|
942
|
+
"is--indeterminate": indeterminateField && !isChecked ? row[indeterminateField] : indeterminate,
|
|
943
|
+
"is--hidden": !isVisible
|
|
944
|
+
}],
|
|
945
|
+
...ons
|
|
946
|
+
}, checkVNs)
|
|
947
|
+
]);
|
|
948
|
+
},
|
|
949
|
+
renderDeepSelectionCellByProp(params) {
|
|
950
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderCheckboxCellByProp(params));
|
|
951
|
+
},
|
|
952
|
+
/**
|
|
953
|
+
* 展开行
|
|
954
|
+
*/
|
|
955
|
+
renderExpandCell(params) {
|
|
956
|
+
const { $table, isHidden, row, column } = params;
|
|
957
|
+
const tableReactData = $table.reactData;
|
|
958
|
+
const tableInternalData = $table.internalData;
|
|
959
|
+
const { isRowGroupStatus } = tableReactData;
|
|
960
|
+
const { rowExpandedMaps, rowExpandLazyLoadedMaps } = tableInternalData;
|
|
961
|
+
const { computeExpandOpts } = $table.getComputeMaps();
|
|
962
|
+
const expandOpts = computeExpandOpts.value;
|
|
963
|
+
const { lazy, labelField, iconLoaded, showIcon, iconOpen, iconClose, visibleMethod } = expandOpts;
|
|
964
|
+
const { slots } = column;
|
|
965
|
+
const defaultSlot = slots ? slots.default : null;
|
|
966
|
+
const iconSlot = slots ? slots.icon : null;
|
|
967
|
+
let isActive = false;
|
|
968
|
+
let isLazyLoading = false;
|
|
969
|
+
if (isRowGroupStatus && row.isAggregate) {
|
|
970
|
+
return renderCellBaseVNs(params, []);
|
|
971
|
+
}
|
|
972
|
+
if (iconSlot) {
|
|
973
|
+
return renderCellBaseVNs(params, $table.callSlot(iconSlot, params));
|
|
974
|
+
}
|
|
975
|
+
if (!isHidden) {
|
|
976
|
+
const rowid = getRowid($table, row);
|
|
977
|
+
isActive = !!rowExpandedMaps[rowid];
|
|
978
|
+
if (lazy) {
|
|
979
|
+
isLazyLoading = !!rowExpandLazyLoadedMaps[rowid];
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
return renderCellBaseVNs(params, [
|
|
983
|
+
showIcon && (!visibleMethod || visibleMethod(params)) ? h("div", {
|
|
984
|
+
class: ["vxe-table--expanded", {
|
|
985
|
+
"is--active": isActive
|
|
986
|
+
}]
|
|
987
|
+
}, [
|
|
988
|
+
h("span", {
|
|
989
|
+
class: "vxe-table--expand-btn",
|
|
990
|
+
onMousedown(evnt) {
|
|
991
|
+
evnt.stopPropagation();
|
|
992
|
+
},
|
|
993
|
+
onClick(evnt) {
|
|
994
|
+
$table.triggerRowExpandEvent(evnt, params);
|
|
995
|
+
}
|
|
996
|
+
}, [
|
|
997
|
+
h("i", {
|
|
998
|
+
class: isLazyLoading ? iconLoaded || getIcon().TABLE_EXPAND_LOADED : isActive ? iconOpen || getIcon().TABLE_EXPAND_OPEN : iconClose || getIcon().TABLE_EXPAND_CLOSE
|
|
999
|
+
})
|
|
1000
|
+
])
|
|
1001
|
+
]) : renderEmptyElement($table),
|
|
1002
|
+
defaultSlot || labelField ? h("div", {
|
|
1003
|
+
class: "vxe-table--expand-label"
|
|
1004
|
+
}, defaultSlot ? $table.callSlot(defaultSlot, params) : XEUtils.get(row, labelField)) : renderEmptyElement($table)
|
|
1005
|
+
]);
|
|
1006
|
+
},
|
|
1007
|
+
renderExpandData(params) {
|
|
1008
|
+
const { $table, column } = params;
|
|
1009
|
+
const { slots, contentRender } = column;
|
|
1010
|
+
const contentSlot = slots ? slots.content : null;
|
|
1011
|
+
if (contentSlot) {
|
|
1012
|
+
return $table.callSlot(contentSlot, params);
|
|
1013
|
+
}
|
|
1014
|
+
if (contentRender) {
|
|
1015
|
+
const { computeRendererOpts } = $table.getComputeMaps();
|
|
1016
|
+
const rendererOpts = computeRendererOpts.value;
|
|
1017
|
+
const compConf = contentRender.name ? rendererOpts[contentRender.name] || renderer.get(contentRender.name) : null;
|
|
1018
|
+
if (compConf) {
|
|
1019
|
+
const rtExpand = compConf.renderTableExpand || compConf.renderExpand;
|
|
1020
|
+
if (rtExpand) {
|
|
1021
|
+
return getSlotVNs(rtExpand(contentRender, params));
|
|
1249
1022
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
return [];
|
|
1026
|
+
},
|
|
1027
|
+
/**
|
|
1028
|
+
* HTML 标签
|
|
1029
|
+
*/
|
|
1030
|
+
renderHTMLCell(params) {
|
|
1031
|
+
const { $table, column } = params;
|
|
1032
|
+
const { slots } = column;
|
|
1033
|
+
const defaultSlot = slots ? slots.default : null;
|
|
1034
|
+
if (defaultSlot) {
|
|
1035
|
+
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
1036
|
+
}
|
|
1037
|
+
return renderCellBaseVNs(params, [
|
|
1038
|
+
h("span", {
|
|
1039
|
+
class: "vxe-cell--html",
|
|
1040
|
+
innerHTML: getDefaultCellLabel(params)
|
|
1041
|
+
})
|
|
1042
|
+
]);
|
|
1043
|
+
},
|
|
1044
|
+
renderDeepHTMLCell(params) {
|
|
1045
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderHTMLCell(params));
|
|
1046
|
+
},
|
|
1047
|
+
/**
|
|
1048
|
+
* 排序和筛选
|
|
1049
|
+
*/
|
|
1050
|
+
renderSortAndFilterHeader(params) {
|
|
1051
|
+
return renderHeaderCellBaseVNs(
|
|
1052
|
+
params,
|
|
1053
|
+
Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params).concat(Cell.renderFilterIcon(params)))
|
|
1054
|
+
);
|
|
1055
|
+
},
|
|
1056
|
+
/**
|
|
1057
|
+
* 排序
|
|
1058
|
+
*/
|
|
1059
|
+
renderSortHeader(params) {
|
|
1060
|
+
return renderHeaderCellBaseVNs(
|
|
1061
|
+
params,
|
|
1062
|
+
Cell.renderHeaderTitle(params).concat(Cell.renderSortIcon(params))
|
|
1063
|
+
);
|
|
1064
|
+
},
|
|
1065
|
+
renderSortIcon(params) {
|
|
1066
|
+
const { $table, column } = params;
|
|
1067
|
+
const { computeSortOpts } = $table.getComputeMaps();
|
|
1068
|
+
const sortOpts = computeSortOpts.value;
|
|
1069
|
+
const { showIcon, allowBtn, ascTitle, descTitle, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts;
|
|
1070
|
+
const { order, slots } = column;
|
|
1071
|
+
if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
|
|
1072
|
+
const sortSlot = slots ? slots.sort : null;
|
|
1073
|
+
return sortSlot ? getSlotVNs($table.callSlot(sortSlot, params)) : [
|
|
1074
|
+
h("span", {
|
|
1075
|
+
class: ["vxe-cell--sort", `vxe-cell--sort-${iconLayout}-layout`]
|
|
1076
|
+
}, [
|
|
1077
|
+
h("i", {
|
|
1078
|
+
class: ["vxe-sort--asc-btn", iconAsc || getIcon().TABLE_SORT_ASC, {
|
|
1079
|
+
"sort--active": order === "asc"
|
|
1080
|
+
}],
|
|
1081
|
+
title: XEUtils.eqNull(ascTitle) ? getI18n("vxe.table.sortAsc") : `${ascTitle || ""}`,
|
|
1082
|
+
onClick: allowBtn ? (evnt) => {
|
|
1083
|
+
evnt.stopPropagation();
|
|
1084
|
+
$table.triggerSortEvent(evnt, column, "asc");
|
|
1085
|
+
} : void 0
|
|
1086
|
+
}),
|
|
1087
|
+
h("i", {
|
|
1088
|
+
class: ["vxe-sort--desc-btn", iconDesc || getIcon().TABLE_SORT_DESC, {
|
|
1089
|
+
"sort--active": order === "desc"
|
|
1090
|
+
}],
|
|
1091
|
+
title: XEUtils.eqNull(descTitle) ? getI18n("vxe.table.sortDesc") : `${descTitle || ""}`,
|
|
1092
|
+
onClick: allowBtn ? (evnt) => {
|
|
1093
|
+
evnt.stopPropagation();
|
|
1094
|
+
$table.triggerSortEvent(evnt, column, "desc");
|
|
1095
|
+
} : void 0
|
|
1096
|
+
})
|
|
1097
|
+
])
|
|
1098
|
+
];
|
|
1099
|
+
}
|
|
1100
|
+
return [];
|
|
1101
|
+
},
|
|
1102
|
+
/**
|
|
1103
|
+
* 筛选
|
|
1104
|
+
*/
|
|
1105
|
+
renderFilterHeader(params) {
|
|
1106
|
+
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params).concat(Cell.renderFilterIcon(params)));
|
|
1107
|
+
},
|
|
1108
|
+
renderFilterIcon(params) {
|
|
1109
|
+
const { $table, column, hasFilter } = params;
|
|
1110
|
+
const tableReactData = $table.reactData;
|
|
1111
|
+
const { filterStore } = tableReactData;
|
|
1112
|
+
const { computeFilterOpts } = $table.getComputeMaps();
|
|
1113
|
+
const filterOpts = computeFilterOpts.value;
|
|
1114
|
+
const { showIcon, iconNone, iconMatch, iconVisibleMethod } = filterOpts;
|
|
1115
|
+
if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
|
|
1116
|
+
return [
|
|
1117
|
+
h("span", {
|
|
1118
|
+
class: ["vxe-cell--filter", {
|
|
1119
|
+
"is--active": filterStore.visible && filterStore.column === column
|
|
1120
|
+
}],
|
|
1121
|
+
onClick(evnt) {
|
|
1122
|
+
if ($table.triggerFilterEvent) {
|
|
1123
|
+
$table.triggerFilterEvent(evnt, params.column, params);
|
|
1253
1124
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
}
|
|
1263
|
-
return Cell.renderDefaultCell(cellParams);
|
|
1125
|
+
}
|
|
1126
|
+
}, [
|
|
1127
|
+
h("i", {
|
|
1128
|
+
class: ["vxe-filter--btn", hasFilter ? iconMatch || getIcon().TABLE_FILTER_MATCH : iconNone || getIcon().TABLE_FILTER_NONE],
|
|
1129
|
+
title: getI18n("vxe.table.filter")
|
|
1130
|
+
})
|
|
1131
|
+
])
|
|
1132
|
+
];
|
|
1264
1133
|
}
|
|
1134
|
+
return [];
|
|
1135
|
+
},
|
|
1136
|
+
/**
|
|
1137
|
+
* 可编辑
|
|
1138
|
+
*/
|
|
1139
|
+
renderEditHeader(params) {
|
|
1140
|
+
const { $table, column } = params;
|
|
1141
|
+
const tableProps = $table.props;
|
|
1142
|
+
const { computeEditOpts } = $table.getComputeMaps();
|
|
1143
|
+
const { editConfig, editRules } = tableProps;
|
|
1144
|
+
const editOpts = computeEditOpts.value;
|
|
1145
|
+
const { sortable, filters, editRender } = column;
|
|
1146
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1147
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1148
|
+
let isRequired = false;
|
|
1149
|
+
if (editRules) {
|
|
1150
|
+
const columnRules = column.rules ? column.rules : XEUtils.get(editRules, column.field);
|
|
1151
|
+
if (columnRules) {
|
|
1152
|
+
isRequired = columnRules.some((rule) => rule.required);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
let editIconVNs = [];
|
|
1156
|
+
if (isEnableEdit) {
|
|
1157
|
+
const { showAsterisk, showIcon, icon } = editOpts;
|
|
1158
|
+
editIconVNs = [
|
|
1159
|
+
isRequired && showAsterisk ? h("span", {
|
|
1160
|
+
class: "vxe-cell--required-icon"
|
|
1161
|
+
}, [
|
|
1162
|
+
h("i")
|
|
1163
|
+
]) : renderEmptyElement($table),
|
|
1164
|
+
editRenderOpts && showIcon ? h("span", {
|
|
1165
|
+
class: "vxe-cell--edit-icon"
|
|
1166
|
+
}, XEUtils.isFunction(icon) ? getSlotVNs(icon({})) : [
|
|
1167
|
+
h("i", {
|
|
1168
|
+
class: icon || getIcon().TABLE_EDIT
|
|
1169
|
+
})
|
|
1170
|
+
]) : renderEmptyElement($table)
|
|
1171
|
+
];
|
|
1172
|
+
}
|
|
1173
|
+
return renderHeaderCellBaseVNs(
|
|
1174
|
+
params,
|
|
1175
|
+
editIconVNs.concat(Cell.renderHeaderTitle(params)).concat(sortable ? Cell.renderSortIcon(params) : []).concat(filters ? Cell.renderFilterIcon(params) : [])
|
|
1176
|
+
);
|
|
1177
|
+
},
|
|
1178
|
+
// 行格编辑模式
|
|
1179
|
+
renderRowEdit(params) {
|
|
1180
|
+
const { $table, column } = params;
|
|
1181
|
+
const tableProps = $table.props;
|
|
1182
|
+
const { editConfig } = tableProps;
|
|
1183
|
+
const tableReactData = $table.reactData;
|
|
1184
|
+
const { editStore } = tableReactData;
|
|
1185
|
+
const { actived } = editStore;
|
|
1186
|
+
const { editRender } = column;
|
|
1187
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1188
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1189
|
+
return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row));
|
|
1190
|
+
},
|
|
1191
|
+
renderDeepRowEdit(params) {
|
|
1192
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderRowEdit(params));
|
|
1193
|
+
},
|
|
1194
|
+
// 单元格编辑模式
|
|
1195
|
+
renderCellEdit(params) {
|
|
1196
|
+
const { $table, column } = params;
|
|
1197
|
+
const tableProps = $table.props;
|
|
1198
|
+
const { editConfig } = tableProps;
|
|
1199
|
+
const tableReactData = $table.reactData;
|
|
1200
|
+
const { editStore } = tableReactData;
|
|
1201
|
+
const { actived } = editStore;
|
|
1202
|
+
const { editRender } = column;
|
|
1203
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1204
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1205
|
+
return Cell.runRenderer(params, !!(editRenderOpts && actived && actived.row === params.row && actived.column === params.column));
|
|
1206
|
+
},
|
|
1207
|
+
renderDeepCellEdit(params) {
|
|
1208
|
+
return Cell.renderDeepNodeBtn(params, Cell.renderCellEdit(params));
|
|
1209
|
+
},
|
|
1210
|
+
runRenderer(params, isEdit) {
|
|
1211
|
+
const { $table, row, column } = params;
|
|
1212
|
+
const tableProps = $table.props;
|
|
1213
|
+
const { editConfig } = tableProps;
|
|
1214
|
+
const tableReactData = $table.reactData;
|
|
1215
|
+
const { isRowGroupStatus } = tableReactData;
|
|
1216
|
+
const { slots, field, editRender, formatter } = column;
|
|
1217
|
+
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
1218
|
+
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
1219
|
+
const defaultSlot = slots ? slots.default : null;
|
|
1220
|
+
const gcSlot = slots ? slots.groupContent || slots["group-content"] : null;
|
|
1221
|
+
const editSlot = slots ? slots.edit : null;
|
|
1222
|
+
const cellParams = Object.assign({ $type: "", isEdit }, params);
|
|
1223
|
+
if (isEdit && editRenderOpts) {
|
|
1224
|
+
cellParams.$type = "edit";
|
|
1225
|
+
if (editSlot) {
|
|
1226
|
+
return $table.callSlot(editSlot, cellParams);
|
|
1227
|
+
}
|
|
1228
|
+
const { computeRendererOpts } = $table.getComputeMaps();
|
|
1229
|
+
const rendererOpts = computeRendererOpts.value;
|
|
1230
|
+
const compConf = editRenderOpts.name ? rendererOpts[editRenderOpts.name] || renderer.get(editRenderOpts.name) : null;
|
|
1231
|
+
const rtEdit = compConf ? compConf.renderTableEdit || compConf.renderEdit : null;
|
|
1232
|
+
if (rtEdit) {
|
|
1233
|
+
return getSlotVNs(rtEdit(editRenderOpts, cellParams));
|
|
1234
|
+
}
|
|
1235
|
+
return [];
|
|
1236
|
+
}
|
|
1237
|
+
if (isRowGroupStatus && field && row.isAggregate) {
|
|
1238
|
+
const aggRow = row;
|
|
1239
|
+
const { computeAggregateOpts } = $table.getComputeMaps();
|
|
1240
|
+
const aggregateOpts = computeAggregateOpts.value;
|
|
1241
|
+
const { mapChildrenField } = aggregateOpts;
|
|
1242
|
+
const groupField = aggRow.groupField;
|
|
1243
|
+
const groupContent = aggRow.groupContent;
|
|
1244
|
+
const childList = mapChildrenField ? aggRow[mapChildrenField] || [] : [];
|
|
1245
|
+
const childCount = aggRow.childCount;
|
|
1246
|
+
if (gcSlot) {
|
|
1247
|
+
return renderCellBaseVNs(params, $table.callSlot(gcSlot, Object.assign({ groupField, groupContent, childList, childCount }, params)));
|
|
1248
|
+
}
|
|
1249
|
+
} else {
|
|
1250
|
+
if (defaultSlot) {
|
|
1251
|
+
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, cellParams));
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
if (formatter) {
|
|
1255
|
+
return renderCellBaseVNs(params, [
|
|
1256
|
+
h("span", {
|
|
1257
|
+
class: "vxe-cell--label"
|
|
1258
|
+
}, getDefaultCellLabel(cellParams))
|
|
1259
|
+
]);
|
|
1260
|
+
}
|
|
1261
|
+
return Cell.renderDefaultCell(cellParams);
|
|
1262
|
+
}
|
|
1263
|
+
};
|
|
1264
|
+
var cell_default = Cell;
|
|
1265
|
+
export {
|
|
1266
|
+
Cell,
|
|
1267
|
+
cell_default as default
|
|
1265
1268
|
};
|
|
1266
|
-
export default Cell;
|