br-dionysus 1.8.6 → 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 -76
- package/attributes.json +1 -1
- package/dist/br-dionysus.es.js +4036 -3938
- 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 +8 -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 -23
- package/packages/MInline/src/MInline.vue +249 -100
- 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,21 +30,56 @@
|
|
|
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>
|
|
@@ -48,10 +87,11 @@
|
|
|
48
87
|
|
|
49
88
|
<script setup lang="ts">
|
|
50
89
|
import { ref, onMounted, useSlots, watch, computed, nextTick } from 'vue'
|
|
51
|
-
import { Size } from '
|
|
90
|
+
import { Size } from './../../typings/enum'
|
|
52
91
|
import createHash from '../../Tool/createHash/createHash'
|
|
53
|
-
import slotsToData, {
|
|
54
|
-
import { FormInlineConfigType } from '
|
|
92
|
+
import slotsToData, { SlotsToDataReturnItem } from './../../Tool/slotsToData/slotsToData'
|
|
93
|
+
import { FormInlineConfigType } from './../../Hook/useFormInline/useFormInline'
|
|
94
|
+
import usePackageConfig from './../../Hook/usePackageConfig/usePackageConfig'
|
|
55
95
|
|
|
56
96
|
const props = withDefaults(defineProps<{
|
|
57
97
|
/**
|
|
@@ -65,12 +105,15 @@ const props = withDefaults(defineProps<{
|
|
|
65
105
|
/** 组件尺寸 */
|
|
66
106
|
size?: Size,
|
|
67
107
|
/** 配置key */
|
|
68
|
-
configKey?: string
|
|
108
|
+
configKey?: string,
|
|
109
|
+
/** 筛选对象 */
|
|
110
|
+
model?: Record<string, any> | null
|
|
69
111
|
}>(), {
|
|
70
112
|
minWidth: 290,
|
|
71
113
|
maxWidth: 400,
|
|
72
114
|
size: Size.DEFAULT,
|
|
73
|
-
configKey: ''
|
|
115
|
+
configKey: '',
|
|
116
|
+
model: null
|
|
74
117
|
})
|
|
75
118
|
|
|
76
119
|
const height = computed(() => {
|
|
@@ -81,6 +124,7 @@ const height = computed(() => {
|
|
|
81
124
|
})
|
|
82
125
|
|
|
83
126
|
const boxClassName = 'j-' + createHash(8)
|
|
127
|
+
const elGlobalClassName = 'j-' + createHash(8)
|
|
84
128
|
|
|
85
129
|
const init = () => {
|
|
86
130
|
const boxEl: HTMLElement | null = document.querySelector('.' + boxClassName + ' [data-box]')
|
|
@@ -126,8 +170,8 @@ onMounted(() => {
|
|
|
126
170
|
|
|
127
171
|
const unfold = ref<boolean>(false)
|
|
128
172
|
|
|
129
|
-
const switchUnfold = () => {
|
|
130
|
-
unfold.value =
|
|
173
|
+
const switchUnfold = (status = !unfold.value) => {
|
|
174
|
+
unfold.value = status
|
|
131
175
|
emit('switch', unfold.value)
|
|
132
176
|
}
|
|
133
177
|
|
|
@@ -165,124 +209,193 @@ onMounted(() => {
|
|
|
165
209
|
})
|
|
166
210
|
})
|
|
167
211
|
|
|
168
|
-
const slotDefaultData = slotsToData(slots)
|
|
169
|
-
const formItemList = slotDefaultData[0].children
|
|
170
|
-
console.log('slotDefaultData', slotDefaultData)
|
|
171
|
-
console.log('formItemList', formItemList)
|
|
172
212
|
/**
|
|
173
|
-
*
|
|
213
|
+
* 以下为配置化
|
|
174
214
|
* */
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
sort: 2,
|
|
191
|
-
defaultValue: ''
|
|
192
|
-
},
|
|
193
|
-
code: {
|
|
194
|
-
show: true,
|
|
195
|
-
sort: 1,
|
|
196
|
-
defaultValue: ''
|
|
197
|
-
},
|
|
198
|
-
time: {
|
|
199
|
-
show: true,
|
|
200
|
-
sort: 3,
|
|
201
|
-
defaultValue: ''
|
|
202
|
-
},
|
|
203
|
-
type: {
|
|
204
|
-
show: true,
|
|
205
|
-
sort: 4,
|
|
206
|
-
defaultValue: ''
|
|
207
|
-
},
|
|
208
|
-
region: {
|
|
209
|
-
show: true,
|
|
210
|
-
sort: 5,
|
|
211
|
-
defaultValue: ''
|
|
212
|
-
},
|
|
213
|
-
level: {
|
|
214
|
-
show: true,
|
|
215
|
-
sort: 6,
|
|
216
|
-
defaultValue: ''
|
|
217
|
-
}
|
|
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)
|
|
218
230
|
}
|
|
219
|
-
|
|
231
|
+
nextTick(() => {
|
|
232
|
+
if (!props.configKey) return
|
|
233
|
+
markAttribute(config.value)
|
|
234
|
+
setDomDraggableEvent(config.value)
|
|
235
|
+
removeDomDraggableEvent()
|
|
236
|
+
generateCheckBox()
|
|
237
|
+
})
|
|
220
238
|
|
|
221
|
-
|
|
222
|
-
console.log('itemDomIndexToPropMap', itemDomIndexToPropMap)
|
|
239
|
+
type ConfigType = FormInlineConfigType<Record<string, any>>
|
|
223
240
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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)
|
|
227
264
|
}
|
|
265
|
+
syncLocalDataToConfig()
|
|
228
266
|
|
|
229
267
|
/**
|
|
230
|
-
*
|
|
231
|
-
* @return Html_Data[]
|
|
268
|
+
* 标记dom的属性
|
|
232
269
|
* */
|
|
233
|
-
const
|
|
234
|
-
const
|
|
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> = {}
|
|
235
276
|
domList.forEach((e, idx) => {
|
|
236
|
-
itemDomIndexToPropMap[idx] = (
|
|
277
|
+
itemDomIndexToPropMap[idx] = (formItemList[idx] as SlotsToDataReturnItem).props?.prop
|
|
237
278
|
})
|
|
238
279
|
domList.forEach((item, idx) => {
|
|
239
|
-
item.
|
|
240
|
-
|
|
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))
|
|
241
287
|
})
|
|
242
|
-
return domList.sort((a, b) => (a?.data_sort || 0) - (b?.data_sort || 0))
|
|
243
288
|
}
|
|
244
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
|
+
}
|
|
245
297
|
/**
|
|
246
|
-
*
|
|
298
|
+
* 生成复选框
|
|
247
299
|
* */
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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)
|
|
254
325
|
}
|
|
255
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
|
|
256
338
|
const domNodeList: NodeList = document.querySelectorAll(`.${boxClassName} [data-box] [data-item]`)
|
|
257
|
-
const domList: HTMLElement[] = []
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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
|
|
261
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++) {
|
|
262
366
|
const dom = domList[i]
|
|
263
|
-
if (!dom) continue
|
|
264
367
|
|
|
265
368
|
dom.draggable = true
|
|
266
|
-
dom.ondrop = () => drop(i)
|
|
267
|
-
dom.ondragstart = () => dragstart(
|
|
369
|
+
dom.ondrop = () => drop(i, config)
|
|
370
|
+
dom.ondragstart = () => dragstart(dom.getAttribute('data-key') as string)
|
|
371
|
+
dom.ondragenter = () => ondragenter(i)
|
|
268
372
|
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* 清除元素的拖拽事件
|
|
377
|
+
* */
|
|
378
|
+
const removeDomDraggableEvent = () => {
|
|
269
379
|
const formDom: HTMLDivElement | null = document.querySelector(`.${boxClassName} [data-box]`)
|
|
270
380
|
if (!formDom) return
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
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
|
+
}
|
|
279
390
|
}
|
|
280
391
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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
|
+
}
|
|
286
399
|
</script>
|
|
287
400
|
|
|
288
401
|
<style scoped lang="scss">
|
|
@@ -318,6 +431,15 @@ nextTick(() => {
|
|
|
318
431
|
}
|
|
319
432
|
}
|
|
320
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
|
+
|
|
321
443
|
.u-btn-gp {
|
|
322
444
|
display: flex;
|
|
323
445
|
padding-bottom: 10px;
|
|
@@ -327,6 +449,12 @@ nextTick(() => {
|
|
|
327
449
|
box-sizing: border-box;
|
|
328
450
|
}
|
|
329
451
|
|
|
452
|
+
.u-check-box-group {
|
|
453
|
+
//display: flex;
|
|
454
|
+
display: none;
|
|
455
|
+
flex: 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
330
458
|
.u-row {
|
|
331
459
|
display: flex;
|
|
332
460
|
overflow: hidden;
|
|
@@ -336,6 +464,10 @@ nextTick(() => {
|
|
|
336
464
|
&[data-unfold="true"] {
|
|
337
465
|
max-height: none !important;
|
|
338
466
|
}
|
|
467
|
+
|
|
468
|
+
> [data-class="checkbox"] {
|
|
469
|
+
display: none;
|
|
470
|
+
}
|
|
339
471
|
}
|
|
340
472
|
|
|
341
473
|
.u-btn-unfold {
|
|
@@ -352,6 +484,11 @@ nextTick(() => {
|
|
|
352
484
|
transform: rotate(270deg);
|
|
353
485
|
}
|
|
354
486
|
}
|
|
487
|
+
|
|
488
|
+
[data-class="checkbox"] {
|
|
489
|
+
padding-left: 5px;
|
|
490
|
+
height: auto;
|
|
491
|
+
}
|
|
355
492
|
</style>
|
|
356
493
|
|
|
357
494
|
<style lang="scss">
|
|
@@ -395,5 +532,17 @@ nextTick(() => {
|
|
|
395
532
|
}
|
|
396
533
|
}
|
|
397
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
|
+
}
|
|
398
547
|
}
|
|
399
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) : []
|