@jnrs/lingshu-smart 2.2.37 → 2.2.38

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.
@@ -0,0 +1,32 @@
1
+ import { FieldMapper } from './proxy';
2
+ type __VLS_Props = {
3
+ /** 字段映射列表 */
4
+ mappers: FieldMapper[];
5
+ /** 画布字段是否可编辑(false=只读,true=可修改) */
6
+ targetFieldEditable?: boolean;
7
+ /** 是否已配置 dictFn(用于「字典 Label / 字典 Color」选项右侧 tag 显示) */
8
+ hasDictFn?: boolean;
9
+ /** 是否显示底部「画布字段修改 + 添加映射」栏(默认 true) */
10
+ showFooter?: boolean;
11
+ /** 底部栏是否包含「画布字段修改」开关(默认 true;Resource 区域在组外统一控制时传 false) */
12
+ showToggle?: boolean;
13
+ };
14
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
15
+ add: () => any;
16
+ remove: (idx: number) => any;
17
+ update: () => any;
18
+ "update:targetFieldEditable": (value: boolean) => any;
19
+ "open-condition": (mapper: FieldMapper) => any;
20
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ onAdd?: (() => any) | undefined;
22
+ onRemove?: ((idx: number) => any) | undefined;
23
+ onUpdate?: (() => any) | undefined;
24
+ "onUpdate:targetFieldEditable"?: ((value: boolean) => any) | undefined;
25
+ "onOpen-condition"?: ((mapper: FieldMapper) => any) | undefined;
26
+ }>, {
27
+ targetFieldEditable: boolean;
28
+ hasDictFn: boolean;
29
+ showFooter: boolean;
30
+ showToggle: boolean;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
32
+ export default _default;
@@ -39,29 +39,14 @@ export interface FieldMapper {
39
39
  * @param type 'label' 字典Label / 'color' 字典Color
40
40
  * @returns 转换后的字符串值,赋值给画布字段 */
41
41
  export type DictFn = (name: string, value: string | number | undefined, type: 'label' | 'color') => string;
42
- /** 资源操作字段配置:定义 payload 中各字段的来源路径 */
43
- export interface ResourceFieldConfig {
44
- /** 资源 className 的源字段路径(如 addType / removeType) */
45
- className: string;
46
- /** 资源 ID 的源字段路径(如 addId / removeId) */
47
- id: string;
48
- /** 资源类型的源字段路径(如 resourceType) */
49
- resourceType: string;
50
- /** 资源 ID 的源字段路径(用于全局查找匹配,如 resourceId) */
51
- resourceId?: string;
52
- /** 工位索引的源字段路径(如 addSiteNumber / removeSiteNumber) */
53
- index: string;
54
- /** 资源名称的源字段路径(仅 add 需要,如 name) */
55
- name?: string;
56
- /** 资源颜色的源字段路径(仅 add 需要,如 displayColor) */
57
- color?: string;
58
- }
59
- /** 资源增删字段映射:分别配置 add / remove 两组字段来源 */
42
+ /** 资源增删字段映射:分别配置 add / remove 两组动态字段映射
43
+ * 目标路径支持点号嵌套,className / id 为目标设备匹配字段,resource.* 为资源对象字段
44
+ * (如 resource.resourceType / resource.index),未配置时使用内置默认映射 */
60
45
  export interface ResourceFieldMap {
61
- /** 新增资源字段映射(不需要新增时可不配置) */
62
- add?: ResourceFieldConfig;
63
- /** 移除资源字段映射(不需要移除时可不配置) */
64
- remove?: ResourceFieldConfig;
46
+ /** 新增资源字段映射列表(无需新增时可不配置或为空数组) */
47
+ add?: FieldMapper[];
48
+ /** 移除资源字段映射列表(无需移除时可不配置或为空数组) */
49
+ remove?: FieldMapper[];
65
50
  }
66
51
  /** 全局操作字段配置(operate: 'global' 时生效) */
67
52
  export interface GlobalFieldConfig {
@@ -82,8 +67,8 @@ export interface ProxyRule {
82
67
  operate: 'single' | 'resource' | 'global';
83
68
  /** 字段映射列表(operate: 'single' 时生效) */
84
69
  mappings: FieldMapper[];
85
- /** 资源增删字段映射(operate: 'resource' 时生效,未配置时使用内置默认字段名) */
86
- resourceFields?: ResourceFieldMap;
70
+ /** 资源增删字段映射(operate: 'resource' 时生效,未配置时使用内置默认字段映射) */
71
+ resourceMappings?: ResourceFieldMap;
87
72
  /** 全局操作字段映射(operate: 'global' 时生效) */
88
73
  globalFields?: GlobalFieldConfig;
89
74
  }
@@ -126,8 +111,9 @@ export declare function resolveMapper(payload: Record<string, unknown>, mapper:
126
111
  /** 根据单条规则构建 operating 对象(operate: 'single') */
127
112
  export declare function buildOperating(payload: Record<string, unknown>, rule: ProxyRule, scene?: IScene | null, dictFn?: DictFn): ILayerOperating | null;
128
113
  /** 根据 Resource 规则构建资源增删 operating 列表(operate: 'resource')
129
- * 字段来源由 rule.resourceFields 配置,未配置时使用内置默认字段名 */
130
- export declare function buildResourceOperating(payload: Record<string, unknown>, rule: ProxyRule): ILayerOperating[];
114
+ * 字段来源由 rule.resourceMappings.add / remove 动态映射配置,未配置时使用内置默认映射。
115
+ * target 支持点号嵌套:className / id 为目标设备匹配字段,resource.* 为资源对象字段。 */
116
+ export declare function buildResourceOperating(payload: Record<string, unknown>, rule: ProxyRule, scene?: IScene | null, dictFn?: DictFn): ILayerOperating[];
131
117
  /** 根据全局操作规则构建 operating(operate: 'global')
132
118
  * resourceIds 从源消息中按 globalFields.resourceIds 路径提取,为空时使用 payloadKey */
133
119
  export declare function buildGlobalOperating(msg: Record<string, unknown>, rule: ProxyRule, payloadKey: string): ILayerOperating[];
@@ -143,6 +129,10 @@ export declare function buildGlobalOperating(msg: Record<string, unknown>, rule:
143
129
  * @returns operating 列表(可能为空数组;非标准数组数据返回空数组由 @raw 处理)
144
130
  */
145
131
  export declare function applyProxy(rawMessage: unknown, rules: ProxyRule[], scene?: IScene | null, payloadKey?: string, sourceTypeField?: string, dictFn?: DictFn): ILayerOperating[];
132
+ /** 资源新增字段默认映射(target 取自 IModelOperating + IResourceOperating,源字段名取自 ViewPageDemo.vue 中 Resource 操作的标准 payload 字段) */
133
+ export declare const DEFAULT_RESOURCE_ADD_MAPPERS: FieldMapper[];
134
+ /** 资源移除字段默认映射 */
135
+ export declare const DEFAULT_RESOURCE_REMOVE_MAPPERS: FieldMapper[];
146
136
  /** 默认代理配置 */
147
137
  export declare function createDefaultConfig(): WsProxyConfig;
148
138
  /** 校验导入的配置结构是否合法 */