xrk-components 0.3.0 → 0.3.3
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/lib/index.css +7 -2
- package/lib/index.esm.js +107 -46
- package/lib/index.umd.js +107 -46
- package/lib/packages/base/button/index.d.ts +1 -1
- package/lib/packages/base/dialog/dialog.d.ts +11 -0
- package/lib/packages/base/dialog/index.d.ts +4 -3
- package/lib/packages/base/select/index.d.ts +4 -1
- package/lib/packages/xrk/table/table.d.ts +0 -13
- package/lib/packages/xrk/table/types/type.d.ts +2 -2
- package/package.json +1 -1
- package/packages/base/button/button.vue +0 -83
- package/packages/base/button/index.ts +0 -26
- package/packages/base/checkbox/checkbox-button.vue +0 -54
- package/packages/base/checkbox/checkbox-group.vue +0 -85
- package/packages/base/checkbox/checkbox.vue +0 -85
- package/packages/base/checkbox/index.ts +0 -62
- package/packages/base/date-picker/date-picker.vue +0 -144
- package/packages/base/date-picker/index.ts +0 -52
- package/packages/base/dialog/dialog.vue +0 -214
- package/packages/base/dialog/index.ts +0 -57
- package/packages/base/form/form-item.vue +0 -57
- package/packages/base/form/form.vue +0 -70
- package/packages/base/form/index.ts +0 -39
- package/packages/base/input/index.ts +0 -50
- package/packages/base/input/input.vue +0 -175
- package/packages/base/pagination/index.ts +0 -30
- package/packages/base/pagination/pagination.vue +0 -160
- package/packages/base/radio/index.ts +0 -49
- package/packages/base/radio/radio-button.vue +0 -46
- package/packages/base/radio/radio-group.vue +0 -77
- package/packages/base/radio/radio.vue +0 -74
- package/packages/base/select/index.ts +0 -62
- package/packages/base/select/select.vue +0 -258
- package/packages/base/switch/index.ts +0 -26
- package/packages/base/switch/switch.vue +0 -103
- package/packages/base/table/hooks/use-table.ts +0 -15
- package/packages/base/table/index.ts +0 -16
- package/packages/base/table/store/index.ts +0 -35
- package/packages/base/table/table-column.vue +0 -351
- package/packages/base/table/table.vue +0 -168
- package/packages/base/table/types/type.ts +0 -123
- package/packages/base/tag/index.ts +0 -52
- package/packages/base/tag/tag-group.vue +0 -182
- package/packages/base/tag/tag.vue +0 -54
- package/packages/base/tool-tip/index.ts +0 -30
- package/packages/base/tool-tip/tool-tip.vue +0 -108
- package/packages/components.ts +0 -33
- package/packages/functions.ts +0 -16
- package/packages/index.ts +0 -30
- package/packages/types.ts +0 -54
- package/packages/xrk/search/hooks/use-search.ts +0 -96
- package/packages/xrk/search/index.ts +0 -22
- package/packages/xrk/search/search.vue +0 -197
- package/packages/xrk/search/types/type.ts +0 -95
- package/packages/xrk/table/hooks/use-table.tsx +0 -34
- package/packages/xrk/table/index.ts +0 -10
- package/packages/xrk/table/table.vue +0 -218
- package/packages/xrk/table/types/type.ts +0 -31
- package/rollup.config.js +0 -59
- package/styles/element/index.scss +0 -5
- package/styles/element/mixin.scss +0 -40
- package/tools/check.ts +0 -9
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-06-28 14:58:39
|
|
4
|
-
-->
|
|
5
|
-
<template>
|
|
6
|
-
<div class="base-tag-group">
|
|
7
|
-
<base-tag
|
|
8
|
-
class="base-tag"
|
|
9
|
-
v-for="(item, index) in modelValue"
|
|
10
|
-
:key="index"
|
|
11
|
-
:type="type"
|
|
12
|
-
:closable="item['closable']"
|
|
13
|
-
:disableTransitions="disableTransitions"
|
|
14
|
-
:hit="hit"
|
|
15
|
-
:color="color"
|
|
16
|
-
:size="size"
|
|
17
|
-
:effect="effect"
|
|
18
|
-
:round="round"
|
|
19
|
-
v-loading="closeIndex == index"
|
|
20
|
-
@close="handleTagClose(index)"
|
|
21
|
-
@click="handleTagClick(index)"
|
|
22
|
-
>
|
|
23
|
-
{{ _Reflect.get(item, labelKey) }}
|
|
24
|
-
</base-tag>
|
|
25
|
-
<template v-if="showAdd">
|
|
26
|
-
<base-input
|
|
27
|
-
v-if="inputVisible"
|
|
28
|
-
class="base-input"
|
|
29
|
-
clearable
|
|
30
|
-
:disabled="adding"
|
|
31
|
-
ref="InputRef"
|
|
32
|
-
v-model="inputValue"
|
|
33
|
-
:size="size"
|
|
34
|
-
:maxlength="maxlength"
|
|
35
|
-
v-loading="adding"
|
|
36
|
-
@keyup.enter="handleInputConfirm"
|
|
37
|
-
@blur="handleInputConfirm"
|
|
38
|
-
/>
|
|
39
|
-
<base-button v-else :size="size" @click="showInput" :disabled="adding">
|
|
40
|
-
{{ addBtnText }}
|
|
41
|
-
</base-button>
|
|
42
|
-
</template>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script lang="tsx">
|
|
47
|
-
export default {
|
|
48
|
-
name: 'base-tag-group'
|
|
49
|
-
};
|
|
50
|
-
</script>
|
|
51
|
-
<script lang="tsx" setup>
|
|
52
|
-
import { BaseInput } from '../input';
|
|
53
|
-
import { BaseButton } from '../button';
|
|
54
|
-
import BaseTag from './tag.vue';
|
|
55
|
-
import { withDefaults, ref, nextTick } from 'vue';
|
|
56
|
-
import { isFunction } from '../../../tools/check';
|
|
57
|
-
import { check } from 'xrk-tools';
|
|
58
|
-
import { BaseTagGroupProps, TagOption } from './index';
|
|
59
|
-
import { vLoading as _vLoading } from 'element-plus';
|
|
60
|
-
|
|
61
|
-
const vLoading = _vLoading;
|
|
62
|
-
const _Reflect = Reflect;
|
|
63
|
-
|
|
64
|
-
const _props = withDefaults(
|
|
65
|
-
defineProps<{
|
|
66
|
-
modelValue?: Array<any>;
|
|
67
|
-
labelKey?: string;
|
|
68
|
-
type?: 'success' | 'info' | 'warning' | 'danger';
|
|
69
|
-
disableTransitions?: boolean;
|
|
70
|
-
hit?: boolean;
|
|
71
|
-
color?: string;
|
|
72
|
-
size?: 'large' | 'default' | 'small';
|
|
73
|
-
effect?: 'dark' | 'light' | 'plain';
|
|
74
|
-
round?: boolean;
|
|
75
|
-
|
|
76
|
-
beforeClose?: any;
|
|
77
|
-
beforeAdd?: (val: any) => any;
|
|
78
|
-
showAdd?: boolean;
|
|
79
|
-
addBtnText?: string;
|
|
80
|
-
maxlength?: number;
|
|
81
|
-
}>(),
|
|
82
|
-
{ labelKey: 'label', showAdd: false, maxlength: 20, addBtnText: '新增' }
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const props = _props as Readonly<BaseTagGroupProps>;
|
|
86
|
-
|
|
87
|
-
const emits = defineEmits<{
|
|
88
|
-
(event: 'update:modelValue', tags: any): void;
|
|
89
|
-
(event: 'change', tags: any): void;
|
|
90
|
-
(event: 'click', tag: any): void;
|
|
91
|
-
}>();
|
|
92
|
-
|
|
93
|
-
const tagsValue = ref<any>(props.modelValue);
|
|
94
|
-
const closeIndex = ref<number>(-1);
|
|
95
|
-
const adding = ref<boolean>(false);
|
|
96
|
-
|
|
97
|
-
const handleTagClose = async (index: number) => {
|
|
98
|
-
if (closeIndex.value > -1) return;
|
|
99
|
-
try {
|
|
100
|
-
closeIndex.value = index;
|
|
101
|
-
if (isFunction(props.beforeClose)) {
|
|
102
|
-
await props.beforeClose?.(tagsValue.value?.[index] as TagOption);
|
|
103
|
-
}
|
|
104
|
-
tagsValue.value?.splice(index, 1);
|
|
105
|
-
emits('update:modelValue', tagsValue.value);
|
|
106
|
-
emits('change', tagsValue.value);
|
|
107
|
-
closeIndex.value = -1;
|
|
108
|
-
} catch (error) {
|
|
109
|
-
console.error(error);
|
|
110
|
-
closeIndex.value = -1;
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
const handleTagClick = (index: number) => {
|
|
114
|
-
emits('click', tagsValue.value?.[index] as TagOption);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* 增加标签逻辑
|
|
119
|
-
*/
|
|
120
|
-
const InputRef = ref<any>(null);
|
|
121
|
-
const inputVisible = ref<boolean>(false);
|
|
122
|
-
const inputValue = ref<string>('');
|
|
123
|
-
const showInput = () => {
|
|
124
|
-
inputVisible.value = true;
|
|
125
|
-
nextTick(() => {
|
|
126
|
-
InputRef.value.focus();
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
const handleInputConfirm = async () => {
|
|
130
|
-
if (adding.value) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (check.isFalseValue(inputValue.value)) {
|
|
134
|
-
inputVisible.value = false;
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
adding.value = true;
|
|
139
|
-
const _value = (
|
|
140
|
-
isFunction(props.beforeAdd)
|
|
141
|
-
? await props.beforeAdd?.(inputValue.value)
|
|
142
|
-
: { label: inputValue.value, value: inputValue.value, closable: true }
|
|
143
|
-
) as TagOption;
|
|
144
|
-
tagsValue.value?.push(_value);
|
|
145
|
-
emits('update:modelValue', tagsValue.value);
|
|
146
|
-
emits('change', tagsValue.value);
|
|
147
|
-
inputVisible.value = false;
|
|
148
|
-
adding.value = false;
|
|
149
|
-
inputValue.value = '';
|
|
150
|
-
} catch (error) {
|
|
151
|
-
adding.value = false;
|
|
152
|
-
inputVisible.value = false;
|
|
153
|
-
inputValue.value = '';
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
</script>
|
|
157
|
-
|
|
158
|
-
<style lang="scss" scoped>
|
|
159
|
-
.base-tag-group {
|
|
160
|
-
display: flex;
|
|
161
|
-
flex-wrap: wrap;
|
|
162
|
-
align-items: center;
|
|
163
|
-
.base-tag {
|
|
164
|
-
margin-right: 5px;
|
|
165
|
-
margin-bottom: 3px;
|
|
166
|
-
margin-top: 3px;
|
|
167
|
-
::v-deep {
|
|
168
|
-
.xrk-loading-spinner .circular {
|
|
169
|
-
width: 20px;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
.base-input {
|
|
174
|
-
width: 150px;
|
|
175
|
-
::v-deep {
|
|
176
|
-
.xrk-loading-spinner .circular {
|
|
177
|
-
width: 20px;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
</style>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-06-28 14:48:20
|
|
4
|
-
-->
|
|
5
|
-
<template>
|
|
6
|
-
<el-tag
|
|
7
|
-
:type="type"
|
|
8
|
-
:closable="closable"
|
|
9
|
-
:disableTransitions="disableTransitions"
|
|
10
|
-
:hit="hit"
|
|
11
|
-
:color="color"
|
|
12
|
-
:size="size"
|
|
13
|
-
:effect="effect"
|
|
14
|
-
:round="round"
|
|
15
|
-
@click="emits('click')"
|
|
16
|
-
@close="emits('close')"
|
|
17
|
-
>
|
|
18
|
-
<slot></slot>
|
|
19
|
-
</el-tag>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script lang="tsx">
|
|
23
|
-
export default {
|
|
24
|
-
name: 'base-tag'
|
|
25
|
-
};
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<script lang="tsx" setup>
|
|
29
|
-
import { ElTag } from 'element-plus';
|
|
30
|
-
import { withDefaults } from 'vue';
|
|
31
|
-
|
|
32
|
-
withDefaults(
|
|
33
|
-
defineProps<{
|
|
34
|
-
type?: 'success' | 'info' | 'warning' | 'danger';
|
|
35
|
-
closable?: boolean;
|
|
36
|
-
disableTransitions?: boolean;
|
|
37
|
-
hit?: boolean;
|
|
38
|
-
color?: string;
|
|
39
|
-
size?: 'large' | 'default' | 'small';
|
|
40
|
-
effect?: 'dark' | 'light' | 'plain';
|
|
41
|
-
round?: boolean;
|
|
42
|
-
}>(),
|
|
43
|
-
{
|
|
44
|
-
size: 'large'
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const emits = defineEmits<{
|
|
49
|
-
(event: 'click', tag?: any): void;
|
|
50
|
-
(event: 'close', tag?: any): void;
|
|
51
|
-
}>();
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { StyleValue, DefineComponent } from 'vue';
|
|
2
|
-
import _BaseToolTip from './tool-tip.vue';
|
|
3
|
-
|
|
4
|
-
export type BaseToolTipProps = {
|
|
5
|
-
popperClass?: string; // 弹出框的样式名,默认base-tool-tip(限制了最大宽度400)
|
|
6
|
-
trigger?: 'hover' | 'click' | 'focus' | 'contextmenu'; // 如何触发 tooltip (来显示)
|
|
7
|
-
transition?: 'el-fade-in-linear' | 'none'; // 动画名称
|
|
8
|
-
disabled?: boolean; // Tooltip 组件是否禁用
|
|
9
|
-
enterable?: boolean; // 鼠标是否可进入到 tooltip 中
|
|
10
|
-
hideAfter?: number; // 延迟关闭,单位毫秒
|
|
11
|
-
placement?:
|
|
12
|
-
| 'top'
|
|
13
|
-
| 'top-start'
|
|
14
|
-
| 'top-end'
|
|
15
|
-
| 'bottom'
|
|
16
|
-
| 'bottom-start'
|
|
17
|
-
| 'bottom-end'
|
|
18
|
-
| 'left'
|
|
19
|
-
| 'left-start'
|
|
20
|
-
| 'left-end'
|
|
21
|
-
| 'right'
|
|
22
|
-
| 'right-start'
|
|
23
|
-
| 'right-end'; // Tooltip 组件出现的位置
|
|
24
|
-
content?: string | number; // 显示的内容,也可被 slot#content 覆盖
|
|
25
|
-
|
|
26
|
-
style?: StyleValue | undefined;
|
|
27
|
-
overShow?: boolean; // 内容超出才显示toolTip
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const BaseToolTip = _BaseToolTip as DefineComponent<BaseToolTipProps>;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-06-30 23:31:05
|
|
4
|
-
-->
|
|
5
|
-
<!--
|
|
6
|
-
* @Description:
|
|
7
|
-
* @Date: 2022-06-28 11:06:06
|
|
8
|
-
-->
|
|
9
|
-
<template>
|
|
10
|
-
<el-tooltip
|
|
11
|
-
:key="_overShow ? '1' : '0'"
|
|
12
|
-
:popper-class="popperClass"
|
|
13
|
-
:trigger="trigger"
|
|
14
|
-
:transition="transition"
|
|
15
|
-
:disabled="_overShow || disabled"
|
|
16
|
-
:placement="placement"
|
|
17
|
-
:hideAfter="hideAfter"
|
|
18
|
-
:enterable="enterable"
|
|
19
|
-
:content="_content"
|
|
20
|
-
>
|
|
21
|
-
<template #content>
|
|
22
|
-
<slot name="content"></slot>
|
|
23
|
-
</template>
|
|
24
|
-
<div
|
|
25
|
-
v-if="overShow"
|
|
26
|
-
style="width: 100%"
|
|
27
|
-
:style="style"
|
|
28
|
-
@mousemove="handleMouseMove"
|
|
29
|
-
ref="toolTipDefault"
|
|
30
|
-
>
|
|
31
|
-
<span ref="toolTipDefaultContent">
|
|
32
|
-
<slot></slot>
|
|
33
|
-
</span>
|
|
34
|
-
</div>
|
|
35
|
-
<slot v-else></slot>
|
|
36
|
-
</el-tooltip>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script lang="tsx">
|
|
40
|
-
export default {
|
|
41
|
-
name: 'base-tool-tip'
|
|
42
|
-
};
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<script lang="tsx" setup>
|
|
46
|
-
import { ElTooltip } from 'element-plus';
|
|
47
|
-
import { computed, ref, StyleValue, withDefaults } from 'vue';
|
|
48
|
-
|
|
49
|
-
const props = withDefaults(
|
|
50
|
-
defineProps<{
|
|
51
|
-
popperClass?: string; // 弹出框的样式名,默认base-tool-tip(限制了最大宽度400)
|
|
52
|
-
trigger?: 'hover' | 'click' | 'focus' | 'contextmenu'; // 如何触发 tooltip (来显示)
|
|
53
|
-
transition?: 'el-fade-in-linear' | 'none'; // 动画名称
|
|
54
|
-
disabled?: boolean; // Tooltip 组件是否禁用
|
|
55
|
-
enterable?: boolean; // 鼠标是否可进入到 tooltip 中
|
|
56
|
-
hideAfter?: number; // 延迟关闭,单位毫秒
|
|
57
|
-
placement?:
|
|
58
|
-
| 'top'
|
|
59
|
-
| 'top-start'
|
|
60
|
-
| 'top-end'
|
|
61
|
-
| 'bottom'
|
|
62
|
-
| 'bottom-start'
|
|
63
|
-
| 'bottom-end'
|
|
64
|
-
| 'left'
|
|
65
|
-
| 'left-start'
|
|
66
|
-
| 'left-end'
|
|
67
|
-
| 'right'
|
|
68
|
-
| 'right-start'
|
|
69
|
-
| 'right-end'; // Tooltip 组件出现的位置
|
|
70
|
-
content?: string | number; // 显示的内容,也可被 slot#content 覆盖
|
|
71
|
-
|
|
72
|
-
style?: StyleValue | undefined;
|
|
73
|
-
overShow?: boolean; // 内容超出才显示toolTip
|
|
74
|
-
}>(),
|
|
75
|
-
{
|
|
76
|
-
overShow: false,
|
|
77
|
-
transition: 'el-fade-in-linear',
|
|
78
|
-
enterable: true,
|
|
79
|
-
hideAfter: 100,
|
|
80
|
-
placement: 'top',
|
|
81
|
-
popperClass: 'base-tool-tip'
|
|
82
|
-
}
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
const _overShow = ref<boolean>(props.overShow);
|
|
86
|
-
const toolTipDefault = ref<HTMLElement | null>(null);
|
|
87
|
-
const toolTipDefaultContent = ref<HTMLElement | null>(null);
|
|
88
|
-
|
|
89
|
-
const _content = computed<string>(() => props.content as string);
|
|
90
|
-
|
|
91
|
-
const handleMouseMove = () => {
|
|
92
|
-
if (toolTipDefault.value?.tagName && toolTipDefaultContent.value?.tagName) {
|
|
93
|
-
const { offsetWidth, offsetHeight } = toolTipDefault.value;
|
|
94
|
-
const { offsetWidth: childOffsetWidth, offsetHeight: childOffsetHeight } =
|
|
95
|
-
toolTipDefaultContent.value;
|
|
96
|
-
|
|
97
|
-
_overShow.value = !(
|
|
98
|
-
offsetWidth < childOffsetWidth || offsetHeight < childOffsetHeight
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style lang="scss">
|
|
105
|
-
.base-tool-tip {
|
|
106
|
-
max-width: 400px;
|
|
107
|
-
}
|
|
108
|
-
</style>
|
package/packages/components.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-07-05 16:34:24
|
|
4
|
-
*/
|
|
5
|
-
export { BaseButton } from './base/button';
|
|
6
|
-
|
|
7
|
-
export { BaseRadio, BaseRadioGroup, BaseRadioButton } from './base/radio';
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
BaseCheckbox,
|
|
11
|
-
BaseCheckboxGroup,
|
|
12
|
-
BaseCheckboxButton
|
|
13
|
-
} from './base/checkbox';
|
|
14
|
-
|
|
15
|
-
export { BaseDatePicker } from './base/date-picker';
|
|
16
|
-
|
|
17
|
-
export { BaseInput } from './base/input';
|
|
18
|
-
|
|
19
|
-
export { BaseSelect } from './base/select';
|
|
20
|
-
|
|
21
|
-
export { BaseSwitch } from './base/switch';
|
|
22
|
-
|
|
23
|
-
export { BaseTag, BaseTagGroup } from './base/tag';
|
|
24
|
-
|
|
25
|
-
export { BasePagination } from './base/pagination';
|
|
26
|
-
|
|
27
|
-
export { BaseForm, BaseFormItem } from './base/form/';
|
|
28
|
-
|
|
29
|
-
export { XrkSearch } from './xrk/search';
|
|
30
|
-
export { BaseTable } from './base/table';
|
|
31
|
-
|
|
32
|
-
export { XrkTable } from './xrk/table';
|
|
33
|
-
export { BaseDialog } from './base/dialog';
|
package/packages/functions.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-07-05 16:34:24
|
|
4
|
-
*/
|
|
5
|
-
export { useTableColumn } from './base/table';
|
|
6
|
-
export { createDialog } from './base/dialog';
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
useInputColumn,
|
|
10
|
-
useSearchColumns,
|
|
11
|
-
useSelectColumn,
|
|
12
|
-
useSearchBtn,
|
|
13
|
-
useResetBtn,
|
|
14
|
-
useDatePickerColumn,
|
|
15
|
-
useOtherComponents
|
|
16
|
-
} from './xrk/search/hooks/use-search';
|
package/packages/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-06-30 22:57:28
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { App } from 'vue';
|
|
7
|
-
import ElementPlus from 'element-plus';
|
|
8
|
-
import locale from 'element-plus/lib/locale/lang/zh-cn';
|
|
9
|
-
import '../styles/element/index.scss';
|
|
10
|
-
|
|
11
|
-
import * as AllComponents from './components';
|
|
12
|
-
|
|
13
|
-
// 所有组件列表
|
|
14
|
-
const components = Object.values(AllComponents).map(i => i);
|
|
15
|
-
|
|
16
|
-
const install = (app: App): void => {
|
|
17
|
-
app.use(ElementPlus, { namespace: 'xrk', locale });
|
|
18
|
-
components.map(component => {
|
|
19
|
-
app.component(component.name, component);
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export * from './components';
|
|
24
|
-
export * from './functions';
|
|
25
|
-
export * from './types';
|
|
26
|
-
|
|
27
|
-
export default {
|
|
28
|
-
version: '0.3.0',
|
|
29
|
-
install
|
|
30
|
-
};
|
package/packages/types.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-07-05 14:03:15
|
|
4
|
-
*/
|
|
5
|
-
export type { BaseButtonProps } from './base/button';
|
|
6
|
-
|
|
7
|
-
export type {
|
|
8
|
-
BaseRadioButtonProps,
|
|
9
|
-
BaseRadioGroupProps,
|
|
10
|
-
BaseRadioProps
|
|
11
|
-
} from './base/radio';
|
|
12
|
-
|
|
13
|
-
export type {
|
|
14
|
-
BaseCheckboxProps,
|
|
15
|
-
BaseCheckboxGroupProps,
|
|
16
|
-
BaseCheckboxButtonProps
|
|
17
|
-
} from './base/checkbox';
|
|
18
|
-
|
|
19
|
-
export type { BaseDatePickerProps } from './base/date-picker';
|
|
20
|
-
|
|
21
|
-
export type { BaseInputProps } from './base/input';
|
|
22
|
-
|
|
23
|
-
export type {
|
|
24
|
-
BaseSelectProps,
|
|
25
|
-
SelectOptionType,
|
|
26
|
-
SelectValueType
|
|
27
|
-
} from './base/select';
|
|
28
|
-
|
|
29
|
-
export type { BaseSwitch } from './base/switch';
|
|
30
|
-
|
|
31
|
-
export type { BaseTagProps, BaseTagGroupProps, TagOption } from './base/tag';
|
|
32
|
-
|
|
33
|
-
export type {
|
|
34
|
-
BasePaginationProps,
|
|
35
|
-
PaginationInfoType
|
|
36
|
-
} from './base/pagination';
|
|
37
|
-
|
|
38
|
-
export type { BaseFormProps, BaseFormItemProps } from './base/form/';
|
|
39
|
-
|
|
40
|
-
export type {
|
|
41
|
-
BaseTableProps,
|
|
42
|
-
BaseTableColumnProps
|
|
43
|
-
} from './base/table/types/type';
|
|
44
|
-
|
|
45
|
-
export type { BaseDialogProps, DialogBtnConfigProps } from './base/dialog';
|
|
46
|
-
|
|
47
|
-
export type { XrkSearchProps } from './xrk/search';
|
|
48
|
-
export type {
|
|
49
|
-
ComponentRender,
|
|
50
|
-
ResetBtnType,
|
|
51
|
-
SearchBtnType,
|
|
52
|
-
SerachColumnType
|
|
53
|
-
} from './xrk/search/types/type';
|
|
54
|
-
export type { XrkTableProps } from './xrk/table/types/type';
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-06-29 15:58:37
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { BaseDatePickerProps } from '../../../base/date-picker';
|
|
7
|
-
import { BaseInputProps } from '../../../base/input';
|
|
8
|
-
import { BaseSelectProps } from '../../../base/select';
|
|
9
|
-
import {
|
|
10
|
-
SerachColumnType,
|
|
11
|
-
SearchBtnType,
|
|
12
|
-
ResetBtnType,
|
|
13
|
-
SerachColumnBaseType,
|
|
14
|
-
BaseInputListener,
|
|
15
|
-
BaseSelectListener,
|
|
16
|
-
BaseDatePickerListener,
|
|
17
|
-
ComponentRender
|
|
18
|
-
} from '../types/type';
|
|
19
|
-
|
|
20
|
-
export const useInputColumn = (
|
|
21
|
-
column: SerachColumnBaseType<BaseInputProps, BaseInputListener>
|
|
22
|
-
): SerachColumnBaseType<BaseInputProps, BaseInputListener> => {
|
|
23
|
-
return {
|
|
24
|
-
type: 'input',
|
|
25
|
-
...column,
|
|
26
|
-
style: {
|
|
27
|
-
width: '220px',
|
|
28
|
-
...(column.style || {})
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const useSelectColumn = (
|
|
34
|
-
column: SerachColumnBaseType<BaseSelectProps, BaseSelectListener>
|
|
35
|
-
): SerachColumnBaseType<BaseSelectProps, BaseSelectListener> => {
|
|
36
|
-
return {
|
|
37
|
-
type: 'select',
|
|
38
|
-
...column,
|
|
39
|
-
style: {
|
|
40
|
-
width: '220px',
|
|
41
|
-
...(column.style || {})
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const useDatePickerColumn = (
|
|
47
|
-
column: SerachColumnBaseType<BaseDatePickerProps, BaseDatePickerListener>
|
|
48
|
-
): SerachColumnBaseType<BaseDatePickerProps, BaseDatePickerListener> => {
|
|
49
|
-
return {
|
|
50
|
-
type: 'datePicker',
|
|
51
|
-
...column,
|
|
52
|
-
style: {
|
|
53
|
-
width: ['datetimerange', 'daterange', 'monthrange'].includes(
|
|
54
|
-
column.config?.type || ''
|
|
55
|
-
)
|
|
56
|
-
? '280px'
|
|
57
|
-
: '220px',
|
|
58
|
-
...(column.style || {})
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const useSearchColumns = (
|
|
64
|
-
columns: Array<SerachColumnType>
|
|
65
|
-
): Array<SerachColumnType> => {
|
|
66
|
-
return columns.map(column => ({
|
|
67
|
-
...column,
|
|
68
|
-
listener: column.listener || {},
|
|
69
|
-
config: {
|
|
70
|
-
clearable: true,
|
|
71
|
-
...(column.config || {})
|
|
72
|
-
}
|
|
73
|
-
}));
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const useSearchBtn = (searchBtnConfig: SearchBtnType) => {
|
|
77
|
-
return {
|
|
78
|
-
text: '搜索',
|
|
79
|
-
show: true,
|
|
80
|
-
...searchBtnConfig
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const useResetBtn = (resetBtnConfig: ResetBtnType) => {
|
|
85
|
-
return {
|
|
86
|
-
text: '重置',
|
|
87
|
-
show: true,
|
|
88
|
-
...resetBtnConfig
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const useOtherComponents = (
|
|
93
|
-
otherComponents: Array<ComponentRender>
|
|
94
|
-
): Array<ComponentRender> => {
|
|
95
|
-
return otherComponents;
|
|
96
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Description:
|
|
3
|
-
* @Date: 2022-07-05 13:42:48
|
|
4
|
-
*/
|
|
5
|
-
import { Component, CSSProperties, DefineComponent } from 'vue';
|
|
6
|
-
|
|
7
|
-
import _XrkSearch from './search.vue';
|
|
8
|
-
import {
|
|
9
|
-
ComponentRender,
|
|
10
|
-
ResetBtnType,
|
|
11
|
-
SearchBtnType,
|
|
12
|
-
SerachColumnType
|
|
13
|
-
} from './types/type';
|
|
14
|
-
|
|
15
|
-
export type XrkSearchProps = {
|
|
16
|
-
columns: Array<SerachColumnType>;
|
|
17
|
-
searchBtn?: SearchBtnType;
|
|
18
|
-
resetBtn?: ResetBtnType;
|
|
19
|
-
otherComponents?: Array<ComponentRender>;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const XrkSearch = _XrkSearch as DefineComponent<XrkSearchProps>;
|