@cloudbase/weda-ui 3.29.0 → 3.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/components/echart.d.ts +175 -2
- package/dist/configs/components/echart.js +52 -48
- package/dist/configs/components/echarts.d.ts +139 -0
- package/dist/configs/components/echarts.js +16 -0
- package/dist/configs/index.d.ts +278 -2
- package/dist/configs/index.js +2 -0
- package/dist/configs/type-utils/index.d.ts +1 -0
- package/dist/configs/type-utils/index.js +2 -0
- package/dist/configs/type-utils/type-form.js +8 -4
- package/dist/style/weda-ui.min.css +1 -1
- 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/index.d.ts +1 -1
- package/dist/web/components/index.js +2 -0
- package/dist/web/components/wd-code-editor/wd-code-editor.js +4 -5
- package/dist/web/utils/tcb.d.ts +16 -0
- package/dist/web/utils/tcb.js +32 -0
- package/package.json +2 -2
|
@@ -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;
|
|
@@ -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 });
|
|
@@ -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);
|
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.30.0",
|
|
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",
|