@nokecy/qc-ui 1.1.67 → 1.1.69
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/dist/cjs/ag-grid-plus/ag-gridPlus.js +1 -16
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigForm.js +3 -1
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +7 -3
- package/dist/cjs/ag-grid-plus/setting/ColumnNameCellRenderer.js +9 -6
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +4 -2
- package/dist/cjs/ag-grid-plus/setting/MoveNodeModal.js +3 -1
- package/dist/cjs/ag-grid-plus/setting/NameColumnRenderer.js +6 -4
- package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +10 -8
- package/dist/cjs/ag-grid-plus/utils/columnProcessors.js +6 -3
- package/dist/cjs/array-table/index.js +15 -1
- package/dist/cjs/array-table/indexColumn.d.ts +17 -0
- package/dist/cjs/array-table/indexColumn.js +58 -0
- package/dist/cjs/array-table/readOnlyFormatters.d.ts +8 -0
- package/dist/cjs/array-table/readOnlyFormatters.js +23 -1
- package/dist/cjs/array-table/utils.js +49 -12
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +3 -18
- package/dist/esm/ag-grid-plus/setting/ColumnConfigForm.js +4 -2
- package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +8 -4
- package/dist/esm/ag-grid-plus/setting/ColumnNameCellRenderer.js +10 -7
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +5 -3
- package/dist/esm/ag-grid-plus/setting/MoveNodeModal.js +4 -2
- package/dist/esm/ag-grid-plus/setting/NameColumnRenderer.js +7 -5
- package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +11 -9
- package/dist/esm/ag-grid-plus/utils/columnProcessors.js +6 -3
- package/dist/esm/array-table/index.js +15 -1
- package/dist/esm/array-table/indexColumn.d.ts +17 -0
- package/dist/esm/array-table/indexColumn.js +52 -0
- package/dist/esm/array-table/readOnlyFormatters.d.ts +8 -0
- package/dist/esm/array-table/readOnlyFormatters.js +22 -0
- package/dist/esm/array-table/utils.js +50 -13
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
20
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
21
|
import { ModuleRegistry } from 'ag-grid-community';
|
|
22
22
|
import { AgGridReact } from 'ag-grid-react';
|
|
23
|
-
import { Spin, Pagination, Card, Tag,
|
|
23
|
+
import { Spin, Pagination, Card, Tag, Popover, Badge, Button, theme } from 'antd';
|
|
24
24
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
25
25
|
import { AllEnterpriseModule } from "ag-grid-enterprise";
|
|
26
26
|
|
|
@@ -36,7 +36,7 @@ import ToolBar from "./toolBar";
|
|
|
36
36
|
import SettingItem from "./settingItem";
|
|
37
37
|
import { RedoOutlined, FilterOutlined } from '@ant-design/icons';
|
|
38
38
|
import { convertFilterModel, dateTimeValueFormatter, dateValueFormatter, flatten, toTree } from "./utils";
|
|
39
|
-
import { mergeInferredColumnType, processEnumColumn } from "./utils/columnProcessors";
|
|
39
|
+
import { mergeInferredColumnType, processEllipsisColumn, processEnumColumn } from "./utils/columnProcessors";
|
|
40
40
|
import AdvancedQueryBuilder from "./queryForm/AdvancedQueryBuilder";
|
|
41
41
|
import { v4 as uuidv4 } from 'uuid';
|
|
42
42
|
import Setting from "./setting";
|
|
@@ -63,7 +63,6 @@ import { GridPlusError, ErrorType, ErrorSeverity } from "./errors";
|
|
|
63
63
|
import { logger } from "./utils/logger";
|
|
64
64
|
import { getEntityExtensionColumns } from "./utils/entityExtensionColumns";
|
|
65
65
|
import { message } from 'antd';
|
|
66
|
-
var Text = Typography.Text;
|
|
67
66
|
var getSort = function getSort(columnState) {
|
|
68
67
|
return columnState ? "".concat(columnState.colId, " ").concat(columnState.sort) : "";
|
|
69
68
|
};
|
|
@@ -470,21 +469,7 @@ function AgGridPlus(props) {
|
|
|
470
469
|
}
|
|
471
470
|
//@ts-ignore
|
|
472
471
|
if (col !== null && col !== void 0 && col.ellipsis) {
|
|
473
|
-
return
|
|
474
|
-
cellRenderer: function cellRenderer(_ref) {
|
|
475
|
-
var value = _ref.value;
|
|
476
|
-
return /*#__PURE__*/React.createElement(Text, {
|
|
477
|
-
ellipsis: {
|
|
478
|
-
tooltip: value
|
|
479
|
-
},
|
|
480
|
-
style: {
|
|
481
|
-
display: 'flex',
|
|
482
|
-
justifyContent: 'center',
|
|
483
|
-
alignItems: 'center'
|
|
484
|
-
}
|
|
485
|
-
}, value);
|
|
486
|
-
}
|
|
487
|
-
});
|
|
472
|
+
return processEllipsisColumn(mergeInferredColumnType(col, dataType));
|
|
488
473
|
}
|
|
489
474
|
if (col.cellRenderer) {
|
|
490
475
|
return _objectSpread(_objectSpread({}, mergeInferredColumnType(col, dataType)), {}, {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
|
-
import { Button, Popconfirm, Space, Tooltip } from 'antd';
|
|
8
|
+
import { Button, Popconfirm, Space, Tooltip, theme } from 'antd';
|
|
9
9
|
import { DeleteOutlined, HolderOutlined } from '@ant-design/icons';
|
|
10
10
|
import { FormGrid, FormItem, FormLayout, Input, Select, NumberPicker, Switch } from '@formily/antd-v5';
|
|
11
11
|
import { createSchemaField } from '@formily/react';
|
|
@@ -29,12 +29,14 @@ var SchemaField = createSchemaField({
|
|
|
29
29
|
* 自定义排序抓手
|
|
30
30
|
*/
|
|
31
31
|
var CustomSortHandle = function CustomSortHandle() {
|
|
32
|
+
var _theme$useToken = theme.useToken(),
|
|
33
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
32
34
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
33
35
|
title: "\u62D6\u52A8\u6392\u5E8F\uFF08\u4EC5\u652F\u6301\u540C\u7EA7\uFF09"
|
|
34
36
|
}, /*#__PURE__*/React.createElement(HolderOutlined, {
|
|
35
37
|
style: {
|
|
36
38
|
fontSize: 16,
|
|
37
|
-
color:
|
|
39
|
+
color: token.colorTextTertiary,
|
|
38
40
|
cursor: 'move'
|
|
39
41
|
}
|
|
40
42
|
}));
|
|
@@ -20,7 +20,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import React, { useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
|
23
|
-
import { Button, Select, Switch, Space, Popconfirm, message, Tag } from 'antd';
|
|
23
|
+
import { Button, Select, Switch, Space, Popconfirm, message, Tag, theme } from 'antd';
|
|
24
24
|
import { DeleteOutlined, FolderOutlined, FolderAddOutlined, FileOutlined } from '@ant-design/icons';
|
|
25
25
|
import { AgGridReact } from 'ag-grid-react';
|
|
26
26
|
import { generateId, normalizeCellAlign } from "./columnGroupUtils";
|
|
@@ -239,6 +239,8 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
239
239
|
_ref2$scrollY = _ref2.scrollY,
|
|
240
240
|
scrollY = _ref2$scrollY === void 0 ? 480 : _ref2$scrollY;
|
|
241
241
|
var gridTheme = useAgGridTheme();
|
|
242
|
+
var _theme$useToken = theme.useToken(),
|
|
243
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
242
244
|
var _useState = useState(items),
|
|
243
245
|
_useState2 = _slicedToArray(_useState, 2),
|
|
244
246
|
localItems = _useState2[0],
|
|
@@ -681,16 +683,18 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
|
|
|
681
683
|
return localItems.filter(isNodeVisible);
|
|
682
684
|
}, [localItems, expandedKeys, simple]);
|
|
683
685
|
|
|
684
|
-
//
|
|
686
|
+
// 添加拖拽样式:选择器限定在本表容器(.qc-column-config-table)内,免得弹窗打开期间染到背后列表的行;
|
|
687
|
+
// 拖拽幽灵挂在 body 上,只能全局。颜色取主题 token。@author nokecy
|
|
685
688
|
useEffect(function () {
|
|
686
689
|
var style = document.createElement('style');
|
|
687
|
-
style.textContent = "\n /* \u62D6\u62FD\u884C\u6837\u5F0F */\n .ag-row-dragging {\n opacity: 0.5;\n transition: opacity 0.2s ease;\n }\n\n /* \u62D6\u62FD\u5E7D\u7075\u6837\u5F0F */\n .ag-dnd-ghost {\n background:
|
|
690
|
+
style.textContent = "\n /* \u62D6\u62FD\u884C\u6837\u5F0F */\n .qc-column-config-table .ag-row-dragging {\n opacity: 0.5;\n transition: opacity 0.2s ease;\n }\n\n /* \u62D6\u62FD\u5E7D\u7075\u6837\u5F0F */\n .ag-dnd-ghost {\n background: ".concat(token.colorBgElevated, " !important;\n color: ").concat(token.colorText, " !important;\n border: 2px dashed ").concat(token.colorPrimary, " !important;\n border-radius: 4px !important;\n padding: 8px !important;\n box-shadow: ").concat(token.boxShadowSecondary, " !important;\n opacity: 0.9 !important;\n font-size: 14px !important;\n }\n\n /* \u53EF\u653E\u7F6E\u76EE\u6807\u9AD8\u4EAE */\n .qc-column-config-table .ag-row-hover.ag-row {\n background-color: ").concat(token.controlItemBgHover, " !important;\n transition: background-color 0.2s ease;\n }\n\n /* \u5206\u7EC4\u884C\u7279\u6B8A\u9AD8\u4EAE */\n .qc-column-config-table .ag-row-hover.ag-row[row-id*=\"group\"] {\n background-color: ").concat(token.controlItemBgActive, " !important;\n border: 2px solid ").concat(token.colorPrimary, ";\n transition: all 0.2s ease;\n }\n\n /* \u884C\u52A8\u753B */\n .qc-column-config-table .ag-row {\n transition: transform 0.3s ease, opacity 0.3s ease;\n }\n\n /* \u62D6\u62FD\u624B\u67C4\u6837\u5F0F */\n .qc-column-config-table .ag-row .ag-cell[col-id=\"type\"] {\n cursor: grab !important;\n }\n\n .qc-column-config-table .ag-row-dragging .ag-cell[col-id=\"type\"] {\n cursor: grabbing !important;\n }\n ");
|
|
688
691
|
document.head.appendChild(style);
|
|
689
692
|
return function () {
|
|
690
693
|
document.head.removeChild(style);
|
|
691
694
|
};
|
|
692
|
-
}, []);
|
|
695
|
+
}, [token]);
|
|
693
696
|
return /*#__PURE__*/React.createElement("div", {
|
|
697
|
+
className: "qc-column-config-table",
|
|
694
698
|
style: {
|
|
695
699
|
width: '100%'
|
|
696
700
|
}
|
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { useState, useCallback, useMemo } from 'react';
|
|
18
|
-
import { Input, Typography, Button, Tooltip } from 'antd';
|
|
18
|
+
import { Input, Typography, Button, Tooltip, theme } from 'antd';
|
|
19
19
|
import { UndoOutlined, InfoCircleOutlined, HolderOutlined } from '@ant-design/icons';
|
|
20
20
|
var Text = Typography.Text;
|
|
21
21
|
/**
|
|
@@ -27,6 +27,9 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
27
27
|
expandedKeys = props.expandedKeys,
|
|
28
28
|
onToggleExpand = props.onToggleExpand,
|
|
29
29
|
allItems = props.allItems;
|
|
30
|
+
var _theme$useToken = theme.useToken(),
|
|
31
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
32
|
+
|
|
30
33
|
var _useState = useState(false),
|
|
31
34
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
35
|
isEditing = _useState2[0],
|
|
@@ -111,7 +114,7 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
111
114
|
width: 16,
|
|
112
115
|
display: 'inline-block',
|
|
113
116
|
fontSize: '12px',
|
|
114
|
-
color:
|
|
117
|
+
color: token.colorTextSecondary
|
|
115
118
|
}
|
|
116
119
|
}, isExpanded ? '▼' : '▶') : /*#__PURE__*/React.createElement("span", {
|
|
117
120
|
style: {
|
|
@@ -120,7 +123,7 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
120
123
|
}
|
|
121
124
|
}), /*#__PURE__*/React.createElement(HolderOutlined, {
|
|
122
125
|
style: {
|
|
123
|
-
color:
|
|
126
|
+
color: token.colorTextTertiary,
|
|
124
127
|
cursor: 'grab',
|
|
125
128
|
fontSize: '14px'
|
|
126
129
|
}
|
|
@@ -143,7 +146,7 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
143
146
|
type: "secondary",
|
|
144
147
|
style: {
|
|
145
148
|
fontSize: '11px',
|
|
146
|
-
color:
|
|
149
|
+
color: token.colorTextTertiary,
|
|
147
150
|
lineHeight: '16px'
|
|
148
151
|
}
|
|
149
152
|
}, "\u539F\u59CB: ", item.originalHeaderName), /*#__PURE__*/React.createElement(Tooltip, {
|
|
@@ -151,7 +154,7 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
151
154
|
}, /*#__PURE__*/React.createElement(InfoCircleOutlined, {
|
|
152
155
|
style: {
|
|
153
156
|
fontSize: '11px',
|
|
154
|
-
color:
|
|
157
|
+
color: token.colorPrimary,
|
|
155
158
|
cursor: 'help'
|
|
156
159
|
}
|
|
157
160
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -173,10 +176,10 @@ export var ColumnNameCellRenderer = function ColumnNameCellRenderer(props) {
|
|
|
173
176
|
flex: 1,
|
|
174
177
|
fontSize: '14px',
|
|
175
178
|
fontWeight: item.type === 'group' ? 600 : 400,
|
|
176
|
-
borderBottom: isEditing ?
|
|
179
|
+
borderBottom: isEditing ? "1px solid ".concat(token.colorPrimary) : '1px solid transparent',
|
|
177
180
|
transition: 'border-color 0.2s',
|
|
178
181
|
padding: '0 4px',
|
|
179
|
-
color: isModified ?
|
|
182
|
+
color: isModified ? token.colorPrimary : token.colorText
|
|
180
183
|
}
|
|
181
184
|
}), isModified && /*#__PURE__*/React.createElement(Tooltip, {
|
|
182
185
|
title: "\u91CD\u7F6E\u4E3A\u539F\u59CB\u540D\u79F0"
|
|
@@ -25,7 +25,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
import React, { useState, useCallback, useMemo, useEffect } from 'react';
|
|
27
27
|
import { logger } from "../utils/logger";
|
|
28
|
-
import { Modal, Tabs, Space, Button, Input, message, Popconfirm, Tag, Tooltip, Empty } from 'antd';
|
|
28
|
+
import { Modal, Tabs, Space, Button, Input, message, Popconfirm, Tag, Tooltip, Empty, theme } from 'antd';
|
|
29
29
|
import { SaveOutlined, ReloadOutlined, EditOutlined, DeleteOutlined, StarOutlined, StarFilled, SearchOutlined,
|
|
30
30
|
// 全局配置相关图标
|
|
31
31
|
GlobalOutlined, RollbackOutlined, ClearOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
|
@@ -52,6 +52,8 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
52
52
|
onSaveColumnState = _ref.onSaveColumnState,
|
|
53
53
|
allColDefsProp = _ref.allColDefs;
|
|
54
54
|
var gridTheme = useAgGridTheme();
|
|
55
|
+
var _theme$useToken = theme.useToken(),
|
|
56
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
55
57
|
// 使用新的集中式方案管理 API(包含状态数据和操作方法)
|
|
56
58
|
var _useGridSchemes = useGridSchemes(),
|
|
57
59
|
columnSchemes = _useGridSchemes.columnSchemes,
|
|
@@ -946,7 +948,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
946
948
|
title: '重置所有用户配置',
|
|
947
949
|
content: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
|
|
948
950
|
style: {
|
|
949
|
-
color:
|
|
951
|
+
color: token.colorError,
|
|
950
952
|
fontWeight: 'bold'
|
|
951
953
|
}
|
|
952
954
|
}, "\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\uFF01"), /*#__PURE__*/React.createElement("p", null, "\u786E\u5B9A\u8981\u5220\u9664\u6240\u6709\u7528\u6237\u7684\u4E2A\u4EBA\u5217\u914D\u7F6E\u5417\uFF1F"), /*#__PURE__*/React.createElement("p", null, "\u6267\u884C\u540E\uFF0C\u6240\u6709\u7528\u6237\u5C06\u4F7F\u7528\u5168\u5C40\u9ED8\u8BA4\u914D\u7F6E\u3002")),
|
|
@@ -1177,7 +1179,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
1177
1179
|
marginLeft: 16,
|
|
1178
1180
|
fontSize: 14,
|
|
1179
1181
|
fontWeight: 'normal',
|
|
1180
|
-
color:
|
|
1182
|
+
color: token.colorPrimary
|
|
1181
1183
|
}
|
|
1182
1184
|
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name, isUsingGlobalFallback && currentScheme.isGlobal && /*#__PURE__*/React.createElement(Tag, {
|
|
1183
1185
|
color: "orange",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
|
-
import { Modal, Tree, message } from 'antd';
|
|
7
|
+
import { Modal, Tree, message, theme } from 'antd';
|
|
8
8
|
import { FolderOutlined, FileOutlined } from '@ant-design/icons';
|
|
9
9
|
import DraggableModal from "../../draggableModal";
|
|
10
10
|
var MoveNodeModal = function MoveNodeModal(_ref) {
|
|
@@ -13,6 +13,8 @@ var MoveNodeModal = function MoveNodeModal(_ref) {
|
|
|
13
13
|
allItems = _ref.allItems,
|
|
14
14
|
onCancel = _ref.onCancel,
|
|
15
15
|
onConfirm = _ref.onConfirm;
|
|
16
|
+
var _theme$useToken = theme.useToken(),
|
|
17
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
16
18
|
/**
|
|
17
19
|
* 将扁平数据转换为 Tree 结构
|
|
18
20
|
*/
|
|
@@ -133,7 +135,7 @@ var MoveNodeModal = function MoveNodeModal(_ref) {
|
|
|
133
135
|
}, /*#__PURE__*/React.createElement("div", {
|
|
134
136
|
style: {
|
|
135
137
|
marginBottom: 16,
|
|
136
|
-
color:
|
|
138
|
+
color: token.colorTextSecondary
|
|
137
139
|
}
|
|
138
140
|
}, "\u8BF7\u9009\u62E9\u76EE\u6807\u7236\u8282\u70B9(\u53EA\u80FD\u9009\u62E9\u5206\u7EC4\u8282\u70B9):"), /*#__PURE__*/React.createElement(Tree, {
|
|
139
141
|
showIcon: true,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import { Input, Tag } from 'antd';
|
|
7
|
+
import { Input, Tag, theme } from 'antd';
|
|
8
8
|
import { FolderOutlined, FileOutlined } from '@ant-design/icons';
|
|
9
9
|
/**
|
|
10
10
|
* 名称列渲染组件
|
|
@@ -18,6 +18,8 @@ var NameColumnRenderer = function NameColumnRenderer(_ref) {
|
|
|
18
18
|
var type = record.type,
|
|
19
19
|
level = record.level,
|
|
20
20
|
_isNew = record._isNew;
|
|
21
|
+
var _theme$useToken = theme.useToken(),
|
|
22
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
21
23
|
|
|
22
24
|
// 计算缩进(每层 20px)
|
|
23
25
|
var indent = level * 20;
|
|
@@ -38,12 +40,12 @@ var NameColumnRenderer = function NameColumnRenderer(_ref) {
|
|
|
38
40
|
// 节点类型图标
|
|
39
41
|
var NodeIcon = type === 'group' ? /*#__PURE__*/React.createElement(FolderOutlined, {
|
|
40
42
|
style: {
|
|
41
|
-
color:
|
|
43
|
+
color: token.colorPrimary,
|
|
42
44
|
fontSize: 14
|
|
43
45
|
}
|
|
44
46
|
}) : /*#__PURE__*/React.createElement(FileOutlined, {
|
|
45
47
|
style: {
|
|
46
|
-
color:
|
|
48
|
+
color: token.colorSuccess,
|
|
47
49
|
fontSize: 14
|
|
48
50
|
}
|
|
49
51
|
});
|
|
@@ -56,7 +58,7 @@ var NameColumnRenderer = function NameColumnRenderer(_ref) {
|
|
|
56
58
|
}
|
|
57
59
|
}, level > 0 && /*#__PURE__*/React.createElement("span", {
|
|
58
60
|
style: {
|
|
59
|
-
color:
|
|
61
|
+
color: token.colorTextTertiary,
|
|
60
62
|
fontFamily: 'monospace',
|
|
61
63
|
fontSize: 12,
|
|
62
64
|
flexShrink: 0
|
|
@@ -80,7 +82,7 @@ var NameColumnRenderer = function NameColumnRenderer(_ref) {
|
|
|
80
82
|
placeholder: type === 'group' ? '请输入分组名称' : '请输入列名称',
|
|
81
83
|
style: {
|
|
82
84
|
flex: 1,
|
|
83
|
-
background: _isNew ?
|
|
85
|
+
background: _isNew ? token.colorWarningBg : 'transparent' // 新添加的节点高亮
|
|
84
86
|
}
|
|
85
87
|
}));
|
|
86
88
|
};
|
|
@@ -25,7 +25,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
25
25
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
26
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
27
|
import React, { useState, useCallback, useMemo, useRef } from 'react';
|
|
28
|
-
import { Tabs, Button, Input, Space, message, Popconfirm, Tag, Tooltip, Switch } from 'antd';
|
|
28
|
+
import { Tabs, Button, Input, Space, message, Popconfirm, Tag, Tooltip, Switch, theme } from 'antd';
|
|
29
29
|
import DraggableModal from "../../draggableModal";
|
|
30
30
|
import { EditOutlined, DeleteOutlined, StarOutlined, StarFilled } from '@ant-design/icons';
|
|
31
31
|
import { AgGridReact } from 'ag-grid-react';
|
|
@@ -51,6 +51,8 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
51
51
|
visible = _ref.visible,
|
|
52
52
|
onClose = _ref.onClose;
|
|
53
53
|
var gridTheme = useAgGridTheme();
|
|
54
|
+
var _theme$useToken = theme.useToken(),
|
|
55
|
+
token = _theme$useToken.token; // 颜色取主题 token,跟随亮/暗主题 @author nokecy
|
|
54
56
|
// 获取方案管理 API
|
|
55
57
|
var _useGridSchemes = useGridSchemes(),
|
|
56
58
|
querySchemes = _useGridSchemes.querySchemes,
|
|
@@ -599,7 +601,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
599
601
|
}
|
|
600
602
|
return /*#__PURE__*/React.createElement(Space, null, scheme.isDefault && /*#__PURE__*/React.createElement(StarFilled, {
|
|
601
603
|
style: {
|
|
602
|
-
color:
|
|
604
|
+
color: token.colorWarning
|
|
603
605
|
}
|
|
604
606
|
}), /*#__PURE__*/React.createElement("span", null, scheme.name), isCurrent && /*#__PURE__*/React.createElement(Tag, {
|
|
605
607
|
color: "blue"
|
|
@@ -701,7 +703,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
701
703
|
marginLeft: 16,
|
|
702
704
|
fontSize: 14,
|
|
703
705
|
fontWeight: 'normal',
|
|
704
|
-
color:
|
|
706
|
+
color: token.colorPrimary
|
|
705
707
|
}
|
|
706
708
|
}, "- \u5F53\u524D\u65B9\u6848: ", currentScheme.name)),
|
|
707
709
|
open: visible,
|
|
@@ -722,30 +724,30 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
|
|
|
722
724
|
style: {
|
|
723
725
|
marginBottom: 16,
|
|
724
726
|
padding: '12px 16px',
|
|
725
|
-
background: currentScheme ?
|
|
727
|
+
background: currentScheme ? token.colorPrimaryBg : token.colorFillTertiary,
|
|
726
728
|
borderRadius: 4,
|
|
727
729
|
border: '1px solid',
|
|
728
|
-
borderColor: currentScheme ?
|
|
730
|
+
borderColor: currentScheme ? token.colorPrimaryBorder : token.colorBorder
|
|
729
731
|
}
|
|
730
732
|
}, currentScheme ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
731
733
|
style: {
|
|
732
734
|
fontWeight: 600,
|
|
733
735
|
marginBottom: 4,
|
|
734
|
-
color:
|
|
736
|
+
color: token.colorPrimary
|
|
735
737
|
}
|
|
736
738
|
}, "\u5F53\u524D\u65B9\u6848: ", currentScheme.name), currentScheme.description && /*#__PURE__*/React.createElement("div", {
|
|
737
739
|
style: {
|
|
738
740
|
fontSize: 12,
|
|
739
|
-
color:
|
|
741
|
+
color: token.colorTextSecondary
|
|
740
742
|
}
|
|
741
743
|
}, currentScheme.description)) : /*#__PURE__*/React.createElement("div", {
|
|
742
744
|
style: {
|
|
743
|
-
color:
|
|
745
|
+
color: token.colorTextSecondary
|
|
744
746
|
}
|
|
745
747
|
}, "\u672A\u9009\u62E9\u65B9\u6848 - \u4F7F\u7528\u4E34\u65F6\u914D\u7F6E")), /*#__PURE__*/React.createElement("div", {
|
|
746
748
|
style: {
|
|
747
749
|
marginBottom: 16,
|
|
748
|
-
color:
|
|
750
|
+
color: token.colorTextSecondary
|
|
749
751
|
}
|
|
750
752
|
}, "\u62D6\u62FD\u4E0B\u65B9\u67E5\u8BE2\u9879\u8C03\u6574\u987A\u5E8F\uFF0C\u4F7F\u7528\u5F00\u5173\u63A7\u5236\u663E\u793A/\u9690\u85CF\uFF0C\u5B8C\u6210\u540E\u53EF\u5E94\u7528\u6216\u4FDD\u5B58\u4E3A\u65B9\u6848"), /*#__PURE__*/React.createElement("div", {
|
|
751
753
|
style: {
|
|
@@ -207,6 +207,8 @@ export function processEllipsisColumn(col) {
|
|
|
207
207
|
return col;
|
|
208
208
|
}
|
|
209
209
|
return _objectSpread(_objectSpread({}, col), {}, {
|
|
210
|
+
// 块级占满单元格,对齐继承单元格的 text-align(列方案的左/中/右对齐、数字列右对齐);
|
|
211
|
+
// 以前写死 flex 居中,列方案选左对齐也居中,且 flex 容器里省略号不截断。@author nokecy
|
|
210
212
|
cellRenderer: function cellRenderer(_ref) {
|
|
211
213
|
var value = _ref.value;
|
|
212
214
|
return /*#__PURE__*/React.createElement(Text, {
|
|
@@ -214,9 +216,10 @@ export function processEllipsisColumn(col) {
|
|
|
214
216
|
tooltip: value
|
|
215
217
|
},
|
|
216
218
|
style: {
|
|
217
|
-
display: '
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
display: 'block',
|
|
220
|
+
width: '100%',
|
|
221
|
+
color: 'inherit',
|
|
222
|
+
lineHeight: 'inherit'
|
|
220
223
|
}
|
|
221
224
|
}, value);
|
|
222
225
|
}
|
|
@@ -19,6 +19,7 @@ import { connect, mapProps, mapReadPretty } from "@formily/react";
|
|
|
19
19
|
import uniqueId from "lodash/uniqueId";
|
|
20
20
|
import { useAddition, buildArrayTableColumns, useArrayTableSources, useArrayTableActions, isColumnComponent } from "./utils";
|
|
21
21
|
import { groupColumnDefs } from "./columnGroup";
|
|
22
|
+
import { ARRAY_TABLE_INDEX_FIELD, hasOwnIndexColumn, makeIndexColumn } from "./indexColumn";
|
|
22
23
|
import { useCellFocus, useKeyboardNavigation, useRowDrag, suppressNativeInputKeys } from "./hooks";
|
|
23
24
|
import ArrayBase from "./arrayBase";
|
|
24
25
|
import ArrayAddBtn from "./arrayAddBtn";
|
|
@@ -130,8 +131,13 @@ var ArrayTableInner = observer(function (props) {
|
|
|
130
131
|
* 列的状态(宽度、顺序、隐藏等)由方案通过 applyColumnState 控制,不需要通过 columnDefs 传递
|
|
131
132
|
*/
|
|
132
133
|
var stableColumnDefs = useMemo(function () {
|
|
134
|
+
var _buildArrayTableColum;
|
|
133
135
|
// 只依赖 sources,不依赖 dataSource 和 field.value
|
|
134
|
-
var cols = buildArrayTableColumns([], field, sources);
|
|
136
|
+
var cols = (_buildArrayTableColum = buildArrayTableColumns([], field, sources)) !== null && _buildArrayTableColum !== void 0 ? _buildArrayTableColum : [];
|
|
137
|
+
// 默认在最左加序号列;schema 里已经放了 ArrayTable.Index 的不再加。@author nokecy
|
|
138
|
+
if (cols.length > 0 && !hasOwnIndexColumn(sources)) {
|
|
139
|
+
cols.unshift(makeIndexColumn());
|
|
140
|
+
}
|
|
135
141
|
//@ts-ignore
|
|
136
142
|
if (cols.length > 0 && props.onRowDrag) {
|
|
137
143
|
//@ts-ignore
|
|
@@ -365,6 +371,14 @@ var ArrayTableInner = observer(function (props) {
|
|
|
365
371
|
},
|
|
366
372
|
onRowDragMove: handleRowDragMove,
|
|
367
373
|
onRowDataUpdated: function onRowDataUpdated(e) {
|
|
374
|
+
// 增删行、拖动换行后行位置变了,未改动的行不会自己重算序号,统一刷新序号列 @author nokecy
|
|
375
|
+
if (stableColumnDefs.some(function (c) {
|
|
376
|
+
return (c === null || c === void 0 ? void 0 : c.field) === ARRAY_TABLE_INDEX_FIELD;
|
|
377
|
+
})) {
|
|
378
|
+
e.api.refreshCells({
|
|
379
|
+
columns: [ARRAY_TABLE_INDEX_FIELD]
|
|
380
|
+
});
|
|
381
|
+
}
|
|
368
382
|
if (isAdd) {
|
|
369
383
|
var _apiRef$current;
|
|
370
384
|
(_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || _apiRef$current.ensureIndexVisible(dataSource.length - 1, "bottom");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ColDef } from 'ag-grid-community';
|
|
2
|
+
/** 默认序号列的字段名;不对应任何数据字段,值由 valueGetter 按行位置生成 */
|
|
3
|
+
export declare const ARRAY_TABLE_INDEX_FIELD = "__arrayTableIndex";
|
|
4
|
+
/**
|
|
5
|
+
* 表格是否已经自己写了序号列(某个可见列里放了 ArrayTable.Index)。
|
|
6
|
+
* 写了就不再加默认序号列,免得出现两列序号;「行号」等业务数据列不算序号列。@author nokecy
|
|
7
|
+
*/
|
|
8
|
+
export declare const hasOwnIndexColumn: (sources: Array<{
|
|
9
|
+
schema: any;
|
|
10
|
+
display?: string;
|
|
11
|
+
}>) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 默认序号列:按行在表格里的位置编号(1 起),不依赖业务行号或主键,与列表页的序号一致。
|
|
14
|
+
* 固定在最左、不可隐藏/拖动/排序;合计等固定行不编号。
|
|
15
|
+
* 增删行、拖动换行后由 ArrayTable 在 onRowDataUpdated 里刷新本列,见 index.tsx。@author nokecy
|
|
16
|
+
*/
|
|
17
|
+
export declare const makeIndexColumn: () => ColDef;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** 默认序号列的字段名;不对应任何数据字段,值由 valueGetter 按行位置生成 */
|
|
2
|
+
export var ARRAY_TABLE_INDEX_FIELD = '__arrayTableIndex';
|
|
3
|
+
|
|
4
|
+
/** schema 里含 ArrayTable.Index / ArrayBase.Index 之类的序号组件 */
|
|
5
|
+
var containsIndexComponent = function containsIndexComponent(schema) {
|
|
6
|
+
var _schema$properties;
|
|
7
|
+
if (!schema) return false;
|
|
8
|
+
var component = schema['x-component'];
|
|
9
|
+
if (typeof component === 'string' && /(?:^|\.)Index$/.test(component)) return true;
|
|
10
|
+
return Object.values((_schema$properties = schema.properties) !== null && _schema$properties !== void 0 ? _schema$properties : {}).some(containsIndexComponent);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 表格是否已经自己写了序号列(某个可见列里放了 ArrayTable.Index)。
|
|
15
|
+
* 写了就不再加默认序号列,免得出现两列序号;「行号」等业务数据列不算序号列。@author nokecy
|
|
16
|
+
*/
|
|
17
|
+
export var hasOwnIndexColumn = function hasOwnIndexColumn(sources) {
|
|
18
|
+
return sources.some(function (_ref) {
|
|
19
|
+
var schema = _ref.schema,
|
|
20
|
+
display = _ref.display;
|
|
21
|
+
return (!display || display === 'visible') && containsIndexComponent(schema);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 默认序号列:按行在表格里的位置编号(1 起),不依赖业务行号或主键,与列表页的序号一致。
|
|
27
|
+
* 固定在最左、不可隐藏/拖动/排序;合计等固定行不编号。
|
|
28
|
+
* 增删行、拖动换行后由 ArrayTable 在 onRowDataUpdated 里刷新本列,见 index.tsx。@author nokecy
|
|
29
|
+
*/
|
|
30
|
+
export var makeIndexColumn = function makeIndexColumn() {
|
|
31
|
+
return {
|
|
32
|
+
field: ARRAY_TABLE_INDEX_FIELD,
|
|
33
|
+
headerName: '序号',
|
|
34
|
+
width: 60,
|
|
35
|
+
pinned: 'left',
|
|
36
|
+
lockPosition: 'left',
|
|
37
|
+
lockPinned: true,
|
|
38
|
+
lockVisible: true,
|
|
39
|
+
suppressMovable: true,
|
|
40
|
+
suppressColumnsToolPanel: true,
|
|
41
|
+
sortable: false,
|
|
42
|
+
filter: false,
|
|
43
|
+
resizable: false,
|
|
44
|
+
editable: false,
|
|
45
|
+
valueGetter: function valueGetter(params) {
|
|
46
|
+
var _params$node, _params$node2;
|
|
47
|
+
if ((_params$node = params.node) !== null && _params$node !== void 0 && _params$node.rowPinned) return '';
|
|
48
|
+
var rowIndex = (_params$node2 = params.node) === null || _params$node2 === void 0 ? void 0 : _params$node2.rowIndex;
|
|
49
|
+
return rowIndex == null ? '' : rowIndex + 1;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -5,6 +5,14 @@ export type ReadOnlyFormatterCtx = {
|
|
|
5
5
|
fieldSchema: any;
|
|
6
6
|
};
|
|
7
7
|
export type ReadOnlyFormatter = (value: any, ctx: ReadOnlyFormatterCtx) => string;
|
|
8
|
+
/**
|
|
9
|
+
* 兜底格式化器:注册表里没有的组件(业务自定义的选择器、输入框等),可编辑列按它出懒挂载文本。
|
|
10
|
+
*
|
|
11
|
+
* 显示与控件失焦时看到的一致:原始值原样显示;labelInValue 对象 / 解构字段({value,label})显示 label,
|
|
12
|
+
* 没有 label 才显示 value;数组逐个显示后逗号拼接。显示需要按编码查名称等特殊逻辑的组件,
|
|
13
|
+
* 消费方用 registerReadOnlyFormatter 注册专用格式化器覆盖。@author nokecy
|
|
14
|
+
*/
|
|
15
|
+
export declare const fallbackFormatter: ReadOnlyFormatter;
|
|
8
16
|
/** 消费方扩展自定义只读列的显示逻辑 */
|
|
9
17
|
export declare const registerReadOnlyFormatter: (component: string, formatter: ReadOnlyFormatter) => void;
|
|
10
18
|
/**
|
|
@@ -94,6 +94,28 @@ var registry = {
|
|
|
94
94
|
Checkbox: booleanFormatter
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* 兜底格式化器:注册表里没有的组件(业务自定义的选择器、输入框等),可编辑列按它出懒挂载文本。
|
|
99
|
+
*
|
|
100
|
+
* 显示与控件失焦时看到的一致:原始值原样显示;labelInValue 对象 / 解构字段({value,label})显示 label,
|
|
101
|
+
* 没有 label 才显示 value;数组逐个显示后逗号拼接。显示需要按编码查名称等特殊逻辑的组件,
|
|
102
|
+
* 消费方用 registerReadOnlyFormatter 注册专用格式化器覆盖。@author nokecy
|
|
103
|
+
*/
|
|
104
|
+
export var fallbackFormatter = function fallbackFormatter(value, ctx) {
|
|
105
|
+
if (value == null || value === '') return '';
|
|
106
|
+
if (Array.isArray(value)) return value.map(function (v) {
|
|
107
|
+
return fallbackFormatter(v, ctx);
|
|
108
|
+
}).filter(Boolean).join(', ');
|
|
109
|
+
if (typeof value === 'boolean') return booleanFormatter(value, ctx);
|
|
110
|
+
if (_typeof(value) === 'object') {
|
|
111
|
+
var _value$label2;
|
|
112
|
+
if (typeof value.format === 'function') return dateFormatter(value, ctx);
|
|
113
|
+
var shown = (_value$label2 = value.label) !== null && _value$label2 !== void 0 ? _value$label2 : value.value;
|
|
114
|
+
return shown == null ? '' : String(shown);
|
|
115
|
+
}
|
|
116
|
+
return String(value);
|
|
117
|
+
};
|
|
118
|
+
|
|
97
119
|
/** 消费方扩展自定义只读列的显示逻辑 */
|
|
98
120
|
export var registerReadOnlyFormatter = function registerReadOnlyFormatter(component, formatter) {
|
|
99
121
|
registry[component] = formatter;
|