From a53909bcc30ecdd6f23589e259d58d7598b20e42 Mon Sep 17 00:00:00 2001 From: Xc Date: Fri, 5 Jul 2024 15:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86updateItems=E6=9A=B4=E9=9C=B2=E7=BB=99?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/components/actionTabPanel/index.js | 6 ++-- es/components/detail/index.d.ts | 10 +++--- es/components/detail/index.js | 2 +- es/components/errorPage/index.d.ts | 4 +-- es/components/errorPage/index.js | 2 +- es/components/filter/index.js | 2 +- es/components/list/index.d.ts | 21 +++++------- es/components/list/index.js | 2 +- es/components/pageHeader/index.d.ts | 19 +++++------ es/components/pageHeader2/index.d.ts | 21 ++++++------ es/components/pagination/index.d.ts | 13 ++++--- es/components/refAttr/index.js | 2 +- es/components/upsert/index.d.ts | 2 +- es/components/upsert/index.js | 2 +- es/features/cache.js | 4 +-- es/features/runningTree.d.ts | 5 ++- es/features/runningTree.js | 33 ++++++++++++------ es/page.common.js | 14 ++++---- es/page.mp.js | 6 ++++ es/page.react.d.ts | 13 +++---- es/page.react.js | 9 +++++ es/platforms/web/responsive/context.js | 2 +- es/types/Page.d.ts | 3 +- lib/components/errorPage/index.d.ts | 4 +-- lib/components/errorPage/index.js | 2 +- lib/components/func/debugPanel/index.d.ts | 3 +- lib/components/message/index.d.ts | 3 +- lib/features/cache.js | 2 +- lib/page.mp.js | 6 ++++ lib/page.native.d.ts | 2 +- lib/page.react.d.ts | 34 +++++++++++++++---- lib/page.react.js | 9 +++++ lib/page.web.d.ts | 3 +- lib/page.web.js | 1 - lib/platforms/native/features/index.d.ts | 4 +-- lib/platforms/native/router/withRouter.d.ts | 3 +- lib/platforms/native/router/withRouter.js | 2 -- lib/platforms/web/Loading.d.ts | 3 +- lib/platforms/web/PullToRefresh.js | 1 - lib/platforms/web/features/index.d.ts | 2 +- .../web/initialize/AppContainer.d.ts | 2 +- lib/platforms/web/initialize/AppError.d.ts | 2 +- lib/platforms/web/initialize/AppError.js | 28 +++++++++++++-- lib/platforms/web/initialize/AppRouter.d.ts | 2 +- lib/platforms/web/initialize/index.js | 2 -- lib/platforms/web/responsive/context.d.ts | 5 ++- lib/platforms/web/responsive/context.js | 2 +- lib/platforms/web/router/withRouter.d.ts | 3 +- lib/types/Page.d.ts | 3 +- package.json | 4 +-- src/page.mp.ts | 11 ++++++ src/page.react.tsx | 20 +++++++++++ src/types/Page.ts | 3 +- 53 files changed, 243 insertions(+), 125 deletions(-) diff --git a/es/components/actionTabPanel/index.js b/es/components/actionTabPanel/index.js index 334680cc..1019b0e6 100644 --- a/es/components/actionTabPanel/index.js +++ b/es/components/actionTabPanel/index.js @@ -1,9 +1,9 @@ export default OakComponent({ isList: false, data: { - slideWidth: 0, - slideLeft: 0, - slideShow: false, + slideWidth: 0, //小程序使用 + slideLeft: 0, //小程序使用 + slideShow: false, //小程序使用 commonAction: [ 'create', 'update', diff --git a/es/components/detail/index.d.ts b/es/components/detail/index.d.ts index bc0497c0..633eebb3 100644 --- a/es/components/detail/index.d.ts +++ b/es/components/detail/index.d.ts @@ -2,12 +2,12 @@ import { ED, OakAbsAttrDef } from '../../types/AbstractComponent'; import { ReactComponentProps } from '../../types/Page'; import { Breakpoint } from 'antd'; declare const _default: (props: ReactComponentProps | undefined; + column?: number | Record; entity: T2; attributes: OakAbsAttrDef[]; - data: Partial; - title?: string | undefined; - bordered?: boolean | undefined; - layout?: "horizontal" | "vertical" | undefined; + data: Partial; + title?: string; + bordered?: boolean; + layout?: 'horizontal' | 'vertical'; }>) => React.ReactElement; export default _default; diff --git a/es/components/detail/index.js b/es/components/detail/index.js index 189d1831..2f123a1c 100644 --- a/es/components/detail/index.js +++ b/es/components/detail/index.js @@ -61,7 +61,7 @@ export default OakComponent({ let currentUrl = event.currentTarget.dataset.src; let urlList = event.currentTarget.dataset.list; wx.previewImage({ - current: currentUrl, + current: currentUrl, // 当前显示图片的http链接 urls: urlList, // 需要预览的图片http链接列表 }); }, diff --git a/es/components/errorPage/index.d.ts b/es/components/errorPage/index.d.ts index 637b5428..b1cb64f5 100644 --- a/es/components/errorPage/index.d.ts +++ b/es/components/errorPage/index.d.ts @@ -3,8 +3,8 @@ import { ReactComponentProps } from '../../types/Page'; import { ECode } from '../../types/ErrorPage'; declare const _default: (props: ReactComponentProps) => React.ReactElement; diff --git a/es/components/errorPage/index.js b/es/components/errorPage/index.js index 77682a75..06597a8f 100644 --- a/es/components/errorPage/index.js +++ b/es/components/errorPage/index.js @@ -37,7 +37,7 @@ export default OakComponent({ code: '', title: '', desc: '', - icon: '', + icon: '', //web独有 imagePath: '', //小程序独有 }, lifetimes: { diff --git a/es/components/filter/index.js b/es/components/filter/index.js index c9631b7c..edea5393 100644 --- a/es/components/filter/index.js +++ b/es/components/filter/index.js @@ -90,7 +90,7 @@ export default OakComponent({ attribute: {}, options: [], inputType: '', - timeStartStr: '', + timeStartStr: '', // 小程序选择时间显示 timeEndStr: '', selectedLabel: '', minDateMp: new Date(1980, 1, 1).getTime(), diff --git a/es/components/list/index.d.ts b/es/components/list/index.d.ts index 996ba90d..ce3142c2 100644 --- a/es/components/list/index.d.ts +++ b/es/components/list/index.d.ts @@ -9,18 +9,13 @@ declare const _default: (props: ReactCompo attributes: OakAbsAttrDef[]; data: RowWithActions[]; loading: boolean; - tablePagination?: false | import("antd").TablePaginationConfig | undefined; - rowSelection?: import("antd/es/table/interface").TableRowSelection> | undefined; - hideHeader?: boolean | undefined; - disableSerialNumber?: boolean | undefined; - size?: "small" | "large" | "middle" | undefined; - scroll?: ({ - x?: string | number | true | undefined; - y?: string | number | undefined; - } & { - scrollToFirstRowOnChange?: boolean | undefined; - }) | undefined; - locale?: import("antd/es/table/interface").TableLocale | undefined; - opWidth?: number | undefined; + tablePagination?: TableProps>['pagination']; + rowSelection?: TableProps>['rowSelection']; + hideHeader?: boolean; + disableSerialNumber?: boolean; + size?: 'large' | 'middle' | 'small'; + scroll?: TableProps>['scroll']; + locale?: TableProps>['locale']; + opWidth?: number; }>) => React.ReactElement; export default _default; diff --git a/es/components/list/index.js b/es/components/list/index.js index de07f9db..07d1fe3d 100644 --- a/es/components/list/index.js +++ b/es/components/list/index.js @@ -13,7 +13,7 @@ export default OakComponent({ tablePagination: undefined, rowSelection: undefined, hideHeader: false, - disableSerialNumber: false, + disableSerialNumber: false, //是否禁用序号 默认启用 size: 'large', scroll: undefined, locale: undefined, diff --git a/es/components/pageHeader/index.d.ts b/es/components/pageHeader/index.d.ts index f25d157d..de716fe3 100644 --- a/es/components/pageHeader/index.d.ts +++ b/es/components/pageHeader/index.d.ts @@ -1,21 +1,20 @@ -/// import { ReactComponentProps } from '../../types/Page'; import { ED } from '../../types/AbstractComponent'; declare const _default: (props: ReactComponentProps void) | undefined; + showBack?: boolean; + onBack?: () => void; backIcon?: React.ReactNode; - delta?: number | undefined; + delta?: number; extra?: React.ReactNode; subTitle?: React.ReactNode; - contentMargin?: boolean | undefined; - contentStyle?: import("react").CSSProperties | undefined; - contentClassName?: string | undefined; + contentMargin?: boolean; + contentStyle?: React.CSSProperties; + contentClassName?: string; tags?: React.ReactNode; children?: React.ReactNode; - showHeader?: boolean | undefined; + showHeader?: boolean; }>) => React.ReactElement; export default _default; diff --git a/es/components/pageHeader2/index.d.ts b/es/components/pageHeader2/index.d.ts index 554c89f9..7e219729 100644 --- a/es/components/pageHeader2/index.d.ts +++ b/es/components/pageHeader2/index.d.ts @@ -1,23 +1,22 @@ -/// import { ReactComponentProps } from '../../types/Page'; import { ED } from '../../types/AbstractComponent'; declare const _default: (props: ReactComponentProps void) | undefined; + style?: React.CSSProperties; + className?: string; + showHeader?: boolean; + showBack?: boolean; + onBack?: () => void; backIcon?: React.ReactNode; - delta?: number | undefined; + delta?: number; title?: React.ReactNode; subTitle?: React.ReactNode; tags?: React.ReactNode; extra?: React.ReactNode; children?: React.ReactNode; content: React.ReactNode; - contentStyle?: import("react").CSSProperties | undefined; - contentClassName?: string | undefined; - bodyStyle?: import("react").CSSProperties | undefined; - bodyClassName?: string | undefined; + contentStyle?: React.CSSProperties; + contentClassName?: string; + bodyStyle?: React.CSSProperties; + bodyClassName?: string; }>) => React.ReactElement; export default _default; diff --git a/es/components/pagination/index.d.ts b/es/components/pagination/index.d.ts index 0e7e783f..7e393cff 100644 --- a/es/components/pagination/index.d.ts +++ b/es/components/pagination/index.d.ts @@ -1,13 +1,12 @@ -/// import { ReactComponentProps } from '../../types/Page'; import { ED } from '../../types/AbstractComponent'; declare const _default: (props: ReactComponentProps React.ReactNode) | undefined; + style?: React.CSSProperties; + className?: string; + showQuickJumper?: boolean; + size?: 'default' | 'small'; + showSizeChanger?: boolean; + showTotal?: (total: number, range: [number, number]) => React.ReactNode; }>) => React.ReactElement; export default _default; diff --git a/es/components/refAttr/index.js b/es/components/refAttr/index.js index a98ea981..6c92bb93 100644 --- a/es/components/refAttr/index.js +++ b/es/components/refAttr/index.js @@ -9,7 +9,7 @@ export default OakComponent({ multiple: false, entityId: '', entityIds: [], - pickerRender: {}, + pickerRender: {}, // OakAbsRefAttrPickerRender onChange: (() => undefined), }, formData() { diff --git a/es/components/upsert/index.d.ts b/es/components/upsert/index.d.ts index 35a7fb5e..b81a5408 100644 --- a/es/components/upsert/index.d.ts +++ b/es/components/upsert/index.d.ts @@ -4,7 +4,7 @@ declare const _default: ; entity: T2; attributes: OakAbsAttrUpsertDef[]; - data: ED2[T2]["Schema"]; + data: ED2[T2]['Schema']; layout: 'horizontal' | 'vertical'; mode: 'default' | 'card'; }>) => React.ReactElement; diff --git a/es/components/upsert/index.js b/es/components/upsert/index.js index d9561533..38d769fd 100644 --- a/es/components/upsert/index.js +++ b/es/components/upsert/index.js @@ -5,7 +5,7 @@ export default OakComponent({ return this.props.entity; }, properties: { - helps: {}, + helps: {}, // Record; entity: '', attributes: [], layout: 'horizontal', diff --git a/es/features/cache.js b/es/features/cache.js index 6f752b1f..d517196d 100644 --- a/es/features/cache.js +++ b/es/features/cache.js @@ -103,7 +103,7 @@ export class Cache extends Feature { this.refreshing--; if (e instanceof OakException) { const { opRecords } = e; - if (opRecords) { + if (opRecords.length) { this.syncInner(opRecords); this.publish(); } @@ -349,7 +349,7 @@ export class Cache extends Feature { opers.forEach((oper) => { const { entity, operation } = oper; this.cacheStore.operate(entity, operation, this.context, { - checkerTypes: ['logical'], + checkerTypes: ['logical'], // 这里不能检查data,不然在数据没填完前会有大量异常 dontCollect: true, }); }); diff --git a/es/features/runningTree.d.ts b/es/features/runningTree.d.ts index d04179e0..1e57d443 100644 --- a/es/features/runningTree.d.ts +++ b/es/features/runningTree.d.ts @@ -137,6 +137,8 @@ declare class ListNode, action?: ED[T]['Action']): void; + updateItems(lsn: number, data: Record, ids: string[], action?: ED[T]['Action']): void; composeOperations(): Array<{ entity: keyof ED; operation: ED[keyof ED]['Operation']; @@ -307,6 +309,7 @@ export declare class RunningTree extends removeItem(path: string, id: string): void; removeItems(path: string, ids: string[]): void; updateItem(path: string, data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action']): void; + updateItems(path: string, data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action']): void; recoverItem(path: string, id: string): void; recoverItems(path: string, ids: string[]): void; resetItem(path: string, id: string): void; diff --git a/es/features/runningTree.js b/es/features/runningTree.js index 687f2c1d..fb6ddde2 100644 --- a/es/features/runningTree.js +++ b/es/features/runningTree.js @@ -776,14 +776,7 @@ class ListNode extends Node { resetItem(id) { this.ulManager.undo({ id }); } - /** - * 目前只支持根据itemId进行更新 - * @param data - * @param id - * @param beforeExecute - * @param afterExecute - */ - updateItem(lsn, data, id, action) { + preProcessUpdateData(data) { const undefinedAttrs = []; // 如果数据键值是一个空字符串则更新成null,undefined则unset掉 for (const k in data) { @@ -797,6 +790,8 @@ class ListNode extends Node { } } undefinedAttrs.forEach((attr) => unset(data, attr)); + } + updateItemInner(lsn, data, id, action) { this.ulManager.push(lsn, { action: action || 'update', data, @@ -804,10 +799,23 @@ class ListNode extends Node { id, }, }); + } + /** + * 目前只支持根据itemId进行更新 + * @param data + * @param id + * @param beforeExecute + * @param afterExecute + */ + updateItem(lsn, data, id, action) { + this.preProcessUpdateData(data); + this.updateItemInner(lsn, data, id, action); this.setDirty(); } - updateItems(data, action) { - throw new Error('暂未实现'); + updateItems(lsn, data, ids, action) { + this.preProcessUpdateData(data); + ids.forEach((id) => this.updateItemInner(lsn, data, id, action)); + this.setDirty(); } composeOperations() { if (!this.dirty) { @@ -2022,6 +2030,11 @@ export class RunningTree extends Feature { assert(node instanceof ListNode); node.updateItem(this.logSerailNumber, data, id, action); } + updateItems(path, data, ids, action) { + const node = this.findNode(path); + assert(node instanceof ListNode); + node.updateItems(this.logSerailNumber, data, ids, action); + } recoverItem(path, id) { const node = this.findNode(path); assert(node instanceof ListNode); diff --git a/es/page.common.js b/es/page.common.js index 3004e044..6b020cb0 100644 --- a/es/page.common.js +++ b/es/page.common.js @@ -77,6 +77,13 @@ export function onPathSet(option, isPage) { } } } + else { + // 不设置的默认情况,宽屏取100窄屏不取 + const { width } = this.props; + if (width !== 'xs') { + getTotal2 = 100; + } + } let pagination2; if (pagination) { if (pagination instanceof Array) { @@ -87,13 +94,6 @@ export function onPathSet(option, isPage) { pagination2 = pagination; } } - else { - // 不设置的默认情况,宽屏取100窄屏不取 - const { width } = this.props; - if (width !== 'xs') { - getTotal2 = 100; - } - } features.runningTree.createNode({ path: oakPath2, entity: entity2, diff --git a/es/page.mp.js b/es/page.mp.js index a910dcb0..4782ad24 100644 --- a/es/page.mp.js +++ b/es/page.mp.js @@ -394,6 +394,12 @@ const oakBehavior = Behavior({ : this.state.oakFullpath; return this.features.runningTree.updateItem(path2, data, id, action); }, + updateItems(data, ids, action, path) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + return this.features.runningTree.updateItems(path2, data, ids, action); + }, removeItem(id, path) { const path2 = path ? `${this.state.oakFullpath}.${path}` diff --git a/es/page.react.d.ts b/es/page.react.d.ts index fa62537e..e6f822ef 100644 --- a/es/page.react.d.ts +++ b/es/page.react.d.ts @@ -48,20 +48,21 @@ export declare function createComponent(options: { url: string; } & OakNavigateToParameters, state?: Record | undefined, disableNamespace?: boolean | undefined): Promise; - addItem(data: Omit & { + addItem(data: Omit & { id?: string | undefined; }, path?: string | undefined): string; - addItems(data: (Omit & { + addItems(data: (Omit & { id?: string | undefined; })[], path?: string | undefined): string[]; removeItem(id: string, path?: string | undefined): void; removeItems(ids: string[], path?: string | undefined): void; - updateItem(data: ED[T_2]["Update"]["data"], id: string, action?: ED[T_2]["Action"] | undefined, path?: string | undefined): void; + updateItem(data: ED[T_3]["Update"]["data"], id: string, action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void; + updateItems(data: ED[T_4]["Update"]["data"], ids: string[], action?: ED[T_4]["Action"] | undefined, path?: string | undefined): void; recoverItem(id: string, path?: string | undefined): void; recoverItems(ids: string[], path?: string | undefined): void; resetItem(id: string, path?: string | undefined): void; - update(data: ED[T_3]["Update"]["data"], action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void; - create(data: Omit, path?: string | undefined): void; + update(data: ED[T_5]["Update"]["data"], action?: ED[T_5]["Action"] | undefined, path?: string | undefined): void; + create(data: Omit, path?: string | undefined): void; remove(path?: string | undefined): void; isCreation(path?: string | undefined): boolean; clean(lsn?: number | undefined, dontPublish?: true | undefined, path?: string | undefined): void; @@ -75,7 +76,7 @@ export declare function createComponent | Partial[] | undefined; checkOperation(entity: T2_2, operation: Omit, checkerTypes?: (CheckerType | "relation")[] | undefined): boolean | import("oak-domain/lib/types").OakUserException; tryExecute(path?: string | undefined, action?: string | undefined): boolean | import("oak-domain/lib/types").OakUserException; - getOperations(path?: string | undefined): { + getOperations(path?: string | undefined): { entity: keyof ED; operation: ED[keyof ED]["Operation"]; }[] | undefined; diff --git a/es/page.react.js b/es/page.react.js index 5f30ec3c..4ca7cb03 100644 --- a/es/page.react.js +++ b/es/page.react.js @@ -100,6 +100,12 @@ class OakComponentBase extends React.PureComponent { : this.state.oakFullpath; this.features.runningTree.updateItem(path2, data, id, action); } + updateItems(data, ids, action, path) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + this.features.runningTree.updateItems(path2, data, ids, action); + } recoverItem(id, path) { const path2 = path ? `${this.state.oakFullpath}.${path}` @@ -465,6 +471,9 @@ export function createComponent(option, features) { updateItem: (data, id, action, path) => { return this.updateItem(data, id, action, path); }, + updateItems: (data, ids, action, path) => { + return this.updateItems(data, ids, action, path); + }, setFilters: (filters, path) => { return this.setFilters(filters, path); }, diff --git a/es/platforms/web/responsive/context.js b/es/platforms/web/responsive/context.js index 160db654..1f1c4d3f 100644 --- a/es/platforms/web/responsive/context.js +++ b/es/platforms/web/responsive/context.js @@ -1,7 +1,7 @@ import React from 'react'; export const keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl']; export const values = { - xs: 576, + xs: 576, //小于576 sm: 576, md: 768, lg: 992, diff --git a/es/types/Page.d.ts b/es/types/Page.d.ts index 21b8822a..d5a8f808 100644 --- a/es/types/Page.d.ts +++ b/es/types/Page.d.ts @@ -222,6 +222,7 @@ export type OakListComponentMethods void; removeItems: (ids: string[], path?: string) => void; updateItem: (data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action'], path?: string) => void; + updateItems: (data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action'], path?: string) => void; recoverItem: (id: string, path?: string) => void; recoverItems: (ids: string[], path?: string) => void; resetItem: (id: string, path?: string) => void; @@ -260,7 +261,7 @@ type OakListComoponetData, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record> = (options: OakComponentOption) => (props: ReactComponentProps) => React.ReactElement; export type WebComponentCommonMethodNames = 'setNotification' | 'setMessage' | 'navigateTo' | 'navigateBack' | 'redirectTo' | 'clean' | 't' | 'execute' | 'refresh' | 'aggregate' | 'checkOperation' | 'isDirty'; -export type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'addNamedFilter' | 'removeNamedFilter' | 'removeNamedFilterByName' | 'setNamedSorters' | 'addNamedSorter' | 'removeNamedSorter' | 'removeNamedSorterByName' | 'setPageSize' | 'setCurrentPage' | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'resetItem' | 'recoverItem' | 'recoverItems'; +export type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'addNamedFilter' | 'removeNamedFilter' | 'removeNamedFilterByName' | 'setNamedSorters' | 'addNamedSorter' | 'removeNamedSorter' | 'removeNamedSorterByName' | 'setPageSize' | 'setCurrentPage' | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'updateItems' | 'resetItem' | 'recoverItem' | 'recoverItems'; export type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation' | 'getId' | 'setId'; export type WebComponentProps = { methods: TMethod & OakCommonComponentMethods & OakListComponentMethods & OakSingleComponentMethods; diff --git a/lib/components/errorPage/index.d.ts b/lib/components/errorPage/index.d.ts index 637b5428..b1cb64f5 100644 --- a/lib/components/errorPage/index.d.ts +++ b/lib/components/errorPage/index.d.ts @@ -3,8 +3,8 @@ import { ReactComponentProps } from '../../types/Page'; import { ECode } from '../../types/ErrorPage'; declare const _default: (props: ReactComponentProps) => React.ReactElement; diff --git a/lib/components/errorPage/index.js b/lib/components/errorPage/index.js index 8156d0b4..51d0bff7 100644 --- a/lib/components/errorPage/index.js +++ b/lib/components/errorPage/index.js @@ -39,7 +39,7 @@ exports.default = OakComponent({ code: '', title: '', desc: '', - icon: '', + icon: '', //web独有 imagePath: '', //小程序独有 }, lifetimes: { diff --git a/lib/components/func/debugPanel/index.d.ts b/lib/components/func/debugPanel/index.d.ts index b967ae6f..ffeec765 100644 --- a/lib/components/func/debugPanel/index.d.ts +++ b/lib/components/func/debugPanel/index.d.ts @@ -1,3 +1,4 @@ /// -declare const _default: (props: import("../../..").ReactComponentProps) => React.ReactElement; +/// +declare const _default: (props: import("../../..").ReactComponentProps) => import("react").ReactElement>; export default _default; diff --git a/lib/components/message/index.d.ts b/lib/components/message/index.d.ts index 81946a9c..fdb631be 100644 --- a/lib/components/message/index.d.ts +++ b/lib/components/message/index.d.ts @@ -1,3 +1,4 @@ /// -declare const _default: (props: import("../..").ReactComponentProps) => React.ReactElement; +/// +declare const _default: (props: import("../..").ReactComponentProps) => import("react").ReactElement>; export default _default; diff --git a/lib/features/cache.js b/lib/features/cache.js index fc47e957..1dbc5595 100644 --- a/lib/features/cache.js +++ b/lib/features/cache.js @@ -352,7 +352,7 @@ class Cache extends Feature_1.Feature { opers.forEach((oper) => { const { entity, operation } = oper; this.cacheStore.operate(entity, operation, this.context, { - checkerTypes: ['logical'], + checkerTypes: ['logical'], // 这里不能检查data,不然在数据没填完前会有大量异常 dontCollect: true, }); }); diff --git a/lib/page.mp.js b/lib/page.mp.js index 8afb3c29..2fde0cfd 100644 --- a/lib/page.mp.js +++ b/lib/page.mp.js @@ -397,6 +397,12 @@ const oakBehavior = Behavior({ : this.state.oakFullpath; return this.features.runningTree.updateItem(path2, data, id, action); }, + updateItems(data, ids, action, path) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + return this.features.runningTree.updateItems(path2, data, ids, action); + }, removeItem(id, path) { const path2 = path ? `${this.state.oakFullpath}.${path}` diff --git a/lib/page.native.d.ts b/lib/page.native.d.ts index efba48a1..7db4a537 100644 --- a/lib/page.native.d.ts +++ b/lib/page.native.d.ts @@ -5,4 +5,4 @@ import { Feature } from './types/Feature'; import { DataOption, OakComponentOption } from './types/Page'; import { SyncContext } from 'oak-domain/lib/store/SyncRowStore'; import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore'; -export declare function createComponent, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record, FormedData extends Record, TData extends Record = {}, TProperty extends DataOption = {}, TMethod extends Record = {}>(option: OakComponentOption, features: BasicFeatures & FD): (props: any) => any; +export declare function createComponent, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record, FormedData extends Record, TData extends Record = {}, TProperty extends DataOption = {}, TMethod extends Record = {}>(option: OakComponentOption, features: BasicFeatures & FD): (props: any) => import("react/jsx-runtime").JSX.Element; diff --git a/lib/page.react.d.ts b/lib/page.react.d.ts index 69045482..e6f822ef 100644 --- a/lib/page.react.d.ts +++ b/lib/page.react.d.ts @@ -1,9 +1,10 @@ +import React from 'react'; import { Aspect, CheckerType, EntityDict, OpRecord } from 'oak-domain/lib/types'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; import { BasicFeatures } from './features'; import { NamedFilterItem, NamedSorterItem } from './types/NamedCondition'; import { Feature } from './types/Feature'; -import { DataOption, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page'; +import { DataOption, ComponentData, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page'; import { MessageProps } from './types/Message'; import { NotificationProps } from './types/Notification'; import { SyncContext } from 'oak-domain/lib/store/SyncRowStore'; @@ -47,20 +48,21 @@ export declare function createComponent(options: { url: string; } & OakNavigateToParameters, state?: Record | undefined, disableNamespace?: boolean | undefined): Promise; - addItem(data: Omit & { + addItem(data: Omit & { id?: string | undefined; }, path?: string | undefined): string; - addItems(data: (Omit & { + addItems(data: (Omit & { id?: string | undefined; })[], path?: string | undefined): string[]; removeItem(id: string, path?: string | undefined): void; removeItems(ids: string[], path?: string | undefined): void; - updateItem(data: ED[T_2]["Update"]["data"], id: string, action?: ED[T_2]["Action"] | undefined, path?: string | undefined): void; + updateItem(data: ED[T_3]["Update"]["data"], id: string, action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void; + updateItems(data: ED[T_4]["Update"]["data"], ids: string[], action?: ED[T_4]["Action"] | undefined, path?: string | undefined): void; recoverItem(id: string, path?: string | undefined): void; recoverItems(ids: string[], path?: string | undefined): void; resetItem(id: string, path?: string | undefined): void; - update(data: ED[T_3]["Update"]["data"], action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void; - create(data: Omit, path?: string | undefined): void; + update(data: ED[T_5]["Update"]["data"], action?: ED[T_5]["Action"] | undefined, path?: string | undefined): void; + create(data: Omit, path?: string | undefined): void; remove(path?: string | undefined): void; isCreation(path?: string | undefined): boolean; clean(lsn?: number | undefined, dontPublish?: true | undefined, path?: string | undefined): void; @@ -74,7 +76,7 @@ export declare function createComponent | Partial[] | undefined; checkOperation(entity: T2_2, operation: Omit, checkerTypes?: (CheckerType | "relation")[] | undefined): boolean | import("oak-domain/lib/types").OakUserException; tryExecute(path?: string | undefined, action?: string | undefined): boolean | import("oak-domain/lib/types").OakUserException; - getOperations(path?: string | undefined): { + getOperations(path?: string | undefined): { entity: keyof ED; operation: ED[keyof ED]["Operation"]; }[] | undefined; @@ -101,5 +103,23 @@ export declare function createComponent[]) => void): Promise; unsubDataEvents(events: string[], moduleName: string): Promise; + context: unknown; + setState>(state: ComponentData | ((prevState: Readonly>, props: Readonly>) => ComponentData | Pick, K> | null) | Pick, K> | null, callback?: (() => void) | undefined): void; + forceUpdate(callback?: (() => void) | undefined): void; + readonly props: Readonly>; + state: Readonly>; + refs: { + [key: string]: React.ReactInstance; + }; + shouldComponentUpdate?(nextProps: Readonly>, nextState: Readonly>, nextContext: any): boolean; + componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; + getSnapshotBeforeUpdate?(prevProps: Readonly>, prevState: Readonly>): any; + componentWillMount?(): void; + UNSAFE_componentWillMount?(): void; + componentWillReceiveProps?(nextProps: Readonly>, nextContext: any): void; + UNSAFE_componentWillReceiveProps?(nextProps: Readonly>, nextContext: any): void; + componentWillUpdate?(nextProps: Readonly>, nextState: Readonly>, nextContext: any): void; + UNSAFE_componentWillUpdate?(nextProps: Readonly>, nextState: Readonly>, nextContext: any): void; }; + contextType?: React.Context | undefined; }; diff --git a/lib/page.react.js b/lib/page.react.js index 4cf58650..d85acfcc 100644 --- a/lib/page.react.js +++ b/lib/page.react.js @@ -105,6 +105,12 @@ class OakComponentBase extends react_1.default.PureComponent { : this.state.oakFullpath; this.features.runningTree.updateItem(path2, data, id, action); } + updateItems(data, ids, action, path) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + this.features.runningTree.updateItems(path2, data, ids, action); + } recoverItem(id, path) { const path2 = path ? `${this.state.oakFullpath}.${path}` @@ -470,6 +476,9 @@ function createComponent(option, features) { updateItem: (data, id, action, path) => { return this.updateItem(data, id, action, path); }, + updateItems: (data, ids, action, path) => { + return this.updateItems(data, ids, action, path); + }, setFilters: (filters, path) => { return this.setFilters(filters, path); }, diff --git a/lib/page.web.d.ts b/lib/page.web.d.ts index a94c1ec6..2f5bea53 100644 --- a/lib/page.web.d.ts +++ b/lib/page.web.d.ts @@ -1,3 +1,4 @@ +import React from 'react'; import { Aspect, EntityDict } from 'oak-domain/lib/types'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; import { BasicFeatures } from './features'; @@ -5,4 +6,4 @@ import { Feature } from './types/Feature'; import { DataOption, OakComponentOption } from './types/Page'; import { SyncContext } from 'oak-domain/lib/store/SyncRowStore'; import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore'; -export declare function createComponent, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record, FormedData extends Record, TData extends Record = {}, TProperty extends DataOption = {}, TMethod extends Record = {}>(option: OakComponentOption, features: BasicFeatures & FD): any; +export declare function createComponent, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record, FormedData extends Record, TData extends Record = {}, TProperty extends DataOption = {}, TMethod extends Record = {}>(option: OakComponentOption, features: BasicFeatures & FD): React.ForwardRefExoticComponent>; diff --git a/lib/page.web.js b/lib/page.web.js index 28223b2f..ca1bd151 100644 --- a/lib/page.web.js +++ b/lib/page.web.js @@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.createComponent = void 0; const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); -const react_1 = tslib_1.__importDefault(require("react")); const withRouter_1 = tslib_1.__importDefault(require("./platforms/web/router/withRouter")); const PullToRefresh_1 = tslib_1.__importDefault(require("./platforms/web/PullToRefresh")); const page_react_1 = require("./page.react"); diff --git a/lib/platforms/native/features/index.d.ts b/lib/platforms/native/features/index.d.ts index 61a6578a..ed07a4f1 100644 --- a/lib/platforms/native/features/index.d.ts +++ b/lib/platforms/native/features/index.d.ts @@ -4,6 +4,6 @@ type Props = { features: Record; children: React.ReactNode; }; -declare const FeaturesProvider: (props: Props) => any; -declare const useFeatures: >() => any; +declare const FeaturesProvider: (props: Props) => import("react/jsx-runtime").JSX.Element; +declare const useFeatures: >() => FD2; export { FeaturesProvider, useFeatures }; diff --git a/lib/platforms/native/router/withRouter.d.ts b/lib/platforms/native/router/withRouter.d.ts index e1f32c1b..3bc7084f 100644 --- a/lib/platforms/native/router/withRouter.d.ts +++ b/lib/platforms/native/router/withRouter.d.ts @@ -1,6 +1,7 @@ +import React from 'react'; type OakComponentProperties = { path?: string; properties?: Record; }; -declare const withRouter: (Component: React.ComponentType, { path, properties }: OakComponentProperties) => (props: any) => any; +declare const withRouter: (Component: React.ComponentType, { path, properties }: OakComponentProperties) => (props: any) => import("react/jsx-runtime").JSX.Element; export default withRouter; diff --git a/lib/platforms/native/router/withRouter.js b/lib/platforms/native/router/withRouter.js index a0858dde..39cb68cf 100644 --- a/lib/platforms/native/router/withRouter.js +++ b/lib/platforms/native/router/withRouter.js @@ -1,8 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); -const react_1 = tslib_1.__importDefault(require("react")); const assert_1 = require("oak-domain/lib/utils/assert"); function getParams(params, properties) { const props = getProps(params, properties); diff --git a/lib/platforms/web/Loading.d.ts b/lib/platforms/web/Loading.d.ts index 6cf00498..9a4eb5de 100644 --- a/lib/platforms/web/Loading.d.ts +++ b/lib/platforms/web/Loading.d.ts @@ -1,3 +1,4 @@ +import React from 'react'; import 'nprogress/nprogress.css'; -declare const _default: any; +declare const _default: React.MemoExoticComponent<() => null>; export default _default; diff --git a/lib/platforms/web/PullToRefresh.js b/lib/platforms/web/PullToRefresh.js index cbab5c59..a2170211 100644 --- a/lib/platforms/web/PullToRefresh.js +++ b/lib/platforms/web/PullToRefresh.js @@ -2,7 +2,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); -const react_1 = tslib_1.__importDefault(require("react")); const rmc_pull_to_refresh_1 = tslib_1.__importDefault(require("rmc-pull-to-refresh")); require("./PullToRefresh.css"); const OakPullToRefresh = (props) => { diff --git a/lib/platforms/web/features/index.d.ts b/lib/platforms/web/features/index.d.ts index 08182f40..18e3356a 100644 --- a/lib/platforms/web/features/index.d.ts +++ b/lib/platforms/web/features/index.d.ts @@ -4,5 +4,5 @@ declare const FeaturesProvider: React.FC<{ features: Record; children: React.ReactNode; }>; -declare const useFeatures: >() => any; +declare const useFeatures: >() => FD2; export { FeaturesProvider, useFeatures }; diff --git a/lib/platforms/web/initialize/AppContainer.d.ts b/lib/platforms/web/initialize/AppContainer.d.ts index 22b5a939..03e1966b 100644 --- a/lib/platforms/web/initialize/AppContainer.d.ts +++ b/lib/platforms/web/initialize/AppContainer.d.ts @@ -2,5 +2,5 @@ import React from 'react'; type AppContainerProps = { children?: React.ReactNode; }; -declare const AppContainer: (props: AppContainerProps) => any; +declare const AppContainer: (props: AppContainerProps) => import("react/jsx-runtime").JSX.Element; export default AppContainer; diff --git a/lib/platforms/web/initialize/AppError.d.ts b/lib/platforms/web/initialize/AppError.d.ts index 300bfc4f..f0499037 100644 --- a/lib/platforms/web/initialize/AppError.d.ts +++ b/lib/platforms/web/initialize/AppError.d.ts @@ -5,5 +5,5 @@ interface ErrorProps { error: any; features: BasicFeatures; } -declare function Error(props: ErrorProps): any; +declare function Error(props: ErrorProps): import("react/jsx-runtime").JSX.Element; export default Error; diff --git a/lib/platforms/web/initialize/AppError.js b/lib/platforms/web/initialize/AppError.js index 111ce68b..a5ac51c3 100644 --- a/lib/platforms/web/initialize/AppError.js +++ b/lib/platforms/web/initialize/AppError.js @@ -1,12 +1,34 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); -const react_1 = tslib_1.__importStar(require("react")); +const react_1 = require("react"); const antd_1 = require("antd"); const Exception_1 = require("oak-domain/lib/types/Exception"); const ErrorPage_1 = require("../../../types/ErrorPage"); -const ErrorPage = (0, react_1.lazy)(() => Promise.resolve().then(() => tslib_1.__importStar(require('../../../components/errorPage')))); +const ErrorPage = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../../../components/errorPage')))); function Error(props) { const { error, features } = props; if (error instanceof Exception_1.OakException) { diff --git a/lib/platforms/web/initialize/AppRouter.d.ts b/lib/platforms/web/initialize/AppRouter.d.ts index d6b79bba..b7620d11 100644 --- a/lib/platforms/web/initialize/AppRouter.d.ts +++ b/lib/platforms/web/initialize/AppRouter.d.ts @@ -5,5 +5,5 @@ declare const AppRouter: (props: { routers: IRouter[]; appName: string; features: BasicFeatures; -}) => any; +}) => import("react/jsx-runtime").JSX.Element; export default AppRouter; diff --git a/lib/platforms/web/initialize/index.js b/lib/platforms/web/initialize/index.js index 9ea67293..62f99595 100644 --- a/lib/platforms/web/initialize/index.js +++ b/lib/platforms/web/initialize/index.js @@ -2,8 +2,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); -// @ts-nocheck -const react_1 = tslib_1.__importDefault(require("react")); const client_1 = tslib_1.__importDefault(require("react-dom/client")); const history_1 = require("history"); const react_router_dom_1 = require("react-router-dom"); diff --git a/lib/platforms/web/responsive/context.d.ts b/lib/platforms/web/responsive/context.d.ts index 0fded541..08e5d73e 100644 --- a/lib/platforms/web/responsive/context.d.ts +++ b/lib/platforms/web/responsive/context.d.ts @@ -1,3 +1,4 @@ +import React from 'react'; export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'; export type Keys = Width[]; export type Values = { @@ -15,4 +16,6 @@ export type Breakpoints = { export declare const keys: Keys; export declare const values: Values; export declare const defaultBreakpoints: Breakpoints; -export declare const ResponsiveContext: any; +export declare const ResponsiveContext: React.Context<{ + breakpoints?: Breakpoints | undefined; +}>; diff --git a/lib/platforms/web/responsive/context.js b/lib/platforms/web/responsive/context.js index 55d0f20e..adacafce 100644 --- a/lib/platforms/web/responsive/context.js +++ b/lib/platforms/web/responsive/context.js @@ -5,7 +5,7 @@ const tslib_1 = require("tslib"); const react_1 = tslib_1.__importDefault(require("react")); exports.keys = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl']; exports.values = { - xs: 576, + xs: 576, //小于576 sm: 576, md: 768, lg: 992, diff --git a/lib/platforms/web/router/withRouter.d.ts b/lib/platforms/web/router/withRouter.d.ts index 21857320..5eda84fb 100644 --- a/lib/platforms/web/router/withRouter.d.ts +++ b/lib/platforms/web/router/withRouter.d.ts @@ -1,6 +1,7 @@ +import React from 'react'; type OakComponentProperties = { path?: string; properties?: Record; }; -declare const withRouter: (Component: React.ComponentType, { path, properties }: OakComponentProperties) => any; +declare const withRouter: (Component: React.ComponentType, { path, properties }: OakComponentProperties) => React.ForwardRefExoticComponent>; export default withRouter; diff --git a/lib/types/Page.d.ts b/lib/types/Page.d.ts index 21b8822a..d5a8f808 100644 --- a/lib/types/Page.d.ts +++ b/lib/types/Page.d.ts @@ -222,6 +222,7 @@ export type OakListComponentMethods void; removeItems: (ids: string[], path?: string) => void; updateItem: (data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action'], path?: string) => void; + updateItems: (data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action'], path?: string) => void; recoverItem: (id: string, path?: string) => void; recoverItems: (ids: string[], path?: string) => void; resetItem: (id: string, path?: string) => void; @@ -260,7 +261,7 @@ type OakListComoponetData, FrontCxt extends SyncContext, AD extends Record>>, FD extends Record> = (options: OakComponentOption) => (props: ReactComponentProps) => React.ReactElement; export type WebComponentCommonMethodNames = 'setNotification' | 'setMessage' | 'navigateTo' | 'navigateBack' | 'redirectTo' | 'clean' | 't' | 'execute' | 'refresh' | 'aggregate' | 'checkOperation' | 'isDirty'; -export type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'addNamedFilter' | 'removeNamedFilter' | 'removeNamedFilterByName' | 'setNamedSorters' | 'addNamedSorter' | 'removeNamedSorter' | 'removeNamedSorterByName' | 'setPageSize' | 'setCurrentPage' | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'resetItem' | 'recoverItem' | 'recoverItems'; +export type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'addNamedFilter' | 'removeNamedFilter' | 'removeNamedFilterByName' | 'setNamedSorters' | 'addNamedSorter' | 'removeNamedSorter' | 'removeNamedSorterByName' | 'setPageSize' | 'setCurrentPage' | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'updateItems' | 'resetItem' | 'recoverItem' | 'recoverItems'; export type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation' | 'getId' | 'setId'; export type WebComponentProps = { methods: TMethod & OakCommonComponentMethods & OakListComponentMethods & OakSingleComponentMethods; diff --git a/package.json b/package.json index 16daca34..8e299258 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "weapp.socket.io": "^2.2.1" }, "peerDependencies": { - "@ant-design/icons": ">=5.2.6", + "@ant-design/icons": ">=5.3.4", "antd": ">=5.13.0", "antd-mobile": ">=5.33.0", "antd-mobile-icons": ">=0.3.0", @@ -47,7 +47,7 @@ "react-router-dom": ">=6.3.0" }, "devDependencies": { - "@ant-design/icons": "5.2.6", + "@ant-design/icons": "^5.3.4", "@babel/cli": "^7.12.13", "@babel/core": "^7.12.13", "@babel/plugin-proposal-class-properties": "^7.12.13", diff --git a/src/page.mp.ts b/src/page.mp.ts index 8d32c808..88ca0e98 100644 --- a/src/page.mp.ts +++ b/src/page.mp.ts @@ -598,6 +598,17 @@ const oakBehavior = Behavior< action ); }, + updateItems(data, ids, action, path) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + return this.features.runningTree.updateItems( + path2, + data, + ids, + action + ); + }, removeItem(id, path) { const path2 = path ? `${this.state.oakFullpath}.${path}` diff --git a/src/page.react.tsx b/src/page.react.tsx index d4098053..79fccf9c 100644 --- a/src/page.react.tsx +++ b/src/page.react.tsx @@ -227,6 +227,23 @@ abstract class OakComponentBase< ); } + updateItems( + data: ED[T]['Update']['data'], + ids: string[], + action?: ED[T]['Action'], + path?: string + ) { + const path2 = path + ? `${this.state.oakFullpath}.${path}` + : this.state.oakFullpath; + this.features.runningTree.updateItems( + path2, + data, + ids, + action + ); + } + recoverItem(id: string, path?: string) { const path2 = path ? `${this.state.oakFullpath}.${path}` @@ -777,6 +794,9 @@ export function createComponent< updateItem: (data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action'], path?: string) => { return this.updateItem(data, id, action, path); }, + updateItems: (data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action'], path?: string) => { + return this.updateItems(data, ids, action, path); + }, setFilters: (filters: NamedFilterItem[], path?: string) => { return this.setFilters(filters, path); }, diff --git a/src/types/Page.ts b/src/types/Page.ts index 85003cac..9d28721e 100644 --- a/src/types/Page.ts +++ b/src/types/Page.ts @@ -445,6 +445,7 @@ export type OakListComponentMethods void; removeItems: (ids: string[], path?: string) => void; updateItem: (data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action'], path?: string) => void; + updateItems: (data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action'], path?: string) => void; recoverItem: (id: string, path?: string) => void; recoverItems: (ids: string[], path?: string) => void; resetItem: (id: string, path?: string) => void; @@ -529,7 +530,7 @@ export type WebComponentCommonMethodNames = 'setNotification' | 'setMessage' | ' // 暴露给list组件的方法 export type WebComponentListMethodNames = 'loadMore' | 'setFilters' | 'addNamedFilter' | 'removeNamedFilter' | 'removeNamedFilterByName' | 'setNamedSorters' | 'addNamedSorter' | 'removeNamedSorter' | 'removeNamedSorterByName' | 'setPageSize' | 'setCurrentPage' - | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'resetItem' | 'recoverItem' | 'recoverItems'; + | 'addItem' | 'addItems' | 'removeItem' | 'removeItems' | 'updateItem' | 'updateItems' | 'resetItem' | 'recoverItem' | 'recoverItems'; // 暴露给single组件的方法 export type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation' | 'getId' | 'setId';