@nokecy/qc-ui 1.1.59 → 1.1.61
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 +3 -1
- package/dist/cjs/ag-grid-plus/queryForm/index.js +7 -1
- package/dist/cjs/ag-grid-plus/queryForm/index.less +1 -1
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigForm.js +2 -1
- package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +1 -1
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.d.ts +5 -0
- package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +8 -3
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.d.ts +6 -0
- package/dist/cjs/ag-grid-plus/setting/columnGroupUtils.js +13 -0
- package/dist/cjs/ag-grid-plus/setting/index.js +7 -2
- package/dist/cjs/ag-grid-plus/settingItem/index.js +4 -1
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +4 -2
- package/dist/esm/ag-grid-plus/queryForm/index.js +8 -2
- package/dist/esm/ag-grid-plus/queryForm/index.less +1 -1
- package/dist/esm/ag-grid-plus/setting/ColumnConfigForm.js +2 -1
- package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +2 -2
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.d.ts +5 -0
- package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +8 -3
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.d.ts +6 -0
- package/dist/esm/ag-grid-plus/setting/columnGroupUtils.js +12 -0
- package/dist/esm/ag-grid-plus/setting/index.js +8 -3
- package/dist/esm/ag-grid-plus/settingItem/index.js +4 -1
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -87,6 +87,8 @@ function useDeepCompareStable(value) {
|
|
|
87
87
|
}
|
|
88
88
|
function AgGridPlus(props) {
|
|
89
89
|
var gridTheme = (0, _theme.useAgGridTheme)();
|
|
90
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
91
|
+
token = _theme$useToken.token; // 高级筛选入口跟随主题及客户主色。@author nokecy
|
|
90
92
|
var style = props.style,
|
|
91
93
|
loadingProps = props.loading,
|
|
92
94
|
gridParams = props.params,
|
|
@@ -1313,7 +1315,7 @@ function AgGridPlus(props) {
|
|
|
1313
1315
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1314
1316
|
style: {
|
|
1315
1317
|
margin: "0 4px",
|
|
1316
|
-
color: advancedQueryRules.children.length > 0 ?
|
|
1318
|
+
color: advancedQueryRules.children.length > 0 ? token.colorPrimary : token.colorText,
|
|
1317
1319
|
fontSize: 16,
|
|
1318
1320
|
cursor: "pointer"
|
|
1319
1321
|
}
|
|
@@ -36,6 +36,9 @@ var FormRender = function FormRender(props) {
|
|
|
36
36
|
onQuery = props.onQuery,
|
|
37
37
|
_props$defaultRows = props.defaultRows,
|
|
38
38
|
defaultRows = _props$defaultRows === void 0 ? 1 : _props$defaultRows;
|
|
39
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
40
|
+
token = _theme$useToken.token; // 筛选区跟随宿主主题。@author nokecy
|
|
41
|
+
|
|
39
42
|
var _useState = (0, _react2.useState)({
|
|
40
43
|
type: 'object',
|
|
41
44
|
properties: {}
|
|
@@ -220,7 +223,10 @@ var FormRender = function FormRender(props) {
|
|
|
220
223
|
return "".concat(c.field, "|").concat(c.headerName);
|
|
221
224
|
}).join('|')]);
|
|
222
225
|
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
223
|
-
className: (0, _classnames.default)(className, "ag-grid-table-search ag-grid-table-search-query-filter")
|
|
226
|
+
className: (0, _classnames.default)(className, "ag-grid-table-search ag-grid-table-search-query-filter"),
|
|
227
|
+
style: {
|
|
228
|
+
backgroundColor: token.colorBgContainer
|
|
229
|
+
}
|
|
224
230
|
}, /*#__PURE__*/_react2.default.createElement(_antdV.Form, {
|
|
225
231
|
form: form,
|
|
226
232
|
labelWidth: 100,
|
|
@@ -11,6 +11,7 @@ var _icons = require("@ant-design/icons");
|
|
|
11
11
|
var _antdV = require("@formily/antd-v5");
|
|
12
12
|
var _react2 = require("@formily/react");
|
|
13
13
|
var _arrayTable = _interopRequireDefault(require("../../array-table"));
|
|
14
|
+
var _columnGroupUtils = require("./columnGroupUtils");
|
|
14
15
|
var _NameColumnRenderer = _interopRequireDefault(require("./NameColumnRenderer"));
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -304,7 +305,7 @@ var ColumnConfigForm = function ColumnConfigForm(_ref) {
|
|
|
304
305
|
return /*#__PURE__*/_react.default.createElement("span", null, "-");
|
|
305
306
|
}
|
|
306
307
|
return /*#__PURE__*/_react.default.createElement(_antdV.Select, {
|
|
307
|
-
value: props.value
|
|
308
|
+
value: (0, _columnGroupUtils.normalizeCellAlign)(props.value),
|
|
308
309
|
onChange: props.onChange,
|
|
309
310
|
options: [{
|
|
310
311
|
value: 'custom-cell-left',
|
|
@@ -178,7 +178,7 @@ var AlignmentCellRenderer = function AlignmentCellRenderer(props) {
|
|
|
178
178
|
if (!item || item.type !== 'column') return /*#__PURE__*/_react.default.createElement("span", null, "-");
|
|
179
179
|
|
|
180
180
|
// 标准化 cellClass 值,默认为左对齐
|
|
181
|
-
var normalizedValue = item.cellClass
|
|
181
|
+
var normalizedValue = (0, _columnGroupUtils.normalizeCellAlign)(item.cellClass);
|
|
182
182
|
return /*#__PURE__*/_react.default.createElement(_antd.Select, {
|
|
183
183
|
value: normalizedValue,
|
|
184
184
|
onChange: function onChange(val) {
|
|
@@ -6,6 +6,11 @@ interface ColumnSettingProps {
|
|
|
6
6
|
visible: boolean;
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
onSaveColumnState: (state: any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 调用方自带的原始列定义(含 cellRenderer 等),优先于 Context。
|
|
11
|
+
* ArrayTable 不在 AgGridPlus 的 Context 里,不传会导致保存后重建出裸列、单元格空白。@author nokecy
|
|
12
|
+
*/
|
|
13
|
+
allColDefs?: any[];
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* 列方案管理组件 - 集成列配置和列方案管理
|
|
@@ -56,14 +56,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
56
56
|
gridApi = _ref.gridApi,
|
|
57
57
|
visible = _ref.visible,
|
|
58
58
|
onClose = _ref.onClose,
|
|
59
|
-
onSaveColumnState = _ref.onSaveColumnState
|
|
59
|
+
onSaveColumnState = _ref.onSaveColumnState,
|
|
60
|
+
allColDefsProp = _ref.allColDefs;
|
|
60
61
|
var gridTheme = (0, _theme.useAgGridTheme)();
|
|
61
62
|
// 使用新的集中式方案管理 API(包含状态数据和操作方法)
|
|
62
63
|
var _useGridSchemes = (0, _useSchemeManager.useGridSchemes)(),
|
|
63
64
|
columnSchemes = _useGridSchemes.columnSchemes,
|
|
64
65
|
currentSchemes = _useGridSchemes.currentSchemes,
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
contextAllColDefs = _useGridSchemes.allColDefs,
|
|
67
|
+
contextInitialColumnDefs = _useGridSchemes.initialColumnDefs,
|
|
67
68
|
saveColumnScheme = _useGridSchemes.saveColumnScheme,
|
|
68
69
|
deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
|
|
69
70
|
setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme,
|
|
@@ -73,6 +74,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
73
74
|
globalConfigPermissions = _useGridSchemes.globalConfigPermissions,
|
|
74
75
|
isUsingGlobalFallback = _useGridSchemes.isUsingGlobalFallback;
|
|
75
76
|
|
|
77
|
+
// 调用方传入的列定义优先:Context 里的属于外层 AgGridPlus 或为空 @author nokecy
|
|
78
|
+
var allColDefs = allColDefsProp !== null && allColDefsProp !== void 0 ? allColDefsProp : contextAllColDefs;
|
|
79
|
+
var initialColumnDefs = allColDefsProp !== null && allColDefsProp !== void 0 ? allColDefsProp : contextInitialColumnDefs;
|
|
80
|
+
|
|
76
81
|
// 解构权限信息
|
|
77
82
|
var canApplyToGlobal = (_globalConfigPermissi = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canApplyToGlobal) !== null && _globalConfigPermissi !== void 0 ? _globalConfigPermissi : false;
|
|
78
83
|
var canResetAllUsers = (_globalConfigPermissi2 = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canResetAllUsers) !== null && _globalConfigPermissi2 !== void 0 ? _globalConfigPermissi2 : false;
|
|
@@ -95,3 +95,9 @@ export declare function isOldSchemeData(data: any[]): boolean;
|
|
|
95
95
|
* @returns AG-Grid columnState 数组
|
|
96
96
|
*/
|
|
97
97
|
export declare function flatConfigToColumnState(flatConfig: FlatColumnItem[], originalColumnDefs?: (ColDef | ColGroupDef)[]): any[];
|
|
98
|
+
/**
|
|
99
|
+
* 把列上的 cellClass 归一为对齐下拉的三个选项值。
|
|
100
|
+
* 列定义里可能是 AG-Grid 数值类型自带的 ag-right-aligned-cell、ArrayTable 的 ag-cell-right 等,
|
|
101
|
+
* 下拉只认 custom-cell-*,不归一就会把原始类名直接显示出来。@author nokecy
|
|
102
|
+
*/
|
|
103
|
+
export declare function normalizeCellAlign(cellClass: unknown): 'custom-cell-left' | 'custom-cell-centered' | 'custom-cell-right';
|
|
@@ -13,6 +13,7 @@ exports.generateId = void 0;
|
|
|
13
13
|
exports.gridStateToFlatConfig = gridStateToFlatConfig;
|
|
14
14
|
exports.isOldSchemeData = isOldSchemeData;
|
|
15
15
|
exports.migrateOldScheme = migrateOldScheme;
|
|
16
|
+
exports.normalizeCellAlign = normalizeCellAlign;
|
|
16
17
|
exports.reorderItems = reorderItems;
|
|
17
18
|
var _lodash = require("lodash");
|
|
18
19
|
var _logger = require("../utils/logger");
|
|
@@ -629,4 +630,16 @@ function flatConfigToColumnState(flatConfig, originalColumnDefs) {
|
|
|
629
630
|
}
|
|
630
631
|
}
|
|
631
632
|
return result;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* 把列上的 cellClass 归一为对齐下拉的三个选项值。
|
|
637
|
+
* 列定义里可能是 AG-Grid 数值类型自带的 ag-right-aligned-cell、ArrayTable 的 ag-cell-right 等,
|
|
638
|
+
* 下拉只认 custom-cell-*,不归一就会把原始类名直接显示出来。@author nokecy
|
|
639
|
+
*/
|
|
640
|
+
function normalizeCellAlign(cellClass) {
|
|
641
|
+
var text = Array.isArray(cellClass) ? cellClass.join(' ') : typeof cellClass === 'string' ? cellClass : '';
|
|
642
|
+
if (/right/.test(text)) return 'custom-cell-right';
|
|
643
|
+
if (/cent/.test(text)) return 'custom-cell-centered';
|
|
644
|
+
return 'custom-cell-left';
|
|
632
645
|
}
|
|
@@ -26,9 +26,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
26
26
|
var Setting = function Setting(props) {
|
|
27
27
|
var gridKey = props.gridKey,
|
|
28
28
|
gridApi = props.gridApi,
|
|
29
|
+
allColDefs = props.allColDefs,
|
|
29
30
|
onSaveColumnState = props.onSaveColumnState,
|
|
30
31
|
_props$showQuerySchem = props.showQueryScheme,
|
|
31
32
|
showQueryScheme = _props$showQuerySchem === void 0 ? true : _props$showQuerySchem;
|
|
33
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
34
|
+
token = _theme$useToken.token; // 设置入口跟随宿主主题。@author nokecy
|
|
35
|
+
|
|
32
36
|
var _useState = (0, _react.useState)(false),
|
|
33
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
34
38
|
columnSettingVisible = _useState2[0],
|
|
@@ -64,7 +68,7 @@ var Setting = function Setting(props) {
|
|
|
64
68
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
65
69
|
style: {
|
|
66
70
|
margin: "0 4px",
|
|
67
|
-
color:
|
|
71
|
+
color: token.colorText,
|
|
68
72
|
fontSize: 16,
|
|
69
73
|
cursor: "pointer"
|
|
70
74
|
},
|
|
@@ -78,7 +82,8 @@ var Setting = function Setting(props) {
|
|
|
78
82
|
onClose: function onClose() {
|
|
79
83
|
return setColumnSettingVisible(false);
|
|
80
84
|
},
|
|
81
|
-
onSaveColumnState: onSaveColumnState || function () {}
|
|
85
|
+
onSaveColumnState: onSaveColumnState || function () {},
|
|
86
|
+
allColDefs: allColDefs
|
|
82
87
|
}), gridKey && showQueryScheme && /*#__PURE__*/_react.default.createElement(_QuerySchemeManager.default, {
|
|
83
88
|
gridKey: gridKey,
|
|
84
89
|
visible: querySchemeVisible,
|
|
@@ -4,15 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _antd = require("antd");
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
10
|
var SettingItem = function SettingItem(props) {
|
|
10
11
|
var onClick = props.onClick,
|
|
11
12
|
icon = props.icon;
|
|
13
|
+
var _theme$useToken = _antd.theme.useToken(),
|
|
14
|
+
token = _theme$useToken.token; // 工具入口跟随宿主主题。@author nokecy
|
|
12
15
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
13
16
|
style: {
|
|
14
17
|
margin: "0 4px",
|
|
15
|
-
color:
|
|
18
|
+
color: token.colorText,
|
|
16
19
|
fontSize: 16,
|
|
17
20
|
cursor: "pointer"
|
|
18
21
|
},
|
|
@@ -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, Typography, Popover, Badge, Button } from 'antd';
|
|
23
|
+
import { Spin, Pagination, Card, Tag, Typography, 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
|
|
|
@@ -79,6 +79,8 @@ function useDeepCompareStable(value) {
|
|
|
79
79
|
}
|
|
80
80
|
function AgGridPlus(props) {
|
|
81
81
|
var gridTheme = useAgGridTheme();
|
|
82
|
+
var _theme$useToken = theme.useToken(),
|
|
83
|
+
token = _theme$useToken.token; // 高级筛选入口跟随主题及客户主色。@author nokecy
|
|
82
84
|
var style = props.style,
|
|
83
85
|
loadingProps = props.loading,
|
|
84
86
|
gridParams = props.params,
|
|
@@ -1305,7 +1307,7 @@ function AgGridPlus(props) {
|
|
|
1305
1307
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1306
1308
|
style: {
|
|
1307
1309
|
margin: "0 4px",
|
|
1308
|
-
color: advancedQueryRules.children.length > 0 ?
|
|
1310
|
+
color: advancedQueryRules.children.length > 0 ? token.colorPrimary : token.colorText,
|
|
1309
1311
|
fontSize: 16,
|
|
1310
1312
|
cursor: "pointer"
|
|
1311
1313
|
}
|
|
@@ -14,7 +14,7 @@ import { DatePicker, FormButtonGroup, FormGrid, FormItem, Form, Input, Select, S
|
|
|
14
14
|
import { createForm } from '@formily/core';
|
|
15
15
|
import { onFieldInit } from '@formily/core';
|
|
16
16
|
import { createSchemaField } from '@formily/react';
|
|
17
|
-
import { Button } from 'antd';
|
|
17
|
+
import { Button, theme } from 'antd';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
20
20
|
import QueryForm from "./queryForm";
|
|
@@ -28,6 +28,9 @@ var FormRender = function FormRender(props) {
|
|
|
28
28
|
onQuery = props.onQuery,
|
|
29
29
|
_props$defaultRows = props.defaultRows,
|
|
30
30
|
defaultRows = _props$defaultRows === void 0 ? 1 : _props$defaultRows;
|
|
31
|
+
var _theme$useToken = theme.useToken(),
|
|
32
|
+
token = _theme$useToken.token; // 筛选区跟随宿主主题。@author nokecy
|
|
33
|
+
|
|
31
34
|
var _useState = useState({
|
|
32
35
|
type: 'object',
|
|
33
36
|
properties: {}
|
|
@@ -212,7 +215,10 @@ var FormRender = function FormRender(props) {
|
|
|
212
215
|
return "".concat(c.field, "|").concat(c.headerName);
|
|
213
216
|
}).join('|')]);
|
|
214
217
|
return /*#__PURE__*/React.createElement("div", {
|
|
215
|
-
className: classNames(className, "ag-grid-table-search ag-grid-table-search-query-filter")
|
|
218
|
+
className: classNames(className, "ag-grid-table-search ag-grid-table-search-query-filter"),
|
|
219
|
+
style: {
|
|
220
|
+
backgroundColor: token.colorBgContainer
|
|
221
|
+
}
|
|
216
222
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
217
223
|
form: form,
|
|
218
224
|
labelWidth: 100,
|
|
@@ -10,6 +10,7 @@ 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';
|
|
12
12
|
import ArrayTable from "../../array-table";
|
|
13
|
+
import { normalizeCellAlign } from "./columnGroupUtils";
|
|
13
14
|
import NameColumnRenderer from "./NameColumnRenderer";
|
|
14
15
|
var SchemaField = createSchemaField({
|
|
15
16
|
components: {
|
|
@@ -294,7 +295,7 @@ var ColumnConfigForm = function ColumnConfigForm(_ref) {
|
|
|
294
295
|
return /*#__PURE__*/React.createElement("span", null, "-");
|
|
295
296
|
}
|
|
296
297
|
return /*#__PURE__*/React.createElement(Select, {
|
|
297
|
-
value: props.value
|
|
298
|
+
value: normalizeCellAlign(props.value),
|
|
298
299
|
onChange: props.onChange,
|
|
299
300
|
options: [{
|
|
300
301
|
value: 'custom-cell-left',
|
|
@@ -23,7 +23,7 @@ import React, { useCallback, useMemo, useState, useRef, useEffect } from 'react'
|
|
|
23
23
|
import { Button, Select, Switch, Space, Popconfirm, message, Tag } from 'antd';
|
|
24
24
|
import { DeleteOutlined, FolderOutlined, FolderAddOutlined, FileOutlined } from '@ant-design/icons';
|
|
25
25
|
import { AgGridReact } from 'ag-grid-react';
|
|
26
|
-
import { generateId } from "./columnGroupUtils";
|
|
26
|
+
import { generateId, normalizeCellAlign } from "./columnGroupUtils";
|
|
27
27
|
import { DebounceNumberInput } from "./DebounceInputs";
|
|
28
28
|
import { useAgGridTheme } from "../theme";
|
|
29
29
|
import { ColumnNameCellRenderer } from "./ColumnNameCellRenderer";
|
|
@@ -172,7 +172,7 @@ var AlignmentCellRenderer = function AlignmentCellRenderer(props) {
|
|
|
172
172
|
if (!item || item.type !== 'column') return /*#__PURE__*/React.createElement("span", null, "-");
|
|
173
173
|
|
|
174
174
|
// 标准化 cellClass 值,默认为左对齐
|
|
175
|
-
var normalizedValue = item.cellClass
|
|
175
|
+
var normalizedValue = normalizeCellAlign(item.cellClass);
|
|
176
176
|
return /*#__PURE__*/React.createElement(Select, {
|
|
177
177
|
value: normalizedValue,
|
|
178
178
|
onChange: function onChange(val) {
|
|
@@ -6,6 +6,11 @@ interface ColumnSettingProps {
|
|
|
6
6
|
visible: boolean;
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
onSaveColumnState: (state: any) => void;
|
|
9
|
+
/**
|
|
10
|
+
* 调用方自带的原始列定义(含 cellRenderer 等),优先于 Context。
|
|
11
|
+
* ArrayTable 不在 AgGridPlus 的 Context 里,不传会导致保存后重建出裸列、单元格空白。@author nokecy
|
|
12
|
+
*/
|
|
13
|
+
allColDefs?: any[];
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* 列方案管理组件 - 集成列配置和列方案管理
|
|
@@ -49,14 +49,15 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
49
49
|
gridApi = _ref.gridApi,
|
|
50
50
|
visible = _ref.visible,
|
|
51
51
|
onClose = _ref.onClose,
|
|
52
|
-
onSaveColumnState = _ref.onSaveColumnState
|
|
52
|
+
onSaveColumnState = _ref.onSaveColumnState,
|
|
53
|
+
allColDefsProp = _ref.allColDefs;
|
|
53
54
|
var gridTheme = useAgGridTheme();
|
|
54
55
|
// 使用新的集中式方案管理 API(包含状态数据和操作方法)
|
|
55
56
|
var _useGridSchemes = useGridSchemes(),
|
|
56
57
|
columnSchemes = _useGridSchemes.columnSchemes,
|
|
57
58
|
currentSchemes = _useGridSchemes.currentSchemes,
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
contextAllColDefs = _useGridSchemes.allColDefs,
|
|
60
|
+
contextInitialColumnDefs = _useGridSchemes.initialColumnDefs,
|
|
60
61
|
saveColumnScheme = _useGridSchemes.saveColumnScheme,
|
|
61
62
|
deleteColumnScheme = _useGridSchemes.deleteColumnScheme,
|
|
62
63
|
setCurrentColumnScheme = _useGridSchemes.setCurrentColumnScheme,
|
|
@@ -66,6 +67,10 @@ var ColumnSetting = function ColumnSetting(_ref) {
|
|
|
66
67
|
globalConfigPermissions = _useGridSchemes.globalConfigPermissions,
|
|
67
68
|
isUsingGlobalFallback = _useGridSchemes.isUsingGlobalFallback;
|
|
68
69
|
|
|
70
|
+
// 调用方传入的列定义优先:Context 里的属于外层 AgGridPlus 或为空 @author nokecy
|
|
71
|
+
var allColDefs = allColDefsProp !== null && allColDefsProp !== void 0 ? allColDefsProp : contextAllColDefs;
|
|
72
|
+
var initialColumnDefs = allColDefsProp !== null && allColDefsProp !== void 0 ? allColDefsProp : contextInitialColumnDefs;
|
|
73
|
+
|
|
69
74
|
// 解构权限信息
|
|
70
75
|
var canApplyToGlobal = (_globalConfigPermissi = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canApplyToGlobal) !== null && _globalConfigPermissi !== void 0 ? _globalConfigPermissi : false;
|
|
71
76
|
var canResetAllUsers = (_globalConfigPermissi2 = globalConfigPermissions === null || globalConfigPermissions === void 0 ? void 0 : globalConfigPermissions.canResetAllUsers) !== null && _globalConfigPermissi2 !== void 0 ? _globalConfigPermissi2 : false;
|
|
@@ -95,3 +95,9 @@ export declare function isOldSchemeData(data: any[]): boolean;
|
|
|
95
95
|
* @returns AG-Grid columnState 数组
|
|
96
96
|
*/
|
|
97
97
|
export declare function flatConfigToColumnState(flatConfig: FlatColumnItem[], originalColumnDefs?: (ColDef | ColGroupDef)[]): any[];
|
|
98
|
+
/**
|
|
99
|
+
* 把列上的 cellClass 归一为对齐下拉的三个选项值。
|
|
100
|
+
* 列定义里可能是 AG-Grid 数值类型自带的 ag-right-aligned-cell、ArrayTable 的 ag-cell-right 等,
|
|
101
|
+
* 下拉只认 custom-cell-*,不归一就会把原始类名直接显示出来。@author nokecy
|
|
102
|
+
*/
|
|
103
|
+
export declare function normalizeCellAlign(cellClass: unknown): 'custom-cell-left' | 'custom-cell-centered' | 'custom-cell-right';
|
|
@@ -615,4 +615,16 @@ export function flatConfigToColumnState(flatConfig, originalColumnDefs) {
|
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
return result;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* 把列上的 cellClass 归一为对齐下拉的三个选项值。
|
|
622
|
+
* 列定义里可能是 AG-Grid 数值类型自带的 ag-right-aligned-cell、ArrayTable 的 ag-cell-right 等,
|
|
623
|
+
* 下拉只认 custom-cell-*,不归一就会把原始类名直接显示出来。@author nokecy
|
|
624
|
+
*/
|
|
625
|
+
export function normalizeCellAlign(cellClass) {
|
|
626
|
+
var text = Array.isArray(cellClass) ? cellClass.join(' ') : typeof cellClass === 'string' ? cellClass : '';
|
|
627
|
+
if (/right/.test(text)) return 'custom-cell-right';
|
|
628
|
+
if (/cent/.test(text)) return 'custom-cell-centered';
|
|
629
|
+
return 'custom-cell-left';
|
|
618
630
|
}
|
|
@@ -10,15 +10,19 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { SettingOutlined } from '@ant-design/icons';
|
|
12
12
|
import React, { useState } from "react";
|
|
13
|
-
import { Dropdown } from 'antd';
|
|
13
|
+
import { Dropdown, theme } from 'antd';
|
|
14
14
|
import ColumnSetting from "./ColumnSetting";
|
|
15
15
|
import QuerySchemeManager from "./QuerySchemeManager";
|
|
16
16
|
var Setting = function Setting(props) {
|
|
17
17
|
var gridKey = props.gridKey,
|
|
18
18
|
gridApi = props.gridApi,
|
|
19
|
+
allColDefs = props.allColDefs,
|
|
19
20
|
onSaveColumnState = props.onSaveColumnState,
|
|
20
21
|
_props$showQuerySchem = props.showQueryScheme,
|
|
21
22
|
showQueryScheme = _props$showQuerySchem === void 0 ? true : _props$showQuerySchem;
|
|
23
|
+
var _theme$useToken = theme.useToken(),
|
|
24
|
+
token = _theme$useToken.token; // 设置入口跟随宿主主题。@author nokecy
|
|
25
|
+
|
|
22
26
|
var _useState = useState(false),
|
|
23
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
28
|
columnSettingVisible = _useState2[0],
|
|
@@ -54,7 +58,7 @@ var Setting = function Setting(props) {
|
|
|
54
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
59
|
style: {
|
|
56
60
|
margin: "0 4px",
|
|
57
|
-
color:
|
|
61
|
+
color: token.colorText,
|
|
58
62
|
fontSize: 16,
|
|
59
63
|
cursor: "pointer"
|
|
60
64
|
},
|
|
@@ -68,7 +72,8 @@ var Setting = function Setting(props) {
|
|
|
68
72
|
onClose: function onClose() {
|
|
69
73
|
return setColumnSettingVisible(false);
|
|
70
74
|
},
|
|
71
|
-
onSaveColumnState: onSaveColumnState || function () {}
|
|
75
|
+
onSaveColumnState: onSaveColumnState || function () {},
|
|
76
|
+
allColDefs: allColDefs
|
|
72
77
|
}), gridKey && showQueryScheme && /*#__PURE__*/React.createElement(QuerySchemeManager, {
|
|
73
78
|
gridKey: gridKey,
|
|
74
79
|
visible: querySchemeVisible,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { theme } from 'antd';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
var SettingItem = function SettingItem(props) {
|
|
3
4
|
var onClick = props.onClick,
|
|
4
5
|
icon = props.icon;
|
|
6
|
+
var _theme$useToken = theme.useToken(),
|
|
7
|
+
token = _theme$useToken.token; // 工具入口跟随宿主主题。@author nokecy
|
|
5
8
|
return /*#__PURE__*/React.createElement("div", {
|
|
6
9
|
style: {
|
|
7
10
|
margin: "0 4px",
|
|
8
|
-
color:
|
|
11
|
+
color: token.colorText,
|
|
9
12
|
fontSize: 16,
|
|
10
13
|
cursor: "pointer"
|
|
11
14
|
},
|