getFreshValue没有处理异常
This commit is contained in:
parent
40454a637f
commit
b9a40a8694
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { Item } from './types';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
entity: string | number;
|
||||
items: Item[];
|
||||
mode: "cell" | "table-cell";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { IMode, Item } from "./type";
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
entity: string | number;
|
||||
items: Item[];
|
||||
rows: number;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { ED } from '../../types/AbstractComponent';
|
||||
import { ColumnProps } from '../../types/Filter';
|
||||
import { ReactComponentProps } from '../../types/Page';
|
||||
declare const _default: (props: ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
|
||||
declare const _default: (props: ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
entity: string | number;
|
||||
column: ColumnProps<ED, string | number>;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <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, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
name: string;
|
||||
size: number;
|
||||
color: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference types="react" />
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
import { RowWithActions } from '../..';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
entity: string | number;
|
||||
multiple: boolean;
|
||||
onSelect: (value: [{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { ED, OakAbsRefAttrPickerRender } from '../../types/AbstractComponent';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
placeholder: string | undefined;
|
||||
multiple: boolean;
|
||||
entityId: string;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { EntityDict } from "oak-domain/lib/types";
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
path: string;
|
||||
openTip: boolean;
|
||||
entity: string | number;
|
||||
|
|
|
|||
|
|
@ -1590,20 +1590,26 @@ export class RunningTree extends Feature {
|
|||
const includeModi = path.includes(MODI_NEXT_PATH_SUFFIX);
|
||||
if (node) {
|
||||
this.cache.begin();
|
||||
assert(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
const opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
try {
|
||||
assert(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
const opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
}
|
||||
}
|
||||
const opers = root?.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
}
|
||||
const value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
const opers = root?.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
catch (err) {
|
||||
this.cache.rollback();
|
||||
throw err;
|
||||
}
|
||||
const value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
isDirty(path) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { Cache } from './cache';
|
||||
import { SyncContext } from "oak-domain/lib/store/SyncRowStore";
|
||||
import { Feature } from "../types/Feature";
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { Feature } from '../types/Feature';
|
||||
declare type SubscribeEvent = 'connect' | 'disconnect';
|
||||
export declare class SubScriber<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends CommonAspectDict<ED, Cxt> & Record<string, Aspect<ED, Cxt>>> extends Feature {
|
||||
private cache;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { Cache } from './cache';
|
||||
import { SyncContext } from "oak-domain/lib/store/SyncRowStore";
|
||||
import { Feature } from "../types/Feature";
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { Feature } from '../types/Feature';
|
||||
declare type SubscribeEvent = 'connect' | 'disconnect';
|
||||
export declare class SubScriber<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends CommonAspectDict<ED, Cxt> & Record<string, Aspect<ED, Cxt>>> extends Feature {
|
||||
private eventCallbackMap;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { pull } from 'oak-domain/lib/utils/lodash';
|
||||
import { Feature } from "../types/Feature";
|
||||
import { Feature } from '../types/Feature';
|
||||
export class SubScriber extends Feature {
|
||||
eventCallbackMap = {
|
||||
connect: [],
|
||||
|
|
@ -17,6 +17,5 @@ export class SubScriber extends Feature {
|
|||
async sub(data, callback) {
|
||||
console.log('data subscribe 在dev模式下不起作用');
|
||||
}
|
||||
async unsub(ids) {
|
||||
}
|
||||
async unsub(ids) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import assert from "assert";
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { pull, omit } from 'oak-domain/lib/utils/lodash';
|
||||
import io from '../utils/socket.io/socket.io';
|
||||
import { Feature } from "../types/Feature";
|
||||
import { Feature } from '../types/Feature';
|
||||
export class SubScriber extends Feature {
|
||||
cache;
|
||||
getSubscribePointFn;
|
||||
|
|
@ -24,7 +24,7 @@ export class SubScriber extends Feature {
|
|||
pull(this.eventCallbackMap[event], callback);
|
||||
}
|
||||
emit(event) {
|
||||
this.eventCallbackMap[event].forEach(ele => ele());
|
||||
this.eventCallbackMap[event].forEach((ele) => ele());
|
||||
}
|
||||
async initSocketOption() {
|
||||
const { url, path } = await this.getSubscribePointFn();
|
||||
|
|
@ -33,8 +33,7 @@ export class SubScriber extends Feature {
|
|||
});
|
||||
this.socket = socket;
|
||||
}
|
||||
async login() {
|
||||
}
|
||||
async login() { }
|
||||
async connect() {
|
||||
let optionInited = false;
|
||||
if (!this.socket) {
|
||||
|
|
@ -80,7 +79,7 @@ export class SubScriber extends Feature {
|
|||
});
|
||||
}
|
||||
async sub(data, callback) {
|
||||
const ids = data.map(ele => ele.id);
|
||||
const ids = data.map((ele) => ele.id);
|
||||
if (callback) {
|
||||
ids.forEach((id) => {
|
||||
assert(!this.callbackMap[id], `[subscriber]注册回调的id${id}发生重复`);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export * from './types/Initialize';
|
|||
export * from './types/Filter';
|
||||
export * from './types/AbstractComponent';
|
||||
export * from './types/Upload';
|
||||
export * from './types/Exception';
|
||||
export * from './utils/upload';
|
||||
export { CacheStore } from './cacheStore/CacheStore';
|
||||
export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export * from './types/Initialize';
|
|||
export * from './types/Filter';
|
||||
export * from './types/AbstractComponent';
|
||||
export * from './types/Upload';
|
||||
export * from './types/Exception';
|
||||
export * from './utils/upload';
|
||||
export { CacheStore } from './cacheStore/CacheStore';
|
||||
export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../../types/Page").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../../types/Page").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
entity: string | number;
|
||||
actions: string[];
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
relationId: string;
|
||||
entity: string | number;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <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, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
onEntityClicked: (entity: string) => void;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relation", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, "relation", true, {
|
||||
entity: string | number;
|
||||
entityId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relationAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "relationAuth", true, {
|
||||
entity: string | number;
|
||||
relationIds: string[];
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relationAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "relationAuth", true, {
|
||||
relationId: string;
|
||||
entity: string | number;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ exports.CacheStore = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var action_1 = require("oak-domain/lib/actions/action");
|
||||
var oak_memory_tree_store_1 = require("oak-memory-tree-store");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var SyncTriggerExecutor_1 = tslib_1.__importDefault(require("./SyncTriggerExecutor"));
|
||||
;
|
||||
var CacheStore = /** @class */ (function (_super) {
|
||||
|
|
@ -18,7 +18,7 @@ var CacheStore = /** @class */ (function (_super) {
|
|||
return this.aggregateSync(entity, aggregation, context, option);
|
||||
};
|
||||
CacheStore.prototype.cascadeUpdate = function (entity, operation, context, option) {
|
||||
(0, assert_1.default)(context.getCurrentTxnId());
|
||||
(0, assert_1.assert)(context.getCurrentTxnId());
|
||||
if (!option.blockTrigger) {
|
||||
this.triggerExecutor.check(entity, operation, context, 'before', option.checkerTypes);
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ var CacheStore = /** @class */ (function (_super) {
|
|||
return {};
|
||||
};
|
||||
CacheStore.prototype.operate = function (entity, operation, context, option) {
|
||||
(0, assert_1.default)(context.getCurrentTxnId());
|
||||
(0, assert_1.assert)(context.getCurrentTxnId());
|
||||
var result = _super.prototype.operateSync.call(this, entity, operation, context, option);
|
||||
return result;
|
||||
};
|
||||
|
|
@ -58,7 +58,7 @@ var CacheStore = /** @class */ (function (_super) {
|
|||
return result;
|
||||
};
|
||||
CacheStore.prototype.check = function (entity, operation, context, checkerTypes) {
|
||||
(0, assert_1.default)(context.getCurrentTxnId());
|
||||
(0, assert_1.assert)(context.getCurrentTxnId());
|
||||
var action = operation.action;
|
||||
if (action_1.readOnlyActions.includes(action)) {
|
||||
// 只读查询的checker只能在根部入口执行
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
// 简化版的对checker的同步检查
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var types_1 = require("oak-domain/lib/types");
|
||||
var checker_1 = require("oak-domain/lib/store/checker");
|
||||
var filter_1 = require("oak-domain/lib/store/filter");
|
||||
|
|
@ -98,9 +98,9 @@ var SyncTriggerExecutor = /** @class */ (function () {
|
|||
var filter = checker.filter;
|
||||
if (filter) {
|
||||
var filterr = typeof filter === 'function' ? filter(operation, context, {}) : filter;
|
||||
(0, assert_1.default)(!(filter instanceof Promise), "\u5BF9".concat(entity, "\u7684\u52A8\u4F5C").concat(action, "\u4E0A\u5B9A\u4E49\u7684checker\uFF0C\u5176filter\u8FD4\u56DE\u4E86Promise\uFF0C\u8BF7\u6CE8\u610F\u5C06\u540C\u6B65\u548C\u5F02\u6B65\u7684\u8FD4\u56DE\u533A\u5206\u5BF9\u5F85"));
|
||||
(0, assert_1.assert)(!(filter instanceof Promise), "\u5BF9".concat(entity, "\u7684\u52A8\u4F5C").concat(action, "\u4E0A\u5B9A\u4E49\u7684checker\uFF0C\u5176filter\u8FD4\u56DE\u4E86Promise\uFF0C\u8BF7\u6CE8\u610F\u5C06\u540C\u6B65\u548C\u5F02\u6B65\u7684\u8FD4\u56DE\u533A\u5206\u5BF9\u5F85"));
|
||||
var isRepel = (0, filter_1.checkFilterRepel)(entity, context, filterr, operation.filter, true);
|
||||
(0, assert_1.default)(typeof isRepel === 'boolean');
|
||||
(0, assert_1.assert)(typeof isRepel === 'boolean');
|
||||
if (isRepel) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { Item } from './types';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
entity: string | number;
|
||||
items: Item[];
|
||||
mode: "cell" | "table-cell";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { IMode, Item } from "./type";
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
entity: string | number;
|
||||
items: Item[];
|
||||
rows: number;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var usefulFn_1 = require("../../utils/usefulFn");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
exports.default = OakComponent({
|
||||
isList: false,
|
||||
properties: {
|
||||
|
|
@ -45,7 +44,7 @@ exports.default = OakComponent({
|
|||
ready: function () {
|
||||
var _a = this.props, attributes = _a.attributes, entity = _a.entity;
|
||||
var schema = this.features.cache.getSchema();
|
||||
(0, assert_1.default)(attributes);
|
||||
(0, assert_1.assert)(attributes);
|
||||
var judgeAttributes = (0, usefulFn_1.translateAttributes)(schema, entity, attributes);
|
||||
var ttt = this.t.bind(this);
|
||||
var transformer = (0, usefulFn_1.makeDataTransformer)(schema, entity, attributes, ttt);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import { ED } from '../../types/AbstractComponent';
|
||||
import { ColumnProps } from '../../types/Filter';
|
||||
import { ReactComponentProps } from '../../types/Page';
|
||||
declare const _default: (props: ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
|
||||
declare const _default: (props: ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
entity: string | number;
|
||||
column: ColumnProps<ED, string | number>;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var utils_1 = require("../filter2/utils");
|
||||
exports.default = OakComponent({
|
||||
entity: function () {
|
||||
|
|
@ -31,7 +31,7 @@ exports.default = OakComponent({
|
|||
count++;
|
||||
}
|
||||
});
|
||||
(0, assert_1.default)(!(count > 1), '仅支持一项进行全文检索');
|
||||
(0, assert_1.assert)(!(count > 1), '仅支持一项进行全文检索');
|
||||
// 小程序最多可显示三个过滤器,剩下的放在折叠面板
|
||||
if (process.env.OAK_PLATFORM === 'wechatMp') {
|
||||
columnsMp = columns === null || columns === void 0 ? void 0 : columns.slice(0, 3);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <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, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
name: string;
|
||||
size: number;
|
||||
color: string;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var usefulFn_1 = require("../../utils/usefulFn");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
exports.default = OakComponent({
|
||||
isList: false,
|
||||
properties: {
|
||||
|
|
@ -46,8 +46,8 @@ exports.default = OakComponent({
|
|||
_a = this.props, attributes = _a.attributes, entity = _a.entity, data = _a.data;
|
||||
schema = this.features.cache.getSchema();
|
||||
colorDict = this.features.style.getColorDict();
|
||||
(0, assert_1.default)(!!data, 'data不能为空');
|
||||
(0, assert_1.default)(!!entity, 'list属性entity不能为空');
|
||||
(0, assert_1.assert)(!!data, 'data不能为空');
|
||||
(0, assert_1.assert)(!!entity, 'list属性entity不能为空');
|
||||
ttt = this.t.bind(this);
|
||||
converter = (0, usefulFn_1.analyzeAttrMobileForCard)(schema, entity, ttt, attributes);
|
||||
judgeAttributes = (0, usefulFn_1.translateAttributes)(schema, entity, attributes);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ var tslib_1 = require("tslib");
|
|||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var react_1 = require("react");
|
||||
var antd_1 = require("antd");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var actionBtn_1 = tslib_1.__importDefault(require("../actionBtn"));
|
||||
var usefulFn_1 = require("../../utils/usefulFn");
|
||||
|
|
@ -31,9 +31,9 @@ function Render(props) {
|
|||
}
|
||||
var tableColumns_1 = showAttributes && showAttributes.map(function (ele) {
|
||||
if (ele.entity === 'notExist') {
|
||||
(0, assert_1.default)(ele.attribute.width, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49width"));
|
||||
(0, assert_1.default)(ele.attribute.type, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49type"));
|
||||
(0, assert_1.default)(ele.attribute.label, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49label"));
|
||||
(0, assert_1.assert)(ele.attribute.width, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49width"));
|
||||
(0, assert_1.assert)(ele.attribute.type, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49type"));
|
||||
(0, assert_1.assert)(ele.attribute.label, "\u975Eschema\u5C5E\u6027".concat(ele.attr, "\u9700\u8981\u81EA\u5B9A\u4E49label"));
|
||||
}
|
||||
var title = (0, usefulFn_1.getLabel)(ele.attribute, ele.entity, ele.attr, t);
|
||||
var width = (0, usefulFn_1.getWidth)(ele.attribute, ele.attrType);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var react_1 = require("react");
|
||||
var Map_1 = tslib_1.__importDefault(require("ol/Map"));
|
||||
var Feature_1 = tslib_1.__importDefault(require("ol/Feature"));
|
||||
|
|
@ -37,7 +37,7 @@ function Map(props) {
|
|||
}),
|
||||
new Vector_2.default({
|
||||
source: new Vector_1.default(),
|
||||
})
|
||||
}),
|
||||
],
|
||||
view: new View_1.default({
|
||||
center: (0, proj_1.fromLonLat)(props.center || DEFAULT_CENTER),
|
||||
|
|
@ -89,8 +89,10 @@ function Map(props) {
|
|||
(0, react_1.useEffect)(function () {
|
||||
// marker好像没有效果,以后再调
|
||||
if (props.markers && map) {
|
||||
var markerLayer = map.getAllLayers().find(function (ele) { return ele instanceof Vector_2.default; });
|
||||
(0, assert_1.default)(markerLayer && markerLayer instanceof Vector_2.default);
|
||||
var markerLayer = map
|
||||
.getAllLayers()
|
||||
.find(function (ele) { return ele instanceof Vector_2.default; });
|
||||
(0, assert_1.assert)(markerLayer && markerLayer instanceof Vector_2.default);
|
||||
var feature = markerLayer.getSource().getFeatureById('markers');
|
||||
if (feature) {
|
||||
// feature.setGeometry(new MultiPoint(props.markers.map(ele => fromLonLat(ele))));
|
||||
|
|
@ -106,12 +108,12 @@ function Map(props) {
|
|||
color: 'red',
|
||||
}),
|
||||
// 圆形半径
|
||||
radius: 10
|
||||
radius: 10,
|
||||
}),
|
||||
// 填充样式
|
||||
fill: new style_1.Fill({
|
||||
color: 'red',
|
||||
})
|
||||
}),
|
||||
}));
|
||||
feature.setId('markers');
|
||||
markerLayer.getSource().addFeature(feature);
|
||||
|
|
@ -119,7 +121,6 @@ function Map(props) {
|
|||
map.render();
|
||||
}
|
||||
}, [props.markers]);
|
||||
return (0, jsx_runtime_1.jsx)("div", { id: "map-".concat(id || prefix), className: web_module_less_1.default.map, style: props.style });
|
||||
return ((0, jsx_runtime_1.jsx)("div", { id: "map-".concat(id || prefix), className: web_module_less_1.default.map, style: props.style }));
|
||||
}
|
||||
exports.default = Map;
|
||||
;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/// <reference types="react" />
|
||||
import { ED } from '../../types/AbstractComponent';
|
||||
import { RowWithActions } from '../..';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, true, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
entity: string | number;
|
||||
multiple: boolean;
|
||||
onSelect: (value: [{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { ED, OakAbsRefAttrPickerRender } from '../../types/AbstractComponent';
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, string | number, false, {
|
||||
declare const _default: (props: import("../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, false, {
|
||||
placeholder: string | undefined;
|
||||
multiple: boolean;
|
||||
entityId: string;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
exports.default = OakComponent({
|
||||
isList: false,
|
||||
/* entity() {
|
||||
|
|
@ -46,7 +46,7 @@ exports.default = OakComponent({
|
|||
},
|
||||
entityIds: function () {
|
||||
this.reRender();
|
||||
}
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
ready: function () {
|
||||
|
|
@ -56,7 +56,7 @@ exports.default = OakComponent({
|
|||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
refreshData: function () {
|
||||
|
|
@ -69,11 +69,11 @@ exports.default = OakComponent({
|
|||
_b = pickerRender, mode = _b.mode, entity = _b.entity, projection = _b.projection, filter = _b.filter, count = _b.count, title = _b.title;
|
||||
if (mode === 'radio') {
|
||||
// radio的要先取数据出来
|
||||
(0, assert_1.default)(typeof count === 'number' && count <= 5, 'radio类型的外键选择,总数必须小于5');
|
||||
(0, assert_1.assert)(typeof count === 'number' && count <= 5, 'radio类型的外键选择,总数必须小于5');
|
||||
}
|
||||
else if (mode === 'select') {
|
||||
// select也先取(可以点击再取,但这样初始状态不好渲染)
|
||||
(0, assert_1.default)(typeof count === 'number' && count <= 20, 'select类型的外键选择,总数必须小于20');
|
||||
(0, assert_1.assert)(typeof count === 'number' && count <= 20, 'select类型的外键选择,总数必须小于20');
|
||||
}
|
||||
else {
|
||||
return [2 /*return*/];
|
||||
|
|
@ -100,5 +100,5 @@ exports.default = OakComponent({
|
|||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference types="react" />
|
||||
import { EntityDict } from "oak-domain/lib/types";
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
path: string;
|
||||
openTip: boolean;
|
||||
entity: string | number;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ exports.DebugStore = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var oak_memory_tree_store_1 = require("oak-memory-tree-store");
|
||||
var TriggerExecutor_1 = require("oak-domain/lib/store/TriggerExecutor");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var RelationAuth_1 = require("oak-domain/lib/store/RelationAuth");
|
||||
;
|
||||
;
|
||||
|
|
@ -64,7 +64,7 @@ var DebugStore = /** @class */ (function (_super) {
|
|||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
(0, assert_1.default)(context.getCurrentTxnId());
|
||||
(0, assert_1.assert)(context.getCurrentTxnId());
|
||||
/**
|
||||
* 这里似乎还有点问题,如果在后续的checker里增加了cascadeUpdate,是无法在一开始检查权限的
|
||||
* 后台的DbStore也一样 by Xc 20230801
|
||||
|
|
@ -87,7 +87,7 @@ var DebugStore = /** @class */ (function (_super) {
|
|||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
(0, assert_1.default)(context.getCurrentTxnId());
|
||||
(0, assert_1.assert)(context.getCurrentTxnId());
|
||||
Object.assign(selection, {
|
||||
action: 'select',
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ var Feature_1 = require("../types/Feature");
|
|||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var CacheStore_1 = require("../cacheStore/CacheStore");
|
||||
var Exception_1 = require("oak-domain/lib/types/Exception");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var constant_1 = require("../constant/constant");
|
||||
var filter_1 = require("oak-domain/lib/store/filter");
|
||||
var DEFAULT_KEEP_FRESH_PERIOD = 600 * 1000; // 10分钟不刷新
|
||||
|
|
@ -252,7 +252,7 @@ var Cache = /** @class */ (function (_super) {
|
|||
now = 0, key = '';
|
||||
if (canOptimize) {
|
||||
filter = selection.filter;
|
||||
(0, assert_1.default)(filter);
|
||||
(0, assert_1.assert)(filter);
|
||||
originFilter = filter;
|
||||
key = this.filterToKey(filter);
|
||||
now = Date.now();
|
||||
|
|
@ -485,7 +485,7 @@ var Cache = /** @class */ (function (_super) {
|
|||
};
|
||||
Cache.prototype.redoOperation = function (opers) {
|
||||
var _this = this;
|
||||
(0, assert_1.default)(this.context);
|
||||
(0, assert_1.assert)(this.context);
|
||||
opers.forEach(function (oper) {
|
||||
var entity = oper.entity, operation = oper.operation;
|
||||
_this.cacheStore.operate(entity, operation, _this.context, {
|
||||
|
|
@ -512,11 +512,11 @@ var Cache = /** @class */ (function (_super) {
|
|||
for (_a = tslib_1.__values(opRecords), _b = _a.next(); !_b.done; _b = _a.next()) {
|
||||
record = _b.value;
|
||||
d = record.d;
|
||||
(0, assert_1.default)(Object.keys(d).length > 0, '在通过fetchRow取不一致数据时返回了空数据,请拿该程序员祭天。');
|
||||
(0, assert_1.assert)(Object.keys(d).length > 0, '在通过fetchRow取不一致数据时返回了空数据,请拿该程序员祭天。');
|
||||
try {
|
||||
for (missedRows_1 = (e_6 = void 0, tslib_1.__values(missedRows)), missedRows_1_1 = missedRows_1.next(); !missedRows_1_1.done; missedRows_1_1 = missedRows_1.next()) {
|
||||
mr = missedRows_1_1.value;
|
||||
(0, assert_1.default)(Object.keys(d[mr.entity]).length > 0, "\u5728\u901A\u8FC7fetchRow\u53D6\u4E0D\u4E00\u81F4\u6570\u636E\u65F6\u8FD4\u56DE\u4E86\u7A7A\u6570\u636E\uFF0C\u8BF7\u62FF\u8BE5\u7A0B\u5E8F\u5458\u796D\u5929\u3002entity\u662F".concat(mr.entity));
|
||||
(0, assert_1.assert)(Object.keys(d[mr.entity]).length > 0, "\u5728\u901A\u8FC7fetchRow\u53D6\u4E0D\u4E00\u81F4\u6570\u636E\u65F6\u8FD4\u56DE\u4E86\u7A7A\u6570\u636E\uFF0C\u8BF7\u62FF\u8BE5\u7A0B\u5E8F\u5458\u796D\u5929\u3002entity\u662F".concat(mr.entity));
|
||||
}
|
||||
}
|
||||
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
||||
|
|
@ -618,18 +618,18 @@ var Cache = /** @class */ (function (_super) {
|
|||
return this.getFullDataFn();
|
||||
};
|
||||
Cache.prototype.begin = function () {
|
||||
(0, assert_1.default)(!this.context);
|
||||
(0, assert_1.assert)(!this.context);
|
||||
this.context = this.contextBuilder();
|
||||
this.context.begin();
|
||||
return this.context;
|
||||
};
|
||||
Cache.prototype.commit = function () {
|
||||
(0, assert_1.default)(this.context);
|
||||
(0, assert_1.assert)(this.context);
|
||||
this.context.commit();
|
||||
this.context = undefined;
|
||||
};
|
||||
Cache.prototype.rollback = function () {
|
||||
(0, assert_1.default)(this.context);
|
||||
(0, assert_1.assert)(this.context);
|
||||
this.context.rollback();
|
||||
this.context = undefined;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ContextMenuFactory = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var Feature_1 = require("../types/Feature");
|
||||
var relation_1 = require("oak-domain/lib/store/relation");
|
||||
;
|
||||
var ContextMenuFactory = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(ContextMenuFactory, _super);
|
||||
function ContextMenuFactory(cache, relationAuth, cascadePathGraph) {
|
||||
|
|
@ -17,13 +16,14 @@ var ContextMenuFactory = /** @class */ (function (_super) {
|
|||
return _this;
|
||||
}
|
||||
ContextMenuFactory.prototype.setMenus = function (menus) {
|
||||
(0, assert_1.default)(!this.menus, 'setMenus只应该全局调用一次');
|
||||
(0, assert_1.assert)(!this.menus, 'setMenus只应该全局调用一次');
|
||||
this.menus = menus;
|
||||
};
|
||||
ContextMenuFactory.prototype.makeMenuFilters = function (destEntity, paths, entity, entityId) {
|
||||
var schema = this.cache.getSchema();
|
||||
(0, assert_1.default)(paths.length > 0);
|
||||
var filters = paths.map(function (path) {
|
||||
(0, assert_1.assert)(paths.length > 0);
|
||||
var filters = paths
|
||||
.map(function (path) {
|
||||
if (path === '') {
|
||||
if (entity === destEntity) {
|
||||
return {
|
||||
|
|
@ -44,7 +44,7 @@ var ContextMenuFactory = /** @class */ (function (_super) {
|
|||
e3 = attr;
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(rel instanceof Array);
|
||||
(0, assert_1.assert)(rel instanceof Array);
|
||||
e3 = rel[0];
|
||||
}
|
||||
if (idx === pathhh.length - 1) {
|
||||
|
|
@ -72,15 +72,19 @@ var ContextMenuFactory = /** @class */ (function (_super) {
|
|||
return judgeIter(e3, idx + 1);
|
||||
};
|
||||
return judgeIter(destEntity, 0);
|
||||
}).filter(function (ele) { return !!ele; });
|
||||
})
|
||||
.filter(function (ele) { return !!ele; });
|
||||
return filters;
|
||||
};
|
||||
ContextMenuFactory.prototype.getMenusByContext = function (entity, entityId) {
|
||||
var _this = this;
|
||||
(0, assert_1.default)(this.menus, '应当先调用setMenus才能动态判定菜单');
|
||||
var menus = this.menus.filter(function (menu) {
|
||||
(0, assert_1.assert)(this.menus, '应当先调用setMenus才能动态判定菜单');
|
||||
var menus = this.menus
|
||||
.filter(function (menu) {
|
||||
var destEntity = menu.entity, paths = menu.paths, action = menu.action;
|
||||
var filters = paths.length > 0 ? _this.makeMenuFilters(destEntity, paths, entity, entityId) : [{}]; // 如果没有path,视为无法推断操作的filter,直接返回无任何限制
|
||||
var filters = paths.length > 0
|
||||
? _this.makeMenuFilters(destEntity, paths, entity, entityId)
|
||||
: [{}]; // 如果没有path,视为无法推断操作的filter,直接返回无任何限制
|
||||
if (filters.length > 0) {
|
||||
// 这里应该是or关系,paths表达的路径中只要有一条满足就可能满足
|
||||
var allows = filters.map(function (filter) {
|
||||
|
|
@ -88,11 +92,17 @@ var ContextMenuFactory = /** @class */ (function (_super) {
|
|||
return true;
|
||||
}
|
||||
// relationAuth和其它的checker现在分开判断
|
||||
return _this.relationAuth.checkRelation(destEntity, {
|
||||
return (_this.relationAuth.checkRelation(destEntity, {
|
||||
action: action,
|
||||
data: undefined,
|
||||
filter: filter,
|
||||
}) && _this.cache.checkOperation(destEntity, action, undefined, filter, ['logical', 'relation', 'logicalRelation', 'row']);
|
||||
}) &&
|
||||
_this.cache.checkOperation(destEntity, action, undefined, filter, [
|
||||
'logical',
|
||||
'relation',
|
||||
'logicalRelation',
|
||||
'row',
|
||||
]));
|
||||
});
|
||||
if (allows.indexOf(true) >= 0) {
|
||||
return true;
|
||||
|
|
@ -100,7 +110,8 @@ var ContextMenuFactory = /** @class */ (function (_super) {
|
|||
return false;
|
||||
}
|
||||
return false;
|
||||
}).map(function (wrapper) { return (0, lodash_1.omit)(wrapper, ['filtersMaker']); });
|
||||
})
|
||||
.map(function (wrapper) { return (0, lodash_1.omit)(wrapper, ['filtersMaker']); });
|
||||
return menus;
|
||||
};
|
||||
return ContextMenuFactory;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ exports.Environment = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var Feature_1 = require("../types/Feature");
|
||||
var env_1 = require("../utils/env/env");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var Exception_1 = require("../types/Exception");
|
||||
var Environment = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Environment, _super);
|
||||
|
|
@ -47,11 +47,11 @@ var Environment = /** @class */ (function (_super) {
|
|||
return [2 /*return*/, this.env];
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(this.loading);
|
||||
(0, assert_1.assert)(this.loading);
|
||||
return [2 /*return*/, new Promise(function (resolve, reject) {
|
||||
var fn = _this.subscribe(function () {
|
||||
fn();
|
||||
(0, assert_1.default)(_this.env);
|
||||
(0, assert_1.assert)(_this.env);
|
||||
resolve(_this.env);
|
||||
});
|
||||
})];
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.Locales = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var Feature_1 = require("../types/Feature");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var i18n_js_1 = require("i18n-js");
|
||||
var constant_1 = require("../constant/constant");
|
||||
var Locales = /** @class */ (function (_super) {
|
||||
|
|
@ -31,7 +31,7 @@ var Locales = /** @class */ (function (_super) {
|
|||
_this.i18n.missingBehavior = 'loadData';
|
||||
_this.i18n.missingTranslation.register("loadData", function (i18n, scope, options) {
|
||||
_this.loadData(scope);
|
||||
(0, assert_1.default)(typeof scope === 'string');
|
||||
(0, assert_1.assert)(typeof scope === 'string');
|
||||
return scope.split('.').pop();
|
||||
});
|
||||
// 同时注册一个返回空字符串的策略
|
||||
|
|
@ -91,7 +91,7 @@ var Locales = /** @class */ (function (_super) {
|
|||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
(0, assert_1.default)(typeof key === 'string');
|
||||
(0, assert_1.assert)(typeof key === 'string');
|
||||
_a = tslib_1.__read(key.split('.'), 1), ns = _a[0];
|
||||
return [4 /*yield*/, this.cache.refresh('i18n', {
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Navigator = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var url_1 = tslib_1.__importDefault(require("url"));
|
||||
var Feature_1 = require("../types/Feature");
|
||||
var Navigator = /** @class */ (function (_super) {
|
||||
|
|
@ -39,12 +39,12 @@ var Navigator = /** @class */ (function (_super) {
|
|||
var urlParse = url_1.default.parse(url, true);
|
||||
var _a = urlParse, pathname = _a.pathname, search = _a.search;
|
||||
if (!/^\/{1}/.test(pathname)) {
|
||||
(0, assert_1.default)(false, 'url前面必须以/开头');
|
||||
(0, assert_1.assert)(false, 'url前面必须以/开头');
|
||||
}
|
||||
// 格式:/house/list 前面加上/pages 后面加上/index
|
||||
if ((pathname === null || pathname === void 0 ? void 0 : pathname.indexOf('pages')) !== -1 ||
|
||||
(pathname === null || pathname === void 0 ? void 0 : pathname.lastIndexOf('index')) !== -1) {
|
||||
(0, assert_1.default)(false, 'url两边不需要加上/pages和/index');
|
||||
(0, assert_1.assert)(false, 'url两边不需要加上/pages和/index');
|
||||
}
|
||||
var pathname2 = "/pages".concat(pathname, "/index");
|
||||
var search2 = search;
|
||||
|
|
|
|||
|
|
@ -1831,20 +1831,26 @@ var RunningTree = /** @class */ (function (_super) {
|
|||
var includeModi = path.includes(exports.MODI_NEXT_PATH_SUFFIX);
|
||||
if (node) {
|
||||
this.cache.begin();
|
||||
(0, assert_1.assert)(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
var opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
try {
|
||||
(0, assert_1.assert)(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
var opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
}
|
||||
}
|
||||
var opers = root === null || root === void 0 ? void 0 : root.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
}
|
||||
var value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
var opers = root === null || root === void 0 ? void 0 : root.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
catch (err) {
|
||||
this.cache.rollback();
|
||||
throw err;
|
||||
}
|
||||
var value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
};
|
||||
RunningTree.prototype.isDirty = function (path) {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { Cache } from './cache';
|
||||
import { SyncContext } from "oak-domain/lib/store/SyncRowStore";
|
||||
import { Feature } from "../types/Feature";
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { Feature } from '../types/Feature';
|
||||
declare type SubscribeEvent = 'connect' | 'disconnect';
|
||||
export declare class SubScriber<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends CommonAspectDict<ED, Cxt> & Record<string, Aspect<ED, Cxt>>> extends Feature {
|
||||
private cache;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|||
import { CommonAspectDict } from 'oak-common-aspect';
|
||||
import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
||||
import { Cache } from './cache';
|
||||
import { SyncContext } from "oak-domain/lib/store/SyncRowStore";
|
||||
import { Feature } from "../types/Feature";
|
||||
import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
||||
import { Feature } from '../types/Feature';
|
||||
declare type SubscribeEvent = 'connect' | 'disconnect';
|
||||
export declare class SubScriber<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends CommonAspectDict<ED, Cxt> & Record<string, Aspect<ED, Cxt>>> extends Feature {
|
||||
private eventCallbackMap;
|
||||
|
|
|
|||
|
|
@ -29,11 +29,9 @@ var SubScriber = /** @class */ (function (_super) {
|
|||
});
|
||||
};
|
||||
SubScriber.prototype.unsub = function (ids) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/];
|
||||
}); });
|
||||
};
|
||||
return SubScriber;
|
||||
}(Feature_1.Feature));
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SubScriber = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var socket_io_1 = tslib_1.__importDefault(require("../utils/socket.io/socket.io"));
|
||||
var Feature_1 = require("../types/Feature");
|
||||
|
|
@ -47,11 +47,9 @@ var SubScriber = /** @class */ (function (_super) {
|
|||
});
|
||||
};
|
||||
SubScriber.prototype.login = function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
||||
return [2 /*return*/];
|
||||
}); });
|
||||
};
|
||||
SubScriber.prototype.connect = function () {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
|
|
@ -135,7 +133,7 @@ var SubScriber = /** @class */ (function (_super) {
|
|||
ids = data.map(function (ele) { return ele.id; });
|
||||
if (callback) {
|
||||
ids.forEach(function (id) {
|
||||
(0, assert_1.default)(!_this.callbackMap[id], "[subscriber]\u6CE8\u518C\u56DE\u8C03\u7684id".concat(id, "\u53D1\u751F\u91CD\u590D"));
|
||||
(0, assert_1.assert)(!_this.callbackMap[id], "[subscriber]\u6CE8\u518C\u56DE\u8C03\u7684id".concat(id, "\u53D1\u751F\u91CD\u590D"));
|
||||
_this.callbackMap[id] = callback;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
export * from './types/Feature';
|
||||
export { BasicFeatures } from './features';
|
||||
export type { BasicFeatures } from './features';
|
||||
export * from './features/cache';
|
||||
export * from './features/localStorage';
|
||||
export * from './utils/upload';
|
||||
export * from './types/Notification';
|
||||
export * from './types/Message';
|
||||
export * from './types/Page';
|
||||
export * from './types/Initialize';
|
||||
export * from './types/Filter';
|
||||
export * from './types/AbstractComponent';
|
||||
export * from './types/Upload';
|
||||
export * from './types/Exception';
|
||||
export * from './utils/upload';
|
||||
export { CacheStore } from './cacheStore/CacheStore';
|
||||
export { default as SyncTriggerExecutor } from './cacheStore/SyncTriggerExecutor';
|
||||
export { DebugStore } from './debugStore/DebugStore';
|
||||
|
|
|
|||
11
lib/index.js
11
lib/index.js
|
|
@ -1,13 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DebugStore = exports.SyncTriggerExecutor = exports.CacheStore = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./types/Feature"), exports);
|
||||
tslib_1.__exportStar(require("./features/cache"), exports);
|
||||
tslib_1.__exportStar(require("./features/localStorage"), exports);
|
||||
tslib_1.__exportStar(require("./utils/upload"), exports);
|
||||
tslib_1.__exportStar(require("./types/Notification"), exports);
|
||||
tslib_1.__exportStar(require("./types/Message"), exports);
|
||||
tslib_1.__exportStar(require("./types/Page"), exports);
|
||||
tslib_1.__exportStar(require("./types/Initialize"), exports);
|
||||
tslib_1.__exportStar(require("./types/Filter"), exports);
|
||||
tslib_1.__exportStar(require("./types/AbstractComponent"), exports);
|
||||
tslib_1.__exportStar(require("./types/Upload"), exports);
|
||||
tslib_1.__exportStar(require("./types/Exception"), exports);
|
||||
tslib_1.__exportStar(require("./utils/upload"), exports);
|
||||
var CacheStore_1 = require("./cacheStore/CacheStore");
|
||||
Object.defineProperty(exports, "CacheStore", { enumerable: true, get: function () { return CacheStore_1.CacheStore; } });
|
||||
var SyncTriggerExecutor_1 = require("./cacheStore/SyncTriggerExecutor");
|
||||
Object.defineProperty(exports, "SyncTriggerExecutor", { enumerable: true, get: function () { return tslib_1.__importDefault(SyncTriggerExecutor_1).default; } });
|
||||
var DebugStore_1 = require("./debugStore/DebugStore");
|
||||
Object.defineProperty(exports, "DebugStore", { enumerable: true, get: function () { return DebugStore_1.DebugStore; } });
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
exports.createComponent = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
/// <reference path="../node_modules/@types/wechat-miniprogram/index.d.ts" />
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var page_common_1 = require("./page.common");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var OakProperties = {
|
||||
|
|
@ -103,7 +103,7 @@ var oakBehavior = Behavior({
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)(false);
|
||||
(0, assert_1.assert)(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ var oakBehavior = Behavior({
|
|||
this.features.runningTree.setPageSize(path2, pageSize);
|
||||
},
|
||||
setCurrentPage: function (currentPage, path) {
|
||||
(0, assert_1.default)(currentPage !== 0);
|
||||
(0, assert_1.assert)(currentPage !== 0);
|
||||
if (this.state.oakEntity && this.state.oakFullpath) {
|
||||
var path2 = path
|
||||
? "".concat(this.state.oakFullpath, ".").concat(path)
|
||||
|
|
@ -705,7 +705,7 @@ function createComponent(option, features) {
|
|||
_this.subscribed.push(features[ele].subscribe(function () { return _this.reRender(); }));
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(typeof ele === 'object');
|
||||
(0, assert_1.assert)(typeof ele === 'object');
|
||||
var feature = ele.feature, behavior_1 = ele.behavior;
|
||||
_this.subscribed.push(features[feature].subscribe(function () {
|
||||
switch (behavior_1) {
|
||||
|
|
@ -714,7 +714,7 @@ function createComponent(option, features) {
|
|||
return;
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)(behavior_1 === 'refresh');
|
||||
(0, assert_1.assert)(behavior_1 === 'refresh');
|
||||
_this.refresh();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ exports.createComponent = void 0;
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
/// <reference path="../node_modules/@types/wechat-miniprogram/index.d.ts" />
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var react_1 = tslib_1.__importDefault(require("react"));
|
||||
var web_1 = require("./platforms/web");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
|
|
@ -381,7 +381,7 @@ var OakComponentBase = /** @class */ (function (_super) {
|
|||
}
|
||||
};
|
||||
OakComponentBase.prototype.setCurrentPage = function (currentPage, path) {
|
||||
(0, assert_1.default)(currentPage !== 0);
|
||||
(0, assert_1.assert)(currentPage !== 0);
|
||||
if (this.state.oakEntity && this.state.oakFullpath) {
|
||||
var path2 = path
|
||||
? "".concat(this.state.oakFullpath, ".").concat(path)
|
||||
|
|
@ -707,7 +707,7 @@ function createComponent(option, features) {
|
|||
_this.subscribed.push(features[ele].subscribe(function () { return _this.reRender(); }));
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(typeof ele === 'object');
|
||||
(0, assert_1.assert)(typeof ele === 'object');
|
||||
var feature = ele.feature, behavior_1 = ele.behavior;
|
||||
_this.subscribed.push(features[feature].subscribe(function () {
|
||||
switch (behavior_1) {
|
||||
|
|
@ -716,7 +716,7 @@ function createComponent(option, features) {
|
|||
return;
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)(behavior_1 === 'refresh');
|
||||
(0, assert_1.assert)(behavior_1 === 'refresh');
|
||||
_this.refresh();
|
||||
return;
|
||||
}
|
||||
|
|
@ -744,7 +744,7 @@ function createComponent(option, features) {
|
|||
case 0:
|
||||
if (!(prevProps.oakPath !== this.props.oakPath)) return [3 /*break*/, 2];
|
||||
// oakPath如果是用变量初始化,在这里再执行onPathSet,如果有entity的结点在此执行ready
|
||||
(0, assert_1.default)(this.props.oakPath);
|
||||
(0, assert_1.assert)(this.props.oakPath);
|
||||
return [4 /*yield*/, this.onPathSet()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
|
|
@ -758,7 +758,7 @@ function createComponent(option, features) {
|
|||
_a.label = 2;
|
||||
case 2:
|
||||
if (this.props.oakId !== prevProps.oakId) {
|
||||
(0, assert_1.default)(this.props.oakId); // 好像不可能把已有的id设空的界面需求吧
|
||||
(0, assert_1.assert)(this.props.oakId); // 好像不可能把已有的id设空的界面需求吧
|
||||
this.setId(this.props.oakId);
|
||||
}
|
||||
/* 这几个东西暂不支持变化,必须在初始化时确定
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../../types/Page").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../../types/Page").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
entity: string | number;
|
||||
actions: string[];
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "actionAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "actionAuth", true, {
|
||||
relationId: string;
|
||||
entity: string | number;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <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, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, string | number, true, {
|
||||
onEntityClicked: (entity: string) => void;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ exports.default = OakComponent({
|
|||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relation", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain").EntityDict & import("oak-domain").BaseEntityDict, "relation", true, {
|
||||
entity: string | number;
|
||||
entityId: string;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
exports.default = OakComponent({
|
||||
entity: 'relation',
|
||||
isList: true,
|
||||
|
|
@ -24,7 +23,7 @@ exports.default = OakComponent({
|
|||
}
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(ele.entityId === _this.props.entityId);
|
||||
(0, assert_1.assert)(ele.entityId === _this.props.entityId);
|
||||
}
|
||||
});
|
||||
var hasRelationEntites = this.features.relationAuth.getHasRelationEntities();
|
||||
|
|
@ -43,13 +42,16 @@ exports.default = OakComponent({
|
|||
}
|
||||
if (entityId) {
|
||||
Object.assign(filter, {
|
||||
$or: [{
|
||||
$or: [
|
||||
{
|
||||
entityId: {
|
||||
$exists: false,
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
entityId: entityId,
|
||||
}]
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
|
@ -60,8 +62,8 @@ exports.default = OakComponent({
|
|||
});
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
properties: {
|
||||
entity: '',
|
||||
|
|
@ -84,6 +86,6 @@ exports.default = OakComponent({
|
|||
relationId: id,
|
||||
entity: entity,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ var tslib_1 = require("tslib");
|
|||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var list_1 = tslib_1.__importDefault(require("../../../components/list"));
|
||||
var filterPanel_1 = tslib_1.__importDefault(require("../../../components/filterPanel"));
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
function render(props) {
|
||||
var _a = props.data, relations = _a.relations, oakLoading = _a.oakLoading, oakFullpath = _a.oakFullpath, hasRelationEntites = _a.hasRelationEntites;
|
||||
var _b = props.methods, onActionClicked = _b.onActionClicked, onRelationClicked = _b.onRelationClicked;
|
||||
|
|
@ -27,7 +27,7 @@ function render(props) {
|
|||
onActionClicked(id, entity);
|
||||
}
|
||||
else {
|
||||
(0, assert_1.default)(action === 'relation');
|
||||
(0, assert_1.assert)(action === 'relation');
|
||||
onRelationClicked(id, entity);
|
||||
}
|
||||
} })] }));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relationAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "relationAuth", true, {
|
||||
entity: string | number;
|
||||
relationIds: string[];
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/// <reference types="react" />
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain/lib/base-app-domain").EntityDict, "relationAuth", true, {
|
||||
declare const _default: (props: import("../../..").ReactComponentProps<import("oak-domain/lib/types").EntityDict & import("oak-domain").BaseEntityDict, "relationAuth", true, {
|
||||
relationId: string;
|
||||
entity: string | number;
|
||||
}>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ var react_1 = tslib_1.__importDefault(require("react"));
|
|||
var react_router_dom_1 = require("react-router-dom");
|
||||
var responsive_1 = require("./../responsive");
|
||||
var url_1 = tslib_1.__importDefault(require("url"));
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
function getParams(location, properties) {
|
||||
var search = location.search, state = location.state;
|
||||
var query = getQuery(search, properties);
|
||||
|
|
@ -46,7 +46,7 @@ function getQuery(url, properties) {
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
(0, assert_1.default)(typeof properties[k] === 'string', '传参只能是number/boolean/object/string四种类型');
|
||||
(0, assert_1.assert)(typeof properties[k] === 'string', '传参只能是number/boolean/object/string四种类型');
|
||||
Object.assign(query2, (_d = {},
|
||||
_d[k] = query[k],
|
||||
_d));
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.analyzeAttrMobileForCard = exports.translateAttributes = exports.analyzeDataUpsertTransformer = exports.makeDataTransformer = exports.getType = exports.getAlign = exports.getValue = exports.getWidth = exports.getLabel = exports.getPath = exports.getLinkUrl = exports.resolvePath = exports.getAttributes = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var assert_1 = tslib_1.__importDefault(require("assert"));
|
||||
var assert_1 = require("oak-domain/lib/utils/assert");
|
||||
var relation_1 = require("oak-domain/lib/store/relation");
|
||||
var lodash_1 = require("oak-domain/lib/utils/lodash");
|
||||
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||
|
|
@ -37,7 +37,7 @@ function getAttributes(attributes) {
|
|||
}
|
||||
exports.getAttributes = getAttributes;
|
||||
function resolvePath(dataSchema, entity, path) {
|
||||
(0, assert_1.default)(!path.includes('['), '数组索引不需要携带[],请使用arr.0.value');
|
||||
(0, assert_1.assert)(!path.includes('['), '数组索引不需要携带[],请使用arr.0.value');
|
||||
var attrs = path.split('.');
|
||||
var idx = 0;
|
||||
var _entity = entity;
|
||||
|
|
@ -174,7 +174,13 @@ function getValue(data, path, entity, attr, attrType, t) {
|
|||
}
|
||||
exports.getValue = getValue;
|
||||
function getAlign(attrType) {
|
||||
var rightType = ['float', 'int', 'bigint', 'decimal', 'money'];
|
||||
var rightType = [
|
||||
'float',
|
||||
'int',
|
||||
'bigint',
|
||||
'decimal',
|
||||
'money',
|
||||
];
|
||||
if (rightType.includes(attrType)) {
|
||||
return 'right';
|
||||
}
|
||||
|
|
@ -231,7 +237,7 @@ function analyzeDataUpsertTransformer(dataSchema, entity, attrUpsertDefs) {
|
|||
var makeNativeFixedPart = function (attr, def) {
|
||||
var attrDef = dataSchema[entity].attributes[attr]; // upsert应该不会涉及createAt这些内置属性
|
||||
var type = attrDef.type, required = attrDef.notNull, defaultValue = attrDef.default, enumeration = attrDef.enumeration, params = attrDef.params;
|
||||
(0, assert_1.default)(type !== 'ref');
|
||||
(0, assert_1.assert)(type !== 'ref');
|
||||
return {
|
||||
attr: attr,
|
||||
type: type,
|
||||
|
|
@ -255,11 +261,11 @@ function analyzeDataUpsertTransformer(dataSchema, entity, attrUpsertDefs) {
|
|||
.map(function (ele) {
|
||||
if (typeof ele === 'string') {
|
||||
var rel = (0, relation_1.judgeRelation)(dataSchema, entity, ele);
|
||||
(0, assert_1.default)(rel === 1);
|
||||
(0, assert_1.assert)(rel === 1);
|
||||
return makeNativeFixedPart(ele);
|
||||
}
|
||||
else if (typeof ele === 'object' && ele.type === 'geo') {
|
||||
(0, assert_1.default)(!geoDef, '只能定义一个geo渲染对象');
|
||||
(0, assert_1.assert)(!geoDef, '只能定义一个geo渲染对象');
|
||||
geoDef = ele;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -1959,20 +1959,26 @@ export class RunningTree<
|
|||
const includeModi = path.includes(MODI_NEXT_PATH_SUFFIX);
|
||||
if (node) {
|
||||
this.cache.begin();
|
||||
assert(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
const opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
try {
|
||||
assert(node instanceof ListNode || node instanceof SingleNode);
|
||||
if (includeModi) {
|
||||
const opers2 = node.getActiveModiOperations();
|
||||
if (opers2) {
|
||||
this.cache.redoOperation(opers2);
|
||||
}
|
||||
}
|
||||
const opers = root?.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
}
|
||||
const value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
const opers = root?.composeOperations();
|
||||
if (opers) {
|
||||
this.cache.redoOperation(opers);
|
||||
catch(err) {
|
||||
this.cache.rollback();
|
||||
throw err;
|
||||
}
|
||||
const value = node.getFreshValue();
|
||||
this.cache.rollback();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue