@fmdevui/fm-dev 1.0.82 → 1.0.83

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/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! fm-dev v1.0.82 */
1
+ /*! fm-dev v1.0.83 */
2
2
  import { defineComponent, reactive, computed, watch, resolveComponent, createBlock, openBlock, withCtx, createVNode, createElementVNode, createTextVNode, toDisplayString as toDisplayString$1, withDirectives, createElementBlock, Fragment, renderList, vShow, ref, onMounted, nextTick, normalizeStyle, createCommentVNode, normalizeClass, withModifiers, mergeModels, useModel, effectScope, getCurrentInstance, shallowRef, isRef as isRef$1, inject, onUnmounted, h, Text, markRaw, hasInjectionContext, toRaw as toRaw$1, isReactive as isReactive$1, toRef, unref, getCurrentScope, onScopeDispose, toRefs, resolveDirective, resolveDynamicComponent, useSlots, mergeProps, createSlots, renderSlot, toHandlers, onBeforeUnmount, onUpdated, useAttrs, normalizeProps, guardReactiveProps } from 'vue';
3
3
  import crypto from 'crypto';
4
4
  import require$$0 from 'url';
@@ -36343,7 +36343,7 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
36343
36343
  name: "FmTree"
36344
36344
  },
36345
36345
  __name: "index",
36346
- props: {
36346
+ props: /* @__PURE__ */ mergeModels({
36347
36347
  checkStrictly: { type: Boolean, default: true },
36348
36348
  /**
36349
36349
  * api service name
@@ -36375,10 +36375,14 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
36375
36375
  type: String,
36376
36376
  default: "\u7C7B\u578B\u540D\u79F0"
36377
36377
  }
36378
- },
36379
- emits: ["node-click"],
36378
+ }, {
36379
+ "modelValue": {},
36380
+ "modelModifiers": {}
36381
+ }),
36382
+ emits: /* @__PURE__ */ mergeModels(["node-click"], ["update:modelValue"]),
36380
36383
  setup(__props, { expose: __expose, emit: __emit }) {
36381
36384
  const props = __props;
36385
+ const modeValue = useModel(__props, "modelValue");
36382
36386
  const filterText = ref("");
36383
36387
  const treeRef = ref();
36384
36388
  const state = reactive({
@@ -36398,7 +36402,9 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
36398
36402
  var res = await useBaseApi(props.apiService).get(props.paras, props.apiAction);
36399
36403
  state.folderData = res.data.result ?? [];
36400
36404
  if (showLoading) state.loading = false;
36401
- return res.data.result ?? [];
36405
+ const rtreeData = res.data.result ?? [];
36406
+ modeValue.value = rtreeData.length > 0 ? rtreeData[0].id : 0;
36407
+ return rtreeData;
36402
36408
  };
36403
36409
  const getCheckedKeys = () => {
36404
36410
  return treeRef.value.getCheckedKeys();
@@ -36420,11 +36426,13 @@ var _sfc_main$9 = /* @__PURE__ */ defineComponent({
36420
36426
  fetchTreeData();
36421
36427
  } else if ("rootNode" == command) {
36422
36428
  treeRef.value?.setCurrentKey();
36429
+ modeValue.value = 0;
36423
36430
  emit("node-click", { id: 0, name: "" });
36424
36431
  }
36425
36432
  };
36426
36433
  const emit = __emit;
36427
36434
  const nodeClick = (node) => {
36435
+ modeValue.value = node.id;
36428
36436
  emit("node-click", { id: node.id, name: node.name });
36429
36437
  };
36430
36438
  const setCurrentKey = (key, shouldAutoExpandParent) => {
@@ -1,5 +1,5 @@
1
1
  import { TreeKey } from 'element-plus/es/components/tree/src/tree.type';
2
- import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
3
  import { TreeKey } from 'element-plus';
4
4
  declare const _default: DefineComponent<ExtractPropTypes<{
5
5
  checkStrictly: {
@@ -39,12 +39,16 @@ declare const _default: DefineComponent<ExtractPropTypes<{
39
39
  type: StringConstructor;
40
40
  default: string;
41
41
  };
42
+ modelValue: {
43
+ type: PropType<any>;
44
+ };
42
45
  }>, {
43
46
  fetchTreeData: (showLoading?: boolean) => Promise<any>;
44
47
  getCheckedKeys: () => TreeKey[];
45
48
  setCurrentKey: (key?: TreeKey | undefined, shouldAutoExpandParent?: boolean | undefined) => void;
46
49
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
47
50
  "node-click": (...args: any[]) => void;
51
+ "update:modelValue": (value: any) => void;
48
52
  }, string, PublicProps, Readonly< ExtractPropTypes<{
49
53
  checkStrictly: {
50
54
  type: BooleanConstructor;
@@ -83,8 +87,12 @@ declare const _default: DefineComponent<ExtractPropTypes<{
83
87
  type: StringConstructor;
84
88
  default: string;
85
89
  };
90
+ modelValue: {
91
+ type: PropType<any>;
92
+ };
86
93
  }>> & Readonly<{
87
94
  "onNode-click"?: ((...args: any[]) => any) | undefined;
95
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
88
96
  }>, {
89
97
  placeholder: string;
90
98
  apiService: string;
@@ -787,12 +787,16 @@ declare const FmTree: DefineComponent<ExtractPropTypes<{
787
787
  type: StringConstructor;
788
788
  default: string;
789
789
  };
790
+ modelValue: {
791
+ type: PropType<any>;
792
+ };
790
793
  }>, {
791
794
  fetchTreeData: (showLoading?: boolean) => Promise<any>;
792
795
  getCheckedKeys: () => TreeKey[];
793
796
  setCurrentKey: (key?: TreeKey | undefined, shouldAutoExpandParent?: boolean | undefined) => void;
794
797
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
795
798
  "node-click": (...args: any[]) => void;
799
+ "update:modelValue": (value: any) => void;
796
800
  }, string, PublicProps, Readonly< ExtractPropTypes<{
797
801
  checkStrictly: {
798
802
  type: BooleanConstructor;
@@ -825,8 +829,12 @@ declare const FmTree: DefineComponent<ExtractPropTypes<{
825
829
  type: StringConstructor;
826
830
  default: string;
827
831
  };
832
+ modelValue: {
833
+ type: PropType<any>;
834
+ };
828
835
  }>> & Readonly<{
829
836
  "onNode-click"?: ((...args: any[]) => any) | undefined;
837
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
830
838
  }>, {
831
839
  placeholder: string;
832
840
  apiService: string;
@@ -16,7 +16,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
16
  name: "FmTree"
17
17
  },
18
18
  __name: "index",
19
- props: {
19
+ props: /* @__PURE__ */ vue.mergeModels({
20
20
  checkStrictly: { type: Boolean, default: true },
21
21
  /**
22
22
  * api service name
@@ -48,10 +48,14 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
48
48
  type: String,
49
49
  default: "\u7C7B\u578B\u540D\u79F0"
50
50
  }
51
- },
52
- emits: ["node-click"],
51
+ }, {
52
+ "modelValue": {},
53
+ "modelModifiers": {}
54
+ }),
55
+ emits: /* @__PURE__ */ vue.mergeModels(["node-click"], ["update:modelValue"]),
53
56
  setup(__props, { expose: __expose, emit: __emit }) {
54
57
  const props = __props;
58
+ const modeValue = vue.useModel(__props, "modelValue");
55
59
  const filterText = vue.ref("");
56
60
  const treeRef = vue.ref();
57
61
  const state = vue.reactive({
@@ -71,7 +75,9 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
71
75
  var res = await index.useBaseApi(props.apiService).get(props.paras, props.apiAction);
72
76
  state.folderData = res.data.result ?? [];
73
77
  if (showLoading) state.loading = false;
74
- return res.data.result ?? [];
78
+ const rtreeData = res.data.result ?? [];
79
+ modeValue.value = rtreeData.length > 0 ? rtreeData[0].id : 0;
80
+ return rtreeData;
75
81
  };
76
82
  const getCheckedKeys = () => {
77
83
  return treeRef.value.getCheckedKeys();
@@ -93,11 +99,13 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
93
99
  fetchTreeData();
94
100
  } else if ("rootNode" == command) {
95
101
  treeRef.value?.setCurrentKey();
102
+ modeValue.value = 0;
96
103
  emit("node-click", { id: 0, name: "" });
97
104
  }
98
105
  };
99
106
  const emit = __emit;
100
107
  const nodeClick = (node) => {
108
+ modeValue.value = node.id;
101
109
  emit("node-click", { id: node.id, name: node.name });
102
110
  };
103
111
  const setCurrentKey = (key, shouldAutoExpandParent) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fmdevui/fm-dev",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
4
4
  "description": "Page level components developed based on Element Plus.",
5
5
  "author": "fmdevui",
6
6
  "keywords": [