@cloudbase/weda-ui 3.8.2 → 3.9.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.
Files changed (61) hide show
  1. package/dist/configs/components/dataView.d.ts +15 -0
  2. package/dist/configs/components/dataView.js +104 -6
  3. package/dist/configs/components/listView.d.ts +31 -0
  4. package/dist/configs/components/listView.js +145 -24
  5. package/dist/configs/components/wd-form.d.ts +2 -0
  6. package/dist/configs/components/wd-location.d.ts +13 -0
  7. package/dist/configs/components/wd-location.js +10 -0
  8. package/dist/configs/components/wd-markdown.d.ts +110 -0
  9. package/dist/configs/components/wd-markdown.js +171 -0
  10. package/dist/configs/components/wd-menu-layout.d.ts +13 -10
  11. package/dist/configs/components/wd-menu-layout.js +12 -1
  12. package/dist/configs/components/wd-menu-nav-tab-layou.d.ts +27 -0
  13. package/dist/configs/components/wd-menu-nav-tab-layou.js +31 -0
  14. package/dist/configs/components/wd-side-tab.js +1 -0
  15. package/dist/configs/components/wd-table.d.ts +3 -1
  16. package/dist/configs/components/wd-table.js +1 -0
  17. package/dist/configs/components/wd-top-tab.js +1 -0
  18. package/dist/configs/components/wd-upload-image.js +1 -1
  19. package/dist/configs/components/web-view.d.ts +6 -15
  20. package/dist/configs/components/web-view.js +12 -15
  21. package/dist/configs/index.d.ts +404 -40
  22. package/dist/configs/index.js +4 -0
  23. package/dist/configs/type-utils/error.d.ts +1 -0
  24. package/dist/configs/type-utils/error.js +3 -0
  25. package/dist/configs/utils/layout.d.ts +1 -1
  26. package/dist/configs/utils/layout.js +219 -7
  27. package/dist/style/index.scss +1 -1
  28. package/dist/web/components/dataView/index.js +5 -3
  29. package/dist/web/components/form/location/components/LocationH5/location.h5.js +19 -3
  30. package/dist/web/components/form/location/components/LocationPC/location.PC.js +7 -1
  31. package/dist/web/components/index.d.ts +2 -0
  32. package/dist/web/components/index.js +4 -0
  33. package/dist/web/components/listView/index.js +48 -13
  34. package/dist/web/components/listView/interface.d.ts +4 -0
  35. package/dist/web/components/listView/useQueryParams.d.ts +11 -0
  36. package/dist/web/components/listView/useQueryParams.js +23 -0
  37. package/dist/web/components/richTextView/index.js +4 -38
  38. package/dist/web/components/richTextView/useImgTransform.d.ts +1 -0
  39. package/dist/web/components/richTextView/useImgTransform.js +47 -0
  40. package/dist/web/components/slot/index.js +2 -1
  41. package/dist/web/components/wd-form/index.d.ts +1 -0
  42. package/dist/web/components/wd-location/wd-location.js +2 -2
  43. package/dist/web/components/wd-markdown/github-markdown-light.css +1139 -0
  44. package/dist/web/components/wd-markdown/index.d.ts +4 -0
  45. package/dist/web/components/wd-markdown/index.js +3 -0
  46. package/dist/web/components/wd-markdown/style.d.ts +3 -0
  47. package/dist/web/components/wd-markdown/style.js +3 -0
  48. package/dist/web/components/wd-markdown/wd-markdown.d.ts +7 -0
  49. package/dist/web/components/wd-markdown/wd-markdown.js +96 -0
  50. package/dist/web/components/wd-menu-layout/components/H5Menu.js +4 -1
  51. package/dist/web/components/wd-menu-layout/components/NavTabMenu.d.ts +3 -0
  52. package/dist/web/components/wd-menu-layout/components/NavTabMenu.js +7 -0
  53. package/dist/web/components/wd-menu-layout/wd-menu-layout.js +5 -2
  54. package/dist/web/components/wd-menu-nav-tab-layout/index.d.ts +6 -0
  55. package/dist/web/components/wd-menu-nav-tab-layout/index.js +5 -0
  56. package/dist/web/components/wd-table/components/FieldRender/index.js +5 -2
  57. package/dist/web/utils/error.d.ts +13 -0
  58. package/dist/web/utils/error.js +11 -0
  59. package/dist/web/utils/getModelParams.d.ts +2 -0
  60. package/dist/web/utils/getModelParams.js +73 -4
  61. package/package.json +4 -1
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { useCallback, useImperativeHandle, useState, useRef, } from 'react';
2
+ import React, { useCallback, useState, useRef } from 'react';
3
+ import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
3
4
  import ListView from '../listView';
4
5
  import { useLoopRenderDetect } from '../common/use-loop-render-detect';
5
6
  /**
@@ -16,10 +17,11 @@ export default React.forwardRef(function DataView(props, ref) {
16
17
  }, []);
17
18
  const refresh = useCallback(() => { var _a, _b; return (_b = (_a = listViewRef.current) === null || _a === void 0 ? void 0 : _a.refresh) === null || _b === void 0 ? void 0 : _b.call(_a); }, [listViewRef.current]);
18
19
  const deleteOne = useCallback((params) => { var _a, _b; return (_b = (_a = listViewRef.current) === null || _a === void 0 ? void 0 : _a.deleteOne) === null || _b === void 0 ? void 0 : _b.call(_a, params); }, [listViewRef.current]);
19
- useImperativeHandle(ref, () => ({ record, refresh, deleteOne }), [
20
+ useSetWidgetApi(() => ({
20
21
  record,
21
22
  refresh,
22
23
  deleteOne,
23
- ]);
24
+ dataSourceVersion: props.supportManyRelated ? 'v2' : 'v1',
25
+ }), [record, refresh, deleteOne, props.supportManyRelated], ref);
24
26
  return (_jsx(ListView, { ...props, ref: listViewRef, isRecords: false, orderBy: undefined, orderType: undefined, template: "none", pageSize: 1, pagination: "none", beforeDataChange: beforeDataChange, refType: "dataView", dataSourceData: [].concat(props.dataSourceData) }));
25
27
  });
@@ -16,6 +16,7 @@ import { useRecycle } from '../../../../../utils/hooks/useRecycle';
16
16
  import ChooseBtn from '../ChooseBtn';
17
17
  import { WdText } from '../../../../wd-text';
18
18
  import { checkCustomLocation } from '../../common/useLocationInfo';
19
+ import { errorHandler } from '../../../../../utils/error';
19
20
  import './style';
20
21
  const { useEffect, useState, useRef } = React;
21
22
  export default function LocationH5(props) {
@@ -139,7 +140,12 @@ export default function LocationH5(props) {
139
140
  recycleBack(true);
140
141
  }
141
142
  }, (error) => {
142
- console.error('error loc', error);
143
+ const { comErrorInfo } = errorHandler({
144
+ code: 'WdLocation.GeolocationLocationError',
145
+ id,
146
+ error,
147
+ });
148
+ events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
143
149
  currentLocations.current = null;
144
150
  setApiKeyStatus({
145
151
  status: false,
@@ -151,7 +157,12 @@ export default function LocationH5(props) {
151
157
  });
152
158
  };
153
159
  script.onerror = (error) => {
154
- console.error('Geolocation script onerror', error);
160
+ const { comErrorInfo } = errorHandler({
161
+ code: 'WdLocation.GeolocationScriptError',
162
+ id,
163
+ error,
164
+ });
165
+ events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
155
166
  setApiKeyStatus({
156
167
  status: false,
157
168
  message: '定位失败',
@@ -188,7 +199,12 @@ export default function LocationH5(props) {
188
199
  }
189
200
  })
190
201
  .catch((error) => {
191
- console.error('datasources error', error);
202
+ const { comErrorInfo } = errorHandler({
203
+ code: 'WdLocation.DatasourceError',
204
+ id,
205
+ error,
206
+ });
207
+ events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
192
208
  setDataSourceStatus({
193
209
  status: false,
194
210
  message: error,
@@ -13,6 +13,7 @@ import { propTypes, defaultProps } from '../../common/propsConfig';
13
13
  import { callDataSource } from '../../../../../utils/tcb';
14
14
  import Header from './Header';
15
15
  import { useRecycle } from '../../../../../utils/hooks/useRecycle';
16
+ import { errorHandler } from '../../../../../utils/error';
16
17
  import './style';
17
18
  const { useState, useEffect, useRef } = React;
18
19
  export default function LocationPC(props) {
@@ -136,7 +137,12 @@ export default function LocationPC(props) {
136
137
  }
137
138
  })
138
139
  .catch((error) => {
139
- console.error('datasources error', error);
140
+ const { comErrorInfo } = errorHandler({
141
+ code: 'WdLocation.DatasourceError',
142
+ id,
143
+ error,
144
+ });
145
+ events === null || events === void 0 ? void 0 : events.error({ error: comErrorInfo });
140
146
  setDataSourceStatus({
141
147
  status: false,
142
148
  message: error,
@@ -128,6 +128,7 @@ export { default as WdMenPlantLayout } from "./wd-menu-plant-layout";
128
128
  export { default as WdMenuVerticalLayout } from "./wd-menu-vertical-layout";
129
129
  export { default as WdMenuTabLayout } from "./wd-menu-tab-layout";
130
130
  export { default as WdMenuNavLayout } from "./wd-menu-nav-layout";
131
+ export { default as WdMenuNavTabLayout } from "./wd-menu-nav-tab-layout";
131
132
  export { default as WdMenuList } from "./wd-menu-list";
132
133
  export { default as WdCard } from "./wd-card";
133
134
  export { default as WdLayout } from "./wd-layout";
@@ -142,6 +143,7 @@ export const WdCodeEditor: any;
142
143
  export const WdMember: any;
143
144
  export const WdLocation: any;
144
145
  export const WdRichText: any;
146
+ export const WdMarkdown: any;
145
147
  export { default as WdCanvas } from "./wd-canvas";
146
148
  export { default as WdAudio } from "./wd-audio";
147
149
  export { default as WdFormObj } from "./wd-form-obj";
@@ -177,6 +177,7 @@ export { default as WdMenPlantLayout } from './wd-menu-plant-layout';
177
177
  export { default as WdMenuVerticalLayout } from './wd-menu-vertical-layout';
178
178
  export { default as WdMenuTabLayout } from './wd-menu-tab-layout';
179
179
  export { default as WdMenuNavLayout } from './wd-menu-nav-layout';
180
+ export { default as WdMenuNavTabLayout } from './wd-menu-nav-tab-layout';
180
181
  export { default as WdMenuList } from './wd-menu-list';
181
182
  // export { default as WdLoading } from './wd-loading';
182
183
  export { default as WdCard } from './wd-card';
@@ -201,6 +202,9 @@ export const WdLocation = loadable(() => import('./wd-location'), {
201
202
  export const WdRichText = loadable(() => import('./wd-rich-text'), {
202
203
  fallback,
203
204
  });
205
+ export const WdMarkdown = loadable(() => import('./wd-markdown'), {
206
+ fallback,
207
+ });
204
208
  export { default as WdCanvas } from './wd-canvas';
205
209
  export { default as WdAudio } from './wd-audio';
206
210
  export { default as WdFormObj } from './wd-form-obj';
@@ -12,6 +12,7 @@ import { useLoopRenderDetect } from '../common/use-loop-render-detect';
12
12
  import { getModelParams } from '../../utils/getModelParams';
13
13
  import { WdCompError } from '../../utils/error';
14
14
  import { useSetWidgetApi } from '../../utils/widget-api/use-set-widget-api';
15
+ import { useQueryParams } from './useQueryParams';
15
16
  const BLOCK_NAME = 'weda-list-view';
16
17
  const LISTVIEW_MESSAGE = {
17
18
  methods_no_support: '当前组件绑定了APIs,暂不支持进行数据删除',
@@ -25,6 +26,17 @@ const getIdeMockData = (length = 3) => Array.from({ length }).map(() => Object.c
25
26
  const getStringValue = (v) => (typeof v === 'string' ? v : '');
26
27
  const defaultCloudbase = { callDataSource, isInIde };
27
28
  const defaultBeforeDataChange = (v) => v;
29
+ const getQueryParams = (isV2protocol, params) => {
30
+ if (isV2protocol) {
31
+ params.getCount = true;
32
+ params.pageNumber = params.pageNo;
33
+ if (params.orderBy && ['asc', 'desc'].includes(params.orderType)) {
34
+ params.orderBy = [{ [params.orderBy]: params.orderType }];
35
+ }
36
+ params.compatibleWithV1 = true;
37
+ }
38
+ return params;
39
+ };
28
40
  /**
29
41
  * 数据容器-列表视图
30
42
  */
@@ -33,13 +45,14 @@ export default React.forwardRef(function ListView(props, ref) {
33
45
  const { dataSourceType, bindConnectMetadata, connectorMethod, connectorParams: rawConnectorParams, datasource, dataSourceData: rawDataSourceData, // 表达式: 值
34
46
  template, enableTotal, // 表达式: 启用动态分页
35
47
  total: rawTotal, // 表达式: 总页数
36
- pageSize = 5, pagination, events, className, children, isRecords = true, //是否展示回调recoreds字段
48
+ pageSize = 5, pageIndex: _pageNo = 1, pagination, events, className, children, isRecords = true, //是否展示回调records字段
37
49
  isSetStatus: rawIsSetStatus = false, //是否开启异常状态
38
50
  isSetLoading: rawIsSetLoading = true, // 是否开启加载状态
39
51
  loading = false, // 数据加载状态,仅表达式生效
40
52
  emptyText, //空状态时的文案
41
53
  loadCompletedText = '', // 加载到底提示
42
- appCloud = defaultCloudbase, beforeDataChange = defaultBeforeDataChange, refType = 'listView', loadButtonText, ...rest } = props;
54
+ appCloud = defaultCloudbase, beforeDataChange = defaultBeforeDataChange, refType = 'listView', loadButtonText, selectFieldType = 'main', // 查询字段范围类型
55
+ ...rest } = props;
43
56
  const platform = usePlatform();
44
57
  const isH5 = platform === 'h5';
45
58
  const isSetStatus = dataSourceType !== 'expression' ? rawIsSetStatus : false;
@@ -50,6 +63,7 @@ export default React.forwardRef(function ListView(props, ref) {
50
63
  const methodName = getStringValue(dataSourceType === 'data-model'
51
64
  ? ((_a = datasource === null || datasource === void 0 ? void 0 : datasource.extra) === null || _a === void 0 ? void 0 : _a.methodName) || 'wedaGetRecords'
52
65
  : connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name);
66
+ const isV2protocol = methodName === 'wedaGetRecordsV2';
53
67
  const dataSourceName = getStringValue(dataSourceType === 'data-model'
54
68
  ? datasource === null || datasource === void 0 ? void 0 : datasource.name
55
69
  : (_b = bindConnectMetadata === null || bindConnectMetadata === void 0 ? void 0 : bindConnectMetadata.datasource) === null || _b === void 0 ? void 0 : _b.name);
@@ -66,7 +80,7 @@ export default React.forwardRef(function ListView(props, ref) {
66
80
  const paramRef = useRef({
67
81
  dataSourceName,
68
82
  methodName,
69
- params: { pageNo: 1, pageSize, connectorParams, modelParams },
83
+ params: { pageNo: _pageNo, pageSize, connectorParams, modelParams },
70
84
  pagination,
71
85
  }); // 最新请求参数
72
86
  const exprRef = useRef({ total: 0, dataSourceData: [], enableTotal }); // 对比表达式变化
@@ -90,6 +104,13 @@ export default React.forwardRef(function ListView(props, ref) {
90
104
  message: '',
91
105
  requestId: '',
92
106
  });
107
+ const isReadyToGetAuthField = dataSourceType === 'data-model' && isV2protocol && !!dataSourceName;
108
+ const { queryParams, fieldsLoading } = useQueryParams({
109
+ dataSourceName,
110
+ isReadyToGetAuthField,
111
+ selectFieldType,
112
+ modelParams,
113
+ });
93
114
  // 组件卸载时触发
94
115
  useEffect(() => {
95
116
  clearContext();
@@ -109,13 +130,18 @@ export default React.forwardRef(function ListView(props, ref) {
109
130
  var _a, _b;
110
131
  clearDelay();
111
132
  if (!isIdeMockData) {
133
+ // authFields 加载中,不触发请求
134
+ if (isV2protocol && fieldsLoading) {
135
+ return;
136
+ }
112
137
  fetchData({
113
138
  dataSourceName,
114
139
  methodName,
115
140
  params: {
116
141
  ...(_a = paramRef.current) === null || _a === void 0 ? void 0 : _a.params,
117
- pageNo: 1,
142
+ pageNo: _pageNo,
118
143
  pageSize,
144
+ modelParams: queryParams,
119
145
  },
120
146
  pagination,
121
147
  }, {
@@ -128,15 +154,15 @@ export default React.forwardRef(function ListView(props, ref) {
128
154
  state: getContextState(),
129
155
  });
130
156
  }
131
- }, [methodName, dataSourceName, pageSize, pagination, dataSourceType]);
157
+ }, [methodName, dataSourceName, pageSize, _pageNo, pagination, dataSourceType, isV2protocol, isIdeMockData, fieldsLoading]);
132
158
  // props 对象类型监听,需重新分页
133
159
  useEffect(() => {
134
160
  var _a, _b, _c, _d;
135
161
  if (dataSourceType === 'data-model') {
136
- if (!isequal((_b = (_a = paramRef.current) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.modelParams, modelParams)) {
162
+ if (!isequal((_b = (_a = paramRef.current) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.modelParams, queryParams)) {
137
163
  clearDelay();
138
164
  fetchData({
139
- params: { pageNo: 1, modelParams },
165
+ params: { pageNo: _pageNo, modelParams: queryParams },
140
166
  }, { isInitData: true });
141
167
  }
142
168
  }
@@ -205,7 +231,7 @@ export default React.forwardRef(function ListView(props, ref) {
205
231
  const temp = await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callDataSource({
206
232
  dataSourceName,
207
233
  methodName,
208
- params: tcbParams,
234
+ params: getQueryParams(isV2protocol, tcbParams),
209
235
  swr: param.swr,
210
236
  }, true));
211
237
  records = records.concat(temp.records || []);
@@ -216,7 +242,7 @@ export default React.forwardRef(function ListView(props, ref) {
216
242
  console.error('fetchDataLoop: ', e);
217
243
  }
218
244
  return { records: records.slice(0, count), total };
219
- }, [appCloud]);
245
+ }, [appCloud, isV2protocol]);
220
246
  // 加载成功(包含为空)事件
221
247
  const onSuccessCb = useCallback(({ records, total, isTriggerEmpty, datasource }) => {
222
248
  var _a, _b;
@@ -317,7 +343,7 @@ export default React.forwardRef(function ListView(props, ref) {
317
343
  * isInitData: 是否初始化数据默认否, isFetchCurrent: 是否拉取当前所有数据默认否
318
344
  */
319
345
  const fetchData = useCallback(async (param, options) => {
320
- var _a, _b, _c;
346
+ var _a, _b, _c, _d;
321
347
  const { isInitData, isFetchCurrent } = options || {};
322
348
  // 合并参数并保存,useEffect 中需要比对
323
349
  paramRef.current = {
@@ -330,8 +356,13 @@ export default React.forwardRef(function ListView(props, ref) {
330
356
  // 不触发请求
331
357
  if (!(dataSourceName && methodName) && dataSourceType !== 'expression')
332
358
  return;
359
+ // select为空时,不触发请求
360
+ if (isV2protocol && !((_a = Object.keys(modelParams === null || modelParams === void 0 ? void 0 : modelParams.select)) === null || _a === void 0 ? void 0 : _a.length)) {
361
+ setStatus('loading');
362
+ return;
363
+ }
333
364
  // 分页变化事件
334
- (_a = events === null || events === void 0 ? void 0 : events.onPagingChange) === null || _a === void 0 ? void 0 : _a.call(events, { query: { pageNo, pageSize } });
365
+ (_b = events === null || events === void 0 ? void 0 : events.onPagingChange) === null || _b === void 0 ? void 0 : _b.call(events, { query: { pageNo, pageSize } });
335
366
  setStatus('loading');
336
367
  // 前端分页时,应该触发表达式
337
368
  if (dataSourceType === 'expression') {
@@ -365,7 +396,7 @@ export default React.forwardRef(function ListView(props, ref) {
365
396
  data = await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callDataSource({
366
397
  dataSourceName,
367
398
  methodName,
368
- params: tcbParams,
399
+ params: getQueryParams(isV2protocol, tcbParams),
369
400
  swr: param.swr,
370
401
  }, true));
371
402
  }
@@ -400,7 +431,7 @@ export default React.forwardRef(function ListView(props, ref) {
400
431
  : refType === 'dataView'
401
432
  ? 'WdDataView.QueryError'
402
433
  : 'WdListView.QueryError',
403
- requestId: (_c = (_b = e === null || e === void 0 ? void 0 : e.original) === null || _b === void 0 ? void 0 : _b.original) === null || _c === void 0 ? void 0 : _c.requestId,
434
+ requestId: (_d = (_c = e === null || e === void 0 ? void 0 : e.original) === null || _c === void 0 ? void 0 : _c.original) === null || _d === void 0 ? void 0 : _d.requestId,
404
435
  original: e === null || e === void 0 ? void 0 : e.original,
405
436
  });
406
437
  }
@@ -418,6 +449,8 @@ export default React.forwardRef(function ListView(props, ref) {
418
449
  events,
419
450
  enableTotal,
420
451
  setExpression,
452
+ isV2protocol,
453
+ fieldsLoading,
421
454
  ]);
422
455
  // 计算上下文对象数据
423
456
  const getContextState = (state = {}) => {
@@ -515,6 +548,7 @@ export default React.forwardRef(function ListView(props, ref) {
515
548
  total,
516
549
  pageNo,
517
550
  pageSize: statePageSize,
551
+ dataSourceVersion: isV2protocol ? 'v2' : 'v1',
518
552
  // 组件方法
519
553
  deleteOne: async (_id) => {
520
554
  try {
@@ -558,6 +592,7 @@ export default React.forwardRef(function ListView(props, ref) {
558
592
  methodRefresh,
559
593
  dataRef.current.records,
560
594
  err,
595
+ isV2protocol,
561
596
  ], ref);
562
597
  /**
563
598
  * 分页,加载更多
@@ -113,6 +113,10 @@ export interface IListView extends IDataContainer {
113
113
  * 显示行数
114
114
  */
115
115
  pageSize?: number;
116
+ /**
117
+ * 页码
118
+ */
119
+ pageNo?: number;
116
120
  /**
117
121
  * 分页类型,加载更多|底部刷新|分页器
118
122
  */
@@ -0,0 +1,11 @@
1
+ interface QueryParams {
2
+ fieldsLoading: boolean;
3
+ queryParams: any;
4
+ }
5
+ export declare const useQueryParams: ({ dataSourceName, isReadyToGetAuthField, selectFieldType, modelParams, }: {
6
+ dataSourceName: any;
7
+ isReadyToGetAuthField: any;
8
+ selectFieldType: any;
9
+ modelParams: any;
10
+ }) => QueryParams;
11
+ export {};
@@ -0,0 +1,23 @@
1
+ import { useMemo } from 'react';
2
+ import { useDataSource } from '../../utils/hooks/useDataSource';
3
+ export const useQueryParams = ({ dataSourceName, isReadyToGetAuthField, selectFieldType, modelParams, }) => {
4
+ const needQueryFields = selectFieldType === 'all';
5
+ const { data: dataSource, error } = useDataSource(isReadyToGetAuthField && needQueryFields ? dataSourceName : '');
6
+ const queryParams = useMemo(() => {
7
+ var _a;
8
+ const result = {
9
+ fieldsLoading: needQueryFields,
10
+ queryParams: modelParams,
11
+ };
12
+ if (selectFieldType === 'all') {
13
+ const select = {};
14
+ Object.keys(((_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.schema) === null || _a === void 0 ? void 0 : _a.properties) || {}).forEach((name) => {
15
+ select[name] = true;
16
+ });
17
+ result.queryParams.select = select;
18
+ result.fieldsLoading = !error && !dataSource;
19
+ }
20
+ return result;
21
+ }, [dataSource, error, modelParams, needQueryFields, selectFieldType]);
22
+ return queryParams;
23
+ };
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
2
+ import { useEffect, useRef } from 'react';
3
3
  import classNames from '../../utils/classnames';
4
- import { getTempFileURL } from '../../utils/tcb';
5
- import { LOAD_ERR_IMG_BASE64, getWhitelist } from '../../utils/constant';
4
+ import { getWhitelist } from '../../utils/constant';
6
5
  import { getOnClick } from '../wd-unified-link/utils';
6
+ import { useImgTransform } from './useImgTransform';
7
7
  import destr from 'destr';
8
8
  import './style';
9
9
  import xss from 'xss';
@@ -14,41 +14,7 @@ export default function RichTextView({ value = '', className, style, id, }) {
14
14
  'weda-RichTextView': true,
15
15
  [className]: className,
16
16
  });
17
- const [displayValue, setDisplayValue] = useState('');
18
- const regex = new RegExp(/<img [^>]*src=\\*"([^"]*?)\\*"/g);
19
- const iferror = `javascript:this.width='80';this.src='${LOAD_ERR_IMG_BASE64}';this.onerror=null`;
20
- let tempValue = (parseValue || '')
21
- .toString()
22
- .replace(/<img style="/g, `<img style="max-width:100%;`)
23
- .replace(/<img /g, `<img onerror=${iferror} `);
24
- const getSrc = async (img) => {
25
- const url = img.replace(regex, '$1');
26
- if (img.includes('cloud://')) {
27
- const newURL = await getTempFileURL(url);
28
- if (newURL) {
29
- tempValue = tempValue.replace(new RegExp(url, 'g'), newURL);
30
- }
31
- }
32
- };
33
- useEffect(() => {
34
- try {
35
- const imgs = parseValue.match(regex);
36
- if (imgs && imgs.length > 0) {
37
- (async () => {
38
- await Promise.all(imgs.map(async (img) => {
39
- await getSrc(img);
40
- }));
41
- setDisplayValue(tempValue);
42
- })();
43
- }
44
- else {
45
- setDisplayValue(tempValue);
46
- }
47
- }
48
- catch (e) {
49
- setDisplayValue(tempValue);
50
- }
51
- }, [value]);
17
+ const displayValue = useImgTransform(parseValue);
52
18
  const richTextRef = useRef(null);
53
19
  useEffect(() => {
54
20
  if (richTextRef.current) {
@@ -0,0 +1 @@
1
+ export declare const useImgTransform: (value: string) => string;
@@ -0,0 +1,47 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { getTempFileURL } from '../../utils/tcb';
3
+ import { LOAD_ERR_IMG_BASE64 } from '../../utils/constant';
4
+ const regex = new RegExp(/<img [^>]*src=\\*"([^"]*?)\\*"/g);
5
+ const iferror = `javascript:this.width='80';this.src='${LOAD_ERR_IMG_BASE64}';this.onerror=null`;
6
+ const transformImag = (value) => {
7
+ return (value || '')
8
+ .toString()
9
+ .replace(/<img style="/g, `<img style="max-width:100%;`)
10
+ .replace(/<img /g, `<img onerror=${iferror} `);
11
+ };
12
+ const getSrc = async (img) => {
13
+ const url = img.replace(regex, '$1');
14
+ if (img.includes('cloud://')) {
15
+ return await getTempFileURL(url);
16
+ }
17
+ };
18
+ export const useImgTransform = (value) => {
19
+ const [displayValue, setDisplayValue] = useState('');
20
+ useEffect(() => {
21
+ let tempValue = transformImag(value);
22
+ try {
23
+ const imgs = value.match(regex);
24
+ if (imgs && imgs.length > 0) {
25
+ (async () => {
26
+ const imgRes = await Promise.all(imgs.map(async (img) => {
27
+ return await getSrc(img);
28
+ }));
29
+ imgs.forEach((img, index) => {
30
+ const url = img.replace(regex, '$1');
31
+ if (imgRes[index]) {
32
+ tempValue = tempValue.replace(new RegExp(url, 'g'), imgRes[index]);
33
+ }
34
+ });
35
+ setDisplayValue(tempValue);
36
+ })();
37
+ }
38
+ else {
39
+ setDisplayValue(tempValue);
40
+ }
41
+ }
42
+ catch (e) {
43
+ setDisplayValue(tempValue);
44
+ }
45
+ }, [value]);
46
+ return displayValue;
47
+ };
@@ -3,6 +3,7 @@ import classNames from '../../utils/classnames';
3
3
  import { usePlatform } from '../../utils/platform';
4
4
  import { useConfig } from '../../utils/config-context';
5
5
  export default function Slot({ compositeParent, name, className, style, }) {
6
+ var _a;
6
7
  const { classPrefix } = useConfig();
7
8
  const platform = usePlatform();
8
9
  const cls = classNames({
@@ -16,5 +17,5 @@ export default function Slot({ compositeParent, name, className, style, }) {
16
17
  // 兼容编辑器点击,可选中 Slot 组件
17
18
  return (_jsx("div", { style: style, className: cls, children: 'Slot - ' + name }));
18
19
  }
19
- return compositeParent.props.data[name] ? (_jsx("div", { style: style, className: cls, children: compositeParent.props.data[name] })) : null;
20
+ return ((_a = compositeParent === null || compositeParent === void 0 ? void 0 : compositeParent.props) === null || _a === void 0 ? void 0 : _a.data[name]) ? (_jsx("div", { style: style, className: cls, children: compositeParent.props.data[name] })) : null;
20
21
  }
@@ -63,6 +63,7 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
63
63
  requestid: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
64
64
  message: import("@sinclair/typebox").TString;
65
65
  code: import("@sinclair/typebox").TString;
66
+ original: import("@sinclair/typebox").TAny;
66
67
  }>;
67
68
  }>;
68
69
  }]>> & {
@@ -12,7 +12,7 @@ import './style';
12
12
  * 地图-标准化
13
13
  */
14
14
  export const WdLocation = forwardRef(function WdLocation(props, ref) {
15
- const { classRoot = 'location', clearable = X_RUNTIME_DEFAULT.clearable, placeholder = '选择地理位置', customLocation, customRange = X_RUNTIME_DEFAULT.customRange, dataSource = X_RUNTIME_DEFAULT._dataSourceInLocation, defauleShowLocation, drag = X_RUNTIME_DEFAULT.drag, locationType = X_RUNTIME_DEFAULT.locationType, locationRange = X_RUNTIME_DEFAULT.locationRange, showLngLat = X_RUNTIME_DEFAULT.showLngLat, showMap = X_RUNTIME_DEFAULT.showMap, zoom = X_RUNTIME_DEFAULT.zoom, events = emptyObject, } = props;
15
+ const { classRoot = 'location', clearable = X_RUNTIME_DEFAULT.clearable, placeholder = '选择地理位置', customLocation, customRange = X_RUNTIME_DEFAULT.customRange, dataSource = X_RUNTIME_DEFAULT._dataSourceInLocation, defauleShowLocation, drag = X_RUNTIME_DEFAULT.drag, locationType = X_RUNTIME_DEFAULT.locationType, locationRange = X_RUNTIME_DEFAULT.locationRange, showLngLat = X_RUNTIME_DEFAULT.showLngLat, showMap = X_RUNTIME_DEFAULT.showMap, zoom = X_RUNTIME_DEFAULT.zoom, events = emptyObject, id, } = props;
16
16
  const traitProps = { ...props, inputRef: ref };
17
17
  const trait = useFormInputTrait(traitProps);
18
18
  const { value, onChange, disabled, readOnly, visible } = trait;
@@ -44,5 +44,5 @@ export const WdLocation = forwardRef(function WdLocation(props, ref) {
44
44
  const inputWrapProps = { ...props, classRoot, disabled, ...clearProps };
45
45
  if (!visible)
46
46
  return null;
47
- return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { recycleBack: setIsInit, children: _jsx(Location, { events: events, labelVisible: false, placeholder: placeholder, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource, defauleShowLocation: defauleShowLocation, drag: drag, locationType: locationType, locationRange: locationRange, showLngLat: showLngLat, showMap: showMap, zoom: zoom, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange }) }) }) }) }));
47
+ return (_jsx(WdFormItem, { ...formItemProps, children: _jsx(WdInputGroup, { ...inputGroupProps, children: _jsx(WdInputWrap, { ...inputWrapProps, children: _jsx(RecycleProvider, { recycleBack: setIsInit, children: _jsx(Location, { events: events, labelVisible: false, placeholder: placeholder, value: value, customLocation: customLocation, customRange: customRange, dataSource: dataSource, defauleShowLocation: defauleShowLocation, drag: drag, locationType: locationType, locationRange: locationRange, showLngLat: showLngLat, showMap: showMap, zoom: zoom, readOnly: readOnly, disabled: disabled, decorator: null, onChange: onChange, id: id }) }) }) }) }));
48
48
  });