@nokecy/qc-ui 0.0.1

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 (128) hide show
  1. package/README.md +23 -0
  2. package/dist/cjs/ag-grid-plus/ag-gridPlus.d.ts +5 -0
  3. package/dist/cjs/ag-grid-plus/ag-gridPlus.js +191 -0
  4. package/dist/cjs/ag-grid-plus/global.scss +65 -0
  5. package/dist/cjs/ag-grid-plus/gridManager/index.d.ts +8 -0
  6. package/dist/cjs/ag-grid-plus/gridManager/index.js +51 -0
  7. package/dist/cjs/ag-grid-plus/index.d.ts +3 -0
  8. package/dist/cjs/ag-grid-plus/index.js +23 -0
  9. package/dist/cjs/ag-grid-plus/interface.d.ts +25 -0
  10. package/dist/cjs/ag-grid-plus/interface.js +17 -0
  11. package/dist/cjs/ag-grid-plus/queryForm/index.d.ts +10 -0
  12. package/dist/cjs/ag-grid-plus/queryForm/index.js +210 -0
  13. package/dist/cjs/ag-grid-plus/queryForm/index.less +48 -0
  14. package/dist/cjs/ag-grid-plus/queryForm/queryForm.d.ts +3 -0
  15. package/dist/cjs/ag-grid-plus/queryForm/queryForm.js +110 -0
  16. package/dist/cjs/array-table/index.d.ts +10 -0
  17. package/dist/cjs/array-table/index.js +205 -0
  18. package/dist/cjs/dashboard/dashboard/components/index.d.ts +2 -0
  19. package/dist/cjs/dashboard/dashboard/components/index.js +15 -0
  20. package/dist/cjs/dashboard/dashboard/components/modal/index.d.ts +3 -0
  21. package/dist/cjs/dashboard/dashboard/components/modal/index.js +26 -0
  22. package/dist/cjs/dashboard/dashboard/components/toolbar/index.d.ts +11 -0
  23. package/dist/cjs/dashboard/dashboard/components/toolbar/index.js +37 -0
  24. package/dist/cjs/dashboard/dashboard/components/toolbar/style/index.d.ts +1 -0
  25. package/dist/cjs/dashboard/dashboard/components/toolbar/style/index.js +3 -0
  26. package/dist/cjs/dashboard/dashboard/components/toolbar/style/index.less +49 -0
  27. package/dist/cjs/dashboard/dashboard/index.d.ts +62 -0
  28. package/dist/cjs/dashboard/dashboard/index.js +603 -0
  29. package/dist/cjs/dashboard/dashboard/index.less +173 -0
  30. package/dist/cjs/dashboard/dashboard/service.d.ts +8 -0
  31. package/dist/cjs/dashboard/dashboard/service.js +114 -0
  32. package/dist/cjs/dashboard/dashboard/utils.d.ts +9 -0
  33. package/dist/cjs/dashboard/dashboard/utils.js +126 -0
  34. package/dist/cjs/dashboard/index.d.ts +3 -0
  35. package/dist/cjs/dashboard/index.js +30 -0
  36. package/dist/cjs/dashboard/utils.d.ts +24 -0
  37. package/dist/cjs/dashboard/utils.js +162 -0
  38. package/dist/cjs/dashboard/widget/index.d.ts +13 -0
  39. package/dist/cjs/dashboard/widget/index.js +79 -0
  40. package/dist/cjs/dashboard/widget/index.less +7 -0
  41. package/dist/cjs/dashboard/widget/selector/index.d.ts +4 -0
  42. package/dist/cjs/dashboard/widget/selector/index.js +271 -0
  43. package/dist/cjs/dashboard/widget/selector/index.less +434 -0
  44. package/dist/cjs/dashboard/widget/utils.d.ts +4 -0
  45. package/dist/cjs/dashboard/widget/utils.js +116 -0
  46. package/dist/cjs/elsaFlow/config-graph.d.ts +1 -0
  47. package/dist/cjs/elsaFlow/config-graph.js +57 -0
  48. package/dist/cjs/elsaFlow/index.d.ts +6 -0
  49. package/dist/cjs/elsaFlow/index.js +199 -0
  50. package/dist/cjs/elsaFlow/react-edge/edge1.d.ts +4 -0
  51. package/dist/cjs/elsaFlow/react-edge/edge1.js +31 -0
  52. package/dist/cjs/elsaFlow/react-edge/edge1.less +0 -0
  53. package/dist/cjs/elsaFlow/react-edge/edge2.d.ts +4 -0
  54. package/dist/cjs/elsaFlow/react-edge/edge2.js +31 -0
  55. package/dist/cjs/elsaFlow/react-edge/edge2.less +0 -0
  56. package/dist/cjs/elsaFlow/react-node/node1.d.ts +4 -0
  57. package/dist/cjs/elsaFlow/react-node/node1.js +28 -0
  58. package/dist/cjs/elsaFlow/react-node/node1.less +11 -0
  59. package/dist/cjs/elsaFlow/react-node/node2.d.ts +4 -0
  60. package/dist/cjs/elsaFlow/react-node/node2.js +28 -0
  61. package/dist/cjs/elsaFlow/react-node/node2.less +11 -0
  62. package/dist/cjs/index.d.ts +4 -0
  63. package/dist/cjs/index.js +37 -0
  64. package/dist/esm/ag-grid-plus/ag-gridPlus.d.ts +5 -0
  65. package/dist/esm/ag-grid-plus/ag-gridPlus.js +169 -0
  66. package/dist/esm/ag-grid-plus/global.scss +65 -0
  67. package/dist/esm/ag-grid-plus/gridManager/index.d.ts +8 -0
  68. package/dist/esm/ag-grid-plus/gridManager/index.js +44 -0
  69. package/dist/esm/ag-grid-plus/index.d.ts +3 -0
  70. package/dist/esm/ag-grid-plus/index.js +3 -0
  71. package/dist/esm/ag-grid-plus/interface.d.ts +25 -0
  72. package/dist/esm/ag-grid-plus/interface.js +9 -0
  73. package/dist/esm/ag-grid-plus/queryForm/index.d.ts +10 -0
  74. package/dist/esm/ag-grid-plus/queryForm/index.js +189 -0
  75. package/dist/esm/ag-grid-plus/queryForm/index.less +48 -0
  76. package/dist/esm/ag-grid-plus/queryForm/queryForm.d.ts +3 -0
  77. package/dist/esm/ag-grid-plus/queryForm/queryForm.js +92 -0
  78. package/dist/esm/array-table/index.d.ts +10 -0
  79. package/dist/esm/array-table/index.js +179 -0
  80. package/dist/esm/dashboard/dashboard/components/index.d.ts +2 -0
  81. package/dist/esm/dashboard/dashboard/components/index.js +2 -0
  82. package/dist/esm/dashboard/dashboard/components/modal/index.d.ts +3 -0
  83. package/dist/esm/dashboard/dashboard/components/modal/index.js +17 -0
  84. package/dist/esm/dashboard/dashboard/components/toolbar/index.d.ts +11 -0
  85. package/dist/esm/dashboard/dashboard/components/toolbar/index.js +24 -0
  86. package/dist/esm/dashboard/dashboard/components/toolbar/style/index.d.ts +1 -0
  87. package/dist/esm/dashboard/dashboard/components/toolbar/style/index.js +1 -0
  88. package/dist/esm/dashboard/dashboard/components/toolbar/style/index.less +49 -0
  89. package/dist/esm/dashboard/dashboard/index.d.ts +62 -0
  90. package/dist/esm/dashboard/dashboard/index.js +571 -0
  91. package/dist/esm/dashboard/dashboard/index.less +173 -0
  92. package/dist/esm/dashboard/dashboard/service.d.ts +8 -0
  93. package/dist/esm/dashboard/dashboard/service.js +102 -0
  94. package/dist/esm/dashboard/dashboard/utils.d.ts +9 -0
  95. package/dist/esm/dashboard/dashboard/utils.js +106 -0
  96. package/dist/esm/dashboard/index.d.ts +3 -0
  97. package/dist/esm/dashboard/index.js +3 -0
  98. package/dist/esm/dashboard/utils.d.ts +24 -0
  99. package/dist/esm/dashboard/utils.js +142 -0
  100. package/dist/esm/dashboard/widget/index.d.ts +13 -0
  101. package/dist/esm/dashboard/widget/index.js +59 -0
  102. package/dist/esm/dashboard/widget/index.less +7 -0
  103. package/dist/esm/dashboard/widget/selector/index.d.ts +4 -0
  104. package/dist/esm/dashboard/widget/selector/index.js +249 -0
  105. package/dist/esm/dashboard/widget/selector/index.less +434 -0
  106. package/dist/esm/dashboard/widget/utils.d.ts +4 -0
  107. package/dist/esm/dashboard/widget/utils.js +88 -0
  108. package/dist/esm/elsaFlow/config-graph.d.ts +1 -0
  109. package/dist/esm/elsaFlow/config-graph.js +42 -0
  110. package/dist/esm/elsaFlow/index.d.ts +6 -0
  111. package/dist/esm/elsaFlow/index.js +189 -0
  112. package/dist/esm/elsaFlow/react-edge/edge1.d.ts +4 -0
  113. package/dist/esm/elsaFlow/react-edge/edge1.js +18 -0
  114. package/dist/esm/elsaFlow/react-edge/edge1.less +0 -0
  115. package/dist/esm/elsaFlow/react-edge/edge2.d.ts +4 -0
  116. package/dist/esm/elsaFlow/react-edge/edge2.js +18 -0
  117. package/dist/esm/elsaFlow/react-edge/edge2.less +0 -0
  118. package/dist/esm/elsaFlow/react-node/node1.d.ts +4 -0
  119. package/dist/esm/elsaFlow/react-node/node1.js +16 -0
  120. package/dist/esm/elsaFlow/react-node/node1.less +11 -0
  121. package/dist/esm/elsaFlow/react-node/node2.d.ts +4 -0
  122. package/dist/esm/elsaFlow/react-node/node2.js +16 -0
  123. package/dist/esm/elsaFlow/react-node/node2.less +11 -0
  124. package/dist/esm/index.d.ts +4 -0
  125. package/dist/esm/index.js +5 -0
  126. package/dist/umd/qc-ui.min.css +1 -0
  127. package/dist/umd/qc-ui.min.js +1 -0
  128. package/package.json +61 -0
@@ -0,0 +1,65 @@
1
+ /* Add application styles & imports to this file! */
2
+
3
+ @import "~ag-grid-community/src/styles/ag-grid.scss";
4
+ @import "~ag-grid-community/src/styles/ag-theme-alpine/sass/ag-theme-alpine-mixin";
5
+
6
+
7
+ .ag-theme-alpine {
8
+ @include ag-theme-alpine(( // use theme parameters where possible
9
+ // Default border for cells. This can be used to specify the border-style and border-color properties e.g. `dashed red` but the border-width is fixed at 1px.
10
+ grid-size: 4px,
11
+ odd-row-background-color:#fff,
12
+ secondary-border-color:#f0f0f0,
13
+ cell-horizontal-padding: ag-derived(grid-size, $times: 2),
14
+ border-color:#f0f0f5,
15
+ cell-horizontal-border: 1px solid ag-derived(secondary-border-color),
16
+ font-size: 12px,
17
+ font-family: ('microsoft yahei', 'Helvetica', 'Arial'),
18
+ ));
19
+
20
+ .ag-header-cell {
21
+ // or write CSS selectors to make customisations beyond what the parameters support
22
+ border-right: 1px solid ag-param(secondary-border-color);
23
+ }
24
+
25
+ .ag-header-group-cell-with-group {
26
+ // or write CSS selectors to make customisations beyond what the parameters support
27
+ border-right: 1px solid ag-param(secondary-border-color);
28
+ }
29
+
30
+ .ag-header-center .ag-header-group-cell-label,
31
+ .ag-header-center .ag-header-cell-label {
32
+ text-align: center;
33
+ display: grid;
34
+ }
35
+ }
36
+
37
+ .ag-drak-theme-alpine {
38
+ @include ag-theme-alpine(( // use theme parameters where possible
39
+ // Default border for cells. This can be used to specify the border-style and border-color properties e.g. `dashed red` but the border-width is fixed at 1px.
40
+ grid-size: 4px,
41
+ odd-row-background-color:#fff,
42
+ secondary-border-color:#000,
43
+ cell-horizontal-padding: ag-derived(grid-size, $times: 2),
44
+ border-color:#000,
45
+ cell-horizontal-border: 1px solid ag-derived(secondary-border-color),
46
+ font-size: 11px,
47
+ font-family: ('microsoft yahei', 'Helvetica', 'Arial'),
48
+ ));
49
+
50
+ .ag-header-cell {
51
+ // or write CSS selectors to make customisations beyond what the parameters support
52
+ border-right: 1px solid ag-param(secondary-border-color);
53
+ }
54
+
55
+ .ag-header-group-cell-with-group {
56
+ // or write CSS selectors to make customisations beyond what the parameters support
57
+ border-right: 1px solid ag-param(secondary-border-color);
58
+ }
59
+
60
+ .ag-header-center .ag-header-group-cell-label,
61
+ .ag-header-center .ag-header-cell-label {
62
+ text-align: center;
63
+ display: grid;
64
+ }
65
+ }
@@ -0,0 +1,8 @@
1
+ import { ColumnApi, GridApi } from "ag-grid-community";
2
+ export default class GridManage {
3
+ agGridApi: GridApi | undefined;
4
+ agGridColumnApi: ColumnApi | undefined;
5
+ rowkey: string | undefined;
6
+ columnsDefs: any[] | undefined;
7
+ dataSourceChanged(dataSource?: any[]): void;
8
+ }
@@ -0,0 +1,44 @@
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
4
+
5
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ var GridManage = /*#__PURE__*/function () {
10
+ function GridManage() {
11
+ _classCallCheck(this, GridManage);
12
+
13
+ _defineProperty(this, "agGridApi", void 0);
14
+
15
+ _defineProperty(this, "agGridColumnApi", void 0);
16
+
17
+ _defineProperty(this, "rowkey", void 0);
18
+
19
+ _defineProperty(this, "columnsDefs", void 0);
20
+ }
21
+
22
+ _createClass(GridManage, [{
23
+ key: "dataSourceChanged",
24
+ value: function dataSourceChanged() {// if (!Array.isArray(dataSource) || !this.agGridApi) return;
25
+ // const gridDataSource: any[] = [];
26
+ // this.agGridApi.forEachNode(node => {
27
+ // if (node.data) gridDataSource.push(node.data);
28
+ // });
29
+ // if (isEqual(dataSource, gridDataSource) || isEqual(dataSource, this.agGridConfig.dataSource))
30
+ // return this.agGridApi.setRowData(dataSource);
31
+ // this.reset({
32
+ // dataSource: dataSource,
33
+ // });
34
+ // this.agGridApi.setRowData([]);
35
+ // this.agGridApi.setRowData(dataSource);
36
+
37
+ var dataSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
+ }
39
+ }]);
40
+
41
+ return GridManage;
42
+ }();
43
+
44
+ export { GridManage as default };
@@ -0,0 +1,3 @@
1
+ import AgGridPlus from "./ag-gridPlus";
2
+ import { AgGridColumn } from "./interface";
3
+ export { AgGridPlus, AgGridColumn };
@@ -0,0 +1,3 @@
1
+ import AgGridPlus from "./ag-gridPlus";
2
+ import { AgGridColumn } from "./interface";
3
+ export { AgGridPlus, AgGridColumn };
@@ -0,0 +1,25 @@
1
+ import { GridApi } from 'ag-grid-community';
2
+ import { AgGridReactProps, AgGridColumnProps, AgGridColumnGroupProps } from 'ag-grid-react';
3
+ import React, { CSSProperties, ReactNode } from 'react';
4
+ interface GridProps extends AgGridReactProps {
5
+ hideRedo?: boolean;
6
+ style?: CSSProperties;
7
+ params?: any;
8
+ initParams?: any;
9
+ request?: (params: any, sort: any, filter: any) => Promise<any>;
10
+ dataSource?: any[];
11
+ search?: boolean;
12
+ headerTitle?: React.ReactNode;
13
+ toolBarRender?: (gridApi?: GridApi) => React.ReactNode[];
14
+ columnDefs?: any;
15
+ }
16
+ interface AgGridColumnPropsClone extends AgGridColumnProps {
17
+ hideInTable?: boolean;
18
+ hideInSearch?: boolean;
19
+ queryField?: string;
20
+ searchComponent?: ReactNode;
21
+ searchComponentProps?: any;
22
+ searchSort?: number;
23
+ }
24
+ declare function AgGridColumn(props: AgGridColumnPropsClone | AgGridColumnGroupProps): JSX.Element;
25
+ export { GridProps, AgGridColumn };
@@ -0,0 +1,9 @@
1
+ import { AgGridColumn as AgGridColumnClone } from 'ag-grid-react';
2
+ import React from 'react';
3
+
4
+ function AgGridColumn(props) {
5
+ ///@ts-ignore
6
+ return /*#__PURE__*/React.createElement(AgGridColumnClone, props);
7
+ }
8
+
9
+ export { AgGridColumn };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { GridApi } from 'ag-grid-community';
3
+ import './index.less';
4
+ declare const FormRender: (props: {
5
+ className?: any;
6
+ gridApi?: GridApi<any> | undefined;
7
+ columns: any[];
8
+ onQuery: (formValue: any) => void;
9
+ }) => JSX.Element;
10
+ export default FormRender;
@@ -0,0 +1,189 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+
11
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+
13
+ 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); }
14
+
15
+ 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; }
16
+
17
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
18
+
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+
21
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
22
+
23
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
24
+
25
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
26
+
27
+ import { DatePicker, FormButtonGroup, FormGrid, FormItem, Form, Input, Submit } from '@formily/antd';
28
+ import { createForm } from '@formily/core';
29
+ import { createSchemaField } from '@formily/react';
30
+ import { Button } from 'antd';
31
+ import classNames from 'classnames';
32
+ import React, { useEffect, useMemo, useState } from 'react';
33
+ import QueryForm from "./queryForm";
34
+ import "./index.less";
35
+
36
+ var FormRender = function FormRender(props) {
37
+ var className = props.className,
38
+ gridApi = props.gridApi,
39
+ columns = props.columns,
40
+ onQuery = props.onQuery;
41
+ var form = useMemo(function () {
42
+ return createForm();
43
+ }, []);
44
+ var SchemaField = useMemo(function () {
45
+ return createSchemaField({
46
+ components: {
47
+ QueryForm: QueryForm,
48
+ Input: Input,
49
+ DatePicker: DatePicker,
50
+ FormItem: FormItem,
51
+ FormGrid: FormGrid,
52
+ FormButtonGroup: FormButtonGroup,
53
+ Submit: Submit,
54
+ Button: Button
55
+ }
56
+ });
57
+ }, []);
58
+
59
+ var onSubmit = function onSubmit() {
60
+ form.submit(function (formValues) {
61
+ onQuery(formValues);
62
+ });
63
+ };
64
+
65
+ var onReset = /*#__PURE__*/function () {
66
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
67
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
68
+ while (1) {
69
+ switch (_context.prev = _context.next) {
70
+ case 0:
71
+ _context.next = 2;
72
+ return form.reset();
73
+
74
+ case 2:
75
+ onQuery({});
76
+
77
+ case 3:
78
+ case "end":
79
+ return _context.stop();
80
+ }
81
+ }
82
+ }, _callee);
83
+ }));
84
+
85
+ return function onReset() {
86
+ return _ref.apply(this, arguments);
87
+ };
88
+ }();
89
+
90
+ var _useState = useState({
91
+ type: 'object',
92
+ properties: {}
93
+ }),
94
+ _useState2 = _slicedToArray(_useState, 2),
95
+ schema = _useState2[0],
96
+ setSchema = _useState2[1];
97
+
98
+ var getSchema = function getSchema() {
99
+ var rootSchema = {
100
+ type: 'object',
101
+ properties: {}
102
+ };
103
+
104
+ if (!columns) {
105
+ return rootSchema;
106
+ }
107
+
108
+ var gridSchema = {
109
+ type: 'void',
110
+ "x-component": 'QueryForm',
111
+ "x-component-props": {
112
+ onReset: onReset
113
+ },
114
+ properties: {}
115
+ };
116
+ columns.forEach(function (i, index) {
117
+ i.searchSort = i.getColDef().searchSort === 0 ? i.getColDef().searchSort : i.getColDef().searchSort || index;
118
+ }); //ag-grid 列 添加属性 searchSort,冒泡排序表单
119
+
120
+ for (var i = 0; i < columns.length - 1; i++) {
121
+ for (var j = 0; j < columns.length - 1 - i; j++) {
122
+ if (columns[j].searchSort > columns[j + 1].searchSort) {
123
+ var temp = columns[j];
124
+ columns[j] = columns[j + 1];
125
+ columns[j + 1] = temp;
126
+ }
127
+ }
128
+ }
129
+
130
+ var arr = columns.filter(function (i) {
131
+ return (i === null || i === void 0 ? void 0 : i.visible) != false && !i.getColDef().hideInSearch || i.getColDef().hideInTable;
132
+ });
133
+ arr.map(function (col) {
134
+ var colDef = col.getColDef();
135
+ var name = colDef.field;
136
+ var headerName = colDef.headerName; //表单自定义组件
137
+
138
+ var component = colDef.searchComponent ? colDef.searchComponent : colDef.filter == "agDateColumnFilter" ? "DatePicker.RangePicker" : "Input";
139
+
140
+ if (colDef.filter != false) {
141
+ var _colDef$searchCompone, _colDef$searchCompone2;
142
+
143
+ var filedSchema = {
144
+ type: 'string',
145
+ title: headerName,
146
+ required: (colDef === null || colDef === void 0 ? void 0 : (_colDef$searchCompone = colDef.searchComponentProps) === null || _colDef$searchCompone === void 0 ? void 0 : _colDef$searchCompone.required) || false,
147
+ default: colDef === null || colDef === void 0 ? void 0 : (_colDef$searchCompone2 = colDef.searchComponentProps) === null || _colDef$searchCompone2 === void 0 ? void 0 : _colDef$searchCompone2.default,
148
+ "x-component": component,
149
+ "x-component-props": _objectSpread({
150
+ placeholder: "\u8BF7\u8F93\u5165".concat(headerName),
151
+ allowClear: true,
152
+ style: {
153
+ maxWidth: 200
154
+ }
155
+ }, colDef === null || colDef === void 0 ? void 0 : colDef.searchComponentProps),
156
+ "x-decorator": 'FormItem'
157
+ }; ///@ts-ignore
158
+
159
+ gridSchema.properties[name] = filedSchema;
160
+ }
161
+ }); ///@ts-ignore
162
+
163
+ rootSchema.properties["grid"] = gridSchema;
164
+
165
+ if (!arr.length) {
166
+ ///@ts-ignore
167
+ delete rootSchema.properties["grid"];
168
+ }
169
+
170
+ return rootSchema;
171
+ };
172
+
173
+ useEffect(function () {
174
+ var new_schema = getSchema();
175
+ setSchema(new_schema);
176
+ }, [columns]);
177
+ return /*#__PURE__*/React.createElement("div", {
178
+ className: classNames(className, "ag-grid-table-search ag-grid-table-search-query-filter")
179
+ }, /*#__PURE__*/React.createElement(Form, {
180
+ form: form,
181
+ labelWidth: 100,
182
+ feedbackLayout: "none",
183
+ onAutoSubmit: onSubmit
184
+ }, /*#__PURE__*/React.createElement(SchemaField, {
185
+ schema: schema
186
+ })));
187
+ };
188
+
189
+ export default FormRender;
@@ -0,0 +1,48 @@
1
+
2
+ @pro-table-search-prefix-cls: ~'ag-grid-table-search';
3
+
4
+ @pro-table-form-prefix-cls: ~'ag-grid-table-form';
5
+
6
+ .@{pro-table-search-prefix-cls} {
7
+ margin-bottom: 8px;
8
+ padding: 8px;
9
+ // padding-bottom: 0;
10
+ background-color: #fff;
11
+
12
+ &.@{pro-table-form-prefix-cls} {
13
+ margin: 0;
14
+ padding: 0 16px;
15
+ overflow: unset;
16
+ }
17
+
18
+ &-light {
19
+ margin-bottom: 0;
20
+ padding: 16px 0;
21
+ }
22
+
23
+ &-form-option {
24
+ .ant-form-item {
25
+ margin: 0;
26
+ }
27
+
28
+ .ant-form-item-label {
29
+ opacity: 0;
30
+ }
31
+
32
+ .ant-form-item-control-input {
33
+ justify-content: flex-start;
34
+ }
35
+ }
36
+ }
37
+
38
+ @media (max-width: 575px) {
39
+ .@{pro-table-search-prefix-cls} {
40
+ height: auto !important;
41
+ padding-bottom: 24px;
42
+
43
+ .ant-form-item-label {
44
+ min-width: 80px;
45
+ text-align: left;
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const QueryForm: React.FC;
3
+ export default QueryForm;
@@ -0,0 +1,92 @@
1
+ import React, { useMemo, Fragment } from 'react';
2
+ import { FormGrid, Submit, FormButtonGroup } from '@formily/antd';
3
+ import { DownOutlined } from '@ant-design/icons';
4
+ import { Button } from 'antd';
5
+ import { observer } from '@formily/react';
6
+
7
+ var useCollapseGrid = function useCollapseGrid(maxRows) {
8
+ var grid = useMemo(function () {
9
+ return FormGrid.createFormGrid({
10
+ maxColumns: 5,
11
+ maxWidth: 240,
12
+ maxRows: maxRows,
13
+ shouldVisible: function shouldVisible(node, grid) {
14
+ if (node.index === grid.childSize - 1) return true;
15
+ if (grid.maxRows === Infinity) return true;
16
+ return node.shadowRow < maxRows + 1 && node.index < grid.maxColumns - 1;
17
+ }
18
+ });
19
+ }, []);
20
+ var expanded = grid.maxRows === Infinity;
21
+ var realRows = grid.shadowRows;
22
+ var computeRows = grid.fullnessLastColumn ? grid.shadowRows - 1 : grid.shadowRows;
23
+
24
+ var toggle = function toggle() {
25
+ if (grid.maxRows === Infinity) {
26
+ grid.maxRows = maxRows;
27
+ } else {
28
+ grid.maxRows = Infinity;
29
+ }
30
+ };
31
+
32
+ var takeType = function takeType() {
33
+ if (realRows < maxRows + 1) return 'incomplete-wrap';
34
+ if (computeRows > maxRows) return 'collapsible';
35
+ return 'complete-wrap';
36
+ };
37
+
38
+ return {
39
+ grid: grid,
40
+ expanded: expanded,
41
+ toggle: toggle,
42
+ type: takeType()
43
+ };
44
+ };
45
+
46
+ var QueryForm = observer(function (props) {
47
+ var onReset = props.onReset;
48
+
49
+ var _useCollapseGrid = useCollapseGrid(1),
50
+ grid = _useCollapseGrid.grid,
51
+ expanded = _useCollapseGrid.expanded,
52
+ toggle = _useCollapseGrid.toggle,
53
+ type = _useCollapseGrid.type;
54
+
55
+ var renderActions = function renderActions() {
56
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Submit, null, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Button, {
57
+ onClick: onReset
58
+ }, "\u91CD\u7F6E"));
59
+ };
60
+
61
+ var renderExpanded = function renderExpanded() {
62
+ return /*#__PURE__*/React.createElement("a", {
63
+ onClick: function onClick(e) {
64
+ e.preventDefault();
65
+ toggle();
66
+ }
67
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, expanded ? '收起' : '展开', /*#__PURE__*/React.createElement(DownOutlined, {
68
+ style: {
69
+ marginLeft: '0.5em',
70
+ transition: '0.3s all',
71
+ transform: "rotate(".concat(expanded ? 0 : 0.5, "turn)")
72
+ }
73
+ })));
74
+ };
75
+
76
+ var renderButtonGroup = function renderButtonGroup() {
77
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(FormButtonGroup, {
78
+ align: "right"
79
+ }, renderActions(), type === 'collapsible' ? renderExpanded() : null));
80
+ };
81
+
82
+ return /*#__PURE__*/React.createElement(FormGrid, {
83
+ grid: grid
84
+ }, props.children, /*#__PURE__*/React.createElement(FormGrid.GridColumn, {
85
+ gridSpan: -1,
86
+ style: {
87
+ display: 'flex',
88
+ justifyContent: 'right'
89
+ }
90
+ }, renderButtonGroup()));
91
+ });
92
+ export default QueryForm;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { AgGridReactProps, AgGridColumnProps } from 'ag-grid-react';
3
+ import { ArrayBaseMixins } from '@formily/antd';
4
+ import '@ag-grid-community/core/dist/styles/ag-grid.css';
5
+ import '@ag-grid-community/core/dist/styles/ag-theme-alpine.css';
6
+ declare type ComposedArrayTable = React.FC<React.PropsWithChildren<AgGridReactProps>> & ArrayBaseMixins & {
7
+ Column?: React.FC<React.PropsWithChildren<AgGridColumnProps>>;
8
+ };
9
+ export declare const ArrayTable: ComposedArrayTable;
10
+ export default ArrayTable;