@jetlinks-web/components 1.0.5 → 2.0.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/index.ts +54 -15
- package/package.json +9 -6
- package/src/AMap/Map.vue +110 -107
- package/src/BadgeStatus/Badge.vue +41 -40
- package/src/BadgeStatus/color.ts +25 -23
- package/src/CardSelect/CardSelect.vue +136 -0
- package/src/CardSelect/index.ts +3 -0
- package/src/CheckButton/CheckButton.vue +146 -0
- package/src/CheckButton/index.md +27 -0
- package/src/CheckButton/index.ts +3 -0
- package/src/ConfigProvider/context.ts +17 -0
- package/src/ConfigProvider/index.tsx +42 -0
- package/src/Echarts/Echarts.vue +43 -43
- package/src/Ellipsis/Ellipsis.vue +182 -0
- package/src/Ellipsis/index.ts +3 -0
- package/src/Empty/Empty.vue +43 -0
- package/src/Empty/image.ts +3 -0
- package/src/Empty/index.ts +2 -0
- package/src/FullPage/{index.vue → FullPage.vue} +30 -27
- package/src/FullPage/index.ts +3 -0
- package/src/Icon/icon.tsx +40 -0
- package/src/Icon/index.ts +3 -0
- package/src/MonacoEditor/Monaco.vue +242 -0
- package/src/MonacoEditor/index.md +26 -0
- package/src/MonacoEditor/index.ts +2 -0
- package/src/PermissionButton/index.tsx +95 -92
- package/src/ProLayout/Basic/BasicLayout.less +66 -0
- package/src/ProLayout/Basic/BasicLayout.tsx +392 -0
- package/src/ProLayout/Basic/Header.less +8 -0
- package/src/ProLayout/Basic/Header.tsx +115 -0
- package/src/ProLayout/PageContainer/index.less +103 -0
- package/src/ProLayout/PageContainer/index.tsx +441 -0
- package/src/ProLayout/PageContainer/typings.ts +56 -0
- package/src/ProLayout/RouteContext.ts +87 -0
- package/src/ProLayout/SiderMenu/BaseMenu.tsx +296 -0
- package/src/ProLayout/SiderMenu/SiderMenu.tsx +320 -0
- package/src/ProLayout/SiderMenu/index.less +212 -0
- package/src/ProLayout/SiderMenu/index.ts +2 -0
- package/src/ProLayout/SiderMenu/typings.ts +49 -0
- package/src/ProLayout/TopHeader/index.less +174 -0
- package/src/ProLayout/TopHeader/index.tsx +210 -0
- package/src/ProLayout/defaultSettings.ts +106 -0
- package/src/ProLayout/index.ts +6 -0
- package/src/ProLayout/style/default.less +4 -0
- package/src/ProLayout/style/index.ts +1 -0
- package/src/ProLayout/style/style.less +7 -0
- package/src/ProLayout/typings.ts +87 -0
- package/src/ProLayout/util.ts +64 -0
- package/src/ProTable/index.md +53 -0
- package/src/ProTable/index.tsx +551 -0
- package/src/ProTable/proTableTypes.ts +70 -0
- package/src/ProTable/style/index.less +92 -0
- package/src/ProTable/style/index.ts +1 -0
- package/src/Scrollbar/Bar.vue +75 -0
- package/src/Scrollbar/Scrollbar.vue +260 -0
- package/src/Scrollbar/Thumb.vue +163 -0
- package/src/Scrollbar/constants.ts +10 -0
- package/src/Scrollbar/index.ts +4 -0
- package/src/Scrollbar/scrollbar.ts +108 -0
- package/src/Scrollbar/thumb.ts +16 -0
- package/src/Scrollbar/util.ts +38 -0
- package/src/Search/Advanced/History.vue +140 -0
- package/src/Search/Advanced/SaveHistory.vue +108 -0
- package/src/Search/Advanced/index.vue +435 -0
- package/src/Search/Item.vue +525 -0
- package/src/Search/Search.vue +398 -0
- package/src/Search/hooks/index.ts +1 -0
- package/src/Search/hooks/useSearchItems.ts +68 -0
- package/src/Search/index.md +57 -0
- package/src/Search/index.ts +5 -0
- package/src/Search/setting.ts +55 -0
- package/src/Search/typing.ts +76 -0
- package/src/Search/util.ts +263 -0
- package/src/ValueItem/ValueItem.vue +50 -35
- package/src/ValueItem/util.ts +2 -1
- package/src/style/index.ts +3 -0
- package/src/style/variable.less +4 -0
- package/src/GeoComponent/GeoComponent.vue +0 -139
- package/src/GeoComponent/index.ts +0 -3
- package/src/PermissionButton/hooks.ts +0 -20
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BreadcrumbRender,
|
|
3
|
+
FormatMessage,
|
|
4
|
+
HeaderContentRender,
|
|
5
|
+
WithFalse,
|
|
6
|
+
HeaderRender,
|
|
7
|
+
RightContentRender,
|
|
8
|
+
CollapsedButtonRender,
|
|
9
|
+
MenuExtraRender,
|
|
10
|
+
SubMenuItemRender,
|
|
11
|
+
MenuContentRender,
|
|
12
|
+
MenuItemRender,
|
|
13
|
+
MenuHeaderRender,
|
|
14
|
+
} from '../typings';
|
|
15
|
+
import SiderMenu, { siderMenuProps } from '../SiderMenu/SiderMenu';
|
|
16
|
+
import type { CSSProperties, ExtractPropTypes, PropType } from 'vue';
|
|
17
|
+
import {
|
|
18
|
+
computed,
|
|
19
|
+
defineComponent,
|
|
20
|
+
provide,
|
|
21
|
+
reactive,
|
|
22
|
+
watchEffect,
|
|
23
|
+
toRefs,
|
|
24
|
+
} from 'vue';
|
|
25
|
+
import { defaultSettingProps } from '../defaultSettings';
|
|
26
|
+
import { baseHeaderProps } from '../TopHeader';
|
|
27
|
+
import Header, { headerViewProps } from './Header';
|
|
28
|
+
import type { VueNode } from 'ant-design-vue/lib/_util/type';
|
|
29
|
+
import useConfigInject from 'ant-design-vue/lib/_util/hooks/useConfigInject';
|
|
30
|
+
import type { BreadcrumbProps, RouteContextProps } from '../RouteContext';
|
|
31
|
+
import { pick } from 'lodash-es';
|
|
32
|
+
import { defaultRouteContext, routeContextInjectKey } from '../RouteContext';
|
|
33
|
+
import { getMenuFirstChildren, getSlot } from '../util';
|
|
34
|
+
import { Layout, LayoutContent } from 'ant-design-vue';
|
|
35
|
+
|
|
36
|
+
export const basicLayoutProps = {
|
|
37
|
+
...defaultSettingProps,
|
|
38
|
+
...siderMenuProps,
|
|
39
|
+
...baseHeaderProps,
|
|
40
|
+
...headerViewProps,
|
|
41
|
+
|
|
42
|
+
pure: Boolean,
|
|
43
|
+
loading: Boolean,
|
|
44
|
+
locale: {
|
|
45
|
+
type: [Function, Boolean] as PropType<WithFalse<FormatMessage>>,
|
|
46
|
+
default() {
|
|
47
|
+
return (s: string) => s;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* 是否禁用移动端模式,有的管理系统不需要移动端模式,此属性设置为true即可
|
|
52
|
+
*/
|
|
53
|
+
disableMobile: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
required: false,
|
|
56
|
+
},
|
|
57
|
+
isChildrenLayout: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* 兼用 content 的 margin
|
|
63
|
+
*/
|
|
64
|
+
disableContentMargin: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
required: false,
|
|
67
|
+
},
|
|
68
|
+
colSize: {
|
|
69
|
+
type: Number,
|
|
70
|
+
required: false,
|
|
71
|
+
},
|
|
72
|
+
contentStyle: {
|
|
73
|
+
type: [String, Object] as PropType<CSSProperties>,
|
|
74
|
+
default: () => {
|
|
75
|
+
return null;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
breadcrumb: {
|
|
79
|
+
type: [Object, Function] as PropType<BreadcrumbProps>,
|
|
80
|
+
default: () => null,
|
|
81
|
+
},
|
|
82
|
+
collapsedButtonRender: {
|
|
83
|
+
type: [Function, Object, Boolean] as PropType<
|
|
84
|
+
WithFalse<(collapsed?: boolean) => VueNode>
|
|
85
|
+
>,
|
|
86
|
+
default: () => undefined,
|
|
87
|
+
},
|
|
88
|
+
breadcrumbRender: {
|
|
89
|
+
type: [Object, Function, Boolean] as PropType<BreadcrumbRender>,
|
|
90
|
+
default() {
|
|
91
|
+
return null;
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
headerContentRender: {
|
|
95
|
+
type: [Function, Object, Boolean] as PropType<HeaderContentRender>,
|
|
96
|
+
default: () => undefined,
|
|
97
|
+
},
|
|
98
|
+
headerRender: {
|
|
99
|
+
type: [Object, Function, Boolean] as PropType<HeaderRender>,
|
|
100
|
+
default: () => undefined,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export type BasicLayoutProps = Partial<
|
|
105
|
+
ExtractPropTypes<typeof basicLayoutProps>
|
|
106
|
+
>;
|
|
107
|
+
|
|
108
|
+
export default defineComponent({
|
|
109
|
+
name: 'JProLayout',
|
|
110
|
+
inheritAttrs: false,
|
|
111
|
+
props: basicLayoutProps,
|
|
112
|
+
emits: [
|
|
113
|
+
'update:collapsed',
|
|
114
|
+
'update:open-keys',
|
|
115
|
+
'update:selected-keys',
|
|
116
|
+
'collapse',
|
|
117
|
+
'openKeys',
|
|
118
|
+
'select',
|
|
119
|
+
'menuHeaderClick',
|
|
120
|
+
'menuClick',
|
|
121
|
+
'backClick',
|
|
122
|
+
],
|
|
123
|
+
setup(props, { emit, attrs, slots }) {
|
|
124
|
+
const { prefixCls } = useConfigInject('layout', {});
|
|
125
|
+
const isTop = computed(() => props.layout === 'top');
|
|
126
|
+
const hasSide = computed(
|
|
127
|
+
() => props.layout === 'mix' || props.layout === 'side' || false,
|
|
128
|
+
);
|
|
129
|
+
const hasSplitMenu = computed(
|
|
130
|
+
() => props.layout === 'mix' && props.splitMenus,
|
|
131
|
+
);
|
|
132
|
+
const hasFlatMenu = computed(() => {
|
|
133
|
+
return hasSide.value && hasSplitMenu.value;
|
|
134
|
+
});
|
|
135
|
+
const siderWidth = computed(() =>
|
|
136
|
+
props.collapsed ? props.collapsedWidth : props.siderWidth,
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const onCollapse = (collapsed: boolean) => {
|
|
140
|
+
emit('update:collapsed', collapsed);
|
|
141
|
+
emit('collapse', collapsed);
|
|
142
|
+
};
|
|
143
|
+
const onOpenKeys = (openKeys: string[] | false) => {
|
|
144
|
+
emit('update:open-keys', openKeys);
|
|
145
|
+
emit('openKeys', openKeys);
|
|
146
|
+
};
|
|
147
|
+
const onSelect = (selectedKeys: string[] | false) => {
|
|
148
|
+
emit('update:selected-keys', selectedKeys);
|
|
149
|
+
emit('select', selectedKeys);
|
|
150
|
+
};
|
|
151
|
+
const onMenuHeaderClick = (e: MouseEvent) => {
|
|
152
|
+
emit('menuHeaderClick', e);
|
|
153
|
+
};
|
|
154
|
+
const onMenuClick = (args: any) => {
|
|
155
|
+
emit('menuClick', args);
|
|
156
|
+
};
|
|
157
|
+
const onBack = (args: any) => {
|
|
158
|
+
emit('backClick', args);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const baseClassName = computed(() => `${props.prefixCls}-basicLayout`);
|
|
162
|
+
|
|
163
|
+
const className = computed(() => {
|
|
164
|
+
return {
|
|
165
|
+
[baseClassName.value]: true,
|
|
166
|
+
[`${baseClassName.value}-top-menu`]: isTop.value,
|
|
167
|
+
[`${baseClassName.value}-is-children`]: props.isChildrenLayout,
|
|
168
|
+
[`${baseClassName.value}-fix-siderbar`]: props.fixSiderbar,
|
|
169
|
+
[`${baseClassName.value}-${props.layout}`]: props.layout,
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const genLayoutStyle = reactive<CSSProperties>({
|
|
174
|
+
position: 'relative',
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
watchEffect(() => {
|
|
178
|
+
if (
|
|
179
|
+
props.isChildrenLayout ||
|
|
180
|
+
(props.contentStyle && props.contentStyle.minHeight)
|
|
181
|
+
) {
|
|
182
|
+
genLayoutStyle.minHeight = 0;
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const headerRender = (
|
|
187
|
+
p: BasicLayoutProps & {
|
|
188
|
+
hasSiderMenu: boolean;
|
|
189
|
+
headerRender: HeaderRender;
|
|
190
|
+
rightContentRender: RightContentRender;
|
|
191
|
+
},
|
|
192
|
+
matchMenuKeys?: string[],
|
|
193
|
+
): VueNode | null => {
|
|
194
|
+
if (p.headerRender === false || p.pure) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return <Header {...p} matchMenuKeys={matchMenuKeys || []} />;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const breadcrumb = computed<BreadcrumbProps>(() => ({
|
|
201
|
+
...props.breadcrumb,
|
|
202
|
+
itemRender: getSlot<BreadcrumbRender>(
|
|
203
|
+
slots,
|
|
204
|
+
props,
|
|
205
|
+
'breadcrumbRender',
|
|
206
|
+
) as BreadcrumbRender,
|
|
207
|
+
}));
|
|
208
|
+
|
|
209
|
+
const flatMenuData = computed(
|
|
210
|
+
() =>
|
|
211
|
+
(hasFlatMenu.value &&
|
|
212
|
+
props.selectedKeys &&
|
|
213
|
+
getMenuFirstChildren(
|
|
214
|
+
props.menuData,
|
|
215
|
+
props.selectedKeys[0],
|
|
216
|
+
)) ||
|
|
217
|
+
[],
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const routeContext = reactive<RouteContextProps>({
|
|
221
|
+
...defaultRouteContext,
|
|
222
|
+
...(pick(toRefs(props), [
|
|
223
|
+
'pure',
|
|
224
|
+
'locale',
|
|
225
|
+
'menuData',
|
|
226
|
+
'openKeys',
|
|
227
|
+
'selectedKeys',
|
|
228
|
+
'contentWidth',
|
|
229
|
+
'disableMobile',
|
|
230
|
+
'fixSiderbar',
|
|
231
|
+
'fixedHeader',
|
|
232
|
+
'headerHeight',
|
|
233
|
+
]) as any),
|
|
234
|
+
siderWidth,
|
|
235
|
+
breadcrumb,
|
|
236
|
+
flatMenuData,
|
|
237
|
+
hasSide,
|
|
238
|
+
back: onBack,
|
|
239
|
+
hasHeader: true,
|
|
240
|
+
flatMenu: hasFlatMenu,
|
|
241
|
+
});
|
|
242
|
+
provide(routeContextInjectKey, routeContext);
|
|
243
|
+
|
|
244
|
+
return () => {
|
|
245
|
+
const {
|
|
246
|
+
pure,
|
|
247
|
+
onCollapse: propsOnCollapse,
|
|
248
|
+
onOpenKeys: propsOnOpenKeys,
|
|
249
|
+
onSelect: propsOnSelect,
|
|
250
|
+
onMenuClick: propsOnMenuClick,
|
|
251
|
+
...restProps
|
|
252
|
+
} = props;
|
|
253
|
+
|
|
254
|
+
const collapsedButtonRender = getSlot<CollapsedButtonRender>(
|
|
255
|
+
slots,
|
|
256
|
+
props,
|
|
257
|
+
'collapsedButtonRender',
|
|
258
|
+
);
|
|
259
|
+
const headerContentRender = getSlot<HeaderContentRender>(
|
|
260
|
+
slots,
|
|
261
|
+
props,
|
|
262
|
+
'headerContentRender',
|
|
263
|
+
);
|
|
264
|
+
const rightContentRender = getSlot<RightContentRender>(
|
|
265
|
+
slots,
|
|
266
|
+
props,
|
|
267
|
+
'rightContentRender',
|
|
268
|
+
);
|
|
269
|
+
const customHeaderRender = getSlot<HeaderRender>(
|
|
270
|
+
slots,
|
|
271
|
+
props,
|
|
272
|
+
'headerRender',
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
// menu
|
|
276
|
+
const menuHeaderRender = getSlot<MenuHeaderRender>(
|
|
277
|
+
slots,
|
|
278
|
+
props,
|
|
279
|
+
'menuHeaderRender',
|
|
280
|
+
);
|
|
281
|
+
const menuExtraRender = getSlot<MenuExtraRender>(
|
|
282
|
+
slots,
|
|
283
|
+
props,
|
|
284
|
+
'menuExtraRender',
|
|
285
|
+
);
|
|
286
|
+
const menuContentRender = getSlot<MenuContentRender>(
|
|
287
|
+
slots,
|
|
288
|
+
props,
|
|
289
|
+
'menuContentRender',
|
|
290
|
+
);
|
|
291
|
+
const menuItemRender = getSlot<MenuItemRender>(
|
|
292
|
+
slots,
|
|
293
|
+
props,
|
|
294
|
+
'menuItemRender',
|
|
295
|
+
);
|
|
296
|
+
const subMenuItemRender = getSlot<SubMenuItemRender>(
|
|
297
|
+
slots,
|
|
298
|
+
props,
|
|
299
|
+
'subMenuItemRender',
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const headerDom = computed(() =>
|
|
303
|
+
headerRender(
|
|
304
|
+
{
|
|
305
|
+
...props,
|
|
306
|
+
menuItemRender,
|
|
307
|
+
subMenuItemRender,
|
|
308
|
+
hasSiderMenu: !isTop.value,
|
|
309
|
+
menuData: props.menuData,
|
|
310
|
+
onCollapse,
|
|
311
|
+
onOpenKeys,
|
|
312
|
+
onSelect,
|
|
313
|
+
onMenuHeaderClick,
|
|
314
|
+
rightContentRender,
|
|
315
|
+
collapsedButtonRender,
|
|
316
|
+
headerTitleRender: menuHeaderRender,
|
|
317
|
+
menuExtraRender,
|
|
318
|
+
menuContentRender,
|
|
319
|
+
headerContentRender,
|
|
320
|
+
headerRender: customHeaderRender,
|
|
321
|
+
theme: (props.theme || 'dark')
|
|
322
|
+
.toLocaleLowerCase()
|
|
323
|
+
.includes('dark')
|
|
324
|
+
? 'dark'
|
|
325
|
+
: 'light',
|
|
326
|
+
},
|
|
327
|
+
props.matchMenuKeys,
|
|
328
|
+
),
|
|
329
|
+
);
|
|
330
|
+
routeContext.hasHeader = !!headerDom.value;
|
|
331
|
+
|
|
332
|
+
const contentClassName = computed(() => {
|
|
333
|
+
return {
|
|
334
|
+
[`${baseClassName.value}-content`]: true,
|
|
335
|
+
[`${baseClassName.value}-has-header`]: headerDom,
|
|
336
|
+
[`${baseClassName.value}-content-disable-margin`]:
|
|
337
|
+
props.disableContentMargin,
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
return (
|
|
342
|
+
<>
|
|
343
|
+
{pure ? (
|
|
344
|
+
slots.default?.()
|
|
345
|
+
) : (
|
|
346
|
+
<div class={className.value}>
|
|
347
|
+
<Layout
|
|
348
|
+
style={{
|
|
349
|
+
minHeight: '100vh',
|
|
350
|
+
...((attrs.style as CSSProperties) || {}),
|
|
351
|
+
}}
|
|
352
|
+
>
|
|
353
|
+
{headerDom.value}
|
|
354
|
+
<Layout
|
|
355
|
+
style={genLayoutStyle}
|
|
356
|
+
class={prefixCls.value}
|
|
357
|
+
>
|
|
358
|
+
{!isTop.value && (
|
|
359
|
+
<SiderMenu
|
|
360
|
+
{...restProps}
|
|
361
|
+
menuHeaderRender={menuHeaderRender}
|
|
362
|
+
menuExtraRender={menuExtraRender}
|
|
363
|
+
menuContentRender={
|
|
364
|
+
menuContentRender
|
|
365
|
+
}
|
|
366
|
+
menuItemRender={menuItemRender}
|
|
367
|
+
subMenuItemRender={
|
|
368
|
+
subMenuItemRender
|
|
369
|
+
}
|
|
370
|
+
collapsedButtonRender={
|
|
371
|
+
collapsedButtonRender
|
|
372
|
+
}
|
|
373
|
+
onCollapse={onCollapse}
|
|
374
|
+
onSelect={onSelect}
|
|
375
|
+
onOpenKeys={onOpenKeys}
|
|
376
|
+
onMenuClick={onMenuClick}
|
|
377
|
+
/>
|
|
378
|
+
)}
|
|
379
|
+
<Layout>
|
|
380
|
+
<LayoutContent>
|
|
381
|
+
{slots.default?.()}
|
|
382
|
+
</LayoutContent>
|
|
383
|
+
</Layout>
|
|
384
|
+
</Layout>
|
|
385
|
+
</Layout>
|
|
386
|
+
</div>
|
|
387
|
+
)}
|
|
388
|
+
</>
|
|
389
|
+
);
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { baseHeaderProps, TopNavHeader } from '../TopHeader';
|
|
2
|
+
import type { BaseHeaderPropsType } from '../TopHeader';
|
|
3
|
+
import PropTypes from 'ant-design-vue/lib/_util/vue-types';
|
|
4
|
+
import type { VueNode } from 'ant-design-vue/lib/_util/type';
|
|
5
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
6
|
+
import { defineComponent, computed, toRefs } from 'vue';
|
|
7
|
+
import type { WithFalse } from '../typings';
|
|
8
|
+
import { useRouteContext } from '../RouteContext';
|
|
9
|
+
import { Layout } from 'ant-design-vue';
|
|
10
|
+
|
|
11
|
+
export const headerViewProps = {
|
|
12
|
+
...baseHeaderProps,
|
|
13
|
+
headerRender: {
|
|
14
|
+
type: [Object, Function, Boolean] as PropType<
|
|
15
|
+
WithFalse<(props: any, defaultDom: VueNode) => VueNode>
|
|
16
|
+
>,
|
|
17
|
+
default: () => undefined,
|
|
18
|
+
},
|
|
19
|
+
headerTitleRender: {
|
|
20
|
+
type: [Object, Function, Boolean] as PropType<
|
|
21
|
+
WithFalse<(props: any, defaultDom: VueNode) => VueNode>
|
|
22
|
+
>,
|
|
23
|
+
default: () => undefined,
|
|
24
|
+
},
|
|
25
|
+
headerContentRender: {
|
|
26
|
+
type: [Object, Function, Boolean] as PropType<
|
|
27
|
+
WithFalse<(props: any) => VueNode>
|
|
28
|
+
>,
|
|
29
|
+
default: () => undefined,
|
|
30
|
+
},
|
|
31
|
+
hasSiderMenu: PropTypes.looseBool,
|
|
32
|
+
siderWidth: PropTypes.number.def(208),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type HeaderViewProps = Partial<
|
|
36
|
+
ExtractPropTypes<typeof headerViewProps> & BaseHeaderPropsType
|
|
37
|
+
>;
|
|
38
|
+
|
|
39
|
+
export default defineComponent({
|
|
40
|
+
name: 'HeaderView',
|
|
41
|
+
inheritAttrs: false,
|
|
42
|
+
props: headerViewProps,
|
|
43
|
+
setup(props) {
|
|
44
|
+
const {
|
|
45
|
+
prefixCls,
|
|
46
|
+
fixedHeader,
|
|
47
|
+
hasSiderMenu,
|
|
48
|
+
headerHeight,
|
|
49
|
+
layout,
|
|
50
|
+
theme,
|
|
51
|
+
onCollapse,
|
|
52
|
+
} = toRefs(props);
|
|
53
|
+
const context = useRouteContext();
|
|
54
|
+
const needFixedHeader = computed(
|
|
55
|
+
() => fixedHeader.value || context.fixedHeader,
|
|
56
|
+
);
|
|
57
|
+
const isMix = computed(() => layout.value === 'mix');
|
|
58
|
+
const isTop = computed(() => layout.value === 'top');
|
|
59
|
+
const needSettingWidth = computed(
|
|
60
|
+
() => needFixedHeader.value && hasSiderMenu.value && !isTop.value,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const className = computed(() => {
|
|
64
|
+
return {
|
|
65
|
+
[`${prefixCls.value}-fixed-header`]: needFixedHeader.value,
|
|
66
|
+
[`${prefixCls.value}-top-menu`]: isTop.value,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const renderContent = () => {
|
|
71
|
+
const defaultDom = (
|
|
72
|
+
<TopNavHeader
|
|
73
|
+
theme={theme.value}
|
|
74
|
+
mode="horizontal"
|
|
75
|
+
{...props}
|
|
76
|
+
onCollapse={onCollapse.value}
|
|
77
|
+
menuData={context.menuData}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
if (props.headerRender) {
|
|
81
|
+
return props.headerRender(props, defaultDom);
|
|
82
|
+
}
|
|
83
|
+
return defaultDom;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const right = computed(() => (needFixedHeader.value ? 0 : undefined));
|
|
87
|
+
|
|
88
|
+
return () => (
|
|
89
|
+
<>
|
|
90
|
+
{needFixedHeader.value && (
|
|
91
|
+
<Layout.Header
|
|
92
|
+
style={{
|
|
93
|
+
height: `${headerHeight.value}px`,
|
|
94
|
+
lineHeight: `${headerHeight.value}px`,
|
|
95
|
+
background: 'transparent',
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
)}
|
|
99
|
+
<Layout.Header
|
|
100
|
+
style={{
|
|
101
|
+
padding: 0,
|
|
102
|
+
height: `${headerHeight.value}px`,
|
|
103
|
+
lineHeight: `${headerHeight.value}px`,
|
|
104
|
+
width: '100%',
|
|
105
|
+
zIndex: 100,
|
|
106
|
+
right: right.value,
|
|
107
|
+
}}
|
|
108
|
+
class={className.value}
|
|
109
|
+
>
|
|
110
|
+
{renderContent()}
|
|
111
|
+
</Layout.Header>
|
|
112
|
+
</>
|
|
113
|
+
);
|
|
114
|
+
},
|
|
115
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
@import '../style/default.less';
|
|
2
|
+
|
|
3
|
+
@pro-layout-page-container: ~'@{ant-prefix}-pro-page-container';
|
|
4
|
+
|
|
5
|
+
.@{pro-layout-page-container}-children-content {
|
|
6
|
+
margin: 24px 24px 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.@{pro-layout-page-container} {
|
|
10
|
+
&-warp {
|
|
11
|
+
background-color: @component-background;
|
|
12
|
+
.@{ant-prefix}-tabs-bar {
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
&-ghost {
|
|
17
|
+
.@{pro-layout-page-container}-warp {
|
|
18
|
+
background-color: @component-background;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.@{pro-layout-page-container}-main {
|
|
24
|
+
.@{pro-layout-page-container}-detail {
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.@{pro-layout-page-container}-row {
|
|
29
|
+
display: flex;
|
|
30
|
+
width: 100%;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.@{pro-layout-page-container}-title-content {
|
|
34
|
+
margin-bottom: 16px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.@{pro-layout-page-container}-title,
|
|
38
|
+
.@{pro-layout-page-container}-content {
|
|
39
|
+
flex: auto;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.@{pro-layout-page-container}-extraContent,
|
|
43
|
+
.@{pro-layout-page-container}-main {
|
|
44
|
+
flex: 0 1 auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.@{pro-layout-page-container}-main {
|
|
48
|
+
width: 100%;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.@{pro-layout-page-container}-title {
|
|
52
|
+
margin-bottom: 16px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.@{pro-layout-page-container}-logo {
|
|
56
|
+
margin-bottom: 16px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.@{pro-layout-page-container}-extraContent {
|
|
60
|
+
min-width: 242px;
|
|
61
|
+
margin-left: 88px;
|
|
62
|
+
text-align: right;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media screen and (max-width: @screen-xl) {
|
|
67
|
+
.@{pro-layout-page-container}-main {
|
|
68
|
+
.@{pro-layout-page-container}-extraContent {
|
|
69
|
+
margin-left: 44px;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media screen and (max-width: @screen-lg) {
|
|
75
|
+
.@{pro-layout-page-container}-main {
|
|
76
|
+
.@{pro-layout-page-container}-extraContent {
|
|
77
|
+
margin-left: 20px;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media screen and (max-width: @screen-md) {
|
|
83
|
+
.@{pro-layout-page-container}-main {
|
|
84
|
+
.@{pro-layout-page-container}-row {
|
|
85
|
+
display: block;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.@{pro-layout-page-container}-action,
|
|
89
|
+
.@{pro-layout-page-container}-extraContent {
|
|
90
|
+
margin-left: 0;
|
|
91
|
+
text-align: left;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media screen and (max-width: @screen-sm) {
|
|
97
|
+
.@{pro-layout-page-container}-detail {
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
.@{pro-layout-page-container}-extraContent {
|
|
101
|
+
margin-left: 0;
|
|
102
|
+
}
|
|
103
|
+
}
|