@yxhl/specter-pui-vtk 1.0.84 → 1.0.86

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": "@yxhl/specter-pui-vtk",
3
- "version": "1.0.84",
3
+ "version": "1.0.86",
4
4
  "description": "雅心互联 Vue 3 + Vuetify3 组件库",
5
5
  "type": "module",
6
6
  "main": "./dist/specter-pui.umd.js",
@@ -37,10 +37,10 @@
37
37
  @click:outside="closePreview"
38
38
  >
39
39
  <VCard class="image-viewer-card">
40
- <v-toolbar dark color="primary">
41
- <v-toolbar-title>{{ currentImageTitle }}</v-toolbar-title>
42
- <VSpacer></VSpacer>
43
- <v-toolbar-items>
40
+ <v-toolbar dark color="primary">
41
+ <v-toolbar-title>{{ currentImageTitle }}</v-toolbar-title>
42
+ <VSpacer></VSpacer>
43
+ <v-toolbar-items>
44
44
  <VBtn icon dark @click="zoomImage(-0.3)">
45
45
  <VIcon>mdi-magnify-minus-outline</VIcon>
46
46
  </VBtn>
@@ -53,14 +53,14 @@
53
53
  <VBtn icon dark @click="rotateImage(90)">
54
54
  <VIcon>mdi-rotate-right</VIcon>
55
55
  </VBtn>
56
- <VBtn icon dark @click="resetImageTransform">
57
- <VIcon>mdi-refresh</VIcon>
58
- </VBtn>
59
- <VBtn icon dark @click="closePreview">
60
- <VIcon>mdi-close</VIcon>
61
- </VBtn>
62
- </v-toolbar-items>
63
- </v-toolbar>
56
+ <VBtn icon dark @click="resetImageTransform">
57
+ <VIcon>mdi-refresh</VIcon>
58
+ </VBtn>
59
+ <VBtn icon dark @click="closePreview">
60
+ <VIcon>mdi-close</VIcon>
61
+ </VBtn>
62
+ </v-toolbar-items>
63
+ </v-toolbar>
64
64
 
65
65
  <div class="image-viewer-content">
66
66
  <VBtn
@@ -379,7 +379,7 @@ const endImageDrag = (event) => {
379
379
 
380
380
  /* 图片查看器样式 */
381
381
  .image-viewer-card {
382
- background-color: rgba(0, 0, 0, 0.9);
382
+ background-color: rgba(0, 0, 0, 0.3);
383
383
  color: white;
384
384
  }
385
385
 
@@ -93,23 +93,45 @@ const props = defineProps({
93
93
  });
94
94
 
95
95
  const emit = defineEmits(['update:value', 'search', 'reset']);
96
- const instance = getCurrentInstance();
97
-
98
- const user = ref({});
99
- const menu = ref(false);
100
- const queryParam = ref({ ...props.value });
101
- const initialQueryParam = ref({ ...props.value });
102
-
103
- const initialIndex = computed(() => {
104
- return Object.entries(queryParam.value).filter(([key, val]) => {
105
- if (key === 'condition') return false;
106
- const initVal = initialQueryParam.value[key];
107
- if (Array.isArray(val) && Array.isArray(initVal)) {
108
- return JSON.stringify(val) !== JSON.stringify(initVal);
109
- }
110
- return val !== initVal;
111
- }).length;
112
- });
96
+ const instance = getCurrentInstance();
97
+
98
+ const user = ref({});
99
+ const menu = ref(false);
100
+
101
+ const cloneValue = (val) => {
102
+ if (Array.isArray(val)) return [...val];
103
+ if (val && typeof val === 'object') return { ...val };
104
+ return val;
105
+ };
106
+
107
+ const cloneQueryParam = (source = {}) => {
108
+ return Object.fromEntries(Object.entries(source || {}).map(([key, val]) => [key, cloneValue(val)]));
109
+ };
110
+
111
+ const isSameValue = (a, b) => {
112
+ if (
113
+ Array.isArray(a) ||
114
+ Array.isArray(b) ||
115
+ (a && typeof a === 'object') ||
116
+ (b && typeof b === 'object')
117
+ ) {
118
+ return JSON.stringify(a) === JSON.stringify(b);
119
+ }
120
+
121
+ return a === b;
122
+ };
123
+
124
+ const queryParam = ref(cloneQueryParam(props.value));
125
+ const initialQueryParam = ref(cloneQueryParam(props.value));
126
+ const externalQueryParam = ref(cloneQueryParam(props.value));
127
+
128
+ const initialIndex = computed(() => {
129
+ return Object.entries(queryParam.value).filter(([key, val]) => {
130
+ if (key === 'condition') return false;
131
+ const initVal = initialQueryParam.value[key];
132
+ return !isSameValue(val, initVal);
133
+ }).length;
134
+ });
113
135
 
114
136
  const contentStyle = computed(() => {
115
137
  const minValue = props.contentMinHeight;
@@ -123,12 +145,29 @@ const contentStyle = computed(() => {
123
145
  };
124
146
  });
125
147
 
126
- watch(
127
- () => props.value,
128
- (newVal) => {
129
- queryParam.value = { ...newVal };
130
- }
131
- );
148
+ watch(
149
+ () => props.value,
150
+ (newVal = {}) => {
151
+ const nextExternalQueryParam = cloneQueryParam(newVal);
152
+ const nextQueryParam = { ...queryParam.value };
153
+
154
+ Object.entries(nextExternalQueryParam).forEach(([key, val]) => {
155
+ if (!isSameValue(val, externalQueryParam.value[key])) {
156
+ nextQueryParam[key] = cloneValue(val);
157
+ }
158
+ });
159
+
160
+ Object.keys(externalQueryParam.value).forEach((key) => {
161
+ if (!(key in nextExternalQueryParam)) {
162
+ delete nextQueryParam[key];
163
+ }
164
+ });
165
+
166
+ queryParam.value = nextQueryParam;
167
+ externalQueryParam.value = nextExternalQueryParam;
168
+ },
169
+ { deep: true }
170
+ );
132
171
 
133
172
  onMounted(() => {
134
173
  user.value = JSON.parse(localStorage.getItem("_mis_acis_users") || "{}");