table.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _ctor = _interopRequireDefault(require("xe-utils/ctor"));
  7. var _conf = _interopRequireDefault(require("../../conf"));
  8. var _vXETable = _interopRequireDefault(require("../../v-x-e-table"));
  9. var _body = _interopRequireDefault(require("../../body"));
  10. var _tools = require("../../tools");
  11. var _methods = _interopRequireDefault(require("./methods"));
  12. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13. /**
  14. * 渲染浮固定列
  15. * 分别渲染左边固定列和右边固定列
  16. * 如果宽度足够情况下,则不需要渲染固定列
  17. * @param {Function} h 创建 VNode 函数
  18. * @param {Object} $xetable 表格实例
  19. * @param {String} fixedType 固定列类型
  20. */
  21. function renderFixed(h, $xetable, fixedType) {
  22. var tableData = $xetable.tableData,
  23. tableColumn = $xetable.tableColumn,
  24. visibleColumn = $xetable.visibleColumn,
  25. tableGroupColumn = $xetable.tableGroupColumn,
  26. isGroup = $xetable.isGroup,
  27. vSize = $xetable.vSize,
  28. showHeader = $xetable.showHeader,
  29. showFooter = $xetable.showFooter,
  30. columnStore = $xetable.columnStore,
  31. footerTableData = $xetable.footerTableData;
  32. var fixedColumn = columnStore["".concat(fixedType, "List")];
  33. return h('div', {
  34. class: "vxe-table--fixed-".concat(fixedType, "-wrapper"),
  35. ref: "".concat(fixedType, "Container")
  36. }, [showHeader ? h('vxe-table-header', {
  37. props: {
  38. fixedType: fixedType,
  39. tableData: tableData,
  40. tableColumn: tableColumn,
  41. visibleColumn: visibleColumn,
  42. tableGroupColumn: tableGroupColumn,
  43. size: vSize,
  44. fixedColumn: fixedColumn,
  45. isGroup: isGroup
  46. },
  47. ref: "".concat(fixedType, "Header")
  48. }) : null, h('vxe-table-body', {
  49. props: {
  50. fixedType: fixedType,
  51. tableData: tableData,
  52. tableColumn: tableColumn,
  53. visibleColumn: visibleColumn,
  54. fixedColumn: fixedColumn,
  55. size: vSize,
  56. isGroup: isGroup
  57. },
  58. ref: "".concat(fixedType, "Body")
  59. }), showFooter && footerTableData ? h('vxe-table-footer', {
  60. props: {
  61. footerTableData: footerTableData,
  62. tableColumn: tableColumn,
  63. visibleColumn: visibleColumn,
  64. fixedColumn: fixedColumn,
  65. fixedType: fixedType,
  66. size: vSize
  67. },
  68. ref: "".concat(fixedType, "Footer")
  69. }) : null]);
  70. }
  71. var _default2 = {
  72. name: 'VxeTable',
  73. props: {
  74. /** 基本属性 */
  75. id: String,
  76. // 数据
  77. data: Array,
  78. // (v3.0 废弃)
  79. customs: Array,
  80. // 表格的高度
  81. height: [Number, String],
  82. // 表格的最大高度
  83. maxHeight: [Number, String],
  84. // 所有列是否允许拖动列宽调整大小
  85. resizable: {
  86. type: Boolean,
  87. default: function _default() {
  88. return _conf.default.table.resizable;
  89. }
  90. },
  91. // 是否带有斑马纹
  92. stripe: {
  93. type: Boolean,
  94. default: function _default() {
  95. return _conf.default.table.stripe;
  96. }
  97. },
  98. // 是否带有边框
  99. border: {
  100. type: [Boolean, String],
  101. default: function _default() {
  102. return _conf.default.table.border;
  103. }
  104. },
  105. // 是否圆角边框
  106. round: {
  107. type: Boolean,
  108. default: function _default() {
  109. return _conf.default.table.round;
  110. }
  111. },
  112. // 表格的尺寸
  113. size: {
  114. type: String,
  115. default: function _default() {
  116. return _conf.default.table.size || _conf.default.size;
  117. }
  118. },
  119. // 列的宽度是否自撑开(可能会被废弃的参数,不要使用)
  120. fit: {
  121. type: Boolean,
  122. default: function _default() {
  123. return _conf.default.table.fit;
  124. }
  125. },
  126. // 表格是否加载中
  127. loading: Boolean,
  128. // 所有的列对其方式
  129. align: {
  130. type: String,
  131. default: function _default() {
  132. return _conf.default.table.align;
  133. }
  134. },
  135. // 所有的表头列的对齐方式
  136. headerAlign: {
  137. type: String,
  138. default: function _default() {
  139. return _conf.default.table.headerAlign;
  140. }
  141. },
  142. // 所有的表尾列的对齐方式
  143. footerAlign: {
  144. type: String,
  145. default: function _default() {
  146. return _conf.default.table.footerAlign;
  147. }
  148. },
  149. // 是否显示表头
  150. showHeader: {
  151. type: Boolean,
  152. default: function _default() {
  153. return _conf.default.table.showHeader;
  154. }
  155. },
  156. // (v3.0 废弃)
  157. startIndex: {
  158. type: Number,
  159. default: 0
  160. },
  161. // 是否要高亮当前选中行
  162. highlightCurrentRow: {
  163. type: Boolean,
  164. default: function _default() {
  165. return _conf.default.table.highlightCurrentRow;
  166. }
  167. },
  168. // 鼠标移到行是否要高亮显示
  169. highlightHoverRow: {
  170. type: Boolean,
  171. default: function _default() {
  172. return _conf.default.table.highlightHoverRow;
  173. }
  174. },
  175. // 是否要高亮当前选中列
  176. highlightCurrentColumn: {
  177. type: Boolean,
  178. default: function _default() {
  179. return _conf.default.table.highlightCurrentColumn;
  180. }
  181. },
  182. // 鼠标移到列是否要高亮显示
  183. highlightHoverColumn: {
  184. type: Boolean,
  185. default: function _default() {
  186. return _conf.default.table.highlightHoverColumn;
  187. }
  188. },
  189. // 激活单元格编辑时是否高亮显示
  190. highlightCell: Boolean,
  191. // 是否显示表尾合计
  192. showFooter: Boolean,
  193. // 表尾合计的计算方法
  194. footerMethod: {
  195. type: Function,
  196. default: _conf.default.table.footerMethod
  197. },
  198. // 给行附加 className
  199. rowClassName: [String, Function],
  200. // 给单元格附加 className
  201. cellClassName: [String, Function],
  202. // 给表头的行附加 className
  203. headerRowClassName: [String, Function],
  204. // 给表头的单元格附加 className
  205. headerCellClassName: [String, Function],
  206. // 给表尾的行附加 className
  207. footerRowClassName: [String, Function],
  208. // 给表尾的单元格附加 className
  209. footerCellClassName: [String, Function],
  210. // 给单元格附加样式
  211. cellStyle: [Object, Function],
  212. // 给表头单元格附加样式
  213. headerCellStyle: [Object, Function],
  214. // 给表尾单元格附加样式
  215. footerCellStyle: [Object, Function],
  216. // 给行附加样式
  217. rowStyle: [Object, Function],
  218. // 给表头行附加样式
  219. headerRowStyle: [Object, Function],
  220. // 给表尾行附加样式
  221. footerRowStyle: [Object, Function],
  222. // 合并指定单元格
  223. mergeCells: Array,
  224. // 合并指定的表尾数据
  225. mergeFooterItems: Array,
  226. // 自定义合并行或列的方法
  227. spanMethod: Function,
  228. // 表尾合并行或列
  229. footerSpanMethod: Function,
  230. // 设置所有内容过长时显示为省略号
  231. showOverflow: {
  232. type: [Boolean, String],
  233. default: function _default() {
  234. return _conf.default.table.showOverflow;
  235. }
  236. },
  237. // 设置表头所有内容过长时显示为省略号
  238. showHeaderOverflow: {
  239. type: [Boolean, String],
  240. default: function _default() {
  241. return _conf.default.table.showHeaderOverflow;
  242. }
  243. },
  244. // 设置表尾所有内容过长时显示为省略号
  245. showFooterOverflow: {
  246. type: [Boolean, String],
  247. default: function _default() {
  248. return _conf.default.table.showFooterOverflow;
  249. }
  250. },
  251. // 是否所有服务端筛选
  252. remoteFilter: Boolean,
  253. // 是否所有服务端排序
  254. remoteSort: Boolean,
  255. // 自定义所有列的排序方法
  256. sortMethod: Function,
  257. // 所有列宽度
  258. columnWidth: [Number, String],
  259. // 所有列最小宽度,把剩余宽度按比例分配
  260. columnMinWidth: [Number, String],
  261. /** 高级属性 */
  262. // 主键配置
  263. columnKey: Boolean,
  264. rowKey: Boolean,
  265. rowId: {
  266. type: String,
  267. default: function _default() {
  268. return _conf.default.table.rowId;
  269. }
  270. },
  271. zIndex: Number,
  272. emptyText: {
  273. type: String,
  274. default: function _default() {
  275. return _conf.default.table.emptyText;
  276. }
  277. },
  278. keepSource: {
  279. type: Boolean,
  280. default: function _default() {
  281. return _conf.default.table.keepSource;
  282. }
  283. },
  284. // 是否自动监听父容器变化去更新响应式表格宽高
  285. autoResize: {
  286. type: Boolean,
  287. default: function _default() {
  288. return _conf.default.table.autoResize;
  289. }
  290. },
  291. // 是否自动根据状态属性去更新响应式表格宽高
  292. syncResize: [Boolean, String, Number],
  293. // 设置列的默认参数,仅对部分支持的属性有效
  294. columnConfig: Object,
  295. resizableConfig: Object,
  296. // 序号配置项
  297. seqConfig: Object,
  298. // 排序配置项
  299. sortConfig: Object,
  300. // 筛选配置项
  301. filterConfig: Object,
  302. // 单选框配置
  303. radioConfig: Object,
  304. // (v3.0 废弃)
  305. selectConfig: Object,
  306. // 复选框配置项
  307. checkboxConfig: Object,
  308. // tooltip 配置项
  309. tooltipConfig: Object,
  310. // 导出配置项
  311. exportConfig: [Boolean, Object],
  312. // 导入配置项
  313. importConfig: [Boolean, Object],
  314. // 打印配置项
  315. printConfig: Object,
  316. // 展开行配置项
  317. expandConfig: Object,
  318. // 树形结构配置项
  319. treeConfig: [Boolean, Object],
  320. // 快捷菜单配置项
  321. menuConfig: [Boolean, Object],
  322. // 在 v3 中废弃
  323. contextMenu: [Boolean, Object],
  324. // 鼠标配置项
  325. mouseConfig: Object,
  326. // 区域配置项
  327. areaConfig: Object,
  328. // 按键配置项
  329. keyboardConfig: Object,
  330. // 复制/粘贴配置项
  331. clipConfig: Object,
  332. // 查找/替换配置项
  333. fnrConfig: Object,
  334. // 编辑配置项
  335. editConfig: [Boolean, Object],
  336. // 校验配置项
  337. validConfig: Object,
  338. // 校验规则配置项
  339. editRules: Object,
  340. // 空内容渲染配置项
  341. emptyRender: [Boolean, Object],
  342. // 自定义列配置项
  343. customConfig: [Boolean, Object],
  344. // 横向虚拟滚动配置项
  345. scrollX: Object,
  346. // 纵向虚拟滚动配置项
  347. scrollY: Object,
  348. // 优化相关
  349. cloak: {
  350. type: Boolean,
  351. default: function _default() {
  352. return _conf.default.table.cloak;
  353. }
  354. },
  355. animat: {
  356. type: Boolean,
  357. default: function _default() {
  358. return _conf.default.table.animat;
  359. }
  360. },
  361. delayHover: {
  362. type: Number,
  363. default: function _default() {
  364. return _conf.default.table.delayHover;
  365. }
  366. },
  367. // 优化配置项
  368. optimization: Object,
  369. // 额外的参数
  370. params: Object
  371. },
  372. components: {
  373. VxeTableBody: _body.default
  374. },
  375. provide: function provide() {
  376. return {
  377. $xetable: this,
  378. xecolgroup: null
  379. };
  380. },
  381. inject: {
  382. $xegrid: {
  383. default: null
  384. }
  385. },
  386. mixins: [],
  387. data: function data() {
  388. return {
  389. tId: "".concat(_ctor.default.uniqueId()),
  390. isCloak: false,
  391. // 列分组配置
  392. collectColumn: [],
  393. // 渲染的列分组
  394. tableGroupColumn: [],
  395. // 完整所有列
  396. tableFullColumn: [],
  397. // 渲染所有列
  398. visibleColumn: [],
  399. // 可视区渲染的列
  400. tableColumn: [],
  401. // 渲染中的数据
  402. tableData: [],
  403. // 是否启用了横向 X 可视渲染方式加载
  404. scrollXLoad: false,
  405. // 是否启用了纵向 Y 可视渲染方式加载
  406. scrollYLoad: false,
  407. // 是否存在纵向滚动条
  408. overflowY: true,
  409. // 是否存在横向滚动条
  410. overflowX: false,
  411. // 纵向滚动条的宽度
  412. scrollbarWidth: 0,
  413. // 横向滚动条的高度
  414. scrollbarHeight: 0,
  415. // 行高
  416. rowHeight: 0,
  417. // 表格父容器的高度
  418. parentHeight: 0,
  419. // 复选框属性,是否全选
  420. isAllSelected: false,
  421. // 复选框属性,有选中且非全选状态
  422. isIndeterminate: false,
  423. // 复选框属性,已选中的行
  424. selection: [],
  425. // 当前行
  426. currentRow: null,
  427. // 单选框属性,选中列
  428. currentColumn: null,
  429. // 单选框属性,选中行
  430. selectRow: null,
  431. // 表尾合计数据
  432. footerTableData: [],
  433. // 展开列信息
  434. expandColumn: null,
  435. // 树节点列信息
  436. treeNodeColumn: null,
  437. // 已展开的行
  438. rowExpandeds: [],
  439. // 懒加载中的展开行的列表
  440. expandLazyLoadeds: [],
  441. // 已展开树节点
  442. treeExpandeds: [],
  443. // 懒加载中的树节点的列表
  444. treeLazyLoadeds: [],
  445. // 树节点不确定状态的列表
  446. treeIndeterminates: [],
  447. // 合并单元格的对象集
  448. mergeList: [],
  449. // 合并表尾数据的对象集
  450. mergeFooterList: [],
  451. // 是否已经加载了筛选
  452. hasFilterPanel: false,
  453. // 当前选中的筛选列
  454. filterStore: {
  455. isAllSelected: false,
  456. isIndeterminate: false,
  457. style: null,
  458. options: [],
  459. column: null,
  460. multiple: false,
  461. visible: false
  462. },
  463. // 存放列相关的信息
  464. columnStore: {
  465. leftList: [],
  466. centerList: [],
  467. rightList: [],
  468. resizeList: [],
  469. pxList: [],
  470. pxMinList: [],
  471. scaleList: [],
  472. scaleMinList: [],
  473. autoList: []
  474. },
  475. // 存放快捷菜单的信息
  476. ctxMenuStore: {
  477. selected: null,
  478. visible: false,
  479. showChild: false,
  480. selectChild: null,
  481. list: [],
  482. style: null
  483. },
  484. // 存放可编辑相关信息
  485. editStore: {
  486. indexs: {
  487. columns: []
  488. },
  489. titles: {
  490. columns: []
  491. },
  492. // 所有选中
  493. checked: {
  494. rows: [],
  495. columns: [],
  496. tRows: [],
  497. tColumns: []
  498. },
  499. // 选中源
  500. selected: {
  501. row: null,
  502. column: null
  503. },
  504. // 已复制源
  505. copyed: {
  506. cut: false,
  507. rows: [],
  508. columns: []
  509. },
  510. // 激活
  511. actived: {
  512. row: null,
  513. column: null
  514. },
  515. insertList: [],
  516. removeList: []
  517. },
  518. // 存放数据校验相关信息
  519. validStore: {
  520. visible: false,
  521. row: null,
  522. column: null,
  523. content: '',
  524. rule: null,
  525. isArrow: false
  526. },
  527. // 导入相关信息
  528. importStore: {
  529. file: null,
  530. type: '',
  531. modeList: [],
  532. typeList: [],
  533. filename: '',
  534. visible: false
  535. },
  536. importParams: {
  537. mode: '',
  538. types: null,
  539. message: true
  540. },
  541. // 导出相关信息
  542. exportStore: {
  543. name: '',
  544. modeList: [],
  545. typeList: [],
  546. columns: [],
  547. hasFooter: false,
  548. visible: false
  549. },
  550. exportParams: {
  551. filename: '',
  552. sheetName: '',
  553. mode: '',
  554. type: '',
  555. original: false,
  556. message: true,
  557. isHeader: false,
  558. isFooter: false
  559. }
  560. };
  561. },
  562. computed: {
  563. vSize: function vSize() {
  564. return this.size || this.$parent.size || this.$parent.vSize;
  565. },
  566. validOpts: function validOpts() {
  567. return Object.assign({
  568. message: 'default'
  569. }, _conf.default.table.validConfig, this.validConfig);
  570. },
  571. sXOpts: function sXOpts() {
  572. return Object.assign({}, _conf.default.table.scrollX, this.optimizeOpts.scrollX, this.scrollX);
  573. },
  574. sYOpts: function sYOpts() {
  575. return Object.assign({}, _conf.default.table.scrollY, this.optimizeOpts.scrollY, this.scrollY);
  576. },
  577. optimizeOpts: function optimizeOpts() {
  578. return Object.assign({}, _conf.default.table.optimization, this.optimization);
  579. },
  580. rowHeightMaps: function rowHeightMaps() {
  581. return {
  582. default: 48,
  583. medium: 44,
  584. small: 40,
  585. mini: 36
  586. };
  587. },
  588. columnOpts: function columnOpts() {
  589. return Object.assign({}, this.columnConfig);
  590. },
  591. resizableOpts: function resizableOpts() {
  592. return Object.assign({}, _conf.default.table.resizableConfig, this.resizableConfig);
  593. },
  594. seqOpts: function seqOpts() {
  595. return Object.assign({
  596. startIndex: 0
  597. }, _conf.default.table.seqConfig, this.seqConfig);
  598. },
  599. radioOpts: function radioOpts() {
  600. return Object.assign({}, _conf.default.table.radioConfig, this.radioConfig);
  601. },
  602. checkboxOpts: function checkboxOpts() {
  603. return Object.assign({}, _conf.default.table.checkboxConfig, this.checkboxConfig || this.selectConfig);
  604. },
  605. tooltipOpts: function tooltipOpts() {
  606. return Object.assign({
  607. size: this.vSize,
  608. leaveDelay: 300
  609. }, _conf.default.table.tooltipConfig, this.tooltipConfig);
  610. },
  611. validTipOpts: function validTipOpts() {
  612. return Object.assign({
  613. isArrow: false
  614. }, this.tooltipOpts);
  615. },
  616. editOpts: function editOpts() {
  617. return Object.assign({}, _conf.default.table.editConfig, this.editConfig);
  618. },
  619. sortOpts: function sortOpts() {
  620. return Object.assign({
  621. orders: ['asc', 'desc', null]
  622. }, _conf.default.table.sortConfig, this.sortConfig);
  623. },
  624. filterOpts: function filterOpts() {
  625. return Object.assign({}, _conf.default.table.filterConfig, this.filterConfig);
  626. },
  627. mouseOpts: function mouseOpts() {
  628. return Object.assign({}, _conf.default.table.mouseConfig, this.mouseConfig);
  629. },
  630. areaOpts: function areaOpts() {
  631. return Object.assign({}, _conf.default.table.areaConfig, this.areaConfig);
  632. },
  633. keyboardOpts: function keyboardOpts() {
  634. return Object.assign({}, _conf.default.table.keyboardConfig, this.keyboardConfig);
  635. },
  636. clipOpts: function clipOpts() {
  637. return Object.assign({}, _conf.default.table.clipConfig, this.clipConfig);
  638. },
  639. fnrOpts: function fnrOpts() {
  640. return Object.assign({}, _conf.default.table.fnrConfig, this.fnrConfig);
  641. },
  642. // 是否使用了分组表头
  643. isGroup: function isGroup() {
  644. return this.collectColumn.some(_tools.UtilTools.hasChildrenList);
  645. },
  646. hasTip: function hasTip() {
  647. return _vXETable.default._tooltip;
  648. },
  649. isResizable: function isResizable() {
  650. return this.resizable || this.tableFullColumn.some(function (column) {
  651. return column.resizable;
  652. });
  653. },
  654. headerCtxMenu: function headerCtxMenu() {
  655. var headerOpts = this.ctxMenuOpts.header;
  656. return headerOpts && headerOpts.options ? headerOpts.options : [];
  657. },
  658. bodyCtxMenu: function bodyCtxMenu() {
  659. var bodyOpts = this.ctxMenuOpts.body;
  660. return bodyOpts && bodyOpts.options ? bodyOpts.options : [];
  661. },
  662. footerCtxMenu: function footerCtxMenu() {
  663. var footerOpts = this.ctxMenuOpts.footer;
  664. return footerOpts && footerOpts.options ? footerOpts.options : [];
  665. },
  666. isCtxMenu: function isCtxMenu() {
  667. return (this.contextMenu || this.menuConfig) && _tools.UtilTools.isEnableConf(this.ctxMenuOpts) && (this.headerCtxMenu.length || this.bodyCtxMenu.length || this.footerCtxMenu.length);
  668. },
  669. ctxMenuOpts: function ctxMenuOpts() {
  670. return Object.assign({}, _conf.default.table.contextMenu, _conf.default.table.menuConfig, this.contextMenu, this.menuConfig);
  671. },
  672. ctxMenuList: function ctxMenuList() {
  673. var rest = [];
  674. this.ctxMenuStore.list.forEach(function (list) {
  675. list.forEach(function (item) {
  676. rest.push(item);
  677. });
  678. });
  679. return rest;
  680. },
  681. exportOpts: function exportOpts() {
  682. return Object.assign({}, _conf.default.table.exportConfig, this.exportConfig);
  683. },
  684. importOpts: function importOpts() {
  685. return Object.assign({}, _conf.default.table.importConfig, this.importConfig);
  686. },
  687. printOpts: function printOpts() {
  688. return Object.assign({}, _conf.default.table.printConfig, this.printConfig);
  689. },
  690. expandOpts: function expandOpts() {
  691. return Object.assign({}, _conf.default.table.expandConfig, this.expandConfig);
  692. },
  693. treeOpts: function treeOpts() {
  694. return Object.assign({}, _conf.default.table.treeConfig, this.treeConfig);
  695. },
  696. emptyOpts: function emptyOpts() {
  697. return Object.assign({}, _conf.default.table.emptyRender, this.emptyRender);
  698. },
  699. cellOffsetWidth: function cellOffsetWidth() {
  700. return this.border ? Math.max(2, Math.ceil(this.scrollbarWidth / this.tableColumn.length)) : 1;
  701. },
  702. customOpts: function customOpts() {
  703. return Object.assign({}, _conf.default.table.customConfig, this.customConfig);
  704. },
  705. tableBorder: function tableBorder() {
  706. var border = this.border;
  707. if (border === true) {
  708. return 'full';
  709. }
  710. if (border) {
  711. return border;
  712. }
  713. return 'default';
  714. },
  715. /**
  716. * 判断列全选的复选框是否禁用
  717. */
  718. isAllCheckboxDisabled: function isAllCheckboxDisabled() {
  719. var tableFullData = this.tableFullData,
  720. treeConfig = this.treeConfig,
  721. checkboxOpts = this.checkboxOpts;
  722. var strict = checkboxOpts.strict,
  723. checkMethod = checkboxOpts.checkMethod;
  724. if (strict) {
  725. if (tableFullData.length) {
  726. if (checkMethod) {
  727. if (treeConfig) {// 暂时不支持树形结构
  728. } // 如果所有行都被禁用
  729. return tableFullData.every(function (row) {
  730. return !checkMethod({
  731. row: row
  732. });
  733. });
  734. }
  735. return false;
  736. }
  737. return true;
  738. }
  739. return false;
  740. }
  741. },
  742. watch: {
  743. data: function data(value) {
  744. var _this = this;
  745. this.loadTableData(value).then(function () {
  746. if (!_this.inited) {
  747. _this.inited = true;
  748. _this.handleDefaults();
  749. }
  750. if ((_this.scrollXLoad || _this.scrollYLoad) && _this.expandColumn) {
  751. _tools.UtilTools.warn('vxe.error.scrollErrProp', ['column.type=expand']);
  752. }
  753. });
  754. },
  755. customs: function customs(value) {
  756. if (!this.isUpdateCustoms) {
  757. this.mergeCustomColumn(value);
  758. }
  759. this.isUpdateCustoms = false;
  760. },
  761. collectColumn: function collectColumn(value) {
  762. var _this2 = this;
  763. var tableFullColumn = _tools.UtilTools.getColumnList(value);
  764. this.tableFullColumn = tableFullColumn;
  765. this.clearMergeCells();
  766. this.clearMergeFooterItems();
  767. this.cacheColumnMap();
  768. if (this.customs) {
  769. this.mergeCustomColumn(this.customs);
  770. }
  771. if (this.customConfig) {
  772. this.restoreCustomStorage();
  773. }
  774. this.refreshColumn().then(function () {
  775. if (_this2.scrollXLoad) {
  776. _this2.loadScrollXData(true);
  777. }
  778. });
  779. this.handleTableData(true);
  780. if ((this.scrollXLoad || this.scrollYLoad) && this.expandColumn) {
  781. _tools.UtilTools.warn('vxe.error.scrollErrProp', ['column.type=expand']);
  782. }
  783. if (this.isGroup && this.mouseConfig && this.mouseOpts.checked) {
  784. _tools.UtilTools.error('vxe.error.groupMouseRange', ['mouse-config.checked']);
  785. }
  786. this.$nextTick(function () {
  787. if (_this2.$toolbar) {
  788. _this2.$toolbar.syncUpdate({
  789. collectColumn: value,
  790. $table: _this2
  791. }); // 在 v3.0 中废弃 toolbar 方式
  792. if (!_this2.customConfig) {
  793. _this2.restoreCustomStorage();
  794. _this2.analyColumnWidth();
  795. _this2.refreshColumn();
  796. }
  797. }
  798. });
  799. },
  800. tableColumn: function tableColumn() {
  801. this.analyColumnWidth();
  802. },
  803. showHeader: function showHeader() {
  804. var _this3 = this;
  805. this.$nextTick(function () {
  806. _this3.recalculate(true).then(function () {
  807. return _this3.refreshScroll();
  808. });
  809. });
  810. },
  811. showFooter: function showFooter() {
  812. var _this4 = this;
  813. this.$nextTick(function () {
  814. _this4.recalculate(true).then(function () {
  815. return _this4.refreshScroll();
  816. });
  817. });
  818. },
  819. height: function height() {
  820. var _this5 = this;
  821. this.$nextTick(function () {
  822. return _this5.recalculate(true);
  823. });
  824. },
  825. maxHeight: function maxHeight() {
  826. var _this6 = this;
  827. this.$nextTick(function () {
  828. return _this6.recalculate(true);
  829. });
  830. },
  831. syncResize: function syncResize(value) {
  832. var _this7 = this;
  833. if (value) {
  834. var $el = this.$el; // 只在可视状态下才去更新
  835. if ($el.clientWidth && $el.clientHeight) {
  836. this.recalculate();
  837. }
  838. this.$nextTick(function () {
  839. setTimeout(function () {
  840. if ($el.clientWidth && $el.clientHeight) {
  841. _this7.recalculate(true);
  842. }
  843. });
  844. });
  845. }
  846. },
  847. mergeCells: function mergeCells(value) {
  848. this.clearMergeCells();
  849. this.setMergeCells(value);
  850. },
  851. mergeFooterItems: function mergeFooterItems(value) {
  852. this.clearMergeFooterItems();
  853. this.setMergeFooterItems(value);
  854. }
  855. },
  856. created: function created() {
  857. var _this8 = this;
  858. var _Object$assign = Object.assign(this, {
  859. tZindex: 0,
  860. elemStore: {},
  861. // 存放横向 X 虚拟滚动相关的信息
  862. scrollXStore: {},
  863. // 存放纵向 Y 虚拟滚动相关信息
  864. scrollYStore: {},
  865. // 存放 tooltip 相关信息
  866. tooltipStore: {},
  867. // 表格宽度
  868. tableWidth: 0,
  869. // 表格高度
  870. tableHeight: 0,
  871. // 表头高度
  872. headerHeight: 0,
  873. // 表尾高度
  874. footerHeight: 0,
  875. // 当前 hover 行
  876. // hoverRow: null,
  877. // 最后滚动位置
  878. lastScrollLeft: 0,
  879. lastScrollTop: 0,
  880. // 单选框属性,已选中保留的行
  881. radioReserveRow: null,
  882. // 复选框属性,已选中保留的行
  883. checkboxReserveRowMap: {},
  884. // 行数据,已展开保留的行
  885. rowExpandedReserveRowMap: {},
  886. // 树结构数据,已展开保留的行
  887. treeExpandedReserveRowMap: {},
  888. // 完整数据、条件处理后
  889. tableFullData: [],
  890. afterFullData: [],
  891. // 缓存数据集
  892. fullAllDataRowMap: new Map(),
  893. fullAllDataRowIdData: {},
  894. fullDataRowMap: new Map(),
  895. fullDataRowIdData: {},
  896. fullColumnMap: new Map(),
  897. fullColumnIdData: {},
  898. fullColumnFieldData: {}
  899. }),
  900. sXOpts = _Object$assign.sXOpts,
  901. scrollXStore = _Object$assign.scrollXStore,
  902. sYOpts = _Object$assign.sYOpts,
  903. scrollYStore = _Object$assign.scrollYStore,
  904. mouseOpts = _Object$assign.mouseOpts,
  905. data = _Object$assign.data,
  906. editOpts = _Object$assign.editOpts,
  907. treeOpts = _Object$assign.treeOpts,
  908. treeConfig = _Object$assign.treeConfig,
  909. showOverflow = _Object$assign.showOverflow;
  910. if (!this.rowId && (this.checkboxOpts.reserve || this.checkboxOpts.checkRowKeys || this.radioOpts.reserve || this.radioOpts.checkRowKey || this.expandOpts.expandRowKeys || this.treeOpts.expandRowKeys)) {
  911. _tools.UtilTools.warn('vxe.error.reqProp', ['row-id']);
  912. } // 在 v3.0 中废弃 column-width
  913. if (this.columnWidth) {
  914. _tools.UtilTools.warn('vxe.error.delProp', ['column-width', 'column-config.width']);
  915. } // 在 v3.0 中废弃 column-min-width
  916. if (this.columnMinWidth) {
  917. _tools.UtilTools.warn('vxe.error.delProp', ['column-min-width', 'column-config.minWidth']);
  918. } // 在 v3.0 中废弃 start-index
  919. if (this.startIndex) {
  920. _tools.UtilTools.warn('vxe.error.delProp', ['start-index', 'seq-config.startIndex']);
  921. } // 在 v3.0 中废弃 select-config
  922. if (this.selectConfig) {
  923. _tools.UtilTools.warn('vxe.error.delProp', ['select-config', 'checkbox-config']);
  924. }
  925. if (this.editConfig && editOpts.showStatus && !this.keepSource) {
  926. _tools.UtilTools.warn('vxe.error.reqProp', ['keep-source']);
  927. }
  928. if (treeConfig && treeOpts.line && (!this.rowKey || !showOverflow)) {
  929. _tools.UtilTools.warn('vxe.error.reqProp', ['row-key | show-overflow']);
  930. }
  931. if (this.showFooter && !this.footerMethod) {
  932. _tools.UtilTools.warn('vxe.error.reqProp', ['footer-method']);
  933. } // 在 v3.0 中废弃 customs
  934. if (this.customs) {
  935. _tools.UtilTools.warn('vxe.error.removeProp', ['customs']);
  936. } // 在 v3.0 中废弃 sort-method
  937. if (this.sortMethod) {
  938. _tools.UtilTools.warn('vxe.error.delProp', ['sort-method', 'sort-config.sortMethod']);
  939. } // 在 v3.0 中废弃 remote-sort
  940. if (this.remoteSort) {
  941. _tools.UtilTools.warn('vxe.error.delProp', ['remote-sort', 'sort-config.remote']);
  942. } // 在 v3.0 中废弃 remote-filter
  943. if (this.remoteFilter) {
  944. _tools.UtilTools.warn('vxe.error.delProp', ['remote-filter', 'filter-config.remote']);
  945. }
  946. if (!this.handleUpdateCellAreas) {
  947. if (this.clipConfig) {
  948. _tools.UtilTools.warn('vxe.error.notProp', ['clip-config']);
  949. }
  950. if (this.fnrConfig) {
  951. _tools.UtilTools.warn('vxe.error.notProp', ['fnr-config']);
  952. }
  953. if (this.mouseOpts.area) {
  954. _tools.UtilTools.error('vxe.error.notProp', ['mouse-config.area']);
  955. return;
  956. }
  957. }
  958. if (mouseOpts.selected && mouseOpts.area) {
  959. _tools.UtilTools.error('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected']);
  960. }
  961. if (mouseOpts.checked && mouseOpts.area) {
  962. _tools.UtilTools.error('vxe.error.errConflicts', ['mouse-config.checked', 'mouse-config.area']);
  963. } // v3 中只支持对象类型
  964. // 在 v3.0 中废弃 context-menu
  965. if (this.contextMenu) {
  966. _tools.UtilTools.warn('vxe.error.delProp', ['context-menu', 'menu-config']);
  967. if (!_ctor.default.isObject(this.contextMenu)) {
  968. _tools.UtilTools.warn('vxe.error.errProp', ["table.context-menu=".concat(this.contextMenu), 'table.context-menu={}']);
  969. }
  970. }
  971. if (this.menuConfig && !_ctor.default.isObject(this.menuConfig)) {
  972. _tools.UtilTools.warn('vxe.error.errProp', ["table.menu-config=".concat(this.menuConfig), 'table.menu-config={}']);
  973. }
  974. if (this.exportConfig && !_ctor.default.isObject(this.exportConfig)) {
  975. _tools.UtilTools.warn('vxe.error.errProp', ["table.export-config=".concat(this.exportConfig), 'table.export-config={}']);
  976. }
  977. if (this.importConfig && !_ctor.default.isObject(this.importConfig)) {
  978. _tools.UtilTools.warn('vxe.error.errProp', ["table.import-config=".concat(this.importConfig), 'table.import-config={}']);
  979. }
  980. if (this.printConfig && !_ctor.default.isObject(this.printConfig)) {
  981. _tools.UtilTools.warn('vxe.error.errProp', ["table.print-config=".concat(this.printConfig), 'table.print-config={}']);
  982. }
  983. if (this.treeConfig && !_ctor.default.isObject(this.treeConfig)) {
  984. _tools.UtilTools.warn('vxe.error.errProp', ["table.tree-config=".concat(this.treeConfig), 'table.tree-config={}']);
  985. }
  986. if (this.customConfig && !_ctor.default.isObject(this.customConfig)) {
  987. _tools.UtilTools.warn('vxe.error.errProp', ["table.custom-config=".concat(this.customConfig), 'table.custom-config={}']);
  988. }
  989. if (this.editConfig && !_ctor.default.isObject(this.editConfig)) {
  990. _tools.UtilTools.warn('vxe.error.errProp', ["table.edit-config=".concat(this.editConfig), 'table.edit-config={}']);
  991. }
  992. if (this.emptyRender && !_ctor.default.isObject(this.emptyRender)) {
  993. _tools.UtilTools.warn('vxe.error.errProp', ["table.empty-render=".concat(this.emptyRender), 'table.empty-render={}']);
  994. }
  995. if (this.mouseConfig && this.editConfig) {
  996. if (mouseOpts.checked && editOpts.trigger !== 'dblclick') {
  997. _tools.UtilTools.warn('vxe.error.errProp', ['mouse-config.checked', 'edit-config.trigger=dblclick']);
  998. }
  999. }
  1000. if (this.mouseOpts.area && this.checkboxOpts.range) {
  1001. _tools.UtilTools.error('vxe.error.errConflicts', ['mouse-config.area', 'checkbox-config.range']);
  1002. }
  1003. if (treeConfig && this.stripe) {
  1004. _tools.UtilTools.warn('vxe.error.noTree', ['stripe']);
  1005. } // 在 v3.0 中废弃 optimization
  1006. if (this.optimization) {
  1007. _tools.UtilTools.warn('vxe.error.removeProp', ['optimization']);
  1008. } // 废弃 optimization.cloak
  1009. if (this.optimizeOpts.cloak) {
  1010. _tools.UtilTools.warn('vxe.error.delProp', ['optimization.cloak', 'cloak']);
  1011. } // 废弃 optimization.animat
  1012. if (this.optimizeOpts.animat) {
  1013. _tools.UtilTools.warn('vxe.error.delProp', ['optimization.animat', 'animat']);
  1014. } // 废弃 optimization.delayHover
  1015. if (this.optimizeOpts.delayHover) {
  1016. _tools.UtilTools.warn('vxe.error.delProp', ['optimization.delayHover', 'delay-hover']);
  1017. } // 废弃 optimization.scrollX
  1018. if (this.optimizeOpts.scrollX) {
  1019. _tools.UtilTools.warn('vxe.error.delProp', ['optimization.scrollX', 'scroll-x']);
  1020. } // 废弃 optimization.scrollY
  1021. if (this.optimizeOpts.scrollY) {
  1022. _tools.UtilTools.warn('vxe.error.delProp', ['optimization.scrollY', 'scroll-y']);
  1023. }
  1024. var customOpts = this.customOpts;
  1025. if (!this.id && this.customConfig && (customOpts.storage === true || customOpts.storage && customOpts.storage.resizable || customOpts.storage && customOpts.storage.visible)) {
  1026. _tools.UtilTools.error('vxe.error.reqProp', ['id']);
  1027. }
  1028. if (this.treeConfig && this.checkboxOpts.range) {
  1029. _tools.UtilTools.error('vxe.error.noTree', ['checkbox-config.range']);
  1030. }
  1031. if (this.treeConfig && this.mouseOpts.area) {
  1032. _tools.UtilTools.error('vxe.error.noTree', ['mouse-config.area']);
  1033. } // 检查是否有安装需要的模块
  1034. var errorModuleName;
  1035. if (!_vXETable.default._edit && this.editConfig) {
  1036. errorModuleName = 'Edit';
  1037. } else if (!_vXETable.default._valid && this.editRules) {
  1038. errorModuleName = 'Validator';
  1039. } else if (!_vXETable.default._keyboard && (this.checkboxOpts.range || this.keyboardConfig || this.mouseConfig)) {
  1040. errorModuleName = 'Keyboard';
  1041. } else if (!_vXETable.default._export && (this.importConfig || this.exportConfig)) {
  1042. errorModuleName = 'Export';
  1043. }
  1044. if (errorModuleName) {
  1045. throw new Error(_tools.UtilTools.getLog('vxe.error.reqModule', [errorModuleName]));
  1046. }
  1047. Object.assign(scrollYStore, {
  1048. startIndex: 0,
  1049. visibleIndex: 0,
  1050. adaptive: sYOpts.adaptive !== false,
  1051. renderSize: _ctor.default.toNumber(sYOpts.rSize),
  1052. offsetSize: _ctor.default.toNumber(sYOpts.oSize)
  1053. });
  1054. Object.assign(scrollXStore, {
  1055. startIndex: 0,
  1056. visibleIndex: 0,
  1057. renderSize: _ctor.default.toNumber(sXOpts.rSize),
  1058. offsetSize: _ctor.default.toNumber(sXOpts.oSize)
  1059. });
  1060. if (this.cloak) {
  1061. this.isCloak = true;
  1062. setTimeout(function () {
  1063. _this8.isCloak = false;
  1064. }, _tools.DomTools.browse ? 500 : 300);
  1065. }
  1066. this.loadTableData(data).then(function () {
  1067. if (data && data.length) {
  1068. _this8.inited = true;
  1069. _this8.handleDefaults();
  1070. }
  1071. _this8.updateStyle();
  1072. _this8.recalculate();
  1073. });
  1074. _tools.GlobalEvent.on(this, 'paste', this.handleGlobalPasteEvent);
  1075. _tools.GlobalEvent.on(this, 'copy', this.handleGlobalCopyEvent);
  1076. _tools.GlobalEvent.on(this, 'cut', this.handleGlobalCutEvent);
  1077. _tools.GlobalEvent.on(this, 'mousedown', this.handleGlobalMousedownEvent);
  1078. _tools.GlobalEvent.on(this, 'blur', this.handleGlobalBlurEvent);
  1079. _tools.GlobalEvent.on(this, 'mousewheel', this.handleGlobalMousewheelEvent);
  1080. _tools.GlobalEvent.on(this, 'keydown', this.handleGlobalKeydownEvent);
  1081. _tools.GlobalEvent.on(this, 'resize', this.handleGlobalResizeEvent);
  1082. _tools.GlobalEvent.on(this, 'contextmenu', this.handleGlobalContextmenuEvent);
  1083. this.preventEvent(null, 'created');
  1084. },
  1085. mounted: function mounted() {
  1086. var _this9 = this;
  1087. var $listeners = this.$listeners;
  1088. if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
  1089. _tools.UtilTools.warn('vxe.error.reqProp', ['menu-config']);
  1090. }
  1091. if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
  1092. _tools.UtilTools.warn('vxe.error.reqProp', ['tooltip-config']);
  1093. }
  1094. if (!this.tooltipConfig && (this.$listeners['cell-mouseenter'] || this.$listeners['cell-mouseleave'])) {
  1095. _tools.UtilTools.warn('vxe.error.reqProp', ['tooltip-config']);
  1096. }
  1097. if (this.autoResize) {
  1098. var resizeObserver = new _tools.ResizeEvent(function () {
  1099. return _this9.recalculate(true);
  1100. });
  1101. resizeObserver.observe(this.$el);
  1102. resizeObserver.observe(this.getParentElem());
  1103. this.$resize = resizeObserver;
  1104. }
  1105. if (!this.$xegrid && this.customs) {
  1106. _tools.UtilTools.warn('vxe.error.removeProp', ['customs']);
  1107. }
  1108. document.body.appendChild(this.$refs.tableWrapper);
  1109. this.preventEvent(null, 'mounted');
  1110. },
  1111. activated: function activated() {
  1112. var _this10 = this;
  1113. this.recalculate().then(function () {
  1114. return _this10.refreshScroll();
  1115. });
  1116. this.preventEvent(null, 'activated');
  1117. },
  1118. deactivated: function deactivated() {
  1119. this.preventEvent(null, 'deactivated');
  1120. },
  1121. beforeDestroy: function beforeDestroy() {
  1122. var tableWrapper = this.$refs.tableWrapper;
  1123. if (tableWrapper && tableWrapper.parentNode) {
  1124. tableWrapper.parentNode.removeChild(tableWrapper);
  1125. }
  1126. if (this.$resize) {
  1127. this.$resize.disconnect();
  1128. }
  1129. this.closeFilter();
  1130. this.closeMenu();
  1131. this.preventEvent(null, 'beforeDestroy');
  1132. },
  1133. destroyed: function destroyed() {
  1134. _tools.GlobalEvent.off(this, 'paste');
  1135. _tools.GlobalEvent.off(this, 'copy');
  1136. _tools.GlobalEvent.off(this, 'cut');
  1137. _tools.GlobalEvent.off(this, 'mousedown');
  1138. _tools.GlobalEvent.off(this, 'blur');
  1139. _tools.GlobalEvent.off(this, 'mousewheel');
  1140. _tools.GlobalEvent.off(this, 'keydown');
  1141. _tools.GlobalEvent.off(this, 'resize');
  1142. _tools.GlobalEvent.off(this, 'contextmenu');
  1143. this.preventEvent(null, 'destroyed');
  1144. },
  1145. render: function render(h) {
  1146. var _e = this._e,
  1147. $scopedSlots = this.$scopedSlots,
  1148. tId = this.tId,
  1149. tableData = this.tableData,
  1150. tableColumn = this.tableColumn,
  1151. visibleColumn = this.visibleColumn,
  1152. tableGroupColumn = this.tableGroupColumn,
  1153. isGroup = this.isGroup,
  1154. isResizable = this.isResizable,
  1155. isCtxMenu = this.isCtxMenu,
  1156. loading = this.loading,
  1157. isCloak = this.isCloak,
  1158. stripe = this.stripe,
  1159. showHeader = this.showHeader,
  1160. height = this.height,
  1161. tableBorder = this.tableBorder,
  1162. treeOpts = this.treeOpts,
  1163. treeConfig = this.treeConfig,
  1164. mouseConfig = this.mouseConfig,
  1165. mouseOpts = this.mouseOpts,
  1166. vSize = this.vSize,
  1167. validOpts = this.validOpts,
  1168. editRules = this.editRules,
  1169. showFooter = this.showFooter,
  1170. overflowX = this.overflowX,
  1171. overflowY = this.overflowY,
  1172. scrollXLoad = this.scrollXLoad,
  1173. scrollYLoad = this.scrollYLoad,
  1174. scrollbarHeight = this.scrollbarHeight,
  1175. highlightCell = this.highlightCell,
  1176. highlightHoverRow = this.highlightHoverRow,
  1177. highlightHoverColumn = this.highlightHoverColumn,
  1178. editConfig = this.editConfig,
  1179. checkboxOpts = this.checkboxOpts,
  1180. validTipOpts = this.validTipOpts,
  1181. tooltipOpts = this.tooltipOpts,
  1182. columnStore = this.columnStore,
  1183. filterStore = this.filterStore,
  1184. ctxMenuStore = this.ctxMenuStore,
  1185. ctxMenuOpts = this.ctxMenuOpts,
  1186. footerTableData = this.footerTableData,
  1187. hasTip = this.hasTip,
  1188. emptyRender = this.emptyRender,
  1189. emptyOpts = this.emptyOpts;
  1190. var leftList = columnStore.leftList,
  1191. rightList = columnStore.rightList;
  1192. var emptyContent;
  1193. if ($scopedSlots.empty) {
  1194. emptyContent = $scopedSlots.empty.call(this, {
  1195. $table: this
  1196. }, h);
  1197. } else {
  1198. var compConf = emptyRender ? _vXETable.default.renderer.get(emptyOpts.name) : null;
  1199. if (compConf) {
  1200. emptyContent = compConf.renderEmpty.call(this, h, emptyOpts, {
  1201. $table: this
  1202. }, {
  1203. $table: this
  1204. });
  1205. } else {
  1206. emptyContent = this.emptyText || _conf.default.i18n('vxe.table.emptyText');
  1207. }
  1208. }
  1209. return h('div', {
  1210. class: ['vxe-table', 'vxe-table--render-default', "tid_".concat(tId), vSize ? "size--".concat(vSize) : '', "border--".concat(tableBorder), {
  1211. 'vxe-editable': !!editConfig,
  1212. 'show--head': showHeader,
  1213. 'show--foot': showFooter,
  1214. 'is--group': isGroup,
  1215. 'has--height': height,
  1216. 'has--tree-line': treeConfig && treeOpts.line,
  1217. 'fixed--left': leftList.length,
  1218. 'fixed--right': rightList.length,
  1219. 'c--highlight': highlightCell,
  1220. 't--animat': !!this.animat,
  1221. 'is--round': this.round,
  1222. 't--stripe': !treeConfig && stripe,
  1223. 't--selected': mouseConfig && mouseOpts.selected,
  1224. // 在 v3.0 中废弃 mouse-config.checked
  1225. 't--checked': mouseConfig && mouseOpts.checked,
  1226. 'is--area': mouseConfig && mouseOpts.area,
  1227. 'row--highlight': highlightHoverRow,
  1228. 'column--highlight': highlightHoverColumn,
  1229. 'is--loading': isCloak || loading,
  1230. 'is--empty': !loading && !tableData.length,
  1231. 'scroll--y': overflowY,
  1232. 'scroll--x': overflowX,
  1233. 'virtual--x': scrollXLoad,
  1234. 'virtual--y': scrollYLoad
  1235. }],
  1236. attrs: {
  1237. 'x-cloak': isCloak
  1238. }
  1239. }, [
  1240. /**
  1241. * 隐藏列
  1242. */
  1243. h('div', {
  1244. class: 'vxe-table-slots',
  1245. ref: 'hideColumn'
  1246. }, this.$slots.default), h('div', {
  1247. class: 'vxe-table--main-wrapper'
  1248. }, [
  1249. /**
  1250. * 主头部
  1251. */
  1252. showHeader ? h('vxe-table-header', {
  1253. ref: 'tableHeader',
  1254. props: {
  1255. tableData: tableData,
  1256. tableColumn: tableColumn,
  1257. visibleColumn: visibleColumn,
  1258. tableGroupColumn: tableGroupColumn,
  1259. size: vSize,
  1260. isGroup: isGroup
  1261. }
  1262. }) : _e(),
  1263. /**
  1264. * 主内容
  1265. */
  1266. h('vxe-table-body', {
  1267. ref: 'tableBody',
  1268. props: {
  1269. tableData: tableData,
  1270. tableColumn: tableColumn,
  1271. visibleColumn: visibleColumn,
  1272. size: vSize,
  1273. isGroup: isGroup
  1274. }
  1275. }),
  1276. /**
  1277. * 底部
  1278. */
  1279. showFooter ? h('vxe-table-footer', {
  1280. props: {
  1281. footerTableData: footerTableData,
  1282. tableColumn: tableColumn,
  1283. visibleColumn: visibleColumn,
  1284. size: vSize
  1285. },
  1286. ref: 'tableFooter'
  1287. }) : null]),
  1288. /**
  1289. * 左侧固定列
  1290. */
  1291. leftList && leftList.length && overflowX ? renderFixed(h, this, 'left') : _e(),
  1292. /**
  1293. * 右侧固定列
  1294. */
  1295. rightList && rightList.length && overflowX ? renderFixed(h, this, 'right') : _e(),
  1296. /**
  1297. * 空数据
  1298. */
  1299. h('div', {
  1300. ref: 'emptyPlaceholder',
  1301. class: 'vxe-table--empty-placeholder'
  1302. }, [h('div', {
  1303. class: 'vxe-table--empty-content'
  1304. }, emptyContent)]),
  1305. /**
  1306. * 边框线
  1307. */
  1308. h('div', {
  1309. class: 'vxe-table--border-line'
  1310. }),
  1311. /**
  1312. * 列宽线
  1313. */
  1314. isResizable ? h('div', {
  1315. class: 'vxe-table--resizable-bar',
  1316. style: overflowX ? {
  1317. 'padding-bottom': "".concat(scrollbarHeight, "px")
  1318. } : null,
  1319. ref: 'resizeBar'
  1320. }) : _e(),
  1321. /**
  1322. * 加载中
  1323. */
  1324. h('div', {
  1325. class: ['vxe-table--loading vxe-loading', {
  1326. 'is--visible': isCloak || loading
  1327. }]
  1328. }, [h('div', {
  1329. class: 'vxe-loading--spinner'
  1330. })]),
  1331. /**
  1332. * 筛选
  1333. */
  1334. this.hasFilterPanel ? h('vxe-table-filter', {
  1335. props: {
  1336. filterStore: filterStore
  1337. },
  1338. ref: 'filterWrapper'
  1339. }) : _e(),
  1340. /**
  1341. * 导入
  1342. */
  1343. this.importConfig ? h('vxe-import-panel', {
  1344. props: {
  1345. defaultOptions: this.importParams,
  1346. storeData: this.importStore
  1347. }
  1348. }) : _e(),
  1349. /**
  1350. * 导出/打印
  1351. */
  1352. this.exportConfig || this.printConfig ? h('vxe-export-panel', {
  1353. props: {
  1354. defaultOptions: this.exportParams,
  1355. storeData: this.exportStore
  1356. }
  1357. }) : _e(), h('div', {
  1358. class: "vxe-table".concat(tId, "-wrapper ").concat(this.$vnode.data.staticClass || ''),
  1359. ref: 'tableWrapper'
  1360. }, [
  1361. /**
  1362. * 复选框-范围选择
  1363. */
  1364. checkboxOpts.range ? h('div', {
  1365. class: 'vxe-table--checkbox-range',
  1366. ref: 'checkboxRange'
  1367. }) : _e(),
  1368. /**
  1369. * 快捷菜单
  1370. */
  1371. isCtxMenu ? h('vxe-table-context-menu', {
  1372. props: {
  1373. ctxMenuStore: ctxMenuStore,
  1374. ctxMenuOpts: ctxMenuOpts
  1375. },
  1376. ref: 'ctxWrapper'
  1377. }) : _e(),
  1378. /**
  1379. * 公用提示
  1380. */
  1381. hasTip ? h('vxe-tooltip', {
  1382. key: 'cTip',
  1383. ref: 'commTip',
  1384. props: {
  1385. isArrow: false,
  1386. enterable: false
  1387. }
  1388. }) : _e(),
  1389. /**
  1390. * 单元格溢出的提示
  1391. */
  1392. hasTip ? h('vxe-tooltip', {
  1393. ref: 'tooltip',
  1394. props: tooltipOpts,
  1395. on: tooltipOpts.enterable ? {
  1396. leave: this.handleTooltipLeaveEvent
  1397. } : null
  1398. }) : _e(),
  1399. /**
  1400. * 单元格校验不通过的提示
  1401. * 仅用于一行数据时有效,多行数据使用内部的提示框
  1402. */
  1403. hasTip && editRules && validOpts.showMessage && (validOpts.message === 'default' ? !height : validOpts.message === 'tooltip') ? h('vxe-tooltip', {
  1404. class: 'vxe-table--valid-error',
  1405. props: validOpts.message === 'tooltip' || tableData.length === 1 ? validTipOpts : null,
  1406. ref: 'validTip'
  1407. }) : _e()])]);
  1408. },
  1409. methods: _methods.default
  1410. };
  1411. exports.default = _default2;