Skip to content

Commit 036e467

Browse files
author
Kenneth Cheng
committed
implement no-sorting prop
1 parent fa46293 commit 036e467

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vue3-excel-editor",
33
"email": "apple.6502@gmail.com",
44
"description": "Vue3 plugin for displaying and editing the array-of-object in Excel style",
5-
"version": "1.0.46",
5+
"version": "1.0.47",
66
"main": "src/main.js",
77
"dependencies": {
88
"@vuepic/vue-datepicker": "^3.3.0",

src/VueExcelColumn.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default {
3737
summary: {type: String, default: null},
3838
sort: {type: Function, default: null},
3939
sorting: {type: Function, default: null},
40+
noSorting: {type: Boolean, default: null},
4041
masking: {type: String, default: ''},
4142
placeholder: {type: String, default: ''},
4243
color: {type: [String, Function], default: null},
@@ -254,6 +255,7 @@ export default {
254255
isLink: this.isLink || (this.link ? () => true : null),
255256
sort: this.sort,
256257
sorting: this.sorting,
258+
noSorting: this.noSorting !== null ? this.noSorting : self.$parent.noSorting,
257259
258260
keyField: this.keyField,
259261
sticky: this.sticky,

src/VueExcelEditor.vue

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@
3636
<span style="width:100%">
3737
<svg v-if="selectedCount>0" 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>
3838
<svg v-else aria-hidden="true" focusable="false" data-prefix="fas" data-icon="bars" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-bars fa-w-14 fa-sm"><path fill="currentColor" d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path></svg>
39-
<!--
40-
<svg v-if="processing" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="spinner" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-spinner fa-w-16 fa-spin fa-sm"><path fill="currentColor" d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>
41-
<svg v-else aria-hidden="true" focusable="false" data-prefix="fas" data-icon="bars" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-bars fa-w-14 fa-sm"><path fill="currentColor" d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path></svg>
42-
-->
4339
</span>
4440
</th>
4541
<th v-for="(item, p) in fields"
@@ -48,7 +44,8 @@
4844
:colspan="p === fields.length - 1 && vScroller.buttonHeight < vScroller.height ? 2: 1"
4945
:class="{'sort-asc-sign': sortPos==p && sortDir==1,
5046
'sort-des-sign': sortPos==p && sortDir==-1,
51-
'sticky-column': item.sticky}"
47+
'sticky-column': item.sticky,
48+
'no-sorting': item.noSorting}"
5249
:style="{left: item.left}"
5350
@mousedown="headerClick($event, p)"
5451
@contextmenu.prevent="panelFilterClick(item)">
@@ -331,6 +328,7 @@ export default defineComponent({
331328
},
332329
noFinding: {type: Boolean, default: false},
333330
noFindingNext: {type: Boolean, default: false},
331+
noSorting: {type: Boolean, default: false},
334332
filterRow: {type: Boolean, default: false},
335333
freeSelect: {type: Boolean, default: false},
336334
noFooter: {type: Boolean, default: false},
@@ -1718,9 +1716,12 @@ export default defineComponent({
17181716
this.fields[index - 1].label = e.target.textContent
17191717
},
17201718
sort (n, pos) {
1721-
this.processing = true
17221719
const colPos = typeof pos === 'undefined' ? this.columnFilterRef.colPos : pos
17231720
const field = this.fields[colPos]
1721+
if (field.noSorting) return
1722+
1723+
this.processing = true
1724+
17241725
const name = field.name
17251726
setTimeout(() => {
17261727
let sorting = field.sorting
@@ -3074,6 +3075,9 @@ input:focus, input:active:focus, input.active:focus {
30743075
cursor: s-resize;
30753076
z-index: 6;
30763077
}
3078+
.systable thead th.no-sorting {
3079+
cursor: auto;
3080+
}
30773081
.systable thead td.column-filter {
30783082
text-align: left;
30793083
background-color: #fffff2;

0 commit comments

Comments
 (0)