g-ui-web 1.3.59 → 1.3.60

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/style.css.gz CHANGED
Binary file
@@ -1,2 +1,95 @@
1
- declare const TargetCompleteRate: any;
1
+ declare const TargetCompleteRate: ({
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
3
+ dbOptions: {
4
+ type: ObjectConstructor;
5
+ required: true;
6
+ default: () => {
7
+ data: never[];
8
+ fieldMap: {
9
+ fullCyclePlan: string;
10
+ fullCycleDynamic: string;
11
+ plan: string;
12
+ dynamic: string;
13
+ offsetRatio: string;
14
+ };
15
+ };
16
+ };
17
+ fullCycleLabel: {
18
+ type: StringConstructor;
19
+ default: string;
20
+ };
21
+ actualLabel: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
26
+ dbOptions: Record<string, any>;
27
+ fullCycleLabel: string;
28
+ actualLabel: string;
29
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
30
+ P: {};
31
+ B: {};
32
+ D: {};
33
+ C: {};
34
+ M: {};
35
+ Defaults: {};
36
+ }, Readonly<globalThis.ExtractPropTypes<{
37
+ dbOptions: {
38
+ type: ObjectConstructor;
39
+ required: true;
40
+ default: () => {
41
+ data: never[];
42
+ fieldMap: {
43
+ fullCyclePlan: string;
44
+ fullCycleDynamic: string;
45
+ plan: string;
46
+ dynamic: string;
47
+ offsetRatio: string;
48
+ };
49
+ };
50
+ };
51
+ fullCycleLabel: {
52
+ type: StringConstructor;
53
+ default: string;
54
+ };
55
+ actualLabel: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ };
59
+ }>> & Readonly<{}>, {}, {}, {}, {}, {
60
+ dbOptions: Record<string, any>;
61
+ fullCycleLabel: string;
62
+ actualLabel: string;
63
+ }>;
64
+ __isFragment?: never;
65
+ __isTeleport?: never;
66
+ __isSuspense?: never;
67
+ } & import('vue').ComponentOptionsBase<Readonly<globalThis.ExtractPropTypes<{
68
+ dbOptions: {
69
+ type: ObjectConstructor;
70
+ required: true;
71
+ default: () => {
72
+ data: never[];
73
+ fieldMap: {
74
+ fullCyclePlan: string;
75
+ fullCycleDynamic: string;
76
+ plan: string;
77
+ dynamic: string;
78
+ offsetRatio: string;
79
+ };
80
+ };
81
+ };
82
+ fullCycleLabel: {
83
+ type: StringConstructor;
84
+ default: string;
85
+ };
86
+ actualLabel: {
87
+ type: StringConstructor;
88
+ default: string;
89
+ };
90
+ }>> & Readonly<{}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
91
+ dbOptions: Record<string, any>;
92
+ fullCycleLabel: string;
93
+ actualLabel: string;
94
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & import('vue').Plugin) & Record<string, any>;
2
95
  export default TargetCompleteRate;
@@ -0,0 +1,52 @@
1
+ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
2
+ dbOptions: {
3
+ type: ObjectConstructor;
4
+ required: true;
5
+ default: () => {
6
+ data: never[];
7
+ fieldMap: {
8
+ fullCyclePlan: string;
9
+ fullCycleDynamic: string;
10
+ plan: string;
11
+ dynamic: string;
12
+ offsetRatio: string;
13
+ };
14
+ };
15
+ };
16
+ fullCycleLabel: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ actualLabel: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
25
+ dbOptions: {
26
+ type: ObjectConstructor;
27
+ required: true;
28
+ default: () => {
29
+ data: never[];
30
+ fieldMap: {
31
+ fullCyclePlan: string;
32
+ fullCycleDynamic: string;
33
+ plan: string;
34
+ dynamic: string;
35
+ offsetRatio: string;
36
+ };
37
+ };
38
+ };
39
+ fullCycleLabel: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ actualLabel: {
44
+ type: StringConstructor;
45
+ default: string;
46
+ };
47
+ }>> & Readonly<{}>, {
48
+ dbOptions: Record<string, any>;
49
+ fullCycleLabel: string;
50
+ actualLabel: string;
51
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
52
+ export default _default;
@@ -0,0 +1,185 @@
1
+ import { Ref } from 'vue';
2
+ import { AxiosRequestConfig } from 'axios';
3
+ /** 数据源类型 */
4
+ type DataSourceType = 'static' | 'api';
5
+ /** 加载状态 */
6
+ type LoadingStatus = 'idle' | 'loading' | 'success' | 'error';
7
+ /** 单个数据源配置 */
8
+ interface DataSourceConfig<T = any> {
9
+ /** 数据源唯一标识 */
10
+ key: string;
11
+ /** 数据源类型 */
12
+ type: DataSourceType;
13
+ /** 静态数据(type 为 static 时使用) */
14
+ data?: T;
15
+ /** API 请求配置(type 为 api 时使用) */
16
+ api?: {
17
+ url: string;
18
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
19
+ params?: Record<string, any>;
20
+ data?: Record<string, any>;
21
+ headers?: Record<string, string>;
22
+ /** 响应数据字段路径,如 '/artists' 或 'data.items' */
23
+ fieldPath?: string;
24
+ /** 响应数据转换函数 */
25
+ transform?: (response: any) => T;
26
+ };
27
+ }
28
+ /** 数据源状态 */
29
+ interface DataSourceState<T = any> {
30
+ data: T | null;
31
+ status: LoadingStatus;
32
+ error: Error | null;
33
+ lastUpdated: Date | null;
34
+ }
35
+ /** 融合数据转换函数参数 */
36
+ type MergeDataMap = Record<string, any>;
37
+ /** DataSource 构造配置 */
38
+ interface DataSourceOptions {
39
+ /** 是否立即加载 */
40
+ immediate?: boolean;
41
+ /** 请求失败重试次数 */
42
+ retryCount?: number;
43
+ /** 重试延迟(毫秒) */
44
+ retryDelay?: number;
45
+ /** 全局请求拦截器 */
46
+ onRequest?: (config: AxiosRequestConfig) => AxiosRequestConfig;
47
+ /** 全局响应拦截器 */
48
+ onResponse?: (response: any) => any;
49
+ /** 全局错误处理 */
50
+ onError?: (error: Error, key: string) => void;
51
+ /** 融合数据的转换函数,参数为 { key: data } 形式的对象,配置后自动融合所有数据源 */
52
+ mergeTransformer?: (dataMap: MergeDataMap) => any[];
53
+ }
54
+ /** 数据更新监听器 */
55
+ type DataUpdateListener<T = any> = (key: string, data: T, state: DataSourceState<T>) => void;
56
+ declare class DataSource {
57
+ /** 数据源配置映射 */
58
+ private _configMap;
59
+ /** 数据源状态映射 */
60
+ private _stateMap;
61
+ /** 配置选项 */
62
+ private _options;
63
+ /** 数据更新监听器列表 */
64
+ private _listeners;
65
+ /** 响应式状态(用于 Vue 响应式更新) */
66
+ reactiveStates: Record<string, DataSourceState>;
67
+ /** 全局加载状态 */
68
+ isLoading: Ref<boolean>;
69
+ /** 全局错误状态 */
70
+ hasError: Ref<boolean>;
71
+ /** 调试模式 */
72
+ debugMode: boolean;
73
+ constructor(sources: any, options?: DataSourceOptions);
74
+ /**
75
+ * 添加数据源
76
+ */
77
+ addSource<T>(config: DataSourceConfig<T>): void;
78
+ /**
79
+ * 移除数据源
80
+ */
81
+ removeSource(key: string): boolean;
82
+ /**
83
+ * 加载单个数据源
84
+ */
85
+ private loadSingle;
86
+ /**
87
+ * 从对象中按路径获取值
88
+ * 支持两种路径格式:
89
+ * - 点分隔:'data.users'
90
+ * - 斜杠分隔:'/data/users' 或 'data/users'
91
+ */
92
+ private pickPath;
93
+ /**
94
+ * 带重试的请求
95
+ */
96
+ private fetchWithRetry;
97
+ /**
98
+ * 延迟函数
99
+ */
100
+ private delay;
101
+ /**
102
+ * 更新状态
103
+ */
104
+ private updateState;
105
+ /**
106
+ * 更新全局状态
107
+ */
108
+ private updateGlobalStatus;
109
+ /**
110
+ * 通知所有监听器
111
+ */
112
+ private notifyListeners;
113
+ private normalizeMethod;
114
+ /**
115
+ * 清理配置,将旧版格式(path + resPath)转换为新版 DataSourceConfig
116
+ * - 支持新版 fieldPath
117
+ * - 兼容旧版 resPath,将其转换为 fieldPath
118
+ */
119
+ private cleanConfig;
120
+ /**
121
+ * 加载数据(支持加载全部或指定的数据源)
122
+ * 返回融合后的数组数据
123
+ */
124
+ loadData(keys?: string | string[]): Promise<any[]>;
125
+ /**
126
+ * 刷新数据(参数变更时重新请求,或手动更新数据)
127
+ * @param key 数据源标识
128
+ * @param paramsOrData 请求参数或直接更新的数据
129
+ * @param manual 是否手动更新本地数据(true: 直接更新本地数据,false: 从数据源加载)
130
+ */
131
+ refreshData<T = any>(key: string, paramsOrData?: Record<string, any> | T, manual?: boolean): Promise<T>;
132
+ /**
133
+ * 刷新所有数据源
134
+ * 返回融合后的数组数据
135
+ */
136
+ refreshAll(params?: Record<string, Record<string, any>>): Promise<any[]>;
137
+ /**
138
+ * 获取数据
139
+ */
140
+ getData<T = any>(key: string): T | null;
141
+ /**
142
+ * 获取所有数据
143
+ */
144
+ getAllData(): Record<string, any>;
145
+ /**
146
+ * 获取状态
147
+ */
148
+ getState(key: string): DataSourceState | undefined;
149
+ /**
150
+ * 获取所有状态
151
+ */
152
+ getAllStates(): Record<string, DataSourceState>;
153
+ /**
154
+ * 获取加载状态
155
+ */
156
+ getLoadingStatus(key: string): LoadingStatus;
157
+ /**
158
+ * 检查是否正在加载
159
+ */
160
+ isSourceLoading(key: string): boolean;
161
+ /**
162
+ * 添加数据更新监听器
163
+ */
164
+ onDataUpdate(listener: DataUpdateListener): () => void;
165
+ /**
166
+ * 融合所有数据源数据
167
+ * @param transformer 可选的转换函数(不传则使用 options 中配置的 mergeTransformer)
168
+ * @returns 融合后的数组数据
169
+ */
170
+ mergeData<T = any>(transformer?: (dataMap: MergeDataMap) => T[]): T[];
171
+ /**
172
+ * 清除所有数据
173
+ */
174
+ clear(): void;
175
+ /**
176
+ * 销毁实例
177
+ */
178
+ destroy(): void;
179
+ /**
180
+ * 旧版本兼容
181
+ */
182
+ reload(key?: string, params?: Record<string, any>): Promise<any[]> | Promise<Record<string, any> | undefined>;
183
+ }
184
+ export { DataSource, type DataSourceConfig, type DataSourceState, type DataSourceOptions, type DataSourceType, type LoadingStatus, type DataUpdateListener, };
185
+ export { useDataSource, type UseDataSourceOptions } from './useDataSource';
@@ -0,0 +1,28 @@
1
+ declare const debugStore: {
2
+ markedComponentIds: Set<string> & Omit<Set<string>, keyof Set<any>>;
3
+ };
4
+ /**
5
+ * 标记组件用于调试
6
+ */
7
+ export declare function markComponentForDebug(componentId: string): void;
8
+ /**
9
+ * 取消标记组件
10
+ */
11
+ export declare function unmarkComponentForDebug(componentId: string): void;
12
+ /**
13
+ * 切换组件的调试标记状态
14
+ */
15
+ export declare function toggleComponentDebug(componentId: string): boolean;
16
+ /**
17
+ * 检查组件是否被标记用于调试
18
+ */
19
+ export declare function isComponentMarkedForDebug(componentId: string): boolean;
20
+ /**
21
+ * 获取所有被标记的组件 ID
22
+ */
23
+ export declare function getMarkedComponentIds(): string[];
24
+ /**
25
+ * 清除所有调试标记
26
+ */
27
+ export declare function clearAllDebugMarks(): void;
28
+ export { debugStore };
@@ -20,4 +20,4 @@ export default class DataSource {
20
20
  */
21
21
  export declare const resetDataSource: (data: any) => any;
22
22
  export declare const checkType: (value: any) => "数组" | "对象" | "字符串" | "其他类型";
23
- export {};
23
+ export { toggleComponentDebug, isComponentMarkedForDebug, markComponentForDebug, unmarkComponentForDebug, getMarkedComponentIds, clearAllDebugMarks, debugStore } from './debugStore';
@@ -0,0 +1,66 @@
1
+ import { Ref } from 'vue';
2
+ import { DataSource, DataSourceConfig, DataSourceOptions } from './DataProvider';
3
+ interface UseDataSourceOptions extends DataSourceOptions {
4
+ /** 是否在 onMounted 时自动加载 */
5
+ autoLoad?: boolean;
6
+ /** 监听的参数,参数变化时自动刷新 */
7
+ watchParams?: Ref<Record<string, any>> | (() => Record<string, any>);
8
+ /** 参数变化时刷新的数据源 key */
9
+ watchKeys?: string[];
10
+ }
11
+ declare function useDataSource(sources: DataSourceConfig | DataSourceConfig[] | any, options?: UseDataSourceOptions): {
12
+ /** DataSource 实例 */
13
+ _sourceInstance: DataSource;
14
+ /** 融合后的数组数据 */
15
+ sourceData: import('vue').Reactive<any[]>;
16
+ /** 所有状态 */
17
+ sourceState: Record<string, import('./DataProvider').DataSourceState<any>>;
18
+ /** 全局加载状态 */
19
+ isLoading: Ref<boolean, boolean>;
20
+ /** 全局错误状态 */
21
+ hasError: Ref<boolean, boolean>;
22
+ /** 加载数据 */
23
+ loadData: (keys?: string | string[]) => Promise<any[]>;
24
+ /** 刷新单个数据源 */
25
+ refreshData: (key: string, params?: Record<string, any>) => Promise<Record<string, any> | undefined>;
26
+ /** 兼容旧版 reload 行为 */
27
+ reload: (key?: string, params?: Record<string, any>) => Promise<any[] | Record<string, any> | undefined>;
28
+ /** 刷新所有数据源 */
29
+ refreshAll: (params?: Record<string, Record<string, any>>) => Promise<any[]>;
30
+ /** 更新数据 */
31
+ updateData: <T>(key: string, newData: T) => Promise<T>;
32
+ /** 获取状态 */
33
+ getState: (key: string) => import('./DataProvider').DataSourceState<any>;
34
+ /** 融合数据(调用 DataSource 的 mergeData) */
35
+ mergeData: <T = any>(transformer?: (dataMap: {
36
+ [x: string]: any;
37
+ }) => T[]) => T[];
38
+ /** 添加数据更新监听器 */
39
+ onDataUpdate: (listener: import('./DataProvider').DataUpdateListener) => () => void;
40
+ /** 清除数据 */
41
+ clear: () => void;
42
+ /** 销毁实例 */
43
+ destroy: () => void;
44
+ };
45
+ /**
46
+ * 处理静态数据,将其转换为数组格式
47
+ * @param data 静态数据,可能是数字、字符串、数组或对象
48
+ * @param dataField 如果数据是数字、字符串,指定dataField作为数组元素的键
49
+ * @returns 转换后的数组格式数据
50
+ */
51
+ declare const convertDataToArray: (data: any, dataField?: any) => Promise<any[] | undefined>;
52
+ /**
53
+ * 判断是否是 DataSource 类实例
54
+ */
55
+ declare function isSourceClass(val: any): val is DataSource;
56
+ /**
57
+ * 判断是否是 useDataSource 返回的实例
58
+ */
59
+ declare function isSourceHook(val: any): val is ReturnType<typeof useDataSource>;
60
+ /**
61
+ * 创建调试右键点击处理器
62
+ * @param dbOptions 组件的数据源配置对象
63
+ * @returns 右键点击事件处理器
64
+ */
65
+ declare function createDebugHandler(dbOptions?: any): (e: MouseEvent) => Promise<void>;
66
+ export { useDataSource, isSourceHook, isSourceClass, convertDataToArray, createDebugHandler, type UseDataSourceOptions, };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "g-ui-web",
3
3
  "private": false,
4
4
  "description": "可视化组件库",
5
- "version": "1.3.59",
5
+ "version": "1.3.60",
6
6
  "author": "wyu",
7
7
  "license": "MIT",
8
8
  "type": "module",
@@ -73,7 +73,8 @@
73
73
  "vue-tsc": "^2.0.24",
74
74
  "vuex": "^4.1.0",
75
75
  "vxe-table": "^4.10.5",
76
- "sortablejs": "^1.15.6"
76
+ "sortablejs": "^1.15.6",
77
+ "js-cookie": "^3.0.5"
77
78
  },
78
79
  "repository": {
79
80
  "type": "git",
@@ -98,4 +99,4 @@
98
99
  "eslint-config-prettier": "^10.1.8",
99
100
  "prettier": "^3.6.2"
100
101
  }
101
- }
102
+ }