qy-better-lib 0.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/.vscode/extensions.json +3 -0
- package/LICENSE +24 -0
- package/README.md +2 -0
- package/index.html +13 -0
- package/package.json +37 -0
- package/packages/core/DOCUMENTATION.md +2681 -0
- package/packages/core/LICENSE +24 -0
- package/packages/core/package.json +67 -0
- package/packages/core/types/index.d.ts +39 -0
- package/packages/core/types/json.d.ts +4 -0
- package/packages/core/types/vue.shim.d.ts +5 -0
- package/packages/core/vitest.config.ts +15 -0
- package/packages/core/yarn.lock +1233 -0
- package/packages/hooks/DOCUMENTATION.md +634 -0
- package/packages/hooks/LICENSE +24 -0
- package/packages/hooks/__tests__/use-chart/index.test.ts +287 -0
- package/packages/hooks/__tests__/use-emit/index.test.ts +248 -0
- package/packages/hooks/__tests__/use-fullscreen/index.test.ts +162 -0
- package/packages/hooks/__tests__/use-image/index.test.ts +230 -0
- package/packages/hooks/__tests__/use-layout-flow/index.test.ts +382 -0
- package/packages/hooks/__tests__/use-mqtt/index.test.ts +392 -0
- package/packages/hooks/__tests__/use-print/index.test.ts +378 -0
- package/packages/hooks/__tests__/use-watermark/index.test.ts +277 -0
- package/packages/hooks/__tests__/use-websocket/index.test.ts +402 -0
- package/packages/hooks/package.json +104 -0
- package/packages/hooks/types/index.d.ts +1 -0
- package/packages/hooks/types/json.d.ts +4 -0
- package/packages/hooks/types/vue.shim.d.ts +5 -0
- package/packages/hooks/yarn.lock +1832 -0
- package/packages/lowcode/core/package.json +60 -0
- package/packages/lowcode/core/types/index.d.ts +1 -0
- package/packages/lowcode/core/types/json.d.ts +4 -0
- package/packages/lowcode/core/types/vue.shim.d.ts +5 -0
- package/packages/lowcode/core/vite.dist.min.config.js +40 -0
- package/packages/lowcode/core/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/core/vite.lib.config.js +74 -0
- package/packages/lowcode/core/vite.lib.config.js.map +1 -0
- package/packages/lowcode/core/yarn.lock +1132 -0
- package/packages/lowcode/mobile/package.json +63 -0
- package/packages/lowcode/mobile/types/index.d.ts +1 -0
- package/packages/lowcode/mobile/types/json.d.ts +4 -0
- package/packages/lowcode/mobile/types/vue.shim.d.ts +77 -0
- package/packages/lowcode/mobile/vite.config.js +11 -0
- package/packages/lowcode/mobile/vite.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js +71 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.lib.config.js +137 -0
- package/packages/lowcode/mobile/vite.lib.config.js.map +1 -0
- package/packages/lowcode/mobile/yarn.lock +3888 -0
- package/packages/lowcode/pc/package.json +64 -0
- package/packages/lowcode/pc/vite.config.js +11 -0
- package/packages/lowcode/pc/vite.config.js.map +1 -0
- package/packages/lowcode/pc/vite.dist.min.config.js +71 -0
- package/packages/lowcode/pc/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/pc/vite.lib.config.js +137 -0
- package/packages/lowcode/pc/vite.lib.config.js.map +1 -0
- package/packages/lowcode/pc/yarn.lock +4026 -0
- package/packages/pc_components/DOCUMENTATION.md +566 -0
- package/packages/pc_components/LICENSE +24 -0
- package/packages/pc_components/lib/commDialog/index.d.ts +3 -0
- package/packages/pc_components/lib/commDialog/index.js +8 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.d.ts +102 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.js +43 -0
- package/packages/pc_components/lib/commDialog/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commDialog/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commDialog/src/props.js +48 -0
- package/packages/pc_components/lib/commDialog/src/type.d.ts +39 -0
- package/packages/pc_components/lib/commForm/index.d.ts +3 -0
- package/packages/pc_components/lib/commForm/index.js +8 -0
- package/packages/pc_components/lib/commForm/src/index.vue.d.ts +95 -0
- package/packages/pc_components/lib/commForm/src/index.vue.js +50 -0
- package/packages/pc_components/lib/commForm/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commForm/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commForm/src/props.js +47 -0
- package/packages/pc_components/lib/commForm/src/type.d.ts +8 -0
- package/packages/pc_components/lib/contextMenu/index.d.ts +5 -0
- package/packages/pc_components/lib/contextMenu/index.js +8 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.d.ts +91 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.js +153 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/contextMenu/src/props.d.ts +32 -0
- package/packages/pc_components/lib/contextMenu/src/props.js +27 -0
- package/packages/pc_components/lib/contextMenu/src/type.d.ts +11 -0
- package/packages/pc_components/lib/describeView/index.d.ts +2 -0
- package/packages/pc_components/lib/describeView/index.js +7 -0
- package/packages/pc_components/lib/describeView/src/index.vue.d.ts +61 -0
- package/packages/pc_components/lib/describeView/src/index.vue.js +84 -0
- package/packages/pc_components/lib/describeView/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/describeView/src/props.d.ts +35 -0
- package/packages/pc_components/lib/describeView/src/props.js +33 -0
- package/packages/pc_components/lib/describeView/src/type.d.ts +10 -0
- package/packages/pc_components/lib/index.d.ts +18 -0
- package/packages/pc_components/lib/index.js +40 -0
- package/packages/pc_components/lib/simpleVirtualList/index.d.ts +2 -0
- package/packages/pc_components/lib/simpleVirtualList/index.js +7 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.d.ts +28 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.js +101 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/simpleVirtualList/src/type.d.ts +12 -0
- package/packages/pc_components/lib/styles/comm-form.scss +4 -0
- package/packages/pc_components/lib/styles/context-menu.scss +47 -0
- package/packages/pc_components/lib/styles/describe-view.scss +25 -0
- package/packages/pc_components/lib/styles/index.scss +6 -0
- package/packages/pc_components/lib/styles/simple-virtual-list.scss +25 -0
- package/packages/pc_components/lib/styles/table-extend.scss +100 -0
- package/packages/pc_components/lib/styles/text-button.scss +71 -0
- package/packages/pc_components/lib/tableExtend/index.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/index.js +7 -0
- package/packages/pc_components/lib/tableExtend/props.d.ts +130 -0
- package/packages/pc_components/lib/tableExtend/props.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.d.ts +186 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.js +234 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.d.ts +24 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.js +29 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/type.d.ts +165 -0
- package/packages/pc_components/lib/tableExtend/type.js +9 -0
- package/packages/pc_components/lib/tableExtend/useTable.d.ts +27 -0
- package/packages/pc_components/lib/tableExtend/useTable.js +115 -0
- package/packages/pc_components/lib/textButton/index.d.ts +2 -0
- package/packages/pc_components/lib/textButton/index.js +7 -0
- package/packages/pc_components/lib/textButton/src/index.vue.d.ts +42 -0
- package/packages/pc_components/lib/textButton/src/index.vue.js +44 -0
- package/packages/pc_components/lib/textButton/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/textButton/src/props.d.ts +23 -0
- package/packages/pc_components/lib/textButton/src/props.js +30 -0
- package/packages/pc_components/lib/textButton/src/type.d.ts +30 -0
- package/packages/pc_components/lib/utils/index.d.ts +77 -0
- package/packages/pc_components/lib/utils/index.js +124 -0
- package/packages/pc_components/package.json +73 -0
- package/packages/pc_components/types/index.d.ts +9 -0
- package/packages/pc_components/types/json.d.ts +4 -0
- package/packages/pc_components/types/vue.shim.d.ts +5 -0
- package/packages/pc_components/yarn.lock +1641 -0
- package/postcss.config.js +19 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +37 -0
- package/src/api/index.ts +42 -0
- package/src/assets/vue.svg +1 -0
- package/src/document/core.md +2680 -0
- package/src/document/hooks.md +632 -0
- package/src/document/pc_components.md +566 -0
- package/src/locales/en.json +1 -0
- package/src/locales/zh-cn.json +1 -0
- package/src/main.ts +13 -0
- package/src/plugins/element-plus.ts +16 -0
- package/src/plugins/i18n.ts +17 -0
- package/src/plugins/index.ts +13 -0
- package/src/plugins/store.ts +12 -0
- package/src/router/index.ts +20 -0
- package/src/shared/chartType.ts +279 -0
- package/src/shared/const.ts +160 -0
- package/src/shared/lib.ts +129 -0
- package/src/shared/request.ts +255 -0
- package/src/shared/type.ts +48 -0
- package/src/shared/utils/date.ts +83 -0
- package/src/shared/utils/utils.ts +85 -0
- package/src/store/index.ts +22 -0
- package/src/store/modules/app.ts +17 -0
- package/src/store/modules/shared.ts +21 -0
- package/src/styles/index.scss +169 -0
- package/src/types/app.d.ts +23 -0
- package/src/types/echarts.d.ts +5 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/json.d.ts +4 -0
- package/src/types/scss.d.ts +9 -0
- package/src/types/vue.shim.d.ts +5 -0
- package/src/views/docs/docs-content.vue +379 -0
- package/src/views/docs/docs-header.vue +130 -0
- package/src/views/docs/docs-sidebar.vue +76 -0
- package/src/views/docs/hooks.ts +600 -0
- package/src/views/docs/index.vue +30 -0
- package/src/views/docs/styles/docs-content.scss +106 -0
- package/src/views/docs/styles/docs-header.scss +20 -0
- package/src/views/docs/styles/docs-sidebar.scss +182 -0
- package/src/views/docs/styles/index.scss +14 -0
- package/src/views/docs/type.ts +101 -0
- package/src/views/index.vue +34 -0
- package/tsconfig.json +37 -0
- package/tsconfig.node.json +8 -0
- package/vite.config.ts +54 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent, useAttrs, useSlots, openBlock, createBlock, createCommentVNode, createVNode, mergeProps } from "vue";
|
|
2
|
+
import { ElDialog, ElDrawer } from "element-plus";
|
|
3
|
+
import { props } from "./props.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "index",
|
|
6
|
+
props: props(),
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const props2 = __props;
|
|
9
|
+
const attrs = useAttrs();
|
|
10
|
+
const slots = useSlots();
|
|
11
|
+
const dialog_component = () => createVNode(ElDialog, mergeProps(attrs, {
|
|
12
|
+
"width": props2.size,
|
|
13
|
+
"showClose": props2.showClose,
|
|
14
|
+
"draggable": props2.draggable,
|
|
15
|
+
"modal": props2.modal,
|
|
16
|
+
"modalStyle": props2.modalStyle
|
|
17
|
+
}), {
|
|
18
|
+
header: () => slots.header?.(),
|
|
19
|
+
default: () => slots.default?.(),
|
|
20
|
+
footer: () => slots.footer?.()
|
|
21
|
+
});
|
|
22
|
+
const drawer_component = () => createVNode(ElDrawer, mergeProps(attrs, {
|
|
23
|
+
"size": props2.size,
|
|
24
|
+
"showClose": props2.showClose,
|
|
25
|
+
"modal": props2.modal,
|
|
26
|
+
"modalStyle": props2.modalStyle
|
|
27
|
+
}), {
|
|
28
|
+
header: () => slots.header?.(),
|
|
29
|
+
default: () => slots.default?.(),
|
|
30
|
+
footer: () => slots.footer?.()
|
|
31
|
+
});
|
|
32
|
+
return (_ctx, _cache) => {
|
|
33
|
+
return _ctx.type === "dialog" ? (openBlock(), createBlock(dialog_component, {
|
|
34
|
+
key: 0
|
|
35
|
+
})) : _ctx.type === "drawer" ? (openBlock(), createBlock(drawer_component, {
|
|
36
|
+
key: 1
|
|
37
|
+
})) : createCommentVNode("", true);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
_sfc_main as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DialogType } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* 通用弹窗组件属性定义
|
|
4
|
+
*/
|
|
5
|
+
export declare const props: () => {
|
|
6
|
+
/**
|
|
7
|
+
* 弹窗类型
|
|
8
|
+
*/
|
|
9
|
+
type: {
|
|
10
|
+
type: () => DialogType;
|
|
11
|
+
default: string;
|
|
12
|
+
validator: (value: string) => boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 弹窗大小
|
|
16
|
+
*/
|
|
17
|
+
size: {
|
|
18
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 是否显示关闭按钮
|
|
23
|
+
*/
|
|
24
|
+
showClose: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 是否可拖动
|
|
30
|
+
*/
|
|
31
|
+
draggable: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 是否模态
|
|
37
|
+
*/
|
|
38
|
+
modal: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 遮罩层样式
|
|
44
|
+
*/
|
|
45
|
+
modalStyle: {
|
|
46
|
+
type: ObjectConstructor;
|
|
47
|
+
default: () => {};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const props = () => ({
|
|
2
|
+
/**
|
|
3
|
+
* 弹窗类型
|
|
4
|
+
*/
|
|
5
|
+
type: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: "dialog",
|
|
8
|
+
validator: (value) => ["dialog", "drawer"].includes(value)
|
|
9
|
+
},
|
|
10
|
+
/**
|
|
11
|
+
* 弹窗大小
|
|
12
|
+
*/
|
|
13
|
+
size: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: "50%"
|
|
16
|
+
},
|
|
17
|
+
/**
|
|
18
|
+
* 是否显示关闭按钮
|
|
19
|
+
*/
|
|
20
|
+
showClose: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* 是否可拖动
|
|
26
|
+
*/
|
|
27
|
+
draggable: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
/**
|
|
32
|
+
* 是否模态
|
|
33
|
+
*/
|
|
34
|
+
modal: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* 遮罩层样式
|
|
40
|
+
*/
|
|
41
|
+
modalStyle: {
|
|
42
|
+
type: Object,
|
|
43
|
+
default: () => ({})
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
props
|
|
48
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DialogProps, DrawerProps } from 'element-plus';
|
|
2
|
+
/**
|
|
3
|
+
* 弹窗类型
|
|
4
|
+
*/
|
|
5
|
+
export type DialogType = 'dialog' | 'drawer';
|
|
6
|
+
/**
|
|
7
|
+
* 通用弹窗组件属性
|
|
8
|
+
*/
|
|
9
|
+
export interface CommonDialogProps {
|
|
10
|
+
/**
|
|
11
|
+
* 弹窗类型
|
|
12
|
+
*/
|
|
13
|
+
type: DialogType;
|
|
14
|
+
/**
|
|
15
|
+
* 弹窗大小
|
|
16
|
+
*/
|
|
17
|
+
size: string | number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 弹窗组件插槽
|
|
21
|
+
*/
|
|
22
|
+
export interface CommonDialogSlots {
|
|
23
|
+
/**
|
|
24
|
+
* 头部插槽
|
|
25
|
+
*/
|
|
26
|
+
header?: () => any;
|
|
27
|
+
/**
|
|
28
|
+
* 默认插槽
|
|
29
|
+
*/
|
|
30
|
+
default?: () => any;
|
|
31
|
+
/**
|
|
32
|
+
* 底部插槽
|
|
33
|
+
*/
|
|
34
|
+
footer?: () => any;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 合并的弹窗属性(包含Element Plus的属性)
|
|
38
|
+
*/
|
|
39
|
+
export type MergedDialogProps = CommonDialogProps & Partial<DialogProps> & Partial<DrawerProps>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { LabelPosition } from './type';
|
|
2
|
+
import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* 表单验证
|
|
5
|
+
*/
|
|
6
|
+
declare function validate(): Promise<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* 表单重置
|
|
9
|
+
*/
|
|
10
|
+
declare function reset(): void;
|
|
11
|
+
declare function __VLS_template(): {
|
|
12
|
+
attrs: Partial<{}>;
|
|
13
|
+
slots: Readonly<{
|
|
14
|
+
/**默认插槽 */
|
|
15
|
+
default: () => any[];
|
|
16
|
+
/**底部插槽 */
|
|
17
|
+
footer: () => any[];
|
|
18
|
+
}> & {
|
|
19
|
+
/**默认插槽 */
|
|
20
|
+
default: () => any[];
|
|
21
|
+
/**底部插槽 */
|
|
22
|
+
footer: () => any[];
|
|
23
|
+
};
|
|
24
|
+
refs: {};
|
|
25
|
+
rootEl: any;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
28
|
+
declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
29
|
+
labelWidth: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
default: number;
|
|
32
|
+
};
|
|
33
|
+
labelPosition: {
|
|
34
|
+
type: PropType<LabelPosition>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
model: {
|
|
38
|
+
type: PropType<Record<string, any>>;
|
|
39
|
+
default: () => {};
|
|
40
|
+
};
|
|
41
|
+
formRules: {
|
|
42
|
+
type: PropType<Record<string, any>>;
|
|
43
|
+
default: () => {};
|
|
44
|
+
};
|
|
45
|
+
column: {
|
|
46
|
+
type: NumberConstructor;
|
|
47
|
+
default: number;
|
|
48
|
+
};
|
|
49
|
+
options: {
|
|
50
|
+
type: PropType<Record<string, any>>;
|
|
51
|
+
default: () => {};
|
|
52
|
+
};
|
|
53
|
+
}>, {
|
|
54
|
+
validate: typeof validate;
|
|
55
|
+
reset: typeof reset;
|
|
56
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
57
|
+
labelWidth: {
|
|
58
|
+
type: NumberConstructor;
|
|
59
|
+
default: number;
|
|
60
|
+
};
|
|
61
|
+
labelPosition: {
|
|
62
|
+
type: PropType<LabelPosition>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
model: {
|
|
66
|
+
type: PropType<Record<string, any>>;
|
|
67
|
+
default: () => {};
|
|
68
|
+
};
|
|
69
|
+
formRules: {
|
|
70
|
+
type: PropType<Record<string, any>>;
|
|
71
|
+
default: () => {};
|
|
72
|
+
};
|
|
73
|
+
column: {
|
|
74
|
+
type: NumberConstructor;
|
|
75
|
+
default: number;
|
|
76
|
+
};
|
|
77
|
+
options: {
|
|
78
|
+
type: PropType<Record<string, any>>;
|
|
79
|
+
default: () => {};
|
|
80
|
+
};
|
|
81
|
+
}>> & Readonly<{}>, {
|
|
82
|
+
column: number;
|
|
83
|
+
options: Record<string, any>;
|
|
84
|
+
labelWidth: number;
|
|
85
|
+
labelPosition: LabelPosition;
|
|
86
|
+
model: Record<string, any>;
|
|
87
|
+
formRules: Record<string, any>;
|
|
88
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
89
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
90
|
+
export default _default;
|
|
91
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
92
|
+
new (): {
|
|
93
|
+
$slots: S;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, useSlots, openBlock, createBlock, createVNode, resolveComponent, mergeProps } from "vue";
|
|
2
|
+
import { validateForm } from "../../utils/index.js";
|
|
3
|
+
import { props } from "./props.js";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "index",
|
|
6
|
+
props: props(),
|
|
7
|
+
setup(__props, {
|
|
8
|
+
expose: __expose
|
|
9
|
+
}) {
|
|
10
|
+
const props2 = __props;
|
|
11
|
+
const form_ref = ref(null);
|
|
12
|
+
const form_style = computed(() => {
|
|
13
|
+
return {
|
|
14
|
+
"grid-template-columns": `repeat(${props2.column}, minmax(1px, 1fr))`
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
const form_attr = computed(() => ({
|
|
18
|
+
labelWidth: props2.labelWidth,
|
|
19
|
+
labelPosition: props2.labelPosition,
|
|
20
|
+
...props2.options
|
|
21
|
+
}));
|
|
22
|
+
__expose({
|
|
23
|
+
validate,
|
|
24
|
+
reset
|
|
25
|
+
});
|
|
26
|
+
const slots = useSlots();
|
|
27
|
+
async function validate() {
|
|
28
|
+
return await validateForm(form_ref);
|
|
29
|
+
}
|
|
30
|
+
function reset() {
|
|
31
|
+
form_ref.value?.resetFields();
|
|
32
|
+
}
|
|
33
|
+
const common_form = () => createVNode(resolveComponent("el-form"), mergeProps({
|
|
34
|
+
"class": "comm-form",
|
|
35
|
+
"model": props2.model,
|
|
36
|
+
"rules": props2.formRules,
|
|
37
|
+
"ref": form_ref
|
|
38
|
+
}, form_attr.value, {
|
|
39
|
+
"style": form_style.value
|
|
40
|
+
}), {
|
|
41
|
+
default: () => [slots.default?.(), slots.footer?.()]
|
|
42
|
+
});
|
|
43
|
+
return (_ctx, _cache) => {
|
|
44
|
+
return openBlock(), createBlock(common_form);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
_sfc_main as default
|
|
50
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { LabelPosition } from './type';
|
|
3
|
+
/**
|
|
4
|
+
* 通用表单组件属性定义
|
|
5
|
+
*/
|
|
6
|
+
export declare const props: () => {
|
|
7
|
+
/**
|
|
8
|
+
* 标题宽度
|
|
9
|
+
*/
|
|
10
|
+
labelWidth: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 标签位置
|
|
16
|
+
*/
|
|
17
|
+
labelPosition: {
|
|
18
|
+
type: PropType<LabelPosition>;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 表单数据
|
|
23
|
+
*/
|
|
24
|
+
model: {
|
|
25
|
+
type: PropType<Record<string, any>>;
|
|
26
|
+
default: () => {};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 验证规则
|
|
30
|
+
*/
|
|
31
|
+
formRules: {
|
|
32
|
+
type: PropType<Record<string, any>>;
|
|
33
|
+
default: () => {};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 表单列数,默认1列
|
|
37
|
+
*/
|
|
38
|
+
column: {
|
|
39
|
+
type: NumberConstructor;
|
|
40
|
+
default: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* UI组件属性
|
|
44
|
+
*/
|
|
45
|
+
options: {
|
|
46
|
+
type: PropType<Record<string, any>>;
|
|
47
|
+
default: () => {};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const props = () => ({
|
|
2
|
+
/**
|
|
3
|
+
* 标题宽度
|
|
4
|
+
*/
|
|
5
|
+
labelWidth: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 100
|
|
8
|
+
},
|
|
9
|
+
/**
|
|
10
|
+
* 标签位置
|
|
11
|
+
*/
|
|
12
|
+
labelPosition: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "left"
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* 表单数据
|
|
18
|
+
*/
|
|
19
|
+
model: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => ({})
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* 验证规则
|
|
25
|
+
*/
|
|
26
|
+
formRules: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: () => ({})
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* 表单列数,默认1列
|
|
32
|
+
*/
|
|
33
|
+
column: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 1
|
|
36
|
+
},
|
|
37
|
+
/**
|
|
38
|
+
* UI组件属性
|
|
39
|
+
*/
|
|
40
|
+
options: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({})
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export {
|
|
46
|
+
props
|
|
47
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ContextMenuItem, MenuPosition } from './type';
|
|
2
|
+
import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* 显示菜单
|
|
5
|
+
* @param event 鼠标事件或位置对象
|
|
6
|
+
*/
|
|
7
|
+
declare function show(event: MouseEvent | MenuPosition): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* 隐藏菜单
|
|
10
|
+
*/
|
|
11
|
+
declare function hide(): void;
|
|
12
|
+
declare function __VLS_template(): {
|
|
13
|
+
attrs: Partial<{}>;
|
|
14
|
+
slots: {
|
|
15
|
+
item?(_: {
|
|
16
|
+
data: ContextMenuItem;
|
|
17
|
+
}): any;
|
|
18
|
+
};
|
|
19
|
+
refs: {
|
|
20
|
+
context_menu_ref: HTMLDivElement;
|
|
21
|
+
};
|
|
22
|
+
rootEl: any;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
|
+
declare const __VLS_component: DefineComponent<ExtractPropTypes<{
|
|
26
|
+
position: {
|
|
27
|
+
type: PropType<MenuPosition>;
|
|
28
|
+
default: () => {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
options: {
|
|
34
|
+
type: PropType<ContextMenuItem[]>;
|
|
35
|
+
default: () => never[];
|
|
36
|
+
required: boolean;
|
|
37
|
+
};
|
|
38
|
+
disabled: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
visible: {
|
|
43
|
+
type: PropType<boolean>;
|
|
44
|
+
};
|
|
45
|
+
}>, {
|
|
46
|
+
hide: typeof hide;
|
|
47
|
+
show: typeof show;
|
|
48
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
49
|
+
show: () => any;
|
|
50
|
+
menu_click: (item: ContextMenuItem) => any;
|
|
51
|
+
hide: () => any;
|
|
52
|
+
"update:visible": (value: boolean) => any;
|
|
53
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
54
|
+
position: {
|
|
55
|
+
type: PropType<MenuPosition>;
|
|
56
|
+
default: () => {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
options: {
|
|
62
|
+
type: PropType<ContextMenuItem[]>;
|
|
63
|
+
default: () => never[];
|
|
64
|
+
required: boolean;
|
|
65
|
+
};
|
|
66
|
+
disabled: {
|
|
67
|
+
type: BooleanConstructor;
|
|
68
|
+
default: boolean;
|
|
69
|
+
};
|
|
70
|
+
visible: {
|
|
71
|
+
type: PropType<boolean>;
|
|
72
|
+
};
|
|
73
|
+
}>> & Readonly<{
|
|
74
|
+
onShow?: (() => any) | undefined;
|
|
75
|
+
onMenu_click?: ((item: ContextMenuItem) => any) | undefined;
|
|
76
|
+
onHide?: (() => any) | undefined;
|
|
77
|
+
"onUpdate:visible"?: ((value: boolean) => any) | undefined;
|
|
78
|
+
}>, {
|
|
79
|
+
disabled: boolean;
|
|
80
|
+
options: ContextMenuItem[];
|
|
81
|
+
position: MenuPosition;
|
|
82
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
83
|
+
context_menu_ref: HTMLDivElement;
|
|
84
|
+
}, any>;
|
|
85
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
86
|
+
export default _default;
|
|
87
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
88
|
+
new (): {
|
|
89
|
+
$slots: S;
|
|
90
|
+
};
|
|
91
|
+
};
|