iov-design 2.15.60 → 2.15.62

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.
Files changed (242) hide show
  1. package/README.md +148 -148
  2. package/lib/alert.js +24 -105
  3. package/lib/aside.js +24 -34
  4. package/lib/autocomplete.js +36 -240
  5. package/lib/avatar.js +21 -20
  6. package/lib/backtop.js +27 -52
  7. package/lib/badge.js +30 -58
  8. package/lib/breadcrumb-item.js +24 -53
  9. package/lib/breadcrumb.js +24 -37
  10. package/lib/button-group.js +24 -29
  11. package/lib/button.js +38 -60
  12. package/lib/calendar.js +29 -146
  13. package/lib/card.js +24 -51
  14. package/lib/carousel-item.js +30 -68
  15. package/lib/carousel.js +27 -159
  16. package/lib/cascader-panel.js +41 -64
  17. package/lib/cascader.js +37 -470
  18. package/lib/checkbox-button.js +28 -164
  19. package/lib/checkbox-group.js +24 -37
  20. package/lib/checkbox.js +35 -189
  21. package/lib/col.js +1 -0
  22. package/lib/collapse-item.js +27 -125
  23. package/lib/collapse.js +24 -37
  24. package/lib/color-picker.js +104 -424
  25. package/lib/container.js +24 -34
  26. package/lib/date-picker.js +126 -1981
  27. package/lib/descriptions-item.js +1 -0
  28. package/lib/descriptions.js +1 -0
  29. package/lib/dialog.js +24 -137
  30. package/lib/divider.js +29 -64
  31. package/lib/drawer.js +24 -139
  32. package/lib/dropdown-item.js +27 -45
  33. package/lib/dropdown-menu.js +24 -51
  34. package/lib/dropdown.js +21 -20
  35. package/lib/empty.js +24 -61
  36. package/lib/footer.js +24 -34
  37. package/lib/form-item.js +42 -128
  38. package/lib/form.js +27 -40
  39. package/lib/header.js +24 -34
  40. package/lib/icon.js +24 -29
  41. package/lib/image.js +36 -220
  42. package/lib/index.js +1 -1
  43. package/lib/infinite-scroll.js +1 -0
  44. package/lib/input-number.js +30 -163
  45. package/lib/input.js +42 -274
  46. package/lib/iov-design.common.js +1635 -11132
  47. package/lib/link.js +31 -56
  48. package/lib/loading.js +24 -77
  49. package/lib/locale/format.js +10 -10
  50. package/lib/main.js +24 -29
  51. package/lib/menu-item-group.js +24 -40
  52. package/lib/menu-item.js +27 -83
  53. package/lib/menu.js +21 -20
  54. package/lib/message-box.js +24 -321
  55. package/lib/message.js +30 -82
  56. package/lib/mixins/migrating.js +20 -20
  57. package/lib/notification.js +24 -109
  58. package/lib/option-group.js +24 -50
  59. package/lib/option.js +27 -76
  60. package/lib/page-header.js +24 -56
  61. package/lib/pagination.js +24 -97
  62. package/lib/popconfirm.js +24 -97
  63. package/lib/popover.js +24 -89
  64. package/lib/progress.js +30 -133
  65. package/lib/radio-button.js +29 -111
  66. package/lib/radio-group.js +24 -39
  67. package/lib/radio.js +36 -152
  68. package/lib/rate.js +24 -94
  69. package/lib/result.js +72 -187
  70. package/lib/row.js +1 -0
  71. package/lib/scrollbar.js +1 -0
  72. package/lib/select.js +48 -637
  73. package/lib/skeleton-item.js +36 -68
  74. package/lib/skeleton.js +28 -70
  75. package/lib/slider.js +36 -267
  76. package/lib/spinner.js +24 -51
  77. package/lib/statistic.js +24 -76
  78. package/lib/step.js +29 -118
  79. package/lib/steps.js +27 -40
  80. package/lib/submenu.js +21 -20
  81. package/lib/switch.js +24 -130
  82. package/lib/tab-pane.js +24 -52
  83. package/lib/table-column.js +1 -0
  84. package/lib/table.js +93 -633
  85. package/lib/tabs.js +34 -49
  86. package/lib/tag.js +21 -20
  87. package/lib/theme-chalk/autocomplete.css +1 -1
  88. package/lib/theme-chalk/base.css +1 -1
  89. package/lib/theme-chalk/cascader.css +1 -1
  90. package/lib/theme-chalk/date-picker.css +1 -1
  91. package/lib/theme-chalk/index.css +1 -1
  92. package/lib/theme-chalk/input-number.css +1 -1
  93. package/lib/theme-chalk/input.css +1 -1
  94. package/lib/theme-chalk/iovfont.css +1 -1
  95. package/lib/theme-chalk/link.css +1 -1
  96. package/lib/theme-chalk/message-box.css +1 -1
  97. package/lib/theme-chalk/pagination.css +1 -1
  98. package/lib/theme-chalk/select.css +1 -1
  99. package/lib/theme-chalk/slider.css +1 -1
  100. package/lib/theme-chalk/time-picker.css +1 -1
  101. package/lib/theme-chalk/transfer.css +1 -1
  102. package/lib/time-picker.js +58 -820
  103. package/lib/time-select.js +42 -303
  104. package/lib/timeline-item.js +29 -75
  105. package/lib/timeline.js +21 -20
  106. package/lib/tooltip.js +1 -0
  107. package/lib/transfer.js +36 -299
  108. package/lib/tree.js +54 -243
  109. package/lib/upload.js +86 -654
  110. package/lib/utils/clickoutside.js +7 -7
  111. package/lib/utils/vue-popper.js +7 -7
  112. package/package.json +154 -154
  113. package/packages/autocomplete/src/autocomplete-suggestions.vue +76 -76
  114. package/packages/autocomplete/src/autocomplete.vue +285 -285
  115. package/packages/button/src/button.vue +90 -90
  116. package/packages/calendar/src/date-table.vue +200 -200
  117. package/packages/calendar/src/main.vue +280 -280
  118. package/packages/carousel/src/item.vue +138 -138
  119. package/packages/carousel/src/main.vue +315 -315
  120. package/packages/cascader/src/cascader.vue +776 -776
  121. package/packages/cascader-panel/src/cascader-menu.vue +138 -138
  122. package/packages/cascader-panel/src/cascader-node.vue +246 -246
  123. package/packages/cascader-panel/src/cascader-panel.vue +391 -391
  124. package/packages/cascader-panel/src/node.js +166 -166
  125. package/packages/cascader-panel/src/store.js +58 -58
  126. package/packages/checkbox/src/checkbox-button.vue +199 -199
  127. package/packages/checkbox/src/checkbox-group.vue +49 -49
  128. package/packages/checkbox/src/checkbox.vue +225 -225
  129. package/packages/collapse/src/collapse-item.vue +114 -114
  130. package/packages/color-picker/src/components/picker-dropdown.vue +121 -121
  131. package/packages/color-picker/src/main.vue +188 -188
  132. package/packages/date-picker/src/basic/date-table.vue +441 -441
  133. package/packages/date-picker/src/basic/month-table.vue +269 -269
  134. package/packages/date-picker/src/basic/time-spinner.vue +304 -304
  135. package/packages/date-picker/src/basic/year-table.vue +111 -111
  136. package/packages/date-picker/src/panel/date-range.vue +680 -680
  137. package/packages/date-picker/src/panel/date.vue +609 -609
  138. package/packages/date-picker/src/panel/month-range.vue +289 -289
  139. package/packages/date-picker/src/panel/time-range.vue +248 -248
  140. package/packages/date-picker/src/panel/time-select.vue +178 -178
  141. package/packages/date-picker/src/panel/time.vue +186 -186
  142. package/packages/date-picker/src/picker.vue +967 -967
  143. package/packages/descriptions/src/index.js +180 -180
  144. package/packages/dialog/src/component.vue +262 -262
  145. package/packages/drawer/src/main.vue +205 -205
  146. package/packages/dropdown/src/dropdown-item.vue +37 -37
  147. package/packages/dropdown/src/dropdown-menu.vue +63 -63
  148. package/packages/dropdown/src/dropdown.vue +293 -293
  149. package/packages/empty/src/index.vue +70 -70
  150. package/packages/form/src/form-item.vue +324 -324
  151. package/packages/form/src/form.vue +182 -182
  152. package/packages/image/src/image-viewer.vue +330 -330
  153. package/packages/image/src/main.vue +249 -249
  154. package/packages/infinite-scroll/src/main.js +150 -150
  155. package/packages/input/src/input.vue +477 -477
  156. package/packages/input-number/src/input-number.vue +283 -283
  157. package/packages/loading/src/directive.js +133 -133
  158. package/packages/loading/src/index.js +106 -106
  159. package/packages/menu/src/menu-item.vue +112 -112
  160. package/packages/menu/src/menu.vue +325 -325
  161. package/packages/menu/src/submenu.vue +349 -349
  162. package/packages/message/src/main.js +91 -91
  163. package/packages/message-box/src/main.js +216 -216
  164. package/packages/message-box/src/main.vue +333 -333
  165. package/packages/notification/src/main.js +94 -94
  166. package/packages/page-header/src/main.vue +30 -30
  167. package/packages/pagination/src/pagination.js +390 -390
  168. package/packages/popconfirm/src/main.vue +104 -104
  169. package/packages/popover/src/main.vue +239 -239
  170. package/packages/radio/src/radio-button.vue +115 -115
  171. package/packages/radio/src/radio-group.vue +115 -115
  172. package/packages/radio/src/radio.vue +148 -148
  173. package/packages/rate/src/main.vue +348 -348
  174. package/packages/scrollbar/src/bar.js +92 -92
  175. package/packages/scrollbar/src/main.js +130 -130
  176. package/packages/select/src/option-group.vue +60 -60
  177. package/packages/select/src/option.vue +171 -171
  178. package/packages/select/src/select-dropdown.vue +74 -74
  179. package/packages/select/src/select.vue +979 -979
  180. package/packages/slider/src/button.vue +238 -238
  181. package/packages/slider/src/main.vue +427 -427
  182. package/packages/statistic/src/main.vue +204 -204
  183. package/packages/steps/src/steps.vue +68 -68
  184. package/packages/switch/src/component.vue +182 -182
  185. package/packages/table/src/config.js +153 -153
  186. package/packages/table/src/filter-panel.vue +194 -194
  187. package/packages/table/src/store/current.js +76 -76
  188. package/packages/table/src/store/helper.js +41 -41
  189. package/packages/table/src/store/index.js +147 -147
  190. package/packages/table/src/store/watcher.js +502 -502
  191. package/packages/table/src/table-body.js +469 -469
  192. package/packages/table/src/table-column.js +328 -328
  193. package/packages/table/src/table-header.js +571 -571
  194. package/packages/table/src/table-layout.js +249 -249
  195. package/packages/table/src/table-row.js +101 -101
  196. package/packages/table/src/table.vue +740 -740
  197. package/packages/table/src/util.js +273 -273
  198. package/packages/tabs/src/tab-bar.vue +57 -57
  199. package/packages/tabs/src/tab-nav.vue +294 -294
  200. package/packages/tabs/src/tabs.vue +201 -201
  201. package/packages/theme-chalk/src/button.scss +416 -416
  202. package/packages/theme-chalk/src/cascader.scss +252 -252
  203. package/packages/theme-chalk/src/checkbox.scss +419 -419
  204. package/packages/theme-chalk/src/common/var.scss +795 -795
  205. package/packages/theme-chalk/src/form.scss +201 -201
  206. package/packages/theme-chalk/src/input.scss +591 -591
  207. package/packages/theme-chalk/src/iovfont.scss +818 -803
  208. package/packages/theme-chalk/src/link.scss +8 -8
  209. package/packages/theme-chalk/src/message-box.scss +207 -207
  210. package/packages/theme-chalk/src/mixins/_button.scss +136 -136
  211. package/packages/theme-chalk/src/mixins/mixins.scss +190 -190
  212. package/packages/theme-chalk/src/radio-button.scss +115 -115
  213. package/packages/theme-chalk/src/select.scss +270 -270
  214. package/packages/theme-chalk/src/tabs.scss +755 -755
  215. package/packages/theme-chalk/src/upload.scss +568 -568
  216. package/packages/tooltip/src/main.js +242 -242
  217. package/packages/transfer/src/main.vue +231 -231
  218. package/packages/transfer/src/transfer-panel.vue +251 -251
  219. package/packages/tree/src/model/node.js +484 -484
  220. package/packages/tree/src/tree-node.vue +279 -279
  221. package/packages/tree/src/tree.vue +496 -496
  222. package/packages/upload/src/index.vue +420 -420
  223. package/packages/upload/src/upload-file.vue +98 -98
  224. package/packages/upload/src/upload-list.vue +115 -115
  225. package/packages/upload/src/upload-picture.vue +98 -98
  226. package/packages/upload/src/upload.vue +231 -231
  227. package/packages/upload/src/utils.js +31 -31
  228. package/src/directives/repeat-click.js +26 -26
  229. package/src/index.js +259 -259
  230. package/src/locale/format.js +46 -46
  231. package/src/locale/index.js +48 -48
  232. package/src/locale/lang/lo-LA.js +126 -126
  233. package/src/mixins/locale.js +9 -9
  234. package/src/mixins/migrating.js +54 -54
  235. package/src/transitions/collapse-transition.js +77 -77
  236. package/src/utils/clickoutside.js +76 -76
  237. package/src/utils/date-util.js +282 -282
  238. package/src/utils/popup/index.js +218 -218
  239. package/src/utils/popup/popup-manager.js +194 -194
  240. package/src/utils/util.js +245 -245
  241. package/src/utils/vdom.js +5 -5
  242. package/src/utils/vue-popper.js +198 -198
@@ -1,194 +1,194 @@
1
- <template>
2
- <transition name="el-zoom-in-top">
3
- <div
4
- class="el-table-filter"
5
- v-if="multiple"
6
- v-clickoutside="handleOutsideClick"
7
- v-show="showPopper">
8
- <div class="el-table-filter__content">
9
- <el-scrollbar wrap-class="el-table-filter__wrap">
10
- <el-checkbox-group class="el-table-filter__checkbox-group" v-model="filteredValue">
11
- <el-checkbox
12
- v-for="filter in filters"
13
- :key="filter.value"
14
- :label="filter.value">{{ filter.text }}</el-checkbox>
15
- </el-checkbox-group>
16
- </el-scrollbar>
17
- </div>
18
- <div class="el-table-filter__bottom">
19
- <button @click="handleConfirm"
20
- :class="{ 'is-disabled': filteredValue.length === 0 }"
21
- :disabled="filteredValue.length === 0">{{ t('el.table.confirmFilter') }}</button>
22
- <button @click="handleReset">{{ t('el.table.resetFilter') }}</button>
23
- </div>
24
- </div>
25
- <div
26
- class="el-table-filter"
27
- v-else
28
- v-clickoutside="handleOutsideClick"
29
- v-show="showPopper">
30
- <ul class="el-table-filter__list">
31
- <li class="el-table-filter__list-item"
32
- :class="{ 'is-active': filterValue === undefined || filterValue === null }"
33
- @click="handleSelect(null)">{{ t('el.table.clearFilter') }}</li>
34
- <li class="el-table-filter__list-item"
35
- v-for="filter in filters"
36
- :label="filter.value"
37
- :key="filter.value"
38
- :class="{ 'is-active': isActive(filter) }"
39
- @click="handleSelect(filter.value)" >{{ filter.text }}</li>
40
- </ul>
41
- </div>
42
- </transition>
43
- </template>
44
-
45
- <script type="text/babel">
46
- import Popper from 'iov-design/src/utils/vue-popper';
47
- import { PopupManager } from 'iov-design/src/utils/popup';
48
- import Locale from 'iov-design/src/mixins/locale';
49
- import Clickoutside from 'iov-design/src/utils/clickoutside';
50
- import Dropdown from './dropdown';
51
- import ElCheckbox from 'iov-design/packages/checkbox';
52
- import ElCheckboxGroup from 'iov-design/packages/checkbox-group';
53
- import ElScrollbar from 'iov-design/packages/scrollbar';
54
-
55
- export default {
56
- name: 'ElTableFilterPanel',
57
-
58
- mixins: [Popper, Locale],
59
-
60
- directives: {
61
- Clickoutside
62
- },
63
-
64
- components: {
65
- ElCheckbox,
66
- ElCheckboxGroup,
67
- ElScrollbar
68
- },
69
-
70
- props: {
71
- placement: {
72
- type: String,
73
- default: 'bottom-end'
74
- }
75
- },
76
-
77
- methods: {
78
- isActive(filter) {
79
- return filter.value === this.filterValue;
80
- },
81
-
82
- handleOutsideClick() {
83
- setTimeout(() => {
84
- this.showPopper = false;
85
- }, 16);
86
- },
87
-
88
- handleConfirm() {
89
- this.confirmFilter(this.filteredValue);
90
- this.handleOutsideClick();
91
- },
92
-
93
- handleReset() {
94
- this.filteredValue = [];
95
- this.confirmFilter(this.filteredValue);
96
- this.handleOutsideClick();
97
- },
98
-
99
- handleSelect(filterValue) {
100
- this.filterValue = filterValue;
101
-
102
- if ((typeof filterValue !== 'undefined') && (filterValue !== null)) {
103
- this.confirmFilter(this.filteredValue);
104
- } else {
105
- this.confirmFilter([]);
106
- }
107
-
108
- this.handleOutsideClick();
109
- },
110
-
111
- confirmFilter(filteredValue) {
112
- this.table.store.commit('filterChange', {
113
- column: this.column,
114
- values: filteredValue
115
- });
116
- this.table.store.updateAllSelected();
117
- }
118
- },
119
-
120
- data() {
121
- return {
122
- table: null,
123
- cell: null,
124
- column: null
125
- };
126
- },
127
-
128
- computed: {
129
- filters() {
130
- return this.column && this.column.filters;
131
- },
132
-
133
- filterValue: {
134
- get() {
135
- return (this.column.filteredValue || [])[0];
136
- },
137
- set(value) {
138
- if (this.filteredValue) {
139
- if ((typeof value !== 'undefined') && (value !== null)) {
140
- this.filteredValue.splice(0, 1, value);
141
- } else {
142
- this.filteredValue.splice(0, 1);
143
- }
144
- }
145
- }
146
- },
147
-
148
- filteredValue: {
149
- get() {
150
- if (this.column) {
151
- return this.column.filteredValue || [];
152
- }
153
- return [];
154
- },
155
- set(value) {
156
- if (this.column) {
157
- this.column.filteredValue = value;
158
- }
159
- }
160
- },
161
-
162
- multiple() {
163
- if (this.column) {
164
- return this.column.filterMultiple;
165
- }
166
- return true;
167
- }
168
- },
169
-
170
- mounted() {
171
- this.popperElm = this.$el;
172
- this.referenceElm = this.cell;
173
- this.table.bodyWrapper.addEventListener('scroll', () => {
174
- this.updatePopper();
175
- });
176
-
177
- this.$watch('showPopper', (value) => {
178
- if (this.column) this.column.filterOpened = value;
179
- if (value) {
180
- Dropdown.open(this);
181
- } else {
182
- Dropdown.close(this);
183
- }
184
- });
185
- },
186
- watch: {
187
- showPopper(val) {
188
- if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < PopupManager.zIndex) {
189
- this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
190
- }
191
- }
192
- }
193
- };
194
- </script>
1
+ <template>
2
+ <transition name="el-zoom-in-top">
3
+ <div
4
+ class="el-table-filter"
5
+ v-if="multiple"
6
+ v-clickoutside="handleOutsideClick"
7
+ v-show="showPopper">
8
+ <div class="el-table-filter__content">
9
+ <el-scrollbar wrap-class="el-table-filter__wrap">
10
+ <el-checkbox-group class="el-table-filter__checkbox-group" v-model="filteredValue">
11
+ <el-checkbox
12
+ v-for="filter in filters"
13
+ :key="filter.value"
14
+ :label="filter.value">{{ filter.text }}</el-checkbox>
15
+ </el-checkbox-group>
16
+ </el-scrollbar>
17
+ </div>
18
+ <div class="el-table-filter__bottom">
19
+ <button @click="handleConfirm"
20
+ :class="{ 'is-disabled': filteredValue.length === 0 }"
21
+ :disabled="filteredValue.length === 0">{{ t('el.table.confirmFilter') }}</button>
22
+ <button @click="handleReset">{{ t('el.table.resetFilter') }}</button>
23
+ </div>
24
+ </div>
25
+ <div
26
+ class="el-table-filter"
27
+ v-else
28
+ v-clickoutside="handleOutsideClick"
29
+ v-show="showPopper">
30
+ <ul class="el-table-filter__list">
31
+ <li class="el-table-filter__list-item"
32
+ :class="{ 'is-active': filterValue === undefined || filterValue === null }"
33
+ @click="handleSelect(null)">{{ t('el.table.clearFilter') }}</li>
34
+ <li class="el-table-filter__list-item"
35
+ v-for="filter in filters"
36
+ :label="filter.value"
37
+ :key="filter.value"
38
+ :class="{ 'is-active': isActive(filter) }"
39
+ @click="handleSelect(filter.value)" >{{ filter.text }}</li>
40
+ </ul>
41
+ </div>
42
+ </transition>
43
+ </template>
44
+
45
+ <script type="text/babel">
46
+ import Popper from 'iov-design/src/utils/vue-popper';
47
+ import { PopupManager } from 'iov-design/src/utils/popup';
48
+ import Locale from 'iov-design/src/mixins/locale';
49
+ import Clickoutside from 'iov-design/src/utils/clickoutside';
50
+ import Dropdown from './dropdown';
51
+ import ElCheckbox from 'iov-design/packages/checkbox';
52
+ import ElCheckboxGroup from 'iov-design/packages/checkbox-group';
53
+ import ElScrollbar from 'iov-design/packages/scrollbar';
54
+
55
+ export default {
56
+ name: 'ElTableFilterPanel',
57
+
58
+ mixins: [Popper, Locale],
59
+
60
+ directives: {
61
+ Clickoutside
62
+ },
63
+
64
+ components: {
65
+ ElCheckbox,
66
+ ElCheckboxGroup,
67
+ ElScrollbar
68
+ },
69
+
70
+ props: {
71
+ placement: {
72
+ type: String,
73
+ default: 'bottom-end'
74
+ }
75
+ },
76
+
77
+ methods: {
78
+ isActive(filter) {
79
+ return filter.value === this.filterValue;
80
+ },
81
+
82
+ handleOutsideClick() {
83
+ setTimeout(() => {
84
+ this.showPopper = false;
85
+ }, 16);
86
+ },
87
+
88
+ handleConfirm() {
89
+ this.confirmFilter(this.filteredValue);
90
+ this.handleOutsideClick();
91
+ },
92
+
93
+ handleReset() {
94
+ this.filteredValue = [];
95
+ this.confirmFilter(this.filteredValue);
96
+ this.handleOutsideClick();
97
+ },
98
+
99
+ handleSelect(filterValue) {
100
+ this.filterValue = filterValue;
101
+
102
+ if ((typeof filterValue !== 'undefined') && (filterValue !== null)) {
103
+ this.confirmFilter(this.filteredValue);
104
+ } else {
105
+ this.confirmFilter([]);
106
+ }
107
+
108
+ this.handleOutsideClick();
109
+ },
110
+
111
+ confirmFilter(filteredValue) {
112
+ this.table.store.commit('filterChange', {
113
+ column: this.column,
114
+ values: filteredValue
115
+ });
116
+ this.table.store.updateAllSelected();
117
+ }
118
+ },
119
+
120
+ data() {
121
+ return {
122
+ table: null,
123
+ cell: null,
124
+ column: null
125
+ };
126
+ },
127
+
128
+ computed: {
129
+ filters() {
130
+ return this.column && this.column.filters;
131
+ },
132
+
133
+ filterValue: {
134
+ get() {
135
+ return (this.column.filteredValue || [])[0];
136
+ },
137
+ set(value) {
138
+ if (this.filteredValue) {
139
+ if ((typeof value !== 'undefined') && (value !== null)) {
140
+ this.filteredValue.splice(0, 1, value);
141
+ } else {
142
+ this.filteredValue.splice(0, 1);
143
+ }
144
+ }
145
+ }
146
+ },
147
+
148
+ filteredValue: {
149
+ get() {
150
+ if (this.column) {
151
+ return this.column.filteredValue || [];
152
+ }
153
+ return [];
154
+ },
155
+ set(value) {
156
+ if (this.column) {
157
+ this.column.filteredValue = value;
158
+ }
159
+ }
160
+ },
161
+
162
+ multiple() {
163
+ if (this.column) {
164
+ return this.column.filterMultiple;
165
+ }
166
+ return true;
167
+ }
168
+ },
169
+
170
+ mounted() {
171
+ this.popperElm = this.$el;
172
+ this.referenceElm = this.cell;
173
+ this.table.bodyWrapper.addEventListener('scroll', () => {
174
+ this.updatePopper();
175
+ });
176
+
177
+ this.$watch('showPopper', (value) => {
178
+ if (this.column) this.column.filterOpened = value;
179
+ if (value) {
180
+ Dropdown.open(this);
181
+ } else {
182
+ Dropdown.close(this);
183
+ }
184
+ });
185
+ },
186
+ watch: {
187
+ showPopper(val) {
188
+ if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < PopupManager.zIndex) {
189
+ this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
190
+ }
191
+ }
192
+ }
193
+ };
194
+ </script>
@@ -1,76 +1,76 @@
1
- import { arrayFind } from 'iov-design/src/utils/util';
2
- import { getRowIdentity } from '../util';
3
-
4
- export default {
5
- data() {
6
- return {
7
- states: {
8
- // 不可响应的,设置 currentRowKey 时,data 不一定存在,也许无法算出正确的 currentRow
9
- // 把该值缓存一下,当用户点击修改 currentRow 时,把该值重置为 null
10
- _currentRowKey: null,
11
- currentRow: null
12
- }
13
- };
14
- },
15
-
16
- methods: {
17
- setCurrentRowKey(key) {
18
- this.assertRowKey();
19
- this.states._currentRowKey = key;
20
- this.setCurrentRowByKey(key);
21
- },
22
-
23
- restoreCurrentRowKey() {
24
- this.states._currentRowKey = null;
25
- },
26
-
27
- setCurrentRowByKey(key) {
28
- const { states } = this;
29
- const { data = [], rowKey } = states;
30
- let currentRow = null;
31
- if (rowKey) {
32
- currentRow = arrayFind(data, item => getRowIdentity(item, rowKey) === key);
33
- }
34
- states.currentRow = currentRow;
35
- },
36
-
37
- updateCurrentRow(currentRow) {
38
- const { states, table } = this;
39
- const oldCurrentRow = states.currentRow;
40
- if (currentRow && currentRow !== oldCurrentRow) {
41
- states.currentRow = currentRow;
42
- table.$emit('current-change', currentRow, oldCurrentRow);
43
- return;
44
- }
45
- if (!currentRow && oldCurrentRow) {
46
- states.currentRow = null;
47
- table.$emit('current-change', null, oldCurrentRow);
48
- }
49
- },
50
-
51
- updateCurrentRowData() {
52
- const { states, table } = this;
53
- const { rowKey, _currentRowKey } = states;
54
- // data 为 null 时,解构时的默认值会被忽略
55
- const data = states.data || [];
56
- const oldCurrentRow = states.currentRow;
57
-
58
- // 当 currentRow 不在 data 中时尝试更新数据
59
- if (data.indexOf(oldCurrentRow) === -1 && oldCurrentRow) {
60
- if (rowKey) {
61
- const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
62
- this.setCurrentRowByKey(currentRowKey);
63
- } else {
64
- states.currentRow = null;
65
- }
66
- if (states.currentRow === null) {
67
- table.$emit('current-change', null, oldCurrentRow);
68
- }
69
- } else if (_currentRowKey) {
70
- // 把初始时下设置的 rowKey 转化成 rowData
71
- this.setCurrentRowByKey(_currentRowKey);
72
- this.restoreCurrentRowKey();
73
- }
74
- }
75
- }
76
- };
1
+ import { arrayFind } from 'iov-design/src/utils/util';
2
+ import { getRowIdentity } from '../util';
3
+
4
+ export default {
5
+ data() {
6
+ return {
7
+ states: {
8
+ // 不可响应的,设置 currentRowKey 时,data 不一定存在,也许无法算出正确的 currentRow
9
+ // 把该值缓存一下,当用户点击修改 currentRow 时,把该值重置为 null
10
+ _currentRowKey: null,
11
+ currentRow: null
12
+ }
13
+ };
14
+ },
15
+
16
+ methods: {
17
+ setCurrentRowKey(key) {
18
+ this.assertRowKey();
19
+ this.states._currentRowKey = key;
20
+ this.setCurrentRowByKey(key);
21
+ },
22
+
23
+ restoreCurrentRowKey() {
24
+ this.states._currentRowKey = null;
25
+ },
26
+
27
+ setCurrentRowByKey(key) {
28
+ const { states } = this;
29
+ const { data = [], rowKey } = states;
30
+ let currentRow = null;
31
+ if (rowKey) {
32
+ currentRow = arrayFind(data, item => getRowIdentity(item, rowKey) === key);
33
+ }
34
+ states.currentRow = currentRow;
35
+ },
36
+
37
+ updateCurrentRow(currentRow) {
38
+ const { states, table } = this;
39
+ const oldCurrentRow = states.currentRow;
40
+ if (currentRow && currentRow !== oldCurrentRow) {
41
+ states.currentRow = currentRow;
42
+ table.$emit('current-change', currentRow, oldCurrentRow);
43
+ return;
44
+ }
45
+ if (!currentRow && oldCurrentRow) {
46
+ states.currentRow = null;
47
+ table.$emit('current-change', null, oldCurrentRow);
48
+ }
49
+ },
50
+
51
+ updateCurrentRowData() {
52
+ const { states, table } = this;
53
+ const { rowKey, _currentRowKey } = states;
54
+ // data 为 null 时,解构时的默认值会被忽略
55
+ const data = states.data || [];
56
+ const oldCurrentRow = states.currentRow;
57
+
58
+ // 当 currentRow 不在 data 中时尝试更新数据
59
+ if (data.indexOf(oldCurrentRow) === -1 && oldCurrentRow) {
60
+ if (rowKey) {
61
+ const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
62
+ this.setCurrentRowByKey(currentRowKey);
63
+ } else {
64
+ states.currentRow = null;
65
+ }
66
+ if (states.currentRow === null) {
67
+ table.$emit('current-change', null, oldCurrentRow);
68
+ }
69
+ } else if (_currentRowKey) {
70
+ // 把初始时下设置的 rowKey 转化成 rowData
71
+ this.setCurrentRowByKey(_currentRowKey);
72
+ this.restoreCurrentRowKey();
73
+ }
74
+ }
75
+ }
76
+ };
@@ -1,41 +1,41 @@
1
- import Store from './index';
2
- import debounce from 'throttle-debounce/debounce';
3
-
4
- export function createStore(table, initialState = {}) {
5
- if (!table) {
6
- throw new Error('Table is required.');
7
- }
8
-
9
- const store = new Store();
10
- store.table = table;
11
- // fix https://github.com/ElemeFE/element/issues/14075
12
- // related pr https://github.com/ElemeFE/element/pull/14146
13
- store.toggleAllSelection = debounce(10, store._toggleAllSelection);
14
- Object.keys(initialState).forEach(key => {
15
- store.states[key] = initialState[key];
16
- });
17
- return store;
18
- }
19
-
20
- export function mapStates(mapper) {
21
- const res = {};
22
- Object.keys(mapper).forEach(key => {
23
- const value = mapper[key];
24
- let fn;
25
- if (typeof value === 'string') {
26
- fn = function() {
27
- return this.store.states[value];
28
- };
29
- } else if (typeof value === 'function') {
30
- fn = function() {
31
- return value.call(this, this.store.states);
32
- };
33
- } else {
34
- console.error('invalid value type');
35
- }
36
- if (fn) {
37
- res[key] = fn;
38
- }
39
- });
40
- return res;
41
- };
1
+ import Store from './index';
2
+ import debounce from 'throttle-debounce/debounce';
3
+
4
+ export function createStore(table, initialState = {}) {
5
+ if (!table) {
6
+ throw new Error('Table is required.');
7
+ }
8
+
9
+ const store = new Store();
10
+ store.table = table;
11
+ // fix https://github.com/ElemeFE/element/issues/14075
12
+ // related pr https://github.com/ElemeFE/element/pull/14146
13
+ store.toggleAllSelection = debounce(10, store._toggleAllSelection);
14
+ Object.keys(initialState).forEach(key => {
15
+ store.states[key] = initialState[key];
16
+ });
17
+ return store;
18
+ }
19
+
20
+ export function mapStates(mapper) {
21
+ const res = {};
22
+ Object.keys(mapper).forEach(key => {
23
+ const value = mapper[key];
24
+ let fn;
25
+ if (typeof value === 'string') {
26
+ fn = function() {
27
+ return this.store.states[value];
28
+ };
29
+ } else if (typeof value === 'function') {
30
+ fn = function() {
31
+ return value.call(this, this.store.states);
32
+ };
33
+ } else {
34
+ console.error('invalid value type');
35
+ }
36
+ if (fn) {
37
+ res[key] = fn;
38
+ }
39
+ });
40
+ return res;
41
+ };