Skip to content

Commit 3bffd39

Browse files
committed
multiChanges: feat(listView): add table-like data feature for listView
- feat(auth) sdk embed auth - feat: theme add chart - feat(listView): change comps' exposing name from 'data' to 'items' - feat(table) link column support disbale property - feat: time validation config - refactor(listView): refactor file structure for listView - bug fixes
1 parent ff5554c commit 3bffd39

37 files changed

+628
-347
lines changed

client/packages/openblocks-core/lib/index.cjs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ var FunctionNode = /** @class */ (function (_super) {
318318
FunctionNode.prototype.dependValues = function () {
319319
return this.child.dependValues();
320320
};
321-
FunctionNode.prototype.fetchInfo = function (exposingNodes) {
322-
return this.child.fetchInfo(exposingNodes);
321+
FunctionNode.prototype.fetchInfo = function (exposingNodes, options) {
322+
return this.child.fetchInfo(exposingNodes, options);
323323
};
324324
__decorate([
325325
memoized()
@@ -390,12 +390,12 @@ var RecordNode = /** @class */ (function (_super) {
390390
});
391391
return ret;
392392
};
393-
RecordNode.prototype.fetchInfo = function (exposingNodes) {
393+
RecordNode.prototype.fetchInfo = function (exposingNodes, options) {
394394
var isFetching = false;
395395
var ready = true;
396396
Object.entries(this.children).forEach(function (_a) {
397397
_a[0]; var child = _a[1];
398-
var fi = child.fetchInfo(exposingNodes);
398+
var fi = child.fetchInfo(exposingNodes, options);
399399
isFetching = fi.isFetching || isFetching;
400400
ready = fi.ready && ready;
401401
});
@@ -1552,6 +1552,7 @@ function string2Fn(unevaledValue, type, methods) {
15521552

15531553
var IS_FETCHING_FIELD = "isFetching";
15541554
var LATEST_END_TIME_FIELD = "latestEndTime";
1555+
var TRIGGER_TYPE_FIELD = "triggerType";
15551556
/**
15561557
* user input node
15571558
*
@@ -1662,7 +1663,7 @@ var CodeNode = /** @class */ (function (_super) {
16621663
});
16631664
return ret;
16641665
};
1665-
CodeNode.prototype.fetchInfo = function (exposingNodes) {
1666+
CodeNode.prototype.fetchInfo = function (exposingNodes, options) {
16661667
if (!!this.evalCache.inIsFetching) {
16671668
return {
16681669
isFetching: false,
@@ -1676,6 +1677,11 @@ var CodeNode = /** @class */ (function (_super) {
16761677
var ready_1 = true;
16771678
topDepends.forEach(function (paths, depend) {
16781679
var value = depend.evaluate(exposingNodes);
1680+
if ((options === null || options === void 0 ? void 0 : options.ignoreManualDepReadyStatus) &&
1681+
___default["default"].has(value, TRIGGER_TYPE_FIELD) &&
1682+
value.triggerType === "manual") {
1683+
return;
1684+
}
16791685
if (___default["default"].has(value, IS_FETCHING_FIELD)) {
16801686
isFetching_1 = isFetching_1 || value.isFetching === true;
16811687
}
@@ -1727,9 +1733,10 @@ function fixCyclic(extra, exposingNodes) {
17271733
*/
17281734
var FetchCheckNode = /** @class */ (function (_super) {
17291735
__extends(FetchCheckNode, _super);
1730-
function FetchCheckNode(child) {
1736+
function FetchCheckNode(child, options) {
17311737
var _this = _super.call(this) || this;
17321738
_this.child = child;
1739+
_this.options = options;
17331740
_this.type = "fetchCheck";
17341741
return _this;
17351742
}
@@ -1746,7 +1753,7 @@ var FetchCheckNode = /** @class */ (function (_super) {
17461753
return this.child.dependValues();
17471754
};
17481755
FetchCheckNode.prototype.fetchInfo = function (exposingNodes) {
1749-
return this.child.fetchInfo(exposingNodes);
1756+
return this.child.fetchInfo(exposingNodes, this.options);
17501757
};
17511758
__decorate([
17521759
memoized()

client/packages/openblocks-core/lib/index.d.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ declare type NonOptionalKeys<T> = {
2929
declare type RecordOptionalNodeToValue<T> = {
3030
[K in NonOptionalKeys<T>]: NodeToValue<T[K]>;
3131
};
32+
interface FetchInfoOptions {
33+
ignoreManualDepReadyStatus?: boolean;
34+
}
3235
/**
3336
* the base structure for evaluate
3437
*/
@@ -58,7 +61,7 @@ interface Node<T> {
5861
* FIXME: this should be a protected function.
5962
*/
6063
filterNodes(exposingNodes: Record<string, Node<unknown>>): Map<Node<unknown>, Set<string>>;
61-
fetchInfo(exposingNodes: Record<string, Node<unknown>>): FetchInfo;
64+
fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions): FetchInfo;
6265
}
6366
declare abstract class AbstractNode<T> implements Node<T> {
6467
readonly type: string;
@@ -142,7 +145,7 @@ declare class FunctionNode<T, OutputType> extends AbstractNode<OutputType> {
142145
justEval(exposingNodes: Record<string, Node<unknown>>, methods?: EvalMethods): OutputType;
143146
getChildren(): Node<unknown>[];
144147
dependValues(): Record<string, unknown>;
145-
fetchInfo(exposingNodes: Record<string, Node<unknown>>): FetchInfo;
148+
fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions): FetchInfo;
146149
}
147150
declare function withFunction<T, OutputType>(
148151
child: Node<T>,
@@ -195,7 +198,7 @@ declare class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
195198
): ValueAndMsg<unknown>;
196199
getChildren(): Node<unknown>[];
197200
dependValues(): Record<string, unknown>;
198-
fetchInfo(exposingNodes: Record<string, Node<unknown>>): FetchInfo;
201+
fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions): FetchInfo;
199202
}
200203
/**
201204
* generate node for unevaledValue
@@ -209,8 +212,9 @@ declare function fromUnevaledValue(
209212
*/
210213
declare class FetchCheckNode extends AbstractNode<FetchInfo> {
211214
readonly child: Node<unknown>;
215+
readonly options?: FetchInfoOptions | undefined;
212216
readonly type = "fetchCheck";
213-
constructor(child: Node<unknown>);
217+
constructor(child: Node<unknown>, options?: FetchInfoOptions | undefined);
214218
filterNodes(exposingNodes: Record<string, Node<unknown>>): Map<Node<unknown>, Set<string>>;
215219
justEval(exposingNodes: Record<string, Node<unknown>>): FetchInfo;
216220
getChildren(): Node<unknown>[];
@@ -238,7 +242,10 @@ declare class RecordNode<T extends Record<string, Node<unknown>>> extends Abstra
238242
): RecordNodeToValue<T>;
239243
getChildren(): Node<unknown>[];
240244
dependValues(): Record<string, unknown>;
241-
fetchInfo(exposingNodes: Record<string, Node<unknown>>): {
245+
fetchInfo(
246+
exposingNodes: Record<string, Node<unknown>>,
247+
options?: FetchInfoOptions
248+
): {
242249
isFetching: boolean;
243250
ready: boolean;
244251
};
@@ -799,6 +806,7 @@ export {
799806
ExtraNodeType,
800807
FetchCheckNode,
801808
FetchInfo,
809+
FetchInfoOptions,
802810
FunctionNode,
803811
MultiBaseComp,
804812
MultiChangeAction,

client/packages/openblocks-core/lib/index.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ var FunctionNode = /** @class */ (function (_super) {
310310
FunctionNode.prototype.dependValues = function () {
311311
return this.child.dependValues();
312312
};
313-
FunctionNode.prototype.fetchInfo = function (exposingNodes) {
314-
return this.child.fetchInfo(exposingNodes);
313+
FunctionNode.prototype.fetchInfo = function (exposingNodes, options) {
314+
return this.child.fetchInfo(exposingNodes, options);
315315
};
316316
__decorate([
317317
memoized()
@@ -382,12 +382,12 @@ var RecordNode = /** @class */ (function (_super) {
382382
});
383383
return ret;
384384
};
385-
RecordNode.prototype.fetchInfo = function (exposingNodes) {
385+
RecordNode.prototype.fetchInfo = function (exposingNodes, options) {
386386
var isFetching = false;
387387
var ready = true;
388388
Object.entries(this.children).forEach(function (_a) {
389389
_a[0]; var child = _a[1];
390-
var fi = child.fetchInfo(exposingNodes);
390+
var fi = child.fetchInfo(exposingNodes, options);
391391
isFetching = fi.isFetching || isFetching;
392392
ready = fi.ready && ready;
393393
});
@@ -1544,6 +1544,7 @@ function string2Fn(unevaledValue, type, methods) {
15441544

15451545
var IS_FETCHING_FIELD = "isFetching";
15461546
var LATEST_END_TIME_FIELD = "latestEndTime";
1547+
var TRIGGER_TYPE_FIELD = "triggerType";
15471548
/**
15481549
* user input node
15491550
*
@@ -1654,7 +1655,7 @@ var CodeNode = /** @class */ (function (_super) {
16541655
});
16551656
return ret;
16561657
};
1657-
CodeNode.prototype.fetchInfo = function (exposingNodes) {
1658+
CodeNode.prototype.fetchInfo = function (exposingNodes, options) {
16581659
if (!!this.evalCache.inIsFetching) {
16591660
return {
16601661
isFetching: false,
@@ -1668,6 +1669,11 @@ var CodeNode = /** @class */ (function (_super) {
16681669
var ready_1 = true;
16691670
topDepends.forEach(function (paths, depend) {
16701671
var value = depend.evaluate(exposingNodes);
1672+
if ((options === null || options === void 0 ? void 0 : options.ignoreManualDepReadyStatus) &&
1673+
_.has(value, TRIGGER_TYPE_FIELD) &&
1674+
value.triggerType === "manual") {
1675+
return;
1676+
}
16711677
if (_.has(value, IS_FETCHING_FIELD)) {
16721678
isFetching_1 = isFetching_1 || value.isFetching === true;
16731679
}
@@ -1719,9 +1725,10 @@ function fixCyclic(extra, exposingNodes) {
17191725
*/
17201726
var FetchCheckNode = /** @class */ (function (_super) {
17211727
__extends(FetchCheckNode, _super);
1722-
function FetchCheckNode(child) {
1728+
function FetchCheckNode(child, options) {
17231729
var _this = _super.call(this) || this;
17241730
_this.child = child;
1731+
_this.options = options;
17251732
_this.type = "fetchCheck";
17261733
return _this;
17271734
}
@@ -1738,7 +1745,7 @@ var FetchCheckNode = /** @class */ (function (_super) {
17381745
return this.child.dependValues();
17391746
};
17401747
FetchCheckNode.prototype.fetchInfo = function (exposingNodes) {
1741-
return this.child.fetchInfo(exposingNodes);
1748+
return this.child.fetchInfo(exposingNodes, this.options);
17421749
};
17431750
__decorate([
17441751
memoized()

client/packages/openblocks-core/src/eval/codeNode.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import _ from "lodash";
22
import { memoized } from "util/memoize";
33
import { FunctionNode, withFunction } from "./functionNode";
4-
import { AbstractNode, FetchInfo, Node } from "./node";
4+
import { AbstractNode, FetchInfo, FetchInfoOptions, Node } from "./node";
55
import { fromRecord } from "./recordNode";
66
import { CodeType, EvalMethods } from "./types/evalTypes";
77
import { ValueAndMsg, ValueExtra } from "./types/valueAndMsg";
8-
import { addDepends, addDepend } from "./utils/dependMap";
8+
import { addDepend, addDepends } from "./utils/dependMap";
99
import { filterDepends, hasCycle } from "./utils/evaluate";
1010
import { dependsErrorMessage, mergeNodesWithSameName, nodeIsRecord } from "./utils/nodeUtils";
1111
import { string2Fn } from "./utils/string2Fn";
@@ -19,6 +19,7 @@ export interface CodeNodeOptions {
1919

2020
const IS_FETCHING_FIELD = "isFetching";
2121
const LATEST_END_TIME_FIELD = "latestEndTime";
22+
const TRIGGER_TYPE_FIELD = "triggerType";
2223

2324
/**
2425
* user input node
@@ -144,7 +145,10 @@ export class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
144145
return ret;
145146
}
146147

147-
override fetchInfo(exposingNodes: Record<string, Node<unknown>>): FetchInfo {
148+
override fetchInfo(
149+
exposingNodes: Record<string, Node<unknown>>,
150+
options?: FetchInfoOptions
151+
): FetchInfo {
148152
if (!!this.evalCache.inIsFetching) {
149153
return {
150154
isFetching: false,
@@ -160,6 +164,14 @@ export class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
160164

161165
topDepends.forEach((paths, depend) => {
162166
const value = depend.evaluate(exposingNodes) as any;
167+
if (
168+
options?.ignoreManualDepReadyStatus &&
169+
_.has(value, TRIGGER_TYPE_FIELD) &&
170+
value.triggerType === "manual"
171+
) {
172+
return;
173+
}
174+
163175
if (_.has(value, IS_FETCHING_FIELD)) {
164176
isFetching = isFetching || value.isFetching === true;
165177
}
@@ -177,7 +189,7 @@ export class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
177189

178190
return {
179191
isFetching,
180-
ready,
192+
ready: ready,
181193
};
182194
} finally {
183195
this.evalCache.inIsFetching = false;

client/packages/openblocks-core/src/eval/fetchCheckNode.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
11
import { memoized } from "util/memoize";
2-
import { AbstractNode, FetchInfo, Node } from "./node";
2+
import { AbstractNode, FetchInfo, FetchInfoOptions, Node } from "./node";
33

44
/**
55
* evaluate to get FetchInfo or fetching status
66
*/
77
export class FetchCheckNode extends AbstractNode<FetchInfo> {
88
readonly type = "fetchCheck";
9-
constructor(readonly child: Node<unknown>) {
9+
10+
constructor(readonly child: Node<unknown>, readonly options?: FetchInfoOptions) {
1011
super();
1112
}
13+
1214
@memoized()
1315
override filterNodes(exposingNodes: Record<string, Node<unknown>>) {
1416
return this.child.filterNodes(exposingNodes);
1517
}
18+
1619
override justEval(exposingNodes: Record<string, Node<unknown>>) {
1720
return this.fetchInfo(exposingNodes);
1821
}
22+
1923
override getChildren(): Node<unknown>[] {
2024
return [this.child];
2125
}
26+
2227
override dependValues(): Record<string, unknown> {
2328
return this.child.dependValues();
2429
}
30+
2531
override fetchInfo(exposingNodes: Record<string, Node<unknown>>) {
26-
return this.child.fetchInfo(exposingNodes);
32+
return this.child.fetchInfo(exposingNodes, this.options);
2733
}
2834
}
2935

client/packages/openblocks-core/src/eval/functionNode.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { memoized } from "../util/memoize";
2-
import { AbstractNode, Node } from "./node";
2+
import { AbstractNode, FetchInfoOptions, Node } from "./node";
33
import { EvalMethods } from "./types/evalTypes";
44
import { evalPerfUtil } from "./utils/perfUtils";
55

@@ -8,29 +8,35 @@ import { evalPerfUtil } from "./utils/perfUtils";
88
*/
99
export class FunctionNode<T, OutputType> extends AbstractNode<OutputType> {
1010
readonly type = "function";
11+
1112
constructor(readonly child: Node<T>, readonly func: (params: T) => OutputType) {
1213
super();
1314
}
15+
1416
@memoized()
1517
override filterNodes(exposingNodes: Record<string, Node<unknown>>) {
1618
return evalPerfUtil.perf(this, "filterNodes", () => {
1719
return this.child.filterNodes(exposingNodes);
1820
});
1921
}
22+
2023
override justEval(
2124
exposingNodes: Record<string, Node<unknown>>,
2225
methods?: EvalMethods
2326
): OutputType {
2427
return this.func(this.child.evaluate(exposingNodes, methods));
2528
}
29+
2630
override getChildren(): Node<unknown>[] {
2731
return [this.child];
2832
}
33+
2934
override dependValues(): Record<string, unknown> {
3035
return this.child.dependValues();
3136
}
32-
override fetchInfo(exposingNodes: Record<string, Node<unknown>>) {
33-
return this.child.fetchInfo(exposingNodes);
37+
38+
override fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions) {
39+
return this.child.fetchInfo(exposingNodes, options);
3440
}
3541
}
3642

0 commit comments

Comments
 (0)