@ecan-bi/tools 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecan-bi/tools",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "General tools",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -13,7 +13,6 @@
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "dayjs": "^1.11.13",
16
- "lodash-es": "^4.17.21",
17
- "vue": "3.2.27"
16
+ "lodash-es": "^4.17.21"
18
17
  }
19
18
  }
package/src/indicator.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { unref } from 'vue'
2
1
  import dayjs from 'dayjs'
3
2
  import { cloneDeep } from 'lodash-es'
4
- import { hasOwn, lowerCaseIncludes, getConditions, getFormatStep } from './utils'
3
+ import { hasOwn, lowerCaseIncludes, getConditions, getFormatStep, unref } from './utils'
5
4
  import { MODEL_KEY_LIST } from './constant'
6
5
 
7
6
  let modelValue = new Map()
package/src/utils.ts CHANGED
@@ -58,3 +58,21 @@ export function getFormatStep (format: string) {
58
58
  }
59
59
  return formatStep
60
60
  }
61
+
62
+ export function unref (data: any) {
63
+ if (isVueReactive(data)) {
64
+ return data.value
65
+ } else {
66
+ return data
67
+ }
68
+ }
69
+
70
+ // 自定义方法判断变量是否是vue2/vue3的响应式数据
71
+ function isVueReactive (obj: any) {
72
+ return (
73
+ !!obj && // 确保对象存在
74
+ (obj.__ob__ !== undefined || // Vue 2 的 __ob__ 属性
75
+ obj.__v_isReactive === true || // Vue 3 的 __v_isReactive 属性
76
+ obj.__v_isRef === true) // Vue 3 的 __v_isRef 属性
77
+ );
78
+ }