Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xiaohaih/condition-core

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xiaohaih/condition-core - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

dist/index.cjs.js

6

CHANGELOG.md
# @xiaohaih/condition-core
## 0.5.2
### Patch Changes
- 修复将数组设定为空值时引发的 bug
## 0.5.1

@@ -4,0 +10,0 @@

2

package.json
{
"name": "@xiaohaih/condition-core",
"version": "0.5.1",
"version": "0.5.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -54,6 +54,2 @@ import {

};
// 防止触发搜索时, query 产生变化内部重复赋值
// const { flag: realtimeFlag, updateFlag: updateRealtimeFlag } = useDisableInCurrentCycle();
// 防止触发搜索时, backfill 产生变化内部重复赋值
// const { flag: backfillFlag, updateFlag: updateBackfillFlag } = useDisableInCurrentCycle();

@@ -63,8 +59,5 @@ const option = defineCommonMethod({

const { multiple } = props;
// updateRealtimeFlag();
// updateBackfillFlag();
checked.value = (props.resetToInitialValue && initialValue.value?.slice()) || (multiple ? [] : '');
},
updateWrapperQuery() {
// updateRealtimeFlag();
wrapper && Object.entries(getQuery()).forEach(([k, v]) => wrapper.updateQueryValue(k, v, props.field));

@@ -83,5 +76,2 @@ },

option.updateWrapperQuery();
// fix: 初始更新值且外部也设置值时
// 会导致内部无法同步到最新值
// realtimeFlag.value = true;
}

@@ -110,34 +100,15 @@

],
// [props.field, props.query[props.field]] as const,
([_field, val], [__field]) => {
// 仅在值发生变化时同步 忽视空值不一致的问题
// if (!realtimeFlag.value) return;
const _val = props.backfillToValue(val, _field, props.query);
if (_field.toString() !== __field.toString() || isEqualExcludeEmptyValue(_val, checked.value)) return;
if (
checked.value === _val ||
_field.toString() !== __field.toString() ||
isEqualExcludeEmptyValue(_val, checked.value)
)
return;
// 实时值改变仅更新值即可, 不做其它任何操作
checked.value !== _val && (checked.value = _val);
// updateCheckedValue(_val);
// wrapper?.queryChangedInWrapper.value || wrapper?.insetSearch();
},
),
);
// // 回填值发生变化时触发更新
// unwatchs.push(
// watch(
// [
// () => props.fields || props.field,
// () =>
// props.fields
// ? props.fields.map((k) => props.backfill?.[k]).filter(Boolean)
// : props.backfill?.[props.field],
// ],
// ([_field, val], [__field]) => {
// // 存在回填值时回填, 不存在时不做改动
// const _val = props.backfillToValue(val, _field, props.backfill);
// if (_field.toString() !== __field.toString() || isEqualExcludeEmptyValue(_val, checked.value)) return;
// updateBackfillFlag();
// updateCheckedValue(_val);
// },
// ),
// );

@@ -153,3 +124,2 @@ // 存在依赖项

([_depend, _dependFields], [__depend, __dependFields]) => {
// if (!realtimeFlag.value) return;
// 是否启用依赖, 相同时启用才走后续逻辑, 不同时直接走后续逻辑

@@ -156,0 +126,0 @@ if (_depend === __depend && !_depend) return;

@@ -9,3 +9,4 @@ import { markRaw, VNode } from 'vue-demi';

export function emptyToValue<T extends unknown>(val: any, defaultVal: T) {
if (Array.isArray(val)) return val.filter(Boolean).length ? val : defaultVal;
// 数组不应该置为空值, 影响到组件内部逻辑
// if (Array.isArray(val)) return val.filter(Boolean).length ? val : defaultVal;
return typeof val === 'number' ? val : val || defaultVal;

@@ -12,0 +13,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc