Merge remote-tracking branch 'origin/main'

This commit is contained in:
雪忆 2024-07-29 15:10:40 +08:00
commit ecfe66a019
54 changed files with 386 additions and 268 deletions

View File

@ -63,8 +63,8 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
cssTarget: 'chrome80',
rollupOptions: {
output: {
// 入口文件名(不能变,否则所有打包的 js hash 值全变了)
entryFileNames: 'index.js',
// 入口文件名
entryFileNames: 'assets/entry/[name]-[hash].js',
manualChunks: {
vue: ['vue', 'pinia', 'vue-router'],
antd: ['ant-design-vue', '@ant-design/icons-vue'],

View File

@ -107,9 +107,10 @@
"vue-router": "^4.3.2",
"vue-types": "^5.1.1",
"vuedraggable": "^4.1.0",
"vxe-table": "^4.6.3",
"vxe-table-plugin-export-xlsx": "^4.0.1",
"xe-utils": "^3.5.25",
"vxe-pc-ui": "^4.0.44",
"vxe-table": "^4.7.40",
"vxe-table-plugin-export-xlsx": "^4.0.4",
"xe-utils": "^3.5.28",
"xlsx": "^0.18.5"
},
"devDependencies": {

62
pnpm-lock.yaml generated
View File

@ -122,15 +122,18 @@ importers:
vuedraggable:
specifier: ^4.1.0
version: 4.1.0(vue@3.4.25(typescript@5.4.5))
vxe-pc-ui:
specifier: ^4.0.44
version: 4.0.44
vxe-table:
specifier: ^4.6.3
version: 4.6.3(vue@3.4.25(typescript@5.4.5))
specifier: ^4.7.40
version: 4.7.40
vxe-table-plugin-export-xlsx:
specifier: ^4.0.1
version: 4.0.1(vxe-table@4.6.3(vue@3.4.25(typescript@5.4.5)))
specifier: ^4.0.4
version: 4.0.4(vxe-table@4.7.40)
xe-utils:
specifier: ^3.5.25
version: 3.5.25
specifier: ^3.5.28
version: 3.5.28
xlsx:
specifier: ^0.18.5
version: 0.18.5
@ -2005,6 +2008,9 @@ packages:
'@vueuse/shared@10.9.0':
resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==}
'@vxe-ui/core@1.0.12':
resolution: {integrity: sha512-s79mQw6uYSbTVGBWbxrisHwJV1b770vZMT9XpY3khcFQhXNo25+PS3FLrNCSsBBJR0ZkBLOXDER/ft9DIqgFTw==}
'@zxcvbn-ts/core@3.0.4':
resolution: {integrity: sha512-aQeiT0F09FuJaAqNrxynlAwZ2mW/1MdXakKWNmGM1Qp/VaY6CnB/GfnMS2T8gB2231Esp1/maCWd8vTG4OuShw==}
@ -3096,8 +3102,8 @@ packages:
dom-serializer@2.0.0:
resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==}
dom-zindex@1.0.2:
resolution: {integrity: sha512-QceDZxPlvzhpg6e8szxNiKPUt5Y9SfFTe3nZy8og3JoPQPlAlzBzHa/lhDkhgeG3cjbKyQcuoic+wymF0o0d1Q==}
dom-zindex@1.0.4:
resolution: {integrity: sha512-PNk7u71TJ1C9Lwjjp5nNuQcVWuECFMmr9kZAwi2UbgWUM7jXdTCe4O4x5bhLUa07jpcZUVA5Du3ho7/FXzS9Ng==}
domelementtype@1.3.1:
resolution: {integrity: sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==}
@ -7060,15 +7066,16 @@ packages:
peerDependencies:
vue: ^3.0.1
vxe-table-plugin-export-xlsx@4.0.1:
resolution: {integrity: sha512-puUOUfptu5ciEiFqTlVni3twLICSbkl87uXOsjZzrEyXJHJS9dYu7ZTD7/DRMqyuWyU3Idg7AekfcdcslP4Y/A==}
vxe-pc-ui@4.0.44:
resolution: {integrity: sha512-wiauFMmSvEkVKa/AsKGb5CMi91Ojts+Ydcn+iespgl3xMBD01BR/CGzeCI478P3XAFBsiN4gWlgxHmGP5TR8UA==}
vxe-table-plugin-export-xlsx@4.0.4:
resolution: {integrity: sha512-Og2ZcIWTV7msT1ddPT/spxJaP1T8wxs3Uuu1LO/3HL5Ugt9tShEY3FJ7YGic3j1Nk6ZZT+VsU+afgT5EzpcUJw==}
peerDependencies:
vxe-table: ^4.5.0
vxe-table@4.6.3:
resolution: {integrity: sha512-71FOi0lFQbvs1dUIZPTDCLaSJkRjLHlBuNzWIR9RofBe4EvhX4OowrhaCCsCXXKCCGSlJRp6+/O2c71lEZY9PQ==}
peerDependencies:
vue: ^3.2.28
vxe-table@4.7.40:
resolution: {integrity: sha512-y9VC3oLJgusxFj3xZ28G4gU+YClBuDIV8oM75Dx3doYJ7vanXZnSf70XJ+W5xEKflamUmjGre66XZ2b4XuqtMw==}
w3c-hr-time@1.0.2:
resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==}
@ -7206,8 +7213,8 @@ packages:
utf-8-validate:
optional: true
xe-utils@3.5.25:
resolution: {integrity: sha512-d/ty5eo4hXtho/3195XAvqereIoSYJ+XfC52f3ZEPxTaCeyLFivDZTyX6gTdsR65ISH1Irvn85H0bSL60dUhSQ==}
xe-utils@3.5.28:
resolution: {integrity: sha512-oeLLJ0b54QdOSSgYQ9TiKW/xAGrc9r0weCA/5UfyGdm3n3js4cNOuuf9Tml7UwgBQpl4uWMbMwUZKLh2yqPF3A==}
xlsx@0.18.5:
resolution: {integrity: sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==}
@ -9228,6 +9235,11 @@ snapshots:
- '@vue/composition-api'
- vue
'@vxe-ui/core@1.0.12':
dependencies:
dom-zindex: 1.0.4
xe-utils: 3.5.28
'@zxcvbn-ts/core@3.0.4':
dependencies:
fastest-levenshtein: 1.0.16
@ -10389,7 +10401,7 @@ snapshots:
domhandler: 5.0.3
entities: 4.5.0
dom-zindex@1.0.2: {}
dom-zindex@1.0.4: {}
domelementtype@1.3.1: {}
@ -15005,15 +15017,17 @@ snapshots:
sortablejs: 1.14.0
vue: 3.4.25(typescript@5.4.5)
vxe-table-plugin-export-xlsx@4.0.1(vxe-table@4.6.3(vue@3.4.25(typescript@5.4.5))):
vxe-pc-ui@4.0.44:
dependencies:
vxe-table: 4.6.3(vue@3.4.25(typescript@5.4.5))
'@vxe-ui/core': 1.0.12
vxe-table@4.6.3(vue@3.4.25(typescript@5.4.5)):
vxe-table-plugin-export-xlsx@4.0.4(vxe-table@4.7.40):
dependencies:
dom-zindex: 1.0.2
vue: 3.4.25(typescript@5.4.5)
xe-utils: 3.5.25
vxe-table: 4.7.40
vxe-table@4.7.40:
dependencies:
vxe-pc-ui: 4.0.44
w3c-hr-time@1.0.2:
dependencies:
@ -15138,7 +15152,7 @@ snapshots:
ws@8.16.0: {}
xe-utils@3.5.25: {}
xe-utils@3.5.28: {}
xlsx@0.18.5:
dependencies:

View File

@ -54,7 +54,7 @@
import { useFormValues } from './hooks/useFormValues';
import useAdvanced from './hooks/useAdvanced';
import { useFormEvents } from './hooks/useFormEvents';
import { itemIsUploadComponent, useFormEvents } from './hooks/useFormEvents';
import { createFormContext } from './hooks/useFormContext';
import { useAutoFocus } from './hooks/useAutoFocus';
import { useModalContext } from '@/components/Modal';
@ -64,7 +64,7 @@
import { useDesign } from '@/hooks/web/useDesign';
import { cloneDeep } from 'lodash-es';
import { TableActionType } from '@/components/Table';
import { isFunction } from '@/utils/is';
import { isArray, isFunction } from '@/utils/is';
defineOptions({ name: 'BasicForm' });
@ -165,14 +165,17 @@
schema.defaultValue = def;
}
}
// handle upload type
if (defaultValue && itemIsUploadComponent(schema?.component)) {
if (isArray(defaultValue)) {
schema.defaultValue = defaultValue;
} else if (typeof defaultValue == 'string') {
schema.defaultValue = [defaultValue];
}
}
// handle schema.valueFormat
if (
isHandleDefaultValue &&
defaultValue &&
component &&
isFunction(valueFormat)
) {
if (isHandleDefaultValue && defaultValue && component && isFunction(valueFormat)) {
schema.defaultValue = valueFormat({
value: defaultValue,
schema,

View File

@ -287,11 +287,11 @@
const on = {
[eventKey]: (...args: Nullable<Recordable<any>>[]) => {
const [e] = args;
const target = e ? e.target : null;
let value = target ? (isCheck ? target.checked : target.value) : e;
if(isFunction(valueFormat)){
value = valueFormat({...unref(getValues),value});
if (isFunction(valueFormat)) {
value = valueFormat({ ...unref(getValues), value });
}
props.setFormModel(field, value, props.schema);

View File

@ -31,8 +31,13 @@ export function createPlaceholderMessage(component: ComponentType) {
const DATE_TYPE = ['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'];
/**
*
*/
export const uploadItemType: ComponentType[] = ['Upload', 'ImageUpload'];
function genType() {
return [...DATE_TYPE, 'RangePicker',"TimeRangePicker"];
return [...DATE_TYPE, 'RangePicker', 'TimeRangePicker'];
}
export function setComponentRuleType(
@ -45,7 +50,7 @@ export function setComponentRuleType(
}
if (['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'].includes(component)) {
rule.type = valueFormat ? 'string' : 'object';
} else if (['RangePicker', 'Upload', 'CheckboxGroup'].includes(component)) {
} else if (['RangePicker', 'CheckboxGroup'].includes(component)) {
rule.type = 'array';
} else if (['InputNumber'].includes(component)) {
rule.type = 'number';

View File

@ -4,10 +4,16 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
import { unref, toRaw, nextTick } from 'vue';
import { isArray, isFunction, isObject, isString, isNil } from '@/utils/is';
import { deepMerge } from '@/utils';
import { dateItemType, defaultValueComponents, isIncludeSimpleComponents } from '../helper';
import {
dateItemType,
defaultValueComponents,
isIncludeSimpleComponents,
uploadItemType,
} from '../helper';
import { dateUtil } from '@/utils/dateUtil';
import { cloneDeep, has, uniqBy, get, set } from 'lodash-es';
import { error } from '@/utils/log';
import { ComponentProps } from '../types';
interface UseFormActionContext {
emit: EmitType;
@ -19,7 +25,12 @@ interface UseFormActionContext {
schemaRef: Ref<FormSchema[]>;
handleFormValues: Fn;
}
/**
* @description: Is it upload
*/
export function itemIsUploadComponent(key: keyof ComponentProps) {
return uploadItemType.includes(key);
}
function tryConstructArray(field: string, values: Recordable = {}): any[] | undefined {
const pattern = /^\[(.+)\]$/;
if (pattern.test(field)) {
@ -123,7 +134,20 @@ export function useFormEvents({
}
}
}
// Adapt upload component
if (itemIsUploadComponent(schema?.component)) {
constructValue = get(value, key);
const fieldValue = constructValue || value;
if (fieldValue) {
if (isArray(fieldValue)) {
unref(formModel)[key] = fieldValue;
} else if (typeof fieldValue == 'string') {
unref(formModel)[key] = [fieldValue];
}
}
validKeys.push(key);
return;
}
// Adapt common component
if (hasKey) {
constructValue = get(value, key);

View File

@ -1,7 +1,7 @@
import type { Options, Props } from './typing';
import ImgPreview from './Functional.vue';
import { isClient } from '@/utils/is';
import { createVNode, render } from 'vue';
import ImgPreview from './Functional.vue';
import type { Options, Props } from './typing';
let instance: ReturnType<typeof createVNode> | null = null;
export function createImgPreview(options: Options) {
@ -10,8 +10,13 @@ export function createImgPreview(options: Options) {
const container = document.createElement('div');
Object.assign(propsData, { show: true, index: 0, scaleStep: 100 }, options);
instance = createVNode(ImgPreview, propsData);
render(instance, container);
document.body.appendChild(container);
if (instance?.component) {
// 存在实例时更新props
Object.assign(instance.component.props, propsData);
} else {
instance = createVNode(ImgPreview, propsData);
render(instance, container);
document.body.appendChild(container);
}
return instance.component?.exposed;
}

View File

@ -17,11 +17,11 @@
</template>
<script lang="ts" setup>
import { PropType, ref, computed, unref, getCurrentInstance, watch, useSlots } from 'vue';
import { useDesign } from '@/hooks/web/useDesign';
import { propTypes } from '@/utils/propTypes';
import { useMenuItem } from './useMenu';
import { Tooltip } from 'ant-design-vue';
import { computed, getCurrentInstance, PropType, ref, unref, useSlots, watch } from 'vue';
import { useMenuItem } from './useMenu';
import { useSimpleRootMenuContext } from './useSimpleMenuContext';
defineOptions({ name: 'MenuItem' });
@ -76,7 +76,7 @@
const { uidList } = getParentList();
rootMenuEmitter.emit('on-update-opened', {
opend: false,
opened: false,
parent: instance?.parent,
uidList: uidList,
});

View File

@ -57,27 +57,27 @@
</template>
<script lang="ts" setup>
import { type TimeoutHandle, type Recordable } from '@vben/types';
import type { CSSProperties, PropType } from 'vue';
import type { SubMenuProvider } from './types';
import {
computed,
unref,
getCurrentInstance,
reactive,
provide,
onBeforeMount,
inject,
} from 'vue';
import { useDesign } from '@/hooks/web/useDesign';
import { propTypes } from '@/utils/propTypes';
import { useMenuItem } from './useMenu';
import { useSimpleRootMenuContext } from './useSimpleMenuContext';
import { CollapseTransition } from '@/components/Transition';
import Icon from '@/components/Icon/Icon.vue';
import { Popover } from 'ant-design-vue';
import { CollapseTransition } from '@/components/Transition';
import { useDesign } from '@/hooks/web/useDesign';
import { isBoolean, isObject } from '@/utils/is';
import { mitt } from '@/utils/mitt';
import { propTypes } from '@/utils/propTypes';
import { type Recordable, type TimeoutHandle } from '@vben/types';
import { Popover } from 'ant-design-vue';
import type { CSSProperties, PropType } from 'vue';
import {
computed,
getCurrentInstance,
inject,
onBeforeMount,
provide,
reactive,
unref,
} from 'vue';
import type { SubMenuProvider } from './types';
import { useMenuItem } from './useMenu';
import { useSimpleRootMenuContext } from './useSimpleMenuContext';
defineOptions({ name: 'SubMenu' });
@ -184,7 +184,7 @@
if (unref(getAccordion)) {
const { uidList } = getParentList();
rootMenuEmitter.emit('on-update-opened', {
opend: false,
opened: false,
parent: instance?.parent,
uidList: uidList,
});
@ -267,9 +267,9 @@
return;
}
if (isObject(data) && rootProps.accordion) {
const { opend, parent, uidList } = data as Recordable<any>;
const { opened, parent, uidList } = data as Recordable<any>;
if (parent === instance?.parent) {
state.opened = opend;
state.opened = opened;
} else if (!uidList.includes(instance?.uid)) {
state.opened = false;
}

View File

@ -1,12 +1,12 @@
import type { InjectionKey, Ref, ComponentInternalInstance } from 'vue';
import type { Emitter } from '@/utils/mitt';
import { createContext, useContext } from '@/hooks/core/useContext';
import type { Emitter } from '@/utils/mitt';
import type { ComponentInternalInstance, InjectionKey, Ref } from 'vue';
export type MenuEmitterEvents = {
'on-update-opened':
| (string | number)[]
| {
opend: boolean;
opened: boolean;
parent?: ComponentInternalInstance | null;
uidList: number[];
};

View File

@ -17,6 +17,7 @@
import { treeToList } from '@/utils/helper/treeHelper';
import { Spin } from 'ant-design-vue';
import { parseRowKey } from '../../helper';
import { warn } from '@/utils/log';
export default defineComponent({
name: 'EditableCell',
@ -282,6 +283,7 @@
});
} catch (e) {
result = false;
warn(e);
} finally {
spinning.value = false;
}

View File

@ -540,13 +540,13 @@
label:
typeof col.title === 'string'
? col.title
: col.customTitle === 'string'
: typeof col.customTitle === 'string'
? col.customTitle
: '',
value:
typeof col.dataIndex === 'string'
? col.dataIndex
: col.title === 'string'
: typeof col.title === 'string'
? col.title
: '',
column: {

View File

@ -146,6 +146,7 @@ export function useDataSource(
},
{
deep: true,
immediate: true,
},
);

View File

@ -59,6 +59,7 @@
import UploadPreviewModal from './components/UploadPreviewModal.vue';
import { BaseFileItem } from './types/typing';
import { buildUUID } from '@/utils/uuid';
defineOptions({ name: 'BasicUpload' });
const props = defineProps(uploadContainerProps);
@ -85,7 +86,10 @@
const value = { ...attrs, ...props };
return omit(value, 'onChange');
});
function getValue(valueKey="url") {
const isFirstRender = ref<boolean>(true);
function getValue(valueKey = 'url') {
const list = (fileList.value || []).map((item: any) => {
return item[valueKey];
});
@ -110,7 +114,7 @@
} else if (typeof v == 'string') {
values.push(v);
}
fileList.value = values.map((item,i) => {
fileList.value = values.map((item) => {
if (item && isString(item)) {
return {
uid: buildUUID(),
@ -124,13 +128,19 @@
}) as any;
}
emit('update:value', values);
emit('change', values);
if (!isFirstRender.value) {
emit('change', values);
isFirstRender.value = false;
}
},
{
immediate: true,
deep: true,
},
{ immediate: true },
);
// modal
function handleChange(urls: string[],valueKey:string) {
function handleChange(urls: string[], valueKey: string) {
fileList.value = [...unref(fileList), ...(genFileListByUrls(urls) || [])];
const values = getValue(valueKey);
emit('update:value', values);
@ -138,7 +148,7 @@
}
// modal
function handlePreviewChange(fileItems: string[],valueKey:string) {
function handlePreviewChange(fileItems: string[], valueKey: string) {
fileList.value = [...(fileItems || [])];
const values = getValue(valueKey);
emit('update:value', values);

View File

@ -63,6 +63,7 @@
const fileList = ref<UploadProps['fileList']>([]);
const isLtMsg = ref<boolean>(true);
const isActMsg = ref<boolean>(true);
const isFirstRender = ref<boolean>(true);
watch(
() => props.value,
@ -94,7 +95,10 @@
}) as UploadProps['fileList'];
}
emit('update:value', value);
emit('change', value);
if (!isFirstRender.value) {
emit('change', value);
isFirstRender.value = false;
}
},
{
immediate: true,

View File

@ -23,6 +23,7 @@
import { BasicColumn } from '@/components/Table';
import { useMessage } from '@/hooks/web/useMessage';
import { buildUUID } from '@/utils/uuid';
const { createMessage } = useMessage();
const props = defineProps(previewProps);
@ -97,7 +98,6 @@
return createMessage.warning(t('component.upload.maxNumber', [maxNumber]));
}
record[uidKey] = record[uidKey] ?? buildUUID();
record[valueKey] = record[valueKey];
fileListRef.value = [...fileListRef.value, record];
emit('list-change', fileListRef.value, valueKey);
}

View File

@ -14,7 +14,7 @@ type SortableOptions = Merge<
// ...可扩展
}
>;
export type handleFnKey = "record" | "valueKey" | "uidKey"
export type handleFnKey = 'record' | 'valueKey' | 'uidKey';
export type previewColumnsFnType = {
handleRemove: (record: Record<handleFnKey, any>) => any;
handleAdd: (record: Record<handleFnKey, any>) => any;

View File

@ -1,6 +1,6 @@
import { withInstall } from '@/utils';
import vxeBasicTable from './src/VxeBasicTable';
import { VXETable } from 'vxe-table';
import { VxeUI } from 'vxe-table';
import VXETablePluginAntd from './src/components';
import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx';
import ExcelJS from 'exceljs';
@ -10,4 +10,4 @@ export const VxeBasicTable = withInstall(vxeBasicTable);
export * from 'vxe-table';
export * from './src/types';
VXETable.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS });
VxeUI.use(VXETablePluginAntd).use(VXETablePluginExportXLSX, { ExcelJS });

View File

@ -1,22 +1,25 @@
import { defineComponent, computed, ref } from 'vue';
import { defineComponent, computed, ref, watch } from 'vue';
import { BasicTableProps } from './types';
import { basicProps } from './props';
import { ignorePropKeys } from './const';
import { basicEmits } from './emits';
import XEUtils from 'xe-utils';
import type {
import {
VxeGridInstance,
VxeGridEventProps,
GridMethods,
TableMethods,
TableEditMethods,
TableValidatorMethods,
VxeUI,
VxeGlobalThemeName,
VxeGrid,
} from 'vxe-table';
import { Grid as VxeGrid } from 'vxe-table';
import { extendSlots } from '@/utils/helper/tsxHelper';
import { gridComponentMethodKeys } from './methods';
import { omit } from 'lodash-es';
import { useRootSetting } from '@/hooks/setting/useRootSetting';
export default defineComponent({
name: 'VxeBasicTable',
@ -25,7 +28,14 @@ export default defineComponent({
setup(props, { emit, attrs }) {
const tableElRef = ref<VxeGridInstance>();
const emitEvents: VxeGridEventProps = {};
const { getDarkMode } = useRootSetting();
watch(
() => getDarkMode.value,
() => {
VxeUI.setTheme(getDarkMode.value as VxeGlobalThemeName);
},
{ immediate: true },
);
const extendTableMethods = (methodKeys) => {
const funcs: any = {};
methodKeys.forEach((name) => {

View File

@ -1,20 +1,21 @@
import XEUtils from 'xe-utils';
import { createDefaultRender, createEditRender, createFormItemRender } from './common';
import { VxeGlobalRendererOptions } from 'vxe-table';
export default {
renderDefault: createDefaultRender({}, (_, params) => {
renderTableDefault: createDefaultRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
renderEdit: createEditRender({}, (_, params) => {
renderTableEdit: createEditRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
renderItemContent: createFormItemRender({}, (_, params) => {
renderFormItemContent: createFormItemRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,20 +1,21 @@
import XEUtils from 'xe-utils';
import { createDefaultRender, createEditRender, createFormItemRender } from './common';
import { VxeGlobalRendererOptions } from 'vxe-table';
export default {
renderDefault: createDefaultRender({}, (_, params) => {
renderTableDefault: createDefaultRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
renderEdit: createEditRender({}, (_, params) => {
renderTableEdit: createEditRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
renderItemContent: createFormItemRender({}, (_, params) => {
renderFormItemContent: createFormItemRender({}, (_, params) => {
return {
params: XEUtils.get(params, 'row'),
};
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import {
createEditRender,
createDefaultRender,
@ -7,10 +8,10 @@ import {
} from './common';
export default {
autofocus: 'input.ant-input',
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter: createFilterRender(),
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
};
tableAutoFocus: 'input.ant-input',
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,8 +1,9 @@
import { h } from 'vue';
import {
FormItemContentRenderParams,
FormItemRenderOptions,
VxeFormItemPropTypes,
VxeGlobalRendererHandles,
VxeGlobalRendererOptions,
} from 'vxe-table';
import XEUtils from 'xe-utils';
import { cellText, createEvents, createProps, getComponent } from './common';
@ -11,8 +12,8 @@ const COMPONENT_NAME = 'AButton';
export function createEditRender() {
return function (
renderOpts: VxeGlobalRendererHandles.RenderEditOptions,
params: VxeGlobalRendererHandles.RenderEditParams,
renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) {
const { attrs } = renderOpts;
const Component = getComponent(COMPONENT_NAME);
@ -29,8 +30,8 @@ export function createEditRender() {
export function createDefaultRender() {
return function (
renderOpts: VxeGlobalRendererHandles.RenderEditOptions,
params: VxeGlobalRendererHandles.RenderEditParams,
renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) {
const { attrs } = renderOpts;
const Component = getComponent(COMPONENT_NAME);
@ -50,7 +51,10 @@ export function createDefaultRender() {
}
export function createFormItemRender() {
return function (renderOpts: FormItemRenderOptions, params: FormItemContentRenderParams) {
return function (
renderOpts: VxeFormItemPropTypes.ItemRender,
params: FormItemContentRenderParams,
) {
const { attrs, content } = renderOpts;
const { property, $form, data } = params;
const props = createProps(renderOpts, null);
@ -113,8 +117,8 @@ function createToolbarButtonRender() {
}
export default {
renderEdit: createEditRender(),
renderDefault: createDefaultRender(),
renderItemContent: createFormItemRender(),
renderTableEdit: createEditRender(),
renderTableDefault: createDefaultRender(),
renderFormItemContent: createFormItemRender(),
renderToolbarButton: createToolbarButtonRender(),
};
} as VxeGlobalRendererOptions;

View File

@ -1,20 +1,21 @@
import {
FormItemContentRenderParams,
FormItemRenderOptions,
VxeFormItemPropTypes,
VxeGlobalRendererHandles,
VxeGlobalRendererOptions,
} from 'vxe-table';
import { createDefaultRender, createEditRender, createFormItemRender } from './AButton';
function createEditButtonRender() {
return function (
renderOpts: VxeGlobalRendererHandles.RenderEditOptions,
params: VxeGlobalRendererHandles.RenderEditParams,
renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) {
const buttonEditRender = createEditRender();
const { children } = renderOpts;
if (children) {
return children.map(
(childRenderOpts: VxeGlobalRendererHandles.RenderEditOptions) =>
(childRenderOpts: VxeGlobalRendererHandles.RenderTableEditOptions) =>
buttonEditRender(childRenderOpts, params)[0],
);
}
@ -25,7 +26,7 @@ function createEditButtonRender() {
function createDefaultButtonRender() {
return function (
renderOpts: VxeGlobalRendererHandles.RenderDefaultOptions,
params: VxeGlobalRendererHandles.RenderDefaultParams,
params: VxeGlobalRendererHandles.RenderTableDefaultParams,
) {
const buttonDefaultRender = createDefaultRender();
const { children } = renderOpts;
@ -40,12 +41,16 @@ function createDefaultButtonRender() {
}
function createButtonItemRender() {
return function (renderOpts: FormItemRenderOptions, params: FormItemContentRenderParams) {
return function (
renderOpts: VxeFormItemPropTypes.ItemRender,
params: FormItemContentRenderParams,
) {
const buttonItemRender = createFormItemRender();
const { children } = renderOpts;
if (children) {
return children.map(
(childRenderOpts: FormItemRenderOptions) => buttonItemRender(childRenderOpts, params)[0],
(childRenderOpts: VxeFormItemPropTypes.ItemRender) =>
buttonItemRender(childRenderOpts, params)[0],
);
}
return [];
@ -53,7 +58,7 @@ function createButtonItemRender() {
}
export default {
renderEdit: createEditButtonRender(),
renderDefault: createDefaultButtonRender(),
renderItemContent: createButtonItemRender(),
};
renderTableEdit: createEditButtonRender(),
renderTableDefault: createDefaultButtonRender(),
renderFormItemContent: createButtonItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,4 +1,4 @@
import { VxeGlobalRendererHandles } from 'vxe-table';
import { VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import XEUtils from 'xe-utils';
import {
createEditRender,
@ -21,7 +21,7 @@ function matchCascaderData(index: number, list: any[], values: any[], labels: an
function getCascaderCellValue(
renderOpts: VxeGlobalRendererHandles.RenderOptions,
params: VxeGlobalRendererHandles.RenderCellParams,
params: VxeGlobalRendererHandles.RenderTableCellParams,
) {
const { props = {} } = renderOpts;
const { row, column } = params;
@ -35,8 +35,8 @@ function getCascaderCellValue(
}
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getCascaderCellValue),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getCascaderCellValue),
};
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getCascaderCellValue),
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getCascaderCellValue),
} as VxeGlobalRendererOptions;

View File

@ -1,5 +1,6 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { createFormItemRender } from './common';
export default {
renderItemContent: createFormItemRender(),
};
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,4 +1,4 @@
import { VxeGlobalRendererHandles } from 'vxe-table';
import { VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import XEUtils from 'xe-utils';
import {
createCellRender,
@ -9,7 +9,9 @@ import {
export function getDatePickerCellValue(
renderOpts: VxeGlobalRendererHandles.RenderOptions,
params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams,
params:
| VxeGlobalRendererHandles.RenderTableCellParams
| VxeGlobalRendererHandles.ExportMethodParams,
defaultFormat: string,
) {
const { props = {} } = renderOpts;
@ -22,12 +24,12 @@ export function getDatePickerCellValue(
}
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getDatePickerCellValue, () => {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getDatePickerCellValue, () => {
return ['YYYY-MM-DD'];
}),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getDatePickerCellValue, () => {
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getDatePickerCellValue, () => {
return ['YYYY-MM-DD'];
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,9 +1,9 @@
import { h } from 'vue';
import { VxeGlobalRendererHandles } from 'vxe-table';
import { VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import { getComponent } from './common';
function createEmptyRender() {
return function (renderOpts: VxeGlobalRendererHandles.RenderEmptyOptions) {
return function (renderOpts: VxeGlobalRendererHandles.RenderTableEmptyOptions) {
const { name, attrs, props } = renderOpts;
const Component = getComponent(name);
@ -23,5 +23,5 @@ function createEmptyRender() {
}
export default {
renderEmpty: createEmptyRender(),
};
renderTableEmptyView: createEmptyRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import {
createEditRender,
createDefaultRender,
@ -7,10 +8,10 @@ import {
} from './common';
export default {
autofocus: 'input.ant-input',
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter: createFilterRender(),
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
};
tableAutoFocus: 'input.ant-input',
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import {
createEditRender,
createFilterRender,
@ -7,10 +8,10 @@ import {
} from './common';
export default {
autofocus: 'input.ant-input-number-input',
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter: createFilterRender(),
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
};
tableAutoFocus: 'input.ant-input-number-input',
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import {
createEditRender,
createDefaultRender,
@ -8,10 +9,10 @@ import {
} from './common';
export default {
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter: createFilterRender(),
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
renderToolbarTool: createToolbarToolRender(),
};
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { getDatePickerCellValue } from './ADatePicker';
import {
createCellRender,
@ -7,12 +8,12 @@ import {
} from './common';
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getDatePickerCellValue, () => {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getDatePickerCellValue, () => {
return ['YYYY-MM'];
}),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getDatePickerCellValue, () => {
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getDatePickerCellValue, () => {
return ['YYYY-MM'];
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,5 +1,6 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { createFormItemRender } from './common';
export default {
renderItemContent: createFormItemRender(),
};
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,4 +1,4 @@
import { VxeColumnPropTypes, VxeGlobalRendererHandles } from 'vxe-table';
import { VxeColumnPropTypes, VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import XEUtils from 'xe-utils';
import {
createCellRender,
@ -9,7 +9,9 @@ import {
function getRangePickerCellValue(
renderOpts: VxeColumnPropTypes.EditRender,
params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams,
params:
| VxeGlobalRendererHandles.RenderTableCellParams
| VxeGlobalRendererHandles.ExportMethodParams,
) {
const { props = {} } = renderOpts;
const { row, column } = params;
@ -23,8 +25,8 @@ function getRangePickerCellValue(
}
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getRangePickerCellValue),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getRangePickerCellValue),
};
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getRangePickerCellValue),
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getRangePickerCellValue),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import {
createEditRender,
createDefaultRender,
@ -7,9 +8,9 @@ import {
} from './common';
export default {
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter: createFilterRender(),
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
};
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,5 +1,5 @@
import { ComponentOptions, h, resolveComponent } from 'vue';
import { VxeColumnPropTypes, VxeGlobalRendererHandles } from 'vxe-table';
import { VxeColumnPropTypes, VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import XEUtils from 'xe-utils';
import {
cellText,
@ -32,7 +32,7 @@ function renderOptions(options: any[], optionProps: VxeGlobalRendererHandles.Ren
function createEditRender() {
return function (
renderOpts: VxeColumnPropTypes.EditRender,
params: VxeGlobalRendererHandles.RenderEditParams,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) {
const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts;
const { row, column, $table } = params;
@ -100,8 +100,8 @@ function createEditRender() {
}
function getSelectCellValue(
renderOpts: VxeGlobalRendererHandles.RenderCellOptions,
params: VxeGlobalRendererHandles.RenderCellParams,
renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions,
params: VxeGlobalRendererHandles.RenderTableCellParams,
) {
const {
options = [],
@ -144,7 +144,7 @@ function getSelectCellValue(
function createFilterRender() {
return function (
renderOpts: VxeColumnPropTypes.FilterRender,
params: VxeGlobalRendererHandles.RenderFilterParams,
params: VxeGlobalRendererHandles.RenderTableFilterParams,
) {
const { options = [], optionGroups, optionProps = {}, optionGroupProps = {} } = renderOpts;
const groupOptions = optionGroupProps.options || 'options';
@ -249,10 +249,10 @@ function createFilterRender() {
}
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getSelectCellValue),
renderFilter: createFilterRender(),
defaultFilterMethod(params) {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getSelectCellValue),
renderTableFilter: createFilterRender(),
tableFilterDefaultMethod(params) {
const { option, row, column } = params;
const { data } = option;
const { field, filterRender: renderOpts } = column;
@ -266,6 +266,6 @@ export default {
}
return cellValue == data;
},
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getSelectCellValue),
};
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getSelectCellValue),
} as VxeGlobalRendererOptions;

View File

@ -9,11 +9,12 @@ import {
createFormItemRender,
getComponent,
} from './common';
import { VxeGlobalRendererOptions } from 'vxe-table';
export default {
renderDefault: createDefaultRender(),
renderEdit: createEditRender(),
renderFilter(renderOpts, params) {
renderTableDefault: createDefaultRender(),
renderTableEdit: createEditRender(),
renderTableFilter(renderOpts, params) {
const { column } = params;
const { name, attrs } = renderOpts;
const Component = getComponent(name);
@ -48,6 +49,6 @@ export default {
),
];
},
defaultFilterMethod: createDefaultFilterRender(),
renderItemContent: createFormItemRender(),
};
tableFilterDefaultMethod: createDefaultFilterRender(),
renderFormItemContent: createFormItemRender(),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { getDatePickerCellValue } from './ADatePicker';
import {
createEditRender,
@ -7,12 +8,12 @@ import {
} from './common';
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getDatePickerCellValue, () => {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getDatePickerCellValue, () => {
return ['HH:mm:ss'];
}),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getDatePickerCellValue, () => {
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getDatePickerCellValue, () => {
return ['HH:mm:ss'];
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,4 +1,4 @@
import { VxeGlobalRendererHandles } from 'vxe-table';
import { VxeGlobalRendererHandles, VxeGlobalRendererOptions } from 'vxe-table';
import XEUtils from 'xe-utils';
import {
createEditRender,
@ -10,7 +10,9 @@ import {
function getTreeSelectCellValue(
renderOpts: VxeGlobalRendererHandles.RenderOptions,
params: VxeGlobalRendererHandles.RenderCellParams | VxeGlobalRendererHandles.ExportMethodParams,
params:
| VxeGlobalRendererHandles.RenderTableCellParams
| VxeGlobalRendererHandles.ExportMethodParams,
) {
const { props = {} } = renderOpts;
const { treeData, treeCheckable } = props;
@ -28,8 +30,8 @@ function getTreeSelectCellValue(
}
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getTreeSelectCellValue),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getTreeSelectCellValue),
};
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getTreeSelectCellValue),
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getTreeSelectCellValue),
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { getDatePickerCellValue } from './ADatePicker';
import {
createEditRender,
@ -7,12 +8,12 @@ import {
} from './common';
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getDatePickerCellValue, () => {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getDatePickerCellValue, () => {
return ['YYYY-WW周'];
}),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getDatePickerCellValue, () => {
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getDatePickerCellValue, () => {
return ['YYYY-WW周'];
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,3 +1,4 @@
import { VxeGlobalRendererOptions } from 'vxe-table';
import { getDatePickerCellValue } from './ADatePicker';
import {
createEditRender,
@ -7,12 +8,12 @@ import {
} from './common';
export default {
renderEdit: createEditRender(),
renderCell: createCellRender(getDatePickerCellValue, () => {
renderTableEdit: createEditRender(),
renderTableCell: createCellRender(getDatePickerCellValue, () => {
return ['YYYY'];
}),
renderItemContent: createFormItemRender(),
exportMethod: createExportMethod(getDatePickerCellValue, () => {
renderFormItemContent: createFormItemRender(),
tableExportMethod: createExportMethod(getDatePickerCellValue, () => {
return ['YYYY'];
}),
};
} as VxeGlobalRendererOptions;

View File

@ -1,7 +1,7 @@
import { ComponentOptions, h } from 'vue';
import {
FormItemContentRenderParams,
FormItemRenderOptions,
VxeFormItemPropTypes,
VxeGlobalRendererHandles,
} from 'vxe-table';
import XEUtils from 'xe-utils';
@ -160,12 +160,12 @@ export function createDefaultRender(
defaultProps?: { [key: string]: any },
callBack?: (
renderOpts: VxeGlobalRendererHandles.RenderDefaultOptions,
params: VxeGlobalRendererHandles.RenderDefaultParams,
params: VxeGlobalRendererHandles.RenderTableDefaultParams,
) => Record<string, any>,
) {
return function (
renderOpts: VxeGlobalRendererHandles.RenderDefaultOptions,
params: VxeGlobalRendererHandles.RenderDefaultParams,
params: VxeGlobalRendererHandles.RenderTableDefaultParams,
) {
const { row, column, $table } = params;
const { name, attrs } = renderOpts;
@ -195,13 +195,13 @@ export function createDefaultRender(
export function createEditRender(
defaultProps?: { [key: string]: any },
callBack?: (
renderOpts: VxeGlobalRendererHandles.RenderEditOptions,
params: VxeGlobalRendererHandles.RenderEditParams,
renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) => Record<string, any>,
) {
return function (
renderOpts: VxeGlobalRendererHandles.RenderEditOptions,
params: VxeGlobalRendererHandles.RenderEditParams,
renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions,
params: VxeGlobalRendererHandles.RenderTableEditParams,
) {
const { row, column, $table } = params;
const { name, attrs } = renderOpts;
@ -232,12 +232,12 @@ export function createFilterRender(
defaultProps?: { [key: string]: any },
callBack?: (
renderOpts: VxeGlobalRendererHandles.RenderFilterOptions,
params: VxeGlobalRendererHandles.RenderFilterParams,
params: VxeGlobalRendererHandles.RenderTableFilterParams,
) => Record<string, any>,
) {
return function (
renderOpts: VxeGlobalRendererHandles.RenderFilterOptions,
params: VxeGlobalRendererHandles.RenderFilterParams,
params: VxeGlobalRendererHandles.RenderTableFilterParams,
) {
const { column } = params;
const { name, attrs } = renderOpts;
@ -287,7 +287,7 @@ export function createFilterRender(
*/
export function createDefaultFilterRender() {
return function (params: VxeGlobalRendererHandles.FilterMethodParams) {
return function (params: VxeGlobalRendererHandles.TableFilterMethodParams) {
const { option, row, column } = params;
const { data } = option;
const cellValue = XEUtils.get(row, column.field as string);
@ -301,11 +301,14 @@ export function createDefaultFilterRender() {
export function createFormItemRender(
defaultProps?: { [key: string]: any },
callBack?: (
renderOpts: FormItemRenderOptions,
renderOpts: VxeFormItemPropTypes.ItemRender,
params: FormItemContentRenderParams,
) => Record<string, any>,
) {
return function (renderOpts: FormItemRenderOptions, params: FormItemContentRenderParams) {
return function (
renderOpts: VxeFormItemPropTypes.ItemRender,
params: FormItemContentRenderParams,
) {
const args = (callBack && callBack(renderOpts, params)) ?? {};
const { data, property, $form } = params;
const { name } = renderOpts;
@ -344,13 +347,13 @@ export function createFormItemRender(
export function createCellRender(
getSelectCellValue: Function,
callBack?: (
renderOpts: VxeGlobalRendererHandles.RenderCellOptions,
params: VxeGlobalRendererHandles.RenderCellParams,
renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions,
params: VxeGlobalRendererHandles.RenderTableCellParams,
) => Array<any>,
) {
return function (
renderOpts: VxeGlobalRendererHandles.RenderCellOptions,
params: VxeGlobalRendererHandles.RenderCellParams,
renderOpts: VxeGlobalRendererHandles.RenderTableCellOptions,
params: VxeGlobalRendererHandles.RenderTableCellParams,
) {
const args = (callBack && callBack(renderOpts, params)) ?? [];
const cellLabel = getSelectCellValue && getSelectCellValue(renderOpts, params, ...args);

View File

@ -1,4 +1,4 @@
import { VXETableCore, VxeGlobalInterceptorHandles } from 'vxe-table';
import { VxeUIExport, VxeGlobalInterceptorHandles } from 'vxe-table';
import AAutoComplete from './AAutoComplete';
import AInput from './AInput';
import AInputNumber from './AInputNumber';
@ -50,7 +50,7 @@ function getEventTargetNode(evnt: any, container: HTMLElement, className: string
function handleClearEvent(
params:
| VxeGlobalInterceptorHandles.InterceptorClearFilterParams
| VxeGlobalInterceptorHandles.InterceptorClearActivedParams
| VxeGlobalInterceptorHandles.InterceptorClearEditParams
| VxeGlobalInterceptorHandles.InterceptorClearAreasParams,
) {
const { $event } = params;
@ -73,10 +73,10 @@ function handleClearEvent(
* vxe-table ant-design-vue
*/
export const VXETablePluginAntd = {
install(vxetablecore: VXETableCore) {
install(vxetablecore: VxeUIExport) {
const { interceptor, renderer } = vxetablecore;
renderer.mixin({
const customRenderComponents = {
AAutoComplete,
AInput,
AInputNumber,
@ -99,16 +99,21 @@ export const VXETablePluginAntd = {
AEmpty,
AInputSearch,
AYearPicker,
};
Object.keys(customRenderComponents).forEach((name) => {
if (renderer.get(name)) return;
renderer.add(name, customRenderComponents[name]);
});
interceptor.add('event.clearFilter', handleClearEvent);
interceptor.add('event.clearActived', handleClearEvent);
interceptor.add('event.clearEdit', handleClearEvent);
interceptor.add('event.clearAreas', handleClearEvent);
},
};
if (typeof window !== 'undefined' && window.VXETable && window.VXETable.use) {
window.VXETable.use(VXETablePluginAntd);
if (typeof window !== 'undefined' && window.VxeUI && window.VxeUI.use) {
window.VxeUI.use(VXETablePluginAntd);
}
export default VXETablePluginAntd;

View File

@ -2,4 +2,5 @@
@import './variable';
@import './toolbar';
@import './component';
@import 'vxe-table/styles/index';
@import 'vxe-table/styles/all';
@import 'vxe-pc-ui/styles/all';

View File

@ -1,4 +1,4 @@
import { VXETable } from '..';
import { VxeUI } from '..';
import componentSetting from '@/settings/componentSetting';
VXETable.setup(componentSetting.vxeTable);
VxeUI.setConfig(componentSetting.vxeTable);

View File

@ -2,7 +2,8 @@ import type { App } from 'vue';
import { Button } from './Button';
import { Input, Layout } from 'ant-design-vue';
import VXETable from 'vxe-table';
import VXEUI from 'vxe-pc-ui';
export function registerGlobComp(app: App) {
app.use(Input).use(Button).use(Layout).use(VXETable);
app.use(Input).use(Button).use(Layout).use(VXETable).use(VXEUI);
}

View File

@ -177,4 +177,4 @@
"resizeParentHeightTable": "resizeParentHeightTable",
"vxeTable": "VxeTable"
}
}
}

View File

@ -176,4 +176,4 @@
"resizeParentHeightTable": "继承父元素高度",
"vxeTable": "VxeTable"
}
}
}

View File

@ -24,7 +24,7 @@ import { Persistent } from '@/utils/cache/persistent';
export function initAppConfigStore() {
const localeStore = useLocaleStore();
const appStore = useAppStore();
let projCfg: ProjectConfig = Persistent.getLocal(PROJ_CFG_KEY) as ProjectConfig;
let projCfg = Persistent.getLocal<ProjectConfig>(PROJ_CFG_KEY);
projCfg = deepMerge(projectSetting, projCfg || {});
const darkMode = appStore.getDarkMode;
const {

View File

@ -61,10 +61,10 @@ export function createPermissionGuard(router: Router) {
path: LOGIN_PATH,
replace: true,
};
if (to.path) {
if (to.fullPath) {
redirectData.query = {
...redirectData.query,
redirect: to.path,
redirect: to.fullPath,
};
}
next(redirectData);

View File

@ -134,7 +134,9 @@ export const useMultipleTabStore = defineStore({
// Existing pages, do not add tabs repeatedly
const tabHasExits = this.tabList.some((tab, index) => {
updateIndex = index;
return decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path);
return (
decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path)
);
});
// If the tab already exists, perform the update operation

View File

@ -16,8 +16,6 @@ export class AxiosRetry {
return Promise.reject(error);
}
config.__retryCount += 1;
//请求返回后config的header不正确造成重试请求失败,删除返回headers采用默认headers
delete config.headers;
return this.delay(waitTime).then(() => axiosInstance(config));
}

View File

@ -18,8 +18,8 @@
import { useMessage } from '@/hooks/web/useMessage';
import { PageWrapper } from '@/components/Page';
import { isAccountExist } from '@/api/demo/system';
import dayjs from "dayjs"
import dayjs from 'dayjs';
const schemas: FormSchema[] = [
{
field: 'field1',
@ -236,7 +236,7 @@
field5: ['1'],
field7: '1',
field33: '2020-12-12',
field3: dayjs('2020-12-12',"YYYY-MM-DD"),
field3: dayjs('2020-12-12', 'YYYY-MM-DD'),
});
}