xt-element-ui 2.1.5 → 2.1.7

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 (72) hide show
  1. package/docs/components/base/xt-badge.md +0 -2
  2. package/docs/components/base/xt-bar.md +5 -32
  3. package/docs/components/base/xt-button.md +0 -2
  4. package/docs/components/base/xt-card-item.md +0 -2
  5. package/docs/components/base/xt-card.md +17 -19
  6. package/docs/components/base/xt-chart.md +5 -31
  7. package/docs/components/base/xt-config-provider.md +0 -2
  8. package/docs/components/base/xt-date-picker.md +268 -180
  9. package/docs/components/base/xt-flex-box.md +25 -25
  10. package/docs/components/base/xt-form-schema.md +356 -0
  11. package/docs/components/base/xt-grid-box.md +4 -6
  12. package/docs/components/base/xt-icon.md +0 -2
  13. package/docs/components/base/xt-input.md +204 -44
  14. package/docs/components/base/xt-line.md +4 -30
  15. package/docs/components/base/xt-list.md +456 -458
  16. package/docs/components/base/xt-map-provider.md +0 -2
  17. package/docs/components/base/xt-map.md +0 -2
  18. package/docs/components/base/xt-multi.md +5 -44
  19. package/docs/components/base/xt-page.md +17 -6
  20. package/docs/components/base/xt-pie.md +5 -30
  21. package/docs/components/base/xt-progress.md +0 -2
  22. package/docs/components/base/xt-scroll-arrow.md +0 -2
  23. package/docs/components/base/xt-select-tree.md +0 -2
  24. package/docs/components/base/xt-step-price.md +0 -2
  25. package/docs/components/base/xt-table.md +2 -2
  26. package/docs/components/base/xt-tabs.md +0 -2
  27. package/docs/components/base/xt-text.md +1 -2
  28. package/docs/components/base/xt-time.md +0 -2
  29. package/docs/components/base/xt-transfer-tree.md +0 -2
  30. package/docs/components/base/xt-upload.md +11 -8
  31. package/docs/components/utils/config.md +285 -0
  32. package/docs/components/utils/format.md +445 -0
  33. package/package.json +5 -2
  34. package/src/components/xt-badge/style/index.scss +0 -22
  35. package/src/components/xt-chart/XtBar.vue +0 -3
  36. package/src/components/xt-date-picker/component/Picker.vue +196 -0
  37. package/src/components/xt-date-picker/component/RangeDate.vue +136 -0
  38. package/src/components/xt-date-picker/index.vue +164 -144
  39. package/src/components/xt-flex-box/index.vue +1 -1
  40. package/src/components/xt-form-schema/index.js +8 -0
  41. package/src/components/xt-form-schema/index.vue +328 -0
  42. package/src/components/xt-grid-item/index.vue +2 -2
  43. package/src/components/xt-input/index.vue +224 -28
  44. package/src/components/xt-input/style/index.scss +10 -0
  45. package/src/components/xt-layout/ExFieldset.vue +4 -4
  46. package/src/components/xt-list/index.js +7 -7
  47. package/src/components/xt-list/index.vue +885 -885
  48. package/src/components/xt-page/index.vue +148 -75
  49. package/src/components/xt-progress/style/index.scss +0 -14
  50. package/src/components/xt-tab-pane/index.js +10 -0
  51. package/src/components/{xt-tabs/TabPane.vue → xt-tab-pane/index.vue} +14 -1
  52. package/src/components/xt-table/XtTableCell.vue +2 -2
  53. package/src/components/xt-table/index.vue +5 -7
  54. package/src/components/xt-tabs/index.js +1 -3
  55. package/src/components/xt-tabs/index.vue +303 -44
  56. package/src/components/xt-tabs/style/index.scss +0 -40
  57. package/src/components/xt-text/style/index.scss +0 -15
  58. package/src/components/xt-transfer-tree/index.js +7 -7
  59. package/src/components/xt-transfer-tree/index.vue +493 -493
  60. package/src/components/xt-upload/index.vue +12 -6
  61. package/src/enhance/index.scss +13 -0
  62. package/src/index.js +7 -2
  63. package/src/styles/theme/colors.scss +0 -44
  64. package/src/styles/theme/dark-variables.scss +0 -29
  65. package/lib/demo.html +0 -10
  66. package/lib/index.common.js +0 -126851
  67. package/lib/index.css +0 -1
  68. package/lib/index.umd.js +0 -126861
  69. package/lib/index.umd.min.js +0 -1
  70. package/src/components/xt-date-picker/SearchDate.vue +0 -45
  71. package/src/components/xt-date-picker/quarter.vue +0 -154
  72. package/src/components/xt-table/index copy.vue +0 -663
@@ -1,34 +1,42 @@
1
1
  <template>
2
- <div class="xt-tabs" :class="[
3
- `xt-tabs--${position}`,
4
- { 'xt-tabs--card': type === 'card' }
2
+ <div ref="tabsWrap" class="xt-tabs" :class="[
3
+ `xt-tabs--${actualPosition}`,
4
+ { 'xt-tabs--card': type === 'card' },
5
+ { 'xt-tabs--border-card': type === 'border-card' },
6
+ { 'xt-tabs--editable': editable }
5
7
  ]">
6
- <div class="xt-tabs__header">
7
- <div class="xt-tabs__nav">
8
+ <div class="xt-tabs__header" ref="tabsHeader">
9
+ <div class="xt-tabs__nav" ref="tabsNav">
8
10
  <div
9
11
  v-for="(pane, index) in panes"
10
12
  :key="pane.name"
11
13
  class="xt-tabs__nav-item"
12
- :class="{ 'xt-tabs__nav-item--active': activeName === pane.name }"
13
- @click="handleTabClick(pane.name)"
14
+ :class="{
15
+ 'xt-tabs__nav-item--active': activeName === pane.name,
16
+ 'xt-tabs__nav-item--disabled': pane.disabled
17
+ }"
18
+ @click="handleTabClick(pane)"
14
19
  >
15
20
  <span class="xt-tabs__nav-link">{{ pane.label }}</span>
21
+ <span
22
+ v-if="(closable || pane.closable) && !editable"
23
+ class="xt-tabs__close"
24
+ @click.stop="handleTabRemove(pane.name)"
25
+ >×</span>
26
+ </div>
27
+ <div
28
+ v-if="addable || editable"
29
+ class="xt-tabs__nav-item xt-tabs__nav-item--add"
30
+ @click="handleTabAdd"
31
+ >
32
+ <span>+</span>
16
33
  </div>
17
34
  </div>
18
35
  <div class="xt-tabs__nav-indicator" :style="indicatorStyle"></div>
19
36
  </div>
20
37
 
21
38
  <div class="xt-tabs__content">
22
- <transition name="xt-tabs-fade" mode="out-in">
23
- <div
24
- v-for="(pane, index) in panes"
25
- :key="pane.name"
26
- class="xt-tabs__pane"
27
- v-show="activeName === pane.name"
28
- >
29
- <slot :name="pane.name"></slot>
30
- </div>
31
- </transition>
39
+ <slot></slot>
32
40
  </div>
33
41
  </div>
34
42
  </template>
@@ -43,13 +51,29 @@ export default {
43
51
  },
44
52
  type: {
45
53
  type: String,
46
- default: 'default',
47
- validator: (val) => ['default', 'card'].includes(val)
54
+ default: 'card',
55
+ validator: (val) => ['default', 'card', 'border-card'].includes(val)
48
56
  },
49
57
  position: {
50
58
  type: String,
51
59
  default: 'top',
52
60
  validator: (val) => ['top', 'bottom', 'left', 'right'].includes(val)
61
+ },
62
+ tabPosition: {
63
+ type: String,
64
+ default: ''
65
+ },
66
+ closable: {
67
+ type: Boolean,
68
+ default: false
69
+ },
70
+ addable: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ editable: {
75
+ type: Boolean,
76
+ default: false
53
77
  }
54
78
  },
55
79
  data() {
@@ -58,56 +82,291 @@ export default {
58
82
  activeName: this.value
59
83
  }
60
84
  },
61
- watch: {
62
- value(val) {
63
- this.activeName = val
64
- },
65
- activeName(val) {
66
- this.$emit('input', val)
67
- this.$emit('change', val)
68
- }
69
- },
70
85
  computed: {
86
+ actualPosition() {
87
+ return this.tabPosition || this.position
88
+ },
71
89
  indicatorStyle() {
72
90
  const activeIndex = this.panes.findIndex(p => p.name === this.activeName)
73
- if (activeIndex === -1) return { display: 'none' }
91
+ if (activeIndex === -1 || !this.$refs.tabsNav) return { display: 'none' }
74
92
 
75
- const navItems = this.$el && this.$el.querySelectorAll('.xt-tabs__nav-item')
93
+ const navItems = this.$refs.tabsNav.querySelectorAll('.xt-tabs__nav-item:not(.xt-tabs__nav-item--add)')
76
94
  if (!navItems || navItems.length === 0) return { display: 'none' }
77
95
 
78
96
  const activeItem = navItems[activeIndex]
79
- return {
80
- left: `${activeItem.offsetLeft}px`,
81
- width: `${activeItem.offsetWidth}px`,
82
- display: 'block'
97
+ if (!activeItem) return { display: 'none' }
98
+
99
+ const pos = this.actualPosition
100
+ const base = { transition: 'all 0.3s ease' }
101
+ if (pos === 'top' || pos === 'bottom') {
102
+ return {
103
+ ...base,
104
+ left: `${activeItem.offsetLeft}px`,
105
+ width: `${activeItem.offsetWidth}px`,
106
+ height: '2px',
107
+ bottom: pos === 'top' ? 0 : 'auto',
108
+ top: pos === 'bottom' ? 0 : 'auto',
109
+ display: 'block'
110
+ }
111
+ } else {
112
+ return {
113
+ ...base,
114
+ top: `${activeItem.offsetTop}px`,
115
+ height: `${activeItem.offsetHeight}px`,
116
+ width: '2px',
117
+ left: pos === 'left' ? 'auto' : 0,
118
+ right: pos === 'right' ? 0 : 'auto',
119
+ display: 'block'
120
+ }
83
121
  }
84
122
  }
85
123
  },
124
+ watch: {
125
+ value(val) {
126
+ this.activeName = val
127
+ },
128
+ activeName(val) {
129
+ this.$emit('input', val)
130
+ this.$emit('change', val)
131
+ this.$nextTick(() => this.$forceUpdate())
132
+ },
133
+ panes: {
134
+ handler() {
135
+ this.$nextTick(() => this.$forceUpdate())
136
+ },
137
+ deep: true
138
+ }
139
+ },
86
140
  methods: {
87
- handleTabClick(name) {
88
- this.activeName = name
141
+ handleTabClick(pane) {
142
+ if (pane.disabled) return
143
+ this.activeName = pane.name
144
+ this.$emit('tab-click', pane)
145
+ },
146
+ handleTabRemove(name) {
147
+ this.$emit('tab-remove', name)
148
+ this.$emit('edit', name, 'remove')
149
+ const index = this.panes.findIndex(p => p.name === name)
150
+ if (index > -1) {
151
+ this.panes.splice(index, 1)
152
+ if (this.activeName === name && this.panes.length > 0) {
153
+ this.activeName = this.panes[0].name
154
+ }
155
+ }
156
+ },
157
+ handleTabAdd() {
158
+ this.$emit('tab-add')
159
+ this.$emit('edit', null, 'add')
89
160
  },
90
161
  addPane(pane) {
91
- if (!this.panes.find(p => p.name === pane.name)) {
162
+ const exist = this.panes.some(p => p.name === pane.name)
163
+ if (!exist) {
92
164
  this.panes.push(pane)
93
165
  if (!this.activeName && this.panes.length === 1) {
94
166
  this.activeName = pane.name
95
167
  }
168
+ this.$nextTick(() => this.$forceUpdate())
96
169
  }
97
170
  },
98
171
  removePane(name) {
99
- const index = this.panes.findIndex(p => p.name === name)
100
- if (index > -1) {
101
- this.panes.splice(index, 1)
172
+ const idx = this.panes.findIndex(p => p.name === name)
173
+ if (idx > -1) {
174
+ this.panes.splice(idx, 1)
175
+ this.$nextTick(() => this.$forceUpdate())
102
176
  }
177
+ },
178
+ collectPanes() {
179
+ this.panes = []
180
+ this.$children.forEach(child => {
181
+ if (child.$options.name === 'XtTabPane') {
182
+ this.addPane({
183
+ name: child.name,
184
+ label: child.label,
185
+ disabled: child.disabled,
186
+ closable: child.closable
187
+ })
188
+ }
189
+ })
103
190
  }
104
191
  },
105
192
  mounted() {
106
- this.$children.forEach(child => {
107
- if (child.$options.name === 'XtTabPane') {
108
- this.addPane({ name: child.name, label: child.label })
109
- }
193
+ this.$nextTick(() => {
194
+ this.collectPanes()
195
+ this.$watch(() => this.$children, () => {
196
+ this.collectPanes()
197
+ }, { flush: 'post' })
110
198
  })
111
199
  }
112
200
  }
113
201
  </script>
202
+
203
+ <style lang="scss" scoped>
204
+ .xt-tabs {
205
+ display: flex;
206
+ flex-direction: column;
207
+
208
+ &--top, &--bottom {
209
+ flex-direction: column;
210
+ .xt-tabs__header {
211
+ width: 100%;
212
+ }
213
+ }
214
+
215
+ &--left, &--right {
216
+ flex-direction: row;
217
+ .xt-tabs__header {
218
+ flex-direction: column;
219
+ width: auto;
220
+ }
221
+ .xt-tabs__nav {
222
+ flex-direction: column;
223
+ }
224
+ .xt-tabs__nav-indicator {
225
+ width: 2px;
226
+ height: auto;
227
+ }
228
+ .xt-tabs__content {
229
+ border-left: 1px solid #dcdfe6;
230
+ border-top: none;
231
+ }
232
+ &--right .xt-tabs__content {
233
+ border-left: none;
234
+ border-right: 1px solid #dcdfe6;
235
+ }
236
+ }
237
+
238
+ &--top .xt-tabs__nav-indicator {
239
+ bottom: 0;
240
+ }
241
+ &--bottom .xt-tabs__nav-indicator {
242
+ top: 0;
243
+ }
244
+ &--left .xt-tabs__nav-indicator {
245
+ right: 0;
246
+ }
247
+ &--right .xt-tabs__nav-indicator {
248
+ left: 0;
249
+ }
250
+
251
+ &--card {
252
+ .xt-tabs__header {
253
+ margin-bottom: -1px;
254
+ }
255
+
256
+ .xt-tabs__nav-item {
257
+ border: 1px solid transparent;
258
+ border-bottom: none;
259
+ background: #f5f7fa;
260
+
261
+ &--active {
262
+ background: #fff;
263
+ border-color: #dcdfe6;
264
+ border-bottom-color: #fff;
265
+ }
266
+ }
267
+ &--left, &--right {
268
+ .xt-tabs__nav-item {
269
+ border-bottom: 1px solid transparent;
270
+ border-right: none;
271
+ }
272
+ .xt-tabs__nav-item--active {
273
+ border-right-color: #fff;
274
+ border-bottom-color: #dcdfe6;
275
+ }
276
+ }
277
+ }
278
+
279
+ &--border-card {
280
+ border: 1px solid #dcdfe6;
281
+ border-radius: 4px;
282
+ overflow: hidden;
283
+
284
+ .xt-tabs__nav-item--active {
285
+ background: #ecf5ff;
286
+ color: #409eff;
287
+ }
288
+ }
289
+
290
+ &--editable {
291
+ .xt-tabs__close {
292
+ display: inline-block;
293
+ }
294
+ }
295
+ }
296
+
297
+ .xt-tabs__header {
298
+ position: relative;
299
+ display: flex;
300
+ }
301
+
302
+ .xt-tabs__nav {
303
+ display: flex;
304
+ flex-wrap: nowrap;
305
+ }
306
+
307
+ .xt-tabs__nav-item {
308
+ position: relative;
309
+ padding: 12px 20px;
310
+ cursor: pointer;
311
+ font-size: 14px;
312
+ color: #606266;
313
+ transition: all 0.3s;
314
+ white-space: nowrap;
315
+
316
+ &--active {
317
+ color: #409eff;
318
+ }
319
+
320
+ &--disabled {
321
+ cursor: not-allowed;
322
+ color: #c0c4cc;
323
+ }
324
+
325
+ &--add {
326
+ color: #909399;
327
+ font-size: 20px;
328
+ }
329
+
330
+ &:hover:not(.xt-tabs__nav-item--disabled) {
331
+ color: #409eff;
332
+ background-color: #ecf5ff;
333
+ }
334
+ }
335
+
336
+ .xt-tabs__nav-link {
337
+ display: inline-block;
338
+ }
339
+
340
+ .xt-tabs__close {
341
+ display: none;
342
+ margin-left: 8px;
343
+ font-size: 16px;
344
+ line-height: 1;
345
+ color: #909399;
346
+ vertical-align: middle;
347
+
348
+ &:hover {
349
+ color: #f56c6c;
350
+ }
351
+ }
352
+
353
+ .xt-tabs__nav-indicator {
354
+ position: absolute;
355
+ height: 2px;
356
+ background-color: #409eff;
357
+ }
358
+
359
+ .xt-tabs__content {
360
+ flex: 1;
361
+ padding: 16px;
362
+ border-top: 1px solid #dcdfe6;
363
+ }
364
+
365
+ .xt-tabs--border-card .xt-tabs__content {
366
+ border-top: none;
367
+ }
368
+
369
+ .xt-tabs__pane {
370
+ min-height: 40px;
371
+ }
372
+ </style>
@@ -155,43 +155,3 @@
155
155
  opacity: 0;
156
156
  transform: translateY(-10px);
157
157
  }
158
-
159
- [data-theme='dark'], html.dark {
160
- .xt-tabs__header {
161
- border-color: $xt-dark-color-border;
162
- }
163
-
164
- .xt-tabs--card .xt-tabs__header {
165
- background: $xt-dark-color-bg-secondary;
166
- }
167
-
168
- .xt-tabs--card .xt-tabs__nav-item--active {
169
- background: $xt-dark-color-bg-primary;
170
- border-color: $xt-dark-color-border;
171
- border-bottom-color: $xt-dark-color-bg-primary;
172
- }
173
-
174
- .xt-tabs--left .xt-tabs__header {
175
- border-color: $xt-dark-color-border;
176
- }
177
-
178
- .xt-tabs--right .xt-tabs__header {
179
- border-color: $xt-dark-color-border;
180
- }
181
-
182
- .xt-tabs__nav-item {
183
- color: $xt-dark-color-text-secondary;
184
- }
185
-
186
- .xt-tabs__nav-item:hover {
187
- color: $xt-dark-color-primary;
188
- }
189
-
190
- .xt-tabs__nav-item--active {
191
- color: $xt-dark-color-primary;
192
- }
193
-
194
- .xt-tabs--card .xt-tabs__content {
195
- border-color: $xt-dark-color-border;
196
- }
197
- }
@@ -93,18 +93,3 @@
93
93
  }
94
94
  }
95
95
 
96
- // 暗色主题
97
- [data-theme='dark'], html.dark {
98
- .xt-text--primary {
99
- color: $xt-dark-color-primary;
100
- }
101
- .xt-text--success {
102
- color: $xt-dark-color-success;
103
- }
104
- .xt-text--warning {
105
- color: $xt-dark-color-warning;
106
- }
107
- .xt-text--danger {
108
- color: $xt-dark-color-danger;
109
- }
110
- }
@@ -1,8 +1,8 @@
1
- import XtTransferTree from './index.vue'
2
-
3
- XtTransferTree.install = function (Vue) {
4
- Vue.component(XtTransferTree.name, XtTransferTree)
5
- }
6
-
7
- export default XtTransferTree
1
+ import XtTransferTree from './index.vue'
2
+
3
+ XtTransferTree.install = function (Vue) {
4
+ Vue.component(XtTransferTree.name, XtTransferTree)
5
+ }
6
+
7
+ export default XtTransferTree
8
8
  export { XtTransferTree }