分页组件total显示修正

This commit is contained in:
lxy 2025-06-13 17:49:37 +08:00
parent e686d60bb4
commit b4b62b85a4
104 changed files with 306 additions and 422 deletions

View File

@ -8,5 +8,5 @@ type TransformAspectDict<T extends AspectDict<ED, BCT>, ED extends BaseEntityDic
[K in keyof T]: T[K] extends (params: infer P, context: BCT) => infer R ? R extends Promise<unknown> ? (params: P, callback?: (result: R, opRecords?: OpRecord<ED>[]) => void, dontPublish?: true, ignoreContext?: true) => R : never : never;
};
export type AspectDictTrans<ED extends BaseEntityDict, AD extends AspectDict<ED, BCT>, BCT extends AsyncContext<ED>> = TransformAspectDict<AD & CommonAspectDict<ED>, ED, BCT>;
export declare const createService: <ED extends BaseEntityDict, AD extends AspectDict<ED, any>>(cache: import("../features/cache").Cache<ED>) => TransformAspectDict<AD & CommonAspectDict<ED>, ED, any>;
export declare const createService: <ED extends BaseEntityDict, AD extends AspectDict<ED, any>>(cache: BasicFeatures<ED>["cache"]) => AspectDictTrans<ED, AD, any>;
export {};

View File

@ -1,18 +1,10 @@
/// <reference types="react" />
import { ED, OakExtraActionProps } from '../../types/AbstractComponent';
import { ActionDef } from '../../types/Page';
declare const _default: (props: import("../../types/Page").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
entity: string | number;
entity: keyof ED;
extraActions: OakExtraActionProps[];
actions: ActionDef<ED, string | number>[];
cascadeActions: {
[x: string]: ActionDef<ED, string | number>[] | undefined;
id?: ActionDef<ED, string | number>[] | undefined;
$$seq$$?: ActionDef<ED, string | number>[] | undefined;
$$createAt$$?: ActionDef<ED, string | number>[] | undefined;
$$updateAt$$?: ActionDef<ED, string | number>[] | undefined;
$$deleteAt$$?: ActionDef<ED, string | number>[] | undefined;
};
actions: ActionDef<ED, keyof ED>[];
cascadeActions: { [K in keyof ED[keyof ED]["Schema"]]?: ActionDef<ED, keyof ED>[]; };
onAction: Function;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,10 +1,10 @@
/// <reference types="react" />
import { ED } from "../../types/AbstractComponent";
import { Item } from './types';
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
entity: string | number;
entity: keyof ED;
items: Item[];
mode: "default" | "cell" | "table-cell";
column: number;
fixed: boolean;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ButtonProps } from 'antd';
export type Item = {
icon?: string | React.ReactNode;

View File

@ -1,10 +1,10 @@
/// <reference types="react" />
import { ED } from "../../types/AbstractComponent";
import { IMode, Item } from "./type";
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
entity: string | number;
entity: keyof ED;
items: Item[];
rows: number;
column: number;
mode: IMode;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { ButtonProps } from 'antd';
export type Item = {
icon?: string;

View File

@ -1,11 +1,10 @@
/// <reference types="react" />
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, boolean, {
value: (string | number)[];
option: {
value: Array<string | number>;
option: Array<{
label: string;
value: string | number;
}[];
}>;
onSelect: (v: Array<string | number>) => void;
disabled: boolean;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,2 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -2,12 +2,12 @@ import { ED, OakAbsAttrDef } from '../../types/AbstractComponent';
import { ReactComponentProps } from '../../types/Page';
import { Breakpoint } from 'antd';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
column?: number | Record<Breakpoint, number> | undefined;
column?: number | Record<Breakpoint, number>;
entity: T2;
attributes: OakAbsAttrDef[];
data: Partial<ED2[T2]["Schema"]>;
title?: string | undefined;
bordered?: boolean | undefined;
layout?: "horizontal" | "vertical" | undefined;
title?: string;
bordered?: boolean;
layout?: "horizontal" | "vertical";
}>) => React.ReactElement;
export default _default;

View File

@ -1,5 +1,4 @@
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
onClicked: (entity: string) => void;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -3,8 +3,8 @@ import { ReactComponentProps } from '../../types/Page';
import { ECode } from '../../types/ErrorPage';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
code: ECode;
title?: string | undefined;
desc?: string | undefined;
title?: string;
desc?: string;
children?: React.ReactNode;
icon?: React.ReactNode;
content?: React.ReactNode;

View File

@ -1,8 +1,7 @@
/// <reference types="react" />
import { ED } from '../../types/AbstractComponent';
import { ColumnProps } from '../../types/Filter';
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
entity: string | number;
column: ColumnProps<ED, string | number>;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
entity: keyof ED;
column: ColumnProps<ED, keyof ED>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,9 +1,8 @@
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
onActionClick: (action: string) => void;
actions: string[];
actionDescriptions: any;
iconSize: string;
rowNum: number;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,2 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,2 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "i18n", true, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "i18n", true, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,2 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "i18n", false, WechatMiniprogram.Component.DataOption>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "i18n", false, WechatMiniprogram.Component.DataOption>) => React.ReactElement;
export default _default;

View File

@ -1,7 +1,6 @@
/// <reference types="react" />
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
name: string;
size: number;
color: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
color: "primary" | "success" | "error" | "waring" | "info" | string;
}>) => React.ReactElement;
export default _default;

View File

@ -10,18 +10,13 @@ declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactCompo
data: RowWithActions<ED2, T2>[];
loading: boolean;
tablePagination?: React.ReactNode | false;
rowSelection?: import("antd/es/table/interface").TableRowSelection<RowWithActions<ED2, T2>> | 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;
rowSelection?: TableProps<RowWithActions<ED2, T2>>["rowSelection"];
hideHeader?: boolean;
disableSerialNumber?: boolean;
size?: "large" | "middle" | "small";
scroll?: TableProps<RowWithActions<ED2, T2>>["scroll"];
empty?: React.ReactNode;
opWidth?: number | undefined;
ellipsis?: boolean | undefined;
opWidth?: number;
ellipsis?: boolean;
}>) => React.ReactElement;
export default _default;

View File

@ -2,7 +2,7 @@ import { ED, OakAbsDerivedAttrDef } from '../../../types/AbstractComponent';
import { ReactComponentProps } from '../../../types/Page';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
value: string | string[];
type: OakAbsDerivedAttrDef['type'];
type: OakAbsDerivedAttrDef["type"];
color: string;
linkUrl: string;
}>) => React.ReactElement;

View File

@ -1,5 +1,4 @@
/// <reference types="react" />
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
key: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,21 +1,20 @@
/// <reference types="react" />
import { ReactComponentProps } from '../../types/Page';
import { ED } from '../../types/AbstractComponent';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
style?: import("react").CSSProperties | undefined;
className?: string | undefined;
style?: React.CSSProperties;
className?: string;
title?: React.ReactNode;
showBack?: boolean | undefined;
onBack?: (() => 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;

View File

@ -1,23 +1,22 @@
/// <reference types="react" />
import { ReactComponentProps } from '../../types/Page';
import { ED } from '../../types/AbstractComponent';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
style?: import("react").CSSProperties | undefined;
className?: string | undefined;
showHeader?: boolean | undefined;
showBack?: boolean | undefined;
onBack?: (() => 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;

View File

@ -1,13 +1,12 @@
/// <reference types="react" />
import { ReactComponentProps } from '../../types/Page';
import { ED } from '../../types/AbstractComponent';
declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactComponentProps<ED2, T2, false, {
entity: T2;
style?: import("react").CSSProperties | undefined;
className?: string | undefined;
showQuickJumper?: boolean | undefined;
size?: "small" | "default" | undefined;
showSizeChanger?: boolean | undefined;
showTotal?: ((total: number, range: [number, number]) => 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;

View File

@ -25,11 +25,11 @@ export default OakComponent({
}
}
if (prev.oakPagination?.currentPage !== next.oakPagination?.currentPage) {
const { pageSize, currentPage, more, getTotal } = next.oakPagination || {};
const { pageSize, currentPage, more, } = next.oakPagination || {};
const { newTotal } = this.state;
let newTotal3 = newTotal || newTotal2;
if (newTotal3 && pageSize) {
if (Math.ceil(newTotal3 / pageSize) === currentPage && more && newTotal3 >= getTotal) {
if (Math.ceil(newTotal3 / pageSize) === currentPage && more) {
this.setState({ newTotal: newTotal3 + pageSize });
}
}

View File

@ -19,11 +19,7 @@ MiddleSelect.Option = Select.Option;
export default function Render(props) {
const { style, className, oakPagination, oakFullpath, newTotal, showQuickJumper, showSizeChanger, size, showTotal, showTitle, } = props.data;
const { t, setPageSize, setCurrentPage } = props.methods;
const { pageSize, total, currentPage, more, count, getTotal } = oakPagination || {};
const [hasmore, setHasmore] = useState(more);
useEffect(() => {
setHasmore(more && newTotal >= getTotal);
}, [more, newTotal, getTotal]);
const { pageSize, total, currentPage, more, count, } = oakPagination || {};
const paginationRef = useRef(null);
const [internalInputVal, setInternalInputVal] = useState(currentPage);
useEffect(() => {
@ -90,8 +86,8 @@ export default function Render(props) {
currentPage * pageSize > newTotal ? newTotal : currentPage * pageSize,
])}
</li>) : (<li className={Style[`${prefixCls}-total-text`]}>
{/* 共 {newTotal >= total! ? (hasmore ? newTotal + '+' : (currentPage! - 1) * pageSize! + count!) : total} 条 */}
{newTotal + (hasmore ? '+' : '')}
{/* 共 {newTotal >= total! ? (more ? newTotal + '+' : (currentPage! - 1) * pageSize! + count!) : total} 条 */}
{newTotal > total ? (currentPage - 1) * pageSize + count + (more ? '+' : '') : total}
</li>);
//上一页
function renderPrev(prevPage) {
@ -179,11 +175,13 @@ export default function Render(props) {
}
}
function changePageSize(size) {
const newCurrent = calculatePage(size, pageSize, newTotal);
const nextCurrent = currentPage > newCurrent && newCurrent !== 0 ? newCurrent : currentPage;
// const newCurrent = calculatePage(size, pageSize!, newTotal);
// const nextCurrent =
// currentPage! > newCurrent && newCurrent !== 0 ? newCurrent : currentPage!;
setPageSize(size);
setInternalInputVal(nextCurrent);
setCurrentPage(nextCurrent);
//pageSize 改变时自动回到第一页
// setInternalInputVal(nextCurrent);
// setCurrentPage(nextCurrent);
}
const shouldDisplayQuickJumper = newTotal > pageSize ? showQuickJumper : false;
const goButton = showQuickJumper && showQuickJumper.goButton;

View File

@ -1,23 +1,15 @@
/// <reference types="react" />
import { ED } from '../../types/AbstractComponent';
import { RowWithActions } from '../..';
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
entity: string | number;
entity: keyof ED;
multiple: boolean;
onSelect: (value: [{
id: string;
}]) => void;
title: (row: RowWithActions<ED, keyof ED>) => string;
titleLabel: string;
filter: {
[K: string]: any;
};
sorter: {
$attr: {
[K: string]: any;
};
$direction?: "asc" | "desc" | undefined;
}[];
filter: ED[keyof ED]["Filter"];
sorter: ED[keyof ED]["Sorter"];
projection: {};
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,11 +1,10 @@
/// <reference types="react" />
import { ED, OakAbsRefAttrPickerRender } from '../../types/AbstractComponent';
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
placeholder: string | undefined;
multiple: boolean;
entityId: string;
entityIds: string[];
pickerRender: OakAbsRefAttrPickerRender<ED, string | number>;
pickerRender: OakAbsRefAttrPickerRender<ED, keyof ED>;
onChange: (value: string[]) => void;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
pathId: string;
relations: {
@ -6,5 +5,5 @@ declare const _default: (props: import("../../..").ReactComponentProps<import("o
name: string;
}[];
actions: string[];
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,5 +1,4 @@
/// <reference types="react" />
declare const _default: (props: import("../../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "path", false, {
actions: string[];
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,6 +1,5 @@
/// <reference types="react" />
import { EntityDict } from 'oak-domain/lib/base-app-domain';
declare const _default: (props: import("../../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & EntityDict, "path", true, {
entity: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,7 +1,6 @@
/// <reference types="react" />
import { EntityDict } from 'oak-domain/lib/base-app-domain';
declare const _default: (props: import("../../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & EntityDict, "path", false, {
onConfirmed: () => void;
entity: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relationAuth", true, {
pathId: string;
sourceRelations: {
@ -9,5 +8,5 @@ declare const _default: (props: import("../../..").ReactComponentProps<import("o
id: string;
name: string;
}[];
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,7 +1,7 @@
/// <reference types="react" />
import { ED } from '../../types/AbstractComponent';
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
entity: string | number;
entity: keyof ED;
attributes: string[];
placeholder: string;
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
}>) => React.ReactElement;
export default _default;

View File

@ -1,11 +1,11 @@
import { ED, OakAbsAttrUpsertDef } from '../../types/AbstractComponent';
import { ReactComponentProps } from '../../types/Page';
declare const _default: <ED2 extends ED, T2 extends keyof ED2, T3 extends string | number = string | number>(props: ReactComponentProps<ED2, T2, false, {
declare const _default: <ED2 extends ED, T2 extends keyof ED2, T3 extends keyof ED = keyof ED>(props: ReactComponentProps<ED2, T2, false, {
helps: Record<string, string>;
entity: T2;
attributes: OakAbsAttrUpsertDef<ED2, T2, T3>[];
data: ED2[T2]["Schema"];
layout: 'horizontal' | 'vertical';
mode: 'default' | 'card';
layout: "horizontal" | "vertical";
mode: "default" | "card";
}>) => React.ReactElement;
export default _default;

View File

@ -10,7 +10,7 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
eventOperationMap: Record<string, string[]>;
getNavigatorState(): {
pathname: string;
oakFrom?: string | undefined;
oakFrom?: string;
} | undefined;
getSubscriberId(): string | undefined;
getBriefEnvironment(): BriefEnv | undefined;

View File

@ -43,7 +43,7 @@ export default abstract class Console<ED extends EntityDict & BaseEntityDict, OM
setContext(entity: keyof ED, entityId: string): void;
getContext(): ConsoleContext<ED> | undefined;
getAvailMenus(): (OMenu & {
sourceEntity?: keyof ED | undefined;
sourceEntity?: keyof ED;
available: boolean | null;
})[];
/**

View File

@ -1,4 +1,3 @@
/// <reference types="node" />
import { Feature } from '../types/Feature';
export declare class Navigator extends Feature {
namespace: string;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { OakNavigateToParameters } from '../types/Page';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { EntityDict } from 'oak-domain/lib/types';

View File

@ -15,10 +15,10 @@ export declare class Navigator extends CommonNavigator {
namespace: string;
url: string;
state: unknown;
key: string;
pathname: string;
search: string;
hash: string;
key: import("history").Key;
pathname: import("history").Pathname;
search: import("history").Search;
hash: import("history").Hash;
};
getState(): {
pathname: string;

View File

@ -119,20 +119,20 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
removeChild(path: string): void;
getChild(path: string): SingleNode<ED, T>;
getNamedFilters(): (NamedFilterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedFilterByName(name: string): (NamedFilterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean): void;
addNamedFilter(filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilter(filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilterByName(name: string, refresh?: boolean): void;
getNamedSorters(): (NamedSorterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedSorterByName(name: string): (NamedSorterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedSorters(sorters: NamedSorterItem<ED, T>[], refresh?: boolean): void;
addNamedSorter(sorter: NamedSorterItem<ED, T>, refresh?: boolean): void;
@ -329,20 +329,20 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict> extends
setPageSize<T extends keyof ED>(path: string, pageSize: number): void;
setCurrentPage<T extends keyof ED>(path: string, currentPage: number): void;
getNamedFilters<T extends keyof ED>(path: string): (NamedFilterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedFilterByName<T extends keyof ED>(path: string, name: string): (NamedFilterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedFilters<T extends keyof ED>(path: string, filters: NamedFilterItem<ED, T>[], refresh?: boolean): void;
addNamedFilter<T extends keyof ED>(path: string, filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilter<T extends keyof ED>(path: string, filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilterByName<T extends keyof ED>(path: string, name: string, refresh?: boolean): void;
getNamedSorters<T extends keyof ED>(path: string): (NamedSorterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedSorterByName<T extends keyof ED>(path: string, name: string): (NamedSorterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedSorters<T extends keyof ED>(path: string, sorters: NamedSorterItem<ED, T>[], refresh?: boolean): void;
addNamedSorter<T extends keyof ED>(path: string, sorter: NamedSorterItem<ED, T>, refresh?: boolean): void;

View File

@ -96,9 +96,6 @@ export function onPathSet(option, isPage) {
pagination2 = pagination;
}
}
if (pagination2) {
pagination2.getTotal = getTotal2;
}
features.runningTree.createNode({
path: oakPath2,
entity: entity2,
@ -433,11 +430,9 @@ export function reRender(option, extra) {
try {
this.features.runningTree.redoBranchModis(this.state.oakFullpath);
const origin = oakDirty && this.features.runningTree.getFreshValue(this.state.oakFullpath);
//@ts-ignore
const originLegalActions = origin ? checkActionsAndCascadeEntities.call(this, origin, option) : undefined;
this.features.runningTree.redoBranchOperations(this.state.oakFullpath);
const rows = this.features.runningTree.getFreshValue(this.state.oakFullpath);
//@ts-ignore
const oakLegalActions = rows && checkActionsAndCascadeEntities.call(this, rows, option);
rollback();
rollback = () => undefined;

1
es/page.mp.d.ts vendored
View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { Aspect, EntityDict } from 'oak-domain/lib/types';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { BasicFeatures } from './features';

106
es/page.react.d.ts vendored
View File

@ -25,84 +25,84 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
componentDidUpdate(prevProps: Record<string, any>, prevState: Record<string, any>): Promise<void>;
render(): React.ReactNode;
oakFullpath: string;
featuresSubscribed: {
featuresSubscribed: Array<{
name: string;
callback: (args?: any) => void;
unsubHandler?: (() => void) | undefined;
}[];
unsubHandler?: () => void;
}>;
addFeatureSub(name: string, callback: (args?: any) => void): void;
removeFeatureSub(name: string, callback: (args?: any) => void): void;
unsubscribeAll(): void;
subscribeAll(): void;
save(key: string, item: any): Promise<void>;
load(key: string): Promise<any>;
clear(key?: string | undefined): Promise<void>;
clear(key?: string): Promise<void>;
setNotification(data: NotificationProps): void;
consumeNotification(): NotificationProps | undefined;
setMessage(data: MessageProps): Promise<void>;
consumeMessage(): MessageProps | undefined;
reRender(extra?: Record<string, any> | undefined): void;
reRender(extra?: Record<string, any>): void;
navigateTo<T2 extends keyof ED>(options: {
url: string;
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any> | undefined, disableNamespace?: boolean | undefined): Promise<void>;
navigateBack(delta?: number | undefined): Promise<void>;
redirectTo<T2_1 extends keyof ED>(options: {
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean): Promise<void>;
navigateBack(delta?: number): Promise<void>;
redirectTo<T2 extends keyof ED>(options: {
url: string;
} & OakNavigateToParameters<ED, T2_1>, state?: Record<string, any> | undefined, disableNamespace?: boolean | undefined): Promise<void>;
addItem<T extends keyof ED>(data: Omit<ED[T]["CreateSingle"]["data"], "id"> & {
id?: string | undefined;
}, path?: string | undefined): string;
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean): Promise<void>;
addItem<T_1 extends keyof ED>(data: Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
id?: string;
}, path?: string): string;
addItems<T_1 extends keyof ED>(data: (Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
id?: string | undefined;
})[], path?: string | undefined): string[];
removeItem(id: string, path?: string | undefined): void;
removeItems(ids: string[], path?: string | undefined): void;
updateItem<T_2 extends keyof ED>(data: ED[T_2]["Update"]["data"], id: string, action?: ED[T_2]["Action"] | undefined, path?: string | undefined): void;
updateItems<T_3 extends keyof ED>(data: ED[T_3]["Update"]["data"], ids: string[], action?: ED[T_3]["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<T_4 extends keyof ED>(data: ED[T_4]["Update"]["data"], action?: ED[T_4]["Action"] | undefined, path?: string | undefined): void;
create<T_5 extends keyof ED>(data: Omit<ED[T_5]["CreateSingle"]["data"], "id">, 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;
id?: string;
})[], path?: string): string[];
removeItem(id: string, path?: string): void;
removeItems(ids: string[], path?: string): void;
updateItem<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], id: string, action?: ED[T_1]["Action"] | undefined, path?: string): void;
updateItems<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], ids: string[], action?: ED[T_1]["Action"] | undefined, path?: string): void;
recoverItem(id: string, path?: string): void;
recoverItems(ids: string[], path?: string): void;
resetItem(id: string, path?: string): void;
update<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], action?: ED[T_1]["Action"] | undefined, path?: string): void;
create<T_1 extends keyof ED>(data: Omit<ED[T_1]["CreateSingle"]["data"], "id">, path?: string): void;
remove(path?: string): void;
isCreation(path?: string): boolean;
clean(lsn?: number, dontPublish?: true, path?: string): void;
savePoint(): number;
t(key: string, params?: object | undefined): string;
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps | undefined, path?: string | undefined, opers?: {
t(key: string, params?: object): string;
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps, path?: string, opers?: {
entity: T;
operation: ED[T]["Operation"];
}[] | undefined): Promise<void>;
isDirty(path?: string | undefined): boolean;
getFreshValue(path?: string | undefined): Partial<import("oak-domain/lib/types").GeneralEntityShape> | Partial<import("oak-domain/lib/types").GeneralEntityShape>[] | undefined;
select<T2_2 extends keyof ED>(entity: T2_2, selection: ED[T2_2]["Selection"]): Partial<import("oak-domain/lib/types").GeneralEntityShape>[];
checkOperation<T2_3 extends keyof ED>(entity: T2_3, operation: Omit<ED[T2_3]["Operation"], "id">, checkerTypes?: CheckerType[] | undefined, cacheInsensative?: true | undefined): boolean | { [A in ED[T2_3]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[T2_3]["Action"]];
tryExecute(path?: string | undefined, action?: string | undefined): boolean | { [A_1 in ED[keyof ED]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[keyof ED]["Action"]];
getOperations<T_6 extends keyof ED>(path?: string | undefined): {
isDirty(path?: string): boolean;
getFreshValue(path?: string): Partial<import("oak-domain/lib/types").GeneralEntityShape> | Partial<import("oak-domain/lib/types").GeneralEntityShape>[] | undefined;
select<T2 extends keyof ED>(entity: T2, selection: ED[T2]["Selection"]): Partial<import("oak-domain/lib/types").GeneralEntityShape>[];
checkOperation<T2 extends keyof ED>(entity: T2, operation: Omit<ED[T2]["Operation"], "id">, checkerTypes?: CheckerType[], cacheInsensative?: true): boolean | { [A in ED[T2]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[T2]["Action"]];
tryExecute(path?: string, action?: string): boolean | { [A in ED[keyof ED]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[keyof ED]["Action"]];
getOperations<T_1 extends keyof ED>(path?: string): {
entity: keyof ED;
operation: ED[keyof ED]["Operation"];
}[] | undefined;
refresh(pageNumber?: number | undefined, resetTotal?: boolean | undefined): Promise<void>;
refresh(pageNumber?: number, resetTotal?: boolean): Promise<void>;
loadMore(): Promise<void>;
setId(id: string, path?: string | undefined): void;
setId(id: string, path?: string): void;
unsetId(): void;
getId(path?: string | undefined): string | undefined;
setFilters(filters: NamedFilterItem<ED, T>[], path?: string | undefined): void;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean | undefined, path?: string | undefined): void;
getFilters(path?: string | undefined): any[] | undefined;
getFilterByName(name: string, path?: string | undefined): any;
addNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedFilterByName(name: string, refresh?: boolean | undefined, path?: string | undefined): void;
setNamedSorters(namedSorters: NamedSorterItem<ED, T>[], refresh?: boolean | undefined, path?: string | undefined): void;
getSorters(path?: string | undefined): ED[T]["Sorter"][] | undefined;
getSorterByName(name: string, path?: string | undefined): any;
addNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedSorterByName(name: string, refresh?: boolean | undefined, path?: string | undefined): void;
getPagination(path?: string | undefined): import(".").Pagination | undefined;
setPageSize(pageSize: number, path?: string | undefined): void;
setCurrentPage(currentPage: number, path?: string | undefined): void;
getId(path?: string): string | undefined;
setFilters(filters: NamedFilterItem<ED, T>[], path?: string): void;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean, path?: string): void;
getFilters(path?: string): any[] | undefined;
getFilterByName(name: string, path?: string): any;
addNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedFilterByName(name: string, refresh?: boolean, path?: string): void;
setNamedSorters(namedSorters: NamedSorterItem<ED, T>[], refresh?: boolean, path?: string): void;
getSorters(path?: string): ED[T]["Sorter"][] | undefined;
getSorterByName(name: string, path?: string): any;
addNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedSorterByName(name: string, refresh?: boolean, path?: string): void;
getPagination(path?: string): import(".").Pagination | undefined;
setPageSize(pageSize: number, path?: string): void;
setCurrentPage(currentPage: number, path?: string): void;
subDataEvents(events: string[], callback: (event: string, opRecords: OpRecord<ED>[]) => void): Promise<() => void>;
context: unknown;
setState<K extends keyof TData | keyof FormedData | keyof import("./types/Page").OakComponentData<ED, T>>(state: ComponentData<ED, T, FormedData, TData> | ((prevState: Readonly<ComponentData<ED, T, FormedData, TData>>, props: Readonly<ComponentProps<ED, T, TProperty>>) => ComponentData<ED, T, FormedData, TData> | Pick<ComponentData<ED, T, FormedData, TData>, K> | null) | Pick<ComponentData<ED, T, FormedData, TData>, K> | null, callback?: (() => void) | undefined): void;

View File

@ -1,9 +1,8 @@
/// <reference types="react" />
import { Breakpoints } from './context';
export interface ResponsiveProviderProps {
children?: React.ReactNode;
breakpoints?: Breakpoints;
}
export declare function ResponsiveProvider(props: ResponsiveProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<{
breakpoints?: Breakpoints | undefined;
breakpoints?: Breakpoints;
}>>;

View File

@ -17,5 +17,5 @@ export declare const keys: Keys;
export declare const values: Values;
export declare const defaultBreakpoints: Breakpoints;
export declare const ResponsiveContext: React.Context<{
breakpoints?: Breakpoints | undefined;
breakpoints?: Breakpoints;
}>;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { BrowserRouterProps } from 'react-router-dom';
export interface IBrowserRouterProps extends BrowserRouterProps {
namespace: string;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from 'oak-domain/lib/types/Entity';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { DataType, DataTypeParams } from 'oak-domain/lib/types/schema/DataTypes';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Dayjs } from 'dayjs';
import { OakAbsRefAttrPickerDef, ColSpanType, ED } from './AbstractComponent';
export type ViewType = 'Input' | 'Select' | 'DatePicker' | 'DatePicker.RangePicker' | 'RefAttr';

1
es/types/Map.d.ts vendored
View File

@ -1,4 +1,3 @@
/// <reference types="react" />
export type MapComponent = (props: {
id?: string;
center?: [number, number];

2
es/types/Page.d.ts vendored
View File

@ -1,5 +1,3 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="wechat-miniprogram" />
import { Aspect, EntityDict, CheckerType, AggregationResult, OpRecord, OakUserException } from "oak-domain/lib/types";
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { Feature } from './Feature';

View File

@ -5,5 +5,4 @@ export interface Pagination {
more?: boolean;
total?: number;
randomRange?: number;
getTotal?: number;
}

1
es/types/Wx.d.ts vendored
View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
export type PromisifyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
export type PromisifyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { PromisifyOption } from '../../types/Wx';
export declare class Bluetooth {
private serverDict;

View File

@ -8,5 +8,5 @@ type TransformAspectDict<T extends AspectDict<ED, BCT>, ED extends BaseEntityDic
[K in keyof T]: T[K] extends (params: infer P, context: BCT) => infer R ? R extends Promise<unknown> ? (params: P, callback?: (result: R, opRecords?: OpRecord<ED>[]) => void, dontPublish?: true, ignoreContext?: true) => R : never : never;
};
export type AspectDictTrans<ED extends BaseEntityDict, AD extends AspectDict<ED, BCT>, BCT extends AsyncContext<ED>> = TransformAspectDict<AD & CommonAspectDict<ED>, ED, BCT>;
export declare const createService: <ED extends BaseEntityDict, AD extends AspectDict<ED, any>>(cache: import("../features/cache").Cache<ED>) => TransformAspectDict<AD & CommonAspectDict<ED>, ED, any>;
export declare const createService: <ED extends BaseEntityDict, AD extends AspectDict<ED, any>>(cache: BasicFeatures<ED>["cache"]) => AspectDictTrans<ED, AD, any>;
export {};

View File

@ -10,7 +10,7 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
eventOperationMap: Record<string, string[]>;
getNavigatorState(): {
pathname: string;
oakFrom?: string | undefined;
oakFrom?: string;
} | undefined;
getSubscriberId(): string | undefined;
getBriefEnvironment(): BriefEnv | undefined;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDebugStore = void 0;
exports.createDebugStore = createDebugStore;
const node_schedule_1 = require("node-schedule");
const constant_1 = require("../constant/constant");
const DebugStore_1 = require("./DebugStore");
@ -223,4 +223,3 @@ function createDebugStore(storageSchema, contextBuilder, triggers, checkers, wat
}
return store;
}
exports.createDebugStore = createDebugStore;

View File

@ -43,7 +43,7 @@ export default abstract class Console<ED extends EntityDict & BaseEntityDict, OM
setContext(entity: keyof ED, entityId: string): void;
getContext(): ConsoleContext<ED> | undefined;
getAvailMenus(): (OMenu & {
sourceEntity?: keyof ED | undefined;
sourceEntity?: keyof ED;
available: boolean | null;
})[];
/**

View File

@ -1,6 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeStep1 = exports.initializeStep2 = void 0;
exports.initializeStep2 = initializeStep2;
exports.initializeStep1 = initializeStep1;
const tslib_1 = require("tslib");
const cache_1 = require("./cache");
const location_1 = require("./location");
@ -43,7 +44,6 @@ function initializeStep2(features, connector, storageSchema, frontendContextBuil
subscriber,
};
}
exports.initializeStep2 = initializeStep2;
function initializeStep1() {
const location = new location_1.Location();
const environment = new environment_1.Environment();
@ -60,4 +60,3 @@ function initializeStep1() {
navigator,
};
}
exports.initializeStep1 = initializeStep1;

View File

@ -1,4 +1,3 @@
/// <reference types="node" />
import { Feature } from '../types/Feature';
export declare class Navigator extends Feature {
namespace: string;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { OakNavigateToParameters } from '../types/Page';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { EntityDict } from 'oak-domain/lib/types';

View File

@ -15,10 +15,10 @@ export declare class Navigator extends CommonNavigator {
namespace: string;
url: string;
state: unknown;
key: string;
pathname: string;
search: string;
hash: string;
key: import("history").Key;
pathname: import("history").Pathname;
search: import("history").Search;
hash: import("history").Hash;
};
getState(): {
pathname: string;

View File

@ -119,20 +119,20 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
removeChild(path: string): void;
getChild(path: string): SingleNode<ED, T>;
getNamedFilters(): (NamedFilterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedFilterByName(name: string): (NamedFilterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean): void;
addNamedFilter(filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilter(filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilterByName(name: string, refresh?: boolean): void;
getNamedSorters(): (NamedSorterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedSorterByName(name: string): (NamedSorterItem<ED, T> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedSorters(sorters: NamedSorterItem<ED, T>[], refresh?: boolean): void;
addNamedSorter(sorter: NamedSorterItem<ED, T>, refresh?: boolean): void;
@ -329,20 +329,20 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict> extends
setPageSize<T extends keyof ED>(path: string, pageSize: number): void;
setCurrentPage<T extends keyof ED>(path: string, currentPage: number): void;
getNamedFilters<T extends keyof ED>(path: string): (NamedFilterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedFilterByName<T extends keyof ED>(path: string, name: string): (NamedFilterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedFilters<T extends keyof ED>(path: string, filters: NamedFilterItem<ED, T>[], refresh?: boolean): void;
addNamedFilter<T extends keyof ED>(path: string, filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilter<T extends keyof ED>(path: string, filter: NamedFilterItem<ED, T>, refresh?: boolean): void;
removeNamedFilterByName<T extends keyof ED>(path: string, name: string, refresh?: boolean): void;
getNamedSorters<T extends keyof ED>(path: string): (NamedSorterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
})[];
getNamedSorterByName<T extends keyof ED>(path: string, name: string): (NamedSorterItem<ED, keyof ED> & {
applied?: boolean | undefined;
applied?: boolean;
}) | undefined;
setNamedSorters<T extends keyof ED>(path: string, sorters: NamedSorterItem<ED, T>[], refresh?: boolean): void;
addNamedSorter<T extends keyof ED>(path: string, sorter: NamedSorterItem<ED, T>, refresh?: boolean): void;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialize = void 0;
exports.initialize = initialize;
const features_1 = require("./features");
const IntrinsicCheckers_1 = require("oak-domain/lib/store/IntrinsicCheckers");
/**
@ -27,4 +27,3 @@ function initialize(storageSchema, frontendContextBuilder, connector, checkers,
features,
};
}
exports.initialize = initialize;

View File

@ -1,6 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.select = exports.getFreshValue = exports.destroyNode = exports.execute = exports.loadMore = exports.refresh = exports.reRender = exports.onPathSet = void 0;
exports.onPathSet = onPathSet;
exports.reRender = reRender;
exports.refresh = refresh;
exports.loadMore = loadMore;
exports.execute = execute;
exports.destroyNode = destroyNode;
exports.getFreshValue = getFreshValue;
exports.select = select;
const assert_1 = require("oak-domain/lib/utils/assert");
const lodash_1 = require("oak-domain/lib/utils/lodash");
const relation_1 = require("oak-domain/lib/store/relation");
@ -99,9 +106,6 @@ function onPathSet(option, isPage) {
pagination2 = pagination;
}
}
if (pagination2) {
pagination2.getTotal = getTotal2;
}
features.runningTree.createNode({
path: oakPath2,
entity: entity2,
@ -146,7 +150,6 @@ function onPathSet(option, isPage) {
};
}
}
exports.onPathSet = onPathSet;
function checkActionAttrsIfNecessary(cache, entity, action, id) {
if (typeof action === 'string') {
return action;
@ -437,11 +440,9 @@ function reRender(option, extra) {
try {
this.features.runningTree.redoBranchModis(this.state.oakFullpath);
const origin = oakDirty && this.features.runningTree.getFreshValue(this.state.oakFullpath);
//@ts-ignore
const originLegalActions = origin ? checkActionsAndCascadeEntities.call(this, origin, option) : undefined;
this.features.runningTree.redoBranchOperations(this.state.oakFullpath);
const rows = this.features.runningTree.getFreshValue(this.state.oakFullpath);
//@ts-ignore
const oakLegalActions = rows && checkActionsAndCascadeEntities.call(this, rows, option);
rollback();
rollback = () => undefined;
@ -551,13 +552,11 @@ function reRender(option, extra) {
this.setState(data);
}
}
exports.reRender = reRender;
async function refresh(pageNumber, resetTotal) {
if (this.state.oakFullpath) {
await this.features.runningTree.refresh(this.state.oakFullpath, pageNumber, resetTotal);
}
}
exports.refresh = refresh;
async function loadMore() {
if (this.state.oakEntity && this.state.oakFullpath) {
try {
@ -571,7 +570,6 @@ async function loadMore() {
}
}
}
exports.loadMore = loadMore;
async function execute(action, path, messageProps, //默认true
opers) {
if (this.state.oakExecuting) {
@ -593,12 +591,10 @@ opers) {
this.setMessage(messageData);
}
}
exports.execute = execute;
function destroyNode(isPage, path) {
this.features.runningTree.destroyNode(path, isPage);
(0, lodash_1.unset)(this.state, ['oakFullpath', 'oakEntity']);
}
exports.destroyNode = destroyNode;
function getFreshValue(path) {
const rollback = this.features.runningTree.begin();
try {
@ -614,7 +610,6 @@ function getFreshValue(path) {
(0, assert_1.assert)(false);
}
}
exports.getFreshValue = getFreshValue;
function select(entity, selection) {
const rollback = this.features.runningTree.begin();
try {
@ -631,4 +626,3 @@ function select(entity, selection) {
(0, assert_1.assert)(false);
}
}
exports.select = select;

1
lib/page.mp.d.ts vendored
View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { Aspect, EntityDict } from 'oak-domain/lib/types';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { BasicFeatures } from './features';

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createComponent = void 0;
exports.createComponent = createComponent;
/// <reference path="../node_modules/@types/wechat-miniprogram/index.d.ts" />
const assert_1 = require("oak-domain/lib/utils/assert");
const types_1 = require("oak-domain/lib/types");
@ -881,4 +881,3 @@ function createComponent(option, features) {
},
});
}
exports.createComponent = createComponent;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createComponent = void 0;
exports.createComponent = createComponent;
const tslib_1 = require("tslib");
const react_native_1 = require("react-native");
const page_react_1 = require("./page.react");
@ -41,4 +41,3 @@ function createComponent(option, features) {
}
return (0, withRouter_1.default)(Component, option);
}
exports.createComponent = createComponent;

106
lib/page.react.d.ts vendored
View File

@ -25,84 +25,84 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
componentDidUpdate(prevProps: Record<string, any>, prevState: Record<string, any>): Promise<void>;
render(): React.ReactNode;
oakFullpath: string;
featuresSubscribed: {
featuresSubscribed: Array<{
name: string;
callback: (args?: any) => void;
unsubHandler?: (() => void) | undefined;
}[];
unsubHandler?: () => void;
}>;
addFeatureSub(name: string, callback: (args?: any) => void): void;
removeFeatureSub(name: string, callback: (args?: any) => void): void;
unsubscribeAll(): void;
subscribeAll(): void;
save(key: string, item: any): Promise<void>;
load(key: string): Promise<any>;
clear(key?: string | undefined): Promise<void>;
clear(key?: string): Promise<void>;
setNotification(data: NotificationProps): void;
consumeNotification(): NotificationProps | undefined;
setMessage(data: MessageProps): Promise<void>;
consumeMessage(): MessageProps | undefined;
reRender(extra?: Record<string, any> | undefined): void;
reRender(extra?: Record<string, any>): void;
navigateTo<T2 extends keyof ED>(options: {
url: string;
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any> | undefined, disableNamespace?: boolean | undefined): Promise<void>;
navigateBack(delta?: number | undefined): Promise<void>;
redirectTo<T2_1 extends keyof ED>(options: {
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean): Promise<void>;
navigateBack(delta?: number): Promise<void>;
redirectTo<T2 extends keyof ED>(options: {
url: string;
} & OakNavigateToParameters<ED, T2_1>, state?: Record<string, any> | undefined, disableNamespace?: boolean | undefined): Promise<void>;
addItem<T extends keyof ED>(data: Omit<ED[T]["CreateSingle"]["data"], "id"> & {
id?: string | undefined;
}, path?: string | undefined): string;
} & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean): Promise<void>;
addItem<T_1 extends keyof ED>(data: Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
id?: string;
}, path?: string): string;
addItems<T_1 extends keyof ED>(data: (Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
id?: string | undefined;
})[], path?: string | undefined): string[];
removeItem(id: string, path?: string | undefined): void;
removeItems(ids: string[], path?: string | undefined): void;
updateItem<T_2 extends keyof ED>(data: ED[T_2]["Update"]["data"], id: string, action?: ED[T_2]["Action"] | undefined, path?: string | undefined): void;
updateItems<T_3 extends keyof ED>(data: ED[T_3]["Update"]["data"], ids: string[], action?: ED[T_3]["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<T_4 extends keyof ED>(data: ED[T_4]["Update"]["data"], action?: ED[T_4]["Action"] | undefined, path?: string | undefined): void;
create<T_5 extends keyof ED>(data: Omit<ED[T_5]["CreateSingle"]["data"], "id">, 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;
id?: string;
})[], path?: string): string[];
removeItem(id: string, path?: string): void;
removeItems(ids: string[], path?: string): void;
updateItem<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], id: string, action?: ED[T_1]["Action"] | undefined, path?: string): void;
updateItems<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], ids: string[], action?: ED[T_1]["Action"] | undefined, path?: string): void;
recoverItem(id: string, path?: string): void;
recoverItems(ids: string[], path?: string): void;
resetItem(id: string, path?: string): void;
update<T_1 extends keyof ED>(data: ED[T_1]["Update"]["data"], action?: ED[T_1]["Action"] | undefined, path?: string): void;
create<T_1 extends keyof ED>(data: Omit<ED[T_1]["CreateSingle"]["data"], "id">, path?: string): void;
remove(path?: string): void;
isCreation(path?: string): boolean;
clean(lsn?: number, dontPublish?: true, path?: string): void;
savePoint(): number;
t(key: string, params?: object | undefined): string;
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps | undefined, path?: string | undefined, opers?: {
t(key: string, params?: object): string;
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps, path?: string, opers?: {
entity: T;
operation: ED[T]["Operation"];
}[] | undefined): Promise<void>;
isDirty(path?: string | undefined): boolean;
getFreshValue(path?: string | undefined): Partial<import("oak-domain/lib/types").GeneralEntityShape> | Partial<import("oak-domain/lib/types").GeneralEntityShape>[] | undefined;
select<T2_2 extends keyof ED>(entity: T2_2, selection: ED[T2_2]["Selection"]): Partial<import("oak-domain/lib/types").GeneralEntityShape>[];
checkOperation<T2_3 extends keyof ED>(entity: T2_3, operation: Omit<ED[T2_3]["Operation"], "id">, checkerTypes?: CheckerType[] | undefined, cacheInsensative?: true | undefined): boolean | { [A in ED[T2_3]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[T2_3]["Action"]];
tryExecute(path?: string | undefined, action?: string | undefined): boolean | { [A_1 in ED[keyof ED]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[keyof ED]["Action"]];
getOperations<T_6 extends keyof ED>(path?: string | undefined): {
isDirty(path?: string): boolean;
getFreshValue(path?: string): Partial<import("oak-domain/lib/types").GeneralEntityShape> | Partial<import("oak-domain/lib/types").GeneralEntityShape>[] | undefined;
select<T2 extends keyof ED>(entity: T2, selection: ED[T2]["Selection"]): Partial<import("oak-domain/lib/types").GeneralEntityShape>[];
checkOperation<T2 extends keyof ED>(entity: T2, operation: Omit<ED[T2]["Operation"], "id">, checkerTypes?: CheckerType[], cacheInsensative?: true): boolean | { [A in ED[T2]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[T2]["Action"]];
tryExecute(path?: string, action?: string): boolean | { [A in ED[keyof ED]["Action"]]: boolean | import("oak-domain/lib/types").OakUserException<ED>; }[ED[keyof ED]["Action"]];
getOperations<T_1 extends keyof ED>(path?: string): {
entity: keyof ED;
operation: ED[keyof ED]["Operation"];
}[] | undefined;
refresh(pageNumber?: number | undefined, resetTotal?: boolean | undefined): Promise<void>;
refresh(pageNumber?: number, resetTotal?: boolean): Promise<void>;
loadMore(): Promise<void>;
setId(id: string, path?: string | undefined): void;
setId(id: string, path?: string): void;
unsetId(): void;
getId(path?: string | undefined): string | undefined;
setFilters(filters: NamedFilterItem<ED, T>[], path?: string | undefined): void;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean | undefined, path?: string | undefined): void;
getFilters(path?: string | undefined): any[] | undefined;
getFilterByName(name: string, path?: string | undefined): any;
addNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedFilterByName(name: string, refresh?: boolean | undefined, path?: string | undefined): void;
setNamedSorters(namedSorters: NamedSorterItem<ED, T>[], refresh?: boolean | undefined, path?: string | undefined): void;
getSorters(path?: string | undefined): ED[T]["Sorter"][] | undefined;
getSorterByName(name: string, path?: string | undefined): any;
addNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean | undefined, path?: string | undefined): void;
removeNamedSorterByName(name: string, refresh?: boolean | undefined, path?: string | undefined): void;
getPagination(path?: string | undefined): import(".").Pagination | undefined;
setPageSize(pageSize: number, path?: string | undefined): void;
setCurrentPage(currentPage: number, path?: string | undefined): void;
getId(path?: string): string | undefined;
setFilters(filters: NamedFilterItem<ED, T>[], path?: string): void;
setNamedFilters(filters: NamedFilterItem<ED, T>[], refresh?: boolean, path?: string): void;
getFilters(path?: string): any[] | undefined;
getFilterByName(name: string, path?: string): any;
addNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedFilter(namedFilter: NamedFilterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedFilterByName(name: string, refresh?: boolean, path?: string): void;
setNamedSorters(namedSorters: NamedSorterItem<ED, T>[], refresh?: boolean, path?: string): void;
getSorters(path?: string): ED[T]["Sorter"][] | undefined;
getSorterByName(name: string, path?: string): any;
addNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedSorter(namedSorter: NamedSorterItem<ED, T>, refresh?: boolean, path?: string): void;
removeNamedSorterByName(name: string, refresh?: boolean, path?: string): void;
getPagination(path?: string): import(".").Pagination | undefined;
setPageSize(pageSize: number, path?: string): void;
setCurrentPage(currentPage: number, path?: string): void;
subDataEvents(events: string[], callback: (event: string, opRecords: OpRecord<ED>[]) => void): Promise<() => void>;
context: unknown;
setState<K extends keyof TData | keyof FormedData | keyof import("./types/Page").OakComponentData<ED, T>>(state: ComponentData<ED, T, FormedData, TData> | ((prevState: Readonly<ComponentData<ED, T, FormedData, TData>>, props: Readonly<ComponentProps<ED, T, TProperty>>) => ComponentData<ED, T, FormedData, TData> | Pick<ComponentData<ED, T, FormedData, TData>, K> | null) | Pick<ComponentData<ED, T, FormedData, TData>, K> | null, callback?: (() => void) | undefined): void;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createComponent = void 0;
exports.createComponent = createComponent;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const assert_1 = require("oak-domain/lib/utils/assert");
@ -751,4 +751,3 @@ function createComponent(option, features) {
;
return OakComponentWrapper;
}
exports.createComponent = createComponent;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createComponent = void 0;
exports.createComponent = createComponent;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const withRouter_1 = tslib_1.__importDefault(require("./platforms/web/router/withRouter"));
@ -105,4 +105,3 @@ function createComponent(option, features) {
}
return (0, withRouter_1.default)(Component, option);
}
exports.createComponent = createComponent;

View File

@ -1,5 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = initialize;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const client_1 = tslib_1.__importDefault(require("react-dom/client"));
@ -39,4 +40,3 @@ function initialize(features, appName, routers, locales, error, format) {
root.render(Main);
}
}
exports.default = initialize;

View File

@ -1,9 +1,8 @@
/// <reference types="react" />
import { Breakpoints } from './context';
export interface ResponsiveProviderProps {
children?: React.ReactNode;
breakpoints?: Breakpoints;
}
export declare function ResponsiveProvider(props: ResponsiveProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<{
breakpoints?: Breakpoints | undefined;
breakpoints?: Breakpoints;
}>>;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponsiveProvider = void 0;
exports.ResponsiveProvider = ResponsiveProvider;
const react_1 = require("react");
const context_1 = require("./context");
function ResponsiveProvider(props) {
@ -12,4 +12,3 @@ function ResponsiveProvider(props) {
value,
}, children);
}
exports.ResponsiveProvider = ResponsiveProvider;

View File

@ -17,5 +17,5 @@ export declare const keys: Keys;
export declare const values: Values;
export declare const defaultBreakpoints: Breakpoints;
export declare const ResponsiveContext: React.Context<{
breakpoints?: Breakpoints | undefined;
breakpoints?: Breakpoints;
}>;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useWidth = void 0;
exports.useWidth = useWidth;
const react_1 = require("react");
const react_responsive_1 = require("react-responsive");
const context_1 = require("./context");
@ -46,4 +46,3 @@ function useWidth(props) {
}
return 'xs';
}
exports.useWidth = useWidth;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { BrowserRouterProps } from 'react-router-dom';
export interface IBrowserRouterProps extends BrowserRouterProps {
namespace: string;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBrowserWidth = void 0;
exports.getBrowserWidth = getBrowserWidth;
const context_1 = require("../responsive/context");
// const canUseDocument = !!(
// typeof window !== 'undefined' &&
@ -40,4 +40,3 @@ function getBrowserWidth() {
}
return size;
}
exports.getBrowserWidth = getBrowserWidth;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lookUpAST = void 0;
exports.lookUpAST = lookUpAST;
/**
* Common runtime logic between js and wxs
*/
@ -54,4 +54,3 @@ function lookUpAST(key, translations, locale, fallbackLocale) {
}
return translation;
}
exports.lookUpAST = lookUpAST;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTranslations = void 0;
exports.parseTranslations = parseTranslations;
const tslib_1 = require("tslib");
const format_message_parse_1 = tslib_1.__importDefault(require("format-message-parse"));
function parseTranslations(object) {
@ -16,4 +16,3 @@ function parseTranslations(object) {
}
return object;
}
exports.parseTranslations = parseTranslations;

View File

@ -1,6 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getI18next = exports.CURRENT_LOCALE_DATA = exports.LOCALE_CHANGE_HANDLER_NAME = exports.CURRENT_LOCALE_KEY = exports.getI18nInstanceWechatMp = exports.initI18nWechatMp = exports.I18nWechatMpRuntimeBase = void 0;
exports.CURRENT_LOCALE_DATA = exports.LOCALE_CHANGE_HANDLER_NAME = exports.CURRENT_LOCALE_KEY = exports.I18nWechatMpRuntimeBase = void 0;
exports.initI18nWechatMp = initI18nWechatMp;
exports.getI18nInstanceWechatMp = getI18nInstanceWechatMp;
exports.getI18next = getI18next;
const interpreter_1 = require("./interpreter");
const common_1 = require("./common");
const translation_parser_1 = require("./compile/translation-parser");
@ -83,11 +86,9 @@ function initI18nWechatMp(options) {
});
return i18nInstance;
}
exports.initI18nWechatMp = initI18nWechatMp;
function getI18nInstanceWechatMp() {
return OakI18n?.i18nInstance;
}
exports.getI18nInstanceWechatMp = getI18nInstanceWechatMp;
exports.CURRENT_LOCALE_KEY = '$_locale';
exports.LOCALE_CHANGE_HANDLER_NAME = '$_localeChange';
exports.CURRENT_LOCALE_DATA = '$_translations';
@ -102,7 +103,6 @@ function getI18next(options) {
});
return i18n;
}
exports.getI18next = getI18next;
// type Func = (...args: any[]) => any;
// export const I18nWechatMp = Behavior(
// (() => {

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.interpret = void 0;
exports.interpret = interpret;
const EMPTY = '';
function interpret(message, params) {
if (!message)
@ -13,7 +13,6 @@ function interpret(message, params) {
}, [])
.join('');
}
exports.interpret = interpret;
function _eval(element, params) {
params = params || {};
if (typeof element === 'string') {

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.t = void 0;
exports.t = t;
/**
* 在wxs环境下实现部分i18n-js内的逻辑
* 参见i18n-js/src/i18n.ts中的translate逻辑
@ -132,7 +132,6 @@ function t(key, p1, p2, p3, p4, p5, p6) {
}
return fullKey.split('.').pop();
}
exports.t = t;
function propObserver(locales, oldValue, instance) {
Instance = instance;
}

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMessageInterpreter = void 0;
exports.getMessageInterpreter = getMessageInterpreter;
const interpreter_1 = require("../interpreter");
const common_1 = require("../common");
function getMessageInterpreter() {
@ -25,4 +25,3 @@ function getMessageInterpreter() {
return '';
};
}
exports.getMessageInterpreter = getMessageInterpreter;

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { EntityDict } from 'oak-domain/lib/types/Entity';
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { DataType, DataTypeParams } from 'oak-domain/lib/types/schema/DataTypes';

View File

@ -1,4 +1,3 @@
/// <reference types="react" />
import { Dayjs } from 'dayjs';
import { OakAbsRefAttrPickerDef, ColSpanType, ED } from './AbstractComponent';
export type ViewType = 'Input' | 'Select' | 'DatePicker' | 'DatePicker.RangePicker' | 'RefAttr';

1
lib/types/Map.d.ts vendored
View File

@ -1,4 +1,3 @@
/// <reference types="react" />
export type MapComponent = (props: {
id?: string;
center?: [number, number];

2
lib/types/Page.d.ts vendored
View File

@ -1,5 +1,3 @@
/// <reference types="wechat-miniprogram" />
/// <reference types="wechat-miniprogram" />
import { Aspect, EntityDict, CheckerType, AggregationResult, OpRecord, OakUserException } from "oak-domain/lib/types";
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
import { Feature } from './Feature';

View File

@ -5,5 +5,4 @@ export interface Pagination {
more?: boolean;
total?: number;
randomRange?: number;
getTotal?: number;
}

1
lib/types/Wx.d.ts vendored
View File

@ -1,3 +1,2 @@
/// <reference types="wechat-miniprogram" />
export type PromisifyOption<T extends Record<string, any>> = Omit<T, 'success' | 'fail' | 'complete'>;
export type PromisifyResult<T extends WechatMiniprogram.AsyncMethodOptionLike> = Promise<Parameters<Exclude<T['success'], undefined>>[0]>;

View File

@ -1,4 +1,3 @@
/// <reference types="wechat-miniprogram" />
import { PromisifyOption } from '../../types/Wx';
export declare class Bluetooth {
private serverDict;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEnv = void 0;
exports.getEnv = getEnv;
async function getEnv() {
const env = await wx.getSystemInfo();
const fullEnv = Object.assign(env, {
@ -19,4 +19,3 @@ async function getEnv() {
briefEnv,
};
}
exports.getEnv = getEnv;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEnv = void 0;
exports.getEnv = getEnv;
const react_native_1 = require("react-native");
const react_native_localize_1 = require("react-native-localize");
const react_native_device_info_1 = require("react-native-device-info");
@ -31,4 +31,3 @@ async function getEnv() {
briefEnv,
};
}
exports.getEnv = getEnv;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEnv = void 0;
exports.getEnv = getEnv;
const tslib_1 = require("tslib");
const fingerprintjs_1 = tslib_1.__importDefault(require("@fingerprintjs/fingerprintjs"));
const lodash_1 = require("oak-domain/lib/utils/lodash");
@ -33,4 +33,3 @@ async function getEnv() {
briefEnv,
};
}
exports.getEnv = getEnv;

View File

@ -1,11 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.t = exports.registerMissCallback = void 0;
exports.registerMissCallback = registerMissCallback;
exports.t = t;
let MissCallback = () => undefined;
function registerMissCallback(callback) {
MissCallback = callback;
}
exports.registerMissCallback = registerMissCallback;
function get(object, path) {
// 沿着路径寻找到对应的值,未找到则返回默认值 defaultValue
return (_basePath(path).reduce((o, k) => {
@ -25,4 +25,3 @@ function t(key, locales, lng, fallbackLng, params) {
}
return '';
}
exports.t = t;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.locate = void 0;
exports.locate = locate;
const utils_1 = require("./utils");
async function locateWechat() {
return wx.getLocation({});
@ -38,4 +38,3 @@ async function locate() {
return result2;
}
}
exports.locate = locate;

View File

@ -1,11 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isMockId = exports.generateMockId = void 0;
exports.generateMockId = generateMockId;
exports.isMockId = isMockId;
function generateMockId() {
return `__mock-${Math.ceil(Math.random() * 100000000000)}`;
}
exports.generateMockId = generateMockId;
function isMockId(id) {
return id.startsWith('__mock-');
}
exports.isMockId = isMockId;

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.promisify = void 0;
exports.promisify = promisify;
/**
* 将小程序的API封装成支持Promise的API, 小程序部分api不支持promise
* @params fn {Function} 小程序原始API如wx.login
@ -22,4 +22,3 @@ function promisify(fn) {
});
};
}
exports.promisify = promisify;

View File

@ -1,6 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.analyzeAttrMobileForCard = exports.translateAttributes = exports.analyzeDataUpsertTransformer = exports.makeDataTransformer = exports.getType = exports.getFixed = exports.getAlign = exports.getValue = exports.getWidth = exports.getLabel = exports.getPath = exports.getLinkUrl = exports.isAttributeType = exports.resolvePath = exports.getAttributes = void 0;
exports.getAttributes = getAttributes;
exports.resolvePath = resolvePath;
exports.isAttributeType = isAttributeType;
exports.getLinkUrl = getLinkUrl;
exports.getPath = getPath;
exports.getLabel = getLabel;
exports.getWidth = getWidth;
exports.getValue = getValue;
exports.getAlign = getAlign;
exports.getFixed = getFixed;
exports.getType = getType;
exports.makeDataTransformer = makeDataTransformer;
exports.analyzeDataUpsertTransformer = analyzeDataUpsertTransformer;
exports.translateAttributes = translateAttributes;
exports.analyzeAttrMobileForCard = analyzeAttrMobileForCard;
const tslib_1 = require("tslib");
const assert_1 = require("oak-domain/lib/utils/assert");
const relation_1 = require("oak-domain/lib/store/relation");
@ -35,7 +49,6 @@ function getAttributes(attributes) {
},
});
}
exports.getAttributes = getAttributes;
function resolvePath(dataSchema, entity, path) {
(0, assert_1.assert)(!path.includes('['), '数组索引不需要携带[],请使用arr.0.value');
const attrs = path.split('.');
@ -86,12 +99,10 @@ function resolvePath(dataSchema, entity, path) {
attribute,
};
}
exports.resolvePath = resolvePath;
// 强制类型
function isAttributeType(attribute) {
return attribute;
}
exports.isAttributeType = isAttributeType;
function getLinkUrl(attribute, props) {
if (typeof attribute === 'string') {
return '';
@ -107,7 +118,6 @@ function getLinkUrl(attribute, props) {
href += searchParams.join('&');
return href;
}
exports.getLinkUrl = getLinkUrl;
// 以下几个get方法只需要两个参数attribute和一个解析path对象只是后者类型还没定义
function getPath(attribute) {
if (typeof attribute === 'string') {
@ -115,7 +125,6 @@ function getPath(attribute) {
}
return attribute.path;
}
exports.getPath = getPath;
function getLabel(attribute, entity, attr, t) {
if (isAttributeType(attribute).label) {
return isAttributeType(attribute).label;
@ -133,7 +142,6 @@ function getLabel(attribute, entity, attr, t) {
}
return t(`${entity}:attr.${attr}`, {});
}
exports.getLabel = getLabel;
// 目前width属性可以是undefined只有特殊type或用户自定义才有值这样其余attr属性可以自适应
function getWidth(attribute, attrType) {
let width;
@ -149,7 +157,6 @@ function getWidth(attribute, attrType) {
}
return width;
}
exports.getWidth = getWidth;
function getValue(data, path, entity, attr, attrType, t) {
let value = (0, lodash_1.get)(data, path);
// 枚举类型还要通过i18转一下中文
@ -173,15 +180,12 @@ function getValue(data, path, entity, attr, attrType, t) {
}
return value;
}
exports.getValue = getValue;
function getAlign(attribute) {
return isAttributeType(attribute).align || 'left';
}
exports.getAlign = getAlign;
function getFixed(attribute) {
return isAttributeType(attribute).fixed;
}
exports.getFixed = getFixed;
function getType(attribute, attrType) {
let type = attrType;
if (isAttributeType(attribute).type) {
@ -189,7 +193,6 @@ function getType(attribute, attrType) {
}
return type;
}
exports.getType = getType;
function getLabelI18(dataSchema, entity, path, t) {
const { attr, entity: entityI8n } = resolvePath(dataSchema, entity, path);
return t(`${entityI8n}:attr.${attr}`, {});
@ -227,7 +230,6 @@ function makeDataTransformer(dataSchema, entity, attrDefs, t) {
};
});
}
exports.makeDataTransformer = makeDataTransformer;
function analyzeDataUpsertTransformer(dataSchema, entity, attrUpsertDefs) {
let geoDef = undefined;
const makeNativeFixedPart = (attr, def) => {
@ -306,7 +308,6 @@ function analyzeDataUpsertTransformer(dataSchema, entity, attrUpsertDefs) {
};
});
}
exports.analyzeDataUpsertTransformer = analyzeDataUpsertTransformer;
function translateAttributes(dataSchema, entity, attributes) {
const judgeAttributes = attributes.map((ele) => {
const path = getPath(ele);
@ -322,7 +323,6 @@ function translateAttributes(dataSchema, entity, attributes) {
});
return judgeAttributes;
}
exports.translateAttributes = translateAttributes;
function analyzeAttrMobileForCard(dataSchema, entity, t, attributes) {
return (data) => {
// 遍历用户传入的数据源
@ -347,4 +347,3 @@ function analyzeAttrMobileForCard(dataSchema, entity, t, attributes) {
return coverData;
};
}
exports.analyzeAttrMobileForCard = analyzeAttrMobileForCard;

View File

@ -29,11 +29,11 @@ export default OakComponent({
}
}
if (prev.oakPagination?.currentPage !== next.oakPagination?.currentPage) {
const { pageSize, currentPage, more, getTotal } = next.oakPagination || {};
const { pageSize, currentPage, more, } = next.oakPagination || {};
const { newTotal } = this.state;
let newTotal3 = newTotal || newTotal2;
if (newTotal3 && pageSize) {
if (Math.ceil(newTotal3 / pageSize) === currentPage && more && newTotal3 >= getTotal) {
if (Math.ceil(newTotal3 / pageSize) === currentPage && more) {
this.setState({ newTotal: newTotal3 + pageSize });
}
}

View File

@ -60,11 +60,7 @@ export default function Render(
showTitle,
} = props.data;
const { t, setPageSize, setCurrentPage } = props.methods;
const { pageSize, total, currentPage, more, count, getTotal } = oakPagination || {};
const [hasmore, setHasmore] = useState(more);
useEffect(() => {
setHasmore(more && newTotal >= getTotal!);
}, [more, newTotal, getTotal])
const { pageSize, total, currentPage, more, count, } = oakPagination || {};
const paginationRef = useRef<HTMLUListElement>(null);
const [internalInputVal, setInternalInputVal] = useState(currentPage);
@ -157,8 +153,8 @@ export default function Render(
</li>
) : (
<li className={Style[`${prefixCls}-total-text`]}>
{/* 共 {newTotal >= total! ? (hasmore ? newTotal + '+' : (currentPage! - 1) * pageSize! + count!) : total} 条 */}
{newTotal + (hasmore ? '+' : '')}
{/* 共 {newTotal >= total! ? (more ? newTotal + '+' : (currentPage! - 1) * pageSize! + count!) : total} 条 */}
{newTotal > total! ? (currentPage! - 1) * pageSize! + count! + (more ? '+' : '') : total}
</li>
);
@ -291,13 +287,14 @@ export default function Render(
}
function changePageSize(size: number) {
const newCurrent = calculatePage(size, pageSize!, newTotal);
const nextCurrent =
currentPage! > newCurrent && newCurrent !== 0 ? newCurrent : currentPage!;
// const newCurrent = calculatePage(size, pageSize!, newTotal);
// const nextCurrent =
// currentPage! > newCurrent && newCurrent !== 0 ? newCurrent : currentPage!;
setPageSize(size);
setInternalInputVal(nextCurrent);
setCurrentPage(nextCurrent);
//pageSize 改变时自动回到第一页
// setInternalInputVal(nextCurrent);
// setCurrentPage(nextCurrent);
}

Some files were not shown because too many files have changed in this diff Show More