@v-c/cascader 1.0.3 → 1.1.0-rc.1

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/dist/Cascader.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useCascaderProvider } from "./context.js";
2
- import useSearchOptions_default from "./hooks/useSearchOptions.js";
2
+ import useSearchOptions from "./hooks/useSearchOptions.js";
3
3
  import { SHOW_PARENT, fillFieldNames, toPathKeys, toRawValues } from "./utils/commonUtil.js";
4
4
  import { formatStrategyValues, toPathOptions } from "./utils/treeUtil.js";
5
5
  import useDisplayValues_default from "./hooks/useDisplayValues.js";
@@ -8,13 +8,14 @@ import useOptions from "./hooks/useOptions.js";
8
8
  import useSearchConfig from "./hooks/useSearchConfig.js";
9
9
  import useSelect from "./hooks/useSelect.js";
10
10
  import useValues from "./hooks/useValues.js";
11
- import OptionList_default from "./OptionList/index.js";
11
+ import OptionList from "./OptionList/index.js";
12
12
  import { warningNullOptions } from "./utils/warningPropsUtil.js";
13
13
  import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
14
14
  import { BaseSelect } from "@v-c/select";
15
15
  import { useId, useMergedState } from "@v-c/util";
16
16
  import useEvent from "@v-c/util/dist/hooks/useEvent";
17
17
  import omit from "@v-c/util/dist/omit";
18
+ //#region src/Cascader.tsx
18
19
  var cascaderDefaults = {
19
20
  prefixCls: "vc-cascader",
20
21
  expandIcon: ">",
@@ -54,7 +55,7 @@ var omitKeyList = [
54
55
  "classNames",
55
56
  "styles"
56
57
  ];
57
- var Cascader_default = /* @__PURE__ */ defineComponent((props, { attrs, slots, expose }) => {
58
+ var Cascader = /* @__PURE__ */ defineComponent((props, { attrs, slots, expose }) => {
58
59
  const baseSelectRef = shallowRef(null);
59
60
  expose({
60
61
  focus: (options) => baseSelectRef.value?.focus(options),
@@ -86,7 +87,7 @@ var Cascader_default = /* @__PURE__ */ defineComponent((props, { attrs, slots, e
86
87
  setSearchValue(searchText);
87
88
  if (info.source !== "blur") searchConfig.value.onSearch?.(searchText);
88
89
  };
89
- const searchOptions = useSearchOptions_default(mergedSearchValue, mergedOptions, mergedFieldNames, computed(() => props.popupPrefixCls || props.prefixCls || cascaderDefaults.prefixCls), searchConfig, computed(() => !!props.changeOnSelect || multiple.value));
90
+ const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, computed(() => props.popupPrefixCls || props.prefixCls || cascaderDefaults.prefixCls), searchConfig, computed(() => !!props.changeOnSelect || multiple.value));
90
91
  const valuesInfo = useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, useMissingValues(mergedOptions, mergedFieldNames));
91
92
  const checkedValues = computed(() => valuesInfo.value[0]);
92
93
  const halfCheckedValues = computed(() => valuesInfo.value[1]);
@@ -168,7 +169,7 @@ var Cascader_default = /* @__PURE__ */ defineComponent((props, { attrs, slots, e
168
169
  "searchValue": mergedSearchValue.value,
169
170
  "onSearch": onInternalSearch,
170
171
  "showSearch": mergedShowSearch.value,
171
- "OptionList": OptionList_default,
172
+ "OptionList": OptionList,
172
173
  "emptyOptions": emptyOptions.value,
173
174
  "open": props.open,
174
175
  "popupClassName": props.popupClassName,
@@ -636,4 +637,5 @@ var Cascader_default = /* @__PURE__ */ defineComponent((props, { attrs, slots, e
636
637
  default: void 0
637
638
  }
638
639
  }, cascaderDefaults) });
639
- export { Cascader_default as default };
640
+ //#endregion
641
+ export { Cascader as default };
@@ -1,7 +1,8 @@
1
1
  import { useCascaderContext } from "../context.js";
2
2
  import { createVNode, defineComponent, mergeDefaults } from "vue";
3
3
  import { clsx } from "@v-c/util";
4
- var Checkbox_default = /* @__PURE__ */ defineComponent((props) => {
4
+ //#region src/OptionList/Checkbox.tsx
5
+ var Checkbox = /* @__PURE__ */ defineComponent((props) => {
5
6
  const context = useCascaderContext();
6
7
  return () => {
7
8
  const checkable = context.value?.checkable;
@@ -18,8 +19,7 @@ var Checkbox_default = /* @__PURE__ */ defineComponent((props) => {
18
19
  }, { props: /* @__PURE__ */ mergeDefaults({
19
20
  prefixCls: {
20
21
  type: String,
21
- required: true,
22
- default: void 0
22
+ required: true
23
23
  },
24
24
  checked: {
25
25
  type: Boolean,
@@ -66,4 +66,5 @@ var Checkbox_default = /* @__PURE__ */ defineComponent((props) => {
66
66
  disabled: false,
67
67
  disableCheckbox: false
68
68
  }) });
69
- export { Checkbox_default as default };
69
+ //#endregion
70
+ export { Checkbox as default };
@@ -1,24 +1,13 @@
1
1
  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
- import Checkbox_default from "./Checkbox.js";
4
+ import Checkbox from "./Checkbox.js";
5
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
- const FIX_LABEL = "__cascader_fix_label__";
9
- var columnDefaults = {
10
- prefixCls: "",
11
- options: [],
12
- prevValuePath: [],
13
- onToggleOpen: () => {},
14
- onSelect: () => {},
15
- onActive: () => {},
16
- checkedSet: /* @__PURE__ */ new Set(),
17
- halfCheckedSet: /* @__PURE__ */ new Set(),
18
- loadingKeys: [],
19
- isSelectable: () => false
20
- };
21
- var Column_default = /* @__PURE__ */ defineComponent((props) => {
8
+ //#region src/OptionList/Column.tsx
9
+ var FIX_LABEL = "__cascader_fix_label__";
10
+ var Column = /* @__PURE__ */ defineComponent((props) => {
22
11
  const menuRef = ref(null);
23
12
  const context = useCascaderContext();
24
13
  const menuPrefixCls = computed(() => `${props.prefixCls}-menu`);
@@ -123,7 +112,7 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
123
112
  e.preventDefault();
124
113
  }
125
114
  }), [
126
- props.multiple && createVNode(Checkbox_default, {
115
+ props.multiple && createVNode(Checkbox, {
127
116
  "prefixCls": `${props.prefixCls}-checkbox`,
128
117
  "checked": checked,
129
118
  "halfChecked": halfChecked,
@@ -145,8 +134,7 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
145
134
  props: /* @__PURE__ */ mergeDefaults({
146
135
  prefixCls: {
147
136
  type: String,
148
- required: true,
149
- default: void 0
137
+ required: true
150
138
  },
151
139
  multiple: {
152
140
  type: Boolean,
@@ -155,8 +143,7 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
155
143
  },
156
144
  options: {
157
145
  type: Array,
158
- required: true,
159
- default: void 0
146
+ required: true
160
147
  },
161
148
  activeValue: {
162
149
  type: [String, Number],
@@ -165,43 +152,35 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
165
152
  },
166
153
  prevValuePath: {
167
154
  type: Array,
168
- required: true,
169
- default: void 0
155
+ required: true
170
156
  },
171
157
  onToggleOpen: {
172
158
  type: Function,
173
- required: true,
174
- default: void 0
159
+ required: true
175
160
  },
176
161
  onSelect: {
177
162
  type: Function,
178
- required: true,
179
- default: void 0
163
+ required: true
180
164
  },
181
165
  onActive: {
182
166
  type: Function,
183
- required: true,
184
- default: void 0
167
+ required: true
185
168
  },
186
169
  checkedSet: {
187
170
  type: Set,
188
- required: true,
189
- default: void 0
171
+ required: true
190
172
  },
191
173
  halfCheckedSet: {
192
174
  type: Set,
193
- required: true,
194
- default: void 0
175
+ required: true
195
176
  },
196
177
  loadingKeys: {
197
178
  type: Array,
198
- required: true,
199
- default: void 0
179
+ required: true
200
180
  },
201
181
  isSelectable: {
202
182
  type: Function,
203
- required: true,
204
- default: void 0
183
+ required: true
205
184
  },
206
185
  disabled: {
207
186
  type: Boolean,
@@ -213,8 +192,20 @@ var Column_default = /* @__PURE__ */ defineComponent((props) => {
213
192
  required: false,
214
193
  default: void 0
215
194
  }
216
- }, columnDefaults),
195
+ }, {
196
+ prefixCls: "",
197
+ options: [],
198
+ prevValuePath: [],
199
+ onToggleOpen: () => {},
200
+ onSelect: () => {},
201
+ onActive: () => {},
202
+ checkedSet: /* @__PURE__ */ new Set(),
203
+ halfCheckedSet: /* @__PURE__ */ new Set(),
204
+ loadingKeys: [],
205
+ isSelectable: () => false
206
+ }),
217
207
  name: "Column",
218
208
  inheritAttrs: false
219
209
  });
220
- export { FIX_LABEL, Column_default as default };
210
+ //#endregion
211
+ export { FIX_LABEL, Column as default };
@@ -1,12 +1,13 @@
1
1
  import { useCascaderContext } from "../context.js";
2
2
  import { getFullPathKeys, isLeaf, scrollIntoParentView, toPathKey, toPathKeys, toPathValueStr } from "../utils/commonUtil.js";
3
3
  import { toPathOptions } from "../utils/treeUtil.js";
4
- import Column_default, { FIX_LABEL } from "./Column.js";
5
- import useActive_default from "./useActive.js";
4
+ import Column, { FIX_LABEL } from "./Column.js";
5
+ import useActive from "./useActive.js";
6
6
  import useKeyboard from "./useKeyboard.js";
7
7
  import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, nextTick, onBeforeUpdate, ref, shallowRef, watch, watchEffect } from "vue";
8
8
  import { clsx } from "@v-c/util";
9
- var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
9
+ //#region src/OptionList/List.tsx
10
+ var RawOptionList = /* @__PURE__ */ defineComponent((props, { expose }) => {
10
11
  const containerRef = ref(null);
11
12
  const rtl = computed(() => props.direction === "rtl");
12
13
  const context = useCascaderContext();
@@ -39,7 +40,7 @@ var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
39
40
  });
40
41
  const checkedSet = computed(() => new Set(toPathKeys(context.value?.values || [])));
41
42
  const halfCheckedSet = computed(() => new Set(toPathKeys(context.value?.halfValues || [])));
42
- const [activeValueCells, setActiveValueCells] = useActive_default(computed(() => !!props.multiple), computed(() => props.open));
43
+ const [activeValueCells, setActiveValueCells] = useActive(computed(() => !!props.multiple), computed(() => props.open));
43
44
  const onPathOpen = (nextValueCells) => {
44
45
  setActiveValueCells(nextValueCells);
45
46
  internalLoadData(nextValueCells);
@@ -121,7 +122,7 @@ var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
121
122
  const columnNodes = (isEmpty ? [{ options: emptyList }] : optionColumns.value).map((col, index) => {
122
123
  const prevValuePath = activeValueCells.value.slice(0, index);
123
124
  const activeValue = activeValueCells.value[index];
124
- return createVNode(Column_default, mergeProps({ "key": index }, columnProps, {
125
+ return createVNode(Column, mergeProps({ "key": index }, columnProps, {
125
126
  "prefixCls": mergedPrefixCls.value,
126
127
  "options": col.options,
127
128
  "prevValuePath": prevValuePath,
@@ -140,8 +141,7 @@ var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
140
141
  props: /* @__PURE__ */ mergeDefaults({
141
142
  prefixCls: {
142
143
  type: String,
143
- required: true,
144
- default: void 0
144
+ required: true
145
145
  },
146
146
  multiple: {
147
147
  type: Boolean,
@@ -155,8 +155,7 @@ var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
155
155
  },
156
156
  toggleOpen: {
157
157
  type: Function,
158
- required: true,
159
- default: void 0
158
+ required: true
160
159
  },
161
160
  notFoundContent: {
162
161
  required: false,
@@ -195,4 +194,5 @@ var List_default = /* @__PURE__ */ defineComponent((props, { expose }) => {
195
194
  name: "RawOptionList",
196
195
  inheritAttrs: false
197
196
  });
198
- export { List_default as default };
197
+ //#endregion
198
+ export { RawOptionList as default };
@@ -1,14 +1,15 @@
1
- import List_default from "./List.js";
1
+ import RawOptionList from "./List.js";
2
2
  import { createVNode, defineComponent, mergeProps, shallowRef } from "vue";
3
3
  import { useBaseProps } from "@v-c/select";
4
- var OptionList_default = /* @__PURE__ */ defineComponent((_, { expose }) => {
4
+ //#region src/OptionList/index.tsx
5
+ var OptionList = /* @__PURE__ */ defineComponent((_, { expose }) => {
5
6
  const baseProps = useBaseProps();
6
7
  const listRef = shallowRef(null);
7
8
  expose({
8
9
  onKeyDown: (event) => listRef.value?.onKeyDown(event),
9
10
  onKeyUp: (event) => listRef.value?.onKeyUp(event)
10
11
  });
11
- return () => createVNode(List_default, mergeProps(baseProps.value || {}, {
12
+ return () => createVNode(RawOptionList, mergeProps(baseProps.value || {}, {
12
13
  "lockOptions": baseProps.value?.lockOptions,
13
14
  "ref": (el) => {
14
15
  listRef.value = el;
@@ -18,4 +19,5 @@ var OptionList_default = /* @__PURE__ */ defineComponent((_, { expose }) => {
18
19
  name: "OptionList",
19
20
  inheritAttrs: false
20
21
  });
21
- export { OptionList_default as default };
22
+ //#endregion
23
+ export { OptionList as default };
@@ -1,5 +1,9 @@
1
1
  import { useCascaderContext } from "../context.js";
2
2
  import { ref, watch } from "vue";
3
+ //#region src/OptionList/useActive.ts
4
+ /**
5
+ * Control the active open options path.
6
+ */
3
7
  function useActive(multiple, open) {
4
8
  const context = useCascaderContext();
5
9
  const activeValueCells = ref([]);
@@ -10,5 +14,5 @@ function useActive(multiple, open) {
10
14
  activeValueCells.value = next;
11
15
  }];
12
16
  }
13
- var useActive_default = useActive;
14
- export { useActive_default as default };
17
+ //#endregion
18
+ export { useActive as default };
@@ -1,6 +1,7 @@
1
- import { SEARCH_MARK } from "../hooks/useSearchOptions.js";
1
+ import "../hooks/useSearchOptions.js";
2
2
  import { getFullPathKeys, toPathKey } from "../utils/commonUtil.js";
3
3
  import KeyCode from "@v-c/util/dist/KeyCode";
4
+ //#region src/OptionList/useKeyboard.ts
4
5
  function useKeyboard(options, fieldNames, activeValueCells, setActiveValueCells, onKeyBoardSelect, contextProps) {
5
6
  const getActiveStatus = () => {
6
7
  let activeIndex = -1;
@@ -99,4 +100,5 @@ function useKeyboard(options, fieldNames, activeValueCells, setActiveValueCells,
99
100
  onKeyUp: () => {}
100
101
  };
101
102
  }
103
+ //#endregion
102
104
  export { useKeyboard as default };
package/dist/Panel.js CHANGED
@@ -5,10 +5,11 @@ import useMissingValues from "./hooks/useMissingValues.js";
5
5
  import useOptions from "./hooks/useOptions.js";
6
6
  import useSelect from "./hooks/useSelect.js";
7
7
  import useValues from "./hooks/useValues.js";
8
- import List_default from "./OptionList/List.js";
8
+ import RawOptionList from "./OptionList/List.js";
9
9
  import { computed, createVNode, defineComponent, mergeDefaults, shallowRef, watch } from "vue";
10
10
  import { clsx } from "@v-c/util";
11
11
  import useEvent from "@v-c/util/dist/hooks/useEvent";
12
+ //#region src/Panel.tsx
12
13
  function noop() {}
13
14
  var panelDefaults = {
14
15
  prefixCls: "vc-cascader",
@@ -16,7 +17,7 @@ var panelDefaults = {
16
17
  showCheckedStrategy: SHOW_PARENT,
17
18
  notFoundContent: "Not Found"
18
19
  };
19
- var Panel_default = /* @__PURE__ */ defineComponent((props) => {
20
+ var Panel = /* @__PURE__ */ defineComponent((props) => {
20
21
  const multiple = computed(() => !!props.checkable);
21
22
  const mergedShowCheckedStrategy = computed(() => props.showCheckedStrategy ?? panelDefaults.showCheckedStrategy);
22
23
  const internalRawValues = shallowRef(props?.value ?? props?.defaultValue);
@@ -72,7 +73,7 @@ var Panel_default = /* @__PURE__ */ defineComponent((props) => {
72
73
  [`${panelPrefixCls}-empty`]: isEmpty
73
74
  }, props.className),
74
75
  "style": props.style
75
- }, [isEmpty ? props.notFoundContent ?? panelDefaults.notFoundContent : createVNode(List_default, {
76
+ }, [isEmpty ? props.notFoundContent ?? panelDefaults.notFoundContent : createVNode(RawOptionList, {
76
77
  "prefixCls": props.prefixCls ?? panelDefaults.prefixCls,
77
78
  "searchValue": "",
78
79
  "multiple": multiple.value,
@@ -199,4 +200,5 @@ var Panel_default = /* @__PURE__ */ defineComponent((props) => {
199
200
  default: void 0
200
201
  }
201
202
  }, panelDefaults) });
202
- export { Panel_default as default };
203
+ //#endregion
204
+ export { Panel as default };
package/dist/context.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { inject, provide, ref } from "vue";
2
+ //#region src/context.ts
2
3
  var CascaderContextKey = Symbol("CascaderContext");
3
4
  function useCascaderProvider(value) {
4
5
  provide(CascaderContextKey, value);
@@ -6,4 +7,5 @@ function useCascaderProvider(value) {
6
7
  function useCascaderContext() {
7
8
  return inject(CascaderContextKey, ref(null));
8
9
  }
10
+ //#endregion
9
11
  export { useCascaderContext, useCascaderProvider };
@@ -1,6 +1,7 @@
1
1
  import { toPathKey } from "../utils/commonUtil.js";
2
2
  import { toPathOptions } from "../utils/treeUtil.js";
3
3
  import { cloneVNode, computed, isVNode } from "vue";
4
+ //#region src/hooks/useDisplayValues.ts
4
5
  var useDisplayValues_default = (rawValues, options, fieldNames, multiple, displayRender) => {
5
6
  return computed(() => {
6
7
  const mergedDisplayRender = displayRender.value || ((labels) => {
@@ -19,7 +20,7 @@ var useDisplayValues_default = (rawValues, options, fieldNames, multiple, displa
19
20
  });
20
21
  return rawValues.value.map((valueCells) => {
21
22
  const valueOptions = toPathOptions(valueCells, options.value, fieldNames.value);
22
- const label = mergedDisplayRender(valueOptions.map(({ option, value: value$1 }) => option?.[fieldNames.value.label] ?? value$1), valueOptions.map(({ option }) => option));
23
+ const label = mergedDisplayRender(valueOptions.map(({ option, value }) => option?.[fieldNames.value.label] ?? value), valueOptions.map(({ option }) => option));
23
24
  const value = toPathKey(valueCells);
24
25
  return {
25
26
  label,
@@ -31,4 +32,5 @@ var useDisplayValues_default = (rawValues, options, fieldNames, multiple, displa
31
32
  });
32
33
  });
33
34
  };
35
+ //#endregion
34
36
  export { useDisplayValues_default as default };
@@ -1,6 +1,8 @@
1
1
  import { VALUE_SPLIT } from "../utils/commonUtil.js";
2
2
  import { shallowRef } from "vue";
3
3
  import { convertDataToEntities } from "@v-c/tree";
4
+ //#region src/hooks/useEntities.ts
5
+ /** Lazy parse options data into conduct-able info to avoid perf issue in single mode */
4
6
  function useEntities(options, fieldNames) {
5
7
  const cacheRef = shallowRef({
6
8
  options: [],
@@ -33,4 +35,5 @@ function useEntities(options, fieldNames) {
33
35
  };
34
36
  return getEntities;
35
37
  }
38
+ //#endregion
36
39
  export { useEntities as default };
@@ -1,4 +1,5 @@
1
1
  import { toPathOptions } from "../utils/treeUtil.js";
2
+ //#region src/hooks/useMissingValues.ts
2
3
  function useMissingValues(options, fieldNames) {
3
4
  return (rawValues) => {
4
5
  const missingValues = [];
@@ -10,4 +11,5 @@ function useMissingValues(options, fieldNames) {
10
11
  return [existsValues, missingValues];
11
12
  };
12
13
  }
14
+ //#endregion
13
15
  export { useMissingValues as default };
@@ -1,9 +1,11 @@
1
1
  import useEntities from "./useEntities.js";
2
2
  import { computed } from "vue";
3
+ //#region src/hooks/useOptions.ts
3
4
  function useOptions(mergedFieldNames, options) {
4
5
  const emptyOptions = [];
5
6
  const mergedOptions = computed(() => options.value || emptyOptions);
6
7
  const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
8
+ /** Convert path key back to value format */
7
9
  const getValueByKeyPath = (pathKeys) => {
8
10
  const keyPathEntities = getPathKeyEntities();
9
11
  return pathKeys.map((pathKey) => {
@@ -17,4 +19,5 @@ function useOptions(mergedFieldNames, options) {
17
19
  getValueByKeyPath
18
20
  ];
19
21
  }
22
+ //#endregion
20
23
  export { useOptions as default };
@@ -1,5 +1,6 @@
1
1
  import { computed } from "vue";
2
2
  import { warning } from "@v-c/util";
3
+ //#region src/hooks/useSearchConfig.ts
3
4
  function useSearchConfig(showSearch, props) {
4
5
  const mergedShowSearch = computed(() => {
5
6
  if (!showSearch.value) return false;
@@ -26,4 +27,5 @@ function useSearchConfig(showSearch, props) {
26
27
  return config;
27
28
  })];
28
29
  }
30
+ //#endregion
29
31
  export { useSearchConfig as default };
@@ -1,5 +1,6 @@
1
1
  import { computed } from "vue";
2
- const SEARCH_MARK = "__vc_cascader_search_mark__";
2
+ //#region src/hooks/useSearchOptions.ts
3
+ var SEARCH_MARK = "__vc_cascader_search_mark__";
3
4
  var defaultFilter = (search, options, { label = "" }) => options.some((opt) => String(opt[label]).toLowerCase().includes(search.toLowerCase()));
4
5
  var defaultRender = (_inputValue, path, _prefixCls, fieldNames) => path.map((opt) => opt[fieldNames.label]).join(" / ");
5
6
  function useSearchOptions(search, options, fieldNames, prefixCls, config, enableHalfPath) {
@@ -36,5 +37,5 @@ function useSearchOptions(search, options, fieldNames, prefixCls, config, enable
36
37
  return limit !== false && limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;
37
38
  });
38
39
  }
39
- var useSearchOptions_default = useSearchOptions;
40
- export { SEARCH_MARK, useSearchOptions_default as default };
40
+ //#endregion
41
+ export { SEARCH_MARK, useSearchOptions as default };
@@ -1,6 +1,7 @@
1
1
  import { toPathKey, toPathKeys } from "../utils/commonUtil.js";
2
2
  import { formatStrategyValues } from "../utils/treeUtil.js";
3
3
  import { conductCheck } from "@v-c/tree";
4
+ //#region src/hooks/useSelect.ts
4
5
  function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, missingCheckedValues, getPathKeyEntities, getValueByKeyPath, showCheckedStrategy) {
5
6
  return (valuePath) => {
6
7
  if (!multiple.value) triggerChange(valuePath);
@@ -28,4 +29,5 @@ function useSelect(multiple, triggerChange, checkedValues, halfCheckedValues, mi
28
29
  }
29
30
  };
30
31
  }
32
+ //#endregion
31
33
  export { useSelect as default };
@@ -1,6 +1,7 @@
1
1
  import { toPathKeys } from "../utils/commonUtil.js";
2
2
  import { computed } from "vue";
3
3
  import { conductCheck } from "@v-c/tree";
4
+ //#region src/hooks/useValues.ts
4
5
  function useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues) {
5
6
  return computed(() => {
6
7
  const [existValues, missingValues] = getMissingValues(rawValues.value);
@@ -17,4 +18,5 @@ function useValues(multiple, rawValues, getPathKeyEntities, getValueByKeyPath, g
17
18
  ];
18
19
  });
19
20
  }
21
+ //#endregion
20
22
  export { useValues as default };
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { SHOW_CHILD, SHOW_PARENT } from "./utils/commonUtil.js";
2
- import Cascader_default from "./Cascader.js";
3
- import Panel_default from "./Panel.js";
4
- var ExportCascader = Cascader_default;
5
- ExportCascader.Panel = Panel_default;
2
+ import Cascader from "./Cascader.js";
3
+ import Panel from "./Panel.js";
4
+ //#region src/index.tsx
5
+ var ExportCascader = Cascader;
6
+ ExportCascader.Panel = Panel;
6
7
  ExportCascader.SHOW_PARENT = SHOW_PARENT;
7
8
  ExportCascader.SHOW_CHILD = SHOW_CHILD;
8
- var src_default = ExportCascader;
9
- export { Panel_default as Panel, SHOW_CHILD, SHOW_PARENT, src_default as default };
9
+ //#endregion
10
+ export { Panel, SHOW_CHILD, SHOW_PARENT, ExportCascader as default };
@@ -1,10 +1,17 @@
1
1
  import { SEARCH_MARK } from "../hooks/useSearchOptions.js";
2
- const VALUE_SPLIT = "__VC_CASCADER_SPLIT__";
3
- const SHOW_PARENT = "SHOW_PARENT";
4
- const SHOW_CHILD = "SHOW_CHILD";
2
+ //#region src/utils/commonUtil.ts
3
+ var VALUE_SPLIT = "__VC_CASCADER_SPLIT__";
4
+ var SHOW_PARENT = "SHOW_PARENT";
5
+ var SHOW_CHILD = "SHOW_CHILD";
6
+ /**
7
+ * Will convert value to string, and join with `VALUE_SPLIT`
8
+ */
5
9
  function toPathKey(value) {
6
10
  return value.join(VALUE_SPLIT);
7
11
  }
12
+ /**
13
+ * Batch convert value to string, and join with `VALUE_SPLIT`
14
+ */
8
15
  function toPathKeys(value) {
9
16
  return value.map(toPathKey);
10
17
  }
@@ -42,4 +49,5 @@ function toRawValues(value) {
42
49
  if (isMultipleValue(value)) return value;
43
50
  return (value.length === 0 ? [] : [value]).map((val) => Array.isArray(val) ? val : [val]);
44
51
  }
52
+ //#endregion
45
53
  export { SHOW_CHILD, SHOW_PARENT, VALUE_SPLIT, fillFieldNames, getFullPathKeys, isLeaf, scrollIntoParentView, toPathKey, toPathKeys, toPathValueStr, toRawValues };
@@ -1,4 +1,5 @@
1
- import { SHOW_CHILD } from "./commonUtil.js";
1
+ import "./commonUtil.js";
2
+ //#region src/utils/treeUtil.ts
2
3
  function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
3
4
  const valueSet = new Set(pathKeys);
4
5
  const keyPathEntities = getKeyPathEntities();
@@ -29,4 +30,5 @@ function toPathOptions(valueCells, options, fieldNames, stringMode = false) {
29
30
  }
30
31
  return valueOptions;
31
32
  }
33
+ //#endregion
32
34
  export { formatStrategyValues, toPathOptions };
@@ -1,4 +1,5 @@
1
1
  import { warning } from "@v-c/util";
2
+ //#region src/utils/warningPropsUtil.ts
2
3
  function warningNullOptions(options, fieldNames) {
3
4
  if (options) {
4
5
  const recursiveOptions = (optionsList) => {
@@ -14,4 +15,5 @@ function warningNullOptions(options, fieldNames) {
14
15
  recursiveOptions(options);
15
16
  }
16
17
  }
18
+ //#endregion
17
19
  export { warningNullOptions };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/cascader",
3
3
  "type": "module",
4
- "version": "1.0.3",
4
+ "version": "1.1.0-rc.1",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -24,8 +24,8 @@
24
24
  "vue": "^3.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "@v-c/select": "^1.0.20",
28
- "@v-c/tree": "^1.0.5",
27
+ "@v-c/select": "^1.0.23",
28
+ "@v-c/tree": "^1.1.0-rc.1",
29
29
  "@v-c/util": "^1.0.19"
30
30
  },
31
31
  "scripts": {