@aochuang/common 1.0.0 → 1.0.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.
Files changed (194) hide show
  1. package/common/loading/index.js +7 -0
  2. package/common/loading/loading.vue +71 -0
  3. package/common/tips/index.js +7 -0
  4. package/common/tips/tips.vue +82 -0
  5. package/common/tooltip/index.js +7 -0
  6. package/common/tooltip/popper.js +18 -0
  7. package/common/tooltip/tooltip.vue +55 -0
  8. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-boolean.vue +33 -0
  9. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date-range.vue +30 -0
  10. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date.vue +41 -0
  11. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime-range.vue +34 -0
  12. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime.vue +41 -0
  13. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number-range.vue +67 -0
  14. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number.vue +35 -0
  15. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-string.vue +41 -0
  16. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-value.vue +73 -0
  17. package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item.vue +226 -0
  18. package/components/advanced-filter/advanced-filter-condition-toggle.vue +112 -0
  19. package/components/advanced-filter/advanced-filter-condition.vue +352 -0
  20. package/components/advanced-filter/advanced-filter-permanent-item.vue +10 -0
  21. package/components/advanced-filter/advanced-filter-permanent.vue +10 -0
  22. package/components/advanced-filter/advanced-filter-scene-form.vue +95 -0
  23. package/components/advanced-filter/advanced-filter-scene-item.vue +64 -0
  24. package/components/advanced-filter/advanced-filter-scene-manage.vue +264 -0
  25. package/components/advanced-filter/advanced-filter-scene-transfer.vue +283 -0
  26. package/components/advanced-filter/advanced-filter-scene.vue +199 -0
  27. package/components/advanced-filter/advanced-filter.vue +114 -0
  28. package/components/advanced-filter/index.js +36 -0
  29. package/components/advanced-filter/utils.js +132 -0
  30. package/components/autocomplete/autocomplete.vue +121 -0
  31. package/components/autocomplete/index.js +7 -0
  32. package/components/avatar/avatar.png +0 -0
  33. package/components/avatar/avatar.vue +212 -0
  34. package/components/avatar/index.js +7 -0
  35. package/components/brick-wall/brick-wall-skeleton.vue +125 -0
  36. package/components/brick-wall/brick-wall.vue +293 -0
  37. package/components/brick-wall/index.js +7 -0
  38. package/components/button/button.vue +537 -0
  39. package/components/button/index.js +7 -0
  40. package/components/button/utils.js +20 -0
  41. package/components/cascader/cascader.vue +184 -0
  42. package/components/cascader/index.js +7 -0
  43. package/components/cascader/util.js +50 -0
  44. package/components/checkbox/checkbox.vue +114 -0
  45. package/components/checkbox/index.js +7 -0
  46. package/components/checkbox-button/index.js +8 -0
  47. package/components/checkbox-group/checkbox-group.vue +11 -0
  48. package/components/checkbox-group/index.js +7 -0
  49. package/components/date-picker/date-picker.vue +300 -0
  50. package/components/date-picker/index.js +7 -0
  51. package/components/dialog/dialog.vue +182 -0
  52. package/components/dialog/index.js +14 -0
  53. package/components/dialog/utils.js +20 -0
  54. package/components/drawer/drawer.vue +186 -0
  55. package/components/drawer/index.js +14 -0
  56. package/components/drawer/utils.js +36 -0
  57. package/components/dropdown/dropdown-item.vue +63 -0
  58. package/components/dropdown/dropdown.vue +286 -0
  59. package/components/dropdown/index.js +16 -0
  60. package/components/empty/empty.vue +62 -0
  61. package/components/empty/index.js +7 -0
  62. package/components/filter/filter-group.vue +44 -0
  63. package/components/filter/filter-item.vue +122 -0
  64. package/components/filter/filter-more.vue +114 -0
  65. package/components/filter/filter.vue +407 -0
  66. package/components/filter/index.js +20 -0
  67. package/components/filter/refresh-line.svg +1 -0
  68. package/components/filter/util.js +5 -0
  69. package/components/form/form-cell.vue +231 -0
  70. package/components/form/form-group.vue +147 -0
  71. package/components/form/form-row.vue +51 -0
  72. package/components/form/form.vue +256 -0
  73. package/components/form/index.js +13 -0
  74. package/components/grid/grid-card-view/grid-card-view.vue +157 -0
  75. package/components/grid/grid-column.vue +136 -0
  76. package/components/grid/grid-filter/grid-filter-group.vue +41 -0
  77. package/components/grid/grid-filter/grid-filter-item.vue +68 -0
  78. package/components/grid/grid-filter/grid-filter.vue +115 -0
  79. package/components/grid/grid-filter/util.js +7 -0
  80. package/components/grid/grid-filter-operate/grid-filter-operate-item.vue +55 -0
  81. package/components/grid/grid-filter-operate/grid-filter-operate.vue +46 -0
  82. package/components/grid/grid-sort/grid-sort-proxy.js +27 -0
  83. package/components/grid/grid-sort/grid-sort.vue +205 -0
  84. package/components/grid/grid-sort/icons/asc.png +0 -0
  85. package/components/grid/grid-sort/icons/desc.png +0 -0
  86. package/components/grid/grid-sort/index.js +7 -0
  87. package/components/grid/grid-table-view/grid-table-view.vue +178 -0
  88. package/components/grid/grid-table.vue +547 -0
  89. package/components/grid/grid-toolbar/grid-batch-toolbar-proxy.js +21 -0
  90. package/components/grid/grid-toolbar/grid-batch-toolbar.vue +129 -0
  91. package/components/grid/grid-toolbar/grid-global-toolbar-proxy.js +21 -0
  92. package/components/grid/grid-toolbar/grid-global-toolbar.vue +37 -0
  93. package/components/grid/grid-toolbar/grid-more-toolbar-proxy.js +21 -0
  94. package/components/grid/grid-toolbar/grid-more-toolbar.vue +138 -0
  95. package/components/grid/grid-toolbar/grid-row-toolbar.vue +279 -0
  96. package/components/grid/grid-view-select.vue +78 -0
  97. package/components/grid/grid.vue +1102 -0
  98. package/components/grid/icons/more-line.svg +1 -0
  99. package/components/grid/icons/refresh.svg +14 -0
  100. package/components/grid/index.js +61 -0
  101. package/components/grid/util.js +31 -0
  102. package/components/icon/demo.css +539 -0
  103. package/components/icon/demo_index.html +7433 -0
  104. package/components/icon/icon.vue +96 -0
  105. package/components/icon/iconfont.css +1275 -0
  106. package/components/icon/iconfont.eot +0 -0
  107. package/components/icon/iconfont.js +1 -0
  108. package/components/icon/iconfont.json +2214 -0
  109. package/components/icon/iconfont.svg +455 -0
  110. package/components/icon/iconfont.ttf +0 -0
  111. package/components/icon/iconfont.woff +0 -0
  112. package/components/icon/iconfont.woff2 +0 -0
  113. package/components/icon/index.js +7 -0
  114. package/components/image/image.vue +299 -0
  115. package/components/image/index.js +12 -0
  116. package/components/image/util.js +26 -0
  117. package/components/index.js +153 -0
  118. package/components/loading/index.js +7 -0
  119. package/components/loading/loading.vue +130 -0
  120. package/components/menu/index.js +14 -0
  121. package/components/menu/menu-group.vue +240 -0
  122. package/components/menu/menu-item.vue +215 -0
  123. package/components/menu/menu.vue +64 -0
  124. package/components/message/index.js +19 -0
  125. package/components/message/message.js +28 -0
  126. package/components/message/message.less +6 -0
  127. package/components/message-box/index.js +10 -0
  128. package/components/message-box/message-box.js +140 -0
  129. package/components/message-box/message-box.less +5 -0
  130. package/components/pagination/index.js +7 -0
  131. package/components/pagination/pagination.vue +193 -0
  132. package/components/panel/index.js +7 -0
  133. package/components/panel/panel.vue +44 -0
  134. package/components/popover/index.js +7 -0
  135. package/components/popover/popover.vue +140 -0
  136. package/components/popup-select/index.js +7 -0
  137. package/components/popup-select/popup-select.vue +114 -0
  138. package/components/radio/index.js +7 -0
  139. package/components/radio/radio.vue +92 -0
  140. package/components/radio-button/index.js +7 -0
  141. package/components/radio-button/radio-button.vue +20 -0
  142. package/components/radio-group/index.js +7 -0
  143. package/components/radio-group/radio-group.vue +22 -0
  144. package/components/searchbox/index.js +7 -0
  145. package/components/searchbox/searchbox.vue +260 -0
  146. package/components/select/index.js +9 -0
  147. package/components/select/select-load-more.vue +53 -0
  148. package/components/select/select.vue +572 -0
  149. package/components/skeleton/index.js +14 -0
  150. package/components/skeleton/skeleton-rows.vue +52 -0
  151. package/components/skeleton/skeleton.vue +72 -0
  152. package/components/sortable/index.js +9 -0
  153. package/components/sortable/sortable-item.vue +77 -0
  154. package/components/sortable/sortable.vue +62 -0
  155. package/components/spinner/index.js +7 -0
  156. package/components/spinner/spinner.vue +121 -0
  157. package/components/spinner-range/index.js +7 -0
  158. package/components/spinner-range/spinner-range.vue +97 -0
  159. package/components/spinner-textarea/index.js +7 -0
  160. package/components/spinner-textarea/spinner-textarea.vue +65 -0
  161. package/components/switch/index.js +7 -0
  162. package/components/switch/switch.vue +105 -0
  163. package/components/tabs/index.js +10 -0
  164. package/components/tabs/tabs.vue +115 -0
  165. package/components/tag/index.js +9 -0
  166. package/components/tag/tag.less +30 -0
  167. package/components/text/index.js +7 -0
  168. package/components/text/text.vue +69 -0
  169. package/components/textarea/index.js +7 -0
  170. package/components/textarea/textarea.vue +229 -0
  171. package/components/textbox/index.js +7 -0
  172. package/components/textbox/textbox.vue +275 -0
  173. package/components/time-picker/index.js +7 -0
  174. package/components/time-picker/time-picker.vue +77 -0
  175. package/components/toolbar/index.js +14 -0
  176. package/components/toolbar/toolbar-item.vue +43 -0
  177. package/components/toolbar/toolbar.vue +81 -0
  178. package/components/tooltip/index.js +9 -0
  179. package/components/tooltip/tooltip.vue +86 -0
  180. package/components/transfer/index.js +7 -0
  181. package/components/transfer/transfer-load-more.vue +53 -0
  182. package/components/transfer/transfer.vue +245 -0
  183. package/components/tree/index.js +7 -0
  184. package/components/tree/tree.vue +326 -0
  185. package/components/tree/utils.js +122 -0
  186. package/components/video/index.js +7 -0
  187. package/components/video/video.vue +53 -0
  188. package/package.json +4 -1
  189. package/utils/date.js +55 -0
  190. package/utils/emitter.js +3 -0
  191. package/utils/json.js +19 -0
  192. package/utils/resize-event.js +35 -0
  193. package/utils/util.js +12 -0
  194. package/utils/utils.js +0 -0
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="ui-sortable-item" :class="[{'is-hover-handle': hoverShowHandle}, clsName]">
3
+ <template v-if="enableHandle">
4
+ <span v-if="!$scopedSlots.handle && !customHandle" class="ui-sortable-item__handle" :class="handleClass" title="拖拽排序"></span>
5
+ <slot v-else name="handle" :className="handleClass"></slot>
6
+ </template>
7
+ <slot :handle-class="handleClass"></slot>
8
+ </div>
9
+ </template>
10
+ <script>
11
+ export default {
12
+ name: 'UiSortableItem',
13
+ inject: ['UiSortable'],
14
+ props: {
15
+ customHandle: {
16
+ type: Boolean,
17
+ default: false
18
+ }
19
+ },
20
+ computed: {
21
+ enableHandle () {
22
+ return this.UiSortable.innerEnableHandle
23
+ },
24
+ hoverShowHandle () {
25
+ return this.UiSortable.hoverShowHandle
26
+ },
27
+ handleClass () {
28
+ return this.UiSortable.handleClass
29
+ },
30
+ clsName () {
31
+ return this.UiSortable.id + '-item'
32
+ }
33
+ }
34
+ }
35
+ </script>
36
+ <style lang="less">
37
+ .ui-sortable-item{
38
+ position: relative;
39
+ &.is-hover-handle{
40
+ .ui-sortable-item__handle{
41
+ opacity: 0;
42
+ }
43
+ &:hover{
44
+ .ui-sortable-item__handle{
45
+ opacity: 1;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ .ui-sortable-item__handle{
51
+ width: 12px;
52
+ height: 18px;
53
+ position: absolute;
54
+ left: 9px;
55
+ top: 50%;
56
+ transform: translateY(-50%);
57
+ z-index: 5;
58
+ cursor: move;
59
+ transition: all .3s;
60
+ &:after{
61
+ content: '';
62
+ top: 3px;
63
+ z-index: 10;
64
+ position: absolute;
65
+ cursor: move;
66
+ width: 1px;
67
+ height: 1px;
68
+ background-color: currentColor;
69
+ box-shadow:
70
+ 0 0, 3px 0,
71
+ 0 3px, 3px 3px,
72
+ 0 6px, 3px 6px,
73
+ 0 9px, 3px 9px;
74
+ border-radius: 50%;
75
+ }
76
+ }
77
+ </style>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class='ui-sortable'>
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import Sortable from 'sortablejs'
9
+
10
+ let uniqueNumber = Date.now()
11
+
12
+ export default {
13
+ name: 'UiSortable',
14
+ props: {
15
+ enableHandle: {
16
+ type: Boolean,
17
+ default: true
18
+ },
19
+ hoverShowHandle: {
20
+ type: Boolean,
21
+ default: true
22
+ }
23
+ },
24
+ provide () {
25
+ return {
26
+ UiSortable: this
27
+ }
28
+ },
29
+ computed: {
30
+ id () {
31
+ return 'ui-sortable-' + (uniqueNumber++)
32
+ },
33
+ innerEnableHandle () {
34
+ return this.enableHandle
35
+ },
36
+ handleClass () {
37
+ return this.id + '-handle'
38
+ }
39
+ },
40
+ mounted () {
41
+ this.sortable = new Sortable(this.$el, {
42
+ sort: true,
43
+ draggable: '.' + this.id + '-item',
44
+ handle: this.enableHandle ? '.' + this.handleClass : '.ui-sortable-item',
45
+ animation: 150,
46
+ ghostClass: 'ui-sortable--ghost',
47
+ chosenClass: 'ui-sortable--chosen',
48
+ dragClass: 'ui-sortable--drag',
49
+ forceFallback: true,
50
+ fallbackClass: 'ui-sortable__fallback',
51
+ onSort: (evt) => {
52
+ this.$emit('sort', {
53
+ oldIndex: evt.oldIndex,
54
+ newIndex: evt.newIndex
55
+ })
56
+ }
57
+ })
58
+ }
59
+ }
60
+ </script>
61
+ <style lang="less">
62
+ </style>
@@ -0,0 +1,7 @@
1
+ import Spinner from './spinner.vue'
2
+
3
+ Spinner.install = (Vue) => {
4
+ Vue.component(Spinner.name, Spinner)
5
+ }
6
+
7
+ export default Spinner
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <input-number
3
+ ref="input"
4
+ v-model="innerValue"
5
+ class="ui-spinner"
6
+ :class="['ui-spinner--' + size, { 'is-adjustable': adjustable }]"
7
+ :size="size"
8
+ :controls-position="controlsPosition"
9
+ :placeholder="placeholder"
10
+ :precision="precision"
11
+ :disabled="disabled"
12
+ :max="max"
13
+ :min="min"
14
+ :style="{ width: width }"
15
+ @change="handleChange"
16
+ />
17
+ </template>
18
+ <script>
19
+ import inputNumber from 'element-ui/lib/input-number'
20
+ import 'element-ui/lib/theme-chalk/input-number.css'
21
+
22
+ export default {
23
+ name: 'UiSpinner',
24
+ components: {
25
+ inputNumber
26
+ },
27
+ props: {
28
+ value: {
29
+ type: [String, Number]
30
+ },
31
+ disabled: {
32
+ type: Boolean
33
+ },
34
+ placeholder: {
35
+ type: String
36
+ },
37
+ emptiable: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ size: {
42
+ type: String,
43
+ default: 'small'
44
+ },
45
+ controlsPosition: {
46
+ type: String,
47
+ default: 'right'
48
+ },
49
+ adjustable: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ precision: {
54
+ type: Number
55
+ },
56
+ width: {
57
+ type: String,
58
+ default: '170px'
59
+ },
60
+ max: {
61
+ type: Number
62
+ },
63
+ min: {
64
+ type: Number
65
+ }
66
+ },
67
+ computed: {
68
+ innerValue: {
69
+ get() {
70
+ if (this.value === '') {
71
+ return
72
+ }
73
+ return this.value
74
+ },
75
+ set(val) {
76
+ this.$emit('input', val)
77
+ }
78
+ }
79
+ },
80
+ updated() {
81
+ if (this.emptiable) {
82
+ if (
83
+ this.value === null ||
84
+ this.value === undefined ||
85
+ this.value === ''
86
+ ) {
87
+ this.$refs.input.setCurrentValue(undefined)
88
+ }
89
+ } else {
90
+ if (!this.value) {
91
+ this.$refs.input.setCurrentValue(0)
92
+ }
93
+ }
94
+ },
95
+ methods: {
96
+ handleChange(e) {
97
+ this.$emit('change', {
98
+ value: e
99
+ })
100
+ }
101
+ }
102
+ }
103
+ </script>
104
+ <style lang="less">
105
+ .ui-spinner.el-input-number {
106
+ .el-input__inner{
107
+ box-sizing: border-box;
108
+ }
109
+ // &.el-input-number.el-input-number--small{
110
+ // width: 170px;
111
+ // }
112
+ &.is-controls-right {
113
+ .el-input {
114
+ .el-input__inner {
115
+ text-align: left;
116
+ padding-left: 12px;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ </style>
@@ -0,0 +1,7 @@
1
+ import SpinnerRange from './spinner-range'
2
+
3
+ SpinnerRange.install = Vue => {
4
+ Vue.component(SpinnerRange.name, SpinnerRange)
5
+ }
6
+
7
+ export default SpinnerRange
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <div class="ui-spinner-range">
3
+ <div class="ui-spinner-range__item">
4
+ <ui-spinner v-model="innerStartValue" :precision="precision" :min="startMin" :max="startMax" :width="startWidth" :placeholder="startPlaceholder"></ui-spinner>
5
+ </div>
6
+ <div class="ui-spinner-range__line">~</div>
7
+ <div class="ui-spinner-range__item">
8
+ <ui-spinner v-model="innerEndValue" :precision="precision" :min="endMin" :max="endMax" :width="endWidth" :placeholder="endPlaceholder"></ui-spinner>
9
+ </div>
10
+ <div class="ui-spinner-range__unit">{{ unit }}</div>
11
+ </div>
12
+ </template>
13
+ <script>
14
+ export default {
15
+ name: 'UiSpinnerRange',
16
+ props: {
17
+ value: {
18
+ type: Array
19
+ },
20
+ unit: {
21
+ type: String
22
+ },
23
+ startPlaceholder: {
24
+ type: String
25
+ },
26
+ endPlaceholder: {
27
+ type: String
28
+ },
29
+ startMin: {
30
+ type: Number
31
+ },
32
+ startMax: {
33
+ type: Number
34
+ },
35
+ precision: {
36
+ type: Number
37
+ },
38
+ endMin: {
39
+ type: Number
40
+ },
41
+ endMax: {
42
+ type: Number
43
+ },
44
+ startWidth: {
45
+ type: String
46
+ },
47
+ endWidth: {
48
+ type: String
49
+ },
50
+ },
51
+ computed: {
52
+ innerValue: {
53
+ get () {
54
+ return this.value || []
55
+ },
56
+ set (val) {
57
+ this.$emit('input', val)
58
+ }
59
+ },
60
+ innerStartValue: {
61
+ get () {
62
+ return this.innerValue[0]
63
+ },
64
+ set (val) {
65
+ const nextValue = [...this.innerValue]
66
+ nextValue.splice(0, 1, val)
67
+ this.innerValue = nextValue
68
+ }
69
+ },
70
+ innerEndValue: {
71
+ get () {
72
+ return this.innerValue[1]
73
+ },
74
+ set (val) {
75
+ const nextValue = [...this.innerValue]
76
+ nextValue.splice(1, 1, val)
77
+ this.innerValue = nextValue
78
+ }
79
+ }
80
+ }
81
+ }
82
+ </script>
83
+ <style lang="less">
84
+ .ui-spinner-range{
85
+ display: flex;
86
+ flex-direction: row;
87
+ align-items: center;
88
+ }
89
+ .ui-spinner-range__line{
90
+ color: #999;
91
+ margin: 0 6px;
92
+ }
93
+ .ui-spinner-range__unit{
94
+ color: #999;
95
+ margin-left: 6px;
96
+ }
97
+ </style>
@@ -0,0 +1,7 @@
1
+ import SpinnerTextarea from './spinner-textarea.vue'
2
+
3
+ SpinnerTextarea.install = (Vue) => {
4
+ Vue.component(SpinnerTextarea.name, SpinnerTextarea)
5
+ }
6
+
7
+ export default SpinnerTextarea
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <ui-textarea
3
+ ref="uiTextarea"
4
+ v-model="innerValue"
5
+ class="ui-spinner-textarea"
6
+ :class="['ui-spinner-textarea--' + size, { 'is-adjustable': adjustable }]"
7
+ :disabled="disabled"
8
+ :placeholder="placeholder"
9
+ :rows="rows"
10
+ :maxlength="null"
11
+ @change="handleChange"
12
+ />
13
+ </template>
14
+ <script>
15
+
16
+ export default {
17
+ name: 'UiSpinnerTextarea',
18
+ props: {
19
+ rows: {
20
+ type: Number
21
+ },
22
+ value: {
23
+ type: [String, Number, Array]
24
+ },
25
+ rangeSeparator: {
26
+ type: String,
27
+ default: '\n'
28
+ },
29
+ disabled: {
30
+ type: Boolean
31
+ },
32
+ placeholder: {
33
+ type: String
34
+ },
35
+ size: {
36
+ type: String,
37
+ default: 'small'
38
+ },
39
+ adjustable: {
40
+ type: Boolean,
41
+ default: true
42
+ }
43
+ },
44
+ computed: {
45
+ innerValue: {
46
+ get() {
47
+ if (this.value instanceof Array) {
48
+ return this.value.join(this.rangeSeparator)
49
+ }
50
+ return this.value
51
+ },
52
+ set(val) {
53
+ this.$emit('input', val)
54
+ }
55
+ }
56
+ },
57
+ methods: {
58
+ handleChange(e) {
59
+ this.$emit('change', {
60
+ value: e.value
61
+ })
62
+ }
63
+ }
64
+ }
65
+ </script>
@@ -0,0 +1,7 @@
1
+ import Switch from './switch'
2
+
3
+ Switch.install = (Vue) => {
4
+ Vue.component(Switch.name, Switch)
5
+ }
6
+
7
+ export default Switch
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <label class="ui-switch" :class="['ui-switch--' + size, {'is-disabled': disabled}]">
3
+ <div class="ui-switch__main">
4
+ <el-switch class="ui-switch__input" :width="switchWidth" :disabled="disabled" v-model="innerValue"></el-switch>
5
+ <span class="ui-switch__label" v-if="trueLabel && falseLabel">{{ value ? trueLabel : falseLabel }}</span>
6
+ <span class="ui-switch__label" v-if="$slots.default">
7
+ <slot></slot>
8
+ </span>
9
+ </div>
10
+ </label>
11
+ </template>
12
+ <script>
13
+ import ElSwitch from 'element-ui/lib/switch'
14
+ import 'element-ui/lib/theme-chalk/switch.css'
15
+
16
+ export default {
17
+ name: 'UiSwitch',
18
+ components: {
19
+ ElSwitch
20
+ },
21
+ props: {
22
+ value: {
23
+ type: Boolean
24
+ },
25
+ size: {
26
+ type: String,
27
+ default: 'small',
28
+ validator (value) {
29
+ return ['small', 'mini'].includes(value)
30
+ }
31
+ },
32
+ disabled: {
33
+ type: Boolean
34
+ },
35
+ trueLabel: {
36
+ type: String
37
+ },
38
+ falseLabel: {
39
+ type: String
40
+ }
41
+ },
42
+ computed: {
43
+ innerValue: {
44
+ get () {
45
+ return this.value
46
+ },
47
+ set (val) {
48
+ this.$emit('input', val)
49
+ }
50
+ },
51
+ switchWidth () {
52
+ const sizeMap = {
53
+ small: 36,
54
+ mini: 24
55
+ }
56
+ return sizeMap[this.size]
57
+ }
58
+ }
59
+ }
60
+ </script>
61
+ <style lang="less">
62
+ .ui-switch{
63
+ display: inline-block;
64
+ vertical-align: top;
65
+ padding-top: 8px;
66
+ padding-bottom: 8px;
67
+ &.is-disabled{
68
+ color: #aaa;
69
+ cursor: not-allowed;
70
+ }
71
+ .el-switch__core{
72
+ box-sizing: content-box;
73
+ }
74
+ .el-switch__core:after{
75
+ margin-top: 1px;
76
+ margin-left: 1px;
77
+ }
78
+ .el-switch.is-checked .el-switch__core::after{
79
+ margin-left: -15px;
80
+ }
81
+ }
82
+ .ui-switch__main{
83
+ display: flex;
84
+ flex-direction: row;
85
+ align-items: center;
86
+ line-height: 1;
87
+ }
88
+ .ui-switch__label{
89
+ margin-left: 6px;
90
+ }
91
+ .ui-switch--mini{
92
+ .el-switch__core{
93
+ height: 16px;
94
+ &:after {
95
+ width: 12px;
96
+ height: 12px;
97
+ }
98
+ }
99
+ .el-switch.is-checked {
100
+ .el-switch__core::after{
101
+ margin-left: -13px;
102
+ }
103
+ }
104
+ }
105
+ </style>
@@ -0,0 +1,10 @@
1
+ import Tabs from './tabs.vue'
2
+ import TabsPane from 'element-ui/lib/tab-pane'
3
+ import 'element-ui/lib/theme-chalk/tab-pane.css'
4
+
5
+ Tabs.install = (Vue) => {
6
+ Vue.component(Tabs.name, Tabs)
7
+ Vue.component('UiTabsPane', TabsPane)
8
+ }
9
+
10
+ export default Tabs
@@ -0,0 +1,115 @@
1
+ <template>
2
+ <el-tabs
3
+ ref="tabs"
4
+ class="ui-tabs"
5
+ v-model="innerValue"
6
+ :tab-position="tabPosition"
7
+ :type="type"
8
+ :style="style"
9
+ @tab-click="handleTabClick"
10
+ >
11
+ <slot></slot>
12
+ </el-tabs>
13
+ </template>
14
+ <script>
15
+ import Tabs from 'element-ui/lib/tabs'
16
+ import 'element-ui/lib/theme-chalk/tabs.css'
17
+
18
+ export default {
19
+ name: 'UiTabs',
20
+ components: {
21
+ ElTabs: Tabs
22
+ },
23
+ props: {
24
+ value: {
25
+ type: String
26
+ },
27
+ type: {
28
+ type: String
29
+ },
30
+ align: {
31
+ type: String,
32
+ default: 'left',
33
+ validator (value) {
34
+ return ['left', 'center', 'right'].indexOf(value) >= 0
35
+ }
36
+ },
37
+ height: {
38
+ type: String
39
+ },
40
+ tabPosition: {
41
+ type: String
42
+ }
43
+ },
44
+ data () {
45
+ return {
46
+ tabs: null
47
+ }
48
+ },
49
+ computed: {
50
+ innerValue: {
51
+ get () {
52
+ return this.value
53
+ },
54
+ set (val) {
55
+ this.$emit('input', val)
56
+ }
57
+ },
58
+ style () {
59
+ const style = {}
60
+ if (this.height) {
61
+ style.height = this.height
62
+ }
63
+ return style
64
+ }
65
+ },
66
+ mounted () {
67
+ this.tabs = this.$refs.tabs
68
+ },
69
+ methods: {
70
+ setCurrentName (name) {
71
+ this.$refs.tabs && this.$refs.tabs.setCurrentName(name)
72
+ },
73
+ // 上面那个会导致一直触发input事件,要解决切换选项卡检查是否有数据变化场景,需要静态方式设置currentName属性
74
+ setTabsStaticCurrentName (name) {
75
+ if (!this.$refs.tabs) {
76
+ return
77
+ }
78
+ this.$refs.tabs.currentName = name
79
+ },
80
+ handleTabClick (evt) {
81
+ this.$emit('tab-click', {
82
+ name: evt.name
83
+ })
84
+ }
85
+ }
86
+ }
87
+ </script>
88
+ <style lang="less">
89
+ .ui-tabs.is-one{
90
+ .el-tabs__header.is-top{
91
+ display: none;
92
+ }
93
+ }
94
+ .el-tabs--top.ui-tabs.el-tabs{
95
+ display: flex;
96
+ flex-direction: column;
97
+ .el-tabs__content{
98
+ flex: 1;
99
+ min-height: 0;
100
+ overflow: initial;
101
+ }
102
+ .el-tab-pane{
103
+ height: 100%;
104
+ }
105
+ }
106
+ .el-tabs--border-card.ui-tabs {
107
+ box-shadow: none;
108
+ & >.el-tabs__content{
109
+ padding: 0;
110
+ }
111
+ &.el-tabs--bottom .el-tabs__header.is-bottom{
112
+ margin-top: 0;
113
+ }
114
+ }
115
+ </style>
@@ -0,0 +1,9 @@
1
+ import ElTag from 'element-ui/lib/tag'
2
+ import 'element-ui/lib/theme-chalk/tag.css'
3
+ import './tag.less'
4
+
5
+ export default {
6
+ install (Vue) {
7
+ Vue.component('UiTag', ElTag)
8
+ }
9
+ }