xs 才开启下拉刷新

This commit is contained in:
Wang Kejun 2022-09-15 17:04:09 +08:00
parent 71c46036bc
commit 3c9f66a8ad
4 changed files with 56 additions and 48 deletions

View File

@ -36,7 +36,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict, Cxt extends C
operation: ED[keyof ED]['Operation'];
}>): Promise<SelectionResult<ED[T]["Schema"], S["data"]>>;
get<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, params?: SelectOption): Promise<import("oak-domain/lib/types").SelectRowShape<ED[T]["Schema"], S["data"]>[]>;
judgeRelation(entity: keyof ED, attr: string): string | 0 | 1 | string[] | 2;
judgeRelation(entity: keyof ED, attr: string): string | 0 | 2 | 1 | string[];
bindOnSync(callback: (opRecords: OpRecord<ED>[]) => Promise<void>): void;
unbindOnSync(callback: (opRecords: OpRecord<ED>[]) => Promise<void>): void;
getCachedData(): { [T in keyof ED]?: ED[T]["OpSchema"][] | undefined; };

View File

@ -37,7 +37,7 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
getBeforeExecute(): ((updateData: import("oak-domain/lib/types").DeduceUpdateOperationData<ED[T]["OpSchema"]>, action: ED[T]["Action"]) => Promise<void>) | undefined;
getAfterExecute(): ((updateData: import("oak-domain/lib/types").DeduceUpdateOperationData<ED[T]["OpSchema"]>, action: ED[T]["Action"]) => Promise<void>) | undefined;
destroy(): void;
protected judgeRelation(attr: string): string | 0 | 1 | string[] | 2;
protected judgeRelation(attr: string): string | 0 | 2 | 1 | string[];
protected contains(filter: ED[T]['Selection']['filter'], conditionalFilter: ED[T]['Selection']['filter']): boolean;
protected repel(filter1: ED[T]['Selection']['filter'], filter2: ED[T]['Selection']['filter']): boolean;
}

View File

@ -282,20 +282,23 @@ function createPage(options, features, exceptionRouterDict) {
var _this = this;
var Render = render.call(this);
var oakLoading = this.state.oakLoading;
return react_1.default.cloneElement((0, jsx_runtime_1.jsx)(web_1.PullToRefresh, { onRefresh: function () {
if (methods === null || methods === void 0 ? void 0 : methods.onPullDownRefresh) {
methods.onPullDownRefresh.call(_this);
return;
}
if (_this.props.width === 'xs') {
onPullDownRefresh.call(_this);
}
}, refreshing: oakLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: {
activate: commonMethods.t.call(this, 'common:ptrActivate'),
deactivate: commonMethods.t.call(this, 'common:ptrDeactivate'),
release: commonMethods.t.call(this, 'common:ptrRelease'),
finish: commonMethods.t.call(this, 'common:ptrFinish'),
} }), {}, Render);
if (this.props.width === 'xs') {
return react_1.default.cloneElement((0, jsx_runtime_1.jsx)(web_1.PullToRefresh, { onRefresh: function () {
if (methods === null || methods === void 0 ? void 0 : methods.onPullDownRefresh) {
methods.onPullDownRefresh.call(_this);
return;
}
else {
onPullDownRefresh.call(_this);
}
}, refreshing: oakLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: {
activate: commonMethods.t.call(this, 'common:ptrActivate'),
deactivate: commonMethods.t.call(this, 'common:ptrDeactivate'),
release: commonMethods.t.call(this, 'common:ptrRelease'),
finish: commonMethods.t.call(this, 'common:ptrFinish'),
} }), {}, Render);
}
return Render;
};
return OakPageWrapper;
}(react_1.default.PureComponent));

View File

@ -425,38 +425,43 @@ export function createPage<
const Render = render.call(this);
const { oakLoading } = this.state;
return React.cloneElement(
<PullToRefresh
onRefresh={() => {
if (methods?.onPullDownRefresh) {
methods.onPullDownRefresh.call(this);
return;
}
if (this.props.width === 'xs') {
onPullDownRefresh.call(this);
}
}}
refreshing={oakLoading}
distanceToRefresh={DEFAULT_REACH_BOTTOM_DISTANCE}
indicator={{
activate: commonMethods.t.call(
this,
'common:ptrActivate'
),
deactivate: commonMethods.t.call(
this,
'common:ptrDeactivate'
),
release: commonMethods.t.call(
this,
'common:ptrRelease'
),
finish: commonMethods.t.call(this, 'common:ptrFinish'),
}}
/>,
{},
Render
);
if (this.props.width === 'xs') {
return React.cloneElement(
<PullToRefresh
onRefresh={() => {
if (methods?.onPullDownRefresh) {
methods.onPullDownRefresh.call(this);
return;
} else {
onPullDownRefresh.call(this);
}
}}
refreshing={oakLoading}
distanceToRefresh={DEFAULT_REACH_BOTTOM_DISTANCE}
indicator={{
activate: commonMethods.t.call(
this,
'common:ptrActivate'
),
deactivate: commonMethods.t.call(
this,
'common:ptrDeactivate'
),
release: commonMethods.t.call(
this,
'common:ptrRelease'
),
finish: commonMethods.t.call(
this,
'common:ptrFinish'
),
}}
/>,
{},
Render
);
}
return Render;
}
}