bri-components 1.5.22 → 1.6.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 (154) hide show
  1. package/README.md +83 -83
  2. package/lib/styles/bundle.css +12 -12
  3. package/lib/styles/font/fontello.svg +31 -31
  4. package/package.json +127 -125
  5. package/src/components/Error/Error403.vue +42 -42
  6. package/src/components/Error/Error404.vue +40 -40
  7. package/src/components/Error/Error500.vue +51 -51
  8. package/src/components/Error/error.less +162 -162
  9. package/src/components/Error/errorBack.vue +40 -40
  10. package/src/components/controls/DshControlInput.vue +195 -195
  11. package/src/components/controls/base/BriUpload/BriUpload.vue +435 -434
  12. package/src/components/controls/base/BriUpload/BriUploadImage.vue +430 -377
  13. package/src/components/controls/base/BriUpload/uploadList.vue +738 -727
  14. package/src/components/controls/base/BriUpload/uploadMixin.js +453 -446
  15. package/src/components/controls/base/DshCascader/DshCascader.vue +215 -215
  16. package/src/components/controls/base/DshCascader/components/cascaderModal.vue +366 -366
  17. package/src/components/controls/base/DshCascader/components/cascaderPicker.vue +416 -416
  18. package/src/components/controls/base/DshCascader/components/cascaderSimple.vue +141 -141
  19. package/src/components/controls/base/DshCascader/components/cascaderTree.vue +151 -151
  20. package/src/components/controls/base/DshCoordinates.vue +587 -585
  21. package/src/components/controls/base/DshDate/DshDate.vue +191 -191
  22. package/src/components/controls/base/DshDate/DshDaterange.vue +186 -186
  23. package/src/components/controls/base/DshDivider.vue +201 -201
  24. package/src/components/controls/base/DshEditor.vue +274 -274
  25. package/src/components/controls/base/DshInput/BriInputs.vue +166 -166
  26. package/src/components/controls/base/DshInput/DshInput.vue +260 -260
  27. package/src/components/controls/base/DshNumber/BriInputNumber/BriInputNumber.vue +435 -435
  28. package/src/components/controls/base/DshNumber/BriInputNumber/mixins/emitter.js +34 -34
  29. package/src/components/controls/base/DshNumber/BriInputNumber/mixins/form.js +14 -14
  30. package/src/components/controls/base/DshNumber/BriInputNumber/utils/assist.js +322 -322
  31. package/src/components/controls/base/DshNumber/DshNumber.vue +143 -143
  32. package/src/components/controls/base/DshNumber/DshNumberange.vue +109 -109
  33. package/src/components/controls/base/DshSelect/DshCheckbox.vue +168 -168
  34. package/src/components/controls/base/DshSelect/DshSelect.vue +180 -180
  35. package/src/components/controls/base/DshSelect/DshSelectAll.vue +269 -269
  36. package/src/components/controls/base/DshSwitch/DshSwitch.vue +115 -115
  37. package/src/components/controls/control.less +324 -324
  38. package/src/components/controls/controlMap.js +117 -117
  39. package/src/components/controls/extra/DshColor.vue +81 -81
  40. package/src/components/controls/extra/DshThemeColor.vue +100 -100
  41. package/src/components/controls/extra/DshThemeIcon.vue +122 -122
  42. package/src/components/controls/mixins/cascaderMixin.js +325 -325
  43. package/src/components/controls/mixins/cascaderPickerMixin.js +227 -227
  44. package/src/components/controls/mixins/cascaderTableMixin.js +130 -130
  45. package/src/components/controls/mixins/controlMixin.js +393 -393
  46. package/src/components/controls/mixins/dateMixin.js +149 -149
  47. package/src/components/controls/mixins/flatTableMixin.js +111 -111
  48. package/src/components/controls/mixins/numberMixin.js +112 -112
  49. package/src/components/controls/mixins/selectMixin.js +233 -233
  50. package/src/components/controls/mixins/switchMixin.js +87 -87
  51. package/src/components/controls/mixins/userAndDepartMixin.js +260 -260
  52. package/src/components/controls/senior/DshLabels.vue +333 -333
  53. package/src/components/controls/senior/DshPackage.vue +57 -57
  54. package/src/components/controls/senior/cascaderTable.vue +213 -213
  55. package/src/components/controls/senior/correlation.vue +135 -135
  56. package/src/components/controls/senior/flatTable.vue +138 -138
  57. package/src/components/controls/senior/selectDepartments.vue +397 -399
  58. package/src/components/controls/senior/selectUsers/departMenu.vue +296 -293
  59. package/src/components/controls/senior/selectUsers/selectUsers.vue +712 -712
  60. package/src/components/controls/special/DshBack.vue +42 -42
  61. package/src/components/controls/special/DshUndeveloped.vue +41 -41
  62. package/src/components/form/DshAdvSearch.vue +510 -510
  63. package/src/components/form/DshDefaultSearch.vue +260 -260
  64. package/src/components/form/DshForm.vue +494 -494
  65. package/src/components/form/searchMixin.js +376 -376
  66. package/src/components/list/BriCard.vue +95 -95
  67. package/src/components/list/BriTable.vue +205 -205
  68. package/src/components/list/BriTree.vue +529 -529
  69. package/src/components/list/BriTreeItem.vue +163 -163
  70. package/src/components/list/DshBox/DshBox.vue +219 -219
  71. package/src/components/list/DshBox/DshCard.vue +446 -446
  72. package/src/components/list/DshBox/DshCrossTable.vue +827 -827
  73. package/src/components/list/DshBox/DshList.vue +404 -404
  74. package/src/components/list/DshBox/DshPanel.vue +669 -669
  75. package/src/components/list/DshBox/DshSingleData.vue +119 -119
  76. package/src/components/list/DshBox/DshTable.vue +239 -239
  77. package/src/components/list/DshCascaderTable.vue +115 -115
  78. package/src/components/list/DshFlatTable.vue +334 -337
  79. package/src/components/list/DshPage.vue +194 -194
  80. package/src/components/list/DshTreeTable.vue +113 -113
  81. package/src/components/list/common/importModal.vue +243 -243
  82. package/src/components/list/common/quoteListModal.vue +206 -206
  83. package/src/components/list/mixins/DshCascaderTableMixin.js +278 -278
  84. package/src/components/list/mixins/DshFlatTableMixin.js +509 -509
  85. package/src/components/list/mixins/DshTreeTableMixin.js +286 -286
  86. package/src/components/list/mixins/tableBaseMixin.js +1653 -1653
  87. package/src/components/list/mixins/treeTableBaseMixin.js +145 -145
  88. package/src/components/other/BriAvatar.vue +166 -166
  89. package/src/components/other/BriCode.vue +125 -125
  90. package/src/components/other/BriCollapseTree.vue +207 -207
  91. package/src/components/other/BriGantt.vue +1087 -1087
  92. package/src/components/other/BriIframe.vue +116 -116
  93. package/src/components/other/BriLoading.vue +171 -171
  94. package/src/components/other/BriSvg.vue +27 -27
  95. package/src/components/other/DshColorPanel.vue +128 -128
  96. package/src/components/other/DshMenuNav.vue +188 -188
  97. package/src/components/other/DshVideoPlayer.vue +184 -0
  98. package/src/components/small/BriButton.vue +71 -71
  99. package/src/components/small/BriDrawer.vue +169 -169
  100. package/src/components/small/BriTooltip.vue +87 -87
  101. package/src/components/small/DshBtnModal.vue +68 -68
  102. package/src/components/small/DshButtons.vue +324 -324
  103. package/src/components/small/DshDropdown.vue +225 -225
  104. package/src/components/small/DshIcons.vue +59 -59
  105. package/src/components/small/DshListRender.js +21 -21
  106. package/src/components/small/DshModal.vue +160 -160
  107. package/src/components/small/DshSteps.vue +141 -141
  108. package/src/components/small/DshTabs.vue +598 -598
  109. package/src/components/small/DshTabsSet.vue +309 -309
  110. package/src/components/small/DshTags.vue +251 -251
  111. package/src/components/small/DshTitle.vue +50 -50
  112. package/src/components/small/render.js +20 -20
  113. package/src/components/unit/DshFormUnit.vue +398 -398
  114. package/src/components/unit/DshListUnit.vue +115 -115
  115. package/src/components/unit/unitMixin.js +86 -86
  116. package/src/data/index.js +4 -4
  117. package/src/index.js +287 -285
  118. package/src/styles/bundle.css +12 -12
  119. package/src/styles/components/BriButton.less +307 -307
  120. package/src/styles/components/BriTable.less +344 -344
  121. package/src/styles/components/DshModal.less +257 -257
  122. package/src/styles/components/index.less +3 -3
  123. package/src/styles/global/animate.less +11 -11
  124. package/src/styles/global/base.less +45 -45
  125. package/src/styles/global/box.less +186 -186
  126. package/src/styles/global/control.less +122 -122
  127. package/src/styles/global/flex.less +282 -282
  128. package/src/styles/global/global.less +8 -8
  129. package/src/styles/global/text.less +59 -59
  130. package/src/styles/global/variables.less +85 -85
  131. package/src/styles/iconfont/iconfont.css +254 -254
  132. package/src/styles/iconfont/iconfont.json +422 -422
  133. package/src/styles/iconfont/iconfont.svg +137 -137
  134. package/src/styles/index.less +26 -26
  135. package/src/styles/reset-easytable.less +21 -21
  136. package/src/styles/reset-iview-controls.less +145 -145
  137. package/src/styles/reset-iview-other.less +49 -49
  138. package/src/styles/reset-iview-variables.less +43 -43
  139. package/src/styles/reset.less +45 -45
  140. package/src/utils/index.js +3 -5
  141. package/lib/0.bri-components.min.js +0 -1
  142. package/lib/1.bri-components.min.js +0 -1
  143. package/lib/10.bri-components.min.js +0 -1
  144. package/lib/11.bri-components.min.js +0 -1
  145. package/lib/2.bri-components.min.js +0 -1
  146. package/lib/3.bri-components.min.js +0 -1
  147. package/lib/4.bri-components.min.js +0 -1
  148. package/lib/5.bri-components.min.js +0 -1
  149. package/lib/6.bri-components.min.js +0 -1
  150. package/lib/7.bri-components.min.js +0 -1
  151. package/lib/8.bri-components.min.js +0 -1
  152. package/lib/9.bri-components.min.js +0 -1
  153. package/lib/bri-components.min.js +0 -18
  154. package/src/utils/table.js +0 -175
@@ -1,598 +1,598 @@
1
- <template>
2
- <Tabs
3
- :class="['DshTabs', `DshTabs-${mode}`, `DshTabs-${mode}-${size}`]"
4
- v-model="curTabKey"
5
- :type="['button', 'card'].includes(mode) ? 'card' : undefined"
6
- :animated="false"
7
- >
8
- <TabPane
9
- v-for="tabItem in list"
10
- :key="tabItem[keyField]"
11
- class="DshTabs-item"
12
- :name="tabItem[keyField]"
13
- :label="getLabel(tabItem)"
14
- :size="size"
15
- >
16
- <slot
17
- v-if="renderStatusMap[tabItem[keyField]]"
18
- :tabItem="tabItem"
19
- >
20
- <span></span>
21
- </slot>
22
- </TabPane>
23
-
24
- <div
25
- v-if="rightTabList.length"
26
- slot="extra"
27
- class="extra"
28
- >
29
- <span
30
- v-for="tabItem in rightTabList"
31
- :key="tabItem[keyField]"
32
- :class="{
33
- 'extra-item': true,
34
- 'extra-item-active': tabItem[keyField] === curTabKey
35
- }"
36
- @click="curTabKey = tabItem[keyField]"
37
- >
38
- {{ tabItem.name }}
39
- </span>
40
- </div>
41
- </Tabs>
42
- </template>
43
-
44
- <script>
45
- export default {
46
- name: "DshTabs",
47
- props: {
48
- value: {
49
- type: String
50
- },
51
- mode: {
52
- type: String,
53
- default: "creative",
54
- validator (val) {
55
- return ["creative", "tradition", "page", "button", "card", "line", "menu"].includes(val);
56
- }
57
- },
58
- keyField: {
59
- type: String,
60
- default: "_key"
61
- },
62
- list: {
63
- type: Array,
64
- default () {
65
- return [];
66
- }
67
- },
68
- size: {
69
- type: String,
70
- default: "default",
71
- validator (val) {
72
- return ["default", "small", "large"].includes(val);
73
- }
74
- }
75
- },
76
- data () {
77
- return {
78
- renderStatusMap: {}
79
- };
80
- },
81
- computed: {
82
- curTabKey: {
83
- get () {
84
- return this.value;
85
- },
86
- set (tabKey) {
87
- // iview的组件有问题,重复点击tab的某一项,set函数还是会触发!
88
- if (tabKey !== this.curTabKey) {
89
- this.init(tabKey);
90
-
91
- this.$emit("input", tabKey);
92
- this.$emit("change", tabKey, this.list.find(item => item[this.keyField] === tabKey));
93
- }
94
- }
95
- },
96
-
97
- rightTabList () {
98
- return this.list.filter(item => item.slot === "extra");
99
- }
100
- },
101
- created () {
102
- this.init(this.curTabKey != undefined ? this.curTabKey : (this.list[0] && this.list[0][this.keyField]));
103
- },
104
- mounted () {},
105
- methods: {
106
- init (tabKey) {
107
- this.$set(this.renderStatusMap, tabKey, true);
108
- },
109
-
110
- getLabel (tabItem) {
111
- return tabItem.slot !== "extra"
112
- ? (h) => {
113
- return h("div", {
114
- style: {
115
- padding: ["button", "menu"].includes(this.mode) ? undefined : "0px 16px"
116
- }
117
- }, tabItem.name);
118
- }
119
- : undefined;
120
- }
121
- }
122
- };
123
- </script>
124
-
125
- <style lang="less">
126
- .DshTabs {
127
- width: 100%;
128
- // height: 100%;
129
- display: flex;
130
- flex-direction: column;
131
-
132
- &-item {
133
-
134
- }
135
-
136
- .extra {
137
- height: 100%;
138
-
139
- &-item {
140
- display: inline-block;
141
- padding: 8px 16px;
142
- font-size: @textSize;
143
- cursor: pointer;
144
-
145
- &-active {
146
- color: @themeColor;
147
- position: relative;
148
- }
149
- }
150
- }
151
-
152
- &-creative,
153
- &-tradition {
154
- .ivu-tabs {
155
- color: @titleColor;
156
-
157
- &-bar {
158
- height: 100%;
159
- border-bottom: 0px!important;
160
- margin-bottom: 0px!important;
161
-
162
- .ivu-tabs-nav-right {
163
- margin-top: 8px;
164
- margin-left: 40px;
165
- }
166
-
167
- .ivu-tabs-nav-container {
168
- height: 100%;
169
-
170
- .ivu-tabs-nav-wrap {
171
-
172
- .ivu-tabs-nav {
173
- &-prev,
174
- &-next {
175
- height: 100%;
176
- display: flex;
177
- flex-direction: row;
178
- justify-content: center;
179
- align-items: center;
180
-
181
- i {
182
- display: inline-block;
183
- font-size: @largeTitleSize;
184
- }
185
- }
186
-
187
- &-scroll {
188
- &-disabled {
189
- display: none;
190
- }
191
-
192
- .ivu-tabs-nav {
193
-
194
- .ivu-tabs-ink-bar {
195
- height: 0;
196
- background-color: #FFF;
197
- }
198
-
199
- .ivu-tabs-tab {
200
- // display: inline-block;
201
- // height: 44px;
202
- padding: 0px!important;
203
- margin-right: 1px!important;
204
- // background-color: #E5E5E5;
205
- text-align: center;
206
- line-height: 44px;
207
- font-size: @textSize;
208
- color: @titleColor;
209
-
210
- &-active,
211
- &-focused {
212
- color: @themeColor;
213
- background-color: #FFF;
214
- font-weight: 500;
215
- }
216
- }
217
- }
218
- }
219
- }
220
- }
221
- }
222
- }
223
-
224
- &-content {
225
- padding-top: 20px;
226
- }
227
- }
228
- }
229
-
230
- &-tradition {
231
- .ivu-tabs {
232
- color: #ffffff;
233
-
234
- &-bar {
235
-
236
- .ivu-tabs-nav-right {
237
-
238
- }
239
-
240
- .ivu-tabs-nav-container {
241
- overflow: visible;
242
-
243
- .ivu-tabs-nav-wrap {
244
-
245
- .ivu-tabs-nav {
246
- &-prev,
247
- &-next {
248
- color: #ffffff;
249
- }
250
-
251
- &-scroll {
252
- .ivu-tabs-nav {
253
-
254
- .ivu-tabs-ink-bar {
255
-
256
- }
257
-
258
- .ivu-tabs-tab {
259
- color: #ffffff;
260
-
261
- &:hover {
262
- color: #ffffff;
263
- }
264
-
265
- &-active,
266
- &-focused {
267
- color: @theme-active;
268
-
269
- &:hover {
270
- color: @theme-active;
271
- }
272
- }
273
- }
274
- }
275
- }
276
- }
277
- }
278
- }
279
- }
280
- }
281
- }
282
-
283
- // 页面编辑版
284
- &-page {
285
- .extra {
286
- &-item {
287
- &-active {
288
- &::after {
289
- content: "";
290
- width: 100%;
291
- height: 2px;
292
- position: absolute;
293
- bottom: 0px;
294
- left: 0;
295
- z-index: 1;
296
- background-color: @themeColor;
297
- }
298
- }
299
- }
300
- }
301
-
302
- .ivu-tabs {
303
-
304
- &-bar {
305
- border-bottom: 0px!important;
306
- margin-bottom: 0px!important;
307
-
308
- .ivu-tabs-nav-right {
309
- margin-left: 40px;
310
- }
311
-
312
- .ivu-tabs-nav-container {
313
-
314
- .ivu-tabs-nav-wrap {
315
-
316
- .ivu-tabs-nav {
317
- &-prev,
318
- &-next {
319
- padding-top: 4px;
320
-
321
- i {
322
- font-size: @titleSize;
323
- }
324
- }
325
-
326
- &-scroll {
327
- .ivu-tabs-nav {
328
- display: flex;
329
- align-items: center;
330
-
331
- // tab切换下方下划线
332
- .ivu-tabs-ink-bar {
333
- display: none;
334
-
335
- &-animated {
336
- display: none;
337
- }
338
- }
339
-
340
- // tab切换标签
341
- .ivu-tabs-tab {
342
- display: inline-block;
343
- height: 40px;
344
- padding: 0px!important;
345
- margin-right: 1px!important;
346
- background-color: #E5E5E5;
347
- text-align: center;
348
- line-height: 40px;
349
- font-size: @smallTitleSize;
350
- color: #666666;
351
-
352
- &-active {
353
- background: @white!important;
354
- color: @themeColor!important;
355
- font-weight: 700;
356
- }
357
-
358
- &:hover {
359
- color: @themeColor!important;
360
- }
361
- }
362
- }
363
- }
364
- }
365
- }
366
- }
367
-
368
- }
369
-
370
- &-content {
371
- flex: 1;
372
- min-height: 0px;
373
- padding-top: 20px;
374
- }
375
-
376
- &-context-menu {
377
-
378
- }
379
- }
380
- }
381
-
382
- // 按钮式、卡片式
383
- &-button {
384
- height: 32px;
385
- &.ivu-tabs.ivu-tabs-card>.ivu-tabs-bar {
386
- border: none;
387
- margin-bottom: 0px;
388
- height: 100%;
389
-
390
- .ivu-tabs-tab {
391
- height: 28px;
392
- background-color: transparent;
393
- color: @contentColor;
394
- border-radius: 3px;
395
- border: none;
396
- margin: 2px;
397
- padding: 3px 16px;
398
- line-height: 22px;
399
-
400
- &-active {
401
- background-color: #fff;
402
- color: @textColor;
403
- }
404
-
405
- &:hover {
406
- color: @textColor;
407
- }
408
- }
409
-
410
- .ivu-tabs-ink-bar {
411
- background-color: transparent;
412
- }
413
- }
414
-
415
- .ivu-tabs-nav {
416
- background-color: @borderColor;
417
- border-radius: @borderRadius;
418
- }
419
-
420
- &-large {
421
- height: 40px;
422
- &.ivu-tabs > .ivu-tabs-bar {
423
- .ivu-tabs-nav-container, .ivu-tabs-nav {
424
- height: 40px;
425
- }
426
- .ivu-tabs-tab {
427
- height: 36px;
428
- font-size: 16px;
429
- line-height: 24px;
430
- padding: 6px 24px;
431
- }
432
- }
433
- .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
434
- line-height: 40px;
435
- }
436
- }
437
- }
438
-
439
- &-card {
440
- height: 32px;
441
- &.ivu-tabs.ivu-tabs-card > .ivu-tabs-bar {
442
- border: none;
443
- margin: 0px;
444
- height: 100%;
445
-
446
- .ivu-tabs-tab {
447
- height: 28px;
448
- background-color: transparent;
449
- color: @contentColor;
450
- border-radius: 3px;
451
- border: none;
452
- margin: 2px;
453
- padding: 3px 16px;
454
- line-height: 22px;
455
-
456
- &-active {
457
- background-color: @themeColor;
458
- color: rgba(255,255,255,0.9);
459
- &.ivu-tabs-tab:hover {
460
- color: rgba(255,255,255,0.9);
461
- }
462
- }
463
-
464
- &:hover {
465
- color: @textColor;
466
- }
467
- }
468
-
469
- .ivu-tabs-ink-bar {
470
- background-color: transparent;
471
- }
472
- }
473
-
474
- .ivu-tabs-nav {
475
- background-color: @borderColor;
476
- border-radius: @borderRadius;
477
- }
478
-
479
- &-large {
480
- height: 40px;
481
- &.ivu-tabs > .ivu-tabs-bar {
482
- .ivu-tabs-nav-container, .ivu-tabs-nav {
483
- height: 40px;
484
- }
485
- .ivu-tabs-tab {
486
- height: 36px;
487
- font-size: 16px;
488
- line-height: 24px;
489
- padding: 6px 24px;
490
- }
491
- }
492
- .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
493
- line-height: 40px;
494
- }
495
- }
496
- }
497
-
498
- // 下划线
499
- &-line {
500
- .ivu-tabs {
501
- // color: @titleColor;
502
-
503
- &-bar {
504
- height: 100%;
505
- border-bottom: 0px!important;
506
- margin-bottom: 0px!important;
507
-
508
- .ivu-tabs-nav-container {
509
-
510
- .ivu-tabs-nav-wrap {
511
-
512
- .ivu-tabs-nav {
513
- &-prev,
514
- &-next {
515
-
516
- }
517
-
518
- &-scroll {
519
- &-disabled {
520
-
521
- }
522
-
523
- .ivu-tabs-nav {
524
-
525
- .ivu-tabs-ink-bar {
526
-
527
- }
528
-
529
- .ivu-tabs-tab {
530
-
531
- &-active,
532
- &-focused {
533
-
534
- }
535
- }
536
- }
537
- }
538
- }
539
- }
540
- }
541
- }
542
- }
543
- }
544
-
545
- // menu
546
- &-menu {
547
- transform: translateY(4px);
548
- &.ivu-tabs > .ivu-tabs-bar {
549
- border: none;
550
- margin: 0px;
551
-
552
- .ivu-tabs-tab {
553
- position: relative;
554
- height: 32px;
555
- color: @contentColor;
556
- font-size: 16px;
557
- line-height: 24px;
558
- padding: 0 0px 8px 0px;
559
- margin-right: 24px;
560
-
561
- &:after {
562
- content: " ";
563
- display: flex;
564
- width: 32px;
565
- height: 2px;
566
- background: transparent;
567
- position: absolute;
568
- left: calc(50% - 16px);
569
- bottom: 2px;
570
- }
571
-
572
- &-active {
573
- color: @textColor;
574
- font-weight: 500;
575
- &:after {
576
- background: @themeColor;
577
- }
578
- }
579
-
580
- &:hover {
581
- color: @textColor;
582
- }
583
-
584
- &:last-of-type {
585
- margin-right: 0px;
586
- }
587
- }
588
-
589
- .ivu-tabs-ink-bar {
590
- display: none;
591
- }
592
- .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
593
- line-height: 24px;
594
- }
595
- }
596
- }
597
- }
598
- </style>
1
+ <template>
2
+ <Tabs
3
+ :class="['DshTabs', `DshTabs-${mode}`, `DshTabs-${mode}-${size}`]"
4
+ v-model="curTabKey"
5
+ :type="['button', 'card'].includes(mode) ? 'card' : undefined"
6
+ :animated="false"
7
+ >
8
+ <TabPane
9
+ v-for="tabItem in list"
10
+ :key="tabItem[keyField]"
11
+ class="DshTabs-item"
12
+ :name="tabItem[keyField]"
13
+ :label="getLabel(tabItem)"
14
+ :size="size"
15
+ >
16
+ <slot
17
+ v-if="renderStatusMap[tabItem[keyField]]"
18
+ :tabItem="tabItem"
19
+ >
20
+ <span></span>
21
+ </slot>
22
+ </TabPane>
23
+
24
+ <div
25
+ v-if="rightTabList.length"
26
+ slot="extra"
27
+ class="extra"
28
+ >
29
+ <span
30
+ v-for="tabItem in rightTabList"
31
+ :key="tabItem[keyField]"
32
+ :class="{
33
+ 'extra-item': true,
34
+ 'extra-item-active': tabItem[keyField] === curTabKey
35
+ }"
36
+ @click="curTabKey = tabItem[keyField]"
37
+ >
38
+ {{ tabItem.name }}
39
+ </span>
40
+ </div>
41
+ </Tabs>
42
+ </template>
43
+
44
+ <script>
45
+ export default {
46
+ name: "DshTabs",
47
+ props: {
48
+ value: {
49
+ type: String
50
+ },
51
+ mode: {
52
+ type: String,
53
+ default: "creative",
54
+ validator (val) {
55
+ return ["creative", "tradition", "page", "button", "card", "line", "menu"].includes(val);
56
+ }
57
+ },
58
+ keyField: {
59
+ type: String,
60
+ default: "_key"
61
+ },
62
+ list: {
63
+ type: Array,
64
+ default () {
65
+ return [];
66
+ }
67
+ },
68
+ size: {
69
+ type: String,
70
+ default: "default",
71
+ validator (val) {
72
+ return ["default", "small", "large"].includes(val);
73
+ }
74
+ }
75
+ },
76
+ data () {
77
+ return {
78
+ renderStatusMap: {}
79
+ };
80
+ },
81
+ computed: {
82
+ curTabKey: {
83
+ get () {
84
+ return this.value;
85
+ },
86
+ set (tabKey) {
87
+ // iview的组件有问题,重复点击tab的某一项,set函数还是会触发!
88
+ if (tabKey !== this.curTabKey) {
89
+ this.init(tabKey);
90
+
91
+ this.$emit("input", tabKey);
92
+ this.$emit("change", tabKey, this.list.find(item => item[this.keyField] === tabKey));
93
+ }
94
+ }
95
+ },
96
+
97
+ rightTabList () {
98
+ return this.list.filter(item => item.slot === "extra");
99
+ }
100
+ },
101
+ created () {
102
+ this.init(this.curTabKey != undefined ? this.curTabKey : (this.list[0] && this.list[0][this.keyField]));
103
+ },
104
+ mounted () {},
105
+ methods: {
106
+ init (tabKey) {
107
+ this.$set(this.renderStatusMap, tabKey, true);
108
+ },
109
+
110
+ getLabel (tabItem) {
111
+ return tabItem.slot !== "extra"
112
+ ? (h) => {
113
+ return h("div", {
114
+ style: {
115
+ padding: ["button", "menu"].includes(this.mode) ? undefined : "0px 16px"
116
+ }
117
+ }, tabItem.name);
118
+ }
119
+ : undefined;
120
+ }
121
+ }
122
+ };
123
+ </script>
124
+
125
+ <style lang="less">
126
+ .DshTabs {
127
+ width: 100%;
128
+ // height: 100%;
129
+ display: flex;
130
+ flex-direction: column;
131
+
132
+ &-item {
133
+
134
+ }
135
+
136
+ .extra {
137
+ height: 100%;
138
+
139
+ &-item {
140
+ display: inline-block;
141
+ padding: 8px 16px;
142
+ font-size: @textSize;
143
+ cursor: pointer;
144
+
145
+ &-active {
146
+ color: @themeColor;
147
+ position: relative;
148
+ }
149
+ }
150
+ }
151
+
152
+ &-creative,
153
+ &-tradition {
154
+ .ivu-tabs {
155
+ color: @titleColor;
156
+
157
+ &-bar {
158
+ height: 100%;
159
+ border-bottom: 0px!important;
160
+ margin-bottom: 0px!important;
161
+
162
+ .ivu-tabs-nav-right {
163
+ margin-top: 8px;
164
+ margin-left: 40px;
165
+ }
166
+
167
+ .ivu-tabs-nav-container {
168
+ height: 100%;
169
+
170
+ .ivu-tabs-nav-wrap {
171
+
172
+ .ivu-tabs-nav {
173
+ &-prev,
174
+ &-next {
175
+ height: 100%;
176
+ display: flex;
177
+ flex-direction: row;
178
+ justify-content: center;
179
+ align-items: center;
180
+
181
+ i {
182
+ display: inline-block;
183
+ font-size: @largeTitleSize;
184
+ }
185
+ }
186
+
187
+ &-scroll {
188
+ &-disabled {
189
+ display: none;
190
+ }
191
+
192
+ .ivu-tabs-nav {
193
+
194
+ .ivu-tabs-ink-bar {
195
+ height: 0;
196
+ background-color: #FFF;
197
+ }
198
+
199
+ .ivu-tabs-tab {
200
+ // display: inline-block;
201
+ // height: 44px;
202
+ padding: 0px!important;
203
+ margin-right: 1px!important;
204
+ // background-color: #E5E5E5;
205
+ text-align: center;
206
+ line-height: 44px;
207
+ font-size: @textSize;
208
+ color: @titleColor;
209
+
210
+ &-active,
211
+ &-focused {
212
+ color: @themeColor;
213
+ background-color: #FFF;
214
+ font-weight: 500;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ }
222
+ }
223
+
224
+ &-content {
225
+ padding-top: 20px;
226
+ }
227
+ }
228
+ }
229
+
230
+ &-tradition {
231
+ .ivu-tabs {
232
+ color: #ffffff;
233
+
234
+ &-bar {
235
+
236
+ .ivu-tabs-nav-right {
237
+
238
+ }
239
+
240
+ .ivu-tabs-nav-container {
241
+ overflow: visible;
242
+
243
+ .ivu-tabs-nav-wrap {
244
+
245
+ .ivu-tabs-nav {
246
+ &-prev,
247
+ &-next {
248
+ color: #ffffff;
249
+ }
250
+
251
+ &-scroll {
252
+ .ivu-tabs-nav {
253
+
254
+ .ivu-tabs-ink-bar {
255
+
256
+ }
257
+
258
+ .ivu-tabs-tab {
259
+ color: #ffffff;
260
+
261
+ &:hover {
262
+ color: #ffffff;
263
+ }
264
+
265
+ &-active,
266
+ &-focused {
267
+ color: @theme-active;
268
+
269
+ &:hover {
270
+ color: @theme-active;
271
+ }
272
+ }
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ }
282
+
283
+ // 页面编辑版
284
+ &-page {
285
+ .extra {
286
+ &-item {
287
+ &-active {
288
+ &::after {
289
+ content: "";
290
+ width: 100%;
291
+ height: 2px;
292
+ position: absolute;
293
+ bottom: 0px;
294
+ left: 0;
295
+ z-index: 1;
296
+ background-color: @themeColor;
297
+ }
298
+ }
299
+ }
300
+ }
301
+
302
+ .ivu-tabs {
303
+
304
+ &-bar {
305
+ border-bottom: 0px!important;
306
+ margin-bottom: 0px!important;
307
+
308
+ .ivu-tabs-nav-right {
309
+ margin-left: 40px;
310
+ }
311
+
312
+ .ivu-tabs-nav-container {
313
+
314
+ .ivu-tabs-nav-wrap {
315
+
316
+ .ivu-tabs-nav {
317
+ &-prev,
318
+ &-next {
319
+ padding-top: 4px;
320
+
321
+ i {
322
+ font-size: @titleSize;
323
+ }
324
+ }
325
+
326
+ &-scroll {
327
+ .ivu-tabs-nav {
328
+ display: flex;
329
+ align-items: center;
330
+
331
+ // tab切换下方下划线
332
+ .ivu-tabs-ink-bar {
333
+ display: none;
334
+
335
+ &-animated {
336
+ display: none;
337
+ }
338
+ }
339
+
340
+ // tab切换标签
341
+ .ivu-tabs-tab {
342
+ display: inline-block;
343
+ height: 40px;
344
+ padding: 0px!important;
345
+ margin-right: 1px!important;
346
+ background-color: #E5E5E5;
347
+ text-align: center;
348
+ line-height: 40px;
349
+ font-size: @smallTitleSize;
350
+ color: #666666;
351
+
352
+ &-active {
353
+ background: @white!important;
354
+ color: @themeColor!important;
355
+ font-weight: 700;
356
+ }
357
+
358
+ &:hover {
359
+ color: @themeColor!important;
360
+ }
361
+ }
362
+ }
363
+ }
364
+ }
365
+ }
366
+ }
367
+
368
+ }
369
+
370
+ &-content {
371
+ flex: 1;
372
+ min-height: 0px;
373
+ padding-top: 20px;
374
+ }
375
+
376
+ &-context-menu {
377
+
378
+ }
379
+ }
380
+ }
381
+
382
+ // 按钮式、卡片式
383
+ &-button {
384
+ height: 32px;
385
+ &.ivu-tabs.ivu-tabs-card>.ivu-tabs-bar {
386
+ border: none;
387
+ margin-bottom: 0px;
388
+ height: 100%;
389
+
390
+ .ivu-tabs-tab {
391
+ height: 28px;
392
+ background-color: transparent;
393
+ color: @contentColor;
394
+ border-radius: 3px;
395
+ border: none;
396
+ margin: 2px;
397
+ padding: 3px 16px;
398
+ line-height: 22px;
399
+
400
+ &-active {
401
+ background-color: #fff;
402
+ color: @textColor;
403
+ }
404
+
405
+ &:hover {
406
+ color: @textColor;
407
+ }
408
+ }
409
+
410
+ .ivu-tabs-ink-bar {
411
+ background-color: transparent;
412
+ }
413
+ }
414
+
415
+ .ivu-tabs-nav {
416
+ background-color: @borderColor;
417
+ border-radius: @borderRadius;
418
+ }
419
+
420
+ &-large {
421
+ height: 40px;
422
+ &.ivu-tabs > .ivu-tabs-bar {
423
+ .ivu-tabs-nav-container, .ivu-tabs-nav {
424
+ height: 40px;
425
+ }
426
+ .ivu-tabs-tab {
427
+ height: 36px;
428
+ font-size: 16px;
429
+ line-height: 24px;
430
+ padding: 6px 24px;
431
+ }
432
+ }
433
+ .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
434
+ line-height: 40px;
435
+ }
436
+ }
437
+ }
438
+
439
+ &-card {
440
+ height: 32px;
441
+ &.ivu-tabs.ivu-tabs-card > .ivu-tabs-bar {
442
+ border: none;
443
+ margin: 0px;
444
+ height: 100%;
445
+
446
+ .ivu-tabs-tab {
447
+ height: 28px;
448
+ background-color: transparent;
449
+ color: @contentColor;
450
+ border-radius: 3px;
451
+ border: none;
452
+ margin: 2px;
453
+ padding: 3px 16px;
454
+ line-height: 22px;
455
+
456
+ &-active {
457
+ background-color: @themeColor;
458
+ color: rgba(255,255,255,0.9);
459
+ &.ivu-tabs-tab:hover {
460
+ color: rgba(255,255,255,0.9);
461
+ }
462
+ }
463
+
464
+ &:hover {
465
+ color: @textColor;
466
+ }
467
+ }
468
+
469
+ .ivu-tabs-ink-bar {
470
+ background-color: transparent;
471
+ }
472
+ }
473
+
474
+ .ivu-tabs-nav {
475
+ background-color: @borderColor;
476
+ border-radius: @borderRadius;
477
+ }
478
+
479
+ &-large {
480
+ height: 40px;
481
+ &.ivu-tabs > .ivu-tabs-bar {
482
+ .ivu-tabs-nav-container, .ivu-tabs-nav {
483
+ height: 40px;
484
+ }
485
+ .ivu-tabs-tab {
486
+ height: 36px;
487
+ font-size: 16px;
488
+ line-height: 24px;
489
+ padding: 6px 24px;
490
+ }
491
+ }
492
+ .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
493
+ line-height: 40px;
494
+ }
495
+ }
496
+ }
497
+
498
+ // 下划线
499
+ &-line {
500
+ .ivu-tabs {
501
+ // color: @titleColor;
502
+
503
+ &-bar {
504
+ height: 100%;
505
+ border-bottom: 0px!important;
506
+ margin-bottom: 0px!important;
507
+
508
+ .ivu-tabs-nav-container {
509
+
510
+ .ivu-tabs-nav-wrap {
511
+
512
+ .ivu-tabs-nav {
513
+ &-prev,
514
+ &-next {
515
+
516
+ }
517
+
518
+ &-scroll {
519
+ &-disabled {
520
+
521
+ }
522
+
523
+ .ivu-tabs-nav {
524
+
525
+ .ivu-tabs-ink-bar {
526
+
527
+ }
528
+
529
+ .ivu-tabs-tab {
530
+
531
+ &-active,
532
+ &-focused {
533
+
534
+ }
535
+ }
536
+ }
537
+ }
538
+ }
539
+ }
540
+ }
541
+ }
542
+ }
543
+ }
544
+
545
+ // menu
546
+ &-menu {
547
+ transform: translateY(4px);
548
+ &.ivu-tabs > .ivu-tabs-bar {
549
+ border: none;
550
+ margin: 0px;
551
+
552
+ .ivu-tabs-tab {
553
+ position: relative;
554
+ height: 32px;
555
+ color: @contentColor;
556
+ font-size: 16px;
557
+ line-height: 24px;
558
+ padding: 0 0px 8px 0px;
559
+ margin-right: 24px;
560
+
561
+ &:after {
562
+ content: " ";
563
+ display: flex;
564
+ width: 32px;
565
+ height: 2px;
566
+ background: transparent;
567
+ position: absolute;
568
+ left: calc(50% - 16px);
569
+ bottom: 2px;
570
+ }
571
+
572
+ &-active {
573
+ color: @textColor;
574
+ font-weight: 500;
575
+ &:after {
576
+ background: @themeColor;
577
+ }
578
+ }
579
+
580
+ &:hover {
581
+ color: @textColor;
582
+ }
583
+
584
+ &:last-of-type {
585
+ margin-right: 0px;
586
+ }
587
+ }
588
+
589
+ .ivu-tabs-ink-bar {
590
+ display: none;
591
+ }
592
+ .ivu-tabs-nav-prev, .ivu-tabs-nav-next {
593
+ line-height: 24px;
594
+ }
595
+ }
596
+ }
597
+ }
598
+ </style>