@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,424 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPostObjectResponseFields = exports.getApiResponseFields = exports.getAccountDivideOptsFields = exports.generateFormValuesCallback2Fields = exports.generateFormValuesCallback1Fields = exports.SERVICE_SOURCE = void 0;
7
+ var _excluded = ["_source", "_serviceId"];
8
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
+ 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."); }
10
+ 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); }
11
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
+ 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; }
14
+ 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; }
15
+ 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; }
16
+ 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); }
17
+ 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; }
18
+ 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; }
19
+ 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; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ 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); }
22
+ var SERVICE_SOURCE = {
23
+ // 服务来源
24
+ APP: 'app',
25
+ QUERY: 'query',
26
+ INNER: 'inner',
27
+ PLATFORM: 'platform',
28
+ STD: 'std',
29
+ ATOM: 'atom',
30
+ RHIN: 'rhin',
31
+ SCENE: 'scene',
32
+ OBJECT: 'object',
33
+ SUPER: 'super' // 动态查询通用服务
34
+ };
35
+ /**
36
+ * 生成成功表单字段
37
+ */
38
+ exports.SERVICE_SOURCE = SERVICE_SOURCE;
39
+ var generateFormValuesCallback1Fields = function generateFormValuesCallback1Fields(kv, context, extraInfo) {
40
+ var name = kv.name,
41
+ options = kv.options,
42
+ dataId = kv.dataId,
43
+ actionObjName = kv.actionObjName;
44
+ var getComponentId = context.getComponentId,
45
+ getTodoActionByItem = context.getTodoActionByItem;
46
+ var opts = [];
47
+ var targetContainer = getComponentId(options.compId);
48
+ if (!targetContainer) return [];
49
+ if (actionObjName === 'DForm' || actionObjName === 'BOFramer') {
50
+ opts.push(_objectSpread({
51
+ title: "(".concat(name, ")\u8868\u5355\u53D6\u503C"),
52
+ value: "$values_".concat(options.compId, "$"),
53
+ formValueActionId: dataId,
54
+ targetName: name,
55
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
56
+ dataId: dataId,
57
+ type: 'object',
58
+ description: '表单数据对象,包括:字段编码和值'
59
+ }, extraInfo));
60
+ var collectionFormApi = function collectionFormApi(comps) {
61
+ comps === null || comps === void 0 ? void 0 : comps.forEach(function (comp) {
62
+ var _comp$attribute, _actionItem$todoCallb, _actionItem$todoCallb2;
63
+ var isAppChildForm = comp === null || comp === void 0 ? void 0 : (_comp$attribute = comp.attribute) === null || _comp$attribute === void 0 ? void 0 : _comp$attribute.isAppChildForm;
64
+ var isRangePicker = (comp === null || comp === void 0 ? void 0 : comp.compName) === 'DformRangePicker';
65
+ var props = comp === null || comp === void 0 ? void 0 : comp.props;
66
+ var childComponents = comp === null || comp === void 0 ? void 0 : comp.children();
67
+ var actionItem = getTodoActionByItem('value', comp.compName, true);
68
+ var callbackItem = actionItem === null || actionItem === void 0 ? void 0 : (_actionItem$todoCallb = actionItem.todoCallbacks.find(function (callback) {
69
+ return _typeof(callback) === 'object' && callback.key === 'callback1';
70
+ })) === null || _actionItem$todoCallb === void 0 ? void 0 : (_actionItem$todoCallb2 = _actionItem$todoCallb.fields) === null || _actionItem$todoCallb2 === void 0 ? void 0 : _actionItem$todoCallb2[0];
71
+ if (isAppChildForm) {
72
+ opts.push(_objectSpread({
73
+ 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") : ''),
74
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "$"),
75
+ formValueActionId: dataId,
76
+ targetName: name,
77
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
78
+ valueKey: props === null || props === void 0 ? void 0 : props.fieldProps,
79
+ dataId: dataId,
80
+ type: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.type,
81
+ description: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.description
82
+ }, extraInfo));
83
+ // 时间段选择增加起止时间
84
+ if (isRangePicker) {
85
+ opts.push({
86
+ 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") : ''),
87
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "[0]$"),
88
+ formValueActionId: dataId,
89
+ targetName: name,
90
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
91
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_begin"),
92
+ dataId: dataId,
93
+ type: 'string',
94
+ 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")
95
+ });
96
+ opts.push({
97
+ 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") : ''),
98
+ value: "$values_".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldProps, "[1]$"),
99
+ formValueActionId: dataId,
100
+ targetName: name,
101
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
102
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldProps, "_end"),
103
+ dataId: dataId,
104
+ type: 'string',
105
+ 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")
106
+ });
107
+ }
108
+ }
109
+ collectionFormApi(childComponents || []);
110
+ });
111
+ };
112
+ collectionFormApi(targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.children());
113
+ }
114
+ // pc端表单
115
+ if (actionObjName === 'Form') {
116
+ opts.push({
117
+ title: "".concat(name, "\u8868\u5355\u6570\u636E"),
118
+ value: "$".concat(options.compId, "$"),
119
+ dataId: dataId,
120
+ formValueActionId: dataId,
121
+ targetName: name,
122
+ formId: targetContainer.id,
123
+ type: 'object',
124
+ description: '表单数据对象,包括:字段编码和值'
125
+ });
126
+ var _collectionFormApi = function _collectionFormApi(comps) {
127
+ comps === null || comps === void 0 ? void 0 : comps.forEach(function (comp) {
128
+ var _comp$attribute2, _actionItem$todoCallb3, _actionItem$todoCallb4;
129
+ var isFormComponent = (comp === null || comp === void 0 ? void 0 : (_comp$attribute2 = comp.attribute) === null || _comp$attribute2 === void 0 ? void 0 : _comp$attribute2.compType) === 2;
130
+ // 时间段选择控件
131
+ var isRangePicker = (comp === null || comp === void 0 ? void 0 : comp.compName) === 'RangePicker';
132
+ var attribute = (comp === null || comp === void 0 ? void 0 : comp.attribute) || {};
133
+ var props = attribute === null || attribute === void 0 ? void 0 : attribute.props;
134
+ var childComponents = comp === null || comp === void 0 ? void 0 : comp.children();
135
+ var actionItem = getTodoActionByItem('getValue', comp.compName, false);
136
+ var callbackItem = actionItem === null || actionItem === void 0 ? void 0 : (_actionItem$todoCallb3 = actionItem.todoCallbacks.find(function (callback) {
137
+ return _typeof(callback) === 'object' && callback.key === 'callback1';
138
+ })) === null || _actionItem$todoCallb3 === void 0 ? void 0 : (_actionItem$todoCallb4 = _actionItem$todoCallb3.fields) === null || _actionItem$todoCallb4 === void 0 ? void 0 : _actionItem$todoCallb4[0];
139
+ // 解决在表单的情况下,用户删除了标题字段,出现title undefined
140
+ 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);
141
+ if (isFormComponent) {
142
+ opts.push({
143
+ 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") : ''),
144
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "$"),
145
+ formValueActionId: dataId,
146
+ targetName: name,
147
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
148
+ valueKey: props === null || props === void 0 ? void 0 : props.fieldName,
149
+ dataId: dataId,
150
+ type: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.type,
151
+ description: callbackItem === null || callbackItem === void 0 ? void 0 : callbackItem.description
152
+ });
153
+ // 时间段选择需要添加起止时间
154
+ if (isRangePicker) {
155
+ opts.push({
156
+ 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") : ''),
157
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "[0]$"),
158
+ formValueActionId: dataId,
159
+ targetName: name,
160
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
161
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_begin"),
162
+ dataId: dataId,
163
+ type: 'string',
164
+ 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")
165
+ });
166
+ opts.push({
167
+ 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") : ''),
168
+ value: "$".concat(options.compId, ".").concat(props === null || props === void 0 ? void 0 : props.fieldName, "[1]$"),
169
+ formValueActionId: dataId,
170
+ targetName: name,
171
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
172
+ valueKey: "".concat(props === null || props === void 0 ? void 0 : props.fieldName, "_end"),
173
+ dataId: dataId,
174
+ type: 'string',
175
+ 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")
176
+ });
177
+ }
178
+ }
179
+ _collectionFormApi(childComponents || []);
180
+ });
181
+ };
182
+ _collectionFormApi(targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.children());
183
+ }
184
+ return opts;
185
+ };
186
+ /**
187
+ * 生成失败表单字段
188
+ */
189
+ exports.generateFormValuesCallback1Fields = generateFormValuesCallback1Fields;
190
+ var generateFormValuesCallback2Fields = function generateFormValuesCallback2Fields(kv, context) {
191
+ var targetName = kv.name,
192
+ options = kv.options,
193
+ dataId = kv.dataId,
194
+ actionObjName = kv.actionObjName;
195
+ var getComponentId = context.getComponentId;
196
+ var opts = [];
197
+ var targetContainer = getComponentId(options.compId);
198
+ if (actionObjName === 'DForm' || actionObjName === 'BOFramer') {
199
+ opts.push({
200
+ title: "(".concat(targetName, ")\u8868\u5355\u5931\u8D25\u7ED3\u679C"),
201
+ value: "$errors_".concat(options.compId, "$"),
202
+ formValueActionId: dataId,
203
+ targetName: targetName,
204
+ formId: targetContainer.id,
205
+ dataId: dataId,
206
+ type: 'object',
207
+ description: '表单数据对象和失败信息,包括:字段编码、字段值、校验失败的字段编码和错误提示信息'
208
+ }, {
209
+ title: "(".concat(targetName, ")\u8868\u5355\u5931\u8D25\u7ED3\u679C\u9996\u4E2A\u9519\u8BEF\u4FE1\u606F"),
210
+ value: "$errors_".concat(options.compId, ".errorFields[0].errors[0]$"),
211
+ formValueActionId: dataId,
212
+ targetName: targetName,
213
+ formId: targetContainer === null || targetContainer === void 0 ? void 0 : targetContainer.id,
214
+ dataId: dataId,
215
+ type: 'string',
216
+ description: '校验失败返回的错误提示信息'
217
+ });
218
+ }
219
+ return opts;
220
+ };
221
+ exports.generateFormValuesCallback2Fields = generateFormValuesCallback2Fields;
222
+ var typeMap = {
223
+ objectArray: 'objectInArray',
224
+ field: 'string',
225
+ date: 'string',
226
+ datetime: 'string',
227
+ double: 'number',
228
+ long: 'number',
229
+ fieldArray: 'stringInArray'
230
+ };
231
+ var addOpts = function addOpts(resAttrs, opts, lastObj, parentValue) {
232
+ var disabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
233
+ var needResponseCodeKey = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
234
+ (resAttrs || []).forEach(function (c) {
235
+ var _lastObj$options, _lastObj$options2, _code$replace, _typeMap$c$attrType, _c$children;
236
+ var actionTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options = lastObj.options) === null || _lastObj$options === void 0 ? void 0 : _lastObj$options.actionTitle;
237
+ var responseId = lastObj === null || lastObj === void 0 ? void 0 : lastObj.dataId;
238
+ var serviceTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options2 = lastObj.options) === null || _lastObj$options2 === void 0 ? void 0 : _lastObj$options2._serviceTitle;
239
+ if (actionTitle && serviceTitle) {
240
+ serviceTitle = "".concat(serviceTitle, "(").concat(actionTitle, ")");
241
+ }
242
+ var code = (c === null || c === void 0 ? void 0 : c._id) || (c === null || c === void 0 ? void 0 : c.code);
243
+ 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, "$");
244
+ opts.push({
245
+ // eslint-disable-next-line no-underscore-dangle
246
+ 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),
247
+ actionTitle: actionTitle,
248
+ code: c === null || c === void 0 ? void 0 : c.code,
249
+ name: c === null || c === void 0 ? void 0 : c.name,
250
+ // 有些c._id中包含多个参数(比如param.node),要修改成param?.node
251
+ // eslint-disable-next-line no-underscore-dangle
252
+ value: value,
253
+ parentValue: parentValue,
254
+ attrType: c.type,
255
+ responseId: responseId,
256
+ serviceTitle: serviceTitle,
257
+ valueKey: code,
258
+ dataId: responseId,
259
+ disabled: needResponseCodeKey ? false : disabled,
260
+ serviceAttrType: c === null || c === void 0 ? void 0 : c.attrType,
261
+ type: (_typeMap$c$attrType = typeMap[c.attrType]) !== null && _typeMap$c$attrType !== void 0 ? _typeMap$c$attrType : c.attrType,
262
+ description: '-'
263
+ });
264
+ // 数组节点下的字段不能直接通过属性访问符访问,禁用掉
265
+ if (c === null || c === void 0 ? void 0 : (_c$children = c.children) === null || _c$children === void 0 ? void 0 : _c$children.length) {
266
+ addOpts(c.children, opts, lastObj, value, disabled || ['objectArray', 'array'].includes(c.attrType), needResponseCodeKey);
267
+ }
268
+ });
269
+ };
270
+ /**
271
+ * 获取发送请求的入参字段
272
+ * @param lastObj
273
+ * @param context
274
+ */
275
+ var getApiResponseFields = function getApiResponseFields(lastObj, context) {
276
+ var _lastObj$options3, _lastObj$options4, _targetComp$props, _targetComp$props2;
277
+ var options = lastObj.options;
278
+ var getComponentId = context.getComponentId,
279
+ callFun = context.callFun,
280
+ needResponseCodeKey = context.needResponseCodeKey;
281
+ var targetComp = getComponentId(options.compId);
282
+ // 往请求里面加入一些提示,用于区分多个请求
283
+ var actionTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options3 = lastObj.options) === null || _lastObj$options3 === void 0 ? void 0 : _lastObj$options3.actionTitle;
284
+ var responseId = lastObj === null || lastObj === void 0 ? void 0 : lastObj.dataId;
285
+ var serviceTitle = lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options4 = lastObj.options) === null || _lastObj$options4 === void 0 ? void 0 : _lastObj$options4._serviceTitle;
286
+ if (actionTitle && serviceTitle) {
287
+ serviceTitle = "".concat(serviceTitle, "(").concat(actionTitle, ")");
288
+ }
289
+ var value = "$reply_".concat(lastObj.options.id, "$");
290
+ var opts = [{
291
+ 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',
292
+ actionTitle: actionTitle,
293
+ value: value,
294
+ attrType: 'object',
295
+ responseId: responseId,
296
+ serviceTitle: serviceTitle,
297
+ // valueKey: lastObj.options.id,
298
+ isRoot: true,
299
+ dataId: responseId,
300
+ type: 'object',
301
+ description: '请求响应数据'
302
+ }];
303
+ var _lastObj$options5 = lastObj.options,
304
+ _source = _lastObj$options5._source,
305
+ _serviceId = _lastObj$options5._serviceId,
306
+ restOption = _objectWithoutProperties(_lastObj$options5, _excluded);
307
+ var resAttrs = callFun('findSelectedService', {
308
+ _source: _source,
309
+ _serviceId: _serviceId,
310
+ restOption: restOption
311
+ })[2];
312
+ // 这些服务只收集一级参数?
313
+ if ([SERVICE_SOURCE.APP,
314
+ // SERVICE_SOURCE.QUERY,
315
+ // SERVICE_SOURCE.INNER,
316
+ SERVICE_SOURCE.ATOM
317
+ // SERVICE_SOURCE.STD,
318
+ ].includes(_source)) {
319
+ opts.push.apply(opts, _toConsumableArray(resAttrs.map(function (c) {
320
+ var _c$code, _c$code$replace;
321
+ return {
322
+ title: (c === null || c === void 0 ? void 0 : c.name) ? "".concat(c.name, "\uFF08").concat(c.code, "\uFF09") : "response.".concat(c.code),
323
+ actionTitle: actionTitle,
324
+ name: c === null || c === void 0 ? void 0 : c.name,
325
+ code: c === null || c === void 0 ? void 0 : c.code,
326
+ // 有些c.code中包含多个参数(比如param.node),要修改成param?.node
327
+ 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, "$"),
328
+ parentValue: value,
329
+ attrType: c.type,
330
+ responseId: responseId,
331
+ serviceTitle: serviceTitle,
332
+ valueKey: c.code,
333
+ dataId: responseId
334
+ };
335
+ })));
336
+ } else {
337
+ addOpts(resAttrs, opts, lastObj, value, undefined, needResponseCodeKey);
338
+ }
339
+ return opts;
340
+ };
341
+ /**
342
+ * 提交业务对象
343
+ * @param lastObj
344
+ * @param context
345
+ * @returns
346
+ */
347
+ exports.getApiResponseFields = getApiResponseFields;
348
+ var getPostObjectResponseFields = function getPostObjectResponseFields(lastObj, context) {
349
+ var _lastObj$options6, _lastObj$options7;
350
+ var getRootNode = context.getRootNode;
351
+ var _getRootNode = getRootNode(),
352
+ _getRootNode$dataSour = _getRootNode.dataSource,
353
+ dataSource = _getRootNode$dataSour === void 0 ? [] : _getRootNode$dataSour;
354
+ var opts = [{
355
+ title: 'response',
356
+ actionTitle: lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options6 = lastObj.options) === null || _lastObj$options6 === void 0 ? void 0 : _lastObj$options6.actionTitle,
357
+ value: "$reply_".concat(lastObj.options.id, "$"),
358
+ attrType: 'object',
359
+ dataId: lastObj.dataId,
360
+ type: 'object'
361
+ }];
362
+ // 提交的所有数据源(业务对象)
363
+ var postDataSource = (lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options7 = lastObj.options) === null || _lastObj$options7 === void 0 ? void 0 : _lastObj$options7.postDataSource) || [];
364
+ postDataSource.map(function (m) {
365
+ var source = dataSource.find(function (d) {
366
+ return d.name === m;
367
+ });
368
+ if (source) {
369
+ var _source$config, _source$config$option, _source$config$option2, _lastObj$options8, _source$config2, _source$config2$optio, _source$config2$optio2, _typeMap$source$type;
370
+ opts.push({
371
+ 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),
372
+ actionTitle: lastObj === null || lastObj === void 0 ? void 0 : (_lastObj$options8 = lastObj.options) === null || _lastObj$options8 === void 0 ? void 0 : _lastObj$options8.actionTitle,
373
+ 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, "']$"),
374
+ attrType: 'array',
375
+ dataId: lastObj.dataId,
376
+ type: (_typeMap$source$type = typeMap[source.type]) !== null && _typeMap$source$type !== void 0 ? _typeMap$source$type : source.type
377
+ });
378
+ }
379
+ return m;
380
+ });
381
+ return opts;
382
+ };
383
+ exports.getPostObjectResponseFields = getPostObjectResponseFields;
384
+ var getAccountDivideOptsFields = function getAccountDivideOptsFields(lastObj, context) {
385
+ var opts = [];
386
+ var rootVal = "adData_".concat(lastObj.options.id);
387
+ opts.push({
388
+ title: '(分账)response',
389
+ value: "$".concat(rootVal, "$"),
390
+ dataId: lastObj.dataId
391
+ });
392
+ opts.push({
393
+ title: '(分账)response.startDate',
394
+ value: "$".concat(rootVal, ".startDate$"),
395
+ dataId: lastObj.dataId
396
+ });
397
+ opts.push({
398
+ title: '(分账)response.endDate',
399
+ value: "$".concat(rootVal, ".endDate$"),
400
+ dataId: lastObj.dataId
401
+ });
402
+ opts.push({
403
+ title: '(分账)response.payCycle',
404
+ value: "$".concat(rootVal, ".payCycle$"),
405
+ dataId: lastObj.dataId
406
+ });
407
+ opts.push({
408
+ title: '(分账)response.totalAmount',
409
+ value: "$".concat(rootVal, ".totalAmount$"),
410
+ dataId: lastObj.dataId
411
+ });
412
+ opts.push({
413
+ title: '(分账)response.list',
414
+ value: "$".concat(rootVal, ".list$"),
415
+ dataId: lastObj.dataId
416
+ });
417
+ opts.push({
418
+ title: '(分账)response.prodCode',
419
+ value: "$".concat(rootVal, ".prodCode$"),
420
+ dataId: lastObj.dataId
421
+ });
422
+ return opts;
423
+ };
424
+ exports.getAccountDivideOptsFields = getAccountDivideOptsFields;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/assets",
3
- "version": "4.1.1",
3
+ "version": "4.2.1-alpha.1",
4
4
  "description": "灵犀低代码平台移动端 - 工具类",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",