From 4e8e6fee0b8d91448832b9df0180a1a291cdb5d0 Mon Sep 17 00:00:00 2001 From: Xc Date: Mon, 23 Dec 2024 16:41:38 +0800 Subject: [PATCH 1/4] 3.3.9-dev --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3d3d380..530ba64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oak-memory-tree-store", - "version": "3.3.8", + "version": "3.3.9", "description": "oak框架中内存级store的实现", "author": { "name": "XuChang" @@ -10,7 +10,7 @@ "es/**/*" ], "dependencies": { - "oak-domain": "^5.1.14", + "oak-domain": "file:../oak-domain", "uuid": "^8.3.2" }, "scripts": { From b9509af2f25567cf491697cce171d84ff9c79647 Mon Sep 17 00:00:00 2001 From: Xc Date: Wed, 25 Dec 2024 13:16:38 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=BA=86=E6=BC=8F?= =?UTF-8?q?=E6=8E=89=E7=9A=84option=E5=AD=98=E5=9C=A8=E6=80=A7=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/store.js | 32 ++++++++++++++++---------------- lib/store.js | 32 ++++++++++++++++---------------- src/store.ts | 32 ++++++++++++++++---------------- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/es/store.js b/es/store.js index ea8ddd2..7839640 100644 --- a/es/store.js +++ b/es/store.js @@ -424,7 +424,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data > value; }; } @@ -432,7 +432,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data < value; }; } @@ -440,7 +440,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value; }; } @@ -448,7 +448,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data <= value; }; } @@ -456,7 +456,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data === value; }; } @@ -464,7 +464,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data !== value; }; } @@ -472,7 +472,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value[0] && data <= value[1]; }; } @@ -480,7 +480,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return typeof data === 'number' && data % value[0] === value[1]; }; } @@ -488,7 +488,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.startsWith(value); }; } @@ -496,7 +496,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.endsWith(value); }; } @@ -504,7 +504,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.includes(value); }; } @@ -513,7 +513,7 @@ export default class TreeStore extends CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); if (value) { return ![null, undefined].includes(data); } @@ -526,7 +526,7 @@ export default class TreeStore extends CascadeStore { assert(value instanceof Array); return (row) => { const data = get(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return value.includes(data); }; } @@ -534,7 +534,7 @@ export default class TreeStore extends CascadeStore { assert(value instanceof Array); return (row) => { const data = get(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return !value.includes(data); }; } @@ -543,7 +543,7 @@ export default class TreeStore extends CascadeStore { const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return differenceBy(array, data, (value) => { if (typeof value === 'object') { return JSON.stringify(value); @@ -557,7 +557,7 @@ export default class TreeStore extends CascadeStore { const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return intersectionBy(array, data, (value) => { if (typeof value === 'object') { return JSON.stringify(value); diff --git a/lib/store.js b/lib/store.js index d329380..4f84e29 100644 --- a/lib/store.js +++ b/lib/store.js @@ -426,7 +426,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data > value; }; } @@ -434,7 +434,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data < value; }; } @@ -442,7 +442,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value; }; } @@ -450,7 +450,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data <= value; }; } @@ -458,7 +458,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data === value; }; } @@ -466,7 +466,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data !== value; }; } @@ -474,7 +474,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value[0] && data <= value[1]; }; } @@ -482,7 +482,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return typeof data === 'number' && data % value[0] === value[1]; }; } @@ -490,7 +490,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.startsWith(value); }; } @@ -498,7 +498,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.endsWith(value); }; } @@ -506,7 +506,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.includes(value); }; } @@ -515,7 +515,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); if (value) { return ![null, undefined].includes(data); } @@ -528,7 +528,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { (0, assert_1.assert)(value instanceof Array); return (row) => { const data = (0, lodash_1.get)(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return value.includes(data); }; } @@ -536,7 +536,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { (0, assert_1.assert)(value instanceof Array); return (row) => { const data = (0, lodash_1.get)(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return !value.includes(data); }; } @@ -545,7 +545,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return (0, lodash_1.differenceBy)(array, data, (value) => { if (typeof value === 'object') { return JSON.stringify(value); @@ -559,7 +559,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? (0, lodash_1.get)(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return (0, lodash_1.intersectionBy)(array, data, (value) => { if (typeof value === 'object') { return JSON.stringify(value); diff --git a/src/store.ts b/src/store.ts index 7f9f9f7..58961c3 100644 --- a/src/store.ts +++ b/src/store.ts @@ -566,7 +566,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data > value; }; } @@ -574,14 +574,14 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data < value; }; } case '$gte': { return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value; }; } @@ -589,7 +589,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data <= value; }; } @@ -597,7 +597,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data === value; }; } @@ -605,7 +605,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data !== value; }; } @@ -613,7 +613,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['number', 'string'].includes(typeof data) && data >= value[0] && data <= value[1]; }; } @@ -621,7 +621,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return typeof data === 'number' && data % value[0] === value[1]; }; } @@ -629,7 +629,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.startsWith(value); }; } @@ -637,7 +637,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.endsWith(value); }; } @@ -645,7 +645,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return ['string'].includes(typeof data) && data.includes(value); }; } @@ -654,7 +654,7 @@ export default class TreeStore extends C return (row) => { // JsonFilter有可能是根结点,path为空 const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); if (value) { return ![null, undefined].includes(data); } @@ -667,7 +667,7 @@ export default class TreeStore extends C assert(value instanceof Array); return (row) => { const data = get(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return value.includes(data); }; } @@ -675,7 +675,7 @@ export default class TreeStore extends C assert(value instanceof Array); return (row) => { const data = get(row, path); - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return !value.includes(data); }; } @@ -684,7 +684,7 @@ export default class TreeStore extends C const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return differenceBy(array, data, (value: any) => { if (typeof value === 'object') { return JSON.stringify(value); @@ -698,7 +698,7 @@ export default class TreeStore extends C const array = value instanceof Array ? value : [value]; return (row) => { const data = path ? get(row, path) : row; - data === undefined && option.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); + data === undefined && option?.warnWhenAttributeMiss && showWarningAttributeMiss(entity, path); return intersectionBy(array, data, (value: any) => { if (typeof value === 'object') { return JSON.stringify(value); From 0a9945ed2b6fdbf79f5c7541ab54694645ee6f36 Mon Sep 17 00:00:00 2001 From: wkj <278599135@.com> Date: Mon, 30 Dec 2024 20:21:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9B=B4=E6=AD=A3=E4=BA=86=E6=BC=8F?= =?UTF-8?q?=E6=8E=89=E7=9A=84option=E5=AD=98=E5=9C=A8=E6=80=A7=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/store.js | 10 +++++----- lib/store.js | 10 +++++----- src/store.ts | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/es/store.js b/es/store.js index 7839640..bb8cd58 100644 --- a/es/store.js +++ b/es/store.js @@ -358,7 +358,7 @@ export default class TreeStore extends CascadeStore { if (expression.hasOwnProperty('#attr')) { // 说明是本结点的属性; const attr = row[expression['#attr']]; - if (attr === undefined && option.warnWhenAttributeMiss) { + if (attr === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, expression['#attr']); } return attr; @@ -407,7 +407,7 @@ export default class TreeStore extends CascadeStore { for (const attr of attributes) { const { name } = attr; const value = row[name]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, name); } if (typeof value === 'string' && row[name].includes($search)) { @@ -638,7 +638,7 @@ export default class TreeStore extends CascadeStore { const row = this.constructRow(node, context, option); if (row) { const value = row[attr]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, attr); } return value === filter; @@ -738,7 +738,7 @@ export default class TreeStore extends CascadeStore { return false; } if (row.entityId === undefined || row.entity === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, 'entity/entityId'); } return false; // 若不能确定,认定为条件不满足 @@ -772,7 +772,7 @@ export default class TreeStore extends CascadeStore { return filterFn(node2, nodeDict, exprResolveFns); } if (row[`${attr}Id`] === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, `${attr}Id`); } } diff --git a/lib/store.js b/lib/store.js index 4f84e29..671c7a2 100644 --- a/lib/store.js +++ b/lib/store.js @@ -360,7 +360,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { if (expression.hasOwnProperty('#attr')) { // 说明是本结点的属性; const attr = row[expression['#attr']]; - if (attr === undefined && option.warnWhenAttributeMiss) { + if (attr === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, expression['#attr']); } return attr; @@ -409,7 +409,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { for (const attr of attributes) { const { name } = attr; const value = row[name]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, name); } if (typeof value === 'string' && row[name].includes($search)) { @@ -640,7 +640,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { const row = this.constructRow(node, context, option); if (row) { const value = row[attr]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, attr); } return value === filter; @@ -740,7 +740,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return false; } if (row.entityId === undefined || row.entity === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, 'entity/entityId'); } return false; // 若不能确定,认定为条件不满足 @@ -774,7 +774,7 @@ class TreeStore extends CascadeStore_1.CascadeStore { return filterFn(node2, nodeDict, exprResolveFns); } if (row[`${attr}Id`] === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, `${attr}Id`); } } diff --git a/src/store.ts b/src/store.ts index 58961c3..0b2e57e 100644 --- a/src/store.ts +++ b/src/store.ts @@ -479,7 +479,7 @@ export default class TreeStore extends C const attr = row[(expression as { '#attr': keyof ED[T]['Schema']; })['#attr']] as ExpressionConstant; - if (attr === undefined && option.warnWhenAttributeMiss) { + if (attr === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, (expression as { '#attr': string; })['#attr']); @@ -547,7 +547,7 @@ export default class TreeStore extends C for (const attr of attributes) { const { name } = attr; const value = row[name]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, name as string); } @@ -798,7 +798,7 @@ export default class TreeStore extends C const row = this.constructRow(node, context, option); if (row) { const value = row[attr]; - if (value === undefined && option.warnWhenAttributeMiss) { + if (value === undefined && option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, attr); } return value === filter; @@ -916,7 +916,7 @@ export default class TreeStore extends C return false; } if ((row as any).entityId === undefined || (row as any).entity === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, 'entity/entityId'); } return false; // 若不能确定,认定为条件不满足 @@ -952,7 +952,7 @@ export default class TreeStore extends C return filterFn(node2, nodeDict, exprResolveFns); } if ((row as any)[`${attr}Id`] === undefined) { - if (option.warnWhenAttributeMiss) { + if (option?.warnWhenAttributeMiss) { showWarningAttributeMiss(entity, `${attr}Id`); } } From 8b892d95dd80bdc51f8389731eaede09c8f08bf9 Mon Sep 17 00:00:00 2001 From: Xc Date: Mon, 30 Dec 2024 20:42:23 +0800 Subject: [PATCH 4/4] 3.3.9-pub --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 530ba64..7ffa336 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "es/**/*" ], "dependencies": { - "oak-domain": "file:../oak-domain", + "oak-domain": "^5.1.15", "uuid": "^8.3.2" }, "scripts": {