@nokecy/qc-ui 1.1.34 → 1.1.36

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.
Files changed (29) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +48 -6
  2. package/dist/cjs/ag-grid-plus/context/gridContext.d.ts +19 -0
  3. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.d.ts +8 -0
  4. package/dist/cjs/ag-grid-plus/context/useSchemeDataFlow.js +62 -1
  5. package/dist/cjs/ag-grid-plus/index.d.ts +2 -0
  6. package/dist/cjs/ag-grid-plus/index.js +13 -0
  7. package/dist/cjs/ag-grid-plus/interface.d.ts +9 -0
  8. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +8 -2
  9. package/dist/cjs/ag-grid-plus/shared/storage/localStorageAdapter.js +34 -6
  10. package/dist/cjs/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +2 -0
  11. package/dist/cjs/ag-grid-plus/types.d.ts +53 -0
  12. package/dist/cjs/ag-grid-plus/utils/entityExtensionColumns.d.ts +22 -0
  13. package/dist/cjs/ag-grid-plus/utils/entityExtensionColumns.js +138 -0
  14. package/dist/esm/ag-grid-plus/ag-gridPlus.js +48 -6
  15. package/dist/esm/ag-grid-plus/context/gridContext.d.ts +19 -0
  16. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.d.ts +8 -0
  17. package/dist/esm/ag-grid-plus/context/useSchemeDataFlow.js +62 -1
  18. package/dist/esm/ag-grid-plus/index.d.ts +2 -0
  19. package/dist/esm/ag-grid-plus/index.js +5 -0
  20. package/dist/esm/ag-grid-plus/interface.d.ts +9 -0
  21. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +8 -2
  22. package/dist/esm/ag-grid-plus/shared/storage/localStorageAdapter.js +34 -6
  23. package/dist/esm/ag-grid-plus/shared/storage/schemeStorageAdapter.d.ts +2 -0
  24. package/dist/esm/ag-grid-plus/types.d.ts +53 -0
  25. package/dist/esm/ag-grid-plus/utils/entityExtensionColumns.d.ts +22 -0
  26. package/dist/esm/ag-grid-plus/utils/entityExtensionColumns.js +138 -0
  27. package/dist/esm/standardFormDialog/withStandardForm.d.ts +2 -2
  28. package/dist/umd/qc-ui.min.js +1 -1
  29. package/package.json +1 -1
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.fieldToColumnDef = fieldToColumnDef;
7
+ exports.getEntityExtensionColumns = getEntityExtensionColumns;
8
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ /**
21
+ * 实体扩展字段列转换工具
22
+ * 将后端 ABP 配置的扩展字段转换为 AG-Grid 列定义
23
+ *
24
+ * @author nokecy
25
+ */
26
+
27
+ /**
28
+ * 数据类型到列配置的映射
29
+ * 根据字段的数据类型自动配置列宽度、是否可搜索、列类型等
30
+ */
31
+ var dataTypeColumnConfig = {
32
+ // 字符串类型
33
+ String: {
34
+ width: 150,
35
+ hideInSearch: false
36
+ },
37
+ Text: {
38
+ width: 200,
39
+ hideInSearch: true
40
+ },
41
+ // 数值类型
42
+ Int: {
43
+ width: 100,
44
+ hideInSearch: true,
45
+ type: 'numberColumn'
46
+ },
47
+ Long: {
48
+ width: 100,
49
+ hideInSearch: true,
50
+ type: 'numberColumn'
51
+ },
52
+ Decimal: {
53
+ width: 120,
54
+ hideInSearch: true,
55
+ type: 'numberColumn'
56
+ },
57
+ Double: {
58
+ width: 120,
59
+ hideInSearch: true,
60
+ type: 'numberColumn'
61
+ },
62
+ Float: {
63
+ width: 120,
64
+ hideInSearch: true,
65
+ type: 'numberColumn'
66
+ },
67
+ // 布尔类型
68
+ Boolean: {
69
+ width: 80,
70
+ hideInSearch: false
71
+ },
72
+ // 日期时间类型
73
+ DateTime: {
74
+ width: 160,
75
+ hideInSearch: true,
76
+ type: 'dateTimeColumn'
77
+ },
78
+ Date: {
79
+ width: 120,
80
+ hideInSearch: true,
81
+ type: 'dateColumn'
82
+ },
83
+ // 其他类型
84
+ Guid: {
85
+ width: 280,
86
+ hideInSearch: false
87
+ },
88
+ Enum: {
89
+ width: 100,
90
+ hideInSearch: false
91
+ }
92
+ };
93
+
94
+ /**
95
+ * 将单个扩展字段转换为列定义
96
+ *
97
+ * @param field 扩展字段定义
98
+ * @returns AG-Grid 列定义
99
+ */
100
+ function fieldToColumnDef(field) {
101
+ var config = dataTypeColumnConfig[field.dataType] || {
102
+ width: 150,
103
+ hideInSearch: false
104
+ };
105
+ var colDef = _objectSpread(_objectSpread({
106
+ field: field.name,
107
+ headerName: field.displayName,
108
+ width: config.width,
109
+ hideInSearch: config.hideInSearch
110
+ }, config.type && {
111
+ type: config.type
112
+ }), field.description && {
113
+ headerTooltip: field.description
114
+ });
115
+ return colDef;
116
+ }
117
+
118
+ /**
119
+ * 获取指定实体的扩展列定义
120
+ *
121
+ * @param entityType 实体类型全名 (如 "Burn.Product.Domain.Product")
122
+ * @param extensions 实体扩展配置映射
123
+ * @returns 扩展列定义数组,按 sortOrder 排序
124
+ */
125
+ function getEntityExtensionColumns(entityType, extensions) {
126
+ // 边界情况处理:无效输入直接返回空数组
127
+ var entityConfig = entityType ? extensions === null || extensions === void 0 ? void 0 : extensions[entityType] : undefined;
128
+ var fields = entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.fields;
129
+ if (!fields || !Array.isArray(fields)) {
130
+ return [];
131
+ }
132
+
133
+ // 按 sortOrder 排序后转换为列定义
134
+ return _toConsumableArray(fields).sort(function (a, b) {
135
+ var _a$sortOrder, _b$sortOrder;
136
+ return ((_a$sortOrder = a.sortOrder) !== null && _a$sortOrder !== void 0 ? _a$sortOrder : 0) - ((_b$sortOrder = b.sortOrder) !== null && _b$sortOrder !== void 0 ? _b$sortOrder : 0);
137
+ }).map(fieldToColumnDef);
138
+ }
@@ -1,7 +1,7 @@
1
1
  import _sumBy from "lodash/sumBy";
2
2
  import _uniqueId from "lodash/uniqueId";
3
3
  import _isArray from "lodash/isArray";
4
- var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText", "queryDefaultRows", "onSelectedRowsChange", "enableClickSelection", "rowSelection", "useNativeTreeFilter"];
4
+ var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children", "defaultSearchExpand", "overlayNoRowsTemplateText", "queryDefaultRows", "onSelectedRowsChange", "enableClickSelection", "rowSelection", "useNativeTreeFilter", "entityType"];
5
5
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7
7
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -54,6 +54,7 @@ import { extractItemsOrder, extractHiddenFields } from "./shared/utils/schemeDat
54
54
  import { createSafeHtmlTemplate } from "./utils/sanitize";
55
55
  import { GridPlusError, ErrorType, ErrorSeverity } from "./errors";
56
56
  import { logger } from "./utils/logger";
57
+ import { getEntityExtensionColumns } from "./utils/entityExtensionColumns";
57
58
  import { message } from 'antd';
58
59
  var Text = Typography.Text;
59
60
  var getSort = function getSort(columnState) {
@@ -85,6 +86,7 @@ function AgGridPlus(props) {
85
86
  propsRowSelection = props.rowSelection,
86
87
  _props$useNativeTreeF = props.useNativeTreeFilter,
87
88
  useNativeTreeFilter = _props$useNativeTreeF === void 0 ? false : _props$useNativeTreeF,
89
+ entityType = props.entityType,
88
90
  rest = _objectWithoutProperties(props, _excluded);
89
91
  var _useGridPlusColumnSta = useGridPlusColumnState(),
90
92
  onSaveColumnState = _useGridPlusColumnSta.onSaveColumnState,
@@ -96,7 +98,8 @@ function AgGridPlus(props) {
96
98
  globalConfigPermissions = _useGridPlusColumnSta.globalConfigPermissions,
97
99
  applySchemeToGlobal = _useGridPlusColumnSta.applySchemeToGlobal,
98
100
  resetToGlobal = _useGridPlusColumnSta.resetToGlobal,
99
- resetAllUsers = _useGridPlusColumnSta.resetAllUsers;
101
+ resetAllUsers = _useGridPlusColumnSta.resetAllUsers,
102
+ hostEntityExtensions = _useGridPlusColumnSta.hostEntityExtensions;
100
103
  var gridRef = useRef();
101
104
  var apiRef = useRef();
102
105
  var allColDefsRef = useRef([]);
@@ -274,7 +277,9 @@ function AgGridPlus(props) {
274
277
  currentQuerySchemes = schemeDataFlow.querySchemes,
275
278
  currentQueryScheme = schemeDataFlow.currentQueryScheme,
276
279
  derivedColumnDefs = schemeDataFlow.derivedColumnDefs,
277
- derivedColumnState = schemeDataFlow.derivedColumnState;
280
+ derivedColumnState = schemeDataFlow.derivedColumnState,
281
+ isUsingGlobalFallback = schemeDataFlow.isUsingGlobalFallback,
282
+ isUsingGlobalQueryFallback = schemeDataFlow.isUsingGlobalQueryFallback;
278
283
  useImperativeHandle(propsGridRef, function () {
279
284
  return gridRef.current;
280
285
  });
@@ -607,6 +612,34 @@ function AgGridPlus(props) {
607
612
  cellRenderer: cellRenderer
608
613
  });
609
614
  });
615
+
616
+ // 【新增】基于 entityType 自动注入扩展列 @author nokecy
617
+ // 从 context 的 hostEntityExtensions 获取对应实体的扩展字段并转换为列定义
618
+ if (entityType && hostEntityExtensions) {
619
+ var extensionCols = getEntityExtensionColumns(entityType, hostEntityExtensions);
620
+ if (extensionCols.length > 0) {
621
+ // 查找操作列位置(pinned='right' 或 field='action')
622
+ var actionIndex = columnDefs.findIndex(function (col) {
623
+ return col.field === 'action' || col.pinned === 'right';
624
+ });
625
+ if (actionIndex === -1) {
626
+ var _columnDefs;
627
+ // 没有操作列,直接追加到末尾
628
+ (_columnDefs = columnDefs).push.apply(_columnDefs, _toConsumableArray(extensionCols));
629
+ } else {
630
+ var _columnDefs2;
631
+ // 插入到操作列之前
632
+ (_columnDefs2 = columnDefs).splice.apply(_columnDefs2, [actionIndex, 0].concat(_toConsumableArray(extensionCols)));
633
+ }
634
+ logger.debug('[AgGridPlus] 已注入实体扩展列', {
635
+ entityType: entityType,
636
+ extensionColsCount: extensionCols.length,
637
+ extensionCols: extensionCols.map(function (c) {
638
+ return c.field;
639
+ })
640
+ });
641
+ }
642
+ }
610
643
  return columnDefs;
611
644
  };
612
645
 
@@ -633,7 +666,7 @@ function AgGridPlus(props) {
633
666
  });
634
667
  }
635
668
  return cols;
636
- }, [React.Children.count(children), props.columnDefs, extensibleColumns, gridKey]);
669
+ }, [React.Children.count(children), props.columnDefs, extensibleColumns, gridKey, entityType, hostEntityExtensions]);
637
670
 
638
671
  // 稳定化 gridParams 和 sortColumn 的引用
639
672
  var stableGridParams = useMemo(function () {
@@ -1254,7 +1287,12 @@ function AgGridPlus(props) {
1254
1287
  globalConfigPermissions: globalConfigPermissions,
1255
1288
  applySchemeToGlobal: applySchemeToGlobal,
1256
1289
  resetToGlobal: resetToGlobal,
1257
- resetAllUsers: resetAllUsers
1290
+ resetAllUsers: resetAllUsers,
1291
+ // ========== 全局方案回退状态 @author nokecy ==========
1292
+ isUsingGlobalFallback: isUsingGlobalFallback,
1293
+ isUsingGlobalQueryFallback: isUsingGlobalQueryFallback,
1294
+ // ========== 实体扩展字段配置 @author nokecy ==========
1295
+ hostEntityExtensions: hostEntityExtensions
1258
1296
  };
1259
1297
  }, [extensibleColumns, gridPlusColumnState, allColDefsRef.current,
1260
1298
  // 【修复】添加到依赖数组
@@ -1264,7 +1302,11 @@ function AgGridPlus(props) {
1264
1302
  // 方案管理依赖
1265
1303
  columnSchemes, querySchemes, currentSchemes, schemesLoading, lastSyncTime, saveColumnScheme, deleteColumnScheme, saveQueryScheme, deleteQueryScheme, setCurrentColumnScheme, setCurrentQueryScheme, refreshSchemes, getColumnSchemes, getQuerySchemes, getCurrentScheme,
1266
1304
  // 全局配置依赖
1267
- globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers]);
1305
+ globalConfigPermissions, applySchemeToGlobal, resetToGlobal, resetAllUsers,
1306
+ // 全局方案回退状态依赖 @author nokecy
1307
+ isUsingGlobalFallback, isUsingGlobalQueryFallback,
1308
+ // 实体扩展字段配置依赖 @author nokecy
1309
+ hostEntityExtensions]);
1268
1310
  return /*#__PURE__*/React.createElement(GridPlusContext.Provider, {
1269
1311
  value: gridPlusContextValue
1270
1312
  }, /*#__PURE__*/React.createElement(Spin, {
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import type { ColumnScheme, QueryScheme, CurrentSchemeDto } from "../shared/storage/schemeStorageAdapter";
3
3
  import type { GlobalConfigPermissions } from '../shared/permissions/globalConfigPermissions';
4
+ import type { HostEntityExtensions } from '../types';
4
5
  /**
5
6
  * 方案管理 API 接口
6
7
  *
@@ -166,5 +167,23 @@ export interface GridPlusContextValue extends SchemeManagementAPI {
166
167
  * 由使用端(业务应用)传入,用于前端根据权限动态显示/隐藏操作按钮
167
168
  */
168
169
  globalConfigPermissions?: GlobalConfigPermissions;
170
+ /**
171
+ * 是否使用全局列方案作为回退
172
+ * 当没有用户方案时自动使用全局方案,此时为 true
173
+ */
174
+ isUsingGlobalFallback?: boolean;
175
+ /**
176
+ * 是否使用全局查询方案作为回退
177
+ */
178
+ isUsingGlobalQueryFallback?: boolean;
179
+ /**
180
+ * 实体扩展字段配置映射
181
+ * key: 实体类型全名 (如 "Burn.Product.Domain.Product")
182
+ * value: 该实体的扩展配置(包含字段定义数组)
183
+ *
184
+ * 来自后端 ABP 配置的 extraProperties.hostEntityExtensions
185
+ * 用于 AgGridPlus 根据 entityType 属性自动注入扩展列
186
+ */
187
+ hostEntityExtensions?: HostEntityExtensions;
169
188
  }
170
189
  export declare const GridPlusContext: React.Context<GridPlusContextValue>;
@@ -32,9 +32,13 @@ export declare function useSchemeSource(gridKey: string, schemeData: SchemeData)
32
32
  columnSchemes: ColumnScheme[];
33
33
  currentColumnSchemeId: string | null | undefined;
34
34
  currentColumnScheme: ColumnScheme | undefined;
35
+ /** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
36
+ isUsingGlobalFallback: boolean;
35
37
  querySchemes: QueryScheme[];
36
38
  currentQuerySchemeId: string | null | undefined;
37
39
  currentQueryScheme: QueryScheme | undefined;
40
+ /** 是否使用全局查询方案作为回退 */
41
+ isUsingGlobalQueryFallback: boolean;
38
42
  };
39
43
  /**
40
44
  * 派生层 - 计算 Grid 状态(只读派生)
@@ -83,7 +87,11 @@ export declare function useSchemeDataFlow(gridKey: string, allColDefs: ExtendedC
83
87
  columnSchemes: ColumnScheme[];
84
88
  currentColumnSchemeId: string | null | undefined;
85
89
  currentColumnScheme: ColumnScheme | undefined;
90
+ /** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
91
+ isUsingGlobalFallback: boolean;
86
92
  querySchemes: QueryScheme[];
87
93
  currentQuerySchemeId: string | null | undefined;
88
94
  currentQueryScheme: QueryScheme | undefined;
95
+ /** 是否使用全局查询方案作为回退 */
96
+ isUsingGlobalQueryFallback: boolean;
89
97
  };
@@ -39,23 +39,84 @@ export function useSchemeSource(gridKey, schemeData) {
39
39
  var _currentSchemes$gridK, _currentSchemes$gridK2;
40
40
  var schemes = (columnSchemes === null || columnSchemes === void 0 ? void 0 : columnSchemes[gridKey]) || [];
41
41
  var currentColumnSchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK = currentSchemes[gridKey]) === null || _currentSchemes$gridK === void 0 ? void 0 : _currentSchemes$gridK.columnSchemeId;
42
+
43
+ // 优先使用当前用户方案,如果没有则自动使用全局方案
44
+ // @author nokecy
42
45
  var currentColumnScheme = schemes.find(function (s) {
43
46
  return s.id === currentColumnSchemeId;
44
47
  });
48
+ var isUsingGlobalFallback = false;
49
+ if (!currentColumnScheme && schemes.length > 0) {
50
+ // 没有当前用户方案,查找全局方案
51
+ var globalSchemes = schemes.filter(function (s) {
52
+ return s.isGlobal === true;
53
+ });
54
+
55
+ // 多个全局方案警告 @author nokecy
56
+ if (globalSchemes.length > 1) {
57
+ console.warn('[useSchemeSource] 检测到多个全局方案,将使用第一个', {
58
+ gridKey: gridKey,
59
+ globalSchemeCount: globalSchemes.length,
60
+ globalSchemes: globalSchemes.map(function (s) {
61
+ return {
62
+ id: s.id,
63
+ name: s.name
64
+ };
65
+ })
66
+ });
67
+ }
68
+ var globalScheme = globalSchemes[0];
69
+ if (globalScheme) {
70
+ currentColumnScheme = globalScheme;
71
+ isUsingGlobalFallback = true;
72
+ }
73
+ }
45
74
  var querySchemeList = (querySchemes === null || querySchemes === void 0 ? void 0 : querySchemes[gridKey]) || [];
46
75
  var currentQuerySchemeId = currentSchemes === null || currentSchemes === void 0 || (_currentSchemes$gridK2 = currentSchemes[gridKey]) === null || _currentSchemes$gridK2 === void 0 ? void 0 : _currentSchemes$gridK2.querySchemeId;
76
+
77
+ // 查询方案也采用相同的回退逻辑
78
+ // @author nokecy
47
79
  var currentQueryScheme = querySchemeList.find(function (s) {
48
80
  return s.id === currentQuerySchemeId;
49
81
  });
82
+ var isUsingGlobalQueryFallback = false;
83
+ if (!currentQueryScheme && querySchemeList.length > 0) {
84
+ var globalQuerySchemes = querySchemeList.filter(function (s) {
85
+ return s.isGlobal === true;
86
+ });
87
+
88
+ // 多个全局查询方案警告 @author nokecy
89
+ if (globalQuerySchemes.length > 1) {
90
+ console.warn('[useSchemeSource] 检测到多个全局查询方案,将使用第一个', {
91
+ gridKey: gridKey,
92
+ globalSchemeCount: globalQuerySchemes.length,
93
+ globalSchemes: globalQuerySchemes.map(function (s) {
94
+ return {
95
+ id: s.id,
96
+ name: s.name
97
+ };
98
+ })
99
+ });
100
+ }
101
+ var globalQueryScheme = globalQuerySchemes[0];
102
+ if (globalQueryScheme) {
103
+ currentQueryScheme = globalQueryScheme;
104
+ isUsingGlobalQueryFallback = true;
105
+ }
106
+ }
50
107
  return {
51
108
  // 列方案
52
109
  columnSchemes: schemes,
53
110
  currentColumnSchemeId: currentColumnSchemeId,
54
111
  currentColumnScheme: currentColumnScheme,
112
+ /** 是否使用全局方案作为回退(没有用户方案时自动使用全局方案) */
113
+ isUsingGlobalFallback: isUsingGlobalFallback,
55
114
  // 查询方案
56
115
  querySchemes: querySchemeList,
57
116
  currentQuerySchemeId: currentQuerySchemeId,
58
- currentQueryScheme: currentQueryScheme
117
+ currentQueryScheme: currentQueryScheme,
118
+ /** 是否使用全局查询方案作为回退 */
119
+ isUsingGlobalQueryFallback: isUsingGlobalQueryFallback
59
120
  };
60
121
  }, [columnSchemes, querySchemes, currentSchemes, gridKey]);
61
122
  }
@@ -13,3 +13,5 @@ export type { UseSchemeManagerConfig } from "./context/useSchemeManager";
13
13
  export type { BackendApiAdapterConfig } from "./shared/storage/backendApiAdapter";
14
14
  export type { LocalStorageAdapterConfig } from "./shared/storage/localStorageAdapter";
15
15
  export type { GlobalConfigPermissions } from "./shared/permissions/globalConfigPermissions";
16
+ export type { EntityExtensionField, EntityExtensionConfig, HostEntityExtensions } from "./types";
17
+ export { fieldToColumnDef, getEntityExtensionColumns } from "./utils/entityExtensionColumns";
@@ -15,5 +15,10 @@ export { BackendApiSchemeAdapter } from "./shared/storage/backendApiAdapter";
15
15
 
16
16
  // 权限相关类型
17
17
 
18
+ // 实体扩展字段类型 @author nokecy
19
+
20
+ // 实体扩展列工具函数 @author nokecy
21
+ export { fieldToColumnDef, getEntityExtensionColumns } from "./utils/entityExtensionColumns";
22
+
18
23
  // 注意: 旧的查询方案管理功能已废弃
19
24
  // 相关导出已移除,请使用集中式方案管理 API (useSchemeManager/useGridSchemes)
@@ -95,6 +95,15 @@ interface GridProps extends AgGridReactProps {
95
95
  * @default false
96
96
  */
97
97
  useNativeTreeFilter?: boolean;
98
+ /**
99
+ * 实体类型全名,用于自动注入扩展字段列
100
+ * 当配置此属性时,组件会自动从 context 的 hostEntityExtensions
101
+ * 获取对应实体的扩展字段并转换为列定义
102
+ *
103
+ * @example "Burn.Product.Domain.Product"
104
+ * @author nokecy
105
+ */
106
+ entityType?: string;
98
107
  }
99
108
  interface AgGridColumnPropsClone extends ColDef {
100
109
  /**
@@ -61,7 +61,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
61
61
  applySchemeToGlobal = _useGridSchemes.applySchemeToGlobal,
62
62
  resetToGlobal = _useGridSchemes.resetToGlobal,
63
63
  resetAllUsers = _useGridSchemes.resetAllUsers,
64
- globalConfigPermissions = _useGridSchemes.globalConfigPermissions;
64
+ globalConfigPermissions = _useGridSchemes.globalConfigPermissions,
65
+ isUsingGlobalFallback = _useGridSchemes.isUsingGlobalFallback;
65
66
 
66
67
  // 解构权限信息
67
68
  var canApplyToGlobal = (_globalConfigPermissi = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canApplyToGlobal) !== null && _globalConfigPermissi !== void 0 ? _globalConfigPermissi : false;
@@ -1155,7 +1156,12 @@ var ColumnSetting = function ColumnSetting(_ref) {
1155
1156
  fontWeight: 'normal',
1156
1157
  color: '#1890ff'
1157
1158
  }
1158
- }, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name)),
1159
+ }, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name, isUsingGlobalFallback && currentScheme.isGlobal && /*#__PURE__*/React.createElement(Tag, {
1160
+ color: "orange",
1161
+ style: {
1162
+ marginLeft: 8
1163
+ }
1164
+ }, "\u81EA\u52A8\u4F7F\u7528\u5168\u5C40"))),
1159
1165
  open: visible,
1160
1166
  onCancel: handleClose,
1161
1167
  width: 1100,
@@ -1,7 +1,7 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
2
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
6
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -110,13 +110,35 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
110
110
  while (1) switch (_context.prev = _context.next) {
111
111
  case 0:
112
112
  this.log('加载所有方案数据');
113
- data = this.readData();
113
+ data = this.readData(); // 【修复】确保所有方案都有 isGlobal 字段
114
+ // 如果没有设置,默认为 false(非全局方案)
115
+ // @author nokecy
116
+ if (data.columnSchemes) {
117
+ Object.keys(data.columnSchemes).forEach(function (gridId) {
118
+ data.columnSchemes[gridId] = data.columnSchemes[gridId].map(function (scheme) {
119
+ var _scheme$isGlobal;
120
+ return _objectSpread(_objectSpread({}, scheme), {}, {
121
+ isGlobal: (_scheme$isGlobal = scheme.isGlobal) !== null && _scheme$isGlobal !== void 0 ? _scheme$isGlobal : false
122
+ });
123
+ });
124
+ });
125
+ }
126
+ if (data.querySchemes) {
127
+ Object.keys(data.querySchemes).forEach(function (gridId) {
128
+ data.querySchemes[gridId] = data.querySchemes[gridId].map(function (scheme) {
129
+ var _isGlobal;
130
+ return _objectSpread(_objectSpread({}, scheme), {}, {
131
+ isGlobal: (_isGlobal = scheme.isGlobal) !== null && _isGlobal !== void 0 ? _isGlobal : false
132
+ });
133
+ });
134
+ });
135
+ }
114
136
  this.log('加载完成', {
115
137
  columnSchemes: Object.keys(data.columnSchemes).length,
116
138
  querySchemes: Object.keys(data.querySchemes).length
117
139
  });
118
140
  return _context.abrupt("return", data);
119
- case 4:
141
+ case 6:
120
142
  case "end":
121
143
  return _context.stop();
122
144
  }
@@ -131,7 +153,8 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
131
153
  key: "saveColumnScheme",
132
154
  value: function () {
133
155
  var _saveColumnScheme = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gridId, scheme) {
134
- var data, index, newScheme;
156
+ var _savedScheme$isGlobal;
157
+ var data, index, newScheme, savedScheme;
135
158
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
136
159
  while (1) switch (_context2.prev = _context2.next) {
137
160
  case 0:
@@ -158,8 +181,13 @@ export var LocalStorageSchemeAdapter = /*#__PURE__*/function () {
158
181
  this.log("\u65B0\u589E\u5217\u65B9\u6848: ".concat(gridId, " - ").concat(scheme.name));
159
182
  }
160
183
  this.writeData(data);
161
- return _context2.abrupt("return", data.columnSchemes[gridId][index >= 0 ? index : data.columnSchemes[gridId].length - 1]);
162
- case 6:
184
+
185
+ // 【修复】确保返回的方案包含 isGlobal 字段 @author nokecy
186
+ savedScheme = data.columnSchemes[gridId][index >= 0 ? index : data.columnSchemes[gridId].length - 1];
187
+ return _context2.abrupt("return", _objectSpread(_objectSpread({}, savedScheme), {}, {
188
+ isGlobal: (_savedScheme$isGlobal = savedScheme.isGlobal) !== null && _savedScheme$isGlobal !== void 0 ? _savedScheme$isGlobal : false
189
+ }));
190
+ case 7:
163
191
  case "end":
164
192
  return _context2.stop();
165
193
  }
@@ -75,6 +75,8 @@ export interface QueryScheme {
75
75
  updatedAt?: number;
76
76
  /** 创建用户ID(可选) */
77
77
  createdBy?: string;
78
+ /** 是否为全局方案 @author nokecy */
79
+ isGlobal?: boolean;
78
80
  }
79
81
  /**
80
82
  * 列方案(集中式 API 使用)
@@ -310,3 +310,56 @@ export type RowDataArray<T = any> = T[];
310
310
  * 查询表单项数组类型
311
311
  */
312
312
  export type QueryFormItems = QueryFormItem[];
313
+ /**
314
+ * 扩展字段定义
315
+ * 来自后端 ABP 配置的 hostEntityExtensions
316
+ */
317
+ export interface EntityExtensionField {
318
+ /** 字段名称 */
319
+ name: string;
320
+ /** 显示名称 */
321
+ displayName: string;
322
+ /** 描述信息 */
323
+ description?: string | null;
324
+ /** 数据类型: String, Int, Long, Decimal, Double, Float, Boolean, DateTime, Date, Guid, Enum, Text */
325
+ dataType: string;
326
+ /** 最大长度(字符串类型) */
327
+ maxLength?: number | null;
328
+ /** 精度(数值类型) */
329
+ precision?: number | null;
330
+ /** 小数位数(数值类型) */
331
+ scale?: number | null;
332
+ /** 是否必填 */
333
+ isRequired?: boolean;
334
+ /** 排序顺序 */
335
+ sortOrder?: number;
336
+ /** UI 组件类型 */
337
+ uiComponent?: string | null;
338
+ /** 占位符文本 */
339
+ placeholder?: string | null;
340
+ /** 默认值 */
341
+ defaultValue?: any;
342
+ /** 组件属性(JSON 字符串) */
343
+ componentProps?: string | null;
344
+ /** 验证规则(JSON 字符串) */
345
+ validationRules?: string | null;
346
+ }
347
+ /**
348
+ * 单个实体的扩展配置
349
+ */
350
+ export interface EntityExtensionConfig {
351
+ /** 实体类型全名 (如 "Burn.Product.Domain.Product") */
352
+ entityType: string;
353
+ /** 实体显示名称 */
354
+ displayName: string;
355
+ /** 模块名称 */
356
+ moduleName: string;
357
+ /** 扩展字段列表 */
358
+ fields: EntityExtensionField[];
359
+ }
360
+ /**
361
+ * 所有实体扩展配置映射
362
+ * key: 实体类型全名
363
+ * value: 该实体的扩展配置
364
+ */
365
+ export type HostEntityExtensions = Record<string, EntityExtensionConfig>;