fix
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,8 @@
|
||||
.DS_Store
|
||||
.history
|
||||
node_modules
|
||||
/lib_temp
|
||||
/packages_temp
|
||||
/dist
|
||||
/es
|
||||
/lib
|
||||
|
||||
@@ -24,6 +24,7 @@ A [vue](https://www.npmjs.com/package/vue) based PC form component, support add
|
||||
* [x] ~~v2.0 Based on vue2.6, Support for all major browsers.~~
|
||||
* [x] v3.0 Based on vue2.6, supports modern browsers and retains compatibility with IE11.
|
||||
* [x] v4.0 Based on vue3.x, Only support modern browser, not IE.
|
||||
* [x] v4.7 Based on vue3.x, refactor the components, split the excess components, and keep only the table.
|
||||
|
||||
## Browser Support
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* [x] ~~v2.0 基于 vue2.6,支持所有主流的浏览器,同时兼具功能与性能~~
|
||||
* [x] v3.0 基于 vue2.6,支持现代浏览器并保留兼容 IE11
|
||||
* [x] v4.0 基于 vue3.x,只支持现代浏览器,不支持 IE
|
||||
* [x] v4.7 基于 vue3.x,重构组件,拆分多余组件,只保留表格
|
||||
* [ ] 下一阶段:sticky 渲染模式、将虚拟滚动提升到极致、虚拟滚动动态行高、数据图表可视化
|
||||
|
||||
## 浏览器支持
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
* [x] ~~v1.0 基於 vue2.6,支持所有主流的瀏覽器,實現表格的一切實用的功能~~
|
||||
* [x] ~~v2.0 基於 vue2.6,支持所有主流的瀏覽器,同時兼具功能與效能~~
|
||||
* [x] v3.0 基於 vue2.6,支持現代瀏覽器並保留相容IE11
|
||||
* [x] v4.0 基于 vue3.x,只支持現代瀏覽器,不支持IE
|
||||
* [x] v4.0 基於 vue3.x,只支持現代瀏覽器,不支持IE
|
||||
* [x] v4.7 基於 vue3.x,重構組件,拆分多餘組件,只保留表格
|
||||
|
||||
## 瀏覽器支持
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vxe-table",
|
||||
"version": "4.6.16",
|
||||
"version": "4.6.17-beta.0",
|
||||
"description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、列拖拽,懒加载、快捷菜单、数据校验、树形结构、打印导出、自定义模板、渲染器、JSON 配置式...",
|
||||
"scripts": {
|
||||
"update": "npm install --legacy-peer-deps",
|
||||
|
||||
@@ -96,7 +96,7 @@ export function install (app: App, options: any) {
|
||||
if (XEUtils.isPlainObject(options)) {
|
||||
setConfig(options)
|
||||
if ((options as any).theme) {
|
||||
setTheme(options)
|
||||
setTheme((options as any).theme)
|
||||
}
|
||||
}
|
||||
components.forEach(component => component.install(app))
|
||||
|
||||
@@ -3181,8 +3181,14 @@ export default defineComponent({
|
||||
} else {
|
||||
const { selectCheckboxMaps } = reactData
|
||||
XEUtils.each(selectCheckboxMaps, (row, rowid) => {
|
||||
if (isFull ? fullDataRowIdData[rowid] : afterFullRowMaps[rowid]) {
|
||||
rowList.push(row)
|
||||
if (isFull) {
|
||||
if (fullDataRowIdData[rowid]) {
|
||||
rowList.push(fullDataRowIdData[rowid].row)
|
||||
}
|
||||
} else {
|
||||
if (afterFullRowMaps[rowid]) {
|
||||
rowList.push(afterFullRowMaps[rowid])
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export function _t (key: string, args?: any) {
|
||||
export const setConfig: VxeGlobalConfigMethod = (options) => {
|
||||
if (options) {
|
||||
if (options.theme) {
|
||||
setTheme(options)
|
||||
setTheme(options.theme)
|
||||
}
|
||||
if (options.zIndex) {
|
||||
DomZIndex.setCurrent(options.zIndex)
|
||||
@@ -154,7 +154,7 @@ export const VXETable = {
|
||||
|
||||
export const VxeUI = VXETable
|
||||
|
||||
setTheme(globalStore)
|
||||
setTheme('light')
|
||||
|
||||
export * from './src/interceptor'
|
||||
export * from './src/renderer'
|
||||
|
||||
@@ -98,9 +98,16 @@ const GlobalConfig: VXETableConfigOptions = {
|
||||
showAsterisk: true
|
||||
},
|
||||
importConfig: {
|
||||
_typeMaps: {},
|
||||
modes: ['insert', 'covering']
|
||||
},
|
||||
exportConfig: {
|
||||
_typeMaps: {
|
||||
csv: 1,
|
||||
html: 1,
|
||||
xml: 1,
|
||||
txt: 1
|
||||
},
|
||||
modes: ['current', 'selected']
|
||||
},
|
||||
printConfig: {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import GlobalConfig from './conf'
|
||||
|
||||
export function setTheme (options: any) {
|
||||
const theme = (options ? options.theme : null) || GlobalConfig.theme || 'default'
|
||||
export function setTheme (name: any) {
|
||||
let theme = name || GlobalConfig.theme
|
||||
if (!theme || theme === 'default') {
|
||||
theme = 'light'
|
||||
}
|
||||
if (typeof document !== 'undefined') {
|
||||
const documentElement = document.documentElement
|
||||
if (documentElement) {
|
||||
documentElement.setAttribute('data-vxe-table-theme', theme)
|
||||
documentElement.setAttribute('data-vxe-ui-theme', theme)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,21 +112,21 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
const treeOpts = computeTreeOpts.value
|
||||
const childrenField = treeOpts.children || treeOpts.childrenField
|
||||
const validOpts = computeValidOpts.value
|
||||
let validDatas
|
||||
let validList
|
||||
if (rows === true) {
|
||||
validDatas = afterFullData
|
||||
validList = afterFullData
|
||||
} else if (rows) {
|
||||
if (XEUtils.isFunction(rows)) {
|
||||
cb = rows
|
||||
} else {
|
||||
validDatas = XEUtils.isArray(rows) ? rows : [rows]
|
||||
validList = XEUtils.isArray(rows) ? rows : [rows]
|
||||
}
|
||||
}
|
||||
if (!validDatas) {
|
||||
if (!validList) {
|
||||
if ($xetable.getInsertRecords) {
|
||||
validDatas = $xetable.getInsertRecords().concat($xetable.getUpdateRecords())
|
||||
validList = $xetable.getInsertRecords().concat($xetable.getUpdateRecords())
|
||||
} else {
|
||||
validDatas = []
|
||||
validList = []
|
||||
}
|
||||
}
|
||||
const rowValidErrs: any = []
|
||||
@@ -181,9 +181,9 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
}
|
||||
}
|
||||
if (treeConfig) {
|
||||
XEUtils.eachTree(validDatas, handleVaild, { children: childrenField })
|
||||
XEUtils.eachTree(validList, handleVaild, { children: childrenField })
|
||||
} else {
|
||||
validDatas.forEach(handleVaild)
|
||||
validList.forEach(handleVaild)
|
||||
}
|
||||
return Promise.all(rowValidErrs).then(() => {
|
||||
const ruleProps = Object.keys(validRest)
|
||||
@@ -300,9 +300,9 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
})
|
||||
})
|
||||
} else if (rowList.length) {
|
||||
const rowidList = rowList.map(row => `${getRowid($xetable, row)}`)
|
||||
const rowIdList = rowList.map(row => `${getRowid($xetable, row)}`)
|
||||
XEUtils.each(validErrorMaps, (item, key) => {
|
||||
if (rowidList.indexOf(key.split(':')[0]) > -1) {
|
||||
if (rowIdList.indexOf(key.split(':')[0]) > -1) {
|
||||
validErrMaps[key] = item
|
||||
}
|
||||
})
|
||||
@@ -361,7 +361,7 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
const { editRules } = props
|
||||
const { field } = column
|
||||
const errorRules: Rule[] = []
|
||||
const syncVailds: Promise<any>[] = []
|
||||
const syncValidList: Promise<any>[] = []
|
||||
if (field && editRules) {
|
||||
const rules = XEUtils.get(editRules, field)
|
||||
if (rules) {
|
||||
@@ -407,7 +407,7 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
errorRules.push(new Rule({ type: 'custom', trigger, content: customValid.message, rule: new Rule(rule) }))
|
||||
} else if (customValid.catch) {
|
||||
// 如果为异步校验(注:异步校验是并发无序的)
|
||||
syncVailds.push(
|
||||
syncValidList.push(
|
||||
customValid.catch((e: any) => {
|
||||
validRuleErr = true
|
||||
errorRules.push(new Rule({ type: 'custom', trigger, content: e && e.message ? e.message : (rule.content || rule.message), rule: new Rule(rule) }))
|
||||
@@ -435,7 +435,7 @@ const validatorHook: VxeGlobalHooksHandles.HookOptions = {
|
||||
})
|
||||
}
|
||||
}
|
||||
return Promise.all(syncVailds).then(() => {
|
||||
return Promise.all(syncValidList).then(() => {
|
||||
if (errorRules.length) {
|
||||
const rest = { rules: errorRules, rule: errorRules[0] }
|
||||
return Promise.reject(rest)
|
||||
|
||||
@@ -608,7 +608,7 @@
|
||||
}
|
||||
}
|
||||
&.cell--area {
|
||||
.vxe-table--main-wrapper {
|
||||
.vxe-body--row {
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import '../variable.scss';
|
||||
|
||||
[data-vxe-table-theme="dark"] {
|
||||
[data-vxe-ui-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
|
||||
/*font*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@import '../variable.scss';
|
||||
|
||||
[data-vxe-table-theme="default"] {
|
||||
[data-vxe-ui-theme="light"] {
|
||||
/*font*/
|
||||
--vxe-font-family: #{$vxe-font-family};
|
||||
--vxe-font-size: #{$vxe-font-size};
|
||||
|
||||
6
types/module/export.d.ts
vendored
6
types/module/export.d.ts
vendored
@@ -86,6 +86,9 @@ declare module '../table' {
|
||||
* 导入参数
|
||||
*/
|
||||
export interface ImportConfig {
|
||||
// 内置属性
|
||||
_typeMaps?: Record<string, number>
|
||||
|
||||
/**
|
||||
* 可选文件类型列表
|
||||
*/
|
||||
@@ -142,6 +145,9 @@ declare module '../table' {
|
||||
* 导出参数
|
||||
*/
|
||||
export interface ExportConfig {
|
||||
// 内置属性
|
||||
_typeMaps?: Record<string, number>
|
||||
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
|
||||
3
types/v-x-e-table/index.d.ts
vendored
3
types/v-x-e-table/index.d.ts
vendored
@@ -94,6 +94,7 @@ export interface VxeGlobalIcon {
|
||||
}
|
||||
|
||||
export type VxeGlobalConfigMethod = (options?: VXETableConfigOptions) => VXETableCore
|
||||
export type VxeGlobalThemeMethod = (name?: '' | 'light' | 'dark') => VXETableCore
|
||||
|
||||
/**
|
||||
* 请使用 setConfig
|
||||
@@ -133,6 +134,7 @@ export type VxeGlobalTranslate = (key: string, args?: any) => string
|
||||
export type VxeGlobalUse = (plugin: VXETablePluginObject, ...options: any[]) => VXETableCore
|
||||
|
||||
export const setConfig: VxeGlobalConfigMethod
|
||||
export const setTheme: VxeGlobalThemeMethod
|
||||
export const interceptor: VxeGlobalInterceptor
|
||||
export const renderer: VxeGlobalRenderer
|
||||
export const commands: VxeGlobalCommands
|
||||
@@ -194,6 +196,7 @@ export interface VXETableCore {
|
||||
* 设置全局参数/获取所有参数
|
||||
*/
|
||||
setConfig: VxeGlobalConfigMethod
|
||||
setTheme: VxeGlobalThemeMethod
|
||||
setIcon: typeof setIcon
|
||||
/**
|
||||
* 读取内部数据
|
||||
|
||||
Reference in New Issue
Block a user