@peng_kai/kit 0.2.15 → 0.2.16

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.
@@ -34,6 +34,10 @@ function storeSetup() {
34
34
  setTimeout(() => tabKeyList.value.splice(i, 1));
35
35
  }
36
36
  };
37
+ const closeAllTab = () => {
38
+ tabKeyList.value.forEach(key => pageStore.closePage(key));
39
+ setTimeout(() => tabKeyList.value.length = 0);
40
+ };
37
41
 
38
42
  watch(activeTab, (key) => {
39
43
  if (!tabKeyList.value.includes(key))
@@ -43,6 +47,7 @@ function storeSetup() {
43
47
  return {
44
48
  activeTab,
45
49
  tabList,
50
+ closeAllTab,
46
51
  closeTab,
47
52
  openTab,
48
53
  };
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { computed } from 'vue';
2
+ import { computed, watch } from 'vue';
3
3
  import { InputNumber as AInputNumber, Form } from 'ant-design-vue';
4
4
  </script>
5
5
 
@@ -22,25 +22,22 @@ const emits = defineEmits<{
22
22
 
23
23
  const formItemContext = Form.useInjectFormItemContext();
24
24
  const minValue = computed({
25
- get() {
26
- return props.value[0];
27
- },
28
- set(value) {
29
- updateValue(value, maxValue.value);
30
- },
25
+ get: () => props.value[0],
26
+ set: v => emits('update:value', [v, props.value[1]]),
31
27
  });
32
28
  const maxValue = computed({
33
- get() {
34
- return props.value[1];
35
- },
36
- set(value) {
37
- updateValue(minValue.value, value);
38
- },
29
+ get: () => props.value[1],
30
+ set: v => emits('update:value', [props.value[0], v]),
39
31
  });
40
32
 
41
- function updateValue(...args: typeof props.value) {
42
- emits('update:value', args.sort());
43
- formItemContext.onFieldChange();
33
+ watch([minValue, maxValue], () => formItemContext.onFieldChange());
34
+
35
+ function onBlur() {
36
+ const min = props.value[0];
37
+ const max = props.value[1];
38
+
39
+ if (min !== undefined && max !== undefined)
40
+ emits('update:value', [min, max].sort() as [number, number]);
44
41
  }
45
42
  </script>
46
43
 
@@ -49,11 +46,13 @@ function updateValue(...args: typeof props.value) {
49
46
  <AInputNumber
50
47
  v-model:value="minValue" class="w-full" :min="props.min"
51
48
  :max="props.max" :placeholder="props.placeholder?.[0]"
49
+ @blur="onBlur"
52
50
  />
53
51
  <span>&nbsp;-&nbsp;</span>
54
52
  <AInputNumber
55
53
  v-model:value="maxValue" class="w-full" :min="props.min"
56
54
  :max="props.max" :placeholder="props.placeholder?.[1]"
55
+ @blur="onBlur"
57
56
  />
58
57
  </div>
59
58
  </template>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.2.15",
4
+ "version": "0.2.16",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",