@cloudbase/weda-ui 3.5.1 → 3.5.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/README.md +3 -0
- package/dist/configs/components/button.d.ts +12 -12
- package/dist/configs/components/calendar.d.ts +26 -0
- package/dist/configs/components/calendar.js +80 -0
- package/dist/configs/components/carousel.json +1 -4
- package/dist/configs/components/chart/line.d.ts +28 -28
- package/dist/configs/components/common/form-input-required.d.ts +1 -1
- package/dist/configs/components/container.d.ts +1 -1
- package/dist/configs/components/customer-service.d.ts +10 -34
- package/dist/configs/components/customer-service.js +91 -92
- package/dist/configs/components/dataView.d.ts +21 -3
- package/dist/configs/components/dataView.js +165 -16
- package/dist/configs/components/echart.d.ts +4 -4
- package/dist/configs/components/form-checkbox.d.ts +18 -18
- package/dist/configs/components/form-checkbox.js +0 -4
- package/dist/configs/components/form-date.d.ts +14 -14
- package/dist/configs/components/form-date.js +0 -4
- package/dist/configs/components/form-depart-tree-select.d.ts +17 -14
- package/dist/configs/components/form-depart-tree-select.js +1 -4
- package/dist/configs/components/form-email.d.ts +10 -10
- package/dist/configs/components/form-email.js +0 -4
- package/dist/configs/components/form-image-uploader.d.ts +11 -8
- package/dist/configs/components/form-image-uploader.js +1 -4
- package/dist/configs/components/form-input.d.ts +16 -16
- package/dist/configs/components/form-input.js +0 -10
- package/dist/configs/components/form-location.d.ts +21 -12
- package/dist/configs/components/form-location.js +1 -4
- package/dist/configs/components/form-multi-region.d.ts +13 -10
- package/dist/configs/components/form-multi-region.js +1 -4
- package/dist/configs/components/form-phone.d.ts +10 -10
- package/dist/configs/components/form-phone.js +0 -4
- package/dist/configs/components/form-radio.d.ts +18 -18
- package/dist/configs/components/form-radio.js +0 -4
- package/dist/configs/components/form-region.d.ts +12 -12
- package/dist/configs/components/form-region.js +0 -4
- package/dist/configs/components/form-rich-text.d.ts +11 -8
- package/dist/configs/components/form-rich-text.js +1 -4
- package/dist/configs/components/form-select-multiple.d.ts +27 -24
- package/dist/configs/components/form-select-multiple.js +1 -4
- package/dist/configs/components/form-select.d.ts +27 -24
- package/dist/configs/components/form-select.js +1 -4
- package/dist/configs/components/form-switch.d.ts +6 -6
- package/dist/configs/components/form-switch.js +0 -4
- package/dist/configs/components/form-text-area.d.ts +10 -10
- package/dist/configs/components/form-text-area.js +0 -4
- package/dist/configs/components/form-time.d.ts +17 -14
- package/dist/configs/components/form-time.js +1 -4
- package/dist/configs/components/form-upload-file.d.ts +13 -10
- package/dist/configs/components/form-upload-file.js +1 -4
- package/dist/configs/components/form-url.d.ts +10 -10
- package/dist/configs/components/form-url.js +0 -4
- package/dist/configs/components/form-user-tree-select.d.ts +19 -16
- package/dist/configs/components/form-user-tree-select.js +1 -4
- package/dist/configs/components/formdetail.json +0 -4
- package/dist/configs/components/grid/col.d.ts +2 -4
- package/dist/configs/components/grid/grid.d.ts +2 -4
- package/dist/configs/components/grid/row.d.ts +2 -3
- package/dist/configs/components/image.d.ts +4 -4
- package/dist/configs/components/link.d.ts +8 -8
- package/dist/configs/components/listView.d.ts +78 -33
- package/dist/configs/components/listView.js +258 -51
- package/dist/configs/components/lottery.d.ts +67 -0
- package/dist/configs/components/lottery.js +178 -0
- package/dist/configs/components/modal.d.ts +2 -2
- package/dist/configs/components/qr_code.d.ts +11 -11
- package/dist/configs/components/repeater.d.ts +10 -91
- package/dist/configs/components/repeater.js +75 -87
- package/dist/configs/components/tabs.d.ts +4 -4
- package/dist/configs/components/text.d.ts +2 -2
- package/dist/configs/components/wd-bubble.d.ts +3 -8
- package/dist/configs/components/wd-button.d.ts +22 -34
- package/dist/configs/components/wd-card.d.ts +10 -10
- package/dist/configs/components/wd-card.js +10 -5
- package/dist/configs/components/wd-checkbox.d.ts +36 -81
- package/dist/configs/components/wd-date-range.d.ts +87 -131
- package/dist/configs/components/wd-date.d.ts +88 -132
- package/dist/configs/components/wd-date.js +1 -1
- package/dist/configs/components/wd-divider.d.ts +2 -2
- package/dist/configs/components/wd-form-detail.d.ts +9 -9
- package/dist/configs/components/wd-form.d.ts +54 -82
- package/dist/configs/components/wd-form.js +1 -1
- package/dist/configs/components/wd-icon.d.ts +8 -9
- package/dist/configs/components/wd-image-upload.d.ts +5 -5
- package/dist/configs/components/wd-image.d.ts +8 -12
- package/dist/configs/components/wd-input-email.d.ts +88 -156
- package/dist/configs/components/wd-input-number.d.ts +38 -179
- package/dist/configs/components/wd-input-number.js +1 -1
- package/dist/configs/components/wd-input-phone.d.ts +86 -156
- package/dist/configs/components/wd-input-url.d.ts +88 -156
- package/dist/configs/components/wd-input.d.ts +120 -164
- package/dist/configs/components/wd-layout.d.ts +1 -5
- package/dist/configs/components/wd-link.d.ts +14 -26
- package/dist/configs/components/wd-modal.d.ts +12 -8
- package/dist/configs/components/wd-modal.js +14 -14
- package/dist/configs/components/wd-official-account.d.ts +3 -5
- package/dist/configs/components/wd-official-account.js +3 -5
- package/dist/configs/components/wd-radio.d.ts +35 -80
- package/dist/configs/components/wd-switch.d.ts +21 -67
- package/dist/configs/components/wd-table.d.ts +95 -132
- package/dist/configs/components/wd-table.js +61 -17
- package/dist/configs/components/wd-text.d.ts +8 -8
- package/dist/configs/components/wd-textarea.d.ts +64 -110
- package/dist/configs/components/wd-time.d.ts +89 -133
- package/dist/configs/components/wd-tree.d.ts +243 -281
- package/dist/configs/components/wd-tree.js +1 -1
- package/dist/configs/components/web-view.d.ts +30 -10
- package/dist/configs/components/web-view.js +34 -33
- package/dist/configs/components/wedaVideo.d.ts +30 -0
- package/dist/configs/components/wedaVideo.js +98 -0
- package/dist/configs/components/wxOpenApi/phone.d.ts +6 -6
- package/dist/configs/components/wxOpenApi/phoneCode.d.ts +6 -62
- package/dist/configs/components/wxOpenApi/phoneCode.js +62 -70
- package/dist/configs/components/wxOpenApi/share.d.ts +12 -12
- package/dist/configs/components/wxOpenApi/userInfo.d.ts +7 -7
- package/dist/configs/index.d.ts +2515 -4367
- package/dist/configs/index.js +3 -3
- package/dist/configs/type-utils/error.d.ts +3 -3
- package/dist/configs/type-utils/index.d.ts +6 -6
- package/dist/configs/type-utils/index.js +2 -5
- package/dist/configs/type-utils/type-form.d.ts +95 -101
- package/dist/index.js +1 -1
- package/dist/style/index.scss +1 -1
- package/dist/web/components/chart/common/echarts.js +0 -1
- package/dist/web/components/customer-service/customer-service.js +1 -1
- package/dist/web/components/dataView/index.js +1 -1
- package/dist/web/components/echart/echart.js +22 -6
- package/dist/web/components/flow/common/components/index.js +1 -0
- package/dist/web/components/flow/common/hooks/index.js +1 -0
- package/dist/web/components/flow/common/index.js +1 -0
- package/dist/web/components/flow/modules/operations/components/index.js +1 -0
- package/dist/web/components/flow/modules/operations/components/user-select/index.js +1 -0
- package/dist/web/components/flow/modules/operations/config/index.js +1 -0
- package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/index.js +1 -0
- package/dist/web/components/flow/process/constants.js +1 -3
- package/dist/web/components/flow-graph/graph.js +0 -1
- package/dist/web/components/form/checkbox/index.js +2 -2
- package/dist/web/components/form/enumSelect/MultipleSelect.js +1 -1
- package/dist/web/components/form/enumSelect/NormalSelect.js +1 -1
- package/dist/web/components/form/input/index.js +1 -1
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +2 -2
- package/dist/web/components/form/radio/index.js +1 -1
- package/dist/web/components/form/select/dropdown-select/h5.js +5 -5
- package/dist/web/components/form/select/dropdown-select/pc.js +25 -28
- package/dist/web/components/form/select/dropdown-select/ui.d.ts +1 -1
- package/dist/web/components/form/select/dropdown-select/ui.js +5 -5
- package/dist/web/components/form/select/h5.js +10 -6
- package/dist/web/components/form/select/index.js +4 -2
- package/dist/web/components/form/selectMultiple/h5.js +1 -1
- package/dist/web/components/form/selectMultiple/index.js +1 -1
- package/dist/web/components/form/uploader/index.js +0 -1
- package/dist/web/components/form/uploader/uploader.pc.js +0 -1
- package/dist/web/components/form/uploaderFile/index.js +0 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +6 -4
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +6 -4
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +19 -3
- package/dist/web/components/form/userOrgSelect/common/types.d.ts +2 -1
- package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +1 -3
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.d.ts +1 -1
- package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +2 -2
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +0 -1
- package/dist/web/components/form-date/index.d.ts +1 -1
- package/dist/web/components/form-depart-tree-select/index.d.ts +1 -1
- package/dist/web/components/form-email/index.d.ts +2 -2
- package/dist/web/components/form-input/index.d.ts +2 -2
- package/dist/web/components/form-input-hooks/index.js +12 -13
- package/dist/web/components/form-multi-region/index.d.ts +1 -1
- package/dist/web/components/form-phone/index.d.ts +1 -1
- package/dist/web/components/form-region/index.d.ts +1 -1
- package/dist/web/components/form-select/index.d.ts +1 -1
- package/dist/web/components/form-select-multiple/index.d.ts +1 -1
- package/dist/web/components/form-text-area/index.d.ts +2 -2
- package/dist/web/components/form-time/index.d.ts +1 -1
- package/dist/web/components/form-url/index.d.ts +2 -2
- package/dist/web/components/form-user-tree-select/index.d.ts +1 -1
- package/dist/web/components/form-user-tree-select/index.js +3 -2
- package/dist/web/components/listView/index.js +81 -14
- package/dist/web/components/listView/interface.d.ts +7 -1
- package/dist/web/components/lottery/index.d.ts +22 -14
- package/dist/web/components/lottery/index.js +1 -2
- package/dist/web/components/navigationBar/horizontalMenu.js +0 -1
- package/dist/web/components/phone/index.js +1 -1
- package/dist/web/components/richText/index.js +3 -2
- package/dist/web/components/share/index.js +1 -1
- package/dist/web/components/table/UserDepartment/utils.js +0 -2
- package/dist/web/components/wd-card/wd-card.js +1 -1
- package/dist/web/components/wd-checkbox-list/checkboxList.js +1 -1
- package/dist/web/components/wd-date/elements/Calendar.h5.js +1 -2
- package/dist/web/components/wd-department-select/h5.js +0 -1
- package/dist/web/components/wd-form/hooks/use-remote-value.js +20 -8
- package/dist/web/components/wd-form/index.d.ts +7 -7
- package/dist/web/components/wd-form/index.js +12 -10
- package/dist/web/components/wd-input/wd-input.d.ts +43 -43
- package/dist/web/components/wd-input-email/wd-input-email.d.ts +39 -39
- package/dist/web/components/wd-input-number/number.js +0 -1
- package/dist/web/components/wd-input-number/wd-input-number.js +10 -6
- package/dist/web/components/wd-input-phone/wd-input-phone.d.ts +43 -43
- package/dist/web/components/wd-input-url/wd-input-url.d.ts +39 -39
- package/dist/web/components/wd-member-select/h5.js +0 -1
- package/dist/web/components/wd-modal/wd-modal.js +8 -3
- package/dist/web/components/wd-official-account/index.js +1 -1
- package/dist/web/components/wd-radio-list/wd-radio-list.js +2 -2
- package/dist/web/components/wd-table/components/FieldRender/UserDepartment/utils.js +0 -2
- package/dist/web/components/wd-table/components/FieldRender/index.d.ts +1 -1
- package/dist/web/components/wd-table/components/FieldRender/index.js +9 -6
- package/dist/web/components/wd-table/components/ModalTable/index.js +0 -3
- package/dist/web/components/wd-table/components/Table/index.js +4 -0
- package/dist/web/components/wd-table/hooks/useAuthFields.d.ts +1 -1
- package/dist/web/components/wd-table/hooks/useAuthFields.js +18 -4
- package/dist/web/components/wd-table/utils/index.js +5 -4
- package/dist/web/components/wd-table/wd-table.js +41 -19
- package/dist/web/components/wd-tree/utils.js +0 -2
- package/dist/web/components/wd-tree/wd-tree.js +0 -1
- package/dist/web/components/wd-upload-image/wd-upload-image.js +0 -1
- package/dist/web/components/web-view/web-view.d.ts +23 -6
- package/dist/web/index.js +1 -0
- package/dist/web/utils/constant.js +0 -1
- package/dist/web/utils/hooks/useFormLegacy.d.ts +1 -1
- package/dist/web/utils/hooks/useFormLegacy.js +9 -3
- package/dist/web/utils/moment.js +1 -3
- package/dist/web/utils/platform.js +0 -3
- package/dist/web/utils/widget-api/index.d.ts +1 -1
- package/dist/web/utils/widget-api/index.js +19 -22
- package/dist/web/weda-ui.css +6 -0
- package/package.json +13 -6
- package/dist/configs/components/calendar.json +0 -83
- package/dist/configs/components/lottery.json +0 -166
- package/dist/configs/components/wedaVideo.json +0 -101
|
@@ -14,10 +14,26 @@ export const defaultRequest = async (action, params) => {
|
|
|
14
14
|
throw errorHandle(error, action);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
function sortUserList(userIds, userList) {
|
|
18
|
+
// 将userList转换为Map,key为userId,value为对应的user对象
|
|
19
|
+
const userMap = userList.reduce((map, user) => {
|
|
20
|
+
map[user.UserId] = user;
|
|
21
|
+
return map;
|
|
22
|
+
}, {});
|
|
23
|
+
// 按照userIds的顺序构建排序后的userList
|
|
24
|
+
const sortedUserList = userIds.reduce((result, userId) => {
|
|
25
|
+
if (userMap[userId]) {
|
|
26
|
+
result.push(userMap[userId]);
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}, []);
|
|
30
|
+
return sortedUserList;
|
|
31
|
+
}
|
|
32
|
+
export const getUserListByIds = async (params) => {
|
|
33
|
+
const { selectUserIds, request } = params;
|
|
19
34
|
const userList = await fetchUserListByIds(selectUserIds, request);
|
|
20
|
-
|
|
35
|
+
const sortedUserList = sortUserList(selectUserIds, userList);
|
|
36
|
+
return dealUserData(sortedUserList);
|
|
21
37
|
};
|
|
22
38
|
/**
|
|
23
39
|
* 统一接口错误处理
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { ICompRef } from '../../../../types';
|
|
3
2
|
import type { CommonFormPropsType } from '../../types';
|
|
3
|
+
import type * as React from 'react';
|
|
4
4
|
export interface IUserTreeSelect extends CommonFormPropsType {
|
|
5
5
|
defaultValue?: Readonly<string | string[]>;
|
|
6
6
|
confirmValue?: string;
|
|
@@ -69,6 +69,7 @@ export interface IUserTreeSelect extends CommonFormPropsType {
|
|
|
69
69
|
/** 是否展示未关联部门用户 */
|
|
70
70
|
displayUncategorizedUsers?: boolean;
|
|
71
71
|
readOnly?: boolean;
|
|
72
|
+
formType?: string;
|
|
72
73
|
}
|
|
73
74
|
type TCompRef = ICompRef<{
|
|
74
75
|
open: () => void;
|
|
@@ -14,9 +14,7 @@ import { useDepartData } from '../../hooks/use-depart-data';
|
|
|
14
14
|
import './style';
|
|
15
15
|
export default function DepartTreeSelect(props) {
|
|
16
16
|
const { events = emptyObject, defaultValue = emptyArray, //默认值,支持数组
|
|
17
|
-
confirmValue = '', defaultValueType = 'noneDepart', multiple = false, onChange = null,
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
request = defaultRequest, departmentScope, } = props;
|
|
17
|
+
confirmValue = '', defaultValueType = 'noneDepart', multiple = false, onChange = null, request = defaultRequest, departmentScope, } = props;
|
|
20
18
|
const platform = usePlatform();
|
|
21
19
|
// 两次默认值不同, 需要刷新
|
|
22
20
|
const prevDefaultRef = React.useRef(null);
|
|
@@ -5,4 +5,4 @@ export declare const UserOrgContext: React.Context<any>;
|
|
|
5
5
|
export declare function UserSelectPC({ id, className, style, label, labelVisible, //标题显隐
|
|
6
6
|
placeholder, disabled, layout, requiredFlag, size, multiple, //多选
|
|
7
7
|
outerRef, request, //接口请求
|
|
8
|
-
decorator, onCancel, onConfirm, errInfo, open, setOpen, selectedOrgId, setSelectedOrgId, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, selectedUserIds, setSelectedUserIds, pageNo, setPageNo, pageSize, filterParams, treeData, error, onConfirmSelectUser, secondDisplay, naked, containerClass, triggerElement, readOnly, }: IUserTreeSelect): JSX.Element;
|
|
8
|
+
decorator, onCancel, onConfirm, errInfo, open, setOpen, selectedOrgId, setSelectedOrgId, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, selectedUserIds, setSelectedUserIds, pageNo, setPageNo, pageSize, filterParams, treeData, error, onConfirmSelectUser, secondDisplay, naked, containerClass, triggerElement, readOnly, formType, }: IUserTreeSelect): JSX.Element;
|
|
@@ -11,7 +11,7 @@ export const UserOrgContext = React.createContext(null);
|
|
|
11
11
|
export function UserSelectPC({ id, className, style, label = '人员选择', labelVisible = true, //标题显隐
|
|
12
12
|
placeholder = '请选择人员', disabled = false, layout = 'horizontal', requiredFlag = false, size = 'l', multiple = false, //多选
|
|
13
13
|
outerRef, request = defaultRequest, //接口请求
|
|
14
|
-
decorator, onCancel, onConfirm, errInfo, open, setOpen, selectedOrgId, setSelectedOrgId, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, selectedUserIds, setSelectedUserIds, pageNo, setPageNo, pageSize, filterParams, treeData, error, onConfirmSelectUser, secondDisplay, naked, containerClass, triggerElement, readOnly, }) {
|
|
14
|
+
decorator, onCancel, onConfirm, errInfo, open, setOpen, selectedOrgId, setSelectedOrgId, selectedUserList, setSelectedUserList, confirmUserList, setConfirmUserList, selectedUserIds, setSelectedUserIds, pageNo, setPageNo, pageSize, filterParams, treeData, error, onConfirmSelectUser, secondDisplay, naked, containerClass, triggerElement, readOnly, formType, }) {
|
|
15
15
|
// 外层组件类
|
|
16
16
|
const cls = classNames({
|
|
17
17
|
'weda-ui': true,
|
|
@@ -44,7 +44,7 @@ decorator, onCancel, onConfirm, errInfo, open, setOpen, selectedOrgId, setSelect
|
|
|
44
44
|
pageNo,
|
|
45
45
|
setPageNo,
|
|
46
46
|
pageSize,
|
|
47
|
-
}, children: readOnly ? (_jsx(InputTags, { tagsList: confirmUserList, placeholder: placeholder, multiple: multiple, errInfo: errInfo, disabled: disabled, readOnly: readOnly, onClose: (e, item) => {
|
|
47
|
+
}, children: readOnly && formType !== 'read' ? (_jsx(InputTags, { tagsList: confirmUserList, placeholder: placeholder, multiple: multiple, errInfo: errInfo, disabled: disabled, readOnly: readOnly, onClose: (e, item) => {
|
|
48
48
|
const currentConfirmUserList = confirmUserList.filter((l) => (l === null || l === void 0 ? void 0 : l.id) !== (item === null || item === void 0 ? void 0 : item.id));
|
|
49
49
|
setConfirmUserList(currentConfirmUserList);
|
|
50
50
|
onConfirmSelectUser(currentConfirmUserList);
|
|
@@ -10,8 +10,8 @@ declare const FormDate: React.ForwardRefExoticComponent<CommonPropsType & import
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
end: string;
|
|
@@ -10,8 +10,8 @@ declare const FormDepartTreeSelect: React.ForwardRefExoticComponent<CommonPropsT
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -10,10 +10,10 @@ declare const FormEmail: React.ForwardRefExoticComponent<CommonPropsType & impor
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
15
|
-
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
16
15
|
disabled: boolean;
|
|
16
|
+
maxLength: number;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
19
19
|
focus: boolean;
|
|
@@ -11,10 +11,10 @@ declare const WdInput: React.ForwardRefExoticComponent<CommonPropsType & import(
|
|
|
11
11
|
name: string;
|
|
12
12
|
type: "number" | "text" | "idcard" | "digit";
|
|
13
13
|
value: string;
|
|
14
|
-
size: "s" | "m" | "l" | "full";
|
|
15
14
|
required: boolean;
|
|
16
|
-
|
|
15
|
+
size: "s" | "m" | "l" | "full";
|
|
17
16
|
disabled: boolean;
|
|
17
|
+
maxLength: number;
|
|
18
18
|
placeholder: string;
|
|
19
19
|
layout: "" | "vertical" | "horizontal";
|
|
20
20
|
focus: boolean;
|
|
@@ -52,7 +52,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
52
52
|
const [visible, setVisible] = useState(true);
|
|
53
53
|
const forceUpdate = useRerender();
|
|
54
54
|
const form = useParentForm($widget);
|
|
55
|
-
logger.debug(
|
|
55
|
+
logger.debug('WdFormItem', form, name, inputParams);
|
|
56
56
|
const layout = useMemo(() => {
|
|
57
57
|
let finalLayout;
|
|
58
58
|
if (form && (!currentLayout || currentLayout === 'auto')) {
|
|
@@ -62,21 +62,20 @@ export function useFormInputTrait(inputParams) {
|
|
|
62
62
|
finalLayout = currentLayout;
|
|
63
63
|
}
|
|
64
64
|
return finalLayout;
|
|
65
|
-
|
|
65
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps --- add form.layout as dependencies
|
|
66
|
+
}, [form, currentLayout, form === null || form === void 0 ? void 0 : form.layout]);
|
|
66
67
|
const [syncValue, _setSyncedValue] = useSyncValue(value, isObjectEqual);
|
|
67
68
|
const setSyncedValue = useCallback((newVal) => {
|
|
68
69
|
var _a;
|
|
69
70
|
logger.debug('updateFormContext', newVal);
|
|
70
71
|
_setSyncedValue(newVal);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, [_setSyncedValue, $node, form, name]);
|
|
76
|
-
// const [syncValue] = useSetValueWithFormContextUpdate(value, form, name);
|
|
72
|
+
// 发现富文本中有时序问题,form 还是拿到旧值的闭包,所以再找一次
|
|
73
|
+
const f = form !== null && form !== void 0 ? form : getParentForm($widget);
|
|
74
|
+
(_a = f === null || f === void 0 ? void 0 : f.updateFormContext) === null || _a === void 0 ? void 0 : _a.call(f, name, newVal);
|
|
75
|
+
}, [$widget, _setSyncedValue, form, name]);
|
|
77
76
|
useEffect(() => {
|
|
78
|
-
logger.debug('Form', form);
|
|
79
|
-
}, [form]);
|
|
77
|
+
logger.debug('Form', form, name);
|
|
78
|
+
}, [form, name]);
|
|
80
79
|
useEffect(() => {
|
|
81
80
|
// 未匹配任何规则时,清空错误提示
|
|
82
81
|
if (!rules)
|
|
@@ -96,7 +95,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
96
95
|
setValidateErrorMsg('');
|
|
97
96
|
setValidateState(undefined);
|
|
98
97
|
}, [setValidateErrorMsg, setValidateState]);
|
|
99
|
-
// 挂在setValue方法到 $widget上
|
|
98
|
+
// 挂在 setValue 方法到 $widget 上
|
|
100
99
|
React.useImperativeHandle(inputRef, () => {
|
|
101
100
|
logger.debug('useImperativeHandle', { name, syncValue });
|
|
102
101
|
const result = {
|
|
@@ -107,7 +106,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
107
106
|
setVisible(val) {
|
|
108
107
|
const value = convertMethodParam(val);
|
|
109
108
|
if (typeof value !== 'boolean') {
|
|
110
|
-
console.warn('参数需要为boolean');
|
|
109
|
+
console.warn('参数需要为 boolean');
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
112
|
setVisible(value);
|
|
@@ -302,7 +301,7 @@ export function useFormInputTrait(inputParams) {
|
|
|
302
301
|
});
|
|
303
302
|
// const runOnceRef = useRef(false);
|
|
304
303
|
// useEffect(() => {
|
|
305
|
-
// // 双保险,向上取initialValues
|
|
304
|
+
// // 双保险,向上取 initialValues
|
|
306
305
|
// if (runOnceRef.current) {
|
|
307
306
|
// return;
|
|
308
307
|
// }
|
|
@@ -10,8 +10,8 @@ declare const FormMultiRegion: React.ForwardRefExoticComponent<CommonPropsType &
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -10,8 +10,8 @@ declare const FormPhone: React.ForwardRefExoticComponent<CommonPropsType & impor
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -10,8 +10,8 @@ declare const FormRegion: React.ForwardRefExoticComponent<CommonPropsType & impo
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string[];
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
separator: string;
|
|
@@ -11,8 +11,8 @@ declare const FormSelect: React.ForwardRefExoticComponent<CommonPropsType & impo
|
|
|
11
11
|
name: string;
|
|
12
12
|
format: "x-enum" | "related" | "father-son" | "many-one";
|
|
13
13
|
value: string;
|
|
14
|
-
size: "s" | "m" | "l" | "full";
|
|
15
14
|
required: boolean;
|
|
15
|
+
size: "s" | "m" | "l" | "full";
|
|
16
16
|
disabled: boolean;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -11,8 +11,8 @@ declare const FormSelectMultiple: React.ForwardRefExoticComponent<CommonPropsTyp
|
|
|
11
11
|
name: string;
|
|
12
12
|
format: "many-many" | "one-many";
|
|
13
13
|
value: string[];
|
|
14
|
-
size: "s" | "m" | "l" | "full";
|
|
15
14
|
required: boolean;
|
|
15
|
+
size: "s" | "m" | "l" | "full";
|
|
16
16
|
disabled: boolean;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -10,10 +10,10 @@ declare const FormTextArea: React.ForwardRefExoticComponent<CommonPropsType & im
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
15
|
-
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
16
15
|
disabled: boolean;
|
|
16
|
+
maxLength: number;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
19
19
|
focus: boolean;
|
|
@@ -10,8 +10,8 @@ declare const FormTime: React.ForwardRefExoticComponent<CommonPropsType & import
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
end: string;
|
|
@@ -10,10 +10,10 @@ declare const FormUrl: React.ForwardRefExoticComponent<CommonPropsType & import(
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
15
|
-
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
16
15
|
disabled: boolean;
|
|
16
|
+
maxLength: number;
|
|
17
17
|
placeholder: string;
|
|
18
18
|
layout: "" | "vertical" | "horizontal";
|
|
19
19
|
focus: boolean;
|
|
@@ -10,8 +10,8 @@ declare const FormUserTreeSelect: React.ForwardRefExoticComponent<CommonPropsTyp
|
|
|
10
10
|
label: string;
|
|
11
11
|
name: string;
|
|
12
12
|
value: string;
|
|
13
|
-
size: "s" | "m" | "l" | "full";
|
|
14
13
|
required: boolean;
|
|
14
|
+
size: "s" | "m" | "l" | "full";
|
|
15
15
|
disabled: boolean;
|
|
16
16
|
placeholder: string;
|
|
17
17
|
layout: "" | "vertical" | "horizontal";
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { UserTreeSelect } from '../../components';
|
|
4
4
|
import Tips from '../form/tips';
|
|
5
|
-
import { useFormInputTrait } from '../form-input-hooks';
|
|
5
|
+
import { useFormInputTrait, useParentForm } from '../form-input-hooks';
|
|
6
6
|
import { FormItemWrapper } from '../common/form-item-wrapper';
|
|
7
7
|
const FormUserTreeSelect = React.forwardRef(function FormUserTreeSelect(props, inputRef) {
|
|
8
|
+
const parent = useParentForm(props.$widget);
|
|
8
9
|
const { className, id, style, events, required, requiredFlag, label, labelVisible, confirmValue, defaultValueType, multiple, size, where, secondDisplay, corpScope, ...restProps } = props;
|
|
9
10
|
const { value, name, onChange, disabled, layout, readOnly, validateErrorMsg, validateState, visible, } = useFormInputTrait({
|
|
10
11
|
name: restProps.name,
|
|
@@ -16,6 +17,6 @@ const FormUserTreeSelect = React.forwardRef(function FormUserTreeSelect(props, i
|
|
|
16
17
|
if (!visible) {
|
|
17
18
|
return null;
|
|
18
19
|
}
|
|
19
|
-
return (_jsxs(FormItemWrapper, { children: [_jsx(UserTreeSelect, { id: id, style: style, className: className, events: events, name: name, checked: value, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, confirmValue: confirmValue, defaultValueType: defaultValueType, defaultValue: value, size: size, multiple: multiple, where: where, secondDisplay: secondDisplay, corpScope: corpScope, readOnly: readOnly,
|
|
20
|
+
return (_jsxs(FormItemWrapper, { children: [_jsx(UserTreeSelect, { id: id, style: style, className: className, events: events, name: name, onChange: onChange, checked: value, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, confirmValue: confirmValue, defaultValueType: defaultValueType, defaultValue: value, size: size, multiple: multiple, where: where, secondDisplay: secondDisplay, corpScope: corpScope, readOnly: readOnly, formType: parent === null || parent === void 0 ? void 0 : parent.formType }), (validateState === 'error' || validateState === 'warn') && (_jsx(Tips, { tips: validateErrorMsg, type: "warn" }))] }));
|
|
20
21
|
});
|
|
21
22
|
export default FormUserTreeSelect;
|
|
@@ -24,12 +24,16 @@ const getIdeMockData = (length = 3) => Array.from({ length }).map(() => Object.c
|
|
|
24
24
|
const getStringValue = (v) => (typeof v === 'string' ? v : '');
|
|
25
25
|
const defaultCloudbase = { callDataSource, isInIde };
|
|
26
26
|
const defaultBeforeDataChange = (v) => v;
|
|
27
|
+
const getCurrentPageData = (data = [], pageNo, pageSize) => {
|
|
28
|
+
const records = [].concat(data);
|
|
29
|
+
return (records === null || records === void 0 ? void 0 : records.slice((pageNo - 1) * pageSize, pageNo * pageSize)) || []; // 当前页的数据
|
|
30
|
+
};
|
|
27
31
|
/**
|
|
28
32
|
* 数据容器-列表视图
|
|
29
33
|
*/
|
|
30
34
|
export default React.forwardRef(function ListView(props, ref) {
|
|
31
35
|
var _a, _b, _c;
|
|
32
|
-
const { dataSourceType, bindConnectMetadata, connectorMethod, connectorParams: rawConnectorParams, datasource, template, pageSize = 5, pagination, events, className, children, isRecords = true, //是否展示回调recoreds字段
|
|
36
|
+
const { dataSourceType, bindConnectMetadata, connectorMethod, connectorParams: rawConnectorParams, datasource, dataSourceData: _dataSourceData = [], template, enableTotal, total: _total, pageSize = 5, pagination, events, className, children, isRecords = true, //是否展示回调recoreds字段
|
|
33
37
|
isSetStatus = false, //是否开启加载状态
|
|
34
38
|
emptyText, //空状态时的文案
|
|
35
39
|
loadCompletedText = '', // 加载到底提示
|
|
@@ -38,7 +42,7 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
38
42
|
const isH5 = platform === 'h5';
|
|
39
43
|
const modelParams = getModelParams(props); // 包括 where 和 order
|
|
40
44
|
const connectorParams = rawConnectorParams && JSON.parse(JSON.stringify(rawConnectorParams));
|
|
41
|
-
const isModel = dataSourceType
|
|
45
|
+
const isModel = dataSourceType === 'data-model';
|
|
42
46
|
const methodName = getStringValue(isModel
|
|
43
47
|
? ((_a = datasource === null || datasource === void 0 ? void 0 : datasource.extra) === null || _a === void 0 ? void 0 : _a.methodName) || 'wedaGetRecords'
|
|
44
48
|
: connectorMethod === null || connectorMethod === void 0 ? void 0 : connectorMethod.name);
|
|
@@ -46,12 +50,14 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
46
50
|
useLoopRenderDetect({ limit: 600 });
|
|
47
51
|
const [entry, setEntry] = useState(null); // 触底的observer对象
|
|
48
52
|
const [status, setStatus] = useState(''); // 查询状态
|
|
53
|
+
const [pageParam, setPageParam] = useState({ pageNo: 1, pageSize });
|
|
49
54
|
const paramRef = useRef({
|
|
50
55
|
dataSourceName,
|
|
51
56
|
methodName,
|
|
52
|
-
params: {
|
|
57
|
+
params: { ...pageParam, connectorParams, modelParams },
|
|
53
58
|
pagination,
|
|
54
59
|
}); // 最新请求参数
|
|
60
|
+
const [dataSourceData, setDataSourceData] = useState(_dataSourceData || []);
|
|
55
61
|
const dataRef = useRef({ total: 0, records: [] }); // 最新数据列表
|
|
56
62
|
const observeRef = useRef(null); // 当前监听对象
|
|
57
63
|
const delayRef = useRef({
|
|
@@ -97,7 +103,10 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
97
103
|
pageSize,
|
|
98
104
|
},
|
|
99
105
|
pagination,
|
|
100
|
-
}, {
|
|
106
|
+
}, {
|
|
107
|
+
isInitData: true,
|
|
108
|
+
dataSourceData,
|
|
109
|
+
});
|
|
101
110
|
}
|
|
102
111
|
else {
|
|
103
112
|
(_b = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _b === void 0 ? void 0 : _b.call(events, {
|
|
@@ -105,7 +114,7 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
105
114
|
state: getContextState(),
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
|
-
}, [methodName, dataSourceName, pageSize, pagination, isModel]);
|
|
117
|
+
}, [methodName, dataSourceName, pageSize, pagination, isModel, enableTotal]);
|
|
109
118
|
// props 对象类型监听,需重新分页
|
|
110
119
|
useEffect(() => {
|
|
111
120
|
var _a, _b, _c, _d;
|
|
@@ -117,7 +126,7 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
117
126
|
}, { isInitData: true });
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
|
-
else {
|
|
129
|
+
else if (['custom-connector', 'connector'].includes(dataSourceType)) {
|
|
121
130
|
if (!isequal((_d = (_c = paramRef.current) === null || _c === void 0 ? void 0 : _c.params) === null || _d === void 0 ? void 0 : _d.connectorParams, connectorParams)) {
|
|
122
131
|
clearDelay();
|
|
123
132
|
fetchData({
|
|
@@ -126,6 +135,20 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
});
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (dataSourceType === 'expression') {
|
|
140
|
+
if (Array.isArray(_dataSourceData) &&
|
|
141
|
+
!isequal(dataSourceData, _dataSourceData)) {
|
|
142
|
+
setDataSourceData(_dataSourceData);
|
|
143
|
+
// 绑定表达式且开启动态分页的时候,列表展示依赖请求结果,因此不做清空处理。(滚动分页需保留上次的结果)
|
|
144
|
+
fetchData({
|
|
145
|
+
params: {
|
|
146
|
+
pageNo: enableTotal ? (pageParam === null || pageParam === void 0 ? void 0 : pageParam.pageNo) || 1 : 1,
|
|
147
|
+
},
|
|
148
|
+
}, { isInitData: !enableTotal, dataSourceData: _dataSourceData });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [_dataSourceData, dataSourceType]);
|
|
129
152
|
// 监听触底加载事件
|
|
130
153
|
useEffect(() => {
|
|
131
154
|
var _a, _b;
|
|
@@ -158,8 +181,7 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
158
181
|
}, []);
|
|
159
182
|
// 能否点击下一页
|
|
160
183
|
const hasNextPage = () => {
|
|
161
|
-
|
|
162
|
-
const { pageNo = 1, pageSize = 5 } = ((_a = paramRef.current) === null || _a === void 0 ? void 0 : _a.params) || {};
|
|
184
|
+
const { pageNo = 1, pageSize = 5 } = pageParam || {};
|
|
163
185
|
const { total = 0 } = dataRef.current || {};
|
|
164
186
|
return pageNo * pageSize < total;
|
|
165
187
|
};
|
|
@@ -195,8 +217,16 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
195
217
|
const onEvents = useCallback((data, datasource) => {
|
|
196
218
|
var _a, _b;
|
|
197
219
|
const isDataViewApis = !isRecords && !isModel;
|
|
198
|
-
|
|
199
|
-
|
|
220
|
+
let fetchRecords = [].concat(isDataViewApis ? data : (data === null || data === void 0 ? void 0 : data.records) || []);
|
|
221
|
+
let total = isDataViewApis ? 0 : Number(data === null || data === void 0 ? void 0 : data.total) || 0;
|
|
222
|
+
// 支持绑定表达式和动态分页
|
|
223
|
+
if (datasource.dataSourceType === 'expression') {
|
|
224
|
+
total = Array.isArray(_dataSourceData) ? _dataSourceData === null || _dataSourceData === void 0 ? void 0 : _dataSourceData.length : 0;
|
|
225
|
+
if (enableTotal && !isNaN(parseInt(`${_total}`))) {
|
|
226
|
+
total = parseInt(`${_total}`);
|
|
227
|
+
}
|
|
228
|
+
fetchRecords = [].concat(data);
|
|
229
|
+
}
|
|
200
230
|
if (['loadMoreButton', 'bottomLoad'].includes(paramRef.current.pagination)) {
|
|
201
231
|
dataRef.current = {
|
|
202
232
|
total,
|
|
@@ -239,7 +269,16 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
239
269
|
else {
|
|
240
270
|
successCb();
|
|
241
271
|
}
|
|
242
|
-
}, [
|
|
272
|
+
}, [
|
|
273
|
+
_total,
|
|
274
|
+
beforeDataChange,
|
|
275
|
+
enableTotal,
|
|
276
|
+
events,
|
|
277
|
+
isModel,
|
|
278
|
+
isRecords,
|
|
279
|
+
pagination,
|
|
280
|
+
_dataSourceData === null || _dataSourceData === void 0 ? void 0 : _dataSourceData.length,
|
|
281
|
+
]);
|
|
243
282
|
/**
|
|
244
283
|
* 列表视图拉取数据
|
|
245
284
|
* 方法仅依赖入参和paramRef的参数
|
|
@@ -247,18 +286,43 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
247
286
|
*/
|
|
248
287
|
const fetchData = useCallback(async (param, options) => {
|
|
249
288
|
var _a, _b, _c, _d, _e;
|
|
250
|
-
const
|
|
251
|
-
const { isInitData, isFetchCurrent } = options || {};
|
|
289
|
+
const { isInitData, isFetchCurrent, dataSourceData } = options || {};
|
|
252
290
|
// 合并参数并保存,useEffect 中需要比对
|
|
253
291
|
paramRef.current = {
|
|
254
292
|
...paramRef.current,
|
|
255
293
|
...param,
|
|
256
294
|
params: { ...paramRef.current.params, ...param === null || param === void 0 ? void 0 : param.params },
|
|
257
295
|
};
|
|
296
|
+
const query = {
|
|
297
|
+
pageNo: paramRef.current.params.pageNo,
|
|
298
|
+
pageSize: paramRef.current.params.pageSize,
|
|
299
|
+
};
|
|
300
|
+
setPageParam(query);
|
|
301
|
+
// 分页变化事件
|
|
302
|
+
if (events === null || events === void 0 ? void 0 : events.onPagingChange) {
|
|
303
|
+
events.onPagingChange({
|
|
304
|
+
query,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
258
307
|
const { dataSourceName, methodName, params } = paramRef.current;
|
|
259
308
|
const { pageNo, pageSize, modelParams, connectorParams } = params || {};
|
|
309
|
+
if (dataSourceType === 'expression') {
|
|
310
|
+
isInitData && (dataRef.current = { total: 0, records: [] });
|
|
311
|
+
if (!dataSourceData && enableTotal) {
|
|
312
|
+
// 动态分页的情况下,只改变页码,不主动更改records,等待请求回来更新records
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
// 绑定表达式时触发
|
|
316
|
+
const records = enableTotal
|
|
317
|
+
? [].concat(dataSourceData || _dataSourceData)
|
|
318
|
+
: getCurrentPageData(dataSourceData || _dataSourceData, pageNo, pageSize);
|
|
319
|
+
onEvents(records, { dataSourceType });
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
// 模型/apis请求
|
|
260
323
|
if (!(dataSourceName && methodName))
|
|
261
324
|
return;
|
|
325
|
+
const fetchVersion = (delayRef.current.version = getUuid());
|
|
262
326
|
setStatus('loading');
|
|
263
327
|
let tcbParams = {};
|
|
264
328
|
// tcb分页参数
|
|
@@ -324,11 +388,14 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
324
388
|
appCloud,
|
|
325
389
|
bindConnectMetadata,
|
|
326
390
|
connectorMethod,
|
|
391
|
+
dataSourceType,
|
|
327
392
|
datasource,
|
|
393
|
+
enableTotal,
|
|
328
394
|
events,
|
|
329
395
|
fetchDataLoop,
|
|
330
396
|
isModel,
|
|
331
397
|
onEvents,
|
|
398
|
+
refType,
|
|
332
399
|
]);
|
|
333
400
|
/**
|
|
334
401
|
* 计算上下文对象数据
|
|
@@ -336,7 +403,7 @@ export default React.forwardRef(function ListView(props, ref) {
|
|
|
336
403
|
const getContextState = (state = {}) => {
|
|
337
404
|
var _a, _b;
|
|
338
405
|
const total = (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.total) !== null && _b !== void 0 ? _b : 0;
|
|
339
|
-
const { pageNo, pageSize } =
|
|
406
|
+
const { pageNo, pageSize } = pageParam;
|
|
340
407
|
return { total, pageNo, pageSize, ...state };
|
|
341
408
|
};
|
|
342
409
|
/**
|
|
@@ -6,7 +6,7 @@ export interface IDataContainer {
|
|
|
6
6
|
/**
|
|
7
7
|
* 数据源
|
|
8
8
|
*/
|
|
9
|
-
dataSourceType: 'data-model' | 'connector' | 'custom-connector';
|
|
9
|
+
dataSourceType: 'data-model' | 'connector' | 'custom-connector' | 'expression';
|
|
10
10
|
/**
|
|
11
11
|
* API
|
|
12
12
|
*/
|
|
@@ -62,6 +62,12 @@ export interface IDataContainer {
|
|
|
62
62
|
* 容器事件
|
|
63
63
|
*/
|
|
64
64
|
events?: {
|
|
65
|
+
onPagingChange?: (arg0: {
|
|
66
|
+
query: {
|
|
67
|
+
pageNo: number;
|
|
68
|
+
pageSize: number;
|
|
69
|
+
};
|
|
70
|
+
}) => void;
|
|
65
71
|
queryEmpty?: any;
|
|
66
72
|
querySuccess?: any;
|
|
67
73
|
queryFail?: any;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CommonPropsType, ICompRef } from '../../types';
|
|
3
|
+
import type { DataType, EventsType } from '../../../configs/components/lottery';
|
|
3
4
|
import './style';
|
|
4
5
|
type TCompRef = ICompRef<{
|
|
5
6
|
start: () => void;
|
|
6
7
|
}>;
|
|
7
|
-
declare const _default: React.ForwardRefExoticComponent<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
prizeList: any;
|
|
14
|
-
/**
|
|
15
|
-
* 启动抽奖
|
|
16
|
-
*/
|
|
8
|
+
declare const _default: React.ForwardRefExoticComponent<CommonPropsType & import("type-fest").Simplify<{
|
|
9
|
+
prizeList: {
|
|
10
|
+
title: string;
|
|
11
|
+
image: string;
|
|
12
|
+
}[];
|
|
17
13
|
enablePrize: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* 抽奖结果
|
|
20
|
-
*/
|
|
21
14
|
prizeResult: string;
|
|
22
|
-
}
|
|
15
|
+
}> & import("type-fest").Simplify<import("../../../configs/type-utils").StaticEventsType<[{
|
|
16
|
+
readonly name: "clickLotteryButton";
|
|
17
|
+
readonly title: "点击开始抽奖按钮";
|
|
18
|
+
}, {
|
|
19
|
+
readonly name: "finishLottery";
|
|
20
|
+
readonly title: "开奖";
|
|
21
|
+
readonly detail: import("@sinclair/typebox").TObject<{
|
|
22
|
+
prize: import("@sinclair/typebox").TString;
|
|
23
|
+
result: import("@sinclair/typebox").TObject<{
|
|
24
|
+
desc: import("@sinclair/typebox").TString;
|
|
25
|
+
idx: import("@sinclair/typebox").TNumber;
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
}]>> & React.RefAttributes<TCompRef>>;
|
|
29
|
+
export default _default;
|
|
30
|
+
export type PropsType = CommonPropsType & DataType & EventsType & {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/jsx-key */
|
|
3
2
|
import React, { useState, useEffect, useCallback, useImperativeHandle, useMemo, } from 'react';
|
|
4
3
|
import { usePlatform } from '../../utils/platform';
|
|
5
4
|
import classNames from '../../utils/classnames';
|
|
@@ -65,9 +64,9 @@ export default React.forwardRef(function Lottery(props, ref) {
|
|
|
65
64
|
const startLottery = useCallback(() => {
|
|
66
65
|
setLotteryList(lotteryListDefault());
|
|
67
66
|
setBtnActived(true);
|
|
67
|
+
events === null || events === void 0 ? void 0 : events.clickLotteryButton({});
|
|
68
68
|
if (lotteryAction.isStart)
|
|
69
69
|
return;
|
|
70
|
-
events === null || events === void 0 ? void 0 : events.clickLotteryButton();
|
|
71
70
|
setIsStartLottery(true);
|
|
72
71
|
}, [
|
|
73
72
|
lotteryAction.isStart,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/jsx-key */
|
|
3
2
|
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
3
|
import { NavMenu, List, Dropdown } from 'tea-component';
|
|
5
4
|
import { usePlatform } from '../../utils/platform';
|