@yxhl/specter-pui-vtk 1.0.99 → 1.0.101

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.
@@ -23,20 +23,28 @@
23
23
  clearable
24
24
  >
25
25
  <template v-slot:append-inner>
26
- <VBadge
27
- dot
28
- :content="initialIndex"
29
- :model-value="initialIndex > 0"
30
- color="error"
31
- class="advanced-badge"
32
- >
33
- <span
34
- v-bind="props"
35
- class="text-blue vtk-cursor-pointer d-inline-flex align-center text-body-2"
26
+ <VIcon
27
+ class="search-icon"
28
+ size="small"
29
+ @click.stop="search"
30
+ >mdi-magnify</VIcon>
31
+ <span class="search-divider"></span>
32
+ <span class="search-advanced">
33
+ <VBadge
34
+ dot
35
+ :content="initialIndex"
36
+ :model-value="initialIndex > 0"
37
+ color="error"
38
+ class="advanced-badge"
36
39
  >
37
- 高级
38
- </span>
39
- </VBadge>
40
+ <span
41
+ v-bind="props"
42
+ class="pl-1 text-blue vtk-cursor-pointer d-inline-flex align-center text-body-2"
43
+ >
44
+ 高级
45
+ </span>
46
+ </VBadge>
47
+ </span>
40
48
  </template>
41
49
  </VTextField>
42
50
  </template>
@@ -93,45 +101,45 @@ const props = defineProps({
93
101
  });
94
102
 
95
103
  const emit = defineEmits(['update:value', 'search', 'reset']);
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
- });
104
+ const instance = getCurrentInstance();
105
+
106
+ const user = ref({});
107
+ const menu = ref(false);
108
+
109
+ const cloneValue = (val) => {
110
+ if (Array.isArray(val)) return [...val];
111
+ if (val && typeof val === 'object') return { ...val };
112
+ return val;
113
+ };
114
+
115
+ const cloneQueryParam = (source = {}) => {
116
+ return Object.fromEntries(Object.entries(source || {}).map(([key, val]) => [key, cloneValue(val)]));
117
+ };
118
+
119
+ const isSameValue = (a, b) => {
120
+ if (
121
+ Array.isArray(a) ||
122
+ Array.isArray(b) ||
123
+ (a && typeof a === 'object') ||
124
+ (b && typeof b === 'object')
125
+ ) {
126
+ return JSON.stringify(a) === JSON.stringify(b);
127
+ }
128
+
129
+ return a === b;
130
+ };
131
+
132
+ const queryParam = ref(cloneQueryParam(props.value));
133
+ const initialQueryParam = ref(cloneQueryParam(props.value));
134
+ const externalQueryParam = ref(cloneQueryParam(props.value));
135
+
136
+ const initialIndex = computed(() => {
137
+ return Object.entries(queryParam.value).filter(([key, val]) => {
138
+ if (key === 'condition') return false;
139
+ const initVal = initialQueryParam.value[key];
140
+ return !isSameValue(val, initVal);
141
+ }).length;
142
+ });
135
143
 
136
144
  const contentStyle = computed(() => {
137
145
  const minValue = props.contentMinHeight;
@@ -145,29 +153,29 @@ const contentStyle = computed(() => {
145
153
  };
146
154
  });
147
155
 
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
- );
156
+ watch(
157
+ () => props.value,
158
+ (newVal = {}) => {
159
+ const nextExternalQueryParam = cloneQueryParam(newVal);
160
+ const nextQueryParam = { ...queryParam.value };
161
+
162
+ Object.entries(nextExternalQueryParam).forEach(([key, val]) => {
163
+ if (!isSameValue(val, externalQueryParam.value[key])) {
164
+ nextQueryParam[key] = cloneValue(val);
165
+ }
166
+ });
167
+
168
+ Object.keys(externalQueryParam.value).forEach((key) => {
169
+ if (!(key in nextExternalQueryParam)) {
170
+ delete nextQueryParam[key];
171
+ }
172
+ });
173
+
174
+ queryParam.value = nextQueryParam;
175
+ externalQueryParam.value = nextExternalQueryParam;
176
+ },
177
+ { deep: true }
178
+ );
171
179
 
172
180
  onMounted(() => {
173
181
  user.value = JSON.parse(localStorage.getItem("_mis_acis_users") || "{}");
@@ -256,9 +264,7 @@ defineExpose({ search, reset });
256
264
 
257
265
  :deep(.box .v-field__append-inner) {
258
266
  cursor: pointer;
259
- padding-left: 16px !important;
260
- padding-right: 4px !important;
261
- border-left: 1px #cccccc88 solid;
267
+ padding-left: 4px !important;
262
268
  min-width: 50px;
263
269
  display: flex;
264
270
  align-items: center;
@@ -267,4 +273,27 @@ defineExpose({ search, reset });
267
273
  :deep(.advanced-badge .v-badge__badge) {
268
274
  transform: translate(10px, -2px);
269
275
  }
276
+
277
+ .search-advanced {
278
+ flex-shrink: 0;
279
+ white-space: nowrap;
280
+ }
281
+
282
+ .search-divider {
283
+ width: 1px;
284
+ align-self: stretch;
285
+ margin: 0 8px 0 6px;
286
+ background: #cccccc88;
287
+ flex-shrink: 0;
288
+ }
289
+
290
+ .search-icon {
291
+ cursor: pointer;
292
+ margin-right: 4px;
293
+ transition: color 0.2s;
294
+ }
295
+
296
+ .search-icon:hover {
297
+ color: rgb(var(--v-theme-primary));
298
+ }
270
299
  </style>