vxe-table 4.23.4 → 4.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.esm.js +32459 -33908
- package/dist/style.css +4501 -1
- package/dist/style.mini.css +1 -0
- package/es/colgroup/index.d.ts +760 -0
- package/es/colgroup/index.js +16 -13
- package/es/column/index.d.ts +760 -0
- package/es/column/index.js +16 -13
- package/es/components.d.ts +9 -0
- package/es/components.js +29 -29
- package/es/grid/index.d.ts +2824 -0
- package/es/grid/index.js +14 -9
- package/es/grid/src/emits.d.ts +2 -0
- package/es/grid/src/emits.js +18 -15
- package/es/grid/src/grid.d.ts +556 -0
- package/es/grid/src/grid.js +1695 -1758
- package/es/grid/src/props.d.ts +200 -0
- package/es/grid/src/props.js +19 -6
- package/es/{vxe-grid/style.min.css → grid/style.mini.css} +1 -1
- package/es/index.d.ts +3 -0
- package/es/index.esm.js +6 -3
- package/es/index.js +6 -0
- package/es/locale/lang/ar-EG.d.ts +908 -2
- package/es/locale/lang/ar-EG.js +906 -903
- package/es/locale/lang/de-DE.d.ts +908 -2
- package/es/locale/lang/de-DE.js +906 -903
- package/es/locale/lang/en-US.d.ts +908 -2
- package/es/locale/lang/en-US.js +906 -903
- package/es/locale/lang/es-ES.d.ts +908 -2
- package/es/locale/lang/es-ES.js +906 -903
- package/es/locale/lang/fr-FR.d.ts +908 -2
- package/es/locale/lang/fr-FR.js +906 -903
- package/es/locale/lang/hu-HU.d.ts +908 -2
- package/es/locale/lang/hu-HU.js +906 -903
- package/es/locale/lang/hy-AM.d.ts +908 -2
- package/es/locale/lang/hy-AM.js +906 -903
- package/es/locale/lang/id-ID.d.ts +908 -2
- package/es/locale/lang/id-ID.js +906 -903
- package/es/locale/lang/it-IT.d.ts +908 -2
- package/es/locale/lang/it-IT.js +906 -903
- package/es/locale/lang/ja-JP.d.ts +908 -2
- package/es/locale/lang/ja-JP.js +906 -903
- package/es/locale/lang/ko-KR.d.ts +908 -2
- package/es/locale/lang/ko-KR.js +906 -903
- package/es/locale/lang/ms-MY.d.ts +908 -2
- package/es/locale/lang/ms-MY.js +906 -903
- package/es/locale/lang/nb-NO.d.ts +908 -2
- package/es/locale/lang/nb-NO.js +906 -903
- package/es/locale/lang/pt-BR.d.ts +908 -2
- package/es/locale/lang/pt-BR.js +906 -903
- package/es/locale/lang/ru-RU.d.ts +908 -2
- package/es/locale/lang/ru-RU.js +906 -903
- package/es/locale/lang/th-TH.d.ts +908 -2
- package/es/locale/lang/th-TH.js +906 -903
- package/es/locale/lang/ug-CN.d.ts +908 -2
- package/es/locale/lang/ug-CN.js +906 -903
- package/es/locale/lang/uk-UA.d.ts +908 -2
- package/es/locale/lang/uk-UA.js +906 -903
- package/es/locale/lang/uz-UZ.d.ts +908 -2
- package/es/locale/lang/uz-UZ.js +906 -903
- package/es/locale/lang/vi-VN.d.ts +908 -2
- package/es/locale/lang/vi-VN.js +906 -903
- package/es/locale/lang/zh-CHT.d.ts +908 -2
- package/es/locale/lang/zh-CHT.js +906 -903
- package/es/locale/lang/zh-CN.d.ts +908 -2
- package/es/locale/lang/zh-CN.js +906 -903
- package/es/locale/lang/zh-HK.d.ts +908 -2
- package/es/locale/lang/zh-HK.js +910 -2
- package/es/locale/lang/zh-MO.d.ts +908 -2
- package/es/locale/lang/zh-MO.js +910 -2
- package/es/locale/lang/zh-TC.d.ts +908 -0
- package/es/locale/lang/zh-TC.js +910 -2
- package/es/locale/lang/zh-TW.d.ts +908 -2
- package/es/locale/lang/zh-TW.js +910 -2
- package/es/table/index.d.ts +2672 -0
- package/es/table/index.js +16 -11
- package/es/table/module/custom/hook.d.ts +1 -0
- package/es/table/module/custom/hook.js +462 -483
- package/es/table/module/custom/panel.d.ts +17 -0
- package/es/table/module/custom/panel.js +1482 -1559
- package/es/table/module/edit/hook.d.ts +1 -0
- package/es/table/module/edit/hook.js +1008 -1078
- package/es/table/module/export/export-panel.d.ts +27 -0
- package/es/table/module/export/export-panel.js +523 -575
- package/es/table/module/export/hook.d.ts +1 -0
- package/es/table/module/export/hook.js +1805 -1884
- package/es/table/module/export/import-panel.d.ts +27 -0
- package/es/table/module/export/import-panel.js +244 -252
- package/es/table/module/export/util.d.ts +5 -0
- package/es/table/module/export/util.js +20 -17
- package/es/table/module/filter/hook.d.ts +1 -0
- package/es/table/module/filter/hook.js +472 -487
- package/es/table/module/filter/panel.d.ts +16 -0
- package/es/table/module/filter/panel.js +251 -275
- package/es/table/module/keyboard/hook.d.ts +1 -0
- package/es/table/module/keyboard/hook.js +445 -497
- package/es/table/module/menu/hook.d.ts +1 -0
- package/es/table/module/menu/hook.js +295 -315
- package/es/table/module/menu/panel.d.ts +2 -0
- package/es/table/module/menu/panel.js +164 -183
- package/es/table/module/validator/hook.d.ts +1 -0
- package/es/table/module/validator/hook.js +522 -571
- package/es/table/render/index.d.ts +1 -0
- package/es/table/render/index.js +1402 -1362
- package/es/table/src/body.d.ts +24 -0
- package/es/table/src/body.js +850 -865
- package/es/table/src/cell.d.ts +192 -0
- package/es/table/src/cell.js +1209 -1207
- package/es/table/src/column.d.ts +263 -0
- package/es/table/src/column.js +178 -174
- package/es/table/src/columnInfo.d.ts +13 -0
- package/es/table/src/columnInfo.js +202 -196
- package/es/table/src/emits.d.ts +2 -0
- package/es/table/src/emits.js +126 -119
- package/es/table/src/footer.d.ts +45 -0
- package/es/table/src/footer.js +336 -340
- package/es/table/src/group.d.ts +178 -0
- package/es/table/src/group.js +49 -46
- package/es/table/src/header.d.ts +26 -0
- package/es/table/src/header.js +517 -519
- package/es/table/src/props.d.ts +238 -0
- package/es/table/src/props.js +331 -328
- package/es/table/src/store.d.ts +6 -0
- package/es/table/src/store.js +9 -6
- package/es/table/src/table.d.ts +539 -0
- package/es/table/src/table.js +14064 -15041
- package/es/table/src/use/cell-view.d.ts +10 -0
- package/es/table/src/use/cell-view.js +36 -33
- package/es/table/src/use/index.d.ts +1 -0
- package/es/table/src/use/index.js +1 -1
- package/es/table/src/util.d.ts +74 -0
- package/es/table/src/util.js +1038 -1026
- package/es/table/style.css +1 -1
- package/es/table/style.mini.css +1 -0
- package/es/toolbar/index.d.ts +340 -0
- package/es/toolbar/index.js +14 -9
- package/es/toolbar/src/toolbar.d.ts +75 -0
- package/es/toolbar/src/toolbar.js +605 -613
- package/es/toolbar/{style.min.css → style.mini.css} +1 -1
- package/es/ui/index.d.ts +86 -0
- package/es/ui/index.js +457 -501
- package/es/ui/src/anime.d.ts +10 -0
- package/es/ui/src/anime.js +40 -40
- package/es/ui/src/comp.d.ts +2 -0
- package/es/ui/src/comp.js +5 -2
- package/es/ui/src/dom.d.ts +80 -0
- package/es/ui/src/dom.js +377 -380
- package/es/ui/src/log.d.ts +6 -0
- package/es/ui/src/log.js +18 -13
- package/es/ui/src/utils.d.ts +23 -0
- package/es/ui/src/utils.js +57 -53
- package/es/ui/src/vn.d.ts +7 -0
- package/es/ui/src/vn.js +49 -42
- package/es/v-x-e-table/index.d.ts +3 -0
- package/es/v-x-e-table/index.js +6 -3
- package/es/vxe-colgroup/index.d.ts +3 -0
- package/es/vxe-colgroup/index.js +6 -3
- package/es/vxe-column/index.d.ts +3 -0
- package/es/vxe-column/index.js +6 -3
- package/es/vxe-grid/index.d.ts +3 -0
- package/es/vxe-grid/index.js +6 -3
- package/{lib/grid/style/style.min.css → es/vxe-grid/style.mini.css} +1 -1
- package/es/vxe-table/index.d.ts +3 -0
- package/es/vxe-table/index.js +6 -3
- package/es/vxe-table/style.css +1 -1
- package/es/vxe-table/style.mini.css +1 -0
- package/es/vxe-toolbar/index.d.ts +3 -0
- package/es/vxe-toolbar/index.js +6 -3
- package/es/vxe-toolbar/{style.min.css → style.mini.css} +1 -1
- package/es/vxe-ui/index.d.ts +3 -0
- package/es/vxe-ui/index.js +6 -3
- package/lib/colgroup/index.js +44 -18
- package/lib/colgroup/style/index.js +1 -1
- package/lib/column/index.js +44 -18
- package/lib/column/style/index.js +1 -1
- package/lib/components.js +58 -92
- package/lib/grid/index.js +42 -14
- package/lib/grid/src/emits.js +37 -6
- package/lib/grid/src/grid.js +850 -1195
- package/lib/grid/src/props.js +27 -11
- package/lib/grid/style/index.js +1 -1
- package/lib/{vxe-grid/style/style.min.css → grid/style/style.mini.css} +1 -1
- package/lib/iconfont.1792977622800.ttf +0 -0
- package/lib/iconfont.1792977622800.woff +0 -0
- package/lib/iconfont.1792977622800.woff2 +0 -0
- package/lib/index.common.js +35 -19
- package/lib/index.js +37 -0
- package/lib/index.umd.js +30586 -24322
- package/lib/index.umd.min.js +3 -1
- package/lib/locale/ar-EG.umd.js +948 -0
- package/lib/locale/de-DE.umd.js +948 -0
- package/lib/locale/en-US.umd.js +948 -0
- package/lib/locale/es-ES.umd.js +948 -0
- package/lib/locale/fr-FR.umd.js +948 -0
- package/lib/locale/hu-HU.umd.js +948 -0
- package/lib/locale/hy-AM.umd.js +948 -0
- package/lib/locale/id-ID.umd.js +948 -0
- package/lib/locale/it-IT.umd.js +948 -0
- package/lib/locale/ja-JP.umd.js +948 -0
- package/lib/locale/ko-KR.umd.js +948 -0
- package/lib/locale/lang/ar-EG.js +681 -664
- package/lib/locale/lang/ar-EG.umd.js +913 -892
- package/lib/locale/lang/de-DE.js +681 -664
- package/lib/locale/lang/de-DE.umd.js +913 -892
- package/lib/locale/lang/en-US.js +678 -661
- package/lib/locale/lang/en-US.umd.js +913 -892
- package/lib/locale/lang/es-ES.js +681 -664
- package/lib/locale/lang/es-ES.umd.js +913 -892
- package/lib/locale/lang/fr-FR.js +654 -637
- package/lib/locale/lang/fr-FR.umd.js +913 -892
- package/lib/locale/lang/hu-HU.js +681 -664
- package/lib/locale/lang/hu-HU.umd.js +913 -892
- package/lib/locale/lang/hy-AM.js +681 -664
- package/lib/locale/lang/hy-AM.umd.js +913 -892
- package/lib/locale/lang/id-ID.js +681 -664
- package/lib/locale/lang/id-ID.umd.js +913 -892
- package/lib/locale/lang/it-IT.js +661 -644
- package/lib/locale/lang/it-IT.umd.js +912 -891
- package/lib/locale/lang/ja-JP.js +710 -693
- package/lib/locale/lang/ja-JP.umd.js +913 -892
- package/lib/locale/lang/ko-KR.js +681 -664
- package/lib/locale/lang/ko-KR.umd.js +913 -892
- package/lib/locale/lang/ms-MY.js +681 -664
- package/lib/locale/lang/ms-MY.umd.js +913 -892
- package/lib/locale/lang/nb-NO.js +681 -664
- package/lib/locale/lang/nb-NO.umd.js +913 -892
- package/lib/locale/lang/pt-BR.js +681 -664
- package/lib/locale/lang/pt-BR.umd.js +913 -892
- package/lib/locale/lang/ru-RU.js +690 -673
- package/lib/locale/lang/ru-RU.umd.js +913 -892
- package/lib/locale/lang/th-TH.js +681 -664
- package/lib/locale/lang/th-TH.umd.js +913 -892
- package/lib/locale/lang/ug-CN.js +681 -664
- package/lib/locale/lang/ug-CN.umd.js +913 -892
- package/lib/locale/lang/uk-UA.js +674 -657
- package/lib/locale/lang/uk-UA.umd.js +913 -892
- package/lib/locale/lang/uz-UZ.js +583 -566
- package/lib/locale/lang/uz-UZ.umd.js +908 -887
- package/lib/locale/lang/vi-VN.js +681 -664
- package/lib/locale/lang/vi-VN.umd.js +913 -892
- package/lib/locale/lang/zh-CHT.js +681 -664
- package/lib/locale/lang/zh-CHT.umd.js +913 -892
- package/lib/locale/lang/zh-CN.js +681 -664
- package/lib/locale/lang/zh-CN.umd.js +913 -892
- package/lib/locale/lang/zh-HK.js +928 -7
- package/lib/locale/lang/zh-HK.umd.js +945 -20
- package/lib/locale/lang/zh-MO.js +928 -7
- package/lib/locale/lang/zh-MO.umd.js +945 -20
- package/lib/locale/lang/zh-TC.js +928 -7
- package/lib/locale/lang/zh-TC.umd.js +948 -0
- package/lib/locale/lang/zh-TW.js +928 -7
- package/lib/locale/lang/zh-TW.umd.js +945 -20
- package/lib/locale/ms-MY.umd.js +948 -0
- package/lib/locale/nb-NO.umd.js +948 -0
- package/lib/locale/pt-BR.umd.js +948 -0
- package/lib/locale/ru-RU.umd.js +948 -0
- package/lib/locale/th-TH.umd.js +948 -0
- package/lib/locale/ug-CN.umd.js +948 -0
- package/lib/locale/uk-UA.umd.js +948 -0
- package/lib/locale/uz-UZ.umd.js +948 -0
- package/lib/locale/vi-VN.umd.js +948 -0
- package/lib/locale/zh-CHT.umd.js +948 -0
- package/lib/locale/zh-CN.umd.js +948 -0
- package/lib/locale/zh-HK.umd.js +948 -0
- package/lib/locale/zh-MO.umd.js +948 -0
- package/lib/locale/zh-TC.umd.js +948 -0
- package/lib/locale/zh-TW.umd.js +948 -0
- package/lib/style.css +4501 -1
- package/lib/style.mini.css +1 -0
- package/lib/table/index.js +45 -17
- package/lib/table/module/custom/hook.js +132 -252
- package/lib/table/module/custom/panel.js +919 -970
- package/lib/table/module/edit/hook.js +250 -620
- package/lib/table/module/export/export-panel.js +390 -347
- package/lib/table/module/export/hook.js +745 -1179
- package/lib/table/module/export/import-panel.js +170 -136
- package/lib/table/module/export/util.js +37 -14
- package/lib/table/module/filter/hook.js +127 -227
- package/lib/table/module/filter/panel.js +177 -208
- package/lib/table/module/keyboard/hook.js +93 -172
- package/lib/table/module/menu/hook.js +86 -165
- package/lib/table/module/menu/panel.js +176 -141
- package/lib/table/module/validator/hook.js +164 -271
- package/lib/table/render/index.js +700 -1147
- package/lib/table/src/body.js +426 -559
- package/lib/table/src/cell.js +619 -987
- package/lib/table/src/column.js +55 -30
- package/lib/table/src/columnInfo.js +88 -110
- package/lib/table/src/emits.js +145 -13
- package/lib/table/src/footer.js +181 -240
- package/lib/table/src/group.js +56 -34
- package/lib/table/src/header.js +292 -367
- package/lib/table/src/props.js +27 -12
- package/lib/table/src/store.js +25 -9
- package/lib/table/src/table.js +14179 -1019
- package/lib/table/src/use/cell-view.js +47 -37
- package/lib/table/src/use/index.js +17 -15
- package/lib/table/src/util.js +236 -337
- package/lib/table/style/index.js +1 -1
- package/lib/table/style/style.css +1 -1
- package/lib/table/style/style.mini.css +1 -0
- package/lib/toolbar/index.js +42 -14
- package/lib/toolbar/src/toolbar.js +271 -379
- package/lib/toolbar/style/index.js +1 -1
- package/lib/toolbar/style/{style.min.css → style.mini.css} +1 -1
- package/lib/ui/index.js +153 -195
- package/lib/ui/src/anime.js +49 -29
- package/lib/ui/src/comp.js +23 -6
- package/lib/ui/src/dom.js +114 -147
- package/lib/ui/src/log.js +34 -18
- package/lib/ui/src/utils.js +57 -45
- package/lib/ui/src/vn.js +60 -34
- package/lib/ui/style/index.js +1 -1
- package/lib/v-x-e-table/index.js +35 -19
- package/lib/vxe-colgroup/index.js +35 -19
- package/lib/vxe-colgroup/style/index.js +1 -1
- package/lib/vxe-column/index.js +35 -19
- package/lib/vxe-column/style/index.js +1 -1
- package/lib/vxe-grid/index.js +35 -19
- package/lib/vxe-grid/style/index.js +1 -1
- package/{es/grid/style.min.css → lib/vxe-grid/style/style.mini.css} +1 -1
- package/lib/vxe-table/index.js +35 -19
- package/lib/vxe-table/style/index.js +1 -1
- package/lib/vxe-table/style/style.css +1 -1
- package/lib/vxe-table/style/style.mini.css +1 -0
- package/lib/vxe-toolbar/index.js +35 -19
- package/lib/vxe-toolbar/style/index.js +1 -1
- package/lib/vxe-toolbar/style/{style.min.css → style.mini.css} +1 -1
- package/lib/vxe-ui/index.js +35 -19
- package/lib/vxe-ui/style/index.js +1 -1
- package/package.json +8 -4
- package/packages/locale/lang/zh-HK.ts +907 -3
- package/packages/locale/lang/zh-MO.ts +907 -3
- package/packages/locale/lang/zh-TC.ts +907 -3
- package/packages/locale/lang/zh-TW.ts +907 -3
- package/packages/table/module/edit/hook.ts +2 -2
- package/packages/table/src/table.ts +64 -28
- package/packages/ui/index.ts +1 -28
- package/dist/style.min.css +0 -1
- package/es/index.css +0 -1
- package/es/index.min.css +0 -1
- package/es/style.css +0 -1
- package/es/style.min.css +0 -1
- package/es/table/style.min.css +0 -1
- package/es/vxe-table/style.min.css +0 -1
- package/es/vxe-v-x-e-table/index.js +0 -3
- package/lib/colgroup/index.min.js +0 -1
- package/lib/column/index.min.js +0 -1
- package/lib/components.min.js +0 -1
- package/lib/grid/index.min.js +0 -1
- package/lib/grid/src/emits.min.js +0 -1
- package/lib/grid/src/grid.min.js +0 -1
- package/lib/grid/src/props.min.js +0 -1
- package/lib/index.css +0 -1
- package/lib/index.min.css +0 -1
- package/lib/locale/lang/ar-EG.d.ts +0 -2
- package/lib/locale/lang/ar-EG.min.js +0 -1
- package/lib/locale/lang/de-DE.d.ts +0 -2
- package/lib/locale/lang/de-DE.min.js +0 -1
- package/lib/locale/lang/en-US.d.ts +0 -2
- package/lib/locale/lang/en-US.min.js +0 -1
- package/lib/locale/lang/es-ES.d.ts +0 -2
- package/lib/locale/lang/es-ES.min.js +0 -1
- package/lib/locale/lang/fr-FR.d.ts +0 -2
- package/lib/locale/lang/fr-FR.min.js +0 -1
- package/lib/locale/lang/hu-HU.d.ts +0 -2
- package/lib/locale/lang/hu-HU.min.js +0 -1
- package/lib/locale/lang/hy-AM.d.ts +0 -2
- package/lib/locale/lang/hy-AM.min.js +0 -1
- package/lib/locale/lang/id-ID.d.ts +0 -2
- package/lib/locale/lang/id-ID.min.js +0 -1
- package/lib/locale/lang/it-IT.d.ts +0 -2
- package/lib/locale/lang/it-IT.min.js +0 -1
- package/lib/locale/lang/ja-JP.d.ts +0 -2
- package/lib/locale/lang/ja-JP.min.js +0 -1
- package/lib/locale/lang/ko-KR.d.ts +0 -2
- package/lib/locale/lang/ko-KR.min.js +0 -1
- package/lib/locale/lang/ms-MY.d.ts +0 -2
- package/lib/locale/lang/ms-MY.min.js +0 -1
- package/lib/locale/lang/nb-NO.d.ts +0 -2
- package/lib/locale/lang/nb-NO.min.js +0 -1
- package/lib/locale/lang/pt-BR.d.ts +0 -2
- package/lib/locale/lang/pt-BR.min.js +0 -1
- package/lib/locale/lang/ru-RU.d.ts +0 -2
- package/lib/locale/lang/ru-RU.min.js +0 -1
- package/lib/locale/lang/th-TH.d.ts +0 -2
- package/lib/locale/lang/th-TH.min.js +0 -1
- package/lib/locale/lang/ug-CN.d.ts +0 -2
- package/lib/locale/lang/ug-CN.min.js +0 -1
- package/lib/locale/lang/uk-UA.d.ts +0 -2
- package/lib/locale/lang/uk-UA.min.js +0 -1
- package/lib/locale/lang/uz-UZ.d.ts +0 -2
- package/lib/locale/lang/uz-UZ.min.js +0 -1
- package/lib/locale/lang/vi-VN.d.ts +0 -2
- package/lib/locale/lang/vi-VN.min.js +0 -1
- package/lib/locale/lang/zh-CHT.d.ts +0 -2
- package/lib/locale/lang/zh-CHT.min.js +0 -1
- package/lib/locale/lang/zh-CN.d.ts +0 -2
- package/lib/locale/lang/zh-CN.min.js +0 -1
- package/lib/locale/lang/zh-HK.d.ts +0 -2
- package/lib/locale/lang/zh-HK.min.js +0 -1
- package/lib/locale/lang/zh-MO.d.ts +0 -2
- package/lib/locale/lang/zh-MO.min.js +0 -1
- package/lib/locale/lang/zh-TC.min.js +0 -1
- package/lib/locale/lang/zh-TW.d.ts +0 -2
- package/lib/locale/lang/zh-TW.min.js +0 -1
- package/lib/style.min.css +0 -1
- package/lib/table/index.min.js +0 -1
- package/lib/table/module/custom/hook.min.js +0 -1
- package/lib/table/module/custom/panel.min.js +0 -1
- package/lib/table/module/edit/hook.min.js +0 -1
- package/lib/table/module/export/export-panel.min.js +0 -1
- package/lib/table/module/export/hook.min.js +0 -1
- package/lib/table/module/export/import-panel.min.js +0 -1
- package/lib/table/module/export/util.min.js +0 -1
- package/lib/table/module/filter/hook.min.js +0 -1
- package/lib/table/module/filter/panel.min.js +0 -1
- package/lib/table/module/keyboard/hook.min.js +0 -1
- package/lib/table/module/menu/hook.min.js +0 -1
- package/lib/table/module/menu/panel.min.js +0 -1
- package/lib/table/module/validator/hook.min.js +0 -1
- package/lib/table/render/index.min.js +0 -1
- package/lib/table/src/body.min.js +0 -1
- package/lib/table/src/cell.min.js +0 -1
- package/lib/table/src/column.min.js +0 -1
- package/lib/table/src/columnInfo.min.js +0 -1
- package/lib/table/src/emits.min.js +0 -1
- package/lib/table/src/footer.min.js +0 -1
- package/lib/table/src/group.min.js +0 -1
- package/lib/table/src/header.min.js +0 -1
- package/lib/table/src/props.min.js +0 -1
- package/lib/table/src/store.min.js +0 -1
- package/lib/table/src/table.min.js +0 -1
- package/lib/table/src/use/cell-view.min.js +0 -1
- package/lib/table/src/use/index.min.js +0 -1
- package/lib/table/src/util.min.js +0 -1
- package/lib/table/style/style.min.css +0 -1
- package/lib/toolbar/index.min.js +0 -1
- package/lib/toolbar/src/toolbar.min.js +0 -1
- package/lib/ui/index.min.js +0 -1
- package/lib/ui/src/anime.min.js +0 -1
- package/lib/ui/src/comp.min.js +0 -1
- package/lib/ui/src/dom.min.js +0 -1
- package/lib/ui/src/log.min.js +0 -1
- package/lib/ui/src/utils.min.js +0 -1
- package/lib/ui/src/vn.min.js +0 -1
- package/lib/ui/style/style.min.css +0 -0
- package/lib/v-x-e-table/index.min.js +0 -1
- package/lib/v-x-e-table/style/index.js +0 -1
- package/lib/v-x-e-table/style/style.css +0 -0
- package/lib/v-x-e-table/style/style.min.css +0 -0
- package/lib/vxe-colgroup/index.min.js +0 -1
- package/lib/vxe-colgroup/style/style.min.css +0 -0
- package/lib/vxe-column/index.min.js +0 -1
- package/lib/vxe-column/style/style.min.css +0 -0
- package/lib/vxe-grid/index.min.js +0 -1
- package/lib/vxe-table/index.min.js +0 -1
- package/lib/vxe-table/style/style.min.css +0 -1
- package/lib/vxe-toolbar/index.min.js +0 -1
- package/lib/vxe-ui/index.min.js +0 -1
- package/lib/vxe-ui/style/style.min.css +0 -0
- package/lib/vxe-v-x-e-table/index.js +0 -21
- package/lib/vxe-v-x-e-table/index.min.js +0 -1
- package/lib/vxe-v-x-e-table/style/index.js +0 -1
- package/lib/vxe-v-x-e-table/style/style.css +0 -0
- package/lib/vxe-v-x-e-table/style/style.min.css +0 -0
- /package/{es/iconfont.1792740941484.ttf → dist/iconfont.1792977622800.ttf} +0 -0
- /package/{es/iconfont.1792740941484.woff → dist/iconfont.1792977622800.woff} +0 -0
- /package/{es/iconfont.1792740941484.woff2 → dist/iconfont.1792977622800.woff2} +0 -0
- /package/es/colgroup/{style.min.css → style.mini.css} +0 -0
- /package/es/column/{style.min.css → style.mini.css} +0 -0
- /package/{lib/iconfont.1792740941484.ttf → es/iconfont.1792977622800.ttf} +0 -0
- /package/{lib/iconfont.1792740941484.woff → es/iconfont.1792977622800.woff} +0 -0
- /package/{lib/iconfont.1792740941484.woff2 → es/iconfont.1792977622800.woff2} +0 -0
- /package/es/ui/{style.min.css → style.mini.css} +0 -0
- /package/es/{v-x-e-table/style.css → vxe-colgroup/style.mini.css} +0 -0
- /package/es/{v-x-e-table/style.min.css → vxe-column/style.mini.css} +0 -0
- /package/es/{vxe-colgroup/style.min.css → vxe-ui/style.mini.css} +0 -0
- /package/{es/vxe-column/style.min.css → lib/colgroup/style/style.mini.css} +0 -0
- /package/{es/vxe-ui/style.min.css → lib/column/style/style.mini.css} +0 -0
- /package/{es/vxe-v-x-e-table/style.css → lib/ui/style/style.mini.css} +0 -0
- /package/{es/vxe-v-x-e-table/style.min.css → lib/vxe-colgroup/style/style.mini.css} +0 -0
- /package/lib/{colgroup/style/style.min.css → vxe-column/style/style.mini.css} +0 -0
- /package/lib/{column/style/style.min.css → vxe-ui/style/style.mini.css} +0 -0
|
@@ -1,1110 +1,1040 @@
|
|
|
1
|
-
import { reactive, nextTick } from
|
|
2
|
-
import XEUtils from
|
|
3
|
-
import { VxeUI } from
|
|
4
|
-
import { hasEnableConf, isEnableConf } from
|
|
5
|
-
import { getCellValue, setCellValue, getRowid } from
|
|
6
|
-
import { removeClass, addClass } from
|
|
7
|
-
import { createComponentLog } from
|
|
8
|
-
const { warnLog, errLog } = createComponentLog(
|
|
1
|
+
import { reactive, nextTick } from "vue";
|
|
2
|
+
import XEUtils from "xe-utils";
|
|
3
|
+
import { VxeUI } from "../../../ui";
|
|
4
|
+
import { hasEnableConf, isEnableConf } from "../../../ui/src/utils";
|
|
5
|
+
import { getCellValue, setCellValue, getRowid } from "../../src/util";
|
|
6
|
+
import { removeClass, addClass } from "../../../ui/src/dom";
|
|
7
|
+
import { createComponentLog } from "../../../ui/src/log";
|
|
8
|
+
const { warnLog, errLog } = createComponentLog("table");
|
|
9
9
|
const { getConfig, renderer, hooks, getI18n } = VxeUI;
|
|
10
|
-
const tableEditMethodKeys = [
|
|
11
|
-
hooks.add(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const tableEditMethodKeys = ["insert", "insertAt", "insertNextAt", "insertChild", "insertChildAt", "insertChildNextAt", "remove", "removeCheckboxRow", "removeRadioRow", "removeCurrentRow", "getRecordset", "getInsertRecords", "getRemoveRecords", "getUpdateRecords", "getEditRecord", "getActiveRecord", "getEditCell", "getSelectedCell", "clearEdit", "clearActived", "clearSelected", "isEditByRow", "isActiveByRow", "setEditRow", "setActiveRow", "setEditCell", "setActiveCell", "setSelectCell"];
|
|
11
|
+
hooks.add("tableEditModule", {
|
|
12
|
+
setupTable($xeTable) {
|
|
13
|
+
const { props, reactData, internalData } = $xeTable;
|
|
14
|
+
const { refElem } = $xeTable.getRefMaps();
|
|
15
|
+
const { computeMouseOpts, computeEditOpts, computeCheckboxOpts, computeTreeOpts, computeValidOpts, computeRendererOpts } = $xeTable.getComputeMaps();
|
|
16
|
+
const browseObj = XEUtils.browse();
|
|
17
|
+
let editMethods = {};
|
|
18
|
+
let editPrivateMethods = {};
|
|
19
|
+
const getEditColumnModel = (row, column) => {
|
|
20
|
+
const { model, editRender } = column;
|
|
21
|
+
if (editRender) {
|
|
22
|
+
model.value = getCellValue(row, column);
|
|
23
|
+
model.update = false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const setEditColumnModel = (row, column) => {
|
|
27
|
+
const { model, editRender } = column;
|
|
28
|
+
if (editRender && model.update) {
|
|
29
|
+
setCellValue(row, column, model.value);
|
|
30
|
+
model.update = false;
|
|
31
|
+
model.value = null;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const removeCellSelectedClass = () => {
|
|
35
|
+
const el = refElem.value;
|
|
36
|
+
if (el) {
|
|
37
|
+
const cell = el.querySelector(".col--selected");
|
|
38
|
+
if (cell) {
|
|
39
|
+
removeClass(cell, "col--selected");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const syncActivedCell = () => {
|
|
44
|
+
const { editStore, tableColumn } = reactData;
|
|
45
|
+
const editOpts = computeEditOpts.value;
|
|
46
|
+
const { actived } = editStore;
|
|
47
|
+
const { row, column } = actived;
|
|
48
|
+
if (row && column) {
|
|
49
|
+
if (editOpts.mode === "row") {
|
|
50
|
+
tableColumn.forEach((column2) => setEditColumnModel(row, column2));
|
|
51
|
+
} else {
|
|
52
|
+
setEditColumnModel(row, column);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const insertTreeRow = (newRecords, isAppend) => {
|
|
57
|
+
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
58
|
+
const treeOpts = computeTreeOpts.value;
|
|
59
|
+
const { rowField, parentField, mapChildrenField } = treeOpts;
|
|
60
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
61
|
+
const funcName = isAppend ? "push" : "unshift";
|
|
62
|
+
newRecords.forEach((item) => {
|
|
63
|
+
const parentRowId = item[parentField];
|
|
64
|
+
const rowid = getRowid($xeTable, item);
|
|
65
|
+
const matchObj = parentRowId ? XEUtils.findTree(tableFullTreeData, (item2) => parentRowId === item2[rowField], { children: mapChildrenField }) : null;
|
|
66
|
+
if (matchObj) {
|
|
67
|
+
const { item: parentRow } = matchObj;
|
|
68
|
+
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
|
|
69
|
+
const parentLevel = parentRest ? parentRest.level : 0;
|
|
70
|
+
let pChilds = parentRow[childrenField];
|
|
71
|
+
let pMapChilds = parentRow[mapChildrenField];
|
|
72
|
+
if (!XEUtils.isArray(pChilds)) {
|
|
73
|
+
pChilds = parentRow[childrenField] = [];
|
|
74
|
+
}
|
|
75
|
+
if (!XEUtils.isArray(pMapChilds)) {
|
|
76
|
+
pMapChilds = parentRow[mapChildrenField] = [];
|
|
77
|
+
}
|
|
78
|
+
pChilds[funcName](item);
|
|
79
|
+
pMapChilds[funcName](item);
|
|
80
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
81
|
+
fullDataRowIdData[rowid] = rest;
|
|
82
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
83
|
+
} else {
|
|
84
|
+
if (parentRowId) {
|
|
85
|
+
warnLog("vxe.error.unableInsert");
|
|
86
|
+
}
|
|
87
|
+
afterFullData[funcName](item);
|
|
88
|
+
tableFullTreeData[funcName](item);
|
|
89
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: tableFullTreeData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
90
|
+
fullDataRowIdData[rowid] = rest;
|
|
91
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const handleInsertRowAt = (records, targetRowOrRowid, isInsertNextRow) => {
|
|
96
|
+
const { treeConfig } = props;
|
|
97
|
+
const { isRowGroupStatus } = reactData;
|
|
98
|
+
const { tableFullTreeData, afterFullData, mergeBodyList, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps, removeRowMaps } = internalData;
|
|
99
|
+
const treeOpts = computeTreeOpts.value;
|
|
100
|
+
const { transform, parentField, rowField, mapChildrenField } = treeOpts;
|
|
101
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
102
|
+
if (!XEUtils.isArray(records)) {
|
|
103
|
+
records = [records];
|
|
104
|
+
}
|
|
105
|
+
let targetRow = targetRowOrRowid;
|
|
106
|
+
if (XEUtils.isString(targetRowOrRowid) || XEUtils.isNumber(targetRowOrRowid)) {
|
|
107
|
+
const rowRest = fullAllDataRowIdData[targetRowOrRowid];
|
|
108
|
+
if (rowRest) {
|
|
109
|
+
targetRow = rowRest.row;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!records.length) {
|
|
113
|
+
return Promise.resolve({ row: null, rows: [] });
|
|
114
|
+
}
|
|
115
|
+
$xeTable.handlePushStack();
|
|
116
|
+
const newRecords = reactive($xeTable.defineField(records.map((record) => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record))));
|
|
117
|
+
let treeRecords = [];
|
|
118
|
+
if (treeConfig && transform) {
|
|
119
|
+
treeRecords = XEUtils.toArrayTree(newRecords, { key: rowField, parentKey: parentField, children: childrenField });
|
|
120
|
+
}
|
|
121
|
+
if (XEUtils.eqNull(targetRow)) {
|
|
122
|
+
if (treeConfig && transform) {
|
|
123
|
+
insertTreeRow(newRecords, false);
|
|
124
|
+
} else if (isRowGroupStatus) {
|
|
125
|
+
if (treeConfig) {
|
|
126
|
+
throw new Error(getI18n("vxe.error.noTree", ["insert"]));
|
|
127
|
+
}
|
|
128
|
+
errLog(getI18n("vxe.error.noGroup", ["insert"]));
|
|
129
|
+
} else {
|
|
130
|
+
newRecords.forEach((item) => {
|
|
131
|
+
const rowid = getRowid($xeTable, item);
|
|
132
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
133
|
+
fullDataRowIdData[rowid] = rest;
|
|
134
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
135
|
+
afterFullData.unshift(item);
|
|
136
|
+
tableFullData.unshift(item);
|
|
137
|
+
});
|
|
138
|
+
mergeBodyList.forEach((mergeItem) => {
|
|
139
|
+
const { row: mergeRowIndex } = mergeItem;
|
|
140
|
+
if (mergeRowIndex >= 0) {
|
|
141
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
24
142
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const removeCellSelectedClass = () => {
|
|
35
|
-
const el = refElem.value;
|
|
36
|
-
if (el) {
|
|
37
|
-
const cell = el.querySelector('.col--selected');
|
|
38
|
-
if (cell) {
|
|
39
|
-
removeClass(cell, 'col--selected');
|
|
40
|
-
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
if (targetRow === -1) {
|
|
147
|
+
if (treeConfig && transform) {
|
|
148
|
+
insertTreeRow(newRecords, true);
|
|
149
|
+
} else if (isRowGroupStatus) {
|
|
150
|
+
if (treeConfig) {
|
|
151
|
+
throw new Error(getI18n("vxe.error.noTree", ["insert"]));
|
|
41
152
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
153
|
+
errLog(getI18n("vxe.error.noGroup", ["insert"]));
|
|
154
|
+
} else {
|
|
155
|
+
newRecords.forEach((item) => {
|
|
156
|
+
const rowid = getRowid($xeTable, item);
|
|
157
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, treeIndex: -1, _tIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
158
|
+
fullDataRowIdData[rowid] = rest;
|
|
159
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
160
|
+
afterFullData.push(item);
|
|
161
|
+
tableFullData.push(item);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
if (treeConfig && transform) {
|
|
166
|
+
const matchMapObj = XEUtils.findTree(tableFullTreeData, (item) => targetRow[rowField] === item[rowField], { children: mapChildrenField });
|
|
167
|
+
if (matchMapObj) {
|
|
168
|
+
const { parent: parentRow } = matchMapObj;
|
|
169
|
+
const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
|
|
170
|
+
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
|
|
171
|
+
const parentLevel = parentRest ? parentRest.level : 0;
|
|
172
|
+
treeRecords.forEach((row, i) => {
|
|
173
|
+
if (parentRow) {
|
|
174
|
+
if (row[parentField] !== parentRow[rowField]) {
|
|
175
|
+
errLog("vxe.error.errProp", [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
|
|
176
|
+
row[parentField] = parentRow[rowField];
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
if (row[parentField] !== null) {
|
|
180
|
+
if (!XEUtils.eqNull(row[parentField])) {
|
|
181
|
+
errLog("vxe.error.errProp", [`${parentField}=${row[parentField]}`, "null"]);
|
|
182
|
+
}
|
|
183
|
+
row[parentField] = null;
|
|
184
|
+
}
|
|
51
185
|
}
|
|
52
|
-
|
|
53
|
-
|
|
186
|
+
let targetIndex = matchMapObj.index + i;
|
|
187
|
+
if (isInsertNextRow) {
|
|
188
|
+
targetIndex = targetIndex + 1;
|
|
54
189
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const { tableFullTreeData, afterFullData, fullDataRowIdData, fullAllDataRowIdData } = internalData;
|
|
59
|
-
const treeOpts = computeTreeOpts.value;
|
|
60
|
-
const { rowField, parentField, mapChildrenField } = treeOpts;
|
|
61
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
62
|
-
const funcName = isAppend ? 'push' : 'unshift';
|
|
63
|
-
newRecords.forEach(item => {
|
|
64
|
-
const parentRowId = item[parentField];
|
|
190
|
+
parentMapChilds.splice(targetIndex, 0, row);
|
|
191
|
+
});
|
|
192
|
+
XEUtils.eachTree(treeRecords, (item) => {
|
|
65
193
|
const rowid = getRowid($xeTable, item);
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
|
|
70
|
-
const parentLevel = parentRest ? parentRest.level : 0;
|
|
71
|
-
let pChilds = parentRow[childrenField];
|
|
72
|
-
let pMapChilds = parentRow[mapChildrenField];
|
|
73
|
-
if (!XEUtils.isArray(pChilds)) {
|
|
74
|
-
pChilds = parentRow[childrenField] = [];
|
|
75
|
-
}
|
|
76
|
-
if (!XEUtils.isArray(pMapChilds)) {
|
|
77
|
-
pMapChilds = parentRow[mapChildrenField] = [];
|
|
78
|
-
}
|
|
79
|
-
pChilds[funcName](item);
|
|
80
|
-
pMapChilds[funcName](item);
|
|
81
|
-
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: pChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
82
|
-
fullDataRowIdData[rowid] = rest;
|
|
83
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
194
|
+
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
195
|
+
if (item[childrenField]) {
|
|
196
|
+
item[mapChildrenField] = item[childrenField];
|
|
84
197
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// const insertGroupRow = (newRecords: any[], isAppend: boolean) => {
|
|
98
|
-
// }
|
|
99
|
-
const handleInsertRowAt = (records, targetRowOrRowid, isInsertNextRow) => {
|
|
100
|
-
const { treeConfig } = props;
|
|
101
|
-
const { isRowGroupStatus } = reactData;
|
|
102
|
-
const { tableFullTreeData, afterFullData, mergeBodyList, tableFullData, fullDataRowIdData, fullAllDataRowIdData, insertRowMaps, removeRowMaps } = internalData;
|
|
103
|
-
const treeOpts = computeTreeOpts.value;
|
|
104
|
-
const { transform, parentField, rowField, mapChildrenField } = treeOpts;
|
|
105
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
106
|
-
if (!XEUtils.isArray(records)) {
|
|
107
|
-
records = [records];
|
|
108
|
-
}
|
|
109
|
-
let targetRow = targetRowOrRowid;
|
|
110
|
-
if (XEUtils.isString(targetRowOrRowid) || XEUtils.isNumber(targetRowOrRowid)) {
|
|
111
|
-
const rowRest = fullAllDataRowIdData[targetRowOrRowid];
|
|
112
|
-
if (rowRest) {
|
|
113
|
-
targetRow = rowRest.row;
|
|
198
|
+
fullDataRowIdData[rowid] = rest;
|
|
199
|
+
fullAllDataRowIdData[rowid] = rest;
|
|
200
|
+
}, { children: childrenField });
|
|
201
|
+
if (parentRow) {
|
|
202
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, (item) => targetRow[rowField] === item[rowField], { children: childrenField });
|
|
203
|
+
if (matchObj) {
|
|
204
|
+
const parentChilds = matchObj.items;
|
|
205
|
+
let targetIndex = matchObj.index;
|
|
206
|
+
if (isInsertNextRow) {
|
|
207
|
+
targetIndex = targetIndex + 1;
|
|
208
|
+
}
|
|
209
|
+
parentChilds.splice(targetIndex, 0, ...treeRecords);
|
|
114
210
|
}
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
warnLog("vxe.error.unableInsert");
|
|
214
|
+
insertTreeRow(newRecords, true);
|
|
115
215
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
$xeTable.handlePushStack();
|
|
120
|
-
const newRecords = reactive($xeTable.defineField(records.map((record) => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record))));
|
|
121
|
-
let treeRecords = [];
|
|
122
|
-
if (treeConfig && transform) {
|
|
123
|
-
treeRecords = XEUtils.toArrayTree(newRecords, { key: rowField, parentKey: parentField, children: childrenField });
|
|
216
|
+
} else if (isRowGroupStatus) {
|
|
217
|
+
if (treeConfig) {
|
|
218
|
+
throw new Error(getI18n("vxe.error.noTree", ["insert"]));
|
|
124
219
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
else if (isRowGroupStatus) {
|
|
131
|
-
// 如果分组
|
|
132
|
-
if (treeConfig) {
|
|
133
|
-
throw new Error(getI18n('vxe.error.noTree', ['insert']));
|
|
134
|
-
}
|
|
135
|
-
errLog(getI18n('vxe.error.noGroup', ['insert']));
|
|
136
|
-
// insertGroupRow(newRecords, false)
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
newRecords.forEach(item => {
|
|
140
|
-
const rowid = getRowid($xeTable, item);
|
|
141
|
-
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
142
|
-
fullDataRowIdData[rowid] = rest;
|
|
143
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
144
|
-
afterFullData.unshift(item);
|
|
145
|
-
tableFullData.unshift(item);
|
|
146
|
-
});
|
|
147
|
-
// 刷新单元格合并
|
|
148
|
-
mergeBodyList.forEach((mergeItem) => {
|
|
149
|
-
const { row: mergeRowIndex } = mergeItem;
|
|
150
|
-
if (mergeRowIndex >= 0) {
|
|
151
|
-
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
if (targetRow === -1) {
|
|
158
|
-
// 如果为虚拟树
|
|
159
|
-
if (treeConfig && transform) {
|
|
160
|
-
insertTreeRow(newRecords, true);
|
|
161
|
-
}
|
|
162
|
-
else if (isRowGroupStatus) {
|
|
163
|
-
// 如果分组
|
|
164
|
-
if (treeConfig) {
|
|
165
|
-
throw new Error(getI18n('vxe.error.noTree', ['insert']));
|
|
166
|
-
}
|
|
167
|
-
errLog(getI18n('vxe.error.noGroup', ['insert']));
|
|
168
|
-
// insertGroupRow(newRecords, true)
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
newRecords.forEach(item => {
|
|
172
|
-
const rowid = getRowid($xeTable, item);
|
|
173
|
-
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, treeIndex: -1, _tIndex: -1, $index: -1, items: afterFullData, parent: null, level: 0, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
174
|
-
fullDataRowIdData[rowid] = rest;
|
|
175
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
176
|
-
afterFullData.push(item);
|
|
177
|
-
tableFullData.push(item);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
// 如果为虚拟树
|
|
183
|
-
if (treeConfig && transform) {
|
|
184
|
-
const matchMapObj = XEUtils.findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], { children: mapChildrenField });
|
|
185
|
-
if (matchMapObj) {
|
|
186
|
-
const { parent: parentRow } = matchMapObj;
|
|
187
|
-
const parentMapChilds = parentRow ? parentRow[mapChildrenField] : tableFullTreeData;
|
|
188
|
-
const parentRest = fullAllDataRowIdData[getRowid($xeTable, parentRow)];
|
|
189
|
-
const parentLevel = parentRest ? parentRest.level : 0;
|
|
190
|
-
treeRecords.forEach((row, i) => {
|
|
191
|
-
if (parentRow) {
|
|
192
|
-
if (row[parentField] !== parentRow[rowField]) {
|
|
193
|
-
errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, `${parentField}=${parentRow[rowField]}`]);
|
|
194
|
-
row[parentField] = parentRow[rowField];
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
if (row[parentField] !== null) {
|
|
199
|
-
if (!XEUtils.eqNull(row[parentField])) {
|
|
200
|
-
errLog('vxe.error.errProp', [`${parentField}=${row[parentField]}`, 'null']);
|
|
201
|
-
}
|
|
202
|
-
row[parentField] = null;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
let targetIndex = matchMapObj.index + i;
|
|
206
|
-
if (isInsertNextRow) {
|
|
207
|
-
targetIndex = targetIndex + 1;
|
|
208
|
-
}
|
|
209
|
-
parentMapChilds.splice(targetIndex, 0, row);
|
|
210
|
-
});
|
|
211
|
-
XEUtils.eachTree(treeRecords, (item) => {
|
|
212
|
-
const rowid = getRowid($xeTable, item);
|
|
213
|
-
const rest = { row: item, rowid, _seq: -1, seq: -1, index: -1, _index: -1, $index: -1, treeIndex: -1, _tIndex: -1, items: parentMapChilds, parent: parentRow, level: parentLevel + 1, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 };
|
|
214
|
-
if (item[childrenField]) {
|
|
215
|
-
item[mapChildrenField] = item[childrenField];
|
|
216
|
-
}
|
|
217
|
-
fullDataRowIdData[rowid] = rest;
|
|
218
|
-
fullAllDataRowIdData[rowid] = rest;
|
|
219
|
-
}, { children: childrenField });
|
|
220
|
-
// 源
|
|
221
|
-
if (parentRow) {
|
|
222
|
-
const matchObj = XEUtils.findTree(tableFullTreeData, item => targetRow[rowField] === item[rowField], { children: childrenField });
|
|
223
|
-
if (matchObj) {
|
|
224
|
-
const parentChilds = matchObj.items;
|
|
225
|
-
let targetIndex = matchObj.index;
|
|
226
|
-
if (isInsertNextRow) {
|
|
227
|
-
targetIndex = targetIndex + 1;
|
|
228
|
-
}
|
|
229
|
-
parentChilds.splice(targetIndex, 0, ...treeRecords);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
warnLog('vxe.error.unableInsert');
|
|
235
|
-
insertTreeRow(newRecords, true);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
else if (isRowGroupStatus) {
|
|
239
|
-
// 如果分组
|
|
240
|
-
if (treeConfig) {
|
|
241
|
-
throw new Error(getI18n('vxe.error.noTree', ['insert']));
|
|
242
|
-
}
|
|
243
|
-
errLog(getI18n('vxe.error.noGroup', ['insert']));
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
if (treeConfig) {
|
|
247
|
-
throw new Error(getI18n('vxe.error.noTree', ['insert']));
|
|
248
|
-
}
|
|
249
|
-
let afIndex = -1;
|
|
250
|
-
// 如果是可视索引
|
|
251
|
-
if (XEUtils.isNumber(targetRow)) {
|
|
252
|
-
if (targetRow < afterFullData.length) {
|
|
253
|
-
afIndex = targetRow;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
afIndex = $xeTable.findRowIndexOf(afterFullData, targetRow);
|
|
258
|
-
}
|
|
259
|
-
// 如果是插入指定行的下一行
|
|
260
|
-
if (isInsertNextRow) {
|
|
261
|
-
afIndex = Math.min(afterFullData.length, afIndex + 1);
|
|
262
|
-
}
|
|
263
|
-
if (afIndex === -1) {
|
|
264
|
-
throw new Error(getI18n('vxe.error.unableInsert'));
|
|
265
|
-
}
|
|
266
|
-
afterFullData.splice(afIndex, 0, ...newRecords);
|
|
267
|
-
const tfIndex = $xeTable.findRowIndexOf(tableFullData, targetRow);
|
|
268
|
-
if (tfIndex > -1) {
|
|
269
|
-
tableFullData.splice(tfIndex + (isInsertNextRow ? 1 : 0), 0, ...newRecords);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
tableFullData.push(...newRecords);
|
|
273
|
-
}
|
|
274
|
-
// 刷新单元格合并
|
|
275
|
-
mergeBodyList.forEach((mergeItem) => {
|
|
276
|
-
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
|
|
277
|
-
if (mergeRowIndex >= afIndex) {
|
|
278
|
-
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
279
|
-
}
|
|
280
|
-
else if (isInsertNextRow ? (mergeRowIndex + mergeRowspan >= afIndex) : (mergeRowIndex + mergeRowspan > afIndex)) {
|
|
281
|
-
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
220
|
+
errLog(getI18n("vxe.error.noGroup", ["insert"]));
|
|
221
|
+
} else {
|
|
222
|
+
if (treeConfig) {
|
|
223
|
+
throw new Error(getI18n("vxe.error.noTree", ["insert"]));
|
|
286
224
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
insertRowMaps[rowid] = newRow;
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
// 如果为虚拟树
|
|
301
|
-
if (treeConfig && transform) {
|
|
302
|
-
XEUtils.eachTree(treeRecords, handleStatus, { children: mapChildrenField });
|
|
225
|
+
let afIndex = -1;
|
|
226
|
+
if (XEUtils.isNumber(targetRow)) {
|
|
227
|
+
if (targetRow < afterFullData.length) {
|
|
228
|
+
afIndex = targetRow;
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
afIndex = $xeTable.findRowIndexOf(afterFullData, targetRow);
|
|
303
232
|
}
|
|
304
|
-
|
|
305
|
-
|
|
233
|
+
if (isInsertNextRow) {
|
|
234
|
+
afIndex = Math.min(afterFullData.length, afIndex + 1);
|
|
306
235
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
$xeTable.cacheRowMap(false);
|
|
310
|
-
$xeTable.updateScrollYStatus();
|
|
311
|
-
$xeTable.handleTableData(treeConfig && transform);
|
|
312
|
-
if (!(treeConfig && transform)) {
|
|
313
|
-
$xeTable.updateAfterDataIndex();
|
|
236
|
+
if (afIndex === -1) {
|
|
237
|
+
throw new Error(getI18n("vxe.error.unableInsert"));
|
|
314
238
|
}
|
|
315
|
-
|
|
316
|
-
$xeTable.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
239
|
+
afterFullData.splice(afIndex, 0, ...newRecords);
|
|
240
|
+
const tfIndex = $xeTable.findRowIndexOf(tableFullData, targetRow);
|
|
241
|
+
if (tfIndex > -1) {
|
|
242
|
+
tableFullData.splice(tfIndex + (isInsertNextRow ? 1 : 0), 0, ...newRecords);
|
|
243
|
+
} else {
|
|
244
|
+
tableFullData.push(...newRecords);
|
|
320
245
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
};
|
|
246
|
+
mergeBodyList.forEach((mergeItem) => {
|
|
247
|
+
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
|
|
248
|
+
if (mergeRowIndex >= afIndex) {
|
|
249
|
+
mergeItem.row = mergeRowIndex + newRecords.length;
|
|
250
|
+
} else if (isInsertNextRow ? mergeRowIndex + mergeRowspan >= afIndex : mergeRowIndex + mergeRowspan > afIndex) {
|
|
251
|
+
mergeItem.rowspan = mergeRowspan + newRecords.length;
|
|
252
|
+
}
|
|
329
253
|
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
const handleStatus = (newRow) => {
|
|
258
|
+
const rowid = getRowid($xeTable, newRow);
|
|
259
|
+
if (removeRowMaps[rowid]) {
|
|
260
|
+
delete removeRowMaps[rowid];
|
|
261
|
+
if (insertRowMaps[rowid]) {
|
|
262
|
+
delete insertRowMaps[rowid];
|
|
263
|
+
}
|
|
264
|
+
} else {
|
|
265
|
+
insertRowMaps[rowid] = newRow;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
if (treeConfig && transform) {
|
|
269
|
+
XEUtils.eachTree(treeRecords, handleStatus, { children: mapChildrenField });
|
|
270
|
+
} else {
|
|
271
|
+
newRecords.forEach(handleStatus);
|
|
272
|
+
}
|
|
273
|
+
reactData.removeRowFlag++;
|
|
274
|
+
reactData.insertRowFlag++;
|
|
275
|
+
$xeTable.cacheRowMap(false, false);
|
|
276
|
+
$xeTable.updateScrollYStatus();
|
|
277
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
278
|
+
if (!(treeConfig && transform)) {
|
|
279
|
+
$xeTable.updateAfterDataIndex();
|
|
280
|
+
}
|
|
281
|
+
$xeTable.updateFooter();
|
|
282
|
+
$xeTable.handleUpdateBodyMerge();
|
|
283
|
+
$xeTable.checkSelectionStatus();
|
|
284
|
+
if (reactData.scrollYLoad) {
|
|
285
|
+
$xeTable.updateScrollYSpace();
|
|
286
|
+
}
|
|
287
|
+
return nextTick().then(() => {
|
|
288
|
+
$xeTable.updateCellAreas();
|
|
289
|
+
return $xeTable.recalculate(true);
|
|
290
|
+
}).then(() => {
|
|
291
|
+
return {
|
|
292
|
+
row: newRecords.length ? newRecords[newRecords.length - 1] : null,
|
|
293
|
+
rows: newRecords
|
|
330
294
|
};
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
295
|
+
});
|
|
296
|
+
};
|
|
297
|
+
const handleInsertChildRowAt = (records, parentRowOrParentId, targetRow, isInsertNextRow) => {
|
|
298
|
+
const { treeConfig } = props;
|
|
299
|
+
const { fullAllDataRowIdData } = internalData;
|
|
300
|
+
const treeOpts = computeTreeOpts.value;
|
|
301
|
+
const { transform, rowField, parentField } = treeOpts;
|
|
302
|
+
if (treeConfig && transform) {
|
|
303
|
+
if (!XEUtils.isArray(records)) {
|
|
304
|
+
records = [records];
|
|
305
|
+
}
|
|
306
|
+
let parentRow = parentRowOrParentId;
|
|
307
|
+
if (XEUtils.isString(parentRowOrParentId) || XEUtils.isNumber(parentRowOrParentId)) {
|
|
308
|
+
const rowRest = fullAllDataRowIdData[parentRowOrParentId];
|
|
309
|
+
if (rowRest) {
|
|
310
|
+
parentRow = rowRest.row;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return handleInsertRowAt(records.map((item) => Object.assign({}, item, { [parentField]: parentRow[rowField] })), targetRow, isInsertNextRow);
|
|
314
|
+
} else {
|
|
315
|
+
errLog("vxe.error.errProp", ["tree-config.transform=false", "tree-config.transform=true"]);
|
|
316
|
+
}
|
|
317
|
+
return Promise.resolve({ row: null, rows: [] });
|
|
318
|
+
};
|
|
319
|
+
const handleClearEdit = (evnt, targetRow) => {
|
|
320
|
+
const { editStore } = reactData;
|
|
321
|
+
const { actived, focused } = editStore;
|
|
322
|
+
const { row, column } = actived;
|
|
323
|
+
const validOpts = computeValidOpts.value;
|
|
324
|
+
if (row || column) {
|
|
325
|
+
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
326
|
+
return nextTick();
|
|
327
|
+
}
|
|
328
|
+
syncActivedCell();
|
|
329
|
+
$xeTable.updateFooter();
|
|
330
|
+
actived.args = null;
|
|
331
|
+
actived.row = null;
|
|
332
|
+
actived.column = null;
|
|
333
|
+
$xeTable.dispatchEvent("edit-closed", {
|
|
334
|
+
row,
|
|
335
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
336
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
337
|
+
column,
|
|
338
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
339
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
340
|
+
}, evnt || null);
|
|
341
|
+
}
|
|
342
|
+
focused.row = null;
|
|
343
|
+
focused.column = null;
|
|
344
|
+
if (validOpts.autoClear) {
|
|
345
|
+
if (validOpts.msgMode !== "full" || getConfig().cellVaildMode === "obsolete") {
|
|
346
|
+
if ($xeTable.clearValidate) {
|
|
347
|
+
return $xeTable.clearValidate();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return nextTick().then(() => $xeTable.updateCellAreas());
|
|
352
|
+
};
|
|
353
|
+
const handleEditActive = (params, evnt, options) => {
|
|
354
|
+
const $xeGrid = $xeTable.xeGrid;
|
|
355
|
+
const $xeGantt = $xeTable.xeGantt;
|
|
356
|
+
const { editConfig, mouseConfig } = props;
|
|
357
|
+
const { editStore, tableColumn } = reactData;
|
|
358
|
+
const editOpts = computeEditOpts.value;
|
|
359
|
+
const mouseOpts = computeMouseOpts.value;
|
|
360
|
+
const { mode } = editOpts;
|
|
361
|
+
const { actived, focused } = editStore;
|
|
362
|
+
const { row, column } = params;
|
|
363
|
+
const { editRender } = column;
|
|
364
|
+
const { isFocus, isPos, isClear } = options;
|
|
365
|
+
const cell = params.cell || $xeTable.getCellElement(row, column);
|
|
366
|
+
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
367
|
+
const editParams = { ...params, cell };
|
|
368
|
+
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
369
|
+
if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
|
|
370
|
+
if (actived.row !== row || (mode === "cell" ? actived.column !== column : false)) {
|
|
371
|
+
let type = "edit-disabled";
|
|
372
|
+
if (!beforeEditMethod || beforeEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt })) {
|
|
373
|
+
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
374
|
+
$xeTable.clearSelected();
|
|
375
|
+
if ($xeTable.clearCellAreas) {
|
|
376
|
+
$xeTable.clearCellAreas();
|
|
377
|
+
$xeTable.clearCopyCellArea();
|
|
339
378
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
379
|
+
}
|
|
380
|
+
$xeTable.closeTooltip();
|
|
381
|
+
if (actived.column) {
|
|
382
|
+
handleClearEdit(evnt);
|
|
383
|
+
}
|
|
384
|
+
type = "edit-activated";
|
|
385
|
+
column.renderHeight = cell.offsetHeight;
|
|
386
|
+
actived.args = editParams;
|
|
387
|
+
actived.row = row;
|
|
388
|
+
actived.column = column;
|
|
389
|
+
$xeTable.handlePushStack();
|
|
390
|
+
if (isClear) {
|
|
391
|
+
setCellValue(row, column, null);
|
|
392
|
+
}
|
|
393
|
+
if (mode === "row") {
|
|
394
|
+
tableColumn.forEach((column2) => getEditColumnModel(row, column2));
|
|
395
|
+
} else {
|
|
396
|
+
getEditColumnModel(row, column);
|
|
397
|
+
}
|
|
398
|
+
const afterEditMethod = editOpts.afterEditMethod;
|
|
399
|
+
nextTick(() => {
|
|
400
|
+
if (isFocus) {
|
|
401
|
+
$xeTable.handleFocus(editParams, evnt);
|
|
402
|
+
}
|
|
403
|
+
if (afterEditMethod) {
|
|
404
|
+
afterEditMethod({ ...editParams, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt });
|
|
346
405
|
}
|
|
347
|
-
|
|
406
|
+
});
|
|
348
407
|
}
|
|
349
|
-
|
|
350
|
-
|
|
408
|
+
$xeTable.dispatchEvent(type, {
|
|
409
|
+
row,
|
|
410
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
411
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
412
|
+
column,
|
|
413
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
414
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
415
|
+
}, evnt);
|
|
416
|
+
if (type === "edit-activated") {
|
|
417
|
+
$xeTable.dispatchEvent("edit-actived", {
|
|
418
|
+
row,
|
|
419
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
420
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
421
|
+
column,
|
|
422
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
423
|
+
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
424
|
+
}, evnt);
|
|
351
425
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (targetRow && getRowid($xeTable, targetRow) !== getRowid($xeTable, row)) {
|
|
361
|
-
return nextTick();
|
|
362
|
-
}
|
|
363
|
-
syncActivedCell();
|
|
364
|
-
$xeTable.updateFooter();
|
|
365
|
-
actived.args = null;
|
|
366
|
-
actived.row = null;
|
|
367
|
-
actived.column = null;
|
|
368
|
-
$xeTable.dispatchEvent('edit-closed', {
|
|
369
|
-
row,
|
|
370
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
371
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
372
|
-
column,
|
|
373
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
374
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
375
|
-
}, evnt || null);
|
|
426
|
+
} else {
|
|
427
|
+
const { column: oldColumn } = actived;
|
|
428
|
+
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
429
|
+
$xeTable.clearSelected();
|
|
430
|
+
if ($xeTable.clearCellAreas) {
|
|
431
|
+
$xeTable.clearCellAreas();
|
|
432
|
+
$xeTable.clearCopyCellArea();
|
|
433
|
+
}
|
|
376
434
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
435
|
+
if (oldColumn && oldColumn !== column) {
|
|
436
|
+
const { model: oldModel } = oldColumn;
|
|
437
|
+
if (oldModel.update) {
|
|
438
|
+
setCellValue(row, oldColumn, oldModel.value);
|
|
439
|
+
}
|
|
440
|
+
if ($xeTable.clearValidate) {
|
|
441
|
+
$xeTable.clearValidate(row, column);
|
|
442
|
+
}
|
|
385
443
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
const editOpts = computeEditOpts.value;
|
|
394
|
-
const mouseOpts = computeMouseOpts.value;
|
|
395
|
-
const { mode } = editOpts;
|
|
396
|
-
const { actived, focused } = editStore;
|
|
397
|
-
const { row, column } = params;
|
|
398
|
-
const { editRender } = column;
|
|
399
|
-
const { isFocus, isPos, isClear } = options;
|
|
400
|
-
const cell = (params.cell || $xeTable.getCellElement(row, column));
|
|
401
|
-
const beforeEditMethod = editOpts.beforeEditMethod || editOpts.activeMethod;
|
|
402
|
-
const editParams = Object.assign(Object.assign({}, params), { cell });
|
|
403
|
-
if (cell && isEnableConf(editConfig) && isEnableConf(editRender)) {
|
|
404
|
-
// 激活编辑
|
|
405
|
-
if (!$xeTable.isPendingByRow(row) && !$xeTable.isAggregateRecord(row)) {
|
|
406
|
-
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
407
|
-
// 判断是否禁用编辑
|
|
408
|
-
let type = 'edit-disabled';
|
|
409
|
-
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, editParams), { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }))) {
|
|
410
|
-
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
411
|
-
$xeTable.clearSelected();
|
|
412
|
-
if ($xeTable.clearCellAreas) {
|
|
413
|
-
$xeTable.clearCellAreas();
|
|
414
|
-
$xeTable.clearCopyCellArea();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
$xeTable.closeTooltip();
|
|
418
|
-
if (actived.column) {
|
|
419
|
-
handleClearEdit(evnt);
|
|
420
|
-
}
|
|
421
|
-
type = 'edit-activated';
|
|
422
|
-
column.renderHeight = cell.offsetHeight;
|
|
423
|
-
actived.args = editParams;
|
|
424
|
-
actived.row = row;
|
|
425
|
-
actived.column = column;
|
|
426
|
-
$xeTable.handlePushStack();
|
|
427
|
-
if (isClear) {
|
|
428
|
-
setCellValue(row, column, null);
|
|
429
|
-
}
|
|
430
|
-
if (mode === 'row') {
|
|
431
|
-
tableColumn.forEach((column) => getEditColumnModel(row, column));
|
|
432
|
-
}
|
|
433
|
-
else {
|
|
434
|
-
getEditColumnModel(row, column);
|
|
435
|
-
}
|
|
436
|
-
const afterEditMethod = editOpts.afterEditMethod;
|
|
437
|
-
nextTick(() => {
|
|
438
|
-
if (isFocus) {
|
|
439
|
-
$xeTable.handleFocus(editParams, evnt);
|
|
440
|
-
}
|
|
441
|
-
if (afterEditMethod) {
|
|
442
|
-
afterEditMethod(Object.assign(Object.assign({}, editParams), { $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }));
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
$xeTable.dispatchEvent(type, {
|
|
447
|
-
row,
|
|
448
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
449
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
450
|
-
column,
|
|
451
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
452
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
453
|
-
}, evnt);
|
|
454
|
-
// v4已废弃
|
|
455
|
-
if (type === 'edit-activated') {
|
|
456
|
-
$xeTable.dispatchEvent('edit-actived', {
|
|
457
|
-
row,
|
|
458
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
459
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
460
|
-
column,
|
|
461
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
462
|
-
$columnIndex: $xeTable.getVMColumnIndex(column)
|
|
463
|
-
}, evnt);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
467
|
-
const { column: oldColumn } = actived;
|
|
468
|
-
if (hasEnableConf(mouseConfig, mouseOpts)) {
|
|
469
|
-
$xeTable.clearSelected();
|
|
470
|
-
if ($xeTable.clearCellAreas) {
|
|
471
|
-
$xeTable.clearCellAreas();
|
|
472
|
-
$xeTable.clearCopyCellArea();
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
if (oldColumn && oldColumn !== column) {
|
|
476
|
-
const { model: oldModel } = oldColumn;
|
|
477
|
-
if (oldModel.update) {
|
|
478
|
-
setCellValue(row, oldColumn, oldModel.value);
|
|
479
|
-
}
|
|
480
|
-
if ($xeTable.clearValidate) {
|
|
481
|
-
$xeTable.clearValidate(row, column);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
column.renderHeight = cell.offsetHeight;
|
|
485
|
-
actived.args = editParams;
|
|
486
|
-
actived.column = column;
|
|
487
|
-
if (isPos) {
|
|
488
|
-
setTimeout(() => {
|
|
489
|
-
$xeTable.handleFocus(editParams, evnt);
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
focused.column = null;
|
|
494
|
-
focused.row = null;
|
|
495
|
-
$xeTable.focus();
|
|
496
|
-
}
|
|
444
|
+
column.renderHeight = cell.offsetHeight;
|
|
445
|
+
actived.args = editParams;
|
|
446
|
+
actived.column = column;
|
|
447
|
+
if (isPos) {
|
|
448
|
+
setTimeout(() => {
|
|
449
|
+
$xeTable.handleFocus(editParams, evnt);
|
|
450
|
+
});
|
|
497
451
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
452
|
+
}
|
|
453
|
+
focused.column = null;
|
|
454
|
+
focused.row = null;
|
|
455
|
+
$xeTable.focus();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return nextTick();
|
|
459
|
+
};
|
|
460
|
+
const handleEditCell = (row, fieldOrColumn, options) => {
|
|
461
|
+
const { editConfig } = props;
|
|
462
|
+
const { isPos } = options;
|
|
463
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
464
|
+
if (row && column && isEnableConf(editConfig) && isEnableConf(column.editRender) && !$xeTable.isAggregateRecord(row)) {
|
|
465
|
+
return Promise.resolve(isPos ? $xeTable.scrollToRow(row, column) : null).then(() => {
|
|
466
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
467
|
+
if (cell) {
|
|
468
|
+
handleEditActive({
|
|
469
|
+
row,
|
|
470
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
471
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
472
|
+
_rowIndex: $xeTable.getVTRowIndex(row),
|
|
473
|
+
column,
|
|
474
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
475
|
+
$columnIndex: $xeTable.getVMColumnIndex(column),
|
|
476
|
+
_columnIndex: $xeTable.getVTColumnIndex(column),
|
|
477
|
+
cell,
|
|
478
|
+
$table: $xeTable
|
|
479
|
+
}, null, {
|
|
480
|
+
isFocus: isPos,
|
|
481
|
+
isPos
|
|
482
|
+
});
|
|
483
|
+
internalData._lastCallTime = Date.now();
|
|
484
|
+
}
|
|
485
|
+
return nextTick();
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return nextTick();
|
|
489
|
+
};
|
|
490
|
+
editMethods = {
|
|
491
|
+
/**
|
|
492
|
+
* 往表格中插入临时数据
|
|
493
|
+
*
|
|
494
|
+
* @param {*} records
|
|
495
|
+
*/
|
|
496
|
+
insert(records) {
|
|
497
|
+
return handleInsertRowAt(records, null);
|
|
498
|
+
},
|
|
499
|
+
/**
|
|
500
|
+
* 往表格指定行中插入临时数据
|
|
501
|
+
* 如果 row 为空则从插入到顶部,如果为树结构,则插入到目标节点顶部
|
|
502
|
+
* 如果 row 为 -1 则从插入到底部,如果为树结构,则插入到目标节点底部
|
|
503
|
+
* 如果 row 为有效行则插入到该行的位置,如果为树结构,则有插入到效的目标节点该行的位置
|
|
504
|
+
*/
|
|
505
|
+
insertAt(records, targetRowOrRowid) {
|
|
506
|
+
return handleInsertRowAt(records, targetRowOrRowid);
|
|
507
|
+
},
|
|
508
|
+
insertNextAt(records, targetRowOrRowid) {
|
|
509
|
+
return handleInsertRowAt(records, targetRowOrRowid, true);
|
|
510
|
+
},
|
|
511
|
+
insertChild(records, parentRowOrParentId) {
|
|
512
|
+
return handleInsertChildRowAt(records, parentRowOrParentId, null);
|
|
513
|
+
},
|
|
514
|
+
insertChildAt(records, parentRowOrParentId, targetRow) {
|
|
515
|
+
return handleInsertChildRowAt(records, parentRowOrParentId, targetRow);
|
|
516
|
+
},
|
|
517
|
+
insertChildNextAt(records, parentRowOrParentId, targetRow) {
|
|
518
|
+
return handleInsertChildRowAt(records, parentRowOrParentId, targetRow, true);
|
|
519
|
+
},
|
|
520
|
+
/**
|
|
521
|
+
* 删除指定行数据
|
|
522
|
+
* 如果传 row 则删除一行
|
|
523
|
+
* 如果传 rows 则删除多行
|
|
524
|
+
* 如果为空则删除所有
|
|
525
|
+
*/
|
|
526
|
+
remove(rows) {
|
|
527
|
+
const { treeConfig } = props;
|
|
528
|
+
const { editStore, isRowGroupStatus } = reactData;
|
|
529
|
+
const { tableFullTreeData, selectCheckboxMaps, afterFullData, mergeBodyList, tableFullData, pendingRowMaps, insertRowMaps, removeRowMaps } = internalData;
|
|
530
|
+
const checkboxOpts = computeCheckboxOpts.value;
|
|
531
|
+
const treeOpts = computeTreeOpts.value;
|
|
532
|
+
const { transform, mapChildrenField } = treeOpts;
|
|
533
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
534
|
+
const { actived } = editStore;
|
|
535
|
+
const { checkField } = checkboxOpts;
|
|
536
|
+
let delList = [];
|
|
537
|
+
if (!rows) {
|
|
538
|
+
rows = tableFullData;
|
|
539
|
+
} else if (!XEUtils.isArray(rows)) {
|
|
540
|
+
rows = [rows];
|
|
541
|
+
}
|
|
542
|
+
if (!rows.length) {
|
|
543
|
+
return Promise.resolve({ row: null, rows: [] });
|
|
544
|
+
}
|
|
545
|
+
$xeTable.handlePushStack();
|
|
546
|
+
rows.forEach((row) => {
|
|
547
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
548
|
+
const rowid = getRowid($xeTable, row);
|
|
549
|
+
removeRowMaps[rowid] = row;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
if (!checkField) {
|
|
553
|
+
rows.forEach((row) => {
|
|
554
|
+
const rowid = getRowid($xeTable, row);
|
|
555
|
+
if (selectCheckboxMaps[rowid]) {
|
|
556
|
+
delete selectCheckboxMaps[rowid];
|
|
527
557
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const { transform, mapChildrenField } = treeOpts;
|
|
573
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
574
|
-
const { actived } = editStore;
|
|
575
|
-
const { checkField } = checkboxOpts;
|
|
576
|
-
let delList = [];
|
|
577
|
-
if (!rows) {
|
|
578
|
-
rows = tableFullData;
|
|
579
|
-
}
|
|
580
|
-
else if (!XEUtils.isArray(rows)) {
|
|
581
|
-
rows = [rows];
|
|
582
|
-
}
|
|
583
|
-
if (!rows.length) {
|
|
584
|
-
return Promise.resolve({ row: null, rows: [] });
|
|
585
|
-
}
|
|
586
|
-
$xeTable.handlePushStack();
|
|
587
|
-
// 如果是新增,则保存记录
|
|
588
|
-
rows.forEach((row) => {
|
|
589
|
-
if (!$xeTable.isInsertByRow(row)) {
|
|
590
|
-
const rowid = getRowid($xeTable, row);
|
|
591
|
-
removeRowMaps[rowid] = row;
|
|
592
|
-
}
|
|
593
|
-
});
|
|
594
|
-
// 如果绑定了多选属性,则更新状态
|
|
595
|
-
if (!checkField) {
|
|
596
|
-
rows.forEach((row) => {
|
|
597
|
-
const rowid = getRowid($xeTable, row);
|
|
598
|
-
if (selectCheckboxMaps[rowid]) {
|
|
599
|
-
delete selectCheckboxMaps[rowid];
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
reactData.updateCheckboxFlag++;
|
|
603
|
-
}
|
|
604
|
-
// 从数据源中移除
|
|
605
|
-
if (tableFullData === rows) {
|
|
606
|
-
rows = delList = tableFullData.slice(0);
|
|
607
|
-
internalData.tableFullData = [];
|
|
608
|
-
internalData.afterFullData = [];
|
|
609
|
-
$xeTable.clearMergeCells();
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
// 如果为虚拟树
|
|
613
|
-
if (treeConfig && transform) {
|
|
614
|
-
rows.forEach((row) => {
|
|
615
|
-
const rowid = getRowid($xeTable, row);
|
|
616
|
-
const matchMapObj = XEUtils.findTree(tableFullTreeData, item => rowid === getRowid($xeTable, item), { children: mapChildrenField });
|
|
617
|
-
if (matchMapObj) {
|
|
618
|
-
const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
|
|
619
|
-
delList.push(rItems[0]);
|
|
620
|
-
}
|
|
621
|
-
const matchObj = XEUtils.findTree(tableFullTreeData, item => rowid === getRowid($xeTable, item), { children: childrenField });
|
|
622
|
-
if (matchObj) {
|
|
623
|
-
matchObj.items.splice(matchObj.index, 1);
|
|
624
|
-
}
|
|
625
|
-
const afIndex = $xeTable.findRowIndexOf(afterFullData, row);
|
|
626
|
-
if (afIndex > -1) {
|
|
627
|
-
afterFullData.splice(afIndex, 1);
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
else if (isRowGroupStatus) {
|
|
632
|
-
// 如果分组
|
|
633
|
-
warnLog(getI18n('vxe.error.noGroup', ['remove']));
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
rows.forEach((row) => {
|
|
637
|
-
const tfIndex = $xeTable.findRowIndexOf(tableFullData, row);
|
|
638
|
-
if (tfIndex > -1) {
|
|
639
|
-
const rItems = tableFullData.splice(tfIndex, 1);
|
|
640
|
-
delList.push(rItems[0]);
|
|
641
|
-
}
|
|
642
|
-
const afIndex = $xeTable.findRowIndexOf(afterFullData, row);
|
|
643
|
-
if (afIndex > -1) {
|
|
644
|
-
// 刷新单元格合并
|
|
645
|
-
mergeBodyList.forEach((mergeItem) => {
|
|
646
|
-
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
|
|
647
|
-
if (mergeRowIndex > afIndex) {
|
|
648
|
-
mergeItem.row = mergeRowIndex - 1;
|
|
649
|
-
}
|
|
650
|
-
else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
651
|
-
mergeItem.rowspan = mergeRowspan - 1;
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
afterFullData.splice(afIndex, 1);
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
// 如果当前行被激活编辑,则清除激活状态
|
|
660
|
-
if (actived.row && $xeTable.findRowIndexOf(rows, actived.row) > -1) {
|
|
661
|
-
editMethods.clearEdit();
|
|
662
|
-
}
|
|
663
|
-
// 从新增中移除已删除的数据
|
|
664
|
-
rows.forEach((row) => {
|
|
665
|
-
const rowid = getRowid($xeTable, row);
|
|
666
|
-
if (insertRowMaps[rowid]) {
|
|
667
|
-
delete insertRowMaps[rowid];
|
|
668
|
-
}
|
|
669
|
-
if (pendingRowMaps[rowid]) {
|
|
670
|
-
delete pendingRowMaps[rowid];
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
reactData.removeRowFlag++;
|
|
674
|
-
reactData.insertRowFlag++;
|
|
675
|
-
reactData.pendingRowFlag++;
|
|
676
|
-
$xeTable.cacheRowMap(false);
|
|
677
|
-
$xeTable.handleTableData(treeConfig && transform);
|
|
678
|
-
$xeTable.updateFooter();
|
|
679
|
-
$xeTable.handleUpdateBodyMerge();
|
|
680
|
-
if (!(treeConfig && transform)) {
|
|
681
|
-
$xeTable.updateAfterDataIndex();
|
|
682
|
-
}
|
|
683
|
-
$xeTable.checkSelectionStatus();
|
|
684
|
-
if (reactData.scrollYLoad) {
|
|
685
|
-
$xeTable.updateScrollYSpace();
|
|
686
|
-
}
|
|
687
|
-
return nextTick().then(() => {
|
|
688
|
-
$xeTable.updateCellAreas();
|
|
689
|
-
return $xeTable.recalculate(true);
|
|
690
|
-
}).then(() => {
|
|
691
|
-
return { row: delList.length ? delList[delList.length - 1] : null, rows: delList };
|
|
692
|
-
});
|
|
693
|
-
},
|
|
694
|
-
/**
|
|
695
|
-
* 删除复选框选中的数据
|
|
696
|
-
*/
|
|
697
|
-
removeCheckboxRow() {
|
|
698
|
-
return editMethods.remove($xeTable.getCheckboxRecords()).then((params) => {
|
|
699
|
-
$xeTable.clearCheckboxRow();
|
|
700
|
-
return params;
|
|
701
|
-
});
|
|
702
|
-
},
|
|
703
|
-
/**
|
|
704
|
-
* 删除单选框选中的数据
|
|
705
|
-
*/
|
|
706
|
-
removeRadioRow() {
|
|
707
|
-
const radioRecord = $xeTable.getRadioRecord();
|
|
708
|
-
return editMethods.remove(radioRecord || []).then((params) => {
|
|
709
|
-
$xeTable.clearRadioRow();
|
|
710
|
-
return params;
|
|
711
|
-
});
|
|
712
|
-
},
|
|
713
|
-
/**
|
|
714
|
-
* 删除当前行选中的数据
|
|
715
|
-
*/
|
|
716
|
-
removeCurrentRow() {
|
|
717
|
-
const currentRecord = $xeTable.getCurrentRecord();
|
|
718
|
-
return editMethods.remove(currentRecord || []).then((params) => {
|
|
719
|
-
$xeTable.clearCurrentRow();
|
|
720
|
-
return params;
|
|
721
|
-
});
|
|
722
|
-
},
|
|
723
|
-
/**
|
|
724
|
-
* 获取表格数据集,包含新增、删除、修改、标记
|
|
725
|
-
*/
|
|
726
|
-
getRecordset() {
|
|
727
|
-
const removeRecords = editMethods.getRemoveRecords();
|
|
728
|
-
const pendingRecords = $xeTable.getPendingRecords();
|
|
729
|
-
const delRecords = removeRecords.concat(pendingRecords);
|
|
730
|
-
// 如果已经被删除,则无需放到更新数组
|
|
731
|
-
const updateRecords = editMethods.getUpdateRecords().filter(row => {
|
|
732
|
-
return !delRecords.some(item => $xeTable.eqRow(item, row));
|
|
733
|
-
});
|
|
734
|
-
return {
|
|
735
|
-
insertRecords: editMethods.getInsertRecords(),
|
|
736
|
-
removeRecords,
|
|
737
|
-
updateRecords,
|
|
738
|
-
pendingRecords
|
|
739
|
-
};
|
|
740
|
-
},
|
|
741
|
-
/**
|
|
742
|
-
* 获取新增的临时数据
|
|
743
|
-
*/
|
|
744
|
-
getInsertRecords() {
|
|
745
|
-
const { fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
746
|
-
const insertRecords = [];
|
|
747
|
-
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
748
|
-
if (fullAllDataRowIdData[rowid]) {
|
|
749
|
-
insertRecords.push(row);
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
return insertRecords;
|
|
753
|
-
},
|
|
754
|
-
/**
|
|
755
|
-
* 获取已删除的数据
|
|
756
|
-
*/
|
|
757
|
-
getRemoveRecords() {
|
|
758
|
-
const { removeRowMaps } = internalData;
|
|
759
|
-
const removeRecords = [];
|
|
760
|
-
XEUtils.each(removeRowMaps, (row) => {
|
|
761
|
-
removeRecords.push(row);
|
|
558
|
+
});
|
|
559
|
+
reactData.updateCheckboxFlag++;
|
|
560
|
+
}
|
|
561
|
+
if (tableFullData === rows) {
|
|
562
|
+
rows = delList = tableFullData.slice(0);
|
|
563
|
+
internalData.tableFullData = [];
|
|
564
|
+
internalData.afterFullData = [];
|
|
565
|
+
$xeTable.clearMergeCells();
|
|
566
|
+
} else {
|
|
567
|
+
if (treeConfig && transform) {
|
|
568
|
+
rows.forEach((row) => {
|
|
569
|
+
const rowid = getRowid($xeTable, row);
|
|
570
|
+
const matchMapObj = XEUtils.findTree(tableFullTreeData, (item) => rowid === getRowid($xeTable, item), { children: mapChildrenField });
|
|
571
|
+
if (matchMapObj) {
|
|
572
|
+
const rItems = matchMapObj.items.splice(matchMapObj.index, 1);
|
|
573
|
+
delList.push(rItems[0]);
|
|
574
|
+
}
|
|
575
|
+
const matchObj = XEUtils.findTree(tableFullTreeData, (item) => rowid === getRowid($xeTable, item), { children: childrenField });
|
|
576
|
+
if (matchObj) {
|
|
577
|
+
matchObj.items.splice(matchObj.index, 1);
|
|
578
|
+
}
|
|
579
|
+
const afIndex = $xeTable.findRowIndexOf(afterFullData, row);
|
|
580
|
+
if (afIndex > -1) {
|
|
581
|
+
afterFullData.splice(afIndex, 1);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
} else if (isRowGroupStatus) {
|
|
585
|
+
warnLog(getI18n("vxe.error.noGroup", ["remove"]));
|
|
586
|
+
} else {
|
|
587
|
+
rows.forEach((row) => {
|
|
588
|
+
const tfIndex = $xeTable.findRowIndexOf(tableFullData, row);
|
|
589
|
+
if (tfIndex > -1) {
|
|
590
|
+
const rItems = tableFullData.splice(tfIndex, 1);
|
|
591
|
+
delList.push(rItems[0]);
|
|
592
|
+
}
|
|
593
|
+
const afIndex = $xeTable.findRowIndexOf(afterFullData, row);
|
|
594
|
+
if (afIndex > -1) {
|
|
595
|
+
mergeBodyList.forEach((mergeItem) => {
|
|
596
|
+
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem;
|
|
597
|
+
if (mergeRowIndex > afIndex) {
|
|
598
|
+
mergeItem.row = mergeRowIndex - 1;
|
|
599
|
+
} else if (mergeRowIndex + mergeRowspan > afIndex) {
|
|
600
|
+
mergeItem.rowspan = mergeRowspan - 1;
|
|
601
|
+
}
|
|
762
602
|
});
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
return $xeTable.clearEdit(row);
|
|
846
|
-
},
|
|
847
|
-
/**
|
|
848
|
-
* 清除激活的编辑
|
|
849
|
-
*/
|
|
850
|
-
clearEdit(row) {
|
|
851
|
-
return handleClearEdit(null, row);
|
|
852
|
-
},
|
|
853
|
-
/**
|
|
854
|
-
* 清除所选中源状态
|
|
855
|
-
*/
|
|
856
|
-
clearSelected() {
|
|
857
|
-
const { editStore } = reactData;
|
|
858
|
-
const { selected } = editStore;
|
|
859
|
-
selected.row = null;
|
|
860
|
-
selected.column = null;
|
|
861
|
-
removeCellSelectedClass();
|
|
862
|
-
return nextTick();
|
|
863
|
-
},
|
|
864
|
-
isActiveByRow(row) {
|
|
865
|
-
warnLog('vxe.error.delFunc', ['isActiveByRow', 'isEditByRow']);
|
|
866
|
-
// 即将废弃
|
|
867
|
-
return $xeTable.isEditByRow(row);
|
|
868
|
-
},
|
|
869
|
-
/**
|
|
870
|
-
* 判断行是否为激活编辑状态
|
|
871
|
-
* @param {Row} row 行对象
|
|
872
|
-
*/
|
|
873
|
-
isEditByRow(row) {
|
|
874
|
-
const { editStore } = reactData;
|
|
875
|
-
return editStore.actived.row === row;
|
|
876
|
-
},
|
|
877
|
-
setActiveRow(row) {
|
|
878
|
-
warnLog('vxe.error.delFunc', ['setActiveRow', 'setEditRow']);
|
|
879
|
-
// 即将废弃
|
|
880
|
-
return editMethods.setEditRow(row);
|
|
881
|
-
},
|
|
882
|
-
/**
|
|
883
|
-
* 激活行编辑
|
|
884
|
-
*/
|
|
885
|
-
setEditRow(row, fieldOrColumn, options) {
|
|
886
|
-
const { visibleColumn } = internalData;
|
|
887
|
-
let column = XEUtils.find(visibleColumn, column => isEnableConf(column.editRender));
|
|
888
|
-
let isPos = false;
|
|
889
|
-
if (fieldOrColumn) {
|
|
890
|
-
isPos = true;
|
|
891
|
-
if (fieldOrColumn !== true) {
|
|
892
|
-
column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
return handleEditCell(row, column, Object.assign({
|
|
896
|
-
isPos,
|
|
897
|
-
isFocus: isPos
|
|
898
|
-
}, options));
|
|
899
|
-
},
|
|
900
|
-
setActiveCell(row, fieldOrColumn) {
|
|
901
|
-
warnLog('vxe.error.delFunc', ['setActiveCell', 'setEditCell']);
|
|
902
|
-
// 即将废弃
|
|
903
|
-
return editMethods.setEditCell(row, fieldOrColumn);
|
|
904
|
-
},
|
|
905
|
-
/**
|
|
906
|
-
* 激活单元格编辑
|
|
907
|
-
*/
|
|
908
|
-
setEditCell(row, fieldOrColumn, options) {
|
|
909
|
-
return handleEditCell(row, fieldOrColumn, Object.assign({
|
|
910
|
-
isFocus: true,
|
|
911
|
-
isPos: true
|
|
912
|
-
}, options));
|
|
913
|
-
},
|
|
914
|
-
/**
|
|
915
|
-
* 只对 trigger=dblclick 有效,选中单元格
|
|
916
|
-
*/
|
|
917
|
-
setSelectCell(row, fieldOrColumn) {
|
|
918
|
-
const { tableData } = reactData;
|
|
919
|
-
const editOpts = computeEditOpts.value;
|
|
920
|
-
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
921
|
-
if (row && column && editOpts.trigger !== 'manual') {
|
|
922
|
-
const rowIndex = $xeTable.findRowIndexOf(tableData, row);
|
|
923
|
-
if (rowIndex > -1 && column) {
|
|
924
|
-
const cell = $xeTable.getCellElement(row, column);
|
|
925
|
-
const params = {
|
|
926
|
-
$table: $xeTable,
|
|
927
|
-
row,
|
|
928
|
-
rowIndex,
|
|
929
|
-
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
930
|
-
_rowIndex: $xeTable.getVTRowIndex(row),
|
|
931
|
-
column,
|
|
932
|
-
columnIndex: $xeTable.getColumnIndex(column),
|
|
933
|
-
$columnIndex: $xeTable.getVMColumnIndex(column),
|
|
934
|
-
_columnIndex: $xeTable.getVTColumnIndex(column),
|
|
935
|
-
cell
|
|
936
|
-
};
|
|
937
|
-
$xeTable.handleSelected(params, null);
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
return nextTick();
|
|
941
|
-
}
|
|
603
|
+
afterFullData.splice(afIndex, 1);
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (actived.row && $xeTable.findRowIndexOf(rows, actived.row) > -1) {
|
|
609
|
+
editMethods.clearEdit();
|
|
610
|
+
}
|
|
611
|
+
rows.forEach((row) => {
|
|
612
|
+
const rowid = getRowid($xeTable, row);
|
|
613
|
+
if (insertRowMaps[rowid]) {
|
|
614
|
+
delete insertRowMaps[rowid];
|
|
615
|
+
}
|
|
616
|
+
if (pendingRowMaps[rowid]) {
|
|
617
|
+
delete pendingRowMaps[rowid];
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
reactData.removeRowFlag++;
|
|
621
|
+
reactData.insertRowFlag++;
|
|
622
|
+
reactData.pendingRowFlag++;
|
|
623
|
+
$xeTable.cacheRowMap(false, false);
|
|
624
|
+
$xeTable.handleTableData(treeConfig && transform);
|
|
625
|
+
$xeTable.updateFooter();
|
|
626
|
+
$xeTable.handleUpdateBodyMerge();
|
|
627
|
+
if (!(treeConfig && transform)) {
|
|
628
|
+
$xeTable.updateAfterDataIndex();
|
|
629
|
+
}
|
|
630
|
+
$xeTable.checkSelectionStatus();
|
|
631
|
+
if (reactData.scrollYLoad) {
|
|
632
|
+
$xeTable.updateScrollYSpace();
|
|
633
|
+
}
|
|
634
|
+
return nextTick().then(() => {
|
|
635
|
+
$xeTable.updateCellAreas();
|
|
636
|
+
return $xeTable.recalculate(true);
|
|
637
|
+
}).then(() => {
|
|
638
|
+
return { row: delList.length ? delList[delList.length - 1] : null, rows: delList };
|
|
639
|
+
});
|
|
640
|
+
},
|
|
641
|
+
/**
|
|
642
|
+
* 删除复选框选中的数据
|
|
643
|
+
*/
|
|
644
|
+
removeCheckboxRow() {
|
|
645
|
+
return editMethods.remove($xeTable.getCheckboxRecords()).then((params) => {
|
|
646
|
+
$xeTable.clearCheckboxRow();
|
|
647
|
+
return params;
|
|
648
|
+
});
|
|
649
|
+
},
|
|
650
|
+
/**
|
|
651
|
+
* 删除单选框选中的数据
|
|
652
|
+
*/
|
|
653
|
+
removeRadioRow() {
|
|
654
|
+
const radioRecord = $xeTable.getRadioRecord();
|
|
655
|
+
return editMethods.remove(radioRecord || []).then((params) => {
|
|
656
|
+
$xeTable.clearRadioRow();
|
|
657
|
+
return params;
|
|
658
|
+
});
|
|
659
|
+
},
|
|
660
|
+
/**
|
|
661
|
+
* 删除当前行选中的数据
|
|
662
|
+
*/
|
|
663
|
+
removeCurrentRow() {
|
|
664
|
+
const currentRecord = $xeTable.getCurrentRecord();
|
|
665
|
+
return editMethods.remove(currentRecord || []).then((params) => {
|
|
666
|
+
$xeTable.clearCurrentRow();
|
|
667
|
+
return params;
|
|
668
|
+
});
|
|
669
|
+
},
|
|
670
|
+
/**
|
|
671
|
+
* 获取表格数据集,包含新增、删除、修改、标记
|
|
672
|
+
*/
|
|
673
|
+
getRecordset() {
|
|
674
|
+
const removeRecords = editMethods.getRemoveRecords();
|
|
675
|
+
const pendingRecords = $xeTable.getPendingRecords();
|
|
676
|
+
const delRecords = removeRecords.concat(pendingRecords);
|
|
677
|
+
const updateRecords = editMethods.getUpdateRecords().filter((row) => {
|
|
678
|
+
return !delRecords.some((item) => $xeTable.eqRow(item, row));
|
|
679
|
+
});
|
|
680
|
+
return {
|
|
681
|
+
insertRecords: editMethods.getInsertRecords(),
|
|
682
|
+
removeRecords,
|
|
683
|
+
updateRecords,
|
|
684
|
+
pendingRecords
|
|
942
685
|
};
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
686
|
+
},
|
|
687
|
+
/**
|
|
688
|
+
* 获取新增的临时数据
|
|
689
|
+
*/
|
|
690
|
+
getInsertRecords() {
|
|
691
|
+
const { fullAllDataRowIdData, insertRowMaps } = internalData;
|
|
692
|
+
const insertRecords = [];
|
|
693
|
+
XEUtils.each(insertRowMaps, (row, rowid) => {
|
|
694
|
+
if (fullAllDataRowIdData[rowid]) {
|
|
695
|
+
insertRecords.push(row);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
return insertRecords;
|
|
699
|
+
},
|
|
700
|
+
/**
|
|
701
|
+
* 获取已删除的数据
|
|
702
|
+
*/
|
|
703
|
+
getRemoveRecords() {
|
|
704
|
+
const { removeRowMaps } = internalData;
|
|
705
|
+
const removeRecords = [];
|
|
706
|
+
XEUtils.each(removeRowMaps, (row) => {
|
|
707
|
+
removeRecords.push(row);
|
|
708
|
+
});
|
|
709
|
+
return removeRecords;
|
|
710
|
+
},
|
|
711
|
+
/**
|
|
712
|
+
* 获取更新数据
|
|
713
|
+
* 只精准匹配 row 的更改
|
|
714
|
+
* 如果是树表格,子节点更改状态不会影响父节点的更新状态
|
|
715
|
+
*/
|
|
716
|
+
getUpdateRecords() {
|
|
717
|
+
const { keepSource, treeConfig } = props;
|
|
718
|
+
const { tableFullData, tableFullTreeData } = internalData;
|
|
719
|
+
const treeOpts = computeTreeOpts.value;
|
|
720
|
+
const updateRecords = [];
|
|
721
|
+
if (keepSource) {
|
|
722
|
+
syncActivedCell();
|
|
723
|
+
if (treeConfig) {
|
|
724
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
725
|
+
XEUtils.eachTree(tableFullTreeData, (row) => {
|
|
726
|
+
if ($xeTable.isUpdateByRow(row)) {
|
|
727
|
+
updateRecords.push(row);
|
|
728
|
+
}
|
|
729
|
+
}, { children: childrenField });
|
|
730
|
+
} else {
|
|
731
|
+
tableFullData.forEach((row) => {
|
|
732
|
+
if ($xeTable.isUpdateByRow(row)) {
|
|
733
|
+
updateRecords.push(row);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return updateRecords;
|
|
739
|
+
},
|
|
740
|
+
getActiveRecord() {
|
|
741
|
+
warnLog("vxe.error.delFunc", ["getActiveRecord", "getEditCell"]);
|
|
742
|
+
const { editStore } = reactData;
|
|
743
|
+
const { fullAllDataRowIdData } = internalData;
|
|
744
|
+
const { args, row } = editStore.actived;
|
|
745
|
+
if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
|
|
746
|
+
return Object.assign({}, args, { row });
|
|
747
|
+
}
|
|
748
|
+
return null;
|
|
749
|
+
},
|
|
750
|
+
getEditRecord() {
|
|
751
|
+
warnLog("vxe.error.delFunc", ["getEditRecord", "getEditCell"]);
|
|
752
|
+
const { editStore } = reactData;
|
|
753
|
+
const { fullAllDataRowIdData } = internalData;
|
|
754
|
+
const { args, row } = editStore.actived;
|
|
755
|
+
if (args && row && fullAllDataRowIdData[getRowid($xeTable, row)]) {
|
|
756
|
+
return Object.assign({}, args, { row });
|
|
757
|
+
}
|
|
758
|
+
return null;
|
|
759
|
+
},
|
|
760
|
+
getEditCell() {
|
|
761
|
+
const { editStore } = reactData;
|
|
762
|
+
const { row, column } = editStore.actived;
|
|
763
|
+
if (column && row) {
|
|
764
|
+
return {
|
|
765
|
+
row,
|
|
766
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
767
|
+
column,
|
|
768
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
return null;
|
|
772
|
+
},
|
|
773
|
+
/**
|
|
774
|
+
* 获取选中的单元格
|
|
775
|
+
*/
|
|
776
|
+
getSelectedCell() {
|
|
777
|
+
const { editStore } = reactData;
|
|
778
|
+
const { row, column } = editStore.selected;
|
|
779
|
+
if (row && column) {
|
|
780
|
+
return {
|
|
781
|
+
row,
|
|
782
|
+
column
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
return null;
|
|
786
|
+
},
|
|
787
|
+
clearActived(row) {
|
|
788
|
+
warnLog("vxe.error.delFunc", ["clearActived", "clearEdit"]);
|
|
789
|
+
return $xeTable.clearEdit(row);
|
|
790
|
+
},
|
|
791
|
+
/**
|
|
792
|
+
* 清除激活的编辑
|
|
793
|
+
*/
|
|
794
|
+
clearEdit(row) {
|
|
795
|
+
return handleClearEdit(null, row);
|
|
796
|
+
},
|
|
797
|
+
/**
|
|
798
|
+
* 清除所选中源状态
|
|
799
|
+
*/
|
|
800
|
+
clearSelected() {
|
|
801
|
+
const { editStore } = reactData;
|
|
802
|
+
const { selected } = editStore;
|
|
803
|
+
selected.row = null;
|
|
804
|
+
selected.column = null;
|
|
805
|
+
removeCellSelectedClass();
|
|
806
|
+
return nextTick();
|
|
807
|
+
},
|
|
808
|
+
isActiveByRow(row) {
|
|
809
|
+
warnLog("vxe.error.delFunc", ["isActiveByRow", "isEditByRow"]);
|
|
810
|
+
return $xeTable.isEditByRow(row);
|
|
811
|
+
},
|
|
812
|
+
/**
|
|
813
|
+
* 判断行是否为激活编辑状态
|
|
814
|
+
* @param {Row} row 行对象
|
|
815
|
+
*/
|
|
816
|
+
isEditByRow(row) {
|
|
817
|
+
const { editStore } = reactData;
|
|
818
|
+
return editStore.actived.row === row;
|
|
819
|
+
},
|
|
820
|
+
setActiveRow(row) {
|
|
821
|
+
warnLog("vxe.error.delFunc", ["setActiveRow", "setEditRow"]);
|
|
822
|
+
return editMethods.setEditRow(row);
|
|
823
|
+
},
|
|
824
|
+
/**
|
|
825
|
+
* 激活行编辑
|
|
826
|
+
*/
|
|
827
|
+
setEditRow(row, fieldOrColumn, options) {
|
|
828
|
+
const { visibleColumn } = internalData;
|
|
829
|
+
let column = XEUtils.find(visibleColumn, (column2) => isEnableConf(column2.editRender));
|
|
830
|
+
let isPos = false;
|
|
831
|
+
if (fieldOrColumn) {
|
|
832
|
+
isPos = true;
|
|
833
|
+
if (fieldOrColumn !== true) {
|
|
834
|
+
column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return handleEditCell(row, column, Object.assign({
|
|
838
|
+
isPos,
|
|
839
|
+
isFocus: isPos
|
|
840
|
+
}, options));
|
|
841
|
+
},
|
|
842
|
+
setActiveCell(row, fieldOrColumn) {
|
|
843
|
+
warnLog("vxe.error.delFunc", ["setActiveCell", "setEditCell"]);
|
|
844
|
+
return editMethods.setEditCell(row, fieldOrColumn);
|
|
845
|
+
},
|
|
846
|
+
/**
|
|
847
|
+
* 激活单元格编辑
|
|
848
|
+
*/
|
|
849
|
+
setEditCell(row, fieldOrColumn, options) {
|
|
850
|
+
return handleEditCell(row, fieldOrColumn, Object.assign({
|
|
851
|
+
isFocus: true,
|
|
852
|
+
isPos: true
|
|
853
|
+
}, options));
|
|
854
|
+
},
|
|
855
|
+
/**
|
|
856
|
+
* 只对 trigger=dblclick 有效,选中单元格
|
|
857
|
+
*/
|
|
858
|
+
setSelectCell(row, fieldOrColumn) {
|
|
859
|
+
const { tableData } = reactData;
|
|
860
|
+
const editOpts = computeEditOpts.value;
|
|
861
|
+
const column = XEUtils.isString(fieldOrColumn) ? $xeTable.getColumnByField(fieldOrColumn) : fieldOrColumn;
|
|
862
|
+
if (row && column && editOpts.trigger !== "manual") {
|
|
863
|
+
const rowIndex = $xeTable.findRowIndexOf(tableData, row);
|
|
864
|
+
if (rowIndex > -1 && column) {
|
|
865
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
866
|
+
const params = {
|
|
867
|
+
$table: $xeTable,
|
|
868
|
+
row,
|
|
869
|
+
rowIndex,
|
|
870
|
+
$rowIndex: $xeTable.getVMRowIndex(row),
|
|
871
|
+
_rowIndex: $xeTable.getVTRowIndex(row),
|
|
872
|
+
column,
|
|
873
|
+
columnIndex: $xeTable.getColumnIndex(column),
|
|
874
|
+
$columnIndex: $xeTable.getVMColumnIndex(column),
|
|
875
|
+
_columnIndex: $xeTable.getVTColumnIndex(column),
|
|
876
|
+
cell
|
|
877
|
+
};
|
|
878
|
+
$xeTable.handleSelected(params, null);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return nextTick();
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const handleCellFocus = (cell, params) => {
|
|
885
|
+
const { editConfig } = props;
|
|
886
|
+
const { column } = params;
|
|
887
|
+
const { editRender } = column;
|
|
888
|
+
const editOpts = computeEditOpts.value;
|
|
889
|
+
if (editConfig && isEnableConf(editRender)) {
|
|
890
|
+
const rendererOpts = computeRendererOpts.value;
|
|
891
|
+
const renderName = editRender.name;
|
|
892
|
+
const compRender = renderName ? rendererOpts[renderName] || renderer.get(renderName) : null;
|
|
893
|
+
let autoFocus = editRender.autofocus || editRender.autoFocus;
|
|
894
|
+
let autoSelect = editRender.autoSelect || editRender.autoselect;
|
|
895
|
+
let inputElem = null;
|
|
896
|
+
if (editOpts.autoFocus) {
|
|
897
|
+
if (!autoFocus && compRender) {
|
|
898
|
+
autoFocus = compRender.tableAutoFocus || compRender.tableAutofocus || compRender.autofocus;
|
|
899
|
+
}
|
|
900
|
+
if (!autoSelect && compRender) {
|
|
901
|
+
autoSelect = compRender.tableAutoSelect || compRender.autoselect;
|
|
902
|
+
}
|
|
903
|
+
if (XEUtils.isFunction(autoFocus)) {
|
|
904
|
+
inputElem = autoFocus(params);
|
|
905
|
+
} else if (autoFocus) {
|
|
906
|
+
if (autoFocus === true) {
|
|
907
|
+
inputElem = cell.querySelector("input,textarea");
|
|
908
|
+
} else {
|
|
909
|
+
inputElem = cell.querySelector(autoFocus);
|
|
981
910
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
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
|
-
}, 0);
|
|
1079
|
-
}
|
|
1080
|
-
if (evnt) {
|
|
1081
|
-
$xeTable.dispatchEvent('cell-selected', params, evnt);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
return nextTick();
|
|
1086
|
-
};
|
|
1087
|
-
return selectMethod();
|
|
1088
|
-
},
|
|
1089
|
-
addCellSelectedClass() {
|
|
1090
|
-
const { editStore } = reactData;
|
|
1091
|
-
const { selected } = editStore;
|
|
1092
|
-
const { row, column } = selected;
|
|
1093
|
-
removeCellSelectedClass();
|
|
1094
|
-
if (row && column) {
|
|
1095
|
-
const cell = $xeTable.getCellElement(row, column);
|
|
1096
|
-
if (cell) {
|
|
1097
|
-
addClass(cell, 'col--selected');
|
|
911
|
+
if (inputElem) {
|
|
912
|
+
inputElem.focus();
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
return inputElem;
|
|
917
|
+
}
|
|
918
|
+
return null;
|
|
919
|
+
};
|
|
920
|
+
editPrivateMethods = {
|
|
921
|
+
/**
|
|
922
|
+
* 处理激活编辑
|
|
923
|
+
*/
|
|
924
|
+
handleEdit(params, evnt, options) {
|
|
925
|
+
return handleEditActive(params, evnt, Object.assign({
|
|
926
|
+
isFocus: true,
|
|
927
|
+
isPos: true
|
|
928
|
+
}, options));
|
|
929
|
+
},
|
|
930
|
+
/**
|
|
931
|
+
* @deprecated
|
|
932
|
+
*/
|
|
933
|
+
handleActived(params, evnt) {
|
|
934
|
+
return editPrivateMethods.handleEdit(params, evnt);
|
|
935
|
+
},
|
|
936
|
+
/**
|
|
937
|
+
* 处理取消编辑
|
|
938
|
+
* @param evnt
|
|
939
|
+
* @returns
|
|
940
|
+
*/
|
|
941
|
+
handleClearEdit,
|
|
942
|
+
handleCellFocus,
|
|
943
|
+
/**
|
|
944
|
+
* 处理聚焦
|
|
945
|
+
*/
|
|
946
|
+
handleFocus(params) {
|
|
947
|
+
const { row, column, cell } = params;
|
|
948
|
+
const { editRender } = column;
|
|
949
|
+
const editOpts = computeEditOpts.value;
|
|
950
|
+
if (isEnableConf(editRender)) {
|
|
951
|
+
const autoSelect = editRender.autoSelect || editRender.autoselect;
|
|
952
|
+
const inputElem = handleCellFocus(cell, params);
|
|
953
|
+
if (inputElem) {
|
|
954
|
+
if (autoSelect) {
|
|
955
|
+
inputElem.select();
|
|
956
|
+
} else {
|
|
957
|
+
if (browseObj.msie) {
|
|
958
|
+
const textRange = inputElem.createTextRange();
|
|
959
|
+
textRange.collapse(false);
|
|
960
|
+
textRange.select();
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
} else {
|
|
964
|
+
if (editOpts.autoPos) {
|
|
965
|
+
if (!column.fixed) {
|
|
966
|
+
$xeTable.scrollToRow(row, column);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
/**
|
|
973
|
+
* 处理选中源
|
|
974
|
+
*/
|
|
975
|
+
handleSelected(params, evnt) {
|
|
976
|
+
const { mouseConfig, editConfig } = props;
|
|
977
|
+
const { editStore } = reactData;
|
|
978
|
+
const mouseOpts = computeMouseOpts.value;
|
|
979
|
+
const editOpts = computeEditOpts.value;
|
|
980
|
+
const { actived, selected } = editStore;
|
|
981
|
+
const { row, column } = params;
|
|
982
|
+
const isMouseSelected = hasEnableConf(mouseConfig, mouseOpts) && mouseOpts.selected;
|
|
983
|
+
const selectMethod = () => {
|
|
984
|
+
if (isMouseSelected && (selected.row !== row || selected.column !== column)) {
|
|
985
|
+
if (actived.row !== row || (editOpts.mode === "cell" ? actived.column !== column : false)) {
|
|
986
|
+
handleClearEdit(evnt);
|
|
987
|
+
$xeTable.clearSelected();
|
|
988
|
+
if ($xeTable.clearCellAreas) {
|
|
989
|
+
$xeTable.clearCellAreas();
|
|
990
|
+
$xeTable.clearCopyCellArea();
|
|
991
|
+
}
|
|
992
|
+
selected.args = params;
|
|
993
|
+
selected.row = row;
|
|
994
|
+
selected.column = column;
|
|
995
|
+
if (isMouseSelected) {
|
|
996
|
+
editPrivateMethods.addCellSelectedClass();
|
|
997
|
+
}
|
|
998
|
+
$xeTable.focus();
|
|
999
|
+
if (editConfig && editOpts.isReuseKeep && isEnableConf(editOpts) && isEnableConf(column.editRender)) {
|
|
1000
|
+
setTimeout(() => {
|
|
1001
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
1002
|
+
if (cell) {
|
|
1003
|
+
const hasReusekeep = cell.querySelector(".vxe-reusekeep-control");
|
|
1004
|
+
if (hasReusekeep) {
|
|
1005
|
+
handleCellFocus(cell, params);
|
|
1098
1006
|
}
|
|
1099
|
-
|
|
1007
|
+
}
|
|
1008
|
+
}, 0);
|
|
1009
|
+
}
|
|
1010
|
+
if (evnt) {
|
|
1011
|
+
$xeTable.dispatchEvent("cell-selected", params, evnt);
|
|
1012
|
+
}
|
|
1100
1013
|
}
|
|
1014
|
+
}
|
|
1015
|
+
return nextTick();
|
|
1101
1016
|
};
|
|
1102
|
-
return
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1017
|
+
return selectMethod();
|
|
1018
|
+
},
|
|
1019
|
+
addCellSelectedClass() {
|
|
1020
|
+
const { editStore } = reactData;
|
|
1021
|
+
const { selected } = editStore;
|
|
1022
|
+
const { row, column } = selected;
|
|
1023
|
+
removeCellSelectedClass();
|
|
1024
|
+
if (row && column) {
|
|
1025
|
+
const cell = $xeTable.getCellElement(row, column);
|
|
1026
|
+
if (cell) {
|
|
1027
|
+
addClass(cell, "col--selected");
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
return { ...editMethods, ...editPrivateMethods };
|
|
1033
|
+
},
|
|
1034
|
+
setupGrid($xeGrid) {
|
|
1035
|
+
return $xeGrid.extendTableMethods(tableEditMethodKeys);
|
|
1036
|
+
},
|
|
1037
|
+
setupGantt($xeGantt) {
|
|
1038
|
+
return $xeGantt.extendTableMethods(tableEditMethodKeys);
|
|
1039
|
+
}
|
|
1110
1040
|
});
|