为clean增加了dontPublish参数
This commit is contained in:
parent
896711588f
commit
2c80c5b077
|
|
@ -117,7 +117,7 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
||||||
getProjection(): ED[T]["Selection"]["data"] | undefined;
|
getProjection(): ED[T]["Selection"]["data"] | undefined;
|
||||||
private constructFilters;
|
private constructFilters;
|
||||||
constructSelection(withParent?: true, ignoreNewParent?: boolean, ignoreUnapplied?: true): {
|
constructSelection(withParent?: true, ignoreNewParent?: boolean, ignoreUnapplied?: true): {
|
||||||
data: ED[T]["Selection"]["data"];
|
data: ED[T]["Selection"]["data"] | undefined;
|
||||||
filter: ED[T]["Selection"]["filter"] | undefined;
|
filter: ED[T]["Selection"]["filter"] | undefined;
|
||||||
sorter: ED[T]["Selection"]["sorter"];
|
sorter: ED[T]["Selection"]["sorter"];
|
||||||
total: number | undefined;
|
total: number | undefined;
|
||||||
|
|
@ -131,7 +131,7 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
||||||
refresh(pageNumber?: number, append?: boolean): Promise<void>;
|
refresh(pageNumber?: number, append?: boolean): Promise<void>;
|
||||||
loadMore(): Promise<void>;
|
loadMore(): Promise<void>;
|
||||||
setCurrentPage(currentPage: number): void;
|
setCurrentPage(currentPage: number): void;
|
||||||
clean(): void;
|
clean(dontPublish?: true): void;
|
||||||
getIntrinsticFilters(): ED[T]["Selection"]["filter"] | undefined;
|
getIntrinsticFilters(): ED[T]["Selection"]["filter"] | undefined;
|
||||||
}
|
}
|
||||||
declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends Node<ED, T> {
|
declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends Node<ED, T> {
|
||||||
|
|
@ -179,7 +179,7 @@ declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof
|
||||||
private passRsToChild;
|
private passRsToChild;
|
||||||
saveRefreshResult(data: Record<string, any>): void;
|
saveRefreshResult(data: Record<string, any>): void;
|
||||||
refresh(): Promise<void>;
|
refresh(): Promise<void>;
|
||||||
clean(): void;
|
clean(dontPublish?: true): void;
|
||||||
private getFilter;
|
private getFilter;
|
||||||
getIntrinsticFilters(): ED[T]["Selection"]["filter"] | undefined;
|
getIntrinsticFilters(): ED[T]["Selection"]["filter"] | undefined;
|
||||||
/**
|
/**
|
||||||
|
|
@ -217,7 +217,7 @@ declare class VirtualNode<ED extends EntityDict & BaseEntityDict> extends Featur
|
||||||
setExecuting(executing: boolean): void;
|
setExecuting(executing: boolean): void;
|
||||||
isExecuting(): boolean;
|
isExecuting(): boolean;
|
||||||
isLoading(): boolean;
|
isLoading(): boolean;
|
||||||
clean(): void;
|
clean(dontPublish?: true): void;
|
||||||
checkIfClean(): void;
|
checkIfClean(): void;
|
||||||
}
|
}
|
||||||
export type CreateNodeOptions<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
export type CreateNodeOptions<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||||
|
|
|
||||||
|
|
@ -726,7 +726,7 @@ class ListNode extends Node {
|
||||||
constructSelection(withParent, ignoreNewParent, ignoreUnapplied) {
|
constructSelection(withParent, ignoreNewParent, ignoreUnapplied) {
|
||||||
const { sorters, getTotal } = this;
|
const { sorters, getTotal } = this;
|
||||||
const data = this.getProjection();
|
const data = this.getProjection();
|
||||||
// (0, assert_1.assert)(data, '取数据时找不到projection信息');
|
// assert(data, '取数据时找不到projection信息');
|
||||||
const sorterArr = sorters.filter(ele => !ignoreUnapplied || ele.applied).map((ele) => {
|
const sorterArr = sorters.filter(ele => !ignoreUnapplied || ele.applied).map((ele) => {
|
||||||
const { sorter } = ele;
|
const { sorter } = ele;
|
||||||
if (typeof sorter === 'function') {
|
if (typeof sorter === 'function') {
|
||||||
|
|
@ -841,15 +841,17 @@ class ListNode extends Node {
|
||||||
setCurrentPage(currentPage) {
|
setCurrentPage(currentPage) {
|
||||||
this.refresh(currentPage, false);
|
this.refresh(currentPage, false);
|
||||||
}
|
}
|
||||||
clean() {
|
clean(dontPublish) {
|
||||||
if (this.dirty) {
|
if (this.dirty) {
|
||||||
const originUpdates = this.updates;
|
const originUpdates = this.updates;
|
||||||
this.updates = {};
|
this.updates = {};
|
||||||
for (const k in this.children) {
|
for (const k in this.children) {
|
||||||
this.children[k].clean();
|
this.children[k].clean(dontPublish);
|
||||||
}
|
}
|
||||||
this.dirty = undefined;
|
this.dirty = undefined;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查看这个list上所有数据必须遵守的限制
|
// 查看这个list上所有数据必须遵守的限制
|
||||||
|
|
@ -1117,14 +1119,14 @@ class SingleNode extends Node {
|
||||||
if (attr === 'entityId') {
|
if (attr === 'entityId') {
|
||||||
(0, assert_1.assert)(data.entity, '设置entityId时请将entity也传入');
|
(0, assert_1.assert)(data.entity, '设置entityId时请将entity也传入');
|
||||||
if (this.children[data.entity]) {
|
if (this.children[data.entity]) {
|
||||||
this.children[data.entity].clean();
|
this.children[data.entity].clean(true);
|
||||||
this.passRsToChild(data.entity);
|
this.passRsToChild(data.entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.schema[this.entity].attributes[attr]?.type === 'ref') {
|
else if (this.schema[this.entity].attributes[attr]?.type === 'ref') {
|
||||||
const refKey = attr.slice(0, attr.length - 2);
|
const refKey = attr.slice(0, attr.length - 2);
|
||||||
if (this.children[refKey]) {
|
if (this.children[refKey]) {
|
||||||
this.children[refKey].clean();
|
this.children[refKey].clean(true);
|
||||||
this.passRsToChild(refKey);
|
this.passRsToChild(refKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1331,14 +1333,16 @@ class SingleNode extends Node {
|
||||||
this.publish();
|
this.publish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clean() {
|
clean(dontPublish) {
|
||||||
if (this.dirty) {
|
if (this.dirty) {
|
||||||
this.operation = undefined;
|
this.operation = undefined;
|
||||||
for (const child in this.children) {
|
for (const child in this.children) {
|
||||||
this.children[child].clean();
|
this.children[child].clean(dontPublish);
|
||||||
}
|
}
|
||||||
this.dirty = undefined;
|
this.dirty = undefined;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getFilter() {
|
getFilter() {
|
||||||
|
|
@ -1550,12 +1554,14 @@ class VirtualNode extends Feature_1.Feature {
|
||||||
isLoading() {
|
isLoading() {
|
||||||
return this.loading;
|
return this.loading;
|
||||||
}
|
}
|
||||||
clean() {
|
clean(dontPublish) {
|
||||||
for (const ele in this.children) {
|
for (const ele in this.children) {
|
||||||
this.children[ele].clean();
|
this.children[ele].clean(dontPublish);
|
||||||
}
|
}
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
checkIfClean() {
|
checkIfClean() {
|
||||||
for (const k in this.children) {
|
for (const k in this.children) {
|
||||||
|
|
@ -2044,7 +2050,7 @@ class RunningTree extends Feature_1.Feature {
|
||||||
.filter((ele) => !!ele)
|
.filter((ele) => !!ele)
|
||||||
.map((ele) => ele.operation), undefined, () => {
|
.map((ele) => ele.operation), undefined, () => {
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
node.clean();
|
node.clean(true);
|
||||||
if (node instanceof SingleNode) {
|
if (node instanceof SingleNode) {
|
||||||
(0, assert_1.assert)(operations.length === 1);
|
(0, assert_1.assert)(operations.length === 1);
|
||||||
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
||||||
|
|
@ -2058,7 +2064,7 @@ class RunningTree extends Feature_1.Feature {
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
node.clean();
|
node.clean(true);
|
||||||
node.setExecuting(false);
|
node.setExecuting(false);
|
||||||
return { message: 'No Operation' };
|
return { message: 'No Operation' };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,11 +163,11 @@ const oakBehavior = Behavior({
|
||||||
switchTab(option, state) {
|
switchTab(option, state) {
|
||||||
return this.features.navigator.switchTab(option, state);
|
return this.features.navigator.switchTab(option, state);
|
||||||
},
|
},
|
||||||
clean(path) {
|
clean(dontPublish, path) {
|
||||||
const path2 = path
|
const path2 = path
|
||||||
? `${this.state.oakFullpath}.${path}`
|
? `${this.state.oakFullpath}.${path}`
|
||||||
: this.state.oakFullpath;
|
: this.state.oakFullpath;
|
||||||
return this.features.runningTree.clean(path2);
|
return this.features.runningTree.clean(path2, dontPublish);
|
||||||
},
|
},
|
||||||
isDirty(path) {
|
isDirty(path) {
|
||||||
return this.features.runningTree.isDirty(path || this.state.oakFullpath);
|
return this.features.runningTree.isDirty(path || this.state.oakFullpath);
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,4 @@ import { Feature } from './types/Feature';
|
||||||
import { DataOption, OakComponentOption } from './types/Page';
|
import { DataOption, OakComponentOption } from './types/Page';
|
||||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
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): (props: any) => import("react/jsx-runtime").JSX.Element;
|
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): (props: any) => any;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import React from 'react';
|
|
||||||
import { Aspect, CheckerType, EntityDict, OpRecord } from 'oak-domain/lib/types';
|
import { Aspect, CheckerType, EntityDict, OpRecord } from 'oak-domain/lib/types';
|
||||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||||
import { BasicFeatures } from './features';
|
import { BasicFeatures } from './features';
|
||||||
import { NamedFilterItem, NamedSorterItem } from './types/NamedCondition';
|
import { NamedFilterItem, NamedSorterItem } from './types/NamedCondition';
|
||||||
import { Feature } from './types/Feature';
|
import { Feature } from './types/Feature';
|
||||||
import { DataOption, ComponentData, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
import { DataOption, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
||||||
import { MessageProps } from './types/Message';
|
import { MessageProps } from './types/Message';
|
||||||
import { NotificationProps } from './types/Notification';
|
import { NotificationProps } from './types/Notification';
|
||||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||||
|
|
@ -64,7 +63,7 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
|
||||||
create<T_4 extends keyof ED>(data: Omit<ED[T_4]["CreateSingle"]["data"], "id">, path?: string | undefined): void;
|
create<T_4 extends keyof ED>(data: Omit<ED[T_4]["CreateSingle"]["data"], "id">, path?: string | undefined): void;
|
||||||
remove(path?: string | undefined): void;
|
remove(path?: string | undefined): void;
|
||||||
isCreation(path?: string | undefined): boolean;
|
isCreation(path?: string | undefined): boolean;
|
||||||
clean(path?: string | undefined): void;
|
clean(dontPublish?: true | undefined, path?: string | undefined): void;
|
||||||
t(key: string, params?: object | undefined): string;
|
t(key: string, params?: object | undefined): string;
|
||||||
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps | undefined, path?: string | undefined, opers?: {
|
execute(action?: ED[T]["Action"] | undefined, messageProps?: boolean | MessageProps | undefined, path?: string | undefined, opers?: {
|
||||||
entity: T;
|
entity: T;
|
||||||
|
|
@ -101,23 +100,5 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
|
||||||
setCurrentPage(currentPage: number, path?: string | undefined): void;
|
setCurrentPage(currentPage: number, path?: string | undefined): void;
|
||||||
subDataEvents(events: string[], moduleName: string, callback: (event: string, opRecords: OpRecord<ED>[]) => void): Promise<void>;
|
subDataEvents(events: string[], moduleName: string, callback: (event: string, opRecords: OpRecord<ED>[]) => void): Promise<void>;
|
||||||
unsubDataEvents(events: string[], moduleName: string): Promise<void>;
|
unsubDataEvents(events: string[], moduleName: string): 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;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -157,11 +157,11 @@ class OakComponentBase extends react_1.default.PureComponent {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clean(path) {
|
clean(dontPublish, path) {
|
||||||
const path2 = path
|
const path2 = path
|
||||||
? `${this.state.oakFullpath}.${path}`
|
? `${this.state.oakFullpath}.${path}`
|
||||||
: this.state.oakFullpath;
|
: this.state.oakFullpath;
|
||||||
this.features.runningTree.clean(path2);
|
this.features.runningTree.clean(path2, dontPublish);
|
||||||
}
|
}
|
||||||
t(key, params) {
|
t(key, params) {
|
||||||
return this.features.locales.t(key, params);
|
return this.features.locales.t(key, params);
|
||||||
|
|
@ -456,8 +456,8 @@ function createComponent(option, features) {
|
||||||
redirectTo: (options, state, disableNamespace) => {
|
redirectTo: (options, state, disableNamespace) => {
|
||||||
return this.redirectTo(options, state, disableNamespace);
|
return this.redirectTo(options, state, disableNamespace);
|
||||||
},
|
},
|
||||||
clean: (path) => {
|
clean: (dontPublish, path) => {
|
||||||
return this.clean(path);
|
return this.clean(dontPublish, path);
|
||||||
},
|
},
|
||||||
checkOperation: (entity, operation, checkerTypes) => {
|
checkOperation: (entity, operation, checkerTypes) => {
|
||||||
return this.checkOperation(entity, operation, checkerTypes);
|
return this.checkOperation(entity, operation, checkerTypes);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import React from 'react';
|
|
||||||
import { Aspect, EntityDict } from 'oak-domain/lib/types';
|
import { Aspect, EntityDict } from 'oak-domain/lib/types';
|
||||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||||
import { BasicFeatures } from './features';
|
import { BasicFeatures } from './features';
|
||||||
|
|
@ -6,4 +5,4 @@ import { Feature } from './types/Feature';
|
||||||
import { DataOption, OakComponentOption } from './types/Page';
|
import { DataOption, OakComponentOption } from './types/Page';
|
||||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
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, 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;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.createComponent = void 0;
|
exports.createComponent = void 0;
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
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 withRouter_1 = tslib_1.__importDefault(require("./platforms/web/router/withRouter"));
|
||||||
const PullToRefresh_1 = tslib_1.__importDefault(require("./platforms/web/PullToRefresh"));
|
const PullToRefresh_1 = tslib_1.__importDefault(require("./platforms/web/PullToRefresh"));
|
||||||
const page_react_1 = require("./page.react");
|
const page_react_1 = require("./page.react");
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,6 @@ type Props = {
|
||||||
features: Record<string, Feature>;
|
features: Record<string, Feature>;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
declare const FeaturesProvider: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
declare const FeaturesProvider: (props: Props) => any;
|
||||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => FD2;
|
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||||
export { FeaturesProvider, useFeatures };
|
export { FeaturesProvider, useFeatures };
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
|
||||||
type OakComponentProperties = {
|
type OakComponentProperties = {
|
||||||
path?: string;
|
path?: string;
|
||||||
properties?: Record<string, any>;
|
properties?: Record<string, any>;
|
||||||
};
|
};
|
||||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => (props: any) => import("react/jsx-runtime").JSX.Element;
|
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => (props: any) => any;
|
||||||
export default withRouter;
|
export default withRouter;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const tslib_1 = require("tslib");
|
||||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
||||||
|
const react_1 = tslib_1.__importDefault(require("react"));
|
||||||
const assert_1 = require("oak-domain/lib/utils/assert");
|
const assert_1 = require("oak-domain/lib/utils/assert");
|
||||||
function getParams(params, properties) {
|
function getParams(params, properties) {
|
||||||
const props = getProps(params, properties);
|
const props = getProps(params, properties);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const tslib_1 = require("tslib");
|
const tslib_1 = require("tslib");
|
||||||
const jsx_runtime_1 = require("react/jsx-runtime");
|
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"));
|
const rmc_pull_to_refresh_1 = tslib_1.__importDefault(require("rmc-pull-to-refresh"));
|
||||||
require("./PullToRefresh.css");
|
require("./PullToRefresh.css");
|
||||||
const OakPullToRefresh = (props) => {
|
const OakPullToRefresh = (props) => {
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@ declare const FeaturesProvider: React.FC<{
|
||||||
features: Record<string, Feature>;
|
features: Record<string, Feature>;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}>;
|
}>;
|
||||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => FD2;
|
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||||
export { FeaturesProvider, useFeatures };
|
export { FeaturesProvider, useFeatures };
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import React from 'react';
|
|
||||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||||
export type Keys = Width[];
|
export type Keys = Width[];
|
||||||
export type Values = {
|
export type Values = {
|
||||||
|
|
@ -16,6 +15,4 @@ export type Breakpoints = {
|
||||||
export declare const keys: Keys;
|
export declare const keys: Keys;
|
||||||
export declare const values: Values;
|
export declare const values: Values;
|
||||||
export declare const defaultBreakpoints: Breakpoints;
|
export declare const defaultBreakpoints: Breakpoints;
|
||||||
export declare const ResponsiveContext: React.Context<{
|
export declare const ResponsiveContext: any;
|
||||||
breakpoints?: Breakpoints | undefined;
|
|
||||||
}>;
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
|
||||||
type OakComponentProperties = {
|
type OakComponentProperties = {
|
||||||
path?: string;
|
path?: string;
|
||||||
properties?: Record<string, any>;
|
properties?: Record<string, any>;
|
||||||
};
|
};
|
||||||
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => React.ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
declare const withRouter: (Component: React.ComponentType<any>, { path, properties }: OakComponentProperties) => any;
|
||||||
export default withRouter;
|
export default withRouter;
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export type OakCommonComponentMethods<ED extends EntityDict & BaseEntityDict, T
|
||||||
navigateBack: (delta?: number) => Promise<void>;
|
navigateBack: (delta?: number) => Promise<void>;
|
||||||
redirectTo: <T2 extends keyof ED>(options: Parameters<typeof wx.redirectTo>[0] & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean) => Promise<void>;
|
redirectTo: <T2 extends keyof ED>(options: Parameters<typeof wx.redirectTo>[0] & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean) => Promise<void>;
|
||||||
switchTab: <T2 extends keyof ED>(options: Parameters<typeof wx.switchTab>[0] & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean) => Promise<void>;
|
switchTab: <T2 extends keyof ED>(options: Parameters<typeof wx.switchTab>[0] & OakNavigateToParameters<ED, T2>, state?: Record<string, any>, disableNamespace?: boolean) => Promise<void>;
|
||||||
clean: (path?: string) => void;
|
clean: (dontPublish?: true, path?: string) => void;
|
||||||
isDirty: (path?: string) => boolean;
|
isDirty: (path?: string) => boolean;
|
||||||
t(key: string, params?: object): string;
|
t(key: string, params?: object): string;
|
||||||
execute: (action?: ED[T]['Action'], messageProps?: boolean | MessageProps, path?: string, opers?: Array<{
|
execute: (action?: ED[T]['Action'], messageProps?: boolean | MessageProps, path?: string, opers?: Array<{
|
||||||
|
|
|
||||||
|
|
@ -1027,16 +1027,18 @@ class ListNode<
|
||||||
this.refresh(currentPage, false);
|
this.refresh(currentPage, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean(dontPublish?: true) {
|
||||||
if (this.dirty) {
|
if (this.dirty) {
|
||||||
const originUpdates = this.updates;
|
const originUpdates = this.updates;
|
||||||
this.updates = {};
|
this.updates = {};
|
||||||
for (const k in this.children) {
|
for (const k in this.children) {
|
||||||
this.children[k].clean();
|
this.children[k].clean(dontPublish);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dirty = undefined;
|
this.dirty = undefined;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1346,14 +1348,14 @@ class SingleNode<ED extends EntityDict & BaseEntityDict,
|
||||||
if (attr === 'entityId') {
|
if (attr === 'entityId') {
|
||||||
assert(data.entity, '设置entityId时请将entity也传入');
|
assert(data.entity, '设置entityId时请将entity也传入');
|
||||||
if (this.children[data.entity]) {
|
if (this.children[data.entity]) {
|
||||||
this.children[data.entity].clean();
|
this.children[data.entity].clean(true);
|
||||||
this.passRsToChild(data.entity);
|
this.passRsToChild(data.entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.schema[this.entity]!.attributes[attr as any]?.type === 'ref') {
|
else if (this.schema[this.entity]!.attributes[attr as any]?.type === 'ref') {
|
||||||
const refKey = attr.slice(0, attr.length - 2);
|
const refKey = attr.slice(0, attr.length - 2);
|
||||||
if (this.children[refKey]) {
|
if (this.children[refKey]) {
|
||||||
this.children[refKey].clean();
|
this.children[refKey].clean(true);
|
||||||
this.passRsToChild(refKey);
|
this.passRsToChild(refKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1579,15 +1581,17 @@ class SingleNode<ED extends EntityDict & BaseEntityDict,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean(dontPublish?: true) {
|
||||||
if (this.dirty) {
|
if (this.dirty) {
|
||||||
this.operation = undefined;
|
this.operation = undefined;
|
||||||
for (const child in this.children) {
|
for (const child in this.children) {
|
||||||
this.children[child]!.clean();
|
this.children[child]!.clean(dontPublish);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dirty = undefined;
|
this.dirty = undefined;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1826,12 +1830,14 @@ class VirtualNode<
|
||||||
return this.loading;
|
return this.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean(dontPublish?: true) {
|
||||||
for (const ele in this.children) {
|
for (const ele in this.children) {
|
||||||
this.children[ele].clean();
|
this.children[ele].clean(dontPublish);
|
||||||
}
|
}
|
||||||
this.dirty = false;
|
this.dirty = false;
|
||||||
this.publish();
|
if (!dontPublish) {
|
||||||
|
this.publish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
checkIfClean() {
|
checkIfClean() {
|
||||||
for (const k in this.children) {
|
for (const k in this.children) {
|
||||||
|
|
@ -2506,7 +2512,7 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
undefined,
|
undefined,
|
||||||
() => {
|
() => {
|
||||||
// 清空缓存
|
// 清空缓存
|
||||||
node.clean();
|
node.clean(true);
|
||||||
if (node instanceof SingleNode) {
|
if (node instanceof SingleNode) {
|
||||||
assert(operations.length === 1);
|
assert(operations.length === 1);
|
||||||
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
// 这逻辑有点扯,页面自己决定后续逻辑 by Xc 20231108
|
||||||
|
|
@ -2523,7 +2529,7 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
node.clean();
|
node.clean(true);
|
||||||
node.setExecuting(false);
|
node.setExecuting(false);
|
||||||
|
|
||||||
return { message: 'No Operation' };
|
return { message: 'No Operation' };
|
||||||
|
|
@ -2536,10 +2542,10 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clean(path: string) {
|
clean(path: string, dontPublish?: true) {
|
||||||
const node = this.findNode(path)!;
|
const node = this.findNode(path)!;
|
||||||
|
|
||||||
node.clean();
|
node.clean(dontPublish);
|
||||||
const parent = node.getParent();
|
const parent = node.getParent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.checkIfClean();
|
parent.checkIfClean();
|
||||||
|
|
|
||||||
|
|
@ -279,11 +279,11 @@ const oakBehavior = Behavior<
|
||||||
return this.features.navigator.switchTab(option, state);
|
return this.features.navigator.switchTab(option, state);
|
||||||
},
|
},
|
||||||
|
|
||||||
clean(path) {
|
clean(dontPublish, path) {
|
||||||
const path2 = path
|
const path2 = path
|
||||||
? `${this.state.oakFullpath}.${path}`
|
? `${this.state.oakFullpath}.${path}`
|
||||||
: this.state.oakFullpath;
|
: this.state.oakFullpath;
|
||||||
return this.features.runningTree.clean(path2);
|
return this.features.runningTree.clean(path2, dontPublish);
|
||||||
},
|
},
|
||||||
|
|
||||||
isDirty(path) {
|
isDirty(path) {
|
||||||
|
|
|
||||||
|
|
@ -301,11 +301,11 @@ abstract class OakComponentBase<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clean(path?: string) {
|
clean(dontPublish?: true, path?: string) {
|
||||||
const path2 = path
|
const path2 = path
|
||||||
? `${this.state.oakFullpath}.${path}`
|
? `${this.state.oakFullpath}.${path}`
|
||||||
: this.state.oakFullpath;
|
: this.state.oakFullpath;
|
||||||
this.features.runningTree.clean(path2);
|
this.features.runningTree.clean(path2, dontPublish);
|
||||||
}
|
}
|
||||||
|
|
||||||
t(key: string, params?: object) {
|
t(key: string, params?: object) {
|
||||||
|
|
@ -762,8 +762,8 @@ export function createComponent<
|
||||||
disableNamespace
|
disableNamespace
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
clean: (path?: string) => {
|
clean: (dontPublish?: true, path?: string) => {
|
||||||
return this.clean(path);
|
return this.clean(dontPublish, path);
|
||||||
},
|
},
|
||||||
checkOperation: <T2 extends keyof ED>(entity: T2, operation: ED[T2]['Operation'], checkerTypes?: CheckerType[]) => {
|
checkOperation: <T2 extends keyof ED>(entity: T2, operation: ED[T2]['Operation'], checkerTypes?: CheckerType[]) => {
|
||||||
return this.checkOperation(entity, operation, checkerTypes);
|
return this.checkOperation(entity, operation, checkerTypes);
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ export type OakCommonComponentMethods<
|
||||||
disableNamespace?: boolean
|
disableNamespace?: boolean
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
// setProps: (props: Record<string, any>, usingState?: true) => void;
|
// setProps: (props: Record<string, any>, usingState?: true) => void;
|
||||||
clean: (path?: string) => void;
|
clean: (dontPublish?: true, path?: string) => void;
|
||||||
isDirty: (path?: string) => boolean;
|
isDirty: (path?: string) => boolean;
|
||||||
|
|
||||||
t(key: string, params?: object): string;
|
t(key: string, params?: object): string;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue