vap1 0.2.3 → 0.2.4

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 (268) hide show
  1. package/components/Box/Box.js +75 -42
  2. package/components/Box/SelectBar.js +51 -24
  3. package/components/Box/_register.d.ts +4 -0
  4. package/components/Box/_register.js +10 -8
  5. package/components/Box/index.js +1 -1
  6. package/components/Lists/SList.js +76 -48
  7. package/components/SearchBar/ActionButtons.js +75 -42
  8. package/components/SearchBar/ByField.js +80 -52
  9. package/components/SearchBar/ByKeyword.js +44 -17
  10. package/components/SearchBar/SearchField.js +8 -8
  11. package/components/SearchBar/SearchTags.js +4 -4
  12. package/components/SearchBar/_register.js +9 -8
  13. package/components/SearchBar/index.js +22 -11
  14. package/components/Tables/ApiTable.d.ts +1 -1
  15. package/components/Tables/ApiTable.js +19 -8
  16. package/components/Tables/ApiTableModal.d.ts +1 -1
  17. package/components/Tables/ApiTableModal.js +40 -13
  18. package/components/Tables/Components/ActionBar.js +53 -26
  19. package/components/Tables/Components/Actions.js +40 -29
  20. package/components/Tables/Components/Summary.js +2 -2
  21. package/components/Tables/Components/index.js +3 -3
  22. package/components/Tables/STable.js +21 -10
  23. package/components/Tables/TopTable.d.ts +3 -2
  24. package/components/Tables/TopTable.js +64 -37
  25. package/components/Tables/TopTableModal.js +21 -10
  26. package/components/Tables/Util.d.ts +2 -2
  27. package/components/Tables/Util.js +11 -9
  28. package/components/Tables/VTable.d.ts +2 -2
  29. package/components/Tables/VTable.js +137 -65
  30. package/components/Tables/index.d.ts +7 -2
  31. package/components/Tables/index.js +5 -5
  32. package/components/TreeSelect/BaseTreeSelect.js +81 -45
  33. package/components/TreeSelect/DTreeSelect.js +191 -66
  34. package/components/TreeSelect/FTreeSelect.js +67 -20
  35. package/components/TreeSelect/STreeSelect.js +22 -11
  36. package/components/Trees/ActionTree.js +562 -431
  37. package/components/Trees/BaseTree.js +85 -38
  38. package/components/Trees/COTree/COButton.js +48 -21
  39. package/components/Trees/COTree/COSelect.js +31 -20
  40. package/components/Trees/COTree/COTree.js +223 -107
  41. package/components/Trees/COTree/COTreeUtil.js +160 -115
  42. package/components/Trees/DTree.js +139 -68
  43. package/components/Trees/FTree.js +76 -29
  44. package/components/Trees/STree.js +59 -23
  45. package/components/UForm/FormWrapper.js +70 -53
  46. package/components/UForm/UDescriptions.js +38 -38
  47. package/components/UForm/UForm.js +240 -135
  48. package/components/UForm/UFormModal.js +99 -44
  49. package/components/UForm/UInfo.js +33 -22
  50. package/components/UForm/UInfoModal.js +31 -20
  51. package/components/UForm/UModal.js +40 -13
  52. package/components/UForm/_FormUtils.js +29 -18
  53. package/components/UForm/_input.js +75 -39
  54. package/components/UForm/_register.js +11 -9
  55. package/components/Upload/UploadFile.js +38 -11
  56. package/components/Upload/UploadImage.js +50 -23
  57. package/components/Upload/UploadModal.js +149 -84
  58. package/components/Upload/useUpload.js +35 -19
  59. package/components/_RegisterUtil.js +20 -8
  60. package/components/_adapt/Alert.js +20 -9
  61. package/components/_adapt/Breadcrumb.js +18 -7
  62. package/components/_adapt/Button.js +24 -13
  63. package/components/_adapt/Col.js +34 -23
  64. package/components/_adapt/Collapse.js +21 -10
  65. package/components/_adapt/ColorPicker.js +55 -28
  66. package/components/_adapt/ConfigProvider.js +14 -3
  67. package/components/_adapt/Drawer.js +18 -7
  68. package/components/_adapt/Dropdown.js +23 -12
  69. package/components/_adapt/FloatButton.js +21 -10
  70. package/components/_adapt/Icon.js +18 -7
  71. package/components/_adapt/Input.js +17 -6
  72. package/components/_adapt/InputNumber.js +16 -5
  73. package/components/_adapt/Layout.js +84 -28
  74. package/components/_adapt/Menu.js +28 -17
  75. package/components/_adapt/Modal.js +72 -25
  76. package/components/_adapt/Pagination.js +14 -3
  77. package/components/_adapt/Popconfirm.js +17 -6
  78. package/components/_adapt/Popover.js +17 -6
  79. package/components/_adapt/Progress.js +42 -11
  80. package/components/_adapt/Radio.js +21 -10
  81. package/components/_adapt/Row.js +18 -7
  82. package/components/_adapt/Select.js +54 -43
  83. package/components/_adapt/Slider.js +1 -1
  84. package/components/_adapt/Space.js +2 -2
  85. package/components/_adapt/Table.js +16 -5
  86. package/components/_adapt/Tabs.js +17 -6
  87. package/components/_adapt/Tag.js +19 -8
  88. package/components/_adapt/Tooltip.js +15 -4
  89. package/components/_adapt/TreeSelect.js +18 -7
  90. package/components/_adapt/notification.js +1 -1
  91. package/components/_adapt/todo/Image.js +2 -2
  92. package/components/_adapt/todo/NotEffectOnV15.js +1 -1
  93. package/components/_adapt/todo/Segmented.js +2 -2
  94. package/components/_adapt/utils.js +28 -8
  95. package/components/_common/AutoComplete.js +101 -34
  96. package/components/_common/CountUp.js +30 -14
  97. package/components/_common/DateRange.js +36 -20
  98. package/components/_common/HighLight.js +22 -6
  99. package/components/_common/I18N.js +27 -2
  100. package/components/_common/Loading.js +25 -9
  101. package/components/_common/MonthRange.js +26 -26
  102. package/components/_common/PromiseLabel.js +68 -15
  103. package/components/_common/Role.js +2 -2
  104. package/components/_common/Upagination.js +45 -34
  105. package/components/_setup/Const.js +2 -2
  106. package/components/_setup/I18N/enUS.js +2 -2
  107. package/components/_setup/I18N/zhCN.js +3 -3
  108. package/components/_setup/I18N/zhHK.js +2 -2
  109. package/components/_setup/ICON/IconTypes.js +2 -2
  110. package/components/_setup/SearchField/SearchFieldAdvance.js +22 -11
  111. package/components/_setup/SearchField/SearchFieldDate.js +114 -77
  112. package/components/_setup/SearchField/SearchFieldInput.js +21 -10
  113. package/components/_setup/SearchField/SearchFieldSelect.js +55 -44
  114. package/components/_setup/SearchField/SearchFieldTree.js +63 -52
  115. package/components/_setup/SelectBar/SelectList.js +21 -10
  116. package/components/_setup/SelectBar/SelectTree.js +17 -6
  117. package/components/_setup/UForm/UFormAdvanceInput.js +105 -78
  118. package/components/_setup/UForm/UFormCOTree.js +21 -10
  119. package/components/_setup/UForm/UFormCrontab.js +51 -35
  120. package/components/_setup/UForm/UFormDate.js +158 -122
  121. package/components/_setup/UForm/UFormInput.js +110 -73
  122. package/components/_setup/UForm/UFormJSON.js +95 -57
  123. package/components/_setup/UForm/UFormJSONTable.js +79 -41
  124. package/components/_setup/UForm/UFormOrg.js +112 -48
  125. package/components/_setup/UForm/UFormRole.js +31 -20
  126. package/components/_setup/UForm/UFormSelect.js +106 -79
  127. package/components/_setup/UForm/UFormTree.js +52 -41
  128. package/components/_setup/UForm/UFormUpload.js +62 -34
  129. package/components/_setup/UForm/_utils.js +9 -9
  130. package/deps/JsonView.js +18 -7
  131. package/deps/SpringBoot.js +1 -1
  132. package/deps/SpringCloud.js +4 -4
  133. package/deps/_editor/advance/_Image.js +33 -20
  134. package/deps/_editor/base/Element.js +28 -17
  135. package/deps/_editor/base/Leaf.js +18 -7
  136. package/deps/_editor/base/Support.js +4 -4
  137. package/deps/_editor/i18n.js +1 -1
  138. package/deps/_editor/tools/Button.js +31 -19
  139. package/deps/_editor/tools/ToolBar.js +3 -3
  140. package/deps/_editor/tools/_BlockButton.js +49 -27
  141. package/deps/_editor/tools/_InsertButton.js +32 -28
  142. package/deps/_editor/tools/_MarkButton.js +15 -14
  143. package/deps/_editor/tools/_TxtButton.js +90 -58
  144. package/deps/api-audit.js +1 -1
  145. package/deps/echarts.js +58 -17
  146. package/deps/editor.js +52 -26
  147. package/deps/registerEditor.js +18 -7
  148. package/hooks/_list.js +1 -1
  149. package/hooks/useAjax.js +43 -19
  150. package/hooks/useAjaxAction.js +57 -20
  151. package/hooks/useAjaxQuery.js +121 -51
  152. package/hooks/useApi.js +35 -8
  153. package/hooks/useApiBase.js +291 -184
  154. package/hooks/useApiGlobal.js +40 -13
  155. package/hooks/useApp.js +4 -4
  156. package/hooks/useArray.js +114 -52
  157. package/hooks/useDefault.js +19 -3
  158. package/hooks/useDoLoad.js +25 -9
  159. package/hooks/useEffectFunction.js +4 -3
  160. package/hooks/useEffectOnce.js +5 -5
  161. package/hooks/useError.js +21 -5
  162. package/hooks/useFirstMountState.js +3 -3
  163. package/hooks/useGenkey.js +7 -7
  164. package/hooks/useGetSet.js +9 -9
  165. package/hooks/useGlobal.js +58 -29
  166. package/hooks/useHover.js +25 -9
  167. package/hooks/useMemoPromise.js +62 -22
  168. package/hooks/useModals.js +71 -36
  169. package/hooks/useMountedState.js +6 -6
  170. package/hooks/useOpenState.js +26 -10
  171. package/hooks/usePromise.js +15 -13
  172. package/hooks/useQueue.js +35 -8
  173. package/hooks/useSetState.js +25 -8
  174. package/hooks/useStateList.js +30 -18
  175. package/hooks/useSyncExternalStore.js +31 -15
  176. package/hooks/useToggle.js +6 -3
  177. package/hooks/useUnmountPromise.js +11 -11
  178. package/hooks/useUpdate.js +20 -4
  179. package/hooks/useUpdateEffect.js +5 -5
  180. package/login/Base65.js +15 -14
  181. package/login/Password.js +91 -38
  182. package/login/SM4.js +50 -49
  183. package/login/cems/index.js +2 -2
  184. package/login/jit/index.js +16 -71
  185. package/login/jit/pnxclient.js +6 -4
  186. package/login/vap/index.js +1 -1
  187. package/login/xrtx/index.js +2 -2
  188. package/package.json +1 -1
  189. package/screen/Comment.js +16 -5
  190. package/screen/Page.js +14 -14
  191. package/screen/render.js +2 -2
  192. package/uform/FormEditor.js +43 -26
  193. package/uform/FormViewer.js +30 -19
  194. package/uform/hooks/useEditor.js +83 -47
  195. package/uform/hooks/useForm.js +2 -2
  196. package/uform/index.js +10 -10
  197. package/uform/inputs/_advance.js +12 -12
  198. package/uform/inputs/_date.js +63 -52
  199. package/uform/inputs/_input.js +49 -38
  200. package/uform/inputs/_select.js +53 -42
  201. package/uform/inputs/_specific.js +33 -22
  202. package/uform/inputs/index.js +5 -5
  203. package/uform/inputs/register.js +14 -14
  204. package/uform/panel/Editor/GroupEditor.js +31 -31
  205. package/uform/panel/Editor/ListEditor.js +22 -22
  206. package/uform/panel/Editor/_FieldItems.js +16 -16
  207. package/uform/panel/Editor/_GroupCollapse.js +9 -9
  208. package/uform/panel/Editor/_GroupDefault.js +9 -9
  209. package/uform/panel/Editor/_GroupStep.js +18 -18
  210. package/uform/panel/Editor/_GroupTab.js +16 -16
  211. package/uform/panel/Editor/index.js +17 -17
  212. package/uform/panel/Items/index.js +22 -11
  213. package/uform/panel/Propreties/CanvasProperties.js +14 -14
  214. package/uform/panel/Propreties/Component/FieldPlugin.js +5 -5
  215. package/uform/panel/Propreties/Component/LinkAsyncFunction.js +22 -47
  216. package/uform/panel/Propreties/Component/LinkSyncFunction.js +20 -43
  217. package/uform/panel/Propreties/Component/Links.js +40 -29
  218. package/uform/panel/Propreties/Component/OptionTable.js +97 -52
  219. package/uform/panel/Propreties/Component/RegexpModal.js +11 -11
  220. package/uform/panel/Propreties/Component/Validate.js +35 -24
  221. package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +13 -24
  222. package/uform/panel/Propreties/Component/ValidateSyncFunction.js +15 -38
  223. package/uform/panel/Propreties/FieldOptions.js +78 -44
  224. package/uform/panel/Propreties/FieldProperties.js +47 -20
  225. package/uform/panel/Propreties/GroupProperties.js +9 -9
  226. package/uform/panel/Propreties/_ItemAdvance.js +37 -26
  227. package/uform/panel/Propreties/_ItemBase.js +30 -19
  228. package/uform/panel/Propreties/_ItemLink.js +20 -9
  229. package/uform/panel/Propreties/_ItemValidate.js +33 -22
  230. package/uform/plugins/index.js +7 -7
  231. package/uform/utils/Convert.js +137 -94
  232. package/uform/utils/SchemaConvert.js +43 -68
  233. package/uform/utils/arr.js +103 -75
  234. package/utils/Ajax.d.ts +1 -11
  235. package/utils/Ajax.js +154 -68
  236. package/utils/ArrayUtil.js +14 -12
  237. package/utils/CacheUtil.js +19 -13
  238. package/utils/Const.js +13 -13
  239. package/utils/CustomApp.js +15 -10
  240. package/utils/EventUtil.js +78 -14
  241. package/utils/Format.js +59 -38
  242. package/utils/Global.js +8 -8
  243. package/utils/Logger.js +56 -11
  244. package/utils/PageUtil.d.ts +12 -6
  245. package/utils/PageUtil.js +105 -35
  246. package/utils/Renders/ApiGetRender.js +187 -100
  247. package/utils/Renders/ApiPostRender.js +123 -69
  248. package/utils/Renders/DateRender.js +9 -9
  249. package/utils/Renders/DictRender.js +82 -55
  250. package/utils/Renders/FileRender.js +34 -12
  251. package/utils/Renders/ListRender.js +21 -21
  252. package/utils/Renders/NumberRender.js +14 -13
  253. package/utils/Renders/StatusRender.js +20 -20
  254. package/utils/Renders/StringRender.js +17 -17
  255. package/utils/Renders/_define.d.ts +2 -2
  256. package/utils/Renders/_define.js +7 -7
  257. package/utils/StringUtil.js +98 -67
  258. package/utils/TreeUtil.js +71 -20
  259. package/utils/VAP.js +14 -14
  260. package/utils/XHR.js +27 -11
  261. package/utils/_AjaxUtil.d.ts +10 -0
  262. package/utils/_AjaxUtil.js +35 -12
  263. package/utils/_Support.js +26 -26
  264. package/utils/i18n.js +78 -44
  265. package/utils/index.d.ts +9 -1
  266. package/utils/index.js +34 -5
  267. package/utils/screenful.js +82 -29
  268. package/widget/index.js +4 -4
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,35 +19,62 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
19
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
20
  });
10
21
  };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
11
49
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
51
  };
14
52
  Object.defineProperty(exports, "__esModule", { value: true });
15
53
  exports.ApiPostRender = void 0;
16
- const react_1 = __importDefault(require("react"));
17
- const lodash_1 = __importDefault(require("lodash"));
18
- const index_1 = require("../index");
19
- const XHR_1 = require("../XHR");
20
- const hooks_1 = require("../../hooks");
21
- const _define_1 = require("./_define");
22
- const Const_1 = require("../Const");
23
- const SESSION_KEY = '__API_KV_';
24
- const getInCache = (SESSION, key) => {
54
+ var react_1 = __importDefault(require("react"));
55
+ var lodash_1 = __importDefault(require("lodash"));
56
+ var index_1 = require("../index");
57
+ var XHR_1 = require("../XHR");
58
+ var hooks_1 = require("../../hooks");
59
+ var _define_1 = require("./_define");
60
+ var Const_1 = require("../Const");
61
+ var SESSION_KEY = '__API_KV_';
62
+ var getInCache = function (SESSION, key) {
25
63
  var cache = index_1.CacheUtil.getData(SESSION);
26
- const cacheKey = key + '';
64
+ var cacheKey = key + '';
27
65
  if (!lodash_1.default.has(cache, cacheKey)) {
28
66
  return null;
29
67
  }
30
- let val = lodash_1.default.get(cache, cacheKey);
68
+ var val = lodash_1.default.get(cache, cacheKey);
31
69
  if (val === true) {
32
70
  return null;
33
71
  }
34
72
  return val;
35
73
  };
36
- const getLabel = (props, resp, key) => {
37
- const SESSION = SESSION_KEY + props.api;
74
+ var getLabel = function (props, resp, key) {
75
+ var SESSION = SESSION_KEY + props.api;
38
76
  var cache = index_1.CacheUtil.getData(SESSION);
39
- const cacheKey = key + '';
77
+ var cacheKey = key + '';
40
78
  if (SESSION == null) {
41
79
  index_1.CacheUtil.set(SESSION, {});
42
80
  cache = index_1.CacheUtil.getData(SESSION);
@@ -48,7 +86,7 @@ const getLabel = (props, resp, key) => {
48
86
  }
49
87
  ;
50
88
  var result = false;
51
- const arr = (0, _define_1.getList)(resp);
89
+ var arr = (0, _define_1.getList)(resp);
52
90
  if (arr.length > 0)
53
91
  result = resp.list[0][props.nameField] + '';
54
92
  cache[cacheKey] = result;
@@ -62,50 +100,63 @@ const getLabel = (props, resp, key) => {
62
100
  * API 缓存有 KEY 但 KEY = FALSE 确定无值
63
101
  * API 缓存有值 = 值
64
102
  */
65
- const _ApiPostRender = (props) => {
66
- const update = (0, hooks_1.useUpdate)();
67
- const KEY = SESSION_KEY + props.api;
68
- const cacheKey = props.value + '';
69
- (0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
70
- if (cacheKey == '')
71
- return;
72
- var cache = index_1.CacheUtil.getData(KEY);
73
- // 存在
74
- if (lodash_1.default.has(cache, cacheKey)) {
75
- let txt = lodash_1.default.get(cache, cacheKey);
76
- if (txt !== true)
77
- return;
78
- // 正在请求时,等待一下 最长20秒
79
- let i = 0;
80
- while (txt === true && i < 200) {
81
- i++;
82
- yield index_1.Ajax.WAIT(lodash_1.default.random(50, 150));
83
- cache = index_1.CacheUtil.getData(KEY);
84
- txt = lodash_1.default.get(cache, cacheKey);
85
- }
86
- if (txt !== true) {
87
- update();
88
- return;
103
+ var _ApiPostRender = function (props) {
104
+ var update = (0, hooks_1.useUpdate)();
105
+ var KEY = SESSION_KEY + props.api;
106
+ var cacheKey = props.value + '';
107
+ (0, hooks_1.useEffectFunction)(function () { return __awaiter(void 0, void 0, void 0, function () {
108
+ var cache, txt, i, resp, result;
109
+ var _a;
110
+ return __generator(this, function (_b) {
111
+ switch (_b.label) {
112
+ case 0:
113
+ if (cacheKey == '')
114
+ return [2 /*return*/];
115
+ cache = index_1.CacheUtil.getData(KEY);
116
+ if (!lodash_1.default.has(cache, cacheKey)) return [3 /*break*/, 4];
117
+ txt = lodash_1.default.get(cache, cacheKey);
118
+ if (txt !== true)
119
+ return [2 /*return*/];
120
+ i = 0;
121
+ _b.label = 1;
122
+ case 1:
123
+ if (!(txt === true && i < 200)) return [3 /*break*/, 3];
124
+ i++;
125
+ return [4 /*yield*/, index_1.Ajax.WAIT(lodash_1.default.random(50, 150))];
126
+ case 2:
127
+ _b.sent();
128
+ cache = index_1.CacheUtil.getData(KEY);
129
+ txt = lodash_1.default.get(cache, cacheKey);
130
+ return [3 /*break*/, 1];
131
+ case 3:
132
+ if (txt !== true) {
133
+ update();
134
+ return [2 /*return*/];
135
+ }
136
+ return [2 /*return*/];
137
+ case 4:
138
+ ;
139
+ cache = index_1.CacheUtil.getData(KEY);
140
+ // 不存在
141
+ cache[cacheKey] = true;
142
+ index_1.CacheUtil.set(KEY, cache);
143
+ update();
144
+ return [4 /*yield*/, index_1.Ajax.POST(props.api, __assign(__assign({}, props.param), (_a = {}, _a[props.valueFiled] = props.value, _a)), { process: false })];
145
+ case 5:
146
+ resp = _b.sent();
147
+ result = getLabel(props, resp, cacheKey);
148
+ cache = index_1.CacheUtil.getData(KEY);
149
+ cache[cacheKey] = result;
150
+ index_1.CacheUtil.set(KEY, cache);
151
+ update();
152
+ return [2 /*return*/];
89
153
  }
90
- return;
91
- }
92
- ;
93
- cache = index_1.CacheUtil.getData(KEY);
94
- // 不存在
95
- cache[cacheKey] = true;
96
- index_1.CacheUtil.set(KEY, cache);
97
- update();
98
- const resp = yield index_1.Ajax.POST(props.api, Object.assign(Object.assign({}, props.param), { [props.valueFiled]: props.value }), { process: false });
99
- const result = getLabel(props, resp, cacheKey);
100
- cache = index_1.CacheUtil.getData(KEY);
101
- cache[cacheKey] = result;
102
- index_1.CacheUtil.set(KEY, cache);
103
- update();
104
- }));
105
- const CACHE = index_1.CacheUtil.getData(KEY);
154
+ });
155
+ }); });
156
+ var CACHE = index_1.CacheUtil.getData(KEY);
106
157
  if (props.value == null || CACHE == null || !lodash_1.default.has(CACHE, cacheKey) || CACHE[cacheKey] === true)
107
158
  return Const_1.NONE;
108
- const result = CACHE[cacheKey];
159
+ var result = CACHE[cacheKey];
109
160
  if (lodash_1.default.isFunction(props.render)) {
110
161
  if (result === false) {
111
162
  return props.render({ label: null, value: cacheKey });
@@ -116,23 +167,25 @@ const _ApiPostRender = (props) => {
116
167
  return props.default || props.value;
117
168
  return (0, _define_1.getValue)(result, props);
118
169
  };
119
- const ApiPostRender = (options) => {
120
- const KEY = SESSION_KEY + options.api;
170
+ var ApiPostRender = function (options) {
171
+ var KEY = SESSION_KEY + options.api;
121
172
  if (index_1.CacheUtil.getData(KEY) === null) {
122
173
  index_1.CacheUtil.set(KEY, {});
123
174
  }
124
- let cache = index_1.CacheUtil.getData(KEY);
125
- lodash_1.default.keys(cache).map(key => {
175
+ var cache = index_1.CacheUtil.getData(KEY);
176
+ lodash_1.default.keys(cache).map(function (key) {
126
177
  if (cache[key] === true) {
127
178
  lodash_1.default.unset(cache, key);
128
179
  }
129
180
  });
130
181
  index_1.CacheUtil.set(KEY, cache);
131
- const fn = (txt) => react_1.default.createElement(_ApiPostRender, Object.assign({ key: KEY + txt }, options, { value: txt }));
132
- fn.autocomplate = (txt) => __awaiter(void 0, void 0, void 0, function* () {
133
- return [];
134
- });
135
- fn.clear = (key) => {
182
+ var fn = function (txt) { return react_1.default.createElement(_ApiPostRender, __assign({ key: KEY + txt }, options, { value: txt })); };
183
+ fn.autocomplate = function (txt) { return __awaiter(void 0, void 0, void 0, function () {
184
+ return __generator(this, function (_a) {
185
+ return [2 /*return*/, []];
186
+ });
187
+ }); };
188
+ fn.clear = function (key) {
136
189
  if (key === undefined) {
137
190
  index_1.CacheUtil.set(KEY, null);
138
191
  return;
@@ -140,16 +193,17 @@ const ApiPostRender = (options) => {
140
193
  var cache = index_1.CacheUtil.getData(KEY);
141
194
  if (cache == null)
142
195
  return;
143
- const cacheKey = key + '';
196
+ var cacheKey = key + '';
144
197
  if (!lodash_1.default.has(cache, cacheKey))
145
198
  return;
146
199
  lodash_1.default.unset(cache, cacheKey);
147
200
  index_1.CacheUtil.set(KEY, cache);
148
201
  };
149
- fn.getText = (key, def) => {
150
- let result = getInCache(KEY, key);
202
+ fn.getText = function (key, def) {
203
+ var _a;
204
+ var result = getInCache(KEY, key);
151
205
  if (result === null) {
152
- const resp = (0, XHR_1.POSTSYNC)(options.api, Object.assign(Object.assign({}, options.param), { [options.valueFiled]: key }));
206
+ var resp = (0, XHR_1.POSTSYNC)(options.api, __assign(__assign({}, options.param), (_a = {}, _a[options.valueFiled] = key, _a)));
153
207
  result = getLabel(options, resp, key);
154
208
  }
155
209
  if (result == false)
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dateRender = exports.DateRender = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const dayjs_1 = __importDefault(require("dayjs"));
9
- const Const_1 = require("../Const");
10
- const DateRender = (options) => {
11
- const config = options == undefined ? {} : options;
12
- const fn = (txt) => {
7
+ var react_1 = __importDefault(require("react"));
8
+ var dayjs_1 = __importDefault(require("dayjs"));
9
+ var Const_1 = require("../Const");
10
+ var DateRender = function (options) {
11
+ var config = options == undefined ? {} : options;
12
+ var fn = function (txt) {
13
13
  if (txt == null)
14
14
  return Const_1.NONE || config.default;
15
15
  ;
16
- const date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
16
+ var date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
17
17
  if (!date.isValid())
18
18
  return Const_1.NONE || config.default;
19
19
  if (config.className) {
@@ -21,10 +21,10 @@ const DateRender = (options) => {
21
21
  }
22
22
  return date.format(config.targetFormat || 'YYYY-MM-DD HH:mm:ss');
23
23
  };
24
- fn.getText = (txt, def) => {
24
+ fn.getText = function (txt, def) {
25
25
  if (txt == null)
26
26
  return (def || '');
27
- const date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
27
+ var date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
28
28
  if (!date.isValid())
29
29
  return txt + '';
30
30
  return date.format(config.targetFormat || 'YYYY-MM-DD HH:mm:ss');
@@ -1,22 +1,49 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
2
29
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
30
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
31
  };
5
32
  Object.defineProperty(exports, "__esModule", { value: true });
6
33
  exports.DICT = exports.initDict = exports.DictRender = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const antd_1 = require("antd");
10
- const Icon_1 = require("../../components/_adapt/Icon");
11
- const index_1 = require("../index");
12
- const Const_1 = require("../../components/_setup/Const");
13
- const Const_2 = require("../Const");
14
- const _Support_1 = require("../_Support");
15
- const _V_DICT = (0, _Support_1.globalDefault)('_V_DICT', { DICTS: [], DICT_MAP: new Map() });
34
+ var react_1 = __importDefault(require("react"));
35
+ var lodash_1 = __importDefault(require("lodash"));
36
+ var antd_1 = require("antd");
37
+ var Icon_1 = require("../../components/_adapt/Icon");
38
+ var index_1 = require("../index");
39
+ var Const_1 = require("../../components/_setup/Const");
40
+ var Const_2 = require("../Const");
41
+ var _Support_1 = require("../_Support");
42
+ var _V_DICT = (0, _Support_1.globalDefault)('_V_DICT', { DICTS: [], DICT_MAP: new Map() });
16
43
  exports.DICT = _V_DICT;
17
- const DICT = _V_DICT.DICT_MAP;
44
+ var DICT = _V_DICT.DICT_MAP;
18
45
  // var DICT = globalDefault('_V_DICT' as any, new Map<string, DictInfo>());
19
- const VALIDATE_FORMAT = new Set(['tag', 'color', 'status', 'sup', 'sub', 'icon', 'progress', 'clazz']);
46
+ var VALIDATE_FORMAT = new Set(['tag', 'color', 'status', 'sup', 'sub', 'icon', 'progress', 'clazz']);
20
47
  // const tagRender = (key: string | number, def: string | false = TEXT.RENDER_TEXT, map: Map<string, [string, string]>) => {
21
48
  // if (!map.has(key)) {
22
49
  // if (def) {
@@ -27,48 +54,48 @@ const VALIDATE_FORMAT = new Set(['tag', 'color', 'status', 'sup', 'sub', 'icon',
27
54
  // let [txt, format] = map.get(key);
28
55
  // return <Tag className="c-dict-tag" color={format ? format : 'geekblue'}>{txt}</Tag>
29
56
  // }
30
- const STATUS = new Set(['success', 'processing', 'warning', 'error', 'default']);
31
- const statusRender = (key, def, map) => {
57
+ var STATUS = new Set(['success', 'processing', 'warning', 'error', 'default']);
58
+ var statusRender = function (key, def, map) {
32
59
  if (!map.has(key)) {
33
60
  if (def === false)
34
61
  return key;
35
62
  return react_1.default.createElement(antd_1.Badge, { className: "c-dict-status", status: "default", text: def });
36
63
  }
37
- let [txt, format] = map.get(key);
64
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
38
65
  if (STATUS.has(format)) {
39
66
  // return <Badge status={format as any} text={txt} />
40
67
  }
41
68
  return react_1.default.createElement(antd_1.Badge, { className: "c-dict-status", status: "default", text: txt });
42
69
  };
43
- const subRender = (key, def, map) => {
70
+ var subRender = function (key, def, map) {
44
71
  if (!map.has(key)) {
45
72
  if (def === false)
46
73
  return key;
47
74
  return def;
48
75
  }
49
- let [txt, format] = map.get(key);
76
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
50
77
  return react_1.default.createElement("span", { className: "c-dict-sub" },
51
78
  txt,
52
79
  format && react_1.default.createElement("sub", null, format));
53
80
  };
54
- const supRender = (key, def, map) => {
81
+ var supRender = function (key, def, map) {
55
82
  if (!map.has(key)) {
56
83
  if (def === false)
57
84
  return key;
58
85
  return def;
59
86
  }
60
- let [txt, format] = map.get(key);
87
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
61
88
  return react_1.default.createElement("span", { className: "c-dict-sup" },
62
89
  txt,
63
90
  format && react_1.default.createElement("sup", null, format));
64
91
  };
65
- const iconRender = (key, def, map) => {
92
+ var iconRender = function (key, def, map) {
66
93
  if (!map.has(key)) {
67
94
  if (def === false)
68
95
  return key;
69
96
  return def;
70
97
  }
71
- let [txt, format] = map.get(key);
98
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
72
99
  if (format == null || format == '') {
73
100
  return txt;
74
101
  }
@@ -82,13 +109,13 @@ const iconRender = (key, def, map) => {
82
109
  txt);
83
110
  };
84
111
  // const PROGRESS = new Set<string>(['prepare', 'ready', 'doing', 'finsh', 'error'])
85
- const progressRender = (key, def, map) => {
112
+ var progressRender = function (key, def, map) {
86
113
  if (!map.has(key)) {
87
114
  if (def == false)
88
115
  return key;
89
116
  return def;
90
117
  }
91
- let [txt, format] = map.get(key);
118
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
92
119
  switch (format) {
93
120
  case 'prepare':
94
121
  return react_1.default.createElement(antd_1.Badge, { className: "c-dict-progress c-dict-progress-" + format, count: react_1.default.createElement(Icon_1.Icon, { type: "plus-circle" }), text: txt });
@@ -103,28 +130,28 @@ const progressRender = (key, def, map) => {
103
130
  }
104
131
  return txt;
105
132
  };
106
- const borderRender = (key, def, map) => {
133
+ var borderRender = function (key, def, map) {
107
134
  if (!map.has(key)) {
108
135
  if (def === false)
109
136
  return key;
110
137
  return def;
111
138
  }
112
- let [txt, format] = map.get(key);
139
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
113
140
  return react_1.default.createElement("span", { className: "c-dict-border", style: { color: format, borderLeftColor: format } }, txt);
114
141
  };
115
- const extClass = (key, def, map) => {
142
+ var extClass = function (key, def, map) {
116
143
  if (!map.has(key)) {
117
144
  if (def === false)
118
145
  return key;
119
146
  return def;
120
147
  }
121
- let [txt, format] = map.get(key);
148
+ var _a = __read(map.get(key), 2), txt = _a[0], format = _a[1];
122
149
  if (format) {
123
150
  return react_1.default.createElement("span", { className: format }, txt);
124
151
  }
125
152
  return txt;
126
153
  };
127
- const renderDictValue = (info, item) => {
154
+ var renderDictValue = function (info, item) {
128
155
  switch (info.format) {
129
156
  case 'tag':
130
157
  // return tagRender(item.value);
@@ -153,23 +180,23 @@ const renderDictValue = (info, item) => {
153
180
  }
154
181
  return item.label;
155
182
  };
156
- const _DictRender = (props) => {
183
+ var _DictRender = function (props) {
157
184
  // if (DICT == null) return NONE;
158
185
  if (props.value === null)
159
186
  return props.default || Const_2.NONE;
160
- const dictInfo = DICT.get(props.dictType);
187
+ var dictInfo = DICT.get(props.dictType);
161
188
  if (dictInfo == null)
162
189
  return props.default || Const_2.NONE;
163
- const dictKey = props.value + '';
164
- let idx = lodash_1.default.findIndex(dictInfo.nodes, (item) => dictKey == item.value);
190
+ var dictKey = props.value + '';
191
+ var idx = lodash_1.default.findIndex(dictInfo.nodes, function (item) { return dictKey == item.value; });
165
192
  if (idx < 0)
166
193
  return props.default || Const_2.NONE;
167
194
  return renderDictValue(dictInfo, dictInfo.nodes[idx]);
168
195
  };
169
- const putOptions = (arr, config) => {
196
+ var putOptions = function (arr, config) {
170
197
  if (config === undefined)
171
198
  return arr;
172
- let list = arr.slice();
199
+ var list = arr.slice();
173
200
  if (config.shift) {
174
201
  if (config.shift === true) {
175
202
  list.unshift({ label: index_1.i18n.txt(Const_1.V.TXT_ALL), value: '' });
@@ -179,7 +206,7 @@ const putOptions = (arr, config) => {
179
206
  }
180
207
  }
181
208
  if (config.valueFormat == 'number') {
182
- list.map(item => {
209
+ list.map(function (item) {
183
210
  try {
184
211
  item.value = parseInt(item.value);
185
212
  }
@@ -189,28 +216,28 @@ const putOptions = (arr, config) => {
189
216
  }
190
217
  return list;
191
218
  };
192
- const DictCache = new Map();
193
- const DictRender = (options) => {
219
+ var DictCache = new Map();
220
+ var DictRender = function (options) {
194
221
  if (lodash_1.default.isString(options) && DictCache.has(options))
195
222
  return DictCache.get(options);
196
- const props = lodash_1.default.isString(options) ? { dictType: options } : options;
197
- const fn = (txt) => {
198
- return react_1.default.createElement(_DictRender, Object.assign({}, props, { value: txt }));
223
+ var props = lodash_1.default.isString(options) ? { dictType: options } : options;
224
+ var fn = function (txt) {
225
+ return react_1.default.createElement(_DictRender, __assign({}, props, { value: txt }));
199
226
  };
200
- fn.options = (config) => {
201
- let info = DICT.get(props.dictType);
227
+ fn.options = function (config) {
228
+ var info = DICT.get(props.dictType);
202
229
  if (info == null)
203
230
  return [];
204
231
  return putOptions(info.nodes, config);
205
232
  };
206
- fn.getText = (key, def) => {
233
+ fn.getText = function (key, def) {
207
234
  if (key === null)
208
235
  return lodash_1.default.isString(def) ? def : '';
209
- const dictInfo = DICT.get(props.dictType);
236
+ var dictInfo = DICT.get(props.dictType);
210
237
  if (dictInfo == null)
211
238
  return lodash_1.default.isString(def) ? def : '';
212
- const dictKey = key + '';
213
- let idx = lodash_1.default.findIndex(dictInfo.nodes, (item) => dictKey == item.value);
239
+ var dictKey = key + '';
240
+ var idx = lodash_1.default.findIndex(dictInfo.nodes, function (item) { return dictKey == item.value; });
214
241
  if (idx < 0)
215
242
  return lodash_1.default.isString(def) ? def : '';
216
243
  return dictInfo.nodes[idx].label;
@@ -220,13 +247,13 @@ const DictRender = (options) => {
220
247
  return fn;
221
248
  };
222
249
  exports.DictRender = DictRender;
223
- const initNodes = (parentType, dict, nodes) => {
224
- let childs = lodash_1.default.filter(dict, item => item.parentType == parentType);
225
- childs.map(item => {
226
- let value = lodash_1.default.trim(item.code);
250
+ var initNodes = function (parentType, dict, nodes) {
251
+ var childs = lodash_1.default.filter(dict, function (item) { return item.parentType == parentType; });
252
+ childs.map(function (item) {
253
+ var value = lodash_1.default.trim(item.code);
227
254
  if (value.length > 0)
228
- nodes.push({ label: item.codeValue, value });
229
- let subChildren = lodash_1.default.filter(dict, sub => sub.parentType == item.type);
255
+ nodes.push({ label: item.codeValue, value: value });
256
+ var subChildren = lodash_1.default.filter(dict, function (sub) { return sub.parentType == item.type; });
230
257
  if (subChildren.length > 0) {
231
258
  initNodes(item.type, dict, nodes);
232
259
  }
@@ -235,11 +262,11 @@ const initNodes = (parentType, dict, nodes) => {
235
262
  /**
236
263
  * 初始化字典,将字典接口的响应数组传入
237
264
  */
238
- const initDict = (dict) => {
239
- const roots = lodash_1.default.filter(dict, item => item['parentType'] == '0' || item['parentType'] == '');
265
+ var initDict = function (dict) {
266
+ var roots = lodash_1.default.filter(dict, function (item) { return item['parentType'] == '0' || item['parentType'] == ''; });
240
267
  _V_DICT.DICTS = [];
241
- roots.map(root => {
242
- const info = { code: root.type, nodes: [] };
268
+ roots.map(function (root) {
269
+ var info = { code: root.type, nodes: [] };
243
270
  _V_DICT.DICTS.push({ label: root.codeValue, value: root.type });
244
271
  if (root.format && VALIDATE_FORMAT.has(root.format))
245
272
  info.format = root.format;
@@ -1,25 +1,47 @@
1
1
  "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.imgRender = exports.fileRender = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const lodash_1 = __importDefault(require("lodash"));
9
- const Icon_1 = require("../../components/_adapt/Icon");
10
- const index_1 = require("../index");
11
- const Const_1 = require("../../components/_setup/Const");
18
+ var react_1 = __importDefault(require("react"));
19
+ var lodash_1 = __importDefault(require("lodash"));
20
+ var Icon_1 = require("../../components/_adapt/Icon");
21
+ var index_1 = require("../index");
22
+ var Const_1 = require("../../components/_setup/Const");
12
23
  // 支持直接用浏览器打开的格式
13
- const VIEW_TYPES = ['.png', '.jpg', '.svg', '.jpeg', '.gif', '.pdf', '.mp4', '.mp3'];
14
- const canView = (fileName) => {
15
- for (let sux of VIEW_TYPES) {
16
- if (lodash_1.default.toLower(fileName).endsWith(sux)) {
17
- return true;
24
+ var VIEW_TYPES = ['.png', '.jpg', '.svg', '.jpeg', '.gif', '.pdf', '.mp4', '.mp3'];
25
+ var canView = function (fileName) {
26
+ var e_1, _a;
27
+ try {
28
+ for (var VIEW_TYPES_1 = __values(VIEW_TYPES), VIEW_TYPES_1_1 = VIEW_TYPES_1.next(); !VIEW_TYPES_1_1.done; VIEW_TYPES_1_1 = VIEW_TYPES_1.next()) {
29
+ var sux = VIEW_TYPES_1_1.value;
30
+ if (lodash_1.default.toLower(fileName).endsWith(sux)) {
31
+ return true;
32
+ }
33
+ }
34
+ }
35
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
36
+ finally {
37
+ try {
38
+ if (VIEW_TYPES_1_1 && !VIEW_TYPES_1_1.done && (_a = VIEW_TYPES_1.return)) _a.call(VIEW_TYPES_1);
18
39
  }
40
+ finally { if (e_1) throw e_1.error; }
19
41
  }
20
42
  return false;
21
43
  };
22
- const fileRender = (fileId, fileName) => {
44
+ var fileRender = function (fileId, fileName) {
23
45
  if (fileName && canView(fileName)) {
24
46
  return react_1.default.createElement("a", { href: index_1.GLOBAL.CONFIG.UPLOAD.PREVIEW + fileId, target: "_blank", title: fileName },
25
47
  react_1.default.createElement(Icon_1.Icon, { type: "search" }),
@@ -32,7 +54,7 @@ const fileRender = (fileId, fileName) => {
32
54
  fileName ? fileName : index_1.i18n.txt(Const_1.V.BTN_DOWNLOAD));
33
55
  };
34
56
  exports.fileRender = fileRender;
35
- const imgRender = (fileId) => {
57
+ var imgRender = function (fileId) {
36
58
  // if (portrait) {
37
59
  // if (_.startsWith(portrait, '/') || _.startsWith(portrait, 'http:')) {
38
60
  // return portrait;