@fmdevui/fm-dev 1.0.82 → 1.0.84

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.
@@ -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;
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, reactive, onMounted, watch, resolveComponent, resolveDirective, createBlock, openBlock, withCtx, withDirectives, createElementBlock, createVNode, createCommentVNode, createTextVNode, toDisplayString, createElementVNode, unref } from 'vue';
1
+ import { defineComponent, useModel, ref, reactive, onMounted, watch, resolveComponent, resolveDirective, createBlock, openBlock, withCtx, withDirectives, createElementBlock, createVNode, createCommentVNode, createTextVNode, toDisplayString, createElementVNode, unref, mergeModels } from 'vue';
2
2
  import { Search, MoreFilled } from '@element-plus/icons-vue';
3
3
  import { useBaseApi } from '../../../api/base/index.mjs';
4
4
 
@@ -12,7 +12,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  name: "FmTree"
13
13
  },
14
14
  __name: "index",
15
- props: {
15
+ props: /* @__PURE__ */ mergeModels({
16
16
  checkStrictly: { type: Boolean, default: true },
17
17
  /**
18
18
  * api service name
@@ -44,10 +44,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
44
44
  type: String,
45
45
  default: "\u7C7B\u578B\u540D\u79F0"
46
46
  }
47
- },
48
- emits: ["node-click"],
47
+ }, {
48
+ "modelValue": {},
49
+ "modelModifiers": {}
50
+ }),
51
+ emits: /* @__PURE__ */ mergeModels(["node-click"], ["update:modelValue"]),
49
52
  setup(__props, { expose: __expose, emit: __emit }) {
50
53
  const props = __props;
54
+ const modeValue = useModel(__props, "modelValue");
51
55
  const filterText = ref("");
52
56
  const treeRef = ref();
53
57
  const state = reactive({
@@ -67,7 +71,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
67
71
  var res = await useBaseApi(props.apiService).get(props.paras, props.apiAction);
68
72
  state.folderData = res.data.result ?? [];
69
73
  if (showLoading) state.loading = false;
70
- return res.data.result ?? [];
74
+ const rtreeData = res.data.result ?? [];
75
+ modeValue.value = rtreeData.length > 0 ? rtreeData[0] : { id: 0, name: "" };
76
+ return rtreeData;
71
77
  };
72
78
  const getCheckedKeys = () => {
73
79
  return treeRef.value.getCheckedKeys();
@@ -89,11 +95,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
89
95
  fetchTreeData();
90
96
  } else if ("rootNode" == command) {
91
97
  treeRef.value?.setCurrentKey();
98
+ modeValue.value = { id: 0, name: "" };
92
99
  emit("node-click", { id: 0, name: "" });
93
100
  }
94
101
  };
95
102
  const emit = __emit;
96
103
  const nodeClick = (node) => {
104
+ modeValue.value = { id: node.id, name: node.name };
97
105
  emit("node-click", { id: node.id, name: node.name });
98
106
  };
99
107
  const setCurrentKey = (key, shouldAutoExpandParent) => {
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fm-dev v1.0.82 */
1
+ /*! fm-dev v1.0.84 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('crypto'), require('url'), require('http'), require('https'), require('util'), require('stream'), require('assert'), require('zlib'), require('element-plus')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vue', 'crypto', 'url', 'http', 'https', 'util', 'stream', 'assert', 'zlib', 'element-plus'], factory) :
@@ -36338,7 +36338,7 @@
36338
36338
  name: "FmTree"
36339
36339
  },
36340
36340
  __name: "index",
36341
- props: {
36341
+ props: /* @__PURE__ */ vue.mergeModels({
36342
36342
  checkStrictly: { type: Boolean, default: true },
36343
36343
  /**
36344
36344
  * api service name
@@ -36370,10 +36370,14 @@
36370
36370
  type: String,
36371
36371
  default: "\u7C7B\u578B\u540D\u79F0"
36372
36372
  }
36373
- },
36374
- emits: ["node-click"],
36373
+ }, {
36374
+ "modelValue": {},
36375
+ "modelModifiers": {}
36376
+ }),
36377
+ emits: /* @__PURE__ */ vue.mergeModels(["node-click"], ["update:modelValue"]),
36375
36378
  setup(__props, { expose: __expose, emit: __emit }) {
36376
36379
  const props = __props;
36380
+ const modeValue = vue.useModel(__props, "modelValue");
36377
36381
  const filterText = vue.ref("");
36378
36382
  const treeRef = vue.ref();
36379
36383
  const state = vue.reactive({
@@ -36393,7 +36397,9 @@
36393
36397
  var res = await useBaseApi(props.apiService).get(props.paras, props.apiAction);
36394
36398
  state.folderData = res.data.result ?? [];
36395
36399
  if (showLoading) state.loading = false;
36396
- return res.data.result ?? [];
36400
+ const rtreeData = res.data.result ?? [];
36401
+ modeValue.value = rtreeData.length > 0 ? rtreeData[0] : { id: 0, name: "" };
36402
+ return rtreeData;
36397
36403
  };
36398
36404
  const getCheckedKeys = () => {
36399
36405
  return treeRef.value.getCheckedKeys();
@@ -36415,11 +36421,13 @@
36415
36421
  fetchTreeData();
36416
36422
  } else if ("rootNode" == command) {
36417
36423
  treeRef.value?.setCurrentKey();
36424
+ modeValue.value = { id: 0, name: "" };
36418
36425
  emit("node-click", { id: 0, name: "" });
36419
36426
  }
36420
36427
  };
36421
36428
  const emit = __emit;
36422
36429
  const nodeClick = (node) => {
36430
+ modeValue.value = { id: node.id, name: node.name };
36423
36431
  emit("node-click", { id: node.id, name: node.name });
36424
36432
  };
36425
36433
  const setCurrentKey = (key, shouldAutoExpandParent) => {