@nokecy/qc-ui 0.3.12 → 0.3.14

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.
@@ -73,10 +73,10 @@ var getPosition = function getPosition(random, fontSize) {
73
73
  left: left
74
74
  };
75
75
  };
76
- /*
77
- 生成uuid
78
- len:number 长度
79
- radix:number 进制
76
+ /*
77
+ 生成uuid
78
+ len:number 长度
79
+ radix:number 进制
80
80
  */
81
81
 
82
82
 
@@ -115,10 +115,10 @@ function generateUuid() {
115
115
  }
116
116
 
117
117
  var confirm = _antd.Modal.confirm;
118
- /**
119
- * 异步确认弹窗,抛出确认或取消布尔值
120
- *
121
- * @param {confirmUtilAsyncProps} props
118
+ /**
119
+ * 异步确认弹窗,抛出确认或取消布尔值
120
+ *
121
+ * @param {confirmUtilAsyncProps} props
122
122
  */
123
123
 
124
124
  var confirmUtilAsync = function confirmUtilAsync(props) {
@@ -1,7 +1,7 @@
1
- .react-dashboard-widget {
2
- width: 100%;
3
- height: 100%;
4
- position: relative;
5
- border:1px solid rgba(128,128,128,0.3);
6
- overflow:hidden;
7
- }
1
+ .react-dashboard-widget {
2
+ width: 100%;
3
+ height: 100%;
4
+ position: relative;
5
+ border:1px solid rgba(128,128,128,0.3);
6
+ overflow:hidden;
7
+ }
@@ -1,172 +1,172 @@
1
- .react-dashboard-widget-selector{
2
- position:fixed;
3
- top:50%;
4
- left:50%;
5
- transform:translate(-50%, -50%);
6
- z-index:1006;
7
- width:60%;
8
- height:60%;
9
- max-width:800px;
10
- max-height:600px;
11
- background:var(--component-background);
12
- }
13
-
14
- .react-dashboard-widget-wrap {
15
- display: flex;
16
- height:100%;
17
-
18
- .react-dashboard-widget-leftBar {
19
- padding: 10px;
20
- width: 180px;
21
- border-right: 1px solid rgba(0, 0, 0, 0.1);
22
- background: var(--component-background);
23
- .react-dashboard-widget-searchIcon {
24
- color: var(--text-color);
25
- }
26
-
27
- .react-dashboard-widget-item {
28
- display: flex;
29
- justify-content: space-between;
30
- padding: 10px;
31
-
32
- .react-dashboard-widget-Badge {
33
-
34
- .ant-badge-count {
35
- color: var(--text-color);
36
- background-color: var(--component-background-1) !important;
37
- }
38
-
39
- }
40
-
41
- cursor: pointer;
42
-
43
- &:hover {
44
- background: var(--component-background-3);
45
- font-weight: bold;
46
- }
47
- }
48
-
49
- .react-dashboard-widget-active {
50
- background: rgba(0, 0, 0, 0.03);
51
- font-weight: bold;
52
- }
53
- }
54
-
55
- .react-dashboard-widget-Layer {
56
- flex: 1 1;
57
- overflow-y: auto;
58
- overflow-x: hidden;
59
- padding: 10px;
60
- background: rgba(0, 0, 0, 0.01);
61
- &::-webkit-scrollbar {
62
- width: 1px;
63
- height: 1px;
64
- overflow: auto;
65
- }
66
-
67
- &::-webkit-scrollbar-thumb {
68
- background-color: var(--primary-color);
69
- min-height: 25px;
70
- min-width: 25px;
71
-
72
- &:hover {
73
- background-color: #a8a8a8;
74
- }
75
-
76
- &:active {
77
- background-color: #787878;
78
- }
79
- }
80
-
81
- &::-webkit-scrollbar-track {
82
- background-color: #f7f7f7;
83
- border: 1px solid #efefef;
84
- }
85
-
86
- .react-dashboard-widget-waterfall {
87
- width: 100%;
88
- }
89
-
90
- .ant-popover-inner-content {
91
- background: rgba(0, 0, 0, 0.01);
92
- }
93
-
94
-
95
- .react-dashboard-widget-item {
96
- cursor: pointer;
97
- height: auto;
98
- margin-bottom: 10px;
99
- width: 100%;
100
- height: auto;
101
- border-radius: 5px;
102
- overflow: hidden;
103
- // box-shadow: 0 0 0px rgba(255, 255, 255, 1);
104
- transition: all 0.3s;
105
- border: 1px solid rgba(0, 0, 0, 0.1);
106
- -webkit-column-break-inside: avoid;
107
- position: relative;
108
- background: var(--component-background);
109
- .react-dashboard-widget-shortcut {
110
- width: 100%;
111
- height: auto;
112
- }
113
-
114
- .react-dashboard-widget-mask {
115
- opacity: 0;
116
- position: absolute;
117
- top: 0;
118
- left: 0;
119
- width: 100%;
120
- height: 100%;
121
- background: rgba(0, 0, 0, 0.5);
122
- display: flex;
123
- justify-content: center;
124
- align-items: center;
125
- transition: all 0.3s;
126
- }
127
-
128
- &:hover {
129
- transition: all 0.3s;
130
-
131
- border: 1px solid var(--component-background-3);
132
-
133
- .react-dashboard-widget-mask {
134
- opacity: 1;
135
- transition: all 0.3s;
136
- }
137
- }
138
-
139
- .react-dashboard-widget-bottombar {
140
- border-top: 1px solid rgba(0, 0, 0, 0.1);
141
- width: 100%;
142
-
143
- padding: 5px;
144
-
145
- .react-dashboard-widget-iconWrap {
146
- display: inline-block;
147
- width: 28px;
148
- height: 28px;
149
- line-height: 28px;
150
- text-align: center;
151
- border-radius: 7px;
152
- color: #fff;
153
- margin-right: 5px;
154
- font-size: 16px;
155
- }
156
-
157
- .react-dashboard-widget-name {
158
- font-size: 16px;
159
- flex: 1;
160
- color: var(--text-color);
161
- line-height: 28px;
162
- font-weight: bold;
163
- display: inline;
164
- }
165
-
166
- .react-dashboard-widget-description {
167
- margin-top: 5px;
168
- }
169
- }
170
- }
171
- }
172
- }
1
+ .react-dashboard-widget-selector{
2
+ position:fixed;
3
+ top:50%;
4
+ left:50%;
5
+ transform:translate(-50%, -50%);
6
+ z-index:1006;
7
+ width:60%;
8
+ height:60%;
9
+ max-width:800px;
10
+ max-height:600px;
11
+ background:var(--component-background);
12
+ }
13
+
14
+ .react-dashboard-widget-wrap {
15
+ display: flex;
16
+ height:100%;
17
+
18
+ .react-dashboard-widget-leftBar {
19
+ padding: 10px;
20
+ width: 180px;
21
+ border-right: 1px solid rgba(0, 0, 0, 0.1);
22
+ background: var(--component-background);
23
+ .react-dashboard-widget-searchIcon {
24
+ color: var(--text-color);
25
+ }
26
+
27
+ .react-dashboard-widget-item {
28
+ display: flex;
29
+ justify-content: space-between;
30
+ padding: 10px;
31
+
32
+ .react-dashboard-widget-Badge {
33
+
34
+ .ant-badge-count {
35
+ color: var(--text-color);
36
+ background-color: var(--component-background-1) !important;
37
+ }
38
+
39
+ }
40
+
41
+ cursor: pointer;
42
+
43
+ &:hover {
44
+ background: var(--component-background-3);
45
+ font-weight: bold;
46
+ }
47
+ }
48
+
49
+ .react-dashboard-widget-active {
50
+ background: rgba(0, 0, 0, 0.03);
51
+ font-weight: bold;
52
+ }
53
+ }
54
+
55
+ .react-dashboard-widget-Layer {
56
+ flex: 1 1;
57
+ overflow-y: auto;
58
+ overflow-x: hidden;
59
+ padding: 10px;
60
+ background: rgba(0, 0, 0, 0.01);
61
+ &::-webkit-scrollbar {
62
+ width: 1px;
63
+ height: 1px;
64
+ overflow: auto;
65
+ }
66
+
67
+ &::-webkit-scrollbar-thumb {
68
+ background-color: var(--primary-color);
69
+ min-height: 25px;
70
+ min-width: 25px;
71
+
72
+ &:hover {
73
+ background-color: #a8a8a8;
74
+ }
75
+
76
+ &:active {
77
+ background-color: #787878;
78
+ }
79
+ }
80
+
81
+ &::-webkit-scrollbar-track {
82
+ background-color: #f7f7f7;
83
+ border: 1px solid #efefef;
84
+ }
85
+
86
+ .react-dashboard-widget-waterfall {
87
+ width: 100%;
88
+ }
89
+
90
+ .ant-popover-inner-content {
91
+ background: rgba(0, 0, 0, 0.01);
92
+ }
93
+
94
+
95
+ .react-dashboard-widget-item {
96
+ cursor: pointer;
97
+ height: auto;
98
+ margin-bottom: 10px;
99
+ width: 100%;
100
+ height: auto;
101
+ border-radius: 5px;
102
+ overflow: hidden;
103
+ // box-shadow: 0 0 0px rgba(255, 255, 255, 1);
104
+ transition: all 0.3s;
105
+ border: 1px solid rgba(0, 0, 0, 0.1);
106
+ -webkit-column-break-inside: avoid;
107
+ position: relative;
108
+ background: var(--component-background);
109
+ .react-dashboard-widget-shortcut {
110
+ width: 100%;
111
+ height: auto;
112
+ }
113
+
114
+ .react-dashboard-widget-mask {
115
+ opacity: 0;
116
+ position: absolute;
117
+ top: 0;
118
+ left: 0;
119
+ width: 100%;
120
+ height: 100%;
121
+ background: rgba(0, 0, 0, 0.5);
122
+ display: flex;
123
+ justify-content: center;
124
+ align-items: center;
125
+ transition: all 0.3s;
126
+ }
127
+
128
+ &:hover {
129
+ transition: all 0.3s;
130
+
131
+ border: 1px solid var(--component-background-3);
132
+
133
+ .react-dashboard-widget-mask {
134
+ opacity: 1;
135
+ transition: all 0.3s;
136
+ }
137
+ }
138
+
139
+ .react-dashboard-widget-bottombar {
140
+ border-top: 1px solid rgba(0, 0, 0, 0.1);
141
+ width: 100%;
142
+
143
+ padding: 5px;
144
+
145
+ .react-dashboard-widget-iconWrap {
146
+ display: inline-block;
147
+ width: 28px;
148
+ height: 28px;
149
+ line-height: 28px;
150
+ text-align: center;
151
+ border-radius: 7px;
152
+ color: #fff;
153
+ margin-right: 5px;
154
+ font-size: 16px;
155
+ }
156
+
157
+ .react-dashboard-widget-name {
158
+ font-size: 16px;
159
+ flex: 1;
160
+ color: var(--text-color);
161
+ line-height: 28px;
162
+ font-weight: bold;
163
+ display: inline;
164
+ }
165
+
166
+ .react-dashboard-widget-description {
167
+ margin-top: 5px;
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
@@ -1,4 +1,4 @@
1
- var _excluded = ["style", "loading", "params", "request", "dataSource", "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", "gridColumnState", "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
 
@@ -48,6 +48,7 @@ function AgGridPlus(props) {
48
48
  gridParams = props.params,
49
49
  request = props.request,
50
50
  dataSource = props.dataSource,
51
+ treeKeyName = props.treeKeyName,
51
52
  treeParentName = props.treeParentName,
52
53
  propRowData = props.rowData,
53
54
  propsGridRef = props.gridRef,
@@ -264,7 +265,7 @@ function AgGridPlus(props) {
264
265
  return !columnProps ? props.columnDefs ? props.columnDefs : [] : columnProps;
265
266
  }, [props.columnDefs]);
266
267
  var rowDataMemo = useMemo(function () {
267
- return props.treeData ? flatten(toTree(rowData), treeParentName) : rowData;
268
+ return props.treeData ? flatten(toTree(rowData, treeParentName !== null && treeParentName !== void 0 ? treeParentName : "id", treeParentName !== null && treeParentName !== void 0 ? treeParentName : "parentId"), treeParentName) : rowData;
268
269
  }, [rowData, props.treeData]);
269
270
  return /*#__PURE__*/React.createElement(Spin, {
270
271
  spinning: loading,
@@ -12,6 +12,7 @@ interface GridProps extends AgGridReactProps {
12
12
  loading?: boolean;
13
13
  request?: (params: any, sort: any, filter: any) => Promise<any>;
14
14
  dataSource?: any[];
15
+ treeKeyName?: string;
15
16
  treeParentName?: string;
16
17
  search?: boolean;
17
18
  headerTitle?: React.ReactNode;
@@ -6,6 +6,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
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
8
 
9
+ 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; }
10
+
11
+ 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); } }
12
+
13
+ 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); }); }; }
14
+
9
15
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
16
 
11
17
  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."); }
@@ -18,12 +24,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
18
24
 
19
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
26
 
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
27
  import { DatePicker, FormButtonGroup, FormGrid, FormItem, Form, Input, Submit } from '@formily/antd-v5';
28
28
  import { createForm } from '@formily/core';
29
29
  import { createSchemaField } from '@formily/react';
@@ -41,20 +41,17 @@ var FormRender = function FormRender(props) {
41
41
  columnStates = props.columnStates,
42
42
  onQuery = props.onQuery;
43
43
 
44
- var getFormComponents = function getFormComponents() {
45
- var columnDefs = gridApi === null || gridApi === void 0 ? void 0 : gridApi.getColumnDefs();
46
- var components = {};
47
-
48
- if (columnDefs) {
49
- return columnDefs.map(function (x) {
50
- return x.searchComponent;
51
- });
52
- }
53
- };
44
+ var _useState = useState({
45
+ type: 'object',
46
+ properties: {}
47
+ }),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ schema = _useState2[0],
50
+ setSchema = _useState2[1];
54
51
 
55
52
  var form = useMemo(function () {
56
53
  return createForm();
57
- }, []);
54
+ }, [schema]);
58
55
  var SchemaField = useMemo(function () {
59
56
  return createSchemaField({
60
57
  components: {
@@ -69,7 +66,7 @@ var FormRender = function FormRender(props) {
69
66
  BoolSelect: BoolSelect
70
67
  }
71
68
  });
72
- }, []);
69
+ }, [schema]);
73
70
 
74
71
  var onSubmit = function onSubmit() {
75
72
  onQuery && onQuery(form.values);
@@ -100,14 +97,6 @@ var FormRender = function FormRender(props) {
100
97
  };
101
98
  }();
102
99
 
103
- var _useState = useState({
104
- type: 'object',
105
- properties: {}
106
- }),
107
- _useState2 = _slicedToArray(_useState, 2),
108
- schema = _useState2[0],
109
- setSchema = _useState2[1];
110
-
111
100
  var getComponent = function getComponent(colDef) {
112
101
  var component = colDef.searchComponent ? colDef.searchComponent : undefined;
113
102
 
@@ -153,6 +142,7 @@ var FormRender = function FormRender(props) {
153
142
  return x.colId == colDef.field;
154
143
  });
155
144
  var columnDefs = gridApi === null || gridApi === void 0 ? void 0 : gridApi.getColumnDef(colDef.field);
145
+ console.log("columnDefs", columnDefs);
156
146
  return _objectSpread(_objectSpread(_objectSpread({}, colDef), columnDefs), state);
157
147
  });
158
148
  columns = columns ? (_columns = columns) === null || _columns === void 0 ? void 0 : _columns.filter(function (i) {
@@ -4,6 +4,6 @@ declare const convertSortModel: (sortModel: any[]) => string;
4
4
  declare const dateValueFormatter: (params: ValueFormatterParams) => string;
5
5
  declare const dateTimeValueFormatter: (params: ValueFormatterParams) => string;
6
6
  declare const flatten: (arr: any[], parentPropName: any, parentref?: any[]) => any;
7
- declare const toTree: (data: any[]) => any[];
7
+ declare const toTree: (data: any[], keyName: any, parentKeyName: any) => any[];
8
8
  declare const flattenTreeDeep: (treeData: any[], childrenName?: string) => any[];
9
9
  export { dateValueFormatter, dateTimeValueFormatter, convertFilterModel, convertSortModel, flattenTreeDeep, toTree, flatten };
@@ -114,7 +114,7 @@ var flatten = function flatten(arr, parentPropName, parentref) {
114
114
  return data;
115
115
  };
116
116
 
117
- var toTree = function toTree(data) {
117
+ var toTree = function toTree(data, keyName, parentKeyName) {
118
118
  // 删除 所有 children,以防止多次调用
119
119
  data.forEach(function (item) {
120
120
  delete item.children;
@@ -122,12 +122,12 @@ var toTree = function toTree(data) {
122
122
 
123
123
  var map = {};
124
124
  data.forEach(function (item) {
125
- map[item.id] = item;
125
+ map[item[keyName]] = item;
126
126
  });
127
127
  var val = [];
128
128
  data.forEach(function (item) {
129
129
  // 以当前遍历项,的pid,去map对象中找到索引的id
130
- var parent = map[item.parentId]; // 好绕啊,如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
130
+ var parent = map[item[parentKeyName]]; // 好绕啊,如果找到索引,那么说明此项不在顶级当中,那么需要把此项添加到,他对应的父级中
131
131
 
132
132
  if (parent) {
133
133
  (parent.children || (parent.children = [])).push(item);