@cloudbase/weda-ui 3.28.0 → 3.29.2
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/dist/configs/actions/showMessage.json +1 -1
- package/dist/configs/actions/showModal.json +1 -1
- package/dist/configs/actions/showToast.json +1 -1
- package/dist/configs/components/auth.json +1 -1
- package/dist/configs/components/button.d.ts +1 -1
- package/dist/configs/components/button.js +2 -1
- package/dist/configs/components/calendar.d.ts +1 -1
- package/dist/configs/components/calendar.js +2 -1
- package/dist/configs/components/carousel.json +4 -11
- package/dist/configs/components/chart/bar.d.ts +1 -1
- package/dist/configs/components/chart/bar.js +2 -1
- package/dist/configs/components/chart/line.d.ts +1 -1
- package/dist/configs/components/chart/line.js +2 -1
- package/dist/configs/components/chart/pie.d.ts +1 -1
- package/dist/configs/components/chart/pie.js +2 -1
- package/dist/configs/components/chart/statisticsCard.d.ts +1 -1
- package/dist/configs/components/chart/statisticsCard.js +2 -1
- package/dist/configs/components/container.d.ts +1 -1
- package/dist/configs/components/container.js +2 -1
- package/dist/configs/components/customer-service.d.ts +1 -1
- package/dist/configs/components/customer-service.js +2 -1
- package/dist/configs/components/dataView.js +2 -2
- package/dist/configs/components/echart.d.ts +175 -2
- package/dist/configs/components/echart.js +53 -48
- package/dist/configs/components/echarts.d.ts +139 -0
- package/dist/configs/components/echarts.js +16 -0
- package/dist/configs/components/flow/flow.json +2 -4
- package/dist/configs/components/flow/flowbasic.json +2 -4
- package/dist/configs/components/flow/flowchart.json +2 -4
- package/dist/configs/components/flow/flowcontrol.json +2 -4
- package/dist/configs/components/flow/flowlayout.json +2 -4
- package/dist/configs/components/flow/flowprocess.json +2 -4
- package/dist/configs/components/flowgraph.json +2 -4
- package/dist/configs/components/form/checkbox.json +1 -1
- package/dist/configs/components/form/departTreeSelect.json +1 -1
- package/dist/configs/components/form/form.json +1 -1
- package/dist/configs/components/form/input.json +4 -11
- package/dist/configs/components/form/location.json +1 -1
- package/dist/configs/components/form/radio.json +2 -4
- package/dist/configs/components/form/richText.json +3 -7
- package/dist/configs/components/form/select.json +6 -26
- package/dist/configs/components/form/switch.json +1 -1
- package/dist/configs/components/form/textarea.json +2 -4
- package/dist/configs/components/form/tips.json +1 -1
- package/dist/configs/components/form/uploader.json +4 -10
- package/dist/configs/components/form/uploaderFile.json +3 -7
- package/dist/configs/components/form/userTreeSelect.json +3 -9
- package/dist/configs/components/form-checkbox.d.ts +1 -1
- package/dist/configs/components/form-checkbox.js +2 -1
- package/dist/configs/components/form-date.d.ts +1 -1
- package/dist/configs/components/form-date.js +2 -1
- package/dist/configs/components/form-depart-tree-select.d.ts +1 -1
- package/dist/configs/components/form-depart-tree-select.js +2 -1
- package/dist/configs/components/form-email.d.ts +1 -1
- package/dist/configs/components/form-email.js +2 -1
- package/dist/configs/components/form-image-uploader.d.ts +1 -1
- package/dist/configs/components/form-image-uploader.js +2 -1
- package/dist/configs/components/form-input.d.ts +1 -1
- package/dist/configs/components/form-input.js +2 -1
- package/dist/configs/components/form-location.d.ts +1 -1
- package/dist/configs/components/form-location.js +2 -1
- package/dist/configs/components/form-multi-region.d.ts +1 -1
- package/dist/configs/components/form-multi-region.js +2 -1
- package/dist/configs/components/form-phone.d.ts +1 -1
- package/dist/configs/components/form-phone.js +2 -1
- package/dist/configs/components/form-radio.d.ts +1 -1
- package/dist/configs/components/form-radio.js +2 -1
- package/dist/configs/components/form-region.d.ts +1 -1
- package/dist/configs/components/form-region.js +2 -1
- package/dist/configs/components/form-rich-text.d.ts +1 -1
- package/dist/configs/components/form-rich-text.js +2 -1
- package/dist/configs/components/form-select-multiple.d.ts +1 -1
- package/dist/configs/components/form-select-multiple.js +2 -1
- package/dist/configs/components/form-select.d.ts +1 -1
- package/dist/configs/components/form-select.js +2 -1
- package/dist/configs/components/form-switch.d.ts +1 -1
- package/dist/configs/components/form-switch.js +2 -1
- package/dist/configs/components/form-text-area.d.ts +1 -1
- package/dist/configs/components/form-text-area.js +2 -1
- package/dist/configs/components/form-time.d.ts +1 -1
- package/dist/configs/components/form-time.js +2 -1
- package/dist/configs/components/form-upload-file.d.ts +1 -1
- package/dist/configs/components/form-upload-file.js +2 -1
- package/dist/configs/components/form-url.d.ts +1 -1
- package/dist/configs/components/form-url.js +2 -1
- package/dist/configs/components/form-user-tree-select.d.ts +1 -1
- package/dist/configs/components/form-user-tree-select.js +2 -1
- package/dist/configs/components/formdetail.json +8 -22
- package/dist/configs/components/graphicCard.json +4 -11
- package/dist/configs/components/grid/col.d.ts +1 -1
- package/dist/configs/components/grid/col.js +2 -1
- package/dist/configs/components/grid/grid.d.ts +1 -1
- package/dist/configs/components/grid/grid.js +2 -1
- package/dist/configs/components/grid/row.d.ts +1 -1
- package/dist/configs/components/grid/row.js +2 -1
- package/dist/configs/components/image.d.ts +1 -1
- package/dist/configs/components/image.js +2 -1
- package/dist/configs/components/jsx.js +2 -1
- package/dist/configs/components/link.d.ts +1 -1
- package/dist/configs/components/link.js +2 -1
- package/dist/configs/components/listView.js +2 -1
- package/dist/configs/components/lottery.d.ts +1 -1
- package/dist/configs/components/lottery.js +2 -1
- package/dist/configs/components/modal.d.ts +1 -1
- package/dist/configs/components/modal.js +2 -1
- package/dist/configs/components/navLayout.json +4 -11
- package/dist/configs/components/navigationBar.json +1 -1
- package/dist/configs/components/pagelayout.json +3 -8
- package/dist/configs/components/picker/datePicker.json +1 -1
- package/dist/configs/components/qr_code.d.ts +1 -1
- package/dist/configs/components/qr_code.js +2 -1
- package/dist/configs/components/repeater-item.json +1 -1
- package/dist/configs/components/repeater.d.ts +1 -1
- package/dist/configs/components/repeater.js +2 -1
- package/dist/configs/components/richtextview.json +2 -4
- package/dist/configs/components/scrollView.d.ts +1 -1
- package/dist/configs/components/scrollView.js +2 -1
- package/dist/configs/components/slot.json +1 -1
- package/dist/configs/components/swiper.d.ts +1 -1
- package/dist/configs/components/swiper.js +2 -1
- package/dist/configs/components/table.json +17 -65
- package/dist/configs/components/tabs.d.ts +1 -1
- package/dist/configs/components/tabs.js +2 -1
- package/dist/configs/components/text.d.ts +1 -1
- package/dist/configs/components/text.js +2 -1
- package/dist/configs/components/wd-ad.d.ts +1 -1
- package/dist/configs/components/wd-ad.js +2 -1
- package/dist/configs/components/wd-audio.d.ts +1 -1
- package/dist/configs/components/wd-audio.js +2 -1
- package/dist/configs/components/wd-bubble.d.ts +1 -1
- package/dist/configs/components/wd-bubble.js +2 -1
- package/dist/configs/components/wd-button.d.ts +1 -1
- package/dist/configs/components/wd-button.js +3 -2
- package/dist/configs/components/wd-calendar.d.ts +1 -1
- package/dist/configs/components/wd-calendar.js +2 -1
- package/dist/configs/components/wd-canvas.d.ts +1 -1
- package/dist/configs/components/wd-canvas.js +2 -1
- package/dist/configs/components/wd-card.d.ts +3 -3
- package/dist/configs/components/wd-card.js +4 -3
- package/dist/configs/components/wd-cascader.d.ts +1 -1
- package/dist/configs/components/wd-cascader.js +2 -1
- package/dist/configs/components/wd-checkbox.d.ts +1 -1
- package/dist/configs/components/wd-checkbox.js +2 -1
- package/dist/configs/components/wd-code-editor.d.ts +1 -1
- package/dist/configs/components/wd-code-editor.js +2 -1
- package/dist/configs/components/wd-date-range.d.ts +1 -1
- package/dist/configs/components/wd-date-range.js +2 -1
- package/dist/configs/components/wd-date.d.ts +1 -1
- package/dist/configs/components/wd-date.js +2 -1
- package/dist/configs/components/wd-department.d.ts +1 -1
- package/dist/configs/components/wd-department.js +2 -1
- package/dist/configs/components/wd-divider.d.ts +1 -1
- package/dist/configs/components/wd-divider.js +2 -1
- package/dist/configs/components/wd-drawer.d.ts +1 -1
- package/dist/configs/components/wd-drawer.js +2 -1
- package/dist/configs/components/wd-form-arr.d.ts +1 -1
- package/dist/configs/components/wd-form-arr.js +2 -1
- package/dist/configs/components/wd-form-detail.d.ts +1 -1
- package/dist/configs/components/wd-form-detail.js +2 -1
- package/dist/configs/components/wd-form-obj.d.ts +1 -1
- package/dist/configs/components/wd-form-obj.js +2 -1
- package/dist/configs/components/wd-form.d.ts +2 -2
- package/dist/configs/components/wd-form.js +3 -3
- package/dist/configs/components/wd-icon.d.ts +1 -1
- package/dist/configs/components/wd-icon.js +2 -1
- package/dist/configs/components/wd-image.d.ts +1 -1
- package/dist/configs/components/wd-image.js +2 -1
- package/dist/configs/components/wd-input-email.d.ts +1 -1
- package/dist/configs/components/wd-input-email.js +2 -1
- package/dist/configs/components/wd-input-number.d.ts +1 -1
- package/dist/configs/components/wd-input-number.js +2 -1
- package/dist/configs/components/wd-input-phone.d.ts +1 -1
- package/dist/configs/components/wd-input-phone.js +2 -1
- package/dist/configs/components/wd-input-url.d.ts +1 -1
- package/dist/configs/components/wd-input-url.js +2 -1
- package/dist/configs/components/wd-input.d.ts +1 -1
- package/dist/configs/components/wd-input.js +2 -1
- package/dist/configs/components/wd-layout.d.ts +1 -1
- package/dist/configs/components/wd-layout.js +2 -1
- package/dist/configs/components/wd-link.d.ts +1 -1
- package/dist/configs/components/wd-link.js +2 -1
- package/dist/configs/components/wd-location.d.ts +15 -1
- package/dist/configs/components/wd-location.js +18 -1
- package/dist/configs/components/wd-markdown.d.ts +1 -1
- package/dist/configs/components/wd-markdown.js +2 -1
- package/dist/configs/components/wd-member.d.ts +1 -1
- package/dist/configs/components/wd-member.js +2 -1
- package/dist/configs/components/wd-menu-base-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-base-layout.js +2 -1
- package/dist/configs/components/wd-menu-horizontal-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-horizontal-layout.js +2 -1
- package/dist/configs/components/wd-menu-layout.d.ts +2 -2
- package/dist/configs/components/wd-menu-layout.js +2 -1
- package/dist/configs/components/wd-menu-list.d.ts +1 -1
- package/dist/configs/components/wd-menu-list.js +2 -1
- package/dist/configs/components/wd-menu-nav-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-nav-layout.js +2 -1
- package/dist/configs/components/wd-menu-nav-tab-layou.d.ts +1 -1
- package/dist/configs/components/wd-menu-nav-tab-layou.js +2 -1
- package/dist/configs/components/wd-menu-plant-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-plant-layout.js +2 -1
- package/dist/configs/components/wd-menu-tab-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-tab-layout.js +2 -1
- package/dist/configs/components/wd-menu-vertical-layout.d.ts +1 -1
- package/dist/configs/components/wd-menu-vertical-layout.js +2 -1
- package/dist/configs/components/wd-modal.d.ts +1 -1
- package/dist/configs/components/wd-modal.js +2 -2
- package/dist/configs/components/wd-official-account.d.ts +1 -1
- package/dist/configs/components/wd-official-account.js +2 -1
- package/dist/configs/components/wd-progress.d.ts +1 -1
- package/dist/configs/components/wd-progress.js +2 -1
- package/dist/configs/components/wd-radio.d.ts +1 -1
- package/dist/configs/components/wd-radio.js +2 -1
- package/dist/configs/components/wd-rating.d.ts +1 -1
- package/dist/configs/components/wd-rating.js +2 -1
- package/dist/configs/components/wd-region.d.ts +1 -1
- package/dist/configs/components/wd-region.js +2 -1
- package/dist/configs/components/wd-rich-text.d.ts +1 -1
- package/dist/configs/components/wd-rich-text.js +2 -1
- package/dist/configs/components/wd-select-multiple.d.ts +1 -1
- package/dist/configs/components/wd-select-multiple.js +2 -1
- package/dist/configs/components/wd-select.d.ts +1 -1
- package/dist/configs/components/wd-select.js +2 -1
- package/dist/configs/components/wd-side-tab.d.ts +1 -1
- package/dist/configs/components/wd-side-tab.js +2 -1
- package/dist/configs/components/wd-store-home.d.ts +1 -1
- package/dist/configs/components/wd-store-home.js +2 -1
- package/dist/configs/components/wd-store-product.d.ts +1 -1
- package/dist/configs/components/wd-store-product.js +2 -1
- package/dist/configs/components/wd-switch.d.ts +1 -1
- package/dist/configs/components/wd-switch.js +2 -1
- package/dist/configs/components/wd-tabbar.d.ts +1 -1
- package/dist/configs/components/wd-tabbar.js +2 -1
- package/dist/configs/components/wd-table.d.ts +1 -1
- package/dist/configs/components/wd-table.js +2 -1
- package/dist/configs/components/wd-tag-select.d.ts +1 -1
- package/dist/configs/components/wd-tag-select.js +2 -1
- package/dist/configs/components/wd-tag.d.ts +1 -1
- package/dist/configs/components/wd-tag.js +2 -1
- package/dist/configs/components/wd-text.d.ts +1 -1
- package/dist/configs/components/wd-text.js +2 -1
- package/dist/configs/components/wd-textarea.d.ts +1 -1
- package/dist/configs/components/wd-textarea.js +2 -1
- package/dist/configs/components/wd-time.d.ts +1 -1
- package/dist/configs/components/wd-time.js +2 -1
- package/dist/configs/components/wd-top-tab.d.ts +1 -1
- package/dist/configs/components/wd-top-tab.js +2 -1
- package/dist/configs/components/wd-tree.d.ts +1 -1
- package/dist/configs/components/wd-tree.js +2 -1
- package/dist/configs/components/wd-unified-link.d.ts +1 -1
- package/dist/configs/components/wd-unified-link.js +2 -1
- package/dist/configs/components/wd-upload-file.d.ts +5 -1
- package/dist/configs/components/wd-upload-file.js +12 -1
- package/dist/configs/components/wd-upload-image.d.ts +1 -1
- package/dist/configs/components/wd-upload-image.js +2 -1
- package/dist/configs/components/web-view.d.ts +1 -1
- package/dist/configs/components/web-view.js +2 -1
- package/dist/configs/components/wedaVideo.d.ts +1 -1
- package/dist/configs/components/wedaVideo.js +2 -1
- package/dist/configs/components/wxOpenApi/phone.d.ts +1 -1
- package/dist/configs/components/wxOpenApi/phone.js +2 -1
- package/dist/configs/components/wxOpenApi/phoneCode.d.ts +1 -1
- package/dist/configs/components/wxOpenApi/phoneCode.js +2 -1
- package/dist/configs/components/wxOpenApi/share.d.ts +1 -1
- package/dist/configs/components/wxOpenApi/share.js +2 -1
- package/dist/configs/components/wxOpenApi/userInfo.d.ts +1 -1
- package/dist/configs/components/wxOpenApi/userInfo.js +2 -1
- package/dist/configs/index.d.ts +540 -232
- package/dist/configs/index.js +2 -0
- package/dist/configs/type-utils/index.d.ts +3 -1
- package/dist/configs/type-utils/index.js +2 -0
- package/dist/configs/type-utils/type-form.js +8 -4
- package/dist/configs/type-utils/x-runtime-default.d.ts +1 -0
- package/dist/configs/type-utils/x-runtime-default.js +1 -0
- package/dist/configs/utils/constants.d.ts +2 -0
- package/dist/configs/utils/constants.js +2 -0
- package/dist/onlineConfig.json +4 -4
- package/dist/style/weda-ui.min.css +2 -2
- package/dist/web/components/form/location/common/fetchLocationApiKey.d.ts +11 -0
- package/dist/web/components/form/location/common/fetchLocationApiKey.js +20 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +20 -33
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +20 -30
- package/dist/web/components/form/uploaderFile/index.css +11 -1
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +2 -1
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -4
- package/dist/web/components/index.d.ts +1 -1
- package/dist/web/components/index.js +2 -0
- package/dist/web/components/uploaderFileView/index.js +0 -2
- package/dist/web/components/wd-code-editor/wd-code-editor.js +4 -5
- package/dist/web/components/wd-upload-file/wd-upload-file.js +2 -2
- package/dist/web/utils/i18n/locale/en_US.d.ts +1 -0
- package/dist/web/utils/i18n/locale/en_US.js +1 -0
- package/dist/web/utils/i18n/locale/zh_CN.d.ts +1 -0
- package/dist/web/utils/i18n/locale/zh_CN.js +1 -0
- package/dist/web/utils/tcb.d.ts +16 -0
- package/dist/web/utils/tcb.js +32 -0
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取地图 API Key
|
|
3
|
+
* @param {Object} dataSource - 数据源配置
|
|
4
|
+
* @param {string} dataSource.name - 数据源名称
|
|
5
|
+
* @param {string} dataSource.templateCode - 模板代码
|
|
6
|
+
* @returns {Promise<string>} API Key
|
|
7
|
+
*/
|
|
8
|
+
export function fetchLocationApiKey(dataSource: {
|
|
9
|
+
name: string;
|
|
10
|
+
templateCode: string;
|
|
11
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import { callDataSource, getOpenApi } from '../../../../utils/tcb';
|
|
4
|
+
/**
|
|
5
|
+
* 获取地图 API Key
|
|
6
|
+
* @param {Object} dataSource - 数据源配置
|
|
7
|
+
* @param {string} dataSource.name - 数据源名称
|
|
8
|
+
* @param {string} dataSource.templateCode - 模板代码
|
|
9
|
+
* @returns {Promise<string>} API Key
|
|
10
|
+
*/
|
|
11
|
+
export function fetchLocationApiKey(dataSource) {
|
|
12
|
+
const fetchApiKey = dataSource.templateCode === 'qqmapV2'
|
|
13
|
+
? getOpenApi({ userAPIsID: dataSource.name, path: '/getApiKey' })
|
|
14
|
+
: callDataSource({ dataSourceName: dataSource.name, methodName: 'getApiKey' });
|
|
15
|
+
return fetchApiKey.then((res) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const apiKey = ((_a = res === null || res === void 0 ? void 0 : res.result) === null || _a === void 0 ? void 0 : _a.apiKey) || (res === null || res === void 0 ? void 0 : res.apiKey);
|
|
18
|
+
return apiKey;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -8,7 +8,6 @@ import { renderDecorator } from '../../../renderDecorator';
|
|
|
8
8
|
import MapView from '../../common/mapView';
|
|
9
9
|
import SelectModal from '../../common/selectModal';
|
|
10
10
|
import { propTypes, defaultProps } from '../../common/propsConfig';
|
|
11
|
-
import { callDataSource } from '../../../../../utils/tcb';
|
|
12
11
|
import { inH5IsMobile } from '../../../../../utils/platform';
|
|
13
12
|
import { useConfig } from '../../../../../utils/config-context';
|
|
14
13
|
import { emptyObject } from '../../../../../utils/constant';
|
|
@@ -17,6 +16,7 @@ import ChooseBtn from '../ChooseBtn';
|
|
|
17
16
|
import { WdText } from '../../../../wd-text';
|
|
18
17
|
import { checkCustomLocation } from '../../common/useLocationInfo';
|
|
19
18
|
import { errorHandler } from '../../../../../utils/error';
|
|
19
|
+
import { fetchLocationApiKey } from '../../common/fetchLocationApiKey';
|
|
20
20
|
import './style';
|
|
21
21
|
const { useEffect, useState, useRef } = React;
|
|
22
22
|
export default function LocationH5(props) {
|
|
@@ -195,43 +195,30 @@ export default function LocationH5(props) {
|
|
|
195
195
|
}, [APIKEY, locationType, dataSourceStatus]);
|
|
196
196
|
useEffect(() => {
|
|
197
197
|
// 调用API数据源方法
|
|
198
|
-
if (dataSource.name) {
|
|
199
|
-
callDataSource({
|
|
200
|
-
dataSourceName: dataSource.name,
|
|
201
|
-
methodName: 'getApiKey',
|
|
202
|
-
})
|
|
203
|
-
.then((res) => {
|
|
204
|
-
if (res.apiKey) {
|
|
205
|
-
setAPIKEY(res.apiKey);
|
|
206
|
-
setDataSourceStatus({
|
|
207
|
-
status: true,
|
|
208
|
-
message: '',
|
|
209
|
-
});
|
|
210
|
-
setApiKeyStatus({
|
|
211
|
-
status: true,
|
|
212
|
-
message: '',
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
})
|
|
216
|
-
.catch((error) => {
|
|
217
|
-
const { comErrorInfo } = errorHandler({
|
|
218
|
-
code: 'WdLocation.DatasourceError',
|
|
219
|
-
id,
|
|
220
|
-
error,
|
|
221
|
-
});
|
|
222
|
-
events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
|
|
223
|
-
setDataSourceStatus({
|
|
224
|
-
status: false,
|
|
225
|
-
message: error,
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
198
|
+
if (!dataSource.name) {
|
|
230
199
|
setDataSourceStatus({
|
|
231
200
|
status: false,
|
|
232
201
|
message: '请在编辑器属性区配置地图APIs',
|
|
233
202
|
});
|
|
203
|
+
return;
|
|
234
204
|
}
|
|
205
|
+
fetchLocationApiKey(dataSource)
|
|
206
|
+
.then((apiKey) => {
|
|
207
|
+
if (apiKey) {
|
|
208
|
+
setAPIKEY(apiKey);
|
|
209
|
+
setDataSourceStatus({ status: true, message: '' });
|
|
210
|
+
setApiKeyStatus({ status: true, message: '' });
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
.catch((error) => {
|
|
214
|
+
const { comErrorInfo } = errorHandler({
|
|
215
|
+
code: 'WdLocation.DatasourceError',
|
|
216
|
+
id,
|
|
217
|
+
error,
|
|
218
|
+
});
|
|
219
|
+
events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
|
|
220
|
+
setDataSourceStatus({ status: false, message: error });
|
|
221
|
+
});
|
|
235
222
|
}, [dataSource]);
|
|
236
223
|
const showToast = (message) => {
|
|
237
224
|
weui.toast(message, {
|
|
@@ -10,10 +10,10 @@ import MapView from '../../common/mapView';
|
|
|
10
10
|
import SelectModal from '../../common/selectModal';
|
|
11
11
|
import useLocationInfo from '../../common/useLocationInfo';
|
|
12
12
|
import { propTypes, defaultProps } from '../../common/propsConfig';
|
|
13
|
-
import { callDataSource } from '../../../../../utils/tcb';
|
|
14
13
|
import Header from './Header';
|
|
15
14
|
import { useRecycle } from '../../../../../utils/hooks/useRecycle';
|
|
16
15
|
import { errorHandler } from '../../../../../utils/error';
|
|
16
|
+
import { fetchLocationApiKey } from '../../common/fetchLocationApiKey';
|
|
17
17
|
import './style';
|
|
18
18
|
const { useState, useEffect, useRef } = React;
|
|
19
19
|
export default function LocationPC(props) {
|
|
@@ -152,40 +152,30 @@ export default function LocationPC(props) {
|
|
|
152
152
|
};
|
|
153
153
|
useEffect(() => {
|
|
154
154
|
// 调用API数据源方法
|
|
155
|
-
if (dataSource.name) {
|
|
156
|
-
callDataSource({
|
|
157
|
-
dataSourceName: dataSource.name,
|
|
158
|
-
methodName: 'getApiKey',
|
|
159
|
-
})
|
|
160
|
-
.then((res) => {
|
|
161
|
-
if (res.apiKey) {
|
|
162
|
-
setAPIKEY(res.apiKey);
|
|
163
|
-
setDataSourceStatus({
|
|
164
|
-
status: true,
|
|
165
|
-
message: '',
|
|
166
|
-
});
|
|
167
|
-
setApiKeyStatus({ status: true, message: '' });
|
|
168
|
-
}
|
|
169
|
-
})
|
|
170
|
-
.catch((error) => {
|
|
171
|
-
const { comErrorInfo } = errorHandler({
|
|
172
|
-
code: 'WdLocation.DatasourceError',
|
|
173
|
-
id,
|
|
174
|
-
error,
|
|
175
|
-
});
|
|
176
|
-
events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
|
|
177
|
-
setDataSourceStatus({
|
|
178
|
-
status: false,
|
|
179
|
-
message: error,
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
155
|
+
if (!dataSource.name) {
|
|
184
156
|
setDataSourceStatus({
|
|
185
157
|
status: false,
|
|
186
158
|
message: '请在编辑器属性区配置地图APIs',
|
|
187
159
|
});
|
|
160
|
+
return;
|
|
188
161
|
}
|
|
162
|
+
fetchLocationApiKey(dataSource)
|
|
163
|
+
.then((apiKey) => {
|
|
164
|
+
if (apiKey) {
|
|
165
|
+
setAPIKEY(apiKey);
|
|
166
|
+
setDataSourceStatus({ status: true, message: '' });
|
|
167
|
+
setApiKeyStatus({ status: true, message: '' });
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
.catch((error) => {
|
|
171
|
+
const { comErrorInfo } = errorHandler({
|
|
172
|
+
code: 'WdLocation.DatasourceError',
|
|
173
|
+
id,
|
|
174
|
+
error,
|
|
175
|
+
});
|
|
176
|
+
events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
|
|
177
|
+
setDataSourceStatus({ status: false, message: error });
|
|
178
|
+
});
|
|
189
179
|
}, [dataSource]);
|
|
190
180
|
const getIsShowMap = () => {
|
|
191
181
|
let status = showMap;
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
align-items: center;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.weda-upload-file-pc .weda-upload-file-pc__btn-
|
|
88
|
+
.weda-upload-file-pc .weda-upload-file-pc__btn-describe {
|
|
89
89
|
line-height: 20px;
|
|
90
90
|
color: var(--wd-color-text-placeholder, rgba(0, 0, 0, 0.4));
|
|
91
91
|
font-size: var(--wd-font-size-2, 0.75em);
|
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
.weda-upload-file-pc .weda-upload-file-pc--item .weda-upload-file-pc--item-action {
|
|
151
151
|
width: 160px;
|
|
152
152
|
padding: 10px 12px;
|
|
153
|
+
border-right: 0;
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
.weda-upload-file-pc .weda-upload-file-pc__btn--weak {
|
|
@@ -376,3 +377,12 @@
|
|
|
376
377
|
width: 92px;
|
|
377
378
|
height: 32px;
|
|
378
379
|
}
|
|
380
|
+
.weda-upload-file-pc .wedatea2td-form-upload-drag {
|
|
381
|
+
width: 100%;
|
|
382
|
+
}
|
|
383
|
+
.weda-upload-file-pc .wedatea2td-form-upload-drag .wedatea2td-form-upload__inner {
|
|
384
|
+
width: 100%;
|
|
385
|
+
}
|
|
386
|
+
.weda-upload-file-pc .wedatea2td-form-upload-drag .wedatea2td-form-upload__inner {
|
|
387
|
+
min-height: 210px;
|
|
388
|
+
}
|
|
@@ -7,7 +7,7 @@ import type { DataType } from '../../../../configs/components/wd-upload-file';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare function UploadFilePc({ layout, id, style, labelVisible, label, requiredFlag, disabled, className, events, decorator, tips, btnTitle, uploadTipText, maxUploadCount, maxSize, single, defaultValue, // 组件默认初始化值
|
|
9
9
|
value, // 用于模型组件中 formily 的值管理
|
|
10
|
-
acceptTypes, downloadVisible, deleteVisible, uploadPath, onChange, isEdit, $node, readOnly, callbacks, storageType, }: IUploaderFilePc): JSX.Element;
|
|
10
|
+
acceptTypes, downloadVisible, deleteVisible, uploadPath, onChange, isEdit, $node, readOnly, callbacks, storageType, draggable, }: IUploaderFilePc): JSX.Element;
|
|
11
11
|
export interface IUploaderFilePc extends CommonFormPropsType {
|
|
12
12
|
btnTitle?: string;
|
|
13
13
|
maxUploadCount?: number;
|
|
@@ -26,6 +26,7 @@ export interface IUploaderFilePc extends CommonFormPropsType {
|
|
|
26
26
|
callbacks?: DataType['callbacks'];
|
|
27
27
|
uploadTipText?: string;
|
|
28
28
|
storageType?: DataType['storageType'];
|
|
29
|
+
draggable?: DataType['draggable'];
|
|
29
30
|
}
|
|
30
31
|
export interface IUploadFileAction {
|
|
31
32
|
status?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Upload, ConfigProvider, Icon, List } from 'tea-component';
|
|
3
|
+
import { Upload, ConfigProvider, Icon, List, Text, Status } from 'tea-component';
|
|
4
4
|
import { WdButton } from '../../wd-button';
|
|
5
5
|
import { WdText } from '../../wd-text';
|
|
6
6
|
import { useTranslation } from '../../../utils/i18n/translation';
|
|
@@ -36,7 +36,7 @@ layout, id = '', style, labelVisible = true, label, requiredFlag = false, disabl
|
|
|
36
36
|
// 组件属性
|
|
37
37
|
decorator, tips = '', btnTitle, uploadTipText, maxUploadCount = 9, maxSize = 1024, single = true, defaultValue = emptyArray, // 组件默认初始化值
|
|
38
38
|
value = emptyArray, // 用于模型组件中 formily 的值管理
|
|
39
|
-
acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPath = 'weda-uploader', onChange = null, isEdit = true, $node, readOnly, callbacks, storageType = 'cloudID', }) {
|
|
39
|
+
acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPath = 'weda-uploader', onChange = null, isEdit = true, $node, readOnly, callbacks, storageType = 'cloudID', draggable = false, }) {
|
|
40
40
|
var _a;
|
|
41
41
|
const t = useTranslation();
|
|
42
42
|
const _storageTypeIsHttps = storageTypeIsHttps(storageType);
|
|
@@ -44,6 +44,8 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
44
44
|
const uploadFileLabel = label || t.uploadFile;
|
|
45
45
|
const uploadBtnTitle = btnTitle || t.clickToUpload;
|
|
46
46
|
const uploadSupportText = uploadTipText || t.supportBatchUpload;
|
|
47
|
+
const draggableText = t.draggableText;
|
|
48
|
+
// const [showFileList, setShowFileList] = React.useState(!draggable);
|
|
47
49
|
const [fileIDList, setfileIDList] = React.useState(() => {
|
|
48
50
|
let defaultVal = defaultValue;
|
|
49
51
|
let val = value;
|
|
@@ -202,6 +204,8 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
202
204
|
disabled ||
|
|
203
205
|
readOnly);
|
|
204
206
|
}, [disabled, fileIDList.length, fileList, maxUploadCount, single, readOnly]);
|
|
207
|
+
// 是否显示文件列表
|
|
208
|
+
const showFileList = (((fileList === null || fileList === void 0 ? void 0 : fileList.length) || (fileIDList === null || fileIDList === void 0 ? void 0 : fileIDList.length)) && draggable) || !draggable;
|
|
205
209
|
return renderDecorator(_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(FileContext.Provider, { value: {
|
|
206
210
|
uploadPath,
|
|
207
211
|
downloadVisible,
|
|
@@ -210,7 +214,7 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
210
214
|
isEdit,
|
|
211
215
|
events,
|
|
212
216
|
fileSizeObj,
|
|
213
|
-
}, "data-testid": "button-up", children: _jsxs("div", { className: `${CLASS_PREFIX} ${readOnly ? `${CLASS_PREFIX}__readOnly` : ''}`, "data-testid": "UploadFilePc", children: [isEdit && (_jsx("div", { className: `${CLASS_PREFIX}__input-box`, children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { disabled: true, text: btnTitle, theme: "secondary", variant: "outline" }))) : (
|
|
217
|
+
}, "data-testid": "button-up", children: _jsxs("div", { className: `${CLASS_PREFIX} ${readOnly ? `${CLASS_PREFIX}__readOnly` : ''}`, "data-testid": "UploadFilePc", children: [isEdit && (_jsx("div", { className: `${CLASS_PREFIX}__input-box`, children: btnDisabled ? (readOnly ? null : (_jsx(WdButton, { disabled: true, text: btnTitle, theme: "secondary", variant: "outline" }))) : draggable ? (_jsx(Upload, { ...uploadProps, beforeUpload: handleBefore, "data-testid": "Upload", children: ({ open, isDragging }) => (_jsx(Upload.Dragger, { children: isDragging ? ('释放鼠标') : (_jsx(Status, { className: "upload-file", icon: 'blank', size: 's', operation: _jsxs(_Fragment, { children: [_jsx("a", { onClick: open, children: uploadBtnTitle }), " / ", _jsx(Text, { theme: "weak", children: draggableText })] }) })) })) })) : (_jsxs(_Fragment, { children: [_jsx(Upload, { ...uploadProps, beforeUpload: handleBefore, "data-testid": "Upload", children: _jsx(WdButton, { className: `${CLASS_PREFIX}__btn--weak`, text: uploadBtnTitle, theme: "secondary", variant: "outline" }) }), !single && _jsx(WdText, { text: uploadSupportText, className: `${CLASS_PREFIX}__btn-describe` })] })) })), _jsxs(List, { split: "divide", style: { display: showFileList ? 'block' : 'none' }, children: [_jsx(List.Item, { children: _jsxs("div", { className: `${CLASS_PREFIX}--item ${CLASS_PREFIX}--item-header`, children: [_jsx("div", { className: `${CLASS_PREFIX}--item-title ${CLASS_PREFIX}--item-label`, children: t.fileName }), formType !== 'read' && (_jsx("div", { className: `${CLASS_PREFIX}--item-size ${CLASS_PREFIX}--item-label`, children: t.fileSize })), _jsx("div", { className: `${CLASS_PREFIX}--item-status ${CLASS_PREFIX}--item-label`, children: t.fileStatus }), _jsx("div", { className: `${CLASS_PREFIX}--item-action ${CLASS_PREFIX}--item-label`, children: t.fileOperation })] }) }), fileIDList.map((d) => (_jsx(List.Item, { children: _jsx(TcbFileEcho, { disabled: disabled, fileID: d, formType: formType }) }, d))), fileList.map((item) => (_jsx(List.Item, { children: _jsx(TcbFileUpload, { disabled: disabled, file: item, formType: formType, id: id }) }, item === null || item === void 0 ? void 0 : item._uuid))), !readOnly && isEdit && fileIDList.length === 0 && fileList.length === 0 && (_jsx(List.Item, { className: `${CLASS_PREFIX}--item-empty`, children: _jsxs("div", { className: `${CLASS_PREFIX}--item`, children: [t.clickTopBtn.replace('{btn}', uploadBtnTitle), " "] }) }))] })] }) }) }), decorator)({
|
|
214
218
|
id,
|
|
215
219
|
className: cls,
|
|
216
220
|
style,
|
|
@@ -90,7 +90,6 @@ export { default as WdAd } from "./wd-ad";
|
|
|
90
90
|
export { default as WdOfficialAccount } from "./wd-official-account";
|
|
91
91
|
export { default as WdModal } from "./wd-modal";
|
|
92
92
|
export { default as WdDrawer } from "./wd-drawer";
|
|
93
|
-
export { default as Chart } from "./echart";
|
|
94
93
|
export { default as WdButton } from "./wd-button";
|
|
95
94
|
export { default as WdDivider } from "./wd-divider";
|
|
96
95
|
export const WdTable: any;
|
|
@@ -155,4 +154,5 @@ export { default as WdStoreHome } from "./wd-store-home";
|
|
|
155
154
|
export { default as WdStoreProduct } from "./wd-store-product";
|
|
156
155
|
export { ConfigProvider } from "./wd-config-provider";
|
|
157
156
|
export { default as FormDetail, default as WdFormDetail } from "./formdetail";
|
|
157
|
+
export { default as Chart, default as ECharts } from "./echart";
|
|
158
158
|
export { default as WdTagSelect, WdTag } from "./wd-tag";
|
|
@@ -140,6 +140,8 @@ export { default as WdOfficialAccount } from './wd-official-account';
|
|
|
140
140
|
export { default as WdModal } from './wd-modal';
|
|
141
141
|
export { default as WdDrawer } from './wd-drawer';
|
|
142
142
|
export { default as Chart } from './echart';
|
|
143
|
+
// ECharts 新拖入的图表支持小程序端
|
|
144
|
+
export { default as ECharts } from './echart';
|
|
143
145
|
export { default as WdButton } from './wd-button';
|
|
144
146
|
export { default as WdDivider } from './wd-divider';
|
|
145
147
|
export const WdTable = loadable(() => import('./wd-table'), { fallback });
|
|
@@ -4,7 +4,6 @@ import { UploadFilePc } from '../form/uploaderFile/uploadFile.pc';
|
|
|
4
4
|
import { UploadFileH5 } from '../form/uploaderFile/uploadFile.h5';
|
|
5
5
|
import { filterStrList, isCloudFileID, isHttpFileID, downloadFile, usePlatform, transFileCloudidToName, } from '../../utils/platform';
|
|
6
6
|
import { useTempUrl } from '../../utils/hooks/use-cloud-id-temp-url';
|
|
7
|
-
import { useTranslation } from '../../utils/i18n/translation';
|
|
8
7
|
import './style';
|
|
9
8
|
const CLASS_PREFIX = 'weda-uploader-file-view';
|
|
10
9
|
/**
|
|
@@ -14,7 +13,6 @@ export default function UploaderFileView(props) {
|
|
|
14
13
|
const { value, className, single = true, // 展示为单行 a 标签
|
|
15
14
|
showType, // 展示端为 pc 还是 h5 样式
|
|
16
15
|
...rest } = props;
|
|
17
|
-
const t = useTranslation();
|
|
18
16
|
const platform = usePlatform();
|
|
19
17
|
const fileIDList = filterStrList(value);
|
|
20
18
|
if (single) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState
|
|
2
|
+
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import CodeMirror from '@uiw/react-codemirror';
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import { useConfig } from '../../utils/config-context';
|
|
@@ -12,21 +12,20 @@ import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
|
|
|
12
12
|
import { X_RUNTIME_DEFAULT } from '../../../configs/type-utils/x-runtime-default';
|
|
13
13
|
import { loadLanguage, format } from './lang';
|
|
14
14
|
import { themeData } from './theme';
|
|
15
|
+
import { textToString } from '../../utils/platform';
|
|
15
16
|
export const WdCodeEditor = React.forwardRef(function WdCodeEditor(props, ref) {
|
|
16
17
|
const { name, placeholder, focus = X_RUNTIME_DEFAULT.focus, events, classRoot = 'code-editor', language = X_RUNTIME_DEFAULT.codeEditorLanguage, theme = X_RUNTIME_DEFAULT.codeEditorTheme, style, } = props;
|
|
17
18
|
/** 兼容从 Form 获取属性,必须引入,自动挂载组件方法 */
|
|
18
19
|
const [innerHandle, setInnerHandle] = useState({});
|
|
19
20
|
const traitProps = { ...props, setInnerHandle, inputRef: ref };
|
|
20
21
|
const { value: _value, onChange: onChangeForm, disabled, readOnly, validateErrorMsg, validateState, visible, } = useFormInputTrait(traitProps);
|
|
21
|
-
const value = _value
|
|
22
|
+
const value = textToString(_value);
|
|
22
23
|
const { classPrefix } = useConfig();
|
|
23
24
|
const startWithOnProps = useMemo(() => filterPropsWithOn(props), [props]);
|
|
24
25
|
const inputId = useMemo(() => getUuid(), []);
|
|
25
26
|
const height = useMemo(() => {
|
|
26
27
|
var _a;
|
|
27
|
-
const height = (style === null || style === void 0 ? void 0 : style.height)
|
|
28
|
-
? `${(_a = String(style.height)) === null || _a === void 0 ? void 0 : _a.replace(/(\d+(?:\.\d+)?)(%|rem)/g, '$1')}`
|
|
29
|
-
: '200px';
|
|
28
|
+
const height = (style === null || style === void 0 ? void 0 : style.height) ? `${(_a = String(style.height)) === null || _a === void 0 ? void 0 : _a.replace(/(\d+(?:\.\d+)?)(%|rem)/g, '$1')}` : '200px';
|
|
30
29
|
return height.includes('px') ? height : `${height}px`;
|
|
31
30
|
}, [style === null || style === void 0 ? void 0 : style.height]);
|
|
32
31
|
const size = useSize(props);
|
|
@@ -13,7 +13,7 @@ import './style';
|
|
|
13
13
|
* 文件上传-标准化
|
|
14
14
|
*/
|
|
15
15
|
export const WdUploadFile = forwardRef(function WdUploadFile(props, ref) {
|
|
16
|
-
const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText: _uploadButtonText, uploadTipText: _uploadTipText, storageType = 'cloudID', } = props;
|
|
16
|
+
const { classRoot = 'upload-file', acceptTypes: _acceptTypes = X_RUNTIME_DEFAULT._acceptTypesInFile, maxSize = X_RUNTIME_DEFAULT.maxSize, single = X_RUNTIME_DEFAULT.single, maxUploadCount = X_RUNTIME_DEFAULT.maxUploadCount, events = emptyObject, deleteVisible = X_RUNTIME_DEFAULT.deleteVisible, downloadVisible = X_RUNTIME_DEFAULT.downloadVisible, callbacks, uploadButtonText: _uploadButtonText, uploadTipText: _uploadTipText, storageType = 'cloudID', draggable = X_RUNTIME_DEFAULT.draggable, } = props;
|
|
17
17
|
const t = useTranslation();
|
|
18
18
|
const uploadButtonText = _uploadButtonText !== null && _uploadButtonText !== void 0 ? _uploadButtonText : t.clickToUpload;
|
|
19
19
|
const uploadTipText = _uploadTipText !== null && _uploadTipText !== void 0 ? _uploadTipText : t.supportBatchUpload;
|
|
@@ -38,5 +38,5 @@ export const WdUploadFile = forwardRef(function WdUploadFile(props, ref) {
|
|
|
38
38
|
};
|
|
39
39
|
if (!visible)
|
|
40
40
|
return null;
|
|
41
|
-
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(UploaderFile, { btnTitle: uploadButtonText, uploadTipText: uploadTipText, events: events, labelVisible: false, acceptTypes: acceptTypes, defaultValue: value, deleteVisible: deleteVisible, downloadVisible: downloadVisible, maxSize: maxSize, maxUploadCount: maxUploadCount, single: single, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, callbacks: callbacks, storageType: storageType }) }));
|
|
41
|
+
return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(UploaderFile, { btnTitle: uploadButtonText, uploadTipText: uploadTipText, events: events, labelVisible: false, acceptTypes: acceptTypes, defaultValue: value, deleteVisible: deleteVisible, downloadVisible: downloadVisible, maxSize: maxSize, maxUploadCount: maxUploadCount, single: single, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, callbacks: callbacks, storageType: storageType, draggable: draggable }) }));
|
|
42
42
|
});
|
package/dist/web/utils/tcb.d.ts
CHANGED
|
@@ -46,3 +46,19 @@ export declare function appCloudShowWedaToast(params: any): any;
|
|
|
46
46
|
* 设置默认上传路径
|
|
47
47
|
*/
|
|
48
48
|
export declare const getDefaultUploadPath: (uploadPath: any) => any;
|
|
49
|
+
/**
|
|
50
|
+
* 开放APIs 查询 (apis v2)
|
|
51
|
+
* @param param.userAPIsID - APIs 连接器 ID
|
|
52
|
+
* @param param.path - 请求路径
|
|
53
|
+
* @param param.method - 请求方法,默认 'get'
|
|
54
|
+
* @param param.data - 请求数据(可选)
|
|
55
|
+
* @param param.headers - 请求头(可选)
|
|
56
|
+
* @param throwError - 是否抛出错误,默认 false
|
|
57
|
+
*/
|
|
58
|
+
export declare function getOpenApi(param: {
|
|
59
|
+
userAPIsID: string;
|
|
60
|
+
path: string;
|
|
61
|
+
method?: 'get' | 'post' | 'put' | 'delete' | 'patch';
|
|
62
|
+
data?: Record<string, unknown>;
|
|
63
|
+
headers?: Record<string, string>;
|
|
64
|
+
}, throwError?: boolean): Promise<any>;
|
package/dist/web/utils/tcb.js
CHANGED
|
@@ -193,3 +193,35 @@ export const getDefaultUploadPath = (uploadPath) => {
|
|
|
193
193
|
const _uploadPath = appName ? `${uploadPath}/${appName}` : uploadPath;
|
|
194
194
|
return _uploadPath;
|
|
195
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* 开放APIs 查询 (apis v2)
|
|
198
|
+
* @param param.userAPIsID - APIs 连接器 ID
|
|
199
|
+
* @param param.path - 请求路径
|
|
200
|
+
* @param param.method - 请求方法,默认 'get'
|
|
201
|
+
* @param param.data - 请求数据(可选)
|
|
202
|
+
* @param param.headers - 请求头(可选)
|
|
203
|
+
* @param throwError - 是否抛出错误,默认 false
|
|
204
|
+
*/
|
|
205
|
+
export async function getOpenApi(param, throwError = false) {
|
|
206
|
+
var _a, _b, _c;
|
|
207
|
+
const { userAPIsID, path, method = 'get', data, headers } = param;
|
|
208
|
+
try {
|
|
209
|
+
const app = await ((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getCloudInstance());
|
|
210
|
+
if (!((_c = app === null || app === void 0 ? void 0 : app.apis) === null || _c === void 0 ? void 0 : _c[userAPIsID])) {
|
|
211
|
+
throw new Error(`APIs connector "${userAPIsID}" not found`);
|
|
212
|
+
}
|
|
213
|
+
const result = await app.apis[userAPIsID].request({
|
|
214
|
+
method,
|
|
215
|
+
path,
|
|
216
|
+
...(data && { data }),
|
|
217
|
+
...(headers && { headers }),
|
|
218
|
+
});
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
errorHandler({ code: 'GetOpenApi', error });
|
|
223
|
+
if (throwError)
|
|
224
|
+
throw error;
|
|
225
|
+
return {};
|
|
226
|
+
}
|
|
227
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.29.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@babel/preset-env": "^7.22.15",
|
|
152
152
|
"@babel/preset-react": "^7.22.15",
|
|
153
153
|
"@babel/preset-typescript": "^7.22.15",
|
|
154
|
-
"@cloudbase/cals": "^1.2.
|
|
154
|
+
"@cloudbase/cals": "^1.2.23",
|
|
155
155
|
"@cloudbase/lowcode-cli": "^0.23.0",
|
|
156
156
|
"@cloudbase/weda-cloud-sdk": "^1.0.108",
|
|
157
157
|
"@commitlint/cli": "^16.0.2",
|