@wfrog/vc-ui 1.10.1 → 1.10.2

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.
@@ -14,6 +14,7 @@ export interface IExplorerListProps {
14
14
  loading?: boolean;
15
15
  loadingText?: string;
16
16
  highlightCurrent?: boolean;
17
+ deepWatch?: boolean;
17
18
  confirmParams?: (item: IExplorerListItem) => IButtonProps['confirm'];
18
19
  }
19
20
  export interface IExplorerListEmits {
@@ -1,6 +1,6 @@
1
1
  import './index.css'
2
2
  import '../../chunk/Gk1J52Yw.mjs';
3
- import { defineComponent, ref, computed, createBlock, openBlock, normalizeClass, withCtx, withDirectives, createElementBlock, createCommentVNode, createElementVNode, Fragment, renderList, unref, renderSlot, createTextVNode, toDisplayString, mergeProps, vShow, createVNode } from 'vue';
3
+ import { defineComponent, ref, computed, watch, onBeforeUnmount, createBlock, openBlock, normalizeClass, withCtx, withDirectives, createElementBlock, createCommentVNode, createElementVNode, Fragment, renderList, unref, renderSlot, createTextVNode, toDisplayString, mergeProps, vShow, createVNode } from 'vue';
4
4
  import { Loading } from '@element-plus/icons-vue';
5
5
  import { C as Component$3 } from '../button/button.mjs';
6
6
  import { i as injectExplorerPanelState } from '../explorer-panel/explorer-panel2.mjs';
@@ -21,6 +21,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21
21
  loading: { type: Boolean },
22
22
  loadingText: { default: "数据加载中..." },
23
23
  highlightCurrent: { type: Boolean, default: true },
24
+ deepWatch: { type: Boolean, default: false },
24
25
  confirmParams: { type: Function, default: (item) => {
25
26
  return { msg: `确定要删除 ${item.label} 吗?` };
26
27
  } }
@@ -41,10 +42,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
41
42
  const filterMethod = props.filterMethod || ((keyword, item) => {
42
43
  return item.label.toLowerCase().includes(keyword.toLowerCase());
43
44
  });
45
+ const listData = ref([]);
44
46
  const myData = computed(() => {
45
- return filterKeyword.value ? props.data.filter((item) => filterMethod(filterKeyword.value, item)) : props.data;
47
+ return filterKeyword.value ? listData.value.filter((item) => filterMethod(filterKeyword.value, item)) : listData.value;
46
48
  });
47
49
  const isEmpty = computed(() => myData.value.length === 0);
50
+ const propsWatch = watch(() => props.data, (value) => {
51
+ listData.value = value;
52
+ }, { immediate: true, deep: props.deepWatch });
48
53
  function handleClick(item, e) {
49
54
  if (!props.highlightCurrent) {
50
55
  return;
@@ -57,6 +62,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
62
  actived.value = value;
58
63
  }
59
64
  });
65
+ onBeforeUnmount(() => {
66
+ propsWatch.stop();
67
+ });
60
68
  return (_ctx, _cache) => {
61
69
  const _component_ElIcon = ElIcon;
62
70
  return openBlock(), createBlock(Component$1, {
@@ -3,19 +3,39 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  item?(_: {
6
- data: IExplorerListItem<any>;
6
+ data: {
7
+ label: string;
8
+ icon?: string | undefined;
9
+ value: string | number;
10
+ original?: any;
11
+ };
7
12
  index: number;
8
13
  }): any;
9
14
  label?(_: {
10
- data: IExplorerListItem<any>;
15
+ data: {
16
+ label: string;
17
+ icon?: string | undefined;
18
+ value: string | number;
19
+ original?: any;
20
+ };
11
21
  index: number;
12
22
  }): any;
13
23
  action?(_: {
14
- data: IExplorerListItem<any>;
24
+ data: {
25
+ label: string;
26
+ icon?: string | undefined;
27
+ value: string | number;
28
+ original?: any;
29
+ };
15
30
  index: number;
16
31
  }): any;
17
32
  'extra-label'?(_: {
18
- data: IExplorerListItem<any>;
33
+ data: {
34
+ label: string;
35
+ icon?: string | undefined;
36
+ value: string | number;
37
+ original?: any;
38
+ };
19
39
  index: number;
20
40
  }): any;
21
41
  };
@@ -45,6 +65,7 @@ declare const __VLS_component: import('vue').DefineComponent<IExplorerListProps,
45
65
  emptyText: string;
46
66
  highlightCurrent: boolean;
47
67
  actions: ("create" | "modify" | "remove" | "up" | "down" | "action")[];
68
+ deepWatch: boolean;
48
69
  confirmParams: (item: IExplorerListItem) => import('../button/button').IButtonProps["confirm"];
49
70
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
50
71
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -5,7 +5,7 @@ import { IButtonProps } from '../button/button';
5
5
  export interface IExplorerTreeProps {
6
6
  data?: TreeComponentProps['data'];
7
7
  actions?: ('create' | 'modify' | 'remove' | 'up' | 'down' | 'action')[];
8
- treeProps?: TreeComponentProps;
8
+ treeProps?: Partial<TreeComponentProps>;
9
9
  emptyText?: string;
10
10
  defaultExpandAll?: boolean;
11
11
  pending?: boolean;
@@ -14,6 +14,7 @@ export interface IExplorerTreeProps {
14
14
  confirmParams?: (node: Node) => IButtonProps['confirm'];
15
15
  filterMethod?: TreeComponentProps['filterNodeMethod'];
16
16
  highlightCurrent?: boolean;
17
+ deepWatch?: boolean;
17
18
  }
18
19
  export interface IExplorerTreeEmits {
19
20
  (e: 'nodeClick', value: string | number, node: Node, instance: ComponentInternalInstance | null, event: MouseEvent): void;
@@ -3,7 +3,7 @@ import '../../chunk/Gk1J52Yw.mjs';
3
3
  import { E as ElTree } from '../../chunk/eqwEsspo.mjs';
4
4
  import '../../chunk/DBf73TLo.mjs';
5
5
  import '../../chunk/DbhQlaOz.mjs';
6
- import { defineComponent, useTemplateRef, computed, watch, createBlock, openBlock, normalizeClass, withCtx, withDirectives, createElementBlock, createCommentVNode, createVNode, mergeProps, unref, renderSlot, createElementVNode, createTextVNode, toDisplayString, Fragment, renderList, vShow } from 'vue';
6
+ import { defineComponent, useTemplateRef, ref, computed, watch, onBeforeUnmount, createBlock, openBlock, normalizeClass, withCtx, withDirectives, createElementBlock, createCommentVNode, createVNode, mergeProps, unref, renderSlot, createElementVNode, createTextVNode, toDisplayString, Fragment, renderList, vShow } from 'vue';
7
7
  import { Loading } from '@element-plus/icons-vue';
8
8
  import { C as Component$3 } from '../button/button.mjs';
9
9
  import { i as injectExplorerPanelState } from '../explorer-panel/explorer-panel2.mjs';
@@ -27,7 +27,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  return { msg: `确定要删除 ${node.data.label} 吗?` };
28
28
  } },
29
29
  filterMethod: {},
30
- highlightCurrent: { type: Boolean, default: true }
30
+ highlightCurrent: { type: Boolean, default: true },
31
+ deepWatch: { type: Boolean, default: false }
31
32
  },
32
33
  emits: ["nodeClick", "create", "modify", "remove", "up", "down"],
33
34
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -42,8 +43,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
43
  up: { title: "上移", type: "success", icon: "Top" },
43
44
  down: { title: "下移", type: "success", icon: "Bottom" }
44
45
  };
46
+ const treeData = ref();
45
47
  const treeProps = computed(() => ({
46
- data: props.data,
47
48
  emptyText: props.emptyText,
48
49
  defaultExpandAll: props.defaultExpandAll,
49
50
  expandOnClickNode: false,
@@ -61,15 +62,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
62
  function handleNodeClick(data, node, instance, event) {
62
63
  emits("nodeClick", data.value, node, instance, event);
63
64
  }
64
- watch(filterKeyword, (value) => {
65
- treeRef.value?.filter(value);
66
- });
65
+ const filterWatch = watch(filterKeyword, (value) => treeRef.value?.filter(value));
66
+ const propsWatch = watch(() => props.data, (value) => {
67
+ treeData.value = value;
68
+ }, { immediate: true, deep: props.deepWatch });
67
69
  __expose({
68
70
  getTreeRef: () => treeRef.value,
69
71
  setActive: (value, shouldAutoExpandParent = true) => {
70
72
  treeRef.value?.setCurrentKey(value, shouldAutoExpandParent);
71
73
  }
72
74
  });
75
+ onBeforeUnmount(() => {
76
+ filterWatch.stop();
77
+ propsWatch.stop();
78
+ });
73
79
  return (_ctx, _cache) => {
74
80
  const _component_ElTree = ElTree;
75
81
  const _component_ElIcon = ElIcon;
@@ -80,7 +86,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
80
86
  default: withCtx(() => [
81
87
  withDirectives(createVNode(_component_ElTree, mergeProps({
82
88
  ref_key: "treeRef",
83
- ref: treeRef
89
+ ref: treeRef,
90
+ data: unref(treeData)
84
91
  }, { ..._ctx.$attrs, ...unref(treeProps) }, {
85
92
  class: _ctx.$style.tree,
86
93
  "filter-node-method": filterNode,
@@ -140,7 +147,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
147
  ])
141
148
  ]),
142
149
  _: 3
143
- }, 16, ["class"]), [
150
+ }, 16, ["data", "class"]), [
144
151
  [vShow, !__props.loading && !__props.pending]
145
152
  ]),
146
153
  __props.loading ? (openBlock(), createElementBlock("div", {
@@ -2061,6 +2061,7 @@ declare const __VLS_component: import('vue').DefineComponent<IExplorerTreeProps,
2061
2061
  highlightCurrent: boolean;
2062
2062
  defaultExpandAll: boolean;
2063
2063
  actions: ("create" | "modify" | "remove" | "up" | "down" | "action")[];
2064
+ deepWatch: boolean;
2064
2065
  confirmParams: (node: Node) => import('../button/button').IButtonProps["confirm"];
2065
2066
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
2066
2067
  treeRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
package/dist/es/index.mjs CHANGED
@@ -156,7 +156,7 @@ const __vite_glob_0_47 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePr
156
156
  default: _sfc_main$8
157
157
  }, Symbol.toStringTag, { value: 'Module' }));
158
158
 
159
- const version = "1.10.1";
159
+ const version = "1.10.2";
160
160
 
161
161
  const modules = /* #__PURE__ */ Object.assign({"./components/awesome-icon/awesome-icon.vue": __vite_glob_0_0,"./components/backbottom/backbottom.vue": __vite_glob_0_1,"./components/button/button.vue": __vite_glob_0_2,"./components/chat-container/chat-container.vue": __vite_glob_0_3,"./components/choice-boolean/choice-boolean.vue": __vite_glob_0_4,"./components/choice/choice.vue": __vite_glob_0_5,"./components/color-switch/color-switch.vue": __vite_glob_0_6,"./components/config-provider/config-provider.vue": __vite_glob_0_7,"./components/cropper/cropper.vue": __vite_glob_0_8,"./components/currency/currency.vue": __vite_glob_0_9,"./components/dark-switch/dark-switch.vue": __vite_glob_0_10,"./components/daterange-picker/daterange-picker.vue": __vite_glob_0_11,"./components/dialog-camera-upload/dialog-camera-upload.vue": __vite_glob_0_12,"./components/dialog-map-point/dialog-map-point.vue": __vite_glob_0_13,"./components/dialog-upload-images/dialog-upload-images.vue": __vite_glob_0_14,"./components/dialog/dialog.vue": __vite_glob_0_15,"./components/drag-verify/drag-verify.vue": __vite_glob_0_16,"./components/drawer/drawer.vue": __vite_glob_0_17,"./components/easy-pagination/easy-pagination.vue": __vite_glob_0_18,"./components/el-icon/el-icon.vue": __vite_glob_0_19,"./components/explorer-column-table/explorer-column-table.vue": __vite_glob_0_20,"./components/explorer-container/explorer-container.vue": __vite_glob_0_21,"./components/explorer-filter/explorer-filter.vue": __vite_glob_0_22,"./components/explorer-footer/explorer-footer.vue": __vite_glob_0_23,"./components/explorer-form/explorer-form.vue": __vite_glob_0_24,"./components/explorer-list/explorer-list.vue": __vite_glob_0_25,"./components/explorer-modal-form/explorer-modal-form.vue": __vite_glob_0_26,"./components/explorer-panel/explorer-panel.vue": __vite_glob_0_27,"./components/explorer-query/explorer-query.vue": __vite_glob_0_28,"./components/explorer-table/explorer-table.vue": __vite_glob_0_29,"./components/explorer-tools/explorer-tools.vue": __vite_glob_0_30,"./components/explorer-tree/explorer-tree.vue": __vite_glob_0_31,"./components/explorer/explorer.vue": __vite_glob_0_32,"./components/flag/flag.vue": __vite_glob_0_33,"./components/icon-picker/icon-picker.vue": __vite_glob_0_34,"./components/icon/icon.vue": __vite_glob_0_35,"./components/iconify-icon/iconify-icon.vue": __vite_glob_0_36,"./components/image/image.vue": __vite_glob_0_37,"./components/input-number/input-number.vue": __vite_glob_0_38,"./components/input/input.vue": __vite_glob_0_39,"./components/pca-picker/pca-picker.vue": __vite_glob_0_40,"./components/qr-code/qr-code.vue": __vite_glob_0_41,"./components/screenfull/screenfull.vue": __vite_glob_0_42,"./components/scrollbar/scrollbar.vue": __vite_glob_0_43,"./components/select/select.vue": __vite_glob_0_44,"./components/single-player/single-player.vue": __vite_glob_0_45,"./components/splitter-panel/splitter-panel.vue": __vite_glob_0_46,"./components/splitter/splitter.vue": __vite_glob_0_47,"./components/svg-icon/svg-icon.vue": __vite_glob_0_48,"./components/switch/switch.vue": __vite_glob_0_49,"./components/sync-scroll-container/sync-scroll-container.vue": __vite_glob_0_50,"./components/tags/tags.vue": __vite_glob_0_51,"./components/text-ellipsis/text-ellipsis.vue": __vite_glob_0_52,"./components/thousand-input/thousand-input.vue": __vite_glob_0_53,"./components/tinymce/tinymce.vue": __vite_glob_0_54,"./components/transfer-panel/transfer-panel.vue": __vite_glob_0_55,"./components/transfer/transfer.vue": __vite_glob_0_56,"./components/tree-picker/tree-picker.vue": __vite_glob_0_57,"./components/upload-file/upload-file.vue": __vite_glob_0_58});
162
162
  const upper = (_, letter) => letter.toUpperCase();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wfrog/vc-ui",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "packageManager": "pnpm@10.20.0",
5
5
  "description": "vue3 组件库 vc-ui",
6
6
  "author": "wellfrog",