@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,22 @@
1
+ /**
2
+ * 实体扩展字段列转换工具
3
+ * 将后端 ABP 配置的扩展字段转换为 AG-Grid 列定义
4
+ *
5
+ * @author nokecy
6
+ */
7
+ import type { ExtendedColDef, EntityExtensionField, HostEntityExtensions } from '../types';
8
+ /**
9
+ * 将单个扩展字段转换为列定义
10
+ *
11
+ * @param field 扩展字段定义
12
+ * @returns AG-Grid 列定义
13
+ */
14
+ export declare function fieldToColumnDef(field: EntityExtensionField): ExtendedColDef;
15
+ /**
16
+ * 获取指定实体的扩展列定义
17
+ *
18
+ * @param entityType 实体类型全名 (如 "Burn.Product.Domain.Product")
19
+ * @param extensions 实体扩展配置映射
20
+ * @returns 扩展列定义数组,按 sortOrder 排序
21
+ */
22
+ export declare function getEntityExtensionColumns(entityType: string | undefined, extensions?: HostEntityExtensions): ExtendedColDef[];
@@ -0,0 +1,138 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ 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."); }
4
+ 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); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ 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; }
11
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
+ 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); }
13
+ /**
14
+ * 实体扩展字段列转换工具
15
+ * 将后端 ABP 配置的扩展字段转换为 AG-Grid 列定义
16
+ *
17
+ * @author nokecy
18
+ */
19
+
20
+ /**
21
+ * 数据类型到列配置的映射
22
+ * 根据字段的数据类型自动配置列宽度、是否可搜索、列类型等
23
+ */
24
+ var dataTypeColumnConfig = {
25
+ // 字符串类型
26
+ String: {
27
+ width: 150,
28
+ hideInSearch: false
29
+ },
30
+ Text: {
31
+ width: 200,
32
+ hideInSearch: true
33
+ },
34
+ // 数值类型
35
+ Int: {
36
+ width: 100,
37
+ hideInSearch: true,
38
+ type: 'numberColumn'
39
+ },
40
+ Long: {
41
+ width: 100,
42
+ hideInSearch: true,
43
+ type: 'numberColumn'
44
+ },
45
+ Decimal: {
46
+ width: 120,
47
+ hideInSearch: true,
48
+ type: 'numberColumn'
49
+ },
50
+ Double: {
51
+ width: 120,
52
+ hideInSearch: true,
53
+ type: 'numberColumn'
54
+ },
55
+ Float: {
56
+ width: 120,
57
+ hideInSearch: true,
58
+ type: 'numberColumn'
59
+ },
60
+ // 布尔类型
61
+ Boolean: {
62
+ width: 80,
63
+ hideInSearch: false
64
+ },
65
+ // 日期时间类型
66
+ DateTime: {
67
+ width: 160,
68
+ hideInSearch: true,
69
+ type: 'dateTimeColumn'
70
+ },
71
+ Date: {
72
+ width: 120,
73
+ hideInSearch: true,
74
+ type: 'dateColumn'
75
+ },
76
+ // 其他类型
77
+ Guid: {
78
+ width: 280,
79
+ hideInSearch: false
80
+ },
81
+ Enum: {
82
+ width: 100,
83
+ hideInSearch: false
84
+ }
85
+ };
86
+
87
+ /**
88
+ * 将单个扩展字段转换为列定义
89
+ *
90
+ * @param field 扩展字段定义
91
+ * @returns AG-Grid 列定义
92
+ */
93
+ export function fieldToColumnDef(field) {
94
+ var config = dataTypeColumnConfig[field.dataType] || {
95
+ width: 150,
96
+ hideInSearch: false
97
+ };
98
+ var colDef = _objectSpread(_objectSpread({
99
+ field: field.name,
100
+ headerName: field.displayName,
101
+ width: config.width,
102
+ hideInSearch: config.hideInSearch
103
+ }, config.type && {
104
+ type: config.type
105
+ }), field.description && {
106
+ headerTooltip: field.description
107
+ });
108
+ return colDef;
109
+ }
110
+
111
+ /**
112
+ * 获取指定实体的扩展列定义
113
+ *
114
+ * @param entityType 实体类型全名 (如 "Burn.Product.Domain.Product")
115
+ * @param extensions 实体扩展配置映射
116
+ * @returns 扩展列定义数组,按 sortOrder 排序
117
+ */
118
+ export function getEntityExtensionColumns(entityType, extensions) {
119
+ // 边界情况处理
120
+ if (!entityType || !extensions || !extensions[entityType]) {
121
+ return [];
122
+ }
123
+ var entityConfig = extensions[entityType];
124
+
125
+ // 验证字段数组
126
+ if (!entityConfig.fields || !Array.isArray(entityConfig.fields)) {
127
+ return [];
128
+ }
129
+
130
+ // 按 sortOrder 排序字段
131
+ var sortedFields = _toConsumableArray(entityConfig.fields).sort(function (a, b) {
132
+ var _a$sortOrder, _b$sortOrder;
133
+ 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);
134
+ });
135
+
136
+ // 转换为列定义
137
+ return sortedFields.map(fieldToColumnDef);
138
+ }
@@ -173,7 +173,7 @@ export declare const createSelectField: (title: string, options: {
173
173
  export declare const createCascaderField: (title: string, options: any[], config?: {
174
174
  required?: boolean | undefined;
175
175
  changeOnSelect?: boolean | undefined;
176
- expandTrigger?: "click" | "hover" | undefined;
176
+ expandTrigger?: "hover" | "click" | undefined;
177
177
  placeholder?: string | undefined;
178
178
  }) => {
179
179
  type: string;
@@ -187,7 +187,7 @@ export declare const createCascaderField: (title: string, options: any[], config
187
187
  };
188
188
  options: any[];
189
189
  changeOnSelect: boolean;
190
- expandTrigger: "click" | "hover";
190
+ expandTrigger: "hover" | "click";
191
191
  };
192
192
  };
193
193
  export default withStandardForm;