cmat 0.0.97 → 0.0.98

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.98",
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数据提供者的工厂函数
@@ -1788,7 +1812,7 @@ declare class CmatDataPickerComponent<T = any> implements MatFormFieldControl<T
1788
1812
  readonly searchable: _angular_core.InputSignal<boolean>;
1789
1813
  readonly debounceTime: _angular_core.InputSignal<number>;
1790
1814
  readonly pageSize: _angular_core.InputSignal<number>;
1791
- readonly uiMode: _angular_core.InputSignal<"dialog" | "auto" | "drawer" | "bottom-sheet">;
1815
+ readonly uiMode: _angular_core.InputSignal<"auto" | "drawer" | "dialog" | "bottom-sheet">;
1792
1816
  readonly drawerPosition: _angular_core.InputSignal<"start" | "end">;
1793
1817
  readonly drawerWidth: _angular_core.InputSignal<string>;
1794
1818
  readonly dialogWidth: _angular_core.InputSignal<string>;
@@ -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
  * 支持两种格式:
@@ -2067,7 +2100,7 @@ declare class CmatFilterToolbarComponent implements OnInit {
2067
2100
  }
2068
2101
 
2069
2102
  declare class CmatFormActionsComponent {
2070
- readonly align: _angular_core.InputSignal<"center" | "start" | "end">;
2103
+ readonly align: _angular_core.InputSignal<"start" | "end" | "center">;
2071
2104
  readonly divider: _angular_core.InputSignal<boolean>;
2072
2105
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CmatFormActionsComponent, never>;
2073
2106
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CmatFormActionsComponent, "cmat-form-actions", never, { "align": { "alias": "align"; "required": false; "isSignal": true; }; "divider": { "alias": "divider"; "required": false; "isSignal": true; }; }, {}, never, ["[cmatFormActionsLeft]", "[cmatFormActions]"], true, never>;
@@ -3136,7 +3169,7 @@ declare class CmatPageHeaderComponent {
3136
3169
  readonly description: _angular_core.InputSignal<string>;
3137
3170
  readonly eyebrow: _angular_core.InputSignal<string>;
3138
3171
  readonly divider: _angular_core.InputSignal<boolean>;
3139
- readonly align: _angular_core.InputSignal<"center" | "start">;
3172
+ readonly align: _angular_core.InputSignal<"start" | "center">;
3140
3173
  readonly isCentered: _angular_core.Signal<boolean>;
3141
3174
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CmatPageHeaderComponent, never>;
3142
3175
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<CmatPageHeaderComponent, "cmat-page-header", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "eyebrow": { "alias": "eyebrow"; "required": false; "isSignal": true; }; "divider": { "alias": "divider"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, ["[cmatPageHeaderActions]"], true, never>;