Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-frontend-base into dev

This commit is contained in:
Xu Chang 2023-10-26 16:01:39 +08:00
commit b7f60b8c5a
7 changed files with 106 additions and 30 deletions

View File

@ -768,27 +768,44 @@ export function createComponent(option, features) {
render() { render() {
const { oakPullDownRefreshLoading } = this.state; const { oakPullDownRefreshLoading } = this.state;
const Render = getRender.call(this); const Render = getRender.call(this);
// 传入oakPath或page入口页 需要等待oakFullpath初始化完成
if ((this.props.oakPath || (this.iAmThePage() && path)) &&
!this.state.oakFullpath) {
return null;
}
// option有entity也需要等待oakFullpath初始化完成
if (this.oakOption.entity && !this.state.oakFullpath) {
return null;
}
if (this.supportPullDownRefresh()) { if (this.supportPullDownRefresh()) {
return (_jsx(PullToRefresh, { onRefresh: async () => { return (_jsx(PullToRefresh, { onRefresh: async () => {
this.pullDownRefresh = true; this.pullDownRefresh = true;
await this.refresh(); await this.refresh();
this.pullDownRefresh = false; this.pullDownRefresh = false;
}, refreshing: oakPullDownRefreshLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: { }, refreshing: oakPullDownRefreshLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: {
activate: this.t('common::ptrActivate', { '#oakModule': 'oak-frontend-base' }), activate: this.t('common::ptrActivate', {
deactivate: this.t('common::ptrDeactivate', { '#oakModule': 'oak-frontend-base' }), '#oakModule': 'oak-frontend-base',
release: this.t('common::ptrRelease', { '#oakModule': 'oak-frontend-base' }), }),
finish: this.t('common::ptrFinish', { '#oakModule': 'oak-frontend-base' }), deactivate: this.t('common::ptrDeactivate', {
'#oakModule': 'oak-frontend-base',
}),
release: this.t('common::ptrRelease', {
'#oakModule': 'oak-frontend-base',
}),
finish: this.t('common::ptrFinish', {
'#oakModule': 'oak-frontend-base',
}),
}, children: _jsx(Render, { methods: this.methodProps, data: { }, children: _jsx(Render, { methods: this.methodProps, data: {
...this.defaultProperties, ...this.defaultProperties,
...this.state, ...this.state,
...this.props, ...this.props,
} }) })); } }) }));
} }
return _jsx(Render, { methods: this.methodProps, data: { return (_jsx(Render, { methods: this.methodProps, data: {
...this.defaultProperties, ...this.defaultProperties,
...this.state, ...this.state,
...this.props, ...this.props,
} }); } }));
} }
} }
; ;

View File

@ -30,4 +30,9 @@
.oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) { .oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) {
height: auto; height: auto;
}
.oak-pull-to-refresh {
height: 100%;
transform: translate3d(0px, 0px, 0px);
} }

View File

@ -772,27 +772,44 @@ function createComponent(option, features) {
render() { render() {
const { oakPullDownRefreshLoading } = this.state; const { oakPullDownRefreshLoading } = this.state;
const Render = getRender.call(this); const Render = getRender.call(this);
// 传入oakPath或page入口页 需要等待oakFullpath初始化完成
if ((this.props.oakPath || (this.iAmThePage() && path)) &&
!this.state.oakFullpath) {
return null;
}
// option有entity也需要等待oakFullpath初始化完成
if (this.oakOption.entity && !this.state.oakFullpath) {
return null;
}
if (this.supportPullDownRefresh()) { if (this.supportPullDownRefresh()) {
return ((0, jsx_runtime_1.jsx)(web_1.PullToRefresh, { onRefresh: async () => { return ((0, jsx_runtime_1.jsx)(web_1.PullToRefresh, { onRefresh: async () => {
this.pullDownRefresh = true; this.pullDownRefresh = true;
await this.refresh(); await this.refresh();
this.pullDownRefresh = false; this.pullDownRefresh = false;
}, refreshing: oakPullDownRefreshLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: { }, refreshing: oakPullDownRefreshLoading, distanceToRefresh: DEFAULT_REACH_BOTTOM_DISTANCE, indicator: {
activate: this.t('common::ptrActivate', { '#oakModule': 'oak-frontend-base' }), activate: this.t('common::ptrActivate', {
deactivate: this.t('common::ptrDeactivate', { '#oakModule': 'oak-frontend-base' }), '#oakModule': 'oak-frontend-base',
release: this.t('common::ptrRelease', { '#oakModule': 'oak-frontend-base' }), }),
finish: this.t('common::ptrFinish', { '#oakModule': 'oak-frontend-base' }), deactivate: this.t('common::ptrDeactivate', {
'#oakModule': 'oak-frontend-base',
}),
release: this.t('common::ptrRelease', {
'#oakModule': 'oak-frontend-base',
}),
finish: this.t('common::ptrFinish', {
'#oakModule': 'oak-frontend-base',
}),
}, children: (0, jsx_runtime_1.jsx)(Render, { methods: this.methodProps, data: { }, children: (0, jsx_runtime_1.jsx)(Render, { methods: this.methodProps, data: {
...this.defaultProperties, ...this.defaultProperties,
...this.state, ...this.state,
...this.props, ...this.props,
} }) })); } }) }));
} }
return (0, jsx_runtime_1.jsx)(Render, { methods: this.methodProps, data: { return ((0, jsx_runtime_1.jsx)(Render, { methods: this.methodProps, data: {
...this.defaultProperties, ...this.defaultProperties,
...this.state, ...this.state,
...this.props, ...this.props,
} }); } }));
} }
} }
; ;

View File

@ -30,4 +30,9 @@
.oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) { .oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) {
height: auto; height: auto;
}
.oak-pull-to-refresh {
height: 100%;
transform: translate3d(0px, 0px, 0px);
} }

View File

@ -51,7 +51,7 @@
"@types/lodash": "^4.14.168", "@types/lodash": "^4.14.168",
"@types/luxon": "^2.0.9", "@types/luxon": "^2.0.9",
"@types/mocha": "^8.2.0", "@types/mocha": "^8.2.0",
"@types/node": "^20.6.0", "@types/node": "^20.7.0",
"@types/node-schedule": "^2.1.0", "@types/node-schedule": "^2.1.0",
"@types/react": "^18.2.21", "@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.7",

View File

@ -43,10 +43,10 @@ abstract class OakComponentBase<
TData extends DataOption, TData extends DataOption,
TProperty extends DataOption, TProperty extends DataOption,
TMethod extends MethodOption TMethod extends MethodOption
> extends React.PureComponent< > extends React.PureComponent<
ComponentProps<ED, T, IsList, TProperty>, ComponentProps<ED, T, IsList, TProperty>,
ComponentData<ED, T, FormedData, TData> ComponentData<ED, T, FormedData, TData>
> { > {
abstract features: FD & abstract features: FD &
BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>; BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>;
abstract oakOption: OakComponentOption< abstract oakOption: OakComponentOption<
@ -1103,7 +1103,7 @@ export function createComponent<
console.warn('发生了结点先形成再配置oakPath的情况请检查代码修正'); console.warn('发生了结点先形成再配置oakPath的情况请检查代码修正');
lifetimes?.ready && lifetimes.ready.call(this); lifetimes?.ready && lifetimes.ready.call(this);
lifetimes?.show && lifetimes.show.call(this); lifetimes?.show && lifetimes.show.call(this);
const { oakFullpath } = this.state; const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath)) { if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath)) {
this.refresh(); this.refresh();
@ -1149,6 +1149,17 @@ export function createComponent<
render(): React.ReactNode { render(): React.ReactNode {
const { oakPullDownRefreshLoading } = this.state; const { oakPullDownRefreshLoading } = this.state;
const Render = getRender.call(this); const Render = getRender.call(this);
// 传入oakPath或page入口页 需要等待oakFullpath初始化完成
if (
(this.props.oakPath || (this.iAmThePage() && path)) &&
!this.state.oakFullpath
) {
return null;
}
// option有entity也需要等待oakFullpath初始化完成
if (this.oakOption.entity && !this.state.oakFullpath) {
return null;
}
if (this.supportPullDownRefresh()) { if (this.supportPullDownRefresh()) {
return ( return (
@ -1161,25 +1172,41 @@ export function createComponent<
refreshing={oakPullDownRefreshLoading} refreshing={oakPullDownRefreshLoading}
distanceToRefresh={DEFAULT_REACH_BOTTOM_DISTANCE} distanceToRefresh={DEFAULT_REACH_BOTTOM_DISTANCE}
indicator={{ indicator={{
activate: this.t('common::ptrActivate', { '#oakModule': 'oak-frontend-base' }), activate: this.t('common::ptrActivate', {
deactivate: this.t('common::ptrDeactivate', { '#oakModule': 'oak-frontend-base' }), '#oakModule': 'oak-frontend-base',
release: this.t('common::ptrRelease', { '#oakModule': 'oak-frontend-base' }), }),
finish: this.t('common::ptrFinish', { '#oakModule': 'oak-frontend-base' }), deactivate: this.t('common::ptrDeactivate', {
'#oakModule': 'oak-frontend-base',
}),
release: this.t('common::ptrRelease', {
'#oakModule': 'oak-frontend-base',
}),
finish: this.t('common::ptrFinish', {
'#oakModule': 'oak-frontend-base',
}),
}} }}
> >
<Render methods={this.methodProps} data={{ <Render
...this.defaultProperties, methods={this.methodProps}
...this.state, data={{
...this.props, ...this.defaultProperties,
}} /> ...this.state,
...this.props,
}}
/>
</PullToRefresh> </PullToRefresh>
); );
} }
return <Render methods={this.methodProps} data={{ return (
...this.defaultProperties, <Render
...this.state, methods={this.methodProps}
...this.props, data={{
}} />; ...this.defaultProperties,
...this.state,
...this.props,
}}
/>
);
} }
}; };
return withRouter(OakComponentWrapper, option); return withRouter(OakComponentWrapper, option);

View File

@ -30,4 +30,9 @@
.oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) { .oak-pull-to-refresh-content-wrapper .oak-pull-to-refresh-content>:nth-child(2) {
height: auto; height: auto;
}
.oak-pull-to-refresh {
height: 100%;
transform: translate3d(0px, 0px, 0px);
} }