Skip to content

Commit

Permalink
Fix the bug in currentField
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Cheng committed May 15, 2024
1 parent 92921ef commit eea1ac3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vue3-excel-editor",
"email": "[email protected]",
"description": "Vue3 plugin for displaying and editing the array-of-object in Excel style",
"version": "1.0.33",
"version": "1.0.34",
"main": "src/main.js",
"dependencies": {
"@vuepic/vue-datepicker": "^3.3.0",
Expand Down
30 changes: 15 additions & 15 deletions src/VueExcelEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
:style="{top: calCellTop2 + 'px'}"
@click="columnFilter = {}">
<span v-if="Object.keys(columnFilter).length > 0">
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="eraser" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-eraser fa-w-16 fa-sm"><path fill="currentColor" d="M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"></path></svg>
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="eraser" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-eraser fa-w-16 fa-sm"><path fill="currentColor" d="M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z"></path></svg>
</span>
<!--
<svg v-if="selectedCount==table.length" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="times-circle" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-times-circle fa-w-16 fa-sm"><path fill="currentColor" d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"></path></svg>
Expand Down Expand Up @@ -700,7 +700,7 @@ export default defineComponent({
register: null
}
if (this.addColumn) colDef = this.addColumn(colDef)
this.newColumn(colDef, pos)
this.newColumn(colDef, pos)
},
newColumn (field, pos) {
this.fields.splice(pos, 0, field)
Expand Down Expand Up @@ -743,7 +743,7 @@ export default defineComponent({
toText: t => t,
register: null
})
})
})
},
refresh () {
// this.pageTop = 0
Expand Down Expand Up @@ -912,7 +912,7 @@ export default defineComponent({
},
localeDate (d) {
if (typeof d === 'undefined') d = new Date()
const pad = n => n < 10 ? '0'+n : n;
const pad = n => n < 10 ? '0'+n : n;
return d.getFullYear() + '-'
+ pad(d.getMonth() + 1) + '-'
+ pad(d.getDate()) + ' '
Expand Down Expand Up @@ -1004,7 +1004,7 @@ export default defineComponent({
ref.$el.textContent = filterText
ref.$emit('update:modelValue', filterText)
},
clearFilter(name) {
if (!name) this.columnFilter = {}
else this.setFilter(name, '')
Expand Down Expand Up @@ -1810,7 +1810,7 @@ export default defineComponent({
},
settingClick() {
if (!this.disablePanelSetting)
if (!this.disablePanelSetting)
this.$refs.panelSetting.showPanel();
},
Expand All @@ -1825,7 +1825,7 @@ export default defineComponent({
this.$refs.importFile.click()
this.importCallback = cb
this.importErrorCallback = errCb
},
},
doImport (e) {
this.processing = true
// this.refresh()
Expand Down Expand Up @@ -1875,8 +1875,8 @@ export default defineComponent({
if (keys.length) {
// locate match record
rowPos = this.table.findIndex(v =>
keys.filter(f =>
typeof v[f.name] !== 'undefined'
keys.filter(f =>
typeof v[f.name] !== 'undefined'
&& (v[f.name] === line[f.name] || v[f.name] === line[f.label])).length === keys.length
)
if (rowPos === -1) {
Expand Down Expand Up @@ -1979,7 +1979,7 @@ export default defineComponent({
throw new Error('VueExcelEditor: ' + e.stack)
}
fileReader.readAsBinaryString(file)
}, 500)
}, 500)
},
exportTable (format, selectedOnly, filename) {
this.processing = true
Expand Down Expand Up @@ -2100,7 +2100,7 @@ export default defineComponent({
}
},
selectRecordByKeys (keys) {
const rowPos = this.table.findIndex(v =>
const rowPos = this.table.findIndex(v =>
this.fields.filter(f => f.keyField).filter(f => v[f.name] === keys[f.name]).length === keys.length)
if (rowPos >= 0) this.selectRecord(rowPos)
},
Expand Down Expand Up @@ -2296,15 +2296,15 @@ export default defineComponent({
if (e.target.offsetWidth < e.target.scrollWidth)
cursor = 'pointer'
}
if (this.currentField && this.currentField.type === 'action')
const row = e.target.parentNode
const colPos = Array.from(row.children).indexOf(e.target) - 1
const currentField = this.fields[colPos]
if (currentField.type === 'action')
cursor = 'pointer'
e.target.style.cursor = cursor
},
cellMouseOver (e) {
const cell = e.target
const row = e.target.parentNode
const colPos = Array.from(row.children).indexOf(e.target) - 1
this.currentField = this.fields[colPos]
if (!cell.classList.contains('error')) return
if (this.tipTimeout) clearTimeout(this.tipTimeout)
if ((this.tip = this.errmsg[cell.getAttribute('id')]) === '') return
Expand Down

0 comments on commit eea1ac3

Please sign in to comment.