@yugu-ui/flow-ui 0.0.0-stage → 0.1.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/README.md +343 -2
- package/dist/adapter/wflow.d.ts +260 -0
- package/dist/base-ui/base-card-item.d.ts +26 -0
- package/dist/base-ui/base-card.d.ts +60 -0
- package/dist/base-ui/base-drawer.d.ts +56 -0
- package/dist/base-ui/base-modal.d.ts +43 -0
- package/dist/base-ui/yg-confirm.d.ts +79 -0
- package/dist/composables/form.d.ts +19 -0
- package/dist/config/FlowConfig.d.ts +34 -0
- package/dist/config/FlowConfigField.d.ts +12 -0
- package/dist/config/FlowConfigFlow/components/FlowIcon.d.ts +11 -0
- package/dist/config/FlowConfigFlow/components/FlowNodeCard.d.ts +7 -0
- package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/index.d.ts +19 -0
- package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ApproverConfig.d.ts +7 -0
- package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/CcConfig.d.ts +6 -0
- package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/ConditionConfig.d.ts +8 -0
- package/dist/config/FlowConfigFlow/components/NodeConfigDrawer/modules/StartConfig.d.ts +7 -0
- package/dist/config/FlowConfigFlow/composables/useNodeDrawer.d.ts +9 -0
- package/dist/config/FlowConfigFlow/index.d.ts +18 -0
- package/dist/config/FlowConfigMore.d.ts +12 -0
- package/dist/config/useFcCssVars.d.ts +2 -0
- package/dist/file-preview/file-preview-modal.d.ts +24 -0
- package/dist/file-preview/index.d.ts +21 -0
- package/dist/flow-list/index.d.ts +21 -0
- package/dist/flow-list/modules/FlowListGroup.d.ts +21 -0
- package/dist/flow-list/modules/FlowListItem.d.ts +21 -0
- package/dist/flow-list/types/index.d.ts +20 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +6913 -0
- package/dist/person-selector/api/index.d.ts +4 -0
- package/dist/person-selector/composables/useOverflowTags.d.ts +13 -0
- package/dist/person-selector/composables/usePersonData.d.ts +40 -0
- package/dist/person-selector/composables/useSelection.d.ts +42 -0
- package/dist/person-selector/constants/index.d.ts +5 -0
- package/dist/person-selector/index.d.ts +21 -0
- package/dist/person-selector/types/index.d.ts +35 -0
- package/dist/person-selector/utils/index.d.ts +5 -0
- package/dist/provider/index.d.ts +25 -0
- package/dist/provider/key.d.ts +4 -0
- package/dist/provider/types.d.ts +68 -0
- package/dist/style.css +2430 -0
- package/dist/timeline/ApprovalModal.d.ts +47 -0
- package/dist/timeline/FlowAvatar.d.ts +11 -0
- package/dist/timeline/FlowLayout.d.ts +42 -0
- package/dist/timeline/FlowNode.d.ts +103 -0
- package/dist/timeline/flowUserKey.d.ts +18 -0
- package/dist/timeline/types.d.ts +9 -0
- package/dist/utils/common.d.ts +4 -0
- package/package.json +56 -4
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface UseOverflowTagsOptions {
|
|
2
|
+
/** 是否启用溢出测量(displayMode === 'overflow') */
|
|
3
|
+
enabled: () => boolean;
|
|
4
|
+
/** 已选项总数(resolvedSelected.length) */
|
|
5
|
+
itemCount: () => number;
|
|
6
|
+
}
|
|
7
|
+
export declare function useOverflowTags(options: UseOverflowTagsOptions): {
|
|
8
|
+
triggerRef: import('vue').Ref<HTMLElement | null, HTMLElement | null>;
|
|
9
|
+
visibleCount: import('vue').Ref<number, number>;
|
|
10
|
+
overflowCount: import('vue').ComputedRef<number>;
|
|
11
|
+
setTagRef: (el: unknown, idx: number) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PersonItem, PersonSelectorData } from '../types';
|
|
2
|
+
export declare function usePersonData(): {
|
|
3
|
+
depts: import('vue').Ref<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
isDisabled: boolean;
|
|
7
|
+
}[], import('../types').DeptItem[] | {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
isDisabled: boolean;
|
|
11
|
+
}[]>;
|
|
12
|
+
roles: import('vue').Ref<{
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
isDisabled: boolean;
|
|
16
|
+
}[], import('../types').RoleItem[] | {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
isDisabled: boolean;
|
|
20
|
+
}[]>;
|
|
21
|
+
people: import('vue').Ref<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
deptId: string;
|
|
25
|
+
roleIds: string[];
|
|
26
|
+
isDisabled: boolean;
|
|
27
|
+
}[], PersonItem[] | {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
deptId: string;
|
|
31
|
+
roleIds: string[];
|
|
32
|
+
isDisabled: boolean;
|
|
33
|
+
}[]>;
|
|
34
|
+
loading: import('vue').Ref<boolean, boolean>;
|
|
35
|
+
ensureData: () => Promise<PersonSelectorData>;
|
|
36
|
+
refreshData: () => Promise<PersonSelectorData>;
|
|
37
|
+
peopleByDept: import('vue').ComputedRef<Map<string, PersonItem[]>>;
|
|
38
|
+
peopleByRole: import('vue').ComputedRef<Map<string, PersonItem[]>>;
|
|
39
|
+
deptNameById: import('vue').ComputedRef<Map<string, string>>;
|
|
40
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { DeptItem, PersonItem, ResolvedItem, RoleItem, SelectableType, SelectedItem } from '../types';
|
|
3
|
+
interface UseSelectionOptions {
|
|
4
|
+
modelValue: () => SelectedItem[];
|
|
5
|
+
depts: Ref<DeptItem[]>;
|
|
6
|
+
roles: Ref<RoleItem[]>;
|
|
7
|
+
people: Ref<PersonItem[]>;
|
|
8
|
+
/** 弹窗打开期间暂停外部 modelValue 同步,避免用户编辑被外部变化覆盖 */
|
|
9
|
+
paused?: () => boolean;
|
|
10
|
+
/** 确认提交回调(组件内在此触发 update:modelValue / change) */
|
|
11
|
+
onChange: (value: SelectedItem[]) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useSelection(options: UseSelectionOptions): {
|
|
14
|
+
localSelected: Ref<{
|
|
15
|
+
type: SelectableType;
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string | undefined;
|
|
18
|
+
}[], SelectedItem[] | {
|
|
19
|
+
type: SelectableType;
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
}[]>;
|
|
23
|
+
resolvedSelected: import('vue').ComputedRef<ResolvedItem[]>;
|
|
24
|
+
resolvedLocalSelected: import('vue').ComputedRef<ResolvedItem[]>;
|
|
25
|
+
isSelected: (type: SelectableType, id: string) => boolean;
|
|
26
|
+
isDeptDisabled: (deptId: string) => boolean;
|
|
27
|
+
isRoleDisabled: (roleId: string) => boolean;
|
|
28
|
+
isPersonStopDisabled: (personId: string) => boolean;
|
|
29
|
+
isPersonCovered: (personId: string) => boolean;
|
|
30
|
+
personCoverSource: (personId: string) => {
|
|
31
|
+
label: string;
|
|
32
|
+
kind: "dept" | "role";
|
|
33
|
+
} | null;
|
|
34
|
+
addItems: (items: SelectedItem[]) => void;
|
|
35
|
+
removeMany: (items: SelectedItem[]) => void;
|
|
36
|
+
toggleItem: (item: SelectedItem) => void;
|
|
37
|
+
removeLocal: (item: SelectedItem) => void;
|
|
38
|
+
clearAll: () => void;
|
|
39
|
+
resetLocal: () => void;
|
|
40
|
+
commit: () => void;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SelectableType } from '../types';
|
|
2
|
+
export declare const TYPE_COLORS: Record<SelectableType, string>;
|
|
3
|
+
export declare const TYPE_LABELS: Record<SelectableType, string>;
|
|
4
|
+
export declare const SEARCH_LABELS: Record<SelectableType, string>;
|
|
5
|
+
export declare const AVATAR_PALETTE: string[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SelectedItem, SelectableType } from './types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
modelValue?: SelectedItem[];
|
|
4
|
+
selectableTypes?: SelectableType[];
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
displayMode?: 'wrap' | 'overflow';
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
change: (value: SelectedItem[]) => any;
|
|
10
|
+
"update:modelValue": (value: SelectedItem[]) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
+
onChange?: ((value: SelectedItem[]) => any) | undefined;
|
|
13
|
+
"onUpdate:modelValue"?: ((value: SelectedItem[]) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
placeholder: string;
|
|
16
|
+
modelValue: SelectedItem[];
|
|
17
|
+
selectableTypes: SelectableType[];
|
|
18
|
+
displayMode: "wrap" | "overflow";
|
|
19
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type SelectableType = 'person' | 'role' | 'dept';
|
|
2
|
+
export interface SelectedItem {
|
|
3
|
+
type: SelectableType;
|
|
4
|
+
id: string;
|
|
5
|
+
/** 名称:组件确认时从选人字典解析带出;外部旧数据(type+id)可缺省 */
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
export type ResolvedItem = SelectedItem & {
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
export interface DeptItem {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** 是否停用:true-停用;false-正常(来自接口 is_disabled) */
|
|
15
|
+
isDisabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RoleItem {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
/** 是否停用:true-停用;false-正常(来自接口 is_disabled) */
|
|
21
|
+
isDisabled: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface PersonItem {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
deptId: string;
|
|
27
|
+
roleIds: string[];
|
|
28
|
+
/** 是否停用:true-停用;false-正常(来自接口 is_disabled) */
|
|
29
|
+
isDisabled: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface PersonSelectorData {
|
|
32
|
+
depts: DeptItem[];
|
|
33
|
+
roles: RoleItem[];
|
|
34
|
+
people: PersonItem[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ResolvedItem, SelectedItem, SelectableType } from '../types';
|
|
2
|
+
export declare const itemKey: (item: SelectedItem) => string;
|
|
3
|
+
export declare const typeChar: (item: ResolvedItem) => string;
|
|
4
|
+
export declare const typeColor: (type: SelectableType) => string;
|
|
5
|
+
export declare const avatarColor: (id: string) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { FlowUIConfig, FlowUIOptions } from './types';
|
|
3
|
+
export type { FlowUIComponents, FlowUIConfig, FlowUIOptions, FlowUIRequest, FlowUIRequestConfig, FlowUIResponse, PersonSelectorApi, PersonSelectorRawData } from './types';
|
|
4
|
+
export { FLOW_UI_KEY } from './key';
|
|
5
|
+
/** createFlowUI 返回的 Vue 插件实例(供 app.use 使用) */
|
|
6
|
+
export interface FlowUIInstance {
|
|
7
|
+
install(app: App): void;
|
|
8
|
+
}
|
|
9
|
+
/** 非 setup 上下文(adapter 层等)读取注入配置:未注入时 DEV 告警一次并返回兜底配置(不抛错) */
|
|
10
|
+
export declare function getFlowUIConfig(): FlowUIConfig;
|
|
11
|
+
/**
|
|
12
|
+
* 流程组件库注入入口:`app.use(createFlowUI({ request, getToken?, baseURL?, personSelectorApi? }))`
|
|
13
|
+
* - `request`:宿主请求实例(平面函数式,返回 `{ data, error }`),包内全部接口改走它;
|
|
14
|
+
* - `getToken`:返回完整 Authorization 头值(如 `Bearer xxx`),供包内原生 fetch 场景使用;
|
|
15
|
+
* - `baseURL`:后端接口基础路径,远程选项相对 action 拼接用;
|
|
16
|
+
* - `personSelectorApi`:人员选择器数据源,默认请求 GET /system/person-selector。
|
|
17
|
+
* - `components`:能力组件注入(如附件上传组件),包内以动态组件消费,未注入时对应能力降级提示。
|
|
18
|
+
* Developed collaboratively with vscode - 改动代码行数: 1行(2.12 宿主全局组件解耦:注入入口文档补能力组件说明)
|
|
19
|
+
*/
|
|
20
|
+
export declare function createFlowUI(options: FlowUIOptions): FlowUIInstance;
|
|
21
|
+
/**
|
|
22
|
+
* 组件内读取注入配置(须在 setup 上下文调用):
|
|
23
|
+
* 未注入时 DEV 告警一次并返回兜底配置(不抛错,请求走 error 分支降级)。
|
|
24
|
+
*/
|
|
25
|
+
export declare function useFlowUI(): FlowUIConfig;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
/** 请求配置(axios 风格子集,包内仅用到 url/method/params/data) */
|
|
3
|
+
export interface FlowUIRequestConfig {
|
|
4
|
+
url: string;
|
|
5
|
+
method?: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
6
|
+
params?: Record<string, unknown>;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
}
|
|
9
|
+
/** 平面请求响应结构(与宿主 request 实例一致:data + error,不抛异常) */
|
|
10
|
+
export interface FlowUIResponse<T = unknown> {
|
|
11
|
+
data: T | null;
|
|
12
|
+
error: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 宿主请求实例最小结构(平面函数式)。
|
|
16
|
+
* 要求自带 tenant_no/operator 填充与统一错误处理(401 提示、错误 toast),
|
|
17
|
+
* 包内所有接口调用均改走该实例,不再依赖宿主 service 层。
|
|
18
|
+
*/
|
|
19
|
+
export type FlowUIRequest = <T = unknown>(config: FlowUIRequestConfig) => Promise<FlowUIResponse<T>>;
|
|
20
|
+
/** 人员选择器原始数据(GET /system/person-selector 响应 data,snake_case 原样) */
|
|
21
|
+
export interface PersonSelectorRawData {
|
|
22
|
+
depts: Array<{
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
is_disabled: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
roles: Array<{
|
|
28
|
+
id: number;
|
|
29
|
+
name: string;
|
|
30
|
+
is_disabled: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
people: Array<{
|
|
33
|
+
id: number;
|
|
34
|
+
name: string;
|
|
35
|
+
dept_id: number;
|
|
36
|
+
role_ids: number[];
|
|
37
|
+
is_disabled: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
/** 人员选择器数据源函数(宿主可覆盖;默认实现走注入 request 请求 /system/person-selector) */
|
|
41
|
+
export type PersonSelectorApi = () => Promise<FlowUIResponse<PersonSelectorRawData>>;
|
|
42
|
+
/** 宿主能力组件(可选注入):包内以动态组件渲染,未注入对应槽位时该能力降级提示 */
|
|
43
|
+
export interface FlowUIComponents {
|
|
44
|
+
/** 附件上传组件:须支持 v-model(附件数组)与 upload-type/drag props */
|
|
45
|
+
FileUpload?: Component;
|
|
46
|
+
}
|
|
47
|
+
/** 注入选项(宿主 app.use(createFlowUI(options)) 传入) */
|
|
48
|
+
export interface FlowUIOptions {
|
|
49
|
+
/** 宿主请求实例(必填):包内 wflow/PersonSelector 等接口全部改走它 */
|
|
50
|
+
request: FlowUIRequest;
|
|
51
|
+
/** 鉴权头获取函数:返回完整 Authorization 头值(如 `Bearer xxx`),供包内原生 fetch 等场景使用;缺省视为未登录 */
|
|
52
|
+
getToken?: () => string;
|
|
53
|
+
/** 后端接口基础路径:远程选项 action 为相对路径时拼接(对应宿主 VITE_SERVICE_BASE_URL) */
|
|
54
|
+
baseURL?: string;
|
|
55
|
+
/** 人员选择器数据源:默认 GET /system/person-selector,宿主可自定义覆盖 */
|
|
56
|
+
personSelectorApi?: PersonSelectorApi;
|
|
57
|
+
/** 能力组件注入:附件上传等宿主专属组件 */
|
|
58
|
+
components?: FlowUIComponents;
|
|
59
|
+
}
|
|
60
|
+
/** 解析后的注入配置(包内 useFlowUI 返回,全部字段有兜底值) */
|
|
61
|
+
export interface FlowUIConfig {
|
|
62
|
+
request: FlowUIRequest;
|
|
63
|
+
getToken: () => string;
|
|
64
|
+
baseURL: string;
|
|
65
|
+
personSelectorApi: PersonSelectorApi;
|
|
66
|
+
/** 能力组件(未注入为空对象,对应能力降级提示) */
|
|
67
|
+
components: FlowUIComponents;
|
|
68
|
+
}
|