br-dionysus 1.8.7 → 1.10.0
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/README.md +158 -226
- package/attributes.json +1 -1
- package/dist/br-dionysus.es.js +5470 -5183
- package/dist/br-dionysus.umd.js +8 -8
- package/dist/index.css +1 -1
- package/dist/packages/Hook/useFormInline/useFormInline.d.ts +1 -1
- package/dist/packages/Hook/usePackageConfig/usePackageConfig.d.ts +1 -1
- package/dist/packages/MInline/src/MInline.vue.d.ts +15 -1
- package/dist/packages/MTable/src/token.d.ts +1 -1
- package/dist/packages/MTableColumnSet/src/MTableColumnSet.vue.d.ts +1 -1
- package/dist/packages/MTableSuper/src/token.d.ts +1 -1
- package/dist/packages/SkinConfig/src/useSkin.d.ts +14 -1
- package/dist/packages/index.d.ts +2 -0
- package/package.json +1 -1
- package/packages/Hook/useFormInline/useFormInline.ts +16 -6
- package/packages/Hook/usePackageConfig/demo.vue +1 -1
- package/packages/Hook/usePackageConfig/usePackageConfig.ts +3 -7
- package/packages/Hook/useRemainingSpace/demo.vue +1 -1
- package/packages/Hook/useTableConfig/demo.vue +1 -1
- package/packages/Hook/useTableV2Config/demo.vue +1 -1
- package/packages/MDialog/docs/demo.vue +2 -2
- package/packages/MInline/docs/README.md +7 -6
- package/packages/MInline/docs/demo.vue +43 -88
- package/packages/MInline/src/MInline.vue +283 -10
- package/packages/MSelect/src/MOption.vue +1 -1
- package/packages/MSelect/src/MSelect.vue +1 -1
- package/packages/MSelectTable/docs/demo.vue +1 -1
- package/packages/MTable/docs/demo.vue +2 -2
- package/packages/MTable/src/token.ts +1 -1
- package/packages/MTableColumnSet/src/MTableColumnSet.vue +1 -1
- package/packages/MTableSuper/docs/demo.vue +2 -2
- package/packages/MTableSuper/src/MTableSuper.vue +2 -2
- package/packages/MTableSuper/src/token.ts +1 -1
- package/packages/MTableV2/docs/demo.vue +1 -1
- package/packages/MTableV2/src/MTableV2.vue +1 -1
- package/packages/SkinConfig/docs/README.md +17 -10
- package/packages/SkinConfig/docs/demo.vue +4 -1
- package/packages/SkinConfig/src/SkinConfig.vue +78 -5
- package/packages/SkinConfig/src/useSkin.ts +63 -24
- package/packages/Tool/slotsToData/slotsToData.ts +2 -0
- package/packages/index.ts +23 -21
- package/src/App.vue +4 -2
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
class="g-inline-box"
|
|
4
|
+
:class="elGlobalClassName"
|
|
5
|
+
>
|
|
3
6
|
<div
|
|
4
7
|
v-if="slots.inlineBtn"
|
|
5
8
|
v-show="showInlineBtnBox"
|
|
@@ -13,6 +16,7 @@
|
|
|
13
16
|
v-if="slots.default"
|
|
14
17
|
class="m-inline"
|
|
15
18
|
:data-show-inline-btn="showInlineBtnBox"
|
|
19
|
+
:data-is-config-mode="isConfigMode"
|
|
16
20
|
dataCover
|
|
17
21
|
>
|
|
18
22
|
<div
|
|
@@ -26,30 +30,68 @@
|
|
|
26
30
|
>
|
|
27
31
|
<slot name="default"></slot>
|
|
28
32
|
</div>
|
|
33
|
+
<el-checkbox-group
|
|
34
|
+
class="u-check-box-group"
|
|
35
|
+
v-model="checkList"
|
|
36
|
+
@change="checkboxChange"
|
|
37
|
+
>
|
|
38
|
+
<el-checkbox
|
|
39
|
+
v-for="key in configKeyList"
|
|
40
|
+
:key="key"
|
|
41
|
+
:label="key"
|
|
42
|
+
:value="key"
|
|
43
|
+
data-class="checkbox"
|
|
44
|
+
:data-key="key"
|
|
45
|
+
>
|
|
46
|
+
<p></p>
|
|
47
|
+
</el-checkbox>
|
|
48
|
+
</el-checkbox-group>
|
|
29
49
|
<div
|
|
30
50
|
class="u-btn-gp"
|
|
31
51
|
:style="{
|
|
32
52
|
height: height + 'px'
|
|
33
53
|
}"
|
|
34
54
|
>
|
|
35
|
-
<slot
|
|
55
|
+
<slot
|
|
56
|
+
v-if="!isConfigMode"
|
|
57
|
+
name="submitBtn"
|
|
58
|
+
></slot>
|
|
59
|
+
<el-button
|
|
60
|
+
v-if="isConfigMode"
|
|
61
|
+
type="primary"
|
|
62
|
+
icon="FolderChecked"
|
|
63
|
+
:size="props.size"
|
|
64
|
+
@click="saveConfig"
|
|
65
|
+
>
|
|
66
|
+
保存
|
|
67
|
+
</el-button>
|
|
36
68
|
<el-icon
|
|
37
|
-
v-if="showUnfoldBtn"
|
|
69
|
+
v-if="showUnfoldBtn && !isConfigMode"
|
|
38
70
|
class="u-btn-unfold"
|
|
39
|
-
@click="switchUnfold"
|
|
71
|
+
@click="switchUnfold()"
|
|
40
72
|
:data-unfold="unfold"
|
|
41
73
|
>
|
|
42
74
|
<DArrowRight />
|
|
43
75
|
</el-icon>
|
|
76
|
+
<el-icon
|
|
77
|
+
v-if="props.configKey"
|
|
78
|
+
class="u-btn-unfold"
|
|
79
|
+
@click="switchConfigMode()"
|
|
80
|
+
>
|
|
81
|
+
<Setting />
|
|
82
|
+
</el-icon>
|
|
44
83
|
</div>
|
|
45
84
|
</div>
|
|
46
85
|
</div>
|
|
47
86
|
</template>
|
|
48
87
|
|
|
49
88
|
<script setup lang="ts">
|
|
50
|
-
import { ref, onMounted, useSlots, watch, computed } from 'vue'
|
|
51
|
-
import { Size } from '
|
|
89
|
+
import { ref, onMounted, useSlots, watch, computed, nextTick } from 'vue'
|
|
90
|
+
import { Size } from './../../typings/enum'
|
|
52
91
|
import createHash from '../../Tool/createHash/createHash'
|
|
92
|
+
import slotsToData, { SlotsToDataReturnItem } from './../../Tool/slotsToData/slotsToData'
|
|
93
|
+
import { FormInlineConfigType } from './../../Hook/useFormInline/useFormInline'
|
|
94
|
+
import usePackageConfig from './../../Hook/usePackageConfig/usePackageConfig'
|
|
53
95
|
|
|
54
96
|
const props = withDefaults(defineProps<{
|
|
55
97
|
/**
|
|
@@ -61,11 +103,17 @@ const props = withDefaults(defineProps<{
|
|
|
61
103
|
* */
|
|
62
104
|
maxWidth?: number,
|
|
63
105
|
/** 组件尺寸 */
|
|
64
|
-
size?: Size
|
|
106
|
+
size?: Size,
|
|
107
|
+
/** 配置key */
|
|
108
|
+
configKey?: string,
|
|
109
|
+
/** 筛选对象 */
|
|
110
|
+
model?: Record<string, any> | null
|
|
65
111
|
}>(), {
|
|
66
112
|
minWidth: 290,
|
|
67
113
|
maxWidth: 400,
|
|
68
|
-
size: Size.DEFAULT
|
|
114
|
+
size: Size.DEFAULT,
|
|
115
|
+
configKey: '',
|
|
116
|
+
model: null
|
|
69
117
|
})
|
|
70
118
|
|
|
71
119
|
const height = computed(() => {
|
|
@@ -76,6 +124,7 @@ const height = computed(() => {
|
|
|
76
124
|
})
|
|
77
125
|
|
|
78
126
|
const boxClassName = 'j-' + createHash(8)
|
|
127
|
+
const elGlobalClassName = 'j-' + createHash(8)
|
|
79
128
|
|
|
80
129
|
const init = () => {
|
|
81
130
|
const boxEl: HTMLElement | null = document.querySelector('.' + boxClassName + ' [data-box]')
|
|
@@ -121,8 +170,8 @@ onMounted(() => {
|
|
|
121
170
|
|
|
122
171
|
const unfold = ref<boolean>(false)
|
|
123
172
|
|
|
124
|
-
const switchUnfold = () => {
|
|
125
|
-
unfold.value =
|
|
173
|
+
const switchUnfold = (status = !unfold.value) => {
|
|
174
|
+
unfold.value = status
|
|
126
175
|
emit('switch', unfold.value)
|
|
127
176
|
}
|
|
128
177
|
|
|
@@ -159,6 +208,194 @@ onMounted(() => {
|
|
|
159
208
|
subtree: true // 后代
|
|
160
209
|
})
|
|
161
210
|
})
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 以下为配置化
|
|
214
|
+
* */
|
|
215
|
+
const configKey = computed(() => 'formInline' + props.configKey)
|
|
216
|
+
const isConfigMode = ref<boolean>(false)
|
|
217
|
+
/**
|
|
218
|
+
* 切换配置模式
|
|
219
|
+
* */
|
|
220
|
+
const switchConfigMode = (status: boolean = !isConfigMode.value) => {
|
|
221
|
+
isConfigMode.value = status
|
|
222
|
+
|
|
223
|
+
if (isConfigMode.value) syncLocalDataToConfig()
|
|
224
|
+
// if (!isConfigMode.value) syncLocalDataToConfig()
|
|
225
|
+
markAttribute(config.value)
|
|
226
|
+
setDomDraggableEvent(config.value)
|
|
227
|
+
if (!isConfigMode.value) return removeDomDraggableEvent()
|
|
228
|
+
|
|
229
|
+
switchUnfold(true)
|
|
230
|
+
}
|
|
231
|
+
nextTick(() => {
|
|
232
|
+
if (!props.configKey) return
|
|
233
|
+
markAttribute(config.value)
|
|
234
|
+
setDomDraggableEvent(config.value)
|
|
235
|
+
removeDomDraggableEvent()
|
|
236
|
+
generateCheckBox()
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
type ConfigType = FormInlineConfigType<Record<string, any>>
|
|
240
|
+
|
|
241
|
+
const packageConfig = usePackageConfig()
|
|
242
|
+
const config = ref<ConfigType>({})
|
|
243
|
+
const checkList = ref<string[]>([])
|
|
244
|
+
checkList.value = Object.keys(config.value).filter(key => config.value[key as keyof typeof config.value].show)
|
|
245
|
+
/**
|
|
246
|
+
* 同步本地配置数据到缓存(生效)
|
|
247
|
+
* */
|
|
248
|
+
const syncLocalDataToConfig = () => {
|
|
249
|
+
if (!props.configKey) return
|
|
250
|
+
const slotDefaultData = slotsToData(slots)
|
|
251
|
+
const formItemList = slotDefaultData[0].children
|
|
252
|
+
const keyList = formItemList.map(item => item?.props?.prop).sort(item => item)
|
|
253
|
+
const cacheConfig = packageConfig.get<ConfigType>(configKey.value)
|
|
254
|
+
let count = Object.keys(cacheConfig).length
|
|
255
|
+
for (const key in props.model) {
|
|
256
|
+
if (key === 'reset' || !keyList.includes(key)) continue
|
|
257
|
+
config.value[key] = {
|
|
258
|
+
sort: cacheConfig[key] !== undefined ? cacheConfig[key].sort : count++,
|
|
259
|
+
defaultValue: cacheConfig[key] !== undefined ? cacheConfig[key].defaultValue : props.model[key],
|
|
260
|
+
show: cacheConfig[key] !== undefined ? cacheConfig[key].show : true
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
checkList.value = Object.keys(config.value).filter(key => config.value[key as keyof typeof config.value].show)
|
|
264
|
+
}
|
|
265
|
+
syncLocalDataToConfig()
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* 标记dom的属性
|
|
269
|
+
* */
|
|
270
|
+
const markAttribute = (configData: ConfigType) => {
|
|
271
|
+
const slotDefaultData = slotsToData(slots)
|
|
272
|
+
const formItemList = slotDefaultData[0].children
|
|
273
|
+
const domNodeList: NodeList = document.querySelectorAll(`.${boxClassName} [data-box] [data-item]`)
|
|
274
|
+
const domList: HTMLElement[] = Array.from(domNodeList) as HTMLElement[]
|
|
275
|
+
const itemDomIndexToPropMap: Record<number, string> = {}
|
|
276
|
+
domList.forEach((e, idx) => {
|
|
277
|
+
itemDomIndexToPropMap[idx] = (formItemList[idx] as SlotsToDataReturnItem).props?.prop
|
|
278
|
+
})
|
|
279
|
+
domList.forEach((item, idx) => {
|
|
280
|
+
const key = item.getAttribute('data-key') || itemDomIndexToPropMap[idx] as keyof typeof configData
|
|
281
|
+
const itemConfig = configData[key] || {}
|
|
282
|
+
item.setAttribute('data-sort', String(itemConfig.sort))
|
|
283
|
+
// const a = item.querySelector('p')
|
|
284
|
+
// if (a) a.innerText = itemConfig.sort
|
|
285
|
+
item.setAttribute('data-key', key)
|
|
286
|
+
item.setAttribute('data-show', String(itemConfig.show))
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const configKeyList: string[] = Object.keys(config.value)
|
|
291
|
+
const checkboxChange = () => {
|
|
292
|
+
for (const key in config.value) {
|
|
293
|
+
config.value[key as keyof typeof config.value].show = checkList.value.includes(key)
|
|
294
|
+
}
|
|
295
|
+
markAttribute(config.value)
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 生成复选框
|
|
299
|
+
* */
|
|
300
|
+
const generateCheckBox = () => {
|
|
301
|
+
const domNodeList: NodeList = document.querySelectorAll(`.${boxClassName} [data-box] [data-item]`)
|
|
302
|
+
const domList: HTMLElement[] = Array.from(domNodeList) as HTMLElement[]
|
|
303
|
+
domList.forEach(dom => {
|
|
304
|
+
const key = dom.getAttribute('data-key')
|
|
305
|
+
const checkDom = document.querySelector(`.${elGlobalClassName} [data-class='checkbox'][data-key='${key}']`)
|
|
306
|
+
if (!checkDom) return
|
|
307
|
+
dom.appendChild(checkDom)
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const dragKey = ref<string>('')
|
|
312
|
+
const dragstart = (keyName: string = '') => {
|
|
313
|
+
dragKey.value = keyName
|
|
314
|
+
}
|
|
315
|
+
const drop = (index: number, configData: ConfigType) => {
|
|
316
|
+
const keySort = Object.keys(configData)
|
|
317
|
+
.sort((a, b) => configData[a as keyof typeof configData].sort - configData[b as keyof typeof configData].sort)
|
|
318
|
+
|
|
319
|
+
keySort.splice(keySort.indexOf(dragKey.value), 1)
|
|
320
|
+
keySort.splice(index, 0, dragKey.value)
|
|
321
|
+
|
|
322
|
+
for (const key in configData) {
|
|
323
|
+
const _key = key as keyof typeof configData
|
|
324
|
+
config.value[_key].sort = keySort.indexOf(key)
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
markAttribute(config.value)
|
|
328
|
+
setDomDraggableEvent(config.value)
|
|
329
|
+
const dom = document.querySelector(`.${boxClassName} [data-switch="true"]`)
|
|
330
|
+
if (!dom) return
|
|
331
|
+
dom.setAttribute('data-switch', 'false')
|
|
332
|
+
dragenterIndex.value = null
|
|
333
|
+
}
|
|
334
|
+
const dragover = (event: Event) => event.preventDefault()
|
|
335
|
+
const dragenterIndex = ref<number | null>(null)
|
|
336
|
+
const ondragenter = (index: number) => {
|
|
337
|
+
dragenterIndex.value = index
|
|
338
|
+
const domNodeList: NodeList = document.querySelectorAll(`.${boxClassName} [data-box] [data-item]`)
|
|
339
|
+
const domList: HTMLElement[] = Array.from(domNodeList) as HTMLElement[]
|
|
340
|
+
domList.forEach(dom => {
|
|
341
|
+
const sort = Number(dom.getAttribute('data-sort'))
|
|
342
|
+
dom.setAttribute('data-switch', String(sort === dragenterIndex.value))
|
|
343
|
+
})
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* 设置元素的拖拽事件与顺序
|
|
347
|
+
* */
|
|
348
|
+
const setDomDraggableEvent = (config: ConfigType) => {
|
|
349
|
+
const formDom: HTMLDivElement | null = document.querySelector(`.${boxClassName} [data-box]`)
|
|
350
|
+
if (!formDom) return
|
|
351
|
+
formDom.ondragover = dragover
|
|
352
|
+
|
|
353
|
+
const domList: HTMLElement[] = Array.from(formDom.childNodes)
|
|
354
|
+
.filter(dom => dom.nodeType !== Node.TEXT_NODE && dom.nodeType !== Node.COMMENT_NODE) as HTMLElement[]
|
|
355
|
+
|
|
356
|
+
const newDomList = domList.sort((a, b) => {
|
|
357
|
+
const aKey = a.getAttribute('data-key') as keyof typeof config
|
|
358
|
+
const bKey = b.getAttribute('data-key') as keyof typeof config
|
|
359
|
+
return (config[aKey]?.sort || 0) - (config[bKey]?.sort || 0)
|
|
360
|
+
})
|
|
361
|
+
newDomList.forEach(dom => {
|
|
362
|
+
formDom.appendChild(dom)
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
for (let i = 0; i < domList.length; i++) {
|
|
366
|
+
const dom = domList[i]
|
|
367
|
+
|
|
368
|
+
dom.draggable = true
|
|
369
|
+
dom.ondrop = () => drop(i, config)
|
|
370
|
+
dom.ondragstart = () => dragstart(dom.getAttribute('data-key') as string)
|
|
371
|
+
dom.ondragenter = () => ondragenter(i)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* 清除元素的拖拽事件
|
|
377
|
+
* */
|
|
378
|
+
const removeDomDraggableEvent = () => {
|
|
379
|
+
const formDom: HTMLDivElement | null = document.querySelector(`.${boxClassName} [data-box]`)
|
|
380
|
+
if (!formDom) return
|
|
381
|
+
|
|
382
|
+
const domList: HTMLElement[] = Array.from(formDom.childNodes)
|
|
383
|
+
.filter(dom => dom.nodeType !== Node.TEXT_NODE) as HTMLElement[]
|
|
384
|
+
|
|
385
|
+
for (let i = 0; i < domList.length; i++) {
|
|
386
|
+
const dom = domList[i]
|
|
387
|
+
|
|
388
|
+
dom.draggable = false
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const saveConfig = () => {
|
|
393
|
+
for (const key in config.value) {
|
|
394
|
+
config.value[key].defaultValue = (props.model || {})[key] === undefined ? config.value[key].defaultValue : (props.model || {})[key]
|
|
395
|
+
}
|
|
396
|
+
packageConfig.set(configKey.value, config.value)
|
|
397
|
+
switchConfigMode(false)
|
|
398
|
+
}
|
|
162
399
|
</script>
|
|
163
400
|
|
|
164
401
|
<style scoped lang="scss">
|
|
@@ -194,6 +431,15 @@ onMounted(() => {
|
|
|
194
431
|
}
|
|
195
432
|
}
|
|
196
433
|
|
|
434
|
+
.m-inline-btn + .m-inline[data-is-config-mode="false"] {
|
|
435
|
+
//[data-show="false"] {
|
|
436
|
+
// display: none;
|
|
437
|
+
//}
|
|
438
|
+
[data-class="checkbox"] {
|
|
439
|
+
display: none;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
197
443
|
.u-btn-gp {
|
|
198
444
|
display: flex;
|
|
199
445
|
padding-bottom: 10px;
|
|
@@ -203,6 +449,12 @@ onMounted(() => {
|
|
|
203
449
|
box-sizing: border-box;
|
|
204
450
|
}
|
|
205
451
|
|
|
452
|
+
.u-check-box-group {
|
|
453
|
+
//display: flex;
|
|
454
|
+
display: none;
|
|
455
|
+
flex: 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
206
458
|
.u-row {
|
|
207
459
|
display: flex;
|
|
208
460
|
overflow: hidden;
|
|
@@ -212,6 +464,10 @@ onMounted(() => {
|
|
|
212
464
|
&[data-unfold="true"] {
|
|
213
465
|
max-height: none !important;
|
|
214
466
|
}
|
|
467
|
+
|
|
468
|
+
> [data-class="checkbox"] {
|
|
469
|
+
display: none;
|
|
470
|
+
}
|
|
215
471
|
}
|
|
216
472
|
|
|
217
473
|
.u-btn-unfold {
|
|
@@ -228,6 +484,11 @@ onMounted(() => {
|
|
|
228
484
|
transform: rotate(270deg);
|
|
229
485
|
}
|
|
230
486
|
}
|
|
487
|
+
|
|
488
|
+
[data-class="checkbox"] {
|
|
489
|
+
padding-left: 5px;
|
|
490
|
+
height: auto;
|
|
491
|
+
}
|
|
231
492
|
</style>
|
|
232
493
|
|
|
233
494
|
<style lang="scss">
|
|
@@ -271,5 +532,17 @@ onMounted(() => {
|
|
|
271
532
|
}
|
|
272
533
|
}
|
|
273
534
|
}
|
|
535
|
+
|
|
536
|
+
.m-inline-btn + .m-inline[data-is-config-mode="false"] {
|
|
537
|
+
[data-show="false"] {
|
|
538
|
+
display: none;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
[data-switch="true"] {
|
|
543
|
+
//border-top: 1px solid #2a598a;
|
|
544
|
+
//border-left: 1px solid #2a598a;
|
|
545
|
+
box-shadow: inset 0 -5px 10px var(--el-color-primary-light-8);
|
|
546
|
+
}
|
|
274
547
|
}
|
|
275
548
|
</style>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
20
|
import { provide, useAttrs, ref, watch } from 'vue'
|
|
21
|
-
import { selectKey } from '
|
|
21
|
+
import { selectKey } from './../../MSelect/src/token'
|
|
22
22
|
|
|
23
23
|
const props = withDefaults(defineProps<{
|
|
24
24
|
/** 是否为checkbox模式 */
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
|
|
93
93
|
<script setup lang="ts">
|
|
94
94
|
import { ref } from 'vue'
|
|
95
|
-
import { useTableConfig } from '
|
|
96
|
-
import { MTableColumn } from '
|
|
95
|
+
import { useTableConfig } from './../../index'
|
|
96
|
+
import { MTableColumn } from './../../MTableColumn'
|
|
97
97
|
|
|
98
98
|
const privateExpandChange = (row: any, expandedRows: any[]) => {
|
|
99
99
|
console.log('row', row)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue'
|
|
2
2
|
import type { Ref } from 'vue'
|
|
3
|
-
import { TableConfig } from '
|
|
3
|
+
import { TableConfig } from './../../Hook/useTableConfig/useTableConfig'
|
|
4
4
|
|
|
5
5
|
export const tableKey: InjectionKey<{
|
|
6
6
|
/** 表格列配置 */
|
|
@@ -93,7 +93,7 @@ import { ref, watch, computed } from 'vue'
|
|
|
93
93
|
import type { Ref } from 'vue'
|
|
94
94
|
import createHash from '../../Tool/createHash/createHash'
|
|
95
95
|
import { useZIndex } from 'element-plus'
|
|
96
|
-
import type { TableConfigItem } from '
|
|
96
|
+
import type { TableConfigItem } from './../../Hook/useTableConfig/useTableConfig'
|
|
97
97
|
|
|
98
98
|
interface TableConfig {
|
|
99
99
|
[propName: string]: TableConfigItem
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
|
|
140
140
|
<script setup lang="ts">
|
|
141
141
|
import { ref } from 'vue'
|
|
142
|
-
import { useTableConfig } from '
|
|
143
|
-
import { MTableColumn } from '
|
|
142
|
+
import { useTableConfig } from './../../index'
|
|
143
|
+
import { MTableColumn } from './../../MTableColumn'
|
|
144
144
|
|
|
145
145
|
const privateExpandChange = (row: any, expandedRows: any[]) => {
|
|
146
146
|
console.log('row', row)
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
<script setup lang="ts">
|
|
25
25
|
import { useAttrs, useSlots, computed, createVNode, unref, ref } from 'vue'
|
|
26
|
-
import { MTableV2 } from '
|
|
27
|
-
import { MTable } from '
|
|
26
|
+
import { MTableV2 } from './../../MTableV2'
|
|
27
|
+
import { MTable } from './../../MTable'
|
|
28
28
|
import { ElCheckbox } from 'element-plus'
|
|
29
29
|
|
|
30
30
|
const attrs = useAttrs()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue'
|
|
2
2
|
import type { Ref } from 'vue'
|
|
3
|
-
import { TableConfig } from '
|
|
3
|
+
import { TableConfig } from './../../Hook/useTableConfig/useTableConfig'
|
|
4
4
|
|
|
5
5
|
export const tableKey: InjectionKey<{
|
|
6
6
|
/** 表格列配置 */
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<script setup lang="ts">
|
|
17
17
|
import { ref } from 'vue'
|
|
18
|
-
import useTableV2Config from '
|
|
18
|
+
import useTableV2Config from './../../Hook/useTableV2Config/useTableV2Config'
|
|
19
19
|
|
|
20
20
|
const tableData = ref<any[]>([])
|
|
21
21
|
const { tableTitle, tableConfig, filtersValue } = useTableV2Config('MTableV2Demo', [{
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
import { ref, watch, computed, useSlots } from 'vue'
|
|
41
41
|
import { TableConfig } from './../../Hook/useTableConfig/useTableConfig'
|
|
42
42
|
import MTableColumnSet from './../../MTableColumnSet/src/MTableColumnSet.vue'
|
|
43
|
-
import checkType from '
|
|
43
|
+
import checkType from './../../Tool/checkType/checkType'
|
|
44
44
|
|
|
45
45
|
interface FilterValue {
|
|
46
46
|
[key: string]: Array<string | number>
|
|
@@ -20,16 +20,23 @@ import demo from './demo.vue'
|
|
|
20
20
|
|
|
21
21
|
#### SkinConfig(皮肤对象)
|
|
22
22
|
|
|
23
|
-
| 参数
|
|
24
|
-
|
|
25
|
-
| darkTheme
|
|
26
|
-
| followSystem
|
|
27
|
-
| size
|
|
28
|
-
| primaryColor
|
|
29
|
-
| successColor
|
|
30
|
-
| warningColor
|
|
31
|
-
| dangerColor
|
|
32
|
-
| infoColor
|
|
23
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
24
|
+
|--------------------|:-------------------------------:|:-------:|:---------------------------------:|:----------:|
|
|
25
|
+
| darkTheme | 是否为深色主题 | boolean | - | false |
|
|
26
|
+
| followSystem | 是否跟随系统 | boolean | - | false |
|
|
27
|
+
| size | 大小 | enum | large \| default \| small | default |
|
|
28
|
+
| primaryColor | 主题色 | string | - | '#646CFF' |
|
|
29
|
+
| successColor | 成功色 | string | - | '#67c23a' |
|
|
30
|
+
| warningColor | 警告色 | string | - | '#e6a23c' |
|
|
31
|
+
| dangerColor | 危险色 | string | - | '#f56c6c' |
|
|
32
|
+
| infoColor | 信息色 | string | - | '#909399' |
|
|
33
|
+
| showHeavyLoad | 显示重载按钮 | boolean | - | false |
|
|
34
|
+
| showBreadcrumb | 显示面包屑导航 | boolean | - | false |
|
|
35
|
+
| showBreadcrumbIcon | 显示面包屑图标 | boolean | - | true |
|
|
36
|
+
| switchAnimation | 切换动画 | boolean | - | true |
|
|
37
|
+
| auxiliaryTools | 辅助工具(页签,面包屑,无) | string | 'multiple' \| 'breadcrumb' \| '' | 'multiple' |
|
|
38
|
+
| outsideSpacingSize | 外间距大小(--m-outside-spacing-size) | number | - | 16 |
|
|
39
|
+
| insideSpacingSize | 内间距大小(--m-inside-spacing-size) | number | - | 24 |
|
|
33
40
|
|
|
34
41
|
### 3) 说明
|
|
35
42
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@change="size = $event.size"
|
|
6
6
|
></SkinConfig>
|
|
7
7
|
|
|
8
|
+
<p>skin: {{ skin.skinConfig }}</p>
|
|
8
9
|
<div class="m-box">
|
|
9
10
|
<div class="u-color-box">
|
|
10
11
|
<h3>色卡</h3>
|
|
@@ -61,8 +62,10 @@
|
|
|
61
62
|
|
|
62
63
|
<script setup lang="ts">
|
|
63
64
|
import { ref, onMounted } from 'vue'
|
|
64
|
-
import { SkinConfig } from '
|
|
65
|
+
import { SkinConfig } from './../../SkinConfig'
|
|
66
|
+
import useSkin from './../src/useSkin'
|
|
65
67
|
|
|
68
|
+
const skin = useSkin()
|
|
66
69
|
const size = ref<string>('')
|
|
67
70
|
const shinConfigRef = ref<InstanceType<typeof SkinConfig> | null>(null)
|
|
68
71
|
onMounted(() => {
|