Table.html 3.5 KB
<div class="ant-table-wrapper">
    <es-spin spinning="{{loading}}">
        <div ng-class="'ant-table ant-table-'+state.size">
            <div class="ant-table-content">
                <table>
                    <thead class="ant-table-thead">
                        <tr>
                            <th ng-if="rowSelection" class="ant-table-selection-column">
                                <span class="ant-table-header-column">
                                    <div>
                                        <span class="ant-table-column-title">
                                            <div class="ant-table-selection">
                                                <es-checkbox on-change="handleSelectAll(event)" checked="{{state.isSelectAll}}" />
                                            </div>
                                        </span>
                                    </div>
                                </span>
                            </th>
                            <th ng-repeat="(key, column) in columns track by key" class="ant-table-cell ant-table-column-has-sorters" ng-style="{width:column.width}">
                                    <span ng-if="!column.sorter">{{column.title}}</span>
                                    <div ng-if="column.sorter" class="ant-table-column-sorters" ng-click="handleSorter(column.key)">
                                        <span class="ant-table-column-title">{{column.title}}</span>
                                        <span class="ant-table-column-sorter ant-table-column-sorter-full">
                                            <span class="ant-table-column-sorter-inner">
                                                <es-icon type="CaretUpOutlined" ng-class="'ant-table-column-sorter-up'+(state.sorter.field===column.key&&state.sorter.order==='ascend'?' active':'')"></es-icon>
                                                <es-icon type="CaretDownOutlined" ng-class="'ant-table-column-sorter-down'+(state.sorter.field===column.key&&state.sorter.order==='descend'?' active':'')"></es-icon>
                                            </span>
                                        </span>
                                    </div>
                                </th>
                        </tr>
                    </thead>
                    <tbody class="ant-table-tbody">
                        <tr ng-repeat="(key, record) in state.dataSource track by record[state.rowKey]" class="ant-table-row">
                            <td ng-if="rowSelection" class="ant-table-selection-column">
                                <span>
                                    <es-checkbox checked="record.checked" disabled="record.disabled" on-change="handleSelect(event,$index)" />
                                </span>
                            </td>
                                <td ng-repeat="(key, column) in columns track by key" data-key="{{column.key}}">
                                        <es-slot content="{{record[column.key]}}" context="esTable.getContext().$parent" />
                                    </td>
                        </tr>
                        <tr ng-if="state.dataSource.length===0" class="ant-table-placeholder">
                            <td colspan="{{columns.length}}">
                                <es-empty image="presented_image_simple"></es-empty>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </es-spin>
</div>