cmat 0.0.97 → 0.0.99

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmat",
3
- "version": "0.0.97",
3
+ "version": "0.0.99",
4
4
  "author": {
5
5
  "name": "Yu Tao",
6
6
  "email": "916426364@qq.com"
@@ -45,12 +45,32 @@ interface DataSourceConfig<T = any> {
45
45
  descField?: string;
46
46
  /** 响应数据映射函数 */
47
47
  responseMapper?: (res: any) => PagedResult<T>;
48
+ /**
49
+ * 按 key 批量加载的 API 地址(可选)
50
+ * 用于支持仅传入 key 值时的回填解析
51
+ * 如未提供,则使用主 url 并在参数中添加 keys 字段
52
+ */
53
+ loadByUrl?: string;
54
+ /**
55
+ * 按 key 加载时的参数字段名,默认 'keys'
56
+ */
57
+ keysParam?: string;
58
+ /**
59
+ * 按 key 加载的响应数据映射函数
60
+ * 如未提供,则尝试直接从响应中提取数组
61
+ */
62
+ loadByKeysMapper?: (res: any) => T[];
48
63
  }
49
64
  /**
50
65
  * 数据提供者接口
51
66
  */
52
67
  interface DataPickerProvider<T = any> {
53
68
  loadPage(query: DataPickerQuery): Observable<PagedResult<T>>;
69
+ /**
70
+ * 按 key 批量加载完整对象(可选)
71
+ * 用于支持仅传入 key 值时的回填解析
72
+ */
73
+ loadByKeys?(keys: (string | number)[]): Observable<T[]>;
54
74
  }
55
75
  /**
56
76
  * 列配置
@@ -74,6 +94,10 @@ declare class HttpDataPickerProvider<T = any> implements DataPickerProvider<T> {
74
94
  private _config;
75
95
  constructor(_dataService: CmatDataService, _config: DataSourceConfig<T>);
76
96
  loadPage(query: DataPickerQuery): Observable<PagedResult<T>>;
97
+ /**
98
+ * 按 key 批量加载完整对象
99
+ */
100
+ loadByKeys(keys: (string | number)[]): Observable<T[]>;
77
101
  }
78
102
  /**
79
103
  * 创建HTTP数据提供者的工厂函数
@@ -355,6 +379,15 @@ declare class CmatDataPickerComponent<T = any> implements MatFormFieldControl<T
355
379
  * Update selection
356
380
  */
357
381
  private updateSelection;
382
+ /**
383
+ * 检测值是否为原始类型(string/number),即纯 key 值
384
+ */
385
+ private _isPrimitiveValue;
386
+ /**
387
+ * 异步解析纯 key 数组为完整对象
388
+ * 调用 dataProvider.loadByKeys 获取完整数据后更新 selectedItems
389
+ */
390
+ private _resolveKeys;
358
391
  /**
359
392
  * Format template string
360
393
  * 支持两种格式:
package/types/cmat.d.ts CHANGED
@@ -1562,12 +1562,32 @@ interface DataSourceConfig<T = any> {
1562
1562
  descField?: string;
1563
1563
  /** 响应数据映射函数 */
1564
1564
  responseMapper?: (res: any) => PagedResult<T>;
1565
+ /**
1566
+ * 按 key 批量加载的 API 地址(可选)
1567
+ * 用于支持仅传入 key 值时的回填解析
1568
+ * 如未提供,则使用主 url 并在参数中添加 keys 字段
1569
+ */
1570
+ loadByUrl?: string;
1571
+ /**
1572
+ * 按 key 加载时的参数字段名,默认 'keys'
1573
+ */
1574
+ keysParam?: string;
1575
+ /**
1576
+ * 按 key 加载的响应数据映射函数
1577
+ * 如未提供,则尝试直接从响应中提取数组
1578
+ */
1579
+ loadByKeysMapper?: (res: any) => T[];
1565
1580
  }
1566
1581
  /**
1567
1582
  * 数据提供者接口
1568
1583
  */
1569
1584
  interface DataPickerProvider<T = any> {
1570
1585
  loadPage(query: DataPickerQuery): Observable<PagedResult<T>>;
1586
+ /**
1587
+ * 按 key 批量加载完整对象(可选)
1588
+ * 用于支持仅传入 key 值时的回填解析
1589
+ */
1590
+ loadByKeys?(keys: (string | number)[]): Observable<T[]>;
1571
1591
  }
1572
1592
  /**
1573
1593
  * 列配置
@@ -1591,6 +1611,10 @@ declare class HttpDataPickerProvider<T = any> implements DataPickerProvider<T> {
1591
1611
  private _config;
1592
1612
  constructor(_dataService: CmatDataService$1, _config: DataSourceConfig<T>);
1593
1613
  loadPage(query: DataPickerQuery): Observable<PagedResult<T>>;
1614
+ /**
1615
+ * 按 key 批量加载完整对象
1616
+ */
1617
+ loadByKeys(keys: (string | number)[]): Observable<T[]>;
1594
1618
  }
1595
1619
  /**
1596
1620
  * 创建HTTP数据提供者的工厂函数
@@ -1872,6 +1896,15 @@ declare class CmatDataPickerComponent<T = any> implements MatFormFieldControl<T
1872
1896
  * Update selection
1873
1897
  */
1874
1898
  private updateSelection;
1899
+ /**
1900
+ * 检测值是否为原始类型(string/number),即纯 key 值
1901
+ */
1902
+ private _isPrimitiveValue;
1903
+ /**
1904
+ * 异步解析纯 key 数组为完整对象
1905
+ * 调用 dataProvider.loadByKeys 获取完整数据后更新 selectedItems
1906
+ */
1907
+ private _resolveKeys;
1875
1908
  /**
1876
1909
  * Format template string
1877
1910
  * 支持两种格式:
@@ -4725,7 +4758,7 @@ declare class CmatSeamlessAutoScrollDirective implements OnInit, AfterViewInit,
4725
4758
  readonly itemTemplate: _angular_core.Signal<TemplateRef<any>>;
4726
4759
  readonly data: _angular_core.InputSignal<unknown[]>;
4727
4760
  readonly speed: _angular_core.InputSignal<number>;
4728
- readonly direction: _angular_core.InputSignal<"left" | "up" | "right" | "down">;
4761
+ readonly direction: _angular_core.InputSignal<"left" | "right" | "up" | "down">;
4729
4762
  private _viewContainer;
4730
4763
  private _containerElement;
4731
4764
  private _contentElement;