ns-base-module 1.0.0

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 (148) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +20 -0
  3. package/dist/Button/AntdIconButton.d.ts +11 -0
  4. package/dist/Button/AntdIconButton.d.ts.map +1 -0
  5. package/dist/Button/AntdIconButton.js +22 -0
  6. package/dist/Button/ConfigButton.d.ts +18 -0
  7. package/dist/Button/ConfigButton.d.ts.map +1 -0
  8. package/dist/Button/ConfigButton.js +78 -0
  9. package/dist/Button/index.d.ts +8 -0
  10. package/dist/Button/index.d.ts.map +1 -0
  11. package/dist/Button/index.js +19 -0
  12. package/dist/ClassFilter/index.d.ts +11 -0
  13. package/dist/ClassFilter/index.d.ts.map +1 -0
  14. package/dist/ClassFilter/index.js +119 -0
  15. package/dist/ClassFilter/indexVertical.d.ts +10 -0
  16. package/dist/ClassFilter/indexVertical.d.ts.map +1 -0
  17. package/dist/ClassFilter/indexVertical.js +69 -0
  18. package/dist/ClassFilter/util.d.ts +17 -0
  19. package/dist/ClassFilter/util.d.ts.map +1 -0
  20. package/dist/ClassFilter/util.js +135 -0
  21. package/dist/CopyCol/index.d.ts +4 -0
  22. package/dist/CopyCol/index.d.ts.map +1 -0
  23. package/dist/CopyCol/index.js +57 -0
  24. package/dist/Entry/EntryCriteria.d.ts +17 -0
  25. package/dist/Entry/EntryCriteria.d.ts.map +1 -0
  26. package/dist/Entry/EntryCriteria.js +138 -0
  27. package/dist/Entry/EntryItem.d.ts +34 -0
  28. package/dist/Entry/EntryItem.d.ts.map +1 -0
  29. package/dist/Entry/EntryItem.js +757 -0
  30. package/dist/Entry/components/Checkbox.d.ts +12 -0
  31. package/dist/Entry/components/Checkbox.d.ts.map +1 -0
  32. package/dist/Entry/components/Checkbox.js +15 -0
  33. package/dist/Entry/components/ChooseModalTable.d.ts +15 -0
  34. package/dist/Entry/components/ChooseModalTable.d.ts.map +1 -0
  35. package/dist/Entry/components/ChooseModalTable.js +407 -0
  36. package/dist/Entry/components/Condition.d.ts +9 -0
  37. package/dist/Entry/components/Condition.d.ts.map +1 -0
  38. package/dist/Entry/components/Condition.js +30 -0
  39. package/dist/Entry/components/DatePicker.d.ts +12 -0
  40. package/dist/Entry/components/DatePicker.d.ts.map +1 -0
  41. package/dist/Entry/components/DatePicker.js +12 -0
  42. package/dist/Entry/components/Etable2Modal.d.ts +4 -0
  43. package/dist/Entry/components/Etable2Modal.d.ts.map +1 -0
  44. package/dist/Entry/components/Etable2Modal.js +122 -0
  45. package/dist/Entry/components/Express.d.ts +8 -0
  46. package/dist/Entry/components/Express.d.ts.map +1 -0
  47. package/dist/Entry/components/Express.js +30 -0
  48. package/dist/Entry/components/GroupInput.d.ts +13 -0
  49. package/dist/Entry/components/GroupInput.d.ts.map +1 -0
  50. package/dist/Entry/components/GroupInput.js +77 -0
  51. package/dist/Entry/components/ImageText.d.ts +13 -0
  52. package/dist/Entry/components/ImageText.d.ts.map +1 -0
  53. package/dist/Entry/components/ImageText.js +235 -0
  54. package/dist/Entry/components/Input.d.ts +27 -0
  55. package/dist/Entry/components/Input.d.ts.map +1 -0
  56. package/dist/Entry/components/Input.js +86 -0
  57. package/dist/Entry/components/InputNumber.d.ts +18 -0
  58. package/dist/Entry/components/InputNumber.d.ts.map +1 -0
  59. package/dist/Entry/components/InputNumber.js +111 -0
  60. package/dist/Entry/components/InputNumberRange.d.ts +10 -0
  61. package/dist/Entry/components/InputNumberRange.d.ts.map +1 -0
  62. package/dist/Entry/components/InputNumberRange.js +58 -0
  63. package/dist/Entry/components/ListSelect.d.ts +15 -0
  64. package/dist/Entry/components/ListSelect.d.ts.map +1 -0
  65. package/dist/Entry/components/ListSelect.js +110 -0
  66. package/dist/Entry/components/ObjectSelect.d.ts +14 -0
  67. package/dist/Entry/components/ObjectSelect.d.ts.map +1 -0
  68. package/dist/Entry/components/ObjectSelect.js +91 -0
  69. package/dist/Entry/components/Progress.d.ts +11 -0
  70. package/dist/Entry/components/Progress.d.ts.map +1 -0
  71. package/dist/Entry/components/Progress.js +63 -0
  72. package/dist/Entry/components/Radio.d.ts +15 -0
  73. package/dist/Entry/components/Radio.d.ts.map +1 -0
  74. package/dist/Entry/components/Radio.js +17 -0
  75. package/dist/Entry/components/Select.d.ts +29 -0
  76. package/dist/Entry/components/Select.d.ts.map +1 -0
  77. package/dist/Entry/components/Select.js +113 -0
  78. package/dist/Entry/components/Switch.d.ts +6 -0
  79. package/dist/Entry/components/Switch.d.ts.map +1 -0
  80. package/dist/Entry/components/Switch.js +19 -0
  81. package/dist/Entry/components/TagsDatePicker.d.ts +7 -0
  82. package/dist/Entry/components/TagsDatePicker.d.ts.map +1 -0
  83. package/dist/Entry/components/TagsDatePicker.js +229 -0
  84. package/dist/Entry/components/TimePicker.d.ts +6 -0
  85. package/dist/Entry/components/TimePicker.d.ts.map +1 -0
  86. package/dist/Entry/components/TimePicker.js +6 -0
  87. package/dist/Entry/components/TreeSelect.d.ts +6 -0
  88. package/dist/Entry/components/TreeSelect.d.ts.map +1 -0
  89. package/dist/Entry/components/TreeSelect.js +18 -0
  90. package/dist/Entry/components/index.scss +97 -0
  91. package/dist/Entry/components/utils.d.ts +1 -0
  92. package/dist/Entry/components/utils.d.ts.map +1 -0
  93. package/dist/Entry/components/utils.js +6 -0
  94. package/dist/Entry/data.d.ts +133 -0
  95. package/dist/Entry/index.d.ts +54 -0
  96. package/dist/Entry/index.d.ts.map +1 -0
  97. package/dist/Entry/index.js +45 -0
  98. package/dist/FilterPopover/Filter.d.ts +24 -0
  99. package/dist/FilterPopover/Filter.d.ts.map +1 -0
  100. package/dist/FilterPopover/Filter.js +370 -0
  101. package/dist/FilterPopover/FilterClearIcon.d.ts +8 -0
  102. package/dist/FilterPopover/FilterClearIcon.d.ts.map +1 -0
  103. package/dist/FilterPopover/FilterClearIcon.js +45 -0
  104. package/dist/FilterPopover/index.d.ts +20 -0
  105. package/dist/FilterPopover/index.d.ts.map +1 -0
  106. package/dist/FilterPopover/index.js +136 -0
  107. package/dist/Icon/IconCreate.d.ts +11 -0
  108. package/dist/Icon/IconCreate.d.ts.map +1 -0
  109. package/dist/Icon/IconCreate.js +22 -0
  110. package/dist/Icon/index.d.ts +6 -0
  111. package/dist/Icon/index.d.ts.map +1 -0
  112. package/dist/Icon/index.js +22 -0
  113. package/dist/WidgetConfig/index.d.ts +40 -0
  114. package/dist/WidgetConfig/index.d.ts.map +1 -0
  115. package/dist/WidgetConfig/index.js +129 -0
  116. package/dist/index.d.ts +2 -0
  117. package/dist/index.d.ts.map +1 -0
  118. package/dist/index.js +4 -0
  119. package/dist/test/index.d.ts +4 -0
  120. package/dist/test/index.d.ts.map +1 -0
  121. package/dist/test/index.js +7 -0
  122. package/dist/umd/ns-base-module.min.js +1 -0
  123. package/dist/utils/cache.d.ts +17 -0
  124. package/dist/utils/cache.d.ts.map +1 -0
  125. package/dist/utils/cache.js +127 -0
  126. package/dist/utils/enum.d.ts +22 -0
  127. package/dist/utils/enum.d.ts.map +1 -0
  128. package/dist/utils/enum.js +37 -0
  129. package/dist/utils/language.d.ts +241 -0
  130. package/dist/utils/language.d.ts.map +1 -0
  131. package/dist/utils/language.js +247 -0
  132. package/dist/utils/request.d.ts +15 -0
  133. package/dist/utils/request.d.ts.map +1 -0
  134. package/dist/utils/request.js +180 -0
  135. package/dist/utils/utils.d.ts +113 -0
  136. package/dist/utils/utils.d.ts.map +1 -0
  137. package/dist/utils/utils.js +462 -0
  138. package/package.json +97 -0
  139. package/style/basics.scss +671 -0
  140. package/style/components/ClassFilter.scss +69 -0
  141. package/style/components/FilterPopover.scss +34 -0
  142. package/style/components/index.scss +2 -0
  143. package/style/default.scss +1219 -0
  144. package/style/index.scss +1 -0
  145. package/style/mixins/index.scss +28 -0
  146. package/style/mixins/libs/tint.scss +23 -0
  147. package/style/variables.scss +684 -0
  148. package/types/Action.d.ts +43 -0
@@ -0,0 +1,757 @@
1
+ var _excluded = ["type", "valueEnum", "src", "width", "api", "changeApi", "parentKey", "async", "params", "code", "menuCode", "relationField", "formValues", "requestParams", "onSelectObject", "onJump", "onOpen", "onSetResult", "onCover", "onChangeSearch", "onPlay", "emit", "form", "record", "dispatch", "pageChangeApi", "label_", "onSetPageResult", "dispatchType", "onComputeExp"];
2
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ 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."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+ import React, { useState, useEffect } from 'react';
18
+ import Input from "./components/Input";
19
+ import InputNumber from "./components/InputNumber";
20
+ import InputNumberRange from "./components/InputNumberRange";
21
+ import Select from "./components/Select";
22
+ import Switch from "./components/Switch";
23
+ import Progress from "./components/Progress";
24
+ import DatePicker from "./components/DatePicker";
25
+ import TagsDatePicker from "./components/TagsDatePicker";
26
+ import TimePicker from "./components/TimePicker";
27
+ import Checkbox from "./components/Checkbox";
28
+ import Radio from "./components/Radio";
29
+ import TreeSelect from "./components/TreeSelect";
30
+ import Condition from "./components/Condition";
31
+ import { UploadImage, UploadFile } from '@/components/Upload';
32
+ import { ImageGroup } from '@/components/Image';
33
+ import Cron from '@/components/Cron';
34
+ import Editor, { EditorPreview, EditorModal } from '@/components/WangEditor';
35
+ import Link from '@/components/Link';
36
+ import FormTable from '@/components/v2/Table/FormTable';
37
+ import ColorPicker from '@/components/ColorPicker';
38
+ import Tag from '@/components/Tag';
39
+ import Tags from '@/components/Tags';
40
+ import ReactJson from 'react-json-view';
41
+ import { TimelineModal, TableEditableModal } from '@/components/v2/Modal';
42
+ import ListSelect from "./components/ListSelect";
43
+ import ObjectSelect from "./components/ObjectSelect";
44
+ import AceEditor from '@/components/AceEditor';
45
+ import { AceTable } from '@/components/v2/Table';
46
+ import Tree from '@/components/Tree';
47
+ import Express from "./components/Express";
48
+ import Steps from '@/components/Steps';
49
+ import QRCode from '@/components/QRCode';
50
+ import Barcode from '@/components/Barcode';
51
+ import GroupInput from "./components/GroupInput";
52
+ import ChooseModalTable from "./components/ChooseModalTable";
53
+ import Etable2Modal from "./components/Etable2Modal";
54
+ import ImageText from "./components/ImageText";
55
+ import { MoreOutlined } from '@ant-design/icons';
56
+ import moment from 'moment';
57
+ import { getAsyncSelectOptions, queryAsyncApi } from '@/services/config';
58
+ import { EntryType } from "./data.d";
59
+ import { formatData } from '@/utils/utils';
60
+ import { message } from 'antd';
61
+ import { useHistory, useLocation, useParams } from 'umi';
62
+ import { isArray, isFunction, isString } from 'lodash';
63
+ var RangePicker = DatePicker.RangePicker;
64
+ var TextArea = Input.TextArea,
65
+ TextAreaBlur = Input.TextAreaBlur,
66
+ Password = Input.Password,
67
+ Search = Input.Search;
68
+ var Option = Select.Option;
69
+ var CheckboxGroup = Checkbox.Group;
70
+ var datePickerFormat = 'YYYY-MM-DD';
71
+ var dateTimePickerFormat = 'YYYY-MM-DD HH:mm:ss';
72
+ var timePickerFormat = 'HH:mm:ss';
73
+ var EntryItem = function EntryItem(_ref) {
74
+ var _useLocation, _props$value2, _props$entryAttr, _props$renderEntryAtt;
75
+ var type = _ref.type,
76
+ _ref$valueEnum = _ref.valueEnum,
77
+ valueEnum = _ref$valueEnum === void 0 ? [] : _ref$valueEnum,
78
+ src = _ref.src,
79
+ width = _ref.width,
80
+ api = _ref.api,
81
+ changeApi = _ref.changeApi,
82
+ parentKey = _ref.parentKey,
83
+ _ref$async = _ref.async,
84
+ async = _ref$async === void 0 ? false : _ref$async,
85
+ params = _ref.params,
86
+ code = _ref.code,
87
+ menuCode = _ref.menuCode,
88
+ relationField = _ref.relationField,
89
+ formValues = _ref.formValues,
90
+ requestParams = _ref.requestParams,
91
+ onSelectObject = _ref.onSelectObject,
92
+ onJump = _ref.onJump,
93
+ onOpen = _ref.onOpen,
94
+ onSetResult = _ref.onSetResult,
95
+ onCover = _ref.onCover,
96
+ onChangeSearch = _ref.onChangeSearch,
97
+ onPlay = _ref.onPlay,
98
+ emit = _ref.emit,
99
+ form = _ref.form,
100
+ record = _ref.record,
101
+ dispatch = _ref.dispatch,
102
+ pageChangeApi = _ref.pageChangeApi,
103
+ label_ = _ref.label_,
104
+ onSetPageResult = _ref.onSetPageResult,
105
+ dispatchType = _ref.dispatchType,
106
+ onComputeExp = _ref.onComputeExp,
107
+ props = _objectWithoutProperties(_ref, _excluded);
108
+ var history = useHistory();
109
+ // console.log(params);
110
+ var _useState = useState([]),
111
+ _useState2 = _slicedToArray(_useState, 2),
112
+ options = _useState2[0],
113
+ setOptions = _useState2[1];
114
+ // const [inputValue, setInputValue] = useState<any>(props.value);
115
+
116
+ // useEffect(() => {
117
+ // console.log('props.valueprops.value', props.value);
118
+ // if (props.value) {
119
+ // setInputValue(props.value);
120
+ // }
121
+ // }, [props.value]);
122
+
123
+ var _useParams = useParams(),
124
+ formTemplateCode = _useParams.formTemplateCode,
125
+ id = _useParams.id;
126
+ var path = (_useLocation = useLocation()) === null || _useLocation === void 0 ? void 0 : _useLocation.pathname;
127
+ useEffect(function () {
128
+ if (type == EntryType.Select || type == EntryType.ObjectSelect) {
129
+ // console.log(!!async && !!parentKey && !!api);
130
+ // console.log(type);
131
+
132
+ // console.log(async, 'async');
133
+ // console.log(parentKey, 'parentKey');
134
+ // console.log(api, 'api');
135
+ // console.log(props.value, 'value');
136
+
137
+ if (!!async && !!parentKey && !!api) {
138
+ getAsyncSelectOptions({
139
+ api: api,
140
+ params: params,
141
+ parentKey: parentKey,
142
+ code: code,
143
+ menuCode: menuCode
144
+ }).then(function (res) {
145
+ if ((res === null || res === void 0 ? void 0 : res.code) == 200) {
146
+ var _res$data;
147
+ setOptions((res === null || res === void 0 ? void 0 : res.data) || []);
148
+ // console.log(props.value, 'value');
149
+ // console.log(res.data);
150
+ var findItem = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.find(function (fd) {
151
+ return fd.value == props.value;
152
+ });
153
+ if (!findItem && options.length) {
154
+ var _props$onChange;
155
+ // console.log(options, 'wqkl');
156
+
157
+ props === null || props === void 0 || (_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, null);
158
+ }
159
+ // if (options.length) props?.onChange?.(null);
160
+ }
161
+ });
162
+ return;
163
+ }
164
+ setOptions([]);
165
+ }
166
+ }, [params]);
167
+ var onChangeDatePicker = function onChangeDatePicker(value, dateString) {
168
+ // console.log(value, dateString);
169
+ onComputeExp === null || onComputeExp === void 0 || onComputeExp(dateString);
170
+ props === null || props === void 0 || props.onChange(dateString);
171
+ };
172
+ var onChangeRangePicker = function onChangeRangePicker(value, dateString) {
173
+ // console.log(value, dateString);
174
+ props === null || props === void 0 || props.onChange(value ? dateString : value);
175
+ };
176
+ var onChangeTimePicker = function onChangeTimePicker(value, dateString) {
177
+ // console.log(value, dateString);
178
+ props === null || props === void 0 || props.onChange(dateString);
179
+ };
180
+ var onSearch = function onSearch(value) {
181
+ if (api && onChangeSearch && code) {
182
+ onChangeSearch(api, _objectSpread(_objectSpread({}, formValues !== null && formValues !== void 0 ? formValues : {}), {}, _defineProperty({}, code, value)));
183
+ return;
184
+ }
185
+ if (api && onSetResult && code) queryAsyncApi(api, {
186
+ method: 'post',
187
+ data: _defineProperty({}, code, value)
188
+ }).then(function (res) {
189
+ if (res !== null && res !== void 0 && res.isPlay) {
190
+ onPlay === null || onPlay === void 0 || onPlay((res === null || res === void 0 ? void 0 : res.code) == 200 ? true : false);
191
+ }
192
+ if ((res === null || res === void 0 ? void 0 : res.code) == 200) {
193
+ onSetResult(res === null || res === void 0 ? void 0 : res.data);
194
+ return;
195
+ }
196
+ message.error(res === null || res === void 0 ? void 0 : res.msg);
197
+ });
198
+ };
199
+ var onAllSearch = function onAllSearch() {
200
+ if (api && onChangeSearch && code) {
201
+ onChangeSearch(api, _objectSpread({}, formValues !== null && formValues !== void 0 ? formValues : {}));
202
+ return;
203
+ }
204
+ if (api && onSetResult) queryAsyncApi(api, {
205
+ method: 'post',
206
+ data: formValues
207
+ }).then(function (res) {
208
+ if (res !== null && res !== void 0 && res.isPlay) {
209
+ onPlay === null || onPlay === void 0 || onPlay((res === null || res === void 0 ? void 0 : res.code) == 200 ? true : false);
210
+ }
211
+ if ((res === null || res === void 0 ? void 0 : res.code) == 200) {
212
+ onSetResult(res === null || res === void 0 ? void 0 : res.data);
213
+ return;
214
+ }
215
+ message.error(res === null || res === void 0 ? void 0 : res.msg);
216
+ });
217
+ };
218
+ var onChangeSelect = function onChangeSelect(value) {
219
+ if (emit) {
220
+ // console.log('emit,emit,emit');
221
+ // history.replace({ search: `emitKey=${code}&emitValue=${value}` });
222
+
223
+ window.history.replaceState(null, '', "/#".concat(history.location.pathname, "?&emitKey=").concat(code, "&emitValue=").concat(value));
224
+ setTimeout(function () {
225
+ window.nsForm = form;
226
+ var FormValue = window.nsForm && window.nsForm.getFieldsValue();
227
+ try {
228
+ dispatch({
229
+ type: dispatchType || 'order/fetchConfig',
230
+ payload: {
231
+ menuCode: menuCode,
232
+ formTemplateCode: formTemplateCode,
233
+ data: _objectSpread(_objectSpread({
234
+ path: path,
235
+ id: id
236
+ }, form.getFieldsValue()), {}, {
237
+ type: value
238
+ })
239
+ }
240
+ }).then(function (res) {
241
+ if (res !== null && res !== void 0 && res.backRelease) window.onpopstate = function () {
242
+ dispatch({
243
+ type: 'global/leaveForm',
244
+ payload: {
245
+ menuCode: menuCode,
246
+ id: id
247
+ }
248
+ });
249
+ };
250
+ });
251
+ } catch (error) {}
252
+ });
253
+ }
254
+ if (!changeApi || changeApi == '') {
255
+ if (pageChangeApi && pageChangeApi != '' && isFunction(onSetPageResult)) {
256
+ setTimeout(function () {
257
+ var _props$onChange2;
258
+ props === null || props === void 0 || (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 || _props$onChange2.call(props, value);
259
+ onSetPageResult({
260
+ pageChangeApi: pageChangeApi
261
+ });
262
+ }, 50);
263
+ } else {
264
+ var _props$onChange3;
265
+ props === null || props === void 0 || (_props$onChange3 = props.onChange) === null || _props$onChange3 === void 0 || _props$onChange3.call(props, value);
266
+ }
267
+ return;
268
+ }
269
+ if (!!code && !!onSetResult) {
270
+ // console.log('onSetResultonSetResultonSetResultonSetResult');
271
+
272
+ queryAsyncApi(changeApi, {
273
+ method: 'post',
274
+ data: _objectSpread(_objectSpread({}, formValues), {}, _defineProperty({}, code, value))
275
+ }).then(function (res) {
276
+ if ((res === null || res === void 0 ? void 0 : res.code) == 200) {
277
+ onSetResult(res === null || res === void 0 ? void 0 : res.data);
278
+ return;
279
+ }
280
+ message.error(res === null || res === void 0 ? void 0 : res.msg);
281
+ });
282
+ // console.log('emitkey', emit);
283
+ }
284
+ };
285
+ // current_field_code,current_field_val,current_field_name
286
+ var urlColumnParam = function urlColumnParam(_ref2) {
287
+ var param = _ref2.param,
288
+ url = _ref2.url;
289
+ if (!url) {
290
+ return url;
291
+ }
292
+ return url.replace('#(currentFieldCode)#', param.currentFieldCode).replace('#(currentFieldVal)#', param.currentFieldVal).replace('#(currentFieldName)', param.currentFieldName);
293
+ };
294
+
295
+ // ChooseModal 弹框选择 赋值表单值
296
+ var onSelectSubmitListSelect = function onSelectSubmitListSelect(values) {
297
+ var _props$onChange4, _props$onSelectSubmit;
298
+ var _values = isArray(values) ? values[0] : values;
299
+ var _value = props.valueKey ? _values[props.valueKey] : props.id && _values[props.id] ? _values[props.id] : _values.code;
300
+ props === null || props === void 0 || (_props$onChange4 = props.onChange) === null || _props$onChange4 === void 0 || _props$onChange4.call(props, _value);
301
+
302
+ // 兼容旧业务
303
+ (_props$onSelectSubmit = props.onSelectSubmit) === null || _props$onSelectSubmit === void 0 || _props$onSelectSubmit.call(props, _values);
304
+ };
305
+ // 选择弹框 删除input值
306
+ var clearForm = function clearForm() {
307
+ var _props$onChange5;
308
+ props === null || props === void 0 || (_props$onChange5 = props.onChange) === null || _props$onChange5 === void 0 || _props$onChange5.call(props, '');
309
+
310
+ // 选择模板 需清空模板name
311
+ if (props.id === 'formTemplateCode') {
312
+ var _props$onSelectSubmit2;
313
+ (_props$onSelectSubmit2 = props.onSelectSubmit) === null || _props$onSelectSubmit2 === void 0 || _props$onSelectSubmit2.call(props, '');
314
+ }
315
+ };
316
+
317
+ // {...(!col.emit == undefined && {
318
+ // onChange: (event: any) => {
319
+ // console.log('event', event);
320
+ // },
321
+ // })}
322
+ var _fields = (form === null || form === void 0 ? void 0 : form.getFieldsValue()) || null;
323
+ try {
324
+ switch (type) {
325
+ case EntryType.Input:
326
+ return /*#__PURE__*/React.createElement(Input, _extends({
327
+ allowClear: true,
328
+ title: props.value
329
+ }, props));
330
+ case EntryType.Search:
331
+ return /*#__PURE__*/React.createElement(Search, _extends({
332
+ allowClear: true,
333
+ title: props.value
334
+ }, props, {
335
+ onSearch: onSearch
336
+ }));
337
+ case EntryType.AllSearch:
338
+ return /*#__PURE__*/React.createElement(Search, _extends({
339
+ allowClear: true,
340
+ title: props.value
341
+ }, props, {
342
+ onSearch: onAllSearch
343
+ }));
344
+ case EntryType.InputNumber:
345
+ return /*#__PURE__*/React.createElement(InputNumber, _extends({
346
+ style: {
347
+ width: '100%'
348
+ },
349
+ title: props.value
350
+ }, props, {
351
+ onComputeExp: onComputeExp
352
+ }));
353
+ case EntryType.InputNumberRange:
354
+ return /*#__PURE__*/React.createElement(InputNumberRange, props);
355
+ case EntryType.Password:
356
+ return /*#__PURE__*/React.createElement(Password, _extends({
357
+ title: props.value
358
+ }, props));
359
+ case EntryType.TableInput:
360
+ return /*#__PURE__*/React.createElement(Input.InputBlur, _extends({
361
+ allowClear: true
362
+ }, props, {
363
+ title: props.value,
364
+ defaultValue: props.value,
365
+ onBlur: props.onChange
366
+ }));
367
+ case EntryType.TableInputNumber:
368
+ return /*#__PURE__*/React.createElement(InputNumber.InputNumberBlur, _extends({
369
+ style: {
370
+ width: '100%'
371
+ }
372
+ }, props, {
373
+ title: props.value,
374
+ defaultValue: props.value,
375
+ onBlur: props.onChange
376
+ }));
377
+ case EntryType.TagSelect:
378
+ return /*#__PURE__*/React.createElement(Select, _extends({
379
+ mode: "tags",
380
+ style: {
381
+ width: '100%'
382
+ },
383
+ dropdownMatchSelectWidth: false
384
+ }, props), valueEnum.map(function (_ref3) {
385
+ var label = _ref3.label,
386
+ value = _ref3.value;
387
+ return /*#__PURE__*/React.createElement(Option, {
388
+ value: value,
389
+ key: value
390
+ }, label);
391
+ }));
392
+ case EntryType.Select:
393
+ // const { value, ...nextProps } = props;
394
+ return /*#__PURE__*/React.createElement(Select, _extends({
395
+ allowClear: true,
396
+ showSearch: true,
397
+ dropdownMatchSelectWidth: false,
398
+ optionFilterProp: "children",
399
+ filterOption: function filterOption(input, option) {
400
+ var _option$children;
401
+ return (option === null || option === void 0 || (_option$children = option.children) === null || _option$children === void 0 || (_option$children = _option$children.toLowerCase()) === null || _option$children === void 0 ? void 0 : _option$children.indexOf(input === null || input === void 0 ? void 0 : input.toLowerCase())) >= 0;
402
+ },
403
+ record: record,
404
+ style: {
405
+ width: '100%'
406
+ }
407
+ }, props.multiple ? {
408
+ mode: 'multiple',
409
+ suffixIcon: /*#__PURE__*/React.createElement(MoreOutlined, null),
410
+ showArrow: true
411
+ } : {}, props, {
412
+ // options={!!async ? options : valueEnum}
413
+ // valueEnum={!!async ? options : valueEnum}
414
+ // defaultValue={props.value}
415
+ onChange: onChangeSelect
416
+ }), (!!async ? options : valueEnum).map(function (item) {
417
+ return /*#__PURE__*/React.createElement(Option, {
418
+ value: item.value,
419
+ key: item.value,
420
+ disabled: item.disabled
421
+ }, item.label);
422
+ }));
423
+ case EntryType.MultSelect:
424
+ return /*#__PURE__*/React.createElement(Select, _extends({
425
+ mode: "multiple",
426
+ dropdownMatchSelectWidth: false,
427
+ suffixIcon: /*#__PURE__*/React.createElement(MoreOutlined, null),
428
+ showArrow: true,
429
+ allowClear: true,
430
+ showSearch: true,
431
+ optionFilterProp: "children",
432
+ filterOption: function filterOption(input, option) {
433
+ var _option$children2;
434
+ return (option === null || option === void 0 || (_option$children2 = option.children) === null || _option$children2 === void 0 || (_option$children2 = _option$children2.toLowerCase()) === null || _option$children2 === void 0 ? void 0 : _option$children2.indexOf(input === null || input === void 0 ? void 0 : input.toLowerCase())) >= 0;
435
+ }
436
+ // onChange={(value) => onChange(value)}
437
+ ,
438
+ style: {
439
+ width: '100%'
440
+ }
441
+ }, props, {
442
+ defaultValue: props.value
443
+ }), valueEnum.map(function (item) {
444
+ return /*#__PURE__*/React.createElement(Option, {
445
+ value: item.value,
446
+ key: item.value
447
+ }, item.label);
448
+ }));
449
+ case EntryType.DatePicker:
450
+ try {
451
+ return /*#__PURE__*/React.createElement(DatePicker, _extends({
452
+ style: {
453
+ width: '100%'
454
+ }
455
+ }, props, {
456
+ picker: props.picker || 'date',
457
+ format: props.format || datePickerFormat,
458
+ value: props.value ? moment(props.value, props.format || datePickerFormat) : undefined,
459
+ onChange: onChangeDatePicker
460
+ }));
461
+ } catch (error) {
462
+ console.log('datePicker报错', error);
463
+ }
464
+ case EntryType.DateTimePicker:
465
+ return /*#__PURE__*/React.createElement(DatePicker, _extends({
466
+ style: {
467
+ width: '100%'
468
+ }
469
+ }, props, {
470
+ picker: props.picker || 'date',
471
+ format: props.format || dateTimePickerFormat,
472
+ showTime: true,
473
+ value: props.value ? moment(props.value, props.format || dateTimePickerFormat) : undefined,
474
+ onChange: onChangeDatePicker
475
+ }));
476
+ case EntryType.RangePicker:
477
+ try {
478
+ var _props$value;
479
+ return /*#__PURE__*/React.createElement(RangePicker, _extends({
480
+ style: {
481
+ width: '100%'
482
+ }
483
+ }, props, {
484
+ picker: props.picker || 'date',
485
+ format: props.format || datePickerFormat,
486
+ value: props.value && _typeof(props.value) === 'object' ? (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.map(function (v) {
487
+ return moment(v, props.format || datePickerFormat);
488
+ }) : undefined,
489
+ onChange: onChangeRangePicker
490
+ }));
491
+ } catch (error) {
492
+ console.log('RangePicker出错', error);
493
+ return null;
494
+ }
495
+ case EntryType.RangeTimePicker:
496
+ return /*#__PURE__*/React.createElement(RangePicker, _extends({
497
+ showTime: true,
498
+ style: {
499
+ width: '100%'
500
+ }
501
+ }, props, {
502
+ picker: props.picker || 'date',
503
+ format: props.format || dateTimePickerFormat,
504
+ value: props.value && _typeof(props.value) === 'object' ? props.value.map(function (v) {
505
+ return moment(v, props.format || dateTimePickerFormat);
506
+ }) : undefined,
507
+ onChange: onChangeRangePicker
508
+ }));
509
+ case EntryType.TagsDatePicker:
510
+ return /*#__PURE__*/React.createElement(TagsDatePicker, _extends({
511
+ style: {
512
+ width: '100%'
513
+ }
514
+ }, props, {
515
+ picker: props.picker || 'date'
516
+ // format={props.format || dateTimePickerFormat}
517
+ ,
518
+ value: props.value
519
+ // ? props.value.map((v: string) => moment(v, props.format || dateTimePickerFormat))
520
+ // : undefined
521
+ ,
522
+ onChange: onChangeRangePicker
523
+ }));
524
+ case EntryType.TimePicker:
525
+ return /*#__PURE__*/React.createElement(TimePicker, _extends({
526
+ style: {
527
+ width: '100%'
528
+ }
529
+ }, props, {
530
+ format: props.format || timePickerFormat,
531
+ value: props.value ? moment(props.value, props.format || timePickerFormat) : undefined,
532
+ onChange: onChangeTimePicker
533
+ }));
534
+ case EntryType.SwitchRead:
535
+ return /*#__PURE__*/React.createElement(Switch, _extends({}, props, {
536
+ disabled: true,
537
+ checked: props.value || props.checked
538
+ }));
539
+ case EntryType.Switch:
540
+ var checked = props.value == null || props.value == undefined ? props.checked : props.value;
541
+ return /*#__PURE__*/React.createElement(Switch, _extends({}, props, {
542
+ checked: checked
543
+ }));
544
+ case EntryType.TableTextarea:
545
+ return /*#__PURE__*/React.createElement(TextAreaBlur, _extends({}, props, {
546
+ defaultValue: props.value,
547
+ onBlur: props.onChange
548
+ }));
549
+ case EntryType.Textarea:
550
+ return /*#__PURE__*/React.createElement(TextArea, _extends({
551
+ rows: 1,
552
+ style: {
553
+ color: 'rgba(0, 0, 0, 0.75)'
554
+ }
555
+ }, props));
556
+ case EntryType.Image:
557
+ return /*#__PURE__*/React.createElement(ImageGroup, {
558
+ width: (Number(width) - 16) / (src || props.value || []).length,
559
+ src: src || props.value
560
+ });
561
+ case EntryType.CheckboxGroup:
562
+ return /*#__PURE__*/React.createElement(CheckboxGroup, _extends({
563
+ options: valueEnum
564
+ }, props));
565
+ case EntryType.Checkbox:
566
+ // console.log(props.value, props.checked);
567
+ return /*#__PURE__*/React.createElement(Checkbox, props, props.label);
568
+ case EntryType.Radio:
569
+ return /*#__PURE__*/React.createElement(Radio, props, props.label);
570
+ case EntryType.RadioGroup:
571
+ // console.log(props);
572
+ return /*#__PURE__*/React.createElement(Radio.Group, _extends({
573
+ options: valueEnum
574
+ }, props));
575
+ case EntryType.ImageUpload:
576
+ return /*#__PURE__*/React.createElement(UploadImage, props);
577
+ case EntryType.FileUpload:
578
+ return /*#__PURE__*/React.createElement(UploadFile, _extends({}, props, {
579
+ value: isArray(props.value) ? props.value : []
580
+ }));
581
+ case EntryType.TreeSelect:
582
+ return /*#__PURE__*/React.createElement(TreeSelect, _extends({
583
+ showSearch: true,
584
+ allowClear: true
585
+ }, props, {
586
+ treeData: valueEnum
587
+ }));
588
+ case EntryType.Cron:
589
+ return /*#__PURE__*/React.createElement(Cron, props);
590
+ case EntryType.Editor:
591
+ return props.value ? /*#__PURE__*/React.createElement(Editor, _extends({
592
+ key: 'editor'
593
+ }, props)) : /*#__PURE__*/React.createElement(Editor, _extends({
594
+ key: 'add'
595
+ }, props));
596
+ case EntryType.EditorPreview:
597
+ return /*#__PURE__*/React.createElement(EditorPreview, props);
598
+ case EntryType.EditorModal:
599
+ return /*#__PURE__*/React.createElement(EditorModal, props);
600
+ case EntryType.OpenBrowser:
601
+ return /*#__PURE__*/React.createElement(Link, _extends({}, props, {
602
+ onClick: function onClick() {
603
+ return onOpen === null || onOpen === void 0 ? void 0 : onOpen({
604
+ config: {
605
+ path: urlColumnParam({
606
+ param: {
607
+ currentFieldCode: code || '',
608
+ currentFieldVal: props.value,
609
+ currentFieldName: label_
610
+ },
611
+ url: props.path
612
+ })
613
+ }
614
+ }, _objectSpread(_objectSpread({}, _fields), record));
615
+ }
616
+ }), props.value);
617
+ case EntryType.Link:
618
+ return /*#__PURE__*/React.createElement(Link, _extends({}, props, {
619
+ onClick: function onClick() {
620
+ return onJump === null || onJump === void 0 ? void 0 : onJump({
621
+ config: {
622
+ path: urlColumnParam({
623
+ param: {
624
+ currentFieldCode: code || '',
625
+ currentFieldVal: props.value,
626
+ currentFieldName: label_
627
+ },
628
+ url: props.path
629
+ })
630
+ }
631
+ }, _objectSpread(_objectSpread({}, _fields), record));
632
+ }
633
+ }), props.value);
634
+ case EntryType.Tag:
635
+ return /*#__PURE__*/React.createElement(Tag, props);
636
+ case EntryType.Tags:
637
+ return /*#__PURE__*/React.createElement(Tags, props);
638
+ case EntryType.FormTable:
639
+ return /*#__PURE__*/React.createElement(FormTable, props);
640
+ case EntryType.Condition:
641
+ return /*#__PURE__*/React.createElement(Condition, _extends({
642
+ type: props.condition
643
+ }, props));
644
+ case EntryType.ColorPicker:
645
+ return /*#__PURE__*/React.createElement(ColorPicker, _extends({
646
+ format: '',
647
+ disabled: false
648
+ }, props));
649
+ case EntryType.JsonRead:
650
+ return props.value ? /*#__PURE__*/React.createElement(ReactJson, {
651
+ collapsed: true,
652
+ src: _typeof(props.value) == 'object' ? props.value : JSON.parse(props.value)
653
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null);
654
+ case EntryType.TimelineModal:
655
+ return /*#__PURE__*/React.createElement(TimelineModal, _extends({}, props, {
656
+ api: "".concat(api, "?id=").concat(params || '')
657
+ }));
658
+ case EntryType.ChooseModal:
659
+ return /*#__PURE__*/React.createElement(ListSelect, _extends({
660
+ clearForm: clearForm,
661
+ menuCode: menuCode,
662
+ params: _objectSpread(_objectSpread({}, record), requestParams)
663
+ }, props, {
664
+ onSelectSubmit: onSelectSubmitListSelect
665
+ }));
666
+ case EntryType.ObjectSelect:
667
+ return /*#__PURE__*/React.createElement(ObjectSelect, _extends({
668
+ record: record,
669
+ onSelectObject: onSelectObject,
670
+ valueEnum: !!async ? options : valueEnum
671
+ }, props));
672
+ case EntryType.TableEditableModal:
673
+ return /*#__PURE__*/React.createElement(TableEditableModal, _extends({
674
+ width: width
675
+ }, props));
676
+ case EntryType.AceEditor:
677
+ return /*#__PURE__*/React.createElement(AceEditor, props);
678
+ case EntryType.AceTable:
679
+ return /*#__PURE__*/React.createElement(AceTable, props);
680
+ case EntryType.Tree:
681
+ return /*#__PURE__*/React.createElement(Tree, _extends({}, props, {
682
+ valueEnum: valueEnum,
683
+ onJump: onJump
684
+ }));
685
+ case EntryType.Express:
686
+ return /*#__PURE__*/React.createElement(Express, _extends({}, props, {
687
+ valueEnum: valueEnum
688
+ }));
689
+ case EntryType.Steps:
690
+ return /*#__PURE__*/React.createElement(Steps, _extends({}, props, {
691
+ menuCode: menuCode,
692
+ list: (_props$value2 = props === null || props === void 0 ? void 0 : props.value) !== null && _props$value2 !== void 0 ? _props$value2 : []
693
+ }));
694
+ case EntryType.QRCode:
695
+ return /*#__PURE__*/React.createElement(QRCode, props);
696
+ case EntryType.Barcode:
697
+ return /*#__PURE__*/React.createElement(Barcode, props);
698
+ case EntryType.GroupInput:
699
+ return /*#__PURE__*/React.createElement(GroupInput, _extends({}, props, {
700
+ onSearch: onAllSearch
701
+ }));
702
+ case EntryType.ChooseModalTable:
703
+ return /*#__PURE__*/React.createElement(ChooseModalTable, _extends({
704
+ menuCode: menuCode,
705
+ params: _objectSpread(_objectSpread({}, record), requestParams)
706
+ }, props));
707
+ case EntryType.Progress:
708
+ return /*#__PURE__*/React.createElement(Progress, _extends({
709
+ percent: props.value,
710
+ width: width
711
+ }, props));
712
+ case EntryType.Etable2Modal:
713
+ try {
714
+ var _value = props.value;
715
+ if (typeof _value === 'string') {
716
+ _value = JSON.parse(_value);
717
+ }
718
+ return /*#__PURE__*/React.createElement(Etable2Modal, _extends({}, props, {
719
+ value: _value,
720
+ menuCode: menuCode
721
+ }));
722
+ } catch (error) {
723
+ console.log('Etable2Modal报错');
724
+ return null;
725
+ }
726
+ case EntryType.ImageText:
727
+ var configs = [];
728
+ // console.log('props.width:', props.width, props);
729
+ var data_ = record === null || record === void 0 ? void 0 : record[typeof code == 'string' ? code : ''];
730
+ if (isString(props === null || props === void 0 || (_props$entryAttr = props.entryAttr) === null || _props$entryAttr === void 0 ? void 0 : _props$entryAttr.children)) {
731
+ try {
732
+ var _props$entryAttr2;
733
+ configs = JSON.parse((props === null || props === void 0 || (_props$entryAttr2 = props.entryAttr) === null || _props$entryAttr2 === void 0 ? void 0 : _props$entryAttr2.children) || "[{}]");
734
+ } catch (error) {
735
+ console.error('图文组件‘entryAttr’数据格式错误');
736
+ }
737
+ } else {
738
+ configs = [];
739
+ }
740
+ return /*#__PURE__*/React.createElement(ImageText, _extends({
741
+ dataSource: data_ || [],
742
+ width: props === null || props === void 0 || (_props$renderEntryAtt = props.renderEntryAttr) === null || _props$renderEntryAtt === void 0 ? void 0 : _props$renderEntryAtt.width,
743
+ configs: configs || []
744
+ }, props));
745
+ default:
746
+ return /*#__PURE__*/React.createElement(Input, {
747
+ className: "disabled-input",
748
+ disabled: true,
749
+ value: props.dataFormat ? formatData(props.value, props.dataFormat) : props.value
750
+ });
751
+ }
752
+ } catch (error) {
753
+ console.log('entryItem报错', error);
754
+ return null;
755
+ }
756
+ };
757
+ export default EntryItem;