@nokecy/qc-ui 0.6.2 → 0.6.3

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.
@@ -4,9 +4,6 @@
4
4
  * See installation docs at https://www.ag-grid.com/javascript-data-grid/applying-theme-builder-styling-grid/
5
5
  */
6
6
 
7
- @import url('https://fonts.googleapis.com/css2?family=IBM%20Plex%20Sans:wght@400&display=swap');
8
-
9
-
10
7
  .ag-root-wrapper, .ag-measurement-container, .ag-apply-theme-variables {
11
8
  --ag-background-color: var(--ag-inherited-background-color, #FFF);
12
9
  --ag-foreground-color: var(--ag-inherited-foreground-color, #181d1f);
@@ -25,7 +22,7 @@
25
22
  --ag-pinned-column-border: var(--ag-inherited-pinned-column-border, solid 1px var(--ag-border-color));
26
23
  --ag-pinned-row-border: var(--ag-inherited-pinned-row-border, solid 1px var(--ag-border-color));
27
24
  --ag-side-panel-border: var(--ag-inherited-side-panel-border, solid 1px var(--ag-border-color));
28
- --ag-font-family: var(--ag-inherited-font-family, 'IBM Plex Sans');
25
+ --ag-font-family: var(--ag-inherited-font-family, "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol','Noto Color Emoji'");
29
26
  --ag-chrome-background-color: var(--ag-inherited-chrome-background-color, color-mix(in srgb, transparent, var(--ag-foreground-color) 2%));
30
27
  --ag-header-background-color: var(--ag-inherited-header-background-color, var(--ag-chrome-background-color));
31
28
  --ag-header-font-family: var(--ag-inherited-header-font-family, var(--ag-font-family));
@@ -111,21 +111,13 @@ function AgGridPlus(props) {
111
111
  var defaultColDef = (0, _react.useMemo)(function () {
112
112
  return {
113
113
  resizable: true,
114
- sortable: true
115
- // headerComponentParams: {
116
- // template:
117
- // '<div class="ag-cell-label-container" role="presentation">' +
118
- // // ' <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>' +
119
- // ' <div ref="eLabel" class="ag-header-cell-label" role="presentation">' +
120
- // ' <span ref="eText" class="ag-header-cell-text"></span>' +
121
- // // ' <span ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' +
122
- // // ' <span ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' +
123
- // ' <span ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' +
124
- // ' <span ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' +
125
- // ' <span ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' +
126
- // ' </div>' +
127
- // '</div>'
128
- // }
114
+ sortable: true,
115
+ headerComponentParams: {
116
+ template: '<div class="ag-cell-label-container" role="presentation">' +
117
+ // '<span data-ref="eMenu" class="ag-header-icon ag-header-cell-menu-button"></span>'+
118
+ // '<span data-ref="eFilterButton" class="ag-header-icon ag-header-cell-filter-button"></span>'+
119
+ '<div data-ref="eLabel" class="ag-header-cell-label" role="presentation">' + '<span data-ref="eText" class="ag-header-cell-text" role="columnheader"></span>' + '<span data-ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' + '<span data-ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' + '<span data-ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' + '<span data-ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' + '<span data-ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' + '</div>' + '</div>'
120
+ }
129
121
  };
130
122
  }, []);
131
123
  var columnTypes = (0, _react.useMemo)(function () {
@@ -4,9 +4,6 @@
4
4
  * See installation docs at https://www.ag-grid.com/javascript-data-grid/applying-theme-builder-styling-grid/
5
5
  */
6
6
 
7
- @import url('https://fonts.googleapis.com/css2?family=IBM%20Plex%20Sans:wght@400&display=swap');
8
-
9
-
10
7
  .ag-root-wrapper, .ag-measurement-container, .ag-apply-theme-variables {
11
8
  --ag-background-color: var(--ag-inherited-background-color, #FFF);
12
9
  --ag-foreground-color: var(--ag-inherited-foreground-color, #181d1f);
@@ -25,7 +22,7 @@
25
22
  --ag-pinned-column-border: var(--ag-inherited-pinned-column-border, solid 1px var(--ag-border-color));
26
23
  --ag-pinned-row-border: var(--ag-inherited-pinned-row-border, solid 1px var(--ag-border-color));
27
24
  --ag-side-panel-border: var(--ag-inherited-side-panel-border, solid 1px var(--ag-border-color));
28
- --ag-font-family: var(--ag-inherited-font-family, 'IBM Plex Sans');
25
+ --ag-font-family: var(--ag-inherited-font-family, "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol','Noto Color Emoji'");
29
26
  --ag-chrome-background-color: var(--ag-inherited-chrome-background-color, color-mix(in srgb, transparent, var(--ag-foreground-color) 2%));
30
27
  --ag-header-background-color: var(--ag-inherited-header-background-color, var(--ag-chrome-background-color));
31
28
  --ag-header-font-family: var(--ag-inherited-header-font-family, var(--ag-font-family));
@@ -1,6 +1,7 @@
1
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
2
  import _sumBy from "lodash/sumBy";
3
3
  var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children"];
4
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
5
  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; }
5
6
  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; }
6
7
  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; }
@@ -26,8 +27,6 @@ import { RedoOutlined } from '@ant-design/icons';
26
27
  import { convertFilterModel, dateTimeValueFormatter, dateValueFormatter, flatten, toTree } from "./utils";
27
28
  import Setting from "./setting";
28
29
  import { useGridPlusColumnState } from '.';
29
- import { jsx as _jsx } from "react/jsx-runtime";
30
- import { jsxs as _jsxs } from "react/jsx-runtime";
31
30
  var getSort = function getSort(columnState) {
32
31
  return columnState ? "".concat(columnState.colId, " ").concat(columnState.sort) : "";
33
32
  };
@@ -103,21 +102,13 @@ function AgGridPlus(props) {
103
102
  var defaultColDef = useMemo(function () {
104
103
  return {
105
104
  resizable: true,
106
- sortable: true
107
- // headerComponentParams: {
108
- // template:
109
- // '<div class="ag-cell-label-container" role="presentation">' +
110
- // // ' <span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>' +
111
- // ' <div ref="eLabel" class="ag-header-cell-label" role="presentation">' +
112
- // ' <span ref="eText" class="ag-header-cell-text"></span>' +
113
- // // ' <span ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' +
114
- // // ' <span ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' +
115
- // ' <span ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' +
116
- // ' <span ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' +
117
- // ' <span ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' +
118
- // ' </div>' +
119
- // '</div>'
120
- // }
105
+ sortable: true,
106
+ headerComponentParams: {
107
+ template: '<div class="ag-cell-label-container" role="presentation">' +
108
+ // '<span data-ref="eMenu" class="ag-header-icon ag-header-cell-menu-button"></span>'+
109
+ // '<span data-ref="eFilterButton" class="ag-header-icon ag-header-cell-filter-button"></span>'+
110
+ '<div data-ref="eLabel" class="ag-header-cell-label" role="presentation">' + '<span data-ref="eText" class="ag-header-cell-text" role="columnheader"></span>' + '<span data-ref="eFilter" class="ag-header-icon ag-filter-icon"></span>' + '<span data-ref="eSortOrder" class="ag-header-icon ag-sort-order"></span>' + '<span data-ref="eSortDesc" class="ag-header-icon ag-sort-descending-icon"></span>' + '<span data-ref="eSortAsc" class="ag-header-icon ag-sort-ascending-icon"></span>' + '<span data-ref="eSortNone" class="ag-header-icon ag-sort-none-icon"></span>' + '</div>' + '</div>'
111
+ }
121
112
  };
122
113
  }, []);
123
114
  var columnTypes = useMemo(function () {
@@ -338,135 +329,130 @@ function AgGridPlus(props) {
338
329
  var rowDataMemo = useMemo(function () {
339
330
  return props.treeData ? flatten(toTree(rowData, treeKeyName !== null && treeKeyName !== void 0 ? treeKeyName : "id", treeParentName !== null && treeParentName !== void 0 ? treeParentName : "parentId"), treeKeyName !== null && treeKeyName !== void 0 ? treeKeyName : "id") : rowData;
340
331
  }, [rowData, props.treeData]);
341
- return /*#__PURE__*/_jsx(Spin, {
332
+ return /*#__PURE__*/React.createElement(Spin, {
342
333
  spinning: loading,
343
- wrapperClassName: "grid-spin",
344
- children: /*#__PURE__*/_jsxs("div", {
345
- className: "grid-container",
346
- style: {
347
- display: "flex",
348
- flexDirection: "column",
349
- flex: 1,
350
- height: "100%"
351
- },
352
- children: [search == false ? null : /*#__PURE__*/_jsx(FormRender, {
353
- colDefs: allColDefs,
354
- columnStates: columnState || [],
355
- gridApi: apiRef.current,
356
- onQuery: function onQuery(formValues) {
357
- setQueryFilter(_objectSpread({}, formValues));
358
- onRequest && onRequest(formValues);
359
- }
360
- }), /*#__PURE__*/_jsxs(Card, {
361
- bordered: false,
362
- headStyle: {
363
- border: 0
364
- },
365
- bodyStyle: {
366
- margin: 0,
367
- padding: 12,
368
- paddingTop: 0,
369
- height: "100%",
370
- display: "flex",
371
- flexDirection: "column"
372
- },
373
- style: {
374
- height: "100%"
375
- },
376
- children: [/*#__PURE__*/_jsxs("div", {
377
- style: _objectSpread({
378
- display: "flex",
379
- flexDirection: "column",
380
- height: "100%"
381
- }, style),
382
- children: [hideTool ? null : /*#__PURE__*/_jsx(ToolBar, {
383
- title: headerTitle,
384
- actions: actionDom,
385
- settings: [/*#__PURE__*/_jsx(SettingItem, {
386
- onClick: onRefresh,
387
- icon: /*#__PURE__*/_jsx(RedoOutlined, {})
388
- }), /*#__PURE__*/_jsx(Setting, {
389
- gridKey: gridKey,
390
- gridApi: apiRef.current,
391
- onSaveColumnState: onColumnStateChanged
392
- })]
393
- }), /*#__PURE__*/_jsx(AgGridReact, _objectSpread(_objectSpread({
394
- className: "ag-theme-custom"
395
- }, rest), {}, {
396
- gridOptions: {
397
- enableCellTextSelection: true,
398
- ensureDomOrder: true
399
- },
400
- enableRangeSelection: true,
401
- suppressCopyRowsToClipboard: true
402
- //指定客户端模式
403
- ,
404
- rowModelType: "clientSide",
405
- maintainColumnOrder: true,
406
- rowData: rowDataMemo,
407
- onGridReady: onGridReady,
408
- defaultColDef: defaultColDef,
409
- onSortChanged: function onSortChanged(event) {
410
- sortChanged(event.api);
411
- props.onSortChanged && props.onSortChanged(event);
412
- },
413
- onSelectionChanged: onRowChanged,
414
- onRowSelected: onRowSelected,
415
- onDragStopped: function onDragStopped(e) {
416
- if (apiRef.current) {
417
- var _apiRef$current2;
418
- var _columnState = (_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.getColumnState();
419
- setColumnState(_columnState);
420
- onColumnStateChanged && onColumnStateChanged(_columnState);
421
- }
422
- }
423
- // onColumnMoved={() => {
424
- // if (apiRef.current) {
425
- // setColumnState(apiRef.current?.getColumnState());
426
- // }
427
- // }}
428
- ,
429
- pinnedBottomRowData: calculateArr,
430
- columnTypes: columnTypes,
431
- animateRows: true
432
- //停用默认分页组件
433
- ,
434
- suppressPaginationPanel: true,
435
- columnDefs: colDefs
436
- }))]
437
- }), /*#__PURE__*/_jsx("div", {
438
- style: {
439
- marginTop: 12,
440
- display: "flex",
441
- justifyContent: "flex-end"
442
- },
443
- children: /*#__PURE__*/_jsx(Pagination, {
444
- pageSize: pagination.pageSize,
445
- current: pagination.current,
446
- total: pagination.total,
447
- onChange: function onChange(page, pageSize) {
448
- setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
449
- pageSize: pageSize,
450
- current: page
451
- }));
452
- },
453
- onShowSizeChange: function onShowSizeChange(current, size) {
454
- setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
455
- pageSize: size,
456
- current: current
457
- }));
458
- },
459
- size: "small",
460
- showTotal: function showTotal(total, range) {
461
- return "\u7B2C ".concat(range[0], "-").concat(range[1], " \u6761/\u603B\u5171 ").concat(total, " \u6761");
462
- },
463
- pageSizeOptions: [10, 100, 200, 500, 1000, 10000],
464
- hideOnSinglePage: false,
465
- showQuickJumper: false
466
- })
467
- })]
468
- })]
469
- })
470
- });
334
+ wrapperClassName: "grid-spin"
335
+ }, /*#__PURE__*/React.createElement("div", {
336
+ className: "grid-container",
337
+ style: {
338
+ display: "flex",
339
+ flexDirection: "column",
340
+ flex: 1,
341
+ height: "100%"
342
+ }
343
+ }, search == false ? null : /*#__PURE__*/React.createElement(FormRender, {
344
+ colDefs: allColDefs,
345
+ columnStates: columnState || [],
346
+ gridApi: apiRef.current,
347
+ onQuery: function onQuery(formValues) {
348
+ setQueryFilter(_objectSpread({}, formValues));
349
+ onRequest && onRequest(formValues);
350
+ }
351
+ }), /*#__PURE__*/React.createElement(Card, {
352
+ bordered: false,
353
+ headStyle: {
354
+ border: 0
355
+ },
356
+ bodyStyle: {
357
+ margin: 0,
358
+ padding: 12,
359
+ paddingTop: 0,
360
+ height: "100%",
361
+ display: "flex",
362
+ flexDirection: "column"
363
+ },
364
+ style: {
365
+ height: "100%"
366
+ }
367
+ }, /*#__PURE__*/React.createElement("div", {
368
+ style: _objectSpread({
369
+ display: "flex",
370
+ flexDirection: "column",
371
+ height: "100%"
372
+ }, style)
373
+ }, hideTool ? null : /*#__PURE__*/React.createElement(ToolBar, {
374
+ title: headerTitle,
375
+ actions: actionDom,
376
+ settings: [/*#__PURE__*/React.createElement(SettingItem, {
377
+ onClick: onRefresh,
378
+ icon: /*#__PURE__*/React.createElement(RedoOutlined, null)
379
+ }), /*#__PURE__*/React.createElement(Setting, {
380
+ gridKey: gridKey,
381
+ gridApi: apiRef.current,
382
+ onSaveColumnState: onColumnStateChanged
383
+ })]
384
+ }), /*#__PURE__*/React.createElement(AgGridReact, _extends({
385
+ className: "ag-theme-custom"
386
+ }, rest, {
387
+ gridOptions: {
388
+ enableCellTextSelection: true,
389
+ ensureDomOrder: true
390
+ },
391
+ enableRangeSelection: true,
392
+ suppressCopyRowsToClipboard: true
393
+ //指定客户端模式
394
+ ,
395
+ rowModelType: "clientSide",
396
+ maintainColumnOrder: true,
397
+ rowData: rowDataMemo,
398
+ onGridReady: onGridReady,
399
+ defaultColDef: defaultColDef,
400
+ onSortChanged: function onSortChanged(event) {
401
+ sortChanged(event.api);
402
+ props.onSortChanged && props.onSortChanged(event);
403
+ },
404
+ onSelectionChanged: onRowChanged,
405
+ onRowSelected: onRowSelected,
406
+ onDragStopped: function onDragStopped(e) {
407
+ if (apiRef.current) {
408
+ var _apiRef$current2;
409
+ var _columnState = (_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.getColumnState();
410
+ setColumnState(_columnState);
411
+ onColumnStateChanged && onColumnStateChanged(_columnState);
412
+ }
413
+ }
414
+ // onColumnMoved={() => {
415
+ // if (apiRef.current) {
416
+ // setColumnState(apiRef.current?.getColumnState());
417
+ // }
418
+ // }}
419
+ ,
420
+ pinnedBottomRowData: calculateArr,
421
+ columnTypes: columnTypes,
422
+ animateRows: true
423
+ //停用默认分页组件
424
+ ,
425
+ suppressPaginationPanel: true,
426
+ columnDefs: colDefs
427
+ }))), /*#__PURE__*/React.createElement("div", {
428
+ style: {
429
+ marginTop: 12,
430
+ display: "flex",
431
+ justifyContent: "flex-end"
432
+ }
433
+ }, /*#__PURE__*/React.createElement(Pagination, {
434
+ pageSize: pagination.pageSize,
435
+ current: pagination.current,
436
+ total: pagination.total,
437
+ onChange: function onChange(page, pageSize) {
438
+ setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
439
+ pageSize: pageSize,
440
+ current: page
441
+ }));
442
+ },
443
+ onShowSizeChange: function onShowSizeChange(current, size) {
444
+ setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
445
+ pageSize: size,
446
+ current: current
447
+ }));
448
+ },
449
+ size: "small",
450
+ showTotal: function showTotal(total, range) {
451
+ return "\u7B2C ".concat(range[0], "-").concat(range[1], " \u6761/\u603B\u5171 ").concat(total, " \u6761");
452
+ },
453
+ pageSizeOptions: [10, 100, 200, 500, 1000, 10000],
454
+ hideOnSinglePage: false,
455
+ showQuickJumper: false
456
+ })))));
471
457
  }
472
458
  export default AgGridPlus;