diff --git a/examples/views/password-input/PasswordInputTest.vue b/examples/views/password-input/PasswordInputTest.vue index befa5dff..ec549eff 100644 --- a/examples/views/password-input/PasswordInputTest.vue +++ b/examples/views/password-input/PasswordInputTest.vue @@ -8,8 +8,8 @@

- - + +

@@ -22,92 +22,7 @@ const demo1 = reactive({ value101: '', value102: '', value103: '', - value200: '', - value201: '', - value202: '', - value203: '', - value300: '', - value301: '', - value302: '', - value303: '', - value400: '', - value401: '', - value402: '', - value403: '', - value404: '', - value405: '', - value406: '', - value407: '', - value408: '2020-10-01', - value409: '2020-10-01', - value500: '22', - value501: '', - value502: '', - value503: '33.33', - value504: '', - value505: '', - value506: '44', - value507: '', - value508: '', - value509: '1e+2', - value600: '', - value601: '', - value602: '', - value603: '', - value701: '2017-12-18', - value702: '2017-12-18', - value703: '2017-12-18', - value704: '2017-12-18', - value705: '2017-12-18', - value706: '2017-12-18', - value707: '2017-12-18', - value800: '', - value801: '', - value802: '', - value803: '', - value804: '', - value805: '' + value104: '', + value105: '' }) - - diff --git a/package.json b/package.json index 25838f83..6e61a14c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-pc-ui", - "version": "4.3.6", + "version": "4.3.7", "description": "A vue based PC component library", "scripts": { "update": "npm install --legacy-peer-deps", @@ -63,7 +63,7 @@ "vue": "3.5.5", "vue-i18n": "^9.13.1", "vue-router": "^4.3.2", - "vxe-table": "^4.9.4" + "vxe-table": "^4.9.8" }, "vetur": { "tags": "helper/vetur/tags.json", diff --git a/packages/password-input/src/password-input.ts b/packages/password-input/src/password-input.ts index 372f88b0..728a90cd 100644 --- a/packages/password-input/src/password-input.ts +++ b/packages/password-input/src/password-input.ts @@ -10,6 +10,10 @@ export default defineComponent({ name: 'VxePasswordInput', props: { modelValue: String as PropType, + immediate: { + type: Boolean as PropType, + default: true + }, name: String as PropType, clearable: { type: Boolean as PropType, @@ -112,14 +116,24 @@ export default defineComponent({ return 'password' }) + const computeInpImmediate = computed(() => { + const { immediate } = props + return immediate + }) + const triggerEvent = (evnt: Event & { type: 'input' | 'change' | 'click' | 'focus' | 'blur' }) => { const { inputValue } = reactData passwordInputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt) } const emitInputEvent = (value: any, evnt: Event) => { + const inpImmediate = computeInpImmediate.value reactData.inputValue = value - passwordInputMethods.dispatchEvent('input', { value }, evnt) + if (inpImmediate) { + handleChange(value, evnt) + } else { + passwordInputMethods.dispatchEvent('input', { value }, evnt) + } } const inputEvent = (evnt: Event & { type: 'input' }) => { diff --git a/packages/tree/src/tree.ts b/packages/tree/src/tree.ts index 68876b95..f6989ded 100644 --- a/packages/tree/src/tree.ts +++ b/packages/tree/src/tree.ts @@ -382,7 +382,7 @@ export default defineComponent({ return nextTick() }, setAllCheckboxNode (checked) { - const selectMaps: Record = Object.assign(reactData.selectCheckboxMaps) + const selectMaps: Record = Object.assign({}, reactData.selectCheckboxMaps) const childrenField = computeChildrenField.value if (checked) { XEUtils.eachTree(reactData.treeList, (node) => { @@ -404,7 +404,7 @@ export default defineComponent({ return nextTick() }, setExpandByNodeId (nodeids, expanded) { - const expandedMaps: Record = Object.assign(reactData.treeExpandedMaps) + const expandedMaps: Record = Object.assign({}, reactData.treeExpandedMaps) if (nodeids) { if (!XEUtils.isArray(nodeids)) { nodeids = [nodeids] @@ -417,7 +417,7 @@ export default defineComponent({ return nextTick() }, setExpandNode (nodes, expanded) { - const expandedMaps: Record = Object.assign(reactData.treeExpandedMaps) + const expandedMaps: Record = Object.assign({}, reactData.treeExpandedMaps) if (nodes) { if (!XEUtils.isArray(nodes)) { nodes = [nodes] @@ -431,7 +431,7 @@ export default defineComponent({ return nextTick() }, toggleExpandByNodeId (nodeids) { - const expandedMaps: Record = Object.assign(reactData.treeExpandedMaps) + const expandedMaps: Record = Object.assign({}, reactData.treeExpandedMaps) if (nodeids) { if (!XEUtils.isArray(nodeids)) { nodeids = [nodeids] @@ -444,7 +444,7 @@ export default defineComponent({ return nextTick() }, toggleExpandNode (nodes) { - const expandedMaps: Record = Object.assign(reactData.treeExpandedMaps) + const expandedMaps: Record = Object.assign({}, reactData.treeExpandedMaps) if (nodes) { if (!XEUtils.isArray(nodes)) { nodes = [nodes] @@ -458,7 +458,7 @@ export default defineComponent({ return nextTick() }, setAllExpandNode () { - const expandedMaps: Record = Object.assign(reactData.treeExpandedMaps) + const expandedMaps: Record = Object.assign({}, reactData.treeExpandedMaps) const childrenField = computeChildrenField.value XEUtils.eachTree(reactData.treeList, (node) => { const nodeid = getNodeId(node) @@ -639,27 +639,30 @@ export default defineComponent({ const { checkStrictly } = checkboxOpts return new Promise(resolve => { if (loadMethod) { - const { treeExpandLazyLoadedMaps } = reactData + const tempExpandLazyLoadedMaps = Object.assign({}, reactData.treeExpandLazyLoadedMaps) const { nodeMaps } = reactData const nodeid = getNodeId(node) const nodeItem = nodeMaps[nodeid] - treeExpandLazyLoadedMaps[nodeid] = true + tempExpandLazyLoadedMaps[nodeid] = true + reactData.treeExpandLazyLoadedMaps = tempExpandLazyLoadedMaps Promise.resolve( loadMethod({ $tree: $xeTree, node }) ).then((childRecords: any) => { + const { treeExpandLazyLoadedMaps } = reactData nodeItem.treeLoaded = true if (treeExpandLazyLoadedMaps[nodeid]) { - delete treeExpandLazyLoadedMaps[nodeid] + treeExpandLazyLoadedMaps[nodeid] = false } if (!XEUtils.isArray(childRecords)) { childRecords = [] } if (childRecords) { return treeMethods.loadChildrenNode(node, childRecords).then(childRows => { - const { treeExpandedMaps } = reactData - if (childRows.length && !treeExpandedMaps[nodeid]) { - treeExpandedMaps[nodeid] = true + const tempExpandedMaps = Object.assign({}, reactData.treeExpandedMaps) + if (childRows.length && !tempExpandedMaps[nodeid]) { + tempExpandedMaps[nodeid] = true } + reactData.treeExpandedMaps = tempExpandedMaps // 如果当前节点已选中,则展开后子节点也被选中 if (!checkStrictly && treeMethods.isCheckedByCheckboxNodeId(nodeid)) { handleCheckedCheckboxNode(childRows.map((item: any) => getNodeId(item)), true) @@ -676,7 +679,7 @@ export default defineComponent({ const { treeExpandLazyLoadedMaps } = reactData nodeItem.treeLoaded = false if (treeExpandLazyLoadedMaps[nodeid]) { - delete treeExpandLazyLoadedMaps[nodeid] + treeExpandLazyLoadedMaps[nodeid] = false } updateNodeLine(node) dispatchEvent('load-error', { node, data: e }, new Event('load-error')) diff --git a/types/components/password-input.d.ts b/types/components/password-input.d.ts index aa064846..20a3b898 100644 --- a/types/components/password-input.d.ts +++ b/types/components/password-input.d.ts @@ -25,6 +25,7 @@ export interface VxePasswordInputPrivateRef extends PasswordInputPrivateRef { } export namespace VxePasswordInputPropTypes { export type Size = VxeComponentSizeType export type ModelValue = string | null + export type Immediate = boolean export type ClassName = string export type Name = string export type Clearable = boolean @@ -46,6 +47,7 @@ export namespace VxePasswordInputPropTypes { export interface VxePasswordInputProps { size?: VxePasswordInputPropTypes.Size modelValue?: VxePasswordInputPropTypes.ModelValue + immediate?: VxePasswordInputPropTypes.Immediate className?: VxePasswordInputPropTypes.ClassName name?: VxePasswordInputPropTypes.Name clearable?: VxePasswordInputPropTypes.Clearable