kui-vue 3.2.5 → 3.2.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 (107) hide show
  1. package/components/_tool/directives.js +3 -1
  2. package/components/_tool/docClick.js +3 -1
  3. package/components/_tool/outsiteclick.js +1 -2
  4. package/components/_tool/resize.js +2 -3
  5. package/components/_tool/scroll.js +2 -3
  6. package/components/_tool/transfer.js +3 -1
  7. package/components/_tool/utils.js +9 -3
  8. package/components/affix/affix.jsx +21 -8
  9. package/components/avatar/styles/index.less +1 -1
  10. package/components/base/drop.jsx +3 -3
  11. package/components/base/pop.jsx +7 -4
  12. package/components/bin/index.js +2 -0
  13. package/components/button/styles/index.less +7 -6
  14. package/components/colorPicker/colorpicker.jsx +27 -15
  15. package/components/colorPicker/demo/base.md +1 -1
  16. package/components/colorPicker/demo/index.vue +2 -0
  17. package/components/colorPicker/demo/shape.md +33 -0
  18. package/components/colorPicker/index.md +10 -7
  19. package/components/colorPicker/styles/index.less +30 -13
  20. package/components/datePicker/datecalendar.jsx +149 -83
  21. package/components/datePicker/datepicker.jsx +11 -7
  22. package/components/datePicker/demo/base.md +2 -0
  23. package/components/datePicker/demo/index.vue +2 -0
  24. package/components/datePicker/demo/inside.md +76 -0
  25. package/components/datePicker/demo/size.md +3 -3
  26. package/components/datePicker/index.js +2 -1
  27. package/components/datePicker/index.md +1 -0
  28. package/components/datePicker/styles/calendar.less +149 -49
  29. package/components/datePicker/styles/datepicker.less +3 -3
  30. package/components/drawer/demo/base.md +2 -2
  31. package/components/drawer/demo/custom.md +2 -2
  32. package/components/drawer/demo/form.md +1 -1
  33. package/components/drawer/demo/target.md +14 -3
  34. package/components/drawer/drawer.jsx +11 -10
  35. package/components/drawer/index.md +1 -1
  36. package/components/drawer/styles/animal.less +2 -1
  37. package/components/drawer/styles/index.less +26 -10
  38. package/components/dropdown/dropdown.jsx +0 -1
  39. package/components/empty/empty.jsx +2 -1
  40. package/components/form/form.jsx +1 -1
  41. package/components/icon/demo/search.vue +4 -4
  42. package/components/icon/index.md +1 -1
  43. package/components/image/preview.jsx +10 -8
  44. package/components/index.js +12 -4
  45. package/components/input/demo/size.md +3 -3
  46. package/components/input/styles/index.less +5 -5
  47. package/components/locale/index.js +74 -0
  48. package/components/locale/lang/de.js +55 -0
  49. package/components/locale/lang/el.js +72 -0
  50. package/components/locale/lang/en.js +55 -0
  51. package/components/locale/lang/fr.js +72 -0
  52. package/components/locale/lang/it.js +72 -0
  53. package/components/locale/lang/ja.js +72 -0
  54. package/components/locale/lang/ko.js +72 -0
  55. package/components/locale/lang/ru.js +55 -0
  56. package/components/locale/lang/th.js +72 -0
  57. package/components/locale/lang/ua.js +55 -0
  58. package/components/locale/lang/vi.js +55 -0
  59. package/components/locale/lang/zh-CN.js +55 -0
  60. package/components/locale/lang/zh-TW.js +55 -0
  61. package/components/message/styles/index.less +4 -3
  62. package/components/modal/demo/custom.md +1 -1
  63. package/components/modal/index.js +8 -6
  64. package/components/modal/modal.jsx +42 -37
  65. package/components/page/page.jsx +4 -3
  66. package/components/page/styles/index.less +13 -13
  67. package/components/popconfirm/popconfirm.jsx +2 -2
  68. package/components/select/demo/filterable.md +6 -14
  69. package/components/select/demo/search.md +6 -4
  70. package/components/select/index.md +20 -19
  71. package/components/select/select.jsx +7 -4
  72. package/components/select/styles/index.less +13 -3
  73. package/components/slider/slider.jsx +6 -4
  74. package/components/space/space.jsx +2 -2
  75. package/components/styles/color.less +2 -2
  76. package/components/table/extend.jsx +1 -1
  77. package/components/table/index.md +4 -3
  78. package/components/table/table.jsx +4 -3
  79. package/components/tabs/tabs.jsx +3 -3
  80. package/components/timeline/demo/base.md +3 -3
  81. package/components/timeline/demo/icon.md +5 -5
  82. package/components/timeline/demo/mode.md +12 -6
  83. package/components/timeline/index.md +7 -6
  84. package/components/timeline/styles/index.less +40 -13
  85. package/components/timeline/timeline.jsx +5 -1
  86. package/components/timeline/timelineitem.jsx +9 -5
  87. package/components/treeselect/treeselect.vue +36 -35
  88. package/components/upload/index.md +1 -1
  89. package/components/upload/styles/index.less +1 -1
  90. package/components/upload/upload.jsx +5 -4
  91. package/dist/k-ui.css +7 -1
  92. package/dist/k-ui.js +2 -2
  93. package/dist/locale/de.js +8 -0
  94. package/dist/locale/el.js +8 -0
  95. package/dist/locale/en.js +8 -0
  96. package/dist/locale/fr.js +8 -0
  97. package/dist/locale/it.js +8 -0
  98. package/dist/locale/ja.js +8 -0
  99. package/dist/locale/ko.js +8 -0
  100. package/dist/locale/ru.js +8 -0
  101. package/dist/locale/th.js +8 -0
  102. package/dist/locale/ua.js +8 -0
  103. package/dist/locale/vi.js +8 -0
  104. package/dist/locale/zhCN.js +8 -0
  105. package/dist/locale/zhTW.js +8 -0
  106. package/package.json +4 -3
  107. package/readme.md +1 -1
@@ -6,32 +6,25 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div class="demo-select">
9
- <p>Selected value:{{data}}</p>
9
+ <span>单选过滤 :</span>
10
10
  <Select
11
11
  size="large"
12
- :width="512"
12
+ :width="300"
13
13
  v-model="data"
14
14
  placeholder="单选过滤" filterable>
15
15
  <Option :value="v" :label="v" v-for="(v,i) in options" :key="i"/>
16
16
  </Select>
17
- <p>Selected value:{{data2}}</p>
17
+ <p></p>
18
+ <br/>
19
+ <span>多选过滤 :</span>
18
20
  <Select
19
21
  class="demo-select"
20
22
  multiple
21
- :width="512"
23
+ :width="300"
22
24
  v-model="data2"
23
25
  placeholder="多选过滤" filterable >
24
26
  <Option :value="v" :label="v" v-for="(v,i) in options" :key="i"/>
25
27
  </Select>
26
- <p>Selected value:{{data3}}</p>
27
- <Select
28
- class="demo-select"
29
- :width="512"
30
- multiple
31
- v-model="data3"
32
- placeholder="远程搜索" filterable size="small">
33
- <Option :value="v" :label="v" v-for="(v,i) in options" :key="i"/>
34
- </Select>
35
28
  </div>
36
29
  </template>
37
30
  <script>
@@ -41,7 +34,6 @@ export default{
41
34
  options:['almond','apple','apple core','apple juice','apple skin','apricot','apricot flesh','apricot pit','areca nut','banana','banana skin','bargain price','beechnut','Beijing flowering crab','bitter','bitterness','bitter orange','blackberry','canned fruit','carambola','cherry','cherry pit','cherry pulp','chestnut','Chinese chestnut','Chinese date','Chinese gooseberry','Chinese walnut','coconut','coconut milk','coconut water','cold storage','cold store','crisp','cumquat','damson plum','Dangshan pear','date','date pit','decayed fruit','downy pitch','dry fruit','duke','early-maturing','fig','filbert','first class','flat peach','flavour','flesh','flesh fruit','fresh','fresh litchi','fruiterer','fruit in bags','fruit knife','fruits of the season','gingko','give full weigh','give short weight','grape','grape juice','grape skin','grapestone','greengage','Hami melon','Hard','haw','hawthorn','hazel','honey peach','in season','juicy','juicy peach','jujube','kernel','kumquat','late-maturing','lemon','litchi','litchi rind','longan','longan pulp','loquat','mandarine','mango','mature','morello','muskmelon','navel orange','nut','nut meat','nut shell','oleaster','olive','orange','orange peel','papaya','peach','pear','perishable','pineapple','plum','plumcot','pomegranate','pomelo','red bayberry','reduced price','ripe','rotten fruit','seasonable','seedless orange','special-grade','strawberry','sultana','superfine','tangerine','tart','tender','tinned fruit','unripe','walnut','walnut kernel','water chestnut','watermelon'],
42
35
  data:'',
43
36
  data2:[],
44
- data3:[],
45
37
  }
46
38
  }
47
39
  }
@@ -6,20 +6,22 @@
6
6
  ```vue
7
7
  <template>
8
8
  <div class="demo-select">
9
- <p>Selected value:{{s1}}</p>
9
+ <span>单选搜索: </span>
10
10
  <Select
11
11
  v-model="s1"
12
- :width="512"
12
+ :width="300"
13
13
  @search="search1"
14
14
  :loading="loading1"
15
15
  placeholder="单选搜索">
16
16
  <Option :value="v" :label="v" v-for="(v,i) in options1" :key="i"/>
17
17
  </Select>
18
- <p>Selected value:{{s2}}</p>
18
+ <p></p>
19
+ <br/>
20
+ <span>多选搜索</span>
19
21
  <Select
20
22
  class="demo-select"
21
23
  multiple
22
- :width="512"
24
+ :width="300"
23
25
  :loading="loading2"
24
26
  @search="search2"
25
27
  v-model="s2"
@@ -1,23 +1,24 @@
1
1
  ### Select API
2
- | 属性 | 说明 | 类型 | 默认值 |
3
- | ----------- | ---------------------------------------------------------- | ------------------------------ | ------ |
4
- | value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number | - |
5
- | width | 组件宽度 | String,Number | - |
6
- | placeholder | 选择框默认文字 | String | 请选择 |
7
- | disabled | 是否禁用当前项 | Boolean | false |
8
- | size | 组件尺寸大小,提供`small`,`large`两种尺寸,默认为正常 | String | - |
9
- | multiple | 是否呈现多选模式 | Boolean | false |
10
- | loading | 是否显示异步加载 | Boolean | false |
11
- | clearable | 是否可以清空选项 | Boolean | false |
12
- | bordered | 是否显示边框 | Boolean | true |
13
- | showArrow | 是否显示下拉按钮 | Boolean | true |
14
- | transfer | 默认渲染到body 上,如定位有问题,请尝试修改为 false | Boolean | true |
15
- | change | 在选项状态发生改变时触发,返回选择项{value:xx,label:xx} | Function | - |
16
- | open-change | 下拉框展开或收起时触发 | Function | - |
17
- | options | options 数据,如果设置则不需要手动构造 Option 节点 | Array <{value,label,disabled}> | [] |
18
- | theme | theme='light' 时呈现浅色主题 | String | - |
19
- | icon | 自定义图标 | String | - |
20
- | shape | shape='circle' 时呈现圆角 | String | - |
2
+ | 属性 | 说明 | 类型 | 默认值 |
3
+ | ----------- | ---------------------------------------------------------- | ------------------------------ | ---------- |
4
+ | value | 指定选中项目的 `value` 值,可以使用 `v-model` 双向绑定数据 | String,Number | - |
5
+ | width | 组件宽度 | String,Number | - |
6
+ | placeholder | 选择框默认文字 | String | 请选择 |
7
+ | disabled | 是否禁用当前项 | Boolean | false |
8
+ | size | 组件尺寸大小,提供`small`,`large`两种尺寸,默认为正常 | String | - |
9
+ | emptyText | 没有数据时展示的提示 | String | '赞无数据' |
10
+ | multiple | 是否呈现多选模式 | Boolean | false |
11
+ | loading | 是否显示异步加载 | Boolean | false |
12
+ | clearable | 是否可以清空选项 | Boolean | false |
13
+ | bordered | 是否显示边框 | Boolean | true |
14
+ | showArrow | 是否显示下拉按钮 | Boolean | true |
15
+ | transfer | 默认渲染到body 上,如定位有问题,请尝试修改为 false | Boolean | true |
16
+ | change | 在选项状态发生改变时触发,返回选择项{value:xx,label:xx} | Function | - |
17
+ | open-change | 下拉框展开或收起时触发 | Function | - |
18
+ | options | options 数据,如果设置则不需要手动构造 Option 节点 | Array <{value,label,disabled}> | [] |
19
+ | theme | theme='light' 时呈现浅色主题 | String | - |
20
+ | icon | 自定义图标 | String | - |
21
+ | shape | shape='circle' 时呈现圆角 | String | - |
21
22
 
22
23
  ### Option API
23
24
  | 属性 | 说明 | 类型 | 默认值 |
@@ -4,11 +4,12 @@ import Empty from '../empty';
4
4
  import { hasProp, getChild, isNotEmpty } from '../_tool/utils'
5
5
 
6
6
  import Drop from '../base/drop'
7
+ import { t } from '../locale';
7
8
 
8
9
  export default {
9
10
  name: "Select",
10
11
  props: {
11
- placeholder: { type: String, default: "请选择" },
12
+ placeholder: String,
12
13
  size: {
13
14
  default: 'default',
14
15
  validator(value) {
@@ -27,6 +28,7 @@ export default {
27
28
  showArrow: { type: Boolean, default: true },
28
29
  options: Array,
29
30
  theme: String,
31
+ emptyText: String,
30
32
  icon: String,
31
33
  shape: String,
32
34
  arrowIcon: { type: String, default: 'chevron-down' },
@@ -266,7 +268,7 @@ export default {
266
268
  render() {
267
269
  let { disabled, size, multiple,
268
270
  opened, placeholder, showArrow, bordered,
269
- clear, removeTag, queryKey, theme, arrowIcon, icon, shape,filterable,
271
+ clear, removeTag, queryKey, theme, arrowIcon, icon, shape, filterable,
270
272
  clearable, label, toggleDrop, transfer } = this
271
273
  let childNode = []
272
274
 
@@ -305,7 +307,7 @@ export default {
305
307
  // ? <li class="k-select-empty" onClick={this.emptyClick}><Icon type="albums" /><p class="k-empty-desc">暂无数据</p></li>
306
308
  // : childs
307
309
  // )
308
- const loadingNode = <div class="k-select-loading"><Icon type="sync" spin /><span>加载中...</span></div>
310
+ const loadingNode = <div class="k-select-loading"><Icon type="sync" spin /><span>{t('k.select.loading')}</span></div>
309
311
  const props = {
310
312
  ref: 'overlay',
311
313
  props: {
@@ -326,9 +328,10 @@ export default {
326
328
  }
327
329
  }
328
330
  }
329
- let overlay = <Drop {...props}>{this.loading ? loadingNode : (!childs.length ? <Empty onClick={this.emptyClick} /> : <ul>{childs}</ul>)}</Drop>
331
+ let overlay = <Drop {...props}>{this.loading ? loadingNode : (!childs.length ? <Empty onClick={this.emptyClick} description={this.emptyText}/> : <ul>{childs}</ul>)}</Drop>
330
332
 
331
333
  label = multiple ? (label || []) : label
334
+ placeholder = t('k.select.placeholder')
332
335
  const placeNode = ((placeholder && ((!label || !label.length) && !queryKey))
333
336
  ? <div class="k-select-placeholder">{placeholder}</div>
334
337
  : null
@@ -44,7 +44,7 @@
44
44
  }
45
45
  &-search-wrap {
46
46
  position: absolute;
47
- left: 5px;
47
+ // left: 5px;
48
48
  z-index: 1;
49
49
  top: 50%;
50
50
  background: none;
@@ -96,7 +96,7 @@
96
96
  padding: 3px 0;
97
97
  left: 0;
98
98
  top: 0;
99
- margin: 0;
99
+ margin: 0 0 0 5px;
100
100
  vertical-align: middle;
101
101
  // .k-select-search {
102
102
  // // border: none;
@@ -255,6 +255,7 @@
255
255
  .k-select-loading {
256
256
  padding: 10px;
257
257
  font-size: 14px;
258
+ color: var(--kui-color-font);
258
259
  .k-icon {
259
260
  font-size: 14px;
260
261
  }
@@ -336,9 +337,10 @@
336
337
  .k-select-sm {
337
338
  .k-select-icon {
338
339
  font-size: 14px;
340
+ margin-left: 4px;
339
341
  }
340
342
  .k-select-selection {
341
- min-height: 25px;
343
+ min-height: 24px;
342
344
  }
343
345
  .k-select-arrow {
344
346
  font-size: 12px;
@@ -388,6 +390,14 @@
388
390
  font-size: 12px;
389
391
  color: var(--kui-color-font);
390
392
  }
393
+ &.k-select-has-icon {
394
+ .k-select-selection > .k-select-search-wrap{
395
+ left: 14px;
396
+ }
397
+ .k-select-placeholder {
398
+ left: 14px;
399
+ }
400
+ }
391
401
  }
392
402
 
393
403
  .k-select-lg {
@@ -18,7 +18,7 @@ export default {
18
18
  },
19
19
  watch: {
20
20
  value(v) {
21
- this.defaultValue = v || this.min
21
+ this.defaultValue = (v || this.min) * 1
22
22
  }
23
23
  },
24
24
  data() {
@@ -41,22 +41,24 @@ export default {
41
41
  },
42
42
  render() {
43
43
  let { min, max, step, disabled, direction, defaultValue, groupContext } = this
44
+ defaultValue = defaultValue * 1
45
+ console.log(defaultValue)
44
46
  let props = {
45
47
  class: 'k-slider-bar',
46
48
  attrs: {
47
49
  min, max, step,
48
- value: defaultValue,
50
+ value: defaultValue * 1,
49
51
  type: 'range',
50
52
  disabled,
51
53
  },
52
54
  style: {
53
- 'background': `linear-gradient(to right, #3a95ff ${(defaultValue - min) / (max - min) * 100}%, rgba(255, 255, 255, 0.3) 0%)`
55
+ 'background': `linear-gradient(to right, var(--kui-color-main) ${(defaultValue - min) / (max - min) * 100}%, rgba(255, 255, 255, 0.3) 0%)`
54
56
  },
55
57
  on: {
56
58
  input: this.change
57
59
  }
58
60
  }
59
- // todo: 懒得写, 用input range 替代, 等需求复杂了, 再继续写更多
61
+ // todo: 懒得写, 用input range 替代
60
62
  return <div class={['k-slider', { 'k-slider-disabled': disabled }]}><input {...props} /></div>
61
63
  }
62
64
 
@@ -47,8 +47,8 @@ export default {
47
47
  return (
48
48
  <div class={classes}>
49
49
  {
50
- childs.map((child) => {
51
- return <div class="k-space-item" style={style}>{child}</div>
50
+ childs.map((child, i) => {
51
+ return <div class="k-space-item" style={i != childs.length - 1 ? style : null}>{child}</div>
52
52
  })
53
53
  }
54
54
  </div>
@@ -148,8 +148,8 @@
148
148
  @border-color: rgba(216, 216, 216, 0.5); //边框颜色
149
149
  @dark-border-color: rgba(83, 83, 83, 0.5);
150
150
 
151
- @disable-border: #d0d0d0; //禁用边框颜色
152
- @dark-disable-border: fadeout(@border-color,90%);
151
+ @disable-border: rgba(216, 216, 216, 0.4);//禁用边框颜色
152
+ @dark-disable-border: rgba(83, 83, 83, 0.4);
153
153
 
154
154
  @disable-back: #f5f5f5;//禁用背景颜色
155
155
  @dark-disable-back: fadeout(@back-color,90%);
@@ -23,7 +23,7 @@ export default {
23
23
  },
24
24
  mounted() {
25
25
  let { thead } = this.$refs
26
- if (thead) {
26
+ if (thead && this.$isServer) {
27
27
  // thead.style.marginBottom = `-${thead.offsetHeight - thead.scrollHeight}px`
28
28
  let size = measureScrollBar()
29
29
  this.scrollBarHeight = size
@@ -1,11 +1,12 @@
1
1
  ## Table API
2
2
 
3
3
  | 属性 | 说明 | 类型 | 默认值 |
4
- |---------------|------------------------------------|-----------------------------------------------------|-------------------------|
4
+ | ------------- | ---------------------------------- | --------------------------------------------------- | ----------------------- |
5
5
  | bordered | 是否显示边框 | Boolean | false |
6
6
  | width | 表格的宽度,超出部分出现滚动条 | Number | - |
7
7
  | height | 表格高度,超出部分滚动,头部会固定 | Number | - |
8
8
  | size | 值为`small`时展示紧凑模式 | String | - |
9
+ | emptyText | 没有数据时展示的提示 | String | '赞无数据' |
9
10
  | loading | 表格异步加载模式 | Boolean | false |
10
11
  | data | 显示的结构化数据 | Array | [ ] |
11
12
  | columns | 表格列的配置描述, | Array | [ ] |
@@ -18,7 +19,7 @@
18
19
  ## Column API
19
20
 
20
21
  | 属性 | 说明 | 类型 | 默认值 |
21
- |-----------|---------------------------------------------------------------------------------------------------|--------------------------------|--------|
22
+ | --------- | ------------------------------------------------------------------------------------------------- | ------------------------------ | ------ |
22
23
  | title | 列头显示文字 | String | - |
23
24
  | key | 对应列内容的字段名 | String | - |
24
25
  | width | 列宽 | Number | - |
@@ -31,7 +32,7 @@
31
32
  ## Data.Item API
32
33
 
33
34
  | 属性 | 说明 | 类型 | 默认值 |
34
- |------------|------------------|---------|--------|
35
+ | ---------- | ---------------- | ------- | ------ |
35
36
  | key | Vue 需要的 key | String | - |
36
37
  | \_checked | 选择框是否被选中 | Boolean | false |
37
38
  | \_disabled | 选择框是否被禁用 | Boolean | false |
@@ -22,6 +22,7 @@ export default {
22
22
  data: { type: Array, default: () => [] }, // 表格数据
23
23
  columns: { type: Array, default: () => [] }, // 表格类目
24
24
  loading: Boolean,
25
+ emptyText: String,
25
26
  },
26
27
  data() {
27
28
  return {
@@ -33,10 +34,10 @@ export default {
33
34
  mounted() {
34
35
  this.renderEnd = true
35
36
  this.resetHeight()
36
- window.addEventListener('resize', this.autoResize)
37
+ this.$isServer && window.addEventListener('resize', this.autoResize)
37
38
  },
38
39
  beforeDestroy() {
39
- window.removeEventListener('resize', this.autoResize)
40
+ this.$isServer && window.removeEventListener('resize', this.autoResize)
40
41
  },
41
42
  updated() {
42
43
  this.autoResize()
@@ -260,7 +261,7 @@ export default {
260
261
  }
261
262
 
262
263
  if (!data || !data.length) {
263
- content.push(<Empty />)
264
+ content.push(<Empty description={this.emptyText} />)
264
265
  }
265
266
  //custom footer
266
267
  if (footer) {
@@ -31,13 +31,13 @@ export default {
31
31
  }
32
32
  },
33
33
  mounted() {
34
- window.addEventListener('resize', this.resetNavPosition)
34
+ this.$isServer && window.addEventListener('resize', this.resetNavPosition)
35
35
  this.$nextTick(() => {
36
36
  this.updateIndex()
37
37
  })
38
38
  },
39
- beforeDistory() {
40
- window.removeEventListener('resize', this.resetNavPosition)
39
+ beforeDestory() {
40
+ this.$isServer && window.removeEventListener('resize', this.resetNavPosition)
41
41
  },
42
42
  methods: {
43
43
  closeTab(key, e) {
@@ -7,9 +7,9 @@
7
7
  <template>
8
8
  <div>
9
9
  <TimeLine>
10
- <TimeLineItem>2019 年 11月 发布3.0版本</TimeLineItem>
11
- <TimeLineItem>2019 年 1月27日 发布2.0版本</TimeLineItem>
12
- <TimeLineItem>2017 年 12月 发布1.0版本</TimeLineItem>
10
+ <TimeLineItem time="2020-11-03">发布3.0版本</TimeLineItem>
11
+ <TimeLineItem time="2019-10-25">发布2.0版本</TimeLineItem>
12
+ <TimeLineItem time="2018-10-08">发布1.0版本</TimeLineItem>
13
13
  </TimeLine>
14
14
  </div>
15
15
  </template>
@@ -7,15 +7,15 @@
7
7
  <template>
8
8
  <div>
9
9
  <TimeLine>
10
- <TimeLineItem color="green">优化成吨的改善和体验</TimeLineItem>
11
- <TimeLineItem color="orange">
10
+ <TimeLineItem color="green" time="2020-11-03">优化成吨的改善和体验</TimeLineItem>
11
+ <TimeLineItem color="orange" time="2020-11-02">
12
12
  <p>新增一些很友好的功能</p>
13
13
  <p>新增一些很友好的功能</p>
14
14
  <p>新增一些很友好的功能</p>
15
15
  </TimeLineItem>
16
- <TimeLineItem icon="ribbon">发布2.0版本</TimeLineItem>
17
- <TimeLineItem icon="bug" color="red">修复bug</TimeLineItem>
18
- <TimeLineItem>发布1.0版本</TimeLineItem>
16
+ <TimeLineItem icon="ribbon" color="#3593ff" time="2020-11-01">发布2.0版本</TimeLineItem>
17
+ <TimeLineItem icon="bug" color="red" time="2020-10-03">修复bug</TimeLineItem>
18
+ <TimeLineItem time="2020-10-01">发布1.0版本</TimeLineItem>
19
19
  </TimeLine>
20
20
  </div>
21
21
  </template>
@@ -9,16 +9,22 @@
9
9
  <RadioGroup v-model="mode">
10
10
  <Radio label="left" value="left" />
11
11
  <Radio label="center" value="center" />
12
+ <Radio label="alternate" value="alternate" />
12
13
  <Radio label="right" value="right" />
13
14
  </RadioGroup>
14
15
  <br />
15
16
  <br />
16
17
  <TimeLine :mode="mode">
17
- <TimeLineItem color="green">优化成吨的改善和体验</TimeLineItem>
18
- <TimeLineItem color="orange">新增一些很友好的功能</TimeLineItem>
19
- <TimeLineItem icon="ribbon">发布2.0版本</TimeLineItem>
20
- <TimeLineItem icon="bug" color="red">修复bug</TimeLineItem>
21
- <TimeLineItem>发布1.0版本</TimeLineItem>
18
+ <TimeLineItem color="green" time="2020-11-03" extra="更多的辅助细节">优化成吨的改善和体验</TimeLineItem>
19
+ <TimeLineItem color="orange" time="2020-11-02">
20
+ <p>新增一些很友好的功能</p>
21
+ <p>新增一些很友好的功能</p>
22
+ <p>新增一些很友好的功能</p>
23
+ <template slot="extra">更多的辅助细节</template>
24
+ </TimeLineItem>
25
+ <TimeLineItem icon="ribbon" color="#3593ff" time="2020-11-01" extra="更多的辅助细节">发布2.0版本</TimeLineItem>
26
+ <TimeLineItem icon="bug" color="red" time="2020-10-03" extra="更多的辅助细节">修复bug</TimeLineItem>
27
+ <TimeLineItem time="2020-10-01" extra="更多的辅助细节">发布1.0版本</TimeLineItem>
22
28
  </TimeLine>
23
29
  </div>
24
30
  </template>
@@ -26,7 +32,7 @@
26
32
  export default{
27
33
  data(){
28
34
  return{
29
- mode:'right'
35
+ mode:'left'
30
36
  }
31
37
  }
32
38
  }
@@ -1,7 +1,8 @@
1
1
  ### API
2
- | 属性 | 说明 | 类型 | 默认值 |
3
- |-------|---------------|--------|-----|
4
- | icon | 时间轴 `item` 图标 | String | - |
5
- | color | 时间轴 `item` 图标颜色 | String | - |
6
- | dot | 自定义时间轴点 | slot | - |
7
- | mode| 通过设置 `mode` 可以改变时间轴和内容的相对位置 `left` \| `alternate` \| `right` |String|left|
2
+ | 属性 | 说明 | 类型 | 默认值 |
3
+ | ----- | -------------------------------------------------------------------------------------- | ----------- | ------ |
4
+ | icon | 时间轴 `item` 图标 | String | - |
5
+ | color | 时间轴 `item` 图标颜色 | String | - |
6
+ | time | 时间文本 | String | - |
7
+ | extra | 自定义辅助内容 | String,slot | - |
8
+ | mode | 通过设置 `mode` 可以改变时间轴和内容的相对位置 `left` ,`center`, `alternate` , `right` | String | left |
@@ -9,6 +9,7 @@
9
9
  padding: 0;
10
10
  list-style: none;
11
11
  color: var(--kui-color-font);
12
+ width: 100%;
12
13
  .k-time-line-item {
13
14
  position: relative;
14
15
  &:before {
@@ -26,30 +27,56 @@
26
27
  }
27
28
  .k-time-line-dot {
28
29
  position: absolute;
29
- background: var(--kui-color-back);
30
- top: 4px;
31
- left: -.5px;
30
+ // background: var(--kui-color-back);
31
+ top: 2px;
32
+ left: 0;
32
33
  font-size: 16px;
33
- color: var(--kui-color-main);
34
+ color: #ccc;
34
35
  line-height: 1;
35
- border-radius: 50%;
36
- }
37
- .k-time-line-icon-default {
38
- font-size: 12px;
39
- left: 1px;
40
- top: 5.5px;
36
+ // border-radius: 50%;
41
37
  }
38
+ // .k-time-line-icon-default {
39
+ // font-size: 12px;
40
+ // left: 1px;
41
+ // top: 4px;
42
+ // }
42
43
  .k-time-line-item-content {
43
- padding: 0 0 20px 18px;
44
- font-size: 12px;
44
+ padding: 0 0 20px 25px;
45
+ font-size: 14px;
45
46
  position: relative;
46
- line-height: 22px;
47
+ line-height: 20px;
47
48
  top: 0;
48
49
  box-sizing: border-box;
49
50
  }
51
+ .k-time-line-item-time {
52
+ font-size: 12px;
53
+ color: var(--kui-color-gray-30);
54
+ margin-top: 4px;
55
+ line-height: 16px;
56
+ }
57
+ .k-time-line-item-extra {
58
+ font-size: 12px;
59
+ color: var(--kui-color-gray-30);
60
+ margin-top: 4px;
61
+ line-height: 16px;
62
+ }
50
63
  }
51
64
 
52
65
  .k-timeline-center {
66
+ .k-time-line-item {
67
+ width: 50%;
68
+ left: 50%;
69
+ }
70
+ .k-time-line-item-time {
71
+ position: absolute;
72
+ margin-left: calc(-35px - 100%);
73
+ width: 100%;
74
+ text-align: right;
75
+ top: -2px;
76
+ }
77
+ }
78
+
79
+ .k-timeline-alternate {
53
80
  width: 100%;
54
81
  display: inline-block;
55
82
  .k-time-line-item {
@@ -2,7 +2,11 @@
2
2
  export default {
3
3
  name: "TimeLine",
4
4
  props: {
5
- mode: { type: String, default: 'left' }
5
+ mode: {
6
+ type: String, default: 'left', validator: (val) => {
7
+ return ['left', 'right', 'center', 'alternate'].indexOf(val) > -1
8
+ }
9
+ }
6
10
  },
7
11
  render() {
8
12
  const classes = ['k-timeline', `k-timeline-${this.mode}`]
@@ -3,15 +3,17 @@ export default {
3
3
  name: "TimeLineItem",
4
4
  props: {
5
5
  color: String,
6
- icon: String
6
+ icon: String,
7
+ time: String,
8
+ extra: String,
7
9
  },
8
10
  render() {
9
- let { icon, color } = this
11
+ let { icon, color, time } = this
10
12
  const styles = { color }
11
- const type = icon ? icon : "radio-button-off";
13
+ const type = icon ? icon : "ellipse";
12
14
  const iconNode = this.$slots.dot || <Icon type={type} />
13
- const iconCls = ['k-time-line-dot', { 'k-time-line-icon-default': !icon }]
14
-
15
+ const iconCls = ['k-time-line-dot']
16
+ let extra = this.extra || this.$slots.extra
15
17
  return (
16
18
  <li class="k-time-line-item">
17
19
  <div class={iconCls} style={styles}>
@@ -19,6 +21,8 @@ export default {
19
21
  </div>
20
22
  <div class="k-time-line-item-content">
21
23
  {this.$slots.default}
24
+ {extra && <div class="k-time-line-item-extra">{extra}</div>}
25
+ {time && <div class="k-time-line-item-time">{time}</div>}
22
26
  </div>
23
27
  </li>
24
28
  )