@quansitech/antd-admin 1.2.9 → 1.3.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.
@@ -73,39 +73,47 @@ export function modalShow(_x) {
73
73
  }
74
74
  function _modalShow() {
75
75
  _modalShow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
76
- var props, res, _options$content, Component, _afterClose, modal;
76
+ var props, r, res, _options$content, Component, _afterClose, modal;
77
77
  return _regeneratorRuntime().wrap(function _callee$(_context) {
78
78
  while (1) switch (_context.prev = _context.next) {
79
79
  case 0:
80
80
  props = options.content.props;
81
- if (!options.content.url) {
82
- _context.next = 8;
81
+ if (options.content.url) {
82
+ options.content.request = {
83
+ method: 'get',
84
+ url: options.content.url
85
+ };
86
+ }
87
+ if (!options.content.request) {
88
+ _context.next = 10;
83
89
  break;
84
90
  }
85
- _context.next = 4;
91
+ r = options.content.request;
92
+ _context.next = 6;
86
93
  return http({
87
- method: 'get',
88
- url: options.content.url,
94
+ method: r.method,
95
+ url: r.url,
96
+ data: r.data,
89
97
  headers: {
90
98
  'X-Modal': '1'
91
99
  }
92
100
  });
93
- case 4:
101
+ case 6:
94
102
  res = _context.sent;
95
103
  if (!(typeof res.data === 'string')) {
96
- _context.next = 7;
104
+ _context.next = 9;
97
105
  break;
98
106
  }
99
107
  throw new Error('modal response is not vail');
100
- case 7:
108
+ case 9:
101
109
  props = res.data;
102
- case 8:
110
+ case 10:
103
111
  if (props) {
104
- _context.next = 10;
112
+ _context.next = 12;
105
113
  break;
106
114
  }
107
115
  throw new Error('modal props is empty');
108
- case 10:
116
+ case 12:
109
117
  if (props.type === 'table') {
110
118
  if (typeof props.ajaxRequest === 'undefined') {
111
119
  props.ajaxRequest = true;
@@ -141,7 +149,7 @@ function _modalShow() {
141
149
  destroy: modal.destroy,
142
150
  update: modal.update
143
151
  });
144
- case 15:
152
+ case 17:
145
153
  case "end":
146
154
  return _context.stop();
147
155
  }
@@ -250,6 +258,17 @@ export function diffTree(tree1, tree2, childKey) {
250
258
  }
251
259
  return res;
252
260
  }
261
+ export function treeToList(tree, childKey) {
262
+ var res = [];
263
+ for (var key in tree) {
264
+ var item = tree[key];
265
+ res.push(filterObjectKeys(item, ['children']));
266
+ if (item[childKey]) {
267
+ res.push.apply(res, _toConsumableArray(treeToList(item[childKey], childKey)));
268
+ }
269
+ }
270
+ return res;
271
+ }
253
272
  export function findValuePath(obj, target) {
254
273
  var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
255
274
  for (var key in obj) {
package/dist/types.d.ts CHANGED
@@ -23,5 +23,6 @@ type ModalOptions = {
23
23
  type: 'form' | 'table',
24
24
  props?: any,
25
25
  url?: string,
26
+ request?: RequestOptions,
26
27
  },
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quansitech/antd-admin",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"