@v-c/cascader 0.0.1 → 1.0.0

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.
@@ -57,15 +57,16 @@ var Column = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
57
57
  };
58
58
  });
59
59
  });
60
- (0, vue.watch)(() => props.activeValue, () => {
61
- (0, vue.nextTick)(() => {
62
- if (menuRef.value) {
63
- const selector = `.${menuItemPrefixCls.value}-active`;
64
- const activeElement = menuRef.value.querySelector(selector);
65
- if (activeElement) require_commonUtil.scrollIntoParentView(activeElement);
66
- }
67
- });
68
- }, { immediate: true });
60
+ (0, vue.watch)(() => props.activeValue, async () => {
61
+ if (menuRef.value) {
62
+ const selector = `.${menuItemPrefixCls.value}-active`;
63
+ const activeElement = menuRef.value.querySelector(selector);
64
+ if (activeElement) require_commonUtil.scrollIntoParentView(activeElement);
65
+ }
66
+ }, {
67
+ immediate: true,
68
+ flush: "post"
69
+ });
69
70
  return () => {
70
71
  const fieldNames = context.value?.fieldNames;
71
72
  const changeOnSelect = context.value?.changeOnSelect;
@@ -140,7 +141,7 @@ var Column = /* @__PURE__ */ (0, vue.defineComponent)((props) => {
140
141
  triggerSelect();
141
142
  }
142
143
  }, null),
143
- (0, vue.createVNode)("div", { "class": `${menuItemPrefixCls.value}-content` }, [optionRender ? optionRender(option) : label]),
144
+ (0, vue.createVNode)("div", { "class": `${menuItemPrefixCls.value}-content` }, [optionRender && value !== "__EMPTY__" ? optionRender(option) : label]),
144
145
  !isLoading && expandIcon && !isMergedLeaf && (0, vue.createVNode)("div", { "class": `${menuItemPrefixCls.value}-expand-icon` }, [expandIcon]),
145
146
  isLoading && loadingIcon && (0, vue.createVNode)("div", { "class": `${menuItemPrefixCls.value}-loading-icon` }, [loadingIcon])
146
147
  ]);
@@ -2,7 +2,7 @@ import { useCascaderContext } from "../context.js";
2
2
  import { SEARCH_MARK } from "../hooks/useSearchOptions.js";
3
3
  import { isLeaf, scrollIntoParentView, toPathKey } from "../utils/commonUtil.js";
4
4
  import Checkbox_default from "./Checkbox.js";
5
- import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, nextTick, ref, watch } from "vue";
5
+ import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, ref, watch } from "vue";
6
6
  import { clsx } from "@v-c/util";
7
7
  import pickAttrs from "@v-c/util/dist/pickAttrs";
8
8
  const FIX_LABEL = "__cascader_fix_label__";
@@ -51,15 +51,16 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
51
51
  };
52
52
  });
53
53
  });
54
- watch(() => props.activeValue, () => {
55
- nextTick(() => {
56
- if (menuRef.value) {
57
- const selector = `.${menuItemPrefixCls.value}-active`;
58
- const activeElement = menuRef.value.querySelector(selector);
59
- if (activeElement) scrollIntoParentView(activeElement);
60
- }
61
- });
62
- }, { immediate: true });
54
+ watch(() => props.activeValue, async () => {
55
+ if (menuRef.value) {
56
+ const selector = `.${menuItemPrefixCls.value}-active`;
57
+ const activeElement = menuRef.value.querySelector(selector);
58
+ if (activeElement) scrollIntoParentView(activeElement);
59
+ }
60
+ }, {
61
+ immediate: true,
62
+ flush: "post"
63
+ });
63
64
  return () => {
64
65
  const fieldNames = context.value?.fieldNames;
65
66
  const changeOnSelect = context.value?.changeOnSelect;
@@ -134,7 +135,7 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
134
135
  triggerSelect();
135
136
  }
136
137
  }, null),
137
- createVNode("div", { "class": `${menuItemPrefixCls.value}-content` }, [optionRender ? optionRender(option) : label]),
138
+ createVNode("div", { "class": `${menuItemPrefixCls.value}-content` }, [optionRender && value !== "__EMPTY__" ? optionRender(option) : label]),
138
139
  !isLoading && expandIcon && !isMergedLeaf && createVNode("div", { "class": `${menuItemPrefixCls.value}-expand-icon` }, [expandIcon]),
139
140
  isLoading && loadingIcon && createVNode("div", { "class": `${menuItemPrefixCls.value}-loading-icon` }, [loadingIcon])
140
141
  ]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/cascader",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "1.0.0",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -24,9 +24,9 @@
24
24
  "vue": "^3.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@v-c/select": "^1.0.3",
28
- "@v-c/tree": "^0.0.1",
29
- "@v-c/util": "^1.0.4"
27
+ "@v-c/select": "^1.0.9",
28
+ "@v-c/tree": "^1.0.0",
29
+ "@v-c/util": "^1.0.9"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "vite build",