evui 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -105,24 +105,57 @@
105
105
  {{ column.caption }}
106
106
  <!-- Sort Icon -->
107
107
  <span @click.stop="onSort(column)">
108
- <grid-sort-button
109
- v-if="column.sortable === undefined ? true : column.sortable"
110
- class="column-sort__icon column-sort__icon--basic"
111
- :icon="'basic'"
112
- :style="{
113
- height: `${rowHeight}px`,
114
- 'line-height': `${rowHeight}px`,
115
- }"
116
- />
117
- <grid-sort-button
118
- v-if="sortField === column.field"
119
- class="column-sort__icon"
120
- :icon="sortOrder"
121
- :style="{
122
- height: `${rowHeight}px`,
123
- 'line-height': `${rowHeight}px`,
124
- }"
125
- />
108
+ <template v-if="!!$slots.sortIcon">
109
+ <span
110
+ v-if="column.sortable === undefined ? true : column.sortable"
111
+ class="column-sort__icon column-sort__icon--basic"
112
+ :style="{
113
+ height: `${rowHeight}px`,
114
+ 'line-height': `${rowHeight}px`,
115
+ }"
116
+ >
117
+ <slot name="sortIcon" />
118
+ </span>
119
+ <span
120
+ v-if="sortField === column.field"
121
+ :class="[{
122
+ 'column-sort__icon': true,
123
+ 'column-sort__icon--asc': sortOrder === 'asc',
124
+ 'column-sort__icon--desc': sortOrder === 'desc',
125
+ }]"
126
+ :style="{
127
+ height: `${rowHeight}px`,
128
+ 'line-height': `${rowHeight}px`,
129
+ }"
130
+ >
131
+ <slot :name="`sortIcon_${sortOrder}`" />
132
+ </span>
133
+ </template>
134
+ <template v-else>
135
+ <grid-sort-button
136
+ v-if="column.sortable === undefined ? true : column.sortable"
137
+ class="column-sort__icon column-sort__icon--basic"
138
+ :icon="'basic'"
139
+ :style="{
140
+ height: `${rowHeight}px`,
141
+ 'line-height': `${rowHeight}px`,
142
+ }"
143
+ />
144
+ <grid-sort-button
145
+ v-if="sortField === column.field"
146
+ :class="[{
147
+ 'column-sort__icon': true,
148
+ 'column-sort__icon--asc': sortOrder === 'asc',
149
+ 'column-sort__icon--desc': sortOrder === 'desc',
150
+ }]"
151
+ :icon="sortOrder"
152
+ :style="{
153
+ height: `${rowHeight}px`,
154
+ 'line-height': `${rowHeight}px`,
155
+ visibility: !!sortOrder ? hidden : true,
156
+ }"
157
+ />
158
+ </template>
126
159
  </span>
127
160
  </span>
128
161
  <!-- Column Resize -->
@@ -598,6 +631,7 @@ export default {
598
631
 
599
632
  const {
600
633
  setColumnSetting,
634
+ initColumnSettingInfo,
601
635
  onApplyColumn,
602
636
  setColumnHidden,
603
637
  } = columnSettingEvent({
@@ -633,6 +667,7 @@ export default {
633
667
  () => {
634
668
  sortInfo.isSorting = false;
635
669
  sortInfo.sortField = '';
670
+ initColumnSettingInfo();
636
671
  setSort();
637
672
  }, { deep: true },
638
673
  );
@@ -79,6 +79,9 @@
79
79
  .column-sort__icon--basic {
80
80
  visibility: visible;
81
81
  }
82
+ .column-sort__icon--asc, .column-sort__icon--desc {
83
+ visibility: hidden;
84
+ }
82
85
  }
83
86
  }
84
87
 
@@ -900,6 +900,13 @@ export const columnSettingEvent = (params) => {
900
900
  const setColumnSetting = () => {
901
901
  columnSettingInfo.isShowColumnSetting = true;
902
902
  };
903
+ const initColumnSettingInfo = () => {
904
+ stores.filteredColumns.length = 0;
905
+ columnSettingInfo.isShowColumnSetting = false;
906
+ columnSettingInfo.isFilteringColumn = false;
907
+ columnSettingInfo.visibleColumnIdx = [];
908
+ columnSettingInfo.hiddenColumn = '';
909
+ };
903
910
  const setFilteringColumn = () => {
904
911
  columnSettingInfo.visibleColumnIdx = stores.filteredColumns.map(column => column.index);
905
912
 
@@ -919,10 +926,14 @@ export const columnSettingEvent = (params) => {
919
926
  const setColumnHidden = (val) => {
920
927
  const columns = columnSettingInfo.isFilteringColumn
921
928
  ? stores.filteredColumns : stores.originColumns;
929
+
930
+ if (columns.length === 1) {
931
+ return;
932
+ }
922
933
  stores.filteredColumns = columns.filter(column => column.field !== val);
923
934
  columnSettingInfo.hiddenColumn = val;
924
935
  setFilteringColumn();
925
936
  };
926
937
 
927
- return { setColumnSetting, onApplyColumn, setColumnHidden };
938
+ return { setColumnSetting, initColumnSettingInfo, onApplyColumn, setColumnHidden };
928
939
  };