br-dionysus 1.8.7 → 1.9.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 +118 -206
- package/attributes.json +1 -1
- package/dist/br-dionysus.es.js +4340 -4158
- 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 +1 -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/demo.vue +1 -1
- package/packages/SkinConfig/src/SkinConfig.vue +3 -3
- package/packages/SkinConfig/src/useSkin.ts +3 -3
- 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>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
<script setup lang="ts">
|
|
63
63
|
import { ref, onMounted } from 'vue'
|
|
64
|
-
import { SkinConfig } from '
|
|
64
|
+
import { SkinConfig } from './../../SkinConfig'
|
|
65
65
|
|
|
66
66
|
const size = ref<string>('')
|
|
67
67
|
const shinConfigRef = ref<InstanceType<typeof SkinConfig> | null>(null)
|
|
@@ -240,9 +240,9 @@
|
|
|
240
240
|
<script setup lang="ts">
|
|
241
241
|
import { ref, onMounted, reactive } from 'vue'
|
|
242
242
|
import useSkin, { SkinConfig } from './useSkin'
|
|
243
|
-
import { Size } from '
|
|
244
|
-
import { Filter } from '
|
|
245
|
-
import { MInputNumber } from '
|
|
243
|
+
import { Size } from './../../typings/enum'
|
|
244
|
+
import { Filter } from './../../typings/interface'
|
|
245
|
+
import { MInputNumber } from './../../MInputNumber'
|
|
246
246
|
|
|
247
247
|
const filter: Filter = {
|
|
248
248
|
typeOptions: ref<Option[]>([{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reactive } from 'vue'
|
|
2
|
-
import { Size } from '
|
|
2
|
+
import { Size } from './../../typings/enum'
|
|
3
3
|
import compareStructures from '../../Tool/compareStructures/compareStructures'
|
|
4
|
-
import usePackageConfig from '
|
|
4
|
+
import usePackageConfig from './../../Hook/usePackageConfig/usePackageConfig'
|
|
5
5
|
|
|
6
6
|
const packageConfig = usePackageConfig()
|
|
7
7
|
|
|
@@ -105,7 +105,7 @@ const useSkin = (): {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/** 皮肤配置 */
|
|
108
|
-
const skinConfig
|
|
108
|
+
const skinConfig = reactive(packageConfig.get<SkinConfig>('skinConfig')) as SkinConfig
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* @description 设置皮肤色
|
|
@@ -22,6 +22,8 @@ const slotsToData = (slots: Slots, name: string = 'default', data: SlotsToDataRe
|
|
|
22
22
|
for (let i = 0; i < slotsData.length; i++) {
|
|
23
23
|
const item = slotsData[i]
|
|
24
24
|
|
|
25
|
+
if (!item.type || typeof item.type === 'symbol') continue // 跳过注释节点
|
|
26
|
+
|
|
25
27
|
const children = item.children
|
|
26
28
|
const isChildren = Boolean(children)
|
|
27
29
|
const _data = isChildren ? slotsToData(children) : []
|
package/packages/index.ts
CHANGED
|
@@ -3,29 +3,30 @@ import { App, Plugin } from 'vue'
|
|
|
3
3
|
import { TabPagePlugin } from './TabPage'
|
|
4
4
|
import { MInputNumberPlugin } from './MInputNumber'
|
|
5
5
|
import { MInlinePlugin } from './MInline'
|
|
6
|
-
import { SkinConfigPlugin } from '
|
|
7
|
-
import { MTablePlugin } from '
|
|
8
|
-
import { MTableColumnPlugin } from '
|
|
9
|
-
import { MTableColumnSetPlugin } from '
|
|
10
|
-
import { MSelectPlugin, MOptionPlugin } from '
|
|
11
|
-
import { MSelectV2Plugin } from '
|
|
12
|
-
import { MSelectTablePlugin } from '
|
|
13
|
-
import { MDialogPlugin } from '
|
|
14
|
-
import { MSelectTableV1Plugin } from '
|
|
15
|
-
import { MTableV2Plugin } from '
|
|
16
|
-
import { MTableSuperPlugin } from '
|
|
6
|
+
import { SkinConfigPlugin } from './SkinConfig'
|
|
7
|
+
import { MTablePlugin } from './MTable'
|
|
8
|
+
import { MTableColumnPlugin } from './MTableColumn'
|
|
9
|
+
import { MTableColumnSetPlugin } from './MTableColumnSet'
|
|
10
|
+
import { MSelectPlugin, MOptionPlugin } from './MSelect'
|
|
11
|
+
import { MSelectV2Plugin } from './MSelectV2'
|
|
12
|
+
import { MSelectTablePlugin } from './MSelectTable'
|
|
13
|
+
import { MDialogPlugin } from './MDialog'
|
|
14
|
+
import { MSelectTableV1Plugin } from './MSelectTableV1'
|
|
15
|
+
import { MTableV2Plugin } from './MTableV2'
|
|
16
|
+
import { MTableSuperPlugin } from './MTableSuper'
|
|
17
17
|
|
|
18
|
-
import useTableConfig from '
|
|
19
|
-
import useTableV2Config from '
|
|
20
|
-
import useRemainingSpace from '
|
|
21
|
-
import useSkin from '
|
|
22
|
-
import useGlobalZIndex from '
|
|
23
|
-
import usePackageConfig from '
|
|
24
|
-
import useMTableColumnSet from '
|
|
18
|
+
import useTableConfig from './Hook/useTableConfig/useTableConfig'
|
|
19
|
+
import useTableV2Config from './Hook/useTableV2Config/useTableV2Config'
|
|
20
|
+
import useRemainingSpace from './Hook/useRemainingSpace/useRemainingSpace'
|
|
21
|
+
import useSkin from './SkinConfig/src/useSkin'
|
|
22
|
+
import useGlobalZIndex from './Hook/useZIndex/useGlobalZIndex'
|
|
23
|
+
import usePackageConfig from './Hook/usePackageConfig/usePackageConfig'
|
|
24
|
+
import useMTableColumnSet from './MTableColumnSet/src/useMTableColumnSet'
|
|
25
|
+
import useFormInline from './Hook/useFormInline/useFormInline'
|
|
25
26
|
|
|
26
|
-
import moneyFormat from '
|
|
27
|
-
import checkType from '
|
|
28
|
-
import compareStructures from '
|
|
27
|
+
import moneyFormat from './Tool/moneyFormat/moneyFormat'
|
|
28
|
+
import checkType from './Tool/checkType/checkType'
|
|
29
|
+
import compareStructures from './Tool/compareStructures/compareStructures'
|
|
29
30
|
|
|
30
31
|
const BrPlugin: Plugin = {
|
|
31
32
|
install (app: App) {
|
|
@@ -69,6 +70,7 @@ export { useSkin }
|
|
|
69
70
|
export { useGlobalZIndex }
|
|
70
71
|
export { usePackageConfig }
|
|
71
72
|
export { useMTableColumnSet }
|
|
73
|
+
export { useFormInline }
|
|
72
74
|
|
|
73
75
|
export { moneyFormat }
|
|
74
76
|
export { checkType }
|
package/src/App.vue
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
20
|
-
import ComponentList from 'packages/list.json'
|
|
20
|
+
import ComponentList from './../packages/list.json'
|
|
21
21
|
import { reactive } from 'vue'
|
|
22
|
-
import usePackageConfig from 'packages/Hook/usePackageConfig/usePackageConfig'
|
|
22
|
+
import usePackageConfig from './../packages/Hook/usePackageConfig/usePackageConfig'
|
|
23
23
|
|
|
24
24
|
usePackageConfig({
|
|
25
25
|
getConfig: (key: string = '') => {
|
|
@@ -27,10 +27,12 @@ usePackageConfig({
|
|
|
27
27
|
return JSON.parse(localStorage.getItem(key) || '{}')
|
|
28
28
|
},
|
|
29
29
|
setConfig: (key: string = '', data: any) => {
|
|
30
|
+
// 模拟接口
|
|
30
31
|
setTimeout(() => {
|
|
31
32
|
// console.log(key, data)
|
|
32
33
|
localStorage.setItem(key, JSON.stringify(data))
|
|
33
34
|
}, 1000)
|
|
35
|
+
localStorage.setItem(key, JSON.stringify(data))
|
|
34
36
|
}
|
|
35
37
|
})
|
|
36
38
|
|
package/tags.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"demo":{"attributes":[],"description":"这是一个demo"},"m-dialog":{"attributes":["modelValue","width","insideHeight","minInsideHeight","maxInsideHeight","resize","draggable","insideClassName","resized","update:insideHeight","update:modelValue"],"description":"这是一个MDialog"},"m-inline":{"attributes":["minWidth","maxWidth","size","switch"],"description":"这是一个MInline"},"m-input-number":{"attributes":["modelValue","placeholder","disabled","size","min","max","step","stepStrictly","thousandthPlace","noBorder","noSpacing","update:modelValue","change","focus","blur"],"description":"这是一个MInputNumber"},"m-option":{"attributes":[],"description":"这是一个MOption"},"m-select":{"attributes":["checkboxMode","multiple"],"description":"这是一个MSelect"},"m-select-table":{"attributes":["modelValue","name","placeholder","disabled","size","total","filterMethod","filterable","remote","remoteMethod","options","tableTitle","multiple","keywords","reserveSelection","tableHeight","isAffirmBtn","scrollbarAlwaysOn","allowCreate","border","popupWidth","selected","selectMultiple","toPage","update:modelValue","clear","removeTag"],"description":"这是一个MSelectTable"},"m-select-table-v1":{"attributes":["modelValue","placeholder","disabled","options","tableTitle","remoteMethod","allowCreate","focusShow","isSelect","clearable","size","labelKey","scrollbarAlwaysOn","total","update:modelValue","selectMultiple","change","selected","clear"],"description":"这是一个MSelectTableV1"},"m-select-v2":{"attributes":["modelValue","checkboxMode","multiple","showAll","options","update:modelValue"],"description":"这是一个MSelectV2"},"m-table":{"attributes":["size","sole","data","filtersValue","tableConfig","expandProp","expandRowKeys","rowKey","tableConfigKey","pasteData","update:tableConfig","privateExpandChange"],"description":"这是一个MTable"},"m-table-column":{"attributes":["filtersValue","filters","filterMethod","children","update:filtersValue"],"description":"这是一个MTableColumn"},"m-table-column-set":{"attributes":["modelValue","foldMode","link","tableConfigKey","update:modelValue","change"],"description":"这是一个MTableColumnSet"},"m-table-super":{"attributes":[],"description":"这是一个MTableSuper"},"m-table-v2":{"attributes":["size","data","height","border","columns","filtersValue","tableConfig","tableConfigKey","fixed","estimatedRowHeight","headerHeight","cellWidthAdaptive","pasteData","update:tableConfig"],"description":"这是一个MTableV2"},"skin-config":{"attributes":["change"],"description":"这是一个SkinConfig"},"tab-page":{"attributes":["modelValue","activeKey","showRightClickMenu","primaryColor","primaryBackgroundColor","close","click"],"description":"这是一个TabPage"}}
|
|
1
|
+
{"demo":{"attributes":[],"description":"这是一个demo"},"m-dialog":{"attributes":["modelValue","width","insideHeight","minInsideHeight","maxInsideHeight","resize","draggable","insideClassName","resized","update:insideHeight","update:modelValue"],"description":"这是一个MDialog"},"m-inline":{"attributes":["minWidth","maxWidth","size","configKey","model","switch"],"description":"这是一个MInline"},"m-input-number":{"attributes":["modelValue","placeholder","disabled","size","min","max","step","stepStrictly","thousandthPlace","noBorder","noSpacing","update:modelValue","change","focus","blur"],"description":"这是一个MInputNumber"},"m-option":{"attributes":[],"description":"这是一个MOption"},"m-select":{"attributes":["checkboxMode","multiple"],"description":"这是一个MSelect"},"m-select-table":{"attributes":["modelValue","name","placeholder","disabled","size","total","filterMethod","filterable","remote","remoteMethod","options","tableTitle","multiple","keywords","reserveSelection","tableHeight","isAffirmBtn","scrollbarAlwaysOn","allowCreate","border","popupWidth","selected","selectMultiple","toPage","update:modelValue","clear","removeTag"],"description":"这是一个MSelectTable"},"m-select-table-v1":{"attributes":["modelValue","placeholder","disabled","options","tableTitle","remoteMethod","allowCreate","focusShow","isSelect","clearable","size","labelKey","scrollbarAlwaysOn","total","update:modelValue","selectMultiple","change","selected","clear"],"description":"这是一个MSelectTableV1"},"m-select-v2":{"attributes":["modelValue","checkboxMode","multiple","showAll","options","update:modelValue"],"description":"这是一个MSelectV2"},"m-table":{"attributes":["size","sole","data","filtersValue","tableConfig","expandProp","expandRowKeys","rowKey","tableConfigKey","pasteData","update:tableConfig","privateExpandChange"],"description":"这是一个MTable"},"m-table-column":{"attributes":["filtersValue","filters","filterMethod","children","update:filtersValue"],"description":"这是一个MTableColumn"},"m-table-column-set":{"attributes":["modelValue","foldMode","link","tableConfigKey","update:modelValue","change"],"description":"这是一个MTableColumnSet"},"m-table-super":{"attributes":[],"description":"这是一个MTableSuper"},"m-table-v2":{"attributes":["size","data","height","border","columns","filtersValue","tableConfig","tableConfigKey","fixed","estimatedRowHeight","headerHeight","cellWidthAdaptive","pasteData","update:tableConfig"],"description":"这是一个MTableV2"},"skin-config":{"attributes":["change"],"description":"这是一个SkinConfig"},"tab-page":{"attributes":["modelValue","activeKey","showRightClickMenu","primaryColor","primaryBackgroundColor","close","click"],"description":"这是一个TabPage"}}
|