context增加了默认导出
This commit is contained in:
parent
b9d58b84c2
commit
90f5e92e61
|
|
@ -1,4 +1,3 @@
|
|||
// @ts-nocheck
|
||||
import { ED, OakAbsAttrDef, onActionFnDef, OakExtraActionProps } from '../../types/AbstractComponent';
|
||||
import { TableProps } from 'antd';
|
||||
import { RowWithActions, ReactComponentProps } from '../../types/Page';
|
||||
|
|
|
|||
|
|
@ -29,3 +29,4 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
|
|||
*/
|
||||
clearSubscriber(): void;
|
||||
}
|
||||
export default BackendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -62,3 +62,5 @@ export class BackendRuntimeContext extends AsyncContext {
|
|||
this.subscriberId = undefined;
|
||||
}
|
||||
}
|
||||
;
|
||||
export default BackendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ export declare abstract class FrontendRuntimeContext<ED extends EntityDict & Bas
|
|||
constructor(store: SyncRowStore<ED, FrontendRuntimeContext<ED>>, features: BasicFeatures<ED>);
|
||||
protected getSerializedData(): Promise<SerializedData>;
|
||||
}
|
||||
export default FrontendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -20,3 +20,5 @@ export class FrontendRuntimeContext extends SyncContext {
|
|||
};
|
||||
}
|
||||
}
|
||||
;
|
||||
export default FrontendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -783,7 +783,6 @@ class ListNode extends Node {
|
|||
* @param afterExecute
|
||||
*/
|
||||
updateItem(lsn, data, id, action) {
|
||||
// 如果数据键值是一个空字符串则更新成null
|
||||
const undefinedAttrs = [];
|
||||
// 如果数据键值是一个空字符串则更新成null,undefined则unset掉
|
||||
for (const k in data) {
|
||||
|
|
@ -796,10 +795,7 @@ class ListNode extends Node {
|
|||
undefinedAttrs.push(k);
|
||||
}
|
||||
}
|
||||
|
||||
undefinedAttrs.forEach(
|
||||
(attr) => unset(data, attr)
|
||||
);
|
||||
undefinedAttrs.forEach((attr) => unset(data, attr));
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -1219,7 +1215,6 @@ class SingleNode extends Node {
|
|||
update(lsn, data, action) {
|
||||
// 如果数据键值是一个空字符串则更新成null,如果是undefined则取消此键值
|
||||
const undefinedAttrs = [];
|
||||
// 如果数据键值是一个空字符串则更新成null,undefined则unset掉
|
||||
for (const k in data) {
|
||||
if (data[k] === '') {
|
||||
Object.assign(data, {
|
||||
|
|
@ -1230,10 +1225,7 @@ class SingleNode extends Node {
|
|||
undefinedAttrs.push(k);
|
||||
}
|
||||
}
|
||||
|
||||
undefinedAttrs.forEach(
|
||||
(attr) => unset(data, attr)
|
||||
);
|
||||
undefinedAttrs.forEach((attr) => unset(data, attr));
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -1323,12 +1315,10 @@ class SingleNode extends Node {
|
|||
const operations = this.ulManager.makeOperations();
|
||||
this.ulManager.rollback(lsnMax);
|
||||
assert(operations.length <= 1);
|
||||
const [ operation ] = operations;
|
||||
|
||||
const [operation] = operations;
|
||||
if (operation) {
|
||||
const { filter, ...rest } = operation;
|
||||
const intrinsticFilter = this.getIntrinsticFilters();
|
||||
|
||||
return [
|
||||
{
|
||||
entity: this.entity,
|
||||
|
|
|
|||
|
|
@ -21,27 +21,27 @@ export default function initialize(features, appName, routers, locales, error) {
|
|||
const history = createBrowserHistory();
|
||||
features.navigator.setHistory(history);
|
||||
if (error) {
|
||||
root.render(<AppError error={error} features={features} />);
|
||||
root.render(<AppError error={error} features={features}/>);
|
||||
}
|
||||
else {
|
||||
const { language } = window.navigator;
|
||||
dayjs.locale(locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? 'zh-cn' : 'en-us');
|
||||
root.render(<HistoryRouter history={history}>
|
||||
<ResponsiveProvider>
|
||||
<FeaturesProvider features={features}>
|
||||
<ConfigProvider locale={locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? zhCN : enUS} theme={{
|
||||
cssVar: {
|
||||
prefix: 'adm', // 和antd-mobile共享
|
||||
}
|
||||
}}>
|
||||
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
|
||||
<AppContainer>
|
||||
<AppRouter features={features} appName={appName} routers={routers} />
|
||||
</AppContainer>
|
||||
</StyleProvider>
|
||||
</ConfigProvider>
|
||||
</FeaturesProvider>
|
||||
</ResponsiveProvider>
|
||||
</HistoryRouter>);
|
||||
<ResponsiveProvider>
|
||||
<FeaturesProvider features={features}>
|
||||
<ConfigProvider locale={locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? zhCN : enUS} theme={{
|
||||
cssVar: {
|
||||
prefix: 'adm', // 和antd-mobile共享
|
||||
}
|
||||
}}>
|
||||
<StyleProvider hashPriority="high" transformers={[legacyLogicalPropertiesTransformer]}>
|
||||
<AppContainer>
|
||||
<AppRouter features={features} appName={appName} routers={routers}/>
|
||||
</AppContainer>
|
||||
</StyleProvider>
|
||||
</ConfigProvider>
|
||||
</FeaturesProvider>
|
||||
</ResponsiveProvider>
|
||||
</HistoryRouter>);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,3 +29,4 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
|
|||
*/
|
||||
clearSubscriber(): void;
|
||||
}
|
||||
export default BackendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -67,3 +67,5 @@ class BackendRuntimeContext extends AsyncRowStore_1.AsyncContext {
|
|||
}
|
||||
}
|
||||
exports.BackendRuntimeContext = BackendRuntimeContext;
|
||||
;
|
||||
exports.default = BackendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ export declare abstract class FrontendRuntimeContext<ED extends EntityDict & Bas
|
|||
constructor(store: SyncRowStore<ED, FrontendRuntimeContext<ED>>, features: BasicFeatures<ED>);
|
||||
protected getSerializedData(): Promise<SerializedData>;
|
||||
}
|
||||
export default FrontendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -24,3 +24,5 @@ class FrontendRuntimeContext extends SyncRowStore_1.SyncContext {
|
|||
}
|
||||
}
|
||||
exports.FrontendRuntimeContext = FrontendRuntimeContext;
|
||||
;
|
||||
exports.default = FrontendRuntimeContext;
|
||||
|
|
|
|||
|
|
@ -786,14 +786,19 @@ class ListNode extends Node {
|
|||
* @param afterExecute
|
||||
*/
|
||||
updateItem(lsn, data, id, action) {
|
||||
// 如果数据键值是一个空字符串则更新成null
|
||||
const undefinedAttrs = [];
|
||||
// 如果数据键值是一个空字符串则更新成null,undefined则unset掉
|
||||
for (const k in data) {
|
||||
if (data[k] === '') {
|
||||
Object.assign(data, {
|
||||
[k]: null,
|
||||
});
|
||||
}
|
||||
else if (data[k] === undefined) {
|
||||
undefinedAttrs.push(k);
|
||||
}
|
||||
}
|
||||
undefinedAttrs.forEach((attr) => (0, lodash_1.unset)(data, attr));
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -1223,6 +1228,7 @@ class SingleNode extends Node {
|
|||
undefinedAttrs.push(k);
|
||||
}
|
||||
}
|
||||
undefinedAttrs.forEach((attr) => (0, lodash_1.unset)(data, attr));
|
||||
this.ulManager.push(lsn, {
|
||||
action: action || 'update',
|
||||
data,
|
||||
|
|
@ -1311,26 +1317,28 @@ class SingleNode extends Node {
|
|||
}
|
||||
const operations = this.ulManager.makeOperations();
|
||||
this.ulManager.rollback(lsnMax);
|
||||
(0, assert_1.assert)(operations.length === 1);
|
||||
(0, assert_1.assert)(operations.length <= 1);
|
||||
const [operation] = operations;
|
||||
const { filter, ...rest } = operation;
|
||||
const intrinsticFilter = this.getIntrinsticFilters();
|
||||
return [
|
||||
{
|
||||
entity: this.entity,
|
||||
operation: {
|
||||
...rest,
|
||||
filter: intrinsticFilter ? (0, filter_1.combineFilters)(this.entity, this.schema, [
|
||||
{
|
||||
if (operation) {
|
||||
const { filter, ...rest } = operation;
|
||||
const intrinsticFilter = this.getIntrinsticFilters();
|
||||
return [
|
||||
{
|
||||
entity: this.entity,
|
||||
operation: {
|
||||
...rest,
|
||||
filter: intrinsticFilter ? (0, filter_1.combineFilters)(this.entity, this.schema, [
|
||||
{
|
||||
id: this.getId(),
|
||||
},
|
||||
intrinsticFilter
|
||||
]) : {
|
||||
id: this.getId(),
|
||||
},
|
||||
intrinsticFilter
|
||||
]) : {
|
||||
id: this.getId(),
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
getProjection(withDecendants) {
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ function initialize(features, appName, routers, locales, error) {
|
|||
const { language } = window.navigator;
|
||||
dayjs_1.default.locale(locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? 'zh-cn' : 'en-us');
|
||||
root.render((0, jsx_runtime_1.jsx)(react_router_dom_1.unstable_HistoryRouter, { history: history, children: (0, jsx_runtime_1.jsx)(responsive_1.ResponsiveProvider, { children: (0, jsx_runtime_1.jsx)(features_1.FeaturesProvider, { features: features, children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { locale: locales?.dayJs || ['zh-CN', 'zh_CN'].includes(language) ? zh_CN_1.default : en_US_1.default, theme: {
|
||||
token: {
|
||||
colorPrimary: 'var(--oak-color-primary)',
|
||||
cssVar: {
|
||||
prefix: 'adm', // 和antd-mobile共享
|
||||
}
|
||||
}, children: (0, jsx_runtime_1.jsx)(cssinjs_1.StyleProvider, { hashPriority: "high", transformers: [cssinjs_1.legacyLogicalPropertiesTransformer], children: (0, jsx_runtime_1.jsx)(AppContainer_1.default, { children: (0, jsx_runtime_1.jsx)(AppRouter_1.default, { features: features, appName: appName, routers: routers }) }) }) }) }) }) }));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,4 +78,6 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
clearSubscriber() {
|
||||
this.subscriberId = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default BackendRuntimeContext;
|
||||
|
|
@ -38,4 +38,6 @@ export abstract class FrontendRuntimeContext<ED extends EntityDict & BaseEntityD
|
|||
ns,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default FrontendRuntimeContext;
|
||||
|
|
|
|||
Loading…
Reference in New Issue