@nokecy/qc-ui 1.1.55 → 1.1.57

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 (31) hide show
  1. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +2 -1
  2. package/dist/cjs/ag-grid-plus/index.less +4 -4
  3. package/dist/cjs/ag-grid-plus/queryForm/index.js +2 -1
  4. package/dist/cjs/ag-grid-plus/setting/ColumnConfigTable.js +2 -1
  5. package/dist/cjs/ag-grid-plus/setting/ColumnSetting.js +2 -1
  6. package/dist/cjs/ag-grid-plus/setting/QuerySchemeManager.js +3 -2
  7. package/dist/cjs/ag-grid-plus/theme.d.ts +5 -0
  8. package/dist/cjs/ag-grid-plus/theme.js +33 -1
  9. package/dist/cjs/ag-grid-plus/toolBar/index.js +2 -6
  10. package/dist/cjs/ag-grid-plus/toolBar/style.js +28 -5
  11. package/dist/cjs/array-table/index.js +2 -1
  12. package/dist/cjs/array-table/preview.js +2 -1
  13. package/dist/cjs/array-table/theme.d.ts +2 -10
  14. package/dist/cjs/array-table/theme.js +18 -18
  15. package/dist/esm/ag-grid-plus/ag-gridPlus.js +3 -2
  16. package/dist/esm/ag-grid-plus/index.less +4 -4
  17. package/dist/esm/ag-grid-plus/queryForm/index.js +2 -1
  18. package/dist/esm/ag-grid-plus/setting/ColumnConfigTable.js +3 -2
  19. package/dist/esm/ag-grid-plus/setting/ColumnSetting.js +3 -2
  20. package/dist/esm/ag-grid-plus/setting/QuerySchemeManager.js +4 -3
  21. package/dist/esm/ag-grid-plus/theme.d.ts +5 -0
  22. package/dist/esm/ag-grid-plus/theme.js +32 -1
  23. package/dist/esm/ag-grid-plus/toolBar/index.js +2 -6
  24. package/dist/esm/ag-grid-plus/toolBar/style.js +28 -5
  25. package/dist/esm/array-table/index.js +2 -1
  26. package/dist/esm/array-table/preview.js +2 -1
  27. package/dist/esm/array-table/theme.d.ts +2 -10
  28. package/dist/esm/array-table/theme.js +17 -18
  29. package/dist/umd/qc-ui.min.css +1 -1
  30. package/dist/umd/qc-ui.min.js +1 -1
  31. package/package.json +1 -1
@@ -86,6 +86,7 @@ function useDeepCompareStable(value) {
86
86
  return ref.current;
87
87
  }
88
88
  function AgGridPlus(props) {
89
+ var gridTheme = (0, _theme.useAgGridTheme)();
89
90
  var style = props.style,
90
91
  loadingProps = props.loading,
91
92
  gridParams = props.params,
@@ -1320,7 +1321,7 @@ function AgGridPlus(props) {
1320
1321
  }
1321
1322
  }, /*#__PURE__*/_react.default.createElement(_icons.FilterOutlined, null)))) : null].filter(Boolean)
1322
1323
  }), /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, _extends({
1323
- theme: _theme.agGridTheme
1324
+ theme: gridTheme
1324
1325
  }, rest, {
1325
1326
  localeText: _locale.localeText,
1326
1327
  gridOptions: {
@@ -28,12 +28,12 @@
28
28
  }
29
29
 
30
30
  .ag-root-wrapper-body .ag-center-cols-viewport .ag-center-cols-container .ag-checkbox .ag-checkbox-input-wrapper {
31
- width: 18px !important;
32
- height: 18px !important;
31
+ width: 16px !important;
32
+ height: 16px !important;
33
33
  }
34
34
  .ag-root-wrapper-body .ag-header-viewport .ag-checkbox .ag-checkbox-input-wrapper {
35
- width: 18px !important;
36
- height: 18px !important;
35
+ width: 16px !important;
36
+ height: 16px !important;
37
37
  }
38
38
 
39
39
  // 列内容对齐方式样式
@@ -27,7 +27,7 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
27
27
  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); }
28
28
  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; }
29
29
  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; } }
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // @author nokecy
31
31
  var FormRender = function FormRender(props) {
32
32
  var className = props.className,
33
33
  gridApi = props.gridApi,
@@ -67,6 +67,7 @@ var FormRender = function FormRender(props) {
67
67
  components: {
68
68
  QueryForm: _queryForm.default,
69
69
  Input: _antdV.Input,
70
+ Select: _antdV.Select,
70
71
  DatePicker: _antdV.DatePicker,
71
72
  FormItem: _antdV.FormItem,
72
73
  FormGrid: _antdV.FormGrid,
@@ -244,6 +244,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
244
244
  simple = _ref2$simple === void 0 ? false : _ref2$simple,
245
245
  _ref2$scrollY = _ref2.scrollY,
246
246
  scrollY = _ref2$scrollY === void 0 ? 480 : _ref2$scrollY;
247
+ var gridTheme = (0, _theme.useAgGridTheme)();
247
248
  var _useState = (0, _react.useState)(items),
248
249
  _useState2 = _slicedToArray(_useState, 2),
249
250
  localItems = _useState2[0],
@@ -712,7 +713,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
712
713
  height: scrollY
713
714
  }
714
715
  }, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
715
- theme: _theme.agGridTheme,
716
+ theme: gridTheme,
716
717
  rowData: visibleItems,
717
718
  columnDefs: columnDefs,
718
719
  getRowId: function getRowId(params) {
@@ -57,6 +57,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
57
57
  visible = _ref.visible,
58
58
  onClose = _ref.onClose,
59
59
  onSaveColumnState = _ref.onSaveColumnState;
60
+ var gridTheme = (0, _theme.useAgGridTheme)();
60
61
  // 使用新的集中式方案管理 API(包含状态数据和操作方法)
61
62
  var _useGridSchemes = (0, _useSchemeManager.useGridSchemes)(),
62
63
  columnSchemes = _useGridSchemes.columnSchemes,
@@ -1254,7 +1255,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
1254
1255
  marginTop: 100
1255
1256
  }
1256
1257
  }) : /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
1257
- theme: _theme.agGridTheme,
1258
+ theme: gridTheme,
1258
1259
  localeText: _locale.localeText,
1259
1260
  rowData: filteredSchemes,
1260
1261
  columnDefs: schemeColumnDefs,
@@ -58,6 +58,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
58
58
  var gridKey = _ref.gridKey,
59
59
  visible = _ref.visible,
60
60
  onClose = _ref.onClose;
61
+ var gridTheme = (0, _theme.useAgGridTheme)();
61
62
  // 获取方案管理 API
62
63
  var _useGridSchemes = (0, _useSchemeManager.useGridSchemes)(),
63
64
  querySchemes = _useGridSchemes.querySchemes,
@@ -761,7 +762,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
761
762
  }
762
763
  }, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
763
764
  ref: queryGridRef,
764
- theme: _theme.agGridTheme,
765
+ theme: gridTheme,
765
766
  rowData: queryItemsData,
766
767
  columnDefs: queryColumnDefs,
767
768
  defaultColDef: {
@@ -809,7 +810,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
809
810
  }
810
811
  }, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
811
812
  ref: schemeGridRef,
812
- theme: _theme.agGridTheme,
813
+ theme: gridTheme,
813
814
  rowData: schemes,
814
815
  columnDefs: schemeColumnDefs,
815
816
  defaultColDef: {
@@ -3,3 +3,8 @@
3
3
  * 使用 themeQuartz API 替代 CSS 变量方式
4
4
  */
5
5
  export declare const agGridTheme: import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
6
+ /**
7
+ * 根据当前 Ant Design ConfigProvider 主题生成 AgGrid 主题色。
8
+ * 复选框、行选中和悬停等强调状态与 antd 主色同步。@author nokecy
9
+ */
10
+ export declare function useAgGridTheme(): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.agGridTheme = void 0;
7
+ exports.useAgGridTheme = useAgGridTheme;
7
8
  var _agGridCommunity = require("ag-grid-community");
9
+ var _antd = require("antd");
10
+ var _react = require("react");
8
11
  /**
9
12
  * AG-Grid v33 主题配置
10
13
  * 使用 themeQuartz API 替代 CSS 变量方式
@@ -75,4 +78,33 @@ var agGridTheme = exports.agGridTheme = _agGridCommunity.themeQuartz.withParams(
75
78
  // 侧边栏配置
76
79
  sideBarPanelWidth: 250,
77
80
  spacing: 6
78
- });
81
+ });
82
+
83
+ /**
84
+ * 根据当前 Ant Design ConfigProvider 主题生成 AgGrid 主题色。
85
+ * 复选框、行选中和悬停等强调状态与 antd 主色同步。@author nokecy
86
+ */
87
+ function useAgGridTheme() {
88
+ var _antdTheme$useToken = _antd.theme.useToken(),
89
+ token = _antdTheme$useToken.token;
90
+ return (0, _react.useMemo)(function () {
91
+ return agGridTheme.withParams({
92
+ accentColor: token.colorPrimary,
93
+ rowHoverColor: token.colorPrimaryBg,
94
+ selectedRowBackgroundColor: token.colorPrimaryBgHover,
95
+ columnHoverColor: token.colorPrimaryBg,
96
+ rangeSelectionBorderColor: token.colorPrimary,
97
+ rangeSelectionBackgroundColor: token.colorPrimaryBgHover,
98
+ focusShadow: "0 0 0 3px ".concat(token.colorPrimaryBg),
99
+ checkboxUncheckedBackgroundColor: token.colorBgContainer,
100
+ checkboxUncheckedBorderColor: token.colorBorder,
101
+ checkboxCheckedBackgroundColor: token.colorPrimary,
102
+ checkboxCheckedBorderColor: token.colorPrimary,
103
+ checkboxCheckedShapeColor: token.colorWhite,
104
+ checkboxIndeterminateBackgroundColor: token.colorPrimary,
105
+ checkboxIndeterminateBorderColor: token.colorPrimary,
106
+ checkboxIndeterminateShapeColor: token.colorWhite,
107
+ toggleButtonOnBackgroundColor: token.colorPrimary
108
+ });
109
+ }, [token.colorBgContainer, token.colorBorder, token.colorPrimary, token.colorPrimaryBg, token.colorPrimaryBgHover, token.colorWhite]);
110
+ }
@@ -84,11 +84,7 @@ var ListToolBar = function ListToolBar(_ref) {
84
84
  return null;
85
85
  }
86
86
  return /*#__PURE__*/_react.default.createElement("div", {
87
- style: {
88
- display: 'flex',
89
- alignItems: 'center',
90
- gap: 8
91
- }
87
+ className: "".concat(prefixCls, "-actions ").concat(hashId)
92
88
  }, actions.map(function (action, index) {
93
89
  if (! /*#__PURE__*/_react.default.isValidElement(action)) {
94
90
  // eslint-disable-next-line react/no-array-index-key
@@ -101,7 +97,7 @@ var ListToolBar = function ListToolBar(_ref) {
101
97
  key: index
102
98
  }, action === null || action === void 0 ? void 0 : action.props));
103
99
  }));
104
- }, [actions]);
100
+ }, [actions, hashId, prefixCls]);
105
101
  var hasRight = (0, _react.useMemo)(function () {
106
102
  return hasTitle || actionDom || (settings === null || settings === void 0 ? void 0 : settings.length);
107
103
  }, [actionDom, hasTitle, settings === null || settings === void 0 ? void 0 : settings.length]);
@@ -17,6 +17,8 @@ var genProListStyle = function genProListStyle(token) {
17
17
  "&-container": {
18
18
  display: "flex",
19
19
  justifyContent: "space-between",
20
+ alignItems: "center",
21
+ minWidth: 0,
20
22
  paddingBlock: 8,
21
23
  //token.padding,
22
24
  paddingInline: 0,
@@ -54,29 +56,47 @@ var genProListStyle = function genProListStyle(token) {
54
56
  },
55
57
  "&-left": _defineProperty(_defineProperty({
56
58
  display: "flex",
57
- flexWrap: "wrap",
59
+ flexWrap: "nowrap",
58
60
  alignItems: "center",
59
61
  gap: token.marginXS,
60
62
  justifyContent: "flex-start",
61
- maxWidth: "calc(100% - 200px)",
62
- flex: 1
63
+ minWidth: 0,
64
+ flex: "0 1 auto"
63
65
  }, "".concat(token.antCls, "-tabs"), {
64
66
  width: "100%"
65
67
  }), "&-has-tabs", {
66
68
  overflow: "hidden"
67
69
  }),
68
70
  "&-right": {
69
- flex: 1,
71
+ flex: "1 1 0",
72
+ minWidth: 0,
70
73
  display: "flex",
71
- flexWrap: "wrap",
74
+ flexWrap: "nowrap",
75
+ alignItems: "center",
72
76
  justifyContent: "flex-end",
73
77
  gap: token.marginXS
74
78
  },
79
+ // @author nokecy:按钮单行呈现,空间不足时只在操作区内滚动,不撑开页面。
80
+ "&-actions": {
81
+ display: "flex",
82
+ alignItems: "center",
83
+ gap: token.marginXS,
84
+ minWidth: 0,
85
+ flex: "0 1 auto",
86
+ overflowX: "auto",
87
+ overflowY: "hidden",
88
+ scrollbarWidth: "none",
89
+ whiteSpace: "nowrap",
90
+ "&::-webkit-scrollbar": {
91
+ display: "none"
92
+ }
93
+ },
75
94
  "&-extra-line": {
76
95
  marginBlockEnd: token.margin
77
96
  },
78
97
  "&-setting-items": {
79
98
  display: "flex",
99
+ flex: "0 0 auto",
80
100
  gap: token.marginXS,
81
101
  lineHeight: "32px",
82
102
  alignItems: "center"
@@ -127,6 +147,9 @@ var genProListStyle = function genProListStyle(token) {
127
147
  "&-left": {
128
148
  marginBlockEnd: "8px",
129
149
  maxWidth: "100%"
150
+ },
151
+ "&-right": {
152
+ width: "100%"
130
153
  }
131
154
  })));
132
155
  };
@@ -40,6 +40,7 @@ var ArrayTableInner = (0, _react2.observer)(function (props) {
40
40
  var _addition$props;
41
41
  var height = props.height,
42
42
  gridKey = props.gridKey;
43
+ var arrayTableTheme = (0, _theme.useArrayTableTheme)(true);
43
44
 
44
45
  // 【新增】运行时验证 gridKey
45
46
  if (!gridKey) {
@@ -330,7 +331,7 @@ var ArrayTableInner = (0, _react2.observer)(function (props) {
330
331
  minHeight: 0
331
332
  }
332
333
  }, /*#__PURE__*/_react.default.createElement(_agGridReact.AgGridReact, {
333
- theme: _theme.arrayTableTheme,
334
+ theme: arrayTableTheme,
334
335
  context: gridContext,
335
336
  onGridReady: function onGridReady(params) {
336
337
  params.api.hidePopupMenu();
@@ -13,6 +13,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
  //@ts-ignore
14
14
  var ArrayTable = function ArrayTable(props) {
15
15
  var height = props.height;
16
+ var arrayTablePreviewTheme = (0, _theme.useArrayTableTheme)();
16
17
  var field = (0, _react2.useField)();
17
18
  var dataSource = Array.isArray(field.value) ? field.value.slice() : [];
18
19
  var sources = (0, _utils.useArrayTableSources)();
@@ -32,7 +33,7 @@ var ArrayTable = function ArrayTable(props) {
32
33
  },
33
34
  hideTool: true,
34
35
  search: false,
35
- theme: _theme.arrayTablePreviewTheme,
36
+ theme: arrayTablePreviewTheme,
36
37
  rowHeight: _theme.ARRAY_TABLE_ROW_HEIGHT,
37
38
  pagination: false,
38
39
  columnDefs: columns,
@@ -4,13 +4,5 @@
4
4
  * 只设网格选项会让文字的行盒仍是主题默认行高(29.6-3=26.6px),顶在 37px 的格子上方(偏上约 4.5px)。
5
5
  */
6
6
  export declare const ARRAY_TABLE_ROW_HEIGHT = 38;
7
- /** 阅读态主题:共用主题 + 行高 + 单元格居中 */
8
- export declare const arrayTablePreviewTheme: import("ag-grid-community").Theme<import("ag-grid-community").CoreParams & import("ag-grid-community").ButtonStyleParams & import("ag-grid-community").CheckboxStyleParams & import("ag-grid-community").TabStyleParams & import("ag-grid-community").InputStyleParams & {}>;
9
- /**
10
- * 编辑态主题:在阅读态主题上去掉单元格聚焦/选区视觉(行内编辑更干净)。
11
- * focusShadow -> 聚焦光环
12
- * rangeSelectionBorder -> 单格点击形成的 1×1 选区蓝边
13
- * rangeSelectionBackground -> 选区淡蓝填充
14
- * 仅去视觉,不动焦点功能——键盘导航/点击进编辑仍依赖 cell focus。
15
- */
16
- export declare const arrayTableTheme: import("ag-grid-community").Theme<import("ag-grid-community").CoreParams & import("ag-grid-community").ButtonStyleParams & import("ag-grid-community").CheckboxStyleParams & import("ag-grid-community").TabStyleParams & import("ag-grid-community").InputStyleParams & {}>;
7
+ /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
8
+ export declare function useArrayTableTheme(editable?: boolean): import("ag-grid-community").Theme<import("ag-grid-community").CoreParams & import("ag-grid-community").ButtonStyleParams & import("ag-grid-community").CheckboxStyleParams & import("ag-grid-community").TabStyleParams & import("ag-grid-community").InputStyleParams & {}>;
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.arrayTableTheme = exports.arrayTablePreviewTheme = exports.ARRAY_TABLE_ROW_HEIGHT = void 0;
6
+ exports.ARRAY_TABLE_ROW_HEIGHT = void 0;
7
+ exports.useArrayTableTheme = useArrayTableTheme;
7
8
  var _agGridCommunity = require("ag-grid-community");
9
+ var _react = require("react");
8
10
  var _theme = require("../ag-grid-plus/theme");
9
11
  /**
10
12
  * ArrayTable(明细表格)的 AG-Grid 主题:编辑态(index.tsx)与阅读态(preview.tsx)共用。
@@ -31,20 +33,18 @@ var arrayTableCellFit = (0, _agGridCommunity.createPart)({
31
33
  css: "\n .ag-cell .ag-cell-wrapper { height: 100%; }\n .ag-cell .ant-formily-item { margin-bottom: 0; }\n .ag-cell .ant-formily-item-help { position: absolute; }\n "
32
34
  });
33
35
 
34
- /** 阅读态主题:共用主题 + 行高 + 单元格居中 */
35
- var arrayTablePreviewTheme = exports.arrayTablePreviewTheme = _theme.agGridTheme.withParams({
36
- rowHeight: ARRAY_TABLE_ROW_HEIGHT
37
- }).withPart(arrayTableCellFit);
38
-
39
- /**
40
- * 编辑态主题:在阅读态主题上去掉单元格聚焦/选区视觉(行内编辑更干净)。
41
- * focusShadow -> 聚焦光环
42
- * rangeSelectionBorder -> 单格点击形成的 1×1 选区蓝边
43
- * rangeSelectionBackground -> 选区淡蓝填充
44
- * 仅去视觉,不动焦点功能——键盘导航/点击进编辑仍依赖 cell focus。
45
- */
46
- var arrayTableTheme = exports.arrayTableTheme = arrayTablePreviewTheme.withParams({
47
- focusShadow: 'none',
48
- rangeSelectionBorderColor: 'transparent',
49
- rangeSelectionBackgroundColor: 'transparent'
50
- });
36
+ /** 根据当前 antd 主题生成编辑态或阅读态明细表格主题。@author nokecy */
37
+ function useArrayTableTheme() {
38
+ var editable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
39
+ var agGridTheme = (0, _theme.useAgGridTheme)();
40
+ return (0, _react.useMemo)(function () {
41
+ var previewTheme = agGridTheme.withParams({
42
+ rowHeight: ARRAY_TABLE_ROW_HEIGHT
43
+ }).withPart(arrayTableCellFit);
44
+ return editable ? previewTheme.withParams({
45
+ focusShadow: 'none',
46
+ rangeSelectionBorderColor: 'transparent',
47
+ rangeSelectionBackgroundColor: 'transparent'
48
+ }) : previewTheme;
49
+ }, [agGridTheme, editable]);
50
+ }
@@ -28,7 +28,7 @@ import { AllEnterpriseModule } from "ag-grid-enterprise";
28
28
  ModuleRegistry.registerModules([AllEnterpriseModule]);
29
29
 
30
30
  // 导入 AG-Grid v33 主题
31
- import { agGridTheme } from "./theme";
31
+ import { useAgGridTheme } from "./theme";
32
32
  import { useTypeInferenceRow } from "./hooks/useTypeInferenceRow";
33
33
  import "./index.less";
34
34
  import FormRender from "./queryForm";
@@ -78,6 +78,7 @@ function useDeepCompareStable(value) {
78
78
  return ref.current;
79
79
  }
80
80
  function AgGridPlus(props) {
81
+ var gridTheme = useAgGridTheme();
81
82
  var style = props.style,
82
83
  loadingProps = props.loading,
83
84
  gridParams = props.params,
@@ -1312,7 +1313,7 @@ function AgGridPlus(props) {
1312
1313
  }
1313
1314
  }, /*#__PURE__*/React.createElement(FilterOutlined, null)))) : null].filter(Boolean)
1314
1315
  }), /*#__PURE__*/React.createElement(AgGridReact, _extends({
1315
- theme: agGridTheme
1316
+ theme: gridTheme
1316
1317
  }, rest, {
1317
1318
  localeText: localeText,
1318
1319
  gridOptions: {
@@ -28,12 +28,12 @@
28
28
  }
29
29
 
30
30
  .ag-root-wrapper-body .ag-center-cols-viewport .ag-center-cols-container .ag-checkbox .ag-checkbox-input-wrapper {
31
- width: 18px !important;
32
- height: 18px !important;
31
+ width: 16px !important;
32
+ height: 16px !important;
33
33
  }
34
34
  .ag-root-wrapper-body .ag-header-viewport .ag-checkbox .ag-checkbox-input-wrapper {
35
- width: 18px !important;
36
- height: 18px !important;
35
+ width: 16px !important;
36
+ height: 16px !important;
37
37
  }
38
38
 
39
39
  // 列内容对齐方式样式
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { DatePicker, FormButtonGroup, FormGrid, FormItem, Form, Input, Submit } from '@formily/antd-v5';
13
+ import { DatePicker, FormButtonGroup, FormGrid, FormItem, Form, Input, Select, Submit } from '@formily/antd-v5'; // @author nokecy
14
14
  import { createForm } from '@formily/core';
15
15
  import { onFieldInit } from '@formily/core';
16
16
  import { createSchemaField } from '@formily/react';
@@ -59,6 +59,7 @@ var FormRender = function FormRender(props) {
59
59
  components: {
60
60
  QueryForm: QueryForm,
61
61
  Input: Input,
62
+ Select: Select,
62
63
  DatePicker: DatePicker,
63
64
  FormItem: FormItem,
64
65
  FormGrid: FormGrid,
@@ -25,7 +25,7 @@ import { DeleteOutlined, FolderOutlined, FolderAddOutlined, FileOutlined } from
25
25
  import { AgGridReact } from 'ag-grid-react';
26
26
  import { generateId } from "./columnGroupUtils";
27
27
  import { DebounceNumberInput } from "./DebounceInputs";
28
- import { agGridTheme } from "../theme";
28
+ import { useAgGridTheme } from "../theme";
29
29
  import { ColumnNameCellRenderer } from "./ColumnNameCellRenderer";
30
30
  // ==================== Cell Renderers ====================
31
31
 
@@ -238,6 +238,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
238
238
  simple = _ref2$simple === void 0 ? false : _ref2$simple,
239
239
  _ref2$scrollY = _ref2.scrollY,
240
240
  scrollY = _ref2$scrollY === void 0 ? 480 : _ref2$scrollY;
241
+ var gridTheme = useAgGridTheme();
241
242
  var _useState = useState(items),
242
243
  _useState2 = _slicedToArray(_useState, 2),
243
244
  localItems = _useState2[0],
@@ -706,7 +707,7 @@ var ColumnConfigTable = function ColumnConfigTable(_ref2) {
706
707
  height: scrollY
707
708
  }
708
709
  }, /*#__PURE__*/React.createElement(AgGridReact, {
709
- theme: agGridTheme,
710
+ theme: gridTheme,
710
711
  rowData: visibleItems,
711
712
  columnDefs: columnDefs,
712
713
  getRowId: function getRowId(params) {
@@ -30,7 +30,7 @@ import { SaveOutlined, ReloadOutlined, EditOutlined, DeleteOutlined, StarOutline
30
30
  // 全局配置相关图标
31
31
  GlobalOutlined, RollbackOutlined, ClearOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
32
32
  import { AgGridReact } from 'ag-grid-react';
33
- import { agGridTheme } from "../theme";
33
+ import { useAgGridTheme } from "../theme";
34
34
  import { localeText } from "../locale";
35
35
  import { createForm, onFormInit } from '@formily/core';
36
36
  import { gridStateToFlatConfig, flatConfigToGridState, flatConfigToColumnState, dropQueryOnlyItems, excludeQueryOnlyColumns, isOldSchemeData, migrateOldScheme, generateId } from "./columnGroupUtils";
@@ -50,6 +50,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
50
50
  visible = _ref.visible,
51
51
  onClose = _ref.onClose,
52
52
  onSaveColumnState = _ref.onSaveColumnState;
53
+ var gridTheme = useAgGridTheme();
53
54
  // 使用新的集中式方案管理 API(包含状态数据和操作方法)
54
55
  var _useGridSchemes = useGridSchemes(),
55
56
  columnSchemes = _useGridSchemes.columnSchemes,
@@ -1247,7 +1248,7 @@ var ColumnSetting = function ColumnSetting(_ref) {
1247
1248
  marginTop: 100
1248
1249
  }
1249
1250
  }) : /*#__PURE__*/React.createElement(AgGridReact, {
1250
- theme: agGridTheme,
1251
+ theme: gridTheme,
1251
1252
  localeText: localeText,
1252
1253
  rowData: filteredSchemes,
1253
1254
  columnDefs: schemeColumnDefs,
@@ -33,7 +33,7 @@ import { useGridSchemes } from "../context/useSchemeManager";
33
33
  import { useQueryForm } from "../context/queryFormContext";
34
34
  import { v4 as uuidv4 } from 'uuid';
35
35
  import { extractItemsOrder, extractHiddenFields, buildQueryConfig } from "../shared/utils/schemeDataMigration";
36
- import { agGridTheme } from "../theme";
36
+ import { useAgGridTheme } from "../theme";
37
37
 
38
38
  /**
39
39
  * 查询项数据结构
@@ -50,6 +50,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
50
50
  var gridKey = _ref.gridKey,
51
51
  visible = _ref.visible,
52
52
  onClose = _ref.onClose;
53
+ var gridTheme = useAgGridTheme();
53
54
  // 获取方案管理 API
54
55
  var _useGridSchemes = useGridSchemes(),
55
56
  querySchemes = _useGridSchemes.querySchemes,
@@ -753,7 +754,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
753
754
  }
754
755
  }, /*#__PURE__*/React.createElement(AgGridReact, {
755
756
  ref: queryGridRef,
756
- theme: agGridTheme,
757
+ theme: gridTheme,
757
758
  rowData: queryItemsData,
758
759
  columnDefs: queryColumnDefs,
759
760
  defaultColDef: {
@@ -801,7 +802,7 @@ var QuerySchemeManager = function QuerySchemeManager(_ref) {
801
802
  }
802
803
  }, /*#__PURE__*/React.createElement(AgGridReact, {
803
804
  ref: schemeGridRef,
804
- theme: agGridTheme,
805
+ theme: gridTheme,
805
806
  rowData: schemes,
806
807
  columnDefs: schemeColumnDefs,
807
808
  defaultColDef: {
@@ -3,3 +3,8 @@
3
3
  * 使用 themeQuartz API 替代 CSS 变量方式
4
4
  */
5
5
  export declare const agGridTheme: import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
6
+ /**
7
+ * 根据当前 Ant Design ConfigProvider 主题生成 AgGrid 主题色。
8
+ * 复选框、行选中和悬停等强调状态与 antd 主色同步。@author nokecy
9
+ */
10
+ export declare function useAgGridTheme(): import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
@@ -4,6 +4,8 @@
4
4
  */
5
5
 
6
6
  import { themeQuartz } from 'ag-grid-community';
7
+ import { theme as antdTheme } from 'antd';
8
+ import { useMemo } from 'react';
7
9
  export var agGridTheme = themeQuartz.withParams({
8
10
  // 基础颜色
9
11
  backgroundColor: '#FFFFFF',
@@ -69,4 +71,33 @@ export var agGridTheme = themeQuartz.withParams({
69
71
  // 侧边栏配置
70
72
  sideBarPanelWidth: 250,
71
73
  spacing: 6
72
- });
74
+ });
75
+
76
+ /**
77
+ * 根据当前 Ant Design ConfigProvider 主题生成 AgGrid 主题色。
78
+ * 复选框、行选中和悬停等强调状态与 antd 主色同步。@author nokecy
79
+ */
80
+ export function useAgGridTheme() {
81
+ var _antdTheme$useToken = antdTheme.useToken(),
82
+ token = _antdTheme$useToken.token;
83
+ return useMemo(function () {
84
+ return agGridTheme.withParams({
85
+ accentColor: token.colorPrimary,
86
+ rowHoverColor: token.colorPrimaryBg,
87
+ selectedRowBackgroundColor: token.colorPrimaryBgHover,
88
+ columnHoverColor: token.colorPrimaryBg,
89
+ rangeSelectionBorderColor: token.colorPrimary,
90
+ rangeSelectionBackgroundColor: token.colorPrimaryBgHover,
91
+ focusShadow: "0 0 0 3px ".concat(token.colorPrimaryBg),
92
+ checkboxUncheckedBackgroundColor: token.colorBgContainer,
93
+ checkboxUncheckedBorderColor: token.colorBorder,
94
+ checkboxCheckedBackgroundColor: token.colorPrimary,
95
+ checkboxCheckedBorderColor: token.colorPrimary,
96
+ checkboxCheckedShapeColor: token.colorWhite,
97
+ checkboxIndeterminateBackgroundColor: token.colorPrimary,
98
+ checkboxIndeterminateBorderColor: token.colorPrimary,
99
+ checkboxIndeterminateShapeColor: token.colorWhite,
100
+ toggleButtonOnBackgroundColor: token.colorPrimary
101
+ });
102
+ }, [token.colorBgContainer, token.colorBorder, token.colorPrimary, token.colorPrimaryBg, token.colorPrimaryBgHover, token.colorWhite]);
103
+ }
@@ -75,11 +75,7 @@ var ListToolBar = function ListToolBar(_ref) {
75
75
  return null;
76
76
  }
77
77
  return /*#__PURE__*/React.createElement("div", {
78
- style: {
79
- display: 'flex',
80
- alignItems: 'center',
81
- gap: 8
82
- }
78
+ className: "".concat(prefixCls, "-actions ").concat(hashId)
83
79
  }, actions.map(function (action, index) {
84
80
  if (! /*#__PURE__*/React.isValidElement(action)) {
85
81
  // eslint-disable-next-line react/no-array-index-key
@@ -92,7 +88,7 @@ var ListToolBar = function ListToolBar(_ref) {
92
88
  key: index
93
89
  }, action === null || action === void 0 ? void 0 : action.props));
94
90
  }));
95
- }, [actions]);
91
+ }, [actions, hashId, prefixCls]);
96
92
  var hasRight = useMemo(function () {
97
93
  return hasTitle || actionDom || (settings === null || settings === void 0 ? void 0 : settings.length);
98
94
  }, [actionDom, hasTitle, settings === null || settings === void 0 ? void 0 : settings.length]);