@complex-suite/component-antd 4.10.12
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/LayoutResizeObserver.ts +104 -0
- package/LocalResizeObserver.ts +46 -0
- package/README.md +67 -0
- package/antdConfig.ts +361 -0
- package/format.ts +458 -0
- package/history.md +325 -0
- package/icon.ts +65 -0
- package/index.test.ts +5 -0
- package/index.ts +55 -0
- package/package.json +39 -0
- package/plugin.ts +95 -0
- package/quick/QuickCascade.tsx +107 -0
- package/quick/QuickEdit.tsx +117 -0
- package/quick/QuickFloat.tsx +32 -0
- package/quick/QuickFloatModal.tsx +95 -0
- package/quick/QuickFloatValue.tsx +103 -0
- package/quick/QuickList.tsx +433 -0
- package/quick/data/FloatData.ts +77 -0
- package/src/AutoSpin.vue +39 -0
- package/src/AutoText.vue +101 -0
- package/src/ButtonView.tsx +62 -0
- package/src/CollapseArea.tsx +88 -0
- package/src/EditArea.tsx +205 -0
- package/src/EditView.tsx +179 -0
- package/src/FlexBox.tsx +74 -0
- package/src/FormList.tsx +226 -0
- package/src/ImageViewer.tsx +122 -0
- package/src/InfoArea.tsx +182 -0
- package/src/InfoView.tsx +150 -0
- package/src/MenuView.tsx +91 -0
- package/src/ModalView.tsx +274 -0
- package/src/MultipleImport.tsx +231 -0
- package/src/SearchArea.tsx +170 -0
- package/src/SelectText.vue +59 -0
- package/src/SimpleTable.tsx +256 -0
- package/src/SingleImport.tsx +189 -0
- package/src/TableView.tsx +415 -0
- package/src/components/AutoRender.tsx +19 -0
- package/src/components/ChoiceInfo.vue +73 -0
- package/src/components/PaginationView.tsx +103 -0
- package/src/components/TableMenu.tsx +93 -0
- package/src/dictionary/AutoEditItem.tsx +164 -0
- package/src/dictionary/AutoInfoItem.tsx +126 -0
- package/src/dictionary/AutoItem.tsx +219 -0
- package/src/icons/EmptyImage.vue +30 -0
- package/src/icons/ErrorImage.vue +30 -0
- package/src/style/index.css +304 -0
- package/tsconfig.json +8 -0
- package/type.ts +4 -0
- package/vitest.config.ts +11 -0
- package/widthCalculator.ts +20 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { h, defineComponent, PropType, VNode } from 'vue'
|
|
2
|
+
import ModalView from './../src/ModalView'
|
|
3
|
+
import type { ModalViewProps } from './../src/ModalView'
|
|
4
|
+
import EditArea from './../src/EditArea'
|
|
5
|
+
import type { EditAreaProps } from './../src/EditArea'
|
|
6
|
+
import InfoArea from './../src/InfoArea'
|
|
7
|
+
import type { InfoAreaProps } from './../src/InfoArea'
|
|
8
|
+
|
|
9
|
+
export type QuickEditTarget = 'edit' | 'info'
|
|
10
|
+
|
|
11
|
+
export interface QuickEditProps<T extends QuickEditTarget = 'edit'> {
|
|
12
|
+
content: string | (() => VNode | VNode[])
|
|
13
|
+
contentProps?: {
|
|
14
|
+
id?: string
|
|
15
|
+
class?: string
|
|
16
|
+
style?: Record<string, any>
|
|
17
|
+
}
|
|
18
|
+
data?: Record<PropertyKey, any>
|
|
19
|
+
type?: string
|
|
20
|
+
target?: T
|
|
21
|
+
targetProps: T extends 'edit' ? EditAreaProps : InfoAreaProps
|
|
22
|
+
modalProps?: ModalViewProps
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
name: 'QuickEdit',
|
|
27
|
+
emits: {
|
|
28
|
+
submit: (_targetData: Record<string, any>, _originData: undefined | Record<string, any>, _type: string) => {
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
content: {
|
|
34
|
+
type: [String, Function] as PropType<QuickEditProps<QuickEditTarget>['content']>,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
contentProps: {
|
|
38
|
+
type: Object as PropType<QuickEditProps<QuickEditTarget>['contentProps']>
|
|
39
|
+
},
|
|
40
|
+
data: {
|
|
41
|
+
type: Object as PropType<QuickEditProps<QuickEditTarget>['data']>
|
|
42
|
+
},
|
|
43
|
+
type: {
|
|
44
|
+
type: String as PropType<QuickEditProps<QuickEditTarget>['type']>
|
|
45
|
+
},
|
|
46
|
+
target: {
|
|
47
|
+
type: String as PropType<QuickEditProps<QuickEditTarget>['target']>
|
|
48
|
+
},
|
|
49
|
+
targetProps: {
|
|
50
|
+
type: Object as PropType<QuickEditProps<QuickEditTarget>['targetProps']>,
|
|
51
|
+
required: true
|
|
52
|
+
},
|
|
53
|
+
modalProps: {
|
|
54
|
+
type: Object as PropType<QuickEditProps<QuickEditTarget>['modalProps']>,
|
|
55
|
+
required: false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
showTarget() {
|
|
60
|
+
(this.$refs.modal as InstanceType<typeof ModalView>).show()
|
|
61
|
+
this.$nextTick(() => {
|
|
62
|
+
(this.$refs.target as InstanceType<typeof EditArea | typeof InfoArea>).$show(this.type, this.data)
|
|
63
|
+
})
|
|
64
|
+
},
|
|
65
|
+
renderContent() {
|
|
66
|
+
return h('span', {
|
|
67
|
+
class: 'complex-color-link',
|
|
68
|
+
onClick: () => {
|
|
69
|
+
this.showTarget()
|
|
70
|
+
},
|
|
71
|
+
...this.contentProps
|
|
72
|
+
}, typeof this.content === 'string' ? this.content : this.content())
|
|
73
|
+
},
|
|
74
|
+
renderPanel() {
|
|
75
|
+
if (this.target !== 'info') {
|
|
76
|
+
return h(ModalView, {
|
|
77
|
+
ref: 'modal',
|
|
78
|
+
width: 880,
|
|
79
|
+
menu: ['cancel', 'submit'],
|
|
80
|
+
submit: () => {
|
|
81
|
+
const promise = (this.$refs.target as InstanceType<typeof EditArea>).$submit()
|
|
82
|
+
promise.then(res => {
|
|
83
|
+
this.$emit('submit', res.targetData, res.originData, res.type)
|
|
84
|
+
})
|
|
85
|
+
return promise
|
|
86
|
+
},
|
|
87
|
+
...this.modalProps
|
|
88
|
+
}, {
|
|
89
|
+
default: () => h(EditArea, {
|
|
90
|
+
ref: 'target',
|
|
91
|
+
...this.targetProps
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
} else {
|
|
95
|
+
return h(ModalView, {
|
|
96
|
+
ref: 'modal',
|
|
97
|
+
width: 880,
|
|
98
|
+
menu: ['close'],
|
|
99
|
+
...this.modalProps
|
|
100
|
+
}, {
|
|
101
|
+
default: () => h(InfoArea, {
|
|
102
|
+
ref: 'target',
|
|
103
|
+
...this.targetProps
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
render() {
|
|
110
|
+
return h('div', {
|
|
111
|
+
class: 'complex-quick-panel'
|
|
112
|
+
}, [
|
|
113
|
+
this.renderContent(),
|
|
114
|
+
this.renderPanel()
|
|
115
|
+
])
|
|
116
|
+
}
|
|
117
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineComponent, h, PropType } from "vue"
|
|
2
|
+
import FloatData from "./data/FloatData"
|
|
3
|
+
import type { FloatValue } from "./data/FloatData"
|
|
4
|
+
import QuickFloatValue from "./QuickFloatValue"
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: 'QuickFloat',
|
|
8
|
+
props: {
|
|
9
|
+
float: {
|
|
10
|
+
type: Object as PropType<FloatData>,
|
|
11
|
+
required: true
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
methods: {
|
|
15
|
+
renderValue(floatValue: FloatValue) {
|
|
16
|
+
return h(QuickFloatValue, {
|
|
17
|
+
floatValue,
|
|
18
|
+
onClose: (floatValue: FloatValue, from: string) => {
|
|
19
|
+
this.float.close(floatValue, from)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
renderList() {
|
|
24
|
+
return this.float.list.map(floatValue => {
|
|
25
|
+
return this.renderValue(floatValue)
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
render() {
|
|
30
|
+
return h('div', { class: 'complex-quick-float' }, [ this.renderList() ])
|
|
31
|
+
}
|
|
32
|
+
})
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { defineComponent, h, PropType } from "vue"
|
|
2
|
+
import type { ModalProps } from "ant-design-vue"
|
|
3
|
+
import ModalView from "../src/ModalView"
|
|
4
|
+
import type { ModalViewSlotProps } from "../src/ModalView"
|
|
5
|
+
import FloatData from "./data/FloatData"
|
|
6
|
+
import type { FloatValue } from "./data/FloatData"
|
|
7
|
+
import { contentRef } from "./QuickFloatValue"
|
|
8
|
+
|
|
9
|
+
export interface QuickFloatModalProps {
|
|
10
|
+
modal: FloatValue['modal']
|
|
11
|
+
content: FloatValue['content']
|
|
12
|
+
float?: FloatData
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
name: 'QuickFloatModal',
|
|
17
|
+
emits: {
|
|
18
|
+
// 关闭
|
|
19
|
+
close: (from: string) => {
|
|
20
|
+
return typeof from === 'string'
|
|
21
|
+
},
|
|
22
|
+
// 菜单
|
|
23
|
+
menu: (prop: string, _self: any) => {
|
|
24
|
+
return typeof prop === 'string'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
props: {
|
|
28
|
+
modal: {
|
|
29
|
+
type: Object as PropType<QuickFloatModalProps['modal']>,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
content: {
|
|
33
|
+
type: Object as PropType<QuickFloatModalProps['content']>,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
float: {
|
|
37
|
+
type: Object as PropType<QuickFloatModalProps['float']>,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
data() {
|
|
42
|
+
return {
|
|
43
|
+
floatValue: undefined as undefined | FloatValue
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
getContent() {
|
|
48
|
+
return !this.float ? this.$refs[contentRef] : this.floatValue?.target?.getContent()
|
|
49
|
+
},
|
|
50
|
+
getModal() {
|
|
51
|
+
return !this.float ? (this.$refs.modal as InstanceType<typeof ModalView>) : this.floatValue?.target?.getModal()
|
|
52
|
+
},
|
|
53
|
+
show(args: any[], title?: string, option?: ModalProps) {
|
|
54
|
+
if (!this.float) {
|
|
55
|
+
(this.$refs.modal as InstanceType<typeof ModalView>).show(title, option)
|
|
56
|
+
this.$nextTick(() => {
|
|
57
|
+
if (this.content.show) {
|
|
58
|
+
this.content.show.trigger(this.getContent(), args)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
} else {
|
|
62
|
+
this.floatValue = this.float.push({
|
|
63
|
+
label: {
|
|
64
|
+
value: title || this.modal.title || '浮窗'
|
|
65
|
+
},
|
|
66
|
+
modal: {
|
|
67
|
+
title: title,
|
|
68
|
+
...this.modal
|
|
69
|
+
},
|
|
70
|
+
content: {
|
|
71
|
+
render: this.content.render,
|
|
72
|
+
show: this.content.show ? {
|
|
73
|
+
trigger: this.content.show.trigger,
|
|
74
|
+
args: args
|
|
75
|
+
} : undefined
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
render() {
|
|
82
|
+
if (!this.float) {
|
|
83
|
+
return h(ModalView, {
|
|
84
|
+
ref: 'modal',
|
|
85
|
+
...this.modal
|
|
86
|
+
}, {
|
|
87
|
+
default: (modalSlotProps: ModalViewSlotProps) => {
|
|
88
|
+
return this.content.render(contentRef, modalSlotProps)
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
} else {
|
|
92
|
+
return null
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { defineComponent, h, PropType, markRaw } from "vue"
|
|
2
|
+
import { FloatValue } from "./data/FloatData"
|
|
3
|
+
import ModalView from "./../src/ModalView"
|
|
4
|
+
import type { ModalViewSlotProps } from "./../src/ModalView"
|
|
5
|
+
import icon from "../icon"
|
|
6
|
+
|
|
7
|
+
export const contentRef = 'content'
|
|
8
|
+
export const modalRef = 'modal'
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'QuickFloatValue',
|
|
12
|
+
emits: {
|
|
13
|
+
// 关闭
|
|
14
|
+
close: (floatValue: FloatValue, _from: string) => {
|
|
15
|
+
return !!floatValue
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
floatValue: {
|
|
20
|
+
type: Object as PropType<FloatValue>,
|
|
21
|
+
required: true
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {}
|
|
26
|
+
},
|
|
27
|
+
watch: {
|
|
28
|
+
'floatValue.show': {
|
|
29
|
+
immediate: true,
|
|
30
|
+
handler: function (value) {
|
|
31
|
+
if (value) {
|
|
32
|
+
this.$nextTick(() => {
|
|
33
|
+
this.show()
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
mounted() {
|
|
40
|
+
this.floatValue.target = markRaw(this) as any
|
|
41
|
+
},
|
|
42
|
+
beforeUnmount() {
|
|
43
|
+
this.floatValue.target = undefined
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
getContent() {
|
|
47
|
+
return this.$refs[contentRef]
|
|
48
|
+
},
|
|
49
|
+
getModal() {
|
|
50
|
+
return this.$refs[modalRef] as InstanceType<typeof ModalView>
|
|
51
|
+
},
|
|
52
|
+
show() {
|
|
53
|
+
this.getModal().show()
|
|
54
|
+
if (!this.floatValue.init) {
|
|
55
|
+
this.floatValue.init = true
|
|
56
|
+
this.$nextTick(() => {
|
|
57
|
+
if (this.floatValue.content.show) {
|
|
58
|
+
this.floatValue.content.show.trigger(this.getContent(), this.floatValue.content.show.args)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
close(from = 'float') {
|
|
64
|
+
this.getModal().close(from)
|
|
65
|
+
},
|
|
66
|
+
renderContent() {
|
|
67
|
+
if (!this.floatValue.init && !this.floatValue.show) {
|
|
68
|
+
// 未加载未展示直接不进行构建
|
|
69
|
+
return null
|
|
70
|
+
}
|
|
71
|
+
return h(ModalView, {
|
|
72
|
+
class: 'complex-quick-float-item-modal',
|
|
73
|
+
ref: modalRef,
|
|
74
|
+
onClose: (from: string) => {
|
|
75
|
+
this.$emit('close', this.floatValue, from)
|
|
76
|
+
},
|
|
77
|
+
...this.floatValue.modal
|
|
78
|
+
}, {
|
|
79
|
+
default: (modalSlotProps: ModalViewSlotProps) => {
|
|
80
|
+
return this.floatValue.content.render('content', modalSlotProps)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
},
|
|
84
|
+
renderName() {
|
|
85
|
+
return h('div', {
|
|
86
|
+
class: 'complex-quick-float-item-label',
|
|
87
|
+
onClick: () => {
|
|
88
|
+
if (!this.floatValue.show) {
|
|
89
|
+
this.floatValue.show = true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
default: () => [
|
|
94
|
+
this.floatValue.label.icon ? icon.parse(this.floatValue.label.icon) : null,
|
|
95
|
+
typeof this.floatValue.label.value !== 'function' ? this.floatValue.label.value : this.floatValue.label.value()
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
render() {
|
|
101
|
+
return h('div', { class: ['complex-quick-float-item', this.floatValue.show ? 'complex-quick-float-item-active' : ''] }, [ this.renderContent(), this.renderName() ])
|
|
102
|
+
}
|
|
103
|
+
})
|