@xiaohaih/condition-core
Advanced tools
Comparing version 0.5.1 to 0.5.2
# @xiaohaih/condition-core | ||
## 0.5.2 | ||
### Patch Changes | ||
- 修复将数组设定为空值时引发的 bug | ||
## 0.5.1 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"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 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
471440
46
4742
5