diff --git a/packages/button/src/button.ts b/packages/button/src/button.ts index 39053f44d781f25b5c7680a0cbf980bdac723f81..981d3cd7407a590121351cf4b12f2e1978867e30 100644 --- a/packages/button/src/button.ts +++ b/packages/button/src/button.ts @@ -14,8 +14,8 @@ export default defineComponent({ /** * 按钮类型 */ - type: String as PropType, - className: String as PropType, + type: { type: String as PropType, default: () => GlobalConfig.button.type }, + className: { type: String as PropType, default: () => GlobalConfig.button.className }, /** * 按钮尺寸 */ @@ -23,47 +23,51 @@ export default defineComponent({ /** * 用来标识这一项 */ - name: [String, Number] as PropType, + name: { type: [String, Number] as PropType, default: () => GlobalConfig.button.name }, /** * 按钮内容 */ - content: String as PropType, + content: { type: String as PropType, default: () => GlobalConfig.button.content }, /** * 固定显示下拉面板的方向 */ - placement: String as PropType, + placement: { type: String as PropType, default: () => GlobalConfig.button.placement }, /** * 按钮状态 */ - status: String as PropType, + status: { type: String as PropType, default: () => GlobalConfig.button.status }, /** * 按钮的图标 */ - icon: String as PropType, + icon: { type: String as PropType, default: () => GlobalConfig.button.icon }, /** * 圆角边框 */ - round: Boolean as PropType, + round: { type: Boolean as PropType, default: () => GlobalConfig.button.round }, /** * 圆角按钮 */ - circle: Boolean as PropType, + circle: { type: Boolean as PropType, default: () => GlobalConfig.button.circle }, /** * 是否禁用 */ - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.button.disabled }, /** * 是否加载中 */ - loading: Boolean as PropType, + loading: { type: Boolean as PropType, default: () => GlobalConfig.button.loading }, /** * 在下拉面板关闭时销毁内容 */ - destroyOnClose: Boolean as PropType, + destroyOnClose: { type: Boolean as PropType, default: () => GlobalConfig.button.destroyOnClose }, /** * 是否将弹框容器插入于 body 内 */ - transfer: { type: Boolean as PropType, default: () => GlobalConfig.button.transfer } + transfer: { type: Boolean as PropType, default: () => GlobalConfig.button.transfer }, + /** + * 按钮点击回调方法 + */ + click: { type: Function as PropType } }, emits: [ 'click', @@ -199,6 +203,10 @@ export default defineComponent({ } const clickEvent = (evnt: Event) => { + if (props.click) { + // 回调按钮点击事件 + props.click({ $event: evnt, props: this.props }, evnt) + } buttonMethods.dispatchEvent('click', { $event: evnt }, evnt) } diff --git a/packages/form/src/form-item.ts b/packages/form/src/form-item.ts index 8ec55935dfb3ba5ac67e14935387c1b7ee615239..fb52206be23c0dfcbe42d71ca10f262d9546c457 100644 --- a/packages/form/src/form-item.ts +++ b/packages/form/src/form-item.ts @@ -9,22 +9,22 @@ import { renderTitle } from './render' import { VxeFormConstructor, VxeFormDefines, VxeFormItemPropTypes, VxeFormPrivateMethods } from '../../../types/all' export const formItemProps = { - title: String as PropType, + title: { type: String as PropType, default: () => GlobalConfig.formItem.title }, field: String as PropType, - span: [String, Number] as PropType, - align: String as PropType, - titleAlign: String as PropType, - titleWidth: [String, Number] as PropType, - className: [String, Function] as PropType, - titleOverflow: { type: [Boolean, String] as PropType, default: null }, - titlePrefix: Object as PropType, - titleSuffix: Object as PropType, - resetValue: { default: null }, - visibleMethod: Function as PropType, - visible: { type: Boolean as PropType, default: null }, - folding: Boolean as PropType, - collapseNode: Boolean as PropType, - itemRender: Object as PropType + span: { type: [String, Number] as PropType, default: () => GlobalConfig.formItem.span }, + align: { type: String as PropType, default: () => GlobalConfig.formItem.align }, + titleAlign: { type: String as PropType, default: () => GlobalConfig.formItem.titleAlign }, + titleWidth: { type: [String, Number] as PropType, default: () => GlobalConfig.formItem.titleWidth }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.formItem.className }, + titleOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.formItem.titleOverflow }, + titlePrefix: { type: Object as PropType, default: () => GlobalConfig.formItem.titlePrefix }, + titleSuffix: { type: Object as PropType, default: () => GlobalConfig.formItem.titleSuffix }, + resetValue: { type: Object as PropType, default: () => GlobalConfig.formItem.resetValue }, + visibleMethod: { type: Function as PropType, default: () => GlobalConfig.formItem.visibleMethod }, + visible: { type: Boolean as PropType, default: () => GlobalConfig.formItem.visible }, + folding: { type: Boolean as PropType, default: () => GlobalConfig.formItem.folding }, + collapseNode: { type: Boolean as PropType, default: () => GlobalConfig.formItem.collapseNode }, + itemRender: { type: Object as PropType, default: () => GlobalConfig.formItem.itemRender } } export default defineComponent({ diff --git a/packages/form/src/form.ts b/packages/form/src/form.ts index 9fbf1b4b534696b9452f6ede00f3de59b88616b6..12513c1af36de0ec754a3eef64bfeac006a7335d 100644 --- a/packages/form/src/form.ts +++ b/packages/form/src/form.ts @@ -69,9 +69,9 @@ function getResetValue (value: any, resetValue: any) { export default defineComponent({ name: 'VxeForm', props: { - collapseStatus: { type: Boolean as PropType, default: true }, - loading: Boolean as PropType, - data: Object as PropType, + collapseStatus: { type: Boolean as PropType, default: () => GlobalConfig.form.collapseStatus }, + loading: { type: Boolean as PropType, default: () => GlobalConfig.form.loading }, + data: { type: Object as PropType }, size: { type: String as PropType, default: () => GlobalConfig.form.size || GlobalConfig.size }, span: { type: [String, Number] as PropType, default: () => GlobalConfig.form.span }, align: { type: String as PropType, default: () => GlobalConfig.form.align }, @@ -79,13 +79,13 @@ export default defineComponent({ titleWidth: { type: [String, Number] as PropType, default: () => GlobalConfig.form.titleWidth }, titleColon: { type: Boolean as PropType, default: () => GlobalConfig.form.titleColon }, titleAsterisk: { type: Boolean as PropType, default: () => GlobalConfig.form.titleAsterisk }, - titleOverflow: { type: [Boolean, String] as PropType, default: null }, - className: [String, Function] as PropType, + titleOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.form.titleOverflow }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.form.className }, items: Array as PropType, rules: Object as PropType, preventSubmit: { type: Boolean as PropType, default: () => GlobalConfig.form.preventSubmit }, - validConfig: Object as PropType, - tooltipConfig: Object as PropType, + validConfig: { type: Object as PropType, default: () => GlobalConfig.form.validConfig }, + tooltipConfig: { type: Object as PropType, default: () => GlobalConfig.form.tooltipConfig }, customLayout: { type: Boolean as PropType, default: () => GlobalConfig.form.customLayout } }, emits: [ diff --git a/packages/input/src/input.ts b/packages/input/src/input.ts index 7920645564256502e7579a3a6438241b06373721..d2c7abb205cdec61a983edbbafe168c47efa3f4c 100644 --- a/packages/input/src/input.ts +++ b/packages/input/src/input.ts @@ -83,24 +83,24 @@ export default defineComponent({ name: 'VxeInput', props: { modelValue: [String, Number, Date] as PropType, - immediate: { type: Boolean as PropType, default: true }, + immediate: { type: Boolean as PropType, default: () => GlobalConfig.input.immediate }, name: String as PropType, - type: { type: String as PropType, default: 'text' }, + type: { type: String as PropType, default: () => GlobalConfig.input.type }, clearable: { type: Boolean as PropType, default: () => GlobalConfig.input.clearable }, - readonly: Boolean as PropType, - disabled: Boolean as PropType, - placeholder: String as PropType, - maxlength: [String, Number] as PropType, - autocomplete: { type: String as PropType, default: 'off' }, - align: String as PropType, + readonly: { type: Boolean as PropType, default: () => GlobalConfig.input.readonly }, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.input.disabled }, + placeholder: { type: String as PropType, default: () => GlobalConfig.input.placeholder }, + maxlength: { type: [String, Number] as PropType, default: () => GlobalConfig.input.maxlength }, + autocomplete: { type: String as PropType, default: () => GlobalConfig.input.autocomplete }, + align: { type: String as PropType, default: () => GlobalConfig.input.align }, form: String as PropType, - className: String as PropType, + className: { type: String as PropType, default: () => GlobalConfig.input.className }, size: { type: String as PropType, default: () => GlobalConfig.input.size || GlobalConfig.size }, // number、integer、float - min: { type: [String, Number] as PropType, default: null }, - max: { type: [String, Number] as PropType, default: null }, - step: [String, Number] as PropType, + min: { type: [String, Number] as PropType, default: () => GlobalConfig.input.min }, + max: { type: [String, Number] as PropType, default: () => GlobalConfig.input.max }, + step: { type: [String, Number] as PropType, default: () => GlobalConfig.input.step }, exponential: { type: Boolean as PropType, default: () => GlobalConfig.input.exponential }, // number、integer、float、password @@ -117,16 +117,16 @@ export default defineComponent({ startDay: { type: [String, Number] as PropType, default: () => GlobalConfig.input.startDay }, labelFormat: { type: String as PropType, default: () => GlobalConfig.input.labelFormat }, valueFormat: { type: String as PropType, default: () => GlobalConfig.input.valueFormat }, - editable: { type: Boolean as PropType, default: true }, + editable: { type: Boolean as PropType, default: () => GlobalConfig.input.editable }, festivalMethod: { type: Function as PropType, default: () => GlobalConfig.input.festivalMethod }, disabledMethod: { type: Function as PropType, default: () => GlobalConfig.input.disabledMethod }, // week selectDay: { type: [String, Number] as PropType, default: () => GlobalConfig.input.selectDay }, - prefixIcon: String as PropType, - suffixIcon: String as PropType, - placement: String as PropType, + prefixIcon: { type: String as PropType, default: () => GlobalConfig.input.prefixIcon }, + suffixIcon: { type: String as PropType, default: () => GlobalConfig.input.suffixIcon }, + placement: { type: String as PropType, default: () => GlobalConfig.input.placement }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.input.transfer } }, emits: [ diff --git a/packages/modal/src/modal.ts b/packages/modal/src/modal.ts index 1c924084ca8a2aedd1702331d45d347ecc804e73..48cabafcbc342839b29b4713a6d0e3d34b75f286 100644 --- a/packages/modal/src/modal.ts +++ b/packages/modal/src/modal.ts @@ -17,37 +17,37 @@ export default defineComponent({ props: { modelValue: Boolean as PropType, id: String as PropType, - type: { type: String as PropType, default: 'modal' }, - loading: { type: Boolean as PropType, default: null }, - status: String as PropType, - iconStatus: String as PropType, - className: String as PropType, + type: { type: String as PropType, default: () => GlobalConfig.modal.type }, + loading: { type: Boolean as PropType, default: () => GlobalConfig.modal.loading }, + status: { type: String as PropType, default: () => GlobalConfig.modal.status }, + iconStatus: { type: String as PropType, default: () => GlobalConfig.modal.iconStatus }, + className: { type: String as PropType, default: () => GlobalConfig.modal.className }, top: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.top }, - position: [String, Object] as PropType, - title: String as PropType, + position: { type: [String, Object] as PropType, default: () => GlobalConfig.modal.position }, + title: { type: String as PropType, default: () => GlobalConfig.modal.title }, duration: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.duration }, - message: [Number, String] as PropType, - content: [Number, String] as PropType, + message: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.message }, + content: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.content }, cancelButtonText: { type: String as PropType, default: () => GlobalConfig.modal.cancelButtonText }, confirmButtonText: { type: String as PropType, default: () => GlobalConfig.modal.confirmButtonText }, lockView: { type: Boolean as PropType, default: () => GlobalConfig.modal.lockView }, - lockScroll: Boolean as PropType, + lockScroll: { type: Boolean as PropType, default: () => GlobalConfig.modal.lockScroll }, mask: { type: Boolean as PropType, default: () => GlobalConfig.modal.mask }, maskClosable: { type: Boolean as PropType, default: () => GlobalConfig.modal.maskClosable }, escClosable: { type: Boolean as PropType, default: () => GlobalConfig.modal.escClosable }, - resize: Boolean as PropType, + resize: { type: Boolean as PropType, default: () => GlobalConfig.modal.resize }, showHeader: { type: Boolean as PropType, default: () => GlobalConfig.modal.showHeader }, showFooter: { type: Boolean as PropType, default: () => GlobalConfig.modal.showFooter }, - showZoom: Boolean as PropType, + showZoom: { type: Boolean as PropType, default: () => GlobalConfig.modal.showZoom }, showClose: { type: Boolean as PropType, default: () => GlobalConfig.modal.showClose }, dblclickZoom: { type: Boolean as PropType, default: () => GlobalConfig.modal.dblclickZoom }, - width: [Number, String] as PropType, - height: [Number, String] as PropType, + width: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.width }, + height: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.height }, minWidth: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.minWidth }, minHeight: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.minHeight }, - zIndex: Number as PropType, + zIndex: { type: Number as PropType, default: () => GlobalConfig.modal.zIndex }, marginSize: { type: [Number, String] as PropType, default: () => GlobalConfig.modal.marginSize }, - fullscreen: Boolean as PropType, + fullscreen: { type: Boolean as PropType, default: () => GlobalConfig.modal.fullscreen }, draggable: { type: Boolean as PropType, default: () => GlobalConfig.modal.draggable }, remember: { type: Boolean, default: () => GlobalConfig.modal.remember }, destroyOnClose: { type: Boolean as PropType, default: () => GlobalConfig.modal.destroyOnClose }, diff --git a/packages/pager/src/pager.ts b/packages/pager/src/pager.ts index ab0a03445496e39e9c8203afd2fe9a0669040506..f1c657b7786496ccd783b19fadfb3ee366603bbd 100644 --- a/packages/pager/src/pager.ts +++ b/packages/pager/src/pager.ts @@ -35,13 +35,13 @@ export default defineComponent({ // 当只有一页时隐藏 autoHidden: { type: Boolean as PropType, default: () => GlobalConfig.pager.autoHidden }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.pager.transfer }, - className: [String, Function] as PropType, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.pager.className }, // 自定义图标 - iconPrevPage: String as PropType, - iconJumpPrev: String as PropType, - iconJumpNext: String as PropType, - iconNextPage: String as PropType, - iconJumpMore: String as PropType + iconPrevPage: { type: String as PropType, default: () => GlobalConfig.pager.iconPrevPage }, + iconJumpPrev: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpPrev }, + iconJumpNext: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpNext }, + iconNextPage: { type: String as PropType, default: () => GlobalConfig.pager.iconNextPage }, + iconJumpMore: { type: String as PropType, default: () => GlobalConfig.pager.iconJumpMore } }, emits: [ 'update:pageSize', diff --git a/packages/radio/src/group.ts b/packages/radio/src/group.ts index 1099d8866ca0ca635ba29607a33b6843f1c2d6de..f724bd83bb195753a1105553a402cb87f5453685 100644 --- a/packages/radio/src/group.ts +++ b/packages/radio/src/group.ts @@ -3,13 +3,20 @@ import XEUtils from 'xe-utils' import GlobalConfig from '../../v-x-e-table/src/conf' import { useSize } from '../../hooks/size' -import { VxeRadioGroupPropTypes, VxeRadioGroupConstructor, VxeRadioGroupEmits, VxeRadioGroupPrivateMethods, RadioGroupPrivateMethods, RadioGroupMethods } from '../../../types/all' +import { + VxeRadioGroupPropTypes, + VxeRadioGroupConstructor, + VxeRadioGroupEmits, + VxeRadioGroupPrivateMethods, + RadioGroupPrivateMethods, + RadioGroupMethods +} from '../../../types/all' export default defineComponent({ name: 'VxeRadioGroup', props: { modelValue: [String, Number, Boolean] as PropType, - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.radio.disabled }, size: { type: String as PropType, default: () => GlobalConfig.radio.size || GlobalConfig.size } }, emits: [ diff --git a/packages/select/src/select.ts b/packages/select/src/select.ts index 5a8a7ac03d5906a92038a80f130580a07040bb5a..a7cc717aea12aa479faced528a1ed60aea739750 100644 --- a/packages/select/src/select.ts +++ b/packages/select/src/select.ts @@ -6,7 +6,18 @@ import { getEventTargetNode, getAbsolutePos } from '../../tools/dom' import { getLastZIndex, nextZIndex, getFuncText, formatText } from '../../tools/utils' import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event' -import { VxeSelectPropTypes, VxeSelectConstructor, SelectReactData, VxeSelectEmits, SelectMethods, SelectPrivateRef, VxeSelectMethods, VxeInputConstructor, VxeOptgroupProps, VxeOptionProps } from '../../../types/all' +import { + VxeSelectPropTypes, + VxeSelectConstructor, + SelectReactData, + VxeSelectEmits, + SelectMethods, + SelectPrivateRef, + VxeSelectMethods, + VxeInputConstructor, + VxeOptgroupProps, + VxeOptionProps +} from '../../../types/all' function isOptionVisible (option: any) { return option.visible !== false @@ -20,23 +31,23 @@ export default defineComponent({ name: 'VxeSelect', props: { modelValue: null, - clearable: Boolean as PropType, - placeholder: String as PropType, + clearable: { type: Boolean as PropType, default: () => GlobalConfig.select.clearable }, + placeholder: { type: String as PropType, default: () => GlobalConfig.select.placeholder }, loading: Boolean as PropType, - disabled: Boolean as PropType, - multiple: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.select.disabled }, + multiple: { type: Boolean as PropType, default: () => GlobalConfig.select.multiple }, multiCharOverflow: { type: [Number, String] as PropType, default: () => GlobalConfig.select.multiCharOverflow }, - prefixIcon: String as PropType, - placement: String as PropType, - options: Array as PropType, - optionProps: Object as PropType, - optionGroups: Array as PropType, - optionGroupProps: Object as PropType, - className: [String, Function] as PropType, + prefixIcon: { type: String as PropType, default: () => GlobalConfig.select.prefixIcon }, + placement: { type: String as PropType, default: () => GlobalConfig.select.placement }, + options: { type: Array as PropType, default: () => GlobalConfig.select.options }, + optionProps: { type: Object as PropType, default: () => GlobalConfig.select.optionProps }, + optionGroups: { type: Array as PropType, default: () => GlobalConfig.select.optionGroups }, + optionGroupProps: { type: Object as PropType, default: () => GlobalConfig.select.optionGroupProps }, + className: { type: [String, Function] as PropType, default: () => GlobalConfig.select.className }, size: { type: String as PropType, default: () => GlobalConfig.select.size || GlobalConfig.size }, - emptyText: String as PropType, + emptyText: { type: String as PropType, default: () => GlobalConfig.select.emptyText }, optionId: { type: String as PropType, default: () => GlobalConfig.select.optionId }, - optionKey: Boolean as PropType, + optionKey: { type: Boolean as PropType, default: () => GlobalConfig.select.optionKey }, transfer: { type: Boolean as PropType, default: () => GlobalConfig.select.transfer } }, emits: [ diff --git a/packages/switch/src/switch.ts b/packages/switch/src/switch.ts index a8bb396e4b20d6d988e0603c41047be97cbf456d..e27c60d782f3f8b26e984ea8c0833c3a2502f2de 100644 --- a/packages/switch/src/switch.ts +++ b/packages/switch/src/switch.ts @@ -10,14 +10,14 @@ export default defineComponent({ name: 'VxeSwitch', props: { modelValue: [String, Number, Boolean] as PropType, - disabled: Boolean as PropType, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.switch.disabled }, size: { type: String as PropType, default: () => GlobalConfig.switch.size || GlobalConfig.size }, - openLabel: String as PropType, - closeLabel: String as PropType, - openValue: { type: [String, Number, Boolean] as PropType, default: true }, - closeValue: { type: [String, Number, Boolean] as PropType, default: false }, - openIcon: String as PropType, - closeIcon: String as PropType + openLabel: { type: String as PropType, default: () => GlobalConfig.switch.openLabel }, + closeLabel: { type: String as PropType, default: () => GlobalConfig.switch.closeLabel }, + openValue: { type: [String, Number, Boolean] as PropType, default: () => GlobalConfig.switch.openValue }, + closeValue: { type: [String, Number, Boolean] as PropType, default: () => GlobalConfig.switch.closeValue }, + openIcon: { type: String as PropType, default: () => GlobalConfig.switch.openIcon }, + closeIcon: { type: String as PropType, default: () => GlobalConfig.switch.closeIcon } }, emits: [ 'update:modelValue', diff --git a/packages/table/src/props.ts b/packages/table/src/props.ts index 586d8e2072fae9b2e04edb743ef8b566d0e1f80a..9b33a3b644766de2ff40c8eb53e4bad843751b14 100644 --- a/packages/table/src/props.ts +++ b/packages/table/src/props.ts @@ -9,9 +9,9 @@ export default { // 数据 data: Array as PropType, // 表格的高度 - height: [Number, String] as PropType, + height: { type: [Number, String] as PropType, default: () => GlobalConfig.table.height }, // 表格的最大高度 - maxHeight: [Number, String] as PropType, + maxHeight: { type: [Number, String] as PropType, default: () => GlobalConfig.table.maxHeight }, // 所有列是否允许拖动列宽调整大小 resizable: { type: Boolean as PropType, default: () => GlobalConfig.table.resizable }, // 是否带有斑马纹 @@ -43,43 +43,43 @@ export default { // 鼠标移到列是否要高亮显示 highlightHoverColumn: { type: Boolean as PropType, default: () => GlobalConfig.table.highlightHoverColumn }, // 激活单元格编辑时是否高亮显示 - highlightCell: Boolean as PropType, + highlightCell: { type: Boolean as PropType, default: () => GlobalConfig.table.highlightCell }, // 是否显示表尾合计 - showFooter: Boolean as PropType, + showFooter: { type: Boolean as PropType, default: () => GlobalConfig.table.showFooter }, // 表尾合计的计算方法 - footerMethod: Function as PropType, + footerMethod: { type: Function as PropType, default: () => GlobalConfig.table.footerMethod }, // 给行附加 className - rowClassName: [String, Function] as PropType, + rowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.rowClassName }, // 给单元格附加 className - cellClassName: [String, Function] as PropType, + cellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.cellClassName }, // 给表头的行附加 className - headerRowClassName: [String, Function] as PropType, + headerRowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.headerRowClassName }, // 给表头的单元格附加 className - headerCellClassName: [String, Function] as PropType, + headerCellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.headerCellClassName }, // 给表尾的行附加 className - footerRowClassName: [String, Function] as PropType, + footerRowClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.footerRowClassName }, // 给表尾的单元格附加 className - footerCellClassName: [String, Function] as PropType, + footerCellClassName: { type: [String, Function] as PropType, default: () => GlobalConfig.table.footerCellClassName }, // 给单元格附加样式 - cellStyle: [Object, Function] as PropType, + cellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.cellStyle }, // 给表头单元格附加样式 - headerCellStyle: [Object, Function] as PropType, + headerCellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.headerCellStyle }, // 给表尾单元格附加样式 - footerCellStyle: [Object, Function] as PropType, + footerCellStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.footerCellStyle }, // 给行附加样式 - rowStyle: [Object, Function] as PropType, + rowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.rowStyle }, // 给表头行附加样式 - headerRowStyle: [Object, Function] as PropType, + headerRowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.headerRowStyle }, // 给表尾行附加样式 - footerRowStyle: [Object, Function] as PropType, + footerRowStyle: { type: [Object, Function] as PropType, default: () => GlobalConfig.table.footerRowStyle }, // 合并指定单元格 - mergeCells: Array as PropType, + mergeCells: { type: Array as PropType, default: () => GlobalConfig.table.mergeCells }, // 合并指定的表尾 - mergeFooterItems: Array as PropType, + mergeFooterItems: { type: Array as PropType, default: () => GlobalConfig.table.mergeFooterItems }, // 自定义合并行或列的方法 - spanMethod: Function as PropType, + spanMethod: { type: Function as PropType }, // 表尾合并行或列 - footerSpanMethod: Function as PropType, + footerSpanMethod: { type: Function as PropType }, // 设置所有内容过长时显示为省略号 showOverflow: { type: [Boolean, String] as PropType, default: () => GlobalConfig.table.showOverflow }, // 设置表头所有内容过长时显示为省略号 @@ -89,16 +89,16 @@ export default { /** 高级属性 */ // 主键配置 - columnKey: Boolean as PropType, - rowKey: Boolean as PropType, + columnKey: { type: Boolean as PropType, default: () => GlobalConfig.table.columnKey }, + rowKey: { type: Boolean as PropType, default: () => GlobalConfig.table.rowKey }, rowId: { type: String as PropType, default: () => GlobalConfig.table.rowId }, - zIndex: Number as PropType, + zIndex: { type: Number as PropType, default: () => GlobalConfig.table.zIndex }, emptyText: { type: String as PropType, default: () => GlobalConfig.table.emptyText }, keepSource: { type: Boolean as PropType, default: () => GlobalConfig.table.keepSource }, // 是否自动监听父容器变化去更新响应式表格宽高 autoResize: { type: Boolean as PropType, default: () => GlobalConfig.table.autoResize }, // 是否自动根据状态属性去更新响应式表格宽高 - syncResize: [Boolean, String, Number], + syncResize: { type: [Boolean, String, Number], default: () => GlobalConfig.table.syncResize }, // 列配置信息 columnConfig: Object as PropType, // 行配置信息 diff --git a/packages/textarea/src/textarea.ts b/packages/textarea/src/textarea.ts index 40220e7be2414457fae6729f14d8e6ae582b61c9..754d795746d4eaef84e88bbac33fc6c8aa2cb050 100644 --- a/packages/textarea/src/textarea.ts +++ b/packages/textarea/src/textarea.ts @@ -12,19 +12,19 @@ export default defineComponent({ name: 'VxeTextarea', props: { modelValue: [String, Number] as PropType, - className: String as PropType, - immediate: { type: Boolean as PropType, default: true }, + className: { type: String as PropType, default: () => GlobalConfig.textarea.className }, + immediate: { type: Boolean as PropType, default: () => GlobalConfig.textarea.immediate }, name: String as PropType, - readonly: Boolean as PropType, - disabled: Boolean as PropType, - placeholder: String as PropType, - maxlength: [String, Number] as PropType, - rows: { type: [String, Number] as PropType, default: 2 }, - cols: { type: [String, Number] as PropType, default: null }, - showWordCount: Boolean as PropType, - countMethod: Function as PropType, - autosize: [Boolean, Object] as PropType, - form: String as PropType, + readonly: { type: Boolean as PropType, default: () => GlobalConfig.textarea.readonly }, + disabled: { type: Boolean as PropType, default: () => GlobalConfig.textarea.disabled }, + placeholder: { type: String as PropType, default: () => GlobalConfig.textarea.placeholder }, + maxlength: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.maxlength }, + rows: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.rows }, + cols: { type: [String, Number] as PropType, default: () => GlobalConfig.textarea.cols }, + showWordCount: { type: Boolean as PropType, default: () => GlobalConfig.textarea.showWordCount }, + countMethod: { type: Function as PropType }, + autosize: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.textarea.autosize }, + form: { type: String as PropType, default: () => GlobalConfig.textarea.form }, resize: { type: String as PropType, default: () => GlobalConfig.textarea.resize }, size: { type: String as PropType, default: () => GlobalConfig.textarea.size || GlobalConfig.size } }, diff --git a/packages/toolbar/src/toolbar.ts b/packages/toolbar/src/toolbar.ts index c4516f4e8b5dee0cd50286a1751cbc316b4ba746..dce256a69e11ca4be9b00e449595aed1bfa323e1 100644 --- a/packages/toolbar/src/toolbar.ts +++ b/packages/toolbar/src/toolbar.ts @@ -13,17 +13,17 @@ export default defineComponent({ name: 'VxeToolbar', props: { loading: Boolean, - refresh: [Boolean, Object] as PropType, - import: [Boolean, Object] as PropType, - export: [Boolean, Object] as PropType, - print: [Boolean, Object] as PropType, - zoom: [Boolean, Object] as PropType< VxeToolbarPropTypes.Zoom>, - custom: [Boolean, Object] as PropType, + refresh: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.refresh }, + import: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.import }, + export: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.export }, + print: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.print }, + zoom: { type: [Boolean, Object] as PropType< VxeToolbarPropTypes.Zoom>, default: () => GlobalConfig.toolbar.zoom }, + custom: { type: [Boolean, Object] as PropType, default: () => GlobalConfig.toolbar.custom }, buttons: { type: Array as PropType, default: () => GlobalConfig.toolbar.buttons }, tools: { type: Array as PropType, default: () => GlobalConfig.toolbar.tools }, perfect: { type: Boolean as PropType, default: () => GlobalConfig.toolbar.perfect }, size: { type: String as PropType, default: () => GlobalConfig.toolbar.size || GlobalConfig.size }, - className: [String, Function] as PropType + className: { type: [String, Function] as PropType, default: () => GlobalConfig.toolbar.className } }, emits: [ 'button-click', diff --git a/packages/tooltip/src/tooltip.ts b/packages/tooltip/src/tooltip.ts index 353475a0d172c0e1a32e74c275e9f69494f47cd3..cdebb3edd7a74aa9e22db57d296d16e715141230 100644 --- a/packages/tooltip/src/tooltip.ts +++ b/packages/tooltip/src/tooltip.ts @@ -14,12 +14,12 @@ export default defineComponent({ size: { type: String as PropType, default: () => GlobalConfig.tooltip.size || GlobalConfig.size }, trigger: { type: String as PropType, default: () => GlobalConfig.tooltip.trigger }, theme: { type: String as PropType, default: () => GlobalConfig.tooltip.theme }, - content: [String, Number] as PropType, - zIndex: [String, Number] as PropType, + content: { type: [String, Number] as PropType, default: () => GlobalConfig.tooltip.content }, + zIndex: { type: [String, Number] as PropType, default: () => GlobalConfig.tooltip.zIndex }, isArrow: { type: Boolean as PropType, default: true }, - enterable: Boolean as PropType, + enterable: { type: Boolean as PropType, default: () => GlobalConfig.tooltip.enterable }, leaveDelay: { type: Number as PropType, default: () => GlobalConfig.tooltip.leaveDelay }, - leaveMethod: Function as PropType + leaveMethod: { type: Function as PropType, default: () => GlobalConfig.tooltip.leaveMethod } }, emits: [ 'update:modelValue' diff --git a/packages/v-x-e-table/src/conf.ts b/packages/v-x-e-table/src/conf.ts index ad7a9c7bd44a0e36499df71e96f67165acbc925b..0745ba62ae8b15fd8678dccae3860c2c0f38904e 100644 --- a/packages/v-x-e-table/src/conf.ts +++ b/packages/v-x-e-table/src/conf.ts @@ -232,10 +232,10 @@ const GlobalConfig: VXETableGlobalConfig = { // size: null, // autoHidden: false, // perfect: true, - // pageSize: 10, - // pagerCount: 7, - // pageSizes: [10, 15, 20, 50, 100], - // layouts: ['PrevJump', 'PrevPage', 'Jump', 'PageCount', 'NextPage', 'NextJump', 'Sizes', 'Total'] + pageSize: 10, + pagerCount: 7, + pageSizes: [10, 15, 20, 50, 100], + layouts: ['PrevJump', 'PrevPage', 'Jump', 'PageCount', 'NextPage', 'NextJump', 'Sizes', 'Total'] }, form: { // preventSubmit: false, @@ -245,9 +245,14 @@ const GlobalConfig: VXETableGlobalConfig = { }, // size: null, // colon: false, - titleAsterisk: true + titleAsterisk: true, + collapseStatus: true + }, + formItem: { + // span: 8 }, input: { + type: 'text', // size: null, // transfer: false // parseFormat: 'yyyy-MM-dd HH:mm:ss.SSS', @@ -258,7 +263,10 @@ const GlobalConfig: VXETableGlobalConfig = { startDay: 1, selectDay: 1, digits: 2, - controls: true + controls: true, + immediate: true, + autocomplete: 'off', + editable: true }, textarea: { // size: null, @@ -266,6 +274,8 @@ const GlobalConfig: VXETableGlobalConfig = { // minRows: 1, // maxRows: 10 // } + immediate: true, + rows: 2 }, select: { // size: null, @@ -297,6 +307,8 @@ const GlobalConfig: VXETableGlobalConfig = { }, switch: { // size: null + openValue: true, + closeValue: false }, modal: { // size: null, @@ -314,7 +326,8 @@ const GlobalConfig: VXETableGlobalConfig = { showClose: true, draggable: true, // storage: false, - storageKey: 'VXE_MODAL_POSITION' + storageKey: 'VXE_MODAL_POSITION', + type: 'modal' }, list: { // size: null, diff --git a/styles/form.scss b/styles/form.scss index 86030c5255786c63487f5655c442bceac140d984..4dd11486d5fda33c81a3f0200e867aa112821e9d 100644 --- a/styles/form.scss +++ b/styles/form.scss @@ -179,6 +179,7 @@ .vxe-form--item-content { position: relative; flex-grow: 1; + width: 100%; } } .vxe-default-input, diff --git a/styles/pager.scss b/styles/pager.scss index 0c6c0023db2a59b7530172312ce15e4f9a1eac94..eed708abff8877e7324b6c4be2528ec20aff74d3 100644 --- a/styles/pager.scss +++ b/styles/pager.scss @@ -221,7 +221,7 @@ font-weight: 700; } } - .vxe-pager--sizes { + .vxe-select.size--mini.vxe-pager--sizes { width: 7em; text-align: center; cursor: pointer; diff --git a/styles/switch.scss b/styles/switch.scss index 7a71493771b547b09524959a139f50316f7dddfe..0d3a4c8fd589b5a7264ab03e510e30d69a56b2a5 100644 --- a/styles/switch.scss +++ b/styles/switch.scss @@ -4,7 +4,7 @@ display: inline-block; color: $vxe-font-color; vertical-align: middle; - padding: 0.4em; + padding: 0.3em; user-select: none; text-align: center; &.is--animat { diff --git a/types/button.d.ts b/types/button.d.ts index 82502205f1fad8e3e00b6bb6204d042cb459ccd1..155a73897b78c06bc839f4163cb14dd1802664bd 100644 --- a/types/button.d.ts +++ b/types/button.d.ts @@ -51,6 +51,7 @@ export namespace VxeButtonPropTypes { export type Loading = boolean; export type DestroyOnClose = boolean; export type Transfer = boolean; + export type Click = Function; } export type VxeButtonProps = { @@ -104,6 +105,10 @@ export type VxeButtonProps = { * 是否将弹框容器插入于 body 内 */ transfer?: VxeButtonPropTypes.Transfer; + /** + * 按钮点击回调方法 + */ + click?: VxeButtonPropTypes.Click; } export interface ButtonMethods { diff --git a/types/table.d.ts b/types/table.d.ts index af4cd7b0126fc3fdf51f5829965b7bd88e52e6f0..c08f99b88dd1c24bb1cb77ff70e327a6e25752bd 100644 --- a/types/table.d.ts +++ b/types/table.d.ts @@ -1946,6 +1946,7 @@ export type VxeTableProps = { columnKey?: VxeTablePropTypes.ColumnKey; rowKey?: VxeTablePropTypes.RowKey; rowId?: VxeTablePropTypes.RowId; + zIndex?:VxeTablePropTypes.ZIndex; keepSource?: VxeTablePropTypes.KeepSource; autoResize?: VxeTablePropTypes.AutoResize; syncResize?: VxeTablePropTypes.SyncResize; @@ -2484,4 +2485,4 @@ export namespace VxeTableEvents { export type ValidError = (params: VxeTableDefines.ValidErrorEventParams) => void; export type Scroll = (params: VxeTableDefines.ScrollEventParams) => void; export type Custom = (params: VxeTableDefines.CustomEventParams) => void; -} \ No newline at end of file +} diff --git a/types/v-x-e-table/setup.d.ts b/types/v-x-e-table/setup.d.ts index 9b057a5423bf0dd0285026990de8ac3c3a666c1d..79cb5df808499ece4f53cefa89ae00ba6c132a7b 100644 --- a/types/v-x-e-table/setup.d.ts +++ b/types/v-x-e-table/setup.d.ts @@ -14,6 +14,7 @@ import { VxeTextareaProps } from '../textarea' import { VxeButtonProps } from '../button' import { VxeCheckboxProps } from '../checkbox' import { VxeRadioProps } from '../radio' +import {VxeFormItemProps, VxeFormItemPropTypes} from "../form-item"; export interface VXETableSetupOptions { size?: SizeType; @@ -68,6 +69,7 @@ export interface VXETableGlobalConfig extends VXETableSetupOptions { tooltip: VxeTooltipProps; pager: VxePagerProps; form: VxeFormProps; + formItem: VxeFormItemProps; input: VxeInputProps; textarea: VxeTextareaProps; select: VxeSelectProps;