修改了几个原来的bug
This commit is contained in:
parent
06067dbef0
commit
2133125f53
|
|
@ -1,4 +1,3 @@
|
|||
/// <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,3 @@
|
|||
/// <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;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class Cache extends Feature_1.Feature {
|
|||
this.refreshing--;
|
||||
if (e instanceof Exception_1.OakException) {
|
||||
const { opRecords } = e;
|
||||
if (opRecords) {
|
||||
if (opRecords.length) {
|
||||
this.syncInner(opRecords);
|
||||
this.publish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
|||
recoverItem(id: string): void;
|
||||
recoverItems(ids: string[]): void;
|
||||
resetItem(id: string): void;
|
||||
private preProcessUpdateData;
|
||||
private updateItemInner;
|
||||
/**
|
||||
* 目前只支持根据itemId进行更新
|
||||
* @param data
|
||||
|
|
@ -145,7 +147,7 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
|||
* @param afterExecute
|
||||
*/
|
||||
updateItem(lsn: number, data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action']): void;
|
||||
updateItems(data: Record<string, ED[T]['Update']['data']>, action?: ED[T]['Action']): void;
|
||||
updateItems(lsn: number, data: Record<string, ED[T]['Update']['data']>, ids: string[], action?: ED[T]['Action']): void;
|
||||
composeOperations(): Array<{
|
||||
entity: keyof ED;
|
||||
operation: ED[keyof ED]['Operation'];
|
||||
|
|
@ -307,6 +309,7 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict> extends
|
|||
removeItem(path: string, id: string): void;
|
||||
removeItems(path: string, ids: string[]): void;
|
||||
updateItem<T extends keyof ED>(path: string, data: ED[T]['Update']['data'], id: string, action?: ED[T]['Action']): void;
|
||||
updateItems<T extends keyof ED>(path: string, data: ED[T]['Update']['data'], ids: string[], action?: ED[T]['Action']): void;
|
||||
recoverItem(path: string, id: string): void;
|
||||
recoverItems(path: string, ids: string[]): void;
|
||||
resetItem(path: string, id: string): void;
|
||||
|
|
|
|||
|
|
@ -779,14 +779,7 @@ class ListNode extends Node {
|
|||
resetItem(id) {
|
||||
this.ulManager.undo({ id });
|
||||
}
|
||||
/**
|
||||
* 目前只支持根据itemId进行更新
|
||||
* @param data
|
||||
* @param id
|
||||
* @param beforeExecute
|
||||
* @param afterExecute
|
||||
*/
|
||||
updateItem(lsn, data, id, action) {
|
||||
preProcessUpdateData(data) {
|
||||
const undefinedAttrs = [];
|
||||
// 如果数据键值是一个空字符串则更新成null,undefined则unset掉
|
||||
for (const k in data) {
|
||||
|
|
@ -800,6 +793,8 @@ class ListNode extends Node {
|
|||
}
|
||||
}
|
||||
undefinedAttrs.forEach((attr) => (0, lodash_1.unset)(data, attr));
|
||||
}
|
||||
updateItemInner(lsn, data, id, action) {
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -807,10 +802,23 @@ class ListNode extends Node {
|
|||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 目前只支持根据itemId进行更新
|
||||
* @param data
|
||||
* @param id
|
||||
* @param beforeExecute
|
||||
* @param afterExecute
|
||||
*/
|
||||
updateItem(lsn, data, id, action) {
|
||||
this.preProcessUpdateData(data);
|
||||
this.updateItemInner(lsn, data, id, action);
|
||||
this.setDirty();
|
||||
}
|
||||
updateItems(data, action) {
|
||||
throw new Error('暂未实现');
|
||||
updateItems(lsn, data, ids, action) {
|
||||
this.preProcessUpdateData(data);
|
||||
ids.forEach((id) => this.updateItemInner(lsn, data, id, action));
|
||||
this.setDirty();
|
||||
}
|
||||
composeOperations() {
|
||||
if (!this.dirty) {
|
||||
|
|
@ -830,11 +838,13 @@ class ListNode extends Node {
|
|||
const { filter, ...rest } = operation;
|
||||
return {
|
||||
entity: this.entity,
|
||||
/* 现在update有一对多或者多对一的外键对象,oak-db会报错,暂时先封掉
|
||||
operation: {
|
||||
...rest,
|
||||
// 加上instrinstic filter有机率降低后台各种检查对数据库的访问(先决条件已经满足约束)
|
||||
filter: (0, filter_1.combineFilters)(this.entity, this.schema, [filter, intrinsticFilter]),
|
||||
}
|
||||
filter: combineFilters(this.entity, this.schema, [filter, intrinsticFilter]),
|
||||
} */
|
||||
operation
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
@ -847,10 +857,10 @@ class ListNode extends Node {
|
|||
} */
|
||||
return projection;
|
||||
}
|
||||
constructFilters(withParent, ignoreNewParent, ignoreUnapplied, onlyIntrinstic) {
|
||||
constructFilters(withParent, ignoreNewParent, ignoreUnapplied) {
|
||||
const { filters: ownFilters } = this;
|
||||
const filters = ownFilters.filter(ele => (!ignoreUnapplied || ele.applied === true || ele.applied === undefined) // 如果是undefined,说明不可以移除(构造时就存在),也得返回
|
||||
&& (!onlyIntrinstic || ele.applied === undefined)).map((ele) => {
|
||||
).map((ele) => {
|
||||
const { filter } = ele;
|
||||
if (typeof filter === 'function') {
|
||||
return filter();
|
||||
|
|
@ -1007,7 +1017,7 @@ class ListNode extends Node {
|
|||
}
|
||||
// 查看这个list上所有数据必须遵守的限制
|
||||
getIntrinsticFilters() {
|
||||
const filters = this.constructFilters(undefined, true, true, true);
|
||||
const filters = this.constructFilters(undefined, true, true);
|
||||
return (0, filter_1.combineFilters)(this.entity, this.schema, filters || []);
|
||||
}
|
||||
}
|
||||
|
|
@ -2023,6 +2033,11 @@ class RunningTree extends Feature_1.Feature {
|
|||
(0, assert_1.assert)(node instanceof ListNode);
|
||||
node.updateItem(this.logSerailNumber, data, id, action);
|
||||
}
|
||||
updateItems(path, data, ids, action) {
|
||||
const node = this.findNode(path);
|
||||
(0, assert_1.assert)(node instanceof ListNode);
|
||||
node.updateItems(this.logSerailNumber, data, ids, action);
|
||||
}
|
||||
recoverItem(path, id) {
|
||||
const node = this.findNode(path);
|
||||
(0, assert_1.assert)(node instanceof ListNode);
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@ function onPathSet(option, isPage) {
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 不设置的默认情况,宽屏取100窄屏不取
|
||||
const { width } = this.props;
|
||||
if (width !== 'xs') {
|
||||
getTotal2 = 100;
|
||||
}
|
||||
}
|
||||
let pagination2;
|
||||
if (pagination) {
|
||||
if (pagination instanceof Array) {
|
||||
|
|
@ -90,13 +97,6 @@ function onPathSet(option, isPage) {
|
|||
pagination2 = pagination;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 不设置的默认情况,宽屏取100窄屏不取
|
||||
const { width } = this.props;
|
||||
if (width !== 'xs') {
|
||||
getTotal2 = 100;
|
||||
}
|
||||
}
|
||||
features.runningTree.createNode({
|
||||
path: oakPath2,
|
||||
entity: entity2,
|
||||
|
|
|
|||
|
|
@ -5,4 +5,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): (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 { 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, ComponentData, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
||||
import { DataOption, ComponentProps, OakComponentOption, OakNavigateToParameters } from './types/Page';
|
||||
import { MessageProps } from './types/Message';
|
||||
import { NotificationProps } from './types/Notification';
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
|
|
@ -102,23 +101,5 @@ export declare function createComponent<IsList extends boolean, ED extends Entit
|
|||
setCurrentPage(currentPage: number, path?: string | undefined): void;
|
||||
subDataEvents(events: string[], moduleName: string, callback: (event: string, opRecords: OpRecord<ED>[]) => void): 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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
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';
|
||||
|
|
@ -6,4 +5,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, 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;
|
||||
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) => import("react/jsx-runtime").JSX.Element;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => FD2;
|
||||
declare const FeaturesProvider: (props: Props) => any;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||
export { FeaturesProvider, useFeatures };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
type OakComponentProperties = {
|
||||
path?: string;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
"use strict";
|
||||
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 assert_1 = require("oak-domain/lib/utils/assert");
|
||||
function getParams(params, properties) {
|
||||
const props = getProps(params, properties);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import React from 'react';
|
||||
import 'nprogress/nprogress.css';
|
||||
declare const _default: React.MemoExoticComponent<() => null>;
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
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>>() => FD2;
|
||||
declare const useFeatures: <FD2 extends Record<string, Feature>>() => any;
|
||||
export { FeaturesProvider, useFeatures };
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ import React from 'react';
|
|||
type AppContainerProps = {
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
declare const AppContainer: (props: AppContainerProps) => import("react/jsx-runtime").JSX.Element;
|
||||
declare const AppContainer: (props: AppContainerProps) => any;
|
||||
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>): import("react/jsx-runtime").JSX.Element;
|
||||
declare function Error<ED extends EntityDict & BaseEntityDict>(props: ErrorProps<ED>): any;
|
||||
export default Error;
|
||||
|
|
|
|||
|
|
@ -1,34 +1,12 @@
|
|||
"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 = require("react");
|
||||
const react_1 = tslib_1.__importStar(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(() => __importStar(require('../../../components/errorPage'))));
|
||||
const ErrorPage = (0, react_1.lazy)(() => Promise.resolve().then(() => tslib_1.__importStar(require('../../../components/errorPage'))));
|
||||
function Error(props) {
|
||||
const { error, features } = props;
|
||||
if (error instanceof Exception_1.OakException) {
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ declare const AppRouter: <ED extends BaseEntityDict>(props: {
|
|||
routers: IRouter[];
|
||||
appName: string;
|
||||
features: BasicFeatures<ED>;
|
||||
}) => import("react/jsx-runtime").JSX.Element;
|
||||
}) => any;
|
||||
export default AppRouter;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
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,4 +1,3 @@
|
|||
import React from 'react';
|
||||
export type Width = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
||||
export type Keys = Width[];
|
||||
export type Values = {
|
||||
|
|
@ -16,6 +15,4 @@ export type Breakpoints = {
|
|||
export declare const keys: Keys;
|
||||
export declare const values: Values;
|
||||
export declare const defaultBreakpoints: Breakpoints;
|
||||
export declare const ResponsiveContext: React.Context<{
|
||||
breakpoints?: Breakpoints | undefined;
|
||||
}>;
|
||||
export declare const ResponsiveContext: any;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import React from 'react';
|
||||
type OakComponentProperties = {
|
||||
path?: string;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ export class Cache<ED extends EntityDict & BaseEntityDict> extends Feature {
|
|||
this.refreshing--;
|
||||
if (e instanceof OakException) {
|
||||
const { opRecords } = e;
|
||||
if (opRecords) {
|
||||
if (opRecords.length) {
|
||||
this.syncInner(opRecords as OpRecord<ED>[]);
|
||||
this.publish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -957,19 +957,7 @@ class ListNode<
|
|||
this.ulManager.undo({ id });
|
||||
}
|
||||
|
||||
/**
|
||||
* 目前只支持根据itemId进行更新
|
||||
* @param data
|
||||
* @param id
|
||||
* @param beforeExecute
|
||||
* @param afterExecute
|
||||
*/
|
||||
updateItem(
|
||||
lsn: number,
|
||||
data: ED[T]['Update']['data'],
|
||||
id: string,
|
||||
action?: ED[T]['Action']
|
||||
) {
|
||||
private preProcessUpdateData(data: ED[T]['Update']['data']) {
|
||||
const undefinedAttrs: string[] = [];
|
||||
// 如果数据键值是一个空字符串则更新成null,undefined则unset掉
|
||||
for (const k in data) {
|
||||
|
|
@ -986,6 +974,14 @@ class ListNode<
|
|||
undefinedAttrs.forEach(
|
||||
(attr) => unset(data, attr)
|
||||
);
|
||||
}
|
||||
|
||||
private updateItemInner(
|
||||
lsn: number,
|
||||
data: ED[T]['Update']['data'],
|
||||
id: string,
|
||||
action?: ED[T]['Action']
|
||||
) {
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -993,14 +989,36 @@ class ListNode<
|
|||
id,
|
||||
},
|
||||
} as unknown as Omit<ED[T]['Update'], "id">);
|
||||
}
|
||||
/**
|
||||
* 目前只支持根据itemId进行更新
|
||||
* @param data
|
||||
* @param id
|
||||
* @param beforeExecute
|
||||
* @param afterExecute
|
||||
*/
|
||||
updateItem(
|
||||
lsn: number,
|
||||
data: ED[T]['Update']['data'],
|
||||
id: string,
|
||||
action?: ED[T]['Action']
|
||||
) {
|
||||
this.preProcessUpdateData(data);
|
||||
this.updateItemInner(lsn, data, id, action);
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
updateItems(
|
||||
lsn: number,
|
||||
data: Record<string, ED[T]['Update']['data']>,
|
||||
action?: ED[T]['Action']
|
||||
ids: string[],
|
||||
action?: ED[T]['Action'],
|
||||
) {
|
||||
throw new Error('暂未实现');
|
||||
this.preProcessUpdateData(data);
|
||||
ids.forEach(
|
||||
(id) => this.updateItemInner(lsn, data, id, action)
|
||||
);
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
composeOperations():
|
||||
|
|
@ -2457,6 +2475,17 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
|||
node.updateItem(this.logSerailNumber, data, id, action);
|
||||
}
|
||||
|
||||
updateItems<T extends keyof ED>(
|
||||
path: string,
|
||||
data: ED[T]['Update']['data'],
|
||||
ids: string[],
|
||||
action?: ED[T]['Action']
|
||||
) {
|
||||
const node = this.findNode(path);
|
||||
assert(node instanceof ListNode);
|
||||
node.updateItems(this.logSerailNumber, data, ids, action);
|
||||
}
|
||||
|
||||
recoverItem(path: string, id: string) {
|
||||
const node = this.findNode(path);
|
||||
assert(node instanceof ListNode);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,13 @@ export function onPathSet<
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 不设置的默认情况,宽屏取100窄屏不取
|
||||
const { width } = this.props;
|
||||
if (width !== 'xs') {
|
||||
getTotal2 = 100;
|
||||
}
|
||||
}
|
||||
let pagination2: Pick<Pagination, 'currentPage' | 'pageSize' | 'randomRange'> | undefined;
|
||||
if (pagination) {
|
||||
if (pagination instanceof Array) {
|
||||
|
|
@ -129,13 +136,6 @@ export function onPathSet<
|
|||
pagination2 = pagination;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// 不设置的默认情况,宽屏取100窄屏不取
|
||||
const { width } = this.props;
|
||||
if (width !== 'xs') {
|
||||
getTotal2 = 100;
|
||||
}
|
||||
}
|
||||
features.runningTree.createNode({
|
||||
path: oakPath2,
|
||||
entity: entity2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue