/* * @Author: 尹成诺 * @Date: 2022-05-18 17:46:56 * @LastEditors: 尹成诺 * @LastEditTime: 2023-01-06 09:47:05 * @Description: file content */ import { App, Ref } from 'vue' import SSTable from './index.vue' import STable from '@surely-vue/table' import '@surely-vue/table/dist/index.less' import { ColumnType, TableExposeType } from '@surely-vue/table/dist/src/components/interface' export type EMITSTYPE = (event: T, ...args: any[]) => void export interface _Table { cancel: () => {} scrollTo: TableExposeType edits: Ref> add: (rowKey?: any) => {} edit: (rowKey?: any) => {} editing: (rowKey?: any) => boolean save: (rowKey?: any) => Promise } export type Table = _Table | undefined export type EmptyText = (_: any) => string | undefined export type TableColumn = ColumnType & { sortField?: string // 排序字段 emptyText?: EmptyText // 空值填充 ascendValue?: any // 升序排序字段值 descendValue?: any // 降序排序字段值 summary?: boolean // 是否计算合计字段 separate?: boolean // 是否数字千位分隔 } export type TableColumns = Array export interface Scope { text?: string value?: any record: any column: TableColumn recordIndexs: Array } export const numberToLocaleString = (number: number) => number.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 2 }) export const getElementById = (id: string) => document.getElementById(id) as HTMLElement export const error = (message: string) => { setTimeout(() => { console.clear() console.error(`%c ${message}`, 'font-size: 66px') }) throw new Error(message) } export default { install: (app: App) => { app.use(STable) app.component('SSTable', SSTable) } }