@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,407 @@
1
+ <template>
2
+ <div class="ui-filter" :class="['is-' + dir]">
3
+ <slot />
4
+ <div class="ui-filter__fast">
5
+ <template v-if="fastFilterGroups && fastFilterGroups.length">
6
+ <div class="ui-filter__fast-groups">
7
+ <div
8
+ class="ui-filter__fast-group"
9
+ v-for="(group, index) in fastFilterGroups"
10
+ :key="group.id"
11
+ >
12
+ <div class="ui-filter__fast-group-label" v-if="group.props.label" :style="{'width': group.props.labelWidth}">
13
+ {{ group.props.label }}
14
+ </div>
15
+ <div class="ui-filter__fast-group-target">
16
+ <template v-if="group.children && group.children.length">
17
+ <div class="ui-filter__fast-list">
18
+ <div
19
+ v-for="(item, index) in group.children"
20
+ :key="index"
21
+ class="ui-filter__fast-item"
22
+ v-show="item.props.show !== false"
23
+ >
24
+ <span class="ui-filter__fast-item-label" v-if="item.props.label" :style="{'width': labelWidth}">{{item.props.label}}</span>
25
+ <div class="ui-filter__fast-item-target">
26
+ <component :is="handleRenderItem(item)" :data-key="item.info.count" />
27
+ </div>
28
+ </div>
29
+ <template v-if="(!fastFilterNotGroupItems || !fastFilterNotGroupItems.length) && index === fastFilterGroups.length - 1">
30
+ <template v-if="!imediate">
31
+ <div class="ui-filter__fast-item">
32
+ <ui-button :loading="tableLoading" icon="sousuo" type="primary" @click="handleSearchClick">搜索</ui-button>
33
+ </div>
34
+ <div class="ui-filter__fast-item">
35
+ <ui-button :loading="tableLoading" icon="refresh-line" @click="handleResetClick">重置</ui-button>
36
+ </div>
37
+ </template>
38
+ </template>
39
+ </div>
40
+ </template>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </template>
45
+ <template v-if="fastFilterNotGroupItems && fastFilterNotGroupItems.length">
46
+ <div class="ui-filter__fast-list">
47
+ <div
48
+ v-for="(item, index) in fastFilterNotGroupItems"
49
+ :key="index"
50
+ class="ui-filter__fast-item"
51
+ v-show="item.props.show !== false"
52
+ >
53
+ <span class="ui-filter__fast-item-label" v-if="item.props.label" :style="{'width': labelWidth}">{{item.props.label}}</span>
54
+ <div class="ui-filter__fast-item-target">
55
+ <component :is="handleRenderItem(item)" :data-key="item.info.count" />
56
+ </div>
57
+ </div>
58
+ <template v-if="!imediate">
59
+ <div class="ui-filter__fast-item">
60
+ <ui-button :loading="tableLoading" icon="sousuo" type="primary" @click="handleSearchClick">搜索</ui-button>
61
+ </div>
62
+ <div class="ui-filter__fast-item">
63
+ <ui-button :loading="tableLoading" icon="refresh-line" @click="handleResetClick">重置</ui-button>
64
+ </div>
65
+ </template>
66
+ </div>
67
+ </template>
68
+ </div>
69
+ <div class="ui-filter__more" v-if="moreFilterItems && moreFilterItems.length">
70
+ <filter-more
71
+ :value="value"
72
+ :items="moreFilterItems"
73
+ :label-width="labelWidth"
74
+ ></filter-more>
75
+ </div>
76
+ </div>
77
+ </template>
78
+ <script>
79
+ import { isEmpty } from '../../utils/util'
80
+ import FilterMore from './filter-more'
81
+ import { clone } from '../../utils/json'
82
+
83
+ export default {
84
+ name: 'UiFilter',
85
+ components: {
86
+ FilterMore
87
+ },
88
+ provide() {
89
+ return {
90
+ UiFilter: this
91
+ }
92
+ },
93
+ props: {
94
+ value: {
95
+ type: Object
96
+ },
97
+ ready: {
98
+ type: Boolean,
99
+ default: true
100
+ },
101
+ dir: {
102
+ type: String,
103
+ default: 'horizon',
104
+ validtor (value) {
105
+ return ['horizon', 'vertical'].includes(value)
106
+ }
107
+ },
108
+ labelWidth: {
109
+ type: String
110
+ },
111
+ imediate: {
112
+ type: Boolean,
113
+ default: true
114
+ },
115
+ tableLoading: {
116
+ type: Boolean,
117
+ default: false
118
+ }
119
+ },
120
+ data() {
121
+ return {
122
+ initValue: null,
123
+ items: [],
124
+ groups: [],
125
+ innerReady: false
126
+ }
127
+ },
128
+ computed: {
129
+ fastFilterGroups() {
130
+ return this.groups.map(v => {
131
+ const vv = Object.assign({}, v)
132
+ vv.children = this.fastFilterItems.filter(item => item.groupId === v.id)
133
+ return vv
134
+ })
135
+ },
136
+ fastFilterNotGroupItems() {
137
+ return (this.items || []).filter(v => !v.groupId)
138
+ },
139
+ fastFilterItems() {
140
+ return this.items.filter(v => !v.props.more)
141
+ },
142
+ moreFilterItems () {
143
+ return this.items.filter(v => !!v.props.more)
144
+ },
145
+ operaterFnMap () {
146
+ return {
147
+ eq ({ field, value }) {
148
+ return [[field, '=', value]]
149
+ },
150
+ like ({ field, value }) {
151
+ return [[field, '=', `%${value}%`]]
152
+ },
153
+ between ({ field, value }) {
154
+ if (Array.isArray(value)) {
155
+ const result = value.reduce((rs, v, i) => {
156
+ if (isEmpty(v)) {
157
+ return
158
+ }
159
+ if (i === 0) {
160
+ rs.push([field, '>', v])
161
+ } else {
162
+ rs.push([field, '<', v])
163
+ }
164
+ return rs
165
+ }, [])
166
+ if (!result.length) {
167
+ return
168
+ }
169
+ return result
170
+ }
171
+ },
172
+ in () {
173
+
174
+ }
175
+ }
176
+ }
177
+ },
178
+ watch: {
179
+ value: {
180
+ handler () {
181
+ if (this.ready && this.innerReady && this.imediate) {
182
+ this.handleChange()
183
+ }
184
+ },
185
+ deep: true
186
+ }
187
+ },
188
+ created () {
189
+ this.initValue = clone(this.value)
190
+ this.$watch(() => {
191
+ return this.value
192
+ }, () => {
193
+ this.initValue = clone(this.value)
194
+ })
195
+ },
196
+ mounted () {
197
+ this.$nextTick(() => {
198
+ this.innerReady = true
199
+ })
200
+ },
201
+ methods: {
202
+ handleChange() {
203
+ clearTimeout(this._timer)
204
+ this._timer = setTimeout(() => {
205
+ this.$emit('change')
206
+ })
207
+ },
208
+ handleSearchClick() {
209
+ clearTimeout(this._timer)
210
+ this._timer = setTimeout(() => {
211
+ this.$emit('change')
212
+ })
213
+ },
214
+ handleResetClick () {
215
+ this.$emit('input', this.initValue)
216
+ clearTimeout(this._timer)
217
+ this._timer = setTimeout(() => {
218
+ this.$emit('change')
219
+ })
220
+ },
221
+ getFilters() {
222
+ const simple = {}
223
+ const where = []
224
+ Object.keys(this.value || {}).forEach(key => {
225
+ if (isEmpty(this.value[key])) {
226
+ return
227
+ }
228
+ let filterValue = this.value[key]
229
+ const item = this.items.find(v => v.props && v.props.prop === key)
230
+ // if (item) {
231
+ // if (item.props.transform) {
232
+ // filterValue = item.props.transform({
233
+ // value: filterValue
234
+ // })
235
+ // }
236
+ // if (!this.operaterFnMap[item.props.operater]) {
237
+ // throw new Error('不支持的操作符' + item.props.operater)
238
+ // }
239
+ // const fields = [item.props.prop]
240
+ // fields.forEach(field => {
241
+ // const filterItem = this.operaterFnMap[item.props.operater]({
242
+ // field,
243
+ // value: filterValue
244
+ // })
245
+ // if (!filterItem) {
246
+ // return
247
+ // }
248
+ // filterItem.forEach(item => {
249
+ // where.push(item)
250
+ // })
251
+ // })
252
+ // } else {
253
+ simple[key] = filterValue
254
+ // }
255
+ })
256
+ // return {
257
+ // simple,
258
+ // complex: {
259
+ // where
260
+ // }
261
+ // }
262
+ return simple
263
+ },
264
+ handleRenderItem(item) {
265
+ return {
266
+ functional: true,
267
+ render: (h, c) => {
268
+ return item.render(h, c)
269
+ }
270
+ }
271
+ },
272
+ addItem(item) {
273
+ if (!item || !item.id) {
274
+ return
275
+ }
276
+ let index = -1
277
+ this.items.some((v, i) => {
278
+ if (v.id === item.id) {
279
+ index = i
280
+ return true
281
+ }
282
+ })
283
+ if (index >= 0) {
284
+ this.items.splice(index, 1, item)
285
+ } else {
286
+ this.items.push(item)
287
+ }
288
+ },
289
+ removeItem(id) {
290
+ let index = -1
291
+ this.items.some((v, i) => {
292
+ if (v.id === id) {
293
+ index = i
294
+ return true
295
+ }
296
+ })
297
+ if (index < 0) {
298
+ return
299
+ }
300
+ this.items.splice(index, 1)
301
+ },
302
+ addGroup (group) {
303
+ if (!group || !group.id) {
304
+ return
305
+ }
306
+ let index = -1
307
+ this.groups.some((v, i) => {
308
+ if (v.id === group.id) {
309
+ index = i
310
+ return true
311
+ }
312
+ })
313
+ if (index >= 0) {
314
+ this.groups.splice(index, 1, group)
315
+ } else {
316
+ this.groups.push(group)
317
+ }
318
+ },
319
+ removeGroup(id) {
320
+ let index = -1
321
+ this.groups.some((v, i) => {
322
+ if (v.id === id) {
323
+ index = i
324
+ return true
325
+ }
326
+ })
327
+ if (index < 0) {
328
+ return
329
+ }
330
+ this.groups.splice(index, 1)
331
+ }
332
+ }
333
+ }
334
+ </script>
335
+ <style lang="less">
336
+ .ui-filter{
337
+ width: 100%;
338
+ &.is-horizon {
339
+ display: flex;
340
+ flex-direction: row;
341
+ align-items: center;
342
+ justify-content: space-between;
343
+ .ui-filter__fast-item{
344
+ margin: 3px 18px 3px 0;
345
+ }
346
+ }
347
+ &.is-vertical {
348
+ display: flex;
349
+ flex-direction: column;
350
+ .ui-filter__fast-item{
351
+ margin: 6px 0 6px 0;
352
+ width: 100%;
353
+ }
354
+ .ui-filter__fast-item-target{
355
+ flex: 1;
356
+ min-width: 0;
357
+ }
358
+ }
359
+ }
360
+ .ui-filter__fast{
361
+ flex: 1;
362
+ }
363
+ .ui-filter__fast-groups{
364
+ border-radius: 4px;
365
+ box-shadow: rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.31) 0px 0px 1px;
366
+ }
367
+ .ui-filter__fast-group{
368
+ display: flex;
369
+ flex-direction: row;
370
+ padding: 2px;
371
+ &:not(:last-child) {
372
+ border-bottom: 1px dashed #eee;
373
+ }
374
+ }
375
+ .ui-filter__fast-group-label {
376
+ line-height: 24px;
377
+ padding: 9px 12px;
378
+ margin-right: -16px;
379
+ white-space: nowrap;
380
+ }
381
+ .ui-filter__fast-group-target{
382
+ display: flex;
383
+ flex-direction: row;
384
+ flex-wrap: wrap;
385
+ padding: 2px 12px;
386
+ }
387
+ .ui-filter__fast-list{
388
+ display: flex;
389
+ flex-direction: row;
390
+ flex-wrap: wrap;
391
+ }
392
+ .ui-filter__fast-item{
393
+ display: flex;
394
+ flex-direction: row;
395
+ align-items: center;
396
+ }
397
+ .ui-filter__fast-item:last-child{
398
+ margin-right: 0;
399
+ }
400
+ .ui-filter__fast-item-label{
401
+ color: #999;
402
+ padding-right: 9px;;
403
+ }
404
+ .ui-filter__more{
405
+ margin-left: 12px;
406
+ }
407
+ </style>
@@ -0,0 +1,20 @@
1
+ import Filter from './filter'
2
+ import FilterGroup from './filter-group'
3
+ import FilterItem from './filter-item'
4
+
5
+ export {
6
+ Filter,
7
+ FilterItem,
8
+ FilterGroup
9
+ }
10
+
11
+ export default {
12
+ Filter,
13
+ FilterItem,
14
+ FilterGroup,
15
+ install (Vue) {
16
+ Vue.component(Filter.name, Filter)
17
+ Vue.component(FilterGroup.name, FilterGroup)
18
+ Vue.component(FilterItem.name, FilterItem)
19
+ }
20
+ }
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1680482233621" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="25773" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M233.088 189.141333A425.002667 425.002667 0 0 1 512 85.333333c235.648 0 426.666667 191.018667 426.666667 426.666667 0 91.136-28.586667 175.616-77.226667 244.906667L725.333333 512h128A341.333333 341.333333 0 0 0 275.626667 265.728l-42.538667-76.586667z m557.824 645.717334A425.002667 425.002667 0 0 1 512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512c0-91.136 28.586667-175.616 77.226667-244.906667L298.666667 512H170.666667a341.333333 341.333333 0 0 0 577.706666 246.272l42.538667 76.586667z" p-id="25774"></path></svg>
@@ -0,0 +1,5 @@
1
+ let number = 1621734381083
2
+ export const unique = function() {
3
+ ++number
4
+ return 'ui-toolbar-' + number
5
+ }
@@ -0,0 +1,231 @@
1
+ <template>
2
+ <el-col :span="innerSpan" class="ui-form-cell" :class="['is-label-' + labelPosition, { 'is-margin-bottom': marginBottom }]">
3
+ <el-form-item :prop="prop" :required="required" :label-width="labelWidth" ref="formItem" :style="style">
4
+ <slot>{{value}}</slot>
5
+ <div class="ui-form-cell__label" slot="label" v-if="$slots.label || label">
6
+ <slot name="label">{{label}}</slot>
7
+ <ui-tooltip class="ui-form-cell__explain" v-if="explain" :content="explain">
8
+ <ui-icon name="question-fill">a</ui-icon>
9
+ </ui-tooltip>
10
+ </div>
11
+ <span class="ui-form-cell__error" slot="error" slot-scope="{ error }">
12
+ <slot name="error" :error="error">{{error}}</slot>
13
+ </span>
14
+ <p class="ui-form-cell__tips" v-if="tips || $slots.tips">
15
+ <slot name="tips">{{tips}}</slot>
16
+ </p>
17
+ </el-form-item>
18
+ </el-col>
19
+ </template>
20
+ <script>
21
+ import Col from 'element-ui/lib/col'
22
+ import 'element-ui/lib/theme-chalk/col.css'
23
+ import FormItem from 'element-ui/lib/form-item'
24
+ import 'element-ui/lib/theme-chalk/form-item.css'
25
+
26
+ export default {
27
+ name: 'UiFormCell',
28
+ inject: ['UiForm'],
29
+ provide () {
30
+ return {
31
+ UiFormCell: this
32
+ }
33
+ },
34
+ components: {
35
+ ElCol: Col,
36
+ ElFormItem: FormItem
37
+ },
38
+ props: {
39
+ label: {
40
+ type: String
41
+ },
42
+ align: {
43
+ type: String,
44
+ default: 'top'
45
+ },
46
+ showLabel: {
47
+ type: Boolean,
48
+ default: true
49
+ },
50
+ marginBottom: {
51
+ type: Boolean,
52
+ default: true
53
+ },
54
+ prop: {
55
+ type: String
56
+ },
57
+ tips: {
58
+ type: String
59
+ },
60
+ explain: {
61
+ type: String
62
+ },
63
+ span: {
64
+ type: Number
65
+ },
66
+ required: {
67
+ type: Boolean,
68
+ default: false
69
+ }
70
+ },
71
+ computed: {
72
+ style () {
73
+ const map = {
74
+ top: 'flex-top',
75
+ middle: 'center',
76
+ bottom: 'flex-end'
77
+ }
78
+ return {
79
+ 'align-items': map[this.align]
80
+ }
81
+ },
82
+ labelPosition () {
83
+ return this.UiForm.labelPosition
84
+ },
85
+ labelWidth () {
86
+ let width
87
+ if (!this.showLabel) {
88
+ width = '0'
89
+ }
90
+ return width
91
+ },
92
+ parent () {
93
+ return this.$parent.$parent
94
+ },
95
+ innerSpan () {
96
+ if (this.span) {
97
+ return this.span
98
+ } else {
99
+ let num = 0
100
+ if (this.parent && this.parent.$options.name === 'UiFormRow' && this.parent.$slots.default) {
101
+ num = this.parent.$slots.default.filter(v => {
102
+ return v && v.componentOptions && v.componentOptions.Ctor && v.componentOptions.Ctor.options && v.componentOptions.Ctor.options.name === 'UiFormCell'
103
+ }).length
104
+ }
105
+ return num === 0 ? 24 : 24 / num
106
+ }
107
+ },
108
+ model () {
109
+ return this.UiForm.model
110
+ },
111
+ value () {
112
+ let value
113
+ if (this.prop) {
114
+ value = this.model[this.prop]
115
+ return value === null || value === undefined || value === '' ? '' : value
116
+ }
117
+ return value
118
+ }
119
+ },
120
+ methods: {
121
+ isValid () {
122
+ return this.$refs.formItem.validateState !== 'error'
123
+ }
124
+ }
125
+ }
126
+ </script>
127
+ <style lang="less">
128
+ body .ui-form-cell{
129
+ box-sizing: border-box!important;
130
+ &:not(.is-label-top) {
131
+ > .el-form-item{
132
+ display: flex;
133
+ flex-direction: row;
134
+ }
135
+ }
136
+ &.is-label-top{
137
+ position: relative;
138
+ > .el-form-item.is-required > .el-form-item__label:before{
139
+ right: -20px;
140
+ }
141
+ > .el-form-item{
142
+ margin-bottom: 12px;
143
+ }
144
+ > .el-form-item > .el-form-item__label{
145
+ padding-top: 0;
146
+ }
147
+ }
148
+ &:not(.is-margin-bottom) {
149
+ > .el-form-item{
150
+ margin-bottom: 0;
151
+ }
152
+ }
153
+ .el-form-item{
154
+ margin-bottom: 15px;
155
+ &:before{
156
+ display: none;
157
+ }
158
+ &.is-required{
159
+ .el-form-item__label:before{
160
+ position: absolute;
161
+ top: 8px;
162
+ right: 0;
163
+ height: 16px;
164
+ line-height: 16px;
165
+ width: 16px;
166
+ text-align: center;
167
+ }
168
+ }
169
+ &.is-error{
170
+ .el-input .el-input__inner,
171
+ .el-textarea__inner{
172
+ border-color: #F56C6C;
173
+ &:hover{
174
+ border-color: #F56C6C;
175
+ }
176
+ &:focus{
177
+ box-shadow: 0 0 0 0.2rem rgba(245, 108, 108, 0.25);
178
+ }
179
+ }
180
+ .el-input.is-focus .el-input__inner{
181
+ box-shadow: 0 0 0 0.2rem rgba(245, 108, 108, 0.25);
182
+ }
183
+ }
184
+ }
185
+ .el-form-item__label{
186
+ line-height: 24px;
187
+ padding-top: 4px;
188
+ padding-bottom: 4px;
189
+ color: #888;
190
+ position: relative;
191
+ box-sizing: border-box;
192
+ }
193
+ .ui-form-cell__label{
194
+ display: flex;
195
+ flex-direction: row;
196
+ }
197
+ .el-form-item__content{
198
+ line-height: 32px;
199
+ word-break: break-all;
200
+ flex: 1;
201
+ margin-left: 0!important;
202
+ font-size: 14px;
203
+ min-width: 0;
204
+ &:before,&:after{
205
+ display: none;
206
+ }
207
+ }
208
+ .el-form-item__error{
209
+ position: static;
210
+ margin-top: 3px;
211
+ }
212
+ }
213
+ .ui-form-cell__tips{
214
+ margin: 5px 0 0;
215
+ line-height: 1.7em;
216
+ color: #999;
217
+ font-size: 12px;
218
+ }
219
+ .ui-form-cell__error{
220
+ margin-top: 3px;
221
+ display: block;
222
+ color: #F56C6C;
223
+ padding-top: 4px;
224
+ line-height: 1;
225
+ font-size: 12px;
226
+ }
227
+ .ui-form-cell__explain{
228
+ display: inline-block;
229
+ margin-left: 4px;
230
+ }
231
+ </style>