1
0
mirror of synced 2025-11-06 11:20:40 +08:00
This commit is contained in:
xuliangzhan
2024-05-26 12:26:38 +08:00
parent a56eb8bddb
commit a79108bd96
16 changed files with 56 additions and 26 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,8 @@
.DS_Store
.history
node_modules
/lib_temp
/packages_temp
/dist
/es
/lib

View File

@@ -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

View File

@@ -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 渲染模式、将虚拟滚动提升到极致、虚拟滚动动态行高、数据图表可视化
## 浏览器支持

View File

@@ -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重構組件拆分多餘組件只保留表格
## 瀏覽器支持

View File

@@ -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",

View File

@@ -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))

View File

@@ -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])
}
}
})
}

View File

@@ -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'

View File

@@ -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: {

View File

@@ -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)
}
}
}

View File

@@ -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)

View File

@@ -608,7 +608,7 @@
}
}
&.cell--area {
.vxe-table--main-wrapper {
.vxe-body--row {
user-select: none;
}
}

View File

@@ -1,6 +1,6 @@
@import '../variable.scss';
[data-vxe-table-theme="dark"] {
[data-vxe-ui-theme="dark"] {
color-scheme: dark;
/*font*/

View File

@@ -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};

View File

@@ -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>
/**
* 文件名
*/

View File

@@ -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
/**
* 读取内部数据