@nokecy/qc-ui 0.3.28 → 0.3.31

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.
@@ -33,7 +33,7 @@ var _setting = _interopRequireDefault(require("./setting"));
33
33
 
34
34
  var _ = require(".");
35
35
 
36
- var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
36
+ var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children"];
37
37
 
38
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
39
 
@@ -85,11 +85,13 @@ function AgGridPlus(props) {
85
85
  hideTool = props.hideTool,
86
86
  onReady = props.onGridReady,
87
87
  gridKey = props.gridKey,
88
- gridColumnState = props.gridColumnState,
89
88
  children = props.children,
90
89
  rest = _objectWithoutProperties(props, _excluded);
91
90
 
92
- var gridPlusColumnState = (0, _.useGridPlusColumnState)();
91
+ var _useGridPlusColumnSta = (0, _.useGridPlusColumnState)(),
92
+ onSaveColumnState = _useGridPlusColumnSta.onSaveColumnState,
93
+ gridPlusColumnState = _useGridPlusColumnSta.columnState;
94
+
93
95
  var gridRef = (0, _react.useRef)();
94
96
  var apiRef = (0, _react.useRef)();
95
97
  var columnsRef = (0, _react.useRef)();
@@ -270,7 +272,9 @@ function AgGridPlus(props) {
270
272
  props.onRowSelected && props.onRowSelected(e);
271
273
  }, []);
272
274
 
273
- var onColumnStateChanged = function onColumnStateChanged(columnState) {};
275
+ var onColumnStateChanged = function onColumnStateChanged(columnState) {
276
+ onSaveColumnState && onSaveColumnState(gridKey, columnState);
277
+ };
274
278
 
275
279
  (0, _react.useEffect)(function () {
276
280
  gridRef.current = {
@@ -369,7 +373,10 @@ function AgGridPlus(props) {
369
373
  if (columnsRef.current) {
370
374
  var _columnsRef$current2;
371
375
 
372
- setColumnState((_columnsRef$current2 = columnsRef.current) === null || _columnsRef$current2 === void 0 ? void 0 : _columnsRef$current2.getColumnState());
376
+ var _columnState = (_columnsRef$current2 = columnsRef.current) === null || _columnsRef$current2 === void 0 ? void 0 : _columnsRef$current2.getColumnState();
377
+
378
+ setColumnState(_columnState);
379
+ onColumnStateChanged && onColumnStateChanged(_columnState);
373
380
  }
374
381
  } // onColumnMoved={() => {
375
382
  // if (columnsRef.current) {
@@ -408,7 +415,7 @@ function AgGridPlus(props) {
408
415
  showTotal: function showTotal(total, range) {
409
416
  return "\u7B2C ".concat(range[0], "-").concat(range[1], " \u6761/\u603B\u5171 ").concat(total, " \u6761");
410
417
  },
411
- pageSizeOptions: [10, 100, 200, 500, 1000],
418
+ pageSizeOptions: [10, 100, 200, 500, 1000, 10000, 50000],
412
419
  hideOnSinglePage: false,
413
420
  showQuickJumper: false
414
421
  })))));
@@ -1,2 +1,5 @@
1
1
  import React from 'react';
2
- export declare const GridPlusContext: React.Context<any>;
2
+ export declare const GridPlusContext: React.Context<{
3
+ columnState: any;
4
+ onSaveColumnState: (gridKey: string, columnState: any[]) => void;
5
+ }>;
@@ -9,6 +9,9 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- var GridPlusContext = /*#__PURE__*/_react.default.createContext(null);
12
+ var GridPlusContext = /*#__PURE__*/_react.default.createContext({
13
+ columnState: undefined,
14
+ onSaveColumnState: function onSaveColumnState(gridKey, columnState) {}
15
+ });
13
16
 
14
17
  exports.GridPlusContext = GridPlusContext;
@@ -1,5 +1,9 @@
1
1
  import AgGridPlus from "./ag-gridPlus";
2
2
  import { AgGridColumn } from "./interface";
3
- export declare const useGridPlusColumnState: () => any;
4
- export { AgGridPlus, AgGridColumn };
3
+ import { GridPlusContext } from "./context/gridContext";
4
+ export declare const useGridPlusColumnState: () => {
5
+ columnState: any;
6
+ onSaveColumnState: (gridKey: string, columnState: any[]) => {};
7
+ };
8
+ export { AgGridPlus, AgGridColumn, GridPlusContext };
5
9
  export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten } from "./utils";
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "AgGridPlus", {
15
15
  return _agGridPlus.default;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "GridPlusContext", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _gridContext.GridPlusContext;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "convertFilterModel", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -76,7 +76,7 @@ var FormRender = function FormRender(props) {
76
76
  })];
77
77
  }
78
78
  });
79
- }, [schema]);
79
+ }, []);
80
80
  var SchemaField = (0, _react2.useMemo)(function () {
81
81
  return (0, _react.createSchemaField)({
82
82
  components: {
@@ -119,18 +119,7 @@ var Setting = function Setting(props) {
119
119
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.Object, null, /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
120
120
  "x-component": "ArrayTable.Column",
121
121
  "x-component-props": {
122
- width: 150,
123
- title: "字段名"
124
- }
125
- }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
126
- name: "field",
127
- "x-decorator": "FormItem",
128
- "x-component": "Input",
129
- "x-read-pretty": true
130
- })), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
131
- "x-component": "ArrayTable.Column",
132
- "x-component-props": {
133
- width: 150,
122
+ width: 100,
134
123
  title: "列名"
135
124
  }
136
125
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
@@ -141,7 +130,7 @@ var Setting = function Setting(props) {
141
130
  })), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
142
131
  "x-component": "ArrayTable.Column",
143
132
  "x-component-props": {
144
- width: 150,
133
+ width: 100,
145
134
  title: "宽度"
146
135
  }
147
136
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
@@ -151,17 +140,24 @@ var Setting = function Setting(props) {
151
140
  })), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
152
141
  "x-component": "ArrayTable.Column",
153
142
  "x-component-props": {
154
- width: 150,
143
+ width: 100,
155
144
  title: "占满"
156
145
  }
157
146
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
158
147
  name: "flex",
159
148
  "x-decorator": "FormItem",
160
- "x-component": "Switch"
149
+ "x-component": "Select",
150
+ enum: [{
151
+ value: 1,
152
+ label: "占满"
153
+ }, {
154
+ value: 0,
155
+ label: "不占满"
156
+ }]
161
157
  })), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
162
158
  "x-component": "ArrayTable.Column",
163
159
  "x-component-props": {
164
- width: 150,
160
+ width: 100,
165
161
  title: '固定位置'
166
162
  }
167
163
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
@@ -181,7 +177,6 @@ var Setting = function Setting(props) {
181
177
  })), /*#__PURE__*/_react2.default.createElement(SchemaField.Void, {
182
178
  "x-component": "ArrayTable.Column",
183
179
  "x-component-props": {
184
- width: 150,
185
180
  title: '隐藏'
186
181
  }
187
182
  }, /*#__PURE__*/_react2.default.createElement(SchemaField.String, {
@@ -1,9 +1,9 @@
1
1
  import ArrayTable from "./array-table";
2
2
  import ArrayTableIndex from "./array-table-index";
3
- import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
3
+ import { AgGridColumn, AgGridPlus, GridPlusContext, flattenTreeDeep } from "./ag-grid-plus";
4
4
  import ExtensibleGrid from "./extensible-grid";
5
5
  import Editable from "./editable";
6
6
  import DialogSelect from "./dialogSelect";
7
7
  import Dashboard from "./dashboard";
8
- export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard };
8
+ export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, GridPlusContext, ExtensibleGrid, Dashboard };
9
9
  export { flattenTreeDeep };
package/dist/cjs/index.js CHANGED
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "ExtensibleGrid", {
51
51
  return _extensibleGrid.default;
52
52
  }
53
53
  });
54
+ Object.defineProperty(exports, "GridPlusContext", {
55
+ enumerable: true,
56
+ get: function get() {
57
+ return _agGridPlus.GridPlusContext;
58
+ }
59
+ });
54
60
  Object.defineProperty(exports, "flattenTreeDeep", {
55
61
  enumerable: true,
56
62
  get: function get() {
@@ -1,4 +1,4 @@
1
- var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "gridColumnState", "children"];
1
+ var _excluded = ["style", "loading", "params", "request", "dataSource", "treeKeyName", "treeParentName", "rowData", "gridRef", "headerTitle", "toolBarRender", "search", "hideTool", "onGridReady", "gridKey", "children"];
2
2
 
3
3
  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
4
 
@@ -58,11 +58,13 @@ function AgGridPlus(props) {
58
58
  hideTool = props.hideTool,
59
59
  onReady = props.onGridReady,
60
60
  gridKey = props.gridKey,
61
- gridColumnState = props.gridColumnState,
62
61
  children = props.children,
63
62
  rest = _objectWithoutProperties(props, _excluded);
64
63
 
65
- var gridPlusColumnState = useGridPlusColumnState();
64
+ var _useGridPlusColumnSta = useGridPlusColumnState(),
65
+ onSaveColumnState = _useGridPlusColumnSta.onSaveColumnState,
66
+ gridPlusColumnState = _useGridPlusColumnSta.columnState;
67
+
66
68
  var gridRef = useRef();
67
69
  var apiRef = useRef();
68
70
  var columnsRef = useRef();
@@ -243,7 +245,9 @@ function AgGridPlus(props) {
243
245
  props.onRowSelected && props.onRowSelected(e);
244
246
  }, []);
245
247
 
246
- var onColumnStateChanged = function onColumnStateChanged(columnState) {};
248
+ var onColumnStateChanged = function onColumnStateChanged(columnState) {
249
+ onSaveColumnState && onSaveColumnState(gridKey, columnState);
250
+ };
247
251
 
248
252
  useEffect(function () {
249
253
  gridRef.current = {
@@ -340,7 +344,10 @@ function AgGridPlus(props) {
340
344
  if (columnsRef.current) {
341
345
  var _columnsRef$current2;
342
346
 
343
- setColumnState((_columnsRef$current2 = columnsRef.current) === null || _columnsRef$current2 === void 0 ? void 0 : _columnsRef$current2.getColumnState());
347
+ var _columnState = (_columnsRef$current2 = columnsRef.current) === null || _columnsRef$current2 === void 0 ? void 0 : _columnsRef$current2.getColumnState();
348
+
349
+ setColumnState(_columnState);
350
+ onColumnStateChanged && onColumnStateChanged(_columnState);
344
351
  }
345
352
  } // onColumnMoved={() => {
346
353
  // if (columnsRef.current) {
@@ -379,7 +386,7 @@ function AgGridPlus(props) {
379
386
  showTotal: function showTotal(total, range) {
380
387
  return "\u7B2C ".concat(range[0], "-").concat(range[1], " \u6761/\u603B\u5171 ").concat(total, " \u6761");
381
388
  },
382
- pageSizeOptions: [10, 100, 200, 500, 1000],
389
+ pageSizeOptions: [10, 100, 200, 500, 1000, 10000, 50000],
383
390
  hideOnSinglePage: false,
384
391
  showQuickJumper: false
385
392
  })))));
@@ -1,2 +1,5 @@
1
1
  import React from 'react';
2
- export declare const GridPlusContext: React.Context<any>;
2
+ export declare const GridPlusContext: React.Context<{
3
+ columnState: any;
4
+ onSaveColumnState: (gridKey: string, columnState: any[]) => void;
5
+ }>;
@@ -1,2 +1,5 @@
1
1
  import React from 'react';
2
- export var GridPlusContext = /*#__PURE__*/React.createContext(null);
2
+ export var GridPlusContext = /*#__PURE__*/React.createContext({
3
+ columnState: undefined,
4
+ onSaveColumnState: function onSaveColumnState(gridKey, columnState) {}
5
+ });
@@ -1,5 +1,9 @@
1
1
  import AgGridPlus from "./ag-gridPlus";
2
2
  import { AgGridColumn } from "./interface";
3
- export declare const useGridPlusColumnState: () => any;
4
- export { AgGridPlus, AgGridColumn };
3
+ import { GridPlusContext } from "./context/gridContext";
4
+ export declare const useGridPlusColumnState: () => {
5
+ columnState: any;
6
+ onSaveColumnState: (gridKey: string, columnState: any[]) => {};
7
+ };
8
+ export { AgGridPlus, AgGridColumn, GridPlusContext };
5
9
  export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten } from "./utils";
@@ -5,5 +5,5 @@ import { GridPlusContext } from "./context/gridContext";
5
5
  export var useGridPlusColumnState = function useGridPlusColumnState() {
6
6
  return React.useContext(GridPlusContext);
7
7
  };
8
- export { AgGridPlus, AgGridColumn };
8
+ export { AgGridPlus, AgGridColumn, GridPlusContext };
9
9
  export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten } from "./utils";
@@ -54,7 +54,7 @@ var FormRender = function FormRender(props) {
54
54
  })];
55
55
  }
56
56
  });
57
- }, [schema]);
57
+ }, []);
58
58
  var SchemaField = useMemo(function () {
59
59
  return createSchemaField({
60
60
  components: {
@@ -102,18 +102,7 @@ var Setting = function Setting(props) {
102
102
  }, /*#__PURE__*/React.createElement(SchemaField.Object, null, /*#__PURE__*/React.createElement(SchemaField.Void, {
103
103
  "x-component": "ArrayTable.Column",
104
104
  "x-component-props": {
105
- width: 150,
106
- title: "字段名"
107
- }
108
- }, /*#__PURE__*/React.createElement(SchemaField.String, {
109
- name: "field",
110
- "x-decorator": "FormItem",
111
- "x-component": "Input",
112
- "x-read-pretty": true
113
- })), /*#__PURE__*/React.createElement(SchemaField.Void, {
114
- "x-component": "ArrayTable.Column",
115
- "x-component-props": {
116
- width: 150,
105
+ width: 100,
117
106
  title: "列名"
118
107
  }
119
108
  }, /*#__PURE__*/React.createElement(SchemaField.String, {
@@ -124,7 +113,7 @@ var Setting = function Setting(props) {
124
113
  })), /*#__PURE__*/React.createElement(SchemaField.Void, {
125
114
  "x-component": "ArrayTable.Column",
126
115
  "x-component-props": {
127
- width: 150,
116
+ width: 100,
128
117
  title: "宽度"
129
118
  }
130
119
  }, /*#__PURE__*/React.createElement(SchemaField.String, {
@@ -134,17 +123,24 @@ var Setting = function Setting(props) {
134
123
  })), /*#__PURE__*/React.createElement(SchemaField.Void, {
135
124
  "x-component": "ArrayTable.Column",
136
125
  "x-component-props": {
137
- width: 150,
126
+ width: 100,
138
127
  title: "占满"
139
128
  }
140
129
  }, /*#__PURE__*/React.createElement(SchemaField.String, {
141
130
  name: "flex",
142
131
  "x-decorator": "FormItem",
143
- "x-component": "Switch"
132
+ "x-component": "Select",
133
+ enum: [{
134
+ value: 1,
135
+ label: "占满"
136
+ }, {
137
+ value: 0,
138
+ label: "不占满"
139
+ }]
144
140
  })), /*#__PURE__*/React.createElement(SchemaField.Void, {
145
141
  "x-component": "ArrayTable.Column",
146
142
  "x-component-props": {
147
- width: 150,
143
+ width: 100,
148
144
  title: '固定位置'
149
145
  }
150
146
  }, /*#__PURE__*/React.createElement(SchemaField.String, {
@@ -164,7 +160,6 @@ var Setting = function Setting(props) {
164
160
  })), /*#__PURE__*/React.createElement(SchemaField.Void, {
165
161
  "x-component": "ArrayTable.Column",
166
162
  "x-component-props": {
167
- width: 150,
168
163
  title: '隐藏'
169
164
  }
170
165
  }, /*#__PURE__*/React.createElement(SchemaField.String, {
@@ -1,9 +1,9 @@
1
1
  import ArrayTable from "./array-table";
2
2
  import ArrayTableIndex from "./array-table-index";
3
- import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
3
+ import { AgGridColumn, AgGridPlus, GridPlusContext, flattenTreeDeep } from "./ag-grid-plus";
4
4
  import ExtensibleGrid from "./extensible-grid";
5
5
  import Editable from "./editable";
6
6
  import DialogSelect from "./dialogSelect";
7
7
  import Dashboard from "./dashboard";
8
- export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard };
8
+ export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, GridPlusContext, ExtensibleGrid, Dashboard };
9
9
  export { flattenTreeDeep };
package/dist/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import ArrayTable from "./array-table";
2
2
  import ArrayTableIndex from "./array-table-index";
3
- import { AgGridColumn, AgGridPlus, flattenTreeDeep } from "./ag-grid-plus";
3
+ import { AgGridColumn, AgGridPlus, GridPlusContext, flattenTreeDeep } from "./ag-grid-plus";
4
4
  import ExtensibleGrid from "./extensible-grid";
5
5
  import Editable from "./editable";
6
6
  import DialogSelect from "./dialogSelect";
7
7
  import Dashboard from "./dashboard";
8
- export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, ExtensibleGrid, Dashboard };
8
+ export { Editable, DialogSelect, ArrayTable, ArrayTableIndex, AgGridColumn, AgGridPlus, GridPlusContext, ExtensibleGrid, Dashboard };
9
9
  export { flattenTreeDeep };