增加了一个生命周期mature,当页面完成数据回调时调用
This commit is contained in:
parent
6a959ce6ad
commit
42b7600e51
|
|
@ -113,7 +113,7 @@ class UpdateLogManager {
|
|||
// 插入到最后一次update中
|
||||
const { action, filter, data } = oper2;
|
||||
let ids = action === 'create' ? [data.id] : getRelevantIds(filter);
|
||||
const key = JSON.stringify(ids.length > 0 ? { ids } : filter);
|
||||
const key = JSON.stringify(ids.length > 0 ? ids : filter);
|
||||
if (this.logs.length > 0) {
|
||||
const update = this.logs[this.logs.length - 1];
|
||||
assert(update.lsn <= lsn);
|
||||
|
|
@ -155,7 +155,8 @@ class UpdateLogManager {
|
|||
}
|
||||
}
|
||||
undo(filter) {
|
||||
const key = JSON.stringify(filter);
|
||||
const ids = getRelevantIds(filter);
|
||||
const key = JSON.stringify(ids.length > 0 ? ids : filter);
|
||||
this.logs.forEach((log) => {
|
||||
const { operations } = log;
|
||||
unset(operations, key);
|
||||
|
|
@ -524,7 +525,7 @@ class ListNode extends EntityNode {
|
|||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.schema, [
|
||||
...filter,
|
||||
...(filter || []),
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ const oakBehavior = Behavior({
|
|||
return;
|
||||
}
|
||||
const pathState = onPathSet.call(this, this.oakOption, this.iAmThePage());
|
||||
this.setState(pathState, () => {
|
||||
this.setState(pathState, async () => {
|
||||
if (this.prevState.oakFullpath === undefined) {
|
||||
// oakFullpath后置的情况,容一下错
|
||||
if (this.oakLifetime !== 'ready') {
|
||||
|
|
@ -486,7 +486,8 @@ const oakBehavior = Behavior({
|
|||
this.oakOption.lifetimes?.ready.call(this);
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
@ -649,6 +650,7 @@ export function createComponent(option, features) {
|
|||
await (onPullDownRefresh
|
||||
? onPullDownRefresh.call(this)
|
||||
: this.refresh());
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
this.setState({
|
||||
oakPullDownRefreshLoading: false,
|
||||
});
|
||||
|
|
@ -755,7 +757,7 @@ export function createComponent(option, features) {
|
|||
else {
|
||||
assert(typeof ele === 'object');
|
||||
const { feature, behavior, callback } = ele;
|
||||
this.addFeatureSub(feature, () => {
|
||||
this.addFeatureSub(feature, async () => {
|
||||
if (behavior) {
|
||||
switch (behavior) {
|
||||
case 'reRender': {
|
||||
|
|
@ -764,7 +766,8 @@ export function createComponent(option, features) {
|
|||
}
|
||||
default: {
|
||||
assert(behavior === 'refresh');
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -791,6 +794,7 @@ export function createComponent(option, features) {
|
|||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
try {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof OakException) {
|
||||
|
|
|
|||
|
|
@ -648,6 +648,7 @@ export function createComponent(option, features) {
|
|||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
@ -705,7 +706,8 @@ export function createComponent(option, features) {
|
|||
}
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import { createBrowserHistory } from 'history';
|
|||
import { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';
|
||||
import { ConfigProvider } from 'antd';
|
||||
import { StyleProvider, legacyLogicalPropertiesTransformer } from '@ant-design/cssinjs';
|
||||
import dayjs from 'dayjs';
|
||||
import { ResponsiveProvider } from '../responsive';
|
||||
import { FeaturesProvider } from '../features';
|
||||
import AppError from './AppError';
|
||||
import AppContainer from './AppContainer';
|
||||
import AppRouter from './AppRouter';
|
||||
// import { AliveScope, autoFixContext } from 'react-activation'
|
||||
import dayjs from 'dayjs';
|
||||
import 'dayjs/locale/zh-cn';
|
||||
import zhCN from 'antd/locale/zh_CN';
|
||||
import enUS from 'antd/locale/en_US';
|
||||
|
|
@ -23,7 +23,7 @@ export default function initialize(features, appName, routers, locales, error, f
|
|||
const history = createBrowserHistory();
|
||||
features.navigator.setHistory(history);
|
||||
const { language } = window.navigator;
|
||||
dayjs.locale(locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? 'zh-cn' : 'en-us');
|
||||
dayjs.locale(locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? 'zh-cn' : 'en-us');
|
||||
const Main = error ? (<HistoryRouter history={history}>
|
||||
<AppError error={error} features={features}/>
|
||||
</HistoryRouter>) : (<HistoryRouter history={history}>
|
||||
|
|
|
|||
|
|
@ -155,12 +155,12 @@ export type OakComponentOption<IsList extends boolean, ED extends EntityDict & B
|
|||
* 在组件实例刚刚被创建时执行
|
||||
* sync only
|
||||
*/
|
||||
created?(): void;
|
||||
created?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* sync only
|
||||
*/
|
||||
attached?(): void;
|
||||
attached?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* async or sync
|
||||
|
|
@ -170,18 +170,22 @@ export type OakComponentOption<IsList extends boolean, ED extends EntityDict & B
|
|||
* 小程序专用,在组件实例被移动到节点树另一个位置时执行
|
||||
* sync only
|
||||
*/
|
||||
moved?(): void;
|
||||
moved?(): any;
|
||||
/**
|
||||
* 在组件实例被从页面节点树移除时执行
|
||||
* sync only
|
||||
*/
|
||||
detached?(): void;
|
||||
detached?(): any;
|
||||
/**
|
||||
* 小程序专用,每当组件方法抛出错误时执行
|
||||
* sync only
|
||||
* @param err 错误信息
|
||||
*/
|
||||
error?(err: Error): void;
|
||||
error?(err: Error): any;
|
||||
/**
|
||||
* 当页面取数完成后回调
|
||||
*/
|
||||
mature?(): any;
|
||||
/**
|
||||
* 组件所在的页面被展示时执行
|
||||
* sync only
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ class ListNode extends EntityNode {
|
|||
id: 1,
|
||||
},
|
||||
filter: (0, filter_1.combineFilters)(this.entity, this.schema, [
|
||||
...filter,
|
||||
...(filter || []),
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ const oakBehavior = Behavior({
|
|||
return;
|
||||
}
|
||||
const pathState = page_common_1.onPathSet.call(this, this.oakOption, this.iAmThePage());
|
||||
this.setState(pathState, () => {
|
||||
this.setState(pathState, async () => {
|
||||
if (this.prevState.oakFullpath === undefined) {
|
||||
// oakFullpath后置的情况,容一下错
|
||||
if (this.oakLifetime !== 'ready') {
|
||||
|
|
@ -489,7 +489,8 @@ const oakBehavior = Behavior({
|
|||
this.oakOption.lifetimes?.ready.call(this);
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
@ -652,6 +653,7 @@ function createComponent(option, features) {
|
|||
await (onPullDownRefresh
|
||||
? onPullDownRefresh.call(this)
|
||||
: this.refresh());
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
this.setState({
|
||||
oakPullDownRefreshLoading: false,
|
||||
});
|
||||
|
|
@ -758,7 +760,7 @@ function createComponent(option, features) {
|
|||
else {
|
||||
(0, assert_1.assert)(typeof ele === 'object');
|
||||
const { feature, behavior, callback } = ele;
|
||||
this.addFeatureSub(feature, () => {
|
||||
this.addFeatureSub(feature, async () => {
|
||||
if (behavior) {
|
||||
switch (behavior) {
|
||||
case 'reRender': {
|
||||
|
|
@ -767,7 +769,8 @@ function createComponent(option, features) {
|
|||
}
|
||||
default: {
|
||||
(0, assert_1.assert)(behavior === 'refresh');
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -794,6 +797,7 @@ function createComponent(option, features) {
|
|||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
try {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof types_1.OakException) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from 'react';
|
||||
import { Aspect, EntityDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { BasicFeatures } from './features';
|
||||
|
|
@ -5,4 +6,4 @@ import { Feature } from './types/Feature';
|
|||
import { DataOption, OakComponentOption } from './types/Page';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
export declare function createComponent<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): any;
|
||||
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>>;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import React from 'react';
|
||||
import { Aspect, CheckerType, EntityDict, OpRecord } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { BasicFeatures } from './features';
|
||||
import { NamedFilterItem, NamedSorterItem } from './types/NamedCondition';
|
||||
import { Feature } from './types/Feature';
|
||||
import { DataOption, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
||||
import { DataOption, ComponentData, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
||||
import { MessageProps } from './types/Message';
|
||||
import { NotificationProps } from './types/Notification';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
|
|
@ -103,5 +104,23 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
|
|||
setPageSize(pageSize: number, path?: string | undefined): void;
|
||||
setCurrentPage(currentPage: number, path?: string | undefined): 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;
|
||||
forceUpdate(callback?: (() => void) | undefined): void;
|
||||
readonly props: Readonly<ComponentProps<ED, T, TProperty>>;
|
||||
state: Readonly<ComponentData<ED, T, FormedData, TData>>;
|
||||
refs: {
|
||||
[key: string]: React.ReactInstance;
|
||||
};
|
||||
shouldComponentUpdate?(nextProps: Readonly<ComponentProps<ED, T, TProperty>>, nextState: Readonly<ComponentData<ED, T, FormedData, TData>>, nextContext: any): boolean;
|
||||
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
||||
getSnapshotBeforeUpdate?(prevProps: Readonly<ComponentProps<ED, T, TProperty>>, prevState: Readonly<ComponentData<ED, T, FormedData, TData>>): any;
|
||||
componentWillMount?(): void;
|
||||
UNSAFE_componentWillMount?(): void;
|
||||
componentWillReceiveProps?(nextProps: Readonly<ComponentProps<ED, T, TProperty>>, nextContext: any): void;
|
||||
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<ComponentProps<ED, T, TProperty>>, nextContext: any): void;
|
||||
componentWillUpdate?(nextProps: Readonly<ComponentProps<ED, T, TProperty>>, nextState: Readonly<ComponentData<ED, T, FormedData, TData>>, nextContext: any): void;
|
||||
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps<ED, T, TProperty>>, nextState: Readonly<ComponentData<ED, T, FormedData, TData>>, nextContext: any): void;
|
||||
};
|
||||
contextType?: React.Context<any> | undefined;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -653,6 +653,7 @@ function createComponent(option, features) {
|
|||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
@ -710,7 +711,8 @@ function createComponent(option, features) {
|
|||
}
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from 'react';
|
||||
import { Aspect, EntityDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { BasicFeatures } from './features';
|
||||
|
|
@ -5,4 +6,4 @@ import { Feature } from './types/Feature';
|
|||
import { DataOption, OakComponentOption } from './types/Page';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
export declare function createComponent<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): any;
|
||||
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>>;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.createComponent = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const react_1 = tslib_1.__importDefault(require("react"));
|
||||
const withRouter_1 = tslib_1.__importDefault(require("./platforms/web/router/withRouter"));
|
||||
const PullToRefresh_1 = tslib_1.__importDefault(require("./platforms/web/PullToRefresh"));
|
||||
const page_react_1 = require("./page.react");
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ type Props = {
|
|||
features: Record<string, Feature>;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
declare const FeaturesProvider: (props: Props) => any;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||
declare const FeaturesProvider: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => FD2;
|
||||
export { FeaturesProvider, useFeatures };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
type OakComponentProperties = {
|
||||
path?: string;
|
||||
properties?: Record<string, any>;
|
||||
};
|
||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => any;
|
||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export default withRouter;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from 'react';
|
||||
import 'nprogress/nprogress.css';
|
||||
declare const _default: any;
|
||||
declare const _default: React.MemoExoticComponent<() => null>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const react_1 = tslib_1.__importDefault(require("react"));
|
||||
const rmc_pull_to_refresh_1 = tslib_1.__importDefault(require("rmc-pull-to-refresh"));
|
||||
require("./PullToRefresh.css");
|
||||
const OakPullToRefresh = (props) => {
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ declare const FeaturesProvider: React.FC<{
|
|||
features: Record<string, Feature>;
|
||||
children: React.ReactNode;
|
||||
}>;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => FD2;
|
||||
export { FeaturesProvider, useFeatures };
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import React from 'react';
|
|||
type AppContainerProps = {
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
declare const AppContainer: (props: AppContainerProps) => any;
|
||||
declare const AppContainer: (props: AppContainerProps) => import("react/jsx-runtime").JSX.Element;
|
||||
export default AppContainer;
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ interface ErrorProps<ED extends EntityDict & BaseEntityDict> {
|
|||
error: any;
|
||||
features: BasicFeatures<ED>;
|
||||
}
|
||||
declare function Error<ED extends EntityDict & BaseEntityDict>(props: ErrorProps<ED>): any;
|
||||
declare function Error<ED extends EntityDict & BaseEntityDict>(props: ErrorProps<ED>): import("react/jsx-runtime").JSX.Element;
|
||||
export default Error;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,34 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
const react_1 = tslib_1.__importStar(require("react"));
|
||||
const react_1 = require("react");
|
||||
const antd_1 = require("antd");
|
||||
const Exception_1 = require("oak-domain/lib/types/Exception");
|
||||
const ErrorPage_1 = require("../../../types/ErrorPage");
|
||||
const ErrorPage = (0, react_1.lazy)(() => Promise.resolve().then(() => tslib_1.__importStar(require('../../../components/errorPage'))));
|
||||
const ErrorPage = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../../../components/errorPage'))));
|
||||
function Error(props) {
|
||||
const { error, features } = props;
|
||||
const { locales } = features;
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ declare const AppRouter: <ED extends BaseEntityDict>(props: {
|
|||
routers: IRouter[];
|
||||
appName: string;
|
||||
features: BasicFeatures<ED>;
|
||||
}) => any;
|
||||
}) => import("react/jsx-runtime").JSX.Element;
|
||||
export default AppRouter;
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||
// @ts-nocheck
|
||||
const react_1 = tslib_1.__importDefault(require("react"));
|
||||
const client_1 = tslib_1.__importDefault(require("react-dom/client"));
|
||||
const history_1 = require("history");
|
||||
const react_router_dom_1 = require("react-router-dom");
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import React from 'react';
|
||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
export type Keys = Width[];
|
||||
export type Values = {
|
||||
|
|
@ -15,4 +16,6 @@ export type Breakpoints = {
|
|||
export declare const keys: Keys;
|
||||
export declare const values: Values;
|
||||
export declare const defaultBreakpoints: Breakpoints;
|
||||
export declare const ResponsiveContext: any;
|
||||
export declare const ResponsiveContext: React.Context<{
|
||||
breakpoints?: Breakpoints | undefined;
|
||||
}>;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
type OakComponentProperties = {
|
||||
path?: string;
|
||||
properties?: Record<string, any>;
|
||||
};
|
||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => any;
|
||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
||||
export default withRouter;
|
||||
|
|
|
|||
|
|
@ -155,12 +155,12 @@ export type OakComponentOption<IsList extends boolean, ED extends EntityDict & B
|
|||
* 在组件实例刚刚被创建时执行
|
||||
* sync only
|
||||
*/
|
||||
created?(): void;
|
||||
created?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* sync only
|
||||
*/
|
||||
attached?(): void;
|
||||
attached?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* async or sync
|
||||
|
|
@ -170,18 +170,22 @@ export type OakComponentOption<IsList extends boolean, ED extends EntityDict & B
|
|||
* 小程序专用,在组件实例被移动到节点树另一个位置时执行
|
||||
* sync only
|
||||
*/
|
||||
moved?(): void;
|
||||
moved?(): any;
|
||||
/**
|
||||
* 在组件实例被从页面节点树移除时执行
|
||||
* sync only
|
||||
*/
|
||||
detached?(): void;
|
||||
detached?(): any;
|
||||
/**
|
||||
* 小程序专用,每当组件方法抛出错误时执行
|
||||
* sync only
|
||||
* @param err 错误信息
|
||||
*/
|
||||
error?(err: Error): void;
|
||||
error?(err: Error): any;
|
||||
/**
|
||||
* 当页面取数完成后回调
|
||||
*/
|
||||
mature?(): any;
|
||||
/**
|
||||
* 组件所在的页面被展示时执行
|
||||
* sync only
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ class ListNode<
|
|||
id: 1,
|
||||
},
|
||||
filter: combineFilters(this.entity, this.schema, [
|
||||
...filter!,
|
||||
...(filter || []),
|
||||
{
|
||||
id: {
|
||||
$in: intersected,
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ const oakBehavior = Behavior<
|
|||
this.oakOption as any,
|
||||
this.iAmThePage()
|
||||
);
|
||||
this.setState(pathState as any, () => {
|
||||
this.setState(pathState as any, async () => {
|
||||
if (this.prevState.oakFullpath === undefined) {
|
||||
// oakFullpath后置的情况,容一下错
|
||||
if (this.oakLifetime !== 'ready') {
|
||||
|
|
@ -710,7 +710,8 @@ const oakBehavior = Behavior<
|
|||
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature();
|
||||
} else {
|
||||
this.reRender();
|
||||
}
|
||||
|
|
@ -968,6 +969,7 @@ export function createComponent<
|
|||
? onPullDownRefresh.call(this)
|
||||
: this.refresh()
|
||||
);
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
this.setState({
|
||||
oakPullDownRefreshLoading: false as any,
|
||||
});
|
||||
|
|
@ -1075,7 +1077,7 @@ export function createComponent<
|
|||
} else {
|
||||
assert(typeof ele === 'object');
|
||||
const { feature, behavior, callback } = ele;
|
||||
this.addFeatureSub(feature as string, () => {
|
||||
this.addFeatureSub(feature as string, async () => {
|
||||
if (behavior) {
|
||||
switch (behavior) {
|
||||
case 'reRender': {
|
||||
|
|
@ -1084,7 +1086,8 @@ export function createComponent<
|
|||
}
|
||||
default: {
|
||||
assert(behavior === 'refresh');
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1116,6 +1119,7 @@ export function createComponent<
|
|||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
try {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
catch (err) {
|
||||
if (err instanceof OakException) {
|
||||
|
|
|
|||
|
|
@ -981,6 +981,7 @@ export function createComponent<
|
|||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
@ -1048,7 +1049,8 @@ export function createComponent<
|
|||
}
|
||||
const { oakFullpath } = this.state;
|
||||
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
|
||||
this.refresh();
|
||||
await this.refresh();
|
||||
lifetimes?.mature && lifetimes.mature();
|
||||
}
|
||||
else {
|
||||
this.reRender();
|
||||
|
|
|
|||
|
|
@ -332,12 +332,12 @@ export type OakComponentOption<
|
|||
* 在组件实例刚刚被创建时执行
|
||||
* sync only
|
||||
*/
|
||||
created?(): void;
|
||||
created?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* sync only
|
||||
*/
|
||||
attached?(): void;
|
||||
attached?(): any;
|
||||
/**
|
||||
* 在组件实例进入页面节点树时执行
|
||||
* async or sync
|
||||
|
|
@ -347,18 +347,22 @@ export type OakComponentOption<
|
|||
* 小程序专用,在组件实例被移动到节点树另一个位置时执行
|
||||
* sync only
|
||||
*/
|
||||
moved?(): void;
|
||||
moved?(): any;
|
||||
/**
|
||||
* 在组件实例被从页面节点树移除时执行
|
||||
* sync only
|
||||
*/
|
||||
detached?(): void;
|
||||
detached?(): any;
|
||||
/**
|
||||
* 小程序专用,每当组件方法抛出错误时执行
|
||||
* sync only
|
||||
* @param err 错误信息
|
||||
*/
|
||||
error?(err: Error): void;
|
||||
error?(err: Error): any;
|
||||
/**
|
||||
* 当页面取数完成后回调
|
||||
*/
|
||||
mature?(): any;
|
||||
/**
|
||||
* 组件所在的页面被展示时执行
|
||||
* sync only
|
||||
|
|
|
|||
Loading…
Reference in New Issue