@lingxiteam/assets 4.1.1 → 4.2.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,83 @@
1
+ export interface KV {
2
+ dataName: string;
3
+ dataId: number | string;
4
+ options: {
5
+ compId: string;
6
+ compLib: string;
7
+ pageJsonId: string;
8
+ compName: string;
9
+ id: string;
10
+ [key: string]: any;
11
+ };
12
+ actionObjId: string;
13
+ actionObjName: string;
14
+ value: string;
15
+ currentCompName: string;
16
+ name: string;
17
+ }
18
+ export declare const SERVICE_SOURCE: {
19
+ APP: string;
20
+ QUERY: string;
21
+ INNER: string;
22
+ PLATFORM: string;
23
+ STD: string;
24
+ ATOM: string;
25
+ RHIN: string;
26
+ SCENE: string;
27
+ OBJECT: string;
28
+ SUPER: string;
29
+ };
30
+ export interface CallbackContext {
31
+ getComponentId: (id: string) => any;
32
+ getTodoActionByItem: (key: string, compName: string, isMobile: boolean) => any;
33
+ callFun: (key: string, ...restParams: any[]) => any;
34
+ needResponseCodeKey: boolean;
35
+ getRootNode: () => any;
36
+ }
37
+ /**
38
+ * 生成成功表单字段
39
+ */
40
+ export declare const generateFormValuesCallback1Fields: (kv: KV, context: CallbackContext, extraInfo?: {
41
+ description?: string;
42
+ type?: string;
43
+ }) => any[];
44
+ /**
45
+ * 生成失败表单字段
46
+ */
47
+ export declare const generateFormValuesCallback2Fields: (kv: KV, context: CallbackContext) => any[];
48
+ /**
49
+ * 获取发送请求的入参字段
50
+ * @param lastObj
51
+ * @param context
52
+ */
53
+ export declare const getApiResponseFields: (lastObj: KV, context: CallbackContext) => {
54
+ title: string;
55
+ actionTitle: any;
56
+ value: string;
57
+ attrType: string;
58
+ responseId: string | number;
59
+ serviceTitle: any;
60
+ isRoot: boolean;
61
+ dataId: string | number;
62
+ type: string;
63
+ description: string;
64
+ }[];
65
+ /**
66
+ * 提交业务对象
67
+ * @param lastObj
68
+ * @param context
69
+ * @returns
70
+ */
71
+ export declare const getPostObjectResponseFields: (lastObj: KV, context: CallbackContext) => {
72
+ title: string;
73
+ actionTitle: any;
74
+ value: string;
75
+ attrType: string;
76
+ dataId: string | number;
77
+ type: string;
78
+ }[];
79
+ export declare const getAccountDivideOptsFields: (lastObj: KV, context: CallbackContext) => {
80
+ title: string;
81
+ value: string;
82
+ dataId: string | number;
83
+ }[];
@@ -0,0 +1,412 @@
1
+ var _excluded = ["_source", "_serviceId"];
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ 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); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ 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; }
8
+ 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; }
9
+ 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; }
10
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
+ 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; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
+ export var SERVICE_SOURCE = {
17
+ // 服务来源
18
+ APP: 'app',
19
+ QUERY: 'query',
20
+ INNER: 'inner',
21
+ PLATFORM: 'platform',
22
+ STD: 'std',
23
+ ATOM: 'atom',
24
+ RHIN: 'rhin',
25
+ SCENE: 'scene',
26
+ OBJECT: 'object',
27
+ SUPER: 'super' // 动态查询通用服务
28
+ };
29
+ /**
30
+ * 生成成功表单字段
31
+ */
32
+ export var generateFormValuesCallback1Fields = function generateFormValuesCallback1Fields(kv, context, extraInfo) {
33
+ var name = kv.name,
34
+ options = kv.options,
35
+ dataId = kv.dataId,
36
+ actionObjName = kv.actionObjName;
37
+ var getComponentId = context.getComponentId,
38
+ getTodoActionByItem = context.getTodoActionByItem;
39
+ var opts = [];
40
+ var targetContainer = getComponentId(options.compId);
41
+ if (!targetContainer) return [];
42
+ if (actionObjName === 'DForm' || actionObjName === 'BOFramer') {
43
+ opts.push(_objectSpread({
44
+ title: "(".concat(name, ")\u8868\u5355\u53D6\u503C"),
45
+ value: "$values_".concat(options.compId, "$"),
46
+ formValueActionId: dataId,
47
+ targetName: name,
48
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
49
+ dataId: dataId,
50
+ type: 'object',
51
+ description: '表单数据对象,包括:字段编码和值'
52
+ }, extraInfo));
53
+ var collectionFormApi = function collectionFormApi(comps) {
54
+ comps === null || comps === void 0 ? void 0 : comps.forEach(function (comp) {
55
+ var _comp$attribute, _actionItem$todoCallb, _actionItem$todoCallb2;
56
+ var isAppChildForm = comp === null || comp === void 0 ? void 0 : (_comp$attribute = comp.attribute) === null || _comp$attribute === void 0 ? void 0 : _comp$attribute.isAppChildForm;
57
+ var isRangePicker = (comp === null || comp === void 0 ? void 0 : comp.compName) === 'DformRangePicker';
58
+ var props = comp === null || comp === void 0 ? void 0 : comp.props;
59
+ var childComponents = comp === null || comp === void 0 ? void 0 : comp.children();
60
+ var actionItem = getTodoActionByItem('value', comp.compName, true);
61
+ var callbackItem = actionItem === null || actionItem === void 0 ? void 0 : (_actionItem$todoCallb = actionItem.todoCallbacks.find(function (callback) {
62
+ return _typeof(callback) === 'object' && callback.key === 'callback1';
63
+ })) === null || _actionItem$todoCallb === void 0 ? void 0 : (_actionItem$todoCallb2 = _actionItem$todoCallb.fields) === null || _actionItem$todoCallb2 === void 0 ? void 0 : _actionItem$todoCallb2[0];
64
+ if (isAppChildForm) {
65
+ opts.push(_objectSpread({
66
+ title: "".concat(props === null || props === void 0 ? void 0 : props.title).concat((props === null || props === void 0 ? void 0 : props.fieldProps) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "\uFF09") : ''),
67
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "$"),
68
+ formValueActionId: dataId,
69
+ targetName: name,
70
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
71
+ valueKey: props === null || props === void 0 ? void 0 : props.fieldProps,
72
+ dataId: dataId,
73
+ type: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.type,
74
+ description: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.description
75
+ }, extraInfo));
76
+ // 时间段选择增加起止时间
77
+ if (isRangePicker) {
78
+ opts.push({
79
+ title: "".concat(props === null || props === void 0 ? void 0 : props.title, "_\u5F00\u59CB\u65F6\u95F4").concat((props === null || props === void 0 ? void 0 : props.fieldProps) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_begin\uFF09") : ''),
80
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "[0]$"),
81
+ formValueActionId: dataId,
82
+ targetName: name,
83
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
84
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_begin"),
85
+ dataId: dataId,
86
+ type: 'string',
87
+ description: "".concat(props === null || props === void 0 ? void 0 : props.title, "\u7684\u5F00\u59CB\u65F6\u95F4\uFF0C\u6309\u7167\u6307\u5B9A\u7684\u201C\u53D6\u503C\u683C\u5F0F\u201D\u8FDB\u884C\u683C\u5F0F\u5316\u8F93\u51FA")
88
+ });
89
+ opts.push({
90
+ title: "".concat(props === null || props === void 0 ? void 0 : props.title, "_\u7ED3\u675F\u65F6\u95F4").concat((props === null || props === void 0 ? void 0 : props.fieldProps) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_end\uFF09") : ''),
91
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "[1]$"),
92
+ formValueActionId: dataId,
93
+ targetName: name,
94
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
95
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_end"),
96
+ dataId: dataId,
97
+ type: 'string',
98
+ description: "".concat(props === null || props === void 0 ? void 0 : props.title, "\u7684\u7ED3\u675F\u65F6\u95F4\uFF0C\u6309\u7167\u6307\u5B9A\u7684\u201C\u53D6\u503C\u683C\u5F0F\u201D\u8FDB\u884C\u683C\u5F0F\u5316\u8F93\u51FA")
99
+ });
100
+ }
101
+ }
102
+ collectionFormApi(childComponents || []);
103
+ });
104
+ };
105
+ collectionFormApi(targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.children());
106
+ }
107
+ // pc端表单
108
+ if (actionObjName === 'Form') {
109
+ opts.push({
110
+ title: "".concat(name, "\u8868\u5355\u6570\u636E"),
111
+ value: "$".concat(options.compId, "$"),
112
+ dataId: dataId,
113
+ formValueActionId: dataId,
114
+ targetName: name,
115
+ formId: targetContainer.id,
116
+ type: 'object',
117
+ description: '表单数据对象,包括:字段编码和值'
118
+ });
119
+ var _collectionFormApi = function _collectionFormApi(comps) {
120
+ comps === null || comps === void 0 ? void 0 : comps.forEach(function (comp) {
121
+ var _comp$attribute2, _actionItem$todoCallb3, _actionItem$todoCallb4;
122
+ var isFormComponent = (comp === null || comp === void 0 ? void 0 : (_comp$attribute2 = comp.attribute) === null || _comp$attribute2 === void 0 ? void 0 : _comp$attribute2.compType) === 2;
123
+ // 时间段选择控件
124
+ var isRangePicker = (comp === null || comp === void 0 ? void 0 : comp.compName) === 'RangePicker';
125
+ var attribute = (comp === null || comp === void 0 ? void 0 : comp.attribute) || {};
126
+ var props = attribute === null || attribute === void 0 ? void 0 : attribute.props;
127
+ var childComponents = comp === null || comp === void 0 ? void 0 : comp.children();
128
+ var actionItem = getTodoActionByItem('getValue', comp.compName, false);
129
+ var callbackItem = actionItem === null || actionItem === void 0 ? void 0 : (_actionItem$todoCallb3 = actionItem.todoCallbacks.find(function (callback) {
130
+ return _typeof(callback) === 'object' && callback.key === 'callback1';
131
+ })) === null || _actionItem$todoCallb3 === void 0 ? void 0 : (_actionItem$todoCallb4 = _actionItem$todoCallb3.fields) === null || _actionItem$todoCallb4 === void 0 ? void 0 : _actionItem$todoCallb4[0];
132
+ // 解决在表单的情况下,用户删除了标题字段,出现title undefined
133
+ var title = (props === null || props === void 0 ? void 0 : props.name) || (attribute === null || attribute === void 0 ? void 0 : attribute.label) || (attribute === null || attribute === void 0 ? void 0 : attribute.compName);
134
+ if (isFormComponent) {
135
+ opts.push({
136
+ title: "".concat(title).concat((props === null || props === void 0 ? void 0 : props.fieldName) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldName, "\uFF09") : ''),
137
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "$"),
138
+ formValueActionId: dataId,
139
+ targetName: name,
140
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
141
+ valueKey: props === null || props === void 0 ? void 0 : props.fieldName,
142
+ dataId: dataId,
143
+ type: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.type,
144
+ description: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.description
145
+ });
146
+ // 时间段选择需要添加起止时间
147
+ if (isRangePicker) {
148
+ opts.push({
149
+ title: "".concat(title, "_\u5F00\u59CB\u65F6\u95F4").concat((props === null || props === void 0 ? void 0 : props.fieldName) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_begin\uFF09") : ''),
150
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "[0]$"),
151
+ formValueActionId: dataId,
152
+ targetName: name,
153
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
154
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_begin"),
155
+ dataId: dataId,
156
+ type: 'string',
157
+ description: "".concat(title, "\u7684\u5F00\u59CB\u65F6\u95F4\uFF0C\u6309\u7167\u6307\u5B9A\u7684\u201C\u53D6\u503C\u683C\u5F0F\u201D\u8FDB\u884C\u683C\u5F0F\u5316\u8F93\u51FA")
158
+ });
159
+ opts.push({
160
+ title: "".concat(title, "_\u7ED3\u675F\u65F6\u95F4").concat((props === null || props === void 0 ? void 0 : props.fieldName) ? "\uFF08".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_end\uFF09") : ''),
161
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "[1]$"),
162
+ formValueActionId: dataId,
163
+ targetName: name,
164
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
165
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_end"),
166
+ dataId: dataId,
167
+ type: 'string',
168
+ description: "".concat(props === null || props === void 0 ? void 0 : props.title, "\u7684\u7ED3\u675F\u65F6\u95F4\uFF0C\u6309\u7167\u6307\u5B9A\u7684\u201C\u53D6\u503C\u683C\u5F0F\u201D\u8FDB\u884C\u683C\u5F0F\u5316\u8F93\u51FA")
169
+ });
170
+ }
171
+ }
172
+ _collectionFormApi(childComponents || []);
173
+ });
174
+ };
175
+ _collectionFormApi(targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.children());
176
+ }
177
+ return opts;
178
+ };
179
+ /**
180
+ * 生成失败表单字段
181
+ */
182
+ export var generateFormValuesCallback2Fields = function generateFormValuesCallback2Fields(kv, context) {
183
+ var targetName = kv.name,
184
+ options = kv.options,
185
+ dataId = kv.dataId,
186
+ actionObjName = kv.actionObjName;
187
+ var getComponentId = context.getComponentId;
188
+ var opts = [];
189
+ var targetContainer = getComponentId(options.compId);
190
+ if (actionObjName === 'DForm' || actionObjName === 'BOFramer') {
191
+ opts.push({
192
+ title: "(".concat(targetName, ")\u8868\u5355\u5931\u8D25\u7ED3\u679C"),
193
+ value: "$errors_".concat(options.compId, "$"),
194
+ formValueActionId: dataId,
195
+ targetName: targetName,
196
+ formId: targetContainer.id,
197
+ dataId: dataId,
198
+ type: 'object',
199
+ description: '表单数据对象和失败信息,包括:字段编码、字段值、校验失败的字段编码和错误提示信息'
200
+ }, {
201
+ title: "(".concat(targetName, ")\u8868\u5355\u5931\u8D25\u7ED3\u679C\u9996\u4E2A\u9519\u8BEF\u4FE1\u606F"),
202
+ value: "$errors_".concat(options.compId, ".errorFields[0].errors[0]$"),
203
+ formValueActionId: dataId,
204
+ targetName: targetName,
205
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
206
+ dataId: dataId,
207
+ type: 'string',
208
+ description: '校验失败返回的错误提示信息'
209
+ });
210
+ }
211
+ return opts;
212
+ };
213
+ var typeMap = {
214
+ objectArray: 'objectInArray',
215
+ field: 'string',
216
+ date: 'string',
217
+ datetime: 'string',
218
+ double: 'number',
219
+ long: 'number',
220
+ fieldArray: 'stringInArray'
221
+ };
222
+ var addOpts = function addOpts(resAttrs, opts, lastObj, parentValue) {
223
+ var disabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
224
+ var needResponseCodeKey = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
225
+ (resAttrs || []).forEach(function (c) {
226
+ var _lastObj$options, _lastObj$options2, _code$replace, _typeMap$c$attrType, _c$children;
227
+ var actionTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options = lastObj.options) === null || _lastObj$options === void 0 ? void 0 : _lastObj$options.actionTitle;
228
+ var responseId = lastObj === null || lastObj === void 0 ? void 0 : lastObj.dataId;
229
+ var serviceTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options2 = lastObj.options) === null || _lastObj$options2 === void 0 ? void 0 : _lastObj$options2._serviceTitle;
230
+ if (actionTitle && serviceTitle) {
231
+ serviceTitle = "".concat(serviceTitle, "(").concat(actionTitle, ")");
232
+ }
233
+ var code = (c === null || c === void 0 ? void 0 : c._id) || (c === null || c === void 0 ? void 0 : c.code);
234
+ var value = "$reply_".concat(lastObj.options.id, "?.").concat((code === null || code === void 0 ? void 0 : (_code$replace = code.replace) === null || _code$replace === void 0 ? void 0 : _code$replace.call(code, /\./g, '?.')) || code, "$");
235
+ opts.push({
236
+ // eslint-disable-next-line no-underscore-dangle
237
+ title: (c === null || c === void 0 ? void 0 : c.name) ? "".concat(c === null || c === void 0 ? void 0 : c.name, "\uFF08").concat(code, "\uFF09") : "response.".concat(code),
238
+ actionTitle: actionTitle,
239
+ code: c === null || c === void 0 ? void 0 : c.code,
240
+ name: c === null || c === void 0 ? void 0 : c.name,
241
+ // 有些c._id中包含多个参数(比如param.node),要修改成param?.node
242
+ // eslint-disable-next-line no-underscore-dangle
243
+ value: value,
244
+ parentValue: parentValue,
245
+ attrType: c.type,
246
+ responseId: responseId,
247
+ serviceTitle: serviceTitle,
248
+ valueKey: code,
249
+ dataId: responseId,
250
+ disabled: needResponseCodeKey ? false : disabled,
251
+ serviceAttrType: c === null || c === void 0 ? void 0 : c.attrType,
252
+ type: (_typeMap$c$attrType = typeMap[c.attrType]) !== null && _typeMap$c$attrType !== void 0 ? _typeMap$c$attrType : c.attrType,
253
+ description: '-'
254
+ });
255
+ // 数组节点下的字段不能直接通过属性访问符访问,禁用掉
256
+ if (c === null || c === void 0 ? void 0 : (_c$children = c.children) === null || _c$children === void 0 ? void 0 : _c$children.length) {
257
+ addOpts(c.children, opts, lastObj, value, disabled || ['objectArray', 'array'].includes(c.attrType), needResponseCodeKey);
258
+ }
259
+ });
260
+ };
261
+ /**
262
+ * 获取发送请求的入参字段
263
+ * @param lastObj
264
+ * @param context
265
+ */
266
+ export var getApiResponseFields = function getApiResponseFields(lastObj, context) {
267
+ var _lastObj$options3, _lastObj$options4, _targetComp$props, _targetComp$props2;
268
+ var options = lastObj.options;
269
+ var getComponentId = context.getComponentId,
270
+ callFun = context.callFun,
271
+ needResponseCodeKey = context.needResponseCodeKey;
272
+ var targetComp = getComponentId(options.compId);
273
+ // 往请求里面加入一些提示,用于区分多个请求
274
+ var actionTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options3 = lastObj.options) === null || _lastObj$options3 === void 0 ? void 0 : _lastObj$options3.actionTitle;
275
+ var responseId = lastObj === null || lastObj === void 0 ? void 0 : lastObj.dataId;
276
+ var serviceTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options4 = lastObj.options) === null || _lastObj$options4 === void 0 ? void 0 : _lastObj$options4._serviceTitle;
277
+ if (actionTitle && serviceTitle) {
278
+ serviceTitle = "".concat(serviceTitle, "(").concat(actionTitle, ")");
279
+ }
280
+ var value = "$reply_".concat(lastObj.options.id, "$");
281
+ var opts = [{
282
+ title: (targetComp === null || targetComp === void 0 ? void 0 : (_targetComp$props = targetComp.props) === null || _targetComp$props === void 0 ? void 0 : _targetComp$props.name) ? "response(".concat(targetComp === null || targetComp === void 0 ? void 0 : (_targetComp$props2 = targetComp.props) === null || _targetComp$props2 === void 0 ? void 0 : _targetComp$props2.name, ")") : 'response',
283
+ actionTitle: actionTitle,
284
+ value: value,
285
+ attrType: 'object',
286
+ responseId: responseId,
287
+ serviceTitle: serviceTitle,
288
+ // valueKey: lastObj.options.id,
289
+ isRoot: true,
290
+ dataId: responseId,
291
+ type: 'object',
292
+ description: '请求响应数据'
293
+ }];
294
+ var _lastObj$options5 = lastObj.options,
295
+ _source = _lastObj$options5._source,
296
+ _serviceId = _lastObj$options5._serviceId,
297
+ restOption = _objectWithoutProperties(_lastObj$options5, _excluded);
298
+ var resAttrs = callFun('findSelectedService', {
299
+ _source: _source,
300
+ _serviceId: _serviceId,
301
+ restOption: restOption
302
+ })[2];
303
+ // 这些服务只收集一级参数?
304
+ if ([SERVICE_SOURCE.APP,
305
+ // SERVICE_SOURCE.QUERY,
306
+ // SERVICE_SOURCE.INNER,
307
+ SERVICE_SOURCE.ATOM
308
+ // SERVICE_SOURCE.STD,
309
+ ].includes(_source)) {
310
+ opts.push.apply(opts, _toConsumableArray(resAttrs.map(function (c) {
311
+ var _c$code, _c$code$replace;
312
+ return {
313
+ title: (c === null || c === void 0 ? void 0 : c.name) ? "".concat(c.name, "\uFF08").concat(c.code, "\uFF09") : "response.".concat(c.code),
314
+ actionTitle: actionTitle,
315
+ name: c === null || c === void 0 ? void 0 : c.name,
316
+ code: c === null || c === void 0 ? void 0 : c.code,
317
+ // 有些c.code中包含多个参数(比如param.node),要修改成param?.node
318
+ value: "$reply_".concat(lastObj.options.id, "?.").concat(((_c$code = c.code) === null || _c$code === void 0 ? void 0 : (_c$code$replace = _c$code.replace) === null || _c$code$replace === void 0 ? void 0 : _c$code$replace.call(_c$code, /\./g, '?.')) || c.code, "$"),
319
+ parentValue: value,
320
+ attrType: c.type,
321
+ responseId: responseId,
322
+ serviceTitle: serviceTitle,
323
+ valueKey: c.code,
324
+ dataId: responseId
325
+ };
326
+ })));
327
+ } else {
328
+ addOpts(resAttrs, opts, lastObj, value, undefined, needResponseCodeKey);
329
+ }
330
+ return opts;
331
+ };
332
+ /**
333
+ * 提交业务对象
334
+ * @param lastObj
335
+ * @param context
336
+ * @returns
337
+ */
338
+ export var getPostObjectResponseFields = function getPostObjectResponseFields(lastObj, context) {
339
+ var _lastObj$options6, _lastObj$options7;
340
+ var getRootNode = context.getRootNode;
341
+ var _getRootNode = getRootNode(),
342
+ _getRootNode$dataSour = _getRootNode.dataSource,
343
+ dataSource = _getRootNode$dataSour === void 0 ? [] : _getRootNode$dataSour;
344
+ var opts = [{
345
+ title: 'response',
346
+ actionTitle: lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options6 = lastObj.options) === null || _lastObj$options6 === void 0 ? void 0 : _lastObj$options6.actionTitle,
347
+ value: "$reply_".concat(lastObj.options.id, "$"),
348
+ attrType: 'object',
349
+ dataId: lastObj.dataId,
350
+ type: 'object'
351
+ }];
352
+ // 提交的所有数据源(业务对象)
353
+ var postDataSource = (lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options7 = lastObj.options) === null || _lastObj$options7 === void 0 ? void 0 : _lastObj$options7.postDataSource) || [];
354
+ postDataSource.map(function (m) {
355
+ var source = dataSource.find(function (d) {
356
+ return d.name === m;
357
+ });
358
+ if (source) {
359
+ var _source$config, _source$config$option, _source$config$option2, _lastObj$options8, _source$config2, _source$config2$optio, _source$config2$optio2, _typeMap$source$type;
360
+ opts.push({
361
+ title: "\u8FD4\u56DE\u5BF9\u8C61-".concat(source === null || source === void 0 ? void 0 : (_source$config = source.config) === null || _source$config === void 0 ? void 0 : (_source$config$option = _source$config.options) === null || _source$config$option === void 0 ? void 0 : (_source$config$option2 = _source$config$option.object) === null || _source$config$option2 === void 0 ? void 0 : _source$config$option2.busiObjectName),
362
+ actionTitle: lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options8 = lastObj.options) === null || _lastObj$options8 === void 0 ? void 0 : _lastObj$options8.actionTitle,
363
+ value: "$reply_".concat(lastObj.options.id, "?.['").concat(source === null || source === void 0 ? void 0 : (_source$config2 = source.config) === null || _source$config2 === void 0 ? void 0 : (_source$config2$optio = _source$config2.options) === null || _source$config2$optio === void 0 ? void 0 : (_source$config2$optio2 = _source$config2$optio.object) === null || _source$config2$optio2 === void 0 ? void 0 : _source$config2$optio2.busiObjectId, "']$"),
364
+ attrType: 'array',
365
+ dataId: lastObj.dataId,
366
+ type: (_typeMap$source$type = typeMap[source.type]) !== null && _typeMap$source$type !== void 0 ? _typeMap$source$type : source.type
367
+ });
368
+ }
369
+ return m;
370
+ });
371
+ return opts;
372
+ };
373
+ export var getAccountDivideOptsFields = function getAccountDivideOptsFields(lastObj, context) {
374
+ var opts = [];
375
+ var rootVal = "adData_".concat(lastObj.options.id);
376
+ opts.push({
377
+ title: '(分账)response',
378
+ value: "$".concat(rootVal, "$"),
379
+ dataId: lastObj.dataId
380
+ });
381
+ opts.push({
382
+ title: '(分账)response.startDate',
383
+ value: "$".concat(rootVal, ".startDate$"),
384
+ dataId: lastObj.dataId
385
+ });
386
+ opts.push({
387
+ title: '(分账)response.endDate',
388
+ value: "$".concat(rootVal, ".endDate$"),
389
+ dataId: lastObj.dataId
390
+ });
391
+ opts.push({
392
+ title: '(分账)response.payCycle',
393
+ value: "$".concat(rootVal, ".payCycle$"),
394
+ dataId: lastObj.dataId
395
+ });
396
+ opts.push({
397
+ title: '(分账)response.totalAmount',
398
+ value: "$".concat(rootVal, ".totalAmount$"),
399
+ dataId: lastObj.dataId
400
+ });
401
+ opts.push({
402
+ title: '(分账)response.list',
403
+ value: "$".concat(rootVal, ".list$"),
404
+ dataId: lastObj.dataId
405
+ });
406
+ opts.push({
407
+ title: '(分账)response.prodCode',
408
+ value: "$".concat(rootVal, ".prodCode$"),
409
+ dataId: lastObj.dataId
410
+ });
411
+ return opts;
412
+ };
@@ -20,7 +20,8 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
20
20
  onOk = props.onOk,
21
21
  onCancel = props.onCancel,
22
22
  okText = props.okText,
23
- cancelText = props.cancelText;
23
+ cancelText = props.cancelText,
24
+ showErrorCode = props.showErrorCode;
24
25
  return visible ? /*#__PURE__*/_react.default.createElement("div", {
25
26
  className: "lxm-modal-wraper",
26
27
  ref: ref
@@ -37,7 +38,7 @@ var Modal = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
37
38
  alt: ""
38
39
  })), title ? /*#__PURE__*/_react.default.createElement("div", {
39
40
  className: "lxm-modal-title"
40
- }, title) : '', subtitle ? /*#__PURE__*/_react.default.createElement("div", {
41
+ }, title) : '', showErrorCode !== false && subtitle ? /*#__PURE__*/_react.default.createElement("div", {
41
42
  className: "lxm-modal-subtitle"
42
43
  }, subtitle) : '', content ? /*#__PURE__*/_react.default.createElement("div", {
43
44
  className: "lxm-modal-content"
@@ -12,6 +12,8 @@ var defaultGlobalConfig = {
12
12
  maxLen: null,
13
13
  showType: 'modal',
14
14
  maxCount: null,
15
+ showErrorCode: true,
16
+ // 在错误提示框里展示错误编码
15
17
  resolve: process.env.LingXi_ERROR_RESOLVE || (0, _compUtils.resolveRequestPath)('/lcdp/error/queryErrorInfoByCodeOrMsg'),
16
18
  okText: '查看详情',
17
19
  cancelText: '知道了',
@@ -32,7 +32,8 @@ var Notice = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
32
32
  maxLen = props.maxLen,
33
33
  duration = props.duration,
34
34
  badge = props.badge,
35
- onShowStash = props.onShowStash;
35
+ onShowStash = props.onShowStash,
36
+ showErrorCode = props.showErrorCode;
36
37
  var _useState = (0, _react.useState)(),
37
38
  _useState2 = _slicedToArray(_useState, 2),
38
39
  footerContent = _useState2[0],
@@ -120,7 +121,7 @@ var Notice = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
120
121
  className: "lx-notification-notice-head-state"
121
122
  }), /*#__PURE__*/_react.default.createElement("div", {
122
123
  className: "lx-notification-notice-head-title"
123
- }, title, isDomEle(code) ? /*#__PURE__*/_react.default.createElement("span", {
124
+ }, title, showErrorCode !== false && isDomEle(code) ? /*#__PURE__*/_react.default.createElement("span", {
124
125
  className: "lx-notification-notice-head-code"
125
126
  }, code) : ''), isDomEle(extra) ? /*#__PURE__*/_react.default.createElement("div", {
126
127
  className: "lx-notification-notice-head-extra"
@@ -57,9 +57,7 @@ var Notification = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
57
57
  return item.key !== key;
58
58
  });
59
59
  });
60
- if (stashOpenList.length) {
61
- setStashOpenList([]);
62
- }
60
+ setStashOpenList([]);
63
61
  };
64
62
  var onAddNotice = function onAddNotice(config) {
65
63
  setConfigList(function (list) {
@@ -17,6 +17,8 @@ var defaultGlobalConfig = {
17
17
  // 最大错误显示数据
18
18
  showBadge: false,
19
19
  // 展示当前错误徽标数,当maxCount为1时生效
20
+ showErrorCode: true,
21
+ // 在错误提示框里展示错误编码
20
22
  placement: 'topRight',
21
23
  // 'topRight', 'topLeft', 'bottomRight', 'bottomLeft'
22
24
  extendFooter: null,
@@ -1,5 +1,7 @@
1
1
  import * as mobileRootConfig from './mobile';
2
2
  import * as pcRootConfig from './pc';
3
+ import * as todoCallback from './todoCallback';
3
4
  export { getTodoActionListByKey } from './todoActionList';
4
5
  export { default as todoOptionList } from './todoOptionList';
5
- export { mobileRootConfig, pcRootConfig, };
6
+ export type { KV } from './todoCallback';
7
+ export { mobileRootConfig, pcRootConfig, todoCallback, };
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "getTodoActionListByKey", {
10
10
  return _todoActionList.getTodoActionListByKey;
11
11
  }
12
12
  });
13
- exports.pcRootConfig = exports.mobileRootConfig = void 0;
13
+ exports.todoCallback = exports.pcRootConfig = exports.mobileRootConfig = void 0;
14
14
  Object.defineProperty(exports, "todoOptionList", {
15
15
  enumerable: true,
16
16
  get: function get() {
@@ -21,6 +21,8 @@ var mobileRootConfig = _interopRequireWildcard(require("./mobile"));
21
21
  exports.mobileRootConfig = mobileRootConfig;
22
22
  var pcRootConfig = _interopRequireWildcard(require("./pc"));
23
23
  exports.pcRootConfig = pcRootConfig;
24
+ var todoCallback = _interopRequireWildcard(require("./todoCallback"));
25
+ exports.todoCallback = todoCallback;
24
26
  var _todoActionList = require("./todoActionList");
25
27
  var _todoOptionList = _interopRequireDefault(require("./todoOptionList"));
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }