@jetlinks-web/components 1.0.4 → 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,16 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import type Thumb from './Thumb.vue'
|
|
3
|
+
|
|
4
|
+
export const thumbProps = {
|
|
5
|
+
vertical: Boolean,
|
|
6
|
+
size: String,
|
|
7
|
+
move: Number,
|
|
8
|
+
ratio: {
|
|
9
|
+
type: Number,
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
always: Boolean,
|
|
13
|
+
}
|
|
14
|
+
export type ThumbProps = ExtractPropTypes<typeof thumbProps>
|
|
15
|
+
|
|
16
|
+
export type ThumbInstance = InstanceType<typeof Thumb>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue'
|
|
2
|
+
import type { ThumbProps } from './thumb'
|
|
3
|
+
|
|
4
|
+
export const GAP = 4 // top 2 + bottom 2 of bar instance
|
|
5
|
+
|
|
6
|
+
export const BAR_MAP = {
|
|
7
|
+
vertical: {
|
|
8
|
+
offset: 'offsetHeight',
|
|
9
|
+
scroll: 'scrollTop',
|
|
10
|
+
scrollSize: 'scrollHeight',
|
|
11
|
+
size: 'height',
|
|
12
|
+
key: 'vertical',
|
|
13
|
+
axis: 'Y',
|
|
14
|
+
client: 'clientY',
|
|
15
|
+
direction: 'top',
|
|
16
|
+
},
|
|
17
|
+
horizontal: {
|
|
18
|
+
offset: 'offsetWidth',
|
|
19
|
+
scroll: 'scrollLeft',
|
|
20
|
+
scrollSize: 'scrollWidth',
|
|
21
|
+
size: 'width',
|
|
22
|
+
key: 'horizontal',
|
|
23
|
+
axis: 'X',
|
|
24
|
+
client: 'clientX',
|
|
25
|
+
direction: 'left',
|
|
26
|
+
},
|
|
27
|
+
} as const
|
|
28
|
+
|
|
29
|
+
export const renderThumbStyle = ({
|
|
30
|
+
move,
|
|
31
|
+
size,
|
|
32
|
+
bar,
|
|
33
|
+
}: Pick<ThumbProps, 'move' | 'size'> & {
|
|
34
|
+
bar: typeof BAR_MAP[keyof typeof BAR_MAP]
|
|
35
|
+
}): CSSProperties => ({
|
|
36
|
+
[bar.size]: size,
|
|
37
|
+
transform: `translate${bar.axis}(${move}%)`,
|
|
38
|
+
})
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="search-history-warp">
|
|
3
|
+
<FormItemRest>
|
|
4
|
+
<Button
|
|
5
|
+
class="search-history-button"
|
|
6
|
+
type="primary"
|
|
7
|
+
html-type="submit"
|
|
8
|
+
>
|
|
9
|
+
搜索
|
|
10
|
+
</Button>
|
|
11
|
+
</FormItemRest>
|
|
12
|
+
<Popover
|
|
13
|
+
placement="bottom"
|
|
14
|
+
trigger="click"
|
|
15
|
+
overlay-class-name="search-history-list-pop"
|
|
16
|
+
:visible="historyVisible"
|
|
17
|
+
@visibleChange="visibleChange"
|
|
18
|
+
>
|
|
19
|
+
<template #content>
|
|
20
|
+
<div v-if="!showEmpty" class="search-history-items">
|
|
21
|
+
<div
|
|
22
|
+
v-for="item in historyList"
|
|
23
|
+
:key="item.id"
|
|
24
|
+
class="search-history-item"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="history-item--title"
|
|
28
|
+
@click="itemClick(item.content)"
|
|
29
|
+
>
|
|
30
|
+
<Ellipsis style="width: 100%">{{
|
|
31
|
+
item.name
|
|
32
|
+
}}
|
|
33
|
+
</Ellipsis>
|
|
34
|
+
</div>
|
|
35
|
+
<Popconfirm
|
|
36
|
+
title="确认删除吗?"
|
|
37
|
+
placement="top"
|
|
38
|
+
@confirm="deleteHistory(item)"
|
|
39
|
+
>
|
|
40
|
+
<span class="delete">
|
|
41
|
+
<AIcon type="DeleteOutlined"/>
|
|
42
|
+
</span>
|
|
43
|
+
</Popconfirm>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div v-else class="search-history-empty">
|
|
47
|
+
<Empty/>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
<div
|
|
51
|
+
class="search-history-button-icon"
|
|
52
|
+
@click.stop="showHistoryList"
|
|
53
|
+
>
|
|
54
|
+
<AIcon type="DownOutlined"/>
|
|
55
|
+
</div>
|
|
56
|
+
</Popover>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script setup lang="ts" name="SearchHistory">
|
|
61
|
+
import type { SearchHistoryList } from '../typing';
|
|
62
|
+
import { computed, ref } from 'vue';
|
|
63
|
+
import type { PropType } from 'vue';
|
|
64
|
+
import { isFunction } from 'lodash-es';
|
|
65
|
+
import { AIcon, Empty, Ellipsis } from '../../../';
|
|
66
|
+
import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue'
|
|
67
|
+
|
|
68
|
+
type Emit = {
|
|
69
|
+
(event: 'click'): void;
|
|
70
|
+
(event: 'itemClick', data: string): void;
|
|
71
|
+
};
|
|
72
|
+
const emit = defineEmits<Emit>();
|
|
73
|
+
|
|
74
|
+
const props = defineProps({
|
|
75
|
+
target: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: '',
|
|
78
|
+
required: true,
|
|
79
|
+
},
|
|
80
|
+
request: {
|
|
81
|
+
type: Function as PropType<(target: string) => Promise<any>>,
|
|
82
|
+
default: null,
|
|
83
|
+
},
|
|
84
|
+
deleteRequest: {
|
|
85
|
+
type: Function as PropType<(target: string, item: any) => Promise<any>>,
|
|
86
|
+
default: null,
|
|
87
|
+
},
|
|
88
|
+
deleteKey: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'key',
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const historyList = ref<SearchHistoryList[]>([]);
|
|
95
|
+
const historyVisible = ref(false);
|
|
96
|
+
const showEmpty = computed(() => {
|
|
97
|
+
return historyList.value.length === 0;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const showHistoryList = async () => {
|
|
101
|
+
if (props.request) {
|
|
102
|
+
const resp = await props.request(props.target);
|
|
103
|
+
if (resp.success && resp.result.length) {
|
|
104
|
+
historyList.value = resp.result.filter((item) => item.content);
|
|
105
|
+
} else {
|
|
106
|
+
historyList.value = [];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const visibleChange = async (v: boolean) => {
|
|
112
|
+
historyVisible.value = v;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const click = () => {
|
|
116
|
+
emit('click');
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const itemClick = (content: string) => {
|
|
120
|
+
historyVisible.value = false;
|
|
121
|
+
emit('itemClick', content);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const deleteHistory = async (item: any) => {
|
|
125
|
+
if (props.deleteRequest && isFunction(props.deleteRequest)) {
|
|
126
|
+
const resp = await props.deleteRequest(
|
|
127
|
+
props.target,
|
|
128
|
+
item[props.deleteKey],
|
|
129
|
+
);
|
|
130
|
+
historyVisible.value = false;
|
|
131
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
132
|
+
message.success('操作成功');
|
|
133
|
+
} else {
|
|
134
|
+
message.error('操作失败');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
</script>
|
|
139
|
+
|
|
140
|
+
<style scoped lang="less"></style>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Popover
|
|
3
|
+
v-model:visible="visible"
|
|
4
|
+
title="搜索名称"
|
|
5
|
+
trigger="click"
|
|
6
|
+
placement="bottom"
|
|
7
|
+
@visibleChange="visibleChange"
|
|
8
|
+
>
|
|
9
|
+
<template #content>
|
|
10
|
+
<div v-if="visible" style="width: 240px">
|
|
11
|
+
<Form ref="formRef" :model="modelRef">
|
|
12
|
+
<FormItem
|
|
13
|
+
name="name"
|
|
14
|
+
:rules="[
|
|
15
|
+
{ required: true, message: '请输入名称' },
|
|
16
|
+
{ max: 64, message: '最多64个字符' },
|
|
17
|
+
]"
|
|
18
|
+
>
|
|
19
|
+
<Textarea
|
|
20
|
+
v-model:value="modelRef.name"
|
|
21
|
+
:rows="3"
|
|
22
|
+
:maxlength="200"
|
|
23
|
+
/>
|
|
24
|
+
</FormItem>
|
|
25
|
+
</Form>
|
|
26
|
+
<Button
|
|
27
|
+
:loading="saveHistoryLoading"
|
|
28
|
+
type="primary"
|
|
29
|
+
class="save-btn"
|
|
30
|
+
style="width: 100%"
|
|
31
|
+
@click="saveHistory"
|
|
32
|
+
>
|
|
33
|
+
保存
|
|
34
|
+
</Button>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
<Button ghost type="primary"> 保存</Button>
|
|
38
|
+
</Popover>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import type { Terms } from '../typing';
|
|
43
|
+
import type { PropType } from 'vue';
|
|
44
|
+
import { ref, reactive } from 'vue';
|
|
45
|
+
import { Form, Button, FormItem, Popover, Textarea, message } from 'ant-design-vue'
|
|
46
|
+
import { isFunction } from 'lodash-es';
|
|
47
|
+
|
|
48
|
+
const props = defineProps({
|
|
49
|
+
terms: {
|
|
50
|
+
type: Object as PropType<Terms>,
|
|
51
|
+
default: () => ({}),
|
|
52
|
+
},
|
|
53
|
+
target: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '',
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
request: {
|
|
59
|
+
type: Function as PropType<(data: any, target: string) => Promise<any>>,
|
|
60
|
+
default: null,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const saveHistoryLoading = ref(false);
|
|
65
|
+
|
|
66
|
+
const visible = ref(false);
|
|
67
|
+
|
|
68
|
+
const formRef = ref();
|
|
69
|
+
|
|
70
|
+
const modelRef = reactive({
|
|
71
|
+
name: undefined,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const visibleChange = (e: boolean) => {
|
|
75
|
+
visible.value = e;
|
|
76
|
+
if (!e) {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
modelRef.name = undefined;
|
|
79
|
+
}, 100);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 保存当前查询条件
|
|
85
|
+
*/
|
|
86
|
+
const saveHistory = async () => {
|
|
87
|
+
// 获取当前查询条件并转化为字符串
|
|
88
|
+
const formData = await formRef.value.validate();
|
|
89
|
+
if (formData && props.request && isFunction(props.request)) {
|
|
90
|
+
formData.content = JSON.stringify(props.terms);
|
|
91
|
+
saveHistoryLoading.value = true;
|
|
92
|
+
const resp = await props.request(formData, props.target);
|
|
93
|
+
saveHistoryLoading.value = false;
|
|
94
|
+
if (resp.success || resp.status === 200 || resp.code === 200) {
|
|
95
|
+
message.success('操作成功');
|
|
96
|
+
visibleChange(false);
|
|
97
|
+
} else {
|
|
98
|
+
message.error('操作失败');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<style scoped lang="less">
|
|
105
|
+
.save-btn {
|
|
106
|
+
width: 100%;
|
|
107
|
+
}
|
|
108
|
+
</style>
|