@qy_better_lib/pc 0.2.34 → 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/DOCUMENTATION.md +559 -0
- package/LICENSE +24 -0
- package/dist/@qy_better_lib/pc.min.js +1 -1
- package/lib/commDialog/index.d.ts +3 -0
- package/lib/commDialog/index.js +8 -0
- package/lib/commDialog/src/index.vue.d.ts +102 -0
- package/lib/commDialog/src/index.vue.js +49 -0
- package/lib/commDialog/src/index.vue2.js +4 -0
- package/lib/commDialog/src/props.d.ts +49 -0
- package/lib/commDialog/src/props.js +48 -0
- package/lib/commDialog/src/type.d.ts +39 -0
- package/lib/commForm/index.d.ts +3 -0
- package/lib/commForm/index.js +8 -0
- package/lib/commForm/src/index.vue.d.ts +95 -0
- package/lib/commForm/src/index.vue.js +51 -0
- package/lib/commForm/src/index.vue2.js +4 -0
- package/lib/commForm/src/props.d.ts +49 -0
- package/lib/commForm/src/props.js +47 -0
- package/lib/commForm/src/type.d.ts +8 -0
- package/lib/contextMenu/index.d.ts +5 -2
- package/lib/contextMenu/index.js +5 -4
- package/lib/contextMenu/src/index.vue.d.ts +48 -36
- package/lib/contextMenu/src/index.vue.js +128 -79
- package/lib/contextMenu/src/index.vue2.js +2 -2
- package/lib/contextMenu/src/props.d.ts +32 -0
- package/lib/contextMenu/src/props.js +27 -0
- package/lib/contextMenu/src/type.d.ts +11 -0
- package/lib/describeView/index.js +4 -4
- package/lib/describeView/src/index.vue.d.ts +6 -9
- package/lib/describeView/src/index.vue.js +73 -70
- package/lib/describeView/src/index.vue2.js +2 -2
- package/lib/describeView/src/props.d.ts +35 -0
- package/lib/describeView/src/props.js +33 -0
- package/lib/index.d.ts +7 -3
- package/lib/index.js +31 -21
- package/lib/simpleVirtualList/index.js +4 -4
- package/lib/simpleVirtualList/src/index.vue.js +70 -53
- package/lib/simpleVirtualList/src/index.vue2.js +2 -2
- package/lib/styles/comm-form.scss +4 -0
- package/lib/styles/index.scss +6 -5
- package/lib/tableExtend/index.js +4 -4
- package/lib/tableExtend/props.d.ts +74 -15
- package/lib/tableExtend/props.js +82 -24
- package/lib/tableExtend/src/colVisible.vue.js +95 -70
- package/lib/tableExtend/src/colVisible.vue2.js +2 -2
- package/lib/tableExtend/src/index.vue.d.ts +18 -10
- package/lib/tableExtend/src/index.vue.js +169 -142
- package/lib/tableExtend/src/index.vue2.js +2 -2
- package/lib/tableExtend/src/valueCol.vue.js +11 -8
- package/lib/tableExtend/src/valueCol.vue2.js +2 -2
- package/lib/tableExtend/type.d.ts +9 -14
- package/lib/tableExtend/type.js +7 -2
- package/lib/tableExtend/useTable.d.ts +19 -50
- package/lib/tableExtend/useTable.js +95 -56
- package/lib/textButton/index.js +4 -4
- package/lib/textButton/src/index.vue.d.ts +7 -6
- package/lib/textButton/src/index.vue.js +25 -37
- package/lib/textButton/src/index.vue2.js +2 -2
- package/lib/textButton/src/props.d.ts +23 -0
- package/lib/textButton/src/props.js +30 -0
- package/lib/textButton/src/type.d.ts +30 -0
- package/lib/utils/index.d.ts +55 -13
- package/lib/utils/index.js +98 -54
- package/package.json +26 -9
- package/types/index.d.ts +9 -1
- /package/lib/styles/{contextMenu.scss → context-menu.scss} +0 -0
- /package/lib/styles/{describeView.scss → describe-view.scss} +0 -0
- /package/lib/styles/{simpleVirtualList.scss → simple-virtual-list.scss} +0 -0
- /package/lib/styles/{tableExtend.scss → table-extend.scss} +0 -0
- /package/lib/styles/{textButton.scss → text-button.scss} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, toDisplayString } from "vue";
|
|
2
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3
3
|
__name: "valueCol",
|
|
4
4
|
props: {
|
|
5
5
|
row: {
|
|
@@ -13,14 +13,17 @@ const f = /* @__PURE__ */ l({
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const column = computed(() => {
|
|
19
|
+
const { row, colCfg } = props;
|
|
20
|
+
return row[colCfg.prop];
|
|
20
21
|
});
|
|
21
|
-
return (
|
|
22
|
+
return (_ctx, _cache) => {
|
|
23
|
+
return openBlock(), createElementBlock("span", null, toDisplayString(column.value != void 0 ? column.value : "--"), 1);
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
export {
|
|
25
|
-
|
|
28
|
+
_sfc_main as default
|
|
26
29
|
};
|
|
@@ -41,32 +41,31 @@ export type TableAttr = {
|
|
|
41
41
|
/**分页 */
|
|
42
42
|
export type Pagination = {
|
|
43
43
|
/**页码 */
|
|
44
|
-
|
|
44
|
+
page_index: number | undefined;
|
|
45
45
|
/**每页显示数量 */
|
|
46
|
-
|
|
47
|
-
has: boolean;
|
|
46
|
+
page_size: number | undefined;
|
|
48
47
|
};
|
|
49
48
|
/**列配置 */
|
|
50
49
|
export type ColumnConfig = {
|
|
51
50
|
/**显示列 */
|
|
52
|
-
|
|
51
|
+
show_column: TableColumn[];
|
|
53
52
|
/**隐藏列 */
|
|
54
|
-
|
|
53
|
+
hidden_column: TableColumn[];
|
|
55
54
|
};
|
|
56
55
|
interface TableExtendProps<T> extends Omit<TableProps<any>, "data"> {
|
|
57
56
|
data?: undefined;
|
|
58
57
|
}
|
|
59
58
|
/**注入结构 */
|
|
60
59
|
export type TableProvies = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
table_props: Record<string, any>;
|
|
61
|
+
table_colums: Ref<Array<TableColumn>>;
|
|
62
|
+
column_config: ColumnConfig;
|
|
64
63
|
};
|
|
65
64
|
export type ImageViewer = {
|
|
66
65
|
/**是否显示 */
|
|
67
66
|
show: boolean;
|
|
68
67
|
/**图片路径 */
|
|
69
|
-
|
|
68
|
+
file_path_list: any[];
|
|
70
69
|
/**显示图片的索引 */
|
|
71
70
|
index: number;
|
|
72
71
|
};
|
|
@@ -155,13 +154,9 @@ export interface TableColumn {
|
|
|
155
154
|
*/
|
|
156
155
|
fixed?: "left" | "right";
|
|
157
156
|
/**
|
|
158
|
-
*
|
|
157
|
+
* 文件类型
|
|
159
158
|
*/
|
|
160
159
|
fileType?: FileType;
|
|
161
|
-
/**
|
|
162
|
-
* 数据是否为HTML
|
|
163
|
-
*/
|
|
164
|
-
isHtml?: boolean;
|
|
165
160
|
/**多语言配置 */
|
|
166
161
|
langue?: string;
|
|
167
162
|
/**其他配置 */
|
package/lib/tableExtend/type.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var FileType = /* @__PURE__ */ ((FileType2) => {
|
|
2
|
+
FileType2[FileType2["PICTURE"] = 1] = "PICTURE";
|
|
3
|
+
FileType2[FileType2["PDF"] = 2] = "PDF";
|
|
4
|
+
FileType2[FileType2["OTHER"] = 3] = "OTHER";
|
|
5
|
+
return FileType2;
|
|
6
|
+
})(FileType || {});
|
|
2
7
|
export {
|
|
3
|
-
|
|
8
|
+
FileType
|
|
4
9
|
};
|
|
@@ -1,58 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComputedRef } from 'vue';
|
|
1
|
+
import { ColumnConfig, TableColumn } from './type';
|
|
2
|
+
import { ComputedRef, ShallowReactive } from 'vue';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 表格扩展组件的核心逻辑钩子
|
|
5
|
+
* @param {Function} i18n_instance - 国际化实例函数,用于多语言支持
|
|
6
|
+
* @returns {Object} 表格相关的响应式数据和计算属性
|
|
5
7
|
*/
|
|
6
|
-
export default function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export default function use_table(i18n_instance?: (key: string) => string): {
|
|
9
|
+
def_col_setting: TableColumn;
|
|
10
|
+
selection_options: Record<string, any>;
|
|
11
|
+
table_attribute: ComputedRef<Record<string, any>>;
|
|
10
12
|
pagination: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
page_index: any;
|
|
14
|
+
page_size: any;
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
has_pagination: ComputedRef<boolean>;
|
|
17
|
+
image_viewer: {
|
|
16
18
|
show: boolean;
|
|
17
|
-
|
|
19
|
+
file_path_list: any[];
|
|
18
20
|
index: number;
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
prop?: string | undefined;
|
|
26
|
-
label?: string | undefined;
|
|
27
|
-
init?: boolean | undefined;
|
|
28
|
-
width?: number | undefined;
|
|
29
|
-
minWidth?: number | undefined;
|
|
30
|
-
showOverflowTooltip?: (boolean | Record<string, any>) | undefined;
|
|
31
|
-
sortable?: boolean | undefined;
|
|
32
|
-
fixed?: "left" | "right" | undefined;
|
|
33
|
-
fileType?: FileType | undefined;
|
|
34
|
-
isHtml?: boolean | undefined;
|
|
35
|
-
langue?: string | undefined;
|
|
36
|
-
}[];
|
|
37
|
-
hiddenColumn: {
|
|
38
|
-
[x: string]: any;
|
|
39
|
-
headerAlign?: string | undefined;
|
|
40
|
-
align?: string | undefined;
|
|
41
|
-
prop?: string | undefined;
|
|
42
|
-
label?: string | undefined;
|
|
43
|
-
init?: boolean | undefined;
|
|
44
|
-
width?: number | undefined;
|
|
45
|
-
minWidth?: number | undefined;
|
|
46
|
-
showOverflowTooltip?: (boolean | Record<string, any>) | undefined;
|
|
47
|
-
sortable?: boolean | undefined;
|
|
48
|
-
fixed?: "left" | "right" | undefined;
|
|
49
|
-
fileType?: FileType | undefined;
|
|
50
|
-
isHtml?: boolean | undefined;
|
|
51
|
-
langue?: string | undefined;
|
|
52
|
-
}[];
|
|
53
|
-
};
|
|
54
|
-
colSettingList: ComputedRef<TableColumn[]>;
|
|
55
|
-
showToolPanel: ComputedRef<boolean>;
|
|
56
|
-
showBottomPanel: ComputedRef<boolean>;
|
|
57
|
-
hasImageViewer: ComputedRef<boolean>;
|
|
22
|
+
column_config: ShallowReactive<ColumnConfig>;
|
|
23
|
+
col_setting_list: ComputedRef<TableColumn[]>;
|
|
24
|
+
show_tool_panel: ComputedRef<boolean>;
|
|
25
|
+
show_bottom_panel: ComputedRef<boolean>;
|
|
26
|
+
has_image_viewer: ComputedRef<boolean>;
|
|
58
27
|
};
|
|
@@ -1,76 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getCurrentInstance
|
|
3
|
-
import { FileType
|
|
4
|
-
function
|
|
5
|
-
const
|
|
1
|
+
import { auto_size } from "@qy_better_lib/core";
|
|
2
|
+
import { getCurrentInstance, computed, reactive, toRef, shallowReactive } from "vue";
|
|
3
|
+
import { FileType } from "./type.js";
|
|
4
|
+
function use_table(i18n_instance) {
|
|
5
|
+
const base_w = 1920;
|
|
6
|
+
const current_instance = getCurrentInstance();
|
|
7
|
+
const props = current_instance?.props;
|
|
8
|
+
const default_table_attr = {
|
|
6
9
|
rowKey: "id",
|
|
7
10
|
"element-loading-text": "加载中…",
|
|
8
11
|
"element-loading-background": "rgba(0, 0, 0, 0.2)",
|
|
9
|
-
highlightCurrentRow:
|
|
10
|
-
stripe:
|
|
11
|
-
border:
|
|
12
|
-
}
|
|
12
|
+
highlightCurrentRow: true,
|
|
13
|
+
stripe: true,
|
|
14
|
+
border: false
|
|
15
|
+
};
|
|
16
|
+
const default_col_setting = {
|
|
13
17
|
headerAlign: void 0,
|
|
14
18
|
align: void 0,
|
|
15
19
|
prop: void 0,
|
|
16
20
|
label: void 0,
|
|
17
|
-
init:
|
|
21
|
+
init: true,
|
|
18
22
|
width: void 0,
|
|
19
|
-
showOverflowTooltip:
|
|
23
|
+
showOverflowTooltip: false,
|
|
20
24
|
sortable: void 0,
|
|
21
25
|
fixed: void 0
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
};
|
|
27
|
+
const table_attribute = computed(() => {
|
|
28
|
+
return {
|
|
29
|
+
...default_table_attr,
|
|
30
|
+
...Object.keys(props.options).length > 0 ? props.options : {}
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const selection_options = reactive({
|
|
26
34
|
count: 0,
|
|
27
35
|
rows: []
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
});
|
|
37
|
+
const pagination = reactive({
|
|
38
|
+
page_index: props?.paging?.pageIndex ? toRef(props.paging, "pageIndex") : 1,
|
|
39
|
+
page_size: props?.paging?.pageSize ? toRef(props.paging, "pageSize") : 10
|
|
40
|
+
});
|
|
41
|
+
const has_pagination = computed(() => {
|
|
42
|
+
const has = props?.paging?.pageIndex > 0 && props?.paging?.pageSize > 0;
|
|
43
|
+
if (!props.autoPagination) {
|
|
44
|
+
return has;
|
|
45
|
+
}
|
|
46
|
+
const total = props.tableData.length > (props.total || 0) ? props.tableData.length : props.total || 0;
|
|
47
|
+
return has && total > pagination.page_size;
|
|
48
|
+
});
|
|
49
|
+
const image_viewer = reactive({
|
|
50
|
+
/** 是否显示图片预览 */
|
|
51
|
+
show: false,
|
|
52
|
+
/** 图片路径列表 */
|
|
53
|
+
file_path_list: [],
|
|
54
|
+
/** 当前显示图片的索引 */
|
|
43
55
|
index: 0
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
label: ""
|
|
56
|
+
});
|
|
57
|
+
const column_config = shallowReactive({
|
|
58
|
+
show_column: [],
|
|
59
|
+
hidden_column: []
|
|
60
|
+
});
|
|
61
|
+
const col_setting_list = computed(() => {
|
|
62
|
+
if (!column_config.show_column || column_config.show_column.length === 0) {
|
|
63
|
+
return [{ prop: "default-prop", init: true, label: "" }];
|
|
52
64
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
const col_list = column_config.show_column.map((item) => {
|
|
66
|
+
const clonedItem = { ...item };
|
|
67
|
+
i18n_instance && clonedItem.langue && (clonedItem.label = i18n_instance(clonedItem.langue));
|
|
68
|
+
if (props.autoSize) {
|
|
69
|
+
if (clonedItem.width) {
|
|
70
|
+
clonedItem.width = auto_size(clonedItem.width || 0, base_w);
|
|
71
|
+
} else if (clonedItem.minWidth) {
|
|
72
|
+
clonedItem.minWidth = auto_size(clonedItem.minWidth || 0, base_w);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
clonedItem.minWidth = auto_size(clonedItem.minWidth || 0, base_w);
|
|
76
|
+
}
|
|
77
|
+
return { ...default_col_setting, ...clonedItem };
|
|
78
|
+
});
|
|
79
|
+
return col_list;
|
|
80
|
+
});
|
|
81
|
+
const show_tool_panel = computed(() => {
|
|
82
|
+
return (current_instance?.slots["tool-left"]?.()?.length || 0) > 0 || (current_instance?.slots["tool-right"]?.()?.length || 0) > 0;
|
|
83
|
+
});
|
|
84
|
+
const show_bottom_panel = computed(() => (current_instance?.slots["tool-left"]?.()?.length || 0) > 0);
|
|
85
|
+
const has_image_viewer = computed(() => col_setting_list.value.some(
|
|
86
|
+
(f) => f.fileType && f.fileType == FileType.PICTURE
|
|
59
87
|
));
|
|
60
88
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
89
|
+
def_col_setting: default_col_setting,
|
|
90
|
+
// 默认列配置
|
|
91
|
+
selection_options,
|
|
92
|
+
// 选中行状态
|
|
93
|
+
table_attribute,
|
|
94
|
+
// 表格属性
|
|
95
|
+
pagination,
|
|
96
|
+
// 分页配置
|
|
97
|
+
has_pagination,
|
|
98
|
+
// 是否显示分页
|
|
99
|
+
image_viewer,
|
|
100
|
+
// 图片预览配置
|
|
101
|
+
column_config,
|
|
102
|
+
// 列显示/隐藏配置
|
|
103
|
+
col_setting_list,
|
|
104
|
+
// 表格显示列
|
|
105
|
+
show_tool_panel,
|
|
106
|
+
// 是否显示工具栏
|
|
107
|
+
show_bottom_panel,
|
|
108
|
+
// 是否显示底部面板
|
|
109
|
+
has_image_viewer
|
|
110
|
+
// 是否包含图片预览功能
|
|
72
111
|
};
|
|
73
112
|
}
|
|
74
113
|
export {
|
|
75
|
-
|
|
114
|
+
use_table as default
|
|
76
115
|
};
|
package/lib/textButton/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import _sfc_main from "./src/index.vue.js";
|
|
2
|
+
_sfc_main.install = (app) => {
|
|
3
|
+
app.component("TextButton", _sfc_main);
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
_sfc_main as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
import { TextButtonType } from './type';
|
|
2
3
|
declare function __VLS_template(): {
|
|
3
4
|
attrs: Partial<{}>;
|
|
4
5
|
slots: {
|
|
@@ -10,26 +11,26 @@ declare function __VLS_template(): {
|
|
|
10
11
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
12
|
declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
12
13
|
type: {
|
|
13
|
-
type:
|
|
14
|
+
type: PropType<TextButtonType>;
|
|
14
15
|
default: string;
|
|
15
16
|
validator: (val: string) => boolean;
|
|
16
17
|
};
|
|
17
18
|
icon: StringConstructor;
|
|
18
19
|
disabled: BooleanConstructor;
|
|
19
20
|
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
20
|
-
click: (
|
|
21
|
+
click: (event: MouseEvent) => any;
|
|
21
22
|
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
22
23
|
type: {
|
|
23
|
-
type:
|
|
24
|
+
type: PropType<TextButtonType>;
|
|
24
25
|
default: string;
|
|
25
26
|
validator: (val: string) => boolean;
|
|
26
27
|
};
|
|
27
28
|
icon: StringConstructor;
|
|
28
29
|
disabled: BooleanConstructor;
|
|
29
30
|
}>> & Readonly<{
|
|
30
|
-
onClick?: ((
|
|
31
|
+
onClick?: ((event: MouseEvent) => any) | undefined;
|
|
31
32
|
}>, {
|
|
32
|
-
type:
|
|
33
|
+
type: TextButtonType;
|
|
33
34
|
disabled: boolean;
|
|
34
35
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
35
36
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,56 +1,44 @@
|
|
|
1
|
-
import { defineComponent
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, createElementVNode, withModifiers, renderSlot } from "vue";
|
|
2
|
+
import { props } from "./props.js";
|
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4
|
+
...{ name: "TextButton" },
|
|
4
5
|
__name: "index",
|
|
5
|
-
props:
|
|
6
|
-
type: {
|
|
7
|
-
type: String,
|
|
8
|
-
default: "primary",
|
|
9
|
-
validator: (e) => [
|
|
10
|
-
"default",
|
|
11
|
-
"primary",
|
|
12
|
-
"success",
|
|
13
|
-
"warning",
|
|
14
|
-
"info",
|
|
15
|
-
"danger"
|
|
16
|
-
].includes(e)
|
|
17
|
-
},
|
|
18
|
-
icon: String,
|
|
19
|
-
disabled: Boolean
|
|
20
|
-
},
|
|
6
|
+
props: props(),
|
|
21
7
|
emits: ["click"],
|
|
22
|
-
setup(
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
8
|
+
setup(__props, { emit: __emit }) {
|
|
9
|
+
const props2 = __props;
|
|
10
|
+
const emit = __emit;
|
|
11
|
+
function onClick(e) {
|
|
12
|
+
if (props2.disabled) return;
|
|
13
|
+
emit("click", e);
|
|
26
14
|
}
|
|
27
|
-
return (
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
class:
|
|
31
|
-
`text-button-${
|
|
32
|
-
|
|
15
|
+
return (_ctx, _cache) => {
|
|
16
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
17
|
+
return openBlock(), createElementBlock("div", {
|
|
18
|
+
class: normalizeClass(["text-button", [
|
|
19
|
+
`text-button-${_ctx.type}`,
|
|
20
|
+
_ctx.disabled && "is-disabled"
|
|
33
21
|
]])
|
|
34
22
|
}, [
|
|
35
|
-
|
|
23
|
+
_ctx.icon ? (openBlock(), createBlock(_component_el_icon, {
|
|
36
24
|
key: 0,
|
|
37
25
|
class: "text-button-icon"
|
|
38
26
|
}, {
|
|
39
|
-
default:
|
|
40
|
-
(
|
|
27
|
+
default: withCtx(() => [
|
|
28
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
41
29
|
]),
|
|
42
30
|
_: 1
|
|
43
|
-
})) :
|
|
44
|
-
|
|
31
|
+
})) : createCommentVNode("", true),
|
|
32
|
+
createElementVNode("div", {
|
|
45
33
|
class: "text-button-inner",
|
|
46
|
-
onClick:
|
|
34
|
+
onClick: withModifiers(onClick, ["prevent"])
|
|
47
35
|
}, [
|
|
48
|
-
|
|
36
|
+
renderSlot(_ctx.$slots, "default")
|
|
49
37
|
])
|
|
50
38
|
], 2);
|
|
51
39
|
};
|
|
52
40
|
}
|
|
53
41
|
});
|
|
54
42
|
export {
|
|
55
|
-
|
|
43
|
+
_sfc_main as default
|
|
56
44
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { TextButtonType } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* 文本按钮组件属性定义
|
|
5
|
+
*/
|
|
6
|
+
export declare const props: () => {
|
|
7
|
+
/**
|
|
8
|
+
* 按钮类型
|
|
9
|
+
*/
|
|
10
|
+
type: {
|
|
11
|
+
type: PropType<TextButtonType>;
|
|
12
|
+
default: string;
|
|
13
|
+
validator: (val: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 图标组件
|
|
17
|
+
*/
|
|
18
|
+
icon: StringConstructor;
|
|
19
|
+
/**
|
|
20
|
+
* 是否禁用
|
|
21
|
+
*/
|
|
22
|
+
disabled: BooleanConstructor;
|
|
23
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const props = () => ({
|
|
2
|
+
/**
|
|
3
|
+
* 按钮类型
|
|
4
|
+
*/
|
|
5
|
+
type: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: "primary",
|
|
8
|
+
validator: (val) => {
|
|
9
|
+
return [
|
|
10
|
+
"default",
|
|
11
|
+
"primary",
|
|
12
|
+
"success",
|
|
13
|
+
"warning",
|
|
14
|
+
"info",
|
|
15
|
+
"danger"
|
|
16
|
+
].includes(val);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* 图标组件
|
|
21
|
+
*/
|
|
22
|
+
icon: String,
|
|
23
|
+
/**
|
|
24
|
+
* 是否禁用
|
|
25
|
+
*/
|
|
26
|
+
disabled: Boolean
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
props
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文本按钮类型
|
|
3
|
+
*/
|
|
4
|
+
export type TextButtonType = 'default' | 'primary' | 'success' | 'warning' | 'info' | 'danger';
|
|
5
|
+
/**
|
|
6
|
+
* 文本按钮组件属性
|
|
7
|
+
*/
|
|
8
|
+
export interface TextButtonProps {
|
|
9
|
+
/**
|
|
10
|
+
* 按钮类型
|
|
11
|
+
*/
|
|
12
|
+
type: TextButtonType;
|
|
13
|
+
/**
|
|
14
|
+
* 图标组件
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 是否禁用
|
|
19
|
+
*/
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 文本按钮组件事件
|
|
24
|
+
*/
|
|
25
|
+
export interface TextButtonEmits {
|
|
26
|
+
/**
|
|
27
|
+
* 点击事件
|
|
28
|
+
*/
|
|
29
|
+
(e: 'click', event: MouseEvent): void;
|
|
30
|
+
}
|