1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | import Component from '@ember/component'; import layout from '../templates/components/el-table'; import {computed, get, set} from "@ember/object"; // import tableStore from "../utils/table-store"; export default Component.extend({ layout, data: null, size: '', width: '', maxHeight: null, fit: true, stripe: true, border: false, rowKey: null, // string or function , context: null, showHeader: true, showSummary: false, sumText: '', summaryMethod: null, // Function rowClassName: null, // string or function cellClassName: null, // string or function cellStyle: null, // object or function headerRowCLassName: null, // string function headerRowStyle: null, //object function headerCellCLassName: null, // string function headerCellStyle: null, //object function highlightCurrentRow: true, currentRowKey: null, // string number emptyText: '', expandRowKeys: null, defaultExpandAll: false, defaultSort: null, tooltipEffect: '', spanMethod: null, // function selectOnIndeterminate: true, classNames: ['el-table'], classNameBindings: [ 'fit:el-table--fit', 'stripe:el-table--striped', 'isBorder:el-table--border', // todo: 'isHidden:el-table--hidden', // todo: 'isGroup:el-table--group', // todo: 'maxHeight:el-table--fluid-height', 'layout.scrollX:el-table--scrollable-x', // todo: 'layout.scrollY:el-table--scrollable-y', // todo: 'rowHover:el-table--enable-row-hover', // todo; 'rowTransition:el-table--enable-row-transition', // todo ], // isGroup: computed.or('border', 'isGroup'), isBorder: computed.or('border', 'isGroup'), layoutBodyWidth: computed('layout.bodyWidth', function(){ return 'width: '+ get(this,'layout.bodyWidth') ? get(this,'layout.bodyWidth') + 'px' : ''; }), init() { this._super(); // if (!get(this, 'api')) { // // let initialState = { // rowKey: this.rowKey, // defaultExpandAll: this.defaultExpandAll, // selectOnIndeterminate: this.selectOnIndeterminate // }; // const api = tableStore.create({table: this, initialState}); // set(this, 'api', api); // // } // const layout = new TableLayout({ // todo: https://github.com/ElemeFE/element/blob/9c32f55892bf15a7287a57b9ec78fe1f138ef64a/packages/table/src/table-layout.js // store, // table: this, // fit: this.fit, // showHeader: this.showHeader // }); // // copied from table.vue // set(this, 'store', store); set(this, 'isHidden', false); set(this, 'renderExpanded', null); set(this, 'resizeProxyVisible', false); set(this, 'resizeState', { width: null, height: null }); set(this, 'isGroup', false); set(this, 'scrollPosition', 'left'); // set(this, 'data', []); set(this, 'context', {}); set(this, 'expandRowKeys', []); set(this, 'defaultSort', {}); set(this, 'parent', this); }, }); |