@oinone/kunlun-vue-ui-antd 6.3.9 → 6.4.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/dist/oinone-kunlun-vue-ui-antd.css +1 -1
- package/dist/oinone-kunlun-vue-ui-antd.esm.js +2 -2
- package/dist/oinone-kunlun-vue-ui-antd.scss +1 -1
- package/dist/types/src/component/index.d.ts +1 -0
- package/dist/types/src/component/oio-button/oio-button.vue.d.ts +6 -0
- package/dist/types/src/component/oio-drawer/oio-drawer.vue.d.ts +43 -11
- package/dist/types/src/component/oio-gallery/oio-gallery.vue.d.ts +2 -0
- package/dist/types/src/component/oio-group/index.d.ts +1 -0
- package/dist/types/src/component/oio-group/oio-group.vue.d.ts +6 -0
- package/dist/types/src/component/oio-group/typing.d.ts +10 -0
- package/dist/types/src/component/oio-inner-popup/oio-inner-popup.vue.d.ts +0 -3
- package/dist/types/src/component/oio-input/oio-input-number.vue.d.ts +2 -1
- package/dist/types/src/component/oio-input/oio-input-password.vue.d.ts +6 -0
- package/dist/types/src/component/oio-input/oio-input-search.vue.d.ts +6 -0
- package/dist/types/src/component/oio-input/oio-input.vue.d.ts +12 -1
- package/dist/types/src/component/oio-list/index.d.ts +1 -0
- package/dist/types/src/component/oio-list/oio-list.vue.d.ts +80 -0
- package/dist/types/src/component/oio-modal/oio-modal.vue.d.ts +47 -10
- package/dist/types/src/component/oio-notification/index.d.ts +12 -1
- package/dist/types/src/component/oio-select/oio-select.vue.d.ts +14 -2
- package/dist/types/src/component/oio-tabs/oio-tabs.vue.d.ts +10 -3
- package/dist/types/src/component/oio-tooltip/oio-tooltip-help.vue.d.ts +0 -2
- package/dist/types/src/component/oio-tree/oio-tree.vue.d.ts +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/package.json +3 -3
- package/src/component/index.ts +1 -0
- package/src/component/oio-button/oio-button.vue +2 -2
- package/src/component/oio-button/style/a-button.scss +102 -13
- package/src/component/oio-checkbox/style/index.scss +21 -1
- package/src/component/oio-collapse/style/index.scss +2 -1
- package/src/component/oio-date-time-picker/style/index.scss +42 -41
- package/src/component/oio-date-time-range-picker/style/index.scss +5 -5
- package/src/component/oio-drawer/oio-drawer.vue +77 -18
- package/src/component/oio-drawer/style/index.scss +129 -10
- package/src/component/oio-drawer/style/parameters.scss +4 -0
- package/src/component/oio-form/style/index.scss +3 -2
- package/src/component/oio-gallery/oio-gallery.vue +2 -4
- package/src/component/oio-group/index.ts +1 -0
- package/src/component/oio-group/oio-group.vue +7 -1
- package/src/component/oio-group/style/index.scss +17 -4
- package/src/component/oio-group/typing.ts +10 -0
- package/src/component/oio-inner-popup/oio-inner-popup.vue +23 -12
- package/src/component/oio-inner-popup/style/index.scss +13 -25
- package/src/component/oio-input/oio-input-group.vue +1 -1
- package/src/component/oio-input/oio-input-number.vue +4 -1
- package/src/component/oio-input/oio-input-search.vue +6 -1
- package/src/component/oio-input/oio-input.vue +20 -7
- package/src/component/oio-list/index.ts +1 -0
- package/src/component/oio-list/oio-list-item.vue +17 -0
- package/src/component/oio-list/oio-list.vue +206 -0
- package/src/component/oio-list/style/index.scss +51 -0
- package/src/component/oio-list/style/parameters.scss +5 -0
- package/src/component/oio-modal/oio-modal.vue +89 -34
- package/src/component/oio-modal/style/index.scss +128 -72
- package/src/component/oio-modal/style/parameters.scss +4 -0
- package/src/component/oio-notification/index.ts +17 -2
- package/src/component/oio-pagination/style/index.scss +12 -11
- package/src/component/oio-radio/style/index.scss +38 -1
- package/src/component/oio-select/oio-select.vue +23 -10
- package/src/component/oio-select/style/a-select.scss +1 -1
- package/src/component/oio-select/style/index.scss +28 -11
- package/src/component/oio-spin/style/index.scss +1 -6
- package/src/component/oio-tabs/oio-tab.vue +1 -1
- package/src/component/oio-tabs/oio-tabs.vue +22 -2
- package/src/component/oio-tabs/style/index.scss +64 -0
- package/src/component/oio-tabs/use-tab-bar.ts +9 -10
- package/src/component/oio-tooltip/oio-tooltip-help.vue +1 -2
- package/src/component/oio-tree/oio-tree.vue +1 -2
- package/src/component/oio-tree/style/index.scss +4 -0
- package/src/index.ts +1 -0
- package/src/style/index.scss +1 -0
|
@@ -16,8 +16,8 @@ export default defineComponent({
|
|
|
16
16
|
...OioInputProps
|
|
17
17
|
},
|
|
18
18
|
slots: ['prepend', 'append', 'prefix', 'suffix'],
|
|
19
|
-
emits: ['update:value', 'press-enter'],
|
|
20
|
-
setup(props,
|
|
19
|
+
emits: ['update:value', 'press-enter', 'change', 'focus', 'blur'],
|
|
20
|
+
setup(props, { emit, expose }) {
|
|
21
21
|
const origin = ref();
|
|
22
22
|
|
|
23
23
|
const internalValue = ref<string | undefined>();
|
|
@@ -29,7 +29,7 @@ export default defineComponent({
|
|
|
29
29
|
return props.value;
|
|
30
30
|
},
|
|
31
31
|
set(value) {
|
|
32
|
-
|
|
32
|
+
emit('update:value', value);
|
|
33
33
|
internalValue.value = value;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -57,12 +57,21 @@ export default defineComponent({
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
const onPressEnter = (event: KeyboardEvent) => {
|
|
60
|
-
|
|
60
|
+
emit('press-enter', event);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const onFocus = (val: FocusEvent) => {
|
|
64
|
+
emit('focus', val);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const onBlur = (val: FocusEvent) => {
|
|
68
|
+
emit('blur', val);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
expose({
|
|
64
72
|
focus: (options?: InputFocusOptions) => origin.value.focus(options),
|
|
65
|
-
blur: () => origin.value.blur()
|
|
73
|
+
blur: () => origin.value.blur(),
|
|
74
|
+
originInput: origin
|
|
66
75
|
});
|
|
67
76
|
|
|
68
77
|
onMounted(() => {
|
|
@@ -77,7 +86,9 @@ export default defineComponent({
|
|
|
77
86
|
autocomplete,
|
|
78
87
|
|
|
79
88
|
onUpdateValue,
|
|
80
|
-
onPressEnter
|
|
89
|
+
onPressEnter,
|
|
90
|
+
onFocus,
|
|
91
|
+
onBlur
|
|
81
92
|
};
|
|
82
93
|
},
|
|
83
94
|
render() {
|
|
@@ -98,6 +109,8 @@ export default defineComponent({
|
|
|
98
109
|
...this.$attrs,
|
|
99
110
|
'onUpdate:value': this.onUpdateValue,
|
|
100
111
|
onPressEnter: this.onPressEnter,
|
|
112
|
+
onFocus: this.onFocus,
|
|
113
|
+
onBlur: this.onBlur,
|
|
101
114
|
class: StringHelper.append(inputClassList, CastHelper.cast(this.$attrs.class)),
|
|
102
115
|
ref: 'origin'
|
|
103
116
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OioList } from './oio-list.vue';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>hello world</div>
|
|
3
|
+
</template>
|
|
4
|
+
<script lang="ts">
|
|
5
|
+
import { defineComponent } from 'vue';
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'OioListItem',
|
|
9
|
+
components: {},
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {},
|
|
12
|
+
setup(props) {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
<style lang="scss"></style>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { OioListItem, StringHelper } from '@oinone/kunlun-shared';
|
|
3
|
+
import { OioIcon, PropRecordHelper, SelectMode } from '@oinone/kunlun-vue-ui-common';
|
|
4
|
+
import { Radio as ARadio } from 'ant-design-vue';
|
|
5
|
+
import { computed, createVNode, defineComponent, PropType, ref, VNode } from 'vue';
|
|
6
|
+
import { DEFAULT_PREFIX } from '../../theme';
|
|
7
|
+
import { OioCheckbox } from '../oio-checkbox';
|
|
8
|
+
import { OioEmptyData } from '../oio-empty';
|
|
9
|
+
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'OioList',
|
|
12
|
+
components: {
|
|
13
|
+
OioEmptyData,
|
|
14
|
+
OioIcon,
|
|
15
|
+
OioCheckbox,
|
|
16
|
+
ARadio
|
|
17
|
+
},
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
props: {
|
|
20
|
+
list: {
|
|
21
|
+
type: Array as PropType<OioListItem[]>,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
showIcon: {
|
|
25
|
+
type: Boolean
|
|
26
|
+
},
|
|
27
|
+
mode: {
|
|
28
|
+
type: String as PropType<SelectMode | keyof typeof SelectMode>
|
|
29
|
+
},
|
|
30
|
+
showCheckedAll: {
|
|
31
|
+
type: Boolean
|
|
32
|
+
},
|
|
33
|
+
checkedAll: {
|
|
34
|
+
type: Boolean
|
|
35
|
+
},
|
|
36
|
+
halfCheckedAll: {
|
|
37
|
+
type: Boolean
|
|
38
|
+
},
|
|
39
|
+
checkedKeys: {
|
|
40
|
+
type: Array as PropType<string[]>
|
|
41
|
+
},
|
|
42
|
+
selectable: {
|
|
43
|
+
type: Boolean
|
|
44
|
+
},
|
|
45
|
+
selectedKeys: {
|
|
46
|
+
type: Array as PropType<string[]>
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
emits: ['update:checkedAll', 'update:halfCheckedAll', 'update:selectedKeys', 'checked', 'selected'],
|
|
50
|
+
setup(props, { emit }) {
|
|
51
|
+
const internalSelectedKeys = ref<string[]>([]);
|
|
52
|
+
const selectedKeys = computed({
|
|
53
|
+
get() {
|
|
54
|
+
return props.selectedKeys || internalSelectedKeys.value;
|
|
55
|
+
},
|
|
56
|
+
set(val: string[]) {
|
|
57
|
+
internalSelectedKeys.value = val;
|
|
58
|
+
emit('update:selectedKeys', val);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const onChecked = (item: OioListItem, checked: boolean) => {
|
|
63
|
+
emit('checked', item, checked);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onCheckedAll = (checked: boolean) => {
|
|
67
|
+
emit('update:checkedAll', checked);
|
|
68
|
+
emit('update:halfCheckedAll', false);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const onSelected = (e: MouseEvent, item: OioListItem) => {
|
|
72
|
+
e.preventDefault?.();
|
|
73
|
+
e.stopPropagation?.();
|
|
74
|
+
const val = !!selectedKeys.value.find((v) => v === item.key);
|
|
75
|
+
if (val) {
|
|
76
|
+
selectedKeys.value = [];
|
|
77
|
+
} else {
|
|
78
|
+
selectedKeys.value = [item.key];
|
|
79
|
+
}
|
|
80
|
+
emit('selected', item, !val);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
selectedKeys,
|
|
85
|
+
onChecked,
|
|
86
|
+
onCheckedAll,
|
|
87
|
+
onSelected
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
render() {
|
|
91
|
+
const {
|
|
92
|
+
$attrs,
|
|
93
|
+
$slots,
|
|
94
|
+
$translate,
|
|
95
|
+
|
|
96
|
+
mode,
|
|
97
|
+
list,
|
|
98
|
+
checkedKeys,
|
|
99
|
+
showIcon,
|
|
100
|
+
showCheckedAll,
|
|
101
|
+
checkedAll,
|
|
102
|
+
halfCheckedAll,
|
|
103
|
+
selectable,
|
|
104
|
+
selectedKeys,
|
|
105
|
+
onChecked,
|
|
106
|
+
onCheckedAll,
|
|
107
|
+
onSelected
|
|
108
|
+
} = this;
|
|
109
|
+
const { default: defaultSlot, icon: iconSlot } = PropRecordHelper.collectionSlots($slots, [
|
|
110
|
+
{
|
|
111
|
+
origin: 'default',
|
|
112
|
+
default: ({ item }) => {
|
|
113
|
+
return [createVNode('span', {}, item.label)];
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
origin: 'icon',
|
|
118
|
+
default: ({ item }) => {
|
|
119
|
+
if (item.icon) {
|
|
120
|
+
return [
|
|
121
|
+
createVNode(OioIcon, {
|
|
122
|
+
icon: item.icon,
|
|
123
|
+
color: '#ffffff'
|
|
124
|
+
})
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
let first = item.label.trim().charAt(0);
|
|
128
|
+
if (StringHelper.isLetter(first.charCodeAt(0))) {
|
|
129
|
+
first = first.toUpperCase();
|
|
130
|
+
}
|
|
131
|
+
return [createVNode('span', {}, first)];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]);
|
|
135
|
+
const children: VNode[] = [];
|
|
136
|
+
const renderList = list || [];
|
|
137
|
+
const itemClassNames = [`${DEFAULT_PREFIX}-list-item`];
|
|
138
|
+
if (selectable) {
|
|
139
|
+
itemClassNames.push(`${DEFAULT_PREFIX}-list-item-selectable`);
|
|
140
|
+
}
|
|
141
|
+
if (renderList.length) {
|
|
142
|
+
if (mode === SelectMode.multiple && showCheckedAll) {
|
|
143
|
+
children.push(
|
|
144
|
+
createVNode(
|
|
145
|
+
'div',
|
|
146
|
+
{
|
|
147
|
+
key: '__checked_all__',
|
|
148
|
+
class: itemClassNames
|
|
149
|
+
},
|
|
150
|
+
[
|
|
151
|
+
createVNode('div', { class: `${DEFAULT_PREFIX}-list-item-label` }, $translate('全选')),
|
|
152
|
+
createVNode(OioCheckbox, {
|
|
153
|
+
checked: checkedAll,
|
|
154
|
+
indeterminate: halfCheckedAll,
|
|
155
|
+
'onUpdate:checked': onCheckedAll
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
for (const item of renderList) {
|
|
162
|
+
const itemNodes: VNode[] = [];
|
|
163
|
+
const contentNodes: VNode[] = [];
|
|
164
|
+
if (showIcon) {
|
|
165
|
+
contentNodes.push(createVNode('div', { class: `${DEFAULT_PREFIX}-list-item-icon` }, iconSlot({ item })));
|
|
166
|
+
}
|
|
167
|
+
contentNodes.push(createVNode('div', { class: `${DEFAULT_PREFIX}-list-item-label` }, defaultSlot({ item })));
|
|
168
|
+
itemNodes.push(createVNode('div', { class: `${DEFAULT_PREFIX}-list-item-content` }, contentNodes));
|
|
169
|
+
if (mode === SelectMode.multiple) {
|
|
170
|
+
itemNodes.push(
|
|
171
|
+
createVNode(OioCheckbox, {
|
|
172
|
+
checked: item.checked,
|
|
173
|
+
'onUpdate:checked': (val: boolean) => onChecked(item, val)
|
|
174
|
+
})
|
|
175
|
+
);
|
|
176
|
+
} else if (mode === SelectMode.single) {
|
|
177
|
+
itemNodes.push(
|
|
178
|
+
createVNode(ARadio, {
|
|
179
|
+
class: 'oio-radio',
|
|
180
|
+
checked: item.key === checkedKeys?.[0],
|
|
181
|
+
'onUpdate:checked': (val: boolean) => onChecked(item, item.key !== checkedKeys?.[0])
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
const itemProps: Record<string, unknown> = { key: item.key, class: itemClassNames };
|
|
186
|
+
if (selectable) {
|
|
187
|
+
if (selectedKeys.includes(item.key)) {
|
|
188
|
+
itemProps.class = [...itemClassNames, `${DEFAULT_PREFIX}-list-item-activated`];
|
|
189
|
+
}
|
|
190
|
+
itemProps.onClick = (e: MouseEvent) => onSelected(e, item);
|
|
191
|
+
}
|
|
192
|
+
children.push(createVNode('div', itemProps, itemNodes));
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
children.push(createVNode(OioEmptyData));
|
|
196
|
+
}
|
|
197
|
+
return createVNode(
|
|
198
|
+
'div',
|
|
199
|
+
{
|
|
200
|
+
...PropRecordHelper.collectionBasicProps($attrs, [`${DEFAULT_PREFIX}-list`])
|
|
201
|
+
},
|
|
202
|
+
children
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@import './parameters.scss';
|
|
2
|
+
|
|
3
|
+
.#{$listClassPrefix} {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
row-gap: 8px;
|
|
7
|
+
|
|
8
|
+
.#{$listClassPrefix}-item {
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
align-items: center;
|
|
12
|
+
height: 24px;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
padding: 0 8px;
|
|
15
|
+
|
|
16
|
+
&-selectable {
|
|
17
|
+
user-select: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&-selectable:hover {
|
|
21
|
+
background-color: var(--oio-menu-hover-background-color);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&-activated {
|
|
26
|
+
background-color: var(--oio-menu-hover-background-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ant-radio-wrapper.oio-radio {
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.#{$listClassPrefix}-item-content {
|
|
35
|
+
flex: 1;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
column-gap: 8px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.#{$listClassPrefix}-item-icon {
|
|
42
|
+
width: 20px;
|
|
43
|
+
height: 20px;
|
|
44
|
+
line-height: 20px;
|
|
45
|
+
text-align: center;
|
|
46
|
+
font-size: 10px;
|
|
47
|
+
color: #ffffff;
|
|
48
|
+
background-color: #4589ff;
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { CastHelper, StringHelper, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
2
|
+
import { CastHelper, CSSStyle, StringHelper, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
3
3
|
import {
|
|
4
4
|
OioCloseIcon,
|
|
5
|
+
OioIcon,
|
|
5
6
|
OioModalProps,
|
|
7
|
+
PopupDisplayAs,
|
|
6
8
|
PropRecordHelper,
|
|
7
9
|
StyleHelper,
|
|
8
10
|
useDraggable,
|
|
9
|
-
|
|
11
|
+
useInjectOioDefaultFormContext,
|
|
12
|
+
useModal,
|
|
13
|
+
useProviderOioDefaultFormContext
|
|
10
14
|
} from '@oinone/kunlun-vue-ui-common';
|
|
11
15
|
import { Modal as AModal } from 'ant-design-vue';
|
|
12
16
|
import { isBoolean } from 'lodash-es';
|
|
13
|
-
import { computed, createVNode, defineComponent, nextTick, ref, watch } from 'vue';
|
|
17
|
+
import { computed, createVNode, defineComponent, nextTick, ref, watch, withModifiers } from 'vue';
|
|
14
18
|
import { DEFAULT_PREFIX } from '../../theme';
|
|
15
19
|
import { OioButton } from '../oio-button';
|
|
16
20
|
import { OioSpin } from '../oio-spin';
|
|
17
|
-
import { OioTooltip
|
|
21
|
+
import { OioTooltip } from '../oio-tooltip';
|
|
18
22
|
|
|
19
23
|
export default defineComponent({
|
|
20
24
|
name: 'OioModal',
|
|
@@ -22,15 +26,18 @@ export default defineComponent({
|
|
|
22
26
|
AModal,
|
|
23
27
|
OioButton,
|
|
24
28
|
OioSpin,
|
|
25
|
-
OioTooltip
|
|
29
|
+
OioTooltip,
|
|
30
|
+
OioIcon
|
|
26
31
|
},
|
|
27
32
|
inheritAttrs: false,
|
|
28
33
|
props: {
|
|
29
34
|
...OioModalProps
|
|
30
35
|
},
|
|
31
36
|
slots: ['default', 'title', 'header', 'footer', 'closeIcon'],
|
|
32
|
-
emits: ['update:visible'],
|
|
37
|
+
emits: ['update:visible', 'update:displayAs', 'enter', 'cancel'],
|
|
33
38
|
setup(props, context) {
|
|
39
|
+
const formContext = useInjectOioDefaultFormContext();
|
|
40
|
+
|
|
34
41
|
const internalId = `${DEFAULT_PREFIX}-modal-${uniqueKeyGenerator()}`;
|
|
35
42
|
|
|
36
43
|
const modalRef = ref<HTMLElement | undefined>();
|
|
@@ -72,12 +79,21 @@ export default defineComponent({
|
|
|
72
79
|
{ immediate: true }
|
|
73
80
|
);
|
|
74
81
|
|
|
82
|
+
useProviderOioDefaultFormContext({
|
|
83
|
+
...formContext,
|
|
84
|
+
getTriggerContainer() {
|
|
85
|
+
return document.body;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
75
89
|
return {
|
|
76
90
|
...useModal(props, context),
|
|
77
91
|
id
|
|
78
92
|
};
|
|
79
93
|
},
|
|
80
94
|
render() {
|
|
95
|
+
const mainClassName = `${DEFAULT_PREFIX}-modal`;
|
|
96
|
+
|
|
81
97
|
const slots = PropRecordHelper.collectionSlots(this.$slots, [
|
|
82
98
|
{
|
|
83
99
|
origin: 'default',
|
|
@@ -105,28 +121,66 @@ export default defineComponent({
|
|
|
105
121
|
} else {
|
|
106
122
|
defaultSlot = () => finalDefaultSlot;
|
|
107
123
|
}
|
|
124
|
+
|
|
108
125
|
const isOverrideTitle = !!slots.header;
|
|
109
126
|
if (!isOverrideTitle) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
const originalTitleSlot = slots.title;
|
|
128
|
+
|
|
129
|
+
// 默认标题插槽
|
|
130
|
+
const createDefaultTitle = () => [createVNode('span', {}, this.$translate(this.title || '弹窗'))];
|
|
131
|
+
|
|
132
|
+
slots.title = () => {
|
|
133
|
+
// 获取原始或默认的标题插槽
|
|
134
|
+
const originalSlot = [...(originalTitleSlot?.() || createDefaultTitle())];
|
|
135
|
+
|
|
136
|
+
if (this.help) {
|
|
137
|
+
originalSlot.push(
|
|
138
|
+
createVNode(OioTooltip, {
|
|
139
|
+
content: this.help
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 控制图标
|
|
145
|
+
const controlIcons = [
|
|
146
|
+
this.showPopupToggle &&
|
|
147
|
+
!this.isFullScreen &&
|
|
148
|
+
createVNode(OioIcon, {
|
|
149
|
+
style: { cursor: 'pointer' },
|
|
150
|
+
icon: this.displayAs === PopupDisplayAs.modal ? 'oinone-drawer' : 'oinone-dialog',
|
|
151
|
+
size: 16,
|
|
152
|
+
onClick: withModifiers(this.onDisplayAsSwitch, ['stop'])
|
|
153
|
+
}),
|
|
154
|
+
this.enabledFullScreen &&
|
|
155
|
+
createVNode(OioIcon, {
|
|
156
|
+
style: { cursor: 'pointer' },
|
|
157
|
+
icon: this.isFullScreen ? 'oinone-suoxiao1' : 'oinone-fangda2',
|
|
158
|
+
size: 16,
|
|
159
|
+
onClick: withModifiers(this.onFullSwitch, ['stop'])
|
|
160
|
+
})
|
|
161
|
+
].filter(Boolean);
|
|
162
|
+
|
|
163
|
+
// 包装控制区域
|
|
164
|
+
if (controlIcons.length > 0) {
|
|
165
|
+
originalSlot.push(
|
|
166
|
+
createVNode(
|
|
167
|
+
'div',
|
|
168
|
+
{
|
|
169
|
+
class: `${mainClassName}-title-extend`
|
|
170
|
+
},
|
|
171
|
+
controlIcons
|
|
172
|
+
)
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return originalSlot;
|
|
177
|
+
};
|
|
124
178
|
}
|
|
179
|
+
|
|
125
180
|
if (!slots.closeIcon) {
|
|
126
181
|
slots.closeIcon = () => [createVNode(OioCloseIcon)];
|
|
127
182
|
}
|
|
128
183
|
|
|
129
|
-
const mainClassName = `${DEFAULT_PREFIX}-modal`;
|
|
130
184
|
const classNames = [mainClassName];
|
|
131
185
|
if (this.widthClassSuffix) {
|
|
132
186
|
classNames.push(`${mainClassName}-width-${this.widthClassSuffix}`);
|
|
@@ -134,30 +188,31 @@ export default defineComponent({
|
|
|
134
188
|
if (this.heightClassSuffix) {
|
|
135
189
|
classNames.push(`${mainClassName}-height-${this.heightClassSuffix}`);
|
|
136
190
|
}
|
|
137
|
-
|
|
138
|
-
if (this.customHeightClassSuffix) {
|
|
139
|
-
classNames.push(`${mainClassName}-height-${this.customHeightClassSuffix}`);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
191
|
if (this.headerInvisible) {
|
|
143
192
|
classNames.push(`${mainClassName}-header-invisible`);
|
|
144
193
|
}
|
|
145
194
|
if (this.footerInvisible) {
|
|
146
195
|
classNames.push(`${mainClassName}-footer-invisible`);
|
|
147
196
|
}
|
|
197
|
+
|
|
198
|
+
const style = {} as CSSStyle;
|
|
199
|
+
if (!this.heightClassSuffix && this.height) {
|
|
200
|
+
classNames.push(`${mainClassName}-height-custom`);
|
|
201
|
+
style[`--${mainClassName}-custom-height`] = StyleHelper.px(this.height)!;
|
|
202
|
+
}
|
|
203
|
+
|
|
148
204
|
return createVNode(
|
|
149
205
|
AModal,
|
|
150
206
|
{
|
|
151
|
-
...PropRecordHelper.collectionBasicProps(this.$attrs, classNames),
|
|
207
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs, classNames, style),
|
|
152
208
|
mask: this.mask,
|
|
153
209
|
maskClosable: this.headerInvisible ? true : this.maskClosable,
|
|
154
|
-
width:
|
|
155
|
-
wrapClassName: StringHelper.append(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
},
|
|
210
|
+
width: this.width,
|
|
211
|
+
wrapClassName: StringHelper.append(
|
|
212
|
+
[`${mainClassName}-wrapper`],
|
|
213
|
+
CastHelper.cast(this.wrapperClassName),
|
|
214
|
+
this.drawerModalClassName
|
|
215
|
+
).join(' '),
|
|
161
216
|
wrapProps: {
|
|
162
217
|
...(this.wrapperProps || {}),
|
|
163
218
|
id: this.id
|