@kyfe/hroa-ui 1.0.2 → 1.0.4

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 (64) hide show
  1. package/dist/hroa-ui.common.js +3262 -265
  2. package/dist/hroa-ui.css +1 -1
  3. package/dist/hroa-ui.umd.js +3262 -265
  4. package/dist/hroa-ui.umd.min.js +2 -2
  5. package/lib/getJsModule/index.css +1 -1
  6. package/lib/getJsModule/index.js +2 -2
  7. package/lib/hr-add-list/index.js +1 -1
  8. package/lib/hr-bottom-button/index.css +1 -1
  9. package/lib/hr-bottom-button/index.js +1 -1
  10. package/lib/hr-breadcrumb/index.css +1 -1
  11. package/lib/hr-breadcrumb/index.js +2 -2
  12. package/lib/hr-button/index.js +1 -1
  13. package/lib/hr-clipboard/index.js +1 -1
  14. package/lib/hr-condition-filtrate/index.js +1 -1
  15. package/lib/hr-condition-filtrate-popup/index.js +1 -1
  16. package/lib/hr-elasticity-box/index.js +1 -1
  17. package/lib/hr-elasticity-box-item/index.js +1 -1
  18. package/lib/hr-emotional-picture/index.js +1 -1
  19. package/lib/hr-employee-choose/index.js +1 -1
  20. package/lib/hr-file-list/index.css +1 -0
  21. package/lib/hr-file-list/index.js +1 -0
  22. package/lib/hr-img-list/index.js +1 -1
  23. package/lib/hr-info-card/index.js +1 -1
  24. package/lib/hr-information/index.js +1 -1
  25. package/lib/hr-license-plate-number/index.js +1 -1
  26. package/lib/hr-module-card/index.js +1 -1
  27. package/lib/hr-multiterm-choose/index.js +1 -1
  28. package/lib/hr-no-data/index.js +1 -1
  29. package/lib/hr-notice-bar/index.js +1 -1
  30. package/lib/hr-open-ks/index.js +1 -1
  31. package/lib/hr-pager/index.js +1 -1
  32. package/lib/hr-popup/index.js +1 -1
  33. package/lib/hr-preview-file/index.js +1 -1
  34. package/lib/hr-rate/index.js +1 -1
  35. package/lib/hr-reason-textarea/index.js +1 -1
  36. package/lib/hr-search-input/index.js +1 -1
  37. package/lib/hr-select/index.js +1 -1
  38. package/lib/hr-select-list/index.css +1 -1
  39. package/lib/hr-select-list/index.js +2 -2
  40. package/lib/hr-single-choose/index.css +1 -1
  41. package/lib/hr-single-choose/index.js +1 -1
  42. package/lib/hr-slide-pager/index.js +1 -1
  43. package/lib/hr-sort/index.js +1 -1
  44. package/lib/hr-stack-image/index.js +1 -1
  45. package/lib/hr-tab-nav/index.css +1 -1
  46. package/lib/hr-tab-nav/index.js +1 -1
  47. package/lib/hr-view-item/index.js +1 -1
  48. package/lib/index/index.css +1 -1
  49. package/lib/index/index.js +2 -2
  50. package/lib/utils/index.js +1 -1
  51. package/package.json +1 -1
  52. package/packages/hr-bottom-button/src/index.vue +32 -13
  53. package/packages/hr-breadcrumb/src/index.vue +2 -2
  54. package/packages/hr-file-list/index.js +3 -0
  55. package/packages/hr-file-list/src/file-type/other.vue +45 -0
  56. package/packages/hr-file-list/src/file-type/picture.vue +38 -0
  57. package/packages/hr-file-list/src/file-type/video.vue +60 -0
  58. package/packages/hr-file-list/src/index.vue +246 -0
  59. package/packages/hr-file-list/src/utils/enum.js +95 -0
  60. package/packages/hr-file-list/src/utils/fun.js +16 -0
  61. package/packages/hr-file-list//346/226/207/344/273/266/345/210/227/350/241/250.md +0 -0
  62. package/packages/hr-select-list/src/index.vue +29 -11
  63. package/packages/hr-single-choose/src/index.vue +24 -6
  64. package/packages/hr-tab-nav/src/index.vue +4 -3
@@ -0,0 +1,95 @@
1
+ const imgIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/img.svg'
2
+ export const videoIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/video.svg'
3
+ const pdfIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/pdf.svg'
4
+ const pptIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/ppt.svg'
5
+ const wordIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/word.svg'
6
+ const xlsIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/word.svg'
7
+ const txtIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/txt.svg'
8
+ const zipIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/zip.svg'
9
+ export const defaultIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/default.svg'
10
+ export const noFormatIcon = 'https://erphostjs.kye-erp.com/hr-oa-kts/ks-app/hr-fe-together-build/file-type/no-format.svg'
11
+
12
+ export const FILE_TYPE = {
13
+ IMG: 'img',
14
+ VIDEO: 'video',
15
+ OTHER: 'other',
16
+ UNKNOWN: 'unknown'
17
+ }
18
+
19
+ // 图片格式
20
+ export const IMG_FORMAT = ['png', 'jpg', 'jpeg', 'bmp', 'webp', 'gif']
21
+
22
+ // 视频格式
23
+ export const VIDEO_FORMAT = ['mp4', 'avi', 'mkv', 'mov', 'wmv', 'flv', 'mpeg', 'webm']
24
+
25
+ // PDF格式
26
+ export const PDF_FORMAT = ['pdf']
27
+
28
+ // PPT格式
29
+ export const PPT_FORMAT = ['ppt', 'pptx', 'pps', 'ppsx']
30
+
31
+ // WORD格式
32
+ export const WORD_FORMAT = ['doc', 'docx']
33
+
34
+ // XLS格式
35
+ export const XLS_FORMAT = ['xls', 'xlsx']
36
+
37
+ // TXT格式
38
+ export const TXT_FORMAT = ['txt']
39
+
40
+ // ZIP格式
41
+ export const ZIP_FORMAT = ['zip', 'rar', '7z', 'tar', 'gz']
42
+
43
+ // 可预览格式
44
+ export const PREVIEW_FORMAT = [
45
+ ...IMG_FORMAT,
46
+ ...VIDEO_FORMAT,
47
+ ...PDF_FORMAT,
48
+ ...PPT_FORMAT,
49
+ ...WORD_FORMAT,
50
+ ...XLS_FORMAT
51
+ ]
52
+
53
+ // 文件格式数据
54
+ export const FILE_FORMAT_DATA = [
55
+ {
56
+ type: 'IMG',
57
+ format: IMG_FORMAT,
58
+ formatIcon: imgIcon
59
+ },
60
+ {
61
+ type: 'VIDEO',
62
+ format: VIDEO_FORMAT,
63
+ formatIcon: videoIcon
64
+ },
65
+ {
66
+ type: 'PDF',
67
+ format: PDF_FORMAT,
68
+ formatIcon: pdfIcon
69
+ },
70
+ {
71
+ type: 'PPT',
72
+ format: PPT_FORMAT,
73
+ formatIcon: pptIcon
74
+ },
75
+ {
76
+ type: 'WORD',
77
+ format: WORD_FORMAT,
78
+ formatIcon: wordIcon
79
+ },
80
+ {
81
+ type: 'XLS',
82
+ format: XLS_FORMAT,
83
+ formatIcon: xlsIcon
84
+ },
85
+ {
86
+ type: 'TXT',
87
+ format: TXT_FORMAT,
88
+ formatIcon: txtIcon
89
+ },
90
+ {
91
+ type: 'ZIP',
92
+ format: ZIP_FORMAT,
93
+ formatIcon: zipIcon
94
+ }
95
+ ]
@@ -0,0 +1,16 @@
1
+ import { FILE_TYPE, IMG_FORMAT, VIDEO_FORMAT } from './enum.js'
2
+
3
+ // 根据文件拓展名获取文件类型
4
+ export const getFileTypeByExtendName = (extendName) => {
5
+ if (!extendName) {
6
+ return FILE_TYPE.UNKNOWN
7
+ }
8
+ const newExtendName = extendName.toLowerCase()
9
+ const isImgType = IMG_FORMAT.includes(newExtendName)
10
+ const isVideoType = VIDEO_FORMAT.includes(newExtendName)
11
+ return (
12
+ (isImgType && FILE_TYPE.IMG) ||
13
+ (isVideoType && FILE_TYPE.VIDEO) ||
14
+ FILE_TYPE.OTHER
15
+ )
16
+ }
@@ -16,7 +16,7 @@
16
16
  title: String,
17
17
  // 默认值
18
18
  defaultValue: {
19
- type: [String, Array],
19
+ type: [String, Array, Number],
20
20
  default: ''
21
21
  },
22
22
  // 选项value用到的字段
@@ -56,6 +56,11 @@
56
56
  showSubmitBtn: {
57
57
  type: Boolean,
58
58
  default: true
59
+ },
60
+ // 确定按钮文本
61
+ submitBtnTxt: {
62
+ type: String,
63
+ default: '确定'
59
64
  }
60
65
  },
61
66
  data () {
@@ -96,7 +101,7 @@
96
101
  closeable={this.closeable}
97
102
  position={this.position}
98
103
  popupStyle={this.popupStyle}
99
- safe-area-inset-bottom
104
+ safe-area-inset-bottom={this.position === 'bottom'}
100
105
  title={this.title}
101
106
  onClose={this.close}>
102
107
  <div class="hr-select-list">
@@ -106,14 +111,16 @@
106
111
  return <div class={['option-item', this.isSelectedOption(item[this.valKey]) ? 'active' : '']}
107
112
  onClick={() => this.optionClick(item[this.valKey])}>
108
113
  {item[this.labelKey]}
109
- {
110
- this.isSelectedOption(item[this.valKey]) && <div class="check-box"><ks-icon name="success" class="icon-cls" /></div>
111
- }
114
+ <div class="check-box">
115
+ {
116
+ this.isSelectedOption(item[this.valKey]) && <ks-icon name="success" class="icon-cls" />
117
+ }
118
+ </div>
112
119
  </div>
113
120
  })
114
121
  }
115
122
  </div>
116
- {this.showSubmitBtn && <div class="submit-btn" onClick={this.submit}>确认</div>}
123
+ {this.showSubmitBtn && <div class="submit-btn" onClick={this.submit}>{this.submitBtnTxt}</div>}
117
124
  </div>
118
125
  </HrPopup>
119
126
  )
@@ -123,26 +130,34 @@
123
130
  const val = cloneDeep(this.defaultValue)
124
131
  if (Object.prototype.toString.call(val) === '[object String]') {
125
132
  this.selectValue = val ? [val] : []
133
+ } else if (Object.prototype.toString.call(val) === '[object Number]') {
134
+ this.selectValue = String(val) ? [String(val)] : []
126
135
  } else {
127
136
  this.selectValue = val || []
128
137
  }
129
138
  },
130
139
  isSelectedOption (key) {
131
- return this.selectValue.some(i => i === key)
140
+ return this.selectValue.some(i => String(i) === String(key))
132
141
  },
133
142
  // 当前值
134
143
  optionClick (key) {
135
144
  const selectedOptions = this.selectValue || []
136
145
  if (this.multiple) {
137
- const hasSelected = selectedOptions.some(i => i === key)
146
+ const hasSelected = selectedOptions.some(i => String(i) === String(key))
138
147
  if (hasSelected) {
139
- this.selectValue = selectedOptions.filter(i => i !== key)
148
+ this.selectValue = selectedOptions.filter(i => String(i) !== String(key))
140
149
  } else {
141
150
  this.selectValue.push(key)
142
151
  }
143
152
  } else {
144
153
  this.selectValue = [key]
145
154
  }
155
+ this.optionClickAfter(key)
156
+ },
157
+ // 选项点击后执行回调
158
+ optionClickAfter (key) {
159
+ const selectOptions = this.columns.filter(i => this.selectValue.includes(i[this.valKey]))
160
+ this.$emit('optionClick', key, this.selectValue, selectOptions)
146
161
  },
147
162
  close () {
148
163
  const selectOptions = this.columns.filter(i => this.selectValue.includes(i[this.valKey]))
@@ -166,10 +181,10 @@
166
181
  flex-direction: column;
167
182
  .list-box {
168
183
  flex: 1;
184
+ padding: 4px 0;
169
185
  overflow: auto;
170
186
  .option-item {
171
- height: 48px;
172
- padding: 0 16px;
187
+ padding: 12px 16px;
173
188
  font-size: 14px;
174
189
  color: #03050d;
175
190
  display: flex;
@@ -178,6 +193,9 @@
178
193
  &.active {
179
194
  color: #7972fe;
180
195
  }
196
+ .check-box {
197
+ width: 14px;
198
+ }
181
199
  }
182
200
  }
183
201
  .submit-btn {
@@ -60,6 +60,12 @@
60
60
  default () {
61
61
  return false
62
62
  }
63
+ },
64
+ checkValue: {
65
+ type: String || Number,
66
+ default () {
67
+ return -1
68
+ }
63
69
  }
64
70
  },
65
71
  data () {
@@ -75,16 +81,27 @@
75
81
  return this.isShowAll ? [{ label: '全部', value: 0 }].concat(this.list) : this.list
76
82
  }
77
83
  },
84
+ watch: {
85
+ checkValue: {
86
+ handler (newValue) {
87
+ this.initActive(newValue)
88
+ },
89
+ immediate: true
90
+ }
91
+ },
78
92
  methods: {
79
93
  init () {
80
94
  this.initState()
81
95
  },
82
96
  initState () {
83
97
  },
84
- select (index) {
85
- this.active = this.active === index ? -1 : index
98
+ initActive (newValue) {
99
+ this.active = newValue
100
+ },
101
+ select (value, index) {
102
+ this.active = this.active === value ? -1 : value
86
103
  this.$emit('select', this.filterList[index])
87
- }
104
+ },
88
105
  },
89
106
  render () {
90
107
  const width = this.selfAdaption ? null : `calc((100% - ${this.margin * (this.divideeQually - 1)}px) / ${this.divideeQually})`
@@ -98,15 +115,16 @@
98
115
  {
99
116
  this.filterList.map((item, index) => {
100
117
  const marginRight = this.selfAdaption ? null : `${(index + 1) % this.divideeQually === 0 ? 0 : this.margin}px`
118
+ const { value, label } = item
101
119
  return <div
102
- onClick={this.select.bind(this, index)}
120
+ onClick={this.select.bind(this, value, index)}
103
121
  style={{ width, marginRight, marginBottom }}
104
122
  class={[
105
123
  'condition-item',
106
124
  'ellipsis',
107
- this.active === index && 'active',
125
+ this.active === value && 'active',
108
126
  ]}>
109
- {item.label}
127
+ {label}
110
128
  </div>
111
129
  })
112
130
  }
@@ -48,11 +48,12 @@
48
48
  render () {
49
49
  // render tab
50
50
  const renderHeaderTab = (params = {}) => {
51
- const { text, type, count = 0 } = params
51
+ const { text, type, count } = params
52
52
  const active = this.currentType === type
53
+ const isUndefined = typeof count === 'undefined'
53
54
 
54
55
  return <div class={['nav-item', active && 'active']} onClick={this.switchTab.bind(this, type)}>
55
- {text} {count > 0 ? count : ''}
56
+ {text} {isUndefined ? '' : count}
56
57
  {active && <i class="item-border"></i>}
57
58
  </div>
58
59
  }
@@ -108,7 +109,7 @@
108
109
  }
109
110
  .nav-item.active {
110
111
  font-size: 14px;
111
- color: #03050D;
112
+ color: #03050d;
112
113
  }
113
114
  }
114
115
  </style>