@nokecy/qc-ui 1.1.35 → 1.1.37

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,133 @@
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
+ * 使用 extraProperties.xxx 嵌套路径访问数据
90
+ *
91
+ * @param field 扩展字段定义
92
+ * @returns AG-Grid 列定义
93
+ */
94
+ export function fieldToColumnDef(field) {
95
+ var config = dataTypeColumnConfig[field.dataType] || {
96
+ width: 150,
97
+ hideInSearch: false
98
+ };
99
+ var colDef = _objectSpread(_objectSpread({
100
+ // 使用嵌套路径访问 extraProperties 中的数据 @author nokecy
101
+ field: "extraProperties.".concat(field.name),
102
+ headerName: field.displayName,
103
+ width: config.width,
104
+ hideInSearch: config.hideInSearch
105
+ }, config.type && {
106
+ type: config.type
107
+ }), field.description && {
108
+ headerTooltip: field.description
109
+ });
110
+ return colDef;
111
+ }
112
+
113
+ /**
114
+ * 获取指定实体的扩展列定义
115
+ *
116
+ * @param entityType 实体类型全名 (如 "Burn.Product.Domain.Product")
117
+ * @param extensions 实体扩展配置映射
118
+ * @returns 扩展列定义数组,按 sortOrder 排序
119
+ */
120
+ export function getEntityExtensionColumns(entityType, extensions) {
121
+ // 边界情况处理:无效输入直接返回空数组
122
+ var entityConfig = entityType ? extensions === null || extensions === void 0 ? void 0 : extensions[entityType] : undefined;
123
+ var fields = entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.fields;
124
+ if (!fields || !Array.isArray(fields)) {
125
+ return [];
126
+ }
127
+
128
+ // 按 sortOrder 排序后转换为列定义
129
+ return _toConsumableArray(fields).sort(function (a, b) {
130
+ var _a$sortOrder, _b$sortOrder;
131
+ 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);
132
+ }).map(fieldToColumnDef);
133
+ }
@@ -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;