@jetlinks-web/components 1.0.5 → 2.0.1
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 +11 -8
- 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,106 @@
|
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import type { Theme, ContentWidth } from './typings';
|
|
3
|
+
|
|
4
|
+
export interface RenderSetting {
|
|
5
|
+
headerRender?: false;
|
|
6
|
+
menuRender?: false;
|
|
7
|
+
menuHeaderRender?: false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface DefaultSettingProps {
|
|
11
|
+
theme?: Theme;
|
|
12
|
+
/**
|
|
13
|
+
* 自定义页眉高度
|
|
14
|
+
*/
|
|
15
|
+
headerHeight?: number;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
layout: 'side' | 'top' | 'mix';
|
|
20
|
+
|
|
21
|
+
contentWidth: ContentWidth;
|
|
22
|
+
/**
|
|
23
|
+
* sticky header
|
|
24
|
+
*/
|
|
25
|
+
fixedHeader: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* sticky siderbar
|
|
28
|
+
*/
|
|
29
|
+
fixSiderbar: boolean;
|
|
30
|
+
menu: { locale?: boolean; defaultOpenAll?: boolean };
|
|
31
|
+
title: string;
|
|
32
|
+
// Your custom iconfont Symbol script Url
|
|
33
|
+
// eg://at.alicdn.com/t/font_1039637_btcrd5co4w.js
|
|
34
|
+
// 注意:如果需要图标多色,Iconfont 图标项目里要进行批量去色处理
|
|
35
|
+
// Usage: https://github.com/ant-design/ant-design-pro/pull/3517
|
|
36
|
+
iconfontUrl: string;
|
|
37
|
+
primaryColor: string;
|
|
38
|
+
colorWeak?: boolean;
|
|
39
|
+
splitMenus?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type ProSettings = DefaultSettingProps & RenderSetting;
|
|
43
|
+
|
|
44
|
+
export const defaultSettings = {
|
|
45
|
+
theme: 'light',
|
|
46
|
+
layout: 'mix',
|
|
47
|
+
contentWidth: 'Fluid',
|
|
48
|
+
fixedHeader: true,
|
|
49
|
+
fixSiderbar: true,
|
|
50
|
+
menu: {
|
|
51
|
+
locale: true,
|
|
52
|
+
},
|
|
53
|
+
headerHeight: 48,
|
|
54
|
+
title: 'Jetlink UI Components',
|
|
55
|
+
iconfontUrl: '',
|
|
56
|
+
primaryColor: '#315EFB',
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const defaultSettingProps = {
|
|
60
|
+
theme: {
|
|
61
|
+
type: String as PropType<DefaultSettingProps['theme']>,
|
|
62
|
+
default: defaultSettings.theme,
|
|
63
|
+
},
|
|
64
|
+
layout: {
|
|
65
|
+
type: String as PropType<DefaultSettingProps['layout']>,
|
|
66
|
+
default: defaultSettings.layout,
|
|
67
|
+
},
|
|
68
|
+
contentWidth: {
|
|
69
|
+
type: String as PropType<DefaultSettingProps['contentWidth']>,
|
|
70
|
+
default: defaultSettings.contentWidth,
|
|
71
|
+
},
|
|
72
|
+
fixedHeader: {
|
|
73
|
+
type: Boolean as PropType<DefaultSettingProps['fixedHeader']>,
|
|
74
|
+
default: defaultSettings.fixedHeader,
|
|
75
|
+
},
|
|
76
|
+
fixSiderbar: {
|
|
77
|
+
type: Boolean as PropType<DefaultSettingProps['fixSiderbar']>,
|
|
78
|
+
default: defaultSettings.fixSiderbar,
|
|
79
|
+
},
|
|
80
|
+
menu: {
|
|
81
|
+
type: Object as PropType<DefaultSettingProps['menu']>,
|
|
82
|
+
default: () => {
|
|
83
|
+
return {
|
|
84
|
+
locale: true,
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
headerHeight: {
|
|
89
|
+
type: Number as PropType<DefaultSettingProps['headerHeight']>,
|
|
90
|
+
default: defaultSettings.headerHeight,
|
|
91
|
+
},
|
|
92
|
+
title: {
|
|
93
|
+
type: String as PropType<DefaultSettingProps['title']>,
|
|
94
|
+
default: () => defaultSettings.title,
|
|
95
|
+
},
|
|
96
|
+
iconfontUrl: {
|
|
97
|
+
type: String as PropType<DefaultSettingProps['iconfontUrl']>,
|
|
98
|
+
default: () => defaultSettings.iconfontUrl,
|
|
99
|
+
},
|
|
100
|
+
primaryColor: {
|
|
101
|
+
type: String as PropType<DefaultSettingProps['primaryColor']>,
|
|
102
|
+
default: () => defaultSettings.primaryColor,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type ProSettingsProps = ExtractPropTypes<typeof defaultSettingProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.less';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { VNode } from 'vue';
|
|
2
|
+
import type { BreadcrumbProps } from './RouteContext';
|
|
3
|
+
import type { VueNode } from 'ant-design-vue/lib/_util/type';
|
|
4
|
+
|
|
5
|
+
export type Theme = 'dark' | 'light';
|
|
6
|
+
export type LayoutType = 'side' | 'top' | 'mix';
|
|
7
|
+
export type TargetType = '_blank' | '_self' | unknown;
|
|
8
|
+
export type ProProps = Record<never, never>;
|
|
9
|
+
export type ContentWidth = 'Fluid' | 'Fixed';
|
|
10
|
+
|
|
11
|
+
export interface MetaRecord {
|
|
12
|
+
/**
|
|
13
|
+
* @name 菜单的icon
|
|
14
|
+
*/
|
|
15
|
+
icon?: string | VNode;
|
|
16
|
+
/**
|
|
17
|
+
* @name 自定义菜单的国际化 key,如果没有则返回自身
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @name 打开目标位置 '_blank' | '_self' | null | undefined
|
|
22
|
+
*/
|
|
23
|
+
target?: TargetType;
|
|
24
|
+
/**
|
|
25
|
+
* @name 在菜单中隐藏子节点
|
|
26
|
+
*/
|
|
27
|
+
hideChildInMenu?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @name 在菜单中隐藏自己和子节点
|
|
30
|
+
*/
|
|
31
|
+
hideInMenu?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @name disable 菜单选项
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* @name 隐藏自己,并且将子节点提升到与自己平级
|
|
38
|
+
*/
|
|
39
|
+
flatMenu?: boolean;
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface MenuDataItem {
|
|
46
|
+
/**
|
|
47
|
+
* @name 用于标定选中的值,默认是 path
|
|
48
|
+
*/
|
|
49
|
+
path: string;
|
|
50
|
+
name?: string | symbol;
|
|
51
|
+
meta?: MetaRecord;
|
|
52
|
+
/**
|
|
53
|
+
* @name 子菜单
|
|
54
|
+
*/
|
|
55
|
+
children?: MenuDataItem[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type WithFalse<T> = T | false;
|
|
59
|
+
|
|
60
|
+
export type FormatMessage = (message?: string) => string;
|
|
61
|
+
|
|
62
|
+
export type BreadcrumbRender = BreadcrumbProps['itemRender'];
|
|
63
|
+
export type HeaderContentRender = WithFalse<() => VueNode>;
|
|
64
|
+
export type HeaderRender = WithFalse<(props: ProProps) => VueNode>;
|
|
65
|
+
export type RightContentRender = WithFalse<(props: ProProps) => VueNode>;
|
|
66
|
+
export type MenuItemRender = WithFalse<
|
|
67
|
+
(args: {
|
|
68
|
+
item: MenuDataItem;
|
|
69
|
+
title?: JSX.Element;
|
|
70
|
+
icon?: JSX.Element;
|
|
71
|
+
}) => VueNode
|
|
72
|
+
>;
|
|
73
|
+
export type SubMenuItemRender = WithFalse<
|
|
74
|
+
(args: { item: MenuDataItem; children?: VueNode[] }) => VueNode
|
|
75
|
+
>;
|
|
76
|
+
export type MenuHeaderRender = WithFalse<
|
|
77
|
+
(logo: VueNode, title: VueNode, props?: ProProps) => VueNode
|
|
78
|
+
>;
|
|
79
|
+
export type MenuContentRender = WithFalse<
|
|
80
|
+
(props: ProProps, defaultDom: VueNode) => VueNode
|
|
81
|
+
>;
|
|
82
|
+
export type MenuExtraRender = WithFalse<(props?: ProProps) => VueNode>;
|
|
83
|
+
export type LogoRender = WithFalse<VueNode>;
|
|
84
|
+
|
|
85
|
+
export type CollapsedButtonRender = WithFalse<(collapsed?: boolean) => VueNode>;
|
|
86
|
+
export type DefaultPropRender = WithFalse<VueNode>;
|
|
87
|
+
export type PageHeaderRender = WithFalse<(props?: ProProps) => VueNode>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { RouteRecord, RouteRecordRaw } from "vue-router";
|
|
2
|
+
import type { MenuDataItem } from "./typings";
|
|
3
|
+
import type { Slots } from "vue"
|
|
4
|
+
|
|
5
|
+
export function clearMenuItem(menusData: RouteRecord[] | RouteRecordRaw[]): RouteRecordRaw[] {
|
|
6
|
+
return menusData
|
|
7
|
+
.map((item: RouteRecord | RouteRecordRaw) => {
|
|
8
|
+
const finalItem = {...item};
|
|
9
|
+
if (finalItem.meta?.hideInMenu) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (finalItem && finalItem?.children) {
|
|
14
|
+
if (
|
|
15
|
+
!finalItem.meta?.hideChildInMenu &&
|
|
16
|
+
finalItem.children.some(
|
|
17
|
+
(child: RouteRecord | RouteRecordRaw) => child && child.name && !child.meta?.hideInMenu
|
|
18
|
+
)
|
|
19
|
+
) {
|
|
20
|
+
return {
|
|
21
|
+
...item,
|
|
22
|
+
children: clearMenuItem(finalItem.children),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
delete finalItem.children;
|
|
26
|
+
}
|
|
27
|
+
return finalItem;
|
|
28
|
+
})
|
|
29
|
+
.filter((item) => item) as RouteRecordRaw[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function flatMap(menusData: RouteRecord[]): MenuDataItem[] {
|
|
33
|
+
return menusData
|
|
34
|
+
.map((item) => {
|
|
35
|
+
const finalItem = {...item} as MenuDataItem;
|
|
36
|
+
if (!finalItem.name || finalItem.meta?.hideInMenu) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (finalItem.children) {
|
|
40
|
+
delete finalItem.children;
|
|
41
|
+
}
|
|
42
|
+
return finalItem;
|
|
43
|
+
})
|
|
44
|
+
.filter((item) => item) as MenuDataItem[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getMenuFirstChildren(menus: MenuDataItem[], key?: string) {
|
|
48
|
+
return key === undefined ? [] : (menus[menus.findIndex((menu) => menu.path === key)] || {}).children || [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function getSlot<T>(slots: Slots, props: Record<string, unknown>, prop = 'default'): T | false {
|
|
52
|
+
if (props[prop] === false) {
|
|
53
|
+
// force not render
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return (props[prop] || slots[prop]) as T;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop = 'default'): T | false {
|
|
60
|
+
if (props[prop] === false) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return (props[prop] || slots[prop]?.()) as T;
|
|
64
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: Components
|
|
3
|
+
subtitle: 表格
|
|
4
|
+
cols: 1
|
|
5
|
+
type: 高阶组件
|
|
6
|
+
title: ProTable
|
|
7
|
+
# cover: https://gw.alipayobjects.com/zos/alicdn/1vqv2bj68/Pagination.svg
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## API
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<j-pro-table />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Table
|
|
17
|
+
|
|
18
|
+
该属性参考 ant-design-vue 的 [Table](https://www.antdv.com/components/table-cn#Table)
|
|
19
|
+
|
|
20
|
+
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
21
|
+
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ------ | ---- |
|
|
22
|
+
| request | 请求数据的 api | promise | - | |
|
|
23
|
+
| loading | 控制loading | boolean | undefined | |
|
|
24
|
+
| columns | 表格列的配置描述 | array | - | |
|
|
25
|
+
| params | 搜索参数 | object | {} | |
|
|
26
|
+
| type | 表格的类型 | `TREE`\| `PAGE` | 'PAGE' | |
|
|
27
|
+
| noPagination | 是否显示分页 | boolean | trues | |
|
|
28
|
+
| rowSelection | 列表项是否可选择 | object | - | |
|
|
29
|
+
| dataSource | 数据数组 | object\[] | | |
|
|
30
|
+
| gridColumns | 用于不同分辨率下展示的卡片数量的展示,gridColumns\[0] 1366 ~ 1440 分辨率,gridColumns\[1] 1440 ~ 1600 分辨率, gridColumns\[2] > 1600 分辨率 | number[] | - | |
|
|
31
|
+
| gridColumn | 每行展示的卡片数量 | number | - | |
|
|
32
|
+
| alertRender | 是否展示上方选择提示框 | boolean | true | |
|
|
33
|
+
| defaultParams | 默认参数 | object | {} | |
|
|
34
|
+
| bodyStyle | 内容区域自定义样式 | object | - | |
|
|
35
|
+
| card | 卡片插槽 | slot | - | |
|
|
36
|
+
| headerTitle | type 为`PAGE`和`TREE`时顶部左边插槽 | slot | - | |
|
|
37
|
+
| rightExtraRender | type 为`PAGE`和`TREE`时顶部右边插槽 | slot | - | |
|
|
38
|
+
| paginationRender | 分页插槽 | slot | - | |
|
|
39
|
+
|
|
40
|
+
### Column
|
|
41
|
+
|
|
42
|
+
该属性参考 ant-design-vue 的 [Column](https://www.antdv.com/components/table-cn#Column).
|
|
43
|
+
|
|
44
|
+
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
|
45
|
+
| ----------- | ---------------- | ------- | ------ | ---- |
|
|
46
|
+
| scopedSlots | 是否为插槽 | boolean | false | |
|
|
47
|
+
| hideInTable | 是否在表格中隐藏 | boolean | - | |
|
|
48
|
+
|
|
49
|
+
### 事件
|
|
50
|
+
|
|
51
|
+
| 事件名称 | 说明 | 回调参数 | 版本 | |
|
|
52
|
+
| ------------ | -------- | ---------- | ---- | --- |
|
|
53
|
+
| cancelSelect | 取消选择 | () => void | - | |
|