yks-element 1.0.0 → 1.0.315
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.
- package/LICENSE +21 -0
- package/README.md +49 -4
- package/{dist → lib}/fonts/element-icons.535877f5.woff +0 -0
- package/{dist → lib}/fonts/element-icons.732389de.ttf +0 -0
- package/lib/fonts/iconfont.19124b0d.ttf +0 -0
- package/lib/fonts/iconfont.3ae3dd4e.woff +0 -0
- package/lib/yks.css +1 -0
- package/package.json +74 -51
- package/packages/Button/index.js +8 -0
- package/packages/Button/src/index.vue +67 -0
- package/packages/Dialog/index.js +8 -0
- package/packages/Dialog/src/index.vue +103 -0
- package/packages/Multimedia/index.js +8 -0
- package/packages/Multimedia/src/index.vue +167 -0
- package/packages/Pagination/index.js +8 -0
- package/packages/Pagination/src/index.vue +149 -0
- package/packages/Scrollbar/index.js +8 -0
- package/packages/Scrollbar/src/index.vue +27 -0
- package/packages/Select/index.js +8 -0
- package/packages/Select/src/index.vue +350 -0
- package/packages/Select/src/option.vue +29 -0
- package/packages/Table/index.js +8 -0
- package/packages/Table/src/index.vue +141 -0
- package/packages/Tinymce/index.js +8 -0
- package/packages/Tinymce/src/config.js +25 -0
- package/packages/Tinymce/src/index.vue +500 -0
- package/packages/UploadFile/index.js +8 -0
- package/packages/UploadFile/src/index.vue +388 -0
- package/packages/Video/index.js +8 -0
- package/packages/Video/src/index.vue +352 -0
- package/packages/assets/utils/index.js +83 -0
- package/packages/icon/default/icons.js +182 -0
- package/packages/icon/default/icons.min.js +1 -0
- package/packages/icon/default/index.js +7 -0
- package/packages/icon/ks-pdf.png +0 -0
- package/packages/icon/ks-ppt.png +0 -0
- package/packages/icon/ks-word.png +0 -0
- package/packages/icon/ks-xslx.png +0 -0
- package/packages/icon/music-bg.png +0 -0
- package/packages/icon/video-bg.png +0 -0
- package/packages/index.js +221 -0
- package/packages/option/index.js +6 -0
- package/packages/styles/_mixin.scss +93 -0
- package/packages/styles/_variables.scss +40 -0
- package/packages/styles/common.scss +167 -0
- package/packages/styles/element-ui.scss +135 -0
- package/packages/styles/element-variables.scss +794 -0
- package/packages/styles/fonts/element-icons.ttf +0 -0
- package/packages/styles/fonts/element-icons.woff +0 -0
- package/packages/styles/fonts/iconfont.ttf +0 -0
- package/packages/styles/fonts/iconfont.woff +0 -0
- package/packages/styles/icon.scss +69 -0
- package/packages/styles/index.scss +10 -0
- package/packages/styles/select.scss +98 -0
- package/packages/styles/table.scss +45 -0
- package/types/index.d.ts +4 -0
- package/dist/demo.html +0 -10
- package/dist/yks.common.js +0 -64801
- package/dist/yks.css +0 -1
- package/dist/yks.umd.js +0 -64811
- package/dist/yks.umd.min.js +0 -15
- package/packages/button/index.vue +0 -16
- package/packages/index.ts +0 -12
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-select
|
|
3
|
+
ref="infiniteSelect"
|
|
4
|
+
v-model="query"
|
|
5
|
+
class="yks-select"
|
|
6
|
+
:class="{ 'yks-select--multiple': multiple }"
|
|
7
|
+
v-bind="mapProps"
|
|
8
|
+
:multiple="multiple"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:value-key="valueKey"
|
|
11
|
+
:size="size"
|
|
12
|
+
:clearable="clearable"
|
|
13
|
+
:name="name"
|
|
14
|
+
:filterable="mapFilterable"
|
|
15
|
+
:filter-method="filterMethodHandler()"
|
|
16
|
+
:remote="remote"
|
|
17
|
+
:popper-class="mapPopperClass"
|
|
18
|
+
@visible-change="(val) => visibleChangeHandler(val)"
|
|
19
|
+
v-on="$listeners"
|
|
20
|
+
>
|
|
21
|
+
<template v-if="domLimit">
|
|
22
|
+
<yks-option
|
|
23
|
+
v-for="(item, idx) in renderList"
|
|
24
|
+
:key="valueKey ? item[mapValue][valueKey] : item[mapValue]"
|
|
25
|
+
:label="item[mapLabel] ? item[mapLabel] : item[mapValue]"
|
|
26
|
+
:value="item[mapValue]"
|
|
27
|
+
:disabled="item[mapDisabled] ? item[mapDisabled] : false"
|
|
28
|
+
:data-items-index="currStartIndex + idx"
|
|
29
|
+
:class="{ 'last-item': idx === renderList.length - 1, 'first-item': idx === 0 }"
|
|
30
|
+
>
|
|
31
|
+
<slot :item="item" name="options"></slot>
|
|
32
|
+
</yks-option>
|
|
33
|
+
</template>
|
|
34
|
+
<slot v-if="!domLimit"></slot>
|
|
35
|
+
<div v-if="allowBottom" class="yks-select-bottom">
|
|
36
|
+
<slot name="footer"></slot>
|
|
37
|
+
</div>
|
|
38
|
+
<template slot="empty">
|
|
39
|
+
<p class="el-select-dropdown__empty">无数据</p>
|
|
40
|
+
<div v-if="allowBottom" class="yks-select-bottom">
|
|
41
|
+
<slot name="footer"></slot>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</el-select>
|
|
45
|
+
</template>
|
|
46
|
+
<script>
|
|
47
|
+
import { debounce } from 'throttle-debounce'
|
|
48
|
+
import { on, getStyle } from 'element-ui/lib/utils/dom'
|
|
49
|
+
|
|
50
|
+
import ElSelect from 'element-ui/lib/select'
|
|
51
|
+
|
|
52
|
+
const selectProps = { ...ElSelect.props }
|
|
53
|
+
/**
|
|
54
|
+
* YksSelect
|
|
55
|
+
* @module yks-select
|
|
56
|
+
* @example
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export default {
|
|
61
|
+
name: 'YksSelect',
|
|
62
|
+
components: {
|
|
63
|
+
ElSelect
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* 属性参数
|
|
67
|
+
* @member
|
|
68
|
+
* @property {Object} [data] 数据选项
|
|
69
|
+
* @property {Boolean} [dom-limit] 是否渲染,默认值为true
|
|
70
|
+
* @property {Number} [dom-num] 每页渲染的dom数目,最终渲染3页,dom节点数为domNum*3
|
|
71
|
+
* @property {Object} [option-map] 自定义value,label,disabled名称
|
|
72
|
+
* @property {Boolean} [disabled] 是否禁用
|
|
73
|
+
* @property {String} [size] 输入框尺寸
|
|
74
|
+
* @property {Boolean} [clearable] 单选时是否可以清空选项
|
|
75
|
+
* @property {Number} [multiple-limit] 多选时用户最多可以选择的项目数,为 0 则不限制
|
|
76
|
+
* @property {String} [placeholder] 占位符
|
|
77
|
+
* @property {Boolean} [filterable] 是否可搜索
|
|
78
|
+
* @property {Boolean} [filterableInline] 搜索框是否在下拉框里面
|
|
79
|
+
* @property {Boolean} [allow-create] 是否允许用户创建新条目,需配合 filterable 使用
|
|
80
|
+
* @property {Boolean} [collapse-tags] 多选时是否将选中值按文字的形式展示
|
|
81
|
+
* @property {Function} [filter-method] 自定义搜索方法
|
|
82
|
+
* @property {Boolean} [remote] 是否为远程搜索
|
|
83
|
+
* @property {Function} [scrollBottom] 远程搜索时滚动到底部触发
|
|
84
|
+
* @property {Function} [remote-method] 远程搜索方法
|
|
85
|
+
* @property {Boolean} [loading] 是否正在从远程获取数据
|
|
86
|
+
* @property {String} [loading-text] 远程加载时显示的文字
|
|
87
|
+
* @property {String} [no-match-text] 搜索条件无匹配时显示的文字
|
|
88
|
+
* @property {String} [no-data-text] 选项为空时显示的文字
|
|
89
|
+
* @property {String} [popper-class] Select 下拉框的类名
|
|
90
|
+
* @property {String} [allow-bottom] 是否出现底部吸底
|
|
91
|
+
* @property {String} [reserve-keyword] 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词
|
|
92
|
+
* @property {Boolean} [default-first-option] 在输入框按下回车,选择第一个匹配项。需配合 filterable 或 remote 使用
|
|
93
|
+
* @property {Boolean} [popper-append-to-body] 是否将弹出框插入至 body 元素。在弹出框的定位出现问题时,可将该属性设置为 false
|
|
94
|
+
*/
|
|
95
|
+
props: {
|
|
96
|
+
...selectProps,
|
|
97
|
+
domNum: {
|
|
98
|
+
type: Number,
|
|
99
|
+
default: 10
|
|
100
|
+
},
|
|
101
|
+
data: {
|
|
102
|
+
type: Array,
|
|
103
|
+
default: () => {
|
|
104
|
+
return []
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
valueKey: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ''
|
|
110
|
+
},
|
|
111
|
+
clearable: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: false
|
|
114
|
+
},
|
|
115
|
+
allowBottom: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: false
|
|
118
|
+
},
|
|
119
|
+
filterableInline: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
123
|
+
domLimit: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: true
|
|
126
|
+
},
|
|
127
|
+
optionMap: {
|
|
128
|
+
type: Object,
|
|
129
|
+
default() {
|
|
130
|
+
return null
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
data() {
|
|
135
|
+
return {
|
|
136
|
+
selectLabel: '',
|
|
137
|
+
defaultItemHeight: 34,
|
|
138
|
+
query: '',
|
|
139
|
+
|
|
140
|
+
cacheList: [],
|
|
141
|
+
currStartIndex: 0,
|
|
142
|
+
lastMaxItemIndex: 0,
|
|
143
|
+
lastLoadedIndex: 0,
|
|
144
|
+
scrollHeight: null,
|
|
145
|
+
scrollTop: null,
|
|
146
|
+
wrapPaddingTop: 0,
|
|
147
|
+
itemHeight: null,
|
|
148
|
+
isLoading: false,
|
|
149
|
+
visible: false,
|
|
150
|
+
scrollWrap: null,
|
|
151
|
+
selectInput: null,
|
|
152
|
+
selectInitHeight: null,
|
|
153
|
+
scrollList: null,
|
|
154
|
+
scrollLast: null,
|
|
155
|
+
renderList: [],
|
|
156
|
+
// emptyText: null,
|
|
157
|
+
cachedQuery: '',
|
|
158
|
+
changeValue: '',
|
|
159
|
+
cachedPlaceHolder: ''
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
computed: {
|
|
163
|
+
mapFilterable() {
|
|
164
|
+
return this.filterable || this.filterableInline
|
|
165
|
+
},
|
|
166
|
+
mapProps() {
|
|
167
|
+
let params = { ...this.$props }
|
|
168
|
+
delete params.data
|
|
169
|
+
delete params.domLimit
|
|
170
|
+
delete params.domNum
|
|
171
|
+
delete params.filterableInline
|
|
172
|
+
return params
|
|
173
|
+
},
|
|
174
|
+
mapPopperClass() {
|
|
175
|
+
let popperClass = `yks-select-dropdown ${this.popperClass || ''}`
|
|
176
|
+
if (this.filterableInline) {
|
|
177
|
+
popperClass += 'yks-select_input--inline'
|
|
178
|
+
}
|
|
179
|
+
return popperClass
|
|
180
|
+
},
|
|
181
|
+
debounce() {
|
|
182
|
+
return this.remote ? 300 : 0
|
|
183
|
+
},
|
|
184
|
+
mapValue() {
|
|
185
|
+
return this.optionMap && this.optionMap.value ? this.optionMap.value : 'value'
|
|
186
|
+
},
|
|
187
|
+
mapLabel() {
|
|
188
|
+
return this.optionMap && this.optionMap.label ? this.optionMap.label : 'label'
|
|
189
|
+
},
|
|
190
|
+
mapDisabled() {
|
|
191
|
+
return this.optionMap && this.optionMap.disabled ? this.optionMap.disabled : 'disabled'
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
watch: {
|
|
195
|
+
query(val) {
|
|
196
|
+
this.resetTagTitle()
|
|
197
|
+
|
|
198
|
+
// this.cachedQuery = val
|
|
199
|
+
// if (!this.multiple && this.remote) {
|
|
200
|
+
// this.$nextTick(() => {
|
|
201
|
+
// this.$refs.infiniteSelect.currentPlaceholder =
|
|
202
|
+
// this.$refs.infiniteSelect.selectedLabel ||
|
|
203
|
+
// this.$refs.infiniteSelect.cachedPlaceHolder
|
|
204
|
+
// })
|
|
205
|
+
// }
|
|
206
|
+
this.$emit('input', val)
|
|
207
|
+
},
|
|
208
|
+
value(val) {
|
|
209
|
+
// console.log(val, '响应的')
|
|
210
|
+
// this.updateCacheOptions()
|
|
211
|
+
this.query = val
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
data: {
|
|
215
|
+
handler(val, oldVal) {
|
|
216
|
+
// if (this.domLimit) {
|
|
217
|
+
// this.cacheList = [...oldVal]
|
|
218
|
+
this.resetRenderList()
|
|
219
|
+
// this.updateCacheOptions()
|
|
220
|
+
// }
|
|
221
|
+
},
|
|
222
|
+
deep: true
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
mounted() {
|
|
226
|
+
this.query =
|
|
227
|
+
typeof this.value === Array ? JSON.parse(JSON.stringify(this.value)) : this.value
|
|
228
|
+
this.resetRenderList()
|
|
229
|
+
if (this.remote) {
|
|
230
|
+
// this.cacheList = [...this.data]
|
|
231
|
+
// this.updateCacheOptions()
|
|
232
|
+
this.scrollHandler = this.scrollHandler.bind(this)
|
|
233
|
+
this.scrollWrap = this.$refs.infiniteSelect.$el.querySelector(
|
|
234
|
+
'.el-select-dropdown__wrap'
|
|
235
|
+
)
|
|
236
|
+
this.selectInput = this.$refs.infiniteSelect.$el
|
|
237
|
+
this.selectInitHeight = this.$refs.infiniteSelect.$el.offsetHeight
|
|
238
|
+
this.scrollList = this.scrollWrap.querySelector('.el-select-dropdown__list')
|
|
239
|
+
|
|
240
|
+
this.wrapPaddingTop = getStyle(this.scrollList, 'paddingTop')
|
|
241
|
+
this.wrapPaddingTop = parseFloat(this.wrapPaddingTop.split('px')[0] || 0)
|
|
242
|
+
on(this.scrollWrap, 'scroll', this.scrollHandler)
|
|
243
|
+
}
|
|
244
|
+
this.scrollLast = debounce(this.debounce, () => {
|
|
245
|
+
this.$emit('scrollBottom', true)
|
|
246
|
+
this.isLoading = false
|
|
247
|
+
})
|
|
248
|
+
this.resetTagTitle()
|
|
249
|
+
},
|
|
250
|
+
created() {
|
|
251
|
+
if (this.multiple && !Array.isArray(this.value)) {
|
|
252
|
+
this.$emit('input', [])
|
|
253
|
+
}
|
|
254
|
+
if (!this.multiple && Array.isArray(this.value)) {
|
|
255
|
+
this.$emit('input', '')
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
methods: {
|
|
260
|
+
resetTagTitle() {
|
|
261
|
+
this.$nextTick(() => {
|
|
262
|
+
if (this.multiple) {
|
|
263
|
+
const tagList = this.$refs.infiniteSelect.$refs.tags.querySelectorAll(
|
|
264
|
+
'.el-select__tags-text'
|
|
265
|
+
)
|
|
266
|
+
tagList.forEach((v) => {
|
|
267
|
+
if (v.nextSibling) {
|
|
268
|
+
v.title = v.innerHTML
|
|
269
|
+
}
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
},
|
|
274
|
+
filterMethodHandler() {
|
|
275
|
+
return this.filterMethod
|
|
276
|
+
},
|
|
277
|
+
resetRenderList() {
|
|
278
|
+
this.renderList = this.data
|
|
279
|
+
},
|
|
280
|
+
focus() {
|
|
281
|
+
this.$refs.infiniteSelect.focus()
|
|
282
|
+
},
|
|
283
|
+
blur() {
|
|
284
|
+
this.$refs.infiniteSelect.blur()
|
|
285
|
+
},
|
|
286
|
+
visibleChangeHandler(val) {
|
|
287
|
+
// if (this.domLimit) {
|
|
288
|
+
// if (val) {
|
|
289
|
+
// this.cacheList = [...this.data]
|
|
290
|
+
// this.resetRenderList()
|
|
291
|
+
// }
|
|
292
|
+
// }
|
|
293
|
+
|
|
294
|
+
this.$emit('visible-change', val)
|
|
295
|
+
},
|
|
296
|
+
scrollHandler(e) {
|
|
297
|
+
let lastItemTop
|
|
298
|
+
if (!this.scrollHeight) {
|
|
299
|
+
this.scrollHeight = this.scrollWrap.getBoundingClientRect().height
|
|
300
|
+
this.scrollTop = this.scrollWrap.getBoundingClientRect().top
|
|
301
|
+
this.itemHeight = this.scrollList
|
|
302
|
+
.querySelector('.el-select-dropdown__item')
|
|
303
|
+
.getBoundingClientRect().height
|
|
304
|
+
}
|
|
305
|
+
if (this.isLoading) {
|
|
306
|
+
return
|
|
307
|
+
} else {
|
|
308
|
+
let length = this.scrollWrap.querySelectorAll('.el-select-dropdown__item').length
|
|
309
|
+
lastItemTop = this.scrollWrap
|
|
310
|
+
.querySelectorAll('.el-select-dropdown__item')
|
|
311
|
+
[length - 1].getBoundingClientRect()
|
|
312
|
+
let multiOffsetHeight = this.selectInput.offsetHeight - this.selectInitHeight
|
|
313
|
+
lastItemTop = lastItemTop.top - this.scrollTop - multiOffsetHeight
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (lastItemTop <= this.scrollHeight) {
|
|
317
|
+
this.isLoading = true
|
|
318
|
+
if (this.remote) {
|
|
319
|
+
this.scrollLast()
|
|
320
|
+
// } else {
|
|
321
|
+
// this.appendNewItems(
|
|
322
|
+
// this.scrollList.getBoundingClientRect().height,
|
|
323
|
+
// getScroll(this.scrollWrap, true)
|
|
324
|
+
// )
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
updateCacheOptions() {
|
|
332
|
+
// this.$refs.infiniteSelect.setSelected()
|
|
333
|
+
// console.log(this.$refs.infiniteSelect.selected)
|
|
334
|
+
// let selected = this.$refs.infiniteSelect.selected
|
|
335
|
+
// this.$refs.infiniteSelect.cachedOptions.push(...selected)
|
|
336
|
+
// this.cacheList = this
|
|
337
|
+
// console.log(this.$refs.infiniteSelect.setSelected())
|
|
338
|
+
// console.log(this.$refs.infiniteSelect.cachedOptions)
|
|
339
|
+
// this.$refs.infiniteSelect.cachedOptions = this.cacheList.map((r) => {
|
|
340
|
+
// return {
|
|
341
|
+
// label: r[this.mapLabel],
|
|
342
|
+
// value: r[this.mapValue],
|
|
343
|
+
// currentLabel: r[this.mapLabel],
|
|
344
|
+
// currentValue: r[this.mapValue]
|
|
345
|
+
// }
|
|
346
|
+
// })
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-option class="yks-option" v-bind="$props" :title="mapTitle" v-on="$listeners">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</el-option>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
/**
|
|
9
|
+
* 新增属性参数 el-option 扩展参数
|
|
10
|
+
|
|
11
|
+
*/
|
|
12
|
+
import ElOption from 'element-ui/lib/option'
|
|
13
|
+
export default {
|
|
14
|
+
name: 'YksOption',
|
|
15
|
+
components: {
|
|
16
|
+
ElOption
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
...ElOption.props
|
|
20
|
+
},
|
|
21
|
+
computed: {
|
|
22
|
+
mapTitle() {
|
|
23
|
+
return this.label || this.value
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style></style>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table
|
|
3
|
+
ref="table"
|
|
4
|
+
class="ks-table"
|
|
5
|
+
:data="tableData"
|
|
6
|
+
v-bind="tableOptions"
|
|
7
|
+
v-on="$listeners"
|
|
8
|
+
>
|
|
9
|
+
<slot v-if="!dom"></slot>
|
|
10
|
+
<template v-if="dom">
|
|
11
|
+
<template v-for="(col, index) in tableColumns">
|
|
12
|
+
<!-- 定义 index、selection 类型的列-->
|
|
13
|
+
<el-table-column
|
|
14
|
+
v-if="col.type === 'index' || col.type === 'selection'"
|
|
15
|
+
:key="index"
|
|
16
|
+
v-bind="col"
|
|
17
|
+
class-name="xdh-table--not-drag"
|
|
18
|
+
></el-table-column>
|
|
19
|
+
|
|
20
|
+
<!-- 定义 expand 类型的列-->
|
|
21
|
+
<el-table-column v-else-if="col.type === 'expand'" :key="index" v-bind="col">
|
|
22
|
+
<template v-slot="scope">
|
|
23
|
+
<div class="expand-table">
|
|
24
|
+
<slot
|
|
25
|
+
name="expand"
|
|
26
|
+
:row="scope.row"
|
|
27
|
+
:scope="scope"
|
|
28
|
+
:$index="scope.$index"
|
|
29
|
+
:column="tableColumns[index]"
|
|
30
|
+
:columnIndex="index"
|
|
31
|
+
></slot>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
|
|
36
|
+
<!-- 定义通用类型的列-->
|
|
37
|
+
<el-table-column v-else :key="index" v-bind="col">
|
|
38
|
+
<!-- prettier-ignore-attribute (slot-scope) -->
|
|
39
|
+
<template v-if="!col.type" v-slot="scope">
|
|
40
|
+
<slot
|
|
41
|
+
:name="col.prop || 'default'"
|
|
42
|
+
:row="scope.row"
|
|
43
|
+
:$index="scope.$index"
|
|
44
|
+
:column="tableColumns[index]"
|
|
45
|
+
:columnIndex="index"
|
|
46
|
+
>
|
|
47
|
+
{{ scope.row[col.prop] }}
|
|
48
|
+
</slot>
|
|
49
|
+
</template>
|
|
50
|
+
<template v-slot:header="scope">
|
|
51
|
+
<slot
|
|
52
|
+
:name="'header' + (col.prop || '')"
|
|
53
|
+
:column="scope.column"
|
|
54
|
+
:$index="scope.$index"
|
|
55
|
+
>
|
|
56
|
+
{{ scope.column['label'] }}
|
|
57
|
+
</slot>
|
|
58
|
+
</template>
|
|
59
|
+
</el-table-column>
|
|
60
|
+
</template>
|
|
61
|
+
</template>
|
|
62
|
+
|
|
63
|
+
<!--暴露 el-table append 插槽-->
|
|
64
|
+
<slot slot="append" name="append"></slot>
|
|
65
|
+
|
|
66
|
+
<!--暴露 el-table empty 插槽-->
|
|
67
|
+
<slot slot="empty" name="empty">
|
|
68
|
+
<el-empty class="table-empty" :image-size="60" :description="' '"></el-empty>
|
|
69
|
+
</slot>
|
|
70
|
+
</el-table>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import ElTable from 'element-ui/lib/table'
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Table 表格组件
|
|
78
|
+
* @module yks-table
|
|
79
|
+
*/
|
|
80
|
+
export default {
|
|
81
|
+
name: 'YksTable',
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 属性参数,完全继承 el-table参数,并有以下扩展参数
|
|
85
|
+
* @property {Array} [data = []] 表格行数据
|
|
86
|
+
* @property {Array} [columns = []] 表格列定义,对象属性参数完全继承 el-table-column
|
|
87
|
+
* @property {Boolean} [dom = true] 自定义列
|
|
88
|
+
*/
|
|
89
|
+
props: {
|
|
90
|
+
...ElTable.props,
|
|
91
|
+
columns: {
|
|
92
|
+
type: Array,
|
|
93
|
+
default() {
|
|
94
|
+
return []
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
dom: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
101
|
+
emptyMsg: {
|
|
102
|
+
type: String,
|
|
103
|
+
default: '暂无数据~'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
// 表格列定义数组
|
|
110
|
+
tableColumns: this.columns,
|
|
111
|
+
|
|
112
|
+
// 表格行数据
|
|
113
|
+
tableData: this.data
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
computed: {
|
|
117
|
+
// el-table 参数
|
|
118
|
+
tableOptions() {
|
|
119
|
+
const options = { ...this.$props }
|
|
120
|
+
delete options.columns
|
|
121
|
+
delete options.data
|
|
122
|
+
delete Option.dom
|
|
123
|
+
delete Option.showMessage
|
|
124
|
+
return options
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
data(val) {
|
|
129
|
+
this.tableData = val
|
|
130
|
+
},
|
|
131
|
+
columns(val) {
|
|
132
|
+
this.tableColumns = val
|
|
133
|
+
const data = this.tableData
|
|
134
|
+
this.tableData = []
|
|
135
|
+
this.$nextTick(() => {
|
|
136
|
+
this.tableData = data
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Import plugins that you want to use
|
|
2
|
+
// Detail plugins list see: https://www.tinymce.com/docs/plugins/
|
|
3
|
+
// Custom builds see: https://www.tinymce.com/download/custom-builds/
|
|
4
|
+
export const plugins = [
|
|
5
|
+
'advlist anchor autolink autosave code codesample directionality emoticons fullscreen hr image imagetools insertdatetime link lists nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textpattern visualblocks visualchars wordcount'
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
// Here is the list of toolbar control components
|
|
9
|
+
// Details see: https://www.tinymce.com/docs/advanced/editor-control-identifiers/#toolbarcontrols
|
|
10
|
+
export const toolbar = [
|
|
11
|
+
'bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample',
|
|
12
|
+
'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen paste'
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
export const uploadAudio =
|
|
16
|
+
'<svg t="1648778606755" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2398" width="20" height="18"><path d="M204.8 0h477.866667l273.066666 273.066667v614.4c0 75.093333-61.44 136.533333-136.533333 136.533333H204.8c-75.093333 0-136.533333-61.44-136.533333-136.533333V136.533333C68.266667 61.44 129.706667 0 204.8 0z m464.213333 375.466667l-232.106666 61.44c-27.306667 13.653333-47.786667 34.133333-47.786667 61.44v218.453333s-20.48-13.653333-54.613333-6.826667c-47.786667 6.826667-95.573333 47.786667-95.573334 88.746667 0 40.96 47.786667 61.44 95.573334 54.613333 54.613333-6.826667 95.573333-40.96 95.573333-81.92V559.786667c0-13.653333 27.306667-27.306667 27.306667-27.306667L655.36 477.866667s20.48-6.826667 20.48 13.653333v170.666667s-20.48-13.653333-54.613333-6.826667c-54.613333 6.826667-95.573333 40.96-95.573334 81.92s47.786667 68.266667 95.573334 61.44 95.573333-40.96 95.573333-81.92V409.6c0-27.306667-27.306667-40.96-47.786667-34.133333z" fill="#222f3e" p-id="2399"></path><path d="M682.666667 0l273.066666 273.066667h-204.8c-40.96 0-68.266667-27.306667-68.266666-68.266667V0z" fill="#222f3e" opacity=".619" p-id="2400"></path></svg>'
|
|
17
|
+
|
|
18
|
+
export const uploadVideo =
|
|
19
|
+
'<svg t="1648778822578" class="icon" viewBox="0 0 1087 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3355" width="20" height="20"><path d="M768 415.744q0 5.12-10.752 17.92t-23.04 30.208-23.04 37.888-10.752 41.984 10.752 41.472 23.04 36.352 23.04 27.136 10.752 13.824l0 107.52q0 17.408-12.8 39.424t-31.744 41.472-41.984 32.256-43.52 12.8l-508.928 0q-27.648 0-50.688-9.728t-40.448-27.136-27.136-40.96-9.728-51.2l0-441.344q0-20.48 9.216-42.496t26.112-40.448 39.936-30.72 50.688-12.288l508.928 0q27.648 0 51.712 9.728t41.984 26.624 28.16 40.448 10.24 50.176l0 89.088zM1086.464 319.488l0 467.968q0 22.528-11.776 39.936t-35.328 17.408q-8.192 0-20.992-6.144t-25.6-14.336-24.064-16.384-16.384-13.312q-13.312-11.264-40.448-38.912t-54.784-62.464-48.64-71.68-20.992-67.584 22.528-70.144 54.272-77.312 66.56-70.144 58.368-48.64q9.216-6.144 25.088-14.848t28.16-8.704q27.648 0 35.84 15.36t8.192 37.888l0 2.048z" p-id="3356" fill="#222f3e"></path></svg>'
|
|
20
|
+
|
|
21
|
+
export const uploadFile =
|
|
22
|
+
'<svg t="1648778907477" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4315" width="24" height="24"><path d="M736.005 696.494H174.18c-17.673 0-32-14.327-32-32V255.582c0-17.673 14.327-32 32-32h157.213c7.96 0 15.635 2.967 21.525 8.321l47.547 43.222h335.54c17.673 0 32 14.327 32 32v357.369c0 17.673-14.327 32-32 32z m-529.825-64h497.825V339.125H388.094a32.002 32.002 0 0 1-21.525-8.321l-47.547-43.222H206.18v344.912z" fill="#222f3e" p-id="4316"></path><path d="M853.18 821.092H317.509c-17.673 0-32-14.327-32-32s14.327-32 32-32H821.18V414.206c0-17.673 14.327-32 32-32s32 14.327 32 32v374.886c0 17.673-14.327 32-32 32z" fill="#222f3e" p-id="4317"></path></svg>'
|
|
23
|
+
|
|
24
|
+
export const uploadRecording =
|
|
25
|
+
'<svg t="1648782146375" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5288" width="20" height="20"><path d="M512 683.52c130.56 0 235.52-102.4 235.52-232.96V256c0-130.56-104.96-232.96-235.52-232.96s-235.52 102.4-235.52 232.96v194.56c0 130.56 102.4 232.96 235.52 232.96z m368.64-281.6c0-23.04-20.48-43.52-46.08-43.52s-43.52 20.48-43.52 43.52c0 5.12 0 10.24 2.56 12.8v33.28c0 151.04-125.44 276.48-281.6 276.48-153.6 0-281.6-125.44-281.6-276.48V409.6c0-2.56 2.56-5.12 2.56-10.24 0-23.04-20.48-43.52-43.52-43.52-25.6 0-43.52 20.48-43.52 43.52v64c0 186.88 140.8 335.36 320 360.96v87.04h-122.88c-25.6 0-46.08 20.48-46.08 46.08s20.48 43.52 46.08 43.52h332.8c28.16 0 43.52-17.92 43.52-43.52 0-23.04-17.92-46.08-43.52-46.08h-122.88v-87.04c184.32-20.48 327.68-174.08 327.68-360.96v-61.44z m0 0" fill="#222f3e" p-id="5289"></path></svg>'
|