ronds-metadata 1.3.49 → 1.3.50

Sign up to get free protection for your applications and to get access to all the features.
package/es/api/index.js CHANGED
@@ -5,12 +5,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  /*
6
6
  * @Author:wangxian
7
7
  * @Date: 2021-09-18 14:15:04
8
- * @LastEditTime: 2023-11-21 18:51:09
8
+ * @LastEditTime: 2024-07-03 16:02:30
9
9
  */
10
10
  import { guid, md5 } from '../utils';
11
11
  import { addInterceptor, HttpHelper } from '../framework/http';
12
12
  var http = new HttpHelper();
13
- var token = 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkNBMzFBMEJDMkQ5M0I3RkVFOTBDMDkwMDI4MUVBMTlEIiwidHlwIjoiYXQrand0In0.eyJuYmYiOjE2NzAyODgzMTksImV4cCI6MTcwMTgyNDMxOSwiaXNzIjoiaHR0cDovLzE5Mi4xNjguMS4xNzk6MzEwMDIiLCJhdWQiOiJlcG0iLCJjbGllbnRfaWQiOiJlcG0iLCJzdWIiOiIzYTAyZTY3Zi1mYzNjLWU2YjQtYTFjNC1jOTEzOWE1NjM3OTUiLCJhdXRoX3RpbWUiOjE2NzAyODgzMTksImlkcCI6ImxvY2FsIiwicm9sZSI6InBobV9hZG1pbiIsInBob25lX251bWJlciI6IjEyMzQ1NiIsInBob25lX251bWJlcl92ZXJpZmllZCI6IkZhbHNlIiwiZW1haWwiOiJwaG1AYWJwLmlvIiwiZW1haWxfdmVyaWZpZWQiOiJGYWxzZSIsIm5hbWUiOiJwaG0iLCJpYXQiOjE2NzAyODgzMTksInNjb3BlIjpbImFkZHJlc3MiLCJlbWFpbCIsImVwbSIsIm9wZW5pZCIsInBob25lIiwicHJvZmlsZSIsInJvbGUiLCJvZmZsaW5lX2FjY2VzcyJdLCJhbXIiOlsicHdkIl19.J1FKumhVm8zRAAqk61-4_LxjIz7gSehrAWhTKj0BPExZytQhLe8vLjGpXtLL-n_j3JE2eDz8____0afXdC5LaD_b6z-Wxyowe0BdCgGCRxAZDV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1cXXr8EORukCeaDlqnrnzPixSR0kpEi9-PSv4YEdJUq-63DcUkHN5wJAPKivMJnrr562WPJLZDUc9kh9AIzLXaSw5SlA0djW28TOJaDqGqA52Gewh4rtzhkxwEsoUYUMPbu9G3tQuhWvxJ4HkfMvbnhb9vUalSL5RMlCb04diLgacTEGAu-aNznIC7svlWGbmWBv2FtVjvMa42MtTBm9jOoIRfV2JzPcXd-VWz5tn3pcLm3QuacsMLM2n1YI_AWqvkWm9tv9wvDbLbJqFRxYJ3OPRjj46VJFLtydG1dP7Jy29KGRT2Mw';
14
14
  addInterceptor(function (httpClient) {
15
15
  httpClient.interceptors.request.use(function (_config) {
16
16
  if (!_config.headers) {
@@ -9,14 +9,18 @@ import "antd/es/button/style";
9
9
  import _Button from "antd/es/button";
10
10
  import "antd/es/date-picker/style";
11
11
  import _DatePicker from "antd/es/date-picker";
12
+ import "antd/es/auto-complete/style";
13
+ import _AutoComplete from "antd/es/auto-complete";
14
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
12
15
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
16
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
17
  import "antd/es/input/style";
15
18
  import _Input from "antd/es/input";
19
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
16
20
  /*
17
21
  * @Author: wangxian
18
22
  * @Date: 2021-09-18 14:15:04
19
- * @LastEditTime: 2024-04-17 13:41:48
23
+ * @LastEditTime: 2024-07-03 16:04:03
20
24
  */
21
25
  import React from 'react';
22
26
  import { UploadOutlined } from '@ant-design/icons';
@@ -25,6 +29,8 @@ import { useGetExtraInfo } from '../hooks';
25
29
  import useObservable from '../../../framework/rxjs-hooks/useObservable';
26
30
  import NumberRange from './plugin/NumberRange';
27
31
  import { tr } from '../../../framework/locale';
32
+ import { useAsyncMemo } from '@/framework/hooks/use-async-memo';
33
+ import { MetadataService } from '@/framework/metadata/MetadataService';
28
34
  var TextArea = _Input.TextArea;
29
35
  function Index(props) {
30
36
  var _extraInfo$addonAfter7;
@@ -80,12 +86,66 @@ function Index(props) {
80
86
  setRules(_toConsumableArray(_));
81
87
  }
82
88
  }, [extraInfo]);
89
+ var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
90
+ var _autoComplete$http;
91
+ var autoComplete, _options, _autoComplete$http2, _autoComplete$http3, _autoComplete$http4, _autoComplete$http5, server, res;
92
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
93
+ while (1) switch (_context.prev = _context.next) {
94
+ case 0:
95
+ autoComplete = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.autoComplete;
96
+ _options = [];
97
+ if (!(autoComplete === null || autoComplete === void 0 ? void 0 : autoComplete.enum)) {
98
+ _context.next = 4;
99
+ break;
100
+ }
101
+ return _context.abrupt("return", autoComplete === null || autoComplete === void 0 ? void 0 : autoComplete.enum);
102
+ case 4:
103
+ if (!(autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http = autoComplete.http) === null || _autoComplete$http === void 0 ? void 0 : _autoComplete$http.url)) {
104
+ _context.next = 11;
105
+ break;
106
+ }
107
+ server = new MetadataService();
108
+ _context.next = 8;
109
+ return server.GetEnumDataByUrl(autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http2 = autoComplete.http) === null || _autoComplete$http2 === void 0 ? void 0 : _autoComplete$http2.url, autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http3 = autoComplete.http) === null || _autoComplete$http3 === void 0 ? void 0 : _autoComplete$http3.method, (autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http4 = autoComplete.http) === null || _autoComplete$http4 === void 0 ? void 0 : _autoComplete$http4.body) && JSON.parse(autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http5 = autoComplete.http) === null || _autoComplete$http5 === void 0 ? void 0 : _autoComplete$http5.body));
110
+ case 8:
111
+ res = _context.sent;
112
+ if (!(res && res.length > 0)) {
113
+ _context.next = 11;
114
+ break;
115
+ }
116
+ return _context.abrupt("return", res.map(function (it) {
117
+ var _autoComplete$http6;
118
+ return {
119
+ value: it[(autoComplete === null || autoComplete === void 0 ? void 0 : (_autoComplete$http6 = autoComplete.http) === null || _autoComplete$http6 === void 0 ? void 0 : _autoComplete$http6.value) || 'name']
120
+ };
121
+ }));
122
+ case 11:
123
+ return _context.abrupt("return", _options);
124
+ case 12:
125
+ case "end":
126
+ return _context.stop();
127
+ }
128
+ }, _callee);
129
+ })), [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.autoComplete]);
83
130
  var processInputType = function processInputType(_type) {
84
- var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5, _extraInfo$disabled6, _extraInfo$addonAfter2, _extraInfo$addonAfter3, _extraInfo$addonAfter4, _extraInfo$addonAfter5, _extraInfo$disabled7;
131
+ var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5, _extraInfo$disabled6, _extraInfo$disabled7, _extraInfo$addonAfter2, _extraInfo$addonAfter3, _extraInfo$addonAfter4, _extraInfo$addonAfter5, _extraInfo$disabled8;
85
132
  switch (_type) {
133
+ case 'autoComplete':
134
+ return /*#__PURE__*/React.createElement(_AutoComplete, {
135
+ options: httpOptions,
136
+ style: {
137
+ width: 200
138
+ },
139
+ filterOption: function filterOption(inputValue, option) {
140
+ var _option$value;
141
+ return ((_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.toString().toUpperCase().indexOf(inputValue.toUpperCase())) !== -1;
142
+ },
143
+ disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
144
+ placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
145
+ });
86
146
  case 'password':
87
147
  return /*#__PURE__*/React.createElement(_Input.Password, {
88
- disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
148
+ disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
89
149
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
90
150
  });
91
151
  case 'textarea':
@@ -94,13 +154,13 @@ function Index(props) {
94
154
  showCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.showCount,
95
155
  maxLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxLength,
96
156
  rows: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.textareaRows) || 4,
97
- disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
157
+ disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
98
158
  placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
99
159
  });
100
160
  case 'colorPicker':
101
161
  return /*#__PURE__*/React.createElement(_Input, {
102
162
  type: "color",
103
- disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
163
+ disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
104
164
  placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
105
165
  });
106
166
  case 'datePicker':
@@ -110,7 +170,7 @@ function Index(props) {
110
170
  React.createElement(_DatePicker, {
111
171
  showTime: true,
112
172
  format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
113
- disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
173
+ disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
114
174
  placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder)
115
175
  })
116
176
  );
@@ -123,12 +183,12 @@ function Index(props) {
123
183
  }, 1000);
124
184
  }
125
185
  }, /*#__PURE__*/React.createElement(_Button, {
126
- disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
186
+ disabled: (_extraInfo$disabled6 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled6 !== void 0 ? _extraInfo$disabled6 : disabled,
127
187
  icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
128
188
  }, tr('上传')));
129
189
  case 'numberRange':
130
190
  return /*#__PURE__*/React.createElement(NumberRange, _extends({}, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.numberRange, {
131
- disabled: (_extraInfo$disabled6 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled6 !== void 0 ? _extraInfo$disabled6 : disabled
191
+ disabled: (_extraInfo$disabled7 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled7 !== void 0 ? _extraInfo$disabled7 : disabled
132
192
  }));
133
193
  default:
134
194
  return /*#__PURE__*/React.createElement(_Input, {
@@ -144,7 +204,7 @@ function Index(props) {
144
204
  }))) : undefined,
145
205
  showCount: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.showCount,
146
206
  maxLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxLength,
147
- disabled: (_extraInfo$disabled7 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled7 !== void 0 ? _extraInfo$disabled7 : disabled,
207
+ disabled: (_extraInfo$disabled8 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled8 !== void 0 ? _extraInfo$disabled8 : disabled,
148
208
  placeholder: tr(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder),
149
209
  title: tr(valueTitle),
150
210
  allowClear: true
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.49",
4
+ "version": "1.3.50",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",