@fecp/designer 5.6.30 → 5.6.31
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.
- package/es/_virtual/_commonjsHelpers.mjs +25 -0
- package/es/_virtual/index.mjs +4 -4
- package/es/_virtual/index2.mjs +2 -5
- package/es/_virtual/index3.mjs +5 -3
- package/es/_virtual/index4.mjs +5 -2
- package/es/_virtual/index5.mjs +3 -2
- package/es/_virtual/index6.mjs +4 -0
- package/es/_virtual/index7.mjs +4 -0
- package/es/config-dev.js +2 -0
- package/es/designer/package.json.mjs +1 -1
- package/es/designer/src/axios/config.mjs +10 -3
- package/es/designer/src/axios/crypto.mjs +1 -5
- package/es/designer/src/packages/aiForm/AiDiffTable.vue.mjs +152 -0
- package/es/designer/src/packages/aiForm/api.mjs +21 -0
- package/es/designer/src/packages/aiForm/apply.mjs +153 -0
- package/es/designer/src/packages/aiForm/compressConfig.mjs +69 -0
- package/es/designer/src/packages/aiForm/constants.mjs +184 -0
- package/es/designer/src/packages/aiForm/diff.mjs +140 -0
- package/es/designer/src/packages/aiForm/index.vue.mjs +301 -0
- package/es/designer/src/packages/aiForm/normalizeFieldList.mjs +138 -0
- package/es/designer/src/packages/aiForm/parseAiResult.mjs +245 -0
- package/es/designer/src/packages/aiForm/prompt.mjs +130 -0
- package/es/designer/src/packages/aiForm/useAiFormDrawer.mjs +16 -0
- package/es/designer/src/packages/dataSource/dataSource.vue.mjs +45 -30
- package/es/designer/src/packages/form/headerBtn.vue.mjs +4 -1
- package/es/designer/src/packages/form/index.vue.mjs +16 -2
- package/es/designer/src/packages/utils/datasource.mjs +14 -1
- package/es/designer.css +444 -153
- package/es/node_modules/@braintree/sanitize-url/dist/index.mjs +1 -1
- package/es/node_modules/diagram-js/lib/model/index.mjs +1 -1
- package/es/node_modules/element-plus/es/utils/vue/icon.mjs +1 -1
- package/es/node_modules/highlight.js/es/index.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-LMCZKHZV.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/chunk-32BRIVSS.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICXQ74PX.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-OUVF2IWQ.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-EOCWNBFH.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-23GEKE2U.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-NO4QXBWP.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-DBY2YBRQ.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-2N3HPSRC.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-6OUMAXLB.mjs +1 -1
- package/es/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-G3AALYLV.mjs +1 -1
- package/es/node_modules/object-refs/index.mjs +1 -1
- package/es/packages/mobile/src/axios/config.mjs +8 -4
- package/es/packages/mobile/src/components/ai/MarkdownRenderer/MarkdownRenderer.vue.mjs +1 -1
- package/es/packages/mobile/src/components/custom/approvalBar/ApprovalBar.vue.mjs +53 -13
- package/es/packages/mobile/src/components/custom/approvalBar/FlowUserSelect.vue.mjs +215 -0
- package/es/packages/mobile/src/components/dataDisplay/cardList/CardList.vue.mjs +19 -15
- package/es/packages/mobile/src/utils/datasource.mjs +14 -1
- package/es/packages/mobile/src/utils/formatterUtil.mjs +24 -12
- package/es/packages/vue/src/components/forms/form/Form.vue.mjs +5 -7
- package/es/packages/vue/src/utils/datasource.mjs +14 -1
- package/lib/_virtual/_commonjsHelpers.js +25 -0
- package/lib/_virtual/index.js +4 -4
- package/lib/_virtual/index2.js +3 -6
- package/lib/_virtual/index3.js +6 -4
- package/lib/_virtual/index4.js +6 -3
- package/lib/_virtual/index5.js +3 -2
- package/lib/_virtual/index6.js +4 -0
- package/lib/_virtual/index7.js +4 -0
- package/lib/config-dev.js +2 -0
- package/lib/designer/package.json.js +1 -1
- package/lib/designer/src/axios/config.js +10 -3
- package/lib/designer/src/axios/crypto.js +0 -4
- package/lib/designer/src/packages/aiForm/AiDiffTable.vue.js +152 -0
- package/lib/designer/src/packages/aiForm/api.js +21 -0
- package/lib/designer/src/packages/aiForm/apply.js +153 -0
- package/lib/designer/src/packages/aiForm/compressConfig.js +69 -0
- package/lib/designer/src/packages/aiForm/constants.js +184 -0
- package/lib/designer/src/packages/aiForm/diff.js +140 -0
- package/lib/designer/src/packages/aiForm/index.vue.js +301 -0
- package/lib/designer/src/packages/aiForm/normalizeFieldList.js +138 -0
- package/lib/designer/src/packages/aiForm/parseAiResult.js +245 -0
- package/lib/designer/src/packages/aiForm/prompt.js +130 -0
- package/lib/designer/src/packages/aiForm/useAiFormDrawer.js +16 -0
- package/lib/designer/src/packages/dataSource/dataSource.vue.js +44 -29
- package/lib/designer/src/packages/form/headerBtn.vue.js +4 -1
- package/lib/designer/src/packages/form/index.vue.js +15 -1
- package/lib/designer/src/packages/utils/datasource.js +14 -1
- package/lib/designer.css +444 -153
- package/lib/node_modules/@braintree/sanitize-url/dist/index.js +1 -1
- package/lib/node_modules/diagram-js/lib/model/index.js +1 -1
- package/lib/node_modules/highlight.js/es/index.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-LMCZKHZV.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/chunk-32BRIVSS.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICXQ74PX.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-OUVF2IWQ.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-EOCWNBFH.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-23GEKE2U.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-NO4QXBWP.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-DBY2YBRQ.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-2N3HPSRC.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-6OUMAXLB.js +1 -1
- package/lib/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-G3AALYLV.js +1 -1
- package/lib/node_modules/object-refs/index.js +1 -1
- package/lib/packages/mobile/src/axios/config.js +8 -4
- package/lib/packages/mobile/src/components/ai/MarkdownRenderer/MarkdownRenderer.vue.js +1 -1
- package/lib/packages/mobile/src/components/custom/approvalBar/ApprovalBar.vue.js +52 -12
- package/lib/packages/mobile/src/components/custom/approvalBar/FlowUserSelect.vue.js +215 -0
- package/lib/packages/mobile/src/components/dataDisplay/cardList/CardList.vue.js +19 -15
- package/lib/packages/mobile/src/utils/datasource.js +14 -1
- package/lib/packages/mobile/src/utils/formatterUtil.js +24 -12
- package/lib/packages/vue/src/components/forms/form/Form.vue.js +4 -6
- package/lib/packages/vue/src/utils/datasource.js +14 -1
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ require("../../store/index.js");
|
|
|
23
23
|
const vue3JsonViewer = require("../../../../node_modules/vue3-json-viewer/dist/vue3-json-viewer.js");
|
|
24
24
|
;/* empty css */
|
|
25
25
|
const env = require("../../utils/env.js");
|
|
26
|
+
const datasource = require("../utils/datasource.js");
|
|
26
27
|
;/* empty css */
|
|
27
28
|
;/* empty css */
|
|
28
29
|
;/* empty css */
|
|
@@ -39,23 +40,27 @@ const index$9 = require("../../../../node_modules/element-plus/es/components/tag
|
|
|
39
40
|
const index$a = require("../../../../node_modules/element-plus/es/components/message/index.js");
|
|
40
41
|
const _hoisted_1 = { class: "data-source" };
|
|
41
42
|
const _hoisted_2 = { class: "config-section" };
|
|
42
|
-
const _hoisted_3 = {
|
|
43
|
-
const _hoisted_4 = {
|
|
43
|
+
const _hoisted_3 = {
|
|
44
44
|
key: 0,
|
|
45
45
|
class: "condition-desc"
|
|
46
46
|
};
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const _hoisted_4 = { class: "desc-content" };
|
|
48
|
+
const _hoisted_5 = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "condition-desc"
|
|
51
|
+
};
|
|
52
|
+
const _hoisted_6 = { class: "test-section" };
|
|
53
|
+
const _hoisted_7 = { class: "section-header" };
|
|
54
|
+
const _hoisted_8 = { class: "section-title" };
|
|
55
|
+
const _hoisted_9 = {
|
|
51
56
|
key: 0,
|
|
52
57
|
class: "response-area"
|
|
53
58
|
};
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
+
const _hoisted_10 = { class: "response-title" };
|
|
60
|
+
const _hoisted_11 = { class: "response-actions" };
|
|
61
|
+
const _hoisted_12 = { class: "response-status" };
|
|
62
|
+
const _hoisted_13 = { class: "response-time" };
|
|
63
|
+
const _hoisted_14 = {
|
|
59
64
|
key: 1,
|
|
60
65
|
class: "empty-response"
|
|
61
66
|
};
|
|
@@ -72,13 +77,23 @@ const _sfc_main = {
|
|
|
72
77
|
const loading = Vue.ref(false);
|
|
73
78
|
const responseData = Vue.ref("");
|
|
74
79
|
const requestTime = Vue.ref(0);
|
|
80
|
+
function isAbsoluteUrl(url) {
|
|
81
|
+
return /^https?:\/\//i.test(url || "");
|
|
82
|
+
}
|
|
75
83
|
const serversOptions = Vue.ref([]);
|
|
76
84
|
for (const key in env.default.servers) {
|
|
85
|
+
const value = env.default.servers[key];
|
|
77
86
|
serversOptions.value.push({
|
|
78
|
-
|
|
79
|
-
value:
|
|
87
|
+
//外部 HTTP 服务(绝对地址)直接展示地址,便于识别
|
|
88
|
+
label: isAbsoluteUrl(value) ? `${key}(${value})` : key,
|
|
89
|
+
value
|
|
80
90
|
});
|
|
81
91
|
}
|
|
92
|
+
const isExternalServer = Vue.computed(() => {
|
|
93
|
+
var _a;
|
|
94
|
+
const serverName = ((_a = props.requestConfigData) == null ? void 0 : _a.serverName) || "";
|
|
95
|
+
return isAbsoluteUrl(env.default.servers[serverName] || serverName);
|
|
96
|
+
});
|
|
82
97
|
Vue.watch(
|
|
83
98
|
() => props.requestConfigData,
|
|
84
99
|
() => {
|
|
@@ -108,8 +123,7 @@ const _sfc_main = {
|
|
|
108
123
|
params[param.key] = param.value;
|
|
109
124
|
}
|
|
110
125
|
});
|
|
111
|
-
const
|
|
112
|
-
const fullUrl = `${baseUrl}${requestConfig.url}`;
|
|
126
|
+
const fullUrl = datasource.buildRequestUrl(requestConfig);
|
|
113
127
|
let res;
|
|
114
128
|
if (requestConfig.method === "get") {
|
|
115
129
|
const queryString = new URLSearchParams(params).toString();
|
|
@@ -210,7 +224,8 @@ const _sfc_main = {
|
|
|
210
224
|
modelValue: __props.requestConfigData.url,
|
|
211
225
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => __props.requestConfigData.url = $event),
|
|
212
226
|
placeholder: "请输入请求URL"
|
|
213
|
-
}, null, 8, ["modelValue"])
|
|
227
|
+
}, null, 8, ["modelValue"]),
|
|
228
|
+
Vue.unref(isExternalServer) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_3, " 外部 HTTP 地址:将直接请求该地址,请确保目标服务允许跨域(CORS)访问。 ")) : Vue.createCommentVNode("", true)
|
|
214
229
|
]),
|
|
215
230
|
_: 1
|
|
216
231
|
}),
|
|
@@ -241,7 +256,7 @@ const _sfc_main = {
|
|
|
241
256
|
}),
|
|
242
257
|
Vue.createVNode(_component_el_form_item, { label: "内容类型" }, {
|
|
243
258
|
default: Vue.withCtx(() => [
|
|
244
|
-
Vue.createElementVNode("div",
|
|
259
|
+
Vue.createElementVNode("div", _hoisted_4, [
|
|
245
260
|
Vue.createVNode(_component_el_radio_group, {
|
|
246
261
|
modelValue: __props.requestConfigData.contentType,
|
|
247
262
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => __props.requestConfigData.contentType = $event)
|
|
@@ -274,7 +289,7 @@ const _sfc_main = {
|
|
|
274
289
|
]),
|
|
275
290
|
_: 1
|
|
276
291
|
}, 8, ["modelValue"]),
|
|
277
|
-
__props.requestConfigData.contentType == "upload" ? (Vue.openBlock(), Vue.createElementBlock("div",
|
|
292
|
+
__props.requestConfigData.contentType == "upload" ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_5, " 单文件上传键名: file, 多文件上传键名: files。 ")) : Vue.createCommentVNode("", true)
|
|
278
293
|
])
|
|
279
294
|
]),
|
|
280
295
|
_: 1
|
|
@@ -292,9 +307,9 @@ const _sfc_main = {
|
|
|
292
307
|
_: 1
|
|
293
308
|
}, 8, ["model"])
|
|
294
309
|
]),
|
|
295
|
-
Vue.createElementVNode("div",
|
|
296
|
-
Vue.createElementVNode("div",
|
|
297
|
-
Vue.createElementVNode("span",
|
|
310
|
+
Vue.createElementVNode("div", _hoisted_6, [
|
|
311
|
+
Vue.createElementVNode("div", _hoisted_7, [
|
|
312
|
+
Vue.createElementVNode("span", _hoisted_8, [
|
|
298
313
|
Vue.createVNode(_component_el_icon, { class: "section-icon" }, {
|
|
299
314
|
default: Vue.withCtx(() => [
|
|
300
315
|
Vue.createVNode(Vue.unref(index$7.VideoPlay))
|
|
@@ -316,10 +331,10 @@ const _sfc_main = {
|
|
|
316
331
|
_: 1
|
|
317
332
|
}, 8, ["icon", "loading"])
|
|
318
333
|
]),
|
|
319
|
-
Vue.unref(responseData) ? (Vue.openBlock(), Vue.createElementBlock("div",
|
|
320
|
-
Vue.createElementVNode("div",
|
|
334
|
+
Vue.unref(responseData) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_9, [
|
|
335
|
+
Vue.createElementVNode("div", _hoisted_10, [
|
|
321
336
|
_cache[14] || (_cache[14] = Vue.createElementVNode("span", null, "响应结果", -1)),
|
|
322
|
-
Vue.createElementVNode("div",
|
|
337
|
+
Vue.createElementVNode("div", _hoisted_11, [
|
|
323
338
|
Vue.createVNode(_component_el_button, {
|
|
324
339
|
size: "small",
|
|
325
340
|
text: "",
|
|
@@ -333,7 +348,7 @@ const _sfc_main = {
|
|
|
333
348
|
}, 8, ["icon"])
|
|
334
349
|
])
|
|
335
350
|
]),
|
|
336
|
-
Vue.createElementVNode("div",
|
|
351
|
+
Vue.createElementVNode("div", _hoisted_12, [
|
|
337
352
|
Vue.createVNode(_component_el_tag, {
|
|
338
353
|
type: Vue.unref(responseData).status >= 200 && Vue.unref(responseData).status < 300 ? "success" : "danger",
|
|
339
354
|
size: "small"
|
|
@@ -343,7 +358,7 @@ const _sfc_main = {
|
|
|
343
358
|
]),
|
|
344
359
|
_: 1
|
|
345
360
|
}, 8, ["type"]),
|
|
346
|
-
Vue.createElementVNode("span",
|
|
361
|
+
Vue.createElementVNode("span", _hoisted_13, "耗时: " + Vue.toDisplayString(Vue.unref(requestTime)) + "ms", 1)
|
|
347
362
|
]),
|
|
348
363
|
Vue.createVNode(Vue.unref(vue3JsonViewer.JsonViewer), {
|
|
349
364
|
value: Vue.unref(responseData).data,
|
|
@@ -351,7 +366,7 @@ const _sfc_main = {
|
|
|
351
366
|
boxed: "",
|
|
352
367
|
"show-array-index": false
|
|
353
368
|
}, null, 8, ["value"])
|
|
354
|
-
])) : (Vue.openBlock(), Vue.createElementBlock("div",
|
|
369
|
+
])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_14, [
|
|
355
370
|
Vue.createVNode(_component_el_icon, { class: "empty-icon" }, {
|
|
356
371
|
default: Vue.withCtx(() => [
|
|
357
372
|
Vue.createVNode(Vue.unref(index$7.Document))
|
|
@@ -369,7 +384,7 @@ const _sfc_main = {
|
|
|
369
384
|
name: "dataHandler"
|
|
370
385
|
}, {
|
|
371
386
|
default: Vue.withCtx(() => _cache[16] || (_cache[16] = [
|
|
372
|
-
Vue.createTextVNode("
|
|
387
|
+
Vue.createTextVNode("待开发")
|
|
373
388
|
])),
|
|
374
389
|
_: 1
|
|
375
390
|
})
|
|
@@ -383,5 +398,5 @@ const _sfc_main = {
|
|
|
383
398
|
};
|
|
384
399
|
}
|
|
385
400
|
};
|
|
386
|
-
const DataSource = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
401
|
+
const DataSource = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-8491c9bd"]]);
|
|
387
402
|
exports.default = DataSource;
|
|
@@ -13,9 +13,11 @@ const useDialogDialog = require("../dialog/useDialogDialog.js");
|
|
|
13
13
|
const useDialogGlobalDialog = require("../dialogGlobal/useDialogGlobalDialog.js");
|
|
14
14
|
const useProdDialog = require("../prod/useProdDialog.js");
|
|
15
15
|
const useImportantDataChangeDialog = require("../importantDataChange/useImportantDataChangeDialog.js");
|
|
16
|
+
const useAiFormDrawer = require("../aiForm/useAiFormDrawer.js");
|
|
16
17
|
const index$1 = require("../../../../node_modules/@element-plus/icons-vue/dist/index.js");
|
|
17
18
|
const common = require("../utils/common.js");
|
|
18
19
|
;/* empty css */
|
|
20
|
+
;/* empty css */
|
|
19
21
|
const _pluginVue_exportHelper = require("../../../../_virtual/_plugin-vue_export-helper.js");
|
|
20
22
|
const index = require("../../../../node_modules/element-plus/es/components/icon/index.js");
|
|
21
23
|
const _hoisted_1 = { class: "header-btns" };
|
|
@@ -55,6 +57,7 @@ const _sfc_main = {
|
|
|
55
57
|
openImportantDataChangeDialog,
|
|
56
58
|
ImportantDataChangeDialog
|
|
57
59
|
} = useImportantDataChangeDialog.useImportantDataChangeDialog();
|
|
60
|
+
useAiFormDrawer.useAiFormDrawer();
|
|
58
61
|
Vue.computed(() => {
|
|
59
62
|
return common.getEditConfigData();
|
|
60
63
|
});
|
|
@@ -205,5 +208,5 @@ const _sfc_main = {
|
|
|
205
208
|
};
|
|
206
209
|
}
|
|
207
210
|
};
|
|
208
|
-
const formHeaderBtn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
211
|
+
const formHeaderBtn = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-66d82ad3"]]);
|
|
209
212
|
exports.default = formHeaderBtn;
|
|
@@ -325,6 +325,20 @@ const _sfc_main = {
|
|
|
325
325
|
eventBus.default.on("resizeEvent", () => {
|
|
326
326
|
gridLayout.value.resizeEvent();
|
|
327
327
|
});
|
|
328
|
+
eventBus.default.on("refreshFormFields", () => {
|
|
329
|
+
const cfg = common.getEditConfigData();
|
|
330
|
+
(cfg.fieldsData || []).forEach((item) => {
|
|
331
|
+
if (item == null ? void 0 : item.component) {
|
|
332
|
+
item.component = { ...index.defaultProperty, ...item.component };
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
editConfigData.value = cfg;
|
|
336
|
+
layoutData.value = cfg.fieldsData || [];
|
|
337
|
+
Vue.nextTick(() => {
|
|
338
|
+
var _a;
|
|
339
|
+
return (_a = gridLayout.value) == null ? void 0 : _a.resizeEvent();
|
|
340
|
+
});
|
|
341
|
+
});
|
|
328
342
|
Vue.ref(/* @__PURE__ */ new Map());
|
|
329
343
|
const isDragging = Vue.computed(() => {
|
|
330
344
|
var _a;
|
|
@@ -519,5 +533,5 @@ const _sfc_main = {
|
|
|
519
533
|
};
|
|
520
534
|
}
|
|
521
535
|
};
|
|
522
|
-
const formWorkArea = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-
|
|
536
|
+
const formWorkArea = /* @__PURE__ */ _pluginVue_exportHelper.default(_sfc_main, [["__scopeId", "data-v-c54438be"]]);
|
|
523
537
|
exports.default = formWorkArea;
|
|
@@ -78,7 +78,7 @@ class DataSourceManager {
|
|
|
78
78
|
const currentDs = this.getCurrentDataSource();
|
|
79
79
|
if (!currentDs) return {};
|
|
80
80
|
const config = {
|
|
81
|
-
url:
|
|
81
|
+
url: buildRequestUrl(currentDs),
|
|
82
82
|
method: currentDs.method
|
|
83
83
|
};
|
|
84
84
|
if (currentDs.contentType === "formData") {
|
|
@@ -290,9 +290,22 @@ class DataSourceManager {
|
|
|
290
290
|
this.events.error = [];
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
+
function resolveServerBase(serverName) {
|
|
294
|
+
const servers = typeof window !== "undefined" && window.$servers || {};
|
|
295
|
+
return servers[serverName] ?? serverName ?? "";
|
|
296
|
+
}
|
|
297
|
+
function buildRequestUrl(dataSource) {
|
|
298
|
+
const base = resolveServerBase(dataSource == null ? void 0 : dataSource.serverName).replace(/\/+$/, "");
|
|
299
|
+
const url = (dataSource == null ? void 0 : dataSource.url) || "";
|
|
300
|
+
if (/^https?:\/\//i.test(url)) return url;
|
|
301
|
+
if (/^https?:\/\//i.test(base)) return `${base}/${url.replace(/^\/+/, "")}`;
|
|
302
|
+
if (!base) return url;
|
|
303
|
+
return `/${base}${url}`;
|
|
304
|
+
}
|
|
293
305
|
function createDataSource(options = {}) {
|
|
294
306
|
return new DataSourceManager(options);
|
|
295
307
|
}
|
|
296
308
|
exports.DataSourceManager = DataSourceManager;
|
|
309
|
+
exports.buildRequestUrl = buildRequestUrl;
|
|
297
310
|
exports.createDataSource = createDataSource;
|
|
298
311
|
exports.default = DataSourceManager;
|