Compare commits
14 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
4929590c81 | |
|
|
567e0abc6a | |
|
|
a26f464ba1 | |
|
|
fdd24a8cc8 | |
|
|
fff9750b2a | |
|
|
f16b3f91a8 | |
|
|
6e48eb02b4 | |
|
|
b07f084341 | |
|
|
96b8cd9366 | |
|
|
363b329070 | |
|
|
51cc8786a0 | |
|
|
ea01036c5a | |
|
|
71f385f0f4 | |
|
|
91bf1da808 |
|
|
@ -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: BasicFeatures<ED>["cache"]) => 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 {};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import { ButtonProps } from 'antd';
|
||||
export type Item = {
|
||||
icon?: string | React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import { ButtonProps } from 'antd';
|
||||
export type Item = {
|
||||
icon?: string;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactCompo
|
|||
column?: number | Record<Breakpoint, number>;
|
||||
entity: T2;
|
||||
attributes: OakAbsAttrDef[];
|
||||
data: Partial<ED2[T2]['Schema']>;
|
||||
data: Partial<ED2[T2]["Schema"]>;
|
||||
title?: string;
|
||||
bordered?: boolean;
|
||||
layout?: 'horizontal' | 'vertical';
|
||||
layout?: "horizontal" | "vertical";
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
/// <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 | null | undefined;
|
||||
color: string;
|
||||
size: number | undefined | null;
|
||||
color: "primary" | "success" | "error" | "waring" | "info" | string;
|
||||
oakClass: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactCompo
|
|||
data: RowWithActions<ED2, T2>[];
|
||||
loading: boolean;
|
||||
tablePagination?: React.ReactNode | false;
|
||||
rowSelection?: TableProps<RowWithActions<ED2, T2>>['rowSelection'];
|
||||
rowSelection?: TableProps<RowWithActions<ED2, T2>>["rowSelection"];
|
||||
hideHeader?: boolean;
|
||||
disableSerialNumber?: boolean;
|
||||
size?: 'large' | 'middle' | 'small';
|
||||
scroll?: TableProps<RowWithActions<ED2, T2>>['scroll'];
|
||||
size?: "large" | "middle" | "small";
|
||||
scroll?: TableProps<RowWithActions<ED2, T2>>["scroll"];
|
||||
empty?: React.ReactNode;
|
||||
opWidth?: number;
|
||||
ellipsis?: boolean;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
/// <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, {}>) => 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, {}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ declare const _default: <ED2 extends ED, T2 extends keyof ED2>(props: ReactCompo
|
|||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
showQuickJumper?: boolean;
|
||||
size?: 'default' | 'small';
|
||||
size?: "default" | "small";
|
||||
showSizeChanger?: boolean;
|
||||
showTotal?: (total: number, range: [number, number]) => React.ReactNode;
|
||||
}>) => React.ReactElement;
|
||||
|
|
|
|||
|
|
@ -19,7 +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 { pageSize = 0, total = 0, currentPage = 1, more, count, getTotal } = oakPagination || {};
|
||||
const paginationRef = useRef(null);
|
||||
const [internalInputVal, setInternalInputVal] = useState(currentPage);
|
||||
useEffect(() => {
|
||||
|
|
@ -28,7 +28,7 @@ export default function Render(props) {
|
|||
if (!oakPagination) {
|
||||
return null;
|
||||
}
|
||||
if (total === 0) {
|
||||
if (!total) {
|
||||
return null;
|
||||
}
|
||||
const prefixCls = 'rc-pagination';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
data: ED2[T2]["Schema"];
|
||||
layout: "horizontal" | "vertical";
|
||||
mode: "default" | "card";
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
})[];
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="node" />
|
||||
import { Feature } from '../types/Feature';
|
||||
export declare class Navigator extends Feature {
|
||||
namespace: string;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -233,7 +233,7 @@ declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof
|
|||
saveRefreshResult(data: Record<string, any>): void;
|
||||
refresh(): Promise<void>;
|
||||
clean(lsn?: number, dontPublish?: true): void;
|
||||
private getFilter;
|
||||
getFilter(ignoreNew?: true, onlyHot?: true): ED[T]['Filter'] | undefined;
|
||||
getIntrinsticFilters(): ED[T]["Filter"] | undefined;
|
||||
/**
|
||||
* getParentFilter不能假设一定已经有数据,只能根据当前filter的条件去构造
|
||||
|
|
@ -327,20 +327,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;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { createOperationsFromModies } from 'oak-domain/lib/store/modi';
|
|||
import { judgeRelation } from "oak-domain/lib/store/relation";
|
||||
import { CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute } from "oak-domain/lib/types";
|
||||
import { Feature } from '../types/Feature';
|
||||
import { generateNewId } from 'oak-domain/lib/utils/uuid';
|
||||
import { generateNewId, generateNewIdAsync } from 'oak-domain/lib/utils/uuid';
|
||||
export const MODI_NEXT_PATH_SUFFIX = ':next';
|
||||
const START_LSN = 100;
|
||||
function mergeOperation(schema, entity, oper1, oper2) {
|
||||
|
|
@ -1252,7 +1252,7 @@ class SingleNode extends EntityNode {
|
|||
setId(id) {
|
||||
if (id !== this.id) {
|
||||
const operations = this.ulManager.makeOperations();
|
||||
assert(operations.length <= 1);
|
||||
assert(operations.length <= 1, 'singleNode在setId时出现数据不一致');
|
||||
const [operation] = operations;
|
||||
if (operation?.action === 'create') {
|
||||
if (operation.data.id === id) {
|
||||
|
|
@ -1413,7 +1413,7 @@ class SingleNode extends EntityNode {
|
|||
}
|
||||
setDirty() {
|
||||
const id = this.getId();
|
||||
assert(id);
|
||||
assert(id, "不能对没有id的singleNode设置dirty");
|
||||
this.ulManager.push(this.ulManager.maxLsn, {
|
||||
action: 'update',
|
||||
data: {},
|
||||
|
|
@ -1441,7 +1441,7 @@ class SingleNode extends EntityNode {
|
|||
const childOperations = child.composeOperations(paths?.length ? paths : undefined);
|
||||
if (childOperations) {
|
||||
if (child instanceof SingleNode) {
|
||||
assert(childOperations.length === 1);
|
||||
assert(childOperations.length === 1, 'singleNode在composeOperations时出现数据不一致');
|
||||
this.ulManager.push(lsnMax + 100, {
|
||||
action: 'update',
|
||||
data: {
|
||||
|
|
@ -1453,7 +1453,7 @@ class SingleNode extends EntityNode {
|
|||
});
|
||||
}
|
||||
else {
|
||||
assert(child instanceof ListNode);
|
||||
assert(child instanceof ListNode, 'child必须是ListNode');
|
||||
this.ulManager.push(lsnMax + 100, {
|
||||
action: 'update',
|
||||
data: {
|
||||
|
|
@ -1543,8 +1543,8 @@ class SingleNode extends EntityNode {
|
|||
const rel = this.judgeRelation(k2);
|
||||
if (rel === 2) {
|
||||
if (value?.entityId) {
|
||||
assert(child instanceof SingleNode);
|
||||
assert(value.entity === child.getEntity());
|
||||
assert(child instanceof SingleNode, 'child必须是singleNode');
|
||||
assert(value.entity === child.getEntity(), 'singleNode的entity必须一致');
|
||||
child.saveRefreshResult({
|
||||
[value.entityId]: this.sr[k2] || {},
|
||||
});
|
||||
|
|
@ -2007,6 +2007,7 @@ export class RunningTree extends Feature {
|
|||
assert(!parentNode || parentNode instanceof VirtualNode);
|
||||
node = new VirtualNode(fullPath, path, parentNode, stale);
|
||||
}
|
||||
// 任何临时的修改都需要回滚,上面缓存了一些update操作
|
||||
rollback();
|
||||
if (!parentNode) {
|
||||
assert(!parent && !this.root[path]);
|
||||
|
|
@ -2413,7 +2414,7 @@ export class RunningTree extends Feature {
|
|||
const node = path && this.findNode(path);
|
||||
// assert(node.isDirty());
|
||||
node && node.setExecuting(true);
|
||||
let pollute = false;
|
||||
// let pollute = false;
|
||||
try {
|
||||
let operations = path && this.getOperations(path) || [];
|
||||
if (opers) {
|
||||
|
|
@ -2432,15 +2433,30 @@ export class RunningTree extends Feature {
|
|||
else if (node) {
|
||||
// 老的写法,直接对一个非脏的结点execute某个action,也可以支持
|
||||
assert(node instanceof SingleNode);
|
||||
node.update(this.logSerailNumber, {}, action);
|
||||
pollute = true;
|
||||
operations = node.composeOperations() || [];
|
||||
assert(operations.length === 1);
|
||||
const [operation1] = operations;
|
||||
if (action !== operation1.operation.action) {
|
||||
assert(operation1.operation.action === 'update'); // 如果execute时传action,前面update动作应该只可能是update
|
||||
operation1.operation.action = action;
|
||||
}
|
||||
// node.update(this.logSerailNumber, {}, action);
|
||||
// pollute = true;
|
||||
// operations = node.composeOperations() || [];
|
||||
// assert(operations.length === 1);
|
||||
// const [operation1] = operations;
|
||||
// if (action !== operation1.operation.action) {
|
||||
// assert(operation1.operation.action === 'update'); // 如果execute时传action,前面update动作应该只可能是update
|
||||
// operation1.operation.action = action;
|
||||
// }
|
||||
/**
|
||||
* 上述写法会触发publish行为,如:一个close动作会导致页面像下面这样渲染:
|
||||
* opened --> closed(上面的node.update) --> opened(执行成功回来setExecuting时) --> closed(执行成功回来再sync cache后)
|
||||
*/
|
||||
operations.push({
|
||||
entity: node.getEntity(),
|
||||
operation: {
|
||||
id: await generateNewIdAsync(),
|
||||
action,
|
||||
data: {
|
||||
$$updateAt$$: Date.now(),
|
||||
},
|
||||
filter: node.getFilter(true),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (operations.length > 0) {
|
||||
|
|
@ -2470,9 +2486,9 @@ export class RunningTree extends Feature {
|
|||
}
|
||||
catch (err) {
|
||||
node && node.setExecuting(false);
|
||||
if (pollute) {
|
||||
/* if (pollute) {
|
||||
path && this.clean(path);
|
||||
}
|
||||
} */
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -6,4 +5,4 @@ import { Feature } from './types/Feature';
|
|||
import { DataOption, OakComponentOption } from './types/Page';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends DataOption = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): string;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends DataOption = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): string;
|
||||
|
|
|
|||
|
|
@ -6,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<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { MessageProps } from './types/Message';
|
|||
import { NotificationProps } from './types/Notification';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): {
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): {
|
||||
new (props: ComponentProps<ED, T, TProperty>): {
|
||||
features: BasicFeatures<ED> & FD;
|
||||
oakOption: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>;
|
||||
|
|
@ -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>;
|
||||
} & 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 | undefined;
|
||||
}, path?: string | undefined): string;
|
||||
addItems<T_2 extends keyof ED>(data: (Omit<ED[T_2]["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_3 extends keyof ED>(data: ED[T_3]["Update"]["data"], id: string, action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void;
|
||||
updateItems<T_4 extends keyof ED>(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<T_5 extends keyof ED>(data: ED[T_5]["Update"]["data"], action?: ED[T_5]["Action"] | undefined, path?: string | undefined): void;
|
||||
create<T_6 extends keyof ED>(data: Omit<ED[T_6]["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;
|
||||
addItems<T_1 extends keyof ED>(data: (Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
|
||||
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_7 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;
|
||||
|
|
|
|||
|
|
@ -6,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<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}>>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import { BrowserRouterProps } from 'react-router-dom';
|
||||
export interface IBrowserRouterProps extends BrowserRouterProps {
|
||||
namespace: string;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
export type MapComponent = (props: {
|
||||
id?: string;
|
||||
center?: [number, number];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
export type NotificationProps = {
|
||||
message: React.ReactNode;
|
||||
description: React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -148,7 +146,7 @@ export type ComponentFullThisType<ED extends EntityDict & BaseEntityDict, T exte
|
|||
triggerEvent: <DetailType = any>(name: string, detail?: DetailType, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
|
||||
oakLifetime: OakLifetime;
|
||||
} & OakCommonComponentMethods<ED, T> & OakListComponentMethods<ED, T> & OakSingleComponentMethods<ED, T>;
|
||||
export type OakComponentOption<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any>, TProperty extends DataOption, TMethod extends Record<string, Function>, EMethod extends Record<string, Function> = {}> = ComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod, EMethod> & Partial<{
|
||||
export type OakComponentOption<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any>, TProperty extends DataOption, TMethod extends Record<string, Function>, EMethod extends Record<string, Function> = {}> = ComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod, EMethod> & Partial<{
|
||||
/**
|
||||
* 生命周期回调
|
||||
*/
|
||||
|
|
@ -353,7 +351,7 @@ export type OakComponentData<ED extends EntityDict & BaseEntityDict, T extends k
|
|||
type OakListComoponetData<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||
oakPagination?: Pagination;
|
||||
};
|
||||
export type MakeOakComponent<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>> = <IsList extends boolean, T extends keyof ED, FormedData extends DataOption, TData extends DataOption, TProperty extends DataOption, TMethod extends MethodOption>(options: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>) => (props: ReactComponentProps<ED, T, IsList, TProperty>) => React.ReactElement;
|
||||
export type MakeOakComponent<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>> = <IsList extends boolean, T extends keyof ED, FormedData extends DataOption, TData extends DataOption, TProperty extends DataOption, TMethod extends MethodOption>(options: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>) => (props: ReactComponentProps<ED, T, IsList, TProperty>) => 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' | 'updateItems' | 'resetItem' | 'recoverItem' | 'recoverItems';
|
||||
export type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation' | 'getId' | 'setId';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
type UploadFileFn = (options: {
|
||||
file: string | File | Blob;
|
||||
name: string;
|
||||
uploadUrl: string;
|
||||
formData: Record<string, any>;
|
||||
autoInform?: boolean;
|
||||
getPercent?: Function;
|
||||
uploadId?: string;
|
||||
method?: "POST" | "PUT" | "PATCH";
|
||||
isFilePath?: boolean;
|
||||
}) => Promise<{
|
||||
status: number;
|
||||
statusText: string;
|
||||
statusCode?: number;
|
||||
headers: {
|
||||
get(name: string): string | null;
|
||||
};
|
||||
json(): Promise<any>;
|
||||
text(): Promise<string>;
|
||||
errMsg?: string;
|
||||
data?: any;
|
||||
}>;
|
||||
export interface UploadInterface {
|
||||
uploadFile: UploadFileFn;
|
||||
abortUpload(uploadId: string): boolean;
|
||||
abortAllUploads(): void;
|
||||
getUploadStatus(uploadId: string): 'uploading' | 'completed' | 'aborted' | 'not-found';
|
||||
getActiveUploads(): string[];
|
||||
}
|
||||
export {};
|
||||
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
|
|
@ -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]>;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="wechat-miniprogram" />
|
||||
import { PromisifyOption } from '../../types/Wx';
|
||||
export declare class Bluetooth {
|
||||
private serverDict;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
export declare class Upload {
|
||||
uploadFile(file: File | string, name: string, uploadUrl: string, formData: Record<string, any>, autoInform?: boolean, getPercent?: Function, uploadId?: string, // 新增:上传任务ID,用于中断特定上传
|
||||
method?: "POST" | "PUT" | "PATCH"): Promise<any>;
|
||||
import { UploadInterface } from "../types/Upload";
|
||||
export declare class Upload implements UploadInterface {
|
||||
uploadFile(options: {
|
||||
file: string | File | Blob;
|
||||
name: string;
|
||||
uploadUrl: string;
|
||||
formData: Record<string, any>;
|
||||
autoInform?: boolean;
|
||||
getPercent?: Function;
|
||||
uploadId?: string;
|
||||
method?: "POST" | "PUT" | "PATCH";
|
||||
isFilePath?: boolean;
|
||||
}): Promise<any>;
|
||||
private controllers;
|
||||
constructor();
|
||||
abortUpload(uploadId: string): boolean;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
export class Upload {
|
||||
async uploadFile(file, name, uploadUrl, formData, autoInform, getPercent, uploadId, // 新增:上传任务ID,用于中断特定上传
|
||||
method = "POST") {
|
||||
async uploadFile(options) {
|
||||
console.warn('server不会调用此函数');
|
||||
}
|
||||
controllers = new Map();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,18 @@
|
|||
export declare class Upload {
|
||||
uploadFile(file: File | string, name: string, uploadUrl: string, formData: Record<string, any>, autoInform?: boolean, getPercent?: Function, uploadId?: string, // 新增:上传任务ID,用于中断特定上传
|
||||
method?: "POST" | "PUT" | "PATCH"): Promise<any>;
|
||||
import { UploadInterface } from '../types/Upload';
|
||||
export declare class Upload implements UploadInterface {
|
||||
abortUpload(uploadId: string): boolean;
|
||||
abortAllUploads(): void;
|
||||
getUploadStatus(uploadId: string): 'uploading' | 'completed' | 'aborted' | 'not-found';
|
||||
getActiveUploads(): string[];
|
||||
uploadFile(options: {
|
||||
file: string | File | Blob;
|
||||
name: string;
|
||||
uploadUrl: string;
|
||||
formData: Record<string, any>;
|
||||
autoInform?: boolean;
|
||||
getPercent?: Function;
|
||||
uploadId?: string;
|
||||
method?: "POST" | "PUT" | "PATCH";
|
||||
isFilePath?: boolean;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,47 @@
|
|||
import { promisify } from './promisify';
|
||||
export class Upload {
|
||||
async uploadFile(file, name, uploadUrl, formData, autoInform, getPercent, uploadId, // 新增:上传任务ID,用于中断特定上传
|
||||
method = "POST") {
|
||||
abortUpload(uploadId) {
|
||||
return false;
|
||||
}
|
||||
abortAllUploads() {
|
||||
}
|
||||
getUploadStatus(uploadId) {
|
||||
return 'not-found';
|
||||
}
|
||||
getActiveUploads() {
|
||||
return [];
|
||||
}
|
||||
async uploadFile(options) {
|
||||
const { file, name, uploadUrl, formData, isFilePath, method = "POST" } = options;
|
||||
const isPut = method === "PUT";
|
||||
if (isPut) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fs = wx.getFileSystemManager();
|
||||
fs.readFile({
|
||||
filePath: file,
|
||||
success: (fileRes) => {
|
||||
// 使用 PUT 方法上传
|
||||
wx.request({
|
||||
url: uploadUrl,
|
||||
method: 'PUT',
|
||||
data: fileRes.data, // ArrayBuffer 格式
|
||||
header: {
|
||||
'Content-Type': 'image/jpeg', // 根据实际文件类型设置
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
if (uploadRes.statusCode === 200) {
|
||||
resolve(uploadRes);
|
||||
}
|
||||
else {
|
||||
reject(new Error(`HTTP Error: ${uploadRes.statusCode}`));
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err);
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('读取文件失败', err);
|
||||
reject(err);
|
||||
}
|
||||
if (isFilePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const fs = wx.getFileSystemManager();
|
||||
fs.readFile({
|
||||
filePath: file,
|
||||
encoding: 'binary',
|
||||
success: res => {
|
||||
resolve(global.fetch(uploadUrl, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
},
|
||||
body: res.data,
|
||||
}));
|
||||
},
|
||||
fail: err => {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return global.fetch(uploadUrl, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
'Content-Type': 'application/octet-stream',
|
||||
},
|
||||
body: file,
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,17 @@
|
|||
export declare class Upload {
|
||||
uploadFile(file: File | string, name: string, uploadUrl: string, formData: Record<string, any>, autoInform?: boolean, getPercent?: Function, uploadId?: string, // 新增:上传任务ID,用于中断特定上传
|
||||
method?: "POST" | "PUT" | "PATCH"): Promise<any>;
|
||||
import { UploadInterface } from "../types/Upload";
|
||||
export declare class Upload implements UploadInterface {
|
||||
abortUpload(uploadId: string): boolean;
|
||||
abortAllUploads(): void;
|
||||
getUploadStatus(uploadId: string): 'uploading' | 'completed' | 'aborted' | 'not-found';
|
||||
getActiveUploads(): string[];
|
||||
uploadFile(options: {
|
||||
file: File | string | Blob;
|
||||
name: string;
|
||||
uploadUrl: string;
|
||||
formData: Record<string, any>;
|
||||
autoInform?: boolean;
|
||||
getPercent?: Function;
|
||||
uploadId?: string;
|
||||
method?: "POST" | "PUT" | "PATCH";
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
export class Upload {
|
||||
async uploadFile(file, name, uploadUrl, formData, autoInform, getPercent, uploadId, // 新增:上传任务ID,用于中断特定上传
|
||||
method = "POST") {
|
||||
abortUpload(uploadId) {
|
||||
return false;
|
||||
}
|
||||
abortAllUploads() {
|
||||
}
|
||||
getUploadStatus(uploadId) {
|
||||
return 'not-found';
|
||||
}
|
||||
getActiveUploads() {
|
||||
return [];
|
||||
}
|
||||
async uploadFile(options) {
|
||||
const { file, name, uploadUrl, formData, method = "POST" } = options;
|
||||
const isPut = method === "PUT";
|
||||
if (isPut) {
|
||||
// S3 预签名上传
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
export declare class Upload {
|
||||
import { UploadInterface } from "../types/Upload";
|
||||
export declare class Upload implements UploadInterface {
|
||||
private controllers;
|
||||
constructor();
|
||||
uploadFile(file: File | string, name: string, uploadUrl: string, formData: Record<string, any>, autoInform?: boolean, getPercent?: Function, uploadId?: string, // 新增:上传任务ID,用于中断特定上传
|
||||
method?: "POST" | "PUT" | "PATCH"): Promise<any>;
|
||||
uploadFile(options: {
|
||||
file: File | string | Blob;
|
||||
name: string;
|
||||
uploadUrl: string;
|
||||
formData: Record<string, any>;
|
||||
autoInform?: boolean;
|
||||
getPercent?: Function;
|
||||
uploadId?: string;
|
||||
method?: "POST" | "PUT" | "PATCH";
|
||||
}): Promise<any>;
|
||||
abortUpload(uploadId: string): boolean;
|
||||
abortAllUploads(): void;
|
||||
getUploadStatus(uploadId: string): 'uploading' | 'completed' | 'aborted' | 'not-found';
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ export class Upload {
|
|||
this.getUploadStatus = this.getUploadStatus.bind(this);
|
||||
this.getActiveUploads = this.getActiveUploads.bind(this);
|
||||
}
|
||||
async uploadFile(file, name, uploadUrl, formData, autoInform, getPercent, uploadId, // 新增:上传任务ID,用于中断特定上传
|
||||
method = "POST") {
|
||||
async uploadFile(options) {
|
||||
const { file, name, uploadUrl, formData, getPercent, uploadId, method = "POST" } = options;
|
||||
const isPut = method === "PUT";
|
||||
const id = uploadId || this.generateUploadId(file, uploadUrl);
|
||||
// 如果已有相同ID的上传在进行,先中断它
|
||||
|
|
@ -36,17 +36,33 @@ export class Upload {
|
|||
});
|
||||
xhr.onload = () => {
|
||||
this.controllers.delete(id); // 清理控制器
|
||||
// 构造类似 Response 的对象,支持 headers.get()
|
||||
const headersMap = new Map();
|
||||
const headersStr = xhr.getAllResponseHeaders();
|
||||
headersStr.split('\r\n').forEach(line => {
|
||||
const parts = line.split(': ');
|
||||
if (parts.length === 2) {
|
||||
headersMap.set(parts[0].toLowerCase(), parts[1]);
|
||||
}
|
||||
});
|
||||
const headers = {
|
||||
get: (name) => headersMap.get(name.toLowerCase()) || null,
|
||||
has: (name) => headersMap.has(name.toLowerCase()),
|
||||
forEach: (callback) => {
|
||||
headersMap.forEach(callback);
|
||||
}
|
||||
};
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
if (xhr.status === 204) {
|
||||
resolve({ status: 204 });
|
||||
resolve({ status: 204, headers });
|
||||
}
|
||||
else {
|
||||
try {
|
||||
const data = JSON.parse(xhr.responseText);
|
||||
resolve(data);
|
||||
resolve({ ...data, status: xhr.status, headers });
|
||||
}
|
||||
catch {
|
||||
resolve({ status: xhr.status, raw: xhr.responseText });
|
||||
resolve({ status: xhr.status, raw: xhr.responseText, headers });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,6 +89,9 @@ export class Upload {
|
|||
if (file instanceof File) {
|
||||
xhr.setRequestHeader("Content-Type", file.type || "application/octet-stream");
|
||||
}
|
||||
else if (file instanceof Blob) {
|
||||
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
||||
}
|
||||
xhr.send(file);
|
||||
}
|
||||
else {
|
||||
|
|
@ -95,6 +114,9 @@ export class Upload {
|
|||
if (file instanceof File) {
|
||||
headers["Content-Type"] = file.type || "application/octet-stream";
|
||||
}
|
||||
else if (file instanceof Blob) {
|
||||
headers["Content-Type"] = "application/octet-stream";
|
||||
}
|
||||
result = await fetch(uploadUrl, {
|
||||
method: "PUT",
|
||||
headers,
|
||||
|
|
@ -122,9 +144,7 @@ export class Upload {
|
|||
this.controllers.delete(id); // 失败后清理控制器
|
||||
// 人为中断返回204 使general-business处理成功
|
||||
if (error instanceof DOMException && error.name === 'AbortError') {
|
||||
return {
|
||||
status: 204,
|
||||
};
|
||||
throw new DOMException('Upload aborted', 'AbortError');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
|
@ -159,7 +179,7 @@ export class Upload {
|
|||
generateUploadId(file, uploadUrl) {
|
||||
const timestamp = Date.now();
|
||||
const random = Math.random().toString(36).substring(2, 9);
|
||||
const fileInfo = file instanceof File ? `${file.name}-${file.size}` : String(file);
|
||||
const fileInfo = file instanceof File ? `${file.name}-${file.size}` : file instanceof Blob ? `blob-${file.size}` : file;
|
||||
return `${uploadUrl}-${fileInfo}-${timestamp}-${random}`;
|
||||
}
|
||||
// 获取所有进行中的上传任务
|
||||
|
|
|
|||
|
|
@ -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: BasicFeatures<ED>["cache"]) => 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 {};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
})[];
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="node" />
|
||||
import { Feature } from '../types/Feature';
|
||||
export declare class Navigator extends Feature {
|
||||
namespace: string;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -233,7 +233,7 @@ declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof
|
|||
saveRefreshResult(data: Record<string, any>): void;
|
||||
refresh(): Promise<void>;
|
||||
clean(lsn?: number, dontPublish?: true): void;
|
||||
private getFilter;
|
||||
getFilter(ignoreNew?: true, onlyHot?: true): ED[T]['Filter'] | undefined;
|
||||
getIntrinsticFilters(): ED[T]["Filter"] | undefined;
|
||||
/**
|
||||
* getParentFilter不能假设一定已经有数据,只能根据当前filter的条件去构造
|
||||
|
|
@ -327,20 +327,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;
|
||||
|
|
|
|||
|
|
@ -1255,7 +1255,7 @@ class SingleNode extends EntityNode {
|
|||
setId(id) {
|
||||
if (id !== this.id) {
|
||||
const operations = this.ulManager.makeOperations();
|
||||
(0, assert_1.assert)(operations.length <= 1);
|
||||
(0, assert_1.assert)(operations.length <= 1, 'singleNode在setId时出现数据不一致');
|
||||
const [operation] = operations;
|
||||
if (operation?.action === 'create') {
|
||||
if (operation.data.id === id) {
|
||||
|
|
@ -1416,7 +1416,7 @@ class SingleNode extends EntityNode {
|
|||
}
|
||||
setDirty() {
|
||||
const id = this.getId();
|
||||
(0, assert_1.assert)(id);
|
||||
(0, assert_1.assert)(id, "不能对没有id的singleNode设置dirty");
|
||||
this.ulManager.push(this.ulManager.maxLsn, {
|
||||
action: 'update',
|
||||
data: {},
|
||||
|
|
@ -1444,7 +1444,7 @@ class SingleNode extends EntityNode {
|
|||
const childOperations = child.composeOperations(paths?.length ? paths : undefined);
|
||||
if (childOperations) {
|
||||
if (child instanceof SingleNode) {
|
||||
(0, assert_1.assert)(childOperations.length === 1);
|
||||
(0, assert_1.assert)(childOperations.length === 1, 'singleNode在composeOperations时出现数据不一致');
|
||||
this.ulManager.push(lsnMax + 100, {
|
||||
action: 'update',
|
||||
data: {
|
||||
|
|
@ -1456,7 +1456,7 @@ class SingleNode extends EntityNode {
|
|||
});
|
||||
}
|
||||
else {
|
||||
(0, assert_1.assert)(child instanceof ListNode);
|
||||
(0, assert_1.assert)(child instanceof ListNode, 'child必须是ListNode');
|
||||
this.ulManager.push(lsnMax + 100, {
|
||||
action: 'update',
|
||||
data: {
|
||||
|
|
@ -1546,8 +1546,8 @@ class SingleNode extends EntityNode {
|
|||
const rel = this.judgeRelation(k2);
|
||||
if (rel === 2) {
|
||||
if (value?.entityId) {
|
||||
(0, assert_1.assert)(child instanceof SingleNode);
|
||||
(0, assert_1.assert)(value.entity === child.getEntity());
|
||||
(0, assert_1.assert)(child instanceof SingleNode, 'child必须是singleNode');
|
||||
(0, assert_1.assert)(value.entity === child.getEntity(), 'singleNode的entity必须一致');
|
||||
child.saveRefreshResult({
|
||||
[value.entityId]: this.sr[k2] || {},
|
||||
});
|
||||
|
|
@ -2010,6 +2010,7 @@ class RunningTree extends Feature_1.Feature {
|
|||
(0, assert_1.assert)(!parentNode || parentNode instanceof VirtualNode);
|
||||
node = new VirtualNode(fullPath, path, parentNode, stale);
|
||||
}
|
||||
// 任何临时的修改都需要回滚,上面缓存了一些update操作
|
||||
rollback();
|
||||
if (!parentNode) {
|
||||
(0, assert_1.assert)(!parent && !this.root[path]);
|
||||
|
|
@ -2416,7 +2417,7 @@ class RunningTree extends Feature_1.Feature {
|
|||
const node = path && this.findNode(path);
|
||||
// assert(node.isDirty());
|
||||
node && node.setExecuting(true);
|
||||
let pollute = false;
|
||||
// let pollute = false;
|
||||
try {
|
||||
let operations = path && this.getOperations(path) || [];
|
||||
if (opers) {
|
||||
|
|
@ -2435,15 +2436,30 @@ class RunningTree extends Feature_1.Feature {
|
|||
else if (node) {
|
||||
// 老的写法,直接对一个非脏的结点execute某个action,也可以支持
|
||||
(0, assert_1.assert)(node instanceof SingleNode);
|
||||
node.update(this.logSerailNumber, {}, action);
|
||||
pollute = true;
|
||||
operations = node.composeOperations() || [];
|
||||
(0, assert_1.assert)(operations.length === 1);
|
||||
const [operation1] = operations;
|
||||
if (action !== operation1.operation.action) {
|
||||
(0, assert_1.assert)(operation1.operation.action === 'update'); // 如果execute时传action,前面update动作应该只可能是update
|
||||
operation1.operation.action = action;
|
||||
}
|
||||
// node.update(this.logSerailNumber, {}, action);
|
||||
// pollute = true;
|
||||
// operations = node.composeOperations() || [];
|
||||
// assert(operations.length === 1);
|
||||
// const [operation1] = operations;
|
||||
// if (action !== operation1.operation.action) {
|
||||
// assert(operation1.operation.action === 'update'); // 如果execute时传action,前面update动作应该只可能是update
|
||||
// operation1.operation.action = action;
|
||||
// }
|
||||
/**
|
||||
* 上述写法会触发publish行为,如:一个close动作会导致页面像下面这样渲染:
|
||||
* opened --> closed(上面的node.update) --> opened(执行成功回来setExecuting时) --> closed(执行成功回来再sync cache后)
|
||||
*/
|
||||
operations.push({
|
||||
entity: node.getEntity(),
|
||||
operation: {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
action,
|
||||
data: {
|
||||
$$updateAt$$: Date.now(),
|
||||
},
|
||||
filter: node.getFilter(true),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (operations.length > 0) {
|
||||
|
|
@ -2473,9 +2489,9 @@ class RunningTree extends Feature_1.Feature {
|
|||
}
|
||||
catch (err) {
|
||||
node && node.setExecuting(false);
|
||||
if (pollute) {
|
||||
/* if (pollute) {
|
||||
path && this.clean(path);
|
||||
}
|
||||
} */
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
@ -144,7 +151,6 @@ function onPathSet(option, isPage) {
|
|||
};
|
||||
}
|
||||
}
|
||||
exports.onPathSet = onPathSet;
|
||||
function checkActionAttrsIfNecessary(cache, entity, action, id) {
|
||||
if (typeof action === 'string') {
|
||||
return action;
|
||||
|
|
@ -547,13 +553,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 {
|
||||
|
|
@ -567,7 +571,6 @@ async function loadMore() {
|
|||
}
|
||||
}
|
||||
}
|
||||
exports.loadMore = loadMore;
|
||||
async function execute(action, path, messageProps, //默认true
|
||||
opers) {
|
||||
if (this.state.oakExecuting) {
|
||||
|
|
@ -589,12 +592,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 join(path1, path2) {
|
||||
if (path2 === '..') {
|
||||
const array = path1.split('.');
|
||||
|
|
@ -621,7 +622,6 @@ function getFreshValue(path) {
|
|||
(0, assert_1.assert)(false);
|
||||
}
|
||||
}
|
||||
exports.getFreshValue = getFreshValue;
|
||||
function select(entity, selection) {
|
||||
const rollback = this.features.runningTree.begin();
|
||||
try {
|
||||
|
|
@ -638,4 +638,3 @@ function select(entity, selection) {
|
|||
(0, assert_1.assert)(false);
|
||||
}
|
||||
}
|
||||
exports.select = select;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -6,4 +5,4 @@ import { Feature } from './types/Feature';
|
|||
import { DataOption, OakComponentOption } from './types/Page';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends DataOption = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): string;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends DataOption = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): string;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
@ -886,4 +886,3 @@ function createComponent(option, features) {
|
|||
},
|
||||
});
|
||||
}
|
||||
exports.createComponent = createComponent;
|
||||
|
|
|
|||
|
|
@ -6,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<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { MessageProps } from './types/Message';
|
|||
import { NotificationProps } from './types/Notification';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): {
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): {
|
||||
new (props: ComponentProps<ED, T, TProperty>): {
|
||||
features: BasicFeatures<ED> & FD;
|
||||
oakOption: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>;
|
||||
|
|
@ -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>;
|
||||
} & 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 | undefined;
|
||||
}, path?: string | undefined): string;
|
||||
addItems<T_2 extends keyof ED>(data: (Omit<ED[T_2]["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_3 extends keyof ED>(data: ED[T_3]["Update"]["data"], id: string, action?: ED[T_3]["Action"] | undefined, path?: string | undefined): void;
|
||||
updateItems<T_4 extends keyof ED>(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<T_5 extends keyof ED>(data: ED[T_5]["Update"]["data"], action?: ED[T_5]["Action"] | undefined, path?: string | undefined): void;
|
||||
create<T_6 extends keyof ED>(data: Omit<ED[T_6]["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;
|
||||
addItems<T_1 extends keyof ED>(data: (Omit<ED[T_1]["CreateSingle"]["data"], "id"> & {
|
||||
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_7 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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
@ -744,4 +744,3 @@ function createComponent(option, features) {
|
|||
;
|
||||
return OakComponentWrapper;
|
||||
}
|
||||
exports.createComponent = createComponent;
|
||||
|
|
|
|||
|
|
@ -6,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<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export declare function createComponent<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any> = {}, TProperty extends DataOption = {}, TMethod extends Record<string, Function> = {}>(option: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>, features: BasicFeatures<ED> & FD): React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}>>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}>;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
import { BrowserRouterProps } from 'react-router-dom';
|
||||
export interface IBrowserRouterProps extends BrowserRouterProps {
|
||||
namespace: string;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
// (() => {
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
export type MapComponent = (props: {
|
||||
id?: string;
|
||||
center?: [number, number];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
/// <reference types="react" />
|
||||
export type NotificationProps = {
|
||||
message: React.ReactNode;
|
||||
description: React.ReactNode;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
@ -148,7 +146,7 @@ export type ComponentFullThisType<ED extends EntityDict & BaseEntityDict, T exte
|
|||
triggerEvent: <DetailType = any>(name: string, detail?: DetailType, options?: WechatMiniprogram.Component.TriggerEventOption) => void;
|
||||
oakLifetime: OakLifetime;
|
||||
} & OakCommonComponentMethods<ED, T> & OakListComponentMethods<ED, T> & OakSingleComponentMethods<ED, T>;
|
||||
export type OakComponentOption<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any>, TProperty extends DataOption, TMethod extends Record<string, Function>, EMethod extends Record<string, Function> = {}> = ComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod, EMethod> & Partial<{
|
||||
export type OakComponentOption<IsList extends boolean, ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>, FormedData extends Record<string, any>, TData extends Record<string, any>, TProperty extends DataOption, TMethod extends Record<string, Function>, EMethod extends Record<string, Function> = {}> = ComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod, EMethod> & Partial<{
|
||||
/**
|
||||
* 生命周期回调
|
||||
*/
|
||||
|
|
@ -353,7 +351,7 @@ export type OakComponentData<ED extends EntityDict & BaseEntityDict, T extends k
|
|||
type OakListComoponetData<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||
oakPagination?: Pagination;
|
||||
};
|
||||
export type MakeOakComponent<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, AsyncContext<ED>>>, FD extends Record<string, Feature>> = <IsList extends boolean, T extends keyof ED, FormedData extends DataOption, TData extends DataOption, TProperty extends DataOption, TMethod extends MethodOption>(options: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>) => (props: ReactComponentProps<ED, T, IsList, TProperty>) => React.ReactElement;
|
||||
export type MakeOakComponent<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>> = <IsList extends boolean, T extends keyof ED, FormedData extends DataOption, TData extends DataOption, TProperty extends DataOption, TMethod extends MethodOption>(options: OakComponentOption<IsList, ED, T, Cxt, FrontCxt, AD, FD, FormedData, TData, TProperty, TMethod>) => (props: ReactComponentProps<ED, T, IsList, TProperty>) => 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' | 'updateItems' | 'resetItem' | 'recoverItem' | 'recoverItems';
|
||||
export type WebComponentSingleMethodNames = 'update' | 'remove' | 'create' | 'isCreation' | 'getId' | 'setId';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue