@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.
- package/dist/cjs/ag-grid-plus/ag-grid-theme-builder.css +1 -4
- package/dist/cjs/ag-grid-plus/ag-gridPlus.js +7 -15
- package/dist/esm/ag-grid-plus/ag-grid-theme-builder.css +1 -4
- package/dist/esm/ag-grid-plus/ag-gridPlus.js +132 -146
- package/dist/umd/qc-ui.min.css +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -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, '
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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, '
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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__*/
|
|
332
|
+
return /*#__PURE__*/React.createElement(Spin, {
|
|
342
333
|
spinning: loading,
|
|
343
|
-
wrapperClassName: "grid-spin"
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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;
|