adtec-core-package 0.2.10 → 0.2.11

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": "adtec-core-package",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -11,7 +11,6 @@
11
11
  </div>
12
12
  </div>
13
13
  </el-flex>
14
-
15
14
  <el-flex
16
15
  width="240px"
17
16
  justify="flex-end"
@@ -22,20 +21,19 @@
22
21
  <el-button type="primary" @click="search" :class="getRouteName + '_search'">查询</el-button>
23
22
  <el-button type="text" @click="retract" v-show="is_retract">
24
23
  <el-icon
25
- ><ArrowDown v-show="retractval === '展开'" /><ArrowUp
26
- v-show="retractval === '收起'" /></el-icon
24
+ ><ArrowDown v-show="retractval === '展开'" /><ArrowUp
25
+ v-show="retractval === '收起'" /></el-icon
27
26
  >{{ retractval }}</el-button
28
27
  >
29
28
  </el-flex>
30
29
  </el-flex>
31
30
  </template>
32
31
  <script setup lang="ts">
33
- import { computed, inject, nextTick, onMounted, ref, watch } from 'vue'
32
+ import { computed, inject, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
34
33
  import { useWindowSize } from '@vueuse/core'
35
34
  import { useRouter } from 'vue-router'
36
- import ElFlex from '../ElFlex/ElFlex.vue'
37
35
  import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
38
-
36
+ import ElFlex from '../ElFlex/ElFlex.vue'
39
37
  const router = useRouter()
40
38
  const getRouteName = computed(() => {
41
39
  return router.currentRoute.value.name as string
@@ -47,30 +45,42 @@ const is_retract = ref(false)
47
45
  const ref_div = ref()
48
46
  const windowContent = useWindowSize()
49
47
  const collapsed = inject<boolean>('collapsed')
48
+ const collapsedSearch=ref<boolean|undefined>(false)
50
49
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
51
50
  //@ts-expect-error
52
51
  watch(collapsed, () => {
52
+ collapsedSearch.value = collapsed
53
+ calculation()
54
+ })
55
+ watch(collapsedSearch, () => {
53
56
  calculation()
54
57
  })
55
58
  watch(windowContent.width, () => {
56
59
  calculation()
57
60
  })
58
61
  const calculation = () => {
59
- setTimeout(() => {
60
- if (!(ref_div.value.offsetHeight > 95)) {
61
- if (ref_div.value.offsetHeight !== 0) {
62
- is_retract.value = false
63
- height.value = ref_div.value.offsetHeight + 15 + 'px'
64
- retractval.value = '收起'
65
- } else {
66
- calculation()
62
+ nextTick(()=>{
63
+ setTimeout(() => {
64
+ if(ref_div.value.children.length>0) {
65
+ if (!(ref_div.value.children[0].offsetHeight > 95)) {
66
+ if (ref_div.value.children[0].offsetHeight !== 0) {
67
+ is_retract.value = false
68
+ height.value = ref_div.value.children[0].offsetHeight + 15 + 'px'
69
+ retractval.value = '收起'
70
+ } else {
71
+ calculation()
72
+ }
73
+ }else if(ref_div.value.children[0].offsetHeight<=95){
74
+ is_retract.value = false
75
+ }
76
+ else {
77
+ is_retract.value = true
78
+ height.value = '95px'
79
+ retractval.value = '展开'
80
+ }
67
81
  }
68
- } else {
69
- is_retract.value = true
70
- height.value = '95px'
71
- retractval.value = '展开'
72
- }
73
- }, 100)
82
+ }, 200)
83
+ })
74
84
  }
75
85
  watch(windowContent.height, () => {
76
86
  calculation()
@@ -100,6 +110,11 @@ const emit = defineEmits<{
100
110
  (event: 'search'): void
101
111
  }>()
102
112
  onMounted(() => {
113
+ collapsedSearch.value = collapsed
114
+ //@ts-ignore
115
+ window.$wujie?.bus.$on("collapsedChangeBus", (val:boolean) => {
116
+ collapsedSearch.value=val
117
+ });
103
118
  nextTick(() => {
104
119
  if (!(ref_content.value.children[0].scrollHeight > 95)) {
105
120
  is_retract.value = false
@@ -112,7 +127,10 @@ onMounted(() => {
112
127
  }
113
128
  })
114
129
  })
115
-
130
+ onUnmounted(()=>{
131
+ //@ts-ignore
132
+ window.$wujie?.bus.$off("collapsedChangeBus")
133
+ })
116
134
  // onKeyStroke(['d', 'D', 'ArrowRight'], () => {
117
135
  // translateX.value += 10
118
136
  // }, { dedupe: true })
@@ -1,6 +1,4 @@
1
1
  import { type Ref, ref } from 'vue'
2
- import { cloneDeep } from 'lodash-es'
3
-
4
2
  /**
5
3
  * 创建人 胡啸东
6
4
  * 说明: 用于重置对象
@@ -9,10 +7,10 @@ import { cloneDeep } from 'lodash-es'
9
7
  */
10
8
 
11
9
  export function useResetRefHooks<T>(value: T): [Ref<T>, () => void] {
12
- const initValue = cloneDeep(value)
10
+ const initValue = JSON.parse(JSON.stringify(value))
13
11
  const state = ref(value)
14
12
  const reset = () => {
15
- state.value = cloneDeep(initValue)
13
+ state.value = JSON.parse(JSON.stringify(initValue))
16
14
  }
17
15
  //@ts-ignore
18
16
  return [state, reset]