yxuse 3.0.102 → 3.0.104

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.
Files changed (67) hide show
  1. package/README.md +89 -89
  2. package/lib/index.cjs11.js +1 -1
  3. package/lib/index.cjs2.js +1 -1
  4. package/lib/index.cjs5.js +1 -1
  5. package/lib/index.cjs5.js.gz +0 -0
  6. package/lib/index.cjs6.js +1 -1
  7. package/lib/index.es11.js +8 -2
  8. package/lib/index.es11.js.gz +0 -0
  9. package/lib/index.es2.js +209 -33
  10. package/lib/index.es2.js.gz +0 -0
  11. package/lib/index.es5.js +79 -8
  12. package/lib/index.es5.js.gz +0 -0
  13. package/lib/index.es6.js +3 -3
  14. package/lib/index.es6.js.gz +0 -0
  15. package/lib/utils.cjs.js +1 -1
  16. package/lib/utils.es.js +9 -1
  17. package/lib/vendor-axios.cjs.js.gz +0 -0
  18. package/lib/vendor-axios.es.js.gz +0 -0
  19. package/lib/vendor-dayjs.es.js.gz +0 -0
  20. package/lib/vendor-localforage.cjs.js.gz +0 -0
  21. package/lib/vendor-localforage.es.js.gz +0 -0
  22. package/lib/vendor-lodash.cjs.js.gz +0 -0
  23. package/lib/vendor-lodash.es.js.gz +0 -0
  24. package/lib/vendor-mqtt.cjs.js.gz +0 -0
  25. package/lib/vendor-mqtt.es.js.gz +0 -0
  26. package/lib/vendor-sortablejs.cjs.js.gz +0 -0
  27. package/lib/vendor-sortablejs.es.js.gz +0 -0
  28. package/lib/version.json +12 -12
  29. package/lib/yxuse.css +1 -1
  30. package/lib/yxuse.css.gz +0 -0
  31. package/package.json +178 -178
  32. package/types/api/modules/auth/index.d.ts +13 -13
  33. package/types/components/Common/DynamicComponent/index.vue.d.ts +21 -21
  34. package/types/components/CommonPage/index.d.ts +3 -3
  35. package/types/components/CommonPage/page.d.ts +64 -64
  36. package/types/components/CommonPage/pagination.d.ts +9 -9
  37. package/types/components/CommonPage/props.d.ts +36 -36
  38. package/types/components/CommonPage/search.d.ts +4 -4
  39. package/types/components/CommonPage/table.d.ts +3 -3
  40. package/types/components/CommonPage/type.d.ts +1 -1
  41. package/types/components/SearchForm/index.d.ts +3 -3
  42. package/types/components/SearchForm/index.vue.d.ts +2 -2
  43. package/types/components/YxForm/form.type.d.ts +183 -183
  44. package/types/components/YxForm/form.vaildator.d.ts +57 -57
  45. package/types/components/YxForm/form.vue.d.ts +66 -66
  46. package/types/components/YxFormV2/index.d.ts +3 -3
  47. package/types/components/YxFormV2/index.vue.d.ts +46 -46
  48. package/types/components/YxFormV2/type.d.ts +54 -54
  49. package/types/components/YxFrom/form.type.d.ts +179 -179
  50. package/types/components/YxFrom/form.vaildator.d.ts +57 -57
  51. package/types/components/YxFrom/form.vue.d.ts +66 -66
  52. package/types/components/YxFrom/index.d.ts +3 -3
  53. package/types/components/YxIcon/index.vue.d.ts +22 -22
  54. package/types/components/YxSearchForm/index.d.ts +3 -3
  55. package/types/components/YxSearchForm/index.vue.d.ts +36 -36
  56. package/types/components/YxSearchForm/type.d.ts +52 -52
  57. package/types/components/YxTable3/index.d.ts +1 -1
  58. package/types/components/YxTable3/src/index.d.ts +31 -31
  59. package/types/icons/index.d.ts +1 -1
  60. package/types/icons/src/index.d.ts +4 -4
  61. package/types/theme/checkVersion.d.ts +1 -0
  62. package/types/theme/config.d.ts +1 -0
  63. package/types/theme/type.d.ts +2 -0
  64. package/types/utils/index.d.ts +1 -0
  65. package/types/utils/mqtt/index.d.ts +24 -12
  66. package/types/utils/mqtt/interface.d.ts +6 -2
  67. package/types/utils/mqtt/singleton.d.ts +50 -0
@@ -1,66 +1,66 @@
1
- import { type Ref } from "vue";
2
- import type { IFormConfig } from "./form.type";
3
- declare const _default: <T extends object>(__VLS_props: ({
4
- status: "ADD";
5
- formConfig: IFormConfig<T>;
6
- } | {
7
- status: "EDIT";
8
- formConfig: IFormConfig<T>;
9
- formData: T;
10
- }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
11
- attrs: any;
12
- slots: Partial<Record<string, (_: {
13
- form: T;
14
- }) => any>>;
15
- emit: any;
16
- } | undefined, __VLS_expose?: ((exposed: import("vue").ShallowUnwrapRef<{
17
- form: Ref<T>;
18
- formValue: import("vue").ComputedRef<Partial<T>>;
19
- resetForm: () => void;
20
- validateForm: () => Promise<unknown>;
21
- }>) => void) | undefined, __VLS_setup?: Promise<{
22
- props: ({
23
- status: "ADD";
24
- formConfig: IFormConfig<T>;
25
- } | {
26
- status: "EDIT";
27
- formConfig: IFormConfig<T>;
28
- formData: T;
29
- }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
30
- expose(exposed: import("vue").ShallowUnwrapRef<{
31
- form: Ref<T>;
32
- formValue: import("vue").ComputedRef<Partial<T>>;
33
- resetForm: () => void;
34
- validateForm: () => Promise<unknown>;
35
- }>): void;
36
- attrs: any;
37
- slots: Partial<Record<string, (_: {
38
- form: T;
39
- }) => any>>;
40
- emit: any;
41
- }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
42
- [key: string]: any;
43
- }> & {
44
- __ctx?: {
45
- props: ({
46
- status: "ADD";
47
- formConfig: IFormConfig<T>;
48
- } | {
49
- status: "EDIT";
50
- formConfig: IFormConfig<T>;
51
- formData: T;
52
- }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
53
- expose(exposed: import("vue").ShallowUnwrapRef<{
54
- form: Ref<T>;
55
- formValue: import("vue").ComputedRef<Partial<T>>;
56
- resetForm: () => void;
57
- validateForm: () => Promise<unknown>;
58
- }>): void;
59
- attrs: any;
60
- slots: Partial<Record<string, (_: {
61
- form: T;
62
- }) => any>>;
63
- emit: any;
64
- } | undefined;
65
- };
66
- export default _default;
1
+ import { type Ref } from "vue";
2
+ import type { IFormConfig } from "./form.type";
3
+ declare const _default: <T extends object>(__VLS_props: ({
4
+ status: "ADD";
5
+ formConfig: IFormConfig<T>;
6
+ } | {
7
+ status: "EDIT";
8
+ formConfig: IFormConfig<T>;
9
+ formData: T;
10
+ }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
11
+ attrs: any;
12
+ slots: Partial<Record<string, (_: {
13
+ form: T;
14
+ }) => any>>;
15
+ emit: any;
16
+ } | undefined, __VLS_expose?: ((exposed: import("vue").ShallowUnwrapRef<{
17
+ form: Ref<T>;
18
+ formValue: import("vue").ComputedRef<Partial<T>>;
19
+ resetForm: () => void;
20
+ validateForm: () => Promise<unknown>;
21
+ }>) => void) | undefined, __VLS_setup?: Promise<{
22
+ props: ({
23
+ status: "ADD";
24
+ formConfig: IFormConfig<T>;
25
+ } | {
26
+ status: "EDIT";
27
+ formConfig: IFormConfig<T>;
28
+ formData: T;
29
+ }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
30
+ expose(exposed: import("vue").ShallowUnwrapRef<{
31
+ form: Ref<T>;
32
+ formValue: import("vue").ComputedRef<Partial<T>>;
33
+ resetForm: () => void;
34
+ validateForm: () => Promise<unknown>;
35
+ }>): void;
36
+ attrs: any;
37
+ slots: Partial<Record<string, (_: {
38
+ form: T;
39
+ }) => any>>;
40
+ emit: any;
41
+ }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
42
+ [key: string]: any;
43
+ }> & {
44
+ __ctx?: {
45
+ props: ({
46
+ status: "ADD";
47
+ formConfig: IFormConfig<T>;
48
+ } | {
49
+ status: "EDIT";
50
+ formConfig: IFormConfig<T>;
51
+ formData: T;
52
+ }) & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
53
+ expose(exposed: import("vue").ShallowUnwrapRef<{
54
+ form: Ref<T>;
55
+ formValue: import("vue").ComputedRef<Partial<T>>;
56
+ resetForm: () => void;
57
+ validateForm: () => Promise<unknown>;
58
+ }>): void;
59
+ attrs: any;
60
+ slots: Partial<Record<string, (_: {
61
+ form: T;
62
+ }) => any>>;
63
+ emit: any;
64
+ } | undefined;
65
+ };
66
+ export default _default;
@@ -1,3 +1,3 @@
1
- export { default as YxForm } from "./form.vue";
2
- export * from "./form.type";
3
- export * from "./form.vue";
1
+ export { default as YxForm } from "./form.vue";
2
+ export * from "./form.type";
3
+ export * from "./form.vue";
@@ -1,22 +1,22 @@
1
- interface YxIconProps {
2
- color?: string;
3
- size?: string;
4
- }
5
- declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<YxIconProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<YxIconProps>>>, {}, {}>, {
6
- default?(_: {}): any;
7
- }>;
8
- export default _default;
9
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
- type __VLS_TypePropsToRuntimeProps<T> = {
11
- [K in keyof T]-?: {} extends Pick<T, K> ? {
12
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
- } : {
14
- type: import('vue').PropType<T[K]>;
15
- required: true;
16
- };
17
- };
18
- type __VLS_WithTemplateSlots<T, S> = T & {
19
- new (): {
20
- $slots: S;
21
- };
22
- };
1
+ interface YxIconProps {
2
+ color?: string;
3
+ size?: string;
4
+ }
5
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<YxIconProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<YxIconProps>>>, {}, {}>, {
6
+ default?(_: {}): any;
7
+ }>;
8
+ export default _default;
9
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
+ type __VLS_TypePropsToRuntimeProps<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: import('vue').PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
18
+ type __VLS_WithTemplateSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -1,3 +1,3 @@
1
- export { default as YxSearchForm } from './index.vue';
2
- export * from './index.vue';
3
- export * from './type';
1
+ export { default as YxSearchForm } from './index.vue';
2
+ export * from './index.vue';
3
+ export * from './type';
@@ -1,36 +1,36 @@
1
- import { YxFormProps } from './type.ts';
2
-
3
- declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<YxFormProps>, {
4
- showSearchBtn: boolean;
5
- showAddBtn: boolean;
6
- }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
- search: () => void;
8
- add: () => void;
9
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<YxFormProps>, {
10
- showSearchBtn: boolean;
11
- showAddBtn: boolean;
12
- }>>> & Readonly<{
13
- onSearch?: (() => any) | undefined;
14
- onAdd?: (() => any) | undefined;
15
- }>, {
16
- showSearchBtn: boolean;
17
- showAddBtn: boolean;
18
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
19
- export default _default;
20
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
- type __VLS_TypePropsToRuntimeProps<T> = {
22
- [K in keyof T]-?: {} extends Pick<T, K> ? {
23
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
- } : {
25
- type: import('vue').PropType<T[K]>;
26
- required: true;
27
- };
28
- };
29
- type __VLS_WithDefaults<P, D> = {
30
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
- default: D[K];
32
- }> : P[K];
33
- };
34
- type __VLS_Prettify<T> = {
35
- [K in keyof T]: T[K];
36
- } & {};
1
+ import { YxFormProps } from './type.ts';
2
+
3
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<YxFormProps>, {
4
+ showSearchBtn: boolean;
5
+ showAddBtn: boolean;
6
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
+ search: () => void;
8
+ add: () => void;
9
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<YxFormProps>, {
10
+ showSearchBtn: boolean;
11
+ showAddBtn: boolean;
12
+ }>>> & Readonly<{
13
+ onSearch?: (() => any) | undefined;
14
+ onAdd?: (() => any) | undefined;
15
+ }>, {
16
+ showSearchBtn: boolean;
17
+ showAddBtn: boolean;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: import('vue').PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
29
+ type __VLS_WithDefaults<P, D> = {
30
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
+ default: D[K];
32
+ }> : P[K];
33
+ };
34
+ type __VLS_Prettify<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
@@ -1,52 +1,52 @@
1
- export interface YxFormProps {
2
- searchColumns: SearchFormConfig[];
3
- searchParams: Record<string, any>;
4
- showSearchBtn?: boolean;
5
- showAddBtn?: boolean;
6
- /** 设置样式 */
7
- style?: Record<string, any>;
8
- /** label样式 */
9
- labelStyle?: Record<string, any>;
10
- /** class */
11
- className?: string;
12
- /** label样式 */
13
- classLabelName?: string;
14
- }
15
- export interface SearchFormConfig {
16
- label: string;
17
- /** 渲染类型 */
18
- renderType: string;
19
- key?: string;
20
- /** 动态组件配置 */
21
- config?: Record<string, any>;
22
- /**控制表单显示或隐藏的方法 */
23
- show?: () => boolean;
24
- change?: () => void;
25
- /** 组件类样式 */
26
- componentClassName?: string[];
27
- /** 组件样式 */
28
- componentStyle?: Record<string, any>;
29
- /** 设置样式 */
30
- style?: Record<string, any>;
31
- /** label样式 */
32
- labelStyle?: Record<string, any>;
33
- /** class */
34
- className?: string;
35
- /** label样式 */
36
- classLabelName?: string;
37
- }
38
- export interface FormConfig {
39
- label: string;
40
- /** 渲染类型 */
41
- renderType: string;
42
- key?: string;
43
- options?: Array<{
44
- [key: string]: any;
45
- }> | Function;
46
- width?: number;
47
- componentWidth?: string;
48
- dateType?: string;
49
- inputType?: string;
50
- disabled?: boolean;
51
- clearable?: boolean;
52
- }
1
+ export interface YxFormProps {
2
+ searchColumns: SearchFormConfig[];
3
+ searchParams: Record<string, any>;
4
+ showSearchBtn?: boolean;
5
+ showAddBtn?: boolean;
6
+ /** 设置样式 */
7
+ style?: Record<string, any>;
8
+ /** label样式 */
9
+ labelStyle?: Record<string, any>;
10
+ /** class */
11
+ className?: string;
12
+ /** label样式 */
13
+ classLabelName?: string;
14
+ }
15
+ export interface SearchFormConfig {
16
+ label: string;
17
+ /** 渲染类型 */
18
+ renderType: string;
19
+ key?: string;
20
+ /** 动态组件配置 */
21
+ config?: Record<string, any>;
22
+ /**控制表单显示或隐藏的方法 */
23
+ show?: () => boolean;
24
+ change?: () => void;
25
+ /** 组件类样式 */
26
+ componentClassName?: string[];
27
+ /** 组件样式 */
28
+ componentStyle?: Record<string, any>;
29
+ /** 设置样式 */
30
+ style?: Record<string, any>;
31
+ /** label样式 */
32
+ labelStyle?: Record<string, any>;
33
+ /** class */
34
+ className?: string;
35
+ /** label样式 */
36
+ classLabelName?: string;
37
+ }
38
+ export interface FormConfig {
39
+ label: string;
40
+ /** 渲染类型 */
41
+ renderType: string;
42
+ key?: string;
43
+ options?: Array<{
44
+ [key: string]: any;
45
+ }> | Function;
46
+ width?: number;
47
+ componentWidth?: string;
48
+ dateType?: string;
49
+ inputType?: string;
50
+ disabled?: boolean;
51
+ clearable?: boolean;
52
+ }
@@ -1 +1 @@
1
- export { default as YxTable3 } from "./src/index.tsx";
1
+ export { default as YxTable3 } from "./src/index.tsx";
@@ -1,31 +1,31 @@
1
- import type { PropType } from "vue";
2
- import type { TableProps } from "./interface/index.d";
3
- declare const yxTableEmits: {
4
- "operate-handle": (key: string, row: object) => boolean;
5
- "sort-end": (oldIndex: number, newIndex: number) => boolean;
6
- "update-page": (type: string, value: number) => boolean;
7
- "size-change": () => boolean;
8
- };
9
- export type yxTableEmits = typeof yxTableEmits;
10
- declare const _default: import("vue").DefineComponent<{
11
- tableProps: {
12
- type: PropType<TableProps>;
13
- required: true;
14
- };
15
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
- "operate-handle": (key: string, row: object) => boolean;
17
- "sort-end": (oldIndex: number, newIndex: number) => boolean;
18
- "update-page": (type: string, value: number) => boolean;
19
- "size-change": () => boolean;
20
- }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
- tableProps: {
22
- type: PropType<TableProps>;
23
- required: true;
24
- };
25
- }>> & {
26
- "onOperate-handle"?: ((key: string, row: object) => any) | undefined;
27
- "onSort-end"?: ((oldIndex: number, newIndex: number) => any) | undefined;
28
- "onUpdate-page"?: ((type: string, value: number) => any) | undefined;
29
- "onSize-change"?: (() => any) | undefined;
30
- }, {}, {}>;
31
- export default _default;
1
+ import type { PropType } from "vue";
2
+ import type { TableProps } from "./interface/index.d";
3
+ declare const yxTableEmits: {
4
+ "operate-handle": (key: string, row: object) => boolean;
5
+ "sort-end": (oldIndex: number, newIndex: number) => boolean;
6
+ "update-page": (type: string, value: number) => boolean;
7
+ "size-change": () => boolean;
8
+ };
9
+ export type yxTableEmits = typeof yxTableEmits;
10
+ declare const _default: import("vue").DefineComponent<{
11
+ tableProps: {
12
+ type: PropType<TableProps>;
13
+ required: true;
14
+ };
15
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ "operate-handle": (key: string, row: object) => boolean;
17
+ "sort-end": (oldIndex: number, newIndex: number) => boolean;
18
+ "update-page": (type: string, value: number) => boolean;
19
+ "size-change": () => boolean;
20
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ tableProps: {
22
+ type: PropType<TableProps>;
23
+ required: true;
24
+ };
25
+ }>> & {
26
+ "onOperate-handle"?: ((key: string, row: object) => any) | undefined;
27
+ "onSort-end"?: ((oldIndex: number, newIndex: number) => any) | undefined;
28
+ "onUpdate-page"?: ((type: string, value: number) => any) | undefined;
29
+ "onSize-change"?: (() => any) | undefined;
30
+ }, {}, {}>;
31
+ export default _default;
@@ -1 +1 @@
1
- export * from "./src/index";
1
+ export * from "./src/index";
@@ -1,4 +1,4 @@
1
- import * as Component from "./svg/Component.svg";
2
- import * as Device from "./svg/device.svg?component";
3
- import * as Data from "./svg/Data.svg";
4
- export { Component, Device, Data };
1
+ import * as Component from "./svg/Component.svg";
2
+ import * as Device from "./svg/device.svg?component";
3
+ import * as Data from "./svg/Data.svg";
4
+ export { Component, Device, Data };
@@ -0,0 +1 @@
1
+ export declare const checkVersion: () => void;
@@ -15,4 +15,5 @@ export declare const defaultConfig: {
15
15
  isTranslateApi: boolean;
16
16
  whitelistTranslateApi: any[];
17
17
  autoGetSystemConfig: boolean;
18
+ autoListenMissFileReload: boolean;
18
19
  };
@@ -29,4 +29,6 @@ export interface YxuseOptions {
29
29
  environment: "development" | "production";
30
30
  /***是否自动获取系统的配置 */
31
31
  autoGetSystemConfig: true;
32
+ /***是否自动监听文件缺失刷新页面 */
33
+ autoListenMissFileReload: boolean;
32
34
  }
@@ -3,4 +3,5 @@ export * from './common/index';
3
3
  export { default as yxSubscribe } from './subscribe/index';
4
4
  export { yxFecth } from './fecth/index';
5
5
  export { default as MQ } from './mqtt/index';
6
+ export * from './mqtt/singleton';
6
7
  export { default as WS } from './socket/index';
@@ -1,16 +1,28 @@
1
- import { CusOptions } from './interface';
1
+ import { ClientOptions, CusOptions } from './interface';
2
+ import { IClientOptions, IClientPublishOptions, IClientSubscribeOptions } from 'mqtt';
2
3
 
4
+ type MessageCallback = (_payload: unknown, _topic: string) => void;
3
5
  declare class MQ {
4
- client: any;
5
- constructor(url: string, options: CusOptions);
6
- createClient(url: string, options: CusOptions): void;
7
- publish(topic: string, message: any): void;
8
- subscribe(topic: any, callback: any): void;
9
- unsubscribe(topic: any): void;
10
- onConnect(e: any): void;
11
- onReconnect(error: any): void;
12
- onError(error: any): void;
13
- onMessage(topic: any, message: any): void;
14
- destroyed(): void;
6
+ private client;
7
+ private readonly subscribeMap;
8
+ onConnect: (_e: unknown) => void;
9
+ onReconnect: (_error: unknown) => void;
10
+ onError: (_error: unknown) => void;
11
+ onMessage: (_topic: string, _message: unknown) => void;
12
+ destroyed: () => void;
13
+ /**标记是否为手动关闭连接 */
14
+ private isManualClose;
15
+ constructor(url: string, options: CusOptions & Partial<ClientOptions>);
16
+ createClient(url: string, options: IClientOptions): void;
17
+ publish(topic: string, message: unknown, options?: IClientPublishOptions): void;
18
+ subscribe(topic: string, callback: MessageCallback, options?: IClientSubscribeOptions): void;
19
+ unsubscribe(topic: string): void;
20
+ resubscribeAll(): void;
21
+ /**
22
+ * @description 分析断开原因
23
+ * @param error 错误对象
24
+ * @returns 断开原因描述
25
+ */
26
+ private analyzeDisconnectReason;
15
27
  }
16
28
  export default MQ;
@@ -4,11 +4,15 @@ export interface ClientOptions {
4
4
  clean: boolean;
5
5
  /**超时时间 */
6
6
  connectTimeout: number;
7
- keepAlive: number;
7
+ /**心跳时间 */
8
+ keepalive: number;
8
9
  /**认证信息 */
9
10
  clientId?: string;
10
- qos: 1;
11
+ /**重连间隔时间 */
12
+ reconnectPeriod: number;
11
13
  }
14
+ /**消息质量: 0: 最多一次, 1: 至少一次, 2: 只有一次 */
15
+ export type Qos = 0 | 1 | 2;
12
16
  export interface CusOptions {
13
17
  /**用户名 */
14
18
  username?: string;
@@ -0,0 +1,50 @@
1
+ import { IClientPublishOptions, IClientSubscribeOptions } from 'mqtt';
2
+ import { default as MQ } from './index';
3
+ import { ClientOptions, CusOptions } from './interface';
4
+
5
+ export type MqttMessageHandler = (_payload: unknown, _topic: string) => void;
6
+ export interface InitMQSingletonOptions extends CusOptions, Partial<ClientOptions> {
7
+ }
8
+ export interface InitMQSingletonConfig {
9
+ /**
10
+ * 是否强制重建连接(会先 destroy,再按新参数创建)
11
+ * @default false
12
+ */
13
+ force?: boolean;
14
+ }
15
+ /**
16
+ * 获取已创建的连接 url 列表
17
+ */
18
+ export declare const getMQSingletonUrls: () => string[];
19
+ /**
20
+ * 初始化 MQ 单例连接(单 url 单一链接,多次调用复用同一 url 的实例)
21
+ */
22
+ export declare const initMQSingleton: (url: string, options: InitMQSingletonOptions, config?: InitMQSingletonConfig) => MQ;
23
+ /**
24
+ * 获取 MQ 单例实例(按 url;未 init 时返回 null)
25
+ */
26
+ export declare const getMQSingleton: (url: string) => MQ | null;
27
+ /**
28
+ * 发布消息(需要先 init)
29
+ */
30
+ export declare const publishMQ: (url: string, topic: string, message: unknown, options?: IClientPublishOptions) => void;
31
+ /**
32
+ * 订阅 topic(支持同一 topic 多回调)
33
+ * - 首次订阅某个 topic 时:会触发底层 MQ.subscribe
34
+ * - 返回一个取消订阅函数,方便在 onUnmounted 中调用
35
+ */
36
+ export declare const subscribeMQ: (url: string, topic: string, handler: MqttMessageHandler, options?: IClientSubscribeOptions) => (() => void);
37
+ /**
38
+ * 取消订阅
39
+ * - 不传 handler:取消该 topic 的所有订阅者,并触发底层 MQ.unsubscribe
40
+ * - 传 handler:仅移除该 handler;当该 topic 没有任何 handler 时才触发底层 MQ.unsubscribe
41
+ */
42
+ export declare const unsubscribeMQ: (url: string, topic: string, handler?: MqttMessageHandler) => void;
43
+ /**
44
+ * 销毁单例连接,并清空订阅关系
45
+ */
46
+ export declare const destroyMQSingleton: (url: string) => void;
47
+ /**
48
+ * 销毁所有 url 的连接
49
+ */
50
+ export declare const destroyAllMQSingleton: () => void;